Extract dungeon maps

This commit is contained in:
octorock
2022-12-11 12:07:48 +01:00
parent 017eb5a65e
commit 1d741c182d
42 changed files with 2535 additions and 1471 deletions
+16 -4
View File
@@ -2,6 +2,7 @@
#define AREA_H
#include "global.h"
#include "map.h"
#include "transitions.h"
#define MAX_ROOMS 64
@@ -11,9 +12,9 @@ typedef struct {
u16 pixel_height;
u16 map_x;
u16 map_y;
void* tileset;
void* map;
void* metatiles;
MapDataDefinition* tileset;
MapDataDefinition* map;
MapDataDefinition* metatiles;
void* bg_anim;
const Transition* exits;
void** properties;
@@ -80,10 +81,21 @@ typedef struct {
u8 flags;
u8 location;
u8 flag_bank;
u8 _3;
u8 queueBgm;
} AreaHeader;
extern AreaHeader gAreaMetadata[];
typedef enum {
AR_IS_OVERWORLD = 0x1,
AR_HAS_KEYS = 0x2,
AR_IS_DUNGEON = 0x4, /**< Causes the area to have a red name. */
AR_HAS_MAP = 0x8,
AR_HAS_ENEMIES = 0x10,
AR_IS_MOLE_CAVE = 0x20,
AR_HAS_NO_ENEMIES = 0x40,
AR_ALLOWS_WARP = 0x80, /**< Not used in EU. Allows to warp in areas that do not have AR_OVERWORLD set. */
} AreaFlags;
typedef enum {
AREA_MINISH_WOODS,
AREA_MINISH_VILLAGE,
+1 -1
View File
@@ -13,7 +13,7 @@ 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*, u32, u32);
extern void LoadResourceAsync(const void* src, u32 dest, u32 size);
extern void GenericConfused(struct Entity_*);
extern void sub_08001290(struct Entity_*, u32);
extern void GenericKnockback(struct Entity_*);
+2 -5
View File
@@ -2,6 +2,7 @@
#define BEANSTALKSUBTASK_H
#include "global.h"
#include "map.h"
/*
tiles 0x4000 and above create an entry here
@@ -18,10 +19,6 @@ typedef struct {
u16 tileIndex;
} struct_080B44D0;
typedef struct {
u32 src;
void* dest;
u32 size;
} struct_08109194;
void LoadMapData(MapDataDefinition* dataDefinition);
#endif // BEANSTALKSUBTASK_H
+13 -4
View File
@@ -126,12 +126,21 @@ bool32 sub_0801E810(u32);
u32 sub_0801DB94(void);
typedef struct {
u8 unk_0;
u8 unk_1;
u8 numFloors;
u8 highestFloor;
u8 unk_2;
// u8 pad;
} struct_080C9C6C;
} DungeonFloorMetadata;
extern const struct_080C9C6C gUnk_080C9C6C[];
extern const DungeonFloorMetadata gDungeonFloorMetadatas[];
typedef struct {
u8 area;
u8 room;
u8 unk_2; // TODO u16 pad?
u8 unk_3;
u32 mapDataOffset;
} DungeonLayout;
#endif // COMMON_H
+1 -1
View File
@@ -212,7 +212,7 @@ void RoomExitCallback(void);
*
* @param a1
*/
void RestoreGameTask(u32 a1);
void RestoreGameTask(bool32 loadGfx);
/**
* Check if an Ezlo message can be displayed.
+1 -1
View File
@@ -78,7 +78,7 @@ typedef struct {
/*0x003*/ u8 field_0x3;
/*0x004*/ u8 state;
/*0x005*/ u8 field_0x5;
/*0x006*/ u8 field_0x6;
/*0x006*/ bool8 loadGfxOnRestore; // used in Subtask_FadeOut to determine the loadGfx parameter of RestoreGameTask.
/*0x007*/ u8 pauseFadeIn;
/*0x008*/ u16 fadeType;
/*0x00A*/ u16 fadeInTime;
+37 -7
View File
@@ -6,18 +6,48 @@
typedef struct {
/*0x0000*/ BgSettings* bgSettings;
/*0x0004*/ u16 mapData[0x1000]; // tilemap data? <-- gMapDataTop / gMapDataBottom
/*0x2004*/ u8 collisionData[0x1000]; // more tilemap data? <-- gUnk_0200D654 / gUnk_02027EB4
/*0x3004*/ u16 mapDataClone[0x1000]; // more tilemap data? <-- gUnk_0200E654 / gUnk_02028EB4
/*0x5004*/ u16 metatileTypes[0x800]; // gMetatileTypesTop, gMetatileTypesBottom
/*0x6004*/ u16 unkData2[0x800]; // gUnk_02011654,gUnk_0202BEB4
/*0x7004*/ u16 metatiles[0x2000]; // gMetatilesTop, gMetatilesBottom
/*0xb004*/ u8 unkData3[0x1000]; // gUnk_02016654, gUnk_02030EB4
/*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
// 0x637
// 0x2030eb4 + 0x637
// 0x20314eb
// e.g. sub_080B1AE0 accesses this
// TODO check whether this also affects sound played when walking?
/*
0x10: water
0x12: ice
0x57: cloning pad
*/
} LayerStruct;
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];
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
*/
typedef struct {
u32 src;
void* dest;
u32 size;
} MapDataDefinition;
#endif // MAP_H
+1 -1
View File
@@ -475,7 +475,7 @@ void sub_08078850(Entity*, u32, u32, const void*);
void sub_08079D84(void);
u32 sub_0807953C(void);
void sub_0807BB68(const s16*, u32, u32);
void sub_0807B9B8(u32, u32, u32);
void SetMetaTileByIndex(u32 tileIndex, u32 position, u32 layer);
void sub_0807B7D8(u32, u32, u32);
void RestorePrevTileEntity(u32, u32);
void UpdateItemAnim(ItemBehavior*);
+1 -1
View File
@@ -24,7 +24,7 @@ enum RoomReloadType {
};
typedef struct {
/*0x00*/ u16 reload_flags;
/*0x00*/ u16 reload_flags; // anything except for 0x1 prevents the screen from reloading when tiles are changed.
/*0x02*/ u8 scrollAction;
/*0x03*/ u8 scrollSubAction;
/*0x04*/ u8 area;