From 472c6154200162edf24d86739ab4b2aa6eb9e6ae Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 09:40:29 -0700 Subject: [PATCH 01/20] Use HSD_ASSERT where the message is the condition HSD_ASSERTMSG only exists so an assert can print text that differs from the code it checks. 46 of the 76 uses do not need that: the message either already spells the condition, or names the variable/constant the condition should have been written with. Recovered from the message strings: It_PKind_Start/_Terminate, Pl_ItemLog_Terminate, LbCardNewTaskArray_Max, LbHeapStatus_Create, INIT_ADD_PARTS_RANGE, Gr_Homerun_Parts_Max, and the locals jobj (gmregenddisp) and pointp (grzakogenerator). INIT_ADD_PARTS_RANGE also removes grhomerun's f32 gobjs_num temporary, which only existed to hold the asserted expression. .clang-format already lists HSD_ASSERT under WhitespaceSensitiveMacros, so conditions whose original spelling is not clang-format canonical (71*1024) survive stringification intact. All nine affected translation units compile to byte-identical objects. --- src/melee/gm/gmmain.c | 3 +- src/melee/gm/gmregenddisp.c | 18 ++++---- src/melee/gr/grhomerun.c | 13 +++--- src/melee/gr/grzakogenerator.c | 20 ++++----- src/melee/it/forward.h | 6 +++ src/melee/lb/forward.h | 5 +++ src/melee/lb/lbaudio_ax.c | 3 +- src/melee/lb/lbcardnew.c | 10 ++--- src/melee/lb/lbheap.c | 20 ++++----- src/melee/lb/lbheap.static.h | 8 +++- src/melee/lb/types.h | 2 +- src/melee/pl/forward.h | 5 +++ src/melee/pl/plbonuslib.c | 28 ++++++------ src/sysdolphin/baselib/bytecode.c | 74 +++++++++++++++---------------- 14 files changed, 116 insertions(+), 99 deletions(-) diff --git a/src/melee/gm/gmmain.c b/src/melee/gm/gmmain.c index 5ddf084dec..2ad0398a53 100644 --- a/src/melee/gm/gmmain.c +++ b/src/melee/gm/gmmain.c @@ -113,8 +113,7 @@ static void gmMain_8015FDA4(void) db_804D6B20 = false; } } else { - HSD_ASSERTMSG(0xD2, DbLevel == DbLKind_NoDebugRom, - "DbLevel == DbLKind_NoDebugRom"); + HSD_ASSERT(0xD2, DbLevel == DbLKind_NoDebugRom); DbLevel = 0; } } diff --git a/src/melee/gm/gmregenddisp.c b/src/melee/gm/gmregenddisp.c index 5153e93bc6..32be2a6089 100644 --- a/src/melee/gm/gmregenddisp.c +++ b/src/melee/gm/gmregenddisp.c @@ -284,7 +284,7 @@ void gm_801A9094(void) HSD_MatAnimJoint* matanim; HSD_GObj* gobj; HSD_JObj* root; - HSD_JObj* child; + HSD_JObj* jobj; PAD_STACK(0x84); gm_801A8D54(sp8C); @@ -306,14 +306,14 @@ void gm_801A9094(void) HSD_JObjSetScaleY(root, 1.8f); HSD_JObjSetScaleZ(root, 1.8f); HSD_ASSERT(0x2F5, joint); - child = HSD_JObjLoadJoint(joint); - HSD_ASSERTMSG(0x2F7, child, "jobj"); - HSD_JObjAddChild(root, child); - HSD_JObjAddAnimAll(child, NULL, matanim, NULL); - HSD_JObjReqAnimAll(child, (f32) dsp->x05); - HSD_JObjAnimAll(child); - HSD_JObjSetTranslateX(child, dsp->x08); - HSD_JObjSetTranslateZ(child, dsp->x0C); + jobj = HSD_JObjLoadJoint(joint); + HSD_ASSERT(0x2F7, jobj); + HSD_JObjAddChild(root, jobj); + HSD_JObjAddAnimAll(jobj, NULL, matanim, NULL); + HSD_JObjReqAnimAll(jobj, (f32) dsp->x05); + HSD_JObjAnimAll(jobj); + HSD_JObjSetTranslateX(jobj, dsp->x08); + HSD_JObjSetTranslateZ(jobj, dsp->x0C); HSD_JObjAddChild(root, HSD_JObjLoadJoint(bg_joint)); gm_801A85E4(root, i, sp8C[i]); } diff --git a/src/melee/gr/grhomerun.c b/src/melee/gr/grhomerun.c index b079190b75..9e286cd5c8 100644 --- a/src/melee/gr/grhomerun.c +++ b/src/melee/gr/grhomerun.c @@ -38,6 +38,9 @@ mpLib_GroundEnum ground_kind, float delta_y); +#define INIT_ADD_PARTS_RANGE (1.0F + (2400.0F / (160.0F * Ground_801C0498()))) +#define Gr_Homerun_Parts_Max 64 + f32 grHr_804D6AD8; int grHr_804D6ADC; f32 grHr_804D6AE0; @@ -207,7 +210,6 @@ void grHomeRun_8021CB20(Ground_GObj* gobj) UnkArchiveStruct* archive; HSD_CObj* cobj; s32 i; - f32 gobjs_num; Ground_801C2ED0(jobj2, gp->map_id); gp->u.homerun.gobjs = HSD_MemAlloc(0x100); @@ -236,15 +238,12 @@ void grHomeRun_8021CB20(Ground_GObj* gobj) HSD_SisLib_803A611C(1, (HSD_GObj*) gp->u.unk.xD4, 9, 0xD, 0, 1, 0, 7); HSD_SisLib_804D1124[1] = HSD_ArchiveGetPublicAddress(archive->unk0, "SIS_GrHomerunData"); - gobjs_num = 2.0F * (1.0F + (2400.0F / (160.0F * Ground_801C0498()))); - HSD_ASSERTMSG(0x1A2, gobjs_num < 64, - "INIT_ADD_PARTS_RANGE*2u.homerun.gobjs[i] = grHomeRun_8021E500(i); } - for (; i < 64; i++) { + for (; i < Gr_Homerun_Parts_Max; i++) { gp->u.homerun.gobjs[i] = NULL; } diff --git a/src/melee/gr/grzakogenerator.c b/src/melee/gr/grzakogenerator.c index c94da5dcd0..397a6972e3 100644 --- a/src/melee/gr/grzakogenerator.c +++ b/src/melee/gr/grzakogenerator.c @@ -124,27 +124,27 @@ s32 grZakoGenerator_801CA43C(grZakoGenerator_Config* config, HSD_JObj* jobj, grZakoGenerator_Data* grZakoGenerator_801CA67C(void) { - grZakoGenerator_Data* data = HSD_MemAlloc(sizeof(grZakoGenerator_Data)); + grZakoGenerator_Data* pointp = HSD_MemAlloc(sizeof(grZakoGenerator_Data)); int i; PAD_STACK(8); - HSD_ASSERTMSG(0x52, data, "pointp"); + HSD_ASSERT(0x52, pointp); for (i = 0; i < 80; i++) { - data->entries[i].x0 = i + 0x20; - data->entries[i].x2 = 0; - data->entries[i].x4 = 0; + pointp->entries[i].x0 = i + 0x20; + pointp->entries[i].x2 = 0; + pointp->entries[i].x4 = 0; } - // NOTE: this actually intializes data->sentinel + // NOTE: this actually intializes pointp->sentinel for (; i < 81; i++) { - data->entries[i].x0 = -1; - data->entries[i].x2 = 0; - data->entries[i].x4 = 0; + pointp->entries[i].x0 = -1; + pointp->entries[i].x2 = 0; + pointp->entries[i].x4 = 0; } lbl_8049F030.xA_b0 = true; lbl_8049F030.x8 = 0; - return data; + return pointp; } void grZakoGenerator_801CA8B4(int arg0) diff --git a/src/melee/it/forward.h b/src/melee/it/forward.h index 963e35768c..75f24e8c57 100644 --- a/src/melee/it/forward.h +++ b/src/melee/it/forward.h @@ -369,4 +369,10 @@ typedef enum ItemKind { It_Kind_Kyasarin_Egg, // Birdo's Egg } ItemKind; +/// Bounds of the Poke Ball Pokemon range of #ItemKind. +typedef enum It_PKind { + /* 0xA1 */ It_PKind_Start = Pokemon_Tosakinto, + /* 0xBF */ It_PKind_Terminate = Pokemon_Chicorita_Leaf, +} It_PKind; + #endif diff --git a/src/melee/lb/forward.h b/src/melee/lb/forward.h index fc114dd59c..8ca14d7ca1 100644 --- a/src/melee/lb/forward.h +++ b/src/melee/lb/forward.h @@ -109,4 +109,9 @@ typedef enum ECBSourceKind { ECBSource_Fixed, } ECBSourceKind; +/// Size of the memory card task array. +typedef enum LbCardNewTaskArray { + /* 0x0B */ LbCardNewTaskArray_Max = 11, +} LbCardNewTaskArray; + #endif diff --git a/src/melee/lb/lbaudio_ax.c b/src/melee/lb/lbaudio_ax.c index d7507ac24a..044e4d8d6b 100644 --- a/src/melee/lb/lbaudio_ax.c +++ b/src/melee/lb/lbaudio_ax.c @@ -2613,8 +2613,7 @@ void lbAudioAx_8002838C(void) AXDriver_8038E30C(0, 2, &rvbStd, (u8*) &lbl_80433B44[0x48], 0xD400); AXDriver_8038E37C(AXDRIVER_AUX_DELAY, &delay); - HSD_ASSERTMSG(0xF72, HSD_AudioGetAuxHeapSize(2, &delay) < 71 * 1024, - "HSD_AudioGetAuxHeapSize(2, &delay) < 71*1024"); + HSD_ASSERT(0xF72, HSD_AudioGetAuxHeapSize(2, &delay) < 71*1024); AXDriver_8038E30C(1, 4, &delay, (u8*) &lbl_80433B44[0x3548], 0x11C00); diff --git a/src/melee/lb/lbcardnew.c b/src/melee/lb/lbcardnew.c index 5804f63347..e410612e7c 100644 --- a/src/melee/lb/lbcardnew.c +++ b/src/melee/lb/lbcardnew.c @@ -45,20 +45,20 @@ struct CardTask* lb_80019C38(void) int i; struct CardTask* result; - for (i = 0; i < 0xB; i++) { + for (i = 0; i < LbCardNewTaskArray_Max; i++) { result = &lb_80432A68.task_array[i]; if (result->x0 == 0xE) { break; } } - HSD_ASSERTMSG(0x154, i != 0xB, "i != LbCardNewTaskArray_Max"); + HSD_ASSERT(0x154, i != LbCardNewTaskArray_Max); return result; } static void reset_task_array(void) { int i; - for (i = 0; i < 11; i++) { + for (i = 0; i < LbCardNewTaskArray_Max; i++) { lb_80432A68.task_array[i].x0 = 0xE; } } @@ -71,13 +71,13 @@ int lb_80019CB0(int result) again: i = 0; - for (i = 0; i < 11; i++) { + for (i = 0; i < LbCardNewTaskArray_Max; i++) { task = &lb_80432A68.task_array[i]; if (lb_80432A68.task_array[i].x0 != 0xE) { break; } } - if (i != 0xB) { + if (i != LbCardNewTaskArray_Max) { if (!(task->x4 & (1 << result))) { reset_task_array(); } else { diff --git a/src/melee/lb/lbheap.c b/src/melee/lb/lbheap.c index 9ba2ee0c61..6329c86582 100644 --- a/src/melee/lb/lbheap.c +++ b/src/melee/lb/lbheap.c @@ -37,7 +37,7 @@ static inline void lbHeap_ResetHeap(struct Heap* heap) heap->size = 0; heap->type = 1; heap->transient = 1; - heap->status = 1; + heap->status = LbHeapStatus_Destroy; } static inline void @@ -45,7 +45,7 @@ lbHeap_DestroyOffsetViewIfCreated(struct lbHeap_HeapOffsetView* view) { struct Heap* heap = &view->heap; - if (view->heap.status == 0) { + if (view->heap.status == LbHeapStatus_Create) { if (heap->type == 0) { OSDestroyHeap(heap->id); heap->id = -1; @@ -53,7 +53,7 @@ lbHeap_DestroyOffsetViewIfCreated(struct lbHeap_HeapOffsetView* view) lbMemory_80014EEC(heap->handle); heap->handle = (Handle*) -1; } - heap->status = 1; + heap->status = LbHeapStatus_Destroy; } } @@ -62,7 +62,7 @@ lbHeap_CreateOffsetViewIfDestroyed(struct lbHeap_HeapOffsetView* view) { struct Heap* heap = &view->heap; - if (view->heap.status == 1) { + if (view->heap.status == LbHeapStatus_Destroy) { if (heap->type == 0) { heap->id = OSCreateHeap((void*) heap->start, (void*) (heap->start + heap->size)); @@ -70,7 +70,7 @@ lbHeap_CreateOffsetViewIfDestroyed(struct lbHeap_HeapOffsetView* view) heap->handle = lbMemory_80014E24( (void*) heap->start, (void*) (heap->start + heap->size)); } - heap->status = 0; + heap->status = LbHeapStatus_Create; } } @@ -152,7 +152,7 @@ void lbHeap_80015900(void) main_heap->start = arena_lo; aram_heap = &lbHeap_80431FA0.heap_array[1]; main_heap->size = arena_hi - arena_lo; - main_heap->status = 0; + main_heap->status = LbHeapStatus_Create; main_heap->type = 0; lbMemory_800155A4(); @@ -160,7 +160,7 @@ void lbHeap_80015900(void) aram_heap->handle = lbMemory_800154D4((void*) aram_lo, (void*) aram_hi); aram_heap->start = aram_lo; aram_heap->size = aram_hi - aram_lo; - aram_heap->status = 0; + aram_heap->status = LbHeapStatus_Create; aram_heap->type = 3; for (create_i = 2, heap_offset = 0x38; create_i < 6; @@ -184,7 +184,7 @@ void* lbHeap_80015BD0(int arg0, int arg1) int enabled = OSDisableInterrupts(); struct Heap* p = &lbHeap_80431FA0.heap_array[arg0]; - if (p->status == 0) { + if (p->status == LbHeapStatus_Create) { if (p->type == 0) { int cur_heap = HSD_GetHeap(); HSD_SetHeap(p->id); @@ -208,7 +208,7 @@ void lbHeap_80015CA8(int arg0, void* arg1) int enabled = OSDisableInterrupts(); struct Heap* p = &lbHeap_80431FA0.heap_array[arg0]; - HSD_ASSERTMSG(0x143, p->status == 0, "p->status == LbHeapStatus_Create"); + HSD_ASSERT(0x143, p->status == LbHeapStatus_Create); if (p->type == 0) { int cur_heap = HSD_GetHeap(); HSD_SetHeap(p->id); @@ -251,7 +251,7 @@ void lbHeap_80015DF8(void) for (i = 0; i < 6; i++) { OSReport("%s :", lbHeap_803BA448[i]); p = &lbHeap_80431FA0.heap_array[i]; - if (p->status == 0) { + if (p->status == LbHeapStatus_Create) { if (p->type == 0) { var_r25 = OSCheckHeap(p->id); } else { diff --git a/src/melee/lb/lbheap.static.h b/src/melee/lb/lbheap.static.h index f101a8c210..096fa84deb 100644 --- a/src/melee/lb/lbheap.static.h +++ b/src/melee/lb/lbheap.static.h @@ -6,6 +6,12 @@ #include +/// @remarks @c LbHeapStatus_Create is named by an assert in #lbHeap_80015CA8. +typedef enum LbHeapStatus { + /* 0x00 */ LbHeapStatus_Create, + /* 0x01 */ LbHeapStatus_Destroy, +} LbHeapStatus; + struct Heap { /* 10 */ s32 id; /* 14 */ Handle* handle; @@ -13,7 +19,7 @@ struct Heap { /* 1C */ u32 size; /* 20 */ s32 type; /* 24 */ s32 transient; - /* 28 */ int status; + /* 28 */ LbHeapStatus status; }; STATIC_ASSERT(sizeof(struct Heap) == 0x1C); diff --git a/src/melee/lb/types.h b/src/melee/lb/types.h index 3bfe27f147..751abde2ce 100644 --- a/src/melee/lb/types.h +++ b/src/melee/lb/types.h @@ -357,7 +357,7 @@ struct lb_80432A68_t { u8 x18; char x19[7]; u8 unk20[0x1C]; - } task_array[11]; + } task_array[LbCardNewTaskArray_Max]; /* 0x8AC */ int x8AC; }; /* size = 0x8B0 */ STATIC_ASSERT(sizeof(struct lb_80432A68_t) == 0x8B0); diff --git a/src/melee/pl/forward.h b/src/melee/pl/forward.h index ff2a9e9f06..a97bd62be8 100644 --- a/src/melee/pl/forward.h +++ b/src/melee/pl/forward.h @@ -127,4 +127,9 @@ typedef enum PlATK { PlATK_AttackNormal_End = 16, } PlATK; +/// Terminator of the bonus item-log index range. +typedef enum Pl_ItemLog { + /* 0x27 */ Pl_ItemLog_Terminate = 39, +} Pl_ItemLog; + #endif diff --git a/src/melee/pl/plbonuslib.c b/src/melee/pl/plbonuslib.c index 3274c556e1..aae09d9218 100644 --- a/src/melee/pl/plbonuslib.c +++ b/src/melee/pl/plbonuslib.c @@ -478,8 +478,7 @@ void pl_8003E17C(int player_id, int arg1, u32 pl_8003E2CC(int arg0, int pl_itemlog_kind) { - HSD_ASSERTMSG(555, pl_itemlog_kind < 39, - "pl_itemlog_kind < Pl_ItemLog_Terminate"); + HSD_ASSERT(555, pl_itemlog_kind < Pl_ItemLog_Terminate); return Player_GetStaleMoveTableIndexPtr2(arg0) ->x0_staleMoveTable.x674[pl_itemlog_kind]; @@ -487,8 +486,7 @@ u32 pl_8003E2CC(int arg0, int pl_itemlog_kind) u32 pl_8003E334(int arg0, int pl_itemlog_kind) { - HSD_ASSERTMSG(564, pl_itemlog_kind < 39, - "pl_itemlog_kind < Pl_ItemLog_Terminate"); + HSD_ASSERT(564, pl_itemlog_kind < Pl_ItemLog_Terminate); return Player_GetStaleMoveTableIndexPtr2(arg0) ->x0_staleMoveTable.x710[pl_itemlog_kind]; @@ -499,9 +497,10 @@ int pl_8003E39C(int arg0) int sum = 0; int pl_itemlog_kind; - for (pl_itemlog_kind = 0; pl_itemlog_kind < 39; pl_itemlog_kind++) { - HSD_ASSERTMSG(555, pl_itemlog_kind < 39, - "pl_itemlog_kind < Pl_ItemLog_Terminate"); + for (pl_itemlog_kind = 0; pl_itemlog_kind < Pl_ItemLog_Terminate; + pl_itemlog_kind++) + { + HSD_ASSERT(555, pl_itemlog_kind < Pl_ItemLog_Terminate); sum += Player_GetStaleMoveTableIndexPtr2(arg0) ->x0_staleMoveTable.x674[pl_itemlog_kind]; @@ -515,9 +514,10 @@ u32 pl_8003E420(int arg0) int sum = 0; int pl_itemlog_kind; - for (pl_itemlog_kind = 0; pl_itemlog_kind < 39; pl_itemlog_kind++) { - HSD_ASSERTMSG(564, pl_itemlog_kind < 39, - "pl_itemlog_kind < Pl_ItemLog_Terminate"); + for (pl_itemlog_kind = 0; pl_itemlog_kind < Pl_ItemLog_Terminate; + pl_itemlog_kind++) + { + HSD_ASSERT(564, pl_itemlog_kind < Pl_ItemLog_Terminate); sum += Player_GetStaleMoveTableIndexPtr2(arg0) ->x0_staleMoveTable.x710[pl_itemlog_kind]; @@ -582,9 +582,8 @@ void pl_8003E70C(Item_GObj* igobj) HSD_GObj* temp_r30 = itGetOwner(igobj); - HSD_ASSERTMSG(634, 0xA1 <= itGetKind(igobj) && itGetKind(igobj) < 0xBF, - "It_PKind_Start <= itGetKind(igobj) && itGetKind(igobj) < " - "It_PKind_Terminate"); + HSD_ASSERT(634, It_PKind_Start <= itGetKind(igobj) && + itGetKind(igobj) < It_PKind_Terminate); RETURN_IF(!ftLib_80086960(temp_r30)); temp_r31 = Player_GetStaleMoveTableIndexPtr2(ftLib_80086BE0(temp_r30)); @@ -594,8 +593,7 @@ void pl_8003E70C(Item_GObj* igobj) u32 pl_8003E7D4(int arg0, int kind) { - HSD_ASSERTMSG(649, 0xA1 <= kind && kind < 0xBF, - "It_PKind_Start <= kind && kind < It_PKind_Terminate"); + HSD_ASSERT(649, It_PKind_Start <= kind && kind < It_PKind_Terminate); return Player_GetStaleMoveTableIndexPtr2(arg0) ->x0_staleMoveTable.total_attack_count_struct.x598[kind]; diff --git a/src/sysdolphin/baselib/bytecode.c b/src/sysdolphin/baselib/bytecode.c index 53ccc5badf..e87f2e5d45 100644 --- a/src/sysdolphin/baselib/bytecode.c +++ b/src/sysdolphin/baselib/bytecode.c @@ -219,7 +219,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) } break; case 0x28: - HSD_ASSERTMSG(467, stack, "stack"); + HSD_ASSERT(467, stack); { d0 = ((ByteCodeVal*) &stack->data)->i; if (d0 < 0) { @@ -233,12 +233,12 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) stack->data = *(void**) &fv; break; case 0x31: - HSD_ASSERTMSG(480, stack, "stack"); + HSD_ASSERT(480, stack); stack->data = (void*) !(s32) stack->data; break; case 0x17: HSD_ASSERT(501, stack); - HSD_ASSERTMSG(501, stack->next, "stack->next"); + HSD_ASSERT(501, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); fv = ((ByteCodeVal*) &stack->data)->f + f0; @@ -246,7 +246,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x18: HSD_ASSERT(507, stack); - HSD_ASSERTMSG(507, stack->next, "stack->next"); + HSD_ASSERT(507, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); fv = ((ByteCodeVal*) &stack->data)->f - f0; @@ -254,7 +254,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x19: HSD_ASSERT(513, stack); - HSD_ASSERTMSG(513, stack->next, "stack->next"); + HSD_ASSERT(513, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); fv = ((ByteCodeVal*) &stack->data)->f * f0; @@ -262,7 +262,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x1A: HSD_ASSERT(519, stack); - HSD_ASSERTMSG(519, stack->next, "stack->next"); + HSD_ASSERT(519, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); fv = ((ByteCodeVal*) &stack->data)->f / f0; @@ -270,7 +270,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x1B: HSD_ASSERT(525, stack); - HSD_ASSERTMSG(525, stack->next, "stack->next"); + HSD_ASSERT(525, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); fv = fmodf(f0, ((ByteCodeVal*) &stack->data)->f); @@ -278,7 +278,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x1C: HSD_ASSERT(531, stack); - HSD_ASSERTMSG(531, stack->next, "stack->next"); + HSD_ASSERT(531, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -286,7 +286,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x1D: HSD_ASSERT(536, stack); - HSD_ASSERTMSG(536, stack->next, "stack->next"); + HSD_ASSERT(536, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -294,7 +294,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x1E: HSD_ASSERT(541, stack); - HSD_ASSERTMSG(541, stack->next, "stack->next"); + HSD_ASSERT(541, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -302,7 +302,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x1F: HSD_ASSERT(546, stack); - HSD_ASSERTMSG(546, stack->next, "stack->next"); + HSD_ASSERT(546, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -310,7 +310,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x20: HSD_ASSERT(551, stack); - HSD_ASSERTMSG(551, stack->next, "stack->next"); + HSD_ASSERT(551, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); d0 = ((ByteCodeVal*) &stack->data)->i; @@ -318,7 +318,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x21: HSD_ASSERT(556, stack); - HSD_ASSERTMSG(556, stack->next, "stack->next"); + HSD_ASSERT(556, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); fv = powf(((ByteCodeVal*) &stack->data)->f, f0); @@ -326,7 +326,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x22: HSD_ASSERT(562, stack); - HSD_ASSERTMSG(562, stack->next, "stack->next"); + HSD_ASSERT(562, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); if (((ByteCodeVal*) &stack->data)->f > f0) { @@ -335,7 +335,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x23: HSD_ASSERT(569, stack); - HSD_ASSERTMSG(569, stack->next, "stack->next"); + HSD_ASSERT(569, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); if (((ByteCodeVal*) &stack->data)->f < f0) { @@ -344,7 +344,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x24: HSD_ASSERT(576, stack); - HSD_ASSERTMSG(576, stack->next, "stack->next"); + HSD_ASSERT(576, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); if (((ByteCodeVal*) &stack->data)->i > d1) { @@ -353,7 +353,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x25: HSD_ASSERT(583, stack); - HSD_ASSERTMSG(583, stack->next, "stack->next"); + HSD_ASSERT(583, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); if (((ByteCodeVal*) &stack->data)->i < d1) { @@ -362,7 +362,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x26: HSD_ASSERT(590, stack); - HSD_ASSERTMSG(590, stack->next, "stack->next"); + HSD_ASSERT(590, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); f1 = ((ByteCodeVal*) &stack->data)->f; @@ -375,7 +375,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x33: HSD_ASSERT(603, stack); - HSD_ASSERTMSG(603, stack->next, "stack->next"); + HSD_ASSERT(603, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); f1 = ((ByteCodeVal*) &stack->data)->f; @@ -383,7 +383,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x34: HSD_ASSERT(608, stack); - HSD_ASSERTMSG(608, stack->next, "stack->next"); + HSD_ASSERT(608, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); f1 = ((ByteCodeVal*) &stack->data)->f; @@ -391,7 +391,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x35: HSD_ASSERT(613, stack); - HSD_ASSERTMSG(613, stack->next, "stack->next"); + HSD_ASSERT(613, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -399,7 +399,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x36: HSD_ASSERT(618, stack); - HSD_ASSERTMSG(618, stack->next, "stack->next"); + HSD_ASSERT(618, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); f1 = ((ByteCodeVal*) &stack->data)->f; @@ -407,7 +407,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x37: HSD_ASSERT(623, stack); - HSD_ASSERTMSG(623, stack->next, "stack->next"); + HSD_ASSERT(623, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); f1 = ((ByteCodeVal*) &stack->data)->f; @@ -415,7 +415,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x38: HSD_ASSERT(628, stack); - HSD_ASSERTMSG(628, stack->next, "stack->next"); + HSD_ASSERT(628, stack->next); f0 = ((ByteCodeVal*) &stack->data)->f; stack = HSD_SListRemove(stack); f1 = ((ByteCodeVal*) &stack->data)->f; @@ -423,7 +423,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x29: HSD_ASSERT(633, stack); - HSD_ASSERTMSG(633, stack->next, "stack->next"); + HSD_ASSERT(633, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -431,7 +431,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x2A: HSD_ASSERT(638, stack); - HSD_ASSERTMSG(638, stack->next, "stack->next"); + HSD_ASSERT(638, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -439,7 +439,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x2B: HSD_ASSERT(643, stack); - HSD_ASSERTMSG(643, stack->next, "stack->next"); + HSD_ASSERT(643, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -447,7 +447,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x2C: HSD_ASSERT(648, stack); - HSD_ASSERTMSG(648, stack->next, "stack->next"); + HSD_ASSERT(648, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -455,7 +455,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x2D: HSD_ASSERT(653, stack); - HSD_ASSERTMSG(653, stack->next, "stack->next"); + HSD_ASSERT(653, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -463,7 +463,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x2E: HSD_ASSERT(658, stack); - HSD_ASSERTMSG(658, stack->next, "stack->next"); + HSD_ASSERT(658, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); ((ByteCodeVal*) &stack->data)->i = @@ -471,7 +471,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x2F: HSD_ASSERT(663, stack); - HSD_ASSERTMSG(663, stack->next, "stack->next"); + HSD_ASSERT(663, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); d0 = ((ByteCodeVal*) &stack->data)->i; @@ -485,7 +485,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x30: HSD_ASSERT(668, stack); - HSD_ASSERTMSG(668, stack->next, "stack->next"); + HSD_ASSERT(668, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); d0 = ((ByteCodeVal*) &stack->data)->i; @@ -499,7 +499,7 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x32: HSD_ASSERT(673, stack); - HSD_ASSERTMSG(673, stack->next, "stack->next"); + HSD_ASSERT(673, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); d0 = ((ByteCodeVal*) &stack->data)->i; @@ -508,28 +508,28 @@ float HSD_ByteCodeEval(u8* bytecode, f32* args, s32 nb_args) break; case 0x39: HSD_ASSERT(678, stack); - HSD_ASSERTMSG(678, stack->next, "stack->next"); + HSD_ASSERT(678, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); stack->data = (void*) (((ByteCodeVal*) &stack->data)->i & d1); break; case 0x3A: HSD_ASSERT(683, stack); - HSD_ASSERTMSG(683, stack->next, "stack->next"); + HSD_ASSERT(683, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); stack->data = (void*) (((ByteCodeVal*) &stack->data)->i | d1); break; case 0x3B: HSD_ASSERT(688, stack); - HSD_ASSERTMSG(688, stack->next, "stack->next"); + HSD_ASSERT(688, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); stack->data = (void*) (((ByteCodeVal*) &stack->data)->i ^ d1); break; case 0x27: HSD_ASSERT(694, stack); - HSD_ASSERTMSG(694, stack->next, "stack->next"); + HSD_ASSERT(694, stack->next); d1 = ((ByteCodeVal*) &stack->data)->i; stack = HSD_SListRemove(stack); d0 = ((ByteCodeVal*) &stack->data)->i; From 55f961c1598f4f54e757ef2ed3350344f1a84f04 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 09:52:25 -0700 Subject: [PATCH 02/20] Replace raw __assert calls with the HSD assert macros Fifteen sites across nine files. Several carried a todo saying no byte-matching macro form was known; the plain forms do match, and the only object delta is anonymous literal-pool renumbering. HSD_ASSERT(line, 0) after a separate OSReport reproduces every 'OSReport then __assert(..., "0")' pair (grkongo, grmutecity, lbaudio_ax, toy, gmtoulib). HSD_ASSERTREPORT reproduces the pairs whose assert text is a real condition (plbonuslib, lbfile). In plbonuslib this removes the var_r0 flag m2c emitted for the ternary, and recovers Gm_Player_NumMax, which a todo in that file already suspected. lbfile.c stores its file name in an array rather than emitting a fresh __FILE__ literal, so it respells both macros around that array, following the existing mnvibration.c precedent. func_800163D8_inline then becomes dead: the wrapper only existed to supply the inline layer HSD_ASSERTREPORT provides. Not converted: stage.c 360, whose fake zero-byte padding sets where the next .data object lands, and mnhyaku 360, where HSD_ASSERTREPORT bills 8 more bytes into the frame of the function that inlines allocMenu. All nine translation units keep identical section contents. --- src/melee/ft/ftchangeparam.c | 6 ++---- src/melee/gm/forward.h | 5 +++++ src/melee/gm/gmtoulib.c | 4 ++-- src/melee/gr/grkongo.c | 3 ++- src/melee/gr/grmutecity.c | 10 ++-------- src/melee/lb/lbaudio_ax.c | 2 +- src/melee/lb/lbfile.c | 38 ++++++++++++++++++------------------ src/melee/pl/plbonuslib.c | 16 +++------------ src/melee/ty/toy.c | 12 ++++++------ src/sysdolphin/baselib/id.c | 5 +---- 10 files changed, 43 insertions(+), 58 deletions(-) diff --git a/src/melee/ft/ftchangeparam.c b/src/melee/ft/ftchangeparam.c index 84767f543e..2b97fbcc31 100644 --- a/src/melee/ft/ftchangeparam.c +++ b/src/melee/ft/ftchangeparam.c @@ -2,15 +2,13 @@ #include "placeholder.h" +#include #include #include float ftCo_CalcYScaledKnockback(float arg0, float scale, float arg2) { - /// @todo Convert to @c HSD_ASSERT once a byte-matching form is found. - if (scale == 0.0F) { - __assert("ftchangeparam.c", 0x1E, "scale != 0.0F"); - } + HSD_ASSERT(0x1E, scale != 0.0F); if (arg2 == 0.0F) { return arg0; } diff --git a/src/melee/gm/forward.h b/src/melee/gm/forward.h index 89a52feabc..b12761b404 100644 --- a/src/melee/gm/forward.h +++ b/src/melee/gm/forward.h @@ -167,4 +167,9 @@ typedef struct VsApproachData VsApproachData; typedef bool (*GmRouteCallback)(int); +/// Number of player slots. +typedef enum Gm_Player { + /* 0x06 */ Gm_Player_NumMax = 6, +} Gm_Player; + #endif diff --git a/src/melee/gm/gmtoulib.c b/src/melee/gm/gmtoulib.c index 422eb16c92..dc9fc4153d 100644 --- a/src/melee/gm/gmtoulib.c +++ b/src/melee/gm/gmtoulib.c @@ -11,6 +11,7 @@ #include +#include "baselib/debug.h" #include "baselib/fog.h" #include "baselib/gobjgxlink.h" #include "baselib/gobjobject.h" @@ -2054,8 +2055,7 @@ int fn_8018F4A0(void) printf("This is impossible stage num from mnSelStageRandom() -> stage " "%d \n", temp_r3); - /// @todo No byte-matching HSD assert macro form. - __assert("gmtoulib.c", 0x53D, "0"); + HSD_ASSERT(0x53D, 0); } return temp_r3; } diff --git a/src/melee/gr/grkongo.c b/src/melee/gr/grkongo.c index b08f42fdac..e15a52cf9f 100644 --- a/src/melee/gr/grkongo.c +++ b/src/melee/gr/grkongo.c @@ -28,6 +28,7 @@ #include "MSL/math.h" #include +#include #include #include #include @@ -332,7 +333,7 @@ void grKongo_801D577C(Ground_GObj* arg0) } else if (angular_vel < 0.0f) { angle_delta = gp->u.kongo3.xD8 - gp->u.kongo3.xD4; } else { - __assert(__FILE__, 505, "0"); + HSD_ASSERT(505, 0); } if (angle_delta < 0.0f) { angle_delta += M_TAU; diff --git a/src/melee/gr/grmutecity.c b/src/melee/gr/grmutecity.c index d3a9739bc3..016951c322 100644 --- a/src/melee/gr/grmutecity.c +++ b/src/melee/gr/grmutecity.c @@ -448,20 +448,14 @@ void grMuteCity_801EFDF8(Ground_GObj* gobj) gp->u.mutecity.xDC = Ground_801C3FA4(gobj, 5); gp->u.mutecity.xE0 = Ground_801C3FA4(gobj, 9); - /// @todo ::HSD_ASSERTREPORT - // HSD_ASSERTREPORT(351, gp->u.mutecity.xE0->u.spline != NULL, - // "not found car spline (R)\n"); if (gp->u.mutecity.xE0->u.spline == NULL) { OSReport("not found car spline (R)\n"); - __assert(__FILE__, 351, "0"); + HSD_ASSERT(351, 0); } - /// @todo ::HSD_ASSERTREPORT - // HSD_ASSERTREPORT(355, gp->u.mutecity.xDC->u.spline != NULL, - // "not found car spline (L)\n"); if (gp->u.mutecity.xDC->u.spline == NULL) { OSReport("not found car spline (L)\n"); - __assert(__FILE__, 355, "0"); + HSD_ASSERT(355, 0); } gp->u.mutecity.xD0_flags.b23 = 2; diff --git a/src/melee/lb/lbaudio_ax.c b/src/melee/lb/lbaudio_ax.c index 044e4d8d6b..0db1b7700d 100644 --- a/src/melee/lb/lbaudio_ax.c +++ b/src/melee/lb/lbaudio_ax.c @@ -2282,7 +2282,7 @@ void lbAudioAx_80027168(void) if (lbl_804D6438 < lbl_804D6448 + lbl_804D6450) { OSReport("******** CAUTION ********\nFGM load size is over\n"); - __assert(__FILE__, 0xDB3, "0"); + HSD_ASSERT(0xDB3, 0); } slot = fn_80026650_noinline(); diff --git a/src/melee/lb/lbfile.c b/src/melee/lb/lbfile.c index 9d8f45b302..753a548bb1 100644 --- a/src/melee/lb/lbfile.c +++ b/src/melee/lb/lbfile.c @@ -14,13 +14,22 @@ static char lbFile_803BA508[] = __FILE__; +/// This file passes its stored file name rather than a fresh @c __FILE__ +/// literal, so both assert macros are respelled around that array. +#undef HSD_ASSERT +#define HSD_ASSERT(line, cond) \ + ((cond) ? ((void) 0) : __assert(lbFile_803BA508, line, #cond)) +#undef HSD_ASSERTREPORT +#define HSD_ASSERTREPORT(line, cond, ...) \ + ((cond) \ + ? (void) 0 \ + : (OSReport(__VA_ARGS__), __assert(lbFile_803BA508, line, #cond))) + static bool cancel; void lbFile_8001615C(int r3, int r4, void* r5, bool cancelflag) { - if (cancelflag) { - __assert(lbFile_803BA508, 71, "!cancelflag"); - } + HSD_ASSERT(71, !cancelflag); cancel = true; } @@ -58,7 +67,7 @@ char* lbFile_80016204(const char* basename) // no room for file extension? if (pos > MAX_BASENAME_LENGTH) { OSReport("Error : file name too long %s.", basename); - __assert(lbFile_803BA508, 0x99, "NULL"); + HSD_ASSERT(0x99, NULL); } lbFile_80432058[pos++] = cur++[0]; } @@ -110,7 +119,7 @@ size_t lbFile_8001634C(s32 fileno) if (!DVDFastOpen(fileno, (DVDFileInfo*) &info)) { OSReport("Cannot open file no=%d.", fileno); - __assert(lbFile_803BA508, 0xD8, "0"); + HSD_ASSERT(0xD8, 0); } length = info.length; @@ -124,10 +133,8 @@ s32 lbFile_800163D8(const char* basename) s32 entry_num; char* filename = lbFile_80016204(basename); entry_num = DVDConvertPathToEntrynum(filename); - if (entry_num == -1) { - OSReport("file isn't exist %s = %d\n", filename, entry_num); - __assert(lbFile_803BA508, 0xEE, "entry_num != -1"); - } + HSD_ASSERTREPORT(0xEE, entry_num != -1, "file isn't exist %s = %d\n", + filename, entry_num); return lbFile_8001634C(entry_num); } @@ -150,10 +157,8 @@ void lbFile_80016580(const char* basename, u32 src, u32* dest, s32 entry_num = DVDConvertPathToEntrynum(filename); PAD_STACK(4); - if (entry_num == -1) { - OSReport("file isn't exist %s = %d\n", filename, entry_num); - __assert(lbFile_803BA508, 0x11A, "entry_num != -1"); - } + HSD_ASSERTREPORT(0x11A, entry_num != -1, "file isn't exist %s = %d\n", + filename, entry_num); lbFile_800164A4(entry_num, src, dest, 1, callback, args); } @@ -183,15 +188,10 @@ void lbFile_80016760(const char* basename, u32* src, u32* dest) qwer(0, basename, src, dest); } -inline u32 func_800163D8_inline(const char* basename) -{ - return lbFile_800163D8(basename); -} - bool lbFile_800168A0(s32 arg0, const char* basename, u32* src, u32* dest) { if ((*src = (u32) lbDvd_8001819C(basename))) { - *dest = func_800163D8_inline(basename); + *dest = lbFile_800163D8(basename); return true; } else { cancel = false; diff --git a/src/melee/pl/plbonuslib.c b/src/melee/pl/plbonuslib.c index aae09d9218..fa4164b044 100644 --- a/src/melee/pl/plbonuslib.c +++ b/src/melee/pl/plbonuslib.c @@ -1382,21 +1382,11 @@ void pl_80040460(int slot, int arg1) void pl_8004049C(int player, ItemKind arg1) { int var_r30 = -1; - s32 var_r0; - RETURN_IF(player == 6); + RETURN_IF(player == Gm_Player_NumMax); - var_r0 = 0; - if ((player >= 0) && (player < 6)) { - var_r0 = 1; - } - if (var_r0 == 0) { - OSReport("zako ko player illegal ! :%d\n", player); - /// @todo Convert to @c HSD_ASSERT once a byte-matching form is - /// found. - __assert("plbonuslib.c", 1559, - "0 <= player && player < Gm_Player_NumMax"); - } + HSD_ASSERTREPORT(1559, 0 <= player && player < Gm_Player_NumMax, + "zako ko player illegal ! :%d\n", player); switch (arg1) { case It_Kind_Old_Kuri: diff --git a/src/melee/ty/toy.c b/src/melee/ty/toy.c index c176b84eac..e67b74d4d5 100644 --- a/src/melee/ty/toy.c +++ b/src/melee/ty/toy.c @@ -1843,7 +1843,7 @@ void Toy_80307470(s32 arg0) if (tg->x50 == NULL) { OSReport("*** BG data aren't being loaded!\n"); - __assert(__FILE__, 2481, "0"); + HSD_ASSERT(2481, 0); } if (tg->x0 != NULL) { @@ -1876,7 +1876,7 @@ void Toy_80307470(s32 arg0) } OSReport("*** Can not Load Panel Label(%s)\n", *label); - __assert(__FILE__, 2534, "0"); + HSD_ASSERT(2534, 0); } void _Toy_803075E8(s32 arg0) @@ -1897,7 +1897,7 @@ void _Toy_803075E8(s32 arg0) if (td->archive == NULL) { OSReport("*** BG data aren't being loaded!\n"); - __assert(__FILE__, 2625, "0"); + HSD_ASSERT(2625, 0); } if (td->gobj != NULL) { @@ -1939,7 +1939,7 @@ void _Toy_803075E8(s32 arg0) } } else { OSReport("*** Can not Load Back Label(%s)\n", *ptr); - __assert(__FILE__, 2677, "0"); + HSD_ASSERT(2677, 0); } } else if (td->x54 != 0) { tdjobj = ((ToyED8Data*) Toy_sbss_804D6ED8)->x8->x28; @@ -2225,7 +2225,7 @@ char* Toy_8030813C(int trophy_id) if (found == 0) { OSReport("**** Not Found Toy Model!(%d)\n", id); - __assert("toy.c", 2979, "0"); + HSD_ASSERT(2979, 0); } return ptr; @@ -2523,7 +2523,7 @@ HSD_GObj* Toy_803087F4(void* arg0) assert_fail: OSReport("*** Cann't Show Model!\n"); - __assert("toy.c", 3358, "0"); + HSD_ASSERT(3358, 0); done: return anim->gobj; diff --git a/src/sysdolphin/baselib/id.c b/src/sysdolphin/baselib/id.c index 3ed5ab66ea..fded41b281 100644 --- a/src/sysdolphin/baselib/id.c +++ b/src/sysdolphin/baselib/id.c @@ -33,10 +33,7 @@ inline IDEntry* IDEntryAlloc(void) IDEntry* entry; entry = HSD_ObjAlloc(HSD_IDGetAllocData()); - /// @todo Convert to @c HSD_ASSERT once a byte-matching form is found. - if (entry == NULL) { - __assert("id.c", 67, "entry"); - } + HSD_ASSERT(67, entry); memset(entry, 0, sizeof(IDEntry)); return entry; From 4454244a24d355eb79dcbd5d751776622f9afeee Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 10:30:51 -0700 Subject: [PATCH 03/20] Address review: rework ItemKind Pokemon_*, drop the lbfile respell Per ribbanya: The It_PKind_ prefix the assert recovers belongs on ItemKind's Pokemon entries, not on a new enum. The 32 Poke Ball entries become It_PKind_*, with It_PKind_Start and It_PKind_Terminate as inline range markers, and the 18 Pokemon-related articles beyond the range take the ordinary It_Kind_ prefix. Both blocks gain the /* 0xNN */ value comments the style guide asks for, which is also what makes the two markers checkable by eye. lbfile.c no longer respells HSD_ASSERT/HSD_ASSERTREPORT. Deleting the explicit lbFile_803BA508 declaration lets __FILE__ emit the same string; the only object-level change is that the literal is now anonymous. All 17 affected translation units keep identical loadable section contents. --- src/melee/ft/chara/ftCaptain/ftCa_SpecialS.c | 2 +- src/melee/ft/chara/ftCommon/ftpickupitem.c | 4 +- src/melee/gr/grcastle.c | 2 +- src/melee/gr/grlib.c | 2 +- src/melee/gr/ground.c | 2 +- src/melee/it/forward.h | 110 +++++++++---------- src/melee/it/itCommonItems.h | 2 +- src/melee/it/it_26B1.c | 6 +- src/melee/it/it_279C.c | 70 ++++++------ src/melee/it/itcoll.c | 9 +- src/melee/it/item.c | 14 +-- src/melee/it/items/itchicorita.c | 2 +- src/melee/it/items/ithouou.c | 2 +- src/melee/it/items/itkamex.c | 2 +- src/melee/it/items/itlucky.c | 2 +- src/melee/it/items/ityaku.c | 2 +- src/melee/it/itmaplib.c | 6 +- src/melee/lb/lbfile.c | 13 --- src/melee/pl/plbonuslib.c | 2 +- 19 files changed, 121 insertions(+), 133 deletions(-) diff --git a/src/melee/ft/chara/ftCaptain/ftCa_SpecialS.c b/src/melee/ft/chara/ftCaptain/ftCa_SpecialS.c index f562b60982..2df031645a 100644 --- a/src/melee/ft/chara/ftCaptain/ftCa_SpecialS.c +++ b/src/melee/ft/chara/ftCaptain/ftCa_SpecialS.c @@ -186,7 +186,7 @@ void ftCa_SpecialS_OnDetect(HSD_GObj* gobj) itGetKind(detected_gobj) < It_Kind_Octarock_Stone) || (itGetKind(detected_gobj) >= It_Kind_Old_Kuri && itGetKind(detected_gobj) < It_Kind_Arwing_Laser) || - itGetKind(detected_gobj) == Pokemon_Random) + itGetKind(detected_gobj) == It_PKind_Random) { switch (fp->motion_id) { case ftCa_MS_SpecialSStart: { diff --git a/src/melee/ft/chara/ftCommon/ftpickupitem.c b/src/melee/ft/chara/ftCommon/ftpickupitem.c index 887955e6b9..a1f90d5c73 100644 --- a/src/melee/ft/chara/ftCommon/ftpickupitem.c +++ b/src/melee/ft/chara/ftCommon/ftpickupitem.c @@ -173,7 +173,7 @@ bool ftpickupitem_8009447C(Fighter_GObj* gobj, Item_GObj* item_gobj) Fighter_8006CF5C(fp, it_8026B47C(item_gobj)); Item_8026A8EC(item_gobj); goto block_35; - case Pokemon_Lucky_Egg: + case It_Kind_Lucky_Egg: Fighter_8006CF5C(fp, it_8026B47C(item_gobj)); Item_8026A8EC(item_gobj); goto block_35; @@ -363,7 +363,7 @@ void ftpickupitem_80094B6C(Fighter_GObj* gobj, Item_GObj* item_gobj) Fighter_8006CF5C(fp, it_8026B47C(item_gobj)); Item_8026A8EC(item_gobj); return; - case Pokemon_Lucky_Egg: + case It_Kind_Lucky_Egg: Fighter_8006CF5C(fp, it_8026B47C(item_gobj)); Item_8026A8EC(item_gobj); return; diff --git a/src/melee/gr/grcastle.c b/src/melee/gr/grcastle.c index 7a73bf62c6..177bd1cf64 100644 --- a/src/melee/gr/grcastle.c +++ b/src/melee/gr/grcastle.c @@ -1799,7 +1799,7 @@ void grCastle_801D0680(void* arg0, unkCastle* arg1) static void grCastle_801D06CC_sub(unkCastle* arg0, Ground_GObj* gobj, s32 i) { - if (ftLib_80086960(gobj) || itGetKind(gobj) != Pokemon_Random) { + if (ftLib_80086960(gobj) || itGetKind(gobj) != It_PKind_Random) { arg0->x134[i] = 1; grMaterial_801C8CDC(arg0->x10C[i]); arg0->x10C[i] = NULL; diff --git a/src/melee/gr/grlib.c b/src/melee/gr/grlib.c index 33d987efcd..12dfd99745 100644 --- a/src/melee/gr/grlib.c +++ b/src/melee/gr/grlib.c @@ -369,7 +369,7 @@ bool grLib_801C9EE8(Vec3* point, float offset) items = HSD_GObj_Entities->items; for (cur_item = items; cur_item != NULL; cur_item = cur_item->next) { - if (itGetKind(cur_item) != Pokemon_Random) { + if (itGetKind(cur_item) != It_PKind_Random) { ip = GET_ITEM(cur_item); if (PointInsideColl(&ip->x378_itemColl, point, offset)) { return true; diff --git a/src/melee/gr/ground.c b/src/melee/gr/ground.c index e210399e0d..12b25b91d2 100644 --- a/src/melee/gr/ground.c +++ b/src/melee/gr/ground.c @@ -506,7 +506,7 @@ void Ground_801C0800(StageIdPair* pair) if (stage_info.ald_yaku_all != NULL) { for (i = 1; stage_info.ald_yaku_all[i] != NULL; i++) { - Article* a = it_804D6D38[Pokemon_Random - It_Kind_Kuriboh]; + Article* a = it_804D6D38[It_PKind_Random - It_Kind_Kuriboh]; a->xC_itemStates->x0_itemStateDesc[i].xC_script = stage_info.ald_yaku_all[i]; } diff --git a/src/melee/it/forward.h b/src/melee/it/forward.h index 75f24e8c57..c44518f425 100644 --- a/src/melee/it/forward.h +++ b/src/melee/it/forward.h @@ -81,7 +81,7 @@ typedef enum Item_HoldKinds { ITEM_HOLD_0, // Common items, besides It_Kind_Foods ITEM_HOLD_1, // Item-related items ITEM_HOLD_2, // It_Kind_Foods - ITEM_HOLD_3, // Pokemon_Random + ITEM_HOLD_3, // It_PKind_Random ITEM_HOLD_4, // Monsters 2 and Stage-specific items, besides // It_Kind_Arwing_Laser, It_Kind_GreatFox_Laser, and // It_Kind_Kyasarin_Egg @@ -282,56 +282,61 @@ typedef enum ItemKind { // POKEMON - Pokemon_Random, // Used for Random Pokemon value - Pokemon_Tosakinto, // Goldeen (Tosakinto) - Pokemon_Chicorita, // Chikorita (Chicorita) - Pokemon_Kabigon, // Snorlax (Kabigon) - Pokemon_Kamex, // Blastoise (Kamex) - Pokemon_Matadogas, // Weezing (Matadogas) - Pokemon_Lizardon, // Charizard (Lizardon) - Pokemon_Fire, // Moltres (Fire) - Pokemon_Thunder, // Zapdos (Thunder) - Pokemon_Freezer, // Articuno (Freezer) - Pokemon_Sonans, // Wobbuffet (Sonans) - Pokemon_Hassam, // Scizor (Hassam) - Pokemon_Unknown, // Unown (Unknown) - Pokemon_Entei, // Entei - Pokemon_Raikou, // Raikou - Pokemon_Suikun, // Suicune (Suikun) - Pokemon_Kireihana, // Bellossom (Kireihana) - Pokemon_Marumine, // Electrode (Marumine) - Pokemon_Lugia, // Lugia - Pokemon_Houou, // Ho-oh (Houou) - Pokemon_Metamon, // Ditto (Metamon) - Pokemon_Pippi, // Clefairy (Pippi) - Pokemon_Togepy, // Togepi (Togepy) - Pokemon_Mew, // Mew - Pokemon_Cerebi, // Celebi (Cerebi) - Pokemon_Hitodeman, // Staryu (Hitodeman) - Pokemon_Lucky, // Chansey (Lucky) - Pokemon_Porygon2, // Porygon2 - Pokemon_Hinoarashi, // Cyndaquil (Hinoarashi) - Pokemon_Maril, // Marill (Maril) - Pokemon_Fushigibana, // Venusaur (Fushigibana) + /* 0xA0 */ It_PKind_Random, // Used for Random Pokemon value + /// First Poke Ball Pokemon, named by an assert in #pl_8003E70C. + /* 0xA1 */ It_PKind_Start, + /* 0xA1 */ It_PKind_Tosakinto = It_PKind_Start, // Goldeen (Tosakinto) + /* 0xA2 */ It_PKind_Chicorita, // Chikorita (Chicorita) + /* 0xA3 */ It_PKind_Kabigon, // Snorlax (Kabigon) + /* 0xA4 */ It_PKind_Kamex, // Blastoise (Kamex) + /* 0xA5 */ It_PKind_Matadogas, // Weezing (Matadogas) + /* 0xA6 */ It_PKind_Lizardon, // Charizard (Lizardon) + /* 0xA7 */ It_PKind_Fire, // Moltres (Fire) + /* 0xA8 */ It_PKind_Thunder, // Zapdos (Thunder) + /* 0xA9 */ It_PKind_Freezer, // Articuno (Freezer) + /* 0xAA */ It_PKind_Sonans, // Wobbuffet (Sonans) + /* 0xAB */ It_PKind_Hassam, // Scizor (Hassam) + /* 0xAC */ It_PKind_Unknown, // Unown (Unknown) + /* 0xAD */ It_PKind_Entei, // Entei + /* 0xAE */ It_PKind_Raikou, // Raikou + /* 0xAF */ It_PKind_Suikun, // Suicune (Suikun) + /* 0xB0 */ It_PKind_Kireihana, // Bellossom (Kireihana) + /* 0xB1 */ It_PKind_Marumine, // Electrode (Marumine) + /* 0xB2 */ It_PKind_Lugia, // Lugia + /* 0xB3 */ It_PKind_Houou, // Ho-oh (Houou) + /* 0xB4 */ It_PKind_Metamon, // Ditto (Metamon) + /* 0xB5 */ It_PKind_Pippi, // Clefairy (Pippi) + /* 0xB6 */ It_PKind_Togepy, // Togepi (Togepy) + /* 0xB7 */ It_PKind_Mew, // Mew + /* 0xB8 */ It_PKind_Cerebi, // Celebi (Cerebi) + /* 0xB9 */ It_PKind_Hitodeman, // Staryu (Hitodeman) + /* 0xBA */ It_PKind_Lucky, // Chansey (Lucky) + /* 0xBB */ It_PKind_Porygon2, // Porygon2 + /* 0xBC */ It_PKind_Hinoarashi, // Cyndaquil (Hinoarashi) + /* 0xBD */ It_PKind_Maril, // Marill (Maril) + /* 0xBE */ It_PKind_Fushigibana, // Venusaur (Fushigibana) + /// One past the last Poke Ball Pokemon. + /* 0xBF */ It_PKind_Terminate, // POKEMON-RELATED - Pokemon_Chicorita_Leaf, // Chikorita's Leaf - Pokemon_Kamex_HydroPump, // Blastoise's Water - Pokemon_Matadogas_Gas1, // Weezing's Gas - Pokemon_Matadogas_Gas2, // Weezing's Gas - Pokemon_Lizardon_Flame1, // Charizard's Breath - Pokemon_Lizardon_Flame2, // Charizard's Breath - Pokemon_Lizardon_Flame3, // Charizard's Breath - Pokemon_Lizardon_Flame4, // Charizard's Breath - Pokemon_Unknown_Swarm, // Mini-Unowns - Pokemon_Lugia_Aeroblast, // Lugia's Aeroblast - Pokemon_Lugia_Aeroblast2, // Lugia's Aeroblast - Pokemon_Lugia_Aeroblast3, // Lugia's Aeroblast - Pokemon_Houou_SacredFire, // Ho-Oh's Flame - Pokemon_Hitodeman_Star, // Staryu's Star - Pokemon_Lucky_Egg, // Chansey's Healing Egg - Pokemon_Hinoarashi_Flame, // Cyndaquil's Fire - Pokemon_Unk, // ??? + + /* 0xBF */ It_Kind_Chicorita_Leaf = It_PKind_Terminate, // Chikorita's Leaf + /* 0xC0 */ It_Kind_Kamex_HydroPump, // Blastoise's Water + /* 0xC1 */ It_Kind_Matadogas_Gas1, // Weezing's Gas + /* 0xC2 */ It_Kind_Matadogas_Gas2, // Weezing's Gas + /* 0xC3 */ It_Kind_Lizardon_Flame1, // Charizard's Breath + /* 0xC4 */ It_Kind_Lizardon_Flame2, // Charizard's Breath + /* 0xC5 */ It_Kind_Lizardon_Flame3, // Charizard's Breath + /* 0xC6 */ It_Kind_Lizardon_Flame4, // Charizard's Breath + /* 0xC7 */ It_Kind_Unknown_Swarm, // Mini-Unowns + /* 0xC8 */ It_Kind_Lugia_Aeroblast, // Lugia's Aeroblast + /* 0xC9 */ It_Kind_Lugia_Aeroblast2, // Lugia's Aeroblast + /* 0xCA */ It_Kind_Lugia_Aeroblast3, // Lugia's Aeroblast + /* 0xCB */ It_Kind_Houou_SacredFire, // Ho-Oh's Flame + /* 0xCC */ It_Kind_Hitodeman_Star, // Staryu's Star + /* 0xCD */ It_Kind_Lucky_Egg, // Chansey's Healing Egg + /* 0xCE */ It_Kind_Hinoarashi_Flame, // Cyndaquil's Fire + /* 0xCF */ It_Kind_Pokemon_Unk, // ??? // MONSTERS 2 @@ -367,12 +372,7 @@ typedef enum ItemKind { It_Kind_Arwing_Laser, // Arwing Laser It_Kind_GreatFox_Laser, // Great Fox's Laser It_Kind_Kyasarin_Egg, // Birdo's Egg -} ItemKind; -/// Bounds of the Poke Ball Pokemon range of #ItemKind. -typedef enum It_PKind { - /* 0xA1 */ It_PKind_Start = Pokemon_Tosakinto, - /* 0xBF */ It_PKind_Terminate = Pokemon_Chicorita_Leaf, -} It_PKind; +} ItemKind; #endif diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 724e718bfa..fcecd6cac3 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -1188,7 +1188,7 @@ typedef struct itPokemonSpawn_DatAttrs { f32 x1C[6]; f32 x34; s32 x38; - s32 pokemon_spawn_weights[Pokemon_Chicorita_Leaf - Pokemon_Tosakinto]; + s32 pokemon_spawn_weights[It_Kind_Chicorita_Leaf - It_PKind_Tosakinto]; u8 _pad[520]; } itPokemonSpawn_DatAttrs; STATIC_ASSERT(sizeof(itPokemonSpawn_DatAttrs) == 0x2BC); diff --git a/src/melee/it/it_26B1.c b/src/melee/it/it_26B1.c index 2a4b1faa7c..5db6109c6f 100644 --- a/src/melee/it/it_26B1.c +++ b/src/melee/it/it_26B1.c @@ -229,7 +229,7 @@ s32 it_8026B47C(HSD_GObj* gobj) // Get heal value of healing items return temp_item->xDD4_itemVar.tomato.heal_amount; case It_Kind_Foods: return temp_item->xDD4_itemVar.foods.heal_amount; - case Pokemon_Lucky_Egg: + case It_Kind_Lucky_Egg: return temp_item->xDD4_itemVar.egg.heal_amount; case It_Kind_WhispyHealApple: return temp_item->xDD4_itemVar.whispyapple.xDD4_heal; @@ -248,7 +248,7 @@ bool it_8026B4F0(HSD_GObj* gobj) // Check if item is a healing item case It_Kind_Tomato: case It_Kind_Foods: case It_Kind_Coin: - case Pokemon_Lucky_Egg: + case It_Kind_Lucky_Egg: case It_Kind_WhispyHealApple: return true; default: @@ -1175,7 +1175,7 @@ void it_8026C368(HSD_GObj* gobj) it_8029D968(gobj); return; - case Pokemon_Marumine: + case It_PKind_Marumine: it_802D09D0(gobj); return; diff --git a/src/melee/it/it_279C.c b/src/melee/it/it_279C.c index dfa85b724f..60a2413acb 100644 --- a/src/melee/it/it_279C.c +++ b/src/melee/it/it_279C.c @@ -1008,17 +1008,17 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { ItemKind it_803F2ED0[22] = { // Common Pokemon - Pokemon_Tosakinto, Pokemon_Chicorita, - Pokemon_Kabigon, Pokemon_Kamex, - Pokemon_Matadogas, Pokemon_Lizardon, - Pokemon_Sonans, Pokemon_Hassam, - Pokemon_Unknown, Pokemon_Kireihana, - Pokemon_Marumine, Pokemon_Metamon, - Pokemon_Pippi, Pokemon_Togepy, - Pokemon_Hitodeman, Pokemon_Lucky, - Pokemon_Porygon2, Pokemon_Hinoarashi, - Pokemon_Maril, Pokemon_Fushigibana, - Pokemon_Chicorita_Leaf, 0x00, + It_PKind_Tosakinto, It_PKind_Chicorita, + It_PKind_Kabigon, It_PKind_Kamex, + It_PKind_Matadogas, It_PKind_Lizardon, + It_PKind_Sonans, It_PKind_Hassam, + It_PKind_Unknown, It_PKind_Kireihana, + It_PKind_Marumine, It_PKind_Metamon, + It_PKind_Pippi, It_PKind_Togepy, + It_PKind_Hitodeman, It_PKind_Lucky, + It_PKind_Porygon2, It_PKind_Hinoarashi, + It_PKind_Maril, It_PKind_Fushigibana, + It_Kind_Chicorita_Leaf, 0x00, }; /// Character-specific items @@ -3968,8 +3968,8 @@ void it_8027A344(Item_GObj* item_gobj) item->x40_vel.y = item->xDD4_itemVar.pokemon_spawn.x4.y; } -#define PK_START (Pokemon_Tosakinto) -#define PK_END (Pokemon_Tosakinto + 30) +#define PK_START (It_PKind_Tosakinto) +#define PK_END (It_PKind_Tosakinto + 30) s32 it_8027A364(Item* item) { @@ -3977,12 +3977,12 @@ s32 it_8027A364(Item* item) item->xC4_article_data->x4_specialAttributes; int ret_val = 1; int i; - int start = Pokemon_Tosakinto; - int end = Pokemon_Tosakinto + 30; + int start = It_PKind_Tosakinto; + int end = It_PKind_Tosakinto + 30; for (i = start; i < end; i++) { if (Item_804A0E24.x != i && Item_804A0E24.y != i) { - ret_val += attr->pokemon_spawn_weights[i - Pokemon_Tosakinto]; + ret_val += attr->pokemon_spawn_weights[i - It_PKind_Tosakinto]; } } @@ -4014,11 +4014,11 @@ s32 it_8027A4D4(Item* item) int y = Item_804A0E24.y; int x = Item_804A0E24.x; if (x != i && y != i) { - var_r3 += attr->pokemon_spawn_weights[i - Pokemon_Tosakinto]; + var_r3 += attr->pokemon_spawn_weights[i - It_PKind_Tosakinto]; if (var_r3 >= rand_int) { Item_804A0E24.y = x; Item_804A0E24.x = i; - return i - Pokemon_Tosakinto; + return i - It_PKind_Tosakinto; } } } @@ -4051,21 +4051,21 @@ s32 it_8027A780(Item* item, void* arg1) y = Item_804A0E24.y; for (i = 0; i < 30; i++) { ItemKind kind = ((ItemKind*) arg1)[i]; - if (kind == Pokemon_Chicorita_Leaf) { + if (kind == It_Kind_Chicorita_Leaf) { break; } if (x != kind && y != kind) { buf->x = kind; cnt++; buf->y = attr->pokemon_spawn_weights[((ItemKind*) arg1)[i] - - Pokemon_Tosakinto]; + It_PKind_Tosakinto]; total += buf->y; buf++; } } rand_int = HSD_Randi(total); accum = 0; - result = Pokemon_Sonans; + result = It_PKind_Sonans; idx = 0; while (cnt > 0) { accum += base->y; @@ -4079,7 +4079,7 @@ s32 it_8027A780(Item* item, void* arg1) } Item_804A0E24.y = Item_804A0E24.x; Item_804A0E24.x = result; - return result - Pokemon_Tosakinto; + return result - It_PKind_Tosakinto; } s32 it_8027A9B8(Item* item) @@ -4088,7 +4088,7 @@ s32 it_8027A9B8(Item* item) vec = gm_801BEC54(); if (vec == NULL) { - return Pokemon_Sonans; + return It_PKind_Sonans; } if ((HSD_Randi(251U) == 0) && (Item_804A0E24.z == 0) && gm_80165084()) { Item_804A0E24.z = 1; @@ -4109,7 +4109,7 @@ void it_8027AAA0(Item_GObj* item1_gobj, Item* item2, s32 arg2) Item* it = GET_ITEM(item1_gobj); itPokemonSpawn_DatAttrs* attr = it->xC4_article_data->x4_specialAttributes; - if (arg2 == Pokemon_Marumine) { + if (arg2 == It_PKind_Marumine) { item2->xDD4_itemVar.pokemon_spawn.x1C = 0.0f; item2->xDD4_itemVar.pokemon_spawn.x20 = 0.0f; } else { @@ -4142,7 +4142,7 @@ void it_8027AAA0(Item_GObj* item1_gobj, Item* item2, s32 arg2) static inline s32 it_8027AB64_SpawnWeight(itPokemonSpawn_DatAttrs* attr, s32 index) { - return attr->pokemon_spawn_weights[index - Pokemon_Tosakinto]; + return attr->pokemon_spawn_weights[index - It_PKind_Tosakinto]; } static inline s32 it_8027AB64_SelectKind(Item* item) @@ -4157,14 +4157,14 @@ static inline s32 it_8027AB64_SelectKind(Item* item) s32 var_ctr; var_r4 = 0; - index = Pokemon_Tosakinto; + index = It_PKind_Tosakinto; for (var_ctr = 30; var_ctr != 0; var_ctr--) { if (recent_x_val != index && recent_y_val != index) { var_r4 += it_8027AB64_SpawnWeight(attr, index); if (var_r4 >= rand_int) { Item_804A0E24.y = recent_x_val; Item_804A0E24.x = index; - return index - Pokemon_Tosakinto; + return index - It_PKind_Tosakinto; } } index++; @@ -4186,14 +4186,14 @@ static inline s32 it_8027AB64_SelectKind(Item* item) s32 var_ctr; var_r4 = 0; - index = Pokemon_Tosakinto; + index = It_PKind_Tosakinto; for (var_ctr = 30; var_ctr != 0; var_ctr--) { if (recent_x_val != index && recent_y_val != index) { var_r4 += *(spawn_weights - 0x92); if (var_r4 >= rand_int) { Item_804A0E24.y = recent_x_val; Item_804A0E24.x = index; - return index - Pokemon_Tosakinto; + return index - It_PKind_Tosakinto; } } spawn_weights++; @@ -4218,10 +4218,10 @@ bool it_8027AB64(Item_GObj* item_gobj) if (temp_r3 == 1) { spawn.kind = it_8027A9B8(item); } else { - spawn.kind = temp_r3 - Pokemon_Tosakinto; + spawn.kind = temp_r3 - It_PKind_Tosakinto; } } else if (gm_8018841C()) { - spawn.kind = (&it_803F2ED0 == NULL) ? Pokemon_Sonans + spawn.kind = (&it_803F2ED0 == NULL) ? It_PKind_Sonans : it_8027A780(item, &it_803F2ED0); } else if (gm_GetCurrentGameMode() == GM_OPENING_MV) { spawn.kind = it_8027AB64_SelectKind(item); @@ -4233,7 +4233,7 @@ bool it_8027AB64(Item_GObj* item_gobj) spawn.kind--; } if (spawn.kind == (enum ItemKind) Pokemon_ID_Metamon && - (it_8026B3C0(Pokemon_Metamon) != 0 || ftLib_800860C4() == 4)) + (it_8026B3C0(It_PKind_Metamon) != 0 || ftLib_800860C4() == 4)) { spawn.kind = (enum ItemKind) Pokemon_ID_Tosakinto; } @@ -4252,15 +4252,15 @@ bool it_8027AB64(Item_GObj* item_gobj) it_8026BB88(item_gobj, &spawn.pos); spawn.x3C_damage = 0; spawn.facing_dir = it_8026B6A8(prev_pos, item2->owner); - spawn.kind = spawn.kind + Pokemon_Tosakinto; + spawn.kind = spawn.kind + It_PKind_Tosakinto; spawn.x0_parent_gobj = item2->owner; spawn.x4_parent_gobj2 = item_gobj; spawn.x44_flag.b0 = 1; spawn.x40 = 0; - if (spawn.kind == Pokemon_Cerebi) { + if (spawn.kind == It_PKind_Cerebi) { gm_80172C04(); } - if (spawn.kind == Pokemon_Mew) { + if (spawn.kind == It_PKind_Mew) { gm_80172BC4(); } } diff --git a/src/melee/it/itcoll.c b/src/melee/it/itcoll.c index 7620addcee..eed5c64216 100644 --- a/src/melee/it/itcoll.c +++ b/src/melee/it/itcoll.c @@ -505,12 +505,12 @@ void it_802703E8(Item_GObj* arg_item_gobj) &arg_item->xACC_itemHurtbox[hurt_index]); it_8027B378(fighter->gobj, arg_item->entity, dmg); kind = arg_item->kind; - if ((kind == Pokemon_Random) && + if ((kind == It_PKind_Random) && (arg_item->xDD4_itemVar.pokemon.x0 == 7) && ((hit->sfx_kind == 1U) || (hit->sfx_kind == 2U))) { lbAudioAx_800237A8(0x61A87, 0x7FU, 0x40U); - } else if ((kind != Pokemon_Random) || + } else if ((kind != It_PKind_Random) || (arg_item->xDD4_itemVar.pokemon.x0 != 8) || ((hit->sfx_kind != 1U) && (hit->sfx_kind != 2U))) @@ -614,11 +614,12 @@ static inline void it_802706D0_sub3(Item* item, Item* arg_item, it_8026F9AC_outline(2, item, hit, arg_item, arg_hurt); it_8027B408(item->entity, arg_item->entity, dmg); kind = arg_item->kind; - if ((kind == Pokemon_Random) && (arg_item->xDD4_itemVar.pokemon.x0 == 7) && + if ((kind == It_PKind_Random) && + (arg_item->xDD4_itemVar.pokemon.x0 == 7) && ((hit->sfx_kind == 1U) || (hit->sfx_kind == 2U))) { lbAudioAx_800237A8(0x61A87, 0x7FU, 0x40U); - } else if ((kind != Pokemon_Random) || + } else if ((kind != It_PKind_Random) || (arg_item->xDD4_itemVar.pokemon.x0 != 8) || ((hit->sfx_kind != 1U) && (hit->sfx_kind != 2U))) { diff --git a/src/melee/it/item.c b/src/melee/it/item.c index 0f5dad6cae..9f26adcd71 100644 --- a/src/melee/it/item.c +++ b/src/melee/it/item.c @@ -291,7 +291,7 @@ static void Item_802674AC(SpawnItem* spawnItem) return; } - if (kind == Pokemon_Random) { + if (kind == It_PKind_Random) { spawnItem->hold_kind = 3; return; } @@ -326,12 +326,12 @@ static void Item_802674AC(SpawnItem* spawnItem) return; } - if (kind < Pokemon_Random) { + if (kind < It_PKind_Random) { spawnItem->hold_kind = 11; return; } - if (kind < Pokemon_Chicorita_Leaf) { + if (kind < It_Kind_Chicorita_Leaf) { spawnItem->hold_kind = 9; return; } @@ -540,14 +540,14 @@ void Item_80267978(HSD_GObj* gobj) // Common items item_data->xC4_article_data = it_804D6D24[item_data->kind]; item_data->xB8_itemLogicTable = &it_803F14C4[item_data->kind]; - } else if (item_data->kind < Pokemon_Tosakinto) { + } else if (item_data->kind < It_PKind_Tosakinto) { // Character items int idx = item_data->kind - It_Kind_Kuriboh; item_data->xC4_article_data = it_804D6D38[idx]; item_data->xB8_itemLogicTable = &it_803F3100[idx]; } else if (item_data->kind < It_Kind_Old_Kuri) { // Pokemon - int idx = item_data->kind - Pokemon_Tosakinto; + int idx = item_data->kind - It_PKind_Tosakinto; item_data->xC4_article_data = it_804D6D30[idx]; item_data->xB8_itemLogicTable = &it_803F23CC[idx]; } else { @@ -971,13 +971,13 @@ static HSD_GObj* Item_8026862C(SpawnItem* spawnItem) // Common items GObj_SetupGXLink(gobj, it_803F1418[spawnItem->kind].x0_renderFunc, 6, 0); - } else if (spawnItem->kind < Pokemon_Tosakinto) { + } else if (spawnItem->kind < It_PKind_Tosakinto) { // Character items int idx = spawnItem->kind - It_Kind_Kuriboh; GObj_SetupGXLink(gobj, it_803F2F28[idx].x0_renderFunc, 6, 0); } else if (spawnItem->kind < It_Kind_Old_Kuri) { // Pokemon - int idx = spawnItem->kind - Pokemon_Tosakinto; + int idx = spawnItem->kind - It_PKind_Tosakinto; GObj_SetupGXLink(gobj, it_803F2310[idx].x0_renderFunc, 6, 0); } else { // Stage items diff --git a/src/melee/it/items/itchicorita.c b/src/melee/it/items/itchicorita.c index 3bae4527c3..1dcdb3309d 100644 --- a/src/melee/it/items/itchicorita.c +++ b/src/melee/it/items/itchicorita.c @@ -242,7 +242,7 @@ void it_802C9B20(Item_GObj* chicorita_gobj) spawn.vel.x = attr->x10 * chicorita->facing_dir; spawn.vel.z = spawn.vel.y = 0.0f; spawn.x40 = 0; - spawn.kind = Pokemon_Chicorita_Leaf; + spawn.kind = It_Kind_Chicorita_Leaf; spawn.x0_parent_gobj = chicorita->owner; spawn.x4_parent_gobj2 = (HSD_GObj*) chicorita_gobj; spawn.x44_flag.b0 = 1; diff --git a/src/melee/it/items/ithouou.c b/src/melee/it/items/ithouou.c index 86c470f137..743553e875 100644 --- a/src/melee/it/items/ithouou.c +++ b/src/melee/it/items/ithouou.c @@ -349,7 +349,7 @@ void it_802D2D2C(Item_GObj* gobj) spawn.x3C_damage = 0; spawn.vel.y = spawn.vel.x = 0.0f; spawn.vel.z = 0.0f; - spawn.kind = Pokemon_Houou_SacredFire; + spawn.kind = It_Kind_Houou_SacredFire; spawn.x0_parent_gobj = ip->owner; spawn.x4_parent_gobj2 = gobj; spawn.x44_flag.b0 = true; diff --git a/src/melee/it/items/itkamex.c b/src/melee/it/items/itkamex.c index cc834b61d7..eab1330e11 100644 --- a/src/melee/it/items/itkamex.c +++ b/src/melee/it/items/itkamex.c @@ -240,7 +240,7 @@ void it_802CAB10(Item_GObj* gobj) spawn.vel.x = attrs->x14 * ip->facing_dir; spawn.vel.y = 0.0f; spawn.vel.z = 0.0f; - spawn.kind = Pokemon_Kamex_HydroPump; + spawn.kind = It_Kind_Kamex_HydroPump; ip->xDD4_itemVar.pokemon.x64 ^= 1; spawn.x0_parent_gobj = ip->owner; spawn.x4_parent_gobj2 = (HSD_GObj*) gobj; diff --git a/src/melee/it/items/itlucky.c b/src/melee/it/items/itlucky.c index f17eeb1073..bb5a05810e 100644 --- a/src/melee/it/items/itlucky.c +++ b/src/melee/it/items/itlucky.c @@ -325,7 +325,7 @@ static inline Item_GObj* it_802D5710_inline(Item_GObj* gobj, Vec3* pos, { Item* ip = gobj->user_data; SpawnItem spawn; - spawn.kind = Pokemon_Lucky_Egg; + spawn.kind = It_Kind_Lucky_Egg; spawn.prev_pos = *pos; spawn.prev_pos.z = 0.0f; spawn.pos = spawn.prev_pos; diff --git a/src/melee/it/items/ityaku.c b/src/melee/it/items/ityaku.c index 216ba44f87..34c0315109 100644 --- a/src/melee/it/items/ityaku.c +++ b/src/melee/it/items/ityaku.c @@ -98,7 +98,7 @@ Item_GObj* it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, HSD_JObj* item_jobj; Item_GObj* item_gobj; - spawn.kind = Pokemon_Random; // 44 + spawn.kind = It_PKind_Random; // 44 if (arg3) { lb_8000B1CC(arg3, NULL, &spawn.prev_pos); } else { diff --git a/src/melee/it/itmaplib.c b/src/melee/it/itmaplib.c index 52baad3495..8568f432e6 100644 --- a/src/melee/it/itmaplib.c +++ b/src/melee/it/itmaplib.c @@ -202,11 +202,11 @@ void it_80275E98(Item_GObj* item_gobj, SpawnItem* spawn) coll->x34_flags.b1234 = 4; } else if (kind < It_Kind_Unk4) { coll->x34_flags.b1234 = 5; - } else if (kind < Pokemon_Random) { + } else if (kind < It_PKind_Random) { coll->x34_flags.b1234 = 5; - } else if (kind < Pokemon_Tosakinto) { + } else if (kind < It_PKind_Tosakinto) { coll->x34_flags.b1234 = 5; - } else if (kind < Pokemon_Chicorita_Leaf) { + } else if (kind < It_Kind_Chicorita_Leaf) { coll->x34_flags.b1234 = 5; } else if (kind < It_Kind_Old_Kuri) { coll->x34_flags.b1234 = 4; diff --git a/src/melee/lb/lbfile.c b/src/melee/lb/lbfile.c index 753a548bb1..b1ae725afa 100644 --- a/src/melee/lb/lbfile.c +++ b/src/melee/lb/lbfile.c @@ -12,19 +12,6 @@ #include #include -static char lbFile_803BA508[] = __FILE__; - -/// This file passes its stored file name rather than a fresh @c __FILE__ -/// literal, so both assert macros are respelled around that array. -#undef HSD_ASSERT -#define HSD_ASSERT(line, cond) \ - ((cond) ? ((void) 0) : __assert(lbFile_803BA508, line, #cond)) -#undef HSD_ASSERTREPORT -#define HSD_ASSERTREPORT(line, cond, ...) \ - ((cond) \ - ? (void) 0 \ - : (OSReport(__VA_ARGS__), __assert(lbFile_803BA508, line, #cond))) - static bool cancel; void lbFile_8001615C(int r3, int r4, void* r5, bool cancelflag) diff --git a/src/melee/pl/plbonuslib.c b/src/melee/pl/plbonuslib.c index fa4164b044..b2133f694c 100644 --- a/src/melee/pl/plbonuslib.c +++ b/src/melee/pl/plbonuslib.c @@ -436,7 +436,7 @@ void pl_8003E17C(int player_id, int arg1, kind2 = kind; } else { // Not one of the common items switch (kind) { - case Pokemon_Lucky_Egg: + case It_Kind_Lucky_Egg: kind2 = It_Kind_L_Gun_Ray; break; case It_Kind_WhispyApple: From 0a42ccf9f1a05d6e9ccddd433b2c556199d460ff Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 10:39:42 -0700 Subject: [PATCH 04/20] Apply the recovered range names at their existing sites The It_PKind_Start/It_PKind_Terminate pair the assert recovers already existed in the tree under invented names. it_279C.c's PK_START/PK_END macros are exactly those two values, as are the open-coded start/end locals beside them, the pokemon_spawn_weights array base and bound, the it_803F2ED0 terminator, and the loop that breaks on it. Same for Gm_Player_NumMax, which duplicated PL_SLOT_MAX, and Pl_ItemLog_Terminate, which duplicated plbonuslib's 0x27. Also from the assert strings: grhomerun's four rear*_gobj fields are one bg_gobj[4] array, and gobjs and jobj_gobjs are parts and back. grshrineroute's symbol array is reached as u.map.symbol; Map_GroundVars already carries it at the same offset (gp+108) and nothing else used it. grbigblue's per-entry jobj is the one the assert names, so the stage model's own jobj moves into the block that uses it. All changed translation units keep identical loadable section contents. --- src/melee/gr/grbigblue.c | 22 +++++++----- src/melee/gr/grhomerun.c | 66 ++++++++++++++++++------------------ src/melee/gr/grshrineroute.c | 35 +++++++++---------- src/melee/gr/types.h | 12 +++---- src/melee/if/ifnametag.c | 14 ++++---- src/melee/it/itCommonItems.h | 2 +- src/melee/it/it_279C.c | 57 +++++++++++++++---------------- src/melee/it/item.c | 10 +++--- src/melee/it/itmaplib.c | 4 +-- src/melee/pl/forward.h | 2 -- src/melee/pl/player.c | 6 ++-- src/melee/pl/plbonuslib.c | 8 ++--- 12 files changed, 115 insertions(+), 123 deletions(-) diff --git a/src/melee/gr/grbigblue.c b/src/melee/gr/grbigblue.c index a7b381af78..d790b35c48 100644 --- a/src/melee/gr/grbigblue.c +++ b/src/melee/gr/grbigblue.c @@ -2386,9 +2386,8 @@ static grBb_TrackEntry grBb_TrackEntries[12] = { void grBigBlue_801EB004(Ground_GObj* gobj) { - HSD_JObj* jobj = GET_JOBJ(gobj); Ground* gp = gobj->user_data; - HSD_JObj* child; + HSD_JObj* jobj; Vec3 pos; Vec3 end_pos; Vec3 diff; @@ -2397,10 +2396,15 @@ void grBigBlue_801EB004(Ground_GObj* gobj) grBb_TrackEntry* entry; PAD_STACK(4); - HSD_JObjSetFlagsAll(jobj, JOBJ_HIDDEN); + /// The assert at 2328 names the per-entry jobj, so the stage model's own + /// jobj is the one scoped to this block. + { + HSD_JObj* jobj = GET_JOBJ(gobj); + HSD_JObjSetFlagsAll(jobj, JOBJ_HIDDEN); - pos.x = pos.y = pos.z = 1.0F; - HSD_JObjSetScale(jobj, &pos); + pos.x = pos.y = pos.z = 1.0F; + HSD_JObjSetScale(jobj, &pos); + } pos.x = pos.y = pos.z = Ground_801C0498(); @@ -2408,10 +2412,10 @@ void grBigBlue_801EB004(Ground_GObj* gobj) for (i = 0; i < 12; i++, entry++) { HSD_JObj* start_jobj; HSD_JObj* end_jobj; - child = Ground_801C3FA4(gobj, entry->jobj_index); + jobj = Ground_801C3FA4(gobj, entry->jobj_index); /* goto required for match: skips to assert block on NULL */ - if (child == NULL) { + if (jobj == NULL) { goto assert_block; } @@ -2425,7 +2429,7 @@ void grBigBlue_801EB004(Ground_GObj* gobj) goto assert_block; } - HSD_JObjSetScale(child, &pos); + HSD_JObjSetScale(jobj, &pos); lb_8000B1CC(start_jobj, NULL, &start_pos); lb_8000B1CC(end_jobj, NULL, &end_pos); @@ -2437,7 +2441,7 @@ void grBigBlue_801EB004(Ground_GObj* gobj) continue; assert_block: - HSD_ASSERTMSG(2328, child, "jobj"); + HSD_ASSERT(2328, jobj); HSD_ASSERT(2329, start_jobj); HSD_ASSERT(2330, end_jobj); } diff --git a/src/melee/gr/grhomerun.c b/src/melee/gr/grhomerun.c index 9e286cd5c8..2cb4ce13e1 100644 --- a/src/melee/gr/grhomerun.c +++ b/src/melee/gr/grhomerun.c @@ -212,11 +212,11 @@ void grHomeRun_8021CB20(Ground_GObj* gobj) s32 i; Ground_801C2ED0(jobj2, gp->map_id); - gp->u.homerun.gobjs = HSD_MemAlloc(0x100); - HSD_ASSERTMSG(0x17A, gp->u.homerun.gobjs, "gp->u.map.parts"); + gp->u.homerun.parts = HSD_MemAlloc(0x100); + HSD_ASSERTMSG(0x17A, gp->u.homerun.parts, "gp->u.map.parts"); - gp->u.homerun.jobj_gobjs = HSD_MemAlloc(0x40); - HSD_ASSERTMSG(0x17B, gp->u.homerun.jobj_gobjs, "gp->u.map.back"); + gp->u.homerun.back = HSD_MemAlloc(0x40); + HSD_ASSERTMSG(0x17B, gp->u.homerun.back, "gp->u.map.back"); HSD_JObjSetScaleX(jobj2, grHr_804D6AE4 * HSD_JObjGetScaleX(jobj)); HSD_JObjSetScaleY(jobj2, grHr_804D6AE4 * HSD_JObjGetScaleY(jobj)); @@ -241,18 +241,18 @@ void grHomeRun_8021CB20(Ground_GObj* gobj) HSD_ASSERT(0x1A2, INIT_ADD_PARTS_RANGE*2u.homerun.gobjs[i] = grHomeRun_8021E500(i); + gp->u.homerun.parts[i] = grHomeRun_8021E500(i); } for (; i < Gr_Homerun_Parts_Max; i++) { - gp->u.homerun.gobjs[i] = NULL; + gp->u.homerun.parts[i] = NULL; } for (i = 0; i < 16; i++) { HSD_JObj* child; - gp->u.homerun.jobj_gobjs[i] = grHomeRun_8021C82C_noinline(4); - HSD_ASSERTMSG(0x1AB, gp->u.homerun.jobj_gobjs[i], "gp->u.map.back[i]"); + gp->u.homerun.back[i] = grHomeRun_8021C82C_noinline(4); + HSD_ASSERTMSG(0x1AB, gp->u.homerun.back[i], "gp->u.map.back[i]"); - jobj = GET_JOBJ(gp->u.homerun.jobj_gobjs[i]); + jobj = GET_JOBJ(gp->u.homerun.back[i]); HSD_ASSERT(0x1AC, jobj); HSD_JObjSetScaleX(jobj, grHr_804D6AE4 * HSD_JObjGetScaleX(jobj)); @@ -266,27 +266,27 @@ void grHomeRun_8021CB20(Ground_GObj* gobj) ((4.0F + (f32) i) * -(160.0F * Ground_801C0498()))); } - gp->u.homerun.rear_gobj = grHomeRun_8021C82C_noinline(3); - HSD_ASSERTMSG(0x1BA, gp->u.homerun.rear_gobj, "gp->u.map.bg_gobj[0]"); - jobj = GET_JOBJ(gp->u.homerun.rear_gobj); + gp->u.homerun.bg_gobj[0] = grHomeRun_8021C82C_noinline(3); + HSD_ASSERTMSG(0x1BA, gp->u.homerun.bg_gobj[0], "gp->u.map.bg_gobj[0]"); + jobj = GET_JOBJ(gp->u.homerun.bg_gobj[0]); HSD_ASSERT(0x1BB, jobj); HSD_JObjSetTranslateX(jobj, 1.5F * -(2150.99F * Ground_801C0498())); - gp->u.homerun.rear2_gobj = grHomeRun_8021C82C_noinline(3); - HSD_ASSERTMSG(0x1BD, gp->u.homerun.rear2_gobj, "gp->u.map.bg_gobj[1]"); - jobj = GET_JOBJ(gp->u.homerun.rear2_gobj); + gp->u.homerun.bg_gobj[1] = grHomeRun_8021C82C_noinline(3); + HSD_ASSERTMSG(0x1BD, gp->u.homerun.bg_gobj[1], "gp->u.map.bg_gobj[1]"); + jobj = GET_JOBJ(gp->u.homerun.bg_gobj[1]); HSD_ASSERT(0x1BE, jobj); HSD_JObjSetTranslateX(jobj, 0.5F * -(2150.99F * Ground_801C0498())); - gp->u.homerun.rear3_gobj = grHomeRun_8021C82C_noinline(3); - HSD_ASSERTMSG(0x1C0, gp->u.homerun.rear3_gobj, "gp->u.map.bg_gobj[2]"); - jobj = GET_JOBJ(gp->u.homerun.rear3_gobj); + gp->u.homerun.bg_gobj[2] = grHomeRun_8021C82C_noinline(3); + HSD_ASSERTMSG(0x1C0, gp->u.homerun.bg_gobj[2], "gp->u.map.bg_gobj[2]"); + jobj = GET_JOBJ(gp->u.homerun.bg_gobj[2]); HSD_ASSERT(0x1C1, jobj); HSD_JObjSetTranslateX(jobj, 0.5F * (2150.99F * Ground_801C0498())); - gp->u.homerun.rear4_gobj = grHomeRun_8021C82C_noinline(3); - HSD_ASSERTMSG(0x1C3, gp->u.homerun.rear4_gobj, "gp->u.map.bg_gobj[3]"); - jobj = GET_JOBJ(gp->u.homerun.rear4_gobj); + gp->u.homerun.bg_gobj[3] = grHomeRun_8021C82C_noinline(3); + HSD_ASSERTMSG(0x1C3, gp->u.homerun.bg_gobj[3], "gp->u.map.bg_gobj[3]"); + jobj = GET_JOBJ(gp->u.homerun.bg_gobj[3]); HSD_ASSERT(0x1C4, jobj); HSD_JObjSetTranslateX(jobj, 1.5F * (2150.99F * Ground_801C0498())); @@ -377,25 +377,25 @@ void grHomeRun_8021D680(Ground_GObj* gobj) x1 = (s32) (1.0F + ((2400.0F + cam_interest.x) / (160.0F * Ground_801C0498()))); - gobj2 = gp->u.homerun.gobjs[0]; + gobj2 = gp->u.homerun.parts[0]; gp2 = GET_GROUND(gobj2); if (gp2->u.homerun2.xC4 < x0) { Ground_801C4A08(gobj2); for (i = 0; i < 63; i++) { - gp->u.homerun.gobjs[i] = gp->u.homerun.gobjs[i + 1]; + gp->u.homerun.parts[i] = gp->u.homerun.parts[i + 1]; } - gp->u.homerun.gobjs[63] = NULL; + gp->u.homerun.parts[63] = NULL; } else if (gp2->u.homerun2.xC4 > x0) { gobj2 = grHomeRun_8021E500(gp2->u.homerun2.xC4 - 1); for (i = 63; i > 0; i--) { struct grHomeRun_GroundVars* vars = &gp->u.homerun; - vars->gobjs[i] = vars->gobjs[i - 1]; + vars->parts[i] = vars->parts[i - 1]; } - gp->u.homerun.gobjs[0] = gobj2; + gp->u.homerun.parts[0] = gobj2; } for (i = 63; i >= 0; i--) { - gobj2 = gp->u.homerun.gobjs[i]; + gobj2 = gp->u.homerun.parts[i]; if (gobj2 != NULL) { break; } @@ -403,10 +403,10 @@ void grHomeRun_8021D680(Ground_GObj* gobj) HSD_ASSERT(0x239, gobj2); gp2 = GET_GROUND(gobj2); if (gp2->u.homerun2.xC4 > x1) { - gp->u.homerun.gobjs[i] = NULL; + gp->u.homerun.parts[i] = NULL; Ground_801C4A08(gobj2); } else if (gp2->u.homerun2.xC4 < x1) { - gp->u.homerun.gobjs[i + 1] = + gp->u.homerun.parts[i + 1] = grHomeRun_8021E500(gp2->u.homerun2.xC4 + 1); } @@ -422,21 +422,21 @@ void grHomeRun_8021D680(Ground_GObj* gobj) } } - jobj = GET_JOBJ(gp->u.homerun.rear_gobj); + jobj = GET_JOBJ(gp->u.homerun.bg_gobj[0]); HSD_ASSERT(0x257, jobj); HSD_JObjSetTranslateX(jobj, x - 1.5F * (2150.99F * Ground_801C0498())); - jobj = GET_JOBJ(gp->u.homerun.rear2_gobj); + jobj = GET_JOBJ(gp->u.homerun.bg_gobj[1]); HSD_ASSERT(0x259, jobj); HSD_JObjSetTranslateX(jobj, x - 0.5F * (2150.99F * Ground_801C0498())); - jobj = GET_JOBJ(gp->u.homerun.rear3_gobj); + jobj = GET_JOBJ(gp->u.homerun.bg_gobj[2]); HSD_ASSERT(0x25B, jobj); HSD_JObjSetTranslateX(jobj, x + 0.5F * (2150.99F * Ground_801C0498())); - jobj = GET_JOBJ(gp->u.homerun.rear4_gobj); + jobj = GET_JOBJ(gp->u.homerun.bg_gobj[3]); HSD_ASSERT(0x25D, jobj); HSD_JObjSetTranslateX(jobj, x + 1.5F * (2150.99F * Ground_801C0498())); diff --git a/src/melee/gr/grshrineroute.c b/src/melee/gr/grshrineroute.c index 5cc736acb2..23eadc7799 100644 --- a/src/melee/gr/grshrineroute.c +++ b/src/melee/gr/grshrineroute.c @@ -273,12 +273,12 @@ void fn_80208A38(HSD_GObj* gobj) jobj = Ground_801C2CF4(i + 0xBD); if (jobj != NULL) { if (*flag != 0) { - gp->u.shrineroute.symbols[i] = grShrineRoute_802088C0(3); + gp->u.map.symbol[i] = grShrineRoute_802088C0(3); } else { - gp->u.shrineroute.symbols[i] = grShrineRoute_802088C0(1); + gp->u.map.symbol[i] = grShrineRoute_802088C0(1); } lb_8000B1CC(jobj, NULL, &pos); - effect = gp->u.shrineroute.symbols[i]; + effect = gp->u.map.symbol[i]; if (effect != NULL) { if ((ejobj = GET_JOBJ(effect)) != NULL) { HSD_JObjSetTranslate(ejobj, &pos); @@ -317,7 +317,7 @@ void grShrineRoute_80208D14(Ground_GObj* gobj) stage_info.x6DC = 0; for (i = 0; i < 6; i++) { - gp->u.shrineroute.symbols[i] = NULL; + gp->u.map.symbol[i] = NULL; } ftCo_800C07F8(gobj, 3, grShrineRoute_8020AE08); @@ -408,12 +408,11 @@ void grShrineRoute_80208F70(Ground_GObj* gobj) ix = result - 0xBD; if (!(gp->u.shrineroute.xC6 & (1 << ix))) { gp->u.shrineroute.xC8 = (u16) result; - HSD_ASSERTMSG(0x213, gp->u.shrineroute.symbols[(u32) ix], + HSD_ASSERTMSG(0x213, gp->u.map.symbol[(u32) ix], "gp->u.map.symbol[ix]"); { s32 mid = - ((Ground*) gp->u.shrineroute.symbols[ix]->user_data) - ->map_id; + ((Ground*) gp->u.map.symbol[ix]->user_data)->map_id; if (player != NULL) { Player_80031790((s32) ftLib_80086BE0(player)); } @@ -1277,12 +1276,12 @@ void grShrineRoute_8020AF38(HSD_GObj* gobj, s32 arg1) pgobj = Ground_801C57A4(); - if (gp->u.shrineroute.symbols[ix] != NULL) { - HSD_GObj** symbols = gp->u.shrineroute.symbols; + if (gp->u.map.symbol[ix] != NULL) { + HSD_GObj** symbol = gp->u.map.symbol; f32 scale; s32 map_id; PAD_STACK(4); - symbolp = &symbols[ix]; + symbolp = &symbol[ix]; map_id = ((Ground*) (*symbolp)->user_data)->map_id; scale = 0.7f; if (map_id == 1) { @@ -1292,7 +1291,7 @@ void grShrineRoute_8020AF38(HSD_GObj* gobj, s32 arg1) } jobj = Ground_801C2CF4(arg1); efSync_Spawn(0x428, gobj, jobj, &scale); - Ground_801C4A08(gp->u.shrineroute.symbols[ix]); + Ground_801C4A08(gp->u.map.symbol[ix]); *symbolp = NULL; if (pgobj != NULL) { ftLib_80086C18(pgobj, 0xB, 0x1E); @@ -1309,16 +1308,14 @@ void grShrineRoute_8020B020(HSD_GObj* gobj, int r4, int r5) comp = r4 - 189; for (i = 0; i < 6; i++) { if (r4 == -1 || i != comp) { - if (gp->u.shrineroute.symbols[i]) { - if (GET_JOBJ(gp->u.shrineroute.symbols[i])) { + if (gp->u.map.symbol[i]) { + if (GET_JOBJ(gp->u.map.symbol[i])) { if (r5) { - HSD_JObjSetFlagsAll( - gp->u.shrineroute.symbols[i]->hsd_obj, - JOBJ_HIDDEN); + HSD_JObjSetFlagsAll(gp->u.map.symbol[i]->hsd_obj, + JOBJ_HIDDEN); } else { - HSD_JObjClearFlagsAll( - gp->u.shrineroute.symbols[i]->hsd_obj, - JOBJ_HIDDEN); + HSD_JObjClearFlagsAll(gp->u.map.symbol[i]->hsd_obj, + JOBJ_HIDDEN); } } } diff --git a/src/melee/gr/types.h b/src/melee/gr/types.h index a0f78ab6d2..5306139586 100644 --- a/src/melee/gr/types.h +++ b/src/melee/gr/types.h @@ -1546,7 +1546,6 @@ struct grShrineroute_GroundVars { /* +0 */ Vec3 offset; /* +C */ HSD_JObj* jobj; } platforms[3]; - /* +44 gp+108 */ HSD_GObj* symbols[6]; }; struct grShrineroute_GroundVars2 { @@ -1611,15 +1610,12 @@ struct ScrollVars { }; struct grHomeRun_GroundVars { - /* +00 gp+C4 */ HSD_GObj** gobjs; - /* +04 gp+C8 */ HSD_GObj** jobj_gobjs; + /* +00 gp+C4 */ HSD_GObj** parts; + /* +04 gp+C8 */ HSD_GObj** back; /* +08 gp+CC */ HSD_Text* xCC; /* +0C gp+D0 */ HSD_JObj* xD0; /* +10 gp+D4 */ HSD_GObj* xD4; - /* +14 gp+D8 */ HSD_GObj* rear_gobj; - /* +18 gp+DC */ HSD_GObj* rear2_gobj; - /* +1C gp+E0 */ HSD_GObj* rear3_gobj; - /* +20 gp+E4 */ HSD_GObj* rear4_gobj; + /* +14 gp+D8 */ HSD_GObj* bg_gobj[4]; /* +24 gp+E8 */ struct { u8 b0 : 1; u8 b1 : 1; @@ -1666,7 +1662,7 @@ struct Map_GroundVars { /* +38 gp+FC */ float xFC; /* +3C gp+100 */ float x100; /* +40 gp+104 */ float x104; - /* +44 gp+108 */ HSD_GObj* symbols[6]; + /* +44 gp+108 */ HSD_GObj* symbol[6]; /* +5C gp+120 */ char pad_5C[0x10]; /* +6C gp+130 */ struct Map_Chikuwa* chikuwa; /* +70 gp+134 */ struct Map_VanishEntry* vanish; diff --git a/src/melee/if/ifnametag.c b/src/melee/if/ifnametag.c index 0ee5381973..397781bd96 100644 --- a/src/melee/if/ifnametag.c +++ b/src/melee/if/ifnametag.c @@ -118,13 +118,13 @@ /// .bss /* 4A1ED0 */ static StaticModelDesc un_804A1ED0; -/* 4A1EE0 */ static HSD_GObj* un_804A1EE0[PL_SLOT_MAX]; -/* 4A1EF8 */ static int un_804A1EF8[PL_SLOT_MAX]; +/* 4A1EE0 */ static HSD_GObj* un_804A1EE0[Gm_Player_NumMax]; +/* 4A1EF8 */ static int un_804A1EF8[Gm_Player_NumMax]; /// .sbss /* 4D6D68 */ static HSD_GObj* un_804D6D68; /* 4D6D6C */ static u8 un_804D6D6C; -/* 4D6D70 */ static u8 un_804D6D70[PL_SLOT_MAX]; +/* 4D6D70 */ static u8 un_804D6D70[Gm_Player_NumMax]; /* 4D6D78 */ static HSD_Text* un_804D6D78; /* 4D6D7C */ static int un_804D6D7C; @@ -162,7 +162,7 @@ void fn_802FCAC4(HSD_GObj* gobj, int pass) { if (ifAll_IsHUDHidden() || un_804D6D6C) { int i; - for (i = 0; i < PL_SLOT_MAX; i++) { + for (i = 0; i < Gm_Player_NumMax; i++) { int do_it; if (Player_GetPlayerSlotType(i) != Gm_PKind_Human || Player_GetNametagSlotID(i) == 0x78) @@ -344,7 +344,7 @@ void un_802FD45C(void) void un_802FD468(void) { int i; - for (i = 0; i < PL_SLOT_MAX; i++) { + for (i = 0; i < Gm_Player_NumMax; i++) { if (un_804A1EE0[i]) { HSD_GObjPLink_80390228(un_804A1EE0[i]); } @@ -363,7 +363,7 @@ void un_802FD4C8(void) HSD_CObj* new_var; int i; PAD_STACK(0x10); - for (i = 0; i < PL_SLOT_MAX; i++) { + for (i = 0; i < Gm_Player_NumMax; i++) { un_804A1EE0[i] = NULL; } un_804D6D68 = NULL; @@ -381,7 +381,7 @@ void un_802FD4C8(void) un_804D6D78->pos_z = -10.0; un_804D6D78->default_alignment = 1; un_802FCBA0(); - for (i = 0; i < PL_SLOT_MAX; i++) { + for (i = 0; i < Gm_Player_NumMax; i++) { NameTag_Create(i); } } diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index fcecd6cac3..8d18a4ade0 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -1188,7 +1188,7 @@ typedef struct itPokemonSpawn_DatAttrs { f32 x1C[6]; f32 x34; s32 x38; - s32 pokemon_spawn_weights[It_Kind_Chicorita_Leaf - It_PKind_Tosakinto]; + s32 pokemon_spawn_weights[It_PKind_Terminate - It_PKind_Start]; u8 _pad[520]; } itPokemonSpawn_DatAttrs; STATIC_ASSERT(sizeof(itPokemonSpawn_DatAttrs) == 0x2BC); diff --git a/src/melee/it/it_279C.c b/src/melee/it/it_279C.c index 60a2413acb..7bf71f9254 100644 --- a/src/melee/it/it_279C.c +++ b/src/melee/it/it_279C.c @@ -1008,17 +1008,17 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { ItemKind it_803F2ED0[22] = { // Common Pokemon - It_PKind_Tosakinto, It_PKind_Chicorita, - It_PKind_Kabigon, It_PKind_Kamex, - It_PKind_Matadogas, It_PKind_Lizardon, - It_PKind_Sonans, It_PKind_Hassam, - It_PKind_Unknown, It_PKind_Kireihana, - It_PKind_Marumine, It_PKind_Metamon, - It_PKind_Pippi, It_PKind_Togepy, - It_PKind_Hitodeman, It_PKind_Lucky, - It_PKind_Porygon2, It_PKind_Hinoarashi, - It_PKind_Maril, It_PKind_Fushigibana, - It_Kind_Chicorita_Leaf, 0x00, + It_PKind_Tosakinto, It_PKind_Chicorita, + It_PKind_Kabigon, It_PKind_Kamex, + It_PKind_Matadogas, It_PKind_Lizardon, + It_PKind_Sonans, It_PKind_Hassam, + It_PKind_Unknown, It_PKind_Kireihana, + It_PKind_Marumine, It_PKind_Metamon, + It_PKind_Pippi, It_PKind_Togepy, + It_PKind_Hitodeman, It_PKind_Lucky, + It_PKind_Porygon2, It_PKind_Hinoarashi, + It_PKind_Maril, It_PKind_Fushigibana, + It_PKind_Terminate, 0x00, }; /// Character-specific items @@ -3968,21 +3968,18 @@ void it_8027A344(Item_GObj* item_gobj) item->x40_vel.y = item->xDD4_itemVar.pokemon_spawn.x4.y; } -#define PK_START (It_PKind_Tosakinto) -#define PK_END (It_PKind_Tosakinto + 30) - s32 it_8027A364(Item* item) { itPokemonSpawn_DatAttrs* attr = item->xC4_article_data->x4_specialAttributes; int ret_val = 1; int i; - int start = It_PKind_Tosakinto; - int end = It_PKind_Tosakinto + 30; + int start = It_PKind_Start; + int end = It_PKind_Terminate; for (i = start; i < end; i++) { if (Item_804A0E24.x != i && Item_804A0E24.y != i) { - ret_val += attr->pokemon_spawn_weights[i - It_PKind_Tosakinto]; + ret_val += attr->pokemon_spawn_weights[i - It_PKind_Start]; } } @@ -4010,15 +4007,15 @@ s32 it_8027A4D4(Item* item) } rand_int = HSD_Randi(it_8027A364(item)); var_r3 = 0; - for (i = PK_START; i < PK_END; i++) { + for (i = It_PKind_Start; i < It_PKind_Terminate; i++) { int y = Item_804A0E24.y; int x = Item_804A0E24.x; if (x != i && y != i) { - var_r3 += attr->pokemon_spawn_weights[i - It_PKind_Tosakinto]; + var_r3 += attr->pokemon_spawn_weights[i - It_PKind_Start]; if (var_r3 >= rand_int) { Item_804A0E24.y = x; Item_804A0E24.x = i; - return i - It_PKind_Tosakinto; + return i - It_PKind_Start; } } } @@ -4051,14 +4048,14 @@ s32 it_8027A780(Item* item, void* arg1) y = Item_804A0E24.y; for (i = 0; i < 30; i++) { ItemKind kind = ((ItemKind*) arg1)[i]; - if (kind == It_Kind_Chicorita_Leaf) { + if (kind == It_PKind_Terminate) { break; } if (x != kind && y != kind) { buf->x = kind; cnt++; buf->y = attr->pokemon_spawn_weights[((ItemKind*) arg1)[i] - - It_PKind_Tosakinto]; + It_PKind_Start]; total += buf->y; buf++; } @@ -4079,7 +4076,7 @@ s32 it_8027A780(Item* item, void* arg1) } Item_804A0E24.y = Item_804A0E24.x; Item_804A0E24.x = result; - return result - It_PKind_Tosakinto; + return result - It_PKind_Start; } s32 it_8027A9B8(Item* item) @@ -4142,7 +4139,7 @@ void it_8027AAA0(Item_GObj* item1_gobj, Item* item2, s32 arg2) static inline s32 it_8027AB64_SpawnWeight(itPokemonSpawn_DatAttrs* attr, s32 index) { - return attr->pokemon_spawn_weights[index - It_PKind_Tosakinto]; + return attr->pokemon_spawn_weights[index - It_PKind_Start]; } static inline s32 it_8027AB64_SelectKind(Item* item) @@ -4157,14 +4154,14 @@ static inline s32 it_8027AB64_SelectKind(Item* item) s32 var_ctr; var_r4 = 0; - index = It_PKind_Tosakinto; + index = It_PKind_Start; for (var_ctr = 30; var_ctr != 0; var_ctr--) { if (recent_x_val != index && recent_y_val != index) { var_r4 += it_8027AB64_SpawnWeight(attr, index); if (var_r4 >= rand_int) { Item_804A0E24.y = recent_x_val; Item_804A0E24.x = index; - return index - It_PKind_Tosakinto; + return index - It_PKind_Start; } } index++; @@ -4186,14 +4183,14 @@ static inline s32 it_8027AB64_SelectKind(Item* item) s32 var_ctr; var_r4 = 0; - index = It_PKind_Tosakinto; + index = It_PKind_Start; for (var_ctr = 30; var_ctr != 0; var_ctr--) { if (recent_x_val != index && recent_y_val != index) { var_r4 += *(spawn_weights - 0x92); if (var_r4 >= rand_int) { Item_804A0E24.y = recent_x_val; Item_804A0E24.x = index; - return index - It_PKind_Tosakinto; + return index - It_PKind_Start; } } spawn_weights++; @@ -4218,7 +4215,7 @@ bool it_8027AB64(Item_GObj* item_gobj) if (temp_r3 == 1) { spawn.kind = it_8027A9B8(item); } else { - spawn.kind = temp_r3 - It_PKind_Tosakinto; + spawn.kind = temp_r3 - It_PKind_Start; } } else if (gm_8018841C()) { spawn.kind = (&it_803F2ED0 == NULL) ? It_PKind_Sonans @@ -4252,7 +4249,7 @@ bool it_8027AB64(Item_GObj* item_gobj) it_8026BB88(item_gobj, &spawn.pos); spawn.x3C_damage = 0; spawn.facing_dir = it_8026B6A8(prev_pos, item2->owner); - spawn.kind = spawn.kind + It_PKind_Tosakinto; + spawn.kind = spawn.kind + It_PKind_Start; spawn.x0_parent_gobj = item2->owner; spawn.x4_parent_gobj2 = item_gobj; spawn.x44_flag.b0 = 1; diff --git a/src/melee/it/item.c b/src/melee/it/item.c index 9f26adcd71..a3be052384 100644 --- a/src/melee/it/item.c +++ b/src/melee/it/item.c @@ -331,7 +331,7 @@ static void Item_802674AC(SpawnItem* spawnItem) return; } - if (kind < It_Kind_Chicorita_Leaf) { + if (kind < It_PKind_Terminate) { spawnItem->hold_kind = 9; return; } @@ -540,14 +540,14 @@ void Item_80267978(HSD_GObj* gobj) // Common items item_data->xC4_article_data = it_804D6D24[item_data->kind]; item_data->xB8_itemLogicTable = &it_803F14C4[item_data->kind]; - } else if (item_data->kind < It_PKind_Tosakinto) { + } else if (item_data->kind < It_PKind_Start) { // Character items int idx = item_data->kind - It_Kind_Kuriboh; item_data->xC4_article_data = it_804D6D38[idx]; item_data->xB8_itemLogicTable = &it_803F3100[idx]; } else if (item_data->kind < It_Kind_Old_Kuri) { // Pokemon - int idx = item_data->kind - It_PKind_Tosakinto; + int idx = item_data->kind - It_PKind_Start; item_data->xC4_article_data = it_804D6D30[idx]; item_data->xB8_itemLogicTable = &it_803F23CC[idx]; } else { @@ -971,13 +971,13 @@ static HSD_GObj* Item_8026862C(SpawnItem* spawnItem) // Common items GObj_SetupGXLink(gobj, it_803F1418[spawnItem->kind].x0_renderFunc, 6, 0); - } else if (spawnItem->kind < It_PKind_Tosakinto) { + } else if (spawnItem->kind < It_PKind_Start) { // Character items int idx = spawnItem->kind - It_Kind_Kuriboh; GObj_SetupGXLink(gobj, it_803F2F28[idx].x0_renderFunc, 6, 0); } else if (spawnItem->kind < It_Kind_Old_Kuri) { // Pokemon - int idx = spawnItem->kind - It_PKind_Tosakinto; + int idx = spawnItem->kind - It_PKind_Start; GObj_SetupGXLink(gobj, it_803F2310[idx].x0_renderFunc, 6, 0); } else { // Stage items diff --git a/src/melee/it/itmaplib.c b/src/melee/it/itmaplib.c index 8568f432e6..79c24e2041 100644 --- a/src/melee/it/itmaplib.c +++ b/src/melee/it/itmaplib.c @@ -204,9 +204,9 @@ void it_80275E98(Item_GObj* item_gobj, SpawnItem* spawn) coll->x34_flags.b1234 = 5; } else if (kind < It_PKind_Random) { coll->x34_flags.b1234 = 5; - } else if (kind < It_PKind_Tosakinto) { + } else if (kind < It_PKind_Start) { coll->x34_flags.b1234 = 5; - } else if (kind < It_Kind_Chicorita_Leaf) { + } else if (kind < It_PKind_Terminate) { coll->x34_flags.b1234 = 5; } else if (kind < It_Kind_Old_Kuri) { coll->x34_flags.b1234 = 4; diff --git a/src/melee/pl/forward.h b/src/melee/pl/forward.h index a97bd62be8..8133920cf9 100644 --- a/src/melee/pl/forward.h +++ b/src/melee/pl/forward.h @@ -1,8 +1,6 @@ #ifndef MELEE_PL_FORWARD_H #define MELEE_PL_FORWARD_H -#define PL_SLOT_MAX 6 - typedef struct StaleMoveTable StaleMoveTable; typedef struct plAllocInfo2 plAllocInfo2; typedef struct plActionStats plActionStats; diff --git a/src/melee/pl/player.c b/src/melee/pl/player.c index f921a67cc1..5e7f285d5f 100644 --- a/src/melee/pl/player.c +++ b/src/melee/pl/player.c @@ -82,7 +82,7 @@ ftMapping ftMapping_list[CHKIND_MAX] = { //////ftMapping_list }; ////.bss -StaticPlayer player_slots[PL_SLOT_MAX]; +StaticPlayer player_slots[Gm_Player_NumMax]; HSD_ObjAllocData Player_AllocData; pl_804D6470_t* pl_804D6470; @@ -96,7 +96,7 @@ static inline bool hasExtraFighterId(ftMapping* data) static inline void Player_CheckSlot(int slot) { - if (slot < 0 || !(slot < PL_SLOT_MAX)) { + if (slot < 0 || !(slot < Gm_Player_NumMax)) { HSD_ASSERTREPORT(102, 0, "cant get player struct! %d\n", slot); } } @@ -2041,7 +2041,7 @@ void Player_InitAllPlayers(void) plStale_InitAttackInstance(); plAttack_80037590(); - for (i = 0; i < PL_SLOT_MAX; i++) { + for (i = 0; i < Gm_Player_NumMax; i++) { Player_InitOrResetPlayer(i); pl_8003891C(i); } diff --git a/src/melee/pl/plbonuslib.c b/src/melee/pl/plbonuslib.c index b2133f694c..5017d5e4bc 100644 --- a/src/melee/pl/plbonuslib.c +++ b/src/melee/pl/plbonuslib.c @@ -549,20 +549,20 @@ void pl_8003E4A4(int slot, bool arg1, void* arg2, int count) { pl_StaleMoveTableExt_t* table = Player_GetStaleMoveTableIndexPtr2(slot); int* moves = arg2; - u32 seen[0x27]; + u32 seen[Pl_ItemLog_Terminate]; int i; - for (i = 0; i < 0x27; i++) { + for (i = 0; i < Pl_ItemLog_Terminate; i++) { seen[i] = 0; } for (i = 0; i < count; i++) { - if (match_item_kind(moves[i]) < 0x27) { + if (match_item_kind(moves[i]) < Pl_ItemLog_Terminate) { seen[match_item_kind(moves[i])] = 1; } } - for (i = 0; i < 0x27; i++) { + for (i = 0; i < Pl_ItemLog_Terminate; i++) { if (seen[i] == 1) { table->x0_staleMoveTable.x7AC[i]++; if ((u32) table->x0_staleMoveTable.x7AC[i] == pl_804D6470->x138) { From cc63d90ef21bef68d62c86d46f363002a69c3481 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 10:51:56 -0700 Subject: [PATCH 05/20] Catch the Pokemon_* uses added upstream since this branch forked Redone with melee-replace-symbols rather than by hand: it walks asm, docs and config as well as src, so it cannot miss a reference the way an ad-hoc pass over src/**/*.{c,h} did. All 35 translation units this branch touches keep loadable section contents identical to upstream/master. --- src/melee/gr/grkinokoroute.c | 4 ++-- src/melee/it/items/ithinoarashi.c | 2 +- src/melee/it/items/ithitodeman.c | 2 +- src/melee/it/items/itlugia.c | 12 ++++++------ src/melee/it/items/itmatadogas.c | 8 ++++---- src/melee/it/items/itunknown.c | 2 +- src/melee/pl/plbonuslib.c | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/melee/gr/grkinokoroute.c b/src/melee/gr/grkinokoroute.c index 61812705e4..06b43bf99e 100644 --- a/src/melee/gr/grkinokoroute.c +++ b/src/melee/gr/grkinokoroute.c @@ -528,7 +528,7 @@ void grKinokoRoute_8020836C(Ground_GObj* gobj, int arg1) mpJointListAdd(0x33); for (cur = HSD_GObj_Entities->items; cur != NULL; cur = cur->next) { - if (itGetKind(cur) == Pokemon_Random) { + if (itGetKind(cur) == It_PKind_Random) { grMaterial_801C8E08(cur); } } @@ -543,7 +543,7 @@ void grKinokoRoute_8020836C(Ground_GObj* gobj, int arg1) mpLib_80057BC0(0x33); for (cur = HSD_GObj_Entities->items; cur != NULL; cur = cur->next) { - if (itGetKind(cur) == Pokemon_Random) { + if (itGetKind(cur) == It_PKind_Random) { grMaterial_801C8E28(cur); } } diff --git a/src/melee/it/items/ithinoarashi.c b/src/melee/it/items/ithinoarashi.c index b8e0484573..3a068fab5b 100644 --- a/src/melee/it/items/ithinoarashi.c +++ b/src/melee/it/items/ithinoarashi.c @@ -266,7 +266,7 @@ void it_802D64B8(HSD_GObj* gobj, Vec3* pos, u32 arg2, f32 facing_dir) Item* ip = GET_ITEM(gobj); SpawnItem spawn; - spawn.kind = Pokemon_Hinoarashi_Flame; + spawn.kind = It_Kind_Hinoarashi_Flame; spawn.prev_pos = *pos; spawn.prev_pos.z = 0.0f; it_8026BB88(gobj, &spawn.pos); diff --git a/src/melee/it/items/ithitodeman.c b/src/melee/it/items/ithitodeman.c index 6bd3f10beb..b3c105772d 100644 --- a/src/melee/it/items/ithitodeman.c +++ b/src/melee/it/items/ithitodeman.c @@ -379,7 +379,7 @@ void it_802D4C74(Item_GObj* gobj) spawn.vel.x = spawn.facing_dir * attrs->x50; spawn.vel.y = 0.0f; spawn.vel.z = 0.0f; - spawn.kind = Pokemon_Hitodeman_Star; + spawn.kind = It_Kind_Hitodeman_Star; spawn.x0_parent_gobj = ip->owner; spawn.x4_parent_gobj2 = gobj; spawn.x44_flag.b0 = false; diff --git a/src/melee/it/items/itlugia.c b/src/melee/it/items/itlugia.c index 0262bb43a8..2dc2fcd2bf 100644 --- a/src/melee/it/items/itlugia.c +++ b/src/melee/it/items/itlugia.c @@ -335,7 +335,7 @@ void it_802D1BBC(Item_GObj* gobj) if (ip->xDD4_itemVar.lugia.xE50.y >= 1.0) { ip->xDD4_itemVar.lugia.xE50.y = (ip->xDD4_itemVar.lugia.xE50.y - 1.0); - it_802D1E8C(gobj, Pokemon_Lugia_Aeroblast, attrs->x1C); + it_802D1E8C(gobj, It_Kind_Lugia_Aeroblast, attrs->x1C); switch (HSD_Randi(3)) { case 0: Item_8026AE84(ip, 0x274D, 0x7F, 0x40); @@ -352,12 +352,12 @@ void it_802D1BBC(Item_GObj* gobj) if (ip->xDD4_itemVar.lugia.xE50.z >= 1.0) { ip->xDD4_itemVar.lugia.xE50.z = (ip->xDD4_itemVar.lugia.xE50.z - 1.0); - it_802D1E8C(gobj, Pokemon_Lugia_Aeroblast2, attrs->x24); + it_802D1E8C(gobj, It_Kind_Lugia_Aeroblast2, attrs->x24); } if (ip->xDD4_itemVar.lugia.x88 >= 1.0) { ip->xDD4_itemVar.lugia.x88 = (ip->xDD4_itemVar.lugia.x88 - 1.0); - it_802D1E8C(gobj, Pokemon_Lugia_Aeroblast3, attrs->x2C); + it_802D1E8C(gobj, It_Kind_Lugia_Aeroblast3, attrs->x2C); } } } @@ -530,13 +530,13 @@ void it_802D24A0(Item_GObj* gobj) f32 multiplier = 0.0f; switch (ip->kind) { - case Pokemon_Lugia_Aeroblast: + case It_Kind_Lugia_Aeroblast: multiplier = attrs[1]; break; - case Pokemon_Lugia_Aeroblast2: + case It_Kind_Lugia_Aeroblast2: multiplier = attrs[2]; break; - case Pokemon_Lugia_Aeroblast3: + case It_Kind_Lugia_Aeroblast3: multiplier = attrs[3]; break; default: diff --git a/src/melee/it/items/itmatadogas.c b/src/melee/it/items/itmatadogas.c index 5a98fc1169..dc6c7a7dc0 100644 --- a/src/melee/it/items/itmatadogas.c +++ b/src/melee/it/items/itmatadogas.c @@ -98,9 +98,9 @@ void it_802CB2B0(Item_GObj* gobj) if (--ip->xDD4_itemVar.matadogas.x60 == 0) { ip->xDD4_itemVar.matadogas.x60 = attrs->x4; if (HSD_Randi(2) == 0) { - it_802CB4F0(gobj, Pokemon_Matadogas_Gas1, attrs->x8); + it_802CB4F0(gobj, It_Kind_Matadogas_Gas1, attrs->x8); } else { - it_802CB4F0(gobj, Pokemon_Matadogas_Gas2, attrs->xC); + it_802CB4F0(gobj, It_Kind_Matadogas_Gas2, attrs->xC); } } } @@ -248,10 +248,10 @@ void it_802CB844(Item_GObj* gobj) itMatadogasAttributes* attrs = ip->xC4_article_data->x4_specialAttributes; switch (kind) { - case Pokemon_Matadogas_Gas1: + case It_Kind_Matadogas_Gas1: scale = attrs->x4; break; - case Pokemon_Matadogas_Gas2: + case It_Kind_Matadogas_Gas2: scale = attrs->x8; break; } diff --git a/src/melee/it/items/itunknown.c b/src/melee/it/items/itunknown.c index 6499606636..5a53cb7043 100644 --- a/src/melee/it/items/itunknown.c +++ b/src/melee/it/items/itunknown.c @@ -243,7 +243,7 @@ void it_802CED54(Item_GObj* gobj) spawn.x3C_damage = 0; spawn.vel = ip->xDD4_itemVar.unknown.x78.vec; spawn.x40 = 0; - spawn.kind = Pokemon_Unknown_Swarm; + spawn.kind = It_Kind_Unknown_Swarm; spawn.x0_parent_gobj = ip->owner; spawn.x4_parent_gobj2 = gobj; spawn.x44_flag.b0 = false; diff --git a/src/melee/pl/plbonuslib.c b/src/melee/pl/plbonuslib.c index 5017d5e4bc..3196060909 100644 --- a/src/melee/pl/plbonuslib.c +++ b/src/melee/pl/plbonuslib.c @@ -531,7 +531,7 @@ inline int match_item_kind(int kind) return kind; } else { switch (kind) { - case Pokemon_Lucky_Egg: + case It_Kind_Lucky_Egg: return 0x23; case It_Kind_WhispyApple: return 0x24; From 259bc798086f5fc480ed7d0d9a5e7e4380a2c95f Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 11:12:08 -0700 Subject: [PATCH 06/20] Address review: doc-comment style, static common_pokemon --- config/GALE01/symbols.txt | 2 +- src/melee/it/forward.h | 104 +++++++++++++++++++------------------- src/melee/it/it_279C.c | 25 ++++----- src/melee/it/it_279C.h | 1 - 4 files changed, 64 insertions(+), 68 deletions(-) diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index f6d01d93ec..08da69890e 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -23875,7 +23875,7 @@ it_803F22A8 = .data:0x803F22A8; // type:object size:0x40 scope:global @188 = .data:0x803F2300; // type:object size:0xD scope:local data:string it_803F2310 = .data:0x803F2310; // type:object size:0xBC scope:global it_803F23CC = .data:0x803F23CC; // type:object size:0xB04 scope:global -it_803F2ED0 = .data:0x803F2ED0; // type:object size:0x58 scope:global +common_pokemon = .data:0x803F2ED0; // type:object size:0x58 scope:local it_803F2F28 = .data:0x803F2F28; // type:object size:0x1D8 scope:global it_803F3100 = .data:0x803F3100; // type:object size:0x1BA8 scope:global it_803F4CA8 = .data:0x803F4CA8; // type:object size:0x78 scope:global diff --git a/src/melee/it/forward.h b/src/melee/it/forward.h index c44518f425..9c2642343f 100644 --- a/src/melee/it/forward.h +++ b/src/melee/it/forward.h @@ -282,61 +282,61 @@ typedef enum ItemKind { // POKEMON - /* 0xA0 */ It_PKind_Random, // Used for Random Pokemon value - /// First Poke Ball Pokemon, named by an assert in #pl_8003E70C. - /* 0xA1 */ It_PKind_Start, - /* 0xA1 */ It_PKind_Tosakinto = It_PKind_Start, // Goldeen (Tosakinto) - /* 0xA2 */ It_PKind_Chicorita, // Chikorita (Chicorita) - /* 0xA3 */ It_PKind_Kabigon, // Snorlax (Kabigon) - /* 0xA4 */ It_PKind_Kamex, // Blastoise (Kamex) - /* 0xA5 */ It_PKind_Matadogas, // Weezing (Matadogas) - /* 0xA6 */ It_PKind_Lizardon, // Charizard (Lizardon) - /* 0xA7 */ It_PKind_Fire, // Moltres (Fire) - /* 0xA8 */ It_PKind_Thunder, // Zapdos (Thunder) - /* 0xA9 */ It_PKind_Freezer, // Articuno (Freezer) - /* 0xAA */ It_PKind_Sonans, // Wobbuffet (Sonans) - /* 0xAB */ It_PKind_Hassam, // Scizor (Hassam) - /* 0xAC */ It_PKind_Unknown, // Unown (Unknown) - /* 0xAD */ It_PKind_Entei, // Entei - /* 0xAE */ It_PKind_Raikou, // Raikou - /* 0xAF */ It_PKind_Suikun, // Suicune (Suikun) - /* 0xB0 */ It_PKind_Kireihana, // Bellossom (Kireihana) - /* 0xB1 */ It_PKind_Marumine, // Electrode (Marumine) - /* 0xB2 */ It_PKind_Lugia, // Lugia - /* 0xB3 */ It_PKind_Houou, // Ho-oh (Houou) - /* 0xB4 */ It_PKind_Metamon, // Ditto (Metamon) - /* 0xB5 */ It_PKind_Pippi, // Clefairy (Pippi) - /* 0xB6 */ It_PKind_Togepy, // Togepi (Togepy) - /* 0xB7 */ It_PKind_Mew, // Mew - /* 0xB8 */ It_PKind_Cerebi, // Celebi (Cerebi) - /* 0xB9 */ It_PKind_Hitodeman, // Staryu (Hitodeman) - /* 0xBA */ It_PKind_Lucky, // Chansey (Lucky) - /* 0xBB */ It_PKind_Porygon2, // Porygon2 - /* 0xBC */ It_PKind_Hinoarashi, // Cyndaquil (Hinoarashi) - /* 0xBD */ It_PKind_Maril, // Marill (Maril) - /* 0xBE */ It_PKind_Fushigibana, // Venusaur (Fushigibana) - /// One past the last Poke Ball Pokemon. - /* 0xBF */ It_PKind_Terminate, + /* 0xA0 */ It_PKind_Random, ///< Used for Random Pokemon value + /* 0xA1 */ It_PKind_Start, ///< First Poke Ball Pokemon, named by an + ///< assert in #pl_8003E70C. + /* 0xA1 */ It_PKind_Tosakinto = It_PKind_Start, ///< Goldeen (Tosakinto) + /* 0xA2 */ It_PKind_Chicorita, ///< Chikorita (Chicorita) + /* 0xA3 */ It_PKind_Kabigon, ///< Snorlax (Kabigon) + /* 0xA4 */ It_PKind_Kamex, ///< Blastoise (Kamex) + /* 0xA5 */ It_PKind_Matadogas, ///< Weezing (Matadogas) + /* 0xA6 */ It_PKind_Lizardon, ///< Charizard (Lizardon) + /* 0xA7 */ It_PKind_Fire, ///< Moltres (Fire) + /* 0xA8 */ It_PKind_Thunder, ///< Zapdos (Thunder) + /* 0xA9 */ It_PKind_Freezer, ///< Articuno (Freezer) + /* 0xAA */ It_PKind_Sonans, ///< Wobbuffet (Sonans) + /* 0xAB */ It_PKind_Hassam, ///< Scizor (Hassam) + /* 0xAC */ It_PKind_Unknown, ///< Unown (Unknown) + /* 0xAD */ It_PKind_Entei, ///< Entei + /* 0xAE */ It_PKind_Raikou, ///< Raikou + /* 0xAF */ It_PKind_Suikun, ///< Suicune (Suikun) + /* 0xB0 */ It_PKind_Kireihana, ///< Bellossom (Kireihana) + /* 0xB1 */ It_PKind_Marumine, ///< Electrode (Marumine) + /* 0xB2 */ It_PKind_Lugia, ///< Lugia + /* 0xB3 */ It_PKind_Houou, ///< Ho-oh (Houou) + /* 0xB4 */ It_PKind_Metamon, ///< Ditto (Metamon) + /* 0xB5 */ It_PKind_Pippi, ///< Clefairy (Pippi) + /* 0xB6 */ It_PKind_Togepy, ///< Togepi (Togepy) + /* 0xB7 */ It_PKind_Mew, ///< Mew + /* 0xB8 */ It_PKind_Cerebi, ///< Celebi (Cerebi) + /* 0xB9 */ It_PKind_Hitodeman, ///< Staryu (Hitodeman) + /* 0xBA */ It_PKind_Lucky, ///< Chansey (Lucky) + /* 0xBB */ It_PKind_Porygon2, ///< Porygon2 + /* 0xBC */ It_PKind_Hinoarashi, ///< Cyndaquil (Hinoarashi) + /* 0xBD */ It_PKind_Maril, ///< Marill (Maril) + /* 0xBE */ It_PKind_Fushigibana, ///< Venusaur (Fushigibana) + /* 0xBF */ It_PKind_Terminate, ///< One past the last Poke Ball Pokemon. // POKEMON-RELATED - /* 0xBF */ It_Kind_Chicorita_Leaf = It_PKind_Terminate, // Chikorita's Leaf - /* 0xC0 */ It_Kind_Kamex_HydroPump, // Blastoise's Water - /* 0xC1 */ It_Kind_Matadogas_Gas1, // Weezing's Gas - /* 0xC2 */ It_Kind_Matadogas_Gas2, // Weezing's Gas - /* 0xC3 */ It_Kind_Lizardon_Flame1, // Charizard's Breath - /* 0xC4 */ It_Kind_Lizardon_Flame2, // Charizard's Breath - /* 0xC5 */ It_Kind_Lizardon_Flame3, // Charizard's Breath - /* 0xC6 */ It_Kind_Lizardon_Flame4, // Charizard's Breath - /* 0xC7 */ It_Kind_Unknown_Swarm, // Mini-Unowns - /* 0xC8 */ It_Kind_Lugia_Aeroblast, // Lugia's Aeroblast - /* 0xC9 */ It_Kind_Lugia_Aeroblast2, // Lugia's Aeroblast - /* 0xCA */ It_Kind_Lugia_Aeroblast3, // Lugia's Aeroblast - /* 0xCB */ It_Kind_Houou_SacredFire, // Ho-Oh's Flame - /* 0xCC */ It_Kind_Hitodeman_Star, // Staryu's Star - /* 0xCD */ It_Kind_Lucky_Egg, // Chansey's Healing Egg - /* 0xCE */ It_Kind_Hinoarashi_Flame, // Cyndaquil's Fire - /* 0xCF */ It_Kind_Pokemon_Unk, // ??? + /* 0xBF */ It_Kind_Chicorita_Leaf = + It_PKind_Terminate, ///< Chikorita's Leaf + /* 0xC0 */ It_Kind_Kamex_HydroPump, ///< Blastoise's Water + /* 0xC1 */ It_Kind_Matadogas_Gas1, ///< Weezing's Gas + /* 0xC2 */ It_Kind_Matadogas_Gas2, ///< Weezing's Gas + /* 0xC3 */ It_Kind_Lizardon_Flame1, ///< Charizard's Breath + /* 0xC4 */ It_Kind_Lizardon_Flame2, ///< Charizard's Breath + /* 0xC5 */ It_Kind_Lizardon_Flame3, ///< Charizard's Breath + /* 0xC6 */ It_Kind_Lizardon_Flame4, ///< Charizard's Breath + /* 0xC7 */ It_Kind_Unknown_Swarm, ///< Mini-Unowns + /* 0xC8 */ It_Kind_Lugia_Aeroblast, ///< Lugia's Aeroblast + /* 0xC9 */ It_Kind_Lugia_Aeroblast2, ///< Lugia's Aeroblast + /* 0xCA */ It_Kind_Lugia_Aeroblast3, ///< Lugia's Aeroblast + /* 0xCB */ It_Kind_Houou_SacredFire, ///< Ho-Oh's Flame + /* 0xCC */ It_Kind_Hitodeman_Star, ///< Staryu's Star + /* 0xCD */ It_Kind_Lucky_Egg, ///< Chansey's Healing Egg + /* 0xCE */ It_Kind_Hinoarashi_Flame, ///< Cyndaquil's Fire + /* 0xCF */ It_Kind_Pokemon_Unk, ///< ??? // MONSTERS 2 diff --git a/src/melee/it/it_279C.c b/src/melee/it/it_279C.c index 7bf71f9254..04bd55b5d1 100644 --- a/src/melee/it/it_279C.c +++ b/src/melee/it/it_279C.c @@ -1006,19 +1006,15 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { }, }; -ItemKind it_803F2ED0[22] = { +static ItemKind common_pokemon[22] = { // Common Pokemon - It_PKind_Tosakinto, It_PKind_Chicorita, - It_PKind_Kabigon, It_PKind_Kamex, - It_PKind_Matadogas, It_PKind_Lizardon, - It_PKind_Sonans, It_PKind_Hassam, - It_PKind_Unknown, It_PKind_Kireihana, - It_PKind_Marumine, It_PKind_Metamon, - It_PKind_Pippi, It_PKind_Togepy, - It_PKind_Hitodeman, It_PKind_Lucky, - It_PKind_Porygon2, It_PKind_Hinoarashi, - It_PKind_Maril, It_PKind_Fushigibana, - It_PKind_Terminate, 0x00, + It_PKind_Tosakinto, It_PKind_Chicorita, It_PKind_Kabigon, + It_PKind_Kamex, It_PKind_Matadogas, It_PKind_Lizardon, + It_PKind_Sonans, It_PKind_Hassam, It_PKind_Unknown, + It_PKind_Kireihana, It_PKind_Marumine, It_PKind_Metamon, + It_PKind_Pippi, It_PKind_Togepy, It_PKind_Hitodeman, + It_PKind_Lucky, It_PKind_Porygon2, It_PKind_Hinoarashi, + It_PKind_Maril, It_PKind_Fushigibana, It_PKind_Terminate, }; /// Character-specific items @@ -4218,8 +4214,9 @@ bool it_8027AB64(Item_GObj* item_gobj) spawn.kind = temp_r3 - It_PKind_Start; } } else if (gm_8018841C()) { - spawn.kind = (&it_803F2ED0 == NULL) ? It_PKind_Sonans - : it_8027A780(item, &it_803F2ED0); + spawn.kind = (&common_pokemon == NULL) + ? It_PKind_Sonans + : it_8027A780(item, &common_pokemon); } else if (gm_GetCurrentGameMode() == GM_OPENING_MV) { spawn.kind = it_8027AB64_SelectKind(item); } else { diff --git a/src/melee/it/it_279C.h b/src/melee/it/it_279C.h index e8801d2e2a..71cf714e1c 100644 --- a/src/melee/it/it_279C.h +++ b/src/melee/it/it_279C.h @@ -43,7 +43,6 @@ /* 27B564 */ void it_8027B564(Item_GObj*); /* 3F2310 */ extern struct sdata_ItemGXLink it_803F2310[47]; /* 3F23CC */ extern struct ItemLogicTable it_803F23CC[47]; -/* 3F2ED0 */ extern ItemKind it_803F2ED0[22]; /* 3F2F28 */ extern struct sdata_ItemGXLink it_803F2F28[118]; /* 3F3100 */ extern struct ItemLogicTable it_803F3100[118]; /* 3F4CA8 */ extern struct sdata_ItemGXLink it_803F4CA8[30]; From 3889fb32e377975b3f6861f481f8f90e335221d8 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 11:40:38 -0700 Subject: [PATCH 07/20] Convert the lbmemory, mnhyaku, and grshrineroute asserts lbmemory.c: all 11 raw __assert sites become HSD_ASSERT/HSD_ASSERTREPORT. The assert strings recover the module's _p() accessor idiom, the free_heap/free_mem/a_arenaLo/a_arenaHi field names, the memp_kouho and p locals, and lbMemFreeToHeap's original name (from its error message). The 0x14F/0x188 string-pool order requires the mgr setup to be a static helper defined above lbMemory_80015320, which also reproduces the target's destructive allocator-base reuse (96.1% -> 96.65%). mnhyaku.c: the allocMenu helper is a decomp invention; flattening it into mnHyaku_8024CB94 lets HSD_ASSERTREPORT match exactly (the local is named user_data, which is why the message says so). grshrineroute.c: the (u32) cast only exists to keep the two symbol[ix] address computations from merging; moving it to the unconstrained mid line makes the assert string-exact. --- config/GALE01/symbols.txt | 2 +- src/melee/gr/grshrineroute.c | 7 +- src/melee/lb/lbheap.c | 2 +- src/melee/lb/lbmemory.c | 223 ++++++++++++++--------------------- src/melee/lb/lbmemory.h | 2 +- src/melee/mn/mnhyaku.c | 26 ++-- 6 files changed, 104 insertions(+), 158 deletions(-) diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index 08da69890e..a775203665 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -320,7 +320,7 @@ lbMemory_80014E24 = .text:0x80014E24; // type:function size:0xC8 scope:global lbMemory_80014EEC = .text:0x80014EEC; // type:function size:0x90 scope:global lbMemory_80014F7C = .text:0x80014F7C; // type:function size:0x4C scope:global lbMemory_80014FC8 = .text:0x80014FC8; // type:function size:0x128 scope:global -lbMemory_800150F0 = .text:0x800150F0; // type:function size:0x94 scope:global +lbMemFreeToHeap = .text:0x800150F0; // type:function size:0x94 scope:global fn_80015184 = .text:0x80015184; // type:function size:0x118 lbMemory_8001529C = .text:0x8001529C; // type:function size:0x84 scope:global lbMemory_80015320 = .text:0x80015320; // type:function size:0x19C scope:global diff --git a/src/melee/gr/grshrineroute.c b/src/melee/gr/grshrineroute.c index 23eadc7799..c084791edc 100644 --- a/src/melee/gr/grshrineroute.c +++ b/src/melee/gr/grshrineroute.c @@ -408,11 +408,10 @@ void grShrineRoute_80208F70(Ground_GObj* gobj) ix = result - 0xBD; if (!(gp->u.shrineroute.xC6 & (1 << ix))) { gp->u.shrineroute.xC8 = (u16) result; - HSD_ASSERTMSG(0x213, gp->u.map.symbol[(u32) ix], - "gp->u.map.symbol[ix]"); + HSD_ASSERT(0x213, gp->u.map.symbol[ix]); { - s32 mid = - ((Ground*) gp->u.map.symbol[ix]->user_data)->map_id; + s32 mid = ((Ground*) gp->u.map.symbol[(u32) ix]->user_data) + ->map_id; if (player != NULL) { Player_80031790((s32) ftLib_80086BE0(player)); } diff --git a/src/melee/lb/lbheap.c b/src/melee/lb/lbheap.c index 6329c86582..105c9e5f9c 100644 --- a/src/melee/lb/lbheap.c +++ b/src/melee/lb/lbheap.c @@ -215,7 +215,7 @@ void lbHeap_80015CA8(int arg0, void* arg1) HSD_Free(arg1); HSD_SetHeap(cur_heap); } else { - lbMemory_800150F0(p->handle, arg1); + lbMemFreeToHeap(p->handle, arg1); } OSRestoreInterrupts(enabled); } diff --git a/src/melee/lb/lbmemory.c b/src/melee/lb/lbmemory.c index 416ba0207f..2b7a3587a0 100644 --- a/src/melee/lb/lbmemory.c +++ b/src/melee/lb/lbmemory.c @@ -23,14 +23,14 @@ struct LBMgr { }; struct Allocator { - void* x0_arenaLo; - void* x4_arenaHi; + void* a_arenaLo; + void* a_arenaHi; struct MemEntry x8_mem[0x83]; - Handle* x62C_free_mem; + Handle* free_mem; s32 x630_num_allocs; s32 x634_max_num_allocs; Handle x638_heap[6]; - Handle* x698_free_heap; + Handle* free_heap; Handle* x69C; struct LBMgr x6A0_mgr; u32 x6E0; @@ -42,7 +42,7 @@ struct Allocator { /* 015320 */ void lbMemory_80015320(int, Handle*, int, int); struct Allocator lbMemory_804318B0; -#define g_alloc lbMemory_804318B0 +#define _p(x) (lbMemory_804318B0.x) STATIC_ASSERT(sizeof(struct MemEntry) == 0xC); STATIC_ASSERT(sizeof(lbMemory_804318B0) == 0x6F0); @@ -57,41 +57,16 @@ STATIC_ASSERT(sizeof(lbMemory_804318B0) == 0x6F0); *list = handle->x0_next; \ } while (0) -static char lbl_803BA2C0[0xB] = "lbmemory.c"; -static char lbl_803BA2CC[0xE] = "_p(free_heap)"; -static char lbl_803BA2DC[0x49] = - "(u32)arenaLo >= (u32)_p(a_arenaLo) && (u32)arenaHi <= " - "(u32)_p(a_arenaHi)"; -static char lbl_803BA328[0xD] = "_p(free_mem)"; -static char lbl_803BA338[0xB] = "memp_kouho"; -static char lbl_803BA344[0x24] = "[LbMem] Error: lbMemFreeToHeap %x.\n"; -static char lbl_803BA368[0x18] = "!p->size\0\0\0\0!cancelflag"; - -SDATA char lbMemory_804D3788[7] = "handle"; -SDATA char lbMemory_804D3790[2] = "0"; -SDATA char lbMemory_804D3794[8] = "p->size"; - static inline Handle* new_handle(void* arenaLo, void* arenaHi) { Handle* h; - if (g_alloc.x698_free_heap == NULL) { - __assert(lbl_803BA2C0, 0x7BU, lbl_803BA2CC); - } - // assert_arena_in_bounds(arenaLo, arenaHi); + HSD_ASSERT(0x7B, _p(free_heap)); if (((u32) arenaLo < 0x80000000U) && ((u32) arenaHi < 0x80000000U)) { - int ok = 0; - if (((u32) arenaLo >= (u32) g_alloc.x0_arenaLo) && - ((u32) arenaHi <= (u32) g_alloc.x4_arenaHi)) - { - ok = 1; - } - if (ok == 0) { - __assert(lbl_803BA2C0, 0x80U, lbl_803BA2DC); - } + HSD_ASSERT(0x80, (u32)arenaLo >= (u32)_p(a_arenaLo) && (u32)arenaHi <= (u32)_p(a_arenaHi)); } - POP_HANDLE(&g_alloc.x698_free_heap, h); + POP_HANDLE(&_p(free_heap), h); h->x0_next = NULL; h->x4_lo = arenaLo; h->x8_hi = arenaHi; @@ -108,16 +83,14 @@ void lbMemory_80014EEC(Handle* handle) { Handle* iter; Handle* tmp_next; - if (handle == NULL) { - __assert(lbl_803BA2C0, 0x95U, lbMemory_804D3788); - } + HSD_ASSERT(149, handle); for (iter = handle->xC_prev; iter != NULL;) { tmp_next = iter->x0_next; - PUSH_HANDLE(&g_alloc.x62C_free_mem, iter); + PUSH_HANDLE(&_p(free_mem), iter); iter = tmp_next; - g_alloc.x630_num_allocs -= 1; + _p(x630_num_allocs) -= 1; } - PUSH_HANDLE(&g_alloc.x698_free_heap, handle); + PUSH_HANDLE(&_p(free_heap), handle); } u32 lbMemory_80014F7C(Handle* h) @@ -141,7 +114,7 @@ u32 lbMemory_80014F7C(Handle* h) Handle* lbMemory_80014FC8(Handle* arg0, u32 size) { void* lo; - Handle* memp_candidate; + Handle* memp_kouho; void* end; u32 least_leftover; u32 aligned_size; @@ -151,13 +124,11 @@ Handle* lbMemory_80014FC8(Handle* arg0, u32 size) Handle* iter; least_leftover = 0x40000000U; - if (g_alloc.x62C_free_mem == NULL) { - __assert(lbl_803BA2C0, 0xCCU, lbl_803BA328); - } + HSD_ASSERT(0xCC, _p(free_mem)); aligned_size = ((size + 0x1F) & 0xFFFFFFE0); start = arg0->x4_lo; iter = (Handle*) &arg0->xC_prev; - memp_candidate = NULL; + memp_kouho = NULL; while (1) { end = (iter->x0_next != NULL) ? iter->x0_next->x4_lo : arg0->x8_hi; @@ -167,7 +138,7 @@ Handle* lbMemory_80014FC8(Handle* arg0, u32 size) if (leftover <= least_leftover) { least_leftover = leftover; lo = start; - memp_candidate = iter; + memp_kouho = iter; } } if (iter->x0_next == NULL) { @@ -177,26 +148,24 @@ Handle* lbMemory_80014FC8(Handle* arg0, u32 size) start = (void*) ((u32) iter->x4_lo + (u32) iter->x8_hi); } } - if (memp_candidate == NULL) { - __assert(lbl_803BA2C0, 0xE9U, lbl_803BA338); - } + HSD_ASSERT(0xE9, memp_kouho); { Handle* result; - POP_HANDLE(&g_alloc.x62C_free_mem, result); + POP_HANDLE(&_p(free_mem), result); result->x8_hi = (void*) aligned_size; result->x4_lo = lo; - result->x0_next = memp_candidate->x0_next; - memp_candidate->x0_next = result; + result->x0_next = memp_kouho->x0_next; + memp_kouho->x0_next = result; - g_alloc.x630_num_allocs += 1; - if (g_alloc.x630_num_allocs > g_alloc.x634_max_num_allocs) { - g_alloc.x634_max_num_allocs = g_alloc.x630_num_allocs; + _p(x630_num_allocs) += 1; + if (_p(x630_num_allocs) > _p(x634_max_num_allocs)) { + _p(x634_max_num_allocs) = _p(x630_num_allocs); } return result; } } -void lbMemory_800150F0(Handle* h, void* arg1) +void lbMemFreeToHeap(Handle* h, void* arg1) { Handle* handle = h->xC_prev; Handle* r6 = (Handle*) &h->xC_prev; @@ -204,43 +173,41 @@ void lbMemory_800150F0(Handle* h, void* arg1) while (handle != NULL) { if (handle->x4_lo == arg1) { r6->x0_next = handle->x0_next; - PUSH_HANDLE(&g_alloc.x62C_free_mem, handle); - g_alloc.x630_num_allocs -= 1; + PUSH_HANDLE(&_p(free_mem), handle); + _p(x630_num_allocs) -= 1; return; } r6 = handle; handle = handle->x0_next; } - OSReport(lbl_803BA344, arg1); - __assert(lbl_803BA2C0, 283, lbMemory_804D3790); + OSReport("[LbMem] Error: lbMemFreeToHeap %x.\n", arg1); + HSD_ASSERT(283, 0); } void fn_80015184(OSAlarm* alarm, OSContext* context) { - struct LBMgr* temp_r3; + struct LBMgr* p; u32 temp_r3_2; u32 temp_r6; u32 var_r30; - temp_r3 = &g_alloc.x6A0_mgr; - if ((u32) temp_r3->size == 0U) { - __assert(lbl_803BA2C0, 0x127U, lbMemory_804D3794); - } - temp_r6 = temp_r3->offset; - temp_r3_2 = temp_r3->size - temp_r6; + p = &_p(x6A0_mgr); + HSD_ASSERT(0x127, p->size); + temp_r6 = p->offset; + temp_r3_2 = p->size - temp_r6; var_r30 = temp_r3_2; if (temp_r3_2 > 0x19000U) { var_r30 = 0x19000; } - memcpy(temp_r3->dst + temp_r6, temp_r3->src + temp_r6, var_r30); - temp_r3->offset = temp_r3->offset + var_r30; - if (temp_r3->offset == temp_r3->size) { - temp_r3->size = 0U; - temp_r3->cb(0, temp_r3->cb_arg, 0, 0); + memcpy(p->dst + temp_r6, p->src + temp_r6, var_r30); + p->offset = p->offset + var_r30; + if (p->offset == p->size) { + p->size = 0U; + p->cb(0, p->cb_arg, 0, 0); return; } - OSCreateAlarm(&temp_r3->alarm); - OSSetAlarm(&temp_r3->alarm, OSMillisecondsToTicks(3), fn_80015184); + OSCreateAlarm(&p->alarm); + OSSetAlarm(&p->alarm, OSMillisecondsToTicks(3), fn_80015184); } u32 lbMemory_8001529C(Handle* h, void* arg1, u32 arg2) @@ -249,11 +216,11 @@ u32 lbMemory_8001529C(Handle* h, void* arg1, u32 arg2) Handle* iter; void** r7; - g_alloc.x6E8 = arg1; - g_alloc.x6E0 = arg2; - g_alloc.x6E4 = h->x4_lo; + _p(x6E8) = arg1; + _p(x6E0) = arg2; + _p(x6E4) = h->x4_lo; - r7 = &g_alloc.x6E4; + r7 = &_p(x6E4); for (iter = h->xC_prev; iter != NULL; iter = iter->x0_next) { lo = iter->x4_lo; @@ -266,24 +233,33 @@ u32 lbMemory_8001529C(Handle* h, void* arg1, u32 arg2) return 0; } +static void start_ram_copy(u32 old, u32 current, u32 size, Handle* next) +{ + struct LBMgr* p = &_p(x6A0_mgr); + int enabled = OSDisableInterrupts(); + + HSD_ASSERT(0x14F, !p->size); + p->src = (u8*) old; + p->dst = (u8*) current; + p->size = size; + p->offset = 0; + p->cb_arg = (u32) next; + p->cb = (void (*)(u32, u32, u32, u32))(Event) lbMemory_80015320; + OSRestoreInterrupts(enabled); + OSCreateAlarm(&p->alarm); + OSSetAlarm(&p->alarm, OSMillisecondsToTicks(3), fn_80015184); +} + void lbMemory_80015320(int arg0, Handle* handle, int arg2, int cancelflag) { - struct Allocator* alloc; - struct LBMgr* mgr; - int enabled; void** currentp; - u32 size; u32 current; u32 old; - Handle* next; - alloc = &g_alloc; - currentp = &alloc->x6E4; - current = (u32) alloc->x6E4; + currentp = &_p(x6E4); + current = (u32) _p(x6E4); - if (cancelflag != 0) { - __assert(lbl_803BA2C0, 0x188U, &lbl_803BA368[0xC]); - } + HSD_ASSERT(0x188, !cancelflag); if (handle != NULL) { if ((old = (u32) handle->x4_lo) != current) { @@ -297,24 +273,9 @@ void lbMemory_80015320(int arg0, Handle* handle, int arg2, int cancelflag) handle->x0_next); return; } else { - mgr = &alloc->x6A0_mgr; - next = handle->x0_next; - size = ((u32) handle->x8_hi + 0x1F) & 0xFFFFFFE0; - enabled = OSDisableInterrupts(); - - if (mgr->size != 0) { - __assert(lbl_803BA2C0, 0x14FU, lbl_803BA368); - } - mgr->src = (u8*) old; - mgr->dst = (u8*) current; - mgr->size = size; - mgr->offset = 0; - mgr->cb_arg = (u32) next; - mgr->cb = - (void (*)(u32, u32, u32, u32))(Event) lbMemory_80015320; - OSRestoreInterrupts(enabled); - OSCreateAlarm(&mgr->alarm); - OSSetAlarm(&mgr->alarm, OSMillisecondsToTicks(3), fn_80015184); + start_ram_copy(old, current, + ((u32) handle->x8_hi + 0x1F) & 0xFFFFFFE0, + handle->x0_next); return; } } @@ -324,40 +285,38 @@ void lbMemory_80015320(int arg0, Handle* handle, int arg2, int cancelflag) return; } - ((void (*)(u32)) alloc->x6E8)(alloc->x6E0); + ((void (*)(u32)) _p(x6E8))(_p(x6E0)); } void lbMemory_800154BC(uintptr_t* arenaLo, uintptr_t* arenaHi) { - *arenaLo = (uintptr_t) g_alloc.x0_arenaLo; - *arenaHi = (uintptr_t) g_alloc.x4_arenaHi; + *arenaLo = (uintptr_t) _p(a_arenaLo); + *arenaHi = (uintptr_t) _p(a_arenaHi); } Handle* lbMemory_800154D4(void* arenaLo, void* arenaHi) { - g_alloc.x69C = new_handle(arenaLo, arenaHi); - return g_alloc.x69C; + _p(x69C) = new_handle(arenaLo, arenaHi); + return _p(x69C); } void lbMemory_800155A4(void) { - Handle* handle = g_alloc.x69C; + Handle* handle = _p(x69C); Handle* iter; Handle** r5; - if (handle == NULL) { - __assert(lbl_803BA2C0, 149, lbMemory_804D3788); - } - r5 = &g_alloc.x62C_free_mem; + HSD_ASSERT(149, handle); + r5 = &_p(free_mem); for (iter = handle->xC_prev; iter != NULL;) { Handle* tmp_next = iter->x0_next; PUSH_HANDLE(r5, iter); iter = tmp_next; - g_alloc.x630_num_allocs -= 1; + _p(x630_num_allocs) -= 1; } - PUSH_HANDLE(&g_alloc.x698_free_heap, handle); - g_alloc.x69C = NULL; + PUSH_HANDLE(&_p(free_heap), handle); + _p(x69C) = NULL; } #pragma push @@ -366,33 +325,33 @@ void lbMemory_8001564C(void) { u32 size[3]; int i; - u8* base = (u8*) &g_alloc; + u8* base = (u8*) &lbMemory_804318B0; - g_alloc.x0_arenaLo = (void*) ARAlloc(0x20); + _p(a_arenaLo) = (void*) ARAlloc(0x20); ARFree(&size[2]); - g_alloc.x4_arenaHi = + _p(a_arenaHi) = (void*) ((ARGetSize() > 0x01000000U) ? 0x01000000U : ARGetSize()); - g_alloc.x62C_free_mem = (Handle*) &g_alloc.x8_mem[0]; + _p(free_mem) = (Handle*) &_p(x8_mem)[0]; for (i = 0; i < 0x82; i++) { - g_alloc.x8_mem[i].x0_next = &g_alloc.x8_mem[i + 1]; + _p(x8_mem)[i].x0_next = &_p(x8_mem)[i + 1]; } - g_alloc.x8_mem[i].x0_next = NULL; + _p(x8_mem)[i].x0_next = NULL; - g_alloc.x634_max_num_allocs = 0; - g_alloc.x630_num_allocs = 0; - g_alloc.x698_free_heap = (Handle*) (base + 0x638); + _p(x634_max_num_allocs) = 0; + _p(x630_num_allocs) = 0; + _p(free_heap) = (Handle*) (base + 0x638); *(void**) (base + 0x638) = base + 0x648; *(void**) (base + 0x648) = base + 0x658; *(void**) (base + 0x658) = base + 0x668; *(void**) (base + 0x668) = base + 0x678; *(void**) (base + 0x678) = base + 0x688; *(void**) (base + 0x688) = NULL; - g_alloc.x69C = NULL; + _p(x69C) = NULL; { - void* hi = g_alloc.x4_arenaHi; - void* lo = g_alloc.x0_arenaLo; - g_alloc.x69C = lbMemory_80014E24(lo, hi); + void* hi = _p(a_arenaHi); + void* lo = _p(a_arenaLo); + _p(x69C) = lbMemory_80014E24(lo, hi); } *(u32*) (base + 0x6D0) = 0; } diff --git a/src/melee/lb/lbmemory.h b/src/melee/lb/lbmemory.h index 4de5c2d56d..ec41896598 100644 --- a/src/melee/lb/lbmemory.h +++ b/src/melee/lb/lbmemory.h @@ -19,7 +19,7 @@ typedef struct _Handle { /* 014EEC */ void lbMemory_80014EEC(Handle*); /* 014F7C */ u32 lbMemory_80014F7C(Handle*); /* 014FC8 */ Handle* lbMemory_80014FC8(Handle*, u32); -/* 0150F0 */ void lbMemory_800150F0(Handle*, void*); +/* 0150F0 */ void lbMemFreeToHeap(Handle*, void*); /* 015184 */ void fn_80015184(OSAlarm* alarm, OSContext* context); /* 01529C */ u32 lbMemory_8001529C(Handle*, void*, u32); /* 0154BC */ void lbMemory_800154BC(uintptr_t*, uintptr_t*); diff --git a/src/melee/mn/mnhyaku.c b/src/melee/mn/mnhyaku.c index 3de4becc11..a4178f47dc 100644 --- a/src/melee/mn/mnhyaku.c +++ b/src/melee/mn/mnhyaku.c @@ -159,25 +159,9 @@ void mnHyaku_8024CAC8(HSD_GObj* gobj) } } -inline static Menu* allocMenu(u8 arg0, HSD_GObj* gobj) -{ - Menu* user_data; - - user_data = HSD_MemAlloc(8); - /// @todo Convert to @c HSD_ASSERTREPORT once a byte-matching form is - /// found. - if (user_data == NULL) { - OSReport("Can't get user_data.\n"); - __assert(__FILE__, 360, "user_data"); - } - user_data->cursor = arg0; - user_data->text = 0; - GObj_InitUserData(gobj, 0, HSD_Free, user_data); - return user_data; -} - void mnHyaku_8024CB94(u8 arg0) { + Menu* user_data; HSD_GObj* gobj; HSD_GObjProc* proc; HSD_JObj* jobj; @@ -194,8 +178,12 @@ void mnHyaku_8024CB94(u8 arg0) HSD_JObjReqAnimAll(jobj, 0.0F); HSD_JObjAnimAll(jobj); - menu = allocMenu(arg0, gobj); - mnHyaku_8024C68C_inline(jobj, menu->cursor); + user_data = HSD_MemAlloc(8); + HSD_ASSERTREPORT(360, user_data, "Can't get user_data.\n"); + user_data->cursor = arg0; + user_data->text = 0; + GObj_InitUserData(gobj, 0, HSD_Free, user_data); + mnHyaku_8024C68C_inline(jobj, user_data->cursor); proc = HSD_GObj_SetupProc(gobj, mnHyaku_8024CAC8, 0U); proc->flags_3 = HSD_GObj_804D783C; From c1e8a2ab24fe7d42d3abd68f81c0ae428b145262 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 11:58:40 -0700 Subject: [PATCH 08/20] Address review: Doxygen groups, Parts_Max enum, _p() family it/forward.h: the ItemKind section markers become Doxygen member groups, and the stray blank line before the closing brace is gone. Gr_Homerun_Parts_Max moves into a gr/forward.h enum. With _p() approved, the remaining HSD_ASSERTMSG sites whose messages spell it convert to HSD_ASSERT: cmsnap (recovering the status field and CmSnapStatus_Sleep), lbcardgame, lbcardnew, and lbsnap. lbsnap's four line-410 asserts are one original helper; reconstructing lbSnap_FormatTime(chan, index, text) makes all four string-exact, including the jndex call site. Every touched object keeps its pre-refactor function scores. --- src/melee/cm/cmsnap.c | 32 +-- src/melee/cm/forward.h | 5 + src/melee/gr/forward.h | 6 + src/melee/gr/grhomerun.c | 1 - src/melee/it/forward.h | 34 ++- src/melee/lb/lbcardgame.c | 140 ++++++------ src/melee/lb/lbcardnew.c | 411 +++++++++++++++++------------------ src/melee/lb/lbsnap.c | 165 +++++++------- src/melee/lb/lbsnap.static.h | 2 +- 9 files changed, 403 insertions(+), 393 deletions(-) diff --git a/src/melee/cm/cmsnap.c b/src/melee/cm/cmsnap.c index 363d622ed2..e9b868a1f9 100644 --- a/src/melee/cm/cmsnap.c +++ b/src/melee/cm/cmsnap.c @@ -1,5 +1,7 @@ #include "cm/cmsnap.h" +#include "cm/forward.h" + #include "lb/lbspdisplay.h" #include @@ -8,49 +10,49 @@ #include typedef struct { - int unk0; + CmSnapStatus status; HSD_ImageDesc unk1; int unk2; } _cmsnap_data; static _cmsnap_data cmsnap_data; +#define _p(x) (cmsnap_data.x) void cmSnap_800315C8(void) { - HSD_ASSERTMSG(0x55, cmsnap_data.unk0 == 0, - "_p(status) == CmSnapStatus_Sleep"); - cmsnap_data.unk0 = 1; + HSD_ASSERT(0x55, _p(status) == CmSnapStatus_Sleep); + _p(status) = 1; } void* cmSnap_80031618(void) { - if (cmsnap_data.unk0 != 5) { + if (_p(status) != 5) { return 0; } - cmsnap_data.unk0 = 0; - return cmsnap_data.unk1.image_ptr; + _p(status) = CmSnapStatus_Sleep; + return _p(unk1).image_ptr; } void cmSnap_80031640(HSD_GObj* arg0, int code) { - switch (cmsnap_data.unk0) { - case 0: + switch (_p(status)) { + case CmSnapStatus_Sleep: break; case 1: - lb_800122C8(&cmsnap_data.unk1, 0, 0, 0); - cmsnap_data.unk0 = 2; + lb_800122C8(&_p(unk1), 0, 0, 0); + _p(status) = 2; break; case 2: case 3: case 4: - cmsnap_data.unk0 += 1; + _p(status) += 1; break; } } void cmSnap_800316B4(void) { - cmsnap_data.unk0 = 0; - cmsnap_data.unk1.image_ptr = NULL; + _p(status) = CmSnapStatus_Sleep; + _p(unk1).image_ptr = NULL; GObj_SetupGXLinkMax(GObj_Create(0x12, 0x12, 0), cmSnap_80031640, 4); - lb_800121FC(&cmsnap_data.unk1, 0x280, 0x1E0, 4, 0x7D6); + lb_800121FC(&_p(unk1), 0x280, 0x1E0, 4, 0x7D6); } diff --git a/src/melee/cm/forward.h b/src/melee/cm/forward.h index eafbc315b6..28fb313d30 100644 --- a/src/melee/cm/forward.h +++ b/src/melee/cm/forward.h @@ -37,4 +37,9 @@ typedef struct CameraDebugMode CameraDebugMode; typedef struct CameraModeCallbacks CameraModeCallbacks; typedef struct CameraInputs CameraInputs; +/// Named by an assert in #cmSnap_800315C8. +typedef enum CmSnapStatus { + /* 0x0 */ CmSnapStatus_Sleep, +} CmSnapStatus; + #endif diff --git a/src/melee/gr/forward.h b/src/melee/gr/forward.h index 64518e88d6..15b8a818aa 100644 --- a/src/melee/gr/forward.h +++ b/src/melee/gr/forward.h @@ -178,6 +178,12 @@ typedef enum StadiumGrType { PsType_Display = 1, } StadiumGrType; +/// Size of the Home-Run Contest parts array, named by an assert in +/// #grHomeRun_8021CB20. +typedef enum Gr_Homerun_Parts { + /* 0x40 */ Gr_Homerun_Parts_Max = 64, +} Gr_Homerun_Parts; + typedef void (*unkCastleCallback)(void*, struct unkCastle*); typedef void (*unkCastleCallback2)(void*, struct unkCastle*, Ground_GObj*); typedef int (*GrIceMtSegmentLookup)(Ground_GObj*); diff --git a/src/melee/gr/grhomerun.c b/src/melee/gr/grhomerun.c index 2cb4ce13e1..a4e32ffc88 100644 --- a/src/melee/gr/grhomerun.c +++ b/src/melee/gr/grhomerun.c @@ -39,7 +39,6 @@ float delta_y); #define INIT_ADD_PARTS_RANGE (1.0F + (2400.0F / (160.0F * Ground_801C0498()))) -#define Gr_Homerun_Parts_Max 64 f32 grHr_804D6AD8; int grHr_804D6ADC; diff --git a/src/melee/it/forward.h b/src/melee/it/forward.h index 9c2642343f..fc8ff83239 100644 --- a/src/melee/it/forward.h +++ b/src/melee/it/forward.h @@ -107,8 +107,8 @@ typedef enum Item_HoldKinds { #define It_Common_End It_Kind_L_Gun_Ray typedef enum ItemKind { - // COMMON ITEMS - + /** @name COMMON ITEMS */ + /// @{ /* 00 */ It_Kind_Capsule, // Capsule /* 01 */ It_Kind_Box, // Crate /* 02 */ It_Kind_Taru, // Barrel @@ -145,8 +145,10 @@ typedef enum ItemKind { /* 21 */ It_Kind_Spycloak, // Cloaking Device (Spycloak) /* 22 */ It_Kind_M_Ball, // Poke Ball (M Ball) - // ITEM-RELATED + /// @} + /** @name ITEM-RELATED */ + /// @{ It_Kind_L_Gun_Ray, // Ray Gun recoil effect (?) It_Kind_StarRod_Star, // Star Rod Star It_Kind_LipStick_Spore, // Lips Stick Dust @@ -156,16 +158,20 @@ typedef enum ItemKind { It_Kind_F_Flower_Flame, // Flower It_Kind_EvYoshiEgg, // Yoshi's Egg (Event) - // MONSTERS + /// @} + /** @name MONSTERS */ + /// @{ It_Kind_Kuriboh, // Goomba (Kuriboh) It_Kind_Leadead, // Redead (Leadead) It_Kind_Octarock, // Octarok (Octarock) It_Kind_Ottosea, // Ottosea It_Kind_Octarock_Stone, // Stone (Octarok Projectile) - // CHARACTER-RELATED + /// @} + /** @name CHARACTER-RELATED */ + /// @{ It_Kind_Mario_Fire, // Mario's fireball It_Kind_DrMario_Vitamin, // Dr. Mario's pill It_Kind_Kirby_CBeam, // Kirby's Cutter beam @@ -280,8 +286,10 @@ typedef enum ItemKind { It_Kind_Unk4, // (unique) It_Kind_Coin, // Coin (?) - // POKEMON + /// @} + /** @name POKEMON */ + /// @{ /* 0xA0 */ It_PKind_Random, ///< Used for Random Pokemon value /* 0xA1 */ It_PKind_Start, ///< First Poke Ball Pokemon, named by an ///< assert in #pl_8003E70C. @@ -317,8 +325,10 @@ typedef enum ItemKind { /* 0xBE */ It_PKind_Fushigibana, ///< Venusaur (Fushigibana) /* 0xBF */ It_PKind_Terminate, ///< One past the last Poke Ball Pokemon. - // POKEMON-RELATED + /// @} + /** @name POKEMON-RELATED */ + /// @{ /* 0xBF */ It_Kind_Chicorita_Leaf = It_PKind_Terminate, ///< Chikorita's Leaf /* 0xC0 */ It_Kind_Kamex_HydroPump, ///< Blastoise's Water @@ -338,8 +348,10 @@ typedef enum ItemKind { /* 0xCE */ It_Kind_Hinoarashi_Flame, ///< Cyndaquil's Fire /* 0xCF */ It_Kind_Pokemon_Unk, ///< ??? - // MONSTERS 2 + /// @} + /** @name MONSTERS 2 */ + /// @{ It_Kind_Old_Kuri, // Old Goomba (old-Kuri) It_Kind_Mato, // Target (Mato) It_Kind_Heiho, // Yoshi's Story Shy Guy (Heiho) @@ -354,8 +366,10 @@ typedef enum ItemKind { It_Kind_ZGShell, // Green Shell (zgshell) It_Kind_ZRShell, // Red Shell (green act) (zrshell) - // STAGE-SPECIFIC + /// @} + /** @name STAGE-SPECIFIC */ + /// @{ It_Kind_Tincle, // Tingle (Tincle) (on balloon) It_Kind_Invalid1, // [Invalid] It_Kind_Invalid2, // [Invalid] @@ -372,7 +386,7 @@ typedef enum ItemKind { It_Kind_Arwing_Laser, // Arwing Laser It_Kind_GreatFox_Laser, // Great Fox's Laser It_Kind_Kyasarin_Egg, // Birdo's Egg - + /// @} } ItemKind; #endif diff --git a/src/melee/lb/lbcardgame.c b/src/melee/lb/lbcardgame.c index fd50a3c0e5..4fd10275bb 100644 --- a/src/melee/lb/lbcardgame.c +++ b/src/melee/lb/lbcardgame.c @@ -20,6 +20,8 @@ #include #include +#define _p(x) (lb_80433318.x) + static struct { u32 x0, x4, x8; u32 pad[2]; @@ -52,10 +54,10 @@ static struct { void lb_8001C600(void) { - int prev = lb_80433318.x0; - lb_80433318.x0 = CARDProbe(0); - if (lb_80433318.x0 != prev) { - lb_80433318.x4 = 1; + int prev = _p(x0); + _p(x0) = CARDProbe(0); + if (_p(x0) != prev) { + _p(x4) = 1; } } @@ -69,16 +71,16 @@ const char* lb_8001C658(void) u32 seconds = OSTicksToSeconds(temp_r6); OSTicksToCalendarTime(OSSecondsToTicks((u64) seconds), &time); for (i = 0; i < 0x40; i++) { - lb_80433318._1C[i] = 0; + _p(_1C)[i] = 0; } if (lbLang_IsSettingJP()) { gamedata_str = "大乱闘スマッシュブラザーズDX セーブデータ"; } else { gamedata_str = "Super Smash Bros. Melee Game Data"; } - sprintf(lb_80433318._1C, "%s %4d/%02d/%02d", gamedata_str, time.year, - time.mon + 1, time.mday); - return lb_80433318._1C; + sprintf(_p(_1C), "%s %4d/%02d/%02d", gamedata_str, time.year, time.mon + 1, + time.mday); + return _p(_1C); } int lb_8001C820(void) @@ -92,56 +94,56 @@ int lb_8001C820(void) } else { var_r0 = 0; } - return lb_80433318.x5C[var_r0]; + return _p(x5C)[var_r0]; } u32 lb_8001C87C(void) { return lb_8001B7E0(0, "SuperSmashBros0110290334", &lb_803BAB74, - &lb_803BAB60, &lb_80433318.x4); + &lb_803BAB60, &_p(x4)); } /// #lb_8001C87C int lb_8001C8BC(void) { - HSD_ASSERTMSG(0x140, lb_80433318.enable, "_p(enable)"); + HSD_ASSERT(0x140, _p(enable)); return lb_8001BC18(0, "SuperSmashBros0110290334", (void**) &lb_803BAB74, - &lb_803BAB60, lb_8001C658(), lb_8001C820(), - lb_80433318.x5C[3], &lb_80433318.x4); + &lb_803BAB60, lb_8001C658(), lb_8001C820(), _p(x5C)[3], + &_p(x4)); } #pragma push #pragma dont_inline on int lb_8001CAF4(void) { - int temp_r5 = lb_80433318.x4; - lb_80433318.x4 = 0; - switch (lb_80433318.x8) { + int temp_r5 = _p(x4); + _p(x4) = 0; + switch (_p(x8)) { case 0: if (temp_r5 != 0) { - lb_80433318.x8 = 1; + _p(x8) = 1; } break; case 3: if (lb_8001C404(0) != 0) { - lb_80433318.x8 = 4; + _p(x8) = 4; } break; case 4: if (temp_r5 != 0 && lb_8001C404(0) == 0) { - lb_80433318.x8 = 3; + _p(x8) = 3; } break; } - return lb_80433318.x8; + return _p(x8); } #pragma pop void lb_8001CBAC(s32 arg0) { - lb_80433318.x8 = arg0; + _p(x8) = arg0; } enum_t lb_8001CBBC(void) @@ -151,10 +153,10 @@ enum_t lb_8001CBBC(void) if (lb_8001CAF4() != 0) { return 0xD; } - temp_r3 = lb_8001BD34(0, "SuperSmashBros0110290334", &lb_803BAB74, - &lb_80433318.x4); + temp_r3 = + lb_8001BD34(0, "SuperSmashBros0110290334", &lb_803BAB74, &_p(x4)); if (temp_r3 != 0 && temp_r3 != 2) { - lb_80433318.x8 = 2; + _p(x8) = 2; } return temp_r3; } @@ -162,13 +164,13 @@ enum_t lb_8001CBBC(void) void fn_8001CC30(int arg0) { if (arg0 != 0) { - lb_80433318.x8 = 2; + _p(x8) = 2; } } bool lb_8001CC4C(void) { - return lb_8001BA44(0, "SuperSmashBros0110290334", &lb_80433318.x4); + return lb_8001BA44(0, "SuperSmashBros0110290334", &_p(x4)); } static int dont_inline_helper(void) @@ -181,8 +183,8 @@ static int dont_inline_helper(void) temp_r24 = lb_8001C820(); return lb_8001BE30(0, "SuperSmashBros0110290334", &lb_803BAB74, - lb_8001C658(), temp_r24, lb_80433318.x5C[3], - &lb_80433318.x4, fn_8001CC30); + lb_8001C658(), temp_r24, _p(x5C)[3], &_p(x4), + fn_8001CC30); } void lb_8001CC84(void) @@ -191,54 +193,54 @@ void lb_8001CC84(void) int temp_r3; do { - switch (lb_80433318.x10) { + switch (_p(x10)) { case 0: - if (lb_80433318.xC == 0) { + if (_p(xC) == 0) { break; } - lb_80433318.xC = 0; - if (lb_80433318.x8 != 0) { + _p(xC) = 0; + if (_p(x8) != 0) { break; } if (dont_inline_helper() != 0xB) { - lb_80433318.x14 = 1; + _p(x14) = 1; } else { - lb_80433318.x10 = 1; + _p(x10) = 1; } break; case 1: temp_r3 = lb_8001B6F8(); if (temp_r3 != 0xB) { if (temp_r3 != 0) { - lb_80433318.x14 = 1; + _p(x14) = 1; } - lb_80433318.x10 = temp_r3 = 0; + _p(x10) = temp_r3 = 0; } break; } - } while (lb_80433318.x10 != 1 && lb_80433318.xC != 0); + } while (_p(x10) != 1 && _p(xC) != 0); } void lb_8001CDB4(void) { - while (lb_80433318.xC || lb_80433318.x10) { + while (_p(xC) || _p(x10)) { lb_8001CC84(); } } void lb_8001CE00(void) { - HSD_ASSERTMSG(0x2A3, lb_80433318.enable, "_p(enable)"); + HSD_ASSERT(0x2A3, _p(enable)); *gm_GetPowerTime() += gmMainLib_8015FC74(); - lb_80433318.xC = true; + _p(xC) = true; } u8 lb_8001CE78(void) { lb_8001CAF4(); - if (lb_80433318.x8 != 0 && lb_80433318.x8 != 4) { + if (_p(x8) != 0 && _p(x8) != 4) { return GM_MEMCARD; } return GM_COUNT; @@ -251,7 +253,7 @@ void fn_8001CEC0(HSD_GObj* gobj) void fn_8001CEE4(HSD_GObj* gobj, int arg1) { - if (lb_80433318.x10 == 1) { + if (_p(x10) == 1) { HSD_GObj_803910D8(gobj, arg1); } } @@ -260,24 +262,24 @@ static float lb_804D3808[][2] = { { 21.5F, 16.5F } }; void lb_8001CF18(void) { - if (lb_80433318.x64 != NULL) { + if (_p(x64) != NULL) { HSD_JObj* jobj; HSD_GObj* gobj = GObj_Create(0x18, 0x3D, 0); - HSD_CObj* cobj = HSD_CObjLoadDesc(lb_80433318.x64->cameras[0].desc); + HSD_CObj* cobj = HSD_CObjLoadDesc(_p(x64)->cameras[0].desc); HSD_GObjObject_80390A70(gobj, HSD_GObj_804D784B, cobj); GObj_SetupGXLinkMax(gobj, fn_8001CEE4, 0xE); gobj->gxlink_prios = 0x80000; gobj = GObj_Create(0x18, 0x3D, 0); - jobj = HSD_JObjLoadJoint(lb_80433318.x64->models[0]->joint); + jobj = HSD_JObjLoadJoint(_p(x64)->models[0]->joint); - HSD_JObjSetTranslateX(jobj, lb_804D3808[lb_80433318.x60][0]); - HSD_JObjSetTranslateY(jobj, lb_804D3808[lb_80433318.x60][1]); + HSD_JObjSetTranslateX(jobj, lb_804D3808[_p(x60)][0]); + HSD_JObjSetTranslateY(jobj, lb_804D3808[_p(x60)][1]); HSD_GObjObject_80390A70(gobj, HSD_GObj_804D7849, jobj); GObj_SetupGXLink(gobj, HSD_GObj_JObjCallback, 0x13, 0); HSD_GObj_SetupProc(gobj, fn_8001CEC0, 0); - gm_8016895C(jobj, lb_80433318.x64->models[0], 0); + gm_8016895C(jobj, _p(x64)->models[0], 0); HSD_JObjReqAnimAll(jobj, 0.0F); HSD_JObjAnimAll(jobj); } @@ -285,24 +287,22 @@ void lb_8001CF18(void) void lb_8001D164(int arg0) { - if (lb_80433318.x5C == 0) { - lbArchive_80016DBC("LbMcGame.", &lb_80433318.x5C, "MemCardIconData", - 0); - lbArchive_80016DBC("NtMemAc", &lb_80433318.x64, - "ScNtcCommon_scene_data", 0); - lb_80433318.x60 = arg0; - lb_80433318.enable = 1; + if (_p(x5C) == 0) { + lbArchive_80016DBC("LbMcGame.", &_p(x5C), "MemCardIconData", 0); + lbArchive_80016DBC("NtMemAc", &_p(x64), "ScNtcCommon_scene_data", 0); + _p(x60) = arg0; + _p(enable) = 1; } } void lb_8001D1F4(void) { - lb_80433318.x5C = NULL; - lb_80433318.x64 = NULL; - lb_80433318.enable = 0; - lb_80433318.xC = 0; - lb_80433318.x10 = 0; - lb_80433318.x14 = 0; + _p(x5C) = NULL; + _p(x64) = NULL; + _p(enable) = 0; + _p(xC) = 0; + _p(x10) = 0; + _p(x14) = 0; } struct unk { @@ -313,15 +313,15 @@ void lb_8001D21C(void) { int i; - lb_80433318.x0 = CARDProbe(0); - lb_80433318.x4 = 0; - lb_80433318.x8 = 0; - lb_80433318.x5C = NULL; - lb_80433318.x64 = NULL; - lb_80433318.enable = 0; - lb_80433318.xC = 0; - lb_80433318.x10 = 0; - lb_80433318.x14 = 0; + _p(x0) = CARDProbe(0); + _p(x4) = 0; + _p(x8) = 0; + _p(x5C) = NULL; + _p(x64) = NULL; + _p(enable) = 0; + _p(xC) = 0; + _p(x10) = 0; + _p(x14) = 0; lb_803BAB74.x14 = gmMainLib_GetSaveData(); for (i = 0; i < 7; i++) { diff --git a/src/melee/lb/lbcardnew.c b/src/melee/lb/lbcardnew.c index e410612e7c..402a1b2d22 100644 --- a/src/melee/lb/lbcardnew.c +++ b/src/melee/lb/lbcardnew.c @@ -10,6 +10,8 @@ #include #include +#define _p(x) (lb_80432A68.x) + int lb_80019BB8(int card_result) { switch (card_result) { @@ -46,7 +48,7 @@ struct CardTask* lb_80019C38(void) struct CardTask* result; for (i = 0; i < LbCardNewTaskArray_Max; i++) { - result = &lb_80432A68.task_array[i]; + result = &_p(task_array)[i]; if (result->x0 == 0xE) { break; } @@ -59,7 +61,7 @@ static void reset_task_array(void) { int i; for (i = 0; i < LbCardNewTaskArray_Max; i++) { - lb_80432A68.task_array[i].x0 = 0xE; + _p(task_array)[i].x0 = 0xE; } } @@ -72,8 +74,8 @@ int lb_80019CB0(int result) i = 0; for (i = 0; i < LbCardNewTaskArray_Max; i++) { - task = &lb_80432A68.task_array[i]; - if (lb_80432A68.task_array[i].x0 != 0xE) { + task = &_p(task_array)[i]; + if (_p(task_array)[i].x0 != 0xE) { break; } } @@ -131,13 +133,13 @@ int lb_80019CB0(int result) } } } - if (result != 11 && lb_80432A68.x50C != NULL) { - lb_80432A68.x50C(result); - lb_80432A68.x50C = NULL; + if (result != 11 && _p(x50C) != NULL) { + _p(x50C)(result); + _p(x50C) = NULL; } - if (result != 11 && lb_80432A68.unk_80 != 0) { - CARDUnmount(lb_80432A68.chan); - lb_80432A68.unk_80 = 0; + if (result != 11 && _p(unk_80) != 0) { + CARDUnmount(_p(chan)); + _p(unk_80) = 0; } return result; } @@ -146,24 +148,24 @@ void lb_80019EF0(int chan, UNK_T save_data, UNK_T status_out, UNK_T callback) { int i; - lb_80432A68.chan = chan; - lb_80432A68.unk_C = save_data; - lb_80432A68.unk_10 = status_out; - lb_80432A68.unk_14 = NULL; - lb_80432A68.unk_18 = 0; - lb_80432A68.unk_1C = 0; - lb_80432A68.snapshot_entries = NULL; - lb_80432A68.free_blocks = NULL; - lb_80432A68.free_files = NULL; - lb_80432A68.unk_34 = 0x10; + _p(chan) = chan; + _p(unk_C) = save_data; + _p(unk_10) = status_out; + _p(unk_14) = NULL; + _p(unk_18) = 0; + _p(unk_1C) = 0; + _p(snapshot_entries) = NULL; + _p(free_blocks) = NULL; + _p(free_files) = NULL; + _p(unk_34) = 0x10; for (i = 0; i < 9; i++) { - lb_80432A68.unk_38[i].unk_0 = 0x10; - lb_80432A68.unk_38[i].unk_4 = -1; + _p(unk_38)[i].unk_0 = 0x10; + _p(unk_38)[i].unk_4 = -1; } - lb_80432A68.unk_80 = 0; - lb_80432A68.x50C = callback; + _p(unk_80) = 0; + _p(x50C) = callback; reset_task_array(); } @@ -175,9 +177,9 @@ void fn_8001A008(s32 unused, s32 card_result) error = lb_80019BB8(card_result); if (error != 0) { - lb_80432A68.unk_34 = error; + _p(unk_34) = error; } - lb_80432A68.x8AC -= 1; + _p(x8AC) -= 1; } static int convert_hsdcard_error(int hsd_error) @@ -218,12 +220,12 @@ void fn_8001A0B0(int file_idx, int hsd_error) error = convert_hsdcard_error(hsd_error); - lb_80432A68.unk_38[file_idx].unk_0 = error; - lb_80432A68.unk_38[file_idx].unk_4 = hsd_error; + _p(unk_38)[file_idx].unk_0 = error; + _p(unk_38)[file_idx].unk_4 = hsd_error; if (error != 0) { - lb_80432A68.unk_34 = error; + _p(unk_34) = error; } - lb_80432A68.x8AC -= 1; + _p(x8AC) -= 1; } int lb_8001A184(void) @@ -240,30 +242,29 @@ int lb_8001A184(void) result = 0; did_disable = 0; - lb_80432A68.x8AC = 0; - probe_result = CARDProbeEx(lb_80432A68.chan, &lb_80432A68.memsize, - &lb_80432A68.sectorsize); - lb_80432A68.unk_34 = lb_80019BB8(probe_result); - if (lb_80432A68.unk_34 == 0) { - if (lb_80432A68.unk_10 != NULL) { - *(s32*) lb_80432A68.unk_10 = 0; + _p(x8AC) = 0; + probe_result = CARDProbeEx(_p(chan), &_p(memsize), &_p(sectorsize)); + _p(unk_34) = lb_80019BB8(probe_result); + if (_p(unk_34) == 0) { + if (_p(unk_10) != NULL) { + *(s32*) _p(unk_10) = 0; } - HSD_ASSERTMSG(0x23F, lb_80432A68.work_area, "_p(work_area)"); + HSD_ASSERT(0x23F, _p(work_area)); enabled = OSDisableInterrupts(); did_disable = 1; - mount_result = CARDMountAsync(lb_80432A68.chan, lb_80432A68.work_area, - NULL, fn_8001A008); + mount_result = + CARDMountAsync(_p(chan), _p(work_area), NULL, fn_8001A008); - lb_80432A68.unk_34 = lb_80019BB8(mount_result); + _p(unk_34) = lb_80019BB8(mount_result); if (mount_result == 0 || mount_result == -6 || mount_result == -0xD) { - lb_80432A68.unk_80 = 1; + _p(unk_80) = 1; } - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } } - pending_ops = lb_80432A68.x8AC; - saved_error = lb_80432A68.unk_34; + pending_ops = _p(x8AC); + saved_error = _p(unk_34); if (did_disable != 0) { OSRestoreInterrupts(enabled); } @@ -283,15 +284,15 @@ int lb_8001A3A4(void) u8 _[8]; unused = 0; - lb_80432A68.x8AC = 0; + _p(x8AC) = 0; enabled = OSDisableInterrupts(); - check_result = CARDCheckAsync(lb_80432A68.chan, fn_8001A008); - lb_80432A68.unk_34 = lb_80019BB8(check_result); - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + check_result = CARDCheckAsync(_p(chan), fn_8001A008); + _p(unk_34) = lb_80019BB8(check_result); + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } - pending_ops = lb_80432A68.x8AC; - saved_error = lb_80432A68.unk_34; + pending_ops = _p(x8AC); + saved_error = _p(unk_34); OSRestoreInterrupts(enabled); if (pending_ops != 0) { return 0xB; @@ -351,69 +352,65 @@ int lb_8001A594(char* filename, void* file_entries) u8 _[8]; unused_2 = 0; - lb_80432A68.x8AC = 0; - if (lb_80432A68.sectorsize != 0x2000) { - lb_80432A68.unk_34 = 0xC; + _p(x8AC) = 0; + if (_p(sectorsize) != 0x2000) { + _p(unk_34) = 0xC; } else { free_result = - CARDFreeBlocks(lb_80432A68.chan, &lb_80432A68.unused_bytes, - &lb_80432A68.unused_files); + CARDFreeBlocks(_p(chan), &_p(unused_bytes), &_p(unused_files)); - lb_80432A68.unk_34 = lb_80019BB8(free_result); - if (lb_80432A68.unk_34 == 0) { + _p(unk_34) = lb_80019BB8(free_result); + if (_p(unk_34) == 0) { if (filename == NULL) { - lb_80432A68.unk_34 = 7; + _p(unk_34) = 7; } else { - open_result = CARDOpen(lb_80432A68.chan, filename, - &lb_80432A68.file_info); - CARDClose(&lb_80432A68.file_info); - HSD_ASSERTMSG(0x2C8, lb_80432A68.lib_area, "_p(lib_area)"); - hsd_803B24E4(&lb_80432A68.unk_A8, lb_80432A68.chan, 0x2000, - lb_80432A68.lib_area); + open_result = CARDOpen(_p(chan), filename, &_p(file_info)); + CARDClose(&_p(file_info)); + HSD_ASSERT(0x2C8, _p(lib_area)); + hsd_803B24E4(&_p(unk_A8), _p(chan), 0x2000, _p(lib_area)); if (open_result == 0) { - hsd_result = hsd_803B2550(&lb_80432A68.unk_A8, filename, - fn_8001A0B0); + hsd_result = + hsd_803B2550(&_p(unk_A8), filename, fn_8001A0B0); - lb_80432A68.unk_34 = convert_hsdcard_error(hsd_result); - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + _p(unk_34) = convert_hsdcard_error(hsd_result); + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } } else if (file_entries == NULL) { - lb_80432A68.unk_34 = 4; - } else if (lb_80432A68.unused_files == 0) { - lb_80432A68.unk_34 = 6; + _p(unk_34) = 4; + } else if (_p(unused_files) == 0) { + _p(unk_34) = 6; } else { - setup_card_entries(&lb_80432A68.unk_A8, lb_80432A68.unk_C, - file_entries); - if (lb_80432A68.unused_bytes < - (hsd_803B2674((void*) &lb_80432A68.unk_A8) << 0xD)) + setup_card_entries(&_p(unk_A8), _p(unk_C), file_entries); + if (_p(unused_bytes) < + (hsd_803B2674((void*) &_p(unk_A8)) << 0xD)) { - lb_80432A68.unk_34 = 5; + _p(unk_34) = 5; } else { - lb_80432A68.unk_34 = 4; + _p(unk_34) = 4; } } } } } - if (lb_80432A68.x8AC != 0) { + if (_p(x8AC) != 0) { return 0xB; } - return lb_80432A68.unk_34; + return _p(unk_34); } int lb_8001A860(void) { - lb_80432A68.x8AC = 0; - switch (lb_80432A68.unk_34) { + _p(x8AC) = 0; + switch (_p(unk_34)) { case 1: break; case 0: case 2: - lb_80432A68.unk_34 = 1; + _p(unk_34) = 1; break; } - return lb_80432A68.unk_34; + return _p(unk_34); } int lb_8001A8A4(void) @@ -427,19 +424,19 @@ int lb_8001A8A4(void) unused = 0; did_disable = 0; - lb_80432A68.x8AC = 0; - if (lb_80432A68.unk_80 != 0) { + _p(x8AC) = 0; + if (_p(unk_80) != 0) { enabled = OSDisableInterrupts(); did_disable = 1; - format_result = CARDFormatAsync(lb_80432A68.chan, fn_8001A008); + format_result = CARDFormatAsync(_p(chan), fn_8001A008); - lb_80432A68.unk_34 = lb_80019BB8(format_result); - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + _p(unk_34) = lb_80019BB8(format_result); + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } } - pending_ops = lb_80432A68.x8AC; - saved_error = lb_80432A68.unk_34; + pending_ops = _p(x8AC); + saved_error = _p(unk_34); if (did_disable != 0) { OSRestoreInterrupts(enabled); } @@ -459,16 +456,16 @@ int lb_8001A9CC(char* filename) u8 _[8]; unused = 0; - lb_80432A68.x8AC = 0; + _p(x8AC) = 0; enabled = OSDisableInterrupts(); - delete_result = CARDDeleteAsync(lb_80432A68.chan, filename, fn_8001A008); + delete_result = CARDDeleteAsync(_p(chan), filename, fn_8001A008); - lb_80432A68.unk_34 = lb_80019BB8(delete_result); - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + _p(unk_34) = lb_80019BB8(delete_result); + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } - pending_ops = lb_80432A68.x8AC; - saved_error = lb_80432A68.unk_34; + pending_ops = _p(x8AC); + saved_error = _p(unk_34); OSRestoreInterrupts(enabled); if (pending_ops != 0) { return 0xB; @@ -486,16 +483,15 @@ int lb_8001AAE4(const char* old_name, const char* new_name) u8 _[8]; unused = 0; - lb_80432A68.x8AC = 0; + _p(x8AC) = 0; enabled = OSDisableInterrupts(); - rename_result = - CARDRenameAsync(lb_80432A68.chan, old_name, new_name, fn_8001A008); - lb_80432A68.unk_34 = lb_80019BB8(rename_result); - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + rename_result = CARDRenameAsync(_p(chan), old_name, new_name, fn_8001A008); + _p(unk_34) = lb_80019BB8(rename_result); + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } - pending_ops = lb_80432A68.x8AC; - saved_error = lb_80432A68.unk_34; + pending_ops = _p(x8AC); + saved_error = _p(unk_34); OSRestoreInterrupts(enabled); if (pending_ops != 0) { return 0xB; @@ -508,17 +504,16 @@ int lb_8001AC04(UNK_T filename) int hsd_result; int unused; - hsd_result = - hsd_803B286C(&lb_80432A68.unk_A8, filename, lb_80432A68.unk_14, - lb_80432A68.unk_18, lb_80432A68.unk_1C, fn_8001A0B0); - lb_80432A68.unk_34 = convert_hsdcard_error(hsd_result); - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + hsd_result = hsd_803B286C(&_p(unk_A8), filename, _p(unk_14), _p(unk_18), + _p(unk_1C), fn_8001A0B0); + _p(unk_34) = convert_hsdcard_error(hsd_result); + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } - if (lb_80432A68.x8AC != 0) { + if (_p(x8AC) != 0) { return 0xB; } - return lb_80432A68.unk_34; + return _p(unk_34); } int lb_8001ACEC(UNK_T file_entries) @@ -532,27 +527,27 @@ int lb_8001ACEC(UNK_T file_entries) volatile int pad_stack; volatile int cached_data; - lb_80432A68.unk_34 = 0; + _p(unk_34) = 0; for (i = 0; i < 9; i++) { - cached_flag = lb_80432A68.xF4[i]; - cached_data = lb_80432A68.xD0[i]; - if (lb_80432A68.xF4[i] != 0) { - hsd_result = hsd_803B29D8(&lb_80432A68.unk_A8, i, - entries[i].data_size, fn_8001A0B0); - lb_80432A68.unk_38[i].unk_0 = convert_hsdcard_error(hsd_result); - lb_80432A68.unk_38[i].unk_4 = hsd_result; - file_error = lb_80432A68.unk_38[i].unk_0; + cached_flag = _p(xF4)[i]; + cached_data = _p(xD0)[i]; + if (_p(xF4)[i] != 0) { + hsd_result = hsd_803B29D8(&_p(unk_A8), i, entries[i].data_size, + fn_8001A0B0); + _p(unk_38)[i].unk_0 = convert_hsdcard_error(hsd_result); + _p(unk_38)[i].unk_4 = hsd_result; + file_error = _p(unk_38)[i].unk_0; if (file_error == 0) { - lb_80432A68.x8AC += 1; + _p(x8AC) += 1; } else { - lb_80432A68.unk_34 = file_error; + _p(unk_34) = file_error; } } } - if (lb_80432A68.x8AC != 0) { + if (_p(x8AC) != 0) { return 0xB; } - return lb_80432A68.unk_34; + return _p(unk_34); } int lb_8001AE38(UNK_T file_entries) @@ -566,61 +561,59 @@ int lb_8001AE38(UNK_T file_entries) volatile int pad_stack; volatile int cached_data; - lb_80432A68.unk_34 = 0; + _p(unk_34) = 0; for (i = 0; i < 9; i++) { - cached_flag = lb_80432A68.xF4[i]; - cached_data = lb_80432A68.xD0[i]; - if (lb_80432A68.xF4[i] != 0) { - hsd_result = hsd_803B2A4C(&lb_80432A68.unk_A8, i, - entries[i].data_size, fn_8001A0B0); - lb_80432A68.unk_38[i].unk_0 = convert_hsdcard_error(hsd_result); - lb_80432A68.unk_38[i].unk_4 = hsd_result; - file_error = lb_80432A68.unk_38[i].unk_0; + cached_flag = _p(xF4)[i]; + cached_data = _p(xD0)[i]; + if (_p(xF4)[i] != 0) { + hsd_result = hsd_803B2A4C(&_p(unk_A8), i, entries[i].data_size, + fn_8001A0B0); + _p(unk_38)[i].unk_0 = convert_hsdcard_error(hsd_result); + _p(unk_38)[i].unk_4 = hsd_result; + file_error = _p(unk_38)[i].unk_0; if (file_error == 0) { - lb_80432A68.x8AC += 1; + _p(x8AC) += 1; } else { - lb_80432A68.unk_34 = file_error; + _p(unk_34) = file_error; } } } - if (lb_80432A68.x8AC != 0) { + if (_p(x8AC) != 0) { return 0xB; } - return lb_80432A68.unk_34; + return _p(unk_34); } int lb_8001AF84(void) { - int hsd_result = - hsd_803B2928(&lb_80432A68.unk_A8, lb_80432A68.unk_14, - lb_80432A68.unk_18, lb_80432A68.unk_1C, fn_8001A0B0); + int hsd_result = hsd_803B2928(&_p(unk_A8), _p(unk_14), _p(unk_18), + _p(unk_1C), fn_8001A0B0); - lb_80432A68.unk_34 = convert_hsdcard_error(hsd_result); + _p(unk_34) = convert_hsdcard_error(hsd_result); - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } - if (lb_80432A68.x8AC != 0) { + if (_p(x8AC) != 0) { return 0xB; } - return lb_80432A68.unk_34; + return _p(unk_34); } int lb_8001B068(void) { - int hsd_result = - hsd_803B27F4(&lb_80432A68.unk_A8, lb_80432A68.unk_14, - lb_80432A68.unk_18, lb_80432A68.unk_1C, fn_8001A0B0); + int hsd_result = hsd_803B27F4(&_p(unk_A8), _p(unk_14), _p(unk_18), + _p(unk_1C), fn_8001A0B0); - lb_80432A68.unk_34 = convert_hsdcard_error(hsd_result); + _p(unk_34) = convert_hsdcard_error(hsd_result); - if (lb_80432A68.unk_34 == 0) { - lb_80432A68.x8AC += 1; + if (_p(unk_34) == 0) { + _p(x8AC) += 1; } - if (lb_80432A68.x8AC != 0) { + if (_p(x8AC) != 0) { return 0xB; } - return lb_80432A68.unk_34; + return _p(unk_34); } int lb_8001B14C(void) @@ -639,12 +632,12 @@ int lb_8001B14C(void) head = NULL; disk_id = DVDGetCurrentDiskID(); - lb_80432A68.x8AC = 0; - if (lb_80432A68.free_blocks != NULL) { - *lb_80432A68.free_blocks = lb_80432A68.unused_bytes / 0x2000; + _p(x8AC) = 0; + if (_p(free_blocks) != NULL) { + *_p(free_blocks) = _p(unused_bytes) / 0x2000; } - if (lb_80432A68.free_files != NULL) { - *lb_80432A68.free_files = lb_80432A68.unused_files; + if (_p(free_files) != NULL) { + *_p(free_files) = _p(unused_files); } nodes = HSD_MemAlloc(0x5F4); node = nodes; @@ -652,7 +645,7 @@ int lb_8001B14C(void) game = (char*) stat[0].gameName; count = 0; for (file_no = 0; file_no < 0x7F; file_no++) { - if (CARDGetStatus(lb_80432A68.chan, file_no, stat) == 0 && + if (CARDGetStatus(_p(chan), file_no, stat) == 0 && strncmp(company, disk_id->company, 2) == 0 && strncmp(game, disk_id->gameName, 4) == 0 && isdigit(stat[0].fileName[0])) @@ -672,17 +665,17 @@ int lb_8001B14C(void) } scan = &head; for (file_no = 0; file_no < count; file_no++) { - lb_80432A68.snapshot_entries[file_no].time = (*scan)->time; - lb_80432A68.snapshot_entries[file_no].file_no = (*scan)->file_no; - lb_80432A68.snapshot_entries[file_no].blocks = (*scan)->blocks; + _p(snapshot_entries)[file_no].time = (*scan)->time; + _p(snapshot_entries)[file_no].file_no = (*scan)->file_no; + _p(snapshot_entries)[file_no].blocks = (*scan)->blocks; scan = &(*scan)->next; } for (i = count; i < 0x7F; i++) { - lb_80432A68.snapshot_entries[i].file_no = -1; + _p(snapshot_entries)[i].file_no = -1; } HSD_Free(nodes); - lb_80432A68.unk_34 = 0; - return lb_80432A68.unk_34; + _p(unk_34) = 0; + return _p(unk_34); } int lb_8001B614(const char* filename) @@ -691,28 +684,28 @@ int lb_8001B614(const char* filename) int fileno; fileno = 0; - lb_80432A68.x8AC = 0; + _p(x8AC) = 0; loop_1: - if (CARDGetStatus(lb_80432A68.chan, fileno, &card_stat) == 0 && - strncmp((const char*) card_stat.company, lb_80432A68.x2C, 2) == 0 && - strncmp((const char*) card_stat.gameName, lb_80432A68.x2F, 4) == 0 && + if (CARDGetStatus(_p(chan), fileno, &card_stat) == 0 && + strncmp((const char*) card_stat.company, _p(x2C), 2) == 0 && + strncmp((const char*) card_stat.gameName, _p(x2F), 4) == 0 && strcmp(card_stat.fileName, filename) == 0) { - lb_80432A68.unk_34 = 0; + _p(unk_34) = 0; } else { fileno += 1; if (fileno >= 0x7F) { - lb_80432A68.unk_34 = 0xD; + _p(unk_34) = 0xD; } else { goto loop_1; } } - return lb_80432A68.unk_34; + return _p(unk_34); } s32 lb_8001B6E0(s32 file_idx) { - return lb_80432A68.unk_38[file_idx].unk_0; + return _p(unk_38)[file_idx].unk_0; } int lb_8001B6F8(void) @@ -722,10 +715,10 @@ int lb_8001B6F8(void) hsd_803AAA48(); enabled = OSDisableInterrupts(); - if (lb_80432A68.x8AC != 0) { + if (_p(x8AC) != 0) { result = 0xB; } else { - result = lb_80432A68.unk_34; + result = _p(unk_34); } OSRestoreInterrupts(enabled); if (result != 0xB) { @@ -854,9 +847,9 @@ int lb_8001BB48(int chan, char* filename, void* file_entries, void* save_data, task->x0 = 7; task->x4 = 0x10; memcpy(task->x10, filename, new_var); - lb_80432A68.unk_14 = write_buf; - lb_80432A68.unk_18 = write_offset; - lb_80432A68.unk_1C = write_len; + _p(unk_14) = write_buf; + _p(unk_18) = write_offset; + _p(unk_1C) = write_len; return lb_80019CB0(0x10); } @@ -874,9 +867,9 @@ inline int lb_8001BB48_inline(int chan, char* filename, void* file_entries, lb_8001A4CC_dontinline(filename, file_entries); setup_task(3, -1); memcpy(setup_task(7, 0x10)->x10, filename, new_var); - lb_80432A68.unk_14 = write_buf; - lb_80432A68.unk_18 = write_offset; - lb_80432A68.unk_1C = write_len; + _p(unk_14) = write_buf; + _p(unk_18) = write_offset; + _p(unk_1C) = write_len; return lb_80019CB0(0x10); } @@ -896,9 +889,9 @@ int lb_8001BC18(int chan, char* filename, void** file_entries, void* save_data, lb_8001A4CC_dontinline(filename, file_entries); setup_task(3, -1); memcpy(setup_task(7, 0x10)->x10, filename, new_var); - lb_80432A68.unk_14 = write_buf; - lb_80432A68.unk_18 = write_offset; - lb_80432A68.unk_1C = write_len; + _p(unk_14) = write_buf; + _p(unk_18) = write_offset; + _p(unk_1C) = write_len; result = lb_80019CB0(0x10); if (result == 0xB) { @@ -955,9 +948,9 @@ int lb_8001BE30(int chan, const char* filename, UNK_T file_entries, task = lb_80019C38(); task->x0 = 10; task->x4 = 2; - lb_80432A68.unk_14 = read_buf; - lb_80432A68.unk_18 = read_offset; - lb_80432A68.unk_1C = read_len; + _p(unk_14) = read_buf; + _p(unk_18) = read_offset; + _p(unk_1C) = read_len; task = lb_80019C38(); task->x0 = 9; task->x4 = 3; @@ -986,9 +979,9 @@ int lb_8001BF04(int chan, char* filename, void* file_entries, task = lb_80019C38_noinline(); task->x0 = 11; task->x4 = 2; - lb_80432A68.unk_14 = write_buf; - lb_80432A68.unk_18 = write_offset; - lb_80432A68.unk_1C = write_len; + _p(unk_14) = write_buf; + _p(unk_18) = write_offset; + _p(unk_1C) = write_len; task = lb_80019C38_noinline(); task->x0 = 8; task->x4 = 3; @@ -1008,9 +1001,9 @@ int lb_8001BFD8(int chan, lbCardNew_SnapshotEntry* snapshot_entries, lb_8001A4CC_dontinline(NULL, 0); setup_task(3, -1); setup_task(12, 0x80); - lb_80432A68.snapshot_entries = snapshot_entries; - lb_80432A68.free_blocks = free_blocks; - lb_80432A68.free_files = free_files; + _p(snapshot_entries) = snapshot_entries; + _p(free_blocks) = free_blocks; + _p(free_files) = free_files; result = lb_80019CB0(0x10); if (result == 0xB) { do { @@ -1096,8 +1089,8 @@ int lb_8001C2D8(int chan, const char* company, const char* game_name, lb_8001A4CC_dontinline(NULL, 0); setup_task(3, -1); task = setup_task(0xD, 0x80); - strncpy(lb_80432A68.x2C, company, 2U); - strncpy(lb_80432A68.x2F, game_name, 4U); + strncpy(_p(x2C), company, 2U); + strncpy(_p(x2F), game_name, 4U); strncpy(task->x10, filename, 0x20U); result = lb_80019CB0(0x10); if (result == 0xB) { @@ -1121,8 +1114,8 @@ int lb_8001C4A8(void* file_entries, void* icon_data) s32* ctx; entry = file_entries; - ctx = &lb_80432A68.unk_A8; - hsd_803B24E4(ctx, 0, 0x2000, lb_80432A68.lib_area); + ctx = &_p(unk_A8); + hsd_803B24E4(ctx, 0, 0x2000, _p(lib_area)); hsd_803B2ADC(ctx, icon); { int i; @@ -1142,20 +1135,20 @@ int lb_8001C4A8(void* file_entries, void* icon_data) void lb_8001C550(void) { - if (lb_80432A68.work_area == NULL) { - lb_80432A68.work_area = HSD_MemAlloc(0xA000); - lb_80432A68.lib_area = HSD_MemAlloc(0x2000); + if (_p(work_area) == NULL) { + _p(work_area) = HSD_MemAlloc(0xA000); + _p(lib_area) = HSD_MemAlloc(0x2000); } } void lb_8001C5A4(void) { - lb_80432A68.work_area = lb_80432A68.lib_area = NULL; + _p(work_area) = _p(lib_area) = NULL; } void lb_8001C5BC(void) { hsd_803B2374(); lb_80019EF0(NULL, NULL, NULL, NULL); - lb_80432A68.x8AC = 0; + _p(x8AC) = 0; } diff --git a/src/melee/lb/lbsnap.c b/src/melee/lb/lbsnap.c index 1531241d80..14f46dfd0e 100644 --- a/src/melee/lb/lbsnap.c +++ b/src/melee/lb/lbsnap.c @@ -3,6 +3,8 @@ #include "lblanguage.h" #include "lbsnap.static.h" + +#define _p(x) (lbSnap_80433380.x) #include #include "ft/ft_0877.h" @@ -19,24 +21,24 @@ void lbSnap_8001D2BC(void) { int i; - for (i = 0; i < (signed) ARRAY_SIZE(lbSnap_80433380.x4C_cardState); i++) { - int prev = lbSnap_80433380.x4C_cardState[i]; - lbSnap_80433380.x4C_cardState[i] = CARDProbe(i); - if (lbSnap_80433380.x4C_cardState[i] != prev) { - lbSnap_80433380.x54_stateChanged[i] = true; + for (i = 0; i < (signed) ARRAY_SIZE(_p(x4C_cardState)); i++) { + int prev = _p(x4C_cardState)[i]; + _p(x4C_cardState)[i] = CARDProbe(i); + if (_p(x4C_cardState)[i] != prev) { + _p(x54_stateChanged)[i] = true; } } } int lbSnap_8001D338(int arg0) { - return lbSnap_80433380.x54_stateChanged[arg0]; + return _p(x54_stateChanged)[arg0]; } int lbSnap_8001D350(int chan) { - struct Unk80433380_48* ptr = &lbSnap_80433380.x48[chan]; - if (ptr->card_result == 0 && lbSnap_80433380.x54_stateChanged[chan]) { + struct Unk80433380_48* ptr = &_p(slot)[chan]; + if (ptr->card_result == 0 && _p(x54_stateChanged)[chan]) { ptr->card_result = 8; } return ptr->card_result; @@ -44,28 +46,28 @@ int lbSnap_8001D350(int chan) int lbSnap_8001D394(int chan) { - return lbSnap_80433380.x48[chan].num; + return _p(slot)[chan].num; } int lbSnap_8001D3B0(int chan) { - return lbSnap_80433380.x48[chan].free_blocks; + return _p(slot)[chan].free_blocks; } int lbSnap_8001D3CC(int chan) { - return lbSnap_80433380.x48[chan].free_files; + return _p(slot)[chan].free_files; } int lbSnap_8001D3E8(int chan, int index) { - return lbSnap_80433380.x48[chan].entries[index].blocks; + return _p(slot)[chan].entries[index].blocks; } int lbSnap_8001D40C(int chan) { - struct Unk80433380_48* ptr = &lbSnap_80433380.x48[chan]; - lbSnap_80433380.x54_stateChanged[chan] = 0; + struct Unk80433380_48* ptr = &_p(slot)[chan]; + _p(x54_stateChanged)[chan] = 0; ptr->card_result = lb_8001BFD8(chan, ptr->entries, &ptr->free_blocks, &ptr->free_files); if (ptr->card_result == 0) { @@ -83,7 +85,7 @@ int lbSnap_8001D40C(int chan) void lbSnap_8001D4A4(int chan, char* arg1) { int new_var; - struct Unk80433380_48* ptr = &lbSnap_80433380.x48[chan]; + struct Unk80433380_48* ptr = &_p(slot)[chan]; OSTime time2 = OSGetTime(); unsigned int time = OSTicksToSeconds(time2); int i; @@ -113,23 +115,27 @@ static inline void lbSnap_ClearText(char* text) } } +static inline void lbSnap_FormatTime(int chan, int index, char* text) +{ + HSD_ASSERT(410, index < _p(slot)[chan].num); + lbSnap_ClearText(text); + sprintf(text, "%u", _p(slot)[chan].entries[index].time); +} + int lbSnap_8001D5FC(int chan, int index) { - struct Unk80433380_48* ptr = &lbSnap_80433380.x48[chan]; + struct Unk80433380_48* ptr = &_p(slot)[chan]; char text[0x21]; int ret; PAD_STACK(8); - if (ptr->card_result == 0 && lbSnap_80433380.x54_stateChanged[chan] != 0) { + if (ptr->card_result == 0 && _p(x54_stateChanged)[chan] != 0) { ptr->card_result = 8; } ret = ptr->card_result; if (ret == 0) { - HSD_ASSERTMSG(410, index < lbSnap_80433380.x48[chan].num, - "index < _p(slot)[chan].num"); - lbSnap_ClearText(text); - sprintf(text, "%u", lbSnap_80433380.x48[chan].entries[index].time); - lbSnap_80433380.x48[chan].card_result = 8; + lbSnap_FormatTime(chan, index, text); + _p(slot)[chan].card_result = 8; ret = lb_8001B99C(chan, text, 0); } return ret; @@ -137,28 +143,22 @@ int lbSnap_8001D5FC(int chan, int index) int lbSnap_8001D7B0(int chan, int index, int jndex) { - struct Unk80433380_48* ptr = &lbSnap_80433380.x48[chan]; + struct Unk80433380_48* ptr = &_p(slot)[chan]; char text1[0x21]; char text2[0x21]; char text3[0x21]; int ret; PAD_STACK(8); - if (ptr->card_result == 0 && lbSnap_80433380.x54_stateChanged[chan] != 0) { + if (ptr->card_result == 0 && _p(x54_stateChanged)[chan] != 0) { ptr->card_result = 8; } ret = ptr->card_result; if (ret == 0) { - HSD_ASSERTMSG(410, index < lbSnap_80433380.x48[chan].num, - "index < _p(slot)[chan].num"); - lbSnap_ClearText(text1); - sprintf(text1, "%u", lbSnap_80433380.x48[chan].entries[index].time); - HSD_ASSERTMSG(410, jndex < lbSnap_80433380.x48[chan].num, - "index < _p(slot)[chan].num"); - lbSnap_ClearText(text2); - sprintf(text2, "%u", lbSnap_80433380.x48[chan].entries[jndex].time); + lbSnap_FormatTime(chan, index, text1); + lbSnap_FormatTime(chan, jndex, text2); lbSnap_8001D4A4(chan, text3); - lbSnap_80433380.x48[chan].card_result = 8; + _p(slot)[chan].card_result = 8; ret = lb_8001C0F4(chan, text1, text2, text3, 0); } return ret; @@ -203,7 +203,7 @@ static inline int lbSnap_GetTiledYOff(int tile_column, int y) static inline u8* lbSnap_GetMemSnapIconData(void) { - return lbSnap_80433380.x44_LbMcSnap_MemSnapIconData[0].ptr; + return _p(x44_LbMcSnap_MemSnapIconData)[0].ptr; } static inline int lbSnap_GetTiledColumn(int x) @@ -251,45 +251,42 @@ int lbSnap_8001DC0C(u8* arg0) char* text; int ret = 0; - lbSnap_80433380.x0->x0 = 4; - lbSnap_80433380.x0->x4 = 0x280; - lbSnap_80433380.x0->x6 = 0x1E0; - lbSnap_80433380.x0->x10 = gm_8016B004(); - it_8026C47C(&lbSnap_80433380.x0->x14); - lbSnap_80433380.x0->x34 = ft_80087C1C(); - lbSnap_80433380.x0->x8 = 3; - hsd_803B5C2C(lbSnap_80433380.x0->x8); - lbSnap_80433380.x0->xC = - hsd_803B51C8((int) arg0, lbSnap_80433380.x0->x4, - lbSnap_80433380.x0->x6, lbSnap_80433380.x0->x38, 256000); - if (lbSnap_80433380.x0->xC != 0) { + _p(x0)->x0 = 4; + _p(x0)->x4 = 0x280; + _p(x0)->x6 = 0x1E0; + _p(x0)->x10 = gm_8016B004(); + it_8026C47C(&_p(x0)->x14); + _p(x0)->x34 = ft_80087C1C(); + _p(x0)->x8 = 3; + hsd_803B5C2C(_p(x0)->x8); + _p(x0)->xC = + hsd_803B51C8((int) arg0, _p(x0)->x4, _p(x0)->x6, _p(x0)->x38, 256000); + if (_p(x0)->xC != 0) { ret = 1; } lbSnap_8001DA5C(arg0); ticks = OSGetTime(); seconds = OSTicksToSeconds(ticks); OSTicksToCalendarTime(OSSecondsToTicks((u64) seconds), &time); - for (i = 0; i < sizeof(lbSnap_80433380.x4_string); i++) { - lbSnap_80433380.x4_string[i] = 0; + for (i = 0; i < sizeof(_p(x4_string)); i++) { + _p(x4_string)[i] = 0; } if (lbLang_IsSettingJP()) { text = "大乱闘スマッシュブラザーズDX 写真データ"; } else { text = "Super Smash Bros. Melee Snapshot"; } - sprintf(lbSnap_80433380.x4_string, "%s %02d/%02d %02d:%02d:%02d", text, - time.mon + 1, time.mday, time.hour, time.min, time.sec); + sprintf(_p(x4_string), "%s %02d/%02d %02d:%02d:%02d", text, time.mon + 1, + time.mday, time.hour, time.min, time.sec); return ret; } int lbSnap_8001DE8C(void* arg0) { int ret = 0; - if (lbSnap_80433380.x0->x0 == 4) { - int temp = hsd_803B6BE4(lbSnap_80433380.x0->x38, - lbSnap_80433380.x0->xC, arg0); - DCFlushRange(arg0, - lbSnap_80433380.x0->x4 * lbSnap_80433380.x0->x6 * 2); + if (_p(x0)->x0 == 4) { + int temp = hsd_803B6BE4(_p(x0)->x38, _p(x0)->xC, arg0); + DCFlushRange(arg0, _p(x0)->x4 * _p(x0)->x6 * 2); if (temp != 0) { ret = 1; } @@ -306,7 +303,7 @@ static inline int lbSnap_GetSaveDataOffset(struct Unk80433380_0* snap) #pragma global_optimizer off int lbSnap_8001DF20(void) { - struct Unk80433380_0* snap = lbSnap_80433380.x0; + struct Unk80433380_0* snap = _p(x0); struct Unk803BACC8* tmp; lbSnap_803BACC8.x14 = lbSnap_GetSaveDataOffset(snap); tmp = &lbSnap_803BACC8; @@ -317,50 +314,45 @@ int lbSnap_8001DF20(void) int lbSnap_8001DF6C(int chan) { - struct Unk80433380_48* ptr = &lbSnap_80433380.x48[chan]; + struct Unk80433380_48* ptr = &_p(slot)[chan]; char text[0x21]; int ret; - if (ptr->card_result == 0 && lbSnap_80433380.x54_stateChanged[chan] != 0) { + if (ptr->card_result == 0 && _p(x54_stateChanged)[chan] != 0) { ptr->card_result = 8; } ret = ptr->card_result; if (ret == 0) { struct Unk803BACC8* desc = &lbSnap_803BACC8; int chan_arg = chan; - lbSnap_80433380.x48[chan].card_result = 8; + _p(slot)[chan].card_result = 8; lbSnap_8001D4A4(chan_arg, text); - desc->x14 = lbSnap_GetSaveDataOffset(lbSnap_80433380.x0); - desc->x1C = lbSnap_80433380.x0; - ret = lb_8001BB48( - chan, text, &desc->x14, desc, lbSnap_80433380.x4_string, - lbSnap_80433380.x44_LbMcSnap_MemSnapIconData[0].offset, - lbSnap_80433380.x44_LbMcSnap_MemSnapIconData[1].size, 0); + desc->x14 = lbSnap_GetSaveDataOffset(_p(x0)); + desc->x1C = _p(x0); + ret = lb_8001BB48(chan, text, &desc->x14, desc, _p(x4_string), + _p(x44_LbMcSnap_MemSnapIconData)[0].offset, + _p(x44_LbMcSnap_MemSnapIconData)[1].size, 0); } return ret; } int lbSnap_8001E058(int chan, int index) { - struct Unk80433380_48* ptr = &lbSnap_80433380.x48[chan]; + struct Unk80433380_48* ptr = &_p(slot)[chan]; int ret; char text[0x21]; PAD_STACK(8); - if (ptr->card_result == 0 && lbSnap_80433380.x54_stateChanged[chan] != 0) { + if (ptr->card_result == 0 && _p(x54_stateChanged)[chan] != 0) { ptr->card_result = 8; } ret = ptr->card_result; if (ret == 0) { - HSD_ASSERTMSG(410, index < lbSnap_80433380.x48[chan].num, - "index < _p(slot)[chan].num"); - lbSnap_ClearText(text); - sprintf(text, "%u", lbSnap_80433380.x48[chan].entries[index].time); - lbSnap_803BACC8.x1C = lbSnap_80433380.x0; - ret = lb_8001BF04( - chan, text, &lbSnap_803BACC8.x14, lbSnap_80433380.x4_string, - lbSnap_80433380.x44_LbMcSnap_MemSnapIconData[0].offset, - lbSnap_80433380.x44_LbMcSnap_MemSnapIconData[1].size, 0); + lbSnap_FormatTime(chan, index, text); + lbSnap_803BACC8.x1C = _p(x0); + ret = lb_8001BF04(chan, text, &lbSnap_803BACC8.x14, _p(x4_string), + _p(x44_LbMcSnap_MemSnapIconData)[0].offset, + _p(x44_LbMcSnap_MemSnapIconData)[1].size, 0); } return ret; } @@ -377,27 +369,26 @@ int lbSnap_8001E210(void) void lbSnap_8001E218(void* arg0, struct Unk80433380_48* arg1) { - lbSnap_80433380.x0 = arg0; - lbSnap_80433380.x48 = arg1; - lbSnap_80433380.x48->card_result = 8; - lbSnap_80433380.x48[1].card_result = 8; - lbArchive_80016DBC("LbMcSnap.", - (void**) &lbSnap_80433380.x44_LbMcSnap_MemSnapIconData, + _p(x0) = arg0; + _p(slot) = arg1; + _p(slot)->card_result = 8; + _p(slot)[1].card_result = 8; + lbArchive_80016DBC("LbMcSnap.", (void**) &_p(x44_LbMcSnap_MemSnapIconData), "MemSnapIconData", 0); } void lbSnap_8001E27C(void) { - lbSnap_80433380.x0 = 0; - lbSnap_80433380.x48 = NULL; + _p(x0) = 0; + _p(slot) = NULL; } void lbSnap_8001E290(void) { int chan; // EXIChannel doesn't optimize the loop properly - lbSnap_80433380.x44_LbMcSnap_MemSnapIconData = NULL; + _p(x44_LbMcSnap_MemSnapIconData) = NULL; for (chan = 0; chan < 2; chan++) { - lbSnap_80433380.x4C_cardState[chan] = CARDProbe(chan); - lbSnap_80433380.x54_stateChanged[chan] = 0; + _p(x4C_cardState)[chan] = CARDProbe(chan); + _p(x54_stateChanged)[chan] = 0; } } diff --git a/src/melee/lb/lbsnap.static.h b/src/melee/lb/lbsnap.static.h index a514f40194..c4690c738f 100644 --- a/src/melee/lb/lbsnap.static.h +++ b/src/melee/lb/lbsnap.static.h @@ -40,7 +40,7 @@ struct Unk80433380 { /* 0x00 */ struct Unk80433380_0* x0; /* 0x04 */ char x4_string[0x40]; /* 0x44 */ LbMcSnapMemSnapIconData* x44_LbMcSnap_MemSnapIconData; - /* 0x48 */ struct Unk80433380_48* x48; + /* 0x48 */ struct Unk80433380_48* slot; /* 0x4C */ int x4C_cardState[2]; /* 0x54 */ int x54_stateChanged[3]; }; /* size = 0x60 */ From 1aa423b33f592a5d3df7f8e6b299b7d6ad3535ac Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 12:17:59 -0700 Subject: [PATCH 09/20] Use Doxygen member group syntax --- src/melee/it/forward.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/melee/it/forward.h b/src/melee/it/forward.h index fc8ff83239..2c952083d4 100644 --- a/src/melee/it/forward.h +++ b/src/melee/it/forward.h @@ -107,7 +107,7 @@ typedef enum Item_HoldKinds { #define It_Common_End It_Kind_L_Gun_Ray typedef enum ItemKind { - /** @name COMMON ITEMS */ + /// @name COMMON ITEMS /// @{ /* 00 */ It_Kind_Capsule, // Capsule /* 01 */ It_Kind_Box, // Crate @@ -147,7 +147,7 @@ typedef enum ItemKind { /// @} - /** @name ITEM-RELATED */ + /// @name ITEM-RELATED /// @{ It_Kind_L_Gun_Ray, // Ray Gun recoil effect (?) It_Kind_StarRod_Star, // Star Rod Star @@ -160,7 +160,7 @@ typedef enum ItemKind { /// @} - /** @name MONSTERS */ + /// @name MONSTERS /// @{ It_Kind_Kuriboh, // Goomba (Kuriboh) It_Kind_Leadead, // Redead (Leadead) @@ -170,7 +170,7 @@ typedef enum ItemKind { /// @} - /** @name CHARACTER-RELATED */ + /// @name CHARACTER-RELATED /// @{ It_Kind_Mario_Fire, // Mario's fireball It_Kind_DrMario_Vitamin, // Dr. Mario's pill @@ -288,7 +288,7 @@ typedef enum ItemKind { /// @} - /** @name POKEMON */ + /// @name POKEMON /// @{ /* 0xA0 */ It_PKind_Random, ///< Used for Random Pokemon value /* 0xA1 */ It_PKind_Start, ///< First Poke Ball Pokemon, named by an @@ -327,7 +327,7 @@ typedef enum ItemKind { /// @} - /** @name POKEMON-RELATED */ + /// @name POKEMON-RELATED /// @{ /* 0xBF */ It_Kind_Chicorita_Leaf = It_PKind_Terminate, ///< Chikorita's Leaf @@ -350,7 +350,7 @@ typedef enum ItemKind { /// @} - /** @name MONSTERS 2 */ + /// @name MONSTERS 2 /// @{ It_Kind_Old_Kuri, // Old Goomba (old-Kuri) It_Kind_Mato, // Target (Mato) @@ -368,7 +368,7 @@ typedef enum ItemKind { /// @} - /** @name STAGE-SPECIFIC */ + /// @name STAGE-SPECIFIC /// @{ It_Kind_Tincle, // Tingle (Tincle) (on balloon) It_Kind_Invalid1, // [Invalid] From f4645218746da96a92edb04663302003c619dbe8 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 13:04:02 -0700 Subject: [PATCH 10/20] Represent common Pokemon padding as alignment --- config/GALE01/symbols.txt | 2 +- src/melee/it/it_279C.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index a775203665..ccad7e1d3e 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -23875,7 +23875,7 @@ it_803F22A8 = .data:0x803F22A8; // type:object size:0x40 scope:global @188 = .data:0x803F2300; // type:object size:0xD scope:local data:string it_803F2310 = .data:0x803F2310; // type:object size:0xBC scope:global it_803F23CC = .data:0x803F23CC; // type:object size:0xB04 scope:global -common_pokemon = .data:0x803F2ED0; // type:object size:0x58 scope:local +common_pokemon = .data:0x803F2ED0; // type:object size:0x54 scope:local it_803F2F28 = .data:0x803F2F28; // type:object size:0x1D8 scope:global it_803F3100 = .data:0x803F3100; // type:object size:0x1BA8 scope:global it_803F4CA8 = .data:0x803F4CA8; // type:object size:0x78 scope:global diff --git a/src/melee/it/it_279C.c b/src/melee/it/it_279C.c index 04bd55b5d1..62b2c29050 100644 --- a/src/melee/it/it_279C.c +++ b/src/melee/it/it_279C.c @@ -1006,7 +1006,7 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { }, }; -static ItemKind common_pokemon[22] = { +static ItemKind common_pokemon[] = { // Common Pokemon It_PKind_Tosakinto, It_PKind_Chicorita, It_PKind_Kabigon, It_PKind_Kamex, It_PKind_Matadogas, It_PKind_Lizardon, @@ -1018,7 +1018,7 @@ static ItemKind common_pokemon[22] = { }; /// Character-specific items -struct sdata_ItemGXLink it_803F2F28[118] = { +struct sdata_ItemGXLink it_803F2F28[118] ATTRIBUTE_ALIGN(8) = { it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, From 5443bb1cbfa49b570b8cca2d6664c7c67469fb9c Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 13:42:10 -0700 Subject: [PATCH 11/20] Split character-specific item tables --- config/GALE01/splits.txt | 5 +- configure.py | 1 + src/melee/it/it_279C.c | 2775 +------------------------------------ src/melee/it/it_279C.h | 4 - src/melee/it/it_3F2F.c | 2779 ++++++++++++++++++++++++++++++++++++++ src/melee/it/it_3F2F.h | 12 + src/melee/it/item.c | 1 + 7 files changed, 2798 insertions(+), 2779 deletions(-) create mode 100644 src/melee/it/it_3F2F.c create mode 100644 src/melee/it/it_3F2F.h diff --git a/config/GALE01/splits.txt b/config/GALE01/splits.txt index 018f6d769f..82338c7daf 100644 --- a/config/GALE01/splits.txt +++ b/config/GALE01/splits.txt @@ -3353,10 +3353,13 @@ melee/it/itanimlist.c: melee/it/it_279C.c: .text start:0x80279C48 end:0x8027B5B0 .rodata start:0x803B8588 end:0x803B85A8 - .data start:0x803F2310 end:0x803F5428 + .data start:0x803F2310 end:0x803F2F28 .sdata start:0x804D51D0 end:0x804D51E0 .sdata2 start:0x804DC7B8 end:0x804DC7D0 +melee/it/it_3F2F.c: + .data start:0x803F2F28 end:0x803F5428 + melee/it/itzako.c: .text start:0x8027B5B0 end:0x8027CF00 .rodata start:0x803B85A8 end:0x803B8600 diff --git a/configure.py b/configure.py index f3d3d21644..8695b65d4b 100755 --- a/configure.py +++ b/configure.py @@ -1240,6 +1240,7 @@ def MatchingFor(*versions): Object(Matching, "melee/it/iteffect.c"), Object(Matching, "melee/it/itanimlist.c"), Object(Matching, "melee/it/it_279C.c"), + Object(Matching, "melee/it/it_3F2F.c"), Object(Matching, "melee/it/itzako.c"), # Individual items Object(Matching, "melee/it/items/itcapsule.c"), diff --git a/src/melee/it/it_279C.c b/src/melee/it/it_279C.c index 62b2c29050..1f941c93c9 100644 --- a/src/melee/it/it_279C.c +++ b/src/melee/it/it_279C.c @@ -2,7 +2,6 @@ #include "it_2725.h" #include "ithitbox.h" -#include "itzako.h" #include "baselib/random.h" #include "db/db.h" @@ -11,128 +10,40 @@ #include "ft/ft_0892.h" #include "ft/ftlib.h" #include "gm/gm_unsplit.h" +#include "it/inlines.h" #include "it/itdraw.h" -#include "it/items/it_2ADA.h" -#include "it/items/it_2E5A.h" -#include "it/items/it_2F28.h" -#include "it/items/itarwinglaser.h" #include "it/items/itcerebi.h" #include "it/items/itchicorita.h" -#include "it/items/itclimbersblizzard.h" -#include "it/items/itclimbersice.h" -#include "it/items/itclimbersstring.h" -#include "it/items/itclinkmilk.h" -#include "it/items/itcrazyhandbomb.h" -#include "it/items/itdrmariopill.h" #include "it/items/itentei.h" #include "it/items/itfire.h" -#include "it/items/itfoxblaster.h" -#include "it/items/itfoxlaser.h" #include "it/items/itfreezer.h" #include "it/items/itfushigibana.h" -#include "it/items/itgamewatchbreath.h" -#include "it/items/itgamewatchchef.h" -#include "it/items/itgamewatchfire.h" -#include "it/items/itgamewatchgreenhouse.h" -#include "it/items/itgamewatchjudge.h" -#include "it/items/itgamewatchmanhole.h" -#include "it/items/itgamewatchpanic.h" -#include "it/items/itgamewatchparachute.h" -#include "it/items/itgamewatchrescue.h" -#include "it/items/itgamewatchturtle.h" -#include "it/items/itgreatfoxlaser.h" #include "it/items/ithassam.h" -#include "it/items/itheiho.h" #include "it/items/ithinoarashi.h" #include "it/items/ithitodeman.h" #include "it/items/ithouou.h" #include "it/items/itkabigon.h" #include "it/items/itkamex.h" -#include "it/items/itkirbycutterbeam.h" -#include "it/items/itkirbygamewatchchefpan.h" -#include "it/items/itkirbyhammer.h" #include "it/items/itkireihana.h" -#include "it/items/itklap.h" -#include "it/items/itkoopaflame.h" -#include "it/items/itkyasarin.h" -#include "it/items/itkyasarinegg.h" -#include "it/items/itleadead.h" -#include "it/items/itlikelike.h" -#include "it/items/itlinkbomb.h" -#include "it/items/itlinkbow.h" -#include "it/items/itlinkhookshot.h" #include "it/items/itlizardon.h" #include "it/items/itlucky.h" #include "it/items/itlugia.h" -#include "it/items/itluigifireball.h" #include "it/items/itmaril.h" -#include "it/items/itmariocape.h" -#include "it/items/itmariofireball.h" #include "it/items/itmarumine.h" -#include "it/items/itmasterhandbullet.h" -#include "it/items/itmasterhandlaser.h" #include "it/items/itmatadogas.h" -#include "it/items/itmato.h" #include "it/items/itmetamon.h" #include "it/items/itmew.h" -#include "it/items/itmewtwodisable.h" -#include "it/items/itmewtwoshadowball.h" -#include "it/items/itnessbat.h" -#include "it/items/itnesspkfire.h" -#include "it/items/itnesspkfirepillar.h" -#include "it/items/itnesspkflash.h" -#include "it/items/itnesspkflashexplode.h" -#include "it/items/itnesspkthunderball.h" -#include "it/items/itnesspkthundertrail.h" -#include "it/items/itnessyoyo.h" -#include "it/items/itnokonoko.h" -#include "it/items/itoctarock.h" -#include "it/items/itoctarockstone.h" #include "it/items/itoldkuri.h" -#include "it/items/itoldottosea.h" -#include "it/items/itpatapata.h" -#include "it/items/itpeachexplode.h" -#include "it/items/itpeachparasol.h" -#include "it/items/itpeachtoad.h" -#include "it/items/itpeachtoadspore.h" -#include "it/items/itpeachturnip.h" -#include "it/items/itpikachuthunder.h" -#include "it/items/itpikachutjoltair.h" -#include "it/items/itpikachutjoltground.h" #include "it/items/itpippi.h" #include "it/items/itporygon2.h" #include "it/items/itraikou.h" -#include "it/items/itsamusbomb.h" -#include "it/items/itsamuschargeshot.h" -#include "it/items/itsamusgrapple.h" -#include "it/items/itsamusmissile.h" -#include "it/items/itseakchain.h" -#include "it/items/itseakneedleheld.h" -#include "it/items/itseakneedlethrown.h" -#include "it/items/itseakvanish.h" #include "it/items/itsonans.h" #include "it/items/itsuikun.h" #include "it/items/itthunder.h" -#include "it/items/ittincle.h" #include "it/items/ittogepy.h" -#include "it/items/ittools.h" #include "it/items/ittosakinto.h" #include "it/items/itunknown.h" -#include "it/items/itwhispyapple.h" -#include "it/items/itwhitebea.h" -#include "it/items/ityaku.h" -#include "it/items/ityoshieggthrow.h" -#include "it/items/ityoshistar.h" -#include "it/items/itzeldadinfire.h" -#include "it/items/itzeldadinfireexplode.h" -#include "it/items/itzgshell.h" -#include "it/items/itzrshell.h" #include "it/itgroundcoll.h" -#include "items/itcoin.h" -#include "items/itfoxillusion.h" -#include "items/itlinkarrow.h" -#include "items/itlinkboomerang.h" -#include "items/ityoshiegglay.h" #include "lb/lbvector.h" #include "pl/plattack.h" #include "pl/plbonuslib.h" @@ -1017,2690 +928,6 @@ static ItemKind common_pokemon[] = { It_PKind_Maril, It_PKind_Fushigibana, It_PKind_Terminate, }; -/// Character-specific items -struct sdata_ItemGXLink it_803F2F28[118] ATTRIBUTE_ALIGN(8) = { - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - - it_8026EECC, it_8026EECC, it_8026EECC, it_8029CD18, it_8029CD18, - - it_8026EECC, it_8026EECC, it_8029FDDC, it_8029FDDC, it_8026EECC, - it_8026EECC, it_802A7D8C, it_802A7D8C, it_8026EECC, it_8026EECC, - - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - - it_8026EECC, it_8026EECC, it_802A7D8C, it_802A7D8C, it_8026EECC, - - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - - it_8026EECC, it_802F13B4, it_8026EECC, -}; - -struct ItemLogicTable it_803F3100[ARRAY_SIZE(it_803F2F28)] = { - { - // Kuriboh - it_803F8320, - it_802D73F0, - it_2725_Logic9_Destroyed, - itOldKuri_Logic0_PickedUp, - it_2725_Logic0_Dropped, - it_2725_Logic0_Thrown, - NULL, - it_2725_Logic0_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Leadead - it_803F8EB0, - it_802E8BCC, - itLeadead_Logic1_Destroyed, - itLeadead_Logic1_PickedUp, - itLeadead_Logic1_Dropped, - itLeadead_Logic1_Thrown, - NULL, - it_802E8CD8, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Octarock - it_803F8B48, - it_802E4A44, - it_2725_Logic9_Destroyed, - itOctarock_Logic2_PickedUp, - itOctarock_Logic2_Dropped, - itOctarock_Logic2_Thrown, - NULL, - it_802E4B00, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802E5AA4, - }, - { - // Ottosea - it_803F89C8, - it_802E2470, - it_2725_Logic3_Destroyed, - it_802E31F8, - it_802E32B4, - it_802E3314, - NULL, - it_2725_Logic8_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802E3784, - }, - { - // Octarock stone - it_803F8E90, - itOctarockstone_802E878C, - NULL, - NULL, - NULL, - NULL, - itOctarockstone_Logic4_DmgDealt, - NULL, - NULL, - itOctarockstone_Logic4_Reflected, - itOctarockstone_Logic4_Clanked, - itOctarockstone_Logic4_Absorbed, - itOctarockstone_Logic4_ShieldBounced, - itOctarockstone_Logic4_HitShield, - itOctarockstone_802E89B0, - }, - { - // Mario fireball - it_803F6788, - NULL, - NULL, - NULL, - NULL, - NULL, - itMarioFireball_Logic87_DmgDealt, - NULL, - NULL, - itMarioFireball_Logic87_Reflected, - itMarioFireball_Logic87_Clanked, - itMarioFireball_Logic87_Absorbed, - itMarioFireball_Logic87_ShieldBounced, - itMarioFireball_Logic87_HitShield, - itMarioFireball_Logic87_EvtUnk, - }, - { - // Dr Mario pill - it_803F75D0, - NULL, - NULL, - itDrMarioPill_PickedUp, - NULL, - NULL, - itDrMarioPill_DmgDealt, - NULL, - NULL, - itDrMarioPill_Reflected, - itDrMarioPill_Clanked, - itDrMarioPill_Absorbed, - itDrMarioPill_ShieldBounced, - itDrMarioPill_HitShield, - itDrMarioPill_EvtUnk, - }, - { - // Kirby cutter beam - it_803F6798, - NULL, - NULL, - NULL, - NULL, - NULL, - itKirbyCutterBeam_Logic7_DmgDealt, - NULL, - NULL, - it_2725_Logic7_Reflected, - itKirbyCutterBeam_Logic7_Clanked, - itKirbyCutterBeam_Logic7_Absorbed, - it_2725_Logic7_ShieldBounced, - itKirbyCutterBeam_Logic7_HitShield, - it_8029C4B4, - }, - { - // Kirby hammer - it_803F6C98, - NULL, - itKirbyHammer_Logic8_Destroyed, - itKirbyHammer_Logic8_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802ADDB0, - }, - { - it_803F6C88, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802ADBE4, - }, - { - it_803F9470, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802F2BDC, - }, - { - // Fox laser - it_803F67D0, - NULL, - NULL, - NULL, - NULL, - NULL, - itFoxLaser_Logic94_Clanked, - NULL, - NULL, - itFoxLaser_Logic94_Reflected, - itFoxLaser_Logic94_Clanked, - itFoxLaser_Logic94_Absorbed, - itFoxLaser_Logic94_ShieldBounced, - itFoxLaser_Logic94_HitShield, - itFoxLaser_Logic94_EvtUnk, - }, - { - // Falco laser - it_803F67D0, - NULL, - NULL, - NULL, - NULL, - NULL, - itFoxLaser_Logic94_Clanked, - NULL, - NULL, - itFoxLaser_Logic94_Reflected, - itFoxLaser_Logic94_Clanked, - itFoxLaser_Logic94_Absorbed, - itFoxLaser_Logic94_ShieldBounced, - itFoxLaser_Logic94_HitShield, - itFoxLaser_Logic94_EvtUnk, - }, - { - // Fox illusion - it_803F6818, - NULL, - itFoxIllusion_Logic14_Destroyed, - NULL, - NULL, - NULL, - itFoxIllusion_Logic14_DmgDealt, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_8029D948, - }, - { - // Falco phantasm - it_803F6818, - NULL, - itFoxIllusion_Logic14_Destroyed, - NULL, - NULL, - NULL, - itFoxIllusion_Logic14_DmgDealt, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_8029D948, - }, - { - // Link bomb - it_803F6888, - NULL, - NULL, - it_8029DEB0, - it_8029EC34, - it_8029E5D0, - it_8029F960, - itLinkBomb_Logic16_DmgReceived, - itLinkBomb_Logic16_EnteredAir, - itLinkBomb_Logic16_Reflected, - NULL, - NULL, - itLinkBomb_Logic16_ShieldBounced, - itLinkBomb_Logic16_HitShield, - it_8029FD84, - }, - { - // Young Link bomb - it_803F6888, - NULL, - NULL, - it_8029DEB0, - it_8029EC34, - it_8029E5D0, - it_8029F960, - itLinkBomb_Logic16_DmgReceived, - itLinkBomb_Logic16_EnteredAir, - itLinkBomb_Logic16_Reflected, - NULL, - NULL, - itLinkBomb_Logic16_ShieldBounced, - itLinkBomb_Logic16_HitShield, - it_8029FD84, - }, - { - // Link boomerang - it_803F6920, - NULL, - itLinkBoomerang_Logic18_Destroyed, - it_802A0E70, - it_802A0F84, - it_802A0F88, - it_802A1F08, - NULL, - NULL, - it_802A20E8, - it_802A1FA8, - itLinkBoomerang_Logic18_Absorbed, - it_802A2320, - it_802A2288, - it_802A23CC, - }, - { - // Young Link boomerang - it_803F6920, - NULL, - itLinkBoomerang_Logic18_Destroyed, - it_802A0E70, - it_802A0F84, - it_802A0F88, - it_802A1F08, - NULL, - NULL, - it_802A20E8, - it_802A1FA8, - itLinkBoomerang_Logic18_Absorbed, - it_802A2320, - it_802A2288, - it_802A23CC, - }, - { - // Link hookshot - it_803F6998, - it_802A2418, - NULL, - itLinkHookshot_Logic20_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802A7D40, - }, - { - // Young Link hookshot - it_803F6998, - NULL, - NULL, - itLinkHookshot_Logic20_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802A7D40, - }, - { - // Link arrow - it_803F6A28, - NULL, - itLinkArrow_Logic98_Destroyed, - itLinkArrow_Logic98_PickedUp, - NULL, - NULL, - itLinkArrow_Logic98_DmgDealt, - NULL, - NULL, - itLinkArrow_Logic98_Reflected, - itLinkArrow_Logic98_Clanked, - NULL, - NULL, - itLinkArrow_Logic98_HitShield, - itLinkArrow_Logic98_EvtUnk, - }, - { - // Young Link arrow - it_803F6A28, - NULL, - itLinkArrow_Logic98_Destroyed, - itLinkArrow_Logic98_PickedUp, - NULL, - NULL, - itLinkArrow_Logic98_DmgDealt, - NULL, - NULL, - itLinkArrow_Logic98_Reflected, - itLinkArrow_Logic98_Clanked, - NULL, - NULL, - itLinkArrow_Logic98_HitShield, - itLinkArrow_Logic98_EvtUnk, - }, - { - // Ness PK fire - it_803F6B28, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic23_DmgDealt, - NULL, - NULL, - itNessPKFire_Logic23_Reflected, - it_2725_Logic23_Clanked, - itNessPKFire_Logic23_Absorbed, - it_2725_Logic23_ShieldBounced, - itNessPKFire_Logic23_HitShield, - it_802AA474, - }, - { - // Ness PK fire pillar - it_803F6B60, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itNesspkfirepillar_Logic24_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itNesspkfirepillar_Logic24_EvtUnk, - }, - { - // Ness PK flash - it_803F6B70, - NULL, - it_2725_Logic102_Destroyed, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itNesspkflash_Logic102_Reflected, - itNesspkflash_Logic102_Clanked, - itNesspkflash_Logic102_Absorbed, - NULL, - NULL, - itNesspkflash_Logic102_EvtUnk, - }, - { - // Ness PK thunder ball - it_803F6BC8, - NULL, - it_802AB90C, - NULL, - NULL, - NULL, - itNessPKThunderball_Logic26_DmgDealt, - NULL, - NULL, - it_802AC098, - it_802AC074, - it_802AC338, - it_802AC35C, - it_802AC3F8, - it_802AC41C, - }, - { - // Ness PK thunder trail 1 - it_803F6C08, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Ness PK thunder trail 2 - it_803F6C08, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Ness PK thunder trail 3 - it_803F6C08, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Ness PK thunder trail 4 - it_803F6C08, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Fox blaster - it_803F6CA8, - NULL, - NULL, - itFoxBlaster_Logic96_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itFoxBlaster_Logic96_EvtUnk, - }, - { - // Falco blaster - it_803F6CA8, - NULL, - NULL, - itFoxBlaster_Logic96_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itFoxBlaster_Logic96_EvtUnk, - }, - { - // Link bow - it_803F6E98, - NULL, - itLinkBow_Logic100_Destroyed, - itLinkBow_Logic100_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itLinkBow_Logic100_EvtUnk, - }, - { - // Young Link bow - it_803F6E98, - NULL, - itLinkBow_Logic100_Destroyed, - itLinkBow_Logic100_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itLinkBow_Logic100_EvtUnk, - }, - { - // Ness PK flush explode - it_803F6F40, - NULL, - it_2725_Logic103_Destroyed, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itNessPKFlashExplode_Logic103_Clanked, - itNessPKFlashExplode_Logic103_Absorbed, - itNessPKFlashExplode_Logic103_ShieldBounced, - itNessPKFlashExplode_Logic103_HitShield, - itNessPKFlashExplode_Logic103_EvtUnk, - }, - { - // Sheik needle thrown - it_803F6F50, - NULL, - itSeakNeedleThrown_Logic109_Destroyed, - NULL, - NULL, - NULL, - it_2725_Logic109_DmgDealt, - it_2725_Logic109_DmgReceived, - NULL, - it_2725_Logic109_Reflected, - it_2725_Logic109_Clanked, - NULL, - it_2725_Logic109_ShieldBounced, - it_2725_Logic109_HitShield, - itSeakNeedleThrown_Logic109_EvtUnk, - }, - { - // Sheik needle held - it_803F70A8, - NULL, - NULL, - itSeakNeedleHeld_Logic110_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itSeakNeedleHeld_Logic110_EvtUnk, - }, - { - // Pikachu thunder - it_803F70C8, - NULL, - it_2725_Logic39_Destroyed, - NULL, - NULL, - NULL, - itPikachuThunder_Logic39_DmgDealt, - NULL, - NULL, - NULL, - itPikachuThunder_Logic39_Clanked, - itPikachuThunder_Logic39_Absorbed, - NULL, - itPikachuThunder_Logic39_HitShield, - itPikachuThunder_Logic39_EvtUnk, - }, - { - // Pichu thunder - it_803F70C8, - NULL, - it_2725_Logic39_Destroyed, - NULL, - NULL, - NULL, - itPikachuThunder_Logic39_DmgDealt, - NULL, - NULL, - NULL, - itPikachuThunder_Logic39_Clanked, - itPikachuThunder_Logic39_Absorbed, - NULL, - itPikachuThunder_Logic39_HitShield, - itPikachuThunder_Logic39_EvtUnk, - }, - { - // Mario cape - it_803F70F8, - NULL, - itMarioCape_Logic41_Destroyed, - it_2725_Logic41_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802B2870, - }, - { - // Dr Mario cape - it_803F70F8, - NULL, - itMarioCape_Logic41_Destroyed, - it_2725_Logic41_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802B2870, - }, - { - // Sheik vanish - it_803F70B8, - NULL, - NULL, - NULL, - NULL, - NULL, - itSeakVanish_Logic42_DmgDealt, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802B1DCC, - }, - { - // Yoshi egg throw - it_803F7118, - NULL, - NULL, - itYoshiEggThrow_Logic43_PickedUp, - NULL, - NULL, - it_802B2C04, - NULL, - NULL, - it_802B2E5C, - it_2725_Logic43_Clanked, - NULL, - it_802B2F88, - it_802B2E7C, - it_802B2FA8, - }, - { - // Yoshi egg lay - it_803F94A0, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_27CF_Logic114_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_27CF_Logic114_EvtUnk, - }, - { - // Yoshi star - it_803F7158, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802B309C, - NULL, - NULL, - it_802B314C, - it_802B30C0, - it_802B3108, - it_802B312C, - it_802B30E4, - it_802B3348, - }, - { - // Pikachu tjolt ground - it_803F7190, - NULL, - it_2725_Logic106_Destroyed, - NULL, - NULL, - NULL, - it_2725_Logic106_DmgDealt, - NULL, - NULL, - it_2725_Logic106_Reflected, - it_2725_Logic106_Clanked, - it_2725_Logic106_Absorbed, - it_2725_Logic106_ShieldBounced, - it_2725_Logic106_HitShield, - itPikachuTJoltGround_Logic106_EvtUnk, - }, - { - // Pikachu tjolt air - it_803F71D8, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic107_DmgDealt, - NULL, - NULL, - it_2725_Logic107_Reflected, - it_2725_Logic107_Clanked, - it_2725_Logic107_Absorbed, - it_2725_Logic107_ShieldBounced, - it_2725_Logic107_HitShield, - itPikachuTJoltAir_Logic107_EvtUnk, - }, - { - // Pichu tjolt ground - it_803F7190, - NULL, - it_2725_Logic106_Destroyed, - NULL, - NULL, - NULL, - it_2725_Logic106_DmgDealt, - NULL, - NULL, - it_2725_Logic106_Reflected, - it_2725_Logic106_Clanked, - it_2725_Logic106_Absorbed, - it_2725_Logic106_ShieldBounced, - it_2725_Logic106_HitShield, - itPikachuTJoltGround_Logic106_EvtUnk, - }, - { - // Pichu tjolt air - it_803F71D8, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic107_DmgDealt, - NULL, - NULL, - it_2725_Logic107_Reflected, - it_2725_Logic107_Clanked, - it_2725_Logic107_Absorbed, - it_2725_Logic107_ShieldBounced, - it_2725_Logic107_HitShield, - itPikachuTJoltAir_Logic107_EvtUnk, - }, - { - // Samus bomb - it_803F7220, - NULL, - NULL, - NULL, - NULL, - NULL, - itSamusBomb_Logic50_DmgDealt, - NULL, - itSamusBomb_Logic50_EnteredAir, - it_2725_Logic50_Reflected, - itSamusBomb_Logic50_Clanked, - NULL, - itSamusBomb_Logic50_ShieldBounced, - itSamusBomb_Logic50_HitShield, - itSamusBomb_Logic50_EvtUnk, - }, - { - // Samus charge shot - it_803F7288, - NULL, - it_2725_Logic108_Destroyed, - it_2725_Logic108_PickedUp, - NULL, - NULL, - itSamusChargeshot_Logic108_DmgDealt, - NULL, - NULL, - it_2725_Logic108_Reflected, - itSamusChargeshot_Logic108_Clanked, - itSamusChargeshot_Logic108_Absorbed, - it_2725_Logic108_ShieldBounced, - itSamusChargeshot_Logic108_HitShield, - itSamusChargeshot_Logic108_EvtUnk, - }, - { - // Samus missile - it_803F7340, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic52_DmgDealt, - NULL, - NULL, - it_2725_Logic52_Reflected, - it_2725_Logic52_Clanked, - NULL, - it_2725_Logic52_ShieldBounced, - it_2725_Logic52_HitShield, - it_2725_Logic52_EvtUnk, - }, - { - // Samus grapple beam - it_803F73A8, - itSamusGrapple_Logic53_Spawned, - NULL, - itSamusGrapple_Logic53_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itSamusGrapple_Logic53_EvtUnk, - }, - { - // Sheik chain - it_803F7438, - NULL, - NULL, - it_2725_Logic54_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itSeakChain_Logic54_EvtUnk, - }, - { - // Peach explode - it_803F7488, - NULL, - NULL, - NULL, - NULL, - NULL, - itPeachExplode_Logic55_DmgDealt, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itPeachExplode_Logic55_EvtUnk, - }, - { - // Peach turnip - it_803F74A8, - NULL, - itPeachTurnip_Logic56_Destroyed, - itPeachTurnip_Logic56_PickedUp, - itPeachTurnip_Logic56_Dropped, - itPeachTurnip_Logic56_Thrown, - itPeachTurnip_Logic56_DmgDealt, - NULL, - NULL, - itPeachTurnip_Logic56_Reflected, - itPeachTurnip_Logic56_Clanked, - NULL, - itPeachTurnip_Logic56_ShieldBounced, - itPeachTurnip_Logic56_HitShield, - itPeachTurnip_Logic56_EvtUnk, - }, - { - // Bowser flame - ItemStateTable_KoopaFlame, - NULL, - NULL, - NULL, - NULL, - NULL, - itKoopaFlame_Logic111_DmgDealt, - NULL, - NULL, - itKoopaFlame_Logic111_Reflected, - itKoopaFlame_Logic111_Clanked, - itKoopaFlame_Logic111_Absorbed, - itKoopaFlame_Logic111_ShieldBounced, - itKoopaFlame_Logic111_HitShield, - itKoopaFlame_Logic111_EvtUnk, - }, - { - // Ness bat - it_803F6C68, - NULL, - NULL, - it_2725_Logic58_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itNessBat_Logic58_EvtUnk, - }, - { - // Ness yo-yo - it_803F7558, - NULL, - NULL, - itNessYoyo_Logic59_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic59_EvtUnk, - }, - { - // Peach parasol - it_803F74F8, - NULL, - itPeachParasol_Logic60_Destroyed, - itPeachParasol_Logic60_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itPeachParasol_Logic60_EvtUnk, - }, - { - // Peach toad - it_803F7528, - NULL, - itPeachToad_Logic91_Destroyed, - itPeachToad_Logic91_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itPeachToad_Logic91_EvtUnk, - }, - { - // Luigi fireball - it_803F75C0, - NULL, - NULL, - NULL, - NULL, - NULL, - itLuigiFireball_Logic89_DmgDealt, - NULL, - NULL, - itLuigiFireball_Logic89_Reflected, - itLuigiFireball_Logic89_Clanked, - itLuigiFireball_Logic89_Absorbed, - itLuigiFireball_Logic89_ShieldBounced, - itLuigiFireball_Logic89_HitShield, - itLuigiFireball_Logic89_EvtUnk, - }, - { - // Ice Climbers ice - it_803F7668, - NULL, - it_2725_Logic90_Destroyed, - NULL, - NULL, - NULL, - itClimbersIce_Logic90_DmgDealt, - NULL, - NULL, - itClimbersIce_Logic90_Reflected, - itClimbersIce_Logic90_Clanked, - itClimbersIce_Logic90_Absorbed, - itClimbersIce_Logic90_ShieldBounced, - it_2725_Logic90_HitShield, - itClimbersIce_Logic90_EvtUnk, - }, - { - // Ice Climbers blizzard - it_803F76A8, - NULL, - NULL, - NULL, - NULL, - NULL, - itClimbersBlizzard_DmgDealt, - NULL, - NULL, - itClimbersBlizzard_Reflected, - itClimbersBlizzard_Clanked, - itClimbersBlizzard_Absorbed, - itClimbersBlizzard_ShieldBounced, - itClimbersBlizzard_HitShield, - itClimbersBlizzard_EvtUnk, - }, - { - // Zelda din fire - ItemStateTable_ZeldaDinFire, - NULL, - itZeldaDinFire_Logic65_Destroyed, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itZeldaDinFire_Logic65_Reflected, - itZeldaDinFire_Logic65_Clanked, - itZeldaDinFire_Logic65_Absorbed, - NULL, - NULL, - itZeldaDinFire_Logic65_EvtUnk, - }, - { - // Zelda din fire explode - it_803F7740, - NULL, - itZeldaDinFireExplode_Logic66_Destroyed, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itZeldaDinFireExplode_Logic66_Clanked, - itZeldaDinFireExplode_Logic66_Absorbed, - itZeldaDinFireExplode_Logic66_ShieldBounced, - itZeldaDinFireExplode_Logic66_HitShield, - itZeldaDinFireExplode_Logic66_EvtUnk, - }, - { - // Mewtwo disable - it_803F7750, - NULL, - itMewtwoDisable_Logic67_Destroyed, - NULL, - NULL, - NULL, - itMewtwoDisable_Logic67_DmgDealt, - NULL, - NULL, - itMewtwoDisable_Logic67_Reflected, - itMewtwoDisable_Logic67_Clanked, - itMewtwoDisable_Logic67_Absorbed, - itMewtwoDisable_Logic67_ShieldBounced, - itMewtwoDisable_Logic67_HitShield, - itMewtwoDisable_Logic67_EvtUnk, - }, - { - // Peach toad spore - it_803F7548, - NULL, - NULL, - NULL, - NULL, - NULL, - itPeachToadSpore_Logic92_DmgDealt, - NULL, - NULL, - itPeachToadSpore_Logic68_Reflected, - itPeachToadSpore_Logic68_Clanked, - itPeachToadSpore_Logic68_Absorbed, - itPeachToadSpore_Logic68_ShieldBounced, - itPeachToadSpore_Logic68_HitShield, - itPeachToadSpore_Logic92_EvtUnk, - }, - { - // Mewtwo shadow ball - it_803F7760, - NULL, - it_2725_Logic101_Destroyed, - it_2725_Logic101_PickedUp, - NULL, - NULL, - itMewtwoShadowball_Logic101_DmgDealt, - NULL, - NULL, - it_2725_Logic101_Reflected, - itMewtwoShadowball_Logic101_Clanked, - itMewtwoShadowball_Logic101_Absorbed, - it_2725_Logic101_ShieldBounced, - itMewtwoShadowball_Logic101_HitShield, - itMewtwoShadowball_Logic101_EvtUnk, - }, - { - // Ice Climbers string (belay) - it_803F76B8, - NULL, - NULL, - it_2725_Logic70_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic70_EvtUnk, - }, - { - // Game & Watch greenhouse (insecticide spray) - it_803F7898, - NULL, - itGamewatchGreenhouse_Destroyed, - itGamewatchGreenhouse_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGamewatchGreenhouse_EvtUnk, - }, - { - // Game & Watch manhole - it_803F78D8, - NULL, - itGameWatchManhole_Logic72_Destroyed, - itGameWatchManhole_Logic72_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchManhole_Logic72_EvtUnk, - }, - { - // Game & Watch fire - it_803F78E8, - NULL, - itGamewatchFire_Destroyed, - itGamewatchFire_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGamewatchFire_EvtUnk, - }, - { - // Game & Watch parachute - it_803F78F8, - NULL, - itGameWatchParachute_Logic74_Destroyed, - itGameWatchParachute_Logic74_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchParachute_Logic74_EvtUnk, - }, - { - // Game & Watch turtle - it_803F7918, - NULL, - itGameWatchTurtle_Logic75_Destroyed, - itGameWatchTurtle_Logic75_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchTurtle_Logic75_EvtUnk, - }, - { - // Game & Watch breath - it_803F7938, - NULL, - itGameWatchBreath_Logic76_Destroyed, - itGameWatchBreath_Logic76_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchBreath_Logic76_EvtUnk, - }, - { - // Game & Watch judge - it_803F7968, - NULL, - itGameWatchJudge_Logic77_Destroyed, - it_2725_Logic77_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchJudge_Logic77_EvtUnk, - }, - { - // Game & Watch panic - it_803F79A0, - NULL, - itGameWatchPanic_Logic78_Destroyed, - itGameWatchPanic_Logic78_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchPanic_Logic78_EvtUnk, - }, - { - // Game & Watch chef - it_803F79E0, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchChef_Logic112_DmgDealt, - NULL, - NULL, - itGameWatchChef_Logic112_Reflected, - it_2725_Logic112_Clanked, - it_2725_Logic112_Absorbed, - itGameWatchChef_Logic112_ShieldBounced, - it_2725_Logic112_HitShield, - itGameWatchChef_Logic112_EvtUnk, - }, - { - // Young Link milk - it_803F7A28, - NULL, - NULL, - it_2725_Logic80_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itCLinkMilk_Logic80_EvtUnk, - }, - { - // Game & Watch rescue - it_803F79C0, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchRescue_Logic81_EvtUnk, - }, - { - // Master Hand laser - it_803F9378, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itMasterHandLaser_Logic84_EvtUnk, - }, - { - // Master Hand bullet - it_803F9388, - NULL, - NULL, - NULL, - NULL, - NULL, - itMasterHandBullet_Logic83_DmgDealt, - NULL, - NULL, - itMasterHandBullet_Logic83_Reflected, - itMasterHandBullet_Logic83_Clanked, - itMasterHandBullet_Logic83_Absorbed, - itMasterHandBullet_Logic83_ShieldBounced, - itMasterHandBullet_Logic83_HitShield, - itMasterHandBullet_Logic85_EvtUnk, - }, - { - // Crazy Hand laser - it_803F9378, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itMasterHandLaser_Logic84_EvtUnk, - }, - { - // Crazy Hand bullet - it_803F9388, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itMasterHandBullet_Logic85_EvtUnk, - }, - { - // Crazy Hand bomb - it_803F93A8, - NULL, - NULL, - NULL, - NULL, - NULL, - itCrazyHandBomb_Logic86_DmgDealt, - NULL, - NULL, - itCrazyHandBomb_Logic86_Reflected, - NULL, - NULL, - NULL, - NULL, - itCrazyHandBomb_Logic86_EvtUnk, - }, - { - it_803F6788, - NULL, - NULL, - NULL, - NULL, - NULL, - itMarioFireball_Logic87_DmgDealt, - NULL, - NULL, - itMarioFireball_Logic87_Reflected, - itMarioFireball_Logic87_Clanked, - itMarioFireball_Logic87_Absorbed, - itMarioFireball_Logic87_ShieldBounced, - itMarioFireball_Logic87_HitShield, - itMarioFireball_Logic87_EvtUnk, - }, - { - it_803F75D0, - NULL, - NULL, - NULL, - NULL, - NULL, - itDrMarioPill_DmgDealt, - NULL, - NULL, - itDrMarioPill_Reflected, - itDrMarioPill_Clanked, - itDrMarioPill_Absorbed, - itDrMarioPill_ShieldBounced, - itDrMarioPill_HitShield, - itDrMarioPill_EvtUnk, - }, - { - it_803F75C0, - NULL, - NULL, - NULL, - NULL, - NULL, - itLuigiFireball_Logic89_DmgDealt, - NULL, - NULL, - itLuigiFireball_Logic89_Reflected, - itLuigiFireball_Logic89_Clanked, - itLuigiFireball_Logic89_Absorbed, - itLuigiFireball_Logic89_ShieldBounced, - itLuigiFireball_Logic89_HitShield, - itLuigiFireball_Logic89_EvtUnk, - }, - { - it_803F7668, - NULL, - it_2725_Logic90_Destroyed, - NULL, - NULL, - NULL, - itClimbersIce_Logic90_DmgDealt, - NULL, - NULL, - itClimbersIce_Logic90_Reflected, - itClimbersIce_Logic90_Clanked, - itClimbersIce_Logic90_Absorbed, - itClimbersIce_Logic90_ShieldBounced, - it_2725_Logic90_HitShield, - itClimbersIce_Logic90_EvtUnk, - }, - { - it_803F7528, - NULL, - itPeachToad_Logic91_Destroyed, - itPeachToad_Logic91_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itPeachToad_Logic91_EvtUnk, - }, - { - it_803F7548, - NULL, - NULL, - NULL, - NULL, - NULL, - itPeachToadSpore_Logic92_DmgDealt, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itPeachToadSpore_Logic92_EvtUnk, - }, - { - it_803F67D0, - NULL, - NULL, - NULL, - NULL, - NULL, - itFoxLaser_Logic94_Clanked, - NULL, - NULL, - itFoxLaser_Logic94_Reflected, - itFoxLaser_Logic94_Clanked, - itFoxLaser_Logic94_Absorbed, - itFoxLaser_Logic94_ShieldBounced, - itFoxLaser_Logic94_HitShield, - itFoxLaser_Logic94_EvtUnk, - }, - { - it_803F67D0, - NULL, - NULL, - NULL, - NULL, - NULL, - itFoxLaser_Logic94_Clanked, - NULL, - NULL, - itFoxLaser_Logic94_Reflected, - itFoxLaser_Logic94_Clanked, - itFoxLaser_Logic94_Absorbed, - itFoxLaser_Logic94_ShieldBounced, - itFoxLaser_Logic94_HitShield, - itFoxLaser_Logic94_EvtUnk, - }, - { - it_803F6CA8, - NULL, - NULL, - itFoxBlaster_Logic96_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itFoxBlaster_Logic96_EvtUnk, - }, - { - it_803F6CA8, - NULL, - NULL, - itFoxBlaster_Logic96_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itFoxBlaster_Logic96_EvtUnk, - }, - { - it_803F6A28, - NULL, - itLinkArrow_Logic98_Destroyed, - itLinkArrow_Logic98_PickedUp, - NULL, - NULL, - itLinkArrow_Logic98_DmgDealt, - NULL, - NULL, - itLinkArrow_Logic98_Reflected, - itLinkArrow_Logic98_Clanked, - NULL, - NULL, - itLinkArrow_Logic98_HitShield, - itLinkArrow_Logic98_EvtUnk, - }, - { - it_803F6A28, - NULL, - itLinkArrow_Logic98_Destroyed, - itLinkArrow_Logic98_PickedUp, - NULL, - NULL, - itLinkArrow_Logic98_DmgDealt, - NULL, - NULL, - itLinkArrow_Logic98_Reflected, - itLinkArrow_Logic98_Clanked, - NULL, - NULL, - itLinkArrow_Logic98_HitShield, - itLinkArrow_Logic98_EvtUnk, - }, - { - it_803F6E98, - NULL, - itLinkBow_Logic100_Destroyed, - itLinkBow_Logic100_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itLinkBow_Logic100_EvtUnk, - }, - { - it_803F6E98, - NULL, - itLinkBow_Logic100_Destroyed, - itLinkBow_Logic100_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itLinkBow_Logic100_EvtUnk, - }, - { - it_803F7760, - NULL, - it_2725_Logic101_Destroyed, - it_2725_Logic101_PickedUp, - NULL, - NULL, - itMewtwoShadowball_Logic101_DmgDealt, - NULL, - NULL, - it_2725_Logic101_Reflected, - itMewtwoShadowball_Logic101_Clanked, - itMewtwoShadowball_Logic101_Absorbed, - it_2725_Logic101_ShieldBounced, - itMewtwoShadowball_Logic101_HitShield, - itMewtwoShadowball_Logic101_EvtUnk, - }, - { - it_803F6B70, - NULL, - it_2725_Logic102_Destroyed, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itNesspkflash_Logic102_Reflected, - itNesspkflash_Logic102_Clanked, - itNesspkflash_Logic102_Absorbed, - NULL, - NULL, - itNesspkflash_Logic102_EvtUnk, - }, - { - it_803F6F40, - NULL, - it_2725_Logic103_Destroyed, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itNessPKFlashExplode_Logic103_Clanked, - itNessPKFlashExplode_Logic103_Absorbed, - itNessPKFlashExplode_Logic103_ShieldBounced, - itNessPKFlashExplode_Logic103_HitShield, - itNessPKFlashExplode_Logic103_EvtUnk, - }, - { - it_803F7190, - NULL, - it_2725_Logic106_Destroyed, - NULL, - NULL, - NULL, - it_2725_Logic106_DmgDealt, - NULL, - NULL, - it_2725_Logic106_Reflected, - it_2725_Logic106_Clanked, - it_2725_Logic106_Absorbed, - it_2725_Logic106_ShieldBounced, - it_2725_Logic106_HitShield, - itPikachuTJoltGround_Logic106_EvtUnk, - }, - { - it_803F71D8, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic107_DmgDealt, - NULL, - NULL, - it_2725_Logic107_Reflected, - it_2725_Logic107_Clanked, - it_2725_Logic107_Absorbed, - it_2725_Logic107_ShieldBounced, - it_2725_Logic107_HitShield, - itPikachuTJoltAir_Logic107_EvtUnk, - }, - { - it_803F7190, - NULL, - it_2725_Logic106_Destroyed, - NULL, - NULL, - NULL, - it_2725_Logic106_DmgDealt, - NULL, - NULL, - it_2725_Logic106_Reflected, - it_2725_Logic106_Clanked, - it_2725_Logic106_Absorbed, - it_2725_Logic106_ShieldBounced, - it_2725_Logic106_HitShield, - itPikachuTJoltGround_Logic106_EvtUnk, - }, - { - it_803F71D8, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic107_DmgDealt, - NULL, - NULL, - it_2725_Logic107_Reflected, - it_2725_Logic107_Clanked, - it_2725_Logic107_Absorbed, - it_2725_Logic107_ShieldBounced, - it_2725_Logic107_HitShield, - itPikachuTJoltAir_Logic107_EvtUnk, - }, - { - it_803F7288, - NULL, - it_2725_Logic108_Destroyed, - it_2725_Logic108_PickedUp, - NULL, - NULL, - itSamusChargeshot_Logic108_DmgDealt, - NULL, - NULL, - it_2725_Logic108_Reflected, - itSamusChargeshot_Logic108_Clanked, - itSamusChargeshot_Logic108_Absorbed, - it_2725_Logic108_ShieldBounced, - itSamusChargeshot_Logic108_HitShield, - itSamusChargeshot_Logic108_EvtUnk, - }, - { - it_803F6F50, - NULL, - itSeakNeedleThrown_Logic109_Destroyed, - NULL, - NULL, - NULL, - it_2725_Logic109_DmgDealt, - it_2725_Logic109_DmgReceived, - NULL, - it_2725_Logic109_Reflected, - it_2725_Logic109_Clanked, - NULL, - it_2725_Logic109_ShieldBounced, - it_2725_Logic109_HitShield, - itSeakNeedleThrown_Logic109_EvtUnk, - }, - { - it_803F70A8, - NULL, - NULL, - itSeakNeedleHeld_Logic110_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itSeakNeedleHeld_Logic110_EvtUnk, - }, - { - ItemStateTable_KoopaFlame, - NULL, - NULL, - NULL, - NULL, - NULL, - itKoopaFlame_Logic111_DmgDealt, - NULL, - NULL, - itKoopaFlame_Logic111_Reflected, - itKoopaFlame_Logic111_Clanked, - itKoopaFlame_Logic111_Absorbed, - itKoopaFlame_Logic111_ShieldBounced, - itKoopaFlame_Logic111_HitShield, - itKoopaFlame_Logic111_EvtUnk, - }, - { - it_803F79E0, - NULL, - NULL, - NULL, - NULL, - NULL, - itGameWatchChef_Logic112_DmgDealt, - NULL, - NULL, - itGameWatchChef_Logic112_Reflected, - it_2725_Logic112_Clanked, - it_2725_Logic112_Absorbed, - itGameWatchChef_Logic112_ShieldBounced, - it_2725_Logic112_HitShield, - itGameWatchChef_Logic112_EvtUnk, - }, - { - it_803F7958, - NULL, - itKirbyGameWatchChefPan_Logic113_Destroyed, - itKirbyGameWatchChefPan_Logic113_PickedUp, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - itKirbyGameWatchChefPan_Logic113_EvtUnk, - }, - { - it_803F94A0, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_27CF_Logic114_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_27CF_Logic114_EvtUnk, - }, - { - // Unk4 - it_803F8BD8, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2E5A_Logic115_DmgDealt, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2E5A_Logic115_EvtUnk, - }, - { - // Coin - it_803F93C8, - itCoin_Logic116_Spawned, - itCoin_Logic116_Destroyed, - itCoin_Logic116_PickedUp, - itCoin_Logic116_Thrown, - itCoin_Logic116_Thrown, - NULL, - itCoin_Logic116_DmgReceived, - itCoin_Logic116_EnteredAir, - NULL, - NULL, - NULL, - NULL, - NULL, - itCoin_Logic116_EvtUnk, - }, - { - // Pokemon random - it_803F8C8C, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2E6A_Logic117_DmgDealt, - it_2E6A_Logic117_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2E6A_Logic117_EvtUnk, - }, -}; - -/// Monster and Stage-specific Items -struct sdata_ItemGXLink it_803F4CA8[30] = { - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, NULL, -}; - -struct ItemLogicTable it_803F4D20[ARRAY_SIZE(it_803F4CA8)] = { - { - // Old Goomba (old-Kuri) - it_803F8320, - it_802D73F0, - it_2725_Logic9_Destroyed, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic0_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802D84D8, - }, - { - // Target (Mato) - it_803F83E0, - it_802D84F8, - it_2725_Logic9_Destroyed, - NULL, - NULL, - NULL, - NULL, - it_802D85F4, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Yoshi's Story Shy Guy (Heiho) - it_803F83F0, - it_802D8688, - it_2725_Logic9_Destroyed, - NULL, - NULL, - NULL, - NULL, - it_802D8EC8, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802D9A0C, - }, - { - // Koopa Troopa (Green) (Nokonoko) - it_803F85F0, - it_802DC69C, - it_2725_Logic9_Destroyed, - it_802DD4F4, - it_802DD59C, - it_802DD67C, - NULL, - itNokonoko_Logic3_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802DD7D0, - }, - { - // Koopa Troopa (Red) (Patapata) - it_803F88C0, - it_802E05A0, - it_2725_Logic9_Destroyed, - itPatapata_Logic4_PickedUp, - it_2725_Logic4_Dropped, - it_2725_Logic4_Thrown, - NULL, - it_2725_Logic4_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802E16D8, - }, - { - // Like-Like (likelike) - it_803F8468, - it_802D9BA8, - itLikeLike_Logic5_Destroyed, - itLikeLike_Logic5_PickedUp, - it_2725_Logic5_Dropped, - itLikeLike_Logic5_Thrown, - NULL, - it_2725_Logic5_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802E16D8, - }, - { - // Old Redead (old-lead) [invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Old Octorok (old-octa) [invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Old Ottosea (old-otto) - it_803F89C8, - it_802E2470, - NULL, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic8_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Polar Bear (whitebea) - it_803F8A88, - it_802E37BC, - it_2725_Logic9_Destroyed, - itWhiteBea_Logic9_PickedUp, - it_2725_Logic9_Dropped, - it_2725_Logic9_Thrown, - NULL, - it_802E3884, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802E4A24, - }, - { - // Klaptrap (klap) - it_803F8940, - it_802E1820, - itKlap_Logic10_Destroyed, - NULL, - NULL, - NULL, - NULL, - it_2725_Logic10_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802E2450, - }, - { - // Green Shell (zgshell) - it_803F86C8, - it_802DE040, - itZGShell_Logic11_Destroyed, - it_2725_Logic11_PickedUp, - itZGShell_Logic11_Dropped, - itZGShell_Logic11_Thrown, - itZGShell_Logic11_DmgDealt, - itZGShell_Logic11_DmgReceived, - it_2725_Logic11_EnteredAir, - itZGShell_Logic11_Reflected, - it_2725_Logic11_Clanked, - NULL, - itZGShell_Logic11_ShieldBounced, - it_2725_Logic11_HitShield, - it_802DFED4, - }, - { - // Red Shell (green act) (zrshell) - it_803F87F0, - it_802E02E8, - itZRShell_Logic12_Destroyed, - itZRShell_Logic12_PickedUp, - itZRShell_Logic12_Dropped, - itZRShell_Logic12_Thrown, - itZRShell_Logic12_DmgDealt, - itZRShell_Logic12_DmgReceived, - itZRShell_Logic12_EnteredAir, - itZRShell_Logic12_Reflected, - itZRShell_Logic12_Clanked, - NULL, - itZRShell_Logic12_ShieldBounced, - itZRShell_Logic12_HitShield, - it_802E0468, - }, - { - // Tingle (Tincle) (on balloon) - it_803F9000, - it_802EB5C8, - NULL, - NULL, - NULL, - NULL, - itTincle_Logic13_DmgDealt, - itTincle_Logic13_DmgReceived, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802EC850, - }, - { - // [Invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // [Invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // [Invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Whispy Apple - it_803F91D0, - NULL, - NULL, - it_802EEA08, - it_802EEA70, - it_802EEB28, - it_802EEED0, - NULL, - itWhispyApple_Logic18_EnteredAir, - it_802EEF10, - it_802EEED8, - NULL, - it_802EEF68, - it_802EEF30, - it_802EEF88, - }, - { - // Whispy's Healing Apple - it_803F91D0, - NULL, - NULL, - it_802EEA08, - it_802EEA70, - it_802EEB28, - it_802EEED0, - NULL, - itWhispyApple_Logic18_EnteredAir, - it_802EEF10, - it_802EEED8, - NULL, - it_802EEF68, - it_802EEF30, - it_802EEF88, - }, - { - // [Invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // [Invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // [Invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Tool (Flatzone) - it_803F9260, - NULL, - NULL, - NULL, - NULL, - NULL, - itTools_Logic22_DmgDealt, - itTools_Logic22_DmgReceived, - NULL, - itTools_Logic22_Reflected, - it_2725_Logic22_Clanked, - it_2725_Logic22_Absorbed, - itTools_Logic22_ShieldBounced, - it_2725_Logic22_HitShield, - it_802EFA24, - }, - { - // [Invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // [Invalid] - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, - { - // Birdo (Kyasarin) - it_803F90D0, - it_802ECE90, - itKyasarin_Logic25_Destroyed, - NULL, - NULL, - NULL, - NULL, - it_802EDDC0, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802EE1E0, - }, - { - // Arwing Laser - it_803F8DE8, - NULL, - it_802E79C8, - NULL, - NULL, - NULL, - it_802E838C, - NULL, - NULL, - it_802E8420, - it_802E838C, - it_802E8418, - it_802E85F4, - it_802E8784, - NULL, - }, - { - // Great Fox's Laser - it_803F8FD0, - it_802EB1EC, - NULL, - NULL, - NULL, - NULL, - itGreatFoxLaser_Logic27_DmgDealt, - NULL, - NULL, - it_2725_Logic27_Reflected, - itGreatFoxLaser_Logic27_Clanked, - itGreatFoxLaser_Logic27_Absorbed, - NULL, - NULL, - it_802EB5A8, - }, - { - // Birdo's Egg - it_803F9328, - NULL, - NULL, - itKyasarinEgg_Logic28_PickedUp, - itKyasarinEgg_Logic28_Dropped, - itKyasarinEgg_Logic28_Thrown, - it_2725_Logic28_DmgDealt, - it_802F022C, - NULL, - it_2725_Logic28_Reflected, - it_2725_Logic28_Clanked, - NULL, - itKyasarinEgg_Logic28_ShieldBounced, - it_2725_Logic28_HitShield, - it_802F0320, - }, - { - // NULL - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - }, -}; - typedef enum PokemonKind { Pokemon_ID_Tosakinto, // Goldeen (Tosakinto) Pokemon_ID_Chicorita, // Chikorita (Chicorita) diff --git a/src/melee/it/it_279C.h b/src/melee/it/it_279C.h index 71cf714e1c..cd4a1128b3 100644 --- a/src/melee/it/it_279C.h +++ b/src/melee/it/it_279C.h @@ -43,9 +43,5 @@ /* 27B564 */ void it_8027B564(Item_GObj*); /* 3F2310 */ extern struct sdata_ItemGXLink it_803F2310[47]; /* 3F23CC */ extern struct ItemLogicTable it_803F23CC[47]; -/* 3F2F28 */ extern struct sdata_ItemGXLink it_803F2F28[118]; -/* 3F3100 */ extern struct ItemLogicTable it_803F3100[118]; -/* 3F4CA8 */ extern struct sdata_ItemGXLink it_803F4CA8[30]; -/* 3F4D20 */ extern struct ItemLogicTable it_803F4D20[30]; #endif diff --git a/src/melee/it/it_3F2F.c b/src/melee/it/it_3F2F.c new file mode 100644 index 0000000000..0ec64336a1 --- /dev/null +++ b/src/melee/it/it_3F2F.c @@ -0,0 +1,2779 @@ +#include "it_3F2F.h" + +#include "itzako.h" + +#include "it/itdraw.h" +#include "it/items/it_2ADA.h" +#include "it/items/it_2E5A.h" +#include "it/items/it_2F28.h" +#include "it/items/itarwinglaser.h" +#include "it/items/itclimbersblizzard.h" +#include "it/items/itclimbersice.h" +#include "it/items/itclimbersstring.h" +#include "it/items/itclinkmilk.h" +#include "it/items/itcrazyhandbomb.h" +#include "it/items/itdrmariopill.h" +#include "it/items/itfoxblaster.h" +#include "it/items/itfoxlaser.h" +#include "it/items/itgamewatchbreath.h" +#include "it/items/itgamewatchchef.h" +#include "it/items/itgamewatchfire.h" +#include "it/items/itgamewatchgreenhouse.h" +#include "it/items/itgamewatchjudge.h" +#include "it/items/itgamewatchmanhole.h" +#include "it/items/itgamewatchpanic.h" +#include "it/items/itgamewatchparachute.h" +#include "it/items/itgamewatchrescue.h" +#include "it/items/itgamewatchturtle.h" +#include "it/items/itgreatfoxlaser.h" +#include "it/items/itheiho.h" +#include "it/items/itkirbycutterbeam.h" +#include "it/items/itkirbygamewatchchefpan.h" +#include "it/items/itkirbyhammer.h" +#include "it/items/itklap.h" +#include "it/items/itkoopaflame.h" +#include "it/items/itkyasarin.h" +#include "it/items/itkyasarinegg.h" +#include "it/items/itleadead.h" +#include "it/items/itlikelike.h" +#include "it/items/itlinkbomb.h" +#include "it/items/itlinkbow.h" +#include "it/items/itlinkhookshot.h" +#include "it/items/itluigifireball.h" +#include "it/items/itmariocape.h" +#include "it/items/itmariofireball.h" +#include "it/items/itmasterhandbullet.h" +#include "it/items/itmasterhandlaser.h" +#include "it/items/itmato.h" +#include "it/items/itmewtwodisable.h" +#include "it/items/itmewtwoshadowball.h" +#include "it/items/itnessbat.h" +#include "it/items/itnesspkfire.h" +#include "it/items/itnesspkfirepillar.h" +#include "it/items/itnesspkflash.h" +#include "it/items/itnesspkflashexplode.h" +#include "it/items/itnesspkthunderball.h" +#include "it/items/itnesspkthundertrail.h" +#include "it/items/itnessyoyo.h" +#include "it/items/itnokonoko.h" +#include "it/items/itoctarock.h" +#include "it/items/itoctarockstone.h" +#include "it/items/itoldkuri.h" +#include "it/items/itoldottosea.h" +#include "it/items/itpatapata.h" +#include "it/items/itpeachexplode.h" +#include "it/items/itpeachparasol.h" +#include "it/items/itpeachtoad.h" +#include "it/items/itpeachtoadspore.h" +#include "it/items/itpeachturnip.h" +#include "it/items/itpikachuthunder.h" +#include "it/items/itpikachutjoltair.h" +#include "it/items/itpikachutjoltground.h" +#include "it/items/itsamusbomb.h" +#include "it/items/itsamuschargeshot.h" +#include "it/items/itsamusgrapple.h" +#include "it/items/itsamusmissile.h" +#include "it/items/itseakchain.h" +#include "it/items/itseakneedleheld.h" +#include "it/items/itseakneedlethrown.h" +#include "it/items/itseakvanish.h" +#include "it/items/ittincle.h" +#include "it/items/ittools.h" +#include "it/items/itwhispyapple.h" +#include "it/items/itwhitebea.h" +#include "it/items/ityaku.h" +#include "it/items/ityoshieggthrow.h" +#include "it/items/ityoshistar.h" +#include "it/items/itzeldadinfire.h" +#include "it/items/itzeldadinfireexplode.h" +#include "it/items/itzgshell.h" +#include "it/items/itzrshell.h" +#include "items/itcoin.h" +#include "items/itfoxillusion.h" +#include "items/itlinkarrow.h" +#include "items/itlinkboomerang.h" +#include "items/ityoshiegglay.h" + +/// Character-specific items +struct sdata_ItemGXLink it_803F2F28[118] = { + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + + it_8026EECC, it_8026EECC, it_8026EECC, it_8029CD18, it_8029CD18, + + it_8026EECC, it_8026EECC, it_8029FDDC, it_8029FDDC, it_8026EECC, + it_8026EECC, it_802A7D8C, it_802A7D8C, it_8026EECC, it_8026EECC, + + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + + it_8026EECC, it_8026EECC, it_802A7D8C, it_802A7D8C, it_8026EECC, + + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + + it_8026EECC, it_802F13B4, it_8026EECC, +}; + +struct ItemLogicTable it_803F3100[ARRAY_SIZE(it_803F2F28)] = { + { + // Kuriboh + it_803F8320, + it_802D73F0, + it_2725_Logic9_Destroyed, + itOldKuri_Logic0_PickedUp, + it_2725_Logic0_Dropped, + it_2725_Logic0_Thrown, + NULL, + it_2725_Logic0_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Leadead + it_803F8EB0, + it_802E8BCC, + itLeadead_Logic1_Destroyed, + itLeadead_Logic1_PickedUp, + itLeadead_Logic1_Dropped, + itLeadead_Logic1_Thrown, + NULL, + it_802E8CD8, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Octarock + it_803F8B48, + it_802E4A44, + it_2725_Logic9_Destroyed, + itOctarock_Logic2_PickedUp, + itOctarock_Logic2_Dropped, + itOctarock_Logic2_Thrown, + NULL, + it_802E4B00, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E5AA4, + }, + { + // Ottosea + it_803F89C8, + it_802E2470, + it_2725_Logic3_Destroyed, + it_802E31F8, + it_802E32B4, + it_802E3314, + NULL, + it_2725_Logic8_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E3784, + }, + { + // Octarock stone + it_803F8E90, + itOctarockstone_802E878C, + NULL, + NULL, + NULL, + NULL, + itOctarockstone_Logic4_DmgDealt, + NULL, + NULL, + itOctarockstone_Logic4_Reflected, + itOctarockstone_Logic4_Clanked, + itOctarockstone_Logic4_Absorbed, + itOctarockstone_Logic4_ShieldBounced, + itOctarockstone_Logic4_HitShield, + itOctarockstone_802E89B0, + }, + { + // Mario fireball + it_803F6788, + NULL, + NULL, + NULL, + NULL, + NULL, + itMarioFireball_Logic87_DmgDealt, + NULL, + NULL, + itMarioFireball_Logic87_Reflected, + itMarioFireball_Logic87_Clanked, + itMarioFireball_Logic87_Absorbed, + itMarioFireball_Logic87_ShieldBounced, + itMarioFireball_Logic87_HitShield, + itMarioFireball_Logic87_EvtUnk, + }, + { + // Dr Mario pill + it_803F75D0, + NULL, + NULL, + itDrMarioPill_PickedUp, + NULL, + NULL, + itDrMarioPill_DmgDealt, + NULL, + NULL, + itDrMarioPill_Reflected, + itDrMarioPill_Clanked, + itDrMarioPill_Absorbed, + itDrMarioPill_ShieldBounced, + itDrMarioPill_HitShield, + itDrMarioPill_EvtUnk, + }, + { + // Kirby cutter beam + it_803F6798, + NULL, + NULL, + NULL, + NULL, + NULL, + itKirbyCutterBeam_Logic7_DmgDealt, + NULL, + NULL, + it_2725_Logic7_Reflected, + itKirbyCutterBeam_Logic7_Clanked, + itKirbyCutterBeam_Logic7_Absorbed, + it_2725_Logic7_ShieldBounced, + itKirbyCutterBeam_Logic7_HitShield, + it_8029C4B4, + }, + { + // Kirby hammer + it_803F6C98, + NULL, + itKirbyHammer_Logic8_Destroyed, + itKirbyHammer_Logic8_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802ADDB0, + }, + { + it_803F6C88, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802ADBE4, + }, + { + it_803F9470, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802F2BDC, + }, + { + // Fox laser + it_803F67D0, + NULL, + NULL, + NULL, + NULL, + NULL, + itFoxLaser_Logic94_Clanked, + NULL, + NULL, + itFoxLaser_Logic94_Reflected, + itFoxLaser_Logic94_Clanked, + itFoxLaser_Logic94_Absorbed, + itFoxLaser_Logic94_ShieldBounced, + itFoxLaser_Logic94_HitShield, + itFoxLaser_Logic94_EvtUnk, + }, + { + // Falco laser + it_803F67D0, + NULL, + NULL, + NULL, + NULL, + NULL, + itFoxLaser_Logic94_Clanked, + NULL, + NULL, + itFoxLaser_Logic94_Reflected, + itFoxLaser_Logic94_Clanked, + itFoxLaser_Logic94_Absorbed, + itFoxLaser_Logic94_ShieldBounced, + itFoxLaser_Logic94_HitShield, + itFoxLaser_Logic94_EvtUnk, + }, + { + // Fox illusion + it_803F6818, + NULL, + itFoxIllusion_Logic14_Destroyed, + NULL, + NULL, + NULL, + itFoxIllusion_Logic14_DmgDealt, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_8029D948, + }, + { + // Falco phantasm + it_803F6818, + NULL, + itFoxIllusion_Logic14_Destroyed, + NULL, + NULL, + NULL, + itFoxIllusion_Logic14_DmgDealt, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_8029D948, + }, + { + // Link bomb + it_803F6888, + NULL, + NULL, + it_8029DEB0, + it_8029EC34, + it_8029E5D0, + it_8029F960, + itLinkBomb_Logic16_DmgReceived, + itLinkBomb_Logic16_EnteredAir, + itLinkBomb_Logic16_Reflected, + NULL, + NULL, + itLinkBomb_Logic16_ShieldBounced, + itLinkBomb_Logic16_HitShield, + it_8029FD84, + }, + { + // Young Link bomb + it_803F6888, + NULL, + NULL, + it_8029DEB0, + it_8029EC34, + it_8029E5D0, + it_8029F960, + itLinkBomb_Logic16_DmgReceived, + itLinkBomb_Logic16_EnteredAir, + itLinkBomb_Logic16_Reflected, + NULL, + NULL, + itLinkBomb_Logic16_ShieldBounced, + itLinkBomb_Logic16_HitShield, + it_8029FD84, + }, + { + // Link boomerang + it_803F6920, + NULL, + itLinkBoomerang_Logic18_Destroyed, + it_802A0E70, + it_802A0F84, + it_802A0F88, + it_802A1F08, + NULL, + NULL, + it_802A20E8, + it_802A1FA8, + itLinkBoomerang_Logic18_Absorbed, + it_802A2320, + it_802A2288, + it_802A23CC, + }, + { + // Young Link boomerang + it_803F6920, + NULL, + itLinkBoomerang_Logic18_Destroyed, + it_802A0E70, + it_802A0F84, + it_802A0F88, + it_802A1F08, + NULL, + NULL, + it_802A20E8, + it_802A1FA8, + itLinkBoomerang_Logic18_Absorbed, + it_802A2320, + it_802A2288, + it_802A23CC, + }, + { + // Link hookshot + it_803F6998, + it_802A2418, + NULL, + itLinkHookshot_Logic20_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802A7D40, + }, + { + // Young Link hookshot + it_803F6998, + NULL, + NULL, + itLinkHookshot_Logic20_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802A7D40, + }, + { + // Link arrow + it_803F6A28, + NULL, + itLinkArrow_Logic98_Destroyed, + itLinkArrow_Logic98_PickedUp, + NULL, + NULL, + itLinkArrow_Logic98_DmgDealt, + NULL, + NULL, + itLinkArrow_Logic98_Reflected, + itLinkArrow_Logic98_Clanked, + NULL, + NULL, + itLinkArrow_Logic98_HitShield, + itLinkArrow_Logic98_EvtUnk, + }, + { + // Young Link arrow + it_803F6A28, + NULL, + itLinkArrow_Logic98_Destroyed, + itLinkArrow_Logic98_PickedUp, + NULL, + NULL, + itLinkArrow_Logic98_DmgDealt, + NULL, + NULL, + itLinkArrow_Logic98_Reflected, + itLinkArrow_Logic98_Clanked, + NULL, + NULL, + itLinkArrow_Logic98_HitShield, + itLinkArrow_Logic98_EvtUnk, + }, + { + // Ness PK fire + it_803F6B28, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic23_DmgDealt, + NULL, + NULL, + itNessPKFire_Logic23_Reflected, + it_2725_Logic23_Clanked, + itNessPKFire_Logic23_Absorbed, + it_2725_Logic23_ShieldBounced, + itNessPKFire_Logic23_HitShield, + it_802AA474, + }, + { + // Ness PK fire pillar + it_803F6B60, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itNesspkfirepillar_Logic24_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itNesspkfirepillar_Logic24_EvtUnk, + }, + { + // Ness PK flash + it_803F6B70, + NULL, + it_2725_Logic102_Destroyed, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itNesspkflash_Logic102_Reflected, + itNesspkflash_Logic102_Clanked, + itNesspkflash_Logic102_Absorbed, + NULL, + NULL, + itNesspkflash_Logic102_EvtUnk, + }, + { + // Ness PK thunder ball + it_803F6BC8, + NULL, + it_802AB90C, + NULL, + NULL, + NULL, + itNessPKThunderball_Logic26_DmgDealt, + NULL, + NULL, + it_802AC098, + it_802AC074, + it_802AC338, + it_802AC35C, + it_802AC3F8, + it_802AC41C, + }, + { + // Ness PK thunder trail 1 + it_803F6C08, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Ness PK thunder trail 2 + it_803F6C08, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Ness PK thunder trail 3 + it_803F6C08, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Ness PK thunder trail 4 + it_803F6C08, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Fox blaster + it_803F6CA8, + NULL, + NULL, + itFoxBlaster_Logic96_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itFoxBlaster_Logic96_EvtUnk, + }, + { + // Falco blaster + it_803F6CA8, + NULL, + NULL, + itFoxBlaster_Logic96_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itFoxBlaster_Logic96_EvtUnk, + }, + { + // Link bow + it_803F6E98, + NULL, + itLinkBow_Logic100_Destroyed, + itLinkBow_Logic100_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itLinkBow_Logic100_EvtUnk, + }, + { + // Young Link bow + it_803F6E98, + NULL, + itLinkBow_Logic100_Destroyed, + itLinkBow_Logic100_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itLinkBow_Logic100_EvtUnk, + }, + { + // Ness PK flush explode + it_803F6F40, + NULL, + it_2725_Logic103_Destroyed, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itNessPKFlashExplode_Logic103_Clanked, + itNessPKFlashExplode_Logic103_Absorbed, + itNessPKFlashExplode_Logic103_ShieldBounced, + itNessPKFlashExplode_Logic103_HitShield, + itNessPKFlashExplode_Logic103_EvtUnk, + }, + { + // Sheik needle thrown + it_803F6F50, + NULL, + itSeakNeedleThrown_Logic109_Destroyed, + NULL, + NULL, + NULL, + it_2725_Logic109_DmgDealt, + it_2725_Logic109_DmgReceived, + NULL, + it_2725_Logic109_Reflected, + it_2725_Logic109_Clanked, + NULL, + it_2725_Logic109_ShieldBounced, + it_2725_Logic109_HitShield, + itSeakNeedleThrown_Logic109_EvtUnk, + }, + { + // Sheik needle held + it_803F70A8, + NULL, + NULL, + itSeakNeedleHeld_Logic110_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itSeakNeedleHeld_Logic110_EvtUnk, + }, + { + // Pikachu thunder + it_803F70C8, + NULL, + it_2725_Logic39_Destroyed, + NULL, + NULL, + NULL, + itPikachuThunder_Logic39_DmgDealt, + NULL, + NULL, + NULL, + itPikachuThunder_Logic39_Clanked, + itPikachuThunder_Logic39_Absorbed, + NULL, + itPikachuThunder_Logic39_HitShield, + itPikachuThunder_Logic39_EvtUnk, + }, + { + // Pichu thunder + it_803F70C8, + NULL, + it_2725_Logic39_Destroyed, + NULL, + NULL, + NULL, + itPikachuThunder_Logic39_DmgDealt, + NULL, + NULL, + NULL, + itPikachuThunder_Logic39_Clanked, + itPikachuThunder_Logic39_Absorbed, + NULL, + itPikachuThunder_Logic39_HitShield, + itPikachuThunder_Logic39_EvtUnk, + }, + { + // Mario cape + it_803F70F8, + NULL, + itMarioCape_Logic41_Destroyed, + it_2725_Logic41_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802B2870, + }, + { + // Dr Mario cape + it_803F70F8, + NULL, + itMarioCape_Logic41_Destroyed, + it_2725_Logic41_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802B2870, + }, + { + // Sheik vanish + it_803F70B8, + NULL, + NULL, + NULL, + NULL, + NULL, + itSeakVanish_Logic42_DmgDealt, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802B1DCC, + }, + { + // Yoshi egg throw + it_803F7118, + NULL, + NULL, + itYoshiEggThrow_Logic43_PickedUp, + NULL, + NULL, + it_802B2C04, + NULL, + NULL, + it_802B2E5C, + it_2725_Logic43_Clanked, + NULL, + it_802B2F88, + it_802B2E7C, + it_802B2FA8, + }, + { + // Yoshi egg lay + it_803F94A0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_27CF_Logic114_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_27CF_Logic114_EvtUnk, + }, + { + // Yoshi star + it_803F7158, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802B309C, + NULL, + NULL, + it_802B314C, + it_802B30C0, + it_802B3108, + it_802B312C, + it_802B30E4, + it_802B3348, + }, + { + // Pikachu tjolt ground + it_803F7190, + NULL, + it_2725_Logic106_Destroyed, + NULL, + NULL, + NULL, + it_2725_Logic106_DmgDealt, + NULL, + NULL, + it_2725_Logic106_Reflected, + it_2725_Logic106_Clanked, + it_2725_Logic106_Absorbed, + it_2725_Logic106_ShieldBounced, + it_2725_Logic106_HitShield, + itPikachuTJoltGround_Logic106_EvtUnk, + }, + { + // Pikachu tjolt air + it_803F71D8, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic107_DmgDealt, + NULL, + NULL, + it_2725_Logic107_Reflected, + it_2725_Logic107_Clanked, + it_2725_Logic107_Absorbed, + it_2725_Logic107_ShieldBounced, + it_2725_Logic107_HitShield, + itPikachuTJoltAir_Logic107_EvtUnk, + }, + { + // Pichu tjolt ground + it_803F7190, + NULL, + it_2725_Logic106_Destroyed, + NULL, + NULL, + NULL, + it_2725_Logic106_DmgDealt, + NULL, + NULL, + it_2725_Logic106_Reflected, + it_2725_Logic106_Clanked, + it_2725_Logic106_Absorbed, + it_2725_Logic106_ShieldBounced, + it_2725_Logic106_HitShield, + itPikachuTJoltGround_Logic106_EvtUnk, + }, + { + // Pichu tjolt air + it_803F71D8, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic107_DmgDealt, + NULL, + NULL, + it_2725_Logic107_Reflected, + it_2725_Logic107_Clanked, + it_2725_Logic107_Absorbed, + it_2725_Logic107_ShieldBounced, + it_2725_Logic107_HitShield, + itPikachuTJoltAir_Logic107_EvtUnk, + }, + { + // Samus bomb + it_803F7220, + NULL, + NULL, + NULL, + NULL, + NULL, + itSamusBomb_Logic50_DmgDealt, + NULL, + itSamusBomb_Logic50_EnteredAir, + it_2725_Logic50_Reflected, + itSamusBomb_Logic50_Clanked, + NULL, + itSamusBomb_Logic50_ShieldBounced, + itSamusBomb_Logic50_HitShield, + itSamusBomb_Logic50_EvtUnk, + }, + { + // Samus charge shot + it_803F7288, + NULL, + it_2725_Logic108_Destroyed, + it_2725_Logic108_PickedUp, + NULL, + NULL, + itSamusChargeshot_Logic108_DmgDealt, + NULL, + NULL, + it_2725_Logic108_Reflected, + itSamusChargeshot_Logic108_Clanked, + itSamusChargeshot_Logic108_Absorbed, + it_2725_Logic108_ShieldBounced, + itSamusChargeshot_Logic108_HitShield, + itSamusChargeshot_Logic108_EvtUnk, + }, + { + // Samus missile + it_803F7340, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic52_DmgDealt, + NULL, + NULL, + it_2725_Logic52_Reflected, + it_2725_Logic52_Clanked, + NULL, + it_2725_Logic52_ShieldBounced, + it_2725_Logic52_HitShield, + it_2725_Logic52_EvtUnk, + }, + { + // Samus grapple beam + it_803F73A8, + itSamusGrapple_Logic53_Spawned, + NULL, + itSamusGrapple_Logic53_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itSamusGrapple_Logic53_EvtUnk, + }, + { + // Sheik chain + it_803F7438, + NULL, + NULL, + it_2725_Logic54_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itSeakChain_Logic54_EvtUnk, + }, + { + // Peach explode + it_803F7488, + NULL, + NULL, + NULL, + NULL, + NULL, + itPeachExplode_Logic55_DmgDealt, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itPeachExplode_Logic55_EvtUnk, + }, + { + // Peach turnip + it_803F74A8, + NULL, + itPeachTurnip_Logic56_Destroyed, + itPeachTurnip_Logic56_PickedUp, + itPeachTurnip_Logic56_Dropped, + itPeachTurnip_Logic56_Thrown, + itPeachTurnip_Logic56_DmgDealt, + NULL, + NULL, + itPeachTurnip_Logic56_Reflected, + itPeachTurnip_Logic56_Clanked, + NULL, + itPeachTurnip_Logic56_ShieldBounced, + itPeachTurnip_Logic56_HitShield, + itPeachTurnip_Logic56_EvtUnk, + }, + { + // Bowser flame + ItemStateTable_KoopaFlame, + NULL, + NULL, + NULL, + NULL, + NULL, + itKoopaFlame_Logic111_DmgDealt, + NULL, + NULL, + itKoopaFlame_Logic111_Reflected, + itKoopaFlame_Logic111_Clanked, + itKoopaFlame_Logic111_Absorbed, + itKoopaFlame_Logic111_ShieldBounced, + itKoopaFlame_Logic111_HitShield, + itKoopaFlame_Logic111_EvtUnk, + }, + { + // Ness bat + it_803F6C68, + NULL, + NULL, + it_2725_Logic58_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itNessBat_Logic58_EvtUnk, + }, + { + // Ness yo-yo + it_803F7558, + NULL, + NULL, + itNessYoyo_Logic59_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic59_EvtUnk, + }, + { + // Peach parasol + it_803F74F8, + NULL, + itPeachParasol_Logic60_Destroyed, + itPeachParasol_Logic60_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itPeachParasol_Logic60_EvtUnk, + }, + { + // Peach toad + it_803F7528, + NULL, + itPeachToad_Logic91_Destroyed, + itPeachToad_Logic91_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itPeachToad_Logic91_EvtUnk, + }, + { + // Luigi fireball + it_803F75C0, + NULL, + NULL, + NULL, + NULL, + NULL, + itLuigiFireball_Logic89_DmgDealt, + NULL, + NULL, + itLuigiFireball_Logic89_Reflected, + itLuigiFireball_Logic89_Clanked, + itLuigiFireball_Logic89_Absorbed, + itLuigiFireball_Logic89_ShieldBounced, + itLuigiFireball_Logic89_HitShield, + itLuigiFireball_Logic89_EvtUnk, + }, + { + // Ice Climbers ice + it_803F7668, + NULL, + it_2725_Logic90_Destroyed, + NULL, + NULL, + NULL, + itClimbersIce_Logic90_DmgDealt, + NULL, + NULL, + itClimbersIce_Logic90_Reflected, + itClimbersIce_Logic90_Clanked, + itClimbersIce_Logic90_Absorbed, + itClimbersIce_Logic90_ShieldBounced, + it_2725_Logic90_HitShield, + itClimbersIce_Logic90_EvtUnk, + }, + { + // Ice Climbers blizzard + it_803F76A8, + NULL, + NULL, + NULL, + NULL, + NULL, + itClimbersBlizzard_DmgDealt, + NULL, + NULL, + itClimbersBlizzard_Reflected, + itClimbersBlizzard_Clanked, + itClimbersBlizzard_Absorbed, + itClimbersBlizzard_ShieldBounced, + itClimbersBlizzard_HitShield, + itClimbersBlizzard_EvtUnk, + }, + { + // Zelda din fire + ItemStateTable_ZeldaDinFire, + NULL, + itZeldaDinFire_Logic65_Destroyed, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itZeldaDinFire_Logic65_Reflected, + itZeldaDinFire_Logic65_Clanked, + itZeldaDinFire_Logic65_Absorbed, + NULL, + NULL, + itZeldaDinFire_Logic65_EvtUnk, + }, + { + // Zelda din fire explode + it_803F7740, + NULL, + itZeldaDinFireExplode_Logic66_Destroyed, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itZeldaDinFireExplode_Logic66_Clanked, + itZeldaDinFireExplode_Logic66_Absorbed, + itZeldaDinFireExplode_Logic66_ShieldBounced, + itZeldaDinFireExplode_Logic66_HitShield, + itZeldaDinFireExplode_Logic66_EvtUnk, + }, + { + // Mewtwo disable + it_803F7750, + NULL, + itMewtwoDisable_Logic67_Destroyed, + NULL, + NULL, + NULL, + itMewtwoDisable_Logic67_DmgDealt, + NULL, + NULL, + itMewtwoDisable_Logic67_Reflected, + itMewtwoDisable_Logic67_Clanked, + itMewtwoDisable_Logic67_Absorbed, + itMewtwoDisable_Logic67_ShieldBounced, + itMewtwoDisable_Logic67_HitShield, + itMewtwoDisable_Logic67_EvtUnk, + }, + { + // Peach toad spore + it_803F7548, + NULL, + NULL, + NULL, + NULL, + NULL, + itPeachToadSpore_Logic92_DmgDealt, + NULL, + NULL, + itPeachToadSpore_Logic68_Reflected, + itPeachToadSpore_Logic68_Clanked, + itPeachToadSpore_Logic68_Absorbed, + itPeachToadSpore_Logic68_ShieldBounced, + itPeachToadSpore_Logic68_HitShield, + itPeachToadSpore_Logic92_EvtUnk, + }, + { + // Mewtwo shadow ball + it_803F7760, + NULL, + it_2725_Logic101_Destroyed, + it_2725_Logic101_PickedUp, + NULL, + NULL, + itMewtwoShadowball_Logic101_DmgDealt, + NULL, + NULL, + it_2725_Logic101_Reflected, + itMewtwoShadowball_Logic101_Clanked, + itMewtwoShadowball_Logic101_Absorbed, + it_2725_Logic101_ShieldBounced, + itMewtwoShadowball_Logic101_HitShield, + itMewtwoShadowball_Logic101_EvtUnk, + }, + { + // Ice Climbers string (belay) + it_803F76B8, + NULL, + NULL, + it_2725_Logic70_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic70_EvtUnk, + }, + { + // Game & Watch greenhouse (insecticide spray) + it_803F7898, + NULL, + itGamewatchGreenhouse_Destroyed, + itGamewatchGreenhouse_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGamewatchGreenhouse_EvtUnk, + }, + { + // Game & Watch manhole + it_803F78D8, + NULL, + itGameWatchManhole_Logic72_Destroyed, + itGameWatchManhole_Logic72_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchManhole_Logic72_EvtUnk, + }, + { + // Game & Watch fire + it_803F78E8, + NULL, + itGamewatchFire_Destroyed, + itGamewatchFire_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGamewatchFire_EvtUnk, + }, + { + // Game & Watch parachute + it_803F78F8, + NULL, + itGameWatchParachute_Logic74_Destroyed, + itGameWatchParachute_Logic74_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchParachute_Logic74_EvtUnk, + }, + { + // Game & Watch turtle + it_803F7918, + NULL, + itGameWatchTurtle_Logic75_Destroyed, + itGameWatchTurtle_Logic75_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchTurtle_Logic75_EvtUnk, + }, + { + // Game & Watch breath + it_803F7938, + NULL, + itGameWatchBreath_Logic76_Destroyed, + itGameWatchBreath_Logic76_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchBreath_Logic76_EvtUnk, + }, + { + // Game & Watch judge + it_803F7968, + NULL, + itGameWatchJudge_Logic77_Destroyed, + it_2725_Logic77_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchJudge_Logic77_EvtUnk, + }, + { + // Game & Watch panic + it_803F79A0, + NULL, + itGameWatchPanic_Logic78_Destroyed, + itGameWatchPanic_Logic78_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchPanic_Logic78_EvtUnk, + }, + { + // Game & Watch chef + it_803F79E0, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchChef_Logic112_DmgDealt, + NULL, + NULL, + itGameWatchChef_Logic112_Reflected, + it_2725_Logic112_Clanked, + it_2725_Logic112_Absorbed, + itGameWatchChef_Logic112_ShieldBounced, + it_2725_Logic112_HitShield, + itGameWatchChef_Logic112_EvtUnk, + }, + { + // Young Link milk + it_803F7A28, + NULL, + NULL, + it_2725_Logic80_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itCLinkMilk_Logic80_EvtUnk, + }, + { + // Game & Watch rescue + it_803F79C0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchRescue_Logic81_EvtUnk, + }, + { + // Master Hand laser + it_803F9378, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itMasterHandLaser_Logic84_EvtUnk, + }, + { + // Master Hand bullet + it_803F9388, + NULL, + NULL, + NULL, + NULL, + NULL, + itMasterHandBullet_Logic83_DmgDealt, + NULL, + NULL, + itMasterHandBullet_Logic83_Reflected, + itMasterHandBullet_Logic83_Clanked, + itMasterHandBullet_Logic83_Absorbed, + itMasterHandBullet_Logic83_ShieldBounced, + itMasterHandBullet_Logic83_HitShield, + itMasterHandBullet_Logic85_EvtUnk, + }, + { + // Crazy Hand laser + it_803F9378, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itMasterHandLaser_Logic84_EvtUnk, + }, + { + // Crazy Hand bullet + it_803F9388, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itMasterHandBullet_Logic85_EvtUnk, + }, + { + // Crazy Hand bomb + it_803F93A8, + NULL, + NULL, + NULL, + NULL, + NULL, + itCrazyHandBomb_Logic86_DmgDealt, + NULL, + NULL, + itCrazyHandBomb_Logic86_Reflected, + NULL, + NULL, + NULL, + NULL, + itCrazyHandBomb_Logic86_EvtUnk, + }, + { + it_803F6788, + NULL, + NULL, + NULL, + NULL, + NULL, + itMarioFireball_Logic87_DmgDealt, + NULL, + NULL, + itMarioFireball_Logic87_Reflected, + itMarioFireball_Logic87_Clanked, + itMarioFireball_Logic87_Absorbed, + itMarioFireball_Logic87_ShieldBounced, + itMarioFireball_Logic87_HitShield, + itMarioFireball_Logic87_EvtUnk, + }, + { + it_803F75D0, + NULL, + NULL, + NULL, + NULL, + NULL, + itDrMarioPill_DmgDealt, + NULL, + NULL, + itDrMarioPill_Reflected, + itDrMarioPill_Clanked, + itDrMarioPill_Absorbed, + itDrMarioPill_ShieldBounced, + itDrMarioPill_HitShield, + itDrMarioPill_EvtUnk, + }, + { + it_803F75C0, + NULL, + NULL, + NULL, + NULL, + NULL, + itLuigiFireball_Logic89_DmgDealt, + NULL, + NULL, + itLuigiFireball_Logic89_Reflected, + itLuigiFireball_Logic89_Clanked, + itLuigiFireball_Logic89_Absorbed, + itLuigiFireball_Logic89_ShieldBounced, + itLuigiFireball_Logic89_HitShield, + itLuigiFireball_Logic89_EvtUnk, + }, + { + it_803F7668, + NULL, + it_2725_Logic90_Destroyed, + NULL, + NULL, + NULL, + itClimbersIce_Logic90_DmgDealt, + NULL, + NULL, + itClimbersIce_Logic90_Reflected, + itClimbersIce_Logic90_Clanked, + itClimbersIce_Logic90_Absorbed, + itClimbersIce_Logic90_ShieldBounced, + it_2725_Logic90_HitShield, + itClimbersIce_Logic90_EvtUnk, + }, + { + it_803F7528, + NULL, + itPeachToad_Logic91_Destroyed, + itPeachToad_Logic91_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itPeachToad_Logic91_EvtUnk, + }, + { + it_803F7548, + NULL, + NULL, + NULL, + NULL, + NULL, + itPeachToadSpore_Logic92_DmgDealt, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itPeachToadSpore_Logic92_EvtUnk, + }, + { + it_803F67D0, + NULL, + NULL, + NULL, + NULL, + NULL, + itFoxLaser_Logic94_Clanked, + NULL, + NULL, + itFoxLaser_Logic94_Reflected, + itFoxLaser_Logic94_Clanked, + itFoxLaser_Logic94_Absorbed, + itFoxLaser_Logic94_ShieldBounced, + itFoxLaser_Logic94_HitShield, + itFoxLaser_Logic94_EvtUnk, + }, + { + it_803F67D0, + NULL, + NULL, + NULL, + NULL, + NULL, + itFoxLaser_Logic94_Clanked, + NULL, + NULL, + itFoxLaser_Logic94_Reflected, + itFoxLaser_Logic94_Clanked, + itFoxLaser_Logic94_Absorbed, + itFoxLaser_Logic94_ShieldBounced, + itFoxLaser_Logic94_HitShield, + itFoxLaser_Logic94_EvtUnk, + }, + { + it_803F6CA8, + NULL, + NULL, + itFoxBlaster_Logic96_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itFoxBlaster_Logic96_EvtUnk, + }, + { + it_803F6CA8, + NULL, + NULL, + itFoxBlaster_Logic96_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itFoxBlaster_Logic96_EvtUnk, + }, + { + it_803F6A28, + NULL, + itLinkArrow_Logic98_Destroyed, + itLinkArrow_Logic98_PickedUp, + NULL, + NULL, + itLinkArrow_Logic98_DmgDealt, + NULL, + NULL, + itLinkArrow_Logic98_Reflected, + itLinkArrow_Logic98_Clanked, + NULL, + NULL, + itLinkArrow_Logic98_HitShield, + itLinkArrow_Logic98_EvtUnk, + }, + { + it_803F6A28, + NULL, + itLinkArrow_Logic98_Destroyed, + itLinkArrow_Logic98_PickedUp, + NULL, + NULL, + itLinkArrow_Logic98_DmgDealt, + NULL, + NULL, + itLinkArrow_Logic98_Reflected, + itLinkArrow_Logic98_Clanked, + NULL, + NULL, + itLinkArrow_Logic98_HitShield, + itLinkArrow_Logic98_EvtUnk, + }, + { + it_803F6E98, + NULL, + itLinkBow_Logic100_Destroyed, + itLinkBow_Logic100_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itLinkBow_Logic100_EvtUnk, + }, + { + it_803F6E98, + NULL, + itLinkBow_Logic100_Destroyed, + itLinkBow_Logic100_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itLinkBow_Logic100_EvtUnk, + }, + { + it_803F7760, + NULL, + it_2725_Logic101_Destroyed, + it_2725_Logic101_PickedUp, + NULL, + NULL, + itMewtwoShadowball_Logic101_DmgDealt, + NULL, + NULL, + it_2725_Logic101_Reflected, + itMewtwoShadowball_Logic101_Clanked, + itMewtwoShadowball_Logic101_Absorbed, + it_2725_Logic101_ShieldBounced, + itMewtwoShadowball_Logic101_HitShield, + itMewtwoShadowball_Logic101_EvtUnk, + }, + { + it_803F6B70, + NULL, + it_2725_Logic102_Destroyed, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itNesspkflash_Logic102_Reflected, + itNesspkflash_Logic102_Clanked, + itNesspkflash_Logic102_Absorbed, + NULL, + NULL, + itNesspkflash_Logic102_EvtUnk, + }, + { + it_803F6F40, + NULL, + it_2725_Logic103_Destroyed, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itNessPKFlashExplode_Logic103_Clanked, + itNessPKFlashExplode_Logic103_Absorbed, + itNessPKFlashExplode_Logic103_ShieldBounced, + itNessPKFlashExplode_Logic103_HitShield, + itNessPKFlashExplode_Logic103_EvtUnk, + }, + { + it_803F7190, + NULL, + it_2725_Logic106_Destroyed, + NULL, + NULL, + NULL, + it_2725_Logic106_DmgDealt, + NULL, + NULL, + it_2725_Logic106_Reflected, + it_2725_Logic106_Clanked, + it_2725_Logic106_Absorbed, + it_2725_Logic106_ShieldBounced, + it_2725_Logic106_HitShield, + itPikachuTJoltGround_Logic106_EvtUnk, + }, + { + it_803F71D8, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic107_DmgDealt, + NULL, + NULL, + it_2725_Logic107_Reflected, + it_2725_Logic107_Clanked, + it_2725_Logic107_Absorbed, + it_2725_Logic107_ShieldBounced, + it_2725_Logic107_HitShield, + itPikachuTJoltAir_Logic107_EvtUnk, + }, + { + it_803F7190, + NULL, + it_2725_Logic106_Destroyed, + NULL, + NULL, + NULL, + it_2725_Logic106_DmgDealt, + NULL, + NULL, + it_2725_Logic106_Reflected, + it_2725_Logic106_Clanked, + it_2725_Logic106_Absorbed, + it_2725_Logic106_ShieldBounced, + it_2725_Logic106_HitShield, + itPikachuTJoltGround_Logic106_EvtUnk, + }, + { + it_803F71D8, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic107_DmgDealt, + NULL, + NULL, + it_2725_Logic107_Reflected, + it_2725_Logic107_Clanked, + it_2725_Logic107_Absorbed, + it_2725_Logic107_ShieldBounced, + it_2725_Logic107_HitShield, + itPikachuTJoltAir_Logic107_EvtUnk, + }, + { + it_803F7288, + NULL, + it_2725_Logic108_Destroyed, + it_2725_Logic108_PickedUp, + NULL, + NULL, + itSamusChargeshot_Logic108_DmgDealt, + NULL, + NULL, + it_2725_Logic108_Reflected, + itSamusChargeshot_Logic108_Clanked, + itSamusChargeshot_Logic108_Absorbed, + it_2725_Logic108_ShieldBounced, + itSamusChargeshot_Logic108_HitShield, + itSamusChargeshot_Logic108_EvtUnk, + }, + { + it_803F6F50, + NULL, + itSeakNeedleThrown_Logic109_Destroyed, + NULL, + NULL, + NULL, + it_2725_Logic109_DmgDealt, + it_2725_Logic109_DmgReceived, + NULL, + it_2725_Logic109_Reflected, + it_2725_Logic109_Clanked, + NULL, + it_2725_Logic109_ShieldBounced, + it_2725_Logic109_HitShield, + itSeakNeedleThrown_Logic109_EvtUnk, + }, + { + it_803F70A8, + NULL, + NULL, + itSeakNeedleHeld_Logic110_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itSeakNeedleHeld_Logic110_EvtUnk, + }, + { + ItemStateTable_KoopaFlame, + NULL, + NULL, + NULL, + NULL, + NULL, + itKoopaFlame_Logic111_DmgDealt, + NULL, + NULL, + itKoopaFlame_Logic111_Reflected, + itKoopaFlame_Logic111_Clanked, + itKoopaFlame_Logic111_Absorbed, + itKoopaFlame_Logic111_ShieldBounced, + itKoopaFlame_Logic111_HitShield, + itKoopaFlame_Logic111_EvtUnk, + }, + { + it_803F79E0, + NULL, + NULL, + NULL, + NULL, + NULL, + itGameWatchChef_Logic112_DmgDealt, + NULL, + NULL, + itGameWatchChef_Logic112_Reflected, + it_2725_Logic112_Clanked, + it_2725_Logic112_Absorbed, + itGameWatchChef_Logic112_ShieldBounced, + it_2725_Logic112_HitShield, + itGameWatchChef_Logic112_EvtUnk, + }, + { + it_803F7958, + NULL, + itKirbyGameWatchChefPan_Logic113_Destroyed, + itKirbyGameWatchChefPan_Logic113_PickedUp, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + itKirbyGameWatchChefPan_Logic113_EvtUnk, + }, + { + it_803F94A0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_27CF_Logic114_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_27CF_Logic114_EvtUnk, + }, + { + // Unk4 + it_803F8BD8, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2E5A_Logic115_DmgDealt, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2E5A_Logic115_EvtUnk, + }, + { + // Coin + it_803F93C8, + itCoin_Logic116_Spawned, + itCoin_Logic116_Destroyed, + itCoin_Logic116_PickedUp, + itCoin_Logic116_Thrown, + itCoin_Logic116_Thrown, + NULL, + itCoin_Logic116_DmgReceived, + itCoin_Logic116_EnteredAir, + NULL, + NULL, + NULL, + NULL, + NULL, + itCoin_Logic116_EvtUnk, + }, + { + // Pokemon random + it_803F8C8C, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2E6A_Logic117_DmgDealt, + it_2E6A_Logic117_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2E6A_Logic117_EvtUnk, + }, +}; + +/// Monster and Stage-specific Items +struct sdata_ItemGXLink it_803F4CA8[30] = { + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, NULL, +}; + +struct ItemLogicTable it_803F4D20[ARRAY_SIZE(it_803F4CA8)] = { + { + // Old Goomba (old-Kuri) + it_803F8320, + it_802D73F0, + it_2725_Logic9_Destroyed, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic0_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802D84D8, + }, + { + // Target (Mato) + it_803F83E0, + it_802D84F8, + it_2725_Logic9_Destroyed, + NULL, + NULL, + NULL, + NULL, + it_802D85F4, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Yoshi's Story Shy Guy (Heiho) + it_803F83F0, + it_802D8688, + it_2725_Logic9_Destroyed, + NULL, + NULL, + NULL, + NULL, + it_802D8EC8, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802D9A0C, + }, + { + // Koopa Troopa (Green) (Nokonoko) + it_803F85F0, + it_802DC69C, + it_2725_Logic9_Destroyed, + it_802DD4F4, + it_802DD59C, + it_802DD67C, + NULL, + itNokonoko_Logic3_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802DD7D0, + }, + { + // Koopa Troopa (Red) (Patapata) + it_803F88C0, + it_802E05A0, + it_2725_Logic9_Destroyed, + itPatapata_Logic4_PickedUp, + it_2725_Logic4_Dropped, + it_2725_Logic4_Thrown, + NULL, + it_2725_Logic4_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E16D8, + }, + { + // Like-Like (likelike) + it_803F8468, + it_802D9BA8, + itLikeLike_Logic5_Destroyed, + itLikeLike_Logic5_PickedUp, + it_2725_Logic5_Dropped, + itLikeLike_Logic5_Thrown, + NULL, + it_2725_Logic5_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E16D8, + }, + { + // Old Redead (old-lead) [invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Old Octorok (old-octa) [invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Old Ottosea (old-otto) + it_803F89C8, + it_802E2470, + NULL, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic8_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Polar Bear (whitebea) + it_803F8A88, + it_802E37BC, + it_2725_Logic9_Destroyed, + itWhiteBea_Logic9_PickedUp, + it_2725_Logic9_Dropped, + it_2725_Logic9_Thrown, + NULL, + it_802E3884, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E4A24, + }, + { + // Klaptrap (klap) + it_803F8940, + it_802E1820, + itKlap_Logic10_Destroyed, + NULL, + NULL, + NULL, + NULL, + it_2725_Logic10_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E2450, + }, + { + // Green Shell (zgshell) + it_803F86C8, + it_802DE040, + itZGShell_Logic11_Destroyed, + it_2725_Logic11_PickedUp, + itZGShell_Logic11_Dropped, + itZGShell_Logic11_Thrown, + itZGShell_Logic11_DmgDealt, + itZGShell_Logic11_DmgReceived, + it_2725_Logic11_EnteredAir, + itZGShell_Logic11_Reflected, + it_2725_Logic11_Clanked, + NULL, + itZGShell_Logic11_ShieldBounced, + it_2725_Logic11_HitShield, + it_802DFED4, + }, + { + // Red Shell (green act) (zrshell) + it_803F87F0, + it_802E02E8, + itZRShell_Logic12_Destroyed, + itZRShell_Logic12_PickedUp, + itZRShell_Logic12_Dropped, + itZRShell_Logic12_Thrown, + itZRShell_Logic12_DmgDealt, + itZRShell_Logic12_DmgReceived, + itZRShell_Logic12_EnteredAir, + itZRShell_Logic12_Reflected, + itZRShell_Logic12_Clanked, + NULL, + itZRShell_Logic12_ShieldBounced, + itZRShell_Logic12_HitShield, + it_802E0468, + }, + { + // Tingle (Tincle) (on balloon) + it_803F9000, + it_802EB5C8, + NULL, + NULL, + NULL, + NULL, + itTincle_Logic13_DmgDealt, + itTincle_Logic13_DmgReceived, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802EC850, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Whispy Apple + it_803F91D0, + NULL, + NULL, + it_802EEA08, + it_802EEA70, + it_802EEB28, + it_802EEED0, + NULL, + itWhispyApple_Logic18_EnteredAir, + it_802EEF10, + it_802EEED8, + NULL, + it_802EEF68, + it_802EEF30, + it_802EEF88, + }, + { + // Whispy's Healing Apple + it_803F91D0, + NULL, + NULL, + it_802EEA08, + it_802EEA70, + it_802EEB28, + it_802EEED0, + NULL, + itWhispyApple_Logic18_EnteredAir, + it_802EEF10, + it_802EEED8, + NULL, + it_802EEF68, + it_802EEF30, + it_802EEF88, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Tool (Flatzone) + it_803F9260, + NULL, + NULL, + NULL, + NULL, + NULL, + itTools_Logic22_DmgDealt, + itTools_Logic22_DmgReceived, + NULL, + itTools_Logic22_Reflected, + it_2725_Logic22_Clanked, + it_2725_Logic22_Absorbed, + itTools_Logic22_ShieldBounced, + it_2725_Logic22_HitShield, + it_802EFA24, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Birdo (Kyasarin) + it_803F90D0, + it_802ECE90, + itKyasarin_Logic25_Destroyed, + NULL, + NULL, + NULL, + NULL, + it_802EDDC0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802EE1E0, + }, + { + // Arwing Laser + it_803F8DE8, + NULL, + it_802E79C8, + NULL, + NULL, + NULL, + it_802E838C, + NULL, + NULL, + it_802E8420, + it_802E838C, + it_802E8418, + it_802E85F4, + it_802E8784, + NULL, + }, + { + // Great Fox's Laser + it_803F8FD0, + it_802EB1EC, + NULL, + NULL, + NULL, + NULL, + itGreatFoxLaser_Logic27_DmgDealt, + NULL, + NULL, + it_2725_Logic27_Reflected, + itGreatFoxLaser_Logic27_Clanked, + itGreatFoxLaser_Logic27_Absorbed, + NULL, + NULL, + it_802EB5A8, + }, + { + // Birdo's Egg + it_803F9328, + NULL, + NULL, + itKyasarinEgg_Logic28_PickedUp, + itKyasarinEgg_Logic28_Dropped, + itKyasarinEgg_Logic28_Thrown, + it_2725_Logic28_DmgDealt, + it_802F022C, + NULL, + it_2725_Logic28_Reflected, + it_2725_Logic28_Clanked, + NULL, + itKyasarinEgg_Logic28_ShieldBounced, + it_2725_Logic28_HitShield, + it_802F0320, + }, + { + // NULL + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, +}; diff --git a/src/melee/it/it_3F2F.h b/src/melee/it/it_3F2F.h new file mode 100644 index 0000000000..a2f51f34db --- /dev/null +++ b/src/melee/it/it_3F2F.h @@ -0,0 +1,12 @@ +#ifndef GALE01_IT_3F2F +#define GALE01_IT_3F2F + +#include "it/items/types.h" +#include "it/types.h" + +/* 3F2F28 */ extern struct sdata_ItemGXLink it_803F2F28[118]; +/* 3F3100 */ extern struct ItemLogicTable it_803F3100[118]; +/* 3F4CA8 */ extern struct sdata_ItemGXLink it_803F4CA8[30]; +/* 3F4D20 */ extern struct ItemLogicTable it_803F4D20[30]; + +#endif diff --git a/src/melee/it/item.c b/src/melee/it/item.c index a3be052384..b4bc83a3ad 100644 --- a/src/melee/it/item.c +++ b/src/melee/it/item.c @@ -16,6 +16,7 @@ #include "it/it_2725.h" #include "it/it_279C.h" #include "it/it_3F14.h" +#include "it/it_3F2F.h" #include "it/itanimlist.h" #include "it/itcoll.h" #include "it/iteffect.h" From 3b981b2d6b5b39b53255bf29ce70cc9a8c27d102 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 13:46:00 -0700 Subject: [PATCH 12/20] Restore itzako prototype include --- src/melee/it/it_279C.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/melee/it/it_279C.c b/src/melee/it/it_279C.c index 1f941c93c9..f44dbea154 100644 --- a/src/melee/it/it_279C.c +++ b/src/melee/it/it_279C.c @@ -2,6 +2,7 @@ #include "it_2725.h" #include "ithitbox.h" +#include "itzako.h" #include "baselib/random.h" #include "db/db.h" From 5fd47e62c7eff529d7e83c494c24ccc07596bda1 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 14:05:12 -0700 Subject: [PATCH 13/20] Use enum values for CmSnapStatus --- src/melee/cm/cmsnap.c | 14 +++++++------- src/melee/cm/forward.h | 5 +++++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/melee/cm/cmsnap.c b/src/melee/cm/cmsnap.c index e9b868a1f9..c271ef02a2 100644 --- a/src/melee/cm/cmsnap.c +++ b/src/melee/cm/cmsnap.c @@ -20,12 +20,12 @@ static _cmsnap_data cmsnap_data; void cmSnap_800315C8(void) { HSD_ASSERT(0x55, _p(status) == CmSnapStatus_Sleep); - _p(status) = 1; + _p(status) = CmSnapStatus_0x1; } void* cmSnap_80031618(void) { - if (_p(status) != 5) { + if (_p(status) != CmSnapStatus_0x5) { return 0; } _p(status) = CmSnapStatus_Sleep; @@ -37,13 +37,13 @@ void cmSnap_80031640(HSD_GObj* arg0, int code) switch (_p(status)) { case CmSnapStatus_Sleep: break; - case 1: + case CmSnapStatus_0x1: lb_800122C8(&_p(unk1), 0, 0, 0); - _p(status) = 2; + _p(status) = CmSnapStatus_0x2; break; - case 2: - case 3: - case 4: + case CmSnapStatus_0x2: + case CmSnapStatus_0x3: + case CmSnapStatus_0x4: _p(status) += 1; break; } diff --git a/src/melee/cm/forward.h b/src/melee/cm/forward.h index 28fb313d30..757398bcd4 100644 --- a/src/melee/cm/forward.h +++ b/src/melee/cm/forward.h @@ -40,6 +40,11 @@ typedef struct CameraInputs CameraInputs; /// Named by an assert in #cmSnap_800315C8. typedef enum CmSnapStatus { /* 0x0 */ CmSnapStatus_Sleep, + /* 0x1 */ CmSnapStatus_0x1, + /* 0x2 */ CmSnapStatus_0x2, + /* 0x3 */ CmSnapStatus_0x3, + /* 0x4 */ CmSnapStatus_0x4, + /* 0x5 */ CmSnapStatus_0x5, } CmSnapStatus; #endif From 0732fe0b70c5218441765889bd59328c380fdd27 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 14:06:29 -0700 Subject: [PATCH 14/20] Use Unk names for CmSnapStatus placeholders --- src/melee/cm/cmsnap.c | 14 +++++++------- src/melee/cm/forward.h | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/melee/cm/cmsnap.c b/src/melee/cm/cmsnap.c index c271ef02a2..c4eb2f9ad3 100644 --- a/src/melee/cm/cmsnap.c +++ b/src/melee/cm/cmsnap.c @@ -20,12 +20,12 @@ static _cmsnap_data cmsnap_data; void cmSnap_800315C8(void) { HSD_ASSERT(0x55, _p(status) == CmSnapStatus_Sleep); - _p(status) = CmSnapStatus_0x1; + _p(status) = CmSnapStatus_Unk1; } void* cmSnap_80031618(void) { - if (_p(status) != CmSnapStatus_0x5) { + if (_p(status) != CmSnapStatus_Unk5) { return 0; } _p(status) = CmSnapStatus_Sleep; @@ -37,13 +37,13 @@ void cmSnap_80031640(HSD_GObj* arg0, int code) switch (_p(status)) { case CmSnapStatus_Sleep: break; - case CmSnapStatus_0x1: + case CmSnapStatus_Unk1: lb_800122C8(&_p(unk1), 0, 0, 0); - _p(status) = CmSnapStatus_0x2; + _p(status) = CmSnapStatus_Unk2; break; - case CmSnapStatus_0x2: - case CmSnapStatus_0x3: - case CmSnapStatus_0x4: + case CmSnapStatus_Unk2: + case CmSnapStatus_Unk3: + case CmSnapStatus_Unk4: _p(status) += 1; break; } diff --git a/src/melee/cm/forward.h b/src/melee/cm/forward.h index 757398bcd4..f9203c3b15 100644 --- a/src/melee/cm/forward.h +++ b/src/melee/cm/forward.h @@ -40,11 +40,11 @@ typedef struct CameraInputs CameraInputs; /// Named by an assert in #cmSnap_800315C8. typedef enum CmSnapStatus { /* 0x0 */ CmSnapStatus_Sleep, - /* 0x1 */ CmSnapStatus_0x1, - /* 0x2 */ CmSnapStatus_0x2, - /* 0x3 */ CmSnapStatus_0x3, - /* 0x4 */ CmSnapStatus_0x4, - /* 0x5 */ CmSnapStatus_0x5, + /* 0x1 */ CmSnapStatus_Unk1, + /* 0x2 */ CmSnapStatus_Unk2, + /* 0x3 */ CmSnapStatus_Unk3, + /* 0x4 */ CmSnapStatus_Unk4, + /* 0x5 */ CmSnapStatus_Unk5, } CmSnapStatus; #endif From 2e85d2d2becab6c8e6fe2dec2a06efe7a779d954 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 14:06:57 -0700 Subject: [PATCH 15/20] Clarify CmSnapStatus assert attribution --- src/melee/cm/forward.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/melee/cm/forward.h b/src/melee/cm/forward.h index f9203c3b15..f811b303f4 100644 --- a/src/melee/cm/forward.h +++ b/src/melee/cm/forward.h @@ -37,7 +37,8 @@ typedef struct CameraDebugMode CameraDebugMode; typedef struct CameraModeCallbacks CameraModeCallbacks; typedef struct CameraInputs CameraInputs; -/// Named by an assert in #cmSnap_800315C8. +/// @remarks @c CmSnapStatus_Sleep is named by an assert in +/// #cmSnap_800315C8. typedef enum CmSnapStatus { /* 0x0 */ CmSnapStatus_Sleep, /* 0x1 */ CmSnapStatus_Unk1, From 0df362cb02bad6c68b38fd4eaf1c5abee5fcd751 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 14:09:37 -0700 Subject: [PATCH 16/20] Remove brittle grBigBlue line reference --- src/melee/gr/grbigblue.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/melee/gr/grbigblue.c b/src/melee/gr/grbigblue.c index d790b35c48..7e8ee85914 100644 --- a/src/melee/gr/grbigblue.c +++ b/src/melee/gr/grbigblue.c @@ -2396,8 +2396,6 @@ void grBigBlue_801EB004(Ground_GObj* gobj) grBb_TrackEntry* entry; PAD_STACK(4); - /// The assert at 2328 names the per-entry jobj, so the stage model's own - /// jobj is the one scoped to this block. { HSD_JObj* jobj = GET_JOBJ(gobj); HSD_JObjSetFlagsAll(jobj, JOBJ_HIDDEN); From dcc40ea91cdfeda16d556e4152ed8d4886c4e8e0 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 14:13:28 -0700 Subject: [PATCH 17/20] Flatten grBigBlue stage model setup --- src/melee/gr/grbigblue.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/melee/gr/grbigblue.c b/src/melee/gr/grbigblue.c index 7e8ee85914..83dacd39d9 100644 --- a/src/melee/gr/grbigblue.c +++ b/src/melee/gr/grbigblue.c @@ -2386,6 +2386,7 @@ static grBb_TrackEntry grBb_TrackEntries[12] = { void grBigBlue_801EB004(Ground_GObj* gobj) { + HSD_JObj* stage_jobj = GET_JOBJ(gobj); Ground* gp = gobj->user_data; HSD_JObj* jobj; Vec3 pos; @@ -2396,13 +2397,10 @@ void grBigBlue_801EB004(Ground_GObj* gobj) grBb_TrackEntry* entry; PAD_STACK(4); - { - HSD_JObj* jobj = GET_JOBJ(gobj); - HSD_JObjSetFlagsAll(jobj, JOBJ_HIDDEN); + HSD_JObjSetFlagsAll(stage_jobj, JOBJ_HIDDEN); - pos.x = pos.y = pos.z = 1.0F; - HSD_JObjSetScale(jobj, &pos); - } + pos.x = pos.y = pos.z = 1.0F; + HSD_JObjSetScale(stage_jobj, &pos); pos.x = pos.y = pos.z = Ground_801C0498(); From 955783841f72e5d4eb0d956d6d580ccdb1eb5d99 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 14:21:31 -0700 Subject: [PATCH 18/20] Use Pl_ItemLog enum throughout item tracking --- src/melee/pl/forward.h | 43 +++++++++++++- src/melee/pl/plbonus.c | 115 ++++++++++++++++++++------------------ src/melee/pl/plbonuslib.c | 12 ++-- src/melee/pl/plbonuslib.h | 5 +- src/melee/pl/types.h | 6 +- 5 files changed, 114 insertions(+), 67 deletions(-) diff --git a/src/melee/pl/forward.h b/src/melee/pl/forward.h index 8133920cf9..967b905ebe 100644 --- a/src/melee/pl/forward.h +++ b/src/melee/pl/forward.h @@ -125,8 +125,49 @@ typedef enum PlATK { PlATK_AttackNormal_End = 16, } PlATK; -/// Terminator of the bonus item-log index range. +/// Bonus item-log indices. +/// @remarks @c Pl_ItemLog_Terminate is named by asserts in #pl_8003E2CC and +/// #pl_8003E334. typedef enum Pl_ItemLog { + /* 0x00 */ Pl_ItemLog_Unk00, + /* 0x01 */ Pl_ItemLog_Unk01, + /* 0x02 */ Pl_ItemLog_Unk02, + /* 0x03 */ Pl_ItemLog_Unk03, + /* 0x04 */ Pl_ItemLog_Unk04, + /* 0x05 */ Pl_ItemLog_Unk05, + /* 0x06 */ Pl_ItemLog_Unk06, + /* 0x07 */ Pl_ItemLog_Unk07, + /* 0x08 */ Pl_ItemLog_Unk08, + /* 0x09 */ Pl_ItemLog_Unk09, + /* 0x0A */ Pl_ItemLog_Unk10, + /* 0x0B */ Pl_ItemLog_Unk11, + /* 0x0C */ Pl_ItemLog_Unk12, + /* 0x0D */ Pl_ItemLog_Unk13, + /* 0x0E */ Pl_ItemLog_Unk14, + /* 0x0F */ Pl_ItemLog_Unk15, + /* 0x10 */ Pl_ItemLog_Unk16, + /* 0x11 */ Pl_ItemLog_Unk17, + /* 0x12 */ Pl_ItemLog_Unk18, + /* 0x13 */ Pl_ItemLog_Unk19, + /* 0x14 */ Pl_ItemLog_Unk20, + /* 0x15 */ Pl_ItemLog_Unk21, + /* 0x16 */ Pl_ItemLog_Unk22, + /* 0x17 */ Pl_ItemLog_Unk23, + /* 0x18 */ Pl_ItemLog_Unk24, + /* 0x19 */ Pl_ItemLog_Unk25, + /* 0x1A */ Pl_ItemLog_Unk26, + /* 0x1B */ Pl_ItemLog_Unk27, + /* 0x1C */ Pl_ItemLog_Unk28, + /* 0x1D */ Pl_ItemLog_Unk29, + /* 0x1E */ Pl_ItemLog_Unk30, + /* 0x1F */ Pl_ItemLog_Unk31, + /* 0x20 */ Pl_ItemLog_Unk32, + /* 0x21 */ Pl_ItemLog_Unk33, + /* 0x22 */ Pl_ItemLog_Unk34, + /* 0x23 */ Pl_ItemLog_Unk35, + /* 0x24 */ Pl_ItemLog_Unk36, + /* 0x25 */ Pl_ItemLog_Unk37, + /* 0x26 */ Pl_ItemLog_Unk38, /* 0x27 */ Pl_ItemLog_Terminate = 39, } Pl_ItemLog; diff --git a/src/melee/pl/plbonus.c b/src/melee/pl/plbonus.c index 96acce5ad4..d3bc4e1a47 100644 --- a/src/melee/pl/plbonus.c +++ b/src/melee/pl/plbonus.c @@ -110,13 +110,13 @@ void pl_8003891C(int player) pl_80041524(player); pl_800418F4(player); - for (i = 0; i < 39; ++i) { + for (i = 0; i < Pl_ItemLog_Terminate; ++i) { temp_r31->x0_staleMoveTable.x674[i] = 0; } - for (i = 0; i < 39; ++i) { + for (i = 0; i < Pl_ItemLog_Terminate; ++i) { temp_r31->x0_staleMoveTable.x710[i] = 0; } - for (i = 0; i < 39; ++i) { + for (i = 0; i < Pl_ItemLog_Terminate; ++i) { temp_r31->x0_staleMoveTable.x7AC[i] = 0; } for (i = 0; i < 30; ++i) { @@ -981,7 +981,7 @@ void fn_8003C340(int player) setFlag(player, 0x93); return; } - if (temp_r3 == pl_8003E2CC(player, 7)) { + if (temp_r3 == pl_8003E2CC(player, Pl_ItemLog_Unk07)) { setFlag(player, 0xB3); } if (pl_8003E420(player) == it_8026B7D8()) { @@ -989,13 +989,17 @@ void fn_8003C340(int player) } temp_r3_2 = it_8026B7E0(); - if (temp_r3_2 != 0 && temp_r3_2 == pl_8003E334(player, 0x12)) { + if (temp_r3_2 != 0 && + temp_r3_2 == pl_8003E334(player, Pl_ItemLog_Unk18)) + { setFlag(player, 0xA0); } count = 0; - for (i = 0; i < 0x27; i++) { - if (i >= 6 && i != 0x12 && pl_8003E2CC(player, i) != 0) { + for (i = 0; i < Pl_ItemLog_Terminate; i++) { + if (i >= Pl_ItemLog_Unk06 && i != Pl_ItemLog_Unk18 && + pl_8003E2CC(player, i) != 0) + { count++; } } @@ -1011,60 +1015,60 @@ void fn_8003C340(int player) var_r29 = 0; var_r30 = 0; - for (i = 0; i < 0x27; i++) { + for (i = 0; i < Pl_ItemLog_Terminate; i++) { temp_r3_3 = pl_8003E2CC(player, i); switch (i) { - case 11: - case 12: - case 13: - case 22: - case 23: - case 24: - case 28: + case Pl_ItemLog_Unk11: + case Pl_ItemLog_Unk12: + case Pl_ItemLog_Unk13: + case Pl_ItemLog_Unk22: + case Pl_ItemLog_Unk23: + case Pl_ItemLog_Unk24: + case Pl_ItemLog_Unk28: var_r30 += temp_r3_3; break; - case 16: - case 21: - case 25: + case Pl_ItemLog_Unk16: + case Pl_ItemLog_Unk21: + case Pl_ItemLog_Unk25: var_r29 += temp_r3_3; break; - case 8: - case 9: - case 35: - case 37: + case Pl_ItemLog_Unk08: + case Pl_ItemLog_Unk09: + case Pl_ItemLog_Unk35: + case Pl_ItemLog_Unk37: var_r28 += temp_r3_3; break; - case 18: + case Pl_ItemLog_Unk18: var_r27 += temp_r3_3; break; - case 26: - case 27: - case 31: - case 32: - case 33: + case Pl_ItemLog_Unk26: + case Pl_ItemLog_Unk27: + case Pl_ItemLog_Unk31: + case Pl_ItemLog_Unk32: + case Pl_ItemLog_Unk33: var_r26 += temp_r3_3; break; - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 14: - case 15: - case 17: - case 19: - case 20: - case 30: - case 34: - case 36: - case 38: + case Pl_ItemLog_Unk00: + case Pl_ItemLog_Unk01: + case Pl_ItemLog_Unk02: + case Pl_ItemLog_Unk03: + case Pl_ItemLog_Unk04: + case Pl_ItemLog_Unk05: + case Pl_ItemLog_Unk06: + case Pl_ItemLog_Unk07: + case Pl_ItemLog_Unk14: + case Pl_ItemLog_Unk15: + case Pl_ItemLog_Unk17: + case Pl_ItemLog_Unk19: + case Pl_ItemLog_Unk20: + case Pl_ItemLog_Unk30: + case Pl_ItemLog_Unk34: + case Pl_ItemLog_Unk36: + case Pl_ItemLog_Unk38: var_r25 += temp_r3_3; break; - case 10: - case 29: + case Pl_ItemLog_Unk10: + case Pl_ItemLog_Unk29: var_r24 += temp_r3_3; break; } @@ -1101,17 +1105,18 @@ void fn_8003C340(int player) { setFlag(player, 0xA6); } - if (pl_8003E2CC(player, 0x1A) + pl_8003E2CC(player, 0x1B) >= + if (pl_8003E2CC(player, Pl_ItemLog_Unk26) + + pl_8003E2CC(player, Pl_ItemLog_Unk27) >= pl_804D6470->x168) { setFlag(player, 0xAE); } - for (i = 0; i < 0x27; i++) { + for (i = 0; i < Pl_ItemLog_Terminate; i++) { switch (i) { - case 0xA: - case 0x19: - case 0x1A: + case Pl_ItemLog_Unk10: + case Pl_ItemLog_Unk25: + case Pl_ItemLog_Unk26: if (pl_8003E2CC(player, i) == 0) { goto skip; } @@ -1126,13 +1131,13 @@ void fn_8003C340(int player) setFlag(player, 0xAF); skip: - if (pl_8003E2CC(player, 7) >= pl_804D6470->x170) { + if (pl_8003E2CC(player, Pl_ItemLog_Unk07) >= pl_804D6470->x170) { setFlag(player, 0xB5); } - if (pl_8003E2CC(player, 9) >= pl_804D6470->x174) { + if (pl_8003E2CC(player, Pl_ItemLog_Unk09) >= pl_804D6470->x174) { setFlag(player, 0xBC); } - if (pl_8003E2CC(player, 8) >= pl_804D6470->x178) { + if (pl_8003E2CC(player, Pl_ItemLog_Unk08) >= pl_804D6470->x178) { setFlag(player, 0xBD); } if (pl_8003E7D4(player, 0xB7) != 0) { diff --git a/src/melee/pl/plbonuslib.c b/src/melee/pl/plbonuslib.c index 3196060909..443c0ab512 100644 --- a/src/melee/pl/plbonuslib.c +++ b/src/melee/pl/plbonuslib.c @@ -476,7 +476,7 @@ void pl_8003E17C(int player_id, int arg1, } } -u32 pl_8003E2CC(int arg0, int pl_itemlog_kind) +u32 pl_8003E2CC(int arg0, Pl_ItemLog pl_itemlog_kind) { HSD_ASSERT(555, pl_itemlog_kind < Pl_ItemLog_Terminate); @@ -484,7 +484,7 @@ u32 pl_8003E2CC(int arg0, int pl_itemlog_kind) ->x0_staleMoveTable.x674[pl_itemlog_kind]; } -u32 pl_8003E334(int arg0, int pl_itemlog_kind) +u32 pl_8003E334(int arg0, Pl_ItemLog pl_itemlog_kind) { HSD_ASSERT(564, pl_itemlog_kind < Pl_ItemLog_Terminate); @@ -532,13 +532,13 @@ inline int match_item_kind(int kind) } else { switch (kind) { case It_Kind_Lucky_Egg: - return 0x23; + return Pl_ItemLog_Unk35; case It_Kind_WhispyApple: - return 0x24; + return Pl_ItemLog_Unk36; case It_Kind_WhispyHealApple: - return 0x25; + return Pl_ItemLog_Unk37; case It_Kind_Hammer_Head: - return 0x26; + return Pl_ItemLog_Unk38; default: return -1; } diff --git a/src/melee/pl/plbonuslib.h b/src/melee/pl/plbonuslib.h index 4d8ec19cb7..ad064d5e94 100644 --- a/src/melee/pl/plbonuslib.h +++ b/src/melee/pl/plbonuslib.h @@ -5,6 +5,7 @@ #include #include "it/forward.h" +#include "pl/forward.h" /* 03D60C */ bool pl_8003D60C(int); /* 03D644 */ void pl_8003D644(int, int, int, int); @@ -15,8 +16,8 @@ /* 03E114 */ void pl_8003E114(int, int, float); /* 03E150 */ void pl_8003E150(int slot, int); /* 03E17C */ void pl_8003E17C(int, int, Item_GObj*); -/* 03E2CC */ u32 pl_8003E2CC(int, int pl_itemlog_kind); -/* 03E334 */ u32 pl_8003E334(int, int pl_itemlog_kind); +/* 03E2CC */ u32 pl_8003E2CC(int, Pl_ItemLog pl_itemlog_kind); +/* 03E334 */ u32 pl_8003E334(int, Pl_ItemLog pl_itemlog_kind); /* 03E39C */ int pl_8003E39C(int); /* 03E420 */ u32 pl_8003E420(int); /* 03E4A4 */ void pl_8003E4A4(int slot, bool, void*, int); diff --git a/src/melee/pl/types.h b/src/melee/pl/types.h index b2c7bae274..2f504e8255 100644 --- a/src/melee/pl/types.h +++ b/src/melee/pl/types.h @@ -118,9 +118,9 @@ struct StaleMoveTable { u16 x12_b0 : 1; } x10[6]; } x5EC; - /* +674 */ u32 x674[39]; - /* +710 */ int x710[39]; - /* +7AC */ int x7AC[39]; + /* +674 */ u32 x674[Pl_ItemLog_Terminate]; + /* +710 */ int x710[Pl_ItemLog_Terminate]; + /* +7AC */ int x7AC[Pl_ItemLog_Terminate]; /* +848 */ int x848[30]; /* +8C0 */ struct pl_x8C0_t { int x0; From 8687c4264278fe413caef7f68c8954743782c7f3 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 14:26:39 -0700 Subject: [PATCH 19/20] Complete Gm_Player enum range --- src/melee/gm/forward.h | 11 ++++++++++- src/melee/pl/plbonus.c | 4 ---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/melee/gm/forward.h b/src/melee/gm/forward.h index b12761b404..c8b30aebc5 100644 --- a/src/melee/gm/forward.h +++ b/src/melee/gm/forward.h @@ -167,9 +167,18 @@ typedef struct VsApproachData VsApproachData; typedef bool (*GmRouteCallback)(int); -/// Number of player slots. +/// Player slot indices. +/// @remarks @c Gm_Player_NumMax is named by an assert in #pl_8004049C. +/// @c Gm_Player_Other is named by asserts in #setFlag and #setPointValue. typedef enum Gm_Player { + /* 0x00 */ Gm_Player_Unk0, + /* 0x01 */ Gm_Player_Unk1, + /* 0x02 */ Gm_Player_Unk2, + /* 0x03 */ Gm_Player_Unk3, + /* 0x04 */ Gm_Player_Unk4, + /* 0x05 */ Gm_Player_Unk5, /* 0x06 */ Gm_Player_NumMax = 6, + /* 0x06 */ Gm_Player_Other = Gm_Player_NumMax, } Gm_Player; #endif diff --git a/src/melee/pl/plbonus.c b/src/melee/pl/plbonus.c index d3bc4e1a47..1b95090a69 100644 --- a/src/melee/pl/plbonus.c +++ b/src/melee/pl/plbonus.c @@ -16,10 +16,6 @@ #include #include -enum { - Gm_Player_Other = 6, -}; - /// Sets a bonus flag boolean to true static void setFlag(int player, int kind) { From 6a02989c9ecf8b3f214f4c9b8464b65ab938174a Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Sun, 26 Jul 2026 14:29:29 -0700 Subject: [PATCH 20/20] Apply clang-format to Pl_ItemLog use --- src/melee/pl/plbonus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/melee/pl/plbonus.c b/src/melee/pl/plbonus.c index 1b95090a69..64f6edd398 100644 --- a/src/melee/pl/plbonus.c +++ b/src/melee/pl/plbonus.c @@ -985,9 +985,7 @@ void fn_8003C340(int player) } temp_r3_2 = it_8026B7E0(); - if (temp_r3_2 != 0 && - temp_r3_2 == pl_8003E334(player, Pl_ItemLog_Unk18)) - { + if (temp_r3_2 != 0 && temp_r3_2 == pl_8003E334(player, Pl_ItemLog_Unk18)) { setFlag(player, 0xA0); }