summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTreeki <treeki@gmail.com>2011-09-17 00:55:14 +0200
committerTreeki <treeki@gmail.com>2011-09-17 00:55:14 +0200
commit7a01ebfe271008804af099444b61498246594351 (patch)
tree86b04fe121e7ccb7a95d3eaa5f2a1adf42fb6e61 /src
parent3f51fed7227c3a409efd3fb8a38a63b709d9cca3 (diff)
downloadkamek-7a01ebfe271008804af099444b61498246594351.tar.gz
kamek-7a01ebfe271008804af099444b61498246594351.zip
Mr Sun converted to C++. untested but compiles
Diffstat (limited to 'src')
-rwxr-xr-xsrc/mrsun.cpp27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/mrsun.cpp b/src/mrsun.cpp
index b246131..668a789 100755
--- a/src/mrsun.cpp
+++ b/src/mrsun.cpp
@@ -1,24 +1,36 @@
#include <common.h>
-#include <g3dhax.h>
#include <game.h>
+#include <g3dhax.h>
-class dMrSun_c : public dEn_c {
+class daMrSun_c : public dEn_c {
int onCreate();
int onDelete();
int onExecute();
int onDraw();
mHeapAllocator_c allocator;
+ m3d::mdl_c model;
- static dMrSun_c *build();
+ static daMrSun_c *build();
};
+daMrSun_c *daMrSun_c::build() {
+ void *buffer = AllocFromGameHeap1(sizeof(daMrSun_c));
+ return new(buffer) daMrSun_c;
+}
+
#define ACTIVATE 1
#define DEACTIVATE 0
-int dMrSun_c::onCreate() {
+int daMrSun_c::onCreate() {
OSReport("Creating the Mr.Sun Model");
+ allocator.link(-1, GameHeaps[0], 0, 0x20);
+
+ nw4r::g3d::ResFile rf(getResource("g3d/bubble.brres", "bubble"));
+ model.setup(rf.GetResMdl("bubble"), &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&model, 0);
+ allocator.unlink();
OSReport("Setting Mr.Sun's Size to 4.0");
this->scale = (Vec){4.0, 4.0, 4.0};
@@ -47,16 +59,17 @@ int dMrSun_c::onCreate() {
return true;
}
-int dMrSun_c::onDelete() {
+int daMrSun_c::onDelete() {
return true;
}
-int dMrSun_c::onExecute() {
+int daMrSun_c::onExecute() {
OSReport("Oh Mr.Sun, Sun, Mr.Golden Sun");
return true;
}
-int dMrSun_c::onDraw() {
+int daMrSun_c::onDraw() {
+ model.scheduleForDrawing();
return true;
}