fix: flip dungeon Y for north-up, guard COM exceptions
- Negate Y delta for dungeon tiles and objects so north points up (AC Y+ = north, canvas Y+ = down) - Wrap early COM calls in try/catch to prevent RPC_E_SERVERFAULT during state transitions (portal loading, etc.) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
3857c0de79
commit
b067a148f3
1 changed files with 6 additions and 6 deletions
|
|
@ -3877,9 +3877,9 @@ function updateRadarWindow(msg) {
|
||||||
ctx.globalAlpha = isCurrentFloor ? 0.85 : 0.12;
|
ctx.globalAlpha = isCurrentFloor ? 0.85 : 0.12;
|
||||||
|
|
||||||
(level.cells || []).forEach(cell => {
|
(level.cells || []).forEach(cell => {
|
||||||
// UB mirrors X: x = -(cell.x - playerX), Y is direct: y = cell.y - playerY
|
// UB mirrors X, Y flipped for north-up (AC Y+ = north, canvas Y+ = down)
|
||||||
const dx = -(cell.x - playerX) * scale;
|
const dx = -(cell.x - playerX) * scale;
|
||||||
const dy = (cell.y - playerY) * scale;
|
const dy = -(cell.y - playerY) * scale;
|
||||||
const tileCanvas = hasTiles ? dungeonTileCanvases[String(cell.env_id)] : null;
|
const tileCanvas = hasTiles ? dungeonTileCanvases[String(cell.env_id)] : null;
|
||||||
|
|
||||||
if (tileCanvas) {
|
if (tileCanvas) {
|
||||||
|
|
@ -3976,8 +3976,8 @@ function updateRadarWindow(msg) {
|
||||||
// Use raw physics coords in dungeons (X mirrored), EW/NS on surface
|
// Use raw physics coords in dungeons (X mirrored), EW/NS on surface
|
||||||
let dX, dY;
|
let dX, dY;
|
||||||
if (isDungeon && obj.raw_x !== undefined) {
|
if (isDungeon && obj.raw_x !== undefined) {
|
||||||
dX = -(obj.raw_x - playerX); // X mirrored to match UB coordinate system
|
dX = -(obj.raw_x - playerX); // X mirrored
|
||||||
dY = (obj.raw_y - playerY);
|
dY = -(obj.raw_y - playerY); // Y flipped for north-up
|
||||||
} else {
|
} else {
|
||||||
dX = obj.ew - playerEW;
|
dX = obj.ew - playerEW;
|
||||||
dY = obj.ns - playerNS;
|
dY = obj.ns - playerNS;
|
||||||
|
|
@ -4039,8 +4039,8 @@ function updateRadarWindow(msg) {
|
||||||
const withDist = objects.map(obj => {
|
const withDist = objects.map(obj => {
|
||||||
let distMeters, dX, dY;
|
let distMeters, dX, dY;
|
||||||
if (isDungeon && obj.raw_x !== undefined) {
|
if (isDungeon && obj.raw_x !== undefined) {
|
||||||
dX = -(obj.raw_x - playerX); // X mirrored
|
dX = -(obj.raw_x - playerX);
|
||||||
dY = (obj.raw_y - playerY);
|
dY = -(obj.raw_y - playerY);
|
||||||
distMeters = Math.sqrt(dX * dX + dY * dY); // raw coords are ~meters
|
distMeters = Math.sqrt(dX * dX + dY * dY); // raw coords are ~meters
|
||||||
} else {
|
} else {
|
||||||
dX = obj.ew - playerEW;
|
dX = obj.ew - playerEW;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue