Split+data code_8023144/code_80227B8

This commit is contained in:
Kermalis
2023-09-20 22:26:35 -04:00
parent 8b7c5e5ff5
commit fdcef19d85
184 changed files with 1862 additions and 1834 deletions

View File

@@ -0,0 +1,339 @@
#ifndef GUARD_DUNGEON_ENTITY_H
#define GUARD_DUNGEON_ENTITY_H
#include "constants/global.h"
#include "structs/str_position.h"
#include "sprite.h"
#include "structs/str_items.h"
#include "structs/str_moves.h"
#define MAX_STAT_STAGE 20
#define STAT_MULTIPLIER_THRESHOLD 63
#define DEFAULT_STAT_STAGE 10
#define DEFAULT_STAT_MULTIPLIER 256
#define MAX_SPEED_STAGE 4
#define MAX_STOCKPILE_STAGE 3
#define NUM_SPEED_COUNTERS 5
#define NUM_PREV_POS 4
#define STAT_STAGE_ATK 0
#define STAT_STAGE_SP_ATK 1
#define STAT_STAGE_DEF 0
#define STAT_STAGE_SP_DEF 1
#define STAT_STAGE_ACCURACY 0
#define STAT_STAGE_EVASION 1
// size: 0x18
typedef struct ActionContainer
{
/* 0x0 */ u16 action;
/* 0x2 */ u8 direction;
u8 fill3;
// Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset.
/* 0x4 */ u8 actionUseIndex;
// Position of the Pokémon the last time it threw an item.
/* 0x8 */ Position lastItemThrowPosition;
u8 unkC;
u8 fillD[3];
u8 fill10[4];
// Position of the target that the Pokémon wants throw an item at.
/* 0x14 */ Position itemTargetPosition;
} ActionContainer;
// size: 0x208
typedef struct EntityInfo
{
// This has different purposes for Pokémon, items, and traps.
// Pokemon: MovementFlag
// Items: ItemFlag
// Traps: TrapType
/* 0x0 */ u16 flags;
/* 0x2 */ s16 id; // Pokémon species or item ID.
// Everything from here on only applies to Pokémon.
/* 0x4 */ s16 apparentID; // Shows a different Pokémon when using Transform.
/* 0x6 */ bool8 isNotTeamMember;
/* 0x7 */ bool8 isTeamLeader;
/* 0x8 */ u8 shopkeeper;
/* 0x9 */ u8 level;
/* 0xA */ u8 teamIndex; // Leader is 0, partner is 1, etc.
/* 0xC */ s16 IQ;
/* 0xE */ s16 HP;
/* 0x10 */ s16 maxHPStat;
// Bosses have higher HP than normal for their level. This is the max HP they would normally have given their level.
/* 0x12 */ s16 originalHP;
/* 0x14 */ u8 atk;
/* 0x15 */ u8 spAtk;
/* 0x16 */ u8 def;
/* 0x17 */ u8 spDef;
/* 0x18 */ u32 exp;
// Temporary stat boosts/drops from effects like Growl or Swords Dance.
// These start at 10 and are in the range [1, 19].
// Index 0 is Attack. Index 1 is Special Attack.
/* 0x1C */ s16 offensiveStages[2];
// Index 0 is Defense. Index 1 is Special Defense.
/* 0x20 */ s16 defensiveStages[2];
// Index 0 is accuracy. Index 1 is evasion.
/* 0x24 */ s16 hitChanceStages[2];
// // When a Fire-type move is used on a Pokémon with Flash Fire, this value increases the power of the Pokémon's Fire-type moves.
/* 0x28 */ s16 flashFireBoost;
// These start at 0x1000, and are halved by certain moves like Screech to lower the corresponding stat.
// Index 0 is Attack. Index 1 is Special Attack.
/* 0x2C */ s32 offensiveMultipliers[2];
// Index 0 is Defense. Index 1 is Special Defense.
/* 0x34 */ s32 defensiveMultipliers[2];
/* 0x3C */ s16 hiddenPowerBasePower;
/* 0x3E */ u8 hiddenPowerType;
u8 fill3F;
/* 0x40 */ u8 joinedAt; // Uses the dungeon index in dungeon.h.
/* 0x44 */ ActionContainer action;
/* 0x5C */ u8 types[2];
/* 0x5E */ u8 abilities[2];
/* 0x60 */ Item heldItem;
u8 fill64[0x68 - 0x64];
/* 0x68 */ Position prevPos[NUM_PREV_POS];
/* 0x78 */ u8 aiObjective;
/* 0x79 */ bool8 aiNotNextToTarget;
/* 0x7A */ bool8 aiTargetingEnemy;
/* 0x7B */ bool8 aiTurningAround;
/* 0x7C */ u16 aiTargetSpawnGenID;
/* 0x80 */ struct Entity *aiTarget;
u8 fill84[0x88 - 0x84];
/* 0x88 */ Position aiTargetPos;
// Bitwise flags corresponding to selected IQ skills.
/* 0x8C */ u8 IQSkillMenuFlags[4]; // IQ skills selected in the IQ skills menu.
/* 0x90 */ u8 IQSkillFlags[4];
/* 0x94 */ u8 tactic;
u8 fill95[0x98 - 0x95];
/* 0x98 */ u32 unk98;
/* 0x9C */ u32 unk9C;
/* 0xA0 */ u32 unkA0;
/* 0xA4 */ u8 clientType;
u8 fillA5[0xA8 - 0xA5];
// Statuses are split into groups based on which ones can't overlap.
// See status.h for which statuses are in each group.
/* 0xA8 */ u8 sleep;
/* 0xA9 */ u8 sleepTurns;
u8 fillAA[0xAC - 0xAA];
/* 0xAC */ u8 nonVolatileStatus;
/* 0xAD */ u8 nonVolatileStatusTurns;
/* 0xAE */ u8 nonVolatileStatusDamageCountdown;
u8 fillAF;
/* 0xB0 */ u8 immobilizeStatus;
u8 fillB1[0xB4 - 0xB1];
/* 0xB4 */ s32 unkB4;
/* 0xB8 */ u8 immobilizeStatusTurns;
/* 0xB9 */ u8 immobilizeStatusDamageCountdown;
u8 fillBA[0xBC - 0xBA];
/* 0xBC */ u8 volatileStatus;
/* 0xBD */ u8 volatileStatusTurns;
u8 fillBE[0xC0 - 0xBE];
/* 0xC0 */ u8 chargingStatus;
/* 0xC1 */ u8 chargingStatusTurns;
/* 0xC2 */ u8 chargingStatusMoveIndex; // The position of the move in the Pokémon's moveset that triggered the status.
u8 fillC3;
/* 0xC4 */ u8 protectionStatus;
/* 0xC5 */ u8 protectionStatusTurns;
u8 fillC6[0xC8 - 0xC6];
/* 0xC8 */ u8 waitingStatus;
/* 0xC9 */ bool8 enemyDecoy; // True if the Pokémon is a decoy and a wild Pokémon (i.e., not an allied Pokémon).
u8 fillCA;
/* 0xCB */ u8 waitingStatusTurns;
/* 0xCC */ u8 curseDamageCountdown;
u8 fillCD[0xD0 - 0xCD];
/* 0xD0 */ u8 linkedStatus;
u8 fillD1[0xD4 - 0xD1];
/* 0xD4 */ u32 unkD4;
/* 0xD8 */ u8 unkD8;
/* 0xD9 */ u8 linkedStatusTurns;
/* 0xDA */ u8 linkedStatusDamageCountdown;
u8 fillDB;
/* 0xDC */ u8 moveStatus;
/* 0xDD */ u8 moveStatusTurns;
u8 fillDE[0xE0 - 0xDE];
/* 0xE0 */ u8 itemStatus;
u8 fillE1[0xE4 - 0xE1];
/* 0xE4 */ u8 transformStatus;
/* 0xE5 */ u8 transformStatusTurns;
u8 fillE6[0xE8 - 0xE6];
/* 0xE8 */ u8 eyesightStatus;
/* 0xE9 */ u8 eyesightStatusTurns;
/* 0xEA */ u8 unkEA;
u8 fillEB;
/* 0xEC */ bool8 muzzled;
/* 0xED */ u8 muzzledTurns;
u8 fillEE[0xF0 - 0xEE];
/* 0xF0 */ bool8 powerEars;
/* 0xF1 */ bool8 scanning;
/* 0xF2 */ bool8 stairSpotter;
u8 fillF3;
/* 0xF4 */ bool8 grudge;
/* 0xF5 */ bool8 exposed;
/* 0xF6 */ bool8 isColorChanged;
/* 0xF7 */ bool8 bossFlag;
/* 0xF8 */ bool8 speedStageChanged; // Toggled when pokemon is movement speed is sped up
/* 0xF9 */ u8 unkF9;
/* 0xFA */ u8 terrifiedTurns; // Doubles as a bool for whether the Pokémon is terrified.
u8 unkFB;
// Set to true if the player makes a teammate use their held item.
// This is done by going to the teammate's held item in the toolbox and selecting "Use".
/* 0xFC */ bool8 useHeldItem;
/* 0xFD */ u8 perishSongTurns; // When this reaches 0, the Pokémon faints from Perish Song. Doubles as a bool for whether the Pokémon is afflicted by Perish Song.
u8 unkFE;
u8 unkFF;
/* 0x100 */ u8 targetingDecoy; // If the Pokémon is targeting a decoy, this indicates whether the decoy target is a team or wild Pokémon.
/* 0x104 */ s32 speedStage;
// The turn counter for movement speed up/down is split into five timers each. Multiple timers are used if the Pokémon is affected by multiple
// speed-up/slow effects at once, like using Agility twice.
/* 0x108 */ u8 speedUpCounters[NUM_SPEED_COUNTERS];
/* 0x10D */ u8 speedDownCounters[NUM_SPEED_COUNTERS];
/* 0x112 */ u8 stockpileStage;
u8 fill113;
// When non-zero, an AI Pokémon will move in a random direction every turn when it is a room.
// There is a chance of this flag being set when a wild Pokémon spawns. The chance depends on the dungeon's randomMovementChance.
/* 0x114 */ u32 moveRandomly;
/* 0x118 */ Move moves[MAX_MON_MOVES];
/* 0x138 */ u8 struggleMoveFlags;
/* 0x13C */ u32 belly;
/* 0x140 */ u32 maxBelly;
/* 0x144 */ bool8 aiNextToTarget; // True if an AI Pokémon is following another Pokémon and is already adjacent to them.
/* 0x145 */ bool8 recalculateFollow; // Used by the AI to defer a movement decision until after all other Pokémon have moved.
u8 fill146;
/* 0x147 */ bool8 waiting; // True if an AI Pokémon decided to do nothing this turn.
/* 0x148 */ bool8 attacking;
/* 0x149 */ u8 unk149;
/* 0x14A */ u8 unk14A;
/* 0x14B */ u8 unk14B;
/* 0x14C */ u8 unk14C;
/* 0x14D */ u8 unk14D;
/* 0x14E */ u16 visualFlags;
/* 0x150 */ u16 previousVisualFlags;
/* 0x152 */ u8 unk152;
u8 unk153;
u8 unk154;
u8 unk155;
u8 unk156;
bool8 unk157;
u8 unk158;
u8 unk159;
u8 unk15A;
u8 unk15B;
u8 unk15C;
u8 unk15D;
u8 unk15E;
u8 unk15F;
u8 fill160[0x164 - 0x160];
/* 0x164 */ u8 unk164;
/* 0x165 */ u8 unk165;
/* 0x166 */ u8 unk166;
/* 0x167 */ u8 unk167;
/* 0x168 */ u8 unk168;
/* 0x169 */ u8 turnsSinceWarpScarfActivation;
/* 0x16C */ Position targetPos;
/* 0x170 */ Position pixelPos;
u32 unk174;
u16 unk178;
/* 0x17A */ u16 mimicMoveIDs[MAX_MON_MOVES]; // All moves that Mimic has copied (not sure on size...)
// Previous value of targetPosition for movement, 1 and 2 moves ago.
/* 0x184 */ Position previousTargetMovePosition1;
/* 0x188 */ Position32 previousTargetMovePosition2;
/* 0x190 */ u8 lastMoveDirection; // The last direction that the Pokémon moved in.
// Number of tiles that the Pokémon moved last, multiplied by 0x100.
/* 0x194 */ Position32 lastMoveIncrement;
/* 0x19C */ u8 walkAnimFramesLeft; // Set when the Pokémon starts moving, and counts down until the Pokémon's walk animation stops.
u8 fill19D[0x1F4 - 0x19D];
/* 0x1F4 */ u8 numMoveTiles; // Number of tiles to move in a turn. Can be greater than 1 if the user's movement speed is boosted.
u8 fill1F5;
/* 0x1F6 */ bool8 notMoving;
u8 fill1F7[0x1FA - 0x1F7];
/* 0x1FA */ s16 mobileTurnTimer; // When a Pokémon can pass through walls in a hallway, this counts up to 200 before the Pokémon turns in a random direction.
/* 0x1FC */ u16 expGainedInTurn; // Used to accumulate experience when multiple enemies are defeated in one turn.
/* 0x200 */ u32 statusIcons;
u8 unk204;
} EntityInfo;
// size: 0x74 | Used for Pokémon, items, and traps.
typedef struct Entity
{
/* 0x0 */ u32 type;
/* 0x4 */ Position pos;
/* 0x8 */ Position 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;
s32 unk1C;
/* 0x20 */ bool8 isVisible; // Turned off when a Pokémon faints.
u8 fill21;
u8 unk22;
u8 fill23;
u8 unk24;
/* 0x25 */ u8 room;
// The global spawn index counter starts at 10. Each Pokémon that spawns increments the counter and
// gets assigned the current counter value as its spawn index.
/* 0x26 */ u16 spawnGenID;
/* 0x28*/ EntitySpriteInfo spriteInfo;
OpenedFile *sprite;
s16 unk68;
u8 unk6A;
u8 unk6B;
/* 0x6C */ u8 direction;
/* 0x6D */ u8 direction2; // Duplicate of 0x6C?
u8 unk6E;
u8 unk6F;
/* 0x70 */ EntityInfo *info;
} Entity;
enum EntityType
{
ENTITY_NOTHING,
ENTITY_MONSTER,
ENTITY_TRAP,
ENTITY_ITEM,
ENTITY_UNK_4,
ENTITY_UNK_5,
};
enum MovementFlag
{
MOVEMENT_FLAG_SWAPPING_PLACES = 1 << 5,
MOVEMENT_FLAG_WALKING = 1 << 9,
MOVEMENT_FLAG_UNK_14 = 1 << 14,
MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY = 1 << 15 // Set if the Pokémon is petrified and the leader cures them by swapping places.
};
enum ShopkeeperMode
{
SHOPKEEPER_MODE_NORMAL,
SHOPKEEPER_MODE_SHOPKEEPER,
// These two modes trigger if an explosion damages the shopkeeper. The shopkeeper attacks the side that damaged it.
SHOPKEEPER_MODE_ATTACK_ENEMIES,
SHOPKEEPER_MODE_ATTACK_TEAM
};
enum AIObjective
{
AI_CHASE_TARGET = 1,
AI_CHASE_REMEMBERED_TARGET = 2,
AI_ROAM = 3,
AI_LEAVE_ROOM = 4,
AI_RUN_AWAY = 5,
AI_STAND_STILL = 6,
AI_TAKE_ITEM = 7
};
enum ClientType
{
CLIENT_TYPE_NONE = 0,
CLIENT_TYPE_CLIENT = 1, // Used for mission clients that need rescuing.
CLIENT_TYPE_PARTNER,
CLIENT_TYPE_DONT_MOVE = 4 // Used for Diglett in the Skarmory boss fight.
};
enum VisualFlag
{
// Set if Run Away's visual effect (green smoke cloud) has been triggered on this floor.
// Prevents the effect from showing again if the Pokémon stops running away and then starts running away again.
VISUAL_FLAG_RUN_AWAY = 2
};
#endif

