Skip to content

Commit

Permalink
Implemented QuickMatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Belonit committed Dec 18, 2023
1 parent 434d851 commit d37011c
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 9 deletions.
1 change: 1 addition & 0 deletions Spawner.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<ClCompile Include="src\Spawner\ProtocolZero.cpp" />
<ClCompile Include="src\Spawner\ProtocolZero.Hook.cpp" />
<ClCompile Include="src\Spawner\ProtocolZero.LatencyLevel.cpp" />
<ClCompile Include="src\Spawner\QuickMatch.cpp" />
<ClCompile Include="src\Spawner\Ra2Mode.cpp" />
<ClCompile Include="src\Spawner\CustomMixes.cpp" />
<ClCompile Include="src\Spawner\RandomMap.cpp" />
Expand Down
45 changes: 45 additions & 0 deletions src/Spawner/QuickMatch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#include "Spawner.h"
#include <Utilities/Macro.h>

namespace QuickMatch
{
const wchar_t* PlayerString = L"Player";
}

DEFINE_HOOK(0x643AA5, ProgressScreenClass_643720_HideName, 0x8)
{
if ((Spawner::Enabled && Spawner::GetConfig()->QuickMatch) == false)
return 0;

REF_STACK(wchar_t*, pPlayerName, STACK_OFFSET(0x5C, 8));
pPlayerName = const_cast<wchar_t*>(QuickMatch::PlayerString);

return 0;
}

DEFINE_HOOK(0x65837A, RadarClass_658330_HideName, 0x6)
{
if ((Spawner::Enabled && Spawner::GetConfig()->QuickMatch) == false)
return 0;

R->ECX(QuickMatch::PlayerString);
return 0x65837A + 0x6;
}

DEFINE_HOOK(0x64B156, ModeLessDialog_64AE50_HideName, 0x9)
{
if ((Spawner::Enabled && Spawner::GetConfig()->QuickMatch) == false)
return 0;

R->EDX(QuickMatch::PlayerString);
return 0x64B156 + 0x9;
}

DEFINE_HOOK(0x648EA8, WaitForPlayers_HideName, 0x6)
{
if ((Spawner::Enabled && Spawner::GetConfig()->QuickMatch) == false)
return 0;

R->EAX(QuickMatch::PlayerString);
return 0x648EB3;
}
4 changes: 1 addition & 3 deletions src/Spawner/Spawner.Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,13 @@ void SpawnerConfig::LoadFromINIFile(CCINIClass* pINI)

// Extended Options
Ra2Mode = pINI->ReadBool(pSettingsSection, "Ra2Mode", Ra2Mode);
QuickMatch = pINI->ReadBool(pSettingsSection, "QuickMatch", QuickMatch);
SkipScoreScreen = pINI->ReadBool(pSettingsSection, "SkipScoreScreen", SkipScoreScreen);
WriteStatistics = pINI->ReadBool(pSettingsSection, "WriteStatistics", WriteStatistics);
AINamesByDifficulty = pINI->ReadBool(pSettingsSection, "AINamesByDifficulty", AINamesByDifficulty);
ContinueWithoutHumans = pINI->ReadBool(pSettingsSection, "ContinueWithoutHumans", ContinueWithoutHumans);
DefeatedBecomesObserver = pINI->ReadBool(pSettingsSection, "DefeatedBecomesObserver", DefeatedBecomesObserver);
Observer_ShowAIOnSidebar = pINI->ReadBool(pSettingsSection, "Observer.ShowAIOnSidebar", Observer_ShowAIOnSidebar);
// TODO:
// QuickMatch = pINI->ReadBool(pSettingsSection, "QuickMatch", QuickMatch);
// RunAutoSS = pINI->ReadBool(pSettingsSection, "RunAutoSS", RunAutoSS);
}

constexpr char* PlayerSectionArray[8] = {
Expand Down
8 changes: 2 additions & 6 deletions src/Spawner/Spawner.Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,13 @@ class SpawnerConfig

// Extended Options
bool Ra2Mode;
bool QuickMatch;
bool SkipScoreScreen;
bool WriteStatistics;
bool AINamesByDifficulty;
bool ContinueWithoutHumans;
bool DefeatedBecomesObserver;
bool Observer_ShowAIOnSidebar;
// TODO:
// bool QuickMatch;
// bool RunAutoSS;

SpawnerConfig() // default values
// Game Mode Options
Expand Down Expand Up @@ -215,15 +213,13 @@ class SpawnerConfig

// Extended Options
, Ra2Mode { false }
, QuickMatch { false }
, SkipScoreScreen { Main::GetConfig()->SkipScoreScreen }
, WriteStatistics { false }
, AINamesByDifficulty { false }
, ContinueWithoutHumans { false }
, DefeatedBecomesObserver { false }
, Observer_ShowAIOnSidebar { false }
// TODO:
// , QuickMatch { false }
// , RunAutoSS { false }
{ }

void LoadFromINIFile(CCINIClass* pINI);
Expand Down

0 comments on commit d37011c

Please sign in to comment.