diff --git a/Source/Server/Damage.c b/Source/Server/Damage.c index a785f2e9..7ed08a92 100644 --- a/Source/Server/Damage.c +++ b/Source/Server/Damage.c @@ -39,3 +39,26 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos self = eOld; } + +void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius ) { + entity eDChain = findradius( vOrigin, fRadius ); + + while( eDChain ) { + + if ( eDChain.takedamage == DAMAGE_YES ) { + float fDiff = vlen( vOrigin - eDChain.origin ); + + fDiff = ( fRadius - fDiff ) / fRadius; + + fDamage = fDamage * fDiff; + + bprint( sprintf("[DEBUG] EXPLOSION! Hit Radius: %d, Damage Multiplier: %f\n", vlen( vOrigin - eDChain.origin ), fDiff ) ); + + if ( fDiff > 0 ) { + Damage_Apply( eDChain, eAttacker, fDamage, eDChain.origin ); + } + } + + eDChain = eDChain.chain; + } +} diff --git a/Source/Server/Defs.h b/Source/Server/Defs.h index 1d58e91a..ce7a09db 100644 --- a/Source/Server/Defs.h +++ b/Source/Server/Defs.h @@ -113,6 +113,7 @@ float OpenCSGunBase_Reload( void ); float Player_GetMaxSpeed( float fWeapon ); void TraceAttack_FireBullets( int iShots ); +void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius ); // WIP string __fullspawndata; diff --git a/Source/Server/Rules.c b/Source/Server/Rules.c index f79f4242..f671ff0d 100644 --- a/Source/Server/Rules.c +++ b/Source/Server/Rules.c @@ -105,6 +105,11 @@ void Rules_Restart( void ) { // This can happen whenever an objective is complete or time is up void Rules_RoundOver( int iTeamWon ) { + + if ( fGameState != GAME_ACTIVE ) { + return; + } + if ( iTeamWon == TEAM_T ) { sound( world, CHAN_VOICE, "radio/terwin.wav", 1.0, ATTN_NONE ); iWon_T++; diff --git a/Source/Shared/WeaponC4Bomb.c b/Source/Shared/WeaponC4Bomb.c index 7e5431be..ab7d7927 100644 --- a/Source/Shared/WeaponC4Bomb.c +++ b/Source/Shared/WeaponC4Bomb.c @@ -28,15 +28,15 @@ int iBombProgress; weaponinfo_t wptC4BOMB = { WEAPON_C4BOMB, // Identifier SLOT_GRENADE, - 650, // Price + 0, // Price CALIBER_50AE, // Caliber ID 1.0, // Max Player Speed - 1, // Bullets Per Shot - 1, // Clip/MagSize - 54, // Damage + 0, // Bullets Per Shot + 0, // Clip/MagSize + 500, // Damage 1, // Penetration Multiplier 64, // Bullet Range - 0.81, // Range Modifier + 1, // Range Modifier TYPE_AUTO, 0.0, // Attack-Delay 0.0, // Reload-Delay @@ -60,18 +60,34 @@ void WeaponC4BOMB_Drop( vector vBombPos ) { static void c4bomb_think( void ) { if ( self.fAttackFinished < time ) { Rules_RoundOver( TEAM_T ); + // EXPLODE! + sound( self, CHAN_VOICE, "weapons/c4_explode1.wav", 1.0, ATTN_NONE ); + Damage_Radius( self.origin, self.owner, 500, 1024 ); remove( self ); return; } - self.nextthink = time + 0.12; + + if ( self.fAttackFinished - time < 5 ) { + sound( self, CHAN_VOICE, "weapons/c4_beep5.wav", 1.0, ATTN_NORM ); + } else if ( self.fAttackFinished - time < 10 ) { + sound( self, CHAN_VOICE, "weapons/c4_beep4.wav", 1.0, ATTN_NORM ); + } else if ( self.fAttackFinished - time < 20 ) { + sound( self, CHAN_VOICE, "weapons/c4_beep3.wav", 1.0, ATTN_NORM ); + } else if ( self.fAttackFinished - time < 30 ) { + sound( self, CHAN_VOICE, "weapons/c4_beep2.wav", 1.0, ATTN_NORM ); + } else { + sound( self, CHAN_VOICE, "weapons/c4_beep1.wav", 1.0, ATTN_NORM ); + } + self.nextthink = time + 1.5; } entity eBomb = spawn(); setorigin( eBomb, vBombPos ); setmodel( eBomb, "models/w_c4.mdl" ); eBomb.think = c4bomb_think; - eBomb.nextthink = time + 0.12; + eBomb.nextthink = time + 1.5; eBomb.fAttackFinished = time + 45; + sound( eBomb, CHAN_WEAPON, "weapons/c4_plant.wav", 1.0, ATTN_IDLE ); sound( world, CHAN_VOICE, "radio/bombpl.wav", 1.0, ATTN_NONE ); @@ -117,7 +133,6 @@ void WeaponC4BOMB_PrimaryFire( void ) { // 3 seconds have passed, plant the bomb if ( self.fBombProgress >= 3.0 ) { - Client_SendEvent( self, EV_WEAPON_SECONDARYATTACK ); // This means we'll drop the bomb on CSQC WeaponC4BOMB_Drop( trace_endpos ); } #else