From 5c904d39053fffca03ea42c85ed22fc81463465a Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Thu, 3 Apr 2025 10:14:45 +0200 Subject: [PATCH] merge dungeon leader - dungeon range --- ld_script.txt | 1 - src/dungeon_leader.c | 31 ------------------------------- src/dungeon_range.c | 25 +++++++++++++++++++++++++ sym_ewram_init.txt | 2 +- 4 files changed, 26 insertions(+), 33 deletions(-) delete mode 100644 src/dungeon_leader.c diff --git a/ld_script.txt b/ld_script.txt index 84a6cc42e..d279facf4 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -275,7 +275,6 @@ SECTIONS { src/trap.o(.text); src/dungeon_serializer.o(.text); src/dungeon_range.o(.text); - src/dungeon_leader.o(.text); asm/code_8083654.o(.text); src/dungeon_music.o(.text); src/dungeon_random.o(.text); diff --git a/src/dungeon_leader.c b/src/dungeon_leader.c deleted file mode 100644 index 56e1c737b..000000000 --- a/src/dungeon_leader.c +++ /dev/null @@ -1,31 +0,0 @@ -#include "global.h" -#include "structs/str_dungeon.h" -#include "dungeon_leader.h" -#include "dungeon_util.h" - -EWRAM_INIT Entity *gLeaderPointer = NULL; - -Entity* GetLeader(void) -{ - Entity *leader = gLeaderPointer; - if (leader == NULL) - { - s32 i; - for (i = 0; i < MAX_TEAM_MEMBERS; i++) - { - Entity *currentPokemon = gDungeon->teamPokemon[i]; - if (EntityIsValid(currentPokemon) && GetEntInfo(currentPokemon)->isTeamLeader) - { - gLeaderPointer = currentPokemon; - return currentPokemon; - } - } - return NULL; - } - return leader; -} - -EntityInfo* GetLeaderInfo(void) -{ - return GetEntInfo(GetLeader()); -} diff --git a/src/dungeon_range.c b/src/dungeon_range.c index af475d72f..6fa91ae55 100644 --- a/src/dungeon_range.c +++ b/src/dungeon_range.c @@ -1,11 +1,14 @@ #include "global.h" #include "dungeon_range.h" +#include "dungeon_leader.h" +#include "dungeon_util.h" #include "sprite.h" #include "structs/str_dungeon.h" #include "dungeon_map_access.h" #include "structs/map.h" #include "structs/str_202ED28.h" +EWRAM_INIT Entity *gLeaderPointer = NULL; bool8 IsPositionActuallyInSight(DungeonPos *pos1, DungeonPos *pos2) { @@ -234,3 +237,25 @@ bool8 sub_8083568(s32 inX, s32 inY, u8 index) return FALSE; } } + +Entity* GetLeader(void) +{ + Entity *leader = gLeaderPointer; + if (leader == NULL) { + s32 i; + for (i = 0; i < MAX_TEAM_MEMBERS; i++) { + Entity *currentPokemon = gDungeon->teamPokemon[i]; + if (EntityIsValid(currentPokemon) && GetEntInfo(currentPokemon)->isTeamLeader) { + gLeaderPointer = currentPokemon; + return currentPokemon; + } + } + return NULL; + } + return leader; +} + +EntityInfo* GetLeaderInfo(void) +{ + return GetEntInfo(GetLeader()); +} diff --git a/sym_ewram_init.txt b/sym_ewram_init.txt index 1048a3c5c..96618d1ad 100644 --- a/sym_ewram_init.txt +++ b/sym_ewram_init.txt @@ -121,7 +121,7 @@ .include "src/dungeon_menu_recruitment.o" .include "src/dungeon_ai_items.o" .include "src/explosion.o" -.include "src/dungeon_leader.o" +.include "src/dungeon_range.o" .include "src/dungeon_random.o" .include "src/dungeon_music.o" .include "src/pokemon.o"