diff options
Diffstat (limited to '')
-rw-r--r-- | kamek_pal.x | 2 | ||||
-rw-r--r-- | src/boss.cpp | 4 | ||||
-rw-r--r-- | src/bossFlameThrower.cpp | 4 | ||||
-rw-r--r-- | src/bossRamboo.cpp | 61 | ||||
-rw-r--r-- | src/levelspecial.cpp | 172 | ||||
-rwxr-xr-x | src/meteor.cpp | 25 | ||||
-rwxr-xr-x | src/thundercloud.cpp | 4 |
7 files changed, 91 insertions, 181 deletions
diff --git a/kamek_pal.x b/kamek_pal.x index 4e4b426..f0e75db 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -111,6 +111,8 @@ SECTIONS { OneofManySoundPlayers = 0x800CE9B0; BombExplodeState = 0x80B12A48; NoFreezie = 0x800A0B08; + GameTimer = 0x8042A350; + GameTimerB = 0x80D25BF8; DoSceneChange__FUsUiUi = 0x800E1F50; diff --git a/src/boss.cpp b/src/boss.cpp index 72e8121..df553fb 100644 --- a/src/boss.cpp +++ b/src/boss.cpp @@ -113,12 +113,10 @@ bool ShrinkBoss(daBoss *actor, Vec *pos, float scale, int timer) { // actor->pos.y += 2.0; - - if (actor->timer == 30) { + if (timer == 30) { SpawnEffect("Wm_ob_starcoinget_gl", 0, pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); SpawnEffect("Wm_mr_vshipattack_hosi", 0, pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); SpawnEffect("Wm_ob_keyget01_b", 0, pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); - actor->timer = 0; } if (actor->scale.x < 0) { return true; } diff --git a/src/bossFlameThrower.cpp b/src/bossFlameThrower.cpp index 871625a..78f93fd 100644 --- a/src/bossFlameThrower.cpp +++ b/src/bossFlameThrower.cpp @@ -31,9 +31,9 @@ int daKoopaBreath::onCreate() { ActivePhysics::Info GreatBalls; GreatBalls.xDistToCenter = 0.0; - GreatBalls.yDistToCenter = 18.0; + GreatBalls.yDistToCenter = 0.0; GreatBalls.xDistToEdge = 38.0; - GreatBalls.yDistToEdge = 38.0; + GreatBalls.yDistToEdge = 28.0; GreatBalls.category1 = 0x3; GreatBalls.category2 = 0x0; diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index ea97629..bf27d51 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -4,6 +4,7 @@ #include <sfx.h> #include <stage.h> #include "boss.h" +#include "player.h" class daRamboo_c : public daBoss { int onCreate(); @@ -69,8 +70,12 @@ CREATE_STATE(daRamboo_c, Wait); CREATE_STATE(daRamboo_c, Flee); CREATE_STATE(daRamboo_c, Outro); +extern "C" void *EN_LandbarrelPlayerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther); -void daRamboo_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); } +void daRamboo_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + EN_LandbarrelPlayerCollision(this, apThis, apOther); + DamagePlayer(this, apThis, apOther); +} void daRamboo_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_en_obakedoor_sm", 0, &apOther->owner->pos, &(S16Vec){0,0,0}, &(Vec){0.5, 0.5, 0.5}); this->pos.x += 6.0; @@ -156,13 +161,14 @@ int daRamboo_c::onCreate() { this->scale = (Vec){2.0, 2.0, 2.0}; + this->aPhysics.collisionCheckType = 1; ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 160.0; HitMeBaby.yDistToCenter = 80.0; - HitMeBaby.xDistToEdge = 148.0; - HitMeBaby.yDistToEdge = 148.0; + HitMeBaby.xDistToEdge = 132.0; + HitMeBaby.yDistToEdge = 132.0; HitMeBaby.category1 = 0x3; HitMeBaby.category2 = 0x0; @@ -173,15 +179,6 @@ int daRamboo_c::onCreate() { this->aPhysics.initWithStruct(this, &HitMeBaby); - this->aPhysics.collisionCheckType = 2; - this->aPhysics._8 = 48.0; - this->aPhysics._C = 48.0; - this->aPhysics._18 = 48.0; - this->aPhysics.trpValue0 = 48.0; - this->aPhysics.trpValue1 = 48.0; - this->aPhysics.trpValue2 = 48.0; - this->aPhysics.trpValue3 = 48.0; - this->aPhysics.addToList(); this->Baseline = this->pos.y; @@ -237,6 +234,7 @@ int daRamboo_c::onExecute() { this->fogSrt.setFrameForEntry(1.0, 0); if (dFlagMgr_c::instance->flags & this->eventFlag) { + dFlagMgr_c::instance->flags = dFlagMgr_c::instance->flags && this->eventFlag; doStateChange(&StateID_Outro); } @@ -303,6 +301,23 @@ void daRamboo_c::endState_Grow() { +float RightmostPlayerPos() { + dStageActor_c* current; + current->pos.x = 0.0; + + for(char ii = 0; ii < 4; ii++) { + dStageActor_c* player = GetSpecificPlayerActor(ii); + if(!player) { + continue; + } + // actor->pos.x, actor->pos.y, actor->pos.z, + // player->pos.x, player->pos.y, player->pos.z); + if(player->pos.x > current->pos.x) { + current = player; + } + } + return current->pos.x; +} // Advance State @@ -325,11 +340,17 @@ void daRamboo_c::executeState_Advance() { if (this->anmWaitA.isAnimationDone()) { this->anmWaitA.setCurrentFrame(0.0); } - this->pos.x -= this->timer / 48.0; + float px = RightmostPlayerPos(); + + if ((px - 132.0) < this->pos.x) { + this->pos.x -= this->timer / 28.0; } + else { + this->pos.x = (px - 132.0); } + this->pos.y = this->Baseline + sin(this->ytimer * 3.14 / 192) * 36; - if (this->timer >= 48) { this->timer = 47; } + if (this->timer >= 32) { this->timer = 31; } if (this->ytimer >= 384) { this->ytimer = 0; } PlaySound(this, SE_EMY_TERESA); @@ -423,7 +444,7 @@ void daRamboo_c::executeState_Flee() { this->anmWaitB.setUpdateRate(1.0); } - this->pos.x += (60 - this->timer) / 6; + this->pos.x += (60 - this->timer) / 8; if ((this->timer > 60) && (this->anmWaitB.isAnimationDone())) { @@ -454,7 +475,6 @@ void daRamboo_c::beginState_Outro() { OutroSetup(this); } void daRamboo_c::executeState_Outro() { - if (this->anmWaitB.isAnimationDone()) this->anmWaitB.setCurrentFrame(0.0); @@ -467,15 +487,16 @@ void daRamboo_c::executeState_Outro() { PlayerVictoryCries(this); } - this->timer += 1; + this->timer = timer + 1; return; } bool ret; Vec tempPos = (Vec){this->pos.x + 160.0, this->pos.y - 80.0, 5500.0}; ret = ShrinkBoss(this, &tempPos, 15.0, this->timer); + pos.y -= 2.0; - if (ret == true) { + if (ret) { BossExplode(this, &tempPos); this->dying = 1; this->timer = 0; @@ -484,8 +505,8 @@ void daRamboo_c::executeState_Outro() { PlaySound(this, SE_EMY_BIG_TERESA_DEAD); } - this->timer += 1; - + timer = timer + 1; + OSReport("Timer: %d", timer); } void daRamboo_c::endState_Outro() { } diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp index adadc50..25e2130 100644 --- a/src/levelspecial.cpp +++ b/src/levelspecial.cpp @@ -17,11 +17,12 @@ struct LevelSpecial { u8 effect; // 0x3D5 u8 lastEvState; // 0x3D6 u8 func; // 0x3D7 + u32 keepTime; + u32 setTime; }; extern u16 TimeStopFlag; -extern u32 TimerBranch; extern u32 AlwaysDrawFlag; extern u32 AlwaysDrawBranch; @@ -38,6 +39,10 @@ extern char SizerOn; extern char ZOrderOn; extern int GlobalStarsCollected; +extern u32 GameTimer; + +#define time *(u32*)((GameTimer) + 0x4) + float GlobalSizeFloatModifications [] = {1, 0.25, 0.5, 0.75, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5, 6, 7, 8, 10 }; float GlobalRiderFloatModifications [] = {1, 0.6, 0.7, 0.9, 1, 1, 1, 1.1, 1.25, 1.5, 2, 2.5, 3, 3.5, 4, 5}; @@ -56,7 +61,6 @@ fBase_c *FindActorByID(u32 id); bool ResetAfterLevel(void) { // TimeStopFlag = 0; - TimerBranch = 0x3403FFA4; MarioDescentRate = -4; MarioJumpMax = 3.628; MarioJumpArc = 2.5; @@ -77,11 +81,12 @@ bool LevelSpecial_Create(LevelSpecial *self) { char eventNum = (self->settings >> 24) & 0xFF; self->eventFlag = (u64)1 << (eventNum - 1); - + self->keepTime = 0; self->type = (self->settings) & 15; self->effect = (self->settings >> 4) & 15; - + self->setTime = (self->settings >> 8) & 0xFFFF; + self->lastEvState = 0xFF; LevelSpecial_Update(self); @@ -90,6 +95,9 @@ bool LevelSpecial_Create(LevelSpecial *self) { } bool LevelSpecial_Execute(LevelSpecial *self) { + if (self->keepTime > 0) { + time = self->keepTime; } + LevelSpecial_Update(self); return true; } @@ -116,7 +124,7 @@ void LevelSpecial_Update(LevelSpecial *self) { // break; case 2: // Stop Timer - TimerBranch = 0x7C601B78; + self->keepTime = time; break; @@ -137,81 +145,9 @@ void LevelSpecial_Update(LevelSpecial *self) { } break; -// case 4: // Mario Size -// dAc_Py_c *Mario; -// if (self->effect == 0) //Super Size -// { -// MarioSize = 4.0; - -// for(int n=0; n<4; n++) { -// OSReport("Changing Physics for Player %d\n", n); -// Mario = GetSpecificPlayerActor(n); -// OSReport("Player Actor at %08x\n", Mario); -// if(Mario == 0) -// continue; -// // Mario->aPhysics.info.xDistToCenter = Mario->aPhysics.info.xDistToCenter * 4.0; -// // Mario->aPhysics.info.xDistToEdge = Mario->aPhysics.info.xDistToEdge * 4.0; -// // Mario->aPhysics.info.yDistToCenter = Mario->aPhysics.info.yDistToCenter * 4.0; -// // Mario->aPhysics.info.yDistToEdge = Mario->aPhysics.info.yDistToEdge * 4.0; -// // -// Mario->bPhysics.info.xDistToCenter = Mario->bPhysics.info.xDistToCenter * 4.0; -// Mario->bPhysics.info.xDistToEdge = Mario->bPhysics.info.xDistToEdge * 4.0; -// Mario->bPhysics.info.yDistToCenter = Mario->bPhysics.info.yDistToCenter * 4.0; -// Mario->bPhysics.info.yDistToEdge = Mario->bPhysics.info.yDistToEdge * 4.0; -// // -// // Mario->cPhysics.info.xDistToCenter = Mario->cPhysics.info.xDistToCenter * 4.0; -// // Mario->cPhysics.info.xDistToEdge = Mario->cPhysics.info.xDistToEdge * 4.0; -// // Mario->cPhysics.info.yDistToCenter = Mario->cPhysics.info.yDistToCenter * 4.0; -// // Mario->cPhysics.info.yDistToEdge = Mario->cPhysics.info.yDistToEdge * 4.0; -// // -// // Mario->dPhysics.info.xDistToCenter = Mario->dPhysics.info.xDistToCenter * 4.0; -// // Mario->dPhysics.info.xDistToEdge = Mario->dPhysics.info.xDistToEdge * 4.0; -// // Mario->dPhysics.info.yDistToCenter = Mario->dPhysics.info.yDistToCenter * 4.0; -// // Mario->dPhysics.info.yDistToEdge = Mario->dPhysics.info.yDistToEdge * 4.0; -// // -// // Mario->ePhysics.info.xDistToCenter = Mario->ePhysics.info.xDistToCenter * 4.0; -// // Mario->ePhysics.info.xDistToEdge = Mario->ePhysics.info.xDistToEdge * 4.0; -// // Mario->ePhysics.info.yDistToCenter = Mario->ePhysics.info.yDistToCenter * 4.0; -// // Mario->ePhysics.info.yDistToEdge = Mario->ePhysics.info.yDistToEdge * 4.0; -// } -// } - - -// else //Half-Pint -// { -// MarioSize = 0.25; - -// for(int n=0; n<4; n++) { -// Mario = GetSpecificPlayerActor(n); -// if(Mario == 0) -// continue; -// Mario->aPhysics.info.xDistToCenter = Mario->aPhysics.info.xDistToCenter * 0.25; -// Mario->aPhysics.info.xDistToEdge = Mario->aPhysics.info.xDistToEdge * 0.25; -// Mario->aPhysics.info.yDistToCenter = Mario->aPhysics.info.yDistToCenter * 0.25; -// Mario->aPhysics.info.yDistToEdge = Mario->aPhysics.info.yDistToEdge * 0.25; - -// Mario->bPhysics.info.xDistToCenter = Mario->bPhysics.info.xDistToCenter * 0.25; -// Mario->bPhysics.info.xDistToEdge = Mario->bPhysics.info.xDistToEdge * 0.25; -// Mario->bPhysics.info.yDistToCenter = Mario->bPhysics.info.yDistToCenter * 0.25; -// Mario->bPhysics.info.yDistToEdge = Mario->bPhysics.info.yDistToEdge * 0.25; - -// Mario->cPhysics.info.xDistToCenter = Mario->cPhysics.info.xDistToCenter * 0.25; -// Mario->cPhysics.info.xDistToEdge = Mario->cPhysics.info.xDistToEdge * 0.25; -// Mario->cPhysics.info.yDistToCenter = Mario->cPhysics.info.yDistToCenter * 0.25; -// Mario->cPhysics.info.yDistToEdge = Mario->cPhysics.info.yDistToEdge * 0.25; - -// Mario->dPhysics.info.xDistToCenter = Mario->dPhysics.info.xDistToCenter * 0.25; -// Mario->dPhysics.info.xDistToEdge = Mario->dPhysics.info.xDistToEdge * 0.25; -// Mario->dPhysics.info.yDistToCenter = Mario->dPhysics.info.yDistToCenter * 0.25; -// Mario->dPhysics.info.yDistToEdge = Mario->dPhysics.info.yDistToEdge * 0.25; - -// Mario->ePhysics.info.xDistToCenter = Mario->ePhysics.info.xDistToCenter * 0.25; -// Mario->ePhysics.info.xDistToEdge = Mario->ePhysics.info.xDistToEdge * 0.25; -// Mario->ePhysics.info.yDistToCenter = Mario->ePhysics.info.yDistToCenter * 0.25; -// Mario->ePhysics.info.yDistToEdge = Mario->ePhysics.info.yDistToEdge * 0.25; -// } -// } -// break; + case 4: // Set Time + time = (self->setTime << 0xC) - 1; // Possibly - 0xFFF? + break; case 5: // Global Enemy Size @@ -258,7 +194,7 @@ void LevelSpecial_Update(LevelSpecial *self) { // break; case 2: // Stop Timer - TimerBranch = 0x3403FFA4; + self->keepTime = 0; break; @@ -269,78 +205,8 @@ void LevelSpecial_Update(LevelSpecial *self) { MarioJumpMax = 3.628; break; - // case 4: // Mario Size - // dAc_Py_c *Mario; -// if (self->effect == 0) //Super Size -// { -// MarioSize = 4.0; -// -// for(int n=0; n<4; n++) { -// Mario = GetSpecificPlayerActor(n); -// if(Mario == 0) -// continue; -// Mario->aPhysics.info.xDistToCenter = Mario->aPhysics.info.xDistToCenter / 4.0; -// Mario->aPhysics.info.xDistToEdge = Mario->aPhysics.info.xDistToEdge / 4.0; -// Mario->aPhysics.info.yDistToCenter = Mario->aPhysics.info.yDistToCenter / 4.0; -// Mario->aPhysics.info.yDistToEdge = Mario->aPhysics.info.yDistToEdge / 4.0; -// -// Mario->bPhysics.info.xDistToCenter = Mario->bPhysics.info.xDistToCenter / 4.0; -// Mario->bPhysics.info.xDistToEdge = Mario->bPhysics.info.xDistToEdge / 4.0; -// Mario->bPhysics.info.yDistToCenter = Mario->bPhysics.info.yDistToCenter / 4.0; -// Mario->bPhysics.info.yDistToEdge = Mario->bPhysics.info.yDistToEdge / 4.0; -// -// Mario->cPhysics.info.xDistToCenter = Mario->cPhysics.info.xDistToCenter / 4.0; -// Mario->cPhysics.info.xDistToEdge = Mario->cPhysics.info.xDistToEdge / 4.0; -// Mario->cPhysics.info.yDistToCenter = Mario->cPhysics.info.yDistToCenter / 4.0; -// Mario->cPhysics.info.yDistToEdge = Mario->cPhysics.info.yDistToEdge / 4.0; -// -// Mario->dPhysics.info.xDistToCenter = Mario->dPhysics.info.xDistToCenter / 4.0; -// Mario->dPhysics.info.xDistToEdge = Mario->dPhysics.info.xDistToEdge / 4.0; -// Mario->dPhysics.info.yDistToCenter = Mario->dPhysics.info.yDistToCenter / 4.0; -// Mario->dPhysics.info.yDistToEdge = Mario->dPhysics.info.yDistToEdge / 4.0; -// -// Mario->ePhysics.info.xDistToCenter = Mario->ePhysics.info.xDistToCenter / 4.0; -// Mario->ePhysics.info.xDistToEdge = Mario->ePhysics.info.xDistToEdge / 4.0; -// Mario->ePhysics.info.yDistToCenter = Mario->ePhysics.info.yDistToCenter / 4.0; -// Mario->ePhysics.info.yDistToEdge = Mario->ePhysics.info.yDistToEdge / 4.0; -// } -// } -// -// else //Half-Pint -// { -// MarioSize = 0.25; -// -// for(int n=0; n<4; n++) { -// Mario = GetSpecificPlayerActor(n); -// if(Mario == 0) -// continue; -// Mario->aPhysics.info.xDistToCenter = Mario->aPhysics.info.xDistToCenter / 0.25; -// Mario->aPhysics.info.xDistToEdge = Mario->aPhysics.info.xDistToEdge / 0.25; -// Mario->aPhysics.info.yDistToCenter = Mario->aPhysics.info.yDistToCenter / 0.25; -// Mario->aPhysics.info.yDistToEdge = Mario->aPhysics.info.yDistToEdge / 0.25; -// -// Mario->bPhysics.info.xDistToCenter = Mario->bPhysics.info.xDistToCenter / 0.25; -// Mario->bPhysics.info.xDistToEdge = Mario->bPhysics.info.xDistToEdge / 0.25; -// Mario->bPhysics.info.yDistToCenter = Mario->bPhysics.info.yDistToCenter / 0.25; -// Mario->bPhysics.info.yDistToEdge = Mario->bPhysics.info.yDistToEdge / 0.25; -// -// Mario->cPhysics.info.xDistToCenter = Mario->cPhysics.info.xDistToCenter / 0.25; -// Mario->cPhysics.info.xDistToEdge = Mario->cPhysics.info.xDistToEdge / 0.25; -// Mario->cPhysics.info.yDistToCenter = Mario->cPhysics.info.yDistToCenter / 0.25; -// Mario->cPhysics.info.yDistToEdge = Mario->cPhysics.info.yDistToEdge / 0.25; -// -// Mario->dPhysics.info.xDistToCenter = Mario->dPhysics.info.xDistToCenter / 0.25; -// Mario->dPhysics.info.xDistToEdge = Mario->dPhysics.info.xDistToEdge / 0.25; -// Mario->dPhysics.info.yDistToCenter = Mario->dPhysics.info.yDistToCenter / 0.25; -// Mario->dPhysics.info.yDistToEdge = Mario->dPhysics.info.yDistToEdge / 0.25; -// -// Mario->ePhysics.info.xDistToCenter = Mario->ePhysics.info.xDistToCenter / 0.25; -// Mario->ePhysics.info.xDistToEdge = Mario->ePhysics.info.xDistToEdge / 0.25; -// Mario->ePhysics.info.yDistToCenter = Mario->ePhysics.info.yDistToCenter / 0.25; -// Mario->ePhysics.info.yDistToEdge = Mario->ePhysics.info.yDistToEdge / 0.25; -// } -// } - // break; + case 4: // Mario Size + break; case 5: // Global Enemy Size SizerOn = 0; diff --git a/src/meteor.cpp b/src/meteor.cpp index 91e90c0..aa76f5d 100755 --- a/src/meteor.cpp +++ b/src/meteor.cpp @@ -27,6 +27,9 @@ class dMeteor : public dEn_c { void updateModelMatrices(); void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); + + public: + void kill(); }; dMeteor *dMeteor::build() { @@ -47,6 +50,18 @@ void dMeteor::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); } +void MeteorPhysicsCallback(dMeteor *self, dEn_c *other) { + if (other->name == 657) { + OSReport("CANNON COLLISION"); + + SpawnEffect("Wm_en_burst_m", 0, &other->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + PlaySound(other, SE_OBJ_TARU_BREAK); + other->Delete(1); + + self->kill(); + } +} + void dMeteor::collisionCat7_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) { DamagePlayer(this, apThis, apOther); } @@ -97,7 +112,7 @@ int dMeteor::onCreate() { this->aPhysics.addToList(); } - MakeItRound.baseSetup(this, 0, 0, 0, 1, 0); + MakeItRound.baseSetup(this, (void*)&MeteorPhysicsCallback, 0, 0, 1, 0); MakeItRound.x = 0.0; MakeItRound.y = 0.0; @@ -157,4 +172,12 @@ void dMeteor::updateModelMatrices() { bodyModel.calcWorld(false); } +void dMeteor::kill() { + PlaySound(this, SE_OBJ_ROCK_LAND); + SpawnEffect("Wm_ob_cmnboxsmoke", 0, &pos, &rot, &scale); + SpawnEffect("Wm_ob_cmnboxgrain", 0, &pos, &rot, &scale); + + this->Delete(1); +} + diff --git a/src/thundercloud.cpp b/src/thundercloud.cpp index a84340f..4c7e647 100755 --- a/src/thundercloud.cpp +++ b/src/thundercloud.cpp @@ -202,7 +202,7 @@ int dThunderCloud::onCreate() { SetupTextures_Enemy(&bodyModel, 0); bool ret; - nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("thundershoot"); + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("wait_cloud"); ret = this->anm.setup(mdl, anmChr, &this->allocator, 0); allocator.unlink(); @@ -305,7 +305,7 @@ void dThunderCloud::updateModelMatrices() { void dThunderCloud::beginState_Follow() { this->timer = 0; - this->bindAnimChr_and_setUpdateRate("thundershoot", 1, 0.0, 1.0); + this->bindAnimChr_and_setUpdateRate("wait_cloud", 1, 0.0, 1.0); this->rot.x = 0; this->rot.y = 0; this->rot.z = 0; |