diff --git a/main/render.c b/main/render.c index bded460fc..7479563de 100755 --- a/main/render.c +++ b/main/render.c @@ -1143,6 +1143,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) @@ -1223,9 +1227,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; diff --git a/main/wall.c b/main/wall.c index 91d0a1611..7cb13387d 100755 --- a/main/wall.c +++ b/main/wall.c @@ -60,6 +60,10 @@ static char rcsid[] = "$Id: wall.c,v 1.1.1.1 2006/03/17 19:56:48 zicodxx Exp $"; #include "editor/editor.h" #endif +#ifdef OGL +#include "ogl_init.h" +#endif + // Special door on boss level which is locked if not in multiplayer...sorry for this awful solution --MK. #define BOSS_LOCKED_DOOR_LEVEL 7 #define BOSS_LOCKED_DOOR_SEG 595 @@ -87,6 +91,9 @@ int Num_cloaking_walls; //#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] = { @@ -161,6 +168,10 @@ 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 { @@ -170,6 +181,10 @@ int wall_is_doorway ( segment * seg, int side ) return WID_ILLUSORY_WALL; } } +#ifdef OGL + else + wall_maybe_4d=0; +#endif if (type == WALL_BLASTABLE) { if (flags & WALL_BLASTED)