From 9b1df8223e713762897d4a8a8508d0c4843570ee Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Wed, 21 Sep 2011 17:45:08 -0500 Subject: Respawning and death anim slowdown for Mr.Sun --- src/mrsun.cpp | 74 +++++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 22 deletions(-) diff --git a/src/mrsun.cpp b/src/mrsun.cpp index 0fc3d05..88dd7fd 100755 --- a/src/mrsun.cpp +++ b/src/mrsun.cpp @@ -31,25 +31,22 @@ class daMrSun_c : public dEn_c { short spinReduceZ; short spinReduceY; float spinStateOn; + int dying; + char sunDying; - + void dieFall_Execute(); static daMrSun_c *build(); void updateModelMatrices(); - void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); - void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); +// void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); +// void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); - void dieFumi_Begin(); - void dieFumi_Execute(); - void dieFumi_End(); - - USING_STATES(daMrSun_c); DECLARE_STATE(Follow); DECLARE_STATE(Swoop); @@ -86,26 +83,57 @@ CREATE_STATE(daMrSun_c, Wait); #define DEACTIVATE 0 -void daMrSun_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Player"); } -void daMrSun_c::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Yoshi"); } - void daMrSun_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Fireball"); } -void daMrSun_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Iceball"); } -void daMrSun_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Rolling Object"); doStateChange(&StateID_Wait); } +void daMrSun_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { + OSReport("Hit Iceball"); + if (this->settings == 0) { // It's a sun + if (this->sunDying == 5) { + doStateChange(&StateID_DieIceVanish); } + else { + this->sunDying = this->sunDying + 1; } + } } +void daMrSun_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { + OSReport("Hit Rolling Object"); + this->timer = 0; + doStateChange(&StateID_DieFall); } void daMrSun_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { - OSReport("Hit Hammer"); - doStateChange(&StateID_Wait); -} + OSReport("Hit Hammer"); + this->timer = 0; + doStateChange(&StateID_DieFall); } void daMrSun_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Yoshi Fire"); } -void daMrSun_c::dieFumi_Begin() { this->dieFall_Begin(); } -void daMrSun_c::dieFumi_Execute() { this->dieFall_Execute(); } -void daMrSun_c::dieFumi_End() { this->dieFall_End(); } - - - +void daMrSun_c::dieFall_Execute() { + + this->timer = this->timer + 1; + + + this->dying = this->dying + 0.15; + + this->pos.x = this->pos.x + 0.15; + this->pos.y = this->pos.y + ((-0.2 * (this->dying*this->dying)) + 5); + + this->dEn_c::dieFall_Execute(); + + + if (this->timer > 450) { + dStageActor_c *Player = GetSpecificPlayerActor(0); + if (Player == 0) { Player = GetSpecificPlayerActor(1); } + if (Player == 0) { Player = GetSpecificPlayerActor(2); } + if (Player == 0) { Player = GetSpecificPlayerActor(3); } + + Player->pos; + + this->pos.x = Player->pos.x - 300; + if (Player == 0) { + this->pos.x = 0; + doStateChange(&StateID_Follow); } + this->pos.y = this->Baseline; + + doStateChange(&StateID_Follow); + } +} int daMrSun_c::onCreate() { @@ -174,6 +202,8 @@ int daMrSun_c::onCreate() { this->timer = 0; this->xSpiralOffset = 0.0; this->ySpiralOffset = 0.0; + this->dying = -15; + this->sunDying = 0; this->pos.z = 3300.00; -- cgit v1.2.3