diff --git a/Source/server/cstrike/client.c b/Source/server/cstrike/client.c index 09769b42..66ddb750 100644 --- a/Source/server/cstrike/client.c +++ b/Source/server/cstrike/client.c @@ -154,10 +154,10 @@ void Game_PutClientInServer(void) Spawn_MakeSpectator(); Spawn_ObserverCam(); self.SendEntity = Player_SendEntity; - + // Because we don't want to reset these when we die Money_AddMoney(self, autocvar_mp_startmoney); - + if (cvar("mp_timelimit") > 0) { if (autocvar_fcs_voxannounce == TRUE) { float fTimeLeft = cvar("mp_timelimit") - (time / 60); diff --git a/Source/server/cstrike/damage.c b/Source/server/cstrike/damage.c index 85d5936f..fea45716 100644 --- a/Source/server/cstrike/damage.c +++ b/Source/server/cstrike/damage.c @@ -73,11 +73,11 @@ int Damage_ShouldDamage(float fTargetTeam, float fAttackerTeam) } else if (fAttackerTeam == TEAM_VIP) { fAttackerTeam = TEAM_CT; } - + if (fTargetTeam == fAttackerTeam) { return FALSE; } - + return TRUE; #endif } @@ -91,9 +91,9 @@ Generic function that applies damage, pain and suffering */ void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor) { -#ifdef CSTRIKE - // Modify the damage based on the location - if (trace_surface_id == BODY_HEAD) { + /* Modify the damage based on the location */ + switch (trace_surface_id) { + case BODY_HEAD: if (eTarget.iEquipment & EQUIPMENT_HELMET) { sound(self, CHAN_ITEM, "weapons/ric_metal-2.wav", 1, ATTN_IDLE); iDamage = 0; @@ -101,13 +101,16 @@ void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPo } else { iDamage *= 4; } - } else if (trace_surface_id == BODY_STOMACH) { + break; + case BODY_STOMACH: iDamage *= 0.9; - } else if (trace_surface_id == BODY_LEGLEFT) { - iDamage *= 0.4; - } else if (trace_surface_id == BODY_LEGRIGHT) { + break; + case BODY_LEGLEFT: + case BODY_LEGRIGHT: iDamage *= 0.4; + break; } + dprint(sprintf("[DEBUG] Hit Bodypart: %s\n", Damage_GetHitLocation(trace_surface_id))); if (eTarget != eAttacker) { @@ -120,15 +123,15 @@ void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPo eTarget.velocity = [0,0,0]; - // Apply the damage finally + /* Apply the damage finally */ if (eTarget.armor) { float fRatio = 0.5; if (eAttacker.weapon) { fRatio *= wptTable[eAttacker.weapon].fWeaponArmorRatio; } - - // Simple implementation of how kevlar damage is calculated + + /* Simple implementation of how kevlar damage is calculated */ float fNewDmg = iDamage * fRatio; float fNewArmor = (iDamage - fNewDmg) / 2; @@ -158,8 +161,8 @@ void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPo eTarget.dmg_take = (float)iDamage; } eTarget.dmg_inflictor = eAttacker; - - // Special monetary punishment for hostage murderers + + /* Special monetary punishment for hostage murderers */ if (eTarget.classname == "hostage_entity") { if (eTarget.health > 0) { Money_AddMoney(eAttacker, autocvar_fcs_penalty_pain); // Pain @@ -168,26 +171,29 @@ void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPo } } - // Target is dead and a client.... + /* Target is dead and a client.... */ if (eTarget.health <= 0) { if (eTarget.flags & FL_CLIENT) { eTarget.fDeaths++; forceinfokey(eTarget, "*deaths", ftos(eTarget.fDeaths)); } - + if ((eTarget.flags & FL_CLIENT) && (eAttacker.flags & FL_CLIENT)) { - // Don't encourage them to kill their own team members for $$$ + /* Don't encourage them to kill their own team members for $$$ */ if (Damage_ShouldDamage(eTarget.team, eAttacker.team) == TRUE) { eAttacker.frags++; Money_AddMoney(eAttacker, autocvar_fcs_reward_kill); } else { eAttacker.frags--; + /* Team killer */ + if (eTarget != eAttacker) { + Money_AddMoney(eAttacker, -3300); + } } - Damage_CastOrbituary(eAttacker, eTarget, eAttacker.weapon, trace_surface_id == BODY_HEAD ? TRUE:FALSE); } } - + entity eOld = self; self = eTarget; @@ -199,7 +205,6 @@ void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPo } self = eOld; -#endif } /* @@ -212,16 +217,8 @@ from a plain geographical standpoint */ float Damage_CheckAttack(entity eTarget, vector vAttackPos) { - if (eTarget.movetype == MOVETYPE_PUSH) { - traceline(vAttackPos, 0.5 * (eTarget.absmin + eTarget.absmax), TRUE, self); - - if (trace_fraction == 1) { - return TRUE; - } - if (trace_ent == eTarget) { - return TRUE; - } - return FALSE; + if (eTarget.solid == SOLID_BSP) { + return TRUE; } traceline(vAttackPos, eTarget.origin, TRUE, self); @@ -255,34 +252,28 @@ Damage_Radius Even more pain and suffering, mostly used for explosives ================= */ -void Damage_Radius(vector vOrigin, entity eAttacker, float fDamage, float fRadius, int iCheckClip) +void Damage_Radius(vector org, entity eAttacker, float fDamage, float fRadius, int iCheckClip) { - for (entity eDChain = world; (eDChain = findfloat(eDChain, takedamage, DAMAGE_YES));) { + for (entity c = world; (c = findfloat(c, takedamage, DAMAGE_YES));) { vector vecRealPos; - vecRealPos[0] = eDChain.absmin[0] + (0.5 * (eDChain.absmax[0] - eDChain.absmin[0])); - vecRealPos[1] = eDChain.absmin[1] + (0.5 * (eDChain.absmax[1] - eDChain.absmin[1])); - vecRealPos[2] = eDChain.absmin[2] + (0.5 * (eDChain.absmax[2] - eDChain.absmin[2])); + vecRealPos[0] = c.absmin[0] + (0.5 * (c.absmax[0] - c.absmin[0])); + vecRealPos[1] = c.absmin[1] + (0.5 * (c.absmax[1] - c.absmin[1])); + vecRealPos[2] = c.absmin[2] + (0.5 * (c.absmax[2] - c.absmin[2])); - float fDist = vlen(vOrigin - vecRealPos); - //vector vPush; + float fDist = vlen(org - vecRealPos); if (fDist > fRadius) { continue; } - if (Damage_CheckAttack(eDChain, vOrigin) || iCheckClip == FALSE) { - float fDiff = vlen(vOrigin - vecRealPos); + if (Damage_CheckAttack(c, org) || iCheckClip == FALSE) { + float fDiff = vlen(org - vecRealPos); fDiff = (fRadius - fDiff) / fRadius; fDamage = rint(fDamage * fDiff); if (fDiff > 0) { - Damage_Apply(eDChain, eAttacker, fDamage, eDChain.origin, TRUE); - /*if (eDChain.movetype != MOVETYPE_NONE) { - vPush = vectoangles(vecRealPos - vOrigin); - makevectors(vPush); - eDChain.velocity += (v_forward * fDamage * 5) + (v_up * fDamage * 2.5); - }*/ + Damage_Apply(c, eAttacker, fDamage, vecRealPos, 0); } } diff --git a/Source/server/cstrike/func_vip_safetyzone.cpp b/Source/server/cstrike/func_vip_safetyzone.cpp index 060ad279..2fd1f783 100644 --- a/Source/server/cstrike/func_vip_safetyzone.cpp +++ b/Source/server/cstrike/func_vip_safetyzone.cpp @@ -29,6 +29,9 @@ void func_vip_safetyzone::touch(void) { if (other.classname == "player") { if (other.team == TEAM_VIP) { + /* In Assassination, all Counter-Terrorists receive a $2500 + * reward if they won by successfully guaranteeing + * the escape of the VIP. */ Rules_RoundOver(TEAM_CT, 2500, FALSE); VIP_Rescue(other); } diff --git a/Source/server/cstrike/money.c b/Source/server/cstrike/money.c index e34a5a01..45b4eea4 100644 --- a/Source/server/cstrike/money.c +++ b/Source/server/cstrike/money.c @@ -74,3 +74,102 @@ void Money_ResetTeamReward(void) iMoneyReward_T = 0; iMoneyReward_CT = 0; } + +int iLosses_CT; +int iLosses_T; +int iWinstreak_CT; +int iWinstreak_T; +int iBonus_CT; +int iBonus_T; + +int Money_GetLosses(int team) +{ + if (team == TEAM_T) { + return iLosses_T; + } else { + return iLosses_CT; + } +} +int Money_HasBonus(int team) +{ + if (team == TEAM_T) { + return iBonus_T; + } else { + return iBonus_CT; + } +} + +void Money_HandleRoundReward(int winner) +{ + int loser; + + if (winner == TEAM_CT) { + iWinstreak_CT++; + iWinstreak_T = 0; + iLosses_T++; + iLosses_CT = 0; + loser = TEAM_T; + + if (iWinstreak_CT >= 2) { + iBonus_CT = TRUE; + } + } else if (winner == TEAM_T) { + iWinstreak_T++; + iWinstreak_CT = 0; + iLosses_CT++; + iLosses_T = 0; + loser = TEAM_CT; + + if (iWinstreak_T >= 2) { + iBonus_T = TRUE; + } + } + + /* After the condition of a team winning two consecutive rounds is + * satisfied then the loss bonus money changes to above where their + * first loss means they receive $1500 and not $1400. */ + if (Money_HasBonus(loser)) { + switch (Money_GetLosses(loser)) { + case 1: + Money_QueTeamReward(loser, 1500); + break; + case 2: + Money_QueTeamReward(loser, 2000); + break; + case 3: + Money_QueTeamReward(loser, 2500); + break; + default: + Money_QueTeamReward(loser, 3000); + break; + } + } else { + switch (Money_GetLosses(loser)) { + case 1: + Money_QueTeamReward(loser, 1400); + break; + case 2: + Money_QueTeamReward(loser, 1900); + break; + case 3: + Money_QueTeamReward(loser, 2400); + break; + case 4: + Money_QueTeamReward(loser, 2900); + break; + default: + Money_QueTeamReward(loser, 3400); + break; + } + } +} + +void Money_ResetRoundReward(void) +{ + iLosses_CT = + iLosses_T = + iWinstreak_CT = + iWinstreak_T = + iBonus_CT = + iBonus_T = 0; +} diff --git a/Source/server/cstrike/player.c b/Source/server/cstrike/player.c index e40efc2e..23b6662a 100644 --- a/Source/server/cstrike/player.c +++ b/Source/server/cstrike/player.c @@ -133,6 +133,8 @@ void Player_Death(int iHitBody) Rules_CountPlayers(); + /* In Assassination, all Terrorists receive a $2500 + * reward if they won by killing the VIP. */ if (self.team == TEAM_VIP) { Rules_RoundOver(TEAM_T, 2500, FALSE); return; diff --git a/Source/server/cstrike/rules.c b/Source/server/cstrike/rules.c index 58e8fb00..bf57f257 100755 --- a/Source/server/cstrike/rules.c +++ b/Source/server/cstrike/rules.c @@ -209,16 +209,15 @@ void Rules_RoundOver( int iTeamWon, int iMoneyReward, float fSilent ) { Radio_BroadcastMessage( RADIO_TERWIN ); } iWon_T++; - - // FIXME: Calculate the proper loss values - Money_QueTeamReward( TEAM_CT, 1400 ); + + Money_HandleRoundReward(TEAM_T); } else if ( iTeamWon == TEAM_CT ) { if ( fSilent == FALSE ) { Radio_BroadcastMessage( RADIO_CTWIN ); } iWon_CT++; - // FIXME: Calculate the proper loss values - Money_QueTeamReward( TEAM_T, 1400 ); + + Money_HandleRoundReward(TEAM_CT); } else { if ( fSilent == FALSE ) { Radio_BroadcastMessage( RADIO_ROUNDDRAW ); @@ -243,6 +242,8 @@ void Rules_TimeOver( void ) { if ( iVIPZones > 0 ) { Rules_RoundOver( TEAM_T, 3250, FALSE ); } else if ( iBombZones > 0 ) { + /* In Bomb Defusal, all Counter-Terrorists receive $3250 + * if they won running down the time. */ Rules_RoundOver( TEAM_CT, 3250, FALSE ); } else if ( iHostagesMax > 0 ) { // TODO: Broadcast_Print: Hostages have not been rescued! @@ -313,12 +314,23 @@ void Rules_DeathCheck(void) Rules_RoundOver( FALSE, 0, FALSE ); } } else { + int winner; if ( ( self.team == TEAM_T ) && ( iAlivePlayers_T == 0 ) ) { - if ( iBombPlanted == FALSE ) { - Rules_RoundOver( TEAM_CT, 3600, FALSE ); - } + winner = TEAM_CT; } else if ( ( self.team == TEAM_CT ) && ( iAlivePlayers_CT == 0 ) ) { - Rules_RoundOver( TEAM_T, 3600, FALSE ); + winner = TEAM_T; + } else { + return; + } + + if (iBombZones > 0) { + /* In Bomb Defusal, the winning team receives $3250 + * if they won by eliminating the enemy team. */ + Rules_RoundOver(winner, 3250, FALSE); + } else { + /* In Hostage Rescue, the winning team receives $3600 + * if they won by eliminating the enemy team. */ + Rules_RoundOver(winner, 3600, FALSE); } } } diff --git a/Source/server/cstrike/timer.c b/Source/server/cstrike/timer.c index a78054ec..86ee5252 100644 --- a/Source/server/cstrike/timer.c +++ b/Source/server/cstrike/timer.c @@ -45,7 +45,7 @@ void Timer_Update(void) fGameTime = -1; return; } - + // This map has been played enough we think if (fGameState != GAME_OVER) { if (cvar("mp_timelimit") > 0) { @@ -106,6 +106,7 @@ void Timer_Update(void) if (fGameTime <= 0) { if (iWon_T == 0 && iWon_CT == 0) { Money_ResetTeamReward(); + Money_ResetRoundReward(); Rules_Restart(TRUE); } else { if (autocvar_mp_halftime == TRUE && (autocvar_mp_winlimit / 2 == iRounds)) { diff --git a/Source/shared/cstrike/weaponc4bomb.c b/Source/shared/cstrike/weaponc4bomb.c index b5303d9d..0ba171b4 100755 --- a/Source/shared/cstrike/weaponc4bomb.c +++ b/Source/shared/cstrike/weaponc4bomb.c @@ -67,7 +67,9 @@ static void WeaponC4BOMB_Use( void ) { // Takes 10 seconds to defuse that thing! if ( fDefuseProgress > 10 ) { sound( self, CHAN_VOICE, "weapons/c4_disarmed.wav", 1.0, ATTN_NORM ); - Rules_RoundOver( TEAM_CT, 3500, TRUE ); + /* In Bomb Defusal, all Counter-Terrorists receive $3600 if + * they won by defusing the bomb. */ + Rules_RoundOver( TEAM_CT, 3600, TRUE ); Radio_BroadcastMessage( RADIO_BOMBDEF ); eActivator.fProgressBar = 0; iBombPlanted = FALSE; @@ -100,7 +102,8 @@ static void WeaponC4BOMB_Think( void ) { // If our time has passed, explode if ( self.fAttackFinished < time ) { - // Terrorists win + /* In Bomb Defusal, all Terrorists receive $3500 + * if they won by detonating the bomb. */ Rules_RoundOver( TEAM_T, 3500, FALSE ); // Make it explode and hurt things diff --git a/Source/shared/cstrike/weaponflashbang.c b/Source/shared/cstrike/weaponflashbang.c index c675af52..3038ef9d 100755 --- a/Source/shared/cstrike/weaponflashbang.c +++ b/Source/shared/cstrike/weaponflashbang.c @@ -142,6 +142,7 @@ void WeaponFLASHBANG_Throw( void ) { eNade.nextthink = time + 3.0f; self.iAmmo_FLASHBANG--; + Radio_TeamMessage(RADIO_CT_FIREINHOLE, self.team); if ( !self.iAmmo_FLASHBANG ) { Weapon_SwitchBest(); diff --git a/Source/shared/cstrike/weaponhegrenade.c b/Source/shared/cstrike/weaponhegrenade.c index 84905f23..8628f9fb 100755 --- a/Source/shared/cstrike/weaponhegrenade.c +++ b/Source/shared/cstrike/weaponhegrenade.c @@ -125,6 +125,8 @@ void WeaponHEGRENADE_Throw( void ) { self.iAmmo_HEGRENADE--; + Radio_TeamMessage(RADIO_CT_FIREINHOLE, self.team); + if ( !self.iAmmo_HEGRENADE ) { Weapon_SwitchBest(); } else { diff --git a/Source/shared/cstrike/weaponm3.c b/Source/shared/cstrike/weaponm3.c index faed9d29..02de7787 100755 --- a/Source/shared/cstrike/weaponm3.c +++ b/Source/shared/cstrike/weaponm3.c @@ -116,22 +116,27 @@ void WeaponM3_Secondary( void ) { void WeaponM3_Reload( void ) { #ifdef SSQC // Can we reload the gun even if we wanted to? - if ( ( self.(wptM3.iMagfld) != wptM3.iMagSize ) && ( self.(wptM3.iCaliberfld) > 0 ) ) { - self.iMode_M3 = 1 - self.iMode_M3; - - if ( self.iMode_M3 == TRUE ) { - self.think = WeaponM3_Secondary; - self.nextthink = time + 0.8; - } else { - self.think = WeaponM3_ReloadNULL; - } - - Client_SendEvent( self, EV_WEAPON_RELOAD ); - self.fAttackFinished = time + 1.0; + if (( self.(wptM3.iMagfld) == wptM3.iMagSize )) { + return; } + if (self.(wptM3.iCaliberfld) <= 0) { + return; + } + + self.iMode_M3 = 1 - self.iMode_M3; + + if (self.iMode_M3) { + self.think = WeaponM3_Secondary; + self.nextthink = time + 0.8; + } else { + self.think = WeaponM3_ReloadNULL; + } + + Client_SendEvent( self, EV_WEAPON_RELOAD ); + self.fAttackFinished = time + 1.0; #else iWeaponMode_M3 = 1 - iWeaponMode_M3; - + if ( iWeaponMode_M3 == TRUE ) { View_PlayAnimation( ANIM_M3_RELOAD_START ); } else { diff --git a/Source/shared/cstrike/weapons.c b/Source/shared/cstrike/weapons.c index fb111c05..a0f8e12d 100755 --- a/Source/shared/cstrike/weapons.c +++ b/Source/shared/cstrike/weapons.c @@ -239,8 +239,15 @@ void Weapon_Release( void ) { } else if ( self.weapon == WEAPON_C4BOMB ) { WeaponC4BOMB_Release(); } else { - if (self.(wptTable[ self.weapon ].iMagfld) == 0 && self.(wptTable[ self.weapon ].iCaliberfld)) { - Weapon_Reload(self.weapon); + if (self.weapon == WEAPON_XM1014) { + return; + } else if (self.weapon == WEAPON_M3) { + return; + } + if (self.(wptTable[ self.weapon ].iMagfld) <= 0) { + if (self.(wptTable[ self.weapon ].iCaliberfld)) { + Weapon_Reload(self.weapon); + } } } } diff --git a/Source/shared/cstrike/weaponsmokegrenade.c b/Source/shared/cstrike/weaponsmokegrenade.c index 604ea953..5b0a6c79 100755 --- a/Source/shared/cstrike/weaponsmokegrenade.c +++ b/Source/shared/cstrike/weaponsmokegrenade.c @@ -132,6 +132,7 @@ void WeaponSMOKEGRENADE_Throw( void ) { eNade.gravity = 0.5f; self.iAmmo_SMOKEGRENADE--; + Radio_TeamMessage(RADIO_CT_FIREINHOLE, self.team); if ( !self.iAmmo_SMOKEGRENADE ) { Weapon_SwitchBest(); diff --git a/Source/shared/cstrike/weaponxm1014.c b/Source/shared/cstrike/weaponxm1014.c index 8c18f329..dc3811ab 100755 --- a/Source/shared/cstrike/weaponxm1014.c +++ b/Source/shared/cstrike/weaponxm1014.c @@ -114,19 +114,24 @@ void WeaponXM1014_Secondary( void ) { void WeaponXM1014_Reload( void ) { #ifdef SSQC // Can we reload the gun even if we wanted to? - if ( ( self.(wptXM1014.iMagfld) != wptXM1014.iMagSize ) && ( self.(wptXM1014.iCaliberfld) > 0 ) ) { - self.iMode_XM1014 = 1 - self.iMode_XM1014; - - if ( self.iMode_XM1014 == TRUE ) { - self.think = WeaponXM1014_Secondary; - self.nextthink = time + 0.8; - } else { - self.think = WeaponXM1014_ReloadNULL; - } - - Client_SendEvent( self, EV_WEAPON_RELOAD ); - self.fAttackFinished = time + 0.5; + if (self.(wptXM1014.iMagfld) == wptXM1014.iMagSize) { + return; } + if (self.(wptXM1014.iCaliberfld) <= 0) { + return; + } + + self.iMode_XM1014 = 1 - self.iMode_XM1014; + + if ( self.iMode_XM1014 == TRUE ) { + self.think = WeaponXM1014_Secondary; + self.nextthink = time + 0.8; + } else { + self.think = WeaponXM1014_ReloadNULL; + } + + Client_SendEvent( self, EV_WEAPON_RELOAD ); + self.fAttackFinished = time + 0.5; #else iWeaponMode_XM1014 = 1 - iWeaponMode_XM1014; diff --git a/cstrike/data.pk3dir/csprogs.dat b/cstrike/data.pk3dir/csprogs.dat index b6545f10..53d947f1 100644 Binary files a/cstrike/data.pk3dir/csprogs.dat and b/cstrike/data.pk3dir/csprogs.dat differ diff --git a/cstrike/data.pk3dir/progs.dat b/cstrike/data.pk3dir/progs.dat index 3056ff0b..1542bfae 100644 Binary files a/cstrike/data.pk3dir/progs.dat and b/cstrike/data.pk3dir/progs.dat differ diff --git a/rewolf/data.pk3dir/csprogs.dat b/rewolf/data.pk3dir/csprogs.dat index 834b6ec7..8cf5b667 100644 Binary files a/rewolf/data.pk3dir/csprogs.dat and b/rewolf/data.pk3dir/csprogs.dat differ diff --git a/rewolf/data.pk3dir/progs.dat b/rewolf/data.pk3dir/progs.dat index ec09db8a..197d441d 100644 Binary files a/rewolf/data.pk3dir/progs.dat and b/rewolf/data.pk3dir/progs.dat differ diff --git a/scihunt/data.pk3dir/csprogs.dat b/scihunt/data.pk3dir/csprogs.dat index d959bbd8..ff89c3cc 100644 Binary files a/scihunt/data.pk3dir/csprogs.dat and b/scihunt/data.pk3dir/csprogs.dat differ diff --git a/scihunt/data.pk3dir/progs.dat b/scihunt/data.pk3dir/progs.dat index f405e036..028bae07 100644 Binary files a/scihunt/data.pk3dir/progs.dat and b/scihunt/data.pk3dir/progs.dat differ diff --git a/valve/data.pk3dir/csprogs.dat b/valve/data.pk3dir/csprogs.dat index 60ac2854..5f9b1c38 100644 Binary files a/valve/data.pk3dir/csprogs.dat and b/valve/data.pk3dir/csprogs.dat differ diff --git a/valve/data.pk3dir/menu.dat b/valve/data.pk3dir/menu.dat index 3b03243f..8421a153 100644 Binary files a/valve/data.pk3dir/menu.dat and b/valve/data.pk3dir/menu.dat differ diff --git a/valve/data.pk3dir/progs.dat b/valve/data.pk3dir/progs.dat index 090bc0f1..a9d5d552 100644 Binary files a/valve/data.pk3dir/progs.dat and b/valve/data.pk3dir/progs.dat differ