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 "rom/rom.h"
11
12namespace yaze::zelda3 {
13
14struct GameData; // Forward declaration
15
16constexpr int kDungeonMapRoomsPtr = 0x57605; // 14 pointers of map data
17constexpr int kDungeonMapFloors = 0x575D9; // 14 words values
18
19constexpr int kDungeonMapGfxPtr = 0x57BE4; // 14 pointers of gfx data
20
21// data start for floors/gfx MUST skip 575D9 to 57621 (pointers)
22constexpr int kDungeonMapDataStart = 0x57039;
23
24// IF Byte = 0xB9 dungeon maps are not expanded
25constexpr int kDungeonMapExpCheck = 0x56652; // $0A:E652
26constexpr int kDungeonMapTile16 = 0x57009; // $0A:F009
27constexpr int kDungeonMapTile16Expanded = 0x109010; // $21:9010
28
29// 14 words values 0x000F = no boss
30constexpr int kDungeonMapBossRooms = 0x56807;
31constexpr int kTriforceVertices = 0x04FFD2; // group of 3, X, Y ,Z
32constexpr int kTriforceFaces = 0x04FFE4; // group of 5
33
34constexpr int kCrystalVertices = 0x04FF98;
35
36constexpr int kNumDungeons = 14;
37constexpr int kNumRooms = 25;
38constexpr int kNumDungeonMapTile16 = 186;
39
43struct DungeonMap {
44 unsigned short boss_room = 0xFFFF;
45 unsigned char nbr_of_floor = 0;
46 unsigned char nbr_of_basement = 0;
47 std::vector<std::array<uint8_t, kNumRooms>> floor_rooms;
48 std::vector<std::array<uint8_t, kNumRooms>> floor_gfx;
49
50 DungeonMap(unsigned short boss_room, unsigned char nbr_of_floor,
51 unsigned char nbr_of_basement,
52 const std::vector<std::array<uint8_t, kNumRooms>>& floor_rooms,
53 const std::vector<std::array<uint8_t, kNumRooms>>& floor_gfx)
59};
60
62 std::array<std::vector<std::array<std::string, kNumRooms>>, kNumDungeons>;
63
71absl::StatusOr<std::vector<DungeonMap>> LoadDungeonMaps(
72 Rom& rom, DungeonMapLabels& dungeon_map_labels);
73
80absl::Status SaveDungeonMaps(Rom& rom, std::vector<DungeonMap>& dungeon_maps);
81
90absl::Status LoadDungeonMapTile16(gfx::Tilemap& tile16_blockset, Rom& rom,
91 GameData* game_data,
92 const std::vector<uint8_t>& gfx_data,
93 bool bin_mode);
94
101absl::Status SaveDungeonMapTile16(gfx::Tilemap& tile16_blockset, Rom& rom);
102
111absl::Status LoadDungeonMapGfxFromBinary(Rom& rom, GameData* game_data,
112 gfx::Tilemap& tile16_blockset,
113 std::array<gfx::Bitmap, 4>& sheets,
114 std::vector<uint8_t>& gfx_bin_data);
115} // namespace yaze::zelda3
116
117#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:24
Zelda 3 specific classes and functions.
Definition editor.h:35
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:34
constexpr int kDungeonMapDataStart
Definition dungeon_map.h:22
constexpr int kDungeonMapExpCheck
Definition dungeon_map.h:25
constexpr int kDungeonMapFloors
Definition dungeon_map.h:17
constexpr int kDungeonMapTile16
Definition dungeon_map.h:26
constexpr int kNumRooms
Definition dungeon_map.h:37
constexpr int kDungeonMapTile16Expanded
Definition dungeon_map.h:27
absl::Status SaveDungeonMapTile16(gfx::Tilemap &tile16_blockset, Rom &rom)
Save the dungeon map tile16 to the ROM.
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 kDungeonMapBossRooms
Definition dungeon_map.h:30
constexpr int kDungeonMapRoomsPtr
Definition dungeon_map.h:16
constexpr int kNumDungeonMapTile16
Definition dungeon_map.h:38
constexpr int kTriforceVertices
Definition dungeon_map.h:31
constexpr int kTriforceFaces
Definition dungeon_map.h:32
constexpr int kNumDungeons
Definition dungeon_map.h:36
std::array< std::vector< std::array< std::string, kNumRooms > >, kNumDungeons > DungeonMapLabels
Definition dungeon_map.h:61
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:19
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:43
unsigned char nbr_of_floor
Definition dungeon_map.h:45
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:50
std::vector< std::array< uint8_t, kNumRooms > > floor_rooms
Definition dungeon_map.h:47
unsigned char nbr_of_basement
Definition dungeon_map.h:46
std::vector< std::array< uint8_t, kNumRooms > > floor_gfx
Definition dungeon_map.h:48
unsigned short boss_room
Definition dungeon_map.h:44