diff options
Diffstat (limited to 'src/bossThwompaDomp.cpp')
-rw-r--r-- | src/bossThwompaDomp.cpp | 223 |
1 files changed, 118 insertions, 105 deletions
diff --git a/src/bossThwompaDomp.cpp b/src/bossThwompaDomp.cpp index 3a1b0c7..fb8d59e 100644 --- a/src/bossThwompaDomp.cpp +++ b/src/bossThwompaDomp.cpp @@ -5,26 +5,26 @@ #include <stage.h> #include "effects.h" +// Externs + extern "C" int posIsInZone(Vec,float*,float*,u8 zone); + extern "C" void* ScreenPositionClass; + extern "C" void ShakeScreen(void*,int,int,int,int); // (ScreenPositionClass, some other ints - set the second one to 1 to shake it) + extern "C" int SpawnThwompEffects(dEn_c *); -extern "C" int posIsInZone(Vec,float*,float*,u8 zone); -extern "C" void* ScreenPositionClass; -extern "C" void ShakeScreen(void*,int,int,int,int); // (ScreenPositionClass, some other ints - set the second one to 1 to shake it) -extern "C" int SpawnThwompEffects(dEn_c *); + extern "C" void* SoundRelatedClass; + extern "C" Vec ConvertStagePositionIntoScreenPosition__Maybe(Vec); + extern "C" void AnotherSoundRelatedFunction(void*,SFX,Vec,int); -extern "C" void* SoundRelatedClass; -extern "C" Vec ConvertStagePositionIntoScreenPosition__Maybe(Vec); -extern "C" void AnotherSoundRelatedFunction(void*,SFX,Vec,int); + extern "C" void *PlaySound(dEn_c *, int soundID); + extern "C" void *PlaySoundAsync(dEn_c *, int soundID); + extern "C" dStageActor_c *GetSpecificPlayerActor(int number); -extern "C" void *PlaySound(dEn_c *, int soundID); -extern "C" void *PlaySoundAsync(dEn_c *, int soundID); -extern "C" dStageActor_c *GetSpecificPlayerActor(int number); + extern "C" void *StopBGMMusic(); + extern "C" void *StartBGMMusic(); -extern "C" void *StopBGMMusic(); -extern "C" void *StartBGMMusic(); - -extern "C" void *MakeMarioEnterDemoMode(); -extern "C" void *MakeMarioExitDemoMode(); -extern "C" void *UpdateGameMgr(); + extern "C" void *MakeMarioEnterDemoMode(); + extern "C" void *MakeMarioExitDemoMode(); + extern "C" void *UpdateGameMgr(); class daEnMegaDosun_c : public dEn_c { @@ -53,6 +53,8 @@ class daEnMegaDosun_c : public dEn_c { float leftBuffer; float rightBuffer; float topBuffer; + bool isOutofScreen; + Vec OutOfScreenPosition; dEn_c *Kameck; @@ -77,14 +79,15 @@ class daEnMegaDosun_c : public dEn_c { DECLARE_STATE(Outro); }; -CREATE_STATE(daEnMegaDosun_c, UpWait); -CREATE_STATE(daEnMegaDosun_c, DownMoveWait); -CREATE_STATE(daEnMegaDosun_c, PuruMove); -CREATE_STATE(daEnMegaDosun_c, DownMove); -CREATE_STATE(daEnMegaDosun_c, DownWait); -CREATE_STATE(daEnMegaDosun_c, UpMove); -CREATE_STATE(daEnMegaDosun_c, Grow); -CREATE_STATE(daEnMegaDosun_c, Outro); +// States + CREATE_STATE(daEnMegaDosun_c, UpWait); + CREATE_STATE(daEnMegaDosun_c, DownMoveWait); + CREATE_STATE(daEnMegaDosun_c, PuruMove); + CREATE_STATE(daEnMegaDosun_c, DownMove); + CREATE_STATE(daEnMegaDosun_c, DownWait); + CREATE_STATE(daEnMegaDosun_c, UpMove); + CREATE_STATE(daEnMegaDosun_c, Grow); + CREATE_STATE(daEnMegaDosun_c, Outro); daEnMegaDosun_c *daEnMegaDosun_c::build() { void *buffer = AllocFromGameHeap1(sizeof(daEnMegaDosun_c)); @@ -102,18 +105,17 @@ daEnMegaDosun_c *daEnMegaDosun_c::build() { void daEnMegaDosun_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) { } - void daEnMegaDosun_c::setupBodyModel() { allocator.link(-1, GameHeaps[0], 0, 0x20); - this->resFile.data = getResource("dossun", "g3d/dossun.brres"); + this->resFile.data = getResource("dossun", "g3d/t00.brres"); nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("dossun_big"); bodyModel.setup(mdl, &allocator, 0x60, 1, 0); SetupTextures_Enemy(&bodyModel, 0); - // nw4r::g3d::ResAnmVis anmRes = this->resFile.GetResAnmVis("dossun_big"); - // this->anmVis.setup(mdl, anmRes, &this->allocator, 0); - // this->anmVis.bind(&bodyModel, anmRes, 1); + nw4r::g3d::ResAnmVis anmRes = this->resFile.GetResAnmVis("dossun_big"); + this->anmVis.setup(mdl, anmRes, &this->allocator, 0); + this->anmVis.bind(&bodyModel, anmRes, 1); allocator.unlink(); } @@ -153,9 +155,9 @@ int daEnMegaDosun_c::onCreate() { OSReport("this->collMgr.Init(this,(u8*)&this->collision_struct,(u8*)&s3,0);\n"); this->collMgr.Init(this,(u8*)&this->collision_struct,(u8*)&s3,0); - // this->pos_delta2.x = 0.0; - // this->pos_delta2.y = 36.0; - // this->pos_delta2.z = 0.0; + this->pos_delta2.x = 0.0; + this->pos_delta2.y = 36.0; + this->pos_delta2.z = 0.0; this->_320 = 0.0; this->_324 = 48.0; @@ -175,11 +177,20 @@ int daEnMegaDosun_c::onCreate() { this->notFalling = 0; this->direction = 0; this->countdownTimer = 0; + this->isOutofScreen = false; // Measured in half tiles - this->leftBuffer = this->pos.x - ((float)((this->settings >> 24) & 0xFF) * 8.0); //nyb 5-6 LEFT - this->rightBuffer = this->pos.x + ((float)((this->settings >> 16) & 0xFF) * 8.0); //nyb 7-8 RIGHT - this->topBuffer = this->pos.y + ((float)((this->settings >> 8) & 0xFF) * 8.0); //nyb 9-10 TOP + this->leftBuffer = this->pos.x - (((float)((this->settings >> 24) & 0xFF) - 5.0) * 8.0); //nyb 5-6 LEFT + this->rightBuffer = this->pos.x + (((float)((this->settings >> 16) & 0xFF) - 3.0) * 8.0); //nyb 7-8 RIGHT + this->topBuffer = this->pos.y + (((float)((this->settings >> 8) & 0xFF) - 8.0) * 8.0); //nyb 9-10 TOP + + + // Boss Thwomp settings + // + // nybble 5-6 - Left Buffer in half tiles (minimum is 5 due to thwomp width) + // nybble 7-8 - Left Buffer in half tiles (minimum is 3 due to thwomp width) + // nybble 9-10 - Top Buffer in half tiles (minimum is 8 due to thwomp height) + // this->doStateChange(&StateID_Grow); @@ -188,14 +199,19 @@ int daEnMegaDosun_c::onCreate() { return true; } - int daEnMegaDosun_c::onExecute() { acState.execute(); - int ret = this->checkZoneBoundaries(0); - if(ret) { - OSReport("daEnMegaDosun_c has left the building\n"); - doStateChange(&StateID_Outro); + if (this->isOutofScreen == false) { + float rect[] = {this->_320, this->_324, this->spriteSomeRectX, this->spriteSomeRectY}; + int ret = this->outOfZone(this->pos, (float*)&rect, this->currentZoneID); + if(ret) { + OSReport("daEnMegaDosun_c has left the building\n"); + this->OutOfScreenPosition = this->pos; + + this->isOutofScreen = true; + doStateChange(&StateID_Outro); + } } return true; @@ -214,6 +230,7 @@ int daEnMegaDosun_c::onDraw() { } int daEnMegaDosun_c::onDelete() { + OSReport("Deleting Thwompy\n"); return true; } @@ -307,14 +324,20 @@ int daEnMegaDosun_c::onDelete() { } if (this->pos.x > this->rightBuffer) { + CreateEffect(&(Vec){this->pos.x + 38.0, this->pos.y + 32.0, 5500.0}, &(S16Vec){0,0,0x4000}, &(Vec){1.0, 1.0, 1.0}, 364); + PlaySoundAsync(this, SE_OBJ_TEKKYU_G_CRASH); + this->direction = 0; } if (this->pos.x < this->leftBuffer) { + CreateEffect(&(Vec){this->pos.x - 40.0, this->pos.y + 32.0, 5500.0}, &(S16Vec){0,0,0xC000}, &(Vec){1.0, 1.0, 1.0}, 364); + PlaySoundAsync(this, SE_OBJ_TEKKYU_G_CRASH); + this->direction = 1; } - this->pos.x += (direction) ? -0.5 : 0.5; + this->pos.x += (direction) ? 0.9 : -0.9; if (this->notFalling == 0) { if(this->CheckIfPlayerBelow(40.0, 256.0)) { @@ -336,13 +359,13 @@ int daEnMegaDosun_c::onDelete() { // StateID_DownMoveWait void daEnMegaDosun_c::beginState_DownMoveWait() { - // this->anmVis.playState = 1; + this->anmVis.playState = 1; this->bodyModel.bindAnim(&this->anmVis, 0.5); } void daEnMegaDosun_c::executeState_DownMoveWait() { - // if(this->anmVis.isAnimationDone()) - // this->doStateChange(&StateID_PuruMove); - // this->anmVis.process(); + if(this->anmVis.isAnimationDone()) + this->doStateChange(&StateID_PuruMove); + this->anmVis.process(); } void daEnMegaDosun_c::endState_DownMoveWait() { return; @@ -421,13 +444,14 @@ int daEnMegaDosun_c::onDelete() { if(this->countdownTimer == 0) { this->doStateChange(&StateID_UpMove); } - else{ + else { this->countdownTimer--; - // if(this->countdownTimer & 0xff == 0x20) - // this->anmVis.playState = 3; + if(this->countdownTimer == 0x20) { + this->anmVis.playState = 3; + } } - // this->anmVis.process(); + this->anmVis.process(); } void daEnMegaDosun_c::endState_DownWait() { return; @@ -443,10 +467,11 @@ int daEnMegaDosun_c::onDelete() { if (this->pos.y > this->topBuffer) { this->doStateChange(&StateID_UpWait); + PlaySoundAsync(this, SE_OBJ_TEKKYU_L_CRASH); this->countdownTimer = 0xc; } else { - this->pos.y += 0.5; + this->pos.y += 1.5; } } void daEnMegaDosun_c::endState_UpMove() { @@ -455,6 +480,7 @@ int daEnMegaDosun_c::onDelete() { // Outro void daEnMegaDosun_c::beginState_Outro() { + OSReport("Outro Being\n"); WLClass::instance->_4 = 5; WLClass::instance->_8 = 0; @@ -465,72 +491,59 @@ int daEnMegaDosun_c::onDelete() { dStage32C_c::instance->freezeMarioBossFlag = 1; + this->speed.y = 0.0; + this->y_speed_inc = 0.0; } void daEnMegaDosun_c::executeState_Outro() { - if (this->dying == 1) { - if (this->timer > 180) { - ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); - } - - if (this->timer == 60) { - - UpdateGameMgr(); - - if (GetSpecificPlayerActor(0) != 0) { - PlaySound(this, SE_VOC_MA_CLEAR_BOSS); - // Send PlBase into DemoGoal State here, kthxbai - } - - if (GetSpecificPlayerActor(1) != 0) { - PlaySound(this, SE_VOC_LU_CLEAR_BOSS); - // Send PlBase into DemoGoal State here, kthxbai - } - - if (GetSpecificPlayerActor(2) != 0) { - PlaySound(this, SE_VOC_KO_CLEAR_BOSS); - // Send PlBase into DemoGoal State here, kthxbai - } - - if (GetSpecificPlayerActor(3) != 0) { - PlaySound(this, SE_VOC_KO2_CLEAR_BOSS); - // Send PlBase into DemoGoal State here, kthxbai - } - } - - this->timer += 1; - return; - } + this->pos.y = this->OutOfScreenPosition.y + 280.0; - if (this->scale.x > 0.1) { + if (this->timer == 0) { + OSReport("Outro Play Sound\n"); PlaySound(this, SE_EMY_BIG_DOSSUN_DEAD); - // Adjust this to equal the scale of your boss / 80. - this->scale.x -= 0.015; - this->scale.y -= 0.015; - this->scale.z -= 0.015; - - if (this->timer == 30) { - CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 756); - CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 801); - CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 957); - this->timer = 0; - } - - this->timer += 1; + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 988); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 989); } - else { - this->scale.x = 0.0; - this->scale.y = 0.0; - this->scale.z = 0.0; - - CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 588); - this->dying = 1; - this->timer = 0; + if (this->timer == 60) { + OSReport("Outro Play Fanfare\n"); PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR); MakeMarioEnterDemoMode(); } + + if (this->timer == 120) { + OSReport("Outro Play Victory Cry\n"); + + UpdateGameMgr(); + + if (GetSpecificPlayerActor(0) != 0) { + PlaySound(this, SE_VOC_MA_CLEAR_BOSS); + // Send PlBase into DemoGoal State here, kthxbai + } + + if (GetSpecificPlayerActor(1) != 0) { + PlaySound(this, SE_VOC_LU_CLEAR_BOSS); + // Send PlBase into DemoGoal State here, kthxbai + } + + if (GetSpecificPlayerActor(2) != 0) { + PlaySound(this, SE_VOC_KO_CLEAR_BOSS); + // Send PlBase into DemoGoal State here, kthxbai + } + + if (GetSpecificPlayerActor(3) != 0) { + PlaySound(this, SE_VOC_KO2_CLEAR_BOSS); + // Send PlBase into DemoGoal State here, kthxbai + } + } + + if (this->timer > 240) { + OSReport("Outro Out\n"); + ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); + } + + this->timer += 1; } void daEnMegaDosun_c::endState_Outro() { } |