Skip to content

Commit

Permalink
Merge pull request #490 from Pedro-Beirao/master
Browse files Browse the repository at this point in the history
Small OpenGL fixes
  • Loading branch information
kraflab authored May 1, 2024
2 parents f891737 + 7ec29f7 commit 97dd6d3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
2 changes: 0 additions & 2 deletions prboom2/src/gl_intern.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@

#define MAXCOORD (32767.0f / MAP_COEFF)

#define SMALLDELTA 0.001f

typedef enum
{
GLDT_UNREGISTERED,
Expand Down
20 changes: 10 additions & 10 deletions prboom2/src/gl_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1175,8 +1175,8 @@ static void gld_DrawWall(GLWall *wall)
static void gld_CalculateWallY(GLWall *wall, float *lineheight,
fixed_t floor_height, fixed_t ceiling_height)
{
wall->ytop = (float) ceiling_height / (float) MAP_SCALE + SMALLDELTA;
wall->ybottom = (float) floor_height / (float) MAP_SCALE - SMALLDELTA;
wall->ytop = (float) ceiling_height / (float) MAP_SCALE;
wall->ybottom = (float) floor_height / (float) MAP_SCALE;
*lineheight = (float) fabs((float) (ceiling_height - floor_height) / FRACUNIT);
}

Expand Down Expand Up @@ -1286,14 +1286,14 @@ void gld_AddWall(seg_t *seg)

if (frontsector->ceilingpic==skyflatnum)
{
wall.ytop=MAXCOORD;
wall.ytop=MAXCOORD*2; // Simply using MAXCOORD would result in HOM when the floor is at a height close to the limit
wall.ybottom=(float)frontsector->ceilingheight/MAP_SCALE;
gld_AddSkyTexture(&wall, frontsector->ceilingsky, frontsector->ceilingsky, SKY_CEILING);
}
if (frontsector->floorpic==skyflatnum)
{
wall.ytop=(float)frontsector->floorheight/MAP_SCALE;
wall.ybottom=-MAXCOORD;
wall.ybottom=-MAXCOORD*2; // Simply using MAXCOORD would result in HOM when the ceiling is at a height close to the limit
gld_AddSkyTexture(&wall, frontsector->floorsky, frontsector->floorsky, SKY_FLOOR);
}
temptex=gld_RegisterTexture(texturetranslation[seg->sidedef->midtexture], true, false, true, false);
Expand Down Expand Up @@ -1366,7 +1366,7 @@ void gld_AddWall(seg_t *seg)
wall.yscale = (float) seg->sidedef->scaley_top / FRACUNIT;
if (frontsector->ceilingpic==skyflatnum)// || backsector->ceilingpic==skyflatnum)
{
wall.ytop= MAXCOORD;
wall.ytop= MAXCOORD*2;
if (
// e6y
// There is no more HOM in the starting area on Memento Mori map29 and on map30.
Expand Down Expand Up @@ -1431,8 +1431,8 @@ void gld_AddWall(seg_t *seg)
!(backsector->flags & NULL_SECTOR) &&
backsector->floorheight < backsector->ceilingheight)
{
wall.ytop=((float)(ceiling_height)/(float)MAP_SCALE)+SMALLDELTA;
wall.ybottom=((float)(floor_height)/(float)MAP_SCALE)-SMALLDELTA;
wall.ytop=((float)(ceiling_height)/(float)MAP_SCALE);
wall.ybottom=((float)(floor_height)/(float)MAP_SCALE);
if (wall.ybottom >= zCamera)
{
wall.flag=GLDWF_TOPFLUD;
Expand Down Expand Up @@ -1600,7 +1600,7 @@ void gld_AddWall(seg_t *seg)
wall.yscale = (float) seg->sidedef->scaley_bottom / FRACUNIT;
if (frontsector->floorpic==skyflatnum)
{
wall.ybottom=-MAXCOORD;
wall.ybottom=-MAXCOORD*2;
if (
(backsector->ceilingheight==backsector->floorheight) &&
(backsector->floorpic==skyflatnum)
Expand Down Expand Up @@ -1637,8 +1637,8 @@ void gld_AddWall(seg_t *seg)
!(backsector->flags & NULL_SECTOR) &&
backsector->floorheight < backsector->ceilingheight)
{
wall.ytop=((float)(ceiling_height)/(float)MAP_SCALE)+SMALLDELTA;
wall.ybottom=((float)(floor_height)/(float)MAP_SCALE)-SMALLDELTA;
wall.ytop=((float)(ceiling_height)/(float)MAP_SCALE);
wall.ybottom=((float)(floor_height)/(float)MAP_SCALE);
if (wall.ytop <= zCamera)
{
wall.flag = GLDWF_BOTFLUD;
Expand Down
4 changes: 2 additions & 2 deletions prboom2/src/gl_vertex.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ void gld_RecalcVertexHeights(const vertex_t *v)
for(j = 0; j < 2; j++)
{
if (j == 0)
height = (float)vi->sectors[i]->ceilingheight/MAP_SCALE+SMALLDELTA;
height = (float)vi->sectors[i]->ceilingheight/MAP_SCALE;
else
height = (float)vi->sectors[i]->floorheight/MAP_SCALE-SMALLDELTA;
height = (float)vi->sectors[i]->floorheight/MAP_SCALE;

for(k = 0; k < vi->numheights; k++)
{
Expand Down

0 comments on commit 97dd6d3

Please sign in to comment.