From 0ed2f54d6131b8f4d9dc00aa40413c121eea8a01 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Wed, 28 Nov 2018 21:08:22 +0100 Subject: Use MAX_SPRITES define --- src/overworld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/overworld.c') diff --git a/src/overworld.c b/src/overworld.c index 10f2ebd26..3193ec0d3 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -2955,7 +2955,7 @@ static void sub_808780C(u8 linkPlayerId) struct LinkPlayerEventObject *linkPlayerEventObj = &gLinkPlayerEventObjects[linkPlayerId]; u8 eventObjId = linkPlayerEventObj->eventObjId; struct EventObject *eventObj = &gEventObjects[eventObjId]; - if (eventObj->spriteId != 64 ) + if (eventObj->spriteId != MAX_SPRITES) DestroySprite(&gSprites[eventObj->spriteId]); linkPlayerEventObj->active = 0; eventObj->active = 0; -- cgit v1.2.3 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 From 4c23adb5f53a61d0e7426376aba9a04de5c8f2b3 Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 8 Dec 2018 19:05:03 +0100 Subject: Decompile field weather --- src/overworld.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/overworld.c') diff --git a/src/overworld.c b/src/overworld.c index 3193ec0d3..470e27ffc 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -148,7 +148,7 @@ extern void ResetAllPicSprites(void); extern void FieldEffectActiveListClear(void); extern void SetUpFieldTasks(void); extern void sub_81BE6B8(void); -extern void sub_80AAFA4(void); +extern void StartWeather(void); extern void ShowStartMenu(void); extern void sub_80AEE84(void); extern void mapldr_default(void); @@ -2160,7 +2160,7 @@ static void sub_8086988(u32 a1) InitEventObjectPalettes(1); FieldEffectActiveListClear(); - sub_80AAFA4(); + StartWeather(); sub_80AEE84(); if (!a1) SetUpFieldTasks(); -- cgit v1.2.3 From 58c4cec9462cef154e75d12181ebe6d42c0f3e9e Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 8 Dec 2018 21:42:36 +0100 Subject: decompile field screen --- src/overworld.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/overworld.c') diff --git a/src/overworld.c b/src/overworld.c index 470e27ffc..a60ac9a54 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -129,7 +129,7 @@ extern void sub_80A0A38(void); extern void trainer_hill_map_load_related(void); extern void sub_8087D74(void); extern void battle_pyramid_map_load_related(u8); -extern void sub_80B00E8(u8); +extern void WriteFlashScanlineEffectBuffer(u8); extern void sub_80E9238(u8); extern void sub_81AA2F8(void); extern void sub_8195E10(void); @@ -1241,7 +1241,7 @@ u8 GetMapMusicFadeoutSpeed(void) return 4; } -void music_something(void) +void TryFadeOutOldMapMusic(void) { u16 currentMusic = GetCurrentMapMusic(); u16 warpMusic = GetWarpDestinationMusic(); @@ -1819,7 +1819,7 @@ static void InitCurrentFlashLevelScanlineEffect(void) } else if ((flashLevel = Overworld_GetFlashLevel())) { - sub_80B00E8(flashLevel); + WriteFlashScanlineEffectBuffer(flashLevel); ScanlineEffect_SetParams(sFlashEffectParams); } } -- cgit v1.2.3 From 4ec14b3d431f61309e33ca58c7702678bd25ae7a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Sat, 8 Dec 2018 22:05:11 +0100 Subject: Finish field screen --- src/overworld.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/overworld.c') diff --git a/src/overworld.c b/src/overworld.c index a60ac9a54..8d8675487 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -4,18 +4,17 @@ #include "battle_setup.h" #include "berry.h" #include "bg.h" -// #include "cable_club.h" +#include "cable_club.h" #include "clock.h" #include "event_data.h" #include "field_camera.h" #include "field_control_avatar.h" #include "field_effect.h" -#include "field_fadetransition.h" #include "event_object_movement.h" #include "field_message_box.h" #include "field_player_avatar.h" #include "field_screen_effect.h" -// #include "field_special_scene.h" +#include "field_special_scene.h" #include "field_specials.h" #include "field_tasks.h" #include "field_weather.h" @@ -38,7 +37,7 @@ #include "play_time.h" #include "random.h" #include "roamer.h" -// #include "rotating_gate.h" +#include "rotating_gate.h" #include "safari_zone.h" #include "save.h" #include "save_location.h" -- cgit v1.2.3 From a7722a0b936132527ff0bf8fd8213ab0bbd25e44 Mon Sep 17 00:00:00 2001 From: Marcus Huderle Date: Sun, 9 Dec 2018 13:41:52 -0600 Subject: Decompile cable_car.c (#438) --- src/overworld.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/overworld.c') diff --git a/src/overworld.c b/src/overworld.c index 417c52a9e..6998c9d98 100644 --- a/src/overworld.c +++ b/src/overworld.c @@ -147,7 +147,6 @@ extern void ResetAllPicSprites(void); extern void FieldEffectActiveListClear(void); extern void SetUpFieldTasks(void); extern void sub_81BE6B8(void); -extern void StartWeather(void); extern void ShowStartMenu(void); extern void sub_80AEE84(void); extern void mapldr_default(void); -- cgit v1.2.3