Replace EntTrapInfo with Trap

This commit is contained in:
Kermalis 2024-11-10 22:51:33 -05:00
parent afa4b04abc
commit 0df055bcc6
13 changed files with 41 additions and 41 deletions

View File

@ -3,7 +3,7 @@
#include "structs/dungeon_entity.h"
Entity *sub_8045684(u8 a, Position *pos, u8 c);
Entity *sub_8045684(u8 trapID, Position *pos, u8 c);
Entity *sub_8045708(Position *pos);
void sub_80457DC(Entity* ent);

View File

@ -11,13 +11,18 @@ extern const Position gAdjacentTileOffsets[NUM_DIRECTIONS];
bool8 EntityExists(Entity *pokemon);
u32 GetEntityType(Entity *entity);
u8 GetEntityRoom(Entity *entity);
Trap *GetTrapData(Entity *entity);
Trap* GetTrapData_1(Entity *entity);
Item *GetItemData(Entity *entity);
struct Tile *GetTileAtEntitySafe(Entity *entity);
Item *GetItemData_1(Entity *entity);
void sub_804535C(Entity *entity, Position32 *pos);
void SetEntityPixelPos(Entity *entity, s32 x, s32 y);
void IncreaseEntityPixelPos(Entity *entity, s32 x, s32 y);
#endif
static inline EntityInfo *GetEntInfo(Entity *entity)
{
return entity->axObj.info.monster;
}
Item *GetItemData(Entity *entity);
Item *GetItemData_1(Entity *entity);
Trap *GetTrapData(Entity *entity);
Trap* GetTrapData_1(Entity *entity);
#endif // GUARD_DUNGEON_UTIL_H

View File

@ -88,7 +88,7 @@ struct axObject
{
struct Item* item;
struct EntityInfo* monster;
struct EntTrapInfo* trap;
struct Trap* trap;
} info;
};

View File

@ -352,13 +352,6 @@ typedef struct EntityInfo
u8 unk204;
} EntityInfo;
// size: 0x4
typedef struct EntTrapInfo
{
/* 0x0 */ u8 unk0;
/* 0x0 */ u8 unk1;
} EntTrapInfo;
// size: 0x74 | Used for Pokémon, items, and traps.
typedef struct Entity
{
@ -477,9 +470,4 @@ static inline void SetExpMultplier(EntityInfo *info)
SetRegularExpMultiplier(info);
}
static inline EntityInfo *GetEntInfo(Entity *ent)
{
return ent->axObj.info.monster;
}
#endif

View File

@ -7,6 +7,7 @@
#include "structs/map.h"
#include "structs/rgb.h"
#include "structs/str_position.h"
#include "structs/str_traps.h"
#include "sprite.h"
#define DUNGEON_MAX_SIZE_X 56
@ -356,7 +357,7 @@ typedef struct Dungeon
/* 0x3800 */ s16 deoxysForm;
Item unk3804[DUNGEON_MAX_ITEMS];
/* 0x3904 */ s16 unk3904;
EntTrapInfo unk3908[DUNGEON_MAX_TRAPS];
Trap unk3908[DUNGEON_MAX_TRAPS];
/* 0x3A08 */ bool8 unk3A08;
/* 0x3A09 */ bool8 unk3A09;
/* 0x3A0A */ bool8 unk3A0A;

View File

@ -3,10 +3,11 @@
#include "constants/trap.h"
typedef struct Trap
// size: 0x4
typedef struct Trap
{
/* 0x0 */ u8 id;
/* 0x1 */ u8 unk1;
} Trap;
#endif // GUARD_STR_TRAPS_H
#endif // GUARD_STR_TRAPS_H

View File

