summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bossFuzzyBear.cpp156
-rw-r--r--src/bossRamboo.cpp1
-rw-r--r--src/soundPlayer.S13
3 files changed, 128 insertions, 42 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() { }
+
+
+
+
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp
index c1b9244..11c0249 100644
--- a/src/bossRamboo.cpp
+++ b/src/bossRamboo.cpp
@@ -272,6 +272,7 @@ void daRamboo_c::executeState_Grow() {
float scaleSpeed, yPosScaling;
if ((this->timer > 60) && (this->timer < 140)) {
+ PlaySound(this, SE_BOSS_IGGY_WANWAN_L_TO_M);
scaleSpeed = 0.175;
// yPosScaling = 0;
diff --git a/src/soundPlayer.S b/src/soundPlayer.S
index 04f29f8..645af31 100644
--- a/src/soundPlayer.S
+++ b/src/soundPlayer.S
@@ -20,8 +20,9 @@
.extern YetAnotherSoundPlayer
.extern CheckIfPlayingSound
.extern StopSoundBasic
-.extern BufferToCheckIfPlaying
+.extern StopSoundRelated
.extern SoundClassRelated
+.extern BufferToCheckIfPlaying
.align 4
@@ -85,7 +86,15 @@ GoAwaySoundGuy:
.global StopSound
StopSound:
+ stwu r1, -0x10(r1)
+ mtlr r0
+ stw r0, 0x14(r1)
+
mr r4, r3
lwz r3, -0x5218(r13)
- b StopSoundBasic
+ bl StopSoundBasic
+ lwz r0, 0x14(r1)
+ mflr r0
+
+ blr