mirror of https://github.com/FWGS/hlsdk-xash3d
A little optimizations.
This commit is contained in:
parent
b22ea2889f
commit
7c66c3aa9c
|
@ -802,7 +802,7 @@ int CHudAmmo::Draw( float flTime )
|
|||
int iCrossX;
|
||||
int iCrossY;
|
||||
int iCrossLength;
|
||||
char *chCrossHair = "+"; // Heh
|
||||
const char *chCrossHair = "+"; // Heh
|
||||
|
||||
//if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
|
||||
// return 1;
|
||||
|
@ -845,7 +845,7 @@ int CHudAmmo::Draw( float flTime )
|
|||
y = ScreenHeight - gHUD.m_iFontHeight - gHUD.m_iFontHeight / 2;
|
||||
|
||||
/******************* DRAW CROSSHAIR *********************/
|
||||
iCrossLength = gHUD.m_scrinfo.charWidths[*chCrossHair];
|
||||
iCrossLength = gHUD.m_scrinfo.charWidths[(unsigned char)*chCrossHair];
|
||||
iCrossY = ScreenHeight / 2 - gHUD.m_scrinfo.iCharHeight / 2;
|
||||
iCrossX = ScreenWidth / 2 - iCrossLength / 2;
|
||||
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
gHUD.y.UserCmd_##x( ); \
|
||||
}
|
||||
|
||||
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( (char*)x ); }
|
||||
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( (char*)x ); }
|
||||
inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int flags ) { return gEngfuncs.pfnRegisterVariable( (char*)cv, (char*)val, flags ); }
|
||||
inline float CVAR_GET_FLOAT( const char *x ) { return gEngfuncs.pfnGetCvarFloat( x ); }
|
||||
inline char* CVAR_GET_STRING( const char *x ) { return gEngfuncs.pfnGetCvarString( x ); }
|
||||
inline struct cvar_s *CVAR_CREATE( const char *cv, const char *val, const int flags ) { return gEngfuncs.pfnRegisterVariable( cv, val, flags ); }
|
||||
|
||||
#define SPR_Load ( *gEngfuncs.pfnSPR_Load )
|
||||
#define SPR_Set ( *gEngfuncs.pfnSPR_Set )
|
||||
|
@ -108,16 +108,16 @@ inline int TextMessageDrawChar( int x, int y, int number, int r, int g, int b )
|
|||
inline int DrawConsoleString( int x, int y, const char *string )
|
||||
{
|
||||
if( hud_textmode->value == 1 )
|
||||
return gHUD.DrawHudString( x, y, 9999, (char*)string, 255 * g_hud_text_color[0], 255 * g_hud_text_color[1], 255 * g_hud_text_color[2] );
|
||||
return gEngfuncs.pfnDrawConsoleString( x, y, (char*) string );
|
||||
return gHUD.DrawHudString( x, y, 9999, string, 255 * g_hud_text_color[0], 255 * g_hud_text_color[1], 255 * g_hud_text_color[2] );
|
||||
return gEngfuncs.pfnDrawConsoleString( x, y, string );
|
||||
}
|
||||
|
||||
inline void GetConsoleStringSize( const char *string, int *width, int *height )
|
||||
{
|
||||
if( hud_textmode->value == 1 )
|
||||
*height = 13, *width = gHUD.DrawHudStringLen( (char*)string );
|
||||
*height = 13, *width = gHUD.DrawHudStringLen( string );
|
||||
else
|
||||
gEngfuncs.pfnDrawConsoleStringLen( (char*)string, width, height );
|
||||
gEngfuncs.pfnDrawConsoleStringLen( string, width, height );
|
||||
}
|
||||
|
||||
int DrawUtfString( int xpos, int ypos, int iMaxX, const char *szIt, int r, int g, int b );
|
||||
|
@ -126,7 +126,7 @@ inline int ConsoleStringLen( const char *string )
|
|||
{
|
||||
int _width = 0, _height = 0;
|
||||
if( hud_textmode->value == 1 )
|
||||
return gHUD.DrawHudStringLen( (char*)string );
|
||||
return gHUD.DrawHudStringLen( string );
|
||||
GetConsoleStringSize( string, &_width, &_height );
|
||||
return _width;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,8 @@
|
|||
|
||||
extern "C" char PM_FindTextureType( char *name );
|
||||
|
||||
void V_PunchAxis( int axis, float punch );
|
||||
extern void EV_Quake_DecalTrace( pmtrace_t *pTrace, const char *decalName );
|
||||
extern void V_PunchAxis( int axis, float punch );
|
||||
extern vec3_t v_origin;
|
||||
|
||||
extern "C"
|
||||
|
@ -88,7 +89,7 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
|
|||
int cnt;
|
||||
float fattn = ATTN_NORM;
|
||||
int entity;
|
||||
char *pTextureName;
|
||||
const char *pTextureName;
|
||||
char texname[64];
|
||||
char szbuffer[64];
|
||||
|
||||
|
@ -108,7 +109,7 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
|
|||
else if( entity == 0 )
|
||||
{
|
||||
// get texture from entity or world (world is ent(0))
|
||||
pTextureName = (char *)gEngfuncs.pEventAPI->EV_TraceTexture( ptr->ent, vecSrc, vecEnd );
|
||||
pTextureName = gEngfuncs.pEventAPI->EV_TraceTexture( ptr->ent, vecSrc, vecEnd );
|
||||
|
||||
if( pTextureName )
|
||||
{
|
||||
|
@ -138,47 +139,63 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
|
|||
switch( chTextureType )
|
||||
{
|
||||
default:
|
||||
case CHAR_TEX_CONCRETE: fvol = 0.9; fvolbar = 0.6;
|
||||
case CHAR_TEX_CONCRETE:
|
||||
fvol = 0.9;
|
||||
fvolbar = 0.6;
|
||||
rgsz[0] = "player/pl_step1.wav";
|
||||
rgsz[1] = "player/pl_step2.wav";
|
||||
cnt = 2;
|
||||
break;
|
||||
case CHAR_TEX_METAL: fvol = 0.9; fvolbar = 0.3;
|
||||
case CHAR_TEX_METAL:
|
||||
fvol = 0.9;
|
||||
fvolbar = 0.3;
|
||||
rgsz[0] = "player/pl_metal1.wav";
|
||||
rgsz[1] = "player/pl_metal2.wav";
|
||||
cnt = 2;
|
||||
break;
|
||||
case CHAR_TEX_DIRT: fvol = 0.9; fvolbar = 0.1;
|
||||
case CHAR_TEX_DIRT:
|
||||
fvol = 0.9;
|
||||
fvolbar = 0.1;
|
||||
rgsz[0] = "player/pl_dirt1.wav";
|
||||
rgsz[1] = "player/pl_dirt2.wav";
|
||||
rgsz[2] = "player/pl_dirt3.wav";
|
||||
cnt = 3;
|
||||
break;
|
||||
case CHAR_TEX_VENT: fvol = 0.5; fvolbar = 0.3;
|
||||
case CHAR_TEX_VENT:
|
||||
fvol = 0.5;
|
||||
fvolbar = 0.3;
|
||||
rgsz[0] = "player/pl_duct1.wav";
|
||||
rgsz[1] = "player/pl_duct1.wav";
|
||||
cnt = 2;
|
||||
break;
|
||||
case CHAR_TEX_GRATE: fvol = 0.9; fvolbar = 0.5;
|
||||
case CHAR_TEX_GRATE:
|
||||
fvol = 0.9;
|
||||
fvolbar = 0.5;
|
||||
rgsz[0] = "player/pl_grate1.wav";
|
||||
rgsz[1] = "player/pl_grate4.wav";
|
||||
cnt = 2;
|
||||
break;
|
||||
case CHAR_TEX_TILE: fvol = 0.8; fvolbar = 0.2;
|
||||
case CHAR_TEX_TILE:
|
||||
fvol = 0.8;
|
||||
fvolbar = 0.2;
|
||||
rgsz[0] = "player/pl_tile1.wav";
|
||||
rgsz[1] = "player/pl_tile3.wav";
|
||||
rgsz[2] = "player/pl_tile2.wav";
|
||||
rgsz[3] = "player/pl_tile4.wav";
|
||||
cnt = 4;
|
||||
break;
|
||||
case CHAR_TEX_SLOSH: fvol = 0.9; fvolbar = 0.0;
|
||||
case CHAR_TEX_SLOSH:
|
||||
fvol = 0.9;
|
||||
fvolbar = 0.0;
|
||||
rgsz[0] = "player/pl_slosh1.wav";
|
||||
rgsz[1] = "player/pl_slosh3.wav";
|
||||
rgsz[2] = "player/pl_slosh2.wav";
|
||||
rgsz[3] = "player/pl_slosh4.wav";
|
||||
cnt = 4;
|
||||
break;
|
||||
case CHAR_TEX_WOOD: fvol = 0.9; fvolbar = 0.2;
|
||||
case CHAR_TEX_WOOD:
|
||||
fvol = 0.9;
|
||||
fvolbar = 0.2;
|
||||
rgsz[0] = "debris/wood1.wav";
|
||||
rgsz[1] = "debris/wood2.wav";
|
||||
rgsz[2] = "debris/wood3.wav";
|
||||
|
@ -186,7 +203,8 @@ float EV_HLDM_PlayTextureSound( int idx, pmtrace_t *ptr, float *vecSrc, float *v
|
|||
break;
|
||||
case CHAR_TEX_GLASS:
|
||||
case CHAR_TEX_COMPUTER:
|
||||
fvol = 0.8; fvolbar = 0.2;
|
||||
fvol = 0.8;
|
||||
fvolbar = 0.2;
|
||||
rgsz[0] = "debris/glass1.wav";
|
||||
rgsz[1] = "debris/glass2.wav";
|
||||
rgsz[2] = "debris/glass3.wav";
|
||||
|
@ -213,9 +231,7 @@ bool CheckPVS( int playerIndex )
|
|||
{
|
||||
//returns true if the player is in the same PVS
|
||||
cl_entity_t *localPlayer = gEngfuncs.GetLocalPlayer();
|
||||
cl_entity_t *player;
|
||||
|
||||
player = gEngfuncs.GetEntityByIndex( playerIndex );
|
||||
cl_entity_t *player = gEngfuncs.GetEntityByIndex( playerIndex );
|
||||
|
||||
if( !player || !localPlayer )
|
||||
return false;
|
||||
|
@ -229,90 +245,120 @@ bool CheckPVS( int playerIndex )
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
char *EV_HLDM_RocketDamageDecal( void )
|
||||
const char *EV_HLDM_RocketDamageDecal()
|
||||
{
|
||||
static char decalname[ 32 ];
|
||||
const char *pszDecalName;
|
||||
int idx;
|
||||
|
||||
idx = gEngfuncs.pfnRandomLong( 1, 3 );
|
||||
sprintf( decalname, "{scorch%i", idx );
|
||||
return decalname;
|
||||
}
|
||||
|
||||
char *EV_HLDM_DamageDecal( void )
|
||||
{
|
||||
static char decalname[ 32 ];
|
||||
int idx;
|
||||
|
||||
idx = gEngfuncs.pfnRandomLong( 0, 4 );
|
||||
sprintf( decalname, "{shot%i", idx + 1 );
|
||||
return decalname;
|
||||
}
|
||||
|
||||
|
||||
char *EV_Lightning_DamageDecal( void )
|
||||
{
|
||||
int idx;
|
||||
static char decalname[ 32 ];
|
||||
//sprintf( decalname, "{smscorch1");
|
||||
|
||||
idx = gEngfuncs.pfnRandomLong( 0, 2 );
|
||||
sprintf( decalname, "{smscorch%i", idx + 1 );
|
||||
|
||||
return decalname;
|
||||
switch( idx + 1 )
|
||||
{
|
||||
case 1:
|
||||
pszDecalName = "{scorch1";
|
||||
break;
|
||||
case 2:
|
||||
pszDecalName = "{scorch2";
|
||||
break;
|
||||
case 3:
|
||||
pszDecalName = "{scorch3";
|
||||
break;
|
||||
}
|
||||
|
||||
char *EV_Quake_DamageDecalClub( void )
|
||||
return pszDecalName;
|
||||
}
|
||||
|
||||
const char *EV_HLDM_DamageDecal()
|
||||
{
|
||||
static char decalname[ 32 ];
|
||||
const char *pszDecalName;
|
||||
int idx = gEngfuncs.pfnRandomLong( 0, 4 );
|
||||
|
||||
switch( idx + 1 )
|
||||
{
|
||||
case 1:
|
||||
pszDecalName = "{shot1";
|
||||
break;
|
||||
case 2:
|
||||
pszDecalName = "{shot2";
|
||||
break;
|
||||
case 3:
|
||||
pszDecalName = "{shot3";
|
||||
break;
|
||||
case 4:
|
||||
pszDecalName = "{shot4";
|
||||
break;
|
||||
case 5:
|
||||
pszDecalName = "{shot5";
|
||||
break;
|
||||
}
|
||||
return pszDecalName;
|
||||
}
|
||||
|
||||
|
||||
const char *EV_Lightning_DamageDecal( void )
|
||||
{
|
||||
const char *pszDecalName;
|
||||
int idx;
|
||||
|
||||
idx = gEngfuncs.pfnRandomLong( 0, 4 );
|
||||
sprintf( decalname, "{shot%i", idx + 1 );
|
||||
return decalname;
|
||||
idx = gEngfuncs.pfnRandomLong( 0, 2 );
|
||||
switch( idx + 1 )
|
||||
{
|
||||
case 1:
|
||||
pszDecalName = "{smscorch1";
|
||||
break;
|
||||
case 2:
|
||||
pszDecalName = "{smscorch2";
|
||||
break;
|
||||
case 3:
|
||||
pszDecalName = "{smscorch3";
|
||||
break;
|
||||
}
|
||||
|
||||
void EV_Quake_GunshotDecalTrace( pmtrace_t *pTrace, char *decalName )
|
||||
return pszDecalName;
|
||||
}
|
||||
|
||||
const char *EV_Quake_DamageDecalClub()
|
||||
{
|
||||
return EV_HLDM_DamageDecal();
|
||||
}
|
||||
|
||||
void EV_Quake_GunshotDecalTrace( pmtrace_t *pTrace, const char *decalName )
|
||||
{
|
||||
int iRand;
|
||||
physent_t *pe;
|
||||
|
||||
gEngfuncs.pEfxAPI->R_BulletImpactParticles( pTrace->endpos );
|
||||
|
||||
iRand = gEngfuncs.pfnRandomLong( 0, 0x7FFF );
|
||||
if( iRand < ( 0x7fff / 2 ) )// not every bullet makes a sound.
|
||||
{
|
||||
const char *pszSound;
|
||||
|
||||
switch( iRand % 5 )
|
||||
{
|
||||
case 0: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 1: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 2: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 3: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 4: gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, "weapons/ric5.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 0:
|
||||
pszSound = "weapons/ric1.wav";
|
||||
break;
|
||||
case 1:
|
||||
pszSound = "weapons/ric2.wav";
|
||||
break;
|
||||
case 2:
|
||||
pszSound = "weapons/ric3.wav";
|
||||
break;
|
||||
case 3:
|
||||
pszSound = "weapons/ric4.wav";
|
||||
break;
|
||||
case 4:
|
||||
pszSound = "weapons/ric5.wav";
|
||||
break;
|
||||
}
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( -1, pTrace->endpos, 0, pszSound, 1.0, ATTN_NORM, 0, PITCH_NORM );
|
||||
}
|
||||
|
||||
pe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );
|
||||
EV_Quake_DecalTrace( pTrace, decalName );
|
||||
}
|
||||
|
||||
// Only decal brush models such as the world etc.
|
||||
if ( decalName && decalName[0] && pe && ( pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP ) )
|
||||
void EV_Quake_DecalTrace( pmtrace_t *pTrace, const char *decalName )
|
||||
{
|
||||
if ( CVAR_GET_FLOAT( "r_decals" ) )
|
||||
{
|
||||
gEngfuncs.pEfxAPI->R_DecalShoot(
|
||||
gEngfuncs.pEfxAPI->Draw_DecalIndex( gEngfuncs.pEfxAPI->Draw_DecalIndexFromName( decalName ) ),
|
||||
gEngfuncs.pEventAPI->EV_IndexFromTrace( pTrace ), 0, pTrace->endpos, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EV_Quake_DecalTrace( pmtrace_t *pTrace, char *decalName )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
pe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );
|
||||
physent_t *pe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );
|
||||
|
||||
// Only decal brush models such as the world etc.
|
||||
if( decalName && decalName[0] && pe && ( pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP ) )
|
||||
|
@ -328,18 +374,15 @@ void EV_Quake_DecalTrace( pmtrace_t *pTrace, char *decalName )
|
|||
|
||||
void EV_HLDM_DecalGunshot( pmtrace_t *pTrace, int iBulletType )
|
||||
{
|
||||
physent_t *pe;
|
||||
// physent_t *pe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );
|
||||
|
||||
pe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );
|
||||
|
||||
if ( pe && pe->solid == SOLID_BSP )
|
||||
// if( pe && pe->solid == SOLID_BSP )
|
||||
{
|
||||
switch( iBulletType )
|
||||
{
|
||||
case BULLET_PLAYER_CROWBAR:
|
||||
EV_Quake_DecalTrace( pTrace, EV_Quake_DamageDecalClub() );
|
||||
break;
|
||||
|
||||
case BULLET_PLAYER_9MM:
|
||||
case BULLET_MONSTER_9MM:
|
||||
case BULLET_PLAYER_MP5:
|
||||
|
@ -383,7 +426,8 @@ void EV_Quake_FireBullets( int idx, float *forward, float *right, float *up, int
|
|||
|
||||
// get circular gaussian spread
|
||||
vec3_t spread;
|
||||
do {
|
||||
do
|
||||
{
|
||||
spread[0] = gEngfuncs.pfnRandomFloat( -1.0, 1.0 ) + gEngfuncs.pfnRandomFloat( -1.0, 1.0 );
|
||||
spread[1] = gEngfuncs.pfnRandomFloat( -1.0, 1.0 ) + gEngfuncs.pfnRandomFloat( -1.0, 1.0 );
|
||||
spread[2] = spread[0] * spread[0] + spread[1] *spread[1];
|
||||
|
@ -415,9 +459,7 @@ void EV_Quake_FireBullets( int idx, float *forward, float *right, float *up, int
|
|||
{
|
||||
default:
|
||||
case BULLET_PLAYER_9MM:
|
||||
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
|
||||
EV_HLDM_DecalGunshot( &tr, iBulletType );
|
||||
break;
|
||||
case BULLET_PLAYER_357:
|
||||
case BULLET_PLAYER_MP5:
|
||||
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
|
||||
EV_HLDM_DecalGunshot( &tr, iBulletType );
|
||||
|
@ -425,10 +467,6 @@ void EV_Quake_FireBullets( int idx, float *forward, float *right, float *up, int
|
|||
case BULLET_PLAYER_BUCKSHOT:
|
||||
EV_HLDM_DecalGunshot( &tr, iBulletType );
|
||||
break;
|
||||
case BULLET_PLAYER_357:
|
||||
EV_HLDM_PlayTextureSound( idx, &tr, vecSrc, vecEnd, iBulletType );
|
||||
EV_HLDM_DecalGunshot( &tr, iBulletType );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -463,12 +501,9 @@ void EV_FireShotGunDouble( event_args_t *args )
|
|||
EV_GetGunPosition( args, vecSrc, origin );
|
||||
VectorCopy( forward, vecAiming );
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
vecSpread[0] = 0.04;
|
||||
vecSpread[1] = 0.04;
|
||||
vecSpread[2] = 0.00;
|
||||
}
|
||||
|
||||
EV_Quake_FireBullets( idx, forward, right, up, 14, vecSrc, vecAiming, vecSpread );
|
||||
|
||||
|
@ -506,12 +541,9 @@ void EV_FireShotGunSingle( event_args_t *args )
|
|||
EV_GetGunPosition( args, vecSrc, origin );
|
||||
VectorCopy( forward, vecAiming );
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
{
|
||||
vecSpread[0] = 0.04;
|
||||
vecSpread[1] = 0.04;
|
||||
vecSpread[2] = 0.00;
|
||||
}
|
||||
|
||||
EV_Quake_FireBullets( idx, forward, right, up, 6, vecSrc, vecAiming, vecSpread );
|
||||
|
||||
|
@ -525,27 +557,27 @@ enum soundtypes_e
|
|||
{
|
||||
SOUND_MISS,
|
||||
SOUND_HIT_BODY,
|
||||
SOUND_HIT_WALL,
|
||||
SOUND_HIT_WALL
|
||||
};
|
||||
|
||||
void EV_Quake_PlayAxeSound( int idx, float *origin, int iSoundType )
|
||||
{
|
||||
const char *pszSound;
|
||||
|
||||
switch( iSoundType )
|
||||
{
|
||||
case SOUND_HIT_BODY:
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "player/axhitbod.wav", 1, ATTN_NORM, 0, PITCH_NORM);
|
||||
pszSound = "player/axhitbod.wav";
|
||||
break;
|
||||
|
||||
case SOUND_HIT_WALL:
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "player/axhit2.wav", 1, ATTN_NORM, 0, PITCH_NORM);
|
||||
pszSound = "player/axhit2.wav";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, pszSound, 1, ATTN_NORM, 0, PITCH_NORM );
|
||||
}
|
||||
|
||||
|
||||
void EV_FireAxe( event_args_t *args )
|
||||
{
|
||||
int ent;
|
||||
|
@ -598,7 +630,6 @@ void EV_FireAxe( event_args_t *args )
|
|||
}
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PopPMStates();
|
||||
|
||||
}
|
||||
|
||||
void EV_FireAxeSwing( event_args_t *args )
|
||||
|
@ -683,7 +714,7 @@ void EV_PlayerPowerup (event_args_t *args)
|
|||
int iPowerUp = (int)args->fparam1;
|
||||
|
||||
int modelIndex;
|
||||
char *model = "sprites/smoke.spr";
|
||||
const char *model = "sprites/smoke.spr";
|
||||
|
||||
modelIndex = gEngfuncs.pEventAPI->EV_FindModelIndex( model );
|
||||
|
||||
|
@ -756,7 +787,6 @@ void EV_FireLightning( event_args_t *args )
|
|||
origin = origin + Vector( 0, 0, 16 );
|
||||
}
|
||||
|
||||
|
||||
if( bSound )
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_WEAPON, "weapons/lhit.wav", 1.0, ATTN_NORM, 0, PITCH_NORM );
|
||||
|
@ -847,17 +877,11 @@ void EV_FireGrenade( event_args_t *args )
|
|||
|
||||
void EV_Quake_NailTouch( struct tempent_s *ent, pmtrace_t *ptr )
|
||||
{
|
||||
char decalname[ 32 ];
|
||||
int idx;
|
||||
physent_t *pe;
|
||||
//physent_t *pe = gEngfuncs.pEventAPI->EV_GetPhysent( ptr->ent );
|
||||
|
||||
pe = gEngfuncs.pEventAPI->EV_GetPhysent( ptr->ent );
|
||||
if ( pe && ( pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP ) )
|
||||
//if( pe && ( pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP ) )
|
||||
{
|
||||
decalname[ 0 ] = '\0';
|
||||
idx = gEngfuncs.pfnRandomLong( 0, 4 );
|
||||
sprintf( decalname, "{shot%i", idx + 1 );
|
||||
EV_Quake_GunshotDecalTrace( ptr, decalname );
|
||||
EV_Quake_GunshotDecalTrace( ptr, EV_HLDM_DamageDecal() );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -944,7 +968,7 @@ void EV_TrainPitchAdjust( event_args_t *args )
|
|||
int pitch;
|
||||
int stop;
|
||||
|
||||
char sz[ 256 ];
|
||||
const char *pszSound;
|
||||
|
||||
idx = args->entindex;
|
||||
|
||||
|
@ -959,60 +983,77 @@ void EV_TrainPitchAdjust( event_args_t *args )
|
|||
|
||||
switch( noise )
|
||||
{
|
||||
case 1: strcpy( sz, "plats/ttrain1.wav"); break;
|
||||
case 2: strcpy( sz, "plats/ttrain2.wav"); break;
|
||||
case 3: strcpy( sz, "plats/ttrain3.wav"); break;
|
||||
case 4: strcpy( sz, "plats/ttrain4.wav"); break;
|
||||
case 5: strcpy( sz, "plats/ttrain6.wav"); break;
|
||||
case 6: strcpy( sz, "plats/ttrain7.wav"); break;
|
||||
case 1:
|
||||
pszSound = "plats/ttrain1.wav";
|
||||
break;
|
||||
case 2:
|
||||
pszSound = "plats/ttrain2.wav";
|
||||
break;
|
||||
case 3:
|
||||
pszSound = "plats/ttrain3.wav";
|
||||
break;
|
||||
case 4:
|
||||
pszSound = "plats/ttrain4.wav";
|
||||
break;
|
||||
case 5:
|
||||
pszSound = "plats/ttrain6.wav";
|
||||
break;
|
||||
case 6:
|
||||
pszSound = "plats/ttrain7.wav";
|
||||
break;
|
||||
default:
|
||||
// no sound
|
||||
strcpy( sz, "" );
|
||||
return;
|
||||
}
|
||||
|
||||
if( stop )
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, sz );
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, pszSound );
|
||||
}
|
||||
else
|
||||
{
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, sz, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, origin, CHAN_STATIC, pszSound, m_flVolume, ATTN_NORM, SND_CHANGE_PITCH, pitch );
|
||||
}
|
||||
}
|
||||
|
||||
char *DMC_BloodDecal (void)
|
||||
const char *DMC_BloodDecal()
|
||||
{
|
||||
static char blooddecal[ 32 ];
|
||||
int idx;
|
||||
const char *pszDecalName;
|
||||
int idx = gEngfuncs.pfnRandomLong( 0, 5 );
|
||||
|
||||
idx = gEngfuncs.pfnRandomLong( 0, 5 );
|
||||
|
||||
sprintf( blooddecal, "{blood%i", idx + 1 );
|
||||
|
||||
return blooddecal;
|
||||
switch( idx + 1 )
|
||||
{
|
||||
case 1:
|
||||
pszDecalName = "{blood1";
|
||||
break;
|
||||
case 2:
|
||||
pszDecalName = "{blood2";
|
||||
break;
|
||||
case 3:
|
||||
pszDecalName = "{blood3";
|
||||
break;
|
||||
case 4:
|
||||
pszDecalName = "{blood4";
|
||||
break;
|
||||
case 5:
|
||||
pszDecalName = "{blood5";
|
||||
break;
|
||||
case 6:
|
||||
pszDecalName = "{blood6";
|
||||
break;
|
||||
}
|
||||
return pszDecalName;
|
||||
}
|
||||
|
||||
void DMC_DecalTrace( pmtrace_t *pTrace, char *decalName )
|
||||
void DMC_DecalTrace( pmtrace_t *pTrace, const char *decalName )
|
||||
{
|
||||
physent_t *pe;
|
||||
|
||||
pe = gEngfuncs.pEventAPI->EV_GetPhysent( pTrace->ent );
|
||||
|
||||
// Only decal brush models such as the world etc.
|
||||
if ( decalName && decalName[0] && pe && ( pe->solid == SOLID_BSP || pe->movetype == MOVETYPE_PUSHSTEP ) )
|
||||
{
|
||||
if ( CVAR_GET_FLOAT( "r_decals" ) )
|
||||
{
|
||||
gEngfuncs.pEfxAPI->R_DecalShoot(
|
||||
gEngfuncs.pEfxAPI->Draw_DecalIndex( gEngfuncs.pEfxAPI->Draw_DecalIndexFromName( decalName ) ),
|
||||
gEngfuncs.pEventAPI->EV_IndexFromTrace( pTrace ), 0, pTrace->endpos, 0 );
|
||||
}
|
||||
}
|
||||
EV_Quake_DecalTrace( pTrace, decalName );
|
||||
}
|
||||
|
||||
void EV_GibTouch( struct tempent_s *ent, struct pmtrace_s *ptr )
|
||||
{
|
||||
const char *pszSound;
|
||||
|
||||
DMC_DecalTrace( ptr, DMC_BloodDecal() );
|
||||
|
||||
// 1 in 5 chance of squishy sound
|
||||
|
@ -1021,20 +1062,31 @@ void EV_GibTouch ( struct tempent_s *ent, struct pmtrace_s *ptr )
|
|||
|
||||
switch( gEngfuncs.pfnRandomLong( 0, 5 ) )
|
||||
{
|
||||
case 0 : gEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, "debris/flesh1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 1 : gEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, "debris/flesh2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 2 : gEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, "debris/flesh3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 3 : gEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, "debris/flesh5.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 4 : gEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, "debris/flesh6.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 5 : gEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, "debris/flesh7.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 0:
|
||||
pszSound = "debris/flesh1.wav";
|
||||
break;
|
||||
case 1:
|
||||
pszSound = "debris/flesh2.wav";
|
||||
break;
|
||||
case 2:
|
||||
pszSound = "debris/flesh3.wav";
|
||||
break;
|
||||
case 3:
|
||||
pszSound = "debris/flesh5.wav";
|
||||
break;
|
||||
case 4:
|
||||
pszSound = "debris/flesh6.wav";
|
||||
break;
|
||||
case 5:
|
||||
pszSound = "debris/flesh7.wav";
|
||||
break;
|
||||
}
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( 0, ptr->endpos, CHAN_STATIC, pszSound, 1.0, ATTN_NORM, 0, PITCH_NORM );
|
||||
}
|
||||
|
||||
void EV_GibParticleCallback( struct particle_s *particle, float frametime )
|
||||
{
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < 3; i++ )
|
||||
for( int i = 0; i < 3; i++ )
|
||||
{
|
||||
particle->org[i] += particle->vel[i] * frametime;
|
||||
}
|
||||
|
@ -1042,14 +1094,10 @@ void EV_GibParticleCallback( struct particle_s *particle, float frametime )
|
|||
|
||||
void EV_Gibbed( event_args_t *args )
|
||||
{
|
||||
|
||||
vec3_t origin, velocity, angles, rotate;
|
||||
int modelindex, i;
|
||||
TEMPENTITY *pGib = NULL;
|
||||
int gibs = 5;
|
||||
char *model1 = "models/gib_1.mdl";
|
||||
char *model2 = "models/gib_2.mdl";
|
||||
char *model3 = "models/gib_3.mdl";
|
||||
|
||||
VectorCopy( args->origin, origin );
|
||||
|
||||
|
@ -1061,15 +1109,25 @@ void EV_Gibbed (event_args_t *args)
|
|||
|
||||
for( i = 0; i < gibs; i++ )
|
||||
{
|
||||
const char *pszModel;
|
||||
|
||||
switch( gEngfuncs.pfnRandomLong( 1, 3 ) )
|
||||
{
|
||||
case 1: modelindex = gEngfuncs.pEventAPI->EV_FindModelIndex ( model1 ); break;
|
||||
case 2: modelindex = gEngfuncs.pEventAPI->EV_FindModelIndex ( model2 ); break;
|
||||
case 3: modelindex = gEngfuncs.pEventAPI->EV_FindModelIndex ( model3 ); break;
|
||||
//Just in case
|
||||
default: modelindex = gEngfuncs.pEventAPI->EV_FindModelIndex ( model1 ); break;
|
||||
default:
|
||||
case 1:
|
||||
pszModel = "models/gib_1.mdl";
|
||||
break;
|
||||
case 2:
|
||||
pszModel = "models/gib_2.mdl";
|
||||
break;
|
||||
case 3:
|
||||
pszModel = "models/gib_3.mdl";
|
||||
break;
|
||||
}
|
||||
|
||||
modelindex = gEngfuncs.pEventAPI->EV_FindModelIndex( pszModel );
|
||||
|
||||
if( !modelindex )
|
||||
return;
|
||||
|
||||
|
@ -1086,11 +1144,10 @@ void EV_Gibbed (event_args_t *args)
|
|||
|
||||
pGib = gEngfuncs.pEfxAPI->R_TempModel( origin, velocity, rotate, 15, modelindex, TE_BOUNCE_NULL );
|
||||
|
||||
if (pGib != NULL)
|
||||
if( pGib )
|
||||
{
|
||||
pGib->flags |= ( FTENT_COLLIDEWORLD | FTENT_ROTATE | FTENT_FADEOUT | FTENT_CLIENTCUSTOM | FTENT_SMOKETRAIL );
|
||||
pGib->hitcallback = EV_GibTouch;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1098,19 +1155,31 @@ void EV_Gibbed (event_args_t *args)
|
|||
//Spawns the teleport effect.
|
||||
void EV_Teleport( event_args_t *args )
|
||||
{
|
||||
const char *pszSound;
|
||||
vec3_t vecOrg;
|
||||
|
||||
VectorCopy( args->origin, vecOrg );
|
||||
|
||||
switch( gEngfuncs.pfnRandomLong( 0, 4 ) )
|
||||
{
|
||||
case 0 : gEngfuncs.pEventAPI->EV_PlaySound( 0, vecOrg, CHAN_STATIC, "misc/r_tele1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 1 : gEngfuncs.pEventAPI->EV_PlaySound( 0, vecOrg, CHAN_STATIC, "misc/r_tele2.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 2 : gEngfuncs.pEventAPI->EV_PlaySound( 0, vecOrg, CHAN_STATIC, "misc/r_tele3.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 3 : gEngfuncs.pEventAPI->EV_PlaySound( 0, vecOrg, CHAN_STATIC, "misc/r_tele4.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 4 : gEngfuncs.pEventAPI->EV_PlaySound( 0, vecOrg, CHAN_STATIC, "misc/r_tele5.wav", 1.0, ATTN_NORM, 0, PITCH_NORM ); break;
|
||||
case 0:
|
||||
pszSound = "misc/r_tele1.wav";
|
||||
break;
|
||||
case 1:
|
||||
pszSound = "misc/r_tele2.wav";
|
||||
break;
|
||||
case 2:
|
||||
pszSound = "misc/r_tele3.wav";
|
||||
break;
|
||||
case 3:
|
||||
pszSound = "misc/r_tele4.wav";
|
||||
break;
|
||||
case 4:
|
||||
pszSound = "misc/r_tele5.wav";
|
||||
break;
|
||||
}
|
||||
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( 0, vecOrg, CHAN_STATIC, pszSound, 1.0, ATTN_NORM, 0, PITCH_NORM );
|
||||
gEngfuncs.pEfxAPI->R_TeleportSplash( vecOrg );
|
||||
}
|
||||
|
||||
|
@ -1172,7 +1241,7 @@ void EV_Explosion (event_args_t *args)
|
|||
{
|
||||
vec3_t origin, scorch_origin, velocity, forward, right, up;
|
||||
int modelIndex;
|
||||
char *model = "sprites/zerogxplode.spr";
|
||||
const char *model = "sprites/zerogxplode.spr";
|
||||
modelIndex = gEngfuncs.pEventAPI->EV_FindModelIndex( model );
|
||||
pmtrace_t tr;
|
||||
|
||||
|
@ -1196,20 +1265,18 @@ void EV_Explosion (event_args_t *args)
|
|||
|
||||
gEngfuncs.pEventAPI->EV_PopPMStates();
|
||||
|
||||
|
||||
DMC_DecalTrace( &tr, EV_HLDM_RocketDamageDecal() );
|
||||
|
||||
}
|
||||
|
||||
#define EV_DMC_MOVE_SOUND 0
|
||||
#define EV_DMC_STOP_SOUND 1
|
||||
char *EV_DMC_LookupDoorSound( int type, int index )
|
||||
const char *EV_DMC_LookupDoorSound( int type, int index )
|
||||
{
|
||||
static char sound[ 128 ];
|
||||
const char *pszSound;
|
||||
int idx;
|
||||
|
||||
// Assume the worst
|
||||
strcpy( sound, "common/null.wav");
|
||||
pszSound = "common/null.wav";
|
||||
|
||||
if( type == EV_DMC_MOVE_SOUND )
|
||||
{
|
||||
|
@ -1217,41 +1284,39 @@ char *EV_DMC_LookupDoorSound( int type, int index )
|
|||
|
||||
switch( idx )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
strcpy( sound, "common/null.wav");
|
||||
pszSound = "common/null.wav";
|
||||
break;
|
||||
case 1:
|
||||
strcpy( sound, "doors/doormove1.wav");
|
||||
pszSound = "doors/doormove1.wav";
|
||||
break;
|
||||
case 2:
|
||||
strcpy( sound, "doors/doormove2.wav");
|
||||
pszSound = "doors/doormove2.wav";
|
||||
break;
|
||||
case 3:
|
||||
strcpy( sound, "doors/doormove3.wav");
|
||||
pszSound = "doors/doormove3.wav";
|
||||
break;
|
||||
case 4:
|
||||
strcpy( sound, "doors/doormove4.wav");
|
||||
pszSound = "doors/doormove4.wav";
|
||||
break;
|
||||
case 5:
|
||||
strcpy( sound, "doors/doormove5.wav");
|
||||
pszSound = "doors/doormove5.wav";
|
||||
break;
|
||||
case 6:
|
||||
strcpy( sound, "doors/doormove6.wav");
|
||||
pszSound = "doors/doormove6.wav";
|
||||
break;
|
||||
case 7:
|
||||
strcpy( sound, "doors/doormove7.wav");
|
||||
pszSound = "doors/doormove7.wav";
|
||||
break;
|
||||
case 8:
|
||||
strcpy( sound, "doors/doormove8.wav");
|
||||
pszSound = "doors/doormove8.wav";
|
||||
break;
|
||||
case 9:
|
||||
strcpy( sound, "doors/doormove9.wav");
|
||||
pszSound = "doors/doormove9.wav";
|
||||
break;
|
||||
case 10:
|
||||
strcpy( sound, "doors/doormove10.wav");
|
||||
break;
|
||||
default:
|
||||
strcpy( sound, "common/null.wav");
|
||||
pszSound = "doors/doormove10.wav";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1262,39 +1327,37 @@ char *EV_DMC_LookupDoorSound( int type, int index )
|
|||
// set the door's 'reached destination' stop sound
|
||||
switch( idx )
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
strcpy( sound, "common/null.wav");
|
||||
pszSound = "common/null.wav";
|
||||
break;
|
||||
case 1:
|
||||
strcpy( sound, "doors/doorstop1.wav");
|
||||
pszSound = "doors/doorstop1.wav";
|
||||
break;
|
||||
case 2:
|
||||
strcpy( sound, "doors/doorstop2.wav");
|
||||
pszSound = "doors/doorstop2.wav";
|
||||
break;
|
||||
case 3:
|
||||
strcpy( sound, "doors/doorstop3.wav");
|
||||
pszSound = "doors/doorstop3.wav";
|
||||
break;
|
||||
case 4:
|
||||
strcpy( sound, "doors/doorstop4.wav");
|
||||
pszSound = "doors/doorstop4.wav";
|
||||
break;
|
||||
case 5:
|
||||
strcpy( sound, "doors/doorstop5.wav");
|
||||
pszSound = "doors/doorstop5.wav";
|
||||
break;
|
||||
case 6:
|
||||
strcpy( sound, "doors/doorstop6.wav");
|
||||
pszSound = "doors/doorstop6.wav";
|
||||
break;
|
||||
case 7:
|
||||
strcpy( sound, "doors/doorstop7.wav");
|
||||
pszSound = "doors/doorstop7.wav";
|
||||
break;
|
||||
case 8:
|
||||
strcpy( sound, "doors/doorstop8.wav");
|
||||
break;
|
||||
default:
|
||||
strcpy( sound, "common/null.wav");
|
||||
pszSound = "doors/doorstop8.wav";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return sound;
|
||||
return pszSound;
|
||||
}
|
||||
|
||||
void EV_DMC_DoorGoUp( event_args_t *args )
|
||||
|
@ -1308,11 +1371,14 @@ void EV_DMC_DoorGoUp( event_args_t *args )
|
|||
|
||||
void EV_DMC_DoorGoDown( event_args_t *args )
|
||||
{
|
||||
EV_DMC_DoorGoUp( args );
|
||||
/*
|
||||
int idx = -1;
|
||||
int soundindex = args->iparam1;
|
||||
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, EV_DMC_LookupDoorSound( EV_DMC_MOVE_SOUND, soundindex ));
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, args->origin, CHAN_STATIC, EV_DMC_LookupDoorSound( EV_DMC_MOVE_SOUND, soundindex ), 1.0, ATTN_NORM, 0, PITCH_NORM );
|
||||
*/
|
||||
}
|
||||
|
||||
void EV_DMC_DoorHitTop( event_args_t *args )
|
||||
|
@ -1326,11 +1392,12 @@ void EV_DMC_DoorHitTop( event_args_t *args )
|
|||
|
||||
void EV_DMC_DoorHitBottom( event_args_t *args )
|
||||
{
|
||||
EV_DMC_DoorHitTop( args );
|
||||
/*
|
||||
int idx = -1;
|
||||
int soundindex = args->iparam1;
|
||||
|
||||
gEngfuncs.pEventAPI->EV_StopSound( idx, CHAN_STATIC, EV_DMC_LookupDoorSound( EV_DMC_MOVE_SOUND, soundindex ) );
|
||||
gEngfuncs.pEventAPI->EV_PlaySound( idx, args->origin, CHAN_STATIC, EV_DMC_LookupDoorSound( EV_DMC_STOP_SOUND, soundindex ), 1.0, ATTN_NORM, 0, PITCH_NORM );
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -317,8 +317,8 @@ void CBasePlayerItem::AttachToPlayer ( CBasePlayer *pPlayer ) { }
|
|||
int CBasePlayerWeapon::AddDuplicate( CBasePlayerItem *pOriginal ) { return 0; }
|
||||
int CBasePlayerWeapon::AddToPlayer( CBasePlayer *pPlayer ) { return FALSE; }
|
||||
int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer ) { return 0; }
|
||||
BOOL CBasePlayerWeapon :: AddPrimaryAmmo( int iCount, char *szName, int iMaxClip, int iMaxCarry ) { return TRUE; }
|
||||
BOOL CBasePlayerWeapon :: AddSecondaryAmmo( int iCount, char *szName, int iMax ) { return TRUE; }
|
||||
BOOL CBasePlayerWeapon :: AddPrimaryAmmo( int iCount, const char *szName, int iMaxClip, int iMaxCarry ) { return TRUE; }
|
||||
BOOL CBasePlayerWeapon :: AddSecondaryAmmo( int iCount, const char *szName, int iMax ) { return TRUE; }
|
||||
BOOL CBasePlayerWeapon :: IsUseable( void ) { return TRUE; }
|
||||
int CBasePlayerWeapon::PrimaryAmmoIndex( void ) { return -1; }
|
||||
int CBasePlayerWeapon::SecondaryAmmoIndex( void ) { return -1; }
|
||||
|
|
|
@ -92,12 +92,12 @@ void HUD_PrepEntity( CBaseEntity *pEntity, CBasePlayer *pWeaponOwner )
|
|||
if( pWeaponOwner )
|
||||
{
|
||||
ItemInfo info;
|
||||
CBasePlayerWeapon *pWeapon = (CBasePlayerWeapon *)pEntity;
|
||||
pWeapon->m_pPlayer = pWeaponOwner;
|
||||
|
||||
((CBasePlayerWeapon *)pEntity)->m_pPlayer = pWeaponOwner;
|
||||
pWeapon->GetItemInfo( &info );
|
||||
|
||||
((CBasePlayerWeapon *)pEntity)->GetItemInfo( &info );
|
||||
|
||||
g_pWpns[ info.iId ] = (CBasePlayerWeapon *)pEntity;
|
||||
g_pWpns[info.iId] = pWeapon;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -444,7 +444,7 @@ void CBasePlayer::Spawn( void )
|
|||
BOOL CQuakeGun::Deploy( )
|
||||
{
|
||||
gEngfuncs.CL_LoadModel( "models/v_axe.mdl", &m_pPlayer->pev->viewmodel );
|
||||
strcpy( m_pPlayer->m_szAnimExtention, "onehanded" );
|
||||
m_pPlayer->m_pszAnimExtention = "onehanded";
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -168,7 +168,7 @@ struct efx_api_s
|
|||
TEMPENTITY *(*R_DefaultSprite)( float *pos, int spriteIndex, float framerate );
|
||||
TEMPENTITY *(*R_TempSprite)( float *pos, float *dir, float scale, int modelIndex, int rendermode, int renderfx, float a, float life, int flags );
|
||||
int (*Draw_DecalIndex)( int id );
|
||||
int (*Draw_DecalIndexFromName)( char *name );
|
||||
int (*Draw_DecalIndexFromName)( const char *name );
|
||||
void (*R_DecalShoot)( int textureIndex, int entity, int modelIndex, float *position, int flags );
|
||||
void (*R_AttachTentToPlayer)( int client, int modelIndex, float zoffset, float life );
|
||||
void (*R_KillAttachedTents)( int client );
|
||||
|
|
|
@ -142,18 +142,6 @@ void AgResetMap()
|
|||
while ((pEntity = UTIL_FindEntityByClassname( pEntity, "weaponbox" )) != NULL)
|
||||
UTIL_Remove(pEntity);
|
||||
|
||||
pEntity = NULL;
|
||||
while ((pEntity = UTIL_FindEntityByClassname( pEntity, "monster_satchel" )) != NULL)
|
||||
UTIL_Remove(pEntity);
|
||||
|
||||
pEntity = NULL;
|
||||
while ((pEntity = UTIL_FindEntityByClassname( pEntity, "monster_tripmine" )) != NULL)
|
||||
UTIL_Remove(pEntity);
|
||||
|
||||
pEntity = NULL;
|
||||
while ((pEntity = UTIL_FindEntityByClassname( pEntity, "monster_snark" )) != NULL)
|
||||
UTIL_Remove(pEntity);
|
||||
|
||||
pEntity = NULL;
|
||||
while ((pEntity = UTIL_FindEntityByClassname( pEntity, "beam" )) != NULL)
|
||||
UTIL_Remove(pEntity);
|
||||
|
|
|
@ -132,7 +132,7 @@ BOOL CQuakeGun::Deploy( )
|
|||
{
|
||||
m_pPlayer->pev->viewmodel = MAKE_STRING("models/v_crowbar.mdl");
|
||||
m_pPlayer->pev->weaponmodel = MAKE_STRING("models/p_9mmhandgun.mdl");
|
||||
strcpy( m_pPlayer->m_szAnimExtention, "onehanded" );
|
||||
m_pPlayer->m_pszAnimExtention = "onehanded";
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
g_flLightTime = 0.0;
|
||||
|
|
|
@ -832,9 +832,9 @@ void CItemAmmo::Spawn( void )
|
|||
void CItemAmmo::Precache( void )
|
||||
{
|
||||
if (pev->spawnflags & BIG_AMMOBOX)
|
||||
PRECACHE_MODEL( (char*)STRING(m_isLargeBox) );
|
||||
PRECACHE_MODEL( STRING(m_isLargeBox) );
|
||||
else
|
||||
PRECACHE_MODEL( (char*)STRING(m_isSmallBox) );
|
||||
PRECACHE_MODEL( STRING(m_isSmallBox) );
|
||||
}
|
||||
|
||||
BOOL CItemAmmo::MyTouch( CBasePlayer *pPlayer )
|
||||
|
|
|
@ -218,7 +218,7 @@ void CBasePlayer::W_SetCurrentAmmo( int sendanim /* = 1 */ )
|
|||
pev->viewmodel = iszViewModel;
|
||||
|
||||
pev->weaponmodel = iszWeaponModel;
|
||||
strcpy( m_szAnimExtention, szAnimExt );
|
||||
m_pszAnimExtention = szAnimExt;
|
||||
|
||||
#else
|
||||
{
|
||||
|
|
|
@ -823,7 +823,7 @@ void CBaseDoor::Blocked( CBaseEntity *pOther )
|
|||
if( m_fNextSoundPlay <= gpGlobals->time )
|
||||
{
|
||||
m_fNextSoundPlay = gpGlobals->time + 0.3;
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, (char*)STRING( pev->noiseMoving ) );
|
||||
STOP_SOUND( ENT( pev ), CHAN_STATIC, STRING( pev->noiseMoving ) );
|
||||
}
|
||||
|
||||
// Block all door pieces with the same targetname here.
|
||||
|
|
|
@ -87,7 +87,7 @@ CHalfLifeMultiplay::CHalfLifeMultiplay()
|
|||
#endif
|
||||
int length;
|
||||
|
||||
char *pFileList = (char*)LOAD_FILE_FOR_ME( "motd.txt", &length );
|
||||
const char *pFileList = (const char*)LOAD_FILE_FOR_ME( "motd.txt", &length );
|
||||
|
||||
if( pFileList )
|
||||
g_bHaveMOTD = true;
|
||||
|
|
|
@ -725,7 +725,7 @@ void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim )
|
|||
strcpy( szAnim, "crouch_shoot_" );
|
||||
else
|
||||
strcpy( szAnim, "ref_shoot_" );
|
||||
strcat( szAnim, m_szAnimExtention );
|
||||
strcat( szAnim, m_pszAnimExtention );
|
||||
animDesired = LookupSequence( szAnim );
|
||||
if( animDesired == -1 )
|
||||
animDesired = 0;
|
||||
|
@ -752,7 +752,7 @@ void CBasePlayer::SetAnimation( PLAYER_ANIM playerAnim )
|
|||
strcpy( szAnim, "crouch_aim_" );
|
||||
else
|
||||
strcpy( szAnim, "ref_aim_" );
|
||||
strcat( szAnim, m_szAnimExtention );
|
||||
strcat( szAnim, m_pszAnimExtention );
|
||||
animDesired = LookupSequence( szAnim );
|
||||
if( animDesired == -1 )
|
||||
animDesired = 0;
|
||||
|
|
|
@ -251,7 +251,7 @@ public:
|
|||
int Classify ( void );
|
||||
void SetAnimation( PLAYER_ANIM playerAnim );
|
||||
void SetWeaponAnimType( const char *szExtention );
|
||||
char m_szAnimExtention[32];
|
||||
const char *m_pszAnimExtention;
|
||||
|
||||
// custom player functions
|
||||
virtual void ImpulseCommands( void );
|
||||
|
|
|
@ -794,7 +794,7 @@ void CBasePlayerWeapon::SendWeaponAnim( int iAnim, int skiplocal )
|
|||
MESSAGE_END();
|
||||
}
|
||||
|
||||
BOOL CBasePlayerWeapon::AddPrimaryAmmo( int iCount, char *szName, int iMaxClip, int iMaxCarry )
|
||||
BOOL CBasePlayerWeapon::AddPrimaryAmmo( int iCount, const char *szName, int iMaxClip, int iMaxCarry )
|
||||
{
|
||||
int iIdAmmo;
|
||||
|
||||
|
@ -831,7 +831,7 @@ BOOL CBasePlayerWeapon::AddPrimaryAmmo( int iCount, char *szName, int iMaxClip,
|
|||
return iIdAmmo > 0 ? TRUE : FALSE;
|
||||
}
|
||||
|
||||
BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, char *szName, int iMax )
|
||||
BOOL CBasePlayerWeapon::AddSecondaryAmmo( int iCount, const char *szName, int iMax )
|
||||
{
|
||||
int iIdAmmo;
|
||||
|
||||
|
@ -906,7 +906,7 @@ BOOL CBasePlayerWeapon::DefaultDeploy( const char *szViewModel, const char *szWe
|
|||
|
||||
m_pPlayer->pev->viewmodel = MAKE_STRING( szViewModel );
|
||||
m_pPlayer->pev->weaponmodel = MAKE_STRING( szWeaponModel );
|
||||
strcpy( m_pPlayer->m_szAnimExtention, szAnimExt );
|
||||
m_pPlayer->m_pszAnimExtention = szAnimExt;
|
||||
SendWeaponAnim( iAnim, skiplocal );
|
||||
|
||||
m_pPlayer->m_flNextAttack = UTIL_WeaponTimeBase() + 0.5;
|
||||
|
@ -1056,13 +1056,13 @@ int CBasePlayerWeapon::ExtractAmmo( CBasePlayerWeapon *pWeapon )
|
|||
{
|
||||
// blindly call with m_iDefaultAmmo. It's either going to be a value or zero. If it is zero,
|
||||
// we only get the ammo in the weapon's clip, which is what we want.
|
||||
iReturn = pWeapon->AddPrimaryAmmo( m_iDefaultAmmo, (char *)pszAmmo1(), iMaxClip(), iMaxAmmo1() );
|
||||
iReturn = pWeapon->AddPrimaryAmmo( m_iDefaultAmmo, pszAmmo1(), iMaxClip(), iMaxAmmo1() );
|
||||
m_iDefaultAmmo = 0;
|
||||
}
|
||||
|
||||
if( pszAmmo2() != NULL )
|
||||
{
|
||||
iReturn = pWeapon->AddSecondaryAmmo( 0, (char *)pszAmmo2(), iMaxAmmo2() );
|
||||
iReturn = pWeapon->AddSecondaryAmmo( 0, pszAmmo2(), iMaxAmmo2() );
|
||||
}
|
||||
|
||||
return iReturn;
|
||||
|
@ -1084,7 +1084,7 @@ int CBasePlayerWeapon::ExtractClipAmmo( CBasePlayerWeapon *pWeapon )
|
|||
iAmmo = m_iClip;
|
||||
}
|
||||
|
||||
return pWeapon->m_pPlayer->GiveAmmo( iAmmo, (char *)pszAmmo1(), iMaxAmmo1() ); // , &m_iPrimaryAmmoType
|
||||
return pWeapon->m_pPlayer->GiveAmmo( iAmmo, pszAmmo1(), iMaxAmmo1() ); // , &m_iPrimaryAmmoType
|
||||
}
|
||||
|
||||
//=========================================================
|
||||
|
|
|
@ -294,8 +294,8 @@ public:
|
|||
virtual int AddWeapon( void ) { ExtractAmmo( this ); return TRUE; }; // Return TRUE if you want to add yourself to the player
|
||||
|
||||
// generic "shared" ammo handlers
|
||||
BOOL AddPrimaryAmmo( int iCount, char *szName, int iMaxClip, int iMaxCarry );
|
||||
BOOL AddSecondaryAmmo( int iCount, char *szName, int iMaxCarry );
|
||||
BOOL AddPrimaryAmmo( int iCount, const char *szName, int iMaxClip, int iMaxCarry );
|
||||
BOOL AddSecondaryAmmo( int iCount, const char *szName, int iMaxCarry );
|
||||
|
||||
virtual void UpdateItemInfo( void ) {}; // updates HUD state
|
||||
|
||||
|
|
Loading…
Reference in New Issue