Added proper return types to a few script functions. Use ptrReadPos++ in places where it's not stricly necessary, but good practice.

This commit is contained in:
Jdog 2020-08-15 15:26:14 -07:00
parent 7beaf4c461
commit 01ecc1dd24
2 changed files with 11 additions and 11 deletions

View File

@ -6,7 +6,7 @@ INCLUDE_ASM(code_f2470_len_27f0, set_npc_animation);
s32 DeleteNpc(script_context* script, s32 initialCall) { s32 DeleteNpc(script_context* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos; bytecode* ptrReadPos = script->ptrReadPos;
npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos)); npc* npcPtr = get_npc_unsafe(get_variable(script, *ptrReadPos++));
if (npcPtr) { if (npcPtr) {
free_npc(npcPtr); free_npc(npcPtr);
@ -18,7 +18,7 @@ s32 DeleteNpc(script_context* script, s32 initialCall) {
s32 GetNpcPointer(script_context* script, s32 initialCall) { s32 GetNpcPointer(script_context* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos; bytecode* ptrReadPos = script->ptrReadPos;
bytecode npcID = get_variable(script, *ptrReadPos++); bytecode npcID = get_variable(script, *ptrReadPos++);
bytecode varNPC = *ptrReadPos; bytecode varNPC = *ptrReadPos++;
set_variable(script, varNPC, get_npc_safe(npcID)); set_variable(script, varNPC, get_npc_safe(npcID));
return 2; return 2;

View File

@ -1,19 +1,19 @@
#include "common.h" #include "common.h"
void SpeakToPlayer(script_context* script, s32 initialCall) { s32 SpeakToPlayer(script_context* script, s32 initialCall) {
_show_message(script, initialCall, 0); return _show_message(script, initialCall, 0);
} }
void EndSpeech(script_context* script, s32 initialCall) { s32 EndSpeech(script_context* script, s32 initialCall) {
_show_message(script, initialCall, 1); return _show_message(script, initialCall, 1);
} }
void ContinueSpeech(script_context* script, s32 initialCall) { s32 ContinueSpeech(script_context* script, s32 initialCall) {
_show_message(script, initialCall, 2); return _show_message(script, initialCall, 2);
} }
void SpeakToNpc(script_context* script, s32 initialCall) { s32 SpeakToNpc(script_context* script, s32 initialCall) {
_show_message(script, initialCall, 3); return _show_message(script, initialCall, 3);
} }
INCLUDE_ASM(code_f4c60_len_4300, _show_message); 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) { s32 SetMessageString(script_context* script, s32 initialCall) {
bytecode* ptrReadPos = script->ptrReadPos; bytecode* ptrReadPos = script->ptrReadPos;
bytecode string = get_variable(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); set_message_string(string, index);
return 2; return 2;