diff --git a/asm/data/code_90FE0.data.s b/asm/data/code_90FE0.data.s deleted file mode 100644 index c085d61ffb..0000000000 --- a/asm/data/code_90FE0.data.s +++ /dev/null @@ -1,114 +0,0 @@ -.include "macro.inc" - -.section .data - -glabel gPlayerStatusPtr -.word gPlayerStatus, 0x00000000, 0x00000000, 0x00000000 - -glabel D_800F7B40 -.float 0.0 - -glabel D_800F7B44 -.word 0x00000000 - -glabel D_800F7B48 -.float 0.0 - -glabel D_800F7B4C -.word 0x00000000 - -glabel D_800F7B50 -.word 0x417C1B33, 0xC0EC5C14, 0x405C9AAA, 0xBF400000 - -glabel D_800F7B60 -.word 0x3E1E0C17, 0xBEB33DB0, 0xBE3AA2E4, 0x3C3CBE62 - -glabel D_800F7B70 -.word 0x40000000, 0x40800000, 0x42000000, 0xC2000000 - -glabel D_800F7B80 -.word 0x00000000, 0x00000000, 0x00000000, 0x00000000 - -glabel D_800F7B90 -.word 0x00000000, 0x00390000, 0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390008, 0x00390007, 0x00390013, 0x00390014, 0xFFFFFFFF, 0x005A0000, 0x005A0002, 0x005A0003, 0x005A0004, 0x005A0006, 0x005A0007, 0x005A0009, 0x005A000A, 0x005A000B, 0x005A001A, 0xFFFFFFFF, 0x00580000, 0x00580001, 0x00580002, 0x00580004, 0x00580005, 0x00580006, 0x00580007, 0x00580008, 0x00580009, 0x00580012, 0x00580014, 0x0058001B, 0xFFFFFFFF - -glabel D_800F7C1C -.word 0x00580001, 0x00580004, 0x00580006, 0x00580008, 0x00580000 - -glabel D_800F7C30 -.word 0x0058001B, 0x00580001, 0x00580004, 0x00580006, 0x00580008, 0x00580000, 0x0058001B, 0x005A0003, 0x005A0006, 0x005A0009, 0x005A000B, 0x005A0000, 0x005A001A, 0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390000, 0x00390014 - -glabel D_800F7C7C -.word 0x800F7BE8, 0x800F7BE8, 0x800F7BBC, 0x800F7B94 - -glabel D_800F7C8C -.word func_802B6000_E24920, 0x00E23260, 0x00E236E0, 0x01000000, func_802B6000_E24920, 0x00E236E0, 0x00E24040, 0x01000000, func_802B6288_E23968, 0x00E236E0, 0x00E24040, 0x01000000, func_802B60B4_E240F4, 0x00E24040, 0x00E245D0, 0x01000000, func_802B60B4_E240F4, 0x00E24040, 0x00E245D0, 0x01000000, func_802B60B4_E240F4, 0x00E24040, 0x00E245D0, 0x00000000, func_802B60B4_E240F4, 0x00E24040, 0x00E245D0, 0x00000000, func_802B6198_E241D8, 0x00E24040, 0x00E245D0, 0x00000000, func_802B6294_E242D4, 0x00E24040, 0x00E245D0, 0x01000000, func_802B6348_E24388, 0x00E24040, 0x00E245D0, 0x01000000, func_802B6000_E24920, 0x00E24920, 0x00E24ED0, 0x01000000, func_802B61C0_E24AE0, 0x00E24920, 0x00E24ED0, 0x01000000, func_802B6638_E29068, 0x00E28A30, 0x00E291A0, 0x01000000, func_802B6000_E24920, 0x00E26DE0, 0x00E27510, 0x00000000, func_802B6000_E24920, 0x00E26DE0, 0x00E27510, 0x00000000, func_802B6000_E24920, 0x00E26710, 0x00E26DE0, 0x00000000, func_802B6000_E24920, 0x00E26710, 0x00E26DE0, 0x00000000, func_802B6060_E27570, 0x00E27510, 0x00E27C90, 0x00000000, func_802B66A8_E25578, 0x00E24ED0, 0x00E25D60, 0x00000000, func_802B6350_E28D80, 0x00E28A30, 0x00E291A0, 0x01000000, func_802B6508_E28F38, 0x00E28A30, 0x00E291A0, 0x00000000, func_802B6000_E24920, 0x00E27C90, 0x00E27F40, 0x00000000, func_802B6000_E24920, 0x00E287F0, 0x00E28A30, 0x00000000, func_802B6000_E24920, 0x00E27F40, 0x00E287F0, 0x00000000, func_802B6230_E24800, 0x00E245D0, 0x00E24920, 0x01000000, func_802B6120_E2A7D0, 0x00E2A6B0, 0x00E2B530, 0x01000000, func_802B6000_E24920, 0x00E25D60, 0x00E26710, 0x00000000, func_802B63D4_E28E04, 0x00E28A30, 0x00E291A0, 0x00000000, func_802B6478_E28EA8, 0x00E28A30, 0x00E291A0, 0x00000000, func_802B60A4_E29514, 0x00E29470, 0x00E2A340, 0x00000000, func_802B6000_E24920, 0x00E291A0, 0x00E29470, 0x00000000, func_802B6000_E24920, 0x00E2A340, 0x00E2A6B0, 0x00000000, func_802B6350_E28D80, 0x00E28A30, 0x00E291A0, 0x01000000, func_802B6000_E24920, 0x00E28A30, 0x00E291A0, 0x00000000, func_802B6000_E24920, 0x00E245D0, 0x00E24920, 0x01000000, func_802B609C_E28ACC, 0x00E28A30, 0x00E291A0, 0x00000000, func_802B6350_E28D80, 0x00E28A30, 0x00E291A0, 0x00000000, func_802B6350_E28D80, 0x00E236E0, 0x00E24040, 0x00000000, func_802B6350_E28D80, 0x00E28A30, 0x00E291A0, 0x01000000, 0x00000000 - -glabel D_800F7F00 -.word 0x80107CA8, 0x80107CF8, 0x80107D48, 0x80107D98, 0x80107DE8, 0x80107CA8, 0x80107E88, 0x80107ED8, 0x80107F28, 0x80107E38, 0x80107FC8, 0x80107FC8, 0x80107FC8, 0x80107FC8, 0x80107FC8, 0x80107FC8 - -glabel D_800F7F40 -.word 0x80107CD0, 0x80107D20, 0x80107D70, 0x80107DC0, 0x80107E10, 0x80107CD0, 0x80107EB0, 0x80107F00, 0x80107F50, 0x80107E60, 0x80107FF0, 0x80107FF0, 0x80107FF0, 0x80107FF0, 0x80107FF0, 0x80107FF0 - -glabel D_800F7F80 -.word 0x801080B8, 0x801080E0, 0x80108108, 0x80108130, 0x80108158, 0x80108180, 0x801081A8, 0x801081D0, 0x801081F8, 0x80108220 - -glabel D_800F7FA8 -.word D_80108068 - -glabel D_800F7FAC -.word 0x80108090 - -glabel D_800F7FB0 -.word 0x80108298, 0x801082E8, 0x801082C0, 0x80108310, 0x80108338, 0x80108360, 0x80108388 - -glabel D_800F7FCC -.word D_801083D8, 0x80108428, 0x80108400, 0x80108450, 0x80108478, 0x801084A0, 0x801084C8 - -glabel D_800F7FE8 -.word 0xFFFFFFFF - -glabel D_800F7FEC -.word 0x00000001 - -glabel D_800F7FF0 -.word 0x00000002 - -glabel D_800F7FF4 -.word 0x00000004 - -glabel D_800F7FF8 -.word 0x00000005 - -glabel D_800F7FFC -.word 0x00000007 - -glabel D_800F8000 -.word 0x00000008, 0x00000000, 0x00000000, 0x00000000 - -glabel D_800F8010 -.word 0x003251D0, 0x00325AD0, 0x802C05CC, 0x00000000 - -glabel D_800F8020 -.word 0x00000000 - -glabel D_800F8024 -.float 0.0 - -glabel D_800F8028 -.float 0.0 - -glabel D_800F802C -.word 0x00000000 - -glabel D_800F8030 -.float 0.0 - -glabel D_800F8034 -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - -glabel D_800F803A -.short 0x0000 - -glabel D_800F803C -.word 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000 diff --git a/include/variables.h b/include/variables.h index ff858e317b..064ade578c 100644 --- a/include/variables.h +++ b/include/variables.h @@ -12,7 +12,7 @@ extern PlayerData gPlayerData; extern ActionState gPlayerActionState; extern PlayerAnim gPlayerAnimation; extern PlayerStatus gPlayerStatus; -extern PlayerStatus* gPlayerStatusPtr; +PlayerStatus* gPlayerStatusPtr; extern CollisionStatus gCollisionStatus; extern GameStatus* gGameStatusPtr[1]; extern s32 gRandSeed; diff --git a/src/code_759b0_len_61b0.c b/src/code_759b0_len_61b0.c index 67bb7a0469..92a04f4719 100644 --- a/src/code_759b0_len_61b0.c +++ b/src/code_759b0_len_61b0.c @@ -1,5 +1,7 @@ #include "common.h" +PlayerStatus* gPlayerStatusPtr = &gPlayerStatus; // maybe wPlayerStatus + INCLUDE_ASM(s32, "code_759b0_len_61b0", func_800DC500); INCLUDE_ASM(s32, "code_759b0_len_61b0", func_800DC778); diff --git a/src/code_838b0_len_5900.c b/src/code_838b0_len_5900.c deleted file mode 100644 index 446881e7c3..0000000000 --- a/src/code_838b0_len_5900.c +++ /dev/null @@ -1,159 +0,0 @@ -#include "common.h" -#include "map.h" -#include "world/partners.h" - -NpcId create_basic_npc(NpcBlueprint* blueprint); - -INCLUDE_ASM(s32, "code_838b0_len_5900", use_consumable); - -void remove_consumable(void) { - gPlayerData.invItems[D_8010CD20] = 0; - sort_items(); -} - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA4B0); - -s32 world_partner_can_use_ability_default(Npc* partner) { - return D_8010EBB0[0] == 0; -} - -s32 world_partner_can_player_pause_default(Npc* partner) { - return TRUE; -} - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA52C); - -INCLUDE_ASM(s32, "code_838b0_len_5900", is_current_partner_flying, void); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA5B8); - -void load_partner_npc(void) { - WorldPartner* partnerEntry = &D_800F803C[D_8010CFD8]; - Npc** partnerNpcPtr = &D_8010C930; - WorldPartner** partner = &D_8010CFEC; - NpcId npcIndex; - NpcBlueprint blueprint; - NpcBlueprint* blueprintPtr; - - *partner = partnerEntry; - blueprintPtr = &blueprint; - dma_copy(partnerEntry->dmaStart, partnerEntry->dmaEnd, partnerEntry->dmaDest); - - blueprint.flags = 0x4000100; - blueprint.initialAnim = (*partner)->idle; - blueprint.onUpdate = NULL; - blueprint.onRender = NULL; - D_8010CFD0 = npcIndex = create_basic_npc(blueprintPtr); - - *partnerNpcPtr = get_npc_by_index(npcIndex); - - { - Npc* npc = *partnerNpcPtr; - npc->npcID = NpcId_PARTNER; - npc->collisionRadius = 10; - npc->collisionHeight = 10; - } - - { - Npc* npc = *partnerNpcPtr; - npc->pos.x = 0.0f; - npc->pos.y = -1000.0f; - npc->pos.z = 0.0f; - npc->scale.x = 0.0f; - npc->scale.y = 0.0f; - npc->scale.z = 0.0f; - } - - D_8010C954 = 0; -} - - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA6A8); - -INCLUDE_ASM(s32, "code_838b0_len_5900", _use_partner_ability); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EB168, s32 arg0); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EB200); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EB2A4); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_use_ability); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_player_can_pause); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_can_use_ability); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_reset_data); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_initialize_data); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_test_enemy_collision); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_get_ride_script); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_handle_before_battle); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_handle_after_battle); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_kill_ability_script); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_suspend_ability_script); - -INCLUDE_ASM(s32, "code_838b0_len_5900", partner_resume_ability_script); - -INCLUDE_ASM(void, "code_838b0_len_5900", enable_partner_walking, Npc* partner, s32 val); - -INCLUDE_ASM(void, "code_838b0_len_5900", func_800EBA3C, Npc* partner); - -INCLUDE_ASM(void, "code_838b0_len_5900", func_800EBB40, Npc* partner); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EBC74); - -INCLUDE_ASM(void, "code_838b0_len_5900", enable_partner_flying, Npc* partner, s32 val); - -INCLUDE_ASM(void, "code_838b0_len_5900", update_player_move_history, Npc* partner); - -INCLUDE_ASM(void, "code_838b0_len_5900", func_800ED5D0, Npc* partner); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800ED9F8); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EE994); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EE9B8); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EECC4); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EECE8); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF300); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF314); - -INCLUDE_ASM(void, "code_838b0_len_5900", enable_partner_ai, void); - -INCLUDE_ASM(s32, "code_838b0_len_5900", set_parter_tether_distance, f32 arg0); - -INCLUDE_ASM(s32, "code_838b0_len_5900", reset_parter_tether_distance); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF3C0); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF3D4); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF3E4); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF414); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF43C); - -INCLUDE_ASM(void, "code_838b0_len_5900", clear_partner_move_history, Npc* partner); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF4E0); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF600); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF628); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF640); - -INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF82C); diff --git a/src/code_7bb60_len_41b0.c b/src/world/actions.c similarity index 65% rename from src/code_7bb60_len_41b0.c rename to src/world/actions.c index 15e19396bf..7a67cff037 100644 --- a/src/code_7bb60_len_41b0.c +++ b/src/world/actions.c @@ -1,3 +1,82 @@ +#include "common.h" + +s32 func_802B6000_E24920(); +s32 func_802B6288_E23968(); +s32 func_802B60B4_E240F4(); +s32 func_802B6198_E241D8(); +s32 func_802B6294_E242D4(); +s32 func_802B6060_E27570(); +s32 func_802B6348_E24388(); +s32 func_802B61C0_E24AE0(); +s32 func_802B6638_E29068(); +s32 func_802B66A8_E25578(); +s32 func_802B6350_E28D80(); +s32 func_802B6508_E28F38(); +s32 func_802B6230_E24800(); +s32 func_802B6120_E2A7D0(); +s32 func_802B63D4_E28E04(); +s32 func_802B6478_E28EA8(); +s32 func_802B60A4_E29514(); +s32 func_802B609C_E28ACC(); + +f32 D_800F7B40 = 0.0f; +s32 D_800F7B44 = 0; +f32 D_800F7B48 = 0.0f; +s32 D_800F7B4C = 0; + +s32 D_800F7B50[] = { 0x417C1B33, 0xC0EC5C14, 0x405C9AAA, 0xBF400000 }; +s32 D_800F7B60[] = { 0x3E1E0C17, 0xBEB33DB0, 0xBE3AA2E4, 0x3C3CBE62 }; +s32 D_800F7B70[] = { 0x40000000, 0x40800000, 0x42000000, 0xC2000000 }; +s32 D_800F7B80[] = { 0x00000000, 0x00000000, 0x00000000, 0x00000000 }; // possibly s16 +s32 D_800F7B90[] = { 0x00000000, 0x00390000, 0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390008, 0x00390007, 0x00390013, 0x00390014, 0xFFFFFFFF, 0x005A0000, 0x005A0002, 0x005A0003, 0x005A0004, 0x005A0006, 0x005A0007, 0x005A0009, 0x005A000A, 0x005A000B, 0x005A001A, 0xFFFFFFFF, 0x00580000, 0x00580001, 0x00580002, 0x00580004, 0x00580005, 0x00580006, 0x00580007, 0x00580008, 0x00580009, 0x00580012, 0x00580014, 0x0058001B, 0xFFFFFFFF }; +s32 D_800F7C1C[] = { 0x00580001, 0x00580004, 0x00580006, 0x00580008, 0x00580000 }; +s32 D_800F7C30[] = { 0x0058001B, 0x00580001, 0x00580004, 0x00580006, 0x00580008, 0x00580000, 0x0058001B, 0x005A0003, 0x005A0006, 0x005A0009, 0x005A000B, 0x005A0000, 0x005A001A, 0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390000, 0x00390014 }; +s32 D_800F7C7C[] = { 0x800F7BE8, 0x800F7BE8, 0x800F7BBC, 0x800F7B94 }; +s32 D_800F7C8C[] = { + // TODO: struct for dma table + // TODO: ld addrs + (s32)&func_802B6000_E24920, &code_code_E23260_ROM_START, &code_code_E23260_ROM_END, 0x01000000, + (s32)&func_802B6000_E24920, 0x00E236E0, 0x00E24040, 0x01000000, + (s32)&func_802B6288_E23968, 0x00E236E0, 0x00E24040, 0x01000000, + (s32)&func_802B60B4_E240F4, 0x00E24040, 0x00E245D0, 0x01000000, + (s32)&func_802B60B4_E240F4, 0x00E24040, 0x00E245D0, 0x01000000, + (s32)&func_802B60B4_E240F4, 0x00E24040, 0x00E245D0, 0x00000000, + (s32)&func_802B60B4_E240F4, 0x00E24040, 0x00E245D0, 0x00000000, + (s32)&func_802B6198_E241D8, 0x00E24040, 0x00E245D0, 0x00000000, + (s32)&func_802B6294_E242D4, 0x00E24040, 0x00E245D0, 0x01000000, + (s32)&func_802B6348_E24388, 0x00E24040, 0x00E245D0, 0x01000000, + (s32)&func_802B6000_E24920, 0x00E24920, 0x00E24ED0, 0x01000000, + (s32)&func_802B61C0_E24AE0, 0x00E24920, 0x00E24ED0, 0x01000000, + (s32)&func_802B6638_E29068, 0x00E28A30, 0x00E291A0, 0x01000000, + (s32)&func_802B6000_E24920, 0x00E26DE0, 0x00E27510, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E26DE0, 0x00E27510, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E26710, 0x00E26DE0, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E26710, 0x00E26DE0, 0x00000000, + (s32)&func_802B6060_E27570, 0x00E27510, 0x00E27C90, 0x00000000, + (s32)&func_802B66A8_E25578, 0x00E24ED0, 0x00E25D60, 0x00000000, + (s32)&func_802B6350_E28D80, 0x00E28A30, 0x00E291A0, 0x01000000, + (s32)&func_802B6508_E28F38, 0x00E28A30, 0x00E291A0, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E27C90, 0x00E27F40, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E287F0, 0x00E28A30, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E27F40, 0x00E287F0, 0x00000000, + (s32)&func_802B6230_E24800, 0x00E245D0, 0x00E24920, 0x01000000, + (s32)&func_802B6120_E2A7D0, 0x00E2A6B0, 0x00E2B530, 0x01000000, + (s32)&func_802B6000_E24920, 0x00E25D60, 0x00E26710, 0x00000000, + (s32)&func_802B63D4_E28E04, 0x00E28A30, 0x00E291A0, 0x00000000, + (s32)&func_802B6478_E28EA8, 0x00E28A30, 0x00E291A0, 0x00000000, + (s32)&func_802B60A4_E29514, 0x00E29470, 0x00E2A340, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E291A0, 0x00E29470, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E2A340, 0x00E2A6B0, 0x00000000, + (s32)&func_802B6350_E28D80, 0x00E28A30, 0x00E291A0, 0x01000000, + (s32)&func_802B6000_E24920, 0x00E28A30, 0x00E291A0, 0x00000000, + (s32)&func_802B6000_E24920, 0x00E245D0, 0x00E24920, 0x01000000, + (s32)&func_802B609C_E28ACC, 0x00E28A30, 0x00E291A0, 0x00000000, + (s32)&func_802B6350_E28D80, 0x00E28A30, 0x00E291A0, 0x00000000, + (s32)&func_802B6350_E28D80, 0x00E236E0, 0x00E24040, 0x00000000, + (s32)&func_802B6350_E28D80, 0x00E28A30, 0x00E291A0, 0x01000000, + NULL, // TODO: file split (world/actions.c) +}; + #include "common.h" #include "world/partners.h" @@ -289,3 +368,4 @@ INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E6500); INCLUDE_ASM(s32, "code_7bb60_len_41b0", make_disguise_npc); INCLUDE_ASM(s32, "code_7bb60_len_41b0", func_800E66C4); + diff --git a/src/world/partners.c b/src/world/partners.c index 456316acfa..16c158fb70 100644 --- a/src/world/partners.c +++ b/src/world/partners.c @@ -1,6 +1,7 @@ #include "common.h" #include "ld_addrs.h" #include "partners.h" +#include "map.h" #include "partner/goombario.h" #include "sprite/npc/world_goombario.h" @@ -32,10 +33,39 @@ s32 world_partner_can_use_ability_default(Npc* partner); s32 world_partner_can_player_pause_default(Npc* partner); -static s32 _pad[] = { 0x00, 0x00, 0x00 }; +// Partner icons +s32 D_800F7F00[] = { + 0x80107CA8, 0x80107CF8, 0x80107D48, 0x80107D98, 0x80107DE8, 0x80107CA8, 0x80107E88, 0x80107ED8, 0x80107F28, 0x80107E38, 0x80107FC8, 0x80107FC8, 0x80107FC8, 0x80107FC8, 0x80107FC8, 0x80107FC8, +}; +s32 D_800F7F40[] = { + 0x80107CD0, 0x80107D20, 0x80107D70, 0x80107DC0, 0x80107E10, 0x80107CD0, 0x80107EB0, 0x80107F00, 0x80107F50, 0x80107E60, 0x80107FF0, 0x80107FF0, 0x80107FF0, 0x80107FF0, 0x80107FF0, 0x80107FF0, +}; +s32 D_800F7F80[] = { + 0x801080B8, 0x801080E0, 0x80108108, 0x80108130, 0x80108158, 0x80108180, 0x801081A8, 0x801081D0, 0x801081F8, 0x80108220, +}; +s32* D_800F7FA8 = &D_80108068; +s32 D_800F7FAC = 0x80108090; +s32 D_800F7FB0[] = { 0x80108298, 0x801082E8, 0x801082C0, 0x80108310, 0x80108338, 0x80108360, 0x80108388 }; +s32 D_800F7FCC[] = { (s32)&D_801083D8, 0x80108428, 0x80108400, 0x80108450, 0x80108478, 0x801084A0, 0x801084C8 }; -WorldPartner gWorldPartners[] = { - // XXX: it's possible that's there's a "none" entry here to match up with enum PartnerID +s32 D_800F7FE8 = -1; +s32 D_800F7FEC = 1; +s32 D_800F7FF0 = 2; +s32 D_800F7FF4 = 4; +s32 D_800F7FF8 = 5; +s32 D_800F7FFC = 7; +s32 D_800F8000[] = { 8, 0, 0, 0 }; +s32 D_800F8010[] = { 0x003251D0, 0x00325AD0, 0x802C05CC, 0x00000000 }; +s32 D_800F8020 = 0; +f32 D_800F8024 = 0.0f; +f32 D_800F8028 = 0.0f; +s32 D_800F802C = 0; +f32 D_800F8030 = 0.0f; +s8 D_800F8034[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; +s16 D_800F803A = 0; + +WorldPartner wPartners[] = { + {}, // None { // Goombario .dmaStart = &world_partner_goombario_ROM_START, @@ -214,3 +244,159 @@ WorldPartner gWorldPartners[] = { .canPlayerPause = world_partner_can_use_ability_default, }, }; + + +NpcId create_basic_npc(NpcBlueprint* blueprint); + +INCLUDE_ASM(s32, "code_838b0_len_5900", use_consumable); + +void remove_consumable(void) { + gPlayerData.invItems[D_8010CD20] = 0; + sort_items(); +} + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA4B0); + +s32 world_partner_can_use_ability_default(Npc* partner) { + return D_8010EBB0[0] == 0; +} + +s32 world_partner_can_player_pause_default(Npc* partner) { + return TRUE; +} + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA52C); + +INCLUDE_ASM(s32, "code_838b0_len_5900", is_current_partner_flying, void); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA5B8); + +void load_partner_npc(void) { + WorldPartner* partnerEntry = &wPartners[D_8010CFD8]; + Npc** partnerNpcPtr = &D_8010C930; + WorldPartner** partner = &D_8010CFEC; + NpcId npcIndex; + NpcBlueprint blueprint; + NpcBlueprint* blueprintPtr; + + *partner = partnerEntry; + blueprintPtr = &blueprint; + dma_copy(partnerEntry->dmaStart, partnerEntry->dmaEnd, partnerEntry->dmaDest); + + blueprint.flags = 0x4000100; + blueprint.initialAnim = (*partner)->idle; + blueprint.onUpdate = NULL; + blueprint.onRender = NULL; + D_8010CFD0 = npcIndex = create_basic_npc(blueprintPtr); + + *partnerNpcPtr = get_npc_by_index(npcIndex); + + { + Npc* npc = *partnerNpcPtr; + npc->npcID = NpcId_PARTNER; + npc->collisionRadius = 10; + npc->collisionHeight = 10; + } + + { + Npc* npc = *partnerNpcPtr; + npc->pos.x = 0.0f; + npc->pos.y = -1000.0f; + npc->pos.z = 0.0f; + npc->scale.x = 0.0f; + npc->scale.y = 0.0f; + npc->scale.z = 0.0f; + } + + D_8010C954 = 0; +} + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EA6A8); + +INCLUDE_ASM(s32, "code_838b0_len_5900", _use_partner_ability); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EB168, s32 arg0); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EB200); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EB2A4); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_use_ability); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_player_can_pause); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_can_use_ability); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_reset_data); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_initialize_data); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_test_enemy_collision); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_get_ride_script); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_handle_before_battle); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_handle_after_battle); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_kill_ability_script); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_suspend_ability_script); + +INCLUDE_ASM(s32, "code_838b0_len_5900", partner_resume_ability_script); + +INCLUDE_ASM(void, "code_838b0_len_5900", enable_partner_walking, Npc* partner, s32 val); + +INCLUDE_ASM(void, "code_838b0_len_5900", func_800EBA3C, Npc* partner); + +INCLUDE_ASM(void, "code_838b0_len_5900", func_800EBB40, Npc* partner); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EBC74); + +INCLUDE_ASM(void, "code_838b0_len_5900", enable_partner_flying, Npc* partner, s32 val); + +INCLUDE_ASM(void, "code_838b0_len_5900", update_player_move_history, Npc* partner); + +INCLUDE_ASM(void, "code_838b0_len_5900", func_800ED5D0, Npc* partner); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800ED9F8); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EE994); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EE9B8); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EECC4); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EECE8); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF300); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF314); + +INCLUDE_ASM(void, "code_838b0_len_5900", enable_partner_ai, void); + +INCLUDE_ASM(s32, "code_838b0_len_5900", set_parter_tether_distance, f32 arg0); + +INCLUDE_ASM(s32, "code_838b0_len_5900", reset_parter_tether_distance); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF3C0); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF3D4); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF3E4); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF414); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF43C); + +INCLUDE_ASM(void, "code_838b0_len_5900", clear_partner_move_history, Npc* partner); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF4E0); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF600); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF628); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF640); + +INCLUDE_ASM(s32, "code_838b0_len_5900", func_800EF82C); diff --git a/src/world/partners.h b/src/world/partners.h index 44971a3b60..3c4b3e6994 100644 --- a/src/world/partners.h +++ b/src/world/partners.h @@ -22,12 +22,10 @@ typedef struct WorldPartner { /* 0x40 */ Bytecode* whileRiding; } WorldPartner; // size = 0x40 -WorldPartner gWorldPartners[11]; - /// Set to 0 when partner NPC loaded extern s32 D_8010C954; -extern s32 D_8010CFD8; // gPartnerID -extern WorldPartner D_800F803C[0x11]; // wPartners +extern s32 D_8010CFD8; +WorldPartner wPartners[0x11]; // wPartners extern WorldPartner* D_8010CFEC; // wPartner extern NpcId D_8010CFD0; // wPartnerNpcIndex extern Npc* D_8010C930; // wPartnerNpc diff --git a/tools/splat.yaml b/tools/splat.yaml index 659e839478..83beb67c82 100644 --- a/tools/splat.yaml +++ b/tools/splat.yaml @@ -262,20 +262,17 @@ segments: - [0x759b0, c, code_759b0_len_61b0] - [0x77480, c] - [0x7B440, c] - - [0x7bb60, c, code_7bb60_len_41b0] + - [0x7bb60, c, world/actions] - [0x7fd10, c, code_7fd10_len_b40] - [0x80850, c, code_80850_len_3060] - - [0x838b0, c, code_838b0_len_5900] + - [0x838b0, c, world/partners] - [0x891b0, c, code_891b0_len_fb0] - [0x8a160, c, code_8a160_len_700] - [0x8a860, c, code_8a860_len_3f30] - [0x8e790, c, code_8e790_len_2850] - - [0x90fe0, data] - - type: code - start: 0x91520 # section may start earlier - vram: 0 # TODO - subsections: - - [0x91520, .data, world/partners] + - [0x90FE0, .data, code_759b0_len_61b0] + - [0x913B0, .data, world/actions] + - [0x914E0, .data, world/partners] - [0x917EC, bin] - [0x93CD0, ci4, ui/hammer, 32, 32] - [0x93ED0, palette, ui/hammer] diff --git a/tools/symbol_addrs.txt b/tools/symbol_addrs.txt index 5b2bccf615..a93c963f38 100644 --- a/tools/symbol_addrs.txt +++ b/tools/symbol_addrs.txt @@ -10413,3 +10413,4 @@ func_8004D428 = 0x8004D428; // type:func gBattleItemTable = 0x80293C04; // type:data func_8006A9F0 = 0x8006A9F0; // type:func rom:0x45B74 rdpstateinit_dl = 0x80093BB8; // type:data +wPartners = 0x800F803C; // type: data