Instead of screwing by possibly using negative array indicies in find_seg_side() return -1. In ordering segments make this result in unimportant order; Taking in some Asserts which were disabled years ago by me. Let's fix this for real when we get to it

This commit is contained in:
zicodxx 2010-07-17 11:57:07 +00:00
parent 81baeaeaa4
commit 4fdbda1689
3 changed files with 8 additions and 4 deletions

View file

@ -3,6 +3,7 @@ D1X-Rebirth Changelog
20100717 20100717
-------- --------
main/gamesave.c, main/render.c: Removed OGL hack to fix overlapping room in D1 lvl19 and rather move vertex a little. Still a hack but now without messing Depth test main/gamesave.c, main/render.c: Removed OGL hack to fix overlapping room in D1 lvl19 and rather move vertex a little. Still a hack but now without messing Depth test
main/gameseg.c, main/render.c: Instead of screwing by possibly using negative array indicies in find_seg_side() return -1. In ordering segments make this result in unimportant order; Taking in some Asserts which were disabled years ago by me. Let's fix this for real when we get to it
20100716 20100716
-------- --------

View file

@ -305,7 +305,7 @@ segmasks get_seg_masks(vms_vector *checkp,int segnum,fix rad,char *calling_file,
int vertex_list[6]; int vertex_list[6];
segment *seg; segment *seg;
// Assert((segnum <= Highest_segment_index) && (segnum >= 0)); // ZICO - FIXME Assert((segnum <= Highest_segment_index) && (segnum >= 0));
seg = &Segments[segnum]; seg = &Segments[segnum];

View file

@ -923,7 +923,8 @@ int find_seg_side(segment *seg,short *verts,int notside)
} }
} }
// Assert(vv0!=-1 && vv1!=-1); // ZICO - disabled. will fail sometimes in some 4D levels. if (vv0 == -1 || vv1 != -1)
return -1;
eptr = Edge_to_sides[vv0][vv1]; eptr = Edge_to_sides[vv0][vv1];
@ -967,7 +968,9 @@ int find_joining_side_norms(vms_vector *norm0_0,vms_vector *norm0_1,vms_vector *
Assert(notside1 != -1); Assert(notside1 != -1);
edgeside0 = find_seg_side(seg0,edge_verts,notside0); edgeside0 = find_seg_side(seg0,edge_verts,notside0);
if (edgeside0 == -1) return 0;
edgeside1 = find_seg_side(seg1,edge_verts,notside1); edgeside1 = find_seg_side(seg1,edge_verts,notside1);
if (edgeside1 == -1) return 0;
//deal with the case where an edge is shared by more than two segments //deal with the case where an edge is shared by more than two segments
@ -1040,8 +1043,8 @@ int compare_children(segment *seg,short c0,short c1)
t = find_joining_side_norms(&norm0_0,&norm0_1,&norm1_0,&norm1_1,&pnt0,&pnt1,seg,c0,c1); t = find_joining_side_norms(&norm0_0,&norm0_1,&norm1_0,&norm1_1,&pnt0,&pnt1,seg,c0,c1);
//if (!t) if (!t) // can happen - 4D rooms!
// return 0; return 0;
vm_vec_sub(&temp,&Viewer_eye,pnt0); vm_vec_sub(&temp,&Viewer_eye,pnt0);
d0_0 = vm_vec_dot(&norm0_0,&temp); d0_0 = vm_vec_dot(&norm0_0,&temp);