home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Encyklopedia Omnia
/
Planeta.iso
/
data
/
c_common.cst
/
00046_Script_swingZoom
< prev
next >
Wrap
Text File
|
2000-11-14
|
2KB
|
51 lines
on swingZoom pNS, pPanAngle, pTilt, pFov, pTime, pDir
global gSwingIncr, gOldTempo, gLastTicks, gSwingExtent, gNumStep, gTiltExtent, gFovExtent
if voidP(gSwingIncr) then
-- calcola il numero di steps
set gNumStep = pTime * (the frameTempo)
-- calcola gli extent
set p1 = the panAngle of sprite pNS
set p2 = pPanAngle
if pDir = #right then
set gSwingExtent = abs(p2-p1)
else
set gSwingExtent = 360-abs(p2-p1)
end if
set gTiltExtent = pTilt - the TiltAngle of sprite pNS
set gFovExtent = pFov - the FieldOfView of sprite pNS
-- determina i passi di swing
set gSwingIncr = gSwingExtent / gNumStep
set tiltIncr = gTiltExtent / gNumStep
set fovIncr = gFovExtent / gNumStep
else
-- dalla seconda volta in poi...
set diff = the ticks - gLastTicks
set frameDuration = 60/(the frameTempo)
set gSwingIncr = (gSwingExtent / gNumStep) * (diff/frameDuration)
set tiltIncr = (gTiltExtent / gNumStep) * (diff/frameDuration)
set fovIncr = (gFovExtent / gNumStep) * (diff/frameDuration)
end if
if pDir = #right then
set incr = (-1) * gSwingIncr
else
set incr = gSwingIncr
end if
set pan = the panAngle of sprite pNS
if abs(pan - pPanAngle) > gSwingIncr then
set the panAngle of sprite pNS to pan + incr
set the TiltAngle of sprite pNS to tiltIncr + the TiltAngle of sprite pNS
set the FieldOfView of sprite pNS to fovIncr + the FieldOfView of sprite pNS
set retVal = 1
else
set gSwingIncr = VOID
set retVal = 0
end if
set gLastTicks = the ticks
return retVal
end