@ -849,9 +849,9 @@ void sub_803F27C(bool8 a0)
strPtr->blinded = 0;
strPtr->hallucinating = 0;
strPtr->unk1820F = 0;
strPtr->unk1820D = 0;
strPtr->unk1820D = FALSE;
strPtr->unk18211 = 0;
strPtr->unk1820E = 0;
strPtr->unk1820E = FALSE;
strPtr->unk1820B = 0;
strPtr->unk1820C = 0;
}
@ -979,8 +979,8 @@ void sub_803F580(u8 a0)
strPtr->cameraPixelPos.y = (cameraTarget->pixelPos.y / 256) - 96;
if (HasHeldItem(cameraTarget, ITEM_X_RAY_SPECS) && info->isTeamLeader) {
strPtr->unk1820D = 1;
strPtr->unk1820E = 1;
strPtr->unk1820D = TRUE;
strPtr->unk1820E = TRUE;
}
else {
strPtr->unk1820D = info->powerEars;
@ -1112,8 +1112,8 @@ void sub_803F878(s32 a0, s32 a1)
strPtr->cameraPixelPos.y = (a1 / 256) - 96;
strPtr->cameraPos.x = a0 / 6144;
strPtr->cameraPos.y = a1 / 6144;
strPtr->unk1820D = 0;
strPtr->unk1820E = 0;
strPtr->unk1820D = FALSE;
strPtr->unk1820E = FALSE;
strPtr->unk18211 = 0;
strPtr->unk18216 = 0;

View File

@ -391,7 +391,7 @@ Entity *sub_804550C(s16 a)
);
}
Entity *sub_8045684(u8 a, Position *pos, u8 c)
Entity *sub_8045684(u8 trapID, Position *pos, u8 c)
{
Entity *entity;
s32 i;
@ -401,7 +401,7 @@ Entity *sub_8045684(u8 a, Position *pos, u8 c)
if (!EntityExists(entity)) {
entity->type = ENTITY_TRAP;
entity->axObj.info.trap = &gDungeon->unk3908[i];
entity->axObj.info.trap->unk0 = a;
entity->axObj.info.trap->id = trapID;
entity->axObj.info.trap->unk1 = c;
entity->unk1C = 0;
@ -457,19 +457,19 @@ bool8 sub_8045804(Entity *ent)
{
UnkDungeonGlobal_unk181E8_sub* saveTyping;
Entity* camTarget;
EntityInfo *entInfo;
EntityInfo *monInfo;
switch (GetEntityType(ent)) {
case ENTITY_MONSTER: {
if (ent->isVisible) {
saveTyping = &gDungeon->unk181e8;
camTarget = saveTyping->cameraTarget;
entInfo = GetEntInfo(ent);
monInfo = GetEntInfo(ent);
if (!entInfo->isNotTeamMember)
if (!monInfo->isNotTeamMember)
return TRUE;
if (!saveTyping->unk1820F && entInfo->transformStatus.transformStatus == STATUS_INVISIBLE)
if (!saveTyping->unk1820F && monInfo->transformStatus.transformStatus == STATUS_INVISIBLE)
return FALSE;
if (saveTyping->unk1820B || saveTyping->unk1820D)
@ -480,6 +480,9 @@ bool8 sub_8045804(Entity *ent)
}
return FALSE;
}
/*case ENTITY_TRAP:
case ENTITY_ITEM:
case ENTITY_UNK_4:*/
default: {
return TRUE;
}

View File

@ -21,6 +21,7 @@
#include "code_8045A00.h"
#include "dungeon_items.h"
#include "structs/str_damage.h"
#include "dungeon_util.h"
void sub_8042940(Entity *r0);
void sub_80428B0(Entity *r0);

View File

@ -2,9 +2,10 @@
#include "code_805D8C8.h"
#include "code_806CD90.h"
#include "dungeon_map_access.h"
#include "dungeon_message.h"
#include "dungeon_movement.h"
#include "dungeon_random.h"
#include "dungeon_message.h"
#include "dungeon_util.h"
#include "moves.h"
#include "pokemon_mid.h"
#include "pokemon_mid.h"
@ -13,7 +14,6 @@
#include "structs/map.h"
#include "structs/str_pokemon.h"
extern Position gAdjacentTileOffsets[];
extern u8 *gUnknown_80FE2EC[];
struct unkStruct_806B7F8

View File

@ -5,6 +5,7 @@
#include "code_803E668.h"
#include "code_806CD90.h"
#include "dungeon_music.h"
#include "dungeon_util.h"
extern const unkStruct_2039DB0 gUnknown_8107380;

View File

@ -47,22 +47,22 @@ u8 GetEntityRoom(Entity *entity)
Trap* GetTrapData(Entity *entity)
{
return (Trap *) GetEntInfo(entity);
return entity->axObj.info.trap;
}
Item* GetItemData(Entity *entity)
{
return (Item *) GetEntInfo(entity);
return entity->axObj.info.item;
}
Trap* GetTrapData_1(Entity *entity)
{
return (Trap *) GetEntInfo(entity);
return entity->axObj.info.trap;
}
Item* GetItemData_1(Entity *entity)
{
return (Item*) GetEntInfo(entity);
return entity->axObj.info.item;
}
Tile *GetTileAtEntity(Entity *entity)

View File

@ -1,6 +1,6 @@
#include "global.h"
#include "status_checks.h"
#include "dungeon_util.h"
#include "charge_move.h"
#include "code_8045A00.h"
#include "dungeon_message.h"