yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
dungeon_map.h
Go to the documentation of this file.
1#ifndef YAZE_APP_ZELDA3_SCREEN_DUNGEON_MAP_H
2#define YAZE_APP_ZELDA3_SCREEN_DUNGEON_MAP_H
3
4#include <array>
5#include <vector>
6
7#include "absl/status/status.h"
10#include "core/rom_settings.h"
11#include "rom/rom.h"
12
13namespace yaze::zelda3 {
14
15struct GameData; // Forward declaration
16
17constexpr int kDungeonMapRoomsPtr = 0x57605; // 14 pointers of map data
18constexpr int kDungeonMapFloors = 0x575D9; // 14 words values
19
20constexpr int kDungeonMapGfxPtr = 0x57BE4; // 14 pointers of gfx data
21
22// data start for floors/gfx MUST skip 575D9 to 57621 (pointers)
23constexpr int kDungeonMapDataStart = 0x57039;
24constexpr int kDungeonMapDataReservedStart = 0x575D9;
25constexpr int kDungeonMapDataReservedEnd = 0x57620;
26constexpr int kDungeonMapDataLimit = 0x57CE0;
27
28// IF Byte = 0xB9 dungeon maps are not expanded
29constexpr int kDungeonMapExpCheck = 0x56652; // $0A:E652
30constexpr int kDungeonMapTile16 = 0x57009; // $0A:F009
31constexpr int kDungeonMapTile16Expanded = 0x109010; // $21:9010
32
38
39// 14 words values 0x000F = no boss
40constexpr int kDungeonMapBossRooms = 0x56807;
41constexpr int kDungeonMapBossFloors = 0x56E79;
42constexpr int kTriforceVertices = 0x04FFD2; // group of 3, X, Y ,Z
43constexpr int kTriforceFaces = 0x04FFE4; // group of 5
44
45constexpr int kCrystalVertices = 0x04FF98;
46
47constexpr int kNumDungeons = 14;
48constexpr int kNumRooms = 25;
49constexpr int kNumDungeonMapTile16 = 186;
50
54struct DungeonMap {
55 unsigned short boss_room = 0xFFFF;
56 unsigned char nbr_of_floor = 0;
57 unsigned char nbr_of_basement = 0;
58 std::vector<std::array<uint8_t, kNumRooms>> floor_rooms;
59 std::vector<std::array<uint8_t, kNumRooms>> floor_gfx;
60
61 DungeonMap(unsigned short boss_room, unsigned char nbr_of_floor,
62 unsigned char nbr_of_basement,
63 const std::vector<std::array<uint8_t, kNumRooms>>& floor_rooms,
64 const std::vector<std::array<uint8_t, kNumRooms>>& floor_gfx)
70};
71
73 std::array<std::vector<std::array<std::string, kNumRooms>>, kNumDungeons>;
74
82absl::StatusOr<std::vector<DungeonMap>> LoadDungeonMaps(
83 Rom& rom, DungeonMapLabels& dungeon_map_labels);
84
91absl::Status SaveDungeonMaps(Rom& rom, std::vector<DungeonMap>& dungeon_maps);
92
101absl::Status LoadDungeonMapTile16(gfx::Tilemap& tile16_blockset, Rom& rom,
102 GameData* game_data,
103 const std::vector<uint8_t>& gfx_data,
104 bool bin_mode);
105
112absl::Status SaveDungeonMapTile16(gfx::Tilemap& tile16_blockset, Rom& rom);
113
122absl::Status LoadDungeonMapGfxFromBinary(Rom& rom, GameData* game_data,
123 gfx::Tilemap& tile16_blockset,
124 std::array<gfx::Bitmap, 4>& sheets,
125 std::vector<uint8_t>& gfx_bin_data);
126} // namespace yaze::zelda3
127
128#endif // YAZE_APP_ZELDA3_SCREEN_DUNGEON_MAP_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:28
static RomSettings & Get()
uint32_t GetAddressOr(const std::string &key, uint32_t default_value) const
constexpr char kDungeonMapTile16Expanded[]
Zelda 3 specific classes and functions.
absl::Status LoadDungeonMapTile16(gfx::Tilemap &tile16_blockset, Rom &rom, GameData *game_data, const std::vector< uint8_t > &gfx_data, bool bin_mode)
Load the dungeon map tile16 from the ROM.
constexpr int kCrystalVertices
Definition dungeon_map.h:45
constexpr int kDungeonMapDataStart
Definition dungeon_map.h:23
int GetDungeonMapTile16Expanded()
Definition dungeon_map.h:33
constexpr int kDungeonMapExpCheck
Definition dungeon_map.h:29
constexpr int kDungeonMapBossFloors
Definition dungeon_map.h:41
constexpr int kDungeonMapDataReservedEnd
Definition dungeon_map.h:25
constexpr int kDungeonMapFloors
Definition dungeon_map.h:18
constexpr int kDungeonMapTile16
Definition dungeon_map.h:30
constexpr int kNumRooms
Definition dungeon_map.h:48
constexpr int kDungeonMapTile16Expanded
Definition dungeon_map.h:31
absl::Status SaveDungeonMapTile16(gfx::Tilemap &tile16_blockset, Rom &rom)
Save the dungeon map tile16 to the ROM.
constexpr int kDungeonMapDataReservedStart
Definition dungeon_map.h:24
absl::Status LoadDungeonMapGfxFromBinary(Rom &rom, GameData *game_data, gfx::Tilemap &tile16_blockset, std::array< gfx::Bitmap, 4 > &sheets, std::vector< uint8_t > &gfx_bin_data)
Load the dungeon map gfx from binary.
constexpr int kDungeonMapDataLimit
Definition dungeon_map.h:26
constexpr int kDungeonMapBossRooms
Definition dungeon_map.h:40
constexpr int kDungeonMapRoomsPtr
Definition dungeon_map.h:17
constexpr int kNumDungeonMapTile16
Definition dungeon_map.h:49
constexpr int kTriforceVertices
Definition dungeon_map.h:42
constexpr int kTriforceFaces
Definition dungeon_map.h:43
constexpr int kNumDungeons
Definition dungeon_map.h:47
std::array< std::vector< std::array< std::string, kNumRooms > >, kNumDungeons > DungeonMapLabels
Definition dungeon_map.h:72
absl::StatusOr< std::vector< DungeonMap > > LoadDungeonMaps(Rom &rom, DungeonMapLabels &dungeon_map_labels)
Load the dungeon maps from the ROM.
constexpr int kDungeonMapGfxPtr
Definition dungeon_map.h:20
absl::Status SaveDungeonMaps(Rom &rom, std::vector< DungeonMap > &dungeon_maps)
Save the dungeon maps to the ROM.
Tilemap structure for SNES tile-based graphics management.
Definition tilemap.h:118
DungeonMap represents the map menu for a dungeon.
Definition dungeon_map.h:54
unsigned char nbr_of_floor
Definition dungeon_map.h:56
DungeonMap(unsigned short boss_room, unsigned char nbr_of_floor, unsigned char nbr_of_basement, const std::vector< std::array< uint8_t, kNumRooms > > &floor_rooms, const std::vector< std::array< uint8_t, kNumRooms > > &floor_gfx)
Definition dungeon_map.h:61
std::vector< std::array< uint8_t, kNumRooms > > floor_rooms
Definition dungeon_map.h:58
unsigned char nbr_of_basement
Definition dungeon_map.h:57
std::vector< std::array< uint8_t, kNumRooms > > floor_gfx
Definition dungeon_map.h:59
unsigned short boss_room
Definition dungeon_map.h:55