forked from phenom/healer-man
Release Healer Man 0.1.40
This commit is contained in:
1 parent
ed0d2fea3d
commit
197a64117c
215 files changed
+5131
-181
No files matched your search
+8
-2
@@ -3,6 +3,8 @@ import type { Vector3Tuple } from "../game/dungeonManifest";
|
||||
import { DungeonMapGraphic } from "./DungeonMapGraphic";
|
||||
import { useInputBindingLabels } from "../input/useInputBindingLabels";
|
||||
import { useGameStore } from "../game/store";
|
||||
import { requireDungeonDefinition } from "../game/dungeonRegistry";
|
||||
import { wowDungeonMapFor, wowMapFloorFor, wowMapHeading } from "../game/wowDungeonMap";
|
||||
|
||||
export interface MinimapProps {
|
||||
position: Vector3Tuple;
|
||||
@@ -23,15 +25,19 @@ export function Minimap({
|
||||
}: MinimapProps) {
|
||||
const bindingLabel = useInputBindingLabels();
|
||||
const inputMode = useGameStore((state) => state.inputMode);
|
||||
const dungeonId = useGameStore((state) => state.activeDungeonId);
|
||||
const map = wowDungeonMapFor(requireDungeonDefinition(dungeonId));
|
||||
const direction = map ? wowMapHeading(map, wowMapFloorFor(map, position), position, yaw) : null;
|
||||
const compassYaw = direction ? Math.atan2(direction[0], -direction[1]) : yaw;
|
||||
const mapKey = bindingLabel(inputMode === "gamepad" ? "controller" : "pc", "map");
|
||||
const heading = ((Math.round((yaw * 180) / Math.PI) % 360) + 360) % 360;
|
||||
const heading = ((Math.round((compassYaw * 180) / Math.PI) % 360) + 360) % 360;
|
||||
return (
|
||||
<section className="hud-minimap" aria-label="Dungeon minimap">
|
||||
<button type="button" className="hud-minimap__map" onClick={onOpenMap} aria-label="Open full dungeon map">
|
||||
<span className="hud-minimap__north" aria-hidden="true">N</span>
|
||||
<span
|
||||
className="hud-minimap__viewport"
|
||||
style={{ "--minimap-turn": rotationMode === "player-up" ? `${-yaw}rad` : "0rad" } as CSSProperties}
|
||||
style={{ "--minimap-turn": rotationMode === "player-up" ? `${-compassYaw}rad` : "0rad" } as CSSProperties}
|
||||
aria-hidden="true"
|
||||
>
|
||||
<DungeonMapGraphic position={position} yaw={yaw} compact />
|
||||
|
||||
Reference in new issue
Block a user