StandardButtonFont = {
    "fonts/arial.mvec",
    40,
    Color(0,0,0,255)
};

StandardButtonGraphics = {
    "buttons/buttonup.png",
    "buttons/buttondown.png",
    "buttons/buttonrollover.png"
};

-- Extract name of the screen from game state.

-- local screen_name = gDialogTable.screen_name
local screen_name = SelectedScreen()
SelectScreen( "" )
assert( screen_name ~= "" )

-- Retrieve all configuration files.

local common_hud_items = assert( loadfile( "hud/items.lua" ) )
local common_hud_overlay_items = assert( loadfile( "hud/overlay_items.lua" ) )
local common_hud_overlay_items_animations = assert( loadfile( "hud/overlay_items_animations.lua" ) )

local effects_items = assert( loadfile( "screens/effects/items.lua" ) )
local effects_items_animations = assert( loadfile( "screens/effects/animations.lua" ) )

-- minigames
------------
local minigames_dir = "gameplaymodes/"

-- CAMERAHUNT
local camerahunt_dir = minigames_dir .. "camerahunt/"

local camerahunt_images = camerahunt_dir .. "images/"
local camerahunt_items_script = assert( loadfile( camerahunt_dir .. "items.lua" ) )
local camerahunt_hud_items_script = assert( loadfile( camerahunt_dir .. "hud.lua" ) )

------------

local book_hud_items_script = assert( loadfile( "hud/Book/items.lua" ) )

-- dialogues initialization
local dialogue_templates_script = assert( loadfile( "hud/dialogue_templates.lua" ) )
local screen_path = "screens/" .. screen_name .. "/"

local common_dialogues_script = assert( loadfile( "screens/common/dialogues.lua" ) )

local scene_items_script = assert( loadfile( screen_path .. "scene_items.lua" ) )
local hud_items_script = assert( loadfile( screen_path .. "hud_items.lua" ) )

local hidden_items_script = assert( loadfile( screen_path .. "hidden_items.lua" ) )
local improper_items_script = assert( loadfile( screen_path .. "improper_items.lua" ) )

local list_items_script = assert( loadfile( screen_path .. "list_items.lua" ) )
local collections_items_script = assert( loadfile( screen_path .. "collections_items.lua" ) )
local advcollections_items_script = assert( loadfile( screen_path .. "advcollections_items.lua" ) )

local adventure_items_script = assert( loadfile( screen_path .. "adventure_items.lua" ) )
local colladventure_items_script = assert( loadfile( screen_path .. "colladventure_items.lua" ) )

local listadventure_items_script = assert( loadfile( screen_path .. "listadventrue_items.lua" ) )

local region_items_script = assert( loadfile( screen_path .. "region_items.lua" ) )

local dialogues_script = loadfile( screen_path .. "dialogues.lua" )

local screen_script = assert( loadfile( screen_path .. "screen.lua" ) )

-- Optional improper &far  item structures

local removed_improper_items_script = loadfile( screen_path .. "removed_improper_items.lua" )
local removed_improper_items_config = {}
if removed_improper_items_script then
     removed_improper_items_config = removed_improper_items_script()
end

local removed_far_items_script = loadfile( screen_path .. "removed_hidden_items.lua" )
local removed_far_items_config = {}
if removed_far_items_script then
     removed_far_items_config = removed_far_items_script()
end

-- Construct optional sound structures.

local sound_script = loadfile( screen_path .. "sound.lua" )
local sound_config = nul
if sound_script then
      sound_config = sound_script()
end

-- Construct optional animation structures.
local scene_animations_script = loadfile( screen_path .. "scene_animations.lua" )
local scene_animations_config = {}
if scene_animations_script then
      scene_animations_config = scene_animations_script()
end

local hud_animations_script = loadfile( screen_path .. "hud_animations.lua" )
local hud_animations_config = {}
if hud_animations_script then
      hud_animations_config = hud_animations_script()
end

-- Construct configuration structure for gadgets
-- if corresponding logical file exists

