From 9c362c0d8f04a26cb5b44b383360c16b74f06e06 Mon Sep 17 00:00:00 2001 From: Blur Date: Sun, 8 Sep 2024 16:55:30 -0500 Subject: [PATCH] Add udmf support to doors keys portals treasures --- src/Lua/Gimmicks/doors.lua | 43 ++++++++++++++++++++++++-------- src/Lua/Gimmicks/keys.lua | 22 ++++++++++++---- src/Lua/Gimmicks/pizzaportal.lua | 2 +- src/Lua/Gimmicks/treasures.lua | 11 +++++--- 4 files changed, 58 insertions(+), 20 deletions(-) diff --git a/src/Lua/Gimmicks/doors.lua b/src/Lua/Gimmicks/doors.lua index addad94..fb51fe2 100644 --- a/src/Lua/Gimmicks/doors.lua +++ b/src/Lua/Gimmicks/doors.lua @@ -29,6 +29,14 @@ states[S_PTSR_DOOR_UNLOCKED] = { } mobjinfo[MT_PTSR_DOOR] = { + --$Category Spice Runners + --$Name Door + --$Sprite PDORA0 + --$Arg0 "Enter/Exit Type" + --$Arg0Type 11 + --$Arg0Enum { 0="Enter"; 1="Exit";} + --$Arg1 "Door/Key ID" + doomednum = 2111, radius = 20*FU, @@ -63,16 +71,16 @@ local function getPlayers(mo) return players end -local function assignDoors(mo, type, angle) +local function assignDoors(mo, type, id) if not (mo and mo.valid) then return end local oppositeType = type == "enter" and "exit" or "enter" - PTSR.doors[type][angle] = mo - mo.assignedType = angle + PTSR.doors[type][id] = mo + mo.assignedType = id - if PTSR.doors[oppositeType][angle] then - local mo2 = PTSR.doors[oppositeType][angle] + if PTSR.doors[oppositeType][id] then + local mo2 = PTSR.doors[oppositeType][id] if mo2 and mo.valid then mo.opposite_door = mo2 @@ -81,7 +89,7 @@ local function assignDoors(mo, type, angle) end if type == "enter" - and PTSR.keys[angle] then + and PTSR.keys[id] then mo.state = S_PTSR_DOOR_LOCKED -- LOCK IT GET THE KEY BITCH end @@ -103,11 +111,24 @@ addHook("MobjSpawn", function(mo) end, MT_PTSR_DOOR) addHook("MapThingSpawn", function(mo, thing) - local type = thing.extrainfo == 0 and "enter" or "exit" - local oppositeType = thing.extrainfo == 0 and "exit" or "enter" - - assignDoors(mo, type, thing.angle) - assignDoors(PTSR.doors[oppositeType][thing.angle], oppositeType, thing.angle) + local type + local oppositeType + local id = 0 + + if not udmf then + type = thing.extrainfo == 0 and "enter" or "exit" + oppositeType = thing.extrainfo == 0 and "exit" or "enter" + id = thing.angle + else + type = thing.args[0] == 0 and "enter" or "exit" + oppositeType = thing.args[0] == 0 and "exit" or "enter" + id = thing.args[1] + end + + if type and oppositeType then + assignDoors(mo, type, id) + assignDoors(PTSR.doors[oppositeType][id], oppositeType, id) + end end, MT_PTSR_DOOR) addHook("MobjThinker", function(mo) diff --git a/src/Lua/Gimmicks/keys.lua b/src/Lua/Gimmicks/keys.lua index c0f5c9e..2718b7d 100644 --- a/src/Lua/Gimmicks/keys.lua +++ b/src/Lua/Gimmicks/keys.lua @@ -26,6 +26,10 @@ local keyNotCaughtFlags = MF_SPECIAL local keyCaughtFlags = MF_NOCLIP|MF_NOCLIPHEIGHT|MF_NOGRAVITY mobjinfo[MT_PTSR_KEY] = { + --$Category Spice Runners + --$Name Key + --$Sprite PKEYA0 + --$Arg0 "Door/Key ID" doomednum = 2112, spawnstate = S_PTSR_KEY, @@ -124,10 +128,18 @@ addHook("PostThinkFrame", do end) addHook("MapThingSpawn", function(mo, thing) - PTSR.keys[thing.angle] = mo - mo.assignedType = thing.angle - - if not PTSR.doors["enter"][thing.angle] then return end + local id = 0 + + if not udmf then + id = thing.angle + else + id = thing.args[0] + end + + PTSR.keys[id] = mo + mo.assignedType = id + + if not PTSR.doors["enter"][id] then return end - PTSR.doors["enter"][thing.angle].state = S_PTSR_DOOR_LOCKED + PTSR.doors["enter"][id].state = S_PTSR_DOOR_LOCKED end, MT_PTSR_KEY) \ No newline at end of file diff --git a/src/Lua/Gimmicks/pizzaportal.lua b/src/Lua/Gimmicks/pizzaportal.lua index fb397a5..b39f6c2 100644 --- a/src/Lua/Gimmicks/pizzaportal.lua +++ b/src/Lua/Gimmicks/pizzaportal.lua @@ -10,7 +10,7 @@ freeslot("MT_PIZZAPORTAL", "S_PIZZAPORTAL", "SPR_P3PT", "sfx_lapin", "sfx_lapout mobjinfo[MT_PIZZAPORTAL] = { --$Name "Pizza Portal" - --$Sprite SPR_P3PT + --$Sprite P3PTA0 --$Category "Spice Runners" doomednum = 1417, spawnstate = S_PIZZAPORTAL, diff --git a/src/Lua/Gimmicks/treasures.lua b/src/Lua/Gimmicks/treasures.lua index 4ec88a3..e325170 100644 --- a/src/Lua/Gimmicks/treasures.lua +++ b/src/Lua/Gimmicks/treasures.lua @@ -1,12 +1,14 @@ +freeslot("MT_PTSR_TREASURE", "S_PTSR_TREASURE", "S_PTSR_TREASURE_EFFECT") + local TREASURE_SCORE_AWARD = 10000 -states[freeslot "S_PTSR_TREASURE"] = { +states[S_PTSR_TREASURE] = { sprite = freeslot "SPR_STRE", frame = A, tics = -1 } -states[freeslot "S_PTSR_TREASURE_EFFECT"] = { +states[S_PTSR_TREASURE_EFFECT] = { sprite = freeslot "SPR_TEFF", frame = FF_ANIMATE|A, tics = -1, @@ -14,7 +16,10 @@ states[freeslot "S_PTSR_TREASURE_EFFECT"] = { var2 = 1 } -mobjinfo[freeslot "MT_PTSR_TREASURE"] = { +mobjinfo[MT_PTSR_TREASURE] = { + --$Category Spice Runners + --$Name Treasure + --$Sprite STREA0 doomednum = 2113, radius = 16*FU, height = 16*FU,