Skip to content

Commit

Permalink
Merge pull request #315 from AnonymousRandomPerson/master
Browse files Browse the repository at this point in the history
Document some AI vars, sync names with pmdsky-debug
  • Loading branch information
SethBarberee authored Dec 30, 2024
2 parents 6020a3d + 1ec6bc5 commit 6936e1f
Show file tree
Hide file tree
Showing 68 changed files with 502 additions and 498 deletions.
10 changes: 5 additions & 5 deletions asm/code_8040094.s
Original file line number Diff line number Diff line change
Expand Up @@ -1663,7 +1663,7 @@ _08040E24:
adds r6, r7, 0
_08040E26:
adds r0, r6, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
bne _08040E34
Expand Down Expand Up @@ -2104,7 +2104,7 @@ _0804118A:
movs r2, 0
str r2, [sp, 0x14]
adds r0, r6, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080411CA
Expand Down Expand Up @@ -2137,7 +2137,7 @@ _080411D0:
cmp r5, r0
beq _08041216
adds r0, r6, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08041216
Expand Down Expand Up @@ -2452,7 +2452,7 @@ sub_804143C:
cmp r0, 0xED
bne _08041476
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080414A4
Expand Down Expand Up @@ -2613,7 +2613,7 @@ sub_8041550:
lsls r0, 24
lsrs r6, r0, 24
adds r0, r7, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _0804159C
Expand Down
12 changes: 6 additions & 6 deletions asm/code_8044210.s
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ _08044592:
adds r0, r1
ldr r5, [r0]
adds r0, r5, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080446A4
Expand Down Expand Up @@ -110,7 +110,7 @@ _08044644:
adds r0, r5, 0
bl TickStatusHeal
adds r0, r5, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080446A4
Expand Down Expand Up @@ -181,7 +181,7 @@ _080446D4:
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08044760
Expand Down Expand Up @@ -273,7 +273,7 @@ _0804476A:
movs r0, 0
bl sub_8043ED0
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
_080447A0:
ldr r5, [r5, 0x4]
cmp r5, 0
Expand All @@ -295,7 +295,7 @@ _080447B8:
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080447FC
Expand All @@ -309,7 +309,7 @@ _080447B8:
adds r0, r4, 0
bl sub_8074094
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080447FC
Expand Down
8 changes: 4 additions & 4 deletions asm/code_8045A00.s
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ _0804618A:
adds r0, r2
adds r0, r1
ldr r0, [r0]
bl EntityExists
bl EntityIsValid
lsls r0, 24
adds r1, r4, 0x1
cmp r0, 0
Expand Down Expand Up @@ -597,7 +597,7 @@ _08046258:
adds r0, r2
adds r0, r1
ldr r0, [r0]
bl EntityExists
bl EntityIsValid
lsls r0, 24
adds r1, r4, 0x1
cmp r0, 0
Expand Down Expand Up @@ -659,7 +659,7 @@ sub_80462AC:
movs r0, 0
str r0, [sp, 0x4]
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
bne _080462E4
Expand Down Expand Up @@ -1792,7 +1792,7 @@ _08046BAA:
adds r4, r5
adds r4, 0x4
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08046C06
Expand Down
4 changes: 2 additions & 2 deletions asm/code_805D8C8.s
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ _080629FC:
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08062A5A
Expand Down Expand Up @@ -5467,7 +5467,7 @@ sub_806455C:
movs r3, 0
bl PrintStringOnWindow
ldr r0, [r4, 0x14]
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080645C0
Expand Down
4 changes: 2 additions & 2 deletions asm/code_805D8C8_1.s
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ _08069044:
cmp r4, 0
beq _08069072
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08069072
Expand Down Expand Up @@ -1149,7 +1149,7 @@ _080691FE:
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080691FC
Expand Down
8 changes: 4 additions & 4 deletions asm/code_8066D04.s
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ _080674BC:
bl sub_8047190
_080674D0:
adds r0, r6, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080674F8
Expand Down Expand Up @@ -1332,7 +1332,7 @@ _080678C6:
cmp r0, 0
bne _080678F6
adds r0, r5, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080678F0
Expand Down Expand Up @@ -1443,7 +1443,7 @@ _0806798E:
movs r3, 0
bl TryUseChosenMove
adds r0, r5, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080679DE
Expand All @@ -1462,7 +1462,7 @@ _080679D2:
blt _0806798E
_080679DE:
adds r0, r5, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08067A56
Expand Down
4 changes: 2 additions & 2 deletions asm/code_8072CF4.s
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ _080732FE:
adds r0, r1
ldr r0, [r0]
mov r8, r0
bl EntityExists
bl EntityIsValid
lsls r0, 24
adds r4, 0x1
str r4, [sp, 0x10]
Expand Down Expand Up @@ -236,7 +236,7 @@ _0807349E:
adds r0, r1
ldr r7, [r0]
adds r0, r7, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
adds r4, 0x1
str r4, [sp, 0x10]
Expand Down
2 changes: 1 addition & 1 deletion asm/code_8083654.s
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ _080839DA:
_08083A00:
ldr r4, [r5]
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _08083A32
Expand Down
2 changes: 1 addition & 1 deletion asm/code_808417C.s
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,7 @@ _08084632:
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _0808466E
Expand Down
2 changes: 1 addition & 1 deletion asm/code_80848F0.s
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ _0808538E:
adds r0, r1
ldr r4, [r0]
adds r0, r4, 0
bl EntityExists
bl EntityIsValid
lsls r0, 24
cmp r0, 0
beq _080853BE
Expand Down
2 changes: 1 addition & 1 deletion include/constants/status.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
#define STATUS_CHARGING 11
#define STATUS_ENRAGED 12

