Skip to content

Commit

Permalink
Remove Linear Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Sep 26, 2024
1 parent b3d8952 commit 07cde30
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 105 deletions.
4 changes: 0 additions & 4 deletions data/text/dialogues.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ _("Obsidian Cookbook Recipe for Doom #666 - [REDACTED]\n\nCreate a map pack of [

--

_("Did you know?\n\nIf you don't feel like backtracking or navigating levels with multiple deep paths and potential dead ends, Linear Mode will create levels that just go from point A to point B!"),

--

_("Did you know?\n\nNature Mode generates levels that are entirely Parks and/or Caves. Who said you needed to go outside to experience outside?"),

--
Expand Down
7 changes: 0 additions & 7 deletions games/doom/levels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -300,20 +300,13 @@ function DOOM.get_levels()
local selected_mode = rand.pick(special_mode)
if selected_mode == "streets" then
LEV.has_streets = true
LEV.is_linear = false
LEV.is_nature = false
elseif selected_mode == "linear" then
LEV.has_streets = false
LEV.is_linear = true
LEV.is_nature = false
else
LEV.has_streets = false
LEV.is_linear = false
LEV.is_nature = true
end
else
LEV.has_streets = false
LEV.is_linear = false
LEV.is_nature = false
end

Expand Down
6 changes: 0 additions & 6 deletions games/doom/x_doom1.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5302,12 +5302,6 @@ function ULTDOOM.get_levels()
end

if not LEV.prebuilt then
if PARAM.float_linear_mode then
if rand.odds(PARAM.float_linear_mode) then
LEV.is_linear = true
end
end

-- nature mode
if PARAM.float_nature_mode then
if rand.odds(PARAM.float_nature_mode) then
Expand Down
7 changes: 0 additions & 7 deletions games/heretic/levels.lua
Original file line number Diff line number Diff line change
Expand Up @@ -277,20 +277,13 @@ function HERETIC.get_levels()
local selected_mode = rand.pick(special_mode)
if selected_mode == "streets" then
LEV.has_streets = true
LEV.is_linear = false
LEV.is_nature = false
elseif selected_mode == "linear" then
LEV.has_streets = false
LEV.is_linear = true
LEV.is_nature = false
else
LEV.has_streets = false
LEV.is_linear = false
LEV.is_nature = true
end
else
LEV.has_streets = false
LEV.is_linear = false
LEV.is_nature = false
end

Expand Down
4 changes: 0 additions & 4 deletions modules/iwad_mode.lua
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,6 @@ function IWAD_MODE.begin_level(self, LEVEL)
LEVEL.size_multiplier = 0.75
LEVEL.has_streets = true -- Its shape implies this
LEVEL.is_nature = false
LEVEL.is_linear = false
LEVEL.sky_light = 144
LEVEL.squareishness = 55
LEVEL.description = "The " .. rand.key_by_probs(nt.URBAN.lexicon.n)
Expand All @@ -989,7 +988,6 @@ function IWAD_MODE.begin_level(self, LEVEL)
LEVEL.sky_light = 128
LEVEL.has_streets = true
LEVEL.is_nature = false
LEVEL.is_linear = false
LEVEL.description = rand.key_by_probs(nt.URBAN.lexicon.a) .. " Downtown"
LEVEL.squareishness = 60
LEVEL.room_height_style = "tall"
Expand All @@ -1010,7 +1008,6 @@ function IWAD_MODE.begin_level(self, LEVEL)
LEVEL.sky_light = 160
LEVEL.has_streets = true -- Shaped enough for this
LEVEL.is_nature = false
LEVEL.is_linear = false
LEVEL.description = rand.key_by_probs(nt.URBAN.lexicon.a) .. " Industrial Zone"
LEVEL.squareishness = 55
LEVEL.room_height_style = "tall"
Expand All @@ -1021,7 +1018,6 @@ function IWAD_MODE.begin_level(self, LEVEL)
LEVEL.size_consistency = "normal"
LEVEL.has_streets = true
LEVEL.is_nature = false
LEVEL.is_linear = false
LEVEL.sky_light = 144
LEVEL.squareishness = 30
LEVEL.room_height_style = "normal"
Expand Down
15 changes: 0 additions & 15 deletions modules/miscellaneous.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,21 +242,6 @@ OB_MODULES["misc"] =
randomize_group="architecture"
},

{
name = "float_linear_mode",
label = _("Linear Mode"),
valuator = "slider",
units = _("% Chance Per Level"),
min = 0,
max = 100,
increment = 1,
default = 0,
tooltip = _("Creates linear levels, where rooms are connected along a linear layout from start to exit."),
longtip = _("Due to the nature of linear levels, you may encounter teleports even if you have teleports off. This is necessary in order for linear levels not to prematuraly terminate and therefore become stunted i.e. only have 2-5 rooms."),
randomize_group="architecture",
priority = 98
},

