diff options
-rw-r--r-- | include/daEnDosun_c.h | 18 | ||||
-rw-r--r-- | include/daEnemy_c.h | 27 | ||||
-rw-r--r-- | include/g3dhax.h | 2 | ||||
-rwxr-xr-x | include/game.h | 24 | ||||
-rw-r--r-- | kamek_pal.x | 32 | ||||
-rw-r--r-- | src/bossBalboaWrench.cpp | 9 | ||||
-rw-r--r-- | src/bossFuzzyBear.cpp | 34 | ||||
-rw-r--r-- | src/bossMegaGoomba.cpp | 21 | ||||
-rw-r--r-- | src/bossRamboo.cpp | 6 | ||||
-rw-r--r-- | src/bossThwompaDomp.cpp | 312 | ||||
-rw-r--r-- | src/bossWrenchThrow.cpp | 23 | ||||
-rw-r--r-- | src/fakeStarCoin.cpp | 18 | ||||
-rwxr-xr-x | src/mrsun.cpp | 13 | ||||
-rwxr-xr-x | src/spritespawner.cpp | 3 | ||||
-rwxr-xr-x | src/spriteswapper.cpp | 3 |
15 files changed, 403 insertions, 142 deletions
diff --git a/include/daEnDosun_c.h b/include/daEnDosun_c.h index 49acabe..fadaedb 100644 --- a/include/daEnDosun_c.h +++ b/include/daEnDosun_c.h @@ -39,19 +39,17 @@ public: nw4r::g3d::ResFile resFile; // _540 m3d::mdl_c bodyModel; // _544 m3d::anmVis_c anmVis; // _584 - //u8 collision_struct[4]; // _5BC - u32 collision_struct; // _5BC - u32 _5C0, _5C4, _5C8; - float posXrelated_1; // _5CC + u32 collision_struct[4]; // _5BC + float shakePosXoffset; // _5CC shakePosXoffset u32 bigOrSmall; // _5D0 0=small,1=big - u32 holdsFromSettings; // _5D4 + u32 holdsFromSettings; // _5D4 0=normal,1=???,2=alwaysFalling u16 puruMoveCounter; // _5D8 - u16 _5DA; + u16 shakeIndex; // _5DA 0=shake,1=normal u32 countdownTimer; // _5DC - u32 anotherCounter; // _5E0 - float posXrelated_2; // _5E4 - float posYrelated_1; // _5E8 - u32 _5EC; + u32 dieCounter; // _5E0 + float unusedXoffset; // _5E4 + float unusedYoffset; // _5E8 + u32 _5EC; // padding /* don't have params yet */ void setupBodyModel(); // 809f63f0 diff --git a/include/daEnemy_c.h b/include/daEnemy_c.h index 36fd574..7b74fed 100644 --- a/include/daEnemy_c.h +++ b/include/daEnemy_c.h @@ -7,23 +7,26 @@ /* All Addresses NTSCv2 */ +//FIXME :( +extern "C" void HandlesOverallScale(Vec3* scale); + class daEnemy_c : public dEn_c { public: - int _vf58(); // 809a54e0 // daEnAkoya_c - void _vf5C(); // 809a54d0 // daEnAkoya_c - int _vf68(); // 809a5520 // daEnAkoya_c + int _vf58() { return 8; } // 809a54e0 // daEnAkoya_c + void _vf5C() { return; } // 809a54d0 // daEnAkoya_c + int _vf68() { return 1; } // 809a5520 // daEnAkoya_c //u8* _vf6C(); // 809a3550 // daEnAkoya_c //FIXME - u8* ptrToWhichPlayer(); // 809a3550 // daEnAkoya_c - int _vf74(); // 809a5510 // dActorState_c - void _vf7C(); // 809a5500 // dActorState_c - void _vfB8(); // 809a54f0 // dActorState_c - void _vf228(); // 809a5560 // smthg w/InitlScale - void _vf23C(); // 809a5550 // nullsub - void _vf240(); // 809a5540 // nullsub - int _vf244(); // 809a5530 // return 0; + u8* ptrToWhichPlayer() { return &this->which_player; } // 809a3550 // daEnAkoya_c + int _vf74() { return 1; } // 809a5510 // dActorState_c + void _vf7C() { return; } // 809a5500 // dActorState_c + void _vfB8() { return; } // 809a54f0 // dActorState_c + void _vf228() { HandlesOverallScale(&this->initialScale); } // 809a5560 // smthg w/InitlScale + void _vf23C() { return; } // 809a5550 // nullsub + void _vf240() { return; } // 809a5540 // nullsub + int _vf244() { return 0; } // 809a5530 // return 0; - void setupBodyModel(); //FIXME + //void setupBodyModel(); //FIXME }; #endif diff --git a/include/g3dhax.h b/include/g3dhax.h index f13aab3..b016e55 100644 --- a/include/g3dhax.h +++ b/include/g3dhax.h @@ -280,7 +280,7 @@ namespace m3d { // 28 might be Max Frame? float _28, _2C, currentFrame; - u8 _34; // animation group?? + u8 playState; // animation group?? }; class anmChr_c : public fanm_c { diff --git a/include/game.h b/include/game.h index 5fd71d5..8e7d86a 100755 --- a/include/game.h +++ b/include/game.h @@ -1245,6 +1245,8 @@ public: void Clear3();
int CollidedWithTile();
+ int SomethingSemiImportant(int);
+ int s_80072BC0();
dStageActor_c* owner;
void* struct1_ptr;
@@ -1462,6 +1464,10 @@ public: virtual void _vf5C();
~dActor_c();
+
+ void UpdateObjectPosBasedOnSpeedValuesReal();
+ void HandleXSpeed();
+ void HandleYSpeed();
};
class dStageActor_c : public dActor_c {
@@ -1487,10 +1493,13 @@ public: u16 spriteSomeFlag;
u8 _366, _367;
u32 _368;
- u8 _36C, _36D;
+ u8 eatenState; // 0=normal,2=eaten
+ u8 _36D;
Vec somethingRelatedToScale;
u32 _37C, _380, _384, _388;
- u8 _38C, _38D, enableFlag, currentLayerID;
+ u8 _38C;
+ u8 which_player; // _38D
+ u8 enableFlag, currentLayerID;
u8 _390, _391, _392, _padding;
dStageActor_c();
@@ -1537,7 +1546,9 @@ public: virtual void _vfD0(Vec2 *p); // mostly same as vfC8, but uses PLAYER_SE_OBJ/GROUP_BOOT/SE_OBJ_CMN_SPLASH_POISON
// I'll add methods as I need them
- void checkZoneBoundaries(u32 flags); // I think this method is for that, anyway
+ int outOfZone(Vec3 pos, float* rect, u8 zone);
+ int checkZoneBoundaries(u32 flags); // I think this method is for that, anyway
+ void Delete(u8 param1); // fBase_c::Delete(void);
~dStageActor_c();
@@ -1624,7 +1635,6 @@ public: u32 _510, _514, _518;
void *_51C;
dEn_c *_520;
- u32 _524;
dEn_c();
@@ -1760,9 +1770,11 @@ public: ~dEn_c();
-
static void collisionCallback(ActivePhysics::Info *one, ActivePhysics::Info *two);
+ void doSpriteMovement();
+ bool CheckIfPlayerBelow(float,float);
+
// States
USING_STATES(dEn_c);
REF_NINTENDO_STATE(DieFumi);
@@ -1778,7 +1790,7 @@ public: class daEnBlockMain_c : public dEn_c {
public:
- u32 _528, _52C, _530;
+ u32 _534, _528, _52C, _530;
Physics physics;
float _618, _61C, _620;
u32 _624, _628, _62C;
diff --git a/kamek_pal.x b/kamek_pal.x index a036ddd..c46bb81 100644 --- a/kamek_pal.x +++ b/kamek_pal.x @@ -147,11 +147,13 @@ SECTIONS { /* collisionMgr_c */ __ct__14collisionMgr_c = 0x8006cf40; __dt__14collisionMgr_c = 0x8006cf40; - Clear1__14collisionMgr_c = 0x8006cfe0; - Clear2__14collisionMgr_c = 0x8006d000; + Clear1__14collisionMgr_cFv = 0x8006cfe0; + Clear2__14collisionMgr_cFv = 0x8006d000; Init__14collisionMgr_cFP13dStageActor_cPUcPUcPUc = 0x8006d090; - Clear3__14collisionMgr_c = 0x8006d440; + Clear3__14collisionMgr_cFv = 0x8006d440; CollidedWithTile__14collisionMgr_c = 0x80070cb0; + SomethingSemiImportant__14collisionMgr_cFi = 0x8006ef40; + s_80072BC0__14collisionMgr_cFv = 0x80072bc0; /* freezeMgr_c */ __ct_11freezeMgr_c = 0x800b8490; @@ -172,12 +174,19 @@ SECTIONS { doSomethingCool7__11freezeMgr_c = 0x800b8d40; CheckCountdownTimer__11freezeMgr_c = 0x800b8f30; + __vt__7fBase_c = 0x80329758; + onCreate__7fBase_cFv = 0x80161ec0; + onDelete__7fBase_cFv = 0x80161f70; + onExecute__7fBase_cFv = 0x80162210; willBeDeleted__7fBase_cFv = 0x80162410; moreHeapShit__7fBase_cFUiPv = 0x80162730; createHeap__7fBase_cFUiPv = 0x80162930; heapCreated__7fBase_cFv = 0x801629F0; Delete__7fBase_cFv = 0x80162650; hasUninitialisedProcesses__7fBase_cFv = 0x80162B60; + onDraw__7fBase_cFv = 0x80162310; + _Z15fBase_c__DeletePv = 0x80162650; + fBase_c__Delete__FPv = 0x80162650; GetExplanationString__7dBase_cFv = 0x8006C660; @@ -351,6 +360,9 @@ SECTIONS { StateID_DieGoal__5dEn_c = 0x80358034; StateID_DieOther__5dEn_c = 0x80358074; + doSpriteMovement__5dEn_cFv = 0x800955F0; + CheckIfPlayerBelow__5dEn_cFff = 0x800978C0; + _vfD8__18dActorMultiState_cFv = 0x80067590; _vfDC__18dActorMultiState_cFv = 0x800675B0; _vfE0__18dActorMultiState_cFv = 0x800675A0; @@ -389,8 +401,10 @@ SECTIONS { _vfC0__13dStageActor_cFv = 0x80065B60; _vfC4__13dStageActor_cFv = 0x80065B70; _vfC8__13dStageActor_cFP7Point2d = 0x80065CC0; + outOfZone__13dStageActor_cF7Point3dPfUc = 0x80064da0; checkZoneBoundaries__13dStageActor_cFUi = 0x80064F50; create__13dStageActor_cF6ActorsUiP7Point3dP6S16VecUc = 0x80064610; + Delete__13dStageActor_cFUc = 0x80064d10; __ct__8dScene_cFv = 0x800E1AA0; __dt__8dScene_cFv = 0x800E1B10; @@ -405,6 +419,9 @@ SECTIONS { __ct__8dActor_cFv = 0x8006C6D0; __dt__8dActor_cFv = 0x8006C7F0; + UpdateObjectPosBasedOnSpeedValuesReal__8dActor_cFv = 0x8006CD40; + HandleXSpeed__8dActor_cFv = 0x8006CD90; + HandleYSpeed__8dActor_cFv = 0x8006CDE0; __ct__7dBase_cFv = 0x8006C420; __dt__7dBase_cFv = 0x8006C490; @@ -417,7 +434,6 @@ SECTIONS { beforeDraw__7dBase_cFv = 0x8006C610; afterDraw__7dBase_cFi = 0x8006C650; - onDraw__7fBase_cFv = 0x80162310; specialDraw1__8dActor_cFv = 0x8006CA50; specialDraw2__8dActor_cFv = 0x8006CA60; @@ -1114,8 +1130,6 @@ SECTIONS { __ashldi3 = 0x802DD4DC; - _Z15fBase_c__DeletePv = 0x80162650; - fBase_c__Delete__FPv = 0x80162650; _Z13FindActorByIDj = 0x80162E40; FindActorByID__FUi = 0x80162E40; @@ -1234,10 +1248,14 @@ SECTIONS { DoStuffAndMarkDead = 0x80097170; SmoothRotation = 0x8015f630; ClassAt1EC_Init = 0x8006D090; + HandlesOverallScale = 0x8009ea50; + s_800b56e0 = 0x800b5730; + unk_8042A008 = 0x8042a2e8; + UnknownBullshit = 0x800d8d50; /* daEnemy_c */ /*FIXME bad vtable address :( */ - __vt__9daEnemy_c = 0x80ae8268; + //__vt__9daEnemy_c = 0x80ae8268; _vf58__9daEnemy_cFv = 0x809a54a0; _vf5C__9daEnemy_cFv = 0x809a5490; _vf68__9daEnemy_cFv = 0x809a54e0; diff --git a/src/bossBalboaWrench.cpp b/src/bossBalboaWrench.cpp index acdbb44..1db7496 100644 --- a/src/bossBalboaWrench.cpp +++ b/src/bossBalboaWrench.cpp @@ -66,9 +66,6 @@ daBalboa_c *daBalboa_c::build() { } -extern "C" void *HandleXSpeed(daBalboa_c *); -extern "C" void *HandleYSpeed(daBalboa_c *); -extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daBalboa_c *); extern "C" u32 GenerateRandomNumber(int max); extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daBalboa_c *, Vec pos); @@ -120,10 +117,10 @@ void daBalboa_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) //FIXME hack to make multiple playerCollisions work this->isDead = 0; this->flags_4FC |= (1<<(31-7)); - if(apOther->owner->_38D > 3) { - OSReport("!!!ATTENTION!!!\napOther->owner->_38D > 3\n"); + if(apOther->owner->which_player > 3) { + OSReport("!!!ATTENTION!!!\napOther->owner->which_player > 3\n"); }else{ - this->counter_504[apOther->owner->_38D] = 0; + this->counter_504[apOther->owner->which_player] = 0; } } diff --git a/src/bossFuzzyBear.cpp b/src/bossFuzzyBear.cpp index 7bb7e8b..1b9cc99 100644 --- a/src/bossFuzzyBear.cpp +++ b/src/bossFuzzyBear.cpp @@ -66,10 +66,6 @@ daFuzzyBear_c *daFuzzyBear_c::build() { } -extern "C" void *HandleXSpeed(daFuzzyBear_c *); -extern "C" void *HandleYSpeed(daFuzzyBear_c *); -extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daFuzzyBear_c *); -extern "C" void *doSpriteMovement(dEn_c *); extern "C" void *PlaySound(daFuzzyBear_c *, int soundID); extern "C" void *StopSound(int soundID); @@ -123,8 +119,8 @@ void daFuzzyBear_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhy if (blah->speed.y < 0) { blah->speed.y = -blah->speed.y; } - doSpriteMovement(blah); - doSpriteMovement(blah); + blah->doSpriteMovement(); + blah->doSpriteMovement(); if (this->isInvulnerable == 1) { @@ -455,10 +451,10 @@ void daFuzzyBear_c::executeState_Bounce() { else { this->speed.y = this->speed.y - 0.1; } // Gravity - HandleXSpeed(this); - HandleYSpeed(this); + this->HandleXSpeed(); + this->HandleYSpeed(); - UpdateObjectPosBasedOnSpeedValues_real(this); + this->UpdateObjectPosBasedOnSpeedValuesReal(); } @@ -533,10 +529,10 @@ void daFuzzyBear_c::executeState_Needles() { } else { doStateChange(&StateID_Bounce); } - HandleXSpeed(this); - HandleYSpeed(this); + this->HandleXSpeed(); + this->HandleYSpeed(); - UpdateObjectPosBasedOnSpeedValues_real(this); + this->UpdateObjectPosBasedOnSpeedValuesReal(); } void daFuzzyBear_c::endState_Needles() { OSReport("Fuzzy Needle State End"); } @@ -587,10 +583,10 @@ void daFuzzyBear_c::executeState_Spray() { else { this->speed.y = this->speed.y - 0.1; } // Gravity - HandleXSpeed(this); - HandleYSpeed(this); + this->HandleXSpeed(); + this->HandleYSpeed(); - UpdateObjectPosBasedOnSpeedValues_real(this); + this->UpdateObjectPosBasedOnSpeedValuesReal(); } void daFuzzyBear_c::endState_Spray() { @@ -679,11 +675,11 @@ void daFuzzyBear_c::executeState_RolyPoly() { -// HandleXSpeed(this); -// HandleYSpeed(this); +// this->HandleXSpeed(); +// this->HandleYSpeed(); -// doSpriteMovement(this); -// UpdateObjectPosBasedOnSpeedValues_real(this); +// this->doSpriteMovement(); +// this->UpdateObjectPosBasedOnSpeedValuesReal(); } void daFuzzyBear_c::endState_RolyPoly() { diff --git a/src/bossMegaGoomba.cpp b/src/bossMegaGoomba.cpp index 996a609..f701ee7 100644 --- a/src/bossMegaGoomba.cpp +++ b/src/bossMegaGoomba.cpp @@ -117,10 +117,6 @@ void HexDump(char* address, u32 length) { extern "C" void *PlaySound(daMegaGoomba_c *, int soundID); -//FIXME make these dEn_c::HandleXSpeed(); -extern "C" void *HandleXSpeed(daMegaGoomba_c *); -extern "C" void *HandleYSpeed(daMegaGoomba_c *); -extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daMegaGoomba_c *); extern "C" u32 GenerateRandomNumber(int max); extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daMegaGoomba_c *, Vec pos); extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); @@ -128,7 +124,6 @@ extern "C" dStageActor_c *GetSpecificPlayerActor(int number); //FIXME make this dEn_c->used... extern "C" char usedForDeterminingStatePress_or_playerCollision(dEn_c* t, ActivePhysics *apThis, ActivePhysics *apOther, int unk1); -extern "C" void doSpriteMovement(dStageActor_c* actor); extern "C" int SomeStrangeModification(dStageActor_c* actor); extern "C" void DoStuffAndMarkDead(dStageActor_c *actor, Vec vector, float unk); extern "C" int SmoothRotation(short* rot, u16 amt, int unk2); @@ -235,10 +230,10 @@ void daMegaGoomba_c::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth //FIXME hack to make multiple playerCollisions work this->isDead = 0; this->flags_4FC |= (1<<(31-7)); - if(apOther->owner->_38D > 3) { - OSReport("!!!ATTENTION!!!\napOther->owner->_38D > 3\n"); + if(apOther->owner->which_player > 3) { + OSReport("!!!ATTENTION!!!\napOther->owner->which_player > 3\n"); }else{ - this->counter_504[apOther->owner->_38D] = 0; + this->counter_504[apOther->owner->which_player] = 0; } } @@ -613,8 +608,8 @@ void daMegaGoomba_c::executeState_Turn() { this->bodyModel._vf1C(); this->animationPat.process(); - HandleYSpeed(this); - doSpriteMovement(this); + this->HandleYSpeed(); + this->doSpriteMovement(); /*this->_vf2D0(); //nullsub();*/ int ret = SomeStrangeModification(this); @@ -650,9 +645,9 @@ void daMegaGoomba_c::executeState_Walk() { this->bodyModel._vf1C(); this->animationPat.process(); //HOMEMADE// - HandleXSpeed(this); - HandleYSpeed(this); - doSpriteMovement(this); + this->HandleXSpeed(); + this->HandleYSpeed(); + this->doSpriteMovement(); u16 amt = (this->direction == 0) ? 0x2000 : 0xE000; SmoothRotation(&this->rot.y, amt, 0x200); /*this->_vf2D0(); //nullsub();*/ diff --git a/src/bossRamboo.cpp b/src/bossRamboo.cpp index 598cf75..3ed947d 100644 --- a/src/bossRamboo.cpp +++ b/src/bossRamboo.cpp @@ -62,9 +62,6 @@ daRamboo_c *daRamboo_c::build() { } -extern "C" void *HandleXSpeed(daRamboo_c *); -extern "C" void *HandleYSpeed(daRamboo_c *); -extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daRamboo_c *); extern "C" u32 GenerateRandomNumber(int max); extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daRamboo_c *, Vec pos); @@ -105,7 +102,8 @@ void daRamboo_c::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysic CreateEffect(380, &apOther->owner->pos); doStateChange(&StateID_Flee); - apOther->owner->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) + apOther->owner->Delete(apOther->owner->_390); } } void daRamboo_c::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { OSReport("Hit Hammer"); } diff --git a/src/bossThwompaDomp.cpp b/src/bossThwompaDomp.cpp index 1c366b8..268b4bd 100644 --- a/src/bossThwompaDomp.cpp +++ b/src/bossThwompaDomp.cpp @@ -1,6 +1,7 @@ #include <common.h> #include <game.h> #include <g3dhax.h> +#include <sfx.h> #include "daEnDosun_c.h" @@ -22,30 +23,65 @@ void sub_8009ea50( _464_struct* data ) { } #endif + +//FIXME find if needed +extern "C" int s_800b56e0(Vec,float*,float*,u8 zone); +//FIXME +extern "C" void* unk_8042A008; +extern "C" void UnknownBullshit(void*,int,int,int,int); +//FIXME +extern "C" void* SoundRelatedClass; +extern "C" Vec ConvertStagePositionIntoScreenPosition__Maybe(Vec); +extern "C" void AnotherSoundRelatedFunction(void*,SFX,Vec,int); + +#define OLD 0 +#define STATES_NEEDED 1 +#define SETTINGS1CHANGE 1 class daEnMegaDosun_c : public daEnDosun_c { - //int onCreate(); // overload for mega - //int onExecute(); + int onCreate(); // overload for mega + int onExecute(); static daEnMegaDosun_c *build(); //int checkZoneBoundaries(int); +#if STATES_NEEDED //FIXME - //USING_STATES(daEnMegaDosun_c); - //DECLARE_STATE(Wait); + USING_STATES(daEnMegaDosun_c); + DECLARE_STATE(UpWait); + DECLARE_STATE(DownMoveWait); + DECLARE_STATE(PuruMove); + DECLARE_STATE(DownMoveKameck); + DECLARE_STATE(DownMove); + DECLARE_STATE(DownWait); + DECLARE_STATE(UpMove); +#endif }; +#if STATES_NEEDED +CREATE_STATE(daEnMegaDosun_c, UpWait); +CREATE_STATE(daEnMegaDosun_c, DownMoveWait); +CREATE_STATE(daEnMegaDosun_c, PuruMove); +CREATE_STATE(daEnMegaDosun_c, DownMoveKameck); +CREATE_STATE(daEnMegaDosun_c, DownMove); +CREATE_STATE(daEnMegaDosun_c, DownWait); +CREATE_STATE(daEnMegaDosun_c, UpMove); +#endif + daEnMegaDosun_c *daEnMegaDosun_c::build() { + OSReport("Building MegaThwomp\n"); void *buffer = AllocFromGameHeap1(sizeof(daEnMegaDosun_c)); return new(buffer) daEnMegaDosun_c; } -#if 0 +#if 1 +//FIXME stops halfway up int daEnMegaDosun_c::onCreate() { - //FIXME + OSReport("daEnMegaDosun::onCreate()\n"); + this->bigOrSmall = 1; // 0=small,1=big,2=mega this->setupBodyModel(); // add this for linking/rename - + this->_36D = 0; // byte this->holdsFromSettings = this->settings & 0xf; //0=normal,1=??,2=fall @@ -54,17 +90,10 @@ int daEnMegaDosun_c::onCreate() { this->pos.y -= 21.0; this->pos.z = -280.0; // behind layer1 (hides spikes) - //FIXME might be u32 0x11804101 - /* - this->collision_struct[0] = 0x11; - this->collision_struct[1] = 0x80; - this->collision_struct[2] = 0x41; - this->collision_struct[3] = 0x01; - */ - this->collision_struct = 0x11804101; - this->_5C0 = 0xFFFE1000; - this->_5C4 = 0x1F000; - this->_5C8 = 0x5000; + this->collision_struct[0] = 0x11804101; + this->collision_struct[1] = 0xFFFE1000; + this->collision_struct[2] = 0x0001F000; + this->collision_struct[3] = 0x00005000; /* //0x80ACF990 + 0x8C = 80acfa1C @@ -74,6 +103,7 @@ int daEnMegaDosun_c::onCreate() { */ ActivePhysics::Info hm; hm.xDistToCenter = 0.0; + //FIXME find the missing link hm.yDistToCenter = 41.0; hm.xDistToEdge = 36.0; hm.yDistToEdge = 38.0; @@ -83,6 +113,7 @@ int daEnMegaDosun_c::onCreate() { hm.bitfield2 = 0x0000820E; hm.unkShort1C = 0x0100; hm.callback = &dEn_c::collisionCallback; + OSReport("this->aPhysiscs.initWithStruct(this,&hm);\n"); this->aPhysics.initWithStruct(this, &hm); /* 0x00000001,0xfffe1000,0x0001f000,0x00055000, @@ -90,8 +121,9 @@ int daEnMegaDosun_c::onCreate() { * 0x03000000,0x0000004f,0x0000820e,0x01000000, * dEn_c::collisionCallback */ - u8 s3[] = {0,0,0,1,0xff,0xfe,0x10,0,0,1,0xf0,0,0,5,0x50,0}; - //FIXME 0x80ACF990 + 0x58 = 80acf9e8 + //u8 s3[] = {0,0,0,1,0xff,0xfe,0x10,0,0,1,0xf0,0,0,5,0x50,0}; + u8 s3[] = {0,0,0,1,0xff,0xfe,0x10,0,0,1,0xf0,0,0xff,0xfe,0x10,0}; + OSReport("this->collMgr.Init(this,(u8*)&this->collision_struct,(u8*)&s3,0);\n"); this->collMgr.Init(this,(u8*)&this->collision_struct,(u8*)&s3,0); this->pos_delta2.x = 0.0; @@ -100,6 +132,7 @@ int daEnMegaDosun_c::onCreate() { this->_320 = 0.0; this->_324 = 48.0; + OSReport("this->aPhysics.addToList();\n"); this->aPhysics.addToList(); this->scale.x = 1.0; @@ -113,6 +146,7 @@ int daEnMegaDosun_c::onCreate() { this->rot.y = 0; this->rot.z = 0; + OSReport("this->doStateChange(FOO): %d\n", this->holdsFromSettings); // check settings bit if(this->holdsFromSettings == 2) { this->doStateChange(&StateID_DownMove_Kameck); @@ -124,22 +158,230 @@ int daEnMegaDosun_c::onCreate() { } #endif -#if 0 int daEnMegaDosun_c::onExecute() { acState.execute(); - //FIXME change to do outro when leaving screen - //this->checkZoneBoundaries(0); + /* + float tempRect[4] = {this->_320,this->_324,0.5*this->spriteSomeRectX,0.5*this->spriteSomeRectY}; + int foo = this->outOfZone(this->pos, tempRect, this->currentZoneID); + //float tempRect2[4] = {this->_338, this->_33C, this->_340, this->_344}; + //OSReport("s_800b56e0()\n"); + //int bar = s_800b56e0(this->pos, tempRect, tempRect2, this->currentZoneID); + //OSReport("foo: %d, bar: %d\n", foo, bar); + if(foo) { + OSReport("this->outOfZone(%d) : %d\n", this->currentZoneID, foo); + OSReport("daEnMegaDosun_c has left the building\n"); + this->Delete(this->_390); + //FIXME change to do outro when leaving screen + }else{ + OSReport("this->outOfZone(%d) : %d\n", this->currentZoneID, foo); + } + */ + int ret = this->checkZoneBoundaries(0); + if(ret) { + OSReport("daEnMegaDosun_c has left the building\n"); + } return 1; } + +#if STATES_NEEDED +//FIXME add sideways moving +//StateID_UpWait +void daEnMegaDosun_c::beginState_UpWait() { + OSReport("beginState_UpWait()\n"); + this->countdownTimer = 0; + if(!this->bigOrSmall) + return; + this->collision_struct[0] = 0x11804101; +} +void daEnMegaDosun_c::executeState_UpWait() { + OSReport("executeState_UpWait()\n"); + if(this->countdownTimer != 0) { + this->countdownTimer--; + return; + } + + //FIXME need megasized - also needs to be less leeway + float _array[] = { 48.0, 80.0 }; // small, big + //CheckIfPlayerBelow(xDelta, yDelta); + //if(this->CheckIfPlayerBelow(80.0, 256.0)) { + if(this->CheckIfPlayerBelow(40.0, 256.0)) { + this->doStateChange(&StateID_DownMoveWait); + this->speed.y = 0.0; + } +} +void daEnMegaDosun_c::endState_UpWait() { + OSReport("endState_UpWait()\n"); + return; +} + +//StateID_DownMoveWait +void daEnMegaDosun_c::beginState_DownMoveWait() { + OSReport("beginState_DownMoveWait()\n"); + this->anmVis.playState = 1; + this->bodyModel.bindAnim(&this->anmVis, 0.5); +} +void daEnMegaDosun_c::executeState_DownMoveWait() { + OSReport("executeState_DownMoveWait()\n"); + if(this->anmVis.isAnimationDone()) + this->doStateChange(&StateID_PuruMove); + this->anmVis.process(); +} +void daEnMegaDosun_c::endState_DownMoveWait() { + OSReport("endState_DownMoveWait()\n"); + return; +} + +//StateID_PuruMove +void daEnMegaDosun_c::beginState_PuruMove() { + OSReport("beginState_PuruMove()\n"); + this->puruMoveCounter = 8; + this->shakeIndex = 0; +} +void daEnMegaDosun_c::executeState_PuruMove() { + OSReport("executeState_PuruMove()\n"); + if(this->puruMoveCounter == 0) { + this->shakePosXoffset = 0.0; + this->doStateChange(&StateID_DownMove); + return; + } + + this->puruMoveCounter--; + if(this->puruMoveCounter & 2 == 0) + return; + + float _array[] = {2.0, 0.0}; + this->shakeIndex ^= 1; + this->shakePosXoffset = _array[this->shakeIndex]; +} +void daEnMegaDosun_c::endState_PuruMove() { + OSReport("endState_PuruMove()\n"); + return; +} + +//StateID_DownMoveKameck +void daEnMegaDosun_c::beginState_DownMoveKameck() { + OSReport("beginState_DownMoveKameck()\n"); + this->anmVis.playState = 1; + this->bodyModel.bindAnim(&this->anmVis, 0.5); +} +void daEnMegaDosun_c::executeState_DownMoveKameck() { + OSReport("executeState_DownMoveKameck()\n"); + if(this->anmVis.isAnimationDone()) + this->doStateChange(&StateID_DownMove); + this->anmVis.process(); +} +void daEnMegaDosun_c::endState_DownMoveKameck() { + OSReport("endState_DownMoveKameck()\n"); + return; +} + +//StateID_DownMove +void daEnMegaDosun_c::beginState_DownMove() { + OSReport("beginState_DownMove()\n"); + this->speed.y = 0.0; +} +void daEnMegaDosun_c::executeState_DownMove() { + OSReport("executeState_DownMove()\n"); + this->HandleYSpeed(); + this->UpdateObjectPosBasedOnSpeedValuesReal(); + + //FIXME what do I do? - bottom detection + int ret = this->collMgr.s_80072BC0(); + OSReport("s_80072BC0(): %08x\n", ret); + if(!ret) + return; + +#if SETTINGS1CHANGE + if((this->holdsFromSettings == 1) && (ret & 0x8000)) { + OSReport("this->speed.y = 0.0;\n"); + this->speed.y = 0.0; + } + + if(this->holdsFromSettings == 2) { + OSReport("ret |= 0x400000\n"); + ret |= 0x400000; + } +#else + if(this->holdsFromSettings == 1) { + OSReport("ret |= 0x400000\n"); + ret |= 0x400000; + } +#endif + + if(!(ret & 0x400000)) { + OSReport("doStateChange(&StateID_DownWait)\n"); + this->doStateChange(&StateID_DownWait); + this->countdownTimer = 0x40; + this->speed.y = 0.0; + UnknownBullshit(unk_8042A008, 0, 1, 0, 0); + }else{ + this->collision_struct[0] = 0x00000001; + this->speed.y = 0.0; + OSReport("UnknownBullshit(%x,%d,%d,%d,%d)\n", unk_8042A008,0,1,0,0); + UnknownBullshit(unk_8042A008, 0, 1, 0, 0); + this->collMgr.Clear2(); + } + + this->spawnEffects(); + Vec p = ConvertStagePositionIntoScreenPosition__Maybe(this->pos); + AnotherSoundRelatedFunction(SoundRelatedClass, SE_EMY_BIG_DOSSUN, p, 0); + //SoundRelatedClass.AnotherSoundRelatedFunction(SE_EMY_BIG_DOSSUN, p, 0); +} +void daEnMegaDosun_c::endState_DownMove() { + OSReport("endState_DownMove()\n"); + return; +} + +//StateID_DownWait +void daEnMegaDosun_c::beginState_DownWait() { + OSReport("beginState_DownWait()\n"); + return; +} +void daEnMegaDosun_c::executeState_DownWait() { + OSReport("executeState_DownWait()\n"); + if(this->countdownTimer == 0) { + this->doStateChange(&StateID_UpMove); + }else{ + this->countdownTimer--; + if(this->countdownTimer & 0xff == 0x20) + this->anmVis.playState = 3; + } + + this->anmVis.process(); +} +void daEnMegaDosun_c::endState_DownWait() { + OSReport("endState_DownWait()\n"); + return; +} + +//StateID_UpMove +void daEnMegaDosun_c::beginState_UpMove() { + OSReport("beginState_UpMove()\n"); + this->collMgr.Clear2(); +} +void daEnMegaDosun_c::executeState_UpMove() { + OSReport("executeState_UpMove()\n"); + this->speed.y = 0.875; + this->UpdateObjectPosBasedOnSpeedValuesReal(); + int ret = this->collMgr.SomethingSemiImportant(0); + OSReport("this->collMgr.SomethingSemiImportant(0): %08x\n", ret); + if(ret != 0) { // at top + this->doStateChange(&StateID_UpWait); + this->countdownTimer = 0xc; + } +} +void daEnMegaDosun_c::endState_UpMove() { + OSReport("endState_UpMove()\n"); + return; +} #endif -//FIXME #if 0 int daEnMegaDosun_c::checkZoneBoundaries(int foo) { - if(this->_36C == 2) { // is eaten + if(this->eatenState == 2) { // is eaten return 0; } @@ -150,16 +392,14 @@ int daEnMegaDosun_c::checkZoneBoundaries(int foo) { int ret = 0; -#if 0 Rect tempRect = (Rect){this->_320, this->_324, 0.5 * this->spriteSomeRectX, 0.5 * this->spriteSomeRectY}; Rect tempRect2 = (Rect){_338, _33C, _340, _344}; - if(this->s800064da0(pos, &tempRect, currentZoneId) || + if(this->outOfZone(this->pos, &tempRect, currentZoneId) || (!(foo&0x4) && s_800b56e0(pos, &tempRect, &tempRect2, currentZoneId)) ) { ret = 1; } -#endif if(ret && !(foo & 0x2)) this->Delete(this->_390); @@ -173,22 +413,22 @@ extern "C" bool CollidedWithTile(u8 *); extern "C" void *SomeStrangeModification(dEn_c *); void ThwompaDompMoveC(dEn_c *Sprite) { - - - + + + bool FirstCheck; bool SecondCheck; - + // Check for collisions with walls? FirstCheck = CollidedWithTile(Sprite->collMgr); SomeStrangeModification(Sprite); SecondCheck = CollidedWithTile(Sprite->collMgr); - + OSReport("XPos = %f, FirstCheck = %d, SecondCheck = %d", Sprite->pos.x, FirstCheck, SecondCheck); if ((FirstCheck != 0) && (SecondCheck != 0)) { OSReport("Actually doing something, I swear"); - + Sprite->pos.y = Sprite->pos.y + 16.0; Sprite->pos.x = Sprite->pos.x - 180.0; @@ -205,8 +445,8 @@ void ThwompaDompMoveC(dEn_c *Sprite) { else { Sprite->pos.x = Sprite->pos.x - 1.0; } } - - + + return; } #endif diff --git a/src/bossWrenchThrow.cpp b/src/bossWrenchThrow.cpp index beea815..6ce36f6 100644 --- a/src/bossWrenchThrow.cpp +++ b/src/bossWrenchThrow.cpp @@ -48,11 +48,7 @@ CREATE_STATE(daWrench, Straight); extern "C" void *PlaySound(dEn_c *, int soundID); -extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daWrench *); extern "C" dStageActor_c *GetSpecificPlayerActor(int number); -extern "C" void *HandleXSpeed(daWrench *); -extern "C" void *HandleYSpeed(daWrench *); - void daWrench::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { @@ -61,10 +57,10 @@ void daWrench::playerCollision(ActivePhysics *apThis, ActivePhysics *apOther) { this->isDead = 0; this->flags_4FC |= (1<<(31-7)); - if(apOther->owner->_38D > 3) { - OSReport("!!!ATTENTION!!!\napOther->owner->_38D > 3\n"); + if(apOther->owner->which_player > 3) { + OSReport("!!!ATTENTION!!!\napOther->owner->which_player > 3\n"); }else{ - this->counter_504[apOther->owner->_38D] = 0; + this->counter_504[apOther->owner->which_player] = 0; } } @@ -78,7 +74,8 @@ void daWrench::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOth PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c(void) + this->Delete(this->_390); } void daWrench::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) {} @@ -266,14 +263,15 @@ void daWrench::executeState_Homing() { this->pos.y += this->ymod * this->lifespan / 360; - UpdateObjectPosBasedOnSpeedValues_real(this); + this->UpdateObjectPosBasedOnSpeedValuesReal(); if (this->lifespan < 1) { PlaySound(this, SE_OBJ_HAMMER_HIT_BOTH); CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 242); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c(void) + this->Delete(this->_390); } PlaySound(this, SE_EMY_CHOROPU_M_SPANNER); @@ -316,7 +314,7 @@ void daWrench::executeState_Straight() { this->rot.z += 0x1000; } - UpdateObjectPosBasedOnSpeedValues_real(this); + this->UpdateObjectPosBasedOnSpeedValuesReal(); PlaySound(this, SE_EMY_CHOROPU_M_SPANNER); @@ -327,7 +325,8 @@ void daWrench::executeState_Straight() { PlaySound(this, SE_OBJ_HAMMER_HIT_BOTH); CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){0.75, 0.75, 0.75}, 242); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c(void) + this->Delete(this->_390); } this->lifespan -= 1; diff --git a/src/fakeStarCoin.cpp b/src/fakeStarCoin.cpp index 8248b1c..5160545 100644 --- a/src/fakeStarCoin.cpp +++ b/src/fakeStarCoin.cpp @@ -44,7 +44,8 @@ void daFakeStarCoin::playerCollision(ActivePhysics *apThis, ActivePhysics *apOth PlaySound(this, SE_EMY_CS_TERESA_BEAT_YOU); CreateEffect(377, &this->pos); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) + this->Delete(this->_390); } void daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther) { @@ -53,7 +54,8 @@ void daFakeStarCoin::collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, A PlaySound(this, SE_OBJ_EMY_FIRE_DISAPP); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) + this->Delete(this->_390); } bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.5, 1.5, 1.5}, 44); @@ -62,7 +64,8 @@ bool daFakeStarCoin::collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, Ac PlaySound(this, SE_OBJ_PNGN_ICE_BREAK); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) + this->Delete(this->_390); return false; } void daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther) { @@ -71,7 +74,8 @@ void daFakeStarCoin::collisionCat9_RollingObject(ActivePhysics *apThis, ActivePh PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) + this->Delete(this->_390); } void daFakeStarCoin::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 48); @@ -79,7 +83,8 @@ void daFakeStarCoin::collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics PlaySound(this, SE_BOSS_JR_FLOOR_BREAK); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) + this->Delete(this->_390); } void daFakeStarCoin::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther) { CreateEffect(&this->pos, &(S16Vec){0,0,0}, &(Vec){1.0, 1.0, 1.0}, 336); @@ -87,7 +92,8 @@ void daFakeStarCoin::collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysi PlaySound(this, SE_OBJ_EMY_FIRE_DISAPP); - this->Delete(); + //FIXME changed to dStageActor_c::Delete(u8) from fBase_c::Delete(void) + this->Delete(this->_390); } diff --git a/src/mrsun.cpp b/src/mrsun.cpp index 8fb4524..a93c06f 100755 --- a/src/mrsun.cpp +++ b/src/mrsun.cpp @@ -68,9 +68,6 @@ daMrSun_c *daMrSun_c::build() { } -extern "C" void *HandleXSpeed(daMrSun_c *); -extern "C" void *HandleYSpeed(daMrSun_c *); -extern "C" void *UpdateObjectPosBasedOnSpeedValues_real(daMrSun_c *); extern "C" u32 GenerateRandomNumber(int max); extern "C" u8 dSprite_c__getXDirectionOfFurthestPlayerRelativeToVEC3(daMrSun_c *, Vec pos); extern "C" dStageActor_c *CreateActor(u16 classID, int settings, Vec pos, char rot, char layer); @@ -364,16 +361,16 @@ void daMrSun_c::executeState_Follow() { if (this->speed.x > 6.0) { this->speed.x = this->speed.x - (speedDelta); } } - HandleXSpeed(this); + this->HandleXSpeed(); float yDiff; yDiff = (this->Baseline - this->pos.y) / 8; this->speed.y = yDiff; - HandleYSpeed(this); + this->HandleYSpeed(); - UpdateObjectPosBasedOnSpeedValues_real(this); + this->UpdateObjectPosBasedOnSpeedValuesReal(); this->timer = this->timer + 1; } @@ -575,8 +572,8 @@ void daMrSun_c::executeState_Spin() { if (this->speed.x > 80.0) { this->speed.x = this->speed.x - (0.2 * 2); } } - HandleXSpeed(this); - UpdateObjectPosBasedOnSpeedValues_real(this); + this->HandleXSpeed(); + this->UpdateObjectPosBasedOnSpeedValuesReal(); this->timer = this->timer + 1; diff --git a/src/spritespawner.cpp b/src/spritespawner.cpp index 5335dfe..32462d5 100755 --- a/src/spritespawner.cpp +++ b/src/spritespawner.cpp @@ -95,7 +95,8 @@ void SpriteSpawner_Update(SpriteSpawner *self) { self->x = spawned->pos.x; self->y = spawned->pos.y; self->z = spawned->pos.z; - spawned->Delete(); + //FIXME changed to add dStageActor_c's Delete(u8) instead of fBase_c's Delete(void) + spawned->Delete(spawned->_390); } self->createdActor = 0; } diff --git a/src/spriteswapper.cpp b/src/spriteswapper.cpp index 4929e7c..a158efc 100755 --- a/src/spriteswapper.cpp +++ b/src/spriteswapper.cpp @@ -105,7 +105,8 @@ void SpriteSwapper_CopyAndDestroy(SpriteSwapper *self) { self->direction = spawned->direction; self->speed = spawned->speed; self->rot = spawned->rot; - spawned->Delete(); + //FIXME changed from fBase_c::Delete(void) to dStageActor_c::Delete(u8) + spawned->Delete(spawned->_390); self->spawnedActor = 0; OSReport("Now it's deleted."); |