Extract some map data definitions

This commit is contained in:
octorock
2023-06-10 15:12:51 +02:00
parent 99c0d42297
commit 551cb72093
88 changed files with 1554 additions and 2327 deletions
+27 -3
View File
@@ -11,7 +11,6 @@ extern u32 GetTileTypeByPos(s32 x, s32 y, u32 layer);
extern u32 GetTileType(u32 position, u32 layer);
extern void SetTile(u32 index, u32 position, u32 layer);
extern void UpdateScrollVram(void);
extern u32 sub_080B1B0C(struct Entity_*);
extern u32 sub_080B1BA4(u32, u32, u32);
extern void LoadResourceAsync(const void* src, u32 dest, u32 size);
extern void GenericConfused(struct Entity_*);
@@ -37,9 +36,34 @@ extern u32 sub_0800442E(struct Entity_*);
extern u32 sub_08007DD6(u32, const u16*);
extern void SoundReqClipped(struct Entity_*, u32);
extern u32 sub_0800132C(struct Entity_*, struct Entity_*);
extern u32 sub_080B1B44(u32, u32);
/**
* Sets the collision data for one metatile.
*/
extern void SetCollisionData(u32 collisionData, u32 metaTilePos, u32 layer);
/**
* Returns the collision data for one metatile.
*/
extern u32 GetCollisionData(u32 metaTilePos, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in metatiles relative to the room)
*/
extern u32 sub_080B1B3C(u32 x, u32 y, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the room)
*/
extern u32 sub_080B1B2C(u32 x, u32 y, u32 layer);
/**
* Returns the collision data for one metatile. (x, y in pixels relative to the world)
*/
extern u32 sub_080B1B18(u32 x, u32 y, u32 layer);
extern u32 sub_080B1B0C(struct Entity_* entity);
// Get CollisionData for entity (relative to entity?)
extern u32 sub_080B1AF0(struct Entity_*, s32 xOffset, s32 yOffset);
extern u32 sub_080B1A48(u32, u32, u32);
extern u32 sub_080B1B18(s32, s32, u32);
extern u32 sub_080B1AE0(u16, u8);
extern u32 GetTileUnderEntity(struct Entity_*);
extern u32 sub_0800445C(struct Entity_*);
-1
View File
@@ -135,7 +135,6 @@ typedef struct {
extern const DungeonFloorMetadata gDungeonFloorMetadatas[];
typedef struct {
u8 area;
u8 room;
+2
View File
@@ -519,6 +519,8 @@ extern u8 gManagerCount;
/** @name Tile Macros */ /// @{
#define TILE(x, y) (((((x)-gRoomControls.origin_x) >> 4) & 0x3F) | ((((y)-gRoomControls.origin_y) >> 4) & 0x3F) << 6)
// Calculate metatilePosition from x and y coordinates where x and y are already relative to the current room.
#define TILE_LOCAL(x, y) ((((x) >> 4) & 0x3F) | (((y) >> 4) & 0x3F) << 6)
#define TILE_POS(x, y) (x + (y << 6))
#define TILE_POS_X_COMPONENT 0x3f
#define TILE_POS_Y_COMPONENT 0xfc0
-5
View File
@@ -23,7 +23,6 @@ extern void CreateMinishEntrance(u32 tile);
extern u32 CreateRandomItemDrop(Entity*, u32);
extern void DrawDirect(u32 spriteIndex, u32 frameIndex);
extern void DrawEntities(void);
extern bool32 EntityWithinDistance(Entity*, s32, s32, s32);
extern void FlushSprites(void);
extern LayerStruct* GetLayerByIndex(u32);
extern u32 GetTileIndex(u32 tilePos, u32 layer);
@@ -49,12 +48,8 @@ extern void ClearBgAnimations(void);
extern void SetBGDefaults(void);
// Unidentified
extern void sub_08000148(u32, u32, u32);
extern u32 sub_080B1A0C(Entity*, s32, s32);
extern u32 sub_080B1AE0(u16, u8);
extern u32 sub_080B1AF0(Entity*, s32, s32);
extern u32 sub_080B1B18(s32, s32, u32);
extern u32 sub_080B1B44(u32, u32);
extern s32 sub_080012DC(Entity*);
extern void sub_08001318(Entity*);
extern void sub_080027EA(Entity*, u32, u32);
+1 -1
View File
@@ -295,7 +295,7 @@ typedef struct {
u8 maxX;
u8 maxY;
u8 windcrestId; /**< Id to set in gSave.windcrests when the user entered a room in the boundaries specified above.*/
//u8 pad;
// u8 pad;
u16 textIndex; /**< The text to show for this area.*/
} OverworldLocation;
extern const OverworldLocation gOverworldLocations[];
+2 -4
View File
@@ -78,10 +78,8 @@
#if NON_MATCHING
#define ASM_FUNC(path, decl)
#else
#define ASM_FUNC(path, decl) \
NAKED decl { \
asm(".include " #path); \
}
#define ASM_FUNC(path, decl) \
NAKED decl { asm(".include " #path); }
#endif
#if NON_MATCHING
+2 -2
View File
@@ -64,8 +64,8 @@ typedef struct {
u8 pauseFrames; /**< Number of frames to pause. */
u8 pauseCount; /**< Number of pauses to make. */
u8 pauseInterval; /**< Number of frames to play between each pause. */
u8 pad;
u16 ticks; /**< Current time. */
u8 pad; // TODO actually used in CopyOAM()
u16 ticks; /**< Current time. */
} Main;
/**
+27 -4
View File
@@ -7,12 +7,35 @@ typedef struct {
Manager base;
} DiggingCaveEntranceManager;
enum DiggingCaveEntranceType {
CAVE_LAKE_WOODS_ENTER,
CAVE_LAKE_WOODS_LEAVE,
CAVE_HYRULE_TOWN_ENTER,
CAVE_HYRULE_TOWN_LEAVE,
CAVE_EASTERN_HILL_ENTER,
CAVE_EASTERN_HILL_LEAVE,
CAVE_CRENEL_ENTER,
CAVE_CRENEL_LEAVE,
CAVE_VEIL_FALLS_ENTER,
CAVE_VEIL_FALLS_LEAVE,
CAVE_TRILBY_HIGHLANDS_ENTER,
CAVE_TRILBY_HIGHLANDS_LEAVE,
CAVE_CASTOR_WILDS_ENTER,
CAVE_CASTOR_WILDS_LEAVE,
CAVE_LAKE_HYLIA_NORTH_ENTER,
CAVE_LAKE_HYLIA_NORTH_LEAVE,
CAVE_LON_LON_RANCH_ENTER,
CAVE_LON_LON_RANCH_LEAVE,
CAVE_LAKE_HYLIA_CENTER_ENTER,
CAVE_LAKE_HYLIA_CENTER_LEAVE,
};
typedef struct {
u16 sourceTilePosition; /**< Tile position for the entrance in the source room. */
u8 sourceRoom;
u8 type; // TODO some sort of type that is used to index gUnk_08109194
u8 targetArea;
u8 targetRoom;
u8 sourceRoom; /**< @see RoomID */
u8 type; /**< @see DiggingCaveEntranceType */
u8 targetArea; /**< @see AreaID */
u8 targetRoom; /**< @see RoomID */
u16 targetTilePosition; /**< Tile position for the entrance in the target room. */
} DiggingCaveEntrance;
+1 -1
View File
@@ -9,7 +9,7 @@ typedef struct {
u16* unk_28;
u16* unk_2c;
u8 filler[0x4];
u8 unk_34;
u8 layer;
u8 unk_35;
u8 unk_36;
u8 unk_37;
+2 -2
View File
@@ -6,8 +6,8 @@
typedef struct {
Manager base;
u8 unk_20[0x18];
s16 unk_38;
s16 unk_3a;
s16 x;
s16 y;
u16 unk_3c;
u16 flags;
} MiscManager;
+18 -11
View File
@@ -6,14 +6,18 @@
typedef struct {
/*0x0000*/ BgSettings* bgSettings;
/*0x0004*/ u16 mapData[0x40*0x40]; /**< MetaTileIndex for each tile on the current layer. */ // tilemap data? <-- gMapDataTop / gMapDataBottom
/*0x2004*/ u8 collisionData[0x40*0x40]; // more tilemap data? <-- gUnk_0200D654 / gUnk_02027EB4
/*0x3004*/ u16 mapDataClone[0x40*0x40]; // more tilemap data? <-- gUnk_0200E654 / gUnk_02028EB4
// Tileset
/*0x5004*/ u16 metatileTypes[0x800]; /**< Maps from the MetaTileIndex to the MetaTileType. */ // gMetatileTypesTop, gMetatileTypesBottom
/*0x6004*/ u16 unkData2[0x800]; /**< Maps from a MetaTileType to a MetaTileIndex. */ // gUnk_02011654,gUnk_0202BEB4 // TODO metatile index for the metatile type??
/*0x7004*/ u16 metatiles[0x800 * 4]; /**< Mapping from a metatile to the four tile_attrs it consists of.*/ // gMetatilesTop, gMetatilesBottom
/*0x0004*/ u16 mapData[0x40 * 0x40];
/**< MetaTileIndex for each tile on the current layer. */ // tilemap data? <-- gMapDataTop / gMapDataBottom
/*0x2004*/ u8 collisionData[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200D654 / gUnk_02027EB4
/*0x3004*/ u16 mapDataClone[0x40 * 0x40]; // more tilemap data? <-- gUnk_0200E654 / gUnk_02028EB4
// Tileset
/*0x5004*/ u16 metatileTypes[0x800];
/**< Maps from the MetaTileIndex to the MetaTileType. */ // gMetatileTypesTop, gMetatileTypesBottom
/*0x6004*/ u16 unkData2[0x800];
/**< Maps from a MetaTileType to a MetaTileIndex. */ // gUnk_02011654,gUnk_0202BEB4 // TODO metatile index for
// the metatile type??
/*0x7004*/ u16 metatiles[0x800 * 4];
/**< Mapping from a metatile to the four tile_attrs it consists of.*/ // gMetatilesTop, gMetatilesBottom
/*0xb004*/ u8 unkData3[0x40*0x40]; /**< Some sort of special behavior for tiles? Falling into holes or jumping off walls does not work when this is all zero.*/ // gUnk_02016654, gUnk_02030EB4
// TODO check with debugger what accesses this
@@ -33,12 +37,11 @@ extern LayerStruct gMapTop;
extern LayerStruct gMapBottom;
// Rendered tilemaps https://www.coranac.com/tonc/text/regbg.htm#sec-map
//extern u16 gMapDataTopSpecial[0x4000];
//extern u16 gMapDataBottomSpecial[0x4000];
// extern u16 gMapDataTopSpecial[0x4000];
// extern u16 gMapDataBottomSpecial[0x4000];
LayerStruct* GetLayerByIndex(u32);
/*
Definition where some map data is found and where it should be copied to.
Defined using the map_data asm macro, e.g. in map_headers.s
@@ -49,5 +52,9 @@ typedef struct {
u32 size;
} MapDataDefinition;
// There is another map data definition following.
#define MAP_MULTIPLE 0x80000000
// The src is compressed.
#define MAP_COMPRESSED 0x80000000
#endif // MAP_H
+1 -1
View File
@@ -21,7 +21,7 @@ void SortEntityBelow(Entity* above_ent, Entity* below_ent);
void LinearMoveDirection(Entity* ent, u32 a, u32 b);
void LinearMoveAngle(Entity* ent, u32 a, u32 b);
bool32 EntityWithinDistance(Entity*, s32, s32, s32);
bool32 EntityWithinDistance(Entity* entity, s32 x, s32 y, s32 distance);
u32 sub_0806FCA0(Entity*, Entity*);
u32 sub_0806F58C(Entity*, Entity*);
u32 PointInsideRadius(s32 x, s32 y, s32 radius);
+4 -3
View File
@@ -45,8 +45,8 @@ typedef struct {
/*0x18*/ u16 unk_18; // progress during transition in same area?
/*0x1A*/ u16 unk_1a; // calculated from unk_18
/*0x1C*/ u16 unk_1c; // 0, 0xff
/*0x1E*/ u16 width;
/*0x20*/ u16 height;
/*0x1E*/ u16 width; /**< Width in pixels. */
/*0x20*/ u16 height; /**< Height in pixels. */
/*0x22*/ u16 unk_22; // so far always 0xffff
/*0x24*/ s8 aff_x;
/*0x25*/ s8 aff_y;
@@ -91,7 +91,8 @@ typedef struct {
u8 area;
u8 room;
u16 unk_02;
u32 flags; /**< Flags that can be set on the tracked rooms. Used e.g. by the door mimic. (TODO probably to start in the discovered state?)*/
u32 flags; /**< Flags that can be set on the tracked rooms. Used e.g. by the door mimic. (TODO probably to start in
the discovered state?)*/
} RoomMemory;
extern RoomMemory* gRoomMemoryPtr;
+3 -3
View File
@@ -14,9 +14,9 @@ typedef enum {
// AREA_HYRULE_FIELD
ROOM_HYRULE_FIELD_WESTERN_WOODS_SOUTH = 0,
ROOM_HYRULE_FIELD_SOUTH_HYRULE_FIELD,
ROOM_HYRULE_FIELD_EASTERN_HILLLS_SOUTH,
ROOM_HYRULE_FIELD_EASTERN_HILLLS_CENTER,
ROOM_HYRULE_FIELD_EASTERN_HILLLS_NORTH,
ROOM_HYRULE_FIELD_EASTERN_HILLS_SOUTH,
ROOM_HYRULE_FIELD_EASTERN_HILLS_CENTER,
ROOM_HYRULE_FIELD_EASTERN_HILLS_NORTH,
ROOM_HYRULE_FIELD_LON_LON_RANCH,
ROOM_HYRULE_FIELD_NORTH_HYRULE_FIELD,
ROOM_HYRULE_FIELD_TRILBY_HIGHLANDS,
+2 -1
View File
@@ -44,7 +44,8 @@ typedef struct {
/*0x009*/ u8 field_0x9[0x17];
/*0x020*/ u16 field_0x20;
/*0x022*/ u8 field_0x22[0x1e];
/*0x040*/ u32 windcrests; /**< Windcrest flags. bits 0 - 0x10: Visited area of the overworld. Above 0x18: windcrest activated. */
/*0x040*/ u32 windcrests; /**< Windcrest flags. bits 0 - 0x10: Visited area of the overworld. Above 0x18: windcrest
activated. */
/*0x044*/ u8 filler44[0xC];
/*0x050*/ u32 unk50;
/*0x054*/ u8 filler54[0x8];