Ejemplo n.º 1
0
 void M4::positionWeapon()
{	//positions the m4 at a fps point of view
	if(noClip == false)
	{
		dbPositionObject(obj,dbCameraPositionX(), dbCameraPositionY()-10,dbCameraPositionZ());
		dbRotateObject(obj,-dbCameraAngleX(), dbCameraAngleY()-180,dbCameraAngleZ());
		dbMoveObject(obj, -18);
		dbMoveObjectRight(obj, -7);
	}
}
Ejemplo n.º 2
0
void showFPS ( void )
{
	char szFPS [ 256 ] = "";
	strcpy ( szFPS, "fps = " );
	strcat ( szFPS, dbStr ( dbScreenFPS ( ) ) );

	dbSetCursor ( 0, 0 );

	dbPrint ( szFPS );
	dbPrint ( "" );

	//strcpy ( szFPS, dbStr ( dbObjectAngleY ( 6000 ) ) );
	//dbPrint ( szFPS );
	
	
	strcpy ( szFPS, dbStr ( dbCameraPositionX ( ) ) );
	dbPrint ( szFPS );
	strcpy ( szFPS, dbStr ( dbCameraPositionY ( ) ) );
	dbPrint ( szFPS );
	strcpy ( szFPS, dbStr ( dbCameraPositionZ ( ) ) );
	dbPrint ( szFPS );

	/*
	dbPrint ( "" );
	strcpy ( szFPS, dbStr ( dbCameraAngleX ( ) ) );
	dbPrint ( szFPS );
	strcpy ( szFPS, dbStr ( dbCameraAngleY ( ) ) );
	dbPrint ( szFPS );
	strcpy ( szFPS, dbStr ( dbCameraAngleZ ( ) ) );
	dbPrint ( szFPS );
	*/

	
	dbPrint ( "" );
	strcpy ( szFPS, dbStr ( dbStatistic ( 1 ) ) );
	dbPrint ( szFPS );
	

	//dbPrint ( "" );
	//dbPrint ( dbStr ( dbKeyState ( ) ) );

}
Ejemplo n.º 3
0
	void CameraCylinder (int iID,float move, float ystep, float yturn)
	{
		if (!camera.ACTIVE) return;

		//Left
		if (dbLeftKey()==1)		
		{	
			camera.b=dbWrapValue(camera.b+yturn);
			float distXZ=dbSQRT(camera.x*camera.x+camera.z*camera.z);
			camera.x=dbNewXValue(camera.point.x,camera.b,-distXZ);
			camera.z=dbNewZValue(camera.point.z,camera.b,-distXZ);
			dbPositionCamera(iID,camera.x,camera.y,camera.z);
			dbPointCamera(iID,camera.point.x,camera.point.y,camera.point.z);
			camera.UPDATE=true;
		}
		//Right
		if (dbRightKey()==1)		
		{
			camera.b=dbWrapValue(camera.b-yturn);	
			float distXZ=dbSQRT(camera.x*camera.x+camera.z*camera.z);
			camera.x=dbNewXValue(camera.point.x,camera.b,-distXZ);
			camera.z=dbNewZValue(camera.point.z,camera.b,-distXZ);
			dbPositionCamera(iID,camera.x,camera.y,camera.z);
			dbPointCamera(iID,camera.point.x,camera.point.y,camera.point.z);
			camera.UPDATE=true;
		}
		//Shift
		if (dbShiftKey()==1)		
		{	
			camera.y += ystep;
			dbPositionCamera(iID,camera.x,camera.y,camera.z);
			dbPointCamera(iID,camera.point.x,camera.point.y,camera.point.z);
			camera.a=dbCameraAngleX(iID);
			camera.UPDATE=true;
		}
		//Strg
		if (dbControlKey()==1)	
		{	
			if (camera.y>=ystep)
			{
			camera.y -= ystep;
			dbPositionCamera(iID,camera.x,camera.y,camera.z);
			dbPointCamera(iID,camera.point.x,camera.point.y,camera.point.z);
			camera.a=dbCameraAngleX(iID);
			camera.UPDATE=true;
			}
		}
		//Up
		if (dbUpKey()==1)	
		{	
			dbMoveCamera(iID,move);
			camera.x=dbCameraPositionX(iID);
			camera.y=dbCameraPositionY(iID);
			camera.z=dbCameraPositionZ(iID);
			camera.UPDATE=true;
		}
		//Down
		if (dbDownKey()==1)
		{	
			dbMoveCamera(iID,-move);
			camera.x=dbCameraPositionX(iID);
			camera.y=dbCameraPositionY(iID);
			camera.z=dbCameraPositionZ(iID);
			camera.UPDATE=true;
		}
		//Mouse
		if (mouse.c==2)
		{
		if ( mouse.mx != 0.0f)	{	dbYRotateCamera(iID,dbCurveAngle(dbWrapValue(dbCameraAngleY(iID)+mouse.mx),dbCameraAngleY(iID),2.5f));	}
		if ( mouse.my != 0.0f)	{	dbXRotateCamera(iID,dbCurveAngle(dbWrapValue(dbCameraAngleX(iID)+mouse.my),dbCameraAngleX(iID),2.5f));	}
		if ( mouse.mz != 0.0f)	{	dbMoveCamera(iID,mouse.mz);}
		}	
	}