#include #include #include class daMrSun_c : public dEn_c { int onCreate(); int onDelete(); int onExecute(); int onDraw(); mHeapAllocator_c allocator; m3d::mdl_c model; static daMrSun_c *build(); void updateModelMatrix(); USING_STATES(daMrSun_c); DECLARE_STATE(Follow); DECLARE_STATE(Swoop); DECLARE_STATE(Spiral); DECLARE_STATE(Spit); DECLARE_STATE(Spin); }; daMrSun_c *daMrSun_c::build() { void *buffer = AllocFromGameHeap1(sizeof(daMrSun_c)); return new(buffer) daMrSun_c; } CREATE_STATE(daMrSun_c, Follow); CREATE_STATE(daMrSun_c, Swoop); CREATE_STATE(daMrSun_c, Spiral); CREATE_STATE(daMrSun_c, Spit); CREATE_STATE(daMrSun_c, Spin); #define ACTIVATE 1 #define DEACTIVATE 0 int daMrSun_c::onCreate() { OSReport("Creating the Mr.Sun Model"); allocator.link(-1, GameHeaps[0], 0, 0x20); nw4r::g3d::ResFile rf(getResource("bubble", "g3d/t00.brres")); 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}; OSReport("Creating Mr.Sun's Physics Struct"); ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 0.0; HitMeBaby.yDistToCenter = 0.0; HitMeBaby.xDistToEdge = 8.0; HitMeBaby.yDistToEdge = 8.0; HitMeBaby.category1 = 0x3; HitMeBaby.category2 = 0x0; HitMeBaby.bitfield1 = 0x4F; HitMeBaby.bitfield2 = 0x820C; HitMeBaby.unkShort1C = 0; HitMeBaby.callback = &dEn_c::collisionCallback; OSReport("Making the Physics Class and adding to the list"); this->aPhysics.initWithStruct(this, &HitMeBaby); this->aPhysics.addToList(); doStateChange(&StateID_Follow); OSReport("Going to Execute Mr.Sun"); this->onExecute(); return true; } int daMrSun_c::onDelete() { return true; } int daMrSun_c::onExecute() { //OSReport("Oh Mr.Sun, Sun, Mr.Golden Sun"); acState.execute(); updateModelMatrix(); return true; } int daMrSun_c::onDraw() { model.scheduleForDrawing(); return true; } void daMrSun_c::updateModelMatrix() { // This won't work with wrap because I'm lazy. matrix.translation(pos.x, pos.y, pos.z); matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); model.setDrawMatrix(matrix); model.setScale(&scale); model.calcWorld(false); } void daMrSun_c::beginState_Follow() { } void daMrSun_c::executeState_Follow() { } void daMrSun_c::endState_Follow() { } void daMrSun_c::beginState_Swoop() { } void daMrSun_c::executeState_Swoop() { } void daMrSun_c::endState_Swoop() { } void daMrSun_c::beginState_Spiral() { } void daMrSun_c::executeState_Spiral() { } void daMrSun_c::endState_Spiral() { } void daMrSun_c::beginState_Spit() { } void daMrSun_c::executeState_Spit() { } void daMrSun_c::endState_Spit() { } void daMrSun_c::beginState_Spin() { } void daMrSun_c::executeState_Spin() { } void daMrSun_c::endState_Spin() { }