diff --git a/tools/quake3/q3map2/light.cpp b/tools/quake3/q3map2/light.cpp index c9421277..fb44b9d7 100644 --- a/tools/quake3/q3map2/light.cpp +++ b/tools/quake3/q3map2/light.cpp @@ -550,12 +550,8 @@ void CreateSurfaceLights( void ){ */ void SetEntityOrigins( void ){ - int j, k, f; - - /* ydnar: copy drawverts into private storage for nefarious purposes */ - yDrawVerts = safe_malloc( bspDrawVerts.size() * sizeof( bspDrawVert_t ) ); - memcpy( yDrawVerts, bspDrawVerts.data(), bspDrawVerts.size() * sizeof( bspDrawVert_t ) ); + yDrawVerts = bspDrawVerts; /* set the entity origins */ for ( const auto& e : entities ) @@ -575,16 +571,15 @@ void SetEntityOrigins( void ){ } /* set origin for all surfaces for this model */ - for ( j = 0; j < dm.numBSPSurfaces; j++ ) + for ( int j = 0; j < dm.numBSPSurfaces; j++ ) { /* get drawsurf */ const bspDrawSurface_t& ds = bspDrawSurfaces[ dm.firstBSPSurface + j ]; /* set its verts */ - for ( k = 0; k < ds.numVerts; k++ ) + for ( int k = 0; k < ds.numVerts; k++ ) { - f = ds.firstVert + k; - yDrawVerts[ f ].xyz = origin + bspDrawVerts[ f ].xyz; + yDrawVerts[ ds.firstVert + k ].xyz += origin; } } } diff --git a/tools/quake3/q3map2/light_ydnar.cpp b/tools/quake3/q3map2/light_ydnar.cpp index 300465dc..d6ef2d06 100644 --- a/tools/quake3/q3map2/light_ydnar.cpp +++ b/tools/quake3/q3map2/light_ydnar.cpp @@ -974,7 +974,7 @@ void MapRawLightmap( int rawLightmapNum ){ { case MST_PLANAR: /* get verts */ - verts = yDrawVerts + ds->firstVert; + verts = &yDrawVerts[ ds->firstVert ]; /* map the triangles */ for ( mapNonAxial = 0; mapNonAxial < 2; mapNonAxial++ ) @@ -2600,7 +2600,7 @@ void IlluminateVertexes( int num ){ CreateTraceLightsForSurface( num, &trace ); /* setup */ - verts = yDrawVerts + ds->firstVert; + verts = &yDrawVerts[ ds->firstVert ]; numAvg = 0; memset( avgColors, 0, sizeof( avgColors ) ); @@ -2825,7 +2825,7 @@ void IlluminateVertexes( int num ){ maxRadius = std::max( lm->sw, lm->sh ); /* walk the surface verts */ - verts = yDrawVerts + ds->firstVert; + verts = &yDrawVerts[ ds->firstVert ]; for ( i = 0; i < ds->numVerts; i++ ) { /* do each lightmap */ diff --git a/tools/quake3/q3map2/lightmaps_ydnar.cpp b/tools/quake3/q3map2/lightmaps_ydnar.cpp index d42e5179..a6dc60ee 100644 --- a/tools/quake3/q3map2/lightmaps_ydnar.cpp +++ b/tools/quake3/q3map2/lightmaps_ydnar.cpp @@ -1673,7 +1673,7 @@ static bool ApproximateLightmap( rawLightmap_t *lm ){ { case MST_PLANAR: /* get verts */ - verts = yDrawVerts + ds->firstVert; + verts = &yDrawVerts[ ds->firstVert ]; /* map the triangles */ info->approximated = true; diff --git a/tools/quake3/q3map2/q3map2.h b/tools/quake3/q3map2/q3map2.h index 2b8ac8a4..deeafe48 100644 --- a/tools/quake3/q3map2/q3map2.h +++ b/tools/quake3/q3map2/q3map2.h @@ -2217,7 +2217,7 @@ Q_EXTERN int numTriangleDiffuseLights; Q_EXTERN int numPatchDiffuseLights; /* ydnar: general purpose extra copy of drawvert list */ -Q_EXTERN bspDrawVert_t *yDrawVerts; +Q_EXTERN std::vector yDrawVerts; Q_EXTERN int defaultLightSubdivide Q_ASSIGN( 999 );