home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 93 / CDMM_93_2.ISO / Project Nomads / nomads_demo_eng.exe / MENUACTION.TCL < prev    next >
Encoding:
Text File  |  2002-07-06  |  6.9 KB  |  221 lines

  1. #-------------------------------------------------------------------------------
  2. #   menuaction.tcl
  3. #
  4. #   All function for the Nomads menu.
  5. #-------------------------------------------------------------------------------
  6.  
  7. # single player clan color constants
  8. set sp_clancolor_john_red      0.0
  9. set sp_clancolor_john_green    0.7
  10. set sp_clancolor_john_blue     0.9
  11.  
  12. set sp_clancolor_goliath_red   1.0
  13. set sp_clancolor_goliath_green 0.1
  14. set sp_clancolor_goliath_blue  0.0
  15.  
  16. set sp_clancolor_susie_red     0.7
  17. set sp_clancolor_susie_green   0.9
  18. set sp_clancolor_susie_blue    0.0
  19.  
  20. #-------------------------------------------------------------------------------
  21.  
  22.  
  23. # multiplayer clancolor variables
  24. set mp_clancolor_red   1.0
  25. set mp_clancolor_green 1.0
  26. set mp_clancolor_blue  1.0
  27.  
  28. # the selected character prototype
  29. set character_proto    char_john
  30.  
  31. #-------------------------------------------------------------------------------
  32. #   m_startgamefrombook
  33. #
  34. #   Wraps starting a new game and loads the book given as argument.
  35. #-------------------------------------------------------------------------------
  36. proc m_startgamefrombook {book} {
  37. global home
  38.  
  39. global sp_clancolor_john_red
  40. global sp_clancolor_john_green
  41. global sp_clancolor_john_blue
  42. global sp_clancolor_goliath_red
  43. global sp_clancolor_goliath_green
  44. global sp_clancolor_goliath_blue
  45. global sp_clancolor_susie_red
  46. global sp_clancolor_susie_green
  47. global sp_clancolor_susie_blue
  48.  
  49. global character_proto
  50.  
  51.     # show loading screen
  52.     delete_possessicon
  53.     delete_artefacts
  54.     delete_ebar
  55.     delete_helpscreen
  56.  
  57.     # pause the game
  58.     /world.pausegame
  59.  
  60.     # execute the right alias routine based on character_proto variable
  61.     set backpack ""
  62.     if {$character_proto == "char_john"} {
  63.         john_aliases
  64.         set backpack "backpack"
  65.         set sp_clancolor_red   $sp_clancolor_john_red 
  66.         set sp_clancolor_green $sp_clancolor_john_green 
  67.         set sp_clancolor_blue  $sp_clancolor_john_blue
  68.     } elseif {$character_proto == "char_goliath"} {
  69.         goliath_aliases
  70.         set backpack "backpack_g"
  71.         set sp_clancolor_red   $sp_clancolor_goliath_red 
  72.         set sp_clancolor_green $sp_clancolor_goliath_green 
  73.         set sp_clancolor_blue  $sp_clancolor_goliath_blue
  74.     } elseif {$character_proto == "char_susie"} {
  75.         susie_aliases
  76.         set backpack "backpack_s"
  77.         set sp_clancolor_red   $sp_clancolor_susie_red 
  78.         set sp_clancolor_green $sp_clancolor_susie_green 
  79.         set sp_clancolor_blue  $sp_clancolor_susie_blue
  80.     }
  81.  
  82.     # load the book
  83.     /world.loadbook2 $book
  84.  
  85.     /world.settimeofday         50000
  86.     /sys/servers/channel.setchannel1f windstrength 0.1
  87.     /sys/servers/channel.setchannel1f winddir      33
  88.  
  89.     # connect camera to JOHN (speziell fⁿr XBOX DEMO)
  90.     /world.setviewercarrier [[/world.getuserclan].getmaennel]
  91.     /world.sethandcontrol   [[/world.getuserclan].getmaennel]
  92.     
  93.     # Activate fast possess by default
  94.     /world.activatefastpossess
  95.  
  96.     # set the clan color
  97.     [/world.getuserclan].setclancolor $sp_clancolor_red $sp_clancolor_green $sp_clancolor_blue
  98.  
  99.     # ATTACH BACKPACK
  100.     icke
  101.     .setattachslottarget 0 $backpack
  102.  
  103.     if {[exists /world/gui/splashscreen]} { delete /world/gui/splashscreen }
  104.  
  105.     # continue game and fadein
  106.     /world.contgame
  107.     /game/handler/cookie.setcookie "_character" $character_proto
  108.     puts "charname:"
  109.     puts [friendname]
  110.     puts "<-- m_startgamefrombook"
  111. }
  112.  
  113. #-------------------------------------------------------------------------------
  114. #   m_newgame
  115. #   Start a new single player game.
  116. #-------------------------------------------------------------------------------
  117. proc m_newgame {} {
  118.     m_startgamefrombook "home:book"
  119. }
  120.  
  121. #-------------------------------------------------------------------------------
  122. # Play test level
  123. #-------------------------------------------------------------------------------
  124. proc m_testbook {} {
  125.     m_startgamefrombook "home:data/book"
  126. }
  127.  
  128. #------------------------------------------------------------------------------
  129. #   m_createcharacter
  130. #   Create a character for the various session types. A client creates a clan
  131. #   with the character, a host searches the userclan for a character and
  132. #   replaces it with a new character. The character proto is defined
  133. #   by the global variable 
  134. #------------------------------------------------------------------------------
  135. proc m_createcharacter {} {
  136. global mp_clancolor_red
  137. global mp_clancolor_green
  138. global mp_clancolor_blue
  139. global character_proto
  140. global home
  141.  
  142.     # single player case: search "maennel" and
  143.     # replace it with the selected character
  144.     if {[/world.isnetsession] == "false"} {
  145.  
  146.         # get user clan and its maennel
  147.         set clan [/world.getuserclan]
  148.         if {$clan == "null"} {
  149.             puts "*** no user clan on character creation"
  150.             return
  151.         }
  152.         set maennel [$clan.getmaennel]
  153.         if {$maennel == "null"} {
  154.             puts "*** no maennel in user clan on character creation"
  155.             return
  156.         }
  157.         
  158.         # create new maennel
  159.         set new_maennel [$clan.createvehicle $character_proto]
  160.  
  161.         
  162.         # align position and orientation and state with original
  163.         $new_maennel.alignvehicle $maennel 0 0 0 0 0 0
  164.         $new_maennel.setstate [$maennel.getstate]
  165.         $new_maennel.setmaxartefacts [$maennel.getmaxartefacts]
  166.  
  167.         # release original
  168.         $clan.releasevehicle $maennel
  169.  
  170.         return
  171.     }
  172.     
  173.     # multiplayer case: server or client?
  174.     if {[/world.ishost] == "true"} {
  175.  
  176.         # Load character and island from slot
  177.         set clan [/world.getuserclan]
  178.         if {$clan != "null"} {
  179.             puts $clan
  180.         }
  181.         set filename $home/save/characters/$character_proto
  182.         /world.loadcharacter $filename
  183.  
  184.         # get user clan and its maennel
  185.         set clan [/world.getuserclan]
  186.         if {$clan == "null"} {
  187.             puts "*** no user clan on character creation"
  188.             return
  189.         }
  190.  
  191.         set maennel [$clan.getmaennel]
  192.         if {$maennel == "null"} {
  193.             puts "*** no maennel in user clan on character creation"
  194.             return
  195.         }
  196.  
  197.         /world.sethandcontrol $maennel
  198.         /world.setviewercarrier $maennel
  199.  
  200.     } else {
  201.  
  202.         # Load character from slot
  203.         set filename $home/save/characters/$character_proto
  204.         /world.loadcharacter $filename
  205.  
  206.         set clan [/world.getuserclan]
  207.         set maennel [$clan.getmaennel]
  208.         /world.sethandcontrol $maennel
  209.         /world.setviewercarrier $maennel
  210.     }
  211.     
  212.     # multiplayer: let every clienbt start with different faction to
  213.     # guarantee enemy state. possible with machine id
  214.     set clan [/world.getuserclan]
  215.     $clan.setfaction [/sys/servers/comm.getclientid]
  216.  
  217.     # set the clan color
  218.     [/world.getuserclan].setclancolor $mp_clancolor_red $mp_clancolor_green $mp_clancolor_blue
  219. }
  220.  
  221.