2016-12-04 14:04:30 +00:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
void Player_Pain( void ) {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void Player_Death( void ) {
|
|
|
|
|
|
|
|
// Drop a corpse
|
|
|
|
entity eCorpse = spawn();
|
|
|
|
setorigin( eCorpse, self.origin );
|
|
|
|
setmodel( eCorpse, self.model );
|
|
|
|
eCorpse.angles = self.angles;
|
|
|
|
eCorpse.frame = 93; // TODO: Pick the right frame
|
|
|
|
|
|
|
|
Spawn_MakeSpectator();
|
2016-12-07 00:05:06 +00:00
|
|
|
self.classname = "player";
|
|
|
|
self.health = 0;
|
2016-12-04 14:04:30 +00:00
|
|
|
|
|
|
|
if ( self.team == TEAM_T ) {
|
2016-12-05 18:06:24 +00:00
|
|
|
iAlivePlayers_T--;
|
2016-12-04 14:04:30 +00:00
|
|
|
|
2016-12-07 23:09:50 +00:00
|
|
|
// If the bomb has been planted, T deaths don't matter anymore
|
|
|
|
if ( iAlivePlayers_T == 0 && iBombPlanted == FALSE ) {
|
2016-12-04 14:04:30 +00:00
|
|
|
Rules_RoundOver( TEAM_CT );
|
|
|
|
}
|
|
|
|
} else if ( self.team == TEAM_CT ) {
|
2016-12-05 18:06:24 +00:00
|
|
|
iAlivePlayers_CT--;
|
2016-12-04 14:04:30 +00:00
|
|
|
|
2016-12-06 00:25:05 +00:00
|
|
|
if ( iAlivePlayers_CT == 0 ) {
|
2016-12-04 14:04:30 +00:00
|
|
|
Rules_RoundOver( TEAM_T );
|
|
|
|
}
|
|
|
|
} else if ( self.team == TEAM_VIP ) {
|
|
|
|
// TODO: Finish me
|
|
|
|
}
|
|
|
|
}
|
2016-12-05 00:22:52 +00:00
|
|
|
|
2016-12-05 18:06:24 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-05 00:22:52 +00:00
|
|
|
/*
|
|
|
|
=================
|
|
|
|
Player_CrouchCheck
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
float Player_CrouchCheck( entity targ ) {
|
2016-12-05 18:06:24 +00:00
|
|
|
float fCheck = FALSE;
|
2016-12-05 00:22:52 +00:00
|
|
|
vector vTrace = self.origin + '0 0 20';
|
|
|
|
|
2016-12-05 18:06:24 +00:00
|
|
|
tracebox( vTrace, VEC_HULL_MIN, VEC_HULL_MAX, vTrace, FALSE, self );
|
|
|
|
|
|
|
|
if ( trace_startsolid == FALSE ) {
|
|
|
|
fCheck = TRUE;
|
2016-12-05 00:22:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return fCheck;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
Player_CrouchDown
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void Player_CrouchDown( void ) {
|
|
|
|
if( self.movetype != MOVETYPE_WALK ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !self.iCrouching ) {
|
|
|
|
setsize( self, VEC_CHULL_MIN, VEC_CHULL_MAX );
|
|
|
|
self.iCrouching = TRUE;
|
|
|
|
self.view_ofs = VEC_PLAYER_CVIEWPOS;
|
|
|
|
self.velocity_z = self.velocity_z + 50;
|
2016-12-05 18:06:24 +00:00
|
|
|
self.maxspeed = Player_GetMaxSpeed( self.weapon );
|
2016-12-05 00:22:52 +00:00
|
|
|
self.iCrouchAttempt = 1;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.iCrouchAttempt = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=================
|
|
|
|
Player_CrouchUp
|
|
|
|
=================
|
|
|
|
*/
|
|
|
|
void Player_CrouchUp( void ) {
|
|
|
|
if ( self.movetype != MOVETYPE_WALK ) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( self.iCrouching && ( !self.velocity_z ) && (Player_CrouchCheck( self ) ) ) {
|
|
|
|
setsize (self, VEC_HULL_MIN, VEC_HULL_MAX);
|
|
|
|
|
|
|
|
setorigin( self, self.origin + '0 0 18');
|
|
|
|
self.velocity_z = self.velocity_z + 16;
|
|
|
|
self.view_ofs = VEC_PLAYER_VIEWPOS;
|
|
|
|
self.iCrouching = FALSE;
|
|
|
|
self.iCrouchAttempt = FALSE;
|
2016-12-05 18:06:24 +00:00
|
|
|
self.maxspeed = Player_GetMaxSpeed( self.weapon );
|
2016-12-05 00:22:52 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
self.iCrouchAttempt = TRUE;
|
|
|
|
}
|