yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
room_default_entrance.h
Go to the documentation of this file.
1#ifndef YAZE_ZELDA3_DUNGEON_ROOM_DEFAULT_ENTRANCE_H
2#define YAZE_ZELDA3_DUNGEON_ROOM_DEFAULT_ENTRANCE_H
3
4#include <cstdint>
5#include <vector>
6
7namespace yaze {
8
9class Rom;
10
11namespace zelda3 {
12
13// How a room's default entrance was chosen.
14enum class RoomEntranceSource : uint8_t {
15 kNone, // No entrance could be associated with the room.
16 kDirect, // An entrance leads straight into the room.
17 kDungeonMap, // The room is on a dungeon's pause-menu map.
18 kNeighbour, // Inherited from an adjacent room in the 16-wide room grid.
19};
20
21// The entrance the game would most plausibly load a room through, and the
22// main graphics set that entrance selects.
23//
24// The game's main blockset ($0AA1) comes only from the entrance
25// (Underworld_LoadEntrance: EntranceData.main_GFX -> $0AA1); moving between
26// rooms never changes it. The room header's blockset byte is the secondary
27// set ($0AA2). A room entered through a door therefore uses the main graphics
28// of the dungeon it belongs to, which yaze recovers here.
30 int entrance_id = -1; // Regular entrance index, or -1.
31 uint8_t main_blockset = 0xFF; // EntranceData.main_GFX, or 0xFF.
33 int via_room = -1; // For kNeighbour: the room inherited from.
34};
35
36struct GameData;
37
38// The source selected by the same main-blockset precedence as
39// Room::LoadRoomGraphics. A default is direct only when the default entrance
40// actually leads into this room; map and neighbour defaults are inferred.
48
53
55 int room_id, uint8_t header_blockset, uint8_t requested_main_blockset,
56 const GameData& game_data);
57
58// Palette half for a destination background slot (tile ID / 64). The game's
59// runtime upload slot runs in the opposite direction. Index zero remains
60// transparent; apply this offset only to nonzero 3bpp pixel indices.
61int DungeonBackgroundPaletteOffset(uint8_t main_blockset, int destination_slot);
62
63// One entry per dungeon room (kNumberOfRooms), in order:
64// 1. an entrance whose room is this room;
65// 2. an entrance of the dungeon whose pause-menu map lists the room (map
66// index to dungeon ID by majority over that map's direct entrances);
67// 3. the choice of a neighbouring room (+-1 in the same row, +-16).
68std::vector<RoomDefaultEntrance> ComputeRoomDefaultEntrances(Rom& rom);
69
70} // namespace zelda3
71} // namespace yaze
72
73#endif // YAZE_ZELDA3_DUNGEON_ROOM_DEFAULT_ENTRANCE_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:49
std::vector< RoomDefaultEntrance > ComputeRoomDefaultEntrances(Rom &rom)
int DungeonBackgroundPaletteOffset(uint8_t main_blockset, int destination_slot)
RoomMainBlocksetResolution ResolveRoomMainBlockset(int room_id, uint8_t header_blockset, uint8_t requested_main_blockset, const GameData &game_data)