From 3909b6408c0125fe311d49a3029a2806993615f7 Mon Sep 17 00:00:00 2001 From: nullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com> Date: Thu, 29 Nov 2018 19:24:28 +0800 Subject: Fix alloc.c as per #386, define INVALID_ constants and rename malloc to alloc as per #325 Some of the INVALID_ are likely erroneously placed, due to lack of documentation --- src/overworld.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/overworld.c') diff --git a/src/overworld.c b/src/overworld.c index 3193ec0d3..13c36819f 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -27,7 +27,7 @@ #include "link_rfu.h" #include "load_save.h" #include "main.h" -#include "malloc.h" +#include "alloc.h" #include "m4a.h" #include "map_name_popup.h" #include "menu.h" @@ -1110,7 +1110,7 @@ static bool16 IsInflitratedSpaceCenter(struct WarpData *warp) u16 GetLocationMusic(struct WarpData *warp) { if (NoMusicInSotopolisWithLegendaries(warp) == TRUE) - return 0xFFFF; + return INVALID_U16; else if (ShouldLegendaryMusicPlayAtLocation(warp) == TRUE) return MUS_OOAME; else if (IsInflitratedSpaceCenter(warp) == TRUE) @@ -1171,7 +1171,7 @@ void Overworld_PlaySpecialMapMusic(void) { u16 music = GetCurrLocationDefaultMusic(); - if (music != MUS_OOAME && music != 0xFFFF) + if (music != MUS_OOAME && music != INVALID_U16) { if (gSaveBlock1Ptr->savedMusic) music = gSaveBlock1Ptr->savedMusic; @@ -1201,7 +1201,7 @@ static void sub_8085810(void) { u16 newMusic = GetWarpDestinationMusic(); u16 currentMusic = GetCurrentMapMusic(); - if (newMusic != MUS_OOAME && newMusic != 0xFFFF) + if (newMusic != MUS_OOAME && newMusic != INVALID_U16) { if (currentMusic == MUS_DEEPDEEP || currentMusic == MUS_NAMINORI) return; -- cgit v1.2.3 From f9ff7316d5c7277eb7482e30121388cd65f4ecfc Mon Sep 17 00:00:00 2001 From: nullableVoidPtr <30564701+nullableVoidPtr@users.noreply.github.com> Date: Wed, 5 Dec 2018 22:31:01 +0800 Subject: Remove uses of INVALID_ defines, clean up some arrays with constants, and spaces -> tabs --- src/overworld.c | 60 +++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 12 deletions(-) (limited to 'src/overworld.c') diff --git a/src/overworld.c b/src/overworld.c index 13c36819f..12e02a9b5 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -296,15 +296,51 @@ static const u8 sUnusedData[] = const struct UCoords32 gDirectionToVectors[] = { - { 0, 0}, // DIR_NONE - { 0, 1}, // DIR_SOUTH - { 0, -1}, // DIR_NORTH - {-1, 0}, // DIR_WEST - { 1, 0}, // DIR_EAST - {-1, 1}, // DIR_SOUTHWEST - { 1, 1}, // DIR_SOUTHEAST - {-1, -1}, // DIR_NORTHWEST - { 1, -1}, // DIR_NORTHEAST + [DIR_NONE] = + { + .x = 0, + .y = 0, + }, + [DIR_SOUTH] = + { + .x = 0, + .y = 1, + }, + [DIR_NORTH] = + { + .x = 0, + .y = -1, + }, + [DIR_WEST] = + { + .x = -1, + .y = 0, + }, + [DIR_EAST] = + { + .x = 1, + .y = 0, + }, + [DIR_SOUTHWEST] = + { + .x = -1, + .y = 1, + }, + [DIR_SOUTHEAST] = + { + .x = 1, + .y = 1, + }, + [DIR_NORTHWEST] = + { + .x = -1, + .y = -1, + }, + [DIR_NORTHEAST] = + { + .x = 1, + .y = -1, + }, }; static const struct BgTemplate gUnknown_08339DAC[] = @@ -1110,7 +1146,7 @@ static bool16 IsInflitratedSpaceCenter(struct WarpData *warp) u16 GetLocationMusic(struct WarpData *warp) { if (NoMusicInSotopolisWithLegendaries(warp) == TRUE) - return INVALID_U16; + return 0xFFFF; else if (ShouldLegendaryMusicPlayAtLocation(warp) == TRUE) return MUS_OOAME; else if (IsInflitratedSpaceCenter(warp) == TRUE) @@ -1171,7 +1207,7 @@ void Overworld_PlaySpecialMapMusic(void) { u16 music = GetCurrLocationDefaultMusic(); - if (music != MUS_OOAME && music != INVALID_U16) + if (music != MUS_OOAME && music != 0xFFFF) { if (gSaveBlock1Ptr->savedMusic) music = gSaveBlock1Ptr->savedMusic; @@ -1201,7 +1237,7 @@ static void sub_8085810(void) { u16 newMusic = GetWarpDestinationMusic(); u16 currentMusic = GetCurrentMapMusic(); - if (newMusic != MUS_OOAME && newMusic != INVALID_U16) + if (newMusic != MUS_OOAME && newMusic != 0xFFFF) { if (currentMusic == MUS_DEEPDEEP || currentMusic == MUS_NAMINORI) return; -- cgit v1.2.3