From ba88b9e8181ed24537e6c0f9207bf2a3cc7706ae Mon Sep 17 00:00:00 2001 From: Marco Hladik Date: Mon, 5 Dec 2016 19:06:24 +0100 Subject: [PATCH] Improved crouching by a ton, changed speed handling (via multipliers) and fixed the timer so that we can do cool things which will come in later. --- Source/Client/View.c | 3 +- Source/Client/progs.src | 1 + Source/Globals.h | 8 ++- Source/Server/Client.c | 8 ++- Source/Server/Defs.h | 8 ++- Source/Server/FuncEscapeZone.c | 2 - Source/Server/FuncHostageRescue.c | 1 + Source/Server/Main.c | 33 +++++---- Source/Server/Player.c | 49 +++++-------- Source/Server/Rules.c | 1 + Source/Server/Spawn.c | 51 +++++++------ Source/Server/Timer.c | 18 +++-- Source/Server/progs.src | 1 + Source/Shared/WeaponAK47.c | 2 +- Source/Shared/WeaponAUG.c | 2 +- Source/Shared/WeaponAWP.c | 2 +- Source/Shared/WeaponBase.c | 3 +- Source/Shared/WeaponC4Bomb.c | 115 ++++++++++++++++++++++++++++++ Source/Shared/WeaponDeagle.c | 2 +- Source/Shared/WeaponElites.c | 2 +- Source/Shared/WeaponFiveSeven.c | 2 +- Source/Shared/WeaponG3SG1.c | 2 +- Source/Shared/WeaponGlock18.c | 2 +- Source/Shared/WeaponM3.c | 2 +- Source/Shared/WeaponM4A1.c | 2 +- Source/Shared/WeaponMP5.c | 2 +- Source/Shared/WeaponMac10.c | 2 +- Source/Shared/WeaponP228.c | 2 +- Source/Shared/WeaponP90.c | 2 +- Source/Shared/WeaponPara.c | 2 +- Source/Shared/WeaponSG550.c | 2 +- Source/Shared/WeaponSG552.c | 2 +- Source/Shared/WeaponScout.c | 2 +- Source/Shared/WeaponTMP.c | 2 +- Source/Shared/WeaponUMP45.c | 2 +- Source/Shared/WeaponUSP45.c | 2 +- Source/Shared/WeaponXM1014.c | 2 +- Source/Shared/Weapons.c | 15 +++- 38 files changed, 255 insertions(+), 106 deletions(-) create mode 100644 Source/Shared/WeaponC4Bomb.c diff --git a/Source/Client/View.c b/Source/Client/View.c index 574a21c1..795c776d 100644 --- a/Source/Client/View.c +++ b/Source/Client/View.c @@ -42,7 +42,8 @@ string sViewModels[ CS_WEAPON_COUNT ] = { "models/v_awp.mdl", "models/v_g3sg1.mdl", "models/v_sg550.mdl", - "models/v_m249.mdl" + "models/v_m249.mdl", + "models/v_c4.mdl" }; entity eViewModel; diff --git a/Source/Client/progs.src b/Source/Client/progs.src index cb16df85..443872e2 100644 --- a/Source/Client/progs.src +++ b/Source/Client/progs.src @@ -12,6 +12,7 @@ Defs.h ../Shared/WeaponAK47.c ../Shared/WeaponAUG.c ../Shared/WeaponAWP.c +../Shared/WeaponC4Bomb.c ../Shared/WeaponDeagle.c ../Shared/WeaponElites.c ../Shared/WeaponFiveSeven.c diff --git a/Source/Globals.h b/Source/Globals.h index d2bc41ad..aa32e1d4 100644 --- a/Source/Globals.h +++ b/Source/Globals.h @@ -44,12 +44,13 @@ enum { enum { GAME_INACTIVE, + GAME_COMMENCING, GAME_FREEZE, GAME_ACTIVE, GAME_END }; -#define CS_WEAPON_COUNT 24 +#define CS_WEAPON_COUNT 25 enum { WEAPON_NONE = 0, WEAPON_KNIFE, @@ -74,7 +75,8 @@ enum { WEAPON_AWP, WEAPON_G3SG1, WEAPON_SG550, - WEAPON_PARA + WEAPON_PARA, + WEAPON_C4BOMB }; enum { @@ -121,7 +123,7 @@ typedef struct { int iSlot; int iPrice; int iCaliber; - int iPlayerSpeed; + float fSpeedM; int iBullets; // How many bullets does it shoot? int iClipSize; // How big is the clip/magazine? diff --git a/Source/Server/Client.c b/Source/Server/Client.c index 09748c0f..78fa0b0b 100644 --- a/Source/Server/Client.c +++ b/Source/Server/Client.c @@ -27,9 +27,13 @@ void ClientDisconnect( void ) { // We were part of the session if( self.iInGame == TRUE ) { if ( self.team == TEAM_T ) { - iInGamePlayers_T--; + if ( self.health > 0 ) { + iAlivePlayers_T--; + } } else if ( self.team == TEAM_CT ) { - iInGamePlayers_CT--; + if ( self.health > 0 ) { + iAlivePlayers_CT--; + } } } } diff --git a/Source/Server/Defs.h b/Source/Server/Defs.h index 6bc53c3b..6f7e0941 100644 --- a/Source/Server/Defs.h +++ b/Source/Server/Defs.h @@ -41,12 +41,14 @@ float EFFECT_BLOOD; .float fCharModel; .int iCrouching; .int iCrouchAttempt; +.int iHasBomb; // Match specific fields int iWon_T; int iWon_CT; -int iInGamePlayers_T; -int iInGamePlayers_CT; + +int iAlivePlayers_T; +int iAlivePlayers_CT; int fOldInGamePlayers; float fGameState; @@ -103,11 +105,13 @@ void Spawn_RespawnClient( float fTeam ); void Spawn_CreateClient( float fTeam ); void Spawn_MakeSpectator( void ); void Client_SendEvent( entity eClient, float fEVType ); +void Weapon_SwitchBest( void ); void OpenCSGunBase_AccuracyCalc( void ); void OpenCSGunBase_Draw( void ); float OpenCSGunBase_PrimaryFire( void ); float OpenCSGunBase_Reload( void ); +float Player_GetMaxSpeed( float fWeapon ); void TraceAttack_FireBullets( int iShots ); diff --git a/Source/Server/FuncEscapeZone.c b/Source/Server/FuncEscapeZone.c index 185c0ad6..0b74d65c 100644 --- a/Source/Server/FuncEscapeZone.c +++ b/Source/Server/FuncEscapeZone.c @@ -49,6 +49,4 @@ void func_escapezone( void ) { self.model = 0; self.touch = func_escapezone_touch; - - iRescueZones++; } diff --git a/Source/Server/FuncHostageRescue.c b/Source/Server/FuncHostageRescue.c index af2d0663..c0243bd0 100644 --- a/Source/Server/FuncHostageRescue.c +++ b/Source/Server/FuncHostageRescue.c @@ -38,6 +38,7 @@ void func_hostage_rescue_touch( void ) { remove( other ); if ( iHostagesRescued >= iHostagesMax ) { + // TODO: Broadcast_Print: All Hostages have been rescued! Rules_RoundOver( TEAM_CT ); } } diff --git a/Source/Server/Main.c b/Source/Server/Main.c index e3b2f5b6..1ba56c27 100644 --- a/Source/Server/Main.c +++ b/Source/Server/Main.c @@ -30,13 +30,18 @@ void StartFrame( void ) { Game_CreateRescueZones(); } - // Global amount of players etc. - int iInGamePlayers = ( iInGamePlayers_T + iInGamePlayers_CT ); + int iInGamePlayers; + // Sigh, check if clients are in the game + if ( find( world, classname , "player" ) != world ) { + iInGamePlayers = 100; + } else { + iInGamePlayers = 0; + } // See if the player count has changed - if ( iInGamePlayers > fOldInGamePlayers && fGameState == GAME_INACTIVE ) { - bprint( "Starting Match...\n" ); - Timer_Begin( cvar( "mp_freezetime" ), GAME_FREEZE ); + if ( iInGamePlayers > fOldInGamePlayers ) { + bprint( "Game commencing...\n" ); + Timer_Begin( 2, GAME_COMMENCING ); fOldInGamePlayers = iInGamePlayers; } else { // No players? Don't bother updating the Timer @@ -51,14 +56,15 @@ void StartFrame( void ) { // The map... entity. void worldspawn( void ) { - precache_model (sCSPlayers[1]); - precache_model (sCSPlayers[2]); - precache_model (sCSPlayers[3]); - precache_model (sCSPlayers[4]); - precache_model (sCSPlayers[5]); - precache_model (sCSPlayers[6]); - precache_model (sCSPlayers[7]); - precache_model (sCSPlayers[8]); + precache_model( sCSPlayers[1] ); + precache_model( sCSPlayers[2] ); + precache_model( sCSPlayers[3] ); + precache_model( sCSPlayers[4] ); + precache_model( sCSPlayers[5] ); + precache_model( sCSPlayers[6] ); + precache_model( sCSPlayers[7] ); + precache_model( sCSPlayers[8] ); + precache_model( "models/w_c4.mdl" ); EFFECT_GUNSHOT = particleeffectnum( "te_gunshot" ); EFFECT_BLOOD = particleeffectnum( "te_blood" ); @@ -71,6 +77,7 @@ void worldspawn( void ) { precache_sound( "radio/terwin.wav" ); precache_sound( "radio/ctwin.wav" ); precache_sound( "radio/rounddraw.wav" ); + precache_sound( "radio/bombpl.wav" ); precache_sound( "hostage/hos1.wav" ); precache_sound( "hostage/hos2.wav" ); diff --git a/Source/Server/Player.c b/Source/Server/Player.c index 34e00ef4..1c02ddf0 100644 --- a/Source/Server/Player.c +++ b/Source/Server/Player.c @@ -34,15 +34,15 @@ void Player_Death( void ) { Spawn_MakeSpectator(); if ( self.team == TEAM_T ) { - iInGamePlayers_T--; + iAlivePlayers_T--; - if ( iInGamePlayers_T == 0 ) { + if ( iAlivePlayers_T == 0 ) { Rules_RoundOver( TEAM_CT ); } } else if ( self.team == TEAM_CT ) { - iInGamePlayers_CT--; + iAlivePlayers_CT--; - if ( iInGamePlayers_CT == 0 ) { + if ( iAlivePlayers_T == 0 ) { Rules_RoundOver( TEAM_T ); } } else if ( self.team == TEAM_VIP ) { @@ -50,39 +50,27 @@ void Player_Death( void ) { } } +float Player_GetMaxSpeed( float fWeapon ) { + if ( self.iCrouching == TRUE ) { + return (cvar( "cl_forwardspeed" ) * wptTable[ fWeapon ].fSpeedM) * 0.5; + } else { + return cvar( "cl_forwardspeed" ) * wptTable[ fWeapon ].fSpeedM; + } +} + /* ================= Player_CrouchCheck - -TODO: Tracebox implementation sucks, BUT SHOULD BE USED HERE. -This is just a hack because for some reason traceboxes hate HLBSP ================= */ float Player_CrouchCheck( entity targ ) { - float fCheck = TRUE; + float fCheck = FALSE; vector vTrace = self.origin + '0 0 20'; - traceline( vTrace + '0 0 -36', vTrace + '0 0 36', FALSE, self ); - if ( trace_fraction != 1 ) { - fCheck = FALSE; - } - - // Now the 4 edges - traceline( vTrace + '-16 0 -36', vTrace + '-16 0 36', FALSE, self ); - if ( trace_fraction != 1 ) { - fCheck = FALSE; - } - traceline( vTrace + '0 -16 -36', vTrace + '0 -16 36', FALSE, self ); - if ( trace_fraction != 1 ) { - fCheck = FALSE; - } - traceline( vTrace + '16 0 -36', vTrace + '16 0 36', FALSE, self ); - if ( trace_fraction != 1 ) { - fCheck = FALSE; - } - traceline( vTrace + '0 16 -36', vTrace + '0 16 36', FALSE, self ); - if ( trace_fraction != 1 ) { - fCheck = FALSE; + tracebox( vTrace, VEC_HULL_MIN, VEC_HULL_MAX, vTrace, FALSE, self ); + + if ( trace_startsolid == FALSE ) { + fCheck = TRUE; } return fCheck; @@ -103,6 +91,7 @@ void Player_CrouchDown( void ) { self.iCrouching = TRUE; self.view_ofs = VEC_PLAYER_CVIEWPOS; self.velocity_z = self.velocity_z + 50; + self.maxspeed = Player_GetMaxSpeed( self.weapon ); self.iCrouchAttempt = 1; return; } @@ -128,7 +117,7 @@ void Player_CrouchUp( void ) { self.view_ofs = VEC_PLAYER_VIEWPOS; self.iCrouching = FALSE; self.iCrouchAttempt = FALSE; - + self.maxspeed = Player_GetMaxSpeed( self.weapon ); return; } diff --git a/Source/Server/Rules.c b/Source/Server/Rules.c index be74d47a..bb86a6cb 100644 --- a/Source/Server/Rules.c +++ b/Source/Server/Rules.c @@ -74,6 +74,7 @@ void Rules_TimeOver( void ) { if ( iBombZones > 0 ) { Rules_RoundOver( TEAM_CT ); } else if ( iHostagesMax > 0 ) { + // TODO: Broadcast_Print: Hostages have not been rescued! Rules_RoundOver( TEAM_T ); } else { Rules_RoundOver( 0 ); diff --git a/Source/Server/Spawn.c b/Source/Server/Spawn.c index 6795f3fb..87f208a3 100644 --- a/Source/Server/Spawn.c +++ b/Source/Server/Spawn.c @@ -83,6 +83,7 @@ void Spawn_RespawnClient( float fTeam ) { self.velocity = '0 0 0'; self.frame = 1; // Idle frame + self.fBombProgress = 0; } void Spawn_CreateClient( float fCharModel ) { @@ -92,13 +93,14 @@ void Spawn_CreateClient( float fCharModel ) { return; } else if( fCharModel < 5 ) { self.team = TEAM_T; - iInGamePlayers_T++; + iAlivePlayers_T++; Weapon_AddItem( WEAPON_GLOCK18 ); Weapon_GiveAmmo( WEAPON_GLOCK18, 40 ); + //Weapon_AddItem( WEAPON_C4BOMB ); } else { self.team = TEAM_CT; - iInGamePlayers_CT++; + iAlivePlayers_CT++; Weapon_AddItem( WEAPON_USP45 ); Weapon_GiveAmmo( WEAPON_USP45, 24 ); @@ -140,27 +142,32 @@ void Spawn_MakeSpectator( void ) { // Event Handling, called by the Client codebase via 'sendevent' void CSEv_GamePlayerSpawn_f( float fChar ) { - // Only allow to spawn directly into the game if we are still freezed/inactive - if ( fGameState == GAME_ACTIVE || fGameState == GAME_END ) { - // Yeah, set the future player model and stuff but let's act dead - if( fChar == 0 ) { - PutClientInServer(); - return; - } else if( fChar < 5 ) { - self.team = TEAM_T; - } else { - self.team = TEAM_CT; - } - - self.classname = "player"; - self.fCharModel = fChar; - self.health = 0; - Spawn_MakeSpectator(); - } else { - self.fCharModel = fChar; - Spawn_CreateClient( fChar ); - } + switch ( fGameState ) { + case GAME_INACTIVE: + case GAME_COMMENCING: + case GAME_ACTIVE: + case GAME_END: + if( fChar == 0 ) { + PutClientInServer(); + return; + } else if( fChar < 5 ) { + self.team = TEAM_T; + } else { + self.team = TEAM_CT; + } + + self.classname = "player"; + self.fCharModel = fChar; + self.health = 0; + Spawn_MakeSpectator(); + break; + default: + self.fCharModel = fChar; + Spawn_CreateClient( fChar ); + break; + + } } // Counter-Terrorist Spawnpoints diff --git a/Source/Server/Timer.c b/Source/Server/Timer.c index a47c3a31..8105a419 100644 --- a/Source/Server/Timer.c +++ b/Source/Server/Timer.c @@ -24,23 +24,33 @@ void Timer_Begin( float fTime, float fMode) { dprint( "[DEBUG] Game Freezetime\n" ); fGameState = GAME_FREEZE; } else if ( fMode == GAME_ACTIVE ) { - dprint( "[DEBUG] Game Started\n" ); + dprint( "[DEBUG] Game Active\n" ); fGameState = GAME_ACTIVE; } else if ( fMode == GAME_END ) { dprint( "[DEBUG] Game Ended\n" ); fGameState = GAME_END; + } else if ( fMode == GAME_COMMENCING ) { + dprint( "[DEBUG] Game Commencing\n" ); + fGameState = GAME_COMMENCING; } fGameTime = fTime; } void Timer_Update( void ) { - if ( fGameTime <= 0 || fGameState == GAME_INACTIVE ) { + if ( fGameState == GAME_INACTIVE ) { return; } fGameTime -= frametime; + if ( fGameState == GAME_COMMENCING || fGameState == GAME_END ) { + if ( fGameTime <= 0 ) { + Rules_Restart(); + } + return; + } + if ( ( fGameState == GAME_ACTIVE ) || ( fGameState == GAME_FREEZE ) ) { if ( fGameTime <= 0 ) { if ( fGameState == GAME_ACTIVE ) { @@ -59,9 +69,5 @@ void Timer_Update( void ) { } } } - } else if ( fGameState == GAME_END ) { - if ( fGameTime <= 0 ) { - Rules_Restart(); - } } } diff --git a/Source/Server/progs.src b/Source/Server/progs.src index 7e0d1782..562c07b9 100644 --- a/Source/Server/progs.src +++ b/Source/Server/progs.src @@ -11,6 +11,7 @@ Defs.h ../Shared/WeaponAK47.c ../Shared/WeaponAUG.c ../Shared/WeaponAWP.c +../Shared/WeaponC4Bomb.c ../Shared/WeaponDeagle.c ../Shared/WeaponElites.c ../Shared/WeaponFiveSeven.c diff --git a/Source/Shared/WeaponAK47.c b/Source/Shared/WeaponAK47.c index de847ea4..c229eeae 100644 --- a/Source/Shared/WeaponAK47.c +++ b/Source/Shared/WeaponAK47.c @@ -26,7 +26,7 @@ weaponinfo_t wptAK47 = { SLOT_PRIMARY, 2500, // Price CALIBER_762MM, // Caliber ID - 221, // Max Player Speed + 0.88, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 36, // Damage Per Bullet diff --git a/Source/Shared/WeaponAUG.c b/Source/Shared/WeaponAUG.c index 93f0403d..34932cc7 100644 --- a/Source/Shared/WeaponAUG.c +++ b/Source/Shared/WeaponAUG.c @@ -26,7 +26,7 @@ weaponinfo_t wptAUG = { SLOT_PRIMARY, 3500, // Price CALIBER_762MM, // Caliber ID - 221, // Max Player Speed + 0.96, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 32, // Damage Per Bullet diff --git a/Source/Shared/WeaponAWP.c b/Source/Shared/WeaponAWP.c index 5b980244..0fb1452e 100644 --- a/Source/Shared/WeaponAWP.c +++ b/Source/Shared/WeaponAWP.c @@ -26,7 +26,7 @@ weaponinfo_t wptAWP = { SLOT_PRIMARY, 4750, // Price CALIBER_338MAG, // Caliber ID - 210, // Max Player Speed + 0.84, // Max Player Speed 1, // Bullets Per Shot 10, // Clip/MagSize 115, // Damage Per Bullet diff --git a/Source/Shared/WeaponBase.c b/Source/Shared/WeaponBase.c index 1b85b8d9..c3a7329f 100644 --- a/Source/Shared/WeaponBase.c +++ b/Source/Shared/WeaponBase.c @@ -45,7 +45,8 @@ weaponinfo_t wptTable[ CS_WEAPON_COUNT ] = { wptAWP, wptG3SG1, wptSG550, - wptPARA + wptPARA, + wptC4BOMB }; #ifdef SSQC diff --git a/Source/Shared/WeaponC4Bomb.c b/Source/Shared/WeaponC4Bomb.c new file mode 100644 index 00000000..4e7c6bc8 --- /dev/null +++ b/Source/Shared/WeaponC4Bomb.c @@ -0,0 +1,115 @@ +/* +OpenCS Project +Copyright (C) 2015 Marco "eukara" Hladik + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +See the GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +*/ + +#ifdef SSQC +.float fBombProgress; +#else +int iBombProgress; +#endif + +// Weapon Info +weaponinfo_t wptC4BOMB = { + WEAPON_C4BOMB, // Identifier + SLOT_GRENADE, + 650, // Price + CALIBER_50AE, // Caliber ID + 1.0, // Max Player Speed + 1, // Bullets Per Shot + 1, // Clip/MagSize + 54, // Damage + 1, // Penetration Multiplier + 64, // Bullet Range + 0.81, // Range Modifier + TYPE_AUTO, + 0.0, // Attack-Delay + 0.0, // Reload-Delay + iAmmo_9MM, // Caliber Pointer + iAmmo_9MM, // Clip Pointer + 1, // Accuracy Divisor + 1, // Accuracy Offset + 1 // Max Inaccuracy +}; + +// Anim Table +enum { + ANIM_C4_IDLE, + ANIM_C4_DRAW, + ANIM_C4_DROP, + ANIM_C4_ENTERCODE +}; + +#ifdef SSQC +void WeaponC4BOMB_Drop( vector vBombPos ) { + entity eBomb = spawn(); + setorigin( eBomb, vBombPos ); + setmodel( eBomb, "models/w_c4.mdl" ); + + sound( world, CHAN_VOICE, "radio/bombpl.wav", 1.0, ATTN_NONE ); + + Weapon_SwitchBest(); +} +#endif + +void WeaponC4BOMB_Draw( void ) { +#ifdef SSQC + self.iCurrentClip = 0; + self.iCurrentCaliber = 0; + Client_SendEvent( self, EV_WEAPON_DRAW ); +#else + View_PlayAnimation( ANIM_C4_DRAW ); +#endif +} + +void WeaponC4BOMB_Release( void ) { +#ifdef SSQC + self.fBombProgress = 0; +#else + View_PlayAnimation( ANIM_C4_IDLE ); + iBombProgress = 0; +#endif +} + +void WeaponC4BOMB_PrimaryFire( void ) { +#ifdef SSQC + makevectors( self.v_angle ); + traceline( self.origin + self.view_ofs, self.origin + self.view_ofs + ( v_forward * 64 ), FALSE, self ); + + if ( trace_fraction == 1 || self.fInBombZone == FALSE ) { + WeaponC4BOMB_Release(); + self.fAttackFinished = time + 1.0; + } + + // Play the sequence at the start + if ( self.fBombProgress == 0 ) { + Client_SendEvent( self, EV_WEAPON_PRIMARYATTACK ); + } + + // Add onto the planting-time thing + self.fBombProgress += frametime; + + // 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 + View_PlayAnimation( ANIM_C4_ENTERCODE ); +#endif +} diff --git a/Source/Shared/WeaponDeagle.c b/Source/Shared/WeaponDeagle.c index 027cd2b0..aac3ba34 100644 --- a/Source/Shared/WeaponDeagle.c +++ b/Source/Shared/WeaponDeagle.c @@ -26,7 +26,7 @@ weaponinfo_t wptDEAGLE = { SLOT_SECONDARY, 650, // Price CALIBER_50AE, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 7, // Clip/MagSize 54, // Damage Per Bullet diff --git a/Source/Shared/WeaponElites.c b/Source/Shared/WeaponElites.c index 8b1b288b..b5768996 100644 --- a/Source/Shared/WeaponElites.c +++ b/Source/Shared/WeaponElites.c @@ -32,7 +32,7 @@ weaponinfo_t wptELITES = { SLOT_SECONDARY, 800, // Price CALIBER_9MM, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 45, // Damage Per Bullet diff --git a/Source/Shared/WeaponFiveSeven.c b/Source/Shared/WeaponFiveSeven.c index bb50092f..673279e9 100644 --- a/Source/Shared/WeaponFiveSeven.c +++ b/Source/Shared/WeaponFiveSeven.c @@ -26,7 +26,7 @@ weaponinfo_t wptFIVESEVEN = { SLOT_SECONDARY, 750, // Price CALIBER_57MM, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 20, // Clip/MagSize 25, // Damage Per Bullet diff --git a/Source/Shared/WeaponG3SG1.c b/Source/Shared/WeaponG3SG1.c index 2f6d15fb..2ea7aedb 100644 --- a/Source/Shared/WeaponG3SG1.c +++ b/Source/Shared/WeaponG3SG1.c @@ -26,7 +26,7 @@ weaponinfo_t wptG3SG1 = { SLOT_PRIMARY, 5000, // Price CALIBER_762MM, // Caliber ID - 210, // Max Player Speed + 0.84, // Max Player Speed 1, // Bullets Per Shot 20, // Clip/MagSize 80, // Damage Per Bullet diff --git a/Source/Shared/WeaponGlock18.c b/Source/Shared/WeaponGlock18.c index 91924e83..ae274be8 100644 --- a/Source/Shared/WeaponGlock18.c +++ b/Source/Shared/WeaponGlock18.c @@ -32,7 +32,7 @@ weaponinfo_t wptGLOCK18 = { SLOT_SECONDARY, 400, // Price CALIBER_9MM, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 20, // Clip/MagSize 25, // Damage Per Bullet diff --git a/Source/Shared/WeaponM3.c b/Source/Shared/WeaponM3.c index e99f7d14..a03d76ee 100644 --- a/Source/Shared/WeaponM3.c +++ b/Source/Shared/WeaponM3.c @@ -32,7 +32,7 @@ weaponinfo_t wptM3 = { SLOT_PRIMARY, 1700, // Price CALIBER_BUCKSHOT, // Caliber ID - 220, // Max Player Speed + 0.92, // Max Player Speed 9, // Bullets Per Shot 8, // Clip/MagSize 26, // Damage Per Bullet diff --git a/Source/Shared/WeaponM4A1.c b/Source/Shared/WeaponM4A1.c index 8225e5aa..28121f8b 100644 --- a/Source/Shared/WeaponM4A1.c +++ b/Source/Shared/WeaponM4A1.c @@ -32,7 +32,7 @@ weaponinfo_t wptM4A1 = { SLOT_PRIMARY, 3100, // Price CALIBER_556MM, // Caliber ID - 230, // Max Player Speed + 0.92, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 33, // Damage Per Bullet diff --git a/Source/Shared/WeaponMP5.c b/Source/Shared/WeaponMP5.c index de65bc78..358b1357 100644 --- a/Source/Shared/WeaponMP5.c +++ b/Source/Shared/WeaponMP5.c @@ -26,7 +26,7 @@ weaponinfo_t wptMP5 = { SLOT_PRIMARY, 1500, // Price CALIBER_9MM, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 26, // Damage Per Bullet diff --git a/Source/Shared/WeaponMac10.c b/Source/Shared/WeaponMac10.c index 8ac96da3..3c7a1a09 100644 --- a/Source/Shared/WeaponMac10.c +++ b/Source/Shared/WeaponMac10.c @@ -26,7 +26,7 @@ weaponinfo_t wptMAC10 = { SLOT_PRIMARY, 1400, // Price CALIBER_45ACP, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 29, // Damage Per Bullet diff --git a/Source/Shared/WeaponP228.c b/Source/Shared/WeaponP228.c index b6632c0f..004eadb2 100644 --- a/Source/Shared/WeaponP228.c +++ b/Source/Shared/WeaponP228.c @@ -26,7 +26,7 @@ weaponinfo_t wptP228 = { SLOT_SECONDARY, 600, // Price CALIBER_357SIG, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 13, // Clip/MagSize 40, // Damage Per Bullet diff --git a/Source/Shared/WeaponP90.c b/Source/Shared/WeaponP90.c index ca427cd2..33f1f675 100644 --- a/Source/Shared/WeaponP90.c +++ b/Source/Shared/WeaponP90.c @@ -26,7 +26,7 @@ weaponinfo_t wptP90 = { SLOT_PRIMARY, 2350, // Price CALIBER_57MM, // Caliber ID - 235, // Max Player Speed + 0.98, // Max Player Speed 1, // Bullets Per Shot 50, // Clip/MagSize 26, // Damage Per Bullet diff --git a/Source/Shared/WeaponPara.c b/Source/Shared/WeaponPara.c index 3491b5ff..6252adc6 100644 --- a/Source/Shared/WeaponPara.c +++ b/Source/Shared/WeaponPara.c @@ -26,7 +26,7 @@ weaponinfo_t wptPARA = { SLOT_PRIMARY, 5750, // Price CALIBER_556MMBOX, // Caliber ID - 220, // Max Player Speed + 0.88, // Max Player Speed 1, // Bullets Per Shot 100, // Clip/MagSize 35, // Damage Per Bullet diff --git a/Source/Shared/WeaponSG550.c b/Source/Shared/WeaponSG550.c index 2680d0b5..87717671 100644 --- a/Source/Shared/WeaponSG550.c +++ b/Source/Shared/WeaponSG550.c @@ -26,7 +26,7 @@ weaponinfo_t wptSG550 = { SLOT_PRIMARY, 4200, // Price CALIBER_556MM, // Caliber ID - 210, // Max Player Speed + 0.84, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 70, // Damage Per Bullet diff --git a/Source/Shared/WeaponSG552.c b/Source/Shared/WeaponSG552.c index b2678286..b05be6ec 100644 --- a/Source/Shared/WeaponSG552.c +++ b/Source/Shared/WeaponSG552.c @@ -26,7 +26,7 @@ weaponinfo_t wptSG552 = { SLOT_PRIMARY, 3500, // Price CALIBER_556MM, // Caliber ID - 235, // Max Player Speed + 0.94, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 33, // Damage Per Bullet diff --git a/Source/Shared/WeaponScout.c b/Source/Shared/WeaponScout.c index c8f3a8a7..16a43055 100644 --- a/Source/Shared/WeaponScout.c +++ b/Source/Shared/WeaponScout.c @@ -26,7 +26,7 @@ weaponinfo_t wptSCOUT = { SLOT_PRIMARY, 2750, // Price CALIBER_762MM, // Caliber ID - 240, // Max Player Speed + 1.04, // Max Player Speed 1, // Bullets Per Shot 10, // Clip/MagSize 75, // Damage Per Bullet diff --git a/Source/Shared/WeaponTMP.c b/Source/Shared/WeaponTMP.c index 328dfac6..5020b08c 100644 --- a/Source/Shared/WeaponTMP.c +++ b/Source/Shared/WeaponTMP.c @@ -26,7 +26,7 @@ weaponinfo_t wptTMP = { SLOT_PRIMARY, 1250, // Price CALIBER_9MM, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 30, // Clip/MagSize 26, // Damage Per Bullet diff --git a/Source/Shared/WeaponUMP45.c b/Source/Shared/WeaponUMP45.c index d9300bcf..632d068e 100644 --- a/Source/Shared/WeaponUMP45.c +++ b/Source/Shared/WeaponUMP45.c @@ -26,7 +26,7 @@ weaponinfo_t wptUMP45 = { SLOT_PRIMARY, 1700, // Price CALIBER_45ACP, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 25, // Clip/MagSize 30, // Damage Per Bullet diff --git a/Source/Shared/WeaponUSP45.c b/Source/Shared/WeaponUSP45.c index be1af579..0ec0e6e5 100644 --- a/Source/Shared/WeaponUSP45.c +++ b/Source/Shared/WeaponUSP45.c @@ -32,7 +32,7 @@ weaponinfo_t wptUSP45 = { SLOT_SECONDARY, 500, // Price CALIBER_45ACP, // Caliber ID - 240, // Max Player Speed + 1.0, // Max Player Speed 1, // Bullets Per Shot 12, // Clip/MagSize 34, // Damage Per Bullet diff --git a/Source/Shared/WeaponXM1014.c b/Source/Shared/WeaponXM1014.c index df9495ff..8aafd1e7 100644 --- a/Source/Shared/WeaponXM1014.c +++ b/Source/Shared/WeaponXM1014.c @@ -32,7 +32,7 @@ weaponinfo_t wptXM1014 = { SLOT_PRIMARY, 3000, // Price CALIBER_BUCKSHOT, // Caliber ID - 240, // Max Player Speed + 0.96, // Max Player Speed 6, // Bullets Per Shot 7, // Clip/MagSize 22, // Damage Per Bullet diff --git a/Source/Shared/Weapons.c b/Source/Shared/Weapons.c index ed66ecbb..76d230dc 100644 --- a/Source/Shared/Weapons.c +++ b/Source/Shared/Weapons.c @@ -49,7 +49,8 @@ weaponfunc_t wpnFuncTable[ CS_WEAPON_COUNT ] = { { WeaponAWP_Draw, WeaponAWP_PrimaryFire, Temp_Nothing, WeaponAWP_Reload }, { WeaponG3SG1_Draw, WeaponG3SG1_PrimaryFire, Temp_Nothing, WeaponG3SG1_Reload }, { WeaponSG550_Draw, WeaponSG550_PrimaryFire, Temp_Nothing, WeaponSG550_Reload }, - { WeaponPARA_Draw, WeaponPARA_PrimaryFire, Temp_Nothing, WeaponPARA_Reload } + { WeaponPARA_Draw, WeaponPARA_PrimaryFire, Temp_Nothing, WeaponPARA_Reload }, + { WeaponC4BOMB_Draw, WeaponC4BOMB_PrimaryFire, Temp_Nothing, Temp_Nothing } }; void Weapon_Draw( float fWeapon ) { @@ -60,7 +61,7 @@ void Weapon_Draw( float fWeapon ) { wpnFuncTable[ fWeapon ].vDraw(); #ifdef SSQC - self.maxspeed = (float)wptTable[ fWeapon ].iPlayerSpeed; + self.maxspeed = Player_GetMaxSpeed( fWeapon ); self.fAttackFinished = time + 1.0; #endif } @@ -157,6 +158,16 @@ void Weapon_GiveAmmo( float fWeapon, float fAmount ) { Weapon_UpdateCurrents(); } +void Weapon_SwitchBest( void ) { + if ( self.iSlotSecondary ) { + Weapon_Switch( SLOT_SECONDARY ); + } else if ( self.iSlotPrimary ) { + Weapon_Switch( SLOT_PRIMARY ); + } else { + Weapon_Switch( SLOT_MELEE ); + } +} + void CSEv_GamePlayerBuy_f( float fWeapon ) { if ( Rules_BuyingPossible() == FALSE ) { return;