merge dungeon leader - dungeon range

This commit is contained in:
DizzyEggg
2025-04-03 10:14:45 +02:00
parent efbf411cf5
commit 5c904d3905
4 changed files with 26 additions and 33 deletions

View File

@@ -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);

View File

@@ -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());
}

View File

@@ -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());
}

View File

@@ -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"