Merge branch 'thegate-fix' into thegate

This commit is contained in:
Night Owl 2018-07-11 05:34:28 +05:00
commit 50595469ec
10 changed files with 84 additions and 177 deletions

View File

@ -22,3 +22,4 @@ script:
- cp dlls/hl.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls - cp dlls/hl.* $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC/dlls
- tar -J -cf $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC - tar -J -cf $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC
- curl --upload-file $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz https://transfer.sh/$TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz - curl --upload-file $TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz https://transfer.sh/$TRAVIS_BRANCH-$TRAVIS_OS_NAME-$CC.txz

View File

@ -108,6 +108,9 @@ int CHudFlashlight::Draw( float flTime )
int r, g, b, x, y, a; int r, g, b, x, y, a;
wrect_t rc; wrect_t rc;
if( gEngfuncs.IsSpectateOnly() )
return 1;
if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) ) if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) )
return 1; return 1;

View File

@ -100,6 +100,37 @@ void __CmdFunc_ToggleServerBrowser( void )
{ {
} }
int __MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf )
{
const char *pszSound;
char cmd[64];
BEGIN_READ( pbuf, iSize );
pszSound = READ_STRING();
if( !IsXashFWGS() && gEngfuncs.pfnGetCvarPointer( "gl_overbright" ) )
{
sprintf( cmd, "mp3 play sound/mp3/%s\n", pszSound );
gEngfuncs.pfnClientCmd( cmd );
}
else
{
sprintf( cmd, "sound/mp3/%s", pszSound );
gEngfuncs.pfnPrimeMusicStream( cmd, 1 );
}
return 1;
}
void __CmdFunc_StopMP3( void )
{
if( !IsXashFWGS() && gEngfuncs.pfnGetCvarPointer( "gl_overbright" ) )
gEngfuncs.pfnClientCmd( "mp3 stop\n" );
else
gEngfuncs.pfnPrimeMusicStream( 0, 0 );
}
// TFFree Command Menu Message Handlers // TFFree Command Menu Message Handlers
int __MsgFunc_ValClass( const char *pszName, int iSize, void *pbuf ) int __MsgFunc_ValClass( const char *pszName, int iSize, void *pbuf )
{ {
@ -183,6 +214,9 @@ void CHud::Init( void )
// VGUI Menus // VGUI Menus
HOOK_MESSAGE( VGUIMenu ); HOOK_MESSAGE( VGUIMenu );
HOOK_MESSAGE( PlayMP3 );
HOOK_COMMAND( "stopmp3", StopMP3 );
CVAR_CREATE( "hud_classautokill", "1", FCVAR_ARCHIVE | FCVAR_USERINFO ); // controls whether or not to suicide immediately on TF class switch CVAR_CREATE( "hud_classautokill", "1", FCVAR_ARCHIVE | FCVAR_USERINFO ); // controls whether or not to suicide immediately on TF class switch
CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round CVAR_CREATE( "hud_takesshots", "0", FCVAR_ARCHIVE ); // controls whether or not to automatically take screenshots at the end of a round
hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE ); hud_textmode = CVAR_CREATE ( "hud_textmode", "0", FCVAR_ARCHIVE );

View File

@ -23,16 +23,13 @@
class CTriggerCommand : public CPointEntity class CTriggerCommand : public CPointEntity
{ {
public: public:
void Spawn(void); void Spawn();
void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value );
private:
void PlayMP3(CBaseEntity* pClient, const char* song);
}; };
LINK_ENTITY_TO_CLASS(trigger_command, CTriggerCommand); LINK_ENTITY_TO_CLASS( trigger_command, CTriggerCommand )
void CTriggerCommand::Spawn(void) void CTriggerCommand::Spawn()
{ {
pev->solid = SOLID_NOT; pev->solid = SOLID_NOT;
pev->movetype = MOVETYPE_NONE; pev->movetype = MOVETYPE_NONE;
@ -40,61 +37,18 @@ void CTriggerCommand::Spawn(void)
pev->frame = 0; pev->frame = 0;
} }
void CTriggerCommand::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value) void CTriggerCommand::Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )
{ {
if (!pActivator || !pActivator->IsNetClient()) char cmd[64];
if( !pActivator || !pActivator->IsPlayer() )
return; return;
const char* command = STRING(pev->netname); if( !pev->netname )
if (!command || !*command)
return; return;
// ALERT(at_console, "%s with command \"%s\"\n", STRING(pev->classname), command); sprintf( cmd, "%s\n", STRING( pev->netname ) );
CLIENT_COMMAND( ENT( pActivator->pev ), cmd );
char* str = NULL; UTIL_Remove( this );
if ((str = (char*)strstr(command, "playmp3")) != NULL)
{
int pchlen = 0;
int extlen = 3; // "mp3" excluding NULL terminator.
int ideallen = 0;
char* pch = NULL, *lastpch = NULL;
char* song = NULL;
pch = strtok(str, " .");
while (pch)
{
pchlen = strlen(pch);
ideallen = (pchlen <= extlen) ? pchlen : extlen;
if (strncmp(pch, "mp3", sizeof(char) * ideallen) == 0)
{
pch = NULL;
}
else
{
lastpch = pch;
pch = strtok(NULL, " .");
}
}
song = lastpch;
PlayMP3(pActivator, song);
}
UTIL_Remove(this);
}
void CTriggerCommand::PlayMP3(CBaseEntity* pClient, const char* song)
{
ASSERT(pClient != NULL);
char cmd[128];
sprintf(cmd, "play sound/mp3/%s.mp3\n", song);
CLIENT_COMMAND(ENT(pClient->pev),cmd);
} }

