mirror of
https://github.com/FWGS/xash3d-fwgs
synced 2024-11-22 18:07:09 +01:00
ref_gl: fixes for MSVC
This commit is contained in:
parent
7aa7f4dbbd
commit
7e08104631
@ -164,6 +164,43 @@ static void Mod_LoadModel( modtype_t desiredType, model_t *mod, const byte *buf,
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_BrushUnloadTextures( model_t *mod )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < mod->numtextures; i++ )
|
||||
{
|
||||
texture_t *tx = mod->textures[i];
|
||||
if( !tx || tx->gl_texturenum == tr.defaultTexture )
|
||||
continue; // free slot
|
||||
|
||||
GL_FreeTexture( tx->gl_texturenum ); // main texture
|
||||
GL_FreeTexture( tx->fb_texturenum ); // luma texture
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_UnloadTextures( model_t *mod )
|
||||
{
|
||||
Assert( mod != NULL );
|
||||
|
||||
switch( mod->type )
|
||||
{
|
||||
case mod_studio:
|
||||
Mod_StudioUnloadTextures( mod->cache.data );
|
||||
break;
|
||||
case mod_alias:
|
||||
Mod_AliasUnloadTextures( mod->cache.data );
|
||||
break;
|
||||
case mod_brush:
|
||||
Mod_BrushUnloadTextures( mod );
|
||||
break;
|
||||
case mod_sprite:
|
||||
Mod_SpriteUnloadTextures( mod->cache.data );
|
||||
break;
|
||||
default: gEngfuncs.Host_Error( "Mod_UnloadModel: unsupported type %d\n", mod->type );
|
||||
}
|
||||
}
|
||||
|
||||
qboolean Mod_ProcessRenderData( model_t *mod, qboolean create, const byte *buf )
|
||||
{
|
||||
qboolean loaded = true;
|
||||
@ -336,45 +373,6 @@ const byte *GL_TextureData( unsigned int texnum )
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void Mod_BrushUnloadTextures( model_t *mod )
|
||||
{
|
||||
int i;
|
||||
|
||||
for( i = 0; i < mod->numtextures; i++ )
|
||||
{
|
||||
texture_t *tx = mod->textures[i];
|
||||
if( !tx || tx->gl_texturenum == tr.defaultTexture )
|
||||
continue; // free slot
|
||||
|
||||
GL_FreeTexture( tx->gl_texturenum ); // main texture
|
||||
GL_FreeTexture( tx->fb_texturenum ); // luma texture
|
||||
}
|
||||
}
|
||||
|
||||
void Mod_UnloadTextures( model_t *mod )
|
||||
{
|
||||
int i, j;
|
||||
|
||||
Assert( mod != NULL );
|
||||
|
||||
switch( mod->type )
|
||||
{
|
||||
case mod_studio:
|
||||
Mod_StudioUnloadTextures( mod->cache.data );
|
||||
break;
|
||||
case mod_alias:
|
||||
Mod_AliasUnloadTextures( mod->cache.data );
|
||||
break;
|
||||
case mod_brush:
|
||||
Mod_BrushUnloadTextures( mod );
|
||||
break;
|
||||
case mod_sprite:
|
||||
Mod_SpriteUnloadTextures( mod->cache.data );
|
||||
break;
|
||||
default: gEngfuncs.Host_Error( "Mod_UnloadModel: unsupported type %d\n", mod->type );
|
||||
}
|
||||
}
|
||||
|
||||
void R_ProcessEntData( qboolean allocate )
|
||||
{
|
||||
if( !allocate )
|
||||
|
@ -34,7 +34,9 @@ GNU General Public License for more details.
|
||||
#include "pm_movevars.h"
|
||||
//#include "cvar.h"
|
||||
|
||||
#ifndef offsetof
|
||||
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
||||
#endif // offsetof
|
||||
|
||||
#define ASSERT(x) if(!( x )) gEngfuncs.Host_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
|
||||
#define Assert(x) if(!( x )) gEngfuncs.Host_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
|
||||
|
@ -144,9 +144,9 @@ load sprite model
|
||||
*/
|
||||
void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, uint texFlags )
|
||||
{
|
||||
dsprite_t *pin;
|
||||
short *numi = NULL;
|
||||
dframetype_t *pframetype;
|
||||
const dsprite_t *pin;
|
||||
const short *numi = NULL;
|
||||
const dframetype_t *pframetype;
|
||||
msprite_t *psprite;
|
||||
int i;
|
||||
|
||||
@ -156,7 +156,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
|
||||
if( pin->version == SPRITE_VERSION_Q1 || pin->version == SPRITE_VERSION_32 )
|
||||
numi = NULL;
|
||||
else if( pin->version == SPRITE_VERSION_HL )
|
||||
numi = (short *)(buffer + sizeof( dsprite_hl_t ));
|
||||
numi = (const short *)((const byte*)buffer + sizeof( dsprite_hl_t ));
|
||||
|
||||
r_texFlags = texFlags;
|
||||
sprite_version = pin->version;
|
||||
@ -168,21 +168,21 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
|
||||
rgbdata_t *pal;
|
||||
|
||||
pal = gEngfuncs.FS_LoadImage( "#id.pal", (byte *)&i, 768 );
|
||||
pframetype = (dframetype_t *)(buffer + sizeof( dsprite_q1_t )); // pinq1 + 1
|
||||
pframetype = (const dframetype_t *)((const byte*)buffer + sizeof( dsprite_q1_t )); // pinq1 + 1
|
||||
gEngfuncs.FS_FreeImage( pal ); // palette installed, no reason to keep this data
|
||||
}
|
||||
else if( *numi == 256 )
|
||||
{
|
||||
byte *src = (byte *)(numi+1);
|
||||
{
|
||||
const byte *src = (const byte *)(numi+1);
|
||||
rgbdata_t *pal;
|
||||
|
||||
|
||||
// install palette
|
||||
switch( psprite->texFormat )
|
||||
{
|
||||
case SPR_INDEXALPHA:
|
||||
pal = gEngfuncs.FS_LoadImage( "#gradient.pal", src, 768 );
|
||||
break;
|
||||
case SPR_ALPHTEST:
|
||||
case SPR_ALPHTEST:
|
||||
pal = gEngfuncs.FS_LoadImage( "#masked.pal", src, 768 );
|
||||
break;
|
||||
default:
|
||||
@ -190,7 +190,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
|
||||
break;
|
||||
}
|
||||
|
||||
pframetype = (dframetype_t *)(src + 768);
|
||||
pframetype = (const dframetype_t *)(src + 768);
|
||||
gEngfuncs.FS_FreeImage( pal ); // palette installed, no reason to keep this data
|
||||
}
|
||||
else
|
||||
@ -298,7 +298,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
|
||||
temp.width = w;
|
||||
temp.height = h;
|
||||
temp.type = pix->type;
|
||||
temp.flags = pix->flags;
|
||||
temp.flags = pix->flags;
|
||||
temp.size = w * h * gEngfuncs.Image_GetPFDesc(temp.type)->bpp;
|
||||
temp.buffer = Mem_Malloc( r_temppool, temp.size );
|
||||
temp.palette = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user