Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pulled out ItemLogic struct and added static vars #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
45 changes: 25 additions & 20 deletions MexTK/include/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,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,24 +568,7 @@ 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
Expand Down Expand Up @@ -981,8 +983,11 @@ struct ItemData

/*** static reference ***/

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

/*** Functions ***/
void Item_IndexStageItem(ItemDesc *item_desc, int index);
Expand Down
2 changes: 1 addition & 1 deletion MexTK/include/mex.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,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