68
include/structs/map.h Normal file
View File

@@ -0,0 +1,68 @@
#ifndef GUARD_MAP_H
#define GUARD_MAP_H
#include "structs/dungeon_entity.h"
#include "structs/str_position.h"
#define MAX_ROOM_COUNT 24 // Empirical max, not sure if the code supports any more.
#define CORRIDOR_ROOM 0xFF
enum TerrainType
{
TERRAIN_TYPE_NORMAL = 1 << 0,
TERRAIN_TYPE_SECONDARY = 1 << 1, // Water or lava depending on the dungeon.
TERRAIN_TYPE_UNK_2 = 1 << 2,
TERRAIN_TYPE_NATURAL_JUNCTION = 1 << 3,
TERRAIN_TYPE_IMPASSABLE_WALL = 1 << 4,
TERRAIN_TYPE_SHOP = 1 << 5,
TERRAIN_TYPE_IN_MONSTER_HOUSE = 1 << 6,
TERRAIN_TYPE_UNK_8 = 1 << 8,
TERRAIN_TYPE_STAIRS = 1 << 9,
};
enum CrossableTerrain
{
CROSSABLE_TERRAIN_REGULAR = 0,
CROSSABLE_TERRAIN_LIQUID = 1,
CROSSABLE_TERRAIN_CREVICE = 2,
CROSSABLE_TERRAIN_WALL = 3,
NUM_CROSSABLE_TERRAIN
};
// size: 0x18
typedef struct Tile
{
// Uses the TerrainType bit flags.
/* 0x0 */ u16 terrainType;
u8 fill2[0x4 - 0x2];
u16 unk4;
u16 unk6;
u8 unk8;
/* 0x9 */ u8 room;
// Bitwise flags for whether Pokémon can move to an adjacent tile. Bits correspond to directions in direction.h.
// Different sets of flags are used for Pokémon that can cross special terrain, corresponding to the CrossableTerrain enum.
/* 0xA */ u8 walkableNeighborFlags[NUM_CROSSABLE_TERRAIN];
u8 fillE[0x10 - 0xE];
/* 0x10 */ Entity *monster; // Pokémon on the tile.
/* 0x14 */ Entity *object; // Item or trap on the tile.
} Tile;
// size: 0x1C
typedef struct RoomData
{
u8 unk0;
u8 unk1;
// All coordinates are inclusive.
// These are not aligned properly to use the Position struct.
/* 0x2 */ s16 bottomRightCornerX;
/* 0x4 */ s16 bottomRightCornerY;
/* 0x6 */ s16 topLeftCornerX;
/* 0x8 */ s16 topLeftCornerY;
u8 fillA[0xC - 0xA];
u32 unkC; // bottom right x
u32 unk10; // bottom right y
u32 unk14; // top left x
u32 unk18; // top left y
} RoomData;
#endif // GUARD_MAP_H

