07 Apr 2011
This commit is contained in:
parent
ce6752545e
commit
bedad89a83
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "gl_local.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
====================
|
====================
|
||||||
|
|
|
@ -197,7 +197,7 @@ void CL_WriteDemoHeader( const char *name )
|
||||||
FS_Write( cls.demofile, BF_GetData( &buf ), len );
|
FS_Write( cls.demofile, BF_GetData( &buf ), len );
|
||||||
|
|
||||||
// force client.dll update
|
// force client.dll update
|
||||||
Cmd_ExecuteString( "cmd fullupdate\n" );
|
Cmd_ExecuteString( "cmd fullupdate\n", src_command );
|
||||||
if( clgame.hInstance ) clgame.dllFuncs.pfnReset();
|
if( clgame.hInstance ) clgame.dllFuncs.pfnReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "net_encode.h"
|
#include "net_encode.h"
|
||||||
#include "entity_types.h"
|
#include "entity_types.h"
|
||||||
|
#include "gl_local.h"
|
||||||
#include "pm_local.h"
|
#include "pm_local.h"
|
||||||
#include "cl_tent.h"
|
#include "cl_tent.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
@ -352,7 +353,7 @@ void CL_DeltaEntity( sizebuf_t *msg, frame_t *frame, int newnum, entity_state_t
|
||||||
qboolean newent = (old) ? false : true;
|
qboolean newent = (old) ? false : true;
|
||||||
qboolean result = true;
|
qboolean result = true;
|
||||||
|
|
||||||
ent = EDICT_NUM( newnum );
|
ent = CL_EDICT_NUM( newnum );
|
||||||
state = &cls.packet_entities[cls.next_client_entities % cls.num_client_entities];
|
state = &cls.packet_entities[cls.next_client_entities % cls.num_client_entities];
|
||||||
ent->index = newnum;
|
ent->index = newnum;
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ cl_entity_t *CL_GetEntityByIndex( int index )
|
||||||
if( index >= clgame.maxEntities )
|
if( index >= clgame.maxEntities )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return EDICT_NUM( index );
|
return CL_EDICT_NUM( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -750,7 +750,7 @@ cl_entity_t *CL_GetLocalPlayer( void )
|
||||||
{
|
{
|
||||||
cl_entity_t *player;
|
cl_entity_t *player;
|
||||||
|
|
||||||
player = EDICT_NUM( cl.playernum + 1 );
|
player = CL_EDICT_NUM( cl.playernum + 1 );
|
||||||
ASSERT( player != NULL );
|
ASSERT( player != NULL );
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
@ -1273,12 +1273,12 @@ void CL_ClearWorld( void )
|
||||||
{
|
{
|
||||||
cl_entity_t *ent;
|
cl_entity_t *ent;
|
||||||
|
|
||||||
ent = EDICT_NUM( 0 );
|
ent = clgame.entities;
|
||||||
ent->index = NUM_FOR_EDICT( ent );
|
|
||||||
ent->curstate.modelindex = 1; // world model
|
ent->curstate.modelindex = 1; // world model
|
||||||
ent->curstate.solid = SOLID_BSP;
|
ent->curstate.solid = SOLID_BSP;
|
||||||
ent->curstate.movetype = MOVETYPE_PUSH;
|
ent->curstate.movetype = MOVETYPE_PUSH;
|
||||||
ent->model = cl.worldmodel;
|
ent->model = cl.worldmodel;
|
||||||
|
ent->index = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CL_InitEdicts( void )
|
void CL_InitEdicts( void )
|
||||||
|
@ -2105,7 +2105,7 @@ static cl_entity_t *pfnGetEntityByIndex( int index )
|
||||||
if( index >= clgame.maxEntities )
|
if( index >= clgame.maxEntities )
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return EDICT_NUM( index );
|
return CL_EDICT_NUM( index );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -3534,8 +3534,8 @@ static cl_enginefunc_t gEngfuncs =
|
||||||
pfnGetScreenInfo,
|
pfnGetScreenInfo,
|
||||||
pfnSetCrosshair,
|
pfnSetCrosshair,
|
||||||
pfnCvar_RegisterVariable,
|
pfnCvar_RegisterVariable,
|
||||||
pfnCVarGetValue,
|
Cvar_VariableValue,
|
||||||
pfnCVarGetString,
|
Cvar_VariableString,
|
||||||
pfnAddClientCommand,
|
pfnAddClientCommand,
|
||||||
pfnHookUserMsg,
|
pfnHookUserMsg,
|
||||||
pfnServerCmd,
|
pfnServerCmd,
|
||||||
|
@ -3556,9 +3556,9 @@ static cl_enginefunc_t gEngfuncs =
|
||||||
pfnGetViewAngles,
|
pfnGetViewAngles,
|
||||||
pfnSetViewAngles,
|
pfnSetViewAngles,
|
||||||
CL_GetMaxClients,
|
CL_GetMaxClients,
|
||||||
pfnCVarSetValue,
|
Cvar_SetFloat,
|
||||||
pfnCmd_Argc,
|
Cmd_Argc,
|
||||||
pfnCmd_Argv,
|
Cmd_Argv,
|
||||||
Con_Printf,
|
Con_Printf,
|
||||||
Con_DPrintf,
|
Con_DPrintf,
|
||||||
Con_NPrintf,
|
Con_NPrintf,
|
||||||
|
|
|
@ -109,8 +109,8 @@ qboolean CL_ChangeGame( const char *gamefolder, qboolean bReset )
|
||||||
clgame.dllFuncs.IN_ActivateMouse();
|
clgame.dllFuncs.IN_ActivateMouse();
|
||||||
|
|
||||||
// restore mlook state
|
// restore mlook state
|
||||||
if( mlook_active ) Cmd_ExecuteString( "+mlook\n" );
|
if( mlook_active ) Cmd_ExecuteString( "+mlook\n", src_command );
|
||||||
if( jlook_active ) Cmd_ExecuteString( "+jlook\n" );
|
if( jlook_active ) Cmd_ExecuteString( "+jlook\n", src_command );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -198,90 +198,6 @@ void CL_ComputePacketLoss( void )
|
||||||
/*
|
/*
|
||||||
=======================================================================
|
=======================================================================
|
||||||
|
|
||||||
CLIENT RELIABLE COMMAND COMMUNICATION
|
|
||||||
|
|
||||||
=======================================================================
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
===================
|
|
||||||
Cmd_ForwardToServer
|
|
||||||
|
|
||||||
adds the current command line as a clc_stringcmd to the client message.
|
|
||||||
things like godmode, noclip, etc, are commands directed to the server,
|
|
||||||
so when they are typed in at the console, they will need to be forwarded.
|
|
||||||
===================
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
CL_ForwardToServer_f
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void CL_ForwardToServer_f( void )
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
if( cls.demoplayback )
|
|
||||||
{
|
|
||||||
if( !Q_stricmp( Cmd_Argv( 1 ), "pause" ))
|
|
||||||
cl.refdef.paused ^= 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( cls.state != ca_connected && cls.state != ca_active )
|
|
||||||
return; // not connected
|
|
||||||
|
|
||||||
cmd = Cmd_Argv( 0 );
|
|
||||||
if( *cmd == '-' || *cmd == '+' )
|
|
||||||
{
|
|
||||||
MsgDev( D_INFO, "Unknown command \"%s\"\n", cmd );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't forward the first argument
|
|
||||||
if( Cmd_Argc() > 1 )
|
|
||||||
{
|
|
||||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
|
||||||
BF_WriteString( &cls.netchan.message, Cmd_Args( ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
===================
|
|
||||||
Cmd_ForwardToServer
|
|
||||||
|
|
||||||
adds the current command line as a clc_stringcmd to the client message.
|
|
||||||
things like godmode, noclip, etc, are commands directed to the server,
|
|
||||||
so when they are typed in at the console, they will need to be forwarded.
|
|
||||||
===================
|
|
||||||
*/
|
|
||||||
void Cmd_ForwardToServer( void )
|
|
||||||
{
|
|
||||||
char *cmd;
|
|
||||||
|
|
||||||
if( cls.demoplayback )
|
|
||||||
{
|
|
||||||
if( !Q_stricmp( Cmd_Argv( 1 ), "pause" ))
|
|
||||||
cl.refdef.paused ^= 1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
cmd = Cmd_Argv( 0 );
|
|
||||||
if( *cmd == '-' || *cmd == '+' )
|
|
||||||
{
|
|
||||||
MsgDev( D_INFO, "Unknown command \"%s\"\n", cmd );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
|
||||||
|
|
||||||
if( Cmd_Argc() > 1 )
|
|
||||||
BF_WriteString( &cls.netchan.message, va( "%s %s", cmd, Cmd_Args( )));
|
|
||||||
else BF_WriteString( &cls.netchan.message, cmd );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=======================================================================
|
|
||||||
|
|
||||||
CLIENT MOVEMENT COMMUNICATION
|
CLIENT MOVEMENT COMMUNICATION
|
||||||
|
|
||||||
=======================================================================
|
=======================================================================
|
||||||
|
@ -1525,7 +1441,6 @@ void CL_InitLocal( void )
|
||||||
Cmd_AddCommand ("fov", NULL, "set client field of view" );
|
Cmd_AddCommand ("fov", NULL, "set client field of view" );
|
||||||
|
|
||||||
// register our commands
|
// register our commands
|
||||||
Cmd_AddCommand ("cmd", CL_ForwardToServer_f, "send a console commandline to the server" );
|
|
||||||
Cmd_AddCommand ("pause", NULL, "pause the game (if the server allows pausing)" );
|
Cmd_AddCommand ("pause", NULL, "pause the game (if the server allows pausing)" );
|
||||||
Cmd_AddCommand ("localservers", CL_LocalServers_f, "collect info about local servers" );
|
Cmd_AddCommand ("localservers", CL_LocalServers_f, "collect info about local servers" );
|
||||||
Cmd_AddCommand ("cd", CL_PlayCDTrack_f, "Play cd-track (not real cd-player of course)" );
|
Cmd_AddCommand ("cd", CL_PlayCDTrack_f, "Play cd-track (not real cd-player of course)" );
|
||||||
|
|
|
@ -527,16 +527,12 @@ pfnClientCmd
|
||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
static void pfnClientCmd( int execute_now, const char *szCmdString )
|
static void pfnClientCmd( int exec_now, const char *szCmdString )
|
||||||
{
|
{
|
||||||
int when;
|
|
||||||
|
|
||||||
if( execute_now )
|
|
||||||
when = EXEC_NOW;
|
|
||||||
else when = EXEC_APPEND;
|
|
||||||
|
|
||||||
// client command executes immediately
|
// client command executes immediately
|
||||||
Cbuf_ExecuteText( when, szCmdString );
|
Cbuf_AddText( szCmdString );
|
||||||
|
|
||||||
|
if( exec_now ) Cbuf_Execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -666,7 +662,7 @@ send client connect
|
||||||
*/
|
*/
|
||||||
static void pfnClientJoin( const netadr_t adr )
|
static void pfnClientJoin( const netadr_t adr )
|
||||||
{
|
{
|
||||||
Cbuf_ExecuteText( EXEC_APPEND, va( "connect %s\n", NET_AdrToString( adr )));
|
Cbuf_AddText( va( "connect %s\n", NET_AdrToString( adr )));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -876,18 +872,20 @@ static ui_enginefuncs_t gEngfuncs =
|
||||||
pfnPIC_DisableScissor,
|
pfnPIC_DisableScissor,
|
||||||
pfnFillRGBA,
|
pfnFillRGBA,
|
||||||
pfnCvar_RegisterVariable,
|
pfnCvar_RegisterVariable,
|
||||||
pfnCVarGetValue,
|
Cvar_VariableValue,
|
||||||
pfnCVarGetString,
|
Cvar_VariableString,
|
||||||
pfnCVarSetString,
|
Cvar_Set,
|
||||||
pfnCVarSetValue,
|
Cvar_SetFloat,
|
||||||
pfnAddCommand,
|
pfnAddClientCommand,
|
||||||
pfnClientCmd,
|
pfnClientCmd,
|
||||||
pfnDelCommand,
|
Cmd_RemoveCommand,
|
||||||
pfnCmd_Argc,
|
Cmd_Argc,
|
||||||
pfnCmd_Argv,
|
Cmd_Argv,
|
||||||
pfnCmd_Args,
|
Cmd_Args,
|
||||||
Con_Printf,
|
Con_Printf,
|
||||||
Con_DPrintf,
|
Con_DPrintf,
|
||||||
|
Con_NPrintf,
|
||||||
|
Con_NXPrintf,
|
||||||
pfnPlaySound,
|
pfnPlaySound,
|
||||||
UI_DrawLogo,
|
UI_DrawLogo,
|
||||||
UI_GetLogoWidth,
|
UI_GetLogoWidth,
|
||||||
|
@ -903,18 +901,13 @@ static ui_enginefuncs_t gEngfuncs =
|
||||||
V_ClearScene,
|
V_ClearScene,
|
||||||
pfnRenderScene,
|
pfnRenderScene,
|
||||||
CL_AddEntity,
|
CL_AddEntity,
|
||||||
pfnLoadLibrary,
|
|
||||||
pfnGetProcAddress,
|
|
||||||
pfnFreeLibrary,
|
|
||||||
Host_Error,
|
Host_Error,
|
||||||
pfnFileExists,
|
FS_FileExists,
|
||||||
pfnGetGameDir,
|
pfnGetGameDir,
|
||||||
VGui_GetPanel,
|
|
||||||
VGui_ViewportPaintBackground,
|
|
||||||
Cmd_CheckMapsList,
|
Cmd_CheckMapsList,
|
||||||
CL_Active,
|
CL_Active,
|
||||||
pfnClientJoin,
|
pfnClientJoin,
|
||||||
pfnLoadFile,
|
COM_LoadFileForMe,
|
||||||
COM_ParseFile,
|
COM_ParseFile,
|
||||||
COM_FreeFile,
|
COM_FreeFile,
|
||||||
Key_ClearStates,
|
Key_ClearStates,
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "net_encode.h"
|
#include "net_encode.h"
|
||||||
#include "event_flags.h"
|
#include "event_flags.h"
|
||||||
#include "particledef.h"
|
#include "particledef.h"
|
||||||
|
#include "gl_local.h"
|
||||||
#include "cl_tent.h"
|
#include "cl_tent.h"
|
||||||
#include "shake.h"
|
#include "shake.h"
|
||||||
|
|
||||||
|
@ -771,7 +772,7 @@ void CL_ParseBaseline( sizebuf_t *msg )
|
||||||
if( newnum < 0 ) Host_Error( "CL_SpawnEdict: invalid number %i\n", newnum );
|
if( newnum < 0 ) Host_Error( "CL_SpawnEdict: invalid number %i\n", newnum );
|
||||||
if( newnum > clgame.maxEntities ) Host_Error( "CL_AllocEdict: no free edicts\n" );
|
if( newnum > clgame.maxEntities ) Host_Error( "CL_AllocEdict: no free edicts\n" );
|
||||||
|
|
||||||
ent = EDICT_NUM( newnum );
|
ent = CL_EDICT_NUM( newnum );
|
||||||
Q_memset( &ent->prevstate, 0, sizeof( ent->prevstate ));
|
Q_memset( &ent->prevstate, 0, sizeof( ent->prevstate ));
|
||||||
ent->index = newnum;
|
ent->index = newnum;
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ qboolean CL_CopyEntityToPhysEnt( physent_t *pe, cl_entity_t *ent )
|
||||||
pe->model = mod;
|
pe->model = mod;
|
||||||
}
|
}
|
||||||
|
|
||||||
pe->info = NUM_FOR_EDICT( ent );
|
pe->info = (int)(ent - clgame.entities);
|
||||||
VectorCopy( ent->curstate.origin, pe->origin );
|
VectorCopy( ent->curstate.origin, pe->origin );
|
||||||
VectorCopy( ent->curstate.angles, pe->angles );
|
VectorCopy( ent->curstate.angles, pe->angles );
|
||||||
VectorCopy( ent->curstate.mins, pe->mins );
|
VectorCopy( ent->curstate.mins, pe->mins );
|
||||||
|
@ -531,7 +531,7 @@ void CL_InitClientMove( void )
|
||||||
clgame.pmove->COM_FileSize = COM_FileSize;
|
clgame.pmove->COM_FileSize = COM_FileSize;
|
||||||
clgame.pmove->COM_LoadFile = COM_LoadFile;
|
clgame.pmove->COM_LoadFile = COM_LoadFile;
|
||||||
clgame.pmove->COM_FreeFile = COM_FreeFile;
|
clgame.pmove->COM_FreeFile = COM_FreeFile;
|
||||||
clgame.pmove->memfgets = pfnMemFgets;
|
clgame.pmove->memfgets = COM_MemFgets;
|
||||||
clgame.pmove->PM_PlaySound = pfnPlaySound;
|
clgame.pmove->PM_PlaySound = pfnPlaySound;
|
||||||
clgame.pmove->PM_TraceTexture = pfnTraceTexture;
|
clgame.pmove->PM_TraceTexture = pfnTraceTexture;
|
||||||
clgame.pmove->PM_PlaybackEventFull = pfnPlaybackEventFull;
|
clgame.pmove->PM_PlaybackEventFull = pfnPlaybackEventFull;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "gl_local.h"
|
||||||
#include "qfont.h"
|
#include "qfont.h"
|
||||||
|
|
||||||
convar_t *scr_viewsize;
|
convar_t *scr_viewsize;
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
#include "menu_int.h"
|
#include "menu_int.h"
|
||||||
#include "cl_entity.h"
|
#include "cl_entity.h"
|
||||||
#include "com_model.h"
|
#include "com_model.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "pm_defs.h"
|
#include "pm_defs.h"
|
||||||
#include "pm_movevars.h"
|
#include "pm_movevars.h"
|
||||||
#include "screenfade.h"
|
#include "screenfade.h"
|
||||||
|
@ -30,9 +30,6 @@
|
||||||
#define VID_LEVELSHOT 1
|
#define VID_LEVELSHOT 1
|
||||||
#define VID_MINISHOT 2
|
#define VID_MINISHOT 2
|
||||||
|
|
||||||
#define EDICT_FROM_AREA( l ) STRUCT_FROM_LINK( l, cl_entity_t, area )
|
|
||||||
#define NUM_FOR_EDICT(e) ((int)((cl_entity_t *)(e) - clgame.entities))
|
|
||||||
#define EDICT_NUM( num ) CL_EDICT_NUM( num, __FILE__, __LINE__ )
|
|
||||||
#define cl_time() ( cl.time )
|
#define cl_time() ( cl.time )
|
||||||
#define sv_time() ( cl.mtime[0] )
|
#define sv_time() ( cl.mtime[0] )
|
||||||
|
|
||||||
|
@ -578,11 +575,12 @@ int pfnIndexFromTrace( struct pmtrace_s *pTrace );
|
||||||
int CL_FindModelIndex( const char *m );
|
int CL_FindModelIndex( const char *m );
|
||||||
HSPRITE pfnSPR_Load( const char *szPicName );
|
HSPRITE pfnSPR_Load( const char *szPicName );
|
||||||
|
|
||||||
_inline cl_entity_t *CL_EDICT_NUM( int n, const char *file, const int line )
|
_inline cl_entity_t *CL_EDICT_NUM( int n )
|
||||||
{
|
{
|
||||||
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
if(( n >= 0 ) && ( n < clgame.maxEntities ))
|
||||||
return clgame.entities + n;
|
return clgame.entities + n;
|
||||||
Host_Error( "CL_EDICT_NUM: bad number %i (called at %s:%i)\n", n, file, line );
|
|
||||||
|
Host_Error( "CL_EDICT_NUM: bad number %i\n", n );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,11 @@ extern byte *r_temppool;
|
||||||
#define RP_NONVIEWERREF (RP_PORTALVIEW|RP_MIRRORVIEW|RP_ENVVIEW|RP_SKYPORTALVIEW|RP_SHADOWMAPVIEW)
|
#define RP_NONVIEWERREF (RP_PORTALVIEW|RP_MIRRORVIEW|RP_ENVVIEW|RP_SKYPORTALVIEW|RP_SHADOWMAPVIEW)
|
||||||
#define RP_LOCALCLIENT( e ) (CL_GetLocalPlayer() && ((e)->index == CL_GetLocalPlayer()->index && e->player ))
|
#define RP_LOCALCLIENT( e ) (CL_GetLocalPlayer() && ((e)->index == CL_GetLocalPlayer()->index && e->player ))
|
||||||
|
|
||||||
|
#define TF_SKY (TF_SKYSIDE|TF_UNCOMPRESSED|TF_NOMIPMAP|TF_NOPICMIP)
|
||||||
|
#define TF_FONT (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP)
|
||||||
|
#define TF_IMAGE (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP)
|
||||||
|
#define TF_DECAL (TF_CLAMP|TF_UNCOMPRESSED)
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TEX_INVALID = 0, // free slot
|
TEX_INVALID = 0, // free slot
|
||||||
|
@ -55,6 +60,25 @@ typedef enum
|
||||||
TEX_CUBEMAP // cubemap textures (sky)
|
TEX_CUBEMAP // cubemap textures (sky)
|
||||||
} texType_t;
|
} texType_t;
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
TF_STATIC = BIT(0), // don't free until Shader_FreeUnused()
|
||||||
|
TF_NOPICMIP = BIT(1), // ignore r_picmip resample rules
|
||||||
|
TF_UNCOMPRESSED = BIT(2), // don't compress texture in video memory
|
||||||
|
TF_CUBEMAP = BIT(3), // it's cubemap texture
|
||||||
|
TF_DEPTHMAP = BIT(4), // custom texture filter used
|
||||||
|
TF_INTENSITY = BIT(5),
|
||||||
|
TF_LUMINANCE = BIT(6), // force image to grayscale
|
||||||
|
TF_SKYSIDE = BIT(7),
|
||||||
|
TF_CLAMP = BIT(8),
|
||||||
|
TF_NOMIPMAP = BIT(9),
|
||||||
|
TF_NEAREST = BIT(10), // disable texfilter
|
||||||
|
TF_HAS_LUMA = BIT(11), // sets by GL_UploadTexture
|
||||||
|
TF_MAKELUMA = BIT(12), // create luma from quake texture
|
||||||
|
TF_NORMALMAP = BIT(13), // is a normalmap
|
||||||
|
TF_LIGHTMAP = BIT(14), // is a lightmap
|
||||||
|
} texFlags_t;
|
||||||
|
|
||||||
typedef struct gltexture_s
|
typedef struct gltexture_s
|
||||||
{
|
{
|
||||||
char name[64]; // game path, including extension
|
char name[64]; // game path, including extension
|
||||||
|
@ -362,6 +386,48 @@ void VID_CheckChanges( void );
|
||||||
qboolean R_Init( void );
|
qboolean R_Init( void );
|
||||||
void R_Shutdown( void );
|
void R_Shutdown( void );
|
||||||
|
|
||||||
|
//
|
||||||
|
// renderer exports
|
||||||
|
//
|
||||||
|
qboolean R_Init( void );
|
||||||
|
void R_Shutdown( void );
|
||||||
|
void VID_CheckChanges( void );
|
||||||
|
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
|
||||||
|
void GL_FreeImage( const char *name );
|
||||||
|
qboolean VID_ScreenShot( const char *filename, int shot_type );
|
||||||
|
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
|
||||||
|
void VID_RestoreGamma( void );
|
||||||
|
void R_BeginFrame( qboolean clearScene );
|
||||||
|
void R_RenderFrame( const ref_params_t *fd, qboolean drawWorld );
|
||||||
|
void R_EndFrame( void );
|
||||||
|
void R_ClearScene( void );
|
||||||
|
void R_GetTextureParms( int *w, int *h, int texnum );
|
||||||
|
void R_GetSpriteParms( int *frameWidth, int *frameHeight, int *numFrames, int curFrame, const struct model_s *pSprite );
|
||||||
|
void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty );
|
||||||
|
void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum );
|
||||||
|
qboolean R_SpeedsMessage( char *out, size_t size );
|
||||||
|
void R_SetupSky( const char *skyboxname );
|
||||||
|
qboolean R_CullBox( const vec3_t mins, const vec3_t maxs, uint clipflags );
|
||||||
|
qboolean R_WorldToScreen( const vec3_t point, vec3_t screen );
|
||||||
|
void R_ScreenToWorld( const vec3_t screen, vec3_t point );
|
||||||
|
qboolean R_AddEntity( struct cl_entity_s *pRefEntity, int entityType );
|
||||||
|
void Mod_LoadSpriteModel( struct model_s *mod, const void *buffer );
|
||||||
|
void Mod_LoadMapSprite( struct model_s *mod, const void *buffer, size_t size );
|
||||||
|
void Mod_UnloadSpriteModel( struct model_s *mod );
|
||||||
|
void Mod_UnloadStudioModel( struct model_s *mod );
|
||||||
|
void Mod_UnloadBrushModel( struct model_s *mod );
|
||||||
|
void GL_SetRenderMode( int mode );
|
||||||
|
void R_RunViewmodelEvents( void );
|
||||||
|
void R_DrawViewModel( void );
|
||||||
|
int R_GetSpriteTexture( const struct model_s *m_pSpriteModel, int frame );
|
||||||
|
void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLight, float radius );
|
||||||
|
void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos, int flags, vec3_t saxis );
|
||||||
|
void R_RemoveEfrags( struct cl_entity_s *ent );
|
||||||
|
void R_AddEfrags( struct cl_entity_s *ent );
|
||||||
|
void R_DecalRemoveAll( int texture );
|
||||||
|
byte *Mod_GetCurrentVis( void );
|
||||||
|
void R_NewMap( void );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=======================================================================
|
=======================================================================
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "entity_types.h"
|
#include "entity_types.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
|
|
||||||
void R_NewMap( void )
|
void R_NewMap( void )
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "gl_local.h"
|
#include "gl_local.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
#define VID_DEFAULTMODE "1"
|
#define VID_DEFAULTMODE "1"
|
||||||
|
|
|
@ -10,7 +10,7 @@ static char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug",
|
||||||
static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||||
|
|
||||||
// returns days since Feb 13 2007
|
// returns days since Feb 13 2007
|
||||||
int com_buildnum( void )
|
int Q_buildnum( void )
|
||||||
{
|
{
|
||||||
int m = 0, d = 0, y = 0;
|
int m = 0, d = 0, y = 0;
|
||||||
static int b = 0;
|
static int b = 0;
|
||||||
|
@ -23,6 +23,7 @@ int com_buildnum( void )
|
||||||
break;
|
break;
|
||||||
d += mond[m];
|
d += mond[m];
|
||||||
}
|
}
|
||||||
|
|
||||||
d += Q_atoi( &date[4] ) - 1;
|
d += Q_atoi( &date[4] ) - 1;
|
||||||
y = Q_atoi( &date[7] ) - 1900;
|
y = Q_atoi( &date[7] ) - 1900;
|
||||||
b = d + (int)((y - 1) * 365.25f );
|
b = d + (int)((y - 1) * 365.25f );
|
||||||
|
|
|
@ -4,20 +4,31 @@
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "server.h"
|
||||||
|
|
||||||
#define MAX_CMD_BUFFER 16384
|
#define MAX_CMD_BUFFER 8192
|
||||||
#define MAX_CMD_LINE 1024
|
#define MAX_CMD_LINE 1024
|
||||||
|
#define MAX_ALIAS_NAME 32
|
||||||
|
|
||||||
|
typedef struct cmdalias_s
|
||||||
|
{
|
||||||
|
struct cmdalias_s *next;
|
||||||
|
char name[MAX_ALIAS_NAME];
|
||||||
|
char *value;
|
||||||
|
} cmdalias_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
byte *data;
|
byte *data;
|
||||||
int maxsize;
|
int cursize;
|
||||||
int cursize;
|
int maxsize;
|
||||||
} cmd_t;
|
} cmdbuf_t;
|
||||||
|
|
||||||
int cmd_wait;
|
qboolean cmd_wait;
|
||||||
cmd_t cmd_text;
|
cmdbuf_t cmd_text;
|
||||||
byte cmd_text_buf[MAX_CMD_BUFFER];
|
byte cmd_text_buf[MAX_CMD_BUFFER];
|
||||||
|
cmdalias_t *cmd_alias;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
@ -38,6 +49,22 @@ void Cbuf_Init( void )
|
||||||
cmd_text.cursize = 0;
|
cmd_text.cursize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void *Cbuf_GetSpace( cmdbuf_t *buf, int length )
|
||||||
|
{
|
||||||
|
void *data;
|
||||||
|
|
||||||
|
if( buf->cursize + length > buf->maxsize )
|
||||||
|
{
|
||||||
|
buf->cursize = 0;
|
||||||
|
Host_Error( "Cbuf_GetSpace: overflow\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
data = buf->data + buf->cursize;
|
||||||
|
buf->cursize += length;
|
||||||
|
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cbuf_AddText
|
Cbuf_AddText
|
||||||
|
@ -50,15 +77,15 @@ void Cbuf_AddText( const char *text )
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
l = Q_strlen( text );
|
l = Q_strlen( text );
|
||||||
|
|
||||||
if( cmd_text.cursize + l >= cmd_text.maxsize )
|
if( cmd_text.cursize + l >= cmd_text.maxsize )
|
||||||
{
|
{
|
||||||
MsgDev( D_WARN, "Cbuf_AddText: overflow\n" );
|
MsgDev( D_WARN, "Cbuf_AddText: overflow\n" );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Q_memcpy( &cmd_text.data[cmd_text.cursize], text, l );
|
|
||||||
cmd_text.cursize += l;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Q_memcpy( Cbuf_GetSpace( &cmd_text, l ), text, l );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
|
@ -66,54 +93,33 @@ Cbuf_InsertText
|
||||||
|
|
||||||
Adds command text immediately after the current command
|
Adds command text immediately after the current command
|
||||||
Adds a \n to the text
|
Adds a \n to the text
|
||||||
|
FIXME: actually change the command buffer to do less copying
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cbuf_InsertText( const char *text )
|
void Cbuf_InsertText( const char *text )
|
||||||
{
|
{
|
||||||
int i, len;
|
char *temp;
|
||||||
|
int templen;
|
||||||
|
|
||||||
len = Q_strlen( text ) + 1;
|
// copy off any commands still remaining in the exec buffer
|
||||||
if( len + cmd_text.cursize > cmd_text.maxsize )
|
templen = cmd_text.cursize;
|
||||||
|
|
||||||
|
if( templen )
|
||||||
{
|
{
|
||||||
MsgDev( D_WARN, "Cbuf_InsertText overflowed\n" );
|
temp = Z_Malloc( templen );
|
||||||
return;
|
Q_memcpy( temp, cmd_text.data, templen );
|
||||||
|
cmd_text.cursize = 0;
|
||||||
}
|
}
|
||||||
|
else temp = NULL;
|
||||||
|
|
||||||
// move the existing command text
|
// add the entire text of the file
|
||||||
for( i = cmd_text.cursize - 1; i >= 0; i-- )
|
Cbuf_AddText( text );
|
||||||
|
|
||||||
|
// add the copied off data
|
||||||
|
if( templen )
|
||||||
{
|
{
|
||||||
cmd_text.data[i + len] = cmd_text.data[i];
|
Q_memcpy( Cbuf_GetSpace( &cmd_text, templen ), temp, templen );
|
||||||
}
|
Z_Free( temp );
|
||||||
|
|
||||||
// copy the new text in
|
|
||||||
Q_memcpy( cmd_text.data, (char *)text, len - 1 );
|
|
||||||
cmd_text.data[len - 1] = '\n'; // add a \n
|
|
||||||
cmd_text.cursize += len;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
============
|
|
||||||
Cbuf_ExecuteText
|
|
||||||
============
|
|
||||||
*/
|
|
||||||
void Cbuf_ExecuteText( int exec_when, const char *text )
|
|
||||||
{
|
|
||||||
switch( exec_when )
|
|
||||||
{
|
|
||||||
case EXEC_NOW:
|
|
||||||
if( text && Q_strlen( text ))
|
|
||||||
Cmd_ExecuteString( text );
|
|
||||||
else Cbuf_Execute();
|
|
||||||
break;
|
|
||||||
case EXEC_INSERT:
|
|
||||||
Cbuf_InsertText( text );
|
|
||||||
break;
|
|
||||||
case EXEC_APPEND:
|
|
||||||
Cbuf_AddText( text );
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
MsgDev( D_ERROR, "Cbuf_ExecuteText: bad execute target\n" );
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,23 +136,17 @@ void Cbuf_Execute( void )
|
||||||
|
|
||||||
while( cmd_text.cursize )
|
while( cmd_text.cursize )
|
||||||
{
|
{
|
||||||
if( cmd_wait )
|
|
||||||
{
|
|
||||||
// skip out while text still remains in buffer, leaving it for next frame
|
|
||||||
cmd_wait--;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// find a \n or ; line break
|
// find a \n or ; line break
|
||||||
text = (char *)cmd_text.data;
|
text = (char *)cmd_text.data;
|
||||||
|
|
||||||
quotes = 0;
|
quotes = 0;
|
||||||
for( i = 0; i < cmd_text.cursize; i++ )
|
for( i = 0; i < cmd_text.cursize; i++ )
|
||||||
{
|
{
|
||||||
if( text[i] == '"') quotes++;
|
if( text[i] == '"' ) quotes++;
|
||||||
if(!( quotes & 1 ) && text[i] == ';' )
|
if(!( quotes & 1 ) && text[i] == ';' )
|
||||||
break; // don't break if inside a quoted string
|
break; // don't break if inside a quoted string
|
||||||
if( text[i] == '\n' || text[i] == '\r' ) break;
|
if( text[i] == '\n' || text[i] == '\r' )
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( i >= MAX_CMD_LINE - 1 )
|
if( i >= MAX_CMD_LINE - 1 )
|
||||||
|
@ -167,17 +167,25 @@ void Cbuf_Execute( void )
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
cmd_text.cursize -= i;
|
cmd_text.cursize -= i;
|
||||||
memmove( text, text + i, cmd_text.cursize );
|
Q_memcpy( text, text + i, cmd_text.cursize );
|
||||||
}
|
}
|
||||||
|
|
||||||
// execute the command line
|
// execute the command line
|
||||||
Cmd_ExecuteString( line );
|
Cmd_ExecuteString( line, src_command );
|
||||||
|
|
||||||
|
if( cmd_wait )
|
||||||
|
{
|
||||||
|
// skip out while text still remains in buffer,
|
||||||
|
// leaving it for next frame
|
||||||
|
cmd_wait = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
SCRIPT COMMANDS
|
SCRIPT COMMANDS
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
*/
|
*/
|
||||||
|
@ -194,7 +202,7 @@ xash -nosound +cmd amlev1
|
||||||
void Cmd_StuffCmds_f( void )
|
void Cmd_StuffCmds_f( void )
|
||||||
{
|
{
|
||||||
int i, j, l = 0;
|
int i, j, l = 0;
|
||||||
char build[MAX_SYSPATH]; // this is for all commandline options combined (and is bounds checked)
|
char build[MAX_CMD_LINE]; // this is for all commandline options combined (and is bounds checked)
|
||||||
|
|
||||||
if( Cmd_Argc() != 1 )
|
if( Cmd_Argc() != 1 )
|
||||||
{
|
{
|
||||||
|
@ -257,9 +265,7 @@ bind g "cmd use rocket ; +attack ; wait ; -attack ; cmd use blaster"
|
||||||
*/
|
*/
|
||||||
void Cmd_Wait_f( void )
|
void Cmd_Wait_f( void )
|
||||||
{
|
{
|
||||||
if( Cmd_Argc() == 1 ) cmd_wait = 1;
|
cmd_wait = true;
|
||||||
else cmd_wait = Q_atoi( Cmd_Argv( 1 ));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -273,34 +279,101 @@ void Cmd_Echo_f( void )
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for(i = 1; i < Cmd_Argc(); i++)
|
for( i = 1; i < Cmd_Argc(); i++ )
|
||||||
Msg("%s ",Cmd_Argv(i));
|
Sys_Print( Cmd_Argv( i ));
|
||||||
Msg ("\n");
|
Sys_Print( "\n" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===============
|
||||||
|
Cmd_Alias_f
|
||||||
|
|
||||||
|
Creates a new command that executes a command string (possibly ; seperated)
|
||||||
|
===============
|
||||||
|
*/
|
||||||
|
void Cmd_Alias_f( void )
|
||||||
|
{
|
||||||
|
cmdalias_t *a;
|
||||||
|
char cmd[MAX_CMD_LINE];
|
||||||
|
int i, c;
|
||||||
|
char *s;
|
||||||
|
|
||||||
|
if( Cmd_Argc() == 1 )
|
||||||
|
{
|
||||||
|
Msg( "Current alias commands:\n" );
|
||||||
|
for( a = cmd_alias; a; a = a->next )
|
||||||
|
Msg( "^2%s^7 : ^3%s^7\n", a->name, a->value );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
s = Cmd_Argv( 1 );
|
||||||
|
|
||||||
|
if( Q_strlen( s ) >= MAX_ALIAS_NAME )
|
||||||
|
{
|
||||||
|
Msg( "Alias name is too long\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the alias allready exists, reuse it
|
||||||
|
for( a = cmd_alias; a; a = a->next )
|
||||||
|
{
|
||||||
|
if( !Q_strcmp( s, a->name ))
|
||||||
|
{
|
||||||
|
Z_Free( a->value );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !a )
|
||||||
|
{
|
||||||
|
a = Z_Malloc( sizeof( cmdalias_t ));
|
||||||
|
a->next = cmd_alias;
|
||||||
|
cmd_alias = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strncpy( a->name, s, sizeof( a->name ));
|
||||||
|
|
||||||
|
// copy the rest of the command line
|
||||||
|
cmd[0] = 0; // start out with a null string
|
||||||
|
|
||||||
|
c = Cmd_Argc();
|
||||||
|
|
||||||
|
for( i = 2; i < c; i++ )
|
||||||
|
{
|
||||||
|
Q_strcat( cmd, Cmd_Argv( i ));
|
||||||
|
if( i != c ) Q_strcat( cmd, " " );
|
||||||
|
}
|
||||||
|
|
||||||
|
Q_strcat( cmd, "\n" );
|
||||||
|
a->value = copystring( cmd );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
|
||||||
COMMAND EXECUTION
|
COMMAND EXECUTION
|
||||||
|
|
||||||
=============================================================================
|
=============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CMD_EXTDLL BIT( 0 )
|
#define CMD_EXTDLL BIT( 0 ) // added by game.dll
|
||||||
|
#define CMD_CLIENTDLL BIT( 1 ) // added by client.dll
|
||||||
|
|
||||||
typedef struct cmd_function_s
|
typedef struct cmd_function_s
|
||||||
{
|
{
|
||||||
struct cmd_function_s *next;
|
struct cmd_function_s *next;
|
||||||
char *name;
|
char *name;
|
||||||
char *desc;
|
|
||||||
xcommand_t function;
|
xcommand_t function;
|
||||||
|
char *desc;
|
||||||
int flags;
|
int flags;
|
||||||
} cmd_function_t;
|
} cmd_function_t;
|
||||||
|
|
||||||
static int cmd_argc;
|
static int cmd_argc;
|
||||||
|
static char *cmd_args = NULL;
|
||||||
static char *cmd_argv[MAX_CMD_TOKENS];
|
static char *cmd_argv[MAX_CMD_TOKENS];
|
||||||
static char cmd_tokenized[MAX_CMD_BUFFER]; // will have 0 bytes inserted
|
static char cmd_tokenized[MAX_CMD_BUFFER]; // will have 0 bytes inserted
|
||||||
static cmd_function_t *cmd_functions; // possible commands to execute
|
static cmd_function_t *cmd_functions; // possible commands to execute
|
||||||
|
cmd_source_t cmd_source;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
|
@ -317,9 +390,9 @@ uint Cmd_Argc( void )
|
||||||
Cmd_Argv
|
Cmd_Argv
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
char *Cmd_Argv( uint arg )
|
char *Cmd_Argv( int arg )
|
||||||
{
|
{
|
||||||
if( arg >= cmd_argc )
|
if((uint)arg >= cmd_argc )
|
||||||
return "";
|
return "";
|
||||||
return cmd_argv[arg];
|
return cmd_argv[arg];
|
||||||
}
|
}
|
||||||
|
@ -327,22 +400,10 @@ char *Cmd_Argv( uint arg )
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cmd_Args
|
Cmd_Args
|
||||||
|
|
||||||
Returns a single string containing argv(1) to argv(argc()-1)
|
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
char *Cmd_Args( void )
|
char *Cmd_Args( void )
|
||||||
{
|
{
|
||||||
static char cmd_args[MAX_SYSPATH];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
cmd_args[0] = 0;
|
|
||||||
// build only for current call
|
|
||||||
for( i = 1; i < cmd_argc; i++ )
|
|
||||||
{
|
|
||||||
Q_strcat( cmd_args, cmd_argv[i] );
|
|
||||||
if( i != cmd_argc - 1 ) Q_strcat( cmd_args, " " );
|
|
||||||
}
|
|
||||||
return cmd_args;
|
return cmd_args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,73 +417,48 @@ are inserted in the apropriate place, The argv array
|
||||||
will point into this temporary buffer.
|
will point into this temporary buffer.
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_TokenizeString( const char *text_in )
|
void Cmd_TokenizeString( char *text )
|
||||||
{
|
{
|
||||||
const char *text;
|
int i;
|
||||||
char *textOut;
|
char cmd_token[MAX_CMD_BUFFER];
|
||||||
|
|
||||||
|
// clear the args from the last string
|
||||||
|
for( i = 0; i < cmd_argc; i++ )
|
||||||
|
Z_Free( cmd_argv[i] );
|
||||||
|
|
||||||
cmd_argc = 0; // clear previous args
|
cmd_argc = 0; // clear previous args
|
||||||
if( !text_in ) return;
|
cmd_args = NULL;
|
||||||
|
|
||||||
text = text_in;
|
if( !text ) return;
|
||||||
textOut = cmd_tokenized;
|
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
// this is usually something malicious
|
// skip whitespace up to a /n
|
||||||
if( cmd_argc == MAX_CMD_TOKENS ) return;
|
while( *text && *text <= ' ' && *text != '\n' )
|
||||||
|
|
||||||
while( 1 )
|
|
||||||
{
|
|
||||||
// skip whitespace
|
|
||||||
while( *text && *text <= ' ' ) text++;
|
|
||||||
if( !*text ) return; // all tokens parsed
|
|
||||||
|
|
||||||
// skip // comments
|
|
||||||
if( text[0] == '/' && text[1] == '/' ) return; // all tokens parsed
|
|
||||||
|
|
||||||
// skip /* */ comments
|
|
||||||
if( text[0] == '/' && text[1] =='*' )
|
|
||||||
{
|
|
||||||
while( *text && ( text[0] != '*' || text[1] != '/' )) text++;
|
|
||||||
if( !*text ) return; // all tokens parsed
|
|
||||||
text += 2;
|
|
||||||
}
|
|
||||||
else break; // we are ready to parse a token
|
|
||||||
}
|
|
||||||
|
|
||||||
// handle quoted strings
|
|
||||||
if( *text == '"' )
|
|
||||||
{
|
|
||||||
cmd_argv[cmd_argc] = textOut;
|
|
||||||
cmd_argc++;
|
|
||||||
text++;
|
text++;
|
||||||
while( *text && *text != '"' )
|
|
||||||
*textOut++ = *text++;
|
if( *text == '\n' )
|
||||||
*textOut++ = 0;
|
{
|
||||||
if( !*text ) return; // all tokens parsed
|
// a newline seperates commands in the buffer
|
||||||
text++;
|
text++;
|
||||||
continue;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// regular token
|
if( !*text )
|
||||||
cmd_argv[cmd_argc] = textOut;
|
return;
|
||||||
cmd_argc++;
|
|
||||||
|
|
||||||
// skip until whitespace, quote, or command
|
|
||||||
while( *text > ' ' )
|
|
||||||
{
|
|
||||||
if( text[0] == '"' ) break;
|
|
||||||
if( text[0] == '/' && text[1] == '/' ) break;
|
|
||||||
// skip /* */ comments
|
|
||||||
if( text[0] == '/' && text[1] =='*' ) break;
|
|
||||||
|
|
||||||
*textOut++ = *text++;
|
|
||||||
}
|
|
||||||
*textOut++ = 0;
|
|
||||||
if( !*text ) return; // all tokens parsed
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if( cmd_argc == 1 )
|
||||||
|
cmd_args = text;
|
||||||
|
|
||||||
|
text = COM_ParseFile( text, cmd_token );
|
||||||
|
if( !text ) return;
|
||||||
|
|
||||||
|
if( cmd_argc < MAX_CMD_TOKENS )
|
||||||
|
{
|
||||||
|
cmd_argv[cmd_argc] = copystring( cmd_token );
|
||||||
|
cmd_argc++;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -434,11 +470,18 @@ Cmd_AddCommand
|
||||||
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc )
|
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc )
|
||||||
{
|
{
|
||||||
cmd_function_t *cmd;
|
cmd_function_t *cmd;
|
||||||
|
|
||||||
|
// fail if the command is a variable name
|
||||||
|
if( Cvar_FindVar( cmd_name ))
|
||||||
|
{
|
||||||
|
MsgDev( D_INFO, "Cmd_AddCommand: %s already defined as a var\n", cmd_name );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// fail if the command already exists
|
// fail if the command already exists
|
||||||
if( Cmd_Exists( cmd_name ))
|
if( Cmd_Exists( cmd_name ))
|
||||||
{
|
{
|
||||||
MsgDev(D_INFO, "Cmd_AddCommand: %s already defined\n", cmd_name);
|
MsgDev( D_INFO, "Cmd_AddCommand: %s already defined\n", cmd_name );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,6 +502,13 @@ Cmd_AddGameCommand
|
||||||
void Cmd_AddGameCommand( const char *cmd_name, xcommand_t function )
|
void Cmd_AddGameCommand( const char *cmd_name, xcommand_t function )
|
||||||
{
|
{
|
||||||
cmd_function_t *cmd;
|
cmd_function_t *cmd;
|
||||||
|
|
||||||
|
// fail if the command is a variable name
|
||||||
|
if( Cvar_FindVar( cmd_name ))
|
||||||
|
{
|
||||||
|
MsgDev( D_INFO, "Cmd_AddCommand: %s already defined as a var\n", cmd_name );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// fail if the command already exists
|
// fail if the command already exists
|
||||||
if( Cmd_Exists( cmd_name ))
|
if( Cmd_Exists( cmd_name ))
|
||||||
|
@ -477,26 +527,68 @@ void Cmd_AddGameCommand( const char *cmd_name, xcommand_t function )
|
||||||
cmd_functions = cmd;
|
cmd_functions = cmd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
============
|
||||||
|
Cmd_AddClientCommand
|
||||||
|
============
|
||||||
|
*/
|
||||||
|
void Cmd_AddClientCommand( const char *cmd_name, xcommand_t function )
|
||||||
|
{
|
||||||
|
cmd_function_t *cmd;
|
||||||
|
|
||||||
|
// fail if the command is a variable name
|
||||||
|
if( Cvar_FindVar( cmd_name ))
|
||||||
|
{
|
||||||
|
MsgDev( D_INFO, "Cmd_AddCommand: %s already defined as a var\n", cmd_name );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// fail if the command already exists
|
||||||
|
if( Cmd_Exists( cmd_name ))
|
||||||
|
{
|
||||||
|
MsgDev(D_INFO, "Cmd_AddCommand: %s already defined\n", cmd_name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// use a small malloc to avoid zone fragmentation
|
||||||
|
cmd = Z_Malloc( sizeof( cmd_function_t ));
|
||||||
|
cmd->name = copystring( cmd_name );
|
||||||
|
cmd->desc = copystring( "client command" );
|
||||||
|
cmd->function = function;
|
||||||
|
cmd->flags = CMD_CLIENTDLL;
|
||||||
|
cmd->next = cmd_functions;
|
||||||
|
cmd_functions = cmd;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cmd_RemoveCommand
|
Cmd_RemoveCommand
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_RemoveCommand (const char *cmd_name)
|
void Cmd_RemoveCommand( const char *cmd_name )
|
||||||
{
|
{
|
||||||
cmd_function_t *cmd, **back;
|
cmd_function_t *cmd, **back;
|
||||||
|
|
||||||
|
if( !cmd_name || !*cmd_name )
|
||||||
|
return;
|
||||||
|
|
||||||
back = &cmd_functions;
|
back = &cmd_functions;
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
cmd = *back;
|
cmd = *back;
|
||||||
if (!cmd ) return;
|
if( !cmd ) return;
|
||||||
if (!Q_strcmp( cmd_name, cmd->name ))
|
|
||||||
|
if( !Q_strcmp( cmd_name, cmd->name ))
|
||||||
{
|
{
|
||||||
*back = cmd->next;
|
*back = cmd->next;
|
||||||
if(cmd->name) Mem_Free(cmd->name);
|
|
||||||
if(cmd->desc) Mem_Free(cmd->desc);
|
if( cmd->name )
|
||||||
Mem_Free(cmd);
|
Mem_Free( cmd->name );
|
||||||
|
|
||||||
|
if( cmd->desc )
|
||||||
|
Mem_Free( cmd->desc );
|
||||||
|
|
||||||
|
Mem_Free( cmd );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
back = &cmd->next;
|
back = &cmd->next;
|
||||||
|
@ -546,41 +638,52 @@ Cmd_ExecuteString
|
||||||
A complete command line has been parsed, so try to execute it
|
A complete command line has been parsed, so try to execute it
|
||||||
============
|
============
|
||||||
*/
|
*/
|
||||||
void Cmd_ExecuteString( const char *text )
|
void Cmd_ExecuteString( char *text, cmd_source_t src )
|
||||||
{
|
{
|
||||||
cmd_function_t *cmd, **prev;
|
qboolean isServerCommand = false;
|
||||||
|
qboolean isDLLCommand = false;
|
||||||
|
cmd_function_t *cmd;
|
||||||
|
cmdalias_t *a;
|
||||||
|
|
||||||
|
// set cmd source
|
||||||
|
cmd_source = src;
|
||||||
|
|
||||||
// execute the command line
|
// execute the command line
|
||||||
Cmd_TokenizeString( text );
|
Cmd_TokenizeString( text );
|
||||||
|
|
||||||
if( !Cmd_Argc()) return; // no tokens
|
if( !Cmd_Argc()) return; // no tokens
|
||||||
|
|
||||||
// check registered command functions
|
// check alias
|
||||||
for( prev = &cmd_functions; *prev; prev = &cmd->next )
|
for( a = cmd_alias; a; a = a->next )
|
||||||
{
|
{
|
||||||
cmd = *prev;
|
if( !Q_stricmp( cmd_argv[0], a->name ))
|
||||||
if( !Q_stricmp( cmd_argv[0], cmd->name ))
|
|
||||||
{
|
{
|
||||||
// rearrange the links so that the command will be
|
Cbuf_InsertText( a->value );
|
||||||
// near the head of the list next time it is used
|
|
||||||
*prev = cmd->next;
|
|
||||||
cmd->next = cmd_functions;
|
|
||||||
cmd_functions = cmd;
|
|
||||||
|
|
||||||
// perform the action
|
|
||||||
if( !cmd->function )
|
|
||||||
Cmd_ExecuteString( va( "cmd %s", text ));
|
|
||||||
else cmd->function();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check functions
|
||||||
|
for( cmd = cmd_functions; cmd; cmd = cmd->next )
|
||||||
|
{
|
||||||
|
if( !Q_stricmp( cmd_argv[0], cmd->name ) && cmd->function )
|
||||||
|
{
|
||||||
|
cmd->function();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check cvars
|
// check cvars
|
||||||
if( Cvar_Command( )) return;
|
if( Cvar_Command( )) return;
|
||||||
|
|
||||||
if( host.type == HOST_NORMAL )
|
// forward the command line to the server, so the entity DLL can parse it
|
||||||
|
if( cmd_source == src_command && host.type == HOST_NORMAL )
|
||||||
{
|
{
|
||||||
// all unrecognized commands will be forwarded to a server
|
if( cls.state >= ca_connected )
|
||||||
Cmd_ForwardToServer();
|
{
|
||||||
|
Cmd_ForwardToServer();
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( text[0] != '@' )
|
else if( text[0] != '@' )
|
||||||
{
|
{
|
||||||
|
@ -589,6 +692,48 @@ void Cmd_ExecuteString( const char *text )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
===================
|
||||||
|
Cmd_ForwardToServer
|
||||||
|
|
||||||
|
adds the current command line as a clc_stringcmd to the client message.
|
||||||
|
things like godmode, noclip, etc, are commands directed to the server,
|
||||||
|
so when they are typed in at the console, they will need to be forwarded.
|
||||||
|
===================
|
||||||
|
*/
|
||||||
|
void Cmd_ForwardToServer( void )
|
||||||
|
{
|
||||||
|
char str[MAX_CMD_BUFFER];
|
||||||
|
|
||||||
|
if( cls.demoplayback )
|
||||||
|
{
|
||||||
|
if( !Q_stricmp( Cmd_Argv( 1 ), "pause" ))
|
||||||
|
cl.refdef.paused ^= 1;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( cls.state != ca_connected && cls.state != ca_active )
|
||||||
|
{
|
||||||
|
MsgDev( D_INFO, "Can't \"%s\", not connected\n", Cmd_Argv( 0 ));
|
||||||
|
return; // not connected
|
||||||
|
}
|
||||||
|
|
||||||
|
BF_WriteByte( &cls.netchan.message, clc_stringcmd );
|
||||||
|
|
||||||
|
str[0] = 0;
|
||||||
|
if( Q_stricmp( Cmd_Argv( 0 ), "cmd" ))
|
||||||
|
{
|
||||||
|
Q_strcat( str, Cmd_Argv( 0 ));
|
||||||
|
Q_strcat( str, " " );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( Cmd_Argc() > 1 )
|
||||||
|
Q_strcat( str, Cmd_Args( ));
|
||||||
|
else Q_strcat( str, "\n" );
|
||||||
|
|
||||||
|
BF_WriteString( &cls.netchan.message, str );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
============
|
============
|
||||||
Cmd_List_f
|
Cmd_List_f
|
||||||
|
@ -645,8 +790,13 @@ void Cmd_Unlink( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
*prev = cmd->next;
|
*prev = cmd->next;
|
||||||
if( cmd->name ) Mem_Free( cmd->name );
|
|
||||||
if( cmd->desc ) Mem_Free( cmd->desc );
|
if( cmd->name )
|
||||||
|
Mem_Free( cmd->name );
|
||||||
|
|
||||||
|
if( cmd->desc )
|
||||||
|
Mem_Free( cmd->desc );
|
||||||
|
|
||||||
Mem_Free( cmd );
|
Mem_Free( cmd );
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -667,4 +817,6 @@ void Cmd_Init( void )
|
||||||
Cmd_AddCommand ("wait", Cmd_Wait_f, "make script execution wait for some rendered frames" );
|
Cmd_AddCommand ("wait", Cmd_Wait_f, "make script execution wait for some rendered frames" );
|
||||||
Cmd_AddCommand ("cmdlist", Cmd_List_f, "display all console commands beginning with the specified prefix" );
|
Cmd_AddCommand ("cmdlist", Cmd_List_f, "display all console commands beginning with the specified prefix" );
|
||||||
Cmd_AddCommand ("stuffcmds", Cmd_StuffCmds_f, va( "execute commandline parameters (must be present in %s.rc script)", SI.ModuleName ));
|
Cmd_AddCommand ("stuffcmds", Cmd_StuffCmds_f, va( "execute commandline parameters (must be present in %s.rc script)", SI.ModuleName ));
|
||||||
|
Cmd_AddCommand ("cmd", Cmd_ForwardToServer, "send a console commandline to the server" );
|
||||||
|
Cmd_AddCommand ("alias", Cmd_Alias_f, "create a script function. Without arguments show the list of all alias" );
|
||||||
}
|
}
|
|
@ -1,104 +0,0 @@
|
||||||
//=======================================================================
|
|
||||||
// Copyright XashXT Group 2009 ©
|
|
||||||
// com_export.h - safe calls exports from other libraries
|
|
||||||
//=======================================================================
|
|
||||||
#ifndef COM_EXPORT_H
|
|
||||||
#define COM_EXPORT_H
|
|
||||||
|
|
||||||
// MD5 Hash
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint buf[4];
|
|
||||||
uint bits[2];
|
|
||||||
byte in[64];
|
|
||||||
} MD5Context_t;
|
|
||||||
|
|
||||||
#define TF_SKY (TF_SKYSIDE|TF_UNCOMPRESSED|TF_NOMIPMAP|TF_NOPICMIP)
|
|
||||||
#define TF_FONT (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP)
|
|
||||||
#define TF_IMAGE (TF_UNCOMPRESSED|TF_NOPICMIP|TF_NOMIPMAP|TF_CLAMP)
|
|
||||||
#define TF_DECAL (TF_CLAMP|TF_UNCOMPRESSED)
|
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
TF_STATIC = BIT(0), // don't free until Shader_FreeUnused()
|
|
||||||
TF_NOPICMIP = BIT(1), // ignore r_picmip resample rules
|
|
||||||
TF_UNCOMPRESSED = BIT(2), // don't compress texture in video memory
|
|
||||||
TF_CUBEMAP = BIT(3), // it's cubemap texture
|
|
||||||
TF_DEPTHMAP = BIT(4), // custom texture filter used
|
|
||||||
TF_INTENSITY = BIT(5),
|
|
||||||
TF_LUMINANCE = BIT(6), // force image to grayscale
|
|
||||||
TF_SKYSIDE = BIT(7),
|
|
||||||
TF_CLAMP = BIT(8),
|
|
||||||
TF_NOMIPMAP = BIT(9),
|
|
||||||
TF_NEAREST = BIT(10), // disable texfilter
|
|
||||||
TF_HAS_LUMA = BIT(11), // sets by GL_UploadTexture
|
|
||||||
TF_MAKELUMA = BIT(12), // create luma from quake texture
|
|
||||||
TF_NORMALMAP = BIT(13), // is a normalmap
|
|
||||||
TF_LIGHTMAP = BIT(14), // is a lightmap
|
|
||||||
} texFlags_t;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
vec3_t position;
|
|
||||||
char name[64];
|
|
||||||
short entityIndex;
|
|
||||||
byte depth;
|
|
||||||
byte flags;
|
|
||||||
|
|
||||||
// this is the surface plane that we hit so that
|
|
||||||
// we can move certain decals across
|
|
||||||
// transitions if they hit similar geometry
|
|
||||||
vec3_t impactPlaneNormal;
|
|
||||||
} decallist_t;
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
string name;
|
|
||||||
int entnum;
|
|
||||||
vec3_t origin;
|
|
||||||
float volume;
|
|
||||||
float attenuation;
|
|
||||||
qboolean looping;
|
|
||||||
int pitch;
|
|
||||||
} soundlist_t;
|
|
||||||
|
|
||||||
qboolean R_Init( void );
|
|
||||||
void R_Shutdown( void );
|
|
||||||
void VID_CheckChanges( void );
|
|
||||||
int GL_LoadTexture( const char *name, const byte *buf, size_t size, int flags );
|
|
||||||
void GL_FreeImage( const char *name );
|
|
||||||
qboolean VID_ScreenShot( const char *filename, int shot_type );
|
|
||||||
qboolean VID_CubemapShot( const char *base, uint size, const float *vieworg, qboolean skyshot );
|
|
||||||
void VID_RestoreGamma( void );
|
|
||||||
void R_BeginFrame( qboolean clearScene );
|
|
||||||
void R_RenderFrame( const ref_params_t *fd, qboolean drawWorld );
|
|
||||||
void R_EndFrame( void );
|
|
||||||
void R_ClearScene( void );
|
|
||||||
void R_GetTextureParms( int *w, int *h, int texnum );
|
|
||||||
void R_GetSpriteParms( int *frameWidth, int *frameHeight, int *numFrames, int curFrame, const struct model_s *pSprite );
|
|
||||||
void R_DrawStretchRaw( float x, float y, float w, float h, int cols, int rows, const byte *data, qboolean dirty );
|
|
||||||
void R_DrawStretchPic( float x, float y, float w, float h, float s1, float t1, float s2, float t2, int texnum );
|
|
||||||
qboolean R_SpeedsMessage( char *out, size_t size );
|
|
||||||
void R_SetupSky( const char *skyboxname );
|
|
||||||
qboolean R_CullBox( const vec3_t mins, const vec3_t maxs, uint clipflags );
|
|
||||||
qboolean R_WorldToScreen( const vec3_t point, vec3_t screen );
|
|
||||||
void R_ScreenToWorld( const vec3_t screen, vec3_t point );
|
|
||||||
qboolean R_AddEntity( struct cl_entity_s *pRefEntity, int entityType );
|
|
||||||
void Mod_LoadSpriteModel( struct model_s *mod, const void *buffer );
|
|
||||||
void Mod_LoadMapSprite( struct model_s *mod, const void *buffer, size_t size );
|
|
||||||
void Mod_UnloadSpriteModel( struct model_s *mod );
|
|
||||||
void Mod_UnloadStudioModel( struct model_s *mod );
|
|
||||||
void Mod_UnloadBrushModel( struct model_s *mod );
|
|
||||||
void GL_SetRenderMode( int mode );
|
|
||||||
void R_RunViewmodelEvents( void );
|
|
||||||
void R_DrawViewModel( void );
|
|
||||||
int R_GetSpriteTexture( const struct model_s *m_pSpriteModel, int frame );
|
|
||||||
void R_LightForPoint( const vec3_t point, color24 *ambientLight, qboolean invLight, float radius );
|
|
||||||
void R_DecalShoot( int textureIndex, int entityIndex, int modelIndex, vec3_t pos, int flags, vec3_t saxis );
|
|
||||||
void R_RemoveEfrags( struct cl_entity_s *ent );
|
|
||||||
void R_AddEfrags( struct cl_entity_s *ent );
|
|
||||||
void R_DecalRemoveAll( int texture );
|
|
||||||
byte *Mod_GetCurrentVis( void );
|
|
||||||
void R_NewMap( void );
|
|
||||||
|
|
||||||
#endif//COM_EXPORT_H
|
|
|
@ -1,6 +1,6 @@
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Copyright XashXT Group 2008 ©
|
// Copyright XashXT Group 2008 ©
|
||||||
// engfuncs.c - misc functions used by dlls'
|
// common.c - misc functions used by dlls'
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
@ -42,7 +42,7 @@ byte *COM_LoadFile( const char *filename, int usehunk, int *pLength )
|
||||||
==============
|
==============
|
||||||
COM_ParseFile
|
COM_ParseFile
|
||||||
|
|
||||||
simple dlls version
|
text parser
|
||||||
==============
|
==============
|
||||||
*/
|
*/
|
||||||
char *COM_ParseFile( char *data, char *token )
|
char *COM_ParseFile( char *data, char *token )
|
||||||
|
@ -201,11 +201,11 @@ void COM_FixSlashes( char *pname )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnMemFgets
|
COM_MemFgets
|
||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
char *pfnMemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, int bufferSize )
|
char *COM_MemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, int bufferSize )
|
||||||
{
|
{
|
||||||
int i, last, stop;
|
int i, last, stop;
|
||||||
|
|
||||||
|
@ -272,41 +272,30 @@ void *Cache_Check( byte *mempool, cache_user_t *c )
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnLoadFile
|
COM_LoadFileForMe
|
||||||
|
|
||||||
=============
|
=============
|
||||||
*/
|
*/
|
||||||
byte* pfnLoadFile( const char *filename, int *pLength )
|
byte* COM_LoadFileForMe( const char *filename, int *pLength )
|
||||||
{
|
{
|
||||||
|
string name;
|
||||||
|
int i;
|
||||||
|
|
||||||
if( !filename || !*filename )
|
if( !filename || !*filename )
|
||||||
{
|
{
|
||||||
if( pLength ) *pLength = 0;
|
if( pLength ) *pLength = 0;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FS_LoadFile( filename, pLength, false );
|
// replace all backward slashes
|
||||||
}
|
for( i = 0; i < Q_strlen( filename ); i++ )
|
||||||
|
{
|
||||||
|
if( filename[i] == '\\' ) name[i] = '/';
|
||||||
|
else name[i] = Q_tolower( filename[i] );
|
||||||
|
}
|
||||||
|
name[i] = '\0';
|
||||||
|
|
||||||
/*
|
return FS_LoadFile( name, pLength, false );
|
||||||
=============
|
|
||||||
pfnFileExists
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
int pfnFileExists( const char *filename, int gamedironly )
|
|
||||||
{
|
|
||||||
return FS_FileExists( filename, gamedironly );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnTime
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
float pfnTime( void )
|
|
||||||
{
|
|
||||||
return Sys_DoubleTime();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -353,50 +342,6 @@ cvar_t *pfnCvar_RegisterVariable( const char *szName, const char *szValue, int f
|
||||||
return (cvar_t *)Cvar_Get( szName, szValue, flags|CVAR_CLIENTDLL, "" );
|
return (cvar_t *)Cvar_Get( szName, szValue, flags|CVAR_CLIENTDLL, "" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarSetString
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnCVarSetString( const char *szName, const char *szValue )
|
|
||||||
{
|
|
||||||
Cvar_Set( szName, szValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarSetValue
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnCVarSetValue( const char *szName, float flValue )
|
|
||||||
{
|
|
||||||
Cvar_SetFloat( szName, flValue );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarGetString
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
char* pfnCVarGetString( const char *szName )
|
|
||||||
{
|
|
||||||
return Cvar_VariableString( szName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarGetValue
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
float pfnCVarGetValue( const char *szName )
|
|
||||||
{
|
|
||||||
return Cvar_VariableValue( szName );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnCVarGetPointer
|
pfnCVarGetPointer
|
||||||
|
@ -408,23 +353,6 @@ cvar_t *pfnCVarGetPointer( const char *szVarName )
|
||||||
{
|
{
|
||||||
return (cvar_t *)Cvar_FindVar( szVarName );
|
return (cvar_t *)Cvar_FindVar( szVarName );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnAddCommand
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
int pfnAddCommand( const char *cmd_name, xcommand_t func )
|
|
||||||
{
|
|
||||||
if( !cmd_name || !*cmd_name )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// NOTE: if( func == NULL ) cmd will be forwarded to a server
|
|
||||||
Cmd_AddCommand( cmd_name, func, "game command" );
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
|
@ -438,59 +366,11 @@ int pfnAddClientCommand( const char *cmd_name, xcommand_t func )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// NOTE: if( func == NULL ) cmd will be forwarded to a server
|
// NOTE: if( func == NULL ) cmd will be forwarded to a server
|
||||||
Cmd_AddGameCommand( cmd_name, func );
|
Cmd_AddClientCommand( cmd_name, func );
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnDelCommand
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnDelCommand( const char *cmd_name )
|
|
||||||
{
|
|
||||||
if( !cmd_name || !*cmd_name ) return;
|
|
||||||
|
|
||||||
Cmd_RemoveCommand( cmd_name );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCmd_Args
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
char *pfnCmd_Args( void )
|
|
||||||
{
|
|
||||||
return Cmd_Args();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCmd_Argv
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
char *pfnCmd_Argv( int argc )
|
|
||||||
{
|
|
||||||
if( argc >= 0 && argc < Cmd_Argc())
|
|
||||||
return Cmd_Argv( argc );
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCmd_Argc
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
int pfnCmd_Argc( void )
|
|
||||||
{
|
|
||||||
return Cmd_Argc();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
Con_Printf
|
Con_Printf
|
||||||
|
@ -533,39 +413,6 @@ void Con_DPrintf( char *szFmt, ... )
|
||||||
Sys_Print( buffer );
|
Sys_Print( buffer );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnLoadLibrary
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void *pfnLoadLibrary( const char *name )
|
|
||||||
{
|
|
||||||
return Com_LoadLibrary( name, false );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnGetProcAddress
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void *pfnGetProcAddress( void *hInstance, const char *name )
|
|
||||||
{
|
|
||||||
return Com_GetProcAddress( hInstance, name );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnFreeLibrary
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnFreeLibrary( void *hInstance )
|
|
||||||
{
|
|
||||||
Com_FreeLibrary( hInstance );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnGetGameDir
|
pfnGetGameDir
|
|
@ -62,7 +62,6 @@ typedef enum
|
||||||
|
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "ref_params.h"
|
#include "ref_params.h"
|
||||||
#include "com_export.h"
|
|
||||||
#include "com_model.h"
|
#include "com_model.h"
|
||||||
#include "crtlib.h"
|
#include "crtlib.h"
|
||||||
|
|
||||||
|
@ -113,7 +112,6 @@ extern convar_t *scr_width;
|
||||||
extern convar_t *scr_height;
|
extern convar_t *scr_height;
|
||||||
extern convar_t *scr_loading;
|
extern convar_t *scr_loading;
|
||||||
extern convar_t *scr_download;
|
extern convar_t *scr_download;
|
||||||
extern convar_t *allow_download;
|
|
||||||
extern convar_t *cl_allow_levelshots;
|
extern convar_t *cl_allow_levelshots;
|
||||||
extern convar_t *host_limitlocal;
|
extern convar_t *host_limitlocal;
|
||||||
extern convar_t *host_maxfps;
|
extern convar_t *host_maxfps;
|
||||||
|
@ -191,6 +189,14 @@ typedef enum
|
||||||
HOST_CRASHED // an exception handler called
|
HOST_CRASHED // an exception handler called
|
||||||
} host_state;
|
} host_state;
|
||||||
|
|
||||||
|
// MD5 Hash
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint buf[4];
|
||||||
|
uint bits[2];
|
||||||
|
byte in[64];
|
||||||
|
} MD5Context_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
RD_NONE = 0,
|
RD_NONE = 0,
|
||||||
|
@ -224,6 +230,31 @@ typedef struct host_redirect_s
|
||||||
void (*flush)( netadr_t adr, rdtype_t target, char *buffer );
|
void (*flush)( netadr_t adr, rdtype_t target, char *buffer );
|
||||||
} host_redirect_t;
|
} host_redirect_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
vec3_t position;
|
||||||
|
char name[64];
|
||||||
|
short entityIndex;
|
||||||
|
byte depth;
|
||||||
|
byte flags;
|
||||||
|
|
||||||
|
// this is the surface plane that we hit so that
|
||||||
|
// we can move certain decals across
|
||||||
|
// transitions if they hit similar geometry
|
||||||
|
vec3_t impactPlaneNormal;
|
||||||
|
} decallist_t;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
string name;
|
||||||
|
int entnum;
|
||||||
|
vec3_t origin;
|
||||||
|
float volume;
|
||||||
|
float attenuation;
|
||||||
|
qboolean looping;
|
||||||
|
int pitch;
|
||||||
|
} soundlist_t;
|
||||||
|
|
||||||
typedef struct host_parm_s
|
typedef struct host_parm_s
|
||||||
{
|
{
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
|
@ -499,7 +530,7 @@ qboolean Sound_Process( wavdata_t **wav, int rate, int width, uint flags );
|
||||||
//
|
//
|
||||||
// build.c
|
// build.c
|
||||||
//
|
//
|
||||||
int com_buildnum( void );
|
int Q_buildnum( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
// host.c
|
// host.c
|
||||||
|
@ -549,34 +580,19 @@ qboolean SV_Active( void );
|
||||||
==============================================================
|
==============================================================
|
||||||
*/
|
*/
|
||||||
cvar_t *pfnCvar_RegisterVariable( const char *szName, const char *szValue, int flags );
|
cvar_t *pfnCvar_RegisterVariable( const char *szName, const char *szValue, int flags );
|
||||||
char *pfnMemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, int bufferSize );
|
char *COM_MemFgets( byte *pMemFile, int fileSize, int *filePos, char *pBuffer, int bufferSize );
|
||||||
byte* pfnLoadFile( const char *filename, int *pLength );
|
byte* COM_LoadFileForMe( const char *filename, int *pLength );
|
||||||
void pfnCVarSetString( const char *szName, const char *szValue );
|
|
||||||
void pfnCVarSetValue( const char *szName, float flValue );
|
|
||||||
float pfnCVarGetValue( const char *szName );
|
|
||||||
char* pfnCVarGetString( const char *szName );
|
|
||||||
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
cvar_t *pfnCVarGetPointer( const char *szVarName );
|
||||||
void pfnFreeFile( void *buffer );
|
|
||||||
int pfnFileExists( const char *filename, int gamedironly );
|
|
||||||
void *pfnLoadLibrary( const char *name );
|
|
||||||
void *pfnGetProcAddress( void *hInstance, const char *name );
|
|
||||||
void pfnFreeLibrary( void *hInstance );
|
|
||||||
int pfnAddCommand( const char *cmd_name, xcommand_t func );
|
|
||||||
int pfnAddClientCommand( const char *cmd_name, xcommand_t func );
|
int pfnAddClientCommand( const char *cmd_name, xcommand_t func );
|
||||||
void pfnDelCommand( const char *cmd_name );
|
|
||||||
void *Cache_Check( byte *mempool, struct cache_user_s *c );
|
void *Cache_Check( byte *mempool, struct cache_user_s *c );
|
||||||
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
|
edict_t* pfnPEntityOfEntIndex( int iEntIndex );
|
||||||
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
void pfnGetModelBounds( model_t *mod, float *mins, float *maxs );
|
||||||
void pfnGetGameDir( char *szGetGameDir );
|
void pfnGetGameDir( char *szGetGameDir );
|
||||||
int pfnGetModelType( model_t *mod );
|
int pfnGetModelType( model_t *mod );
|
||||||
int pfnIsMapValid( char *filename );
|
int pfnIsMapValid( char *filename );
|
||||||
char *pfnCmd_Args( void );
|
|
||||||
char *pfnCmd_Argv( int argc );
|
|
||||||
void Con_DPrintf( char *fmt, ... );
|
void Con_DPrintf( char *fmt, ... );
|
||||||
void Con_Printf( char *szFmt, ... );
|
void Con_Printf( char *szFmt, ... );
|
||||||
int pfnCmd_Argc( void );
|
|
||||||
int pfnIsInGame( void );
|
int pfnIsInGame( void );
|
||||||
float pfnTime( void );
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============================================================
|
==============================================================
|
||||||
|
@ -707,11 +723,12 @@ char *Cvar_Userinfo( void );
|
||||||
char *Cvar_Serverinfo( void );
|
char *Cvar_Serverinfo( void );
|
||||||
void Cmd_WriteVariables( file_t *f );
|
void Cmd_WriteVariables( file_t *f );
|
||||||
qboolean Cmd_CheckMapsList( qboolean fRefresh );
|
qboolean Cmd_CheckMapsList( qboolean fRefresh );
|
||||||
void Cmd_ForwardToServer( void );
|
|
||||||
void Cmd_AutoComplete( char *complete_string );
|
void Cmd_AutoComplete( char *complete_string );
|
||||||
long Com_RandomLong( long lMin, long lMax );
|
long Com_RandomLong( long lMin, long lMax );
|
||||||
float Com_RandomFloat( float fMin, float fMax );
|
float Com_RandomFloat( float fMin, float fMax );
|
||||||
void TrimSpace( const char *source, char *dest );
|
void TrimSpace( const char *source, char *dest );
|
||||||
|
void GL_FreeImage( const char *name );
|
||||||
|
void VID_RestoreGamma( void );
|
||||||
|
|
||||||
typedef struct autocomplete_list_s
|
typedef struct autocomplete_list_s
|
||||||
{
|
{
|
||||||
|
|
|
@ -1400,7 +1400,7 @@ void Con_DrawSolidConsole( float frac )
|
||||||
byte *color = g_color_table[7];
|
byte *color = g_color_table[7];
|
||||||
int stringLen, width = 0, charH;
|
int stringLen, width = 0, charH;
|
||||||
|
|
||||||
Q_snprintf( curbuild, MAX_STRING, "Xash3D %i/%g (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, com_buildnum( ));
|
Q_snprintf( curbuild, MAX_STRING, "Xash3D %i/%g (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
|
||||||
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
||||||
start = scr_width->integer - stringLen;
|
start = scr_width->integer - stringLen;
|
||||||
stringLen = Con_StringLength( curbuild );
|
stringLen = Con_StringLength( curbuild );
|
||||||
|
@ -1546,7 +1546,7 @@ void Con_DrawVersion( void )
|
||||||
|
|
||||||
if( cls.key_dest != key_menu ) return;
|
if( cls.key_dest != key_menu ) return;
|
||||||
|
|
||||||
Q_snprintf( curbuild, MAX_STRING, "v%i/%g (build %i)", PROTOCOL_VERSION, XASH_VERSION, com_buildnum( ));
|
Q_snprintf( curbuild, MAX_STRING, "v%i/%g (build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum( ));
|
||||||
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
Con_DrawStringLen( curbuild, &stringLen, &charH );
|
||||||
start = scr_width->integer - stringLen * 1.05f;
|
start = scr_width->integer - stringLen * 1.05f;
|
||||||
stringLen = Con_StringLength( curbuild );
|
stringLen = Con_StringLength( curbuild );
|
||||||
|
|
|
@ -1,18 +1,10 @@
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Copyright XashXT Group 2011 ©
|
// Copyright XashXT Group 2011 ©
|
||||||
// stdlib.h - internal stdlib
|
// crtlib.h - internal stdlib
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
#ifndef STDLIB_H
|
#ifndef STDLIB_H
|
||||||
#define STDLIB_H
|
#define STDLIB_H
|
||||||
|
|
||||||
// command buffer modes
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
EXEC_NOW = 0,
|
|
||||||
EXEC_INSERT,
|
|
||||||
EXEC_APPEND,
|
|
||||||
};
|
|
||||||
|
|
||||||
// timestamp modes
|
// timestamp modes
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
|
@ -27,6 +19,15 @@ enum
|
||||||
typedef void (*setpair_t)( const char *key, const char *value, void *buffer, void *numpairs );
|
typedef void (*setpair_t)( const char *key, const char *value, void *buffer, void *numpairs );
|
||||||
typedef void (*xcommand_t)( void );
|
typedef void (*xcommand_t)( void );
|
||||||
|
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
src_client, // came in over a net connection as a clc_stringcmd
|
||||||
|
// host_client will be valid during this state.
|
||||||
|
src_command // from the command buffer
|
||||||
|
} cmd_source_t;
|
||||||
|
|
||||||
|
extern cmd_source_t cmd_source;
|
||||||
|
|
||||||
// NOTE: if this is changed, it must be changed in cvardef.h too
|
// NOTE: if this is changed, it must be changed in cvardef.h too
|
||||||
typedef struct convar_s
|
typedef struct convar_s
|
||||||
{
|
{
|
||||||
|
@ -101,23 +102,23 @@ void Cvar_Unlink( void );
|
||||||
void Cbuf_Init( void );
|
void Cbuf_Init( void );
|
||||||
void Cbuf_AddText( const char *text );
|
void Cbuf_AddText( const char *text );
|
||||||
void Cbuf_InsertText( const char *text );
|
void Cbuf_InsertText( const char *text );
|
||||||
void Cbuf_ExecuteText( int exec_when, const char *text );
|
|
||||||
void Cbuf_Execute (void);
|
void Cbuf_Execute (void);
|
||||||
uint Cmd_Argc( void );
|
uint Cmd_Argc( void );
|
||||||
char *Cmd_Args( void );
|
char *Cmd_Args( void );
|
||||||
char *Cmd_Argv( uint arg );
|
char *Cmd_Argv( int arg );
|
||||||
void Cmd_Init( void );
|
void Cmd_Init( void );
|
||||||
void Cmd_Unlink( void );
|
void Cmd_Unlink( void );
|
||||||
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
|
void Cmd_AddCommand( const char *cmd_name, xcommand_t function, const char *cmd_desc );
|
||||||
void Cmd_AddGameCommand( const char *cmd_name, xcommand_t function );
|
void Cmd_AddGameCommand( const char *cmd_name, xcommand_t function );
|
||||||
|
void Cmd_AddClientCommand( const char *cmd_name, xcommand_t function );
|
||||||
void Cmd_RemoveCommand( const char *cmd_name );
|
void Cmd_RemoveCommand( const char *cmd_name );
|
||||||
qboolean Cmd_Exists( const char *cmd_name );
|
qboolean Cmd_Exists( const char *cmd_name );
|
||||||
void Cmd_LookupCmds( char *buffer, void *ptr, setpair_t callback );
|
void Cmd_LookupCmds( char *buffer, void *ptr, setpair_t callback );
|
||||||
qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
|
qboolean Cmd_GetMapList( const char *s, char *completedname, int length );
|
||||||
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
|
qboolean Cmd_GetDemoList( const char *s, char *completedname, int length );
|
||||||
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
|
qboolean Cmd_GetMovieList( const char *s, char *completedname, int length );
|
||||||
void Cmd_TokenizeString( const char *text );
|
void Cmd_TokenizeString( char *text );
|
||||||
void Cmd_ExecuteString( const char *text );
|
void Cmd_ExecuteString( char *text, cmd_source_t src );
|
||||||
void Cmd_ForwardToServer( void );
|
void Cmd_ForwardToServer( void );
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Copyright (C) XashXT Group 2006
|
// Copyright XashXT Group 2007 ©
|
||||||
// All Rights Reserved
|
// filesystem.h - engine FS
|
||||||
// zip32.h - zlib custom build
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
#ifndef FILESYSTEM_H
|
#ifndef FILESYSTEM_H
|
||||||
#define FILESYSTEM_H
|
#define FILESYSTEM_H
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "netchan.h"
|
#include "netchan.h"
|
||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
|
||||||
|
@ -734,10 +734,12 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
|
||||||
Con_ShowConsole( false ); // hide console
|
Con_ShowConsole( false ); // hide console
|
||||||
// execute startup config and cmdline
|
// execute startup config and cmdline
|
||||||
Cbuf_AddText( va( "exec %s.rc\n", SI.ModuleName ));
|
Cbuf_AddText( va( "exec %s.rc\n", SI.ModuleName ));
|
||||||
|
// intentional fallthrough
|
||||||
case HOST_DEDICATED:
|
case HOST_DEDICATED:
|
||||||
Cbuf_Execute();
|
|
||||||
// if stuffcmds wasn't run, then init.rc is probably missing, use default
|
// if stuffcmds wasn't run, then init.rc is probably missing, use default
|
||||||
if( !host.stuffcmdsrun ) Cbuf_ExecuteText( EXEC_NOW, "stuffcmds\n" );
|
if( !host.stuffcmdsrun ) Cbuf_AddText( "stuffcmds\n" );
|
||||||
|
|
||||||
|
Cbuf_Execute();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -746,7 +748,7 @@ int EXPORT Host_Main( const char *progname, int bChangeGame, pfnChangeGame func
|
||||||
Cmd_RemoveCommand( "setgl" );
|
Cmd_RemoveCommand( "setgl" );
|
||||||
|
|
||||||
// we need to execute it again here
|
// we need to execute it again here
|
||||||
Cmd_ExecuteString( "exec config.cfg\n" );
|
Cmd_ExecuteString( "exec config.cfg\n", src_command );
|
||||||
oldtime = Sys_DoubleTime();
|
oldtime = Sys_DoubleTime();
|
||||||
|
|
||||||
// main window message loop
|
// main window message loop
|
||||||
|
|
|
@ -95,21 +95,21 @@ typedef struct imglib_s
|
||||||
#pragma pack( 1 )
|
#pragma pack( 1 )
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
char id[2]; //bmfh.bfType
|
char id[2]; // bmfh.bfType
|
||||||
dword fileSize; //bmfh.bfSize
|
dword fileSize; // bmfh.bfSize
|
||||||
dword reserved0; //bmfh.bfReserved1 + bmfh.bfReserved2
|
dword reserved0; // bmfh.bfReserved1 + bmfh.bfReserved2
|
||||||
dword bitmapDataOffset; //bmfh.bfOffBits
|
dword bitmapDataOffset; // bmfh.bfOffBits
|
||||||
dword bitmapHeaderSize; //bmih.biSize
|
dword bitmapHeaderSize; // bmih.biSize
|
||||||
int width; //bmih.biWidth
|
int width; // bmih.biWidth
|
||||||
int height; //bmih.biHeight
|
int height; // bmih.biHeight
|
||||||
word planes; //bmih.biPlanes
|
word planes; // bmih.biPlanes
|
||||||
word bitsPerPixel; //bmih.biBitCount
|
word bitsPerPixel; // bmih.biBitCount
|
||||||
dword compression; //bmih.biCompression
|
dword compression; // bmih.biCompression
|
||||||
dword bitmapDataSize; //bmih.biSizeImage
|
dword bitmapDataSize; // bmih.biSizeImage
|
||||||
dword hRes; //bmih.biXPelsPerMeter
|
dword hRes; // bmih.biXPelsPerMeter
|
||||||
dword vRes; //bmih.biYPelsPerMeter
|
dword vRes; // bmih.biYPelsPerMeter
|
||||||
dword colors; //bmih.biClrUsed
|
dword colors; // bmih.biClrUsed
|
||||||
dword importantColors; //bmih.biClrImportant
|
dword importantColors; // bmih.biClrImportant
|
||||||
} bmp_t;
|
} bmp_t;
|
||||||
#pragma pack( )
|
#pragma pack( )
|
||||||
|
|
||||||
|
@ -220,7 +220,6 @@ enum
|
||||||
};
|
};
|
||||||
|
|
||||||
extern imglib_t image;
|
extern imglib_t image;
|
||||||
extern byte *fs_mempool;
|
|
||||||
|
|
||||||
void Image_RoundDimensions( int *scaled_width, int *scaled_height );
|
void Image_RoundDimensions( int *scaled_width, int *scaled_height );
|
||||||
byte *Image_ResampleInternal( const void *indata, int in_w, int in_h, int out_w, int out_h, int intype, qboolean *done );
|
byte *Image_ResampleInternal( const void *indata, int in_w, int in_h, int out_w, int out_h, int intype, qboolean *done );
|
||||||
|
|
|
@ -19,7 +19,7 @@ int jpeg_read_byte( void )
|
||||||
int jpeg_read_word( void )
|
int jpeg_read_word( void )
|
||||||
{
|
{
|
||||||
// read word
|
// read word
|
||||||
word i = (jpg_file.buffer[1]<<8)|jpg_file.buffer[0];
|
word i = (jpg_file.buffer[1]<<8)|jpg_file.buffer[0];
|
||||||
i = ((i << 8) & 0xFF00) + ((i >> 8) & 0x00FF);
|
i = ((i << 8) & 0xFF00) + ((i >> 8) & 0x00FF);
|
||||||
jpg_file.buffer += 2;
|
jpg_file.buffer += 2;
|
||||||
|
|
||||||
|
@ -308,7 +308,6 @@ int jpeg_readmarkers( void )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void jpeg_decompress( void )
|
void jpeg_decompress( void )
|
||||||
{
|
{
|
||||||
// decompress jpeg file (baseline algorithm)
|
// decompress jpeg file (baseline algorithm)
|
||||||
|
|
|
@ -242,7 +242,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
|
||||||
{
|
{
|
||||||
if( format->loadfunc( path, f, filesize ))
|
if( format->loadfunc( path, f, filesize ))
|
||||||
{
|
{
|
||||||
Mem_Free(f); // release buffer
|
Mem_Free( f ); // release buffer
|
||||||
return ImagePack(); // loaded
|
return ImagePack(); // loaded
|
||||||
}
|
}
|
||||||
else Mem_Free(f); // release buffer
|
else Mem_Free(f); // release buffer
|
||||||
|
@ -287,7 +287,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
|
||||||
// first side not found, probably it's not cubemap
|
// first side not found, probably it's not cubemap
|
||||||
// it contain info about image_type and dimensions, don't generate black cubemaps
|
// it contain info about image_type and dimensions, don't generate black cubemaps
|
||||||
if( !image.cubemap ) break;
|
if( !image.cubemap ) break;
|
||||||
MsgDev( D_ERROR, "FS_LoadImage: couldn't load (%s%s.%s), create black image\n", loadname, cmap->type[i].suf );
|
MsgDev( D_ERROR, "FS_LoadImage: couldn't load (%s%s), create black image\n", loadname, cmap->type[i].suf );
|
||||||
|
|
||||||
// Mem_Alloc already filled memblock with 0x00, no need to do it again
|
// Mem_Alloc already filled memblock with 0x00, no need to do it again
|
||||||
image.cubemap = Mem_Realloc( host.imagepool, image.cubemap, image.ptr + image.size );
|
image.cubemap = Mem_Realloc( host.imagepool, image.cubemap, image.ptr + image.size );
|
||||||
|
@ -306,6 +306,7 @@ rgbdata_t *FS_LoadImage( const char *filename, const byte *buffer, size_t size )
|
||||||
}
|
}
|
||||||
else break;
|
else break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( image.cubemap )
|
if( image.cubemap )
|
||||||
return ImagePack(); // all done
|
return ImagePack(); // all done
|
||||||
|
|
||||||
|
|
|
@ -289,7 +289,7 @@ void Image_GetPaletteQ1( void )
|
||||||
{
|
{
|
||||||
image.d_rendermode = LUMP_NORMAL;
|
image.d_rendermode = LUMP_NORMAL;
|
||||||
|
|
||||||
if(!q1palette_init)
|
if( !q1palette_init )
|
||||||
{
|
{
|
||||||
Image_SetPalette( palette_q1, d_8toQ1table );
|
Image_SetPalette( palette_q1, d_8toQ1table );
|
||||||
d_8toQ1table[255] = 0; // 255 is transparent
|
d_8toQ1table[255] = 0; // 255 is transparent
|
||||||
|
@ -391,6 +391,7 @@ void Image_CopyParms( rgbdata_t *src )
|
||||||
image.flags = src->flags;
|
image.flags = src->flags;
|
||||||
image.size = src->size;
|
image.size = src->size;
|
||||||
image.palette = src->palette; // may be NULL
|
image.palette = src->palette; // may be NULL
|
||||||
|
|
||||||
Q_memcpy( image.fogParams, src->fogParams, sizeof( image.fogParams ));
|
Q_memcpy( image.fogParams, src->fogParams, sizeof( image.fogParams ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,6 +414,7 @@ qboolean Image_Copy8bitRGBA( const byte *in, byte *out, int pixels )
|
||||||
MsgDev( D_ERROR, "Image_Copy8bitRGBA: no palette set\n" );
|
MsgDev( D_ERROR, "Image_Copy8bitRGBA: no palette set\n" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !in )
|
if( !in )
|
||||||
{
|
{
|
||||||
MsgDev( D_ERROR, "Image_Copy8bitRGBA: no input image\n" );
|
MsgDev( D_ERROR, "Image_Copy8bitRGBA: no input image\n" );
|
||||||
|
@ -445,6 +447,7 @@ qboolean Image_Copy8bitRGBA( const byte *in, byte *out, int pixels )
|
||||||
iout += 8;
|
iout += 8;
|
||||||
pixels -= 8;
|
pixels -= 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pixels & 4 )
|
if( pixels & 4 )
|
||||||
{
|
{
|
||||||
iout[0] = image.d_currentpal[in[0]];
|
iout[0] = image.d_currentpal[in[0]];
|
||||||
|
@ -454,6 +457,7 @@ qboolean Image_Copy8bitRGBA( const byte *in, byte *out, int pixels )
|
||||||
in += 4;
|
in += 4;
|
||||||
iout += 4;
|
iout += 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pixels & 2 )
|
if( pixels & 2 )
|
||||||
{
|
{
|
||||||
iout[0] = image.d_currentpal[in[0]];
|
iout[0] = image.d_currentpal[in[0]];
|
||||||
|
@ -461,6 +465,7 @@ qboolean Image_Copy8bitRGBA( const byte *in, byte *out, int pixels )
|
||||||
in += 2;
|
in += 2;
|
||||||
iout += 2;
|
iout += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( pixels & 1 ) // last byte
|
if( pixels & 1 ) // last byte
|
||||||
iout[0] = image.d_currentpal[in[0]];
|
iout[0] = image.d_currentpal[in[0]];
|
||||||
|
|
||||||
|
@ -468,11 +473,11 @@ qboolean Image_Copy8bitRGBA( const byte *in, byte *out, int pixels )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Image_Resample32LerpLine (const byte *in, byte *out, int inwidth, int outwidth)
|
static void Image_Resample32LerpLine( const byte *in, byte *out, int inwidth, int outwidth )
|
||||||
{
|
{
|
||||||
int j, xi, oldx = 0, f, fstep, endx, lerp;
|
int j, xi, oldx = 0, f, fstep, endx, lerp;
|
||||||
|
|
||||||
fstep = (int)(inwidth * 65536.0f/outwidth);
|
fstep = (int)(inwidth * 65536.0f / outwidth);
|
||||||
endx = (inwidth-1);
|
endx = (inwidth-1);
|
||||||
|
|
||||||
for( j = 0, f = 0; j < outwidth; j++, f += fstep )
|
for( j = 0, f = 0; j < outwidth; j++, f += fstep )
|
||||||
|
@ -505,7 +510,7 @@ static void Image_Resample24LerpLine( const byte *in, byte *out, int inwidth, in
|
||||||
{
|
{
|
||||||
int j, xi, oldx = 0, f, fstep, endx, lerp;
|
int j, xi, oldx = 0, f, fstep, endx, lerp;
|
||||||
|
|
||||||
fstep = (int)(inwidth * 65536.0f/outwidth);
|
fstep = (int)(inwidth * 65536.0f / outwidth);
|
||||||
endx = (inwidth-1);
|
endx = (inwidth-1);
|
||||||
|
|
||||||
for( j = 0, f = 0; j < outwidth; j++, f += fstep )
|
for( j = 0, f = 0; j < outwidth; j++, f += fstep )
|
||||||
|
@ -532,7 +537,7 @@ static void Image_Resample24LerpLine( const byte *in, byte *out, int inwidth, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Image_Resample32Lerp(const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight)
|
void Image_Resample32Lerp( const void *indata, int inwidth, int inheight, void *outdata, int outwidth, int outheight )
|
||||||
{
|
{
|
||||||
int i, j, r, yi, oldy = 0, f, fstep, lerp, endy = (inheight - 1);
|
int i, j, r, yi, oldy = 0, f, fstep, lerp, endy = (inheight - 1);
|
||||||
int inwidth4 = inwidth * 4;
|
int inwidth4 = inwidth * 4;
|
||||||
|
@ -776,11 +781,11 @@ void Image_Resample24Nolerp( const void *indata, int inwidth, int inheight, void
|
||||||
uint frac, fracstep;
|
uint frac, fracstep;
|
||||||
byte *inrow, *out = (byte *)outdata;
|
byte *inrow, *out = (byte *)outdata;
|
||||||
|
|
||||||
fracstep = inwidth * 0x10000/outwidth;
|
fracstep = inwidth * 0x10000 / outwidth;
|
||||||
|
|
||||||
for( i = 0; i < outheight; i++)
|
for( i = 0; i < outheight; i++)
|
||||||
{
|
{
|
||||||
inrow = (byte *)indata + inwidth3 * (i * inheight/outheight);
|
inrow = (byte *)indata + inwidth3 * (i * inheight / outheight);
|
||||||
frac = fracstep>>1;
|
frac = fracstep>>1;
|
||||||
j = outwidth - 4;
|
j = outwidth - 4;
|
||||||
|
|
||||||
|
@ -938,13 +943,21 @@ byte *Image_FloodInternal( const byte *indata, int inwidth, int inheight, int ou
|
||||||
}
|
}
|
||||||
|
|
||||||
if( samples == 1 ) Q_memset( out, 0xFF, newsize ); // last palette color
|
if( samples == 1 ) Q_memset( out, 0xFF, newsize ); // last palette color
|
||||||
else Q_memset( out, 0x00808080, newsize ); // gray (alpha leaved 0x00)
|
else Q_memset( out, 0x00808080, newsize ); // gray (alpha leaved 0x00)
|
||||||
|
|
||||||
for( y = 0; y < outheight; y++ )
|
for( y = 0; y < outheight; y++ )
|
||||||
|
{
|
||||||
for( x = 0; y < inheight && x < outwidth; x++ )
|
for( x = 0; y < inheight && x < outwidth; x++ )
|
||||||
|
{
|
||||||
for( i = 0; i < samples; i++ )
|
for( i = 0; i < samples; i++ )
|
||||||
if( x < inwidth ) *out++ = *in++;
|
{
|
||||||
|
if( x < inwidth )
|
||||||
|
*out++ = *in++;
|
||||||
else *out++;
|
else *out++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*resampled = true;
|
*resampled = true;
|
||||||
return image.tempbuffer;
|
return image.tempbuffer;
|
||||||
}
|
}
|
||||||
|
@ -983,7 +996,7 @@ byte *Image_FlipInternal( const byte *in, word *srcwidth, word *srcheight, int t
|
||||||
image.tempbuffer = Mem_Realloc( host.imagepool, image.tempbuffer, width * height * samples );
|
image.tempbuffer = Mem_Realloc( host.imagepool, image.tempbuffer, width * height * samples );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// we can flip DXT without expanding to RGBA ? hmmm...
|
// we can flip DXT without expanding to RGBA? hmmm...
|
||||||
MsgDev( D_WARN, "Image_Flip: unsupported format %s\n", PFDesc[type].name );
|
MsgDev( D_WARN, "Image_Flip: unsupported format %s\n", PFDesc[type].name );
|
||||||
return (byte *)in;
|
return (byte *)in;
|
||||||
}
|
}
|
||||||
|
|
|
@ -390,7 +390,7 @@ qboolean Image_LoadMIP( const char *name, const byte *buffer, size_t filesize )
|
||||||
{
|
{
|
||||||
int pal_type;
|
int pal_type;
|
||||||
|
|
||||||
// NOTE: we can have luma-pixels if quake1/2 texture
|
// NOTE: we can have luma-pixels if quake1 texture
|
||||||
// converted into the hl texture but palette leave unchanged
|
// converted into the hl texture but palette leave unchanged
|
||||||
// this is a good reason for using fullbright pixels
|
// this is a good reason for using fullbright pixels
|
||||||
pal_type = Image_ComparePalette( pal );
|
pal_type = Image_ComparePalette( pal );
|
||||||
|
|
|
@ -459,7 +459,7 @@ long IN_WndProc( void *hWnd, uint uMsg, uint wParam, long lParam )
|
||||||
GetWindowRect( host.hWnd, &real_rect );
|
GetWindowRect( host.hWnd, &real_rect );
|
||||||
break;
|
break;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
Cbuf_ExecuteText( EXEC_APPEND, "quit" );
|
Sys_Quit();
|
||||||
break;
|
break;
|
||||||
case WM_ACTIVATE:
|
case WM_ACTIVATE:
|
||||||
if( host.state == HOST_SHUTDOWN )
|
if( host.state == HOST_SHUTDOWN )
|
||||||
|
|
|
@ -428,7 +428,7 @@ void Matrix4x4_Invert_Simple( matrix4x4 out, const matrix4x4 in1 )
|
||||||
// (note the lack of sqrt here, because we're trying to undo the scaling,
|
// (note the lack of sqrt here, because we're trying to undo the scaling,
|
||||||
// this means multiplying by the inverse scale twice - squaring it, which
|
// this means multiplying by the inverse scale twice - squaring it, which
|
||||||
// makes the sqrt a waste of time)
|
// makes the sqrt a waste of time)
|
||||||
float scale = 1.0 / (in1[0][0] * in1[0][0] + in1[0][1] * in1[0][1] + in1[0][2] * in1[0][2]);
|
float scale = 1.0f / (in1[0][0] * in1[0][0] + in1[0][1] * in1[0][1] + in1[0][2] * in1[0][2]);
|
||||||
|
|
||||||
// invert the rotation by transposing and multiplying by the squared
|
// invert the rotation by transposing and multiplying by the squared
|
||||||
// recipricol of the input matrix scale as described above
|
// recipricol of the input matrix scale as described above
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Copyright XashXT Group 2007 ©
|
// Copyright XashXT Group 2007 ©
|
||||||
// cm_local.h - main struct
|
// mod_local.h - model loader
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
#ifndef CM_LOCAL_H
|
#ifndef MOD_LOCAL_H
|
||||||
#define CM_LOCAL_H
|
#define MOD_LOCAL_H
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "bspfile.h"
|
#include "bspfile.h"
|
||||||
|
@ -44,7 +44,7 @@ typedef struct
|
||||||
msurface_t **draw_surfaces; // used for sorting translucent surfaces
|
msurface_t **draw_surfaces; // used for sorting translucent surfaces
|
||||||
int max_surfaces; // max surfaces per submodel (for all models)
|
int max_surfaces; // max surfaces per submodel (for all models)
|
||||||
size_t visdatasize; // actual size of the visdata
|
size_t visdatasize; // actual size of the visdata
|
||||||
qboolean loading; // true is worldmodel is loading
|
qboolean loading; // true if worldmodel is loading
|
||||||
} world_static_t;
|
} world_static_t;
|
||||||
|
|
||||||
extern world_static_t world;
|
extern world_static_t world;
|
||||||
|
@ -82,4 +82,4 @@ byte *Mod_DecompressVis( const byte *in );
|
||||||
modtype_t Mod_GetType( int handle );
|
modtype_t Mod_GetType( int handle );
|
||||||
model_t *Mod_Handle( int handle );
|
model_t *Mod_Handle( int handle );
|
||||||
|
|
||||||
#endif//CM_LOCAL_H
|
#endif//MOD_LOCAL_H
|
|
@ -3,7 +3,7 @@
|
||||||
// model.c - modelloader
|
// model.c - modelloader
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "sprite.h"
|
#include "sprite.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "pm_local.h"
|
#include "pm_local.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "pm_local.h"
|
#include "pm_local.h"
|
||||||
#include "pm_movevars.h"
|
#include "pm_movevars.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
#define svc_updateuserinfo 13 // [byte] playernum, [string] userinfo
|
#define svc_updateuserinfo 13 // [byte] playernum, [string] userinfo
|
||||||
#define svc_deltatable 14 // [table header][...]
|
#define svc_deltatable 14 // [table header][...]
|
||||||
#define svc_clientdata 15 // [...]
|
#define svc_clientdata 15 // [...]
|
||||||
#define svc_download 16 // [short] size [size bytes]
|
#define svc_download 16 // <OBSOLETE>
|
||||||
#define svc_updatepings 17 // [bit][idx][ping][packet_loss]
|
#define svc_updatepings 17 // [bit][idx][ping][packet_loss]
|
||||||
#define svc_particle 18 // [float*3][char*3][byte][byte]
|
#define svc_particle 18 // [float*3][char*3][byte][byte]
|
||||||
#define svc_frame 19 // <OBSOLETE>
|
#define svc_frame 19 // <OBSOLETE>
|
||||||
|
|
|
@ -255,7 +255,6 @@ static int mpeg_size( mp3_frame_t *frame, long bytes )
|
||||||
|
|
||||||
=================================================================
|
=================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize )
|
qboolean Sound_LoadMPG( const char *name, const byte *buffer, size_t filesize )
|
||||||
{
|
{
|
||||||
mpegfile_t mpeg;
|
mpegfile_t mpeg;
|
||||||
|
|
|
@ -246,7 +246,7 @@ void CL_TextMessageParse( byte *pMemFile, int fileSize )
|
||||||
lastLinePos = 0;
|
lastLinePos = 0;
|
||||||
messageCount = 0;
|
messageCount = 0;
|
||||||
|
|
||||||
while( pfnMemFgets( pMemFile, fileSize, &filePos, buf, 512 ) != NULL )
|
while( COM_MemFgets( pMemFile, fileSize, &filePos, buf, 512 ) != NULL )
|
||||||
{
|
{
|
||||||
TrimSpace( buf, trim );
|
TrimSpace( buf, trim );
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "world.h"
|
#include "world.h"
|
||||||
#include "pm_defs.h"
|
#include "pm_defs.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
|
||||||
|
@ -17,9 +17,6 @@ const char *et_name[] =
|
||||||
"tempentity",
|
"tempentity",
|
||||||
"beam",
|
"beam",
|
||||||
"fragmented",
|
"fragmented",
|
||||||
"viewentity",
|
|
||||||
"portal",
|
|
||||||
"skyportal",
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// Copyright XashXT Group 2009 ©
|
// Copyright XashXT Group 2009 ©
|
||||||
// world.h - shared world trace
|
// world.h - shared world trace
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
#ifndef WORLD_H
|
#ifndef WORLD_H
|
||||||
#define WORLD_H
|
#define WORLD_H
|
||||||
|
|
|
@ -43,7 +43,7 @@ RSC=rc.exe
|
||||||
# PROP Ignore_Export_Lib 1
|
# PROP Ignore_Export_Lib 1
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
|
||||||
# ADD CPP /nologo /MD /W3 /GX /O2 /Oy /I "./" /I "common" /I "common/imagelib" /I "common/soundlib" /I "server" /I "client" /I "client/vgui" /I "../common" /I "../game_shared" /I "../pm_shared" /I "../utils/vgui/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
|
# ADD CPP /nologo /MD /W3 /GX /O2 /I "./" /I "common" /I "common/imagelib" /I "common/soundlib" /I "server" /I "client" /I "client/vgui" /I "../common" /I "../game_shared" /I "../pm_shared" /I "../utils/vgui/include" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c
|
||||||
# SUBTRACT CPP /YX
|
# SUBTRACT CPP /YX
|
||||||
# ADD BASE MTL /nologo /D "NDEBUG" /win32
|
# ADD BASE MTL /nologo /D "NDEBUG" /win32
|
||||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||||
|
@ -178,6 +178,10 @@ SOURCE=.\common\cmd.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\common\common.c
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\common\con_utils.c
|
SOURCE=.\common\con_utils.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -198,10 +202,6 @@ SOURCE=.\common\cvar.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\common\engfuncs.c
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\common\filesystem.c
|
SOURCE=.\common\filesystem.c
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -530,10 +530,6 @@ SOURCE=.\client\client.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\common\cm_local.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\common\common.h
|
SOURCE=.\common\common.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -566,6 +562,10 @@ SOURCE=.\common\mathlib.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
|
SOURCE=.\common\mod_local.h
|
||||||
|
# End Source File
|
||||||
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\common\net_buffer.h
|
SOURCE=.\common\net_buffer.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
@ -574,10 +574,6 @@ SOURCE=.\common\net_encode.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
||||||
SOURCE=.\common\net_msg.h
|
|
||||||
# End Source File
|
|
||||||
# Begin Source File
|
|
||||||
|
|
||||||
SOURCE=.\common\protocol.h
|
SOURCE=.\common\protocol.h
|
||||||
# End Source File
|
# End Source File
|
||||||
# Begin Source File
|
# Begin Source File
|
||||||
|
|
|
@ -60,9 +60,11 @@ typedef struct ui_enginefuncs_s
|
||||||
char* (*pfnCmdArgv)( int argc );
|
char* (*pfnCmdArgv)( int argc );
|
||||||
char* (*pfnCmd_Args)( void );
|
char* (*pfnCmd_Args)( void );
|
||||||
|
|
||||||
// debug messages (im-menu shows only notify)
|
// debug messages (in-menu shows only notify)
|
||||||
void (*Con_Printf)( char *fmt, ... );
|
void (*Con_Printf)( char *fmt, ... );
|
||||||
void (*Con_DPrintf)( char *fmt, ... );
|
void (*Con_DPrintf)( char *fmt, ... );
|
||||||
|
void (*Con_NPrintf)( int pos, char *fmt, ... );
|
||||||
|
void (*Con_NXPrintf)( struct con_nprint_s *info, char *fmt, ... );
|
||||||
|
|
||||||
// sound handlers
|
// sound handlers
|
||||||
void (*pfnPlayLocalSound)( const char *szSound );
|
void (*pfnPlayLocalSound)( const char *szSound );
|
||||||
|
@ -87,18 +89,11 @@ typedef struct ui_enginefuncs_s
|
||||||
void (*pfnRenderScene)( const struct ref_params_s *fd );
|
void (*pfnRenderScene)( const struct ref_params_s *fd );
|
||||||
int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent );
|
int (*CL_CreateVisibleEntity)( int type, struct cl_entity_s *ent );
|
||||||
|
|
||||||
// dlls managemenet
|
// misc handlers
|
||||||
void* (*pfnLoadLibrary)( const char *name );
|
|
||||||
void* (*pfnGetProcAddress)( void *hInstance, const char *name );
|
|
||||||
void (*pfnFreeLibrary)( void *hInstance );
|
|
||||||
void (*pfnHostError)( const char *szFmt, ... );
|
void (*pfnHostError)( const char *szFmt, ... );
|
||||||
int (*pfnFileExists)( const char *filename, int gamedironly );
|
int (*pfnFileExists)( const char *filename, int gamedironly );
|
||||||
void (*pfnGetGameDir)( char *szGetGameDir );
|
void (*pfnGetGameDir)( char *szGetGameDir );
|
||||||
|
|
||||||
// vgui handlers
|
|
||||||
void* (*VGui_GetPanel)( void ); // UNDONE: wait for version 0.75
|
|
||||||
void (*VGui_ViewportPaintBackground)( int extents[4] );
|
|
||||||
|
|
||||||
// gameinfo handlers
|
// gameinfo handlers
|
||||||
int (*pfnCreateMapsList)( int fRefresh );
|
int (*pfnCreateMapsList)( int fRefresh );
|
||||||
int (*pfnClientInGame)( void );
|
int (*pfnClientInGame)( void );
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
#include "mathlib.h"
|
#include "mathlib.h"
|
||||||
#include "edict.h"
|
#include "edict.h"
|
||||||
#include "eiface.h"
|
#include "eiface.h"
|
||||||
#include "cm_local.h"
|
#include "mod_local.h"
|
||||||
#include "pm_defs.h"
|
#include "pm_defs.h"
|
||||||
#include "pm_movevars.h"
|
#include "pm_movevars.h"
|
||||||
#include "entity_state.h"
|
#include "entity_state.h"
|
||||||
|
|
|
@ -674,7 +674,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
||||||
Q_strcat( remaining, Cmd_Argv( i ));
|
Q_strcat( remaining, Cmd_Argv( i ));
|
||||||
Q_strcat( remaining, " " );
|
Q_strcat( remaining, " " );
|
||||||
}
|
}
|
||||||
Cmd_ExecuteString( remaining );
|
Cmd_ExecuteString( remaining, src_command );
|
||||||
}
|
}
|
||||||
SV_EndRedirect();
|
SV_EndRedirect();
|
||||||
}
|
}
|
||||||
|
@ -1690,6 +1690,7 @@ void SV_ExecuteClientCommand( sv_client_t *cl, char *s )
|
||||||
{
|
{
|
||||||
ucmd_t *u;
|
ucmd_t *u;
|
||||||
|
|
||||||
|
svs.currentPlayer = cl;
|
||||||
Cmd_TokenizeString( s );
|
Cmd_TokenizeString( s );
|
||||||
|
|
||||||
for( u = ucmds; u->name; u++ )
|
for( u = ucmds; u->name; u++ )
|
||||||
|
|
|
@ -358,7 +358,7 @@ SV_QuickLoad_f
|
||||||
*/
|
*/
|
||||||
void SV_QuickLoad_f( void )
|
void SV_QuickLoad_f( void )
|
||||||
{
|
{
|
||||||
Cbuf_ExecuteText( EXEC_APPEND, "echo Quick Loading...; wait; load quick" );
|
Cbuf_AddText( "echo Quick Loading...; wait; load quick" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -391,7 +391,7 @@ SV_QuickSave_f
|
||||||
*/
|
*/
|
||||||
void SV_QuickSave_f( void )
|
void SV_QuickSave_f( void )
|
||||||
{
|
{
|
||||||
Cbuf_ExecuteText( EXEC_APPEND, "echo Quick Saving...; wait; save quick" );
|
Cbuf_AddText( "echo Quick Saving...; wait; save quick" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -774,6 +774,12 @@ void SV_EdictsInfo_f( void )
|
||||||
{
|
{
|
||||||
int active;
|
int active;
|
||||||
|
|
||||||
|
if( sv.state != ss_active )
|
||||||
|
{
|
||||||
|
Msg( "^3no server running.\n" );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
active = pfnNumberOfEntities();
|
active = pfnNumberOfEntities();
|
||||||
Msg( "%5i edicts is used\n", active );
|
Msg( "%5i edicts is used\n", active );
|
||||||
Msg( "%5i edicts is free\n", svgame.globals->maxEntities - active );
|
Msg( "%5i edicts is free\n", svgame.globals->maxEntities - active );
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
#include "pm_defs.h"
|
#include "pm_defs.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
|
||||||
|
// disable this when QNAN error in MakeVectors will be sucessfully reached
|
||||||
|
#define TEMPORARY_FIX_QNAN_ERROR
|
||||||
|
|
||||||
// fatpvs stuff
|
// fatpvs stuff
|
||||||
static byte fatpvs[MAX_MAP_LEAFS/8];
|
static byte fatpvs[MAX_MAP_LEAFS/8];
|
||||||
static byte fatphs[MAX_MAP_LEAFS/8];
|
static byte fatphs[MAX_MAP_LEAFS/8];
|
||||||
|
@ -930,17 +933,6 @@ int pfnPrecacheModel( const char *s )
|
||||||
return modelIndex;
|
return modelIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=========
|
|
||||||
pfnPrecacheSound
|
|
||||||
|
|
||||||
=========
|
|
||||||
*/
|
|
||||||
int pfnPrecacheSound( const char *s )
|
|
||||||
{
|
|
||||||
return SV_SoundIndex( s );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
pfnSetModel
|
pfnSetModel
|
||||||
|
@ -1335,9 +1327,6 @@ edict_t *pfnEntitiesInPVS( edict_t *pplayer )
|
||||||
return chain;
|
return chain;
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable this when QNAN error in MakeVectors will be sucessfully reached
|
|
||||||
#define TEMPORARY_FIX_QNAN_ERROR
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
pfnMakeVectors
|
pfnMakeVectors
|
||||||
|
@ -1358,18 +1347,6 @@ void pfnMakeVectors( const float *rgflVector )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
==============
|
|
||||||
pfnCreateEntity
|
|
||||||
|
|
||||||
just allocate a new one
|
|
||||||
==============
|
|
||||||
*/
|
|
||||||
edict_t* pfnCreateEntity( void )
|
|
||||||
{
|
|
||||||
return SV_AllocEdict();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
==============
|
==============
|
||||||
pfnRemoveEntity
|
pfnRemoveEntity
|
||||||
|
@ -2038,7 +2015,6 @@ void pfnGetAimVector( edict_t* ent, float speed, float *rgflReturn )
|
||||||
int i, j;
|
int i, j;
|
||||||
trace_t tr;
|
trace_t tr;
|
||||||
|
|
||||||
Msg( "GetAimVector for %s\n", SV_ClassName( ent ));
|
|
||||||
VectorCopy( svgame.globals->v_forward, rgflReturn ); // assume failure if it returns early
|
VectorCopy( svgame.globals->v_forward, rgflReturn ); // assume failure if it returns early
|
||||||
|
|
||||||
if( !SV_IsValidEdict( ent ) || (ent->v.flags & FL_FAKECLIENT))
|
if( !SV_IsValidEdict( ent ) || (ent->v.flags & FL_FAKECLIENT))
|
||||||
|
@ -2095,17 +2071,6 @@ void pfnServerCommand( const char* str )
|
||||||
else MsgDev( D_ERROR, "bad server command %s\n", str );
|
else MsgDev( D_ERROR, "bad server command %s\n", str );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=========
|
|
||||||
pfnServerExecute
|
|
||||||
|
|
||||||
=========
|
|
||||||
*/
|
|
||||||
void pfnServerExecute( void )
|
|
||||||
{
|
|
||||||
Cbuf_Execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=========
|
=========
|
||||||
pfnClientCommand
|
pfnClientCommand
|
||||||
|
@ -2227,6 +2192,7 @@ pfnPointContents
|
||||||
*/
|
*/
|
||||||
static int pfnPointContents( const float *rgflVector )
|
static int pfnPointContents( const float *rgflVector )
|
||||||
{
|
{
|
||||||
|
if( !rgflVector ) return CONTENTS_NONE;
|
||||||
return SV_PointContents( rgflVector );
|
return SV_PointContents( rgflVector );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2529,28 +2495,6 @@ void pfnWriteEntity( int iValue )
|
||||||
svgame.msg_realsize += 2;
|
svgame.msg_realsize += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCVarRegister
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnCVarRegister( cvar_t *pCvar )
|
|
||||||
{
|
|
||||||
Cvar_RegisterVariable( pCvar );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCvar_DirectSet
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnCvar_DirectSet( cvar_t *var, char *value )
|
|
||||||
{
|
|
||||||
Cvar_DirectSet( var, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnAlertMessage
|
pfnAlertMessage
|
||||||
|
@ -3076,6 +3020,17 @@ void pfnSetView( const edict_t *pClient, const edict_t *pViewent )
|
||||||
BF_WriteWord( &client->netchan.message, NUM_FOR_EDICT( pViewent ));
|
BF_WriteWord( &client->netchan.message, NUM_FOR_EDICT( pViewent ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
=============
|
||||||
|
pfnTime
|
||||||
|
|
||||||
|
=============
|
||||||
|
*/
|
||||||
|
float pfnTime( void )
|
||||||
|
{
|
||||||
|
return (float)Sys_DoubleTime();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnCompareFileTime
|
pfnCompareFileTime
|
||||||
|
@ -3120,18 +3075,6 @@ void pfnStaticDecal( const float *origin, int decalIndex, int entityIndex, int m
|
||||||
SV_CreateDecal( origin, decalIndex, entityIndex, modelIndex, FDECAL_PERMANENT );
|
SV_CreateDecal( origin, decalIndex, entityIndex, modelIndex, FDECAL_PERMANENT );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnPrecacheGeneric
|
|
||||||
|
|
||||||
can be used for precache scripts
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
int pfnPrecacheGeneric( const char *s )
|
|
||||||
{
|
|
||||||
return SV_GenericIndex( s );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnIsDedicatedServer
|
pfnIsDedicatedServer
|
||||||
|
@ -3239,17 +3182,6 @@ void pfnSetClientMaxspeed( const edict_t *pEdict, float fNewMaxspeed )
|
||||||
SV_SetClientMaxspeed( cl, fNewMaxspeed );
|
SV_SetClientMaxspeed( cl, fNewMaxspeed );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnCreateFakeClient
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
edict_t *pfnCreateFakeClient( const char *netname )
|
|
||||||
{
|
|
||||||
return SV_FakeConnect( netname );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
pfnRunPlayerMove
|
pfnRunPlayerMove
|
||||||
|
@ -3312,39 +3244,6 @@ int pfnNumberOfEntities( void )
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnInfo_RemoveKey
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnInfo_RemoveKey( char *s, const char *key )
|
|
||||||
{
|
|
||||||
Info_RemoveKey( s, key );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnInfoKeyValue
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
char *pfnInfoKeyValue( char *infobuffer, char *key )
|
|
||||||
{
|
|
||||||
return Info_ValueForKey( infobuffer, key );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
pfnSetKeyValue
|
|
||||||
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
void pfnSetKeyValue( char *infobuffer, char *key, char *value )
|
|
||||||
{
|
|
||||||
Info_SetValueForKey( infobuffer, key, value );
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
|
@ -4027,7 +3926,7 @@ const char *pfnGetPlayerAuthId( edict_t *e )
|
||||||
static enginefuncs_t gEngfuncs =
|
static enginefuncs_t gEngfuncs =
|
||||||
{
|
{
|
||||||
pfnPrecacheModel,
|
pfnPrecacheModel,
|
||||||
pfnPrecacheSound,
|
SV_SoundIndex,
|
||||||
pfnSetModel,
|
pfnSetModel,
|
||||||
pfnModelIndex,
|
pfnModelIndex,
|
||||||
pfnModelFrames,
|
pfnModelFrames,
|
||||||
|
@ -4047,7 +3946,7 @@ static enginefuncs_t gEngfuncs =
|
||||||
pfnEntitiesInPVS,
|
pfnEntitiesInPVS,
|
||||||
pfnMakeVectors,
|
pfnMakeVectors,
|
||||||
AngleVectors,
|
AngleVectors,
|
||||||
pfnCreateEntity,
|
SV_AllocEdict,
|
||||||
pfnRemoveEntity,
|
pfnRemoveEntity,
|
||||||
pfnCreateNamedEntity,
|
pfnCreateNamedEntity,
|
||||||
pfnMakeStatic,
|
pfnMakeStatic,
|
||||||
|
@ -4066,7 +3965,7 @@ static enginefuncs_t gEngfuncs =
|
||||||
pfnTraceSphere,
|
pfnTraceSphere,
|
||||||
pfnGetAimVector,
|
pfnGetAimVector,
|
||||||
pfnServerCommand,
|
pfnServerCommand,
|
||||||
pfnServerExecute,
|
Cbuf_Execute,
|
||||||
pfnClientCommand,
|
pfnClientCommand,
|
||||||
pfnParticleEffect,
|
pfnParticleEffect,
|
||||||
pfnLightStyle,
|
pfnLightStyle,
|
||||||
|
@ -4082,11 +3981,11 @@ static enginefuncs_t gEngfuncs =
|
||||||
pfnWriteCoord,
|
pfnWriteCoord,
|
||||||
pfnWriteString,
|
pfnWriteString,
|
||||||
pfnWriteEntity,
|
pfnWriteEntity,
|
||||||
pfnCVarRegister,
|
Cvar_RegisterVariable,
|
||||||
pfnCVarGetValue,
|
Cvar_VariableValue,
|
||||||
pfnCVarGetString,
|
Cvar_VariableString,
|
||||||
pfnCVarSetValue,
|
Cvar_SetFloat,
|
||||||
pfnCVarSetString,
|
Cvar_Set,
|
||||||
pfnAlertMessage,
|
pfnAlertMessage,
|
||||||
pfnEngineFprintf,
|
pfnEngineFprintf,
|
||||||
pfnPvAllocEntPrivateData,
|
pfnPvAllocEntPrivateData,
|
||||||
|
@ -4108,9 +4007,9 @@ static enginefuncs_t gEngfuncs =
|
||||||
pfnNameForFunction,
|
pfnNameForFunction,
|
||||||
pfnClientPrintf,
|
pfnClientPrintf,
|
||||||
pfnServerPrint,
|
pfnServerPrint,
|
||||||
pfnCmd_Args,
|
Cmd_Args,
|
||||||
pfnCmd_Argv,
|
Cmd_Argv,
|
||||||
pfnCmd_Argc,
|
Cmd_Argc,
|
||||||
pfnGetAttachment,
|
pfnGetAttachment,
|
||||||
CRC32_Init,
|
CRC32_Init,
|
||||||
CRC32_ProcessBuffer,
|
CRC32_ProcessBuffer,
|
||||||
|
@ -4121,30 +4020,30 @@ static enginefuncs_t gEngfuncs =
|
||||||
pfnSetView,
|
pfnSetView,
|
||||||
pfnTime,
|
pfnTime,
|
||||||
pfnCrosshairAngle,
|
pfnCrosshairAngle,
|
||||||
pfnLoadFile,
|
COM_LoadFileForMe,
|
||||||
COM_FreeFile,
|
COM_FreeFile,
|
||||||
pfnEndSection,
|
pfnEndSection,
|
||||||
pfnCompareFileTime,
|
pfnCompareFileTime,
|
||||||
pfnGetGameDir,
|
pfnGetGameDir,
|
||||||
pfnCVarRegister,
|
Cvar_RegisterVariable,
|
||||||
pfnFadeClientVolume,
|
pfnFadeClientVolume,
|
||||||
pfnSetClientMaxspeed,
|
pfnSetClientMaxspeed,
|
||||||
pfnCreateFakeClient,
|
SV_FakeConnect,
|
||||||
pfnRunPlayerMove,
|
pfnRunPlayerMove,
|
||||||
pfnNumberOfEntities,
|
pfnNumberOfEntities,
|
||||||
pfnGetInfoKeyBuffer,
|
pfnGetInfoKeyBuffer,
|
||||||
pfnInfoKeyValue,
|
Info_ValueForKey,
|
||||||
pfnSetKeyValue,
|
Info_SetValueForKey,
|
||||||
pfnSetClientKeyValue,
|
pfnSetClientKeyValue,
|
||||||
pfnIsMapValid,
|
pfnIsMapValid,
|
||||||
pfnStaticDecal,
|
pfnStaticDecal,
|
||||||
pfnPrecacheGeneric,
|
SV_GenericIndex,
|
||||||
pfnGetPlayerUserId,
|
pfnGetPlayerUserId,
|
||||||
pfnBuildSoundMsg,
|
pfnBuildSoundMsg,
|
||||||
pfnIsDedicatedServer,
|
pfnIsDedicatedServer,
|
||||||
pfnCVarGetPointer,
|
pfnCVarGetPointer,
|
||||||
pfnGetPlayerWONId,
|
pfnGetPlayerWONId,
|
||||||
pfnInfo_RemoveKey,
|
Info_RemoveKey,
|
||||||
pfnGetPhysicsKeyValue,
|
pfnGetPhysicsKeyValue,
|
||||||
pfnSetPhysicsKeyValue,
|
pfnSetPhysicsKeyValue,
|
||||||
pfnGetPhysicsInfoString,
|
pfnGetPhysicsInfoString,
|
||||||
|
@ -4163,7 +4062,7 @@ static enginefuncs_t gEngfuncs =
|
||||||
Delta_UnsetFieldByIndex,
|
Delta_UnsetFieldByIndex,
|
||||||
pfnSetGroupMask,
|
pfnSetGroupMask,
|
||||||
pfnCreateInstancedBaseline,
|
pfnCreateInstancedBaseline,
|
||||||
pfnCvar_DirectSet,
|
Cvar_DirectSet,
|
||||||
pfnForceUnmodified,
|
pfnForceUnmodified,
|
||||||
pfnGetPlayerStats,
|
pfnGetPlayerStats,
|
||||||
Cmd_AddGameCommand,
|
Cmd_AddGameCommand,
|
||||||
|
@ -4432,7 +4331,7 @@ void SV_UnloadProgs( void )
|
||||||
|
|
||||||
// must unlink all game cvars,
|
// must unlink all game cvars,
|
||||||
// before pointers on them will be lost...
|
// before pointers on them will be lost...
|
||||||
Cmd_ExecuteString( "@unlink\n" );
|
Cmd_ExecuteString( "@unlink\n", src_command );
|
||||||
|
|
||||||
Com_FreeLibrary( svgame.hInstance );
|
Com_FreeLibrary( svgame.hInstance );
|
||||||
Mem_FreePool( &svgame.mempool );
|
Mem_FreePool( &svgame.mempool );
|
||||||
|
|
|
@ -450,7 +450,7 @@ qboolean SV_SpawnServer( const char *mapname, const char *startspot )
|
||||||
qboolean loadgame, paused;
|
qboolean loadgame, paused;
|
||||||
qboolean background;
|
qboolean background;
|
||||||
|
|
||||||
Cmd_ExecuteString( "latch\n" );
|
Cmd_ExecuteString( "latch\n", src_command );
|
||||||
|
|
||||||
// save state
|
// save state
|
||||||
loadgame = sv.loadgame;
|
loadgame = sv.loadgame;
|
||||||
|
|
|
@ -624,8 +624,7 @@ trace_t SV_PushEntity( edict_t *ent, const vec3_t lpush, const vec3_t apush, int
|
||||||
|
|
||||||
trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type, ent );
|
trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, end, type, ent );
|
||||||
|
|
||||||
// NOTE: this condition may doing wrong results with spawn repels from osprey in SvenCoop 4.5. revisit
|
if( trace.fraction != 0.0f )
|
||||||
if( !trace.allsolid && trace.fraction != 0.0f )
|
|
||||||
{
|
{
|
||||||
VectorCopy( trace.endpos, ent->v.origin );
|
VectorCopy( trace.endpos, ent->v.origin );
|
||||||
|
|
||||||
|
@ -1093,7 +1092,7 @@ void SV_Physics_Follow( edict_t *ent )
|
||||||
parent = ent->v.aiment;
|
parent = ent->v.aiment;
|
||||||
if( !SV_IsValidEdict( parent )) return;
|
if( !SV_IsValidEdict( parent )) return;
|
||||||
|
|
||||||
VectorCopy( parent->v.origin, ent->v.origin );
|
VectorAdd( parent->v.origin, parent->v.view_ofs, ent->v.origin );
|
||||||
VectorCopy( parent->v.angles, ent->v.angles );
|
VectorCopy( parent->v.angles, ent->v.angles );
|
||||||
|
|
||||||
// noclip ents never touch triggers
|
// noclip ents never touch triggers
|
||||||
|
@ -1341,11 +1340,11 @@ void SV_Physics_Toss( edict_t *ent )
|
||||||
|
|
||||||
vel = DotProduct( ent->v.velocity, ent->v.velocity );
|
vel = DotProduct( ent->v.velocity, ent->v.velocity );
|
||||||
|
|
||||||
if( vel < 900 || ( ent->v.movetype != MOVETYPE_BOUNCE && ent->v.movetype != MOVETYPE_BOUNCEMISSILE ))
|
if( vel < 900.0f || ( ent->v.movetype != MOVETYPE_BOUNCE && ent->v.movetype != MOVETYPE_BOUNCEMISSILE ))
|
||||||
{
|
{
|
||||||
ent->v.flags |= FL_ONGROUND;
|
ent->v.flags |= FL_ONGROUND;
|
||||||
ent->v.groundentity = trace.ent;
|
ent->v.groundentity = trace.ent;
|
||||||
VectorClear( ent->v.velocity ); // avelocity clearing in server.dll
|
VectorClear( ent->v.velocity ); // avelocity will be clearing in game.dll
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -450,7 +450,7 @@ void SV_InitClientMove( void )
|
||||||
svgame.pmove->COM_FileSize = COM_FileSize;
|
svgame.pmove->COM_FileSize = COM_FileSize;
|
||||||
svgame.pmove->COM_LoadFile = COM_LoadFile;
|
svgame.pmove->COM_LoadFile = COM_LoadFile;
|
||||||
svgame.pmove->COM_FreeFile = COM_FreeFile;
|
svgame.pmove->COM_FreeFile = COM_FreeFile;
|
||||||
svgame.pmove->memfgets = pfnMemFgets;
|
svgame.pmove->memfgets = COM_MemFgets;
|
||||||
svgame.pmove->PM_PlaySound = pfnPlaySound;
|
svgame.pmove->PM_PlaySound = pfnPlaySound;
|
||||||
svgame.pmove->PM_TraceTexture = pfnTraceTexture;
|
svgame.pmove->PM_TraceTexture = pfnTraceTexture;
|
||||||
svgame.pmove->PM_PlaybackEventFull = pfnPlaybackEventFull;
|
svgame.pmove->PM_PlaybackEventFull = pfnPlaybackEventFull;
|
||||||
|
|
|
@ -402,6 +402,13 @@ void SV_TouchLinks( edict_t *ent, areanode_t *node )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if( touch->v.groupinfo && ent->v.groupinfo )
|
||||||
|
{
|
||||||
|
if(( !svs.groupop && !(touch->v.groupinfo & ent->v.groupinfo)) ||
|
||||||
|
(svs.groupop == 1 && (touch->v.groupinfo & ent->v.groupinfo)))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if( touch == ent || touch->v.solid != SOLID_TRIGGER ) // disabled ?
|
if( touch == ent || touch->v.solid != SOLID_TRIGGER ) // disabled ?
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -648,6 +655,13 @@ void SV_WaterLinks( const vec3_t origin, int *pCont, areanode_t *node )
|
||||||
if( touch->v.solid != SOLID_NOT ) // disabled ?
|
if( touch->v.solid != SOLID_NOT ) // disabled ?
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( touch->v.groupinfo )
|
||||||
|
{
|
||||||
|
if(( !svs.groupop && !(touch->v.groupinfo & svs.groupmask)) ||
|
||||||
|
(svs.groupop == 1 && (touch->v.groupinfo & svs.groupmask)))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// only brushes can have special contents
|
// only brushes can have special contents
|
||||||
if( Mod_GetType( touch->v.modelindex ) != mod_brush )
|
if( Mod_GetType( touch->v.modelindex ) != mod_brush )
|
||||||
continue;
|
continue;
|
||||||
|
@ -728,7 +742,8 @@ returns true if the entity is in solid currently
|
||||||
qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker )
|
qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker )
|
||||||
{
|
{
|
||||||
trace_t trace;
|
trace_t trace;
|
||||||
|
#if 0
|
||||||
|
// g-cont. probably not needs
|
||||||
if( ent->v.flags & (FL_CLIENT|FL_FAKECLIENT))
|
if( ent->v.flags & (FL_CLIENT|FL_FAKECLIENT))
|
||||||
{
|
{
|
||||||
// to avoid falling through tracktrain update client mins\maxs here
|
// to avoid falling through tracktrain update client mins\maxs here
|
||||||
|
@ -736,7 +751,7 @@ qboolean SV_TestEntityPosition( edict_t *ent, edict_t *blocker )
|
||||||
SV_SetMinMaxSize( ent, svgame.pmove->player_mins[1], svgame.pmove->player_maxs[1] );
|
SV_SetMinMaxSize( ent, svgame.pmove->player_mins[1], svgame.pmove->player_maxs[1] );
|
||||||
else SV_SetMinMaxSize( ent, svgame.pmove->player_mins[0], svgame.pmove->player_maxs[0] );
|
else SV_SetMinMaxSize( ent, svgame.pmove->player_mins[0], svgame.pmove->player_maxs[0] );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, MOVE_NORMAL|FMOVE_SIMPLEBOX, ent );
|
trace = SV_Move( ent->v.origin, ent->v.mins, ent->v.maxs, ent->v.origin, MOVE_NORMAL|FMOVE_SIMPLEBOX, ent );
|
||||||
|
|
||||||
if( SV_IsValidEdict( blocker ) && SV_IsValidEdict( trace.ent ))
|
if( SV_IsValidEdict( blocker ) && SV_IsValidEdict( trace.ent ))
|
||||||
|
@ -1522,8 +1537,8 @@ int SV_LightForEntity( edict_t *pEdict )
|
||||||
|
|
||||||
if( pEdict->v.flags & FL_CLIENT )
|
if( pEdict->v.flags & FL_CLIENT )
|
||||||
{
|
{
|
||||||
// client has more precision light level
|
// player has more precision light level
|
||||||
// that come from client
|
// that come from client-side
|
||||||
return pEdict->v.light_level;
|
return pEdict->v.light_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,9 +57,6 @@ inline HIMAGE PIC_Load( const char *szPicName, const byte *ucRawImage, long ulRa
|
||||||
#define FILE_EXISTS( file ) (*g_engfuncs.pfnFileExists)( file, FALSE )
|
#define FILE_EXISTS( file ) (*g_engfuncs.pfnFileExists)( file, FALSE )
|
||||||
#define FREE_FILE (*g_engfuncs.COM_FreeFile)
|
#define FREE_FILE (*g_engfuncs.COM_FreeFile)
|
||||||
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
|
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
|
||||||
#define LOAD_LIBRARY (*g_engfuncs.pfnLoadLibrary)
|
|
||||||
#define GET_PROC_ADDRESS (*g_engfuncs.pfnGetProcAddress)
|
|
||||||
#define FREE_LIBRARY (*g_engfuncs.pfnFreeLibrary)
|
|
||||||
#define HOST_ERROR (*g_engfuncs.pfnHostError)
|
#define HOST_ERROR (*g_engfuncs.pfnHostError)
|
||||||
#define COM_ParseFile (*g_engfuncs.COM_ParseFile)
|
#define COM_ParseFile (*g_engfuncs.COM_ParseFile)
|
||||||
#define KEY_SetDest (*g_engfuncs.pfnSetKeyDest)
|
#define KEY_SetDest (*g_engfuncs.pfnSetKeyDest)
|
||||||
|
|
Reference in New Issue