From e0ff484a06fd3f068e29eff4a125f61fbfd174c4 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sat, 17 Sep 2011 03:38:41 +0200 Subject: merged level-select updates to game.h and State stuff --- include/game.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ kamek_ntsc.x | 17 +++++++++++++ kamek_ntsc2.x | 17 +++++++++++++ kamek_pal.x | 17 +++++++++++++ kamek_pal2.x | 17 +++++++++++++ src/eventblock.cpp | 23 ++++++----------- 6 files changed, 148 insertions(+), 15 deletions(-) diff --git a/include/game.h b/include/game.h index 554e17a..7382c34 100755 --- a/include/game.h +++ b/include/game.h @@ -1020,6 +1020,25 @@ public: u8 layer; u8 someFlagByte; u8 isLinkedIntoList; + + void clear(); + void addToList(); + void removeFromList(); + + void initWithStruct(dActor_c *owner, Info *info); + void initWithStruct(dActor_c *owner, Info *info, u8 clMode); + + u16 checkResult1(u16 param); + u16 checkResult3(u16 param); + + float top(); + float bottom(); + float yCenter(); + float right(); + float left(); + float xCenter(); + + // Plus more stuff that isn't needed in the public API, I'm pretty sure. }; @@ -1085,6 +1104,23 @@ public: }; +#define DECLARE_STATE(NAME) \ + static State StateID_##NAME; \ + void beginState_##NAME(); \ + void executeState_##NAME(); \ + void endState_##NAME(); + +#define CREATE_STATE(CLASS, NAME) \ + CLASS::State CLASS::StateID_##NAME \ + (#CLASS "::StateID_" #NAME, \ + &CLASS::beginState_##NAME, \ + &CLASS::executeState_##NAME, \ + &CLASS::endState_##NAME); + +#define USING_STATES(CLASS) \ + typedef State State; + + struct LinkListEntry { LinkListEntry *prev; LinkListEntry *next; @@ -1347,6 +1383,29 @@ public: }; +class dAc_Py_c : public dStageActor_c { +public: + u8 data[0x1164 - 0x394]; + ActivePhysics bPhysics; + ActivePhysics cPhysics; + ActivePhysics dPhysics; + ActivePhysics ePhysics; + + dAc_Py_c(); + + int beforeCreate(); + int afterCreate(int); + int beforeDelete(); + int afterDelete(int); + int beforeExecute(); + int afterExecute(int); + int beforeDraw(); + int afterDraw(int); + + ~dAc_Py_c(); +}; + + /* TODO class dActorState_c : public dStageActor_c { public: @@ -1534,6 +1593,9 @@ public: virtual void _vf27C(); // nullsub, params unknown ~dEn_c(); + + + static void collisionCallback(ActivePhysics::Info *one, ActivePhysics::Info *two); }; @@ -2070,5 +2132,15 @@ struct BGRender { u16 tileNumberWithinBlock, areaID; }; +// A HACK +extern void *DVDClass; +extern "C" u8 *GetRes(void *Something, const char *arcname, const char *filename); + +// Use THESE instead, until I write something up for dRes or dRes_c or whatever the fuck it's called + +inline u8 *getResource(const char *arcName, const char *fileName) { + return GetRes((void*)(((u8*)DVDClass)+4), arcName, fileName); +} + #endif diff --git a/kamek_ntsc.x b/kamek_ntsc.x index ab702c3..4a7a35d 100644 --- a/kamek_ntsc.x +++ b/kamek_ntsc.x @@ -19,6 +19,17 @@ SECTIONS { GenerateRandomNumber = 0x800B2EE0; OneofManySoundPlayers = 0x800CE8C0; BombExplodeState = 0x80B12A68; + NoFreezie = 0x800A0B08; + +/* Mr Sun Related */ + + BubbleModel = 0x809D0CA0; + BubbleDraw = 0x809D0830; + ActivePhysics_InitWithStruct = 0x8008C3E0; + ActivePhysics_AddToList = 0x8008C330; + + + _savefpr_14 = 0x802DCCA8; _savefpr_15 = 0x802DCCAC; @@ -165,6 +176,7 @@ SECTIONS { StateID_DownMove_DiffEnd__15daEnBlockMain_c = 0x80352B74; __ct__5dEn_cFv = 0x80094E80; + __dt__5dEn_cFv = 0x80095130; afterCreate__5dEn_cFi = 0x800951D0; afterExecute__5dEn_cFi = 0x80095480; kill__5dEn_cFv = 0x80097F70; @@ -174,6 +186,7 @@ SECTIONS { _vfCC__5dEn_cFP7Point2d = 0x800973F0; _vfD0__5dEn_cFP7Point2d = 0x800974F0; doStateChange__5dEn_cFP9StateBase = 0x800A7DF0; + collisionCallback__5dEn_cFPQ213ActivePhysics4InfoPQ213ActivePhysics4Info = 0x80095950; preSpriteCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095CE0; prePlayerCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095D30; preYoshiCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095F50; @@ -375,6 +388,10 @@ SECTIONS { instance__10dFlagMgr_c = 0x8042A078; + addToList__13ActivePhysicsFv = 0x8008C330; + initWithStruct__13ActivePhysicsFP8dActor_cPQ213ActivePhysics4Info = 0x8008C3E0; + + __ct__7PhysicsFv = 0x8007F7A0; setup__7PhysicsFP8dActor_cPQ27Physics4InfoUcUcP7Point2d = 0x8007FB10; addToList__7PhysicsFv = 0x8007F900; diff --git a/kamek_ntsc2.x b/kamek_ntsc2.x index f803db3..d59089a 100644 --- a/kamek_ntsc2.x +++ b/kamek_ntsc2.x @@ -19,6 +19,17 @@ SECTIONS { GenerateRandomNumber = 0x800B2EE0; OneofManySoundPlayers = 0x800CE8C0; BombExplodeState = 0x80B12A88; + NoFreezie = 0x800A0B08; + +/* Mr Sun Related */ + + BubbleModel = 0x809D0CC0; + BubbleDraw = 0x809D0850; + ActivePhysics_InitWithStruct = 0x8008C3E0; + ActivePhysics_AddToList = 0x8008C330; + + + _savefpr_14 = 0x802DCCA8; _savefpr_15 = 0x802DCCAC; @@ -165,6 +176,7 @@ SECTIONS { StateID_DownMove_DiffEnd__15daEnBlockMain_c = 0x80352B74; __ct__5dEn_cFv = 0x80094E80; + __dt__5dEn_cFv = 0x80095130; afterCreate__5dEn_cFi = 0x800951D0; afterExecute__5dEn_cFi = 0x80095480; kill__5dEn_cFv = 0x80097F70; @@ -174,6 +186,7 @@ SECTIONS { _vfCC__5dEn_cFP7Point2d = 0x800973F0; _vfD0__5dEn_cFP7Point2d = 0x800974F0; doStateChange__5dEn_cFP9StateBase = 0x800A7DF0; + collisionCallback__5dEn_cFPQ213ActivePhysics4InfoPQ213ActivePhysics4Info = 0x80095950; preSpriteCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095CE0; prePlayerCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095D30; preYoshiCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095F50; @@ -375,6 +388,10 @@ SECTIONS { instance__10dFlagMgr_c = 0x8042A078; + addToList__13ActivePhysicsFv = 0x8008C330; + initWithStruct__13ActivePhysicsFP8dActor_cPQ213ActivePhysics4Info = 0x8008C3E0; + + __ct__7PhysicsFv = 0x8007F7A0; setup__7PhysicsFP8dActor_cPQ27Physics4InfoUcUcP7Point2d = 0x8007FB10; addToList__7PhysicsFv = 0x8007F900; diff --git a/kamek_pal.x b/kamek_pal.x index 81be80c..b910118 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -19,6 +19,17 @@ SECTIONS { GenerateRandomNumber = 0x800B2EE0; OneofManySoundPlayers = 0x800CE9B0; BombExplodeState = 0x80B12A48; + NoFreezie = 0x800A0B08; + +/* Mr Sun Related */ + + BubbleModel = 0x809D0C80; + BubbleDraw = 0x809D0810; + ActivePhysics_InitWithStruct = 0x8008C3E0; + ActivePhysics_AddToList = 0x8008C330; + + + _savefpr_14 = 0x802DCF98; _savefpr_15 = 0x802DCF9C; @@ -165,6 +176,7 @@ SECTIONS { StateID_DownMove_DiffEnd__15daEnBlockMain_c = 0x80352E74; __ct__5dEn_cFv = 0x80094E80; + __dt__5dEn_cFv = 0x80095130; afterCreate__5dEn_cFi = 0x800951D0; afterExecute__5dEn_cFi = 0x80095480; kill__5dEn_cFv = 0x80097F70; @@ -174,6 +186,7 @@ SECTIONS { _vfCC__5dEn_cFP7Point2d = 0x800973F0; _vfD0__5dEn_cFP7Point2d = 0x800974F0; doStateChange__5dEn_cFP9StateBase = 0x800A7DF0; + collisionCallback__5dEn_cFPQ213ActivePhysics4InfoPQ213ActivePhysics4Info = 0x80095950; preSpriteCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095CE0; prePlayerCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095D30; preYoshiCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0x80095F50; @@ -375,6 +388,10 @@ SECTIONS { instance__10dFlagMgr_c = 0x8042A358; + addToList__13ActivePhysicsFv = 0x8008C330; + initWithStruct__13ActivePhysicsFP8dActor_cPQ213ActivePhysics4Info = 0x8008C3E0; + + __ct__7PhysicsFv = 0x8007F7A0; setup__7PhysicsFP8dActor_cPQ27Physics4InfoUcUcP7Point2d = 0x8007FB10; addToList__7PhysicsFv = 0x8007F900; diff --git a/kamek_pal2.x b/kamek_pal2.x index f9f8a9a..87ce78f 100644 --- a/kamek_pal2.x +++ b/kamek_pal2.x @@ -19,6 +19,17 @@ SECTIONS { GenerateRandomNumber = 0xDEADBEEF; OneofManySoundPlayers = 0xDEADBEEF; BombExplodeState = 0xDEADBEEF; + NoFreezie = 0xDEADBEEF; + +/* Mr Sun Related */ + + BubbleModel = 0xDEADBEEF; + BubbleDraw = 0xDEADBEEF; + ActivePhysics_InitWithStruct = 0xDEADBEEF; + ActivePhysics_AddToList = 0xDEADBEEF; + + + _savefpr_14 = 0xDEADBEEF; _savefpr_15 = 0xDEADBEEF; @@ -165,6 +176,7 @@ SECTIONS { StateID_DownMove_DiffEnd__15daEnBlockMain_c = 0xDEADBEEF; __ct__5dEn_cFv = 0xDEADBEEF; + __dt__5dEn_cFv = 0xDEADBEEF; afterCreate__5dEn_cFi = 0xDEADBEEF; afterExecute__5dEn_cFi = 0xDEADBEEF; kill__5dEn_cFv = 0xDEADBEEF; @@ -174,6 +186,7 @@ SECTIONS { _vfCC__5dEn_cFP7Point2d = 0xDEADBEEF; _vfD0__5dEn_cFP7Point2d = 0xDEADBEEF; doStateChange__5dEn_cFP9StateBase = 0xDEADBEEF; + collisionCallback__5dEn_cFPQ213ActivePhysics4InfoPQ213ActivePhysics4Info = 0xDEADBEEF; preSpriteCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0xDEADBEEF; prePlayerCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0xDEADBEEF; preYoshiCollision__5dEn_cFP13ActivePhysicsP13ActivePhysics = 0xDEADBEEF; @@ -375,6 +388,10 @@ SECTIONS { instance__10dFlagMgr_c = 0xDEADBEEF; + addToList__13ActivePhysicsFv = 0xDEADBEEF; + initWithStruct__13ActivePhysicsFP8dActor_cPQ213ActivePhysics4Info = 0xDEADBEEF; + + __ct__7PhysicsFv = 0xDEADBEEF; setup__7PhysicsFP8dActor_cPQ27Physics4InfoUcUcP7Point2d = 0xDEADBEEF; addToList__7PhysicsFv = 0xDEADBEEF; diff --git a/src/eventblock.cpp b/src/eventblock.cpp index f285da8..6f353b7 100644 --- a/src/eventblock.cpp +++ b/src/eventblock.cpp @@ -10,8 +10,6 @@ public: SWAP_EVENTS = 1 }; - typedef State State; - TileRenderer tile; Physics::Info physicsInfo; @@ -28,21 +26,16 @@ public: void calledWhenUpMoveExecutes(); void calledWhenDownMoveExecutes(); - void wait_Begin(); - void wait_Execute(); - void wait_End(); - void blockWasHit(bool isDown); - static State StateID_Wait; + USING_STATES(daEnEventBlock_c); + DECLARE_STATE(Wait); + static daEnEventBlock_c *build(); }; -daEnEventBlock_c::State daEnEventBlock_c::StateID_Wait( - "daEnEventBlock_c::StateID_Wait", - &daEnEventBlock_c::wait_Begin, - &daEnEventBlock_c::wait_Execute, - &daEnEventBlock_c::wait_End); + +CREATE_STATE(daEnEventBlock_c, Wait); int daEnEventBlock_c::onCreate() { @@ -184,13 +177,13 @@ void daEnEventBlock_c::calledWhenDownMoveExecutes() { -void daEnEventBlock_c::wait_Begin() { +void daEnEventBlock_c::beginState_Wait() { } -void daEnEventBlock_c::wait_End() { +void daEnEventBlock_c::endState_Wait() { } -void daEnEventBlock_c::wait_Execute() { +void daEnEventBlock_c::executeState_Wait() { int result = blockResult(); if (result == 0) -- cgit v1.2.3