Skip to content

Commit

Permalink
Floor rendering fix, from PsyDoom
Browse files Browse the repository at this point in the history
  • Loading branch information
Erick194 committed Jun 5, 2020
1 parent 1aaef9a commit 07375ca
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
Expand Up @@ -105,6 +105,9 @@
* Suggestion to create a code to increase the map limit to 255
https://github.com/BodbDearg/PsyDoom/commit/78436a90bfb8e2318141c13bce2e9c8f313af814

* Floor rendering fix, from PsyDoom
https://github.com/BodbDearg/PsyDoom/commit/2a0250ca6b43d920706849d0d9018cc4656cb1f1

* **[Fabien Sanglard](https://github.com/fabiensanglard)**

* Article **[The Polygons of Doom: PSX](http://fabiensanglard.net/doom_psx/index.html)**
Expand Down
14 changes: 8 additions & 6 deletions PSXDOOM/doomdef.h
Expand Up @@ -3,18 +3,20 @@
/* Fixes and Version Update Here*/
// NEWS (PsyDoom) and ([GEC] Master Edition)
#define SHOWFPS 1
#define ENABLE_NIGHTMARE 1 // Originally Activated in the project [GEC] Master Edition
#define ENABLE_NIGHTMARE 1 // Originally Activated in the project [GEC] Master Edition.
#define ENABLE_MOREMAPS 1 // Enable the increase of map limits, important note you need to change the #define LASTLEVEL to the desired value the limit is up to 255.
#define P_FNHF_UPDATE 1 // PsyDoom P_FindNextHighestFloor new code logic
#define P_FNHF_UPDATE 1 // PsyDoom P_FindNextHighestFloor new code logic.


//FIXES
#define FIX_LINEDEFS_DELETION 1 // Fixes for the 'linedef deletion' bug. From PsyDoom
#define RANGE_CHECKS 1 // Only if necessary to avoid alterations in the game
#define FIX_ML_DONTDRAW 1 // Automap: fix a PSX DOOM bug where lines flagged with ML_DONTDRAW would draw when the computer map powerup is obtained. From PsyDoom
#define FIX_LINEDEFS_DELETION 1 // Fixes for the 'linedef deletion' bug. From PsyDoom.
#define RANGE_CHECKS 1 // Only if necessary to avoid alterations in the game.
#define FIX_ML_DONTDRAW 1 // Automap: fix a PSX DOOM bug where lines flagged with ML_DONTDRAW would draw when the computer map powerup is obtained. From PsyDoom.
#define FIX_PE_SKULL_LIMIT 1 // Fixes code error when limiting lost souls, converting Doom 2 pc function to PsxDoom (based on Jaguar Doom), code is incompatible, fixes based on repair done for Psx Final Doom.
#define FIX_FLATSPANS 1 // Precision fix for large open maps, to prevent cracks at the right of the screen. From PsyDoom.

//UPDATES
#define GH_UPDATES 1 // Psx Doom Greatest Hits Updates
#define GH_UPDATES 1 // Psx Doom Greatest Hits Updates.

#define VINT int

Expand Down
28 changes: 28 additions & 0 deletions PSXDOOM/r_phase2.c
Expand Up @@ -899,6 +899,12 @@ void R_Render_Plane(vleaf_t *vlf1, int zheight, psxobj_t *psxobj)
unsigned long *v_yy;
xpos_t *xtable;

#if FIX_FLATSPANS == 1
int origSpanR;
int origSpanUR;
int origSpanVR;
#endif

POLY_FT3 *planepoly = (POLY_FT3*) getScratchAddr(128);//1F800200

lf1 = vlf1->lf;
Expand Down Expand Up @@ -1126,12 +1132,34 @@ void R_Render_Plane(vleaf_t *vlf1, int zheight, psxobj_t *psxobj)
delta2 = ((vx2 - vx1) / linecnt);
delta3 = ((vy2 - vy1) / linecnt);

// From PsyDoom: precision fix to prevent cracks at the right side of the screen on large open maps like 'Tower Of Babel'.
// Store the coords where the last span should end, and use those for the right side of the last span instead of
// the somewhat truncated/imprecise stepped coords.
//
// TODO: make this tweak configurable according to user prefs.
#if FIX_FLATSPANS == 1
origSpanR = x2;
origSpanUR = vx2;
origSpanVR = vy2;
#endif

for (j = 0; j < linecnt; j++)
{
x2 = (x1 + delta1);
vx2 = (vx1 + delta2);
vy2 = (vy1 + delta3);

// From PsyDoom: precision fix to prevent cracks at the right side of the screen on large open maps like 'Tower Of Babel'.
// TODO: make this tweak configurable according to user prefs.
#if FIX_FLATSPANS == 1
if ((j + 1) >= linecnt)
{
x2 = origSpanR;
vx2 = origSpanUR;
vy2 = origSpanVR;
}
#endif

xpos = 0;
if ((vx1 < vx2) && (vx2 < 256) == 0)
{
Expand Down

0 comments on commit 07375ca

Please sign in to comment.