summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2022-12-11 12:07:48 +0100
committeroctorock <79596758+octorock@users.noreply.github.com>2022-12-11 12:07:48 +0100
commit1d741c182dec03c6c7a6ea337f351eedf7d6eb65 (patch)
tree7a1fc484cc98a123a562ed5bb2e03e85b6f28e95 /include
parent017eb5a65efe06ab338f7d6a3bdd1188fcca6c3e (diff)
Extract dungeon maps
Diffstat (limited to 'include')
-rw-r--r--include/area.h20
-rw-r--r--include/asm.h2
-rw-r--r--include/beanstalkSubtask.h7
-rw-r--r--include/common.h17
-rw-r--r--include/game.h2
-rw-r--r--include/main.h2
-rw-r--r--include/map.h44
-rw-r--r--include/player.h2
-rw-r--r--include/room.h2
9 files changed, 73 insertions, 25 deletions
diff --git a/include/area.h b/include/area.h
index ce25c8df..d0b12ee7 100644
--- a/include/area.h
+++ b/include/area.h
@@ -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,11 +81,22 @@ 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,
AREA_HYRULE_TOWN,
diff --git a/include/asm.h b/include/asm.h
index 837cebca..c05fa5ad 100644
--- a/include/asm.h
+++ b/include/asm.h
@@ -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_*);
diff --git a/include/beanstalkSubtask.h b/include/beanstalkSubtask.h
index 3f7d452c..f82c83e5 100644
--- a/include/beanstalkSubtask.h
+++ b/include/beanstalkSubtask.h
@@ -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
diff --git a/include/common.h b/include/common.h
index 5d68679b..bf27bc8d 100644
--- a/include/common.h
+++ b/include/common.h
@@ -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
diff --git a/include/game.h b/include/game.h
index 0bdc45e2..43c3a6a3 100644
--- a/include/game.h
+++ b/include/game.h
@@ -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.
diff --git a/include/main.h b/include/main.h
index 4d70beb7..bb301dcc 100644
--- a/include/main.h
+++ b/include/main.h
@@ -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;
diff --git a/include/map.h b/include/map.h
index b943ca2e..201346e9 100644
--- a/include/map.h
+++ b/include/map.h
@@ -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
diff --git a/include/player.h b/include/player.h
index e0cbdcfc..366ae02a 100644
--- a/include/player.h
+++ b/include/player.h
@@ -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*);
diff --git a/include/room.h b/include/room.h
index 0da81c3e..0a1916d9 100644
--- a/include/room.h
+++ b/include/room.h
@@ -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;