From 7a01ebfe271008804af099444b61498246594351 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 17 Sep 2011 00:55:14 +0200 Subject: Mr Sun converted to C++. untested but compiles --- src/mrsun.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'src/mrsun.cpp') 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 -#include #include +#include -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; } -- cgit v1.2.3