home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 March / Gamestar_82_2006-03_dvd.iso / Dema / ankh_demo_en.exe / media / lua / AnkhInitialization.lua < prev    next >
Encoding:
Text File  |  2005-12-02  |  7.9 KB  |  216 lines

  1. ---------------------------------------------------------------------------
  2. ---------------------- Ankh functions -------------------------------------
  3. ---------------------------------------------------------------------------
  4. -- The functions defined here are specific to the Ankh project           --
  5. ---------------------------------------------------------------------------
  6.  
  7. -- an empty table where the ankh functions go :)
  8. ankh={}
  9.  
  10. ---------------------------------------------------------------------------
  11. -- initializes the scripted logic for the game
  12. ---------------------------------------------------------------------------
  13. function ankh:initialize()
  14.    self:initializeQuests()
  15.    -- kick off the game logic after initialization
  16.    -- this is a single shot, so it will not be called
  17.    -- repeatedly
  18.    
  19.    --TaskMgr:subscribeTaskEvent("RenderTargetUpdater", "EventTaskUpdated", 
  20.    --                  "ankh:startDemo",
  21.    --                 true)
  22.  
  23.    
  24.  
  25.    --api:setObjectsVisibleByType(GameEntity.DefaultInteractor, false)
  26.  
  27.    api:script("AnkhDevAux.lua")
  28.  
  29.    Logger:setLoggingLevel(Log.LL_EVERYTHING)
  30. end
  31. ---------------------------------------------------------------------------
  32.  
  33. ---------------------------------------------------------------------------
  34. -- initializes/creates all the quests for this game
  35. ---------------------------------------------------------------------------
  36. function ankh:initializeQuests()
  37.  
  38.    local do1stPlayable = true
  39.    local do2ndPlayable = false
  40.    local doPressPreview = false
  41.  
  42.    local doDemo = true
  43.  
  44.    if doDemo then
  45.       api:script("AnkhQuest_CrocMask.lua")
  46.       api:script("AnkhQuest_Global.lua")
  47.    elseif do1stPlayable then
  48.       api:script("AnkhQuest_Bulbul_Demo.lua")
  49.    else   
  50.       api:script("AnkhQuest_Global.lua")
  51.       api:script("AnkhQuest_Bulbul.lua")
  52.       api:script("AnkhQuest_Burger.lua")
  53.       api:script("AnkhQuest_TriggerControl.lua")
  54.       api:script("AnkhQuest_CrocMask.lua")
  55.       api:script("AnkhQuest_EnterPalace.lua")
  56.       api:script("AnkhQuest_Embassy.lua")
  57.       api:script("AnkhQuest_EnterTemple.lua")
  58.       api:script("AnkhQuest_EscapeFromHome.lua")
  59.       api:script("AnkhQuest_EscapePalace.lua")
  60.       api:script("AnkhQuest_Final.lua")
  61.       api:script("AnkhQuest_GardenBakery.lua")
  62.       api:script("AnkhQuest_Garden.lua")
  63.       api:script("AnkhQuest_Oasis.lua")
  64.       api:script("AnkhQuest_Osiris.lua")
  65.       api:script("AnkhQuest_Ritual.lua")
  66.       api:script("AnkhQuest_EscapePalace.lua")
  67.       api:script("AnkhQuest_SunOfCairo.lua")
  68.       api:script("AnkhQuest_Sphinx.lua")
  69.       api:script("AnkhQuest_EnterUnderworld.lua")
  70.       api:script("AnkhIntro.lua")
  71.  
  72.       Global:init()
  73.       Global:activate()
  74.       TriggerControl:init()
  75.       TriggerControl:activate()
  76.       EscapeFromHome:init()
  77.       Burger:init()
  78.       CrocMask:init()
  79.       Oasis:init()
  80.       EnterPalace:init()
  81.       EnterTemple:init()
  82.       GardenBakery:init()
  83.       Garden:init()
  84.       Ritual:init()
  85.       EscapePalace:init()
  86.       Embassy:init()
  87.       Bulbul:init()
  88.       SunOfCairo:init()
  89.       Sphinx:init()
  90.       EnterUnderworld:init()
  91.       Osiris:init()
  92.    end
  93.  
  94.    if do2ndPlayable then
  95.       iactor_home_noble_street_front_to_bazar:setConfiguration("Demo_iactor_home_noble_street_front_to_bazar")
  96.    end
  97.  
  98.    if doPressPreview then
  99.       --iactor_palace_prison_cell_to_palace_prison_tunnel:setConfiguration("Demo_iactor_palace_prison_cell_to_palace_prison_tunnel")
  100.    end
  101.  
  102. end
  103. ---------------------------------------------------------------------------
  104.  
  105. ---------------------------------------------------------------------------
  106. -- initializes/creates all the conversations used within the first part
  107. -- of the game 
  108. ---------------------------------------------------------------------------
  109. function ankh:createConversations()
  110. end
  111. ---------------------------------------------------------------------------
  112.  
  113. ---------------------------------------------------------------------------
  114. -- initializes/creates all the cutscenes used within the first part
  115. -- of the game 
  116. ---------------------------------------------------------------------------
  117. function ankh:createCutscenes()
  118. end
  119. ---------------------------------------------------------------------------
  120.  
  121. ---------------------------------------------------------------------------
  122. -- starts/kicks off the game logic for the demo
  123. ---------------------------------------------------------------------------
  124. function ankh:startDemo()
  125.    CameraMgr:activateCamera("cam_palace_backdoor_entrance")
  126.  
  127.    Bulbul:init()
  128.    Bulbul:activate()
  129.  
  130.    --LocationMgr:activateLocation("palace_backdoor")
  131.    --api:cutscene("Bulbul_intro")
  132.  
  133.    api:cutscene("Bulbul_demo_intro")
  134.    --LocationMgr:activateLocation("palace_backdoor")
  135.    --LocationMgr:changeCameraAndOrLocation("palace_backdoor",
  136. --                     "cam_palace_backdoor_entrance",
  137.     --                 PinaVector3(0,0,0),
  138.         --             Rotate(Degree(0),Degree(0),Degree(0)),
  139.             --         "")
  140. end
  141. ---------------------------------------------------------------------------
  142.  
  143. ---------------------------------------------------------------------------
  144. -- starts/kicks off the game logic
  145. ---------------------------------------------------------------------------
  146. function ankh:start()
  147.    TaskMgr:subscribeTaskEvent("RenderTargetUpdater", "EventTaskUpdated", 
  148.                   "GameStateMgr:fadeIn(2.0)",
  149.                   true)
  150.    TaskMgr:subscribeTaskEvent("GameStateManager",
  151.                      "EventFadingInFinished",
  152.                      "Ankh:toggleMenu",
  153.                      true)
  154. end
  155. ---------------------------------------------------------------------------
  156.  
  157. ---------------------------------------------------------------------------
  158. -- starts/kicks off the game logic
  159. ---------------------------------------------------------------------------
  160. function ankh:startGameWithIntro()
  161.    --Intro:activate()
  162.    --TaskMgr:subscribeTaskEvent("RenderTargetUpdater", "EventTaskUpdated", 
  163.     --              "EscapeFromHome:activate()",
  164.         --          true)
  165.  
  166.    CrocMask:init()
  167.    CrocMask:activate()
  168.  
  169.    api:cutscene("CrocMask_nile_scene")
  170. end
  171. ---------------------------------------------------------------------------
  172.  
  173. ---------------------------------------------------------------------------
  174. -- starts/kicks off the game logic
  175. ---------------------------------------------------------------------------
  176. function ankh:startGame()
  177.    LocationMgr:activateLocation("home")
  178.    TaskMgr:subscribeTaskEvent("RenderTargetUpdater", "EventTaskUpdated", 
  179.                   "EscapeFromHome:activate()",
  180.                   true)
  181. end
  182. ---------------------------------------------------------------------------
  183.  
  184. ---------------------------------------------------------------------------
  185. -- utility function reparsing all the lua scripts (for devel/debug purposes)
  186. ---------------------------------------------------------------------------
  187. function ankh:reparseAllScripts()
  188.    api:script("AnkhInitialization.lua")
  189.    api:script("PinaAPI.lua")
  190.    ankh:initializeQuests()
  191. end
  192. ---------------------------------------------------------------------------
  193.  
  194. ---------------------------------------------------------------------------
  195. -- encapsulates a simple object interaction
  196. ---------------------------------------------------------------------------
  197. function ankh:playInteractionAnimation(p_Animation, p_Interactor, p_Sentence)
  198.    local character = GameEntityMgr:getCharacter("char_assil")
  199.    --character:attachToBone(p_Interactor)
  200.    character:blendToPlayOnceAndBack(p_Animation)
  201.    character:say(p_Sentence)
  202. end
  203. ---------------------------------------------------------------------------
  204.  
  205. ---------------------------------------------------------------------------
  206. -- encapsulates a simple object interaction
  207. ---------------------------------------------------------------------------
  208. function ankh:playInteractionAnimation_(p_Character, p_Animation,
  209.                     p_Interactor, p_Sentence)
  210.    local character = GameEntityMgr:getCharacter(p_Character)
  211.    --character:attachObject(p_Interactor)
  212.    character:blendToPlayOnceAndBack(p_Animation)
  213.    character:say(p_Sentence)
  214. end
  215. ---------------------------------------------------------------------------
  216.