From a285b6b533c76b38d576789399288ee7c3e1071b Mon Sep 17 00:00:00 2001 From: Night Owl Date: Fri, 2 Feb 2018 02:47:58 +0500 Subject: [PATCH 1/7] Fix monster_human_grunt. --- dlls/hgrunt.cpp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/dlls/hgrunt.cpp b/dlls/hgrunt.cpp index 20cc3187..54c4ea9e 100644 --- a/dlls/hgrunt.cpp +++ b/dlls/hgrunt.cpp @@ -448,7 +448,7 @@ BOOL CHGrunt::CheckMeleeAttack1( 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; @@ -647,36 +647,30 @@ void CHGrunt::SetYawSpeed( void ) switch( m_Activity ) { case ACT_IDLE: - ys = 150; + ys = 295; break; case ACT_RUN: - ys = 150; + ys = 175; break; case ACT_WALK: - ys = 180; + ys = 275; break; case ACT_RANGE_ATTACK1: - ys = 120; - break; case ACT_RANGE_ATTACK2: - ys = 120; - break; case ACT_MELEE_ATTACK1: - ys = 120; - break; case ACT_MELEE_ATTACK2: - ys = 120; + ys = 145; break; case ACT_TURN_LEFT: case ACT_TURN_RIGHT: - ys = 180; + ys = 295; break; case ACT_GLIDE: case ACT_FLY: - ys = 30; + ys = 55; break; default: - ys = 90; + ys = 115; break; } From 3d7e2b0d933a5d27aed69f77e90f19e7c946728f Mon Sep 17 00:00:00 2001 From: Night Owl Date: Sun, 8 Apr 2018 03:25:13 +0500 Subject: [PATCH 2/7] Do not show flashlight sprite in spectator mode. --- cl_dll/flashlight.cpp | 3 +++ dlls/player.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cl_dll/flashlight.cpp b/cl_dll/flashlight.cpp index c3514c7d..ee3d6d22 100644 --- a/cl_dll/flashlight.cpp +++ b/cl_dll/flashlight.cpp @@ -108,6 +108,9 @@ int CHudFlashlight::Draw( float flTime ) int r, g, b, x, y, a; wrect_t rc; + if( gEngfuncs.IsSpectateOnly() ) + return 1; + if( !( gHUD.m_iWeaponBits & ( 1 << ( WEAPON_SUIT ) ) ) ) return 1; diff --git a/dlls/player.cpp b/dlls/player.cpp index b1d28e67..926bf1e1 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -1421,7 +1421,7 @@ void CBasePlayer::StartObserver( Vector vecPosition, Vector vecViewAngle ) MESSAGE_END(); // Setup flags - m_iHideHUD = ( HIDEHUD_HEALTH | HIDEHUD_WEAPONS ); + m_iHideHUD = ( HIDEHUD_HEALTH | HIDEHUD_FLASHLIGHT | HIDEHUD_WEAPONS ); m_afPhysicsFlags |= PFLAG_OBSERVER; pev->effects = EF_NODRAW; pev->view_ofs = g_vecZero; From 352e52eb0d7eeb3b65191543297d594706456a52 Mon Sep 17 00:00:00 2001 From: Roman Chistokhodov Date: Sun, 8 Jul 2018 15:49:23 +0300 Subject: [PATCH 3/7] Fix #62 ligthting issue. --- dlls/lights.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/dlls/lights.cpp b/dlls/lights.cpp index 1c39266b..13e6d3a9 100644 --- a/dlls/lights.cpp +++ b/dlls/lights.cpp @@ -155,10 +155,10 @@ void CEnvLight::KeyValue( KeyValueData* pkvd ) } else if( j == 4 ) { - v /= 255; - r *= v; - g *= v; - b *= v; + float vf = v / 255.0f; + r *= vf; + g *= vf; + b *= vf; } // simulate qrad direct, ambient,and gamma adjustments, as well as engine scaling From b606972fa9bb906d345b07c040b68f79aaf94c4a Mon Sep 17 00:00:00 2001 From: Night Owl Date: Fri, 2 Feb 2018 14:51:00 +0500 Subject: [PATCH 4/7] Fix monster_houndeye. --- dlls/houndeye.cpp | 107 ++++------------------------------------------ 1 file changed, 9 insertions(+), 98 deletions(-) diff --git a/dlls/houndeye.cpp b/dlls/houndeye.cpp index 5fce77fb..4cb62538 100644 --- a/dlls/houndeye.cpp +++ b/dlls/houndeye.cpp @@ -32,8 +32,9 @@ extern CGraph WorldGraph; // 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. #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_MELEE_DAMAGE 7 #define HOUNDEYE_EYE_FRAMES 4 // how many different switchable maps for the eye @@ -291,17 +292,8 @@ void CHoundeye::HandleAnimEvent( MonsterEvent_t *pEvent ) break; } case HOUND_AE_THUMP: - { - // SOUND HERE! - 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; - } - } + // emit the shockwaves + SonicAttack(); break; case HOUND_AE_ANGERSOUND1: EMIT_SOUND( ENT( pev ), CHAN_VOICE, "houndeye/he_pain3.wav", 1, ATTN_NORM ); @@ -570,99 +562,18 @@ void CHoundeye::SonicAttack( void ) 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; // iterate on all entities in the vicinity. 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" ) ) + if( pEntity->IsPlayer() ) { - // 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 ) ); - } + if( FVisible( pEntity ) ) + pEntity->TakeDamage( pev, pev, HOUNDEYE_MELEE_DAMAGE, DMG_SONIC | DMG_ALWAYSGIB ); 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 this entity is a client, and is not in full view, inflict half damage. We do this so that players still - // take the residual damage if they don't totally leave the houndeye's effective radius. We restrict it to clients - // so that monsters in other parts of the level don't take the damage and get pissed. - flAdjustedDamage *= 0.5; - } - 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 ); - } + pEntity->TakeDamage( pev, pev, HOUNDEYE_MELEE_DAMAGE / 2, DMG_SONIC | DMG_ALWAYSGIB ); } } } From 23e2d00ae90800d5bf792918ef5799532f861a22 Mon Sep 17 00:00:00 2001 From: Night Owl Date: Mon, 9 Jul 2018 22:31:21 +0500 Subject: [PATCH 5/7] Add screenshake on explosion. --- dlls/ggrenade.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/ggrenade.cpp b/dlls/ggrenade.cpp index 0ca516c4..7d5698fd 100644 --- a/dlls/ggrenade.cpp +++ b/dlls/ggrenade.cpp @@ -64,6 +64,8 @@ void CGrenade::Explode( TraceResult *pTrace, int bitsDamageType ) 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 ); 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 From d600d214ce842132547ae4421cfd4b549fae8cdf Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 10 Jul 2018 03:47:18 +0500 Subject: [PATCH 6/7] Fix mp3 player. --- cl_dll/hud.cpp | 20 ++++++++++++ dlls/TheGate/command.cpp | 70 +++++++--------------------------------- dlls/client.cpp | 7 ++++ dlls/player.cpp | 5 +-- 4 files changed, 42 insertions(+), 60 deletions(-) diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index a1d60508..8b8046d8 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -100,6 +100,23 @@ void __CmdFunc_ToggleServerBrowser( void ) { } +int __MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf ) +{ + char cmd[64]; + + BEGIN_READ( pbuf, iSize ); + + sprintf( cmd, "sound/mp3/%s", READ_STRING() ); + gEngfuncs.pfnPrimeMusicStream( cmd, 1 ); + + return 1; +} + +void __CmdFunc_StopMP3( void ) +{ + gEngfuncs.pfnPrimeMusicStream( 0, 0 ); +} + // TFFree Command Menu Message Handlers int __MsgFunc_ValClass( const char *pszName, int iSize, void *pbuf ) { @@ -183,6 +200,9 @@ void CHud::Init( void ) // VGUI Menus 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_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 ); diff --git a/dlls/TheGate/command.cpp b/dlls/TheGate/command.cpp index d7761729..c30d6474 100644 --- a/dlls/TheGate/command.cpp +++ b/dlls/TheGate/command.cpp @@ -23,16 +23,13 @@ class CTriggerCommand : public CPointEntity { public: - void Spawn(void); - void Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value); - -private: - void PlayMP3(CBaseEntity* pClient, const char* song); + void Spawn(); + void Use( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value ); }; -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->movetype = MOVETYPE_NONE; @@ -40,61 +37,18 @@ void CTriggerCommand::Spawn(void) 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; - const char* command = STRING(pev->netname); - - if (!command || !*command) + if( !pev->netname ) 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; - - 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); + UTIL_Remove( this ); } diff --git a/dlls/client.cpp b/dlls/client.cpp index 578534e3..d5d13a85 100644 --- a/dlls/client.cpp +++ b/dlls/client.cpp @@ -49,6 +49,7 @@ extern void CopyToBodyQue( entvars_t* pev ); extern int giPrecacheGrunt; extern int gmsgSayText; extern int gmsgBhopcap; +extern int gmsgPlayMP3; extern cvar_t allow_spectators; @@ -487,6 +488,12 @@ void ClientCommand( edict_t *pEntity ) { 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" ) ) { if( g_flWeaponCheat != 0.0 ) diff --git a/dlls/player.cpp b/dlls/player.cpp index 0c4fd3f2..b2530694 100644 --- a/dlls/player.cpp +++ b/dlls/player.cpp @@ -190,6 +190,7 @@ int gmsgStatusText = 0; int gmsgStatusValue = 0; int gmsgScope = 0; +int gmsgPlayMP3 = 0; void LinkUserMessages( void ) { @@ -233,12 +234,12 @@ void LinkUserMessages( void ) gmsgFade = REG_USER_MSG( "ScreenFade", sizeof(ScreenFade) ); gmsgAmmoX = REG_USER_MSG( "AmmoX", 2 ); gmsgTeamNames = REG_USER_MSG( "TeamNames", -1 ); + gmsgPlayMP3 = REG_USER_MSG( "PlayMP3", -1 ); + gmsgScope = REG_USER_MSG( "Scope", 1 ); gmsgBhopcap = REG_USER_MSG( "Bhopcap", 1 ); gmsgStatusText = REG_USER_MSG( "StatusText", -1 ); gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 ); - - gmsgScope = REG_USER_MSG( "Scope", 1 ); } LINK_ENTITY_TO_CLASS( player, CBasePlayer ) From 9e49b2fcf5787fb1af11cbba48b401d31a045aae Mon Sep 17 00:00:00 2001 From: Night Owl Date: Tue, 10 Jul 2018 10:06:19 +0500 Subject: [PATCH 7/7] Fix mp3 playing in steam. --- cl_dll/hud.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/cl_dll/hud.cpp b/cl_dll/hud.cpp index d4d7a269..a010a342 100644 --- a/cl_dll/hud.cpp +++ b/cl_dll/hud.cpp @@ -102,19 +102,33 @@ void __CmdFunc_ToggleServerBrowser( void ) int __MsgFunc_PlayMP3( const char *pszName, int iSize, void *pbuf ) { + const char *pszSound; char cmd[64]; BEGIN_READ( pbuf, iSize ); - sprintf( cmd, "sound/mp3/%s", READ_STRING() ); - gEngfuncs.pfnPrimeMusicStream( cmd, 1 ); + 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 ) { - gEngfuncs.pfnPrimeMusicStream( 0, 0 ); + if( !IsXashFWGS() && gEngfuncs.pfnGetCvarPointer( "gl_overbright" ) ) + gEngfuncs.pfnClientCmd( "mp3 stop\n" ); + else + gEngfuncs.pfnPrimeMusicStream( 0, 0 ); } // TFFree Command Menu Message Handlers