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 /src | |
parent | 8cbcdc07ac24767504b6d0d8808ef4841b45cfb1 (diff) | |
download | kamek-13d8853431dfe9066263e870dbdf4ef6980e34cd.tar.gz kamek-13d8853431dfe9066263e870dbdf4ef6980e34cd.zip |
fixed player stunning with bossMegaGoomba
Diffstat (limited to 'src')
-rw-r--r-- | src/bossMegaGoomba.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
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); + } + } +} + |