------------------------------------------------------------------------
--  BASIC DEFINITIONS
------------------------------------------------------------------------
--
--  // Obsidian //
--
--  Copyright (C) 2006-2017 Andrew Apted
--  Copyright (C) 2020-2022 MsrSgtShooterPerson
--  Copyright (C) 2020-2022 Armaetus
--
--  This program is free software; you can redistribute it and/or
--  modify it under the terms of the GNU General Public License
--  as published by the Free Software Foundation; either version 2
--  of the License, or (at your option) any later version.
--
--  This program is distributed in the hope that it will be useful,
--  but WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
--  GNU General Public License for more details.
--
------------------------------------------------------------------------

-- important global tables
GAME   = {}
PARAM  = {}
STYLE  = {}
THEME  = {}

SCRIPTS = {}

EPISODE = {}
PREFABS = {}
GROUPS  = {}
TEMPLATES = {}

SHAPE_GRAMMAR = {}

SHAPES = {}

RANDOMIZE_GROUPS = {}

-- a place for unfinished stuff
UNFINISHED = {}


-- tables which interface with GUI code
OB_CONFIG = {}

OB_GAMES   = {}
OB_THEMES  = {}
OB_ENGINES = {}
OB_PORTS = {}
OB_MODULES = {}


-- internationalization / localization
function _(s) return gui.gettext(s) end

-- special theme types, usable by all games
OB_THEMES["original"] =
{
  label = _("Original"),
  priority = 91
}


OB_THEMES["epi"] =
{
  label = _("Episodic"),
  priority = 85
}


OB_THEMES["jumble"] =
{
  label = _("Jumbled Up"),
  priority = 80
}


OB_THEMES["bit_mixed"] =
{
  label = _("Bit Mixed"),
  priority = 81
}


OB_THEMES["psycho"] =
{
  label = _("Psychedelic"),
  priority = -99  -- bottom most
}


-- choices for Length button
LENGTH_CHOICES =
{
  "single",  _("Single Level"),
  "few",     _("A Few Maps"),
  "episode", _("One Episode"),
  "game",    _("Full Game")
}


-- important constants --

-- size of each seed square
SEED_SIZE = 128

-- highest possible Z coord (and lowest, when negative)
EXTREME_H = 32000


-- special value for merging tables
REMOVE_ME = "__REMOVE__"


-- constants for gui.spots_xxx API functions
SPOT_CLEAR    = 0
SPOT_LOW_CEIL = 1
SPOT_WALL     = 2
SPOT_LEDGE    = 3


-- monster and item stuff
MONSTER_QUANTITIES =
{
  rarest = 0.15,
  rarer  = 0.35,
  rare   = 0.7,
  scarce = 1.0,
  few    = 1.3,
  less   = 1.5,
  normal = 2.0,
  more   = 2.5,
  heaps  = 3.0,
  legions = 3.5,
  insane = 4.0,
  deranged = 4.5,
  nuts   = 5.0,
  chaotic = 5.5,
  unhinged = 6.0,
  ludicrous = 6.66
}

MONSTER_KIND_TAB =
{
  none   = 0.1,
  rarest = 0.25,
  rarer  = 0.5,
  rare   = 0.75,
  scarce = 1.0,
  few    = 1.33,
  less   = 1.6,
  normal = 1.9,
  more   = 2.0,
  heaps  = 2.0,
  legions = 2.0,
  insane = 2.0,
  deranged = 2.0,
  nuts   = 2.0,
  chaotic = 2.0,
  unhinged = 2.0,
  ludicrous = 2.0
}

-- weapon max_damage thresholds
-- larger numbers means more monsters are
-- added to the global palette
MONSTER_KIND_JUMPSTART =
{
  default = 5,
  harder = 40,
  tougher = 80,
  fiercer = 160,
  crazier = 240
}

MONSTER_KIND_JUMPSTART_LEVELS =
{
  default = 0,
  harder = 2,
  tougher = 4,
  fiercer = 8,
  crazier = 12
}

