From 3cb4a8c2e6de8a2a3bd0a32a969341339db86d83 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Tue, 20 Mar 2012 22:17:11 -0500 Subject: update with fixes --- bossCaptainBowser.yaml | 66 ++++++++++++++++++++++++------------------------- include/game.h | 3 ++- kamek_pal.x | 4 +++ src/bossPlayerClown.cpp | 27 ++++++++++++++------ src/bossRamboo.cpp | 2 +- src/challengeStar.cpp | 25 +++++++++++-------- src/effectvideo.cpp | 29 ++++++++++++++++++++++ src/fakeStarCoin.cpp | 12 ++++----- src/levelspecial.cpp | 2 ++ src/shyguy.cpp | 6 ++--- src/spritespawner.cpp | 2 +- src/topman.cpp | 2 +- 12 files changed, 117 insertions(+), 63 deletions(-) diff --git a/bossCaptainBowser.yaml b/bossCaptainBowser.yaml index 0583af0..e955cc1 100644 --- a/bossCaptainBowser.yaml +++ b/bossCaptainBowser.yaml @@ -59,40 +59,40 @@ hooks: - name: ClownCarAllocation type: patch addr_pal: 0x8080F918 - data: '38600FD0' # Replace 0x0FD0 which how much space I want to allocate + data: '386017D0' # Replace 0x0FD0 which how much space I want to allocate # Official Funcs - # - name: ClownCarCtor - # type: branch_insn - # branch_type: bl - # src_addr_pal: 0x8080F92C - # target_func: 'newClownCtor(dEn_c *clown)' - - # - name: ClownCarDtor - # type: add_func_pointer - # src_addr_pal: 0x809602A8 - # target_func: 'newClownDtor(dEn_c *clown, u32 willDelete)' - - - # # My overrides - # - name: ClownCarMoveExecute - # type: add_func_pointer - # src_addr_pal: 0x80960184 - # target_func: 'CConExecuteMove(dEn_c *clown)' - - # - name: ClownCarAfterCreate - # type: add_func_pointer - # src_addr_pal: 0x8095FEF8 - # target_func: 'CCafterCreate(dEn_c *clown)' - - # - name: ClownCarOnExecute - # type: add_func_pointer - # src_addr_pal: 0x8095FF08 - # target_func: 'CConExecute(dEn_c *clown)' - - # - name: ClownCarOnDraw - # type: add_func_pointer - # src_addr_pal: 0x8095FF14 - # target_func: 'CConDraw(dEn_c *clown)' + - name: ClownCarCtor + type: branch_insn + branch_type: bl + src_addr_pal: 0x8080F92C + target_func: 'newClownCtor(dEn_c *)' + + - name: ClownCarDtor + type: add_func_pointer + src_addr_pal: 0x809602A8 + target_func: 'newClownDtor(dEn_c *, unsigned int)' + + + # My overrides + - name: ClownCarMoveExecute + type: add_func_pointer + src_addr_pal: 0x80960184 + target_func: 'CConExecuteMove(dEn_c *)' + + - name: ClownCarAfterCreate + type: add_func_pointer + src_addr_pal: 0x8095FEF8 + target_func: 'CCafterCreate(dEn_c *)' + + - name: ClownCarOnExecute + type: add_func_pointer + src_addr_pal: 0x8095FF08 + target_func: 'CConExecute(dEn_c *)' + + - name: ClownCarOnDraw + type: add_func_pointer + src_addr_pal: 0x8095FF14 + target_func: 'CConDraw(dEn_c *)' diff --git a/include/game.h b/include/game.h index 60cebcc..14d61ad 100755 --- a/include/game.h +++ b/include/game.h @@ -1759,7 +1759,8 @@ public: u8 stageActorType; u8 which_player; // _38D u8 enableFlag, currentLayerID; - u8 _390, _391, _392, _padding; + u8 deleteForever; + u8 _391, _392, _padding; dStageActor_c(); diff --git a/kamek_pal.x b/kamek_pal.x index 18b4a8b..c7128f8 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -11,6 +11,10 @@ SECTIONS { __ct__20daJrClownForPlayer_cFv = 0x8080F910; __dt__20daJrClownForPlayer_cFv = 0x80810500; /* Or 0x80810540 maybe, beans if I know */ + PClownCarExecute = 0x800A3600; + PClownCarAfterCreate = 0x80810BC0; + PClownCarDraw = 0x80810B90; + PClownCarMove = 0x80810B90; /* Back to other shit I didn't want to scroll for */ diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp index afa8c3e..e828336 100644 --- a/src/bossPlayerClown.cpp +++ b/src/bossPlayerClown.cpp @@ -8,32 +8,44 @@ #define CLOWN_MODEL(clown) ((m3d::mdl_c*)( ((u32)(clown)) + 0xFD0 )) -dEn_c *newClownCtor(dEn_c *clown); -void newClownDtor(dEn_c *clown, u32 willDelete); +extern "C" void *PClownCarExecute(dEn_c *clown); +extern "C" void *PClownCarAfterCreate(dEn_c *clown, u32); +extern "C" void *PClownCarDraw(dEn_c *clown); +extern "C" void *PClownCarMove(dEn_c *clown); void CConDraw(dEn_c *clown) { // setup matrices - CLOWN_MODEL(clown)->scheduleForDrawing(); + OSReport("Drawing"); + // CLOWN_MODEL(clown)->scheduleForDrawing(); + PClownCarDraw(clown); // run normal clown function } void CConExecute(dEn_c *clown) { + OSReport("Executing"); + + PClownCarExecute(clown); // run normal execute } void CCafterCreate(dEn_c *clown) { - clown->scale.x = clown->scale.x * 1.25; - clown->scale.y = clown->scale.y * 1.25; - clown->scale.z = clown->scale.z * 1.25; + OSReport("Creating"); + + clown->scale.x *= 1.25; + clown->scale.y *= 1.25; + clown->scale.z *= 1.25; // setup the model - // dEn_c::afterCreate(1); + PClownCarAfterCreate(clown, 1); } void CConExecuteMove(dEn_c *clown) { + OSReport("Moving"); + // run normal move + PClownCarMove(clown); // check for wiimote button presses @@ -45,6 +57,7 @@ extern "C" m3d::mdl_c *__ct__Q23m3d5mdl_cFv(m3d::mdl_c *mdl); extern "C" dEn_c *__ct__20daJrClownForPlayer_cFv(dEn_c *clown); dEn_c *newClownCtor(dEn_c *clown) { + OSReport("ctor"); __ct__20daJrClownForPlayer_cFv(clown); __ct__Q23m3d5mdl_cFv(CLOWN_MODEL(clown)); return clown; diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index 0c36f04..c12b709 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -92,7 +92,7 @@ void daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysic doStateChange(&StateID_Flee); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) - apOther->owner->Delete(apOther->owner->_390); + apOther->owner->Delete(1); } } void daRamboo_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { } diff --git a/src/challengeStar.cpp b/src/challengeStar.cpp index fc710d4..97c4364 100644 --- a/src/challengeStar.cpp +++ b/src/challengeStar.cpp @@ -5,6 +5,8 @@ extern "C" void *PlaySound(dEn_c *, int soundID); +extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID); + extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*); extern int GlobalStarsCollected; @@ -39,16 +41,18 @@ class dChallengeStar : public dEn_c { void dChallengeStar::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { - PlaySound(this, SE_OBJ_BROOM_KEY_SHOW); + PlaySoundAsync(this, SE_OBJ_BROOM_KEY_SHOW); SpawnEffect("Wm_ob_greencoinkira_a", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8}); GlobalStarsCollected++; if (GlobalStarsCollected == 50) { GlobalStarsCollected = 0; - EventTable->events = EventTable->events | this->eventFlag; + EventTable->events |= this->eventFlag; + OSReport("50 collected, triggered Event!\n"); } - this->Delete(this->_390); + OSReport("%d Stars Collected\n", GlobalStarsCollected); + this->Delete(1); } void dChallengeStar::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); } @@ -63,7 +67,6 @@ dChallengeStar *dChallengeStar::build() { int dChallengeStar::onCreate() { - OSReport("Creating a star collectable\n"); allocator.link(-1, GameHeaps[0], 0, 0x20); nw4r::g3d::ResFile rf(getResource("I_star", "g3d/I_star.brres")); @@ -74,9 +77,9 @@ int dChallengeStar::onCreate() { ActivePhysics::Info HitMeBaby; HitMeBaby.xDistToCenter = 0.0; - HitMeBaby.yDistToCenter = -3.0; - HitMeBaby.xDistToEdge = 4.0; - HitMeBaby.yDistToEdge = 4.0; + HitMeBaby.yDistToCenter = -4.0; + HitMeBaby.xDistToEdge = 6.0; + HitMeBaby.yDistToEdge = 6.0; HitMeBaby.category1 = 0x5; HitMeBaby.category2 = 0x0; HitMeBaby.bitfield1 = 0x4F; @@ -90,10 +93,12 @@ int dChallengeStar::onCreate() { char eventNum = (this->settings >> 24) & 0xFF; this->eventFlag = (u64)1 << (eventNum - 1); - this->scale.x = 0.5; - this->scale.y = 0.5; - this->scale.z = 0.5; + this->scale.x = 0.70; + this->scale.y = 0.70; + this->scale.z = 0.70; + this->pos.x = 8.0; + this->pos.y -= 14.0; this->pos.z = 3300.0; this->onExecute(); diff --git a/src/effectvideo.cpp b/src/effectvideo.cpp index 98e2dcd..f8561ea 100644 --- a/src/effectvideo.cpp +++ b/src/effectvideo.cpp @@ -93,6 +93,35 @@ int EffectVideo::onExecute() { SpawnEffect("Wm_en_kuribobigsplit", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); break; + + case 514: + SpawnEffect("Wm_ob_fireworks_y", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); + break; + + case 517: + SpawnEffect("Wm_ob_fireworks_b", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); + break; + + case 520: + SpawnEffect("Wm_ob_fireworks_g", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); + break; + + case 523: + SpawnEffect("Wm_ob_fireworks_p", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); + break; + + case 526: + SpawnEffect("Wm_ob_fireworks_k", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); + break; + + case 533: + SpawnEffect("Wm_ob_fireworks_1up", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); + break; + + case 540: + SpawnEffect("Wm_ob_fireworks_star", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){this->scale, this->scale, this->scale}); + break; + default: break; } diff --git a/src/fakeStarCoin.cpp b/src/fakeStarCoin.cpp index 9dcbad3..b69e039 100644 --- a/src/fakeStarCoin.cpp +++ b/src/fakeStarCoin.cpp @@ -44,7 +44,7 @@ void daFakeStarCoin::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth SpawnEffect("Wm_en_obakedoor", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) - this->Delete(this->_390); + this->Delete(1); } void daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { @@ -54,7 +54,7 @@ void daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, A PlaySound(this, SE_OBJ_EMY_FIRE_DISAPP); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) - this->Delete(this->_390); + this->Delete(1); } bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_ob_cmnicekira", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}); @@ -64,7 +64,7 @@ bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, Ac PlaySound(this, SE_OBJ_PNGN_ICE_BREAK); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) - this->Delete(this->_390); + this->Delete(1); return false; } void daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { @@ -74,7 +74,7 @@ void daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePh PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) - this->Delete(this->_390); + this->Delete(1); } void daFakeStarCoin::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_ob_cmnboxgrain", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); @@ -83,7 +83,7 @@ void daFakeStarCoin::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) - this->Delete(this->_390); + this->Delete(1); } void daFakeStarCoin::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { SpawnEffect("Wm_en_explosion", 0, &this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); @@ -92,7 +92,7 @@ void daFakeStarCoin::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysi PlaySound(this, SE_OBJ_EMY_FIRE_DISAPP); //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) - this->Delete(this->_390); + this->Delete(1); } diff --git a/src/levelspecial.cpp b/src/levelspecial.cpp index f57e14a..dc503e0 100644 --- a/src/levelspecial.cpp +++ b/src/levelspecial.cpp @@ -42,6 +42,7 @@ extern float GlobalSpriteSpeed; extern float GlobalRiderSize; extern char SizerOn; extern char ZOrderOn; +extern int GlobalStarsCollected; 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 }; @@ -75,6 +76,7 @@ bool ResetAfterLevel(void) { AlwaysDrawFlag = 0x9421FFF0; AlwaysDrawBranch = 0x7C0802A6; ZOrderOn = 0; + GlobalStarsCollected = 0; return true; } diff --git a/src/shyguy.cpp b/src/shyguy.cpp index acee2f6..5679e49 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -1121,7 +1121,7 @@ void daShyGuy::updateModelMatrices() { // if (this->spikeA != 0) { // PlaySound(spikeA, SE_OBJ_ROCK_S_CRASH); // CreateEffect(&(Vec){this->spikeA->pos.x, this->spikeA->pos.y, 5500.0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 9); - // this->spikeA->Delete(this->spikeA->_390); + // this->spikeA->Delete(this->spikeA->deleteForever); // } // this->spikeA = spawned; // spikeTurn = 1; @@ -1130,7 +1130,7 @@ void daShyGuy::updateModelMatrices() { // if (this->spikeB != 0) { // PlaySound(spikeB, SE_OBJ_ROCK_S_CRASH); // CreateEffect(&(Vec){this->spikeB->pos.x, this->spikeB->pos.y, 5500.0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 9); - // this->spikeB->Delete(this->spikeB->_390); + // this->spikeB->Delete(this->spikeB->deleteForever); // } // this->spikeB = spawned; // spikeTurn = 0; @@ -1434,7 +1434,7 @@ void daShyGuy::updateModelMatrices() { if (this->timer > 450) { this->kill(); - this->Delete(1); + this->Delete(this->deleteForever); } // dEn_c::dieFall_Execute(); diff --git a/src/spritespawner.cpp b/src/spritespawner.cpp index ebfe7a9..56ac383 100755 --- a/src/spritespawner.cpp +++ b/src/spritespawner.cpp @@ -93,7 +93,7 @@ void SpriteSpawner_Update(SpriteSpawner *self) { self->y = spawned->pos.y; self->z = spawned->pos.z; //FIXME changed to add dStageActor_c's Delete(u8) instead of fBase_c's Delete(void) - spawned->Delete(spawned->_390); + spawned->Delete(1); } self->createdActor = 0; } diff --git a/src/topman.cpp b/src/topman.cpp index fccbb0f..42527e2 100644 --- a/src/topman.cpp +++ b/src/topman.cpp @@ -508,7 +508,7 @@ void daTopman::updateModelMatrices() { PlaySound(this, SE_EMY_MECHAKOOPA_DAMAGE); if(this->chrAnimation.isAnimationDone()) { this->kill(); - this->Delete(1); + this->Delete(this->deleteForever); } } void daTopman::endState_Die() { } -- cgit v1.2.3