diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-09-13 15:38:47 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-09-13 15:38:47 -0500 |
commit | a16adae746a5d4814a781f583d18dd79d3e7d43b (patch) | |
tree | 1d4a62d19e3a69e1f057fb6769e3f3e123a182ab | |
parent | dba3ee84993ddb4adc909ba005eb88a2a201da82 (diff) | |
download | kamek-a16adae746a5d4814a781f583d18dd79d3e7d43b.tar.gz kamek-a16adae746a5d4814a781f583d18dd79d3e7d43b.zip |
Added in pumpkin goomba and the airship key global event option
-rw-r--r-- | bowserKey.yaml | 19 | ||||
-rw-r--r-- | pumpkinGoomba.yaml | 24 | ||||
-rw-r--r-- | src/bowserKey.cpp | 45 | ||||
-rw-r--r-- | src/pumpkinGoomba.cpp | 268 |
4 files changed, 356 insertions, 0 deletions
diff --git a/bowserKey.yaml b/bowserKey.yaml new file mode 100644 index 0000000..61ea6b6 --- /dev/null +++ b/bowserKey.yaml @@ -0,0 +1,19 @@ +--- +source_files: [../src/bowserKey.cpp] +hooks: + + - name: endKeyLevel + type: branch_insn + branch_type: bl + src_addr_pal: 0x808047EC + target_func: 'endKeyLevel(dStageActor_c *)' + + - name: startEndKeyLevel + type: add_func_pointer + src_addr_pal: 0x8095E25C + target_func: 'startEndKeyLevel(dStageActor_c *)' + + - name: soundsEndKeyLevel + type: add_func_pointer + src_addr_pal: 0x8095E280 + target_func: 'soundsEndKeyLevel(dStageActor_c *)' diff --git a/pumpkinGoomba.yaml b/pumpkinGoomba.yaml new file mode 100644 index 0000000..ae28f56 --- /dev/null +++ b/pumpkinGoomba.yaml @@ -0,0 +1,24 @@ +--- +# Replaces [637] WM_KINOKO_STAR + + +source_files: [../src/pumpkinGoomba.cpp] +hooks: + - name: BuildGoombaPie + type: add_func_pointer + src_addr_pal: 0x80983E3C + target_func: 'dGoombaPie::build(void)' + + - name: UpdateGoombaPieSpriteInfo + type: patch + # 0x8030A340 + sprite num * 0x28 == offset + addr_pal: 0x8030A6B0 + # -ID- ---- -X Offs- -Y Offs- -RectX1- -RectY1- -RectX2- -RectY2- -1C- -1E- -20- -22- Flag ---- + # Orig 01FC 0000 00000008 00000000 00000000 FFFFFFC0 00000010 00000040 0030 0030 0000 0000 0008 0000 + data: '027D 0000 00000008 00000000 00000008 00000000 00000200 00000200 0030 0030 0000 0000 0008 0000' + + - name: GoombaPieSpriteFileInfo + type: add_func_pointer + src_addr_pal: 0x8031ABA4 + target_func: 'GParcNameList' + # 0x8031AB4C + sprite num * 0x4 == offset diff --git a/src/bowserKey.cpp b/src/bowserKey.cpp new file mode 100644 index 0000000..3bfcd8f --- /dev/null +++ b/src/bowserKey.cpp @@ -0,0 +1,45 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> +#include <stage.h> +#include "boss.h" + +int KeyCounter = 0; +extern "C" void *KeyLoopSet(dStageActor_c *); + +void endKeyLevel(dStageActor_c *key) { + OSReport("Key End Level"); + + if (key->settings) { + KeyCounter += 1; + OSReport("Key Counter now at: %d", KeyCounter); + ExitStage(WORLD_MAP, 0, BEAT_LEVEL, MARIO_WIPE); + } +} + +void startEndKeyLevel(dStageActor_c *key) { + key->speed.y = 4.0; + OSReport("Key Set Speed"); + + if (key->settings) { + StopBGMMusic(); + PlaySound(key, STRM_BGM_COURSE_CLEAR_ZORO); + MakeMarioEnterDemoMode(); + } +} + +void soundsEndKeyLevel(dStageActor_c *key) { + OSReport("Key Set Loop"); + KeyLoopSet(key); + + if (key->settings) { + UpdateGameMgr(); + if (GetSpecificPlayerActor(0) != 0) { PlaySound(key, SE_VOC_MA_CLEAR_MULTI); } + if (GetSpecificPlayerActor(1) != 0) { PlaySound(key, SE_VOC_LU_CLEAR_MULTI); } + if (GetSpecificPlayerActor(2) != 0) { PlaySound(key, SE_VOC_KO_CLEAR_MULTI); } + if (GetSpecificPlayerActor(3) != 0) { PlaySound(key, SE_VOC_KO2_CLEAR_MULTI); } + } +} + + diff --git a/src/pumpkinGoomba.cpp b/src/pumpkinGoomba.cpp new file mode 100644 index 0000000..64d98fc --- /dev/null +++ b/src/pumpkinGoomba.cpp @@ -0,0 +1,268 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include <sfx.h> + +const char* GParcNameList [] = { + "kuribo", + "pumpkin", + "wing", + NULL +}; + +class dGoombaPie : public dEn_c { + int onCreate(); + int onDelete(); + int onExecute(); + int onDraw(); + + mHeapAllocator_c allocator; + nw4r::g3d::ResFile resFile; + m3d::mdl_c bodyModel; + m3d::mdl_c burstModel; + + dStageActor_c *Goomber; + u32 timer; + bool isBursting; + + static dGoombaPie *build(); + + void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); + void spriteCollision(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); + void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); + void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + + void _vf148(); + void _vf14C(); + bool CreateIceActors(); + void addScoreWhenHit(void *other); + + USING_STATES(dGoombaPie); + DECLARE_STATE(Follow); + DECLARE_STATE(Burst); +}; + +dGoombaPie *dGoombaPie::build() { + void *buffer = AllocFromGameHeap1(sizeof(dGoombaPie)); + return new(buffer) dGoombaPie; +} + +/////////////////////// +// Externs and States +/////////////////////// + extern "C" void *PlaySound(dStageActor_c *, int soundID); + extern "C" void *PlaySoundAsync(dStageActor_c *, int soundID); + extern "C" void *EN_LandbarrelPlayerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther); + extern "C" int SmoothRotation(short* rot, u16 amt, int unk2); + extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1); + extern "C" bool SpawnEffect(const char*, int, Vec*, S16Vec*, Vec*); + + CREATE_STATE(dGoombaPie, Follow); + CREATE_STATE(dGoombaPie, Burst); + + +//////////////////////// +// Collision Functions +//////////////////////// + + void pieCollisionCallback(ActivePhysics *one, ActivePhysics *two) { + if (two->owner->name == EN_KURIBO) { return; } + if (two->owner->name == EN_KURIBO) { return; } + dEn_c::collisionCallback(one, two); + } + + void dGoombaPie::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + + char hitType; + hitType = usedForDeterminingStatePress_or_playerCollision(this, apThis, apOther, 0); + + if(hitType == 1) { // regular jump + apOther->someFlagByte |= 2; + doStateChange(&StateID_Burst); + } + else if(hitType == 3) { // spinning jump or whatever? + apOther->someFlagByte |= 2; + doStateChange(&StateID_Burst); + } + else if(hitType == 0) { + EN_LandbarrelPlayerCollision(this, apThis, apOther); + if (this->pos.x > apOther->owner->pos.x) { + this->direction = 1; + } + else { + this->direction = 0; + } + doStateChange(&StateID_Burst); + } + + // fix multiple player collisions via megazig + this->isDead = 0; + this->flags_4FC |= (1<<(31-7)); + this->counter_504[apOther->owner->which_player] = 0; + } + + void dGoombaPie::spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther) {} + void dGoombaPie::yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->playerCollision(apThis, apOther); } + void dGoombaPie::collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_Burst); } + void dGoombaPie::collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_Burst); } + void dGoombaPie::collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_Burst); } + void dGoombaPie::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_Burst); } + void dGoombaPie::collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther){ doStateChange(&StateID_Burst); } + void dGoombaPie::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_Burst); } + void dGoombaPie::collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther){ doStateChange(&StateID_Burst); } + void dGoombaPie::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther){ doStateChange(&StateID_DieSmoke); } + void dGoombaPie::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { doStateChange(&StateID_DieSmoke); } + + // These handle the ice crap + void dGoombaPie::_vf148() { + dEn_c::_vf148(); + doStateChange(&StateID_Burst); + } + void dGoombaPie::_vf14C() { + dEn_c::_vf14C(); + doStateChange(&StateID_Burst); + } + + struct DoSomethingCool { + u32 unk_01; //0000 + Vec3 pos; //0004 + Vec3 scale; //0010 + f32 unk_02; //001C + f32 unk_03; //0020 + f32 unk_04; //0024 + f32 unk_05; //0028 + f32 unk_06; //002C + f32 unk_07; //0030 + f32 unk_08; //0034 + f32 unk_09; //0038 + } goombIceBlock; + + extern "C" void sub_80024C20(void); + extern "C" void __destroy_arr(void*, void(*)(void), int, int); + + bool dGoombaPie::CreateIceActors() + { + struct DoSomethingCool goombIceBlock = { 0, this->pos, {2.5, 2.5, 2.5}, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }; + this->frzMgr.Create_ICEACTORs( (void*)&goombIceBlock, 1 ); + __destroy_arr( (void*)&goombIceBlock, sub_80024C20, 0x3C, 1 ); + return true; + } + + void dGoombaPie::addScoreWhenHit(void *other) {} + + +int dGoombaPie::onCreate() { + + // Model creation + allocator.link(-1, GameHeaps[0], 0, 0x20); + + this->resFile.data = getResource("pumpkin", "g3d/model.brres"); + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("Pumpkin"); + bodyModel.setup(mdl, &allocator, 0x224, 1, 0); + SetupTextures_Map(&bodyModel, 0); + + mdl = this->resFile.GetResMdl("FX_Pumpkin"); + burstModel.setup(mdl, &allocator, 0x224, 1, 0); + SetupTextures_Map(&burstModel, 0); + + allocator.unlink(); + + + // Other shit + isBursting = false; + this->scale = (Vec){0.375, 0.375, 0.375}; + + ActivePhysics::Info HitMeBaby; + + HitMeBaby.xDistToCenter = 0.0; + HitMeBaby.yDistToCenter = 12.0; + + HitMeBaby.xDistToEdge = 8.0; + HitMeBaby.yDistToEdge = 14.0; + + HitMeBaby.category1 = 0x3; + HitMeBaby.category2 = 0x0; + HitMeBaby.bitfield1 = 0x01; + HitMeBaby.bitfield2 = 0x80020; + HitMeBaby.unkShort1C = 0; + HitMeBaby.callback = &pieCollisionCallback; + + this->aPhysics.initWithStruct(this, &HitMeBaby); + this->aPhysics.addToList(); + + + // Remember to follow a goomba + if (settings == 0) { + Goomber = (dStageActor_c*)create(EN_KURIBO, 0, &pos, &rot, 0); } + else { + Goomber = (dStageActor_c*)create(EN_PATA_KURIBO, 0, &pos, &rot, 0); } + + // State Changers + doStateChange(&StateID_Follow); + + this->onExecute(); + return true; +} + +int dGoombaPie::onDelete() { + return true; +} + +int dGoombaPie::onExecute() { + acState.execute(); + this->pos = Goomber->pos; + this->rot = Goomber->rot; + return true; +} + +int dGoombaPie::onDraw() { + matrix.translation(pos.x, pos.y + 4.0, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + if (isBursting) { + burstModel.setDrawMatrix(matrix); + burstModel.setScale(&scale); + burstModel.calcWorld(false); + burstModel.scheduleForDrawing(); + } else { + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); + bodyModel.scheduleForDrawing(); + } + + return true; +} + + + +/////////////// +// Follow State +/////////////// + void dGoombaPie::beginState_Follow() { } + void dGoombaPie::executeState_Follow() { } + void dGoombaPie::endState_Follow() { } + +/////////////// +// Burst State +/////////////// + void dGoombaPie::beginState_Burst() { + this->timer = 0; + isBursting = true; + this->removeMyActivePhysics(); + SpawnEffect("Wm_ob_eggbreak_yw", 0, &pos, &(S16Vec){0,0,0}, &(Vec){2.0, 2.0, 2.0}); + } + void dGoombaPie::executeState_Burst() { + this->Delete(1); + } + void dGoombaPie::endState_Burst() { } + |