More nasty prediction related changes. This is still considered experimental and visually it's very glitchy.
This commit is contained in:
parent
f8058ceeb0
commit
ffb5ca5ff1
31 changed files with 1141 additions and 1102 deletions
|
@ -1,163 +1,163 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/*
|
||||
The overview system was meant to support
|
||||
more layers and so on. Never actually used.
|
||||
Probably seemed impractical, feel free to make this
|
||||
parse layers etc. properly though.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
float fZoom;
|
||||
vector vOrigin;
|
||||
int iRotated;
|
||||
float fHeight;
|
||||
string sImagePath;
|
||||
float fCameraHeight;
|
||||
vector vVert1;
|
||||
vector vVert2;
|
||||
vector vVert3;
|
||||
vector vVert4;
|
||||
} overview_t;
|
||||
|
||||
overview_t ovMap;
|
||||
|
||||
/*
|
||||
=================
|
||||
Overview_Init
|
||||
|
||||
Initializes the globals and whatnot
|
||||
=================
|
||||
*/
|
||||
void Overview_Init( void ) {
|
||||
int *iImageSrc;
|
||||
int iImageWidth = 0;
|
||||
int iImageHeight = 0;
|
||||
int iImageCount = 0;
|
||||
string sTemp;
|
||||
|
||||
ovMap.fZoom = 1.0f;
|
||||
ovMap.vOrigin = '0 0 0';
|
||||
ovMap.iRotated = FALSE;
|
||||
|
||||
filestream fOverview = fopen( sprintf( "overviews/%s.txt", mapname ), FILE_READ );
|
||||
if ( fOverview != -1 ) {
|
||||
for ( int i = 0;; i++ ) {
|
||||
sTemp = fgets( fOverview );
|
||||
if not ( sTemp ) {
|
||||
break;
|
||||
}
|
||||
|
||||
tokenize( sTemp );
|
||||
if ( strtolower( argv( 0 ) ) == "zoom" ) {
|
||||
ovMap.fZoom = stof( argv( 1 ) );
|
||||
} else if ( strtolower( argv( 0 ) ) == "origin" ) {
|
||||
ovMap.vOrigin = [ stof( argv( 1 ) ), stof( argv( 2 ) ), stof( argv( 3 ) ) ];
|
||||
} else if ( strtolower( argv( 0 ) ) == "rotated" ) {
|
||||
ovMap.iRotated = (int)stof( argv( 1 ) );
|
||||
} else if ( strtolower( argv( 0 ) ) == "height" ) {
|
||||
ovMap.fHeight = stof( argv( 1 ) );
|
||||
}
|
||||
}
|
||||
fclose( fOverview );
|
||||
} else {
|
||||
print( sprintf( "[OVERVIEW] Couldn't load overviews/%s.txt\n", mapname ) );
|
||||
ovMap.sImagePath = __NULL__;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ovMap.iRotated == TRUE ) {
|
||||
ovMap.vVert1 = ovMap.vOrigin -( ( 4096/ovMap.fZoom ) * '1 0.75 0' );
|
||||
ovMap.vVert4 = ovMap.vOrigin + ( 4096/ovMap.fZoom ) * '1 0.75 0';
|
||||
ovMap.vVert2 = [ ovMap.vVert1[0], ovMap.vVert4[1] ] ;
|
||||
ovMap.vVert3 = [ ovMap.vVert4[0], ovMap.vVert1[1] ] ;
|
||||
} else {
|
||||
ovMap.vVert1 = ovMap.vOrigin -( ( 4096/ovMap.fZoom ) * '0.75 1 0' );
|
||||
ovMap.vVert4 = ovMap.vOrigin + ( 4096/ovMap.fZoom ) * '0.75 1 0';
|
||||
ovMap.vVert2 = [ ovMap.vVert1[0], ovMap.vVert4[1] ] ;
|
||||
ovMap.vVert3 = [ ovMap.vVert4[0], ovMap.vVert1[1] ] ;
|
||||
}
|
||||
|
||||
ovMap.fCameraHeight = fabs( 4096/ovMap.fZoom );
|
||||
|
||||
ovMap.sImagePath = "overview";
|
||||
shaderforname( ovMap.sImagePath, sprintf("{\n{\nprogram default2d\nmap $rt:%s\n}\n}\n", ovMap.sImagePath ) );
|
||||
|
||||
// Read the image and get rid of the burning green
|
||||
iImageSrc = r_readimage( sprintf( "overviews/%s.bmp", mapname ), iImageWidth, iImageHeight );
|
||||
if ( iImageSrc != __NULL__ ) {
|
||||
for ( int i = 0; i < ( iImageWidth * iImageHeight ); i++ ) {
|
||||
if ( iImageSrc[ i ] == 0xff00ff00i ) {
|
||||
iImageSrc[ i ] = 0x00000000i;
|
||||
}
|
||||
}
|
||||
r_uploadimage( ovMap.sImagePath, iImageWidth, iImageHeight, (void*)iImageSrc );
|
||||
memfree( iImageSrc );
|
||||
}
|
||||
}
|
||||
|
||||
void Overview_DrawLayer( void ) {
|
||||
setproperty( VF_AFOV, 90 );
|
||||
if ( ovMap.iRotated == TRUE ) {
|
||||
R_BeginPolygon( ovMap.sImagePath );
|
||||
R_PolygonVertex( [ ovMap.vVert4[0], ovMap.vVert4[1], ovMap.fHeight ], '1 0', '1 1 1', 1.0f ); // Top Left
|
||||
R_PolygonVertex( [ ovMap.vVert3[0], ovMap.vVert3[1], ovMap.fHeight ], '1 1', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ ovMap.vVert1[0], ovMap.vVert1[1], ovMap.fHeight ], '0 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_PolygonVertex( [ ovMap.vVert2[0], ovMap.vVert2[1], ovMap.fHeight ], '0 0', '1 1 1', 1.0f ); // Bottom left
|
||||
R_EndPolygon();
|
||||
} else {
|
||||
R_BeginPolygon( ovMap.sImagePath );
|
||||
R_PolygonVertex( [ ovMap.vVert4[0], ovMap.vVert4[1], ovMap.fHeight ], '0 0', '1 1 1', 1.0f ); // Top Left
|
||||
R_PolygonVertex( [ ovMap.vVert3[0], ovMap.vVert3[1], ovMap.fHeight ], '1 0', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ ovMap.vVert1[0], ovMap.vVert1[1], ovMap.fHeight ], '1 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_PolygonVertex( [ ovMap.vVert2[0], ovMap.vVert2[1], ovMap.fHeight ], '0 1', '1 1 1', 1.0f ); // Bottom left
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
if ( getplayerkeyvalue( eFind.entnum - 1, "*team" ) == "1" ) {
|
||||
R_BeginPolygon( "sprites/iplayerred.spr_0.tga" );
|
||||
} else {
|
||||
if ( getplayerkeyvalue( eFind.entnum - 1, "*dead" ) == "2" ) {
|
||||
R_BeginPolygon( "sprites/iplayervip.spr_0.tga" );
|
||||
} else {
|
||||
R_BeginPolygon( "sprites/iplayerblue.spr_0.tga" );
|
||||
}
|
||||
}
|
||||
float psize;
|
||||
psize = Math_Lerp(64, 16, pSeat.fMapLerp);
|
||||
R_PolygonVertex( [ eFind.absmax[0] + psize, eFind.absmin[1] - psize, ovMap.fHeight + 16 ], '1 0', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ eFind.absmin[0] - psize, eFind.absmin[1] - psize, ovMap.fHeight + 16 ], '0 0', '1 1 1', 1.0f ); // Top left
|
||||
R_PolygonVertex( [ eFind.absmin[0] - psize, eFind.absmax[1] + psize, ovMap.fHeight + 16 ], '0 1', '1 1 1', 1.0f ); // Bottom left
|
||||
R_PolygonVertex( [ eFind.absmax[0] + psize, eFind.absmax[1] + psize, ovMap.fHeight + 16 ], '1 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Overview_Draw
|
||||
|
||||
Draw one of two types of overviews.
|
||||
This is for spectators.
|
||||
=================
|
||||
*/
|
||||
void Overview_Draw( void ) {
|
||||
if ( ovMap.sImagePath == __NULL__ ) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawfill( video_mins, video_res, '0 0 0', 1.0f, 0 );
|
||||
|
||||
Overview_DrawLayer();
|
||||
|
||||
makevectors( view_angles );
|
||||
setproperty( VF_ORIGIN, ovMap.vOrigin + ( v_forward * -ovMap.fCameraHeight ) ) ;
|
||||
}
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/*
|
||||
The overview system was meant to support
|
||||
more layers and so on. Never actually used.
|
||||
Probably seemed impractical, feel free to make this
|
||||
parse layers etc. properly though.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
float fZoom;
|
||||
vector vOrigin;
|
||||
int iRotated;
|
||||
float fHeight;
|
||||
string sImagePath;
|
||||
float fCameraHeight;
|
||||
vector vVert1;
|
||||
vector vVert2;
|
||||
vector vVert3;
|
||||
vector vVert4;
|
||||
} overview_t;
|
||||
|
||||
overview_t ovMap;
|
||||
|
||||
/*
|
||||
=================
|
||||
Overview_Init
|
||||
|
||||
Initializes the globals and whatnot
|
||||
=================
|
||||
*/
|
||||
void Overview_Init( void ) {
|
||||
int *iImageSrc;
|
||||
int iImageWidth = 0;
|
||||
int iImageHeight = 0;
|
||||
int iImageCount = 0;
|
||||
string sTemp;
|
||||
|
||||
ovMap.fZoom = 1.0f;
|
||||
ovMap.vOrigin = '0 0 0';
|
||||
ovMap.iRotated = FALSE;
|
||||
|
||||
filestream fOverview = fopen( sprintf( "overviews/%s.txt", mapname ), FILE_READ );
|
||||
if ( fOverview != -1 ) {
|
||||
for ( int i = 0;; i++ ) {
|
||||
sTemp = fgets( fOverview );
|
||||
if not ( sTemp ) {
|
||||
break;
|
||||
}
|
||||
|
||||
tokenize( sTemp );
|
||||
if ( strtolower( argv( 0 ) ) == "zoom" ) {
|
||||
ovMap.fZoom = stof( argv( 1 ) );
|
||||
} else if ( strtolower( argv( 0 ) ) == "origin" ) {
|
||||
ovMap.vOrigin = [ stof( argv( 1 ) ), stof( argv( 2 ) ), stof( argv( 3 ) ) ];
|
||||
} else if ( strtolower( argv( 0 ) ) == "rotated" ) {
|
||||
ovMap.iRotated = (int)stof( argv( 1 ) );
|
||||
} else if ( strtolower( argv( 0 ) ) == "height" ) {
|
||||
ovMap.fHeight = stof( argv( 1 ) );
|
||||
}
|
||||
}
|
||||
fclose( fOverview );
|
||||
} else {
|
||||
print( sprintf( "[OVERVIEW] Couldn't load overviews/%s.txt\n", mapname ) );
|
||||
ovMap.sImagePath = __NULL__;
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ovMap.iRotated == TRUE ) {
|
||||
ovMap.vVert1 = ovMap.vOrigin -( ( 4096/ovMap.fZoom ) * '1 0.75 0' );
|
||||
ovMap.vVert4 = ovMap.vOrigin + ( 4096/ovMap.fZoom ) * '1 0.75 0';
|
||||
ovMap.vVert2 = [ ovMap.vVert1[0], ovMap.vVert4[1] ] ;
|
||||
ovMap.vVert3 = [ ovMap.vVert4[0], ovMap.vVert1[1] ] ;
|
||||
} else {
|
||||
ovMap.vVert1 = ovMap.vOrigin -( ( 4096/ovMap.fZoom ) * '0.75 1 0' );
|
||||
ovMap.vVert4 = ovMap.vOrigin + ( 4096/ovMap.fZoom ) * '0.75 1 0';
|
||||
ovMap.vVert2 = [ ovMap.vVert1[0], ovMap.vVert4[1] ] ;
|
||||
ovMap.vVert3 = [ ovMap.vVert4[0], ovMap.vVert1[1] ] ;
|
||||
}
|
||||
|
||||
ovMap.fCameraHeight = fabs( 4096/ovMap.fZoom );
|
||||
|
||||
ovMap.sImagePath = "overview";
|
||||
shaderforname( ovMap.sImagePath, sprintf("{\n{\nprogram default2d\nmap $rt:%s\n}\n}\n", ovMap.sImagePath ) );
|
||||
|
||||
// Read the image and get rid of the burning green
|
||||
iImageSrc = r_readimage( sprintf( "overviews/%s.bmp", mapname ), iImageWidth, iImageHeight );
|
||||
if ( iImageSrc != __NULL__ ) {
|
||||
for ( int i = 0; i < ( iImageWidth * iImageHeight ); i++ ) {
|
||||
if ( iImageSrc[ i ] == 0xff00ff00i ) {
|
||||
iImageSrc[ i ] = 0x00000000i;
|
||||
}
|
||||
}
|
||||
r_uploadimage( ovMap.sImagePath, iImageWidth, iImageHeight, (void*)iImageSrc );
|
||||
memfree( iImageSrc );
|
||||
}
|
||||
}
|
||||
|
||||
void Overview_DrawLayer( void ) {
|
||||
setproperty( VF_AFOV, 90 );
|
||||
if ( ovMap.iRotated == TRUE ) {
|
||||
R_BeginPolygon( ovMap.sImagePath );
|
||||
R_PolygonVertex( [ ovMap.vVert4[0], ovMap.vVert4[1], ovMap.fHeight ], '1 0', '1 1 1', 1.0f ); // Top Left
|
||||
R_PolygonVertex( [ ovMap.vVert3[0], ovMap.vVert3[1], ovMap.fHeight ], '1 1', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ ovMap.vVert1[0], ovMap.vVert1[1], ovMap.fHeight ], '0 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_PolygonVertex( [ ovMap.vVert2[0], ovMap.vVert2[1], ovMap.fHeight ], '0 0', '1 1 1', 1.0f ); // Bottom left
|
||||
R_EndPolygon();
|
||||
} else {
|
||||
R_BeginPolygon( ovMap.sImagePath );
|
||||
R_PolygonVertex( [ ovMap.vVert4[0], ovMap.vVert4[1], ovMap.fHeight ], '0 0', '1 1 1', 1.0f ); // Top Left
|
||||
R_PolygonVertex( [ ovMap.vVert3[0], ovMap.vVert3[1], ovMap.fHeight ], '1 0', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ ovMap.vVert1[0], ovMap.vVert1[1], ovMap.fHeight ], '1 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_PolygonVertex( [ ovMap.vVert2[0], ovMap.vVert2[1], ovMap.fHeight ], '0 1', '1 1 1', 1.0f ); // Bottom left
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
if ( getplayerkeyvalue( eFind.entnum - 1, "*team" ) == "1" ) {
|
||||
R_BeginPolygon( "sprites/iplayerred.spr_0.tga" );
|
||||
} else {
|
||||
if ( getplayerkeyvalue( eFind.entnum - 1, "*dead" ) == "2" ) {
|
||||
R_BeginPolygon( "sprites/iplayervip.spr_0.tga" );
|
||||
} else {
|
||||
R_BeginPolygon( "sprites/iplayerblue.spr_0.tga" );
|
||||
}
|
||||
}
|
||||
float psize;
|
||||
psize = Math_Lerp(64, 16, pSeat.fMapLerp);
|
||||
R_PolygonVertex( [ eFind.absmax[0] + psize, eFind.absmin[1] - psize, ovMap.fHeight + 16 ], '1 0', '1 1 1', 1.0f ); // Top Right
|
||||
R_PolygonVertex( [ eFind.absmin[0] - psize, eFind.absmin[1] - psize, ovMap.fHeight + 16 ], '0 0', '1 1 1', 1.0f ); // Top left
|
||||
R_PolygonVertex( [ eFind.absmin[0] - psize, eFind.absmax[1] + psize, ovMap.fHeight + 16 ], '0 1', '1 1 1', 1.0f ); // Bottom left
|
||||
R_PolygonVertex( [ eFind.absmax[0] + psize, eFind.absmax[1] + psize, ovMap.fHeight + 16 ], '1 1', '1 1 1', 1.0f ); // Bottom right
|
||||
R_EndPolygon();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Overview_Draw
|
||||
|
||||
Draw one of two types of overviews.
|
||||
This is for spectators.
|
||||
=================
|
||||
*/
|
||||
void Overview_Draw( void ) {
|
||||
if ( ovMap.sImagePath == __NULL__ ) {
|
||||
return;
|
||||
}
|
||||
|
||||
drawfill( video_mins, video_res, '0 0 0', 1.0f, 0 );
|
||||
|
||||
Overview_DrawLayer();
|
||||
|
||||
makevectors( view_angles );
|
||||
setproperty( VF_ORIGIN, ovMap.vOrigin + ( v_forward * -ovMap.fCameraHeight ) ) ;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ vector mouse_pos;
|
|||
float clframetime;
|
||||
|
||||
|
||||
|
||||
void View_UpdateWeapon(entity, entity);
|
||||
void View_AddPunchAngle( vector vAdd );
|
||||
void View_PlayAnimation( int iSequence );
|
||||
void Game_Input(void);
|
||||
|
|
|
@ -24,12 +24,12 @@ void Predict_PreFrame(player pl)
|
|||
pl.netteleport_time = pl.teleport_time;
|
||||
|
||||
#ifdef VALVE
|
||||
pl.net_w_attack_next = pl.w_attack_next;
|
||||
pl.net_w_idle_next = pl.w_idle_next;
|
||||
//pl.net_w_attack_next = pl.w_attack_next;
|
||||
//pl.net_w_idle_next = pl.w_idle_next;
|
||||
pl.net_ammo1 = pl.a_ammo1;
|
||||
pl.net_ammo2 = pl.a_ammo2;
|
||||
pl.net_ammo3 = pl.a_ammo3;
|
||||
pl.net_weapontime = pSeat->eViewModel.frame1time;
|
||||
//pl.net_weapontime = pSeat->eViewModel.frame1time;
|
||||
#endif
|
||||
|
||||
//self.netpmove_flags = self.pmove_flags;
|
||||
|
@ -73,13 +73,13 @@ void Predict_PostFrame(player pl)
|
|||
pl.teleport_time = pl.netteleport_time;
|
||||
|
||||
#ifdef VALVE
|
||||
pl.w_attack_next = pl.net_w_attack_next;
|
||||
pl.w_idle_next = pl.net_w_idle_next;
|
||||
//pl.w_attack_next = pl.net_w_attack_next;
|
||||
//pl.w_idle_next = pl.net_w_idle_next;
|
||||
pl.a_ammo1 = pl.net_ammo1;
|
||||
pl.a_ammo2 = pl.net_ammo2;
|
||||
pl.a_ammo3 = pl.net_ammo3;
|
||||
pSeat->eViewModel.frame1time = pl.net_weapontime;
|
||||
pSeat->eViewModel.frame2time = pl.net_weapontime;
|
||||
//pSeat->eViewModel.frame1time = pl.net_weapontime;
|
||||
//pSeat->eViewModel.frame2time = pl.net_weapontime;
|
||||
#endif
|
||||
|
||||
//self.pmove_flags = self.netpmove_flags;
|
||||
|
|
|
@ -46,7 +46,7 @@ void Player_ReadEntity(float flIsNew)
|
|||
pl.a_ammo1 = readbyte();
|
||||
pl.a_ammo2 = readbyte();
|
||||
pl.a_ammo3 = readbyte();
|
||||
pl.w_attack_next = readfloat();
|
||||
pl.w_idle_next = readfloat();
|
||||
//pl.w_attack_next = readfloat();
|
||||
//pl.w_idle_next = readfloat();
|
||||
setorigin( pl, pl.origin );
|
||||
}
|
||||
|
|
|
@ -13,13 +13,11 @@ void View_UpdateWeapon(entity vm, entity mflash)
|
|||
if (pSeat->fLastWeapon != pl.activeweapon) {
|
||||
pSeat->fLastWeapon = pl.activeweapon;
|
||||
if (pl.activeweapon) {
|
||||
setmodel(vm, g_weapons[pl.activeweapon].vmodel());
|
||||
|
||||
Weapons_Draw();
|
||||
skel_delete( mflash.skeletonindex );
|
||||
mflash.skeletonindex = skel_create( vm.modelindex );
|
||||
pSeat->fNumBones = skel_get_numbones( mflash.skeletonindex ) + 1;
|
||||
pSeat->fEjectBone = pSeat->fNumBones + 1;
|
||||
}
|
||||
Weapons_Draw();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -284,7 +284,7 @@ onto the view model
|
|||
void View_PlayAnimation(int iSequence)
|
||||
{
|
||||
pSeat->eViewModel.frame = (float)iSequence;
|
||||
pSeat->eViewModel.frame1time = 0.0f;
|
||||
//pSeat->eViewModel.frame1time = 0.0f;
|
||||
}
|
||||
int View_GetAnimation(void)
|
||||
{
|
||||
|
|
|
@ -1,223 +1,223 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/*
|
||||
=================
|
||||
SpectatorThink
|
||||
|
||||
Run every frame on every spectator
|
||||
=================
|
||||
*/
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/*
|
||||
=================
|
||||
SpectatorThink
|
||||
|
||||
Run every frame on every spectator
|
||||
=================
|
||||
*/
|
||||
void Game_SpectatorThink(void)
|
||||
{
|
||||
self.SendFlags = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ClientKill
|
||||
|
||||
Suicide command 'kill' executes this function.
|
||||
=================
|
||||
*/
|
||||
{
|
||||
self.SendFlags = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ClientKill
|
||||
|
||||
Suicide command 'kill' executes this function.
|
||||
=================
|
||||
*/
|
||||
void Game_ClientKill(void)
|
||||
{
|
||||
Damage_Apply(self, self, self.health, self.origin, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ClientConnect
|
||||
|
||||
Run whenever a new client joins
|
||||
=================
|
||||
*/
|
||||
void Game_ClientConnect(void) {}
|
||||
|
||||
/*
|
||||
=================
|
||||
SpectatorConnect
|
||||
|
||||
Called when a spectator joins the game
|
||||
=================
|
||||
*/
|
||||
{
|
||||
Damage_Apply(self, self, self.health, self.origin, TRUE);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ClientConnect
|
||||
|
||||
Run whenever a new client joins
|
||||
=================
|
||||
*/
|
||||
void Game_ClientConnect(void) {}
|
||||
|
||||
/*
|
||||
=================
|
||||
SpectatorConnect
|
||||
|
||||
Called when a spectator joins the game
|
||||
=================
|
||||
*/
|
||||
void Game_SpectatorConnect(void)
|
||||
{
|
||||
//Spawn_MakeSpectator();
|
||||
//Spawn_ObserverCam();
|
||||
ClientConnect();
|
||||
PutClientInServer();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SpectatorDisconnect
|
||||
|
||||
Called when a spectator leaves the game
|
||||
=================
|
||||
*/
|
||||
{
|
||||
//Spawn_MakeSpectator();
|
||||
//Spawn_ObserverCam();
|
||||
ClientConnect();
|
||||
PutClientInServer();
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SpectatorDisconnect
|
||||
|
||||
Called when a spectator leaves the game
|
||||
=================
|
||||
*/
|
||||
void Game_SpectatorDisconnect(void)
|
||||
{
|
||||
Spray_RemoveAll(self);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ClientDisconnect
|
||||
|
||||
Run whenever a client quits
|
||||
=================
|
||||
*/
|
||||
{
|
||||
Spray_RemoveAll(self);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
ClientDisconnect
|
||||
|
||||
Run whenever a client quits
|
||||
=================
|
||||
*/
|
||||
void Game_ClientDisconnect(void)
|
||||
{
|
||||
// We were part of the session
|
||||
self.health = 0;
|
||||
Rules_CountPlayers();
|
||||
Rules_DeathCheck();
|
||||
Spray_RemoveAll(self);
|
||||
}
|
||||
|
||||
void Game_DecodeChangeParms(void)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
self.angles[0] = parm4;
|
||||
self.angles[1] = parm5;
|
||||
self.angles[2] = parm6;
|
||||
}
|
||||
void Game_SetChangeParms(void)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = self.angles[0];
|
||||
parm5 = self.angles[1];
|
||||
parm6 = self.angles[2];
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
PutClientInServer
|
||||
|
||||
Puts a client into the world.
|
||||
=================
|
||||
*/
|
||||
void Game_PutClientInServer(void)
|
||||
{
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
entity spot;
|
||||
self.SendEntity = Player_SendEntity;
|
||||
|
||||
Game_DecodeChangeParms();
|
||||
|
||||
if (startspot) {
|
||||
self.origin = Landmark_GetSpot();
|
||||
self.fixangle = TRUE;
|
||||
} else {
|
||||
spot = find(world, classname, "info_player_start");
|
||||
self.origin = spot.origin;
|
||||
self.angles = spot.angles;
|
||||
self.fixangle = TRUE;
|
||||
}
|
||||
|
||||
self.classname = "player";
|
||||
self.health = self.max_health = 100;
|
||||
forceinfokey(self, "*dead", "0");
|
||||
self.takedamage = DAMAGE_YES;
|
||||
self.solid = SOLID_SLIDEBOX;
|
||||
self.movetype = MOVETYPE_WALK;
|
||||
self.flags = FL_CLIENT;
|
||||
self.vPain = Player_Pain;
|
||||
self.vDeath = Player_Death;
|
||||
self.iBleeds = TRUE;
|
||||
self.pvsflags = PVSF_IGNOREPVS;
|
||||
self.fSlotGrenade = 0;
|
||||
self.viewzoom = 1.0;
|
||||
setmodel(self, "models/player/vip/vip.mdl");
|
||||
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
self.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
self.velocity = '0 0 0';
|
||||
self.frame = 1; // Idle frame
|
||||
self.fBombProgress = 0;
|
||||
self.team = TEAM_CT;
|
||||
forceinfokey(self, "*spec", "0");
|
||||
return;
|
||||
}
|
||||
|
||||
entity eTarget = world;
|
||||
|
||||
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);
|
||||
Vox_Singlecast(self, sprintf("we have %s minutes remaining", Vox_TimeToString(fTimeLeft)));
|
||||
}
|
||||
}
|
||||
|
||||
self.team = 0;
|
||||
forceinfokey(self, "*team", "0");
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SV_RunClientCommand
|
||||
|
||||
Funtion that can interrupt client commands before physics are run
|
||||
=================
|
||||
*/
|
||||
{
|
||||
// We were part of the session
|
||||
self.health = 0;
|
||||
Rules_CountPlayers();
|
||||
Rules_DeathCheck();
|
||||
Spray_RemoveAll(self);
|
||||
}
|
||||
|
||||
void Game_DecodeChangeParms(void)
|
||||
{
|
||||
g_landmarkpos[0] = parm1;
|
||||
g_landmarkpos[1] = parm2;
|
||||
g_landmarkpos[2] = parm3;
|
||||
self.angles[0] = parm4;
|
||||
self.angles[1] = parm5;
|
||||
self.angles[2] = parm6;
|
||||
}
|
||||
void Game_SetChangeParms(void)
|
||||
{
|
||||
parm1 = g_landmarkpos[0];
|
||||
parm2 = g_landmarkpos[1];
|
||||
parm3 = g_landmarkpos[2];
|
||||
parm4 = self.angles[0];
|
||||
parm5 = self.angles[1];
|
||||
parm6 = self.angles[2];
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
PutClientInServer
|
||||
|
||||
Puts a client into the world.
|
||||
=================
|
||||
*/
|
||||
void Game_PutClientInServer(void)
|
||||
{
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
entity spot;
|
||||
self.SendEntity = Player_SendEntity;
|
||||
|
||||
Game_DecodeChangeParms();
|
||||
|
||||
if (startspot) {
|
||||
self.origin = Landmark_GetSpot();
|
||||
self.fixangle = TRUE;
|
||||
} else {
|
||||
spot = find(world, classname, "info_player_start");
|
||||
self.origin = spot.origin;
|
||||
self.angles = spot.angles;
|
||||
self.fixangle = TRUE;
|
||||
}
|
||||
|
||||
self.classname = "player";
|
||||
self.health = self.max_health = 100;
|
||||
forceinfokey(self, "*dead", "0");
|
||||
self.takedamage = DAMAGE_YES;
|
||||
self.solid = SOLID_SLIDEBOX;
|
||||
self.movetype = MOVETYPE_WALK;
|
||||
self.flags = FL_CLIENT;
|
||||
self.vPain = Player_Pain;
|
||||
self.vDeath = Player_Death;
|
||||
self.iBleeds = TRUE;
|
||||
self.pvsflags = PVSF_IGNOREPVS;
|
||||
self.fSlotGrenade = 0;
|
||||
self.viewzoom = 1.0;
|
||||
setmodel(self, "models/player/vip/vip.mdl");
|
||||
setsize(self, VEC_HULL_MIN, VEC_HULL_MAX);
|
||||
self.view_ofs = VEC_PLAYER_VIEWPOS;
|
||||
self.velocity = '0 0 0';
|
||||
self.frame = 1; // Idle frame
|
||||
self.fBombProgress = 0;
|
||||
self.team = TEAM_CT;
|
||||
forceinfokey(self, "*spec", "0");
|
||||
return;
|
||||
}
|
||||
|
||||
entity eTarget = world;
|
||||
|
||||
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);
|
||||
Vox_Singlecast(self, sprintf("we have %s minutes remaining", Vox_TimeToString(fTimeLeft)));
|
||||
}
|
||||
}
|
||||
|
||||
self.team = 0;
|
||||
forceinfokey(self, "*team", "0");
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SV_RunClientCommand
|
||||
|
||||
Funtion that can interrupt client commands before physics are run
|
||||
=================
|
||||
*/
|
||||
void Game_RunClientCommand(void)
|
||||
{
|
||||
/*if (clienttype(self) == CLIENTTYPE_BOT) {
|
||||
((CBot)self).RunAI();
|
||||
}*/
|
||||
|
||||
if (fGameState == GAME_FREEZE && self.health > 0) {
|
||||
input_movevalues = '0 0 0';
|
||||
//input_buttons = 0;
|
||||
input_impulse = 0;
|
||||
}
|
||||
|
||||
// The individual zones will just override this behavior
|
||||
self.fInBombZone = FALSE;
|
||||
self.fInBuyZone = FALSE;
|
||||
self.fInHostageZone = FALSE;
|
||||
self.fInEscapeZone = FALSE;
|
||||
self.fInVIPZone = FALSE;
|
||||
|
||||
QPhysics_Run(self);
|
||||
}
|
||||
|
||||
void Game_SetNewParms(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Client_SendEvent
|
||||
|
||||
Send a game event
|
||||
=================
|
||||
*/
|
||||
void Client_SendEvent(entity eClient, float fEVType)
|
||||
{
|
||||
Weapon_UpdateCurrents();
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, fEVType);
|
||||
WriteByte(MSG_MULTICAST, num_for_edict(eClient));
|
||||
msg_entity = eClient;
|
||||
multicast(self.origin, MULTICAST_PVS);
|
||||
}
|
||||
{
|
||||
/*if (clienttype(self) == CLIENTTYPE_BOT) {
|
||||
((CBot)self).RunAI();
|
||||
}*/
|
||||
|
||||
if (fGameState == GAME_FREEZE && self.health > 0) {
|
||||
input_movevalues = '0 0 0';
|
||||
//input_buttons = 0;
|
||||
input_impulse = 0;
|
||||
}
|
||||
|
||||
// The individual zones will just override this behavior
|
||||
self.fInBombZone = FALSE;
|
||||
self.fInBuyZone = FALSE;
|
||||
self.fInHostageZone = FALSE;
|
||||
self.fInEscapeZone = FALSE;
|
||||
self.fInVIPZone = FALSE;
|
||||
|
||||
QPhysics_Run(self);
|
||||
}
|
||||
|
||||
void Game_SetNewParms(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Client_SendEvent
|
||||
|
||||
Send a game event
|
||||
=================
|
||||
*/
|
||||
void Client_SendEvent(entity eClient, float fEVType)
|
||||
{
|
||||
Weapon_UpdateCurrents();
|
||||
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, fEVType);
|
||||
WriteByte(MSG_MULTICAST, num_for_edict(eClient));
|
||||
msg_entity = eClient;
|
||||
multicast(self.origin, MULTICAST_PVS);
|
||||
}
|
||||
|
|
|
@ -1,119 +1,119 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
|
||||
#define VEC_PLAYER_VIEWPOS '0 0 20'
|
||||
#define VEC_PLAYER_CVIEWPOS '0 0 12'
|
||||
|
||||
// Server cvars
|
||||
var int autocvar_mp_winlimit = 0;
|
||||
var int autocvar_mp_halftime = 0;
|
||||
var int autocvar_mp_startmoney = 800;
|
||||
var float autocvar_mp_buytime = 90;
|
||||
var float autocvar_mp_freezetime = 6;
|
||||
var float autocvar_mp_c4timer = 45;
|
||||
var float autocvar_mp_roundtime = 5;
|
||||
var float autocvar_mp_timelimit = 60;
|
||||
var string autocvar_motdfile = "motd.txt";
|
||||
var int autocvar_mp_friendlyfire = FALSE;
|
||||
|
||||
// New, FreeCS exclusive variables
|
||||
var int autocvar_fcs_voxannounce = FALSE;
|
||||
var int autocvar_fcs_knifeonly = FALSE; /* Disallows buying and spawning with weps */
|
||||
var int autocvar_fcs_swapteams = FALSE; /* Swaps spawnpoints */
|
||||
var int autocvar_fcs_nopickups = FALSE; /* Disable weapon items */
|
||||
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_fix_bombtimer = FALSE; /* If true, the bomb-timer will dictate the round-end */
|
||||
var int autocvar_fcs_bombaltthrow = FALSE; /* Randomize the bomb-throw every time ever so slightly */
|
||||
|
||||
// Mapcycle features
|
||||
var string autocvar_mapcyclefile = "mapcycle.txt";
|
||||
var int iMapCycleCount;
|
||||
string *sMapCycle;
|
||||
|
||||
// Hit Group standards
|
||||
enum {
|
||||
BODY_DEFAULT,
|
||||
BODY_HEAD,
|
||||
BODY_CHEST,
|
||||
BODY_STOMACH,
|
||||
BODY_ARMLEFT,
|
||||
BODY_ARMRIGHT,
|
||||
BODY_LEGLEFT,
|
||||
BODY_LEGRIGHT
|
||||
};
|
||||
|
||||
// Grenade states
|
||||
enum {
|
||||
GRENADE_UNREADY,
|
||||
GRENADE_PULLING,
|
||||
GRENADE_READY
|
||||
};
|
||||
|
||||
// Match specific fields
|
||||
int iRounds;
|
||||
int iWon_T;
|
||||
int iWon_CT;
|
||||
int iAlivePlayers_T;
|
||||
int iAlivePlayers_CT;
|
||||
|
||||
float fGameState;
|
||||
float fGameTime;
|
||||
|
||||
// Game specific fields
|
||||
int iHostagesMax;
|
||||
int iBombZones;
|
||||
int iRescueZones;
|
||||
int iBuyZones;
|
||||
int iVIPZones;
|
||||
int iEscapeZones;
|
||||
int iBuyRestriction; // For info_map_parameters
|
||||
int iBombRadius; // For info_map_parameters
|
||||
|
||||
int iHostagesRescued;
|
||||
int iBombPlanted;
|
||||
|
||||
void Rules_RoundOver(int iTeamWon, int iMoneyReward, float fSilent);
|
||||
float Rules_BuyingPossible(void);
|
||||
void Timer_Begin(float fTime, float fMode);
|
||||
void Spawn_RespawnClient(float fTeam);
|
||||
void Spawn_CreateClient(float fTeam);
|
||||
void Spawn_MakeSpectator(void);
|
||||
void Client_SendEvent(entity eClient, float fEVType);
|
||||
|
||||
void Weapon_Draw(float fWeapon);
|
||||
void Weapon_SwitchBest(void);
|
||||
void Weapon_UpdateCurrents(void);
|
||||
void Weapon_DropWeapon(int iSlot);
|
||||
float Weapon_GetAnimType(float fWeapon);
|
||||
float Weapon_GetFireRate(float fWeapon);
|
||||
float Weapon_GetReloadTime(float fWeapon);
|
||||
void Weapon_Reload(float fWeapon);
|
||||
|
||||
void BaseGun_AccuracyCalc(void);
|
||||
void BaseGun_Draw(void);
|
||||
float BaseGun_PrimaryFire(void);
|
||||
float BaseGun_Reload(void);
|
||||
void Effect_CreateFlash(entity targ);
|
||||
void BaseMelee_Draw(void);
|
||||
int BaseMelee_Attack(void);
|
||||
|
||||
void Ammo_AutoFill(float fWeapon);
|
||||
void Ammo_BuyPrimary(void);
|
||||
void Ammo_BuySecondary(void);
|
||||
|
||||
void Animation_PlayerTop(float fFrame);
|
||||
void Animation_PlayerTopTemp(float fFrame, float fTime);
|
||||
|
||||
void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor);
|
||||
|
||||
#define NULL __NULL__
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
|
||||
#define VEC_PLAYER_VIEWPOS '0 0 20'
|
||||
#define VEC_PLAYER_CVIEWPOS '0 0 12'
|
||||
|
||||
// Server cvars
|
||||
var int autocvar_mp_winlimit = 0;
|
||||
var int autocvar_mp_halftime = 0;
|
||||
var int autocvar_mp_startmoney = 800;
|
||||
var float autocvar_mp_buytime = 90;
|
||||
var float autocvar_mp_freezetime = 6;
|
||||
var float autocvar_mp_c4timer = 45;
|
||||
var float autocvar_mp_roundtime = 5;
|
||||
var float autocvar_mp_timelimit = 60;
|
||||
var string autocvar_motdfile = "motd.txt";
|
||||
var int autocvar_mp_friendlyfire = FALSE;
|
||||
|
||||
// New, FreeCS exclusive variables
|
||||
var int autocvar_fcs_voxannounce = FALSE;
|
||||
var int autocvar_fcs_knifeonly = FALSE; /* Disallows buying and spawning with weps */
|
||||
var int autocvar_fcs_swapteams = FALSE; /* Swaps spawnpoints */
|
||||
var int autocvar_fcs_nopickups = FALSE; /* Disable weapon items */
|
||||
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_fix_bombtimer = FALSE; /* If true, the bomb-timer will dictate the round-end */
|
||||
var int autocvar_fcs_bombaltthrow = FALSE; /* Randomize the bomb-throw every time ever so slightly */
|
||||
|
||||
// Mapcycle features
|
||||
var string autocvar_mapcyclefile = "mapcycle.txt";
|
||||
var int iMapCycleCount;
|
||||
string *sMapCycle;
|
||||
|
||||
// Hit Group standards
|
||||
enum {
|
||||
BODY_DEFAULT,
|
||||
BODY_HEAD,
|
||||
BODY_CHEST,
|
||||
BODY_STOMACH,
|
||||
BODY_ARMLEFT,
|
||||
BODY_ARMRIGHT,
|
||||
BODY_LEGLEFT,
|
||||
BODY_LEGRIGHT
|
||||
};
|
||||
|
||||
// Grenade states
|
||||
enum {
|
||||
GRENADE_UNREADY,
|
||||
GRENADE_PULLING,
|
||||
GRENADE_READY
|
||||
};
|
||||
|
||||
// Match specific fields
|
||||
int iRounds;
|
||||
int iWon_T;
|
||||
int iWon_CT;
|
||||
int iAlivePlayers_T;
|
||||
int iAlivePlayers_CT;
|
||||
|
||||
float fGameState;
|
||||
float fGameTime;
|
||||
|
||||
// Game specific fields
|
||||
int iHostagesMax;
|
||||
int iBombZones;
|
||||
int iRescueZones;
|
||||
int iBuyZones;
|
||||
int iVIPZones;
|
||||
int iEscapeZones;
|
||||
int iBuyRestriction; // For info_map_parameters
|
||||
int iBombRadius; // For info_map_parameters
|
||||
|
||||
int iHostagesRescued;
|
||||
int iBombPlanted;
|
||||
|
||||
void Rules_RoundOver(int iTeamWon, int iMoneyReward, float fSilent);
|
||||
float Rules_BuyingPossible(void);
|
||||
void Timer_Begin(float fTime, float fMode);
|
||||
void Spawn_RespawnClient(float fTeam);
|
||||
void Spawn_CreateClient(float fTeam);
|
||||
void Spawn_MakeSpectator(void);
|
||||
void Client_SendEvent(entity eClient, float fEVType);
|
||||
|
||||
void Weapon_Draw(float fWeapon);
|
||||
void Weapon_SwitchBest(void);
|
||||
void Weapon_UpdateCurrents(void);
|
||||
void Weapon_DropWeapon(int iSlot);
|
||||
float Weapon_GetAnimType(float fWeapon);
|
||||
float Weapon_GetFireRate(float fWeapon);
|
||||
float Weapon_GetReloadTime(float fWeapon);
|
||||
void Weapon_Reload(float fWeapon);
|
||||
|
||||
void BaseGun_AccuracyCalc(void);
|
||||
void BaseGun_Draw(void);
|
||||
float BaseGun_PrimaryFire(void);
|
||||
float BaseGun_Reload(void);
|
||||
void Effect_CreateFlash(entity targ);
|
||||
void BaseMelee_Draw(void);
|
||||
int BaseMelee_Attack(void);
|
||||
|
||||
void Ammo_AutoFill(float fWeapon);
|
||||
void Ammo_BuyPrimary(void);
|
||||
void Ammo_BuySecondary(void);
|
||||
|
||||
void Animation_PlayerTop(float fFrame);
|
||||
void Animation_PlayerTopTemp(float fFrame, float fTime);
|
||||
|
||||
void Damage_Apply(entity eTarget, entity eAttacker, float iDamage, vector vHitPos, int iSkipArmor);
|
||||
|
||||
#define NULL __NULL__
|
||||
|
|
|
@ -1,445 +1,445 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
void SV_SendChat(entity eSender, string sMessage, entity eEnt, float fType)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM);
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, fType == 0 ? EV_CHAT:EV_CHAT_TEAM);
|
||||
WriteByte(MSG_MULTICAST, num_for_edict(eSender) - 1);
|
||||
WriteByte(MSG_MULTICAST, eSender.team);
|
||||
WriteString(MSG_MULTICAST, sMessage);
|
||||
WriteString(MSG_MULTICAST, sMessage);
|
||||
|
||||
if (eEnt) {
|
||||
msg_entity = eEnt;
|
||||
multicast([0,0,0], MULTICAST_ONE);
|
||||
} else {
|
||||
multicast([0,0,0], MULTICAST_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SV_ParseClientCommand
|
||||
|
||||
Intercepts 'cmd' calls. We use it to intercept
|
||||
chat messages and handle distribution ourselves.
|
||||
=================
|
||||
*/
|
||||
if (eEnt) {
|
||||
msg_entity = eEnt;
|
||||
multicast([0,0,0], MULTICAST_ONE);
|
||||
} else {
|
||||
multicast([0,0,0], MULTICAST_ALL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
SV_ParseClientCommand
|
||||
|
||||
Intercepts 'cmd' calls. We use it to intercept
|
||||
chat messages and handle distribution ourselves.
|
||||
=================
|
||||
*/
|
||||
void Game_ParseClientCommand(string sCommand)
|
||||
{
|
||||
tokenize(sCommand);
|
||||
|
||||
if (argv(1) == "timeleft") {
|
||||
float fTimeLeft = cvar("mp_timelimit") - (time / 60);
|
||||
Vox_Singlecast(self, sprintf("we have %s minutes remaining", Vox_TimeToString(fTimeLeft)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Players talk to players, spectators to spectators.
|
||||
if (self.health) {
|
||||
if (argv(0) == "say") {
|
||||
localcmd(sprintf("echo %s: %s\n", self.netname, argv(1)));
|
||||
SV_SendChat(self, argv(1), world, 0);
|
||||
return;
|
||||
} else if (argv(0) == "say_team") {
|
||||
localcmd(sprintf("echo [TEAM %d] %s: %s\n", self.team, self.netname, argv(1)));
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
if (eFind.team == self.team) {
|
||||
SV_SendChat(self, argv(1), eFind, 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (argv(0) == "say") {
|
||||
localcmd(sprintf("echo [DEAD] %s: %s\n", self.netname, argv(1)));
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "spectator"));) {
|
||||
SV_SendChat(self, argv(1), eFind, 1);
|
||||
}
|
||||
return;
|
||||
} else if (argv(0) == "say_team") {
|
||||
localcmd(sprintf("echo [DEAD] %s: %s\n", self.netname, argv(1)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
clientcommand(self, sCommand);
|
||||
}
|
||||
|
||||
{
|
||||
tokenize(sCommand);
|
||||
|
||||
if (argv(1) == "timeleft") {
|
||||
float fTimeLeft = cvar("mp_timelimit") - (time / 60);
|
||||
Vox_Singlecast(self, sprintf("we have %s minutes remaining", Vox_TimeToString(fTimeLeft)));
|
||||
return;
|
||||
}
|
||||
|
||||
// Players talk to players, spectators to spectators.
|
||||
if (self.health) {
|
||||
if (argv(0) == "say") {
|
||||
localcmd(sprintf("echo %s: %s\n", self.netname, argv(1)));
|
||||
SV_SendChat(self, argv(1), world, 0);
|
||||
return;
|
||||
} else if (argv(0) == "say_team") {
|
||||
localcmd(sprintf("echo [TEAM %d] %s: %s\n", self.team, self.netname, argv(1)));
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
if (eFind.team == self.team) {
|
||||
SV_SendChat(self, argv(1), eFind, 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (argv(0) == "say") {
|
||||
localcmd(sprintf("echo [DEAD] %s: %s\n", self.netname, argv(1)));
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "spectator"));) {
|
||||
SV_SendChat(self, argv(1), eFind, 1);
|
||||
}
|
||||
return;
|
||||
} else if (argv(0) == "say_team") {
|
||||
localcmd(sprintf("echo [DEAD] %s: %s\n", self.netname, argv(1)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
clientcommand(self, sCommand);
|
||||
}
|
||||
|
||||
float Game_ConsoleCmd(string sCommand)
|
||||
{
|
||||
tokenize(sCommand);
|
||||
switch (argv(0)) {
|
||||
case "vox":
|
||||
Vox_Broadcast(argv(1));
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
{
|
||||
tokenize(sCommand);
|
||||
switch (argv(0)) {
|
||||
case "vox":
|
||||
Vox_Broadcast(argv(1));
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void SV_PausedTic(float fDuration)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
StartFrame
|
||||
|
||||
Runs every frame... by worldspawn?
|
||||
=================
|
||||
*/
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
StartFrame
|
||||
|
||||
Runs every frame... by worldspawn?
|
||||
=================
|
||||
*/
|
||||
void Game_StartFrame(void)
|
||||
{
|
||||
// We've got hostages, but no rescue zones, create some
|
||||
if (!iRescueZones && iHostagesMax > 0) {
|
||||
Game_CreateRescueZones();
|
||||
}
|
||||
|
||||
if (iBuyZones == 0) {
|
||||
Game_CreateBuyZones();
|
||||
}
|
||||
|
||||
// TODO: Optimise this
|
||||
if ((iAlivePlayers_T + iAlivePlayers_CT) == 0) {
|
||||
int iInGamePlayers = 0;
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
iInGamePlayers++;
|
||||
}
|
||||
|
||||
if ((iInGamePlayers > 0) && (fGameState != GAME_COMMENCING && fGameState != GAME_END)) {
|
||||
Timer_Begin(2, GAME_COMMENCING);
|
||||
} else if (iInGamePlayers == 0) {
|
||||
fGameState = GAME_INACTIVE;
|
||||
fGameTime = 0;
|
||||
iWon_T = 0;
|
||||
iWon_CT = 0;
|
||||
iRounds = 0;
|
||||
} else {
|
||||
Timer_Update(); // Timer that happens once players have started joining
|
||||
}
|
||||
} else {
|
||||
Timer_Update(); // Normal gameplay timer
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
worldspawn
|
||||
|
||||
It's the map entity, literally
|
||||
=================
|
||||
*/
|
||||
|
||||
void Game_Worldspawn(void)
|
||||
{
|
||||
string sTemp;
|
||||
int iMOTDLines = 0;
|
||||
|
||||
// The message of the day.
|
||||
localcmd(sprintf("echo [MOTD] Loading %s.\n", autocvar_motdfile));
|
||||
filestream fmMOTD = fopen(autocvar_motdfile, FILE_READ);
|
||||
|
||||
if (fmMOTD >= 0) {
|
||||
for (int i = 0; i < 25; i++) {
|
||||
sTemp = fgets(fmMOTD);
|
||||
if not (sTemp) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (sTemp == __NULL__) {
|
||||
localcmd(sprintf("serverinfo motdline%i /\n", iMOTDLines));
|
||||
} else {
|
||||
localcmd(sprintf("serverinfo motdline%i %s\n", iMOTDLines, sTemp));
|
||||
}
|
||||
iMOTDLines++;
|
||||
}
|
||||
localcmd(sprintf("serverinfo motdlength %i\n", iMOTDLines));
|
||||
fclose(fmMOTD);
|
||||
} else {
|
||||
error("[MOTD] Loading failed.\n");
|
||||
}
|
||||
|
||||
// The mapcycle information.
|
||||
localcmd(sprintf("echo [MAPCYCLE] Loading %s.\n", autocvar_mapcyclefile));
|
||||
filestream fmMapcycle = fopen(autocvar_mapcyclefile, FILE_READ);
|
||||
|
||||
if (fmMapcycle >= 0) {
|
||||
for (int i = 0;; i++) {
|
||||
sTemp = fgets(fmMapcycle);
|
||||
if not (sTemp) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (sTemp != __NULL__) {
|
||||
iMapCycleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
fseek(fmMapcycle, 0);
|
||||
localcmd(sprintf("echo [MAPCYCLE] List has %i maps.\n", iMapCycleCount));
|
||||
sMapCycle = memalloc(sizeof(string) * iMapCycleCount);
|
||||
for (int i = 0; i < iMapCycleCount; i++) {
|
||||
sMapCycle[i] = fgets(fmMapcycle);
|
||||
}
|
||||
fclose(fmMapcycle);
|
||||
|
||||
for (int i = 0; i < iMapCycleCount; i++) {
|
||||
if (sMapCycle[i] == mapname) {
|
||||
if ((i + 1) < iMapCycleCount) {
|
||||
localcmd(sprintf("echo [MAPCYCLE] Next map: %s\n", sMapCycle[i + 1]));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iMapCycleCount = 0;
|
||||
error("[MAPCYCLE] Loading failed.\n");
|
||||
}
|
||||
|
||||
// Let's make our version information clear
|
||||
localcmd(sprintf("serverinfo fcs_ver %s\n", __DATE__));
|
||||
|
||||
// All the important precaches
|
||||
for (int i = 1; i < CS_WEAPON_COUNT; i++) {
|
||||
precache_model(sWeaponModels[i]);
|
||||
}
|
||||
|
||||
/*Bot_Init();*/
|
||||
|
||||
precache_model("models/w_flashbang.mdl");
|
||||
precache_model("models/w_hegrenade.mdl");
|
||||
precache_model("models/w_smokegrenade.mdl");
|
||||
|
||||
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/player/vip/vip.mdl");
|
||||
precache_model("models/w_c4.mdl");
|
||||
|
||||
precache_sound("hostage/hos1.wav");
|
||||
precache_sound("hostage/hos2.wav");
|
||||
precache_sound("hostage/hos3.wav");
|
||||
precache_sound("hostage/hos4.wav");
|
||||
precache_sound("hostage/hos5.wav");
|
||||
precache_sound("player/pl_pain2.wav");
|
||||
precache_sound("player/pl_pain4.wav");
|
||||
precache_sound("player/pl_pain5.wav");
|
||||
precache_sound("player/pl_pain6.wav");
|
||||
precache_sound("player/pl_pain7.wav");
|
||||
precache_sound("player/die1.wav");
|
||||
precache_sound("player/die2.wav");
|
||||
precache_sound("player/die3.wav");
|
||||
precache_sound("player/headshot1.wav");
|
||||
precache_sound("player/headshot2.wav");
|
||||
precache_sound("player/headshot3.wav");
|
||||
precache_sound("items/tr_kevlar.wav");
|
||||
precache_sound("weapons/ak47-1.wav");
|
||||
precache_sound("weapons/ak47-2.wav");
|
||||
precache_sound("weapons/ak47_boltpull.wav");
|
||||
precache_sound("weapons/ak47_clipin.wav");
|
||||
precache_sound("weapons/ak47_clipout.wav");
|
||||
precache_sound("weapons/aug-1.wav");
|
||||
precache_sound("weapons/aug_boltpull.wav");
|
||||
precache_sound("weapons/aug_boltslap.wav");
|
||||
precache_sound("weapons/aug_clipin.wav");
|
||||
precache_sound("weapons/aug_clipout.wav");
|
||||
precache_sound("weapons/aug_forearm.wav");
|
||||
precache_sound("weapons/awp1.wav");
|
||||
precache_sound("weapons/awp_clipin.wav");
|
||||
precache_sound("weapons/awp_clipout.wav");
|
||||
precache_sound("weapons/awp_deploy.wav");
|
||||
precache_sound("weapons/boltdown.wav");
|
||||
precache_sound("weapons/boltpull1.wav");
|
||||
precache_sound("weapons/boltup.wav");
|
||||
precache_sound("weapons/c4_beep1.wav");
|
||||
precache_sound("weapons/c4_beep2.wav");
|
||||
precache_sound("weapons/c4_beep3.wav");
|
||||
precache_sound("weapons/c4_beep4.wav");
|
||||
precache_sound("weapons/c4_beep5.wav");
|
||||
precache_sound("weapons/c4_click.wav");
|
||||
precache_sound("weapons/c4_disarm.wav");
|
||||
precache_sound("weapons/c4_disarmed.wav");
|
||||
precache_sound("weapons/c4_explode1.wav");
|
||||
precache_sound("weapons/c4_plant.wav");
|
||||
precache_sound("weapons/clipin1.wav");
|
||||
precache_sound("weapons/clipout1.wav");
|
||||
precache_sound("weapons/de_clipin.wav");
|
||||
precache_sound("weapons/de_clipout.wav");
|
||||
precache_sound("weapons/de_deploy.wav");
|
||||
precache_sound("weapons/deagle-1.wav");
|
||||
precache_sound("weapons/deagle-2.wav");
|
||||
precache_sound("weapons/dryfire_pistol.wav");
|
||||
precache_sound("weapons/dryfire_rifle.wav");
|
||||
precache_sound("weapons/elite_clipout.wav");
|
||||
precache_sound("weapons/elite_deploy.wav");
|
||||
precache_sound("weapons/elite_fire.wav");
|
||||
precache_sound("weapons/elite_leftclipin.wav");
|
||||
precache_sound("weapons/elite_reloadstart.wav");
|
||||
precache_sound("weapons/elite_rightclipin.wav");
|
||||
precache_sound("weapons/elite_sliderelease.wav");
|
||||
precache_sound("weapons/elite_twirl.wav");
|
||||
precache_sound("weapons/fiveseven-1.wav");
|
||||
precache_sound("weapons/fiveseven_clipin.wav");
|
||||
precache_sound("weapons/fiveseven_clipout.wav");
|
||||
precache_sound("weapons/fiveseven_slidepull.wav");
|
||||
precache_sound("weapons/fiveseven_sliderelease.wav");
|
||||
precache_sound("weapons/flashbang-1.wav");
|
||||
precache_sound("weapons/flashbang-2.wav");
|
||||
precache_sound("weapons/g3sg1-1.wav");
|
||||
precache_sound("weapons/g3sg1_clipin.wav");
|
||||
precache_sound("weapons/g3sg1_clipout.wav");
|
||||
precache_sound("weapons/g3sg1_slide.wav");
|
||||
precache_sound("weapons/generic_reload.wav");
|
||||
precache_sound("weapons/generic_shot_reload.wav");
|
||||
precache_sound("weapons/glock18-1.wav");
|
||||
precache_sound("weapons/glock18-2.wav");
|
||||
precache_sound("weapons/grenade_hit1.wav");
|
||||
precache_sound("weapons/grenade_hit2.wav");
|
||||
precache_sound("weapons/grenade_hit3.wav");
|
||||
precache_sound("weapons/he_bounce-1.wav");
|
||||
precache_sound("weapons/headshot2.wav");
|
||||
precache_sound("weapons/hegrenade-1.wav");
|
||||
precache_sound("weapons/hegrenade-2.wav");
|
||||
precache_sound("weapons/knife_deploy1.wav");
|
||||
precache_sound("weapons/knife_hit1.wav");
|
||||
precache_sound("weapons/knife_hit2.wav");
|
||||
precache_sound("weapons/knife_hit3.wav");
|
||||
precache_sound("weapons/knife_hit4.wav");
|
||||
precache_sound("weapons/knife_hitwall1.wav");
|
||||
precache_sound("weapons/knife_slash1.wav");
|
||||
precache_sound("weapons/knife_slash2.wav");
|
||||
precache_sound("weapons/knife_stab.wav");
|
||||
precache_sound("weapons/m249-1.wav");
|
||||
precache_sound("weapons/m249-2.wav");
|
||||
precache_sound("weapons/m249_boxin.wav");
|
||||
precache_sound("weapons/m249_boxout.wav");
|
||||
precache_sound("weapons/m249_chain.wav");
|
||||
precache_sound("weapons/m249_coverdown.wav");
|
||||
precache_sound("weapons/m249_coverup.wav");
|
||||
precache_sound("weapons/m3-1.wav");
|
||||
precache_sound("weapons/m3_insertshell.wav");
|
||||
precache_sound("weapons/m3_pump.wav");
|
||||
precache_sound("weapons/m4a1-1.wav");
|
||||
precache_sound("weapons/m4a1_boltpull.wav");
|
||||
precache_sound("weapons/m4a1_clipin.wav");
|
||||
precache_sound("weapons/m4a1_clipout.wav");
|
||||
precache_sound("weapons/m4a1_deploy.wav");
|
||||
precache_sound("weapons/m4a1_silencer_off.wav");
|
||||
precache_sound("weapons/m4a1_silencer_on.wav");
|
||||
precache_sound("weapons/m4a1_unsil-1.wav");
|
||||
precache_sound("weapons/m4a1_unsil-2.wav");
|
||||
precache_sound("weapons/mac10-1.wav");
|
||||
precache_sound("weapons/mac10_boltpull.wav");
|
||||
precache_sound("weapons/mac10_clipin.wav");
|
||||
precache_sound("weapons/mac10_clipout.wav");
|
||||
precache_sound("weapons/mp5-1.wav");
|
||||
precache_sound("weapons/mp5-2.wav");
|
||||
precache_sound("weapons/mp5_clipin.wav");
|
||||
precache_sound("weapons/mp5_clipout.wav");
|
||||
precache_sound("weapons/mp5_slideback.wav");
|
||||
precache_sound("weapons/p228-1.wav");
|
||||
precache_sound("weapons/p228_clipin.wav");
|
||||
precache_sound("weapons/p228_clipout.wav");
|
||||
precache_sound("weapons/p228_slidepull.wav");
|
||||
precache_sound("weapons/p228_sliderelease.wav");
|
||||
precache_sound("weapons/p90-1.wav");
|
||||
precache_sound("weapons/p90_boltpull.wav");
|
||||
precache_sound("weapons/p90_clipin.wav");
|
||||
precache_sound("weapons/p90_clipout.wav");
|
||||
precache_sound("weapons/p90_cliprelease.wav");
|
||||
precache_sound("weapons/pinpull.wav");
|
||||
precache_sound("weapons/ric1.wav");
|
||||
precache_sound("weapons/ric2.wav");
|
||||
precache_sound("weapons/ric3.wav");
|
||||
precache_sound("weapons/ric4.wav");
|
||||
precache_sound("weapons/ric5.wav");
|
||||
precache_sound("weapons/ric_conc-1.wav");
|
||||
precache_sound("weapons/ric_conc-2.wav");
|
||||
precache_sound("weapons/ric_metal-1.wav");
|
||||
precache_sound("weapons/ric_metal-2.wav");
|
||||
precache_sound("weapons/scout_bolt.wav");
|
||||
precache_sound("weapons/scout_clipin.wav");
|
||||
precache_sound("weapons/scout_clipout.wav");
|
||||
precache_sound("weapons/scout_fire-1.wav");
|
||||
precache_sound("weapons/sg550-1.wav");
|
||||
precache_sound("weapons/sg550_boltpull.wav");
|
||||
precache_sound("weapons/sg550_clipin.wav");
|
||||
precache_sound("weapons/sg550_clipout.wav");
|
||||
precache_sound("weapons/sg552-1.wav");
|
||||
precache_sound("weapons/sg552-2.wav");
|
||||
precache_sound("weapons/sg552_boltpull.wav");
|
||||
precache_sound("weapons/sg552_clipin.wav");
|
||||
precache_sound("weapons/sg552_clipout.wav");
|
||||
precache_sound("weapons/sg_explode.wav");
|
||||
precache_sound("weapons/slideback1.wav");
|
||||
precache_sound("weapons/sliderelease1.wav");
|
||||
precache_sound("weapons/tmp-1.wav");
|
||||
precache_sound("weapons/tmp-2.wav");
|
||||
precache_sound("weapons/ump45-1.wav");
|
||||
precache_sound("weapons/ump45_boltslap.wav");
|
||||
precache_sound("weapons/ump45_clipin.wav");
|
||||
precache_sound("weapons/ump45_clipout.wav");
|
||||
precache_sound("weapons/usp1.wav");
|
||||
precache_sound("weapons/usp2.wav");
|
||||
precache_sound("weapons/usp_clipin.wav");
|
||||
precache_sound("weapons/usp_clipout.wav");
|
||||
precache_sound("weapons/usp_silencer_off.wav");
|
||||
precache_sound("weapons/usp_silencer_on.wav");
|
||||
precache_sound("weapons/usp_slideback.wav");
|
||||
precache_sound("weapons/usp_sliderelease.wav");
|
||||
precache_sound("weapons/usp_unsil-1.wav");
|
||||
precache_sound("weapons/xm1014-1.wav");
|
||||
precache_sound("weapons/zoom.wav");
|
||||
|
||||
clientstat(0, EV_FLOAT, health);
|
||||
clientstat(10, EV_FLOAT, weapon);
|
||||
clientstat(16, EV_FLOAT, view_ofs[2]);
|
||||
clientstat(21, EV_FLOAT, viewzoom);
|
||||
|
||||
/* FIXME: Turn those into bitflags */
|
||||
clientstat(STAT_BUYZONE, EV_FLOAT, fInBuyZone);
|
||||
clientstat(STAT_HOSTAGEZONE, EV_FLOAT, fInHostageZone);
|
||||
clientstat(STAT_BOMBZONE, EV_FLOAT, fInBombZone);
|
||||
clientstat(STAT_ESCAPEZONE, EV_FLOAT, fInEscapeZone);
|
||||
clientstat(STAT_VIPZONE, EV_FLOAT, fInVIPZone);
|
||||
|
||||
clientstat(4, EV_FLOAT, armor);
|
||||
clientstat(STAT_MONEY, EV_FLOAT, fMoney);
|
||||
clientstat(STAT_SLOT_MELEE, EV_FLOAT, fSlotMelee);
|
||||
clientstat(STAT_SLOT_PRIMARY, EV_FLOAT, fSlotPrimary);
|
||||
clientstat(STAT_SLOT_SECONDARY, EV_FLOAT, fSlotSecondary);
|
||||
clientstat(STAT_SLOT_GRENADE, EV_FLOAT, fSlotGrenade);
|
||||
clientstat(STAT_SLOT_C4BOMB, EV_FLOAT, fSlotC4Bomb);
|
||||
clientstat(STAT_ITEM_FLASHBANG, EV_INTEGER, iAmmo_FLASHBANG);
|
||||
clientstat(STAT_ITEM_HEGRENADE, EV_INTEGER, iAmmo_HEGRENADE);
|
||||
clientstat(STAT_ITEM_SMOKEGRENADE, EV_INTEGER, iAmmo_SMOKEGRENADE);
|
||||
clientstat(STAT_EQUIPMENT, EV_INTEGER, iEquipment);
|
||||
clientstat(STAT_CURRENT_MAG, EV_INTEGER, iCurrentMag);
|
||||
clientstat(STAT_CURRENT_CALIBER, EV_INTEGER, iCurrentCaliber);
|
||||
clientstat(STAT_TEAM, EV_INTEGER, team);
|
||||
clientstat(STAT_PROGRESS, EV_FLOAT, fProgressBar);
|
||||
clientstat(STAT_FLAGS, EV_FLOAT, flags);
|
||||
pointerstat(STAT_GAMETIME, EV_FLOAT, &fGameTime);
|
||||
pointerstat(STAT_GAMESTATE, EV_FLOAT, &fGameState);
|
||||
pointerstat(STAT_WON_T, EV_INTEGER, &iWon_T);
|
||||
pointerstat(STAT_WON_CT, EV_INTEGER, &iWon_CT);
|
||||
|
||||
iBombRadius = 1024;
|
||||
localcmd(sprintf("serverinfo slots %d\n", cvar("sv_playerslots")));
|
||||
localcmd("teamplay 1\n");
|
||||
}
|
||||
{
|
||||
// We've got hostages, but no rescue zones, create some
|
||||
if (!iRescueZones && iHostagesMax > 0) {
|
||||
Game_CreateRescueZones();
|
||||
}
|
||||
|
||||
if (iBuyZones == 0) {
|
||||
Game_CreateBuyZones();
|
||||
}
|
||||
|
||||
// TODO: Optimise this
|
||||
if ((iAlivePlayers_T + iAlivePlayers_CT) == 0) {
|
||||
int iInGamePlayers = 0;
|
||||
for (entity eFind = world; (eFind = find(eFind, classname, "player"));) {
|
||||
iInGamePlayers++;
|
||||
}
|
||||
|
||||
if ((iInGamePlayers > 0) && (fGameState != GAME_COMMENCING && fGameState != GAME_END)) {
|
||||
Timer_Begin(2, GAME_COMMENCING);
|
||||
} else if (iInGamePlayers == 0) {
|
||||
fGameState = GAME_INACTIVE;
|
||||
fGameTime = 0;
|
||||
iWon_T = 0;
|
||||
iWon_CT = 0;
|
||||
iRounds = 0;
|
||||
} else {
|
||||
Timer_Update(); // Timer that happens once players have started joining
|
||||
}
|
||||
} else {
|
||||
Timer_Update(); // Normal gameplay timer
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
worldspawn
|
||||
|
||||
It's the map entity, literally
|
||||
=================
|
||||
*/
|
||||
|
||||
void Game_Worldspawn(void)
|
||||
{
|
||||
string sTemp;
|
||||
int iMOTDLines = 0;
|
||||
|
||||
// The message of the day.
|
||||
localcmd(sprintf("echo [MOTD] Loading %s.\n", autocvar_motdfile));
|
||||
filestream fmMOTD = fopen(autocvar_motdfile, FILE_READ);
|
||||
|
||||
if (fmMOTD >= 0) {
|
||||
for (int i = 0; i < 25; i++) {
|
||||
sTemp = fgets(fmMOTD);
|
||||
if not (sTemp) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (sTemp == __NULL__) {
|
||||
localcmd(sprintf("serverinfo motdline%i /\n", iMOTDLines));
|
||||
} else {
|
||||
localcmd(sprintf("serverinfo motdline%i %s\n", iMOTDLines, sTemp));
|
||||
}
|
||||
iMOTDLines++;
|
||||
}
|
||||
localcmd(sprintf("serverinfo motdlength %i\n", iMOTDLines));
|
||||
fclose(fmMOTD);
|
||||
} else {
|
||||
error("[MOTD] Loading failed.\n");
|
||||
}
|
||||
|
||||
// The mapcycle information.
|
||||
localcmd(sprintf("echo [MAPCYCLE] Loading %s.\n", autocvar_mapcyclefile));
|
||||
filestream fmMapcycle = fopen(autocvar_mapcyclefile, FILE_READ);
|
||||
|
||||
if (fmMapcycle >= 0) {
|
||||
for (int i = 0;; i++) {
|
||||
sTemp = fgets(fmMapcycle);
|
||||
if not (sTemp) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (sTemp != __NULL__) {
|
||||
iMapCycleCount++;
|
||||
}
|
||||
}
|
||||
|
||||
fseek(fmMapcycle, 0);
|
||||
localcmd(sprintf("echo [MAPCYCLE] List has %i maps.\n", iMapCycleCount));
|
||||
sMapCycle = memalloc(sizeof(string) * iMapCycleCount);
|
||||
for (int i = 0; i < iMapCycleCount; i++) {
|
||||
sMapCycle[i] = fgets(fmMapcycle);
|
||||
}
|
||||
fclose(fmMapcycle);
|
||||
|
||||
for (int i = 0; i < iMapCycleCount; i++) {
|
||||
if (sMapCycle[i] == mapname) {
|
||||
if ((i + 1) < iMapCycleCount) {
|
||||
localcmd(sprintf("echo [MAPCYCLE] Next map: %s\n", sMapCycle[i + 1]));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
iMapCycleCount = 0;
|
||||
error("[MAPCYCLE] Loading failed.\n");
|
||||
}
|
||||
|
||||
// Let's make our version information clear
|
||||
localcmd(sprintf("serverinfo fcs_ver %s\n", __DATE__));
|
||||
|
||||
// All the important precaches
|
||||
for (int i = 1; i < CS_WEAPON_COUNT; i++) {
|
||||
precache_model(sWeaponModels[i]);
|
||||
}
|
||||
|
||||
/*Bot_Init();*/
|
||||
|
||||
precache_model("models/w_flashbang.mdl");
|
||||
precache_model("models/w_hegrenade.mdl");
|
||||
precache_model("models/w_smokegrenade.mdl");
|
||||
|
||||
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/player/vip/vip.mdl");
|
||||
precache_model("models/w_c4.mdl");
|
||||
|
||||
precache_sound("hostage/hos1.wav");
|
||||
precache_sound("hostage/hos2.wav");
|
||||
precache_sound("hostage/hos3.wav");
|
||||
precache_sound("hostage/hos4.wav");
|
||||
precache_sound("hostage/hos5.wav");
|
||||
precache_sound("player/pl_pain2.wav");
|
||||
precache_sound("player/pl_pain4.wav");
|
||||
precache_sound("player/pl_pain5.wav");
|
||||
precache_sound("player/pl_pain6.wav");
|
||||
precache_sound("player/pl_pain7.wav");
|
||||
precache_sound("player/die1.wav");
|
||||
precache_sound("player/die2.wav");
|
||||
precache_sound("player/die3.wav");
|
||||
precache_sound("player/headshot1.wav");
|
||||
precache_sound("player/headshot2.wav");
|
||||
precache_sound("player/headshot3.wav");
|
||||
precache_sound("items/tr_kevlar.wav");
|
||||
precache_sound("weapons/ak47-1.wav");
|
||||
precache_sound("weapons/ak47-2.wav");
|
||||
precache_sound("weapons/ak47_boltpull.wav");
|
||||
precache_sound("weapons/ak47_clipin.wav");
|
||||
precache_sound("weapons/ak47_clipout.wav");
|
||||
precache_sound("weapons/aug-1.wav");
|
||||
precache_sound("weapons/aug_boltpull.wav");
|
||||
precache_sound("weapons/aug_boltslap.wav");
|
||||
precache_sound("weapons/aug_clipin.wav");
|
||||
precache_sound("weapons/aug_clipout.wav");
|
||||
precache_sound("weapons/aug_forearm.wav");
|
||||
precache_sound("weapons/awp1.wav");
|
||||
precache_sound("weapons/awp_clipin.wav");
|
||||
precache_sound("weapons/awp_clipout.wav");
|
||||
precache_sound("weapons/awp_deploy.wav");
|
||||
precache_sound("weapons/boltdown.wav");
|
||||
precache_sound("weapons/boltpull1.wav");
|
||||
precache_sound("weapons/boltup.wav");
|
||||
precache_sound("weapons/c4_beep1.wav");
|
||||
precache_sound("weapons/c4_beep2.wav");
|
||||
precache_sound("weapons/c4_beep3.wav");
|
||||
precache_sound("weapons/c4_beep4.wav");
|
||||
precache_sound("weapons/c4_beep5.wav");
|
||||
precache_sound("weapons/c4_click.wav");
|
||||
precache_sound("weapons/c4_disarm.wav");
|
||||
precache_sound("weapons/c4_disarmed.wav");
|
||||
precache_sound("weapons/c4_explode1.wav");
|
||||
precache_sound("weapons/c4_plant.wav");
|
||||
precache_sound("weapons/clipin1.wav");
|
||||
precache_sound("weapons/clipout1.wav");
|
||||
precache_sound("weapons/de_clipin.wav");
|
||||
precache_sound("weapons/de_clipout.wav");
|
||||
precache_sound("weapons/de_deploy.wav");
|
||||
precache_sound("weapons/deagle-1.wav");
|
||||
precache_sound("weapons/deagle-2.wav");
|
||||
precache_sound("weapons/dryfire_pistol.wav");
|
||||
precache_sound("weapons/dryfire_rifle.wav");
|
||||
precache_sound("weapons/elite_clipout.wav");
|
||||
precache_sound("weapons/elite_deploy.wav");
|
||||
precache_sound("weapons/elite_fire.wav");
|
||||
precache_sound("weapons/elite_leftclipin.wav");
|
||||
precache_sound("weapons/elite_reloadstart.wav");
|
||||
precache_sound("weapons/elite_rightclipin.wav");
|
||||
precache_sound("weapons/elite_sliderelease.wav");
|
||||
precache_sound("weapons/elite_twirl.wav");
|
||||
precache_sound("weapons/fiveseven-1.wav");
|
||||
precache_sound("weapons/fiveseven_clipin.wav");
|
||||
precache_sound("weapons/fiveseven_clipout.wav");
|
||||
precache_sound("weapons/fiveseven_slidepull.wav");
|
||||
precache_sound("weapons/fiveseven_sliderelease.wav");
|
||||
precache_sound("weapons/flashbang-1.wav");
|
||||
precache_sound("weapons/flashbang-2.wav");
|
||||
precache_sound("weapons/g3sg1-1.wav");
|
||||
precache_sound("weapons/g3sg1_clipin.wav");
|
||||
precache_sound("weapons/g3sg1_clipout.wav");
|
||||
precache_sound("weapons/g3sg1_slide.wav");
|
||||
precache_sound("weapons/generic_reload.wav");
|
||||
precache_sound("weapons/generic_shot_reload.wav");
|
||||
precache_sound("weapons/glock18-1.wav");
|
||||
precache_sound("weapons/glock18-2.wav");
|
||||
precache_sound("weapons/grenade_hit1.wav");
|
||||
precache_sound("weapons/grenade_hit2.wav");
|
||||
precache_sound("weapons/grenade_hit3.wav");
|
||||
precache_sound("weapons/he_bounce-1.wav");
|
||||
precache_sound("weapons/headshot2.wav");
|
||||
precache_sound("weapons/hegrenade-1.wav");
|
||||
precache_sound("weapons/hegrenade-2.wav");
|
||||
precache_sound("weapons/knife_deploy1.wav");
|
||||
precache_sound("weapons/knife_hit1.wav");
|
||||
precache_sound("weapons/knife_hit2.wav");
|
||||
precache_sound("weapons/knife_hit3.wav");
|
||||
precache_sound("weapons/knife_hit4.wav");
|
||||
precache_sound("weapons/knife_hitwall1.wav");
|
||||
precache_sound("weapons/knife_slash1.wav");
|
||||
precache_sound("weapons/knife_slash2.wav");
|
||||
precache_sound("weapons/knife_stab.wav");
|
||||
precache_sound("weapons/m249-1.wav");
|
||||
precache_sound("weapons/m249-2.wav");
|
||||
precache_sound("weapons/m249_boxin.wav");
|
||||
precache_sound("weapons/m249_boxout.wav");
|
||||
precache_sound("weapons/m249_chain.wav");
|
||||
precache_sound("weapons/m249_coverdown.wav");
|
||||
precache_sound("weapons/m249_coverup.wav");
|
||||
precache_sound("weapons/m3-1.wav");
|
||||
precache_sound("weapons/m3_insertshell.wav");
|
||||
precache_sound("weapons/m3_pump.wav");
|
||||
precache_sound("weapons/m4a1-1.wav");
|
||||
precache_sound("weapons/m4a1_boltpull.wav");
|
||||
precache_sound("weapons/m4a1_clipin.wav");
|
||||
precache_sound("weapons/m4a1_clipout.wav");
|
||||
precache_sound("weapons/m4a1_deploy.wav");
|
||||
precache_sound("weapons/m4a1_silencer_off.wav");
|
||||
precache_sound("weapons/m4a1_silencer_on.wav");
|
||||
precache_sound("weapons/m4a1_unsil-1.wav");
|
||||
precache_sound("weapons/m4a1_unsil-2.wav");
|
||||
precache_sound("weapons/mac10-1.wav");
|
||||
precache_sound("weapons/mac10_boltpull.wav");
|
||||
precache_sound("weapons/mac10_clipin.wav");
|
||||
precache_sound("weapons/mac10_clipout.wav");
|
||||
precache_sound("weapons/mp5-1.wav");
|
||||
precache_sound("weapons/mp5-2.wav");
|
||||
precache_sound("weapons/mp5_clipin.wav");
|
||||
precache_sound("weapons/mp5_clipout.wav");
|
||||
precache_sound("weapons/mp5_slideback.wav");
|
||||
precache_sound("weapons/p228-1.wav");
|
||||
precache_sound("weapons/p228_clipin.wav");
|
||||
precache_sound("weapons/p228_clipout.wav");
|
||||
precache_sound("weapons/p228_slidepull.wav");
|
||||
precache_sound("weapons/p228_sliderelease.wav");
|
||||
precache_sound("weapons/p90-1.wav");
|
||||
precache_sound("weapons/p90_boltpull.wav");
|
||||
precache_sound("weapons/p90_clipin.wav");
|
||||
precache_sound("weapons/p90_clipout.wav");
|
||||
precache_sound("weapons/p90_cliprelease.wav");
|
||||
precache_sound("weapons/pinpull.wav");
|
||||
precache_sound("weapons/ric1.wav");
|
||||
precache_sound("weapons/ric2.wav");
|
||||
precache_sound("weapons/ric3.wav");
|
||||
precache_sound("weapons/ric4.wav");
|
||||
precache_sound("weapons/ric5.wav");
|
||||
precache_sound("weapons/ric_conc-1.wav");
|
||||
precache_sound("weapons/ric_conc-2.wav");
|
||||
precache_sound("weapons/ric_metal-1.wav");
|
||||
precache_sound("weapons/ric_metal-2.wav");
|
||||
precache_sound("weapons/scout_bolt.wav");
|
||||
precache_sound("weapons/scout_clipin.wav");
|
||||
precache_sound("weapons/scout_clipout.wav");
|
||||
precache_sound("weapons/scout_fire-1.wav");
|
||||
precache_sound("weapons/sg550-1.wav");
|
||||
precache_sound("weapons/sg550_boltpull.wav");
|
||||
precache_sound("weapons/sg550_clipin.wav");
|
||||
precache_sound("weapons/sg550_clipout.wav");
|
||||
precache_sound("weapons/sg552-1.wav");
|
||||
precache_sound("weapons/sg552-2.wav");
|
||||
precache_sound("weapons/sg552_boltpull.wav");
|
||||
precache_sound("weapons/sg552_clipin.wav");
|
||||
precache_sound("weapons/sg552_clipout.wav");
|
||||
precache_sound("weapons/sg_explode.wav");
|
||||
precache_sound("weapons/slideback1.wav");
|
||||
precache_sound("weapons/sliderelease1.wav");
|
||||
precache_sound("weapons/tmp-1.wav");
|
||||
precache_sound("weapons/tmp-2.wav");
|
||||
precache_sound("weapons/ump45-1.wav");
|
||||
precache_sound("weapons/ump45_boltslap.wav");
|
||||
precache_sound("weapons/ump45_clipin.wav");
|
||||
precache_sound("weapons/ump45_clipout.wav");
|
||||
precache_sound("weapons/usp1.wav");
|
||||
precache_sound("weapons/usp2.wav");
|
||||
precache_sound("weapons/usp_clipin.wav");
|
||||
precache_sound("weapons/usp_clipout.wav");
|
||||
precache_sound("weapons/usp_silencer_off.wav");
|
||||
precache_sound("weapons/usp_silencer_on.wav");
|
||||
precache_sound("weapons/usp_slideback.wav");
|
||||
precache_sound("weapons/usp_sliderelease.wav");
|
||||
precache_sound("weapons/usp_unsil-1.wav");
|
||||
precache_sound("weapons/xm1014-1.wav");
|
||||
precache_sound("weapons/zoom.wav");
|
||||
|
||||
clientstat(0, EV_FLOAT, health);
|
||||
clientstat(10, EV_FLOAT, weapon);
|
||||
clientstat(16, EV_FLOAT, view_ofs[2]);
|
||||
clientstat(21, EV_FLOAT, viewzoom);
|
||||
|
||||
/* FIXME: Turn those into bitflags */
|
||||
clientstat(STAT_BUYZONE, EV_FLOAT, fInBuyZone);
|
||||
clientstat(STAT_HOSTAGEZONE, EV_FLOAT, fInHostageZone);
|
||||
clientstat(STAT_BOMBZONE, EV_FLOAT, fInBombZone);
|
||||
clientstat(STAT_ESCAPEZONE, EV_FLOAT, fInEscapeZone);
|
||||
clientstat(STAT_VIPZONE, EV_FLOAT, fInVIPZone);
|
||||
|
||||
clientstat(4, EV_FLOAT, armor);
|
||||
clientstat(STAT_MONEY, EV_FLOAT, fMoney);
|
||||
clientstat(STAT_SLOT_MELEE, EV_FLOAT, fSlotMelee);
|
||||
clientstat(STAT_SLOT_PRIMARY, EV_FLOAT, fSlotPrimary);
|
||||
clientstat(STAT_SLOT_SECONDARY, EV_FLOAT, fSlotSecondary);
|
||||
clientstat(STAT_SLOT_GRENADE, EV_FLOAT, fSlotGrenade);
|
||||
clientstat(STAT_SLOT_C4BOMB, EV_FLOAT, fSlotC4Bomb);
|
||||
clientstat(STAT_ITEM_FLASHBANG, EV_INTEGER, iAmmo_FLASHBANG);
|
||||
clientstat(STAT_ITEM_HEGRENADE, EV_INTEGER, iAmmo_HEGRENADE);
|
||||
clientstat(STAT_ITEM_SMOKEGRENADE, EV_INTEGER, iAmmo_SMOKEGRENADE);
|
||||
clientstat(STAT_EQUIPMENT, EV_INTEGER, iEquipment);
|
||||
clientstat(STAT_CURRENT_MAG, EV_INTEGER, iCurrentMag);
|
||||
clientstat(STAT_CURRENT_CALIBER, EV_INTEGER, iCurrentCaliber);
|
||||
clientstat(STAT_TEAM, EV_INTEGER, team);
|
||||
clientstat(STAT_PROGRESS, EV_FLOAT, fProgressBar);
|
||||
clientstat(STAT_FLAGS, EV_FLOAT, flags);
|
||||
pointerstat(STAT_GAMETIME, EV_FLOAT, &fGameTime);
|
||||
pointerstat(STAT_GAMESTATE, EV_FLOAT, &fGameState);
|
||||
pointerstat(STAT_WON_T, EV_INTEGER, &iWon_T);
|
||||
pointerstat(STAT_WON_CT, EV_INTEGER, &iWon_CT);
|
||||
|
||||
iBombRadius = 1024;
|
||||
localcmd(sprintf("serverinfo slots %d\n", cvar("sv_playerslots")));
|
||||
localcmd("teamplay 1\n");
|
||||
}
|
||||
|
|
|
@ -301,13 +301,13 @@ class monster_scientist:CBaseEntity
|
|||
|
||||
void monster_scientist::Speak(string msg)
|
||||
{
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_SPEAK);
|
||||
WriteEntity(MSG_MULTICAST, this);
|
||||
WriteString(MSG_MULTICAST, msg);
|
||||
WriteFloat(MSG_MULTICAST, m_flPitch);
|
||||
msg_entity = this;
|
||||
multicast(origin, MULTICAST_PVS);
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_SPEAK);
|
||||
WriteEntity(MSG_MULTICAST, this);
|
||||
WriteString(MSG_MULTICAST, msg);
|
||||
WriteFloat(MSG_MULTICAST, m_flPitch);
|
||||
msg_entity = this;
|
||||
multicast(origin, MULTICAST_PVS);
|
||||
}
|
||||
|
||||
void monster_scientist::Gib(void)
|
||||
|
|
|
@ -16,8 +16,9 @@ class item_ammo:CBaseEntity
|
|||
void item_ammo::touch(void)
|
||||
{
|
||||
if (other.classname == "player") {
|
||||
player pl = (player)other;
|
||||
sound(other, CHAN_ITEM, "items/9mmclip1.wav", 1, ATTN_NORM);
|
||||
|
||||
|
||||
if (cvar("sv_playerslots") == 1) {
|
||||
remove(self);
|
||||
} else {
|
||||
|
|
|
@ -138,8 +138,8 @@ float Player_SendEntity(entity ePEnt, float fChanged)
|
|||
WriteByte(MSG_ENTITY, pl.a_ammo1);
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo2);
|
||||
WriteByte(MSG_ENTITY, pl.a_ammo3);
|
||||
WriteFloat(MSG_ENTITY, pl.w_attack_next);
|
||||
WriteFloat(MSG_ENTITY, pl.w_idle_next);
|
||||
//WriteFloat(MSG_ENTITY, pl.w_attack_next);
|
||||
//WriteFloat(MSG_ENTITY, pl.w_idle_next);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/*
|
||||
=================
|
||||
Vox_TimeToString
|
||||
|
||||
Assumes time in minutes.
|
||||
TODO: Actually output proper, tokenized strings for not just 1-10 minutes
|
||||
=================
|
||||
*/
|
||||
/***
|
||||
*
|
||||
* Copyright (c) 2016-2019 Marco 'eukara' Hladik. All rights reserved.
|
||||
*
|
||||
* See the file LICENSE attached with the sources for usage details.
|
||||
*
|
||||
****/
|
||||
|
||||
/*
|
||||
=================
|
||||
Vox_TimeToString
|
||||
|
||||
Assumes time in minutes.
|
||||
TODO: Actually output proper, tokenized strings for not just 1-10 minutes
|
||||
=================
|
||||
*/
|
||||
string Vox_TimeToString(float fTime)
|
||||
{
|
||||
fTime = rint(fTime);
|
||||
|
||||
switch (fTime) {
|
||||
{
|
||||
fTime = rint(fTime);
|
||||
|
||||
switch (fTime) {
|
||||
case 0: return "less than one";
|
||||
case 1: return "one";
|
||||
case 2: return "two";
|
||||
|
@ -30,40 +30,40 @@ string Vox_TimeToString(float fTime)
|
|||
case 8: return "eight";
|
||||
case 9: return "nine";
|
||||
case 10: return "ten";
|
||||
default: return "over ten";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Vox_Broadcast
|
||||
|
||||
Broadcasts a VOX message to all players
|
||||
=================
|
||||
*/
|
||||
default: return "over ten";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Vox_Broadcast
|
||||
|
||||
Broadcasts a VOX message to all players
|
||||
=================
|
||||
*/
|
||||
void Vox_Broadcast(string sMessage)
|
||||
{
|
||||
localcmd(sprintf("echo [VOX] Broadcast: %s\n", sMessage));
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_CHAT_VOX);
|
||||
WriteString(MSG_MULTICAST, sMessage);
|
||||
msg_entity = world;
|
||||
multicast([0,0,0], MULTICAST_ALL);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Vox_Singlecast
|
||||
|
||||
Broadcasts a VOX message to one player
|
||||
=================
|
||||
*/
|
||||
{
|
||||
localcmd(sprintf("echo [VOX] Broadcast: %s\n", sMessage));
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_CHAT_VOX);
|
||||
WriteString(MSG_MULTICAST, sMessage);
|
||||
msg_entity = world;
|
||||
multicast([0,0,0], MULTICAST_ALL);
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
Vox_Singlecast
|
||||
|
||||
Broadcasts a VOX message to one player
|
||||
=================
|
||||
*/
|
||||
void Vox_Singlecast(entity eClient, string sMessage)
|
||||
{
|
||||
localcmd(sprintf("echo [VOX] Singlecast to %s: %s\n", eClient.netname, sMessage));
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_CHAT_VOX);
|
||||
WriteString(MSG_MULTICAST, sMessage);
|
||||
msg_entity = eClient;
|
||||
{
|
||||
localcmd(sprintf("echo [VOX] Singlecast to %s: %s\n", eClient.netname, sMessage));
|
||||
WriteByte(MSG_MULTICAST, SVC_CGAMEPACKET);
|
||||
WriteByte(MSG_MULTICAST, EV_CHAT_VOX);
|
||||
WriteString(MSG_MULTICAST, sMessage);
|
||||
msg_entity = eClient;
|
||||
multicast([0,0,0], MULTICAST_ONE_R);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ typedef struct
|
|||
|
||||
void() precache;
|
||||
void() pickup;
|
||||
string() vmodel;
|
||||
void(player) updateammo;
|
||||
string() wmodel;
|
||||
string() pmodel;
|
||||
string() deathmsg;
|
||||
|
@ -79,8 +79,9 @@ vector Weapons_GetCameraPos(void);
|
|||
void Weapons_ViewPunchAngle(vector add);
|
||||
void Weapons_PlaySound(entity t, float ch, string s, float vol, float at);
|
||||
int Weapons_IsPresent(player pl, int w);
|
||||
|
||||
void Weapons_SetModel(string);
|
||||
#ifdef SSQC
|
||||
void Weapons_RefreshAmmo(player);
|
||||
void Weapons_InitItem(int w);
|
||||
void Weapons_AddItem(player pl, int w);
|
||||
void Weapons_RemoveItem(player pl, int w);
|
||||
|
|
|
@ -99,7 +99,7 @@ float CSpraylogo::predraw(void)
|
|||
getplayerkeyvalue(m_iOwnerID, "name")));
|
||||
|
||||
shaderforname(m_strLogoname,
|
||||
sprintf("{\ncull disable\npolygonOffset\n{\nmap $rt:%s\n}\n}",
|
||||
sprintf("{\ncull disable\npolygonOffset\n{\nmap $rt:%s\nblendfunc blend\n}\n}",
|
||||
m_strLogopath));
|
||||
} else {
|
||||
makevectors(m_vecAngles);
|
||||
|
|
|
@ -34,9 +34,11 @@ void w_crossbow_precache(void)
|
|||
precache_sound("weapons/xbow_hitbod1.wav");
|
||||
precache_sound("weapons/xbow_hitbod2.wav");
|
||||
}
|
||||
string w_crossbow_vmodel(void)
|
||||
void w_crossbow_updateammo(player pl)
|
||||
{
|
||||
return "models/v_crossbow.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, pl.crossbow_mag, pl.ammo_bolt, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_crossbow_wmodel(void)
|
||||
{
|
||||
|
@ -61,9 +63,7 @@ void w_crossbow_draw(void)
|
|||
{
|
||||
player pl = (player)self;
|
||||
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, pl.crossbow_mag, pl.ammo_bolt, __NULL__);
|
||||
#endif
|
||||
Weapons_SetModel("models/v_crossbow.mdl");
|
||||
|
||||
if (pl.a_ammo1) {
|
||||
Weapons_ViewAnimation(CROSSBOW_DRAW1);
|
||||
|
@ -258,7 +258,7 @@ weapon_t w_crossbow =
|
|||
w_crossbow_crosshair,
|
||||
w_crossbow_precache,
|
||||
w_crossbow_pickup,
|
||||
w_crossbow_vmodel,
|
||||
w_crossbow_updateammo,
|
||||
w_crossbow_wmodel,
|
||||
w_crossbow_pmodel,
|
||||
w_crossbow_deathmsg,
|
||||
|
|
|
@ -32,9 +32,11 @@ void w_crowbar_precache(void)
|
|||
precache_model("models/p_crowbar.mdl");
|
||||
}
|
||||
|
||||
string w_crowbar_vmodel(void)
|
||||
void w_crowbar_updateammo(player pl)
|
||||
{
|
||||
return "models/v_crowbar.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, __NULL__, __NULL__, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_crowbar_wmodel(void)
|
||||
{
|
||||
|
@ -51,10 +53,7 @@ string w_crowbar_deathmsg(void)
|
|||
|
||||
void w_crowbar_draw(void)
|
||||
{
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, __NULL__, __NULL__);
|
||||
#endif
|
||||
Weapons_SetModel("models/v_crowbar.mdl");
|
||||
Weapons_ViewAnimation(CROWBAR_DRAW);
|
||||
}
|
||||
|
||||
|
@ -176,7 +175,7 @@ weapon_t w_crowbar =
|
|||
__NULL__,
|
||||
w_crowbar_precache,
|
||||
__NULL__,
|
||||
w_crowbar_vmodel,
|
||||
w_crowbar_updateammo,
|
||||
w_crowbar_wmodel,
|
||||
w_crowbar_pmodel,
|
||||
w_crowbar_deathmsg,
|
||||
|
|
|
@ -27,9 +27,11 @@ void w_egon_precache(void)
|
|||
precache_model("models/w_egon.mdl");
|
||||
precache_model("models/p_egon.mdl");
|
||||
}
|
||||
string w_egon_vmodel(void)
|
||||
void w_egon_updateammo(player pl)
|
||||
{
|
||||
return "models/v_egon.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_egon_wmodel(void)
|
||||
{
|
||||
|
@ -55,12 +57,9 @@ void w_egon_pickup(void)
|
|||
void w_egon_draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
#ifdef CSQC
|
||||
Weapons_SetModel("models/v_egon.mdl");
|
||||
Weapons_ViewAnimation(EGON_DRAW);
|
||||
pl.w_idle_next = 1.0f;
|
||||
#else
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_egon_holster(void)
|
||||
|
@ -168,7 +167,7 @@ weapon_t w_egon =
|
|||
w_egon_crosshair,
|
||||
w_egon_precache,
|
||||
w_egon_pickup,
|
||||
w_egon_vmodel,
|
||||
w_egon_updateammo,
|
||||
w_egon_wmodel,
|
||||
w_egon_pmodel,
|
||||
w_egon_deathmsg,
|
||||
|
|
|
@ -33,9 +33,11 @@ void w_gauss_precache(void)
|
|||
precache_sound("weapons/electro6.wav");
|
||||
precache_sound("ambience/pulsemachine.wav");
|
||||
}
|
||||
string w_gauss_vmodel(void)
|
||||
void w_gauss_updateammo(player pl)
|
||||
{
|
||||
return "models/v_gauss.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_gauss_wmodel(void)
|
||||
{
|
||||
|
@ -60,11 +62,8 @@ void w_gauss_pickup(void)
|
|||
|
||||
void w_gauss_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_gauss.mdl");
|
||||
Weapons_ViewAnimation(GAUSS_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_uranium, __NULL__);
|
||||
#endif
|
||||
}
|
||||
|
||||
void w_gauss_holster(void)
|
||||
|
@ -382,7 +381,7 @@ weapon_t w_gauss =
|
|||
w_gauss_crosshair,
|
||||
w_gauss_precache,
|
||||
w_gauss_pickup,
|
||||
w_gauss_vmodel,
|
||||
w_gauss_updateammo,
|
||||
w_gauss_wmodel,
|
||||
w_gauss_pmodel,
|
||||
w_gauss_deathmsg,
|
||||
|
|
|
@ -26,9 +26,11 @@ void w_glock_precache(void)
|
|||
precache_model("models/p_9mmhandgun.mdl");
|
||||
precache_sound("weapons/pl_gun3.wav");
|
||||
}
|
||||
string w_glock_vmodel(void)
|
||||
void w_glock_updateammo(player pl)
|
||||
{
|
||||
return "models/v_9mmhandgun.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, pl.glock_mag, pl.ammo_9mm, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_glock_wmodel(void)
|
||||
{
|
||||
|
@ -53,6 +55,7 @@ void w_glock_pickup(void)
|
|||
|
||||
void w_glock_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_9mmhandgun.mdl");
|
||||
Weapons_ViewAnimation(GLOCK_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -243,7 +246,7 @@ weapon_t w_glock =
|
|||
w_glock_hud,
|
||||
w_glock_precache,
|
||||
w_glock_pickup,
|
||||
w_glock_vmodel,
|
||||
w_glock_updateammo,
|
||||
w_glock_wmodel,
|
||||
w_glock_pmodel,
|
||||
w_glock_deathmsg,
|
||||
|
|
|
@ -25,9 +25,11 @@ void w_handgrenade_precache(void)
|
|||
precache_model("models/w_grenade.mdl");
|
||||
precache_model("models/p_grenade.mdl");
|
||||
}
|
||||
string w_handgrenade_vmodel(void)
|
||||
void w_handgrenade_updateammo(player pl)
|
||||
{
|
||||
return "models/v_grenade.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_handgrenade, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_handgrenade_wmodel(void)
|
||||
{
|
||||
|
@ -108,9 +110,9 @@ void w_handgrenade_throw(void)
|
|||
|
||||
void w_handgrenade_draw(void)
|
||||
{
|
||||
#ifdef CSQC
|
||||
Weapons_SetModel("models/v_crowbar.mdl");
|
||||
Weapons_ViewAnimation(HANDGRENADE_DRAW);
|
||||
#else
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_handgrenade, __NULL__);
|
||||
#endif
|
||||
|
@ -229,7 +231,7 @@ weapon_t w_handgrenade =
|
|||
w_handgrenade_hud,
|
||||
w_handgrenade_precache,
|
||||
w_handgrenade_pickup,
|
||||
w_handgrenade_vmodel,
|
||||
w_handgrenade_updateammo,
|
||||
w_handgrenade_wmodel,
|
||||
w_handgrenade_pmodel,
|
||||
w_handgrenade_deathmsg,
|
||||
|
|
|
@ -34,9 +34,11 @@ void w_hornetgun_pickup(void)
|
|||
pl.ammo_hornet = 8;
|
||||
#endif
|
||||
}
|
||||
string w_hornetgun_vmodel(void)
|
||||
void w_hornetgun_updateammo(player pl)
|
||||
{
|
||||
return "models/v_hgun.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_hornet, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_hornetgun_wmodel(void)
|
||||
{
|
||||
|
@ -53,6 +55,7 @@ string w_hornetgun_deathmsg(void)
|
|||
|
||||
void w_hornetgun_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_hgun.mdl");
|
||||
Weapons_ViewAnimation(HORNETGUN_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -236,7 +239,7 @@ weapon_t w_hornetgun =
|
|||
w_hornetgun_crosshair,
|
||||
w_hornetgun_precache,
|
||||
w_hornetgun_pickup,
|
||||
w_hornetgun_vmodel,
|
||||
w_hornetgun_updateammo,
|
||||
w_hornetgun_wmodel,
|
||||
w_hornetgun_pmodel,
|
||||
w_hornetgun_deathmsg,
|
||||
|
|
|
@ -35,9 +35,11 @@ void w_mp5_pickup(void)
|
|||
pl.mp5_mag = 25;
|
||||
}
|
||||
|
||||
string w_mp5_vmodel(void)
|
||||
void w_mp5_updateammo(player pl)
|
||||
{
|
||||
return "models/v_9mmar.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, pl.mp5_mag, pl.ammo_9mm, pl.ammo_m203_grenade);
|
||||
#endif
|
||||
}
|
||||
|
||||
string w_mp5_wmodel(void)
|
||||
|
@ -57,6 +59,7 @@ string w_mp5_deathmsg(void)
|
|||
|
||||
void w_mp5_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_9mmar.mdl");
|
||||
Weapons_ViewAnimation(MP5_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -259,7 +262,7 @@ weapon_t w_mp5 = {
|
|||
w_mp5_crosshair,
|
||||
w_mp5_precache,
|
||||
w_mp5_pickup,
|
||||
w_mp5_vmodel,
|
||||
w_mp5_updateammo,
|
||||
w_mp5_wmodel,
|
||||
w_mp5_pmodel,
|
||||
w_mp5_deathmsg,
|
||||
|
|
|
@ -33,9 +33,11 @@ void w_python_pickup(void)
|
|||
pl.python_mag = 6;
|
||||
}
|
||||
|
||||
string w_python_vmodel(void)
|
||||
void w_python_updateammo(player pl)
|
||||
{
|
||||
return "models/v_357.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, pl.python_mag, pl.ammo_357, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_python_wmodel(void)
|
||||
{
|
||||
|
@ -52,6 +54,7 @@ string w_python_deathmsg(void)
|
|||
|
||||
void w_python_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_357.mdl");
|
||||
Weapons_ViewAnimation(PYTHON_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -209,7 +212,7 @@ weapon_t w_python =
|
|||
w_python_crosshair,
|
||||
w_python_precache,
|
||||
w_python_pickup,
|
||||
w_python_vmodel,
|
||||
w_python_updateammo,
|
||||
w_python_wmodel,
|
||||
w_python_pmodel,
|
||||
w_python_deathmsg,
|
||||
|
|
|
@ -29,9 +29,11 @@ void w_rpg_precache(void)
|
|||
precache_model("sprites/laserdot.spr");
|
||||
precache_sound("weapons/rocketfire1.wav");
|
||||
}
|
||||
string w_rpg_vmodel(void)
|
||||
void w_rpg_updateammo(player pl)
|
||||
{
|
||||
return "models/v_rpg.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, pl.rpg_mag, pl.ammo_rocket, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_rpg_wmodel(void)
|
||||
{
|
||||
|
@ -56,6 +58,7 @@ void w_rpg_pickup(void)
|
|||
|
||||
void w_rpg_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_rpg.mdl");
|
||||
Weapons_ViewAnimation(RPG_DRAW1);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -236,7 +239,7 @@ weapon_t w_rpg =
|
|||
w_rpg_laser,
|
||||
w_rpg_precache,
|
||||
w_rpg_pickup,
|
||||
w_rpg_vmodel,
|
||||
w_rpg_updateammo,
|
||||
w_rpg_wmodel,
|
||||
w_rpg_pmodel,
|
||||
w_rpg_deathmsg,
|
||||
|
|
|
@ -23,9 +23,11 @@ enum
|
|||
RADIO_HOLSTER
|
||||
};
|
||||
|
||||
string w_satchel_vmodel(void)
|
||||
void w_satchel_updateammo(player pl)
|
||||
{
|
||||
return "models/v_satchel.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, pl.satchel_chg, pl.ammo_satchel, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_satchel_wmodel(void)
|
||||
{
|
||||
|
@ -57,6 +59,7 @@ void w_satchel_pickup(void)
|
|||
|
||||
void w_satchel_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_satchel.mdl");
|
||||
Weapons_ViewAnimation(SATCHEL_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -247,7 +250,7 @@ weapon_t w_satchel =
|
|||
w_satchel_hud,
|
||||
w_satchel_precache,
|
||||
w_satchel_pickup,
|
||||
w_satchel_vmodel,
|
||||
w_satchel_updateammo,
|
||||
w_satchel_wmodel,
|
||||
w_satchel_pmodel,
|
||||
w_satchel_deathmsg,
|
||||
|
|
|
@ -38,9 +38,11 @@ void w_shotgun_precache(void)
|
|||
precache_sound("weapons/reload3.wav");
|
||||
precache_sound("weapons/scock1.wav");
|
||||
}
|
||||
string w_shotgun_vmodel(void)
|
||||
void w_shotgun_updateammo(player pl)
|
||||
{
|
||||
return "models/v_shotgun.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, pl.shotgun_mag, pl.ammo_buckshot, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_shotgun_wmodel(void)
|
||||
{
|
||||
|
@ -65,6 +67,7 @@ void w_shotgun_pickup(void)
|
|||
|
||||
void w_shotgun_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_shotgun.mdl");
|
||||
Weapons_ViewAnimation(SHOTGUN_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -278,7 +281,7 @@ weapon_t w_shotgun =
|
|||
w_shotgun_crosshair,
|
||||
w_shotgun_precache,
|
||||
w_shotgun_pickup,
|
||||
w_shotgun_vmodel,
|
||||
w_shotgun_updateammo,
|
||||
w_shotgun_wmodel,
|
||||
w_shotgun_pmodel,
|
||||
w_shotgun_deathmsg,
|
||||
|
|
|
@ -26,6 +26,7 @@ void w_snark_pickup(void)
|
|||
|
||||
void w_snark_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_squeak.mdl");
|
||||
Weapons_ViewAnimation(SNARK_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -200,9 +201,11 @@ void w_snark_precache(void)
|
|||
precache_sound("squeek/sqk_hunt2.wav");
|
||||
precache_sound("squeek/sqk_hunt3.wav");
|
||||
}
|
||||
string w_snark_vmodel(void)
|
||||
void w_snark_updateammo(player pl)
|
||||
{
|
||||
return "models/v_squeak.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_snark, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_snark_wmodel(void)
|
||||
{
|
||||
|
@ -255,7 +258,7 @@ weapon_t w_snark =
|
|||
w_snark_hud,
|
||||
w_snark_precache,
|
||||
w_snark_pickup,
|
||||
w_snark_vmodel,
|
||||
w_snark_updateammo,
|
||||
w_snark_wmodel,
|
||||
w_snark_pmodel,
|
||||
w_snark_deathmsg,
|
||||
|
|
|
@ -27,9 +27,11 @@ void w_tripmine_precache(void)
|
|||
precache_sound("weapons/mine_charge.wav");
|
||||
precache_sound("weapons/mine_activate.wav");
|
||||
}
|
||||
string w_tripmine_vmodel(void)
|
||||
void w_tripmine_updateammo(player pl)
|
||||
{
|
||||
return "models/v_tripmine.mdl";
|
||||
#ifdef SSQC
|
||||
Weapons_UpdateAmmo(pl, __NULL__, pl.ammo_tripmine, __NULL__);
|
||||
#endif
|
||||
}
|
||||
string w_tripmine_wmodel(void)
|
||||
{
|
||||
|
@ -53,6 +55,7 @@ void w_tripmine_pickup(void)
|
|||
|
||||
void w_tripmine_draw(void)
|
||||
{
|
||||
Weapons_SetModel("models/v_tripmine.mdl");
|
||||
Weapons_ViewAnimation(TRIPMINE_DRAW);
|
||||
#ifdef SSQC
|
||||
player pl = (player)self;
|
||||
|
@ -269,7 +272,7 @@ weapon_t w_tripmine =
|
|||
w_tripmine_hud,
|
||||
w_tripmine_precache,
|
||||
w_tripmine_pickup,
|
||||
w_tripmine_vmodel,
|
||||
w_tripmine_updateammo,
|
||||
w_tripmine_wmodel,
|
||||
w_tripmine_pmodel,
|
||||
w_tripmine_deathmsg,
|
||||
|
|
|
@ -19,6 +19,13 @@ void Weapons_Init(void)
|
|||
}
|
||||
}
|
||||
|
||||
void Weapons_SetModel(string mdl)
|
||||
{
|
||||
#ifdef CSQC
|
||||
setmodel(pSeat->eViewModel, mdl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_Draw(void)
|
||||
{
|
||||
player pl = (player)self;
|
||||
|
@ -31,6 +38,13 @@ void Weapons_Draw(void)
|
|||
if (g_weapons[i].draw != __NULL__) {
|
||||
g_weapons[i].draw();
|
||||
}
|
||||
#ifdef CSQC
|
||||
View_UpdateWeapon(pSeat->eViewModel, pSeat->eMuzzleflash);
|
||||
#else
|
||||
if (g_weapons[i].updateammo != __NULL__) {
|
||||
g_weapons[i].updateammo(pl);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Weapons_Holster(void)
|
||||
|
@ -87,15 +101,6 @@ void Weapons_DrawCrosshair(void)
|
|||
}
|
||||
}
|
||||
|
||||
string Weapons_GetViewmodel(int id)
|
||||
{
|
||||
if (g_weapons[id].vmodel != __NULL__) {
|
||||
return g_weapons[id].vmodel();
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
string Weapons_GetWorldmodel(int id)
|
||||
{
|
||||
if (g_weapons[id].wmodel != __NULL__) {
|
||||
|
@ -211,6 +216,13 @@ int Weapons_IsPresent(player pl, int w)
|
|||
|
||||
#ifdef SSQC
|
||||
|
||||
void Weapons_RefreshAmmo(player pl)
|
||||
{
|
||||
if (g_weapons[pl.activeweapon].updateammo != __NULL__) {
|
||||
g_weapons[pl.activeweapon].updateammo(pl);
|
||||
}
|
||||
}
|
||||
|
||||
void Weapons_SwitchBest(player pl)
|
||||
{
|
||||
entity oldself = self;
|
||||
|
|
|
@ -22,7 +22,7 @@ typedef struct
|
|||
|
||||
void() precache;
|
||||
void() pickup;
|
||||
string() vmodel;
|
||||
void(player) updateammo;
|
||||
string() wmodel;
|
||||
string() pmodel;
|
||||
string() deathmsg;
|
||||
|
@ -68,25 +68,26 @@ enum
|
|||
};
|
||||
|
||||
void Weapons_DrawCrosshair(void);
|
||||
void Decals_PlaceSmall(vector pos);
|
||||
void Decals_PlaceBig(vector pos);
|
||||
void Decals_PlaceSmall(vector);
|
||||
void Decals_PlaceBig(vector);
|
||||
void Weapons_MakeVectors(void);
|
||||
vector Weapons_GetCameraPos(void);
|
||||
void Weapons_ViewAnimation(int i);
|
||||
void Weapons_ViewPunchAngle(vector add);
|
||||
void Weapons_PlaySound(entity t, float ch, string s, float vol, float at);
|
||||
int Weapons_IsPresent(player pl, int w);
|
||||
|
||||
void Weapons_ViewAnimation(int);
|
||||
void Weapons_ViewPunchAngle(vector);
|
||||
void Weapons_PlaySound(entity, float, string, float, float);
|
||||
int Weapons_IsPresent(player, int);
|
||||
void Weapons_SetModel(string);
|
||||
#ifdef SSQC
|
||||
void Weapons_InitItem(int w);
|
||||
float Weapons_GetAim(int w);
|
||||
void Weapons_AddItem(player pl, int w);
|
||||
void Weapons_RemoveItem(player pl, int w);
|
||||
string Weapons_GetWorldmodel(int id);
|
||||
void Weapons_UpdateAmmo(player pl, int a1, int a2, int a3);
|
||||
void Weapons_ReloadWeapon(player pl, .int mag, .int ammo, int max);
|
||||
void Weapons_RefreshAmmo(player);
|
||||
void Weapons_InitItem(int);
|
||||
float Weapons_GetAim(int);
|
||||
void Weapons_AddItem(player, int);
|
||||
void Weapons_RemoveItem(player, int);
|
||||
string Weapons_GetWorldmodel(int);
|
||||
void Weapons_UpdateAmmo(player, int, int, int);
|
||||
void Weapons_ReloadWeapon(player, .int, .int, int);
|
||||
#else
|
||||
string Weapons_GetPlayermodel(int id);
|
||||
string Weapons_GetPlayermodel(int);
|
||||
int Weapons_GetAnimation(void);
|
||||
void Weapons_HUDPic(int w, int s, vector pos);
|
||||
void Weapons_HUDPic(int, int, vector);
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue