yaze
0.3.2
Link to the Past ROM Editor
Loading...
Searching...
No Matches
overworld_map_status.h
Go to the documentation of this file.
1
#ifndef YAZE_APP_EDITOR_OVERWORLD_OVERWORLD_MAP_STATUS_H_
2
#define YAZE_APP_EDITOR_OVERWORLD_OVERWORLD_MAP_STATUS_H_
3
4
#include <string>
5
6
#include "absl/strings/str_format.h"
7
8
namespace
yaze::editor
{
9
10
// Absolute overworld map IDs pack world as map / 0x40.
11
inline
const
char
*
OverworldWorldLabelFromMap
(
int
map_id) {
12
switch
(map_id / 0x40) {
13
case
0:
14
return
"LW"
;
15
case
1:
16
return
"DW"
;
17
case
2:
18
return
"SW"
;
19
default
:
20
return
"??"
;
21
}
22
}
23
24
// Effective hover map for status/preview: on leave / no hover, fall back to
25
// "not hovering" (-1) so callers show the selected map only.
26
inline
int
EffectiveOverworldHoverMap
(
int
hovered_map,
bool
canvas_hovered) {
27
return
canvas_hovered ? hovered_map : -1;
28
}
29
30
// Status-bar Map segment: prefer hovered identity while the canvas is hovered.
31
// When hover differs from selection, keep both visible and distinct.
32
inline
std::string
FormatOverworldMapStatusSegment
(
int
current_map,
33
int
hovered_map) {
34
if
(hovered_map < 0 || hovered_map == current_map) {
35
return
absl::StrFormat(
"%s #%02X"
,
OverworldWorldLabelFromMap
(current_map),
36
current_map & 0xFF);
37
}
38
39
const
char
* hover_world =
OverworldWorldLabelFromMap
(hovered_map);
40
const
char
* sel_world =
OverworldWorldLabelFromMap
(current_map);
41
// Labels are stable string literals from OverworldWorldLabelFromMap.
42
if
(hover_world == sel_world) {
43
return
absl::StrFormat(
"%s #%02X · sel #%02X"
, hover_world,
44
hovered_map & 0xFF, current_map & 0xFF);
45
}
46
return
absl::StrFormat(
"%s #%02X · sel %s #%02X"
, hover_world,
47
hovered_map & 0xFF, sel_world, current_map & 0xFF);
48
}
49
50
}
// namespace yaze::editor
51
52
#endif
// YAZE_APP_EDITOR_OVERWORLD_OVERWORLD_MAP_STATUS_H_
yaze::editor
Editors are the view controllers for the application.
Definition
patch_export_usage.cc:9
yaze::editor::EffectiveOverworldHoverMap
int EffectiveOverworldHoverMap(int hovered_map, bool canvas_hovered)
Definition
overworld_map_status.h:26
yaze::editor::FormatOverworldMapStatusSegment
std::string FormatOverworldMapStatusSegment(int current_map, int hovered_map)
Definition
overworld_map_status.h:32
yaze::editor::OverworldWorldLabelFromMap
const char * OverworldWorldLabelFromMap(int map_id)
Definition
overworld_map_status.h:11
src
app
editor
overworld
overworld_map_status.h
Generated by
1.10.0