BOSS_FACTORS =
{
  easier = 0.30,
  medium = 0.60,
  harder = 1.00
}

HEALTH_FACTORS =
{
  none     = 0,
  scarce   = 0.4,
  less     = 0.64,
  bit_less = 0.8,
  normal   = 1.0,
  bit_more = 1.15, --1.3
  more     = 1.5, --1.6
  heaps    = 2.5
}

AMMO_FACTORS =
{
  none     = 0,
  scarce   = 0.64,
  less     = 0.8,
  bit_less = 0.9,
  normal   = 1.0,
  bit_more = 1.1,
  more     = 1.25,
  heaps    = 1.6
}

SECRET_BONUS_FACTORS =
{
  none     = 0,
  more     = 0.5,
  heaps    = 1,
  heapser  = 2,
  heapsest = 4
}

--

ROOM_SIZE_MULTIPLIER_MIXED_PROBS =
{
  normal = 
  {
    [0.25] = 1,
    [0.5] = 2,
    [0.75] = 3,
    [1] = 3,
    [1.25] = 3,
    [1.5] = 2,
    [2] = 2,
    [4] = 1.5,
    [6] = 1,
    [8] = 1
  },

  smallish =
  {
    [0.25] = 1,
    [0.5] = 2,
    [0.75] = 3,
    [1] = 5,
    [1.25] = 0,
    [1.5] = 0,
    [2] = 0,
    [4] = 0,
    [6] = 0,
    [8] = 0
  },

  small =
  {
    [0.25] = 5,
    [0.5] = 10,
    [0.75] = 1,
    [1] = 0.25,
    [1.25] = 0,
    [1.5] = 0,
    [2] = 0,
    [4] = 0,
    [6] = 0,
    [8] = 0
  },

  largeish =
  {
    [0.25] = 0,
    [0.5] = 0,
    [0.75] = 0,
    [1] = 5,
    [1.25] = 4,
    [1.5] = 3,
    [2] = 3,
    [4] = 3,
    [6] = 2,
    [8] = 2
  },

  large =
  {
    [0.25] = 0,
    [0.5] = 0,
    [0.75] = 0,
    [1] = 0,
    [1.25] = 0.25,
    [1.5] = 1.5,
    [2] = 5,
    [4] = 10,
    [6] = 5,
    [8] = 2
  },

  conservative =
  {
    [0.25] = 0.2,
    [0.5] = 3,
    [0.75] = 4,
    [1] = 5,
    [1.25] = 2.5,
    [1.5] = 0.5,
    [2] = 0.2,
    [4] = 0.1,
    [6] = 0.05,
    [8] = 0.05
  },

  very_conservative =
  {
    [0.25] = 1.25,
    [0.5] = 5,
    [0.75] = 3,
    [1] = 10,
    [1.25] = 0.5,
    [1.5] = 0.25,
    [2] = 0.1,
    [4] = 0.025,
    [6] = 0.001,
    [8] = 0.0001
  },

  random =
  {
    [0.25] = 1,
    [0.5] = 1,
    [0.75] = 1,
    [1] = 1,
    [1.25] = 1,
    [1.5] = 1,
    [2] = 1,
    [4] = 1,
    [6] = 1,
    [8] = 1
  }
}

