2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-12-23 17:25:24 +01:00

ref: fix some undefined references, compile-in mathlib and crtlib to refdll

This commit is contained in:
Alibek Omarov 2019-03-06 17:14:25 +03:00
parent e7234bada2
commit d0d5fd1a3f
21 changed files with 315 additions and 291 deletions

View File

@ -184,6 +184,26 @@ void CL_FreeParticle( particle_t *p )
cl_free_particles = p;
}
/*
================
CL_AllocParticleFast
unconditionally give new particle pointer from cl_free_particles
================
*/
particle_t *CL_AllocParticleFast( void )
{
particle_t *p = NULL;
if( cl_free_particles )
{
p = cl_free_particles;
cl_free_particles = p->next;
}
return p;
}
/*
================
R_AllocParticle

View File

@ -13,7 +13,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#pragma once
#ifndef REF_COMMON_H
#if !defined REF_COMMON_H && !defined REF_DLL
#define REF_COMMON_H
#include "ref_api.h"

View File

@ -478,6 +478,70 @@ typedef struct host_parm_s
extern host_parm_t host;
extern sysinfo_t SI;
#define CMD_SERVERDLL BIT( 0 ) // added by server.dll
#define CMD_CLIENTDLL BIT( 1 ) // added by client.dll
#define CMD_GAMEUIDLL BIT( 2 ) // added by GameUI.dll
#define CMD_LOCALONLY BIT( 3 ) // restricted from server commands
#define CMD_REFDLL BIT( 4 ) // added by ref.dll
typedef void (*xcommand_t)( void );
//
// cmd.c
//
void Cbuf_Init( void );
void Cbuf_Clear( void );
void Cbuf_AddText( const char *text );
void Cbuf_InsertText( const char *text );
void Cbuf_ExecStuffCmds( void );
void Cbuf_Execute (void);
int Cmd_Argc( void );
const char *Cmd_Args( void );
const char *Cmd_Argv( int arg );
void Cmd_Init( void );
void Cmd_Unlink( int group );
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
void Cmd_AddRestrictedCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
void Cmd_AddServerCommand( const char *cmd_name, xcommand_t function );
int Cmd_AddClientCommand( const char *cmd_name, xcommand_t function );
int Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function );
void Cmd_RemoveCommand( const char *cmd_name );
qboolean Cmd_Exists( const char *cmd_name );
void Cmd_LookupCmds( char *buffer, void *ptr, setpair_t callback );
qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
void Cmd_TokenizeString( char *text );
void Cmd_ExecuteString( char *text );
void Cmd_ForwardToServer( void );
//
// zone.c
//
void Memory_Init( void );
void *_Mem_Realloc( byte *poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
void *_Mem_Alloc( byte *poolptr, size_t size, qboolean clear, const char *filename, int fileline );
byte *_Mem_AllocPool( const char *name, const char *filename, int fileline );
void _Mem_FreePool( byte **poolptr, const char *filename, int fileline );
void _Mem_EmptyPool( byte *poolptr, const char *filename, int fileline );
void _Mem_Free( void *data, const char *filename, int fileline );
void _Mem_Check( const char *filename, int fileline );
qboolean Mem_IsAllocatedExt( byte *poolptr, void *data );
void Mem_PrintList( size_t minallocationsize );
void Mem_PrintStats( void );
#ifndef REF_DLL
#define Mem_Malloc( pool, size ) _Mem_Alloc( pool, size, false, __FILE__, __LINE__ )
#define Mem_Calloc( pool, size ) _Mem_Alloc( pool, size, true, __FILE__, __LINE__ )
#define Mem_Realloc( pool, ptr, size ) _Mem_Realloc( pool, ptr, size, true, __FILE__, __LINE__ )
#define Mem_Free( mem ) _Mem_Free( mem, __FILE__, __LINE__ )
#define Mem_AllocPool( name ) _Mem_AllocPool( name, __FILE__, __LINE__ )
#define Mem_FreePool( pool ) _Mem_FreePool( pool, __FILE__, __LINE__ )
#define Mem_EmptyPool( pool ) _Mem_EmptyPool( pool, __FILE__, __LINE__ )
#define Mem_IsAllocated( mem ) Mem_IsAllocatedExt( NULL, mem )
#define Mem_Check() _Mem_Check( __FILE__, __LINE__ )
#endif
//
// filesystem.c
//

View File

@ -33,43 +33,6 @@ enum
TIME_FILENAME,
};
#define CMD_SERVERDLL BIT( 0 ) // added by server.dll
#define CMD_CLIENTDLL BIT( 1 ) // added by client.dll
#define CMD_GAMEUIDLL BIT( 2 ) // added by GameUI.dll
#define CMD_LOCALONLY BIT( 3 ) // restricted from server commands
#define CMD_REFDLL BIT( 4 ) // added by ref.dll
typedef void (*xcommand_t)( void );
//
// cmd.c
//
void Cbuf_Init( void );
void Cbuf_Clear( void );
void Cbuf_AddText( const char *text );
void Cbuf_InsertText( const char *text );
void Cbuf_ExecStuffCmds( void );
void Cbuf_Execute (void);
int Cmd_Argc( void );
const char *Cmd_Args( void );
const char *Cmd_Argv( int arg );
void Cmd_Init( void );
void Cmd_Unlink( int group );
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
void Cmd_AddRestrictedCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
void Cmd_AddServerCommand( const char *cmd_name, xcommand_t function );
int Cmd_AddClientCommand( const char *cmd_name, xcommand_t function );
int Cmd_AddGameUICommand( const char *cmd_name, xcommand_t function );
void Cmd_RemoveCommand( const char *cmd_name );
qboolean Cmd_Exists( const char *cmd_name );
void Cmd_LookupCmds( char *buffer, void *ptr, setpair_t callback );
qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
void Cmd_TokenizeString( char *text );
void Cmd_ExecuteString( char *text );
void Cmd_ForwardToServer( void );
//
// crtlib.c
//
@ -118,31 +81,5 @@ void COM_ReplaceExtension( char *path, const char *extension );
void COM_ExtractFilePath( const char *path, char *dest );
const char *COM_FileWithoutPath( const char *in );
void COM_StripExtension( char *path );
//
// zone.c
//
void Memory_Init( void );
void *_Mem_Realloc( byte *poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline );
void *_Mem_Alloc( byte *poolptr, size_t size, qboolean clear, const char *filename, int fileline );
byte *_Mem_AllocPool( const char *name, const char *filename, int fileline );
void _Mem_FreePool( byte **poolptr, const char *filename, int fileline );
void _Mem_EmptyPool( byte *poolptr, const char *filename, int fileline );
void _Mem_Free( void *data, const char *filename, int fileline );
void _Mem_Check( const char *filename, int fileline );
qboolean Mem_IsAllocatedExt( byte *poolptr, void *data );
void Mem_PrintList( size_t minallocationsize );
void Mem_PrintStats( void );
#define Mem_Malloc( pool, size ) _Mem_Alloc( pool, size, false, __FILE__, __LINE__ )
#define Mem_Calloc( pool, size ) _Mem_Alloc( pool, size, true, __FILE__, __LINE__ )
#define Mem_Realloc( pool, ptr, size ) _Mem_Realloc( pool, ptr, size, true, __FILE__, __LINE__ )
#define Mem_Free( mem ) _Mem_Free( mem, __FILE__, __LINE__ )
#define Mem_AllocPool( name ) _Mem_AllocPool( name, __FILE__, __LINE__ )
#define Mem_FreePool( pool ) _Mem_FreePool( pool, __FILE__, __LINE__ )
#define Mem_EmptyPool( pool ) _Mem_EmptyPool( pool, __FILE__, __LINE__ )
#define Mem_IsAllocated( mem ) Mem_IsAllocatedExt( NULL, mem )
#define Mem_Check() _Mem_Check( __FILE__, __LINE__ )
#endif//STDLIB_H

View File

@ -52,7 +52,9 @@ extern "C" {
#include "const.h"
#include "crtlib.h"
#ifndef REF_DLL
#define ASSERT( exp ) if(!( exp )) Sys_Error( "assert failed at %s:%i\n", __FILE__, __LINE__ )
#endif
/*
========================================================================

View File

@ -72,6 +72,8 @@ typedef struct ref_globals_s
float time; // cl.time
float oldtime; // cl.oldtime
double realtime; // host.realtime
double frametime; // host.frametime
int parsecount; // cl.parsecount
int parsecountmod; // cl.parsecountmod
@ -151,10 +153,11 @@ typedef struct ref_api_s
int (*CL_GetRenderParm)( int parm, int arg ); // generic
// cvar handlers
convar_t *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *description );
convar_t *(*Cvar_Get)( const char *szName, const char *szValue, int flags, const char *description );
convar_t *(*pfnGetCvarPointer)( const char *name );
float (*pfnGetCvarFloat)( const char *szName );
const char *(*pfnGetCvarString)( const char *szName );
void (*Cvar_SetValue)( const char *name, float value );
// command handlers
int (*Cmd_AddCommand)( const char *cmd_name, void (*function)(void), const char *description );
@ -207,6 +210,7 @@ typedef struct ref_api_s
void (*CL_DrawEFX)( float time, qboolean fTrans );
void (*CL_ThinkParticle)( double frametime, particle_t *p );
void (*R_FreeDeadParticles)( particle_t **ppparticles );
particle_t *(*CL_AllocParticleFast)( void ); // unconditionally give new particle pointer from cl_free_particles
efrag_t* (*GetEfragsFreeList)( void ); // clgame.free_efrags
void (*SetEfragsFreeList)( efrag_t* ); // clgame.free_efrags
color24 *(*GetTracerColors)( int num );
@ -230,6 +234,7 @@ typedef struct ref_api_s
uint (*COM_HashKey)( const char *strings, uint hashSize );
void (*Host_Error)( const char *fmt, ... );
int (*CL_FxBlend)( cl_entity_t *e );
void (*COM_SetRandomSeed)( int lSeed );
float (*COM_RandomFloat)( float rmin, float rmax );
int (*COM_RandomLong)( int rmin, int rmax );
struct screenfade_s *(*GetScreenFade)( void );
@ -237,6 +242,7 @@ typedef struct ref_api_s
void (*GetPredictedOrigin)( vec3_t v );
byte *(*CL_GetPaletteColor)(int color); // clgame.palette[color]
void (*CL_GetScreenInfo)( int *width, int *height ); // clgame.scrInfo, ptrs may be NULL
void (*SetLocalLightLevel)( int level ); // cl.local.light_level
// studio interface
player_info_t *(*pfnPlayerInfo)( int index );
@ -260,6 +266,7 @@ typedef struct ref_api_s
// use Mem_Free instead
// void (*COM_FreeFile)( void *buffer );
int (*FS_FileExists)( const char *filename, int gamedironly );
void (*FS_AllowDirectPaths)( qboolean enable );
// GL
int (*GL_SetAttribute)( int attr, int value );
@ -308,6 +315,12 @@ typedef struct ref_api_s
// imagelib
void (*Image_AddCmdFlags)( uint flags ); // used to check if hardware dxt is supported
qboolean (*Image_CustomPalette)( void );
qboolean (*Image_Process)( rgbdata_t **pix, int width, int height, uint flags, float bumpscale );
rgbdata_t *(*FS_LoadImage)( const char *filename, const byte *buffer, size_t size );
qboolean (*FS_SaveImage)( const char *filename, rgbdata_t *pix );
rgbdata_t *(*FS_CopyImage)( rgbdata_t *in );
void (*FS_FreeImage)( rgbdata_t *pack );
// client exports
void (*pfnDrawNormalTriangles)( void );

View File

@ -434,7 +434,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
skin.palette = (byte *)gEngfuncs.CL_GetPaletteColor( 0 );
skin.size = width * height;
if( !Image_CustomPalette() )
if( !gEngfuncs.Image_CustomPalette() )
{
for( i = 0; i < skin.width * skin.height; i++ )
{
@ -476,7 +476,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
}
// make an copy
return FS_CopyImage( &skin );
return gEngfuncs.FS_CopyImage( &skin );
}
void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
@ -489,14 +489,14 @@ void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum );
Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum );
Q_snprintf( checkname, sizeof( checkname ), "%s_%i.tga", loadmodel->name, skinnum );
if( !gEngfuncs.FS_FileExists( checkname, false ) || ( pic = FS_LoadImage( checkname, NULL, 0 )) == NULL )
if( !gEngfuncs.FS_FileExists( checkname, false ) || ( pic = gEngfuncs.FS_LoadImage( checkname, NULL, 0 )) == NULL )
pic = Mod_CreateSkinData( loadmodel, (byte *)(pskintype + 1), m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight );
m_pAliasHeader->gl_texturenum[skinnum][0] =
m_pAliasHeader->gl_texturenum[skinnum][1] =
m_pAliasHeader->gl_texturenum[skinnum][2] =
m_pAliasHeader->gl_texturenum[skinnum][3] = GL_LoadTextureInternal( name, pic, 0 );
FS_FreeImage( pic );
gEngfuncs.FS_FreeImage( pic );
if( R_GetTexture( m_pAliasHeader->gl_texturenum[skinnum][0] )->flags & TF_HAS_LUMA )
{
@ -505,7 +505,7 @@ void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
m_pAliasHeader->fb_texturenum[skinnum][1] =
m_pAliasHeader->fb_texturenum[skinnum][2] =
m_pAliasHeader->fb_texturenum[skinnum][3] = GL_LoadTextureInternal( lumaname, pic, TF_MAKELUMA );
FS_FreeImage( pic );
gEngfuncs.FS_FreeImage( pic );
}
return ((byte *)(pskintype + 1) + size);
@ -518,6 +518,7 @@ void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size )
string name, lumaname;
rgbdata_t *pic;
int i, j;
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
// animating skin group. yuck.
pskintype++;
@ -530,14 +531,14 @@ void *Mod_LoadGroupSkin( daliasskintype_t *pskintype, int skinnum, int size )
Q_snprintf( name, sizeof( name ), "%s_%i_%i", loadmodel->name, skinnum, i );
pic = Mod_CreateSkinData( loadmodel, (byte *)(pskintype), m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight );
m_pAliasHeader->gl_texturenum[skinnum][i & 3] = GL_LoadTextureInternal( name, pic, 0 );
FS_FreeImage( pic );
gEngfuncs.FS_FreeImage( pic );
if( R_GetTexture( m_pAliasHeader->gl_texturenum[skinnum][i & 3] )->flags & TF_HAS_LUMA )
{
Q_snprintf( lumaname, sizeof( lumaname ), "%s_%i_%i_luma", loadmodel->name, skinnum, i );
pic = Mod_CreateSkinData( NULL, (byte *)(pskintype), m_pAliasHeader->skinwidth, m_pAliasHeader->skinheight );
m_pAliasHeader->fb_texturenum[skinnum][i & 3] = GL_LoadTextureInternal( lumaname, pic, TF_MAKELUMA );
FS_FreeImage( pic );
gEngfuncs.FS_FreeImage( pic );
}
pskintype = (daliasskintype_t *)((byte *)(pskintype) + size);
@ -725,7 +726,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
GL_MakeAliasModelDisplayLists( mod );
// move the complete, relocatable alias model to the cache
loadmodel->cache.data = m_pAliasHeader;
gEngfuncs.Mod_GetCurrentLoadingModel()->cache.data = m_pAliasHeader;
if( loaded ) *loaded = true; // done
}
@ -817,7 +818,7 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
msurface_t *psurf = NULL;
pmtrace_t trace;
if( FBitSet( host.features, ENGINE_WRITE_LARGE_COORD ))
if( FBitSet( gEngfuncs.CL_GetRenderParm( PARM_FEATURES, 0 ), ENGINE_WRITE_LARGE_COORD ))
{
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
@ -838,9 +839,9 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
{
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
light.r = LightToTexGamma( bound( 0, mv->skycolor_r, 255 ));
light.g = LightToTexGamma( bound( 0, mv->skycolor_g, 255 ));
light.b = LightToTexGamma( bound( 0, mv->skycolor_b, 255 ));
light.r = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_r, 255 ));
light.g = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_g, 255 ));
light.b = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_b, 255 ));
}
}
@ -901,8 +902,10 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
// scale lightdir by light intentsity
VectorScale( lightDir, total, lightDir );
for( lnum = 0, dl = cl_dlights; lnum < MAX_DLIGHTS; lnum++, dl++ )
for( lnum = 0; lnum < MAX_DLIGHTS; lnum++ )
{
dl = gEngfuncs.GetDynamicLight( lnum );
if( dl->die < g_alias.time || !r_dynamic->value )
continue;
@ -921,9 +924,9 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
VectorAdd( lightDir, dist, lightDir );
finalLight[0] += LightToTexGamma( dl->color.r ) * ( add / 256.0f ) * 2.0f;
finalLight[1] += LightToTexGamma( dl->color.g ) * ( add / 256.0f ) * 2.0f;
finalLight[2] += LightToTexGamma( dl->color.b ) * ( add / 256.0f ) * 2.0f;
finalLight[0] += gEngfuncs.LightToTexGamma( dl->color.r ) * ( add / 256.0f ) * 2.0f;
finalLight[1] += gEngfuncs.LightToTexGamma( dl->color.g ) * ( add / 256.0f ) * 2.0f;
finalLight[2] += gEngfuncs.LightToTexGamma( dl->color.b ) * ( add / 256.0f ) * 2.0f;
}
}
@ -1356,7 +1359,7 @@ static void R_AliasSetupTimings( void )
else
{
// menu stuff
g_alias.time = host.realtime;
g_alias.time = gpGlobals->realtime;
}
m_fDoRemap = false;
@ -1389,7 +1392,7 @@ void R_DrawAliasModel( cl_entity_t *e )
//
// locate the proper data
//
m_pAliasHeader = (aliashdr_t *)Mod_AliasExtradata( RI.currententity->model );
m_pAliasHeader = (aliashdr_t *)gEngfuncs.Mod_Extradata( mod_alias, RI.currententity->model );
if( !m_pAliasHeader ) return;
// init time
@ -1400,7 +1403,7 @@ void R_DrawAliasModel( cl_entity_t *e )
R_AliasLerpMovement( e );
if( !FBitSet( host.features, ENGINE_COMPENSATE_QUAKE_BUG ))
if( !FBitSet( gEngfuncs.CL_GetRenderParm( PARM_FEATURES, 0 ), ENGINE_COMPENSATE_QUAKE_BUG ))
e->angles[PITCH] = -e->angles[PITCH]; // stupid quake bug
// don't rotate clients, only aim

View File

@ -477,7 +477,7 @@ qboolean VID_ScreenShot( const char *filename, int shot_type )
case VID_SCREENSHOT:
break;
case VID_SNAPSHOT:
FS_AllowDirectPaths( true );
gEngfuncs.FS_AllowDirectPaths( true );
break;
case VID_LEVELSHOT:
flags |= IMAGE_RESAMPLE;
@ -504,13 +504,13 @@ qboolean VID_ScreenShot( const char *filename, int shot_type )
break;
}
Image_Process( &r_shot, width, height, flags, 0.0f );
gEngfuncs.Image_Process( &r_shot, width, height, flags, 0.0f );
// write image
result = FS_SaveImage( filename, r_shot );
host.write_to_clipboard = false; // disable write to clipboard
FS_AllowDirectPaths( false ); // always reset after store screenshot
FS_FreeImage( r_shot );
result = gEngfuncs.FS_SaveImage( filename, r_shot );
// REFTODO: host.write_to_clipboard = false; // disable write to clipboard
gEngfuncs.FS_AllowDirectPaths( false ); // always reset after store screenshot
gEngfuncs.FS_FreeImage( r_shot );
return result;
}
@ -573,7 +573,7 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
r_side->size = r_side->width * r_side->height * 3;
r_side->buffer = temp;
if( flags ) Image_Process( &r_side, 0, 0, flags, 0.0f );
if( flags ) gEngfuncs.Image_Process( &r_side, 0, 0, flags, 0.0f );
memcpy( buffer + (size * size * 3 * i), r_side->buffer, size * size * 3 );
}
@ -594,9 +594,9 @@ qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qbo
COM_DefaultExtension( basename, ".tga" );
// write image as 6 sides
result = FS_SaveImage( basename, r_shot );
FS_FreeImage( r_shot );
FS_FreeImage( r_side );
result = gEngfuncs.FS_SaveImage( basename, r_shot );
gEngfuncs.FS_FreeImage( r_shot );
gEngfuncs.FS_FreeImage( r_side );
return result;
}
@ -659,7 +659,7 @@ rebuild_page:
if( i == MAX_TEXTURES && gl_showtextures->value != 1 )
{
// bad case, rewind to one and try again
Cvar_SetValue( "r_showtextures", max( 1, gl_showtextures->value - 1 ));
gEngfuncs.Cvar_SetValue( "r_showtextures", max( 1, gl_showtextures->value - 1 ));
if( ++numTries < 2 ) goto rebuild_page; // to prevent infinite loop
}
@ -805,7 +805,7 @@ void R_ShowTree( void )
R_ShowTree_r( WORLDMODEL->nodes, x, y, tr.max_recursion * 3.5f, 1 );
Con_NPrintf( 0, "max recursion %d\n", tr.max_recursion );
gEngfuncs.Con_NPrintf( 0, "max recursion %d\n", tr.max_recursion );
}
/*
@ -824,10 +824,10 @@ void SCR_TimeRefresh_f( void )
if( gEngfuncs.CL_GetConnState() != ref_ca_active )
return;
start = Sys_DoubleTime();
start = gEngfuncs.pfnTime();
// run without page flipping like GoldSrc
if( Cmd_Argc() == 1 )
if( gEngfuncs.Cmd_Argc() == 1 )
{
pglDrawBuffer( GL_FRONT );
for( i = 0; i < 128; i++ )
@ -849,7 +849,7 @@ void SCR_TimeRefresh_f( void )
}
}
stop = Sys_DoubleTime ();
stop = gEngfuncs.pfnTime ();
time = (stop - start);
gEngfuncs.Con_Printf( "%f seconds (%f fps)\n", time, 128 / time );
}

View File

@ -52,7 +52,7 @@ static void FracNoise( float *noise, int divs )
if( divs < 2 ) return;
// noise is normalized to +/- scale
noise[div2] = ( noise[0] + noise[divs] ) * 0.5f + divs * COM_RandomFloat( -0.125f, 0.125f );
noise[div2] = ( noise[0] + noise[divs] ) * 0.5f + divs * gEngfuncs.COM_RandomFloat( -0.125f, 0.125f );
if( div2 > 1 )
{
@ -596,17 +596,14 @@ void R_DrawBeamFollow( BEAM *pbeam, float frametime )
VectorSubtract( particles->org, pbeam->source, delta );
div = VectorLength( delta );
if( div >= 32 && cl_free_particles )
if( div >= 32 )
{
pnew = cl_free_particles;
cl_free_particles = pnew->next;
pnew = gEngfuncs.CL_AllocParticleFast();
}
}
else if( cl_free_particles )
else
{
pnew = cl_free_particles;
cl_free_particles = pnew->next;
div = 0;
pnew = gEngfuncs.CL_AllocParticleFast();
}
}

View File

@ -298,17 +298,17 @@ void R_SetTextureParameters( void )
if( GL_Support( GL_ANISOTROPY_EXT ))
{
if( gl_texture_anisotropy->value > glConfig.max_texture_anisotropy )
Cvar_SetValue( "gl_anisotropy", glConfig.max_texture_anisotropy );
gEngfuncs.Cvar_SetValue( "gl_anisotropy", glConfig.max_texture_anisotropy );
else if( gl_texture_anisotropy->value < 1.0f )
Cvar_SetValue( "gl_anisotropy", 1.0f );
gEngfuncs.Cvar_SetValue( "gl_anisotropy", 1.0f );
}
if( GL_Support( GL_TEXTURE_LOD_BIAS ))
{
if( gl_texture_lodbias->value < -glConfig.max_texture_lod_bias )
Cvar_SetValue( "gl_texture_lodbias", -glConfig.max_texture_lod_bias );
gEngfuncs.Cvar_SetValue( "gl_texture_lodbias", -glConfig.max_texture_lod_bias );
else if( gl_texture_lodbias->value > glConfig.max_texture_lod_bias )
Cvar_SetValue( "gl_texture_lodbias", glConfig.max_texture_lod_bias );
gEngfuncs.Cvar_SetValue( "gl_texture_lodbias", glConfig.max_texture_lod_bias );
}
ClearBits( gl_texture_anisotropy->flags, FCVAR_CHANGED );
@ -1248,14 +1248,14 @@ static void GL_ProcessImage( gl_texture_t *tex, rgbdata_t *pic )
}
if( !FBitSet( tex->flags, TF_IMG_UPLOADED ) && FBitSet( tex->flags, TF_KEEP_SOURCE ))
tex->original = FS_CopyImage( pic ); // because current pic will be expanded to rgba
tex->original = gEngfuncs.FS_CopyImage( pic ); // because current pic will be expanded to rgba
// we need to expand image into RGBA buffer
if( pic->type == PF_INDEXED_24 || pic->type == PF_INDEXED_32 )
img_flags |= IMAGE_FORCE_RGBA;
// processing image before uploading (force to rgba, make luma etc)
if( pic->buffer ) Image_Process( &pic, 0, 0, img_flags, gl_emboss_scale->value );
if( pic->buffer ) gEngfuncs.Image_Process( &pic, 0, 0, img_flags, gl_emboss_scale->value );
if( FBitSet( tex->flags, TF_LUMINANCE ))
ClearBits( pic->flags, IMAGE_HAS_COLOR );
@ -1382,7 +1382,7 @@ static void GL_DeleteTexture( gl_texture_t *tex )
// release source
if( tex->original )
FS_FreeImage( tex->original );
gEngfuncs.FS_FreeImage( tex->original );
pglDeleteTextures( 1, &tex->texnum );
memset( tex, 0, sizeof( *tex ));
@ -1448,7 +1448,7 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags )
// set some image flags
Image_SetForceFlags( picFlags );
pic = FS_LoadImage( name, buf, size );
pic = gEngfuncs.FS_LoadImage( name, buf, size );
if( !pic ) return 0; // couldn't loading image
// allocate the new one
@ -1458,12 +1458,12 @@ int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags )
if( !GL_UploadTexture( tex, pic ))
{
memset( tex, 0, sizeof( gl_texture_t ));
FS_FreeImage( pic ); // release source texture
gEngfuncs.FS_FreeImage( pic ); // release source texture
return 0;
}
GL_ApplyTextureParams( tex ); // update texture filter, wrap etc
FS_FreeImage( pic ); // release source texture
gEngfuncs.FS_FreeImage( pic ); // release source texture
// NOTE: always return texnum as index in array or engine will stop work !!!
return tex - gl_textures;
@ -1516,7 +1516,7 @@ int GL_LoadTextureArray( const char **names, int flags )
{
size_t srcsize, dstsize, mipsize;
src = FS_LoadImage( names[i], NULL, 0 );
src = gEngfuncs.FS_LoadImage( names[i], NULL, 0 );
if( !src ) break; // coldn't find layer
if( pic )
@ -1543,7 +1543,7 @@ int GL_LoadTextureArray( const char **names, int flags )
// but allow to rescale raw images
if( ImageRAW( pic->type ) && ImageRAW( src->type ) && ( pic->width != src->width || pic->height != src->height ))
Image_Process( &src, pic->width, pic->height, IMAGE_RESAMPLE, 0.0f );
gEngfuncs.Image_Process( &src, pic->width, pic->height, IMAGE_RESAMPLE, 0.0f );
if( pic->size != src->size )
{
@ -1574,7 +1574,7 @@ int GL_LoadTextureArray( const char **names, int flags )
srcsize += mipsize;
}
FS_FreeImage( src );
gEngfuncs.FS_FreeImage( src );
// increase layers
pic->depth++;
@ -1584,7 +1584,7 @@ int GL_LoadTextureArray( const char **names, int flags )
if( !pic || ( pic->depth != numLayers ))
{
gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: not all layers were loaded. Texture array is not created\n" );
if( pic ) FS_FreeImage( pic );
if( pic ) gEngfuncs.FS_FreeImage( pic );
return 0;
}
@ -1599,12 +1599,12 @@ int GL_LoadTextureArray( const char **names, int flags )
if( !GL_UploadTexture( tex, pic ))
{
memset( tex, 0, sizeof( gl_texture_t ));
FS_FreeImage( pic ); // release source texture
gEngfuncs.FS_FreeImage( pic ); // release source texture
return 0;
}
GL_ApplyTextureParams( tex ); // update texture filter, wrap etc
FS_FreeImage( pic ); // release source texture
gEngfuncs.FS_FreeImage( pic ); // release source texture
// NOTE: always return texnum as index in array or engine will stop work !!!
return tex - gl_textures;
@ -1817,13 +1817,13 @@ void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
}
// all the operations makes over the image copy not an original
pic = FS_CopyImage( image->original );
Image_Process( &pic, topColor, bottomColor, flags, 0.0f );
pic = gEngfuncs.FS_CopyImage( image->original );
gEngfuncs.Image_Process( &pic, topColor, bottomColor, flags, 0.0f );
GL_UploadTexture( image, pic );
GL_ApplyTextureParams( image ); // update texture filter, wrap etc
FS_FreeImage( pic );
gEngfuncs.FS_FreeImage( pic );
}
/*

View File

@ -35,13 +35,6 @@ GNU General Public License for more details.
#include "cvar.h"
#define offsetof(s,m) (size_t)&(((s *)0)->m)
void CL_DrawEFX(double, double);
void *GL_GetProcAddress(char *);
void GL_CheckForErrors();
void CL_ExtraUpdate();
void Cbuf_Execute();
#define Cvar_SetValue(...)
#define FS_FreeImage(...)
#define ASSERT(x)
#define Assert(x)
@ -278,15 +271,9 @@ extern ref_instance_t RI;
extern gl_globals_t tr;
extern float gldepthmin, gldepthmax;
extern dlight_t cl_dlights[MAX_DLIGHTS];
extern dlight_t cl_elights[MAX_ELIGHTS];
#define r_numEntities (tr.draw_list->num_solid_entities + tr.draw_list->num_trans_entities)
#define r_numStatics (r_stats.c_client_ents)
extern struct beam_s *cl_active_beams;
extern struct beam_s *cl_free_beams;
extern struct particle_s *cl_free_particles;
//
// gl_backend.c
//
@ -755,9 +742,6 @@ extern convar_t *tracerred;
extern convar_t *tracergreen;
extern convar_t *tracerblue;
extern convar_t *traceralpha;
extern convar_t *tracerspeed;
extern convar_t *tracerlength;
extern convar_t *traceroffset;
extern convar_t *cl_lightstyle_lerping;
@ -766,40 +750,12 @@ extern convar_t *cl_lightstyle_lerping;
//
#include "crtlib.h"
FORCEINLINE float COM_RandomFloat( float rmin, float rmax )
{
return gEngfuncs.COM_RandomFloat( rmin, rmax );
}
FORCEINLINE int COM_RandomLong( int rmin, int rmax )
{
return gEngfuncs.COM_RandomLong( rmin, rmax );
}
FORCEINLINE byte *_Mem_AllocPool( const char *name, const char *filename, int fileline )
{
return gEngfuncs._Mem_AllocPool( name, filename, fileline );
}
FORCEINLINE void _Mem_FreePool( byte **poolptr, const char *filename, int fileline )
{
gEngfuncs._Mem_FreePool( poolptr, filename, fileline );
}
FORCEINLINE void *_Mem_Alloc( byte *poolptr, size_t size, qboolean clear, const char *filename, int fileline )
{
return gEngfuncs._Mem_Alloc( poolptr, size, clear, filename, fileline );
}
FORCEINLINE void *_Mem_Realloc( byte *poolptr, void *memptr, size_t size, qboolean clear, const char *filename, int fileline )
{
return gEngfuncs._Mem_Realloc( poolptr, memptr, size, clear, filename, fileline );
}
FORCEINLINE void _Mem_Free( void *data, const char *filename, int fileline )
{
gEngfuncs._Mem_Free( data, filename, fileline );
}
#define Mem_Malloc( pool, size ) gEngfuncs._Mem_Alloc( pool, size, false, __FILE__, __LINE__ )
#define Mem_Calloc( pool, size ) gEngfuncs._Mem_Alloc( pool, size, true, __FILE__, __LINE__ )
#define Mem_Realloc( pool, ptr, size ) gEngfuncs._Mem_Realloc( pool, ptr, size, true, __FILE__, __LINE__ )
#define Mem_Free( mem ) gEngfuncs._Mem_Free( mem, __FILE__, __LINE__ )
#define Mem_AllocPool( name ) gEngfuncs._Mem_AllocPool( name, __FILE__, __LINE__ )
#define Mem_FreePool( pool ) gEngfuncs._Mem_FreePool( pool, __FILE__, __LINE__ )
#define Mem_EmptyPool( pool ) gEngfuncs._Mem_EmptyPool( pool, __FILE__, __LINE__ )
#endif // GL_LOCAL_H

View File

@ -37,9 +37,19 @@ convar_t *r_lockfrustum;
convar_t *r_traceglow;
convar_t *r_dynamic;
convar_t *r_lightmap;
convar_t *r_showhull;
convar_t *gl_round_down;
convar_t *r_vbo;
convar_t *r_vbo_dlightmode;
convar_t *gl_showtextures;
convar_t *vid_brightness;
convar_t *vid_gamma;
convar_t *cl_draw_particles;
convar_t *tracerred;
convar_t *tracergreen;
convar_t *tracerblue;
convar_t *traceralpha;
byte *r_temppool;
@ -321,7 +331,7 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
if( cvarname )
{
// system config disable extensions
parm = Cvar_Get( cvarname, "1", FCVAR_GLCONFIG, va( CVAR_GLCONFIG_DESCRIPTION, name ));
parm = gEngfuncs.Cvar_Get( cvarname, "1", FCVAR_GLCONFIG, va( CVAR_GLCONFIG_DESCRIPTION, name ));
}
if(( parm && !CVAR_TO_BOOL( parm )) || ( !CVAR_TO_BOOL( gl_extensions ) && r_ext != GL_OPENGL_110 ))
@ -473,7 +483,7 @@ void R_RenderInfo_f( void )
}
gEngfuncs.Con_Printf( "\n" );
gEngfuncs.Con_Printf( "MODE: %ix%i\n", vidState.width, vidState.height );
gEngfuncs.Con_Printf( "MODE: %ix%i\n", gpGlobals->width, gpGlobals->height );
gEngfuncs.Con_Printf( "\n" );
gEngfuncs.Con_Printf( "VERTICAL SYNC: %s\n", gl_vsync->value ? "enabled" : "disabled" );
gEngfuncs.Con_Printf( "Color %d bits, Alpha %d bits, Depth %d bits, Stencil %d bits\n", glConfig.color_bits,
@ -719,7 +729,7 @@ void GL_InitExtensions( void )
// MCD has buffering issues
#ifdef _WIN32
if( Q_strstr( glConfig.renderer_string, "gdi" ))
Cvar_SetValue( "gl_finish", 1 );
gEngfuncs.Cvar_SetValue( "gl_finish", 1 );
#endif
tr.framecount = tr.visframecount = 1;
@ -742,46 +752,47 @@ GL_InitCommands
*/
void GL_InitCommands( void )
{
r_speeds = Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
r_fullbright = Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
r_norefresh = Cvar_Get( "r_norefresh", "0", 0, "disable 3D rendering (use with caution)" );
r_showtree = Cvar_Get( "r_showtree", "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
r_lighting_extended = Cvar_Get( "r_lighting_extended", "1", FCVAR_ARCHIVE, "allow to get lighting from world and bmodels" );
r_lighting_modulate = Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "lightstyles modulate scale" );
r_lighting_ambient = Cvar_Get( "r_lighting_ambient", "0.3", FCVAR_ARCHIVE, "map ambient lighting scale" );
r_novis = Cvar_Get( "r_novis", "0", 0, "ignore vis information (perfomance test)" );
r_nocull = Cvar_Get( "r_nocull", "0", 0, "ignore frustrum culling (perfomance test)" );
r_detailtextures = Cvar_Get( "r_detailtextures", "1", FCVAR_ARCHIVE, "enable detail textures support, use '2' for autogenerate detail.txt" );
r_lockpvs = Cvar_Get( "r_lockpvs", "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" );
r_lockfrustum = Cvar_Get( "r_lockfrustum", "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" );
r_dynamic = Cvar_Get( "r_dynamic", "1", FCVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" );
r_traceglow = Cvar_Get( "r_traceglow", "1", FCVAR_ARCHIVE, "cull flares behind models" );
r_lightmap = Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
r_drawentities = Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
r_speeds = gEngfuncs.Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
r_fullbright = gEngfuncs.Cvar_Get( "r_fullbright", "0", FCVAR_CHEAT, "disable lightmaps, get fullbright for entities" );
r_norefresh = gEngfuncs.Cvar_Get( "r_norefresh", "0", 0, "disable 3D rendering (use with caution)" );
r_showtree = gEngfuncs.Cvar_Get( "r_showtree", "0", FCVAR_ARCHIVE, "build the graph of visible BSP tree" );
r_lighting_extended = gEngfuncs.Cvar_Get( "r_lighting_extended", "1", FCVAR_ARCHIVE, "allow to get lighting from world and bmodels" );
r_lighting_modulate = gEngfuncs.Cvar_Get( "r_lighting_modulate", "0.6", FCVAR_ARCHIVE, "lightstyles modulate scale" );
r_lighting_ambient = gEngfuncs.Cvar_Get( "r_lighting_ambient", "0.3", FCVAR_ARCHIVE, "map ambient lighting scale" );
r_novis = gEngfuncs.Cvar_Get( "r_novis", "0", 0, "ignore vis information (perfomance test)" );
r_nocull = gEngfuncs.Cvar_Get( "r_nocull", "0", 0, "ignore frustrum culling (perfomance test)" );
r_detailtextures = gEngfuncs.Cvar_Get( "r_detailtextures", "1", FCVAR_ARCHIVE, "enable detail textures support, use '2' for autogenerate detail.txt" );
r_lockpvs = gEngfuncs.Cvar_Get( "r_lockpvs", "0", FCVAR_CHEAT, "lockpvs area at current point (pvs test)" );
r_lockfrustum = gEngfuncs.Cvar_Get( "r_lockfrustum", "0", FCVAR_CHEAT, "lock frustrum area at current point (cull test)" );
r_dynamic = gEngfuncs.Cvar_Get( "r_dynamic", "1", FCVAR_ARCHIVE, "allow dynamic lighting (dlights, lightstyles)" );
r_traceglow = gEngfuncs.Cvar_Get( "r_traceglow", "1", FCVAR_ARCHIVE, "cull flares behind models" );
r_lightmap = gEngfuncs.Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
r_drawentities = gEngfuncs.Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
r_decals = gEngfuncs.pfnGetCvarPointer( "r_decals" );
r_showhull = gEngfuncs.pfnGetCvarPointer( "r_showhull" );
gl_extensions = Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG, "allow gl_extensions" );
gl_texture_nearest = Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" );
gl_lightmap_nearest = Cvar_Get( "gl_lightmap_nearest", "0", FCVAR_ARCHIVE, "disable lightmap filter" );
gl_check_errors = Cvar_Get( "gl_check_errors", "1", FCVAR_ARCHIVE, "ignore video engine errors" );
gl_extensions = gEngfuncs.Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG, "allow gl_extensions" );
gl_texture_nearest = gEngfuncs.Cvar_Get( "gl_texture_nearest", "0", FCVAR_ARCHIVE, "disable texture filter" );
gl_lightmap_nearest = gEngfuncs.Cvar_Get( "gl_lightmap_nearest", "0", FCVAR_ARCHIVE, "disable lightmap filter" );
gl_check_errors = gEngfuncs.Cvar_Get( "gl_check_errors", "1", FCVAR_ARCHIVE, "ignore video engine errors" );
gl_vsync = gEngfuncs.pfnGetCvarPointer( "gl_vsync" );
gl_detailscale = Cvar_Get( "gl_detailscale", "4.0", FCVAR_ARCHIVE, "default scale applies while auto-generate list of detail textures" );
gl_texture_anisotropy = Cvar_Get( "gl_anisotropy", "8", FCVAR_ARCHIVE, "textures anisotropic filter" );
gl_texture_lodbias = Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (perfomance|quality)" );
gl_keeptjunctions = Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" );
gl_emboss_scale = Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" );
gl_detailscale = gEngfuncs.Cvar_Get( "gl_detailscale", "4.0", FCVAR_ARCHIVE, "default scale applies while auto-generate list of detail textures" );
gl_texture_anisotropy = gEngfuncs.Cvar_Get( "gl_anisotropy", "8", FCVAR_ARCHIVE, "textures anisotropic filter" );
gl_texture_lodbias = gEngfuncs.Cvar_Get( "gl_texture_lodbias", "0.0", FCVAR_ARCHIVE, "LOD bias for mipmapped textures (perfomance|quality)" );
gl_keeptjunctions = gEngfuncs.Cvar_Get( "gl_keeptjunctions", "1", FCVAR_ARCHIVE, "removing tjuncs causes blinking pixels" );
gl_emboss_scale = gEngfuncs.Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" );
gl_showtextures = gEngfuncs.pfnGetCvarPointer( "r_showtextures" );
gl_finish = Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
gl_nosort = Cvar_Get( "gl_nosort", "0", FCVAR_ARCHIVE, "disable sorting of translucent surfaces" );
gl_clear = Cvar_Get( "gl_clear", "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
gl_test = Cvar_Get( "gl_test", "0", 0, "engine developer cvar for quick testing new features" );
gl_wireframe = Cvar_Get( "gl_wireframe", "0", FCVAR_ARCHIVE|FCVAR_SPONLY, "show wireframe overlay" );
gl_wgl_msaa_samples = Cvar_Get( "gl_wgl_msaa_samples", "0", FCVAR_GLCONFIG, "samples number for multisample anti-aliasing" );
gl_msaa = Cvar_Get( "gl_msaa", "1", FCVAR_ARCHIVE, "enable or disable multisample anti-aliasing" );
gl_stencilbits = Cvar_Get( "gl_stencilbits", "8", FCVAR_GLCONFIG, "pixelformat stencil bits (0 - auto)" );
gl_round_down = Cvar_Get( "gl_round_down", "2", FCVAR_RENDERINFO, "round texture sizes to nearest POT value" );
gl_finish = gEngfuncs.Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
gl_nosort = gEngfuncs.Cvar_Get( "gl_nosort", "0", FCVAR_ARCHIVE, "disable sorting of translucent surfaces" );
gl_clear = gEngfuncs.Cvar_Get( "gl_clear", "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
gl_test = gEngfuncs.Cvar_Get( "gl_test", "0", 0, "engine developer cvar for quick testing new features" );
gl_wireframe = gEngfuncs.Cvar_Get( "gl_wireframe", "0", FCVAR_ARCHIVE|FCVAR_SPONLY, "show wireframe overlay" );
gl_wgl_msaa_samples = gEngfuncs.Cvar_Get( "gl_wgl_msaa_samples", "0", FCVAR_GLCONFIG, "samples number for multisample anti-aliasing" );
gl_msaa = gEngfuncs.Cvar_Get( "gl_msaa", "1", FCVAR_ARCHIVE, "enable or disable multisample anti-aliasing" );
gl_stencilbits = gEngfuncs.Cvar_Get( "gl_stencilbits", "8", FCVAR_GLCONFIG, "pixelformat stencil bits (0 - auto)" );
gl_round_down = gEngfuncs.Cvar_Get( "gl_round_down", "2", FCVAR_RENDERINFO, "round texture sizes to nearest POT value" );
// these cvar not used by engine but some mods requires this
gl_polyoffset = Cvar_Get( "gl_polyoffset", "2.0", FCVAR_ARCHIVE, "polygon offset for decals" );
gl_polyoffset = gEngfuncs.Cvar_Get( "gl_polyoffset", "2.0", FCVAR_ARCHIVE, "polygon offset for decals" );
// make sure gl_vsync is checked after vid_restart
SetBits( gl_vsync->flags, FCVAR_CHANGED );
@ -789,6 +800,11 @@ void GL_InitCommands( void )
vid_gamma = gEngfuncs.pfnGetCvarPointer( "gamma" );
vid_brightness = gEngfuncs.pfnGetCvarPointer( "brightness" );
tracerred = gEngfuncs.pfnGetCvarPointer( "tracerred" );
tracergreen = gEngfuncs.pfnGetCvarPointer( "tracergreen" );
tracerblue = gEngfuncs.pfnGetCvarPointer( "tracerblue" );
traceralpha = gEngfuncs.pfnGetCvarPointer( "traceralpha" );
gEngfuncs.Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" );
gEngfuncs.Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
@ -839,8 +855,8 @@ static void R_CheckVBO( void )
def = "0";
}
r_vbo = Cvar_Get( "r_vbo", def, flags, "draw world using VBO" );
r_vbo_dlightmode = Cvar_Get( "r_vbo_dlightmode", dlightmode, FCVAR_ARCHIVE, "vbo dlight rendering mode(0-1)" );
r_vbo = gEngfuncs.Cvar_Get( "r_vbo", def, flags, "draw world using VBO" );
r_vbo_dlightmode = gEngfuncs.Cvar_Get( "r_vbo_dlightmode", dlightmode, FCVAR_ARCHIVE, "vbo dlight rendering mode(0-1)" );
// check if enabled manually
if( CVAR_TO_BOOL(r_vbo) )

View File

@ -152,13 +152,14 @@ void R_PushDlights( void )
int i;
tr.dlightframecount = tr.framecount;
l = cl_dlights;
RI.currententity = gEngfuncs.GetEntityByIndex( 0 );
RI.currentmodel = RI.currententity->model;
for( i = 0; i < MAX_DLIGHTS; i++, l++ )
{
l = gEngfuncs.GetDynamicLight( i );
if( l->die < gpGlobals->time || !l->radius )
continue;
@ -179,8 +180,10 @@ int R_CountDlights( void )
dlight_t *l;
int i, numDlights = 0;
for( i = 0, l = cl_dlights; i < MAX_DLIGHTS; i++, l++ )
for( i = 0; i < MAX_DLIGHTS; i++ )
{
l = gEngfuncs.GetDynamicLight( i );
if( l->die < gpGlobals->time || !l->radius )
continue;
@ -347,9 +350,9 @@ static qboolean R_RecursiveLightPoint( model_t *model, mnode_t *node, float p1f,
}
else
{
cv->r += LightToTexGamma( lm->r ) * scale;
cv->g += LightToTexGamma( lm->g ) * scale;
cv->b += LightToTexGamma( lm->b ) * scale;
cv->r += gEngfuncs.LightToTexGamma( lm->r ) * scale;
cv->g += gEngfuncs.LightToTexGamma( lm->g ) * scale;
cv->b += gEngfuncs.LightToTexGamma( lm->b ) * scale;
}
lm += size; // skip to next lightmap

View File

@ -852,7 +852,7 @@ void R_DrawEntitiesOnList( void )
if( !RI.onlyClientDraw )
{
CL_DrawEFX( tr.frametime, false );
gEngfuncs.CL_DrawEFX( tr.frametime, false );
}
GL_CheckForErrors();
@ -910,7 +910,7 @@ void R_DrawEntitiesOnList( void )
if( !RI.onlyClientDraw )
{
R_AllowFog( false );
CL_DrawEFX( tr.frametime, true );
gEngfuncs.CL_DrawEFX( tr.frametime, true );
R_AllowFog( true );
}
@ -920,7 +920,7 @@ void R_DrawEntitiesOnList( void )
if( !RI.onlyClientDraw )
R_DrawViewModel();
CL_ExtraUpdate();
gEngfuncs.CL_ExtraUpdate();
GL_CheckForErrors();
}
@ -959,7 +959,7 @@ void R_RenderScene( void )
R_DrawWorld();
R_CheckFog();
CL_ExtraUpdate (); // don't let sound get messed up if going slow
gEngfuncs.CL_ExtraUpdate (); // don't let sound get messed up if going slow
R_DrawEntitiesOnList();
@ -1048,7 +1048,7 @@ void R_BeginFrame( qboolean clearScene )
// swapinterval stuff
GL_UpdateSwapInterval();
CL_ExtraUpdate ();
gEngfuncs.CL_ExtraUpdate ();
}
/*

View File

@ -147,7 +147,7 @@ void R_NewMap( void )
sf->fadeReset += gpGlobals->time;
sf->fadeEnd += sf->fadeReset;
Cvar_SetValue( "v_dark", 0.0f );
gEngfuncs.Cvar_SetValue( "v_dark", 0.0f );
}
// clear out efrags in case the level hasn't been reloaded

View File

@ -278,7 +278,7 @@ void CL_DrawParticlesExternal( const ref_viewpass_t *rvp, qboolean trans_pass, f
memcpy( RI.visbytes, tr.visbytes, gpGlobals->visbytes );
tr.frametime = frametime;
CL_DrawEFX( frametime, trans_pass );
gEngfuncs.CL_DrawEFX( frametime, trans_pass );
// restore internal state
memcpy( &RI, &oldRI, sizeof( ref_instance_t ));

View File

@ -537,7 +537,7 @@ void R_AddDynamicLights( msurface_t *surf )
if( !FBitSet( surf->dlightbits, BIT( lnum )))
continue; // not lit by this light
dl = &cl_dlights[lnum];
dl = gEngfuncs.GetDynamicLight( lnum );
// transform light origin to local bmodel space
if( !tr.modelviewIdentity )
@ -581,9 +581,9 @@ void R_AddDynamicLights( msurface_t *surf )
if( dist < minlight )
{
bl[0] += ((int)((rad - dist) * 256) * LightToTexGamma( dl->color.r )) / 256;
bl[1] += ((int)((rad - dist) * 256) * LightToTexGamma( dl->color.g )) / 256;
bl[2] += ((int)((rad - dist) * 256) * LightToTexGamma( dl->color.b )) / 256;
bl[0] += ((int)((rad - dist) * 256) * gEngfuncs.LightToTexGamma( dl->color.r )) / 256;
bl[1] += ((int)((rad - dist) * 256) * gEngfuncs.LightToTexGamma( dl->color.g )) / 256;
bl[2] += ((int)((rad - dist) * 256) * gEngfuncs.LightToTexGamma( dl->color.b )) / 256;
}
}
}
@ -740,9 +740,9 @@ static void R_BuildLightMap( msurface_t *surf, byte *dest, int stride, qboolean
for( i = 0, bl = r_blocklights; i < size; i++, bl += 3, lm++ )
{
bl[0] += LightToTexGamma( lm->r ) * scale;
bl[1] += LightToTexGamma( lm->g ) * scale;
bl[2] += LightToTexGamma( lm->b ) * scale;
bl[0] += gEngfuncs.LightToTexGamma( lm->r ) * scale;
bl[1] += gEngfuncs.LightToTexGamma( lm->g ) * scale;
bl[2] += gEngfuncs.LightToTexGamma( lm->b ) * scale;
}
}
@ -1567,8 +1567,10 @@ void R_DrawBrushModel( cl_entity_t *e )
else VectorSubtract( RI.cullorigin, e->origin, tr.modelorg );
// calculate dynamic lighting for bmodel
for( k = 0, l = cl_dlights; k < MAX_DLIGHTS; k++, l++ )
for( k = 0; k < MAX_DLIGHTS; k++ )
{
l = gEngfuncs.GetDynamicLight( k );
if( l->die < gpGlobals->time || !l->radius )
continue;
@ -3322,15 +3324,15 @@ void R_DrawWorld( void )
R_ClearSkyBox ();
start = Sys_DoubleTime();
start = gEngfuncs.pfnTime();
if( RI.drawOrtho )
R_DrawWorldTopView( WORLDMODEL->nodes, RI.frustum.clipFlags );
else R_RecursiveWorldNode( WORLDMODEL->nodes, RI.frustum.clipFlags );
end = Sys_DoubleTime();
end = gEngfuncs.pfnTime();
r_stats.t_world_node = end - start;
start = Sys_DoubleTime();
start = gEngfuncs.pfnTime();
R_DrawVBO( !CVAR_TO_BOOL(r_fullbright) && !!WORLDMODEL->lightdata, true );
R_DrawTextureChains();
@ -3347,7 +3349,7 @@ void R_DrawWorld( void )
R_DrawSkyBox();
}
end = Sys_DoubleTime();
end = gEngfuncs.pfnTime();
r_stats.t_world_draw = end - start;
tr.num_draw_decals = 0;
@ -3557,7 +3559,7 @@ void GL_BuildLightmaps( void )
memset( &RI, 0, sizeof( RI ));
// update the lightmap blocksize
if( FBitSet( host.features, ENGINE_LARGE_LIGHTMAPS ))
if( FBitSet( gEngfuncs.CL_GetRenderParm( PARM_FEATURES, 0 ), ENGINE_LARGE_LIGHTMAPS ))
tr.block_size = BLOCK_SIZE_MAX;
else tr.block_size = BLOCK_SIZE_DEFAULT;
@ -3625,15 +3627,15 @@ void GL_InitRandomTable( void )
int tu, tv;
// make random predictable
COM_SetRandomSeed( 255 );
gEngfuncs.COM_SetRandomSeed( 255 );
for( tu = 0; tu < MOD_FRAMES; tu++ )
{
for( tv = 0; tv < MOD_FRAMES; tv++ )
{
rtable[tu][tv] = COM_RandomLong( 0, 0x7FFF );
rtable[tu][tv] = gEngfuncs.COM_RandomLong( 0, 0x7FFF );
}
}
COM_SetRandomSeed( 0 );
gEngfuncs.COM_SetRandomSeed( 0 );
}

View File

@ -41,8 +41,8 @@ R_SpriteInit
*/
void R_SpriteInit( void )
{
r_sprite_lerping = Cvar_Get( "r_sprite_lerping", "1", FCVAR_ARCHIVE, "enables sprite animation lerping" );
r_sprite_lighting = Cvar_Get( "r_sprite_lighting", "1", FCVAR_ARCHIVE, "enables sprite lighting (blood etc)" );
r_sprite_lerping = gEngfuncs.Cvar_Get( "r_sprite_lerping", "1", FCVAR_ARCHIVE, "enables sprite animation lerping" );
r_sprite_lighting = gEngfuncs.Cvar_Get( "r_sprite_lighting", "1", FCVAR_ARCHIVE, "enables sprite lighting (blood etc)" );
}
/*
@ -162,9 +162,9 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
{
rgbdata_t *pal;
pal = FS_LoadImage( "#id.pal", (byte *)&i, 768 );
pal = gEngfuncs.FS_LoadImage( "#id.pal", (byte *)&i, 768 );
pframetype = (dframetype_t *)(buffer + sizeof( dsprite_q1_t )); // pinq1 + 1
FS_FreeImage( pal ); // palette installed, no reason to keep this data
gEngfuncs.FS_FreeImage( pal ); // palette installed, no reason to keep this data
}
else if( *numi == 256 )
{
@ -175,18 +175,18 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
switch( psprite->texFormat )
{
case SPR_INDEXALPHA:
pal = FS_LoadImage( "#gradient.pal", src, 768 );
pal = gEngfuncs.FS_LoadImage( "#gradient.pal", src, 768 );
break;
case SPR_ALPHTEST:
pal = FS_LoadImage( "#masked.pal", src, 768 );
pal = gEngfuncs.FS_LoadImage( "#masked.pal", src, 768 );
break;
default:
pal = FS_LoadImage( "#normal.pal", src, 768 );
pal = gEngfuncs.FS_LoadImage( "#normal.pal", src, 768 );
break;
}
pframetype = (dframetype_t *)(src + 768);
FS_FreeImage( pal ); // palette installed, no reason to keep this data
gEngfuncs.FS_FreeImage( pal ); // palette installed, no reason to keep this data
}
else
{
@ -245,7 +245,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
if( loaded ) *loaded = false;
Q_snprintf( texname, sizeof( texname ), "#%s", mod->name );
Image_SetForceFlags( IL_OVERVIEW );
pix = FS_LoadImage( texname, buffer, size );
pix = gEngfuncs.FS_LoadImage( texname, buffer, size );
Image_ClearForceFlags();
if( !pix ) return; // bad image or something else
@ -264,7 +264,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
if( h < MAPSPRITE_SIZE ) h = MAPSPRITE_SIZE;
// resample image if needed
Image_Process( &pix, w, h, IMAGE_FORCE_RGBA|IMAGE_RESAMPLE, 0.0f );
gEngfuncs.Image_Process( &pix, w, h, IMAGE_FORCE_RGBA|IMAGE_RESAMPLE, 0.0f );
w = h = MAPSPRITE_SIZE;
@ -338,7 +338,7 @@ void Mod_LoadMapSprite( model_t *mod, const void *buffer, size_t size, qboolean
}
}
FS_FreeImage( pix );
gEngfuncs.FS_FreeImage( pix );
Mem_Free( temp.buffer );
if( loaded ) *loaded = true;

View File

@ -139,9 +139,9 @@ R_StudioInit
*/
void R_StudioInit( void )
{
cl_himodels = Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
r_studio_sort_textures = Cvar_Get( "r_studio_sort_textures", "0", FCVAR_ARCHIVE, "change draw order for additive meshes" );
r_drawviewmodel = Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" );
cl_himodels = gEngfuncs.Cvar_Get( "cl_himodels", "1", FCVAR_ARCHIVE, "draw high-resolution player models in multiplayer" );
r_studio_sort_textures = gEngfuncs.Cvar_Get( "r_studio_sort_textures", "0", FCVAR_ARCHIVE, "change draw order for additive meshes" );
r_drawviewmodel = gEngfuncs.Cvar_Get( "r_drawviewmodel", "1", 0, "draw firstperson weapon model" );
Matrix3x4_LoadIdentity( g_studio.rotationmatrix );
Cvar_RegisterVariable( &r_glowshellfreq );
@ -172,8 +172,8 @@ static void R_StudioSetupTimings( void )
else
{
// menu stuff
g_studio.time = host.realtime;
g_studio.frametime = host.frametime;
g_studio.time = gpGlobals->realtime;
g_studio.frametime = gpGlobals->frametime;
}
}
@ -600,12 +600,12 @@ void R_StudioSetUpTransform( cl_entity_t *e )
VectorCopy( e->angles, angles );
// interpolate monsters position (moved into UpdateEntityFields by user request)
if( e->curstate.movetype == MOVETYPE_STEP && !FBitSet( host.features, ENGINE_COMPUTE_STUDIO_LERP ))
if( e->curstate.movetype == MOVETYPE_STEP && !FBitSet( gEngfuncs.CL_GetRenderParm( PARM_FEATURES, 0 ), ENGINE_COMPUTE_STUDIO_LERP ))
{
R_StudioLerpMovement( e, g_studio.time, origin, angles );
}
if( !FBitSet( host.features, ENGINE_COMPENSATE_QUAKE_BUG ))
if( !FBitSet( gEngfuncs.CL_GetRenderParm( PARM_FEATURES, 0 ), ENGINE_COMPENSATE_QUAKE_BUG ))
angles[PITCH] = -angles[PITCH]; // stupid quake bug
// don't rotate clients, only aim
@ -718,21 +718,21 @@ void R_StudioFxTransform( cl_entity_t *ent, matrix3x4 transform )
{
case kRenderFxDistort:
case kRenderFxHologram:
if( !COM_RandomLong( 0, 49 ))
if( !gEngfuncs.COM_RandomLong( 0, 49 ))
{
int axis = COM_RandomLong( 0, 1 );
int axis = gEngfuncs.COM_RandomLong( 0, 1 );
if( axis == 1 ) axis = 2; // choose between x & z
VectorScale( transform[axis], COM_RandomFloat( 1.0f, 1.484f ), transform[axis] );
VectorScale( transform[axis], gEngfuncs.COM_RandomFloat( 1.0f, 1.484f ), transform[axis] );
}
else if( !COM_RandomLong( 0, 49 ))
else if( !gEngfuncs.COM_RandomLong( 0, 49 ))
{
float offset;
int axis = COM_RandomLong( 0, 1 );
int axis = gEngfuncs.COM_RandomLong( 0, 1 );
if( axis == 1 ) axis = 2; // choose between x & z
offset = COM_RandomFloat( -10.0f, 10.0f );
transform[COM_RandomLong( 0, 2 )][3] += offset;
offset = gEngfuncs.COM_RandomFloat( -10.0f, 10.0f );
transform[gEngfuncs.COM_RandomLong( 0, 2 )][3] += offset;
}
break;
case kRenderFxExplode:
@ -1400,7 +1400,7 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
msurface_t *psurf = NULL;
pmtrace_t trace;
if( FBitSet( host.features, ENGINE_WRITE_LARGE_COORD ))
if( FBitSet( gEngfuncs.CL_GetRenderParm( PARM_FEATURES, 0 ), ENGINE_WRITE_LARGE_COORD ))
{
vecEnd[0] = origin[0] - mv->skyvec_x * 65536.0f;
vecEnd[1] = origin[1] - mv->skyvec_y * 65536.0f;
@ -1421,9 +1421,9 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
{
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
light.r = LightToTexGamma( bound( 0, mv->skycolor_r, 255 ));
light.g = LightToTexGamma( bound( 0, mv->skycolor_g, 255 ));
light.b = LightToTexGamma( bound( 0, mv->skycolor_b, 255 ));
light.r = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_r, 255 ));
light.g = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_g, 255 ));
light.b = gEngfuncs.LightToTexGamma( bound( 0, mv->skycolor_b, 255 ));
}
}
@ -1484,8 +1484,10 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
// scale lightdir by light intentsity
VectorScale( lightDir, total, lightDir );
for( lnum = 0, dl = cl_dlights; lnum < MAX_DLIGHTS; lnum++, dl++ )
for( lnum = 0; lnum < MAX_DLIGHTS; lnum++ )
{
dl = gEngfuncs.GetDynamicLight( lnum );
if( dl->die < g_studio.time || !r_dynamic->value )
continue;
@ -1504,9 +1506,9 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
VectorAdd( lightDir, dist, lightDir );
finalLight[0] += LightToTexGamma( dl->color.r ) * ( add / 256.0f ) * 2.0f;
finalLight[1] += LightToTexGamma( dl->color.g ) * ( add / 256.0f ) * 2.0f;
finalLight[2] += LightToTexGamma( dl->color.b ) * ( add / 256.0f ) * 2.0f;
finalLight[0] += gEngfuncs.LightToTexGamma( dl->color.r ) * ( add / 256.0f ) * 2.0f;
finalLight[1] += gEngfuncs.LightToTexGamma( dl->color.g ) * ( add / 256.0f ) * 2.0f;
finalLight[2] += gEngfuncs.LightToTexGamma( dl->color.b ) * ( add / 256.0f ) * 2.0f;
}
}
@ -1565,8 +1567,10 @@ void R_StudioEntityLight( alight_t *lightinfo )
dist2 = 1000000.0f;
k = 0;
for( lnum = 0, el = cl_elights; lnum < MAX_ELIGHTS; lnum++, el++ )
for( lnum = 0; lnum < MAX_ELIGHTS; lnum++ )
{
el = gEngfuncs.GetEntityLight( lnum );
if( el->die < g_studio.time || el->radius <= 0.0f )
continue;
@ -1604,9 +1608,9 @@ void R_StudioEntityLight( alight_t *lightinfo )
if( k != -1 )
{
g_studio.locallightcolor[k].r = LightToTexGamma( el->color.r );
g_studio.locallightcolor[k].g = LightToTexGamma( el->color.g );
g_studio.locallightcolor[k].b = LightToTexGamma( el->color.b );
g_studio.locallightcolor[k].r = gEngfuncs.LightToTexGamma( el->color.r );
g_studio.locallightcolor[k].g = gEngfuncs.LightToTexGamma( el->color.g );
g_studio.locallightcolor[k].b = gEngfuncs.LightToTexGamma( el->color.b );
g_studio.locallightR2[k] = r2;
g_studio.locallight[k] = el;
lstrength[k] = minstrength;
@ -3401,7 +3405,7 @@ void R_GatherPlayerLight( void )
tr.ignore_lightgamma = true;
c = R_LightPoint( view->origin );
tr.ignore_lightgamma = false;
cl.local.light_level = (c.r + c.g + c.b) / 3;
gEngfuncs.SetLocalLightLevel( ( c.r + c.g + c.b ) / 3 );
}
/*
@ -3543,7 +3547,7 @@ static void R_StudioLoadTexture( model_t *mod, studiohdr_t *phdr, mstudiotexture
Image_SetMDLPointer((byte *)phdr + ptexture->index);
size = sizeof( mstudiotexture_t ) + ptexture->width * ptexture->height + 768;
if( FBitSet( host.features, ENGINE_LOAD_DELUXEDATA ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
if( FBitSet( gEngfuncs.CL_GetRenderParm( PARM_FEATURES, 0 ), ENGINE_LOAD_DELUXEDATA ) && FBitSet( ptexture->flags, STUDIO_NF_MASKED ))
flags |= TF_KEEP_SOURCE; // Paranoia2 texture alpha-tracing
// build the texname
@ -3613,13 +3617,18 @@ static model_t *pfnModelHandle( int modelindex )
return gEngfuncs.pfnGetModelByIndex( modelindex );
}
static void *pfnMod_StudioExtradata( mode_t *mod )
{
return gEngfuncs.Mod_Extradata( mod_studio, mod );
}
static engine_studio_api_t gStudioAPI =
{
Mod_Calloc,
Mod_CacheCheck,
Mod_LoadCacheFile,
pfnMod_ForName,
Mod_StudioExtradata,
pfnMod_StudioExtradata,
pfnModelHandle,
pfnGetCurrentEntity,
pfnPlayerInfo,
@ -3685,7 +3694,7 @@ void CL_InitStudioAPI( void )
cl_righthand = Cvar_FindVar( "cl_righthand" );
if( cl_righthand == NULL )
cl_righthand = Cvar_Get( "cl_righthand", "0", FCVAR_ARCHIVE, "flip viewmodel (left to right)" );
cl_righthand = gEngfuncs.Cvar_Get( "cl_righthand", "0", FCVAR_ARCHIVE, "flip viewmodel (left to right)" );
// Xash will be used internal StudioModelRenderer
if( !clgame.dllFuncs.pfnGetStudioModelInterface )

View File

@ -668,19 +668,19 @@ void R_InitSkyClouds( mip_t *mt, texture_t *tx, qboolean custom_palette )
int size = (int)sizeof( mip_t ) + ((mt->width * mt->height * 85)>>6);
if( custom_palette ) size += sizeof( short ) + 768;
r_sky = FS_LoadImage( texname, (byte *)mt, size );
r_sky = gEngfuncs.FS_LoadImage( texname, (byte *)mt, size );
}
else
{
// okay, loading it from wad
r_sky = FS_LoadImage( texname, NULL, 0 );
r_sky = gEngfuncs.FS_LoadImage( texname, NULL, 0 );
}
// make sure what sky image is valid
if( !r_sky || !r_sky->palette || r_sky->type != PF_INDEXED_32 || r_sky->height == 0 )
{
gEngfuncs.Con_Reportf( S_ERROR "R_InitSky: unable to load sky texture %s\n", tx->name );
if( r_sky ) FS_FreeImage( r_sky );
if( r_sky ) gEngfuncs.FS_FreeImage( r_sky );
return;
}
@ -744,7 +744,7 @@ void R_InitSkyClouds( mip_t *mt, texture_t *tx, qboolean custom_palette )
tr.alphaskyTexture = GL_LoadTextureInternal( "alpha_sky", &r_temp, TF_NOMIPMAP );
// clean up
FS_FreeImage( r_sky );
gEngfuncs.FS_FreeImage( r_sky );
Mem_Free( trans );
}

View File

@ -30,10 +30,12 @@ def build(bld):
name = get_subproject_name(bld)
bld.env = bld.all_envs[name]
libs = []
libs = [ 'M' ]
source = bld.path.ant_glob(['*.c'])
source += [ '../engine/common/mathlib.c', '../engine/common/crtlib.c', '../engine/common/matrixlib.c' ]
includes = ['.',
'../engine',
'../engine/common',