set baseDir ski
set scenarioDir $baseDir/lesson2
set ::scenarioDir $scenarioDir

#----------------------------------------------------------------------
# ground setup
#----------------------------------------------------------------------

gndfile $scenarioDir/gnd.txt

gnd kp 2000
gnd kd 200
gnd cf 0.6
tog_gnd

loadtexobj props/square_tess.wobj props/blank.jpg
loadtexobjtxfm $scenarioDir/gnd.txfm

tog_gnd

#----------------------------------------------------------------------

< $::charDir/common.setup

set ::restLocX -1.465535
set ::restLocY 0.598467

world setaf skier
restpose -1.465535 0.598467 1.529096

#----------------------------------------------------------------------
# rock
#----------------------------------------------------------------------

< props/newBigRock.setup
set rockName [artfig name]
set skinName "[artfig name].skin"
restpose -1.931729 -0.340175 2.172032
artfig anchored true

# hide texture
texObj $skinName tex 0

#----------------------------------------------------------------------
# spring
#----------------------------------------------------------------------

set spKp 2000
set spKd 50
title "$::charName >> Lesson 2"

#----------------------------------------------------------------------

# play no sound at startup
proc startSim {} {
}

texload brick ../artwork/moraine128_blur.ppm repeat

#----------------------------------------------------------------------

set ::skierState $::onGround

#----------------------------------------------------------------------

source anim.tcl

proc anim_begin {} {
    _anim_begin

    gui delall
#    play $::scenarioDir/lesson.txt
    buf_cload $::scenarioDir/lesson.az
    play logbuf
}

proc anim_end {} {
    _anim_end

    # check to see if we watched the entire animation
    if {[pb time] > 28} {
	set ::skierState $::nextStage
    }
}

# override the goal showing step
proc showGoal {} {
    if {[preview] == 0} {
	message "Lesson 2: Fall Recovery\\n\\n Gravity happens and so do\\n accidents!  Learn how to\\n revive the skier after he\\n falls.\\n\\nPress <space> to continue\\nPress <Esc> to stop lesson at\\n any time" 15 18
    }
}
