diff options
Diffstat (limited to '')
-rw-r--r-- | NewerProject.yaml | 1 | ||||
-rw-r--r-- | NewerProjectKP.yaml | 1 | ||||
-rw-r--r-- | bossBridgeBowser.yaml | 5 | ||||
-rw-r--r-- | bossMegaGoomba.yaml | 6 | ||||
-rw-r--r-- | bossSamurshai.yaml | 21 | ||||
-rw-r--r-- | kamek_pal.x | 4 | ||||
-rw-r--r-- | mrsun.yaml | 5 | ||||
-rw-r--r-- | shyguy.yaml | 6 | ||||
-rw-r--r-- | src/bossBridgeBowser.cpp | 8 | ||||
-rw-r--r-- | src/bossMegaGoomba.cpp | 345 | ||||
-rw-r--r-- | src/bossPodouble.cpp | 4 | ||||
-rw-r--r-- | src/bossSamurshai.cpp | 803 | ||||
-rw-r--r-- | src/makeYourOwnModelSprite.cpp | 9 | ||||
-rwxr-xr-x | src/mrsun.cpp | 9 | ||||
-rw-r--r-- | src/music.cpp | 6 | ||||
-rw-r--r-- | src/shyguy.cpp | 36 | ||||
-rw-r--r-- | src/topman.cpp | 7 | ||||
-rw-r--r-- | topman.yaml | 5 |
18 files changed, 1120 insertions, 161 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml index 752b2a8..d8a6374 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -39,6 +39,7 @@ modules: - processed/bossRamboo.yaml - processed/bossBalboaWrench.yaml - processed/bossWrenchThrow.yaml + - processed/bossSamurshai.yaml - processed/bossPodouble.yaml - processed/bossTopman.yaml - processed/bossCaptainBowser.yaml diff --git a/NewerProjectKP.yaml b/NewerProjectKP.yaml index c0b60cb..7509fe7 100644 --- a/NewerProjectKP.yaml +++ b/NewerProjectKP.yaml @@ -38,6 +38,7 @@ modules: - processed/bossRamboo.yaml - processed/bossBalboaWrench.yaml - processed/bossWrenchThrow.yaml + - processed/bossSamurshai.yaml - processed/bossPodouble.yaml - processed/bossTopman.yaml - processed/bossCaptainBowser.yaml diff --git a/bossBridgeBowser.yaml b/bossBridgeBowser.yaml index c7aea6c..d655274 100644 --- a/bossBridgeBowser.yaml +++ b/bossBridgeBowser.yaml @@ -49,6 +49,11 @@ hooks: src_addr_pal: 0x80B7E804 target_func: 'BowserDoomSpriteCollision(dEn_c *, ActivePhysics *, ActivePhysics *)' + - name: RemoveBowserAnimationCheck + type: patch + addr_pal: 0x80B4157C + data: '60000000' + # - name: SetBowserBridgeHP # type: patch # addr_pal: 0x80B3E478 diff --git a/bossMegaGoomba.yaml b/bossMegaGoomba.yaml index 144e5ac..6edc7cd 100644 --- a/bossMegaGoomba.yaml +++ b/bossMegaGoomba.yaml @@ -7,3 +7,9 @@ hooks: type: add_func_pointer src_addr_pal: 0x80952e10 target_func: 'daMegaGoomba_c::build(void)' + + - name: MegaGoombaSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031B1B4 + target_func: 'MGarcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset diff --git a/bossSamurshai.yaml b/bossSamurshai.yaml new file mode 100644 index 0000000..9c8d65d --- /dev/null +++ b/bossSamurshai.yaml @@ -0,0 +1,21 @@ +--- +# Replaces WM_PUKU + +source_files: [../src/bossSamurshai.cpp] +hooks: + - name: SamurshaiBuild + type: add_func_pointer + src_addr_pal: 0x809894B4 + target_func: 'daSamurshai::build(void)' + + - name: SamurshaiSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031AB98 + target_func: 'SSarcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset + + - name: UpdateSamurshaiSpriteInfo + type: patch + addr_pal: 0x8030A638 + data: '0290 0000 00000010 00000010 00000000 00000000 00000040 00000040 0000 0000 0040 0040 0000 0000' + # 0x8030A340 + sprite num * 0x28 == offset diff --git a/kamek_pal.x b/kamek_pal.x index 95f5487..b8d992d 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -13,6 +13,7 @@ SECTIONS { sAllocatorFunc__FrmHeap = 0x8042E5B0; GetActivePlayerCount = 0x8005FFB0; + GetActiveLivingPlayerCount = 0x8005FEF0; getEffectiveScreenLeft__19ClassWithCameraInfoFv = 0x80082240; instance__19ClassWithCameraInfo = 0x8042A0E0; @@ -75,7 +76,6 @@ SECTIONS { modifyPlayerPropertiesWithRollingObject = 0x80057820; EN_LandbarrelPlayerCollision = 0x80A582A0; - GetCountofActivePlayers = 0x8005FFB0; /* Boss Related */ @@ -86,6 +86,8 @@ SECTIONS { ShakeScreen = 0x800D8D50; StageScreen = 0x8042A2E8; + ShakePlayers = 0x80B60180; + StopPlayerShake = 0x80B60220; createChild__13dStageActor_cF6ActorsP13dStageActor_cUiP7Point3dP6S16VecUc = 0x80064680; GameMgrBossEndFunc = 0x8001CDB0; @@ -8,3 +8,8 @@ hooks: src_addr_pal: 0x80B0DFA0 target_func: 'daMrSun_c::build(void)' + - name: MrSunSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031AFB4 + target_func: 'MSarcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset diff --git a/shyguy.yaml b/shyguy.yaml index 427d295..3f4ec44 100644 --- a/shyguy.yaml +++ b/shyguy.yaml @@ -14,3 +14,9 @@ hooks: # [204] ( 16, 48) ( 0, -24 16: 24) 64? 64? 0? 0? | [8:Environment?] # 00CC 0000 00000010 00000030 00000000 FFFFFFE8 00000010 00000018 0040 0040 0000 0000 0008 0000 data: '0000 0000' + + - name: ShyGuySpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031B0C8 + target_func: 'SGarcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset diff --git a/src/bossBridgeBowser.cpp b/src/bossBridgeBowser.cpp index c507e6c..9663882 100644 --- a/src/bossBridgeBowser.cpp +++ b/src/bossBridgeBowser.cpp @@ -15,12 +15,15 @@ extern "C" void *BowserDamageKill(dEn_c *); extern "C" void *BowserDamageEnd(dEn_c *); int HP = 2; +int lastBomb = 0; void BowserDoomSpriteCollision(dEn_c *bowser, ActivePhysics *apThis, ActivePhysics *apOther) { // If you collide with something or other, call the fireball collision if (apOther->owner->name == 674) { + if (lastBomb == apOther->owner->id) { return; } + // void * bowserClass = (void*)(((u32)bowser) + 0x5F8); // int HP = *(int*)(((u32)bowserClass) + 4); @@ -42,7 +45,7 @@ void BowserDoomSpriteCollision(dEn_c *bowser, ActivePhysics *apThis, ActivePhysi BowserDamageEnd(bowser); // daBossKoopaDemo_c *BowserDemo = (daBossKoopaDemo_c*)FindActorByType(BOSS_KOOPA_DEMO, 0); - daBossKoopa_c *BowserDemo = (daBossKoopa_c*)bowser; + daBossKoopa_c *BowserClass = (daBossKoopa_c*)bowser; OSReport("Koopa Controller: %x", BowserClass); BowserClass->doStateChange(&daBossKoopa_c::StateID_Fall); dFlagMgr_c::instance->set(3, 0, true, false, false); @@ -59,6 +62,8 @@ void BowserDoomSpriteCollision(dEn_c *bowser, ActivePhysics *apThis, ActivePhysi HP -= 1; } + lastBomb = apOther->owner->id; + dEn_c * bomb = (dEn_c*)apOther->owner; bomb->kill(); } @@ -71,6 +76,7 @@ void BowserDoomStart(dStageActor_c *Controller) { dEn_c *Bowser = (dEn_c*)FindActorByType(EN_BOSS_KOOPA, 0); Bowser->Delete(1); + lastBomb = 0; } void BowserDoomExecute(dStageActor_c *Controller) { diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index e4bc270..0029f10 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -4,16 +4,33 @@ #include <sfx.h> #include "boss.h" +extern "C" void *ShakeScreen(void *, unsigned int, unsigned int, unsigned int, unsigned int); +extern "C" void *ShakePlayers(dEn_c *); +extern "C" void *StopPlayerShake(dEn_c *); +extern "C" void *StageScreen; + +const char* MGarcNameList [] = { + "kuriboBig", + "kuriboBoss", + NULL +}; + //Enable this if you're fixing it void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { float amtX = scale->x; float amtY = scale->y; + // 0, 20.0, 18.0, 20.0 ActivePhysics::Info info; + // info.xDistToCenter = 0.0; + // info.yDistToCenter = 7.65 * amtY; + // info.xDistToEdge = 8.0 * amtX; + // info.yDistToEdge = 8.7 * amtY; + info.xDistToCenter = 0.0; - info.yDistToCenter = 7.65 * amtY; - info.xDistToEdge = 4.0 * amtX; - info.yDistToEdge = 7.7 * amtY; + info.yDistToCenter = 22.0 * amtY; + info.xDistToEdge = 18.0 * amtX; + info.yDistToEdge = 24.0 * amtY; info.category1 = actor->aPhysics.info.category1; info.category2 = actor->aPhysics.info.category2; @@ -28,7 +45,7 @@ void setNewActivePhysicsRect(dStageActor_c* actor, Vec* scale) { actor->aPhysics.addToList(); } -class daMegaGoomba_c : public daBoss { +class daMegaGoomba_c : public dEn_c { int onCreate(); int onDelete(); int onExecute(); @@ -57,6 +74,9 @@ class daMegaGoomba_c : public daBoss { float JumpDist; float JumpTime; + char isBigBoss; + char isPanic; + bool takeHit(char count); void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate); @@ -70,8 +90,8 @@ class daMegaGoomba_c : public daBoss { void updateModelMatrices(); - bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); - bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + // bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); + // bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther); // bool preYoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); // bool stageActorCollision(ActivePhysics *apThis, ActivePhysics *apOther); @@ -82,13 +102,15 @@ class daMegaGoomba_c : public daBoss { void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther); - void collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther); + // void collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat11_PipeCannon(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + void addScoreWhenHit(void *other); void _vf120(ActivePhysics *apThis, ActivePhysics *apOther); void _vf110(ActivePhysics *apThis, ActivePhysics *apOther); void _vf108(ActivePhysics *apThis, ActivePhysics *apOther); @@ -115,8 +137,6 @@ daMegaGoomba_c *daMegaGoomba_c::build() { } - - //FIXME make this dEn_c->used... extern "C" int SomeStrangeModification(dStageActor_c* actor); extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk); @@ -129,6 +149,7 @@ CREATE_STATE(daMegaGoomba_c, Walk); CREATE_STATE(daMegaGoomba_c, Turn); CREATE_STATE(daMegaGoomba_c, Jump); CREATE_STATE(daMegaGoomba_c, Launch); +CREATE_STATE(daMegaGoomba_c, Outro); //TODO better fix for possible bug with sign (ex. life=120; count=-9;) @@ -140,7 +161,10 @@ bool daMegaGoomba_c::takeHit(char count) { c = 127 - l; } this->life -= c; - this->XSpeed += 0.25; + // this->XSpeed += 0.10; + + // float rate = this->animationChr.getUpdateRate(); + // this->animationChr.setUpdateRate(rate+0.05); this->JumpHeight += 12.0; this->JumpDist += 12.0; this->JumpTime += 5.0; @@ -153,27 +177,19 @@ bool daMegaGoomba_c::takeHit(char count) { #define ACTIVATE 1 #define DEACTIVATE 0 -bool daMegaGoomba_c::preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) { - return false; -} -bool daMegaGoomba_c::prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { - return false; -} - - +extern "C" void *EN_LandbarrelPlayerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther); void daMegaGoomba_c::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) { //HE'S TOO BADASS TO STOP FOR SMALLER GOOMBAS -#if 0 - float me = apThis->firstFloatArray[3]; - if(((this->direction == 1) && (me > 0.0)) || ((this->direction == 0) && (me < 0.0))) { - dStateBase_c* state = this->acState.getCurrentState(); - if(!state->isEqual(&StateID_Turn)) { - doStateChange(&StateID_Turn); + #if 0 + float me = apThis->firstFloatArray[3]; + if(((this->direction == 1) && (me > 0.0)) || ((this->direction == 0) && (me < 0.0))) { + dStateBase_c* state = this->acState.getCurrentState(); + if(!state->isEqual(&StateID_Turn)) { + doStateChange(&StateID_Turn); + } } - } -#endif + #endif } - void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { /* * * * * * * * * * * * * * * * * * * * * @@ -194,6 +210,7 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth //FIXME rename and make part of dStageActor_c //unk=0 does _vfs, unk=1 does playSeCmnStep //char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); + char ret = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2); if(ret == 1) { // regular jump apOther->someFlagByte |= 2; @@ -215,13 +232,28 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth this->flags_4FC |= (1<<(31-7)); this->counter_504[apOther->owner->which_player] = 0; } +void daMegaGoomba_c::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { + OSReport("Ground Pounded"); + apOther->someFlagByte |= 2; + + if(this->takeHit(1)) + doStateChange(&StateID_DieFall); + + // dEn_c *mario = (dEn_c*)apOther->owner; + // mario->speed.y = 6.0; + // EN_LandbarrelPlayerCollision(this, apThis, apOther); + // mario->speed.x += 16.0; + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + this->counter_504[apOther->owner->which_player] = 0; +} void daMegaGoomba_c::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) {} bool daMegaGoomba_c::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return false; } -void daMegaGoomba_c::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther) { } -void daMegaGoomba_c::collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther) { } +void daMegaGoomba_c::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_DieFall); } +// void daMegaGoomba_c::collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther) { } void daMegaGoomba_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { if(this->takeHit(1)) doStateChange(&StateID_DieFall); @@ -237,6 +269,7 @@ void daMegaGoomba_c::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysi if(this->takeHit(1)) doStateChange(&StateID_DieFall); } +void daMegaGoomba_c::addScoreWhenHit(void *other) {} void daMegaGoomba_c::_vf120(ActivePhysics *apThis, ActivePhysics *apOther) { } void daMegaGoomba_c::_vf110(ActivePhysics *apThis, ActivePhysics *apOther) { } void daMegaGoomba_c::_vf108(ActivePhysics *apThis, ActivePhysics *apOther) { } @@ -267,15 +300,15 @@ void daMegaGoomba_c::dieFall_Execute() { void daMegaGoomba_c::setupBodyModel() { allocator.link(-1, GameHeaps[0], 0, 0x20); - this->resFile.data = getResource("kuribo", "g3d/t02.brres"); - nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("kuribo"); + this->resFile.data = getResource("kuriboBoss", "g3d/kuriboBoss.brres"); + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("kuriboBig"); bodyModel.setup(mdl, &allocator, 0x224, 1, 0); SetupTextures_Enemy(&bodyModel, 0); bool ret; nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("walk"); ret = this->animationChr.setup(mdl, anmChr, &this->allocator, 0); - this->bindAnimChr_and_setUpdateRate("walk", 1, 0.0, 1.0); + this->bindAnimChr_and_setUpdateRate("walk", 1, 0.0, 0.2); nw4r::g3d::ResAnmTexPat anmPat = this->resFile.GetResAnmTexPat("walk"); this->resTexPat = anmPat; @@ -328,14 +361,17 @@ int daMegaGoomba_c::onCreate() { this->rot.y = (this->direction) ? 0xE000 : 0x2000; this->_518 = 2; + isBigBoss = this->settings & 0xF; + this->animationChr.setCurrentFrame(69.0); + ActivePhysics::Info hm; hm.xDistToCenter = 0.0; hm.yDistToCenter = 8.0; - hm.xDistToEdge = 8.0; - hm.yDistToEdge = 8.0; + hm.xDistToEdge = 12.0; + hm.yDistToEdge = 12.0; hm.category1 = 0x3; hm.category2 = 0x0; - hm.bitfield1 = 0x6f; + hm.bitfield1 = 0x4f; hm.bitfield2 = 0xffbafffe; hm.unkShort1C = 0; hm.callback = &dEn_c::collisionCallback; @@ -354,14 +390,21 @@ int daMegaGoomba_c::onCreate() { life = 3; already_hit = false; this->x_speed_inc = 0.1; + this->pos.y -= 16.0; // 2.0 is good final speed - this->XSpeed = 1.5; + this->XSpeed = 0.2; this->JumpHeight = 48.0; this->JumpDist = 64.0; this->JumpTime = 50.0; - doStateChange(&StateID_Grow); + // doStateChange(&StateID_Grow); + + scale.x = 5.0; + scale.y = 5.0; + scale.z = 5.0; + setNewActivePhysicsRect(this, &this->scale); + doStateChange(&StateID_Walk); this->onExecute(); return true; @@ -410,65 +453,66 @@ void daMegaGoomba_c::updateModelMatrices() { /////////////// // Grow State /////////////// - void daMegaGoomba_c::beginState_Grow() { - this->timer = 0; + // void daMegaGoomba_c::beginState_Grow() { + // this->timer = 0; - SetupKameck(this, Kameck); - } + // SetupKameck(this, Kameck); + // } - void daMegaGoomba_c::executeState_Grow() { - this->timer += 1; + // void daMegaGoomba_c::executeState_Grow() { + // this->timer += 1; - bool ret; - ret = GrowBoss(this, Kameck, 1.0, 7.0, 0, this->timer); - - if (ret) { - PlaySound(this, SE_EMY_KURI_CHANGE_BIG); - doStateChange(&StateID_Walk); - } - } - void daMegaGoomba_c::endState_Grow() { - CleanupKameck(this, Kameck); - } - - -// Grow State -// void daMegaGoomba_c::beginState_Grow() { -// this->timer = 1.0; - -// float start, end, shift1, shift2; -// start = 59.0; -// shift1 = 90.0; -// shift2 = 120.0; -// end = 139.0; -// /* keysX[i] = { frame, value, slope }; */ -// Xkey_count = 7; -// keysX[0] = (HermiteKey){ start, 1.0, 1.0 }; -// keysX[1] = (HermiteKey){ (start+shift1)/2, 2.0, 1.0 }; -// keysX[2] = (HermiteKey){ shift1, 4.0, 1.0 }; -// keysX[3] = (HermiteKey){ (shift1+shift2)/2, 3.0, 1.0 }; -// keysX[3] = (HermiteKey){ shift2, 6.0, 1.0 }; -// keysX[3] = (HermiteKey){ (shift2+end)/2, 5.0, 1.0 }; -// keysX[6] = (HermiteKey){ end, 7.0, 1.0 }; -// } -// void daMegaGoomba_c::executeState_Grow() { - -// this->timer += 1.0; - -// if ((this->timer > 60.0) && (this->timer < 140.0)) { + // bool ret; + // // ret = GrowBoss(this, Kameck, 1.0, 16.0, 0, this->timer); + // ret = GrowBoss(this, Kameck, 1.0, 5.0, 0, this->timer); + + // if (ret) { + // setNewActivePhysicsRect(this, &this->scale); + // PlaySound(this, SE_EMY_KURI_CHANGE_BIG); + // doStateChange(&StateID_Walk); + // } + // } + // void daMegaGoomba_c::endState_Grow() { + // CleanupKameck(this, Kameck); + // } + + // Grow State + // void daMegaGoomba_c::beginState_Grow() { + // this->timer = 1.0; + + // float start, end, shift1, shift2; + // start = 59.0; + // shift1 = 90.0; + // shift2 = 120.0; + // end = 139.0; + // /* keysX[i] = { frame, value, slope }; */ + // Xkey_count = 7; + // keysX[0] = (HermiteKey){ start, 1.0, 1.0 }; + // keysX[1] = (HermiteKey){ (start+shift1)/2, 2.0, 1.0 }; + // keysX[2] = (HermiteKey){ shift1, 4.0, 1.0 }; + // keysX[3] = (HermiteKey){ (shift1+shift2)/2, 3.0, 1.0 }; + // keysX[3] = (HermiteKey){ shift2, 6.0, 1.0 }; + // keysX[3] = (HermiteKey){ (shift2+end)/2, 5.0, 1.0 }; + // keysX[6] = (HermiteKey){ end, 7.0, 1.0 }; + // } + // void daMegaGoomba_c::executeState_Grow() { + + // this->timer += 1.0; + + // if ((this->timer > 60.0) && (this->timer < 140.0)) { -// float modifier = GetHermiteCurveValue(this->timer, this->keysX, Xkey_count); -// this->scale = (Vec){modifier, modifier, modifier}; -// setNewActivePhysicsRect(this, &this->scale); + // float modifier = GetHermiteCurveValue(this->timer, this->keysX, Xkey_count); + // this->scale = (Vec){modifier, modifier, modifier}; + // setNewActivePhysicsRect(this, &this->scale); -// } -// if(this->timer == 60.0) -// PlaySound(this, SE_EMY_KURI_CHANGE_BIG); - -// if (this->timer > 170.0) { doStateChange(&StateID_Walk); } - -// } -// void daMegaGoomba_c::endState_Grow() { } + // } + // if(this->timer == 60.0) + // PlaySound(this, SE_EMY_KURI_CHANGE_BIG); + + // if (this->timer > 170.0) { doStateChange(&StateID_Walk); } + + // } + // void daMegaGoomba_c::endState_Grow() { } @@ -477,10 +521,10 @@ void daMegaGoomba_c::updateModelMatrices() { void daMegaGoomba_c::beginState_Shrink() { this->timer = 1.0; Xkey_count = 4; - keysX[0] = (HermiteKey){ 0.0, this->scale.y, 1.0 }; - keysX[1] = (HermiteKey){ 20.0, this->scale.y - 2.0, 1.0 }; - keysX[2] = (HermiteKey){ 40.0, this->scale.y, 1.0 }; - keysX[3] = (HermiteKey){ 59.0, this->scale.y - 2.0, 1.0 }; + keysX[0] = (HermiteKey){ 0.0, this->scale.y, 0.5 }; + keysX[1] = (HermiteKey){ 10.0, this->scale.y - 0.75, 0.5 }; + keysX[2] = (HermiteKey){ 20.0, this->scale.y - 0.35, 0.5 }; + keysX[3] = (HermiteKey){ 39.0, this->scale.y - 0.75, 0.5 }; // disable being hit Vec tempVec = (Vec){0.0, 0.0, 0.0}; @@ -495,7 +539,7 @@ void daMegaGoomba_c::executeState_Shrink() { if(this->timer == 2.0) PlaySound(this, SE_EMY_KURIBO_L_DAMAGE_02); - if (this->timer > 60.0) { doStateChange(&StateID_Walk); } + if (this->timer > 40.0) { doStateChange(&StateID_Walk); } } void daMegaGoomba_c::endState_Shrink() { // enable being hit @@ -616,10 +660,26 @@ void daMegaGoomba_c::executeState_Turn() { this->pos.x = this->last_pos.x; DoStuffAndMarkDead(this, this->pos, 1.0); u16 amt = (this->direction == 0) ? 0x2000 : 0xE000; - int done = SmoothRotation(&this->rot.y, amt, 0x200); + int done = SmoothRotation(&this->rot.y, amt, 0x80); if(done) { this->doStateChange(&StateID_Walk); } + + int frame = (int)(this->animationChr.getCurrentFrame() * 5.0); + if ((frame == 100) || (frame == 325) || (frame == 550) || (frame == 775)) { + ShakeScreen(StageScreen, 0, 1, 0, 0); + ShakePlayers(this); + PlaySound(this, SE_BOSS_MORTON_GROUND_SHAKE); + } + + if (isBigBoss) { + if ((frame == 250) || (frame == 500) || (frame == 700) || (frame == 900)) + StopPlayerShake(this); + } + else { + if ((frame == 200) || (frame == 425) || (frame == 650) || (frame == 875)) + StopPlayerShake(this); + } } void daMegaGoomba_c::endState_Turn() { this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed; @@ -661,32 +721,30 @@ void daMegaGoomba_c::executeState_Walk() { } DoStuffAndMarkDead(this, this->pos, 1.0); - if(this->animationChr.isAnimationDone()) { - this->animationChr.setCurrentFrame(0.0); - int Choice = GenerateRandomNumber(6); - switch(Choice) { - case 0: - //doStateChange(&StateID_Jump); - this->speed.y = 5.0 + (1.0 * (life - 2)); - break; - case 1: - doStateChange(&StateID_Launch); - break; - default: - int new_dir = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, pos); - if(this->direction != new_dir) - doStateChange(&StateID_Turn); - break; - }; - + int frame = (int)(this->animationChr.getCurrentFrame() * 5.0); + if ((frame == 100) || (frame == 325) || (frame == 550) || (frame == 775)) { + ShakeScreen(StageScreen, 0, 1, 0, 0); + ShakePlayers(this); + PlaySound(this, SE_BOSS_MORTON_GROUND_SHAKE); } -#if 0 - //if(CollidedWithTile(this->classAt1EC)) { - if( this->collMgr.CollidedWithTile() { + + if (isBigBoss) { + if ((frame == 250) || (frame == 500) || (frame == 700) || (frame == 900)) + StopPlayerShake(this); } -#endif + else { + if ((frame == 200) || (frame == 425) || (frame == 650) || (frame == 875)) + StopPlayerShake(this); + } + + if(this->animationChr.isAnimationDone()) { + this->animationChr.setCurrentFrame(0.0); + int new_dir = dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(this, pos); + if(this->direction != new_dir) + doStateChange(&StateID_Turn); + } } void daMegaGoomba_c::endState_Walk() { } @@ -694,35 +752,36 @@ void daMegaGoomba_c::endState_Walk() { } - - /////////////// // Outro State /////////////// - void daMegaGoomba_c::beginState_Outro() { - OutroSetup(this); - } - void daMegaGoomba_c::executeState_Outro() { + // void daMegaGoomba_c::beginState_Outro() { - if (this->dying == 1) { - if (this->timer > 180) { ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); } - if (this->timer == 60) { PlayerVictoryCries(this); } - - this->timer += 1; - return; - } + // OutroSetup(this); + // this->aPhysics.removeFromList(); + // } + // void daMegaGoomba_c::executeState_Outro() { - bool ret; - ret = ShrinkBoss(this, &this->pos, 0.5, this->timer); + // if (this->dying == 1) { - if (ret == true) { - BossExplode(this, &this->pos); - this->dying = 1; - this->timer = 0; - } - else { PlaySound(this, SE_EMY_BIG_KURIBO_DOWN); } + // if (this->timer > 180) { ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); } + // if (this->timer == 60) { PlayerVictoryCries(this); } + + // this->timer += 1; + // return; + // } + + // bool ret; + // ret = ShrinkBoss(this, &this->pos, 1.0, this->timer); + + // if (ret == true) { + // BossExplode(this, &this->pos); + // this->dying = 1; + // this->timer = 0; + // } + // else { PlaySound(this, SE_EMY_BIG_KURIBO_DOWN); } - this->timer += 1; - } - void daMegaGoomba_c::endState_Outro() { } + // this->timer += 1; + // } + // void daMegaGoomba_c::endState_Outro() { } diff --git a/src/bossPodouble.cpp b/src/bossPodouble.cpp index 5d41a5c..961d760 100644 --- a/src/bossPodouble.cpp +++ b/src/bossPodouble.cpp @@ -82,7 +82,7 @@ daPodouble *daPodouble::build() { // Externs and States /////////////////////// extern "C" int SmoothRotation(short* rot, u16 amt, int unk2); - extern "C" int GetCountofActivePlayers(); + extern "C" int GetActivePlayerCount(); CREATE_STATE(daPodouble, Bounce); CREATE_STATE(daPodouble, Spit); @@ -364,7 +364,7 @@ int daPodouble::onDraw() { if (this->timer == 382) { - int players = GetCountofActivePlayers(); + int players = GetActivePlayerCount(); Vec tempPos = (Vec){this->pos.x - 190.0, this->pos.y + 120.0, 3564.0}; dStageActor_c *spawner = create(AC_YOSHI_EGG, 0x71010000, &tempPos, &(S16Vec){0,0,0}, 0); diff --git a/src/bossSamurshai.cpp b/src/bossSamurshai.cpp new file mode 100644 index 0000000..fb906c2 --- /dev/null +++ b/src/bossSamurshai.cpp @@ -0,0 +1,803 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> +#include "boss.h" + +const char* SSarcNameList [] = { + "Shynja", + NULL +}; + +void ChucklesAndKnuckles(ActivePhysics *apThis, ActivePhysics *apOther); + +class daSamurshai : public daBoss { + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + mHeapAllocator_c allocator; + nw4r::g3d::ResFile resFile; + m3d::mdl_c bodyModel; + m3d::anmChr_c chrAnimation; + + mEf::es2 effect; + + int isBigBoss; + int timer; + int jumpCounter; + char damage; + char isDown; + Vec initialPos; + float XSpeed; + u32 cmgr_returnValue; + dStageActor_c *chosenOne; + bool topHurts; + bool slowDown; + bool isBouncing; + + ActivePhysics Chuckles; + ActivePhysics Knuckles; + + static daSamurshai *build(); + + void bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate); + void updateModelMatrices(); + bool calculateTileCollisions(); + + // void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); + + void collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); + bool collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + + void _vf148(); + void _vf14C(); + int randomPlayer(); + + USING_STATES(daSamurshai); + + DECLARE_STATE(Intro); + DECLARE_STATE(Walk); + DECLARE_STATE(Turn); + DECLARE_STATE(Chop); + DECLARE_STATE(ChargeSlash); + DECLARE_STATE(Uppercut); + DECLARE_STATE(SpinAttack); + DECLARE_STATE(Damage); + DECLARE_STATE(Outro); +}; + +daSamurshai *daSamurshai::build() { + void *buffer = AllocFromGameHeap1(sizeof(daSamurshai)); + return new(buffer) daSamurshai; +} + +/////////////////////// +// Externs and States +/////////////////////// + extern "C" int SmoothRotation(short* rot, u16 amt, int unk2); + + CREATE_STATE(daSamurshai, Intro); + CREATE_STATE(daSamurshai, Walk); + CREATE_STATE(daSamurshai, Turn); + CREATE_STATE(daSamurshai, Chop); + CREATE_STATE(daSamurshai, ChargeSlash); + CREATE_STATE(daSamurshai, Uppercut); + CREATE_STATE(daSamurshai, SpinAttack); + CREATE_STATE(daSamurshai, Damage); + CREATE_STATE(daSamurshai, Outro); + + +//////////////////////// +// Collision Functions +//////////////////////// + + void ChucklesAndKnuckles(ActivePhysics *apThis, ActivePhysics *apOther) { + ((dEn_c*)apThis->owner)->_vf220(apOther->owner); + } + + void daSamurshai::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + + char hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2); + + if (topHurts == true) { + this->dEn_c::playerCollision(apThis, apOther); + this->_vf220(apOther->owner); + } + else if ((hitType == 1) || (hitType == 3)) { + apOther->someFlagByte |= 2; + if (this->isDown == 0) { + this->playEnemyDownSound1(); + damage += 4; + if (damage > 15) { doStateChange(&StateID_Outro); } + else { doStateChange(&StateID_Damage); } + } + } + else { + this->dEn_c::playerCollision(apThis, apOther); + this->_vf220(apOther->owner); + } + + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + this->counter_504[apOther->owner->which_player] = 0; + } + + void daSamurshai::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); } + void daSamurshai::collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) { } + void daSamurshai::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { + apOther->someFlagByte |= 2; + + if (topHurts == true) { + this->dEn_c::playerCollision(apThis, apOther); + this->_vf220(apOther->owner); + } + else if (this->isDown == 0) { + damage += 6; + if (damage > 15) { doStateChange(&StateID_Outro); } + else { doStateChange(&StateID_Damage); } + } + + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + this->counter_504[apOther->owner->which_player] = 0; + } + void daSamurshai::collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther) { this->collisionCat7_WMWaggleWater(apThis, apOther); } + void daSamurshai::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { + if (this->isDown == 0) { + damage += 3; + if (damage > 2) { doStateChange(&StateID_Outro); } + else { doStateChange(&StateID_Damage); } + } + } + void daSamurshai::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther){ } + void daSamurshai::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){ + if (this->isDown == 0) { + damage += 3; + if (damage > 15) { doStateChange(&StateID_Outro); } + else { doStateChange(&StateID_Damage); } + } + + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + this->counter_504[apOther->owner->which_player] = 0; + } + void daSamurshai::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther){ + damage += 4; + SpawnEffect("Wm_mr_fireball_hit", 0, &apOther->owner->pos, &apOther->owner->rot, &apOther->owner->scale); + PlaySoundAsync(this, SE_OBJ_FIREBALL_DISAPP); + if (damage > 15) { doStateChange(&StateID_Outro); } + } + void daSamurshai::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { + damage += 1; + SpawnEffect("Wm_mr_fireball_hit", 0, &apOther->owner->pos, &apOther->owner->rot, &apOther->owner->scale); + PlaySoundAsync(this, SE_OBJ_FIREBALL_DISAPP); + if (damage > 15) { doStateChange(&StateID_Outro); } + } + bool daSamurshai::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { return true; } + void daSamurshai::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { + damage += 2; + this->spawnHitEffectAtPosition((Vec2){apOther->owner->pos.x, apOther->owner->pos.y}); + if (damage > 15) { doStateChange(&StateID_Outro); } + } + + bool daSamurshai::calculateTileCollisions() { + // Returns true if sprite should turn, false if not. + + HandleXSpeed(); + HandleYSpeed(); + doSpriteMovement(); + + cmgr_returnValue = collMgr.CollidedWithTile(); + collMgr.execute(); + + if (isBouncing) { + stuffRelatingToCollisions(0.1875f, 1.0f, 0.5f); + if (speed.y != 0.0f) + isBouncing = false; + } + + float xDelta = pos.x - last_pos.x; + if (xDelta >= 0.0f) + direction = 0; + else + direction = 1; + + if (collMgr.CollidedWithTile()) { + // Walking into a tile branch + + if (cmgr_returnValue == 0) + isBouncing = true; + + if (speed.x != 0.0f) { + //playWmEnIronEffect(); + } + + speed.y = 0.0f; + + // u32 blah = collMgr.s_80070760(); + // u8 one = (blah & 0xFF); + // static const float incs[5] = {0.00390625f, 0.0078125f, 0.015625f, 0.0234375f, 0.03125f}; + // x_speed_inc = incs[one]; + max_speed.x = (direction == 1) ? -1.0f : 1.0f; + } else { + x_speed_inc = 0.0f; + } + + // Bouncing checks + if (_34A & 4) { + Vec v = (Vec){0.0f, 1.0f, 0.0f}; + collMgr.parent_speed_ptr = &v; + + if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + speed.y = 0.0f; + + collMgr.parent_speed_ptr = &speed; + + } else { + if (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks)) + speed.y = 0.0f; + } + + collMgr.s_8006FA40(0); + + // Switch Direction + if (collMgr.bitfield_for_checks & (0x15 << direction)) { + if (collMgr.CollidedWithTile()) { + isBouncing = true; + } + return true; + } + return false; + } + +void daSamurshai::bindAnimChr_and_setUpdateRate(const char* name, int unk, float unk2, float rate) { + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr(name); + this->chrAnimation.bind(&this->bodyModel, anmChr, unk); + this->bodyModel.bindAnim(&this->chrAnimation, unk2); + this->chrAnimation.setUpdateRate(rate); +} + +int daSamurshai::onCreate() { + + isBigBoss = settings & 0xF; + + // Model Setup + allocator.link(-1, GameHeaps[0], 0, 0x20); + + this->resFile.data = getResource("Shynja", "g3d/Shynja.brres"); + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("Model"); + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); + + // Animations start here + nw4r::g3d::ResAnmChr anmChr = this->resFile.GetResAnmChr("c18_IDLE_R"); + this->chrAnimation.setup(mdl, anmChr, &this->allocator, 0); + + allocator.unlink(); + + // Character Setup + + scale = (Vec){20.0, 20.0, 20.0}; + + pos.y = pos.y + 40.0; + rot.x = 0; // X is vertical axis + rot.y = 0xD800; // Y is horizontal axis + rot.z = 0; // Z is ... an axis >.> + direction = 1; // Heading left. + + speed.x = 0.0; + speed.y = 0.0; + XSpeed = 2.0; + x_speed_inc = 0.2; + initialPos = pos; + topHurts = false; + + // Physics + ActivePhysics::Info HitMeBaby; + + HitMeBaby.xDistToCenter = 0.0; + HitMeBaby.yDistToCenter = 12.0; + + HitMeBaby.xDistToEdge = 14.0; + HitMeBaby.yDistToEdge = 12.0; + + HitMeBaby.category1 = 0x3; + HitMeBaby.category2 = 0x0; + HitMeBaby.bitfield1 = 0x4F; + HitMeBaby.bitfield2 = 0xffbafffe; + HitMeBaby.unkShort1C = 0; + HitMeBaby.callback = &dEn_c::collisionCallback; + + this->aPhysics.initWithStruct(this, &HitMeBaby); + this->aPhysics.addToList(); + + // Tile collider + + // These fucking rects do something for the tile rect + spriteSomeRectX = 28.0f; + spriteSomeRectY = 32.0f; + _320 = 0.0f; + _324 = 16.0f; + + // These structs tell stupid collider what to collide with - these are from koopa troopa + static const u8 one[16] = {0,0,0,1, 0,0,0xC0,0, 0,0,0x40,0, 0,0,0,0}; + static const u8 two[12] = {0,0,0,0, 0,0,0,0, 0,0,0xC0,0}; + static const u8 three[16] = {0,0,0,1, 0,0,0x60,0, 0,0,0x90,0, 0,0,0x60,0}; + + collMgr.Init(this, one, two, three); + collMgr.execute(); + + cmgr_returnValue = collMgr.CollidedWithTile(); + + if (collMgr.CollidedWithTile()) + isBouncing = false; + else + isBouncing = true; + + // Sword Physics + // Chuckles is left, Knuckles is Right + ActivePhysics::Info iChuckles; + ActivePhysics::Info iKnuckles; + + iChuckles.xDistToCenter = -27.0; + iChuckles.yDistToCenter = 12.0; + iChuckles.xDistToEdge = 27.0; + iChuckles.yDistToEdge = 10.0; + + iKnuckles.xDistToCenter = 27.0; + iKnuckles.yDistToCenter = 12.0; + iKnuckles.xDistToEdge = 27.0; + iKnuckles.yDistToEdge = 10.0; + + iKnuckles.category1 = iChuckles.category1 = 0x3; + iKnuckles.category2 = iChuckles.category2 = 0x0; + iKnuckles.bitfield1 = iChuckles.bitfield1 = 0x4F; + iKnuckles.bitfield2 = iChuckles.bitfield2 = 0x6; + iKnuckles.unkShort1C = iChuckles.unkShort1C = 0x0; + iKnuckles.callback = iChuckles.callback = ChucklesAndKnuckles; + + Chuckles.initWithStruct(this, &iChuckles); + Knuckles.initWithStruct(this, &iKnuckles); + + doStateChange(&StateID_Intro); + + this->onExecute(); + return true; +} + +int daSamurshai::onDelete() { + return true; +} +int daSamurshai::onExecute() { + acState.execute(); + updateModelMatrices(); + + return true; +} +int daSamurshai::onDraw() { + bodyModel.scheduleForDrawing(); + bodyModel._vf1C(); + + return true; +} +void daSamurshai::updateModelMatrices() { + // This won't work with wrap because I'm lazy. + matrix.translation(pos.x, pos.y - 2.0, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); +} + + +/////////////// +// Intro State +/////////////// + void daSamurshai::beginState_Intro() { + this->timer = 0; + + SetupKameck(this, Kameck); + } + + void daSamurshai::executeState_Intro() { + this->timer += 1; + + bool ret; + ret = GrowBoss(this, Kameck, 1.0, 5.0, 0, this->timer); + + if (ret) { + PlaySound(this, SE_EMY_KURI_CHANGE_BIG); + doStateChange(&StateID_Walk); + } + } + void daSamurshai::endState_Intro() { + CleanupKameck(this, Kameck); + } + +/////////////// +// Walk State +/////////////// + int daSamurshai::randomPlayer() { + int players[4]; + int playerCount = 0; + + for (int i = 0; i < 4; i++) { + if (Player_Active[i] != 0 && Player_Lives[Player_ID[i]] > 0) { + players[playerCount] = i; + playerCount++; + } + } + return players[MakeRandomNumber(playerCount)]; + } + + void daSamurshai::beginState_Walk() { + bindAnimChr_and_setUpdateRate("c18_IDLE_R2", 1, 0.0, 2.0); + + chosenOne = GetSpecificPlayerActor(this->randomPlayer()); + + this->max_speed.x = (this->direction) ? -this->XSpeed : this->XSpeed; + this->speed.x = (direction) ? -0.6f : 0.6f; + x_speed_inc = 0.2; + + this->max_speed.y = -4.0; + this->speed.y = -4.0; + this->y_speed_inc = -0.1875; + } + void daSamurshai::executeState_Walk() { + + float xDistance = pos.x - chosenOne->pos.x; + float yDistance = pos.y - chosenOne->pos.y; + + OSReport("Distance: %f, %f", xDistance, yDistance); + if ((xDistance > 64.0) && (direction == 0)) { doStateChange(&StateID_Turn); } + if ((xDistance < -64.0) && (direction == 1)) { doStateChange(&StateID_Turn); } + + if (xDistance < 0.0) { xDistance = -xDistance; } + + // Condition for Chop + if (xDistance < 32.0) { doStateChange(&StateID_Chop); } + + // Condition For Charge Slash + if (isBigBoss) { + if ((xDistance < 96.0) && (xDistance > 64.0)) { + int charge = MakeRandomNumber(100); + if (charge > 90) { doStateChange(&StateID_ChargeSlash); } + } + } + + // Aerial Attacks! + if (yDistance > 24.0) { + + // Condition For Spin Attack + if (xDistance < 32.0) { doStateChange(&StateID_SpinAttack); } + + // Condition for Uppercut + if ((xDistance < 48.0) && (xDistance > 64.0)) { doStateChange(&StateID_Uppercut); } + } + + bool ret = calculateTileCollisions(); + if (ret) { + doStateChange(&StateID_Turn); + } + + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); + } + } + void daSamurshai::endState_Walk() { } + +/////////////// +// Turn State +/////////////// + void daSamurshai::beginState_Turn() { + this->speed.x = (direction) ? -0.5f : 0.5f; + this->direction ^= 1; + x_speed_inc = 0.0; + } + void daSamurshai::executeState_Turn() { + + if(this->chrAnimation.isAnimationDone()) { + this->chrAnimation.setCurrentFrame(0.0); + } + + u16 amt = (this->direction == 0) ? 0x2800 : 0xD800; + int done = SmoothRotation(&this->rot.y, amt, 0x1000); + + if(done) { + this->doStateChange(&StateID_Walk); + } + } + void daSamurshai::endState_Turn() { } + +/////////////// +// Chop State +/////////////// + void daSamurshai::beginState_Chop() { + bindAnimChr_and_setUpdateRate("c18_H_CUT_R", 1, 0.0, 1.0); + } + void daSamurshai::executeState_Chop() { + + PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH); + + if (this->direction == 1) { + SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x - 18.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 0.5, 1.5}); + Chuckles.addToList(); + } + else { + SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x + 18.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 0.5, 1.5}); + Knuckles.addToList(); + } + + + if(this->chrAnimation.isAnimationDone()) { + if (this->direction == 1) { + SpawnEffect("Wm_ob_flagget_light", 0, &(Vec){pos.x - 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + SpawnEffect("Wm_en_hanapetal", 0, &(Vec){pos.x - 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); + Chuckles.removeFromList(); + } + else { + SpawnEffect("Wm_ob_flagget_light", 0, &(Vec){pos.x + 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + SpawnEffect("Wm_en_hanapetal", 0, &(Vec){pos.x + 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); + Knuckles.removeFromList(); + } + + PlaySoundAsync(this, SE_EMY_BIG_PAKKUN_DAMAGE_1); + + doStateChange(&StateID_Walk); + } + } + void daSamurshai::endState_Chop() { } + +/////////////// +// ChargeSlash State +/////////////// + void daSamurshai::beginState_ChargeSlash() { + this->timer = 0; + + this->speed.x = 0.0; + this->max_speed.x = (this->direction) ? -8.0 : 8.0; + } + void daSamurshai::executeState_ChargeSlash() { + + if (this->timer == 0) { bindAnimChr_and_setUpdateRate("c18_OB_IDLE_R", 1, 0.0, 1.0); + if (this->direction == 1) + SpawnEffect("Wm_ob_keyget02_lighit", 0, &(Vec){pos.x + 7.0, pos.y + 14.0, pos.z - 5500.0}, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8}); + else + SpawnEffect("Wm_ob_keyget02_lighit", 0, &(Vec){pos.x - 7.0, pos.y + 14.0, pos.z + 5500.0}, &(S16Vec){0,0,0}, &(Vec){0.8, 0.8, 0.8}); + } + + if (this->timer == 40) { + speed.x = (direction) ? -8.0f : 8.0f; + topHurts = true; + } + + if (this->timer > 41) { + if (slowDown == false) { + float xDistance = pos.x - chosenOne->pos.x; + + if (xDistance < 8.0) { + bindAnimChr_and_setUpdateRate("c18_H_CUT_R", 1, 0.0, 2.0); + SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){2.0, 0.2, 1.5}); + slowDown == true; + } + } + else { + speed.x = speed.x / 1.5; + } + + if (speed.x == 0.0) { + topHurts = false; + timer = 500; + } + else { + effect.spawn("Wm_mr_p_iceslip", 0, &(Vec){pos.x, pos.y, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}); + SpawnEffect("Wm_en_hanapetal", 0, &pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}); + } + } + + if (this->timer == 550) { + doStateChange(&StateID_Walk); + } + + bool ret = calculateTileCollisions(); + if (ret) { + if (slowDown = false) { + bindAnimChr_and_setUpdateRate("c18_H_CUT_R", 1, 0.0, 2.0); + SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){2.0, 0.2, 1.5}); + slowDown == true; + } + speed.x = 0.0; + } + + this->timer += 1; + + } + void daSamurshai::endState_ChargeSlash() { + slowDown = false; + } + +/////////////// +// Uppercut State +/////////////// + void daSamurshai::beginState_Uppercut() { + bindAnimChr_and_setUpdateRate("c18_H_SHOT_R", 1, 0.0, 1.0); + slowDown = false; + } + void daSamurshai::executeState_Uppercut() { + + if ((slowDown) && (this->chrAnimation.isAnimationDone())) { + doStateChange(&StateID_Walk); + } + + if (slowDown) { + return; + } + + if ((int)this->chrAnimation.getCurrentFrame() == 34) { + topHurts = true; + PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH); + + speed.y = 2.0; + y_speed_inc = -0.1875; + + if (this->direction == 1) { + SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x - 18.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){0.5, 1.5, 1.5}); + Chuckles.addToList(); + } + else { + SpawnEffect("Wm_ob_itemget_ring", 0, &(Vec){pos.x + 18.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){0.5, 1.5, 1.5}); + Knuckles.addToList(); + } + } + + if ((this->chrAnimation.isAnimationDone()) && (speed.y != 0)) { + if (topHurts) { + if (this->direction == 1) { + SpawnEffect("Wm_ob_flagget_light", 0, &(Vec){pos.x - 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + SpawnEffect("Wm_en_hanapetal", 0, &(Vec){pos.x - 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); + Chuckles.removeFromList(); + } + else { + SpawnEffect("Wm_ob_flagget_light", 0, &(Vec){pos.x + 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + SpawnEffect("Wm_en_hanapetal", 0, &(Vec){pos.x + 38.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); + Knuckles.removeFromList(); + } + + PlaySoundAsync(this, SE_EMY_BIG_PAKKUN_DAMAGE_1); + topHurts = false; + } + } + + if ((this->chrAnimation.isAnimationDone()) && (speed.y == 0.0)) { + bindAnimChr_and_setUpdateRate("c18_DIVING_STEAL_R", 1, 0.0, 1.0); + slowDown = true; + } + + bool ret = calculateTileCollisions(); + + } + void daSamurshai::endState_Uppercut() { slowDown = false; } + +/////////////// +// SpinAttack State +/////////////// + void daSamurshai::beginState_SpinAttack() { + bindAnimChr_and_setUpdateRate("c18_NORMAL_STEAL_R", 1, 0.0, 1.0); + } + void daSamurshai::executeState_SpinAttack() { + + if((int)this->chrAnimation.getCurrentFrame() == 20) { + topHurts = true; + PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH); + + speed.y = 3.0; + y_speed_inc = -0.1875; + + if (this->direction == 1) { Chuckles.addToList(); } + else { Knuckles.addToList(); } + } + + if (((int)chrAnimation.getCurrentFrame() > 20) && ((int)this->chrAnimation.getCurrentFrame() < 60)) { + scale = (Vec){1.0, 1.0, 1.0}; + if (this->direction == 1) { + effect.spawn("Wm_mr_spinjump", 0, &(Vec){pos.x - 18.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &scale); + } + else { + effect.spawn("Wm_mr_spinjump", 0, &(Vec){pos.x + 18.0, pos.y + 16.0, pos.z}, &(S16Vec){0,0,0}, &scale); + } + } + + if((int)this->chrAnimation.getCurrentFrame() == 65) { + topHurts = false; + PlaySoundAsync(this, SE_EMY_CRASHER_PUNCH); + + if (this->direction == 1) { Chuckles.removeFromList(); } + else { Knuckles.removeFromList(); } + } + + if ((this->chrAnimation.isAnimationDone()) && (speed.y == 0.0)) { doStateChange(&StateID_Walk); } + + bool ret = calculateTileCollisions(); + + } + void daSamurshai::endState_SpinAttack() { + } + +/////////////// +// Damage State +/////////////// + void daSamurshai::beginState_Damage() { + bindAnimChr_and_setUpdateRate("c18_L_DMG_F_1_R", 1, 0.0, 2.0); + + this->max_speed.x = 0; + this->speed.x = 0; + this->x_speed_inc = 0; + + this->max_speed.y = -2.0; + this->speed.y = -2.0; + this->y_speed_inc = -0.1875; + + this->timer = 0; + this->isDown = 1; + } + void daSamurshai::executeState_Damage() { + calculateTileCollisions(); + + // effect.spawn("Wm_en_spindamage", 0, &(Vec){pos.x, pos.y + 24.0, 0}, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + + if (this->chrAnimation.isAnimationDone() && (collMgr.SomethingSemiImportant(collMgr.bitfield_for_checks))) { + if (timer == 0) { bindAnimChr_and_setUpdateRate("c18_L_DMG_F_3_R", 1, 0.0, 2.0); timer = 1; } + else if (timer == 1) { bindAnimChr_and_setUpdateRate("c18_L_DMG_F_4_R", 1, 0.0, 1.0); timer = 2; } + else if (timer == 2) { doStateChange(&StateID_Walk); } + } + } + void daSamurshai::endState_Damage() { + this->isDown = 0; + this->rot.y = (direction) ? 0xD800 : 0x2800; + } + +/////////////// +// Outro State +/////////////// + void daSamurshai::beginState_Outro() { + + OutroSetup(this); + this->aPhysics.removeFromList(); + } + void daSamurshai::executeState_Outro() { + + if (this->dying == 1) { + + if (this->timer > 180) { ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); } + if (this->timer == 60) { PlayerVictoryCries(this); } + + this->timer += 1; + return; + } + + bool ret; + ret = ShrinkBoss(this, &pos, 1.0, this->timer); + + if (ret == true) { + BossExplode(this, &pos); + this->dying = 1; + this->timer = 0; + } + else { PlaySound(this, SE_EMY_BIG_KURIBO_DOWN); } + + this->timer += 1; + } + void daSamurshai::endState_Outro() { } + diff --git a/src/makeYourOwnModelSprite.cpp b/src/makeYourOwnModelSprite.cpp index edf70ce..9c54893 100644 --- a/src/makeYourOwnModelSprite.cpp +++ b/src/makeYourOwnModelSprite.cpp @@ -310,7 +310,16 @@ int dMakeYourOwn::onCreate() { setupAnim("anim23", 1.0); // AnmChr name, animation speed break; // ends the case + + case 24: // If nyb 12 is 0, it'll load this model + + setupModel("arrow", "g3d/bre24.brres", "cloud"); // arc name (no .arc), brres name, model name + SetupTextures_Item(&bodyModel, 0); + this->pos.z = -3300.0; + + setupAnim("anim24", 1.0); // AnmChr name, animation speed + break; // ends the case // COPY the entire case here, and then change the number // //case 2: diff --git a/src/mrsun.cpp b/src/mrsun.cpp index ebc33db..86c5bfb 100755 --- a/src/mrsun.cpp +++ b/src/mrsun.cpp @@ -4,6 +4,11 @@ #include "boss.h" +const char* MSarcNameList [] = { + "mrsun", + NULL +}; + class daMrSun_c : public dEn_c { int onCreate(); int onDelete(); @@ -167,7 +172,7 @@ int daMrSun_c::onCreate() { if ((this->settings & 0xF) == 0) { // It's a sun hasGlow = true; - nw4r::g3d::ResFile rf(getResource("bilikyu", "g3d/sun.brres")); + nw4r::g3d::ResFile rf(getResource("mrsun", "g3d/sun.brres")); bodyModel.setup(rf.GetResMdl("Sun"), &allocator, 0x224, 1, 0); SetupTextures_Map(&bodyModel, 0); @@ -178,7 +183,7 @@ int daMrSun_c::onCreate() { else { // It's a moon hasGlow = false; - nw4r::g3d::ResFile rf(getResource("bilikyu", "g3d/moon.brres")); + nw4r::g3d::ResFile rf(getResource("mrsun", "g3d/moon.brres")); bodyModel.setup(rf.GetResMdl("Moon"), &allocator, 0x224, 1, 0); SetupTextures_Map(&bodyModel, 0); } diff --git a/src/music.cpp b/src/music.cpp index 6e658f7..a47b1bf 100644 --- a/src/music.cpp +++ b/src/music.cpp @@ -57,9 +57,9 @@ const char* SongNameList [] = { "TRAIN", "YOSHIHOUSE", "FACTORYB", - "", - "", - "", + "CAVERN", + "SAND", + "SHYGUY", "MINIGAME", "BONUS_AREA", "CHALLENGE", diff --git a/src/shyguy.cpp b/src/shyguy.cpp index 6ea3567..d93d77a 100644 --- a/src/shyguy.cpp +++ b/src/shyguy.cpp @@ -4,6 +4,12 @@ #include <sfx.h> +const char* SGarcNameList [] = { + "shyguy", + "iron_ball", + NULL +}; + // Shy Guy Settings // // Nybble 5: Shy Guy Types @@ -205,11 +211,26 @@ daShyGuy *daShyGuy::build() { dStateBase_c *stateVar; dStateBase_c *deathState; + char hitType; if (this->type < 6) { // Regular Shy Guys stateVar = &StateID_GoDizzy; deathState = &StateID_Die; } else if (this->type > 8) { // Giants + hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); + if(hitType == 1) { // regular jump + apOther->someFlagByte |= 2; + } + else if(hitType == 3) { // spinning jump or whatever? + apOther->someFlagByte |= 2; + } + else if(hitType == 0) { + this->dEn_c::playerCollision(apThis, apOther); + this->_vf220(apOther->owner); + } + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + this->counter_504[apOther->owner->which_player] = 0; return; } else { // Ballooneers @@ -223,7 +244,6 @@ daShyGuy *daShyGuy::build() { this->counter_504[apOther->owner->which_player] = 0; - char hitType; if (this->isDown == 0) { hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 2); } @@ -439,7 +459,7 @@ int daShyGuy::onCreate() { if (type == 6 || type == 7 || type == 8) { this->renderBalloon = 1; - this->balloonFile.data = getResource("lemmy_ball", "g3d/balloon.brres"); + this->balloonFile.data = getResource("shyguy", "g3d/balloon.brres"); nw4r::g3d::ResMdl mdlB = this->balloonFile.GetResMdl("ballon"); balloonModel.setup(mdlB, &allocator, 0x224, 1, 0); balloonModelB.setup(mdlB, &allocator, 0x224, 1, 0); @@ -515,26 +535,26 @@ int daShyGuy::onCreate() { // Shy Guy Colours if (type == 1 || type == 8 || type == 10) { - this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyBlue.brres"); + this->resFile.data = getResource("shyguy", "g3d/ShyGuyBlue.brres"); } else if (type == 5) { - this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyGreen.brres"); + this->resFile.data = getResource("shyguy", "g3d/ShyGuyGreen.brres"); } else if (type == 3) { - this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyCyan.brres"); + this->resFile.data = getResource("shyguy", "g3d/ShyGuyCyan.brres"); } else if (type == 4) { - this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyPurple.brres"); + this->resFile.data = getResource("shyguy", "g3d/ShyGuyPurple.brres"); } else { - this->resFile.data = getResource("lemmy_ball", "g3d/ShyGuyRed.brres"); + this->resFile.data = getResource("shyguy", "g3d/ShyGuyRed.brres"); } nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("body_h"); bodyModel.setup(mdl, &allocator, 0x224, 1, 0); // Animations start here - this->anmFile.data = getResource("lemmy_ball", "g3d/ShyGuyAnimations.brres"); + this->anmFile.data = getResource("shyguy", "g3d/ShyGuyAnimations.brres"); nw4r::g3d::ResAnmChr anmChr = this->anmFile.GetResAnmChr("c18_IDLE_R"); this->chrAnimation.setup(mdl, anmChr, &this->allocator, 0); diff --git a/src/topman.cpp b/src/topman.cpp index 42527e2..edf75dd 100644 --- a/src/topman.cpp +++ b/src/topman.cpp @@ -3,6 +3,11 @@ #include <g3dhax.h> #include <sfx.h> +const char* TMarcNameList [] = { + "topman", + NULL +}; + class daTopman : public dEn_c { int onCreate(); int onDelete(); @@ -300,7 +305,7 @@ int daTopman::onCreate() { // Model creation allocator.link(-1, GameHeaps[0], 0, 0x20); - this->resFile.data = getResource("ben", "g3d/begoman_spike.brres"); + this->resFile.data = getResource("topman", "g3d/begoman_spike.brres"); nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("begoman"); bodyModel.setup(mdl, &allocator, 0x224, 1, 0); SetupTextures_Map(&bodyModel, 0); diff --git a/topman.yaml b/topman.yaml index 1802ebb..4ead37c 100644 --- a/topman.yaml +++ b/topman.yaml @@ -8,3 +8,8 @@ hooks: src_addr_pal: 0x8097CFC8 target_func: 'daTopman::build(void)' + - name: TopmanSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031AE94 + target_func: 'TMarcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset |