diff --git a/base/strings/english_bfa.lang b/base/strings/english_bfa.lang index 1adffb12..110e6536 100644 --- a/base/strings/english_bfa.lang +++ b/base/strings/english_bfa.lang @@ -48,6 +48,8 @@ "#str_sapi" "Audio API" "#str_swf_xaudio" "XAudio 2" "#str_swf_openAL" "OpenAL-soft" + "#str_04102" "Always Run" + "#str_swf_only_MP" "Only MP" // "#str_swf_custom_game" "Mod Name" // "#str_swf_start_map" "First Map to load" } \ No newline at end of file diff --git a/base/strings/french_bfa.lang b/base/strings/french_bfa.lang index c5b2d50e..8a0935d3 100644 --- a/base/strings/french_bfa.lang +++ b/base/strings/french_bfa.lang @@ -48,6 +48,8 @@ "#str_sapi" "Audio API" "#str_swf_xaudio" "XAudio 2" "#str_swf_openAL" "OpenAL-soft" + "#str_04102" "Toujours exécuter" + "#str_swf_only_MP" "Seul MP" // "#str_swf_custom_game" "Nom du mod" // "#str_swf_start_map" "Première carte à charger" } \ No newline at end of file diff --git a/base/strings/german_bfa.lang b/base/strings/german_bfa.lang index 04a3f8c1..017b45e1 100644 --- a/base/strings/german_bfa.lang +++ b/base/strings/german_bfa.lang @@ -48,6 +48,8 @@ "#str_sapi" "Audio API" "#str_swf_xaudio" "XAudio 2" "#str_swf_openAL" "OpenAL-soft" + "#str_04102" "Immer ausführen" + "#str_swf_only_MP" "Nur MP" // "#str_swf_custom_game" "Mod Name" // "#str_swf_start_map" "Erste zu ladende Karte" } \ No newline at end of file diff --git a/base/strings/italian_bfa.lang b/base/strings/italian_bfa.lang index fc40b4aa..acb252f0 100644 --- a/base/strings/italian_bfa.lang +++ b/base/strings/italian_bfa.lang @@ -48,6 +48,8 @@ "#str_sapi" "Audio API" "#str_swf_xaudio" "XAudio 2" "#str_swf_openAL" "OpenAL-soft" + "#str_04102" "Corri sempre" + "#str_swf_only_MP" "Solo MP" // "#str_swf_custom_game" "Nome mod" // "#str_swf_start_map" "Prima mappa da caricare" } \ No newline at end of file diff --git a/base/strings/japanese_bfa.lang b/base/strings/japanese_bfa.lang index 724bca99..1a55b2e1 100644 --- a/base/strings/japanese_bfa.lang +++ b/base/strings/japanese_bfa.lang @@ -48,6 +48,8 @@ "#str_sapi" "オーディオ API" "#str_swf_xaudio" "XAudio 2" "#str_swf_openAL" "OpenAL-soft" + "#str_04102" "常に実行" + "#str_swf_only_MP" "MPのみ" // "#str_swf_custom_game" "Mod Name" // "#str_swf_start_map" "最初にロードするマップ" } \ No newline at end of file diff --git a/base/strings/spanish_bfa.lang b/base/strings/spanish_bfa.lang index 2241b4da..d8a9e194 100644 --- a/base/strings/spanish_bfa.lang +++ b/base/strings/spanish_bfa.lang @@ -48,6 +48,8 @@ "#str_sapi" "Audio API" "#str_swf_xaudio" "XAudio 2" "#str_swf_openAL" "OpenAL-soft" + "#str_04102" "Ejecutar siempre" + "#str_swf_only_MP" "Sólo MP" // "#str_swf_custom_game" "Nombre del mod" // "#str_swf_start_map" "Primer mapa para cargar" } diff --git a/neo/d3xp/Player.cpp b/neo/d3xp/Player.cpp index fed4e825..55177e0a 100644 --- a/neo/d3xp/Player.cpp +++ b/neo/d3xp/Player.cpp @@ -61,6 +61,7 @@ idCVar pm_clientAuthoritative_minSpeedSquared( "pm_clientAuthoritative_minSpeedS //GK: Internal CVar in order to keep track on whenever the character is flipped or not idCVar pm_flip("pm_flip", "0", CVAR_BOOL, ""); idCVar pm_smartHUD("pm_smartHUD", "0", CVAR_BOOL | CVAR_ARCHIVE | CVAR_GAME, "Enable Smart HUD functionality"); +idCVar pm_alwaysRun("pm_alwaysRun", "0", CVAR_INTEGER | CVAR_GAME | CVAR_ROM, "Used to check if in_alwaysRun has changed value"); extern idCVar pm_classicPose; @@ -1878,8 +1879,9 @@ void idPlayer::Init() } // disable stamina on hell levels - if( gameLocal.world && gameLocal.world->spawnArgs.GetBool( "no_stamina" ) ) + if(( gameLocal.world && gameLocal.world->spawnArgs.GetBool( "no_stamina" ) ) || cvarSystem->GetCVarBool("in_alwaysRun")) { + pm_staminaBackup.SetFloat(pm_stamina.GetFloat()); pm_stamina.SetFloat( 0.0f ); } @@ -2881,6 +2883,7 @@ void idPlayer::Restore( idRestoreGame* savefile ) savefile->ReadFloat( set ); pm_stamina.SetFloat( set ); + pm_staminaBackup.SetFloat(pm_stamina.GetFloat()); // create combat collision hull for exact collision detection SetCombatModel(); @@ -3831,6 +3834,13 @@ void idPlayer::UpdateConditions() AI_RUN = ( usercmd.buttons & BUTTON_RUN ) && ( ( !pm_stamina.GetFloat() ) || ( stamina > pm_staminathreshold.GetFloat() ) ); AI_DEAD = ( health <= 0 ); + + if (cvarSystem->GetCVarInteger("in_alwaysRun") != pm_alwaysRun.GetInteger()) { + pm_alwaysRun.SetInteger(cvarSystem->GetCVarInteger("in_alwaysRun")); + pm_stamina.SetFloat(cvarSystem->GetCVarInteger("in_alwaysRun") == 1 || (cvarSystem->GetCVarInteger("in_alwaysRun") == 2 && common->IsMultiplayer()) ? 0.0f : pm_staminaBackup.GetFloat()); + stamina = pm_stamina.GetFloat(); + } + } /* diff --git a/neo/d3xp/gamesys/SysCvar.cpp b/neo/d3xp/gamesys/SysCvar.cpp index 2e919852..4de9729b 100644 --- a/neo/d3xp/gamesys/SysCvar.cpp +++ b/neo/d3xp/gamesys/SysCvar.cpp @@ -243,6 +243,7 @@ idCVar pm_usecylinder( "pm_usecylinder", "0", CVAR_GAME | CVAR_NETWORKSYN idCVar pm_minviewpitch( "pm_minviewpitch", "-89", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "amount player's view can look up (negative values are up)" ); idCVar pm_maxviewpitch( "pm_maxviewpitch", "89", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "amount player's view can look down" ); idCVar pm_stamina( "pm_stamina", "24", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "length of time player can run" ); +idCVar pm_staminaBackup( "pm_staminaBackup", "24", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "backup for pm_stamina"); idCVar pm_staminathreshold( "pm_staminathreshold", "45", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "when stamina drops below this value, player gradually slows to a walk" ); idCVar pm_staminarate( "pm_staminarate", "0.75", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "rate that player regains stamina. divide pm_stamina by this value to determine how long it takes to fully recharge." ); idCVar pm_crouchheight( "pm_crouchheight", "38", CVAR_GAME | CVAR_NETWORKSYNC | CVAR_FLOAT, "height of player's bounding box while crouched" ); diff --git a/neo/d3xp/gamesys/SysCvar.h b/neo/d3xp/gamesys/SysCvar.h index ca258325..d44d8f73 100644 --- a/neo/d3xp/gamesys/SysCvar.h +++ b/neo/d3xp/gamesys/SysCvar.h @@ -173,6 +173,7 @@ extern idCVar pm_usecylinder; extern idCVar pm_minviewpitch; extern idCVar pm_maxviewpitch; extern idCVar pm_stamina; +extern idCVar pm_staminaBackup; extern idCVar pm_staminathreshold; extern idCVar pm_staminarate; extern idCVar pm_crouchheight; diff --git a/neo/d3xp/menus/MenuScreen.h b/neo/d3xp/menus/MenuScreen.h index caf4d199..94d17cf6 100644 --- a/neo/d3xp/menus/MenuScreen.h +++ b/neo/d3xp/menus/MenuScreen.h @@ -1043,12 +1043,13 @@ class idMenuScreen_Shell_GameOptions : public idMenuScreen virtual bool IsDataChanged() const; // retrieves a particular field for reading or updating - virtual idSWFScriptVar GetField( const int fieldIndex ) const + virtual idSWFScriptVar GetField(const int fieldIndex) const;/* { return fields[ fieldIndex ]; - } + }*/ virtual void AdjustField( const int fieldIndex, const int adjustAmount ); + virtual int AdjustOption(int currentValue, const int values[], int numValues, int adjustment); private: idStaticList< idSWFScriptVar, MAX_GAME_FIELDS > fields; diff --git a/neo/d3xp/menus/MenuScreen_HUD.cpp b/neo/d3xp/menus/MenuScreen_HUD.cpp index 5398e691..74e489d7 100644 --- a/neo/d3xp/menus/MenuScreen_HUD.cpp +++ b/neo/d3xp/menus/MenuScreen_HUD.cpp @@ -25,14 +25,17 @@ If you have questions concerning this license or the applicable additional terms =========================================================================== */ -#pragma hdrstop + #include "precompiled.h" +#pragma hdrstop #include "../Game_local.h" //extern idCVar pm_stamina; //extern idCVar flashlight_batteryDrainTimeMS; +extern idCVar in_alwaysRun; + /* ======================== idMenuScreen_HUD::Initialize @@ -330,7 +333,7 @@ void idMenuScreen_HUDLocal::UpdateStamina( idPlayer* player ) if( stamSprite != NULL ) { - if( common->IsMultiplayer() ) + if( common->IsMultiplayer() || in_alwaysRun.GetInteger() == 1) { stamSprite->SetVisible( false ); } diff --git a/neo/d3xp/menus/MenuScreen_Shell_GameOptions.cpp b/neo/d3xp/menus/MenuScreen_Shell_GameOptions.cpp index 764bf9a0..ed652b0e 100644 --- a/neo/d3xp/menus/MenuScreen_Shell_GameOptions.cpp +++ b/neo/d3xp/menus/MenuScreen_Shell_GameOptions.cpp @@ -111,7 +111,7 @@ void idMenuScreen_Shell_GameOptions::Initialize( idMenuHandler* data ) options->AddChild( control ); control = new( TAG_SWF ) idMenuWidget_ControlButton(); - control->SetOptionType( OPTION_SLIDER_TOGGLE ); + control->SetOptionType( OPTION_SLIDER_TEXT ); control->SetLabel( "#str_04102" ); // Always Run control->SetDataSource( &systemData, idMenuDataSource_GameSettings::GAME_FIELD_ALWAYS_SPRINT ); control->SetupEvents( DEFAULT_REPEAT_TIME, options->GetChildren().Num() ); @@ -339,7 +339,7 @@ void idMenuScreen_Shell_GameOptions::idMenuDataSource_GameSettings::LoadData() fields[ GAME_FIELD_AUTO_SWITCH ].SetBool( ui_autoSwitch.GetBool() ); fields[ GAME_FIELD_AUTO_RELOAD ].SetBool( ui_autoReload.GetBool() ); fields[ GAME_FIELD_AIM_ASSIST ].SetBool(game->GetCVarBool("aa_targetAimAssistEnable") ); - fields[ GAME_FIELD_ALWAYS_SPRINT ].SetBool( in_alwaysRun.GetBool() ); + fields[ GAME_FIELD_ALWAYS_SPRINT ].SetInteger( in_alwaysRun.GetInteger() ); fields[ GAME_FIELD_FLASHLIGHT_SHADOWS ].SetBool(game->GetCVarBool("g_weaponShadows") ); fields[ GAME_FIELD_MUZZLE_FLASHES ].SetBool(game->GetCVarBool("g_muzzleFlash") ); originalFields = fields; @@ -360,7 +360,7 @@ void idMenuScreen_Shell_GameOptions::idMenuDataSource_GameSettings::CommitData() ui_autoSwitch.SetBool( fields[ GAME_FIELD_AUTO_SWITCH ].ToBool() ); ui_autoReload.SetBool( fields[ GAME_FIELD_AUTO_RELOAD ].ToBool() ); game->SetCVarBool("aa_targetAimAssistEnable", fields[ GAME_FIELD_AIM_ASSIST ].ToBool() ); - in_alwaysRun.SetBool( fields[ GAME_FIELD_ALWAYS_SPRINT ].ToBool() ); + in_alwaysRun.SetInteger( fields[ GAME_FIELD_ALWAYS_SPRINT ].ToInteger() ); game->SetCVarBool("g_weaponShadows", fields[ GAME_FIELD_FLASHLIGHT_SHADOWS ].ToBool() ); game->SetCVarBool("g_muzzleFlash", fields[ GAME_FIELD_MUZZLE_FLASHES ].ToBool() ); @@ -377,13 +377,55 @@ idMenuScreen_Shell_GameOptions::idMenuDataSource_AudioSettings::AdjustField */ void idMenuScreen_Shell_GameOptions::idMenuDataSource_GameSettings::AdjustField( const int fieldIndex, const int adjustAmount ) { - if( fieldIndex == GAME_FIELD_FOV ) + const int sprintValues[3] = { 0, 1, 2 }; + switch (fieldIndex) { + case GAME_FIELD_FOV: + fields[fieldIndex].SetInteger(idMath::ClampInt(MIN_FOV, MAX_FOV, fields[fieldIndex].ToInteger() + adjustAmount * 5)); + break; + case GAME_FIELD_ALWAYS_SPRINT: + fields[fieldIndex].SetInteger(AdjustOption(fields[fieldIndex].ToInteger(), sprintValues, 3, adjustAmount)); + break; + default: + fields[fieldIndex].SetBool(!fields[fieldIndex].ToBool()); + } +} + +int idMenuScreen_Shell_GameOptions::idMenuDataSource_GameSettings::AdjustOption(int currentValue, const int values[], int numValues, int adjustment) +{ + int index = 0; + for (int i = 0; i < numValues; i++) { - fields[ fieldIndex ].SetInteger( idMath::ClampInt( MIN_FOV, MAX_FOV, fields[ fieldIndex ].ToInteger() + adjustAmount * 5 ) ); + if (currentValue == values[i]) + { + index = i; + break; + } } - else + index += adjustment; + while (index < 0) { - fields[ fieldIndex ].SetBool( !fields[ fieldIndex ].ToBool() ); + index += numValues; + } + index %= numValues; + return values[index]; +} + +/* +======================== +idMenuScreen_Shell_GameOptions::idMenuDataSource_AudioSettings::AdjustField +======================== +*/ +idSWFScriptVar idMenuScreen_Shell_GameOptions::idMenuDataSource_GameSettings::GetField(const int fieldIndex) const +{ + idList sprintValues { + idStr("#str_swf_disabled"), + idStr("#str_swf_enabled"), + idStr("#str_swf_only_MP") + }; + if (fieldIndex == GAME_FIELD_ALWAYS_SPRINT) { + return sprintValues[fields[fieldIndex].ToInteger()].c_str(); + } else { + return fields[fieldIndex]; } } @@ -420,7 +462,7 @@ bool idMenuScreen_Shell_GameOptions::idMenuDataSource_GameSettings::IsDataChange return true; } - if( fields[ GAME_FIELD_ALWAYS_SPRINT ].ToBool() != originalFields[ GAME_FIELD_ALWAYS_SPRINT ].ToBool() ) + if( fields[ GAME_FIELD_ALWAYS_SPRINT ].ToInteger() != originalFields[ GAME_FIELD_ALWAYS_SPRINT ].ToInteger() ) { return true; } diff --git a/neo/framework/UsercmdGen.cpp b/neo/framework/UsercmdGen.cpp index a08e8f8f..5fcb60e4 100644 --- a/neo/framework/UsercmdGen.cpp +++ b/neo/framework/UsercmdGen.cpp @@ -46,7 +46,7 @@ idCVar joy_dampenLook( "joy_dampenLook", "1", CVAR_BOOL | CVAR_ARCHIVE, "Do not idCVar joy_deltaPerMSLook( "joy_deltaPerMSLook", "0.003", CVAR_FLOAT | CVAR_ARCHIVE, "Max amount to be added on look per MS" ); idCVar in_mouseSpeed( "in_mouseSpeed", "1", CVAR_ARCHIVE | CVAR_FLOAT, "speed at which the mouse moves", 0.25f, 4.0f ); -idCVar in_alwaysRun( "in_alwaysRun", "1", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "always run (reverse _speed button) - only in MP" ); +idCVar in_alwaysRun( "in_alwaysRun", "2", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_INTEGER, "always run (reverse _speed button) 1- Both SP And MP 2- only in MP", 0, 2 ); //GK: in_alwaysRunCl idCVar in_alwaysRunCl("in_alwaysRunCl", "0", CVAR_SYSTEM | CVAR_ARCHIVE | CVAR_BOOL, "always run (reverse _speed button) - only in Classic"); //GK End @@ -451,7 +451,7 @@ void idUsercmdGenLocal::AdjustAngles() { float speed = MS2SEC( 16 ); - if( toggled_run.on || ( in_alwaysRun.GetBool() && common->IsMultiplayer() ) ) + if( toggled_run.on || in_alwaysRun.GetInteger() == 1 || (in_alwaysRun.GetInteger() == 2 && common->IsMultiplayer() ) ) { speed *= in_angleSpeedKey.GetFloat(); } @@ -1108,7 +1108,7 @@ void idUsercmdGenLocal::CmdButtons() } // check the run button - if( toggled_run.on || ( in_alwaysRun.GetBool() && common->IsMultiplayer() ) ) + if( toggled_run.on || in_alwaysRun.GetInteger() == 1 || (in_alwaysRun.GetInteger() == 2 && common->IsMultiplayer())) { cmd.buttons |= BUTTON_RUN; } @@ -1153,7 +1153,7 @@ void idUsercmdGenLocal::InitCurrent() memset( &cmd, 0, sizeof( cmd ) ); cmd.impulseSequence = impulseSequence; cmd.impulse = impulse; - cmd.buttons |= ( in_alwaysRun.GetBool() && common->IsMultiplayer() ) ? BUTTON_RUN : 0; + cmd.buttons |= ( in_alwaysRun.GetInteger() == 1 || (in_alwaysRun.GetInteger() == 2 && common->IsMultiplayer())) ? BUTTON_RUN : 0; } /* @@ -1227,7 +1227,7 @@ void idUsercmdGenLocal::MakeCurrent() // update toggled key states toggled_crouch.SetKeyState(ButtonState(UB_MOVEDOWN), in_toggleCrouch.GetBool()); - toggled_run.SetKeyState(ButtonState(UB_SPEED), in_toggleRun.GetBool() && common->IsMultiplayer()); + toggled_run.SetKeyState(ButtonState(UB_SPEED), in_toggleRun.GetBool()); toggled_zoom.SetKeyState(ButtonState(UB_ZOOM), in_toggleZoom.GetBool()); // get basic movement from mouse