[StartupMessages] Added startup messages for the user to let us warn them of things that we need to (steam not being on, not having correct combo of DLC installed). Menu still needs some work though
This commit is contained in:
parent
3cd287ae89
commit
358822d560
@ -83,6 +83,7 @@ namespace Components
|
||||
Loader::Register(new MinidumpUpload());
|
||||
Loader::Register(new StructuredData());
|
||||
Loader::Register(new ConnectProtocol());
|
||||
Loader::Register(new StartupMessages());
|
||||
|
||||
Loader::Pregame = false;
|
||||
}
|
||||
|
@ -101,3 +101,4 @@ namespace Components
|
||||
#include "Modules/MinidumpUpload.hpp"
|
||||
#include "Modules/StructuredData.hpp"
|
||||
#include "Modules/ConnectProtocol.hpp"
|
||||
#include "Modules/StartupMessages.hpp"
|
||||
|
@ -432,6 +432,8 @@ namespace Components
|
||||
void Maps::UpdateDlcStatus()
|
||||
{
|
||||
bool hasAllDlcs = true;
|
||||
bool * hasDlc = new bool[DlcPacks.size()];
|
||||
int i = 0;
|
||||
for (auto& pack : Maps::DlcPacks)
|
||||
{
|
||||
bool hasAllMaps = true;
|
||||
@ -445,10 +447,20 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
hasDlc[i++] = hasAllMaps;
|
||||
Dvar::Var(Utils::String::VA("isDlcInstalled_%d", pack.index)).setRaw(hasAllMaps ? 1 : 0);
|
||||
}
|
||||
|
||||
// Must have all of dlc 3 to 5 or it causes issues
|
||||
static bool sentMessage = false;
|
||||
if ((hasDlc[2] || hasDlc[3] || hasDlc[4]) && (!hasDlc[2] || !hasDlc[3] || !hasDlc[4]) && !sentMessage)
|
||||
{
|
||||
StartupMessages::AddMessage("Warning:\n You only have some of DLCs 3-5 which are all required to be installed to work. There may be issues with those maps.");
|
||||
sentMessage = true;
|
||||
}
|
||||
|
||||
Dvar::Var("isDlcInstalled_All").setRaw(hasAllDlcs ? 1 : 0);
|
||||
|
||||
}
|
||||
|
||||
void Maps::reallocateEntryPool()
|
||||
|
@ -697,6 +697,7 @@ namespace Components
|
||||
Menus::Add("ui_mp/mod_download_popmenu.menu");
|
||||
Menus::Add("ui_mp/popup_friends.menu");
|
||||
Menus::Add("ui_mp/menu_first_launch.menu");
|
||||
Menus::Add("ui_mp/startup_messages.menu");
|
||||
}
|
||||
|
||||
Menus::~Menus()
|
||||
|
42
src/Components/Modules/StartupMessages.cpp
Normal file
42
src/Components/Modules/StartupMessages.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
#include "STDInclude.hpp"
|
||||
|
||||
namespace Components
|
||||
{
|
||||
std::list<std::string> startupMessages;
|
||||
|
||||
int totalMessages = -1;
|
||||
|
||||
StartupMessages::StartupMessages()
|
||||
{
|
||||
Dvar::OnInit([]()
|
||||
{
|
||||
Dvar::Register<const char*>("ui_startupMessage", "", Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
Dvar::Register<const char*>("ui_startupMessageTitle", "", Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
Dvar::Register<const char*>("ui_startupNextButtonText", "", Game::DVAR_FLAG_USERCREATED | Game::DVAR_FLAG_WRITEPROTECTED, "");
|
||||
});
|
||||
|
||||
UIScript::Add("nextStartupMessage", [](UIScript::Token)
|
||||
{
|
||||
if (!startupMessages.size()) return;
|
||||
|
||||
if (totalMessages < 1)
|
||||
{
|
||||
totalMessages = startupMessages.size();
|
||||
}
|
||||
|
||||
std::string message = startupMessages.front();
|
||||
startupMessages.pop_front();
|
||||
|
||||
Game::Dvar_SetStringByName("ui_startupMessage", message.data());
|
||||
Game::Dvar_SetStringByName("ui_startupMessageTitle", Utils::String::VA("Messages (%d/%d)", totalMessages - startupMessages.size(), totalMessages));
|
||||
Game::Dvar_SetStringByName("ui_startupNextButtonText", startupMessages.size() ? "Next" : "Close");
|
||||
Game::Cbuf_AddText(0, "openmenu startup_messages");
|
||||
});
|
||||
}
|
||||
|
||||
void StartupMessages::AddMessage(std::string message)
|
||||
{
|
||||
startupMessages.push_back(message);
|
||||
}
|
||||
|
||||
}
|
16
src/Components/Modules/StartupMessages.hpp
Normal file
16
src/Components/Modules/StartupMessages.hpp
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
namespace Components
|
||||
{
|
||||
class StartupMessages : public Component
|
||||
{
|
||||
public:
|
||||
StartupMessages();
|
||||
|
||||
#if defined(DEBUG) || defined(FORCE_UNIT_TESTS)
|
||||
const char* getName() override { return "StartupMessages"; };
|
||||
#endif
|
||||
|
||||
static void AddMessage(std::string message);
|
||||
};
|
||||
}
|
@ -111,6 +111,7 @@ namespace Steam
|
||||
if (!Proxy::Inititalize())
|
||||
{
|
||||
OutputDebugStringA("Steamproxy not initialized properly");
|
||||
Components::StartupMessages::AddMessage("Warning:\nUnable to connet to Steam. Steam features will be unavailable");
|
||||
}
|
||||
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user