41 int world,
int game_state, ImVec2 screen_position, ImVec2 canvas_origin,
43 if (!std::isfinite(scale) || scale <= 0) {
50 ImVec2((screen_position.x - canvas_origin.x - scrolling.x) / scale,
51 (screen_position.y - canvas_origin.y - scrolling.y) / scale);
53 if (!std::isfinite(pos.x) || !std::isfinite(pos.y) || pos.x < 0 ||
54 pos.x >= 4096 || pos.y < 0 || pos.y >= 4096 || world < 0 || world > 2) {
57 target.
map_id = world * 64 +
static_cast<int>(pos.x) / 512 +
58 (
static_cast<int>(pos.y) / 512) * 8;
60 return target.
valid(map_count) ? std::make_optional(target) : std::nullopt;
std::optional< OverworldContextTarget > ResolveOverworldContextTarget(int world, int game_state, ImVec2 screen_position, ImVec2 canvas_origin, ImVec2 scrolling, float scale, int map_count=zelda3::kNumOverworldMaps)
bool valid(int map_count=zelda3::kNumOverworldMaps) const