mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-01-31 21:50:50 +00:00
Merge pull request #70 from abergmeier/fix_64_bit
Handle st_lwPolygon::surf for 64bit.
This commit is contained in:
commit
8bd15e6f55
3 changed files with 14 additions and 12 deletions
|
@ -1799,7 +1799,7 @@ bool idRenderModelStatic::ConvertLWOToModelSurfaces( const struct st_lwObject* l
|
||||||
{
|
{
|
||||||
lwPolygon* poly = &layer->polygon.pol[j];
|
lwPolygon* poly = &layer->polygon.pol[j];
|
||||||
|
|
||||||
if( poly->surf != lwoSurf )
|
if( poly->surf.ptr != lwoSurf )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -2070,7 +2070,7 @@ struct aseModel_s* idRenderModelStatic::ConvertLWOToASE( const struct st_lwObjec
|
||||||
{
|
{
|
||||||
lwPolygon* poly = &layer->polygon.pol[j];
|
lwPolygon* poly = &layer->polygon.pol[j];
|
||||||
|
|
||||||
if( poly->surf != surf )
|
if( poly->surf.ptr != surf )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2311,7 +2311,7 @@ int lwGetPolygons5( idFile* fp, int cksize, lwPolygonList* plist, int ptoffset )
|
||||||
bp += 2;
|
bp += 2;
|
||||||
}
|
}
|
||||||
j -= 1;
|
j -= 1;
|
||||||
pp->surf = ( lwSurface* ) j; // DG: FIXME: cast int to pointer?!
|
pp->surf.index = j;
|
||||||
|
|
||||||
pp++;
|
pp++;
|
||||||
pv += nv;
|
pv += nv;
|
||||||
|
@ -2855,12 +2855,11 @@ int lwResolvePolySurfaces( lwPolygonList* polygon, lwTagList* tlist,
|
||||||
st = st->next;
|
st = st->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// RB: 64 bit fixes
|
|
||||||
uintptr_t index;
|
intptr_t index;
|
||||||
for( i = 0; i < polygon->count; i++ )
|
for( i = 0; i < polygon->count; i++ )
|
||||||
{
|
{
|
||||||
index = ( uintptr_t ) polygon->pol[ i ].surf;
|
index = polygon->pol[ i ].surf.index;
|
||||||
// RB end
|
|
||||||
|
|
||||||
if( index < 0 || index > tlist->count ) return 0;
|
if( index < 0 || index > tlist->count ) return 0;
|
||||||
if( !s[ index ] )
|
if( !s[ index ] )
|
||||||
|
@ -2873,7 +2872,7 @@ int lwResolvePolySurfaces( lwPolygonList* polygon, lwTagList* tlist,
|
||||||
lwListAdd( ( void** )surf, s[ index ] );
|
lwListAdd( ( void** )surf, s[ index ] );
|
||||||
*nsurfs = *nsurfs + 1;
|
*nsurfs = *nsurfs + 1;
|
||||||
}
|
}
|
||||||
polygon->pol[ i ].surf = s[ index ];
|
polygon->pol[ i ].surf.ptr = s[ index ];
|
||||||
}
|
}
|
||||||
|
|
||||||
Mem_Free( s );
|
Mem_Free( s );
|
||||||
|
@ -2908,7 +2907,7 @@ void lwGetVertNormals( lwPointList* point, lwPolygonList* polygon )
|
||||||
for( k = 0; k < 3; k++ )
|
for( k = 0; k < 3; k++ )
|
||||||
polygon->pol[ j ].v[ n ].norm[ k ] = polygon->pol[ j ].norm[ k ];
|
polygon->pol[ j ].v[ n ].norm[ k ] = polygon->pol[ j ].norm[ k ];
|
||||||
|
|
||||||
if( polygon->pol[ j ].surf->smooth <= 0 ) continue;
|
if( polygon->pol[ j ].surf.ptr->smooth <= 0 ) continue;
|
||||||
|
|
||||||
p = polygon->pol[ j ].v[ n ].index;
|
p = polygon->pol[ j ].v[ n ].index;
|
||||||
|
|
||||||
|
@ -2920,7 +2919,7 @@ void lwGetVertNormals( lwPointList* point, lwPolygonList* polygon )
|
||||||
if( polygon->pol[ j ].smoothgrp != polygon->pol[ h ].smoothgrp )
|
if( polygon->pol[ j ].smoothgrp != polygon->pol[ h ].smoothgrp )
|
||||||
continue;
|
continue;
|
||||||
a = vecangle( polygon->pol[ j ].norm, polygon->pol[ h ].norm );
|
a = vecangle( polygon->pol[ j ].norm, polygon->pol[ h ].norm );
|
||||||
if( a > polygon->pol[ j ].surf->smooth ) continue;
|
if( a > polygon->pol[ j ].surf.ptr->smooth ) continue;
|
||||||
|
|
||||||
for( k = 0; k < 3; k++ )
|
for( k = 0; k < 3; k++ )
|
||||||
polygon->pol[ j ].v[ n ].norm[ k ] += polygon->pol[ h ].norm[ k ];
|
polygon->pol[ j ].v[ n ].norm[ k ] += polygon->pol[ h ].norm[ k ];
|
||||||
|
@ -3054,7 +3053,7 @@ int lwGetPolygonTags( idFile* fp, int cksize, lwTagList* tlist, lwPolygonList* p
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case ID_SURF:
|
case ID_SURF:
|
||||||
plist->pol[ i ].surf = ( lwSurface* ) j; // DG: FIXME: cast int to pointer?!
|
plist->pol[ i ].surf.index = j;
|
||||||
break;
|
break;
|
||||||
case ID_PART:
|
case ID_PART:
|
||||||
plist->pol[ i ].part = j;
|
plist->pol[ i ].part = j;
|
||||||
|
|
|
@ -532,7 +532,10 @@ typedef struct st_lwPolVert
|
||||||
|
|
||||||
typedef struct st_lwPolygon
|
typedef struct st_lwPolygon
|
||||||
{
|
{
|
||||||
lwSurface* surf;
|
union {
|
||||||
|
intptr_t index;
|
||||||
|
lwSurface* ptr;
|
||||||
|
} surf;
|
||||||
int part; /* part index */
|
int part; /* part index */
|
||||||
int smoothgrp; /* smoothing group */
|
int smoothgrp; /* smoothing group */
|
||||||
int flags;
|
int flags;
|
||||||
|
|
Loading…
Reference in a new issue