summaryrefslogtreecommitdiff
path: root/src/bossFuzzyBear.cpp
diff options
context:
space:
mode:
authorColin Noga <Tempus@Spectrum-Song.local>2011-10-15 03:23:27 -0500
committerColin Noga <Tempus@Spectrum-Song.local>2011-10-15 03:23:27 -0500
commitd287567cb54f4ba68633e3580e5e39a38a533604 (patch)
treef9ff45ea3680f1dafb630e678ec85d88362de8a0 /src/bossFuzzyBear.cpp
parentf490f30abf396ad8d0ce4ccfe5337c9949776ed8 (diff)
downloadkamek-d287567cb54f4ba68633e3580e5e39a38a533604.tar.gz
kamek-d287567cb54f4ba68633e3580e5e39a38a533604.zip
some touch ups, animations, effects, sounds, the stage end function, and a proper wipe, fake coin improvements
Diffstat (limited to '')
-rw-r--r--src/bossFuzzyBear.cpp156
1 files changed, 116 insertions, 40 deletions
diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp
index 8d106ca..7ad7dcd 100644
--- a/src/bossFuzzyBear.cpp
+++ b/src/bossFuzzyBear.cpp
@@ -2,9 +2,11 @@
#include <game.h>
#include <g3dhax.h>
#include <sfx.h>
+#include <stage.h>
#include "effects.h"
#include "player.h"
+
class daFuzzyBear_c : public dEn_c {
int onCreate();
int onDelete();
@@ -13,6 +15,8 @@ class daFuzzyBear_c : public dEn_c {
mHeapAllocator_c allocator;
m3d::mdl_c bodyModel;
+ nw4r::g3d::ResFile resFile;
+ m3d::anmChr_c animationChr;
int timer;
char BigBossFuzzyBear;
@@ -31,9 +35,10 @@ class daFuzzyBear_c : public dEn_c {
char roly;
char isInvulnerable;
- void dieBigFall_Execute();
static daFuzzyBear_c *build();
+ void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate);
+ void setupBodyModel();
void updateModelMatrices();
void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
@@ -51,6 +56,7 @@ class daFuzzyBear_c : public dEn_c {
DECLARE_STATE(Spray);
DECLARE_STATE(RolyPoly);
DECLARE_STATE(Wait);
+ DECLARE_STATE(Outro);
};
daFuzzyBear_c *daFuzzyBear_c::build() {
@@ -64,7 +70,7 @@ 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" void *StopSound(int soundID);
+extern "C" void *StopSound(int soundID, int thing=0);
extern "C" u32 GenerateRandomNumber(int max);
extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer);
@@ -78,6 +84,7 @@ CREATE_STATE(daFuzzyBear_c, Needles);
CREATE_STATE(daFuzzyBear_c, Spray);
CREATE_STATE(daFuzzyBear_c, RolyPoly);
CREATE_STATE(daFuzzyBear_c, Wait);
+CREATE_STATE(daFuzzyBear_c, Outro);
#define ACTIVATE 1
@@ -99,7 +106,7 @@ void daFuzzyBear_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, Ac
CreateEffect(&apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 102);
this->damage++;
- if (this->damage > 14) { doStateChange(&StateID_DieBigFall); }
+ if (this->damage > 14) { doStateChange(&StateID_Outro); }
}
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) {
@@ -137,7 +144,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);
- if (this->damage > 14) { doStateChange(&StateID_DieBigFall); }
+ if (this->damage > 14) { doStateChange(&StateID_Outro); }
else { doStateChange(&StateID_RolyPoly); }
}
void daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) {
@@ -151,59 +158,43 @@ void daFuzzyBear_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *
CreateEffect(&apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 162);
- if (this->damage > 14) { doStateChange(&StateID_DieBigFall); }
+ if (this->damage > 14) { doStateChange(&StateID_Outro); }
else { doStateChange(&StateID_RolyPoly); }
}
void daFuzzyBear_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Yoshi Fire"); }
-void daFuzzyBear_c::dieBigFall_Execute() {
-
- if (this->dying == 1) { return; }
- this->rot.x = 0; // X is vertical axis
- this->rot.y = 0; // Y is horizontal axis
- this->rot.z = 0; // Z is ... an axis >.>
- if (this->scale.x > 0.1) {
+void daFuzzyBear_c::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) {
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr(name);
+ this->animationChr.bind(&this->bodyModel, anmChr, unk);
+ this->bodyModel.bindAnim(&this->animationChr, unk2);
+ this->animationChr.setUpdateRate(rate);
+}
- PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST);
- this->scale.x -= 0.015;
- this->scale.y -= 0.015;
- this->scale.z -= 0.015;
+void daFuzzyBear_c::setupBodyModel() {
+ allocator.link(-1, GameHeaps[0], 0, 0x20);
- 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;
- }
- }
- 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->resFile.data = getResource("chorobon", "g3d/chorobon.brres");
+ nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("chorobon");
+ bodyModel.setup(mdl, &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&bodyModel, 0);
- this->timer += 1;
+ bool ret;
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("run");
+ ret = this->animationChr.setup(mdl, anmChr, &this->allocator, 0);
+ allocator.unlink();
}
int daFuzzyBear_c::onCreate() {
OSReport("Creating the Fuzzy Bear Model");
- allocator.link(-1, GameHeaps[0], 0, 0x20);
+ setupBodyModel();
- nw4r::g3d::ResFile rf(getResource("chorobon", "g3d/chorobon.brres"));
- bodyModel.setup(rf.GetResMdl("chorobon"), &allocator, 0x224, 1, 0);
- SetupTextures_Enemy(&bodyModel, 0);
-
- allocator.unlink();
this->BigBossFuzzyBear = this->settings >> 28;
@@ -257,6 +248,9 @@ int daFuzzyBear_c::onCreate() {
this->roly = 0;
this->damage = 0;
this->isInvulnerable = 0;
+
+
+ bindAnimChr_and_setUpdateRate("run", 1, 0.0, 1.0);
OSReport("Setting Fuzzy Bear's State");
doStateChange(&StateID_Grow);
@@ -275,6 +269,9 @@ int daFuzzyBear_c::onExecute() {
acState.execute();
updateModelMatrices();
+ if(this->animationChr.isAnimationDone())
+ this->animationChr.setCurrentFrame(0.0);
+
if (this->aPhysics.result1 == 1) {
char PlayerID = NearestPlayer(this);
dStageActor_c *Player = GetSpecificPlayerActor(PlayerID);
@@ -288,6 +285,7 @@ int daFuzzyBear_c::onExecute() {
int daFuzzyBear_c::onDraw() {
bodyModel.scheduleForDrawing();
+ bodyModel._vf1C();
return true;
}
@@ -308,7 +306,6 @@ 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() {
@@ -316,8 +313,11 @@ void daFuzzyBear_c::executeState_Grow() {
this->timer = this->timer + 1;
float scaleSpeed, yPosScaling;
+
+ if (this->timer == 60) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); }
if ((this->timer > 60) && (this->timer < 140)) {
+
if (BigBossFuzzyBear == 1) {
scaleSpeed = 0.025;
yPosScaling = 25; }
@@ -339,7 +339,8 @@ void daFuzzyBear_c::executeState_Grow() {
}
void daFuzzyBear_c::endState_Grow() {
this->Baseline = this->pos.y;
-// StopSound(SE_BOSS_ROY_MAGIC_MAKE_FAST);
+
+ PlaySound(this, STRM_BGM_TORIDE_BOSS);
OSReport("OK. All grown up now.");
}
@@ -711,4 +712,79 @@ void daFuzzyBear_c::endState_Wait() { }
+void daFuzzyBear_c::beginState_Outro() {
+
+ this->timer = 0;
+
+}
+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) {
+
+ 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
+ }
+ }
+
+ 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;
+
+ 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;
+ }
+ }
+ 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;
+
+ PlaySound(this, STRM_BGM_SHIRO_BOSS_CLEAR);
+ }
+
+ this->timer += 1;
+
+}
+void daFuzzyBear_c::endState_Outro() { }
+
+
+
+