yaze
0.3.2
Link to the Past ROM Editor
Loading...
Searching...
No Matches
sheet_role_palette_table.cc
Go to the documentation of this file.
1
#include "
app/gfx/types/sheet_role_palette_table.h
"
2
3
namespace
yaze
{
4
namespace
gfx {
5
6
namespace
{
7
8
// Sheet-id partition mirrors zelda3/game_data.cc ProcessSheetBitmap defaults:
9
// id < 113 -> dungeon_main
10
// id < 128 -> sprites_aux1
11
// id >= 128 -> hud
12
constexpr
int
kDungeonSheetIdEnd
= 113;
13
constexpr
int
kSpriteSheetIdEnd
= 128;
14
15
}
// namespace
16
17
SheetRole
RoleForBlocksetSlot
(
int
slot_index) {
18
// Mirrors Tile16Editor::GetPaletteSlotForSheet/GetPaletteBaseForSheet.
19
switch
(slot_index) {
20
case
0:
21
return
SheetRole::kOverworldMain
;
22
case
1:
23
case
2:
24
return
SheetRole::kOverworldGfx
;
25
case
3:
26
case
4:
27
return
SheetRole::kOverworldAreaAux1
;
28
case
5:
29
case
6:
30
return
SheetRole::kOverworldAreaAux2
;
31
case
7:
32
return
SheetRole::kOverworldAnimated
;
33
default
:
34
return
SheetRole::kUnclassified
;
35
}
36
}
37
38
SheetRole
RoleForRoomsetSlot
(
int
slot_index) {
39
// Roomsets override blockset slots 4..7.
40
if
(slot_index < 0 || slot_index > 3) {
41
return
SheetRole::kUnclassified
;
42
}
43
return
RoleForBlocksetSlot
(slot_index + 4);
44
}
45
46
SheetRole
RoleForSpritesetSlot
(
int
slot_index) {
47
if
(slot_index < 0 || slot_index > 3) {
48
return
SheetRole::kUnclassified
;
49
}
50
return
SheetRole::kSpriteAux1
;
51
}
52
53
SheetRole
RoleForSheetId
(
int
sheet_id) {
54
if
(sheet_id < 0)
55
return
SheetRole::kUnclassified
;
56
if
(sheet_id < kDungeonSheetIdEnd)
57
return
SheetRole::kDungeonMain
;
58
if
(sheet_id < kSpriteSheetIdEnd)
59
return
SheetRole::kSpriteAux1
;
60
return
SheetRole::kHud
;
61
}
62
63
SheetRolePaletteBinding
DefaultBindingFor
(
SheetRole
role) {
64
switch
(role) {
65
case
SheetRole::kOverworldMain
:
66
// Slot 0 routes to AUX1 region; tile16 reports cgram row 2.
67
return
{
"ow_aux"
, 0, 2};
68
case
SheetRole::kOverworldGfx
:
69
return
{
"ow_main"
, 0, 2};
70
case
SheetRole::kOverworldAreaAux1
:
71
return
{
"ow_aux"
, 0, 2};
72
case
SheetRole::kOverworldAreaAux2
:
73
return
{
"ow_aux"
, 1, 5};
74
case
SheetRole::kOverworldAnimated
:
75
return
{
"ow_animated"
, 0, 7};
76
case
SheetRole::kSpriteAux1
:
77
return
{
"sprites_aux1"
, 0, 0};
78
case
SheetRole::kHud
:
79
return
{
"hud"
, 0, 0};
80
case
SheetRole::kDungeonMain
:
81
return
{
"dungeon_main"
, 0, 0};
82
case
SheetRole::kUnclassified
:
83
default
:
84
return
{
""
, 0, 0};
85
}
86
}
87
88
}
// namespace gfx
89
}
// namespace yaze
yaze::gfx::anonymous_namespace{sheet_role_palette_table.cc}::kSpriteSheetIdEnd
constexpr int kSpriteSheetIdEnd
Definition
sheet_role_palette_table.cc:13
yaze::gfx::anonymous_namespace{sheet_role_palette_table.cc}::kDungeonSheetIdEnd
constexpr int kDungeonSheetIdEnd
Definition
sheet_role_palette_table.cc:12
yaze::gfx::RoleForSheetId
SheetRole RoleForSheetId(int sheet_id)
Definition
sheet_role_palette_table.cc:53
yaze::gfx::DefaultBindingFor
SheetRolePaletteBinding DefaultBindingFor(SheetRole role)
Definition
sheet_role_palette_table.cc:63
yaze::gfx::RoleForRoomsetSlot
SheetRole RoleForRoomsetSlot(int slot_index)
Definition
sheet_role_palette_table.cc:38
yaze::gfx::SheetRole
SheetRole
Definition
sheet_role.h:21
yaze::gfx::SheetRole::kOverworldMain
@ kOverworldMain
yaze::gfx::SheetRole::kOverworldAreaAux2
@ kOverworldAreaAux2
yaze::gfx::SheetRole::kOverworldAreaAux1
@ kOverworldAreaAux1
yaze::gfx::SheetRole::kSpriteAux1
@ kSpriteAux1
yaze::gfx::SheetRole::kOverworldAnimated
@ kOverworldAnimated
yaze::gfx::SheetRole::kHud
@ kHud
yaze::gfx::SheetRole::kOverworldGfx
@ kOverworldGfx
yaze::gfx::SheetRole::kUnclassified
@ kUnclassified
yaze::gfx::SheetRole::kDungeonMain
@ kDungeonMain
yaze::gfx::RoleForBlocksetSlot
SheetRole RoleForBlocksetSlot(int slot_index)
Definition
sheet_role_palette_table.cc:17
yaze::gfx::RoleForSpritesetSlot
SheetRole RoleForSpritesetSlot(int slot_index)
Definition
sheet_role_palette_table.cc:46
yaze
Definition
patch_export_usage.cc:8
sheet_role_palette_table.h
yaze::gfx::SheetRolePaletteBinding
Definition
sheet_role_palette_table.h:15
src
app
gfx
types
sheet_role_palette_table.cc
Generated by
1.10.0