yaze 0.2.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"
8#include "app/gfx/bitmap.h"
9#include "app/gfx/tilemap.h"
10#include "app/rom.h"
11
12namespace yaze::zelda3 {
13
14constexpr int kDungeonMapRoomsPtr = 0x57605; // 14 pointers of map data
15constexpr int kDungeonMapFloors = 0x575D9; // 14 words values
16
17constexpr int kDungeonMapGfxPtr = 0x57BE4; // 14 pointers of gfx data
18
19// data start for floors/gfx MUST skip 575D9 to 57621 (pointers)
20constexpr int kDungeonMapDataStart = 0x57039;
21
22// IF Byte = 0xB9 dungeon maps are not expanded
23constexpr int kDungeonMapExpCheck = 0x56652; // $0A:E652
24constexpr int kDungeonMapTile16 = 0x57009; // $0A:F009
25constexpr int kDungeonMapTile16Expanded = 0x109010; // $21:9010
26
27// 14 words values 0x000F = no boss
28constexpr int kDungeonMapBossRooms = 0x56807;
29constexpr int kTriforceVertices = 0x04FFD2; // group of 3, X, Y ,Z
30constexpr int kTriforceFaces = 0x04FFE4; // group of 5
31
32constexpr int kCrystalVertices = 0x04FF98;
33
34constexpr int kNumDungeons = 14;
35constexpr int kNumRooms = 25;
36constexpr int kNumDungeonMapTile16 = 186;
37
41struct DungeonMap {
42 unsigned short boss_room = 0xFFFF;
43 unsigned char nbr_of_floor = 0;
44 unsigned char nbr_of_basement = 0;
45 std::vector<std::array<uint8_t, kNumRooms>> floor_rooms;
46 std::vector<std::array<uint8_t, kNumRooms>> floor_gfx;
47
48 DungeonMap(unsigned short boss_room, unsigned char nbr_of_floor,
49 unsigned char nbr_of_basement,
50 const std::vector<std::array<uint8_t, kNumRooms>> &floor_rooms,
51 const std::vector<std::array<uint8_t, kNumRooms>> &floor_gfx)
57};
58
60 std::array<std::vector<std::array<std::string, kNumRooms>>, kNumDungeons>;
61
69absl::StatusOr<std::vector<DungeonMap>> LoadDungeonMaps(
70 Rom &rom, DungeonMapLabels &dungeon_map_labels);
71
78absl::Status SaveDungeonMaps(Rom &rom, std::vector<DungeonMap> &dungeon_maps);
79
88absl::Status LoadDungeonMapTile16(gfx::Tilemap &tile16_blockset, Rom &rom,
89 const std::vector<uint8_t> &gfx_data,
90 bool bin_mode);
91
98absl::Status SaveDungeonMapTile16(gfx::Tilemap &tile16_blockset, Rom &rom);
99
108absl::Status LoadDungeonMapGfxFromBinary(Rom &rom,
109 gfx::Tilemap &tile16_blockset,
110 std::array<gfx::Bitmap, 4> &sheets,
111 std::vector<uint8_t> &gfx_bin_data);
112} // namespace yaze::zelda3
113
114#endif // YAZE_APP_ZELDA3_SCREEN_DUNGEON_MAP_H
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:58
Zelda 3 specific classes and functions.
constexpr int kCrystalVertices
Definition dungeon_map.h:32
absl::Status LoadDungeonMapGfxFromBinary(Rom &rom, 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 kDungeonMapDataStart
Definition dungeon_map.h:20
constexpr int kDungeonMapExpCheck
Definition dungeon_map.h:23
absl::Status LoadDungeonMapTile16(gfx::Tilemap &tile16_blockset, Rom &rom, const std::vector< uint8_t > &gfx_data, bool bin_mode)
Load the dungeon map tile16 from the ROM.
constexpr int kDungeonMapFloors
Definition dungeon_map.h:15
constexpr int kDungeonMapTile16
Definition dungeon_map.h:24
constexpr int kNumRooms
Definition dungeon_map.h:35
constexpr int kDungeonMapTile16Expanded
Definition dungeon_map.h:25
absl::Status SaveDungeonMapTile16(gfx::Tilemap &tile16_blockset, Rom &rom)
Save the dungeon map tile16 to the ROM.
constexpr int kDungeonMapBossRooms
Definition dungeon_map.h:28
constexpr int kDungeonMapRoomsPtr
Definition dungeon_map.h:14
constexpr int kNumDungeonMapTile16
Definition dungeon_map.h:36
constexpr int kTriforceVertices
Definition dungeon_map.h:29
constexpr int kTriforceFaces
Definition dungeon_map.h:30
constexpr int kNumDungeons
Definition dungeon_map.h:34
std::array< std::vector< std::array< std::string, kNumRooms > >, kNumDungeons > DungeonMapLabels
Definition dungeon_map.h:59
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:17
absl::Status SaveDungeonMaps(Rom &rom, std::vector< DungeonMap > &dungeon_maps)
Save the dungeon maps to the ROM.
unsigned char nbr_of_floor
Definition dungeon_map.h:43
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:48
std::vector< std::array< uint8_t, kNumRooms > > floor_rooms
Definition dungeon_map.h:45
unsigned char nbr_of_basement
Definition dungeon_map.h:44
std::vector< std::array< uint8_t, kNumRooms > > floor_gfx
Definition dungeon_map.h:46
unsigned short boss_room
Definition dungeon_map.h:42