Skip to content

Commit

Permalink
GetEntInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
mateon1 committed Oct 29, 2024
1 parent 6c1aee3 commit 2eb1cd4
Show file tree
Hide file tree
Showing 59 changed files with 596 additions and 581 deletions.
3 changes: 2 additions & 1 deletion include/globaldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
// This file gets included by each source file, just like in Chunsoft's original source, so we can have this string easily just like they did.

// Later, we can move this into "global.h" before the #ifdef guard. But we can only do this if "global.h" isn't included outside of .c files...
#include "gba/defines.h"

ALIGNED(4) static const u8 sFill[] = _("pksdir0");
ALIGNED(4) static const u8 sFill[] = _("pksdir0");
10 changes: 5 additions & 5 deletions src/code_8041AD0.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ void sub_804178C(u8 param_1)

u32 EntityGetStatusSprites(Entity *entity)
{
return entity->axObj.info->statusIcons;
return GetEntInfo(entity)->statusIcons;
}

void sub_8041888(u8 param_1)
Expand All @@ -158,7 +158,7 @@ void sub_8041888(u8 param_1)
entity = gDungeon->allPokemon[index];
if(EntityExists(entity))
{
entityInfo = entity->axObj.info;
entityInfo = GetEntInfo(entity);
if(param_1)
{
entityInfo->unk14C = 1;
Expand All @@ -177,7 +177,7 @@ void EntityUpdateStatusSprites(Entity *entity)
u8 temp;

if (EntityExists(entity)) {
entityInfo = entity->axObj.info;
entityInfo = GetEntInfo(entity);
spriteStatus = 0;
flag = TRUE;

Expand Down Expand Up @@ -501,7 +501,7 @@ void sub_8041D5C(Entity *pokemon)
if (!sub_8042768(pokemon))
return;

sub_803ED30(pokemon->axObj.info->stockpileStage, pokemon, 1, 11);
sub_803ED30(GetEntInfo(pokemon)->stockpileStage, pokemon, 1, 11);
}

void sub_8041D84(Entity *pokemon)
Expand Down Expand Up @@ -886,7 +886,7 @@ void sub_8042208(Entity *pokemon, u8 r1)

void sub_8042238(Entity *pokemon, Entity *target)
{
if(target->axObj.info->isNotTeamMember)
if(GetEntInfo(target)->isNotTeamMember)
PlaySoundEffect(0x157);
else
PlaySoundEffect(0x156);
Expand Down
2 changes: 1 addition & 1 deletion src/code_804267C.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void sub_80427AC(void)
for (i = 0; i < 20; i++) {
entity = gDungeon->allPokemon[i];
if (EntityExists(entity)) {
enInfo = entity->axObj.info;
enInfo = GetEntInfo(entity);
if (enInfo->unkF3) {
enInfo->unkF3 = FALSE;
sub_80429A0(entity);
Expand Down
14 changes: 7 additions & 7 deletions src/code_8044CC8.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ Item * sub_8044CC8(Entity *param_1, unkStruct_8044CC8 *param_2)
}
else {
if (param_2->actionUseIndex == 0x81) {
info = param_1->axObj.info;
info = GetEntInfo(param_1);
}
else {
if (3 < (u8)(param_2->actionUseIndex + 0x70)) {
return NULL;
}
info = gDungeon->teamPokemon[param_2->actionUseIndex - 0x90]->axObj.info;
info = GetEntInfo(gDungeon->teamPokemon[param_2->actionUseIndex - 0x90]);
}
item = &info->heldItem;
}
Expand Down Expand Up @@ -77,14 +77,14 @@ bool8 sub_8044D40(ActionContainer *param_1,s32 index)
}

Item *sub_8044D90(Entity *entity, s32 index, s32 unused) {
EntityInfo *info = entity->axObj.info;
EntityInfo *info = GetEntInfo(entity);
register unkStruct_8044CC8 *puVar1 asm("r3") = &info->action.unk4[index];
return sub_8044CC8(entity, puVar1);
}

Entity *sub_8044DA4(Entity *entity, s32 index)
{
EntityInfo *info = entity->axObj.info;
EntityInfo *info = GetEntInfo(entity);
return gDungeon->teamPokemon[info->action.unk4[index].actionUseIndex];
}

Expand All @@ -103,7 +103,7 @@ void sub_8044DF0(Entity *entity, s32 index, u32 unused)
Item *item;
EntityInfo *info;

info = entity->axObj.info;
info = GetEntInfo(entity);
item = sub_8044D90(entity,index,unused);
if ((info->action).unk4[0].actionUseIndex == 0x80) {
sub_80461C8(&(info->action).unk4[0].lastItemThrowPosition,1);
Expand All @@ -125,7 +125,7 @@ void sub_8044E24(Entity *entity,int index,u32 unused)
Item item;

itemPtr = sub_8044D90(entity,index,unused);
info = entity->axObj.info;
info = GetEntInfo(entity);
if (!IsHMItem(itemPtr->id)) {
if (GetItemCategory(itemPtr->id) == CATEGORY_TMS_HMS) {
if (info->action.unk4[index].actionUseIndex == 0x80) {
Expand Down Expand Up @@ -231,7 +231,7 @@ bool8 IsNotAttacking(Entity *param_1, bool8 param_2)
EntityInfo *info;
u16 *action;

info = param_1->axObj.info;
info = GetEntInfo(param_1);
action = &(info->action).action;
if ((param_2 == 0) || (sub_8045888(param_1)))
{
Expand Down
2 changes: 1 addition & 1 deletion src/code_8045A00.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void SetMessageArgument(char buffer[], Entity *entity, u32 param_3)
switch(GetEntityType(entity))
{
case ENTITY_MONSTER:
SetMessageArgument_2(buffer, entity->axObj.info, param_3);
SetMessageArgument_2(buffer, GetEntInfo(entity), param_3);
break;
case ENTITY_ITEM:
sub_8045BF8(buffer, GetItemData_1(entity));
Expand Down
38 changes: 19 additions & 19 deletions src/code_8048480.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ bool8 sub_8047930(Entity *pokemon, Entity *target)
{
bool8 flag;

if (((target->axObj.info->shopkeeper == TRUE) ||
(target->axObj.info->clientType == CLIENT_TYPE_DONT_MOVE)) || (target->axObj.info->clientType == CLIENT_TYPE_CLIENT)) {
if (((GetEntInfo(target)->shopkeeper == TRUE) ||
(GetEntInfo(target)->clientType == CLIENT_TYPE_DONT_MOVE)) || (GetEntInfo(target)->clientType == CLIENT_TYPE_CLIENT)) {
return FALSE;
}
else {
Expand Down Expand Up @@ -202,7 +202,7 @@ void sub_80479B8(char param_1, char param_2, u8 param_3, Entity *pokemon, Entity
if (param_1 != '\0') {
if (param_2 == '\0') {
flag = FALSE;
info = target->axObj.info;
info = GetEntInfo(target);
if (info->isNotTeamMember) {
if ((GetItemCategory(item->id) != CATEGORY_THROWN_LINE) && (GetItemCategory(item->id) != CATEGORY_BERRIES_SEEDS_VITAMINS)) {
flag = GetItemCategory(item->id) == CATEGORY_THROWN_ARC ? FALSE : TRUE;
Expand Down Expand Up @@ -540,7 +540,7 @@ void EyedropSeedItemAction(Entity *pokemon, Entity *target)

void CheriBerryItemAction(Entity *pokemon, Entity *target)
{
if(target->axObj.info->nonVolatile.nonVolatileStatus == STATUS_PARALYSIS)
if(GetEntInfo(target)->nonVolatile.nonVolatileStatus == STATUS_PARALYSIS)
SendNonVolatileEndMessage(pokemon, target);
else
// Pointer to "But nothing happened!"
Expand All @@ -549,7 +549,7 @@ void CheriBerryItemAction(Entity *pokemon, Entity *target)

void PechaBerryItemAction(Entity *pokemon, Entity *target)
{
if((u8)(target->axObj.info->nonVolatile.nonVolatileStatus - 2) <= 1)
if((u8)(GetEntInfo(target)->nonVolatile.nonVolatileStatus - 2) <= 1)
SendNonVolatileEndMessage(pokemon, target);
else
// Pointer to "But nothing happened!"
Expand Down Expand Up @@ -594,7 +594,7 @@ void DoomSeedItemAction(Entity *pokemon, Entity *target)

void RawstBerryItemAction(Entity *pokemon, Entity *target)
{
if(target->axObj.info->nonVolatile.nonVolatileStatus == STATUS_BURN)
if(GetEntInfo(target)->nonVolatile.nonVolatileStatus == STATUS_BURN)
SendNonVolatileEndMessage(pokemon, target);
else
{
Expand All @@ -606,12 +606,12 @@ void RawstBerryItemAction(Entity *pokemon, Entity *target)

void HungerSeedItemAction(Entity *pokemon, Entity * target)
{
EntityInfo *entityInfo = target->axObj.info;
if (target->axObj.info->isTeamLeader)
EntityInfo *entityInfo = GetEntInfo(target);
if (GetEntInfo(target)->isTeamLeader)
sub_8078A58(pokemon, target, 0, 5);
else
{
entityInfo = target->axObj.info;
entityInfo = GetEntInfo(target);
SetMessageArgument(gAvailablePokemonNames, target, 0);
if (IQSkillIsEnabled(target, IQ_SELF_CURER))
TryDisplayDungeonLoggableMessage3(pokemon, target, *gPtrSelfHealPreventedHungerMessage);
Expand Down Expand Up @@ -645,7 +645,7 @@ void GinsengItemAction(Entity *pokemon, Entity * target)

isMoveBoosted = FALSE;
moveBoost = 1;
entityInfo = target->axObj.info;
entityInfo = GetEntInfo(target);
if (DungeonRandInt(100) < gUnknown_80F4F46)
moveBoost = 3;
if (entityInfo->isTeamLeader) {
Expand Down Expand Up @@ -687,7 +687,7 @@ void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3)
u8 auStack28 [4];

if (param_3 != 0) {
entityInfo = target->axObj.info;
entityInfo = GetEntInfo(target);
entityInfo_1 = entityInfo;
if (gDungeon->unk675 != 0) {
uVar1 = gUnknown_80F4FA8;
Expand All @@ -711,7 +711,7 @@ void BlastSeedItemAction(Entity *pokemon, Entity * target, u8 param_3)
}
else
{
entityInfo = entity->axObj.info;
entityInfo = GetEntInfo(entity);
if (gDungeon->unk675 != 0) {
uVar1 = gUnknown_80F4FAA;
TryDisplayDungeonLoggableMessage3(pokemon, target, *gUnknown_80FEAE8);
Expand Down Expand Up @@ -742,7 +742,7 @@ void HandleGummiItemAction(Entity *pokemon, Entity *target, u8 gummiIndex)
s32 iVar5;
s32 currIQ;

targetInfo = target->axObj.info;
targetInfo = GetEntInfo(target);
gummiBoost = gTypeGummiIQBoost[targetInfo->types[0]][gummiIndex];
gummiBoost += gTypeGummiIQBoost[targetInfo->types[1]][gummiIndex];
sub_8078B5C(pokemon,target,
Expand Down Expand Up @@ -829,7 +829,7 @@ bool8 sub_8048950(Entity *param_1,Item *item)
{
entity = gDungeon->teamPokemon[index];
if (EntityExists(entity)) {
entityInfo = entity->axObj.info;
entityInfo = GetEntInfo(entity);
flag = CanMonLearnMove(moveID, entityInfo->id);
if (CheckVariousStatuses2(entity, FALSE)) {
flag = FALSE;
Expand Down Expand Up @@ -882,7 +882,7 @@ bool8 sub_8048A68(Entity *param_1,Item *item)
{
entity = gDungeon->teamPokemon[index];
if (EntityExists(entity)) {
pEVar6 = entity->axObj.info;
pEVar6 = GetEntInfo(entity);
flag = TRUE;
if(((MAX_TEAM_MEMBERS - 1) < pEVar6->teamIndex))
flag = FALSE;
Expand Down Expand Up @@ -940,7 +940,7 @@ bool32 sub_8048B9C(Entity *entity,Item *param_2)
u16 action;

bVar2 = FALSE;
entityInfo = entity->axObj.info;
entityInfo = GetEntInfo(entity);
actionPointer = &(entityInfo->action);
if ((param_2->flags & ITEM_FLAG_STICKY)) {
DisplayDungeonMessage(0,*gItemStickyDoesntWorkText,1);
Expand All @@ -952,7 +952,7 @@ bool32 sub_8048B9C(Entity *entity,Item *param_2)
{
entity1 = gDungeon->teamPokemon[index];
if (EntityExists(entity1)) {
entity1Info = entity1->axObj.info;
entity1Info = GetEntInfo(entity1);
flag = TRUE;
if(CheckVariousStatuses2(entity1, FALSE))
{
Expand All @@ -976,7 +976,7 @@ bool32 sub_8048B9C(Entity *entity,Item *param_2)
else
{
while( TRUE ) {
entityInfo = entity2->axObj.info;
entityInfo = GetEntInfo(entity2);
actionContainer = *actionPointer;
goto _clear;
_load:
Expand Down Expand Up @@ -1032,7 +1032,7 @@ bool8 sub_8048D50(Entity * pokemon, Item *item)
{
EntityInfo *entityInfo;

entityInfo = pokemon->axObj.info;
entityInfo = GetEntInfo(pokemon);

if ((item->flags & ITEM_FLAG_STICKY) != 0) {
sub_8045BF8(gFormatItems, item);
Expand Down
2 changes: 1 addition & 1 deletion src/code_805D8C8.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void sub_8068768(void)
entity = gDungeon->allPokemon[i];

if (entity != NULL && EntityExists(entity))
LoadPokemonSprite(entity->axObj.info->apparentID, FALSE);
LoadPokemonSprite(GetEntInfo(entity)->apparentID, FALSE);
}
}

Expand Down
Loading

0 comments on commit 2eb1cd4

Please sign in to comment.