From a5cf2b8090fb6638857b91f4f2a58c5584ca9335 Mon Sep 17 00:00:00 2001 From: Phlosioneer Date: Mon, 25 Feb 2019 02:09:02 -0500 Subject: [PATCH] Use map script constants in map script functions --- src/script.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/script.c b/src/script.c index dff99609b..c95a1141f 100644 --- a/src/script.c +++ b/src/script.c @@ -2,6 +2,7 @@ #include "script.h" #include "event_data.h" #include "util.h" +#include "constants/map_scripts.h" #define RAM_SCRIPT_MAGIC 51 @@ -293,32 +294,32 @@ u8 *MapHeaderCheckScriptTable(u8 tag) void RunOnLoadMapScript(void) { - MapHeaderRunScriptType(1); + MapHeaderRunScriptType(MAP_SCRIPT_ON_LOAD); } void RunOnTransitionMapScript(void) { - MapHeaderRunScriptType(3); + MapHeaderRunScriptType(MAP_SCRIPT_ON_TRANSITION); } void RunOnResumeMapScript(void) { - MapHeaderRunScriptType(5); + MapHeaderRunScriptType(MAP_SCRIPT_ON_RESUME); } void RunOnReturnToFieldMapScript(void) { - MapHeaderRunScriptType(7); + MapHeaderRunScriptType(MAP_SCRIPT_ON_RETURN_TO_FIELD); } void RunOnDiveWarpMapScript(void) { - MapHeaderRunScriptType(6); + MapHeaderRunScriptType(MAP_SCRIPT_ON_DIVE_WARP); } bool8 TryRunOnFrameMapScript(void) { - u8 *ptr = MapHeaderCheckScriptTable(2); + u8 *ptr = MapHeaderCheckScriptTable(MAP_SCRIPT_ON_FRAME_TABLE); if (!ptr) return FALSE; @@ -329,7 +330,7 @@ bool8 TryRunOnFrameMapScript(void) void TryRunOnWarpIntoMapScript(void) { - u8 *ptr = MapHeaderCheckScriptTable(4); + u8 *ptr = MapHeaderCheckScriptTable(MAP_SCRIPT_ON_WARP_INTO_MAP_TABLE); if (ptr) ScriptContext2_RunNewScript(ptr); }