mirror of
https://github.com/w23/xash3d-fwgs
synced 2025-01-18 23:00:01 +01:00
ref: now it compiles, not linking yet. ref_api header moved to engine/ to clarify, that it's sort of engine internals
This commit is contained in:
parent
437ba6d7a2
commit
e7234bada2
@ -19,7 +19,6 @@ PARTICLES MANAGEMENT
|
|||||||
static int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
|
static int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
|
||||||
static int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
|
static int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
|
||||||
static int ramp3[6] = { 0x6d, 0x6b, 6, 5, 4, 3 };
|
static int ramp3[6] = { 0x6d, 0x6b, 6, 5, 4, 3 };
|
||||||
static float gTracerSize[11] = { 1.5f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
|
|
||||||
static int gSparkRamp[9] = { 0xfe, 0xfd, 0xfc, 0x6f, 0x6e, 0x6d, 0x6c, 0x67, 0x60 };
|
static int gSparkRamp[9] = { 0xfe, 0xfd, 0xfc, 0x6f, 0x6e, 0x6d, 0x6c, 0x67, 0x60 };
|
||||||
|
|
||||||
static color24 gTracerColors[] =
|
static color24 gTracerColors[] =
|
||||||
@ -2097,7 +2096,6 @@ void CL_FreeDeadBeams()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CL_DrawEFX( float time, qboolean fTrans )
|
void CL_DrawEFX( float time, qboolean fTrans )
|
||||||
{
|
{
|
||||||
CL_FreeDeadBeams();
|
CL_FreeDeadBeams();
|
||||||
@ -2112,3 +2110,87 @@ void CL_DrawEFX( float time, qboolean fTrans )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CL_ThinkParticle( double frametime, particle_t *p )
|
||||||
|
{
|
||||||
|
float time3 = 15.0f * frametime;
|
||||||
|
float time2 = 10.0f * frametime;
|
||||||
|
float time1 = 5.0f * frametime;
|
||||||
|
float dvel = 4.0f * frametime;
|
||||||
|
float grav = frametime * clgame.movevars.gravity * 0.05f;
|
||||||
|
|
||||||
|
|
||||||
|
if( p->type != pt_clientcustom )
|
||||||
|
{
|
||||||
|
// update position.
|
||||||
|
VectorMA( p->org, frametime, p->vel, p->org );
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( p->type )
|
||||||
|
{
|
||||||
|
case pt_static:
|
||||||
|
break;
|
||||||
|
case pt_fire:
|
||||||
|
p->ramp += time1;
|
||||||
|
if( p->ramp >= 6.0f ) p->die = -1.0f;
|
||||||
|
else p->color = ramp3[(int)p->ramp];
|
||||||
|
p->vel[2] += grav;
|
||||||
|
break;
|
||||||
|
case pt_explode:
|
||||||
|
p->ramp += time2;
|
||||||
|
if( p->ramp >= 8.0f ) p->die = -1.0f;
|
||||||
|
else p->color = ramp1[(int)p->ramp];
|
||||||
|
VectorMA( p->vel, dvel, p->vel, p->vel );
|
||||||
|
p->vel[2] -= grav;
|
||||||
|
break;
|
||||||
|
case pt_explode2:
|
||||||
|
p->ramp += time3;
|
||||||
|
if( p->ramp >= 8.0f ) p->die = -1.0f;
|
||||||
|
else p->color = ramp2[(int)p->ramp];
|
||||||
|
VectorMA( p->vel,-frametime, p->vel, p->vel );
|
||||||
|
p->vel[2] -= grav;
|
||||||
|
break;
|
||||||
|
case pt_blob:
|
||||||
|
if( p->packedColor == 255 )
|
||||||
|
{
|
||||||
|
// normal blob explosion
|
||||||
|
VectorMA( p->vel, dvel, p->vel, p->vel );
|
||||||
|
p->vel[2] -= grav;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case pt_blob2:
|
||||||
|
if( p->packedColor == 255 )
|
||||||
|
{
|
||||||
|
// normal blob explosion
|
||||||
|
p->vel[0] -= p->vel[0] * dvel;
|
||||||
|
p->vel[1] -= p->vel[1] * dvel;
|
||||||
|
p->vel[2] -= grav;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->ramp += time2;
|
||||||
|
if( p->ramp >= 9.0f ) p->ramp = 0.0f;
|
||||||
|
p->color = gSparkRamp[(int)p->ramp];
|
||||||
|
VectorMA( p->vel, -frametime * 0.5f, p->vel, p->vel );
|
||||||
|
p->type = COM_RandomLong( 0, 3 ) ? pt_blob : pt_blob2;
|
||||||
|
p->vel[2] -= grav * 5.0f;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case pt_grav:
|
||||||
|
p->vel[2] -= grav * 20.0f;
|
||||||
|
break;
|
||||||
|
case pt_slowgrav:
|
||||||
|
p->vel[2] -= grav;
|
||||||
|
break;
|
||||||
|
case pt_vox_grav:
|
||||||
|
p->vel[2] -= grav * 8.0f;
|
||||||
|
break;
|
||||||
|
case pt_vox_slowgrav:
|
||||||
|
p->vel[2] -= grav * 4.0f;
|
||||||
|
break;
|
||||||
|
case pt_clientcustom:
|
||||||
|
if( p->callback )
|
||||||
|
p->callback( p, frametime );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -2930,7 +2930,7 @@ void CL_Init( void )
|
|||||||
|
|
||||||
CL_InitLocal();
|
CL_InitLocal();
|
||||||
|
|
||||||
R_Init(); // init renderer
|
VID_Init(); // init video
|
||||||
S_Init(); // init sound
|
S_Init(); // init sound
|
||||||
|
|
||||||
// unreliable buffer. unsed for unreliable commands and voice stream
|
// unreliable buffer. unsed for unreliable commands and voice stream
|
||||||
|
@ -1020,8 +1020,8 @@ void CL_ParseClientData( sizebuf_t *msg )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cl.parsecount = i; // ack'd incoming messages.
|
refState.parsecount = cl.parsecount = i; // ack'd incoming messages.
|
||||||
cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
|
refState.parsecountmod = cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
|
||||||
frame = &cl.frames[cl.parsecountmod]; // frame at index.
|
frame = &cl.frames[cl.parsecountmod]; // frame at index.
|
||||||
|
|
||||||
frame->time = cl.mtime[0]; // mark network received time
|
frame->time = cl.mtime[0]; // mark network received time
|
||||||
|
@ -349,8 +349,8 @@ static void CL_ParseQuakeClientData( sizebuf_t *msg )
|
|||||||
// this is the frame update that this message corresponds to
|
// this is the frame update that this message corresponds to
|
||||||
i = cls.netchan.incoming_sequence;
|
i = cls.netchan.incoming_sequence;
|
||||||
|
|
||||||
cl.parsecount = i; // ack'd incoming messages.
|
refState.parsecount = cl.parsecount = i; // ack'd incoming messages.
|
||||||
cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
|
refState.parsecountmod = cl.parsecountmod = cl.parsecount & CL_UPDATE_MASK; // index into window.
|
||||||
frame = &cl.frames[cl.parsecountmod]; // frame at index.
|
frame = &cl.frames[cl.parsecountmod]; // frame at index.
|
||||||
frame->time = cl.mtime[0]; // mark network received time
|
frame->time = cl.mtime[0]; // mark network received time
|
||||||
frame->receivedtime = host.realtime; // time now that we are parsing.
|
frame->receivedtime = host.realtime; // time now that we are parsing.
|
||||||
|
@ -82,6 +82,45 @@ static uint pfnFileBufferCRC32( const void *buffer, const int length )
|
|||||||
return CRC32_Final( modelCRC );
|
return CRC32_Final( modelCRC );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
R_EnvShot
|
||||||
|
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
static void R_EnvShot( const float *vieworg, const char *name, qboolean skyshot, int shotsize )
|
||||||
|
{
|
||||||
|
static vec3_t viewPoint;
|
||||||
|
|
||||||
|
if( !COM_CheckString( name ))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( cls.scrshot_action != scrshot_inactive )
|
||||||
|
{
|
||||||
|
if( cls.scrshot_action != scrshot_skyshot && cls.scrshot_action != scrshot_envshot )
|
||||||
|
Con_Printf( S_ERROR "R_%sShot: subsystem is busy, try for next frame.\n", skyshot ? "Sky" : "Env" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cls.envshot_vieworg = NULL; // use client view
|
||||||
|
Q_strncpy( cls.shotname, name, sizeof( cls.shotname ));
|
||||||
|
|
||||||
|
if( vieworg )
|
||||||
|
{
|
||||||
|
// make sure what viewpoint don't temporare
|
||||||
|
VectorCopy( vieworg, viewPoint );
|
||||||
|
cls.envshot_vieworg = viewPoint;
|
||||||
|
cls.envshot_disable_vis = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// make request for envshot
|
||||||
|
if( skyshot ) cls.scrshot_action = scrshot_skyshot;
|
||||||
|
else cls.scrshot_action = scrshot_envshot;
|
||||||
|
|
||||||
|
// catch negative values
|
||||||
|
cls.envshot_viewsize = max( 0, shotsize );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
CL_GenericHandle
|
CL_GenericHandle
|
||||||
@ -143,7 +182,7 @@ static render_api_t gRenderAPI =
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
NULL, // CL_DrawParticlesExternal,
|
NULL, // CL_DrawParticlesExternal,
|
||||||
NULL, // R_EnvShot,
|
R_EnvShot,
|
||||||
pfnSPR_LoadExt,
|
pfnSPR_LoadExt,
|
||||||
NULL, // R_LightVec,
|
NULL, // R_LightVec,
|
||||||
NULL, // R_StudioGetTexture,
|
NULL, // R_StudioGetTexture,
|
||||||
|
@ -226,6 +226,37 @@ void SCR_MakeLevelShot( void )
|
|||||||
Cbuf_AddText( "levelshot\n" );
|
Cbuf_AddText( "levelshot\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
VID_WriteOverviewScript
|
||||||
|
|
||||||
|
Create overview script file
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
void VID_WriteOverviewScript( void )
|
||||||
|
{
|
||||||
|
ref_overview_t *ov = &clgame.overView;
|
||||||
|
string filename;
|
||||||
|
file_t *f;
|
||||||
|
|
||||||
|
Q_snprintf( filename, sizeof( filename ), "overviews/%s.txt", clgame.mapname );
|
||||||
|
|
||||||
|
f = FS_Open( filename, "w", false );
|
||||||
|
if( !f ) return;
|
||||||
|
|
||||||
|
FS_Printf( f, "// overview description file for %s.bsp\n\n", clgame.mapname );
|
||||||
|
FS_Print( f, "global\n{\n" );
|
||||||
|
FS_Printf( f, "\tZOOM\t%.2f\n", ov->flZoom );
|
||||||
|
FS_Printf( f, "\tORIGIN\t%.2f\t%.2f\t%.2f\n", ov->origin[0], ov->origin[1], ov->origin[2] );
|
||||||
|
FS_Printf( f, "\tROTATED\t%i\n", ov->rotated ? 1 : 0 );
|
||||||
|
FS_Print( f, "}\n\nlayer\n{\n" );
|
||||||
|
FS_Printf( f, "\tIMAGE\t\"overviews/%s.bmp\"\n", clgame.mapname );
|
||||||
|
FS_Printf( f, "\tHEIGHT\t%.2f\n", ov->zFar ); // ???
|
||||||
|
FS_Print( f, "}\n" );
|
||||||
|
|
||||||
|
FS_Close( f );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
SCR_MakeScreenShot
|
SCR_MakeScreenShot
|
||||||
@ -264,6 +295,8 @@ void SCR_MakeScreenShot( void )
|
|||||||
break;
|
break;
|
||||||
case scrshot_mapshot:
|
case scrshot_mapshot:
|
||||||
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_MAPSHOT );
|
iRet = ref.dllFuncs.VID_ScreenShot( cls.shotname, VID_MAPSHOT );
|
||||||
|
if( iRet )
|
||||||
|
VID_WriteOverviewScript(); // store overview script too
|
||||||
break;
|
break;
|
||||||
case scrshot_inactive:
|
case scrshot_inactive:
|
||||||
return;
|
return;
|
||||||
|
@ -425,7 +425,7 @@ typedef struct
|
|||||||
float applied_angle;
|
float applied_angle;
|
||||||
} screen_shake_t;
|
} screen_shake_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct remap_info_s
|
||||||
{
|
{
|
||||||
unsigned short textures[MAX_SKINS];// alias textures
|
unsigned short textures[MAX_SKINS];// alias textures
|
||||||
struct mstudiotex_s *ptexture; // array of textures with local copy of remapped textures
|
struct mstudiotex_s *ptexture; // array of textures with local copy of remapped textures
|
||||||
@ -731,7 +731,6 @@ void CL_SaveShot_f( void );
|
|||||||
void CL_LevelShot_f( void );
|
void CL_LevelShot_f( void );
|
||||||
void CL_SetSky_f( void );
|
void CL_SetSky_f( void );
|
||||||
void SCR_Viewpos_f( void );
|
void SCR_Viewpos_f( void );
|
||||||
void SCR_TimeRefresh_f( void );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// cl_custom.c
|
// cl_custom.c
|
||||||
@ -963,7 +962,6 @@ void CL_EmitEntities( void );
|
|||||||
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
|
remap_info_t *CL_GetRemapInfoForEntity( cl_entity_t *e );
|
||||||
void CL_AllocRemapInfo( int topcolor, int bottomcolor );
|
void CL_AllocRemapInfo( int topcolor, int bottomcolor );
|
||||||
void CL_FreeRemapInfo( remap_info_t *info );
|
void CL_FreeRemapInfo( remap_info_t *info );
|
||||||
void R_StudioSetRemapColors( int top, int bottom );
|
|
||||||
void CL_UpdateRemapInfo( int topcolor, int bottomcolor );
|
void CL_UpdateRemapInfo( int topcolor, int bottomcolor );
|
||||||
void CL_ClearAllRemaps( void );
|
void CL_ClearAllRemaps( void );
|
||||||
|
|
||||||
|
@ -184,11 +184,22 @@ static qboolean R_LoadProgs( const char *name )
|
|||||||
|
|
||||||
void R_Shutdown( void )
|
void R_Shutdown( void )
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
|
model_t *mod;
|
||||||
|
|
||||||
|
// release SpriteTextures
|
||||||
|
for( i = 1, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ )
|
||||||
|
{
|
||||||
|
if( !mod->name[0] ) continue;
|
||||||
|
Mod_UnloadSpriteModel( mod );
|
||||||
|
}
|
||||||
|
memset( clgame.sprites, 0, sizeof( clgame.sprites ));
|
||||||
|
|
||||||
R_UnloadProgs();
|
R_UnloadProgs();
|
||||||
ref.initialized = false;
|
ref.initialized = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_Init( void )
|
qboolean R_Init( void )
|
||||||
{
|
{
|
||||||
char refdll[64];
|
char refdll[64];
|
||||||
|
|
||||||
@ -206,6 +217,10 @@ void R_Init( void )
|
|||||||
{
|
{
|
||||||
R_Shutdown();
|
R_Shutdown();
|
||||||
Host_Error( "Can't initialize %s renderer!\n", refdll );
|
Host_Error( "Can't initialize %s renderer!\n", refdll );
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SCR_Init();
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ void R_GetTextureParms( int *w, int *h, int texnum );
|
|||||||
extern convar_t *r_decals;
|
extern convar_t *r_decals;
|
||||||
extern convar_t *r_adjust_fov;
|
extern convar_t *r_adjust_fov;
|
||||||
|
|
||||||
void R_Init( void );
|
qboolean R_Init( void );
|
||||||
void R_Shutdown( void );
|
void R_Shutdown( void );
|
||||||
|
|
||||||
#endif // REF_COMMON_H
|
#endif // REF_COMMON_H
|
||||||
|
@ -29,9 +29,6 @@ static SDL_Cursor* s_pDefaultCursor[20];
|
|||||||
#endif
|
#endif
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
|
|
||||||
int g_textures[VGUI_MAX_TEXTURES];
|
|
||||||
int g_textureId = 0;
|
|
||||||
int g_iBoundTexture;
|
|
||||||
static enum VGUI_KeyCode s_pVirtualKeyTrans[256];
|
static enum VGUI_KeyCode s_pVirtualKeyTrans[256];
|
||||||
static enum VGUI_DefaultCursor s_currentCursor;
|
static enum VGUI_DefaultCursor s_currentCursor;
|
||||||
static HINSTANCE s_pVGuiSupport; // vgui_support library
|
static HINSTANCE s_pVGuiSupport; // vgui_support library
|
||||||
|
@ -22,8 +22,6 @@ extern "C" {
|
|||||||
|
|
||||||
#include "port.h"
|
#include "port.h"
|
||||||
|
|
||||||
#define VGUI_MAX_TEXTURES 2048 // a half of total textures count
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// vgui_draw.c
|
// vgui_draw.c
|
||||||
//
|
//
|
||||||
|
@ -163,17 +163,6 @@ static void VID_Mode_f( void )
|
|||||||
R_ChangeDisplaySettings( w, h, Cvar_VariableInteger( "fullscreen" ) );
|
R_ChangeDisplaySettings( w, h, Cvar_VariableInteger( "fullscreen" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
GL_RemoveCommands
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
void GL_RemoveCommands( void )
|
|
||||||
{
|
|
||||||
Cmd_RemoveCommand( "r_info");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void SetWidthAndHeightFromCommandLine()
|
static void SetWidthAndHeightFromCommandLine()
|
||||||
{
|
{
|
||||||
int width, height;
|
int width, height;
|
||||||
@ -206,6 +195,27 @@ static void SetFullscreenModeFromCommandLine( )
|
|||||||
|
|
||||||
void VID_Init()
|
void VID_Init()
|
||||||
{
|
{
|
||||||
|
// system screen width and height (don't suppose for change from console at all)
|
||||||
|
Cvar_Get( "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" );
|
||||||
|
Cvar_Get( "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" );
|
||||||
|
|
||||||
|
window_xpos = Cvar_Get( "_window_xpos", "130", FCVAR_RENDERINFO, "window position by horizontal" );
|
||||||
|
window_ypos = Cvar_Get( "_window_ypos", "48", FCVAR_RENDERINFO, "window position by vertical" );
|
||||||
|
|
||||||
|
vid_gamma = Cvar_Get( "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
||||||
|
vid_brightness = Cvar_Get( "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
||||||
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen refresh rate" );
|
vid_displayfrequency = Cvar_Get ( "vid_displayfrequency", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "fullscreen refresh rate" );
|
||||||
vid_fullscreen = Cvar_Get( "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable fullscreen mode" );
|
vid_fullscreen = Cvar_Get( "fullscreen", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable fullscreen mode" );
|
||||||
|
vid_highdpi = Cvar_Get( "vid_highdpi", "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
|
||||||
|
|
||||||
|
// a1ba: planned to be named vid_mode for compability
|
||||||
|
// but supported mode list is filled by backends, so numbers are not portable any more
|
||||||
|
Cmd_AddCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
||||||
|
|
||||||
|
// Set screen resolution and fullscreen mode if passed in on command line.
|
||||||
|
// This is done after executing opengl.cfg, as the command line values should take priority.
|
||||||
|
SetWidthAndHeightFromCommandLine();
|
||||||
|
SetFullscreenModeFromCommandLine();
|
||||||
|
|
||||||
|
R_Init(); // init renderer
|
||||||
}
|
}
|
||||||
|
@ -428,173 +428,9 @@ uint LZSS_Decompress( const byte *pInput, byte *pOutput )
|
|||||||
return totalBytes;
|
return totalBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
============
|
|
||||||
COM_FileBase
|
|
||||||
|
|
||||||
Extracts the base name of a file (no path, no extension, assumes '/' as path separator)
|
|
||||||
============
|
|
||||||
*/
|
|
||||||
void COM_FileBase( const char *in, char *out )
|
|
||||||
{
|
|
||||||
int len, start, end;
|
|
||||||
|
|
||||||
len = Q_strlen( in );
|
|
||||||
if( !len ) return;
|
|
||||||
|
|
||||||
// scan backward for '.'
|
|
||||||
end = len - 1;
|
|
||||||
|
|
||||||
while( end && in[end] != '.' && in[end] != '/' && in[end] != '\\' )
|
|
||||||
end--;
|
|
||||||
|
|
||||||
if( in[end] != '.' )
|
|
||||||
end = len-1; // no '.', copy to end
|
|
||||||
else end--; // found ',', copy to left of '.'
|
|
||||||
|
|
||||||
// scan backward for '/'
|
|
||||||
start = len - 1;
|
|
||||||
|
|
||||||
while( start >= 0 && in[start] != '/' && in[start] != '\\' )
|
|
||||||
start--;
|
|
||||||
|
|
||||||
if( start < 0 || ( in[start] != '/' && in[start] != '\\' ))
|
|
||||||
start = 0;
|
|
||||||
else start++;
|
|
||||||
|
|
||||||
// length of new sting
|
|
||||||
len = end - start + 1;
|
|
||||||
|
|
||||||
// Copy partial string
|
|
||||||
Q_strncpy( out, &in[start], len + 1 );
|
|
||||||
out[len] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
============
|
|
||||||
COM_FileExtension
|
|
||||||
============
|
|
||||||
*/
|
|
||||||
const char *COM_FileExtension( const char *in )
|
|
||||||
{
|
|
||||||
const char *separator, *backslash, *colon, *dot;
|
|
||||||
|
|
||||||
separator = Q_strrchr( in, '/' );
|
|
||||||
backslash = Q_strrchr( in, '\\' );
|
|
||||||
|
|
||||||
if( !separator || separator < backslash )
|
|
||||||
separator = backslash;
|
|
||||||
|
|
||||||
colon = Q_strrchr( in, ':' );
|
|
||||||
|
|
||||||
if( !separator || separator < colon )
|
|
||||||
separator = colon;
|
|
||||||
|
|
||||||
dot = Q_strrchr( in, '.' );
|
|
||||||
|
|
||||||
if( dot == NULL || ( separator && ( dot < separator )))
|
|
||||||
return "";
|
|
||||||
|
|
||||||
return dot + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
============
|
|
||||||
COM_FileWithoutPath
|
|
||||||
============
|
|
||||||
*/
|
|
||||||
const char *COM_FileWithoutPath( const char *in )
|
|
||||||
{
|
|
||||||
const char *separator, *backslash, *colon;
|
|
||||||
|
|
||||||
separator = Q_strrchr( in, '/' );
|
|
||||||
backslash = Q_strrchr( in, '\\' );
|
|
||||||
|
|
||||||
if( !separator || separator < backslash )
|
|
||||||
separator = backslash;
|
|
||||||
|
|
||||||
colon = Q_strrchr( in, ':' );
|
|
||||||
|
|
||||||
if( !separator || separator < colon )
|
|
||||||
separator = colon;
|
|
||||||
|
|
||||||
return separator ? separator + 1 : in;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
============
|
|
||||||
COM_ExtractFilePath
|
|
||||||
============
|
|
||||||
*/
|
|
||||||
void COM_ExtractFilePath( const char *path, char *dest )
|
|
||||||
{
|
|
||||||
const char *src = path + Q_strlen( path ) - 1;
|
|
||||||
|
|
||||||
// back up until a \ or the start
|
|
||||||
while( src != path && !(*(src - 1) == '\\' || *(src - 1) == '/' ))
|
|
||||||
src--;
|
|
||||||
|
|
||||||
if( src != path )
|
|
||||||
{
|
|
||||||
memcpy( dest, path, src - path );
|
|
||||||
dest[src - path - 1] = 0; // cutoff backslash
|
|
||||||
}
|
|
||||||
else Q_strcpy( dest, "" ); // file without path
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
============
|
|
||||||
COM_StripExtension
|
|
||||||
============
|
|
||||||
*/
|
|
||||||
void COM_StripExtension( char *path )
|
|
||||||
{
|
|
||||||
size_t length;
|
|
||||||
|
|
||||||
length = Q_strlen( path ) - 1;
|
|
||||||
while( length > 0 && path[length] != '.' )
|
|
||||||
{
|
|
||||||
length--;
|
|
||||||
if( path[length] == '/' || path[length] == '\\' || path[length] == ':' )
|
|
||||||
return; // no extension
|
|
||||||
}
|
|
||||||
|
|
||||||
if( length ) path[length] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
COM_DefaultExtension
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void COM_DefaultExtension( char *path, const char *extension )
|
|
||||||
{
|
|
||||||
const char *src;
|
|
||||||
|
|
||||||
// if path doesn't have a .EXT, append extension
|
|
||||||
// (extension should include the .)
|
|
||||||
src = path + Q_strlen( path ) - 1;
|
|
||||||
|
|
||||||
while( *src != '/' && src != path )
|
|
||||||
{
|
|
||||||
// it has an extension
|
|
||||||
if( *src == '.' ) return;
|
|
||||||
src--;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_strcat( path, extension );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
COM_ReplaceExtension
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void COM_ReplaceExtension( char *path, const char *extension )
|
|
||||||
{
|
|
||||||
COM_StripExtension( path );
|
|
||||||
COM_DefaultExtension( path, extension );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
|
@ -490,13 +490,7 @@ void FS_AllowDirectPaths( qboolean enable );
|
|||||||
void FS_AddGameDirectory( const char *dir, uint flags );
|
void FS_AddGameDirectory( const char *dir, uint flags );
|
||||||
void FS_AddGameHierarchy( const char *dir, uint flags );
|
void FS_AddGameHierarchy( const char *dir, uint flags );
|
||||||
void FS_LoadGameInfo( const char *rootfolder );
|
void FS_LoadGameInfo( const char *rootfolder );
|
||||||
void COM_FileBase( const char *in, char *out );
|
|
||||||
const char *COM_FileExtension( const char *in );
|
|
||||||
void COM_DefaultExtension( char *path, const char *extension );
|
|
||||||
void COM_ReplaceExtension( char *path, const char *extension );
|
|
||||||
void COM_ExtractFilePath( const char *path, char *dest );
|
|
||||||
const char *FS_GetDiskPath( const char *name, qboolean gamedironly );
|
const char *FS_GetDiskPath( const char *name, qboolean gamedironly );
|
||||||
const char *COM_FileWithoutPath( const char *in );
|
|
||||||
byte *W_LoadLump( wfile_t *wad, const char *lumpname, size_t *lumpsizeptr, const char type );
|
byte *W_LoadLump( wfile_t *wad, const char *lumpname, size_t *lumpsizeptr, const char type );
|
||||||
void W_Close( wfile_t *wad );
|
void W_Close( wfile_t *wad );
|
||||||
byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
byte *FS_LoadFile( const char *path, fs_offset_t *filesizeptr, qboolean gamedironly );
|
||||||
@ -526,7 +520,6 @@ qboolean FS_SysFileExists( const char *path, qboolean casesensitive );
|
|||||||
qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize );
|
qboolean FS_FileCopy( file_t *pOutput, file_t *pInput, int fileSize );
|
||||||
qboolean FS_Delete( const char *path );
|
qboolean FS_Delete( const char *path );
|
||||||
int FS_UnGetc( file_t *file, byte c );
|
int FS_UnGetc( file_t *file, byte c );
|
||||||
void COM_StripExtension( char *path );
|
|
||||||
fs_offset_t FS_Tell( file_t *file );
|
fs_offset_t FS_Tell( file_t *file );
|
||||||
qboolean FS_Eof( file_t *file );
|
qboolean FS_Eof( file_t *file );
|
||||||
int FS_Close( file_t *file );
|
int FS_Close( file_t *file );
|
||||||
@ -920,6 +913,7 @@ byte *LZSS_Compress( byte *pInput, int inputLength, uint *pOutputSize );
|
|||||||
uint LZSS_Decompress( const byte *pInput, byte *pOutput );
|
uint LZSS_Decompress( const byte *pInput, byte *pOutput );
|
||||||
void GL_FreeImage( const char *name );
|
void GL_FreeImage( const char *name );
|
||||||
void VID_InitDefaultResolution( void );
|
void VID_InitDefaultResolution( void );
|
||||||
|
void VID_Init( void );
|
||||||
void UI_SetActiveMenu( qboolean fActive );
|
void UI_SetActiveMenu( qboolean fActive );
|
||||||
void Cmd_Null_f( void );
|
void Cmd_Null_f( void );
|
||||||
|
|
||||||
|
@ -727,3 +727,171 @@ char *va( const char *format, ... )
|
|||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
COM_FileBase
|
||||||
|
|
||||||
|
Extracts the base name of a file (no path, no extension, assumes '/' as path separator)
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
void COM_FileBase( const char *in, char *out )
|
||||||
|
{
|
||||||
|
int len, start, end;
|
||||||
|
|
||||||
|
len = Q_strlen( in );
|
||||||
|
if( !len ) return;
|
||||||
|
|
||||||
|
// scan backward for '.'
|
||||||
|
end = len - 1;
|
||||||
|
|
||||||
|
while( end && in[end] != '.' && in[end] != '/' && in[end] != '\\' )
|
||||||
|
end--;
|
||||||
|
|
||||||
|
if( in[end] != '.' )
|
||||||
|
end = len-1; // no '.', copy to end
|
||||||
|
else end--; // found ',', copy to left of '.'
|
||||||
|
|
||||||
|
// scan backward for '/'
|
||||||
|
start = len - 1;
|
||||||
|
|
||||||
|
while( start >= 0 && in[start] != '/' && in[start] != '\\' )
|
||||||
|
start--;
|
||||||
|
|
||||||
|
if( start < 0 || ( in[start] != '/' && in[start] != '\\' ))
|
||||||
|
start = 0;
|
||||||
|
else start++;
|
||||||
|
|
||||||
|
// length of new sting
|
||||||
|
len = end - start + 1;
|
||||||
|
|
||||||
|
// Copy partial string
|
||||||
|
Q_strncpy( out, &in[start], len + 1 );
|
||||||
|
out[len] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
COM_FileExtension
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
const char *COM_FileExtension( const char *in )
|
||||||
|
{
|
||||||
|
const char *separator, *backslash, *colon, *dot;
|
||||||
|
|
||||||
|
separator = Q_strrchr( in, '/' );
|
||||||
|
backslash = Q_strrchr( in, '\\' );
|
||||||
|
|
||||||
|
if( !separator || separator < backslash )
|
||||||
|
separator = backslash;
|
||||||
|
|
||||||
|
colon = Q_strrchr( in, ':' );
|
||||||
|
|
||||||
|
if( !separator || separator < colon )
|
||||||
|
separator = colon;
|
||||||
|
|
||||||
|
dot = Q_strrchr( in, '.' );
|
||||||
|
|
||||||
|
if( dot == NULL || ( separator && ( dot < separator )))
|
||||||
|
return "";
|
||||||
|
|
||||||
|
return dot + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
COM_FileWithoutPath
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
const char *COM_FileWithoutPath( const char *in )
|
||||||
|
{
|
||||||
|
const char *separator, *backslash, *colon;
|
||||||
|
|
||||||
|
separator = Q_strrchr( in, '/' );
|
||||||
|
backslash = Q_strrchr( in, '\\' );
|
||||||
|
|
||||||
|
if( !separator || separator < backslash )
|
||||||
|
separator = backslash;
|
||||||
|
|
||||||
|
colon = Q_strrchr( in, ':' );
|
||||||
|
|
||||||
|
if( !separator || separator < colon )
|
||||||
|
separator = colon;
|
||||||
|
|
||||||
|
return separator ? separator + 1 : in;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
COM_ExtractFilePath
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
void COM_ExtractFilePath( const char *path, char *dest )
|
||||||
|
{
|
||||||
|
const char *src = path + Q_strlen( path ) - 1;
|
||||||
|
|
||||||
|
// back up until a \ or the start
|
||||||
|
while( src != path && !(*(src - 1) == '\\' || *(src - 1) == '/' ))
|
||||||
|
src--;
|
||||||
|
|
||||||
|
if( src != path )
|
||||||
|
{
|
||||||
|
memcpy( dest, path, src - path );
|
||||||
|
dest[src - path - 1] = 0; // cutoff backslash
|
||||||
|
}
|
||||||
|
else Q_strcpy( dest, "" ); // file without path
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
COM_StripExtension
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
void COM_StripExtension( char *path )
|
||||||
|
{
|
||||||
|
size_t length;
|
||||||
|
|
||||||
|
length = Q_strlen( path ) - 1;
|
||||||
|
while( length > 0 && path[length] != '.' )
|
||||||
|
{
|
||||||
|
length--;
|
||||||
|
if( path[length] == '/' || path[length] == '\\' || path[length] == ':' )
|
||||||
|
return; // no extension
|
||||||
|
}
|
||||||
|
|
||||||
|
if( length ) path[length] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
COM_DefaultExtension
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void COM_DefaultExtension( char *path, const char *extension )
|
||||||
|
{
|
||||||
|
const char *src;
|
||||||
|
|
||||||
|
// if path doesn't have a .EXT, append extension
|
||||||
|
// (extension should include the .)
|
||||||
|
src = path + Q_strlen( path ) - 1;
|
||||||
|
|
||||||
|
while( *src != '/' && src != path )
|
||||||
|
{
|
||||||
|
// it has an extension
|
||||||
|
if( *src == '.' ) return;
|
||||||
|
src--;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strcat( path, extension );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
COM_ReplaceExtension
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void COM_ReplaceExtension( char *path, const char *extension )
|
||||||
|
{
|
||||||
|
COM_StripExtension( path );
|
||||||
|
COM_DefaultExtension( path, extension );
|
||||||
|
}
|
||||||
|
@ -111,6 +111,14 @@ int Q_sprintf( char *buffer, const char *format, ... ) _format( 2 );
|
|||||||
#define Q_memprint( val ) Q_pretifymem( val, 2 )
|
#define Q_memprint( val ) Q_pretifymem( val, 2 )
|
||||||
char *Q_pretifymem( float value, int digitsafterdecimal );
|
char *Q_pretifymem( float value, int digitsafterdecimal );
|
||||||
char *va( const char *format, ... ) _format( 1 );
|
char *va( const char *format, ... ) _format( 1 );
|
||||||
|
void COM_FileBase( const char *in, char *out );
|
||||||
|
const char *COM_FileExtension( const char *in );
|
||||||
|
void COM_DefaultExtension( char *path, const char *extension );
|
||||||
|
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
|
// zone.c
|
||||||
|
@ -809,3 +809,64 @@ void V_AdjustFov( float *fov_x, float *fov_y, float width, float height, qboolea
|
|||||||
if( *fov_x < x ) *fov_x = x;
|
if( *fov_x < x ) *fov_x = x;
|
||||||
else *fov_y = y;
|
else *fov_y = y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
==================
|
||||||
|
BoxOnPlaneSide
|
||||||
|
|
||||||
|
Returns 1, 2, or 1 + 2
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const mplane_t *p )
|
||||||
|
{
|
||||||
|
float dist1, dist2;
|
||||||
|
int sides = 0;
|
||||||
|
|
||||||
|
// general case
|
||||||
|
switch( p->signbits )
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||||
|
dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||||
|
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
||||||
|
dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
||||||
|
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
||||||
|
dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
||||||
|
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
||||||
|
dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
||||||
|
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// shut up compiler
|
||||||
|
dist1 = dist2 = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( dist1 >= p->dist )
|
||||||
|
sides = 1;
|
||||||
|
if( dist2 < p->dist )
|
||||||
|
sides |= 2;
|
||||||
|
|
||||||
|
return sides;
|
||||||
|
}
|
||||||
|
@ -196,6 +196,23 @@ qboolean Matrix4x4_Invert_Full( matrix4x4 out, const matrix4x4 in1 );
|
|||||||
float V_CalcFov( float *fov_x, float width, float height );
|
float V_CalcFov( float *fov_x, float width, float height );
|
||||||
void V_AdjustFov( float *fov_x, float *fov_y, float width, float height, qboolean lock_x );
|
void V_AdjustFov( float *fov_x, float *fov_y, float width, float height, qboolean lock_x );
|
||||||
|
|
||||||
|
int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const mplane_t *p );
|
||||||
|
#define BOX_ON_PLANE_SIDE( emins, emaxs, p ) \
|
||||||
|
((( p )->type < 3 ) ? \
|
||||||
|
( \
|
||||||
|
((p)->dist <= (emins)[(p)->type]) ? \
|
||||||
|
1 \
|
||||||
|
: \
|
||||||
|
( \
|
||||||
|
((p)->dist >= (emaxs)[(p)->type]) ? \
|
||||||
|
2 \
|
||||||
|
: \
|
||||||
|
3 \
|
||||||
|
) \
|
||||||
|
) \
|
||||||
|
: \
|
||||||
|
BoxOnPlaneSide(( emins ), ( emaxs ), ( p )))
|
||||||
|
|
||||||
extern vec3_t vec3_origin;
|
extern vec3_t vec3_origin;
|
||||||
extern int boxpnt[6][4];
|
extern int boxpnt[6][4];
|
||||||
extern const matrix3x4 matrix3x4_identity;
|
extern const matrix3x4 matrix3x4_identity;
|
||||||
|
@ -182,4 +182,11 @@ void Mod_StudioComputeBounds( void *buffer, vec3_t mins, vec3_t maxs, qboolean i
|
|||||||
int Mod_HitgroupForStudioHull( int index );
|
int Mod_HitgroupForStudioHull( int index );
|
||||||
void Mod_ClearStudioCache( void );
|
void Mod_ClearStudioCache( void );
|
||||||
|
|
||||||
|
//
|
||||||
|
// mod_sprite.c
|
||||||
|
//
|
||||||
|
void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, uint texFlags );
|
||||||
|
void Mod_UnloadSpriteModel( model_t *mod );
|
||||||
|
|
||||||
|
|
||||||
#endif//MOD_LOCAL_H
|
#endif//MOD_LOCAL_H
|
||||||
|
144
engine/common/mod_sprite.c
Normal file
144
engine/common/mod_sprite.c
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
/*
|
||||||
|
mod_sprite.c - sprite loading
|
||||||
|
Copyright (C) 2010 Uncle Mike
|
||||||
|
Copyright (C) 2019 a1batross
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "sprite.h"
|
||||||
|
#include "studio.h"
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
|
#include "ref_common.h"
|
||||||
|
#endif // XASH_DEDICATED
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
Mod_LoadSpriteModel
|
||||||
|
|
||||||
|
load sprite model
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, uint texFlags )
|
||||||
|
{
|
||||||
|
dsprite_q1_t *pinq1;
|
||||||
|
dsprite_hl_t *pinhl;
|
||||||
|
dsprite_t *pin;
|
||||||
|
short *numi = NULL;
|
||||||
|
msprite_t *psprite;
|
||||||
|
int i, size;
|
||||||
|
|
||||||
|
if( loaded ) *loaded = false;
|
||||||
|
pin = (dsprite_t *)buffer;
|
||||||
|
mod->type = mod_sprite;
|
||||||
|
i = pin->version;
|
||||||
|
|
||||||
|
if( pin->ident != IDSPRITEHEADER )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( i != SPRITE_VERSION_Q1 && i != SPRITE_VERSION_HL && i != SPRITE_VERSION_32 )
|
||||||
|
{
|
||||||
|
Con_DPrintf( S_ERROR "%s has wrong version number (%i should be %i or %i)\n", mod->name, i, SPRITE_VERSION_Q1, SPRITE_VERSION_HL );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mod->mempool = Mem_AllocPool( va( "^2%s^7", mod->name ));
|
||||||
|
|
||||||
|
if( i == SPRITE_VERSION_Q1 || i == SPRITE_VERSION_32 )
|
||||||
|
{
|
||||||
|
pinq1 = (dsprite_q1_t *)buffer;
|
||||||
|
size = sizeof( msprite_t ) + ( pinq1->numframes - 1 ) * sizeof( psprite->frames );
|
||||||
|
psprite = Mem_Calloc( mod->mempool, size );
|
||||||
|
mod->cache.data = psprite; // make link to extradata
|
||||||
|
|
||||||
|
psprite->type = pinq1->type;
|
||||||
|
psprite->texFormat = SPR_ADDITIVE; //SPR_ALPHTEST;
|
||||||
|
psprite->numframes = mod->numframes = pinq1->numframes;
|
||||||
|
psprite->facecull = SPR_CULL_FRONT;
|
||||||
|
psprite->radius = pinq1->boundingradius;
|
||||||
|
psprite->synctype = pinq1->synctype;
|
||||||
|
|
||||||
|
// LordHavoc: hack to allow sprites to be non-fullbright
|
||||||
|
for( i = 0; i < MAX_QPATH && mod->name[i]; i++ )
|
||||||
|
if( mod->name[i] == '!' )
|
||||||
|
psprite->texFormat = SPR_ALPHTEST;
|
||||||
|
|
||||||
|
mod->mins[0] = mod->mins[1] = -pinq1->bounds[0] * 0.5f;
|
||||||
|
mod->maxs[0] = mod->maxs[1] = pinq1->bounds[0] * 0.5f;
|
||||||
|
mod->mins[2] = -pinq1->bounds[1] * 0.5f;
|
||||||
|
mod->maxs[2] = pinq1->bounds[1] * 0.5f;
|
||||||
|
numi = NULL;
|
||||||
|
}
|
||||||
|
else if( i == SPRITE_VERSION_HL )
|
||||||
|
{
|
||||||
|
pinhl = (dsprite_hl_t *)buffer;
|
||||||
|
size = sizeof( msprite_t ) + ( pinhl->numframes - 1 ) * sizeof( psprite->frames );
|
||||||
|
psprite = Mem_Calloc( mod->mempool, size );
|
||||||
|
mod->cache.data = psprite; // make link to extradata
|
||||||
|
|
||||||
|
psprite->type = pinhl->type;
|
||||||
|
psprite->texFormat = pinhl->texFormat;
|
||||||
|
psprite->numframes = mod->numframes = pinhl->numframes;
|
||||||
|
psprite->facecull = pinhl->facetype;
|
||||||
|
psprite->radius = pinhl->boundingradius;
|
||||||
|
psprite->synctype = pinhl->synctype;
|
||||||
|
|
||||||
|
mod->mins[0] = mod->mins[1] = -pinhl->bounds[0] * 0.5f;
|
||||||
|
mod->maxs[0] = mod->maxs[1] = pinhl->bounds[0] * 0.5f;
|
||||||
|
mod->mins[2] = -pinhl->bounds[1] * 0.5f;
|
||||||
|
mod->maxs[2] = pinhl->bounds[1] * 0.5f;
|
||||||
|
numi = (short *)(pinhl + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Host_IsDedicated() )
|
||||||
|
{
|
||||||
|
// skip frames loading
|
||||||
|
if( loaded ) *loaded = true; // done
|
||||||
|
psprite->numframes = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// continue loading frames
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
|
ref.dllFuncs.Mod_LoadModel( mod_sprite, mod, buffer, loaded, texFlags );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
====================
|
||||||
|
Mod_UnloadSpriteModel
|
||||||
|
|
||||||
|
release sprite model and frames
|
||||||
|
====================
|
||||||
|
*/
|
||||||
|
void Mod_UnloadSpriteModel( model_t *mod )
|
||||||
|
{
|
||||||
|
Assert( mod != NULL );
|
||||||
|
|
||||||
|
if( mod->type == mod_sprite )
|
||||||
|
{
|
||||||
|
#ifndef XASH_DEDICATED
|
||||||
|
if( host.type != HOST_DEDICATED )
|
||||||
|
{
|
||||||
|
ref.dllFuncs.Mod_UnloadModel( mod );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
Mem_FreePool( &mod->mempool );
|
||||||
|
memset( mod, 0, sizeof( *mod ));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -192,64 +192,3 @@ int RankForContents( int contents )
|
|||||||
default: return 13; // any user contents has more priority than default
|
default: return 13; // any user contents has more priority than default
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
BoxOnPlaneSide
|
|
||||||
|
|
||||||
Returns 1, 2, or 1 + 2
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const mplane_t *p )
|
|
||||||
{
|
|
||||||
float dist1, dist2;
|
|
||||||
int sides = 0;
|
|
||||||
|
|
||||||
// general case
|
|
||||||
switch( p->signbits )
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
|
||||||
dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
|
||||||
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
|
||||||
dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
|
||||||
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
|
||||||
dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
|
|
||||||
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
|
||||||
dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
|
|
||||||
dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// shut up compiler
|
|
||||||
dist1 = dist2 = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( dist1 >= p->dist )
|
|
||||||
sides = 1;
|
|
||||||
if( dist2 < p->dist )
|
|
||||||
sides |= 2;
|
|
||||||
|
|
||||||
return sides;
|
|
||||||
}
|
|
@ -46,26 +46,8 @@ void ClearLink( link_t *l );
|
|||||||
void World_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs );
|
void World_MoveBounds( const vec3_t start, vec3_t mins, vec3_t maxs, const vec3_t end, vec3_t boxmins, vec3_t boxmaxs );
|
||||||
void World_TransformAABB( matrix4x4 transform, const vec3_t mins, const vec3_t maxs, vec3_t outmins, vec3_t outmaxs );
|
void World_TransformAABB( matrix4x4 transform, const vec3_t mins, const vec3_t maxs, vec3_t outmins, vec3_t outmaxs );
|
||||||
trace_t World_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch );
|
trace_t World_CombineTraces( trace_t *cliptrace, trace_t *trace, edict_t *touch );
|
||||||
int BoxOnPlaneSide( const vec3_t emins, const vec3_t emaxs, const mplane_t *p );
|
|
||||||
int RankForContents( int contents );
|
int RankForContents( int contents );
|
||||||
|
|
||||||
#define BOX_ON_PLANE_SIDE( emins, emaxs, p ) \
|
|
||||||
((( p )->type < 3 ) ? \
|
|
||||||
( \
|
|
||||||
((p)->dist <= (emins)[(p)->type]) ? \
|
|
||||||
1 \
|
|
||||||
: \
|
|
||||||
( \
|
|
||||||
((p)->dist >= (emaxs)[(p)->type]) ? \
|
|
||||||
2 \
|
|
||||||
: \
|
|
||||||
3 \
|
|
||||||
) \
|
|
||||||
) \
|
|
||||||
: \
|
|
||||||
BoxOnPlaneSide(( emins ), ( emaxs ), ( p )))
|
|
||||||
|
|
||||||
|
|
||||||
#define check_angles( x ) ( (int)x == 90 || (int)x == 180 || (int)x == 270 || (int)x == -90 || (int)x == -180 || (int)x == -270 )
|
#define check_angles( x ) ( (int)x == 90 || (int)x == 180 || (int)x == 270 || (int)x == -90 || (int)x == -180 || (int)x == -270 )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -26,6 +26,7 @@ GNU General Public License for more details.
|
|||||||
#include "com_model.h"
|
#include "com_model.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "r_efx.h"
|
#include "r_efx.h"
|
||||||
|
#include "cvar.h"
|
||||||
|
|
||||||
#define REF_API_VERSION 1
|
#define REF_API_VERSION 1
|
||||||
|
|
||||||
@ -67,10 +68,14 @@ typedef struct
|
|||||||
typedef struct ref_globals_s
|
typedef struct ref_globals_s
|
||||||
{
|
{
|
||||||
qboolean developer;
|
qboolean developer;
|
||||||
|
qboolean video_prepped;
|
||||||
|
|
||||||
float time; // cl.time
|
float time; // cl.time
|
||||||
float oldtime; // cl.oldtime
|
float oldtime; // cl.oldtime
|
||||||
|
|
||||||
|
int parsecount; // cl.parsecount
|
||||||
|
int parsecountmod; // cl.parsecountmod
|
||||||
|
|
||||||
// viewport width and height
|
// viewport width and height
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
@ -120,7 +125,18 @@ enum ref_shared_texture_e
|
|||||||
REF_ALPHASKY_TEXTURE,
|
REF_ALPHASKY_TEXTURE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef enum ref_connstate_e
|
||||||
|
{
|
||||||
|
ref_ca_disconnected = 0,// not talking to a server
|
||||||
|
ref_ca_connecting, // sending request packets to the server
|
||||||
|
ref_ca_connected, // netchan_t established, waiting for svc_serverdata
|
||||||
|
ref_ca_validate, // download resources, validating, auth on server
|
||||||
|
ref_ca_active, // game views should be displayed
|
||||||
|
ref_ca_cinematic, // playing a cinematic, not connected to a server
|
||||||
|
} ref_connstate_t;
|
||||||
|
|
||||||
struct con_nprint_s;
|
struct con_nprint_s;
|
||||||
|
struct remap_info_s;
|
||||||
|
|
||||||
typedef struct ref_api_s
|
typedef struct ref_api_s
|
||||||
{
|
{
|
||||||
@ -129,10 +145,14 @@ typedef struct ref_api_s
|
|||||||
qboolean (*Host_IsQuakeCompatible)( void );
|
qboolean (*Host_IsQuakeCompatible)( void );
|
||||||
int (*GetPlayerIndex)( void ); // cl.playernum + 1
|
int (*GetPlayerIndex)( void ); // cl.playernum + 1
|
||||||
int (*GetViewEntIndex)( void ); // cl.viewentity
|
int (*GetViewEntIndex)( void ); // cl.viewentity
|
||||||
|
ref_connstate_t (*CL_GetConnState)( void ); // cls.state == ca_connected
|
||||||
|
int (*IsDemoPlaying)( void ); // cls.demoplayback
|
||||||
|
int (*GetWaterLevel)( void ); // cl.local.waterlevel
|
||||||
|
int (*CL_GetRenderParm)( int parm, int arg ); // generic
|
||||||
|
|
||||||
// cvar handlers
|
// cvar handlers
|
||||||
cvar_t *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *description );
|
convar_t *(*pfnRegisterVariable)( const char *szName, const char *szValue, int flags, const char *description );
|
||||||
cvar_t *(*pfnGetCvarPointer)( const char *name );
|
convar_t *(*pfnGetCvarPointer)( const char *name );
|
||||||
float (*pfnGetCvarFloat)( const char *szName );
|
float (*pfnGetCvarFloat)( const char *szName );
|
||||||
const char *(*pfnGetCvarString)( const char *szName );
|
const char *(*pfnGetCvarString)( const char *szName );
|
||||||
|
|
||||||
@ -146,13 +166,21 @@ typedef struct ref_api_s
|
|||||||
void (*Cbuf_AddText)( const char *commands );
|
void (*Cbuf_AddText)( const char *commands );
|
||||||
void (*Cbuf_InsertText)( const char *commands );
|
void (*Cbuf_InsertText)( const char *commands );
|
||||||
void (*Cbuf_Execute)( void );
|
void (*Cbuf_Execute)( void );
|
||||||
|
void (*Cbuf_SetOpenGLConfigHack)( qboolean set ); // host.apply_opengl_config
|
||||||
|
|
||||||
// logging
|
// logging
|
||||||
void (*Con_VPrintf)( const char *fmt, va_list args );
|
void (*Con_VPrintf)( const char *fmt, va_list args );
|
||||||
void (*Con_Printf)( const char *fmt, ... );
|
void (*Con_Printf)( const char *fmt, ... ); // typical console allowed messages
|
||||||
void (*Con_DPrintf)( const char *fmt, ... );
|
void (*Con_DPrintf)( const char *fmt, ... ); // -dev 1
|
||||||
|
void (*Con_Reportf)( const char *fmt, ... ); // -dev 2
|
||||||
|
|
||||||
|
// debug print
|
||||||
void (*Con_NPrintf)( int pos, const char *fmt, ... );
|
void (*Con_NPrintf)( int pos, const char *fmt, ... );
|
||||||
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... );
|
void (*Con_NXPrintf)( struct con_nprint_s *info, const char *fmt, ... );
|
||||||
|
void (*CL_CenterPrint)( const char *fmt, ... );
|
||||||
|
void (*Con_DrawStringLen)( const char *pText, int *length, int *height );
|
||||||
|
int (*Con_DrawString)( int x, int y, const char *string, rgba_t setColor );
|
||||||
|
void (*CL_DrawCenterPrint)();
|
||||||
|
|
||||||
// entity management
|
// entity management
|
||||||
struct cl_entity_s *(*GetLocalPlayer)( void );
|
struct cl_entity_s *(*GetLocalPlayer)( void );
|
||||||
@ -160,11 +188,14 @@ typedef struct ref_api_s
|
|||||||
struct cl_entity_s *(*GetEntityByIndex)( int idx );
|
struct cl_entity_s *(*GetEntityByIndex)( int idx );
|
||||||
int (*pfnNumberOfEntities)( void );
|
int (*pfnNumberOfEntities)( void );
|
||||||
struct cl_entity_s *(*R_BeamGetEntity)( int index );
|
struct cl_entity_s *(*R_BeamGetEntity)( int index );
|
||||||
|
struct cl_entity_s *(*CL_GetWaterEntity)( vec3_t p );
|
||||||
|
qboolean (*CL_AddVisibleEntity)( cl_entity_t *ent, int entityType );
|
||||||
|
|
||||||
// brushes
|
// brushes
|
||||||
int (*Mod_SampleSizeForFace)( struct msurface_s *surf );
|
int (*Mod_SampleSizeForFace)( struct msurface_s *surf );
|
||||||
qboolean (*Mod_BoxVisible)( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
qboolean (*Mod_BoxVisible)( const vec3_t mins, const vec3_t maxs, const byte *visbits );
|
||||||
struct world_static_s *(*GetWorld)( void ); // returns &world
|
struct world_static_s *(*GetWorld)( void ); // returns &world
|
||||||
|
mleaf_t *(*Mod_PointInLeaf)( const vec3_t p, mnode_t *node );
|
||||||
|
|
||||||
// studio models
|
// studio models
|
||||||
void (*R_StudioSlerpBones)( int numbones, vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s );
|
void (*R_StudioSlerpBones)( int numbones, vec4_t q1[], float pos1[][3], vec4_t q2[], float pos2[][3], float s );
|
||||||
@ -174,19 +205,25 @@ typedef struct ref_api_s
|
|||||||
|
|
||||||
// efx
|
// efx
|
||||||
void (*CL_DrawEFX)( float time, qboolean fTrans );
|
void (*CL_DrawEFX)( float time, qboolean fTrans );
|
||||||
|
void (*CL_ThinkParticle)( double frametime, particle_t *p );
|
||||||
void (*R_FreeDeadParticles)( particle_t **ppparticles );
|
void (*R_FreeDeadParticles)( particle_t **ppparticles );
|
||||||
|
efrag_t* (*GetEfragsFreeList)( void ); // clgame.free_efrags
|
||||||
|
void (*SetEfragsFreeList)( efrag_t* ); // clgame.free_efrags
|
||||||
|
color24 *(*GetTracerColors)( int num );
|
||||||
|
|
||||||
// model management
|
// model management
|
||||||
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
model_t *(*Mod_ForName)( const char *name, qboolean crash, qboolean trackCRC );
|
||||||
void *(*Mod_Extradata)( int type, model_t *model );
|
void *(*Mod_Extradata)( int type, model_t *model );
|
||||||
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
|
struct model_s *(*pfnGetModelByIndex)( int index ); // CL_ModelHandle
|
||||||
|
struct model_s *(*Mod_GetCurrentLoadingModel)( void ); // loadmodel
|
||||||
|
void (*Mod_SetCurrentLoadingModel)( struct model_s* ); // loadmodel
|
||||||
|
int (*CL_NumModels)( void );
|
||||||
|
|
||||||
// trace
|
// remap
|
||||||
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
struct remap_info_s *(*CL_GetRemapInfoForEntity)( cl_entity_t *e );
|
||||||
struct pmtrace_s *(*EV_VisTraceLine )( float *start, float *end, int flags );
|
void (*CL_AllocRemapInfo)( int topcolor, int bottomcolor );
|
||||||
struct pmtrace_t (*CL_TraceLine)( vec3_t start, vec3_t end, int flags );
|
void (*CL_FreeRemapInfo)( struct remap_info_s *info );
|
||||||
|
void (*CL_UpdateRemapInfo)( int topcolor, int bottomcolor );
|
||||||
struct movevars_s *(*pfnGetMoveVars)( void );
|
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
void (*CL_ExtraUpdate)( void );
|
void (*CL_ExtraUpdate)( void );
|
||||||
@ -198,6 +235,12 @@ typedef struct ref_api_s
|
|||||||
struct screenfade_s *(*GetScreenFade)( void );
|
struct screenfade_s *(*GetScreenFade)( void );
|
||||||
struct client_textmessage_s *(*pfnTextMessageGet)( const char *pName );
|
struct client_textmessage_s *(*pfnTextMessageGet)( const char *pName );
|
||||||
void (*GetPredictedOrigin)( vec3_t v );
|
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
|
||||||
|
|
||||||
|
// studio interface
|
||||||
|
player_info_t *(*pfnPlayerInfo)( int index );
|
||||||
|
entity_state_t *(*pfnGetPlayerState)( int index );
|
||||||
|
|
||||||
// memory
|
// memory
|
||||||
byte *(*_Mem_AllocPool)( const char *name, const char *filename, int fileline );
|
byte *(*_Mem_AllocPool)( const char *name, const char *filename, int fileline );
|
||||||
@ -212,6 +255,10 @@ typedef struct ref_api_s
|
|||||||
void *(*COM_GetProcAddress)( void *handle, const char *name );
|
void *(*COM_GetProcAddress)( void *handle, const char *name );
|
||||||
|
|
||||||
// filesystem
|
// filesystem
|
||||||
|
byte* (*COM_LoadFile)( const char *path, fs_offset_t *pLength, qboolean gamedironly );
|
||||||
|
char* (*COM_ParseFile)( char *data, char *token );
|
||||||
|
// use Mem_Free instead
|
||||||
|
// void (*COM_FreeFile)( void *buffer );
|
||||||
int (*FS_FileExists)( const char *filename, int gamedironly );
|
int (*FS_FileExists)( const char *filename, int gamedironly );
|
||||||
|
|
||||||
// GL
|
// GL
|
||||||
@ -221,11 +268,14 @@ typedef struct ref_api_s
|
|||||||
void (*GL_DestroyContext)( );
|
void (*GL_DestroyContext)( );
|
||||||
void *(*GL_GetProcAddress)( const char *name );
|
void *(*GL_GetProcAddress)( const char *name );
|
||||||
|
|
||||||
|
// gamma
|
||||||
|
void (*BuildGammaTable)( float lightgamma, float brightness );
|
||||||
|
byte (*LightToTexGamma)( byte color ); // software gamma support
|
||||||
|
|
||||||
// renderapi
|
// renderapi
|
||||||
lightstyle_t* (*GetLightStyle)( int number );
|
lightstyle_t* (*GetLightStyle)( int number );
|
||||||
dlight_t* (*GetDynamicLight)( int number );
|
dlight_t* (*GetDynamicLight)( int number );
|
||||||
dlight_t* (*GetEntityLight)( int number );
|
dlight_t* (*GetEntityLight)( int number );
|
||||||
byte (*LightToTexGamma)( byte color ); // software gamma support
|
|
||||||
int (*R_FatPVS)( const float *org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
|
int (*R_FatPVS)( const float *org, float radius, byte *visbuffer, qboolean merge, qboolean fullvis );
|
||||||
void *(*AVI_LoadVideo)( const char *filename, qboolean load_audio );
|
void *(*AVI_LoadVideo)( const char *filename, qboolean load_audio );
|
||||||
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration );
|
int (*AVI_GetVideoInfo)( void *Avi, long *xres, long *yres, float *duration );
|
||||||
@ -248,12 +298,21 @@ typedef struct ref_api_s
|
|||||||
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
|
void (*S_FadeMusicVolume)( float fadePercent ); // fade background track (0-100 percents)
|
||||||
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
|
void (*SetRandomSeed)( long lSeed ); // set custom seed for RANDOM_FLOAT\RANDOM_LONG for predictable random
|
||||||
|
|
||||||
|
// event api
|
||||||
|
struct physent_s *(*EV_GetPhysent)( int idx );
|
||||||
|
struct msurface_s *( *EV_TraceSurface )( int ground, float *vstart, float *vend );
|
||||||
|
struct pmtrace_s *(*PM_TraceLine)( float *start, float *end, int flags, int usehull, int ignore_pe );
|
||||||
|
struct pmtrace_s *(*EV_VisTraceLine )( float *start, float *end, int flags );
|
||||||
|
struct pmtrace_s (*CL_TraceLine)( vec3_t start, vec3_t end, int flags );
|
||||||
|
struct movevars_s *(*pfnGetMoveVars)( void );
|
||||||
|
|
||||||
|
// imagelib
|
||||||
|
void (*Image_AddCmdFlags)( uint flags ); // used to check if hardware dxt is supported
|
||||||
|
|
||||||
// client exports
|
// client exports
|
||||||
void (*pfnDrawNormalTriangles)( void );
|
void (*pfnDrawNormalTriangles)( void );
|
||||||
void (*pfnDrawTransparentTriangles)( void );
|
void (*pfnDrawTransparentTriangles)( void );
|
||||||
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback );
|
int (*pfnGetRenderInterface)( int version, render_api_t *renderfuncs, render_interface_t *callback );
|
||||||
int (*CL_GetRenderParm)( int parm, int arg ); // generic
|
|
||||||
|
|
||||||
} ref_api_t;
|
} ref_api_t;
|
||||||
|
|
||||||
struct mip_s;
|
struct mip_s;
|
@ -20,6 +20,9 @@ GNU General Public License for more details.
|
|||||||
#include "alias.h"
|
#include "alias.h"
|
||||||
#include "pm_local.h"
|
#include "pm_local.h"
|
||||||
#include "cl_tent.h"
|
#include "cl_tent.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "pmtrace.h"
|
||||||
|
|
||||||
extern cvar_t r_shadows;
|
extern cvar_t r_shadows;
|
||||||
|
|
||||||
@ -418,6 +421,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
|
|||||||
static rgbdata_t skin;
|
static rgbdata_t skin;
|
||||||
char name[MAX_QPATH];
|
char name[MAX_QPATH];
|
||||||
int i;
|
int i;
|
||||||
|
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
||||||
|
|
||||||
skin.width = width;
|
skin.width = width;
|
||||||
skin.height = height;
|
skin.height = height;
|
||||||
@ -427,7 +431,7 @@ rgbdata_t *Mod_CreateSkinData( model_t *mod, byte *data, int width, int height )
|
|||||||
skin.encode = DXT_ENCODE_DEFAULT;
|
skin.encode = DXT_ENCODE_DEFAULT;
|
||||||
skin.numMips = 1;
|
skin.numMips = 1;
|
||||||
skin.buffer = data;
|
skin.buffer = data;
|
||||||
skin.palette = (byte *)&clgame.palette;
|
skin.palette = (byte *)gEngfuncs.CL_GetPaletteColor( 0 );
|
||||||
skin.size = width * height;
|
skin.size = width * height;
|
||||||
|
|
||||||
if( !Image_CustomPalette() )
|
if( !Image_CustomPalette() )
|
||||||
@ -480,6 +484,7 @@ void *Mod_LoadSingleSkin( daliasskintype_t *pskintype, int skinnum, int size )
|
|||||||
string name, lumaname;
|
string name, lumaname;
|
||||||
string checkname;
|
string checkname;
|
||||||
rgbdata_t *pic;
|
rgbdata_t *pic;
|
||||||
|
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
||||||
|
|
||||||
Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum );
|
Q_snprintf( name, sizeof( name ), "%s:frame%i", loadmodel->name, skinnum );
|
||||||
Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum );
|
Q_snprintf( lumaname, sizeof( lumaname ), "%s:luma%i", loadmodel->name, skinnum );
|
||||||
@ -557,7 +562,7 @@ void *Mod_LoadAllSkins( int numskins, daliasskintype_t *pskintype )
|
|||||||
int i, size;
|
int i, size;
|
||||||
|
|
||||||
if( numskins < 1 || numskins > MAX_SKINS )
|
if( numskins < 1 || numskins > MAX_SKINS )
|
||||||
Host_Error( "Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins );
|
gEngfuncs.Host_Error( "Mod_LoadAliasModel: Invalid # of skins: %d\n", numskins );
|
||||||
|
|
||||||
size = m_pAliasHeader->skinwidth * m_pAliasHeader->skinheight;
|
size = m_pAliasHeader->skinwidth * m_pAliasHeader->skinheight;
|
||||||
|
|
||||||
@ -631,7 +636,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
|
|
||||||
if( i != ALIAS_VERSION )
|
if( i != ALIAS_VERSION )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "%s has wrong version number (%i should be %i)\n", mod->name, i, ALIAS_VERSION );
|
gEngfuncs.Con_DPrintf( S_ERROR "%s has wrong version number (%i should be %i)\n", mod->name, i, ALIAS_VERSION );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -658,7 +663,7 @@ void Mod_LoadAliasModel( model_t *mod, const void *buffer, qboolean *loaded )
|
|||||||
|
|
||||||
if( m_pAliasHeader->numverts > MAXALIASVERTS )
|
if( m_pAliasHeader->numverts > MAXALIASVERTS )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "model %s has too many vertices\n", mod->name );
|
gEngfuncs.Con_DPrintf( S_ERROR "model %s has too many vertices\n", mod->name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -776,7 +781,7 @@ similar to R_StudioDynamicLight
|
|||||||
*/
|
*/
|
||||||
void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||||
{
|
{
|
||||||
movevars_t *mv = &clgame.movevars;
|
movevars_t *mv = gEngfuncs.pfnGetMoveVars();
|
||||||
vec3_t lightDir, vecSrc, vecEnd;
|
vec3_t lightDir, vecSrc, vecEnd;
|
||||||
vec3_t origin, dist, finalLight;
|
vec3_t origin, dist, finalLight;
|
||||||
float add, radius, total;
|
float add, radius, total;
|
||||||
@ -825,9 +830,9 @@ void R_AliasDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
vecEnd[2] = origin[2] - mv->skyvec_z * 8192.0f;
|
vecEnd[2] = origin[2] - mv->skyvec_z * 8192.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace = CL_TraceLine( vecSrc, vecEnd, PM_STUDIO_IGNORE );
|
trace = gEngfuncs.CL_TraceLine( vecSrc, vecEnd, PM_STUDIO_IGNORE );
|
||||||
if( trace.ent > 0 ) psurf = PM_TraceSurface( &clgame.pmove->physents[trace.ent], vecSrc, vecEnd );
|
if( trace.ent > 0 ) psurf = gEngfuncs.EV_TraceSurface( trace.ent, vecSrc, vecEnd );
|
||||||
else psurf = PM_TraceSurface( clgame.pmove->physents, vecSrc, vecEnd );
|
else psurf = gEngfuncs.EV_TraceSurface( 0, vecSrc, vecEnd );
|
||||||
|
|
||||||
if( psurf && FBitSet( psurf->flags, SURF_DRAWSKY ))
|
if( psurf && FBitSet( psurf->flags, SURF_DRAWSKY ))
|
||||||
{
|
{
|
||||||
@ -1013,11 +1018,11 @@ R_AliasSetRemapColors
|
|||||||
*/
|
*/
|
||||||
void R_AliasSetRemapColors( int newTop, int newBottom )
|
void R_AliasSetRemapColors( int newTop, int newBottom )
|
||||||
{
|
{
|
||||||
CL_AllocRemapInfo( newTop, newBottom );
|
gEngfuncs.CL_AllocRemapInfo( newTop, newBottom );
|
||||||
|
|
||||||
if( CL_GetRemapInfoForEntity( RI.currententity ))
|
if( gEngfuncs.CL_GetRemapInfoForEntity( RI.currententity ))
|
||||||
{
|
{
|
||||||
CL_UpdateRemapInfo( newTop, newBottom );
|
gEngfuncs.CL_UpdateRemapInfo( newTop, newBottom );
|
||||||
m_fDoRemap = true;
|
m_fDoRemap = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1177,7 +1182,7 @@ void R_AliasLerpMovement( cl_entity_t *e )
|
|||||||
if( g_alias.interpolate && ( g_alias.time < e->curstate.animtime + 1.0f ) && ( e->curstate.animtime != e->latched.prevanimtime ))
|
if( g_alias.interpolate && ( g_alias.time < e->curstate.animtime + 1.0f ) && ( e->curstate.animtime != e->latched.prevanimtime ))
|
||||||
f = ( g_alias.time - e->curstate.animtime ) / ( e->curstate.animtime - e->latched.prevanimtime );
|
f = ( g_alias.time - e->curstate.animtime ) / ( e->curstate.animtime - e->latched.prevanimtime );
|
||||||
|
|
||||||
if( cls.demoplayback == DEMO_QUAKE1 )
|
if( gEngfuncs.IsDemoPlaying() == DEMO_QUAKE1 )
|
||||||
f = f + 1.0f;
|
f = f + 1.0f;
|
||||||
|
|
||||||
g_alias.lerpfrac = bound( 0.0f, f, 1.0f );
|
g_alias.lerpfrac = bound( 0.0f, f, 1.0f );
|
||||||
@ -1227,7 +1232,7 @@ void R_SetupAliasFrame( cl_entity_t *e, aliashdr_t *paliashdr )
|
|||||||
else if( newframe >= paliashdr->numframes )
|
else if( newframe >= paliashdr->numframes )
|
||||||
{
|
{
|
||||||
if( newframe > paliashdr->numframes )
|
if( newframe > paliashdr->numframes )
|
||||||
Con_Reportf( S_WARN "R_GetAliasFrame: no such frame %d (%s)\n", newframe, e->model->name );
|
gEngfuncs.Con_Reportf( S_WARN "R_GetAliasFrame: no such frame %d (%s)\n", newframe, e->model->name );
|
||||||
newframe = paliashdr->numframes - 1;
|
newframe = paliashdr->numframes - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
char r_speeds_msg[MAX_SYSPATH];
|
char r_speeds_msg[MAX_SYSPATH];
|
||||||
ref_speeds_t r_stats; // r_speeds counters
|
ref_speeds_t r_stats; // r_speeds counters
|
||||||
@ -184,7 +185,7 @@ void GL_SelectTexture( GLint tmu )
|
|||||||
|
|
||||||
if( tmu >= GL_MaxTextureUnits( ))
|
if( tmu >= GL_MaxTextureUnits( ))
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "GL_SelectTexture: bad tmu state %i\n", tmu );
|
gEngfuncs.Con_Reportf( S_ERROR "GL_SelectTexture: bad tmu state %i\n", tmu );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -277,7 +278,7 @@ void GL_TextureTarget( uint target )
|
|||||||
{
|
{
|
||||||
if( glState.activeTMU < 0 || glState.activeTMU >= GL_MaxTextureUnits( ))
|
if( glState.activeTMU < 0 || glState.activeTMU >= GL_MaxTextureUnits( ))
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "GL_TextureTarget: bad tmu state %i\n", glState.activeTMU );
|
gEngfuncs.Con_Reportf( S_ERROR "GL_TextureTarget: bad tmu state %i\n", glState.activeTMU );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,37 +453,6 @@ const envmap_t r_envMapInfo[6] =
|
|||||||
{{ 90, 0, 90}, 0 }
|
{{ 90, 0, 90}, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
===============
|
|
||||||
VID_WriteOverviewScript
|
|
||||||
|
|
||||||
Create overview script file
|
|
||||||
===============
|
|
||||||
*/
|
|
||||||
void VID_WriteOverviewScript( void )
|
|
||||||
{
|
|
||||||
ref_overview_t *ov = &gEngfuncs.GetOverviewParms();
|
|
||||||
string filename;
|
|
||||||
file_t *f;
|
|
||||||
|
|
||||||
Q_snprintf( filename, sizeof( filename ), "overviews/%s.txt", clgame.mapname );
|
|
||||||
|
|
||||||
f = FS_Open( filename, "w", false );
|
|
||||||
if( !f ) return;
|
|
||||||
|
|
||||||
FS_Printf( f, "// overview description file for %s.bsp\n\n", clgame.mapname );
|
|
||||||
FS_Print( f, "global\n{\n" );
|
|
||||||
FS_Printf( f, "\tZOOM\t%.2f\n", ov->flZoom );
|
|
||||||
FS_Printf( f, "\tORIGIN\t%.2f\t%.2f\t%.2f\n", ov->origin[0], ov->origin[1], ov->origin[2] );
|
|
||||||
FS_Printf( f, "\tROTATED\t%i\n", ov->rotated ? 1 : 0 );
|
|
||||||
FS_Print( f, "}\n\nlayer\n{\n" );
|
|
||||||
FS_Printf( f, "\tIMAGE\t\"overviews/%s.bmp\"\n", clgame.mapname );
|
|
||||||
FS_Printf( f, "\tHEIGHT\t%.2f\n", ov->zFar ); // ???
|
|
||||||
FS_Print( f, "}\n" );
|
|
||||||
|
|
||||||
FS_Close( f );
|
|
||||||
}
|
|
||||||
|
|
||||||
qboolean VID_ScreenShot( const char *filename, int shot_type )
|
qboolean VID_ScreenShot( const char *filename, int shot_type )
|
||||||
{
|
{
|
||||||
rgbdata_t *r_shot;
|
rgbdata_t *r_shot;
|
||||||
@ -511,7 +481,7 @@ qboolean VID_ScreenShot( const char *filename, int shot_type )
|
|||||||
break;
|
break;
|
||||||
case VID_LEVELSHOT:
|
case VID_LEVELSHOT:
|
||||||
flags |= IMAGE_RESAMPLE;
|
flags |= IMAGE_RESAMPLE;
|
||||||
if( glState.wideScreen )
|
if( gpGlobals->wideScreen )
|
||||||
{
|
{
|
||||||
height = 480;
|
height = 480;
|
||||||
width = 800;
|
width = 800;
|
||||||
@ -528,7 +498,6 @@ qboolean VID_ScreenShot( const char *filename, int shot_type )
|
|||||||
width = 320;
|
width = 320;
|
||||||
break;
|
break;
|
||||||
case VID_MAPSHOT:
|
case VID_MAPSHOT:
|
||||||
VID_WriteOverviewScript(); // store overview script too
|
|
||||||
flags |= IMAGE_RESAMPLE|IMAGE_QUANTIZE; // GoldSrc request overviews in 8-bit format
|
flags |= IMAGE_RESAMPLE|IMAGE_QUANTIZE; // GoldSrc request overviews in 8-bit format
|
||||||
height = 768;
|
height = 768;
|
||||||
width = 1024;
|
width = 1024;
|
||||||
@ -658,7 +627,7 @@ void R_ShowTextures( void )
|
|||||||
|
|
||||||
if( showHelp )
|
if( showHelp )
|
||||||
{
|
{
|
||||||
CL_CenterPrint( "use '<-' and '->' keys to change atlas page, ESC to quit", 0.25f );
|
gEngfuncs.CL_CenterPrint( "use '<-' and '->' keys to change atlas page, ESC to quit", 0.25f );
|
||||||
showHelp = false;
|
showHelp = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,7 +647,7 @@ rebuild_page:
|
|||||||
w = gpGlobals->width / base_w;
|
w = gpGlobals->width / base_w;
|
||||||
h = gpGlobals->height / base_h;
|
h = gpGlobals->height / base_h;
|
||||||
|
|
||||||
Con_DrawStringLen( NULL, NULL, &charHeight );
|
gEngfuncs.Con_DrawStringLen( NULL, NULL, &charHeight );
|
||||||
|
|
||||||
for( i = j = 0; i < MAX_TEXTURES; i++ )
|
for( i = j = 0; i < MAX_TEXTURES; i++ )
|
||||||
{
|
{
|
||||||
@ -739,11 +708,11 @@ rebuild_page:
|
|||||||
shortname[17] = '.';
|
shortname[17] = '.';
|
||||||
shortname[18] = '\0';
|
shortname[18] = '\0';
|
||||||
}
|
}
|
||||||
Con_DrawString( x + 1, y + h - charHeight, shortname, color );
|
gEngfuncs.Con_DrawString( x + 1, y + h - charHeight, shortname, color );
|
||||||
j++, k++;
|
j++, k++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CL_DrawCenterPrint ();
|
gEngfuncs.CL_DrawCenterPrint ();
|
||||||
pglFinish();
|
pglFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -852,7 +821,7 @@ void SCR_TimeRefresh_f( void )
|
|||||||
double start, stop;
|
double start, stop;
|
||||||
double time;
|
double time;
|
||||||
|
|
||||||
if( cls.state != ca_active )
|
if( gEngfuncs.CL_GetConnState() != ref_ca_active )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
start = Sys_DoubleTime();
|
start = Sys_DoubleTime();
|
||||||
@ -863,7 +832,7 @@ void SCR_TimeRefresh_f( void )
|
|||||||
pglDrawBuffer( GL_FRONT );
|
pglDrawBuffer( GL_FRONT );
|
||||||
for( i = 0; i < 128; i++ )
|
for( i = 0; i < 128; i++ )
|
||||||
{
|
{
|
||||||
refState.viewangles[1] = i / 128.0 * 360.0f;
|
gpGlobals->viewangles[1] = i / 128.0 * 360.0f;
|
||||||
R_RenderScene();
|
R_RenderScene();
|
||||||
}
|
}
|
||||||
pglFinish();
|
pglFinish();
|
||||||
@ -874,7 +843,7 @@ void SCR_TimeRefresh_f( void )
|
|||||||
for( i = 0; i < 128; i++ )
|
for( i = 0; i < 128; i++ )
|
||||||
{
|
{
|
||||||
R_BeginFrame( true );
|
R_BeginFrame( true );
|
||||||
refState.viewangles[1] = i / 128.0 * 360.0f;
|
gpGlobals->viewangles[1] = i / 128.0 * 360.0f;
|
||||||
R_RenderScene();
|
R_RenderScene();
|
||||||
R_EndFrame();
|
R_EndFrame();
|
||||||
}
|
}
|
||||||
@ -882,5 +851,5 @@ void SCR_TimeRefresh_f( void )
|
|||||||
|
|
||||||
stop = Sys_DoubleTime ();
|
stop = Sys_DoubleTime ();
|
||||||
time = (stop - start);
|
time = (stop - start);
|
||||||
Con_Printf( "%f seconds (%f fps)\n", time, 128 / time );
|
gEngfuncs.Con_Printf( "%f seconds (%f fps)\n", time, 128 / time );
|
||||||
}
|
}
|
||||||
|
@ -948,7 +948,7 @@ void R_BeamDraw( BEAM *pbeam, float frametime )
|
|||||||
model_t *model;
|
model_t *model;
|
||||||
vec3_t delta;
|
vec3_t delta;
|
||||||
|
|
||||||
model = CL_ModelHandle( pbeam->modelIndex );
|
model = gEngfuncs.pfnGetModelByIndex( pbeam->modelIndex );
|
||||||
SetBits( pbeam->flags, FBEAM_ISACTIVE );
|
SetBits( pbeam->flags, FBEAM_ISACTIVE );
|
||||||
|
|
||||||
if( !model || model->type != mod_sprite )
|
if( !model || model->type != mod_sprite )
|
||||||
@ -1151,7 +1151,7 @@ passed through this
|
|||||||
*/
|
*/
|
||||||
static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed )
|
static void R_BeamSetup( BEAM *pbeam, vec3_t start, vec3_t end, int modelIndex, float life, float width, float amplitude, float brightness, float speed )
|
||||||
{
|
{
|
||||||
model_t *sprite = CL_ModelHandle( modelIndex );
|
model_t *sprite = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
||||||
|
|
||||||
if( !sprite ) return;
|
if( !sprite ) return;
|
||||||
|
|
||||||
@ -1260,7 +1260,7 @@ CL_DrawBeams
|
|||||||
draw beam loop
|
draw beam loop
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
void CL_DrawBeams(int fTrans , BEAM *active_beams )
|
void CL_DrawBeams( int fTrans, BEAM *active_beams )
|
||||||
{
|
{
|
||||||
BEAM *pBeam, *pNext;
|
BEAM *pBeam, *pNext;
|
||||||
BEAM *pPrev = NULL;
|
BEAM *pPrev = NULL;
|
||||||
|
@ -13,8 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
|
#include "mod_local.h"
|
||||||
|
|
||||||
#define list_entry( ptr, type, member ) \
|
#define list_entry( ptr, type, member ) \
|
||||||
((type *)((char *)(ptr) - (size_t)(&((type *)0)->member)))
|
((type *)((char *)(ptr) - (size_t)(&((type *)0)->member)))
|
||||||
|
@ -15,6 +15,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "cl_tent.h"
|
#include "cl_tent.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
#define DECAL_OVERLAP_DISTANCE 2
|
#define DECAL_OVERLAP_DISTANCE 2
|
||||||
#define DECAL_DISTANCE 4 // too big values produce more clipped polygons
|
#define DECAL_DISTANCE 4 // too big values produce more clipped polygons
|
||||||
@ -75,7 +76,7 @@ static void R_DecalUnlink( decal_t *pdecal )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmp = pdecal->psurface->pdecals;
|
tmp = pdecal->psurface->pdecals;
|
||||||
if( !tmp ) Host_Error( "D_DecalUnlink: bad decal list\n" );
|
if( !tmp ) gEngfuncs.Host_Error( "D_DecalUnlink: bad decal list\n" );
|
||||||
|
|
||||||
while( tmp->pnext )
|
while( tmp->pnext )
|
||||||
{
|
{
|
||||||
@ -511,7 +512,7 @@ creates mesh for decal on first rendering
|
|||||||
glpoly_t *R_DecalCreatePoly( decalinfo_t *decalinfo, decal_t *pdecal, msurface_t *surf )
|
glpoly_t *R_DecalCreatePoly( decalinfo_t *decalinfo, decal_t *pdecal, msurface_t *surf )
|
||||||
{
|
{
|
||||||
int lnumverts;
|
int lnumverts;
|
||||||
glpoly_t *poly;
|
glpoly_t *poly;
|
||||||
float *v;
|
float *v;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -522,7 +523,8 @@ glpoly_t *R_DecalCreatePoly( decalinfo_t *decalinfo, decal_t *pdecal, msurface_t
|
|||||||
if( !lnumverts ) return NULL; // probably this never happens
|
if( !lnumverts ) return NULL; // probably this never happens
|
||||||
|
|
||||||
// allocate glpoly
|
// allocate glpoly
|
||||||
poly = Mem_Calloc( com_studiocache, sizeof( glpoly_t ) + ( lnumverts - 4 ) * VERTEXSIZE * sizeof( float ));
|
// REFTODO: com_studiocache pool!
|
||||||
|
poly = Mem_Calloc( r_temppool, sizeof( glpoly_t ) + ( lnumverts - 4 ) * VERTEXSIZE * sizeof( float ));
|
||||||
poly->next = pdecal->polys;
|
poly->next = pdecal->polys;
|
||||||
poly->flags = surf->flags;
|
poly->flags = surf->flags;
|
||||||
pdecal->polys = poly;
|
pdecal->polys = poly;
|
||||||
@ -617,9 +619,10 @@ void R_DecalSurface( msurface_t *surf, decalinfo_t *decalinfo )
|
|||||||
decal_t *decal = surf->pdecals;
|
decal_t *decal = surf->pdecals;
|
||||||
vec4_t textureU, textureV;
|
vec4_t textureU, textureV;
|
||||||
float s, t, w, h;
|
float s, t, w, h;
|
||||||
|
ref_connstate_t state = gEngfuncs.CL_GetConnState();
|
||||||
|
|
||||||
// we in restore mode
|
// we in restore mode
|
||||||
if( cls.state == ca_connected || cls.state == ca_validate )
|
if( state == ref_ca_connected || state == ref_ca_validate )
|
||||||
{
|
{
|
||||||
// NOTE: we may have the decal on this surface that come from another level.
|
// NOTE: we may have the decal on this surface that come from another level.
|
||||||
// check duplicate with same position and texture
|
// check duplicate with same position and texture
|
||||||
@ -758,7 +761,7 @@ void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos
|
|||||||
|
|
||||||
if( textureIndex <= 0 || textureIndex >= MAX_TEXTURES )
|
if( textureIndex <= 0 || textureIndex >= MAX_TEXTURES )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "Decal has invalid texture!\n" );
|
gEngfuncs.Con_Printf( S_ERROR "Decal has invalid texture!\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,19 +769,19 @@ void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos
|
|||||||
{
|
{
|
||||||
ent = CL_GetEntityByIndex( entityIndex );
|
ent = CL_GetEntityByIndex( entityIndex );
|
||||||
|
|
||||||
if( modelIndex > 0 ) model = CL_ModelHandle( modelIndex );
|
if( modelIndex > 0 ) model = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
||||||
else if( ent != NULL ) model = CL_ModelHandle( ent->curstate.modelindex );
|
else if( ent != NULL ) model = gEngfuncs.pfnGetModelByIndex( ent->curstate.modelindex );
|
||||||
else return;
|
else return;
|
||||||
}
|
}
|
||||||
else if( modelIndex > 0 )
|
else if( modelIndex > 0 )
|
||||||
model = CL_ModelHandle( modelIndex );
|
model = gEngfuncs.pfnGetModelByIndex( modelIndex );
|
||||||
else model = WORLDMODEL;
|
else model = WORLDMODEL;
|
||||||
|
|
||||||
if( !model ) return;
|
if( !model ) return;
|
||||||
|
|
||||||
if( model->type != mod_brush )
|
if( model->type != mod_brush )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "Decals must hit mod_brush!\n" );
|
gEngfuncs.Con_Printf( S_ERROR "Decals must hit mod_brush!\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,9 +145,9 @@ void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( cols > glConfig.max_2d_texture_size )
|
if( cols > glConfig.max_2d_texture_size )
|
||||||
Host_Error( "R_DrawStretchRaw: size %i exceeds hardware limits\n", cols );
|
gEngfuncs.Host_Error( "R_DrawStretchRaw: size %i exceeds hardware limits\n", cols );
|
||||||
if( rows > glConfig.max_2d_texture_size )
|
if( rows > glConfig.max_2d_texture_size )
|
||||||
Host_Error( "R_DrawStretchRaw: size %i exceeds hardware limits\n", rows );
|
gEngfuncs.Host_Error( "R_DrawStretchRaw: size %i exceeds hardware limits\n", rows );
|
||||||
|
|
||||||
pglDisable( GL_BLEND );
|
pglDisable( GL_BLEND );
|
||||||
pglDisable( GL_ALPHA_TEST );
|
pglDisable( GL_ALPHA_TEST );
|
||||||
@ -220,9 +220,9 @@ void R_UploadStretchRaw( int texture, int cols, int rows, int width, int height,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( cols > glConfig.max_2d_texture_size )
|
if( cols > glConfig.max_2d_texture_size )
|
||||||
Host_Error( "R_UploadStretchRaw: size %i exceeds hardware limits\n", cols );
|
gEngfuncs.Host_Error( "R_UploadStretchRaw: size %i exceeds hardware limits\n", cols );
|
||||||
if( rows > glConfig.max_2d_texture_size )
|
if( rows > glConfig.max_2d_texture_size )
|
||||||
Host_Error( "R_UploadStretchRaw: size %i exceeds hardware limits\n", rows );
|
gEngfuncs.Host_Error( "R_UploadStretchRaw: size %i exceeds hardware limits\n", rows );
|
||||||
|
|
||||||
tex = R_GetTexture( texture );
|
tex = R_GetTexture( texture );
|
||||||
GL_Bind( GL_KEEP_UNIT, texture );
|
GL_Bind( GL_KEEP_UNIT, texture );
|
||||||
|
@ -14,6 +14,7 @@ GNU General Public License for more details.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
#define TEXTURES_HASH_SIZE (MAX_TEXTURES >> 2)
|
#define TEXTURES_HASH_SIZE (MAX_TEXTURES >> 2)
|
||||||
|
|
||||||
@ -460,7 +461,7 @@ static size_t GL_CalcTextureSize( GLenum format, int width, int height, int dept
|
|||||||
size = width * height * depth * 4;
|
size = width * height * depth * 4;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Host_Error( "GL_CalcTextureSize: bad texture internal format (%u)\n", format );
|
gEngfuncs.Host_Error( "GL_CalcTextureSize: bad texture internal format (%u)\n", format );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1063,7 +1064,7 @@ static void GL_CheckTexImageError( gl_texture_t *tex )
|
|||||||
|
|
||||||
// catch possible errors
|
// catch possible errors
|
||||||
if( CVAR_TO_BOOL( gl_check_errors ) && ( err = pglGetError()) != GL_NO_ERROR )
|
if( CVAR_TO_BOOL( gl_check_errors ) && ( err = pglGetError()) != GL_NO_ERROR )
|
||||||
Con_Printf( S_OPENGL_ERROR "%s while uploading %s [%s]\n", GL_ErrorString( err ), tex->name, GL_TargetToString( tex->target ));
|
gEngfuncs.Con_Printf( S_OPENGL_ERROR "%s while uploading %s [%s]\n", GL_ErrorString( err ), tex->name, GL_TargetToString( tex->target ));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1091,7 +1092,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic )
|
|||||||
// make sure what target is correct
|
// make sure what target is correct
|
||||||
if( tex->target == GL_NONE )
|
if( tex->target == GL_NONE )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "GL_UploadTexture: %s is not supported by your hardware\n", tex->name );
|
gEngfuncs.Con_DPrintf( S_ERROR "GL_UploadTexture: %s is not supported by your hardware\n", tex->name );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1106,7 +1107,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic )
|
|||||||
if(( pic->width * pic->height ) & 3 )
|
if(( pic->width * pic->height ) & 3 )
|
||||||
{
|
{
|
||||||
// will be resampled, just tell me for debug targets
|
// will be resampled, just tell me for debug targets
|
||||||
Con_Reportf( "GL_UploadTexture: %s s&3 [%d x %d]\n", tex->name, pic->width, pic->height );
|
gEngfuncs.Con_Reportf( "GL_UploadTexture: %s s&3 [%d x %d]\n", tex->name, pic->width, pic->height );
|
||||||
}
|
}
|
||||||
|
|
||||||
buf = pic->buffer;
|
buf = pic->buffer;
|
||||||
@ -1124,7 +1125,7 @@ static qboolean GL_UploadTexture( gl_texture_t *tex, rgbdata_t *pic )
|
|||||||
{
|
{
|
||||||
// track the buffer bounds
|
// track the buffer bounds
|
||||||
if( buf != NULL && buf >= bufend )
|
if( buf != NULL && buf >= bufend )
|
||||||
Host_Error( "GL_UploadTexture: %s image buffer overflow\n", tex->name );
|
gEngfuncs.Host_Error( "GL_UploadTexture: %s image buffer overflow\n", tex->name );
|
||||||
|
|
||||||
if( ImageDXT( pic->type ))
|
if( ImageDXT( pic->type ))
|
||||||
{
|
{
|
||||||
@ -1274,7 +1275,7 @@ qboolean GL_CheckTexName( const char *name )
|
|||||||
// because multi-layered textures can exceed name string
|
// because multi-layered textures can exceed name string
|
||||||
if( Q_strlen( name ) >= sizeof( gl_textures->name ))
|
if( Q_strlen( name ) >= sizeof( gl_textures->name ))
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "LoadTexture: too long name %s (%d)\n", name, Q_strlen( name ));
|
gEngfuncs.Con_Printf( S_ERROR "LoadTexture: too long name %s (%d)\n", name, Q_strlen( name ));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1292,7 +1293,7 @@ static gl_texture_t *GL_TextureForName( const char *name )
|
|||||||
uint hash;
|
uint hash;
|
||||||
|
|
||||||
// find the texture in array
|
// find the texture in array
|
||||||
hash = COM_HashKey( name, TEXTURES_HASH_SIZE );
|
hash = gEngfuncs.COM_HashKey( name, TEXTURES_HASH_SIZE );
|
||||||
|
|
||||||
for( tex = gl_texturesHashTable[hash]; tex != NULL; tex = tex->nextHash )
|
for( tex = gl_texturesHashTable[hash]; tex != NULL; tex = tex->nextHash )
|
||||||
{
|
{
|
||||||
@ -1320,7 +1321,7 @@ static gl_texture_t *GL_AllocTexture( const char *name, texFlags_t flags )
|
|||||||
if( i == gl_numTextures )
|
if( i == gl_numTextures )
|
||||||
{
|
{
|
||||||
if( gl_numTextures == MAX_TEXTURES )
|
if( gl_numTextures == MAX_TEXTURES )
|
||||||
Host_Error( "GL_AllocTexture: MAX_TEXTURES limit exceeds\n" );
|
gEngfuncs.Host_Error( "GL_AllocTexture: MAX_TEXTURES limit exceeds\n" );
|
||||||
gl_numTextures++;
|
gl_numTextures++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1334,7 +1335,7 @@ static gl_texture_t *GL_AllocTexture( const char *name, texFlags_t flags )
|
|||||||
tex->flags = flags;
|
tex->flags = flags;
|
||||||
|
|
||||||
// add to hash table
|
// add to hash table
|
||||||
tex->hashValue = COM_HashKey( name, TEXTURES_HASH_SIZE );
|
tex->hashValue = gEngfuncs.COM_HashKey( name, TEXTURES_HASH_SIZE );
|
||||||
tex->nextHash = gl_texturesHashTable[tex->hashValue];
|
tex->nextHash = gl_texturesHashTable[tex->hashValue];
|
||||||
gl_texturesHashTable[tex->hashValue] = tex;
|
gl_texturesHashTable[tex->hashValue] = tex;
|
||||||
|
|
||||||
@ -1359,7 +1360,7 @@ static void GL_DeleteTexture( gl_texture_t *tex )
|
|||||||
// debug
|
// debug
|
||||||
if( !tex->name[0] )
|
if( !tex->name[0] )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_DeleteTexture: trying to free unnamed texture with texnum %i\n", tex->texnum );
|
gEngfuncs.Con_Printf( S_ERROR "GL_DeleteTexture: trying to free unnamed texture with texnum %i\n", tex->texnum );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1523,20 +1524,20 @@ int GL_LoadTextureArray( const char **names, int flags )
|
|||||||
// mixed mode: DXT + RGB
|
// mixed mode: DXT + RGB
|
||||||
if( pic->type != src->type )
|
if( pic->type != src->type )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch image format for %s and %s\n", names[0], names[i] );
|
gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch image format for %s and %s\n", names[0], names[i] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// different mipcount
|
// different mipcount
|
||||||
if( pic->numMips != src->numMips )
|
if( pic->numMips != src->numMips )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch mip count for %s and %s\n", names[0], names[i] );
|
gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch mip count for %s and %s\n", names[0], names[i] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pic->encode != src->encode )
|
if( pic->encode != src->encode )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch custom encoding for %s and %s\n", names[0], names[i] );
|
gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch custom encoding for %s and %s\n", names[0], names[i] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,7 +1547,7 @@ int GL_LoadTextureArray( const char **names, int flags )
|
|||||||
|
|
||||||
if( pic->size != src->size )
|
if( pic->size != src->size )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch image size for %s and %s\n", names[0], names[i] );
|
gEngfuncs.Con_Printf( S_ERROR "GL_LoadTextureArray: mismatch image size for %s and %s\n", names[0], names[i] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1582,7 +1583,7 @@ int GL_LoadTextureArray( const char **names, int flags )
|
|||||||
// there were errors
|
// there were errors
|
||||||
if( !pic || ( pic->depth != numLayers ))
|
if( !pic || ( pic->depth != numLayers ))
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_LoadTextureArray: not all layers were loaded. Texture array is not created\n" );
|
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 ) FS_FreeImage( pic );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1631,7 +1632,7 @@ int GL_LoadTextureFromBuffer( const char *name, rgbdata_t *pic, texFlags_t flags
|
|||||||
if( update )
|
if( update )
|
||||||
{
|
{
|
||||||
if( tex == NULL )
|
if( tex == NULL )
|
||||||
Host_Error( "GL_LoadTextureFromBuffer: couldn't find texture %s for update\n", name );
|
gEngfuncs.Host_Error( "GL_LoadTextureFromBuffer: couldn't find texture %s for update\n", name );
|
||||||
SetBits( tex->flags, flags );
|
SetBits( tex->flags, flags );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1799,19 +1800,19 @@ void GL_ProcessTexture( int texnum, float gamma, int topColor, int bottomColor )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_ProcessTexture: bad operation for %s\n", image->name );
|
gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: bad operation for %s\n", image->name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !image->original )
|
if( !image->original )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_ProcessTexture: no input data for %s\n", image->name );
|
gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: no input data for %s\n", image->name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ImageDXT( image->original->type ))
|
if( ImageDXT( image->original->type ))
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "GL_ProcessTexture: can't process compressed texture %s\n", image->name );
|
gEngfuncs.Con_Printf( S_ERROR "GL_ProcessTexture: can't process compressed texture %s\n", image->name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1960,8 +1961,8 @@ void R_TextureList_f( void )
|
|||||||
gl_texture_t *image;
|
gl_texture_t *image;
|
||||||
int i, texCount, bytes = 0;
|
int i, texCount, bytes = 0;
|
||||||
|
|
||||||
Con_Printf( "\n" );
|
gEngfuncs.Con_Printf( "\n" );
|
||||||
Con_Printf( " -id- -w- -h- -size- -fmt- -type- -data- -encode- -wrap- -depth- -name--------\n" );
|
gEngfuncs.Con_Printf( " -id- -w- -h- -size- -fmt- -type- -data- -encode- -wrap- -depth- -name--------\n" );
|
||||||
|
|
||||||
for( i = texCount = 0, image = gl_textures; i < gl_numTextures; i++, image++ )
|
for( i = texCount = 0, image = gl_textures; i < gl_numTextures; i++, image++ )
|
||||||
{
|
{
|
||||||
@ -1970,192 +1971,192 @@ void R_TextureList_f( void )
|
|||||||
bytes += image->size;
|
bytes += image->size;
|
||||||
texCount++;
|
texCount++;
|
||||||
|
|
||||||
Con_Printf( "%4i: ", i );
|
gEngfuncs.Con_Printf( "%4i: ", i );
|
||||||
Con_Printf( "%4i %4i ", image->width, image->height );
|
gEngfuncs.Con_Printf( "%4i %4i ", image->width, image->height );
|
||||||
Con_Printf( "%12s ", Q_memprint( image->size ));
|
gEngfuncs.Con_Printf( "%12s ", Q_memprint( image->size ));
|
||||||
|
|
||||||
switch( image->format )
|
switch( image->format )
|
||||||
{
|
{
|
||||||
case GL_COMPRESSED_RGBA_ARB:
|
case GL_COMPRESSED_RGBA_ARB:
|
||||||
Con_Printf( "CRGBA " );
|
gEngfuncs.Con_Printf( "CRGBA " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_RGB_ARB:
|
case GL_COMPRESSED_RGB_ARB:
|
||||||
Con_Printf( "CRGB " );
|
gEngfuncs.Con_Printf( "CRGB " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
|
case GL_COMPRESSED_LUMINANCE_ALPHA_ARB:
|
||||||
Con_Printf( "CLA " );
|
gEngfuncs.Con_Printf( "CLA " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_LUMINANCE_ARB:
|
case GL_COMPRESSED_LUMINANCE_ARB:
|
||||||
Con_Printf( "CL " );
|
gEngfuncs.Con_Printf( "CL " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_ALPHA_ARB:
|
case GL_COMPRESSED_ALPHA_ARB:
|
||||||
Con_Printf( "CA " );
|
gEngfuncs.Con_Printf( "CA " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_INTENSITY_ARB:
|
case GL_COMPRESSED_INTENSITY_ARB:
|
||||||
Con_Printf( "CI " );
|
gEngfuncs.Con_Printf( "CI " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
|
||||||
Con_Printf( "DXT1c " );
|
gEngfuncs.Con_Printf( "DXT1c " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
|
||||||
Con_Printf( "DXT1a " );
|
gEngfuncs.Con_Printf( "DXT1a " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT:
|
||||||
Con_Printf( "DXT3 " );
|
gEngfuncs.Con_Printf( "DXT3 " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
|
||||||
Con_Printf( "DXT5 " );
|
gEngfuncs.Con_Printf( "DXT5 " );
|
||||||
break;
|
break;
|
||||||
case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
|
case GL_COMPRESSED_RED_GREEN_RGTC2_EXT:
|
||||||
Con_Printf( "ATI2 " );
|
gEngfuncs.Con_Printf( "ATI2 " );
|
||||||
break;
|
break;
|
||||||
case GL_RGBA:
|
case GL_RGBA:
|
||||||
Con_Printf( "RGBA " );
|
gEngfuncs.Con_Printf( "RGBA " );
|
||||||
break;
|
break;
|
||||||
case GL_RGBA8:
|
case GL_RGBA8:
|
||||||
Con_Printf( "RGBA8 " );
|
gEngfuncs.Con_Printf( "RGBA8 " );
|
||||||
break;
|
break;
|
||||||
case GL_RGBA4:
|
case GL_RGBA4:
|
||||||
Con_Printf( "RGBA4 " );
|
gEngfuncs.Con_Printf( "RGBA4 " );
|
||||||
break;
|
break;
|
||||||
case GL_RGB:
|
case GL_RGB:
|
||||||
Con_Printf( "RGB " );
|
gEngfuncs.Con_Printf( "RGB " );
|
||||||
break;
|
break;
|
||||||
case GL_RGB8:
|
case GL_RGB8:
|
||||||
Con_Printf( "RGB8 " );
|
gEngfuncs.Con_Printf( "RGB8 " );
|
||||||
break;
|
break;
|
||||||
case GL_RGB5:
|
case GL_RGB5:
|
||||||
Con_Printf( "RGB5 " );
|
gEngfuncs.Con_Printf( "RGB5 " );
|
||||||
break;
|
break;
|
||||||
case GL_LUMINANCE4_ALPHA4:
|
case GL_LUMINANCE4_ALPHA4:
|
||||||
Con_Printf( "L4A4 " );
|
gEngfuncs.Con_Printf( "L4A4 " );
|
||||||
break;
|
break;
|
||||||
case GL_LUMINANCE_ALPHA:
|
case GL_LUMINANCE_ALPHA:
|
||||||
case GL_LUMINANCE8_ALPHA8:
|
case GL_LUMINANCE8_ALPHA8:
|
||||||
Con_Printf( "L8A8 " );
|
gEngfuncs.Con_Printf( "L8A8 " );
|
||||||
break;
|
break;
|
||||||
case GL_LUMINANCE4:
|
case GL_LUMINANCE4:
|
||||||
Con_Printf( "L4 " );
|
gEngfuncs.Con_Printf( "L4 " );
|
||||||
break;
|
break;
|
||||||
case GL_LUMINANCE:
|
case GL_LUMINANCE:
|
||||||
case GL_LUMINANCE8:
|
case GL_LUMINANCE8:
|
||||||
Con_Printf( "L8 " );
|
gEngfuncs.Con_Printf( "L8 " );
|
||||||
break;
|
break;
|
||||||
case GL_ALPHA8:
|
case GL_ALPHA8:
|
||||||
Con_Printf( "A8 " );
|
gEngfuncs.Con_Printf( "A8 " );
|
||||||
break;
|
break;
|
||||||
case GL_INTENSITY8:
|
case GL_INTENSITY8:
|
||||||
Con_Printf( "I8 " );
|
gEngfuncs.Con_Printf( "I8 " );
|
||||||
break;
|
break;
|
||||||
case GL_DEPTH_COMPONENT:
|
case GL_DEPTH_COMPONENT:
|
||||||
case GL_DEPTH_COMPONENT24:
|
case GL_DEPTH_COMPONENT24:
|
||||||
Con_Printf( "DPTH24" );
|
gEngfuncs.Con_Printf( "DPTH24" );
|
||||||
break;
|
break;
|
||||||
case GL_DEPTH_COMPONENT32F:
|
case GL_DEPTH_COMPONENT32F:
|
||||||
Con_Printf( "DPTH32" );
|
gEngfuncs.Con_Printf( "DPTH32" );
|
||||||
break;
|
break;
|
||||||
case GL_LUMINANCE16F_ARB:
|
case GL_LUMINANCE16F_ARB:
|
||||||
Con_Printf( "L16F " );
|
gEngfuncs.Con_Printf( "L16F " );
|
||||||
break;
|
break;
|
||||||
case GL_LUMINANCE32F_ARB:
|
case GL_LUMINANCE32F_ARB:
|
||||||
Con_Printf( "L32F " );
|
gEngfuncs.Con_Printf( "L32F " );
|
||||||
break;
|
break;
|
||||||
case GL_LUMINANCE_ALPHA16F_ARB:
|
case GL_LUMINANCE_ALPHA16F_ARB:
|
||||||
Con_Printf( "LA16F " );
|
gEngfuncs.Con_Printf( "LA16F " );
|
||||||
break;
|
break;
|
||||||
case GL_LUMINANCE_ALPHA32F_ARB:
|
case GL_LUMINANCE_ALPHA32F_ARB:
|
||||||
Con_Printf( "LA32F " );
|
gEngfuncs.Con_Printf( "LA32F " );
|
||||||
break;
|
break;
|
||||||
case GL_RG16F:
|
case GL_RG16F:
|
||||||
Con_Printf( "RG16F " );
|
gEngfuncs.Con_Printf( "RG16F " );
|
||||||
break;
|
break;
|
||||||
case GL_RG32F:
|
case GL_RG32F:
|
||||||
Con_Printf( "RG32F " );
|
gEngfuncs.Con_Printf( "RG32F " );
|
||||||
break;
|
break;
|
||||||
case GL_RGB16F_ARB:
|
case GL_RGB16F_ARB:
|
||||||
Con_Printf( "RGB16F" );
|
gEngfuncs.Con_Printf( "RGB16F" );
|
||||||
break;
|
break;
|
||||||
case GL_RGB32F_ARB:
|
case GL_RGB32F_ARB:
|
||||||
Con_Printf( "RGB32F" );
|
gEngfuncs.Con_Printf( "RGB32F" );
|
||||||
break;
|
break;
|
||||||
case GL_RGBA16F_ARB:
|
case GL_RGBA16F_ARB:
|
||||||
Con_Printf( "RGBA16F" );
|
gEngfuncs.Con_Printf( "RGBA16F" );
|
||||||
break;
|
break;
|
||||||
case GL_RGBA32F_ARB:
|
case GL_RGBA32F_ARB:
|
||||||
Con_Printf( "RGBA32F" );
|
gEngfuncs.Con_Printf( "RGBA32F" );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Con_Printf( " ^1ERROR^7 " );
|
gEngfuncs.Con_Printf( " ^1ERROR^7 " );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch( image->target )
|
switch( image->target )
|
||||||
{
|
{
|
||||||
case GL_TEXTURE_1D:
|
case GL_TEXTURE_1D:
|
||||||
Con_Printf( " 1D " );
|
gEngfuncs.Con_Printf( " 1D " );
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_2D:
|
case GL_TEXTURE_2D:
|
||||||
Con_Printf( " 2D " );
|
gEngfuncs.Con_Printf( " 2D " );
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_3D:
|
case GL_TEXTURE_3D:
|
||||||
Con_Printf( " 3D " );
|
gEngfuncs.Con_Printf( " 3D " );
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_CUBE_MAP_ARB:
|
case GL_TEXTURE_CUBE_MAP_ARB:
|
||||||
Con_Printf( "CUBE " );
|
gEngfuncs.Con_Printf( "CUBE " );
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_RECTANGLE_EXT:
|
case GL_TEXTURE_RECTANGLE_EXT:
|
||||||
Con_Printf( "RECT " );
|
gEngfuncs.Con_Printf( "RECT " );
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_2D_ARRAY_EXT:
|
case GL_TEXTURE_2D_ARRAY_EXT:
|
||||||
Con_Printf( "ARRAY " );
|
gEngfuncs.Con_Printf( "ARRAY " );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Con_Printf( "???? " );
|
gEngfuncs.Con_Printf( "???? " );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( image->flags & TF_NORMALMAP )
|
if( image->flags & TF_NORMALMAP )
|
||||||
Con_Printf( "normal " );
|
gEngfuncs.Con_Printf( "normal " );
|
||||||
else Con_Printf( "diffuse " );
|
else Con_Printf( "diffuse " );
|
||||||
|
|
||||||
switch( image->encode )
|
switch( image->encode )
|
||||||
{
|
{
|
||||||
case DXT_ENCODE_COLOR_YCoCg:
|
case DXT_ENCODE_COLOR_YCoCg:
|
||||||
Con_Printf( "YCoCg " );
|
gEngfuncs.Con_Printf( "YCoCg " );
|
||||||
break;
|
break;
|
||||||
case DXT_ENCODE_NORMAL_AG_ORTHO:
|
case DXT_ENCODE_NORMAL_AG_ORTHO:
|
||||||
Con_Printf( "ortho " );
|
gEngfuncs.Con_Printf( "ortho " );
|
||||||
break;
|
break;
|
||||||
case DXT_ENCODE_NORMAL_AG_STEREO:
|
case DXT_ENCODE_NORMAL_AG_STEREO:
|
||||||
Con_Printf( "stereo " );
|
gEngfuncs.Con_Printf( "stereo " );
|
||||||
break;
|
break;
|
||||||
case DXT_ENCODE_NORMAL_AG_PARABOLOID:
|
case DXT_ENCODE_NORMAL_AG_PARABOLOID:
|
||||||
Con_Printf( "parabolic " );
|
gEngfuncs.Con_Printf( "parabolic " );
|
||||||
break;
|
break;
|
||||||
case DXT_ENCODE_NORMAL_AG_QUARTIC:
|
case DXT_ENCODE_NORMAL_AG_QUARTIC:
|
||||||
Con_Printf( "quartic " );
|
gEngfuncs.Con_Printf( "quartic " );
|
||||||
break;
|
break;
|
||||||
case DXT_ENCODE_NORMAL_AG_AZIMUTHAL:
|
case DXT_ENCODE_NORMAL_AG_AZIMUTHAL:
|
||||||
Con_Printf( "azimuthal " );
|
gEngfuncs.Con_Printf( "azimuthal " );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Con_Printf( "default " );
|
gEngfuncs.Con_Printf( "default " );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( image->flags & TF_CLAMP )
|
if( image->flags & TF_CLAMP )
|
||||||
Con_Printf( "clamp " );
|
gEngfuncs.Con_Printf( "clamp " );
|
||||||
else if( image->flags & TF_BORDER )
|
else if( image->flags & TF_BORDER )
|
||||||
Con_Printf( "border " );
|
gEngfuncs.Con_Printf( "border " );
|
||||||
else Con_Printf( "repeat " );
|
else Con_Printf( "repeat " );
|
||||||
Con_Printf( " %d ", image->depth );
|
gEngfuncs.Con_Printf( " %d ", image->depth );
|
||||||
Con_Printf( " %s\n", image->name );
|
gEngfuncs.Con_Printf( " %s\n", image->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Printf( "---------------------------------------------------------\n" );
|
gEngfuncs.Con_Printf( "---------------------------------------------------------\n" );
|
||||||
Con_Printf( "%i total textures\n", texCount );
|
gEngfuncs.Con_Printf( "%i total textures\n", texCount );
|
||||||
Con_Printf( "%s total memory used\n", Q_memprint( bytes ));
|
gEngfuncs.Con_Printf( "%s total memory used\n", Q_memprint( bytes ));
|
||||||
Con_Printf( "\n" );
|
gEngfuncs.Con_Printf( "\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2171,7 +2172,7 @@ void R_InitImages( void )
|
|||||||
|
|
||||||
// create unused 0-entry
|
// create unused 0-entry
|
||||||
Q_strncpy( gl_textures->name, "*unused*", sizeof( gl_textures->name ));
|
Q_strncpy( gl_textures->name, "*unused*", sizeof( gl_textures->name ));
|
||||||
gl_textures->hashValue = COM_HashKey( gl_textures->name, TEXTURES_HASH_SIZE );
|
gl_textures->hashValue = gEngfuncs.COM_HashKey( gl_textures->name, TEXTURES_HASH_SIZE );
|
||||||
gl_textures->nextHash = gl_texturesHashTable[gl_textures->hashValue];
|
gl_textures->nextHash = gl_texturesHashTable[gl_textures->hashValue];
|
||||||
gl_texturesHashTable[gl_textures->hashValue] = gl_textures;
|
gl_texturesHashTable[gl_textures->hashValue] = gl_textures;
|
||||||
gl_numTextures = 1;
|
gl_numTextures = 1;
|
||||||
@ -2180,7 +2181,7 @@ void R_InitImages( void )
|
|||||||
R_SetTextureParameters();
|
R_SetTextureParameters();
|
||||||
GL_CreateInternalTextures();
|
GL_CreateInternalTextures();
|
||||||
|
|
||||||
Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
|
gEngfuncs.Cmd_AddCommand( "texturelist", R_TextureList_f, "display loaded textures list" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2193,7 +2194,7 @@ void R_ShutdownImages( void )
|
|||||||
gl_texture_t *tex;
|
gl_texture_t *tex;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
Cmd_RemoveCommand( "texturelist" );
|
gEngfuncs.Cmd_RemoveCommand( "texturelist" );
|
||||||
GL_CleanupAllTextureUnits();
|
GL_CleanupAllTextureUnits();
|
||||||
|
|
||||||
for( i = 0, tex = gl_textures; i < gl_numTextures; i++, tex++ )
|
for( i = 0, tex = gl_textures; i < gl_numTextures; i++, tex++ )
|
||||||
|
@ -32,27 +32,20 @@ GNU General Public License for more details.
|
|||||||
#include "enginefeatures.h"
|
#include "enginefeatures.h"
|
||||||
#include "com_strings.h"
|
#include "com_strings.h"
|
||||||
#include "pm_movevars.h"
|
#include "pm_movevars.h"
|
||||||
|
#include "cvar.h"
|
||||||
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
#define offsetof(s,m) (size_t)&(((s *)0)->m)
|
||||||
|
|
||||||
typedef cvar_t convar_t;
|
|
||||||
void CL_DrawEFX(double, double);
|
void CL_DrawEFX(double, double);
|
||||||
void *CL_ModelHandle(int);
|
|
||||||
void *GL_GetProcAddress(char *);
|
void *GL_GetProcAddress(char *);
|
||||||
void GL_CheckForErrors();
|
void GL_CheckForErrors();
|
||||||
void CL_ExtraUpdate();
|
void CL_ExtraUpdate();
|
||||||
void Cbuf_Execute();
|
void Cbuf_Execute();
|
||||||
extern convar_t cvstub;
|
|
||||||
#define Cvar_Get(...) &cvstub
|
|
||||||
#define Cvar_SetValue(...)
|
#define Cvar_SetValue(...)
|
||||||
#define Cmd_AddCommand(...)
|
|
||||||
#define Cmd_RemoveCommand(...)
|
|
||||||
#define FS_FreeImage(...)
|
#define FS_FreeImage(...)
|
||||||
#define Host_Error(...)
|
|
||||||
#define ASSERT(x)
|
#define ASSERT(x)
|
||||||
#define Assert(x)
|
#define Assert(x)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#define Con_Reportf gEngfuncs.Con_DPrintf
|
|
||||||
|
|
||||||
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) convar_t cv = { cvname, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
#define CVAR_DEFINE( cv, cvname, cvstr, cvflags, cvdesc ) convar_t cv = { cvname, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
||||||
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) convar_t cv = { #cv, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
#define CVAR_DEFINE_AUTO( cv, cvstr, cvflags, cvdesc ) convar_t cv = { #cv, cvstr, cvflags, 0.0f, (void *)CVAR_SENTINEL, cvdesc }
|
||||||
@ -316,6 +309,7 @@ void GL_TextureTarget( uint target );
|
|||||||
void GL_Cull( GLenum cull );
|
void GL_Cull( GLenum cull );
|
||||||
void R_ShowTextures( void );
|
void R_ShowTextures( void );
|
||||||
void R_ShowTree( void );
|
void R_ShowTree( void );
|
||||||
|
void SCR_TimeRefresh_f( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// gl_cull.c
|
// gl_cull.c
|
||||||
@ -380,6 +374,7 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount );
|
|||||||
//
|
//
|
||||||
// gl_rlight.c
|
// gl_rlight.c
|
||||||
//
|
//
|
||||||
|
void CL_RunLightStyles( void );
|
||||||
void R_PushDlights( void );
|
void R_PushDlights( void );
|
||||||
void R_AnimateLight( void );
|
void R_AnimateLight( void );
|
||||||
void R_GetLightSpot( vec3_t lightspot );
|
void R_GetLightSpot( vec3_t lightspot );
|
||||||
@ -747,12 +742,24 @@ extern convar_t *r_vbo_dlightmode;
|
|||||||
|
|
||||||
extern convar_t *vid_brightness;
|
extern convar_t *vid_brightness;
|
||||||
extern convar_t *vid_gamma;
|
extern convar_t *vid_gamma;
|
||||||
extern convar_t *vid_highdpi;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// engine shared convars
|
// engine shared convars
|
||||||
//
|
//
|
||||||
extern convar_t *v_dark;
|
extern convar_t *v_dark;
|
||||||
|
extern convar_t *cl_draw_beams;
|
||||||
|
extern convar_t *cl_draw_particles;
|
||||||
|
extern convar_t *cl_draw_tracers;
|
||||||
|
extern convar_t *gl_showtextures;
|
||||||
|
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;
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// engine callbacks
|
// engine callbacks
|
||||||
@ -769,11 +776,6 @@ FORCEINLINE int COM_RandomLong( int rmin, int rmax )
|
|||||||
return gEngfuncs.COM_RandomLong( rmin, rmax );
|
return gEngfuncs.COM_RandomLong( rmin, rmax );
|
||||||
}
|
}
|
||||||
|
|
||||||
FORCEINLINE uint COM_HashKey( const char *str, uint hashSize )
|
|
||||||
{
|
|
||||||
return gEngfuncs.COM_HashKey( str, hashSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
FORCEINLINE byte *_Mem_AllocPool( const char *name, const char *filename, int fileline )
|
FORCEINLINE byte *_Mem_AllocPool( const char *name, const char *filename, int fileline )
|
||||||
{
|
{
|
||||||
return gEngfuncs._Mem_AllocPool( name, filename, fileline );
|
return gEngfuncs._Mem_AllocPool( name, filename, fileline );
|
||||||
|
@ -245,24 +245,23 @@ static void APIENTRY GL_DebugOutput( GLuint source, GLuint type, GLuint id, GLui
|
|||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
case GL_DEBUG_TYPE_ERROR_ARB:
|
case GL_DEBUG_TYPE_ERROR_ARB:
|
||||||
Con_Printf( S_OPENGL_ERROR "%s\n", message );
|
gEngfuncs.Con_Printf( S_OPENGL_ERROR "%s\n", message );
|
||||||
break;
|
break;
|
||||||
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB:
|
case GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB:
|
||||||
Con_Printf( S_OPENGL_WARN "%s\n", message );
|
gEngfuncs.Con_Printf( S_OPENGL_WARN "%s\n", message );
|
||||||
break;
|
break;
|
||||||
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB:
|
case GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB:
|
||||||
Con_Printf( S_OPENGL_WARN "%s\n", message );
|
gEngfuncs.Con_Printf( S_OPENGL_WARN "%s\n", message );
|
||||||
break;
|
break;
|
||||||
case GL_DEBUG_TYPE_PORTABILITY_ARB:
|
case GL_DEBUG_TYPE_PORTABILITY_ARB:
|
||||||
if( gpGlobals->developer < DEV_EXTENDED )
|
gEngfuncs.Con_Reportf( S_OPENGL_WARN "%s\n", message );
|
||||||
return;
|
|
||||||
Con_Printf( S_OPENGL_WARN "%s\n", message );
|
|
||||||
break;
|
break;
|
||||||
case GL_DEBUG_TYPE_PERFORMANCE_ARB:
|
case GL_DEBUG_TYPE_PERFORMANCE_ARB:
|
||||||
Con_Printf( S_OPENGL_NOTE "%s\n", message );
|
gEngfuncs.Con_Printf( S_OPENGL_NOTE "%s\n", message );
|
||||||
break;
|
break;
|
||||||
case GL_DEBUG_TYPE_OTHER_ARB:
|
case GL_DEBUG_TYPE_OTHER_ARB:
|
||||||
default: Con_Printf( S_OPENGL_NOTE "%s\n", message );
|
default:
|
||||||
|
gEngfuncs.Con_Printf( S_OPENGL_NOTE "%s\n", message );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -276,7 +275,7 @@ void GL_SetExtension( int r_ext, int enable )
|
|||||||
{
|
{
|
||||||
if( r_ext >= 0 && r_ext < GL_EXTCOUNT )
|
if( r_ext >= 0 && r_ext < GL_EXTCOUNT )
|
||||||
glConfig.extension[r_ext] = enable ? GL_TRUE : GL_FALSE;
|
glConfig.extension[r_ext] = enable ? GL_TRUE : GL_FALSE;
|
||||||
else Con_Printf( S_ERROR "GL_SetExtension: invalid extension %d\n", r_ext );
|
else gEngfuncs.Con_Printf( S_ERROR "GL_SetExtension: invalid extension %d\n", r_ext );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -288,7 +287,7 @@ qboolean GL_Support( int r_ext )
|
|||||||
{
|
{
|
||||||
if( r_ext >= 0 && r_ext < GL_EXTCOUNT )
|
if( r_ext >= 0 && r_ext < GL_EXTCOUNT )
|
||||||
return glConfig.extension[r_ext] ? true : false;
|
return glConfig.extension[r_ext] ? true : false;
|
||||||
Con_Printf( S_ERROR "GL_Support: invalid extension %d\n", r_ext );
|
gEngfuncs.Con_Printf( S_ERROR "GL_Support: invalid extension %d\n", r_ext );
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -316,7 +315,7 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
|
|||||||
convar_t *parm = NULL;
|
convar_t *parm = NULL;
|
||||||
const char *extensions_string;
|
const char *extensions_string;
|
||||||
|
|
||||||
Con_Reportf( "GL_CheckExtension: %s ", name );
|
gEngfuncs.Con_Reportf( "GL_CheckExtension: %s ", name );
|
||||||
GL_SetExtension( r_ext, true );
|
GL_SetExtension( r_ext, true );
|
||||||
|
|
||||||
if( cvarname )
|
if( cvarname )
|
||||||
@ -327,7 +326,7 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
|
|||||||
|
|
||||||
if(( parm && !CVAR_TO_BOOL( parm )) || ( !CVAR_TO_BOOL( gl_extensions ) && r_ext != GL_OPENGL_110 ))
|
if(( parm && !CVAR_TO_BOOL( parm )) || ( !CVAR_TO_BOOL( gl_extensions ) && r_ext != GL_OPENGL_110 ))
|
||||||
{
|
{
|
||||||
Con_Reportf( "- disabled\n" );
|
gEngfuncs.Con_Reportf( "- disabled\n" );
|
||||||
GL_SetExtension( r_ext, false );
|
GL_SetExtension( r_ext, false );
|
||||||
return; // nothing to process at
|
return; // nothing to process at
|
||||||
}
|
}
|
||||||
@ -337,7 +336,7 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
|
|||||||
if(( name[2] == '_' || name[3] == '_' ) && !Q_strstr( extensions_string, name ))
|
if(( name[2] == '_' || name[3] == '_' ) && !Q_strstr( extensions_string, name ))
|
||||||
{
|
{
|
||||||
GL_SetExtension( r_ext, false ); // update render info
|
GL_SetExtension( r_ext, false ); // update render info
|
||||||
Con_Reportf( "- ^1failed\n" );
|
gEngfuncs.Con_Reportf( "- ^1failed\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -348,13 +347,13 @@ void GL_CheckExtension( const char *name, const dllfunc_t *funcs, const char *cv
|
|||||||
for( func = funcs; func && func->name != NULL; func++ )
|
for( func = funcs; func && func->name != NULL; func++ )
|
||||||
{
|
{
|
||||||
// functions are cleared before all the extensions are evaluated
|
// functions are cleared before all the extensions are evaluated
|
||||||
if((*func->func = (void *)GL_GetProcAddress( func->name )) == NULL )
|
if((*func->func = (void *)gEngfuncs.GL_GetProcAddress( func->name )) == NULL )
|
||||||
GL_SetExtension( r_ext, false ); // one or more functions are invalid, extension will be disabled
|
GL_SetExtension( r_ext, false ); // one or more functions are invalid, extension will be disabled
|
||||||
}
|
}
|
||||||
|
|
||||||
if( GL_Support( r_ext ))
|
if( GL_Support( r_ext ))
|
||||||
Con_Reportf( "- ^2enabled\n" );
|
gEngfuncs.Con_Reportf( "- ^2enabled\n" );
|
||||||
else Con_Reportf( "- ^1failed\n" );
|
else gEngfuncs.Con_Reportf( "- ^1failed\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -410,7 +409,7 @@ static void GL_SetDefaults( void )
|
|||||||
pglDepthFunc( GL_LEQUAL );
|
pglDepthFunc( GL_LEQUAL );
|
||||||
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
pglColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
|
||||||
|
|
||||||
if( vidState.stencilEnabled )
|
if( glState.stencilEnabled )
|
||||||
{
|
{
|
||||||
pglDisable( GL_STENCIL_TEST );
|
pglDisable( GL_STENCIL_TEST );
|
||||||
pglStencilMask( ( GLuint ) ~0 );
|
pglStencilMask( ( GLuint ) ~0 );
|
||||||
@ -445,42 +444,39 @@ R_RenderInfo_f
|
|||||||
*/
|
*/
|
||||||
void R_RenderInfo_f( void )
|
void R_RenderInfo_f( void )
|
||||||
{
|
{
|
||||||
Con_Printf( "\n" );
|
gEngfuncs.Con_Printf( "\n" );
|
||||||
Con_Printf( "GL_VENDOR: %s\n", glConfig.vendor_string );
|
gEngfuncs.Con_Printf( "GL_VENDOR: %s\n", glConfig.vendor_string );
|
||||||
Con_Printf( "GL_RENDERER: %s\n", glConfig.renderer_string );
|
gEngfuncs.Con_Printf( "GL_RENDERER: %s\n", glConfig.renderer_string );
|
||||||
Con_Printf( "GL_VERSION: %s\n", glConfig.version_string );
|
gEngfuncs.Con_Printf( "GL_VERSION: %s\n", glConfig.version_string );
|
||||||
|
|
||||||
// don't spam about extensions
|
// don't spam about extensions
|
||||||
if( host_developer.value >= DEV_EXTENDED )
|
gEngfuncs.Con_Reportf( "GL_EXTENSIONS: %s\n", glConfig.extensions_string );
|
||||||
{
|
|
||||||
Con_Printf( "GL_EXTENSIONS: %s\n", glConfig.extensions_string );
|
|
||||||
}
|
|
||||||
|
|
||||||
Con_Printf( "GL_MAX_TEXTURE_SIZE: %i\n", glConfig.max_2d_texture_size );
|
gEngfuncs.Con_Printf( "GL_MAX_TEXTURE_SIZE: %i\n", glConfig.max_2d_texture_size );
|
||||||
|
|
||||||
if( GL_Support( GL_ARB_MULTITEXTURE ))
|
if( GL_Support( GL_ARB_MULTITEXTURE ))
|
||||||
Con_Printf( "GL_MAX_TEXTURE_UNITS_ARB: %i\n", glConfig.max_texture_units );
|
gEngfuncs.Con_Printf( "GL_MAX_TEXTURE_UNITS_ARB: %i\n", glConfig.max_texture_units );
|
||||||
if( GL_Support( GL_TEXTURE_CUBEMAP_EXT ))
|
if( GL_Support( GL_TEXTURE_CUBEMAP_EXT ))
|
||||||
Con_Printf( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: %i\n", glConfig.max_cubemap_size );
|
gEngfuncs.Con_Printf( "GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: %i\n", glConfig.max_cubemap_size );
|
||||||
if( GL_Support( GL_ANISOTROPY_EXT ))
|
if( GL_Support( GL_ANISOTROPY_EXT ))
|
||||||
Con_Printf( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: %.1f\n", glConfig.max_texture_anisotropy );
|
gEngfuncs.Con_Printf( "GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: %.1f\n", glConfig.max_texture_anisotropy );
|
||||||
if( GL_Support( GL_TEXTURE_2D_RECT_EXT ))
|
if( GL_Support( GL_TEXTURE_2D_RECT_EXT ))
|
||||||
Con_Printf( "GL_MAX_RECTANGLE_TEXTURE_SIZE: %i\n", glConfig.max_2d_rectangle_size );
|
gEngfuncs.Con_Printf( "GL_MAX_RECTANGLE_TEXTURE_SIZE: %i\n", glConfig.max_2d_rectangle_size );
|
||||||
if( GL_Support( GL_TEXTURE_ARRAY_EXT ))
|
if( GL_Support( GL_TEXTURE_ARRAY_EXT ))
|
||||||
Con_Printf( "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: %i\n", glConfig.max_2d_texture_layers );
|
gEngfuncs.Con_Printf( "GL_MAX_ARRAY_TEXTURE_LAYERS_EXT: %i\n", glConfig.max_2d_texture_layers );
|
||||||
if( GL_Support( GL_SHADER_GLSL100_EXT ))
|
if( GL_Support( GL_SHADER_GLSL100_EXT ))
|
||||||
{
|
{
|
||||||
Con_Printf( "GL_MAX_TEXTURE_COORDS_ARB: %i\n", glConfig.max_texture_coords );
|
gEngfuncs.Con_Printf( "GL_MAX_TEXTURE_COORDS_ARB: %i\n", glConfig.max_texture_coords );
|
||||||
Con_Printf( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB: %i\n", glConfig.max_teximage_units );
|
gEngfuncs.Con_Printf( "GL_MAX_TEXTURE_IMAGE_UNITS_ARB: %i\n", glConfig.max_teximage_units );
|
||||||
Con_Printf( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: %i\n", glConfig.max_vertex_uniforms );
|
gEngfuncs.Con_Printf( "GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: %i\n", glConfig.max_vertex_uniforms );
|
||||||
Con_Printf( "GL_MAX_VERTEX_ATTRIBS_ARB: %i\n", glConfig.max_vertex_attribs );
|
gEngfuncs.Con_Printf( "GL_MAX_VERTEX_ATTRIBS_ARB: %i\n", glConfig.max_vertex_attribs );
|
||||||
}
|
}
|
||||||
|
|
||||||
Con_Printf( "\n" );
|
gEngfuncs.Con_Printf( "\n" );
|
||||||
Con_Printf( "MODE: %ix%i\n", vidState.width, vidState.height );
|
gEngfuncs.Con_Printf( "MODE: %ix%i\n", vidState.width, vidState.height );
|
||||||
Con_Printf( "\n" );
|
gEngfuncs.Con_Printf( "\n" );
|
||||||
Con_Printf( "VERTICAL SYNC: %s\n", gl_vsync->value ? "enabled" : "disabled" );
|
gEngfuncs.Con_Printf( "VERTICAL SYNC: %s\n", gl_vsync->value ? "enabled" : "disabled" );
|
||||||
Con_Printf( "Color %d bits, Alpha %d bits, Depth %d bits, Stencil %d bits\n", glConfig.color_bits,
|
gEngfuncs.Con_Printf( "Color %d bits, Alpha %d bits, Depth %d bits, Stencil %d bits\n", glConfig.color_bits,
|
||||||
glConfig.alpha_bits, glConfig.depth_bits, glConfig.stencil_bits );
|
glConfig.alpha_bits, glConfig.depth_bits, glConfig.stencil_bits );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -591,7 +587,7 @@ void GL_InitExtensionsBigGL()
|
|||||||
if( glConfig.max_3d_texture_size < 32 )
|
if( glConfig.max_3d_texture_size < 32 )
|
||||||
{
|
{
|
||||||
GL_SetExtension( GL_TEXTURE_3D_EXT, false );
|
GL_SetExtension( GL_TEXTURE_3D_EXT, false );
|
||||||
Con_Printf( S_ERROR "GL_EXT_texture3D reported bogus GL_MAX_3D_TEXTURE_SIZE, disabled\n" );
|
gEngfuncs.Con_Printf( S_ERROR "GL_EXT_texture3D reported bogus GL_MAX_3D_TEXTURE_SIZE, disabled\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -677,9 +673,9 @@ void GL_InitExtensionsBigGL()
|
|||||||
// enable gldebug if allowed
|
// enable gldebug if allowed
|
||||||
if( GL_Support( GL_DEBUG_OUTPUT ))
|
if( GL_Support( GL_DEBUG_OUTPUT ))
|
||||||
{
|
{
|
||||||
if( host_developer.value )
|
if( gpGlobals->developer )
|
||||||
{
|
{
|
||||||
Con_Reportf( "Installing GL_DebugOutput...\n");
|
gEngfuncs.Con_Reportf( "Installing GL_DebugOutput...\n");
|
||||||
pglDebugMessageCallbackARB( GL_DebugOutput, NULL );
|
pglDebugMessageCallbackARB( GL_DebugOutput, NULL );
|
||||||
|
|
||||||
// force everything to happen in the main thread instead of in a separate driver thread
|
// force everything to happen in the main thread instead of in a separate driver thread
|
||||||
@ -703,7 +699,7 @@ void GL_InitExtensions( void )
|
|||||||
glConfig.renderer_string = pglGetString( GL_RENDERER );
|
glConfig.renderer_string = pglGetString( GL_RENDERER );
|
||||||
glConfig.version_string = pglGetString( GL_VERSION );
|
glConfig.version_string = pglGetString( GL_VERSION );
|
||||||
glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
|
glConfig.extensions_string = pglGetString( GL_EXTENSIONS );
|
||||||
Con_Reportf( "^3Video^7: %s\n", glConfig.renderer_string );
|
gEngfuncs.Con_Reportf( "^3Video^7: %s\n", glConfig.renderer_string );
|
||||||
|
|
||||||
#ifdef XASH_GLES
|
#ifdef XASH_GLES
|
||||||
GL_InitExtensionsGLES();
|
GL_InitExtensionsGLES();
|
||||||
@ -718,7 +714,7 @@ void GL_InitExtensions( void )
|
|||||||
Cvar_Set( "gl_anisotropy", va( "%f", bound( 0, gl_texture_anisotropy->value, glConfig.max_texture_anisotropy )));
|
Cvar_Set( "gl_anisotropy", va( "%f", bound( 0, gl_texture_anisotropy->value, glConfig.max_texture_anisotropy )));
|
||||||
|
|
||||||
if( GL_Support( GL_TEXTURE_COMPRESSION_EXT ))
|
if( GL_Support( GL_TEXTURE_COMPRESSION_EXT ))
|
||||||
Image_AddCmdFlags( IL_DDS_HARDWARE );
|
gEngfuncs.Image_AddCmdFlags( IL_DDS_HARDWARE );
|
||||||
|
|
||||||
// MCD has buffering issues
|
// MCD has buffering issues
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -746,9 +742,6 @@ GL_InitCommands
|
|||||||
*/
|
*/
|
||||||
void GL_InitCommands( void )
|
void GL_InitCommands( void )
|
||||||
{
|
{
|
||||||
// system screen width and height (don't suppose for change from console at all)
|
|
||||||
Cvar_Get( "width", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen width" );
|
|
||||||
Cvar_Get( "height", "0", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "screen height" );
|
|
||||||
r_speeds = Cvar_Get( "r_speeds", "0", FCVAR_ARCHIVE, "shows renderer speeds" );
|
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_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_norefresh = Cvar_Get( "r_norefresh", "0", 0, "disable 3D rendering (use with caution)" );
|
||||||
@ -765,21 +758,19 @@ void GL_InitCommands( void )
|
|||||||
r_traceglow = Cvar_Get( "r_traceglow", "1", FCVAR_ARCHIVE, "cull flares behind models" );
|
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_lightmap = Cvar_Get( "r_lightmap", "0", FCVAR_CHEAT, "lightmap debugging tool" );
|
||||||
r_drawentities = Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
r_drawentities = Cvar_Get( "r_drawentities", "1", FCVAR_CHEAT, "render entities" );
|
||||||
r_decals = engine.Cvar_Find( "r_decals" );
|
r_decals = gEngfuncs.pfnGetCvarPointer( "r_decals" );
|
||||||
window_xpos = Cvar_Get( "_window_xpos", "130", FCVAR_RENDERINFO, "window position by horizontal" );
|
|
||||||
window_ypos = Cvar_Get( "_window_ypos", "48", FCVAR_RENDERINFO, "window position by vertical" );
|
|
||||||
|
|
||||||
gl_extensions = Cvar_Get( "gl_allow_extensions", "1", FCVAR_GLCONFIG, "allow gl_extensions" );
|
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_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_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_check_errors = Cvar_Get( "gl_check_errors", "1", FCVAR_ARCHIVE, "ignore video engine errors" );
|
||||||
gl_vsync = engine.Cvar_Find( "gl_vsync" );
|
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_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_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_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_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_emboss_scale = Cvar_Get( "gl_emboss_scale", "0", FCVAR_ARCHIVE|FCVAR_LATCH, "fake bumpmapping scale" );
|
||||||
gl_showtextures = engine.Cvar_Find( "r_showtextures" );
|
gl_showtextures = gEngfuncs.pfnGetCvarPointer( "r_showtextures" );
|
||||||
gl_finish = Cvar_Get( "gl_finish", "0", FCVAR_ARCHIVE, "use glFinish instead of glFlush" );
|
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_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_clear = Cvar_Get( "gl_clear", "0", FCVAR_ARCHIVE, "clearing screen after each frame" );
|
||||||
@ -795,28 +786,21 @@ void GL_InitCommands( void )
|
|||||||
// make sure gl_vsync is checked after vid_restart
|
// make sure gl_vsync is checked after vid_restart
|
||||||
SetBits( gl_vsync->flags, FCVAR_CHANGED );
|
SetBits( gl_vsync->flags, FCVAR_CHANGED );
|
||||||
|
|
||||||
vid_gamma = Cvar_Get( "gamma", "2.5", FCVAR_ARCHIVE, "gamma amount" );
|
vid_gamma = gEngfuncs.pfnGetCvarPointer( "gamma" );
|
||||||
vid_brightness = Cvar_Get( "brightness", "0.0", FCVAR_ARCHIVE, "brightness factor" );
|
vid_brightness = gEngfuncs.pfnGetCvarPointer( "brightness" );
|
||||||
vid_fullscreen = engine.Cvar_Find( "fullscreen" );
|
|
||||||
vid_displayfrequency = engine.Cvar_Find ( "vid_displayfrequency" );
|
|
||||||
vid_highdpi = Cvar_Get( "vid_highdpi", "1", FCVAR_RENDERINFO|FCVAR_VIDRESTART, "enable High-DPI mode" );
|
|
||||||
|
|
||||||
Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" );
|
gEngfuncs.Cmd_AddCommand( "r_info", R_RenderInfo_f, "display renderer info" );
|
||||||
Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
|
gEngfuncs.Cmd_AddCommand( "timerefresh", SCR_TimeRefresh_f, "turn quickly and print rendering statistcs" );
|
||||||
|
|
||||||
// a1ba: planned to be named vid_mode for compability
|
|
||||||
// but supported mode list is filled by backends, so numbers are not portable any more
|
|
||||||
Cmd_AddCommand( "vid_setmode", VID_Mode_f, "display video mode" );
|
|
||||||
|
|
||||||
// give initial OpenGL configuration
|
// give initial OpenGL configuration
|
||||||
host.apply_opengl_config = true;
|
gEngfuncs.Cbuf_SetOpenGLConfigHack( true );
|
||||||
Cbuf_AddText( "exec opengl.cfg\n" );
|
gEngfuncs.Cbuf_AddText( "exec opengl.cfg\n" );
|
||||||
Cbuf_Execute();
|
gEngfuncs.Cbuf_Execute();
|
||||||
host.apply_opengl_config = false;
|
gEngfuncs.Cbuf_SetOpenGLConfigHack( false );
|
||||||
|
|
||||||
// apply actual video mode to window
|
// apply actual video mode to window
|
||||||
Cbuf_AddText( "exec video.cfg\n" );
|
gEngfuncs.Cbuf_AddText( "exec video.cfg\n" );
|
||||||
Cbuf_Execute();
|
gEngfuncs.Cbuf_Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -863,7 +847,6 @@ static void R_CheckVBO( void )
|
|||||||
r_vbo->flags |= FCVAR_ARCHIVE;
|
r_vbo->flags |= FCVAR_ARCHIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_Init
|
R_Init
|
||||||
@ -877,24 +860,21 @@ qboolean R_Init( void )
|
|||||||
GL_InitCommands();
|
GL_InitCommands();
|
||||||
GL_InitRandomTable();
|
GL_InitRandomTable();
|
||||||
|
|
||||||
// Set screen resolution and fullscreen mode if passed in on command line.
|
|
||||||
// This is done after executing opengl.cfg, as the command line values should take priority.
|
|
||||||
SetWidthAndHeightFromCommandLine();
|
|
||||||
SetFullscreenModeFromCommandLine();
|
|
||||||
|
|
||||||
GL_SetDefaultState();
|
GL_SetDefaultState();
|
||||||
|
|
||||||
// create the window and set up the context
|
// create the window and set up the context
|
||||||
|
#if 0 // REFTODO: just make it compile
|
||||||
if( !R_Init_Video( ))
|
if( !R_Init_Video( ))
|
||||||
{
|
{
|
||||||
GL_RemoveCommands();
|
GL_RemoveCommands();
|
||||||
R_Free_Video();
|
R_Free_Video();
|
||||||
|
|
||||||
Sys_Error( "Can't initialize video subsystem\nProbably driver was not installed" );
|
gEngfuncs.Host_Error( "Can't initialize video subsystem\nProbably driver was not installed" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
host.renderinfo_changed = false;
|
host.renderinfo_changed = false;
|
||||||
|
#endif
|
||||||
r_temppool = Mem_AllocPool( "Render Zone" );
|
r_temppool = Mem_AllocPool( "Render Zone" );
|
||||||
|
|
||||||
GL_SetDefaults();
|
GL_SetDefaults();
|
||||||
@ -906,12 +886,19 @@ qboolean R_Init( void )
|
|||||||
R_ClearDecals();
|
R_ClearDecals();
|
||||||
R_ClearScene();
|
R_ClearScene();
|
||||||
|
|
||||||
// initialize screen
|
|
||||||
SCR_Init();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
GL_RemoveCommands
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
void GL_RemoveCommands( void )
|
||||||
|
{
|
||||||
|
gEngfuncs.Cmd_RemoveCommand( "r_info" );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
R_Shutdown
|
R_Shutdown
|
||||||
@ -919,27 +906,18 @@ R_Shutdown
|
|||||||
*/
|
*/
|
||||||
void R_Shutdown( void )
|
void R_Shutdown( void )
|
||||||
{
|
{
|
||||||
model_t *mod;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if( !glw_state.initialized )
|
if( !glw_state.initialized )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// release SpriteTextures
|
|
||||||
for( i = 1, mod = clgame.sprites; i < MAX_CLIENT_SPRITES; i++, mod++ )
|
|
||||||
{
|
|
||||||
if( !mod->name[0] ) continue;
|
|
||||||
Mod_UnloadSpriteModel( mod );
|
|
||||||
}
|
|
||||||
memset( clgame.sprites, 0, sizeof( clgame.sprites ));
|
|
||||||
|
|
||||||
GL_RemoveCommands();
|
GL_RemoveCommands();
|
||||||
R_ShutdownImages();
|
R_ShutdownImages();
|
||||||
|
|
||||||
Mem_FreePool( &r_temppool );
|
Mem_FreePool( &r_temppool );
|
||||||
|
|
||||||
|
#if 0 // REFTODO: just make it compile
|
||||||
// shut down OS specific OpenGL stuff like contexts, etc.
|
// shut down OS specific OpenGL stuff like contexts, etc.
|
||||||
R_Free_Video();
|
R_Free_Video();
|
||||||
|
#endif // 0
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -985,6 +963,6 @@ void GL_CheckForErrors_( const char *filename, const int fileline )
|
|||||||
if(( err = pglGetError( )) == GL_NO_ERROR )
|
if(( err = pglGetError( )) == GL_NO_ERROR )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Con_Printf( S_OPENGL_ERROR "%s (called at %s:%i)\n", GL_ErrorString( err ), filename, fileline );
|
gEngfuncs.Con_Printf( S_OPENGL_ERROR "%s (called at %s:%i)\n", GL_ErrorString( err ), filename, fileline );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,8 @@ GNU General Public License for more details.
|
|||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "entity_types.h"
|
#include "entity_types.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "world.h" // BOX_ON_PLANE_SIDE
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============================================================================
|
===============================================================================
|
||||||
@ -64,8 +66,8 @@ void R_RemoveEfrags( cl_entity_t *ent )
|
|||||||
ef = ef->entnext;
|
ef = ef->entnext;
|
||||||
|
|
||||||
// put it on the free list
|
// put it on the free list
|
||||||
old->entnext = clgame.free_efrags;
|
old->entnext = gEngfuncs.GetEfragsFreeList();
|
||||||
clgame.free_efrags = old;
|
gEngfuncs.SetEfragsFreeList( old );
|
||||||
}
|
}
|
||||||
ent->efrag = NULL;
|
ent->efrag = NULL;
|
||||||
}
|
}
|
||||||
@ -93,14 +95,14 @@ static void R_SplitEntityOnNode( mnode_t *node )
|
|||||||
leaf = (mleaf_t *)node;
|
leaf = (mleaf_t *)node;
|
||||||
|
|
||||||
// grab an efrag off the free list
|
// grab an efrag off the free list
|
||||||
ef = clgame.free_efrags;
|
ef = gEngfuncs.GetEfragsFreeList();
|
||||||
if( !ef )
|
if( !ef )
|
||||||
{
|
{
|
||||||
Con_Printf( S_ERROR "too many efrags!\n" );
|
gEngfuncs.Con_Printf( S_ERROR "too many efrags!\n" );
|
||||||
return; // no free fragments...
|
return; // no free fragments...
|
||||||
}
|
}
|
||||||
|
|
||||||
clgame.free_efrags = clgame.free_efrags->entnext;
|
gEngfuncs.SetEfragsFreeList( ef->entnext );
|
||||||
ef->entity = r_addent;
|
ef->entity = r_addent;
|
||||||
|
|
||||||
// add the entity link
|
// add the entity link
|
||||||
@ -189,10 +191,10 @@ void R_StoreEfrags( efrag_t **ppefrag, int framecount )
|
|||||||
|
|
||||||
if( pent->visframe != framecount )
|
if( pent->visframe != framecount )
|
||||||
{
|
{
|
||||||
if( CL_AddVisibleEntity( pent, ET_FRAGMENTED ))
|
if( gEngfuncs.CL_AddVisibleEntity( pent, ET_FRAGMENTED ))
|
||||||
{
|
{
|
||||||
// mark that we've recorded this entity for this frame
|
// mark that we've recorded this entity for this frame
|
||||||
pent->curstate.messagenum = cl.parsecount;
|
pent->curstate.messagenum = gpGlobals->parsecount;
|
||||||
pent->visframe = framecount;
|
pent->visframe = framecount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,12 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|||||||
GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mathlib.h"
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "pm_local.h"
|
#include "pm_local.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "mathlib.h"
|
||||||
|
#include "ref_params.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
@ -45,15 +47,16 @@ void CL_RunLightStyles( void )
|
|||||||
|
|
||||||
// light animations
|
// light animations
|
||||||
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
// 'm' is normal light, 'a' is no light, 'z' is double bright
|
||||||
for( i = 0, ls = cl.lightstyles; i < MAX_LIGHTSTYLES; i++, ls++ )
|
for( i = 0; i < MAX_LIGHTSTYLES; i++ )
|
||||||
{
|
{
|
||||||
|
ls = gEngfuncs.GetLightStyle( i );
|
||||||
if( !WORLDMODEL->lightdata )
|
if( !WORLDMODEL->lightdata )
|
||||||
{
|
{
|
||||||
tr.lightstylevalue[i] = 256 * 256;
|
tr.lightstylevalue[i] = 256 * 256;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !cl.paused && frametime <= 0.1f )
|
if( !gEngfuncs.CL_GetRenderParm( PARAM_GAMEPAUSED, 0 ) && frametime <= 0.1f )
|
||||||
ls->time += frametime; // evaluate local time
|
ls->time += frametime; // evaluate local time
|
||||||
|
|
||||||
flight = (int)Q_floor( ls->time * 10 );
|
flight = (int)Q_floor( ls->time * 10 );
|
||||||
@ -393,16 +396,19 @@ colorVec R_LightVecInternal( const vec3_t start, const vec3_t end, vec3_t lspot,
|
|||||||
|
|
||||||
// get light from bmodels too
|
// get light from bmodels too
|
||||||
if( CVAR_TO_BOOL( r_lighting_extended ))
|
if( CVAR_TO_BOOL( r_lighting_extended ))
|
||||||
maxEnts = clgame.pmove->numphysent;
|
maxEnts = MAX_PHYSENTS;
|
||||||
|
|
||||||
// check all the bsp-models
|
// check all the bsp-models
|
||||||
for( i = 0; i < maxEnts; i++ )
|
for( i = 0; i < maxEnts; i++ )
|
||||||
{
|
{
|
||||||
physent_t *pe = &clgame.pmove->physents[i];
|
physent_t *pe = gEngfuncs.EV_GetPhysent( i );
|
||||||
vec3_t offset, start_l, end_l;
|
vec3_t offset, start_l, end_l;
|
||||||
mnode_t *pnodes;
|
mnode_t *pnodes;
|
||||||
matrix4x4 matrix;
|
matrix4x4 matrix;
|
||||||
|
|
||||||
|
if( !pe )
|
||||||
|
break;
|
||||||
|
|
||||||
if( !pe->model || pe->model->type != mod_brush )
|
if( !pe->model || pe->model->type != mod_brush )
|
||||||
continue; // skip non-bsp models
|
continue; // skip non-bsp models
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ R_PushScene
|
|||||||
void R_PushScene( void )
|
void R_PushScene( void )
|
||||||
{
|
{
|
||||||
if( ++tr.draw_stack_pos >= MAX_DRAW_STACK )
|
if( ++tr.draw_stack_pos >= MAX_DRAW_STACK )
|
||||||
Host_Error( "draw stack overflow\n" );
|
gEngfuncs.Host_Error( "draw stack overflow\n" );
|
||||||
|
|
||||||
tr.draw_list = &tr.draw_stack[tr.draw_stack_pos];
|
tr.draw_list = &tr.draw_stack[tr.draw_stack_pos];
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ R_PopScene
|
|||||||
void R_PopScene( void )
|
void R_PopScene( void )
|
||||||
{
|
{
|
||||||
if( --tr.draw_stack_pos < 0 )
|
if( --tr.draw_stack_pos < 0 )
|
||||||
Host_Error( "draw stack underflow\n" );
|
gEngfuncs.Host_Error( "draw stack underflow\n" );
|
||||||
tr.draw_list = &tr.draw_stack[tr.draw_stack_pos];
|
tr.draw_list = &tr.draw_stack[tr.draw_stack_pos];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ static void R_Clear( int bitMask )
|
|||||||
{
|
{
|
||||||
int bits;
|
int bits;
|
||||||
|
|
||||||
if( CL_IsDevOverviewMode( ))
|
if( gEngfuncs.CL_IsDevOverviewMode( ))
|
||||||
pglClearColor( 0.0f, 1.0f, 0.0f, 1.0f ); // green background (Valve rules)
|
pglClearColor( 0.0f, 1.0f, 0.0f, 1.0f ); // green background (Valve rules)
|
||||||
else pglClearColor( 0.5f, 0.5f, 0.5f, 1.0f );
|
else pglClearColor( 0.5f, 0.5f, 0.5f, 1.0f );
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ void R_SetupFrustum( void )
|
|||||||
{
|
{
|
||||||
ref_overview_t *ov = gEngfuncs.GetOverviewParms();
|
ref_overview_t *ov = gEngfuncs.GetOverviewParms();
|
||||||
|
|
||||||
if( RP_NORMALPASS() && ( cl.local.waterlevel >= 3 ))
|
if( RP_NORMALPASS() && ( gEngfuncs.GetWaterLevel() >= 3 ))
|
||||||
{
|
{
|
||||||
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
RI.fov_x = atan( tan( DEG2RAD( RI.fov_x ) / 2 ) * ( 0.97 + sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
||||||
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
RI.fov_y = atan( tan( DEG2RAD( RI.fov_y ) / 2 ) * ( 1.03 - sin( gpGlobals->time * 1.5 ) * 0.03 )) * 2 / (M_PI / 180.0);
|
||||||
@ -472,7 +472,7 @@ R_FindViewLeaf
|
|||||||
void R_FindViewLeaf( void )
|
void R_FindViewLeaf( void )
|
||||||
{
|
{
|
||||||
RI.oldviewleaf = RI.viewleaf;
|
RI.oldviewleaf = RI.viewleaf;
|
||||||
RI.viewleaf = Mod_PointInLeaf( RI.pvsorigin, WORLDMODEL->nodes );
|
RI.viewleaf = gEngfuncs.Mod_PointInLeaf( RI.pvsorigin, WORLDMODEL->nodes );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -681,24 +681,24 @@ static void R_CheckFog( void )
|
|||||||
|
|
||||||
RI.fogEnabled = false;
|
RI.fogEnabled = false;
|
||||||
|
|
||||||
if( RI.onlyClientDraw || cl.local.waterlevel < 3 || !RI.drawWorld || !RI.viewleaf )
|
if( RI.onlyClientDraw || gEngfuncs.GetWaterLevel() < 3 || !RI.drawWorld || !RI.viewleaf )
|
||||||
{
|
{
|
||||||
if( RI.cached_waterlevel == 3 )
|
if( RI.cached_waterlevel == 3 )
|
||||||
{
|
{
|
||||||
// in some cases waterlevel jumps from 3 to 1. Catch it
|
// in some cases waterlevel jumps from 3 to 1. Catch it
|
||||||
RI.cached_waterlevel = cl.local.waterlevel;
|
RI.cached_waterlevel = gEngfuncs.GetWaterLevel();
|
||||||
RI.cached_contents = CONTENTS_EMPTY;
|
RI.cached_contents = CONTENTS_EMPTY;
|
||||||
if( !RI.fogCustom ) pglDisable( GL_FOG );
|
if( !RI.fogCustom ) pglDisable( GL_FOG );
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ent = CL_GetWaterEntity( RI.vieworg );
|
ent = gEngfuncs.CL_GetWaterEntity( RI.vieworg );
|
||||||
if( ent && ent->model && ent->model->type == mod_brush && ent->curstate.skin < 0 )
|
if( ent && ent->model && ent->model->type == mod_brush && ent->curstate.skin < 0 )
|
||||||
cnt = ent->curstate.skin;
|
cnt = ent->curstate.skin;
|
||||||
else cnt = RI.viewleaf->contents;
|
else cnt = RI.viewleaf->contents;
|
||||||
|
|
||||||
RI.cached_waterlevel = cl.local.waterlevel;
|
RI.cached_waterlevel = gEngfuncs.GetWaterLevel();
|
||||||
|
|
||||||
if( !IsLiquidContents( RI.cached_contents ) && IsLiquidContents( cnt ))
|
if( !IsLiquidContents( RI.cached_contents ) && IsLiquidContents( cnt ))
|
||||||
{
|
{
|
||||||
@ -935,7 +935,7 @@ R_SetupRefParams must be called right before
|
|||||||
void R_RenderScene( void )
|
void R_RenderScene( void )
|
||||||
{
|
{
|
||||||
if( !WORLDMODEL && RI.drawWorld )
|
if( !WORLDMODEL && RI.drawWorld )
|
||||||
Host_Error( "R_RenderView: NULL worldmodel\n" );
|
gEngfuncs.Host_Error( "R_RenderView: NULL worldmodel\n" );
|
||||||
|
|
||||||
// frametime is valid only for normal pass
|
// frametime is valid only for normal pass
|
||||||
if( RP_NORMALPASS( ))
|
if( RP_NORMALPASS( ))
|
||||||
@ -1012,14 +1012,14 @@ void R_BeginFrame( qboolean clearScene )
|
|||||||
{
|
{
|
||||||
glConfig.softwareGammaUpdate = false; // in case of possible fails
|
glConfig.softwareGammaUpdate = false; // in case of possible fails
|
||||||
|
|
||||||
if(( gl_clear->value || CL_IsDevOverviewMode( )) && clearScene && cls.state != ca_cinematic )
|
if(( gl_clear->value || gEngfuncs.CL_IsDevOverviewMode( )) && clearScene && gEngfuncs.CL_GetConnState() != ref_ca_cinematic )
|
||||||
{
|
{
|
||||||
pglClear( GL_COLOR_BUFFER_BIT );
|
pglClear( GL_COLOR_BUFFER_BIT );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( R_DoResetGamma( ))
|
if( R_DoResetGamma( ))
|
||||||
{
|
{
|
||||||
BuildGammaTable( 1.8f, 0.0f );
|
gEngfuncs.BuildGammaTable( 1.8f, 0.0f );
|
||||||
glConfig.softwareGammaUpdate = true;
|
glConfig.softwareGammaUpdate = true;
|
||||||
GL_RebuildLightmaps();
|
GL_RebuildLightmaps();
|
||||||
glConfig.softwareGammaUpdate = false;
|
glConfig.softwareGammaUpdate = false;
|
||||||
@ -1030,7 +1030,7 @@ void R_BeginFrame( qboolean clearScene )
|
|||||||
}
|
}
|
||||||
else if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED ))
|
else if( FBitSet( vid_gamma->flags, FCVAR_CHANGED ) || FBitSet( vid_brightness->flags, FCVAR_CHANGED ))
|
||||||
{
|
{
|
||||||
BuildGammaTable( vid_gamma->value, vid_brightness->value );
|
gEngfuncs.BuildGammaTable( vid_gamma->value, vid_brightness->value );
|
||||||
glConfig.softwareGammaUpdate = true;
|
glConfig.softwareGammaUpdate = true;
|
||||||
GL_RebuildLightmaps();
|
GL_RebuildLightmaps();
|
||||||
glConfig.softwareGammaUpdate = false;
|
glConfig.softwareGammaUpdate = false;
|
||||||
@ -1229,8 +1229,6 @@ static int GL_RenderGetParm( int parm, int arg )
|
|||||||
case PARM_TEX_FLAGS:
|
case PARM_TEX_FLAGS:
|
||||||
glt = R_GetTexture( arg );
|
glt = R_GetTexture( arg );
|
||||||
return glt->flags;
|
return glt->flags;
|
||||||
case PARM_FEATURES:
|
|
||||||
return host.features;
|
|
||||||
case PARM_ACTIVE_TMU:
|
case PARM_ACTIVE_TMU:
|
||||||
return glState.activeTMU;
|
return glState.activeTMU;
|
||||||
case PARM_LIGHTSTYLEVALUE:
|
case PARM_LIGHTSTYLEVALUE:
|
||||||
@ -1276,44 +1274,6 @@ static void R_GetExtraParmsForTexture( int texture, byte *red, byte *green, byte
|
|||||||
if( density ) *density = glt->fogParams[3];
|
if( density ) *density = glt->fogParams[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=================
|
|
||||||
R_EnvShot
|
|
||||||
|
|
||||||
=================
|
|
||||||
*/
|
|
||||||
static void R_EnvShot( const float *vieworg, const char *name, qboolean skyshot, int shotsize )
|
|
||||||
{
|
|
||||||
static vec3_t viewPoint;
|
|
||||||
|
|
||||||
if( !COM_CheckString( name ))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( cls.scrshot_action != scrshot_inactive )
|
|
||||||
{
|
|
||||||
if( cls.scrshot_action != scrshot_skyshot && cls.scrshot_action != scrshot_envshot )
|
|
||||||
Con_Printf( S_ERROR "R_%sShot: subsystem is busy, try for next frame.\n", skyshot ? "Sky" : "Env" );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cls.envshot_vieworg = NULL; // use client view
|
|
||||||
Q_strncpy( cls.shotname, name, sizeof( cls.shotname ));
|
|
||||||
|
|
||||||
if( vieworg )
|
|
||||||
{
|
|
||||||
// make sure what viewpoint don't temporare
|
|
||||||
VectorCopy( vieworg, viewPoint );
|
|
||||||
cls.envshot_vieworg = viewPoint;
|
|
||||||
cls.envshot_disable_vis = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make request for envshot
|
|
||||||
if( skyshot ) cls.scrshot_action = scrshot_skyshot;
|
|
||||||
else cls.scrshot_action = scrshot_envshot;
|
|
||||||
|
|
||||||
// catch negative values
|
|
||||||
cls.envshot_viewsize = max( 0, shotsize );
|
|
||||||
}
|
|
||||||
|
|
||||||
static void R_SetCurrentEntity( cl_entity_t *ent )
|
static void R_SetCurrentEntity( cl_entity_t *ent )
|
||||||
{
|
{
|
||||||
@ -1330,27 +1290,3 @@ static void R_SetCurrentModel( model_t *mod )
|
|||||||
{
|
{
|
||||||
RI.currentmodel = mod;
|
RI.currentmodel = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
===============
|
|
||||||
R_InitRenderAPI
|
|
||||||
|
|
||||||
Initialize client external rendering
|
|
||||||
===============
|
|
||||||
*/
|
|
||||||
qboolean R_InitRenderAPI( void )
|
|
||||||
{
|
|
||||||
// make sure what render functions is cleared
|
|
||||||
memset( &gRenderIface, 0, sizeof( gRenderIface ));
|
|
||||||
|
|
||||||
if( gEngfuncs.pfnGetRenderInterface( CL_RENDER_INTERFACE_VERSION, &gRenderAPI, &gRenderIface ))
|
|
||||||
{
|
|
||||||
Con_Reportf( "CL_LoadProgs: ^2initailized extended RenderAPI ^7ver. %i\n", CL_RENDER_INTERFACE_VERSION );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure what render functions is cleared
|
|
||||||
memset( &gRenderIface, 0, sizeof( gRenderIface ));
|
|
||||||
|
|
||||||
return false; // just tell user about problems
|
|
||||||
}
|
|
||||||
|
@ -28,13 +28,13 @@ static void R_ParseDetailTextures( const char *filename )
|
|||||||
texture_t *tex;
|
texture_t *tex;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
afile = FS_LoadFile( filename, NULL, false );
|
afile = gEngfuncs.COM_LoadFile( filename, NULL, false );
|
||||||
if( !afile ) return;
|
if( !afile ) return;
|
||||||
|
|
||||||
pfile = afile;
|
pfile = afile;
|
||||||
|
|
||||||
// format: 'texturename' 'detailtexture' 'xScale' 'yScale'
|
// format: 'texturename' 'detailtexture' 'xScale' 'yScale'
|
||||||
while(( pfile = COM_ParseFile( pfile, token )) != NULL )
|
while(( pfile = gEngfuncs.COM_ParseFile( pfile, token )) != NULL )
|
||||||
{
|
{
|
||||||
texname[0] = '\0';
|
texname[0] = '\0';
|
||||||
detail_texname[0] = '\0';
|
detail_texname[0] = '\0';
|
||||||
@ -44,26 +44,26 @@ static void R_ParseDetailTextures( const char *filename )
|
|||||||
{
|
{
|
||||||
// NOTE: COM_ParseFile handled some symbols seperately
|
// NOTE: COM_ParseFile handled some symbols seperately
|
||||||
// this code will be fix it
|
// this code will be fix it
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = gEngfuncs.COM_ParseFile( pfile, token );
|
||||||
Q_strncat( texname, "{", sizeof( texname ));
|
Q_strncat( texname, "{", sizeof( texname ));
|
||||||
Q_strncat( texname, token, sizeof( texname ));
|
Q_strncat( texname, token, sizeof( texname ));
|
||||||
}
|
}
|
||||||
else Q_strncpy( texname, token, sizeof( texname ));
|
else Q_strncpy( texname, token, sizeof( texname ));
|
||||||
|
|
||||||
// read detailtexture name
|
// read detailtexture name
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = gEngfuncs.COM_ParseFile( pfile, token );
|
||||||
Q_strncat( detail_texname, token, sizeof( detail_texname ));
|
Q_strncat( detail_texname, token, sizeof( detail_texname ));
|
||||||
|
|
||||||
// trying the scales or '{'
|
// trying the scales or '{'
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = gEngfuncs.COM_ParseFile( pfile, token );
|
||||||
|
|
||||||
// read second part of detailtexture name
|
// read second part of detailtexture name
|
||||||
if( token[0] == '{' )
|
if( token[0] == '{' )
|
||||||
{
|
{
|
||||||
Q_strncat( detail_texname, token, sizeof( detail_texname ));
|
Q_strncat( detail_texname, token, sizeof( detail_texname ));
|
||||||
pfile = COM_ParseFile( pfile, token ); // read scales
|
pfile = gEngfuncs.COM_ParseFile( pfile, token ); // read scales
|
||||||
Q_strncat( detail_texname, token, sizeof( detail_texname ));
|
Q_strncat( detail_texname, token, sizeof( detail_texname ));
|
||||||
pfile = COM_ParseFile( pfile, token ); // parse scales
|
pfile = gEngfuncs.COM_ParseFile( pfile, token ); // parse scales
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_snprintf( detail_path, sizeof( detail_path ), "gfx/%s", detail_texname );
|
Q_snprintf( detail_path, sizeof( detail_path ), "gfx/%s", detail_texname );
|
||||||
@ -71,7 +71,7 @@ static void R_ParseDetailTextures( const char *filename )
|
|||||||
// read scales
|
// read scales
|
||||||
xScale = Q_atof( token );
|
xScale = Q_atof( token );
|
||||||
|
|
||||||
pfile = COM_ParseFile( pfile, token );
|
pfile = gEngfuncs.COM_ParseFile( pfile, token );
|
||||||
yScale = Q_atof( token );
|
yScale = Q_atof( token );
|
||||||
|
|
||||||
if( xScale <= 0.0f || yScale <= 0.0f )
|
if( xScale <= 0.0f || yScale <= 0.0f )
|
||||||
|
@ -22,6 +22,9 @@ GNU General Public License for more details.
|
|||||||
#include "cl_tent.h"
|
#include "cl_tent.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
|
||||||
|
#define PART_SIZE Q_max( 0.5f, cl_draw_particles->value )
|
||||||
|
static float gTracerSize[11] = { 1.5f, 0.5f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f };
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
CL_DrawParticles
|
CL_DrawParticles
|
||||||
@ -32,11 +35,6 @@ update particle color, position, free expired and draw it
|
|||||||
void CL_DrawParticles( double frametime, particle_t *cl_active_particles )
|
void CL_DrawParticles( double frametime, particle_t *cl_active_particles )
|
||||||
{
|
{
|
||||||
particle_t *p;
|
particle_t *p;
|
||||||
float time3 = 15.0f * frametime;
|
|
||||||
float time2 = 10.0f * frametime;
|
|
||||||
float time1 = 5.0f * frametime;
|
|
||||||
float dvel = 4.0f * frametime;
|
|
||||||
float grav = frametime * MOVEVARS->gravity * 0.05f;
|
|
||||||
vec3_t right, up;
|
vec3_t right, up;
|
||||||
color24 *pColor;
|
color24 *pColor;
|
||||||
int alpha;
|
int alpha;
|
||||||
@ -77,13 +75,15 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles )
|
|||||||
VectorScale( RI.cull_vup, size, up );
|
VectorScale( RI.cull_vup, size, up );
|
||||||
|
|
||||||
p->color = bound( 0, p->color, 255 );
|
p->color = bound( 0, p->color, 255 );
|
||||||
pColor = &clgame.palette[p->color];
|
pColor = gEngfuncs.CL_GetPaletteColor( p->color );
|
||||||
|
|
||||||
alpha = 255 * (p->die - gpGlobals->time) * 16.0f;
|
alpha = 255 * (p->die - gpGlobals->time) * 16.0f;
|
||||||
if( alpha > 255 || p->type == pt_static )
|
if( alpha > 255 || p->type == pt_static )
|
||||||
alpha = 255;
|
alpha = 255;
|
||||||
|
|
||||||
pglColor4ub( LightToTexGamma( pColor->r ), LightToTexGamma( pColor->g ), LightToTexGamma( pColor->b ), alpha );
|
pglColor4ub( gEngfuncs.LightToTexGamma( pColor->r ),
|
||||||
|
gEngfuncs.LightToTexGamma( pColor->g ),
|
||||||
|
gEngfuncs.LightToTexGamma( pColor->b ), alpha );
|
||||||
|
|
||||||
pglTexCoord2f( 0.0f, 1.0f );
|
pglTexCoord2f( 0.0f, 1.0f );
|
||||||
pglVertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
|
pglVertex3f( p->org[0] - right[0] + up[0], p->org[1] - right[1] + up[1], p->org[2] - right[2] + up[2] );
|
||||||
@ -96,79 +96,7 @@ void CL_DrawParticles( double frametime, particle_t *cl_active_particles )
|
|||||||
r_stats.c_particle_count++;
|
r_stats.c_particle_count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( p->type != pt_clientcustom )
|
gEngfuncs.CL_ThinkParticle( frametime, p );
|
||||||
{
|
|
||||||
// update position.
|
|
||||||
VectorMA( p->org, frametime, p->vel, p->org );
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( p->type )
|
|
||||||
{
|
|
||||||
case pt_static:
|
|
||||||
break;
|
|
||||||
case pt_fire:
|
|
||||||
p->ramp += time1;
|
|
||||||
if( p->ramp >= 6.0f ) p->die = -1.0f;
|
|
||||||
else p->color = ramp3[(int)p->ramp];
|
|
||||||
p->vel[2] += grav;
|
|
||||||
break;
|
|
||||||
case pt_explode:
|
|
||||||
p->ramp += time2;
|
|
||||||
if( p->ramp >= 8.0f ) p->die = -1.0f;
|
|
||||||
else p->color = ramp1[(int)p->ramp];
|
|
||||||
VectorMA( p->vel, dvel, p->vel, p->vel );
|
|
||||||
p->vel[2] -= grav;
|
|
||||||
break;
|
|
||||||
case pt_explode2:
|
|
||||||
p->ramp += time3;
|
|
||||||
if( p->ramp >= 8.0f ) p->die = -1.0f;
|
|
||||||
else p->color = ramp2[(int)p->ramp];
|
|
||||||
VectorMA( p->vel,-frametime, p->vel, p->vel );
|
|
||||||
p->vel[2] -= grav;
|
|
||||||
break;
|
|
||||||
case pt_blob:
|
|
||||||
if( p->packedColor == 255 )
|
|
||||||
{
|
|
||||||
// normal blob explosion
|
|
||||||
VectorMA( p->vel, dvel, p->vel, p->vel );
|
|
||||||
p->vel[2] -= grav;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case pt_blob2:
|
|
||||||
if( p->packedColor == 255 )
|
|
||||||
{
|
|
||||||
// normal blob explosion
|
|
||||||
p->vel[0] -= p->vel[0] * dvel;
|
|
||||||
p->vel[1] -= p->vel[1] * dvel;
|
|
||||||
p->vel[2] -= grav;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p->ramp += time2;
|
|
||||||
if( p->ramp >= 9.0f ) p->ramp = 0.0f;
|
|
||||||
p->color = gSparkRamp[(int)p->ramp];
|
|
||||||
VectorMA( p->vel, -frametime * 0.5f, p->vel, p->vel );
|
|
||||||
p->type = COM_RandomLong( 0, 3 ) ? pt_blob : pt_blob2;
|
|
||||||
p->vel[2] -= grav * 5.0f;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case pt_grav:
|
|
||||||
p->vel[2] -= grav * 20.0f;
|
|
||||||
break;
|
|
||||||
case pt_slowgrav:
|
|
||||||
p->vel[2] -= grav;
|
|
||||||
break;
|
|
||||||
case pt_vox_grav:
|
|
||||||
p->vel[2] -= grav * 8.0f;
|
|
||||||
break;
|
|
||||||
case pt_vox_slowgrav:
|
|
||||||
p->vel[2] -= grav * 4.0f;
|
|
||||||
break;
|
|
||||||
case pt_clientcustom:
|
|
||||||
if( p->callback )
|
|
||||||
p->callback( p, frametime );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pglEnd();
|
pglEnd();
|
||||||
@ -232,9 +160,10 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
// update tracer color if this is changed
|
// update tracer color if this is changed
|
||||||
if( FBitSet( tracerred->flags|tracergreen->flags|tracerblue->flags|traceralpha->flags, FCVAR_CHANGED ))
|
if( FBitSet( tracerred->flags|tracergreen->flags|tracerblue->flags|traceralpha->flags, FCVAR_CHANGED ))
|
||||||
{
|
{
|
||||||
gTracerColors[4].r = (byte)(tracerred->value * traceralpha->value * 255);
|
color24 *customColors = gEngfuncs.GetTracerColors( 4 );
|
||||||
gTracerColors[4].g = (byte)(tracergreen->value * traceralpha->value * 255);
|
customColors->r = (byte)(tracerred->value * traceralpha->value * 255);
|
||||||
gTracerColors[4].b = (byte)(tracerblue->value * traceralpha->value * 255);
|
customColors->g = (byte)(tracergreen->value * traceralpha->value * 255);
|
||||||
|
customColors->b = (byte)(tracerblue->value * traceralpha->value * 255);
|
||||||
ClearBits( tracerred->flags, FCVAR_CHANGED );
|
ClearBits( tracerred->flags, FCVAR_CHANGED );
|
||||||
ClearBits( tracergreen->flags, FCVAR_CHANGED );
|
ClearBits( tracergreen->flags, FCVAR_CHANGED );
|
||||||
ClearBits( tracerblue->flags, FCVAR_CHANGED );
|
ClearBits( tracerblue->flags, FCVAR_CHANGED );
|
||||||
@ -293,7 +222,7 @@ void CL_DrawTracers( double frametime, particle_t *cl_active_tracers )
|
|||||||
VectorAdd( verts[0], delta, verts[2] );
|
VectorAdd( verts[0], delta, verts[2] );
|
||||||
VectorAdd( verts[1], delta, verts[3] );
|
VectorAdd( verts[1], delta, verts[3] );
|
||||||
|
|
||||||
pColor = &gTracerColors[p->color];
|
pColor = gEngfuncs.GetTracerColors( p->color );
|
||||||
pglColor4ub( pColor->r, pColor->g, pColor->b, p->packedColor );
|
pglColor4ub( pColor->r, pColor->g, pColor->b, p->packedColor );
|
||||||
|
|
||||||
pglBegin( GL_QUADS );
|
pglBegin( GL_QUADS );
|
||||||
|
@ -15,6 +15,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
|
#include "mod_local.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -87,9 +88,10 @@ static void SubdividePolygon_r( msurface_t *warpface, int numverts, float *verts
|
|||||||
float sample_size;
|
float sample_size;
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
glpoly_t *poly;
|
glpoly_t *poly;
|
||||||
|
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
||||||
|
|
||||||
if( numverts > ( SUBDIVIDE_SIZE - 4 ))
|
if( numverts > ( SUBDIVIDE_SIZE - 4 ))
|
||||||
Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts );
|
gEngfuncs.Host_Error( "Mod_SubdividePolygon: too many vertexes on face ( %i )\n", numverts );
|
||||||
|
|
||||||
sample_size = gEngfuncs.Mod_SampleSizeForFace( warpface );
|
sample_size = gEngfuncs.Mod_SampleSizeForFace( warpface );
|
||||||
BoundPoly( numverts, verts, mins, maxs );
|
BoundPoly( numverts, verts, mins, maxs );
|
||||||
@ -242,6 +244,7 @@ void GL_SubdivideSurface( msurface_t *fa )
|
|||||||
int numverts;
|
int numverts;
|
||||||
int i, lindex;
|
int i, lindex;
|
||||||
float *vec;
|
float *vec;
|
||||||
|
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
||||||
|
|
||||||
// convert edges back to a normal polygon
|
// convert edges back to a normal polygon
|
||||||
numverts = 0;
|
numverts = 0;
|
||||||
@ -700,7 +703,7 @@ static void LM_UploadBlock( qboolean dynamic )
|
|||||||
tr.lightmapTextures[i] = GL_LoadTextureInternal( lmName, &r_lightmap, TF_FONT|TF_ATLAS_PAGE );
|
tr.lightmapTextures[i] = GL_LoadTextureInternal( lmName, &r_lightmap, TF_FONT|TF_ATLAS_PAGE );
|
||||||
|
|
||||||
if( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS )
|
if( ++gl_lms.current_lightmap_texture == MAX_LIGHTMAPS )
|
||||||
Host_Error( "AllocBlock: full\n" );
|
gEngfuncs.Host_Error( "AllocBlock: full\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -990,7 +993,7 @@ void R_BlendLightmaps( void )
|
|||||||
|
|
||||||
// try uploading the block now
|
// try uploading the block now
|
||||||
if( !LM_AllocBlock( smax, tmax, &surf->info->dlight_s, &surf->info->dlight_t ))
|
if( !LM_AllocBlock( smax, tmax, &surf->info->dlight_s, &surf->info->dlight_t ))
|
||||||
Host_Error( "AllocBlock: full\n" );
|
gEngfuncs.Host_Error( "AllocBlock: full\n" );
|
||||||
|
|
||||||
base = gl_lms.lightmap_buffer;
|
base = gl_lms.lightmap_buffer;
|
||||||
base += ( surf->info->dlight_t * BLOCK_SIZE + surf->info->dlight_s ) * 4;
|
base += ( surf->info->dlight_t * BLOCK_SIZE + surf->info->dlight_s ) * 4;
|
||||||
@ -1269,7 +1272,7 @@ void R_DrawTextureChains( void )
|
|||||||
RI.currententity = gEngfuncs.GetEntityByIndex( 0 );
|
RI.currententity = gEngfuncs.GetEntityByIndex( 0 );
|
||||||
RI.currentmodel = RI.currententity->model;
|
RI.currentmodel = RI.currententity->model;
|
||||||
|
|
||||||
if( gEngfuncs.CL)
|
if( gEngfuncs.CL_GetRenderParm( PARM_SKY_SPHERE, 0 ) )
|
||||||
{
|
{
|
||||||
pglDisable( GL_TEXTURE_2D );
|
pglDisable( GL_TEXTURE_2D );
|
||||||
pglColor3f( 1.0f, 1.0f, 1.0f );
|
pglColor3f( 1.0f, 1.0f, 1.0f );
|
||||||
@ -1279,7 +1282,7 @@ void R_DrawTextureChains( void )
|
|||||||
for( s = skychain; s != NULL; s = s->texturechain )
|
for( s = skychain; s != NULL; s = s->texturechain )
|
||||||
R_AddSkyBoxSurface( s );
|
R_AddSkyBoxSurface( s );
|
||||||
|
|
||||||
if( FBitSet( WORLDMODEL->flags, FWORLD_SKYSPHERE ) && !tr.fCustomSkybox )
|
if( gEngfuncs.CL_GetRenderParm( PARM_SKY_SPHERE, 0 ) )
|
||||||
{
|
{
|
||||||
pglEnable( GL_TEXTURE_2D );
|
pglEnable( GL_TEXTURE_2D );
|
||||||
if( skychain )
|
if( skychain )
|
||||||
@ -2429,7 +2432,7 @@ static void R_DrawLightmappedVBO( vboarray_t *vbo, vbotexture_t *vbotex, texture
|
|||||||
|
|
||||||
// try upload the block now
|
// try upload the block now
|
||||||
if( !LM_AllocBlock( smax, tmax, &info->dlight_s, &info->dlight_t ))
|
if( !LM_AllocBlock( smax, tmax, &info->dlight_s, &info->dlight_t ))
|
||||||
Host_Error( "AllocBlock: full\n" );
|
gEngfuncs.Host_Error( "AllocBlock: full\n" );
|
||||||
|
|
||||||
base = gl_lms.lightmap_buffer;
|
base = gl_lms.lightmap_buffer;
|
||||||
base += ( info->dlight_t * BLOCK_SIZE + info->dlight_s ) * 4;
|
base += ( info->dlight_t * BLOCK_SIZE + info->dlight_s ) * 4;
|
||||||
@ -3332,7 +3335,7 @@ void R_DrawWorld( void )
|
|||||||
|
|
||||||
R_DrawTextureChains();
|
R_DrawTextureChains();
|
||||||
|
|
||||||
if( !CL_IsDevOverviewMode( ))
|
if( !gEngfuncs.CL_IsDevOverviewMode( ))
|
||||||
{
|
{
|
||||||
DrawDecalsBatch();
|
DrawDecalsBatch();
|
||||||
GL_ResetFogColor();
|
GL_ResetFogColor();
|
||||||
@ -3389,12 +3392,12 @@ void R_MarkLeaves( void )
|
|||||||
if( RI.viewleaf->contents == CONTENTS_EMPTY )
|
if( RI.viewleaf->contents == CONTENTS_EMPTY )
|
||||||
{
|
{
|
||||||
VectorSet( test, RI.pvsorigin[0], RI.pvsorigin[1], RI.pvsorigin[2] - 16.0f );
|
VectorSet( test, RI.pvsorigin[0], RI.pvsorigin[1], RI.pvsorigin[2] - 16.0f );
|
||||||
leaf = Mod_PointInLeaf( test, WORLDMODEL->nodes );
|
leaf = gEngfuncs.Mod_PointInLeaf( test, WORLDMODEL->nodes );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
VectorSet( test, RI.pvsorigin[0], RI.pvsorigin[1], RI.pvsorigin[2] + 16.0f );
|
VectorSet( test, RI.pvsorigin[0], RI.pvsorigin[1], RI.pvsorigin[2] + 16.0f );
|
||||||
leaf = Mod_PointInLeaf( test, WORLDMODEL->nodes );
|
leaf = gEngfuncs.Mod_PointInLeaf( test, WORLDMODEL->nodes );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(( leaf->contents != CONTENTS_SOLID ) && ( RI.viewleaf != leaf ))
|
if(( leaf->contents != CONTENTS_SOLID ) && ( RI.viewleaf != leaf ))
|
||||||
@ -3444,6 +3447,7 @@ void GL_CreateSurfaceLightmap( msurface_t *surf )
|
|||||||
int sample_size;
|
int sample_size;
|
||||||
mextrasurf_t *info = surf->info;
|
mextrasurf_t *info = surf->info;
|
||||||
byte *base;
|
byte *base;
|
||||||
|
model_t *loadmodel = gEngfuncs.Mod_GetCurrentLoadingModel();
|
||||||
|
|
||||||
if( !loadmodel->lightdata )
|
if( !loadmodel->lightdata )
|
||||||
return;
|
return;
|
||||||
@ -3461,7 +3465,7 @@ void GL_CreateSurfaceLightmap( msurface_t *surf )
|
|||||||
LM_InitBlock();
|
LM_InitBlock();
|
||||||
|
|
||||||
if( !LM_AllocBlock( smax, tmax, &surf->light_s, &surf->light_t ))
|
if( !LM_AllocBlock( smax, tmax, &surf->light_s, &surf->light_t ))
|
||||||
Host_Error( "AllocBlock: full\n" );
|
gEngfuncs.Host_Error( "AllocBlock: full\n" );
|
||||||
}
|
}
|
||||||
|
|
||||||
surf->lightmaptexturenum = gl_lms.current_lightmap_texture;
|
surf->lightmaptexturenum = gl_lms.current_lightmap_texture;
|
||||||
@ -3486,7 +3490,7 @@ void GL_RebuildLightmaps( void )
|
|||||||
int i, j;
|
int i, j;
|
||||||
model_t *m;
|
model_t *m;
|
||||||
|
|
||||||
if( !cl.video_prepped )
|
if( !gpGlobals->video_prepped )
|
||||||
return; // wait for worldmodel
|
return; // wait for worldmodel
|
||||||
|
|
||||||
ClearBits( vid_brightness->flags, FCVAR_CHANGED );
|
ClearBits( vid_brightness->flags, FCVAR_CHANGED );
|
||||||
@ -3507,15 +3511,15 @@ void GL_RebuildLightmaps( void )
|
|||||||
|
|
||||||
LM_InitBlock();
|
LM_InitBlock();
|
||||||
|
|
||||||
for( i = 0; i < cl.nummodels; i++ )
|
for( i = 0; i < gEngfuncs.CL_NumModels(); i++ )
|
||||||
{
|
{
|
||||||
if(( m = CL_ModelHandle( i + 1 )) == NULL )
|
if(( m = gEngfuncs.pfnGetModelByIndex( i + 1 )) == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( m->name[0] == '*' || m->type != mod_brush )
|
if( m->name[0] == '*' || m->type != mod_brush )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
loadmodel = m;
|
gEngfuncs.Mod_SetCurrentLoadingModel( m );
|
||||||
|
|
||||||
for( j = 0; j < m->numsurfaces; j++ )
|
for( j = 0; j < m->numsurfaces; j++ )
|
||||||
GL_CreateSurfaceLightmap( m->surfaces + j );
|
GL_CreateSurfaceLightmap( m->surfaces + j );
|
||||||
@ -3573,9 +3577,9 @@ void GL_BuildLightmaps( void )
|
|||||||
|
|
||||||
LM_InitBlock();
|
LM_InitBlock();
|
||||||
|
|
||||||
for( i = 0; i < cl.nummodels; i++ )
|
for( i = 0; i < gEngfuncs.CL_NumModels(); i++ )
|
||||||
{
|
{
|
||||||
if(( m = CL_ModelHandle( i + 1 )) == NULL )
|
if(( m = gEngfuncs.pfnGetModelByIndex( i + 1 )) == NULL )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if( m->name[0] == '*' || m->type != mod_brush )
|
if( m->name[0] == '*' || m->type != mod_brush )
|
||||||
@ -3586,7 +3590,7 @@ void GL_BuildLightmaps( void )
|
|||||||
// clearing all decal chains
|
// clearing all decal chains
|
||||||
m->surfaces[j].pdecals = NULL;
|
m->surfaces[j].pdecals = NULL;
|
||||||
m->surfaces[j].visframe = 0;
|
m->surfaces[j].visframe = 0;
|
||||||
loadmodel = m;
|
gEngfuncs.Mod_SetCurrentLoadingModel( m );
|
||||||
|
|
||||||
GL_CreateSurfaceLightmap( m->surfaces + j );
|
GL_CreateSurfaceLightmap( m->surfaces + j );
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ GNU General Public License for more details.
|
|||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "entity_types.h"
|
#include "entity_types.h"
|
||||||
#include "cl_tent.h"
|
#include "cl_tent.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
// it's a Valve default value for LoadMapSprite (probably must be power of two)
|
// it's a Valve default value for LoadMapSprite (probably must be power of two)
|
||||||
#define MAPSPRITE_SIZE 128
|
#define MAPSPRITE_SIZE 128
|
||||||
@ -152,81 +153,8 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
|
|||||||
msprite_t *psprite;
|
msprite_t *psprite;
|
||||||
int i, size;
|
int i, size;
|
||||||
|
|
||||||
if( loaded ) *loaded = false;
|
|
||||||
pin = (dsprite_t *)buffer;
|
|
||||||
mod->type = mod_sprite;
|
|
||||||
r_texFlags = texFlags;
|
r_texFlags = texFlags;
|
||||||
i = pin->version;
|
sprite_version = pin->version;
|
||||||
|
|
||||||
if( pin->ident != IDSPRITEHEADER )
|
|
||||||
{
|
|
||||||
Con_DPrintf( S_ERROR "%s has wrong id (%x should be %x)\n", mod->name, pin->ident, IDSPRITEHEADER );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( i != SPRITE_VERSION_Q1 && i != SPRITE_VERSION_HL && i != SPRITE_VERSION_32 )
|
|
||||||
{
|
|
||||||
Con_DPrintf( S_ERROR "%s has wrong version number (%i should be %i or %i)\n", mod->name, i, SPRITE_VERSION_Q1, SPRITE_VERSION_HL );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
mod->mempool = Mem_AllocPool( va( "^2%s^7", mod->name ));
|
|
||||||
sprite_version = i;
|
|
||||||
|
|
||||||
if( i == SPRITE_VERSION_Q1 || i == SPRITE_VERSION_32 )
|
|
||||||
{
|
|
||||||
pinq1 = (dsprite_q1_t *)buffer;
|
|
||||||
size = sizeof( msprite_t ) + ( pinq1->numframes - 1 ) * sizeof( psprite->frames );
|
|
||||||
psprite = Mem_Calloc( mod->mempool, size );
|
|
||||||
mod->cache.data = psprite; // make link to extradata
|
|
||||||
|
|
||||||
psprite->type = pinq1->type;
|
|
||||||
psprite->texFormat = SPR_ADDITIVE; //SPR_ALPHTEST;
|
|
||||||
psprite->numframes = mod->numframes = pinq1->numframes;
|
|
||||||
psprite->facecull = SPR_CULL_FRONT;
|
|
||||||
psprite->radius = pinq1->boundingradius;
|
|
||||||
psprite->synctype = pinq1->synctype;
|
|
||||||
|
|
||||||
// LordHavoc: hack to allow sprites to be non-fullbright
|
|
||||||
for( i = 0; i < MAX_QPATH && mod->name[i]; i++ )
|
|
||||||
if( mod->name[i] == '!' )
|
|
||||||
psprite->texFormat = SPR_ALPHTEST;
|
|
||||||
|
|
||||||
mod->mins[0] = mod->mins[1] = -pinq1->bounds[0] * 0.5f;
|
|
||||||
mod->maxs[0] = mod->maxs[1] = pinq1->bounds[0] * 0.5f;
|
|
||||||
mod->mins[2] = -pinq1->bounds[1] * 0.5f;
|
|
||||||
mod->maxs[2] = pinq1->bounds[1] * 0.5f;
|
|
||||||
numi = NULL;
|
|
||||||
}
|
|
||||||
else if( i == SPRITE_VERSION_HL )
|
|
||||||
{
|
|
||||||
pinhl = (dsprite_hl_t *)buffer;
|
|
||||||
size = sizeof( msprite_t ) + ( pinhl->numframes - 1 ) * sizeof( psprite->frames );
|
|
||||||
psprite = Mem_Calloc( mod->mempool, size );
|
|
||||||
mod->cache.data = psprite; // make link to extradata
|
|
||||||
|
|
||||||
psprite->type = pinhl->type;
|
|
||||||
psprite->texFormat = pinhl->texFormat;
|
|
||||||
psprite->numframes = mod->numframes = pinhl->numframes;
|
|
||||||
psprite->facecull = pinhl->facetype;
|
|
||||||
psprite->radius = pinhl->boundingradius;
|
|
||||||
psprite->synctype = pinhl->synctype;
|
|
||||||
|
|
||||||
mod->mins[0] = mod->mins[1] = -pinhl->bounds[0] * 0.5f;
|
|
||||||
mod->maxs[0] = mod->maxs[1] = pinhl->bounds[0] * 0.5f;
|
|
||||||
mod->mins[2] = -pinhl->bounds[1] * 0.5f;
|
|
||||||
mod->maxs[2] = pinhl->bounds[1] * 0.5f;
|
|
||||||
numi = (short *)(pinhl + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if( host.type == HOST_DEDICATED )
|
|
||||||
{
|
|
||||||
// skip frames loading
|
|
||||||
if( loaded ) *loaded = true; // done
|
|
||||||
psprite->numframes = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_strncpy( sprite_name, mod->name, sizeof( sprite_name ));
|
Q_strncpy( sprite_name, mod->name, sizeof( sprite_name ));
|
||||||
COM_StripExtension( sprite_name );
|
COM_StripExtension( sprite_name );
|
||||||
|
|
||||||
@ -235,7 +163,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
|
|||||||
rgbdata_t *pal;
|
rgbdata_t *pal;
|
||||||
|
|
||||||
pal = FS_LoadImage( "#id.pal", (byte *)&i, 768 );
|
pal = FS_LoadImage( "#id.pal", (byte *)&i, 768 );
|
||||||
pframetype = (dframetype_t *)(pinq1 + 1);
|
pframetype = (dframetype_t *)(buffer + sizeof( dsprite_q1_t )); // pinq1 + 1
|
||||||
FS_FreeImage( pal ); // palette installed, no reason to keep this data
|
FS_FreeImage( pal ); // palette installed, no reason to keep this data
|
||||||
}
|
}
|
||||||
else if( *numi == 256 )
|
else if( *numi == 256 )
|
||||||
@ -262,7 +190,7 @@ void Mod_LoadSpriteModel( model_t *mod, const void *buffer, qboolean *loaded, ui
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "%s has wrong number of palette colors %i (should be 256)\n", mod->name, *numi );
|
gEngfuncs.Con_DPrintf( S_ERROR "%s has wrong number of palette colors %i (should be 256)\n", mod->name, *numi );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,41 +358,30 @@ void Mod_UnloadSpriteModel( model_t *mod )
|
|||||||
mspriteframe_t *pspriteframe;
|
mspriteframe_t *pspriteframe;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
Assert( mod != NULL );
|
psprite = mod->cache.data;
|
||||||
|
|
||||||
if( mod->type == mod_sprite )
|
if( psprite )
|
||||||
{
|
{
|
||||||
if( host.type != HOST_DEDICATED )
|
// release all textures
|
||||||
|
for( i = 0; i < psprite->numframes; i++ )
|
||||||
{
|
{
|
||||||
psprite = mod->cache.data;
|
if( psprite->frames[i].type == SPR_SINGLE )
|
||||||
|
|
||||||
if( psprite )
|
|
||||||
{
|
{
|
||||||
// release all textures
|
pspriteframe = psprite->frames[i].frameptr;
|
||||||
for( i = 0; i < psprite->numframes; i++ )
|
GL_FreeTexture( pspriteframe->gl_texturenum );
|
||||||
{
|
}
|
||||||
if( psprite->frames[i].type == SPR_SINGLE )
|
else
|
||||||
{
|
{
|
||||||
pspriteframe = psprite->frames[i].frameptr;
|
pspritegroup = (mspritegroup_t *)psprite->frames[i].frameptr;
|
||||||
GL_FreeTexture( pspriteframe->gl_texturenum );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
pspritegroup = (mspritegroup_t *)psprite->frames[i].frameptr;
|
|
||||||
|
|
||||||
for( j = 0; j < pspritegroup->numframes; j++ )
|
for( j = 0; j < pspritegroup->numframes; j++ )
|
||||||
{
|
{
|
||||||
pspriteframe = pspritegroup->frames[i];
|
pspriteframe = pspritegroup->frames[i];
|
||||||
GL_FreeTexture( pspriteframe->gl_texturenum );
|
GL_FreeTexture( pspriteframe->gl_texturenum );
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mem_FreePool( &mod->mempool );
|
|
||||||
memset( mod, 0, sizeof( *mod ));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -493,7 +410,7 @@ mspriteframe_t *R_GetSpriteFrame( const model_t *pModel, int frame, float yaw )
|
|||||||
else if( frame >= psprite->numframes )
|
else if( frame >= psprite->numframes )
|
||||||
{
|
{
|
||||||
if( frame > psprite->numframes )
|
if( frame > psprite->numframes )
|
||||||
Con_Printf( S_WARN "R_GetSpriteFrame: no such frame %d (%s)\n", frame, pModel->name );
|
gEngfuncs.Con_Printf( S_WARN "R_GetSpriteFrame: no such frame %d (%s)\n", frame, pModel->name );
|
||||||
frame = psprite->numframes - 1;
|
frame = psprite->numframes - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +478,7 @@ float R_GetSpriteFrameInterpolant( cl_entity_t *ent, mspriteframe_t **oldframe,
|
|||||||
}
|
}
|
||||||
else if( frame >= psprite->numframes )
|
else if( frame >= psprite->numframes )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_WARN "R_GetSpriteFrameInterpolant: no such frame %d (%s)\n", frame, ent->model->name );
|
gEngfuncs.Con_Reportf( S_WARN "R_GetSpriteFrameInterpolant: no such frame %d (%s)\n", frame, ent->model->name );
|
||||||
frame = psprite->numframes - 1;
|
frame = psprite->numframes - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -906,7 +823,7 @@ void R_DrawSpriteModel( cl_entity_t *e )
|
|||||||
{
|
{
|
||||||
cl_entity_t *parent;
|
cl_entity_t *parent;
|
||||||
|
|
||||||
parent = CL_GetEntityByIndex( e->curstate.aiment );
|
parent = gEngfuncs.GetEntityByIndex( e->curstate.aiment );
|
||||||
|
|
||||||
if( parent && parent->model )
|
if( parent && parent->model )
|
||||||
{
|
{
|
||||||
|
@ -21,6 +21,8 @@ GNU General Public License for more details.
|
|||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "pm_local.h"
|
#include "pm_local.h"
|
||||||
#include "cl_tent.h"
|
#include "cl_tent.h"
|
||||||
|
#include "common.h"
|
||||||
|
#include "client.h"
|
||||||
|
|
||||||
#define EVENT_CLIENT 5000 // less than this value it's a server-side studio events
|
#define EVENT_CLIENT 5000 // less than this value it's a server-side studio events
|
||||||
#define MAX_LOCALLIGHTS 4
|
#define MAX_LOCALLIGHTS 4
|
||||||
@ -363,12 +365,16 @@ pfnPlayerInfo
|
|||||||
*/
|
*/
|
||||||
player_info_t *pfnPlayerInfo( int index )
|
player_info_t *pfnPlayerInfo( int index )
|
||||||
{
|
{
|
||||||
|
#if 0
|
||||||
if( !RI.drawWorld )
|
if( !RI.drawWorld )
|
||||||
return &gameui.playerinfo;
|
return &gameui.playerinfo;
|
||||||
|
|
||||||
if( index < 0 || index > cl.maxclients )
|
if( index < 0 || index > cl.maxclients )
|
||||||
return NULL;
|
return NULL;
|
||||||
return &cl.players[index];
|
return &cl.players[index];
|
||||||
|
#else
|
||||||
|
return gEngfuncs.pfnPlayerInfo( index );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -392,11 +398,14 @@ entity_state_t *R_StudioGetPlayerState( int index )
|
|||||||
{
|
{
|
||||||
if( !RI.drawWorld )
|
if( !RI.drawWorld )
|
||||||
return &RI.currententity->curstate;
|
return &RI.currententity->curstate;
|
||||||
|
#if 0
|
||||||
if( index < 0 || index >= cl.maxclients )
|
if( index < 0 || index >= cl.maxclients )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return &cl.frames[cl.parsecountmod].playerstate[index];
|
return &cl.frames[cl.parsecountmod].playerstate[index];
|
||||||
|
#else
|
||||||
|
return gEngfuncs.pfnGetPlayerState( index );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1355,7 +1364,7 @@ R_StudioDynamicLight
|
|||||||
*/
|
*/
|
||||||
void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
||||||
{
|
{
|
||||||
movevars_t *mv = &clgame.movevars;
|
movevars_t *mv = gEngfuncs.pfnGetMoveVars();
|
||||||
vec3_t lightDir, vecSrc, vecEnd;
|
vec3_t lightDir, vecSrc, vecEnd;
|
||||||
vec3_t origin, dist, finalLight;
|
vec3_t origin, dist, finalLight;
|
||||||
float add, radius, total;
|
float add, radius, total;
|
||||||
@ -1404,10 +1413,10 @@ void R_StudioDynamicLight( cl_entity_t *ent, alight_t *plight )
|
|||||||
vecEnd[2] = origin[2] - mv->skyvec_z * 8192.0f;
|
vecEnd[2] = origin[2] - mv->skyvec_z * 8192.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
trace = CL_TraceLine( vecSrc, vecEnd, PM_WORLD_ONLY );
|
trace = gEngfuncs.CL_TraceLine( vecSrc, vecEnd, PM_WORLD_ONLY );
|
||||||
if( trace.ent > 0 ) psurf = PM_TraceSurface( &clgame.pmove->physents[trace.ent], vecSrc, vecEnd );
|
if( trace.ent > 0 ) psurf = gEngfuncs.EV_TraceSurface( trace.ent, vecSrc, vecEnd );
|
||||||
else psurf = PM_TraceSurface( clgame.pmove->physents, vecSrc, vecEnd );
|
else psurf = gEngfuncs.EV_TraceSurface( 0, vecSrc, vecEnd );
|
||||||
|
|
||||||
if( FBitSet( ent->model->flags, STUDIO_FORCE_SKYLIGHT ) || ( psurf && FBitSet( psurf->flags, SURF_DRAWSKY )))
|
if( FBitSet( ent->model->flags, STUDIO_FORCE_SKYLIGHT ) || ( psurf && FBitSet( psurf->flags, SURF_DRAWSKY )))
|
||||||
{
|
{
|
||||||
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
|
VectorSet( lightDir, mv->skyvec_x, mv->skyvec_y, mv->skyvec_z );
|
||||||
@ -1787,7 +1796,7 @@ static void R_StudioSetupSkin( studiohdr_t *ptexturehdr, int index )
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// NOTE: user may ignore to call StudioRemapColors and remap_info will be unavailable
|
// NOTE: user may ignore to call StudioRemapColors and remap_info will be unavailable
|
||||||
if( m_fDoRemap ) ptexture = CL_GetRemapInfoForEntity( RI.currententity )->ptexture;
|
if( m_fDoRemap ) ptexture = gEngfuncs.CL_GetRemapInfoForEntity( RI.currententity )->ptexture;
|
||||||
if( !ptexture ) ptexture = (mstudiotexture_t *)((byte *)ptexturehdr + ptexturehdr->textureindex); // fallback
|
if( !ptexture ) ptexture = (mstudiotexture_t *)((byte *)ptexturehdr + ptexturehdr->textureindex); // fallback
|
||||||
|
|
||||||
if( r_lightmap->value && !r_fullbright->value )
|
if( r_lightmap->value && !r_fullbright->value )
|
||||||
@ -1807,11 +1816,11 @@ mstudiotexture_t *R_StudioGetTexture( cl_entity_t *e )
|
|||||||
mstudiotexture_t *ptexture;
|
mstudiotexture_t *ptexture;
|
||||||
studiohdr_t *phdr, *thdr;
|
studiohdr_t *phdr, *thdr;
|
||||||
|
|
||||||
if(( phdr = Mod_StudioExtradata( e->model )) == NULL )
|
if(( phdr = gEngfuncs.Mod_Extradata( mod_studio, e->model )) == NULL )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
thdr = m_pStudioHeader;
|
thdr = m_pStudioHeader;
|
||||||
if( !thdr ) return NULL;
|
if( !thdr ) return NULL;
|
||||||
|
|
||||||
if( m_fDoRemap ) ptexture = CL_GetRemapInfoForEntity( e )->ptexture;
|
if( m_fDoRemap ) ptexture = CL_GetRemapInfoForEntity( e )->ptexture;
|
||||||
else ptexture = (mstudiotexture_t *)((byte *)thdr + thdr->textureindex);
|
else ptexture = (mstudiotexture_t *)((byte *)thdr + thdr->textureindex);
|
||||||
@ -1851,7 +1860,7 @@ void R_StudioRenderShadow( int iSprite, float *p1, float *p2, float *p3, float *
|
|||||||
if( !p1 || !p2 || !p3 || !p4 )
|
if( !p1 || !p2 || !p3 || !p4 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( TriSpriteTexture( CL_ModelHandle( iSprite ), 0 ))
|
if( TriSpriteTexture( gEngfuncs.pfnGetModelByIndex( iSprite ), 0 ))
|
||||||
{
|
{
|
||||||
TriRenderMode( kRenderTransAlpha );
|
TriRenderMode( kRenderTransAlpha );
|
||||||
TriColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
TriColor4f( 0.0f, 0.0f, 0.0f, 1.0f );
|
||||||
@ -2387,11 +2396,11 @@ R_StudioSetRemapColors
|
|||||||
*/
|
*/
|
||||||
void R_StudioSetRemapColors( int newTop, int newBottom )
|
void R_StudioSetRemapColors( int newTop, int newBottom )
|
||||||
{
|
{
|
||||||
CL_AllocRemapInfo( newTop, newBottom );
|
gEngfuncs.CL_AllocRemapInfo( newTop, newBottom );
|
||||||
|
|
||||||
if( CL_GetRemapInfoForEntity( RI.currententity ))
|
if( gEngfuncs.CL_GetRemapInfoForEntity( RI.currententity ))
|
||||||
{
|
{
|
||||||
CL_UpdateRemapInfo( newTop, newBottom );
|
gEngfuncs.CL_UpdateRemapInfo( newTop, newBottom );
|
||||||
m_fDoRemap = true;
|
m_fDoRemap = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2404,22 +2413,12 @@ R_StudioSetupPlayerModel
|
|||||||
*/
|
*/
|
||||||
static model_t *R_StudioSetupPlayerModel( int index )
|
static model_t *R_StudioSetupPlayerModel( int index )
|
||||||
{
|
{
|
||||||
player_info_t *info;
|
player_info_t *info = gEngfuncs.pfnPlayerInfo( index );
|
||||||
player_model_t *state;
|
player_model_t *state;
|
||||||
|
|
||||||
if( !RI.drawWorld )
|
#if 0
|
||||||
{
|
|
||||||
// we are in gameui.
|
|
||||||
info = &gameui.playerinfo;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( index < 0 || index >= cl.maxclients )
|
|
||||||
return NULL; // bad client ?
|
|
||||||
info = &cl.players[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
state = &cl.player_models[index];
|
state = &cl.player_models[index];
|
||||||
|
#endif
|
||||||
|
|
||||||
// g-cont: force for "dev-mode", non-local games and menu preview
|
// g-cont: force for "dev-mode", non-local games and menu preview
|
||||||
if(( host_developer.value || !Host_IsLocalGame( ) || !RI.drawWorld ) && info->model[0] )
|
if(( host_developer.value || !Host_IsLocalGame( ) || !RI.drawWorld ) && info->model[0] )
|
||||||
@ -2432,7 +2431,7 @@ static model_t *R_StudioSetupPlayerModel( int index )
|
|||||||
Q_snprintf( state->modelname, sizeof( state->modelname ), "models/player/%s/%s.mdl", info->model, info->model );
|
Q_snprintf( state->modelname, sizeof( state->modelname ), "models/player/%s/%s.mdl", info->model, info->model );
|
||||||
|
|
||||||
if( gEngfuncs.FS_FileExists( state->modelname, false ))
|
if( gEngfuncs.FS_FileExists( state->modelname, false ))
|
||||||
state->model = Mod_ForName( state->modelname, false, true );
|
state->model = gEngfuncs.Mod_ForName( state->modelname, false, true );
|
||||||
else state->model = NULL;
|
else state->model = NULL;
|
||||||
|
|
||||||
if( !state->model )
|
if( !state->model )
|
||||||
@ -2473,7 +2472,7 @@ int R_GetEntityRenderMode( cl_entity_t *ent )
|
|||||||
|
|
||||||
RI.currententity = oldent;
|
RI.currententity = oldent;
|
||||||
|
|
||||||
if(( phdr = Mod_StudioExtradata( model )) == NULL )
|
if(( phdr = gEngfuncs.Mod_Extradata( mod_studio, model )) == NULL )
|
||||||
{
|
{
|
||||||
if( R_ModelOpaque( ent->curstate.rendermode ))
|
if( R_ModelOpaque( ent->curstate.rendermode ))
|
||||||
{
|
{
|
||||||
@ -3079,7 +3078,7 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
|||||||
if( RI.currentmodel == NULL )
|
if( RI.currentmodel == NULL )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
R_StudioSetHeader((studiohdr_t *)Mod_StudioExtradata( RI.currentmodel ));
|
R_StudioSetHeader((studiohdr_t *)gEngfuncs.Mod_Extradata( mod_studio, RI.currentmodel ));
|
||||||
|
|
||||||
if( pplayer->gaitsequence )
|
if( pplayer->gaitsequence )
|
||||||
{
|
{
|
||||||
@ -3184,9 +3183,9 @@ static int R_StudioDrawPlayer( int flags, entity_state_t *pplayer )
|
|||||||
if( pplayer->weaponmodel )
|
if( pplayer->weaponmodel )
|
||||||
{
|
{
|
||||||
cl_entity_t saveent = *RI.currententity;
|
cl_entity_t saveent = *RI.currententity;
|
||||||
model_t *pweaponmodel = CL_ModelHandle( pplayer->weaponmodel );
|
model_t *pweaponmodel = gEngfuncs.pfnGetModelByIndex( pplayer->weaponmodel );
|
||||||
|
|
||||||
m_pStudioHeader = (studiohdr_t *)Mod_StudioExtradata( pweaponmodel );
|
m_pStudioHeader = (studiohdr_t *)gEngfuncs.Mod_Extradata( mod_studio, pweaponmodel );
|
||||||
|
|
||||||
R_StudioMergeBones( RI.currententity, pweaponmodel );
|
R_StudioMergeBones( RI.currententity, pweaponmodel );
|
||||||
R_StudioSetupLighting( &lighting );
|
R_StudioSetupLighting( &lighting );
|
||||||
@ -3238,7 +3237,7 @@ static int R_StudioDrawModel( int flags )
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
R_StudioSetHeader((studiohdr_t *)Mod_StudioExtradata( RI.currentmodel ));
|
R_StudioSetHeader((studiohdr_t *)gEngfuncs.Mod_Extradata( mod_studio, RI.currentmodel ));
|
||||||
|
|
||||||
R_StudioSetUpTransform( RI.currententity );
|
R_StudioSetUpTransform( RI.currententity );
|
||||||
|
|
||||||
@ -3608,7 +3607,12 @@ void Mod_StudioUnloadTextures( void *data )
|
|||||||
GL_FreeTexture( ptexture[i].index );
|
GL_FreeTexture( ptexture[i].index );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static model_t *pfnModelHandle( int modelindex )
|
||||||
|
{
|
||||||
|
return gEngfuncs.pfnGetModelByIndex( modelindex );
|
||||||
|
}
|
||||||
|
|
||||||
static engine_studio_api_t gStudioAPI =
|
static engine_studio_api_t gStudioAPI =
|
||||||
{
|
{
|
||||||
Mod_Calloc,
|
Mod_Calloc,
|
||||||
@ -3616,7 +3620,7 @@ static engine_studio_api_t gStudioAPI =
|
|||||||
Mod_LoadCacheFile,
|
Mod_LoadCacheFile,
|
||||||
pfnMod_ForName,
|
pfnMod_ForName,
|
||||||
Mod_StudioExtradata,
|
Mod_StudioExtradata,
|
||||||
CL_ModelHandle,
|
pfnModelHandle,
|
||||||
pfnGetCurrentEntity,
|
pfnGetCurrentEntity,
|
||||||
pfnPlayerInfo,
|
pfnPlayerInfo,
|
||||||
R_StudioGetPlayerState,
|
R_StudioGetPlayerState,
|
||||||
|
@ -16,6 +16,12 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
|
|
||||||
|
#define VGUI_MAX_TEXTURES ( MAX_TEXTURES / 2 ) // a half of total textures count
|
||||||
|
|
||||||
|
static int g_textures[VGUI_MAX_TEXTURES];
|
||||||
|
static int g_textureId = 0;
|
||||||
|
static int g_iBoundTexture;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
================
|
================
|
||||||
VGUI_DrawInit
|
VGUI_DrawInit
|
||||||
@ -56,7 +62,7 @@ generate unique texture number
|
|||||||
int GAME_EXPORT VGUI_GenerateTexture( void )
|
int GAME_EXPORT VGUI_GenerateTexture( void )
|
||||||
{
|
{
|
||||||
if( ++g_textureId >= VGUI_MAX_TEXTURES )
|
if( ++g_textureId >= VGUI_MAX_TEXTURES )
|
||||||
Sys_Error( "VGUI_GenerateTexture: VGUI_MAX_TEXTURES limit exceeded\n" );
|
gEngfuncs.Host_Error( "VGUI_GenerateTexture: VGUI_MAX_TEXTURES limit exceeded\n" );
|
||||||
return g_textureId;
|
return g_textureId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +80,7 @@ void GAME_EXPORT VGUI_UploadTexture( int id, const char *buffer, int width, int
|
|||||||
|
|
||||||
if( id <= 0 || id >= VGUI_MAX_TEXTURES )
|
if( id <= 0 || id >= VGUI_MAX_TEXTURES )
|
||||||
{
|
{
|
||||||
Con_DPrintf( S_ERROR "VGUI_UploadTexture: bad texture %i. Ignored\n", id );
|
gEngfuncs.Con_DPrintf( S_ERROR "VGUI_UploadTexture: bad texture %i. Ignored\n", id );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +111,7 @@ void GAME_EXPORT VGUI_CreateTexture( int id, int width, int height )
|
|||||||
|
|
||||||
if( id <= 0 || id >= VGUI_MAX_TEXTURES )
|
if( id <= 0 || id >= VGUI_MAX_TEXTURES )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "VGUI_CreateTexture: bad texture %i. Ignored\n", id );
|
gEngfuncs.Con_Reportf( S_ERROR "VGUI_CreateTexture: bad texture %i. Ignored\n", id );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +133,7 @@ void GAME_EXPORT VGUI_UploadTextureBlock( int id, int drawX, int drawY, const by
|
|||||||
{
|
{
|
||||||
if( id <= 0 || id >= VGUI_MAX_TEXTURES || g_textures[id] == 0 || g_textures[id] == tr.whiteTexture )
|
if( id <= 0 || id >= VGUI_MAX_TEXTURES || g_textures[id] == 0 || g_textures[id] == tr.whiteTexture )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "VGUI_UploadTextureBlock: bad texture %i. Ignored\n", id );
|
gEngfuncs.Con_Reportf( S_ERROR "VGUI_UploadTextureBlock: bad texture %i. Ignored\n", id );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -221,8 +227,13 @@ generic method to fill rectangle
|
|||||||
*/
|
*/
|
||||||
void GAME_EXPORT VGUI_DrawQuad( const vpoint_t *ul, const vpoint_t *lr )
|
void GAME_EXPORT VGUI_DrawQuad( const vpoint_t *ul, const vpoint_t *lr )
|
||||||
{
|
{
|
||||||
float xscale = gpGlobals->width / (float)clgame.scrInfo.iWidth;
|
int width, height;
|
||||||
float yscale = gpGlobals->height / (float)clgame.scrInfo.iHeight;
|
float xscale, yscale;
|
||||||
|
|
||||||
|
gEngfuncs.CL_GetScreenInfo( &width, &height );
|
||||||
|
|
||||||
|
xscale = gpGlobals->width / (float)width;
|
||||||
|
yscale = gpGlobals->height / (float)height;
|
||||||
|
|
||||||
ASSERT( ul != NULL && lr != NULL );
|
ASSERT( ul != NULL && lr != NULL );
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ GNU General Public License for more details.
|
|||||||
|
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "wadfile.h"
|
#include "wadfile.h"
|
||||||
|
#include "common.h"
|
||||||
|
|
||||||
#define SKYCLOUDS_QUALITY 12
|
#define SKYCLOUDS_QUALITY 12
|
||||||
#define MAX_CLIP_VERTS 128 // skybox clip vertices
|
#define MAX_CLIP_VERTS 128 // skybox clip vertices
|
||||||
@ -162,7 +163,7 @@ void ClipSkyPolygon( int nump, vec3_t vecs, int stage )
|
|||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
if( nump > MAX_CLIP_VERTS )
|
if( nump > MAX_CLIP_VERTS )
|
||||||
Host_Error( "ClipSkyPolygon: MAX_CLIP_VERTS\n" );
|
gEngfuncs.Host_Error( "ClipSkyPolygon: MAX_CLIP_VERTS\n" );
|
||||||
loc1:
|
loc1:
|
||||||
if( stage == 6 )
|
if( stage == 6 )
|
||||||
{
|
{
|
||||||
@ -310,7 +311,7 @@ void R_AddSkyBoxSurface( msurface_t *fa )
|
|||||||
float *v;
|
float *v;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( gEngfuncs.CL_GetRenderParm( PARM_SKY_SPHERE ) && fa->polys && !tr.fCustomSkybox )
|
if( gEngfuncs.CL_GetRenderParm( PARM_SKY_SPHERE, 0 ) && fa->polys && !tr.fCustomSkybox )
|
||||||
{
|
{
|
||||||
glpoly_t *p = fa->polys;
|
glpoly_t *p = fa->polys;
|
||||||
|
|
||||||
@ -432,7 +433,7 @@ void R_SetupSky( const char *skyboxname )
|
|||||||
// to prevent infinite recursion if default skybox was missed
|
// to prevent infinite recursion if default skybox was missed
|
||||||
if( result == SKYBOX_MISSED && Q_stricmp( loadname, DEFAULT_SKYBOX_PATH ))
|
if( result == SKYBOX_MISSED && Q_stricmp( loadname, DEFAULT_SKYBOX_PATH ))
|
||||||
{
|
{
|
||||||
Con_Reportf( S_WARN "missed or incomplete skybox '%s'\n", skyboxname );
|
gEngfuncs.Con_Reportf( S_WARN "missed or incomplete skybox '%s'\n", skyboxname );
|
||||||
R_SetupSky( "desert" ); // force to default
|
R_SetupSky( "desert" ); // force to default
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -678,7 +679,7 @@ void R_InitSkyClouds( mip_t *mt, texture_t *tx, qboolean custom_palette )
|
|||||||
// make sure what sky image is valid
|
// make sure what sky image is valid
|
||||||
if( !r_sky || !r_sky->palette || r_sky->type != PF_INDEXED_32 || r_sky->height == 0 )
|
if( !r_sky || !r_sky->palette || r_sky->type != PF_INDEXED_32 || r_sky->height == 0 )
|
||||||
{
|
{
|
||||||
Con_Reportf( S_ERROR "R_InitSky: unable to load sky texture %s\n", tx->name );
|
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 ) FS_FreeImage( r_sky );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user