diff --git a/sp/game/firefightreloaded/batch/steam_copy.bat b/sp/game/firefightreloaded/batch/steam_copy.bat index 518d524b7..e5260dd41 100644 --- a/sp/game/firefightreloaded/batch/steam_copy.bat +++ b/sp/game/firefightreloaded/batch/steam_copy.bat @@ -27,6 +27,8 @@ XCOPY /E "%CD%\gamepadui" "%gamepaduidir%" /sy XCOPY "%CD%\gameinfo.txt" "%basedir%" /y XCOPY "%CD%\steam.inf" "%basedir%" /y XCOPY "%CD%\version.txt" "%basedir%" /y +XCOPY "%CD%\firefightreloaded_pak_000.vpk" "%basedir%" /y +XCOPY "%CD%\firefightreloaded_pak_dir.vpk" "%basedir%" /y echo. echo Moving game data to release folder... diff --git a/sp/game/firefightreloaded/gameinfo.txt b/sp/game/firefightreloaded/gameinfo.txt index 36e463147..8ebea9250 100644 --- a/sp/game/firefightreloaded/gameinfo.txt +++ b/sp/game/firefightreloaded/gameinfo.txt @@ -1,10 +1,10 @@ "GameInfo" { game "FIREFIGHT RELOADED" - logo "FIREFIGHT RELOADED" - logo2 "" title "" title2 "" + gamepadui_title "FIREFIGHT RELOADED" + gamepadui_title2 "" type singleplayer_only supportsvr 0 developer "Bitl Development Studios" diff --git a/sp/game/firefightreloaded/gamepadui/mainmenu.res b/sp/game/firefightreloaded/gamepadui/mainmenu.res index 410e95ba8..a00b3afcb 100644 --- a/sp/game/firefightreloaded/gamepadui/mainmenu.res +++ b/sp/game/firefightreloaded/gamepadui/mainmenu.res @@ -4,15 +4,15 @@ { "text" "#GameUI_GameMenu_ResumeGame" "command" "cmd gamemenucommand resumegame" - "priority" "7" + "priority" "10" "family" "ingame" } "NewGame" { "text" "#GameUI_GameMenu_NewGame" - "command" "cmd gamepadui_opennewgamedialog" - "priority" "6" + "command" "cmd createnewgame" + "priority" "9" "family" "all" } @@ -20,7 +20,7 @@ { "text" "#GameUI_GameMenu_SaveGame" "command" "cmd gamepadui_opensavegamedialog" - "priority" "5" + "priority" "8" "family" "ingame" } @@ -28,7 +28,7 @@ { "text" "#GameUI_GameMenu_LoadGame" "command" "cmd gamepadui_openloadgamedialog" - "priority" "4" + "priority" "7" "family" "all" } @@ -36,6 +36,30 @@ { "text" "#GameUI_GameMenu_Options" "command" "cmd gamepadui_openoptionsdialog" + "priority" "6" + "family" "all" + } + + "ModelOptions" + { + "text" "#FRMP_PlayerModel_Title" + "command" "cmd playermodeldialog" + "priority" "5" + "family" "all" + } + + "SpawnlistOptions" + { + "text" "#FR_Spawnlist_Title" + "command" "cmd spawnlistdialog" + "priority" "4" + "family" "all" + } + + "OpenWorkshop" + { + "text" "#FIREFIGHTRELOADED_ModMenu_Title" + "command" "cmd showworkshop" "priority" "3" "family" "all" } diff --git a/sp/game/firefightreloaded/gamepadui/options.res b/sp/game/firefightreloaded/gamepadui/options.res index ada724e7d..5d0774da5 100644 --- a/sp/game/firefightreloaded/gamepadui/options.res +++ b/sp/game/firefightreloaded/gamepadui/options.res @@ -39,7 +39,7 @@ "text" "#GameUI_VeryHard" "description" "#GameUI_VeryHardDescription" "type" "skillyskill" - "image" "gamepadui/hard" + "image" "gamepadui/veryhard" "skill" "3" } @@ -48,7 +48,7 @@ "text" "#GameUI_Nightmare" "description" "#GameUI_NightmareDescription" "type" "skillyskill" - "image" "gamepadui/hard" + "image" "gamepadui/nightmare" "skill" "4" } } @@ -199,6 +199,20 @@ "advanced" "1" } + "Console" + { + "text" "#GameUI_DeveloperConsoleCheck" + "type" "wheelywheel" + "advanced" "1" + "convar" "con_enable" + + "options" + { + "0" "#gameui_disabled" + "1" "#gameui_enabled" + } + } + "OldSpawner" { "text" "#FR_OldSpawner" @@ -829,27 +843,6 @@ "advanced" "1" "convar" "mat_force_bloom" - "options" - { - "0" "#gameui_disabled" - "1" "#gameui_enabled" - } - } - } - } - "Advanced" - { - "title" "#GameUI_AdvancedNoEllipsis" - "alternating" "1" - "items" - { - "Console" - { - "text" "#GameUI_DeveloperConsoleCheck" - "type" "wheelywheel" - "advanced" "1" - "convar" "con_enable" - "options" { "0" "#gameui_disabled" diff --git a/sp/game/firefightreloaded/gamepadui/schemeachievement.res b/sp/game/firefightreloaded/gamepadui/schemeachievement.res index ecdf24c16..db44bd672 100644 --- a/sp/game/firefightreloaded/gamepadui/schemeachievement.res +++ b/sp/game/firefightreloaded/gamepadui/schemeachievement.res @@ -44,8 +44,8 @@ "Button.Background.Out" "0 0 0 0" "Button.Background.Over" "255 255 255 255" "Button.Background.Pressed" "255 255 255 255" - "Button.Background.Progress" "255 152 46 255" - "Button.Background.Unprogress" "152 152 152 255" + "Button.Background.Progress" "19 119 230 255" + "Button.Background.Unprogress" "255 255 255 255" "Button.Text.Out" "255 255 255 255" "Button.Text.Over" "0 0 0 255" @@ -94,7 +94,8 @@ "CustomFontFiles" { - "file" "gamepadui/fonts/NotoSans-Regular.ttf" + "file" "resource/smodgui.ttf" "file" "gamepadui/fonts/din1451alt.ttf" + "file" "gamepadui/fonts/NotoSans-Regular.ttf" } } \ No newline at end of file diff --git a/sp/game/firefightreloaded/gamepadui/schemechapterbutton.res b/sp/game/firefightreloaded/gamepadui/schemechapterbutton.res index d13ea719b..a569496e9 100644 --- a/sp/game/firefightreloaded/gamepadui/schemechapterbutton.res +++ b/sp/game/firefightreloaded/gamepadui/schemechapterbutton.res @@ -59,7 +59,7 @@ { "settings" { - "name" "Alte DIN 1451 Mittelschrift" + "name" "SMODGUI" "tall" "26" "weight" "400" "antialias" "1" @@ -80,6 +80,7 @@ "CustomFontFiles" { + "file" "resource/smodgui.ttf" "file" "gamepadui/fonts/NotoSans-Regular.ttf" "file" "gamepadui/fonts/din1451alt.ttf" } diff --git a/sp/game/firefightreloaded/gamepadui/schememainmenu.res b/sp/game/firefightreloaded/gamepadui/schememainmenu.res index e13916af5..8ce79cccf 100644 --- a/sp/game/firefightreloaded/gamepadui/schememainmenu.res +++ b/sp/game/firefightreloaded/gamepadui/schememainmenu.res @@ -3,11 +3,11 @@ "BaseSettings" { "Logo.OffsetX" "85" - "Logo.OffsetY.MainMenu" "290" + "Logo.OffsetY.MainMenu" "340" "Logo.OffsetY.InGame" "340" "Buttons.OffsetX" "85" - "Buttons.OffsetY.MainMenu" "95" + "Buttons.OffsetY.MainMenu" "120" "Buttons.OffsetY.InGame" "70" "Buttons.Space" "6" @@ -15,9 +15,9 @@ "Button.Width.Over" "260" "Button.Width.Pressed" "260" - "Button.Height.Out" "30" - "Button.Height.Over" "36" - "Button.Height.Pressed" "36" + "Button.Height.Out" "20" + "Button.Height.Over" "26" + "Button.Height.Pressed" "26" "FooterButtons.OffsetX" "64" "FooterButtons.OffsetY" "48" @@ -41,28 +41,28 @@ "Button.Description.Hide.Over" "1" "Button.Description.Hide.Pressed" "1" - "Button.Text.OffsetX.Animation.Duration" "0.15" - "Button.Width.Animation.Duration" "0.15" - "Button.Height.Animation.Duration" "0.25" - "Button.Background.Animation.Duration" "0.2" - "Button.Text.Animation.Duration" "0.2" - "Button.Description.Animation.Duration" "0.5" + "Button.Text.OffsetX.Animation.Duration" "0.1" + "Button.Width.Animation.Duration" "0.1" + "Button.Height.Animation.Duration" "0.1" + "Button.Background.Animation.Duration" "0.1" + "Button.Text.Animation.Duration" "0.1" + "Button.Description.Animation.Duration" "0.1" } "Colors" { - "Logo" "255 255 255 255" + "Logo" "19 119 230 255" "Button.Background.Out" "0 0 0 0" - "Button.Background.Over" "25 13 5 120" + "Button.Background.Over" "15 25 40 110" "Button.Background.Pressed" "255 255 255 255" "Button.Background.LeftBorder.Out" "0 0 0 255" - "Button.Background.LeftBorder.Over" "255 134 44 255" + "Button.Background.LeftBorder.Over" "19 119 230 255" "Button.Background.LeftBorder.Pressed" "255 255 255 255" "Button.Text.Out" "227 224 224 255" - "Button.Text.Over" "255 134 44 255" + "Button.Text.Over" "19 119 230 255" "Button.Text.Pressed" "0 0 0 255" "Button.Description.Out" "0 0 0 0" @@ -76,9 +76,9 @@ { "settings" { - "name" "HalfLife2" - "tall" "34" - "weight" "400" + "name" "SMODGUI" + "tall" "50" + "weight" "200" "antialias" "1" } } @@ -88,7 +88,7 @@ "settings" { "name" "Alte DIN 1451 Mittelschrift" - "tall" "25" + "tall" "20" "weight" "400" "antialias" "1" } @@ -99,7 +99,7 @@ "settings" { "name" "Alte DIN 1451 Mittelschrift" - "tall" "25" + "tall" "20" "weight" "600" "antialias" "1" } @@ -108,7 +108,7 @@ "CustomFontFiles" { - "file" "resource/HALFLIFE2.ttf" + "file" "resource/smodgui.ttf" "file" "gamepadui/fonts/din1451alt.ttf" } } diff --git a/sp/game/firefightreloaded/gamepadui/schemeoptions_checkybox.res b/sp/game/firefightreloaded/gamepadui/schemeoptions_checkybox.res index d18b7095c..b3305b8e8 100644 --- a/sp/game/firefightreloaded/gamepadui/schemeoptions_checkybox.res +++ b/sp/game/firefightreloaded/gamepadui/schemeoptions_checkybox.res @@ -36,7 +36,7 @@ "Colors" { "Button.Background.Out" "0 0 0 0" - "Button.Background.Over" "255 255 255 255" + "Button.Background.Over" "255 255 255 180" "Button.Background.Pressed" "255 255 255 255" "Button.Text.Out" "255 255 255 150" diff --git a/sp/game/firefightreloaded/gamepadui/schemeoptions_skillyskill.res b/sp/game/firefightreloaded/gamepadui/schemeoptions_skillyskill.res index c03629809..e9540f2de 100644 --- a/sp/game/firefightreloaded/gamepadui/schemeoptions_skillyskill.res +++ b/sp/game/firefightreloaded/gamepadui/schemeoptions_skillyskill.res @@ -55,31 +55,31 @@ //"Button.Title.Background.Over" "255 134 44 255" //"Button.Title.Background.Pressed" "255 134 44 255" "Button.Title.Background.Over" "0 0 0 0" - "Button.Title.Background.Pressed" "25 13 5 120" + "Button.Title.Background.Pressed" "15 25 40 110" "Button.Description.Background.Out" "0 0 0 0" "Button.Description.Background.Over" "0 0 0 0" - "Button.Description.Background.Pressed" "25 13 5 120" + "Button.Description.Background.Pressed" "15 25 40 110" "Button.Background.BottomBorder.Out" "0 0 0 0" //"Button.Background.BottomBorder.Over" "255 134 44 255" //"Button.Background.BottomBorder.Pressed" "255 134 44 255" "Button.Background.BottomBorder.Over" "0 0 0 0" - "Button.Background.BottomBorder.Pressed" "255 152 46 255" + "Button.Background.BottomBorder.Pressed" "19 119 230 255" "Button.Text.Out" "255 255 255 150" //"Button.Text.Over" "255 255 255 255" //"Button.Text.Pressed" "255 255 255 255" "Button.Text.Over" "255 255 255 255" - "Button.Text.Pressed" "255 134 44 255" + "Button.Text.Pressed" "19 119 230 255" "Button.Description.Out" "0 0 0 0" "Button.Description.Over" "0 0 0 0" "Button.Description.Pressed" "255 255 255 255" - "Button.Image.Out" "50 50 50 220" - "Button.Image.Over" "110 110 110 200" + "Button.Image.Out" "100 100 100 220" + "Button.Image.Over" "150 150 150 220" "Button.Image.Pressed" "255 255 255 255" } @@ -101,7 +101,7 @@ "settings" { "name" "Noto Sans" - "tall" "17" + "tall" "15" "weight" "400" "antialias" "1" } @@ -110,7 +110,8 @@ "CustomFontFiles" { - "file" "gamepadui/fonts/NotoSans-Regular.ttf" + "file" "resource/smodgui.ttf" "file" "gamepadui/fonts/din1451alt.ttf" + "file" "gamepadui/fonts/NotoSans-Regular.ttf" } } \ No newline at end of file diff --git a/sp/game/firefightreloaded/gamepadui/schemeoptions_slideyslide.res b/sp/game/firefightreloaded/gamepadui/schemeoptions_slideyslide.res index 91e6afb34..0c05c18e2 100644 --- a/sp/game/firefightreloaded/gamepadui/schemeoptions_slideyslide.res +++ b/sp/game/firefightreloaded/gamepadui/schemeoptions_slideyslide.res @@ -22,7 +22,7 @@ "Colors" { "Button.Background.Out" "0 0 0 0" - "Button.Background.Over" "255 255 255 255" + "Button.Background.Over" "255 255 255 180" "Button.Background.Pressed" "255 255 255 255" "Button.Text.Out" "255 255 255 150" @@ -34,7 +34,7 @@ "Slider.Backing.Pressed" "0 0 0 140" "Slider.Fill.Out" "255 255 255 255" - "Slider.Fill.Over" "0 0 0 255" + "Slider.Fill.Over" "255 255 255 255" "Slider.Fill.Pressed" "0 0 0 255" } diff --git a/sp/game/firefightreloaded/gamepadui/schemeoptions_wheelywheel.res b/sp/game/firefightreloaded/gamepadui/schemeoptions_wheelywheel.res index de1b4154f..793264352 100644 --- a/sp/game/firefightreloaded/gamepadui/schemeoptions_wheelywheel.res +++ b/sp/game/firefightreloaded/gamepadui/schemeoptions_wheelywheel.res @@ -22,7 +22,7 @@ "Colors" { "Button.Background.Out" "0 0 0 0" - "Button.Background.Over" "255 255 255 255" + "Button.Background.Over" "255 255 255 180" "Button.Background.Pressed" "255 255 255 255" "Button.Binding" "0 0 0 255" diff --git a/sp/game/firefightreloaded/gamepadui/schemepanel.res b/sp/game/firefightreloaded/gamepadui/schemepanel.res index e1a1c7831..a6fd1dbec 100644 --- a/sp/game/firefightreloaded/gamepadui/schemepanel.res +++ b/sp/game/firefightreloaded/gamepadui/schemepanel.res @@ -73,11 +73,11 @@ "GenericConfirmation" "255 255 255 255" "Button.Background.Out" "0 0 0 0" - "Button.Background.Over" "255 255 255 3" + "Button.Background.Over" "255 255 255 180" "Button.Background.Pressed" "255 255 255 255" "Button.Text.Out" "255 255 255 150" - "Button.Text.Over" "255 255 255 255" + "Button.Text.Over" "0 0 0 255" "Button.Text.Pressed" "0 0 0 255" "Button.Description.Out" "0 0 0 0" @@ -156,6 +156,7 @@ "CustomFontFiles" { + "file" "resource/smodgui.ttf" "file" "gamepadui/fonts/NotoSans-Regular.ttf" "file" "gamepadui/fonts/din1451alt.ttf" } diff --git a/sp/game/firefightreloaded/gamepadui/schemesavebutton.res b/sp/game/firefightreloaded/gamepadui/schemesavebutton.res index 684004701..50005d33e 100644 --- a/sp/game/firefightreloaded/gamepadui/schemesavebutton.res +++ b/sp/game/firefightreloaded/gamepadui/schemesavebutton.res @@ -40,7 +40,7 @@ "Colors" { "Button.Background.Out" "0 0 0 0" - "Button.Background.Over" "255 255 255 255" + "Button.Background.Over" "255 255 255 180" "Button.Background.Pressed" "255 255 255 255" "Button.Text.Out" "255 255 255 255" diff --git a/sp/game/firefightreloaded/gamepadui/schemetab.res b/sp/game/firefightreloaded/gamepadui/schemetab.res index 2346c3a72..8304ab4cf 100644 --- a/sp/game/firefightreloaded/gamepadui/schemetab.res +++ b/sp/game/firefightreloaded/gamepadui/schemetab.res @@ -2,7 +2,6 @@ { "BaseSettings" { - "Button.Width.Out" "108" "Button.Width.Over" "108" "Button.Width.Pressed" "108" @@ -34,11 +33,11 @@ "Colors" { "Button.Background.Out" "0 0 0 0" - "Button.Background.Over" "255 255 255 3" + "Button.Background.Over" "255 255 255 180" "Button.Background.Pressed" "255 255 255 255" "Button.Text.Out" "255 255 255 150" - "Button.Text.Over" "255 255 255 255" + "Button.Text.Over" "0 0 0 255" "Button.Text.Pressed" "0 0 0 255" "Button.Description.Out" "0 0 0 0" @@ -54,7 +53,7 @@ { "name" "Alte DIN 1451 Mittelschrift" "tall" "20" - "weight" "400" + "weight" "200" "antialias" "1" } } @@ -62,6 +61,7 @@ "CustomFontFiles" { + "file" "resource/smodgui.ttf" "file" "gamepadui/fonts/din1451alt.ttf" } } \ No newline at end of file diff --git a/sp/src/game/client/firefightreloaded_clientcmds.cpp b/sp/src/game/client/firefightreloaded_clientcmds.cpp index ae43afe2e..e3e387b86 100644 --- a/sp/src/game/client/firefightreloaded_clientcmds.cpp +++ b/sp/src/game/client/firefightreloaded_clientcmds.cpp @@ -1,24 +1,19 @@ #include "cbase.h" -//#include #include "game/client/iviewport.h" +#include "tier3/tier3.h" +#include "vgui/ILocalize.h" +#include "fmtstr.h" +#if !defined(MOD_VER) && !defined( _X360 ) && !defined( NO_STEAM ) +#include "steam/steam_api.h" +#endif -/* -void OpenMessageBox(const CCommand &args) -{ - MessageBox *pMessageBox = new MessageBox(args[1], args[2]); - pMessageBox->DoModal(); -} - -ConCommand messagebox("messagebox", OpenMessageBox); -*/ - -void CC_ToggleIronSights(void) +CON_COMMAND(toggle_ironsight, "") { CBasePlayer* pPlayer = C_BasePlayer::GetLocalPlayer(); if (pPlayer == NULL) return; - CBaseCombatWeapon *pWeapon = pPlayer->GetActiveWeapon(); + CBaseCombatWeapon* pWeapon = pPlayer->GetActiveWeapon(); if (pWeapon == NULL) return; @@ -27,4 +22,14 @@ void CC_ToggleIronSights(void) engine->ServerCmd("toggle_ironsight"); //forward to server } -static ConCommand toggle_ironsight("toggle_ironsight", CC_ToggleIronSights); \ No newline at end of file +CON_COMMAND(showworkshop, "") +{ +#if !defined(MOD_VER) && !defined( _X360 ) && !defined( NO_STEAM ) + if (steamapicontext && steamapicontext->SteamFriends()) + { + char szWorkshopURL[1024]; + Q_snprintf(szWorkshopURL, sizeof(szWorkshopURL), "https://steamcommunity.com/app/%i/workshop/\n", engine->GetAppID()); + steamapicontext->SteamFriends()->ActivateGameOverlayToWebPage(szWorkshopURL); + } +#endif +} \ No newline at end of file diff --git a/sp/src/game/client/gameui/NewSingleplayerGameDialog.cpp b/sp/src/game/client/gameui/NewSingleplayerGameDialog.cpp index 38c517d20..91f0bb8dc 100644 --- a/sp/src/game/client/gameui/NewSingleplayerGameDialog.cpp +++ b/sp/src/game/client/gameui/NewSingleplayerGameDialog.cpp @@ -266,3 +266,9 @@ void CNewSingleplayerGameDialog::SetMap(const char *mapName) } } } + +CON_COMMAND(createnewgame, "") +{ + CNewSingleplayerGameDialog* pCNewSingleplayerGameDialog = new CNewSingleplayerGameDialog(NULL); + pCNewSingleplayerGameDialog->Activate(); +} diff --git a/sp/src/game/client/gameui/PlayerModelDialog.cpp b/sp/src/game/client/gameui/PlayerModelDialog.cpp index a07bcdf4f..0c4c09b21 100644 --- a/sp/src/game/client/gameui/PlayerModelDialog.cpp +++ b/sp/src/game/client/gameui/PlayerModelDialog.cpp @@ -185,3 +185,8 @@ void CPlayerModelDialog::SetModel(const char *name) } } +CON_COMMAND(playermodeldialog, "") +{ + CPlayerModelDialog* pCPlayerModelDialog = new CPlayerModelDialog(NULL); + pCPlayerModelDialog->Activate(); +} \ No newline at end of file diff --git a/sp/src/game/client/gameui/SpawnlistDialog.cpp b/sp/src/game/client/gameui/SpawnlistDialog.cpp index fa3feb12a..927879ab4 100644 --- a/sp/src/game/client/gameui/SpawnlistDialog.cpp +++ b/sp/src/game/client/gameui/SpawnlistDialog.cpp @@ -185,3 +185,8 @@ void CSpawnlistDialog::SetSpawnScript(const char *name) } } +CON_COMMAND(spawnlistdialog, "") +{ + CSpawnlistDialog* pCSpawnlistDialog = new CSpawnlistDialog(NULL); + pCSpawnlistDialog->Activate(); +} \ No newline at end of file diff --git a/sp/src/game/gamepadui/gamepadui_bonusmaps.cpp b/sp/src/game/gamepadui/gamepadui_bonusmaps.cpp new file mode 100644 index 000000000..61128bb2e --- /dev/null +++ b/sp/src/game/gamepadui/gamepadui_bonusmaps.cpp @@ -0,0 +1,715 @@ +#include "gamepadui_interface.h" +#include "gamepadui_image.h" +#include "gamepadui_util.h" +#include "gamepadui_frame.h" +#include "gamepadui_scroll.h" +#include "gamepadui_genericconfirmation.h" + +#include "ienginevgui.h" +#include "vgui/ILocalize.h" +#include "vgui/ISurface.h" +#include "vgui/IVGui.h" + +#include "vgui_controls/ComboBox.h" +#include "vgui_controls/ImagePanel.h" +#include "vgui_controls/ScrollBar.h" + +#include "KeyValues.h" +#include "filesystem.h" + +#include "tier0/memdbgon.h" + + +#if defined ( GAMEPADUI_ENABLE_BONUSMAPS ) // SDK2013 lacks the necessary files to compile this. (Madi) + +class GamepadUIBonusButton; + +#define GAMEPADUI_BONUS_SCHEME GAMEPADUI_RESOURCE_FOLDER "schemebonusbutton.res" + +ConVar gamepadui_selected_challenge("gamepadui_selected_challenge", "0", FCVAR_ARCHIVE); + +const char g_pszMedalNames[4][8] = +{ + "none", + "bronze", + "silver", + "gold" +}; + +void GetChallengeMedals( ChallengeDescription_t *pChallengeDescription, int &iBest, int &iEarnedMedal, int &iNext, int &iNextMedal ) +{ + iBest = pChallengeDescription->iBest; + + if ( iBest == -1 ) + iEarnedMedal = 0; + else if ( iBest <= pChallengeDescription->iGold ) + iEarnedMedal = 3; + else if ( iBest <= pChallengeDescription->iSilver ) + iEarnedMedal = 2; + else if ( iBest <= pChallengeDescription->iBronze ) + iEarnedMedal = 1; + else + iEarnedMedal = 0; + + iNext = -1; + + switch ( iEarnedMedal ) + { + case 0: + iNext = pChallengeDescription->iBronze; + iNextMedal = 1; + break; + case 1: + iNext = pChallengeDescription->iSilver; + iNextMedal = 2; + break; + case 2: + iNext = pChallengeDescription->iGold; + iNextMedal = 3; + break; + case 3: + iNext = -1; + iNextMedal = -1; + break; + } +} + +void CycleSelectedChallenge() +{ + int nChallenge = Clamp( gamepadui_selected_challenge.GetInt(), 0, 2 ); + nChallenge = ( nChallenge + 1 ) % 3; + gamepadui_selected_challenge.SetValue( nChallenge ); +} + +class GamepadUIBonusMapsPanel : public GamepadUIFrame +{ + DECLARE_CLASS_SIMPLE( GamepadUIBonusMapsPanel, GamepadUIFrame ); + +public: + GamepadUIBonusMapsPanel( vgui::Panel *pParent, const char* pPanelName ); + + void UpdateGradients(); + + void OnThink() OVERRIDE; + void OnCommand( char const* pCommand ) OVERRIDE; + + MESSAGE_FUNC_HANDLE( OnGamepadUIButtonNavigatedTo, "OnGamepadUIButtonNavigatedTo", button ); + + void BuildMapsList(); + void LayoutBonusButtons(); + void Paint() OVERRIDE; + void ApplySchemeSettings(vgui::IScheme* pScheme) OVERRIDE; + + void OnMouseWheeled( int delta ) OVERRIDE; + +private: + CUtlVector< GamepadUIBonusButton* > m_pBonusButtons; + CUtlVector< BonusMapDescription_t > m_Bonuses; + + GamepadUIScrollState m_ScrollState; + + GAMEPADUI_PANEL_PROPERTY( float, m_BonusOffsetX, "Bonus.OffsetX", "0", SchemeValueTypes::ProportionalFloat ); + GAMEPADUI_PANEL_PROPERTY( float, m_BonusOffsetY, "Bonus.OffsetY", "0", SchemeValueTypes::ProportionalFloat ); + GAMEPADUI_PANEL_PROPERTY( float, m_BonusSpacing, "Bonus.Spacing", "0", SchemeValueTypes::ProportionalFloat ); + + GAMEPADUI_PANEL_PROPERTY( float, m_flFooterMedalSize, "FooterMedal.Current.Size", "0", SchemeValueTypes::ProportionalFloat ); + GAMEPADUI_PANEL_PROPERTY( float, m_flFooterMedalNextSize, "FooterMedal.Next.Size", "0", SchemeValueTypes::ProportionalFloat ); + + vgui::HFont m_hGoalFont = vgui::INVALID_FONT; + + GamepadUIImage m_CachedMedals[2]; + char m_szCachedMedalNames[256][2]; +}; + +class GamepadUIBonusButton : public GamepadUIButton +{ +public: + DECLARE_CLASS_SIMPLE( GamepadUIBonusButton, GamepadUIButton ); + + GamepadUIBonusButton( vgui::Panel* pParent, vgui::Panel* pActionSignalTarget, const char* pSchemeFile, const char* pCommand, const char* pText, const char* pDescription, const char *pBonusImage ) + : BaseClass( pParent, pActionSignalTarget, pSchemeFile, pCommand, pText, pDescription ) + , m_Image( pBonusImage ) + , m_LockIcon( "gamepadui/lockylock" ) + { + bCompleted[0] = false; + bCompleted[1] = false; + bCompleted[2] = false; + } + + GamepadUIBonusButton( vgui::Panel* pParent, vgui::Panel* pActionSignalTarget, const char* pSchemeFile, const char* pCommand, const wchar* pText, const wchar* pDescription, const char *pBonusImage ) + : BaseClass( pParent, pActionSignalTarget, pSchemeFile, pCommand, pText, pDescription ) + , m_Image( pBonusImage ) + , m_LockIcon( "gamepadui/lockylock" ) + { + bCompleted[0] = false; + bCompleted[1] = false; + bCompleted[2] = false; + } + + ~GamepadUIBonusButton() + { + if ( s_pLastBonusButton == this ) + s_pLastBonusButton = NULL; + } + + ButtonState GetCurrentButtonState() OVERRIDE + { + if ( s_pLastBonusButton == this ) + return ButtonState::Over; + return BaseClass::GetCurrentButtonState(); + } + + void Paint() OVERRIDE + { + int x, y, w, t; + GetBounds( x, y, w, t ); + + PaintButton(); + + vgui::surface()->DrawSetColor( Color( 255, 255, 255, 255 ) ); + vgui::surface()->DrawSetTexture( m_Image ); + int imgH = ( w * 9 ) / 16; + //vgui::surface()->DrawTexturedRect( 0, 0, w, ); + float offset = m_flTextOffsetYAnimationValue[ButtonStates::Out] - m_flTextOffsetY; + vgui::surface()->DrawTexturedSubRect( 0, 0, w, w * 100 / 180, 0.0f, 0.0f, 1.0f * ( 180.0f / 256.0f ), ( ( imgH - offset ) / imgH ) * 100.0f / 128.0f ); + vgui::surface()->DrawSetTexture( 0 ); + if ( !IsEnabled() ) + { + vgui::surface()->DrawSetColor( Color( 255, 255, 255, 16 ) ); + vgui::surface()->DrawFilledRect( 0, 0, w, w * 100 / 180 ); + + vgui::surface()->DrawSetColor( m_colLock ); + vgui::surface()->DrawSetTexture( m_LockIcon ); + int nX = m_flWidth / 2 - m_flLockSize / 2; + int nY = imgH / 2 - m_flLockSize / 2; + vgui::surface()->DrawTexturedRect( nX, nY, nX + m_flLockSize, nY + m_flLockSize ); + } + + vgui::surface()->DrawSetColor( m_colProgressColor ); + vgui::surface()->DrawFilledRect( 0, (w * 100 / 180) - m_flProgressHeight, w * ( IsComplete() ? 1.0f : 0.0f), (w * 100 / 180)); + + PaintText(); + + int nChallenge = Clamp( gamepadui_selected_challenge.GetInt(), 0, 2 ); + if ( m_Medals[ nChallenge ].IsValid() ) + { + vgui::surface()->DrawSetColor( Color( 255, 255, 255, 255 ) ); + vgui::surface()->DrawSetTexture( m_Medals[ nChallenge ] ); + vgui::surface()->DrawTexturedRect( m_flMedalOffsetX, m_flMedalOffsetY, m_flMedalOffsetX + m_flMedalSize, m_flMedalOffsetY + m_flMedalSize ); + vgui::surface()->DrawSetTexture( 0 ); + } + } + + void NavigateTo() OVERRIDE + { + BaseClass::NavigateTo(); + s_pLastBonusButton = this; + } + + const BonusMapDescription_t& GetBonusMapDescription() const + { + return m_BonusMapDesc; + } + + bool IsComplete() const + { + if ( m_BonusMapDesc.bIsFolder ) + return false; + int nChallenge = Clamp( gamepadui_selected_challenge.GetInt(), 0, 2 ); + return m_BonusMapDesc.bComplete || bCompleted[ nChallenge ]; + } + + void SetBonusMapDescription( BonusMapDescription_t* pDesc ) + { + for ( auto& medal : m_Medals ) + medal.Cleanup(); + m_BonusMapDesc = *pDesc; + + if ( !m_BonusMapDesc.m_pChallenges ) + return; + + int nNumChallenges = 0; + for ( ChallengeDescription_t& challenge : *m_BonusMapDesc.m_pChallenges ) + { + int iChallengeNum = challenge.iType != -1 ? challenge.iType : nNumChallenges; + int iBest, iEarnedMedal, iNext, iNextMedal; + GetChallengeMedals( &challenge, iBest, iEarnedMedal, iNext, iNextMedal ); + + bCompleted[ iChallengeNum ] = iNextMedal == -1; + + char szBuff[256]; + if (iChallengeNum < 10) + Q_snprintf(szBuff, 256, "vgui/medals/medal_0%i_%s", iChallengeNum, g_pszMedalNames[iEarnedMedal]); + else + Q_snprintf(szBuff, 256, "vgui/medals/medal_%i_%s", iChallengeNum, g_pszMedalNames[iEarnedMedal]); + m_Medals[ iChallengeNum ].SetImage( szBuff ); + + nNumChallenges++; + } + } + + static GamepadUIBonusButton* GetLastBonusButton() { return s_pLastBonusButton; } + +private: + GamepadUIImage m_Image; + GamepadUIImage m_Medals[3]; + GamepadUIImage m_LockIcon; + + bool bCompleted[3]; + + static GamepadUIBonusButton *s_pLastBonusButton; + + BonusMapDescription_t m_BonusMapDesc = {}; + + GAMEPADUI_PANEL_PROPERTY( Color, m_colProgressColor, "Button.Background.Progress", "255 0 0 255", SchemeValueTypes::Color ); + GAMEPADUI_PANEL_PROPERTY( float, m_flProgressHeight, "Button.Progress.Height", "1", SchemeValueTypes::ProportionalFloat ); + + GAMEPADUI_PANEL_PROPERTY( float, m_flMedalSize, "Button.Medal.Size", "64", SchemeValueTypes::ProportionalFloat ); + GAMEPADUI_PANEL_PROPERTY( float, m_flMedalOffsetX, "Button.Medal.OffsetX", "8", SchemeValueTypes::ProportionalFloat ); + GAMEPADUI_PANEL_PROPERTY( float, m_flMedalOffsetY, "Button.Medal.OffsetY", "8", SchemeValueTypes::ProportionalFloat ); + + GAMEPADUI_PANEL_PROPERTY( float, m_flLockSize, "Button.Lock.Size", "80", SchemeValueTypes::ProportionalFloat ); + GAMEPADUI_PANEL_PROPERTY( Color, m_colLock, "Button.Lock", "20 20 20 255", SchemeValueTypes::Color ); +}; + +GamepadUIBonusButton* GamepadUIBonusButton::s_pLastBonusButton = NULL; + +GamepadUIBonusMapsPanel::GamepadUIBonusMapsPanel( vgui::Panel *pParent, const char* PanelName ) : BaseClass( pParent, PanelName ) +{ + vgui::HScheme hScheme = vgui::scheme()->LoadSchemeFromFile( GAMEPADUI_DEFAULT_PANEL_SCHEME, "SchemePanel" ); + SetScheme( hScheme ); + + FooterButtonMask buttons = FooterButtons::Back | FooterButtons::Select; + SetFooterButtons( buttons, FooterButtons::Select ); + + BuildMapsList(); + Activate(); + + UpdateGradients(); +} + +void GamepadUIBonusMapsPanel::UpdateGradients() +{ + const float flTime = GamepadUI::GetInstance().GetTime(); + GamepadUI::GetInstance().GetGradientHelper()->ResetTargets( flTime ); + GamepadUI::GetInstance().GetGradientHelper()->SetTargetGradient( GradientSide::Up, { 1.0f, 1.0f }, flTime ); + GamepadUI::GetInstance().GetGradientHelper()->SetTargetGradient( GradientSide::Down, { 1.0f, 0.5f }, flTime ); +} + +void GamepadUIBonusMapsPanel::OnThink() +{ + BaseClass::OnThink(); + + LayoutBonusButtons(); +} + +void GamepadUIBonusMapsPanel::ApplySchemeSettings( vgui::IScheme* pScheme ) +{ + BaseClass::ApplySchemeSettings( pScheme ); + m_hGoalFont = pScheme->GetFont( "Goal.Font", true ); +} + +void GamepadUIBonusMapsPanel::OnGamepadUIButtonNavigatedTo( vgui::VPANEL button ) +{ + // TODO: Scroll +#if 0 + GamepadUIButton *pButton = dynamic_cast< GamepadUIButton * >( vgui::ipanel()->GetPanel( button, GetModuleName() ) ); + if ( pButton ) + { + int nParentW, nParentH; + GetParent()->GetSize( nParentW, nParentH ); + + int nX, nY; + pButton->GetPos( nX, nY ); + if ( nX + pButton->m_flWidth > nParentW || nX < 0 ) + { + int nTargetX = pButton->GetPriority() * (pButton->m_flWidth + m_BonusSpacing); + + if ( nX < nParentW / 2 ) + { + nTargetX += nParentW - m_BonusOffsetX; + // Add a bit of spacing to make this more visually appealing :) + nTargetX -= m_BonusSpacing; + } + else + { + nTargetX += pButton->m_flWidth; + // Add a bit of spacing to make this more visually appealing :) + nTargetX += (pButton->m_flWidth / 2) + m_BonusSpacing; + } + + + m_ScrollState.SetScrollTarget( nTargetX - ( nParentW - m_BonusOffsetX ), GamepadUI::GetInstance().GetTime() ); + } + } +#endif +} + +#define MAX_LISTED_BONUS_MAPS 128 + +void GamepadUIBonusMapsPanel::BuildMapsList() +{ + m_pBonusButtons.PurgeAndDeleteElements(); + + GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->ClearBonusMapsList(); + GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->ScanBonusMaps(); + + char szDisplayPath[_MAX_PATH]; + Q_snprintf( szDisplayPath, _MAX_PATH, "%s/", GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->GetPath() ); + + //bool bIsRoot = !Q_strcmp( GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->GetPath(), "." ); + //if ( bIsRoot ) + GetFrameTitle() = GamepadUIString( "#GameUI_BonusMaps" ); + //else + // GetFrameTitle() = GamepadUIString( szDisplayPath ); + + int iMapCount = GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->BonusCount(); + + bool bHasChallenges = false; + + // add to the list + for ( int iMapIndex = 0; iMapIndex < iMapCount && iMapIndex < MAX_LISTED_BONUS_MAPS; ++iMapIndex ) + { + BonusMapDescription_t *pDesc = GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->GetBonusData( iMapIndex ); + + char szImage[MAX_PATH]; + V_snprintf( szImage, sizeof( szImage ), "vgui/%s", pDesc->szImageName ); + + if ( pDesc->m_pChallenges ) + bHasChallenges = true; + + GamepadUIBonusButton *pChapterButton = new GamepadUIBonusButton( + this, this, + GAMEPADUI_BONUS_SCHEME, "action_map", + pDesc->szMapName, NULL, /*pDesc->szComment*/ szImage); + pChapterButton->SetPriority( iMapIndex ); + pChapterButton->SetEnabled( !pDesc->bLocked ); + pChapterButton->SetForwardToParent( true ); + pChapterButton->SetBonusMapDescription( pDesc ); + + m_pBonusButtons.AddToTail( pChapterButton ); + m_Bonuses.AddToTail( *pDesc ); + } + + if ( m_pBonusButtons.Count() > 0 ) + m_pBonusButtons[0]->NavigateTo(); + + for ( int i = 1; i < m_pBonusButtons.Count(); i++) + { + m_pBonusButtons[i]->SetNavLeft(m_pBonusButtons[i - 1]); + m_pBonusButtons[i - 1]->SetNavRight(m_pBonusButtons[i] ); + } + + FooterButtonMask buttons = FooterButtons::Back | FooterButtons::Select; + if (bHasChallenges) + buttons |= FooterButtons::Challenge; + SetFooterButtons( buttons, FooterButtons::Select ); +} + +void GamepadUIBonusMapsPanel::LayoutBonusButtons() +{ + int nParentW, nParentH; + GetParent()->GetSize( nParentW, nParentH ); + + float flScrollClamp = 0.0f; + for ( int i = 0; i < m_pBonusButtons.Count(); i++ ) + { + int nSize = ( m_pBonusButtons[0]->GetWide() + m_BonusSpacing ); + + if ( i < m_pBonusButtons.Count() - 2 ) + flScrollClamp += nSize; + } + + m_ScrollState.UpdateScrollBounds( 0.0f, flScrollClamp ); + + int x = m_BonusOffsetX; + int y = m_BonusOffsetY; + CUtlVector< CUtlVector< GamepadUIBonusButton* > > pButtonRows; + int j = 0; + for ( int i = 0; i < m_pBonusButtons.Count(); i++ ) + { + int size = ( m_pBonusButtons[0]->GetWide() + m_BonusSpacing ); + + if ( x + size > nParentW - m_BonusOffsetX ) + { + j = 0; + x = m_BonusOffsetX; + y += m_pBonusButtons[0]->GetTall() + m_BonusSpacing; + } + + m_pBonusButtons[i]->SetPos( x, y ); + m_pBonusButtons[i]->SetVisible( true ); + j++; + + x += size + m_BonusSpacing; + while (pButtonRows.Size() <= j) + pButtonRows.AddToTail(); + pButtonRows[j].AddToTail( m_pBonusButtons[i] ); + } + + for ( int i = 0; i < pButtonRows.Count(); i++ ) + { + for (int j = 1; j < pButtonRows[i].Count(); j++) + { + pButtonRows[i][j]->SetNavUp(pButtonRows[i][j - 1]); + pButtonRows[i][j - 1]->SetNavDown(pButtonRows[i][j]); + } + } + + m_ScrollState.UpdateScrolling( 2.0f, GamepadUI::GetInstance().GetTime() ); +} + +void GamepadUIBonusMapsPanel::OnCommand( char const* pCommand ) +{ + if ( !V_strcmp( pCommand, "action_back" ) ) + { + bool bIsRoot = !Q_strcmp( GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->GetPath(), "." ); + if ( bIsRoot ) + Close(); + else + { + GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->BackPath(); + + BuildMapsList(); + } + } + else if ( !V_strcmp( pCommand, "action_challenges" ) ) + { + CycleSelectedChallenge(); + } + else if ( !V_strcmp( pCommand, "action_map" ) ) + { + GamepadUIBonusButton* pButton = GamepadUIBonusButton::GetLastBonusButton(); + if ( pButton ) + { + int mapIndex = pButton->GetPriority(); + if ( GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->IsValidIndex( mapIndex ) ) + { + BonusMapDescription_t *pBonusMap = GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->GetBonusData( mapIndex ); + + // Don't do anything with locked items + if ( pBonusMap->bLocked ) + return; + + const char *shortName = pBonusMap->szShortName; + if ( shortName && shortName[ 0 ] ) + { + if ( pBonusMap->bIsFolder ) + { + GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->AppendPath( shortName ); + + BuildMapsList(); + } + else + { + // Load the game, return to top and switch to engine + char sz[ 256 ]; + + // Set the challenge mode if one is selected + int iChallenge = 0; + + GamepadUIBonusButton* pButton = GamepadUIBonusButton::GetLastBonusButton(); + if ( pButton ) + { + const BonusMapDescription_t& desc = pButton->GetBonusMapDescription(); + if ( desc.m_pChallenges ) + { + iChallenge = Clamp( gamepadui_selected_challenge.GetInt(), 0, 2 ) + 1; + } + } + + // Set commentary + ConVarRef commentary( "commentary" ); + commentary.SetValue( 0 ); + + ConVarRef sv_cheats( "sv_cheats" ); + sv_cheats.SetValue( 0 ); + + if ( iChallenge > 0 ) + { + Q_snprintf( sz, sizeof( sz ), "sv_bonus_challenge %i\n", iChallenge ); + GamepadUI::GetInstance().GetEngineClient()->ClientCmd_Unrestricted(sz); + + ChallengeDescription_t *pChallengeDescription = &((*pBonusMap->m_pChallenges)[ iChallenge - 1 ]); + + // Set up medal goals + GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->SetCurrentChallengeObjectives( pChallengeDescription->iBronze, pChallengeDescription->iSilver, pChallengeDescription->iGold ); + GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->SetCurrentChallengeNames( pBonusMap->szFileName, pBonusMap->szMapName, pChallengeDescription->szName ); + } + + if ( pBonusMap->szMapFileName[ 0 ] != '.' ) + { + Q_snprintf( sz, sizeof( sz ), "map %s\n", pBonusMap->szMapFileName ); + } + else + { + const char *pchSubDir = Q_strnchr( GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->GetPath(), '/', Q_strlen( GamepadUI::GetInstance().GetGameUI()->GetBonusMapsDatabase()->GetPath() ) ); + + if ( pchSubDir ) + { + pchSubDir = Q_strnchr( pchSubDir + 1, '/', Q_strlen( pchSubDir ) ); + + if ( pchSubDir ) + { + ++pchSubDir; + const char *pchMapFileName = pBonusMap->szMapFileName + 2; + Q_snprintf( sz, sizeof( sz ), "map %s/%s\n", pchSubDir, pchMapFileName ); + } + } + } + + GamepadUI::GetInstance().GetEngineClient()->ClientCmd_Unrestricted( sz ); + + OnClose(); + } + } + } + } + } + else + { + BaseClass::OnCommand( pCommand ); + } +} + +void GamepadUIBonusMapsPanel::Paint() +{ + BaseClass::Paint(); + + GamepadUIBonusButton* pButton = GamepadUIBonusButton::GetLastBonusButton(); + if ( !pButton ) + return; + + const BonusMapDescription_t& desc = pButton->GetBonusMapDescription(); + if ( !desc.m_pChallenges ) + return; + + int nCurrentChallenge = Clamp(gamepadui_selected_challenge.GetInt(), 0, 2); + + int nNumChallenges = 0; + for (ChallengeDescription_t& challenge : *desc.m_pChallenges) + { + int iChallengeNum = challenge.iType != -1 ? challenge.iType : nNumChallenges; + + if ( iChallengeNum == nCurrentChallenge ) + { + int iBest, iEarnedMedal, iNext, iNextMedal; + GetChallengeMedals( &challenge, iBest, iEarnedMedal, iNext, iNextMedal ); + + int nParentW, nParentH; + GetParent()->GetSize( nParentW, nParentH ); + + char szBuff[256]; + if ( iEarnedMedal != -1 ) + { + if (iChallengeNum < 10) + Q_snprintf(szBuff, 256, "vgui/medals/medal_0%i_%s", iChallengeNum, g_pszMedalNames[iEarnedMedal]); + else + Q_snprintf(szBuff, 256, "vgui/medals/medal_%i_%s", iChallengeNum, g_pszMedalNames[iEarnedMedal]); + if ( V_strcmp( m_szCachedMedalNames[0], szBuff)) + { + m_CachedMedals[ 0 ].SetImage( szBuff ); + V_strcpy( m_szCachedMedalNames[0], szBuff); + } + } + else + { + m_CachedMedals[0].Cleanup(); + V_strcpy(m_szCachedMedalNames[0], ""); + } + + if ( iNextMedal != -1 ) + { + if (iChallengeNum < 10) + Q_snprintf(szBuff, 256, "vgui/medals/medal_0%i_%s", iChallengeNum, g_pszMedalNames[iNextMedal]); + else + Q_snprintf(szBuff, 256, "vgui/medals/medal_%i_%s", iChallengeNum, g_pszMedalNames[iNextMedal]); + if ( V_strcmp( m_szCachedMedalNames[1], szBuff)) + { + m_CachedMedals[ 1 ].SetImage( szBuff ); + V_strcpy( m_szCachedMedalNames[1], szBuff); + } + } + else + { + m_CachedMedals[1].Cleanup(); + V_strcpy(m_szCachedMedalNames[1], ""); + } + + float flX = m_flFooterButtonsOffsetX + m_nFooterButtonWidth + m_flFooterButtonsSpacing; + float flY = nParentH - m_flFooterButtonsOffsetY - m_nFooterButtonHeight; + + // Josh: I should clean this later... + int iBestWide = 0; + int iBestTall = 0; + if (iBest != -1) + { + char szBuff[256]; + wchar_t szWideBuff[256]; + wchar_t szWideBuff2[256]; + + Q_snprintf(szBuff, sizeof(szBuff), "%i", iBest); + g_pVGuiLocalize->ConvertANSIToUnicode(szBuff, szWideBuff2, sizeof(szWideBuff2)); + g_pVGuiLocalize->ConstructString(szWideBuff, sizeof(szWideBuff), g_pVGuiLocalize->Find("#GameUI_BonusMapsBest"), 1, szWideBuff2); + + if ( m_CachedMedals[0].IsValid() ) + { + vgui::surface()->DrawSetTexture( m_CachedMedals[ 0 ] ); + vgui::surface()->DrawSetColor( Color( 255, 255, 255, 255 ) ); + vgui::surface()->DrawTexturedRect( flX, flY, flX + m_flFooterMedalSize, flY + m_flFooterMedalSize ); + } + + vgui::surface()->DrawSetTextColor(Color(255, 255, 255, 255)); + vgui::surface()->DrawSetTextFont( m_hGoalFont ); + vgui::surface()->DrawSetTextPos( flX + m_flFooterMedalSize + m_flFooterButtonsSpacing, flY ); + vgui::surface()->GetTextSize( m_hGoalFont, szWideBuff, iBestWide, iBestTall); + vgui::surface()->DrawPrintText( szWideBuff, V_wcslen(szWideBuff) ); + } + + int iNextWide = 0; + int iNextTall = 0; + if (iNext != -1) + { + char szBuff[256]; + wchar_t szWideBuff[256]; + wchar_t szWideBuff2[256]; + + Q_snprintf(szBuff, sizeof(szBuff), "%i", iNext); + g_pVGuiLocalize->ConvertANSIToUnicode(szBuff, szWideBuff2, sizeof(szWideBuff2)); + g_pVGuiLocalize->ConstructString(szWideBuff, sizeof(szWideBuff), g_pVGuiLocalize->Find("#GameUI_BonusMapsGoal"), 1, szWideBuff2); + + vgui::surface()->DrawSetTextColor(Color(255, 255, 255, 255)); + vgui::surface()->DrawSetTextFont( m_hGoalFont ); + vgui::surface()->DrawSetTextPos( flX + m_flFooterMedalSize + m_flFooterButtonsSpacing, flY + iBestTall ); + vgui::surface()->GetTextSize( m_hGoalFont, szWideBuff, iNextWide, iNextTall); + vgui::surface()->DrawPrintText( szWideBuff, V_wcslen(szWideBuff) ); + + if ( m_CachedMedals[1].IsValid() ) + { + vgui::surface()->DrawSetTexture( m_CachedMedals[ 1 ] ); + vgui::surface()->DrawSetColor( Color( 255, 255, 255, 255 ) ); + float flX2 = flX + m_flFooterMedalSize + Max(iNextWide, iBestWide) + 2 * m_flFooterButtonsSpacing; + float flY2 = flY + iBestTall; + vgui::surface()->DrawTexturedRect( flX2, flY2, flX2 + m_flFooterMedalNextSize, flY2 + m_flFooterMedalNextSize); + } + } + + return; + } + + nNumChallenges++; + } +} + +void GamepadUIBonusMapsPanel::OnMouseWheeled( int nDelta ) +{ + // TODO: Scroll + //m_ScrollState.OnMouseWheeled( nDelta * m_BonusSpacing * 20.0f, GamepadUI::GetInstance().GetTime() ); +} + +CON_COMMAND( gamepadui_openbonusmapsdialog, "" ) +{ + new GamepadUIBonusMapsPanel( GamepadUI::GetInstance().GetBasePanel(), "" ); +} + +#endif // GAMEPADUI_ENABLE_BONUSMAPS diff --git a/sp/src/game/gamepadui/gamepadui_button.h b/sp/src/game/gamepadui/gamepadui_button.h index b1f1d1387..865569abc 100644 --- a/sp/src/game/gamepadui/gamepadui_button.h +++ b/sp/src/game/gamepadui/gamepadui_button.h @@ -42,11 +42,12 @@ namespace FooterButtons Commentary = ( 1 << 6 ), BonusMaps = ( 1 << 7 ), Challenge = ( 1 << 8 ), + UseDefaults = ( 1 << 9 ), // Buttons that are 'confirmatory' ConfirmMask = ( LeftSelect | Select | Okay ), }; - static const int MaxFooterButtons = 9; + static const int MaxFooterButtons = 10; inline const char* GetButtonName( FooterButton button ) { @@ -61,6 +62,7 @@ namespace FooterButtons case Commentary: return "#GameUI_Commentary"; case BonusMaps: return "#Deck_BonusMaps"; case Challenge: return "#Deck_Challenges"; + case UseDefaults: return "#GameUI_UseDefaults"; } return "Unknown"; } @@ -78,6 +80,7 @@ namespace FooterButtons case Commentary: return "action_commentary"; case BonusMaps: return "action_bonus_maps"; case Challenge: return "action_challenges"; + case UseDefaults: return "action_usedefaults"; } return ""; } @@ -95,6 +98,7 @@ namespace FooterButtons case Commentary: return "menu_y"; case BonusMaps: return "menu_x"; case Challenge: return "menu_y"; + case UseDefaults: return "menu_x"; } return ""; } diff --git a/sp/src/game/gamepadui/gamepadui_frame.cpp b/sp/src/game/gamepadui/gamepadui_frame.cpp index 16a7a6dc1..e482491e6 100644 --- a/sp/src/game/gamepadui/gamepadui_frame.cpp +++ b/sp/src/game/gamepadui/gamepadui_frame.cpp @@ -256,7 +256,7 @@ void GamepadUIFrame::OnKeyCodePressed( vgui::KeyCode code ) case KEY_XBUTTON_X: for ( int i = 0; i < FooterButtons::MaxFooterButtons; i++ ) { - if ( FooterButtons::GetButtonByIdx(i) & ( FooterButtons::BonusMaps ) ) + if ( FooterButtons::GetButtonByIdx(i) & ( FooterButtons::BonusMaps | FooterButtons::UseDefaults ) ) { if ( m_pFooterButtons[i] ) m_pFooterButtons[i]->ForceDepressed( true ); @@ -340,7 +340,7 @@ void GamepadUIFrame::OnKeyCodeReleased( vgui::KeyCode code ) case KEY_XBUTTON_X: for ( int i = 0; i < FooterButtons::MaxFooterButtons; i++ ) { - if ( FooterButtons::GetButtonByIdx(i) & ( FooterButtons::BonusMaps ) ) + if ( FooterButtons::GetButtonByIdx(i) & ( FooterButtons::BonusMaps | FooterButtons::UseDefaults ) ) { if ( m_pFooterButtons[i] ) { diff --git a/sp/src/game/gamepadui/gamepadui_mainmenu.cpp b/sp/src/game/gamepadui/gamepadui_mainmenu.cpp index 01c8d780d..8cf44223f 100644 --- a/sp/src/game/gamepadui/gamepadui_mainmenu.cpp +++ b/sp/src/game/gamepadui/gamepadui_mainmenu.cpp @@ -25,8 +25,8 @@ GamepadUIMainMenu::GamepadUIMainMenu( vgui::Panel* pParent ) { if ( pModData->LoadFromFile( g_pFullFileSystem, "gameinfo.txt" ) ) { - m_LogoText[ 0 ] = pModData->GetString( "logo" ); - m_LogoText[ 1 ] = pModData->GetString( "logo2" ); + m_LogoText[0] = pModData->GetString("gamepadui_title", pModData->GetString("title")); + m_LogoText[1] = pModData->GetString("gamepadui_title2", pModData->GetString("title2")); } pModData->deleteThis(); } diff --git a/sp/src/game/gamepadui/gamepadui_options.cpp b/sp/src/game/gamepadui/gamepadui_options.cpp index da6276408..e425d91e1 100644 --- a/sp/src/game/gamepadui/gamepadui_options.cpp +++ b/sp/src/game/gamepadui/gamepadui_options.cpp @@ -41,7 +41,9 @@ ConVar _gamepadui_displaymode( "_gamepadui_displaymode", "0", FCVAR_NONE, "", On ConVar _gamepadui_resolution( "_gamepadui_resolution", "0" ); ConVar _gamepadui_sound_quality( "_gamepadui_sound_quality", "0" ); ConVar _gamepadui_closecaptions( "_gamepadui_closecaptions", "0" ); +#ifdef HL2_RETAIL ConVar _gamepadui_hudaspect( "_gamepadui_hudaspect", "0" ); +#endif ConVar _gamepadui_skill( "_gamepadui_skill", "0" ); struct GamepadUITab @@ -76,6 +78,7 @@ class GamepadUIOptionsPanel : public GamepadUIFrame void OnMouseWheeled( int delta ) OVERRIDE; void UpdateResolutions(); + void ClearBindings(); void FillInBindings(); void ApplyKeyBindings(); @@ -160,6 +163,7 @@ struct GamepadUIOption { GamepadUIString strOptionText; int nValue = 0; + const char* sValue = ""; union { @@ -353,9 +357,10 @@ class GamepadUIWheelyWheel : public GamepadUIConvarButton public: DECLARE_CLASS_SIMPLE( GamepadUIWheelyWheel, GamepadUIConvarButton ); - GamepadUIWheelyWheel( const char *pszCvar, const char *pszCvarDepends, bool bInstantApply, bool bSignOnly, vgui::Panel* pParent, vgui::Panel* pActionSignalTarget, const char *pSchemeFile, const char* pCommand, const char *pText, const char *pDescription ) + GamepadUIWheelyWheel( const char *pszCvar, const char *pszCvarDepends, bool bInstantApply, bool bSignOnly, bool bUsesString, vgui::Panel* pParent, vgui::Panel* pActionSignalTarget, const char *pSchemeFile, const char* pCommand, const char *pText, const char *pDescription ) : BaseClass( pszCvar, pszCvarDepends, bInstantApply, pParent, pActionSignalTarget, pSchemeFile, pCommand, pText, pDescription ) , m_bSignOnly( bSignOnly ) + , m_bUsesString( bUsesString ) { } @@ -408,8 +413,10 @@ class GamepadUIWheelyWheel : public GamepadUIConvarButton { if ( IsDirty() ) { - if ( m_bSignOnly ) + if (m_bSignOnly) m_cvar.SetValue( abs( m_cvar.GetFloat() ) * m_Options[m_nSelectedItem].nValue ); + else if (m_bUsesString) + m_cvar.SetValue(m_Options[m_nSelectedItem].sValue); else m_cvar.SetValue( m_Options[ m_nSelectedItem ].nValue ); } @@ -418,7 +425,18 @@ class GamepadUIWheelyWheel : public GamepadUIConvarButton bool IsDirty() OVERRIDE { - return m_cvar.IsValid() && GetCvarValue() != m_Options[m_nSelectedItem].nValue; + bool dirty = false; + + if (m_bUsesString) + { + dirty = V_strcmp(m_Options[m_nSelectedItem].sValue, m_cvar.GetString()); + } + else + { + dirty = GetCvarValue() != m_Options[m_nSelectedItem].nValue; + } + + return m_cvar.IsValid() && dirty; } virtual void Paint() @@ -480,11 +498,23 @@ class GamepadUIWheelyWheel : public GamepadUIConvarButton { if ( m_cvar.IsValid() ) { - const int nCurrentValue = GetCvarValue(); - for ( int i = 0; i < m_Options.Count(); i++) + if (m_bUsesString) + { + const char *sCurrentValue = m_cvar.GetString(); + for (int i = 0; i < m_Options.Count(); i++) + { + if (!V_strcmp(m_Options[i].sValue,sCurrentValue)) + m_nSelectedItem = i; + } + } + else { - if ( m_Options[ i ].nValue == nCurrentValue ) - m_nSelectedItem = i; + const int nCurrentValue = GetCvarValue(); + for (int i = 0; i < m_Options.Count(); i++) + { + if (m_Options[i].nValue == nCurrentValue) + m_nSelectedItem = i; + } } } } @@ -504,6 +534,7 @@ class GamepadUIWheelyWheel : public GamepadUIConvarButton private: bool m_bSignOnly = false; + bool m_bUsesString = false; int m_nSelectedItem = 0; CUtlVector< GamepadUIOption > m_Options; @@ -954,6 +985,7 @@ int GetCurrentCloseCaptions() return 0; } +#ifdef HL2_RETAIL int GetCurrentHudAspectRatio() { ConVarRef hud_aspect( "hud_aspect" ); @@ -970,6 +1002,7 @@ int GetCurrentHudAspectRatio() else return 0; } +#endif int GetCurrentSkill() { @@ -1128,6 +1161,7 @@ void FlushPendingCloseCaptions() GamepadUI::GetInstance().GetEngineClient()->ClientCmd_Unrestricted( szCmd ); } +#ifdef HL2_RETAIL void FlushPendingHudAspectRatio() { ConVarRef hud_aspect( "hud_aspect" ); @@ -1150,6 +1184,7 @@ void FlushPendingHudAspectRatio() break; } } +#endif void FlushPendingSkill() { @@ -1166,7 +1201,9 @@ void UpdateHelperConvars() _gamepadui_displaymode.SetValue( GetCurrentDisplayMode() ); _gamepadui_sound_quality.SetValue( GetCurrentSoundQuality() ); _gamepadui_closecaptions.SetValue( GetCurrentCloseCaptions() ); +#ifdef HL2_RETAIL _gamepadui_hudaspect.SetValue( GetCurrentHudAspectRatio() ); +#endif _gamepadui_skill.SetValue( GetCurrentSkill() ); } @@ -1178,7 +1215,9 @@ void FlushHelperConVars() FlushPendingResolution(); FlushPendingSoundQuality(); FlushPendingCloseCaptions(); +#ifdef HL2_RETAIL FlushPendingHudAspectRatio(); +#endif FlushPendingSkill(); } @@ -1374,6 +1413,12 @@ void GamepadUIOptionsPanel::OnMouseWheeled( int delta ) m_Tabs[ GetActiveTab() ].ScrollState.OnMouseWheeled( delta * 100.0f, GamepadUI::GetInstance().GetTime() ); } +CON_COMMAND( _gamepadui_resetkeys, "" ) +{ + GamepadUIOptionsPanel::GetInstance()->ClearBindings(); + GamepadUIOptionsPanel::GetInstance()->FillInBindings(); +} + void GamepadUIOptionsPanel::OnCommand( char const* pCommand ) { if ( !V_strcmp( pCommand, "action_back" ) ) @@ -1393,6 +1438,13 @@ void GamepadUIOptionsPanel::OnCommand( char const* pCommand ) ApplyKeyBindings(); GamepadUI::GetInstance().GetEngineClient()->ClientCmd_Unrestricted( "exec userconfig.cfg\nhost_writeconfig\nmat_savechanges\n" ); } + else if ( !V_strcmp( pCommand, "action_usedefaults" ) ) + { + new GamepadUIGenericConfirmationPanel( GamepadUIOptionsPanel::GetInstance(), "UseDefaultsConfirm", GamepadUIString( "#GameUI_KeyboardSettings" ).String(), GamepadUIString("#GameUI_KeyboardSettingsText").String(), + [](){ + GamepadUI::GetInstance().GetEngineClient()->ClientCmd_Unrestricted( "exec config_default.cfg\n_gamepadui_resetkeys\n" ); + }, false, true); + } else if ( StringHasPrefixCaseSensitive( pCommand, "tab " ) ) { const char *pszTab = &pCommand[4]; @@ -1540,6 +1592,19 @@ void GamepadUIOptionsPanel::UpdateResolutions() m_pResolutionButton->SetToDefault(); } +void GamepadUIOptionsPanel::ClearBindings() +{ + for ( int i = 0; i < m_nTabCount; i++ ) + { + for ( GamepadUIButton* pButton : m_Tabs[i].pButtons ) + { + GamepadUIKeyButton* pKeyButton = dynamic_cast(pButton); + if ( pKeyButton ) + pKeyButton->ClearKey(); + } + } +} + // Mainly from GameUI void GamepadUIOptionsPanel::FillInBindings() { @@ -1744,6 +1809,15 @@ void GamepadUIOptionsPanel::SetActiveTab( int nTab ) for ( int i = 0; i < m_nTabCount; i++ ) m_Tabs[ i ].pTabButton->ForceDepressed( i == nActiveTab ); + FooterButtonMask buttons = FooterButtons::Apply | FooterButtons::Back; + + if (V_strncmp(m_Tabs[nActiveTab].pTabButton->GetName(), "Keyboard", 8) == 0) + { + buttons |= FooterButtons::UseDefaults; + } + + SetFooterButtons( buttons ); + for ( GamepadUIButton *pButton : m_Tabs[ nActiveTab ].pButtons ) { if ( pButton->GetCurrentButtonState() == ButtonState::Pressed ) @@ -1786,6 +1860,7 @@ void GamepadUIOptionsPanel::LoadOptionTabs( const char *pszOptionsFile ) m_Tabs[ m_nTabCount ].pTabButton = button; } + m_Tabs[m_nTabCount].pTabButton->SetName(pTabData->GetName()); m_Tabs[ m_nTabCount ].bAlternating = pTabData->GetBool( "alternating" ); m_Tabs[ m_nTabCount ].bHorizontal = pTabData->GetBool( "horizontal" ); @@ -1851,8 +1926,9 @@ void GamepadUIOptionsPanel::LoadOptionTabs( const char *pszOptionsFile ) const char *pszCvarDepends = pItemData->GetString( "depends_on" ); bool bInstantApply = pItemData->GetBool( "instantapply" ); bool bSignOnly = pItemData->GetBool( "signonly" ); + bool bUsesString = pItemData->GetBool("usesstring"); auto button = new GamepadUIWheelyWheel( - pszCvar, pszCvarDepends, bInstantApply, bSignOnly, + pszCvar, pszCvarDepends, bInstantApply, bSignOnly, bUsesString, this, this, GAMEPADUI_RESOURCE_FOLDER "schemeoptions_wheelywheel.res", "button_pressed", @@ -1862,12 +1938,23 @@ void GamepadUIOptionsPanel::LoadOptionTabs( const char *pszOptionsFile ) KeyValues *pOptions = pItemData->FindKey( "options" ); if ( pOptions ) { + int i = 0; for ( KeyValues* pOptionData = pOptions->GetFirstSubKey(); pOptionData != NULL; pOptionData = pOptionData->GetNextKey() ) { GamepadUIOption option; - option.nValue = V_atoi( pOptionData->GetName() ); + if (bUsesString) + { + option.sValue = pOptionData->GetName(); + option.nValue = i; + } + else + { + option.nValue = V_atoi(pOptionData->GetName()); + } + option.strOptionText = GamepadUIString( pOptionData->GetString() ); button->AddOptionItem( option ); + ++i; } } else if ( pszOptionsFrom && *pszOptionsFrom ) diff --git a/sp/src/public/collisionutils.cpp b/sp/src/public/collisionutils.cpp index d26db4ab0..9947b5bf5 100644 --- a/sp/src/public/collisionutils.cpp +++ b/sp/src/public/collisionutils.cpp @@ -1666,7 +1666,7 @@ bool IntersectRayWithOBB( const Ray_t &ray, const matrix3x4_t &matOBBToWorld, } temp.type = 3; - MatrixITransformPlane( matOBBToWorld, temp, pTrace->plane ); + MatrixTransformPlane( matOBBToWorld, temp, pTrace->plane ); return true; } diff --git a/vpk_src/firefightreloaded_pak/materials/gamepadui/nightmare.vmt b/vpk_src/firefightreloaded_pak/materials/gamepadui/nightmare.vmt new file mode 100644 index 000000000..a821d0d97 --- /dev/null +++ b/vpk_src/firefightreloaded_pak/materials/gamepadui/nightmare.vmt @@ -0,0 +1,9 @@ +"UnlitGeneric" +{ + "$basetexture" "gamepadui/nightmare" + "$vertexcolor" 1 + "$vertexalpha" 1 + "$translucent" 1 + "$ignorez" 1 + "$no_fullbright" "1" +} diff --git a/vpk_src/firefightreloaded_pak/materials/gamepadui/nightmare.vtf b/vpk_src/firefightreloaded_pak/materials/gamepadui/nightmare.vtf new file mode 100644 index 000000000..9ec784b99 Binary files /dev/null and b/vpk_src/firefightreloaded_pak/materials/gamepadui/nightmare.vtf differ diff --git a/vpk_src/firefightreloaded_pak/materials/gamepadui/veryhard.vmt b/vpk_src/firefightreloaded_pak/materials/gamepadui/veryhard.vmt new file mode 100644 index 000000000..ef307d338 --- /dev/null +++ b/vpk_src/firefightreloaded_pak/materials/gamepadui/veryhard.vmt @@ -0,0 +1,9 @@ +"UnlitGeneric" +{ + "$basetexture" "gamepadui/veryhard" + "$vertexcolor" 1 + "$vertexalpha" 1 + "$translucent" 1 + "$ignorez" 1 + "$no_fullbright" "1" +} diff --git a/vpk_src/firefightreloaded_pak/materials/gamepadui/veryhard.vtf b/vpk_src/firefightreloaded_pak/materials/gamepadui/veryhard.vtf new file mode 100644 index 000000000..5bd9825ed Binary files /dev/null and b/vpk_src/firefightreloaded_pak/materials/gamepadui/veryhard.vtf differ diff --git a/vpk_src/firefightreloaded_pak/models/Police_soldieranims.dx80.vtx b/vpk_src/firefightreloaded_pak/models/Police_soldieranims.dx80.vtx new file mode 100644 index 000000000..ee4956733 Binary files /dev/null and b/vpk_src/firefightreloaded_pak/models/Police_soldieranims.dx80.vtx differ diff --git a/vpk_src/firefightreloaded_pak/models/Police_soldieranims.dx90.vtx b/vpk_src/firefightreloaded_pak/models/Police_soldieranims.dx90.vtx new file mode 100644 index 000000000..0e766e879 Binary files /dev/null and b/vpk_src/firefightreloaded_pak/models/Police_soldieranims.dx90.vtx differ diff --git a/vpk_src/firefightreloaded_pak/models/Police_soldieranims.phy b/vpk_src/firefightreloaded_pak/models/Police_soldieranims.phy new file mode 100644 index 000000000..318d82f13 Binary files /dev/null and b/vpk_src/firefightreloaded_pak/models/Police_soldieranims.phy differ diff --git a/vpk_src/firefightreloaded_pak/models/Police_soldieranims.sw.vtx b/vpk_src/firefightreloaded_pak/models/Police_soldieranims.sw.vtx new file mode 100644 index 000000000..35d4f9dba Binary files /dev/null and b/vpk_src/firefightreloaded_pak/models/Police_soldieranims.sw.vtx differ diff --git a/vpk_src/firefightreloaded_pak/models/police_soldieranims.mdl b/vpk_src/firefightreloaded_pak/models/police_soldieranims.mdl new file mode 100644 index 000000000..0cbce5bb6 Binary files /dev/null and b/vpk_src/firefightreloaded_pak/models/police_soldieranims.mdl differ diff --git a/vpk_src/firefightreloaded_pak/models/police_soldieranims.vvd b/vpk_src/firefightreloaded_pak/models/police_soldieranims.vvd new file mode 100644 index 000000000..acb4cfd5d Binary files /dev/null and b/vpk_src/firefightreloaded_pak/models/police_soldieranims.vvd differ