diff options
author | Treeki <treeki@gmail.com> | 2011-11-01 22:59:27 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-11-01 22:59:27 +0100 |
commit | c274d2173da36069855b191b93c831c1ad9bcb2b (patch) | |
tree | 538e27ae34d8cad6b269bc7066bfdbca3687b943 | |
parent | a5b283748c34215fb0954b8caa5f27ea00541cad (diff) | |
parent | 804bc013c1a3ec3afeedb19a1351ee4c3206c901 (diff) | |
download | kamek-c274d2173da36069855b191b93c831c1ad9bcb2b.tar.gz kamek-c274d2173da36069855b191b93c831c1ad9bcb2b.zip |
Merge branch 'level-select' of tsn:Kamek into level-select
Diffstat (limited to '')
-rw-r--r-- | src/bossBalboaWrench.cpp | 181 | ||||
-rw-r--r-- | src/bossFuzzyBear.cpp | 13 | ||||
-rw-r--r-- | src/bossRamboo.cpp | 68 | ||||
-rw-r--r-- | src/bossWrenchThrow.cpp | 338 | ||||
-rw-r--r-- | src/fakeStarCoin.cpp | 52 | ||||
-rw-r--r-- | src/soundPlayer.S | 4 |
6 files changed, 518 insertions, 138 deletions
diff --git a/src/bossBalboaWrench.cpp b/src/bossBalboaWrench.cpp index efb3abe..703123d 100644 --- a/src/bossBalboaWrench.cpp +++ b/src/bossBalboaWrench.cpp @@ -33,10 +33,8 @@ class daBalboa_c : public dEn_c { float Baseline; float dying; Vec PopUp [4]; - dStageActor_c *homingWrench; - int homingWrenchLifeSpan; - float homingWrenchDirection; char throwCount; + char upsideDown; static daBalboa_c *build(); @@ -196,7 +194,7 @@ int daBalboa_c::onCreate() { HitMeBaby.yDistToCenter = 36.0; HitMeBaby.xDistToEdge = 24.0; - HitMeBaby.yDistToEdge = 30.0; + HitMeBaby.yDistToEdge = 32.0; HitMeBaby.category1 = 0x3; HitMeBaby.category2 = 0x0; @@ -215,13 +213,16 @@ int daBalboa_c::onCreate() { 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->upsideDown = 0; this->direction = 0; // Heading left. this->pos.z = -800.0; + this->pos.y -= 8.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}; + this->PopUp[0] = (Vec){this->pos.x, this->pos.y - 72.0, this->pos.z}; + this->PopUp[1] = (Vec){this->pos.x - 224.0, this->pos.y - 72.0, this->pos.z}; + this->PopUp[2] = (Vec){this->pos.x, this->pos.y + 248.0, this->pos.z}; + this->PopUp[3] = (Vec){this->pos.x - 224.0, this->pos.y + 248.0, this->pos.z}; + this->PopUp[4] = (Vec){this->pos.x - 112.0, this->pos.y - 40.0, this->pos.z}; OSReport("Setting the State"); @@ -246,20 +247,7 @@ int daBalboa_c::onExecute() { 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; } @@ -304,7 +292,7 @@ void daBalboa_c::executeState_Grow() { float modifier; - modifier = 2.0 + ((this->timer - 60) * scaleSpeed); + modifier = 1.0 + ((this->timer - 60) * scaleSpeed); this->scale = (Vec){modifier, modifier, modifier}; // this->pos.y = this->pos.y + (yPosScaling/80); @@ -313,6 +301,7 @@ void daBalboa_c::executeState_Grow() { if (this->timer > 170) { PlaySound(this, SE_EMY_CHOROPU_BOUND); + this->upsideDown = 0; doStateChange(&StateID_BackDown); } @@ -338,17 +327,48 @@ void daBalboa_c::beginState_ManholeUp() { this->timer = 0; int randChoice; - randChoice = GenerateRandomNumber(4); + randChoice = GenerateRandomNumber(5); this->pos = this->PopUp[randChoice]; - if (randChoice < 2) { // On the left side! + if (randChoice == 0) { // On the left side! + this->rot.y = 0xE000; + this->rot.z = 0; + this->upsideDown = 0; + this->direction = 0; } + + else if (randChoice == 1) { // On the right side! + this->rot.y = 0x2000; + this->rot.z = 0; + this->upsideDown = 0; + this->direction = 1; } + + else if (randChoice == 2) { // On the right ceiling! this->rot.y = 0xE000; + this->rot.z = 0x8000; + this->upsideDown = 1; this->direction = 0; } - else { // On the right side! + + else if (randChoice == 3) { // On the left ceiling! this->rot.y = 0x2000; + this->rot.z = 0x8000; + this->upsideDown = 1; this->direction = 1; } + else if (randChoice == 4) { // In the Center! + char PlayerID = NearestPlayer(this); + dStageActor_c *Player = GetSpecificPlayerActor(PlayerID); + + this->upsideDown = 0; + this->rot.z = 0; + if (Player->pos.x < this->pos.x) { + this->rot.y = 0xE000; + this->direction = 0; } + else { + this->rot.y = 0x2000; + this->direction = 1; } + } + PlaySound(this, 0x21F); } @@ -357,9 +377,13 @@ 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->upsideDown == 0) { + this->pos.y += 0.6; } // Height is 72 pixels, move up 18 pixels. + else { + this->pos.y -= 0.6; } // Height is 72 pixels, move down 18 pixels. + } - if (this->timer > 90) { + if (this->timer > 60) { doStateChange(&StateID_HeadPoke); } this->timer += 1; @@ -385,8 +409,12 @@ void daBalboa_c::beginState_HeadPoke() { 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->upsideDown == 0) { + this->pos.y += 0.6; } // Height is 72 pixels, move up 20 pixels. + else { + this->pos.y -= 0.6; } // Height is 72 pixels, move down 20 pixels. + } + if (this->timer > 90) { doStateChange(&StateID_AllOut); } @@ -406,7 +434,7 @@ 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->bodyModel.bindAnim(&this->anmThrow_3, 0.0); this->anmThrow_3.setUpdateRate(1.0); this->timer = 0; @@ -419,9 +447,13 @@ 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->upsideDown == 0) { + this->pos.y += 1.2; } // Height is 72 pixels, move up last 36 pixels. + else { + this->pos.y -= 1.2; } // Height is 72 pixels, move down last 36 pixels. + } - if (this->timer > 90) { + if (this->timer > 45) { int randChoice; randChoice = GenerateRandomNumber(2); @@ -457,52 +489,13 @@ void daBalboa_c::beginState_ThrowHoming() { } - 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); - + u32 settings; - 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; } + settings = (this->direction) | (this->upsideDown << 1); + settings = settings | 0x10; + CreateActor(544, settings, this->pos, 0, 0); - PlaySound(this, 0x222); - this->homingWrenchLifeSpan = 360; this->timer = 0; } @@ -548,33 +541,15 @@ void daBalboa_c::executeState_ThrowWrench() { } - 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; - } + u32 settings; + u8 up = this->upsideDown; + u8 throwc = this->throwCount; + u8 dir = this->direction; - else { - tempPos.x += 32.0; - tempPos.y += 10.0; + settings = (dir) | (up << 1); + settings = settings | (throwc & 1 << 8); - 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); + CreateActor(544, settings, this->pos, 0, 0); this->timer = 0; this->throwCount += 1; @@ -611,7 +586,11 @@ void daBalboa_c::beginState_BackDown() { void daBalboa_c::executeState_BackDown() { if (this->timer < 60) { - this->pos.y -= 2.6667; } // Height is 80 pixels, move down 80 pixels. + if (this->upsideDown == 0) { + this->pos.y -= 1.2; } // Height is 72 pixels, move down + else { + this->pos.y += 1.2; } // Height is 72 pixels, move up + } if (this->timer > 90) { doStateChange(&StateID_ManholeUp); } diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp index 0c16d42..463d063 100644 --- a/src/bossFuzzyBear.cpp +++ b/src/bossFuzzyBear.cpp @@ -25,7 +25,7 @@ class daFuzzyBear_c : public dEn_c { float AreaWidthRight; float LaunchSpeedShort; float LaunchSpeedHigh; - u8 dying; + char dying; float storeSpeed; Vec initialPos; char RolyBounces; @@ -70,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, int thing=0); +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); @@ -248,6 +248,7 @@ int daFuzzyBear_c::onCreate() { this->roly = 0; this->damage = 0; this->isInvulnerable = 0; + this->dying = 0; bindAnimChr_and_setUpdateRate("run", 1, 0.0, 1.0); @@ -384,12 +385,12 @@ void daFuzzyBear_c::executeState_Bounce() { // Check for walls - if (this->pos.x <= this->initialPos.x - ((15 * 24.0) + wallDistance)) { // Hit left wall, head right. + if (this->pos.x <= this->initialPos.x - ((17 * 16.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 + ((5 * 24.0) - wallDistance)) { // Hit right wall, head left. + if (this->pos.x >= this->initialPos.x + ((7.5 * 16.0) - wallDistance)) { // Hit right wall, head left. this->speed.x = -this->speed.x; this->direction = 0; this->pos.x = this->pos.x - 1.0; } @@ -650,14 +651,14 @@ void daFuzzyBear_c::executeState_RolyPoly() { this->timer += 1; - if (this->pos.x <= this->initialPos.x - ((15 * 24.0) + wallDistance)) { // Hit left wall, head right. + if (this->pos.x <= this->initialPos.x - ((17 * 16.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 + ((5 * 24.0) - wallDistance)) { // Hit right wall, head left. + if (this->pos.x >= this->initialPos.x + ((7.5 * 16.0) - wallDistance)) { // Hit right wall, head left. this->speed.x = -this->speed.x; this->direction = 0; this->pos.x = this->pos.x - 1.0; diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index d37baf6..598cf75 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -30,8 +30,8 @@ class daRamboo_c : public dEn_c { int timer; int ytimer; char Hiding; + char dying; float Baseline; - float dying; u64 eventFlag; @@ -147,7 +147,7 @@ void daRamboo_c::setupModels() { nw4r::g3d::ResMdl mdlC = this->resFile.GetResMdl("teresaB"); this->hideModel.setup(mdlC, &allocator, 0x224, 1, 0); - SetupTextures_Enemy(&this->bodyModel, 0); + SetupTextures_Enemy(&this->hideModel, 0); nw4r::g3d::ResAnmChr anmChrE = this->resFile.GetResAnmChr("shay_teresaB"); ret = this->anmShayB.setup(mdlC, anmChrE, &this->allocator, 0); @@ -182,8 +182,8 @@ int daRamboo_c::onCreate() { HitMeBaby.xDistToCenter = 160.0; HitMeBaby.yDistToCenter = -80.0; - HitMeBaby.xDistToEdge = 154.0; - HitMeBaby.yDistToEdge = 154.0; + HitMeBaby.xDistToEdge = 148.0; + HitMeBaby.yDistToEdge = 148.0; HitMeBaby.category1 = 0x3; HitMeBaby.category2 = 0x0; @@ -205,6 +205,7 @@ int daRamboo_c::onCreate() { this->rot.z = 0; // Z is ... an axis >.> this->direction = 0; // Heading left. this->Hiding = 0; + this->dying = 0; this->speed.x = 0.0; this->ytimer = 0; @@ -354,14 +355,21 @@ void daRamboo_c::beginState_Advance() { this->speed.z = 0; this->timer = 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); } 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; + if (this->anmWaitA.isAnimationDone()) { + this->anmWaitA.setCurrentFrame(0.0); } + + this->pos.x -= this->timer / 48.0; + this->pos.y = this->Baseline + sin(this->ytimer * 3.14 / 192) * 36; if (this->timer >= 48) { this->timer = 47; } @@ -390,22 +398,37 @@ void daRamboo_c::beginState_Wait() { } void daRamboo_c::executeState_Wait() { + if (this->timer < 90) { + this->hideModel._vf1C(); } - if (this->timer == 55) { + if (this->timer > 55) { + this->bodyModel._vf1C(); } + + + if (this->timer == 70) { + 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); + } + + + 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) { + + + if (this->anmShayB.isAnimationDone()) { PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU); doStateChange(&StateID_Advance); } - - this->hideModel._vf1C(); - this->timer += 1; } @@ -429,21 +452,15 @@ void daRamboo_c::endState_Wait() { 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->hideModel._vf1C(); + + if (this->timer == 10) { this->Hiding = 1; nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("shay_teresaB_wait"); @@ -452,15 +469,10 @@ void daRamboo_c::executeState_Flee() { this->anmWaitB.setUpdateRate(1.0); } - this->pos.x += (60 - this->timer) / 8; + this->pos.x += (60 - this->timer) / 6; - if (timer < 10) { - this->bodyModel._vf1C(); } - else { - this->hideModel._vf1C(); } - - if (this->timer > 60) { + if ((this->timer > 60) && (this->anmWaitB.isAnimationDone())) { doStateChange(&StateID_Wait); } @@ -518,7 +530,7 @@ void daRamboo_c::executeState_Outro() { return; } - if (this->scale.x > 0.1) { + if (this->scale.x > 0) { PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST); PlaySound(this, SE_EMY_BIG_TERESA_DEAD); diff --git a/src/bossWrenchThrow.cpp b/src/bossWrenchThrow.cpp new file mode 100644 index 0000000..e99797b --- /dev/null +++ b/src/bossWrenchThrow.cpp @@ -0,0 +1,338 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include "player.h" +#include "effects.h" +#include <sfx.h> + + +extern "C" void *PlaySound(dEn_c *, int soundID); +extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daWrench *); +extern "C" dStageActor_c *GetSpecificPlayerActor(int number); + + +class daWrench : public dEn_c { + int onCreate(); + int onExecute(); + int onDelete(); + int onDraw(); + + mHeapAllocator_c allocator; + m3d::mdl_c bodyModel; + + int timer; + char homing; + char direction; + char front; + float ymod; + int lifespan; + + static daWrench *build(); + + 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); + void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + + + USING_STATES(daWrench); + DECLARE_STATE(HandThrow); + DECLARE_STATE(Homing); + DECLARE_STATE(Straight); + +}; + +CREATE_STATE(daWrench, HandThrow); +CREATE_STATE(daWrench, Homing); +CREATE_STATE(daWrench, Straight); + + + +void daWrench::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + + this->_vf220(apOther->owner); + + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + if(apOther->owner->_38D > 3) { + OSReport("!!!ATTENTION!!!\napOther->owner->_38D > 3\n"); + }else{ + this->counter_504[apOther->owner->_38D] = 0; + } +} + +void daWrench::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { } +bool daWrench::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { + return false; +} +void daWrench::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) {} +void daWrench::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5}, 48); + + PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); + + this->Delete(); +} +void daWrench::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) {} + + + + +daWrench *daWrench::build() { + void *buffer = AllocFromGameHeap1(sizeof(daWrench)); + return new(buffer) daWrench; +} + + +int daWrench::onCreate() { + + allocator.link(-1, GameHeaps[0], 0, 0x20); + + nw4r::g3d::ResFile rf(getResource("choropoo", "g3d/choropoo.brres")); + bodyModel.setup(rf.GetResMdl("spanner"), &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&bodyModel, 0); + + allocator.unlink(); + + + this->homing = this->settings & 0xF; + this->direction = (this->settings >> 4) & 0xF; + this->front = (this->settings >> 8) & 0xF; + + + ActivePhysics::Info HitMeBaby; + + if (this->homing == 0) { + HitMeBaby.yDistToCenter = 21.0; + HitMeBaby.xDistToEdge = 27.0; + HitMeBaby.yDistToEdge = 21.0; + + this->scale.x = 1.5; + this->scale.y = 1.5; + this->scale.z = 1.5; + } + + else { + HitMeBaby.yDistToCenter = 42.0; + HitMeBaby.xDistToEdge = 54.0; + HitMeBaby.yDistToEdge = 42.0; + + this->scale.x = 3.0; + this->scale.y = 3.0; + this->scale.z = 3.0; + } + + HitMeBaby.xDistToCenter = 0.0; + HitMeBaby.category1 = 0x3; + HitMeBaby.category2 = 0x0; + HitMeBaby.bitfield1 = 0x47; + HitMeBaby.bitfield2 = 0xFFFFFFFF; + HitMeBaby.unkShort1C = 0; + HitMeBaby.callback = &dEn_c::collisionCallback; + + this->aPhysics.initWithStruct(this, &HitMeBaby); + this->aPhysics.addToList(); + + + this->pos.z = 3300.0; + + doStateChange(&StateID_HandThrow); + + this->onExecute(); + return true; +} + + +int daWrench::onDelete() { + return true; +} + +int daWrench::onDraw() { + bodyModel.scheduleForDrawing(); + return true; +} + + +void daWrench::updateModelMatrices() { + 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); +} + + +int daWrench::onExecute() { + updateModelMatrices(); + + return true; +} + + + +void daRamboo_c::beginState_HandThrow() { + + if (this->direction == 0) { // Ground Facing Left + this->pos.x += 32.0; + this->pos.y += 48.0; + this->rot.z = 0x4000; + } + else if (this->direction == 1) { // Ground Facing Right + this->pos.x -= 32.0; + this->pos.y += 48.0; + this->rot.z = 0xC000; + } + else if (this->direction == 2) { // Upside Down Facing Left + this->pos.x += 32.0; + this->pos.y -= 48.0; + this->rot.z = 0x4000; + } + else if (this->direction == 3) { // Upside Down Facing Right + this->pos.x -= 32.0; + this->pos.y -= 48.0; + this->rot.z = 0xC000; + } + + if (this->front == 1) { this->pos.z = -804.0; } + + this->lifespan = 0; +} +void daRamboo_c::executeState_HandThrow() { + + if (this->lifespan == 60) { + + if (this->homing == 0) { + doStateChange(&StateID_Straight); } + else { + doStateChange(&StateID_Homing); } + + } + + this->lifespan += 1; + +} +void daRamboo_c::endState_HandThrow() { } + + + +void daRamboo_c::beginState_Homing() { + this->lifespan = 360; + + Vec tempPos = this->pos; + + 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->ymod = 0.0; } + + else if ((Player->pos.y >= tempPos.y - 106.0) && (Player->pos.y < tempPos.y - 16.0)) { + this->ymod = -0.6; } + + else if ((Player->pos.y <= tempPos.y + 106.0) && (Player->pos.y > tempPos.y + 16.0)) { + this->ymod = 0.6; } + + else if (Player->pos.y < tempPos.y - 106.0) { + this->ymod = -1.2; } + + else if (Player->pos.y > tempPos.y + 106.0) { + this->ymod = 1.2; } + + else { + this->ymod = 0.0; } + + if (this->direction == 0) { this->speed.x = -7.0; } + else { this->speed.x = 7.0; } + + + +} +void daRamboo_c::executeState_Homing() { + + if (this->direction && 1) { // directions 1 and 3 spin clockwise, fly rightwards + this->rot.z += 0x400; } + else { // directions 0 and 2 spin anti-clockwise, fly leftwards + this->rot.z -= 0x400; } + + UpdateObjectPosBasedOnSpeedValues_real(this); + + this->pos.y += this->ymod; + + if (this->lifespan < 1) { + + PlaySound(this, SE_OBJ_HAMMER_HIT_BOTH); + + CreateEffect(&this->homingWrench->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 242); + this->Delete(); + } + + PlaySound(this, SE_EMY_CHOROPU_M_SPANNER); + + this->lifespan -= 1; + +} +void daRamboo_c::endState_Homing() { } + + + +void daRamboo_c::beginState_Straight() { + + 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) { + this->speed.x = -6.0; + this->speed.y = -6.0 * slope; + } + + else { + this->speed.x = 6.0; + this->speed.y = 6.0 * slope; + } +} + +void daRamboo_c::executeState_Straight() { + + this->lifespan = 360; + + if (this->direction && 1) { // directions 1 and 3 spin clockwise, fly rightwards + this->rot.z += 0x400; } + else { // directions 0 and 2 spin anti-clockwise, fly leftwards + this->rot.z -= 0x400; } + + UpdateObjectPosBasedOnSpeedValues_real(this); + + PlaySound(this, SE_EMY_CHOROPU_M_SPANNER); + + if (this->lifespan == (360-45)) { this->pos.z = 3300.0; } + + if (this->lifespan < 1) { + + PlaySound(this, SE_OBJ_HAMMER_HIT_BOTH); + + CreateEffect(&this->homingWrench->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}, 242); + this->Delete(); + } + + this->lifespan -= 1; +} +void daRamboo_c::endState_Straight() { } + + + + + + + + + diff --git a/src/fakeStarCoin.cpp b/src/fakeStarCoin.cpp index fb0df72..a845e45 100644 --- a/src/fakeStarCoin.cpp +++ b/src/fakeStarCoin.cpp @@ -30,6 +30,12 @@ class daFakeStarCoin : public dEn_c { 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); + void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + }; @@ -41,6 +47,50 @@ void daFakeStarCoin::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth this->Delete(); } +void daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 336); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 342); + + PlaySound(this, SE_EMY_FIRE_SNAKE_BIGGER); + + this->Delete(); +} +bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 44); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 231); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 235); + + PlaySound(this, SE_OBJ_PNGN_ICE_BREAK); + + this->Delete(); + return false; +} +void daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 48); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 378); + + PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); + + this->Delete(); +} +void daFakeStarCoin::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 48); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 378); + + PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); + + this->Delete(); +} +void daFakeStarCoin::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 336); + CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){3.0, 3.0, 3.0}, 342); + + PlaySound(this, SE_EMY_FIRE_SNAKE_BIGGER); + + this->Delete(); +} + + daFakeStarCoin *daFakeStarCoin::build() { @@ -67,7 +117,7 @@ int daFakeStarCoin::onCreate() { HitMeBaby.category1 = 0x5; HitMeBaby.category2 = 0x0; HitMeBaby.bitfield1 = 0x4F; - HitMeBaby.bitfield2 = 0x200; + HitMeBaby.bitfield2 = 0xFFFFFFFF; HitMeBaby.unkShort1C = 0; HitMeBaby.callback = &dEn_c::collisionCallback; diff --git a/src/soundPlayer.S b/src/soundPlayer.S index 645af31..e132849 100644 --- a/src/soundPlayer.S +++ b/src/soundPlayer.S @@ -87,7 +87,7 @@ GoAwaySoundGuy: StopSound: stwu r1, -0x10(r1) - mtlr r0 + mflr r0 stw r0, 0x14(r1) mr r4, r3 @@ -95,6 +95,6 @@ StopSound: bl StopSoundBasic lwz r0, 0x14(r1) - mflr r0 + mtlr r0 blr |