Ejemplo n.º 1
0
void	Viewport :: Update (GameData& data)
{
	PlayerDatabase* playerdb = data.GetPlayerDatabase();
	if (playerdb != NULL)
	{
		UUID CurrentPLayerID  = playerdb->GetCurrentPlayerID();
		Player* player = playerdb->GetPlayer (CurrentPLayerID);
		
		Vector v = player->GetViewFocus ();
		v.z += NormalZDepth;
		SetCameraPosition(v);
	}
	
	float	ViewAngle = 0.11f;// simply for setting the proper frustum
	glFrustum (-ViewAngle, ViewAngle, -ViewAngle, ViewAngle, 0.1, 9000);
	
	// I can't express how important setting the Frustrum before rotating and translating is.
	// We will end up with very strange clipping in 3-space if we don't keep these
	// ordered thusly.
	Vector LookAt = -CameraAngle;
	glRotated (LookAt.pitch, 1.0, 0, 0);
	glRotated (LookAt.yaw, 0, 1.0, 0);
	glRotated (LookAt.roll, 0, 0, 1.0);		
	
	glTranslated (-Position.x, -Position.y, -Position.z);
	
}
Ejemplo n.º 2
0
//---------------------------------------------------------
void			ProjectileMgr :: ProcessMessages (GameData& GlobalGameData)//inherited, send all messages to the appropriate players
{
	PlayerDatabase* playerdb = GlobalGameData.GetPlayerDatabase();
	
	int NumMessages = ReceiveQueue.Count ();
	for (int i=0; i<NumMessages; i++)
	{
		const Events::GameEvent* msg = reinterpret_cast <const Events::GameEvent*> (ReceiveQueue.Dequeue());
		switch (msg->GetType())
		{
			case Events :: FireWeapon:
			{
				const Events::FireWeaponEvent* fw = reinterpret_cast <const Events::FireWeaponEvent*> (msg);
				UUID PlayerID = fw->GetPlayerID ();
				Player* p = playerdb->GetPlayer(PlayerID);
				if (p)
				{
					ShipArchetype* ship = p->GetShip();
					if (ship)
					{
						AddBolt (*ship, PlayerID);
					}
				}
			}
			break;
		}
	}
	
}
Ejemplo n.º 3
0
void	PlayerStatusBars :: Update (GameData& GlobalGameData)
{
	PlayerDatabase* playerDb = GlobalGameData.GetPlayerDatabase();
	player = playerDb->GetCurrentPlayer ();
	
	if (player == NULL)
	{
		PlayerName.clear();
		NumberOfStationsBeingTracked = 0;
	}
	else
	{
		PlayerName = player->GetName();
		NumberOfStationsBeingTracked = player->GetNumStations();
		ShipArchetype* ship = player->GetShip ();
		PlayerShipTracking = static_cast<float>( ship->GetHealth () );
		PlayerShipShieldTracking = static_cast<float>( ship->GetShieldLevel () );
		
		for (int i=0; i<NumberOfStationsBeingTracked; i++)
		{
			SpaceStation* station = player->GetStation(i);
			StationTracking[i] = static_cast<float>( station->GetHealth () );
			StationShieldTracking[i] = static_cast<float>( station->GetShieldLevel () );
		}
	}
}