summaryrefslogtreecommitdiff
path: root/src/bossFuzzyBear.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-10-09 01:48:06 -0500
committerColin Noga <Tempus@Spectrum-Song.local>2011-10-09 01:48:06 -0500
commitd4ba9bf11d4786c4df5e94c5241492c4eb43c2b6 (patch)
tree4afe8cd5a8fe9c8eba3031cc20a02ed08a0c9b43 /src/bossFuzzyBear.cpp
parentf35befab481e013d76631baf6abec5f69ff703a6 (diff)
downloadkamek-d4ba9bf11d4786c4df5e94c5241492c4eb43c2b6.tar.gz
kamek-d4ba9bf11d4786c4df5e94c5241492c4eb43c2b6.zip
Added a whole bunch of boss crap, soundplayers, retextures, and some mrsun improvements.
Diffstat (limited to '')
-rw-r--r--src/bossFuzzyBear.cpp259
1 files changed, 178 insertions, 81 deletions
diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp
index 6b0fab0..65e6ab6 100644
--- a/src/bossFuzzyBear.cpp
+++ b/src/bossFuzzyBear.cpp
@@ -1,6 +1,7 @@
#include <common.h>
#include <game.h>
#include <g3dhax.h>
+#include <sfx.h>
class daFuzzyBear_c : public dEn_c {
int onCreate();
@@ -25,7 +26,8 @@ class daFuzzyBear_c : public dEn_c {
Vec RolyPos;
char falldown;
char damage;
- char fireballs;
+ char roly;
+ char isInvulnerable;
void dieBigFall_Execute();
static daFuzzyBear_c *build();
@@ -46,6 +48,7 @@ class daFuzzyBear_c : public dEn_c {
DECLARE_STATE(Needles);
DECLARE_STATE(Spray);
DECLARE_STATE(RolyPoly);
+ DECLARE_STATE(Wait);
};
daFuzzyBear_c *daFuzzyBear_c::build() {
@@ -57,6 +60,9 @@ daFuzzyBear_c *daFuzzyBear_c::build() {
extern "C" void *HandleXSpeed(daFuzzyBear_c *);
extern "C" void *HandleYSpeed(daFuzzyBear_c *);
extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daFuzzyBear_c *);
+extern "C" void *doSpriteMovement(dEn_c *);
+extern "C" void *PlaySound(daFuzzyBear_c *, 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);
@@ -71,6 +77,7 @@ CREATE_STATE(daFuzzyBear_c, Bounce);
CREATE_STATE(daFuzzyBear_c, Needles);
CREATE_STATE(daFuzzyBear_c, Spray);
CREATE_STATE(daFuzzyBear_c, RolyPoly);
+CREATE_STATE(daFuzzyBear_c, Wait);
#define ACTIVATE 1
@@ -78,27 +85,65 @@ CREATE_STATE(daFuzzyBear_c, RolyPoly);
void daFuzzyBear_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
+
this->_vf220(apOther->owner);
OSReport("I hit Mario.");
}
void daFuzzyBear_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
+
+ if (this->isInvulnerable == 1) { return; }
+
OSReport("Hit Fireball");
this->timer = 0;
- this->fireballs = this->fireballs + 1;
- if (this->fireballs > 4) { this->damage = this->damage + 1; }
- if (this->damage > 2) { doStateChange(&StateID_DieBigFall); }
+ PlaySound(this, SE_BOSS_KOOPA_FIRE_DISAPP);
+ this->damage++;
+ if (this->damage > 14) { doStateChange(&StateID_DieBigFall); }
}
bool daFuzzyBear_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Iceball"); return false; }
void daFuzzyBear_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {
OSReport("Hit Rolling Object");
+
+ if (this->isInvulnerable == 1) { return; }
+
+
this->timer = 0;
- this->damage = this->damage + 1;
- if (this->damage > 2) { doStateChange(&StateID_DieBigFall); } }
+ this->damage = this->damage + 5;
+
+ dActor_c *block = apOther->owner;
+ dEn_c *blah = (dEn_c*)block;
+
+ this->pos.x += blah->speed.x;
+
+ blah->speed.x = -blah->speed.x;
+ blah->pos.x += blah->speed.x;
+
+ if (blah->direction == 0) { blah->direction = 1; this->roly = 0; }
+ else { blah->direction = 0; this->roly = 1; }
+
+ if (blah->speed.y < 0) {
+ blah->speed.y = -blah->speed.y; }
+
+ doSpriteMovement(blah);
+ doSpriteMovement(blah);
+
+ PlaySound(this, SE_EMY_BLOW_PAKKUN_DOWN);
+
+
+ if (this->damage > 14) { doStateChange(&StateID_DieBigFall); }
+ else { doStateChange(&StateID_RolyPoly); }
+}
void daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
+
+ if (this->isInvulnerable == 1) { return; }
+
+ PlaySound(this, SE_EMY_BIG_PAKKUN_DAMAGE_1);
OSReport("Hit Hammer");
this->timer = 0;
- this->damage = this->damage + 1;
- if (this->damage > 2) { doStateChange(&StateID_DieBigFall); } }
+ this->damage += 3;
+
+ if (this->damage > 14) { doStateChange(&StateID_DieBigFall); }
+ else { doStateChange(&StateID_RolyPoly); }
+}
void daFuzzyBear_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Yoshi Fire"); }
@@ -139,18 +184,16 @@ int daFuzzyBear_c::onCreate() {
HitMeBaby.yDistToCenter = 0.0;
if (BigBossFuzzyBear == 0) {
+ HitMeBaby.xDistToEdge = 32.0;
+ HitMeBaby.yDistToEdge = 32.0; }
+ else {
HitMeBaby.xDistToEdge = 38.0;
HitMeBaby.yDistToEdge = 38.0; }
- else {
- HitMeBaby.xDistToEdge = 50.0;
- HitMeBaby.yDistToEdge = 50.0; }
- HitMeBaby.category1 = 0x7;
+ HitMeBaby.category1 = 0x3;
HitMeBaby.category2 = 0x0;
- HitMeBaby.bitfield1 = 0x0;
- HitMeBaby.bitfield2 = 0x0;
-// HitMeBaby.bitfield1 = 0x4F;
-// HitMeBaby.bitfield2 = 0x828E;
+ HitMeBaby.bitfield1 = 0x4F;
+ HitMeBaby.bitfield2 = 0x8828E;
HitMeBaby.unkShort1C = 0;
HitMeBaby.callback = &dEn_c::collisionCallback;
@@ -177,8 +220,9 @@ int daFuzzyBear_c::onCreate() {
this->initialPos = this->pos;
this->storeSpeed = 0;
this->falldown = 0;
- this->fireballs = 0;
+ this->roly = 0;
this->damage = 0;
+ this->isInvulnerable = 0;
OSReport("Setting Fuzzy Bear's State");
doStateChange(&StateID_Grow);
@@ -279,6 +323,7 @@ void daFuzzyBear_c::updateModelMatrices() {
void daFuzzyBear_c::beginState_Grow() {
OSReport("Growing when Kameck Tells me to.");
this->timer = 0;
+// PlaySound(this, SE_BOSS_ROY_MAGIC_MAKE_FAST);
}
void daFuzzyBear_c::executeState_Grow() {
@@ -288,12 +333,12 @@ void daFuzzyBear_c::executeState_Grow() {
float scaleSpeed, yPosScaling;
if ((this->timer > 60) && (this->timer < 140)) {
- if (BigBossFuzzyBear == 0) {
+ if (BigBossFuzzyBear == 1) {
scaleSpeed = 0.025;
yPosScaling = 25; }
else {
- scaleSpeed = 0.0375;
- yPosScaling = 33; }
+ scaleSpeed = 0.01875;
+ yPosScaling = 18; }
float modifier;
@@ -301,6 +346,7 @@ void daFuzzyBear_c::executeState_Grow() {
this->scale = (Vec){modifier, modifier, modifier};
this->pos.y = this->pos.y + (yPosScaling/80);
+
}
if (this->timer > 170) { doStateChange(&StateID_Bounce); }
@@ -320,8 +366,8 @@ void daFuzzyBear_c::endState_Grow() {
void daFuzzyBear_c::beginState_Bounce() {
OSReport("Begin Bouncing");
- if (this->direction = 0) { this->speed.x = ((this->settings >> 16) && 0xF) * 0.5; }
- else { this->speed.x = ((this->settings >> 16) && 0xF) * -0.5; }
+ if (this->direction = 0) { this->speed.x = 1.5; }
+ else { this->speed.x = -1.5 ; }
if (this->storeSpeed != 0) { this->speed.x = this->storeSpeed; }
@@ -332,17 +378,17 @@ void daFuzzyBear_c::executeState_Bounce() {
float wallDistance, scaleDown, scaleUp, scaleBase;
if (BigBossFuzzyBear == 0) {
+ wallDistance = 32.0;
+ scaleDown = 12.0;
+ scaleUp = 10.0;
+ scaleBase = 2.5;
+ }
+ else {
wallDistance = 38.0;
- scaleDown = 3.0;
+ scaleDown = 16.0;
scaleUp = 12.0;
scaleBase = 3.0;
}
- else {
- wallDistance = 50.0;
- scaleDown = 4.0;
- scaleUp = 16.0;
- scaleBase = 4.0;
- }
if (this->falldown == 1) { this->speed.x = 0; this->timer = 0; }
@@ -350,12 +396,12 @@ void daFuzzyBear_c::executeState_Bounce() {
// Check for walls
- if (this->pos.x <= this->initialPos.x - ((AreaWidthLeft * 24.0) + wallDistance)) { // Hit left wall, head right.
+ if (this->pos.x <= this->initialPos.x - ((15 * 24.0) + wallDistance)) { // Hit left wall, head right.
this->speed.x = -this->speed.x;
this->direction = 1;
this->pos.x = this->pos.x + 1.0; }
- if (this->pos.x >= this->initialPos.x + ((AreaWidthRight * 24.0) - wallDistance)) { // Hit right wall, head left.
+ if (this->pos.x >= this->initialPos.x + ((5 * 24.0) - wallDistance)) { // Hit right wall, head left.
this->speed.x = -this->speed.x;
this->direction = 0;
this->pos.x = this->pos.x - 1.0; }
@@ -389,29 +435,19 @@ void daFuzzyBear_c::executeState_Bounce() {
this->scale.y = modifier;
this->pos.y = this->pos.y + (scaleUp/10.0);
if (this->pos.y > this->Baseline) { this->pos.y = this->Baseline - 1.0; }
+ PlaySound(this, SE_PLY_JUMPDAI);
}
if (this->timer >= 20) {
int randChoice;
- if (BigBossFuzzyBear == 1) {
- randChoice = GenerateRandomNumber(5);
-
- if (randChoice == 0) { doStateChange(&StateID_Spray); }
- else if (randChoice == 1) { doStateChange(&StateID_Needles); }
- else if (randChoice == 2) { doStateChange(&StateID_RolyPoly); }
-
- }
- else {
- randChoice = GenerateRandomNumber(2);
- if (randChoice == 0) { doStateChange(&StateID_RolyPoly); }
- }
-
randChoice = GenerateRandomNumber(5);
-
- if (randChoice == 0) { this->speed.y = LaunchSpeedHigh; }
- else { this->speed.y = LaunchSpeedShort; }
+ if (randChoice == 0) { doStateChange(&StateID_Wait); }
+
+ randChoice = GenerateRandomNumber(4);
+ if (randChoice == 0) { this->speed.y = 8.0; }
+ else { this->speed.y = 6.0; }
this->timer = 0;
this->pos.y = this->Baseline + 1;
@@ -452,49 +488,49 @@ void daFuzzyBear_c::executeState_Needles() {
this->speed.x = 0;
if (BigBossFuzzyBear == 0) {
- origScale = 3.0;
+ origScale = 2.5;
}
else {
- origScale = 4.0;
+ origScale = 3.0;
}
this->timer = this->timer + 1;
OSReport("Needle Timer: %d", this->timer);
- if (this->timer < 120) {
+ 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(511, 0, this->pos, 0, 0);
+ 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(511, 0, this->pos, 0, 0);
+ 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(511, 0, this->pos, 0, 0);
+ 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(511, 0, this->pos, 0, 0);
+ 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(511, 0, this->pos, 0, 0);
+ 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};
@@ -532,18 +568,20 @@ void daFuzzyBear_c::executeState_Spray() {
this->rot.y = sin(this->timer * 3.14 / 5) * 4000; // 3 shakes per second, exactly 24 shakes overall
int randChoice;
- randChoice = GenerateRandomNumber(20); // 1.3 Fuzzies per second, 6 fuzzies overall
+ randChoice = GenerateRandomNumber(18); // 1.3 Fuzzies per second, 6 fuzzies overall
if (randChoice == 0) {
int randChoiceX, randChoiceY;
- randChoiceX = GenerateRandomNumber(24);
- randChoiceY = GenerateRandomNumber(16);
+ randChoiceX = GenerateRandomNumber(92);
+ randChoiceY = GenerateRandomNumber(48);
+
+ float xa, ya;
+ xa = randChoiceX - 48.0;
+ ya = randChoiceY - 24.0;
- dStageActor_c *spawner = CreateActor(144, 0, this->pos, 0, 0);
- spawner->speed.x = randChoiceX - 12.0;
- spawner->speed.y = randChoiceY * 1.0;
- spawner->scale = (Vec){1.0, 1.0, 1.0};
- } }
+ CreateActor(144, 0, (Vec){this->pos.x + xa, this->pos.y + ya, this->pos.z}, 0, 0);
+ }
+ }
else { doStateChange(&StateID_Bounce); }
@@ -571,16 +609,39 @@ void daFuzzyBear_c::endState_Spray() {
// Roly Poly State - Rolls from left to right, bounces off both walls, and returns to original position.
void daFuzzyBear_c::beginState_RolyPoly() {
- this->speed.x = this->storeSpeed;
+
+ this->isInvulnerable = 1;
+
+ if (this->roly == 0) { this->speed.x = 12.0; }
+ else { this->speed.x = -12.0; }
+
this->speed.y = 0;
this->RolyBounces = 0;
this->RolyPos = this->pos;
OSReport("Fuzzy Roly State Begin");
+
+ if (BigBossFuzzyBear == 0) {
+ this->scale = (Vec){2.5, 2.5, 2.5};
+ }
+ else {
+ this->scale = (Vec){3.0, 3.0, 3.0};
+ }
+
}
void daFuzzyBear_c::executeState_RolyPoly() {
OSReport("Fuzzy Roly State Execute");
float wallDistance, scaleDown, scaleUp;
+ PlaySound(this, SE_OBJ_TEKKYU_G_ROLL);
+
+ if (this->pos.y > this->Baseline) { this->pos.y -= 2.0; }
+ else { this->pos.y = this->Baseline - 1.0; }
+
+ if (this->direction == 0) { // is even
+ this->pos.x = this->pos.x - 4.0; }
+ else { // is odd
+ this->pos.x = this->pos.x + 4.0; }
+
if (BigBossFuzzyBear == 0) {
wallDistance = 38.0;
}
@@ -588,16 +649,16 @@ void daFuzzyBear_c::executeState_RolyPoly() {
wallDistance = 50.0;
}
- this->speed.y = 0;
+
- if (this->pos.x <= this->initialPos.x - ((AreaWidthLeft * 24.0) + wallDistance)) { // Hit left wall, head right.
+ if (this->pos.x <= this->initialPos.x - ((15 * 24.0) + wallDistance)) { // Hit left wall, head right.
this->speed.x = -this->speed.x;
this->direction = 1;
this->pos.x = this->pos.x + 1.0;
this->RolyBounces = this->RolyBounces + 1;
}
- if (this->pos.x >= this->initialPos.x + ((AreaWidthRight * 24.0) - wallDistance)) { // Hit right wall, head left.
+ if (this->pos.x >= this->initialPos.x + ((5 * 24.0) - wallDistance)) { // Hit right wall, head left.
this->speed.x = -this->speed.x;
this->direction = 0;
this->pos.x = this->pos.x - 1.0;
@@ -605,24 +666,60 @@ void daFuzzyBear_c::executeState_RolyPoly() {
}
- if (this->direction == 1) { this->rot.z = this->rot.z + 0x1000; }
- else { this->rot.z = this->rot.z - 0x1000; }
+ if (this->direction == 1) { this->rot.z = this->rot.z - 0x400; }
+ else { this->rot.z = this->rot.z + 0x400; }
if (this->RolyBounces == 2) {
- if (this->direction == 1) {
- if (this->pos.x > this->RolyPos.x) {
- this->speed.x = 0;
- if (this->rot.z == 0) { doStateChange(&StateID_Bounce); } } }
- else {
- if (this->pos.x < this->RolyPos.x) {
- this->speed.x = 0;
- if (this->rot.z == 0) { doStateChange(&StateID_Bounce); } } }
+ if ((this->pos.x > this->RolyPos.x -20.0) && (this->pos.x < this->RolyPos.x + 20.0)) {
+ this->speed.x = 0;
+ if (this->rot.z == 0) { doStateChange(&StateID_Bounce); } }
}
- HandleXSpeed(this);
- HandleYSpeed(this);
- UpdateObjectPosBasedOnSpeedValues_real(this);
+
+// HandleXSpeed(this);
+// HandleYSpeed(this);
+
+// doSpriteMovement(this);
+// UpdateObjectPosBasedOnSpeedValues_real(this);
}
-void daFuzzyBear_c::endState_RolyPoly() { this->rot.z = 0; OSReport("Fuzzy Roly State End"); }
+void daFuzzyBear_c::endState_RolyPoly() {
+ this->rot.z = 0;
+ OSReport("Fuzzy Roly State End");
+ this->isInvulnerable = 0;
+}
+
+
+
+
+
+
+
+void daFuzzyBear_c::beginState_Wait() { this->timer = 0;}
+void daFuzzyBear_c::executeState_Wait() {
+
+ this->timer = this->timer + 1;
+
+ if (this->timer > 60) {
+ int randChoice;
+
+ if (BigBossFuzzyBear == 1) {
+
+ randChoice = GenerateRandomNumber(3);
+
+ if (randChoice == 0) { doStateChange(&StateID_Spray); }
+// else if (randChoice == 1) { doStateChange(&StateID_Needles); }
+ else { doStateChange(&StateID_RolyPoly); }
+
+ }
+ else {
+ doStateChange(&StateID_Bounce);
+ }
+ }
+}
+void daFuzzyBear_c::endState_Wait() { }
+
+
+
+