Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Beast data type
- union Word
- {
- unsigned char byte[4];
- unsigned short halfword[2];
- unsigned int word;
- signed char sbyte[4];
- signed short shalfword[2];
- signed int sword;
- float single;
- void * pointer;
- };
- //Globals
- #define MAIN_CHAR_DATA_PTR ((void *) 0x801C84A0) //Purpose unknown
- #define AUX_CHAR_DATA_PTR ((void *) 0x801DA300) //Purpose unknown
- #define PSFE_ROUTINE_PTR 0x80022FD0
- #define DEATH_FLASH_ROUTINE_PTR 0x80025B4C
- #define HIGHLIGHT_ROUTINE_PTR 0x80027090
- #define DEAL_DAMAGE_ROUTINE_PTR 0x80028390
- #define UDQ_ROUTINE_PTR 0x800503DC
- #define SFE_G_SKULLTULA_HIT 0x0000386B
- #define SFE_G_SKULLTULA_KILLED 0x00003885
- //Limit notes
- #define MAX_CHAR_OBJS 0x????????
- #define CHAR_OBJ_SIZE 0x000001F0
- //Character labels
- //Structure definitions
- class charObj
- {
- public:
- Word data[CHAR_OBJ_SIZE>>2];
- //Character struct labels
- #define INTERACTION_FLAGS_1 data[0x000>>2].byte[0]
- #define INTERACTION_FLAGS_2 data[0x000>>2].byte[1]
- #define INTERACTION_FLAGS_3 data[0x000>>2].byte[2]
- #define INTERACTION_FLAGS_4 data[0x000>>2].byte[3]
- #define UNK_WORD_1 data[0x004>>2].word
- #define X_POSITION data[0x038>>2].single
- #define Z_POSITION data[0x03C>>2].single
- #define Y_POSITION data[0x040>>2].single
- #define X_SCALE data[0x050>>2].single
- #define Z_SCALE data[0x054>>2].single
- #define Y_SCALE data[0x058>>2].single
- #define DAMAGE_TABLE_PTR data[0x098>>2].pointer
- #define WEIGHT data[0x0AC>>2].byte[2]
- #define HEALTH data[0x0AC>>2].byte[3]
- #define DAMAGE_QUEUE data[0x0B0>>2].byte[0]
- #define ANGLE_FACING data[0x0B4>>2].word
- #define ANGLE_FACING_LO data[0x0B4>>2].shalfword[1]
- #define DAMAGE_ROUTINE_PTR data[0x130>>2].pointer
- #define MOVEMENT_DATA_PTR data[0x144>>2].pointer
- //Character methods
- inline void updateDamageQueue()
- {
- (
- (
- void (*)
- (
- void * mainCharDataPtr,
- void * auxCharDataPtr,
- void * mainCharObjRefPtr,
- void * auxCharObjRefPtr
- )
- )
- UDQ_ROUTINE_PTR
- )
- (
- MAIN_CHAR_DATA_PTR,
- AUX_CHAR_DATA_PTR,
- (void *) ((int) this + 0x294),
- (void *) ((int) this + 0x2B4)
- );
- }
- inline void highlightChar()
- {
- (
- (
- void (*)
- (
- charObj * charObjPtr,
- unsigned short hue,
- unsigned short duration,
- unsigned short unkInt
- )
- )
- HIGHLIGHT_ROUTINE_PTR
- )
- (
- this,
- 0x4000,
- 0x00C8,
- 0x0000
- );
- }
- inline void playSoundEffect(unsigned short SFEToPlay)
- {
- (
- (
- void (*)
- (
- charObj * charObjPtr,
- unsigned short SFEID
- )
- )
- PSFE_ROUTINE_PTR
- )
- (
- this,
- SFEToPlay
- );
- }
- inline void deathFlash()
- {
- (
- (
- void (*)
- (
- void * mainCharDataPtr,
- charObj * charObjPtr
- )
- )
- DEATH_FLASH_ROUTINE_PTR
- )
- (
- MAIN_CHAR_DATA_PTR,
- this
- );
- }
- inline void dealDamage()
- {
- (
- (
- void (*)
- (
- charObj * charObjPtr
- )
- )
- DEAL_DAMAGE_ROUTINE_PTR
- )
- (
- this
- );
- }
- };
- class controllerInput
- {
- public:
- Word padButtons;
- //Player input defintions
- #define PAD_BUTTON_A 0x00008000
- #define PAD_BUTTON_B 0x00004000
- #define PAD_TRIGGER_Z 0x00002000
- #define PAD_BUTTON_START 0x00001000
- #define PAD_BUTTON_UP 0x00000800
- #define PAD_BUTTON_DOWN 0x00000400
- #define PAD_BUTTON_LEFT 0x00000200
- #define PAD_BUTTON_RIGHT 0x00000100
- #define PAD_TRIGGER_L 0x00000020
- #define PAD_TRIGGER_R 0x00000010
- #define PAD_C_UP 0x00000008
- #define PAD_C_DOWN 0x00000004
- #define PAD_C_LEFT 0x00000002
- #define PAD_C_RIGHT 0x00000001
- #define PAD_BUTTON_A_UPPER 0x00000080
- #define PAD_BUTTON_B_UPPER 0x00000040
- #define PAD_TRIGGER_Z_UPPER 0x00000020
- #define PAD_BUTTON_START_UPPER 0x00000010
- #define PAD_BUTTON_UP_UPPER 0x00000008
- #define PAD_BUTTON_DOWN_UPPER 0x00000004
- #define PAD_BUTTON_LEFT_UPPER 0x00000002
- #define PAD_BUTTON_RIGHT_UPPER 0x00000001
- //Player input methods
- inline bool PAD_AreButtonsHeld(unsigned short buttons)
- {
- return (padButtons.halfword[0] & buttons) == buttons;
- }
- inline bool PAD_AreUpperHeld(unsigned char buttons)
- {
- return (padButtons.byte[0] & buttons) == buttons;
- }
- inline bool PAD_AreLowerHeld(unsigned char buttons)
- {
- return (padButtons.byte[1] & buttons) == buttons;
- }
- };
- //Memory labels
- //charObj * characters = (charObj *) 0x????????;
- //controllerInput * player1Input = (controllerInput *) 0x????????;
- //Memory label corrections
- #define PLAYER_1_INPUT (* player1Input).padButtons.halfword[0]
- #define PLAYER_1_UPPER_INPUT (* player1Input).padButtons.byte[0]
- #define PLAYER_1_LOWER_INPUT (* player1Input).padButtons.byte[1]
- //Global functions
- inline void updateDamageQueue(charObj * targetChar)
- {
- (
- (
- void (*)
- (
- void * mainCharDataPtr,
- void * auxCharDataPtr,
- void * mainCharObjRefPtr,
- void * auxCharObjRefPtr
- )
- )
- UDQ_ROUTINE_PTR
- )
- (
- MAIN_CHAR_DATA_PTR,
- AUX_CHAR_DATA_PTR,
- (void *) ((int) targetChar + 0x294),
- (void *) ((int) targetChar + 0x2B4)
- );
- }
- inline void highlightChar(charObj * targetChar)
- {
- (
- (
- void (*)
- (
- charObj * charObjPtr,
- unsigned short hue,
- unsigned short duration,
- unsigned short unkInt
- )
- )
- HIGHLIGHT_ROUTINE_PTR
- )
- (
- targetChar,
- 0x4000,
- 0x00C8,
- 0x0000
- );
- }
- inline void playSoundEffect(charObj * targetChar, unsigned short SFEToPlay)
- {
- (
- (
- void (*)
- (
- charObj * charObjPtr,
- unsigned short SFEID
- )
- )
- PSFE_ROUTINE_PTR
- )
- (
- targetChar,
- SFEToPlay
- );
- }
- inline void deathFlash(charObj * targetChar)
- {
- (
- (
- void (*)
- (
- void * mainCharDataPtr,
- charObj * charObjPtr
- )
- )
- DEATH_FLASH_ROUTINE_PTR
- )
- (
- MAIN_CHAR_DATA_PTR,
- targetChar
- );
- }
- inline void dealDamage(charObj * targetChar)
- {
- (
- (
- void (*)
- (
- charObj * charObjPtr
- )
- )
- DEAL_DAMAGE_ROUTINE_PTR
- )
- (
- targetChar
- );
- }
- int main()
- {
- #define SOME_CHAR ((charObj *) 0x00000000)
- SOME_CHAR->highlightChar();
- SOME_CHAR->playSoundEffect(SFE_G_SKULLTULA_KILLED);
- SOME_CHAR->deathFlash();
- SOME_CHAR->dealDamage();
- }
RAW Paste Data