View File

@@ -0,0 +1,239 @@
#ifndef GUARD_STR_DUNGEON_H
#define GUARD_STR_DUNGEON_H
#include "global.h"
#include "constants/monster.h"
#include "structs/dungeon_entity.h"
#include "file_system.h"
#include "structs/map.h"
#include "structs/str_position.h"
#include "sprite.h"
#define DUNGEON_MAX_SIZE_X 56
#define DUNGEON_MAX_SIZE_Y 32
#define DUNGEON_MAX_WILD_POKEMON 16
#define DUNGEON_MAX_POKEMON MAX_TEAM_MEMBERS + DUNGEON_MAX_WILD_POKEMON
// size: 0x4
typedef struct DungeonLocation
{
/* 0x0 */ u8 id;
/* 0x1 */ u8 floor;
} DungeonLocation;
// size: 0x4
typedef struct Dungeon_sub
{
u8 unk0;
u8 unk1;
u8 unk2;
} Dungeon_sub;
// size: 0x30
typedef struct unkDungeonGlobal_unk1CE98_sub
{
/* 0x0 */ u8 buffer1[10];
/* 0xA */ u8 buffer2[10];
/* 0x14 */ s16 moveID;
/* 0x16 */ u8 fill16[0x2];
/* 0x18 */ DungeonLocation dungeonLocation;
/* 0x1C */ Item heldItem;
/* 0x20 */ u32 exp;
/* 0x24 */ s16 maxHPStat;
/* 0x26 */ u8 atk;
/* 0x27 */ u8 spAtk;
/* 0x28 */ u8 def;
/* 0x29 */ u8 spDef;
/* 0x2A */ u8 level;
/* 0x2B */ u8 attBoost;
/* 0x2C */ u8 spAttBoost;
/* 0x2D */ u8 defBoost;
/* 0x2E */ u8 spDefBoost;
u8 unk2F; // speedBoost?
} unkDungeonGlobal_unk1CE98_sub;
// size: 0x10
typedef struct DungeonMusicPlayer
{
/* 0x0 */ u32 state;
/* 0x4 */ u32 fadeOutSpeed;
/* 0x8 */ u16 fadeInSpeed;
/* 0xA */ u16 songIndex;
/* 0xC */ u16 pastSongIndex;
/* 0xE */ u16 queuedSongIndex;
} DungeonMusicPlayer;
// size: 0x1CEDC
typedef struct Dungeon
{
u8 unk0;
u8 unk1;
u8 unk2;
u8 unk3;
u8 unk4;
u8 fill5[0x7 - 0x5];
u8 unk7;
u8 unk8;
u8 fill9[0xC - 0x9];
u8 unkC;
u8 unkD;
u8 unkE;
/* 0xF */ bool8 noActionInProgress; // Whether the game is currently accepting input. Set to false while action animations play.
u8 unk10;
u8 unk11;
s16 unk12;
u8 fill14[0xB8 - 0x14];
Entity *unkB8;
Entity *unkBC;
u8 fillC0[0x16D - 0xC0];
u8 unk16D;
u8 fill16E[0x179 - 0x16E];
/* 0x179 */ bool8 pokemonExposed; // True if a Pokémon on the floor has the Exposed status.
u8 fill17A[0x17C - 0x17A];
Dungeon_sub unk17C[0x100];
/* 0x57C */ u8 fill57C[0x644 - 0x57c];
/* 0x644 */ DungeonLocation dungeonLocation;
u8 fill646[0x654 - 0x648];
u8 unk654;
u8 fill655[0x65C - 0x655];
u8 unk65C;
u8 fill65D[0x660 - 0x65D];
/* 0x660 */ s16 fractionalTurn; // Handles turn order when Pokémon have different movement speeds.
u8 fill662[0x666 - 0x662];
/* 0x666 */ s16 windTurns; // Turns remaining before getting swept out of the dungeon.
/* 0x668 */ u16 unk668;
u16 bossSongIndex;
u8 unk66C;
u8 unk66D;
/* 0x66E */ u8 unk66E;
u8 unk66F;
u8 unk670;
/* 0x671 */ bool8 monsterHouseTriggered;
/* 0x672 */ bool8 monsterHouseTriggeredEvent;
u8 unk673;
u8 unk674;
u8 unk675;
/* 0x676 */ bool8 itemHoldersIdentified;
u8 unk677;
u8 unk678;
u8 unk679;
u8 unk67A;
u8 unk67B[0x688 - 0x67B];
s16 unk688;
/* 0x68A */ u8 unk68A;
u8 fill68B[0x699 - 0x68B];
u8 unk699;
u8 fill69A[0x69C - 0x69A];
/* 0x69C */ EntityInfo unk69C[4];
u8 fillEBC[0x363C - 0xEBC];
/* 0x363C */ u8 expYieldRankings[NUM_MONSTERS];
u8 fill37D9[0x37F0 - 0x37D9];
/* 0x37F0 */ u32 unk37F0;
/* 0x37F4 */ s32 unk37F4;
/* 0x37F8 */ bool8 plusIsActive[2]; // Index 0: Enemy , Index 1: Team
/* 0x37FA */ bool8 minusIsActive[2]; // Index 0: Enemy , Index 1: Team
/* 0x37FC */ bool8 decoyActive;
u8 fill37FD[0x3800 - 0x37FD];
s16 unk3800;
u8 fill3802[0x3904 - 0x3802];
/* 0x3904 */ s16 unk3904;
u8 fill3906[0x3A08 - 0x3906];
/* 0x3A08 */ u8 unk3A08;
u8 fill3A09[0x3A0D - 0x3A09];
/* 0x3A0D */ u8 unk3A0D;
/* 0x3A0E */ s16 tileset;
/* 0x3A10 */ u16 unk3A10;
u8 fill3A10[0x3A14 - 0x3A12];
/* 0x3A14 */ s16 bossBattleIndex;
/* 0x3A18 */ Tile tiles[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X];
u8 fillE218[0xE220 - 0xE218];
Position unkE220[4];
u8 unkE230[0xE23C - 0xE230];
s16 unkE23C; // x coord of some kind
s16 unkE23E; // y coord of some kind
u8 fillE240[0xE264 - 0xE240];
/* 0xE264 */ u8 weather; // Uses the weather constants in weather.h.
u8 unkE265; // Uses the weather constants in weather.h
/* 0xE266 */ u8 weatherDamageCounter; // Timer for applying sandstorm/hail damage periodically.
/* 0xE267 */ u8 unkE267[0xE269 - 0xE267];
u8 unkE269;
u8 fillE26A;
u8 unkE26B;
u8 weatherTurns;
u8 fillE26D[0xE26F - 0xE26D];
/* 0xE26F */ u8 naturalWeather[8]; // The weather at the start of the floor. If the weather changes, then expires, revert back to the starting weather.
/* 0xE277 */ u8 mudSportTurns;
/* 0xE278 */ u8 waterSportTurns;
/* 0xE279 */ bool8 nullifyWeather; // Air Lock and Cloud Nine toggle this to disable weather effects
u8 fillE27A[0xE8C0 - 0xE27A];
/* 0xE8C0 */ Tile *tilePointers[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X];
u8 unk104C0;
/* 0x104C4 */ RoomData roomData[MAX_ROOM_COUNT];
u8 fill10764[0x10844 - 0x10764];
/* 0x10844 */ s16 naturalJunctionListCounts[MAX_ROOM_COUNT];
u8 fill10874[0x10884 - 0x10874];
/* 0x10884 */ Position naturalJunctionList[MAX_ROOM_COUNT][32]; // Arrays of room exits for each room.
u8 fill11444[0x11884 - 0x11484];
u8 unk11884[0x1194];
u8 fill12A18[0x12C24 - 0x12A18];
u8 unk12C24[0x930];
u8 fill13554[0x1356C - 0x13554];
u8 unk1356C;
u8 fill1356D[0x13570 - 0x1356D];
/* 0x13570 */ u8 unk13570;
u8 fill13571[0x13574 - 0x13571];
/* 0x13574 */ u16 unk13574;
/* 0x13576 */ u16 unk13576;
/* 0x13578 */ u8 unk13578;
/* 0x13579 */ u8 unk13579;
u8 fill1357A[0x1357C - 0x1357A];
/* 0x1357C */ Entity *teamPokemon[MAX_TEAM_MEMBERS];
/* 0x1358C */ Entity *wildPokemon[DUNGEON_MAX_WILD_POKEMON];
/* 0x135CC */ Entity *allPokemon[DUNGEON_MAX_POKEMON]; // Contains both team and wild Pokémon
/* 0x1361C */ Entity *clientPokemon[0x40];
/* 0x1371C */ Entity *unk1371C[0x40];
/* 0x1381C */ Entity teamPokemonEntities[MAX_TEAM_MEMBERS];
/* 0x139EC */ Entity wildPokemonEntities[DUNGEON_MAX_WILD_POKEMON];
/* 0x1412C */ Entity clientPokemonEntities[0x40];
/* 0x15E2C */ Entity unk15E2C[0x40];
/* 0x17B2C */ Entity *lightningRodPokemon;
/* 0x17B30 */ Entity *snatchPokemon;
/* 0x17B34 */ u8 fillunk1734[0x17B38 - 0x17B34];
/* 0x17B38 */ u32 unk17B38;
/* 0x17B3C */ u32 unk17B3C;
u8 fill17B40[0x17B44 - 0x17B40];
/* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX];
/* 0x181E4 */ OpenedFile *paletFile;
/* 0x181E8 */ Position cameraPos;
/* 0x181EC */ Position cameraPosMirror;
/* 0x181F0 */ Position cameraPixelPos;
/* 0x181F4 */ Position cameraPixelPosMirror;
/* 0x181F8 */ Entity *cameraTarget;
u32 unk181FC;
u32 unk18200;
u32 unk18204;
u8 unk18208;
/* 0x18209 */ u8 visibilityRange; // Dungeon light level.
/* 0x1820A */ bool8 blinded; // Blacks out the screen when the player has the Blinker status.
u8 unk1820B;
u32 unk1820C;
/* 0x18210 */ bool8 hallucinating; // Displays Substitute and flower sprites when the player has the Cross-Eyed status.
u8 fill18211[0x18217 - 0x18211];
u8 unk18217;
u8 fill18218[0x1821A - 0x18218];
u8 unk1821A;
u8 fill1821B[0x1C578 - 0x1821B];
u8 unk1C578;
u8 fill1C579[0x1C57E - 0x1C579];
u8 unk1C57E;
u8 fill1C57F[0x1C58B - 0x1C57F];
u8 unk1C58B;
u8 fill1C58C[0x1CE98 - 0x1C58C];
unkDungeonGlobal_unk1CE98_sub unk1CE98; // TODO: not sure how large this is
u32 unk1CEC8;
/* 0x1CECC */ DungeonMusicPlayer musPlayer;
} Dungeon;
extern Dungeon *gDungeon;
#endif // GUARD_STR_DUNGEON_H

