home *** CD-ROM | disk | FTP | other *** search
- #-------------------------------------------------------------------------------
- # menuaction.tcl
- #
- # All function for the Nomads menu.
- #-------------------------------------------------------------------------------
-
- # single player clan color constants
- set sp_clancolor_john_red 0.0
- set sp_clancolor_john_green 0.7
- set sp_clancolor_john_blue 0.9
-
- set sp_clancolor_goliath_red 1.0
- set sp_clancolor_goliath_green 0.1
- set sp_clancolor_goliath_blue 0.0
-
- set sp_clancolor_susie_red 0.7
- set sp_clancolor_susie_green 0.9
- set sp_clancolor_susie_blue 0.0
-
- #-------------------------------------------------------------------------------
-
-
- # multiplayer clancolor variables
- set mp_clancolor_red 1.0
- set mp_clancolor_green 1.0
- set mp_clancolor_blue 1.0
-
- # the selected character prototype
- set character_proto char_john
-
- #-------------------------------------------------------------------------------
- # m_startgamefrombook
- #
- # Wraps starting a new game and loads the book given as argument.
- #-------------------------------------------------------------------------------
- proc m_startgamefrombook {book} {
- global home
-
- global sp_clancolor_john_red
- global sp_clancolor_john_green
- global sp_clancolor_john_blue
- global sp_clancolor_goliath_red
- global sp_clancolor_goliath_green
- global sp_clancolor_goliath_blue
- global sp_clancolor_susie_red
- global sp_clancolor_susie_green
- global sp_clancolor_susie_blue
-
- global character_proto
-
- # show loading screen
- delete_possessicon
- delete_artefacts
- delete_ebar
- delete_helpscreen
-
- # pause the game
- /world.pausegame
-
- # execute the right alias routine based on character_proto variable
- set backpack ""
- if {$character_proto == "char_john"} {
- john_aliases
- set backpack "backpack"
- set sp_clancolor_red $sp_clancolor_john_red
- set sp_clancolor_green $sp_clancolor_john_green
- set sp_clancolor_blue $sp_clancolor_john_blue
- } elseif {$character_proto == "char_goliath"} {
- goliath_aliases
- set backpack "backpack_g"
- set sp_clancolor_red $sp_clancolor_goliath_red
- set sp_clancolor_green $sp_clancolor_goliath_green
- set sp_clancolor_blue $sp_clancolor_goliath_blue
- } elseif {$character_proto == "char_susie"} {
- susie_aliases
- set backpack "backpack_s"
- set sp_clancolor_red $sp_clancolor_susie_red
- set sp_clancolor_green $sp_clancolor_susie_green
- set sp_clancolor_blue $sp_clancolor_susie_blue
- }
-
- # load the book
- /world.loadbook2 $book
-
- /world.settimeofday 50000
- /sys/servers/channel.setchannel1f windstrength 0.1
- /sys/servers/channel.setchannel1f winddir 33
-
- # connect camera to JOHN (speziell fⁿr XBOX DEMO)
- /world.setviewercarrier [[/world.getuserclan].getmaennel]
- /world.sethandcontrol [[/world.getuserclan].getmaennel]
-
- # Activate fast possess by default
- /world.activatefastpossess
-
- # set the clan color
- [/world.getuserclan].setclancolor $sp_clancolor_red $sp_clancolor_green $sp_clancolor_blue
-
- # ATTACH BACKPACK
- icke
- .setattachslottarget 0 $backpack
-
- if {[exists /world/gui/splashscreen]} { delete /world/gui/splashscreen }
-
- # continue game and fadein
- /world.contgame
- /game/handler/cookie.setcookie "_character" $character_proto
- puts "charname:"
- puts [friendname]
- puts "<-- m_startgamefrombook"
- }
-
- #-------------------------------------------------------------------------------
- # m_newgame
- # Start a new single player game.
- #-------------------------------------------------------------------------------
- proc m_newgame {} {
- m_startgamefrombook "home:book"
- }
-
- #-------------------------------------------------------------------------------
- # Play test level
- #-------------------------------------------------------------------------------
- proc m_testbook {} {
- m_startgamefrombook "home:data/book"
- }
-
- #------------------------------------------------------------------------------
- # m_createcharacter
- # Create a character for the various session types. A client creates a clan
- # with the character, a host searches the userclan for a character and
- # replaces it with a new character. The character proto is defined
- # by the global variable
- #------------------------------------------------------------------------------
- proc m_createcharacter {} {
- global mp_clancolor_red
- global mp_clancolor_green
- global mp_clancolor_blue
- global character_proto
- global home
-
- # single player case: search "maennel" and
- # replace it with the selected character
- if {[/world.isnetsession] == "false"} {
-
- # get user clan and its maennel
- set clan [/world.getuserclan]
- if {$clan == "null"} {
- puts "*** no user clan on character creation"
- return
- }
- set maennel [$clan.getmaennel]
- if {$maennel == "null"} {
- puts "*** no maennel in user clan on character creation"
- return
- }
-
- # create new maennel
- set new_maennel [$clan.createvehicle $character_proto]
-
-
- # align position and orientation and state with original
- $new_maennel.alignvehicle $maennel 0 0 0 0 0 0
- $new_maennel.setstate [$maennel.getstate]
- $new_maennel.setmaxartefacts [$maennel.getmaxartefacts]
-
- # release original
- $clan.releasevehicle $maennel
-
- return
- }
-
- # multiplayer case: server or client?
- if {[/world.ishost] == "true"} {
-
- # Load character and island from slot
- set clan [/world.getuserclan]
- if {$clan != "null"} {
- puts $clan
- }
- set filename $home/save/characters/$character_proto
- /world.loadcharacter $filename
-
- # get user clan and its maennel
- set clan [/world.getuserclan]
- if {$clan == "null"} {
- puts "*** no user clan on character creation"
- return
- }
-
- set maennel [$clan.getmaennel]
- if {$maennel == "null"} {
- puts "*** no maennel in user clan on character creation"
- return
- }
-
- /world.sethandcontrol $maennel
- /world.setviewercarrier $maennel
-
- } else {
-
- # Load character from slot
- set filename $home/save/characters/$character_proto
- /world.loadcharacter $filename
-
- set clan [/world.getuserclan]
- set maennel [$clan.getmaennel]
- /world.sethandcontrol $maennel
- /world.setviewercarrier $maennel
- }
-
- # multiplayer: let every clienbt start with different faction to
- # guarantee enemy state. possible with machine id
- set clan [/world.getuserclan]
- $clan.setfaction [/sys/servers/comm.getclientid]
-
- # set the clan color
- [/world.getuserclan].setclancolor $mp_clancolor_red $mp_clancolor_green $mp_clancolor_blue
- }
-
-