View File

@ -49,6 +49,7 @@ extern void CopyToBodyQue( entvars_t* pev );
extern int giPrecacheGrunt; extern int giPrecacheGrunt;
extern int gmsgSayText; extern int gmsgSayText;
extern int gmsgBhopcap; extern int gmsgBhopcap;
extern int gmsgPlayMP3;
extern cvar_t allow_spectators; extern cvar_t allow_spectators;
@ -487,6 +488,12 @@ void ClientCommand( edict_t *pEntity )
{ {
GetClassPtr( (CBasePlayer *)pev )->ForceClientDllUpdate(); GetClassPtr( (CBasePlayer *)pev )->ForceClientDllUpdate();
} }
else if( FStrEq(pcmd, "playmp3" ) )
{
MESSAGE_BEGIN( MSG_ONE, gmsgPlayMP3, NULL, ENT( pev ) );
WRITE_STRING( (char *)CMD_ARGV( 1 ) );
MESSAGE_END();
}
else if( FStrEq(pcmd, "give" ) ) else if( FStrEq(pcmd, "give" ) )
{ {
if( g_flWeaponCheat != 0.0 ) if( g_flWeaponCheat != 0.0 )

View File

@ -64,6 +64,8 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType )
int iContents = UTIL_PointContents( pev->origin ); int iContents = UTIL_PointContents( pev->origin );
UTIL_ScreenShake( pev->origin, 25.0, 150.0, 1.0, 750.0 );
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin ); MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_EXPLOSION ); // This makes a dynamic light and the explosion sprites/sound WRITE_BYTE( TE_EXPLOSION ); // This makes a dynamic light and the explosion sprites/sound
WRITE_COORD( pev->origin.x ); // Send to PAS because of the sound WRITE_COORD( pev->origin.x ); // Send to PAS because of the sound

View File