ROOM_AREA_MULTIPLIER_MIXED_PROBS =
{
  normal =
  {
    [0.15] = 1,
    [0.5] = 2,
    [0.75] = 2,
    [1] = 3,
    [1.5] = 2,
    [2] = 2,
    [4] = 1
  },

  lessish =
  {
    [0.15] = 2,
    [0.5] = 3,
    [0.75] = 4,
    [1] = 5,
    [1.5] = 0,
    [2] = 0,
    [4] = 0
  },

  less =
  {
    [0.15] = 2,
    [0.5] = 5,
    [0.75] = 7,
    [1] = 10,
    [1.5] = 0.5,
    [2] = 0.25,
    [4] = 0.1
  },

  more =
  {
    [0.15] = 0.08,
    [0.5] = 0.16,
    [0.75] = 0.33,
    [1] = 1.5,
    [1.5] = 5,
    [2] = 10,
    [4] = 3
  },

  moreish =
  {
    [0.15] = 0,
    [0.5] = 0,
    [0.75] = 0,
    [1] = 5,
    [1.5] = 4,
    [2] = 3,
    [4] = 2
  },

  conservative =
  {
    [0.15] = 0.5,
    [0.5] = 1.5,
    [0.75] = 3,
    [1] = 5,
    [1.5] = 0.5,
    [2] = 0.2,
    [4] = 0.025
  },

  very_conservative =
  {
    [0.15] = 0.5,
    [0.5] = 2,
    [0.75] = 5,
    [1] = 10,
    [1.5] = 0.2,
    [2] = 0.1,
    [4] = 0.001
  },

  random =
  {
    [0.15] = 1,
    [0.5] = 1,
    [0.75] = 1,
    [1] = 1,
    [1.5] = 1,
    [2] = 1,
    [4] = 1
  }
}

SIZE_CONSISTENCY_MIXED_PROBS =
{
  strict = 15,
  bounded = 25,
  normal = 60
}

-- outdoor sky sector brightness
SKY_LIGHT_NORMAL =
{ 176,192,208,224,240 }

-- outdor sky sector brightness if level has Dark Outdoors
SKY_LIGHT_DARK =
{ 112,128,144,160 }

--

PROC_GOTCHA_MAP_SIZES =
{
  large = 30,
  regular = 26,
  small = 22,
  tiny = 16
}

PROC_GOTCHA_STRENGTH_LEVEL =
{
  none        = 0,
  harder      = 2,
  tougher     = 4,
  crazier     = 8,
  nightmarish = 16
}

PROC_GOTCHA_QUANTITY_MULTIPLIER =
{
  ["-75"] = 0.25,
  ["-50"] = 0.5,
  ["-25"] = 0.75,
  none    = 1,
  ["25"]  = 1.25,
  ["50"]  = 1.5,
  ["100"] = 2,
  ["150"] = 3,
  ["200"] = 4,
  ["400"] = 8
}



--
-- styles control quantities of things in each level
--
GLOBAL_STYLE_LIST =
{
  outdoors    = { none=30, few=30, some=30, heaps=7 },
  caves       = { none=25, few=15, some=15, heaps=5 },
  parks       = { none=7 , few=1 , some=1 , heaps=1 },
  liquids     = { none=0,  few=20, some=25, heaps=50 },

  hallways    = { none=0,  few=60, some=30, heaps=10 },
  big_rooms   = { none=15, few=40, some=30, heaps=20 },
  big_outdoor_rooms = { none=15, few=20, some=50, heaps=35},
  teleporters = { none=35, few=50, some=20, heaps=10 },
  steepness   = { none=0,  few=10, some=70, heaps=40 },

  traps       = { none=0,  few=25, some=65, heaps=20 },
  cages       = { none=10, few=20, some=40, heaps=10 },
  secrets     = { none=0,  few=15, some=70, heaps=25 },
  ambushes    = { none=10, few=20, some=50, heaps=10 },

  doors       = { none=0,  few=30, some=60, heaps=5 },
  windows     = { none=0,  few=20, some=80, heaps=30 },
  switches    = { none=15, few=30, some=50, heaps=15 },
  keys        = { none=5,  few=15, some=40, heaps=60 },
  trikeys     = { none=5,  few=40, some=30, heaps=20 },

  scenics     = { none=5,  few=10, some=40, heaps=40},
  park_detail = { none=0,  few=5,  some=10, heaps=30},

  symmetry    = { none=35, few=60, some=20, heaps=10 },
  pictures    = { none=0,  few=10, some=70, heaps=30 },
  barrels     = { none=10, few=50, some=35, heaps=10 },

  beams       = { none=10, few=10, some=20, heaps=5  },
  porches     = { none=0,  few=10, some=60, heaps=30 },
  fences      = { none=10, few=20, some=30, heaps=15 }
  -- PLANNED or UNFINISHED stuff --

  --[[
  cycles      = { none=50, few=0,  some=50, heaps=50 }
  ex_floors   = { none=0,  few=40, some=60, heaps=20 }
  lakes       = { none=0,  few=60, some=0,  heaps=10 }
  islands     = { none=0,  few=60, some=0,  heaps=40 }
  ]]
}