View File

@@ -0,0 +1,88 @@
#ifndef GUARD_STR_ITEMS_H
#define GUARD_STR_ITEMS_H
#include "constants/item.h"
// size: 0x20
typedef struct ItemDataEntry
{
/* 0x0 */ u8 *name;
/* 0x4 */ u32 buyPrice;
/* 0x8 */ u32 sellPrice;
/* 0xC */ u8 category;
/* 0xD */ u8 icon;
/* 0x10 */ u8 *description;
// Determines how the AI can use the item.
// Index 0: Item can be used on self.
// Index 1: Item can be thrown at allies.
// Index 2: Item can be thrown at enemies.
/* 0x14 */ bool8 aiFlags[3];
/* 0x18 */ s16 moveID;
/* 0x1A */ u8 order; // Numbered order they are in storage
/* 0x1B */ u8 spawnAmountRange[2];
/* 0x1D */ u8 palette;
/* 0x1E */ u8 actionType;
} ItemDataEntry;
// size: 0x4
typedef struct Item
{
/* 0x0 */ u8 flags;
/* 0x1 */ u8 quantity;
/* 0x2 */ u8 id;
} Item;
// size: 0x4
typedef struct BulkItem
{
/* 0x0 */ u8 id;
/* 0x1 */ u8 quantity;
} BulkItem;
// size: 0x4
typedef struct Gummi
{
/* 0x0 */ s16 boostAmount;
/* 0x2 */ u16 flags;
} Gummi;
// size: 0xC
typedef struct unkStruct_8090F58
{
u32 unk0;
u8 unk4;
u8 unk5;
s16 unk6;
u8 unk8;
} unkStruct_8090F58;
// size: 0x268
typedef struct TeamInventory
{
/* 0x0 */ Item teamItems[INVENTORY_SIZE];
/* 0x50 */ u16 teamStorage[STORAGE_SIZE];
/* 0x230 */ BulkItem kecleonShopItems[MAX_KECLEON_ITEM_SHOP_ITEMS];
/* 0x250 */ BulkItem kecleonWareItems[MAX_KECLEON_WARE_SHOP_ITEMS];
/* 0x260 */ s32 teamMoney;
/* 0x264 */ s32 teamSavings;
} TeamInventory;
// TODO: These should be in constants/
enum ItemFlag
{
ITEM_FLAG_EXISTS = 1 << 0,
ITEM_FLAG_IN_SHOP = 1 << 1, // in a Kecleon shop
ITEM_FLAG_UNPAID = 1 << 2, // Picked up in Kecleon shop but not paid for yet
ITEM_FLAG_STICKY = 1 << 3,
ITEM_FLAG_SET = 1 << 4 // This item can be thrown by pressing L+R instead of having to go to the bag menu.
};
enum ItemAIFlag
{
ITEM_AI_FLAG_TARGET_SELF,
ITEM_AI_FLAG_TARGET_ALLY,
ITEM_AI_FLAG_TARGET_ENEMY
};
#endif // GUARD_STR_ITEMS_H

