From 8ba2124f1e7b986f6f2dc269a7b50b1db1a3af33 Mon Sep 17 00:00:00 2001 From: Mateon1 Date: Tue, 12 Nov 2024 16:08:43 +0100 Subject: [PATCH] Rename Positions --- include/code_800DAC0.h | 4 +- include/code_800F958.h | 2 +- include/code_803E724.h | 2 +- include/code_80450F8.h | 4 +- include/code_8069D4C.h | 2 +- include/code_807CD9C.h | 2 +- include/dungeon_ai_items.h | 2 +- include/dungeon_cutscenes.h | 6 +-- include/dungeon_map_access.h | 4 +- include/dungeon_message.h | 2 +- include/dungeon_movement.h | 10 ++-- include/dungeon_pokemon_sprites.h | 4 +- include/dungeon_range.h | 6 +-- include/dungeon_util.h | 6 +-- include/dungeon_util_1.h | 2 +- include/dungeon_visibility.h | 4 +- include/ground_script.h | 16 +++---- include/position_util.h | 4 +- include/sprite.h | 2 +- include/string_format.h | 2 +- include/structs/axdata.h | 10 ++-- include/structs/dungeon_entity.h | 26 +++++----- include/structs/map.h | 2 +- include/structs/menu.h | 6 +-- include/structs/str_dungeon.h | 18 +++---- include/structs/str_position.h | 10 ++-- include/tile_types.h | 2 +- include/trap.h | 14 +++--- src/code_800558C.c | 18 +++---- src/code_800F958.c | 10 ++-- src/code_803E46C.c | 2 +- src/code_803E724.c | 2 +- src/code_8041AD0.c | 12 ++--- src/code_804267C.c | 12 ++--- src/code_8042B34.c | 13 ++--- src/code_8044CC8.c | 6 +-- src/code_80450F8.c | 4 +- src/code_8045A00.c | 4 +- src/code_8048480.c | 2 +- src/code_805D8C8_1.c | 21 ++++---- src/code_8066D04.c | 4 +- src/code_8069D4C.c | 2 +- src/code_806CD90.c | 4 +- src/code_80718D8.c | 4 +- src/code_8072B78.c | 2 +- src/code_8073CF0.c | 14 +++--- src/code_8075708.c | 2 +- src/code_807CD9C.c | 21 ++++---- src/code_807E1A0.c | 6 +-- src/code_8085E98.c | 5 +- src/code_80861A8.c | 4 +- src/code_80869E4.c | 8 ++-- src/dungeon_ai_attack.c | 2 +- src/dungeon_ai_items.c | 10 ++-- src/dungeon_ai_leader.c | 8 ++-- src/dungeon_ai_movement.c | 6 +-- src/dungeon_ai_targeting.c | 2 +- src/dungeon_cutscenes.c | 46 +++++++++--------- src/dungeon_items.c | 2 +- src/dungeon_map_access.c | 8 ++-- src/dungeon_message.c | 5 +- src/dungeon_move.c | 32 ++++++------- src/dungeon_movement.c | 10 ++-- src/dungeon_range.c | 8 ++-- src/dungeon_serializer.c | 22 ++++----- src/dungeon_util.c | 4 +- src/dungeon_util_1.c | 2 +- src/dungeon_visibility.c | 4 +- src/ground_script_1.c | 79 ++++++++++++++++--------------- src/menu_input.c | 6 +-- src/move_actions.c | 24 +++++----- src/position_util.c | 4 +- src/sprite.c | 4 +- src/status_actions.c | 20 ++++---- src/string_format.c | 6 +-- src/tile_types.c | 12 ++--- src/trap.c | 23 ++++----- src/trap_1.c | 4 +- tmp/fixpoint.cocci | 17 ------- tmp/position.cocci | 17 +++++++ tmp/renames.sed | 26 ---------- 81 files changed, 377 insertions(+), 392 deletions(-) delete mode 100644 tmp/fixpoint.cocci create mode 100644 tmp/position.cocci delete mode 100644 tmp/renames.sed diff --git a/include/code_800DAC0.h b/include/code_800DAC0.h index 9ad99d82e..efe6a6844 100644 --- a/include/code_800DAC0.h +++ b/include/code_800DAC0.h @@ -25,7 +25,7 @@ bool8 sub_800E9A8(s32); void sub_800DAC0(u32); void sub_800DB7C(void); void sub_800DBBC(void); -void sub_800E90C(Position *); -void sub_800E8AC(s32 a0, void *a1, void *a2, s32 a3, void *a4); // a2 could be Position +void sub_800E90C(DungeonPos *); +void sub_800E8AC(s32 a0, void *a1, void *a2, s32 a3, void *a4); // a2 could be DungeonPos #endif // GUARD_CODE_800DAC0_H diff --git a/include/code_800F958.h b/include/code_800F958.h index 884e9a7f9..112b73916 100644 --- a/include/code_800F958.h +++ b/include/code_800F958.h @@ -3,6 +3,6 @@ #include "structs/str_position.h" -void AddPokemonDungeonSprite(s32 id, s16 species, Position *pos, u32); +void AddPokemonDungeonSprite(s32 id, s16 species, DungeonPos *pos, u32); #endif // GUARD_CODE_800F958_H \ No newline at end of file diff --git a/include/code_803E724.h b/include/code_803E724.h index a72345f17..026600408 100644 --- a/include/code_803E724.h +++ b/include/code_803E724.h @@ -3,6 +3,6 @@ #include "structs/str_position.h" -bool8 sub_803F428(Position *pos); +bool8 sub_803F428(DungeonPos *pos); #endif // GUARD_CODE_803E724_H \ No newline at end of file diff --git a/include/code_80450F8.h b/include/code_80450F8.h index 82374dd0c..f86f4a608 100644 --- a/include/code_80450F8.h +++ b/include/code_80450F8.h @@ -3,8 +3,8 @@ #include "structs/dungeon_entity.h" -Entity *sub_8045684(u8 trapID, Position *pos, u8 c); -Entity *sub_8045708(Position *pos); +Entity *sub_8045684(u8 trapID, DungeonPos *pos, u8 c); +Entity *sub_8045708(DungeonPos *pos); void sub_80457DC(Entity* ent); #endif // GUARD_CODE_80227B8_H \ No newline at end of file diff --git a/include/code_8069D4C.h b/include/code_8069D4C.h index 6e4ab6f9a..1a174e7e6 100644 --- a/include/code_8069D4C.h +++ b/include/code_8069D4C.h @@ -14,7 +14,7 @@ struct unkStruct_8069D4C_sub struct unkStruct_8069D4C { s16 id; - Position pos; + DungeonPos pos; s16 HP; struct unkStruct_8069D4C_sub offense; u16 level; diff --git a/include/code_807CD9C.h b/include/code_807CD9C.h index 0f3c8dafc..e61d18766 100644 --- a/include/code_807CD9C.h +++ b/include/code_807CD9C.h @@ -2,7 +2,7 @@ #define CODE_807CD9C_H void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction); -void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, Position *pos); +void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, DungeonPos *pos); void sub_807D3CC(Entity *param_1); #endif /* ifndef CODE_807CD9C_H */ diff --git a/include/dungeon_ai_items.h b/include/dungeon_ai_items.h index 05d909cef..960b33009 100644 --- a/include/dungeon_ai_items.h +++ b/include/dungeon_ai_items.h @@ -6,7 +6,7 @@ void AIDecideUseItem(Entity *pokemon); void GetPossibleAIThrownItemDirections(Entity *pokemon, s32 thrownAIFlag, Item *item, bool8 ignoreRollChance); -void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, Position potentialTargets[], bool8 ignoreRollChance); +void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, DungeonPos potentialTargets[], bool8 ignoreRollChance); void TargetThrownItem(Entity *pokemon, Entity *targetPokemon, Item *item, s32 targetingFlags, bool8 ignoreRollChance); #endif diff --git a/include/dungeon_cutscenes.h b/include/dungeon_cutscenes.h index 1e8c4240a..8a190c10c 100644 --- a/include/dungeon_cutscenes.h +++ b/include/dungeon_cutscenes.h @@ -114,9 +114,9 @@ void sub_808AC3C(void); void sub_808ACC0(void); void sub_808AD48(void); void sub_808ADCC(void); -void sub_808AE54(u8, u8, Position *pos); -void sub_808AEC8(u8, u8, Position *pos); -void sub_808AF3C(u8, u8, Position *pos); +void sub_808AE54(u8, u8, DungeonPos *pos); +void sub_808AEC8(u8, u8, DungeonPos *pos); +void sub_808AF3C(u8, u8, DungeonPos *pos); void sub_808AFB0(u8); void sub_808B030(u8); void sub_808B0B0(u8); diff --git a/include/dungeon_map_access.h b/include/dungeon_map_access.h index d95b12019..adee8dc5b 100644 --- a/include/dungeon_map_access.h +++ b/include/dungeon_map_access.h @@ -12,6 +12,6 @@ Tile *GetTile(s32 x, s32 y); Tile *GetTileSafe(s32 x, s32 y); void sub_8049ED4(void); -void sub_804AC20(Position *pos); +void sub_804AC20(DungeonPos *pos); -#endif // GUARD_DUNGEON_MAP_ACCESS_H \ No newline at end of file +#endif // GUARD_DUNGEON_MAP_ACCESS_H diff --git a/include/dungeon_message.h b/include/dungeon_message.h index 693673b27..f8122c2c7 100644 --- a/include/dungeon_message.h +++ b/include/dungeon_message.h @@ -28,7 +28,7 @@ void LogMessageByIdWithPopupCheckUser(Entity *pokemon, const u8 *str); void TryDisplayDungeonLoggableMessage2(Entity *pokemon, const u8 *str); void TryDisplayDungeonLoggableMessage3(Entity *attacker, Entity *target, const u8 *str); void TryDisplayDungeonLoggableMessage4(Entity *attacker, Entity *target, const u8 *str); -void TryDisplayDungeonLoggableMessage5(Entity *pokemon, Position *pos, const u8 *str); +void TryDisplayDungeonLoggableMessage5(Entity *pokemon, DungeonPos *pos, const u8 *str); // As opposed to the above - these always display the string and save it in the message log. False/True stand for an unknown argument. Not sure what the practical difference is between these. void DisplayDungeonLoggableMessage(Entity *pokemon, const u8 *str); diff --git a/include/dungeon_movement.h b/include/dungeon_movement.h index be363c333..1549f1aa6 100644 --- a/include/dungeon_movement.h +++ b/include/dungeon_movement.h @@ -8,12 +8,12 @@ extern u8 gWalkableTileToCrossableTerrain[8]; u8 GetCrossableTerrain(s16 species); u8 sub_807034C(s16 id, struct Tile *tile); -u8 sub_80703A0(Entity *pokemon, Position *pos); +u8 sub_80703A0(Entity *pokemon, DungeonPos *pos); bool8 CanCrossWalls(Entity *pokemon); -bool8 sub_807049C(Entity *pokemon, Position *pos); -bool8 sub_8070564(Entity *pokemon, Position *pos); -bool8 sub_80705F0(Entity *pokemon, Position *pos); -bool8 sub_80706A4(Entity *pokemon, Position *pos); +bool8 sub_807049C(Entity *pokemon, DungeonPos *pos); +bool8 sub_8070564(Entity *pokemon, DungeonPos *pos); +bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos); +bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos); s32 CalcSpeedStage(Entity *pokemon); #endif diff --git a/include/dungeon_pokemon_sprites.h b/include/dungeon_pokemon_sprites.h index 781c8af1b..b013ba9ab 100644 --- a/include/dungeon_pokemon_sprites.h +++ b/include/dungeon_pokemon_sprites.h @@ -20,8 +20,8 @@ typedef struct DungeonPokemonSprite /* 0xC */ u32 status; /* 0x10 */ u8 visible; /* 0x11 */ u8 unk11; - /* 0x14 */ Position pos; - /* 0x18 */ Position statusOffsets[2]; + /* 0x14 */ DungeonPos pos; + /* 0x18 */ DungeonPos statusOffsets[2]; /* 0x20 */ u32 unk20; /* 0x24 */ u32 unk24; /* 0x28 */ DungeonPokemonStatusSprite statusSprites[2]; diff --git a/include/dungeon_range.h b/include/dungeon_range.h index 905163fb5..9659a29a2 100644 --- a/include/dungeon_range.h +++ b/include/dungeon_range.h @@ -3,8 +3,8 @@ #include "structs/str_position.h" -bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2); -bool8 IsPositionInSight(Position *pos1, Position *pos2); -bool8 IsTargetTwoTilesAway(Position *pos1, Position *pos2); +bool8 IsPositionActuallyInSight(DungeonPos *pos1, DungeonPos *pos2); +bool8 IsPositionInSight(DungeonPos *pos1, DungeonPos *pos2); +bool8 IsTargetTwoTilesAway(DungeonPos *pos1, DungeonPos *pos2); #endif diff --git a/include/dungeon_util.h b/include/dungeon_util.h index e2b1d27e2..5ecd4b111 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -6,13 +6,13 @@ #include "structs/str_position.h" #include "structs/str_traps.h" -extern const Position gAdjacentTileOffsets[NUM_DIRECTIONS]; +extern const DungeonPos gAdjacentTileOffsets[NUM_DIRECTIONS]; bool8 EntityExists(Entity *pokemon); u32 GetEntityType(Entity *entity); u8 GetEntityRoom(Entity *entity); struct Tile *GetTileAtEntitySafe(Entity *entity); -void sub_804535C(Entity *entity, Position32 *pos); +void sub_804535C(Entity *entity, PixelPos *pos); void SetEntityPixelPos(Entity *entity, s32 x, s32 y); void IncreaseEntityPixelPos(Entity *entity, s32 x, s32 y); @@ -25,4 +25,4 @@ Item *GetItemData_1(Entity *entity); Trap *GetTrapData(Entity *entity); Trap* GetTrapData_1(Entity *entity); -#endif // GUARD_DUNGEON_UTIL_H \ No newline at end of file +#endif // GUARD_DUNGEON_UTIL_H diff --git a/include/dungeon_util_1.h b/include/dungeon_util_1.h index 943647813..1923354fc 100644 --- a/include/dungeon_util_1.h +++ b/include/dungeon_util_1.h @@ -22,7 +22,7 @@ void sub_80856E0(Entity * pokemon, s32 direction); void sub_8085764(void); void sub_8085860(s32 x, s32 y); void sub_8085890(s32 x, s32 y); -void ShiftCameraToPosition(Position32 *posStruct, s32 cameraSteps); +void ShiftCameraToPosition(PixelPos *posStruct, s32 cameraSteps); void SetFacingDirection(Entity *pokemon, s32 direction); void sub_8085930(s32 direction); void sub_80859F0(s32 direction); diff --git a/include/dungeon_visibility.h b/include/dungeon_visibility.h index 935735e6f..0485e2080 100644 --- a/include/dungeon_visibility.h +++ b/include/dungeon_visibility.h @@ -6,7 +6,7 @@ bool8 CanSeeTarget(Entity *entity, Entity *targetEntity); bool8 CanTargetEntity(Entity *entity, Entity *targetEntity); bool8 sub_8045A70(Entity *entity, Entity *targetEntity); -bool8 sub_8045AAC(Entity *entity, Position *pos); -bool8 CanTargetPosition(Entity *entity, Position *pos); +bool8 sub_8045AAC(Entity *entity, DungeonPos *pos); +bool8 CanTargetPosition(Entity *entity, DungeonPos *pos); #endif diff --git a/include/ground_script.h b/include/ground_script.h index f9e66fd9d..50fb4d18d 100644 --- a/include/ground_script.h +++ b/include/ground_script.h @@ -57,8 +57,8 @@ typedef struct ScriptData /* 0x2C */ u16 unk2C; // padding /* 0x30 */ s32 unk30; - /* 0x34 */ Position32 pos1; - /* 0x3C */ Position32 pos2; + /* 0x34 */ PixelPos pos1; + /* 0x3C */ PixelPos pos2; /* 0x44 */ u8 unk44[4]; /* 0x48 */ s32 unk48; /* 0x4C */ u8 unk4C; @@ -78,14 +78,14 @@ typedef struct CallbackData // padding // All callbacks take the parentObject as first parameter /* 0x04 */ s16 (*getIndex)(void*); // id related - /* 0x08 */ void (*getSize)(void*, Position32 *out); - /* 0x0C */ void (*getHitboxCenter)(void*, Position32 *out); + /* 0x08 */ void (*getSize)(void*, PixelPos *out); + /* 0x0C */ void (*getHitboxCenter)(void*, PixelPos *out); /* 0x10 */ void (*getPosHeightAndUnk)(void*, u32 *height, u32 *unk); /* 0x14 */ void (*getDirection)(void*, s8 *dir); /* 0x18 */ void (*getFlags)(void*, u32 *flags); - /* 0x1C */ void (*setHitboxPos)(void*, Position32 *posOrNull); - /* 0x20 */ void (*setPositionBounds)(void*, Position32 *from, Position32 *to); - /* 0x24 */ bool8 (*moveReal)(void*, Position32*); + /* 0x1C */ void (*setHitboxPos)(void*, PixelPos *posOrNull); + /* 0x20 */ void (*setPositionBounds)(void*, PixelPos *from, PixelPos *to); + /* 0x24 */ bool8 (*moveReal)(void*, PixelPos*); /* 0x28 */ void (*setPosHeight)(void*, u32 height); /* 0x2C */ void (*setDirection)(void*, s8 dir); // direction must be signed char! /* 0x30 */ void (*setEventIndex)(void*, u16); @@ -94,7 +94,7 @@ typedef struct CallbackData /* 0x3C */ void (*setFlags)(void*, u32 bits); /* 0x40 */ void (*clearFlags)(void*, u32 bits); /* 0x44 */ void (*func44_livesOnlySpriteRelated)(void*, u32); - /* 0x48 */ void (*moveRelative)(void*, Position32*); + /* 0x48 */ void (*moveRelative)(void*, PixelPos*); /* 0x4C */ bool8 (*func4C_spriteRelatedCheck)(void*); /* 0x50 */ bool8 (*func50_spriteRelated)(void*); } CallbackData; diff --git a/include/position_util.h b/include/position_util.h index 03d5f9e29..d38e161f1 100644 --- a/include/position_util.h +++ b/include/position_util.h @@ -3,7 +3,7 @@ #include "structs/str_position.h" -s32 GetDirectionTowardsPosition(Position *originPos, Position *targetPos); -s32 GetDistance(Position *pos1, Position *pos2); +s32 GetDirectionTowardsPosition(DungeonPos *originPos, DungeonPos *targetPos); +s32 GetDistance(DungeonPos *pos1, DungeonPos *pos2); #endif diff --git a/include/sprite.h b/include/sprite.h index 09197daf1..c5369d187 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -34,7 +34,7 @@ void BlinkSavingIcon(void); void CopySpritesToOam(void); void InitSprites(void); void ResetSprites(bool8); -void SetSavingIconCoords(Position *); +void SetSavingIconCoords(DungeonPos *); void sub_8004E8C(unkStruct_2039DB0 *); void sub_8005180(void); void sub_8005304(void); diff --git a/include/string_format.h b/include/string_format.h index 0dd5e875a..3a8f24c7b 100644 --- a/include/string_format.h +++ b/include/string_format.h @@ -33,7 +33,7 @@ struct MonPortraitMsg { OpenedFile *faceFile; struct PortraitGfx *faceData; - Position pos; + DungeonPos pos; u8 spriteId; // Which mon's sprite to use. For example Kecleon has multiple sprites depending on whether it's green or purple. bool8 flip; // Whether the mon's sprite is flipped. u8 unkE; diff --git a/include/structs/axdata.h b/include/structs/axdata.h index a08151b7b..4f7002be9 100644 --- a/include/structs/axdata.h +++ b/include/structs/axdata.h @@ -14,9 +14,9 @@ typedef struct UnkSpriteMem // size: 0x20 typedef struct axdata1 { - /* 0x0 */ Position pos; - /* 0x4 */ Position offset; - /* 0x8 */ Position shadow; + /* 0x0 */ DungeonPos pos; + /* 0x4 */ DungeonPos offset; + /* 0x8 */ DungeonPos shadow; u32 unkC; u32 unk10; /* 0x14 */ s16 vramTileOrMaybeAnimTimer; @@ -43,8 +43,8 @@ typedef struct ax_anim /* 0x0 */ u8 frames; /* 0x1 */ u8 unkFlags; /* 0x2 */ s16 poseId; - /* 0x4 */ Position offset; - /* 0x8 */ Position shadow; + /* 0x4 */ DungeonPos offset; + /* 0x8 */ DungeonPos shadow; } ax_anim; // size: 0x3C diff --git a/include/structs/dungeon_entity.h b/include/structs/dungeon_entity.h index 7bb65b928..c89a0b466 100644 --- a/include/structs/dungeon_entity.h +++ b/include/structs/dungeon_entity.h @@ -33,7 +33,7 @@ typedef struct unkStruct_8044CC8 { /* 0x0 */ u8 actionUseIndex; - /* 0x4 */ Position lastItemThrowPosition; + /* 0x4 */ DungeonPos lastItemThrowPosition; } unkStruct_8044CC8; // size: 0x18 @@ -45,7 +45,7 @@ typedef struct ActionContainer // Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset. /* 0x4 */ unkStruct_8044CC8 unk4[2]; // Position of the target that the Pokémon wants throw an item at. - /* 0x14 */ Position itemTargetPosition; + /* 0x14 */ DungeonPos itemTargetPosition; } ActionContainer; // size: 0x4 @@ -72,7 +72,7 @@ typedef struct AITarget /* 0x4 */ u16 aiTargetSpawnGenID; /* 0x8 */ struct Entity *aiTarget; /* 0xC */ u32 unkC; - /* 0x10 */ Position aiTargetPos; + /* 0x10 */ DungeonPos aiTargetPos; } AITarget; // size: 0x4 @@ -179,11 +179,11 @@ typedef struct Muzzled // size: 0x1C typedef struct Unk_Entity_x184 { - /* 0x184 - 0x0 */ Position previousTargetMovePosition1; - /* 0x188 - 0x4 */ Position32 previousTargetMovePosition2; + /* 0x184 - 0x0 */ DungeonPos previousTargetMovePosition1; + /* 0x188 - 0x4 */ PixelPos previousTargetMovePosition2; /* 0x190 - 0xC */ s32 lastMoveDirection; // The last direction that the Pokémon moved in. // Number of tiles that the Pokémon moved last, multiplied by 0x100. - /* 0x194 - 0x10*/ Position32 lastMoveIncrement; + /* 0x194 - 0x10*/ PixelPos lastMoveIncrement; /* 0x19C - 0x18 */ s16 walkAnimFramesLeft; // Set when the Pokémon starts moving, and counts down until the Pokémon's walk animation stops. /* 0x19e - 0x1a */ u8 unk1A; } Unk_Entity_x184; @@ -241,7 +241,7 @@ typedef struct EntityInfo /* 0x5E */ u8 abilities[2]; /* 0x60 */ Item heldItem; /* 0x64 */ u8 unk64; - /* 0x68 */ Position prevPos[NUM_PREV_POS]; + /* 0x68 */ DungeonPos prevPos[NUM_PREV_POS]; /* 0x78 */ AITarget aiTarget; // Bitwise flags corresponding to selected IQ skills. /* 0x8C */ u8 IQSkillMenuFlags[NUM_PICKED_IQ_SKILLS]; // IQ skills selected in the IQ skills menu. @@ -336,8 +336,8 @@ typedef struct EntityInfo /* 0x167 */ u8 unk167; /* 0x168 */ u8 unk168; /* 0x169 */ u8 turnsSinceWarpScarfActivation; - /* 0x16C */ Position targetPos; - /* 0x170 */ Position pixelPos; + /* 0x16C */ DungeonPos targetPos; + /* 0x170 */ DungeonPos pixelPos; s24_8 unk174; u16 abilityEffectFlags; // See enum AbilityEffectFlags /* 0x17A */ u16 mimicMoveIDs[MAX_MON_MOVES]; // All moves that Mimic has copied (not sure on size...) @@ -356,12 +356,12 @@ typedef struct EntityInfo typedef struct Entity { /* 0x0 */ u32 type; - /* 0x4 */ Position pos; - /* 0x8 */ Position prevPos; + /* 0x4 */ DungeonPos pos; + /* 0x8 */ DungeonPos prevPos; // The center of the entity acccording to pixel-space coordinates, using the same origin as posWorld. // X = (posWorld * 24 + 16) * 256, while Y = (posWorld * 24 + 12) * 256. - /* 0xC */ Position32 pixelPos; - /* 0x14 */ Position32 prevPixelPos; + /* 0xC */ PixelPos pixelPos; + /* 0x14 */ PixelPos prevPixelPos; s32 unk1C; /* 0x20 */ bool8 isVisible; // Turned off when a Pokémon faints. u8 fill21; diff --git a/include/structs/map.h b/include/structs/map.h index cda59ded2..b2127b929 100644 --- a/include/structs/map.h +++ b/include/structs/map.h @@ -56,7 +56,7 @@ typedef struct RoomData u8 unk0; u8 unk1; // All coordinates are inclusive. - // These are not aligned properly to use the Position struct. + // These are not aligned properly to use the DungeonPos struct. /* 0x2 */ s16 bottomRightCornerX; /* 0x4 */ s16 bottomRightCornerY; /* 0x6 */ s16 topLeftCornerX; diff --git a/include/structs/menu.h b/include/structs/menu.h index 96391e592..3d64a5760 100644 --- a/include/structs/menu.h +++ b/include/structs/menu.h @@ -25,11 +25,11 @@ typedef struct MenuInputStruct s32 unk0; u16 unk4; s16 unk6; - Position unk8; // Maybe Position - s16 unkC; // Maybe Position + DungeonPos unk8; // Maybe DungeonPos + s16 unkC; // Maybe DungeonPos s16 unkE; u32 unk10; - Position unk14; // Maybe Position + DungeonPos unk14; // Maybe DungeonPos /* 0x18 */ s16 menuIndex; s16 unk1A; s16 unk1C; diff --git a/include/structs/str_dungeon.h b/include/structs/str_dungeon.h index b95093631..e6866cf7c 100644 --- a/include/structs/str_dungeon.h +++ b/include/structs/str_dungeon.h @@ -77,10 +77,10 @@ typedef struct DungeonMusicPlayer // Size unknown? typedef struct UnkDungeonGlobal_unk181E8_sub { - /* 0x181E8 */ Position cameraPos; // x0 - /* 0x181EC */ Position cameraPosMirror; // x4 - /* 0x181F0 */ Position cameraPixelPos; // x8 - /* 0x181F4 */ Position cameraPixelPosMirror; // xC + /* 0x181E8 */ DungeonPos cameraPos; // x0 + /* 0x181EC */ DungeonPos cameraPosMirror; // x4 + /* 0x181F0 */ DungeonPos cameraPixelPos; // x8 + /* 0x181F4 */ DungeonPos cameraPixelPosMirror; // xC /* 0x181F8 */ Entity *cameraTarget; // x10 u32 unk181FC; // x14 u32 unk18200; // x18 @@ -370,9 +370,9 @@ typedef struct Dungeon /* 0x3A14 */ s16 bossBattleIndex; /* 0x3A16 */ s16 unk3A16; /* 0x3A18 */ Tile tiles[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; - Position unkE218; - Position unkE21C; // stair location? - Position unkE220[8]; + DungeonPos unkE218; + DungeonPos unkE21C; // stair location? + DungeonPos unkE220[8]; unkDungeonE240 unkE240; unkDungeonE240 unkE250; unkDungeonE260 unkE260; @@ -384,7 +384,7 @@ typedef struct Dungeon u8 unk104C0; /* 0x104C4 */ RoomData roomData[MAX_ROOM_COUNT]; /* 0x10844 */ s16 naturalJunctionListCounts[MAX_ROOM_COUNT]; - /* 0x10884 */ Position naturalJunctionList[MAX_ROOM_COUNT][MAX_ROOM_COUNT]; // Arrays of room exits for each room. + /* 0x10884 */ DungeonPos naturalJunctionList[MAX_ROOM_COUNT][MAX_ROOM_COUNT]; // Arrays of room exits for each room. u16 unk11884[250][9]; u16 unk12A18[20][9]; u16 unk12B80[9]; @@ -398,7 +398,7 @@ typedef struct Dungeon u8 fill1356D[0x13570 - 0x1356D]; /* 0x13570 */ u8 unk13570; u8 fill13571[0x13574 - 0x13571]; - /* 0x13574 */ Position trapPos; + /* 0x13574 */ DungeonPos trapPos; /* 0x13578 */ u8 trapID; /* 0x13579 */ u8 unk13579; u8 fill1357A[0x1357C - 0x1357A]; diff --git a/include/structs/str_position.h b/include/structs/str_position.h index f767b80c4..e56ee1d18 100644 --- a/include/structs/str_position.h +++ b/include/structs/str_position.h @@ -2,26 +2,26 @@ #define GUARD_STR_POSITION_H // size: 0x4 -typedef struct Position +typedef struct DungeonPos { /* 0x0 */ s16 x; /* 0x2 */ s16 y; -} Position; +} DungeonPos; /** * Precise position expressed in pixel units, as s24_8 fixpoint. * This type has subpixel precision to 1/256th of a pixel. */ // size: 0x8 -typedef struct Position32 +typedef struct PixelPos { /* 0x0 */ s32 x; // TODO: convert to s24_8 across the codebase /* 0x4 */ s32 y; -} Position32; +} PixelPos; /** * Currently only used in script data, for entities and GroundLink data. - * Position expressed in terms of *graphics* tiles, 8 pixels per unit. + * DungeonPos expressed in terms of *graphics* tiles, 8 pixels per unit. * Flags allow expressing half-tile offsets and allow using a current/default coordinate. */ // size: 0x4 diff --git a/include/tile_types.h b/include/tile_types.h index 78ce34014..46f765829 100644 --- a/include/tile_types.h +++ b/include/tile_types.h @@ -9,7 +9,7 @@ extern const u8 gDungeonWaterType[76]; -void sub_804AE84(Position *pos); +void sub_804AE84(DungeonPos *pos); bool8 IsTileGround(Tile *tile); bool8 IsWaterTileset(); diff --git a/include/trap.h b/include/trap.h index ba9ba7fdb..e6a6ad899 100644 --- a/include/trap.h +++ b/include/trap.h @@ -5,17 +5,17 @@ #include "structs/map.h" #include "structs/str_position.h" -bool8 CanLayTrap(Position *pos); -bool8 LayTrap(Position *pos, u8 trapID, u8 param_3); +bool8 CanLayTrap(DungeonPos *pos); +bool8 LayTrap(DungeonPos *pos, u8 trapID, u8 param_3); bool8 sub_807FD84(Entity *entity); -bool8 sub_807FE04(Position *pos, char param_2); -bool8 sub_807FE44(Position *pos, char param_2); +bool8 sub_807FE04(DungeonPos *pos, char param_2); +bool8 sub_807FE44(DungeonPos *pos, char param_2); void GetTrapName(u8 *buffer, u8 trapIndex); -void sub_807FE9C(Entity *pokemon, Position *pos, int param_3, char param_4); +void sub_807FE9C(Entity *pokemon, DungeonPos *pos, int param_3, char param_4); void HandleMudTrap(Entity *pokemon, Entity *target); void HandleStickyTrap(Entity *pokemon, Entity *target); void HandleGrimyTrap(Entity *pokemon, Entity *target); -void HandleSummonTrap(Entity *pokemon, Position *pos); +void HandleSummonTrap(Entity *pokemon, DungeonPos *pos); void HandlePitfallTrap(Entity *pokemon,Entity *target,Tile *tile); void HandleWarpTrap(Entity *pokemon, Entity *target); void HandleSpinTrap(Entity *pokemon, Entity *target); @@ -30,7 +30,7 @@ void HandleWonderTile(Entity *pokemon, Entity *target); // code_807FCD4.s extern void HandleSealTrap(Entity *pokemon, Entity *target); extern void HandleWhirlwindTrap(Entity *entity, Entity *target); -extern void HandlePokemonTrap(Entity *pokemon, Position *pos); +extern void HandlePokemonTrap(Entity *pokemon, DungeonPos *pos); // trap_1.c void HandleTripTrap(Entity *pokemon, Entity *target); diff --git a/src/code_800558C.c b/src/code_800558C.c index 8c54dff9e..0788f765f 100644 --- a/src/code_800558C.c +++ b/src/code_800558C.c @@ -84,11 +84,11 @@ const RGB *sub_8005674(struct axMapSprite *a0, s32 vramIdx) return a0->pal; } -void sub_800569C(Position *a0, struct axObject *a1, u8 a2) +void sub_800569C(DungeonPos *a0, struct axObject *a1, u8 a2) { - Position *ptr; - Position *ptr2; - Position *ptr3; + DungeonPos *ptr; + DungeonPos *ptr2; + DungeonPos *ptr3; a0->x = 0; a0->y = 0; @@ -97,7 +97,7 @@ void sub_800569C(Position *a0, struct axObject *a1, u8 a2) return; if (a1->axdata.paletteData != NULL) { - ptr = &((Position*)a1->axdata.paletteData)[a1->axdata.sub1.poseId * 4]; + ptr = &((DungeonPos*)a1->axdata.paletteData)[a1->axdata.sub1.poseId * 4]; ptr2 = &ptr[a2]; if (*&ptr2->x == 99 && *&ptr2->y == 99) { a0->x = 99; @@ -115,16 +115,16 @@ void sub_800569C(Position *a0, struct axObject *a1, u8 a2) } } -void sub_8005700(Position *a0, struct axObject *a1) +void sub_8005700(DungeonPos *a0, struct axObject *a1) { s32 i; - Position *ptr; + DungeonPos *ptr; if (!(a1->axdata.flags >> 15)) return; if (a1->axdata.paletteData != NULL) { - ptr = &((Position*)a1->axdata.paletteData)[a1->axdata.sub1.poseId * 4]; + ptr = &((DungeonPos*)a1->axdata.paletteData)[a1->axdata.sub1.poseId * 4]; for (i = 0; i < 4; i++) { if (*&ptr[i].x == 99 && *&ptr[i].y == 99) { a0->x = 99; @@ -159,7 +159,7 @@ void sub_8005770(s32 param_1, const RGB *color, s32 brightness, const RGB *ramp) SetBGPaletteBufferColorRGB((param_1 + 0x10) * 0x10 + i, &color[i], brightness, ramp); } -// Maybe Position +// Maybe DungeonPos void nullsub_7(s16 *a0) {} diff --git a/src/code_800F958.c b/src/code_800F958.c index 1538ea514..c928442bc 100644 --- a/src/code_800F958.c +++ b/src/code_800F958.c @@ -6,13 +6,12 @@ extern DungeonPokemonSprite *NewDungeonPokemonSprite(void); extern DungeonPokemonSprite* GetDungeonPokemonSprite(s32 id); -extern Position gUnknown_80D3564; +extern DungeonPos gUnknown_80D3564; -void AddPokemonDungeonSprite(s32 id, s16 species, Position *pos, u32 r3) -{ +void AddPokemonDungeonSprite(s32 id, s16 species, DungeonPos *pos, u32 r3) { DungeonPokemonSprite *dSprite; DungeonPokemonSprite *newSprite; - Position newPos; + DungeonPos newPos; s32 species_s32; species_s32 = species; @@ -57,7 +56,8 @@ void DeletePokemonDungeonSprite(s32 id) MemoryClear8((u8 *)dSprite, sizeof(DungeonPokemonSprite)); } -void sub_800F958(s32 dungeonSpriteID, Position *pos, Position *statusOffsets, u32 a3) +void sub_800F958(s32 dungeonSpriteID, DungeonPos *pos, + DungeonPos *statusOffsets, u32 a3) { DungeonPokemonSprite *dSprite; diff --git a/src/code_803E46C.c b/src/code_803E46C.c index cf05240e0..6dc8deae5 100644 --- a/src/code_803E46C.c +++ b/src/code_803E46C.c @@ -38,7 +38,7 @@ void sub_800E90C(); void sub_8042E5C(); void sub_8040B60(); void sub_8040788(); -void sub_800F7D0(Position *); +void sub_800F7D0(DungeonPos *); void sub_803E874(s32, s32); void sub_803EAF0(s32, s32); diff --git a/src/code_803E724.c b/src/code_803E724.c index f94ef844f..475f05814 100644 --- a/src/code_803E724.c +++ b/src/code_803E724.c @@ -899,7 +899,7 @@ void sub_803F38C(void) nullsub_5(0xFF, &gFontPalette[palId].pal[15]); } -bool8 sub_803F428(Position *pos) +bool8 sub_803F428(DungeonPos *pos) { UnkDungeonGlobal_unk181E8_sub *strPtr = &gDungeon->unk181e8; Entity *cameraEntity = strPtr->cameraTarget; diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index 5788623d7..eecc28c28 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -51,18 +51,18 @@ extern void sub_800EE5C(u32); extern void sub_800EF64(void); u32 sub_8041764(unkStruct_80416E0 *param_1, bool8 param_2); -s32 sub_80416E0(Position32 *pos, u32 param_2, bool8 param_3); +s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3); -s32 sub_80416A4(Position *pos_1, u32 param_2, bool8 param_3) +s32 sub_80416A4(DungeonPos *pos_1, u32 param_2, bool8 param_3) { - Position32 pos; + PixelPos pos; pos.x = pos_1->x * 0x1800 + 0xc00; pos.y = pos_1->y * 0x1800 + 0x1000; return sub_80416E0(&pos, param_2, param_3); } -s32 sub_80416E0(Position32 *pos, u32 param_2, bool8 param_3) +s32 sub_80416E0(PixelPos *pos, u32 param_2, bool8 param_3) { int counter; s32 ret; @@ -850,7 +850,7 @@ void sub_804218C(Entity *pokemon, Entity *target) sub_804151C(target, 0x2A, 1); } -void sub_804219C(Position32 *pos) +void sub_804219C(PixelPos *pos) { sub_80416E0(pos, 0x90, TRUE); } @@ -868,7 +868,7 @@ void sub_80421C0(Entity *pokemon, u16 r1) PlaySoundEffect(r1); } -void sub_80421EC(Position *pos, u16 r1) +void sub_80421EC(DungeonPos *pos, u16 r1) { if(sub_803F428(pos)) PlaySoundEffect(r1); diff --git a/src/code_804267C.c b/src/code_804267C.c index 2493588d0..36f0c9ef6 100644 --- a/src/code_804267C.c +++ b/src/code_804267C.c @@ -23,7 +23,7 @@ extern const u8 *gPtrFeralFoundItemMessage[]; extern void sub_8040238(void); extern void sub_804151C(Entity *pokemon, u32 r1, u8 r2); extern void sub_804178C(u32); -extern void sub_80416A4(Position *r0, u32 r1, bool8 r2); +extern void sub_80416A4(DungeonPos *r0, u32 r1, bool8 r2); extern void sub_80429A0(Entity *); extern void sub_8042B34(u32, u32, u32); extern bool8 sub_8042CC0(void); @@ -236,13 +236,13 @@ void sub_80429E8(Entity *r0) sub_804151C(r0, 0x11d, 1); } -void sub_80429FC(Position *r0) +void sub_80429FC(DungeonPos *r0) { sub_80416A4(r0, 0x19E, TRUE); sub_80421C0(NULL, 0xD4); } -void sub_8042A14(Position *r0) +void sub_8042A14(DungeonPos *r0) { sub_80416A4(r0, 0x36, TRUE); } @@ -252,7 +252,7 @@ void sub_8042A24(Entity *r0) sub_804151C(r0, 0x15, 1); } -void sub_8042A34(Position *r0) +void sub_8042A34(DungeonPos *r0) { sub_80416A4(r0, 0x13E, FALSE); } @@ -262,12 +262,12 @@ void sub_8042A44(Entity *r0) sub_804151C(r0, 0xDA << 1, 1); } -void sub_8042A54(Position *r0) +void sub_8042A54(DungeonPos *r0) { sub_80416A4(r0, 0x37, TRUE); } -void sub_8042A64(Position *r0) +void sub_8042A64(DungeonPos *r0) { sub_80416A4(r0, 0x29, TRUE); } diff --git a/src/code_8042B34.c b/src/code_8042B34.c index 609a30bab..234c0267a 100644 --- a/src/code_8042B34.c +++ b/src/code_8042B34.c @@ -41,7 +41,7 @@ extern void sub_800EE5C(s32); extern void sub_800EF64(void); extern void sub_800F15C(s32); -struct Sub_UnkStruct_203B414 // Maybe Position? +struct Sub_UnkStruct_203B414 // Maybe DungeonPos? { s16 a0; s16 a2; @@ -218,8 +218,9 @@ void sub_8042E98(void) } } -extern void sub_800569C(Position *, axdata *, u8); -extern void sub_800EB24(s32 param_1, Position *param_2, Position *param_3, s32 param_4, s32 param_5); +extern void sub_800569C(DungeonPos *, axdata *, u8); +extern void sub_800EB24(s32 param_1, DungeonPos *param_2, DungeonPos *param_3, + s32 param_4, s32 param_5); void sub_8042EC8(Entity *a0, s32 a1) { @@ -228,8 +229,8 @@ void sub_8042EC8(Entity *a0, s32 a1) for (i = 0; i < 3; i++) { struct unkStruct_Dungeon5C4_sub *strPtr = &gDungeon->unk5C4[i]; if (strPtr->unk0 >= 0 && strPtr->unkC == a0) { - Position sp8 = {a0->pixelPos.x / 256, a0->pixelPos.y / 256}; - Position sp4 = {0}; + DungeonPos sp8 = {a0->pixelPos.x / 256, a0->pixelPos.y / 256}; + DungeonPos sp4 = {0}; EntityInfo *entInfo = GetEntInfo(a0); if (strPtr->unk8 != -1) { @@ -244,7 +245,7 @@ void sub_8042EC8(Entity *a0, s32 a1) } extern u8 gUnknown_203B40C; -extern Position gUnknown_203B410; +extern DungeonPos gUnknown_203B410; extern u8 *gSerializedData_203B41C; struct Substruct_xxx_dungeon_8042F6C diff --git a/src/code_8044CC8.c b/src/code_8044CC8.c index c55f1638b..8d9ead4b3 100644 --- a/src/code_8044CC8.c +++ b/src/code_8044CC8.c @@ -36,8 +36,8 @@ extern u8 *gUnknown_80F91EC[]; extern u8 sub_8043D10(void); extern bool8 sub_8045888(Entity *); -void sub_80460F8(Position *, Item *, u32); -bool8 sub_80461C8(Position *, u32); +void sub_80460F8(DungeonPos *, Item *, u32); +bool8 sub_80461C8(DungeonPos *, u32); Item * sub_8044CC8(Entity *param_1, unkStruct_8044CC8 *param_2) { @@ -134,7 +134,7 @@ void sub_8044E24(Entity *entity,int index,u32 unused) { Item *itemPtr; EntityInfo *info; - Position *pos; + DungeonPos *pos; Item item; itemPtr = sub_8044D90(entity,index,unused); diff --git a/src/code_80450F8.c b/src/code_80450F8.c index 1bab6d720..526a34b5a 100644 --- a/src/code_80450F8.c +++ b/src/code_80450F8.c @@ -524,7 +524,7 @@ Entity *sub_804550C(s16 a) ); } -Entity *sub_8045684(u8 trapID, Position *pos, u8 c) +Entity *sub_8045684(u8 trapID, DungeonPos *pos, u8 c) { Entity *entity; s32 i; @@ -548,7 +548,7 @@ Entity *sub_8045684(u8 trapID, Position *pos, u8 c) return NULL; } -Entity *sub_8045708(Position *pos) +Entity *sub_8045708(DungeonPos *pos) { s32 i; Entity *ent; diff --git a/src/code_8045A00.c b/src/code_8045A00.c index d6ef76284..fd8662e4b 100644 --- a/src/code_8045A00.c +++ b/src/code_8045A00.c @@ -18,7 +18,7 @@ extern struct unkStruct_8090F58 gUnknown_80F6990; void sub_8045BF8(u8 *, Item *); extern u32 sub_803D73C(u32); -void sub_80460F8(Position *, Item *, u32); +void sub_80460F8(DungeonPos *, Item *, u32); void sub_8045ACC(void) { @@ -135,7 +135,7 @@ void sub_8045CB0(void) u32 uVar5; int xCounter; Item item; - Position pos; + DungeonPos pos; u32 flag; x = DungeonRandInt(DUNGEON_MAX_SIZE_X); diff --git a/src/code_8048480.c b/src/code_8048480.c index cf2989089..da8e833d2 100644 --- a/src/code_8048480.c +++ b/src/code_8048480.c @@ -154,7 +154,7 @@ void sub_80482FC(Entity *, Entity *, u32, u8); extern void sub_8071DA4(Entity *); extern void SetShopkeeperAggression(Entity *, Entity *); -extern void sub_80464C8(Entity *, Position *, Item *); +extern void sub_80464C8(Entity *, DungeonPos *, Item *); extern void sub_806A6E8(Entity *); extern void sub_8042390(Entity *, Item *); diff --git a/src/code_805D8C8_1.c b/src/code_805D8C8_1.c index b2dba0630..6e13f4d04 100644 --- a/src/code_805D8C8_1.c +++ b/src/code_805D8C8_1.c @@ -68,8 +68,9 @@ extern void sub_8083D30(void); extern void sub_8083D08(void); extern void sub_806A6E8(Entity *); extern bool8 sub_8047084(s32 itemFlag); -extern void sub_807FE9C(Entity *pokemon, Position *pos, int param_3, char param_4); -extern void sub_8045DB4(Position *, u32); +extern void sub_807FE9C(Entity *pokemon, DungeonPos *pos, int param_3, + char param_4); +extern void sub_8045DB4(DungeonPos *, u32); bool8 sub_807EF48(void); void sub_806A2BC(Entity *a0, u8 a1); bool8 sub_805E874(void); @@ -116,7 +117,7 @@ void sub_8063A70(ActionContainer *a0, bool8 a1); void sub_8063CF0(ActionContainer *a0, bool8 a1); void sub_8067768(UNUSED ActionContainer *a0); void ShowTacticsMenu(ActionContainer *a0); -void sub_804A728(Position *pos, s32 a1, u8 a2, u8 a3); +void sub_804A728(DungeonPos *pos, s32 a1, u8 a2, u8 a3); extern bool8 sub_8071A8C(Entity *pokemon); extern void sub_80643AC(Entity *pokemon); extern u8 sub_8062F90(Entity *, u32, u32, u32, u32); @@ -1520,13 +1521,13 @@ bool8 sub_805E874(void) bool8 sub_805EC2C(Entity *a0, s32 x, s32 y) { - Position pos = {.x = x, .y = y}; + DungeonPos pos = {.x = x, .y = y}; return sub_8070564(a0, &pos); } bool8 sub_805EC4C(Entity *a0, u8 a1) { - Position pos; + DungeonPos pos; Tile *tile; EntityInfo *tileMonsterInfo; Entity *tileMonster; @@ -2378,7 +2379,7 @@ bool8 sub_805FD3C(struct UnkMenuBitsStruct *a0) s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4); -void sub_8060890(Position *a0); +void sub_8060890(DungeonPos *a0); bool8 sub_8060860(s32 a0); void sub_8060900(Entity *a0); s32 sub_8060800(UnkTextStruct2_sub2 *a0, s32 a1); @@ -2849,7 +2850,7 @@ bool8 sub_8060860(s32 a0) return TRUE; } -void sub_8060890(Position *a0) +void sub_8060890(DungeonPos *a0) { s32 var = sUnknown_202F248[gUnknown_202EE10.unk1E]; switch (var) @@ -3088,7 +3089,7 @@ void sub_8060D24(UNUSED ActionContainer *a0) sub_803EAF0(0, NULL); } -extern bool8 PosHasItem(Position *pos); +extern bool8 PosHasItem(DungeonPos *pos); s32 sub_8060D64(s16 *a0, bool8 a1, bool8 a2, bool8 a3, Entity *a4) { @@ -3281,7 +3282,7 @@ bool8 sub_8060E38(Entity *a0) return ret; } -bool32 sub_8069D18(Position *a0, Entity *a1); +bool32 sub_8069D18(DungeonPos *a0, Entity *a1); extern const u8 gTeamFormat[]; extern const u8 gHeartRedTiny[]; @@ -3302,7 +3303,7 @@ extern void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum); void DrawFieldTeamMenu(struct UnkFieldTeamMenuStruct *a0, UnkTextStruct3 *a1, bool8 a2) { s32 r0; - Position pos; + DungeonPos pos; s32 i; s32 count = 0; diff --git a/src/code_8066D04.c b/src/code_8066D04.c index 916169ae5..5beb3e648 100644 --- a/src/code_8066D04.c +++ b/src/code_8066D04.c @@ -28,12 +28,12 @@ extern u8 *gUnknown_80F8E28[]; extern Item *sub_8044D90(Entity *, s32, u32); void sub_8045BF8(u8 *, Item *); -u8 sub_80460F8(Position *, Item *, u32); +u8 sub_80460F8(DungeonPos *, Item *, u32); extern void sub_807AB38(Entity *, u32); extern Entity * sub_8044DA4(Entity *param_1,int param_2); extern void sub_806A6E8(Entity *); extern void sub_8044DF0(Entity *, u32, u32); -extern void sub_8045DB4(Position *, u32); +extern void sub_8045DB4(DungeonPos *, u32); void HandlePickUpPlayerAction(Entity *entity) { diff --git a/src/code_8069D4C.c b/src/code_8069D4C.c index 08a1a25e5..48c5e9210 100644 --- a/src/code_8069D4C.c +++ b/src/code_8069D4C.c @@ -3,7 +3,7 @@ #include "dungeon_util.h" #include "code_8069D4C.h" -u32 sub_8069D18(Position *pos,Entity *entity) +u32 sub_8069D18(DungeonPos *pos,Entity *entity) { EntityInfo *info; diff --git a/src/code_806CD90.c b/src/code_806CD90.c index f93e90836..e16c9d267 100644 --- a/src/code_806CD90.c +++ b/src/code_806CD90.c @@ -284,7 +284,7 @@ extern void sub_806F63C(Entity *r0); extern void sub_8078084(Entity * pokemon); extern void sub_800DBBC(void); extern void sub_8045C28(Item *Item, u8 itemID, u32 param_3); -extern void sub_80464C8(Entity *, Position *, Item *); +extern void sub_80464C8(Entity *, DungeonPos *, Item *); extern bool8 DoEnemiesEvolveWhenKOed(u8 dungeon); extern bool8 sub_806FA5C(Entity *, Entity *, struct unkStruct_8069D4C *); extern void EntityUpdateStatusSprites(Entity *); @@ -817,7 +817,7 @@ static bool8 HandleDealingDamageInternal(Entity *attacker, Entity *target, struc } } if (i != MAX_TEAM_MEMBERS) { - Position monPos; // r4 + DungeonPos monPos; // r4 sub_8042148(target); diff --git a/src/code_80718D8.c b/src/code_80718D8.c index f2195c485..aed02349e 100644 --- a/src/code_80718D8.c +++ b/src/code_80718D8.c @@ -23,7 +23,7 @@ struct unkStruct_806B7F8 u32 unk4; u16 level; u8 fillA[2]; - struct Position pos; + DungeonPos pos; u8 unk10; }; @@ -65,7 +65,7 @@ extern void sub_8042920(struct Entity *r0); extern s16 sub_803D970(u32); extern s32 sub_803DA20(s32 param_1); extern bool8 sub_806AA0C(s32, u32); -extern bool8 sub_8083660(struct Position *param_1); +extern bool8 sub_8083660(DungeonPos *param_1); void GetPokemonLevelData(LevelData* a1, s32 _id, s32 level); // TODO: change to s32 void sub_8071B48(void) diff --git a/src/code_8072B78.c b/src/code_8072B78.c index d3b1eddb1..7a96283c3 100644 --- a/src/code_8072B78.c +++ b/src/code_8072B78.c @@ -23,7 +23,7 @@ struct unkStruct_806B7F8 u32 unk4; u16 level; u8 fillA[0xC - 0xA]; - struct Position pos; + DungeonPos pos; u8 unk10; }; diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index 5509a78b4..2d69cbaf7 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -41,11 +41,11 @@ extern void sub_8067110(Entity *); extern void sub_80671A0(Entity *); extern void sub_8073D14(Entity *); extern void sub_8045BF8(u8 *, Item *); -extern bool8 sub_80461C8(Position *, u32); +extern bool8 sub_80461C8(DungeonPos *, u32); extern void sub_805229C(void); extern void sub_807E8F0(Entity *); extern void sub_80444F4(Entity *pokemon); -extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3); +extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, DungeonPos *r3); extern void sub_80420B8(Entity *pokemon); extern void sub_8041C4C(Entity *pokemon, u32 r1); extern void sub_805E804(void); @@ -108,7 +108,7 @@ extern const s16 gUnknown_80F4F36; extern s48_16 gUnknown_80F54F4[8]; extern const s32 gUnknown_80F60DC[]; -extern const Position gUnknown_80F4D44[]; +extern const DungeonPos gUnknown_80F4D44[]; bool8 UseAttack(Entity *a0); void sub_8075050(EntityInfo *info, Unk_Entity_x184 *strPtr); @@ -797,7 +797,7 @@ void TickStatusHeal(Entity *entity) } } -void sub_8074FB0(Entity *entity, s32 a1, Position *pos) +void sub_8074FB0(Entity *entity, s32 a1, DungeonPos *pos) { Unk_Entity_x184 *strPtr; EntityInfo *entityInfo = GetEntInfo(entity); @@ -910,7 +910,7 @@ bool8 UseAttack(Entity *a0) } } else { - Position32 pos; + PixelPos pos; monInfo->flags |= 0x2000; pos.x = (monInfo->unk184[0].previousTargetMovePosition2.x * 0x1800) + 0xC00; @@ -948,7 +948,7 @@ bool8 UseAttack(Entity *a0) monInfo->numMoveTiles = 0; } else { - Position32 pos; + PixelPos pos; pos.x = (monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.x * 0x1800) + 0xC00; pos.y = (monInfo->unk184[monInfo->notMoving].previousTargetMovePosition2.y * 0x1800) + 0x1000; @@ -977,7 +977,7 @@ bool8 UseAttack(Entity *a0) sub_807AA30(); for (j = 0; j < 2; j++) { for (loop = 0; loop < DUNGEON_MAX_POKEMON; loop++) { - Position monPosBefore; + DungeonPos monPosBefore; EntityInfo *monInfo; Entity *mon = gDungeon->activePokemon[loop]; diff --git a/src/code_8075708.c b/src/code_8075708.c index 934fdabc6..c89b02c49 100644 --- a/src/code_8075708.c +++ b/src/code_8075708.c @@ -22,7 +22,7 @@ extern void sub_8073D14(Entity *); void sub_8075680(void) { u32 direction; - Position *targetPos; + DungeonPos *targetPos; Entity *entity; EntityInfo *info; int index; diff --git a/src/code_807CD9C.c b/src/code_807CD9C.c index 4288937c1..68b97d534 100644 --- a/src/code_807CD9C.c +++ b/src/code_807CD9C.c @@ -42,25 +42,25 @@ void sub_806A5B8(Entity *); u8 sub_8045888(Entity *); void sub_807EC28(u32); void sub_80694C0(Entity *, s32, s32, s32); -void sub_807D068(Entity *, Position *); +void sub_807D068(Entity *, DungeonPos *); u8 sub_8044B28(void); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); void sub_80421AC(Entity * pokemon, Entity * target); void sub_807BB78(Entity *pokemon); extern void sub_803F580(u32); -bool8 sub_808384C(Position *, Position *); -u8 sub_8083660(Position *); +bool8 sub_808384C(DungeonPos *, DungeonPos *); +u8 sub_8083660(DungeonPos *); void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction) { Tile *tile; int iVar8; bool8 flag; - Position sp_0x18; + DungeonPos sp_0x18; Move move; int sp_0x24; Entity *sp_0x28; - Position32 sp_0x2C; + PixelPos sp_0x2C; sp_0x24 = 10; if (IsCurrentFixedRoomBossFight()) { @@ -162,7 +162,7 @@ void sub_807CD9C(Entity *pokemon, Entity *target, u32 direction) } } -void sub_807D068(Entity *pokemon, Position *pos) +void sub_807D068(Entity *pokemon, DungeonPos *pos) { int pixelX; int posY; @@ -171,7 +171,7 @@ void sub_807D068(Entity *pokemon, Position *pos) int counter; int iVar8; s32 diff; - Position32 local_34; + PixelPos local_34; int incrementX; int incrementY; @@ -215,12 +215,13 @@ _0807D11E: sub_803E46C(0x1a); } -void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, Position *pos) +void sub_807D148(Entity *pokemon, Entity *target, u32 param_3, + DungeonPos *pos) { EntityInfo *info; u32 direction; - Position local_2c; - Position pos2; + DungeonPos local_2c; + DungeonPos pos2; bool8 flag; info = GetEntInfo(target); diff --git a/src/code_807E1A0.c b/src/code_807E1A0.c index a93575b0f..8aa35e672 100644 --- a/src/code_807E1A0.c +++ b/src/code_807E1A0.c @@ -19,7 +19,7 @@ extern void sub_805E804(void); void sub_806A2BC(Entity *pokemon, u8 param_2); extern u8 sub_8044B28(void); extern void sub_8068FE0(Entity *, u32, Entity *r2); -extern void nullsub_93(Position *); +extern void nullsub_93(DungeonPos *); extern void sub_806F370(Entity *pokemon, Entity *target, u32, u32, u8 *, u8 moveType, s32, u32, u32, u32); extern void sub_80694C0(Entity *, s32, s32, u32); extern void sub_807EC28(bool8); @@ -69,8 +69,8 @@ void sub_807E1A0(Entity *pokemon,Entity *target,u8 moveType,s16 param_4,s32 para void sub_807E254(Entity *pokemon,Entity *target) { - Position pokemonPos; - Position targetPos; + DungeonPos pokemonPos; + DungeonPos targetPos; if (HasAbility(pokemon, ABILITY_SUCTION_CUPS)) { diff --git a/src/code_8085E98.c b/src/code_8085E98.c index 197679864..08d309c63 100644 --- a/src/code_8085E98.c +++ b/src/code_8085E98.c @@ -14,7 +14,7 @@ extern const unkStruct_2039DB0 gUnknown_8107374; void sub_800EF64(void); void sub_800EE5C(s32); void sub_8085F44(s32); -void sub_800E90C(Position *); +void sub_800E90C(DungeonPos *); void sub_8088EE8(void); void sub_8088848(void); void sub_808A718(void); @@ -30,7 +30,8 @@ void sub_8085EB0(void) gDungeon->unk181e8.unk18215 = 1; } -u32 sub_8085EC8(s16 param_1,u32 param_2,u32 param_3,Position *param_4,bool32 param_5) +u32 sub_8085EC8(s16 param_1,u32 param_2,u32 param_3,DungeonPos *param_4, + bool32 param_5) { u32 uVar1; unkStruct_80416E0 local_40; diff --git a/src/code_80861A8.c b/src/code_80861A8.c index e53b058e0..e0d050755 100644 --- a/src/code_80861A8.c +++ b/src/code_80861A8.c @@ -21,7 +21,7 @@ void sub_800EE5C(s32); void sub_800EF64(); void sub_803E46C(s32); s32 sub_800E700(s32); -void sub_800569C(Position *, axdata *, u8); +void sub_800569C(DungeonPos *, axdata *, u8); void sub_8085F44(void); void sub_8052FB8(const u8 *); @@ -78,7 +78,7 @@ s32 sub_80861F8(s16 param_1,Entity *param_2,bool32 param_3) EntityInfo *info; s32 uVar2; s32 uStack_38; - Position pos; + DungeonPos pos; unkStruct_80416E0 stack; #ifdef NONMATCHING diff --git a/src/code_80869E4.c b/src/code_80869E4.c index b11838214..710c0db20 100644 --- a/src/code_80869E4.c +++ b/src/code_80869E4.c @@ -44,7 +44,7 @@ void SpriteShockEffect(Entity *entity) static void sub_80862DC(Entity *entity) { - Position32 pos; + PixelPos pos; pos.x = entity->pixelPos.x; pos.y = entity->pixelPos.y + 0x3800; @@ -55,7 +55,7 @@ static void sub_80862DC(Entity *entity) static void sub_8086310(Entity *entity) { - Position32 pos; + PixelPos pos; pos.x = entity->pixelPos.x; pos.y = entity->pixelPos.y + 0x9000; @@ -67,7 +67,7 @@ static void sub_8086310(Entity *entity) static void sub_8086348(Entity *entity) { - Position32 pos; + PixelPos pos; pos.x = entity->pixelPos.x + 0x7800; pos.y = entity->pixelPos.y - 0x2000; @@ -78,7 +78,7 @@ static void sub_8086348(Entity *entity) static void sub_8086384(Entity *entity) { - Position32 pos; + PixelPos pos; pos.x = entity->pixelPos.x + 0x7800; pos.y = entity->pixelPos.y; diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index d56aeb209..1d22cc2ba 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -61,7 +61,7 @@ extern bool8 TryUseChosenMove(struct Entity *, u32, u32, u32, u32, struct Move * extern void sub_8045BF8(u8 *, struct Item *); extern void sub_8044DF0(struct Entity *, u32, u32); extern void sub_8071DA4(struct Entity *); -extern void sub_804AC20(struct Position *); +extern void sub_804AC20(DungeonPos *); extern void sub_807EC28(bool8); extern void sub_806A5B8(struct Entity *entity); diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index 948b357fc..09a5934f7 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -110,7 +110,7 @@ void AIDecideUseItem(Entity *pokemon) } else if (itemType == CATEGORY_THROWN_ARC) { - Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS]; + DungeonPos potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS]; GetPossibleAIArcItemTargets(pokemon, item, potentialTargetPositions, TRUE); if (gAIThrowItemActionChoiceCount == 0) { @@ -233,7 +233,7 @@ void AIDecideUseItem(Entity *pokemon) u8 itemType = GetItemCategory(item->id); if (itemType == CATEGORY_THROWN_ARC) { - Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS]; + DungeonPos potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS]; GetPossibleAIArcItemTargets(pokemon, item, potentialTargetPositions, FALSE); if (gAIThrowItemActionChoiceCount != 0) { @@ -312,7 +312,9 @@ void GetPossibleAIThrownItemDirections(Entity *pokemon, s32 thrownAIFlag, Item * } } -void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, Position potentialTargets[], bool8 ignoreRollChance) +void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, + DungeonPos potentialTargets[], + bool8 ignoreRollChance) { s32 i; gAIThrowItemActionChoiceCount = 0; @@ -340,7 +342,7 @@ void GetPossibleAIArcItemTargets(Entity *pokemon, Item *item, Position potential } if (distance <= 10) { - Position *newPotentialTarget; + DungeonPos *newPotentialTarget; if (!ignoreRollChance) { u32 itemWeight = GetAIUseItemProbability(targetPokemon, item, ITEM_TARGET_OTHER); diff --git a/src/dungeon_ai_leader.c b/src/dungeon_ai_leader.c index 5717ea90c..5c1204ac1 100644 --- a/src/dungeon_ai_leader.c +++ b/src/dungeon_ai_leader.c @@ -50,7 +50,7 @@ void sub_8041888(u8 param_1); void sub_8085140(void); void sub_807360C(void); void sub_805EFB4(Entity *, u8); -void sub_8074FB0(Entity *, u8, Position *); +void sub_8074FB0(Entity *, u8, DungeonPos *); void HandlePlaceItemAction(Entity *); void HandlePickUpPlayerAction(Entity *); @@ -72,7 +72,7 @@ extern u8 sub_8044B28(void); extern u8 UseAttack(Entity *); void sub_806A1E8(Entity *pokemon); extern void sub_80694C0(Entity *, s32, s32, u32); -bool8 sub_804AE08(Position *pos); +bool8 sub_804AE08(DungeonPos *pos); void HandlePickUpAIAction(Entity *pokemon); void HandleThrowItemAIAction(Entity *pokemon); void HandleEatAIAction(Entity *pokemon); @@ -114,8 +114,8 @@ bool8 sub_8072CF4(Entity *entity) s32 index; EntityInfo *info; bool8 bVar14; - Position pos; - Position pos1; + DungeonPos pos; + DungeonPos pos1; sub_804178C(1); gUnknown_203B434 = 1; diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c index ea641c4e9..e6e435246 100644 --- a/src/dungeon_ai_movement.c +++ b/src/dungeon_ai_movement.c @@ -556,7 +556,7 @@ bool8 AvoidEnemies(Entity *pokemon) struct Tile *tile = GetTile(pokemon->pos.x, pokemon->pos.y); if (tile->terrainType & TERRAIN_TYPE_NATURAL_JUNCTION) { - Position aiTargetPos; + DungeonPos aiTargetPos; s32 targetDir; aiTargetPos.x = pokemon->pos.x; aiTargetPos.y = pokemon->pos.y; @@ -593,7 +593,7 @@ bool8 AvoidEnemies(Entity *pokemon) // If there are any room exits that the Pokémon can head towards without moving // closer to the target, head towards the furthest eligible exit. s32 naturalJunctionListCounts; - Position *naturalJunctionList = gDungeon->naturalJunctionList[room]; + DungeonPos *naturalJunctionList = gDungeon->naturalJunctionList[room]; s32 furthestTargetExitIndex; s32 furthestTargetToExitDistance; s32 distanceX; @@ -735,7 +735,7 @@ bool8 Wander(Entity *pokemon) else { s32 naturalJunctionListCounts = gDungeon->naturalJunctionListCounts[room]; - Position *naturalJunctionList = gDungeon->naturalJunctionList[room]; + DungeonPos *naturalJunctionList = gDungeon->naturalJunctionList[room]; if (pokemonInfo->moveRandomly) { s32 targetFacingDir = DungeonRandInt(NUM_DIRECTIONS); diff --git a/src/dungeon_ai_targeting.c b/src/dungeon_ai_targeting.c index 163b12173..1088795b3 100644 --- a/src/dungeon_ai_targeting.c +++ b/src/dungeon_ai_targeting.c @@ -62,7 +62,7 @@ const u8 gTreatmentData[3][2][2][2] = { } }; -bool8 sub_8070F3C(Entity * pokemon, Position *pos, s32 direction) +bool8 sub_8070F3C(Entity * pokemon, DungeonPos *pos, s32 direction) { u8 terrain; struct Tile *tile; diff --git a/src/dungeon_cutscenes.c b/src/dungeon_cutscenes.c index a0437d50e..0a08d442f 100644 --- a/src/dungeon_cutscenes.c +++ b/src/dungeon_cutscenes.c @@ -387,16 +387,16 @@ extern void sub_8041888(u32); extern u32 sub_80861F8(u32, Entity *, u32); extern u8 sub_80860A8(u32); extern void sub_8052D44(s16 *, Entity *, Entity *); -extern void sub_80464C8(Entity *, Position *, Item *); +extern void sub_80464C8(Entity *, DungeonPos *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); -extern u32 sub_8085EC8(u32, u32, u32, Position *, u32); +extern u32 sub_8085EC8(u32, u32, u32, DungeonPos *, u32); extern void sub_807EAA0(u32, u32); extern void sub_8072008(Entity *, Entity *, s16, u32, u32); extern void sub_8085374(void); extern void sub_8045C28(Item *, u8 , u8 *); -extern void sub_8046860(Entity *, Position *, Item *, u32); +extern void sub_8046860(Entity *, DungeonPos *, Item *, u32); extern u32 sub_803D73C(u32); -extern void sub_80460F8(Position *, Item *, u8); +extern void sub_80460F8(DungeonPos *, Item *, u8); extern u8 sub_8044B28(void); extern bool8 sub_8085B80(struct_8085B80 *); @@ -453,7 +453,7 @@ void MoltresScreenFlash2(s32 r0, s32 r1); void MoltresScreenFlash3(void); void MoltresScreenDarken(void); void EnableJirachiWishWarpTile(void); -void sub_808BB3C(Position *pos); +void sub_808BB3C(DungeonPos *pos); void sub_8087144(); void SkarmoryEntry(Entity *); @@ -561,8 +561,8 @@ void SkarmoryPreFightDialogue(void) Entity * diglettEntity; Entity * skarmoryEntity; - Position32 pos1; - Position32 pos2; + PixelPos pos1; + PixelPos pos2; leaderEntity = xxx_call_GetLeader(); // Player partnerEntity = GetPartnerEntity(); // Partner @@ -618,7 +618,7 @@ void SkarmoryReFightDialogue(void) { Entity * leaderEntity; Entity * skarmoryEntity; - Position32 pos; + PixelPos pos; leaderEntity = xxx_call_GetLeader(); skarmoryEntity = GetEntityFromMonsterBehavior(BEHAVIOR_SKARMORY); @@ -2123,7 +2123,7 @@ void MagmaCavernMidDialogue(void) Entity * groudonEntity; Entity * alakazamEntity; s16 IDStack [2]; - Position32 pos; + PixelPos pos; leaderEntity = xxx_call_GetLeader(); partnerEntity = GetPartnerEntity(); @@ -3314,7 +3314,7 @@ void HoOhPreFightDialogue(void) { Entity * leaderEntity; Entity * HoOhEntity; - Position32 local_14; + PixelPos local_14; leaderEntity = xxx_call_GetLeader(); HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH); @@ -3353,7 +3353,7 @@ void HoOhReFightDialogue(void) { Entity * leaderEntity; Entity * HoOhEntity; - Position32 local_14; + PixelPos local_14; leaderEntity = xxx_call_GetLeader(); HoOhEntity = GetEntityFromMonsterBehavior(BEHAVIOR_HO_OH); @@ -3494,8 +3494,8 @@ void LatiosPreFightDialogue(void) { Entity * leaderEntity; Entity * LatiosEntity; - Position32 local_18; - Position local_19; + PixelPos local_18; + DungeonPos local_19; leaderEntity = xxx_call_GetLeader(); LatiosEntity = GetEntityFromMonsterBehavior(BEHAVIOR_LATIOS); @@ -3652,7 +3652,7 @@ void sub_808ADCC(void) } } -void sub_808AE54(u8 param_1,u8 param_2,Position *param_3) +void sub_808AE54(u8 param_1,u8 param_2,DungeonPos *param_3) { Entity * leaderEntity; s16 IDStack[2]; @@ -3675,7 +3675,7 @@ void sub_808AE54(u8 param_1,u8 param_2,Position *param_3) } -void sub_808AEC8(u8 param_1,u8 param_2,Position *param_3) +void sub_808AEC8(u8 param_1,u8 param_2,DungeonPos *param_3) { Entity * leaderEntity; s16 IDStack[2]; @@ -3697,7 +3697,7 @@ void sub_808AEC8(u8 param_1,u8 param_2,Position *param_3) } } -void sub_808AF3C(u8 param_1,u8 param_2,Position *param_3) +void sub_808AF3C(u8 param_1,u8 param_2,DungeonPos *param_3) { Entity * leaderEntity; s16 IDStack[2]; @@ -3813,7 +3813,7 @@ void sub_808B1CC(u8 itemID) { Entity *entity; Tile *tile; - Position pos; + DungeonPos pos; Item item; pos.x = gDungeon->unk644.unk40; @@ -3992,7 +3992,7 @@ void JirachiWish(void) { u8 friendArea; Entity *jirachiEntity; - Position *LeaderPos; + DungeonPos *LeaderPos; Entity *leaderEntity; s32 wishChoice; s32 counter; @@ -4001,9 +4001,9 @@ void JirachiWish(void) Item auStack152 [9]; Item itemStack [9]; Item strengthItems [9]; - Position pos1; - Position pos2; - Position pos3; + DungeonPos pos1; + DungeonPos pos2; + DungeonPos pos3; jirachiEntity = GetEntityFromMonsterBehavior(BEHAVIOR_JIRACHI); CopyMonsterNameToBuffer(gFormatBuffer_Monsters[2], MONSTER_JIRACHI); @@ -4220,14 +4220,14 @@ void JirachiWishGrantFlash(void) sub_8085EB0(); } -void sub_808BB3C(Position *pos1) +void sub_808BB3C(DungeonPos *pos1) { #ifndef NONMATCHING register s32 iVar1 asm("r0"); #else s32 iVar1; #endif - Position newPos; + DungeonPos newPos; iVar1 = pos1->x * 0x1800 + 0xc00; newPos.x = iVar1 / 256; diff --git a/src/dungeon_items.c b/src/dungeon_items.c index b2eb9ffb7..84d27fab5 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -20,7 +20,7 @@ extern u8 *gUnknown_8105360[]; extern u8 *gUnknown_81053A8[]; extern u8 *gUnknown_8105434[]; -extern void sub_80416E0(Position32 *r0, u32, bool8); +extern void sub_80416E0(PixelPos *r0, u32, bool8); extern void sub_80855E4(void *); extern void PlaySoundEffect(u32); extern void sub_804178C(u32); diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index 4c377963d..98561554d 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -763,9 +763,9 @@ void sub_804A49C(s32 a0, s32 a1) sub_80098F8(3); } -void sub_804A728(Position *pos, s32 a1, u8 a2, u8 a3) +void sub_804A728(DungeonPos *pos, s32 a1, u8 a2, u8 a3) { - Position spArray[6]; + DungeonPos spArray[6]; u16 *src; s32 k; Entity *leader; @@ -774,7 +774,7 @@ void sub_804A728(Position *pos, s32 a1, u8 a2, u8 a3) s32 r5; s32 r10; s32 r9; - Position var_48; + DungeonPos var_48; s32 var_38, var_34; s32 x, x2, y; Dungeon *dungeon = gDungeon; @@ -983,7 +983,7 @@ void sub_804AAD4(void) gDungeon->unk104C0 = maxRooms + 1; } -void sub_804AC20(Position *pos) +void sub_804AC20(DungeonPos *pos) { s32 y; struct Tile *tile2; diff --git a/src/dungeon_message.c b/src/dungeon_message.c index 40f574d6f..610caeb7f 100644 --- a/src/dungeon_message.c +++ b/src/dungeon_message.c @@ -167,7 +167,8 @@ void TryDisplayDungeonLoggableMessage4(Entity *attacker, Entity *target, const u } } -void TryDisplayDungeonLoggableMessage5(Entity *pokemon, Position *pos, const u8 *str) +void TryDisplayDungeonLoggableMessage5(Entity *pokemon, DungeonPos *pos, + const u8 *str) { u8 flag; flag = sub_8045888(pokemon) ? TRUE : FALSE; @@ -416,7 +417,7 @@ void DisplayDungeonLoggableMessage(Entity *pokemon, const u8 *str) struct Struct_sub_808CDB0 { - Position pos; + DungeonPos pos; bool8 flip; }; diff --git a/src/dungeon_move.c b/src/dungeon_move.c index f82b768ed..d474afabd 100644 --- a/src/dungeon_move.c +++ b/src/dungeon_move.c @@ -55,14 +55,14 @@ extern void sub_80428A0(Entity *r0); extern bool8 sub_8040BB0(Entity *entity, Move *move, bool8); extern void sub_8040DA0(Entity *entity, Move *move); extern u16 sub_80412E0(u16 moveId, u8 weather, u8 a2); -extern void sub_800569C(Position *, axdata *, u8); +extern void sub_800569C(DungeonPos *, axdata *, u8); extern u8 GetBodySize(s16 index); extern void sub_800EF10(u16 r0); extern s32 sub_800E710(s16 a0, u16 a1); -extern void sub_800E3AC(s32 a0, Position *pos, s32 a2); -extern void sub_8041168(Entity *entity, Entity *entity2, Move *,Position *); +extern void sub_800E3AC(s32 a0, DungeonPos *pos, s32 a2); +extern void sub_8041168(Entity *entity, Entity *entity2, Move *,DungeonPos *); extern Entity *sub_80696A8(Entity *a0); -extern Entity *GetMonsterAtPos(Position *pos); +extern Entity *GetMonsterAtPos(DungeonPos *pos); extern Entity *sub_80696FC(Entity *); extern Entity *sub_806977C(Entity *); extern void sub_806F2BC(Entity *attacker, Entity *target, u8 moveType, s32 a2, struct DamageStruct *dmgStruct); @@ -2265,13 +2265,13 @@ struct UnkStruct_sub_800E308_1 { s16 unk0; s16 unk2; - Position unk4; - Position unk8; + DungeonPos unk4; + DungeonPos unk8; s32 unkC; s32 unk10; }; -// Maybe Position? Maybe not, sub_800E308 is called only by sub_8056564, so :shrug: +// Maybe DungeonPos? Maybe not, sub_800E308 is called only by sub_8056564, so :shrug: struct UnkStruct_sub_800E308_2 { s16 u0; @@ -2281,7 +2281,7 @@ struct UnkStruct_sub_800E308_2 extern s32 sub_800E308(struct UnkStruct_sub_800E308_1 *, struct UnkStruct_sub_800E308_2 *); #ifdef NONMATCHING // https://decomp.me/scratch/fTUsI -s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4) +s32 sub_8056564(Entity *entity, DungeonPos *pos, Move *move, s32 r4) { struct UnkStruct_sub_800E308_1 unkSp1; struct UnkStruct_sub_800E308_2 unkSp2; @@ -2291,7 +2291,7 @@ s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4) unkStruct_80BDBC4 *unkStruct = sub_800ECB8(sub_80412E0(move->id, GetApparentWeather(entity), 1)); s32 unk6 = unkStruct->unk6; // This part with unkPos doesn't match - Position32 unkPos = {pos->x * 0x1800, pos->y * 0x1800}; + PixelPos unkPos = {pos->x * 0x1800, pos->y * 0x1800}; unkPos.x += 0x1000; unkPos.y += 0xC00; @@ -2311,7 +2311,7 @@ s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4) someRetVal); } else { - unkSp1.unk8 = (Position) {0}; + unkSp1.unk8 = (DungeonPos) {0}; } unkSp1.unk0 = sub_80412E0(move->id, GetApparentWeather(entity), 1); unkSp1.unk2 = entInfo->apparentID; @@ -2327,7 +2327,7 @@ s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4) return -1; } #else -NAKED s32 sub_8056564(Entity *entity, Position *pos, Move *move, s32 r4) +NAKED s32 sub_8056564(Entity *entity, DungeonPos *pos, Move *move, s32 r4) { asm_unified("push {r4-r7,lr}\n" " mov r7, r9\n" @@ -2541,8 +2541,8 @@ static const s32 gUnknown_81069D4[NUM_DIRECTIONS] = // This function looks important, but what does it do? void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32 isLinkedMove) { - Position var_68; - Position var_64; + DungeonPos var_68; + DungeonPos var_64; Entity *targetsArray[2]; // Only 2 hmm s32 var_4C, var_48; s32 i, j; @@ -2621,7 +2621,7 @@ void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32 for (i = 0; i < a2; i++) { - Position var_68Before; + DungeonPos var_68Before; Tile *tile; if (var_68.x < 0 || var_68.y < 0 || var_68.x > 55 || var_68.y > 31) @@ -2631,7 +2631,7 @@ void sub_80566F8(Entity *attacker, Move *move, s32 a2, bool8 a3, s32 itemId, s32 var_68.x += var_4C; var_68.y += var_48; if (sub_803F428(&var_68) && !gDungeon->unk181e8.blinded) { - Position32 pos32; + PixelPos pos32; pos32.x = (var_68Before.x * 0x1800) + 0xC00; pos32.y = (var_68Before.y * 0x1800) + 0x1000; var_28 = var_30 * (var_4C << 8); @@ -2828,7 +2828,7 @@ static void SetTargetsForMove(Entity **targetsArray, Entity *attacker, Move *mov } for (i = 0; i < to; i++, direction++) { Entity *targetEntity; - Position unkPositon; + DungeonPos unkPositon; direction &= DIRECTION_MASK; unkPositon.x = attacker->pos.x + gAdjacentTileOffsets[direction].x ; diff --git a/src/dungeon_movement.c b/src/dungeon_movement.c index c53e8b06e..70442bfbe 100644 --- a/src/dungeon_movement.c +++ b/src/dungeon_movement.c @@ -66,7 +66,7 @@ u8 sub_807034C(s16 id, struct Tile *tile) return TRUE; } -u8 sub_80703A0(Entity *pokemon, Position *pos) +u8 sub_80703A0(Entity *pokemon, DungeonPos *pos) { struct Tile *tile; u8 crossableTerrain; @@ -128,7 +128,7 @@ bool8 CanCrossWalls(Entity *pokemon) return FALSE; } -bool8 sub_807049C(Entity *pokemon, Position *pos) +bool8 sub_807049C(Entity *pokemon, DungeonPos *pos) { s32 crossableTerrain; struct Tile *tile; @@ -170,7 +170,7 @@ bool8 sub_807049C(Entity *pokemon, Position *pos) return TRUE; } -bool8 sub_8070564(Entity *pokemon, Position *pos) +bool8 sub_8070564(Entity *pokemon, DungeonPos *pos) { u8 crossableTerrain; struct Tile *tile; @@ -216,7 +216,7 @@ bool8 sub_8070564(Entity *pokemon, Position *pos) return TRUE; } -bool8 sub_80705F0(Entity *pokemon, Position *pos) +bool8 sub_80705F0(Entity *pokemon, DungeonPos *pos) { s32 crossableTerrain; struct Tile *tile; @@ -256,7 +256,7 @@ bool8 sub_80705F0(Entity *pokemon, Position *pos) return TRUE; } -bool8 sub_80706A4(Entity *pokemon, Position *pos) +bool8 sub_80706A4(Entity *pokemon, DungeonPos *pos) { s32 crossableTerrain; struct Tile *tile; diff --git a/src/dungeon_range.c b/src/dungeon_range.c index 6cd4a3941..f06338f4a 100644 --- a/src/dungeon_range.c +++ b/src/dungeon_range.c @@ -5,7 +5,7 @@ #include "dungeon_map_access.h" #include "structs/map.h" -bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2) +bool8 IsPositionActuallyInSight(DungeonPos *pos1, DungeonPos *pos2) { u8 pos1Room; u8 visibility = gDungeon->unk181e8.visibilityRange; @@ -47,7 +47,7 @@ bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2) } } -bool8 IsPositionInSight(Position *pos1, Position *pos2) +bool8 IsPositionInSight(DungeonPos *pos1, DungeonPos *pos2) { struct Tile *tile; u8 pos1Room; @@ -97,7 +97,7 @@ returnFalse: return TRUE; } -void sub_80833E8(Position *param_1, s32 *param_2) +void sub_80833E8(DungeonPos *param_1, s32 *param_2) { struct Tile *tile; struct RoomData *mapRoom; @@ -125,7 +125,7 @@ void sub_80833E8(Position *param_1, s32 *param_2) } } -bool8 IsTargetTwoTilesAway(Position *pos1, Position *pos2) +bool8 IsTargetTwoTilesAway(DungeonPos *pos1, DungeonPos *pos2) { s32 i; struct Tile *tile; diff --git a/src/dungeon_serializer.c b/src/dungeon_serializer.c index 5b0a886f2..2e290f492 100644 --- a/src/dungeon_serializer.c +++ b/src/dungeon_serializer.c @@ -14,7 +14,7 @@ extern u8 gUnknown_202EE70[MAX_TEAM_BODY_SIZE]; extern u8 gUnknown_202EE76[DUNGEON_MAX_WILD_POKEMON_BODY_SIZE]; -extern Position gUnknown_203B410; +extern DungeonPos gUnknown_203B410; extern Entity *gLeaderPointer; // 203B450 #include "data/dungeon_serializer.h" @@ -66,7 +66,7 @@ static s32 ReadSpeedStage(DataSerializer *seri); static u8 ReadTactic(DataSerializer *seri); static u8 ReadDecoyAITracker(DataSerializer *seri); static void ReadTile(DataSerializer *seri, Tile *dst); -static void ReadTilePos(DataSerializer *seri, Position *dst); +static void ReadTilePos(DataSerializer *seri, DungeonPos *dst); static void ReadInvisibleClassStatus(DataSerializer *seri, InvisibleClassStatus *dst); static u8 ReadType(DataSerializer *seri); static u16 ReadU16(DataSerializer *seri); @@ -112,7 +112,7 @@ static void WriteSureShotClassStatus(DataSerializer *seri, SureShotClassStatus* static void WriteMuzzled(DataSerializer *seri, Muzzled *src); static void WriteBurnClassStatus(DataSerializer *seri, BurnClassStatus *src); static void WriteReflectClassStatus(DataSerializer *seri, ReflectClassStatus *src); -static void WriteTilePos(DataSerializer *seri, Position *src); +static void WriteTilePos(DataSerializer *seri, DungeonPos *src); static void WriteS16(DataSerializer *seri, s16 value); static void WriteSleepClassStatus(DataSerializer *seri, SleepClassStatus* src); static void WriteSpeedCounters(DataSerializer *seri, u8 *src, u32 numCounters); @@ -134,7 +134,7 @@ static Entity* sub_8082A08(s16 id, s16 apparentID, s32 index); // These externs are from other files extern u8 GetBodySize(s16 index); -extern void sub_80460F8(Position *, Item *, u32); +extern void sub_80460F8(DungeonPos *, Item *, u32); void SaveDungeonState(u8 *buffer, u32 bufLen) { @@ -868,7 +868,7 @@ static void ReadDungeonItems(DataSerializer *seri) { s32 i; Item item; - Position pos; + DungeonPos pos; ReadBlame(seri, sMisakiSan); @@ -894,7 +894,7 @@ static void ReadDungeonTraps(DataSerializer *seri) s32 counter; Tile *tile; Entity *entity; - Position pos; + DungeonPos pos; u8 isVisible; u8 unk1; u8 trapID; @@ -952,7 +952,7 @@ static void ReadMonster(DataSerializer *seri, bool8 isTeamMember, s32 index) s32 i; EntityInfo *monEntInfo; EntityInfo entInfo = {0}; - Position monPos; + DungeonPos monPos; bool8 shouldSpawnMon; u32 monIsVisible; u32 spawnGenID; @@ -1245,7 +1245,7 @@ void sub_8082B40(void) EntityInfo *info; Entity *entity; s32 i; - Position pos; + DungeonPos pos; for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { entity = gDungeon->activePokemon[i]; @@ -1627,7 +1627,7 @@ static void WriteBool8(DataSerializer *seri, bool8 value) WriteBytes(seri, &local_8, 1); } -static void WriteTilePos(DataSerializer *seri, Position *src) +static void WriteTilePos(DataSerializer *seri, DungeonPos *src) { WriteBytes(seri, &src->x, 1); WriteBytes(seri, &src->y, 1); @@ -1708,7 +1708,7 @@ static bool8 ReadBool8(DataSerializer *seri) return local_8 != 0; } -static void ReadTilePos(DataSerializer *seri, Position *dst) +static void ReadTilePos(DataSerializer *seri, DungeonPos *dst) { dst->x = 0; dst->y = 0; @@ -1739,4 +1739,4 @@ static void ReadDungeonUnkE260(DataSerializer *seri, unkDungeonE260 *dst) static void ReadSpeedCounters(DataSerializer *seri, u8 *dst, u32 numCounters) { ReadBytes(seri, dst, numCounters); -} \ No newline at end of file +} diff --git a/src/dungeon_util.c b/src/dungeon_util.c index eebc9cbdb..096b35346 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -15,7 +15,7 @@ void sub_806C51C(Entity *entity); extern void sub_80462AC(Entity * ,u32, u32, u32, u32); extern void sub_807FA9C(); -const Position gAdjacentTileOffsets[] = { +const DungeonPos gAdjacentTileOffsets[] = { {0, 1}, {1, 1}, {1, 0}, @@ -177,7 +177,7 @@ void sub_804522C(void) { } } -void sub_804535C(Entity *entity, Position32 *pos) +void sub_804535C(Entity *entity, PixelPos *pos) { if (pos != NULL) { diff --git a/src/dungeon_util_1.c b/src/dungeon_util_1.c index d863debc7..70b4ee48a 100644 --- a/src/dungeon_util_1.c +++ b/src/dungeon_util_1.c @@ -248,7 +248,7 @@ void sub_8085890(s32 x, s32 y) sub_803F878(x, y); } -void ShiftCameraToPosition(Position32 *posStruct, s32 cameraSteps) +void ShiftCameraToPosition(PixelPos *posStruct, s32 cameraSteps) { s32 XPos; s32 YPos; diff --git a/src/dungeon_visibility.c b/src/dungeon_visibility.c index f2c862684..9697ba396 100644 --- a/src/dungeon_visibility.c +++ b/src/dungeon_visibility.c @@ -69,12 +69,12 @@ bool8 sub_8045A70(Entity *entity, Entity *targetEntity) return FALSE; } -bool8 sub_8045AAC(Entity *entity, Position *pos) +bool8 sub_8045AAC(Entity *entity, DungeonPos *pos) { return IsPositionActuallyInSight(&entity->pos, pos); } -bool8 CanTargetPosition(Entity *entity, Position *pos) +bool8 CanTargetPosition(Entity *entity, DungeonPos *pos) { return IsPositionInSight(&entity->pos, pos); } diff --git a/src/ground_script_1.c b/src/ground_script_1.c index f426bf597..aa340e4f9 100644 --- a/src/ground_script_1.c +++ b/src/ground_script_1.c @@ -52,7 +52,7 @@ void FatalError(void* loc, char* fmt, ...) __attribute__((noreturn)); char sub_8002984(s32, u8); u32 VecDirection8Radial(); u32 SizedDeltaDirection4(); -u8 SizedDeltaDirection8(Position32*, Position32*, Position32*, Position32*); +u8 SizedDeltaDirection8(PixelPos*, PixelPos*, PixelPos*, PixelPos*); bool8 sub_8021700(s32); bool8 sub_802FCF0(void); @@ -93,13 +93,13 @@ s32 HasItemInInventory(u8); u32 sub_809CC90(); void sub_809D0BC(void); void sub_809D124(s32, s32, s32); -void sub_809D158(s32, Position32*); +void sub_809D158(s32, PixelPos*); void sub_809D170(s32, s32); -void sub_809D190(s32, Position32*, s32); +void sub_809D190(s32, PixelPos*, s32); void sub_809D1A8(s32, s32, s32); -void sub_809D1CC(s32, Position32*, s32); +void sub_809D1CC(s32, PixelPos*, s32); void sub_809D1E4(s32, s32, s32); -void sub_809D208(s32, Position32*, s32); +void sub_809D208(s32, PixelPos*, s32); void sub_809D220(s32, s32, s32); u32 sub_809D52C(); bool8 GroundCancelAllEntities(void); @@ -111,14 +111,14 @@ void sub_80A8BD8(s16, s32*); u32 sub_80A8C2C(); u32 sub_80A8C98(); char *sub_80A8D54(s16); -s16 sub_80A8FD8(s32, Position32*); -s16 sub_80A8F9C(s32, Position32*); +s16 sub_80A8FD8(s32, PixelPos*); +s16 sub_80A8F9C(s32, PixelPos*); u32 sub_80A9050(); u32 sub_80A9090(); -s16 sub_80AC448(s16, Position32*); -s32 sub_80AC49C(s16, Position32*); -s16 sub_80AD360(s16, Position32*); -s16 sub_80AD3B4(s16, Position32*); +s16 sub_80AC448(s16, PixelPos*); +s32 sub_80AC49C(s16, PixelPos*); +s16 sub_80AD360(s16, PixelPos*); +s16 sub_80AD3B4(s16, PixelPos*); u32 GroundLink_GetPos(); u32 GroundLink_GetArea(); void DeleteGroundEvents(void); @@ -139,7 +139,7 @@ extern struct { const char *unk0; s32 unk4; } gChoices[9]; extern char gUnknown_2039D98[12]; extern int gNumChoices; -extern Position32 gUnknown_81164DC; +extern PixelPos gUnknown_81164DC; extern char gUnknown_81165D4[]; extern char gUnknown_81165F4[]; extern char gUnknown_811660C[]; @@ -404,7 +404,7 @@ s32 ExecuteScriptCommand(Action *action) { case 0x19: { s8 unk[4]; GroundObjectData *obj; - Position32 pos; + PixelPos pos; s16 res; s32 group; s32 sector; @@ -431,7 +431,7 @@ s32 ExecuteScriptCommand(Action *action) { case 0x1a: { s8 unk; GroundEffectData *eff; - Position32 pos; + PixelPos pos; s16 res; s32 group; s32 sector; @@ -541,10 +541,10 @@ s32 ExecuteScriptCommand(Action *action) { case 0x21: { s32 ret; s32 unk; - Position32 pos1; - Position32 pos2; - Position32 pos3; - Position32 pos4; + PixelPos pos1; + PixelPos pos2; + PixelPos pos3; + PixelPos pos4; s32 tmp; ret = (s16)sub_80A7AE8((s16)curCmd.arg1); if (ret >= 0) { @@ -864,7 +864,7 @@ s32 ExecuteScriptCommand(Action *action) { } case 0x50: { Action *ptr; - Position32 pos; + PixelPos pos; s8 c; { Action *tmp = (Action*)sub_809D52C(action->unkC.arr); @@ -880,9 +880,9 @@ s32 ExecuteScriptCommand(Action *action) { break; } case 0x51: { - Position32 posIn; - Position32 posOut1; - Position32 posOut2; + PixelPos posIn; + PixelPos posOut1; + PixelPos posOut2; action->callbacks->getHitboxCenter(action->parentObject, &posIn); GroundLink_GetArea(curCmd.argShort, &posOut1, &posOut2, &posIn); action->callbacks->setPositionBounds(action->parentObject, &posOut1, &posOut2); @@ -920,7 +920,7 @@ s32 ExecuteScriptCommand(Action *action) { break; } case 0x58: { - Position32 unk; + PixelPos unk; unk.x = curCmd.arg1 << 8; unk.y = curCmd.arg2 << 8; action->callbacks->moveReal(action->parentObject, &unk); @@ -928,7 +928,7 @@ s32 ExecuteScriptCommand(Action *action) { return 2; } case 0x59: { - Position32 unk; + PixelPos unk; unk.x = curCmd.argShort << 8; unk.y = curCmd.arg1 << 8; action->callbacks->moveRelative(action->parentObject, &unk); @@ -939,12 +939,13 @@ s32 ExecuteScriptCommand(Action *action) { u32 unk[2]; unk[0] = OtherRandInt(curCmd.argShort) << 8; unk[1] = OtherRandInt(curCmd.arg1) << 8; - action->callbacks->moveRelative(action->parentObject, (Position32*)unk); + action->callbacks->moveRelative(action->parentObject, + (PixelPos*)unk); scriptData->unk2A = (u8)curCmd.argByte; return 2; } case 0x5b: { - Position32 unk; + PixelPos unk; action->callbacks->getHitboxCenter(action->parentObject, &unk); GroundLink_GetPos((s16)curCmd.arg1, &unk); action->callbacks->moveReal(action->parentObject, &unk); // landing end of unwanted tailmerge @@ -952,7 +953,7 @@ s32 ExecuteScriptCommand(Action *action) { return 2; } case 0x5c: { - Position32 pos, pos1, pos2; + PixelPos pos, pos1, pos2; action->callbacks->getHitboxCenter(action->parentObject, &pos); GroundLink_GetArea((s16)curCmd.arg1, &pos1, &pos2, &pos); pos.x = pos1.x + OtherRandInt(pos2.x - pos1.x); @@ -962,7 +963,7 @@ s32 ExecuteScriptCommand(Action *action) { return 2; } case 0x5d: { - Position32 unk; + PixelPos unk; s16 res = sub_80A7AE8((s16)curCmd.arg1); if (res >= 0) { sub_80A8FD8(res, &unk); @@ -973,7 +974,7 @@ s32 ExecuteScriptCommand(Action *action) { break; } case 0x5e: { - Position32 pos; + PixelPos pos; s32 height; s32 dir; pos.x = GetScriptVarArrayValue(NULL, POSITION_X, (u16)curCmd.arg1); @@ -992,7 +993,7 @@ s32 ExecuteScriptCommand(Action *action) { return 2; } case 0x5f: { - Position32 pos; + PixelPos pos; u32 height; u32 wat; s8 dir; @@ -1018,7 +1019,7 @@ s32 ExecuteScriptCommand(Action *action) { return 2; } case 0x62: case 0x6a: { - Position32 pos; + PixelPos pos; action->callbacks->getHitboxCenter(action->parentObject, &pos); scriptData->pos2.x = pos.x + (curCmd.arg1 << 8); scriptData->pos2.y = pos.y + (curCmd.arg2 << 8); @@ -1196,7 +1197,7 @@ s32 ExecuteScriptCommand(Action *action) { case 0x8e: case 0x8f: case 0x90: { bool8 flag = FALSE; s8 dir; - Position32 pos1, pos2, pos3, pos4; + PixelPos pos1, pos2, pos3, pos4; switch (curCmd.op) { case 0x8e: { s32 val = (s16)sub_80A7AE8((s16)curCmd.arg1); @@ -1282,7 +1283,7 @@ s32 ExecuteScriptCommand(Action *action) { } case 0x99: { s32 id = action->callbacks->getIndex(action->parentObject); - Position32 unk; + PixelPos unk; switch(action->unk8[0]) { case 1: sub_80A8FD8(id, &unk); @@ -1321,7 +1322,7 @@ s32 ExecuteScriptCommand(Action *action) { } case 0x9c: { s32 id = action->callbacks->getIndex(action->parentObject); - Position32 unk; + PixelPos unk; switch(action->unk8[0]) { case 1: sub_80A8FD8(id, &unk); @@ -1360,7 +1361,7 @@ s32 ExecuteScriptCommand(Action *action) { } case 0x9f: { s32 id = action->callbacks->getIndex(action->parentObject); - Position32 unk; + PixelPos unk; switch(action->unk8[0]) { case 1: sub_80A8FD8(id, &unk); @@ -1399,7 +1400,7 @@ s32 ExecuteScriptCommand(Action *action) { } case 0xa2: { s32 id = action->callbacks->getIndex(action->parentObject); - Position32 unk; + PixelPos unk; switch(action->unk8[0]) { case 1: sub_80A8FD8(id, &unk); @@ -1571,7 +1572,7 @@ s32 ExecuteScriptCommand(Action *action) { } case 0xc0 ... 0xcb: { s32 val; - Position32 pos, pos2, pos3; + PixelPos pos, pos2, pos3; switch (curCmd.op) { case 0xc0: { val = GetScriptVarValue(scriptData->localVars.buf, curCmd.argShort); @@ -1625,7 +1626,7 @@ s32 ExecuteScriptCommand(Action *action) { case 0xc8: { s16 tmp = (s16)sub_80A7AE8((s16)curCmd.arg1); if (tmp >= 0) { - Position32 pos1, pos2, pos3, pos4; + PixelPos pos1, pos2, pos3, pos4; action->callbacks->getHitboxCenter(action->parentObject, &pos1); action->callbacks->getSize(action->parentObject, &pos2); sub_80A8FD8(tmp, &pos3); @@ -1642,7 +1643,7 @@ s32 ExecuteScriptCommand(Action *action) { case 0xc9: { s16 tmp = (s16)sub_80A7AE8((s16)curCmd.arg1); if (tmp >= 0) { - Position32 pos1, pos2, pos3; + PixelPos pos1, pos2, pos3; action->callbacks->getHitboxCenter(action->parentObject, &pos1); action->callbacks->getSize(action->parentObject, &pos2); sub_80A8FD8(tmp, &pos3); diff --git a/src/menu_input.c b/src/menu_input.c index 40e1245ab..e2a867cc5 100644 --- a/src/menu_input.c +++ b/src/menu_input.c @@ -66,7 +66,7 @@ const s32 gUnknown_80D4830[9] = { extern s16 sub_8009614(u32, u32); static void sub_8013134(MenuInputStruct *, u32, u32); -static void sub_801332C(Position *a0); +static void sub_801332C(DungeonPos *a0); static void sub_8013470(MenuInputStruct *); static bool8 sub_8013DD0(unkStructFor8013AA0 *); @@ -716,8 +716,8 @@ void nullsub_34(MenuInputStructSub *a0, s32 a1) { } -// Maybe Position -static void sub_801332C(Position *a0) +// Maybe DungeonPos +static void sub_801332C(DungeonPos *a0) { SpriteOAM sp = {}; SpriteOAM* ptr; diff --git a/src/move_actions.c b/src/move_actions.c index 1a2d20ecd..3226a0a5e 100644 --- a/src/move_actions.c +++ b/src/move_actions.c @@ -183,17 +183,18 @@ void sub_8075900(Entity *pokemon, u8 r1); extern u8 sub_8044B28(void); extern void sub_807EC28(bool8); extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); -extern void sub_804652C(Entity *, Entity *, Item *, u32, Position *); +extern void sub_804652C(Entity *, Entity *, Item *, u32, DungeonPos *); extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32); extern void sub_8045C28(Item *, u8 , u8); -static void sub_805A7D4(Entity *, Entity *, Item *, Position *); +static void sub_805A7D4(Entity *, Entity *, Item *, DungeonPos *); extern void MudWaterSportEffect(u32); extern void CalcDamage(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32); extern void sub_806A6E8(Entity *); extern void sub_806ABAC(Entity *, Entity *); extern u8 sub_806F4A4(Entity *, u32); -extern void sub_807DF38(Entity *pokemon, Entity *target, Position *pos, u32, u8 moveType, s16); +extern void sub_807DF38(Entity *pokemon, Entity *target, DungeonPos *pos, u32, + u8 moveType, s16); extern void nullsub_92(Entity *); extern u32 sub_8055864(Entity *pokemon, Entity *target, Move *param_3, s32 param_4, s32 param_5); extern u8 sub_807EAA0(u32, u32); @@ -2459,7 +2460,7 @@ bool8 sub_805A464(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool32 flag; Item item; - Position pos; + DungeonPos pos; flag = FALSE; if (HandleDamagingMove(pokemon, target, move, 0x100, param_4) != 0) { @@ -2592,7 +2593,7 @@ bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_ EntityInfo *entityInfo; EntityInfo *targetEntityInfo; Item heldItem; - Position pos; + DungeonPos pos; entityInfo = GetEntInfo(pokemon); targetEntityInfo = GetEntInfo(target); @@ -2632,7 +2633,8 @@ bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_ } } -static void sub_805A7D4(Entity * pokemon, Entity * target, Item *item, Position *pos) +static void sub_805A7D4(Entity * pokemon, Entity * target, Item *item, + DungeonPos *pos) { Entity stackEntity; @@ -2655,10 +2657,10 @@ bool8 sub_805A85C(Entity * pokemon, Entity * target, Move *move, u32 param_4) int x; int y; int counter; - Position *r9; - Position pos1; + DungeonPos *r9; + DungeonPos pos1; Move stackMove; - Position32 pos2; + PixelPos pos2; struct Tile *tile; Entity *entity; s32 temp; @@ -2735,9 +2737,9 @@ _0805A9FE: _0805AA5E: if (EntityExists(target)) { #ifndef NOMATCHING - register Position *pos asm("r1"); + register DungeonPos *pos asm("r1"); #else - Position *pos; + DungeonPos *pos; #endif sub_804535C(target, NULL); pos = r9; diff --git a/src/position_util.c b/src/position_util.c index 07fe6fb7e..159fc9aa7 100644 --- a/src/position_util.c +++ b/src/position_util.c @@ -9,7 +9,7 @@ const s32 gFacingDirMapping[3][3] = { {DIRECTION_SOUTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST} }; -s32 GetDirectionTowardsPosition(Position *originPos, Position *targetPos) +s32 GetDirectionTowardsPosition(DungeonPos *originPos, DungeonPos *targetPos) { s32 direction; s32 yDiff; @@ -44,7 +44,7 @@ s32 GetDirectionTowardsPosition(Position *originPos, Position *targetPos) return direction; } -s32 GetDistance(Position *pos1, Position *pos2) +s32 GetDistance(DungeonPos *pos1, DungeonPos *pos2) { s32 distanceX = pos1->x - pos2->x; s32 distance; diff --git a/src/sprite.c b/src/sprite.c index 8d5128655..4d943836c 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -12,7 +12,7 @@ static EWRAM_DATA s16 sUnknown_2025672[8] = {0}; UNUSED // TODO: Remove the "UNUSED" attribute after AddAxSprite is done #endif static EWRAM_DATA s16 sUnknown_2025682[9] = {0}; -static EWRAM_DATA Position sUnknown_2025694 = {0}; +static EWRAM_DATA DungeonPos sUnknown_2025694 = {0}; static EWRAM_DATA u32 sUnknown_2025698 = {0}; UNUSED static EWRAM_DATA u32 sUnused1 = {0}; // 202569C static EWRAM_DATA SpriteList sUnknown_20256A0 = {0}; @@ -755,7 +755,7 @@ void CopySpritesToOam(void) sOAMSpriteCount = count; } -void SetSavingIconCoords(Position *pos) +void SetSavingIconCoords(DungeonPos *pos) { if (pos == NULL) { sUnknown_2025694.x = 0; diff --git a/src/status_actions.c b/src/status_actions.c index 57f45fb5f..8df3e799f 100644 --- a/src/status_actions.c +++ b/src/status_actions.c @@ -39,14 +39,14 @@ extern void sub_807F43C(Entity *, Entity *); extern void sub_807DC68(Entity *, Entity *); extern u32 sub_803D73C(u32); extern void sub_8045C28(Item *, u8 , u8); -extern void sub_80464C8(Entity *, Position *, Item *); +extern void sub_80464C8(Entity *, DungeonPos *, Item *); extern void sub_8068FE0(Entity *, u32, Entity *r2); extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); -extern void sub_807FC3C(Position *, u32, u32); -extern void sub_8042A64(Position *); +extern void sub_807FC3C(DungeonPos *, u32, u32); +extern void sub_8042A64(DungeonPos *); extern void sub_8040A84(void); extern void sub_80498A8(s32, s32); -extern void sub_8042A54(Position *); +extern void sub_8042A54(DungeonPos *); extern void sub_8049BB0(s32, s32); extern s16 sub_8057600(Move*, u32); extern u32 sub_8055864(Entity *pokemon, Entity *target, Move *param_3, s32 param_4, s32 param_5); @@ -60,8 +60,8 @@ extern void sub_806BB6C(Entity *, s32); extern void sub_807E254(Entity *, Entity *, u32); extern u32 HandleDamagingMove(Entity *, Entity *, Move *, u32, u32); extern void sub_806A6E8(Entity *); -extern u8 sub_8069D18(Position *); -extern u8 sub_804AD34(Position *); +extern u8 sub_8069D18(DungeonPos *); +extern u8 sub_804AD34(DungeonPos *); // TODO include dungeon_ai.h when SqueezedStatusTarget is figured out extern void LowerDefenseStageTarget(Entity *, Entity *, s32, s32, u8, bool8); @@ -653,7 +653,7 @@ bool8 sub_805B968(Entity * pokemon, Entity * target, Move * move, s32 param_4) bool8 RockSmashMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { - Position pos; + DungeonPos pos; bool8 flag = FALSE; if (sub_8069D18(&pos) != 0) { @@ -947,7 +947,7 @@ bool8 TrapbustOrbAction(Entity * pokemon,Entity * target, Move *move, s32 param_ s32 xCoord, yCoord; struct RoomData *room; s32 topLeftCornerX, topLeftCornerY; - Position pos; + DungeonPos pos; bool8 foundTrap = FALSE; tile = GetTileAtEntitySafe(target); if (IsBossFight()) { @@ -1099,7 +1099,7 @@ bool8 FillInOrbAction(Entity *pokemon,Entity *target, Move *move, s32 param_4) int y; bool8 filledInTile; int x; - Position tileCoords; + DungeonPos tileCoords; filledInTile = FALSE; targetInfo = GetEntInfo(target); @@ -1153,7 +1153,7 @@ bool8 TrapperOrbAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) bool8 sub_805C3F8(Entity *pokemon, Entity *target, Move *move, s32 param_4) { Item stack; - Position posStruct = target->pos; + DungeonPos posStruct = target->pos; if(GetEntInfo(target)->monsterBehavior != BEHAVIOR_FIXED_ENEMY) { diff --git a/src/string_format.c b/src/string_format.c index 6f359eb28..522ec0052 100644 --- a/src/string_format.c +++ b/src/string_format.c @@ -34,7 +34,7 @@ void sub_80140B4(UnkTextStruct2 *a0) void sub_80140DC(void) { - Position pos; + DungeonPos pos; pos.x = 200; pos.y = 128; @@ -44,7 +44,7 @@ void sub_80140DC(void) void sub_80140F8(void) { - Position pos; + DungeonPos pos; pos.x = 188; pos.y = 64; @@ -92,7 +92,7 @@ struct UnkStruct_203B198 UnkTextStruct2 unk0; u8 unk18; u32 unk1C; - Position unk20; + DungeonPos unk20; u16 unk24; u16 unk26; u16 unk28; diff --git a/src/tile_types.c b/src/tile_types.c index 947b3f246..440a643ae 100644 --- a/src/tile_types.c +++ b/src/tile_types.c @@ -87,9 +87,9 @@ const u8 gDungeonWaterType[76] = { extern void sub_80498A8(s32, s32); extern void sub_80402AC(s32, s32); extern void sub_8049BB0(s32, s32); -void sub_8042A14(Position *); +void sub_8042A14(DungeonPos *); -bool8 PosHasItem(Position *pos) +bool8 PosHasItem(DungeonPos *pos) { struct Tile *tile; Entity *entity; @@ -102,7 +102,7 @@ bool8 PosHasItem(Position *pos) return FALSE; } -Entity *GetMonsterAtPos(Position *pos) +Entity *GetMonsterAtPos(DungeonPos *pos) { struct Tile *tile; Entity *entity; @@ -115,7 +115,7 @@ Entity *GetMonsterAtPos(Position *pos) return NULL; } -bool8 sub_804AD34(Position *pos) +bool8 sub_804AD34(DungeonPos *pos) { struct Tile *tile; s32 x; @@ -155,7 +155,7 @@ bool8 sub_804AD34(Position *pos) return iVar8; } -bool8 sub_804AE08(Position *pos) +bool8 sub_804AE08(DungeonPos *pos) { struct Tile *tile; s32 x; @@ -182,7 +182,7 @@ bool8 sub_804AE08(Position *pos) return uVar6; } -void sub_804AE84(Position *pos) +void sub_804AE84(DungeonPos *pos) { struct Tile *tile; s32 x; diff --git a/src/trap.c b/src/trap.c index 291bb642b..2d51f8b40 100644 --- a/src/trap.c +++ b/src/trap.c @@ -64,7 +64,7 @@ struct unkStruct_806B7F8 u32 unk4; u16 level; u8 fillA[2]; - struct Position pos; + DungeonPos pos; u8 unk10; }; extern Entity* sub_806B7F8(struct unkStruct_806B7F8 *, bool8); @@ -73,7 +73,7 @@ void sub_806A9B4(Entity *, u32); s16 sub_803D970(u32); bool8 sub_806AA0C(s32, s32); -void sub_80421EC(Position *, u32); +void sub_80421EC(DungeonPos *, u32); bool8 sub_8045888(Entity *); u8 sub_8043D10(void); @@ -82,13 +82,14 @@ void sub_8045C28(Item *, u8 , u8); void sub_8045BF8(u8 *, Item *); void DealDamageToEntity(Entity *,s16,u32,u32); void sub_806F480(Entity *, u32); -void sub_804225C(Entity *, Position *, u8); +void sub_804225C(Entity *, DungeonPos *, u8); void sub_8071DA4(Entity *); void sub_806A1E8(Entity *pokemon); u8 sub_803D6FC(void); -extern void sub_807DF38(Entity *pokemon, Entity *target, Position *pos, u32, u8 moveType, s16); +extern void sub_807DF38(Entity *pokemon, Entity *target, DungeonPos *pos, u32, + u8 moveType, s16); -void sub_807FC3C(Position *pos, u32 trapID, u32 param_3) +void sub_807FC3C(DungeonPos *pos, u32 trapID, u32 param_3) { gDungeon->trapPos.x = pos->x; gDungeon->trapPos.y = pos->y; @@ -97,7 +98,7 @@ void sub_807FC3C(Position *pos, u32 trapID, u32 param_3) gDungeon->unk13570 = 1; } -bool8 CanLayTrap(Position *pos) +bool8 CanLayTrap(DungeonPos *pos) { struct Tile *tile = GetTileSafe(pos->x, pos->y); if (tile->terrainType & TERRAIN_TYPE_STAIRS || @@ -118,7 +119,7 @@ bool8 CanLayTrap(Position *pos) return TRUE; } -bool8 LayTrap(Position *pos, u8 trapID, u8 param_3) +bool8 LayTrap(DungeonPos *pos, u8 trapID, u8 param_3) { Tile *tile; Entity *entity; @@ -183,7 +184,7 @@ bool8 sub_807FD84(Entity *entity) return flag; } -bool8 sub_807FE04(Position *pos, char param_2) +bool8 sub_807FE04(DungeonPos *pos, char param_2) { Tile *tile; @@ -201,7 +202,7 @@ bool8 sub_807FE04(Position *pos, char param_2) } } -bool8 sub_807FE44(Position *pos, char param_2) +bool8 sub_807FE44(DungeonPos *pos, char param_2) { Tile *tile; @@ -223,7 +224,7 @@ void GetTrapName(u8 *buffer, u8 trapIndex) strcpy(buffer, gTrapNames[trapIndex]); } -void sub_807FE9C(Entity *pokemon, Position *pos, int param_3, char param_4) +void sub_807FE9C(Entity *pokemon, DungeonPos *pos, int param_3, char param_4) { Tile *tile; bool8 flag1; @@ -578,7 +579,7 @@ void HandlePitfallTrap(Entity *pokemon, Entity *target, Tile *tile) } } -void HandleSummonTrap(Entity *pokemon,Position *pos) +void HandleSummonTrap(Entity *pokemon,DungeonPos *pos) { s32 r4; u32 direction; diff --git a/src/trap_1.c b/src/trap_1.c index c16165703..0aa388a41 100644 --- a/src/trap_1.c +++ b/src/trap_1.c @@ -8,13 +8,13 @@ // TODO: Merge this file with trap.c after "HandlePokemonTrap" is in c -extern void sub_804687C(Entity *, Position *, Position *, Item *, u32); +extern void sub_804687C(Entity *, DungeonPos *, DungeonPos *, Item *, u32); void HandleTripTrap(Entity *pokemon, Entity *target) { u32 direction; EntityInfo *info; - Position pos; + DungeonPos pos; Item item; if (target != NULL) { diff --git a/tmp/fixpoint.cocci b/tmp/fixpoint.cocci deleted file mode 100644 index 1c25b8c31..000000000 --- a/tmp/fixpoint.cocci +++ /dev/null @@ -1,17 +0,0 @@ -@@ -s48_16 e; -s48_16 *ep; -@@ -( -- e.s0 -+ e.hi -| -- e.s4 -+ e.lo -| -- ep->s0 -+ ep->hi -| -- ep->s4 -+ ep->lo -) diff --git a/tmp/position.cocci b/tmp/position.cocci new file mode 100644 index 000000000..ff2de880e --- /dev/null +++ b/tmp/position.cocci @@ -0,0 +1,17 @@ +@@ +typedef Position; +@@ +- struct Position ++ Position +@@ +typedef Position32; +typedef PixelPos; +@@ +- Position32 ++ PixelPos +@@ +typedef Position; +typedef DungeonPos; +@@ +- Position ++ DungeonPos diff --git a/tmp/renames.sed b/tmp/renames.sed deleted file mode 100644 index 39d202303..000000000 --- a/tmp/renames.sed +++ /dev/null @@ -1,26 +0,0 @@ -s/sub_8009DA4/FP24_8_SMul/g -s/sub_8009DD8/FP24_8_SDiv/g -s/sub_8009E14/FP24_8_UMul/g -s/sub_8009EA0/FP24_8_UDiv/g -s/sub_8009F68/FP24_8_Pow/g -s/sub_8009FB8/FP24_8_Hypot/g -s/sub_800A020/FP48_16_FromS32/g -s/sub_800A048/FP48_16_ToS32/g -s/sub_800A068/FP48_16_ToF248/g -s/sub_800A088/FP48_16_FromF248/g -s/sub_800A25C/FP48_16_Negate/g -s/sub_800A27C/FP48_16_Abs/g -s/sub_800A2A0/FP48_16_IsZero/g -s/sub_800A2BC/FP48_16_Equal/g -s/sub_800A2DC/FP48_16_IsNegative/g -s/sub_800A2F0/FP48_16_SLessThan/g -s/sub_800A34C/FP48_16_SMul/g -s/sub_800A3F0/FP48_16_SDiv/g -s/sub_800A4A0/FP48_16_Square/g -s/sub_800A4E4/FP48_16_UMul/g -s/sub_800A5A4/FP48_16_UDiv/g -s/sub_800A6D0/FP48_16_Add/g -s/sub_800A6F0/FP48_16_Subtract/g -s/sub_800A710/FP48_16_Pow/g -s/sub_800A78C/FP48_16_Hypot/g -s/sub_800A894/FP48_16_Log/g