Skip to content

Commit 30021b8

Browse files
author
Morgan Christiansson
committed
Fix resources & tools
1 parent b047f40 commit 30021b8

3 files changed

Lines changed: 153 additions & 140 deletions

File tree

CIO/CFile.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -570,15 +570,12 @@ bobMAP* CFile::read_wld(FILE* fp)
570570
// go to texture information for UpSideDown-Triangles
571571
fseek(fp, 16, SEEK_CUR);
572572

573-
// Read usdTexture: file → memory (align with s25client convention).
574-
//
573+
// Read usdTexture: file → memory (align with s25client coordinate system).
575574
// s25client MapLoader::InitNodes:
576575
// unsigned char t2 = map.getMapDataAt(MapLayer::Terrain2, pt.x, pt.y);
577576
// node.t2 = getTerrainFromS2(t2 & 0x3F); // stored at same visual (pt.x, pt.y) as t1
578-
//
579-
// s25edit WLD file stores USD textures with an odd-row visual offset.
580-
// Shift during load so vertex(i,j).usdTexture = USD at visual (i,j), matching node.t2.
581-
// memory(i, j) = file(i - !(j&1), j)
577+
// s25edit WLD file stores USD offsets that need shifting to match client:
578+
// even rows: memory(i, j) = file(i-1, j)
582579
for(int j = 0; j < myMap->height; j++)
583580
{
584581
for(int i = 0; i < myMap->width; i++)
@@ -845,7 +842,7 @@ bool CFile::save_wld(FILE* fp, void* data)
845842
// go to texture information for UpSideDown-Triangles
846843
libendian::write(map_data_header, fp);
847844

848-
// Write usdTexture: inverse of read shift — restores WLD file layout.
845+
// Write usdTexture: inverse of read shift.
849846
for(int j = 0; j < myMap->height; j++)
850847
{
851848
for(int i = 0; i < myMap->width; i++)

0 commit comments

Comments
 (0)