Added feature to allow icon backgrounds.

Added VirtuesCollectibleX icons
This commit is contained in:
Wofsauge committed 2025-05-08 22:13:31 +02:00
1 parent 3a6b675280
commit b9f217eae3
3 files changed
+26 -8

No files matched your search

+16 -6
View File
@@ -1169,6 +1169,7 @@ end
---@return EID_Icon?
function EID:createItemIconObject(str)
local item = nil
local backgroundImage = ""
local subTypeIdentifier = 0
-- Check for {{Item#.##.###}} markup; easiest way to handle it is to just call this function again
@@ -1183,7 +1184,16 @@ function EID:createItemIconObject(str)
end
end
end
-- Add background image to Icon, if the keyword can be found in the markup string
for keyword, imagePath in pairs(EID.MarkupBackgroundKeywords) do
if string.find(str, keyword) then
str = string.gsub(str, keyword, "")
backgroundImage = imagePath
break
end
end
---@diagnostic disable
local collID,numReplace = string.gsub(str, "Collectible", "")
if numReplace > 0 and collID ~= "" and tonumber(collID) ~= nil then
@@ -1206,19 +1216,19 @@ function EID:createItemIconObject(str)
return {"Pills", tonumber(pillID % 2048)-1, 9, 8, 0, 1, EID.CardPillSprite}
end
---@diagnostic enable
if item == nil then
return nil
end
if dynamicSpriteCache[str] then
return dynamicSpriteCache[str]
if dynamicSpriteCache[backgroundImage .. str] then
return dynamicSpriteCache[backgroundImage .. str]
else
local spriteDummy = Sprite()
spriteDummy:Load("gfx/eid_inline_icons.anm2", true)
spriteDummy:ReplaceSpritesheet(0, backgroundImage)
spriteDummy:ReplaceSpritesheet(1, item.GfxFileName)
spriteDummy:LoadGraphics()
local newDynamicSprite = {"ItemIcon", subTypeIdentifier, 11, 8, -2, -2, spriteDummy}
dynamicSpriteCache[str] = newDynamicSprite
local newDynamicSprite = { "ItemIcon", subTypeIdentifier, 11, 8, -2, -2, spriteDummy }
dynamicSpriteCache[backgroundImage .. str] = newDynamicSprite
return newDynamicSprite
end
end
+6
View File
@@ -975,6 +975,12 @@ EID.RoomShapeToMarkup = { "{{Room}}", "{{RoomSmallHorizontal}}", "{{RoomSmallVer
EID.RoomTypeToMarkup = { "{{Room}}", "{{Shop}}", "{{ErrorRoom}}", "{{TreasureRoom}}", "{{BossRoom}}", "{{MiniBoss}}", "{{SecretRoom}}", "{{SuperSecretRoom}}", "{{ArcadeRoom}}", "{{CursedRoom}}", "{{ChallengeRoom}}", "{{Library}}", "{{SacrificeRoom}}", "{{DevilRoom}}", "{{AngelRoom}}", "{{LadderRoom}}", "{{Room}}" --[[boss rush]], "{{IsaacsRoom}}", "{{BarrenRoom}}", "{{ChestRoom}}", "{{DiceRoom}}", "{{Shop}}", "{{Room}}", --[[Black Market / Greed Exit]] "{{Planetarium}}", "{{Teleporter}}","{{Teleporter}}", "{{Room}}", "{{Room}}" --[[Blue Key rooms]], "{{UltraSecretRoom}}" }
EID.ItemPoolTypeToMarkup = { [0] = "{{ItemPoolTreasure}}", "{{ItemPoolShop}}", "{{ItemPoolBoss}}", "{{ItemPoolDevil}}", "{{ItemPoolAngel}}", "{{ItemPoolSecret}}", "{{ItemPoolLibrary}}", "{{ItemPoolShellGame}}", "{{ItemPoolGoldenChest}}", "{{ItemPoolRedChest}}", "{{ItemPoolBeggar}}", "{{ItemPoolDemonBeggar}}", "{{ItemPoolCurse}}", "{{ItemPoolKeyMaster}}", "{{ItemPoolBombBum}}", "{{ItemPoolMomsChest}}", "{{ItemPoolGreedTreasure}}", "{{ItemPoolGreedShop}}", "{{ItemPoolGreedBoss}}", "{{ItemPoolGreedDevil}}", "{{ItemPoolGreedAngel}}", "{{ItemPoolGreedCurse}}", "{{ItemPoolGreedSecret}}", "{{ItemPoolCraneGame}}", "{{ItemPoolUltraSecret}}", "{{ItemPoolBatteryBum}}", "{{ItemPoolPlanetarium}}", "{{ItemPoolOldChest}}", "{{ItemPoolBabyShop}}", "{{ItemPoolWoodenChest}}", "{{ItemPoolRottenBeggar}}"}
-- Background icon markup substrings
EID.MarkupBackgroundKeywords = {
["Virtues"] = "gfx/ui/hud_bookofvirtues.png",
}
-- additional offset of the textbox to the entity position. Only applies in local description mode.
-- If a function returns a value, it will be used as the offset
EID.LocalModePositionOffset = {
+4 -2
View File
@@ -1,5 +1,5 @@
<AnimatedActor>
<Info CreatedBy="Unknown" CreatedOn="5/7/2025 12:24:54 PM" Version="215" Fps="30"/>
<Info CreatedBy="Unknown" CreatedOn="07.05.2025 23:49:05" Version="216" Fps="30"/>
<Content>
<Spritesheets>
<Spritesheet Path="eid_inline_icons.png" Id="0"/>
@@ -276,7 +276,9 @@
<Frame XPosition="0" YPosition="0" XScale="100" YScale="100" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
</RootAnimation>
<LayerAnimations>
<LayerAnimation LayerId="0" Visible="true"/>
<LayerAnimation LayerId="0" Visible="true">
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="0" YCrop="0" Width="32" Height="32" XScale="50" YScale="50" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
</LayerAnimation>
<LayerAnimation LayerId="1" Visible="true">
<Frame XPosition="0" YPosition="0" XPivot="0" YPivot="0" XCrop="0" YCrop="0" Width="32" Height="32" XScale="50" YScale="50" Delay="1" Visible="true" RedTint="255" GreenTint="255" BlueTint="255" AlphaTint="255" RedOffset="0" GreenOffset="0" BlueOffset="0" Rotation="0" Interpolated="false"/>
</LayerAnimation>