Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions MexTK/include/fighter.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ enum CPUType
CPTP_ITEM,
};

// fighter callback priorities
// fighter callback priorities (see 8000FD48)
enum FtPri
{
FTPRI_HITLAG,
Expand All @@ -133,8 +133,8 @@ enum FtPri
FTPRI_5, // nothing
FTPRI_ENVCOLL,
FTPRI_IK,
FTPRI_ACCESSORY,
FTPRI_GFX,
FTPRI_ACCESSORY, // controls the first 3 accessory callbacks
FTPRI_GFX, // also controls accessory4 callback and the subsequent accessory jobj animation
FTPRI_10,
FTPRI_11,
FTPRI_GRABCOLL,
Expand Down Expand Up @@ -2303,7 +2303,7 @@ struct FighterData
float hitlag_mult; // 0x196c
int x1970; // 0x1970
GOBJ *item_held; // 0x1974
GOBJ *x1978; // 0x1978
GOBJ *x1978; // 0x1978, second held item (new picked up items stored here if 'item_held' already has a value)
GOBJ *bunny_hood; // 0x197c
GOBJ *lip_flower; // 0x1980
GOBJ *item_held_spec; // 0x1984, special held item
Expand Down Expand Up @@ -2431,7 +2431,7 @@ struct FighterData
u16 x2098; // 0x2098
u16 is_hide_player_indicator; // 0x209a
int x209c; // 0x209c
JOBJ *accessory; // 0x20a0
JOBJ *accessory; // 0x20a0, reset on state changes unless persist flag is set
int x20a4; // 0x20a4
void *shadow; // 0x20a8, ASSERTS @ 8037f7b8, describes multiple struct members
int x20ac; // 0x20ac
Expand Down Expand Up @@ -2493,10 +2493,10 @@ struct FighterData
void (*Phys)(GOBJ *fighter); // 0x21a4
void (*Coll)(GOBJ *fighter); // 0x21a8
void (*Cam)(GOBJ *fighter); // 0x21ac
void (*Accessory1)(GOBJ *fighter); // 0x21b0
void (*Accessory1)(GOBJ *fighter); // 0x21b0, reset after state change
void (*Accessory_Persist)(GOBJ *fighter); // 0x21b4, persists across states while the fighter is alive, death clears this ptr, so re-init on Respawn cb. phys position is copied to tonp and fighter jobj matrices are updated after this cb runs
void (*Accessory_Freeze)(GOBJ *fighter); // 0x21b8, only runs during hitlag
void (*Accessory4)(GOBJ *fighter); // 0x21bc
void (*Accessory4)(GOBJ *fighter); // 0x21bc, reset after state change
void (*OnGiveDamage)(GOBJ *fighter); // 0x21c0
void (*OnShieldHit)(GOBJ *fighter); // 0x21c4
void (*OnReflectHit)(GOBJ *fighter); // 0x21c8
Expand Down Expand Up @@ -2614,7 +2614,7 @@ struct FighterData
unsigned char x221f_3 : 1; // 0x20 - 0x221f, hides player indicator
unsigned char sleep : 1; // 0x10 - 0x221f
unsigned char ms : 1; // 0x08 - 0x221f, ms = master/slave. is 1 when the player is a slave
unsigned char x221f_6 : 1;
unsigned char x221f_6 : 1; // 0x04 - 0x221f, is in hitlag?
unsigned char x221f_7 : 1;
unsigned char x221f_8 : 1;
char can_input_multijump; // 0x2220
Expand Down
90 changes: 66 additions & 24 deletions MexTK/include/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,34 @@ enum ItemID
ITEM_BIRDOEGG = 236,
};

// item callback priorities (see 8026862C)
enum ItPri
{
ITPRI_HITLAG,
ITPRI_ANIM,
ITPRI_2,
ITPRI_3,
ITPRI_PHYS,
ITPRI_COLL,
ITPRI_6,
ITPRI_7,
ITPRI_8,
ITPRI_ACCESSORY,
ITPRI_10,
ITPRI_PLAYERCOLL,
ITPRI_GRABCOLL,
ITPRI_HITCOLL,
ITPRI_DMGAPPLY,
ITPRI_15,
ITPRI_DYNAMICS,
ITPRI_17,
ITPRI_18,
ITPRI_19,
ITPRI_20,
ITPRI_21,
ITPRI_22,
};

// ItemStateChange Flags
#define ITEMSTATE_UPDATEANIM 0x2
#define ITEMSTATE_GRAB 0x4
Expand Down Expand Up @@ -405,6 +433,25 @@ struct ItemState
void *collCallback;
};

struct ItemLogic
{
ItemState *item_states; // 0x0
void (*OnCreate)(GOBJ *item); // 0x4
void (*OnDestroy)(GOBJ *item); // 0x8
void (*OnPickup)(GOBJ *item); // 0xC
void (*OnDrop)(GOBJ *item); // 0x10
void (*OnThrow)(GOBJ *item); // 0x14
int (*OnGiveDamage)(GOBJ *item); // 0x18, returns isDestroy
int (*OnTakeDamage)(GOBJ *item); // 0x1c, returns isDestroy
void (*OnEnterAir)(GOBJ *item); // 0x20
void (*OnReflect)(GOBJ *item); // 0x24
void (*OnClank)(GOBJ *item); // 0x28
void (*OnAbsorb)(GOBJ *item); // 0x2c
int (*OnShieldBounce)(GOBJ *item); // 0x30, returns isDestroy
int (*OnShieldHit)(GOBJ *item); // 0x34, returns isDestroy
void (*OnUnkEvent)(GOBJ *item); // 0x38
};

