fix hang in tjunction.c
git-svn-id: svn://svn.icculus.org/netradiant/trunk@189 61c419a2-8eb2-4b30-bcec-8cead039b335
This commit is contained in:
parent
015b22755e
commit
7f9ebdace7
|
|
@ -2374,7 +2374,7 @@ Q_EXTERN bspAdvertisement_t bspAds[ MAX_MAP_ADVERTISEMENTS ];
|
||||||
allocated = def; \
|
allocated = def; \
|
||||||
while(reqitem >= allocated && allocated) \
|
while(reqitem >= allocated && allocated) \
|
||||||
allocated *= 2; \
|
allocated *= 2; \
|
||||||
if(allocated > 2147483647 / sizeof(*ptr)) \
|
if(!allocated || allocated > 2147483647 / sizeof(*ptr)) \
|
||||||
{ \
|
{ \
|
||||||
Error(#ptr " over 2 GB"); \
|
Error(#ptr " over 2 GB"); \
|
||||||
} \
|
} \
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ typedef struct edgeLine_s {
|
||||||
vec3_t origin;
|
vec3_t origin;
|
||||||
vec3_t dir;
|
vec3_t dir;
|
||||||
|
|
||||||
edgePoint_t chain; // unused element of doubly linked list
|
edgePoint_t *chain; // unused element of doubly linked list
|
||||||
} edgeLine_t;
|
} edgeLine_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|
@ -100,14 +100,14 @@ void InsertPointOnEdge( vec3_t v, edgeLine_t *e ) {
|
||||||
p->intercept = d;
|
p->intercept = d;
|
||||||
VectorCopy( v, p->xyz );
|
VectorCopy( v, p->xyz );
|
||||||
|
|
||||||
if ( e->chain.next == &e->chain ) {
|
if ( e->chain->next == e->chain ) {
|
||||||
e->chain.next = e->chain.prev = p;
|
e->chain->next = e->chain->prev = p;
|
||||||
p->next = p->prev = &e->chain;
|
p->next = p->prev = e->chain;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
scan = e->chain.next;
|
scan = e->chain->next;
|
||||||
for ( ; scan != &e->chain ; scan = scan->next ) {
|
for ( ; scan != e->chain ; scan = scan->next ) {
|
||||||
d = p->intercept - scan->intercept;
|
d = p->intercept - scan->intercept;
|
||||||
if ( d > -LINE_POSITION_EPSILON && d < LINE_POSITION_EPSILON ) {
|
if ( d > -LINE_POSITION_EPSILON && d < LINE_POSITION_EPSILON ) {
|
||||||
free( p );
|
free( p );
|
||||||
|
|
@ -195,7 +195,8 @@ int AddEdge( vec3_t v1, vec3_t v2, qboolean createNonAxial ) {
|
||||||
e = &edgeLines[ numEdgeLines ];
|
e = &edgeLines[ numEdgeLines ];
|
||||||
numEdgeLines++;
|
numEdgeLines++;
|
||||||
|
|
||||||
e->chain.next = e->chain.prev = &e->chain;
|
e->chain = safe_malloc( sizeof(edgePoint_t) );
|
||||||
|
e->chain->next = e->chain->prev = e->chain;
|
||||||
|
|
||||||
VectorCopy( v1, e->origin );
|
VectorCopy( v1, e->origin );
|
||||||
VectorCopy( dir, e->dir );
|
VectorCopy( dir, e->dir );
|
||||||
|
|
@ -373,12 +374,12 @@ void FixSurfaceJunctions( mapDrawSurface_t *ds ) {
|
||||||
|
|
||||||
|
|
||||||
if ( start < end ) {
|
if ( start < end ) {
|
||||||
p = e->chain.next;
|
p = e->chain->next;
|
||||||
} else {
|
} else {
|
||||||
p = e->chain.prev;
|
p = e->chain->prev;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; p != &e->chain ; ) {
|
for ( ; p != e->chain ; ) {
|
||||||
if ( start < end ) {
|
if ( start < end ) {
|
||||||
if ( p->intercept > end - ON_EPSILON ) {
|
if ( p->intercept > end - ON_EPSILON ) {
|
||||||
break;
|
break;
|
||||||
|
|
@ -628,7 +629,7 @@ void FixTJunctions( entity_t *ent )
|
||||||
shaderInfo_t *si;
|
shaderInfo_t *si;
|
||||||
int axialEdgeLines;
|
int axialEdgeLines;
|
||||||
originalEdge_t *e;
|
originalEdge_t *e;
|
||||||
|
bspDrawVert_t *dv;
|
||||||
|
|
||||||
/* meta mode has its own t-junction code (currently not as good as this code) */
|
/* meta mode has its own t-junction code (currently not as good as this code) */
|
||||||
//% if( meta )
|
//% if( meta )
|
||||||
|
|
@ -679,7 +680,8 @@ void FixTJunctions( entity_t *ent )
|
||||||
// this gives the most accurate edge description
|
// this gives the most accurate edge description
|
||||||
for ( i = 0 ; i < numOriginalEdges ; i++ ) {
|
for ( i = 0 ; i < numOriginalEdges ; i++ ) {
|
||||||
e = &originalEdges[i];
|
e = &originalEdges[i];
|
||||||
e->dv[ 0 ]->lightmap[ 0 ][ 0 ] = AddEdge( e->dv[ 0 ]->xyz, e->dv[ 1 ]->xyz, qtrue );
|
dv = e->dv[0]; // e might change during AddEdge
|
||||||
|
dv->lightmap[ 0 ][ 0 ] = AddEdge( e->dv[ 0 ]->xyz, e->dv[ 1 ]->xyz, qtrue );
|
||||||
}
|
}
|
||||||
|
|
||||||
Sys_FPrintf( SYS_VRB, "%9d axial edge lines\n", axialEdgeLines );
|
Sys_FPrintf( SYS_VRB, "%9d axial edge lines\n", axialEdgeLines );
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user