home *** CD-ROM | disk | FTP | other *** search
/ CyberMycha 2006 April / SGP.iso / dema / Keepsake-Demo-en-li-v1.0.exe / res / scenes / common / introduction / main.tcl < prev    next >
Text File  |  2006-01-25  |  46KB  |  1,266 lines

  1. source "[AUTO]/introduction.mvwrap.tcl"
  2.  
  3.  
  4. ## ===================================================== ##
  5. ##   The after effect of the first Vision                ##
  6. ## ===================================================== ##
  7.  
  8. proc subtitle {widget label who text delay} {
  9.     set color "1 1 1"
  10.  
  11.     oz'event {
  12.         eval "oz'label::property $label -color $color -text \\\"$text\\\""
  13.     }
  14.     oz'event {
  15.         oz'widget::fadeto $widget 1 0.1
  16.         oz'delay 0.1
  17.     }
  18.     oz'event {
  19.         oz'delay [expr $delay - 0.2]
  20.     }
  21.     oz'event {
  22.         oz'widget::fadeto $widget 0 0.1
  23.         oz'delay 0.1
  24.     }
  25. }
  26.  
  27.  
  28.  
  29.  
  30. proc update_var {} {
  31.     set ::config::user::voice_volume     [expr double([itf'slider::get_pos $itfopt::($itf::opt,voice)]) / 10.0]
  32.     set ::config::user::soundfx_volume   [expr double([itf'slider::get_pos $itfopt::($itf::opt,sfx)])   / 10.0]
  33.     set ::config::user::music_volume     [expr double([itf'slider::get_pos $itfopt::($itf::opt,music)]) / 25]
  34.     set ::config::user::gamma_correction [expr double([itf'slider::get_pos $itfopt::($itf::opt,gamma)]) / 10.0]
  35.  
  36.     if {$::config::user::music_volume == 0} {
  37.         set ::config::user::music_volume 0.01
  38.     }
  39.    
  40.     set ::config::voice::volume     $::config::user::voice_volume
  41.     set ::config::soundfx::volume   $::config::user::soundfx_volume
  42.     set ::config::music::volume     $::config::user::music_volume
  43.     set ::config::ambient2d::volume $::config::user::soundfx_volume
  44.  
  45.     set ::ref_voice_volume     $::config::user::voice_volume
  46.     set ::ref_soundfx_volume   $::config::user::soundfx_volume
  47.     set ::ref_music_volume     $::config::user::music_volume
  48.     set ::ref_ambient2d_volume $::config::user::soundfx_volume
  49.  
  50.     oz'track::play $::music_track "sound/music/introKeepsake.ogg" -repeat 1
  51.  
  52.     masterVolume $::config::music::volume
  53.     updateGamma
  54.     updateVolume
  55. }
  56.     
  57. proc ShowIntroPanel {} {
  58.     set ::itf::logo  [new oz'sprite "interface/[MODE]/intro/intro.logo"]
  59.     set ::itf::intro [new itf'intro]
  60.     set ::itf::vers  [new oz'label "version" 0.13 0.07]
  61.     set ::itf::vbox  [new oz'widget "vbox"]
  62.  
  63.     oz'label::property  $::itf::vers -pos 0 0 -font system.ttf -fsize 16 -color 0 0 0.1 -alpha 1 -text "Keepsake Demo v1.0"
  64.     oz'widget::property $::itf::vbox -pos 0 0.93 -alpha 0
  65.     oz'widget::property $::itf::logo  -pos 0.246582 0.083333 -alpha 0
  66.     oz'widget::property $::itf::intro -pos 0.328125 0.657552 -alpha 0
  67.       
  68.     oz'widget::child [FOREGROUNDWIDGET] $::itf::logo  0.5
  69.     oz'widget::child [FOREGROUNDWIDGET] $::itf::intro 0.5
  70.     oz'widget::child $::itf::vbox $::itf::vers  0.5
  71.     oz'widget::child [FOREGROUNDWIDGET] $::itf::vbox  0.5
  72.       
  73.     wq'widget::fadeto $::itf::logo  1
  74.     wq'widget::fadeto $::itf::intro 1
  75.     wq'widget::fadeto $::itf::vbox 0.5
  76. }
  77.    
  78. proc ShowSaveGamePanel {} {
  79.     set y 0.041666
  80.     for {set i 1} {$i <= 5} {incr i} {
  81.         set ::itf::game$i 0
  82.         if [file exists "[ROOT]/save/savegame$i.tcl"] {
  83.             set ::itf::game$i [new itf'game $i]
  84.             oz'widget::property [set ::itf::game$i] -pos 0.0625 $y -alpha 0
  85.             oz'widget::child [FOREGROUNDWIDGET] [set ::itf::game$i] 0.5
  86.         }
  87.         set y [expr $y + 0.1875]
  88.     }
  89.  
  90.     oz'event {wizDisableMouse}
  91.         
  92.     for {set i 1} {$i <= 5} {incr i} {
  93.         if [set ::itf::game$i] {
  94.             oz'event {
  95.                 oz'widget::fadeto [set ::itf::game$i] 1
  96.                 oz'delay 0.125
  97.             }
  98.         }
  99.     }
  100.  
  101.     oz'event {
  102.         set ::itf::back [new itf'back]
  103.         oz'widget::property [set ::itf::back] -pos 0.703125 0.791666 -alpha 0
  104.         oz'widget::child [FOREGROUNDWIDGET] [set ::itf::back] 0.5
  105.         oz'widget::fadeto [set ::itf::back] 1
  106.         oz'delay 0.125
  107.     }
  108.     
  109.     oz'event {wizEnableMouse}
  110. }
  111.     
  112. proc CloseSaveGamePanel {} {
  113.     wq'widget::fadeto $::itf::game1 0
  114.     wq'widget::fadeto $::itf::game2 0
  115.     wq'widget::fadeto $::itf::game3 0
  116.     wq'widget::fadeto $::itf::game4 0
  117.     wq'widget::fadeto $::itf::game5 0
  118.     wq'widget::fadeto $::itf::history 0
  119.     wq'widget::fadeto $::itf::back  0
  120. }
  121.  
  122. proc DeleteSaveGamePanel {} {
  123.     wq'widget::delete& ::itf::game1
  124.     wq'widget::delete& ::itf::game2
  125.     wq'widget::delete& ::itf::game3
  126.     wq'widget::delete& ::itf::game4
  127.     wq'widget::delete& ::itf::game5
  128.     wq'widget::delete& ::itf::history
  129.     wq'widget::delete& ::itf::back
  130. }
  131.  
  132. class itf'history {
  133.     proc itf'history {this n} oz'widget {itf'game} {
  134.         set roomname "Unknown"
  135.         set icon [expr int(rand() * 10)]
  136.         
  137.         if [file exists "[ROOT]/save/savegame$n-info.tcl"] {
  138.             if [catch {source "[ROOT]/save/savegame$n-info.tcl"}] {
  139.                 set roomname "Unknown"
  140.                 set icon [expr int(rand() * 10)]
  141.             }
  142.         }
  143.         
  144.         set ($this,bg)    [new oz'sprite "interface/[MODE]/history/history.bg"]
  145.         if [file exists "[ROOT]/save/ss$n-[MODE].tga"] {
  146.             set ($this,ss)    [new oz'sprite "save/ss$n-[MODE]"]
  147.         } else {
  148.             set ($this,ss)    [new oz'sprite "save/newgamess-[MODE]"]
  149.         }
  150.  
  151.         set ($this,icon)  [new oz'sprite "interface/[MODE]/intro/intro.icon/intro.icon.$icon"]
  152.         set ($this,enter) [new oz'button "interface/[MODE]/intro/intro.enter"]
  153.         set ($this,erase) [new oz'button "interface/[MODE]/intro/intro.erase"]
  154.         set ($this,name)  [new oz'label "name" 0.227539 0.061197]
  155.         set ($this,time)  [new oz'label "time" 0.227539 0.061197]
  156.         
  157.         set ($this,time0)  [new oz'label "time0" 0.227539 0.061197]
  158.         set ($this,time1)  [new oz'label "time1" 0.227539 0.061197]
  159.         set ($this,time2)  [new oz'label "time2" 0.227539 0.061197]
  160.         set ($this,time3)  [new oz'label "time3" 0.227539 0.061197]
  161.         set ($this,time4)  [new oz'label "time4" 0.227539 0.061197]
  162.         set ($this,time5)  [new oz'label "time5" 0.227539 0.061197]
  163.         set ($this,time6)  [new oz'label "time6" 0.227539 0.061197]
  164.         set ($this,time7)  [new oz'label "time7" 0.227539 0.061197]
  165.  
  166.         set ($this,enter0) [new oz'button "interface/[MODE]/intro/intro.enter"]
  167.         set ($this,enter1) [new oz'button "interface/[MODE]/intro/intro.enter"]
  168.         set ($this,enter2) [new oz'button "interface/[MODE]/intro/intro.enter"]
  169.         set ($this,enter3) [new oz'button "interface/[MODE]/intro/intro.enter"]
  170.         set ($this,enter4) [new oz'button "interface/[MODE]/intro/intro.enter"]
  171.         set ($this,enter5) [new oz'button "interface/[MODE]/intro/intro.enter"]
  172.         set ($this,enter6) [new oz'button "interface/[MODE]/intro/intro.enter"]
  173.         set ($this,enter7) [new oz'button "interface/[MODE]/intro/intro.enter"]
  174.         
  175.         set time [file mtime "[ROOT]/save/savegame$n.tcl"]
  176.         set time [ctime $time]
  177.  
  178.         oz'label::property $($this,name) -pos 0.234375 0.026041 -font system.ttf -fsize 16 -color 1 1 1 
  179.         oz'label::property $($this,time) -pos 0.234375 0.087239 -font system.ttf -fsize 14 -color 1 1 1
  180.         set name ""
  181.         catch {set name $::lng::roomName($roomname)}
  182.         oz'label::property $($this,name) -text "$name"
  183.         oz'label::property $($this,time) -text "$time"
  184.  
  185.         set max 0
  186.         while 1 {
  187.             if ![file exists "[ROOT]/save/$n/$max.tcl"] {
  188.                 break
  189.             }
  190.             incr max
  191.         }
  192.         incr max -1
  193.  
  194.         oz'button::disable $($this,enter0)
  195.         oz'button::disable $($this,enter1)
  196.         oz'button::disable $($this,enter2)
  197.         oz'button::disable $($this,enter3)
  198.         oz'button::disable $($this,enter4)
  199.         oz'button::disable $($this,enter5)
  200.         oz'button::disable $($this,enter6)
  201.         oz'button::disable $($this,enter7)
  202.         
  203.         set p 0
  204.         set ($this,gamenb0) 0
  205.         set ($this,gamenb1) 0
  206.         set ($this,gamenb2) 0
  207.         set ($this,gamenb3) 0
  208.         set ($this,gamenb4) 0
  209.         set ($this,gamenb5) 0
  210.         set ($this,gamenb6) 0
  211.         set ($this,gamenb7) 0
  212.         
  213.         for {set i $max} {$i >= 0 && $i > [expr $max - 8]} {incr i -1} {
  214.             if ![file exists "[ROOT]/save/$n/$i.tcl"] {
  215.                 break
  216.             }
  217.  
  218.             set roomname "Unknown"
  219.             set icon [expr int(rand() * 10)]
  220.             if [file exists "[ROOT]/save/$n/$i-info.tcl"] {
  221.                 if [catch {source "[ROOT]/save/$n/$i-info.tcl"}] {
  222.                     set roomname "Unknown"
  223.                     set icon [expr int(rand() * 10)]
  224.                 }
  225.             }
  226.             
  227.             set time ""
  228.             catch {set time $::lng::roomName($roomname)}
  229.  
  230.             oz'label::property $($this,time$p) -pos 0.234375 [expr 0.083333*$p + 0.177] \
  231.                                                -font system.ttf -fsize 16 -color 1 1 1
  232.             oz'label::property $($this,time$p) -text $time
  233.             oz'button::enable $($this,enter$p)
  234.             set ($this,gamenb$p) $i
  235.             incr p
  236.         }
  237.  
  238.         oz'button::property $($this,enter) -click itf'game::enter2 $n $icon
  239.         oz'button::property $($this,erase) -click itf'game::erase $n
  240.  
  241.         oz'button::property $($this,enter0) -click itf'history::enter_old $($this,gamenb0) $n $icon
  242.         oz'button::property $($this,enter1) -click itf'history::enter_old $($this,gamenb1) $n $icon
  243.         oz'button::property $($this,enter2) -click itf'history::enter_old $($this,gamenb2) $n $icon
  244.         oz'button::property $($this,enter3) -click itf'history::enter_old $($this,gamenb3) $n $icon
  245.         oz'button::property $($this,enter4) -click itf'history::enter_old $($this,gamenb4) $n $icon
  246.         oz'button::property $($this,enter5) -click itf'history::enter_old $($this,gamenb5) $n $icon
  247.         oz'button::property $($this,enter6) -click itf'history::enter_old $($this,gamenb6) $n $icon
  248.         oz'button::property $($this,enter7) -click itf'history::enter_old $($this,gamenb7) $n $icon
  249.  
  250.         oz'widget::property $($this,icon)  -pos 0.5 0
  251.         oz'widget::property $($this,enter) -pos 0.188477 [expr 0.031250 + 0.001]
  252.         oz'widget::property $($this,erase) -pos 0.188477 0.096354
  253.  
  254.         oz'widget::property $($this,enter0) -pos 0.187500 [expr 0.184896 - 0.000]
  255.         oz'widget::property $($this,enter1) -pos 0.187500 [expr 0.268229 - 0.000]
  256.         oz'widget::property $($this,enter2) -pos 0.187500 [expr 0.351563 - 0.000]
  257.         oz'widget::property $($this,enter3) -pos 0.187500 [expr 0.434896 - 0.000]
  258.         oz'widget::property $($this,enter4) -pos 0.187500 [expr 0.518229 - 0.000]
  259.         oz'widget::property $($this,enter5) -pos 0.187500 [expr 0.601563 - 0.000]
  260.         oz'widget::property $($this,enter6) -pos 0.187500 [expr 0.684896 - 0.000]
  261.         oz'widget::property $($this,enter7) -pos 0.187500 [expr 0.766927 - 0.000]
  262.         
  263.         oz'widget::child $this $($this,bg)    0.5
  264.         oz'widget::child $this $($this,ss)    1
  265.         oz'widget::child $this $($this,icon)  1
  266.         oz'widget::child $this $($this,enter) 0
  267.         oz'widget::child $this $($this,erase) 0
  268.         oz'widget::child $this $($this,name)  0
  269.         oz'widget::child $this $($this,time)  0
  270.         
  271.         oz'widget::child $this $($this,time0)  0
  272.         oz'widget::child $this $($this,time1)  0
  273.         oz'widget::child $this $($this,time2)  0
  274.         oz'widget::child $this $($this,time3)  0
  275.         oz'widget::child $this $($this,time4)  0
  276.         oz'widget::child $this $($this,time5)  0
  277.         oz'widget::child $this $($this,time6)  0
  278.         oz'widget::child $this $($this,time7)  0
  279.  
  280.         oz'widget::child $this $($this,enter0)  0
  281.         oz'widget::child $this $($this,enter1)  0
  282.         oz'widget::child $this $($this,enter2)  0
  283.         oz'widget::child $this $($this,enter3)  0
  284.         oz'widget::child $this $($this,enter4)  0
  285.         oz'widget::child $this $($this,enter5)  0
  286.         oz'widget::child $this $($this,enter6)  0
  287.         oz'widget::child $this $($this,enter7)  0
  288.     }
  289.  
  290.     proc ~itf'history {this} {
  291.         delete $($this,bg)
  292.         delete $($this,ss)
  293.         delete $($this,icon)
  294.         delete $($this,enter)
  295.         delete $($this,erase)
  296.         delete $($this,name)
  297.         delete $($this,time)
  298.  
  299.         delete $($this,time0)
  300.         delete $($this,time1)
  301.         delete $($this,time2)
  302.         delete $($this,time3)
  303.         delete $($this,time4)
  304.         delete $($this,time5)
  305.         delete $($this,time6)
  306.         delete $($this,time7)
  307.  
  308.         delete $($this,enter0)
  309.         delete $($this,enter1)
  310.         delete $($this,enter2)
  311.         delete $($this,enter3)
  312.         delete $($this,enter4)
  313.         delete $($this,enter5)
  314.         delete $($this,enter6)
  315.         delete $($this,enter7)
  316.     }
  317.  
  318.     proc enter_old {slot n c} {
  319.         iactive interface.sidebar true
  320.         ozIMenu enable menu
  321.         iactive interface.help true
  322.         ozIMenu enable help
  323.  
  324.         setGameNumber $n $c
  325.         CloseSaveGamePanel
  326.  
  327.         oz'event {oz'delay 0.25}
  328.         oz'event {wizDisableMouse}
  329.         oz'event {standardFadeout}
  330.        
  331.         oz'event {oz'track::stop $::music_track}
  332.         oz'event {wizqEntityStopFollow Zak}
  333.         oz'event {
  334.             if [info exists ::debug_] {
  335.                 source "[ROOT]/save/$n/$slot.tcl"
  336.             } else {
  337.                 if [catch {source "[ROOT]/save/$n/$slot.tcl"}] {
  338.                     ozMessage "$::lng::i_corrupted"
  339.                     closeGameNoSave
  340.                 }
  341.             }
  342.         }
  343.         oz'event {
  344.             if !\$::isGameReady {
  345.                 oz'event {initializeGame}
  346.                 oz'event {showInterface}
  347.                 DeleteSaveGamePanel
  348.                 oz'event {oz'delay 0.01}
  349.                 oz'event {standardFadein}
  350.                 oz'event {wizEnableMouse}
  351.                 oz'event {set ::isGameReady 1}
  352.             }
  353.         }
  354.         
  355.         oz'flush
  356.     }
  357. }
  358.     
  359. class itf'message {
  360.     proc itf'message {this msg} oz'widget {itf'message} {
  361.         set ($this,bg)    [new oz'sprite "interface/[MODE]/intro/intro.message.bg"]
  362.         set ($this,ok)    [new oz'button "interface/[MODE]/intro/intro.ok"]
  363.         set ($this,label) [new oz'label  "message" 0.768554 0.058593]
  364.  
  365.         oz'widget::property $($this,ok) -pos 0.419922 0.089844
  366.         oz'button::property $($this,ok) -click itf'message::ok
  367.  
  368.         oz'label::property $($this,label) -pos 0.053710 0.016927 -font caligula.ttf -fsize 24 -color 1 1 1 
  369.         oz'label::property $($this,label) -text "$msg"
  370.  
  371.         oz'widget::child $this $($this,bg)    0.5
  372.         oz'widget::child $this $($this,ok)    0
  373.         oz'widget::child $this $($this,label) 0
  374.     }
  375.  
  376.     proc ~itf'message {this} {
  377.         delete $($this,bg)
  378.         delete $($this,ok)
  379.         delete $($this,label)
  380.     }
  381.     
  382.     proc ok {} {
  383.         wq'widget::fadeto $::itf::message 0 -wait
  384.         oz'event {ShowIntroPanel}
  385.         wq'widget::delete& ::itf::message
  386.         oz'flush
  387.     }
  388. }
  389.  
  390. class itf'message2 {
  391.     proc itf'message2 {this msg n} oz'widget {itf'message2} {
  392.         set ($this,bg)    [new oz'sprite "interface/[MODE]/intro/intro.message.bg"]
  393.         set ($this,ok)    [new oz'button "interface/[MODE]/intro/intro.ok"]
  394.         set ($this,label) [new oz'label  "message" 0.768554 [expr 0.058593]]
  395.  
  396.         oz'widget::property $($this,ok) -pos 0.419922 0.089844
  397.         oz'button::property $($this,ok) -click itf'message2::ok $n
  398.  
  399.         oz'label::property $($this,label) -pos 0.053710 0.020 -font system.ttf -fsize 16 -color 1 1 1 
  400.         oz'label::property $($this,label) -text "$msg"
  401.  
  402.         oz'widget::child $this $($this,bg)    0.5
  403.         oz'widget::child $this $($this,ok)    0
  404.         oz'widget::child $this $($this,label) 0
  405.     }
  406.  
  407.     proc ~itf'message2 {this} {
  408.         delete $($this,bg)
  409.         delete $($this,ok)
  410.         delete $($this,label)
  411.     }
  412.     
  413.     proc ok {n} {
  414.         wq'widget::fadeto $::itf::message 0 -wait
  415.  
  416.         set ::itf::history [new itf'history $n]
  417.         oz'widget::property $::itf::history -pos 0.062500 0.041667 -alpha 0
  418.         oz'widget::child [FOREGROUNDWIDGET] $::itf::history 0.5
  419.         wq'widget::fadeto $::itf::history 1
  420.  
  421.         oz'event {oz'delay 0.125}
  422.         oz'event {
  423.             set ::itf::back [new itf'back]
  424.             oz'widget::property [set ::itf::back] -pos 0.703125 0.791666 -alpha 0
  425.             oz'widget::child [FOREGROUNDWIDGET] [set ::itf::back] 0.5
  426.             oz'widget::fadeto [set ::itf::back] 1
  427.             oz'delay 0.125
  428.         }
  429.         
  430.         wq'widget::delete& ::itf::message
  431.         oz'flush
  432.     }
  433. }
  434.  
  435. class itf'delete {
  436.     proc itf'delete {this n} oz'widget {itf'delete} {
  437.         set ($this,bg)    [new oz'sprite "interface/[MODE]/intro/intro.delete.bg"]
  438.         set ($this,yes)   [new oz'button "interface/[MODE]/intro/intro.yes"]
  439.         set ($this,no)    [new oz'button "interface/[MODE]/intro/intro.no"]
  440.         set ($this,label) [new oz'label  "question" 0.768554 0.058593]
  441.  
  442.         oz'widget::property $($this,yes) -pos 0.279297 0.089849
  443.         oz'button::property $($this,yes) -click itf'delete::yes $n
  444.  
  445.         oz'widget::property $($this,no)  -pos 0.560547 0.089849
  446.         oz'button::property $($this,no)  -click itf'delete::no
  447.  
  448.         oz'label::property $($this,label) -pos 0.053710 0.016927 -font caligula.ttf -fsize 24 -color 1 1 1 \
  449.                                           -text $::lng::i_confirm
  450.  
  451.         oz'widget::child $this $($this,bg)    0.5
  452.         oz'widget::child $this $($this,yes)   0
  453.         oz'widget::child $this $($this,no)    0
  454.         oz'widget::child $this $($this,label) 0
  455.     }
  456.  
  457.     proc ~itf'delete {this} {
  458.         delete $($this,bg)
  459.         delete $($this,yes)
  460.         delete $($this,no)
  461.         delete $($this,label)
  462.     }
  463.     
  464.     proc yes {n} {
  465.         wq'widget::fadeto $::itf::delete 0 -wait
  466.  
  467.         oz'event {
  468.             set m 0
  469.             for {set i $n} {\$i <= 7} {incr i} {
  470.                 if ![file exists "[ROOT]/save/savegame\$i.tcl"] {
  471.                     set m [expr \$i-1]
  472.                     break
  473.                 }
  474.             }
  475.  
  476.             for {set i $n} {\$i < \$m} {incr i} {
  477.                 catch {file copy -force "[ROOT]/save/savegame[expr \$i+1].tcl" "[ROOT]/save/savegame\$i.tcl"}
  478.                 catch {file copy -force "[ROOT]/save/savegame[expr \$i+1]-info.tcl" "[ROOT]/save/savegame\$i-info.tcl"}
  479.                 catch {file copy -force "[ROOT]/save/ss[expr \$i+1]-[MODE].tga" "[ROOT]/save/ss\$i-[MODE].tga"}
  480.                 catch {file mkdir "[ROOT]/save/\$i"}
  481.                 catch {file copy -force "[ROOT]/save/[expr \$i+1]/0.tcl" "[ROOT]/save/\$i/0.tcl"}
  482.                 catch {file copy -force "[ROOT]/save/[expr \$i+1]/1.tcl" "[ROOT]/save/\$i/1.tcl"}
  483.                 catch {file copy -force "[ROOT]/save/[expr \$i+1]/2.tcl" "[ROOT]/save/\$i/2.tcl"}
  484.                 catch {file copy -force "[ROOT]/save/[expr \$i+1]/3.tcl" "[ROOT]/save/\$i/3.tcl"}
  485.                 catch {file copy -force "[ROOT]/save/[expr \$i+1]/4.tcl" "[ROOT]/save/\$i/4.tcl"}
  486.                 catch {file copy -force "[ROOT]/save/[expr \$i+1]/5.tcl" "[ROOT]/save/\$i/5.tcl"}
  487.                 catch {file copy -force "[ROOT]/save/[expr \$i+1]/6.tcl" "[ROOT]/save/\$i/6.tcl"}
  488.                 catch {file copy -force "[ROOT]/save/[expr \$i+1]/7.tcl" "[ROOT]/save/\$i/7.tcl"}
  489.             }
  490.         
  491.             catch {file delete -force "[ROOT]/save/savegame\$m.tcl"}
  492.             catch {file delete -force "[ROOT]/save/savegame\$m-info.tcl"}
  493.             catch {file delete -force "[ROOT]/save/ss\$m-[MODE].tga"}
  494.             catch {file delete -force "[ROOT]/save/\$m"}
  495.  
  496.             if {\$m == 1} {
  497.                 oz'event {ShowIntroPanel}
  498.             } else {
  499.                 oz'event {ShowSaveGamePanel}
  500.             }
  501.         }
  502.  
  503.         wq'widget::delete& ::itf::delete
  504.         
  505.         oz'flush
  506.     }
  507.  
  508.     proc no {} {
  509.         wq'widget::fadeto $::itf::delete 0 -wait
  510.         oz'event {ShowSaveGamePanel}
  511.         wq'widget::delete& ::itf::delete
  512.         
  513.         oz'flush
  514.     }
  515. }
  516.  
  517. class itf'back {
  518.     proc itf'back {this} oz'widget {itf'back} {
  519.         set ($this,bg)         [new oz'sprite "interface/[MODE]/intro/intro.back.bg"]
  520.         set ($this,back)       [new oz'button "interface/[MODE]/intro/intro.back"]
  521.         set ($this,back.label) [new oz'label  "back" 0.131835 0.061197]
  522.  
  523.         oz'widget::property $($this,back) -pos 0.025391 0.059896
  524.         oz'button::property $($this,back) -click itf'back::click
  525.  
  526.         oz'label::property $($this,back.label) -pos 0.080242 0.050781 -font caligula.ttf -fsize 24 -color 1 1 1 \
  527.                                                -center 0 -text $::lng::i_back
  528.  
  529.         oz'widget::child $this $($this,bg)         0.5
  530.         oz'widget::child $this $($this,back)       0
  531.         oz'widget::child $this $($this,back.label) 0
  532.     }
  533.  
  534.     proc ~itf'back {this} {
  535.         delete $($this,bg)
  536.         delete $($this,back)
  537.         delete $($this,back.label)
  538.     }
  539.     
  540.     proc click {} {
  541.         CloseSaveGamePanel
  542.    
  543.         oz'event {oz'delay 0.5}
  544.         ShowIntroPanel
  545.  
  546.         DeleteSaveGamePanel
  547.         
  548.         oz'flush
  549.     }
  550. }
  551.  
  552. class itf'intro {
  553.     proc itf'intro {this} oz'widget {itf'intro} {
  554.         set ($this,bg) [new oz'sprite "interface/[MODE]/intro/intro.bg"]
  555.  
  556.         set ($this,newgame)  [new oz'button "interface/[MODE]/intro/intro.newgame"]
  557.         set ($this,continue) [new oz'button "interface/[MODE]/intro/intro.continue"]
  558.         set ($this,option)   [new oz'button "interface/[MODE]/intro/intro.option"]
  559.         set ($this,quit)     [new oz'button "interface/[MODE]/intro/intro.quit"]
  560.  
  561.         set ($this,newgame.label)  [new oz'label "newgame"  0.227539 0.059895]
  562.         set ($this,continue.label) [new oz'label "continue" 0.227539 0.059895]
  563.         set ($this,option.label)   [new oz'label "option"   0.227539 0.059895]
  564.         set ($this,quit.label)     [new oz'label "quit"     0.227539 0.059895]
  565.  
  566.         oz'widget::property $($this,newgame)  -pos 0.028320 0.032552
  567.         oz'widget::property $($this,continue) -pos 0.028320 0.096354
  568.         oz'widget::property $($this,option)   -pos 0.028320 0.160156
  569.         oz'widget::property $($this,quit)     -pos 0.028320 0.223958
  570.         
  571.         oz'button::property $($this,newgame)  -click itf'intro::newgame
  572.         oz'button::property $($this,continue) -click itf'intro::continue
  573.         oz'button::property $($this,option)   -click itf'intro::option
  574.         oz'button::property $($this,quit)     -click itf'intro::quit
  575.  
  576.         oz'label::property $($this,newgame.label)  -pos 0.079218 0.024739 -font caligula.ttf -fsize 24 -color 1 1 1 \
  577.                                                    -center 0 -text $::lng::i_newGame
  578.         oz'label::property $($this,continue.label) -pos 0.079218 0.087239 -font caligula.ttf -fsize 24 -color 1 1 1 \
  579.                                                    -center 0 -text $::lng::i_continue
  580.         oz'label::property $($this,option.label)   -pos 0.079218 0.151041 -font caligula.ttf -fsize 24 -color 1 1 1 \
  581.                                                    -center 0 -text $::lng::i_option
  582.         oz'label::property $($this,quit.label)     -pos 0.079218 0.214843 -font caligula.ttf -fsize 24 -color 1 1 1 \
  583.                                                    -center 0 -text $::lng::i_quit
  584.         
  585.         oz'widget::child $this $($this,bg)             0.5
  586.         oz'widget::child $this $($this,newgame)        0
  587.         oz'widget::child $this $($this,continue)       0
  588.         oz'widget::child $this $($this,option)         0
  589.         oz'widget::child $this $($this,quit)           0
  590.         oz'widget::child $this $($this,newgame.label)  0
  591.         oz'widget::child $this $($this,continue.label) 0
  592.         oz'widget::child $this $($this,option.label)   0
  593.         oz'widget::child $this $($this,quit.label)     0
  594.     }
  595.  
  596.     proc ~itf'intro {this} {
  597.         delete $($this,bg)
  598.         delete $($this,newgame)
  599.         delete $($this,continue)
  600.         delete $($this,quit)
  601.         delete $($this,newgame.label)
  602.         delete $($this,continue.label)
  603.         delete $($this,quit.label)
  604.     }
  605.  
  606.     proc newgame {} {
  607.         for {set i 1} {$i <= 5} {incr i} {
  608.             if ![file exists "[ROOT]/save/savegame$i.tcl"] break
  609.         }
  610.     
  611.         if {$i == 6} {
  612.             wq'widget::fadeto $::itf::logo  0
  613.             wq'widget::fadeto $::itf::vbox  0
  614.             if $::itf::opt {
  615.                 wq'widget::fadeto $::itf::opt  0
  616.             }
  617.             wq'widget::fadeto $::itf::intro 0 -wait
  618.  
  619.             set ::itf::message [new itf'message $::lng::i_tooMuchGame]
  620.             oz'widget::property $::itf::message -pos 0.0625 0.416666 -alpha 0
  621.             oz'widget::child [FOREGROUNDWIDGET] $::itf::message 0.5
  622.             wq'widget::fadeto $::itf::message 1
  623.  
  624.             wq'widget::delete& ::itf::vers
  625.             wq'widget::delete& ::itf::vbox
  626.             wq'widget::delete& ::itf::logo
  627.             wq'widget::delete& ::itf::opt
  628.             wq'widget::delete& ::itf::intro
  629.  
  630.             oz'flush
  631.             return
  632.         }
  633.  
  634.         set i 1
  635.         
  636.         file copy -force "[ROOT]/save/newgame.tcl" "[ROOT]/save/savegame$i.tcl"
  637.         file copy -force "[ROOT]/save/newgame-info.tcl" "[ROOT]/save/savegame$i-info.tcl"
  638.         file copy -force "[ROOT]/save/newgamess-[MODE].tga" "[ROOT]/save/ss$i-[MODE].tga"
  639.  
  640.         iactive interface.sidebar true
  641.         ozIMenu enable menu
  642.         iactive interface.help true
  643.         ozIMenu enable help
  644.  
  645.         setGameNumber $i [expr int(rand() * 10)]
  646.  
  647.         wq'widget::fadeto $::itf::logo  0
  648.         wq'widget::fadeto $::itf::vbox  0
  649.         if $::itf::opt {
  650.             wq'widget::fadeto $::itf::opt  0
  651.         }
  652.         wq'widget::fadeto $::itf::intro 0
  653.  
  654.         oz'event {oz'delay 0.25}
  655.         oz'event {wizDisableMouse}
  656.         oz'event {standardFadeout}
  657.         
  658.         oz'event {oz'track::stop $::music_track}
  659.  
  660.         oz'event {cameraFadein 0}
  661.         oz'event {hideMouse}
  662.  
  663.         set l [new oz'label "label" 0.8 0.25]
  664.         set w [new oz'widget "widget"]
  665.         oz'label::property $l -pos 0.1 0.75 -font caligula.ttf -fsize 20 -alpha 1
  666.         oz'widget::property $w -alpha 0
  667.         oz'widget::child $w $l 0
  668.         oz'widget::child [FOREGROUNDWIDGET] $w 0
  669.  
  670.         introduction::new introduction -foreground -depth 0.5 -nopan
  671.         ozqSound::NewFX  "sound/vo/$::LNG/intro/introduction.ogg"
  672.  
  673.         wizqQueue 1 [subst {
  674.           oz'event {oz'delay 12}
  675.           subtitle $w $l Nathaniel "$::lng::introN1"  4
  676.           oz'event {oz'delay 2}
  677.           subtitle $w $l Nathaniel "$::lng::introN2"  4.5
  678.           oz'event {oz'delay 2}
  679.           subtitle $w $l Nathaniel "$::lng::introN3"  4
  680.           oz'event {oz'delay 1.5}
  681.           subtitle $w $l Nathaniel "$::lng::introN4"  6.5
  682.           oz'event {oz'delay 3.5}
  683.           subtitle $w $l Nathaniel "$::lng::introN5"  2
  684.           oz'event {oz'delay 4}
  685.           subtitle $w $l Nathaniel "$::lng::introN6"  6.5
  686.           oz'event {oz'delay 4.5}
  687.           subtitle $w $l Nathaniel "$::lng::introN7"  4
  688.           oz'event {oz'delay 6.5}
  689.           subtitle $w $l Nathaniel "$::lng::introN8"  7
  690.           oz'event {oz'delay 1}
  691.           subtitle $w $l Nathaniel "$::lng::introN9"  9
  692.           oz'event {oz'delay 3.5}
  693.           subtitle $w $l Nathaniel "$::lng::introN10"  5
  694.           oz'event {delete $l}
  695.           oz'event {delete $w}
  696.         }]
  697.  
  698.         chainEvent {
  699.           standardFadein
  700.         }
  701.  
  702.         wq'widget::waitfor $introduction::introduction -animate
  703.         wq'widget::delete& introduction::introduction
  704.  
  705.         oz'event {showMouse}
  706.         oz'event {cameraFadeout 0}
  707.  
  708.         # Wait for Block 1
  709.         wizqWaitQueue 1
  710.   
  711.         oz'event {wizqEntityStopFollow Zak}
  712.         oz'event {
  713.             if [info exists ::debug_] {
  714.                 source "[ROOT]/save/savegame$i.tcl"
  715.             } else {
  716.                 if [catch {source "[ROOT]/save/savegame$i.tcl"}] {
  717.                     ozMessage "$::lng::i_corrupted"
  718.                     closeGameNoSave
  719.                 }
  720.             }
  721.         }
  722.         oz'event {
  723.             if !\$::isGameReady {
  724.                 oz'event {initializeGame}
  725.                 oz'event {showInterface}
  726.                 oz'event {standardFadein}
  727.                 oz'event {wizEnableMouse}
  728.                 oz'event {set ::isGameReady 1}
  729.             }
  730.         }
  731.  
  732.         wq'widget::delete& ::itf::vers
  733.         wq'widget::delete& ::itf::vbox
  734.         wq'widget::delete& ::itf::logo
  735.         wq'widget::delete& ::itf::opt
  736.         wq'widget::delete& ::itf::intro
  737.         
  738.         oz'flush
  739.     }
  740.  
  741.     proc continue {} {
  742.         for {set i 1} {$i <= 5} {incr i} {
  743.             if ![file exists "[ROOT]/save/savegame$i.tcl"] break
  744.         }
  745.         
  746.         if {$i == 1} {
  747.             wq'widget::fadeto $::itf::logo  0
  748.             wq'widget::fadeto $::itf::vbox  0
  749.             if $::itf::opt {
  750.                 wq'widget::fadeto $::itf::opt  0
  751.             }
  752.             wq'widget::fadeto $::itf::intro 0 -wait
  753.  
  754.             set ::itf::message [new itf'message $::lng::i_create]
  755.             oz'widget::property $::itf::message -pos 0.0625 0.416666 -alpha 0
  756.             oz'widget::child [FOREGROUNDWIDGET] $::itf::message 0.5
  757.             wq'widget::fadeto $::itf::message 1
  758.  
  759.             wq'widget::delete& ::itf::logo
  760.             wq'widget::delete& ::itf::vers
  761.             wq'widget::delete& ::itf::vbox
  762.             wq'widget::delete& ::itf::opt
  763.             wq'widget::delete& ::itf::intro
  764.  
  765.             oz'flush
  766.             return
  767.         }
  768.         
  769.         wq'widget::fadeto $::itf::logo  0
  770.         wq'widget::fadeto $::itf::vbox  0
  771.         if $::itf::opt {
  772.             wq'widget::fadeto $::itf::opt  0
  773.         }        
  774.         wq'widget::fadeto $::itf::intro 0 -wait
  775.         wq'widget::delete& ::itf::logo
  776.         wq'widget::delete& ::itf::vbox
  777.         wq'widget::delete& ::itf::vers
  778.         wq'widget::delete& ::itf::opt
  779.         wq'widget::delete& ::itf::intro
  780.  
  781.         oz'event {ShowSaveGamePanel}
  782.  
  783.         oz'flush
  784.     }
  785.  
  786.     proc option {} {
  787.         if {$::itf::opt == 0} {
  788.             set ::itf::opt [new itfopt]
  789.             oz'widget::property $::itf::opt -pos 0.328125 0.276042 -alpha 0
  790.             oz'widget::child [FOREGROUNDWIDGET] $::itf::opt 0.5
  791.             wq'widget::fadeto $::itf::opt 1
  792.         
  793.             oz'flush
  794.         }
  795.     }
  796.     
  797.     proc quit {} {
  798.         set config "set soundfx_volume $::config::user::soundfx_volume\nset voice_volume $::config::user::voice_volume\nset music_volume $::config::user::music_volume\nset gamma_correction $::config::user::gamma_correction"
  799.  
  800.         set fid [open "../res/user.tcl" "w"]
  801.         puts $fid $config
  802.         close $fid
  803.   
  804.         chainEvent {standardFadeout}
  805.         chainEvent {closeGameNoSave}
  806.         oz'flush
  807.     }
  808. }
  809.   
  810. class itf'slider {
  811.     proc itf'slider {this} oz'widget {itf'slider} {
  812.         set ($this,more) [new oz'button "interface/[MODE]/slider/slider.more"]
  813.         set ($this,less) [new oz'button "interface/[MODE]/slider/slider.less"]
  814.  
  815.         set ($this,bar0) [new oz'sprite "interface/[MODE]/slider/slider.bar0"]
  816.         set ($this,bar1) [new oz'sprite "interface/[MODE]/slider/slider.bar1"]
  817.         set ($this,bar2) [new oz'sprite "interface/[MODE]/slider/slider.bar2"]
  818.         set ($this,bar3) [new oz'sprite "interface/[MODE]/slider/slider.bar3"]
  819.         set ($this,bar4) [new oz'sprite "interface/[MODE]/slider/slider.bar4"]
  820.         set ($this,bar5) [new oz'sprite "interface/[MODE]/slider/slider.bar5"]
  821.         set ($this,bar6) [new oz'sprite "interface/[MODE]/slider/slider.bar6"]
  822.         set ($this,bar7) [new oz'sprite "interface/[MODE]/slider/slider.bar7"]
  823.         set ($this,bar8) [new oz'sprite "interface/[MODE]/slider/slider.bar8"]
  824.         set ($this,bar9) [new oz'sprite "interface/[MODE]/slider/slider.bar9"]
  825.  
  826.         oz'widget::property $($this,less) -pos 0.005859 0.010417
  827.         oz'widget::property $($this,more) -pos 0.213867 0.010417
  828.  
  829.         oz'button::property $($this,less) -click itf'slider::less $this
  830.         oz'button::property $($this,more) -click itf'slider::more $this
  831.  
  832.         oz'widget::property $($this,bar0) -pos 0.050781 0.010417 -alpha 0
  833.         oz'widget::property $($this,bar1) -pos 0.066406 0.010417 -alpha 0
  834.         oz'widget::property $($this,bar2) -pos 0.082031 0.010417 -alpha 0
  835.         oz'widget::property $($this,bar3) -pos 0.097656 0.010417 -alpha 0
  836.         oz'widget::property $($this,bar4) -pos 0.113281 0.010417 -alpha 0
  837.         oz'widget::property $($this,bar5) -pos 0.128906 0.010417 -alpha 0
  838.         oz'widget::property $($this,bar6) -pos 0.144531 0.010417 -alpha 0
  839.         oz'widget::property $($this,bar7) -pos 0.160156 0.010417 -alpha 0
  840.         oz'widget::property $($this,bar8) -pos 0.175781 0.010417 -alpha 0
  841.         oz'widget::property $($this,bar9) -pos 0.191406 0.010417 -alpha 0
  842.  
  843.         set ($this,pos) 0
  844.  
  845.         oz'widget::child $this $($this,less) 0
  846.         oz'widget::child $this $($this,more) 0
  847.  
  848.         oz'widget::child $this $($this,bar0) 0
  849.         oz'widget::child $this $($this,bar1) 0
  850.         oz'widget::child $this $($this,bar2) 0
  851.         oz'widget::child $this $($this,bar3) 0
  852.         oz'widget::child $this $($this,bar4) 0
  853.         oz'widget::child $this $($this,bar5) 0
  854.         oz'widget::child $this $($this,bar6) 0
  855.         oz'widget::child $this $($this,bar7) 0
  856.         oz'widget::child $this $($this,bar8) 0
  857.         oz'widget::child $this $($this,bar9) 0
  858.     }
  859.  
  860.     proc ~itf'slider {this} {
  861.         delete $($this,more)
  862.         delete $($this,less)
  863.  
  864.         delete $($this,bar0)
  865.         delete $($this,bar1)
  866.         delete $($this,bar2)
  867.         delete $($this,bar3)
  868.         delete $($this,bar4)
  869.         delete $($this,bar5)
  870.         delete $($this,bar6)
  871.         delete $($this,bar7)
  872.         delete $($this,bar8)
  873.         delete $($this,bar9)
  874.     }
  875.  
  876.     proc get_pos {this} {
  877.         return $($this,pos)
  878.     }
  879.  
  880.     proc set_pos {this p} {
  881.         set ($this,pos) $p
  882.  
  883.         for {set i 0} {$i < $p} {incr i} {
  884.             oz'widget::alpha $($this,bar$i) 1
  885.         }
  886.         for {set i $p} {$i < 10} {incr i} {
  887.             oz'widget::alpha $($this,bar$i) 0
  888.         }
  889.     }
  890.  
  891.     proc less {this} {
  892.         oz'flush
  893.         if {$($this,pos) <= 0} return
  894.  
  895.         incr ($this,pos) -1
  896.  
  897.         oz'widget::fadeto $($this,bar$($this,pos)) 0
  898.  
  899.         update_var
  900.  
  901.         oz'flush
  902.     }
  903.  
  904.     proc more {this} {
  905.         oz'flush
  906.         if {$($this,pos) >= 10} return
  907.  
  908.         oz'widget::fadeto $($this,bar$($this,pos)) 1
  909.  
  910.         incr ($this,pos) 1
  911.  
  912.         update_var
  913.  
  914.         oz'flush
  915.     }
  916. }
  917.  
  918.  
  919. class itfopt {
  920.     proc itfopt {this} oz'widget {itfopt} {
  921.         set ($this,bg) [new oz'sprite "interface/[MODE]/opt/opt.bg"]
  922.  
  923.         set ($this,voice) [new itf'slider]
  924.         set ($this,music) [new itf'slider]
  925.         set ($this,sfx)   [new itf'slider]
  926.         set ($this,gamma) [new itf'slider]
  927.  
  928.         oz'widget::property $($this,voice) -pos 0.072266 [expr 0.036459 - 0.004]
  929.         oz'widget::property $($this,sfx)   -pos 0.072266 [expr 0.109375 - 0.004]
  930.         oz'widget::property $($this,music) -pos [expr 0.072266 - 0.001] [expr 0.182292 - 0.004]
  931.         oz'widget::property $($this,gamma) -pos [expr 0.072266 - 0.001] [expr 0.296875 - 0.004]
  932.         
  933.         oz'widget::child $this $($this,bg)             0.5
  934.         
  935.         oz'widget::child $this $($this,voice)          0
  936.         oz'widget::child $this $($this,sfx)            0
  937.         oz'widget::child $this $($this,music)          0
  938.         oz'widget::child $this $($this,gamma)          0
  939.  
  940.         itf'slider::set_pos $($this,voice) [expr int($::config::user::voice_volume     * 10)]
  941.         itf'slider::set_pos $($this,sfx)   [expr int($::config::user::soundfx_volume   * 10)]
  942.         itf'slider::set_pos $($this,music) [expr int($::config::user::music_volume     * 25)]
  943.         itf'slider::set_pos $($this,gamma) [expr int($::config::user::gamma_correction * 10)]
  944.     }
  945.  
  946.     proc ~itfopt {this} {
  947.         delete $($this,bg)
  948.  
  949.         delete $($this,voice)
  950.         delete $($this,music)
  951.         delete $($this,sfx)
  952.         delete $($this,gamma)
  953.     }
  954. }
  955.  
  956. class itf'game {
  957.     proc itf'game {this n} oz'widget {itf'game} {
  958.         set roomname "Unknown"
  959.         set icon [expr int(rand() * 10)]
  960.         
  961.         if [file exists "[ROOT]/save/savegame$n-info.tcl"] {
  962.             if [catch {source "[ROOT]/save/savegame$n-info.tcl"}] {
  963.                 set roomname "Unknown"
  964.                 set icon [expr int(rand() * 10)]
  965.             }
  966.         }
  967.         
  968.         set ($this,bg)    [new oz'sprite "interface/[MODE]/intro/intro.continue.bg"]
  969.         if [file exists "[ROOT]/save/ss$n-[MODE].tga"] {
  970.             set ($this,ss)    [new oz'sprite "save/ss$n-[MODE]"]
  971.         } else {
  972.             set ($this,ss)    [new oz'sprite "save/newgamess-[MODE]"]
  973.         }
  974.  
  975.         set ($this,icon)  [new oz'sprite "interface/[MODE]/intro/intro.icon/intro.icon.$icon"]
  976.         set ($this,enter) [new oz'button "interface/[MODE]/intro/intro.enter"]
  977.         set ($this,history) [new oz'button "interface/[MODE]/intro/intro.history"]
  978.         set ($this,erase) [new oz'button "interface/[MODE]/intro/intro.erase"]
  979.         set ($this,name)  [new oz'label "name" 0.227539 0.061197]
  980.         set ($this,time)  [new oz'label "time" 0.227539 0.061197]
  981.         
  982.         set time [file mtime "[ROOT]/save/savegame$n.tcl"]
  983.         set time [clock format $time -format "%x %H:%M"]
  984.  
  985.         oz'label::property $($this,name) -pos 0.234375 0.026041 -font system.ttf -fsize 16 -color 1 1 1
  986.         oz'label::property $($this,time) -pos 0.234375 0.087239 -font system.ttf -fsize 14 -color 1 1 1
  987.         set name ""
  988.         catch {set name $::lng::roomName($roomname)}
  989.         oz'label::property $($this,name) -text "$name"
  990.         oz'label::property $($this,time) -text "$time"
  991.  
  992.         oz'button::property $($this,enter) -click itf'game::enter2 $n $icon
  993.         oz'button::property $($this,history) -click itf'game::enter $n $icon
  994.         oz'button::property $($this,erase) -click itf'game::erase $n
  995.  
  996.         oz'widget::property $($this,icon)  -pos 0.5 0
  997.         oz'widget::property $($this,enter) -pos 0.188477 [expr 0.031250 + 0.001]
  998.         oz'widget::property $($this,history) -pos 0.465820 0.110677
  999.         oz'widget::property $($this,erase) -pos 0.188477 0.096354
  1000.  
  1001.         oz'widget::child $this $($this,bg)    0.5
  1002.         oz'widget::child $this $($this,ss)    1
  1003.         oz'widget::child $this $($this,icon)  1
  1004.         oz'widget::child $this $($this,enter) 0
  1005.         oz'widget::child $this $($this,history) 0
  1006.         oz'widget::child $this $($this,erase) 0
  1007.         oz'widget::child $this $($this,name)  0
  1008.         oz'widget::child $this $($this,time)  0
  1009.     }
  1010.  
  1011.     proc ~itf'game {this} {
  1012.         delete $($this,bg)
  1013.         delete $($this,ss)
  1014.         delete $($this,icon)
  1015.         delete $($this,enter)
  1016.         delete $($this,history)
  1017.         delete $($this,erase)
  1018.         delete $($this,name)
  1019.         delete $($this,time)
  1020.     }
  1021.  
  1022.     proc enter {n c} {
  1023.         CloseSaveGamePanel
  1024.         oz'event {oz'delay 0.5}
  1025.  
  1026.         set ::itf::message [new itf'message2 $::lng::h_warning $n]
  1027.         oz'widget::property $::itf::message -pos 0.0625 0.416666 -alpha 0
  1028.         oz'widget::child [FOREGROUNDWIDGET] $::itf::message 0.5
  1029.         wq'widget::fadeto $::itf::message 1
  1030.         
  1031.         oz'flush
  1032.     }
  1033.  
  1034.     proc enter2 {n c} {
  1035.         iactive interface.sidebar true
  1036.         ozIMenu enable menu
  1037.         iactive interface.help true
  1038.         ozIMenu enable help
  1039.  
  1040.         setGameNumber $n $c
  1041.         CloseSaveGamePanel
  1042.  
  1043.         oz'event {oz'delay 0.25}
  1044.         oz'event {wizDisableMouse}
  1045.         oz'event {standardFadeout}
  1046.        
  1047.         oz'event {oz'track::stop $::music_track}
  1048.         oz'event {wizqEntityStopFollow Zak}
  1049.         oz'event {
  1050.             if [info exists ::debug_] {
  1051.                 source "[ROOT]/save/savegame$n.tcl"
  1052.             } else {
  1053.                 if [catch {source "[ROOT]/save/savegame$n.tcl"}] {
  1054.                     ozMessage "$::lng::i_corrupted"
  1055.                     closeGameNoSave
  1056.                 }
  1057.             }
  1058.         }
  1059.         oz'event {
  1060.             if !\$::isGameReady {
  1061.                 oz'event {initializeGame}
  1062.                 oz'event {showInterface}
  1063.                 DeleteSaveGamePanel
  1064.                 oz'event {oz'delay 0.01}
  1065.                 oz'event {standardFadein}
  1066.                 oz'event {wizEnableMouse}
  1067.                 oz'event {set ::isGameReady 1}
  1068.             }
  1069.         }
  1070.         
  1071.         oz'flush
  1072.     }
  1073.  
  1074.     proc erase {n} {
  1075.         CloseSaveGamePanel
  1076.    
  1077.         oz'event {oz'delay 0.5}
  1078.         
  1079.         set ::itf::delete [new itf'delete $n]
  1080.         oz'widget::property $::itf::delete -pos 0.0625 0.416666 -alpha 0
  1081.         oz'widget::child [FOREGROUNDWIDGET] $::itf::delete 0.5
  1082.         wq'widget::fadeto $::itf::delete 1
  1083.  
  1084.         DeleteSaveGamePanel
  1085.         
  1086.         oz'flush
  1087.     }
  1088. }
  1089.  
  1090. proc initializeGame { } {
  1091.   set config "set soundfx_volume $::config::user::soundfx_volume\nset voice_volume $::config::user::voice_volume\nset music_volume $::config::user::music_volume\nset gamma_correction $::config::user::gamma_correction"
  1092.  
  1093.   set fid [open "../res/user.tcl" "w"]
  1094.   puts $fid $config
  1095.   close $fid
  1096.  
  1097.   source "../res/config.tcl"
  1098.  
  1099.   updateVolume
  1100.     
  1101.   ozSet "ghostWhiningVar" [expr 10000 + [ random 5000]]
  1102.   chainCallEvent optionnalConversation.optionnalConversation
  1103.  
  1104.   ozSet "libraryZoomIn" ""
  1105.  
  1106.   if {[ozGet "trialAllegianceDoor"] == "open" || \
  1107.       [ozGet "trialWisdomDoor"] == "open" || \
  1108.       [ozGet "trialTriumphDoor"] == "open"} {
  1109.     ozSet "trialRoomDoorSeen" "complete"
  1110.   }
  1111.  
  1112.   if { [ozGet "zakForm"] == "cat" } {
  1113.     wizqEntityModel Zak "/character/zakCat/zakCat.cal3d"
  1114.     oz'event {ozEntityZak follownormal 1}
  1115.  
  1116.   } elseif { [ozGet "zakForm"] == "dragon" } {
  1117.     wizqEntityModel Zak "/character/zakDragon/zakDragon.cal3d"
  1118.     oz'event {ozEntityZak follownormal 0}
  1119.  
  1120.   } elseif { [ozGet "zakForm"] == "human" } {
  1121.     wizqEntityModel Zak "/character/zakHuman/zakHuman.cal3d"
  1122.     oz'event {ozEntityZak follownormal 0}
  1123.  
  1124.   } else {
  1125.     wizqEntityModel Zak "/character/zakWolf/zakWolf.cal3d"
  1126.     oz'event {ozEntityZak follownormal 1}
  1127.   }
  1128.  
  1129.   SetModelLydia
  1130.  
  1131.   if { [ozGet "puzzleZak"] == "complete" } {
  1132.     oz'event {ozEntityZak show}
  1133.   } else {
  1134.     oz'event {ozEntityZak hide}
  1135.   }
  1136.  
  1137.   if { [ozGet "zakHide"] == "initiated" } {
  1138.     oz'event {ozEntityZak hide}
  1139.   }
  1140.   
  1141.   if {[ozGet "characterControlled"] == "Zak"} {
  1142.       oz'event {switchAppearance}
  1143.       oz'event {
  1144.           ozEntityLydia follownormal 1
  1145.           ozEntityZak follownormal 0
  1146.       }
  1147.   } elseif { [ozGet "mainCharacter"] == "zak" } {
  1148.     chainEvent { switchAppearance }
  1149.       oz'event {
  1150.           ozEntityLydia follownormal 1
  1151.           ozEntityZak follownormal 0
  1152.       }
  1153.   } elseif {[ozGet "sanctuaryZakSwitch"] == "initiated"} {
  1154.       chainEvent { switchAppearance }
  1155.   }
  1156.       
  1157.  
  1158.   if {[ozGet "zakPresence"] == "away"} {
  1159.       wizqEntityStopFollow Zak
  1160.  
  1161.   } elseif { [ozGet "characterControlled"] == "zak" } {
  1162.     wizqEntityStopFollow Zak
  1163.  
  1164.   } elseif { [ozGet "mainCharacter"] == "zak" } {
  1165.     wizqEntityStopFollow Zak
  1166.  
  1167.   } else {
  1168.       wizqEntityResumeFollow Zak
  1169.   }
  1170.  
  1171.   if {([ozGet "zakOnGround"]   == "C" && [ozGet "lydiaOnGround"] == "A") ||
  1172.       ([ozGet "lydiaOnGround"] == "C" && [ozGet "zakOnGround"]   == "A")} {
  1173.     chainEvent {
  1174.       wizEntityShow Lydia
  1175.       wizEntityHide Zak
  1176.     }
  1177.   }
  1178.   
  1179.   oz'event {oz'delay 0.25}
  1180.   
  1181.   ozSet "npcDiscussion" ""
  1182.  
  1183. }
  1184.     
  1185. event "Entrance" {
  1186.   setCamera "intro"
  1187. }
  1188.  
  1189. camera "menu" {
  1190.     layer background "introduction/menu" 0 0 0 0 0 0 0 0
  1191.     cursor "introduction/menuCursor.tga"
  1192. }
  1193.  
  1194. camera "intro" {
  1195.     layer background "introduction/intro" 0 0 0 0 0 0 0 0
  1196.     cursor "introduction/introCursor.tga"
  1197. }
  1198.  
  1199. camera "info" {
  1200.     layer background "introduction/scrollIntro" 0 0 0 0 0 0 0 0
  1201.     cursor "introduction/infoCursor.tga"
  1202. }
  1203.  
  1204. event "main" {
  1205.   wizqEntityModel Npc "/character/mustavio/mustavio.cal3d"
  1206.   chainEvent {wizEntityHide Npc}
  1207.    
  1208.   updateGamma
  1209.   updateVolume
  1210.  
  1211.   wizqEntityStopFollow Zak
  1212.   set ::isGameReady 0
  1213.   hideMouse
  1214.   hideInterface
  1215.    
  1216.   set ::itf::game1 0
  1217.   set ::itf::game2 0
  1218.   set ::itf::game3 0
  1219.   set ::itf::game4 0
  1220.   set ::itf::game5 0
  1221.   set ::itf::history 0
  1222.   set ::itf::opt 0
  1223.   set ::itf::back 0
  1224.  
  1225.   set ::ref_voice_volume     $::config::user::voice_volume
  1226.   set ::ref_soundfx_volume   $::config::user::soundfx_volume
  1227.   set ::ref_music_volume     $::config::user::music_volume
  1228.   set ::ref_ambient2d_volume $::config::user::soundfx_volume
  1229.  
  1230.   chainEvent { 
  1231.     bind next 3 1 1 1
  1232.   }
  1233.  
  1234.   chainEvent {
  1235.     setCamera "menu"
  1236.   }
  1237.  
  1238.   chainEvent {cameraFadein 1000}
  1239.  
  1240.   introduction::new logoB
  1241.   set s [ozqSound::NewFX2  "sound/cutscenes/lb.ogg"]
  1242.   wq'widget::waitfor [set introduction::logoB] -animate
  1243.   wq'widget::delete& introduction::logoB
  1244.   ozqSound::Volume $s 0
  1245.  
  1246.   oz'event {oz'track::play $::music_track "sound/music/introKeepsake.ogg" -repeat 1}
  1247.   introduction::new logo -play
  1248.  
  1249.   chainEvent {cameraFadeout 0}
  1250.   chainEvent {standardFadein}
  1251.   
  1252.   chainEvent {
  1253.     showMouse
  1254.   }
  1255.  
  1256.   ShowIntroPanel
  1257. }
  1258.  
  1259. event "next" {
  1260.   callChainEvent "newsavegame"
  1261.   chainEvent { initializeGame }
  1262.   chainEvent { showInterface }
  1263.   chainEvent { standardFadein }
  1264. }  
  1265.     
  1266.