From 760e1351fb04fee9575205fd71ccdf36a7484409 Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 14 Aug 2020 15:05:05 -0700 Subject: [PATCH 01/18] Working more on script-related functions --- include/variables.h | 2 + src/code_e79b0_len_1920.c | 242 +++++++++++++++++++++++++++++++++++--- undefined_syms.txt | 1 + 3 files changed, 229 insertions(+), 16 deletions(-) diff --git a/include/variables.h b/include/variables.h index 1dbe05b68a..354398f8a0 100644 --- a/include/variables.h +++ b/include/variables.h @@ -15,6 +15,8 @@ extern script_context* gWorldScriptList[128]; extern script_context* gBattleScriptList[128]; extern script_context** gCurrentScriptListPtr[128]; +extern f32 gGlobalTimeSpace; + extern s8 D_800A0900; extern s16* D_80151328; extern s16 D_8010CD10; diff --git a/src/code_e79b0_len_1920.c b/src/code_e79b0_len_1920.c index 9093b6bd64..9382a4e4fd 100644 --- a/src/code_e79b0_len_1920.c +++ b/src/code_e79b0_len_1920.c @@ -18,7 +18,29 @@ INCLUDE_ASM(code_e79b0_len_1920, start_child_script); INCLUDE_ASM(code_e79b0_len_1920, func_802C39F8); -INCLUDE_ASM(code_e79b0_len_1920, restart_script); +//INCLUDE_ASM(code_e79b0_len_1920, restart_script); +/* +// TODO: Find out why things break when script->timeScale = 1 goes after the previous lines +script_context* restart_script(script_context* script) { + script->loopDepth = -1; + script->switchDepth = -1; + script->currentOpcode = 0; + script->frameCounter = 0; + script->frameCounter = 0; + script->unk_158 = 0; + + //script->timeScale = 1; + script->ptrNextLine = script->ptrFirstLine; + script->ptrCurrentLine = script->ptrFirstLine; + script->timeScale = 1.0f; + + + script->timeScale = gGlobalTimeSpace; + find_script_labels(); + func_802C3390(script); + return script; +} +*/ INCLUDE_ASM(code_e79b0_len_1920, update_scripts); @@ -64,41 +86,194 @@ s32 does_script_exist(s32 id) { return 0; } -INCLUDE_ASM(code_e79b0_len_1920, does_script_exist_by_ref); +s32 does_script_exist_by_ref(script_context* script) { + s32 i; -INCLUDE_ASM(code_e79b0_len_1920, set_script_priority); + for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + if(script == (*gCurrentScriptListPtr)[i]) { + return 1; + } + } + return 0; +} -INCLUDE_ASM(code_e79b0_len_1920, set_script_timescale); +void set_script_priority(script_context* script, s8 priority) { + script->priority = priority; +} + +void set_script_timescale(script_context* script, f32 timeScale) { + script->timeScale = timeScale * gGlobalTimeSpace; +} INCLUDE_ASM(code_e79b0_len_1920, set_global_timespace); +/* +// TODO: figure out why compiler/assembler isn't putting SWC1 in delay slot +void set_global_timespace(f32 timeScale) { + //gGlobalTimeSpace = timeScale; + __asm__("LUI $at,0x802e;" + "SWC1 $f12,-0x6358($at);" + ); +} +*/ + INCLUDE_ASM(code_e79b0_len_1920, get_global_timespace); +/* +// TODO: figure out why compiler/assembler isn't putting LWC1 in delay slot +f32 get_global_timespace(void) { + //return gGlobalTimeSpace; + __asm__("LUI $at,0x802e;" + "LWC1 $f0,-0x6358($at);" + ); +} +*/ -INCLUDE_ASM(code_e79b0_len_1920, set_script_group); +void set_script_group(script_context* script, s8 groupFlags) { + script->groupFlags = groupFlags; +} INCLUDE_ASM(code_e79b0_len_1920, bind_trigger); INCLUDE_ASM(code_e79b0_len_1920, bind_trigger_1); -INCLUDE_ASM(code_e79b0_len_1920, suspend_group_script); +void suspend_group_script(script_context* script, s32 groupFlags) { + int i; + script_context* scriptContextPtr; + script_context* childScript = script->childScript; -INCLUDE_ASM(code_e79b0_len_1920, resume_group_script); + if (childScript != NULL) { + suspend_group_script(childScript, groupFlags); + } -INCLUDE_ASM(code_e79b0_len_1920, suspend_all_script); + for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) { + suspend_group_script(scriptContextPtr, groupFlags); + } + } -INCLUDE_ASM(code_e79b0_len_1920, resume_all_script); + if ((script->groupFlags & groupFlags) != 0) { + script->state |= 0x2; + } +} -INCLUDE_ASM(code_e79b0_len_1920, suspend_group_script_index); +void resume_group_script(script_context* script, s32 groupFlags) { + int i; + script_context* scriptContextPtr; + script_context* childScript = script->childScript; -INCLUDE_ASM(code_e79b0_len_1920, resume_group_script_index); + if (childScript != NULL) { + resume_group_script(childScript, groupFlags); + } -INCLUDE_ASM(code_e79b0_len_1920, suspend_all_group); + for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) { + suspend_group_script(scriptContextPtr, groupFlags); + } + } -INCLUDE_ASM(code_e79b0_len_1920, resume_all_group); + if ((script->groupFlags & groupFlags) != 0) { + script->state &= 0xFD; + } +} -INCLUDE_ASM(code_e79b0_len_1920, suspend_group_others); +s32 suspend_all_script(s32 id) { + s32 i; + script_context* scriptContextPtr; -INCLUDE_ASM(code_e79b0_len_1920, resume_group_others); + for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { + suspend_group_script(scriptContextPtr, 0xEF); + } + } +} + +s32 resume_all_script(s32 id) { + s32 i; + script_context* scriptContextPtr; + + for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { + resume_group_script(scriptContextPtr, 0xEF); + } + } +} + +void suspend_group_script_index(s32 id, s32 groupFlags) { + s32 i; + script_context* scriptContextPtr; + + for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { + suspend_group_script(scriptContextPtr, groupFlags); + } + } +} + +void resume_group_script_index(s32 id, s32 groupFlags) { + s32 i; + script_context* scriptContextPtr; + + for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { + resume_group_script(scriptContextPtr, groupFlags); + } + } +} + +s32 suspend_all_group(s32 groupFlags) { + s32 i; + script_context* scriptContextPtr; + + for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL) { + suspend_group_script(scriptContextPtr, groupFlags); + } + } +} + +s32 resume_all_group(s32 groupFlags) { + s32 i; + script_context* scriptContextPtr; + + for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL) { + resume_group_script(scriptContextPtr, groupFlags); + } + } +} + + +void suspend_group_others(s32 script, s32 groupFlags) { + s32 i; + script_context* scriptContextPtr; + + for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr != script) { + suspend_group_script(scriptContextPtr, groupFlags); + } + } +} + +void resume_group_others(s32 script, s32 groupFlags) { + s32 i; + script_context* scriptContextPtr; + + for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr != script) { + resume_group_script(scriptContextPtr, groupFlags); + } + } +} script_context* get_script_by_index(s32 index) { return (*gCurrentScriptListPtr)[index]; @@ -119,7 +294,42 @@ script_context* get_script_by_id(s32 id) { return 0; } +void set_script_flags(script_context* script, s32 flags) { + int i; + script_context* scriptContextPtr; + script_context* childScript = script->childScript; -INCLUDE_ASM(code_e79b0_len_1920, set_script_flags); + script->state |= flags; + if (childScript != NULL) { + set_script_flags(childScript, flags); + } + + for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) { + set_script_flags(script->parentScript, flags); + } + } +} INCLUDE_ASM(code_e79b0_len_1920, clear_script_flags); +/* +// TODO: Really close but some weirdness is going on +void clear_script_flags(script_context* script, s32 flags) { + int i; + script_context* scriptContextPtr; + script_context* childScript = script->childScript; + + script->state &= ~flags; + if (childScript != NULL) { + clear_script_flags(childScript, flags); + } + + for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + scriptContextPtr = (*gCurrentScriptListPtr)[i]; + if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) { + clear_script_flags(script->parentScript, flags); + } + } +} +*/ diff --git a/undefined_syms.txt b/undefined_syms.txt index 32f85a9d6e..5f0a1e30c9 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -6,6 +6,7 @@ gItemTable = 0x800878E0; gWorldScriptList = 0x802DA490; gBattleScriptList = 0x802DA690; gCurrentScriptListPtr = 0x802DA890; +gGlobalTimeSpace = 0x802D9CA8; D_80147574 = 0x80147574; gMapTransitionAlpha = 0x800A0940; From c6058a8227baee05a00091274ccb1cffc6ec532a Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 14 Aug 2020 15:11:48 -0700 Subject: [PATCH 02/18] Fix so everything matches --- src/code_e79b0_len_1920.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code_e79b0_len_1920.c b/src/code_e79b0_len_1920.c index 9382a4e4fd..e94aabadcb 100644 --- a/src/code_e79b0_len_1920.c +++ b/src/code_e79b0_len_1920.c @@ -18,7 +18,7 @@ INCLUDE_ASM(code_e79b0_len_1920, start_child_script); INCLUDE_ASM(code_e79b0_len_1920, func_802C39F8); -//INCLUDE_ASM(code_e79b0_len_1920, restart_script); +INCLUDE_ASM(code_e79b0_len_1920, restart_script); /* // TODO: Find out why things break when script->timeScale = 1 goes after the previous lines script_context* restart_script(script_context* script) { From 1a4f01fe7b391d02d12bf075a0bcabc710dec8bb Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 14 Aug 2020 16:31:50 -0700 Subject: [PATCH 03/18] Fixing some issues and including removal of .s files --- .../does_script_exist_by_ref.s | 22 -------- .../code_e79b0_len_1920/resume_all_group.s | 32 ------------ .../code_e79b0_len_1920/resume_all_script.s | 35 ------------- .../code_e79b0_len_1920/resume_group_others.s | 37 -------------- .../code_e79b0_len_1920/resume_group_script.s | 51 ------------------- .../resume_group_script_index.s | 38 -------------- .../code_e79b0_len_1920/set_script_flags.s | 47 ----------------- .../code_e79b0_len_1920/set_script_group.s | 8 --- .../code_e79b0_len_1920/set_script_priority.s | 8 --- .../set_script_timescale.s | 14 ----- .../code_e79b0_len_1920/suspend_all_group.s | 32 ------------ .../suspend_group_others.s | 37 -------------- .../suspend_group_script.s | 51 ------------------- .../suspend_group_script_index.s | 38 -------------- include/common_structs.h | 4 +- src/code_e79b0_len_1920.c | 32 ++++++------ 16 files changed, 18 insertions(+), 468 deletions(-) delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/does_script_exist_by_ref.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/resume_all_group.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/resume_all_script.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/resume_group_others.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/resume_group_script.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/resume_group_script_index.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/set_script_flags.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/set_script_group.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/set_script_priority.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/set_script_timescale.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/suspend_all_group.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/suspend_group_others.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/suspend_group_script.s delete mode 100644 asm/nonmatchings/code_e79b0_len_1920/suspend_group_script_index.s diff --git a/asm/nonmatchings/code_e79b0_len_1920/does_script_exist_by_ref.s b/asm/nonmatchings/code_e79b0_len_1920/does_script_exist_by_ref.s deleted file mode 100644 index eea0be9e36..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/does_script_exist_by_ref.s +++ /dev/null @@ -1,22 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel does_script_exist_by_ref -/* 0E8B54 802C41A4 0000282D */ daddu $a1, $zero, $zero -/* 0E8B58 802C41A8 3C03802E */ lui $v1, 0x802e -/* 0E8B5C 802C41AC 8C63A890 */ lw $v1, -0x5770($v1) -.L802C41B0: -/* 0E8B60 802C41B0 8C620000 */ lw $v0, ($v1) -/* 0E8B64 802C41B4 14820003 */ bne $a0, $v0, .L802C41C4 -/* 0E8B68 802C41B8 24A50001 */ addiu $a1, $a1, 1 -/* 0E8B6C 802C41BC 03E00008 */ jr $ra -/* 0E8B70 802C41C0 24020001 */ addiu $v0, $zero, 1 - -.L802C41C4: -/* 0E8B74 802C41C4 28A20080 */ slti $v0, $a1, 0x80 -/* 0E8B78 802C41C8 1440FFF9 */ bnez $v0, .L802C41B0 -/* 0E8B7C 802C41CC 24630004 */ addiu $v1, $v1, 4 -/* 0E8B80 802C41D0 03E00008 */ jr $ra -/* 0E8B84 802C41D4 0000102D */ daddu $v0, $zero, $zero - diff --git a/asm/nonmatchings/code_e79b0_len_1920/resume_all_group.s b/asm/nonmatchings/code_e79b0_len_1920/resume_all_group.s deleted file mode 100644 index d16a7958d3..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/resume_all_group.s +++ /dev/null @@ -1,32 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel resume_all_group -/* 0E8FF8 802C4648 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E8FFC 802C464C AFB10014 */ sw $s1, 0x14($sp) -/* 0E9000 802C4650 0080882D */ daddu $s1, $a0, $zero -/* 0E9004 802C4654 AFB00010 */ sw $s0, 0x10($sp) -/* 0E9008 802C4658 0000802D */ daddu $s0, $zero, $zero -/* 0E900C 802C465C AFBF0018 */ sw $ra, 0x18($sp) -.L802C4660: -/* 0E9010 802C4660 3C03802E */ lui $v1, 0x802e -/* 0E9014 802C4664 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E9018 802C4668 00101080 */ sll $v0, $s0, 2 -/* 0E901C 802C466C 00431021 */ addu $v0, $v0, $v1 -/* 0E9020 802C4670 8C440000 */ lw $a0, ($v0) -/* 0E9024 802C4674 50800004 */ beql $a0, $zero, .L802C4688 -/* 0E9028 802C4678 26100001 */ addiu $s0, $s0, 1 -/* 0E902C 802C467C 0C0B10DF */ jal resume_group_script -/* 0E9030 802C4680 0220282D */ daddu $a1, $s1, $zero -/* 0E9034 802C4684 26100001 */ addiu $s0, $s0, 1 -.L802C4688: -/* 0E9038 802C4688 2A020080 */ slti $v0, $s0, 0x80 -/* 0E903C 802C468C 1440FFF4 */ bnez $v0, .L802C4660 -/* 0E9040 802C4690 00000000 */ nop -/* 0E9044 802C4694 8FBF0018 */ lw $ra, 0x18($sp) -/* 0E9048 802C4698 8FB10014 */ lw $s1, 0x14($sp) -/* 0E904C 802C469C 8FB00010 */ lw $s0, 0x10($sp) -/* 0E9050 802C46A0 03E00008 */ jr $ra -/* 0E9054 802C46A4 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/resume_all_script.s b/asm/nonmatchings/code_e79b0_len_1920/resume_all_script.s deleted file mode 100644 index 1c17dc1062..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/resume_all_script.s +++ /dev/null @@ -1,35 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel resume_all_script -/* 0E8E3C 802C448C 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E8E40 802C4490 AFB10014 */ sw $s1, 0x14($sp) -/* 0E8E44 802C4494 0080882D */ daddu $s1, $a0, $zero -/* 0E8E48 802C4498 AFB00010 */ sw $s0, 0x10($sp) -/* 0E8E4C 802C449C 0000802D */ daddu $s0, $zero, $zero -/* 0E8E50 802C44A0 AFBF0018 */ sw $ra, 0x18($sp) -.L802C44A4: -/* 0E8E54 802C44A4 3C03802E */ lui $v1, 0x802e -/* 0E8E58 802C44A8 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E8E5C 802C44AC 00101080 */ sll $v0, $s0, 2 -/* 0E8E60 802C44B0 00431021 */ addu $v0, $v0, $v1 -/* 0E8E64 802C44B4 8C440000 */ lw $a0, ($v0) -/* 0E8E68 802C44B8 50800007 */ beql $a0, $zero, .L802C44D8 -/* 0E8E6C 802C44BC 26100001 */ addiu $s0, $s0, 1 -/* 0E8E70 802C44C0 8C820144 */ lw $v0, 0x144($a0) -/* 0E8E74 802C44C4 54510004 */ bnel $v0, $s1, .L802C44D8 -/* 0E8E78 802C44C8 26100001 */ addiu $s0, $s0, 1 -/* 0E8E7C 802C44CC 0C0B10DF */ jal resume_group_script -/* 0E8E80 802C44D0 240500EF */ addiu $a1, $zero, 0xef -/* 0E8E84 802C44D4 26100001 */ addiu $s0, $s0, 1 -.L802C44D8: -/* 0E8E88 802C44D8 2A020080 */ slti $v0, $s0, 0x80 -/* 0E8E8C 802C44DC 1440FFF1 */ bnez $v0, .L802C44A4 -/* 0E8E90 802C44E0 00000000 */ nop -/* 0E8E94 802C44E4 8FBF0018 */ lw $ra, 0x18($sp) -/* 0E8E98 802C44E8 8FB10014 */ lw $s1, 0x14($sp) -/* 0E8E9C 802C44EC 8FB00010 */ lw $s0, 0x10($sp) -/* 0E8EA0 802C44F0 03E00008 */ jr $ra -/* 0E8EA4 802C44F4 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/resume_group_others.s b/asm/nonmatchings/code_e79b0_len_1920/resume_group_others.s deleted file mode 100644 index d7a7f9e1a4..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/resume_group_others.s +++ /dev/null @@ -1,37 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel resume_group_others -/* 0E90CC 802C471C 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E90D0 802C4720 AFB10014 */ sw $s1, 0x14($sp) -/* 0E90D4 802C4724 0080882D */ daddu $s1, $a0, $zero -/* 0E90D8 802C4728 AFB20018 */ sw $s2, 0x18($sp) -/* 0E90DC 802C472C 00A0902D */ daddu $s2, $a1, $zero -/* 0E90E0 802C4730 AFB00010 */ sw $s0, 0x10($sp) -/* 0E90E4 802C4734 0000802D */ daddu $s0, $zero, $zero -/* 0E90E8 802C4738 AFBF001C */ sw $ra, 0x1c($sp) -.L802C473C: -/* 0E90EC 802C473C 3C03802E */ lui $v1, 0x802e -/* 0E90F0 802C4740 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E90F4 802C4744 00101080 */ sll $v0, $s0, 2 -/* 0E90F8 802C4748 00431021 */ addu $v0, $v0, $v1 -/* 0E90FC 802C474C 8C440000 */ lw $a0, ($v0) -/* 0E9100 802C4750 50800006 */ beql $a0, $zero, .L802C476C -/* 0E9104 802C4754 26100001 */ addiu $s0, $s0, 1 -/* 0E9108 802C4758 50910004 */ beql $a0, $s1, .L802C476C -/* 0E910C 802C475C 26100001 */ addiu $s0, $s0, 1 -/* 0E9110 802C4760 0C0B10DF */ jal resume_group_script -/* 0E9114 802C4764 0240282D */ daddu $a1, $s2, $zero -/* 0E9118 802C4768 26100001 */ addiu $s0, $s0, 1 -.L802C476C: -/* 0E911C 802C476C 2A020080 */ slti $v0, $s0, 0x80 -/* 0E9120 802C4770 1440FFF2 */ bnez $v0, .L802C473C -/* 0E9124 802C4774 00000000 */ nop -/* 0E9128 802C4778 8FBF001C */ lw $ra, 0x1c($sp) -/* 0E912C 802C477C 8FB20018 */ lw $s2, 0x18($sp) -/* 0E9130 802C4780 8FB10014 */ lw $s1, 0x14($sp) -/* 0E9134 802C4784 8FB00010 */ lw $s0, 0x10($sp) -/* 0E9138 802C4788 03E00008 */ jr $ra -/* 0E913C 802C478C 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/resume_group_script.s b/asm/nonmatchings/code_e79b0_len_1920/resume_group_script.s deleted file mode 100644 index 29cd8157a4..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/resume_group_script.s +++ /dev/null @@ -1,51 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel resume_group_script -/* 0E8D2C 802C437C 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E8D30 802C4380 AFB10014 */ sw $s1, 0x14($sp) -/* 0E8D34 802C4384 0080882D */ daddu $s1, $a0, $zero -/* 0E8D38 802C4388 AFBF001C */ sw $ra, 0x1c($sp) -/* 0E8D3C 802C438C AFB20018 */ sw $s2, 0x18($sp) -/* 0E8D40 802C4390 AFB00010 */ sw $s0, 0x10($sp) -/* 0E8D44 802C4394 8E240068 */ lw $a0, 0x68($s1) -/* 0E8D48 802C4398 10800003 */ beqz $a0, .L802C43A8 -/* 0E8D4C 802C439C 00A0902D */ daddu $s2, $a1, $zero -/* 0E8D50 802C43A0 0C0B10DF */ jal resume_group_script -/* 0E8D54 802C43A4 00000000 */ nop -.L802C43A8: -/* 0E8D58 802C43A8 0000802D */ daddu $s0, $zero, $zero -.L802C43AC: -/* 0E8D5C 802C43AC 3C03802E */ lui $v1, 0x802e -/* 0E8D60 802C43B0 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E8D64 802C43B4 00101080 */ sll $v0, $s0, 2 -/* 0E8D68 802C43B8 00431021 */ addu $v0, $v0, $v1 -/* 0E8D6C 802C43BC 8C440000 */ lw $a0, ($v0) -/* 0E8D70 802C43C0 50800007 */ beql $a0, $zero, .L802C43E0 -/* 0E8D74 802C43C4 26100001 */ addiu $s0, $s0, 1 -/* 0E8D78 802C43C8 8C82006C */ lw $v0, 0x6c($a0) -/* 0E8D7C 802C43CC 54510004 */ bnel $v0, $s1, .L802C43E0 -/* 0E8D80 802C43D0 26100001 */ addiu $s0, $s0, 1 -/* 0E8D84 802C43D4 0C0B10B6 */ jal suspend_group_script -/* 0E8D88 802C43D8 0240282D */ daddu $a1, $s2, $zero -/* 0E8D8C 802C43DC 26100001 */ addiu $s0, $s0, 1 -.L802C43E0: -/* 0E8D90 802C43E0 2A020080 */ slti $v0, $s0, 0x80 -/* 0E8D94 802C43E4 1440FFF1 */ bnez $v0, .L802C43AC -/* 0E8D98 802C43E8 00000000 */ nop -/* 0E8D9C 802C43EC 92220004 */ lbu $v0, 4($s1) -/* 0E8DA0 802C43F0 00521024 */ and $v0, $v0, $s2 -/* 0E8DA4 802C43F4 10400004 */ beqz $v0, .L802C4408 -/* 0E8DA8 802C43F8 00000000 */ nop -/* 0E8DAC 802C43FC 92220000 */ lbu $v0, ($s1) -/* 0E8DB0 802C4400 304200FD */ andi $v0, $v0, 0xfd -/* 0E8DB4 802C4404 A2220000 */ sb $v0, ($s1) -.L802C4408: -/* 0E8DB8 802C4408 8FBF001C */ lw $ra, 0x1c($sp) -/* 0E8DBC 802C440C 8FB20018 */ lw $s2, 0x18($sp) -/* 0E8DC0 802C4410 8FB10014 */ lw $s1, 0x14($sp) -/* 0E8DC4 802C4414 8FB00010 */ lw $s0, 0x10($sp) -/* 0E8DC8 802C4418 03E00008 */ jr $ra -/* 0E8DCC 802C441C 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/resume_group_script_index.s b/asm/nonmatchings/code_e79b0_len_1920/resume_group_script_index.s deleted file mode 100644 index 9c0f2eec4c..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/resume_group_script_index.s +++ /dev/null @@ -1,38 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel resume_group_script_index -/* 0E8F20 802C4570 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E8F24 802C4574 AFB10014 */ sw $s1, 0x14($sp) -/* 0E8F28 802C4578 0080882D */ daddu $s1, $a0, $zero -/* 0E8F2C 802C457C AFB20018 */ sw $s2, 0x18($sp) -/* 0E8F30 802C4580 00A0902D */ daddu $s2, $a1, $zero -/* 0E8F34 802C4584 AFB00010 */ sw $s0, 0x10($sp) -/* 0E8F38 802C4588 0000802D */ daddu $s0, $zero, $zero -/* 0E8F3C 802C458C AFBF001C */ sw $ra, 0x1c($sp) -.L802C4590: -/* 0E8F40 802C4590 3C03802E */ lui $v1, 0x802e -/* 0E8F44 802C4594 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E8F48 802C4598 00101080 */ sll $v0, $s0, 2 -/* 0E8F4C 802C459C 00431021 */ addu $v0, $v0, $v1 -/* 0E8F50 802C45A0 8C440000 */ lw $a0, ($v0) -/* 0E8F54 802C45A4 50800007 */ beql $a0, $zero, .L802C45C4 -/* 0E8F58 802C45A8 26100001 */ addiu $s0, $s0, 1 -/* 0E8F5C 802C45AC 8C820144 */ lw $v0, 0x144($a0) -/* 0E8F60 802C45B0 54510004 */ bnel $v0, $s1, .L802C45C4 -/* 0E8F64 802C45B4 26100001 */ addiu $s0, $s0, 1 -/* 0E8F68 802C45B8 0C0B10DF */ jal resume_group_script -/* 0E8F6C 802C45BC 0240282D */ daddu $a1, $s2, $zero -/* 0E8F70 802C45C0 26100001 */ addiu $s0, $s0, 1 -.L802C45C4: -/* 0E8F74 802C45C4 2A020080 */ slti $v0, $s0, 0x80 -/* 0E8F78 802C45C8 1440FFF1 */ bnez $v0, .L802C4590 -/* 0E8F7C 802C45CC 00000000 */ nop -/* 0E8F80 802C45D0 8FBF001C */ lw $ra, 0x1c($sp) -/* 0E8F84 802C45D4 8FB20018 */ lw $s2, 0x18($sp) -/* 0E8F88 802C45D8 8FB10014 */ lw $s1, 0x14($sp) -/* 0E8F8C 802C45DC 8FB00010 */ lw $s0, 0x10($sp) -/* 0E8F90 802C45E0 03E00008 */ jr $ra -/* 0E8F94 802C45E4 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/set_script_flags.s b/asm/nonmatchings/code_e79b0_len_1920/set_script_flags.s deleted file mode 100644 index f676bac13c..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/set_script_flags.s +++ /dev/null @@ -1,47 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel set_script_flags -/* 0E9198 802C47E8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E919C 802C47EC AFB10014 */ sw $s1, 0x14($sp) -/* 0E91A0 802C47F0 0080882D */ daddu $s1, $a0, $zero -/* 0E91A4 802C47F4 AFB20018 */ sw $s2, 0x18($sp) -/* 0E91A8 802C47F8 00A0902D */ daddu $s2, $a1, $zero -/* 0E91AC 802C47FC AFBF001C */ sw $ra, 0x1c($sp) -/* 0E91B0 802C4800 AFB00010 */ sw $s0, 0x10($sp) -/* 0E91B4 802C4804 92220000 */ lbu $v0, ($s1) -/* 0E91B8 802C4808 8E240068 */ lw $a0, 0x68($s1) -/* 0E91BC 802C480C 00521025 */ or $v0, $v0, $s2 -/* 0E91C0 802C4810 10800003 */ beqz $a0, .L802C4820 -/* 0E91C4 802C4814 A2220000 */ sb $v0, ($s1) -/* 0E91C8 802C4818 0C0B11FA */ jal set_script_flags -/* 0E91CC 802C481C 00000000 */ nop -.L802C4820: -/* 0E91D0 802C4820 0000802D */ daddu $s0, $zero, $zero -.L802C4824: -/* 0E91D4 802C4824 3C03802E */ lui $v1, 0x802e -/* 0E91D8 802C4828 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E91DC 802C482C 00101080 */ sll $v0, $s0, 2 -/* 0E91E0 802C4830 00431021 */ addu $v0, $v0, $v1 -/* 0E91E4 802C4834 8C420000 */ lw $v0, ($v0) -/* 0E91E8 802C4838 50400008 */ beql $v0, $zero, .L802C485C -/* 0E91EC 802C483C 26100001 */ addiu $s0, $s0, 1 -/* 0E91F0 802C4840 8C42006C */ lw $v0, 0x6c($v0) -/* 0E91F4 802C4844 54510005 */ bnel $v0, $s1, .L802C485C -/* 0E91F8 802C4848 26100001 */ addiu $s0, $s0, 1 -/* 0E91FC 802C484C 8E24006C */ lw $a0, 0x6c($s1) -/* 0E9200 802C4850 0C0B11FA */ jal set_script_flags -/* 0E9204 802C4854 0240282D */ daddu $a1, $s2, $zero -/* 0E9208 802C4858 26100001 */ addiu $s0, $s0, 1 -.L802C485C: -/* 0E920C 802C485C 2A020080 */ slti $v0, $s0, 0x80 -/* 0E9210 802C4860 1440FFF0 */ bnez $v0, .L802C4824 -/* 0E9214 802C4864 00000000 */ nop -/* 0E9218 802C4868 8FBF001C */ lw $ra, 0x1c($sp) -/* 0E921C 802C486C 8FB20018 */ lw $s2, 0x18($sp) -/* 0E9220 802C4870 8FB10014 */ lw $s1, 0x14($sp) -/* 0E9224 802C4874 8FB00010 */ lw $s0, 0x10($sp) -/* 0E9228 802C4878 03E00008 */ jr $ra -/* 0E922C 802C487C 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/set_script_group.s b/asm/nonmatchings/code_e79b0_len_1920/set_script_group.s deleted file mode 100644 index da0ea1ffd6..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/set_script_group.s +++ /dev/null @@ -1,8 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel set_script_group -/* 0E8BC8 802C4218 03E00008 */ jr $ra -/* 0E8BCC 802C421C A0850004 */ sb $a1, 4($a0) - diff --git a/asm/nonmatchings/code_e79b0_len_1920/set_script_priority.s b/asm/nonmatchings/code_e79b0_len_1920/set_script_priority.s deleted file mode 100644 index e022600d07..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/set_script_priority.s +++ /dev/null @@ -1,8 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel set_script_priority -/* 0E8B88 802C41D8 03E00008 */ jr $ra -/* 0E8B8C 802C41DC A0850003 */ sb $a1, 3($a0) - diff --git a/asm/nonmatchings/code_e79b0_len_1920/set_script_timescale.s b/asm/nonmatchings/code_e79b0_len_1920/set_script_timescale.s deleted file mode 100644 index 14ea4397bf..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/set_script_timescale.s +++ /dev/null @@ -1,14 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel set_script_timescale -/* 0E8B90 802C41E0 3C01802E */ lui $at, 0x802e -/* 0E8B94 802C41E4 C4209CA8 */ lwc1 $f0, -0x6358($at) -/* 0E8B98 802C41E8 44851000 */ mtc1 $a1, $f2 -/* 0E8B9C 802C41EC 00000000 */ nop -/* 0E8BA0 802C41F0 46001002 */ mul.s $f0, $f2, $f0 -/* 0E8BA4 802C41F4 00000000 */ nop -/* 0E8BA8 802C41F8 03E00008 */ jr $ra -/* 0E8BAC 802C41FC E4800150 */ swc1 $f0, 0x150($a0) - diff --git a/asm/nonmatchings/code_e79b0_len_1920/suspend_all_group.s b/asm/nonmatchings/code_e79b0_len_1920/suspend_all_group.s deleted file mode 100644 index bc0d6670ba..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/suspend_all_group.s +++ /dev/null @@ -1,32 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel suspend_all_group -/* 0E8F98 802C45E8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E8F9C 802C45EC AFB10014 */ sw $s1, 0x14($sp) -/* 0E8FA0 802C45F0 0080882D */ daddu $s1, $a0, $zero -/* 0E8FA4 802C45F4 AFB00010 */ sw $s0, 0x10($sp) -/* 0E8FA8 802C45F8 0000802D */ daddu $s0, $zero, $zero -/* 0E8FAC 802C45FC AFBF0018 */ sw $ra, 0x18($sp) -.L802C4600: -/* 0E8FB0 802C4600 3C03802E */ lui $v1, 0x802e -/* 0E8FB4 802C4604 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E8FB8 802C4608 00101080 */ sll $v0, $s0, 2 -/* 0E8FBC 802C460C 00431021 */ addu $v0, $v0, $v1 -/* 0E8FC0 802C4610 8C440000 */ lw $a0, ($v0) -/* 0E8FC4 802C4614 50800004 */ beql $a0, $zero, .L802C4628 -/* 0E8FC8 802C4618 26100001 */ addiu $s0, $s0, 1 -/* 0E8FCC 802C461C 0C0B10B6 */ jal suspend_group_script -/* 0E8FD0 802C4620 0220282D */ daddu $a1, $s1, $zero -/* 0E8FD4 802C4624 26100001 */ addiu $s0, $s0, 1 -.L802C4628: -/* 0E8FD8 802C4628 2A020080 */ slti $v0, $s0, 0x80 -/* 0E8FDC 802C462C 1440FFF4 */ bnez $v0, .L802C4600 -/* 0E8FE0 802C4630 00000000 */ nop -/* 0E8FE4 802C4634 8FBF0018 */ lw $ra, 0x18($sp) -/* 0E8FE8 802C4638 8FB10014 */ lw $s1, 0x14($sp) -/* 0E8FEC 802C463C 8FB00010 */ lw $s0, 0x10($sp) -/* 0E8FF0 802C4640 03E00008 */ jr $ra -/* 0E8FF4 802C4644 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/suspend_group_others.s b/asm/nonmatchings/code_e79b0_len_1920/suspend_group_others.s deleted file mode 100644 index 85ace0f352..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/suspend_group_others.s +++ /dev/null @@ -1,37 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel suspend_group_others -/* 0E9058 802C46A8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E905C 802C46AC AFB10014 */ sw $s1, 0x14($sp) -/* 0E9060 802C46B0 0080882D */ daddu $s1, $a0, $zero -/* 0E9064 802C46B4 AFB20018 */ sw $s2, 0x18($sp) -/* 0E9068 802C46B8 00A0902D */ daddu $s2, $a1, $zero -/* 0E906C 802C46BC AFB00010 */ sw $s0, 0x10($sp) -/* 0E9070 802C46C0 0000802D */ daddu $s0, $zero, $zero -/* 0E9074 802C46C4 AFBF001C */ sw $ra, 0x1c($sp) -.L802C46C8: -/* 0E9078 802C46C8 3C03802E */ lui $v1, 0x802e -/* 0E907C 802C46CC 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E9080 802C46D0 00101080 */ sll $v0, $s0, 2 -/* 0E9084 802C46D4 00431021 */ addu $v0, $v0, $v1 -/* 0E9088 802C46D8 8C440000 */ lw $a0, ($v0) -/* 0E908C 802C46DC 50800006 */ beql $a0, $zero, .L802C46F8 -/* 0E9090 802C46E0 26100001 */ addiu $s0, $s0, 1 -/* 0E9094 802C46E4 50910004 */ beql $a0, $s1, .L802C46F8 -/* 0E9098 802C46E8 26100001 */ addiu $s0, $s0, 1 -/* 0E909C 802C46EC 0C0B10B6 */ jal suspend_group_script -/* 0E90A0 802C46F0 0240282D */ daddu $a1, $s2, $zero -/* 0E90A4 802C46F4 26100001 */ addiu $s0, $s0, 1 -.L802C46F8: -/* 0E90A8 802C46F8 2A020080 */ slti $v0, $s0, 0x80 -/* 0E90AC 802C46FC 1440FFF2 */ bnez $v0, .L802C46C8 -/* 0E90B0 802C4700 00000000 */ nop -/* 0E90B4 802C4704 8FBF001C */ lw $ra, 0x1c($sp) -/* 0E90B8 802C4708 8FB20018 */ lw $s2, 0x18($sp) -/* 0E90BC 802C470C 8FB10014 */ lw $s1, 0x14($sp) -/* 0E90C0 802C4710 8FB00010 */ lw $s0, 0x10($sp) -/* 0E90C4 802C4714 03E00008 */ jr $ra -/* 0E90C8 802C4718 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/suspend_group_script.s b/asm/nonmatchings/code_e79b0_len_1920/suspend_group_script.s deleted file mode 100644 index 402f4e73c7..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/suspend_group_script.s +++ /dev/null @@ -1,51 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel suspend_group_script -/* 0E8C88 802C42D8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E8C8C 802C42DC AFB10014 */ sw $s1, 0x14($sp) -/* 0E8C90 802C42E0 0080882D */ daddu $s1, $a0, $zero -/* 0E8C94 802C42E4 AFBF001C */ sw $ra, 0x1c($sp) -/* 0E8C98 802C42E8 AFB20018 */ sw $s2, 0x18($sp) -/* 0E8C9C 802C42EC AFB00010 */ sw $s0, 0x10($sp) -/* 0E8CA0 802C42F0 8E240068 */ lw $a0, 0x68($s1) -/* 0E8CA4 802C42F4 10800003 */ beqz $a0, .L802C4304 -/* 0E8CA8 802C42F8 00A0902D */ daddu $s2, $a1, $zero -/* 0E8CAC 802C42FC 0C0B10B6 */ jal suspend_group_script -/* 0E8CB0 802C4300 00000000 */ nop -.L802C4304: -/* 0E8CB4 802C4304 0000802D */ daddu $s0, $zero, $zero -.L802C4308: -/* 0E8CB8 802C4308 3C03802E */ lui $v1, 0x802e -/* 0E8CBC 802C430C 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E8CC0 802C4310 00101080 */ sll $v0, $s0, 2 -/* 0E8CC4 802C4314 00431021 */ addu $v0, $v0, $v1 -/* 0E8CC8 802C4318 8C440000 */ lw $a0, ($v0) -/* 0E8CCC 802C431C 50800007 */ beql $a0, $zero, .L802C433C -/* 0E8CD0 802C4320 26100001 */ addiu $s0, $s0, 1 -/* 0E8CD4 802C4324 8C82006C */ lw $v0, 0x6c($a0) -/* 0E8CD8 802C4328 54510004 */ bnel $v0, $s1, .L802C433C -/* 0E8CDC 802C432C 26100001 */ addiu $s0, $s0, 1 -/* 0E8CE0 802C4330 0C0B10B6 */ jal suspend_group_script -/* 0E8CE4 802C4334 0240282D */ daddu $a1, $s2, $zero -/* 0E8CE8 802C4338 26100001 */ addiu $s0, $s0, 1 -.L802C433C: -/* 0E8CEC 802C433C 2A020080 */ slti $v0, $s0, 0x80 -/* 0E8CF0 802C4340 1440FFF1 */ bnez $v0, .L802C4308 -/* 0E8CF4 802C4344 00000000 */ nop -/* 0E8CF8 802C4348 92220004 */ lbu $v0, 4($s1) -/* 0E8CFC 802C434C 00521024 */ and $v0, $v0, $s2 -/* 0E8D00 802C4350 10400004 */ beqz $v0, .L802C4364 -/* 0E8D04 802C4354 00000000 */ nop -/* 0E8D08 802C4358 92220000 */ lbu $v0, ($s1) -/* 0E8D0C 802C435C 34420002 */ ori $v0, $v0, 2 -/* 0E8D10 802C4360 A2220000 */ sb $v0, ($s1) -.L802C4364: -/* 0E8D14 802C4364 8FBF001C */ lw $ra, 0x1c($sp) -/* 0E8D18 802C4368 8FB20018 */ lw $s2, 0x18($sp) -/* 0E8D1C 802C436C 8FB10014 */ lw $s1, 0x14($sp) -/* 0E8D20 802C4370 8FB00010 */ lw $s0, 0x10($sp) -/* 0E8D24 802C4374 03E00008 */ jr $ra -/* 0E8D28 802C4378 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/asm/nonmatchings/code_e79b0_len_1920/suspend_group_script_index.s b/asm/nonmatchings/code_e79b0_len_1920/suspend_group_script_index.s deleted file mode 100644 index 1977ca53c5..0000000000 --- a/asm/nonmatchings/code_e79b0_len_1920/suspend_group_script_index.s +++ /dev/null @@ -1,38 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel suspend_group_script_index -/* 0E8EA8 802C44F8 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0E8EAC 802C44FC AFB10014 */ sw $s1, 0x14($sp) -/* 0E8EB0 802C4500 0080882D */ daddu $s1, $a0, $zero -/* 0E8EB4 802C4504 AFB20018 */ sw $s2, 0x18($sp) -/* 0E8EB8 802C4508 00A0902D */ daddu $s2, $a1, $zero -/* 0E8EBC 802C450C AFB00010 */ sw $s0, 0x10($sp) -/* 0E8EC0 802C4510 0000802D */ daddu $s0, $zero, $zero -/* 0E8EC4 802C4514 AFBF001C */ sw $ra, 0x1c($sp) -.L802C4518: -/* 0E8EC8 802C4518 3C03802E */ lui $v1, 0x802e -/* 0E8ECC 802C451C 8C63A890 */ lw $v1, -0x5770($v1) -/* 0E8ED0 802C4520 00101080 */ sll $v0, $s0, 2 -/* 0E8ED4 802C4524 00431021 */ addu $v0, $v0, $v1 -/* 0E8ED8 802C4528 8C440000 */ lw $a0, ($v0) -/* 0E8EDC 802C452C 50800007 */ beql $a0, $zero, .L802C454C -/* 0E8EE0 802C4530 26100001 */ addiu $s0, $s0, 1 -/* 0E8EE4 802C4534 8C820144 */ lw $v0, 0x144($a0) -/* 0E8EE8 802C4538 54510004 */ bnel $v0, $s1, .L802C454C -/* 0E8EEC 802C453C 26100001 */ addiu $s0, $s0, 1 -/* 0E8EF0 802C4540 0C0B10B6 */ jal suspend_group_script -/* 0E8EF4 802C4544 0240282D */ daddu $a1, $s2, $zero -/* 0E8EF8 802C4548 26100001 */ addiu $s0, $s0, 1 -.L802C454C: -/* 0E8EFC 802C454C 2A020080 */ slti $v0, $s0, 0x80 -/* 0E8F00 802C4550 1440FFF1 */ bnez $v0, .L802C4518 -/* 0E8F04 802C4554 00000000 */ nop -/* 0E8F08 802C4558 8FBF001C */ lw $ra, 0x1c($sp) -/* 0E8F0C 802C455C 8FB20018 */ lw $s2, 0x18($sp) -/* 0E8F10 802C4560 8FB10014 */ lw $s1, 0x14($sp) -/* 0E8F14 802C4564 8FB00010 */ lw $s0, 0x10($sp) -/* 0E8F18 802C4568 03E00008 */ jr $ra -/* 0E8F1C 802C456C 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/include/common_structs.h b/include/common_structs.h index 9d14cb123e..80b5bf692e 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -448,7 +448,7 @@ typedef struct { /* 0x001 */ s8 currentArgc; /* 0x002 */ s8 currentOpcode; /* 0x003 */ s8 priority; - /* 0x004 */ s8 groupFlags; + /* 0x004 */ u8 groupFlags; /* 0x005 */ s8 blocked; /* 1 = blocking */ /* 0x006 */ s8 loopDepth; /* how many nested loops we are in, >= 8 hangs forever */ /* 0x007 */ s8 switchDepth; /* how many nested switches we are in, max = 8 */ @@ -476,7 +476,7 @@ typedef struct { /* 0x14C */ u32 ownerID; /* can be an npcID, a triggerID, a trigger ptr */ /* 0x150 */ f32 timeScale; /* 0x154 */ f32 frameCounter; - /* 0x158 */ s32 unk_158; + /* 0x158 */ f32 unk_158; /* 0x15C */ s32* ptrFirstLine; /* 0x160 */ s32* ptrSavedPosition; /* 0x164 */ s32* ptrCurrentLine; diff --git a/src/code_e79b0_len_1920.c b/src/code_e79b0_len_1920.c index e94aabadcb..661ba84e13 100644 --- a/src/code_e79b0_len_1920.c +++ b/src/code_e79b0_len_1920.c @@ -52,7 +52,7 @@ void* kill_script_by_ID(s32 id) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { kill_script(scriptContextPtr); @@ -64,7 +64,7 @@ s32 kill_all_scripts(void) { s32 i; script_context* scriptContextPtr; - for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL) { kill_script(scriptContextPtr); @@ -77,7 +77,7 @@ s32 does_script_exist(s32 id) { s32 i; script_context* scriptContextPtr; - for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { return 1; @@ -89,7 +89,7 @@ s32 does_script_exist(s32 id) { s32 does_script_exist_by_ref(script_context* script) { s32 i; - for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { if(script == (*gCurrentScriptListPtr)[i]) { return 1; } @@ -145,7 +145,7 @@ void suspend_group_script(script_context* script, s32 groupFlags) { suspend_group_script(childScript, groupFlags); } - for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) { suspend_group_script(scriptContextPtr, groupFlags); @@ -166,7 +166,7 @@ void resume_group_script(script_context* script, s32 groupFlags) { resume_group_script(childScript, groupFlags); } - for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) { suspend_group_script(scriptContextPtr, groupFlags); @@ -182,7 +182,7 @@ s32 suspend_all_script(s32 id) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { suspend_group_script(scriptContextPtr, 0xEF); @@ -194,7 +194,7 @@ s32 resume_all_script(s32 id) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { resume_group_script(scriptContextPtr, 0xEF); @@ -206,7 +206,7 @@ void suspend_group_script_index(s32 id, s32 groupFlags) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { suspend_group_script(scriptContextPtr, groupFlags); @@ -218,7 +218,7 @@ void resume_group_script_index(s32 id, s32 groupFlags) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { resume_group_script(scriptContextPtr, groupFlags); @@ -230,7 +230,7 @@ s32 suspend_all_group(s32 groupFlags) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL) { suspend_group_script(scriptContextPtr, groupFlags); @@ -242,7 +242,7 @@ s32 resume_all_group(s32 groupFlags) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL) { resume_group_script(scriptContextPtr, groupFlags); @@ -255,7 +255,7 @@ void suspend_group_others(s32 script, s32 groupFlags) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr != script) { suspend_group_script(scriptContextPtr, groupFlags); @@ -267,7 +267,7 @@ void resume_group_others(s32 script, s32 groupFlags) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr != script) { resume_group_script(scriptContextPtr, groupFlags); @@ -283,7 +283,7 @@ script_context* get_script_by_id(s32 id) { s32 i; script_context* scriptContextPtr; - for (i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { if ((*gCurrentScriptListPtr)[i] != NULL) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr->uniqueID == id) { @@ -325,7 +325,7 @@ void clear_script_flags(script_context* script, s32 flags) { clear_script_flags(childScript, flags); } - for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) { clear_script_flags(script->parentScript, flags); From 73a39e0747bdaec5dea210acf7b8925d03445aee Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 14 Aug 2020 16:33:44 -0700 Subject: [PATCH 04/18] undo change to script_context struct that was experimental --- include/common_structs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common_structs.h b/include/common_structs.h index 80b5bf692e..fae05de044 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -476,7 +476,7 @@ typedef struct { /* 0x14C */ u32 ownerID; /* can be an npcID, a triggerID, a trigger ptr */ /* 0x150 */ f32 timeScale; /* 0x154 */ f32 frameCounter; - /* 0x158 */ f32 unk_158; + /* 0x158 */ s32 unk_158; /* 0x15C */ s32* ptrFirstLine; /* 0x160 */ s32* ptrSavedPosition; /* 0x164 */ s32* ptrCurrentLine; From d1898f1903ef9d552536557084a56eb010ee9444 Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 14 Aug 2020 19:50:21 -0700 Subject: [PATCH 05/18] Tweaks --- src/code_e79b0_len_1920.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/code_e79b0_len_1920.c b/src/code_e79b0_len_1920.c index 661ba84e13..32b98c696b 100644 --- a/src/code_e79b0_len_1920.c +++ b/src/code_e79b0_len_1920.c @@ -18,8 +18,7 @@ INCLUDE_ASM(code_e79b0_len_1920, start_child_script); INCLUDE_ASM(code_e79b0_len_1920, func_802C39F8); -INCLUDE_ASM(code_e79b0_len_1920, restart_script); -/* +//INCLUDE_ASM(code_e79b0_len_1920, restart_script); // TODO: Find out why things break when script->timeScale = 1 goes after the previous lines script_context* restart_script(script_context* script) { script->loopDepth = -1; @@ -40,7 +39,6 @@ script_context* restart_script(script_context* script) { func_802C3390(script); return script; } -*/ INCLUDE_ASM(code_e79b0_len_1920, update_scripts); @@ -52,7 +50,7 @@ void* kill_script_by_ID(s32 id) { s32 i; script_context* scriptContextPtr; - for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 1; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { kill_script(scriptContextPtr); @@ -110,9 +108,6 @@ INCLUDE_ASM(code_e79b0_len_1920, set_global_timespace); // TODO: figure out why compiler/assembler isn't putting SWC1 in delay slot void set_global_timespace(f32 timeScale) { //gGlobalTimeSpace = timeScale; - __asm__("LUI $at,0x802e;" - "SWC1 $f12,-0x6358($at);" - ); } */ @@ -122,9 +117,6 @@ INCLUDE_ASM(code_e79b0_len_1920, get_global_timespace); // TODO: figure out why compiler/assembler isn't putting LWC1 in delay slot f32 get_global_timespace(void) { //return gGlobalTimeSpace; - __asm__("LUI $at,0x802e;" - "LWC1 $f0,-0x6358($at);" - ); } */ @@ -304,7 +296,7 @@ void set_script_flags(script_context* script, s32 flags) { set_script_flags(childScript, flags); } - for(i=0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for(i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->parentScript == script) { set_script_flags(script->parentScript, flags); From 58b2a01a586d758df86bb635fbf5efe91f3adc12 Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 14 Aug 2020 19:51:02 -0700 Subject: [PATCH 06/18] Remove WIP function --- src/code_e79b0_len_1920.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/code_e79b0_len_1920.c b/src/code_e79b0_len_1920.c index 32b98c696b..a24c8d38d8 100644 --- a/src/code_e79b0_len_1920.c +++ b/src/code_e79b0_len_1920.c @@ -18,8 +18,9 @@ INCLUDE_ASM(code_e79b0_len_1920, start_child_script); INCLUDE_ASM(code_e79b0_len_1920, func_802C39F8); -//INCLUDE_ASM(code_e79b0_len_1920, restart_script); +INCLUDE_ASM(code_e79b0_len_1920, restart_script); // TODO: Find out why things break when script->timeScale = 1 goes after the previous lines +/* script_context* restart_script(script_context* script) { script->loopDepth = -1; script->switchDepth = -1; @@ -39,6 +40,7 @@ script_context* restart_script(script_context* script) { func_802C3390(script); return script; } +*/ INCLUDE_ASM(code_e79b0_len_1920, update_scripts); From 9496d860e4a9f87524475cc38d3545b7160fe536 Mon Sep 17 00:00:00 2001 From: Jdog Date: Fri, 14 Aug 2020 19:55:54 -0700 Subject: [PATCH 07/18] Dumb mistake --- src/code_e79b0_len_1920.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/code_e79b0_len_1920.c b/src/code_e79b0_len_1920.c index a24c8d38d8..3381f98ad5 100644 --- a/src/code_e79b0_len_1920.c +++ b/src/code_e79b0_len_1920.c @@ -52,7 +52,7 @@ void* kill_script_by_ID(s32 id) { s32 i; script_context* scriptContextPtr; - for (i = 1; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { + for (i = 0; i < ARRAY_COUNT(gCurrentScriptListPtr); i++) { scriptContextPtr = (*gCurrentScriptListPtr)[i]; if (scriptContextPtr != NULL && scriptContextPtr->uniqueID == id) { kill_script(scriptContextPtr); From 37ca14122f4afa931c5e804aa663bef752319017 Mon Sep 17 00:00:00 2001 From: Josh Date: Fri, 14 Aug 2020 20:51:58 -0700 Subject: [PATCH 08/18] Update common_structs.h I don't know how this happened. --- include/common_structs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common_structs.h b/include/common_structs.h index e294d97b36..a8264dff31 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -317,7 +317,7 @@ typedef struct ui_status { /* 0x36 */ s16 drawPosY; /* modulated as it appears, goes away */ /* 0x38 */ s16 showTimer; /* 0x3A */ s8 hidden; - /* 0x3B */ s8 unk_3B[ + /* 0x3B */ s8 unk_3B[2] /* 0x3D */ u8 displayHP; /* 0x3E */ u8 displayFP; /* 0x3F */ char unk_3F; From 1d3c037d9a1ce2e7b25638ae0f011b13bdee2ff6 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Fri, 14 Aug 2020 23:54:29 -0400 Subject: [PATCH 09/18] fixing header format --- include/common_structs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/common_structs.h b/include/common_structs.h index e294d97b36..0892675e8e 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -317,7 +317,7 @@ typedef struct ui_status { /* 0x36 */ s16 drawPosY; /* modulated as it appears, goes away */ /* 0x38 */ s16 showTimer; /* 0x3A */ s8 hidden; - /* 0x3B */ s8 unk_3B[ + /* 0x3B */ s8 unk_3B[2]; /* 0x3D */ u8 displayHP; /* 0x3E */ u8 displayFP; /* 0x3F */ char unk_3F; From 507441fc30db0c2235e0ea4e706d39ec2171ca58 Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sat, 15 Aug 2020 00:12:23 -0400 Subject: [PATCH 10/18] Jenkins test 1 --- Jenkinsfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Jenkinsfile diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..37ad920362 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,23 @@ +pipeline { + agent any + + stages { + stage('Setup') { + steps { + sh 'cp /usr/local/etc/roms/baserom_pm.z64 baserom_original.z64' + sh 'make -j setup' + } + } + stage('Build') { + steps { + echo 'Building...' + sh 'make -j' + } + } + } + post { + always { + cleanWs() + } + } +} From ea5ae7a1771f00d37a8a7d55a36470bf611ed71d Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sat, 15 Aug 2020 00:16:19 -0400 Subject: [PATCH 11/18] Jenkins test 2 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 37ad920362..38ccc97550 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,7 +5,7 @@ pipeline { stage('Setup') { steps { sh 'cp /usr/local/etc/roms/baserom_pm.z64 baserom_original.z64' - sh 'make -j setup' + sh 'make setup' } } stage('Build') { From 03b27e31424c0157b49baff4284357a5d976f74d Mon Sep 17 00:00:00 2001 From: Ethan Roseman Date: Sat, 15 Aug 2020 00:20:15 -0400 Subject: [PATCH 12/18] Jenkins test 3 --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 38ccc97550..6d531d58d7 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,7 +4,7 @@ pipeline { stages { stage('Setup') { steps { - sh 'cp /usr/local/etc/roms/baserom_pm.z64 baserom_original.z64' + sh 'cp /usr/local/etc/roms/baserom_pm.z64 baserom.z64' sh 'make setup' } } From 19b143fdd36bf6ba5df53fbc5261e33d12766cd4 Mon Sep 17 00:00:00 2001 From: Jdog Date: Sat, 15 Aug 2020 09:57:33 -0700 Subject: [PATCH 13/18] Match DeleteNpc --- .../code_f2470_len_27f0/DeleteNpc.s | 22 ---------- include/common_structs.h | 42 +++++++++++++++++++ src/code_f2470_len_27f0.c | 11 ++++- 3 files changed, 52 insertions(+), 23 deletions(-) delete mode 100644 asm/nonmatchings/code_f2470_len_27f0/DeleteNpc.s diff --git a/asm/nonmatchings/code_f2470_len_27f0/DeleteNpc.s b/asm/nonmatchings/code_f2470_len_27f0/DeleteNpc.s deleted file mode 100644 index b80cee382e..0000000000 --- a/asm/nonmatchings/code_f2470_len_27f0/DeleteNpc.s +++ /dev/null @@ -1,22 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel DeleteNpc -/* 0F25CC 802CDC1C 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0F25D0 802CDC20 AFBF0010 */ sw $ra, 0x10($sp) -/* 0F25D4 802CDC24 8C82000C */ lw $v0, 0xc($a0) -/* 0F25D8 802CDC28 0C0B1EAF */ jal get_variable -/* 0F25DC 802CDC2C 8C450000 */ lw $a1, ($v0) -/* 0F25E0 802CDC30 0C00EABB */ jal get_npc_unsafe -/* 0F25E4 802CDC34 0040202D */ daddu $a0, $v0, $zero -/* 0F25E8 802CDC38 50400004 */ beql $v0, $zero, .L802CDC4C -/* 0F25EC 802CDC3C 24020002 */ addiu $v0, $zero, 2 -/* 0F25F0 802CDC40 0C00E273 */ jal free_npc -/* 0F25F4 802CDC44 0040202D */ daddu $a0, $v0, $zero -/* 0F25F8 802CDC48 24020002 */ addiu $v0, $zero, 2 -.L802CDC4C: -/* 0F25FC 802CDC4C 8FBF0010 */ lw $ra, 0x10($sp) -/* 0F2600 802CDC50 03E00008 */ jr $ra -/* 0F2604 802CDC54 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/include/common_structs.h b/include/common_structs.h index 0892675e8e..4ea7090654 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -4,6 +4,12 @@ #include "ultra64.h" #include "types.h" +typedef struct vec3f { + /* 0x00 */ f32 x; + /* 0x04 */ f32 y; + /* 0x08 */ f32 z; +} vec3f; // size = 0x0C + typedef struct matrix4f { /* 0x00 */ f32 mtx[4][4]; } matrix4f; // size = 0x40 @@ -671,6 +677,42 @@ typedef struct npc_blur_data { /* 0xA4 */ f32 zpos[20]; } npc_blur_data; // size = 0xF4 +typedef struct npc { + /* 0x000 */ s32 flags; + /* 0x004 */ UNK_PTR onUpdate; /* run before anything else for this npc in the npc update step */ + /* 0x008 */ UNK_PTR onRender; /* run after the display list for this npc is built */ + /* 0x00C */ f32 yaw; + /* 0x010 */ f32 planarFlyDist; /* also used for speech, temp0? */ + /* 0x014 */ f32 jumpScale; /* also used for speech, temp1? */ + /* 0x018 */ f32 moveSpeed; + /* 0x01C */ f32 jumpVelocity; + /* 0x020 */ struct npc_blur_data* blurData; /* related to movement somehow... */ + /* 0x024 */ char unk_24[4]; + /* 0x028 */ u32 currentAnim; + /* 0x02C */ char unk_2C[12]; + /* 0x038 */ struct vec3f pos; + /* 0x044 */ struct vec3f rotation; + /* 0x050 */ char unk_50[4]; + /* 0x054 */ struct vec3f scale; + /* 0x060 */ struct vec3f moveToPos; + /* 0x06C */ struct vec3f colliderPos; /* used during collision with player */ + /* 0x078 */ s32 shadowIndex; + /* 0x07C */ f32 shadowScale; + /* 0x080 */ char unk_80[8]; + /* 0x088 */ s16 isFacingAway; + /* 0x08A */ s16 yawCamOffset; + /* 0x08C */ char unk_8C[2]; + /* 0x08E */ s16 duration; /* formerly interp_counter */ + /* 0x090 */ s16 homePos[3]; + /* 0x096 */ char unk_96[14]; + /* 0x0A4 */ u8 npcID; + /* 0x0A5 */ char unk_A5; + /* 0x0A6 */ s16 collisionRadius; + /* 0x0A8 */ s16 collisionHeight; + /* 0x0AA */ u8 renderMode; + /* 0x0AB */ char unk_AB[661]; +} npc; // size = 0x340 + typedef struct collider_aabb { /* 0x00 */ f32 min[3]; /* 0x0C */ f32 max[3]; diff --git a/src/code_f2470_len_27f0.c b/src/code_f2470_len_27f0.c index 50d684a384..31d9a0f318 100644 --- a/src/code_f2470_len_27f0.c +++ b/src/code_f2470_len_27f0.c @@ -4,7 +4,16 @@ INCLUDE_ASM(code_f2470_len_27f0, func_802CDAC0); INCLUDE_ASM(code_f2470_len_27f0, set_npc_animation); -INCLUDE_ASM(code_f2470_len_27f0, DeleteNpc); +s32 DeleteNpc(script_context* script, s32 initialCall) { + bytecode* ptrReadPos = script->ptrReadPos; + npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos)); + + if (npcPtr) { + free_npc(npcPtr); + return 2; + } + return 2; +} INCLUDE_ASM(code_f2470_len_27f0, GetNpcPointer); From 7d20b291295d957051fdd7c5503449c9d9e7d529 Mon Sep 17 00:00:00 2001 From: Jdog Date: Sat, 15 Aug 2020 10:59:48 -0700 Subject: [PATCH 14/18] Match GetNpcPointer --- .../code_f2470_len_27f0/GetNpcPointer.s | 28 ------------------- src/code_f2470_len_27f0.c | 9 +++++- 2 files changed, 8 insertions(+), 29 deletions(-) delete mode 100644 asm/nonmatchings/code_f2470_len_27f0/GetNpcPointer.s diff --git a/asm/nonmatchings/code_f2470_len_27f0/GetNpcPointer.s b/asm/nonmatchings/code_f2470_len_27f0/GetNpcPointer.s deleted file mode 100644 index 2b4efa6c2a..0000000000 --- a/asm/nonmatchings/code_f2470_len_27f0/GetNpcPointer.s +++ /dev/null @@ -1,28 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel GetNpcPointer -/* 0F2608 802CDC58 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F260C 802CDC5C AFB10014 */ sw $s1, 0x14($sp) -/* 0F2610 802CDC60 0080882D */ daddu $s1, $a0, $zero -/* 0F2614 802CDC64 AFBF0018 */ sw $ra, 0x18($sp) -/* 0F2618 802CDC68 AFB00010 */ sw $s0, 0x10($sp) -/* 0F261C 802CDC6C 8E30000C */ lw $s0, 0xc($s1) -/* 0F2620 802CDC70 8E050000 */ lw $a1, ($s0) -/* 0F2624 802CDC74 0C0B1EAF */ jal get_variable -/* 0F2628 802CDC78 26100004 */ addiu $s0, $s0, 4 -/* 0F262C 802CDC7C 8E100000 */ lw $s0, ($s0) -/* 0F2630 802CDC80 0C00EAD2 */ jal get_npc_safe -/* 0F2634 802CDC84 0040202D */ daddu $a0, $v0, $zero -/* 0F2638 802CDC88 0220202D */ daddu $a0, $s1, $zero -/* 0F263C 802CDC8C 0040302D */ daddu $a2, $v0, $zero -/* 0F2640 802CDC90 0C0B2026 */ jal set_variable -/* 0F2644 802CDC94 0200282D */ daddu $a1, $s0, $zero -/* 0F2648 802CDC98 8FBF0018 */ lw $ra, 0x18($sp) -/* 0F264C 802CDC9C 8FB10014 */ lw $s1, 0x14($sp) -/* 0F2650 802CDCA0 8FB00010 */ lw $s0, 0x10($sp) -/* 0F2654 802CDCA4 24020002 */ addiu $v0, $zero, 2 -/* 0F2658 802CDCA8 03E00008 */ jr $ra -/* 0F265C 802CDCAC 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/src/code_f2470_len_27f0.c b/src/code_f2470_len_27f0.c index 31d9a0f318..7d78c6de95 100644 --- a/src/code_f2470_len_27f0.c +++ b/src/code_f2470_len_27f0.c @@ -15,7 +15,14 @@ s32 DeleteNpc(script_context* script, s32 initialCall) { return 2; } -INCLUDE_ASM(code_f2470_len_27f0, GetNpcPointer); +s32 GetNpcPointer(script_context* script, s32 initialCall) { + bytecode* ptrReadPos = script->ptrReadPos; + bytecode npcID = get_variable(script, *ptrReadPos++); + bytecode varNPC = *ptrReadPos; + + set_variable(script, varNPC, get_npc_safe(npcID)); // removed * + return 2; +} INCLUDE_ASM(code_f2470_len_27f0, SetNpcPos); From 23de219c07071c7ce917e9bc273160eca7d681c6 Mon Sep 17 00:00:00 2001 From: Jdog Date: Sat, 15 Aug 2020 13:11:31 -0700 Subject: [PATCH 15/18] Match SpeakToPlayer, remove uneccessary comment, add WIP SetNpcSpeed --- .../code_f4c60_len_4300/SpeakToPlayer.s | 13 ------------- src/code_f2470_len_27f0.c | 16 +++++++++++++++- src/code_f4c60_len_4300.c | 4 +++- 3 files changed, 18 insertions(+), 15 deletions(-) delete mode 100644 asm/nonmatchings/code_f4c60_len_4300/SpeakToPlayer.s diff --git a/asm/nonmatchings/code_f4c60_len_4300/SpeakToPlayer.s b/asm/nonmatchings/code_f4c60_len_4300/SpeakToPlayer.s deleted file mode 100644 index f3b29c0137..0000000000 --- a/asm/nonmatchings/code_f4c60_len_4300/SpeakToPlayer.s +++ /dev/null @@ -1,13 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SpeakToPlayer -/* 0F4C60 802D02B0 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0F4C64 802D02B4 AFBF0010 */ sw $ra, 0x10($sp) -/* 0F4C68 802D02B8 0C0B40C8 */ jal _show_message -/* 0F4C6C 802D02BC 0000302D */ daddu $a2, $zero, $zero -/* 0F4C70 802D02C0 8FBF0010 */ lw $ra, 0x10($sp) -/* 0F4C74 802D02C4 03E00008 */ jr $ra -/* 0F4C78 802D02C8 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/src/code_f2470_len_27f0.c b/src/code_f2470_len_27f0.c index 7d78c6de95..4d570999da 100644 --- a/src/code_f2470_len_27f0.c +++ b/src/code_f2470_len_27f0.c @@ -20,7 +20,7 @@ s32 GetNpcPointer(script_context* script, s32 initialCall) { bytecode npcID = get_variable(script, *ptrReadPos++); bytecode varNPC = *ptrReadPos; - set_variable(script, varNPC, get_npc_safe(npcID)); // removed * + set_variable(script, varNPC, get_npc_safe(npcID)); return 2; } @@ -33,6 +33,20 @@ INCLUDE_ASM(code_f2470_len_27f0, SetNpcScale); INCLUDE_ASM(code_f2470_len_27f0, SetNpcCollisionSize); INCLUDE_ASM(code_f2470_len_27f0, SetNpcSpeed); +// TODO: Fix issue with BNEZL vs BNEZ +/* +s32 SetNpcSpeed(script_context* script, s32 initialCall) { + bytecode* ptrReadPos = script->ptrReadPos; + bytecode npcID = get_variable(script, *ptrReadPos++); + f32 speed = get_float_variable(script, *ptrReadPos); + npc* npcPtr = resolve_npc(script, npcID); + + npcPtr->moveSpeed = speed; + if(npcPtr != NULL) { + return 2; + } +} +*/ INCLUDE_ASM(code_f2470_len_27f0, SetNpcJumpscale); diff --git a/src/code_f4c60_len_4300.c b/src/code_f4c60_len_4300.c index 2a5cf0f34a..c3b3bb1749 100644 --- a/src/code_f4c60_len_4300.c +++ b/src/code_f4c60_len_4300.c @@ -1,6 +1,8 @@ #include "common.h" -INCLUDE_ASM(code_f4c60_len_4300, SpeakToPlayer); +void SpeakToPlayer(script_context* script, s32 initialCall) { + _show_message(script, initialCall, 0); +} INCLUDE_ASM(code_f4c60_len_4300, EndSpeech); From 98e5db063033caa63644f1ad4c11673933274ee0 Mon Sep 17 00:00:00 2001 From: Jdog Date: Sat, 15 Aug 2020 13:54:06 -0700 Subject: [PATCH 16/18] Match EndSpeech, ContinueSpeech, SpeakToNpc, SetMessageImages, func_802D0C94, SetMessageString. WIP SetMessageValue (issue with extra NOP) --- .../code_f4c60_len_4300/EndSpeech.s | 13 ------ .../code_f4c60_len_4300/SetMessageImages.s | 41 ----------------- .../code_f4c60_len_4300/SetMessageString.s | 28 ----------- src/code_f4c60_len_4300.c | 46 +++++++++++++++++-- 4 files changed, 41 insertions(+), 87 deletions(-) delete mode 100644 asm/nonmatchings/code_f4c60_len_4300/EndSpeech.s delete mode 100644 asm/nonmatchings/code_f4c60_len_4300/SetMessageImages.s delete mode 100644 asm/nonmatchings/code_f4c60_len_4300/SetMessageString.s diff --git a/asm/nonmatchings/code_f4c60_len_4300/EndSpeech.s b/asm/nonmatchings/code_f4c60_len_4300/EndSpeech.s deleted file mode 100644 index 406216c568..0000000000 --- a/asm/nonmatchings/code_f4c60_len_4300/EndSpeech.s +++ /dev/null @@ -1,13 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel EndSpeech -/* 0F4C7C 802D02CC 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0F4C80 802D02D0 AFBF0010 */ sw $ra, 0x10($sp) -/* 0F4C84 802D02D4 0C0B40C8 */ jal _show_message -/* 0F4C88 802D02D8 24060001 */ addiu $a2, $zero, 1 -/* 0F4C8C 802D02DC 8FBF0010 */ lw $ra, 0x10($sp) -/* 0F4C90 802D02E0 03E00008 */ jr $ra -/* 0F4C94 802D02E4 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/asm/nonmatchings/code_f4c60_len_4300/SetMessageImages.s b/asm/nonmatchings/code_f4c60_len_4300/SetMessageImages.s deleted file mode 100644 index 3892e6e4e4..0000000000 --- a/asm/nonmatchings/code_f4c60_len_4300/SetMessageImages.s +++ /dev/null @@ -1,41 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetMessageImages -/* 0F5620 802D0C70 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0F5624 802D0C74 AFBF0010 */ sw $ra, 0x10($sp) -/* 0F5628 802D0C78 8C82000C */ lw $v0, 0xc($a0) -/* 0F562C 802D0C7C 0C0496CB */ jal set_message_images -/* 0F5630 802D0C80 8C440000 */ lw $a0, ($v0) -/* 0F5634 802D0C84 8FBF0010 */ lw $ra, 0x10($sp) -/* 0F5638 802D0C88 24020002 */ addiu $v0, $zero, 2 -/* 0F563C 802D0C8C 03E00008 */ jr $ra -/* 0F5640 802D0C90 27BD0018 */ addiu $sp, $sp, 0x18 - -/* 0F5644 802D0C94 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0F5648 802D0C98 AFBF0010 */ sw $ra, 0x10($sp) -/* 0F564C 802D0C9C 8C82000C */ lw $v0, 0xc($a0) -/* 0F5650 802D0CA0 0C0B1EAF */ jal get_variable -/* 0F5654 802D0CA4 8C450000 */ lw $a1, ($v0) -/* 0F5658 802D0CA8 14400007 */ bnez $v0, .L802D0CC8 -/* 0F565C 802D0CAC 2404FFEF */ addiu $a0, $zero, -0x11 -/* 0F5660 802D0CB0 3C03800A */ lui $v1, 0x800a -/* 0F5664 802D0CB4 2463A650 */ addiu $v1, $v1, -0x59b0 -/* 0F5668 802D0CB8 8C620000 */ lw $v0, ($v1) -/* 0F566C 802D0CBC 34420010 */ ori $v0, $v0, 0x10 -/* 0F5670 802D0CC0 080B4337 */ j .L802D0CDC -/* 0F5674 802D0CC4 AC620000 */ sw $v0, ($v1) - -.L802D0CC8: -/* 0F5678 802D0CC8 3C02800A */ lui $v0, 0x800a -/* 0F567C 802D0CCC 2442A650 */ addiu $v0, $v0, -0x59b0 -/* 0F5680 802D0CD0 8C430000 */ lw $v1, ($v0) -/* 0F5684 802D0CD4 00641824 */ and $v1, $v1, $a0 -/* 0F5688 802D0CD8 AC430000 */ sw $v1, ($v0) -.L802D0CDC: -/* 0F568C 802D0CDC 8FBF0010 */ lw $ra, 0x10($sp) -/* 0F5690 802D0CE0 24020002 */ addiu $v0, $zero, 2 -/* 0F5694 802D0CE4 03E00008 */ jr $ra -/* 0F5698 802D0CE8 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/asm/nonmatchings/code_f4c60_len_4300/SetMessageString.s b/asm/nonmatchings/code_f4c60_len_4300/SetMessageString.s deleted file mode 100644 index a8504c8786..0000000000 --- a/asm/nonmatchings/code_f4c60_len_4300/SetMessageString.s +++ /dev/null @@ -1,28 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel SetMessageString -/* 0F569C 802D0CEC 27BDFFE0 */ addiu $sp, $sp, -0x20 -/* 0F56A0 802D0CF0 AFB10014 */ sw $s1, 0x14($sp) -/* 0F56A4 802D0CF4 0080882D */ daddu $s1, $a0, $zero -/* 0F56A8 802D0CF8 AFBF0018 */ sw $ra, 0x18($sp) -/* 0F56AC 802D0CFC AFB00010 */ sw $s0, 0x10($sp) -/* 0F56B0 802D0D00 8E30000C */ lw $s0, 0xc($s1) -/* 0F56B4 802D0D04 8E050000 */ lw $a1, ($s0) -/* 0F56B8 802D0D08 0C0B1EAF */ jal get_variable -/* 0F56BC 802D0D0C 26100004 */ addiu $s0, $s0, 4 -/* 0F56C0 802D0D10 0220202D */ daddu $a0, $s1, $zero -/* 0F56C4 802D0D14 8E050000 */ lw $a1, ($s0) -/* 0F56C8 802D0D18 0C0B1EAF */ jal get_variable -/* 0F56CC 802D0D1C 0040802D */ daddu $s0, $v0, $zero -/* 0F56D0 802D0D20 0200202D */ daddu $a0, $s0, $zero -/* 0F56D4 802D0D24 0C0496CF */ jal set_message_string -/* 0F56D8 802D0D28 0040282D */ daddu $a1, $v0, $zero -/* 0F56DC 802D0D2C 8FBF0018 */ lw $ra, 0x18($sp) -/* 0F56E0 802D0D30 8FB10014 */ lw $s1, 0x14($sp) -/* 0F56E4 802D0D34 8FB00010 */ lw $s0, 0x10($sp) -/* 0F56E8 802D0D38 24020002 */ addiu $v0, $zero, 2 -/* 0F56EC 802D0D3C 03E00008 */ jr $ra -/* 0F56F0 802D0D40 27BD0020 */ addiu $sp, $sp, 0x20 - diff --git a/src/code_f4c60_len_4300.c b/src/code_f4c60_len_4300.c index c3b3bb1749..76b02ac61a 100644 --- a/src/code_f4c60_len_4300.c +++ b/src/code_f4c60_len_4300.c @@ -4,11 +4,17 @@ void SpeakToPlayer(script_context* script, s32 initialCall) { _show_message(script, initialCall, 0); } -INCLUDE_ASM(code_f4c60_len_4300, EndSpeech); +void EndSpeech(script_context* script, s32 initialCall) { + _show_message(script, initialCall, 1); +} -INCLUDE_ASM(code_f4c60_len_4300, ContinueSpeech); +void ContinueSpeech(script_context* script, s32 initialCall) { + _show_message(script, initialCall, 2); +} -INCLUDE_ASM(code_f4c60_len_4300, SpeakToNpc); +void SpeakToNpc(script_context* script, s32 initialCall) { + _show_message(script, initialCall, 3); +} INCLUDE_ASM(code_f4c60_len_4300, _show_message); @@ -28,11 +34,41 @@ INCLUDE_ASM(code_f4c60_len_4300, CancelMessage); INCLUDE_ASM(code_f4c60_len_4300, CancelMessageAndBlock); -INCLUDE_ASM(code_f4c60_len_4300, SetMessageImages); +s32 SetMessageImages(script_context* script, s32 initialCall) { + set_message_images(*script->ptrReadPos); + return 2; +} -INCLUDE_ASM(code_f4c60_len_4300, SetMessageString); +s32 func_802D0C94(script_context* script, s32 initialCall) { + if (get_variable(script, *script->ptrReadPos) == 0) { + D_8009A650[0] |= 0x10; + } else { + D_8009A650[0] &= ~0x10; + } + return 2; +} + +s32 SetMessageString(script_context* script, s32 initialCall) { + bytecode* ptrReadPos = script->ptrReadPos; + bytecode string = get_variable(script, *ptrReadPos++); + bytecode index = get_variable(script, *ptrReadPos); + + set_message_string(string, index); + return 2; +} INCLUDE_ASM(code_f4c60_len_4300, SetMessageValue); +// TODO: Figure out why there's an extra NOP after this function +/* +s32 SetMessageValue(script_context* script, s32 initialCall) { + bytecode* ptrReadPos = script->ptrReadPos; + bytecode value = get_variable(script, *ptrReadPos++); + bytecode index = get_variable(script, *ptrReadPos); + + set_message_value(value, index); + return 2; +} +*/ INCLUDE_ASM(code_f4c60_len_4300, HidePlayerShadow); From 7beaf4c46163ba717c89a01613d07be4befadbb2 Mon Sep 17 00:00:00 2001 From: Jdog Date: Sat, 15 Aug 2020 14:51:44 -0700 Subject: [PATCH 17/18] Match CloseChoice, CancelMessage, CancelMessageAndBlock. Added gCurrentPrintContext and D_802DB268 (related) --- .../code_f4c60_len_4300/CancelMessage.s | 16 ---------------- .../code_f4c60_len_4300/CancelMessageAndBlock.s | 16 ---------------- .../code_f4c60_len_4300/CloseChoice.s | 16 ---------------- include/variables.h | 3 +++ src/code_f4c60_len_4300.c | 15 ++++++++++++--- undefined_syms.txt | 2 ++ 6 files changed, 17 insertions(+), 51 deletions(-) delete mode 100644 asm/nonmatchings/code_f4c60_len_4300/CancelMessage.s delete mode 100644 asm/nonmatchings/code_f4c60_len_4300/CancelMessageAndBlock.s delete mode 100644 asm/nonmatchings/code_f4c60_len_4300/CloseChoice.s diff --git a/asm/nonmatchings/code_f4c60_len_4300/CancelMessage.s b/asm/nonmatchings/code_f4c60_len_4300/CancelMessage.s deleted file mode 100644 index 451377f77a..0000000000 --- a/asm/nonmatchings/code_f4c60_len_4300/CancelMessage.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel CancelMessage -/* 0F55D0 802D0C20 3C04802E */ lui $a0, 0x802e -/* 0F55D4 802D0C24 8C84B260 */ lw $a0, -0x4da0($a0) -/* 0F55D8 802D0C28 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0F55DC 802D0C2C AFBF0010 */ sw $ra, 0x10($sp) -/* 0F55E0 802D0C30 0C0496C2 */ jal cancel_message -/* 0F55E4 802D0C34 00000000 */ nop -/* 0F55E8 802D0C38 8FBF0010 */ lw $ra, 0x10($sp) -/* 0F55EC 802D0C3C 24020002 */ addiu $v0, $zero, 2 -/* 0F55F0 802D0C40 03E00008 */ jr $ra -/* 0F55F4 802D0C44 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/asm/nonmatchings/code_f4c60_len_4300/CancelMessageAndBlock.s b/asm/nonmatchings/code_f4c60_len_4300/CancelMessageAndBlock.s deleted file mode 100644 index aa3de8c503..0000000000 --- a/asm/nonmatchings/code_f4c60_len_4300/CancelMessageAndBlock.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel CancelMessageAndBlock -/* 0F55F8 802D0C48 3C04802E */ lui $a0, 0x802e -/* 0F55FC 802D0C4C 8C84B260 */ lw $a0, -0x4da0($a0) -/* 0F5600 802D0C50 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0F5604 802D0C54 AFBF0010 */ sw $ra, 0x10($sp) -/* 0F5608 802D0C58 0C0496C2 */ jal cancel_message -/* 0F560C 802D0C5C 00000000 */ nop -/* 0F5610 802D0C60 8FBF0010 */ lw $ra, 0x10($sp) -/* 0F5614 802D0C64 0000102D */ daddu $v0, $zero, $zero -/* 0F5618 802D0C68 03E00008 */ jr $ra -/* 0F561C 802D0C6C 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/asm/nonmatchings/code_f4c60_len_4300/CloseChoice.s b/asm/nonmatchings/code_f4c60_len_4300/CloseChoice.s deleted file mode 100644 index cf0b877771..0000000000 --- a/asm/nonmatchings/code_f4c60_len_4300/CloseChoice.s +++ /dev/null @@ -1,16 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - - -glabel CloseChoice -/* 0F55A8 802D0BF8 3C04802E */ lui $a0, 0x802e -/* 0F55AC 802D0BFC 8C84B268 */ lw $a0, -0x4d98($a0) -/* 0F55B0 802D0C00 27BDFFE8 */ addiu $sp, $sp, -0x18 -/* 0F55B4 802D0C04 AFBF0010 */ sw $ra, 0x10($sp) -/* 0F55B8 802D0C08 0C04971C */ jal close_message -/* 0F55BC 802D0C0C 00000000 */ nop -/* 0F55C0 802D0C10 8FBF0010 */ lw $ra, 0x10($sp) -/* 0F55C4 802D0C14 24020001 */ addiu $v0, $zero, 1 -/* 0F55C8 802D0C18 03E00008 */ jr $ra -/* 0F55CC 802D0C1C 27BD0018 */ addiu $sp, $sp, 0x18 - diff --git a/include/variables.h b/include/variables.h index 4c98591581..02b45e7539 100644 --- a/include/variables.h +++ b/include/variables.h @@ -27,6 +27,9 @@ extern char gSunnyFlowerFieldsBg[]; // "flb_bg" extern bg_header gBackgroundImage; extern s8 D_8014F12F; +extern print_context* gCurrentPrintContext; +extern print_context* D_802DB268; + // Triggers /* 0x80151334 */ extern s16 gTriggerCount; /* 0x80159190 */ extern trigger gTriggerList1[64]; diff --git a/src/code_f4c60_len_4300.c b/src/code_f4c60_len_4300.c index 76b02ac61a..1e8d65b487 100644 --- a/src/code_f4c60_len_4300.c +++ b/src/code_f4c60_len_4300.c @@ -28,11 +28,20 @@ INCLUDE_ASM(code_f4c60_len_4300, SwitchMessage); INCLUDE_ASM(code_f4c60_len_4300, ShowChoice); -INCLUDE_ASM(code_f4c60_len_4300, CloseChoice); +s32 CloseChoice(script_context* script, s32 initialCall) { + close_message(D_802DB268); + return 1; +} -INCLUDE_ASM(code_f4c60_len_4300, CancelMessage); +s32 CancelMessage(script_context* script, s32 initialCall) { + cancel_message(gCurrentPrintContext); + return 2; +} -INCLUDE_ASM(code_f4c60_len_4300, CancelMessageAndBlock); +s32 CancelMessageAndBlock(script_context* script, s32 initialCall) { + cancel_message(gCurrentPrintContext); + return 0; +} s32 SetMessageImages(script_context* script, s32 initialCall) { set_message_images(*script->ptrReadPos); diff --git a/undefined_syms.txt b/undefined_syms.txt index d298cbaace..e3238755fd 100644 --- a/undefined_syms.txt +++ b/undefined_syms.txt @@ -43,6 +43,8 @@ D_8010F6D0 = 0x8010F6D0; gBackgroundImage = 0x80200000; D_802C3000 = 0x802C3000; D_802DBD40 = 0x802DBD40; +gCurrentPrintContext = 0x802DB260; +D_802DB268 = 0x802DB268; D_802E0D90 = 0x802E0D90; D_802EB3D0 = 0x802EB3D0; From 01ecc1dd24c66103fa2e9262dd2ff80729243ae8 Mon Sep 17 00:00:00 2001 From: Jdog Date: Sat, 15 Aug 2020 15:26:14 -0700 Subject: [PATCH 18/18] Added proper return types to a few script functions. Use ptrReadPos++ in places where it's not stricly necessary, but good practice. --- src/code_f2470_len_27f0.c | 4 ++-- src/code_f4c60_len_4300.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/code_f2470_len_27f0.c b/src/code_f2470_len_27f0.c index 4d570999da..dc1ced9484 100644 --- a/src/code_f2470_len_27f0.c +++ b/src/code_f2470_len_27f0.c @@ -6,7 +6,7 @@ INCLUDE_ASM(code_f2470_len_27f0, set_npc_animation); s32 DeleteNpc(script_context* script, s32 initialCall) { bytecode* ptrReadPos = script->ptrReadPos; - npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos)); + npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos++)); if (npcPtr) { free_npc(npcPtr); @@ -18,7 +18,7 @@ s32 DeleteNpc(script_context* script, s32 initialCall) { s32 GetNpcPointer(script_context* script, s32 initialCall) { bytecode* ptrReadPos = script->ptrReadPos; bytecode npcID = get_variable(script, *ptrReadPos++); - bytecode varNPC = *ptrReadPos; + bytecode varNPC = *ptrReadPos++; set_variable(script, varNPC, get_npc_safe(npcID)); return 2; diff --git a/src/code_f4c60_len_4300.c b/src/code_f4c60_len_4300.c index 1e8d65b487..df771a1096 100644 --- a/src/code_f4c60_len_4300.c +++ b/src/code_f4c60_len_4300.c @@ -1,19 +1,19 @@ #include "common.h" -void SpeakToPlayer(script_context* script, s32 initialCall) { - _show_message(script, initialCall, 0); +s32 SpeakToPlayer(script_context* script, s32 initialCall) { + return _show_message(script, initialCall, 0); } -void EndSpeech(script_context* script, s32 initialCall) { - _show_message(script, initialCall, 1); +s32 EndSpeech(script_context* script, s32 initialCall) { + return _show_message(script, initialCall, 1); } -void ContinueSpeech(script_context* script, s32 initialCall) { - _show_message(script, initialCall, 2); +s32 ContinueSpeech(script_context* script, s32 initialCall) { + return _show_message(script, initialCall, 2); } -void SpeakToNpc(script_context* script, s32 initialCall) { - _show_message(script, initialCall, 3); +s32 SpeakToNpc(script_context* script, s32 initialCall) { + return _show_message(script, initialCall, 3); } INCLUDE_ASM(code_f4c60_len_4300, _show_message); @@ -60,7 +60,7 @@ s32 func_802D0C94(script_context* script, s32 initialCall) { s32 SetMessageString(script_context* script, s32 initialCall) { bytecode* ptrReadPos = script->ptrReadPos; bytecode string = get_variable(script, *ptrReadPos++); - bytecode index = get_variable(script, *ptrReadPos); + bytecode index = get_variable(script, *ptrReadPos++); set_message_string(string, index); return 2;