From 2211f3bb977f7a092b9fb40746b7fa0218042d1a Mon Sep 17 00:00:00 2001 From: Brian Savage Date: Mon, 25 Mar 2024 19:47:26 -0400 Subject: [PATCH] Add setting to show coordinates as they are seen In-Game --- src/components/AppMapDetailsBase.ts | 8 ++++++++ src/components/AppMapDetailsDungeon.vue | 2 +- src/components/AppMapDetailsObj.vue | 2 +- src/components/AppMapDetailsPlace.vue | 2 +- src/components/AppMapSettings.vue | 8 ++++++++ src/util/settings.ts | 3 +++ 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/components/AppMapDetailsBase.ts b/src/components/AppMapDetailsBase.ts index 96d3342..f46838a 100644 --- a/src/components/AppMapDetailsBase.ts +++ b/src/components/AppMapDetailsBase.ts @@ -5,6 +5,7 @@ import Component, { mixins } from 'vue-class-component'; import MixinUtil from '@/components/MixinUtil'; import { ObjectMinData } from '@/services/MapMgr'; import * as ui from '@/util/ui'; +import { Settings } from '@/util/settings'; @Component({ watch: { @@ -20,4 +21,11 @@ export default class AppMapDetailsBase extends mixins(MixinUtil) { private created() { this.init(); } + formatPosition(pos: number[]): string { + const inGame = Settings.getInstance().inGameCoordinates + let xyz = [pos[0], pos[1], -pos[2]] // E-W, U-D, N-S + if (inGame) + xyz = [pos[0], -pos[2], pos[1] - 106] // E-W, N-S, U-D -160 + return xyz.map(v => v.toFixed(2)).join(", ") + } } diff --git a/src/components/AppMapDetailsDungeon.vue b/src/components/AppMapDetailsDungeon.vue index 304c6ad..e6255b9 100644 --- a/src/components/AppMapDetailsDungeon.vue +++ b/src/components/AppMapDetailsDungeon.vue @@ -3,7 +3,7 @@

{{sub}}

Dungeon number: {{marker.data.dungeonNum}}
Inside Cave
-
Position: {{pos[0].toFixed(2)}}, {{pos[1].toFixed(2)}}, {{(-pos[2]).toFixed(2)}}
+
Position: {{formatPosition(pos)}}

Treasure Chests

diff --git a/src/components/AppMapDetailsObj.vue b/src/components/AppMapDetailsObj.vue index 2cc9edb..89d198d 100644 --- a/src/components/AppMapDetailsObj.vue +++ b/src/components/AppMapDetailsObj.vue @@ -8,7 +8,7 @@
Actor: {{getRankedUpActorNameForObj(obj)}} (ranked up)
Actor: {{obj.name}}
-
Position: {{obj.data.Translate[0].toFixed(2)}}, {{obj.data.Translate[1].toFixed(2)}}, {{(-obj.data.Translate[2]).toFixed(2)}}
+
Position: {{formatPosition(obj.data.Translate)}}
Scale: {{arrayOrNumToStr(obj.data.Scale, 2)}}
Rotate: {{arrayOrNumToStr(obj.data.Rotate, 5)}}
Unique name: {{obj.data.Name}}
diff --git a/src/components/AppMapDetailsPlace.vue b/src/components/AppMapDetailsPlace.vue index 1e04fd4..af9d4b7 100644 --- a/src/components/AppMapDetailsPlace.vue +++ b/src/components/AppMapDetailsPlace.vue @@ -5,7 +5,7 @@
- Position: {{minobj.pos[0].toFixed(2)}} {{minobj.pos[1].toFixed(2)}} {{(-minobj.pos[2]).toFixed(2)}} + Position: {{formatPosition(minobj.pos)}}
diff --git a/src/components/AppMapSettings.vue b/src/components/AppMapSettings.vue index e0f324e..4d1d6be 100644 --- a/src/components/AppMapSettings.vue +++ b/src/components/AppMapSettings.vue @@ -18,6 +18,14 @@ Show hash IDs in hex Show object heights in tooltips
+
+

Use In-Game Coordinates

+ Display Coordinates as those In-Game +

+ Coordinates here are displayed as East-West, Vertical, North-South (x,z,y). This option converts the coordinates to match those In-Game as East-West, North-South, Vertical - 106 meters (x,y,z). +

+
+

Custom Search Presets

diff --git a/src/util/settings.ts b/src/util/settings.ts index fae2805..6af193c 100644 --- a/src/util/settings.ts +++ b/src/util/settings.ts @@ -42,6 +42,7 @@ export class Settings { decompBannerHidden!: boolean; noTouchScreen!: boolean; + inGameCoordinates!: boolean; private constructor() { this.load(); @@ -73,6 +74,7 @@ export class Settings { this.drawControlsShown = parse(data.drawControlsShown, Id, false); this.decompBannerHidden = parse(data.decompBannerHidden, Id, false); this.noTouchScreen = parse(data.noTouchScreen, Id, false); + this.inGameCoordinates = parse(data.inGameCoordinates, Id, false); this.invokeCallbacks(); } @@ -96,6 +98,7 @@ export class Settings { drawControlsShown: this.drawControlsShown, decompBannerHidden: this.decompBannerHidden, noTouchScreen: this.noTouchScreen, + inGameCoordinates: this.inGameCoordinates, }; // Merge with existing data to avoid data loss. const existingDataStr = localStorage.getItem(Settings.KEY);