----------------------------------------------------------------------------------------
-- core.lua
----------------------------------------------------------------------------------------
dofile("utils.lua")
dofile("oop.lua")
dofile("task_system.lua")
dofile("tasks.lua")

dofile("minigames.lua")
dofile("short_name.lua")
dofile("states.lua")
dofile("items.lua")
dofile("event_loop.lua")
dofile("interface.lua")
dofile("debug.lua")
dofile("game_progress.lua")
dofile("game_progress_com3.lua")
dofile("fx.lua")
dofile("counter.lua")
dofile("scene_nodes.lua")
dofile("savable_tables.lua")
dofile("math.lua")
dofile("old_interface_map.lua")
dofile("table_save.lua")
dofile("save_manager.lua")
dofile("hint_manager.lua")
dofile("game.lua")
dofile("diary.lua")
dofile("gui_animations.lua")
dofile("subtitles.lua")

----------------------------------------------------------------------------------------
-- Setup main actor
-- Character:Load("hero")
-- local hero = Character:Get("hero")
-- Character:SetMainActor(hero)
----------------------------------------------------------------------------------------

-- set keyboard callback script
Game:SetKeyboardCallback("keyboard.lua")
-- set mouse callback script
Game:SetMouseCallback("mouse.lua")
----------------------------------------------------------------------------------------
Audio:UpdateVolume()

MystDialog:AttachMainScript("dialog.lua", "Dialogs")

function SetProfile(profile)
  states["sys_current_profile"] = profile
  SaveMgr:SetSaveSubDir(profile)
  
  Settings = Game:GetSettings()
  Settings:SetParameter("LastProfile", profile)  
  Settings:Save()
  
  if Widgets and Widgets.MainMenu then
    Widgets.MainMenu.UpdateGreetings()
  end
  
end

if Game:GetSettings():GetParameter("LastProfile") ~= "" then
  SetProfile( Game:GetSettings():GetParameter("LastProfile")  )
elseif Config["debug_mode"] == "true" then
  SetProfile(Config["default_debug_profile"])
end

Movie("logo")
OpenMainMenu()
----------------------------------------------------------------------------------------
 

