diff --git a/Source/Client/Defs.h b/Source/Client/Defs.h index 49a4e45f..432bafdd 100755 --- a/Source/Client/Defs.h +++ b/Source/Client/Defs.h @@ -39,8 +39,9 @@ var vector autocvar_cross_color = '0 255 0'; // autocvar of "cross_color" var float autocvar_cl_bob = 0.01; var float autocvar_cl_bobcycle = 0.8; var float autocvar_cl_bobup = 0.5; -var float autocvar_cl_bobclassic = 0; -var float autocvar_v_lefthanded = 0; +var int autocvar_cl_bobclassic = FALSE; +var int autocvar_v_lefthanded = FALSE; +var int autocvar_cl_thirdperson = FALSE; // Particle stuff var float PARTICLE_SPARK; diff --git a/Source/Client/Player.c b/Source/Client/Player.c index 6cb5a213..49de2d39 100755 --- a/Source/Client/Player.c +++ b/Source/Client/Player.c @@ -48,6 +48,31 @@ string sPModels[ CS_WEAPON_COUNT - 1 ] = { "models/p_smokegrenade.mdl" }; +void Player_Draw( void ) { + if ( !self.eGunModel ) { + self.eGunModel = spawn(); + self.eGunModel.drawmask = MASK_ENGINE; + + // Get the weapon bone ID for the current player model + self.fWeaponBoneID = gettagindex( self, "Bip01 R Hand" ); + } + + // Only bother updating the model if the weapon has changed + if ( self.fWeaponLast != self.weapon ) { + setmodel( self.eGunModel, sPModels[ self.weapon - 1 ] ); + self.fWeaponLast = self.weapon; + + // Update the bone index of the current p_ model so we can calculate the offset + self.eGunModel.fWeaponBoneID = gettagindex( self.eGunModel, "Bip01 R Hand" ); + } + + Animation_PlayerUpdate(); + self.baseframe1time += frametime; + self.frame1time += frametime; + + self.baseframe2time += frametime; + self.frame2time += frametime; +} /* ================= Player_PreDraw @@ -58,29 +83,33 @@ Responsible for local player prediction and other player appearance/interpolatio */ float Player_PreDraw( void ) { if ( self.entnum == player_localentnum ) { + vector vOldOrigin; + vector vOldVelocity; + float fOldPMoveFlags; // Don't predict if we're frozen/paused FIXME: FTE doesn't have serverkey_float yet! if ( serverkey( SERVERKEY_PAUSESTATE ) == "1" || ( ( getstati( STAT_GAMESTATE ) == GAME_FREEZE ) && ( getstati( STAT_HEALTH ) > 0 ) ) ) { vPlayerOrigin = self.origin; - vPlayerVelocity = '0 0 0'; - addentity( self ); - return PREDRAW_NEXT; - } - - vector vOldOrigin = self.origin; - vector vOldVelocity = self.velocity; - float fOldPMoveFlags = self.pmove_flags; - - if ( getplayerkeyvalue( player_localnum, "*spec" ) == "0" ) { - self.movetype = MOVETYPE_WALK; + vOldOrigin = vPlayerOrigin; + + self.velocity = '0 0 0'; + vOldVelocity = self.velocity; + fOldPMoveFlags = 0; } else { - self.movetype = MOVETYPE_NOCLIP; + vOldOrigin = self.origin; + vOldVelocity = self.velocity; + fOldPMoveFlags = self.pmove_flags; + + if ( getplayerkeyvalue( player_localnum, "*spec" ) == "0" ) { + self.movetype = MOVETYPE_WALK; + } else { + self.movetype = MOVETYPE_NOCLIP; + } + + for ( int i = servercommandframe + 1; i <= clientcommandframe; i++ ) { + getinputstate( i ); + runstandardplayerphysics( self ); + } } - - for ( int i = servercommandframe + 1; i <= clientcommandframe; i++ ) { - getinputstate( i ); - runstandardplayerphysics( self ); - } - vPlayerOriginOld = vPlayerOrigin; if ( ( self.flags & FL_ONGROUND ) && ( self.origin_z - vPlayerOriginOld_z > 0 ) ) { @@ -97,8 +126,26 @@ float Player_PreDraw( void ) { vPlayerOriginOld_z = self.origin_z; } - vPlayerOrigin = [ self.origin_x, self.origin_y, vPlayerOriginOld_z ]; vPlayerVelocity = self.velocity; + + if ( autocvar_cl_thirdperson == TRUE ) { + static vector vStart; + static vector vEnd; + + makevectors( view_angles ); + vStart = [ self.origin_x, self.origin_y, vPlayerOriginOld_z + 8 ] + ( v_right * 4 ); + vEnd = vStart + ( v_forward * -48 ) + '0 0 8' + ( v_right * 4 ); + traceline( vStart, vEnd, FALSE, self ); + vPlayerOrigin = trace_endpos + ( v_forward * 5 ); + self.renderflags = 0; + Player_Draw(); + } else { + if ( self.eGunModel ) { + remove( self.eGunModel ); + } + self.renderflags = RF_EXTERNALMODEL; + vPlayerOrigin = [ self.origin_x, self.origin_y, vPlayerOriginOld_z ]; + } addentity( self ); self.origin = vOldOrigin; @@ -106,33 +153,8 @@ float Player_PreDraw( void ) { self.velocity = vOldVelocity; self.pmove_flags = fOldPMoveFlags; self.movetype = MOVETYPE_NONE; - - self.renderflags = RF_EXTERNALMODEL; } else { - if ( !self.eGunModel ) { - self.eGunModel = spawn(); - self.eGunModel.drawmask = MASK_ENGINE; - - // Get the weapon bone ID for the current player model - self.fWeaponBoneID = gettagindex( self, "Bip01 R Hand" ); - } - - // Only bother updating the model if the weapon has changed - if ( self.fWeaponLast != self.weapon ) { - setmodel( self.eGunModel, sPModels[ self.weapon - 1 ] ); - self.fWeaponLast = self.weapon; - - // Update the bone index of the current p_ model so we can calculate the offset - self.eGunModel.fWeaponBoneID = gettagindex( self.eGunModel, "Bip01 R Hand" ); - } - - Animation_PlayerUpdate(); - self.baseframe1time += frametime; - self.frame1time += frametime; - - self.baseframe2time += frametime; - self.frame2time += frametime; - + Player_Draw(); addentity( self ); } return PREDRAW_NEXT; diff --git a/Source/FreeCS-CE.prj b/Source/FreeCS-CE.prj index 01652c17..b8ccffcd 100644 --- a/Source/FreeCS-CE.prj +++ b/Source/FreeCS-CE.prj @@ -1,5 +1,5 @@ - + @@ -60,7 +60,7 @@ - + @@ -114,29 +114,18 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/Source/Menu/Defs.h b/Source/Menu/Defs.h index db6e3da8..bbcc08c7 100644 --- a/Source/Menu/Defs.h +++ b/Source/Menu/Defs.h @@ -182,5 +182,11 @@ typedef struct { int iHeaderID; } fcsMenu; +typedef struct { + int iR; + int iG; + int iB; +} color; + void Menu_SetClipArea( vector vPosition, vector vRegion ); void Menu_ResetClipArea( void ); \ No newline at end of file diff --git a/Source/Menu/MenuConfiguration.c b/Source/Menu/MenuConfiguration.c index 43f67f36..42a8b459 100755 --- a/Source/Menu/MenuConfiguration.c +++ b/Source/Menu/MenuConfiguration.c @@ -240,6 +240,9 @@ Menu_Configuration_Player void Menu_Configuration_Player( void ) { static string strPlayername; static int iFirst = 1; + static color cCross; + static color cVGUI; + static color cCon; static void Player_OK( void ) { if ( strPlayername != __NULL__ ) { @@ -248,15 +251,80 @@ void Menu_Configuration_Player( void ) { } else { strPlayername = cvar_string( "name" ); } + + cvar_set( "cross_color", sprintf( "%i %i %i", cCross.iR, cCross.iG, cCross.iB ) ); + cvar_set( "vgui_color", sprintf( "%i %i %i", cVGUI.iR, cVGUI.iG, cVGUI.iB ) ); + cvar_set( "con_color", sprintf( "%i %i %i", cCon.iR, cCon.iG, cCon.iB ) ); } if ( iFirst == 1 ) { + float fCheck; strPlayername = cvar_string( "name" ); + + fCheck = tokenize( cvar_string( "cross_color" ) ); + if ( fCheck == 3 ) { + cCross.iR = stof( argv( 0 ) ); + cCross.iG = stof( argv( 1 ) ); + cCross.iB = stof( argv( 2 ) ); + } else { + // TODO... put this in a more global location? If this is changed, change Defs.h in Source/Client too! + cCross.iR = 0; + cCross.iG = 255; + cCross.iB = 0; + cvar_set( "cross_color", "0 255 0" ); + } + + fCheck = tokenize( cvar_string( "vgui_color" ) ); + if ( fCheck == 3 ) { + cVGUI.iR = stof( argv( 0 ) ); + cVGUI.iG = stof( argv( 1 ) ); + cVGUI.iB = stof( argv( 2 ) ); + } else { + cVGUI.iR = 255; + cVGUI.iG = 170; + cVGUI.iB = 0; + cvar_set( "vgui_color", "255 170 0" ); + } + + fCheck = tokenize( cvar_string( "con_color" ) ); + if ( fCheck == 3 ) { + cCon.iR = stof( argv( 0 ) ); + cCon.iG = stof( argv( 1 ) ); + cCon.iB = stof( argv( 2 ) ); + } else { + cCon.iR = 255; + cCon.iG = 170; + cCon.iB = 0; + cvar_set( "con_color", "255 170 0" ); + } + iFirst = 0; } Object_Label( '196 148', _("PLAYER_NICK"), '8 8' ); Object_Textfield( '196 160', strPlayername, 16 ); + + Object_Label( '196 200', _("PLAYER_CROSSCOLOR"), '8 8' ); + Object_ScrollbarH( '196 212', 255, cCross.iR ); + Object_ScrollbarH( '196 230', 255, cCross.iG ); + Object_ScrollbarH( '196 248', 255, cCross.iB ); + Object_Frame( '468 388', '52 52' ); + drawfill( vMenuOffset + '469 213', '50 50', [ cCross.iR / 255, cCross.iG / 255, cCross.iB / 255 ], 1.0f ); + + Object_Label( '196 288', _("PLAYER_GUICOLOR"), '8 8' ); + Object_ScrollbarH( '196 300', 255, cVGUI.iR ); + Object_ScrollbarH( '196 318', 255, cVGUI.iG ); + Object_ScrollbarH( '196 336', 255, cVGUI.iB ); + Object_Frame( '468 388', '52 52' ); + drawfill( vMenuOffset + '469 300', '50 50', [ cVGUI.iR / 255, cVGUI.iG / 255, cVGUI.iB / 255 ], 1.0f ); + + Object_Label( '196 376', _("PLAYER_HUDCOLOR"), '8 8' ); + Object_ScrollbarH( '196 388', 255, cCon.iR ); + Object_ScrollbarH( '196 406', 255, cCon.iG ); + Object_ScrollbarH( '196 424', 255, cCon.iB ); + Object_Frame( '468 388', '52 52' ); + drawfill( vMenuOffset + '469 388', '50 50', [ cCon.iR / 255, cCon.iG / 255, cCon.iB / 255 ], 1.0f ); + Object_Button( '32 148', BTN_OK, Player_OK, fButtonAlpha[0] ); Object_Button( '32 180', BTN_CANCEL, Menu_Configuration_ButtonCancel, fButtonAlpha[1] ); } diff --git a/Source/Menu/Objects.c b/Source/Menu/Objects.c index 74366aea..93c0542a 100644 --- a/Source/Menu/Objects.c +++ b/Source/Menu/Objects.c @@ -227,27 +227,26 @@ void Object_ScrollbarH( vector vPosition, int iWidth, __inout int iProgress ) { vPosition += vMenuOffset; - if ( ( iScrollbarHold == TRUE ) || ( Menu_InputCheckMouse( [vPosition_x + iProgress, vPosition_y ], '16 16' ) == TRUE ) ) { + if ( ( Menu_InputCheckMouse( [vPosition_x, vPosition_y ], [ iWidth, 16 ] ) == TRUE ) ) { if ( fMouseClick == TRUE ) { iProgress = ( vMousePos_x - vPosition_x ); - iScrollbarHold = TRUE; } + + if ( fScrollWheel == SCROLL_DOWN ) { + iProgress += 2; + fScrollWheel = SCROLL_NONE; + } else if ( fScrollWheel == SCROLL_UP ) { + iProgress -= 2; + fScrollWheel = SCROLL_NONE; + } + + if ( iProgress < 0 ) { + iProgress = 0; + } else if ( iProgress > iWidth ) { + iProgress = iWidth; + } } - - if ( fScrollWheel == SCROLL_DOWN ) { - iProgress += 2; - fScrollWheel = SCROLL_NONE; - } else if ( fScrollWheel == SCROLL_UP ) { - iProgress -= 2; - fScrollWheel = SCROLL_NONE; - } - - if ( iProgress < 0 ) { - iProgress = 0; - } else if ( iProgress > iWidth ) { - iProgress = iWidth; - } - + drawfill( [ vPosition_x + iProgress, vPosition_y ], [ 16, 16 ], autocvar_menu_fgcolor, 1.0f ); } diff --git a/Source/Server/Main.c b/Source/Server/Main.c index b4484207..42d82605 100755 --- a/Source/Server/Main.c +++ b/Source/Server/Main.c @@ -30,6 +30,8 @@ void SV_SendChat( entity eSender, string sMessage, entity eEnt, float fType ) { WriteString( MSG_MULTICAST, sMessage ); msg_entity = eEnt; multicast( '0 0 0', MULTICAST_ONE ); + + localcmd( sprintf( "echo %s: %s\n", eSender.netname, sMessage ) ); } /* diff --git a/Source/Server/Player.c b/Source/Server/Player.c index a41efbeb..12ba3f9e 100755 --- a/Source/Server/Player.c +++ b/Source/Server/Player.c @@ -261,7 +261,7 @@ void Player_UseDown( void ) { traceline ( vSource, vSource + ( v_forward * 64 ), FALSE, self); if ( trace_ent.iUsable ) { - if ( ( trace_ent.weapon == WEAPON_C4BOMB ) && ( trace_ent.classname != "func_pushable" ) ) { + if ( ( trace_ent.classname != "c4bomb" ) && ( trace_ent.classname != "func_pushable" ) ) { self.flags = ( self.flags - FL_USERELEASED ); sound( self, CHAN_ITEM, "common/wpn_select.wav", 0.25, ATTN_IDLE ); } diff --git a/Source/Server/Rules.c b/Source/Server/Rules.c index 1750dc2c..1ab9bf8b 100755 --- a/Source/Server/Rules.c +++ b/Source/Server/Rules.c @@ -106,6 +106,11 @@ void Rules_Restart( void ) { remove( eFind ); } + // Find the bombs. Destory them! + for ( entity eFind = world; ( eFind = find( eFind, classname, "c4bomb" ) ); ) { + remove( eFind ); + } + // Select a random Terrorist for the bomb, if needed if ( iBombZones > 0 ) { int iRandomT = floor( random( 1, (float)iAlivePlayers_T + 1 ) ); diff --git a/Source/Shared/WeaponC4Bomb.c b/Source/Shared/WeaponC4Bomb.c index 5debfa23..8d850a45 100755 --- a/Source/Shared/WeaponC4Bomb.c +++ b/Source/Shared/WeaponC4Bomb.c @@ -64,9 +64,11 @@ var float fBeepTime; // Used for the beeping sounds that last 1.5 seconds var float fDefuseProgress; // Used to track... the progress static void WeaponC4BOMB_Use( void ) { - /*if ( eActivator.team != TEAM_CT ) { - return; - }*/ + if ( cvar( "developer" ) == 0 ) { + if ( eActivator.team != TEAM_CT ) { + return; + } + } // On first use, play defusing sound if ( self.eUser == world ) { @@ -93,8 +95,7 @@ static void WeaponC4BOMB_Use( void ) { fDefuseProgress += 0.01; } - eActivator.fProgressBar = (fDefuseProgress * 0.1); - self.fProgressBar = time + 1.0f; + eActivator.fProgressBar = fDefuseProgress * 0.1; // Make sure WeaponC4BOMB_Think knows who the user is self.eUser = eActivator; @@ -103,11 +104,9 @@ static void WeaponC4BOMB_Use( void ) { static void WeaponC4BOMB_Think( void ) { // If the guy who started using us stopped using us, reset the defuser counter if ( ( self.eUser != world ) && ( self.eUser.button6 == FALSE ) ) { - if ( self.fProgressBar < time ) { - self.eUser.fProgressBar = 0; - self.eUser = world; - fDefuseProgress = 0; - } + self.eUser.fProgressBar = 0; + self.eUser = world; + fDefuseProgress = 0; } // If our time has passed, explode @@ -163,10 +162,9 @@ static void WeaponC4BOMB_Think( void ) { void WeaponC4BOMB_Drop( vector vBombPos ) { // Do all the dirty entspawning stuff entity eBomb = spawn(); - eBomb.classname = "remove_me"; + eBomb.classname = "c4bomb"; eBomb.solid = SOLID_BBOX; - eBomb.weapon = WEAPON_C4BOMB; setmodel( eBomb, "models/w_c4.mdl" ); setorigin( eBomb, vBombPos ); setsize( eBomb, '-6 -6 0', '6 6 6' ); diff --git a/Source/Shared/Weapons.c b/Source/Shared/Weapons.c index 41e4336f..5b87a99e 100755 --- a/Source/Shared/Weapons.c +++ b/Source/Shared/Weapons.c @@ -132,7 +132,7 @@ void Weapon_PrimaryAttack( float fWeapon ) { return; #endif #ifdef CSQC - if ( fWeaponEventPlayer != player_localentnum ) { + if ( fWeaponEventPlayer != player_localentnum || autocvar_cl_thirdperson == TRUE ) { entity ono = findfloat( world, entnum, fWeaponEventPlayer ); if ( ono != __NULL__ ) { Animation_ShootWeapon( ono ); @@ -156,7 +156,7 @@ void Weapon_SecondaryAttack( float fWeapon ) { } #endif #ifdef CSQC - if ( fWeaponEventPlayer != player_localentnum ) { + if ( fWeaponEventPlayer != player_localentnum || autocvar_cl_thirdperson == TRUE ) { return; } #endif @@ -175,7 +175,7 @@ void Weapon_Reload( float fWeapon ) { } #endif #ifdef CSQC - if ( fWeaponEventPlayer != player_localentnum ) { + if ( fWeaponEventPlayer != player_localentnum || autocvar_cl_thirdperson == TRUE ) { entity ono = findfloat( world, entnum, fWeaponEventPlayer ); if ( ono != __NULL__ ) { Animation_ReloadWeapon( ono ); diff --git a/freecs/csprogs.dat b/freecs/csprogs.dat index 69b2421b..ec4b5c22 100644 Binary files a/freecs/csprogs.dat and b/freecs/csprogs.dat differ diff --git a/freecs/menu.dat b/freecs/menu.dat index 4821c62c..d586fdbc 100755 Binary files a/freecs/menu.dat and b/freecs/menu.dat differ diff --git a/freecs/menu.dat.de.po b/freecs/menu.dat.de.po index 2e4e699f..5c79f6a2 100755 --- a/freecs/menu.dat.de.po +++ b/freecs/menu.dat.de.po @@ -39,4 +39,13 @@ msgid "AUDIO_MASTER" msgstr "Lautstaerke:" msgid "VIDEO_RES" -msgstr "Aufloesung:" \ No newline at end of file +msgstr "Aufloesung:" + +msgid "PLAYER_CROSSCOLOR" +msgstr "Fadenkreuz Farbe:" + +msgid "PLAYER_GUICOLOR" +msgstr "UI Farbe:" + +msgid "PLAYER_HUDCOLOR" +msgstr "Heads-Up-Display Farbe:" \ No newline at end of file diff --git a/freecs/menu.dat.en.po b/freecs/menu.dat.en.po index 084e0725..f6719477 100755 --- a/freecs/menu.dat.en.po +++ b/freecs/menu.dat.en.po @@ -45,4 +45,13 @@ msgid "VIDEO_RESTARTMSG" msgstr "Some settings will require you to REFRESH your renderer. Please do so with the option on the left. " msgid "PLAYER_NICK" -msgstr "Nickname:" \ No newline at end of file +msgstr "Nickname:" + +msgid "PLAYER_CROSSCOLOR" +msgstr "Crosshair Color:" + +msgid "PLAYER_GUICOLOR" +msgstr "UI Color:" + +msgid "PLAYER_HUDCOLOR" +msgstr "Heads-Up-Display Color:" \ No newline at end of file diff --git a/freecs/progs.dat b/freecs/progs.dat index 602bdcea..6260cdf7 100644 Binary files a/freecs/progs.dat and b/freecs/progs.dat differ