improved 4D room detection

This commit is contained in:
zicodxx 2006-10-11 19:09:43 +00:00
parent 1364ea9f89
commit 0c938ece10
2 changed files with 27 additions and 5 deletions

View file

@ -1325,6 +1325,10 @@ int find_seg_side(segment *seg,short *verts,int notside)
}
}
#ifdef OGL
extern int wall_maybe_4d;
#endif
//find the two segments that join a given seg though two sides, and
//the sides of those segments the abut.
int find_joining_side_norms(vms_vector *norm0_0,vms_vector *norm0_1,vms_vector *norm1_0,vms_vector *norm1_1,vms_vector **pnt0,vms_vector **pnt1,segment *seg,int s0,int s1)
@ -1405,9 +1409,12 @@ int find_joining_side_norms(vms_vector *norm0_0,vms_vector *norm0_1,vms_vector *
#ifdef OGL
/* ZICO - experimental HACK
If edge_verts differ +/- 100 it's mostly an indication of overlapping rooms using the 4D effect. So we don't want GL_LEQUAL. It does also happen on other places in a level. But it's *unlikely* we see a portal bug caused by missing GL_LEQUAL with verts that differ that much. Nevertheless it's a simple hack to prevent unwanted textures in 4D rooms. */
if ((edge_verts[0] - edge_verts[1] >= 100) || (edge_verts[0] - edge_verts[1] <= -100))
glDepthFunc(GL_ALWAYS);
If edge_verts differ +/- 100 it's mostly an indication of overlapping rooms using the 4D effect. So we don't want GL_LEQUAL. So we set wall_maybe_4d causes GL_ALWAYS in wall.c if WALL_ILLUSION */
if (((edge_verts[0] - edge_verts[1] >= 100) || (edge_verts[0] - edge_verts[1] <= -100)))
{
wall_maybe_4d=1;
}
#endif
return 1;

View file

@ -147,6 +147,9 @@ static char rcsid[] = "$Id: wall.c,v 1.1.1.1 2006/03/17 19:44:01 zicodxx Exp $";
#include "newdemo.h"
#include "multi.h"
#include "gameseq.h"
#ifdef OGL
#include "ogl_init.h"
#endif
void kill_stuck_objects(int wallnum);
@ -171,6 +174,9 @@ int Num_open_doors; // Number of open doors
//#define BM_FLAG_TRANSPARENT 1
//#define BM_FLAG_SUPER_TRANSPARENT 2
#ifdef OGL
int wall_maybe_4d = 0;
#endif
#ifdef EDITOR
char Wall_names[7][10] = {
@ -215,6 +221,7 @@ int check_transparency( segment * seg, int side )
// WID_ILLUSORY_WALL 3 // 1/1/0 illusory wall
// WID_TRANSILLUSORY_WALL 7 // 1/1/1 transparent illusory wall
// WID_NO_WALL 5 // 1/0/1 no wall, can fly through
int wall_is_doorway ( segment * seg, int side )
{
int flags, type;
@ -240,15 +247,23 @@ int wall_is_doorway ( segment * seg, int side )
return WID_NO_WALL;
if (type == WALL_ILLUSION) {
#ifdef OGL
if(wall_maybe_4d)
glDepthFunc(GL_ALWAYS);
#endif
if (Walls[seg->sides[side].wall_num].flags & WALL_ILLUSION_OFF)
return WID_NO_WALL;
else {
if (check_transparency( seg, side))
if (check_transparency( seg, side)) {
return WID_TRANSILLUSORY_WALL;
else
}else
return WID_ILLUSORY_WALL;
}
}
#ifdef OGL
else
wall_maybe_4d=0;
#endif
if (type == WALL_BLASTABLE) {
if (flags & WALL_BLASTED)