diff --git a/data/data_8115F5C_1.s b/data/data_8115F5C_1.s index dda8c121b..44718732b 100644 --- a/data/data_8115F5C_1.s +++ b/data/data_8115F5C_1.s @@ -2,16 +2,6 @@ .align 2 - -.align 2,0 -.string "pksdir0\0" -.align 2,0 -.string "pksdir0\0" -.align 2,0 - -.global gNullGroundScript -gNullGroundScript: @ 8117EFC -.byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .string "pksdir0\0" .align 2,0 diff --git a/data/pksdir_6.s b/data/pksdir_6.s new file mode 100644 index 000000000..a3bfe01ae --- /dev/null +++ b/data/pksdir_6.s @@ -0,0 +1,9 @@ + .section .rodata + + .align 2, 0 + + +@ ??? +.string "pksdir0\0" + .align 2, 0 + diff --git a/ld_script.txt b/ld_script.txt index 40bc2f6bd..ce031e619 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -349,7 +349,7 @@ SECTIONS { src/ground_sprite_data.o(.text); src/ground_sprite_monster.o(.text); src/ground_sprite_util.o(.text); - src/code_80A7714.o(.text); + src/ground_script_file.o(.text); src/ground_lives.o(.text); asm/ground_lives.o(.text); src/ground_object.o(.text); @@ -702,6 +702,8 @@ SECTIONS { src/ground_sprite_data.o(.rodata); src/ground_sprite_monster.o(.rodata); src/ground_sprite_util.o(.rodata); + data/pksdir_6.o(.rodata); + src/ground_script_file.o(.rodata); data/data_8115F5C_1.o(.rodata); src/ground_event.o(.rodata); src/unk_dungeon_load_maybe.o(.rodata); diff --git a/src/code_80A7714.c b/src/ground_script_file.c similarity index 61% rename from src/code_80A7714.c rename to src/ground_script_file.c index e3280153e..3913b0e2b 100644 --- a/src/code_80A7714.c +++ b/src/ground_script_file.c @@ -1,22 +1,21 @@ #include "global.h" -#include "structs/axdata.h" +#include "globaldata.h" +#include "ground_script.h" -extern void sub_80A68A0(u32); -extern void ResetCurrentScriptFile(); +static EWRAM_DATA s16 sScriptFileId = {0}; -static EWRAM_DATA s16 sUnknown_2039DE0 = {0}; - -extern const struct GroundScriptHeader gNullGroundScript; extern const struct GroundScriptHeader *gMapScriptTable[]; // 811E2F8 +static void ResetCurrentScriptFile(void); + void sub_80A7744(void) { - sUnknown_2039DE0 = -1; + sScriptFileId = -1; } void sub_80A7754(void) { - sUnknown_2039DE0 = -1; + sScriptFileId = -1; } void SetCurrentScriptFile(s16 a0) @@ -26,13 +25,13 @@ void SetCurrentScriptFile(s16 a0) ResetCurrentScriptFile(); if (temp != -1) - sUnknown_2039DE0 = temp; + sScriptFileId = temp; } void ResetCurrentScriptFile(void) { - if (sUnknown_2039DE0 != -1) - sUnknown_2039DE0 = -1; + if (sScriptFileId != -1) + sScriptFileId = -1; } bool8 ChangeScriptFile(s16 a0) @@ -41,7 +40,7 @@ bool8 ChangeScriptFile(s16 a0) s32 temp2; temp = a0; temp2 = temp; - if (sUnknown_2039DE0 != temp) { + if (sScriptFileId != temp) { if (temp < 0) ResetCurrentScriptFile(); else @@ -51,10 +50,12 @@ bool8 ChangeScriptFile(s16 a0) return FALSE; } +static const struct GroundScriptHeader sNullGroundScript = {0}; + const struct GroundScriptHeader *GetGroundScript(s16 a0) { if (a0 != -1) return gMapScriptTable[a0]; else - return &gNullGroundScript; + return &sNullGroundScript; } diff --git a/sym_ewram.txt b/sym_ewram.txt index 9ae145f81..36534ad61 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -167,4 +167,4 @@ gUnknown_2039DA8: /* 2039DA8 (sub_80A14E8) */ .space 0x8 .include "src/ground_sprite.o" - .include "src/code_80A7714.o" + .include "src/ground_script_file.o"