diff options
author | Treeki <treeki@gmail.com> | 2012-11-02 22:45:11 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-11-02 22:45:11 +0100 |
commit | 13d8853431dfe9066263e870dbdf4ef6980e34cd (patch) | |
tree | b7be55c1c13ccb803cf9507cfbad383512710287 | |
parent | 8cbcdc07ac24767504b6d0d8808ef4841b45cfb1 (diff) | |
download | kamek-13d8853431dfe9066263e870dbdf4ef6980e34cd.tar.gz kamek-13d8853431dfe9066263e870dbdf4ef6980e34cd.zip |
fixed player stunning with bossMegaGoomba
-rw-r--r-- | bossMegaGoomba.yaml | 5 | ||||
-rw-r--r-- | kamek_pal.x | 4 | ||||
-rw-r--r-- | src/bossMegaGoomba.cpp | 47 |
3 files changed, 46 insertions, 10 deletions
diff --git a/bossMegaGoomba.yaml b/bossMegaGoomba.yaml index 6edc7cd..869c2a2 100644 --- a/bossMegaGoomba.yaml +++ b/bossMegaGoomba.yaml @@ -13,3 +13,8 @@ hooks: src_addr_pal: 0x8031B1B4 target_func: 'MGarcNameList' # 0x8031AB4C + sprite num * 0x4 == offset + + - {name: ShakePlayerFix1, type: nop_insn, area_pal: 0x80B601AC} + - {name: ShakePlayerFix2, type: nop_insn, area_pal: [0x80B601F0, 0x80B601F4]} + - {name: ShakePlayerFix1, type: nop_insn, area_pal: 0x80B601AC} + diff --git a/kamek_pal.x b/kamek_pal.x index 66af909..0438488 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -132,8 +132,8 @@ SECTIONS { ShakeScreen = 0x800D8D50; StageScreen = 0x8042A2E8; - ShakePlayers = 0x80B60180; - StopPlayerShake = 0x80B60220; + stunPlayer = 0x80137650; + unstunPlayer = 0x80137790; createChild__13dStageActor_cF6ActorsP13dStageActor_cUiP7Point3dP6S16VecUc = 0x80064680; GameMgrBossEndFunc = 0x8001CDB0; diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index 79ebd34..a6758f4 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -4,8 +4,6 @@ #include <sfx.h> #include "boss.h" -extern "C" void *ShakePlayers(dEn_c *); -extern "C" void *StopPlayerShake(dEn_c *); extern "C" void *StageScreen; const char* MGarcNameList [] = { @@ -87,6 +85,11 @@ class daMegaGoomba_c : public dEn_c { void updateModelMatrices(); + void stunPlayers(); + void unstunPlayers(); + + bool playerStunned[4]; + // bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); // bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther); // bool preYoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); @@ -653,17 +656,17 @@ void daMegaGoomba_c::executeState_Turn() { int frame = (int)(this->animationChr.getCurrentFrame() * 5.0); if ((frame == 100) || (frame == 325) || (frame == 550) || (frame == 775)) { ShakeScreen(StageScreen, 0, 1, 0, 0); - ShakePlayers(this); + stunPlayers(); PlaySound(this, SE_BOSS_MORTON_GROUND_SHAKE); } if (isBigBoss) { if ((frame == 250) || (frame == 500) || (frame == 700) || (frame == 900)) - StopPlayerShake(this); + unstunPlayers(); } else { if ((frame == 200) || (frame == 425) || (frame == 650) || (frame == 875)) - StopPlayerShake(this); + unstunPlayers(); } } void daMegaGoomba_c::endState_Turn() { @@ -709,17 +712,17 @@ void daMegaGoomba_c::executeState_Walk() { int frame = (int)(this->animationChr.getCurrentFrame() * 5.0); if ((frame == 100) || (frame == 325) || (frame == 550) || (frame == 775)) { ShakeScreen(StageScreen, 0, 1, 0, 0); - ShakePlayers(this); + stunPlayers(); PlaySound(this, SE_BOSS_MORTON_GROUND_SHAKE); } if (isBigBoss) { if ((frame == 250) || (frame == 500) || (frame == 700) || (frame == 900)) - StopPlayerShake(this); + unstunPlayers(); } else { if ((frame == 200) || (frame == 425) || (frame == 650) || (frame == 875)) - StopPlayerShake(this); + unstunPlayers(); } if(this->animationChr.isAnimationDone()) { @@ -769,3 +772,31 @@ void daMegaGoomba_c::endState_Walk() { } // } // void daMegaGoomba_c::endState_Outro() { } + + +extern "C" void stunPlayer(void *, int); +extern "C" void unstunPlayer(void *); + +void daMegaGoomba_c::stunPlayers() { + for (int i = 0; i < 4; i++) { + playerStunned[i] = false; + + dStageActor_c *player = GetSpecificPlayerActor(i); + if (player) { + if (player->collMgr.CollidedWithTile() && player->currentZoneID == currentZoneID) { + stunPlayer(player, 1); + playerStunned[i] = true; + } + } + } +} + +void daMegaGoomba_c::unstunPlayers() { + for (int i = 0; i < 4; i++) { + dStageActor_c *player = GetSpecificPlayerActor(i); + if (player && playerStunned[i]) { + unstunPlayer(player); + } + } +} + |