diff --git a/Source/Builtins.h b/Source/Builtins.h index 3d153bef..01c17dbf 100644 --- a/Source/Builtins.h +++ b/Source/Builtins.h @@ -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 diff --git a/Source/Client/Defs.h b/Source/Client/Defs.h index a3a344e6..05f95c1e 100644 --- a/Source/Client/Defs.h +++ b/Source/Client/Defs.h @@ -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; diff --git a/Source/Client/Draw.c b/Source/Client/Draw.c index ab64104f..4e3c3401 100644 --- a/Source/Client/Draw.c +++ b/Source/Client/Draw.c @@ -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 ) { diff --git a/Source/Client/Event.c b/Source/Client/Event.c index c100f7fb..c4c9895b 100644 --- a/Source/Client/Event.c +++ b/Source/Client/Event.c @@ -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(); diff --git a/Source/Client/HUD.c b/Source/Client/HUD.c index 9b2fdc9e..e9d03613 100644 --- a/Source/Client/HUD.c +++ b/Source/Client/HUD.c @@ -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(); diff --git a/Source/Client/HUDCrosshair.c b/Source/Client/HUDCrosshair.c index 6638bd18..11f998cb 100644 --- a/Source/Client/HUDCrosshair.c +++ b/Source/Client/HUDCrosshair.c @@ -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 ); } diff --git a/Source/Client/HUDWeaponSelect.c b/Source/Client/HUDWeaponSelect.c index 32f5ea0b..d1bde831 100644 --- a/Source/Client/HUDWeaponSelect.c +++ b/Source/Client/HUDWeaponSelect.c @@ -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; diff --git a/Source/Client/Init.c b/Source/Client/Init.c index 70eda46e..2d5c2c41 100644 --- a/Source/Client/Init.c +++ b/Source/Client/Init.c @@ -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" ); diff --git a/Source/Client/VGUI.c b/Source/Client/VGUI.c index c61c03e7..d35eae1f 100644 --- a/Source/Client/VGUI.c +++ b/Source/Client/VGUI.c @@ -48,6 +48,8 @@ void CSQC_VGUI_Draw( void ) { setcursormode( FALSE ); return; } + + vVGUIColor = autocvar_vgui_color * ( 1 / 255 ); setcursormode( TRUE ); diff --git a/Source/Client/VGUIObjects.c b/Source/Client/VGUIObjects.c index 8e0de54b..c0be19bc 100644 --- a/Source/Client/VGUIObjects.c +++ b/Source/Client/VGUIObjects.c @@ -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 ); } diff --git a/Source/Client/View.c b/Source/Client/View.c index 55d5cae5..d1943658 100644 --- a/Source/Client/View.c +++ b/Source/Client/View.c @@ -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 ) { diff --git a/Source/Globals.h b/Source/Globals.h index 9263e7e2..646d2713 100644 --- a/Source/Globals.h +++ b/Source/Globals.h @@ -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, diff --git a/Source/Math.h b/Source/Math.h index 601844e0..fc473000 100644 --- a/Source/Math.h +++ b/Source/Math.h @@ -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; - } -} diff --git a/Source/Server/Main.c b/Source/Server/Main.c index d1b982cd..aab9d6e0 100644 --- a/Source/Server/Main.c +++ b/Source/Server/Main.c @@ -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 } diff --git a/Source/Server/Rules.c b/Source/Server/Rules.c index f0be6f7f..a6e7c310 100644 --- a/Source/Server/Rules.c +++ b/Source/Server/Rules.c @@ -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 ); } } diff --git a/Source/Server/Spawn.c b/Source/Server/Spawn.c index 1d1e1d2b..40251893 100644 --- a/Source/Server/Spawn.c +++ b/Source/Server/Spawn.c @@ -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; diff --git a/Source/Shared/Effects.c b/Source/Shared/Effects.c index 7f0689ab..6521549c 100644 --- a/Source/Shared/Effects.c +++ b/Source/Shared/Effects.c @@ -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 diff --git a/Source/Shared/Weapons.c b/Source/Shared/Weapons.c index 1aa07b99..54e6d686 100644 --- a/Source/Shared/Weapons.c +++ b/Source/Shared/Weapons.c @@ -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; } diff --git a/opencs/default.cfg b/opencs/default.cfg index 5f04cd6b..111d4ce6 100644 --- a/opencs/default.cfg +++ b/opencs/default.cfg @@ -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" diff --git a/opencs/particles/default.cfg b/opencs/particles/default.cfg index b346effb..398dc72a 100644 --- a/opencs/particles/default.cfg +++ b/opencs/particles/default.cfg @@ -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