Merge branch 'master' into TeamPickCamera

# Conflicts:
#	src/Game/Game.cpp
This commit is contained in:
William Moberg
2016-03-04 05:58:49 +01:00
36 changed files with 12339 additions and 1565 deletions
+3 -2
View File
@@ -10,8 +10,9 @@ namespace Events
struct PlayerDeath : Event
{
//KilledBy,KilledByWhat is optional for now. It might be used later in the playerlog-system
EntityWrapper Player;
std::string KilledByWhat;
EntityWrapper Player = EntityWrapper::Invalid;
EntityWrapper Killer = EntityWrapper::Invalid;
std::string KilledByWhat = "";
};
}
+1 -1
View File
@@ -68,7 +68,7 @@ protected:
const std::string m_ComponentType;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) = 0;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt) = 0;
};
class ImpureSystem : public virtual System
+19
View File
@@ -0,0 +1,19 @@
#ifndef Events_KillDeath_h__
#define Events_KillDeath_h__
#include "Core/EventBroker.h"
typedef unsigned int PlayerID;
namespace Events
{
struct KillDeath : public Event
{
PlayerID Casualty = -1;
PlayerID Killer = -1;
};
}
#endif
+17
View File
@@ -0,0 +1,17 @@
#ifndef Events_PlayerConnected
#define Events_PlayerConnected
#include "Core/EventBroker.h"
namespace Events
{
struct PlayerConnected : public Event
{
std::string PlayerName = "";
int PlayerID = -1;
};
}
#endif // !Events_PlayerConnected
+7 -1
View File
@@ -21,6 +21,9 @@
#include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h"
#include "Core/EAmmoPickup.h"
#include "Core/EPlayerDeath.h"
#include "Network/EPlayerConnected.h"
#include "Network/EKillDeath.h"
class Server : public Network
{
@@ -77,7 +80,8 @@ private:
void parseOnPlayerDamage(Packet& packet);
void identifyPacketLoss();
void kick(PlayerID player);
PlayerID GetPlayerIDFromEndpoint();
PlayerID getPlayerIDFromEndpoint();
PlayerID getPlayerIDFromEntityID(EntityID entityID);
void parsePlayerTransform(Packet& packet);
void parseOnInputCommand(Packet& packet);
void parseClientPing();
@@ -103,6 +107,8 @@ private:
bool OnPlayerDamage(const Events::PlayerDamage& e);
EventRelay<Server, Events::AmmoPickup> m_EAmmoPickup;
bool OnAmmoPickup(const Events::AmmoPickup& e);
EventRelay<Server, Events::PlayerDeath> m_EPlayerDeath;
bool OnPlayerDeath(const Events::PlayerDeath& e);
};
#endif
@@ -30,6 +30,8 @@ private:
bool m_LeftFoot = false;
// To get a difference when calculating the walking state.
glm::vec3 m_LastPosition = glm::vec3();
// Used to track afterimages for sprint effect.
float m_SprintEffectTimer;
// The logic for making the sound play when player is moving
void playerStep(double dt);
// Spawn a hexagon at origin of an Entity
+44
View File
@@ -0,0 +1,44 @@
#ifndef ScoreScreenSystem_h__
#define ScoreScreenSystem_h__
#include "Core/System.h"
#include "Core/ResourceManager.h"
#include "Core/EntityFile.h"
#include "Network/EKillDeath.h"
#include "Core/EPlayerSpawned.h"
#include "Network/EPlayerConnected.h"
#include "Network/EPlayerDisconnected.h"
#include "GLM.h"
class ScoreScreenSystem : public PureSystem
{
public:
ScoreScreenSystem(SystemParams params);
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt) override;
EventRelay<ScoreScreenSystem, Events::KillDeath> m_EPlayerDeath;
bool OnPlayerDeath(const Events::KillDeath& e);
EventRelay<ScoreScreenSystem, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawn(const Events::PlayerSpawned& e);
EventRelay<ScoreScreenSystem, Events::PlayerConnected> m_EPlayerConnected;
bool OnPlayerConnected(const Events::PlayerConnected& e);
EventRelay<ScoreScreenSystem, Events::PlayerDisconnected> m_EPlayerDisconnected;
bool OnPlayerDisconnected(const Events::PlayerDisconnected& e);
private:
struct PlayerData {
int ID = -1;
std::string Name = "";
int Team = 1;
int Kills = 0;
int Deaths = 0;
EntityWrapper Player = EntityWrapper::Invalid;
};
std::vector<int> m_DisconnectedIdentities;
int m_PlayerCounter = 0;
std::unordered_map<int, PlayerData> m_PlayerIdentities;
};
#endif
+2
View File
@@ -2,6 +2,8 @@
#define AmmunitionHUDSystem_h__
#include <boost/lexical_cast.hpp>
#include <sstream>
#include <iomanip>
#include "../../Engine/Core/System.h"
#include "../../Engine/GLM.h"