struct SpawnItem
{
GOBJ *parent_gobj; // 0x0
Expand Down Expand Up @@ -549,34 +596,17 @@ struct ItemData
int xac; // 0xac
int xb0; // 0xb0
int xb4; // 0xb4
struct //
{ //
ItemState *item_states; // 0x0
void (*OnCreate)(GOBJ *item); // 0x4
void (*OnDestroy)(GOBJ *item); // 0x8
void (*OnPickup)(GOBJ *item); // 0xC
void (*OnDrop)(GOBJ *item); // 0x10
void (*OnThrow)(GOBJ *item); // 0x14
int (*OnGiveDamage)(GOBJ *item); // 0x18, returns isDestroy
int (*OnTakeDamage)(GOBJ *item); // 0x1c, returns isDestroy
void (*OnEnterAir)(GOBJ *item); // 0x20
void (*OnReflect)(GOBJ *item); // 0x24
void (*x28)(GOBJ *item); // 0x28
void (*x2c)(GOBJ *item); // 0x2c
int (*OnShieldBounce)(GOBJ *item); // 0x30, returns isDestroy
int (*OnShieldHit)(GOBJ *item); // 0x34, returns isDestroy
void (*x38)(GOBJ *item); // 0x38
} *it_func; // 0xb8, persistent item callbacks
ItemLogic *item_logic; // 0xb8, persistent item callbacks
ItemState *item_states; // 0xbc
int air_state; // 0xc0
itData *itData; // 0xc4
JOBJ *joint; // 0xc8
JOBJ *joint; // 0xc8, is this a JOBJDesc instead??
itCommonAttr *common_attr; // 0xcc
int xd0; // 0xd0
ItDynamicBoneset dynamics_boneset[24]; // 0xd4
int dynamics_num; // 0x374
CollData coll_data; // 0x378 -> 0x518
GOBJ *fighter_gobj; // 0x518
GOBJ *fighter_gobj; // 0x518, should be owner_gobj (as it can be an item or other type of GOBJ too)
int x51c; // 0x51c
CmSubject *camera_subject; // 0x520
int x524; // 0x524
Expand Down Expand Up @@ -714,7 +744,7 @@ struct ItemData
void (*anim)(GOBJ *item); // 0xd14
void (*phys)(GOBJ *item); // 0xd18
void (*coll)(GOBJ *item); // 0xd1c
void (*accessory)(GOBJ *item); // 0xd20
void (*accessory)(GOBJ *item); // 0xd20, reset upon item state change (only runs if is_hitlag == 0?)
void (*on_detect)(GOBJ *item); // 0xd24
void (*on_enter_hitlag)(GOBJ *item); // 0xd28, runs after applying hitlag in damage apply proc 8026a62c
void (*on_exit_hitlag)(GOBJ *item); // 0xd2c, runs after exiting hitlag in hitlag update proc 8026a200
Expand All @@ -726,7 +756,7 @@ struct ItemData
int xd40; // 0xd40
float lifetime; // 0xd44
int xd48; // 0xd48
int xd4c; // 0xd4c
int xd4c; // 0xd4c, used as ammo counter for lgun
int land_num; // 0xd50
int throw_num; // 0xd54
int xd58; // 0xd58
Expand Down Expand Up @@ -985,8 +1015,20 @@ struct ItemData

/*** static reference ***/

static itPublicData **stc_itPublicData = (R13 + -0x4978);
static ItemDesc **stc_itdesc_enemies = (R13 + -0x4968);
static ItemLogic *stc_itemlogic_common_items = (R13 + -0xea1dc); // 0x803f14c4
static ItemLogic *stc_itemlogic_pokemon_items = (R13 + -0xe92d4); // 0x803f23cc
static ItemLogic *stc_itemlogic_character_items = (R13 + -0xe85a0); // 0x803f3100
static ItemLogic *stc_itemlogic_stage_items = (R13 + -0xe6980); // 0x803f4d20

static itData **stc_itdata_stage_items = (R13 + -0x3a740); // 0x804a0f60

static itPublicData **stc_itPublicData = (R13 + -0x4978); // 0x804d6d28
static ItemDesc **stc_itdesc_enemies = (R13 + -0x4968); // 0x804d6d38

static itData **stc_itdata_common_items = (R13 + -0x497c); // 0x804d6d24
static itCommonData **stc_itCommonData = (R13 + -0x4978); // 0x804d6d28, loaded in from ItCo.dat/usd
static itData **stc_itdata_pokemon_items = (R13 + -0x4970); // 0x804d6d30
static itData **stc_itdata_character_items = (R13 + -0x4968); // 0x804d6d38

/*** Functions ***/
void Item_IndexStageItem(ItemDesc *item_desc, int index);
Expand Down
2 changes: 1 addition & 1 deletion MexTK/include/mxdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ typedef struct MexData
{
char *dat_name;
char *symbol_name;
void *particle_data_runtime; // this pointer is shifed back by (effect_idx_start * 4)!
void *particle_data_runtime; // this pointer is shifted back by (effect_idx_start * 4)!
} *files;
} *effect;
void *item;
Expand Down
1 change: 1 addition & 0 deletions MexTK/include/structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ typedef struct itPublicData itPublicData;
typedef struct ItemStateDesc ItemStateDesc;
typedef struct ItemData ItemData;
typedef struct ItemState ItemState;
typedef struct ItemLogic ItemLogic;
typedef struct SpawnItem SpawnItem;
typedef struct itData itData;
typedef struct itCommonAttr itCommonAttr;
Expand Down