From 01ecc1dd24c66103fa2e9262dd2ff80729243ae8 Mon Sep 17 00:00:00 2001 From: Jdog Date: Sat, 15 Aug 2020 15:26:14 -0700 Subject: [PATCH] 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;