From 00d56b9657e9ec90357ef4f0a808e079884738c1 Mon Sep 17 00:00:00 2001 From: MsrSgtShooterPerson Date: Wed, 21 Aug 2024 22:46:08 +0800 Subject: [PATCH] Fixed facade texture picking not working, added direct removals of certain textures from use in general room theme textures. --- modules/zdoom_otex.lua | 95 +++++++++++++++++++++++++++++++++++------- 1 file changed, 81 insertions(+), 14 deletions(-) diff --git a/modules/zdoom_otex.lua b/modules/zdoom_otex.lua index 193d04083..1d12164ff 100644 --- a/modules/zdoom_otex.lua +++ b/modules/zdoom_otex.lua @@ -59,10 +59,60 @@ OTEX_EXCLUSIONS = -- teleporter flats TLPT = "all", + LGHT = "all", + -- outdoors GRSS = "all" } +-- some textures that must be removed manually from the DB +OTEX_DIRECT_REMOVALS = +{ + MRBL = + { + textures = + { + "OMRBLA90", + "OMRBLA91", + "OMBRLA92", + "OMBRLA93", + "OMBRLA94", + + "OMBRLC90", + + "OMBRLF29", + "OMBRLF38", + "OMBRLF90", + + "OMBRLG90", + + "OMRBLI92", + "OMRBLI93", + + "OMRBLJ90", + "OMRBLJ93", + + "OMRBLK90", + + "OMRBLO28", + "OMRBLO29", + + "OMBRLP90", + "OMBRLP91", + + "OMBRLR90", + "OMBRLR94" + } + } +} + +OTEX_THEME_RESTRICTIONS = +{ + MRBL = "hell", + BONE = "hell", + FLSH = "hell" +} + function OTEX_PROC_MODULE.setup(self) PARAM.OTEX_module_activated = true module_param_up(self) @@ -92,6 +142,15 @@ function OTEX_PROC_MODULE.synthesize_procedural_themes() end end + -- direct removals + for theme_group,_ in pairs(OTEX_DIRECT_REMOVALS) do + for img_group,_ in pairs(OTEX_DIRECT_REMOVALS[theme_group]) do + for _,tex in pairs(OTEX_DIRECT_REMOVALS[theme_group][img_group]) do + table.kill_elem(resource_tab[theme_group][img_group], tex) + end + end + end + for _,resource_group in pairs(resource_tab) do if resource_group.has_all then for _,T in pairs(resource_group.textures) do @@ -142,14 +201,21 @@ function OTEX_PROC_MODULE.synthesize_procedural_themes() -- try to create a consistent theme for i = 1, PARAM.float_otex_num_themes / 2 do - local grouping = {} - local room_theme = {} - local tab_pick, RT_name + local grouping, room_theme = {} + local tab_pick, RT_name, RT_theme while grouping and not grouping.has_all == true do grouping = resource_tab[rand.pick(group_choices)] end - RT_name = "any_OTEX_cons_" .. i + -- quick hack fix to prevent hell themes from appearing + -- on tech and urban + RT_theme = "any" + if OTEX_THEME_RESTRICTIONS[grouping] + and OTEX_THEME_RESTRICTIONS[grouping] == "hell" then + RT_theme = "hell" + end + + RT_name = RT_theme .. "_OTEX_cons_" .. i room_theme = { env = "building", @@ -181,7 +247,7 @@ function OTEX_PROC_MODULE.synthesize_procedural_themes() end tab_pick = rand.pick(grouping.flats) room_theme.ceilings[tab_pick] = 5 - RT_name = RT_name .. tab_pick .. "_" + RT_name = RT_name .. tab_pick room_theme.name = RT_name OTEX_ROOM_THEMES[RT_name] = room_theme @@ -227,20 +293,21 @@ function OTEX_PROC_MODULE.synthesize_procedural_themes() end -- insert into outdoor facades - for _,T in pairs(GAME.THEMES) do + for theme,table_group in pairs(GAME.THEMES) do local tab_pick, tex_pick, pick_num = 0 - tab_pick = rand.pick(group_choices) - - if T.facades then - for i = 1, 30 do - while not resource_tab[tab_pick].has_textures == true do + if GAME.THEMES[theme].facades then + for i = 1, 50 do + tab_pick = rand.pick(group_choices) + while resource_tab[tab_pick].has_textures == false do tab_pick = rand.pick(group_choices) end - pick_num = 5 - while not T.facades[tex_pick] and pick_num > 5 do + + local pick_num = 0 + tex_pick = rand.pick(resource_tab[tab_pick].textures) + while not GAME.THEMES[theme].facades[tex_pick] and pick_num < 5 do tex_pick = rand.pick(resource_tab[tab_pick].textures) - T.facades[tex_pick] = 25 + GAME.THEMES[theme].facades[tex_pick] = rand.pick({15,20,25,30}) pick_num = pick_num + 1 end end