summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStephen Simpson <megazig@gmail.com>2011-10-19 12:36:15 -0500
committerStephen Simpson <megazig@gmail.com>2011-10-19 12:36:15 -0500
commitb14405c831f2e94f771f65e786d7b2b88146ca97 (patch)
tree75e4b3d9eb75db7e2b09566dc51809be571f389c /src
parent4d5d95ec2c70578627353e40047462c82ac695c1 (diff)
parent80e51e409ca322ff22431be8a33131d2f705a8c7 (diff)
downloadkamek-b14405c831f2e94f771f65e786d7b2b88146ca97.tar.gz
kamek-b14405c831f2e94f771f65e786d7b2b88146ca97.zip
Merge branch 'level-select' into megaTestBoss
Diffstat (limited to '')
-rw-r--r--src/bossBalboaWrench.cpp711
-rw-r--r--src/bossFuzzyBear.cpp1
-rw-r--r--src/bossRamboo.cpp278
-rw-r--r--src/fakeStarCoin.cpp5
4 files changed, 934 insertions, 61 deletions
diff --git a/src/bossBalboaWrench.cpp b/src/bossBalboaWrench.cpp
new file mode 100644
index 0000000..efb3abe
--- /dev/null
+++ b/src/bossBalboaWrench.cpp
@@ -0,0 +1,711 @@
+#include <common.h>
+#include <game.h>
+#include <g3dhax.h>
+#include <sfx.h>
+#include <stage.h>
+#include "effects.h"
+#include "player.h"
+
+class daBalboa_c : public dEn_c {
+ int onCreate();
+ int onDelete();
+ int onExecute();
+ int onDraw();
+
+ mHeapAllocator_c allocator;
+ m3d::mdl_c bodyModel;
+ m3d::mdl_c manholeModel;
+ m3d::mdl_c holeModel;
+
+ nw4r::g3d::ResFile resFile;
+ m3d::anmChr_c anmDead;
+ m3d::anmChr_c anmDead_2;
+ m3d::anmChr_c anmGo_out_ed;
+ m3d::anmChr_c anmGo_out_st;
+ m3d::anmChr_c anmThrow_1;
+ m3d::anmChr_c anmThrow_2;
+ m3d::anmChr_c anmThrow_3;
+ m3d::anmChr_c anmThrow_4Left;
+ m3d::anmChr_c anmThrow_4Right;
+ m3d::anmChr_c anmThrow_5;
+
+ int timer;
+ float Baseline;
+ float dying;
+ Vec PopUp [4];
+ dStageActor_c *homingWrench;
+ int homingWrenchLifeSpan;
+ float homingWrenchDirection;
+ char throwCount;
+
+ static daBalboa_c *build();
+
+ void setupModels();
+ void updateModelMatrices();
+
+ void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther);
+ bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther);
+ void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther);
+
+ USING_STATES(daBalboa_c);
+ DECLARE_STATE(Grow);
+ DECLARE_STATE(ManholeUp);
+ DECLARE_STATE(HeadPoke);
+ DECLARE_STATE(AllOut);
+ DECLARE_STATE(ThrowHoming);
+ DECLARE_STATE(ThrowWrench);
+ DECLARE_STATE(BackDown);
+ DECLARE_STATE(Outro);
+};
+
+daBalboa_c *daBalboa_c::build() {
+ void *buffer = AllocFromGameHeap1(sizeof(daBalboa_c));
+ return new(buffer) daBalboa_c;
+}
+
+
+extern "C" void *HandleXSpeed(daBalboa_c *);
+extern "C" void *HandleYSpeed(daBalboa_c *);
+extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daBalboa_c *);
+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(daBalboa_c *, Vec pos);
+extern "C" dStageActor_c *GetSpecificPlayerActor(int number);
+extern "C" void *PlaySound(daBalboa_c *, int soundID);
+
+
+CREATE_STATE(daBalboa_c, Grow);
+CREATE_STATE(daBalboa_c, ManholeUp);
+CREATE_STATE(daBalboa_c, HeadPoke);
+CREATE_STATE(daBalboa_c, AllOut);
+CREATE_STATE(daBalboa_c, ThrowHoming);
+CREATE_STATE(daBalboa_c, ThrowWrench);
+CREATE_STATE(daBalboa_c, BackDown);
+CREATE_STATE(daBalboa_c, Outro);
+
+
+
+void daBalboa_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) {
+ this->_vf220(apOther->owner);
+ OSReport("I hit Mario.");
+}
+void daBalboa_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {
+ OSReport("Hit Fireball");
+ CreateEffect(378, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5});
+ this->pos.x += 6.0;
+}
+bool daBalboa_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Iceball"); return false; }
+void daBalboa_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {
+ OSReport("Hit Rolling Object");
+
+ if (apOther->owner->name == 412) { // Check if it's a glow block
+ CreateEffect(378, &apOther->owner->pos);
+ CreateEffect(380, &apOther->owner->pos);
+
+ apOther->owner->Delete();
+ doStateChange(&StateID_Outro);
+ }
+}
+void daBalboa_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Hammer"); }
+
+
+
+
+void daBalboa_c::setupModels() {
+ allocator.link(-1, GameHeaps[0], 0, 0x20);
+
+ nw4r::g3d::ResMdl mdl;
+ nw4r::g3d::ResAnmChr anmChr;
+
+ this->resFile.data = getResource("choropoo", "g3d/choropoo.brres");
+
+ mdl = this->resFile.GetResMdl("manhole");
+ this->manholeModel.setup(mdl, &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&this->manholeModel, 0);
+
+ mdl = this->resFile.GetResMdl("choropoo_hole");
+ this->holeModel.setup(mdl, &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&this->holeModel, 0);
+
+ mdl = this->resFile.GetResMdl("choropoo");
+ this->bodyModel.setup(mdl, &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&this->bodyModel, 0);
+
+
+
+ anmChr = this->resFile.GetResAnmChr("dead");
+ this->anmDead.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("dead_2");
+ this->anmDead_2.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("go_out_ed");
+ this->anmGo_out_ed.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("go_out_st");
+ this->anmGo_out_st.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("throw_1");
+ this->anmThrow_1.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("throw_2");
+ this->anmThrow_2.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("throw_3");
+ this->anmThrow_3.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("throw_4_left_hand");
+ this->anmThrow_4Left.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("throw_4_right_hand");
+ this->anmThrow_4Right.setup(mdl, anmChr, &this->allocator, 0);
+
+ anmChr = this->resFile.GetResAnmChr("throw_5");
+ this->anmThrow_5.setup(mdl, anmChr, &this->allocator, 0);
+
+
+ allocator.unlink();
+}
+
+
+
+// Animation Order...
+// AppearLittle - Throw One, sound 0x21F
+// Search - Throw two
+// AppearFull - Throw 3 and sound 0x220
+// Attack - Throw 4
+// Disappear - Throw 5
+
+
+
+int daBalboa_c::onCreate() {
+
+ OSReport("Creating the Balboa Model");
+ setupModels();
+
+
+ OSReport("Setting Balboa's Size to 4.0");
+ this->scale = (Vec){1.0, 1.0, 1.0};
+
+ OSReport("Creating Balboa's Physics Struct");
+
+ ActivePhysics::Info HitMeBaby;
+ HitMeBaby.xDistToCenter = 0.0;
+ HitMeBaby.yDistToCenter = 36.0;
+
+ HitMeBaby.xDistToEdge = 24.0;
+ HitMeBaby.yDistToEdge = 30.0;
+
+ HitMeBaby.category1 = 0x3;
+ HitMeBaby.category2 = 0x0;
+ HitMeBaby.bitfield1 = 0x4F;
+ HitMeBaby.bitfield2 = 0xFFBAFFFE;
+ HitMeBaby.unkShort1C = 0;
+ HitMeBaby.callback = &dEn_c::collisionCallback;
+
+
+ OSReport("Making the Physics Class and adding to the list");
+ this->aPhysics.initWithStruct(this, &HitMeBaby);
+ this->aPhysics.addToList();
+
+ OSReport("Setting up the Box of Goodies");
+
+ this->rot.x = 0; // X is vertical axis
+ this->rot.y = 0xE000; // Y is horizontal axis
+ this->rot.z = 0; // Z is ... an axis >.>
+ this->direction = 0; // Heading left.
+ this->pos.z = -800.0;
+
+ this->PopUp[0] = (Vec){this->pos.x, this->pos.y + 120.0, this->pos.z};
+ this->PopUp[1] = (Vec){this->pos.x - 320.0, this->pos.y - 60.0, this->pos.z};
+ this->PopUp[2] = (Vec){this->pos.x, this->pos.y + 120.0, this->pos.z};
+ this->PopUp[3] = (Vec){this->pos.x - 320.0, this->pos.y - 60.0, this->pos.z};
+
+
+ OSReport("Setting the State");
+ doStateChange(&StateID_Grow);
+
+ OSReport("Going to Execute Balboa");
+ this->onExecute();
+ return true;
+}
+
+int daBalboa_c::onDelete() {
+ return true;
+}
+
+int daBalboa_c::onExecute() {
+ acState.execute();
+ updateModelMatrices();
+
+ if (this->aPhysics.result1 == 1) {
+ char PlayerID = NearestPlayer(this);
+ dStageActor_c *Player = GetSpecificPlayerActor(PlayerID);
+
+ this->_vf220(Player);
+ }
+
+ if (this->homingWrenchLifeSpan > 1) {
+ this->homingWrench->pos.y += this->homingWrenchDirection;
+ this->homingWrenchLifeSpan -= 1;
+ }
+
+ if (this->homingWrenchLifeSpan == 1) {
+ this->homingWrench->Delete();
+ CreateEffect(&this->homingWrench->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 242);
+
+ this->homingWrenchLifeSpan = 0;
+ }
+
+
+ return true;
+}
+
+int daBalboa_c::onDraw() {
+
+ bodyModel.scheduleForDrawing();
+
+ return true;
+}
+
+
+void daBalboa_c::updateModelMatrices() {
+ // This won't work with wrap because I'm lazy.
+ matrix.translation(pos.x, pos.y, pos.z);
+ matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z);
+
+ bodyModel.setDrawMatrix(matrix);
+ bodyModel.setScale(&scale);
+ bodyModel.calcWorld(false);
+
+}
+
+
+// Grow State
+
+void daBalboa_c::beginState_Grow() {
+ OSReport("Growing when Kameck Tells me to.");
+ this->timer = 0;
+
+}
+
+void daBalboa_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)) {
+ scaleSpeed = 0.025;
+// yPosScaling = 0;
+
+ float modifier;
+
+ modifier = 2.0 + ((this->timer - 60) * scaleSpeed);
+
+ this->scale = (Vec){modifier, modifier, modifier};
+// this->pos.y = this->pos.y + (yPosScaling/80);
+
+ }
+
+ if (this->timer > 170) {
+ PlaySound(this, SE_EMY_CHOROPU_BOUND);
+ doStateChange(&StateID_BackDown);
+ }
+
+}
+void daBalboa_c::endState_Grow() {
+
+ OSReport("OK. All grown up now.");
+}
+
+
+
+
+
+// ManholeUp State
+
+void daBalboa_c::beginState_ManholeUp() {
+
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_1");
+ this->anmThrow_1.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmThrow_1, 0.0);
+ this->anmThrow_1.setUpdateRate(1.0);
+
+ this->timer = 0;
+
+ int randChoice;
+ randChoice = GenerateRandomNumber(4);
+
+ this->pos = this->PopUp[randChoice];
+
+ if (randChoice < 2) { // On the left side!
+ this->rot.y = 0xE000;
+ this->direction = 0; }
+ else { // On the right side!
+ this->rot.y = 0x2000;
+ this->direction = 1; }
+
+ PlaySound(this, 0x21F);
+}
+
+void daBalboa_c::executeState_ManholeUp() {
+
+ this->bodyModel._vf1C();
+
+ if (this->timer < 30) {
+ this->pos.y += 0.5; } // Height is 80 pixels, move up 15 pixels.
+
+ if (this->timer > 90) {
+ doStateChange(&StateID_HeadPoke); }
+
+ this->timer += 1;
+
+}
+void daBalboa_c::endState_ManholeUp() { }
+
+
+
+
+// HeadPoke State
+
+void daBalboa_c::beginState_HeadPoke() {
+
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_2");
+ this->anmThrow_2.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmThrow_2, 0.0);
+ this->anmThrow_2.setUpdateRate(1.0);
+
+ this->timer = 0;
+}
+
+void daBalboa_c::executeState_HeadPoke() {
+
+ if (this->timer < 30) {
+ this->pos.y += 1.0; } // Height is 80 pixels, move up another 30 pixels.
+
+ if (this->timer > 90) {
+ doStateChange(&StateID_AllOut); }
+
+ this->timer += 1;
+ this->bodyModel._vf1C();
+
+}
+void daBalboa_c::endState_HeadPoke() { }
+
+
+
+
+
+// AllOut State
+
+void daBalboa_c::beginState_AllOut() {
+
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_3");
+ this->anmThrow_3.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmThrow_1, 0.0);
+ this->anmThrow_3.setUpdateRate(1.0);
+
+ this->timer = 0;
+
+ PlaySound(this, 0x220);
+}
+
+void daBalboa_c::executeState_AllOut() {
+
+ this->bodyModel._vf1C();
+
+ if (this->timer < 30) {
+ this->pos.y += 1.2; } // Height is 80 pixels, move up another 35 pixels.
+
+ if (this->timer > 90) {
+ int randChoice;
+ randChoice = GenerateRandomNumber(2);
+
+ if (randChoice == 0) {
+ doStateChange(&StateID_ThrowHoming); }
+ else {
+ doStateChange(&StateID_ThrowWrench); }
+ }
+
+ this->timer += 1;
+
+}
+void daBalboa_c::endState_AllOut() { }
+
+
+
+
+// ThrowHoming State
+
+void daBalboa_c::beginState_ThrowHoming() {
+
+ if (this->direction == 0) {
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_4_left_hand");
+ this->anmThrow_4Left.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmThrow_4Left, 0.0);
+ this->anmThrow_4Left.setUpdateRate(1.0);
+ }
+ else {
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_4_right_hand");
+ this->anmThrow_4Right.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmThrow_4Right, 0.0);
+ this->anmThrow_4Right.setUpdateRate(1.0);
+ }
+
+
+ Vec tempPos = this->pos;
+ if (this->direction == 0) {
+ tempPos.x -= 32.0;
+ tempPos.y += 10.0;
+
+ this->homingWrench = CreateActor(372, this->direction << 28, tempPos, 0, 0);
+ this->homingWrench->speed.x = -7.0;
+ this->homingWrench->scale = (Vec){3.0, 3.0, 3.0};
+
+ }
+ else {
+ tempPos.x += 32.0;
+ tempPos.y += 10.0;
+
+ this->homingWrench = CreateActor(372, this->direction << 28, tempPos, 0, 0);
+ this->homingWrench->speed.x = 7.0;
+ this->homingWrench->scale = (Vec){3.0, 3.0, 3.0};
+
+ }
+
+
+ char PlayerID = NearestPlayer(this);
+ dStageActor_c *Player = GetSpecificPlayerActor(PlayerID);
+
+
+ if ((Player->pos.y >= tempPos.y - 16.0) && (Player->pos.y <= tempPos.y + 16.0)) {
+ this->homingWrenchDirection = 0.0; }
+
+ else if ((Player->pos.y >= tempPos.y - 106.0) && (Player->pos.y < tempPos.y - 16.0)) {
+ this->homingWrenchDirection = -0.4; }
+
+ else if ((Player->pos.y <= tempPos.y + 106.0) && (Player->pos.y > tempPos.y + 16.0)) {
+ this->homingWrenchDirection = 0.4; }
+
+ else if (Player->pos.y < tempPos.y - 106.0) {
+ this->homingWrenchDirection = -0.8; }
+
+ else if (Player->pos.y > tempPos.y + 106.0) {
+ this->homingWrenchDirection = 0.8; }
+
+ else {
+ this->homingWrenchDirection = 0.0; }
+
+
+ PlaySound(this, 0x222);
+ this->homingWrenchLifeSpan = 360;
+
+ this->timer = 0;
+}
+
+void daBalboa_c::executeState_ThrowHoming() {
+ this->bodyModel._vf1C();
+
+ if (this->timer > 60) {
+ doStateChange(&StateID_BackDown); }
+
+ this->timer += 1;
+ this->bodyModel._vf1C();
+}
+void daBalboa_c::endState_ThrowHoming() { }
+
+
+
+
+// ThrowWrench State
+
+void daBalboa_c::beginState_ThrowWrench() {
+
+ this->timer = 0;
+}
+
+void daBalboa_c::executeState_ThrowWrench() {
+
+
+
+ if (this->timer == 60) {
+
+ if (this->throwCount & 1) {
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_4_left_hand");
+ this->anmThrow_4Left.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmThrow_4Left, 0.0);
+ this->anmThrow_4Left.setUpdateRate(1.0);
+ }
+ else {
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_4_right_hand");
+ this->anmThrow_4Right.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmThrow_4Right, 0.0);
+ this->anmThrow_4Right.setUpdateRate(1.0);
+ }
+
+
+ char PlayerID = NearestPlayer(this);
+ dStageActor_c *Player = GetSpecificPlayerActor(PlayerID);
+
+
+ float slope = ( (this->pos.y - Player->pos.y) / (this->pos.x - Player->pos.x) );
+
+
+ Vec tempPos = this->pos;
+ if (this->direction == 0) {
+ tempPos.x -= 32.0;
+ tempPos.y += 10.0;
+
+ dStageActor_c *wrench = CreateActor(372, this->direction << 28, tempPos, 0, 0);
+ wrench->speed.x = -8.0;
+ wrench->speed.y = -8.0 * slope;
+ }
+
+ else {
+ tempPos.x += 32.0;
+ tempPos.y += 10.0;
+
+ dStageActor_c *wrench = CreateActor(372, this->direction << 28, tempPos, 0, 0);
+ wrench->speed.x = 8.0;
+ wrench->speed.y = 8.0 * slope;
+ }
+
+ PlaySound(this, 0x222);
+
+ this->timer = 0;
+ this->throwCount += 1;
+ }
+
+ if (this->throwCount == 5) {
+ doStateChange(&StateID_BackDown); }
+
+ this->timer += 1;
+ this->bodyModel._vf1C();
+
+}
+void daBalboa_c::endState_ThrowWrench() { this->throwCount = 0; }
+
+
+
+// BackDown State
+
+void daBalboa_c::beginState_BackDown() {
+
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("throw_5");
+ this->anmThrow_5.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmThrow_5, 0.0);
+ this->anmThrow_5.setUpdateRate(1.0);
+
+ this->timer = 0;
+
+ PlaySound(this, 0x221);
+
+ CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 1.0, 1.0}, 351);
+ CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){2.0, 1.0, 1.0}, 352);
+}
+
+void daBalboa_c::executeState_BackDown() {
+
+ if (this->timer < 60) {
+ this->pos.y -= 2.6667; } // Height is 80 pixels, move down 80 pixels.
+
+ if (this->timer > 90) {
+ doStateChange(&StateID_ManholeUp); }
+
+ this->timer += 1;
+ this->bodyModel._vf1C();
+
+}
+void daBalboa_c::endState_BackDown() { }
+
+
+
+
+void daBalboa_c::beginState_Outro() {
+
+ this->removeMyActivePhysics();
+ this->timer = 0;
+ this->rot.x = 0x0; // X is vertical axis
+ this->rot.y = 0xE000; // Y is horizontal axis
+ this->rot.z = 0x0; // Z is ... an axis >.>
+
+}
+void daBalboa_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);
+ PlaySound(this, SE_EMY_BIG_TERESA_DEAD);
+
+ // Adjust this to equal the scale of your boss / 80.
+ this->scale.x -= 0.175;
+ this->scale.y -= 0.175;
+ this->scale.z -= 0.175;
+
+ this->pos.y += 2.0;
+
+ Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0};
+
+ if (this->timer == 30) {
+ CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 756);
+ CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 801);
+ CreateEffect(&tempPos, &(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;
+
+ Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0};
+
+ CreateEffect(&tempPos, &(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 daBalboa_c::endState_Outro() { }
+
+
diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp
index 7ad7dcd..0c16d42 100644
--- a/src/bossFuzzyBear.cpp
+++ b/src/bossFuzzyBear.cpp
@@ -714,6 +714,7 @@ void daFuzzyBear_c::endState_Wait() { }
void daFuzzyBear_c::beginState_Outro() {
+ this->removeMyActivePhysics();
this->timer = 0;
}
diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp
index 11c0249..6bc7e51 100644
--- a/src/bossRamboo.cpp
+++ b/src/bossRamboo.cpp
@@ -2,6 +2,7 @@
#include <game.h>
#include <g3dhax.h>
#include <sfx.h>
+#include <stage.h>
#include "effects.h"
#include "player.h"
@@ -13,20 +14,29 @@ class daRamboo_c : public dEn_c {
mHeapAllocator_c allocator;
m3d::mdl_c bodyModel;
+ m3d::mdl_c hideModel;
m3d::mdl_c fogModel;
+ nw4r::g3d::ResFile resFile;
+ m3d::anmChr_c anmFog;
+ m3d::anmChr_c anmWaitA;
+ m3d::anmChr_c anmShayA;
+ m3d::anmChr_c anmWaitB;
+ m3d::anmChr_c anmShayB;
+
int timer;
int ytimer;
- char BigBossRamboo;
+ char Hiding;
float Baseline;
float dying;
u64 eventFlag;
- void dieBigFall_Execute();
static daRamboo_c *build();
+ void bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c animationChr, m3d::mdl_c model, float rate);
+ void setupModels();
void updateModelMatrices();
void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther);
@@ -40,6 +50,7 @@ class daRamboo_c : public dEn_c {
DECLARE_STATE(Advance);
DECLARE_STATE(Wait);
DECLARE_STATE(Flee);
+ DECLARE_STATE(Outro);
};
daRamboo_c *daRamboo_c::build() {
@@ -62,6 +73,7 @@ CREATE_STATE(daRamboo_c, Grow);
CREATE_STATE(daRamboo_c, Advance);
CREATE_STATE(daRamboo_c, Wait);
CREATE_STATE(daRamboo_c, Flee);
+CREATE_STATE(daRamboo_c, Outro);
struct EventTable_t {
@@ -96,69 +108,59 @@ void daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysic
void daRamboo_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Hammer"); }
-void daRamboo_c::dieBigFall_Execute() {
-
- if (this->dying == 1) { return; }
- this->rot.x = 0x0; // X is vertical axis
- this->rot.y = 0xE000; // Y is horizontal axis
- this->rot.z = 0x0; // Z is ... an axis >.>
+void daRamboo_c::bindAnimChr_and_setUpdateRates(const char* name, m3d::anmChr_c animationChr, m3d::mdl_c model, float rate) {
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr(name);
+ animationChr.bind(&model, anmChr, 1);
+ model.bindAnim(&animationChr, 0.0);
+ animationChr.setUpdateRate(rate);
+}
- if (this->scale.x > 0.1) {
- this->pos.y += 2.0;
+void daRamboo_c::setupModels() {
+ allocator.link(-1, GameHeaps[0], 0, 0x20);
- PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST);
- PlaySound(this, SE_EMY_BIG_TERESA_DEAD);
+ this->resFile.data = getResource("teresa", "g3d/teresa.brres");
+ bool ret;
- this->scale.x -= 0.175;
- this->scale.y -= 0.175;
- this->scale.z -= 0.175;
+ nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("fog");
+ this->fogModel.setup(mdl, &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&this->fogModel, 0);
- Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0};
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("fog");
+ ret = this->anmFog.setup(mdl, anmChr, &this->allocator, 0);
- if (this->timer == 30) {
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 756);
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 801);
- CreateEffect(&tempPos, &(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;
-
- Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0};
- CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 588);
- this->dying = 1;
- }
+ nw4r::g3d::ResMdl mdlB = this->resFile.GetResMdl("teresaA");
+ this->bodyModel.setup(mdlB, &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&this->bodyModel, 0);
- this->timer += 1;
+ nw4r::g3d::ResAnmChr anmChrC = this->resFile.GetResAnmChr("shay_teresaA");
+ ret = this->anmShayA.setup(mdlB, anmChrC, &this->allocator, 0);
+ nw4r::g3d::ResAnmChr anmChrD = this->resFile.GetResAnmChr("wait");
+ ret = this->anmWaitA.setup(mdlB, anmChrD, &this->allocator, 0);
-}
+ nw4r::g3d::ResMdl mdlC = this->resFile.GetResMdl("teresaB");
+ this->hideModel.setup(mdlC, &allocator, 0x224, 1, 0);
+ SetupTextures_Enemy(&this->bodyModel, 0);
+ nw4r::g3d::ResAnmChr anmChrE = this->resFile.GetResAnmChr("shay_teresaB");
+ ret = this->anmShayB.setup(mdlC, anmChrE, &this->allocator, 0);
-int daRamboo_c::onCreate() {
-
- OSReport("Creating the Ramboo Model");
- allocator.link(-1, GameHeaps[0], 0, 0x20);
+ nw4r::g3d::ResAnmChr anmChrF = this->resFile.GetResAnmChr("shay_teresaB_wait");
+ ret = this->anmWaitB.setup(mdlC, anmChrF, &this->allocator, 0);
- nw4r::g3d::ResFile rf(getResource("teresa", "g3d/teresa.brres"));
-
- fogModel.setup(rf.GetResMdl("fog"), &allocator, 0x224, 1, 0);
- SetupTextures_Enemy(&fogModel, 0);
+ allocator.unlink();
+}
- bodyModel.setup(rf.GetResMdl("teresaA"), &allocator, 0x224, 1, 0);
- SetupTextures_Enemy(&bodyModel, 0);
- allocator.unlink();
+int daRamboo_c::onCreate() {
-// this->BigBossRamboo = this->settings >> 28;
+ OSReport("Creating the Ramboo Model");
+ setupModels();
OSReport("Setting Ramboo's Size to 16.0");
@@ -192,6 +194,7 @@ int daRamboo_c::onCreate() {
this->rot.y = 0xE000; // Y is horizontal axis
this->rot.z = 0; // Z is ... an axis >.>
this->direction = 0; // Heading left.
+ this->Hiding = 0;
this->speed.x = 0.0;
this->ytimer = 0;
@@ -200,9 +203,12 @@ int daRamboo_c::onCreate() {
OSReport("Event to activate: %d", eventNum);
this->eventFlag = (u64)1 << (eventNum - 1);
-
-
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("fog");
+ this->anmFog.bind(&this->fogModel, anmChr, 1);
+ this->fogModel.bindAnim(&this->anmFog, 0.0);
+ this->anmFog.setUpdateRate(1.0);
+
OSReport("Setting the State");
doStateChange(&StateID_Grow);
@@ -219,6 +225,11 @@ int daRamboo_c::onExecute() {
acState.execute();
updateModelMatrices();
+ this->fogModel._vf1C();
+
+ if(this->anmFog.isAnimationDone())
+ this->anmFog.setCurrentFrame(0.0);
+
if (this->aPhysics.result1 == 1) {
char PlayerID = NearestPlayer(this);
dStageActor_c *Player = GetSpecificPlayerActor(PlayerID);
@@ -227,7 +238,7 @@ int daRamboo_c::onExecute() {
}
if (EventTable->events & this->eventFlag) {
- doStateChange(&StateID_DieBigFall);
+ doStateChange(&StateID_Outro);
}
return true;
@@ -235,7 +246,11 @@ int daRamboo_c::onExecute() {
int daRamboo_c::onDraw() {
fogModel.scheduleForDrawing();
- bodyModel.scheduleForDrawing();
+
+ if (this->Hiding == 0) {
+ bodyModel.scheduleForDrawing(); }
+ else {
+ hideModel.scheduleForDrawing(); }
return true;
}
@@ -248,12 +263,17 @@ void daRamboo_c::updateModelMatrices() {
fogModel.setScale(&scale);
fogModel.calcWorld(false);
- matrix.translation(pos.x + 160.0, pos.y - 80.0, pos.z);
+ matrix.translation(pos.x + 160.0, pos.y - 80.0, pos.z + 200.0);
matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z);
- bodyModel.setDrawMatrix(matrix);
- bodyModel.setScale(&scale);
- bodyModel.calcWorld(false);
+ if (this->Hiding == 0) {
+ bodyModel.setDrawMatrix(matrix);
+ bodyModel.setScale(&scale);
+ bodyModel.calcWorld(false); }
+ else {
+ hideModel.setDrawMatrix(matrix);
+ hideModel.setScale(&scale);
+ hideModel.calcWorld(false); }
}
@@ -263,6 +283,7 @@ void daRamboo_c::beginState_Grow() {
OSReport("Growing when Kameck Tells me to.");
this->timer = 0;
// PlaySound(this, SE_BOSS_ROY_MAGIC_MAKE_FAST);
+
}
void daRamboo_c::executeState_Grow() {
@@ -271,8 +292,8 @@ void daRamboo_c::executeState_Grow() {
float scaleSpeed, yPosScaling;
+ if (this->timer == 60) { PlaySound(this, SE_BOSS_IGGY_WANWAN_TO_L); }
if ((this->timer > 60) && (this->timer < 140)) {
- PlaySound(this, SE_BOSS_IGGY_WANWAN_L_TO_M);
scaleSpeed = 0.175;
// yPosScaling = 0;
@@ -309,9 +330,13 @@ void daRamboo_c::beginState_Advance() {
this->speed.y = 0;
this->speed.z = 0;
this->timer = 0;
+
+
}
void daRamboo_c::executeState_Advance() {
+ this->bodyModel._vf1C();
+
this->pos.x -= this->timer / 32;
this->pos.y = this->Baseline + sin(this->ytimer * 3.14 / 192) * 48;
@@ -342,16 +367,36 @@ void daRamboo_c::beginState_Wait() {
}
void daRamboo_c::executeState_Wait() {
+
+ if (this->timer == 55) {
+ nw4r::g3d::ResAnmChr anmChrB = this->resFile.GetResAnmChr("shay_teresaB");
+ this->anmShayB.bind(&this->hideModel, anmChrB, 1);
+ this->hideModel.bindAnim(&this->anmShayB, 0.0);
+ this->anmShayB.setUpdateRate(1.0);
+ }
+
if (this->timer > 60) {
PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU);
doStateChange(&StateID_Advance);
}
+
+
+ this->hideModel._vf1C();
this->timer += 1;
}
-void daRamboo_c::endState_Wait() { OSReport("No more bouncing."); }
+void daRamboo_c::endState_Wait() {
+
+ this->Hiding = 0;
+
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaA");
+ this->anmShayA.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmShayA, 0.0);
+ this->anmShayA.setUpdateRate(1.0);
+
+ OSReport("No more bouncing."); }
@@ -361,18 +406,133 @@ void daRamboo_c::endState_Wait() { OSReport("No more bouncing."); }
void daRamboo_c::beginState_Flee() {
+// bindAnimChr_and_setUpdateRates("shay_teresaA", this->animationChrC, this->bodyModel, 1.0);
+
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("wait");
+ this->anmWaitA.bind(&this->bodyModel, anmChr, 1);
+ this->bodyModel.bindAnim(&this->anmWaitA, 0.0);
+ this->anmWaitA.setUpdateRate(1.0);
+
OSReport("Damnit that hurt.");
this->timer = 0;
+
}
void daRamboo_c::executeState_Flee() {
-
+
+ if (timer == 10) {
+ this->Hiding = 1;
+
+ nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaB_wait");
+ this->anmWaitB.bind(&this->hideModel, anmChr, 1);
+ this->hideModel.bindAnim(&this->anmWaitB, 0.0);
+ this->anmWaitB.setUpdateRate(1.0);
+ }
+
this->pos.x += (60 - this->timer) / 8;
- if (this->timer > 60) { doStateChange(&StateID_Wait); }
+ if (timer < 10) {
+ this->bodyModel._vf1C(); }
+ else {
+ this->hideModel._vf1C(); }
+
+
+ if (this->timer > 60) {
+ doStateChange(&StateID_Wait);
+ }
this->timer += 1;
}
-void daRamboo_c::endState_Flee() { OSReport("Ugh, so dizzy."); }
+void daRamboo_c::endState_Flee() {
+
+ OSReport("Ugh, so dizzy.");
+}
+
+
+
+
+void daRamboo_c::beginState_Outro() {
+
+ this->removeMyActivePhysics();
+ this->timer = 0;
+ this->rot.x = 0x0; // X is vertical axis
+ this->rot.y = 0xE000; // Y is horizontal axis
+ this->rot.z = 0x0; // Z is ... an axis >.>
+
+}
+void daRamboo_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);
+ PlaySound(this, SE_EMY_BIG_TERESA_DEAD);
+
+ // Adjust this to equal the scale of your boss / 80.
+ this->scale.x -= 0.175;
+ this->scale.y -= 0.175;
+ this->scale.z -= 0.175;
+
+ this->pos.y += 2.0;
+
+ Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0};
+
+ if (this->timer == 30) {
+ CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 756);
+ CreateEffect(&tempPos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}, 801);
+ CreateEffect(&tempPos, &(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;
+
+ Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0};
+
+ CreateEffect(&tempPos, &(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 daRamboo_c::endState_Outro() { }
+
diff --git a/src/fakeStarCoin.cpp b/src/fakeStarCoin.cpp
index 07d37f7..fb0df72 100644
--- a/src/fakeStarCoin.cpp
+++ b/src/fakeStarCoin.cpp
@@ -55,7 +55,7 @@ int daFakeStarCoin::onCreate() {
nw4r::g3d::ResFile rf(getResource("star_coin", "g3d/star_coin.brres"));
bodyModel.setup(rf.GetResMdl("star_coinA"), &allocator, 0x224, 1, 0);
- SetupTextures_Enemy(&bodyModel, 0);
+ SetupTextures_Map(&bodyModel, 0);
allocator.unlink();
@@ -79,7 +79,8 @@ int daFakeStarCoin::onCreate() {
this->scale.z = 1.0;
this->pos.x -= 120.0;
-
+ this->pos.z = 3300.0;
+
this->onExecute();
return true;
}