{
name = "float_nature_mode",
label = _("Nature Mode"),
Expand Down
65 changes: 5 additions & 60 deletions scripts/grower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1179,10 +1179,6 @@ function Grower_decide_extents(LEVEL)
gui.printf("--==| Streets Mode activated! |==--\n\n")
end

if LEVEL.is_linear then
gui.printf("--==| Linear mode activated! |==--\n\n")
end

if LEVEL.is_nature then
gui.printf("--==| Nature mode activated! Take a walk! |==--\n\n")
end
Expand Down Expand Up @@ -1770,11 +1766,6 @@ function Grower_grammatical_pass(SEEDS, LEVEL, R, pass, apply_num, stop_prob,
if not is_emergency then return 0 end
end

-- hallways cannot be used for teleporter breaks in Linear Mode
if LEVEL.is_linear and is_emergency then
if string.match(rule.name, "hallway") then return 0 end
end

if not ob_match_level_theme(LEVEL, rule) then return 0 end
if not ob_match_feature(rule) then return 0 end

Expand Down Expand Up @@ -1848,7 +1839,7 @@ function Grower_grammatical_pass(SEEDS, LEVEL, R, pass, apply_num, stop_prob,

if R.is_street then return 0 end

if (LEVEL.has_linear_start or LEVEL.is_linear) then
if LEVEL.has_linear_start then
if R.is_start then return 0 end
if not R.grow_parent and not R.is_start then
return 0
Expand Down Expand Up @@ -3729,22 +3720,6 @@ end
break;
end

-- Linear Mode
if LEVEL.is_linear then

if pass == "sprout" then

if R:prelim_conn_num(LEVEL) >= 2 then
break;
end

if R.is_start and R:prelim_conn_num(LEVEL) >= 1 then
break;
end

end
end

if LEVEL.has_linear_start then
if pass == "sprout" then
if not R.is_street and R:prelim_conn_num(LEVEL) >= 1 and R.is_start then
Expand Down Expand Up @@ -3795,10 +3770,6 @@ function Grower_grammatical_room(SEEDS, LEVEL, R, pass, is_emergency)
apply_num = rand.irange(6,20)
end

if LEVEL.is_linear then
apply_num = 1
end

elseif pass == "decorate" then
-- TODO: review this (and stop_prob), see what works best
local tmp_num = sel(R.is_big, 10, 6)
Expand Down Expand Up @@ -4000,16 +3971,9 @@ function Grower_grow_room(SEEDS, LEVEL, R)

if R.is_root then return false end

-- MSSP: Unless we're in linear mode, where
-- the map must continue growing elsewhere
-- or in Procedural Gotchas where the arena
-- is much too small.
if LEVEL.is_procedural_gotcha then
return R:calc_walk_vol() < 128
end
if LEVEL.is_linear then
return false
end

return R:calc_walk_vol() < 8
end
Expand All @@ -4024,7 +3988,7 @@ function Grower_grow_room(SEEDS, LEVEL, R)
if not R.is_hallway and is_too_small(R) then
Grower_grammatical_room(SEEDS, LEVEL, R, "grow")

if is_too_small(R) and not LEVEL.is_linear then
if is_too_small(R) then
if R.grow_parent and R.grow_parent.is_start
and R.small_room then
return
Expand All @@ -4036,24 +4000,11 @@ function Grower_grow_room(SEEDS, LEVEL, R)
end
end

-- Linear Mode, kill mirrored sprouts of symmetric rooms
if LEVEL.is_linear then
if R.grow_parent then
if R.grow_parent:prelim_conn_num(LEVEL) > 2 then
if R.prelim_conn_num == 1 then
gui.debugf("Linear mode: ROOM_" .. R.id .. " culled.\n")
Grower_kill_room(SEEDS, LEVEL, R)
return
end
end
end
end

if LEVEL.is_linear or LEVEL.is_procedural_gotcha then
if LEVEL.is_procedural_gotcha then
if R.grow_parent and R.grow_parent.is_start then
if R.grow_parent:prelim_conn_num(LEVEL) > 1 then
if R.prelim_conn_num == 1 then
gui.debugf("Linear mode: ROOM " .. R.id .. " culled.\n")
gui.debugf("Procedural Gotcha: ROOM " .. R.id .. " culled.\n")
Grower_kill_room(SEEDS, LEVEL, R)
end
end
Expand Down Expand Up @@ -4274,12 +4225,6 @@ function Grower_begin_trunks(LEVEL, SEEDS)
end
end

-- ignore teleporter style setting for linear mode
-- don't you get enough teleporters already anyway?!
if LEVEL.is_linear then
max_trunks = 1
end

LEVEL.trunks = {}

LEVEL.max_trunks = max_trunks
Expand Down Expand Up @@ -4607,7 +4552,7 @@ gui.debugf("=== Coverage seeds: %d/%d rooms: %d/%d\n",
expand_limits()
emergency_sprouts()

if LEVEL.is_linear and not LEVEL.is_procedural_gotcha
if not LEVEL.is_procedural_gotcha
and (#LEVEL.rooms < ((LEVEL.min_rooms + LEVEL.max_rooms) / 2)) then
if emergency_linear_sprouts() == "oof" then
emergency_teleport_break(LEVEL)
Expand Down
3 changes: 1 addition & 2 deletions scripts/level.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
prebuilt -- true if level will is prebuilt (not generated)
is_procedural_gotcha -- true if this level is a special Procedural Gotcha arena
is_linear -- true if this level is linear, as in no branching rooms
is_nature -- true if this level is entirely parks and caves
has_streets -- true if this level contains Street Mode streets
Expand Down Expand Up @@ -2702,7 +2701,7 @@ function Level_make_level(LEV)

if coverage_target == 0 then coverage_target = LEVEL.min_coverage end

if not LEVEL.is_linear and not SHAPE_GRAMMAR.ignore_coverage then
if not SHAPE_GRAMMAR.ignore_coverage then
if LEVEL.cur_coverage < coverage_target then
res = "runt"
end
Expand Down

0 comments on commit 07cde30

Please sign in to comment.