From c6becbea298ed12b34f8ad6365e1db0a2870e3e7 Mon Sep 17 00:00:00 2001 From: Treeki Date: Thu, 22 Mar 2012 04:33:44 +0100 Subject: hopefully fixes the clown? --- src/bossPlayerClown.cpp | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/bossPlayerClown.cpp b/src/bossPlayerClown.cpp index dbf2ff9..15aa2dd 100644 --- a/src/bossPlayerClown.cpp +++ b/src/bossPlayerClown.cpp @@ -5,9 +5,9 @@ #include "boss.h" -#define CLOWN_MODEL(clown) ((m3d::mdl_c*)( ((u32)(clown)) + 0xFD0 )) -#define playerOccupying (((u32)(clown)) + 0x738 ) -// #define allocator ((mHeapAllocator_c*)(((u32)(clown)) + 0x524 )) +#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); @@ -22,11 +22,11 @@ int CConDraw(dEn_c *clown) { short newrot = 0x4000; clown->matrix.applyRotationYXZ(&clown->rot.x, &newrot, &clown->rot.z); - // CLOWN_MODEL(clown)->setDrawMatrix(clown->matrix); - // CLOWN_MODEL(clown)->setScale(&clown->scale); - // CLOWN_MODEL(clown)->calcWorld(false); + cModel->setDrawMatrix(clown->matrix); + cModel->setScale(&clown->scale); + cModel->calcWorld(false); - // CLOWN_MODEL(clown)->scheduleForDrawing(); + cModel->scheduleForDrawing(); return PClownCarDraw(clown); @@ -46,23 +46,22 @@ void CCafterCreate(dEn_c *clown, u32 param) { OSReport("AfterCreate"); // setup the model nw4r::g3d::ResFile resFile; - mHeapAllocator_c allocator; OSReport("defined"); - allocator.link(-1, GameHeaps[0], 0, 0x20); + 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"); - CLOWN_MODEL(clown)->setup(mdl, &allocator, 0x224, 1, 0); + cModel->setup(mdl, cAllocator, 0x224, 1, 0); OSReport("setup"); - SetupTextures_MapObj(CLOWN_MODEL(clown), 0); + SetupTextures_MapObj(cModel, 0); OSReport("lightmaps"); - allocator.unlink(); + cAllocator->unlink(); OSReport("unlinked"); // Original AfterCreate @@ -71,7 +70,7 @@ void CCafterCreate(dEn_c *clown, u32 param) { void CConExecuteMove(dEn_c *clown) { - u8 player = ((dStageActor_c *)playerOccupying)->which_player; + 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); @@ -108,20 +107,24 @@ void CConExecuteMove(dEn_c *clown) { 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__Q23m3d5mdl_cFv(CLOWN_MODEL(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__20daJrClownForPlayer_cFv(dEn_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(CLOWN_MODEL(clown), 0xFFFFFFFF); + __dt__Q23m3d5mdl_cFv(cModel, 0xFFFFFFFF); + __dt__16mHeapAllocator_cFv(cAllocator, 0xFFFFFFFF); __dt__20daJrClownForPlayer_cFv(clown, willDelete); } -- cgit v1.2.3