// ReflectClassStatus statuses
// Reflect class statuses
#define STATUS_REFLECT 1
#define STATUS_SAFEGUARD 2
#define STATUS_LIGHT_SCREEN 3
Expand Down
2 changes: 1 addition & 1 deletion include/dungeon_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

extern const DungeonPos gAdjacentTileOffsets[NUM_DIRECTIONS];

bool8 EntityExists(Entity *pokemon);
bool8 EntityIsValid(Entity *pokemon);
u32 GetEntityType(Entity *entity);
u8 GetEntityRoom(Entity *entity);
Tile *GetTileAtEntitySafe(Entity *entity);
Expand Down
2 changes: 1 addition & 1 deletion include/items.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ u8 GetItemPalette(u8 id);
u32 GetItemActionType(u8 id);
u32 GetSpawnAmountRange(u8 id, u32 r1);
u8 *GetItemDescription(u8 id);
bool8 GetItemAIFlag(u8 id, u32 r1);
bool8 TestItemAIFlag(u8 id, u32 aiFlag);
void BufferItemName(u8 *, u8 id, unkStruct_8090F58 *);
void sub_8090E14(u8 *ext_buffer, Item *slot, const unkStruct_8090F58 *);
bool8 AddItemToInventory(const Item* slot);
Expand Down
8 changes: 4 additions & 4 deletions include/structs/dungeon_entity.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
#define STAT_STAGE_EVASION 1

// size: 0x8
typedef struct unkStruct_8044CC8
typedef struct ActionParameter
{
/* 0x0 */ u8 actionUseIndex;
/* 0x4 */ DungeonPos lastItemThrowPosition;
} unkStruct_8044CC8;
/* 0x4 */ DungeonPos itemPos;
} ActionParameter;

// size: 0x18
typedef struct ActionContainer
Expand All @@ -43,7 +43,7 @@ typedef struct ActionContainer
/* 0x2 */ u8 direction;
u8 unk3;
// Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset.
/* 0x4 */ unkStruct_8044CC8 unk4[2];
/* 0x4 */ ActionParameter actionParameters[2];
// Position of the target that the Pokémon wants throw an item at.
/* 0x14 */ DungeonPos itemTargetPosition;
} ActionContainer;
Expand Down
6 changes: 3 additions & 3 deletions src/code_803E724.c
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ void sub_803EDF0(void)

if (gUnknown_202EDE8.unk0 == 0)
return;
if (!EntityExists(gUnknown_202EDE8.unk4)) {
if (!EntityIsValid(gUnknown_202EDE8.unk4)) {
gUnknown_202EDE8.unk0 = 0;
return;
}
Expand Down Expand Up @@ -935,7 +935,7 @@ void sub_803F580(u8 a0)
UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8;
Entity *cameraTarget = strPtr->cameraTarget;

if (cameraTarget != NULL && EntityExists(cameraTarget)) {
if (cameraTarget != NULL && EntityIsValid(cameraTarget)) {
s32 i;
u32 before, unk18214;
EntityInfo *info = GetEntInfo(cameraTarget);
Expand Down Expand Up @@ -1036,7 +1036,7 @@ void sub_803F580(u8 a0)
if (strPtr->cameraPos.x != strPtr->cameraPosMirror.x || strPtr->cameraPos.y != strPtr->cameraPosMirror.y) {
for (i = 0; i < DUNGEON_MAX_POKEMON; i++) {
Entity *mon = gDungeon->activePokemon[i];
if (EntityExists(mon)) {
if (EntityIsValid(mon)) {
sub_80402AC(mon->pos.x, mon->pos.y);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/code_8041AD0.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ void sub_8041888(u8 param_1)
for(index = 0; index < DUNGEON_MAX_POKEMON; index++)
{
entity = gDungeon->activePokemon[index];
if(EntityExists(entity))
if(EntityIsValid(entity))
{
entityInfo = GetEntInfo(entity);
if(param_1)
Expand All @@ -176,7 +176,7 @@ void EntityUpdateStatusSprites(Entity *entity)
u32 spriteStatus;
u8 temp;

if (EntityExists(entity)) {
if (EntityIsValid(entity)) {
entityInfo = GetEntInfo(entity);
spriteStatus = 0;
flag = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion src/code_804267C.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void sub_80427AC(void)

for (i = 0; i < 20; i++) {
entity = gDungeon->activePokemon[i];
if (EntityExists(entity)) {
if (EntityIsValid(entity)) {
enInfo = GetEntInfo(entity);
if (enInfo->unkF3) {
enInfo->unkF3 = FALSE;
Expand Down
Loading

0 comments on commit 6936e1f

Please sign in to comment.