Rename Positions

This commit is contained in:
Mateon1
2024-11-12 16:08:43 +01:00
parent f46866840c
commit 8ba2124f1e
81 changed files with 377 additions and 392 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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