Added as_* gamemode support

CVAR mp_c4timer now affects the bomb
Fixed a bug in which the rounds weren't reset properly when players left
Max playerspeed can now be controlled serverside with sv_maxspeed
This commit is contained in:
Marco Hladik 2016-12-08 21:24:09 +01:00
parent f89fb231d3
commit b976fc1d33
14 changed files with 240 additions and 19 deletions

View file

@ -49,9 +49,7 @@ float CSQC_ConsoleCommand( string sCMD ) {
return TRUE;
break;
case "chooseteam":
if( getstatf( STAT_TEAM ) == 0 ) {
fVGUI_Display = VGUI_TEAMSELECT;
}
fVGUI_Display = VGUI_TEAMSELECT;
return TRUE;
break;
case "use":

View file

@ -40,11 +40,12 @@ float vHUDNumPos[10] = {
};
// Ditto
vector vHUDCalPos[10] = {
vector vHUDCalPos[11] = {
'0 0 0',
'0.09375 0.28125 0', // 50AE
'0.28125 0.28125 0', // 762MM
'0 0.375 0', // 556MM
'0 0.375 0', // 556MM
'0.09375 0.375 0', // 338MAG
'0.1875 0.28125 0', // 9MM
'0 0.28125 0', // BUCKSHOT

View file

@ -64,6 +64,7 @@ int iHostagesMax;
int iBombZones;
int iRescueZones;
int iBuyZones;
int iVIPZones;
int iBuyRestriction; // For info_map_parameters
int iHostagesRescued;

View file

@ -23,7 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
func_escapezone_touch
=================
*/
void func_escapezone_touch( void ) {
void func_vip_safetyzone( void ) {
if ( ( other.classname == "player" ) && ( other.team == TEAM_T ) ) {
}
@ -36,7 +36,7 @@ SPAWN: func_escapezone
Entry function for the terrorist escape zone
=================
*/
void func_escapezone( void ) {
void func_vip_safetyzone( void ) {
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_TRIGGER;

View file

@ -0,0 +1,61 @@
/*
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.
*/
/*
=================
func_vip_safetyzone_touch
=================
*/
void func_vip_safetyzone_touch( void ) {
if ( ( other.classname == "player" ) && ( other.team == TEAM_VIP ) ) {
Rules_RoundOver( TEAM_CT );
entity eOld = self;
self = other;
self.team = TEAM_CT;
Spawn_MakeSpectator();
self.classname = "player";
self = eOld;
}
}
/*
=================
SPAWN: func_vip_safetyzone
Entry function for the VIP escape zone
=================
*/
void func_vip_safetyzone( void ) {
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_TRIGGER;
if ( self.model ) {
setmodel( self, self.model );
} else {
setsize( self, self.mins, self.maxs );
}
self.model = 0;
self.touch = func_vip_safetyzone_touch;
iVIPZones++;
}

View file

@ -22,12 +22,14 @@ void main( void ) {}
void SetNewParms( void ) {}
void SetChangeParms( void ) {}
void SV_PausedTic( float fDuration ) {
}
// Run every frame... by world?
void StartFrame( void ) {
// We've got hostages, but no rescue zones, create some
if ( !iRescueZones && iHostagesMax > 0 ) {
if ( !iRescueZones && iHostagesMax > 0 ) {
Game_CreateRescueZones();
}
@ -53,6 +55,7 @@ void StartFrame( void ) {
if ( iInGamePlayers == 0 ) {
fGameState = GAME_INACTIVE;
fGameTime = 0;
fOldInGamePlayers = 0;
} else {
Timer_Update();
}
@ -69,6 +72,7 @@ void worldspawn( void ) {
precache_model( sCSPlayers[6] );
precache_model( sCSPlayers[7] );
precache_model( sCSPlayers[8] );
precache_model( "models/player/vip/vip.mdl" );
precache_model( "models/w_c4.mdl" );
EFFECT_GUNSHOT = particleeffectnum( "te_gunshot" );

View file

@ -50,15 +50,16 @@ void Player_Death( void ) {
Rules_RoundOver( TEAM_T );
}
} else if ( self.team == TEAM_VIP ) {
// TODO: Finish me
iAlivePlayers_CT--; // For consistency
Rules_RoundOver( TEAM_T );
}
}
float Player_GetMaxSpeed( float fWeapon ) {
if ( self.iCrouching == TRUE ) {
return (cvar( "cl_forwardspeed" ) * wptTable[ fWeapon ].fSpeedM) * 0.5;
return (cvar( "sv_maxspeed" ) * wptTable[ fWeapon ].fSpeedM) * 0.5;
} else {
return cvar( "cl_forwardspeed" ) * wptTable[ fWeapon ].fSpeedM;
return cvar( "sv_maxspeed" ) * wptTable[ fWeapon ].fSpeedM;
}
}

View file

@ -79,15 +79,15 @@ void Rules_Restart( void ) {
// Select a random Terrorist for the bomb thing
if ( iBombZones > 0 ) {
int iRandomT = ceil( random() * iAlivePlayers_T );
int iPicked = 0;
int iPickT = 0;
eFind = findchain( classname, "player" );
while ( eFind ) {
if ( eFind.classname == "player" && eFind.team == TEAM_T ) {
iPicked++;
iPickT++;
if ( iPicked == iRandomT ) {
if ( iPickT == iRandomT ) {
eOld = self;
self = eFind;
Weapon_AddItem( WEAPON_C4BOMB );
@ -95,6 +95,29 @@ void Rules_Restart( void ) {
}
}
eFind = eFind.chain;
}
}
// If there is a VIP, select a random CT to be it
if ( iVIPZones > 0 ) {
int iRandomCT = ceil( random() * iAlivePlayers_CT );
int iPickCT = 0;
eFind = findchain( classname, "player" );
while ( eFind ) {
if ( eFind.classname == "player" && eFind.team == TEAM_CT ) {
iPickCT++;
if ( iPickCT == iRandomCT ) {
eOld = self;
self = eFind;
self.team = TEAM_VIP;
Spawn_RespawnClient( self.team );
self = eOld;
}
}
eFind = eFind.chain;
}
@ -137,7 +160,9 @@ void Rules_RoundOver( int iTeamWon ) {
// Whenever mp_roundtime was being counted down to 0
void Rules_TimeOver( void ) {
if ( iBombZones > 0 ) {
if ( iVIPZones > 0 ) {
Rules_RoundOver( TEAM_T );
} else if ( iBombZones > 0 ) {
Rules_RoundOver( TEAM_CT );
} else if ( iHostagesMax > 0 ) {
// TODO: Broadcast_Print: Hostages have not been rescued!

View file

@ -29,9 +29,11 @@ entity Spawn_FindSpawnPoint( float fTeam ) {
if ( fTeam == TEAM_T ) {
sClassname = "info_player_deathmatch";
eSpot = eLastSpawn = eLastTSpawn;
} else {
} else if ( fTeam == TEAM_CT ) {
sClassname = "info_player_start";
eSpot = eLastSpawn = eLastCTSpawn;
} else if ( fTeam == TEAM_VIP ) {
return find( world, classname, "info_vip_start" );
}
while (1) {
@ -95,7 +97,11 @@ void Spawn_RespawnClient( float fTeam ) {
self.fixangle = TRUE;
// Get the player-model from Defs.h's list
setmodel( self, sCSPlayers[ self.fCharModel ] );
if ( self.team != TEAM_VIP ) {
setmodel( self, sCSPlayers[ self.fCharModel ] );
} else {
setmodel( self, "models/player/vip/vip.mdl" );
}
setsize( self, VEC_HULL_MIN, VEC_HULL_MAX );
self.view_ofs = VEC_PLAYER_VIEWPOS;
@ -205,6 +211,10 @@ void info_player_start( void ) {
void info_player_deathmatch( void ) {
}
// VIP Spawnpoints
void info_vip_start( void ) {
}
void info_target( void ) {
setorigin( self, self.origin );
}

View file

@ -50,6 +50,7 @@ EnvObjects.c
FuncBreakable.c
FuncLadder.c
FuncHostageRescue.c
FuncVIPSafetyZone.c
FuncBombTarget.c
FuncBuyZone.c
FuncButton.c

View file

@ -87,7 +87,7 @@ void WeaponC4BOMB_Drop( vector vBombPos ) {
setmodel( eBomb, "models/w_c4.mdl" );
eBomb.think = c4bomb_think;
eBomb.nextthink = time + 1.5;
eBomb.fAttackFinished = time + 45;
eBomb.fAttackFinished = time + cvar( "mp_c4timer" );
sound( eBomb, CHAN_WEAPON, "weapons/c4_plant.wav", 1.0, ATTN_IDLE );
Radio_BroadcastMessage( RADIO_BOMBPL );

56
cstrike/default.cfg Normal file
View file

@ -0,0 +1,56 @@
bind w +forward
bind s +back
bind a +moveleft
bind d +moveright
bind "UPARROW" "+forward"
bind "DOWNARROW" "+back"
bind "LEFTARROW" "+left"
bind "RIGHTARROW" "+right"
bind MOUSE1 +attack
bind MOUSE2 +button5
bind r +button4
bind e "use"
bind 1 "impulse 1"
bind 2 "impulse 2"
bind 3 "impulse 3"
bind 4 "impulse 4"
bind SPACE +jump
bind CTRL +button3
bind SHIFT +speed
bind b buy
bind m chooseteam
bind ESC togglemenu
bind v noclip
// Movement Variables
sv_maxspeed 240
cl_forwardspeed 240
cl_sidespeed 240
cl_backspeed 240
cl_movespeedkey 0.2
seta mp_startmoney "800"
seta mp_buytime 90
seta mp_freezetime 6
seta mp_c4timer 45
seta mp_roundtime 5
cl_bobcycle 0.8
cl_bob 0.01
cl_bobup 0.5
seta r_particledesc default
hostname "Counter-Strike 1.5 Server"
seta vid_conautoscale "1"
seta snd_device "sdl"
alias +attack2 +button5
alias -attack2 -button5
alias +reload +button4
alias -reload -button4
r_fullbrightSkins 0
r_fb_models 0

8
cstrike/ftesrv.cfg Normal file
View file

@ -0,0 +1,8 @@
sv_maxspeed 240
seta mp_startmoney "800"
seta mp_buytime 90
seta mp_freezetime 6
seta mp_c4timer 45
seta mp_roundtime 5
hostname "Counter-Strike 1.5 Server"

View file

@ -0,0 +1,55 @@
r_part te_gunshot
{
type texturedspark
texture ball
tcoords 1 65 31 95 256 8 32
scale 1
count 12
scalefactor 1
alpha 0.5
die 0.8
rgb 255 180 0
blend add
spawnmode ball
spawnorg 1
spawnvel 100
veladd -100
friction 0.3
gravity 800
}
r_part +te_gunshot
{
texture ball
tcoords 1 65 31 95 256 8 32
count 3
scale 25
scalefactor 1
die 1
alpha 0.5
rgb 10 10 10
blend add
spawnmode ball
spawnorg 2
spawnvel 20
veladd -20
}
r_part te_blood
{
type texturedspark
texture ball
tcoords 1 65 31 95 256 8 32
scale 1
count 12
scalefactor 1
alpha 0.2
die 0.8
rgb 200 0 0
spawnmode ball
spawnorg 1
spawnvel 100
veladd -100
friction 0.3
gravity 800
}