mirror of
https://github.com/bdnugget/rs-sdk.git
synced 2026-11-07 09:07:30 +00:00
mapview: cover 289's map squares with non-overlapping bands
289 added Ape Atoll (rows 42-43), its dungeon (142-143) and squares at raw row 69, which the old z remap either dropped or drew on top of the underground. The bounds also skipped every edge square, so row 44 and columns 55-56 were never drawn. Replace the ad-hoc remap with a band table (overworld 42-62, underground 142-161 -> 63-82, misc 69-77 -> 83-91), widen the bounds to columns 29-56 with a padding square on each side, and leave rows outside every band undrawn instead of placing them at their raw position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
882699169a
commit
b6714fa74e
2 files changed
+47
-39
No files matched your search
+6
-3
@@ -333,9 +333,12 @@ Upgrade hazards:
|
||||
- [ ] **`GameShell.ts`** — `deltime = 14` (≈30% faster client loop).
|
||||
- [ ] **`MapView.ts`** — live player-position tracking (`playerPositions`,
|
||||
`shouldDrawPlayers`) for the `/mapview/` page; pairs with engine `/playerpositions`.
|
||||
Also replaces upstream's three-area map (`reloadMain/Dungeon/Extra`) with one unified map
|
||||
(`remapZ`, bounds `28<<6` × `44<<6`): on conflict keep ours. 289 widened upstream's main
|
||||
area to mx 32–57 / mz 41–63; our layout still ends at mx 55 / starts at mz 44 (not extended).
|
||||
Also replaces upstream's three-area map (`reloadMain/Dungeon/Extra`) with one unified map:
|
||||
`MAP_BANDS` stacks overworld (raw mapsquare rows 42–62), underground (142–161 → 63–82) and
|
||||
the high-z misc areas (69–77 → 83–91) without overlap; columns 29–56; bounds include one
|
||||
padding square per side because the loaders skip edge squares. On conflict keep ours. After
|
||||
a content sync, list `content/maps/m*_*.jm2` and confirm every square falls in a band and
|
||||
the column range (289 added Ape Atoll at rows 42–43 and its dungeon at 142–143).
|
||||
- [ ] `src/3rdparty/tinymidipcm.js` tweak; `package.json` (bun scripts, deps).
|
||||
- [ ] **Filename casing**: `src/io/JagFile.ts` (capital F) in webclient vs `src/io/Jagfile.ts`
|
||||
in engine. macOS hides case-only renames from git — after a sync run:
|
||||
|
||||
@@ -20,6 +20,15 @@ export class MapView extends GameShell {
|
||||
static shouldDrawMultimap: boolean = false;
|
||||
static shouldDrawFreemap: boolean = false;
|
||||
static shouldDrawPlayers: boolean = true;
|
||||
|
||||
// custom: the unified map stacks three regions north of each other in mapsquare rows, without
|
||||
// overlap: overworld (raw 42-62, incl. Ape Atoll), underground (raw 142-161 -> 63-82) and the
|
||||
// high-z misc areas (raw 69-77 -> 83-91). Rows outside every band are not drawn.
|
||||
static readonly MAP_BANDS: readonly { from: number; to: number; offset: number }[] = [
|
||||
{ from: 42, to: 62, offset: 0 },
|
||||
{ from: 142, to: 161, offset: -79 },
|
||||
{ from: 69, to: 77, offset: 14 }
|
||||
];
|
||||
static shouldDrawHistory: boolean = true; // heatmap on by default; fetched lazily on first frame
|
||||
|
||||
// custom: long-term anonymous movement traces ('H'), pre-rendered into a sparse
|
||||
@@ -60,13 +69,14 @@ export class MapView extends GameShell {
|
||||
pinchMidX: number = 0;
|
||||
pinchMidY: number = 0;
|
||||
|
||||
// custom: unified map — overworld (mz 44-62) + underground (62-79, overlaps OW last row) + misc (80-86)
|
||||
// custom: unified map - mapsquare columns 29-56 and the bands in MAP_BANDS (unified rows 42-91),
|
||||
// plus one padding square on every side: the loaders skip edge squares, which they blend against
|
||||
mapStartX: number = 50 << 6;
|
||||
mapStartZ: number = 50 << 6;
|
||||
mapWidth: number = 28 << 6;
|
||||
mapHeight: number = 44 << 6;
|
||||
mapWidth: number = 30 << 6;
|
||||
mapHeight: number = 52 << 6;
|
||||
mapOriginX: number = 28 << 6;
|
||||
mapOriginZ: number = 44 << 6;
|
||||
mapOriginZ: number = 41 << 6;
|
||||
focusX: number = this.mapStartX - this.mapOriginX;
|
||||
focusZ: number = this.mapOriginZ + this.mapHeight - this.mapStartZ;
|
||||
|
||||
@@ -952,10 +962,8 @@ export class MapView extends GameShell {
|
||||
loadUnderlay(data: Packet): void {
|
||||
while (data.available > 0) {
|
||||
const mx: number = data.g1() * 64 - this.mapOriginX;
|
||||
let rawMz: number = data.g1();
|
||||
if (rawMz >= 144) rawMz -= 82;
|
||||
else if (rawMz >= 70 && rawMz <= 76) rawMz += 10;
|
||||
const mz: number = rawMz * 64 - this.mapOriginZ;
|
||||
const unifiedMz: number = MapView.unifiedSquareZ(data.g1());
|
||||
const mz: number = unifiedMz === -1 ? -1 : unifiedMz * 64 - this.mapOriginZ;
|
||||
|
||||
if (mx > 0 && mz > 0 && mx + 64 < this.mapWidth && mz + 64 < this.mapHeight) {
|
||||
for (let x: number = 0; x < 64; x++) {
|
||||
@@ -974,10 +982,8 @@ export class MapView extends GameShell {
|
||||
loadOverlay(data: Packet): void {
|
||||
while (data.available > 0) {
|
||||
const mx: number = data.g1() * 64 - this.mapOriginX;
|
||||
let rawMz: number = data.g1();
|
||||
if (rawMz >= 144) rawMz -= 82;
|
||||
else if (rawMz >= 70 && rawMz <= 76) rawMz += 10;
|
||||
const mz: number = rawMz * 64 - this.mapOriginZ;
|
||||
const unifiedMz: number = MapView.unifiedSquareZ(data.g1());
|
||||
const mz: number = unifiedMz === -1 ? -1 : unifiedMz * 64 - this.mapOriginZ;
|
||||
|
||||
if (mx > 0 && mz > 0 && mx + 64 < this.mapWidth && mz + 64 < this.mapHeight) {
|
||||
for (let x: number = 0; x < 64; x++) {
|
||||
@@ -1007,10 +1013,8 @@ export class MapView extends GameShell {
|
||||
loadLoc(data: Packet): void {
|
||||
while (data.available > 0) {
|
||||
const mx: number = data.g1() * 64 - this.mapOriginX;
|
||||
let rawMz: number = data.g1();
|
||||
if (rawMz >= 144) rawMz -= 82;
|
||||
else if (rawMz >= 70 && rawMz <= 76) rawMz += 10;
|
||||
const mz: number = rawMz * 64 - this.mapOriginZ;
|
||||
const unifiedMz: number = MapView.unifiedSquareZ(data.g1());
|
||||
const mz: number = unifiedMz === -1 ? -1 : unifiedMz * 64 - this.mapOriginZ;
|
||||
|
||||
if (mx > 0 && mz > 0 && mx + 64 < this.mapWidth && mz + 64 < this.mapHeight) {
|
||||
for (let x: number = 0; x < 64; x++) {
|
||||
@@ -1056,10 +1060,8 @@ export class MapView extends GameShell {
|
||||
loadObj(data: Packet): void {
|
||||
while (data.available > 0) {
|
||||
const mx: number = data.g1() * 64 - this.mapOriginX;
|
||||
let rawMz: number = data.g1();
|
||||
if (rawMz >= 144) rawMz -= 82;
|
||||
else if (rawMz >= 70 && rawMz <= 76) rawMz += 10;
|
||||
const mz: number = rawMz * 64 - this.mapOriginZ;
|
||||
const unifiedMz: number = MapView.unifiedSquareZ(data.g1());
|
||||
const mz: number = unifiedMz === -1 ? -1 : unifiedMz * 64 - this.mapOriginZ;
|
||||
|
||||
if (mx > 0 && mz > 0 && mx + 64 < this.mapWidth && mz + 64 < this.mapHeight) {
|
||||
for (let x: number = 0; x < 64; x++) {
|
||||
@@ -1079,10 +1081,8 @@ export class MapView extends GameShell {
|
||||
loadNpc(data: Packet): void {
|
||||
while (data.available > 0) {
|
||||
const mx: number = data.g1() * 64 - this.mapOriginX;
|
||||
let rawMz: number = data.g1();
|
||||
if (rawMz >= 144) rawMz -= 82;
|
||||
else if (rawMz >= 70 && rawMz <= 76) rawMz += 10;
|
||||
const mz: number = rawMz * 64 - this.mapOriginZ;
|
||||
const unifiedMz: number = MapView.unifiedSquareZ(data.g1());
|
||||
const mz: number = unifiedMz === -1 ? -1 : unifiedMz * 64 - this.mapOriginZ;
|
||||
|
||||
if (mx > 0 && mz > 0 && mx + 64 < this.mapWidth && mz + 64 < this.mapHeight) {
|
||||
for (let x: number = 0; x < 64; x++) {
|
||||
@@ -1102,10 +1102,8 @@ export class MapView extends GameShell {
|
||||
loadMulti(data: Packet): void {
|
||||
while (data.available > 0) {
|
||||
const mx: number = data.g1() * 64 - this.mapOriginX;
|
||||
let rawMz: number = data.g1();
|
||||
if (rawMz >= 144) rawMz -= 82;
|
||||
else if (rawMz >= 70 && rawMz <= 76) rawMz += 10;
|
||||
const mz: number = rawMz * 64 - this.mapOriginZ;
|
||||
const unifiedMz: number = MapView.unifiedSquareZ(data.g1());
|
||||
const mz: number = unifiedMz === -1 ? -1 : unifiedMz * 64 - this.mapOriginZ;
|
||||
|
||||
if (mx > 0 && mz > 0 && mx + 64 < this.mapWidth && mz + 64 < this.mapHeight) {
|
||||
for (let x: number = 0; x < 64; x++) {
|
||||
@@ -1125,10 +1123,8 @@ export class MapView extends GameShell {
|
||||
loadFree(data: Packet): void {
|
||||
while (data.available > 0) {
|
||||
const mx: number = data.g1() * 64 - this.mapOriginX;
|
||||
let rawMz: number = data.g1();
|
||||
if (rawMz >= 144) rawMz -= 82;
|
||||
else if (rawMz >= 70 && rawMz <= 76) rawMz += 10;
|
||||
const mz: number = rawMz * 64 - this.mapOriginZ;
|
||||
const unifiedMz: number = MapView.unifiedSquareZ(data.g1());
|
||||
const mz: number = unifiedMz === -1 ? -1 : unifiedMz * 64 - this.mapOriginZ;
|
||||
|
||||
if (mx > 0 && mz > 0 && mx + 64 < this.mapWidth && mz + 64 < this.mapHeight) {
|
||||
for (let x: number = 0; x < 64; x++) {
|
||||
@@ -2015,10 +2011,18 @@ export class MapView extends GameShell {
|
||||
|
||||
// custom: remap z-coordinates into the unified map space
|
||||
remapZ(z: number): number {
|
||||
const mz: number = (z >> 6);
|
||||
if (mz >= 144) return z - (82 << 6);
|
||||
if (mz >= 70 && mz <= 76) return z + (10 << 6);
|
||||
return z;
|
||||
const mz: number = MapView.unifiedSquareZ(z >> 6);
|
||||
return mz === -1 ? -1 : (mz << 6) | (z & 63);
|
||||
}
|
||||
|
||||
// custom: raw mapsquare row -> unified row, or -1 for rows outside every band
|
||||
static unifiedSquareZ(mz: number): number {
|
||||
for (const band of MapView.MAP_BANDS) {
|
||||
if (mz >= band.from && mz <= band.to) {
|
||||
return mz + band.offset;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// custom: fetch player positions from server
|
||||
@@ -2346,6 +2350,7 @@ export class MapView extends GameShell {
|
||||
|
||||
const prevZ: number = this.remapZ(prev.z);
|
||||
const currZ: number = this.remapZ(curr.z);
|
||||
if (prevZ === -1 || currZ === -1) continue;
|
||||
const prevMapX: number = prev.x - this.mapOriginX;
|
||||
const prevMapY: number = this.mapOriginZ + this.mapHeight - prevZ;
|
||||
const currMapX: number = curr.x - this.mapOriginX;
|
||||
|
||||
Reference in new issue
Block a user