@ -448,7 +448,7 @@ BOOL CHGrunt::CheckMeleeAttack1( float flDot, float flDist )
//========================================================= //=========================================================
BOOL CHGrunt::CheckRangeAttack1( float flDot, float flDist ) BOOL CHGrunt::CheckRangeAttack1( float flDot, float flDist )
{ {
if( !HasConditions( bits_COND_ENEMY_OCCLUDED ) && flDist <= 2048 && flDot >= 0.5 && NoFriendlyFire() ) if( !HasConditions( bits_COND_ENEMY_OCCLUDED ) && flDist <= 8000 && flDot >= 0.5 && NoFriendlyFire() )
{ {
TraceResult tr; TraceResult tr;
@ -647,36 +647,30 @@ void CHGrunt::SetYawSpeed( void )
switch( m_Activity ) switch( m_Activity )
{ {
case ACT_IDLE: case ACT_IDLE:
ys = 150; ys = 295;
break; break;
case ACT_RUN: case ACT_RUN:
ys = 150; ys = 175;
break; break;
case ACT_WALK: case ACT_WALK:
ys = 180; ys = 275;
break; break;
case ACT_RANGE_ATTACK1: case ACT_RANGE_ATTACK1:
ys = 120;
break;
case ACT_RANGE_ATTACK2: case ACT_RANGE_ATTACK2:
ys = 120;
break;
case ACT_MELEE_ATTACK1: case ACT_MELEE_ATTACK1:
ys = 120;
break;
case ACT_MELEE_ATTACK2: case ACT_MELEE_ATTACK2:
ys = 120; ys = 145;
break; break;
case ACT_TURN_LEFT: case ACT_TURN_LEFT:
case ACT_TURN_RIGHT: case ACT_TURN_RIGHT:
ys = 180; ys = 295;
break; break;
case ACT_GLIDE: case ACT_GLIDE:
case ACT_FLY: case ACT_FLY:
ys = 30; ys = 55;
break; break;
default: default:
ys = 90; ys = 115;
break; break;
} }

View File

@ -32,8 +32,9 @@ extern CGraph WorldGraph;
// houndeye does 20 points of damage spread over a sphere 384 units in diameter, and each additional // houndeye does 20 points of damage spread over a sphere 384 units in diameter, and each additional
// squad member increases the BASE damage by 110%, per the spec. // squad member increases the BASE damage by 110%, per the spec.
#define HOUNDEYE_MAX_SQUAD_SIZE 4 #define HOUNDEYE_MAX_SQUAD_SIZE 4
#define HOUNDEYE_MAX_ATTACK_RADIUS 144 #define HOUNDEYE_MAX_ATTACK_RADIUS 120
#define HOUNDEYE_SQUAD_BONUS (float)1.1 #define HOUNDEYE_SQUAD_BONUS (float)1.1
#define HOUNDEYE_MELEE_DAMAGE 7
#define HOUNDEYE_EYE_FRAMES 4 // how many different switchable maps for the eye #define HOUNDEYE_EYE_FRAMES 4 // how many different switchable maps for the eye
@ -291,17 +292,8 @@ void CHoundeye::HandleAnimEvent( MonsterEvent_t *pEvent )
break; break;
} }
case HOUND_AE_THUMP: case HOUND_AE_THUMP:
{ // emit the shockwaves
// SOUND HERE! SonicAttack();
CBaseEntity *pHurt = CheckTraceHullAttack( 70, gSkillData.bullsquidDmgBite, DMG_SLASH );
if( pHurt )
{
pHurt->pev->punchangle.x = 5;
pHurt->pev->velocity = pHurt->pev->velocity - gpGlobals->v_forward * 16;
pHurt->pev->velocity = pHurt->pev->velocity + gpGlobals->v_up * 2;
}
}
break; break;
case HOUND_AE_ANGERSOUND1: case HOUND_AE_ANGERSOUND1:
EMIT_SOUND( ENT( pev ), CHAN_VOICE, "houndeye/he_pain3.wav", 1, ATTN_NORM ); EMIT_SOUND( ENT( pev ), CHAN_VOICE, "houndeye/he_pain3.wav", 1, ATTN_NORM );
@ -570,99 +562,18 @@ void CHoundeye::SonicAttack( void )
break; break;
} }
// blast circles
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_BEAMCYLINDER );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 + HOUNDEYE_MAX_ATTACK_RADIUS / .2 ); // reach damage radius over .3 seconds
WRITE_SHORT( m_iSpriteTexture );
WRITE_BYTE( 0 ); // startframe
WRITE_BYTE( 0 ); // framerate
WRITE_BYTE( 2 ); // life
WRITE_BYTE( 16 ); // width
WRITE_BYTE( 0 ); // noise
WriteBeamColor();
WRITE_BYTE( 255 ); //brightness
WRITE_BYTE( 0 ); // speed
MESSAGE_END();
MESSAGE_BEGIN( MSG_PAS, SVC_TEMPENTITY, pev->origin );
WRITE_BYTE( TE_BEAMCYLINDER );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 );
WRITE_COORD( pev->origin.x );
WRITE_COORD( pev->origin.y );
WRITE_COORD( pev->origin.z + 16 + ( HOUNDEYE_MAX_ATTACK_RADIUS / 2 ) / .2 ); // reach damage radius over .3 seconds
WRITE_SHORT( m_iSpriteTexture );
WRITE_BYTE( 0 ); // startframe
WRITE_BYTE( 0 ); // framerate
WRITE_BYTE( 2 ); // life
WRITE_BYTE( 16 ); // width
WRITE_BYTE( 0 ); // noise
WriteBeamColor();
WRITE_BYTE( 255 ); //brightness
WRITE_BYTE( 0 ); // speed
MESSAGE_END();
CBaseEntity *pEntity = NULL; CBaseEntity *pEntity = NULL;
// iterate on all entities in the vicinity. // iterate on all entities in the vicinity.
while( ( pEntity = UTIL_FindEntityInSphere( pEntity, pev->origin, HOUNDEYE_MAX_ATTACK_RADIUS ) ) != NULL ) while( ( pEntity = UTIL_FindEntityInSphere( pEntity, pev->origin, HOUNDEYE_MAX_ATTACK_RADIUS ) ) != NULL )
{ {
if( pEntity->pev->takedamage != DAMAGE_NO ) if( pEntity->pev->takedamage == DAMAGE_NO )
{
if( !FClassnameIs( pEntity->pev, "monster_houndeye" ) )
{
// houndeyes don't hurt other houndeyes with their attack
// houndeyes do FULL damage if the ent in question is visible. Half damage otherwise.
// This means that you must get out of the houndeye's attack range entirely to avoid damage.
// Calculate full damage first
if( SquadCount() > 1 )
{
// squad gets attack bonus.
flAdjustedDamage = gSkillData.houndeyeDmgBlast + gSkillData.houndeyeDmgBlast * ( HOUNDEYE_SQUAD_BONUS * ( SquadCount() - 1 ) );
}
else
{
// solo
flAdjustedDamage = gSkillData.houndeyeDmgBlast;
}
flDist = ( pEntity->Center() - pev->origin ).Length();
flAdjustedDamage -= ( flDist / HOUNDEYE_MAX_ATTACK_RADIUS ) * flAdjustedDamage;
if( !FVisible( pEntity ) )
{ {
if( pEntity->IsPlayer() ) if( pEntity->IsPlayer() )
{ {
// if this entity is a client, and is not in full view, inflict half damage. We do this so that players still if( FVisible( pEntity ) )
// take the residual damage if they don't totally leave the houndeye's effective radius. We restrict it to clients pEntity->TakeDamage( pev, pev, HOUNDEYE_MELEE_DAMAGE, DMG_SONIC | DMG_ALWAYSGIB );
// so that monsters in other parts of the level don't take the damage and get pissed. else
flAdjustedDamage *= 0.5; pEntity->TakeDamage( pev, pev, HOUNDEYE_MELEE_DAMAGE / 2, DMG_SONIC | DMG_ALWAYSGIB );
}
else if( !FClassnameIs( pEntity->pev, "func_breakable" ) && !FClassnameIs( pEntity->pev, "func_pushable" ) )
{
// do not hurt nonclients through walls, but allow damage to be done to breakables
flAdjustedDamage = 0;
}
}
//ALERT ( at_aiconsole, "Damage: %f\n", flAdjustedDamage );
if( flAdjustedDamage > 0 )
{
pEntity->TakeDamage( pev, pev, flAdjustedDamage, DMG_SONIC | DMG_ALWAYSGIB );
}
} }
} }
} }