View File

@@ -0,0 +1,42 @@
#ifndef GUARD_STR_MOVES_H
#define GUARD_STR_MOVES_H
#include "constants/move.h"
// size: 0x24
typedef struct MoveDataEntry
{
/* 0x0 */ u8 *name;
/* 0x4 */ s16 basePower;
/* 0x6 */ u8 type;
// Determines the range of moves.
/* 0x8 */ u16 targetingFlags[2]; // 0 for player and 1 for AI
// The AI consider certain moves to have different range than they actually do.
/* 0xC */ u8 basePP;
/* 0xD */ u8 aiWeight;
// There are multiple accuracy values. These are define with the AccuracyType enum.
/* 0xE */ u8 accuracy[NUM_ACCURACY_TYPES];
/* 0x11 */ u8 numberOfChainedHits; // Maximum number of times the move will hit. Used for multi-hit moves like Fury Attack.
/* 0x12 */ u8 maxUpgradeLevel;
/* 0x13 */ u8 critChance;
/* 0x14 */ bool8 affectedByMagicCoat; // If true, this move is reflected by Magic Coat.
/* 0x15 */ bool8 isSnatchable;
/* 0x16 */ bool8 usesMouth; // If true, this move can't be used with the Muzzled status.
/* 0x17 */ bool8 cannotHitFrozen; // Used by Status Checker to determine if a move can be used on a frozen target.
/* 0x18 */ bool8 ignoresTaunted;
/* 0x19 */ u8 rangeID;
/* 0x1C */ u8 *description;
/* 0x20 */ u8 *useText; // The text displayed when this move is used.
} MoveDataEntry;
// size: 0x8
typedef struct Move
{
u8 moveFlags;
u8 moveFlags2;
u16 id;
u8 PP;
u8 ginseng; // How much the move is boosted by Ginsengs.
} Move;
#endif // GUARD_STR_MOVES_H

