diff options
author | Colin Noga <Tempus@Spectrum-Song.local> | 2011-10-14 20:11:18 -0500 |
---|---|---|
committer | Colin Noga <Tempus@Spectrum-Song.local> | 2011-10-14 20:11:18 -0500 |
commit | ebff7224dd633bc96b4da979caa20c0bf95b42d5 (patch) | |
tree | 63621cb4d3c8bb4571736378cabf95730a58ce86 | |
parent | 51861f825f6c0efd7814309417d038dbb5bc3bba (diff) | |
download | kamek-ebff7224dd633bc96b4da979caa20c0bf95b42d5.tar.gz kamek-ebff7224dd633bc96b4da979caa20c0bf95b42d5.zip |
added fake star coin to slot 49
-rw-r--r-- | NewerProject.yaml | 1 | ||||
-rw-r--r-- | fakeStarCoin.yaml | 10 | ||||
-rw-r--r-- | src/bossRamboo.cpp | 2 | ||||
-rw-r--r-- | src/fakeStarCoin.cpp | 113 |
4 files changed, 126 insertions, 0 deletions
diff --git a/NewerProject.yaml b/NewerProject.yaml index fc78745..650ba6e 100644 --- a/NewerProject.yaml +++ b/NewerProject.yaml @@ -35,3 +35,4 @@ modules: - processed/bossThwompaDomp.yaml - processed/bossRamboo.yaml - processed/effectVideo.yaml + - processed/fakeStarCoin.yaml diff --git a/fakeStarCoin.yaml b/fakeStarCoin.yaml new file mode 100644 index 0000000..84a5947 --- /dev/null +++ b/fakeStarCoin.yaml @@ -0,0 +1,10 @@ +--- +# Replaces AC_LIFT_SEESAW + +source_files: [../src/fakeStarCoin.cpp] +hooks: + - name: FakeStarCoinAdd + type: add_func_pointer + src_addr_pal: 0x80969438 + target_func: 'daFakeStarCoin::build(void)' + diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index f61ec33..c1b9244 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -106,6 +106,8 @@ void daRamboo_c::dieBigFall_Execute() { if (this->scale.x > 0.1) { + this->pos.y += 2.0; + PlaySound(this, SE_BOSS_CMN_DAMAGE_LAST); PlaySound(this, SE_EMY_BIG_TERESA_DEAD); diff --git a/src/fakeStarCoin.cpp b/src/fakeStarCoin.cpp new file mode 100644 index 0000000..07d37f7 --- /dev/null +++ b/src/fakeStarCoin.cpp @@ -0,0 +1,113 @@ +#include <common.h> +#include <game.h> +#include <g3dhax.h> +#include "player.h" +#include "effects.h" +#include <sfx.h> + + +extern "C" void *PlaySound(dEn_c *, int soundID); + + +class daFakeStarCoin : public dEn_c { + int onCreate(); + int onExecute(); + int onDelete(); + int onDraw(); + + mHeapAllocator_c allocator; + m3d::mdl_c bodyModel; + + u64 eventFlag; + s32 timer; + u32 delay; + + u32 effect; + u8 type; + + static daFakeStarCoin *build(); + + void updateModelMatrices(); + void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + +}; + + +void daFakeStarCoin::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { + + PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU); + CreateEffect(377, &this->pos); + + this->Delete(); +} + + + +daFakeStarCoin *daFakeStarCoin::build() { + void *buffer = AllocFromGameHeap1(sizeof(daFakeStarCoin)); + return new(buffer) daFakeStarCoin; +} + + +int daFakeStarCoin::onCreate() { + + allocator.link(-1, GameHeaps[0], 0, 0x20); + + nw4r::g3d::ResFile rf(getResource("star_coin", "g3d/star_coin.brres")); + bodyModel.setup(rf.GetResMdl("star_coinA"), &allocator, 0x224, 1, 0); + SetupTextures_Enemy(&bodyModel, 0); + + allocator.unlink(); + + ActivePhysics::Info HitMeBaby; + HitMeBaby.xDistToCenter = 0.0; + HitMeBaby.yDistToCenter = -3.0; + HitMeBaby.xDistToEdge = 12.0; + HitMeBaby.yDistToEdge = 15.0; + HitMeBaby.category1 = 0x5; + HitMeBaby.category2 = 0x0; + HitMeBaby.bitfield1 = 0x4F; + HitMeBaby.bitfield2 = 0x200; + HitMeBaby.unkShort1C = 0; + HitMeBaby.callback = &dEn_c::collisionCallback; + + this->aPhysics.initWithStruct(this, &HitMeBaby); + this->aPhysics.addToList(); + + this->scale.x = 1.0; + this->scale.y = 1.0; + this->scale.z = 1.0; + + this->pos.x -= 120.0; + + this->onExecute(); + return true; +} + + +int daFakeStarCoin::onDelete() { + return true; +} + +int daFakeStarCoin::onDraw() { + bodyModel.scheduleForDrawing(); + return true; +} + + +void daFakeStarCoin::updateModelMatrices() { + matrix.translation(pos.x, pos.y, pos.z); + matrix.applyRotationYXZ(&rot.x, &rot.y, &rot.z); + + bodyModel.setDrawMatrix(matrix); + bodyModel.setScale(&scale); + bodyModel.calcWorld(false); +} + +int daFakeStarCoin::onExecute() { + updateModelMatrices(); + + this->rot.x += 0x200; + return true; +} + |