diff --git a/engine/client/mod_dbghulls.c b/engine/client/mod_dbghulls.c index 3b5dd2b5..678e1cd1 100644 --- a/engine/client/mod_dbghulls.c +++ b/engine/client/mod_dbghulls.c @@ -685,6 +685,9 @@ void Mod_CreatePolygonsForHull( int hullnum ) if( hullnum < 1 || hullnum > 3 ) return; + if( !world.num_hull_models ) + Mod_InitDebugHulls( mod ); // FIXME: build hulls for separate bmodels (shells, medkits etc) + Con_Printf( "generating polygons for hull %u...\n", hullnum ); start = Sys_DoubleTime(); diff --git a/engine/common/mod_bmodel.c b/engine/common/mod_bmodel.c index 3f818692..1d77e205 100644 --- a/engine/common/mod_bmodel.c +++ b/engine/common/mod_bmodel.c @@ -3019,7 +3019,6 @@ static qboolean Mod_LoadBmodelLumps( model_t *mod, const byte *mod_base, qboolea { world.version = bmod->version; #if !XASH_DEDICATED - Mod_InitDebugHulls( mod ); // FIXME: build hulls for separate bmodels (shells, medkits etc) world.deluxedata = bmod->deluxedata_out; // deluxemap data pointer world.shadowdata = bmod->shadowdata_out; // occlusion data pointer #endif // XASH_DEDICATED diff --git a/engine/common/model.c b/engine/common/model.c index 1553e5d9..c2b30ba2 100644 --- a/engine/common/model.c +++ b/engine/common/model.c @@ -114,6 +114,9 @@ void Mod_FreeModel( model_t *mod ) world.version = 0; world.shadowdata = NULL; world.deluxedata = NULL; + + // data already freed by Mem_FreePool above + world.hull_models = NULL; } memset( mod, 0, sizeof( *mod )); diff --git a/ref/gl/gl_dbghulls.c b/ref/gl/gl_dbghulls.c index a159729b..3cb9e267 100644 --- a/ref/gl/gl_dbghulls.c +++ b/ref/gl/gl_dbghulls.c @@ -28,7 +28,7 @@ GNU General Public License for more details. // REFTODO: rewrite in triapi void R_DrawWorldHull( void ) { - hull_model_t *hull = &tr.world->hull_models[0]; + hull_model_t *hull; winding_t *poly; int i; @@ -42,6 +42,8 @@ void R_DrawWorldHull( void ) if( !r_showhull->value ) return; + hull = &tr.world->hull_models[0]; + pglDisable( GL_TEXTURE_2D ); list_for_each_entry( poly, &hull->polys, chain ) diff --git a/ref/soft/r_local.h b/ref/soft/r_local.h index 020ab670..f8227e83 100644 --- a/ref/soft/r_local.h +++ b/ref/soft/r_local.h @@ -410,19 +410,10 @@ void R_EntityRemoveDecals( model_t *mod ); void R_ClearDecals( void ); void R_DecalComputeBasis( msurface_t *surf, int flags, vec3_t textureSpaceBasis[3] ); -#if 0 - -// -// gl_drawhulls.c -// -void R_DrawWorldHull( void ); -void R_DrawModelHull( void ); -#endif - void GL_Bind( int tmu, unsigned int texnum ); // -// gl_draw.cM_PI +// gl_draw.c // void R_Set2DMode( qboolean enable ); void R_DrawTileClear( int texnum, int x, int y, int w, int h );