View File

@@ -0,0 +1,167 @@
#ifndef GUARD_STR_POKEMON_H
#define GUARD_STR_POKEMON_H
#include "constants/monster.h"
#include "structs/str_dungeon.h"
#include "structs/str_items.h"
#include "structs/str_moves.h"
// size: 0x4
typedef struct Offense
{
/* 0x0 */ u8 att[2]; // Atk, SpAtk
/* 0x2 */ u8 def[2]; // Def, SpDef
} Offense;
// size: 0x4
typedef struct unkPokeSubStruct_C
{
u8 level;
u8 fill1[3];
} unkPokeSubStruct_C;
// size: 0x58
typedef struct PokemonStruct1
{
u16 unk0; // Probably a union: Sometimes ldrh and sometimes ldrb. Recruited??
/* 0x2 */ bool8 isTeamLeader;
/* 0x3 */ u8 level;
/* 0x4 */ DungeonLocation dungeonLocation;
/* 0x8 */ s16 speciesNum;
unkPokeSubStruct_C unkC[2];
/* 0x14 */ s16 IQ;
/* 0x16 */ u16 pokeHP;
/* 0x18 */ Offense offense;
/* 0x1C */ u32 currExp;
/* 0x20 */ u32 IQSkills;
/* 0x24 */ u8 tacticIndex;
/* 0x28 */ BulkItem heldItem;
/* 0x2C */ Move moves[MAX_MON_MOVES];
/* 0x4C */ u8 name[POKEMON_NAME_LENGTH];
} PokemonStruct1;
// size: 0x4
typedef struct unkStruct_808E6F4
{
s16 unk0;
u8 unk2;
} unkStruct_808E6F4;
// size: 0x4
typedef struct EvolveStage
{
/* 0x0 */ s16 speciesNum;
/* 0x2 */ u8 level;
} EvolveStage;
// size: 0x24
typedef struct unkStruct_8094184
{
/* 0x0 */ Move moves[MAX_MON_MOVES];
u8 unk20;
} unkStruct_8094184;
// size: 0x64
typedef struct PokemonStruct2
{
u16 unk0; // corresponds to unk0 in PokemonStruct
/* 0x2 */ bool8 isTeamLeader;
/* 0x3 */ u8 level;
/* 0x4 */ DungeonLocation dungeonLocation;
/* 0x8 */ u16 IQ;
s16 unkA;
u16 unkC;
/* 0xE */ s16 speciesNum;
u16 unk10; // pokeHP
u16 unk12; // pokeHP
/* 0x14 */ Offense offense; // offense (other offset)
/* 0x18 */ u32 currExp;
/* 0x1C */ unkStruct_8094184 moves;
/* 0x40 */ Item itemSlot; // heldItem
u32 unk44; // some struct
u32 unk48; // some struct (same type as 44)
/* 0x4C */ u32 IQSkills; // unk20
/* 0x50 */ u8 tacticIndex;
unkStruct_808E6F4 unk54;
/* 0x58 */ u8 name[POKEMON_NAME_LENGTH]; // name (other offset)
} PokemonStruct2;
// size: 0x90E8
typedef struct unkStruct_203B45C
{
/* 0x0 */ PokemonStruct1 pokemon[NUM_MONSTERS];
/* 0x8DF8 */ PokemonStruct2 pokemon2[4];
/* 0x8F88 */ PokemonStruct1 team[MAX_TEAM_MEMBERS];
} unkStruct_203B45C;
// size: 0x4
typedef struct PreEvolution
{
/* 0x0 */ s16 evolveFrom;
/* 0x2 */ u16 evolveType;
} PreEvolution;
// size: 0x4
typedef struct EvolutionRequirements
{
/* 0x0 */ s16 mainRequirement;
/* 0x2 */ u16 additionalRequirement;
} EvolutionRequirements;
// size: 0x8
typedef struct unkEvolve
{
/* 0x0 */ PreEvolution preEvolution;
/* 0x4 */ EvolutionRequirements evolutionRequirements;
} unkEvolve;
// size: 0x48
typedef struct MonsterDataEntry
{
/* 0x0 */ u8* species;
/* 0x4 */ u8* category;
/* 0x8 */ u8 overworldPalette;
/* 0x9 */ u8 bodySize;
/* 0xC */ s32 movementSpeed;
/* 0x10 */ u16 dialogueSprites; // Bitwise flags for whether a dialogue sprite/portrait is available for each emotion.
bool8 unk12;
/* 0x13 */ u8 types[2];
/* 0x15 */ u8 movementType;
/* 0x16 */ u8 friendArea;
/* 0x17 */ u8 abilities[2];
/* 0x19 */ u8 shadowSize;
u8 fill1A; // 0 for all Pokémon.
/* 0x1B */ u8 regenSpeed; // 100 for all Pokémon.
/* 0x1C */ bool8 canMove; // Set to false for Pokémon who don't move unless they're the leader, like Kakuna.
/* 0x1D */ u8 chanceAsleep;
/* 0x1E */ u16 baseHP;
/* 0x20 */ s32 expYield;
/* 0x24 */ u16 baseAtkSpAtk[2];
/* 0x28 */ u16 baseDefSpDef[2];
/* 0x2C */ u16 weight;
/* 0x2E */ u16 size;
u8 unk30; // 10 for all Pokémon.
u8 unk31; // 10 for all Pokémon.
u8 unk32; // 24 for all Pokémon.
/* 0x33 */ bool8 toolboxEnabled; // If false, the AI can't use items. Doesn't seem to be used, as it's true for all Pokémon.
/* 0x34 */ PreEvolution preEvolution;
/* 0x38 */ EvolutionRequirements evolutionRequirements;
/* 0x3C */ s16 dexInternal[2]; // dexNo and internalNo
/* 0x40 */ s16 recruitRate;
/* 0x42 */ s16 alphabetParent[2]; // alphabetNo and parentNo
} MonsterDataEntry;
// size: 0xC | https://www.pokecommunity.com/showthread.php?t=407371
typedef struct LevelData
{
/* 0x0 */ s32 expRequired;
/* 0x4 */ u8 gainHP;
/* 0x5 */ u8 gainUnused;
/* 0x6 */ u8 gainAtt;
/* 0x7 */ u8 gainSPAtt;
/* 0x8 */ u8 gainDef;
/* 0x9 */ u8 gainSPDef;
u16 fillA;
} LevelData;
#endif // GUARD_STR_POKEMON_H

