diff --git a/CMakeLists.txt b/CMakeLists.txt index a6770928c7..8891e28a61 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,7 @@ add_subdirectory(source_files/ajpoly_src) add_subdirectory(source_files/physfs_src) add_subdirectory(source_files/zdbsp_src) add_subdirectory(source_files/slump_src) -add_subdirectory(source_files/fltk_src) add_subdirectory(source_files/zlib_src) -add_subdirectory(source_files/fmt_src) project( obsidian @@ -163,26 +161,47 @@ target_include_directories(obsidian PRIVATE source_files/ajpoly_src) target_include_directories(obsidian PRIVATE source_files/zdbsp_src) target_include_directories(obsidian PRIVATE source_files/lua_src) target_include_directories(obsidian PRIVATE source_files/slump_src) -target_include_directories(obsidian PRIVATE source_files/fltk_src) target_include_directories(obsidian PRIVATE source_files/zlib_src) target_include_directories(obsidian PRIVATE source_files/fmt_src/include) -if(MINGW) +if(MINGW OR WIN32) target_compile_definitions(obsidian PRIVATE WIN32) else() target_compile_definitions(obsidian PRIVATE UNIX) endif() +find_package(FLTK 1.3) + +if(FLTK_FOUND) + target_link_libraries(obsidian PRIVATE ${FLTK_LIBRARIES}) +else() + # use vendored version + add_subdirectory(source_files/fltk_src) + target_link_libraries(obsidian PRIVATE fltk fltk_images) + target_include_directories(obsidian PRIVATE source_files/fltk_src) +endif() + +if(UNIX) + find_package(X11 REQUIRED) + target_link_libraries(obsidian PRIVATE X11::Xft) +endif() + +# Copies executables to local install directory after build +if(UNIX) + add_custom_command(TARGET obsidian POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_BINARY_DIR}/obsidian" "${CMAKE_CURRENT_LIST_DIR}" + COMMAND "${CMAKE_COMMAND}" -E copy "${CMAKE_BINARY_DIR}/source_files/ff_src/filename_formatter" "${CMAKE_CURRENT_LIST_DIR}/tools" + ) +endif() + target_link_libraries( obsidian - PRIVATE fltk - fltk_images - zlibstatic + PRIVATE zlibstatic obsidian_lua obsidian_physfs obsidian_acc obsidian_ajpoly obsidian_zdbsp obsidian_slump - fmt::fmt + fontconfig ) diff --git a/INSTALL.md b/INSTALL.md index 5e6849a35b..f3f83cf68b 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -16,7 +16,7 @@ 4. FLTK 1.3 * website: http://www.fltk.org/ * package: `libfltk1.3-dev` - * You may also need: `libxft-dev` `libxinerama-dev` `libjpeg-dev` `libpng-dev` + * You may also need: `libxft-dev` `libxinerama-dev` `libjpeg-dev` `libpng-dev` `libfontconfig1-dev` 5. zlib * website: http://www.zlib.net/ @@ -25,7 +25,7 @@ 6. FLEX * package: `flex` -7. Code formatting tools +7. Code formatting tools (optional) * package: `clang-tidy` * python package (install with pip): `cmakelang` @@ -39,8 +39,6 @@ will build the Obsidian binary. (The '>' is just the prompt) > cmake .. > make (-j# optional, with # being the number of cores you'd like to use) > cd .. - > cp build/obsidian . - > cp build/source_files/ff_src/filename_formatter ./tools Then, obsidian can be launched with: @@ -57,7 +55,7 @@ Similar to the above directions: > cmake .. -DCMAKE_TOOLCHAIN_FILE=../Toolchain-mingw64.cmake (use Toolchain-mingw32.cmake for a 32-bit build) > make (-j# optional, with # being the number of cores you'd like to use) > cd .. - > cp build/obsidian.exe + > cp build/obsidian.exe . > cp build/source_files/ff_src/filename_formatter.exe ./tools diff --git a/games/doom/fabs/cage/gtd_cage_building_side.lua b/games/doom/fabs/cage/gtd_cage_building_side.lua index eed72d4968..b1e66ac1e6 100644 --- a/games/doom/fabs/cage/gtd_cage_building_side.lua +++ b/games/doom/fabs/cage/gtd_cage_building_side.lua @@ -85,6 +85,8 @@ PREFABS.Cage_wall_building_terrace_tall = template = "Cage_wall_building_terrace", map = "MAP02", + height = 264, + tex_CITY02 = { CITY01 = 50, diff --git a/games/doom/fabs/cage/mogwaltz_trap_eye.lua b/games/doom/fabs/cage/mogwaltz_trap_eye.lua index 2f6b913fd7..25a1bdafa4 100644 --- a/games/doom/fabs/cage/mogwaltz_trap_eye.lua +++ b/games/doom/fabs/cage/mogwaltz_trap_eye.lua @@ -1,4 +1,7 @@ -PREFABS.Cage_secret_trap_shootable_eye = +-- TO-DO: Needs redesigning such that monsters are not left stuck inside the bunker. +-- Switches also need to be redesigned such that it's impossible to fail triggering all lines. + +--[[PREFABS.Cage_secret_trap_shootable_eye = { file = "joiner/mogwaltz_trap_eye.wad", map = "MAP01", @@ -28,4 +31,4 @@ PREFABS.Cage_secret_trap_shootable_eye_pair = map = "MAP02", prob = 37, -} +}]] diff --git a/games/doom/fabs/item/dem_item_gamble.wad b/games/doom/fabs/item/dem_item_gamble.wad index b190e81433..aea0948255 100644 Binary files a/games/doom/fabs/item/dem_item_gamble.wad and b/games/doom/fabs/item/dem_item_gamble.wad differ diff --git a/games/doom/fabs/item/dem_secret_closets.wad b/games/doom/fabs/item/dem_secret_closets.wad index 6cd7198988..166e15aa5d 100644 Binary files a/games/doom/fabs/item/dem_secret_closets.wad and b/games/doom/fabs/item/dem_secret_closets.wad differ diff --git a/games/doom/fabs/item/mogwaltz_item_eye.lua b/games/doom/fabs/item/mogwaltz_item_eye.lua index fef49ac1a3..5dfbe4a99e 100644 --- a/games/doom/fabs/item/mogwaltz_item_eye.lua +++ b/games/doom/fabs/item/mogwaltz_item_eye.lua @@ -1,4 +1,6 @@ -PREFABS.Item_secret_item_shootable_eye = +-- TO-DO: Redesign switches to be more reliable and resolve monsters being stuck to spawn positions. + +--[[PREFABS.Item_secret_item_shootable_eye = { file = "item/mogwaltz_item_eye.wad", map = "MAP01", @@ -26,4 +28,4 @@ PREFABS.Item_secret_item_shootable_eye_pair = map = "MAP02", prob = 37, -} +}]] diff --git a/games/doom/fabs/item/scionox_secrets_tech.wad b/games/doom/fabs/item/scionox_secrets_tech.wad index 934dba65a5..602c0b76fd 100644 Binary files a/games/doom/fabs/item/scionox_secrets_tech.wad and b/games/doom/fabs/item/scionox_secrets_tech.wad differ diff --git a/games/doom/fabs/item/scionox_secrets_tech2.wad b/games/doom/fabs/item/scionox_secrets_tech2.wad index fc1020d286..4a2ad7f467 100644 Binary files a/games/doom/fabs/item/scionox_secrets_tech2.wad and b/games/doom/fabs/item/scionox_secrets_tech2.wad differ diff --git a/games/doom/fabs/joiner/gtd_infestation_simple.lua b/games/doom/fabs/joiner/gtd_infestation_simple.lua index 0fbff922da..8c57be3ced 100644 --- a/games/doom/fabs/joiner/gtd_infestation_simple.lua +++ b/games/doom/fabs/joiner/gtd_infestation_simple.lua @@ -2,7 +2,7 @@ -- Disgusting eww pls -- -PREFABS.Joiner_infestation_caveout = +--[[PREFABS.Joiner_infestation_caveout = { file = "joiner/gtd_infestation_simple.wad", map = "MAP01", @@ -56,4 +56,4 @@ PREFABS.Joiner_natural_caveout = MIDVINE2 = 1, ZZWOLF10 = 10 -- invisibility tex }, -} +}]] diff --git a/games/doom/fabs/joiner/gtd_infestation_simple.wad b/games/doom/fabs/joiner/gtd_infestation_simple.wad index e3e5048963..51e7b2b0a6 100644 Binary files a/games/doom/fabs/joiner/gtd_infestation_simple.wad and b/games/doom/fabs/joiner/gtd_infestation_simple.wad differ diff --git a/games/doom/fabs/joiner/mogwaltz_secret_eye.lua b/games/doom/fabs/joiner/mogwaltz_secret_eye.lua index d97d7c4cd2..6115afd8ac 100644 --- a/games/doom/fabs/joiner/mogwaltz_secret_eye.lua +++ b/games/doom/fabs/joiner/mogwaltz_secret_eye.lua @@ -1,4 +1,6 @@ -PREFABS.Joiner_secret_secret_shootable_eye = +-- TO-DO: Switches need to be redesigned such that it's impossible to fail triggering all lines. + +--[[PREFABS.Joiner_secret_secret_shootable_eye = { file = "joiner/mogwaltz_secret_eye.wad", map = "MAP01", @@ -23,7 +25,7 @@ PREFABS.Joiner_secret_secret_shootable_eye = solid_ents = true, } ---[[PREFABS.Joiner_secret_secret_shootable_eye_pick_one = +PREFABS.Joiner_secret_secret_shootable_eye_pick_one = { template = "Joiner_secret_secret_shootable_eye", map = "MAP02", @@ -37,7 +39,7 @@ PREFABS.Joiner_secret_secret_shootable_eye_pick_one_b = map = "MAP03", prob = 18, -}]] +} PREFABS.Joiner_secret_secret_shootable_eye_nodickmove = { @@ -57,4 +59,4 @@ PREFABS.Joiner_secret_secret_shootable_eye_nodickmove_b = prob = 18, y_fit = { 128,140 }, -} +}]] diff --git a/games/doom/fabs/joiner/scionox_guardpost.lua b/games/doom/fabs/joiner/scionox_guardpost.lua index ef8eb55e15..e4be8efbd6 100644 --- a/games/doom/fabs/joiner/scionox_guardpost.lua +++ b/games/doom/fabs/joiner/scionox_guardpost.lua @@ -84,6 +84,8 @@ PREFABS.Joiner_scionox_guardpost_all = template = "Joiner_scionox_guardpost", map = "MAP04", + engine = "!limit", -- TIL there's a lot of missing all-key lines for traditional Doom... + key = "k_ALL", y_fit = { 68,76 , 184,188 }, diff --git a/games/doom/fabs/picture/dem_pic_commercial_set.lua b/games/doom/fabs/picture/dem_pic_commercial_set.lua index be0a68109a..f559a0174a 100644 --- a/games/doom/fabs/picture/dem_pic_commercial_set.lua +++ b/games/doom/fabs/picture/dem_pic_commercial_set.lua @@ -4,7 +4,7 @@ PREFABS.Pic_dem_commercial_set1 = file = "picture/dem_pic_commercial_set.wad", map = "MAP01", -rank = 1, + rank = 1, prob = 250, theme = "urban", @@ -13,6 +13,7 @@ rank = 1, where = "seeds", height = 104, + deep = 16, theme = "urban", env = "building", diff --git a/games/doom/fabs/picture/dem_pic_commercial_set.wad b/games/doom/fabs/picture/dem_pic_commercial_set.wad index ff94744cf3..cd1108410f 100644 Binary files a/games/doom/fabs/picture/dem_pic_commercial_set.wad and b/games/doom/fabs/picture/dem_pic_commercial_set.wad differ diff --git a/games/doom/fabs/stairs/frozsoul_620_lift_128.lua b/games/doom/fabs/stairs/frozsoul_620_lift_128.lua index de56ca2341..b0723853e1 100644 --- a/games/doom/fabs/stairs/frozsoul_620_lift_128.lua +++ b/games/doom/fabs/stairs/frozsoul_620_lift_128.lua @@ -1,10 +1,12 @@ -PREFABS.lift_620_128 = +PREFABS.Lift_620_128 = { file = "stairs/frozsoul_620_lift_128.wad", prob = 10, prob_skew = 1.5, + engine = "!limit", + theme = "!hell", style = "steepness", @@ -22,3 +24,13 @@ PREFABS.lift_620_128 = delta_h = 128, plain_ceiling = true, } + +PREFABS.Lift_620_128_limit = +{ + template = "Lift_620_128", + + engine = "limit", + + line_13369 = 120, + line_13371 = 123 +} diff --git a/games/doom/fabs/stairs/frozsoul_620_lift_128.wad b/games/doom/fabs/stairs/frozsoul_620_lift_128.wad index fc4d7fb59f..45b4caebce 100644 Binary files a/games/doom/fabs/stairs/frozsoul_620_lift_128.wad and b/games/doom/fabs/stairs/frozsoul_620_lift_128.wad differ diff --git a/games/doom/fabs/stairs/gtd_lift_disguised_128.lua b/games/doom/fabs/stairs/gtd_lift_disguised_128.lua index b07ff11931..6f71baf4cf 100644 --- a/games/doom/fabs/stairs/gtd_lift_disguised_128.lua +++ b/games/doom/fabs/stairs/gtd_lift_disguised_128.lua @@ -6,6 +6,8 @@ PREFABS.Lift_gtd_disguised_128 = file = "stairs/gtd_lift_disguised_128.wad", map = "MAP01", + engine = "!limit", + prob = 10, prob_skew = 2, @@ -26,7 +28,16 @@ PREFABS.Lift_gtd_disguised_128 = plain_ceiling = true, } -PREFABS.Lift_gtd_disguised_128_2h = +PREFABS.Lift_gtd_disguised_128_limit = +{ + template = "Lift_gtd_disguised_128", + + engine = "limit", + + line_13364 = 123 +} + +--[[PREFABS.Lift_gtd_disguised_128_2h = { template = "Lift_gtd_disguised_128", map = "MAP02", @@ -40,4 +51,4 @@ PREFABS.Lift_gtd_disguised_128_3h = map = "MAP03", seed_h = 3, -} +}]] diff --git a/games/doom/fabs/stairs/gtd_lift_disguised_64.lua b/games/doom/fabs/stairs/gtd_lift_disguised_64.lua index ca11a03267..a6179963c7 100644 --- a/games/doom/fabs/stairs/gtd_lift_disguised_64.lua +++ b/games/doom/fabs/stairs/gtd_lift_disguised_64.lua @@ -3,6 +3,8 @@ PREFABS.Lift_gtd_disguised_64 = file = "stairs/gtd_lift_disguised_64.wad", map = "MAP01", + engine = "!limit", + prob = 10, prob_skew = 2, @@ -16,6 +18,7 @@ PREFABS.Lift_gtd_disguised_64 = seed_w = 1, x_fit = "frame", + y_fit = "top", bound_z1 = 0, @@ -23,7 +26,16 @@ PREFABS.Lift_gtd_disguised_64 = plain_ceiling = true, } -PREFABS.Lift_gtd_disguised_64_2h = +PREFABS.Lift_gtd_disguised_64_limit = +{ + template = "Lift_gtd_disguised_64", + + engine = "limit", + + line_13364 = 123 +} + +--[[PREFABS.Lift_gtd_disguised_64_2h = { template = "Lift_gtd_disguised_64", map = "MAP02", @@ -37,4 +49,4 @@ PREFABS.Lift_gtd_disguised_64_3h = map = "MAP03", seed_h = 3, -} +}]] diff --git a/games/doom/shapes.lua b/games/doom/shapes.lua index 74666c0bf4..378c870bc3 100644 --- a/games/doom/shapes.lua +++ b/games/doom/shapes.lua @@ -3737,7 +3737,7 @@ GROW_LIQUID_FIGURE_CORRIDOR = }, }, -GROW_LIQUID_BRIDGE_CORRIDOR = +GROW_LIQUID_SQUEEZE_CORRIDOR = { prob = 5, skip_prob = 65, @@ -3759,7 +3759,7 @@ GROW_LIQUID_BRIDGE_CORRIDOR = }, }, -GROW_LIQUID_BRIDGE_CORRIDOR_CROSSING = +GROW_LIQUID_SQUEEZE_GAP_CROSSING = { prob = 5, skip_prob = 65, @@ -3782,6 +3782,31 @@ GROW_LIQUID_BRIDGE_CORRIDOR_CROSSING = }, }, +GROW_LIQUID_SQUEEZE_GAP_CROSSING_STAIR = +{ + prob = 4, + skip_prob = 75, + + structure = + { + "...","111", + "...","111", + "...","1v1", + "...","%A/", + "...","~A~", + "...","/A%", + "...","1^1", + "...","111", + "x1x","x1x", + }, + + diagonals = + { + "~1","1~", + "~1","1~", + }, +}, + GROW_LIQUID_PLATFORM_FUNNEL = { prob = 20, @@ -6122,6 +6147,104 @@ GROW_MAZE_STRAIGHT_CAGE_ALT = } }, +-- [LARGE MAZE] + +GROW_LARGE_MAZE_LONG = +{ + prob = 10, + skip_prob = 50, + + structure = + { + "x..x","x11x", + "x..x","x11x", + "....","!11!", + "....","!11!", + "....","!11!", + "....","!11!", + "x11x","x11x", + "x11x","x11x", + } +}, + +GROW_LARGE_MAZE_LONGER = +{ + prob = 7, + skip_prob = 65, + + structure = + { + "x..x","x11x", + "x..x","x11x", + "....","!11!", + "....","!11!", + "....","!11!", + "....","!11!", + "....","!11!", + "....","!11!", + "x11x","x11x", + "x11x","x11x", + } +}, + +GROW_LARGE_MAZE_LONG_BANDS = +{ + prob = 10, + skip_prob = 50, + + structure = + { + "x..x","x11x", + "x..x","x11x", + "....","!AA!", + "....","!11!", + "....","!11!", + "....","!AA!", + "x11x","x11x", + "x11x","x11x", + } +}, + +GROW_LARGE_MAZE_CROSS = +{ + prob = 7, + skip_prob = 65, + + structure = + { + "xxxx..xxxx","xxxx11xxxx", + "xxxx..xxxx","xxxx11xxxx", + "xxx....xxx","xxx!11!xxx", + "xx......xx","xx!!11!!xx", + "..........","1111111111", + "..........","1111111111", + "xx......xx","xx!!11!!xx", + "xxx....xxx","xxx!11!xxx", + "xxxx11xxxx","xxxx11xxxx", + "xxxx11xxxx","xxxx11xxxx", + } +}, + +GROW_LARGE_MAZE_CROSS_NEW_AREA = +{ + prob = 7, + skip_prob = 65, + + structure = + { + "xxxx..xxxx","xxxx11xxxx", + "xxxx..xxxx","xxxx11xxxx", + "xxx....xxx","xxx!11!xxx", + "xx......xx","xx!!AA!!xx", + "..........","111A11A111", + "..........","111A11A111", + "xx......xx","xx!!AA!!xx", + "xxx....xxx","xxx!11!xxx", + "xxxx11xxxx","xxxx11xxxx", + "xxxx11xxxx","xxxx11xxxx", + } +}, + -- [TWO-WAYS] GROW_TWO_WAY_SMALL = diff --git a/modules/gzdoom_marine_closet.lua b/modules/gzdoom_marine_closet.lua index e4a48bcd73..62b64f973d 100644 --- a/modules/gzdoom_marine_closet.lua +++ b/modules/gzdoom_marine_closet.lua @@ -1376,9 +1376,9 @@ function MARINE_CLOSET_TUNE.calc_closets() kind = "marine_closet", min_count = 1, max_count = PARAM.marine_closets, - not_start = true, - min_prog = 0, - max_prog = 1, + min_prog = PARAM.float_m_c_level_min_pos, + max_prog = PARAM.float_m_c_level_max_pos, + not_secret = PARAM.bool_m_c_in_secrets, level_prob = 100, } @@ -1505,7 +1505,7 @@ OB_MODULES["gzdoom_marine_closets"] = }, tooltip=_( - "[WIP/Experimental]This module adds customizable closets to the map filled with friendly ai marines."), + "[WIP/Experimental]This module adds customizable closets to the map filled with friendly AI marines."), options = { @@ -1513,7 +1513,7 @@ OB_MODULES["gzdoom_marine_closets"] = { name = "float_m_c_chance", label = _("Chance per map"), - priority = 99, + priority = 157, valuator = "slider", units = "%", min = 0, @@ -1529,7 +1529,7 @@ OB_MODULES["gzdoom_marine_closets"] = { name = "float_m_c_min", label = _("Minimum closets"), - priority = 98, + priority = 156, valuator = "slider", units = "", min = 1, @@ -1544,7 +1544,7 @@ OB_MODULES["gzdoom_marine_closets"] = { name = "float_m_c_max", label = _("Maximum closets"), - priority = 97, + priority = 155, valuator = "slider", units = "", min = 1, @@ -1559,7 +1559,7 @@ OB_MODULES["gzdoom_marine_closets"] = { name = "m_c_type", label = _("Closet scaling type"), - priority = 96, + priority = 154, choices = MARINE_CLOSET_TUNE.SCALING, default = "default", tooltip = "Affects how min and max work for closet count:\n\n" .. @@ -1574,7 +1574,7 @@ OB_MODULES["gzdoom_marine_closets"] = { name = "float_m_c_m_min", label = _("Minimum marines"), - priority = 95, + priority = 153, valuator = "slider", units = "", min = 1, @@ -1589,7 +1589,7 @@ OB_MODULES["gzdoom_marine_closets"] = { name = "float_m_c_m_max", label = _("Maximum marines"), - priority = 94, + priority = 152, valuator = "slider", units = "", min = 1, @@ -1604,7 +1604,7 @@ OB_MODULES["gzdoom_marine_closets"] = { name = "float_m_c_health", label = _("Marine Health"), - priority = 93, + priority = 151, valuator = "slider", units = "", min = 25, @@ -1619,7 +1619,7 @@ OB_MODULES["gzdoom_marine_closets"] = { name = "m_c_m_type", label = _("Marine scaling type"), - priority = 92, + priority = 150, choices = MARINE_CLOSET_TUNE.SCALING, default = "default", tooltip = "Affects how min and max work for marine count:\n\n" .. @@ -1629,6 +1629,36 @@ OB_MODULES["gzdoom_marine_closets"] = "Regressive/Regressive episodic: Goes from max to min through game or episode" , }, + float_m_c_level_min_pos = + { + name = "float_m_c_level_min_pos", + label = _("Level Min Position"), + priority = 93, + valuator = "slider", + units = "", + min = 0, + max = 1, + increment = 0.05, + default = 0.5, + presets = "0:0 (Start Room), " .. + "1:1 (Exit Room), " + }, + + float_m_c_level_max_pos = + { + name = "float_m_c_level_max_pos", + label = _("Level Max Position"), + priority = 92, + valuator = "slider", + units = "", + min = 0, + max = 1, + increment = 0.05, + default = 0.5, + presets = "0:0 (Start Room), " .. + "1:1 (Exit Room), " + }, + m_c_tech = { name = "m_c_ttech", @@ -1658,6 +1688,7 @@ OB_MODULES["gzdoom_marine_closets"] = "Range: Closet activates when player is close enough, even if behind wall.\n" .. "Close Range: same as range except requires player to be really really close.\n" .. "Map Start: Closets are active on map start.", + gap = 1 }, m_c_color = @@ -1682,7 +1713,7 @@ OB_MODULES["gzdoom_marine_closets"] = "Additionally if self damage variant is chosen marines can still get hurt by exploding barrels and such", }, - bool_m_c_pdamage = + bool_m_c_pdamage = { name = "bool_m_c_pdamage", label = _("Player Damage Immunity"), @@ -1757,15 +1788,24 @@ OB_MODULES["gzdoom_marine_closets"] = tooltip = "Allows or disallows marine closets to spawn on gotchas and boss generator levels.", }, - bool_m_c_rip = + bool_m_c_rip = { name = "bool_m_c_rip", - label = _("Death messages"), + label = _("Death Messages"), priority = 78, valuator = "button", default = 0, tooltip = "If enabled, will print a message in message log whenever a marine dies.", }, + bool_m_c_in_secret = + { + name = "bool_mc_in_secret", + label = _("In Secret Rooms"), + priority = 77, + valuator = "button", + default = 0, + tooltip = "If enabled, allowed marine closets to be built in secret rooms." + } }, } diff --git a/modules/iwad_mode.lua b/modules/iwad_mode.lua index 48b44ab0e0..d33ee1e812 100644 --- a/modules/iwad_mode.lua +++ b/modules/iwad_mode.lua @@ -905,6 +905,7 @@ E1M1 = parks = "none", fences = "none" }, + -- E1M2 Approximate map dimensions: 5,300 x 3,900 nap units E1M2 = { @@ -932,6 +933,7 @@ E1M2 = big_rooms = "few", big_outdoor_rooms = "few" }, + -- E1M3 Approximate map dimensions: 4,100 x 3,050 map units E1M3 = { @@ -956,6 +958,7 @@ E1M3 = parks = "none", switches = "some" }, + -- E1M4 Approximate map dimensions: 3,700 x 2,800 map units E1M4 = { @@ -983,6 +986,7 @@ E1M4 = porches = "none", fences = "none" }, + -- E1M5 Approximate map dimensions: 4,000 x 3,200 map units E1M5 = { @@ -1009,6 +1013,7 @@ E1M5 = symmetry = "some", pictures = "some" }, + -- E1M6 Approximate map dimensions: 5,800 x 4,900 map units E1M6 = { @@ -1035,6 +1040,7 @@ E1M6 = fences = "few", porches = "some" }, + -- E1M7 Approximate map dimensions: 4,000 x 3,400 map units E1M7 = { @@ -1063,6 +1069,7 @@ E1M7 = switches = "some", beams = "none" }, + -- E1M8 Approximate map dimensions: 6,600 x 7,100 map units E1M8 = { @@ -1090,6 +1097,7 @@ E1M8 = hallways = "few", liquids = "none" }, + -- E1M9 Approximate map dimensions: 3,400 x 3,200 map units E1M9 = { @@ -1115,7 +1123,7 @@ E1M9 = keys = "heaps", trikeys = "some", switches = "some", - symmetry = "heaps", + symmetry = "heaps" }, -- E2M1 Approximate map dimensions: 2,600 x 2,000 map units @@ -1148,6 +1156,156 @@ E2M1 = fences = "none" }, +-- E2M2 Approximate map dimensions: 3,100 x 5,200 map units +E2M2 = +{ + outdoors = "none", + caves = "none", + parks = "none", + liquids = "few", + hallways = "some", + big_rooms = "few", + big_outdoor_rooms = "none", + teleporters = "none", + steepness = "some", + traps = "some", + cages = "none", + secrets = "some", + doors = "some", + windows = "none", + switches = "few", + keys = "some", + trikeys = "none", + scenics = "none", + park_detail = "none", + symmetry = "heaps", + pictures = "some", + barrels = "some", + beams = "few", + porches = "none", + fences = "none" +}, + +-- E2M3 Approximate map dimensions: 3,500 x 2,400 map units +E2M3 = +{ + outdoors = "few", + caves = "none", + parks = "none", + liquids = "some", + hallways = "some", + big_rooms = "none", + big_outdoor_rooms = "none", + teleporters = "none", + steepness = "few", + traps = "some", + cages = "few", + secrets = "few", + doors = "some", + windows = "few", + switches = "few", + keys = "some", + trikeys = "none", + scenics = "none", + park_detail = "none", + symmetry = "heaps", + pictures = "some", + barrels = "few", + beams = "some", + porches = "few", + fences = "few" +}, + +-- E2M4 Approximate map dimensions: 3,800 x 3,800 map units +E2M4 = +{ + outdoors = "none", + caves = "none", + parks = "none", + liquids = "some", + hallways = "some", + big_rooms = "some", + big_outdoor_rooms = "none", + teleporters = "few", + steepness = "some", + traps = "some", + cages = "none", + secrets = "some", + doors = "some", + windows = "none", + switches = "few", + keys = "heaps", + trikeys = "few", + scenics = "none", + park_detail = "none", + symmetry = "some", + pictures = "heaps", + barrels = "few", + beams = "few", + porches = "few", + fences = "few" +}, + +-- E2M5 Approximate map dimensions: 4,200 x 3,700 map units +E2M5 = +{ + outdoors = "few", + caves = "none", + parks = "none", + liquids = "some", + hallways = "heaps", + big_rooms = "few", + big_outdoor_rooms = "few", + teleporters = "some", + steepness = "heaps", + traps = "some", + cages = "few", + secrets = "some", + doors = "heaps", + windows = "few", + switches = "some", + keys = "none", + trikeys = "none", + scenics = "few", + park_detail = "none", + symmetry = "heaps", + pictures = "heaps", + barrels = "few", + beams = "some", + porches = "few", + fences = "few" +}, + +-- E2M6 Approximate map dimensions: 3,200 x 5,000 map units +E2M6 = +{ + outdoors = "few", + caves = "none", + parks = "none", + liquids = "few", + hallways = "heaps", + big_rooms = "none", + big_outdoor_rooms = "none", + teleporters = "few", + steepness = "few", + traps = "some", + cages = "none", + secrets = "some", + doors = "heaps", + windows = "none", + switches = "some", + keys = "heaps", + trikeys = "heaps", + scenics = "few", + park_detail = "none", + symmetry = "none", + pictures = "some", + barrels = "few", + beams = "some", + porches = "none", + fences = "none" +}, + -- This is a template! -- EXMX Approximate map dimensions: X x Y map units EXMX = @@ -1178,6 +1336,8 @@ EXMX = porches = fences = }, + + ]] -- translate changes to here instead @@ -1187,7 +1347,7 @@ function IWAD_MODE.begin_level() if LEVEL.name == "MAP01" then LEVEL.map_W = 18 - LEVEL.description = rand.key_by_probs(nt.URBAN.lexicon.a) .. " Entryway" + LEVEL.description = rand.key_by_probs(nt.TECH.lexicon.e) LEVEL.size_multiplier = 0.6 LEVEL.size_consistency = "strict" LEVEL.sky_light = 192 @@ -1197,6 +1357,7 @@ function IWAD_MODE.begin_level() LEVEL.size_multiplier = 0.5 LEVEL.size_consistency = "strict" LEVEL.sky_light = 192 + LEVEL.description = rand.key_by_probs(nt.TECH.lexicon.e) PARAM.brightness_offset = "-1" elseif LEVEL.name == "MAP03" then LEVEL.map_W = 25 @@ -1211,13 +1372,13 @@ function IWAD_MODE.begin_level() LEVEL.size_consistency = "strict" LEVEL.sky_light = 160 PARAM.brightness_offset = "-2" - LEVEL.description = "The " .. rand.key_by_probs(nt.TECH.lexicon.n) + LEVEL.description = rand.key_by_probs(nt.TECH.lexicon.e) elseif LEVEL.name == "MAP05" then LEVEL.map_W = 28 LEVEL.size_multiplier = 0.8 LEVEL.sky_light = 144 LEVEL.size_consistency = "normal" - LEVEL.description = "The " .. rand.key_by_probs(nt.TECH.lexicon.n) + LEVEL.description = rand.key_by_probs(nt.TECH.lexicon.e) PARAM.brightness_offset = "-2" elseif LEVEL.name == "MAP06" then LEVEL.map_W = 30 @@ -1256,6 +1417,7 @@ function IWAD_MODE.begin_level() LEVEL.size_consistency = "normal" LEVEL.sky_light = 144 PARAM.brightness_offset = "+2" + LEVEL.description = rand.key_by_probs(nt.TECH.lexicon.e) LEVEL.squareishness = 30 elseif LEVEL.name == "MAP11" then LEVEL.map_W = 26 @@ -1271,6 +1433,7 @@ function IWAD_MODE.begin_level() LEVEL.has_streets = true -- Its shape implies this LEVEL.sky_light = 144 PARAM.brightness_offset = "+1" + LEVEL.squareishness = 55 LEVEL.description = "The " .. rand.key_by_probs(nt.URBAN.lexicon.n) elseif LEVEL.name == "MAP13" then LEVEL.map_W = 40 @@ -1517,7 +1680,23 @@ function IWAD_MODE.begin_level() LEVEL.size_consistency = "strict" LEVEL.description = rand.key_by_probs(nt.URBAN.lexicon.a) .. " Anomaly" PARAM.brightness_offset = "+1" - end]] + elseif LEVEL.name == "E2M2" then + LEVEL.map_W = 30 + LEVEL.size_multiplier = 0.8 + LEVEL.area_multiplier = 1.33 + LEVEL.size_consistency = "strict" + LEVEL.description = "Containment " .. rand.key_by_probs(nt.TECH.lexicon.a) + LEVEL.squarishness = 70 + PARAM.brightnesS_offset = "+2" + elseif LEVEL.name == "E2M3" then + LEVEL.map_w = 26 + LEVEL.size_multiplier = 0.6 + LEVEL.area_multiplier = 0.4 + LEVEL.size_consistency = "strict" + LEVEL.description = rand.key_by_probs(nt.TECH.lexicon.e) -- Will this work, MSSP? + LEVEL.squarishness = 33 + end + ]] -- LEVEL.description = "Icon of " .. rand.key_by_probs(nt.GOTHIC.lexicon.h) - For reference -- LEVEL.description = rand.key_by_probs(nt.URBAN.lexicon.a) .. " Citadel" - For reference diff --git a/scripts/naming.lua b/scripts/naming.lua index ef64551e06..4cc5218d76 100644 --- a/scripts/naming.lua +++ b/scripts/naming.lua @@ -790,13 +790,84 @@ namelib.NAMES = Traps=10, RMG=10, }, + -- TODO: Please help add more to this section!! -A, Jul 16th, 2021 + + -- Used for IWAD Mode module. Altered version of the 'a' lexicon so some level names + -- make more sense. + e = + { + + -- Proper full name choices for techy levels.. + ["Administrative Center"]=10, + ["Air Control Tower"]=10, + ["Air Defense Systems"]=10, + ["Alpha Labs"]=10, + ["Ammunition Dump"]=10, + Archives=5, + ["Beta Labs"]=10, -- Fun fact: A third party map is named after this + Barracks = 10, + ["Biological Research Station"]=5, + ["Biolabs"]=10, + ["Celestial Observatory"]=7, + ["Central Processing"]=5, + ["Command H.Q."]=10, + ["Command Control"]=5, + ["Communications Complex"]=10, + ["Correctional Facility"]=5, + ["Delta Labs"]=10, + ["Energy Production Plant"]=10, + ["Energy Substation Hub"]=10, + Engineering=10, + ["Experimental Fusion Generators"]=7, + ["Fire Base"]=5, + Foundry=7, + ["Fuel Storage"]=7, + ["Gamma Labs"]=10, + Garrison=10, + Hangar=5, -- Yeah, because techy! + ["Living Quarters"]=10, + Logistics=7, + ["Manufacturing and Shipping"]=10, + ["Materials Storage"]=10, + ["Maintenance and Repair Center"]=10, + ["Marine Training Annex"]=7, + ["Medical Bay"]=7, + ["Military Outpost"]=10, + ["Mining Quarry"]=10, + ["Network Hub"]=10, + ["Nuclear Power Plant"]=10, + ["Off-Site Emergency Generators"]=10, + ["Off-Site Mars Comms Hub"]=7, + ["Off-world Gateway Site"]=5, + ["Operations Center"]=10, + ["Primary Core"]=7, + Refinery=7, + ["Research and Development"]=10, + ["Robotics Workshop"]=10, + ["Satellite Relay"]=10, + ["Secondary Core"]=7, + ["Spacecraft Refueling Docks"]=10, + ["Storage Silos"]=5, + ["Teleporter Research Complex"]=5, + Terraformer=5, + ["Thermodynamics Research"]=10, + ["Transport Hub"]=7, + Warehouse=10, + ["Waste Recycling Facility"]=10, + ["Water Treatment Plant"]=5, + ["Weapons Production Factory"]=7, + ["Weapons Testing Grounds"]=10, + + + }, + n = { -- MSSP-TODO: sort these names into better categories!!! -- military places - Hangar=5, Outpost=10, Beacon=3, - Bunker=7, Facility=10, Pillbox=1, - Headquarters=2, Silos=7, Base=30, + Outpost=10, + Bunker=7, Facility=10, + Silos=7, Base=30, Command=10, -- utility places @@ -810,15 +881,13 @@ namelib.NAMES = Depositry=3, -- science-y places - Lab=15, Laboratory=5, Observatory=3, Station=15, Tower=5, Relay=5, Satellite=10, Colony=15, Project=5, Experiment=3, Network=5, System=15, -- industrial places - Refinery=15, Factory=10, Foundry=3, + Refinery=15, Factory=10, Workshop=7, Works=2, Forge=8, - ["Flaring Towers"]=5, -- infrastructural places Platform=5, Port=3, Hub=10, @@ -830,18 +899,10 @@ namelib.NAMES = Compound=15, Dock=3, Bay=5, Complex=15, Center=15, Installation=5, Area=15, Site=10, Zone=10, - Chamber=5, Quarters=5, Section=3, + Chamber=5, Section=3, Post=3, Annex=5, Terminal=10, Quadrant=5, Sector=5, Adjunct=3, - -- weird ones - Dilemma=3, - Situation=2, Crisis=2, Emergency=2, - Anomaly=10, Portal=7, Apparatus=10, - Dimension=3, Paradox=3, Vortex=5, - Enigma=5, Artifact=1, Quagmire=1, - Catalyst=2, - -- MSSP adds -- shapes Dome=7, Quadrangle=3, Rotunda=2, @@ -858,40 +919,9 @@ namelib.NAMES = Reserve=7, -- military stuff -MSSP - Casern=5, ["F.O.B."]=7, ["Fire Base"]=10, - Garrison=10, Logistics=10, Containment=7, - Berths=5, Housing=5, - - -- machine/electronic parts -MSSP - -- and weird science-y buzzwords - -- and also car parts - Device=5, Machine=5, Couplings=5, - - Oscillator=5, Magnetron=5, Emulsifier=5, - Alternator=5, Induction=5, Stabilizer=5, - Processor=10, Suspension=5, Conduit=5, - Synthesizer=3, Mainframe=10, Modulator=5, - Converter=4, Inverter=4, Array=5, - Manifold=5, Regulator=5, Inhibitor=7, - Pulser=3, Nacelles=3, Filament=3, - Scrambler=3, Emitter=5, Capacitor=10, - Compressor=7, Condenser=7, Matrix=10, - Feed=8, Refractory=6, Deflector=5, - Junction=7, Analyser=7, Reciprocator=5, - Collector=3, Centrifuge=7, Splitter=5, - Scrubber=5, Injector=7, Accelerator=10, - Infuser=5, Collider=10, Energizer=5, - Transducer=5, Bearing=3, Incubation=5, - Coil=10, Gearbox=5, Radiator=5, - Caliper=3, Rotor=5, Shield=10, - Synchronizer=5, Conditioner=3, Distillery=5, - Transistor=3, Diode=3, Boiler=3, - Compositor=5, Sorter=5, Cultivator=3, - Engine=7, Solderer=3, Primer=5, - Conductor=5, Integrator=5, - Salvager=5, Recycler=5, Culler=4, - - Framework=5, Compartment=5, + Casern=5, ["F.O.B."]=7, + Logistics=10, Containment=7, + Berths=5, -- IT security objects Firewall=5, Servers=5, Encoder=5, diff --git a/scripts/quest.lua b/scripts/quest.lua index 9b3be943a5..e6c9fbf6f0 100644 --- a/scripts/quest.lua +++ b/scripts/quest.lua @@ -2555,17 +2555,28 @@ function Quest_nice_items() -- SI fab stop spawning local function pick_room_for_si(info) + -- check min and max along rooms in the level + local max_along_room = 0 + local min_along_room = 1 + + for _,R in pairs(LEVEL.rooms) do + max_along_room = math.max(max_along_room, R.lev_along) + min_along_room = math.min(min_along_room, R.lev_along) + end + for _,R in pairs(LEVEL.rooms) do if R.closets and not R.secondary_important and not R.is_hallway then local do_it = false - if info.min_prog and (R.lev_along >= info.min_prog) then + if info.min_prog and (R.lev_along >= info.min_prog) + and info.min_prog > min_along_room then do_it = true end - if info.max_prog and (R.lev_along <= info.max_prog) then + if info.max_prog and (R.lev_along <= info.max_prog) + and info.max_prog < max_along_room then do_it = true end diff --git a/scripts/render.lua b/scripts/render.lua index 99344b9570..4807dda1f1 100644 --- a/scripts/render.lua +++ b/scripts/render.lua @@ -1009,7 +1009,7 @@ stderrf("dA = (%1.1f %1.1f) dB = (%1.1f %1.1f)\n", adx, ady, bdx, bdy) E = E.peer end - Render_add_exit_sign(E, z) + Render_add_exit_sign(E, E.area.floor_h) --z end end @@ -2412,7 +2412,7 @@ chunk.goal.action = "S1_OpenDoor" -- FIXME IT SHOULD BE SET WHEN JOINER IS REND end if E and not E.area.room.is_hallway then - Render_add_exit_sign(E, z1) + Render_add_exit_sign(E, E.area.floor_h) --z1 end end end diff --git a/scripts/room.lua b/scripts/room.lua index be2d0055dc..2a6edc516d 100644 --- a/scripts/room.lua +++ b/scripts/room.lua @@ -3380,11 +3380,12 @@ function Room_floor_ceil_heights() if string.gmatch(R.height_style, "short") then if add_h > 128 then add_h = 128 end elseif string.gmatch(R.height_style, "tall") then - if rand.odds(90) then - add_h = add_h * 2 - else - add_h = add_h * 4 - end + add_h = add_h * rand.pick({ + [2] = 8, + [4] = 4, + [6] = 2, + [10] = 1 -- experimental supertall, might drop this + }) end end end diff --git a/source_files/gui/m_lua.cc b/source_files/gui/m_lua.cc index e686f1b93b..fe2eff11a8 100644 --- a/source_files/gui/m_lua.cc +++ b/source_files/gui/m_lua.cc @@ -74,48 +74,52 @@ int gui_format_prefix(lua_State *L) { SYS_ASSERT(levelcount && game && theme && format); - const char *ff_args[10]; - - ff_args[0] = "tools/filename_formatter"; - ff_args[1] = "-c"; - ff_args[2] = levelcount; - ff_args[3] = "-g"; - ff_args[4] = game; - ff_args[5] = "-t"; - ff_args[6] = theme; - ff_args[7] = "-f"; - if (StringCaseCmp(format, "version") == 0) { - std::string tempstring = OBSIDIAN_SHORT_VERSION; - tempstring.append("_"); - ff_args[8] = tempstring.c_str(); - } else if (StringCaseCmp(format, "custom") == 0) { - ff_args[8] = custom_prefix.c_str(); - } else { - ff_args[8] = format; - } - ff_args[9] = NULL; - - struct subprocess_s subprocess; - int result = - subprocess_create(ff_args, subprocess_option_no_window, &subprocess); - if (result != 0) { - return 0; - } - // Read the output of filename_formatter - FILE *p_stdout = subprocess_stdout(&subprocess); - char prefix[100]; - fgets(prefix, 100, p_stdout); + const char* ff_args[10]; - result = subprocess_destroy(&subprocess); - if (result != 0) { - return 0; - } else { - lua_pushstring(L, (const char *)prefix); - return 1; - } - - // Hopefully we don't get here +#ifdef WIN32 + ff_args[0] = "tools/filename_formatter.exe"; +#else + ff_args[0] = "tools/filename_formatter"; +#endif + ff_args[1] = "-c"; + ff_args[2] = levelcount; + ff_args[3] = "-g"; + ff_args[4] = game; + ff_args[5] = "-t"; + ff_args[6] = theme; + ff_args[7] = "-f"; + if (StringCaseCmp(format, "version") == 0) { + std::string tempstring = OBSIDIAN_SHORT_VERSION; + tempstring.append("_"); + ff_args[8] = tempstring.c_str(); + } else if (StringCaseCmp(format, "custom") == 0) { + ff_args[8] = custom_prefix.c_str(); + } else { + ff_args[8] = format; + } + ff_args[9] = NULL; + + struct subprocess_s subprocess; + int result = subprocess_create(ff_args, subprocess_option_no_window, &subprocess); + if (result != 0) { + return 0; + } + + //Read the output of filename_formatter + FILE* p_stdout = subprocess_stdout(&subprocess); + char prefix[100]; + fgets(prefix, 100, p_stdout); + + result = subprocess_destroy(&subprocess); + if (result != 0) { + return 0; + } else { + lua_pushstring(L, (const char *)prefix); + return 1; + } + + //Hopefully we don't get here return 0; } diff --git a/source_files/gui/ui_customboxes.cc b/source_files/gui/ui_customboxes.cc index 9689e4ad6c..d542306a07 100644 --- a/source_files/gui/ui_customboxes.cc +++ b/source_files/gui/ui_customboxes.cc @@ -5,30 +5,47 @@ #include #include "main.h" -void c_color(Fl_Color c) { Fl::set_box_color(c); } +void c_color(Fl_Color c) { + Fl::set_box_color(c); +} + +static const uchar c_active_ramp[24] = { + FL_GRAY_RAMP+0, FL_GRAY_RAMP+1, FL_GRAY_RAMP+2, FL_GRAY_RAMP+3, + FL_GRAY_RAMP+4, FL_GRAY_RAMP+5, FL_GRAY_RAMP+6, FL_GRAY_RAMP+7, + FL_GRAY_RAMP+8, FL_GRAY_RAMP+9, FL_GRAY_RAMP+10,FL_GRAY_RAMP+11, + FL_GRAY_RAMP+12,FL_GRAY_RAMP+13,FL_GRAY_RAMP+14,FL_GRAY_RAMP+15, + FL_GRAY_RAMP+16,FL_GRAY_RAMP+17,FL_GRAY_RAMP+18,FL_GRAY_RAMP+19, + FL_GRAY_RAMP+20,FL_GRAY_RAMP+21,FL_GRAY_RAMP+22,FL_GRAY_RAMP+23}; +static const uchar c_inactive_ramp[24] = { + 43, 43, 44, 44, + 44, 45, 45, 46, + 46, 46, 47, 47, + 48, 48, 48, 49, + 49, 49, 50, 50, + 51, 51, 52, 52}; +static int c_draw_it_active = 1; + + +const uchar *c_fl_gray_ramp() {return (c_draw_it_active?c_active_ramp:c_inactive_ramp)-'A';} + +// CUSTOM GLEAM BOXES --------------------------------------------------------------------------------------- + +void cgleam_shade_rect_top_bottom(int x, int y, int w, int h, Fl_Color fg1, Fl_Color fg2, float th) { + // calculate background size w/o borders + x += 2; y += 2; w -= 4; h -= 4; + // draw the shiny background using maximum limits + int h_top = ((h/2) < (20) ? (h/2) : (20)); // min(h/2, 20); + int h_bottom = ((h/6) < (15) ? (h/6) : (15)); // min(h/6, 15); + int h_flat = h - h_top - h_bottom; + float step_size_top = h_top > 1 ? (0.999f/float(h_top)) : 1; + float step_size_bottom = h_bottom > 1 ? (0.999f/float(h_bottom)) : 1; + // draw the gradient at the top of the widget + float k = 1; + for (int i = 0; i < h_top; i++, k -= step_size_top) { + c_color(fl_color_average(fl_color_average(fg1, fg2, th), fg1, k)); + fl_xyline(x, y+i, x+w-1); + } -// CUSTOM GLEAM BOXES -// --------------------------------------------------------------------------------------- - -void cgleam_shade_rect_top_bottom(int x, int y, int w, int h, Fl_Color fg1, - Fl_Color fg2, float th) { - // calculate background size w/o borders - x += 2; - y += 2; - w -= 4; - h -= 4; - // draw the shiny background using maximum limits - int h_top = ((h / 2) < (20) ? (h / 2) : (20)); // min(h/2, 20); - int h_bottom = ((h / 6) < (15) ? (h / 6) : (15)); // min(h/6, 15); - int h_flat = h - h_top - h_bottom; - float step_size_top = h_top > 1 ? (0.999f / float(h_top)) : 1; - float step_size_bottom = h_bottom > 1 ? (0.999f / float(h_bottom)) : 1; - // draw the gradient at the top of the widget - float k = 1; - for (int i = 0; i < h_top; i++, k -= step_size_top) { - c_color(fl_color_average(fl_color_average(fg1, fg2, th), fg1, k)); - fl_xyline(x, y + i, x + w - 1); - } // draw a "flat" rectangle in the middle area of the box c_color(fg1); @@ -211,28 +228,59 @@ void cgtk_thin_up_box(int x, int y, int w, int h, Fl_Color c) { // CUSTOM PLASTIC BOXES // --------------------------------------------------------------------------------------- -extern const uchar *fl_gray_ramp(); +extern const uchar *c_fl_gray_ramp(); Fl_Color cplastic_shade_color(uchar gc, Fl_Color bc) { - return fl_color_average((Fl_Color)gc, bc, 0.50f); -} - -void cplastic_frame_rect(int x, int y, int w, int h, const char *c, - Fl_Color bc) { - const uchar *g = fl_gray_ramp(); - int b = ((int)strlen(c)) / 4 + 1; - - for (x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b--) { - // Draw lines around the perimeter of the button, 4 colors per - // circuit. - fl_color(cplastic_shade_color(g[(int)*c++], bc)); - fl_line(x, y + h + b, x + w - 1, y + h + b, x + w + b - 1, y + h); - fl_color(cplastic_shade_color(g[(int)*c++], bc)); - fl_line(x + w + b - 1, y + h, x + w + b - 1, y, x + w - 1, y - b); - fl_color(cplastic_shade_color(g[(int)*c++], bc)); - fl_line(x + w - 1, y - b, x, y - b, x - b, y); - fl_color(cplastic_shade_color(g[(int)*c++], bc)); - fl_line(x - b, y, x - b, y + h, x, y + h + b); + return fl_color_average((Fl_Color)gc, bc, 0.50f); +} + + +void cplastic_frame_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) { + const uchar *g = c_fl_gray_ramp(); + int b = ((int) strlen(c)) / 4 + 1; + + for (x += b, y += b, w -= 2 * b, h -= 2 * b; b > 1; b --) + { + // Draw lines around the perimeter of the button, 4 colors per + // circuit. + fl_color(cplastic_shade_color(g[(int)*c++], bc)); + fl_line(x, y + h + b, x + w - 1, y + h + b, x + w + b - 1, y + h); + fl_color(cplastic_shade_color(g[(int)*c++], bc)); + fl_line(x + w + b - 1, y + h, x + w + b - 1, y, x + w - 1, y - b); + fl_color(cplastic_shade_color(g[(int)*c++], bc)); + fl_line(x + w - 1, y - b, x, y - b, x - b, y); + fl_color(cplastic_shade_color(g[(int)*c++], bc)); + fl_line(x - b, y, x - b, y + h, x, y + h + b); + } +} + +void cplastic_shade_rect(int x, int y, int w, int h, const char *c, Fl_Color bc) { + const uchar *g = c_fl_gray_ramp(); + int i, j; + int clen = (int) strlen(c) - 1; + int chalf = clen / 2; + int cstep = 1; + + if (h < (w * 2)) { + // Horizontal shading... + if (clen >= h) cstep = 2; + + for (i = 0, j = 0; j < chalf; i ++, j += cstep) { + // Draw the top line and points... + fl_color(cplastic_shade_color(g[(int)c[i]], bc)); + fl_xyline(x + 1, y + i, x + w - 2); + + fl_color(cplastic_shade_color(g[c[i] - 2], bc)); + fl_point(x, y + i + 1); + fl_point(x + w - 1, y + i + 1); + + // Draw the bottom line and points... + fl_color(cplastic_shade_color(g[(int)c[clen - i]], bc)); + fl_xyline(x + 1, y + h - i, x + w - 2); + + fl_color(cplastic_shade_color(g[c[clen - i] - 2], bc)); + fl_point(x, y + h - i); + fl_point(x + w - 1, y + h - i); } } @@ -318,21 +366,19 @@ void cplastic_up_frame(int x, int y, int w, int h, Fl_Color c) { } void cplastic_narrow_thin_box(int x, int y, int w, int h, Fl_Color c) { - if (h <= 0 || w <= 0) { - return; - } - const uchar *g = fl_gray_ramp(); - fl_color(cplastic_shade_color(g[(int)'R'], c)); - fl_rectf(x + 1, y + 1, w - 2, h - 2); - fl_color(cplastic_shade_color(g[(int)'I'], c)); - if (w > 1) { - fl_xyline(x + 1, y, x + w - 2); - fl_xyline(x + 1, y + h - 1, x + w - 2); - } - if (h > 1) { - fl_yxline(x, y + 1, y + h - 2); - fl_yxline(x + w - 1, y + 1, y + h - 2); - } + if (h<=0 || w<=0) return; + const uchar *g = c_fl_gray_ramp(); + fl_color(cplastic_shade_color(g[(int)'R'], c)); + fl_rectf(x+1, y+1, w-2, h-2); + fl_color(cplastic_shade_color(g[(int)'I'], c)); + if (w > 1) { + fl_xyline(x+1, y, x+w-2); + fl_xyline(x+1, y+h-1, x+w-2); + } + if (h > 1) { + fl_yxline(x, y+1, y+h-2); + fl_yxline(x+w-1, y+1, y+h-2); + } } void cplastic_thin_up_box(int x, int y, int w, int h, Fl_Color c) { @@ -418,56 +464,44 @@ void cframe(int x, int y, int w, int h) { } void cframe2(int x, int y, int w, int h) { - if (h > 0 && w > 0) { - // draw bottom line: - fl_color(BORDER_COLOR); - fl_xyline(x, y + h - 1, x + w - 1); - // draw right line: - fl_color(BORDER_COLOR); - fl_yxline(x + w - 1, y + h - 1, y); - // draw top line: - fl_color(BORDER_COLOR); - fl_xyline(x, y, x + w - 1); - y++; - // draw left line: - fl_color(BORDER_COLOR); - fl_yxline(x, y + h - 1, y); - x++; - } -} - -void cframe3(const char *s, int x, int y, int w, int h) { - const uchar *g = fl_gray_ramp(); - if (h > 0 && w > 0) { - for (; *s;) { - // draw bottom line: - fl_color(g[(int)*s++]); - fl_xyline(x, y + h - 1, x + w - 1); - if (--h <= 0) { - break; - } - // draw right line: - fl_color(g[(int)*s++]); - fl_yxline(x + w - 1, y + h - 1, y); - if (--w <= 0) { - break; - } - // draw top line: - fl_color(g[(int)*s++]); - fl_xyline(x, y, x + w - 1); - y++; - if (--h <= 0) { - break; - } - // draw left line: - fl_color(g[(int)*s++]); - fl_yxline(x, y + h - 1, y); - x++; - if (--w <= 0) { - break; - } - } - } + if (h > 0 && w > 0) { + // draw bottom line: + fl_color(BORDER_COLOR); + fl_xyline(x, y+h-1, x+w-1); + // draw right line: + fl_color(BORDER_COLOR); + fl_yxline(x+w-1, y+h-1, y); + // draw top line: + fl_color(BORDER_COLOR); + fl_xyline(x, y, x+w-1); + y++; + // draw left line: + fl_color(BORDER_COLOR); + fl_yxline(x, y+h-1, y); + x++; + } +} + +void cframe3(const char* s, int x, int y, int w, int h) { + const uchar *g = c_fl_gray_ramp(); + if (h > 0 && w > 0) for (;*s;) { + // draw bottom line: + fl_color(g[(int)*s++]); + fl_xyline(x, y+h-1, x+w-1); + if (--h <= 0) break; + // draw right line: + fl_color(g[(int)*s++]); + fl_yxline(x+w-1, y+h-1, y); + if (--w <= 0) break; + // draw top line: + fl_color(g[(int)*s++]); + fl_xyline(x, y, x+w-1); + y++; if (--h <= 0) break; + // draw left line: + fl_color(g[(int)*s++]); + fl_yxline(x, y+h-1, y); + x++; if (--w <= 0) break; + } } /** Draws a frame of type FL_THIN_UP_FRAME */ diff --git a/source_files/zdbsp_src/CMakeLists.txt b/source_files/zdbsp_src/CMakeLists.txt index 2b01d72155..42b0d7002a 100644 --- a/source_files/zdbsp_src/CMakeLists.txt +++ b/source_files/zdbsp_src/CMakeLists.txt @@ -39,3 +39,4 @@ add_library( ) target_include_directories(obsidian_zdbsp PRIVATE ../zlib_src) +target_link_libraries(obsidian_zdbsp PUBLIC z)