--- x_doom2.lua	2015-07-12 09:27:03.395698100 -0700
+++ /home/Sam/x_old.lua	2015-07-12 09:26:59.209166500 -0700
@@ -1,8 +1,9 @@
 ----------------------------------------------------------------
--- GAME DEF : Doom II
+-- GAME DEF : OLD FREEDOOM
 ----------------------------------------------------------------
 --
 --  Oblige Level Maker (C) 2006,2007 Andrew Apted
+--  ObHack changes (C) 2009-2015 Sam Trenholme
 --
 --  This program is free software; you can redistribute it and/or
 --  modify it under the terms of the GNU General Public License
@@ -621,6 +622,7 @@
       skin =
       {
         switch_w="SW1WOOD", side_w="WOOD1",
+	x_offset=0, y_offset=0,
         kind=11, tag=0,
       }
     },
@@ -1802,9 +1804,14 @@
   { URBAN=4, INDUSTRIAL=3, TECH=3, NATURE=9, CAVE=2, HELL=2 },
   { URBAN=9, INDUSTRIAL=5, TECH=7, NATURE=4, CAVE=2, HELL=4 },
   { URBAN=3, INDUSTRIAL=2, TECH=5, NATURE=3, CAVE=6, HELL=8 },
+  --{ URBAN=4, INDUSTRIAL=3, TECH=3, NATURE=9, CAVE=2, HELL=2 },
 
   -- this entry used for a single episode or level
   { URBAN=5, INDUSTRIAL=4, TECH=6, NATURE=5, CAVE=4, HELL=6 },
+  
+  { URBAN=4, INDUSTRIAL=3, TECH=3, NATURE=9, CAVE=2, HELL=2 },
+  { URBAN=9, INDUSTRIAL=5, TECH=7, NATURE=4, CAVE=2, HELL=4 },
+  { URBAN=3, INDUSTRIAL=2, TECH=5, NATURE=3, CAVE=6, HELL=8 },
 }
 
 D2_SECRET_KINDS =
@@ -1839,6 +1846,10 @@
   { start=1,  len=11 },
   { start=12, len=11 },  -- last two are MAP31, MAP32
   { start=21, len=10 },
+  { start=33, len=16 },  -- Not in DOOM2, extra levels
+  { start=49, len=16 },  -- more extras
+  { start=65, len=16 },  -- more extras
+  { start=81, len=16 },  -- more extras
 }
 
 function doom2_get_levels(episode)
@@ -1896,11 +1907,11 @@
 
 ------------------------------------------------------------
 
-GAME_FACTORIES["doom2"] = function()
+GAME_FACTORIES["olddoom2"] = function()
 
   local T = doom_common_factory()
 
-  T.episodes   = 3
+  T.episodes   = 7
   T.level_func = doom2_get_levels
 
   T.quests   = D2_QUESTS
@@ -1931,4 +1942,121 @@
 
   return T
 end
+
+FD_MONSTER_LIST =
+{
+  ---| fairly good |---
+
+  "zombie", "shooter", "imp",
+  "demon",  "spectre", "caco", 
+  "arach", "revenant", "mancubus",
+  "barrel",
+
+  ---| crappy but playable |---
+
+  "baron",  -- not yet coloured
+  "gunner",
+  "ss_dude",
+
+  ---| missing sprites |---
+  
+  -- "skull",  -- missing death frames, uncomment if you want them to be included
+  -- "knight",
+  -- "pain",
+  -- "vile",
+  -- "cyber",
+  -- "spider",
+  -- "keen",
+}
+
+FD_LIQUIDS =
+{
+  water = { floor="FWATER1", wall="WFALL1" },
+}
+
+FD_SKY_INFO =
+{
+  { color="brown",  light=192 },
+  { color="black",  light=160 },
+  { color="red",    light=192 },
+  { color="brown",  light=192 },
+  { color="brown",  light=192 },
+  { color="black",  light=160 },
+  { color="red",    light=192 },
+}
+
+FD_ROOMS =
+{
+  TORTURE =
+  {
+    space_range = { 60, 90 },
+
+    sc_count = { 6,16 },
+
+    scenery =
+    {
+      impaled_human  = 40, impaled_twitch = 40,
+      gutted_victim1 = 40, gutted_victim2 = 40,
+      gutted_torso1  = 40, gutted_torso2  = 40,
+      gutted_torso3  = 40, gutted_torso4  = 40,
+      hang_twitching = 40,
+      other = 50
+    },
+
+    sc_fabs =
+    {
+      pillar_SPDUDE5=30, other=50
+    },
+
+    wall_fabs =
+    {
+      cage_niche_MIDGRATE = 50,
+      wall_pic_SPDUDE1 = 20, wall_pic_SPDUDE2 = 20,
+      wall_pic_SPDUDE7 = 30, wall_pic_SPDUDE8 = 30,
+
+      other = 50
+    },
+  },
+}
+----------------------------------------------------------------
+
+GAME_FACTORIES["old"] = function()
+
+  -- the FreeDOOM IWAD contains both Doom 1 and Doom 2 textures
+
+---!!!  local T = GAME_FACTORIES.doom1()
+---!!!
+---!!!  T.episodes   = 3
+---!!!  T.level_func = doom2_get_levels
+---!!!
+---!!!  T.quests   = D2_QUESTS
+---!!!
+---!!!  T.combos   = copy_and_merge(T.combos,   D2_COMBOS)
+---!!!  T.exits    = copy_and_merge(T.exits,    D2_EXITS)
+---!!!  T.hallways = copy_and_merge(T.hallways, D2_HALLWAYS)
+---!!!
+---!!!  T.rails = copy_and_merge(T.rails, D2_RAILS)
+---!!!
+---!!!  T.hangs   = copy_and_merge(T.hangs,   D2_OVERHANGS)
+---!!!  T.mats    = copy_and_merge(T.mats,    D2_MATS)
+---!!!  T.crates  = copy_and_merge(T.crates,  D2_CRATES)
+---!!!
+---!!!  T.liquids = copy_and_merge(T.liquids, D2_LIQUIDS, FD_LIQUIDS)
+
+  -- TEMPORARY HACK
+  local T = GAME_FACTORIES.olddoom2()
+
+  T.sky_info = FD_SKY_INFO
+  T.rooms  = copy_and_merge(T.rooms, FD_ROOMS)  -- This is here until all the hanging sprites are done
+
+  -- FreeDOOM is lacking many monster sprites
+
+  T.monsters = {}
+  
+  for zzz,mon in ipairs(FD_MONSTER_LIST) do
+    T.monsters[mon] = DM_MONSTERS[mon] or D2_MONSTERS[mon]
+  end
+
+  return T
+end
 
