From 96a8e02b7d0b9fab4078b7f76a5a27f5d902bfc3 Mon Sep 17 00:00:00 2001 From: Nick K Date: Mon, 17 Oct 2016 18:44:34 -0400 Subject: [PATCH 01/19] Fixed checkpoint corruption upon load kvFrom -> kvCheckpoint :100: :100: :grimacing: --- mp/src/game/server/momentum/mom_player.cpp | 10 ++++++---- mp/src/game/server/momentum/mom_player.h | 8 +++++++- mp/src/game/server/momentum/mom_system_checkpoint.cpp | 5 ++--- mp/src/game/server/momentum/mom_system_checkpoint.h | 2 +- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/mp/src/game/server/momentum/mom_player.cpp b/mp/src/game/server/momentum/mom_player.cpp index 788eee7b82..aa5fae0b2b 100644 --- a/mp/src/game/server/momentum/mom_player.cpp +++ b/mp/src/game/server/momentum/mom_player.cpp @@ -67,7 +67,10 @@ CMomentumPlayer::CMomentumPlayer() ListenForGameEvent("mapfinished_panel_closed"); } -CMomentumPlayer::~CMomentumPlayer() {} +CMomentumPlayer::~CMomentumPlayer() +{ + RemoveAllCheckpoints(); +} void CMomentumPlayer::Precache() { @@ -531,11 +534,10 @@ void CMomentumPlayer::SaveCPsToFile(KeyValues* kvInto) void CMomentumPlayer::LoadCPsFromFile(KeyValues* kvFrom) { - if (!kvFrom) return; + if (!kvFrom || kvFrom->IsEmpty()) return; FOR_EACH_SUBKEY(kvFrom, kvCheckpoint) { - Checkpoint *c = new Checkpoint(); - c->FromKV(kvFrom); + Checkpoint *c = new Checkpoint(kvCheckpoint); m_rcCheckpoints.AddToTail(c); } diff --git a/mp/src/game/server/momentum/mom_player.h b/mp/src/game/server/momentum/mom_player.h index aba0622382..a66b2cd2b4 100644 --- a/mp/src/game/server/momentum/mom_player.h +++ b/mp/src/game/server/momentum/mom_player.h @@ -35,7 +35,13 @@ struct Checkpoint char targetName[512]; char targetClassName[512]; - void FromKV(KeyValues *pKv) + Checkpoint() : crouched(false), pos(vec3_origin), vel(vec3_origin), ang(vec3_angle) + { + targetName[0] = '\0'; + targetClassName[0] = '\0'; + } + + Checkpoint(KeyValues *pKv) { Q_strncpy(targetName, pKv->GetString("targetName"), sizeof(targetName)); Q_strncpy(targetClassName, pKv->GetString("targetClassName"), sizeof(targetClassName)); diff --git a/mp/src/game/server/momentum/mom_system_checkpoint.cpp b/mp/src/game/server/momentum/mom_system_checkpoint.cpp index f8f75c0e6c..e996138f93 100644 --- a/mp/src/game/server/momentum/mom_system_checkpoint.cpp +++ b/mp/src/game/server/momentum/mom_system_checkpoint.cpp @@ -10,10 +10,9 @@ MAKE_TOGGLE_CONVAR(mom_checkpoint_save_between_sessions, "1", FCVAR_ARCHIVE, "Defines if checkpoints should be saved between sessions of the same map.\n"); -void CMOMCheckpointSystem::LevelInitPostEntity() +void CMOMCheckpointSystem::LevelInitPreEntity() { - // We don't check mom_checkpoints_save_between_sessions because we want to be able to, for example - // load checkpoints from friends + // We don't check mom_checkpoints_save_between_sessions because we want to be able to load checkpoints from friends DevLog("Loading checkpoints from %s ...\n", CHECKPOINTS_FILE_NAME); if (m_pCheckpointsKV) diff --git a/mp/src/game/server/momentum/mom_system_checkpoint.h b/mp/src/game/server/momentum/mom_system_checkpoint.h index cf71789f57..c94567e425 100644 --- a/mp/src/game/server/momentum/mom_system_checkpoint.h +++ b/mp/src/game/server/momentum/mom_system_checkpoint.h @@ -17,7 +17,7 @@ class CMOMCheckpointSystem : CAutoGameSystem m_pCheckpointsKV = nullptr; } - void LevelInitPostEntity() override; + void LevelInitPreEntity() override; void LevelShutdownPreEntity() override; void LoadMapCheckpoints(CMomentumPlayer *pPlayer) const; From a0d2a2d1af4e0a1496ccc3bf23465598c64dd748 Mon Sep 17 00:00:00 2001 From: Nick K Date: Mon, 17 Oct 2016 19:10:03 -0400 Subject: [PATCH 02/19] Fixed crashes on resolution change And immediately opening the map selector should not crash --- mp/src/game/client/momentum/ui/ClientTimesDisplay.cpp | 2 +- mp/src/game/client/momentum/ui/MapSelection/MapSelector.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mp/src/game/client/momentum/ui/ClientTimesDisplay.cpp b/mp/src/game/client/momentum/ui/ClientTimesDisplay.cpp index 89317ab4b6..f0e814d71a 100644 --- a/mp/src/game/client/momentum/ui/ClientTimesDisplay.cpp +++ b/mp/src/game/client/momentum/ui/ClientTimesDisplay.cpp @@ -466,7 +466,7 @@ void CClientTimesDisplay::ShowPanel(bool bShow) { // Catch the case where we call ShowPanel before ApplySchemeSettings, eg when // going from windowed <-> fullscreen - if (m_pImageList == nullptr) + if (!m_pImageList && bShow) { InvalidateLayout(true, true); } diff --git a/mp/src/game/client/momentum/ui/MapSelection/MapSelector.cpp b/mp/src/game/client/momentum/ui/MapSelection/MapSelector.cpp index c0ba013556..234cd4c2cf 100644 --- a/mp/src/game/client/momentum/ui/MapSelection/MapSelector.cpp +++ b/mp/src/game/client/momentum/ui/MapSelection/MapSelector.cpp @@ -121,6 +121,7 @@ void CMapSelector::Destroy() { m_hMapsDlg->Close(); m_hMapsDlg->MarkForDeletion(); + m_hMapsDlg = nullptr; } } From 695965144846cbf67c04d68aedcd66946d80ad62 Mon Sep 17 00:00:00 2001 From: Nick K Date: Mon, 17 Oct 2016 20:03:40 -0400 Subject: [PATCH 03/19] Suggestion by Enjoy. about SettingsPanel Turn off the children checkmarks if you disable the parent --- .../ui/SettingsPanel_ComparisonsSettings.res | 16 +++++++++ .../SettingsPanel/ComparisonsSettingsPage.cpp | 33 ++++--------------- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/mp/game/momentum/resource/ui/SettingsPanel_ComparisonsSettings.res b/mp/game/momentum/resource/ui/SettingsPanel_ComparisonsSettings.res index e53f3bad2e..88ca56fa9c 100644 --- a/mp/game/momentum/resource/ui/SettingsPanel_ComparisonsSettings.res +++ b/mp/game/momentum/resource/ui/SettingsPanel_ComparisonsSettings.res @@ -42,6 +42,7 @@ "Default" "0" "cvar_name" "mom_comparisons" "cvar_value" "1" + "actionsignallevel" "1" } "CompareFormat" @@ -73,6 +74,7 @@ "Default" "0" "cvar_name" "mom_comparisons_format_output" "cvar_value" "1" + "actionsignallevel" "1" } "ZonesLabel" @@ -126,6 +128,7 @@ "maxchars" "-1" "NumericInputOnly" "1" "unicode" "0" + "actionsignallevel" "1" } "TimeTypeLabel" @@ -180,6 +183,7 @@ "NumericInputOnly" "0" "unicode" "0" "font" "DefaultVerySmall" + "actionsignallevel" "1" } "TimeShowOverall" @@ -212,6 +216,7 @@ "Default" "0" "cvar_name" "mom_comparisons_time_show_overall" "cvar_value" "1" + "actionsignallevel" "1" } "TimeShowZone" @@ -244,6 +249,7 @@ "Default" "0" "cvar_name" "mom_comparisons_time_show_perzone" "cvar_value" "1" + "actionsignallevel" "1" } "VelShow" @@ -275,6 +281,7 @@ "Default" "0" "cvar_name" "mom_comparisons_vel_show" "cvar_value" "1" + "actionsignallevel" "1" } "VelShowAvg" @@ -306,6 +313,7 @@ "Default" "0" "cvar_name" "mom_comparisons_vel_show_avg" "cvar_value" "1" + "actionsignallevel" "1" } "VelShowMax" @@ -337,6 +345,7 @@ "Default" "0" "cvar_name" "mom_comparisons_vel_show_max" "cvar_value" "1" + "actionsignallevel" "1" } "VelShowEnter" @@ -369,6 +378,7 @@ "Default" "0" "cvar_name" "mom_comparisons_vel_show_enter" "cvar_value" "1" + "actionsignallevel" "1" } "VelShowExit" @@ -401,6 +411,7 @@ "Default" "0" "cvar_name" "mom_comparisons_vel_show_exit" "cvar_value" "1" + "actionsignallevel" "1" } "SyncShow" @@ -432,6 +443,7 @@ "Default" "0" "cvar_name" "mom_comparisons_sync_show" "cvar_value" "0" + "actionsignallevel" "1" } "SyncShowS1" @@ -464,6 +476,7 @@ "Default" "0" "cvar_name" "mom_comparisons_sync_show_sync1" "cvar_value" "0" + "actionsignallevel" "1" } "SyncShowS2" @@ -496,6 +509,7 @@ "Default" "0" "cvar_name" "mom_comparisons_sync_show_sync2" "cvar_value" "0" + "actionsignallevel" "1" } "ShowJumps" @@ -527,6 +541,7 @@ "Default" "0" "cvar_name" "mom_comparisons_jumps_show" "cvar_value" "1" + "actionsignallevel" "1" } "ShowStrafes" @@ -558,5 +573,6 @@ "Default" "0" "cvar_name" "mom_comparisons_strafe_show" "cvar_value" "1" + "actionsignallevel" "1" } } \ No newline at end of file diff --git a/mp/src/game/client/momentum/ui/SettingsPanel/ComparisonsSettingsPage.cpp b/mp/src/game/client/momentum/ui/SettingsPanel/ComparisonsSettingsPage.cpp index cacb2abf5f..f29aafa515 100644 --- a/mp/src/game/client/momentum/ui/SettingsPanel/ComparisonsSettingsPage.cpp +++ b/mp/src/game/client/momentum/ui/SettingsPanel/ComparisonsSettingsPage.cpp @@ -6,66 +6,39 @@ ComparisonsSettingsPage::ComparisonsSettingsPage(Panel *pParent) : BaseClass(pParent, "ComparisonsSettings") { m_pCompareShow = FindControl>("CompareShow"); - m_pCompareShow->AddActionSignalTarget(this); m_pMaxZones = FindControl("Zones"); - m_pMaxZones->AddActionSignalTarget(this); - m_pMaxZonesLabel = FindControl