diff --git a/Source/Server/Damage.c b/Source/Server/Damage.c index c3105342..efa42e8f 100644 --- a/Source/Server/Damage.c +++ b/Source/Server/Damage.c @@ -60,9 +60,6 @@ string Damage_GetHitLocation( int iSurface ) { } void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos ) { - - eTarget.health = eTarget.health - iDamage; // TODO: Body part multipliers - // Special monetary punishment for hostage murderers if ( eTarget.classname == "hostage_entity" ) { if ( eTarget.health > 0 ) { @@ -72,8 +69,14 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos } } + // Modify the damage based on the location if ( trace_surface_id == BODY_HEAD ) { - iDamage *= 4; + if ( eTarget.iEquipment & EQUIPMENT_HELMET ) { + iDamage *= 0.5; + eTarget.iEquipment -= EQUIPMENT_HELMET; + } else { + iDamage *= 4; + } } else if ( trace_surface_id == BODY_STOMACH ) { iDamage *= 0.9; } else if ( trace_surface_id == BODY_LEGLEFT ) { @@ -82,6 +85,9 @@ void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos iDamage *= 0.4; } + // Apply the damage finally + eTarget.health = eTarget.health - iDamage; + dprint( sprintf( "[DEBUG] Hit Bodypart: %s\n", Damage_GetHitLocation( trace_surface_id ) ) ); // Target is dead and a client.... diff --git a/Source/Server/Defs.h b/Source/Server/Defs.h index 4ab7e226..355a2c2d 100644 --- a/Source/Server/Defs.h +++ b/Source/Server/Defs.h @@ -85,6 +85,7 @@ int iRescueZones; int iBuyZones; int iVIPZones; int iBuyRestriction; // For info_map_parameters +int iBombRadius; // For info_map_parameters int iHostagesRescued; int iBombPlanted; @@ -134,6 +135,7 @@ void TraceAttack_FireBullets( int iShots, vector vPos ); void Damage_Radius( vector vOrigin, entity eAttacker, float fDamage, float fRadius ); void Damage_Apply( entity eTarget, entity eAttacker, int iDamage, vector vHitPos ); +void Entities_UseTargets( void ); void Entities_InitRespawnable( void() vRespawnFunc ); void Entities_Respawn( void ); diff --git a/Source/Server/FuncEscapeZone.c b/Source/Server/FuncEscapeZone.c index cc502c10..e4d911ec 100644 --- a/Source/Server/FuncEscapeZone.c +++ b/Source/Server/FuncEscapeZone.c @@ -18,14 +18,32 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* + +TODO: This gamemode is odd about balancing, right now the last surviving terrorist + will decide the match. Still have to think about what rules to set up. +*/ + /* ================= func_escapezone_touch ================= */ -void func_vip_safetyzone( void ) { +void func_escapezone_touch( void ) { if ( ( other.classname == "player" ) && ( other.team == TEAM_T ) ) { + entity eOld = self; + self = other; + Spawn_MakeSpectator(); + self.classname = "player"; + forceinfokey( self, "*dead", "0" ); + iAlivePlayers_T--; + + self = eOld; + + if ( iAlivePlayers_T == 0 ) { + Rules_RoundOver( TEAM_T, 2500, FALSE ); + } } } @@ -36,7 +54,7 @@ SPAWN: func_escapezone Entry function for the terrorist escape zone ================= */ -void func_vip_safetyzone( void ) { +void func_escapezone( void ) { self.angles = '0 0 0'; self.movetype = MOVETYPE_NONE; self.solid = SOLID_TRIGGER; diff --git a/Source/Server/Main.c b/Source/Server/Main.c index c6060c5c..0345b306 100644 --- a/Source/Server/Main.c +++ b/Source/Server/Main.c @@ -376,4 +376,6 @@ void worldspawn( void ) { pointerstat( STAT_GAMETIME, EV_FLOAT, &fGameTime ); pointerstat( STAT_WON_T, EV_INTEGER, &iWon_T ); pointerstat( STAT_WON_CT, EV_INTEGER, &iWon_CT ); + + iBombRadius = 1024; } diff --git a/Source/Server/Player.c b/Source/Server/Player.c index d8552216..d410e75f 100644 --- a/Source/Server/Player.c +++ b/Source/Server/Player.c @@ -66,6 +66,7 @@ void Player_Death( int iHitBody ) { // Drop a corpse entity eCorpse = spawn(); + eCorpse.classname = "corpse"; setorigin( eCorpse, self.origin ); setmodel( eCorpse, self.model ); setsize( eCorpse, self.mins, self.maxs ); diff --git a/Source/Server/Rules.c b/Source/Server/Rules.c index 126c10e7..521578f9 100644 --- a/Source/Server/Rules.c +++ b/Source/Server/Rules.c @@ -27,6 +27,10 @@ enum { // Checks if it is possible for players to buy anything float Rules_BuyingPossible( void ) { + if ( self.health <= 0 ) { + return FALSE; + } + if ( fGameState == GAME_ACTIVE ) { if ( ( ( autocvar_mp_roundtime * 60 ) - fGameTime ) > autocvar_mp_buytime ) { centerprint( self, sprintf( "%d seconds have passed...\nYou can't buy anything now!", autocvar_mp_buytime ) ); @@ -68,6 +72,7 @@ void Rules_Restart( void ) { entity eOld = self; + // Spawn/Respawn everyone at their team position and give them $$$ for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) { self = eFind; @@ -80,7 +85,12 @@ void Rules_Restart( void ) { Money_GiveTeamReward(); } - // Select a random Terrorist for the bomb thing + // Clear the corpses + for ( entity eFind = world; ( eFind = find( eFind, classname, "corpse" ) ); ) { + remove( eFind ); + } + + // Select a random Terrorist for the bomb, if needed if ( iBombZones > 0 ) { int iRandomT = floor( random( 1, (float)iAlivePlayers_T + 1 ) ); int iPickT = 0; @@ -119,7 +129,6 @@ void Rules_Restart( void ) { } // Respawn all the entities - for ( entity eFind = world; ( eFind = findfloat( eFind, fRespawns, TRUE ) ); ) { self = eFind; Entities_Respawn(); @@ -180,10 +189,12 @@ Also allows people to set the bomb placing radius incase you want to use info_bo ================= */ .float buying; -void info_map_parameters( void ) { - if ( !self.buying ) { - self.buying = BUY_BOTH; - } else { +.float bombradius; +void info_map_parameters( void ) { + if ( self.bombradius ) { + iBombRadius = self.bombradius; + } + if ( self.buying ) { iBuyRestriction = self.buying; } } diff --git a/Source/Server/progs.src b/Source/Server/progs.src index be703708..17c28d60 100644 --- a/Source/Server/progs.src +++ b/Source/Server/progs.src @@ -56,6 +56,7 @@ FuncPushable.c FuncLadder.c FuncHostageRescue.c FuncVIPSafetyZone.c +FuncEscapeZone.c FuncBombTarget.c FuncBuyZone.c FuncButton.c diff --git a/Source/Shared/Equipment.c b/Source/Shared/Equipment.c index c88608d3..a10135e7 100644 --- a/Source/Shared/Equipment.c +++ b/Source/Shared/Equipment.c @@ -37,7 +37,7 @@ void CSEv_PlayerBuyEquipment_f( float fID ) { if ( ( self.fMoney - eqptTable[ fID ].iPrice ) >= 0 ) { if ( eqptTable[ fID ].iID == EQUIPMENT_KEVLAR ) { if ( self.armor == 100 ) { - // You already own armor etc. + // You already own kevlar etc. centerprint( self, "You already have kevlar!" ); } else { self.armor = 100; @@ -50,21 +50,21 @@ void CSEv_PlayerBuyEquipment_f( float fID ) { } else if ( eqptTable[ fID ].iID == EQUIPMENT_HELMET ) { if ( self.armor == 100 ) { if ( self.iEquipment & EQUIPMENT_HELMET ) { - // You already have full armor and a helmet + // You already have full kevlar and a helmet centerprint( self, "You already have kevlar and a helmet!" ); } else { - // You have full armor, but no helmet - centerprint( self, "You already have some kevlar,\nand now you've bought a helmet!" ); + // You have full kevlar, but no helmet Money_AddMoney( self, -350 ); sound( self, CHAN_ITEM, "items/tr_kevlar.wav", 1, ATTN_IDLE ); + centerprint( self, "You already have some kevlar,\nand now you've bought a helmet!" ); } } else { if ( self.iEquipment & EQUIPMENT_HELMET ) { - // Only get armor - centerprint( self, "You already have a helmet,\nand now you're bought some kevlar!" ); + // Only get kevlar self.armor = 100; Money_AddMoney( self, -650 ); sound( self, CHAN_ITEM, "items/tr_kevlar.wav", 1, ATTN_IDLE ); + centerprint( self, "You already have a helmet,\nand now you're bought some kevlar!" ); } else { // Get both self.armor = 100; @@ -78,8 +78,10 @@ void CSEv_PlayerBuyEquipment_f( float fID ) { return; } - self.iEquipment = self.iEquipment | ( eqptTable[ fID ].iID ); Money_AddMoney( self, -eqptTable[ fID ].iPrice ); + self.iEquipment = self.iEquipment | ( eqptTable[ fID ].iID ); + } else { + centerprint( self, "You have insufficient funds!" ); } self.fAttackFinished = time + 1.0; diff --git a/Source/Shared/WeaponC4Bomb.c b/Source/Shared/WeaponC4Bomb.c index 0c8a3d96..46313f48 100644 --- a/Source/Shared/WeaponC4Bomb.c +++ b/Source/Shared/WeaponC4Bomb.c @@ -72,11 +72,28 @@ void WeaponC4BOMB_Drop( vector vBombPos ) { // If our time has passed, explode if ( self.fAttackFinished < time ) { + // Terrorists win Rules_RoundOver( TEAM_T, 3500, FALSE ); + + // Make it explode and hurt things + Damage_Radius( self.origin, self, 500, 1024 ); sound( self, CHAN_VOICE, "weapons/c4_explode1.wav", 1.0, ATTN_NONE ); - Damage_Radius( self.origin, self.owner, 500, 1024 ); - remove( self ); + + // Trigger all targets + entity eBombChain = findradius( self.origin, iBombRadius ); + + while ( eBombChain ) { + if ( ( eBombChain.classname == "func_bomb_target" ) ) { + entity eOld = self; + self = eBombChain; + Entities_UseTargets(); + self = eOld; + } + eBombChain = eBombChain.chain; + } + iBombPlanted = FALSE; + remove( self ); return; } diff --git a/Source/Shared/Weapons.c b/Source/Shared/Weapons.c index f4f00406..5790fb60 100644 --- a/Source/Shared/Weapons.c +++ b/Source/Shared/Weapons.c @@ -192,6 +192,8 @@ void CSEv_PlayerBuyWeapon_f( float fWeapon ) { Money_AddMoney( self, -wptTable[ fWeapon ].iPrice ); sound( self, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_IDLE ); + } else { + centerprint( self, "You have insufficient funds!" ); } self.fAttackFinished = time + 1.0; diff --git a/opencs/progs.dat b/opencs/progs.dat index a1d875a4..c2a25ca3 100644 Binary files a/opencs/progs.dat and b/opencs/progs.dat differ