mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-01 13:52:19 -05:00
Check Tracker - Item List
- Fixes item list not updating when changing seeds/options - Separates item exclusion list from item check list - Clean up comments
This commit is contained in:
parent
ad10807ca0
commit
648fe17532
@ -919,7 +919,6 @@ void LocationTable_Init() {
|
|||||||
|
|
||||||
locationTable[GANONDORF_HINT] = ItemLocation::OtherHint(RC_GANONDORF_HINT, 0x00, 0x00, "Ganondorf Hint", {});
|
locationTable[GANONDORF_HINT] = ItemLocation::OtherHint(RC_GANONDORF_HINT, 0x00, 0x00, "Ganondorf Hint", {});
|
||||||
|
|
||||||
// TODO also update the Add/Remove/Etc functions
|
|
||||||
for (int i = NONE; i != KEY_ENUM_MAX; i++)
|
for (int i = NONE; i != KEY_ENUM_MAX; i++)
|
||||||
locationLookupTable.insert(std::make_pair(locationTable[i].GetRandomizerCheck(), static_cast<Key>(i)));
|
locationLookupTable.insert(std::make_pair(locationTable[i].GetRandomizerCheck(), static_cast<Key>(i)));
|
||||||
}
|
}
|
||||||
|
@ -921,7 +921,7 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() {
|
|||||||
for (auto& [randomizerCheck, locationIt] : rcObjects) {
|
for (auto& [randomizerCheck, locationIt] : rcObjects) {
|
||||||
locationIt.visibleInImgui = (
|
locationIt.visibleInImgui = (
|
||||||
(locationIt.vOrMQ != RCVORMQ_MQ) && // don't show MQ checks until we support MQ
|
(locationIt.vOrMQ != RCVORMQ_MQ) && // don't show MQ checks until we support MQ
|
||||||
//(locationIt.rcType != RCTYPE_SHOP) && // don't show shop items until we have shopsanity
|
((locationIt.rcType != RCTYPE_SHOP) || CVar_GetS32("gRandomizeShopsanity", 0) > 1) && // 1 is the value for "0 random items" for shop
|
||||||
(locationIt.rcType != RCTYPE_GOSSIP_STONE) && // don't show gossip stones (maybe gossipsanity will be a thing eventually?)
|
(locationIt.rcType != RCTYPE_GOSSIP_STONE) && // don't show gossip stones (maybe gossipsanity will be a thing eventually?)
|
||||||
(locationIt.rcType != RCTYPE_LINKS_POCKET) &&
|
(locationIt.rcType != RCTYPE_LINKS_POCKET) &&
|
||||||
(locationIt.rcType != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
|
(locationIt.rcType != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
|
||||||
@ -949,3 +949,36 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RandomizerCheckObjects::UpdateTrackerImGuiVisibility() {
|
||||||
|
for (auto& [randomizerCheck, locationIt] : rcObjects) {
|
||||||
|
locationIt.visibleInImgui = (
|
||||||
|
(locationIt.rcArea != RCAREA_INVALID) && // don't show Invalid locations
|
||||||
|
(locationIt.vOrMQ != RCVORMQ_MQ) && // don't show MQ checks until we support MQ
|
||||||
|
((locationIt.rcType != RCTYPE_SHOP) || CVar_GetS32("gRandomizeShopsanity", 0) > 1) && // 1 is the value for "0 random items" for shop
|
||||||
|
(locationIt.rcType != RCTYPE_GOSSIP_STONE) && // don't show gossip stones (maybe gossipsanity will be a thing eventually?)
|
||||||
|
(locationIt.rcType != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them
|
||||||
|
((locationIt.rcType != RCTYPE_SKULL_TOKEN) ||
|
||||||
|
(CVar_GetS32("gRandomizeShuffleTokens", 0) == 3) || // all tokens
|
||||||
|
((CVar_GetS32("gRandomizeShuffleTokens", 0) == 2) && RandomizerCheckObjects::AreaIsOverworld(locationIt.rcArea)) || // overworld tokens
|
||||||
|
((CVar_GetS32("gRandomizeShuffleTokens", 0) == 1) && RandomizerCheckObjects::AreaIsDungeon(locationIt.rcArea)) // dungeon tokens
|
||||||
|
) &&
|
||||||
|
((locationIt.rcType != RCTYPE_COW) || CVar_GetS32("gRandomizeShuffleCows", 0)) &&
|
||||||
|
((locationIt.rcType != RCTYPE_ADULT_TRADE) || CVar_GetS32("gRandomizeShuffleAdultTrade", 0)) &&
|
||||||
|
((locationIt.rc != RC_KF_KOKIRI_SWORD_CHEST) || CVar_GetS32("gRandomizeShuffleKokiriSword", 0)) &&
|
||||||
|
((locationIt.rc != RC_HC_MALON_EGG) || CVar_GetS32("gRandomizeShuffleWeirdEgg", 0)) &&
|
||||||
|
((locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD) || CVar_GetS32("gRandomizeShuffleGerudoToken", 0)) &&
|
||||||
|
((locationIt.rcType != RCTYPE_FROG_SONG) || CVar_GetS32("gRandomizeShuffleFrogSongRupees", 0)) &&
|
||||||
|
((locationIt.rcType != RCTYPE_MAP_COMPASS) || CVar_GetS32("gRandomizeStartingMapsCompasses", 0) != 1) && // 1 is the value for "vanilla" maps/compasses
|
||||||
|
((locationIt.rcType != RCTYPE_SMALL_KEY) || CVar_GetS32("gRandomizeKeysanity", 0) != 1) && // 1 is the value for "vanilla" small keys
|
||||||
|
((locationIt.rcType != RCTYPE_GF_KEY) || CVar_GetS32("randoShuffleGerudoFortressKeys", 0) != 0) && // 0 is the value for "vanilla" gf keys
|
||||||
|
((locationIt.rcType != RCTYPE_BOSS_KEY) || CVar_GetS32("gRandomizeBossKeysanity", 0) != 1) && // 1 is the value for "vanilla" boss keys
|
||||||
|
((locationIt.rcType != RCTYPE_GANON_BOSS_KEY) || CVar_GetS32("gRandomizeShuffleGanonBossKey", 0) != 0) && // 0 is the value for "vanilla" ganon's boss key
|
||||||
|
((!RC_IS_CARPENTER(locationIt.rc) && locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD) ||
|
||||||
|
(CVar_GetS32("gRandomizeGerudoFortress", 0) == 2 && !RC_IS_CARPENTER(locationIt.rc) && locationIt.rc != RC_GF_GERUDO_MEMBERSHIP_CARD) || //2 is the value for "open" gerudo's fortress
|
||||||
|
(CVar_GetS32("gRandomizeGerudoFortress", 0) == 1 && locationIt.rc == RC_GF_NORTH_F1_CARPENTER) || //1 is the value for "fast" gerudo's fortress
|
||||||
|
(CVar_GetS32("gRandomizeGerudoFortress", 0) == 0) //0 is the value for "normal" gerudo's fortress
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -70,7 +70,7 @@ typedef enum {
|
|||||||
#define TWO_ACTOR_PARAMS(a, b) (abs(a) << 16) | abs(b)
|
#define TWO_ACTOR_PARAMS(a, b) (abs(a) << 16) | abs(b)
|
||||||
|
|
||||||
#define RC_OBJECT(rc, rc_v_or_mq, rc_type, rc_area, actor_id, scene_id, actor_params, og_item_id, rc_shortname, rc_spoilername) \
|
#define RC_OBJECT(rc, rc_v_or_mq, rc_type, rc_area, actor_id, scene_id, actor_params, og_item_id, rc_shortname, rc_spoilername) \
|
||||||
{ rc, {rc, rc_v_or_mq, rc_type, rc_area, actor_id, scene_id, actor_params, og_item_id, false, rc_shortname, rc_spoilername} }
|
{ rc, {rc, rc_v_or_mq, rc_type, rc_area, actor_id, scene_id, actor_params, og_item_id, false, false, rc_shortname, rc_spoilername} }
|
||||||
|
|
||||||
#define RC_IS_CARPENTER(a) \
|
#define RC_IS_CARPENTER(a) \
|
||||||
(a == RC_GF_NORTH_F1_CARPENTER || \
|
(a == RC_GF_NORTH_F1_CARPENTER || \
|
||||||
@ -88,6 +88,7 @@ typedef struct {
|
|||||||
int32_t actorParams;
|
int32_t actorParams;
|
||||||
GetItemID ogItemId;
|
GetItemID ogItemId;
|
||||||
bool visibleInImgui;
|
bool visibleInImgui;
|
||||||
|
bool visibleInTrackerImgui;
|
||||||
std::string rcShortName;
|
std::string rcShortName;
|
||||||
std::string rcSpoilerName;
|
std::string rcSpoilerName;
|
||||||
} RandomizerCheckObject;
|
} RandomizerCheckObject;
|
||||||
@ -101,4 +102,5 @@ namespace RandomizerCheckObjects {
|
|||||||
std::map<SceneID, RandomizerCheckArea> GetAllRCAreaBySceneID();
|
std::map<SceneID, RandomizerCheckArea> GetAllRCAreaBySceneID();
|
||||||
RandomizerCheckArea GetRCAreaBySceneID(SceneID sceneId);
|
RandomizerCheckArea GetRCAreaBySceneID(SceneID sceneId);
|
||||||
void UpdateImGuiVisibility();
|
void UpdateImGuiVisibility();
|
||||||
|
void UpdateTrackerImGuiVisibility();
|
||||||
}
|
}
|
||||||
|
@ -642,8 +642,8 @@ void DrawNotes(bool resizeable = false) {
|
|||||||
bool HasItemBeenCollected(RandomizerCheckObject obj) {
|
bool HasItemBeenCollected(RandomizerCheckObject obj) {
|
||||||
// TODO doesn't consider vanilla/MQ?
|
// TODO doesn't consider vanilla/MQ?
|
||||||
|
|
||||||
// return Location(obj.rc)->GetCollectionCheck().IsChecked(gSaveContext); //TODO move all the code to a static
|
// TODO move all the code to a static function in item_location
|
||||||
// function in item_location
|
// return Location(obj.rc)->GetCollectionCheck().IsChecked(gSaveContext);
|
||||||
|
|
||||||
ItemLocation* x = Location(obj.rc);
|
ItemLocation* x = Location(obj.rc);
|
||||||
SpoilerCollectionCheck check = x->GetCollectionCheck();
|
SpoilerCollectionCheck check = x->GetCollectionCheck();
|
||||||
@ -784,27 +784,6 @@ void DrawLocations() {
|
|||||||
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text(locationIt.second.rcShortName.c_str());
|
ImGui::Text(locationIt.second.rcShortName.c_str());
|
||||||
// TODO if the check has been hinted, show the hint's value beside the check
|
|
||||||
// TODO if the check has been rendered, show its (fake) name beside the check
|
|
||||||
|
|
||||||
// gSaveContext.itemLocations[0].get.rgID;
|
|
||||||
// Show the name of the check and the item gotten
|
|
||||||
// ImGui::Text(ItemTable(gSaveContext.itemLocations[locationIt.rc].get.rgID).GetName().english.c_str());
|
|
||||||
// //TODO This is hardcoded english
|
|
||||||
// ImGui::Text(ItemTableManager::Instance->RetrieveItemEntry(MOD_RANDOMIZER,
|
|
||||||
// gSaveContext.itemLocations[locationIt.rc].get.rgID).
|
|
||||||
|
|
||||||
// ImGui::Text(
|
|
||||||
// OTRGlobals::Instance->gRandomizer->getItemMessageTableID(gSaveContext.itemLocations[locationIt.rc].get.rgID)
|
|
||||||
// .GetName()
|
|
||||||
// .english.c_str()); // TODO This is hardcoded english
|
|
||||||
// gSaveContext.itemLocations[locationIt.rc].get).GetName().english.c_str()
|
|
||||||
|
|
||||||
// name of the check is locationIt.rcShortName.c_str()
|
|
||||||
// ImGui::Text(locationIt.rcShortName.c_str());
|
|
||||||
|
|
||||||
// ImGui::Text(gSaveContext.itemLocations[locationIt.rc].check);
|
|
||||||
// OTRGlobals::Instance->gRandomizer->GetRandomizerGetDataFromKnownCheck(locationIt.rc));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -866,8 +845,6 @@ void DrawLocations() {
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::Text("(%s)", txt.c_str());
|
ImGui::Text("(%s)", txt.c_str());
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
// TODO GetItemObtainabilityFromRandomizerGet(rgData.rgID).CAN_OBTAIN or something to
|
|
||||||
// determine if it should say blue rupee
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ImGui::TreePop();
|
ImGui::TreePop();
|
||||||
@ -1318,11 +1295,12 @@ void InitItemTracker() {
|
|||||||
Ship::RegisterHook<Ship::LoadFile>([](uint32_t fileNum) {
|
Ship::RegisterHook<Ship::LoadFile>([](uint32_t fileNum) {
|
||||||
const char* initialTrackerNotes = CVar_GetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
const char* initialTrackerNotes = CVar_GetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
||||||
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
|
strcpy(itemTrackerNotes.Data, initialTrackerNotes);
|
||||||
|
RandomizerCheckObjects::UpdateTrackerImGuiVisibility();
|
||||||
});
|
});
|
||||||
Ship::RegisterHook<Ship::DeleteFile>([](uint32_t fileNum) {
|
Ship::RegisterHook<Ship::DeleteFile>([](uint32_t fileNum) {
|
||||||
CVar_SetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
CVar_SetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), "");
|
||||||
SohImGui::RequestCvarSaveOnNextTick();
|
SohImGui::RequestCvarSaveOnNextTick();
|
||||||
});
|
});
|
||||||
RandomizerCheckObjects::UpdateImGuiVisibility();
|
RandomizerCheckObjects::UpdateTrackerImGuiVisibility();
|
||||||
LocationTable_Init();
|
LocationTable_Init();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user