summaryrefslogtreecommitdiff
path: root/src/bossFuzzyBear.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-03-09 01:40:14 -0600
committerColin Noga <Tempus@chronometry.ca>2012-03-09 01:40:14 -0600
commit59624313e01ef4269f2ca27babe522d407e200b0 (patch)
tree3ef69879f19f4eded72a310a94736e151a108cc7 /src/bossFuzzyBear.cpp
parent05d99e2cf552024116356591be0a88bf862b89c9 (diff)
downloadkamek-59624313e01ef4269f2ca27babe522d407e200b0.tar.gz
kamek-59624313e01ef4269f2ca27babe522d407e200b0.zip
Redid all the boss and custom sprite junk, effect list, saved 25 kb - but bosses break
Diffstat (limited to '')
-rw-r--r--src/bossFuzzyBear.cpp348
1 files changed, 102 insertions, 246 deletions
diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp
index 3fe4085..55b907e 100644
--- a/src/bossFuzzyBear.cpp
+++ b/src/bossFuzzyBear.cpp
@@ -3,11 +3,10 @@
#include <g3dhax.h>
#include <sfx.h>
#include <stage.h>
-#include "effects.h"
-#include "player.h"
+#include "boss.h"
-class daFuzzyBear_c : public dEn_c {
+class daFuzzyBear_c : public daBoss {
int onCreate();
int onDelete();
int onExecute();
@@ -35,7 +34,7 @@ class daFuzzyBear_c : public dEn_c {
char roly;
char isInvulnerable;
- dEn_c *Kameck;
+ daKameckDemo *Kameck;
static daFuzzyBear_c *build();
@@ -58,7 +57,7 @@ class daFuzzyBear_c : public dEn_c {
USING_STATES(daFuzzyBear_c);
DECLARE_STATE(Grow);
DECLARE_STATE(Bounce);
- DECLARE_STATE(Needles);
+ // DECLARE_STATE(Needles);
DECLARE_STATE(Spray);
DECLARE_STATE(RolyPoly);
DECLARE_STATE(Wait);
@@ -71,25 +70,10 @@ daFuzzyBear_c *daFuzzyBear_c::build() {
}
-extern "C" void *PlaySound(daFuzzyBear_c *, int soundID);
-extern "C" void *StopSound(int soundID);
-
-extern "C" u32 GenerateRandomNumber(int max);
-extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
-extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daFuzzyBear_c *, Vec pos);
-extern "C" dStageActor_c *GetSpecificPlayerActor(int num);
-
-extern "C" void *StopBGMMusic();
-extern "C" void *StartBGMMusic();
-
-extern "C" void *MakeMarioEnterDemoMode();
-extern "C" void *MakeMarioExitDemoMode();
-extern "C" void *UpdateGameMgr();
-
CREATE_STATE(daFuzzyBear_c, Grow);
CREATE_STATE(daFuzzyBear_c, Bounce);
-CREATE_STATE(daFuzzyBear_c, Needles);
+// CREATE_STATE(daFuzzyBear_c, Needles);
CREATE_STATE(daFuzzyBear_c, Spray);
CREATE_STATE(daFuzzyBear_c, RolyPoly);
CREATE_STATE(daFuzzyBear_c, Wait);
@@ -97,28 +81,15 @@ CREATE_STATE(daFuzzyBear_c, Outro);
-void daFuzzyBear_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
-
- this->dEn_c::playerCollision(apThis, apOther);
- this->_vf220(apOther->owner);
-
- this->isDead = 0;
- this->flags_4FC |= (1<<(31-7));
- if(apOther->owner->which_player < 4) {
- this->counter_504[apOther->owner->which_player] = 0;
- }
-}
-void daFuzzyBear_c::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
- this->playerCollision(apThis, apOther);
-}
+void daFuzzyBear_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
+void daFuzzyBear_c::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
void daFuzzyBear_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
-
if (this->isInvulnerable == 1) { return; }
this->timer = 0;
PlaySound(this, SE_BOSS_KOOPA_FIRE_DISAPP);
- CreateEffect(&apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 102);
+ SpawnEffect("Wm_mr_fireball_hit", 0, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
this->damage++;
if (this->damage > 14) { doStateChange(&StateID_Outro); }
}
@@ -138,7 +109,7 @@ void daFuzzyBear_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhy
mario->doSpriteMovement();
}
void daFuzzyBear_c::collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther) {
- this->collisionCat7_WMWaggleWater(apThis, apOther);
+ this->collisionCat9_RollingObject(apThis, apOther);
}
void daFuzzyBear_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {
@@ -172,7 +143,7 @@ void daFuzzyBear_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhy
PlaySound(this, SE_EMY_BLOW_PAKKUN_DOWN);
- CreateEffect(&blah->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 161);
+ SpawnEffect("Wm_mr_kickhit", 0, &blah->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
if (this->damage > 14) { doStateChange(&StateID_Outro); }
else { doStateChange(&StateID_RolyPoly); }
@@ -191,7 +162,7 @@ void daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *
this->timer = 0;
this->damage += 5;
- CreateEffect(&apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 162);
+ SpawnEffect("Wm_mr_kick_glow", 0, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
if (this->damage > 14) { doStateChange(&StateID_Outro); }
else { doStateChange(&StateID_RolyPoly); }
@@ -199,7 +170,7 @@ void daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *
bool daFuzzyBear_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; }
void daFuzzyBear_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { }
-void daFuzzyBear_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) { }
+void daFuzzyBear_c::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); }
@@ -332,84 +303,27 @@ void daFuzzyBear_c::updateModelMatrices() {
void daFuzzyBear_c::beginState_Grow() {
this->timer = 0;
- // Stop the BGM Music
- StopBGMMusic();
-
- // Set the necessary Flags and make Mario enter Demo Mode
- dStage32C_c::instance->freezeMarioBossFlag = 1;
- WLClass::instance->_4 = 4;
- WLClass::instance->_8 = 0;
-
- MakeMarioEnterDemoMode();
-
- // Make sure to use the correct position
- Vec pos = (Vec){this->pos.x - 124.0, this->pos.y + 104.0, 3564.0};
- S16Vec rot = (S16Vec){0, 0, 0};
-
- // Create And use Kameck
- Kameck = (daKameckDemo*)createChild(KAMECK_FOR_CASTLE_DEMO, (dStageActor_c*)this, 0, &pos, &rot, 0);
- Kameck->doStateChange(&daKameckDemo::StateID_DemoWait);
-
+ SetupKameck(this, Kameck);
this->scale = (Vec){1.0, 1.0, 1.0};
}
void daFuzzyBear_c::executeState_Grow() {
-
- if (this->timer == 130) { Kameck->doStateChange(&daKameckDemo::StateID_DemoSt); }
- if (this->timer == 400) { Kameck->doStateChange(&daKameckDemo::StateID_DemoSt2); }
-
- this->timer = this->timer + 1;
-
- float scaleSpeed, yPosScaling;
-
- if (this->timer == 150) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); }
-
- if ((this->timer > 150) && (this->timer < 230)) {
-
- if (BigBossFuzzyBear == 1) {
- scaleSpeed = 0.025;
- yPosScaling = 25; }
- else {
- scaleSpeed = 0.01875;
- yPosScaling = 18; }
+ this->timer += 1;
- float modifier;
-
- modifier = 1.0 + ((this->timer - 150) * scaleSpeed);
-
- this->scale = (Vec){modifier, modifier, modifier};
- this->pos.y = this->pos.y + (yPosScaling/80);
-
- }
-
- if (this->timer == 360) {
+ bool ret;
+ if (BigBossFuzzyBear == 1) {
+ ret = GrowBoss(this, Kameck, 1.0, 3.0, 25, this->timer); }
+ else {
+ ret = GrowBoss(this, Kameck, 1.0, 2.5, 18, this->timer); }
- Vec tempPos = (Vec){this->pos.x - 40.0, this->pos.y + 120.0, 3564.0};
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 175); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 400); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 401); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 564); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 583); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 754); // 400 & 401 // 564 // 583 // 754 // 958
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 958); // 400 & 401 // 564 // 583 // 754 // 958
+ if (ret) { doStateChange(&StateID_Bounce); }
- }
-
- if (this->timer > 420) { doStateChange(&StateID_Bounce); }
-
}
void daFuzzyBear_c::endState_Grow() {
this->Baseline = this->pos.y;
- // Clean up the flags and Kameck
- dStage32C_c::instance->freezeMarioBossFlag = 0;
- WLClass::instance->_8 = 1;
-
- MakeMarioExitDemoMode();
- StartBGMMusic();
-
- Kameck->Delete(1);
+ CleanupKameck(this, Kameck);
}
@@ -483,7 +397,7 @@ void daFuzzyBear_c::executeState_Bounce() {
}
else if (this->timer == 10) {
Vec tempPos = (Vec){this->pos.x, this->pos.y - wallDistance, 5500.0};
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 66);
+ SpawnEffect("Wm_mr_beachlandsmk", 0, &tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0});
}
else {
float modifier;
@@ -532,76 +446,76 @@ void daFuzzyBear_c::endState_Bounce() { OSReport("No more bouncing."); }
// Needles State - shoots out some black icicles
-void daFuzzyBear_c::beginState_Needles() {
- this->timer = 0;
- this->speed.y = 0;
- this->speed.x = 0;
- OSReport("Fuzzy Needle State Begin");
-}
-void daFuzzyBear_c::executeState_Needles() {
- float origScale;
-
- this->speed.y = 0;
- this->speed.x = 0;
-
- if (BigBossFuzzyBear == 0) {
- origScale = 2.5;
- }
- else {
- origScale = 3.0;
- }
-
- this->timer = this->timer + 1;
- OSReport("Needle Timer: %d", this->timer);
-
- if (this->timer <= 120) {
- this->scale.y = (sin(this->timer * 3.14 / 5.0) / 2.0) + origScale; // 3 shakes per second, exactly 24 shakes overall
- this->scale.x = (sin(this->timer * 3.14 / 5.0) / 2.0) + origScale; // 3 shakes per second, exactly 24 shakes overall
-
- if (this->timer == 30) {
- dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
- spawner->speed.x = -6.0;
- spawner->speed.y = 0.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- }
-
- if (this->timer == 45) {
- dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
- spawner->speed.x = 6.0;
- spawner->speed.y = 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- }
-
- if (this->timer == 60) {
- dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
- spawner->speed.x = 0.0;
- spawner->speed.y = 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- }
-
- if (this->timer == 75) {
- dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
- spawner->speed.x = -6.0;
- spawner->speed.y = 6.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- }
-
- if (this->timer == 90) {
- dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
- spawner->speed.x = -6.0;
- spawner->speed.y = 0.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- }
- }
- else { doStateChange(&StateID_Bounce); }
-
- this->HandleXSpeed();
- this->HandleYSpeed();
-
- this->UpdateObjectPosBasedOnSpeedValuesReal();
-
-}
-void daFuzzyBear_c::endState_Needles() { OSReport("Fuzzy Needle State End"); }
+// void daFuzzyBear_c::beginState_Needles() {
+// this->timer = 0;
+// this->speed.y = 0;
+// this->speed.x = 0;
+// OSReport("Fuzzy Needle State Begin");
+// }
+// void daFuzzyBear_c::executeState_Needles() {
+// float origScale;
+
+// this->speed.y = 0;
+// this->speed.x = 0;
+
+// if (BigBossFuzzyBear == 0) {
+// origScale = 2.5;
+// }
+// else {
+// origScale = 3.0;
+// }
+
+// this->timer = this->timer + 1;
+// OSReport("Needle Timer: %d", this->timer);
+
+// if (this->timer <= 120) {
+// this->scale.y = (sin(this->timer * 3.14 / 5.0) / 2.0) + origScale; // 3 shakes per second, exactly 24 shakes overall
+// this->scale.x = (sin(this->timer * 3.14 / 5.0) / 2.0) + origScale; // 3 shakes per second, exactly 24 shakes overall
+
+// if (this->timer == 30) {
+// dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
+// spawner->speed.x = -6.0;
+// spawner->speed.y = 0.0;
+// spawner->scale = (Vec){1.0, 1.0, 1.0};
+// }
+
+// if (this->timer == 45) {
+// dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
+// spawner->speed.x = 6.0;
+// spawner->speed.y = 6.0;
+// spawner->scale = (Vec){1.0, 1.0, 1.0};
+// }
+
+// if (this->timer == 60) {
+// dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
+// spawner->speed.x = 0.0;
+// spawner->speed.y = 6.0;
+// spawner->scale = (Vec){1.0, 1.0, 1.0};
+// }
+
+// if (this->timer == 75) {
+// dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
+// spawner->speed.x = -6.0;
+// spawner->speed.y = 6.0;
+// spawner->scale = (Vec){1.0, 1.0, 1.0};
+// }
+
+// if (this->timer == 90) {
+// dStageActor_c *spawner = CreateActor(339, 0, this->pos, 0, 0);
+// spawner->speed.x = -6.0;
+// spawner->speed.y = 0.0;
+// spawner->scale = (Vec){1.0, 1.0, 1.0};
+// }
+// }
+// else { doStateChange(&StateID_Bounce); }
+
+// this->HandleXSpeed();
+// this->HandleYSpeed();
+
+// this->UpdateObjectPosBasedOnSpeedValuesReal();
+
+// }
+// void daFuzzyBear_c::endState_Needles() { OSReport("Fuzzy Needle State End"); }
// Spray State - jumps in the air and shakes out some small fuzzies
@@ -702,7 +616,9 @@ void daFuzzyBear_c::executeState_RolyPoly() {
Vec tempPos = (Vec){this->pos.x, this->pos.y - 34.0, 5500.0};
- if (this->timer & 0x1) { CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){0.4, 0.4, 0.4}, 242); }
+ if (this->timer & 0x1) {
+ SpawnEffect("Wm_ob_icehitsmk", 0, &tempPos, &(S16Vec){0,0,0}, &(Vec){0.4, 0.4, 0.4});
+ }
}
if (this->direction == 0) { // is even
@@ -763,8 +679,6 @@ void daFuzzyBear_c::endState_RolyPoly() {
-
-
void daFuzzyBear_c::beginState_Wait() { this->timer = 0;}
void daFuzzyBear_c::executeState_Wait() {
@@ -782,83 +696,25 @@ void daFuzzyBear_c::endState_Wait() { }
void daFuzzyBear_c::beginState_Outro() {
-
- WLClass::instance->_4 = 5;
- WLClass::instance->_8 = 0;
-
- this->removeMyActivePhysics();
- this->timer = 0;
- StopBGMMusic();
-
- dStage32C_c::instance->freezeMarioBossFlag = 1;
-
+ OutroSetup(this);
}
void daFuzzyBear_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
- }
- }
+ if (this->timer > 180) { ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); }
+ if (this->timer == 60) { PlayerVictoryCries(this); }
this->timer += 1;
return;
}
- if (this->scale.x > 0.1) {
-
- PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST);
-
- // 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;
+ bool ret;
+ ret = ShrinkBoss(this, &this->pos, 2.75, this->timer);
- 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;
- }
+ if (ret) { BossExplode(this, &this->pos); }
- this->timer += 1;
- }
- 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;
+ this->timer += 1;
- PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR);
- MakeMarioEnterDemoMode();
- }
}
void daFuzzyBear_c::endState_Outro() { }