View File

@ -155,10 +155,10 @@ void CEnvLight::KeyValue( KeyValueData* pkvd )
} }
else if( j == 4 ) else if( j == 4 )
{ {
v /= 255; float vf = v / 255.0f;
r *= v; r *= vf;
g *= v; g *= vf;
b *= v; b *= vf;
} }
// simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling // simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling

View File

@ -190,6 +190,7 @@ int gmsgStatusText = 0;
int gmsgStatusValue = 0; int gmsgStatusValue = 0;
int gmsgScope = 0; int gmsgScope = 0;
int gmsgPlayMP3 = 0;
void LinkUserMessages( void ) void LinkUserMessages( void )
{ {
@ -233,12 +234,12 @@ void LinkUserMessages( void )
gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) ); gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) );
gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 ); gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 );
gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 ); gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 );
gmsgPlayMP3 = REG_USER_MSG( "PlayMP3", -1 );
gmsgScope = REG_USER_MSG( "Scope", 1 );
gmsgBhopcap = REG_USER_MSG( "Bhopcap", 1 ); gmsgBhopcap = REG_USER_MSG( "Bhopcap", 1 );
gmsgStatusText = REG_USER_MSG( "StatusText", -1 ); gmsgStatusText = REG_USER_MSG( "StatusText", -1 );
gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 ); gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 );
gmsgScope = REG_USER_MSG( "Scope", 1 );
} }
LINK_ENTITY_TO_CLASS( player, CBasePlayer ) LINK_ENTITY_TO_CLASS( player, CBasePlayer )
@ -1426,7 +1427,7 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle )
MESSAGE_END(); MESSAGE_END();
// Setup flags // Setup flags
m_iHideHUD = ( HIDEHUD_HEALTH | HIDEHUD_WEAPONS ); m_iHideHUD = ( HIDEHUD_HEALTH | HIDEHUD_FLASHLIGHT | HIDEHUD_WEAPONS );
m_afPhysicsFlags |= PFLAG_OBSERVER; m_afPhysicsFlags |= PFLAG_OBSERVER;
pev->effects = EF_NODRAW; pev->effects = EF_NODRAW;
pev->view_ofs = g_vecZero; pev->view_ofs = g_vecZero;