View File

@@ -0,0 +1,18 @@
#ifndef GUARD_STR_POSITION_H
#define GUARD_STR_POSITION_H
// size: 0x4
typedef struct Position
{
/* 0x0 */ s16 x;
/* 0x2 */ s16 y;
} Position;
// size: 0x8
typedef struct Position32
{
/* 0x0 */ s32 x;
/* 0x4 */ s32 y;
} Position32;
#endif // GUARD_STR_POSITION_H

View File

@@ -0,0 +1,61 @@
#ifndef GUARD_STR_TEXT_H
#define GUARD_STR_TEXT_H
// size: 0x48
typedef struct UnkTextStruct1
{
s16 unk0;
s16 unk2;
s16 unk4;
s16 unk6;
s16 unk8;
u32 unkC;
u32 unk10;
u32 unk14;
u32 *unk18;
u32 *unk1C;
s32 unk20;
s32 unk24;
u32 *unk28; // Somewhere in VRAM
s32 unk2C;
u32 *unk30; // Somewhere in VRAM?
u32 *unk34;
s32 unk38;
u32 *unk3C;
u32 *unk40;
u8 unk44;
bool8 unk45;
u8 unk46;
} UnkTextStruct1;
// size: 0x4
typedef struct UnkTextStruct2_sub
{
// I haven't found a func that reads these separately yet, but simply making an arr[2] will cause assignments to break.
// Some funcs only match with this union for some reason even though they don't access the variables separately...
// The first func to break is currently sub_801A5D8 in kecleon_bros4.c
// The first func I matched that uses the array is sub_8006554 in text2.c (using the separated fields doesn't match or get even close)
union {
struct {
s16 unk0;
s16 unk2;
} separate;
s16 arr[2];
} unk0;
} UnkTextStruct2_sub;
// size: 0x18
typedef struct UnkTextStruct2
{
u8 unk0;
u8 fill1[0x4 - 0x1];
s32 unk4;
UnkTextStruct2_sub unk8;
s16 unkC;
s16 unkE;
s16 unk10;
s16 unk12;
const u8 *unk14;
} UnkTextStruct2;
#endif // GUARD_STR_TEXT_H

View File

@@ -0,0 +1,11 @@
#ifndef GUARD_SUBSTRUCT_203B240_H
#define GUARD_SUBSTRUCT_203B240_H
// size: 0x8
struct subStruct_203B240
{
u8 *pokeName;
u8 *unk4;
};
#endif // GUARD_SUBSTRUCT_203B240_H