mirror of
https://github.com/jkdansereau/goldeneye-pc-port.git
synced 2026-10-24 00:02:45 +02:00
Cloud tile is s_skywaterimages[0] = 64x64 IA8, G_TX_WRAP -> it tiles. GE's screen-space textured-quad idiom is tc = width<<5 (glass2.c:678), so skyPortRenderPoly's *32.0f scale was correct; the bug was (s16) overflow on the +/-20k-texel horizon S/T (unk20/unk24 are texel coords, not fractions). Fix: fold every vertex of one primitive by the same multiple of the 64-texel tile period before scaling. Inter-vertex deltas (hence the interpolated cloud texture) are preserved; magnitudes stay in s16 range. Exact for any triangle whose S/T span is < ~1000 texels -- everything except tris straddling the horizon line, which are Defect 2 (adaptive tessellation). sky.c #ifdef PORT only; N64 path unchanged. Builds clean; bunker1 + statue verify PASS, no crash. UNVERIFIED VISUALLY -- owed: one -level_22 screenshot (D176a-SKY-NOTES.md 'Verification ask'). Also: rebased onto main (porting-notes.md conflict resolved).