Skip to content

Commit

Permalink
Add setting to show coordinates as they are seen In-Game
Browse files Browse the repository at this point in the history
  • Loading branch information
savage13 committed Mar 25, 2024
1 parent c5483fa commit 2211f3b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 3 deletions.
8 changes: 8 additions & 0 deletions src/components/AppMapDetailsBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -20,4 +21,11 @@ export default class AppMapDetailsBase<MarkerClass> 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(", ")
}
}
2 changes: 1 addition & 1 deletion src/components/AppMapDetailsDungeon.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<h2 class="location-sub">{{sub}}</h2>
<div>Dungeon number: {{marker.data.dungeonNum}}</div>
<div v-if="marker.data.lm.l.ShrineInCave" style="color: orange"><i class="fa fa-exclamation-circle"></i> Inside Cave</div>
<section title="Warning: This is the marker position; actual Dungeon Position may be different ">Position: {{pos[0].toFixed(2)}}, {{pos[1].toFixed(2)}}, {{(-pos[2]).toFixed(2)}}</section>
<section title="Warning: This is the marker position; actual Dungeon Position may be different ">Position: {{formatPosition(pos)}}</section>
<hr>
<section v-if="tboxObjs.length">
<h4 class="subsection-heading">Treasure Chests</h4>
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppMapDetailsObj.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<section v-if="obj" class="mt-2">
<section v-if="isActuallyRankedUp(obj)">Actor: {{getRankedUpActorNameForObj(obj)}} (ranked up)</section>
<section v-if="!isActuallyRankedUp(obj)">Actor: {{obj.name}}</section>
<section>Position: {{obj.data.Translate[0].toFixed(2)}}, {{obj.data.Translate[1].toFixed(2)}}, {{(-obj.data.Translate[2]).toFixed(2)}}</section>
<section>Position: {{formatPosition(obj.data.Translate)}}</section>
<section v-if="obj.data.Scale != null">Scale: {{arrayOrNumToStr(obj.data.Scale, 2)}}</section>
<section v-if="obj.data.Rotate != null">Rotate: {{arrayOrNumToStr(obj.data.Rotate, 5)}}</section>
<section v-if="obj.data.Name">Unique name: {{obj.data.Name}}</section>
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppMapDetailsPlace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ObjectInfo :obj="minobj" :key="minobj.objid" className="obj-main-info" />
</section>
<section v-if="minobj" class="mt-2">
Position: {{minobj.pos[0].toFixed(2)}} {{minobj.pos[1].toFixed(2)}} {{(-minobj.pos[2]).toFixed(2)}}
Position: {{formatPosition(minobj.pos)}}
</section>
<section v-if="shopDataExists()">
<ShopData :data="shopData[this.sub]" />
Expand Down
8 changes: 8 additions & 0 deletions src/components/AppMapSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
<b-checkbox switch v-model="s.useHexForHashIds">Show hash IDs in hex</b-checkbox>
<b-checkbox switch @change="toggleY">Show object heights in tooltips</b-checkbox>
<hr>
<section>
<h4 class="subsection-heading">Use In-Game Coordinates</h4>
<b-checkbox switch v-model="s.inGameCoordinates">Display Coordinates as those In-Game</b-checkbox>
<p class="small">
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).
</p>
</section>
<hr>
<section>
<h4 class="subsection-heading">Custom Search Presets</h4>
<div class="d-flex mb-1" v-for="(preset, idx) in s.customSearchPresets" :key="idx">
Expand Down
3 changes: 3 additions & 0 deletions src/util/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export class Settings {

decompBannerHidden!: boolean;
noTouchScreen!: boolean;
inGameCoordinates!: boolean;

private constructor() {
this.load();
Expand Down Expand Up @@ -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();
}

Expand All @@ -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);
Expand Down

0 comments on commit 2211f3b

Please sign in to comment.