yaze
0.3.2
Link to the Past ROM Editor
Loading...
Searching...
No Matches
dungeon_door_edges.h
Go to the documentation of this file.
1
#ifndef YAZE_ZELDA3_ATLAS_DUNGEON_DOOR_EDGES_H_
2
#define YAZE_ZELDA3_ATLAS_DUNGEON_DOOR_EDGES_H_
3
4
// Door markers for the Dungeon Atlas: which doors sit on a room's outer wall,
5
// their category, and the pairing of doors on facing walls of grid
6
// neighbours. Ported from Oracle of Secrets Scripts/Maps/room_data.py
7
// (DOOR_CAT, pair_doors) so both pictures agree; these are display
8
// heuristics, not game rules.
9
10
#include <cstdint>
11
#include <string>
12
#include <vector>
13
14
namespace
yaze::zelda3::atlas
{
15
16
enum class
DoorCategory
: uint8_t {
17
kOpen
,
18
kOneSided
,
19
kShutter
,
20
kKey
,
21
kBigKey
,
22
kBomb
,
23
kExit
,
24
kKeyStairs
,
25
kOther
,
26
kIgnore
,
// Layer swap markers: never drawn.
27
};
28
29
const
char
*
DoorCategoryName
(
DoorCategory
category
);
30
DoorCategory
DoorCategoryForType
(
int
door_type);
31
32
// A door as the room stores it (zelda3::Room::Door).
33
struct
AtlasDoorFact
{
34
int
direction
= 0;
// zelda3::DoorDirection: 0 N, 1 S, 2 W, 3 E.
35
int
tile_x
= 0;
36
int
tile_y
= 0;
37
int
type
= 0;
// zelda3::DoorType byte.
38
std::string
type_name
;
39
};
40
41
// A door on the outer wall, as drawn in the gutter.
42
struct
AtlasDoor
{
43
char
wall
=
'N'
;
// N, S, W, E
44
int
pos
= 0;
// Tile position along the wall (0-63).
45
int
type
= 0;
46
std::string
type_name
;
47
DoorCategory
category
=
DoorCategory::kOther
;
48
};
49
50
// Doors on the outer wall with their category. Inner doors and layer swap
51
// markers are dropped; a normal door within 2 tiles of an exit marker on the
52
// same wall is that exit.
53
std::vector<AtlasDoor>
OuterWallDoors
(
const
std::vector<AtlasDoorFact>& doors);
54
55
struct
DoorEdge
{
56
int
a
= 0;
// Room with the door.
57
int
b
= 0;
// Grid neighbour (N = a-0x10, E = a+1).
58
char
dir
=
'E'
;
59
int
pos
= 0;
60
DoorCategory
category
=
DoorCategory::kOpen
;
61
bool
both_sides
=
false
;
// The neighbour has a matching door.
62
bool
one_sided_type
=
false
;
// One of the doors is a one-sided type.
63
std::vector<std::string>
types
;
64
};
65
66
// Pairs doors on facing walls (within 3 tiles). The stronger category wins
67
// (big key > key > shutter > bomb > open > one-sided); a door with no partner
68
// is a one-side edge. `doors_by_room` has one entry per room.
69
std::vector<DoorEdge>
PairDoorEdges
(
70
const
std::vector<std::vector<AtlasDoor>>& doors_by_room);
71
72
}
// namespace yaze::zelda3::atlas
73
74
#endif
// YAZE_ZELDA3_ATLAS_DUNGEON_DOOR_EDGES_H_
yaze::zelda3::atlas
Definition
atlas_annotations.cc:16
yaze::zelda3::atlas::OuterWallDoors
std::vector< AtlasDoor > OuterWallDoors(const std::vector< AtlasDoorFact > &doors)
Definition
dungeon_door_edges.cc:131
yaze::zelda3::atlas::DoorCategoryForType
DoorCategory DoorCategoryForType(int door_type)
Definition
dungeon_door_edges.cc:93
yaze::zelda3::atlas::PairDoorEdges
std::vector< DoorEdge > PairDoorEdges(const std::vector< std::vector< AtlasDoor > > &doors_by_room)
Definition
dungeon_door_edges.cc:171
yaze::zelda3::atlas::DoorCategory
DoorCategory
Definition
dungeon_door_edges.h:16
yaze::zelda3::atlas::DoorCategory::kOther
@ kOther
yaze::zelda3::atlas::DoorCategory::kKey
@ kKey
yaze::zelda3::atlas::DoorCategory::kKeyStairs
@ kKeyStairs
yaze::zelda3::atlas::DoorCategory::kBigKey
@ kBigKey
yaze::zelda3::atlas::DoorCategory::kIgnore
@ kIgnore
yaze::zelda3::atlas::DoorCategory::kBomb
@ kBomb
yaze::zelda3::atlas::DoorCategory::kExit
@ kExit
yaze::zelda3::atlas::DoorCategory::kOpen
@ kOpen
yaze::zelda3::atlas::DoorCategory::kOneSided
@ kOneSided
yaze::zelda3::atlas::DoorCategory::kShutter
@ kShutter
yaze::zelda3::atlas::DoorCategoryName
const char * DoorCategoryName(DoorCategory category)
Definition
dungeon_door_edges.cc:67
yaze::zelda3::category
category
Definition
object_templates.cc:18
yaze::zelda3::atlas::AtlasDoorFact
Definition
dungeon_door_edges.h:33
yaze::zelda3::atlas::AtlasDoorFact::tile_y
int tile_y
Definition
dungeon_door_edges.h:36
yaze::zelda3::atlas::AtlasDoorFact::type
int type
Definition
dungeon_door_edges.h:37
yaze::zelda3::atlas::AtlasDoorFact::type_name
std::string type_name
Definition
dungeon_door_edges.h:38
yaze::zelda3::atlas::AtlasDoorFact::direction
int direction
Definition
dungeon_door_edges.h:34
yaze::zelda3::atlas::AtlasDoorFact::tile_x
int tile_x
Definition
dungeon_door_edges.h:35
yaze::zelda3::atlas::AtlasDoor
Definition
dungeon_door_edges.h:42
yaze::zelda3::atlas::AtlasDoor::pos
int pos
Definition
dungeon_door_edges.h:44
yaze::zelda3::atlas::AtlasDoor::type_name
std::string type_name
Definition
dungeon_door_edges.h:46
yaze::zelda3::atlas::AtlasDoor::category
DoorCategory category
Definition
dungeon_door_edges.h:47
yaze::zelda3::atlas::AtlasDoor::wall
char wall
Definition
dungeon_door_edges.h:43
yaze::zelda3::atlas::AtlasDoor::type
int type
Definition
dungeon_door_edges.h:45
yaze::zelda3::atlas::DoorEdge
Definition
dungeon_door_edges.h:55
yaze::zelda3::atlas::DoorEdge::b
int b
Definition
dungeon_door_edges.h:57
yaze::zelda3::atlas::DoorEdge::dir
char dir
Definition
dungeon_door_edges.h:58
yaze::zelda3::atlas::DoorEdge::one_sided_type
bool one_sided_type
Definition
dungeon_door_edges.h:62
yaze::zelda3::atlas::DoorEdge::category
DoorCategory category
Definition
dungeon_door_edges.h:60
yaze::zelda3::atlas::DoorEdge::both_sides
bool both_sides
Definition
dungeon_door_edges.h:61
yaze::zelda3::atlas::DoorEdge::pos
int pos
Definition
dungeon_door_edges.h:59
yaze::zelda3::atlas::DoorEdge::a
int a
Definition
dungeon_door_edges.h:56
yaze::zelda3::atlas::DoorEdge::types
std::vector< std::string > types
Definition
dungeon_door_edges.h:63
src
zelda3
atlas
dungeon_door_edges.h
Generated by
1.10.0