From 73402653d3c7b6bbc345b43167098fe2d653a503 Mon Sep 17 00:00:00 2001 From: Wofsauge Date: Wed, 21 Aug 2024 22:42:41 +0200 Subject: [PATCH] Added "HideUncollectedItemDescriptions" config option - Reworked QuestionMark rendering - Added QuestionMark Markdown closes #693 --- eid_config.lua | 5 ++++ features/eid_data.lua | 1 + features/eid_mcm.lua | 10 +++++-- features/eid_repentogon.lua | 2 +- main.lua | 55 ++++++++++++++++--------------------- 5 files changed, 38 insertions(+), 35 deletions(-) diff --git a/eid_config.lua b/eid_config.lua index 495fb596..5a6a3291 100644 --- a/eid_config.lua +++ b/eid_config.lua @@ -437,6 +437,10 @@ EID.UserConfig = { -- Default: 0 (Deactivate all Savegame features) ["SaveGameNumber"] = 0, + -- Hides descriptions of items, if they are not collected in the collection page + -- Default: false + ["HideUncollectedItemDescriptions"] = false, + -- Highlight items, if they need to be collected for the collection page -- Default: true ["ItemCollectionIndicator"] = true, @@ -627,6 +631,7 @@ EID.DefaultConfig = { ["SpindownDiceDisplayName"] = false, ["SpindownDiceSkipLocked"] = false, ["SaveGameNumber"] = 0, + ["HideUncollectedItemDescriptions"] = false, ["ItemCollectionIndicator"] = true, ["ItemCollectionColor"] = "ColorFade", ["EnableMouseControls"] = false, diff --git a/features/eid_data.lua b/features/eid_data.lua index db3c3e65..294f52da 100644 --- a/features/eid_data.lua +++ b/features/eid_data.lua @@ -654,6 +654,7 @@ EID.InlineIcons = { ["DailyRunSmall"] = {"Misc", 15, 12, 12, 0, 1}, ["MagnifyingLens"] = {"Misc", 16, 13, 13, 0, -1}, ["Padlock"] = {"Misc", 17, 8, 10, 1, 0}, + ["QuestionMark"] = {"CurseOfBlind", 0, 14, 14, 6, 7, EID.IconSprite}, } -- General Stats (Adjust automatically according to the current DLC) diff --git a/features/eid_mcm.lua b/features/eid_mcm.lua index 2e2627e0..3d3bec95 100644 --- a/features/eid_mcm.lua +++ b/features/eid_mcm.lua @@ -773,7 +773,9 @@ if MCMLoaded then MCM.AddSpace("EID", "Repentogon") end - EID:AddBooleanSetting("Repentogon", "ItemCollectionIndicator", "Highlight uncollected items",{ infoText = "Highlights items that are not yet on the collection page."}) + MCM.AddText("EID", "Repentogon", "Uncollected Items") + EID:AddBooleanSetting("Repentogon", "HideUncollectedItemDescriptions", "Hide uncollected items", { infoText = "Hide descriptions of items that are not yet on the collection page."}) + EID:AddBooleanSetting("Repentogon", "ItemCollectionIndicator", "Highlight uncollected items", { infoText = "Highlights items that are not yet on the collection page."}) -- Needs collection Color MCM.AddSetting( "EID", @@ -788,7 +790,7 @@ if MCMLoaded then Display = function() if EID.Config["ItemCollectionColor"] == nil then EID.Config["ItemCollectionColor"] = EID.DefaultConfig["ItemCollectionColor"] end EID.MCMCompat_isDisplayingEIDTab = "Visuals"; - return "Collection Page Highlight color: " .. string.gsub(EID.Config["ItemCollectionColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ItemCollectionColor"]).."/"..#colorNameArray..")" + return "Highlight color: " .. string.gsub(EID.Config["ItemCollectionColor"], "Color", "").. " ("..AnIndexOf(colorNameArray, EID.Config["ItemCollectionColor"]).."/"..#colorNameArray..")" end, OnChange = function(currentNum) EID.MCM_OptionChanged = true @@ -799,6 +801,7 @@ if MCMLoaded then Info = {"Highlight color for the names of items that need to be picked up for the collection page."} } ) + MCM.AddSpace("EID", "Repentogon") EID:AddBooleanSetting("Repentogon", "RGON_ShowOnCollectionPage", "Show descriptions on collection page", { infoText = "Displays item effects when navigating the collection page in the main menu."}) -- Achievement tracking section @@ -847,7 +850,8 @@ if MCMLoaded then return "Collection page items missing: "..count end) MCM.AddSpace("EID", "Save Game") - EID:AddBooleanSetting("Repentogon", "ItemCollectionIndicator", "Highlight uncollected items") + EID:AddBooleanSetting("Save Game", "HideUncollectedItemDescriptions", "Hide uncollected items", { infoText = "Hide descriptions of items that are not yet on the collection page."}) + EID:AddBooleanSetting("Save Game", "ItemCollectionIndicator", "Highlight uncollected items") -- Needs collection Color MCM.AddSetting( "EID", diff --git a/features/eid_repentogon.lua b/features/eid_repentogon.lua index 55baa207..16e8f0c2 100644 --- a/features/eid_repentogon.lua +++ b/features/eid_repentogon.lua @@ -73,7 +73,7 @@ function EID:OnMenuRender() end local demoDescObj = EID:getDescriptionObj(5, 100, CollectibleId, nil, false) if CollectibleId < maxVanillaItemID and not Isaac.GetPersistentGameData():IsItemInCollection(CollectibleId) then - EID:renderQuestionMark(nil) + EID:printDescription({Icon = EID.InlineIcons["QuestionMark"], Description = description or "", Entity = entity}, nil) return end diff --git a/main.lua b/main.lua index 94736867..b562f930 100644 --- a/main.lua +++ b/main.lua @@ -469,6 +469,10 @@ function EID:addDescriptionToPrint(desc, insertLoc) if desc.Entity then EID.entitiesToPrint[GetPtrHash(desc.Entity)] = true end end +function EID:addQuestionMarkDescription(entity, description) + EID:addDescriptionToPrint({ Icon = EID.InlineIcons["QuestionMark"], Description = description or "", Entity = entity}) +end + local prevPrintFrame = 0 function EID:printDescriptions(useCached) @@ -515,10 +519,6 @@ function EID:printNewDescriptions() if EID:renderUnidentifiedPill(newDesc.Entity) ~= false then table.insert(EID.previousDescs, newDesc) end - elseif newDesc.Description == "QuestionMark" then - if EID:renderQuestionMark(newDesc.Entity) ~= false then - table.insert(EID.previousDescs, newDesc) - end elseif EID:printDescription(newDesc) ~= false then table.insert(EID.previousDescs, newDesc) end @@ -600,7 +600,7 @@ function EID:printDescription(desc, cachedID) end --Display Itemname local curName = "" - if EID.Config["ShowItemName"] then + if EID.Config["ShowItemName"] and desc.Name then curName = desc.Name if EID.Config["TranslateItemName"] ~= 2 then local curLanguage = EID.Config["Language"] @@ -617,7 +617,7 @@ function EID:printDescription(desc, cachedID) end end -- Display Entity ID - if EID.Config["ShowObjectID"] and desc.ObjType > 0 then + if EID.Config["ShowObjectID"] and desc.ObjType and desc.ObjType > 0 then curName = curName.." {{ColorGray}}"..desc.ObjType.."."..desc.ObjVariant.."."..desc.ObjSubType end -- Display Quality @@ -649,7 +649,7 @@ function EID:printDescription(desc, cachedID) renderPos.Y = renderPos.Y + EID.lineHeight * EID.Scale --Display Transformation - if not (desc.Transformation == "0" or desc.Transformation == "" or desc.Transformation == nil) then + if desc.Transformation and not (desc.Transformation == "0" or desc.Transformation == "") then for transform in string.gmatch(desc.Transformation, "([^,]+)") do --have a blank sprite info table if we aren't displaying it local transformSprite = EID.Config["TransformationIcons"] and EID:getTransformationIcon(transform) or {} @@ -694,7 +694,7 @@ function EID:printDescription(desc, cachedID) end end -- Display Last Pool for Collectible for full reroll effects (name) - if EID.isRepentance and not EID.InsideItemReminder and EID.Config["ShowItemPoolText"] and (desc.ObjType == 5 and desc.ObjVariant == 100) then + if EID.isRepentance and not EID.InsideItemReminder and EID.Config["ShowItemPoolText"] and (desc.ObjType and desc.ObjType == 5 and desc.ObjVariant and desc.ObjVariant == 100) then local itemConfig = EID.itemConfig:GetCollectible(desc.ObjSubType) if itemConfig:IsCollectible() and not itemConfig:HasTags(ItemConfig.TAG_QUEST) then local lastPool = game:GetItemPool():GetLastPool() @@ -799,22 +799,6 @@ EID:AddCallback(ModCallbacks.MC_EXECUTE_CMD, EID.onCmd) --------------------------------------------------------------------------- ---------------------------Handle Rendering-------------------------------- -function EID:renderQuestionMark(entity) - EID:PositionLocalMode(entity) - if EID.CurrentScaleType == "Size" then - if alwaysUseLocalMode then return false - else alwaysUseLocalMode = true end - end - EID.IconSprite:Play("CurseOfBlind") - local pos = EID:getTextPosition() - if EID.CachingDescription then - table.insert(EID.CachedStrings, {}) - table.insert(EID.CachedIcons, {}) - table.insert(EID.CachedRenderPoses, Vector(pos.X, pos.Y)) - end - EID:renderIcon(EID.IconSprite, pos.X + 5 * EID.Scale, pos.Y + 5 * EID.Scale, nil, "CurseOfBlind", 0) -end - function EID:renderUnidentifiedPill(entity) EID:PositionLocalMode(entity) if EID.CurrentScaleType == "Size" then @@ -1457,8 +1441,11 @@ function EID:OnRender() -- Handle Glitched Items elseif closest.Type == 5 and closest.Variant == 100 and closest.SubType > 4294960000 then if EID:getEntityData(closest, "EID_DontHide") ~= true then - if (REPENTOGON and closest:ToPickup():IsBlind()) or (EID:hasCurseBlind() and not closest:ToPickup().Touched and EID.Config["DisableOnCurse"] and not EID.isDeathCertRoom) or (EID.Config["DisableOnAltPath"] and not closest:ToPickup().Touched and EID:IsAltChoice(closest)) or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then - EID:addDescriptionToPrint({ Description = "QuestionMark", Entity = closest}) + if (REPENTOGON and closest:ToPickup():IsBlind()) + or (EID:hasCurseBlind() and not closest:ToPickup().Touched and EID.Config["DisableOnCurse"] and not EID.isDeathCertRoom) + or (EID.Config["DisableOnAltPath"] and not closest:ToPickup().Touched and EID:IsAltChoice(closest)) + or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then + EID:addQuestionMarkDescription(closest) end end @@ -1494,7 +1481,7 @@ function EID:OnRender() if EID.CraneItemType[tostring(closest.InitSeed)] or EID.CraneItemType[closest.InitSeed.."Drop"..closest.DropSeed] then if EID:getEntityData(closest, "EID_DontHide") ~= true then if (EID:hasCurseBlind() and EID.Config["DisableOnCurse"]) or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then - EID:addDescriptionToPrint({ Description = "QuestionMark", Entity = closest}) + EID:addQuestionMarkDescription(closest) end end local collectibleID = EID.CraneItemType[closest.InitSeed.."Drop"..closest.DropSeed] or EID.CraneItemType[tostring(closest.InitSeed)] @@ -1515,8 +1502,14 @@ function EID:OnRender() elseif closest.Variant == PickupVariant.PICKUP_COLLECTIBLE then --Handle Collectibles if EID:getEntityData(closest, "EID_DontHide") ~= true then - if (REPENTOGON and closest:ToPickup():IsBlind()) or (EID:hasCurseBlind() and not closest:ToPickup().Touched and EID.Config["DisableOnCurse"] and not EID.isDeathCertRoom) or (EID.Config["DisableOnAltPath"] and not closest:ToPickup().Touched and EID:IsAltChoice(closest)) or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then - EID:addDescriptionToPrint({ Description = "QuestionMark", Entity = closest}) + local isHideUncollected = EID.Config["HideUncollectedItemDescriptions"] and EID:requiredForCollectionPage(closest.SubType) + if (REPENTOGON and closest:ToPickup():IsBlind()) + or isHideUncollected + or (EID:hasCurseBlind() and not closest:ToPickup().Touched and EID.Config["DisableOnCurse"] and not EID.isDeathCertRoom) + or (EID.Config["DisableOnAltPath"] and not closest:ToPickup().Touched and EID:IsAltChoice(closest)) + or (game.Challenge == Challenge.CHALLENGE_APRILS_FOOL and EID.Config["DisableOnAprilFoolsChallenge"]) then + local description = isHideUncollected and EID:getDescriptionEntry("CollectionPageInfo") or nil + EID:addQuestionMarkDescription(closest, description) end end local descriptionObj = EID:getDescriptionObjByEntity(closest) @@ -1532,7 +1525,7 @@ function EID:OnRender() (not EID.Config["DisplayObstructedSoulstoneInfo"] and isSoulstone)) and (not pathsChecked[closest.InitSeed] and not attemptPathfind(closest)) if isOptionsSpawn or hideinShop or obstructed then - EID:addDescriptionToPrint({ Description = "QuestionMark", Entity = closest}) + EID:addQuestionMarkDescription(closest) end end local isCantrippedCard = game.Challenge == 43 and closest.SubType > 32768 @@ -1552,7 +1545,7 @@ function EID:OnRender() local obstructed = not EID.Config["DisplayObstructedPillInfo"] and (not pathsChecked[closest.InitSeed] and not attemptPathfind(closest)) if isOptionsSpawn or hideinShop or obstructed then - EID:addDescriptionToPrint({ Description = "QuestionMark", Entity = closest}) + EID:addQuestionMarkDescription(closest) end end