mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-14 10:37:17 -07:00
dev -> dev-rando
This commit is contained in:
commit
f4fc3662b6
12 changed files with 109 additions and 49 deletions
|
@ -113,6 +113,23 @@ std::map<SceneID, RandomizerCheckArea> DungeonRCAreasBySceneID = {
|
|||
{SCENE_INSIDE_GANONS_CASTLE, RCAREA_GANONS_CASTLE},
|
||||
};
|
||||
|
||||
// Dungeon entrances with obvious visual differences between MQ and vanilla qualifying as spoiling on sight
|
||||
std::vector<uint32_t> spoilingEntrances = {
|
||||
0x0000, // ENTR_DEKU_TREE_0
|
||||
0x0467, // ENTR_DODONGOS_CAVERN_1
|
||||
0x0028, // ENTR_JABU_JABU_0
|
||||
0x0407, // ENTR_JABU_JABU_1
|
||||
0x0169, // ENTR_FOREST_TEMPLE_0
|
||||
0x0165, // ENTR_FIRE_TEMPLE_0
|
||||
0x0175, // ENTR_FIRE_TEMPLE_1
|
||||
0x0423, // ENTR_WATER_TEMPLE_1
|
||||
0x0082, // ENTR_SPIRIT_TEMPLE_0
|
||||
0x02B2, // ENTR_SHADOW_TEMPLE_1
|
||||
0x0088, // ENTR_ICE_CAVERN_0
|
||||
0x0008, // ENTR_GERUDO_TRAINING_GROUNDS_0
|
||||
0x0467 // ENTR_INSIDE_GANONS_CASTLE_0
|
||||
};
|
||||
|
||||
std::map<RandomizerCheckArea, std::vector<RandomizerCheck>> checksByArea;
|
||||
bool areasFullyChecked[RCAREA_INVALID];
|
||||
u32 areasSpoiled = 0;
|
||||
|
@ -270,6 +287,10 @@ void SetCheckCollected(RandomizerCheck rc) {
|
|||
}
|
||||
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
|
||||
|
||||
if (!IsAreaSpoiled(loc->GetArea())) {
|
||||
SetAreaSpoiled(loc->GetArea());
|
||||
}
|
||||
|
||||
doAreaScroll = true;
|
||||
UpdateOrdering(loc->GetArea());
|
||||
UpdateInventoryChecks();
|
||||
|
@ -490,6 +511,15 @@ void CheckTrackerLoadGame(int32_t fileNum) {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (int i = RCAREA_KOKIRI_FOREST; i < RCAREA_INVALID; i++) {
|
||||
if (!IsAreaSpoiled(static_cast<RandomizerCheckArea>(i)) && (RandomizerCheckObjects::AreaIsOverworld(static_cast<RandomizerCheckArea>(i)) || !IS_RANDO ||
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_RANDOM) == RO_MQ_DUNGEONS_NONE ||
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_RANDOM) == RO_MQ_DUNGEONS_SELECTION ||
|
||||
(OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_RANDOM) == RO_MQ_DUNGEONS_SET_NUMBER &&
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_COUNT) == 12))) {
|
||||
SetAreaSpoiled(static_cast<RandomizerCheckArea>(i));
|
||||
}
|
||||
}
|
||||
if (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_LINKS_POCKET) != RO_LINKS_POCKET_NOTHING && IS_RANDO) {
|
||||
s8 startingAge = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_STARTING_AGE);
|
||||
RandomizerCheckArea startingArea;
|
||||
|
@ -556,6 +586,9 @@ void CheckTrackerTransition(uint32_t sceneNum) {
|
|||
SetShopSeen(sceneNum, false);
|
||||
break;
|
||||
}
|
||||
if (!IsAreaSpoiled(currentArea) && (RandomizerCheckObjects::AreaIsOverworld(currentArea) || std::find(spoilingEntrances.begin(), spoilingEntrances.end(), gPlayState->nextEntranceIndex) != spoilingEntrances.end())) {
|
||||
SetAreaSpoiled(currentArea);
|
||||
}
|
||||
}
|
||||
|
||||
void CheckTrackerFrame() {
|
||||
|
@ -775,6 +808,7 @@ void CheckTrackerFlagSet(int16_t flagType, int32_t flag) {
|
|||
|
||||
void InitTrackerData(bool isDebug) {
|
||||
TrySetAreas();
|
||||
areasSpoiled = 0;
|
||||
for (auto& loc : Rando::StaticData::GetLocationTable()) {
|
||||
if (loc.GetRandomizerCheck() != RC_UNKNOWN_CHECK && loc.GetRandomizerCheck() != RC_MAX) {
|
||||
DefaultCheckData(loc.GetRandomizerCheck());
|
||||
|
@ -801,6 +835,7 @@ void SaveTrackerData(SaveContext* saveContext, int sectionID, bool gameSave) {
|
|||
SaveManager::Instance->SaveData("hintItem", saveContext->checkTrackerData[i].hintItem);
|
||||
});
|
||||
});
|
||||
SaveManager::Instance->SaveData("areasSpoiled", areasSpoiled);
|
||||
}
|
||||
|
||||
void SaveFile(SaveContext* saveContext, int sectionID, bool fullSave) {
|
||||
|
@ -816,6 +851,7 @@ void LoadFile() {
|
|||
SaveManager::Instance->LoadData("hintItem", gSaveContext.checkTrackerData[i].hintItem);
|
||||
});
|
||||
});
|
||||
SaveManager::Instance->LoadData("areasSpoiled", areasSpoiled);
|
||||
}
|
||||
|
||||
void Teardown() {
|
||||
|
@ -827,6 +863,15 @@ void Teardown() {
|
|||
lastLocationChecked = RC_UNKNOWN_CHECK;
|
||||
}
|
||||
|
||||
bool IsAreaSpoiled(RandomizerCheckArea rcArea) {
|
||||
return areasSpoiled & (1 << rcArea);
|
||||
}
|
||||
|
||||
void SetAreaSpoiled(RandomizerCheckArea rcArea) {
|
||||
areasSpoiled |= (1 << rcArea);
|
||||
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
|
||||
}
|
||||
|
||||
void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) {
|
||||
auto area = Rando::StaticData::GetLocation(static_cast<RandomizerCheck>(check))->GetArea();
|
||||
if ((!gSaveContext.checkTrackerData[check].skipped && data.skipped) ||
|
||||
|
@ -845,10 +890,6 @@ void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) {
|
|||
void CheckTrackerWindow::DrawElement() {
|
||||
ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver);
|
||||
|
||||
if (!initialized && (gPlayState == nullptr || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
|
||||
if (CVarGetInteger("gCheckTrackerShowOnlyPaused", 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) {
|
||||
return;
|
||||
|
@ -869,7 +910,7 @@ void CheckTrackerWindow::DrawElement() {
|
|||
|
||||
BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar);
|
||||
|
||||
if (!GameInteractor::IsSaveLoaded()) {
|
||||
if (!GameInteractor::IsSaveLoaded() || !initialized) {
|
||||
ImGui::Text("Waiting for file load..."); //TODO Language
|
||||
EndFloatWindows();
|
||||
return;
|
||||
|
@ -880,8 +921,6 @@ void CheckTrackerWindow::DrawElement() {
|
|||
sceneId = (SceneID)gPlayState->sceneNum;
|
||||
}
|
||||
|
||||
areasSpoiled |= (1 << currentArea);
|
||||
|
||||
//Quick Options
|
||||
#ifdef __WIIU__
|
||||
float headerHeight = 40.0f;
|
||||
|
@ -943,7 +982,6 @@ void CheckTrackerWindow::DrawElement() {
|
|||
Color_RGBA8 mainColor;
|
||||
Color_RGBA8 extraColor;
|
||||
std::string stemp;
|
||||
s32 areaMask = 1;
|
||||
|
||||
for (auto& [rcArea, checks] : checksByArea) {
|
||||
RandomizerCheckArea thisArea = currentArea;
|
||||
|
@ -996,11 +1034,7 @@ void CheckTrackerWindow::DrawElement() {
|
|||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f,
|
||||
extraColor.b / 255.0f, extraColor.a / 255.0f));
|
||||
|
||||
isThisAreaSpoiled = areasSpoiled & areaMask || CVarGetInteger("gCheckTrackerOptionMQSpoilers", 0) || !IS_RANDO ||
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_RANDOM) == RO_MQ_DUNGEONS_NONE ||
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_RANDOM) == RO_MQ_DUNGEONS_SELECTION ||
|
||||
(OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_RANDOM) == RO_MQ_DUNGEONS_SET_NUMBER &&
|
||||
OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_MQ_DUNGEON_COUNT) == 12);
|
||||
isThisAreaSpoiled = IsAreaSpoiled(rcArea) || CVarGetInteger("gCheckTrackerOptionMQSpoilers", 0);
|
||||
|
||||
if (isThisAreaSpoiled) {
|
||||
if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(rcArea)) {
|
||||
|
@ -1031,7 +1065,6 @@ void CheckTrackerWindow::DrawElement() {
|
|||
ImGui::TreePop();
|
||||
}
|
||||
}
|
||||
areaMask <<= 1;
|
||||
}
|
||||
|
||||
ImGui::EndTable(); //Checks Lead-out
|
||||
|
@ -1250,10 +1283,10 @@ bool IsVisibleInCheckTracker(RandomizerCheck rc) {
|
|||
}
|
||||
|
||||
void UpdateInventoryChecks() {
|
||||
//For all the areas with compasses, if you have one, spoil the area
|
||||
//For all the areas with maps, if you have one, spoil the area
|
||||
for (auto [scene, area] : DungeonRCAreasBySceneID) {
|
||||
if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, scene)) {
|
||||
areasSpoiled |= (1 << area);
|
||||
SetAreaSpoiled(area);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1263,9 +1296,6 @@ void UpdateAreaFullyChecked(RandomizerCheckArea area) {
|
|||
|
||||
void UpdateAreas(RandomizerCheckArea area) {
|
||||
areasFullyChecked[area] = areaChecksGotten[area] == checksByArea.find(area)->second.size();
|
||||
if (areaChecksGotten[area] != 0 || RandomizerCheckObjects::AreaIsOverworld(area)) {
|
||||
areasSpoiled |= (1 << area);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateAllOrdering() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue