All pastes #173350 Raw Edit

Unnamed

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

//------------------------------------------------------------------------------
// Zoom and FOV functions
//------------------------------------------------------------------------------

$Pref::player::CurrentFOV = 90;

function ZoomIn(%trigger)
{

   switch$ (%trigger)
   {
      case "0":
        //setFov( $Pref::player::CurrentFOV );
	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);
	echo(%f SPC %val);
	if($firstperson)
	{
	//setFov( $Pref::player::ZoomFOV);
	setzoomFov( $Pref::player::CurrentFOV , $Pref::player::ZoomFOV);
	}
	else
	{
	$firstperson=1;
	//setFov($Pref::player::ZoomFOV);
	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);
	//setFov( $Pref::player::ZoomFOV );
	}
	}
	else if ( %val > 0 )
	{
		
		if( $Pref::player::ZoomFOV > 0){
		%oldzoomfov=$Pref::player::ZoomFOV;
		$Pref::player::ZoomFOV-=5;
		//setFov( $Pref::player::ZoomFOV );
		setzoomFov( %oldzoomfov , $Pref::player::ZoomFOV);
		}
	}
}

function DefaultZoom()
{
	$Pref::player::CurrentFOV = 90;
	setFov( $Pref::player::CurrentFOV );
}

function setzoomfov(%zoom,%default)
{

if(%default>%zoom){
%zoomfac=mABS(%zoom - %default);
	for(%i = 0; %i <= %zoomfac; %i++)
	{
	%f=%zoom+%i;
	schedule(5*(%i+1),0,"zoomer",%f);
	}
}else
{
%zoomfac=mABS(%zoom-%default);
	for(%i = 0; %i <= %zoomfac; %i++)
	{
	%f=%zoom-%i;
	schedule(5*(%i+1),0,"zoomer",%f);
	}
}
}

function zoomer(%val)
{
setfov(%val);
}

//moveMap.bind(keyboard, r, zoomOut);
moveMap.bind(keyboard, x, zoomIn);


//------------------------------------------------------------------------------
// Camera & View functions