diff options
author | Colin Noga <Tempus@chronometry.ca> | 2012-03-21 13:12:22 -0500 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2012-03-21 13:12:22 -0500 |
commit | 0dc4aae6128eb16acef1b6faeabcb546762ebe36 (patch) | |
tree | 6754bbf4c92ffc315d4978b95519492484c62963 /src/bossPlayerClown.cpp | |
parent | 800f3920d31c2562cc2f0af112c9efa5d5343d6e (diff) | |
download | kamek-0dc4aae6128eb16acef1b6faeabcb546762ebe36.tar.gz kamek-0dc4aae6128eb16acef1b6faeabcb546762ebe36.zip |
more fixes
Diffstat (limited to 'src/bossPlayerClown.cpp')
-rw-r--r-- | src/bossPlayerClown.cpp | 65 |
1 files changed, 56 insertions, 9 deletions
diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp index bfd6671..5831748 100644 --- a/src/bossPlayerClown.cpp +++ b/src/bossPlayerClown.cpp @@ -2,47 +2,94 @@ #include <game.h> #include <g3dhax.h> #include <sfx.h> -#include <stage.h> #include "boss.h" #define CLOWN_MODEL(clown) ((m3d::mdl_c*)( ((u32)(clown)) + 0xFD0 )) +#define playerOccupying (((u32)(clown)) + 0x738 ) + +// candidates for player are 0x738. Load the vtable from the actor at 0x738, then fire function 0x6C +// Or just fire 0x6C +// or just check 0x38D extern "C" int PClownCarExecute(dEn_c *clown); extern "C" void PClownCarAfterCreate(dEn_c *clown, u32); extern "C" int PClownCarDraw(dEn_c *clown); extern "C" void PClownCarMove(dEn_c *clown); + int CConDraw(dEn_c *clown) { - // setup matrices - OSReport("Drawing"); - // CLOWN_MODEL(clown)->scheduleForDrawing(); + // setup cannon model + matrix.translation(pos.x, pos.y, pos.z); + newrot = rot.y + 0x4000; + matrix.applyRotationYXZ(&rot.x, &newrot, &rot.z); + + CLOWN_MODEL(clown).setDrawMatrix(matrix); + CLOWN_MODEL(clown).setScale(&scale); + CLOWN_MODEL(clown).calcWorld(false); + + CLOWN_MODEL(clown).scheduleForDrawing(); + return PClownCarDraw(clown); // run normal clown function } int CConExecute(dEn_c *clown) { - OSReport("Executing"); - return PClownCarExecute(clown); - // run normal execute } void CCafterCreate(dEn_c *clown, u32 param) { - OSReport("Creating"); clown->scale.x *= 1.25; clown->scale.y *= 1.25; clown->scale.z *= 1.25; // setup the model + mHeapAllocator_c allocator; + nw4r::g3d::ResFile resFile; + + allocator.link(-1, GameHeaps[0], 0, 0x20); + + this->resFile.data = getResource("koopaJr_clown_ply", "g3d/cannon.brres"); + nw4r::g3d::ResMdl mdl = this->resFile.GetResMdl("Cannon"); + CLOWN_MODEL(clown).setup(mdl, &allocator, 0x224, 1, 0); + SetupTextures_MapObject(&CLOWN_MODEL(clown), 0); + allocator.unlink(); + + // Original AfterCreate PClownCarAfterCreate(clown, param); } void CConExecuteMove(dEn_c *clown) { - OSReport("Moving"); + + u8 player = ((dStageActor_c *)playerOccupying)->which_player; + OSReport("Angle = %x, %x, %x", (GetSpecificPlayerActor(player))->rot.y, (GetSpecificPlayerActor(player))->rot.x, (GetSpecificPlayerActor(player))->rot.z); + OSReport("Clown = %x, %x, %x", (clown)->rot.y, (clown)->rot.x, (clown)->rot.z); + + RemoconMngClass* Remo = GetRemoconMng(); + + Vec tempPos; + + u32 buttonPushed = Remocon_GetPressed(Remo->controllers[player]); + if (buttonPushed & 0x0100) { + + if (clown->direction == 0) { // Going right + tempPos = (Vec){clown->pos.x + 32.0, clown->pos.y + 32.0, 3564.0}; + dStageActor_c *spawned = CreateActor(347, clown->direction, tempPos, 0, 0); + spawned->speed.x = 5.0; + } + else { + tempPos = (Vec){clown->pos.x - 32.0, clown->pos.y + 32.0, 3564.0}; + dStageActor_c *spawned = CreateActor(347, clown->direction, tempPos, 0, 0); + spawned->speed.x = -5.0; + } + + SpawnEffect("Wm_en_killervanish", 0, &tempPos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}); + PlaySoundAsync(clown, SE_OBJ_HOUDAI_S_SHOT); + + } // run normal move PClownCarMove(clown); |