diff --git a/Source/Server/Ammo.c b/Source/Server/Ammo.c index c3f3de77..7d0b420b 100755 --- a/Source/Server/Ammo.c +++ b/Source/Server/Ammo.c @@ -45,26 +45,24 @@ Ammo_BuyPrimary Buy ammo for the primary weapon you're equipped with ================= */ -void Ammo_BuyPrimary( float fFree ) { +void Ammo_BuyPrimary(void) { if ( !self.fSlotPrimary ) { return; } int iRequiredAmmo = ( ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iMaxAmount - self.(wptTable[ self.fSlotPrimary ].iCaliberfld)); float fNew = ceil( ( (float)iRequiredAmmo / (float)ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iSize ) ); - for ( int i = 0; i < fNew; i++ ) { - if ( self.fMoney - ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iPrice >= 0 ) { - self.(wptTable[ self.fSlotPrimary ].iCaliberfld) += ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iSize; - Money_AddMoney( self, -ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iPrice ); - sound( self, CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_IDLE ); - - if ( self.(wptTable[ self.fSlotPrimary ].iCaliberfld) > ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iMaxAmount ) { - self.(wptTable[ self.fSlotPrimary ].iCaliberfld) = ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iMaxAmount; - } - } else { + if ( self.fMoney - ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iPrice < 0 ) { break; } + Money_AddMoney( self, -ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iPrice ); + sound( self, CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_IDLE ); + self.(wptTable[ self.fSlotPrimary ].iCaliberfld) += ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iSize; + + if ( self.(wptTable[ self.fSlotPrimary ].iCaliberfld) > ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iMaxAmount ) { + self.(wptTable[ self.fSlotPrimary ].iCaliberfld) = ammoTable[ wptTable[ self.fSlotPrimary ].iCaliber ].iMaxAmount; + } } } @@ -75,7 +73,7 @@ Ammo_BuySecondary Buy ammo for the secondary weapon you're equipped with ================= */ -void Ammo_BuySecondary( float fFree ) { +void Ammo_BuySecondary(void) { if ( !self.fSlotSecondary ) { return; } @@ -84,22 +82,47 @@ void Ammo_BuySecondary( float fFree ) { float fNew = ceil( ( (float)iRequiredAmmo / (float)ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iSize ) ); for ( int i = 0; i < fNew; i++ ) { - if ( fFree == FALSE ) { - if ( self.fMoney - ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iPrice < 0 ) { - break; - } - Money_AddMoney( self, -ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iPrice ); + if ( self.fMoney - ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iPrice < 0 ) { + break; } - - self.(wptTable[ self.fSlotSecondary ].iCaliberfld) += ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iSize; + Money_AddMoney( self, -ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iPrice ); sound( self, CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_IDLE ); - + self.(wptTable[ self.fSlotSecondary ].iCaliberfld) += ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iSize; + if ( self.(wptTable[ self.fSlotSecondary ].iCaliberfld) > ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iMaxAmount ) { self.(wptTable[ self.fSlotSecondary ].iCaliberfld) = ammoTable[ wptTable[ self.fSlotSecondary ].iCaliber ].iMaxAmount; } } } +void Ammo_AutoFill(float fWeapon) +{ + if (autocvar_fcs_fillweapons == FALSE) { + return; + } + + if (Weapon_AlreadyExists(fWeapon)) { + self.(wptTable[fWeapon].iMagfld) = wptTable[fWeapon].iMagSize; + self.(wptTable[fWeapon].iCaliberfld) = ammoTable[wptTable[fWeapon].iCaliber].iMaxAmount; + Weapon_UpdateCurrents(); + } +} + +void Ammo_Clear(void) +{ + // Clear all the ammo stuff + for ( int i = 0; i < CS_WEAPON_COUNT; i++ ) { + self.(wptTable[ i ].iMagfld) = 0; + self.(wptTable[ i ].iCaliberfld) = 0; + } + + self.fSlotMelee = 0; + self.fSlotPrimary = 0; + self.fSlotSecondary = 0; + self.fSlotGrenade = 0; + self.iEquipment = 0; +} + /* ================= CSEv_GamePlayerBuyAmmo_f @@ -113,10 +136,10 @@ void CSEv_GamePlayerBuyAmmo_f( float fType ) { } if ( fType == 0 ) { - Ammo_BuyPrimary( FALSE ); + Ammo_BuyPrimary(); } else { - Ammo_BuySecondary( FALSE ); + Ammo_BuySecondary(); } - + Weapon_UpdateCurrents(); } diff --git a/Source/Server/Defs.h b/Source/Server/Defs.h index 279ac9a5..84cf5b99 100755 --- a/Source/Server/Defs.h +++ b/Source/Server/Defs.h @@ -38,13 +38,8 @@ var float autocvar_mp_roundtime = 5; var float autocvar_mp_timelimit = 60; var string autocvar_motdfile = "motd.txt"; var int autocvar_mp_friendlyfire = FALSE; - var int autocvar_sv_voxannounce = FALSE; -// Casual, or later CS variables -var int autocvar_mp_fillweapons = FALSE; // This will automatically get ammo for the weapon you buy -var int autocvar_mp_autoreload = FALSE; // When pressing fire and the gun is empty, it will reload instead - // New, FreeCS exclusive variables var int autocvar_fcs_knifeonly = FALSE; // Disallows buying and spawning with weps var int autocvar_fcs_swapteams = FALSE; // Swaps spawnpoints @@ -53,6 +48,8 @@ var int autocvar_fcs_reward_kill = 300; var int autocvar_fcs_penalty_pain = -150; var int autocvar_fcs_penalty_kill = -1500; var int autocvar_fcs_maxmoney = 16000; +var int autocvar_fcs_fillweapons = FALSE; // This will automatically get ammo for the weapon you buy +var int autocvar_fcs_autoreload = FALSE; // When pressing fire and the gun is empty, it will reload instead // Mapcycle features var string autocvar_mapcyclefile = "mapcycle.txt"; @@ -136,6 +133,7 @@ int iBombPlanted; entity eActivator; .void() vUse; .int iUsable; +.int iNull; // GoldSrc-Rendermode Fields .vector rendercolor; @@ -181,8 +179,9 @@ void Entities_UseTargets( void ); void Entities_InitRespawnable( void() vRespawnFunc ); void Entities_Respawn( void ); -void Ammo_BuyPrimary( float fFree ); -void Ammo_BuySecondary( float fFree ); +void Ammo_AutoFill(float fWeapon); +void Ammo_BuyPrimary(void); +void Ammo_BuySecondary(void); void Input_Handle( void ); diff --git a/Source/Server/Spawn.c b/Source/Server/Spawn.c index 19ebb476..e31b0b75 100755 --- a/Source/Server/Spawn.c +++ b/Source/Server/Spawn.c @@ -130,7 +130,7 @@ Called whenever a player just needs his basic properties to be reset */ void Spawn_RespawnClient( float fTeam ) { entity eSpawn; - forceinfokey( self, "*spec", "0" ); // Make sure we are known as a spectator + forceinfokey( self, "*spec", "0" ); eSpawn = Spawn_FindSpawnPoint( self.team ); self.classname = "player"; @@ -161,9 +161,12 @@ void Spawn_RespawnClient( float fTeam ) { self.view_ofs = VEC_PLAYER_VIEWPOS; self.velocity = '0 0 0'; - + self.frame = 1; // Idle frame self.fBombProgress = 0; + + Ammo_AutoFill(self.fSlotPrimary); + Ammo_AutoFill(self.fSlotSecondary); } /* @@ -182,7 +185,6 @@ void Spawn_CreateClient( float fCharModel ) { } else if( fCharModel < 5 ) { forceinfokey( self, "*team", "0" ); self.team = TEAM_T; - Rules_CountPlayers(); Weapon_AddItem( WEAPON_KNIFE ); if ( autocvar_fcs_knifeonly == FALSE ) { @@ -194,7 +196,6 @@ void Spawn_CreateClient( float fCharModel ) { } } else { self.team = TEAM_CT; - Rules_CountPlayers(); Weapon_AddItem( WEAPON_KNIFE ); if ( autocvar_fcs_knifeonly == FALSE ) { @@ -205,11 +206,11 @@ void Spawn_CreateClient( float fCharModel ) { Weapon_Draw( WEAPON_KNIFE ); } } - + if( self.iInGame == FALSE ) { self.iInGame = TRUE; } - + forceinfokey( self, "*team", ftos( self.team ) ); Spawn_RespawnClient( self.team ); self.fAttackFinished = time + 1; @@ -224,7 +225,7 @@ Called on connect and whenever a player dies */ void Spawn_MakeSpectator( void ) { self.classname = "spectator"; - + self.health = 0; self.armor = 0; self.takedamage = DAMAGE_NO; @@ -240,12 +241,8 @@ void Spawn_MakeSpectator( void ) { self.view_ofs = self.velocity = '0 0 0'; forceinfokey( self, "*spec", "2" ); // Make sure we are known as a spectator - // Clear all the ammo stuff - for ( int i = 0; i < CS_WEAPON_COUNT; i++ ) { - self.(wptTable[ i ].iMagfld) = 0; - self.(wptTable[ i ].iCaliberfld) = 0; - } - + Ammo_Clear(); + // Clear the inventory self.fSlotMelee = self.fSlotPrimary = self.fSlotSecondary = self.fSlotGrenade = self.iEquipment = 0; } @@ -264,26 +261,23 @@ void CSEv_GamePlayerSpawn_f( float fChar ) { self.fAttackFinished = time + 1.0; return; } - + // Hey, we are alive and are trying to switch teams, so subtract us from the Alive_Team counter. if ( self.health > 0 ) { self.health = 0; Rules_CountPlayers(); Rules_DeathCheck(); + Player_Death(0); } - - self.fSlotMelee = 0; - self.fSlotPrimary = 0; - self.fSlotSecondary = 0; - self.fSlotGrenade = 0; - self.iEquipment = 0; - + + Ammo_Clear(); + // Spawn the players immediately when its in the freeze state switch ( fGameState ) { case GAME_FREEZE: self.fCharModel = fChar; Spawn_CreateClient( fChar ); - + if ( ( self.team == TEAM_T ) && ( iAlivePlayers_T == 1 ) ) { if ( iBombZones > 0 ) { Rules_MakeBomber(); @@ -293,7 +287,7 @@ void CSEv_GamePlayerSpawn_f( float fChar ) { Rules_MakeVIP(); } } - + break; default: if ( fChar == 0 ) { @@ -304,7 +298,7 @@ void CSEv_GamePlayerSpawn_f( float fChar ) { } else { self.team = TEAM_CT; } - + Spawn_MakeSpectator(); self.classname = "player"; self.fCharModel = fChar; @@ -317,7 +311,7 @@ void CSEv_GamePlayerSpawn_f( float fChar ) { self.frags = 0; self.fDeaths = 0; forceinfokey( self, "*deaths", "0" ); - + // Split up for readability and expandability? if ( ( self.team == TEAM_T ) && ( iAlivePlayers_T == 0 ) ) { Rules_RoundOver( FALSE, 0, FALSE ); diff --git a/Source/Shared/BaseGun.c b/Source/Shared/BaseGun.c index e1aa78c5..48562f20 100755 --- a/Source/Shared/BaseGun.c +++ b/Source/Shared/BaseGun.c @@ -141,7 +141,7 @@ Returns whether or not to play an animation float BaseGun_PrimaryFire( void ) { // Nothing in the clip anymore? Don't even attempt if ( ( self.(wptTable[ self.weapon ].iMagfld) - 1 ) < 0 ) { - if ( autocvar_mp_autoreload == TRUE ) { + if ( autocvar_fcs_autoreload == TRUE ) { Weapon_Reload( self.weapon ); } return FALSE; @@ -172,7 +172,7 @@ float BaseGun_Reload( void ) { static void BaseGun_FinishReload( void ) { int iNeed = wptTable[ self.weapon ].iMagSize - self.(wptTable[ self.weapon ].iMagfld); int iHave = self.(wptTable[ self.weapon ].iCaliberfld); - + if ( iNeed > iHave ) { self.(wptTable[ self.weapon ].iMagfld) += iHave; self.(wptTable[ self.weapon ].iCaliberfld) = 0; @@ -180,7 +180,7 @@ float BaseGun_Reload( void ) { self.(wptTable[ self.weapon ].iMagfld) += iNeed; self.(wptTable[ self.weapon ].iCaliberfld) -= iNeed; } - + Weapon_UpdateCurrents(); } diff --git a/Source/Shared/WeaponC4Bomb.c b/Source/Shared/WeaponC4Bomb.c index b1910ab7..c9a61138 100755 --- a/Source/Shared/WeaponC4Bomb.c +++ b/Source/Shared/WeaponC4Bomb.c @@ -46,15 +46,15 @@ weaponinfo_t wptC4BOMB = { TYPE_AUTO, 0.0, // Attack-Delay 0.0, // Reload-Delay - iAmmo_9MM, // Caliber Pointer - iAmmo_9MM, // Clip Pointer + iNull, // Caliber Pointer + iNull, // Clip Pointer 1, // Accuracy Divisor 1, // Accuracy Offset 1, // Max Inaccuracy 8, // Minimum Crosshair Distance 4, // Crosshair Movement Delta 1.0, // Armor penetration ratio - ATYPE_C4, // Animation Type + ATYPE_C4, // Animation Type FALSE }; diff --git a/Source/Shared/WeaponFlashbang.c b/Source/Shared/WeaponFlashbang.c index 8f289b8a..fbcdb98e 100755 --- a/Source/Shared/WeaponFlashbang.c +++ b/Source/Shared/WeaponFlashbang.c @@ -47,7 +47,7 @@ weaponinfo_t wptFLASHBANG = { TYPE_SEMI, // Firing Type 1.0, // Attack-Delay 1.0, // Reload-Delay - iAmmo_9MM, // Caliber Pointer + iNull, // Caliber Pointer iAmmo_FLASHBANG, // Clip Pointer 1, // Accuracy Divisor 1.0, // Accuracy Offset diff --git a/Source/Shared/WeaponHEGrenade.c b/Source/Shared/WeaponHEGrenade.c index 5044899b..425b50ef 100755 --- a/Source/Shared/WeaponHEGrenade.c +++ b/Source/Shared/WeaponHEGrenade.c @@ -46,7 +46,7 @@ weaponinfo_t wptHEGRENADE = { TYPE_SEMI, // Firing Type 1.0, // Attack-Delay 1.0, // Reload-Delay - iAmmo_9MM, // Caliber Pointer + iNull, // Caliber Pointer iAmmo_HEGRENADE, // Clip Pointer 1, // Accuracy Divisor 1.0, // Accuracy Offset diff --git a/Source/Shared/WeaponKnife.c b/Source/Shared/WeaponKnife.c index afec6529..4ac49b81 100755 --- a/Source/Shared/WeaponKnife.c +++ b/Source/Shared/WeaponKnife.c @@ -40,8 +40,8 @@ weaponinfo_t wptKNIFE = { TYPE_SEMI, // Firing Type 0.7, // Attack-Delay 1.0, // Reload-Delay - iAmmo_9MM, // Caliber Pointer - iMag_GLOCK18, // Clip Pointer + iNull, // Caliber Pointer + iNull, // Clip Pointer 1, // Accuracy Divisor 1.0, // Accuracy Offset 1.0, // Max Inaccuracy diff --git a/Source/Shared/WeaponSmokeGrenade.c b/Source/Shared/WeaponSmokeGrenade.c index 59f49020..df759b36 100755 --- a/Source/Shared/WeaponSmokeGrenade.c +++ b/Source/Shared/WeaponSmokeGrenade.c @@ -47,7 +47,7 @@ weaponinfo_t wptSMOKEGRENADE = { TYPE_SEMI, // Firing Type 1.0, // Attack-Delay 1.0, // Reload-Delay - iAmmo_9MM, // Caliber Pointer + iNull, // Caliber Pointer iAmmo_SMOKEGRENADE, // Clip Pointer 1, // Accuracy Divisor 1.0, // Accuracy Offset diff --git a/Source/Shared/Weapons.c b/Source/Shared/Weapons.c index 722984b4..965b6473 100755 --- a/Source/Shared/Weapons.c +++ b/Source/Shared/Weapons.c @@ -528,17 +528,9 @@ void CSEv_PlayerBuyWeapon_f( float fWeapon ) { } if ( ( self.fMoney - wptTable[ fWeapon ].iPrice ) >= 0 ) { - Weapon_AddItem( fWeapon ); - - // Automatically fill weapons with ammo when you buy them (for free) like in CS:S - if ( autocvar_mp_fillweapons == 1 ) { - if ( wptTable[ fWeapon ].iSlot == SLOT_PRIMARY ) { - Ammo_BuyPrimary( TRUE ); - } else if ( wptTable[ fWeapon ].iSlot == SLOT_SECONDARY ) { - Ammo_BuySecondary( TRUE ); - } - } - + Weapon_AddItem(fWeapon); + Ammo_AutoFill(fWeapon); + Weapon_Draw( fWeapon ); Money_AddMoney( self, -wptTable[ fWeapon ].iPrice ); diff --git a/freecs/default.cfg b/freecs/default.cfg index 9ed13729..d08293b9 100755 --- a/freecs/default.cfg +++ b/freecs/default.cfg @@ -41,18 +41,29 @@ bind b buy bind m chooseteam bind ESC togglemenu +// Game variables +seta maxplayers 8 +seta mp_startmoney "800" +seta mp_buytime 90 +seta mp_freezetime 6 +seta mp_c4timer 45 +seta mp_roundtime 5 +seta fcs_knifeonly 0 +seta fcs_swapteams 0 +seta fcs_nopickups 0 +seta fcs_reward_kill 300 +seta fcs_penalty_pain -150 +seta fcs_penalty_kill -1500 +seta fcs_maxmoney 16000 +seta fcs_fillweapons 0 +seta fcs_autoreload 0 + // Movement Variables seta sv_maxspeed 240 seta cl_forwardspeed 240 seta cl_sidespeed 240 seta cl_backspeed 240 seta cl_movespeedkey 0.5 -seta mp_startmoney "800" -seta mp_buytime 90 -seta mp_freezetime 6 -seta mp_c4timer 45 -seta mp_roundtime 5 -seta mp_fillweapons 0 seta cl_bob 0 seta v_bobcycle 0.8 seta v_bob 0.01 @@ -68,7 +79,6 @@ seta cross_color 0 255 0 hostname "FreeCS Server" seta vid_conautoscale "1" -seta snd_device "sdl" seta r_polygonoffset_submodel_offset "0" seta r_polygonoffset_submodel_factor "0" @@ -93,5 +103,5 @@ seta gl_overbright "0" seta maxpitch "89" seta minpitch "-89" seta net_masterextra1 "www.vera-visions.com" -seta net_masterextra2 "dpmaster.deathmask.net:27950 107.161.23.68:27950 [2604:180::4ac:98c1]:27950" -seta net_masterextra3 "dpmaster.tchr.no:27950 92.62.40.73:27950" +seta net_masterextra2 "dpmaster.deathmask.net:27950" +seta net_masterextra3 "dpmaster.tchr.no:27950" diff --git a/freecs/ftesrv.cfg b/freecs/ftesrv.cfg index 37b96e69..076dbda9 100755 --- a/freecs/ftesrv.cfg +++ b/freecs/ftesrv.cfg @@ -1,5 +1,9 @@ // The publically advertised server name hostname "FreeCS Server" +seta sv_public 1 +seta net_masterextra1 "www.vera-visions.com" +seta net_masterextra2 "dpmaster.deathmask.net:27950" +seta net_masterextra3 "dpmaster.tchr.no:27950" // Game variables seta maxplayers 8 @@ -8,7 +12,16 @@ seta mp_buytime 90 seta mp_freezetime 6 seta mp_c4timer 45 seta mp_roundtime 5 -seta mp_fillweapons 0 + +seta fcs_knifeonly 0 +seta fcs_swapteams 0 +seta fcs_nopickups 0 +seta fcs_reward_kill 300 +seta fcs_penalty_pain -150 +seta fcs_penalty_kill -1500 +seta fcs_maxmoney 16000 +seta fcs_fillweapons 0 +seta fcs_autoreload 0 // Physics seta pm_bunnyspeedcap "1" @@ -23,4 +36,4 @@ seta allow_download_maps "0" seta allow_download_models "0" seta allow_download_sounds "0" -alias startmap_dm "map cs_assault" \ No newline at end of file +alias startmap_dm "map cs_assault" diff --git a/freecs/progs.dat b/freecs/progs.dat index 0ccc1864..ab4c05da 100644 Binary files a/freecs/progs.dat and b/freecs/progs.dat differ