03 Jan 2009
This commit is contained in:
parent
1e6aee5a7b
commit
0d70770186
|
@ -100,7 +100,7 @@ void CHud :: VidInit( void )
|
|||
client_sprite_t *p = m_pSpriteList;
|
||||
for ( int j = 0; j < m_iSpriteCount; j++ )
|
||||
{
|
||||
m_rghSprites[j] = p->hSprite;
|
||||
m_rghSprites[j] = SPR_Load( p->szSprite );
|
||||
m_rgrcRects[j] = p->rc;
|
||||
strncpy( &m_rgszSpriteNames[j * MAX_SPRITE_NAME_LENGTH], p->szName, MAX_SPRITE_NAME_LENGTH );
|
||||
p++;
|
||||
|
@ -177,7 +177,10 @@ int CHud :: UpdateClientData( ref_params_t *cdata, float time )
|
|||
{
|
||||
memcpy( m_vecOrigin, cdata->origin, sizeof( vec3_t ));
|
||||
memcpy( m_vecAngles, cdata->angles, sizeof( vec3_t ));
|
||||
|
||||
|
||||
if( m_iWeaponBits != cdata->iWeaponBits )
|
||||
ALERT( at_console, "WeaponBits: %i\n", cdata->iWeaponBits );
|
||||
|
||||
m_iKeyBits = cdata->iKeyBits;
|
||||
m_iWeaponBits = cdata->iWeaponBits;
|
||||
|
||||
|
|
|
@ -215,6 +215,7 @@ public:
|
|||
private:
|
||||
int m_iStatus;
|
||||
int m_iTime;
|
||||
float m_flVolume;
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -657,7 +658,7 @@ public:
|
|||
int iHeight;
|
||||
} m_scrinfo;
|
||||
|
||||
qword m_iWeaponBits;
|
||||
int m_iWeaponBits;
|
||||
int m_fPlayerDead;
|
||||
int m_iIntermission;
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
p = GetSpriteList( pList, "crosshair", i );
|
||||
if( p )
|
||||
{
|
||||
pWeapon->hCrosshair = p->hSprite;
|
||||
pWeapon->hCrosshair = SPR_Load( p->szSprite );
|
||||
pWeapon->rcCrosshair = p->rc;
|
||||
}
|
||||
else pWeapon->hCrosshair = 0;
|
||||
|
@ -92,7 +92,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
p = GetSpriteList( pList, "autoaim", i );
|
||||
if( p )
|
||||
{
|
||||
pWeapon->hAutoaim = p->hSprite;
|
||||
pWeapon->hAutoaim = SPR_Load( p->szSprite );
|
||||
pWeapon->rcAutoaim = p->rc;
|
||||
}
|
||||
else pWeapon->hAutoaim = 0;
|
||||
|
@ -100,7 +100,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
p = GetSpriteList( pList, "zoom", i );
|
||||
if( p )
|
||||
{
|
||||
pWeapon->hZoomedCrosshair = p->hSprite;
|
||||
pWeapon->hZoomedCrosshair = SPR_Load( p->szSprite );
|
||||
pWeapon->rcZoomedCrosshair = p->rc;
|
||||
}
|
||||
else
|
||||
|
@ -112,7 +112,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
p = GetSpriteList( pList, "zoom_autoaim", i );
|
||||
if( p )
|
||||
{
|
||||
pWeapon->hZoomedAutoaim = p->hSprite;
|
||||
pWeapon->hZoomedAutoaim = SPR_Load( p->szSprite );
|
||||
pWeapon->rcZoomedAutoaim = p->rc;
|
||||
}
|
||||
else
|
||||
|
@ -124,7 +124,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
p = GetSpriteList( pList, "weapon", i );
|
||||
if( p )
|
||||
{
|
||||
pWeapon->hInactive = p->hSprite;
|
||||
pWeapon->hInactive = SPR_Load( p->szSprite );
|
||||
pWeapon->rcInactive = p->rc;
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
p = GetSpriteList( pList, "weapon_s", i );
|
||||
if( p )
|
||||
{
|
||||
pWeapon->hActive = p->hSprite;
|
||||
pWeapon->hActive = SPR_Load( p->szSprite );
|
||||
pWeapon->rcActive = p->rc;
|
||||
}
|
||||
else
|
||||
|
@ -150,7 +150,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
p = GetSpriteList( pList, "ammo", i );
|
||||
if( p )
|
||||
{
|
||||
pWeapon->hAmmo = p->hSprite;
|
||||
pWeapon->hAmmo = SPR_Load( p->szSprite );
|
||||
pWeapon->rcAmmo = p->rc;
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void WeaponsResource :: LoadWeaponSprites( WEAPON *pWeapon )
|
|||
p = GetSpriteList( pList, "ammo2", i );
|
||||
if( p )
|
||||
{
|
||||
pWeapon->hAmmo2 = p->hSprite;
|
||||
pWeapon->hAmmo2 = SPR_Load( p->szSprite );
|
||||
pWeapon->rcAmmo2 = p->rc;
|
||||
gHR.iHistoryGap = max( gHR.iHistoryGap, pWeapon->rcActive.bottom - pWeapon->rcActive.top );
|
||||
}
|
||||
|
|
|
@ -79,6 +79,8 @@ static char *FMOD_ErrorString( int errcode )
|
|||
#define FSOUND_LOADMEMORY 0x00008000
|
||||
#define FSOUND_MPEGACCURATE 0x00020000
|
||||
|
||||
#define FSOUND_ALL -3 /* for a channel index, this flag will affect ALL channels available!*/
|
||||
|
||||
enum FSOUND_MIXERTYPES
|
||||
{
|
||||
FSOUND_MIXER_AUTODETECT, /* CE/PS2/GC Only - Non interpolating/low quality mixer. */
|
||||
|
@ -129,8 +131,8 @@ static int (_stdcall *qfmod_getstreampos)(void *data);
|
|||
static signed char (_stdcall *qfmod_setstreampause)(int channel, signed char paused);
|
||||
static signed char (_stdcall *qfmod_setstreampos)(void *data, unsigned int pos);
|
||||
static signed char (_stdcall *qfmod_stopstream)(void *data);
|
||||
static signed char (_stdcall *qfmod_setvolume)(int channel, int vol);
|
||||
|
||||
static signed char (_stdcall *qfmod_setvolume)(int channel, int vol );
|
||||
static signed char (_stdcall *qfmod_setmodvolume)( void *mod, int volume );
|
||||
|
||||
static dllfunction_t fmodfuncs[] =
|
||||
{
|
||||
|
@ -151,6 +153,7 @@ static dllfunction_t fmodfuncs[] =
|
|||
{"_FMUSIC_LoadSongMemory@8", (void **) &qfmod_loadsongmemory},
|
||||
{"_FMUSIC_SetPaused@8", (void **) &qfmod_setmodpause},
|
||||
{"_FMUSIC_GetPaused@4", (void **) &qfmod_getmodpause},
|
||||
{"_FMUSIC_SetMasterVolume@8", (void **) &qfmod_setmodvolume},
|
||||
{"_FSOUND_Stream_OpenFile@12",(void **) &qfmod_loadstream},
|
||||
{"_FSOUND_Stream_Play@8", (void **) &qfmod_playstream},
|
||||
{"_FSOUND_Stream_Close@4", (void **) &qfmod_freestream},
|
||||
|
@ -238,6 +241,7 @@ int CHudSound :: VidInit( void )
|
|||
{
|
||||
// MsgFunc_Fsound( 0, 0, NULL );
|
||||
if( fmod_dll ) qfmod_stopallsongs(); // stop all songs
|
||||
m_flVolume = 0.0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -247,7 +251,7 @@ int CHudSound :: MsgFunc_Fsound( const char *pszName, int iSize, void *pbuf )
|
|||
|
||||
BEGIN_READ( pszName, iSize, pbuf );
|
||||
|
||||
strcpy( songname, READ_STRING( )); // songname
|
||||
strcpy( songname, va( "media/%s", READ_STRING( ))); // songname
|
||||
m_iTime = READ_SHORT(); // song position
|
||||
m_iStatus = READ_BYTE();
|
||||
|
||||
|
@ -256,8 +260,8 @@ int CHudSound :: MsgFunc_Fsound( const char *pszName, int iSize, void *pbuf )
|
|||
{
|
||||
if( CheckFormat( FALSE ) == TRACK ) qfmod_freesong( fmod_data );
|
||||
else if( CheckFormat( FALSE ) == STREAM ) qfmod_freestream( fmod_data );
|
||||
memset( fmod_data, 0, sizeof( fmod_data ));
|
||||
memset( (char*)songname, 0, sizeof( songname ));
|
||||
fmod_data = NULL;
|
||||
m_iTime = 0;
|
||||
m_iStatus = 0;
|
||||
}
|
||||
|
@ -329,6 +333,7 @@ int CHudSound :: PlayStream( const char* name )
|
|||
int CHudSound :: Draw( float flTime )
|
||||
{
|
||||
int pause = CVAR_GET_FLOAT( "paused" ); // engine cvar
|
||||
float vol = CVAR_GET_FLOAT( "s_musicvolume" ); // sound engine cvar
|
||||
|
||||
if( fmod_dll && fmod_data )
|
||||
{
|
||||
|
@ -341,6 +346,14 @@ int CHudSound :: Draw( float flTime )
|
|||
qfmod_setstreampause( 0, !qfmod_getstreampause( 0 ));
|
||||
last_state = pause;
|
||||
}
|
||||
if( vol != m_flVolume )
|
||||
{
|
||||
if( CheckFormat( FALSE ) == TRACK )
|
||||
qfmod_setmodvolume( fmod_data, (int)(vol * 256.f ));
|
||||
else if( CheckFormat( FALSE ) == STREAM )
|
||||
qfmod_setvolume( FSOUND_ALL, (int)(vol * 256.f ));
|
||||
m_flVolume = vol;
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -412,13 +412,14 @@ void DrawCrosshair( void )
|
|||
{
|
||||
if( ds.hCrosshair == 0 ) return;
|
||||
|
||||
// find center of screen
|
||||
int x = (SCREEN_WIDTH - ds.rcCrosshair.right) / 2;
|
||||
int y = (SCREEN_HEIGHT - ds.rcCrosshair.bottom) / 2;
|
||||
|
||||
// FIXME: apply crosshair angles
|
||||
int x = (ScreenWidth - ds.rcCrosshair.right) / 2;
|
||||
int y = (ScreenHeight - ds.rcCrosshair.bottom) / 2;
|
||||
|
||||
ds.hSprite = ds.hCrosshair;
|
||||
SetParms( ds.hCrosshair, kRenderTransAlpha, 0 );
|
||||
SetColor( ds.rgbCrosshair.x, ds.rgbCrosshair.y, ds.rgbCrosshair.z, 1.0f );
|
||||
DrawImage( ds.hCrosshair, x, y, ds.rcCrosshair.right, ds.rcCrosshair.bottom );
|
||||
SPR_DrawGeneric( 0, x, y, -1, -1, &ds.rcCrosshair );
|
||||
}
|
||||
|
||||
void DrawPause( void )
|
||||
|
|
|
@ -72,5 +72,5 @@ if exist vsound\vsound.plg del /f /q vsound\vsound.plg
|
|||
echo Build succeeded!
|
||||
echo Please wait. Xash is now loading
|
||||
cd D:\Xash3D\
|
||||
quake.exe -game tmpQuArK -log -debug -dev 3 +map qctest
|
||||
quake.exe -game tmpQuArK -log -debug -dev 3 +map dm_qstyle
|
||||
:done
|
|
@ -22,11 +22,7 @@ void CL_UpdateEntityFields( edict_t *ent )
|
|||
ent->v.model = MAKE_STRING( cl.configstrings[CS_MODELS+ent->pvClientData->current.model.index] );
|
||||
VectorCopy( ent->pvClientData->current.origin, ent->v.origin );
|
||||
VectorCopy( ent->pvClientData->current.angles, ent->v.angles );
|
||||
|
||||
if( ent->pvClientData->current.ed_type == ED_CLIENT )
|
||||
{
|
||||
ent->v.weapons = ent->pvClientData->current.weapon1 + (ent->pvClientData->current.weapon2 << 32);
|
||||
}
|
||||
ent->v.weapons = ent->pvClientData->current.weapons;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -436,12 +432,8 @@ void CL_CalcViewValues( void )
|
|||
// add the weapon
|
||||
CL_AddViewWeapon( ps );
|
||||
|
||||
clent = EDICT_NUM( ps->number );
|
||||
clent = EDICT_NUM( cl.playernum + 1 );
|
||||
cl.refdef.iWeaponBits = clent->v.weapons;
|
||||
|
||||
if( cl.refdef.iWeaponBits )
|
||||
Msg( "%li\n", cl.refdef.iWeaponBits );
|
||||
|
||||
cls.dllFuncs.pfnUpdateClientData( &cl.refdef, (cl.time * 0.001f));
|
||||
}
|
||||
|
||||
|
|
|
@ -280,6 +280,9 @@ void CL_FreeEdicts( void )
|
|||
if( ent->free ) continue;
|
||||
CL_FreeEdict( ent );
|
||||
}
|
||||
|
||||
// clear globals
|
||||
StringTable_Clear( clgame.hStringTable );
|
||||
clgame.numEntities = 0;
|
||||
}
|
||||
|
||||
|
@ -326,7 +329,6 @@ shader_t pfnLoadShader( const char *szShaderName )
|
|||
MsgDev( D_ERROR, "CL_LoadShader: invalid shadername\n" );
|
||||
return -1;
|
||||
}
|
||||
|
||||
return re->RegisterShader( szShaderName, SHADER_NOMIP );
|
||||
}
|
||||
|
||||
|
@ -553,25 +555,6 @@ char *pfnCmdArgv( int argc )
|
|||
return "";
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnAlertMessage
|
||||
|
||||
=============
|
||||
*/
|
||||
static void pfnAlertMessage( ALERT_TYPE type, char *szFmt, ... )
|
||||
{
|
||||
char buffer[2048]; // must support > 1k messages
|
||||
va_list args;
|
||||
|
||||
va_start( args, szFmt );
|
||||
com.vsnprintf( buffer, 2048, szFmt, args );
|
||||
va_end( args );
|
||||
|
||||
// FIXME: implement message filter
|
||||
com.print( buffer );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnPlaySoundByName
|
||||
|
@ -1015,8 +998,7 @@ bool CL_LoadProgs( const char *name )
|
|||
}
|
||||
|
||||
// 65535 unique strings should be enough ...
|
||||
clgame.hStringTable = StringTable_Create( "Client Strings", 0x10000 );
|
||||
StringTable_SetString( clgame.hStringTable, "" ); // make NULL string
|
||||
clgame.hStringTable = StringTable_Create( "Client", 0x10000 );
|
||||
clgame.maxEntities = host.max_edicts; // FIXME: must come from CS_MAXENTITIES
|
||||
clgame.maxClients = Host_MaxClients();
|
||||
cls.edicts = Mem_Alloc( cls.mempool, sizeof( edict_t ) * clgame.maxEntities );
|
||||
|
|
|
@ -472,11 +472,6 @@ edict_t *CL_AllocEdict( void );
|
|||
void CL_FreeEdict( edict_t *pEdict );
|
||||
string_t CL_AllocString( const char *szValue );
|
||||
const char *CL_GetString( string_t iString );
|
||||
void pfnGetGameDir( char *szGetGameDir );
|
||||
long pfnRandomLong( long lLow, long lHigh );
|
||||
float pfnRandomFloat( float flLow, float flHigh );
|
||||
byte* pfnLoadFile( const char *filename, int *pLength );
|
||||
int pfnFileExists( const char *filename );
|
||||
|
||||
_inline edict_t *CL_EDICT_NUM( int n, const char *file, const int line )
|
||||
{
|
||||
|
|
|
@ -143,6 +143,13 @@ PRVM INTERACTIONS
|
|||
|
||||
==============================================================
|
||||
*/
|
||||
byte* pfnLoadFile( const char *filename, int *pLength );
|
||||
int pfnFileExists( const char *filename );
|
||||
long pfnRandomLong( long lLow, long lHigh );
|
||||
float pfnRandomFloat( float flLow, float flHigh );
|
||||
void pfnAlertMessage( ALERT_TYPE level, char *szFmt, ... );
|
||||
void pfnGetGameDir( char *szGetGameDir );
|
||||
|
||||
char *ED_NewString( const char *string, byte *mempool );
|
||||
#define prog vm->prog // global callback to vprogs.dll
|
||||
#define PRVM_EDICT_NUM( num ) _PRVM_EDICT_NUM( num, __FILE__, __LINE__ )
|
||||
|
|
|
@ -20,17 +20,6 @@ byte* pfnLoadFile( const char *filename, int *pLength )
|
|||
return FS_LoadFile( filename, pLength );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnFreeFile
|
||||
|
||||
=============
|
||||
*/
|
||||
void pfnFreeFile( void *buffer )
|
||||
{
|
||||
if( buffer ) Mem_Free( buffer );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnFileExists
|
||||
|
@ -64,6 +53,45 @@ float pfnRandomFloat( float flLow, float flHigh )
|
|||
return Com_RandomFloat( flLow, flHigh );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnAlertMessage
|
||||
|
||||
=============
|
||||
*/
|
||||
void pfnAlertMessage( ALERT_TYPE level, char *szFmt, ... )
|
||||
{
|
||||
char buffer[2048]; // must support > 1k messages
|
||||
va_list args;
|
||||
|
||||
va_start( args, szFmt );
|
||||
com.vsnprintf( buffer, 2048, szFmt, args );
|
||||
va_end( args );
|
||||
|
||||
if( host.developer < level )
|
||||
return;
|
||||
|
||||
switch( level )
|
||||
{
|
||||
case at_console:
|
||||
com.print( buffer );
|
||||
break;
|
||||
case at_warning:
|
||||
com.print( va("^3Warning:^7 %s", buffer ));
|
||||
break;
|
||||
case at_error:
|
||||
com.print( va("^1Error:^7 %s", buffer ));
|
||||
break;
|
||||
case at_loading:
|
||||
com.print( va("^2Loading:^7 %s", buffer ));
|
||||
break;
|
||||
case at_aiconsole:
|
||||
case at_logged:
|
||||
com.print( buffer );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnGetGameDir
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
static net_field_t ent_fields[] =
|
||||
{
|
||||
{ ES_FIELD(ed_type), NET_BYTE, false }, // stateflags_t #0 (4 bytes)
|
||||
{ ES_FIELD(ed_type), NET_CHAR, false }, // stateflags_t #0 (4 bytes)
|
||||
{ ES_FIELD(classname), NET_WORD, false },
|
||||
{ ES_FIELD(soundindex), NET_WORD, false }, // 512 sounds ( OpenAL software limit is 255 )
|
||||
{ ES_FIELD(origin[0]), NET_FLOAT, false },
|
||||
|
@ -92,8 +92,7 @@ static net_field_t ent_fields[] =
|
|||
{ ES_FIELD(viewoffset[2]), NET_SCALE, false },
|
||||
{ ES_FIELD(maxspeed), NET_WORD, false },
|
||||
{ ES_FIELD(fov), NET_FLOAT, false }, // client horizontal field of view
|
||||
{ ES_FIELD(weapon1), NET_LONG, false }, // client weapon 0-32
|
||||
{ ES_FIELD(weapon2), NET_LONG, false }, // client weapon 32-64
|
||||
{ ES_FIELD(weapons), NET_LONG, false }, // client weapon 0-32
|
||||
{ ES_FIELD(health), NET_FLOAT, false }, // client health
|
||||
// reserve for 10-11 fields without enlarge null_msg_size
|
||||
{ NULL }, // terminator
|
||||
|
@ -281,7 +280,7 @@ void _MSG_WriteBits( sizebuf_t *msg, int value, const char *name, int net_type,
|
|||
if( value < NWDesc[net_type].min_range || value > NWDesc[net_type].max_range )
|
||||
{
|
||||
MsgDev( D_INFO, "MSG_Write%s: ", NWDesc[net_type].name );
|
||||
if( name ) MsgDev( D_INFO, "variable '%s' ", name );
|
||||
if( name ) MsgDev( D_INFO, "'%s' ", name );
|
||||
MsgDev( D_INFO, "range error %i should be in range (%i", value, NWDesc[net_type].min_range );
|
||||
MsgDev( D_INFO, " %i)(called at %s:%i)\n", NWDesc[net_type].max_range, filename, fileline );
|
||||
}
|
||||
|
|
|
@ -200,6 +200,7 @@ typedef struct
|
|||
typedef struct
|
||||
{
|
||||
// user messages stuff
|
||||
const char *msg_name; // just for debug
|
||||
int msg_sizes[MAX_USER_MESSAGES]; // user messages bounds checker
|
||||
int msg_size_index; // write message size at this pos in sizebuf
|
||||
int msg_realsize; // left in bytes
|
||||
|
@ -313,7 +314,6 @@ void SV_InitGame (void);
|
|||
void SV_Map( char *levelstring, char *savename );
|
||||
void SV_SpawnServer( const char *server, const char *savename );
|
||||
int SV_FindIndex (const char *name, int start, int end, bool create);
|
||||
void SV_ClassifyEdict( edict_t *ent );
|
||||
|
||||
//
|
||||
// sv_phys.c
|
||||
|
@ -388,11 +388,6 @@ float SV_AngleMod( float ideal, float current, float speed );
|
|||
void SV_SpawnEntities( const char *mapname, script_t *entities );
|
||||
string_t SV_AllocString( const char *szValue );
|
||||
const char *SV_GetString( string_t iString );
|
||||
void pfnGetGameDir( char *szGetGameDir );
|
||||
long pfnRandomLong( long lLow, long lHigh );
|
||||
float pfnRandomFloat( float flLow, float flHigh );
|
||||
byte* pfnLoadFile( const char *filename, int *pLength );
|
||||
void pfnFreeFile( void *buffer );
|
||||
|
||||
_inline edict_t *SV_EDICT_NUM( int n, const char * file, const int line )
|
||||
{
|
||||
|
|
|
@ -122,8 +122,7 @@ void SV_UpdateEntityState( edict_t *ent )
|
|||
// and clear fixangle for the next frame
|
||||
ent->v.fixangle = 0;
|
||||
}
|
||||
ent->pvServerData->s.weapon1 = ent->v.weapons & 0xFFFFFFFF;
|
||||
ent->pvServerData->s.weapon2 = ent->v.weapons>>32;
|
||||
ent->pvServerData->s.weapons = ent->v.weapons;
|
||||
}
|
||||
else if( ent->pvServerData->s.ed_type == ED_AMBIENT )
|
||||
{
|
||||
|
|
|
@ -12,6 +12,31 @@
|
|||
|
||||
#define EOFS( x ) (int)&(((entvars_t *)0)->x)
|
||||
|
||||
const char *ed_name[] =
|
||||
{
|
||||
"unknown",
|
||||
"world",
|
||||
"static",
|
||||
"ambient",
|
||||
"normal",
|
||||
"brush",
|
||||
"player",
|
||||
"monster",
|
||||
"tempent",
|
||||
"beam",
|
||||
"mover",
|
||||
"viewmodel",
|
||||
"item",
|
||||
"ragdoll",
|
||||
"physbody",
|
||||
"trigger",
|
||||
"portal",
|
||||
"missile",
|
||||
"decal",
|
||||
"vehicle",
|
||||
"error",
|
||||
};
|
||||
|
||||
void Sys_FsGetString( file_t *f, char *str )
|
||||
{
|
||||
char ch;
|
||||
|
@ -514,19 +539,21 @@ void SV_SetMassCentre( edict_t *ent )
|
|||
void SV_SetModel( edict_t *ent, const char *name )
|
||||
{
|
||||
int i;
|
||||
cmodel_t *mod;
|
||||
vec3_t angles;
|
||||
|
||||
i = SV_ModelIndex( name );
|
||||
if( i == 0 ) return;
|
||||
// we can accept configstring as non moveable memory ?
|
||||
|
||||
ent->v.model = MAKE_STRING( sv.configstrings[CS_MODELS+i] );
|
||||
ent->v.modelindex = i;
|
||||
|
||||
mod = pe->RegisterModel( name );
|
||||
if( mod ) SV_SetMinMaxSize( ent, mod->mins, mod->maxs, false );
|
||||
if( !pe->RegisterModel( name )) // precache sv.model
|
||||
MsgDev( D_ERROR, "SV_SetModel: %s not found\n", name );
|
||||
|
||||
switch( (int)ent->v.movetype )
|
||||
// can be changed from qc-code later
|
||||
SV_SetMinMaxSize( ent, vec3_origin, vec3_origin, false );
|
||||
|
||||
switch( ent->v.movetype )
|
||||
{
|
||||
case MOVETYPE_PHYSIC:
|
||||
// FIXME: translate angles correctly
|
||||
|
@ -628,6 +655,7 @@ void SV_InitEdict( edict_t *pEdict )
|
|||
pEdict->pvServerData = (sv_priv_t *)Mem_Alloc( svgame.mempool, sizeof( sv_priv_t ));
|
||||
pEdict->pvPrivateData = NULL; // will be alloced later by pfnAllocPrivateData
|
||||
pEdict->serialnumber = pEdict->pvServerData->s.number = NUM_FOR_EDICT( pEdict );
|
||||
pEdict->pvServerData->s.ed_type = ED_SPAWNED;
|
||||
pEdict->free = false;
|
||||
}
|
||||
|
||||
|
@ -694,6 +722,7 @@ void SV_FreeEdicts( void )
|
|||
}
|
||||
|
||||
// clear globals
|
||||
StringTable_Clear( svgame.hStringTable );
|
||||
svgame.globals->numEntities = 0;
|
||||
svgame.globals->numClients = 0;
|
||||
svgame.globals->mapname = 0;
|
||||
|
@ -1225,7 +1254,7 @@ void pfnVecToAngles( const float *rgflVectorIn, float *rgflVectorOut )
|
|||
=================
|
||||
pfnMoveToOrigin
|
||||
|
||||
FIXME: i'm not sure what is what you want
|
||||
FIXME: i'm not sure what is does what you want
|
||||
=================
|
||||
*/
|
||||
void pfnMoveToOrigin( edict_t *ent, const float *pflGoal, float dist, int iMoveType )
|
||||
|
@ -1310,14 +1339,19 @@ edict_t* pfnFindEntityByString( edict_t *pStartEdict, const char *pszField, cons
|
|||
|
||||
if( !pStartEdict ) e = 0;
|
||||
else e = NUM_FOR_EDICT( pStartEdict );
|
||||
if( !pszValue ) pszValue = "";
|
||||
if( !pszValue || !*pszValue ) return pStartEdict;
|
||||
|
||||
// FIXME: make table with hints
|
||||
if( !com.strcmp( pszField, "classname" ))
|
||||
f = EOFS( classname );
|
||||
else if( !com.strcmp( pszField, "globalname" ))
|
||||
f = EOFS( globalname );
|
||||
else if( !com.strcmp( pszField, "targetname" ))
|
||||
f = EOFS( targetname );
|
||||
else if( !com.strcmp( pszField, "netname" ))
|
||||
f = EOFS( netname );
|
||||
else if( !com.strcmp( pszField, "model" ))
|
||||
f = EOFS( model );
|
||||
else
|
||||
{
|
||||
// FIXME: make cases for all fileds
|
||||
|
@ -1333,10 +1367,7 @@ edict_t* pfnFindEntityByString( edict_t *pStartEdict, const char *pszField, cons
|
|||
t = STRING( *(string_t *)&((byte *)&ed->v)[f] );
|
||||
if( !t ) t = "";
|
||||
if( !com.strcmp( t, pszValue ))
|
||||
{
|
||||
Msg("Find %s [%s]\n", STRING( ed->v.classname ), t );
|
||||
return ed;
|
||||
}
|
||||
}
|
||||
return EDICT_NUM( 0 );
|
||||
}
|
||||
|
@ -1888,34 +1919,13 @@ pfnTraceHull
|
|||
FIXME: replace constant hulls with mins/maxs
|
||||
=================
|
||||
*/
|
||||
void pfnTraceHull( const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr )
|
||||
void pfnTraceHull( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr )
|
||||
{
|
||||
vec3_t mins, maxs;
|
||||
trace_t trace;
|
||||
int move;
|
||||
trace_t trace;
|
||||
int move;
|
||||
|
||||
move = (fNoMonsters) ? MOVE_NOMONSTERS : MOVE_NORMAL;
|
||||
|
||||
switch( hullNumber )
|
||||
{
|
||||
case human_hull:
|
||||
VectorSet( mins, -16, -16, 0 );
|
||||
VectorSet( maxs, 16, 16, 72);
|
||||
break;
|
||||
case large_hull:
|
||||
VectorSet( mins, -32, -32,-32);
|
||||
VectorSet( maxs, 32, 32, 32);
|
||||
break;
|
||||
case head_hull: // ducked
|
||||
VectorSet( mins, -16, -16,-18);
|
||||
VectorSet( maxs, 16, 16, 18);
|
||||
break;
|
||||
case point_hull:
|
||||
default: VectorCopy( vec3_origin, mins );
|
||||
VectorCopy( vec3_origin, maxs );
|
||||
break;
|
||||
}
|
||||
|
||||
if( IS_NAN(v1[0]) || IS_NAN(v1[1]) || IS_NAN(v1[2]) || IS_NAN(v2[0]) || IS_NAN(v1[2]) || IS_NAN(v2[2] ))
|
||||
Host_Error( "SV_TraceHull: NAN errors detected ('%f %f %f', '%f %f %f'\n", v1[0], v1[1], v1[2], v2[0], v2[1], v2[2] );
|
||||
|
||||
|
@ -2134,6 +2144,10 @@ void pfnMessageBegin( int msg_dest, int msg_type, const float *pOrigin, edict_t
|
|||
// reduce number to avoid overflow problems or cheating
|
||||
svgame.msg_index = bound( svc_bad, msg_type, svc_nop );
|
||||
|
||||
if( svgame.msg_index >= 0 && svgame.msg_index < MAX_USER_MESSAGES )
|
||||
svgame.msg_name = sv.configstrings[CS_USER_MESSAGES + svgame.msg_index];
|
||||
else svgame.msg_name = NULL;
|
||||
|
||||
MSG_Begin( svgame.msg_index );
|
||||
|
||||
// save message destination
|
||||
|
@ -2161,11 +2175,10 @@ pfnMessageEnd
|
|||
*/
|
||||
void pfnMessageEnd( void )
|
||||
{
|
||||
const char *name = "Unknown"; // error case
|
||||
const char *name = "Unknown";
|
||||
|
||||
if( svgame.msg_name ) name = svgame.msg_name;
|
||||
|
||||
if( svgame.msg_index >= 0 && svgame.msg_index < MAX_USER_MESSAGES )
|
||||
name = sv.configstrings[CS_USER_MESSAGES + svgame.msg_index];
|
||||
|
||||
if( svgame.msg_sizes[svgame.msg_index] != -1 )
|
||||
{
|
||||
int expsize = svgame.msg_sizes[svgame.msg_index];
|
||||
|
@ -2210,7 +2223,8 @@ pfnWriteByte
|
|||
*/
|
||||
void pfnWriteByte( int iValue )
|
||||
{
|
||||
MSG_WriteByte( &sv.multicast, (int)iValue );
|
||||
if( iValue == -1 ) iValue = 0xFF; // convert char to byte
|
||||
_MSG_WriteBits( &sv.multicast, (int)iValue, svgame.msg_name, NET_BYTE, __FILE__, __LINE__ );
|
||||
svgame.msg_realsize++;
|
||||
}
|
||||
|
||||
|
@ -2222,7 +2236,7 @@ pfnWriteChar
|
|||
*/
|
||||
void pfnWriteChar( int iValue )
|
||||
{
|
||||
MSG_WriteChar( &sv.multicast, (int)iValue );
|
||||
_MSG_WriteBits( &sv.multicast, (int)iValue, svgame.msg_name, NET_CHAR, __FILE__, __LINE__ );
|
||||
svgame.msg_realsize++;
|
||||
}
|
||||
|
||||
|
@ -2234,7 +2248,7 @@ pfnWriteShort
|
|||
*/
|
||||
void pfnWriteShort( int iValue )
|
||||
{
|
||||
MSG_WriteShort( &sv.multicast, (int)iValue );
|
||||
_MSG_WriteBits( &sv.multicast, (int)iValue, svgame.msg_name, NET_SHORT, __FILE__, __LINE__ );
|
||||
svgame.msg_realsize += 2;
|
||||
}
|
||||
|
||||
|
@ -2246,7 +2260,7 @@ pfnWriteLong
|
|||
*/
|
||||
void pfnWriteLong( int iValue )
|
||||
{
|
||||
MSG_WriteLong( &sv.multicast, (int)iValue );
|
||||
_MSG_WriteBits( &sv.multicast, (int)iValue, svgame.msg_name, NET_LONG, __FILE__, __LINE__ );
|
||||
svgame.msg_realsize += 4;
|
||||
}
|
||||
|
||||
|
@ -2258,7 +2272,7 @@ pfnWriteAngle
|
|||
*/
|
||||
void pfnWriteAngle( float flValue )
|
||||
{
|
||||
MSG_WriteAngle32( &sv.multicast, flValue );
|
||||
_MSG_WriteBits( &sv.multicast, flValue, svgame.msg_name, NET_ANGLE, __FILE__, __LINE__ );
|
||||
svgame.msg_realsize += 4;
|
||||
}
|
||||
|
||||
|
@ -2270,7 +2284,7 @@ pfnWriteCoord
|
|||
*/
|
||||
void pfnWriteCoord( float flValue )
|
||||
{
|
||||
MSG_WriteCoord32( &sv.multicast, flValue );
|
||||
_MSG_WriteBits( &sv.multicast, flValue, svgame.msg_name, NET_FLOAT, __FILE__, __LINE__ );
|
||||
svgame.msg_realsize += 4;
|
||||
}
|
||||
|
||||
|
@ -2374,25 +2388,6 @@ void pfnCVarSetString( const char *szVarName, const char *szValue )
|
|||
Cvar_Set( szVarName, szValue );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnAlertMessage
|
||||
|
||||
=============
|
||||
*/
|
||||
static void pfnAlertMessage( ALERT_TYPE level, char *szFmt, ... )
|
||||
{
|
||||
char buffer[2048]; // must support > 1k messages
|
||||
va_list args;
|
||||
|
||||
va_start( args, szFmt );
|
||||
com.vsnprintf( buffer, 2048, szFmt, args );
|
||||
va_end( args );
|
||||
|
||||
// FIXME: implement message filter
|
||||
com.print( buffer );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnPvAllocEntPrivateData
|
||||
|
@ -2659,6 +2654,28 @@ void pfnAreaPortal( edict_t *pEdict, bool enable )
|
|||
pe->SetAreaPortalState( pEdict->v.skin, enable );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnClassifyEdict
|
||||
|
||||
classify edict for render and network usage
|
||||
=============
|
||||
*/
|
||||
void pfnClassifyEdict( edict_t *pEdict, int class )
|
||||
{
|
||||
if( pEdict->free )
|
||||
{
|
||||
MsgDev( D_ERROR, "SV_ClassifyEdict: can't modify free entity\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( !pEdict->pvServerData ) return;
|
||||
pEdict->pvServerData->s.ed_type = class;
|
||||
|
||||
// or leave unclassified, wait for next SV_LinkEdict...
|
||||
Msg( "%s: <%s>\n", STRING( pEdict->v.classname ), ed_name[class] );
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
pfnCmd_Args
|
||||
|
@ -3034,6 +3051,7 @@ static enginefuncs_t gEngfuncs =
|
|||
pfnNameForFunction,
|
||||
pfnServerPrint,
|
||||
pfnAreaPortal,
|
||||
pfnClassifyEdict,
|
||||
pfnCmd_Args,
|
||||
pfnCmd_Argv,
|
||||
pfnCmd_Argc,
|
||||
|
@ -3046,7 +3064,7 @@ static enginefuncs_t gEngfuncs =
|
|||
pfnSetView,
|
||||
pfnCrosshairAngle,
|
||||
pfnLoadFile,
|
||||
pfnFreeFile,
|
||||
pfnFileExists,
|
||||
pfnCompareFileTime,
|
||||
pfnGetGameDir,
|
||||
pfnStaticDecal,
|
||||
|
@ -3115,23 +3133,27 @@ bool SV_ParseEdict( script_t *script, edict_t *ent )
|
|||
classname = pkvd[numpairs].szValue;
|
||||
if( ++numpairs >= 256 ) break;
|
||||
}
|
||||
|
||||
|
||||
// allocate edict private memory (passed by dlls)
|
||||
SpawnEdict = (LINK_ENTITY_FUNC)Com_GetProcAddress( svgame.hInstance, classname );
|
||||
if( !SpawnEdict )
|
||||
{
|
||||
MsgDev( D_ERROR, "No spawn function for %s\n", classname );
|
||||
Mem_FreePool( &tempstr );
|
||||
return false;
|
||||
// attempt to create custom entity
|
||||
if( svgame.dllFuncs.pfnCreate( ent, classname ) == -1 )
|
||||
{
|
||||
MsgDev( D_ERROR, "No spawn function for %s\n", classname );
|
||||
Mem_FreePool( &tempstr );
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ent->v.classname = MAKE_STRING( classname );
|
||||
SpawnEdict( &ent->v );
|
||||
}
|
||||
|
||||
// apply edict classnames
|
||||
ent->pvServerData->s.classname = SV_ClassIndex( classname );
|
||||
ent->v.classname = MAKE_STRING( classname );
|
||||
|
||||
SpawnEdict( &ent->v );
|
||||
|
||||
// apply classname to keyvalue containers and parse fields
|
||||
ent->pvServerData->s.classname = SV_ClassIndex( classname );
|
||||
for( i = 0; i < numpairs; i++ )
|
||||
{
|
||||
if( pkvd[i].fHandled ) continue;
|
||||
|
@ -3303,8 +3325,7 @@ void SV_LoadProgs( const char *name )
|
|||
}
|
||||
|
||||
// 65535 unique strings should be enough ...
|
||||
svgame.hStringTable = StringTable_Create( "Game Strings", 0x10000 );
|
||||
StringTable_SetString( svgame.hStringTable, "" ); // make NULL string
|
||||
svgame.hStringTable = StringTable_Create( "Server", 0x10000 );
|
||||
svgame.globals->maxEntities = host.max_edicts;
|
||||
svgame.globals->maxClients = Host_MaxClients();
|
||||
svgame.edicts = Mem_Alloc( svgame.mempool, sizeof( edict_t ) * svgame.globals->maxEntities );
|
||||
|
|
|
@ -150,7 +150,7 @@ void SV_SpawnServer( const char *server, const char *savename )
|
|||
{
|
||||
uint i, checksum;
|
||||
|
||||
Msg("SpawnServer [%s]\n", server );
|
||||
Msg( "SpawnServer [%s]\n", server );
|
||||
|
||||
svs.spawncount++; // any partially connected client will be restarted
|
||||
sv.state = ss_dead;
|
||||
|
@ -163,7 +163,7 @@ void SV_SpawnServer( const char *server, const char *savename )
|
|||
|
||||
// save name for levels that don't set message
|
||||
com.strncpy( sv.configstrings[CS_NAME], server, CS_SIZE );
|
||||
MSG_Init( &sv.multicast, sv.multicast_buf, sizeof(sv.multicast_buf));
|
||||
MSG_Init( &sv.multicast, sv.multicast_buf, sizeof( sv.multicast_buf ));
|
||||
com.strcpy( sv.name, server );
|
||||
|
||||
// leave slots at start for clients only
|
||||
|
@ -225,13 +225,6 @@ void SV_SpawnServer( const char *server, const char *savename )
|
|||
// create a baseline for more efficient communications
|
||||
SV_CreateBaseline();
|
||||
|
||||
// classify edicts for quick network sorting
|
||||
for( i = 0; i < svgame.globals->numEntities; i++ )
|
||||
{
|
||||
edict_t *ent = EDICT_NUM( i );
|
||||
SV_ClassifyEdict( ent );
|
||||
}
|
||||
|
||||
// set serverinfo variable
|
||||
Cvar_FullSet( "mapname", sv.name, CVAR_SERVERINFO|CVAR_INIT );
|
||||
pe->EndRegistration(); // free unused models
|
||||
|
|
|
@ -459,5 +459,4 @@ void SV_Shutdown( bool reconnect )
|
|||
if( svs.baselines ) Mem_Free( svs.baselines );
|
||||
if( svs.client_entities ) Mem_Free( svs.client_entities );
|
||||
Mem_Set( &svs, 0, sizeof( svs ));
|
||||
}
|
||||
|
||||
}
|
|
@ -39,31 +39,6 @@ typedef struct area_s
|
|||
int type;
|
||||
} area_t;
|
||||
|
||||
const char *ed_name[] =
|
||||
{
|
||||
"unknown",
|
||||
"world",
|
||||
"static",
|
||||
"ambient",
|
||||
"normal",
|
||||
"brush",
|
||||
"player",
|
||||
"monster",
|
||||
"tempent",
|
||||
"beam",
|
||||
"mover",
|
||||
"viewmodel",
|
||||
"item",
|
||||
"ragdoll",
|
||||
"physbody",
|
||||
"trigger",
|
||||
"portal",
|
||||
"missile",
|
||||
"decal",
|
||||
"vehicle",
|
||||
"error",
|
||||
};
|
||||
|
||||
areanode_t sv_areanodes[AREA_NODES];
|
||||
int sv_numareanodes;
|
||||
|
||||
|
@ -167,74 +142,6 @@ void SV_ClearWorld( void )
|
|||
SV_CreateAreaNode( 0, world->mins, world->maxs );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SV_ClassifyEdict
|
||||
|
||||
sorting edict by type
|
||||
=================
|
||||
*/
|
||||
void SV_ClassifyEdict( edict_t *ent )
|
||||
{
|
||||
sv_priv_t *sv_ent;
|
||||
const char *classname;
|
||||
|
||||
sv_ent = ent->pvServerData;
|
||||
if( !sv_ent || sv_ent->s.ed_type != ED_SPAWNED )
|
||||
return;
|
||||
|
||||
// null state ?
|
||||
if( !sv_ent->s.number ) SV_UpdateEntityState( ent );
|
||||
|
||||
classname = STRING( ent->v.classname );
|
||||
|
||||
if( !com.strnicmp( "worldspawn", classname, 10 ))
|
||||
{
|
||||
sv_ent->s.ed_type = ED_WORLDSPAWN;
|
||||
return;
|
||||
}
|
||||
// first pass: determine type by explicit parms
|
||||
if( ent->v.solid == SOLID_TRIGGER )
|
||||
{
|
||||
if( sv_ent->s.soundindex )
|
||||
sv_ent->s.ed_type = ED_AMBIENT; // e.g. trigger_teleport
|
||||
else sv_ent->s.ed_type = ED_TRIGGER; // never sending to client
|
||||
}
|
||||
else if( ent->v.movetype == MOVETYPE_PHYSIC )
|
||||
sv_ent->s.ed_type = ED_RIGIDBODY;
|
||||
else if( ent->v.solid == SOLID_BSP || VectorIsNull( ent->v.origin ))
|
||||
{
|
||||
if( ent->v.movetype == MOVETYPE_CONVEYOR )
|
||||
sv_ent->s.ed_type = ED_MOVER;
|
||||
else if((int)ent->v.flags & FL_WORLDBRUSH )
|
||||
sv_ent->s.ed_type = ED_BSPBRUSH;
|
||||
else if( ent->v.movetype == MOVETYPE_PUSH )
|
||||
sv_ent->s.ed_type = ED_MOVER;
|
||||
else if( ent->v.movetype == MOVETYPE_NONE )
|
||||
sv_ent->s.ed_type = ED_BSPBRUSH;
|
||||
}
|
||||
else if((int)ent->v.flags & FL_MONSTER )
|
||||
sv_ent->s.ed_type = ED_MONSTER;
|
||||
else if((int)ent->v.flags & FL_CLIENT )
|
||||
sv_ent->s.ed_type = ED_CLIENT;
|
||||
else if( !sv_ent->s.model.index && !sv_ent->s.aiment )
|
||||
{
|
||||
if( sv_ent->s.soundindex )
|
||||
sv_ent->s.ed_type = ED_AMBIENT;
|
||||
else sv_ent->s.ed_type = ED_STATIC; // never sending to client
|
||||
}
|
||||
|
||||
if( sv_ent->s.ed_type == ED_SPAWNED )
|
||||
{
|
||||
// mark as normal
|
||||
if( sv_ent->s.model.index || sv_ent->s.soundindex )
|
||||
sv_ent->s.ed_type = ED_NORMAL;
|
||||
}
|
||||
|
||||
// or leave unclassified, wait for next SV_LinkEdict...
|
||||
// Msg( "%s: <%s>\n", STRING( ent->v.classname ), ed_name[sv_ent->s.ed_type] );
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
SV_UnlinkEdict
|
||||
|
@ -271,10 +178,6 @@ void SV_LinkEdict( edict_t *ent )
|
|||
if( ent == EDICT_NUM( 0 )) return; // don't add the world
|
||||
if( ent->free ) return;
|
||||
|
||||
// trying to classify unclassified edicts
|
||||
if( sv.state == ss_active && sv_ent->s.ed_type == ED_SPAWNED )
|
||||
SV_ClassifyEdict( ent );
|
||||
|
||||
// set the size
|
||||
VectorSubtract( ent->v.maxs, ent->v.mins, ent->v.size );
|
||||
|
||||
|
@ -302,32 +205,7 @@ void SV_LinkEdict( edict_t *ent )
|
|||
else sv_ent->solid = 0;
|
||||
|
||||
// set the abs box
|
||||
if( ent->v.solid == SOLID_BSP && !VectorIsNull( ent->v.angles ))
|
||||
{
|
||||
// expand for rotation
|
||||
int i;
|
||||
float max = RadiusFromBounds( ent->v.mins, ent->v.maxs );
|
||||
|
||||
for( i = 0; i < 3; i++ )
|
||||
{
|
||||
ent->v.absmin[i] = ent->v.origin[i] - max;
|
||||
ent->v.absmax[i] = ent->v.origin[i] + max;
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // normal
|
||||
VectorAdd( ent->v.origin, ent->v.mins, ent->v.absmin );
|
||||
VectorAdd( ent->v.origin, ent->v.maxs, ent->v.absmax );
|
||||
}
|
||||
|
||||
// because movement is clipped an epsilon away from an actual edge,
|
||||
// we must fully check even when bounding boxes don't quite touch
|
||||
ent->v.absmin[0] -= 1;
|
||||
ent->v.absmin[1] -= 1;
|
||||
ent->v.absmin[2] -= 1;
|
||||
ent->v.absmax[0] += 1;
|
||||
ent->v.absmax[1] += 1;
|
||||
ent->v.absmax[2] += 1;
|
||||
svgame.dllFuncs.pfnSetAbsBox( ent );
|
||||
|
||||
// link to PVS leafs
|
||||
sv_ent->num_clusters = 0;
|
||||
|
|
|
@ -67,7 +67,6 @@ typedef struct system_s
|
|||
bool con_showcredits;
|
||||
bool con_silentmode;
|
||||
byte *basepool;
|
||||
byte *zonepool;
|
||||
byte *imagepool;
|
||||
byte *scriptpool;
|
||||
byte *stringpool;
|
||||
|
@ -511,5 +510,7 @@ const char *StringTable_GetString( int handle, string_t index );
|
|||
int StringTable_LoadSystem( wfile_t *wad, const char *name );
|
||||
bool StringTable_SaveSystem( int h, wfile_t *wad );
|
||||
void StringTable_DeleteSystem( int handle );
|
||||
void StringTable_ClearSystem( int handle );
|
||||
void StringTable_Info_f( void );
|
||||
|
||||
#endif//LAUNCHER_H
|
|
@ -1431,7 +1431,7 @@ void MemList_f( void )
|
|||
_mem_printstats();
|
||||
break;
|
||||
default:
|
||||
Msg("memlist: usage: memlist <all>\n");
|
||||
Msg( "Usage: memlist <all>\n" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1459,4 +1459,5 @@ void Memory_Shutdown( void )
|
|||
void Memory_Init_Commands( void )
|
||||
{
|
||||
Cmd_AddCommand( "memlist", MemList_f, "prints memory pool information (or if used as memlist 5 lists individual allocations of 5K or larger, 0 lists all allocations)");
|
||||
Cmd_AddCommand( "stinfo", StringTable_Info_f, "prints StringTable system names or contained strings" );
|
||||
}
|
|
@ -253,6 +253,7 @@ void Sys_GetStdAPI( void )
|
|||
com.st_setstring = StringTable_SetString;
|
||||
com.st_load = StringTable_LoadSystem;
|
||||
com.st_save = StringTable_SaveSystem;
|
||||
com.st_clear = StringTable_ClearSystem;
|
||||
com.st_remove = StringTable_DeleteSystem;
|
||||
|
||||
com.GameInfo = &GI;
|
||||
|
|
|
@ -224,11 +224,12 @@ float sse_sqrt( float x )
|
|||
}
|
||||
|
||||
|
||||
#define MAX_STRINGTABLE_SYSTEMS 8 // separately stringsystems
|
||||
#define MAX_STRINGTABLE_SYSTEMS 8 // seperately stringsystems
|
||||
|
||||
typedef struct stringtable_s
|
||||
{
|
||||
string name; // system name (for debug purposes)
|
||||
byte *mempool; // system mempool
|
||||
char *data; // buffer with strings
|
||||
size_t datasize; // current buffsize
|
||||
size_t maxdatasize; // dynamically resized
|
||||
|
@ -278,9 +279,12 @@ int StringTable_CreateNewSystem( const char *name, size_t max_strings )
|
|||
if( !dstring[i] )
|
||||
{
|
||||
// found free slot
|
||||
dstring[i] = Mem_Alloc( Sys.stringpool, sizeof( stringtable_t ));
|
||||
dstring[i] = Mem_Alloc( Sys.basepool, sizeof( stringtable_t ));
|
||||
dstring[i]->mempool = Mem_AllocPool( va( "StringTable_%s", name ));
|
||||
com.strncpy( dstring[i]->name, name, MAX_STRING );
|
||||
dstring[i]->maxstrings = max_strings;
|
||||
|
||||
StringTable_SetString( i, "" ); // make iNullString
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -291,16 +295,28 @@ int StringTable_CreateNewSystem( const char *name, size_t max_strings )
|
|||
|
||||
void StringTable_DeleteSystem( int handle )
|
||||
{
|
||||
if(!StringTable_CheckHandle( handle ))
|
||||
if( !StringTable_CheckHandle( handle ))
|
||||
return;
|
||||
|
||||
// now free stringtable
|
||||
Mem_Free( dstring[handle]->data ); // free strings
|
||||
Mem_Free( dstring[handle]->table); // free indices
|
||||
Mem_Free( dstring[handle] ); // free himself
|
||||
Mem_FreePool( &dstring[handle]->mempool );
|
||||
Mem_Free( dstring[handle] ); // free himself
|
||||
dstring[handle] = NULL;
|
||||
}
|
||||
|
||||
void StringTable_ClearSystem( int handle )
|
||||
{
|
||||
if( !StringTable_CheckHandle( handle ))
|
||||
return;
|
||||
|
||||
Mem_EmptyPool( dstring[handle]->mempool );
|
||||
dstring[handle]->datasize = dstring[handle]->numstrings = 0;
|
||||
dstring[handle]->table = NULL;
|
||||
dstring[handle]->data = NULL;
|
||||
|
||||
StringTable_SetString( handle, "" ); // make iNullString
|
||||
}
|
||||
|
||||
const char *StringTable_GetString( int handle, string_t index )
|
||||
{
|
||||
if(!StringTable_CheckString( handle, index )) return "";
|
||||
|
@ -311,7 +327,7 @@ string_t StringTable_SetString( int handle, const char *string )
|
|||
{
|
||||
int i, len, table_size, data_size;
|
||||
|
||||
if(!StringTable_CheckHandle( handle ))
|
||||
if( !StringTable_CheckHandle( handle ))
|
||||
return -1;
|
||||
|
||||
for( i = 0; i < dstring[handle]->numstrings; i++ )
|
||||
|
@ -331,8 +347,8 @@ string_t StringTable_SetString( int handle, const char *string )
|
|||
return -1;
|
||||
}
|
||||
|
||||
dstring[handle]->table = Mem_Realloc( Sys.stringpool, dstring[handle]->table, table_size );
|
||||
dstring[handle]->data = Mem_Realloc( Sys.stringpool, dstring[handle]->data, data_size );
|
||||
dstring[handle]->table = Mem_Realloc( dstring[handle]->mempool, dstring[handle]->table, table_size );
|
||||
dstring[handle]->data = Mem_Realloc( dstring[handle]->mempool, dstring[handle]->data, data_size );
|
||||
|
||||
com.strcpy( &dstring[handle]->data[dstring[handle]->datasize], string );
|
||||
dstring[handle]->table[dstring[handle]->numstrings] = dstring[handle]->datasize;
|
||||
|
@ -368,4 +384,39 @@ int StringTable_LoadSystem( wfile_t *wad, const char *name )
|
|||
dstring[h]->datasize = datasize;
|
||||
dstring[h]->numstrings = numstrings / sizeof(int);
|
||||
return h;
|
||||
}
|
||||
|
||||
void StringTable_Info_f( void )
|
||||
{
|
||||
int i, j;
|
||||
|
||||
switch(Cmd_Argc( ))
|
||||
{
|
||||
case 1:
|
||||
// display list of all actuve StringTable Systems
|
||||
for( i = 0; i < MAX_STRINGTABLE_SYSTEMS; i++ )
|
||||
{
|
||||
if( dstring[i] ) Msg( "%s\n", dstring[i]->name );
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
// print all symbols in selected StringTable
|
||||
for( i = 0; i < MAX_STRINGTABLE_SYSTEMS; i++ )
|
||||
{
|
||||
if( dstring[i] )
|
||||
{
|
||||
if( !com.stricmp( dstring[i]->name, Cmd_Argv( 1 )))
|
||||
{
|
||||
for( j = 0; j < dstring[i]->numstrings; j++ )
|
||||
Msg( "%s ", StringTable_GetString( i, j ));
|
||||
Msg( "\n" );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
Msg( "Usage: stinfo <name>\n" );
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -120,8 +120,8 @@ typedef struct ref_params_s
|
|||
BOOL spectator;
|
||||
BOOL paused;
|
||||
uint rdflags; // client view effects: RDF_UNDERWATER, RDF_MOTIONBLUR, etc
|
||||
qword iWeaponBits; // pev->weapon
|
||||
dword iKeyBits; // pev->button
|
||||
int iWeaponBits; // pev->weapon
|
||||
int iKeyBits; // pev->button
|
||||
edict_t *onground; // pointer to onground entity
|
||||
byte *areabits; // come from server, contains visible areas list
|
||||
int waterlevel;
|
||||
|
|
|
@ -78,8 +78,7 @@ typedef struct entity_state_s
|
|||
int maxspeed; // sv_maxspeed will be duplicate on all clients
|
||||
float health; // client health (other parms can be send by custom messages)
|
||||
float fov; // horizontal field of view
|
||||
int weapon1; // weapon lowbytes
|
||||
int weapon2; // weapon highbytes
|
||||
int weapons; // weapon flags
|
||||
model_state_t pmodel; // weaponmodel info
|
||||
} entity_state_t;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ typedef struct entvars_s
|
|||
|
||||
float health;
|
||||
float frags;
|
||||
qword weapons; // bit mask for available weapons
|
||||
int weapons; // bit mask for available weapons
|
||||
float takedamage;
|
||||
|
||||
int deadflag;
|
||||
|
|
|
@ -635,6 +635,7 @@ typedef struct stdilib_api_s
|
|||
string_t (*st_setstring)( int handle, const char *string );
|
||||
int (*st_load)( wfile_t *wad, const char *name );
|
||||
bool (*st_save)( int h, wfile_t *wad );
|
||||
void (*st_clear)( int handle );
|
||||
void (*st_remove)( int handle );
|
||||
} stdlib_api_t;
|
||||
|
||||
|
@ -892,6 +893,7 @@ misc utils
|
|||
#define Com_RandomFloat com.Com_RandomFloat
|
||||
#define StringTable_Create com.st_create
|
||||
#define StringTable_Delete com.st_remove
|
||||
#define StringTable_Clear com.st_clear
|
||||
#define StringTable_GetString com.st_getstring
|
||||
#define StringTable_SetString com.st_setstring
|
||||
#define StringTable_Load com.st_load
|
||||
|
|
|
@ -119,7 +119,7 @@ typedef struct enginefuncs_s
|
|||
void (*pfnEmitAmbientSound)( edict_t *ent, float *pos, const char *samp, float vol, float attn, int flags, int pitch );
|
||||
void (*pfnTraceLine)( const float *v1, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
|
||||
void (*pfnTraceToss)( edict_t* pent, edict_t* pentToIgnore, TraceResult *ptr );
|
||||
void (*pfnTraceHull)( const float *v1, const float *v2, int fNoMonsters, int hullNumber, edict_t *pentToSkip, TraceResult *ptr );
|
||||
void (*pfnTraceHull)( const float *v1, const float *mins, const float *maxs, const float *v2, int fNoMonsters, edict_t *pentToSkip, TraceResult *ptr );
|
||||
void (*pfnTraceModel)( const float *v1, const float *v2, edict_t *pent, TraceResult *ptr );
|
||||
const char *(*pfnTraceTexture)( edict_t *pTextureEntity, const float *v1, const float *v2 );
|
||||
void (*pfnGetAimVector)( edict_t* ent, float speed, float *rgflReturn );
|
||||
|
@ -164,6 +164,7 @@ typedef struct enginefuncs_s
|
|||
const char *(*pfnNameForFunction)( dword function );
|
||||
void (*pfnServerPrint)( const char *szMsg );
|
||||
void (*pfnAreaPortal)( edict_t *pEdict, BOOL enable );
|
||||
void (*pfnClassifyEdict)( edict_t *pEdict, int ed_type );
|
||||
const char *(*pfnCmd_Args)( void );
|
||||
const char *(*pfnCmd_Argv)( int argc );
|
||||
int (*pfnCmd_Argc)( void );
|
||||
|
@ -176,7 +177,7 @@ typedef struct enginefuncs_s
|
|||
void (*pfnSetView)( const edict_t *pClient, const edict_t *pViewent );
|
||||
void (*pfnCrosshairAngle)( const edict_t *pClient, float pitch, float yaw );
|
||||
byte* (*pfnLoadFile)( const char *filename, int *pLength );
|
||||
void (*pfnFreeFile)( void *buffer );
|
||||
int (*pfnFileExists)( const char *filename );
|
||||
int (*pfnCompareFileTime)( const char *filename1, const char *filename2, int *iCompare );
|
||||
void (*pfnGetGameDir)( char *szGetGameDir );
|
||||
void (*pfnStaticDecal)( const float *origin, int decalIndex, int entityIndex, int modelIndex );
|
||||
|
@ -306,6 +307,7 @@ typedef struct
|
|||
// initialize/shutdown the game (one-time call after loading of game .dll )
|
||||
void (*pfnGameInit)( void );
|
||||
int (*pfnSpawn)( edict_t *pent );
|
||||
int (*pfnCreate)( edict_t *pent, const char *szName );
|
||||
void (*pfnThink)( edict_t *pent );
|
||||
void (*pfnUse)( edict_t *pentUsed, edict_t *pentOther );
|
||||
void (*pfnTouch)( edict_t *pentTouched, edict_t *pentOther );
|
||||
|
|
|
@ -316,8 +316,8 @@ void R_StudioGetSequenceInfo( dstudiohdr_t *hdr, ref_entity_t *ent, float *pflFr
|
|||
|
||||
if( ent->sequence >= hdr->numseq )
|
||||
{
|
||||
*pflFrameRate = 0.0;
|
||||
*pflGroundSpeed = 0.0;
|
||||
if( pflFrameRate ) *pflFrameRate = 0.0;
|
||||
if( pflGroundSpeed ) *pflGroundSpeed = 0.0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -325,14 +325,17 @@ void R_StudioGetSequenceInfo( dstudiohdr_t *hdr, ref_entity_t *ent, float *pflFr
|
|||
|
||||
if( pseqdesc->numframes > 1 )
|
||||
{
|
||||
*pflFrameRate = 256 * pseqdesc->fps / (pseqdesc->numframes - 1);
|
||||
*pflGroundSpeed = VectorLength( pseqdesc->linearmovement );
|
||||
*pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1);
|
||||
if( pflFrameRate ) *pflFrameRate = 256 * pseqdesc->fps / (pseqdesc->numframes - 1);
|
||||
if( pflGroundSpeed )
|
||||
{
|
||||
*pflGroundSpeed = VectorLength( pseqdesc->linearmovement );
|
||||
*pflGroundSpeed = *pflGroundSpeed * pseqdesc->fps / (pseqdesc->numframes - 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*pflFrameRate = 256.0;
|
||||
*pflGroundSpeed = 0.0;
|
||||
if( pflFrameRate ) *pflFrameRate = 256.0;
|
||||
if( pflGroundSpeed ) *pflGroundSpeed = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -373,6 +376,20 @@ float R_StudioFrameAdvance( ref_entity_t *ent, float framerate, float flInterval
|
|||
return flInterval;
|
||||
}
|
||||
|
||||
void R_StudioResetSequenceInfo( ref_entity_t *ent )
|
||||
{
|
||||
float m_flFrameRate;
|
||||
|
||||
R_StudioGetSequenceInfo( m_pStudioHeader, ent, &m_flFrameRate, NULL );
|
||||
ent->m_fSequenceLoops = ((R_StudioGetSequenceFlags( m_pStudioHeader, ent ) & STUDIO_LOOPING) != 0 );
|
||||
|
||||
// if custom framerate not specified, use default value from studiomodel
|
||||
if( !ent->framerate ) ent->framerate = m_flFrameRate;
|
||||
ent->animtime = r_refdef.time;
|
||||
ent->framerate = 1.0;
|
||||
ent->m_fSequenceFinished = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
StudioCalcBoneAdj
|
||||
|
@ -1733,6 +1750,12 @@ bool R_StudioDrawModel( int pass, int flags )
|
|||
{
|
||||
if( /*mirror_render ||*/ r_lefthand->value == 2 )
|
||||
return 0;
|
||||
|
||||
// viewmodel animate on client
|
||||
R_StudioFrameAdvance( m_pCurrentEntity, 1.0f, 0 );
|
||||
|
||||
if( m_pCurrentEntity->m_fSequenceFinished )
|
||||
R_StudioResetSequenceInfo( m_pCurrentEntity );
|
||||
}
|
||||
|
||||
R_StudioSetupRender( pass );
|
||||
|
|
|
@ -862,6 +862,7 @@ TYPEDESCRIPTION CBaseEntity::m_SaveData[] =
|
|||
DEFINE_FIELD( CBaseEntity, m_fPevNextThink, FIELD_TIME ),
|
||||
|
||||
DEFINE_FIELD( CBaseEntity, m_iStyle, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( CBaseEntity, m_iClassType, FIELD_INTEGER ),
|
||||
DEFINE_FIELD( CBaseEntity, m_iAcessLevel, FIELD_INTEGER ),
|
||||
|
||||
DEFINE_FIELD( CBaseEntity, m_pfnThink, FIELD_FUNCTION ),
|
||||
|
@ -883,20 +884,20 @@ int CBaseEntity::Save( CSave &save )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int CBaseEntity::Restore( CRestore &restore )
|
||||
int CBaseEntity :: Restore( CRestore &restore )
|
||||
{
|
||||
int status;
|
||||
|
||||
status = restore.ReadEntVars( "ENTVARS", pev );
|
||||
if ( status ) status = restore.ReadFields( "BASE", this, m_SaveData, ARRAYSIZE(m_SaveData) );
|
||||
if( status ) status = restore.ReadFields( "BASE", this, m_SaveData, ARRAYSIZE( m_SaveData ));
|
||||
|
||||
if ( pev->modelindex != 0 && !FStringNull(pev->model) )
|
||||
if( pev->modelindex != 0 && !FStringNull( pev->model ))
|
||||
{
|
||||
Vector mins = pev->mins, maxs = pev->maxs; // Set model is about to destroy these
|
||||
|
||||
UTIL_PrecacheModel( pev->model );
|
||||
UTIL_SetModel(ENT(pev), pev->model);
|
||||
UTIL_SetSize(pev, mins, maxs);
|
||||
UTIL_SetModel( ENT( pev ), pev->model );
|
||||
UTIL_SetSize( pev, mins, maxs );
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
|
|
@ -19,9 +19,10 @@ public:
|
|||
|
||||
float m_fNextThink;
|
||||
float m_fPevNextThink;
|
||||
float flTravelTime; //time to moving brushes
|
||||
float flTravelTime; // time to moving brushes
|
||||
int m_iClassType; // edict classtype
|
||||
int m_iStyle;
|
||||
int m_iAcessLevel;//acess level for retinal sacners
|
||||
int m_iAcessLevel;// acess level for retinal sacners
|
||||
|
||||
//===================================================================================================
|
||||
// Xash BaseEntity
|
||||
|
@ -39,12 +40,6 @@ public:
|
|||
virtual void ChangeCamera( string_t newcamera ) {}
|
||||
|
||||
public:
|
||||
unsigned char m_iParentAttachment; // 0 if we're relative to the parent's absorigin and absangles.
|
||||
EHANDLE m_hParent;
|
||||
EHANDLE m_hMoveParent;
|
||||
EHANDLE m_hMoveChild;
|
||||
EHANDLE m_hMovePeer;
|
||||
|
||||
//===================================================================================================
|
||||
// Xash Parent System 0.2 beta
|
||||
//===================================================================================================
|
||||
|
@ -108,7 +103,71 @@ public:
|
|||
virtual void PostActivate( void ) {}
|
||||
virtual void PostSpawn( void ) {}
|
||||
virtual void DesiredAction( void ) {}
|
||||
virtual void StartMessage( CBasePlayer *pPlayer ) {}
|
||||
virtual void StartMessage( CBasePlayer *pPlayer ) {}
|
||||
virtual void SetObjectClass( int iClassType = ED_SPAWNED )
|
||||
{
|
||||
m_iClassType = iClassType;
|
||||
CLASSIFY_EDICT( ENT( pev ), m_iClassType );
|
||||
}
|
||||
|
||||
// auto-classify edict on spawn
|
||||
virtual void ClassifyEdict( void )
|
||||
{
|
||||
// already classified ?
|
||||
if( m_iClassType != ED_SPAWNED ) return;
|
||||
|
||||
if( !strnicmp( "worldspawn", STRING( pev->classname ), 10 ))
|
||||
{
|
||||
SetObjectClass( ED_WORLDSPAWN );
|
||||
return;
|
||||
}
|
||||
|
||||
// first pass: determine type by explicit parms
|
||||
if( !strnicmp( "ambient_", STRING( pev->classname ), 8 ))
|
||||
{
|
||||
SetObjectClass( ED_AMBIENT );
|
||||
return;
|
||||
}
|
||||
else if( pev->solid == SOLID_TRIGGER )
|
||||
{
|
||||
if( pev->modelindex == 0 )
|
||||
SetObjectClass( ED_TRIGGER ); // never sending to client
|
||||
else SetObjectClass( ED_NORMAL );
|
||||
}
|
||||
else if( pev->movetype == MOVETYPE_PHYSIC )
|
||||
{
|
||||
SetObjectClass( ED_RIGIDBODY );
|
||||
}
|
||||
else if( pev->solid == SOLID_BSP || pev->origin == g_vecZero )
|
||||
{
|
||||
if( pev->movetype == MOVETYPE_CONVEYOR )
|
||||
SetObjectClass( ED_MOVER );
|
||||
else if( pev->flags & FL_WORLDBRUSH )
|
||||
SetObjectClass( ED_BSPBRUSH );
|
||||
else if( pev->movetype == MOVETYPE_PUSH )
|
||||
SetObjectClass( ED_MOVER );
|
||||
else if( pev->movetype == MOVETYPE_NONE )
|
||||
SetObjectClass( ED_BSPBRUSH );
|
||||
}
|
||||
else if( pev->flags & FL_MONSTER )
|
||||
SetObjectClass( ED_MONSTER );
|
||||
else if( pev->flags & FL_CLIENT )
|
||||
SetObjectClass( ED_CLIENT );
|
||||
else if( !pev->modelindex && !pev->weaponmodel )
|
||||
{
|
||||
if( pev->noise1 || pev->noise2 || pev->noise3 )
|
||||
SetObjectClass( ED_AMBIENT );
|
||||
else SetObjectClass( ED_STATIC ); // never sending to client
|
||||
}
|
||||
|
||||
// second pass: check sound and model indexes
|
||||
if( m_iClassType == ED_SPAWNED )
|
||||
{
|
||||
// mark as normal
|
||||
if( pev->modelindex || pev->noise1 || pev->noise2 || pev->noise3 )
|
||||
SetObjectClass( ED_NORMAL );
|
||||
}
|
||||
}
|
||||
|
||||
// Setup the object->object collision box (pev->mins / pev->maxs is the object->world collision box)
|
||||
virtual void SetObjectCollisionBox( void );
|
||||
|
|
|
@ -597,12 +597,12 @@ void CSprite::Spawn( void )
|
|||
{
|
||||
Precache();
|
||||
|
||||
UTIL_SetModel( ENT(pev), pev->model );
|
||||
UTIL_SetModel( ENT( pev ), pev->model );
|
||||
|
||||
//Smart Field System Š
|
||||
if(!pev->renderamt) pev->renderamt = 200; //light transparency
|
||||
if(!pev->framerate) pev->framerate = Frames(); //play sequence at one second
|
||||
if(!pev->rendermode) pev->rendermode = kRenderTransAdd;
|
||||
// Smart Field System Š
|
||||
if( !pev->renderamt ) pev->renderamt = 200; // light transparency
|
||||
if( !pev->framerate ) pev->framerate = Frames(); // play sequence at one second
|
||||
if( !pev->rendermode ) pev->rendermode = kRenderTransAdd;
|
||||
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->movetype = MOVETYPE_NOCLIP;
|
||||
|
@ -617,16 +617,16 @@ void CSprite::Spawn( void )
|
|||
|
||||
void CSprite::PostSpawn( void )
|
||||
{
|
||||
m_pGoalEnt = UTIL_FindEntityByTargetname (NULL, STRING(pev->target));
|
||||
if(m_pGoalEnt) UTIL_SetOrigin( this, m_pGoalEnt->pev->origin );
|
||||
m_pGoalEnt = UTIL_FindEntityByTargetname( NULL, STRING( pev->target ));
|
||||
if( m_pGoalEnt ) UTIL_SetOrigin( this, m_pGoalEnt->pev->origin );
|
||||
}
|
||||
|
||||
void CSprite::Think( void )
|
||||
{
|
||||
SetNextThink( 0 );
|
||||
|
||||
if(pev->spawnflags & SF_TEMPSPRITE && gpGlobals->time > pev->pain_finished ) UTIL_Remove(this);
|
||||
else if ( pev->framerate ) Animate( pev->framerate * (gpGlobals->time - pev->dmgtime) );
|
||||
if( pev->spawnflags & SF_TEMPSPRITE && gpGlobals->time > pev->pain_finished ) UTIL_Remove(this);
|
||||
else if( pev->framerate ) Animate( pev->framerate * (gpGlobals->time - pev->dmgtime) );
|
||||
|
||||
Move();
|
||||
pev->dmgtime = gpGlobals->time;
|
||||
|
@ -635,7 +635,7 @@ void CSprite::Think( void )
|
|||
void CSprite::Move( void )
|
||||
{
|
||||
// Not moving on a path, return
|
||||
if (!m_pGoalEnt) return;
|
||||
if( !m_pGoalEnt ) return;
|
||||
|
||||
// Subtract movement from the previous frame
|
||||
pev->frags -= pev->speed * gpGlobals->frametime;
|
||||
|
|
|
@ -231,7 +231,7 @@ LINK_ENTITY_TO_CLASS( item_longjump, CItemLongJump );
|
|||
|
||||
class CItemBattery : public CItem
|
||||
{
|
||||
const char *Model( void ){ return "models/w_battery.mdl"; }
|
||||
const char *Model( void ){ return "models/items/w_battery.mdl"; }
|
||||
const char *PickSound( void ){ return "items/gunpickup2.wav"; }
|
||||
BOOL AddItem( CBaseEntity *pOther ) { return pOther->TakeArmor( BATTERY_CHARGE, TRUE ); }
|
||||
};
|
||||
|
@ -308,7 +308,7 @@ LINK_ENTITY_TO_CLASS( ammo_762, CSniperAmmo );
|
|||
|
||||
class CRpgAmmo : public CItem
|
||||
{
|
||||
const char *Model( void ){ return "models/w_rpgammo.mdl"; }
|
||||
const char *Model( void ){ return "models/ammo/w_rpgammo.mdl"; }
|
||||
const char *PickSound( void ){ return "weapons/glock/clip_in.wav"; }
|
||||
BOOL AddItem( CBaseEntity *pOther ) { return pOther->GiveAmmo( AMMO_RPGCLIP_GIVE, "rockets", 3 ); }
|
||||
};
|
||||
|
@ -333,7 +333,7 @@ LINK_ENTITY_TO_CLASS( ammo_556, CSawAmmo );
|
|||
|
||||
class CMP5AmmoGrenade : public CItem
|
||||
{
|
||||
const char *Model( void ){ return "models/w_ARgrenade.mdl"; }
|
||||
const char *Model( void ){ return "models/ammo/w_argrenade.mdl"; }
|
||||
const char *PickSound( void ){ return "weapons/glock/clip_in.wav"; }
|
||||
BOOL AddItem( CBaseEntity *pOther ) { return pOther->GiveAmmo( AMMO_M203BOX_GIVE, "m203", 10 ); }
|
||||
};
|
||||
|
@ -488,15 +488,15 @@ void CWeaponBox::Touch( CBaseEntity *pOther )
|
|||
|
||||
int CWeaponBox::MaxAmmoCarry( int iszName )
|
||||
{
|
||||
for ( int i = 0; i < MAX_WEAPONS; i++ )
|
||||
for( int i = 0; i < MAX_WEAPONS; i++ )
|
||||
{
|
||||
if ( CBasePlayerWeapon::ItemInfoArray[i].pszAmmo1 && !strcmp( STRING(iszName), CBasePlayerWeapon::ItemInfoArray[i].pszAmmo1 ) )
|
||||
if( CBasePlayerWeapon::ItemInfoArray[i].iszAmmo1 == iszName )
|
||||
return CBasePlayerWeapon::ItemInfoArray[i].iMaxAmmo1;
|
||||
if ( CBasePlayerWeapon::ItemInfoArray[i].pszAmmo2 && !strcmp( STRING(iszName), CBasePlayerWeapon::ItemInfoArray[i].pszAmmo2 ) )
|
||||
if( CBasePlayerWeapon::ItemInfoArray[i].iszAmmo2 == iszName )
|
||||
return CBasePlayerWeapon::ItemInfoArray[i].iMaxAmmo2;
|
||||
}
|
||||
|
||||
Msg( "MaxAmmoCarry() doesn't recognize '%s'!\n", STRING( iszName ) );
|
||||
ALERT( at_error, "MaxAmmoCarry() doesn't recognize '%s'!\n", STRING( iszName ));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -240,8 +240,8 @@ void CBasePlayerWeapon :: Precache( void )
|
|||
{
|
||||
ItemInfoArray[II.iId] = II;
|
||||
|
||||
if ( II.pszAmmo1 && *II.pszAmmo1 )AddAmmoName( II.pszAmmo1 );
|
||||
if ( II.pszAmmo2 && *II.pszAmmo2 )AddAmmoName( II.pszAmmo2 );
|
||||
if( II.iszAmmo1 ) AddAmmoName( II.iszAmmo1 );
|
||||
if( II.iszAmmo2 ) AddAmmoName( II.iszAmmo2 );
|
||||
|
||||
memset( &II, 0, sizeof II );
|
||||
|
||||
|
@ -344,13 +344,13 @@ void CBasePlayerWeapon :: ResetParse( ItemInfo *II )
|
|||
m_iId = MAX_WEAPONS; //Will be owerwrite with GenerateID()
|
||||
II->iSlot = 0;
|
||||
II->iPosition = 0;
|
||||
II->iViewModel = MAKE_STRING("models/weapons/v_glock.mdl");
|
||||
II->iWorldModel = MAKE_STRING("models/weapons/w_glock.mdl");
|
||||
strcpy(II->szAnimExt, "onehanded");
|
||||
II->pszAmmo1 = "none";
|
||||
II->iMaxAmmo1 = -1;
|
||||
II->pszAmmo2 = "none";
|
||||
II->iMaxAmmo2 = -1;
|
||||
II->iViewModel = MAKE_STRING( "models/weapons/v_glock.mdl" );
|
||||
II->iWorldModel = MAKE_STRING( "models/weapons/w_glock.mdl" );
|
||||
strcpy( II->szAnimExt, "onehanded");
|
||||
II->iszAmmo1 = MAKE_STRING( "none" );
|
||||
II->iMaxAmmo1 = WEAPON_NOAMMO;
|
||||
II->iszAmmo2 = MAKE_STRING( "none" );
|
||||
II->iMaxAmmo2 = WEAPON_NOAMMO;
|
||||
II->iMaxClip = -1;
|
||||
II->iFlags = 0;
|
||||
II->iWeight = 0;
|
||||
|
@ -358,8 +358,8 @@ void CBasePlayerWeapon :: ResetParse( ItemInfo *II )
|
|||
II->attack2 = NONE;
|
||||
II->fNextAttack = 0.5;
|
||||
II->fNextAttack2 = 0.5;
|
||||
memset( II->firesound, 0, sizeof(MAX_SHOOTSOUNDS) );
|
||||
memset( II->sfxsound, 0, sizeof(MAX_SHOOTSOUNDS) );
|
||||
memset( II->firesound, 0, sizeof( MAX_SHOOTSOUNDS ));
|
||||
memset( II->sfxsound, 0, sizeof( MAX_SHOOTSOUNDS ));
|
||||
II->sndcount = 0;
|
||||
II->sfxcount = 0;
|
||||
II->emptysnd = iStringNull;
|
||||
|
@ -383,7 +383,7 @@ int CBasePlayerWeapon :: ParseWeaponFile( ItemInfo *II, const char *filename )
|
|||
char *pfile = (char *)LOAD_FILE( path, NULL );
|
||||
ResetParse( II );
|
||||
|
||||
if(!pfile)
|
||||
if( !pfile )
|
||||
{
|
||||
Msg( "Warning: Weapon info file for %s not found!\n", STRING(pev->netname) );
|
||||
COM_FreeFile( pfile );
|
||||
|
@ -393,8 +393,8 @@ int CBasePlayerWeapon :: ParseWeaponFile( ItemInfo *II, const char *filename )
|
|||
else
|
||||
{
|
||||
|
||||
II->pszName = STRING(pev->netname);
|
||||
DevMsg("Parse %s.txt\n", II->pszName );
|
||||
II->iszName = pev->netname;
|
||||
DevMsg("Parse %s.txt\n", STRING( II->iszName ));
|
||||
// parses the type, moves the file pointer
|
||||
iResult = ParseWeaponData( II, pfile );
|
||||
DevMsg("Parsing: WeaponData{} %s\n", iResult ? "OK" : "ERROR" );
|
||||
|
@ -630,37 +630,38 @@ int CBasePlayerWeapon :: ParseWeaponData( ItemInfo *II, char *pfile )
|
|||
pfile = COM_ParseFile(pfile, token);
|
||||
II->iViewModel = ALLOC_STRING(token);
|
||||
}
|
||||
else if ( !stricmp( token, "playermodel" ))
|
||||
else if( !stricmp( token, "playermodel" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
II->iWorldModel = ALLOC_STRING(token);
|
||||
}
|
||||
else if ( !stricmp( token, "anim_prefix" ))
|
||||
else if( !stricmp( token, "anim_prefix" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
strcpy(II->szAnimExt, token);
|
||||
strncpy( II->szAnimExt, token, sizeof( II->szAnimExt ));
|
||||
}
|
||||
else if ( !stricmp( token, "bucket" ))
|
||||
else if( !stricmp( token, "bucket" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
II->iSlot = atoi(token);
|
||||
II->iSlot = atoi( token );
|
||||
}
|
||||
else if ( !stricmp( token, "bucket_position" ))
|
||||
else if( !stricmp( token, "bucket_position" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
II->iPosition = atoi(token);
|
||||
II->iPosition = atoi( token );
|
||||
}
|
||||
else if ( !stricmp( token, "clip_size" ))
|
||||
else if( !stricmp( token, "clip_size" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
if ( !stricmp( token, "noclip" ) ) II->iMaxClip = -1;
|
||||
else II->iMaxClip = atoi(token);
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
if( !stricmp( token, "noclip" ))
|
||||
II->iMaxClip = -1;
|
||||
else II->iMaxClip = atoi( token );
|
||||
}
|
||||
else if ( !stricmp( token, "primary_ammo" ))
|
||||
else if( !stricmp( token, "primary_ammo" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
pfile = COM_ParseFile( pfile, token );
|
||||
|
||||
if ( !stricmp( token, "none" )) II->iMaxAmmo1 = -1;
|
||||
if ( !stricmp( token, "none" )) II->iMaxAmmo1 = WEAPON_NOAMMO;
|
||||
else if ( !stricmp( token, "357" )) II->iMaxAmmo1 = DESERT_MAX_CARRY;
|
||||
else if ( !stricmp( token, "9mm" )) II->iMaxAmmo1 = GLOCK_MAX_CARRY;
|
||||
else if ( !stricmp( token, "12mm" )) II->iMaxAmmo1 = GLOCK_MAX_CARRY;
|
||||
|
@ -672,16 +673,14 @@ int CBasePlayerWeapon :: ParseWeaponData( ItemInfo *II, char *pfile )
|
|||
else if ( !stricmp( token, "buckshot" )) II->iMaxAmmo1 = BUCKSHOT_MAX_CARRY;
|
||||
else if ( !stricmp( token, "grenade" )) II->iMaxAmmo1 = M203_GRENADE_MAX_CARRY;
|
||||
else if ( !stricmp( token, "bolts" )) II->iMaxAmmo1 = BOLT_MAX_CARRY;
|
||||
|
||||
char *psz = new char[16];
|
||||
strcpy(psz, token);
|
||||
II->pszAmmo1 = const_cast<const char *>(psz);
|
||||
|
||||
II->iszAmmo1 = ALLOC_STRING( token );
|
||||
}
|
||||
else if ( !stricmp( token, "secondary_ammo" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
|
||||
if ( !stricmp( token, "none" )) II->iMaxAmmo2 = -1;
|
||||
if ( !stricmp( token, "none" )) II->iMaxAmmo2 = WEAPON_NOAMMO;
|
||||
else if ( !stricmp( token, "357" )) II->iMaxAmmo2 = DESERT_MAX_CARRY;
|
||||
else if ( !stricmp( token, "9mm" )) II->iMaxAmmo2 = GLOCK_MAX_CARRY;
|
||||
else if ( !stricmp( token, "12mm" )) II->iMaxAmmo2 = GLOCK_MAX_CARRY;
|
||||
|
@ -694,19 +693,17 @@ int CBasePlayerWeapon :: ParseWeaponData( ItemInfo *II, char *pfile )
|
|||
else if ( !stricmp( token, "grenade" )) II->iMaxAmmo1 = M203_GRENADE_MAX_CARRY;//don't change this!
|
||||
else if ( !stricmp( token, "bolts" )) II->iMaxAmmo2 = BOLT_MAX_CARRY;
|
||||
|
||||
char *psz = new char[16];
|
||||
strcpy(psz, token);
|
||||
II->pszAmmo2 = const_cast<const char *>(psz);
|
||||
II->iszAmmo2 = ALLOC_STRING( token );
|
||||
}
|
||||
else if ( !stricmp( token, "defaultammo" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
m_iDefaultAmmo = RandomRange((char*)STRING(ALLOC_STRING(token))).Random();
|
||||
m_iDefaultAmmo = RandomRange( token ).Random();
|
||||
}
|
||||
else if ( !stricmp( token, "defaultammo2" ))
|
||||
{
|
||||
pfile = COM_ParseFile(pfile, token);
|
||||
m_iDefaultAmmo2 = RandomRange((char*)STRING(ALLOC_STRING(token))).Random();
|
||||
m_iDefaultAmmo2 = RandomRange( token ).Random();
|
||||
}
|
||||
else if ( !stricmp( token, "weight" ))
|
||||
{
|
||||
|
@ -846,7 +843,7 @@ int CBasePlayerWeapon :: SetAnimation( Activity activity, float fps )
|
|||
break;
|
||||
}
|
||||
|
||||
//lookup all names
|
||||
// lookup all names
|
||||
for(int i = 0; i < m_iAnimCount; i++ )
|
||||
{
|
||||
iSequence = LookupSequence( pAnimsList[i] );
|
||||
|
@ -869,10 +866,10 @@ void CBasePlayerWeapon :: SendWeaponAnim( int sequence, float fps )
|
|||
dstudioseqdesc_t *pseqdesc;
|
||||
pstudiohdr = (dstudiohdr_t *)GET_MODEL_PTR( ENT(pev) );
|
||||
|
||||
//calculate additional body for special effects
|
||||
// calculate additional body for special effects
|
||||
pev->body = (pev->body % NUM_HANDS) + NUM_HANDS * m_iBody;
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, SVC_WEAPONANIM, NULL, m_pPlayer->pev );
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsg.WeaponAnim, NULL, m_pPlayer->pev );
|
||||
WRITE_BYTE( sequence );
|
||||
WRITE_BYTE( pev->body );
|
||||
MESSAGE_END();
|
||||
|
@ -1878,17 +1875,19 @@ void CBasePlayerWeapon::Drop( void )
|
|||
|
||||
void CBasePlayerWeapon::AttachToPlayer ( CBasePlayer *pPlayer )
|
||||
{
|
||||
SetObjectClass( ED_VIEWMODEL );
|
||||
|
||||
pev->movetype = MOVETYPE_FOLLOW;
|
||||
pev->solid = SOLID_NOT;
|
||||
pev->aiment = pPlayer->edict();
|
||||
pev->effects = EF_NODRAW;
|
||||
pev->modelindex = 0;// server won't send down to clients if modelindex == 0
|
||||
pev->targetname = iStringNull; //don't try remove this weapon from map
|
||||
pev->modelindex = 0; // server won't send down to clients if modelindex == 0
|
||||
pev->targetname = iStringNull; // don't try remove this weapon from map
|
||||
pev->model = iStringNull;
|
||||
pev->owner = pPlayer->edict();
|
||||
SetNextThink( 0.1 );
|
||||
SetTouch( NULL );
|
||||
SetThink(NULL);
|
||||
SetThink( NULL );
|
||||
}
|
||||
|
||||
int CBasePlayerWeapon::AddDuplicate( CBasePlayerWeapon *pOriginal )
|
||||
|
@ -1902,19 +1901,17 @@ int CBasePlayerWeapon::AddDuplicate( CBasePlayerWeapon *pOriginal )
|
|||
|
||||
int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer )
|
||||
{
|
||||
m_pPlayer = pPlayer;//Give global pointer to player
|
||||
m_pPlayer = pPlayer; // Give global pointer to player
|
||||
pPlayer->pev->weapons |= (1<<m_iId);
|
||||
|
||||
ALERT( at_console, "AddToPlayer: pev->weapons %li (add %i)\n", pPlayer->pev->weapons, (1<<m_iId));
|
||||
|
||||
if ( !m_iPrimaryAmmoType || !m_iSecondaryAmmoType )
|
||||
if( !m_iPrimaryAmmoType || !m_iSecondaryAmmoType )
|
||||
{
|
||||
m_iPrimaryAmmoType = pPlayer->GetAmmoIndex( pszAmmo1() );
|
||||
m_iSecondaryAmmoType = pPlayer->GetAmmoIndex( pszAmmo2() );
|
||||
}
|
||||
|
||||
MESSAGE_BEGIN(MSG_ONE, gmsg.WeapPickup, NULL, pPlayer->pev);
|
||||
WRITE_BYTE(m_iId);
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsg.WeapPickup, NULL, pPlayer->pev );
|
||||
WRITE_BYTE( m_iId );
|
||||
MESSAGE_END();
|
||||
|
||||
return AddWeapon();
|
||||
|
|
|
@ -55,21 +55,21 @@ typedef struct
|
|||
int iViewModel; // path to viewmodel
|
||||
int iWorldModel; // path to worldmodel
|
||||
char szAnimExt[16]; // player anim postfix
|
||||
const char *pszAmmo1; // ammo 1 type
|
||||
string_t iszAmmo1; // ammo 1 type
|
||||
int iMaxAmmo1; // max ammo 1
|
||||
const char *pszAmmo2; // ammo 2 type
|
||||
string_t iszAmmo2; // ammo 2 type
|
||||
int iMaxAmmo2; // max ammo 2
|
||||
const char *pszName; // weapon name
|
||||
string_t iszName; // weapon name
|
||||
int iMaxClip; // clip size
|
||||
int iId; // unikal weapon Id number
|
||||
int iId; // unique weapon Id number
|
||||
int iFlags; // weapon flags
|
||||
int iWeight; // for autoselect weapon
|
||||
int attack1; // attack1 type
|
||||
int attack2; // attack2 type
|
||||
float fNextAttack; // nextattack
|
||||
float fNextAttack2; // next secondary attack
|
||||
int firesound[MAX_SHOOTSOUNDS]; // firesounds
|
||||
int sfxsound[MAX_SHOOTSOUNDS]; // sfxsound
|
||||
string_t firesound[MAX_SHOOTSOUNDS]; // firesounds
|
||||
string_t sfxsound[MAX_SHOOTSOUNDS]; // sfxsound
|
||||
int sndcount; // fire sound count
|
||||
int sfxcount; // sfx sound count
|
||||
int emptysnd; // empty sound
|
||||
|
@ -81,7 +81,7 @@ typedef struct
|
|||
|
||||
typedef struct
|
||||
{
|
||||
const char *pszName;
|
||||
string_t iszName;
|
||||
int iMaxCarry;
|
||||
int iId;
|
||||
} AmmoInfo;
|
||||
|
@ -201,13 +201,13 @@ public:
|
|||
float fPunchAngle2( void ){ return ItemInfoArray[ m_iId ].punchangle2.Random(); }
|
||||
float fRecoil1( void ) { return ItemInfoArray[ m_iId ].recoil1.Random(); }
|
||||
float fRecoil2( void ) { return ItemInfoArray[ m_iId ].recoil2.Random(); }
|
||||
const char *pszAmmo1( void ) { return ItemInfoArray[ m_iId ].pszAmmo1; }
|
||||
const char *pszName( void ) { return ItemInfoArray[ m_iId ].pszName; }
|
||||
const char *pszAmmo2( void ) { return ItemInfoArray[ m_iId ].pszAmmo2; }
|
||||
const char *pszAmmo1( void ) { return STRING( ItemInfoArray[ m_iId ].iszAmmo1 ); }
|
||||
const char *pszAmmo2( void ) { return STRING( ItemInfoArray[ m_iId ].iszAmmo2 ); }
|
||||
const char *pszName( void ) { return STRING( ItemInfoArray[ m_iId ].iszName ); }
|
||||
|
||||
BOOL PlayEmptySound( void );//universal empty sound
|
||||
|
||||
//Default functions
|
||||
// default functions
|
||||
BOOL DefaultDeploy( Activity sequence );
|
||||
BOOL DefaultHolster( Activity sequence );
|
||||
BOOL DefaultReload( Activity sequence );
|
||||
|
|
|
@ -17,10 +17,10 @@ void CWorld :: Precache( void )
|
|||
|
||||
void CWorld :: KeyValue( KeyValueData *pkvd )
|
||||
{
|
||||
if ( FStrEq(pkvd->szKeyName, "skyname") )
|
||||
if( FStrEq( pkvd->szKeyName, "skyname" ))
|
||||
{
|
||||
// Sent over net now.
|
||||
CVAR_SET_STRING( "sv_skyname", pkvd->szValue );
|
||||
SET_SKYBOX( pkvd->szValue );
|
||||
pkvd->fHandled = TRUE;
|
||||
}
|
||||
else if ( FStrEq(pkvd->szKeyName, "chaptertitle") )
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// This gets called one time when the game is initialied
|
||||
void GameDLLInit( void )
|
||||
{
|
||||
ALERT( at_console, "GameDLLInit();\n" );
|
||||
ALERT( at_aiconsole, "GameDLLInit();\n" );
|
||||
|
||||
// register cvars here:
|
||||
CVAR_REGISTER( "sv_soundlist", "0", 0, "show server sound list" );
|
||||
|
|
|
@ -126,7 +126,7 @@ CGameRules *InstallGameRules( void )
|
|||
SERVER_COMMAND( "exec game.rc\n" );
|
||||
SERVER_EXECUTE( );
|
||||
|
||||
ALERT( at_console, "InstallGameRules\n" );
|
||||
ALERT( at_aiconsole, "InstallGameRules\n" );
|
||||
|
||||
if ( !gpGlobals->deathmatch )
|
||||
{
|
||||
|
|
|
@ -1279,7 +1279,7 @@ void SENTENCEG_Init()
|
|||
}
|
||||
}
|
||||
|
||||
g_engfuncs.pfnFreeFile( pMemFile );
|
||||
FREE_FILE( pMemFile );
|
||||
|
||||
fSentencesInit = TRUE;
|
||||
|
||||
|
@ -1505,7 +1505,7 @@ void TEXTURETYPE_Init()
|
|||
strcpy(&(grgszTextureName[gcTextures++][0]), &(buffer[i]));
|
||||
}
|
||||
|
||||
g_engfuncs.pfnFreeFile( pMemFile );
|
||||
FREE_FILE( pMemFile );
|
||||
|
||||
fTextureTypeInit = TRUE;
|
||||
}
|
||||
|
@ -1908,9 +1908,9 @@ void CFMODAudio::Spawn( void )
|
|||
void CFMODAudio::StartMessage( CBasePlayer *pPlayer )
|
||||
{
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsg.Fsound, NULL, pPlayer->pev );
|
||||
WRITE_STRING( STRING(pev->message));
|
||||
WRITE_SHORT( pev->button );//position
|
||||
WRITE_SHORT( pev->impulse );//flags
|
||||
WRITE_STRING( STRING( pev->message ));
|
||||
WRITE_SHORT( pev->button ); // position
|
||||
WRITE_SHORT( pev->impulse ); // flags
|
||||
MESSAGE_END();
|
||||
}
|
||||
|
||||
|
@ -1922,24 +1922,24 @@ void CFMODAudio::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE us
|
|||
}
|
||||
else m_hActivator = UTIL_PlayerByIndex( 1 );
|
||||
|
||||
if (useType == USE_TOGGLE)
|
||||
if( useType == USE_TOGGLE )
|
||||
{
|
||||
if(m_iState == STATE_OFF) useType = USE_ON;
|
||||
else useType = USE_OFF;
|
||||
}
|
||||
if (useType == USE_ON)
|
||||
if( useType == USE_ON )
|
||||
{
|
||||
m_iState = STATE_ON;
|
||||
SetBits( pev->impulse, SF_START_ON );
|
||||
StartMessage( (CBasePlayer *)(CBaseEntity *)m_hActivator );
|
||||
}
|
||||
else if (useType == USE_OFF)
|
||||
else if( useType == USE_OFF )
|
||||
{
|
||||
ClearBits( pev->impulse, SF_START_ON );
|
||||
StartMessage( (CBasePlayer *)(CBaseEntity *)m_hActivator );
|
||||
m_iState = STATE_OFF;
|
||||
}
|
||||
else if (useType == USE_SHOWINFO)
|
||||
else if( useType == USE_SHOWINFO )
|
||||
{
|
||||
DEBUGHEAD;
|
||||
ALERT(at_console, "State: %s, Song name: %s\n", GetStringForState( GetState()), STRING(pev->message));
|
||||
|
|
|
@ -856,7 +856,7 @@ void ServerPostActivate( void )
|
|||
CBasePlayer *plr = (CBasePlayer*)UTIL_PlayerByIndex( 1 );
|
||||
CBaseEntity *pClass;
|
||||
|
||||
if( !pEdict || MSGSended ) return; //player spawned ?
|
||||
if( !pEdict || MSGSended ) return; // player spawned ?
|
||||
// NOTE: Time to affect is obsolete delay before sending message
|
||||
// Tune multiplayer time if need
|
||||
|
||||
|
@ -866,10 +866,11 @@ void ServerPostActivate( void )
|
|||
for ( int i = 0; i < gpGlobals->maxEntities; i++, pEdict++ )
|
||||
{
|
||||
if( pEdict->free ) continue;
|
||||
pClass = CBaseEntity::Instance(pEdict);
|
||||
if ( pClass && !(pClass->pev->flags & FL_DORMANT) )
|
||||
pClass = CBaseEntity::Instance( pEdict );
|
||||
if( pClass && !( pClass->pev->flags & FL_DORMANT ))
|
||||
{
|
||||
pClass->PostActivate();
|
||||
pClass->ClassifyEdict();
|
||||
}
|
||||
}
|
||||
MSGSended = TRUE;//messages sucessfully sended
|
||||
|
@ -1043,6 +1044,7 @@ void LinkUserMessages( void )
|
|||
gmsg.ItemPickup = REG_USER_MSG( "ItemPickup", -1 );
|
||||
gmsg.RoomType = REG_USER_MSG( "RoomType", 2 );
|
||||
gmsg.HideWeapon = REG_USER_MSG( "HideWeapon", 1 );
|
||||
gmsg.WeaponAnim = REG_USER_MSG( "WeaponAnim", 2 );
|
||||
gmsg.SetFOV = REG_USER_MSG( "SetFOV", 1 );
|
||||
gmsg.ShowMenu = REG_USER_MSG( "ShowMenu", -1 );
|
||||
gmsg.Shake = REG_USER_MSG("ScreenShake", 13 );
|
||||
|
@ -1066,7 +1068,7 @@ void LinkUserMessages( void )
|
|||
gmsg.HudText = REG_USER_MSG( "HudText", -1 );
|
||||
gmsg.ShowGameTitle = REG_USER_MSG("GameTitle", 1);
|
||||
gmsg.SetFog = REG_USER_MSG("SetFog", 7 );
|
||||
gmsg.SetSky = REG_USER_MSG( "SetSky", 7 );
|
||||
gmsg.SetSky = REG_USER_MSG( "SetSky", 13 );
|
||||
gmsg.Particle = REG_USER_MSG( "Particle", -1);
|
||||
gmsg.Beams = REG_USER_MSG( "Beams", -1 );
|
||||
gmsg.AddMirror = REG_USER_MSG( "AddMirror", 2);
|
||||
|
|
|
@ -89,6 +89,7 @@ typedef struct user_messages_s
|
|||
int WeapPickup;
|
||||
int ItemPickup;
|
||||
int HideWeapon;
|
||||
int WeaponAnim;
|
||||
int RoomType;
|
||||
int SayText;
|
||||
int SetFOV;
|
||||
|
|
|
@ -205,7 +205,8 @@
|
|||
#define DIM_GUN_FLASH 128
|
||||
#define NO_GUN_FLASH 0
|
||||
|
||||
#define WEAPON_NOCLIP -1
|
||||
#define WEAPON_NOCLIP -1
|
||||
#define WEAPON_NOAMMO -1
|
||||
|
||||
//default as barney hands for weapon
|
||||
#define GORDON_HANDS 1
|
||||
|
|
|
@ -36,6 +36,7 @@ static DLL_FUNCTIONS gFunctionTable =
|
|||
sizeof( DLL_FUNCTIONS ),
|
||||
GameDLLInit, // pfnGameInit
|
||||
DispatchSpawn, // pfnSpawn
|
||||
DispatchCreate, // pfnCreate
|
||||
DispatchThink, // pfnThink
|
||||
DispatchUse, // pfnUse
|
||||
DispatchTouch, // pfnTouch
|
||||
|
@ -96,12 +97,13 @@ int DispatchSpawn( edict_t *pent )
|
|||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
|
||||
if (pEntity)
|
||||
if( pEntity )
|
||||
{
|
||||
// Initialize these or entities who don't link to the world won't have anything in here
|
||||
pEntity->pev->absmin = pEntity->pev->origin - Vector(1,1,1);
|
||||
pEntity->pev->absmax = pEntity->pev->origin + Vector(1,1,1);
|
||||
|
||||
pEntity->SetObjectClass(); // apply default value
|
||||
pEntity->Spawn();
|
||||
pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
|
||||
|
@ -133,6 +135,11 @@ int DispatchSpawn( edict_t *pent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
int DispatchCreate( edict_t *pent, const char *szName )
|
||||
{
|
||||
return -1; // -1 = failed, 0 = done
|
||||
}
|
||||
|
||||
void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd )
|
||||
{
|
||||
if ( !pkvd || !pentKeyvalue )return;
|
||||
|
@ -376,8 +383,8 @@ void SetObjectCollisionBox( entvars_t *pev )
|
|||
void DispatchObjectCollsionBox( edict_t *pent )
|
||||
{
|
||||
CBaseEntity *pEntity = (CBaseEntity *)GET_PRIVATE(pent);
|
||||
if (pEntity)pEntity->SetObjectCollisionBox();
|
||||
else SetObjectCollisionBox( &pent->v );
|
||||
if( pEntity ) pEntity->SetObjectCollisionBox();
|
||||
else SetObjectCollisionBox( &pent->v );
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
|
|
|
@ -41,17 +41,17 @@ extern enginefuncs_t g_engfuncs;
|
|||
#define MAKE_VECTORS (*g_engfuncs.pfnMakeVectors)
|
||||
#define CREATE_ENTITY (*g_engfuncs.pfnCreateEntity)
|
||||
#define REMOVE_ENTITY (*g_engfuncs.pfnRemoveEntity)
|
||||
#define CREATE_NAMED_ENTITY (*g_engfuncs.pfnCreateNamedEntity)
|
||||
#define CREATE_NAMED_ENTITY (*g_engfuncs.pfnCreateNamedEntity)
|
||||
#define MAKE_STATIC (*g_engfuncs.pfnMakeStatic)
|
||||
#define ENT_IS_ON_FLOOR (*g_engfuncs.pfnEntIsOnFloor)
|
||||
#define DROP_TO_FLOOR (*g_engfuncs.pfnDropToFloor)
|
||||
#define WALK_MOVE (*g_engfuncs.pfnWalkMove)
|
||||
#define SET_ORIGIN (*g_engfuncs.pfnSetOrigin)
|
||||
#define EMIT_SOUND_DYN2 (*g_engfuncs.pfnEmitSound)
|
||||
#define BUILD_SOUND_MSG (*g_engfuncs.pfnBuildSoundMsg)
|
||||
#define EMIT_SOUND_DYN2 (*g_engfuncs.pfnEmitSound)
|
||||
#define BUILD_SOUND_MSG (*g_engfuncs.pfnBuildSoundMsg)
|
||||
#define TRACE_LINE (*g_engfuncs.pfnTraceLine)
|
||||
#define TRACE_TOSS (*g_engfuncs.pfnTraceToss)
|
||||
#define TRACE_MONSTER_HULL (*g_engfuncs.pfnTraceMonsterHull)
|
||||
#define TRACE_MONSTER_HULL (*g_engfuncs.pfnTraceMonsterHull)
|
||||
#define TRACE_HULL (*g_engfuncs.pfnTraceHull)
|
||||
#define GET_AIM_VECTOR (*g_engfuncs.pfnGetAimVector)
|
||||
#define SERVER_COMMAND (*g_engfuncs.pfnServerCommand)
|
||||
|
@ -66,11 +66,13 @@ extern enginefuncs_t g_engfuncs;
|
|||
#define CRC_FINAL (*g_engfuncs.pfnCRC_Final)
|
||||
#define RANDOM_LONG (*g_engfuncs.pfnRandomLong)
|
||||
#define RANDOM_FLOAT (*g_engfuncs.pfnRandomFloat)
|
||||
#define GETPLAYERAUTHID (*g_engfuncs.pfnGetPlayerAuthId)
|
||||
#define CLASSIFY_EDICT (*g_engfuncs.pfnClassifyEdict)
|
||||
|
||||
inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL ) {
|
||||
(*g_engfuncs.pfnMessageBegin)(msg_dest, msg_type, pOrigin, ed);
|
||||
inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin = NULL, edict_t *ed = NULL )
|
||||
{
|
||||
(*g_engfuncs.pfnMessageBegin)( msg_dest, msg_type, pOrigin, ed );
|
||||
}
|
||||
|
||||
#define MESSAGE_END (*g_engfuncs.pfnMessageEnd)
|
||||
#define WRITE_BYTE (*g_engfuncs.pfnWriteByte)
|
||||
#define WRITE_CHAR (*g_engfuncs.pfnWriteChar)
|
||||
|
@ -86,8 +88,7 @@ inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin = NU
|
|||
#define CVAR_GET_STRING (*g_engfuncs.pfnCVarGetString)
|
||||
#define CVAR_SET_FLOAT (*g_engfuncs.pfnCVarSetFloat)
|
||||
#define CVAR_SET_STRING (*g_engfuncs.pfnCVarSetString)
|
||||
#define CVAR_GET_POINTER (*g_engfuncs.pfnCVarGetPointer)
|
||||
#define ALERT (*g_engfuncs.pfnAlertMessage)
|
||||
#define ALERT (*g_engfuncs.pfnAlertMessage)
|
||||
#define ENGINE_FPRINTF (*g_engfuncs.pfnEngineFprintf)
|
||||
#define ALLOC_PRIVATE (*g_engfuncs.pfnPvAllocEntPrivateData)
|
||||
inline void *GET_PRIVATE( edict_t *pent )
|
||||
|
@ -107,27 +108,29 @@ inline void *GET_PRIVATE( edict_t *pent )
|
|||
#define FREE_PRIVATE (*g_engfuncs.pfnFreeEntPrivateData)
|
||||
#define FIND_ENTITY_BY_STRING (*g_engfuncs.pfnFindEntityByString)
|
||||
#define GETENTITYILLUM (*g_engfuncs.pfnGetEntityIllum)
|
||||
#define FIND_ENTITY_IN_SPHERE (*g_engfuncs.pfnFindEntityInSphere)
|
||||
#define FIND_CLIENT_IN_PVS (*g_engfuncs.pfnFindClientInPVS)
|
||||
#define EMIT_AMBIENT_SOUND (*g_engfuncs.pfnEmitAmbientSound)
|
||||
#define GET_MODEL_PTR (*g_engfuncs.pfnGetModelPtr)
|
||||
#define REG_USER_MSG (*g_engfuncs.pfnRegUserMsg)
|
||||
#define GET_BONE_POSITION (*g_engfuncs.pfnGetBonePosition)
|
||||
#define FUNCTION_FROM_NAME (*g_engfuncs.pfnFunctionFromName)
|
||||
#define NAME_FOR_FUNCTION (*g_engfuncs.pfnNameForFunction)
|
||||
#define TRACE_TEXTURE (*g_engfuncs.pfnTraceTexture)
|
||||
#define CMD_ARGS (*g_engfuncs.pfnCmd_Args)
|
||||
#define CMD_ARGC (*g_engfuncs.pfnCmd_Argc)
|
||||
#define CMD_ARGV (*g_engfuncs.pfnCmd_Argv)
|
||||
#define GET_ATTACHMENT (*g_engfuncs.pfnGetAttachment)
|
||||
#define SET_VIEW (*g_engfuncs.pfnSetView)
|
||||
#define SET_CROSSHAIRANGLE (*g_engfuncs.pfnCrosshairAngle)
|
||||
#define LOAD_FILE (*g_engfuncs.pfnLoadFile)
|
||||
#define FREE_FILE (*g_engfuncs.pfnFreeFile)
|
||||
#define COMPARE_FILE_TIME (*g_engfuncs.pfnCompareFileTime)
|
||||
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
|
||||
#define IS_MAP_VALID (*g_engfuncs.pfnIsMapValid)
|
||||
#define IS_DEDICATED_SERVER (*g_engfuncs.pfnIsDedicatedServer)
|
||||
#define HOST_ERROR (*g_engfuncs.pfnHostError)
|
||||
#define FIND_ENTITY_IN_SPHERE (*g_engfuncs.pfnFindEntityInSphere)
|
||||
#define FIND_CLIENT_IN_PVS (*g_engfuncs.pfnFindClientInPVS)
|
||||
#define EMIT_AMBIENT_SOUND (*g_engfuncs.pfnEmitAmbientSound)
|
||||
#define GET_MODEL_PTR (*g_engfuncs.pfnGetModelPtr)
|
||||
#define REG_USER_MSG (*g_engfuncs.pfnRegUserMsg)
|
||||
#define GET_BONE_POSITION (*g_engfuncs.pfnGetBonePosition)
|
||||
#define FUNCTION_FROM_NAME (*g_engfuncs.pfnFunctionFromName)
|
||||
#define NAME_FOR_FUNCTION (*g_engfuncs.pfnNameForFunction)
|
||||
#define TRACE_TEXTURE (*g_engfuncs.pfnTraceTexture)
|
||||
#define CMD_ARGS (*g_engfuncs.pfnCmd_Args)
|
||||
#define CMD_ARGC (*g_engfuncs.pfnCmd_Argc)
|
||||
#define CMD_ARGV (*g_engfuncs.pfnCmd_Argv)
|
||||
#define GET_ATTACHMENT (*g_engfuncs.pfnGetAttachment)
|
||||
#define SET_VIEW (*g_engfuncs.pfnSetView)
|
||||
#define SET_CROSSHAIRANGLE (*g_engfuncs.pfnCrosshairAngle)
|
||||
#define SET_SKYBOX (*g_engfuncs.pfnSetSkybox)
|
||||
#define LOAD_FILE (*g_engfuncs.pfnLoadFile)
|
||||
#define FILE_EXISTS (*g_engfuncs.pfnFileExists)
|
||||
#define FREE_FILE FREE
|
||||
#define COMPARE_FILE_TIME (*g_engfuncs.pfnCompareFileTime)
|
||||
#define GET_GAME_DIR (*g_engfuncs.pfnGetGameDir)
|
||||
#define IS_MAP_VALID (*g_engfuncs.pfnIsMapValid)
|
||||
#define IS_DEDICATED_SERVER (*g_engfuncs.pfnIsDedicatedServer)
|
||||
#define HOST_ERROR (*g_engfuncs.pfnHostError)
|
||||
|
||||
#endif //ENGINECALLBACK_H
|
|
@ -28,6 +28,7 @@ extern "C" EXPORT int GetEntityAPI( DLL_FUNCTIONS *pFunctionTable, int interface
|
|||
extern "C" EXPORT int GetEntityAPI2( DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion );
|
||||
|
||||
extern int DispatchSpawn( edict_t *pent );
|
||||
extern int DispatchCreate( edict_t *pent, const char *szName );
|
||||
extern void DispatchKeyValue( edict_t *pentKeyvalue, KeyValueData *pkvd );
|
||||
extern void DispatchTouch( edict_t *pentTouched, edict_t *pentOther );
|
||||
extern void DispatchUse( edict_t *pentUsed, edict_t *pentOther );
|
||||
|
|
|
@ -111,9 +111,9 @@ char *COM_ParseFile( char *data, char *token )
|
|||
return return_data;
|
||||
}
|
||||
|
||||
void COM_FreeFile (char *buffer)
|
||||
void COM_FreeFile( char *buffer )
|
||||
{
|
||||
FREE_FILE( buffer );
|
||||
if( buffer ) FREE_FILE( buffer );
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
@ -1104,22 +1104,23 @@ int UTIL_PrecacheModel( char* s )
|
|||
//========================================================================
|
||||
// Precaches the ammo and queues the ammo info for sending to clients
|
||||
//========================================================================
|
||||
void AddAmmoName( const char *szAmmoname )
|
||||
void AddAmmoName( string_t iAmmoName )
|
||||
{
|
||||
// make sure it's not already in the registry
|
||||
for ( int i = 0; i < MAX_AMMO_SLOTS; i++ )
|
||||
{
|
||||
if ( !CBasePlayerWeapon::AmmoInfoArray[i].pszName) continue;
|
||||
if ( stricmp( CBasePlayerWeapon::AmmoInfoArray[i].pszName, szAmmoname ) == 0 )
|
||||
if( !CBasePlayerWeapon::AmmoInfoArray[i].iszName ) continue;
|
||||
if( CBasePlayerWeapon::AmmoInfoArray[i].iszName == iAmmoName )
|
||||
return; // ammo already in registry, just quite
|
||||
}
|
||||
|
||||
giAmmoIndex++;
|
||||
ASSERT( giAmmoIndex < MAX_AMMO_SLOTS );
|
||||
if ( giAmmoIndex >= MAX_AMMO_SLOTS )
|
||||
if( giAmmoIndex >= MAX_AMMO_SLOTS )
|
||||
giAmmoIndex = 0;
|
||||
|
||||
CBasePlayerWeapon::AmmoInfoArray[giAmmoIndex].pszName = szAmmoname;
|
||||
CBasePlayerWeapon::AmmoInfoArray[giAmmoIndex].iId = giAmmoIndex;// yes, this info is redundant
|
||||
CBasePlayerWeapon::AmmoInfoArray[giAmmoIndex].iszName = iAmmoName;
|
||||
CBasePlayerWeapon::AmmoInfoArray[giAmmoIndex].iId = giAmmoIndex; // yes, this info is redundant
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
|
@ -2296,7 +2297,30 @@ void UTIL_TraceLine( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTE
|
|||
|
||||
void UTIL_TraceHull( const Vector &vecStart, const Vector &vecEnd, IGNORE_MONSTERS igmon, int hullNumber, edict_t *pentIgnore, TraceResult *ptr )
|
||||
{
|
||||
TRACE_HULL( vecStart, vecEnd, (igmon == ignore_monsters ? TRUE : FALSE), hullNumber, pentIgnore, ptr );
|
||||
Vector mins, maxs;
|
||||
|
||||
switch( hullNumber )
|
||||
{
|
||||
case human_hull:
|
||||
mins = Vector( -16, -16, 0 );
|
||||
maxs = Vector( 16, 16, 72 );
|
||||
break;
|
||||
case large_hull:
|
||||
mins = Vector( -32, -32,-32 );
|
||||
maxs = Vector( 32, 32, 32 );
|
||||
break;
|
||||
case head_hull: // ducked
|
||||
mins = Vector( -16, -16,-18 );
|
||||
maxs = Vector( 16, 16, 18 );
|
||||
break;
|
||||
case point_hull:
|
||||
default:
|
||||
mins = g_vecZero;
|
||||
maxs = g_vecZero;
|
||||
break;
|
||||
}
|
||||
|
||||
TRACE_HULL( vecStart, mins, maxs, vecEnd, (igmon == ignore_monsters ? TRUE : FALSE), pentIgnore, ptr );
|
||||
}
|
||||
|
||||
void UTIL_TraceModel( const Vector &vecStart, const Vector &vecEnd, int hullNumber, edict_t *pentModel, TraceResult *ptr )
|
||||
|
|
|
@ -153,6 +153,52 @@ inline void MESSAGE_BEGIN( int msg_dest, int msg_type, const float *pOrigin, ent
|
|||
class CBaseEntity;
|
||||
class CBasePlayer;
|
||||
|
||||
//=========================================================
|
||||
// RandomRange - for random values
|
||||
//=========================================================
|
||||
class RandomRange
|
||||
{
|
||||
public:
|
||||
float m_flMax, m_flMin; // class members
|
||||
|
||||
RandomRange() { m_flMin = m_flMax = 0; }
|
||||
RandomRange( float fValue ) { m_flMin = m_flMax = fValue; }
|
||||
RandomRange( float fMin, float fMax ) { m_flMin = fMin; m_flMax = fMax; }
|
||||
RandomRange( const char *szToken )
|
||||
{
|
||||
char *cOneDot = NULL;
|
||||
m_flMin = m_flMax = 0;
|
||||
|
||||
for( const char *c = szToken; *c; c++ )
|
||||
{
|
||||
if( *c == '.' )
|
||||
{
|
||||
if( cOneDot != NULL )
|
||||
{
|
||||
// found two dots in a row - it's a range
|
||||
*cOneDot = 0; // null terminate the first number
|
||||
m_flMin = atof( szToken ); // parse the first number
|
||||
*cOneDot = '.'; // change it back, just in case
|
||||
c++;
|
||||
m_flMax = atof( c ); // parse the second number
|
||||
return;
|
||||
}
|
||||
else cOneDot = (char *)c;
|
||||
}
|
||||
else cOneDot = NULL;
|
||||
}
|
||||
|
||||
// no range, just record the number
|
||||
m_flMax = m_flMin = atof( szToken );
|
||||
}
|
||||
|
||||
float Random() { return RANDOM_FLOAT( m_flMin, m_flMax ); }
|
||||
|
||||
// array access...
|
||||
float operator[](int i) const { return ((float*)this)[i];}
|
||||
float& operator[](int i) { return ((float*)this)[i];}
|
||||
};
|
||||
|
||||
// Testing the three types of "entity" for nullity
|
||||
//LRC- four types, rather; see cbase.h
|
||||
#define eoNullEntity 0
|
||||
|
@ -490,8 +536,6 @@ extern DLL_GLOBAL int g_Language;
|
|||
#define VEC_DUCK_HULL_MAX Vector( 16, 16, 18)
|
||||
#define VEC_DUCK_VIEW Vector( 0, 0, 12 )
|
||||
|
||||
#define SVC_WEAPONANIM 35 // FIMXE: get rid of this
|
||||
|
||||
// camera flags
|
||||
#define CAMERA_ON 1
|
||||
#define DRAW_HUD 2
|
||||
|
@ -751,7 +795,7 @@ int UTIL_LoadDecalPreset( string_t pString );
|
|||
int UTIL_LoadDecalPreset( const char *pString );
|
||||
void UTIL_ChangeLevel( string_t mapname, string_t spotname );
|
||||
void UTIL_ChangeLevel( const char *szNextMap, const char *szNextSpot );
|
||||
void AddAmmoName( const char *szAmmoname );
|
||||
void AddAmmoName( string_t iAmmoName );
|
||||
|
||||
// precache utils
|
||||
void UTIL_PrecacheEntity( string_t szClassname );
|
||||
|
|
|
@ -230,52 +230,4 @@ public:
|
|||
Vector4D CompProduct (const Vector4D &v)const {Vector4D res; res.x = x * v.x; res.y = y * v.y; res.z = z * v.z; res.w = w; return res;}
|
||||
};
|
||||
|
||||
//=========================================================
|
||||
// RandomRange - for random values
|
||||
//=========================================================
|
||||
class RandomRange
|
||||
{
|
||||
public:
|
||||
float m_flMax, m_flMin;//class members
|
||||
|
||||
RandomRange() { m_flMin = m_flMax = 0; }
|
||||
RandomRange(float fValue) { m_flMin = m_flMax = fValue; }
|
||||
RandomRange(float fMin, float fMax) { m_flMin = fMin; m_flMax = fMax; }
|
||||
RandomRange( char *szToken )
|
||||
{
|
||||
char *cOneDot = NULL;
|
||||
m_flMin = m_flMax = 0;
|
||||
|
||||
for (char *c = szToken; *c; c++)
|
||||
{
|
||||
if (*c == '.')
|
||||
{
|
||||
if (cOneDot != NULL)
|
||||
{
|
||||
// found two dots in a row - it's a range
|
||||
|
||||
*cOneDot = 0; // null terminate the first number
|
||||
m_flMin = atof(szToken); // parse the first number
|
||||
*cOneDot = '.'; // change it back, just in case
|
||||
c++;
|
||||
m_flMax = atof(c); // parse the second number
|
||||
return;
|
||||
}
|
||||
else cOneDot = c;
|
||||
}
|
||||
else cOneDot = NULL;
|
||||
}
|
||||
|
||||
// no range, just record the number
|
||||
m_flMax = m_flMin = atof(szToken);
|
||||
}
|
||||
|
||||
// FIXME: float Random() { return RANDOM_FLOAT(m_flMin, m_flMax); }
|
||||
float Random() { return m_flMin - m_flMax; }
|
||||
|
||||
// array access...
|
||||
float operator[](int i) const { return ((float*)this)[i];}
|
||||
float& operator[](int i) { return ((float*)this)[i];}
|
||||
};
|
||||
|
||||
#endif
|
|
@ -758,19 +758,19 @@ void CBasePlayer::PackDeadPlayerItems( void )
|
|||
pWeaponBox->SetThink(& CWeaponBox::Kill );
|
||||
pWeaponBox->SetNextThink( 120 );
|
||||
|
||||
// back these two lists up to their first elements
|
||||
// back these two lists up to their first elements
|
||||
iPA = 0;
|
||||
iPW = 0;
|
||||
|
||||
// pack the ammo
|
||||
while ( iPackAmmo[ iPA ] != -1 )
|
||||
// pack the ammo
|
||||
while( iPackAmmo[ iPA ] != -1 )
|
||||
{
|
||||
pWeaponBox->PackAmmo( MAKE_STRING( CBasePlayerWeapon::AmmoInfoArray[ iPackAmmo[ iPA ] ].pszName ), m_rgAmmo[ iPackAmmo[ iPA ] ] );
|
||||
pWeaponBox->PackAmmo( CBasePlayerWeapon::AmmoInfoArray[ iPackAmmo[ iPA ] ].iszName, m_rgAmmo[iPackAmmo[iPA]] );
|
||||
iPA++;
|
||||
}
|
||||
|
||||
// now pack all of the items in the lists
|
||||
while ( rgpPackWeapons[ iPW ] )
|
||||
// now pack all of the items in the lists
|
||||
while( rgpPackWeapons[ iPW ] )
|
||||
{
|
||||
// weapon unhooked from the player. Pack it into der box.
|
||||
pWeaponBox->PackWeapon( rgpPackWeapons[ iPW ] );
|
||||
|
@ -892,7 +892,7 @@ void CBasePlayer::Killed( entvars_t *pevAttacker, int iGib )
|
|||
// Tell Ammo Hud that the player is dead
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsg.CurWeapon, NULL, pev );
|
||||
WRITE_BYTE(0);
|
||||
WRITE_BYTE(0XFF);
|
||||
WRITE_BYTE(0xFF);
|
||||
WRITE_BYTE(0xFF);
|
||||
MESSAGE_END();
|
||||
|
||||
|
@ -4153,27 +4153,26 @@ int CBasePlayer::AmmoInventory( int iAmmoIndex )
|
|||
return m_rgAmmo[ iAmmoIndex ];
|
||||
}
|
||||
|
||||
int CBasePlayer::GetAmmoIndex(const char *psz)
|
||||
int CBasePlayer :: GetAmmoIndex( const char *psz )
|
||||
{
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (!psz || !stricmp( psz, "none" )) return -1;
|
||||
if( !psz || !stricmp( psz, "none" )) return -1;
|
||||
|
||||
for (i = 1; i < MAX_AMMO_SLOTS; i++)
|
||||
for( i = 1; i < MAX_AMMO_SLOTS; i++ )
|
||||
{
|
||||
if ( !CBasePlayerWeapon::AmmoInfoArray[i].pszName )
|
||||
if( !CBasePlayerWeapon::AmmoInfoArray[i].iszName )
|
||||
continue;
|
||||
|
||||
if (stricmp( psz, CBasePlayerWeapon::AmmoInfoArray[i].pszName ) == 0)
|
||||
if( !stricmp( psz, STRING( CBasePlayerWeapon::AmmoInfoArray[i].iszName )))
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char *CBasePlayer::GetAmmoName(int index )
|
||||
const char *CBasePlayer::GetAmmoName( int index )
|
||||
{
|
||||
return CBasePlayerWeapon::AmmoInfoArray[index].pszName;
|
||||
return STRING( CBasePlayerWeapon::AmmoInfoArray[index].iszName );
|
||||
}
|
||||
|
||||
// Called from UpdateClientData
|
||||
|
@ -4604,23 +4603,23 @@ void CBasePlayer :: UpdateClientData( void )
|
|||
{
|
||||
ItemInfo& II = CBasePlayerWeapon::ItemInfoArray[i];
|
||||
|
||||
if ( !II.iId )
|
||||
continue;
|
||||
if( !II.iId ) continue;
|
||||
|
||||
const char *pszName;
|
||||
if (!II.pszName) pszName = "Empty";
|
||||
else pszName = II.pszName;
|
||||
|
||||
if( !II.iszName )
|
||||
pszName = "Empty";
|
||||
else pszName = STRING( II.iszName );
|
||||
|
||||
MESSAGE_BEGIN( MSG_ONE, gmsg.WeaponList, NULL, pev );
|
||||
WRITE_STRING(pszName); // string weapon name
|
||||
WRITE_BYTE(GetAmmoIndex(II.pszAmmo1)); // byte Ammo Type
|
||||
WRITE_BYTE(II.iMaxAmmo1); // byte Max Ammo 1
|
||||
WRITE_BYTE(GetAmmoIndex(II.pszAmmo2)); // byte Ammo2 Type
|
||||
WRITE_BYTE(II.iMaxAmmo2); // byte Max Ammo 2
|
||||
WRITE_BYTE(II.iSlot); // byte bucket
|
||||
WRITE_BYTE(II.iPosition); // byte bucket pos
|
||||
WRITE_BYTE(II.iId); // byte id (bit index into pev->weapons)
|
||||
WRITE_BYTE(II.iFlags); // byte Flags
|
||||
WRITE_STRING( pszName ); // string weapon name
|
||||
WRITE_BYTE( GetAmmoIndex( STRING( II.iszAmmo1 ))); // byte Ammo Type
|
||||
WRITE_BYTE( II.iMaxAmmo1 ); // byte Max Ammo 1
|
||||
WRITE_BYTE( GetAmmoIndex(STRING( II.iszAmmo2 ))); // byte Ammo2 Type
|
||||
WRITE_BYTE( II.iMaxAmmo2 ); // byte Max Ammo 2
|
||||
WRITE_BYTE( II.iSlot ); // byte bucket
|
||||
WRITE_BYTE( II.iPosition ); // byte bucket pos
|
||||
WRITE_BYTE( II.iId ); // byte id (bit index into pev->weapons)
|
||||
WRITE_BYTE( II.iFlags ); // byte Flags
|
||||
MESSAGE_END();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#include "baseweapon.h"
|
||||
|
||||
LINK_ENTITY_TO_CLASS( weapon_m249, CBasePlayerWeapon );
|
||||
LINK_ENTITY_TO_CLASS( weapon_crossbow, CBasePlayerWeapon );
|
||||
LINK_ENTITY_TO_CLASS( weapon_crowbar, CBasePlayerWeapon );
|
||||
LINK_ENTITY_TO_CLASS( weapon_redeemer, CBasePlayerWeapon );
|
||||
LINK_ENTITY_TO_CLASS( weapon_eagle, CBasePlayerWeapon );
|
||||
|
|
4
todo.log
4
todo.log
|
@ -35,6 +35,8 @@ Beta 13.12.08
|
|||
14.move "loading" and "pause" into CHUD
|
||||
15.Get Rid Of DrawImage
|
||||
16.Copy Resources OK
|
||||
17.тормоза на больших картах
|
||||
18.weapon pickup & drawing
|
||||
|
||||
entity_state_t íåâèäèìà äëÿ ïîëüçîâàòåëÿ
|
||||
|
||||
|
@ -43,7 +45,7 @@ entity_state_t
|
|||
0. Q3Fusion (Mirrors, Portals)
|
||||
1. MhQuake (Caustics)
|
||||
2. Xash 0.45 (Mirrors, Portals, Monitors, Rain, Sky)
|
||||
3. Paranoia (Sky)
|
||||
3. Paranoia (Sky, Light)
|
||||
4. Quake2XP (Effects, Glass, Shadows)
|
||||
5. Tenebrae (Mirrors, Cubemap Projection, Bump)
|
||||
6. Darkplaces ALL!!!!!!!!!!!!!!!111111111111
|
||||
|
|
Reference in New Issue