STYLE_CHOICES =
{
  "none",   _("NONE"),
  "rare",   _("Rare"),
  "few",    _("Few"),
  "less",   _("Less"),
  "some",   _("Some"),
  "more",   _("More"),
  "heaps",  _("Heaps"),
  "mixed",  _("Mix It Up")
}


--
-- default parameters (each game can override these settings)
--
GLOBAL_PARAMETERS =
{
  map_limit = 10000,

  step_height = 16,
  jump_height = 24,

  spot_low_h  = 72,
  spot_high_h = 128
}


--
-- prefab stuff
--
GLOBAL_PREFAB_FIELDS =
{
  -- Note the double underscore, since these materials actually
  -- begin with an underscore (like "_WALL" and "_FLOOR").

   tex__WALL   = "?wall",
  flat__WALL   = "?wall",

   tex__OUTER  = "?outer",
  flat__OUTER  = "?outer",

   tex__FLOOR  = "?floor",
  flat__FLOOR  = "?floor",

   tex__CEIL   = "?ceil",
  flat__CEIL   = "?ceil",

   tex__FLOOR2 = "?floor2",
  flat__FLOOR2 = "?floor2",

   tex__CEIL2  = "?ceil2",
  flat__CEIL2  = "?ceil2",

  thing_8166   = "?object",

  line_888     = "?switch_action",

  offset_301   = "?x_offset1",
  offset_302   = "?x_offset2",
  offset_303   = "?x_offset3",
  offset_304   = "?x_offset4",

  offset_401   = "?y_offset1",
  offset_402   = "?y_offset2",
  offset_403   = "?y_offset3",
  offset_404   = "?y_offset4"
}


GLOBAL_SKIN_DEFAULTS =
{
  wall   = "_ERROR",

  fence  = "?wall",
  floor  = "?wall",
  ceil   = "?wall",

  outer  = "?wall",
  floor2 = "?outer",
  ceil2  = "?outer",

  x_offset1 = "",
  x_offset2 = "",
  x_offset3 = "",
  x_offset4 = "",

  y_offset1 = "",
  y_offset2 = "",
  y_offset3 = "",
  y_offset4 = "",

  -- Doom engine stuff
  tag = "",
  light = "",
  object = "",
  switch_action = "",
  scroller = "",

  -- Quake engine stuff
  style = "",
  message = "",
  wait = "",
  targetname = ""
}


-- GL only stuff

LIGHT_GROUPS =
{
  plain = -- neutral color (white or beige)
  {
    prob = 30,
    shades =
    {
      "neutrals"
    }
  },

  monochrome = -- neutral color and one other color
  {
    prob = 50,
    shades =
    {
      "neutrals",
      "hues"
    }
  },

  bichrome = -- neutral color and two other colors
  {
    prob = 25,
    shades =
    {
      "neutrals",
      "hues",
      "hues"
    }
  },

  single = -- completely random color
  {
    prob = 50,
    shades =
    {
      "hues"
    }
  },

  double = -- two completely random colors
  {
    prob = 25,
    shades =
    {
      "hues",
      "hues"
    }
  },

  all = -- the kitchen sink
  {
    prob = 15,
  }
}

LIGHT_COLORS =
{
  neutrals = -- neutral light colors
  {
    white = 10,
    beige = 10
  },

  hues = -- more vibrant light colors
  {
    blue = 10,
    red = 10,
    orange = 10,
    yellow = 10,
    beige = 6,
    green = 10,
    purple = 2
  }
}
