Fixed a bug in which switching the team wouldn't restart the match when the playercount was 0
Optimisations with cvars Added cross_color Added vgui_color
This commit is contained in:
parent
2fa81cc594
commit
7afac5c6cf
20 changed files with 125 additions and 115 deletions
|
@ -12,7 +12,7 @@ Available options:
|
|||
-Faccessors - use accessors instead of basic types via defines
|
||||
-O - write to a different qc file
|
||||
*/
|
||||
#pragma noref 1A
|
||||
#pragma noref 1
|
||||
//#pragma flag enable logicops
|
||||
#pragma warning error Q101 /*too many parms*/
|
||||
#pragma warning error Q105 /*too few parms*/
|
||||
|
@ -73,7 +73,6 @@ Available options:
|
|||
#define DP_EF_RED
|
||||
#define DP_ENT_CUSTOMCOLORMAP
|
||||
#define DP_ENT_EXTERIORMODELTOCLIENT
|
||||
#define DP_ENT_SCALE
|
||||
#define DP_ENT_TRAILEFFECTNUM /* self.traileffectnum=particleeffectnum("myeffectname"); can be used to attach a particle trail to the given server entity. This is equivelent to calling trailparticles each frame. */
|
||||
#define DP_ENT_VIEWMODEL
|
||||
#define DP_GECKO_SUPPORT
|
||||
|
@ -617,7 +616,7 @@ void(string dest, string from, string cmd, string info) SV_ParseClusterEvent; /*
|
|||
float(string sender, string body) SV_ParseConnectionlessPacket; /* Provides QC with a way to communicate between servers, or with client server browsers. Sender is the sender's ip. Body is the body of the message. You'll need to add your own password/etc support as required. Self is not valid. */
|
||||
void(float pauseduration) SV_PausedTic; /* For each frame that the server is paused, this function will be called to give the gamecode a chance to unpause the server again. the pauseduration argument says how long the server has been paused for (the time global is frozen and will not increment while paused). Self is not valid. */
|
||||
float(float newstatus) SV_ShouldPause; /* Called to give the qc a change to block pause/unpause requests. Return false for the pause request to be ignored. newstatus is 1 if the user is trying to pause the game. For the duration of the call, self will be set to the player who tried to pause, or to world if it was triggered by a server-side event. */
|
||||
void() SV_RunClientCommand; /* Called each time a player movement packet was received from a client. Self is set to the player entity which should be updated, while the input_* globals specify the various properties stored within the input packet. The contents of this function should be somewaht identical to the equivelent function in CSQC, or prediction misses will occur. If you're feeling lazy, you can simply call 'runstandardplayerphysicsrunstandardplayerphysics' after modifying the inputs. */
|
||||
void() SV_RunClientCommand; /* Called each time a player movement packet was received from a client. Self is set to the player entity which should be updated, while the input_* globals specify the various properties stored within the input packet. The contents of this function should be somewaht identical to the equivelent function in CSQC, or prediction misses will occur. If you're feeling lazy, you can simply call 'runstandardplayerphysics' after modifying the inputs. */
|
||||
void() SV_AddDebugPolygons; /* Called each video frame. This is the only place where ssqc is allowed to call the R_BeginPolygon/R_PolygonVertex/R_EndPolygon builtins. This is exclusively for debugging, and will break in anything but single player as it will not be called if the engine is not running both a client and a server. */
|
||||
void() SV_PlayerPhysics; /* Legacy method to tweak player input that does not reliably work with prediction (prediction WILL break). Mods that care about prediction should use SV_RunClientCommand instead. If pr_no_playerphysics is set to 1, this function will never be called, which will either fix prediction or completely break player movement depending on whether the feature was even useful. */
|
||||
void() EndFrame; /* Called after non-player entities have been run at the end of the physics frame. Player physics is performed out of order and can/will still occur between EndFrame and BeginFrame. */
|
||||
|
@ -1225,8 +1224,10 @@ const float TEREDIT_TINT = 17;
|
|||
const float TEREDIT_RESET_SECT = 20;
|
||||
const float TEREDIT_RELOAD_SECT = 21;
|
||||
const float TEREDIT_ENTS_WIPE = 22;
|
||||
const float TEREDIT_ENTS_CONCAT = 23;
|
||||
const float TEREDIT_ENTS_GET = 24;
|
||||
const float TEREDIT_ENT_GET = 26;
|
||||
const float TEREDIT_ENT_SET = 27;
|
||||
const float TEREDIT_ENT_ADD = 28;
|
||||
const float TEREDIT_ENT_COUNT = 29;
|
||||
#endif
|
||||
#if defined(CSQC) || defined(MENU)
|
||||
const float SLIST_HOSTCACHEVIEWCOUNT = 0;
|
||||
|
@ -1663,7 +1664,7 @@ float(string extname) checkextension = #99; /*
|
|||
|
||||
#endif
|
||||
float(__variant funcref) checkbuiltin = #0:checkbuiltin; /*
|
||||
Checks to see if the specified builtin is supported/mapped. This is intended as a way to check for #0 functions, allowing for simple single-builtin functions. */
|
||||
Checks to see if the specified builtin is supported/mapped. This is intended as a way to check for #0 functions, allowing for simple single-builtin functions. Warning, if two different engines map different builtins to the same number, then this function will not tell you which will be called, only that it won't crash (the exception being #0, which are remapped as available). */
|
||||
|
||||
#ifdef SSQC
|
||||
float(string builtinname) builtin_find = #100; /*
|
||||
|
@ -2074,6 +2075,11 @@ void(string dest, string from, string cmd, string info) clusterevent = #0:cluste
|
|||
string(entity player, optional string newnode) clustertransfer = #0:clustertransfer; /*
|
||||
Only functions in mapcluster mode. Initiate transfer of the player to a different node. Can take some time. If dest is specified, returns null on error. Otherwise returns the current/new target node (or null if not transferring). */
|
||||
|
||||
#endif
|
||||
#if defined(CSQC) || defined(SSQC)
|
||||
float(float mdlidx) modelframecount = #0:modelframecount; /*
|
||||
Retrieves the number of frames in the specified model. */
|
||||
|
||||
#endif
|
||||
#if defined(CSQC) || defined(MENU)
|
||||
void() clearscene = #300; /*
|
||||
|
@ -2750,6 +2756,9 @@ void(string s) loadfromfile = #530; /*
|
|||
|
||||
#endif
|
||||
#ifdef SSQC
|
||||
void(float pause) setpause = #531; /*
|
||||
Sets whether the server should or should not be paused. This does not affect auto-paused things like when the console is down. */
|
||||
|
||||
float(string mname) precache_vwep_model = #532; /* Part of ZQ_VWEP*/
|
||||
#endif
|
||||
float(float v, optional float base) log = #532; /* Part of ??MVDSV_BUILTINS
|
||||
|
|
|
@ -24,7 +24,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#define DRAWFLAG_MODULATE 2
|
||||
#define DRAWFLAG_2XMODULATE 3
|
||||
|
||||
vector autocvar_con_color; // autocvar of "con_color"
|
||||
vector autocvar_vgui_color; // autocvar of "vgui_color"
|
||||
vector autocvar_cross_color; // autocvar of "cross_color"
|
||||
|
||||
vector vHUDColor; // Defined in HUD_Draw (HUD.c)
|
||||
vector vVGUIColor; // Defined in HUD_Draw (VGUI.c)
|
||||
vector vCrossColor; // Defined in HUD_Draw (HUDCrosshair.c)
|
||||
|
||||
float fVGUI_Display; // The VGUI menu currently being drawn
|
||||
|
||||
vector vVideoResolution; // Updated every frame
|
||||
|
@ -51,3 +58,5 @@ float fCameraTime;
|
|||
void View_PlayAnimation( int iSequence );
|
||||
void Sound_Delayed( string sSample, float fVol, float fDelay );
|
||||
|
||||
// This actually belongs in Builtins.h since its an undocumented global
|
||||
vector pmove_vel;
|
||||
|
|
|
@ -111,7 +111,8 @@ void CSQC_DrawCenterprint( void ) {
|
|||
for ( int i = 0; i < ( fCenterPrintLines ); i++ ) {
|
||||
vCenterPrintPos_x = ( vVideoResolution_x / 2 ) - ( stringwidth( sCenterPrintBuffer[ i ], FALSE ) / 2 );
|
||||
drawstring( vCenterPrintPos + '1 1', sCenterPrintBuffer[ i ], '8 8 0', '0 0 0', fCenterPrintAlpha, 0 );
|
||||
drawstring( vCenterPrintPos, sCenterPrintBuffer[ i ], '8 8 0', VGUI_WINDOW_FGCOLOR, fCenterPrintAlpha, 0 );
|
||||
drawstring( vCenterPrintPos, sCenterPrintBuffer[ i ], '8 8 0', '0.25 0.25 0.25', fCenterPrintAlpha, 0 );
|
||||
drawstring( vCenterPrintPos, sCenterPrintBuffer[ i ], '8 8 0', vHUDColor, fCenterPrintAlpha, DRAWFLAG_ADDITIVE );
|
||||
vCenterPrintPos_y += 8;
|
||||
}
|
||||
}
|
||||
|
@ -165,6 +166,7 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
|
|||
//setproperty( VF_ANGLES, input_angles );
|
||||
View_DrawViewModel();
|
||||
}
|
||||
|
||||
renderscene();
|
||||
|
||||
if( fGameFocus == TRUE ) {
|
||||
|
|
|
@ -106,7 +106,6 @@ void CSQC_Parse_Event( void ) {
|
|||
float fStyle = readbyte();
|
||||
Effect_BreakModel( vPos, vSize, '0 0 0', fStyle );
|
||||
} else if ( fHeader == EV_CAMERATRIGGER ) {
|
||||
|
||||
vCameraPos_x = readcoord();
|
||||
vCameraPos_y = readcoord();
|
||||
vCameraPos_z = readcoord();
|
||||
|
|
|
@ -94,9 +94,9 @@ HUD_DrawHealth
|
|||
Draw the current amount of health
|
||||
=================
|
||||
*/
|
||||
float fOldHealth;
|
||||
float fHealthAlpha;
|
||||
void HUD_DrawHealth( void ) {
|
||||
static float fOldHealth;
|
||||
static float fHealthAlpha;
|
||||
if ( getstatf( STAT_HEALTH ) != fOldHealth ) {
|
||||
fHealthAlpha = 1.0;
|
||||
}
|
||||
|
@ -120,9 +120,9 @@ HUD_DrawArmor
|
|||
Draw the current amount of Kevlar
|
||||
=================
|
||||
*/
|
||||
float fOldArmor;
|
||||
float fArmorAlpha;
|
||||
void HUD_DrawArmor( void ) {
|
||||
static float fOldArmor;
|
||||
static float fArmorAlpha;
|
||||
if ( getstatf( STAT_ARMOR ) != fOldArmor ) {
|
||||
fArmorAlpha = 1.0;
|
||||
}
|
||||
|
@ -180,9 +180,9 @@ HUD_DrawTimer
|
|||
Draws the roundtime at the bottom of the screen (always visible)
|
||||
=================
|
||||
*/
|
||||
int iOldUnits;
|
||||
float fTimerAlpha;
|
||||
void HUD_DrawTimer( void ) {
|
||||
static int iOldUnits;
|
||||
static float fTimerAlpha;
|
||||
int iMinutes, iSeconds, iTens, iUnits;
|
||||
vector vTimePos = [ ( vVideoResolution_x / 2 ) - 62, vVideoResolution_y - 42 ];
|
||||
|
||||
|
@ -258,11 +258,12 @@ HUD_DrawMoney
|
|||
Draws the amount of money (0-16000) with an icon to the screen
|
||||
=================
|
||||
*/
|
||||
float fOldMoneyValue;
|
||||
float fMoneyAlphaEffect;
|
||||
vector vMoneyColorEffect;
|
||||
float fMoneyDifference;
|
||||
void HUD_DrawMoney( void ) {
|
||||
static float fOldMoneyValue;
|
||||
static float fMoneyAlphaEffect;
|
||||
static vector vMoneyColorEffect;
|
||||
static float fMoneyDifference;
|
||||
|
||||
// If the money differs from last frame, paint it appropriately
|
||||
if ( getstatf( STAT_MONEY ) > fOldMoneyValue ) {
|
||||
// Effect already in progress from something else, go add on top of it!
|
||||
|
@ -327,9 +328,9 @@ HUD_DrawAmmo
|
|||
Draws the current clip, the amount of ammo for the caliber and a matching caliber icon
|
||||
=================
|
||||
*/
|
||||
float fOldMag, fOldCal;
|
||||
float fAmmoAlpha;
|
||||
void HUD_DrawAmmo( void ) {
|
||||
static float fOldMag, fOldCal;
|
||||
static float fAmmoAlpha;
|
||||
if ( getstatf( STAT_ACTIVEWEAPON ) == WEAPON_KNIFE || getstatf( STAT_ACTIVEWEAPON ) == WEAPON_C4BOMB ) {
|
||||
return;
|
||||
}
|
||||
|
@ -389,6 +390,11 @@ void HUD_DrawProgressBar( void ) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void HUD_DrawRadar( void ) {
|
||||
drawpic( '16 16', "sprites/radar640.spr_0.tga", '128 128', '1 1 1', 0.5, DRAWFLAG_ADDITIVE );
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
HUD_Draw
|
||||
|
@ -396,20 +402,8 @@ HUD_Draw
|
|||
Called every frame in Draw.c
|
||||
=================
|
||||
*/
|
||||
string sOldConColor;
|
||||
void HUD_Draw( void ) {
|
||||
// Only recalculate the color when it's changed.
|
||||
if ( cvar_string( "con_color" ) != sOldConColor ) {
|
||||
sOldConColor = cvar_string( "con_color" );
|
||||
tokenize( sOldConColor );
|
||||
vHUDColor_x = stof( argv( 0 ) ) / 255;
|
||||
vHUDColor_y = stof( argv( 1 ) ) / 255;
|
||||
vHUDColor_z = stof( argv( 2 ) ) / 255;
|
||||
} else if ( cvar_string( "con_color" ) == "" ){
|
||||
vHUDColor_x = 1;
|
||||
vHUDColor_y = 0.5;
|
||||
vHUDColor_z = 0;
|
||||
}
|
||||
vHUDColor = autocvar_con_color * ( 1 / 255 );
|
||||
|
||||
HUD_DrawTimer();
|
||||
|
||||
|
@ -417,6 +411,7 @@ void HUD_Draw( void ) {
|
|||
return;
|
||||
}
|
||||
|
||||
HUD_DrawRadar();
|
||||
HUD_DrawHealth();
|
||||
HUD_DrawArmor();
|
||||
HUD_DrawIcons();
|
||||
|
|
|
@ -37,6 +37,8 @@ void HUD_DrawCrosshair( void ) {
|
|||
float fDistance = wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCrosshairMinDistance;
|
||||
float fDeltaDistance = wptTable[ getstatf( STAT_ACTIVEWEAPON ) ].iCrosshairDeltaDistance;
|
||||
|
||||
vCrossColor = autocvar_cross_color * ( 1 / 255 );
|
||||
|
||||
if ( !( getstatf( STAT_FLAGS ) & FL_ONGROUND) ) { // If we are in the air...
|
||||
fDistance = fDistance * 2;
|
||||
} else if ( getstatf( STAT_FLAGS ) & FL_CROUCHING ) { // Crouching...
|
||||
|
@ -47,7 +49,7 @@ void HUD_DrawCrosshair( void ) {
|
|||
|
||||
// The amount of shots that we've shot totally does affect our accuracy!
|
||||
if ( iShotMultiplier > iOldShotMultiplier ) {
|
||||
fCrosshairDistance = Math_Min( 15, fCrosshairDistance + fDeltaDistance );
|
||||
fCrosshairDistance = min( 15, fCrosshairDistance + fDeltaDistance );
|
||||
} else if ( fCrosshairDistance > fDistance ) {
|
||||
// Slowly decrease the distance again, 0.02 seems to be the magic number here.
|
||||
fCrosshairDistance -= frametime + ( fCrosshairDistance * 0.02 );
|
||||
|
@ -67,7 +69,7 @@ void HUD_DrawCrosshair( void ) {
|
|||
iCrosshairDistance = ceil( fCrosshairDistance );
|
||||
iLineLength = ( ( iCrosshairDistance - fDistance ) / 2 ) + 5;
|
||||
|
||||
iLineLength = Math_Max( 1, iLineLength );
|
||||
iLineLength = max( 1, iLineLength );
|
||||
|
||||
// Line positions
|
||||
vector vVer1, vVer2, vHor1, vHor2;
|
||||
|
@ -84,8 +86,8 @@ void HUD_DrawCrosshair( void ) {
|
|||
vHor2_x = ( vVideoResolution_x / 2 ) + iCrosshairDistance + 1;
|
||||
vHor2_y = ( vVideoResolution_y / 2 );
|
||||
|
||||
drawfill( vVer1, [ 1, iLineLength ], '0 1 0', 0.75, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vVer2, [ 1, iLineLength ], '0 1 0', 0.75, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vHor1, [ iLineLength, 1 ], '0 1 0', 0.75, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vHor2, [ iLineLength, 1 ], '0 1 0', 0.75, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vVer1, [ 1, iLineLength ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vVer2, [ 1, iLineLength ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vHor1, [ iLineLength, 1 ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
|
||||
drawfill( vHor2, [ iLineLength, 1 ], vCrossColor, 1, DRAWFLAG_ADDITIVE );
|
||||
}
|
||||
|
|
|
@ -246,9 +246,7 @@ Called by CSQC_Input_Frame when conditions are met
|
|||
=================
|
||||
*/
|
||||
void HUD_DrawWeaponSelect_Trigger( void ) {
|
||||
if ( fHUDWeaponSelected != getstatf( STAT_ACTIVEWEAPON ) ) {
|
||||
sendevent( "PlayerSwitchWeapon", "f", fHUDWeaponSelected );
|
||||
}
|
||||
sendevent( "PlayerSwitchWeapon", "f", fHUDWeaponSelected );
|
||||
sound( self, CHAN_ITEM, "common/wpn_select.wav", 0.5, ATTN_NONE );
|
||||
fHUDWeaponSelectTime = 0;
|
||||
fHUDWeaponSelected = 0;
|
||||
|
|
|
@ -27,6 +27,7 @@ Comparable to worldspawn in SSQC in that it's mostly used for precaches
|
|||
*/
|
||||
void CSQC_Init(float apilevel, string enginename, float engineversion) {
|
||||
precache_model( HUD_NUMFILE );
|
||||
precache_model( "sprites/radar640.spr" );
|
||||
precache_model( "sprites/640hud1.spr" );
|
||||
precache_model( "sprites/640hud16.spr" );
|
||||
|
||||
|
|
|
@ -48,6 +48,8 @@ void CSQC_VGUI_Draw( void ) {
|
|||
setcursormode( FALSE );
|
||||
return;
|
||||
}
|
||||
|
||||
vVGUIColor = autocvar_vgui_color * ( 1 / 255 );
|
||||
|
||||
setcursormode( TRUE );
|
||||
|
||||
|
|
|
@ -61,20 +61,20 @@ void VGUI_Window( string sTitle, vector vPos, vector vSize ) {
|
|||
// Draw the outline START
|
||||
v1_x = vPos_x + vSize_x;
|
||||
v1_y = vPos_y;
|
||||
drawline( 1.0, vPos - '1 0 0', v1, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, vPos - '1 0 0', v1, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
|
||||
v2_x = vPos_x;
|
||||
v2_y = vPos_y + vSize_y;
|
||||
drawline( 1.0, vPos, v2, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, vPos, v2, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
|
||||
v3 = vPos + vSize;
|
||||
drawline( 1.0, v1, v3, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v2, v3, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v1, v3, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v2, v3, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
// Draw the outline END
|
||||
|
||||
// Draw the window title
|
||||
drawstring( vPos + '16 16 0', sTitle, '16 16 0', VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, vPos + '0 48 0', v1 + '0 48 0', VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawstring( vPos + '16 16 0', sTitle, '16 16 0', vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, vPos + '0 48 0', v1 + '0 48 0', vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
}
|
||||
|
||||
// Draws a button, returns whether or not a mouse is hovering over it (for inheritance' sake)
|
||||
|
@ -84,15 +84,15 @@ float VGUI_Button( string sLabel, void() vFunction, vector vPos, vector vSize )
|
|||
// Draw the outline START
|
||||
v1_x = vPos_x + vSize_x;
|
||||
v1_y = vPos_y;
|
||||
drawline( 1.0, vPos - '1 0 0', v1, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, vPos - '1 0 0', v1, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
|
||||
v2_x = vPos_x;
|
||||
v2_y = vPos_y + vSize_y;
|
||||
drawline( 1.0, vPos, v2, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, vPos, v2, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
|
||||
v3 = vPos + vSize;
|
||||
drawline( 1.0, v1, v3, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v2, v3, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v1, v3, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v2, v3, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
// Draw the outline END
|
||||
|
||||
// Draw the button label
|
||||
|
@ -105,11 +105,11 @@ float VGUI_Button( string sLabel, void() vFunction, vector vPos, vector vSize )
|
|||
fMouseClick = FALSE;
|
||||
}
|
||||
|
||||
drawstring( v4, sLabel, '8 8 0', VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v4 + '0 10 0', v4 + '0 10 0' + [ (strlen( sLabel ) * 8 ), 0 ], VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawstring( v4, sLabel, '8 8 0', vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v4 + '0 10 0', v4 + '0 10 0' + [ (strlen( sLabel ) * 8 ), 0 ], vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
return TRUE;
|
||||
} else {
|
||||
drawstring( v4, sLabel, '8 8 0', VGUI_WINDOW_FGCOLOR * 0.8, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawstring( v4, sLabel, '8 8 0', vVGUIColor * 0.8, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -121,15 +121,15 @@ void VGUI_FakeButton( string sLabel, vector vPos, vector vSize ) {
|
|||
// Draw the outline START
|
||||
v1_x = vPos_x + vSize_x;
|
||||
v1_y = vPos_y;
|
||||
drawline( 1.0, vPos - '1 0 0', v1, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA * 0.5, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, vPos - '1 0 0', v1, vVGUIColor, VGUI_WINDOW_FGALPHA * 0.5, DRAWFLAG_ADDITIVE );
|
||||
|
||||
v2_x = vPos_x;
|
||||
v2_y = vPos_y + vSize_y;
|
||||
drawline( 1.0, vPos, v2, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA * 0.5, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, vPos, v2, vVGUIColor, VGUI_WINDOW_FGALPHA * 0.5, DRAWFLAG_ADDITIVE );
|
||||
|
||||
v3 = vPos + vSize;
|
||||
drawline( 1.0, v1, v3, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA * 0.5, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v2, v3, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA * 0.5, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v1, v3, vVGUIColor, VGUI_WINDOW_FGALPHA * 0.5, DRAWFLAG_ADDITIVE );
|
||||
drawline( 1.0, v2, v3, vVGUIColor, VGUI_WINDOW_FGALPHA * 0.5, DRAWFLAG_ADDITIVE );
|
||||
// Draw the outline END
|
||||
|
||||
// Draw the button label
|
||||
|
@ -137,10 +137,10 @@ void VGUI_FakeButton( string sLabel, vector vPos, vector vSize ) {
|
|||
v4_y = vPos_y + ( ( vSize_y / 2 ) - 4 );
|
||||
|
||||
|
||||
drawstring( v4, sLabel, '8 8 0', VGUI_WINDOW_FGCOLOR * 0.5, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawstring( v4, sLabel, '8 8 0', vVGUIColor * 0.5, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
}
|
||||
|
||||
// Wrapper for simple VGUI Text labels
|
||||
void VGUI_Text( string sText, vector vPos, vector vSize ) {
|
||||
drawstring( vPos, sText, vSize, VGUI_WINDOW_FGCOLOR, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
drawstring( vPos, sText, vSize, vVGUIColor, VGUI_WINDOW_FGALPHA, DRAWFLAG_ADDITIVE );
|
||||
}
|
||||
|
|
|
@ -51,8 +51,7 @@ string sViewModels[ CS_WEAPON_COUNT ] = {
|
|||
View_CalcBob
|
||||
====================
|
||||
*/
|
||||
vector pmove_vel;
|
||||
float V_CalcBob( void ) {
|
||||
float View_CalcBob( void ) {
|
||||
static float fBobTime;
|
||||
static float fBob;
|
||||
float fCycle;
|
||||
|
@ -78,8 +77,8 @@ float V_CalcBob( void ) {
|
|||
|
||||
fBob = sqrt( vVelocity_x * vVelocity_x + vVelocity_y * vVelocity_y ) * cvar( "cl_bob" );
|
||||
fBob = fBob * 0.3 + fBob * 0.7 * sin(fCycle);
|
||||
fBob = Math_Min( fBob, 4 );
|
||||
fBob = Math_Max( fBob, -7 );
|
||||
fBob = min( fBob, 4 );
|
||||
fBob = max( fBob, -7 );
|
||||
|
||||
return fBob * 0.5;
|
||||
}
|
||||
|
@ -95,7 +94,7 @@ void View_DrawViewModel( void ) {
|
|||
|
||||
if ( time != fLastTime ) {
|
||||
makevectors( getproperty( VF_ANGLES ) );
|
||||
eViewModel.origin = getproperty( VF_ORIGIN ) + '0 0 -1' + ( v_forward * V_CalcBob() );
|
||||
eViewModel.origin = getproperty( VF_ORIGIN ) + '0 0 -1' + ( v_forward * View_CalcBob() );
|
||||
eViewModel.angles = getproperty( VF_ANGLES );
|
||||
|
||||
if( getstatf( STAT_ACTIVEWEAPON ) < CS_WEAPON_COUNT ) {
|
||||
|
|
|
@ -95,12 +95,15 @@ enum {
|
|||
#define CS_EQUIPMENT_COUNT 7
|
||||
#define EQUIPMENT_KEVLAR 1
|
||||
#define EQUIPMENT_HELMET 2
|
||||
#define EQUIPMENT_FLASHBANG 4
|
||||
#define EQUIPMENT_HEGRENADE 8
|
||||
#define EQUIPMENT_SMOKEGRENADE 16
|
||||
|
||||
#define EQUIPMENT_DEFUSALKIT 32
|
||||
#define EQUIPMENT_NIGHTVISION 64
|
||||
|
||||
//#define WEAPON_C4BOMB 32
|
||||
#define EQUIPMENT_FLASHBANG 64
|
||||
#define EQUIPMENT_HEGRENADE 128
|
||||
#define EQUIPMENT_SMOKEGRENADE 256
|
||||
|
||||
enum {
|
||||
CALIBER_50AE = 1,
|
||||
CALIBER_762MM,
|
||||
|
|
|
@ -28,19 +28,3 @@ float Math_LerpAngle( float fStart, float fEnd, float fAmount ) {
|
|||
float Math_CRandom( void ) {
|
||||
return 2 * ( random() - 0.5 );
|
||||
}
|
||||
|
||||
float Math_Min( float fA, float fB ) {
|
||||
if ( fA < fB ) {
|
||||
return fA;
|
||||
} else {
|
||||
return fB;
|
||||
}
|
||||
}
|
||||
|
||||
float Math_Max( float fA, float fB ) {
|
||||
if ( fA > fB ) {
|
||||
return fA;
|
||||
} else {
|
||||
return fB;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,19 +40,15 @@ void StartFrame( void ) {
|
|||
// TODO: Optimise this
|
||||
if ( ( iAlivePlayers_T + iAlivePlayers_CT ) == 0 ) {
|
||||
int iInGamePlayers = 0;
|
||||
static int iOldInGamePlayers;
|
||||
for ( entity eFind = world; ( eFind = find( eFind, classname, "player" ) ); ) {
|
||||
iInGamePlayers++;
|
||||
}
|
||||
|
||||
if ( iInGamePlayers > iOldInGamePlayers ) {
|
||||
dprint( "Game commencing...\n" );
|
||||
if ( ( iInGamePlayers > 0 ) && ( fGameState != GAME_COMMENCING ) ) {
|
||||
Timer_Begin( 2, GAME_COMMENCING );
|
||||
iOldInGamePlayers = iInGamePlayers;
|
||||
} else if ( iInGamePlayers == 0 ) {
|
||||
fGameState = GAME_INACTIVE;
|
||||
fGameTime = 0;
|
||||
iOldInGamePlayers = 0;
|
||||
} else {
|
||||
Timer_Update(); // Timer that happens once players have started joining
|
||||
}
|
||||
|
|
|
@ -139,17 +139,17 @@ void Rules_RoundOver( int iTeamWon, int iMoneyReward, float fSilent ) {
|
|||
}
|
||||
|
||||
if ( iTeamWon == TEAM_T ) {
|
||||
if ( fSilent == TRUE ) {
|
||||
if ( fSilent == FALSE ) {
|
||||
Radio_BroadcastMessage( RADIO_TERWIN );
|
||||
}
|
||||
iWon_T++;
|
||||
} else if ( iTeamWon == TEAM_CT ) {
|
||||
if ( fSilent == TRUE ) {
|
||||
if ( fSilent == FALSE ) {
|
||||
Radio_BroadcastMessage( RADIO_CTWIN );
|
||||
}
|
||||
iWon_CT++;
|
||||
} else {
|
||||
if ( fSilent == TRUE ) {
|
||||
if ( fSilent == FALSE ) {
|
||||
Radio_BroadcastMessage( RADIO_ROUNDDRAW );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,11 +183,22 @@ void CSEv_GamePlayerSpawn_f( float fChar ) {
|
|||
return;
|
||||
}
|
||||
|
||||
// Hey, we are alive and are trying to switch teams, so subtract us from the Alive_Team counter.
|
||||
if ( self.health > 0 ) {
|
||||
if ( self.team == TEAM_T ) {
|
||||
iAlivePlayers_T--;
|
||||
} else if ( self.team == TEAM_CT ) {
|
||||
iAlivePlayers_CT--;
|
||||
}
|
||||
}
|
||||
|
||||
// Spawn the players immediately when its in the freeze state
|
||||
switch ( fGameState ) {
|
||||
case GAME_INACTIVE:
|
||||
case GAME_COMMENCING:
|
||||
case GAME_ACTIVE:
|
||||
case GAME_END:
|
||||
case GAME_FREEZE:
|
||||
self.fCharModel = fChar;
|
||||
Spawn_CreateClient( fChar );
|
||||
break;
|
||||
default:
|
||||
if( fChar == 0 ) {
|
||||
PutClientInServer();
|
||||
return;
|
||||
|
@ -204,11 +215,6 @@ void CSEv_GamePlayerSpawn_f( float fChar ) {
|
|||
forceinfokey( self, "*dead", "1" );
|
||||
forceinfokey( self, "*team", ftos( self.team ) );
|
||||
break;
|
||||
default:
|
||||
self.fCharModel = fChar;
|
||||
Spawn_CreateClient( fChar );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
self.frags = 0;
|
||||
|
|
|
@ -41,7 +41,7 @@ void Effect_AnimatedSprite( vector vPos, float fIndex, float fFPS, float fScale,
|
|||
self.think = Effect_AnimatedSprite_Animate;
|
||||
self.drawmask = MASK_ENGINE;
|
||||
self.nextthink = time + ( 1 / self.framerate );
|
||||
//self.maxframe = modelframecount( self.modelindex );
|
||||
self.maxframe = modelframecount( self.modelindex );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -182,8 +182,10 @@ void CSEv_PlayerBuyWeapon_f( float fWeapon ) {
|
|||
}
|
||||
|
||||
void CSEv_PlayerSwitchWeapon_f( float fWeapon ) {
|
||||
self.weapon = fWeapon;
|
||||
Weapon_Draw( fWeapon );
|
||||
if ( fWeapon != self.weapon ) {
|
||||
self.weapon = fWeapon;
|
||||
Weapon_Draw( fWeapon );
|
||||
}
|
||||
|
||||
self.fAttackFinished = time + 1.0;
|
||||
}
|
||||
|
|
|
@ -29,22 +29,25 @@ bind ESC togglemenu
|
|||
bind v noclip
|
||||
|
||||
// Movement Variables
|
||||
sv_maxspeed 240
|
||||
cl_forwardspeed 240
|
||||
cl_sidespeed 240
|
||||
cl_backspeed 240
|
||||
cl_movespeedkey 0.2
|
||||
seta sv_maxspeed 240
|
||||
seta cl_forwardspeed 240
|
||||
seta cl_sidespeed 240
|
||||
seta cl_backspeed 240
|
||||
seta cl_movespeedkey 0.2
|
||||
seta mp_startmoney "800"
|
||||
seta mp_buytime 90
|
||||
seta mp_freezetime 6
|
||||
seta mp_c4timer 45
|
||||
seta mp_roundtime 5
|
||||
cl_bobcycle 0.8
|
||||
cl_bob 0.01
|
||||
cl_bobup 0.5
|
||||
|
||||
seta cl_bobcycle 0.8
|
||||
seta cl_bob 0.01
|
||||
seta cl_bobup 0.5
|
||||
seta r_particledesc default
|
||||
|
||||
seta con_color 255 128 0
|
||||
seta vgui_color 255 128 0
|
||||
seta cross_color 0 255 0
|
||||
|
||||
hostname "OpenCS Server"
|
||||
seta vid_conautoscale "1"
|
||||
seta snd_device "sdl"
|
||||
|
|
|
@ -8,7 +8,7 @@ r_part te_gunshot
|
|||
scalefactor 1
|
||||
alpha 0.5
|
||||
die 0.8
|
||||
rgb 255 180 0
|
||||
rgb 255 115 0
|
||||
blend add
|
||||
spawnmode ball
|
||||
spawnorg 1
|
||||
|
|
Loading…
Reference in a new issue