From 54cbbfb69c8a9562d89f05967ae38011327e8da0 Mon Sep 17 00:00:00 2001 From: Treeki Date: Sun, 10 Jul 2011 05:07:53 +0200 Subject: initial not completely finished version of daEnTestBlock_c --- include/game.h | 543 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 531 insertions(+), 12 deletions(-) (limited to 'include') diff --git a/include/game.h b/include/game.h index 7c8b4e2..4927345 100755 --- a/include/game.h +++ b/include/game.h @@ -802,6 +802,178 @@ namespace EGG { } +class TileRenderer { +public: + TileRenderer(); + ~TileRenderer(); + + TileRenderer *list1, *list2; + u16 tileNumber; + u8 unkFlag, someBool; + float x, y, z; + float scale; + s16 rotation; + u8 unkByte; + + u16 getTileNum(); + bool getSomeBool(); + void setSomeBool(u8 value); + + float getX(); + float getY(); + float getZ(); + void setPosition(float x, float y); + void setPosition(float x, float y, float z); + + u8 getUnkFlag(); + + void setVars(float scale); // sets unkFlag=1, rotation=0, unkByte=0 + void setVars(float scale, s16 rotation); // sets unkFlag=2, unkByte=0 + + float getScale(); + float getRotationFloat(); + s16 getRotation(); + + u8 getUnkByte(); + + class List { + public: + u32 count; + TileRenderer *first, *last; // order? + + void add(TileRenderer *r); + void remove(TileRenderer *r); + void removeAll(); + + List(); + ~List(); + }; +}; + +class dActor_c; // forward declaration + +class Physics { +public: + struct Unknown { + Unknown(); + ~Unknown(); + + float x, y; + }; + + struct Info { + float x1, y1, x2, y2; // Might be distance to center/edge like APhysics + void *otherCallback1, *otherCallback2, *otherCallback3; + }; + + Physics(); + ~Physics(); + + dActor_c *owner; + Physics *next, *prev; + u32 _C, _10, _14, _18, _1C, _20, _24, _28, _2C, _30, _34, _38, _3C; + void *otherCallback1, *otherCallback2, *otherCallback3; + void *callback1, *callback2, *callback3; + float lastX, lastY; + Unknown unkArray[4]; + float x, y; + float _88, _8C, _90; + Vec lastActorPosition; + float _A0, _A4, last_A0, last_A4, _B0, _B4; + u32 _B8; + s16 *ptrToRotationShort; + s16 currentRotation; + s16 rotDiff; + s16 rotDiffAlt; + u32 isRound; + u32 _CC; + u32 flagsMaybe; + u32 _D4, _D8; + u8 isAddedToList, _DD, layer; + u32 id; + + void addToList(); + void removeFromList(); + + void baseSetup(dActor_c *actor, u32 t_40, u32 t_44, u32 t_48, u8 t_DD, u8 layer); + + // note: Scale can be a null pointer (in that case, it'll use 1.0) + void setup(dActor_c *actor, + float x1, float y1, float x2, float y2, + void *otherCB1, void *otherCB2, void *otherCB3, + u8 t_DD, u8 layer, Vec2 *scale = 0); + + void setup(dActor_c *actor, + Vec2 *p1, Vec2 *p2, + void *otherCB1, void *otherCB2, void *otherCB3, + u8 t_DD, u8 layer, Vec2 *scale = 0); + + void setup(dActor_c *actor, Info *pInfo, u8 t_DD, u8 layer, Vec2 *scale = 0); + + // radius might be diameter? dunno + void setupRound(dActor_c *actor, + float x, float y, float radius, + void *otherCB1, void *otherCB2, void *otherCB3, + u8 t_DD, u8 layer); + + void setRect(float x1, float y1, float x2, float y2, Vec2 *scale = 0); + void setRect(Vec2 *p1, Vec2 *p2, Vec2 *scale = 0); + + void setX(float value); + void setY(float value); + void setWidth(float value); + void setHeight(float value); + + void setPtrToRotation(s16 *ptr); + + void update(); + + // todo: more stuff that might not be relevant atm +}; + + +class ActivePhysics { +public: + struct Info; // forward declaration + typedef void (*Callback)(Info *self, Info *other); + + struct Info { + float xDistToCenter; + float yDistToCenter; + float xDistToEdge; + float yDistToEdge; + u8 category1; + u8 category2; + u32 bitfield1; + u32 bitfield2; + u16 unkShort1C; + Callback callback; + }; + + ActivePhysics(); + virtual ~ActivePhysics(); + + dActor_c *owner; // should be dStageActor? dunno + u32 _8; + u32 _C; + ActivePhysics *listPrev, *listNext; + u32 _18; + Info info; + u32 _40, _44, _48, _4C; + float firstFloatArray[8]; + float secondFloatArray[8]; + Vec2 positionOfLastCollision; + u16 result1; + u16 result2; + u16 result3; + u8 collisionCheckType; + u8 chainlinkMode; + u8 layer; + u8 someFlagByte; + u8 isLinkedIntoList; +}; + + struct LinkListEntry { @@ -875,19 +1047,19 @@ public: virtual int onCreate(); virtual int beforeCreate(); - virtual int afterCreate(); + virtual int afterCreate(int); virtual int onDelete(); virtual int beforeDelete(); - virtual int afterDelete(); + virtual int afterDelete(int); virtual int onExecute(); virtual int beforeExecute(); - virtual int afterExecute(); + virtual int afterExecute(int); virtual int onDraw(); virtual int beforeDraw(); - virtual int afterDraw(); + virtual int afterDraw(int); virtual void willBeDeleted(); @@ -915,13 +1087,13 @@ public: dBase_c(); int beforeCreate(); - int afterCreate(); + int afterCreate(int); int beforeDelete(); - int afterDelete(); + int afterDelete(int); int beforeExecute(); - int afterExecute(); + int afterExecute(int); int beforeDraw(); - int afterDraw(); + int afterDraw(int); ~dBase_c(); @@ -935,13 +1107,13 @@ public: dScene_c(); int beforeCreate(); - int afterCreate(); + int afterCreate(int); int beforeDelete(); - int afterDelete(); + int afterDelete(int); int beforeExecute(); - int afterExecute(); + int afterExecute(int); int beforeDraw(); - int afterDraw(); + int afterDraw(int); ~dScene_c(); @@ -982,6 +1154,353 @@ public: ~dActor_c(); }; +class dStageActor_c : public dActor_c { +public: + u8 _125; + u32 _128, _12C, _130, _134, _138, _13C; + float _140; + u32 _144; + ActivePhysics aPhysics; + u8 classAt1EC[236]; + u32 _2D8; + u8 classAt2DC[0x34]; + u32 _310, _314; + float _318, _31C, _320, _324, _328, _32C, _330, _334, _338, _33C, _340, _344; + u8 direction; + u8 currentZoneID; + u8 _34A, _34B; + u32 _350, _354, _358, _35C, _360; + u8 _364, _365, _366, _367; + u32 _368; + u8 _36C, _36D; + Vec somethingRelatedToScale; + u32 _37C, _380, _384, _388; + u8 _38C, _38D, enableFlag, currentLayerID; + u8 _390, _391, _392, _padding; + + dStageActor_c(); + + int beforeCreate(); + int afterCreate(int); + int beforeDelete(); + int afterDelete(int); + int beforeExecute(); + int afterExecute(int); + int beforeDraw(); + int afterDraw(int); + + const char *GetExplanationString(); + + virtual bool _vf60(); // does stuff with BG_GM + virtual void kill(); // nullsub here, defined in StageActor. probably no params + virtual int _vf68(); // params unknown. return (1) might be bool + virtual u8 *_vf6C(); // returns byte 0x38D + virtual Vec2 _vf70(); // returns Vec Actor.pos + Vec Actor.field_D0 + virtual int _vf74(); // params unknown. return (1) might be bool + virtual void _vf78(); // params unknown. nullsub + virtual void _vf7C(); // params unknown. nullsub + virtual void eatIn(); // copies Actor.scale into StageActor.somethingRelatedToScale + virtual void disableEatIn(); // params unknown. nullsub + virtual void _vf88(); // params unknown. nullsub + virtual bool _vf8C(void *other); // dAcPy_c/daPlBase_c? return (1) is probably bool. seems related to EatOut. uses vfA4 + virtual bool _vf90(dStageActor_c *other); // does something with scores + virtual void _vf94(void *other); // dAcPy_c/daPlBase_c? modifies This's position + virtual void removeMyActivePhysics(); + virtual void addMyActivePhysics(); + virtual void returnRegularScale(); // the reverse of vf80, yay + virtual void _vfA4(void *other); // AcPy/PlBase? similar to vf94 but not quite the same + virtual float _vfA8(void *other); // AcPy/PlBase? what DOES this do...? does a bit of float math + virtual void _vfAC(void *other); // copies somethingRelatedToScale into scale, then multiplies scale by vfA8's return + virtual void _vfB0(); // plays Wm_en_burst_s at actor position + virtual void _vfB4(); // params unknown. nullsub + virtual void _vfB8(); // params unknown. nullsub + virtual void _vfBC(); // params unknown. nullsub + virtual void _vfC0(); // params unknown. nullsub + virtual void _vfC4(); // params unknown. nullsub + virtual void _vfC8(Vec2 *p); // does stuff including effects and playing PLAYER_SE_OBJ/GROUP_BOOT/SE_OBJ_CMN_SPLASH + virtual void _vfCC(Vec2 *p); // mostly same as vfC8, but uses PLAYER_SE_OBJ/GROUP_BOOT/SE_OBJ_CMN_SPLASH_LAVA + 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 + + ~dStageActor_c(); + + + static void create(Actors type, u32 settings, Vec *pos, S16Vec *rot, u8 layer); + static void createChild(Actors type, u32 settings, Vec *pos, S16Vec *rot, u8 layer); +}; + + +/* TODO +class dActorState_c : public dStageActor_c { +public: + ~dActorState_c(); + + virtual void _vfD4(); + virtual void _vfD8(); + virtual void _vfDC(); +}; +*/ + + +class dActorMultiState_c : public dStageActor_c { +public: + ~dActorMultiState_c(); + + // fuck all of this. I'll just use a data blob here + // because I don't feel like reimplementing the State stuff in C++ + // right now. + + u8 stateClassesAndStuff[0x410 - 0x394]; + + virtual void doStateChange(void *state); // might return bool? overridden by dEn_c + virtual void _vfD8(); // nullsub ?? + virtual void _vfDC(); // nullsub ?? + virtual void _vfE0(); // nullsub ?? +}; + + +class dEn_c : public dActorMultiState_c { +public: + float _414, _418, _41C, _420; + void *nextState; + u32 _428, _42C; + u8 _430, _431, isDead; + u32 _434; + u16 _438; + u32 _43C; + Vec velocity1, velocity2; + u8 _458, _459, _45A, _45B, _45C, _45D, _45E; + u32 _460; + Vec initialScale; + float _470; + u32 _474, _478; + dEn_c *_47C; + u32 _480; + u8 classAt484[0x4EC - 0x484]; + u32 _4EC; + float _4F0, _4F4, _4F8; + u32 flags_4FC; + u16 counter_500, counter_502; + u16 counter_504[4]; + u16 counter_50C; + u32 _510, _514, _518; + void *_51C; + dEn_c *_520; + u32 _524, _528, _52C, _530; + + dEn_c(); + + int afterCreate(int); + int beforeExecute(int); + int afterExecute(int); + int beforeDraw(int); + + void kill(); + + void eatIn(); + void disableEatIn(); + bool _vf8C(void *other); // AcPy/PlBase? + void _vfAC(); + void _vfCC(Vec2 *p); + void _vfD0(Vec2 *p); + + void doStateChange(void *state); // might return bool, dunno + + // Now here's where the fun starts. + + virtual bool preSpriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool prePlayerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + virtual bool preYoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); + + virtual bool stageActorCollision(ActivePhysics *apThis, ActivePhysics *apOther); + + virtual void spriteCollision(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void playerCollision(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void yoshiCollision(ActivePhysics *apThis, ActivePhysics *apOther); + + // WHAT A MESS + virtual void collisionCat3_StarPower(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat5_Mario(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void _vf108(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCatD_GroundPound(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void _vf110(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat8_FencePunch(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat7_WMWaggleWater(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat7_WMWaggleWaterYoshi(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void _vf120(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCatA_PenguinMario(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat11_PipeCannon(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat9_RollingObject(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat1_Fireball_E_Explosion(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat2_IceBall_15_YoshiIce(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat13_Hammer(ActivePhysics *apThis, ActivePhysics *apOther); + virtual void collisionCat14_YoshiFire(ActivePhysics *apThis, ActivePhysics *apOther); + + virtual void _vf140(dStageActor_c *actor); + virtual void _vf144(int something); + virtual void _vf148(); // deletes actors held by Class484 and other stuff + virtual void _vf14C(); // deletes actors held by Class484 and makes an En Coin Jump + virtual u32 _vf150(); // reads some bits from a value in Class1EC + virtual void eatenByYoshiProbably(); // nullsub, params unknown + virtual void playHpdpSound1(); // plays PLAYER_SE_EMY/GROUP_BOOT/SE_EMY_DOWN_HPDP_S or _H + virtual void playEnemyDownSound1(); + virtual void playEnemyDownComboSound(void *player); // AcPy_c/daPlBase_c? + virtual void playHpdpSound2(); // plays PLAYER_SE_EMY/GROUP_BOOT/SE_EMY_DOWN_HPDP_S or _H + virtual void _vf168(); // nullsub, params unknown + + // State Functions + virtual void dieFumi_Begin(); // does something involving looping thruogh players + virtual void dieFumi_Execute(); // does movement and some other stuff + virtual void dieFumi_End(); // nullsub + virtual void dieFall_Begin(); // does something involving looping thruogh players + virtual void dieFall_Execute(); // does movement and some other stuff + virtual void dieFall_End(); // nullsub + virtual void dieBigFall_Begin(); // calls vf178 [dieFall_Begin] + virtual void dieBigFall_Execute(); // does movement and some other stuff (but less than 170 and 17C) + virtual void dieBigFall_End(); // calls vf180 [dieFall_End] + virtual void dieSmoke_Begin(); // spawns Wm_en_burst_m effect and then removeMyActivePhysics + virtual void dieSmoke_Execute(); // deletes actor with r4=1 + virtual void dieSmoke_End(); // nullsub + virtual void dieYoshiFumi_Begin(); // spawns Wm_mr_yoshistep effect and then removeMyActivePhysics + virtual void dieYoshiFumi_Execute(); // deletes actor with r4=1 + virtual void dieYoshiFumi_End(); // nullsub + virtual void dieIceVanish_Begin(); // lots of weird stuff + virtual void dieIceVanish_Execute(); // deletes actor with r4=1 + virtual void dieIceVanish_End(); // nullsub + virtual void dieGoal_Begin(); // nullsub + virtual void dieGoal_Execute(); // nullsub + virtual void dieGoal_End(); // nullsub + virtual void dieOther_Begin(); // deletes actor with r4=1 + virtual void dieOther_Execute(); // nullsub + virtual void dieOther_End(); // nullsub + virtual void eatIn_Begin(); // nullsub + virtual void eatIn_Execute(); // changes to EatNow on one condition, otherwise calls vfAC + virtual void eatIn_End(); // nullsub + virtual void eatNow_Begin(); // nullsub + virtual void eatNow_Execute(); // nullsub + virtual void eatNow_End(); // nullsub + virtual void eatOut_Begin(); // nullsub + virtual void eatOut_Execute(); // nullsub + virtual void eatOut_End(); // nullsub + virtual void hitSpin_Begin(); // nullsub + virtual void hitSpin_Execute(); // nullsub + virtual void hitSpin_End(); // nullsub + virtual void ice_Begin(); // does stuff with Class484 and lots of vf's + virtual void ice_Execute(); // tons of stuff with Class484 + virtual void ice_End(); // sets a field in Class484 to 0 + + virtual void spawnHitEffectAtPosition(Vec2 pos); + virtual void doSomethingWithHardHitAndSoftHitEffects(Vec pos); + virtual void playEnemyDownSound2(); + virtual void add2ToYSpeed(); + virtual bool _vf218(); // stuff with floats and camera + virtual void _vf21C(); // does stuff with the speeds + virtual void _vf220(void *other); // some type of actor, PlBase? calls vf3F4 on other with r4=this, r5=0 + virtual void _vf224(); // stores a couple of values into the struct at 464 + virtual void _vf228(); // more fun stuff with 464 and floats + virtual bool _vf22C(); // does stuff involving ICE_ACTORs and arrays + virtual void _vf230(); // "relatedToPlayerOrYoshiCollision" apparently. nullsub, params unknown for now. + virtual void _vf234(); // nullsub, params unknown + virtual void _vf238(); // calls vf34 on class394, params unknown + virtual void _vf23C(); // nullsub, params unknown + virtual void _vf240(); // nullsub, params unknown + virtual int _vf244(); // returns 0. might be bool. params unknown + virtual int _vf248(int something); // does some math involving field510 and [7,7,4,0] and param + virtual void _vf24C(void *other); // deals with something in the class involving the bahp flag + virtual void _vf250(void *other); + virtual void _vf254(void *other); + virtual void _vf258(void *other); + virtual void _vf25C(void *other); // calls vf250 + virtual void _vf260(void *other); // AcPy/PlBase? plays the SE_EMY_FUMU_%d sounds based on some value + virtual void _vf264(dStageActor_c *other); // if other is player or yoshi, do Wm_en_hit and a few other things + virtual void _vf268(void *other); // AcPy/PlBase? plays the SE_EMY_DOWN_SPIN_%d sounds based on some value + virtual void spawnHitEffectAtPositionAgain(Vec2 pos); + virtual void playMameStepSound(); // SE_EMY_MAME_STEP at actor position + virtual void _vf274(); // nullsub, params unknown + virtual void _vf278(void *other); // AcPy/PlBase? plays the SE_EMY_YOSHI_FUMU_%d sounds based on some value + virtual void _vf27C(); // nullsub, params unknown + + ~dEn_c(); +}; + + +class daEnBlockMain_c : public dEn_c { +public: + Physics physics; + float _618, _61C, _620; + u32 _624, _628, _62C; + float initialY; + float _634, _638, _63C, _640; + u32 countdown, _648, _64C; + u32 _650, _654, _658, _65C; + u16 _660; + u8 _662, _663, _664, _665, _666, _667; + u8 _668, _669, _66A, _66B, _66C, _66D, _66E, _66F; + u8 _670, _671, _672, _673; + u8 _674; + u8 _675, _676, _677, _678, _679, _67A, _67B, _67C; + u8 _67D, _67E, _67F, _680; + u32 _684; + u8 _688, isGroundPound, anotherFlag, _68B, _68C, _68D, _68E, _68F; + u32 _690; + u8 _694; + + // Regular methods + void blockInit(float initialY); + void blockUpdate(); + + virtual void calledWhenUpMoveBegins(); + virtual void calledWhenDownMoveBegins(); + + virtual void calledWhenUpMoveExecutes(); + virtual void calledWhenUpMoveDiffExecutes(); + virtual void calledWhenDownMoveExecutes(); + virtual void calledWhenDownMoveEndExecutes(); + virtual void calledWhenDownMoveDiffExecutes(); + virtual void calledWhenDownMoveDiffEndExecutes(); + + virtual void updateScale(bool movingDown); + + // State functions + virtual void upMove_Begin(); + virtual void upMove_Execute(); + virtual void upMove_End(); + virtual void downMove_Begin(); + virtual void downMove_Execute(); + virtual void downMove_End(); + virtual void downMoveEnd_Begin(); + virtual void downMoveEnd_Execute(); + virtual void downMoveEnd_End(); + virtual void upMove_Diff_Begin(); + virtual void upMove_Diff_Execute(); + virtual void upMove_Diff_End(); + virtual void downMove_Diff_Begin(); + virtual void downMove_Diff_Execute(); + virtual void downMove_Diff_End(); + virtual void downMove_DiffEnd_Begin(); + virtual void downMove_DiffEnd_Execute(); + virtual void downMove_DiffEnd_End(); + + static void *PhysicsCallback1; + static void *PhysicsCallback2; + static void *PhysicsCallback3; + static void *OPhysicsCallback1; + static void *OPhysicsCallback2; + static void *OPhysicsCallback3; + + ~daEnBlockMain_c(); +}; + + +class dBgGm_c { +public: + // TODO TODO TODO TODO TODO + static dBgGm_c *instance; + + TileRenderer::List *getTileRendererList(int index); +}; class dPlayerModelBase_c { -- cgit v1.2.3