Thanks for the clarification! If I understand correctly, when "ydetail" variable in "ENG386.C" is set to 3, the produced executable will be for even lower details.
I have a suggestion. For easier compiling and linking of different executable versions you can separate make-files and altered .C and .H files in separate folders like "D07_SRC", "D07_SRC_LQ2" and "D07_SRC_LQ3".
Not yet sir, let it be like that.
What I've been trying to do for more than 4 months is getting a non-fpu version of slopes drawing to work. There's a version that finally doesn't crash and does perspective correction, yet faster on a nonfpu SX processor, it still looks awful and coming with a lot of geometric distortions.
1 2long reciptable[2048], fpuasm, fpuasmnonfpu; 3long reciptablenonfpu[2048], deltaztable[2048]; 4 5#define FIX16_SHIFT 14 // Matches Build's 30-bit fixed-point 6#define FIX16_FACTOR 0x40000000 // 1<<30 in 32-bit (1073741824) 7#define RECIP_TABLE_OFFSET 2048 8 9#define F1_0 0x10000 // 16.16 fixed-point scaling 10 11loadtables() 12{ 13 long i, fil; 14 float z, dz, nextz, deltaz; 15 16 if (tablesloaded == 0) 17 { 18 initksqrt(); 19 20 // Generate original FPU-based reciptable at all times (it's int too) 21 for(i = 0; i < 2048; i++) 22 { 23 reciptable[i] = divscale30(2048L, i+2048); 24 } 25 if ( (use_fpu) == 0) 26 { 27 // Generate non-FPU reciptable if nofpu parameter was passed 28 reciptablenonfpu[0] = F1_0 / RECIP_TABLE_OFFSET; 29 for(i = 1; i < 2048; i++) 30 { 31 //reciptablenonfpu[i] = FIX16_FACTOR / (i + RECIP_TABLE_OFFSET); 32 reciptablenonfpu[i] = F1_0 / i; 33 } 34 35 z = 1.0f; // initial Z (matches original FPU setup) 36 dz = 0.01f; // step size (adjust based on your needs) 37 for (i = 0; i < 2048; i++) 38 { 39 // match max line height 40 nextz = z + dz; 41 // hyperbolic step 42 deltaz = (1.0f/z) - (1.0f/nextz); 43 // convert to fixed-point 44 deltaztable[i] = (long)(deltaz * (1 << 16)); 45 z = nextz; 46 } 47 } 48 49 50 // Load built-in tables (sintable, radar angles, fonts) 51 if ((fil = kopen4load("tables.dat", 0)) != -1) 52 { 53 // Reciptable is NOT loaded from file - generated above 54 kread(fil, sintable, 2048 * 2); 55 kread(fil, radarang, 640 * 2); 56 for(i = 0; i < 640; i++) radarang[1279 - i] = -radarang[i]; 57 kread(fil, textfont, 1024); 58 kread(fil, smalltextfont, 1024); 59 kread(fil, britable, 1024); 60 kclose(fil);
…Show last 6 lines
61 } 62 63 tablesloaded = 1; 64 } 65}
I think the biggest challenge is this line: add ebx, dword ptr _asm2
because as soon as FPU addition is removed it breaks the "hyperbolical continuity" as AI said. There are two lines like this in the asm code and I even tried to simulate it with deltaztable yet without much success.
So we're almost there on non-fpu slopes, I think it still looks meh but much closer to the result I'd desire to have. You can download the compiled exe to see how it's going. My further attempt would be to try decreasing "amplitude" of ebx _asm2 additions. It's slower than low detail degraded version but much faster than fully detailed fpu version on 486sx. Later we could combine both approaches and do fully integer slopes in 2x detail loss instead of 8x or even keep it as is. If it goes fine for sure.
You're welcome but don't hurry, this version is really buggy and may make your computer freeze, there are illegal memory writes are still going.
Upd... fixed
You're welcome but don't hurry, this version is really buggy and may make your computer freeze, there are illegal memory writes are still going.
Upd... fixed
v0.17 - distance rendering optimization. Make distant walls render less 8 times less often than close according to the game ticker. May speed-up rendering on big open maps but may introduce visual artifacts. Enable by typing /distslow command line parameter. Both Duke07.exe and D07LQ2x.exe are bundled with this. Currently acts since 32000 map units. Edit engine.c or eng386.c drawalls_distslow function to change distance.
v0.17 - distance rendering optimization. Make distant walls render less 8 times less often than close according to the game ticker. May speed-up rendering on big open maps but may introduce visual artifacts. Enable by typing /distslow command line parameter. Both Duke07.exe and D07LQ2x.exe are bundled with this. Currently acts since 32000 map units. Edit engine.c or eng386.c drawalls_distslow function to change distance.
v0.17 - distance rendering optimization. Make distant walls render less 8 times less often than close according to the game ticker. May speed-up rendering on big open maps but may introduce visual artifacts. Enable by typing /distslow command line parameter. Both Duke07.exe and D07LQ2x.exe are bundled with this. Currently acts since 32000 map units. Edit engine.c or eng386.c drawalls_distslow function to change distance.
You're welocme, glad someone found it cool! Btw, there must be a better way to do that distance magic but that must be hard to implement.
So we're rendering sky first (the background), as we know that parallax skies setup is done not so flexible in the game so for a parallax map to show up all tiles it consists of, the entire enclosed area must have the same picnum.
So for the idea to work there must be an option to override all skies in the area or even the whole map.
That could also lead to bad picture in the distance as distant geometry can't keep up, so maybe additional parallax-sky-alike horizontal and vertical scrolling on the distance geometry buffer, so the roadmap will be like:
1) Render distant geometry in a separate buffer and apply parallax scrolling to it;
2) Use a 2nd buffer and render parallax skies first here;
3) Copy distant geometry buffer result (scrolling corrected) and draw on top of sky;
4) On the top of it all render only close geometry.