All pastes #176317 Raw Edit

Anonymous

public text v1 · immutable
#176317 ·published 2006-09-19 15:35 UTC
rendered paste body
// zoom and fov functions in client/scripts/default.bind.cs
// might need a moveMap.bind(keyboard, "x", zoomin); in client/config.cs
// zoom and fov functions in client/scripts/default.bind.cs
// kann sein das braucht nen moveMap.bind(keyboard, "x", zoomin); in client/config.cs

// updated version

//------------------------------------------------------------------------------
// Zoom and FOV functions
//------------------------------------------------------------------------------
 
$Pref::player::CurrentFOV = 90;
 
function ZoomIn(%trigger)
{
   switch$ (%trigger)
   {
      case "0":
	setzoomfov($Pref::player::ZoomFOV , $Pref::player::CurrentFOV);
        moveMap.bind(mouse0, "zaxis", handleMouseWheel);
        if($fpreset)
        {
        $firstperson=0;$fpreset=0;
        }
      case "1":
        moveMap.bind(mouse0, "zaxis", handleZoom);
        if($firstperson)
        {
	setzoomfov($Pref::player::CurrentFOV , $Pref::player::ZoomFOV);
        }
        else
        {
        $firstperson=1;
	setzoomfov($Pref::player::CurrentFOV , $Pref::player::ZoomFOV);
        $fpreset=1;
        }
   }  
}
 
function handlezoom(%val)
{
if ( %val < 0 ){
        if( $Pref::player::ZoomFOV < $Pref::player::CurrentFOV){
        %oldzoomfov=$Pref::player::ZoomFOV;
        $Pref::player::ZoomFOV+=5;
	setzoomfov( %oldzoomfov , $Pref::player::ZoomFOV);
        }
        }
else if ( %val > 0 )
        {
                
                if( $Pref::player::ZoomFOV > 0){
                %oldzoomfov=$Pref::player::ZoomFOV;
                $Pref::player::ZoomFOV-=5;
		setzoomfov( %oldzoomfov , $Pref::player::ZoomFOV);
                }
        }
}

function setzoomfov(%zoom,%default)
{
if($pref::Player::zoomSpeed$="" || $pref::Player::zoomSpeed==0){
$pref::Player::zoomSpeed=8;
}
if(%default>%zoom){
	if( isEventPending($Game::zoominSchedule) ){
		cancel($Game::zoominSchedule);%zoom=$curzoom;
	}
	%zoom+=1;
	setfov(%zoom);
	$curzoom=%zoom;
	if(%zoom < %default)
        	$Game::zoomoutSchedule = schedule($pref::Player::zoomSpeed,0,"setzoomfov",%zoom,%default);
}else{
	if( isEventPending($Game::zoomoutSchedule) ){
		cancel($Game::zoomoutSchedule);%zoom=$curzoom;
	}
	%zoom-=1;
	setfov(%zoom);
	$curzoom=%zoom;
	if(%zoom > %default)
        	$Game::zoominSchedule = schedule($pref::Player::zoomSpeed,0,"setzoomfov",%zoom,%default);
}
}
 
function DefaultZoom()
{
        $Pref::player::CurrentFOV = 90;
        setFov( $Pref::player::CurrentFOV );
}
 
//moveMap.bind(keyboard, r, zoomOut);
moveMap.bind(keyboard, x, zoomIn);


//------------------------------------------------------------------------------