local gadget_parts_script = loadfile( screen_path .. "gadgets.lua" )
local gadget_parts_config = nul
if gadget_parts_script then
      gadget_parts_config = gadget_parts_script()
end

-- Construct configuration structure for CaF
-- if corresponding file exists.

local clean_and_fix_script = loadfile( screen_path .. "clean_and_fix.lua" )
local clean_and_fix_config = nul
if clean_and_fix_script then
      clean_and_fix_config = clean_and_fix_script()
end

-- Construct configuration structure for child rescue
-- if corresponding file exists.

local child_rescue_script = loadfile( screen_path .. "child_rescue.lua" )
local child_rescue_config = nul
if child_rescue_script then

    -- Retrieve data tables.

    local child_items_data = dofile( screen_path .. "child_items.lua" )
    local child_rescue_manual = child_rescue_script()

    child_rescue_config = {

        -- Manually specified data.

        child_heart_position = child_rescue_manual.child_heart_position,
        rescued_child_set = child_rescue_manual.rescued_child_set,
        child_rescue_particles = child_rescue_manual.child_rescue_particles,

        screen_specific = child_rescue_manual.screen_specific,

        -- Automaticaly generated data.

        child_thermal_set = child_items_data.child_thermal_set,
        child_tracked_hideout_set = child_items_data.child_tracked_hideout_set,

        thermal_items = child_items_data.thermal_items,
        tracks = child_items_data.tracks,

        visible_before_rescue = child_items_data.visible_before_rescue,
        visible_after_rescue = child_items_data.visible_after_rescue,
    }
end

-- Construct the dialog.

MakeDialog
{
    name="game_dialog",

    screen_script() {

         name="game_screen_window",
         x = 0,
         y = 0,
         w = kMax,
         h = kMax,

         -- Scene sounds.

         sound = sound_config,

         -- Common configuration of the hud.

         common_hud_directory = "hud/images/",
         common_hud_items = common_hud_items(),
         common_hud_overlay_items = common_hud_overlay_items(),
         common_hud_overlay_items_animations = common_hud_overlay_items_animations(),
         
         effects_directory = "screens/effects/images/",
		 effects_items = effects_items(),
		 effects_items_animations = effects_items_animations(),

		-- Minigames
		------------
		
		-- Camera hunt
		camerahunt_items = camerahunt_items_script(),
		camerahunt_hud_items = camerahunt_hud_items_script(),
		camerahunt_directory = camerahunt_images,         
         -- Book hud items
         book_hud_directory = "hud/Book/images/",
         book_hud_items = book_hud_items_script(),
         
         -- Dialogues configuration
         
         
         common_dialogues = common_dialogues_script(),
         
         dialogue_templates = dialogue_templates_script(),
         dialogues = dialogues_script(),

         -- Gadget sounds.

         heart_beat_gadget_sound = "sounds/heart.ogg",

         -- Base visualization.

         screen_name = screen_name,
         screen_directory = screen_path .. "images/",

         scene_items = scene_items_script(),
         scene_items_animations = scene_animations_config,

         hud_items = hud_items_script(),
         hud_items_animations = hud_animations_config,

         -- Configuration for hidden items, improper items and gadget parts.

         hidden_items = hidden_items_script(),
         removed_hidden_items = removed_far_items_config,
         improper_items = improper_items_script(),
         removed_improper_items = removed_improper_items_config,
         gadget_parts = gadget_parts_config,

		 -- Configuration for listitems
		 
		 list_items = list_items_script(),
		 collections_items = collections_items_script(),
         advcollections_items = advcollections_items_script(),
         adventure_items = adventure_items_script(),
         colladventure_items = colladventure_items_script(),
         
         listadventure_items = listadventure_items_script(),
         
         region_items = region_items_script(),
         -- Configuration for clean and fix gameplay.

         clean_and_fix = clean_and_fix_config,

         -- Configuration for child rescue gameplay.

         child_rescue = child_rescue_config,
    },
}
