With this mod you will be able to use Anachronox with upscaled textures for level architecture. It contains two hacked versions of ref_gl.dll. One for 2x textures and one for 4x textures.
Please be aware, that this release is primary intended for people who whant to make their own high res texture pack for the game. Actual textures are not included. Consider my 4x AI-Upscaled texture pack if you just want to play the game with higher textures.
Installation:
Just replace the ref_gl.dll in your game folder with your preferred one from this archive.
What it actually does:
Everytime the game maps textures to level surfaces it additionally multiplys the coordinates by a fixed value (namely 2 in case of 2x and 4 in case of 4x). This effectively leads to the original textures being too small to fit the intended space. This "problem" can then be fixed by upscaling the textures by the respective value.
But how does that work?
Anachronox uses a modified version of the Quake 2 Engine which is open source. So as a first step I tryed to build a version of Quake 2 for upscaled textures. For that I only had to change two lines inside ref_gl/gl_rsurf.c
(https://github.com/id-Software/Quake-2/blob/master/ref_gl/gl_rsurf.c)
Namely inside the function "GL_BuildPolygonFromSurface" I changed this:
poly->verts[i][3] = s;
poly->verts[i][4] = t;
to this:
float texscaler = 2;
poly->verts[i][3] = s * texscaler;
poly->verts[i][4] = t * texscaler;
Anachronox's ref_gl sadly is not completely identical to Quake 2's so I could not just use my freshly compiled one. Instead I opened up IdaPro and took a deep dive into the original dll to find the machine code expression of the above code. It took me several day's but in the end I found the place where variables s and t were loaded into registers. So I fired up HxD and inserted instructions for multiplying the register by 4 (or 2 for the 2x version). (It was a bit more complicated but basically tha's what I did.) So if you want to make a 8x- or 3x- or whatever intx-pack you'd like:
The offset where the scalar is stored in my ref_gl.dll can be found at 0x00449008. Have fun! :)
Widescreen Fix:
If you want to combine this mod with the Widescreen Fix mod: You can by using the patcher delivered with the widescreen mod. The Widescreen Fix mod can be found here:
Moddb.com
Want to say thanks? Listen to my music on Soundcloud or follow me on some of the other plattforms in my linktree: Linktr.ee
Want to say even more thanks? My paypal is benny at flsne.de
Cheers!