Fix spoiler loading, setting more defaults, archi console crash fix + styling
This commit is contained in:
@@ -349,7 +349,7 @@ void Context::SetSpoilerLoaded(const bool spoilerLoaded) {
|
||||
|
||||
void Context::AddReceivedArchipelagoItem(const RandomizerGet item) {
|
||||
mAPreceiveQueue.emplace(item);
|
||||
std::string logMessage = "[LOG] Item Pushed: " + item;
|
||||
std::string logMessage = "[LOG] Item Pushed: " + std::to_string(item);
|
||||
ArchipelagoConsole_SendMessage(logMessage.c_str(), true);
|
||||
}
|
||||
|
||||
@@ -428,8 +428,10 @@ void Context::ParseArchipelago() {
|
||||
ArchipelagoClient& ap_client = ArchipelagoClient::GetInstance();
|
||||
ParseArchipelagoItemsLocations(ap_client.GetScoutedItems());
|
||||
ParseArchipelagoOptions(ap_client.GetSlotData());
|
||||
mEntranceShuffler->UnshuffleAllEntrances();
|
||||
mDungeons->ResetAllDungeons();
|
||||
mTrials->RemoveAllTrials();
|
||||
|
||||
// lets see if counting AP_loaded as spoiler loaded does the trick
|
||||
mSpoilerLoaded = true;
|
||||
mSeedGenerated = false;
|
||||
}
|
||||
|
||||
@@ -259,4 +259,11 @@ void Dungeons::ParseJson(nlohmann::json spoilerFileJson) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Dungeons::ResetAllDungeons() {
|
||||
for (auto& dungeon : dungeonList) {
|
||||
dungeon.ClearMQ();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Rando
|
||||
|
||||
@@ -90,6 +90,7 @@ class Dungeons {
|
||||
std::array<DungeonInfo*, 12> GetDungeonList();
|
||||
size_t GetDungeonListSize() const;
|
||||
void ParseJson(nlohmann::json spoilerFileJson);
|
||||
void ResetAllDungeons();
|
||||
|
||||
private:
|
||||
std::array<DungeonInfo, 12> dungeonList;
|
||||
|
||||
@@ -85,6 +85,12 @@ void Trials::ParseJson(nlohmann::json spoilerFileJson) {
|
||||
}
|
||||
}
|
||||
|
||||
void Trials::RemoveAllTrials() {
|
||||
for (auto& trial : mTrials) {
|
||||
trial.SetAsSkipped();
|
||||
}
|
||||
}
|
||||
|
||||
std::unordered_map<uint32_t, RandomizerHintTextKey> Trials::GetAllTrialHintHeys() const {
|
||||
std::unordered_map<uint32_t, RandomizerHintTextKey> output = {};
|
||||
for (auto trial : mTrials) {
|
||||
|
||||
@@ -37,6 +37,7 @@ class Trials {
|
||||
std::vector<TrialInfo*> GetTrialList();
|
||||
size_t GetTrialListSize() const;
|
||||
void ParseJson(nlohmann::json spoilerFileJson);
|
||||
void RemoveAllTrials();
|
||||
std::unordered_map<uint32_t, RandomizerHintTextKey> GetAllTrialHintHeys() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -10,7 +10,7 @@ bool autoScroll = true;
|
||||
using namespace UIWidgets;
|
||||
|
||||
void ArchipelagoConsole_SendMessage(const char* fmt, bool debugMessage, ...) {
|
||||
if (debugMessage && CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("DebugEnabled"), 0) == 0) {
|
||||
if (debugMessage && !CVarGetInteger(CVAR_REMOTE_ARCHIPELAGO("DebugEnabled"), 0)) {
|
||||
return;
|
||||
}
|
||||
char buf[1024];
|
||||
@@ -73,14 +73,20 @@ void ArchipelagoConsoleWindow::DrawElement() {
|
||||
ImGui::SetKeyboardFocusHere();
|
||||
keepFocus = false;
|
||||
}
|
||||
|
||||
PushStyleInput(THEME_COLOR);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(10.0f, 8.0f));
|
||||
if (ImGui::InputText("##AP_MessageField", textEntryBuf, 1023, ImGuiInputTextFlags_EnterReturnsTrue)) {
|
||||
ArchipelagoClient::GetInstance().SendMessageToConsole(std::string(textEntryBuf));
|
||||
textEntryBuf[0] = '\0';
|
||||
keepFocus = true;
|
||||
}
|
||||
// keepFocus = ImGui::IsItemActive();
|
||||
ImGui::PopStyleVar();
|
||||
PopStyleInput();
|
||||
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Send")) {
|
||||
|
||||
if (UIWidgets::Button("Send", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(ImVec2(0.0, 0.0)))) {
|
||||
ArchipelagoClient::GetInstance().SendMessageToConsole(std::string(textEntryBuf));
|
||||
textEntryBuf[0] = '\0';
|
||||
keepFocus = true;
|
||||
|
||||
@@ -32,6 +32,7 @@ void ArchipelagoSettingsWindow::DrawElement() {
|
||||
UIWidgets::CVarInputString("##ArchipelagoPassword", CVAR_REMOTE_ARCHIPELAGO("Password"),
|
||||
UIWidgets::InputOptions()
|
||||
.Color(THEME_COLOR)
|
||||
.IsSecret(true)
|
||||
.Size(ImVec2(ImGui::GetFontSize() * 15, 0))
|
||||
.LabelPosition(UIWidgets::LabelPositions::None));
|
||||
ImGui::PopStyleColor();
|
||||
|
||||
@@ -1053,6 +1053,7 @@ void FileChoose_UpdateRandomizer() {
|
||||
}
|
||||
|
||||
if (!SpoilerFileExists(CVarGetString(CVAR_GENERAL("SpoilerLog"), "")) &&
|
||||
!fileSelectArchipelagoLoaded &&
|
||||
!CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) {
|
||||
CVarSetString(CVAR_GENERAL("SpoilerLog"), "");
|
||||
Randomizer_SetSpoilerLoaded(false);
|
||||
|
||||
Reference in New Issue
Block a user