#include #include #include #include #include "boss.h" #define cPlayerOccupying (*(dStageActor_c**)(((u32)(clown)) + 0x738 )) #define cAllocator ((mHeapAllocator_c*)(((u32)(clown)) + 0xFD0 )) #define cModel ((m3d::mdl_c*)( ((u32)(clown)) + 0xFEC )) 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 cannon model clown->matrix.translation(clown->pos.x, clown->pos.y, clown->pos.z); short newrot = 0x4000; clown->matrix.applyRotationYXZ(&clown->rot.x, &newrot, &clown->rot.z); cModel->setDrawMatrix(clown->matrix); cModel->setScale(&clown->scale); cModel->calcWorld(false); cModel->scheduleForDrawing(); return PClownCarDraw(clown); // run normal clown function } int CConExecute(dEn_c *clown) { return PClownCarExecute(clown); } void CCafterCreate(dEn_c *clown, u32 param) { clown->scale.x *= 1.25; clown->scale.y *= 1.25; clown->scale.z *= 1.25; OSReport("AfterCreate"); // setup the model nw4r::g3d::ResFile resFile; OSReport("defined"); cAllocator->link(-1, GameHeaps[0], 0, 0x20); OSReport("allocated"); resFile.data = getResource("koopaJr_clown_ply", "g3d/cannon.brres"); OSReport("resource"); nw4r::g3d::ResMdl mdl = resFile.GetResMdl("Cannon"); OSReport("model"); cModel->setup(mdl, cAllocator, 0x224, 1, 0); OSReport("setup"); SetupTextures_MapObj(cModel, 0); OSReport("lightmaps"); cAllocator->unlink(); OSReport("unlinked"); // Original AfterCreate PClownCarAfterCreate(clown, param); } void CConExecuteMove(dEn_c *clown) { u8 player = cPlayerOccupying->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){0.25, 0.25, 0.25}); PlaySoundAsync(clown, SE_OBJ_HOUDAI_S_SHOT); } // run normal move PClownCarMove(clown); // check for wiimote button presses // spawn effect and attack if there are any } extern "C" m3d::mdl_c *__ct__Q23m3d5mdl_cFv(m3d::mdl_c *mdl); extern "C" mHeapAllocator_c *__ct__16mHeapAllocator_cFv(mHeapAllocator_c *al); extern "C" dEn_c *__ct__20daJrClownForPlayer_cFv(dEn_c *clown); dEn_c *newClownCtor(dEn_c *clown) { OSReport("ctor"); __ct__20daJrClownForPlayer_cFv(clown); __ct__16mHeapAllocator_cFv(cAllocator); __ct__Q23m3d5mdl_cFv(cModel); return clown; } extern "C" void __dt__Q23m3d5mdl_cFv(m3d::mdl_c *mdl, u32 willDelete); extern "C" void __dt__16mHeapAllocator_cFv(mHeapAllocator_c *al, u32 willDelete); extern "C" void __dt__20daJrClownForPlayer_cFv(dEn_c *clown, u32 willDelete); void newClownDtor(dEn_c *clown, u32 willDelete) { __dt__Q23m3d5mdl_cFv(cModel, 0xFFFFFFFF); __dt__16mHeapAllocator_cFv(cAllocator, 0xFFFFFFFF); __dt__20daJrClownForPlayer_cFv(clown, willDelete); }