Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7fa634ef7c | |||
| 080f5ac856 | |||
| 4ecbef59bf | |||
| 8a1217e8b5 | |||
| 8e150da7ff | |||
| c790b952fb | |||
| be3d75a5cf | |||
| b3c935c7cc | |||
| f05b09ca7a | |||
| e76740d72b | |||
| d3927de7cc | |||
| fe090504cf | |||
| 672d6f884d | |||
| 5ea0f04b20 | |||
| 9b5e4c10fd | |||
| fb400bb743 | |||
| aa2475dfd6 | |||
| 36c4837813 | |||
| 2fa3637018 | |||
| 52e5e2527a | |||
| 36253a8afd | |||
| 5c343cb254 | |||
| b73595eed0 | |||
| f9e640ffc6 | |||
| f2c7a9f27a | |||
| ac20e41a5d | |||
| 4f99f6ef74 | |||
| d0a083a1e3 | |||
| d5f06fa8c2 | |||
| 8bb8ebbea3 | |||
| 20d46f63c8 | |||
| b7d88808e2 | |||
| f8f536802f | |||
| 60df30fa59 | |||
| c544f349fd | |||
| 0c1a2d3160 |
+1
-1
Submodule assets updated: bc6e7df04c...6ffc1ab82a
@@ -1,5 +1,5 @@
|
|||||||
#ifndef ECaptured_h__
|
#ifndef Events_Captured_h__
|
||||||
#define ECaptured_h__
|
#define Events_Captured_h__
|
||||||
|
|
||||||
#include "EventBroker.h"
|
#include "EventBroker.h"
|
||||||
#include "../Core/Entity.h"
|
#include "../Core/Entity.h"
|
||||||
|
|||||||
@@ -10,28 +10,32 @@
|
|||||||
#include <boost/asio.hpp>
|
#include <boost/asio.hpp>
|
||||||
#include <boost/shared_array.hpp>
|
#include <boost/shared_array.hpp>
|
||||||
|
|
||||||
|
#include "Core/World.h"
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
#include "Core/ConfigFile.h"
|
||||||
|
#include "Core/EPlayerDeath.h"
|
||||||
|
#include "Core/EPlayerDamage.h"
|
||||||
|
#include "Core/EPlayerSpawned.h"
|
||||||
|
#include "Core/EAmmoPickup.h"
|
||||||
|
#include "Game/Events/EDoubleJump.h"
|
||||||
|
#include "Game/Events/EDashAbility.h"
|
||||||
|
#include "Game/Events/EReset.h"
|
||||||
|
#include "Input/EInputCommand.h"
|
||||||
|
#include "imgui/imgui.h"
|
||||||
#include "Network/Network.h"
|
#include "Network/Network.h"
|
||||||
#include "Network/MessageType.h"
|
#include "Network/MessageType.h"
|
||||||
#include "Network/PlayerDefinition.h"
|
#include "Network/PlayerDefinition.h"
|
||||||
#include "Network/UDPClient.h"
|
#include "Network/UDPClient.h"
|
||||||
#include "Network/TCPClient.h"
|
#include "Network/TCPClient.h"
|
||||||
#include "Network/SnapshotDefinitions.h"
|
#include "Network/SnapshotDefinitions.h"
|
||||||
#include "Core/World.h"
|
|
||||||
#include "Core/EntityFile.h"
|
|
||||||
#include "Core/EventBroker.h"
|
|
||||||
#include "Core/ConfigFile.h"
|
|
||||||
#include "Core/EPlayerDeath.h"
|
|
||||||
#include "Input/EInputCommand.h"
|
|
||||||
#include "Core/EPlayerDamage.h"
|
|
||||||
#include "../Game/Events/EDoubleJump.h"
|
|
||||||
#include "Network/EInterpolate.h"
|
|
||||||
#include "Network/SnapshotFilter.h"
|
|
||||||
#include "Core/EPlayerSpawned.h"
|
|
||||||
#include "Core/EAmmoPickup.h"
|
|
||||||
#include "Network/ESearchForServers.h"
|
|
||||||
#include "../Game/Events/EDashAbility.h"
|
|
||||||
#include "Network/EDisplayServerlist.h"
|
#include "Network/EDisplayServerlist.h"
|
||||||
#include "Network/EConnectRequest.h"
|
#include "Network/EConnectRequest.h"
|
||||||
|
#include "Network/EPlayerDisconnected.h"
|
||||||
|
#include "Network/ESearchForServers.h"
|
||||||
|
#include "Network/EInterpolate.h"
|
||||||
|
#include "Network/SnapshotFilter.h"
|
||||||
|
|
||||||
class Client : public Network
|
class Client : public Network
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -40,7 +44,7 @@ public:
|
|||||||
~Client();
|
~Client();
|
||||||
|
|
||||||
void Connect(std::string address, int port);
|
void Connect(std::string address, int port);
|
||||||
void Update() override;
|
void Update(double dt) override;
|
||||||
private:
|
private:
|
||||||
UDPClient m_Unreliable;
|
UDPClient m_Unreliable;
|
||||||
TCPClient m_Reliable;
|
TCPClient m_Reliable;
|
||||||
@@ -74,10 +78,10 @@ private:
|
|||||||
// Network logic
|
// Network logic
|
||||||
PlayerDefinition m_PlayerDefinitions[8];
|
PlayerDefinition m_PlayerDefinitions[8];
|
||||||
SnapshotDefinitions m_NextSnapshot;
|
SnapshotDefinitions m_NextSnapshot;
|
||||||
double m_DurationOfPingTime;
|
double m_DurationOfPingTime = 0;
|
||||||
std::clock_t m_StartPingTime;
|
double m_StartPingTime = 0;
|
||||||
std::clock_t m_TimeSinceSentInputs;
|
double m_TimeSinceSentInputs = 0;
|
||||||
unsigned int m_SendInputIntervalMs;
|
double m_SendInputInterval = 0.033;
|
||||||
std::vector<Events::InputCommand> m_InputCommandBuffer;
|
std::vector<Events::InputCommand> m_InputCommandBuffer;
|
||||||
|
|
||||||
// Private member functions
|
// Private member functions
|
||||||
@@ -100,6 +104,7 @@ private:
|
|||||||
void parseDoubleJump(Packet& packet);
|
void parseDoubleJump(Packet& packet);
|
||||||
void parseDashEffect(Packet& packet);
|
void parseDashEffect(Packet& packet);
|
||||||
void parseAmmoPickup(Packet& packet);
|
void parseAmmoPickup(Packet& packet);
|
||||||
|
void parseRemoveWorld(Packet& packet);
|
||||||
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
|
||||||
void parseSnapshot(Packet& packet);
|
void parseSnapshot(Packet& packet);
|
||||||
void identifyPacketLoss();
|
void identifyPacketLoss();
|
||||||
@@ -109,7 +114,6 @@ private:
|
|||||||
void sendLocalPlayerTransform();
|
void sendLocalPlayerTransform();
|
||||||
void becomePlayer();
|
void becomePlayer();
|
||||||
void displayServerlist();
|
void displayServerlist();
|
||||||
void removeWorld();
|
|
||||||
void createMainMenu();
|
void createMainMenu();
|
||||||
// Mapping Logic
|
// Mapping Logic
|
||||||
// Returns if local EntityID exist in map
|
// Returns if local EntityID exist in map
|
||||||
@@ -138,8 +142,8 @@ private:
|
|||||||
UDPClient m_ServerlistRequest;
|
UDPClient m_ServerlistRequest;
|
||||||
std::vector<ServerInfo> m_Serverlist;
|
std::vector<ServerInfo> m_Serverlist;
|
||||||
bool m_SearchingForServers = false;
|
bool m_SearchingForServers = false;
|
||||||
std::clock_t m_StartSearchTime;
|
double m_TimeSearched = 0;
|
||||||
double m_SearchingTime = 200; // Config I guess
|
double m_SearchingTime = 0.2; // Config I guess
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ enum class MessageType
|
|||||||
OnDashEffect,
|
OnDashEffect,
|
||||||
ServerlistRequest,
|
ServerlistRequest,
|
||||||
AmmoPickup,
|
AmmoPickup,
|
||||||
|
RemoveWorld,
|
||||||
Invalid
|
Invalid
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
Network(World* world, EventBroker* eventBroker);
|
Network(World* world, EventBroker* eventBroker);
|
||||||
virtual ~Network() { };
|
virtual ~Network() { };
|
||||||
|
|
||||||
virtual void Update() = 0;
|
virtual void Update(double dt) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
World* m_World;
|
World* m_World;
|
||||||
@@ -40,6 +40,7 @@ protected:
|
|||||||
void saveToFile();
|
void saveToFile();
|
||||||
void updateNetworkData();
|
void updateNetworkData();
|
||||||
void popNetworkSegmentOfHeader(Packet& packet);
|
void popNetworkSegmentOfHeader(Packet& packet);
|
||||||
|
void removeWorld();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "Network/MessageType.h"
|
#include "Network/MessageType.h"
|
||||||
#include "Network/PlayerDefinition.h"
|
#include "Network/PlayerDefinition.h"
|
||||||
#include "Core/World.h"
|
#include "Core/World.h"
|
||||||
|
#include "Core/EntityFile.h"
|
||||||
#include "Core/EventBroker.h"
|
#include "Core/EventBroker.h"
|
||||||
#include "../Network/Network.h"
|
#include "../Network/Network.h"
|
||||||
#include "Input/EInputCommand.h"
|
#include "Input/EInputCommand.h"
|
||||||
@@ -24,6 +25,8 @@
|
|||||||
#include "Core/EPlayerDeath.h"
|
#include "Core/EPlayerDeath.h"
|
||||||
#include "Network/EPlayerConnected.h"
|
#include "Network/EPlayerConnected.h"
|
||||||
#include "Network/EKillDeath.h"
|
#include "Network/EKillDeath.h"
|
||||||
|
#include "Core/EWin.h"
|
||||||
|
#include "Game/Events/EReset.h"
|
||||||
|
|
||||||
class Server : public Network
|
class Server : public Network
|
||||||
{
|
{
|
||||||
@@ -31,7 +34,7 @@ public:
|
|||||||
Server(World* world, EventBroker* eventBroker, int port);
|
Server(World* world, EventBroker* eventBroker, int port);
|
||||||
~Server();
|
~Server();
|
||||||
|
|
||||||
void Update() override;
|
void Update(double dt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Network channels
|
// Network channels
|
||||||
@@ -41,6 +44,7 @@ private:
|
|||||||
// dont forget to set these in the childrens receive logic
|
// dont forget to set these in the childrens receive logic
|
||||||
boost::asio::ip::address m_Address;
|
boost::asio::ip::address m_Address;
|
||||||
int m_Port = 27666;
|
int m_Port = 27666;
|
||||||
|
bool m_GameIsOver = false;
|
||||||
// Sending messages to client logic
|
// Sending messages to client logic
|
||||||
std::map<PlayerID, PlayerDefinition> m_ConnectedPlayers;
|
std::map<PlayerID, PlayerDefinition> m_ConnectedPlayers;
|
||||||
std::vector<PlayerID> m_PlayersToDisconnect;
|
std::vector<PlayerID> m_PlayersToDisconnect;
|
||||||
@@ -48,14 +52,14 @@ private:
|
|||||||
char readBuffer[BUFFERSIZE] = { 0 };
|
char readBuffer[BUFFERSIZE] = { 0 };
|
||||||
size_t bytesRead = 0;
|
size_t bytesRead = 0;
|
||||||
// time for previouse message
|
// time for previouse message
|
||||||
std::clock_t previousePingMessage = std::clock();
|
double previousPingMessage = 0;
|
||||||
std::clock_t previousSnapshotMessage = std::clock();
|
double previousSnapshotMessage = 0;
|
||||||
std::clock_t timOutTimer = std::clock();
|
double timeOutTimer = 0;
|
||||||
|
|
||||||
// How often we send messages (milliseconds)
|
// How often we send messages (seconds)
|
||||||
float pingIntervalMs;
|
double pingInterval = 1;
|
||||||
float snapshotInterval;
|
double snapshotInterval = 0.05;
|
||||||
int checkTimeOutInterval = 100;
|
double checkTimeOutInterval = 0.1;
|
||||||
int m_NextPlayerID = 0;
|
int m_NextPlayerID = 0;
|
||||||
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
std::vector<Events::InputCommand> m_InputCommandsToBroadcast;
|
||||||
//Timers
|
//Timers
|
||||||
@@ -71,6 +75,7 @@ private:
|
|||||||
void reliableBroadcast(Packet& packet);
|
void reliableBroadcast(Packet& packet);
|
||||||
void unreliableBroadcast(Packet& packet);
|
void unreliableBroadcast(Packet& packet);
|
||||||
void sendSnapshot();
|
void sendSnapshot();
|
||||||
|
void createWorldSnapshot(Packet& packet);
|
||||||
void addPlayersToPacket(Packet& packet, EntityID entityID);
|
void addPlayersToPacket(Packet& packet, EntityID entityID);
|
||||||
void addChildrenToPacket(Packet& packet, EntityID entityID);
|
void addChildrenToPacket(Packet& packet, EntityID entityID);
|
||||||
void addInputCommandsToPacket(Packet& packet);
|
void addInputCommandsToPacket(Packet& packet);
|
||||||
@@ -83,6 +88,7 @@ private:
|
|||||||
void kick(PlayerID player);
|
void kick(PlayerID player);
|
||||||
PlayerID getPlayerIDFromEndpoint();
|
PlayerID getPlayerIDFromEndpoint();
|
||||||
PlayerID getPlayerIDFromEntityID(EntityID entityID);
|
PlayerID getPlayerIDFromEntityID(EntityID entityID);
|
||||||
|
void resetMap();
|
||||||
void parsePlayerTransform(Packet& packet);
|
void parsePlayerTransform(Packet& packet);
|
||||||
void parseOnInputCommand(Packet& packet);
|
void parseOnInputCommand(Packet& packet);
|
||||||
void parseClientPing();
|
void parseClientPing();
|
||||||
@@ -110,6 +116,8 @@ private:
|
|||||||
bool OnAmmoPickup(const Events::AmmoPickup& e);
|
bool OnAmmoPickup(const Events::AmmoPickup& e);
|
||||||
EventRelay<Server, Events::PlayerDeath> m_EPlayerDeath;
|
EventRelay<Server, Events::PlayerDeath> m_EPlayerDeath;
|
||||||
bool OnPlayerDeath(const Events::PlayerDeath& e);
|
bool OnPlayerDeath(const Events::PlayerDeath& e);
|
||||||
|
EventRelay<Server, Events::Win> m_EWin;
|
||||||
|
bool OnWin(const Events::Win& e);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -30,6 +30,7 @@
|
|||||||
#include "../Engine/Core/EPause.h"
|
#include "../Engine/Core/EPause.h"
|
||||||
#include "../Engine/Core/EComponentAttached.h"
|
#include "../Engine/Core/EComponentAttached.h"
|
||||||
#include "../Core/EPlayerSpawned.h"
|
#include "../Core/EPlayerSpawned.h"
|
||||||
|
#include "../Rendering/ESetCamera.h"
|
||||||
|
|
||||||
|
|
||||||
typedef std::pair<ALuint, std::vector<ALuint>> QueuedBuffers;
|
typedef std::pair<ALuint, std::vector<ALuint>> QueuedBuffers;
|
||||||
@@ -91,7 +92,6 @@ private:
|
|||||||
void matchBGMLoop();
|
void matchBGMLoop();
|
||||||
Source* m_CurrentBGM = nullptr;
|
Source* m_CurrentBGM = nullptr;
|
||||||
Source* m_CurrentBGMCombo = nullptr;
|
Source* m_CurrentBGMCombo = nullptr;
|
||||||
bool m_DrumLoopHasBeenStarted = false;
|
|
||||||
|
|
||||||
// Logic
|
// Logic
|
||||||
World* m_World = nullptr;
|
World* m_World = nullptr;
|
||||||
@@ -139,6 +139,8 @@ private:
|
|||||||
bool OnPlayQueueOnEntity(const Events::PlayQueueOnEntity &e);
|
bool OnPlayQueueOnEntity(const Events::PlayQueueOnEntity &e);
|
||||||
EventRelay<SoundManager, Events::ChangeBGM> m_EChangeBGM;
|
EventRelay<SoundManager, Events::ChangeBGM> m_EChangeBGM;
|
||||||
bool OnChangeBGM(const Events::ChangeBGM &e);
|
bool OnChangeBGM(const Events::ChangeBGM &e);
|
||||||
|
EventRelay<SoundManager, Events::SetCamera> m_ESetCamera;
|
||||||
|
bool OnSetCamera(const Events::SetCamera& e);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
#ifndef Events_Reset_h__
|
||||||
|
#define Events_Reset_h__
|
||||||
|
|
||||||
|
#include "Core/EventBroker.h"
|
||||||
|
#include "Core/EntityWrapper.h"
|
||||||
|
|
||||||
|
namespace Events
|
||||||
|
{
|
||||||
|
|
||||||
|
struct Reset : Event
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "Engine/Collision/ETrigger.h"
|
#include "Engine/Collision/ETrigger.h"
|
||||||
#include "Core/ECaptured.h"
|
#include "Core/ECaptured.h"
|
||||||
#include "Core/EWin.h"
|
#include "Core/EWin.h"
|
||||||
|
#include "Game/Events/EReset.h"
|
||||||
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
@@ -23,6 +24,7 @@ public:
|
|||||||
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override;
|
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& capturePoint, double dt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void Init();
|
||||||
//methods which will take care of specific events
|
//methods which will take care of specific events
|
||||||
EventRelay<CapturePointSystem, Events::TriggerTouch> m_ETriggerTouch;
|
EventRelay<CapturePointSystem, Events::TriggerTouch> m_ETriggerTouch;
|
||||||
bool CapturePointSystem::OnTriggerTouch(const Events::TriggerTouch& e);
|
bool CapturePointSystem::OnTriggerTouch(const Events::TriggerTouch& e);
|
||||||
@@ -30,6 +32,8 @@ private:
|
|||||||
bool CapturePointSystem::OnTriggerLeave(const Events::TriggerLeave& e);
|
bool CapturePointSystem::OnTriggerLeave(const Events::TriggerLeave& e);
|
||||||
EventRelay<CapturePointSystem, Events::Captured> m_ECaptured;
|
EventRelay<CapturePointSystem, Events::Captured> m_ECaptured;
|
||||||
bool CapturePointSystem::OnCaptured(const Events::Captured& e);
|
bool CapturePointSystem::OnCaptured(const Events::Captured& e);
|
||||||
|
EventRelay<CapturePointSystem, Events::Reset> m_EReset;
|
||||||
|
bool CapturePointSystem::OnReset(const Events::Reset& e);
|
||||||
void ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner);
|
void ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner);
|
||||||
|
|
||||||
bool m_WinnerWasFound = false;
|
bool m_WinnerWasFound = false;
|
||||||
|
|||||||
@@ -8,6 +8,8 @@
|
|||||||
#include "Core/EPlayerSpawned.h"
|
#include "Core/EPlayerSpawned.h"
|
||||||
#include "Network/EPlayerConnected.h"
|
#include "Network/EPlayerConnected.h"
|
||||||
#include "Network/EPlayerDisconnected.h"
|
#include "Network/EPlayerDisconnected.h"
|
||||||
|
#include "Game/Events/EReset.h"
|
||||||
|
#include "Engine/Input/EInputCommand.h"
|
||||||
#include "GLM.h"
|
#include "GLM.h"
|
||||||
|
|
||||||
class ScoreScreenSystem : public PureSystem
|
class ScoreScreenSystem : public PureSystem
|
||||||
@@ -25,6 +27,10 @@ public:
|
|||||||
bool OnPlayerConnected(const Events::PlayerConnected& e);
|
bool OnPlayerConnected(const Events::PlayerConnected& e);
|
||||||
EventRelay<ScoreScreenSystem, Events::PlayerDisconnected> m_EPlayerDisconnected;
|
EventRelay<ScoreScreenSystem, Events::PlayerDisconnected> m_EPlayerDisconnected;
|
||||||
bool OnPlayerDisconnected(const Events::PlayerDisconnected& e);
|
bool OnPlayerDisconnected(const Events::PlayerDisconnected& e);
|
||||||
|
EventRelay<ScoreScreenSystem, Events::Reset> m_EReset;
|
||||||
|
bool OnReset(const Events::Reset& e);
|
||||||
|
EventRelay<ScoreScreenSystem, Events::InputCommand> m_EInputCommand;
|
||||||
|
bool OnInputCommand(const Events::InputCommand& e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PlayerData {
|
struct PlayerData {
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "Input/EInputCommand.h"
|
#include "Input/EInputCommand.h"
|
||||||
#include "Network/EPlayerDisconnected.h"
|
#include "Network/EPlayerDisconnected.h"
|
||||||
|
#include "Game/Events/EReset.h"
|
||||||
|
|
||||||
class SpectatorCameraSystem : public ImpureSystem
|
class SpectatorCameraSystem : public ImpureSystem
|
||||||
{
|
{
|
||||||
@@ -15,11 +16,14 @@ public:
|
|||||||
private:
|
private:
|
||||||
int m_PickedTeam;
|
int m_PickedTeam;
|
||||||
bool m_CamSetToTeamPick;
|
bool m_CamSetToTeamPick;
|
||||||
|
void reset();
|
||||||
|
|
||||||
EventRelay<SpectatorCameraSystem, Events::InputCommand> m_EInputCommand;
|
EventRelay<SpectatorCameraSystem, Events::InputCommand> m_EInputCommand;
|
||||||
bool OnInputCommand(const Events::InputCommand& e);
|
bool OnInputCommand(const Events::InputCommand& e);
|
||||||
EventRelay<SpectatorCameraSystem, Events::PlayerDisconnected> m_EDisconnect;
|
EventRelay<SpectatorCameraSystem, Events::PlayerDisconnected> m_EDisconnect;
|
||||||
bool OnDisconnect(const Events::PlayerDisconnected& e);
|
bool OnDisconnect(const Events::PlayerDisconnected& e);
|
||||||
|
EventRelay<SpectatorCameraSystem, Events::Reset> m_EReset;
|
||||||
|
bool OnReset(const Events::Reset& e);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -2,4 +2,5 @@
|
|||||||
<CapturePointGameMode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePointGameMode.xsd">
|
<CapturePointGameMode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="CapturePointGameMode.xsd">
|
||||||
<RespawnTime>0.0</RespawnTime>
|
<RespawnTime>0.0</RespawnTime>
|
||||||
<MaxRespawnTime>8.0</MaxRespawnTime>
|
<MaxRespawnTime>8.0</MaxRespawnTime>
|
||||||
|
<ResetCountdown>10.0</ResetCountdown>
|
||||||
</CapturePointGameMode>
|
</CapturePointGameMode>
|
||||||
@@ -12,6 +12,9 @@
|
|||||||
<xs:element name="MaxRespawnTime" type="t:double" minOccurs="0">
|
<xs:element name="MaxRespawnTime" type="t:double" minOccurs="0">
|
||||||
<xs:annotation><xs:documentation>Players will be spawned when RespawnTime reaches this.</xs:documentation></xs:annotation>
|
<xs:annotation><xs:documentation>Players will be spawned when RespawnTime reaches this.</xs:documentation></xs:annotation>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
<xs:element name="ResetCountdown" type="t:double" minOccurs="0">
|
||||||
|
<xs:annotation><xs:documentation>The map will be reset when time reaches 0.</xs:documentation></xs:annotation>
|
||||||
|
</xs:element>
|
||||||
</xs:all>
|
</xs:all>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
</xs:element>
|
</xs:element>
|
||||||
|
|||||||
+12290
-10224
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="BlueCapturepointBorde" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.271661639" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="Bottom">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>3</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.392156869" B="10" G="0.784313738" R="0"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.5" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="LowerMid">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>2</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.0866025388" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.313725501" B="10" G="0.784313738" R="0"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.899999976" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="UpperMid">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>1</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.0866025463" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.196078435" B="10" G="0.784313738" R="0"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.29999995" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Top">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.117647059" B="10" G="0.784313738" R="0"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.70000005" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="RedCapturepointBorde" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.271661639" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="Bottom">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>3</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.392156869" B="0" G="0.235294119" R="21.9607849"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.5" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="LowerMid">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>2</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.0866025388" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.313725501" B="0" G="0.235294119" R="21.9607849"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.899999976" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="UpperMid">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>1</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.0866025463" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.196078435" B="0" G="0.235294119" R="21.9607849"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.29999995" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Top">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.117647059" B="0" G="0.235294119" R="21.9607849"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.70000005" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
|
||||||
|
<Entity name="SpectatorCapturepointBorde" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
|
||||||
|
|
||||||
|
<Components>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.271661639" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
|
||||||
|
<Children>
|
||||||
|
<Entity name="Bottom">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>3</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="-0" Y="-8.74227801e-09" Z="-0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.392156869" B="8.03921604" G="8.03921604" R="8.03921604"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.5" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="LowerMid">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>2</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.0866025388" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.313725501" B="10" G="8.03921604" R="8.03921604"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.899999976" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="UpperMid">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Time>1</Time>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="0.0866025463" Z="0"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.196078435" B="8.03921604" G="8.03921604" R="8.03921604"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.29999995" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
<Entity name="Top">
|
||||||
|
<Components>
|
||||||
|
<c:FloatingEffect>
|
||||||
|
<Period>6</Period>
|
||||||
|
<Axis X="0" Y="1" Z="0"/>
|
||||||
|
<Amplitude>0.10000000149011612</Amplitude>
|
||||||
|
</c:FloatingEffect>
|
||||||
|
<c:Transform/>
|
||||||
|
</Components>
|
||||||
|
<Children>
|
||||||
|
<Entity>
|
||||||
|
<Components>
|
||||||
|
<c:Model>
|
||||||
|
<Resource>Models/Props/CapturePoint/DoubleSidedCylinder.mesh</Resource>
|
||||||
|
<Color A="0.117647059" B="8.03921604" G="8.03921604" R="8.03921604"/>
|
||||||
|
<Transparent>true</Transparent>
|
||||||
|
</c:Model>
|
||||||
|
<c:Transform>
|
||||||
|
<Position X="0" Y="1.70000005" Z="0"/>
|
||||||
|
<Scale X="8.19999981" Y="0.0199999996" Z="8.19999981"/>
|
||||||
|
</c:Transform>
|
||||||
|
</Components>
|
||||||
|
<Children/>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
</Entity>
|
||||||
|
</Children>
|
||||||
|
|
||||||
|
</Entity>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,162 +0,0 @@
|
|||||||
#include "Core/TransformSystem.h"
|
|
||||||
|
|
||||||
std::unordered_map<EntityWrapper, glm::vec3> TransformSystem::PositionCache;
|
|
||||||
std::unordered_map<EntityWrapper, glm::quat> TransformSystem::OrientationCache;
|
|
||||||
std::unordered_map<EntityWrapper, glm::vec3> TransformSystem::ScaleCache;
|
|
||||||
std::unordered_map<EntityWrapper, glm::mat4> TransformSystem::MatrixCache;
|
|
||||||
|
|
||||||
int TransformSystem::RecalculatedPositions = 0;
|
|
||||||
int TransformSystem::RecalculatedOrientations = 0;
|
|
||||||
int TransformSystem::RecalculatedScales = 0;
|
|
||||||
|
|
||||||
TransformSystem::TransformSystem(SystemParams params)
|
|
||||||
: System(params)
|
|
||||||
{
|
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &TransformSystem::OnEntityDeleted);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TransformSystem::OnEntityDeleted(const Events::EntityDeleted& e)
|
|
||||||
{
|
|
||||||
// Clean up deleted entity
|
|
||||||
PositionCache.erase(e.DeletedEntity);
|
|
||||||
OrientationCache.erase(e.DeletedEntity);
|
|
||||||
ScaleCache.erase(e.DeletedEntity);
|
|
||||||
MatrixCache.erase(e.DeletedEntity);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//glm::mat4 Transform::AbsoluteTransformation(EntityWrapper entity)
|
|
||||||
//{
|
|
||||||
// glm::mat4 t = glm::mat4(1.f);
|
|
||||||
//
|
|
||||||
// while (entity.Valid()) {
|
|
||||||
// t = glm::translate((const glm::vec3&)entity["Transform"]["Position"]) * glm::toMat4(glm::quat((const glm::vec3&)entity["Transform"]["Orientation"])) * glm::scale((const glm::vec3&)entity["Transform"]["Scale"]) * t;
|
|
||||||
// entity = entity.Parent();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// return t;
|
|
||||||
//}
|
|
||||||
|
|
||||||
glm::vec3 TransformSystem::AbsolutePosition(World* world, EntityID entity)
|
|
||||||
{
|
|
||||||
return TransformSystem::AbsolutePosition(EntityWrapper(world, entity));
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3 TransformSystem::AbsolutePosition(EntityWrapper entity)
|
|
||||||
{
|
|
||||||
if (!entity.Valid()) {
|
|
||||||
return glm::vec3();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto cacheIt = PositionCache.find(entity);
|
|
||||||
ComponentWrapper cTransform = entity["Transform"];
|
|
||||||
ComponentWrapper::SubscriptProxy cTransformPosition = cTransform["Position"];
|
|
||||||
if (cacheIt != PositionCache.end() && !cTransformPosition.Dirty(DirtySetType::Transform)) {
|
|
||||||
return cacheIt->second;
|
|
||||||
} else {
|
|
||||||
EntityWrapper parent = entity.Parent();
|
|
||||||
// Calculate position
|
|
||||||
glm::vec3 position = AbsolutePosition(parent) + TransformSystem::AbsoluteOrientation(parent) * (TransformSystem::AbsoluteScale(parent) * (const glm::vec3&)cTransformPosition);
|
|
||||||
// Cache it
|
|
||||||
PositionCache[entity] = position;
|
|
||||||
RecalculatedPositions++;
|
|
||||||
// Unset dirty flag
|
|
||||||
cTransformPosition.SetDirty(DirtySetType::Transform, false);
|
|
||||||
return position;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3 TransformSystem::AbsoluteOrientationEuler(EntityWrapper entity)
|
|
||||||
{
|
|
||||||
glm::vec3 orientation;
|
|
||||||
|
|
||||||
while (entity.Valid()) {
|
|
||||||
ComponentWrapper transform = entity["Transform"];
|
|
||||||
orientation += (Field<glm::vec3>)transform["Orientation"];
|
|
||||||
entity = entity.Parent();
|
|
||||||
}
|
|
||||||
|
|
||||||
return orientation;
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::quat TransformSystem::AbsoluteOrientation(World* world, EntityID entity)
|
|
||||||
{
|
|
||||||
return TransformSystem::AbsoluteOrientation(EntityWrapper(world, entity));
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::quat TransformSystem::AbsoluteOrientation(EntityWrapper entity)
|
|
||||||
{
|
|
||||||
if (!entity.Valid()) {
|
|
||||||
return glm::quat();
|
|
||||||
}
|
|
||||||
|
|
||||||
auto cacheIt = OrientationCache.find(entity);
|
|
||||||
ComponentWrapper cTransform = entity["Transform"];
|
|
||||||
ComponentWrapper::SubscriptProxy cTransformOrientation = cTransform["Orientation"];
|
|
||||||
if (cacheIt != OrientationCache.end() && !cTransformOrientation.Dirty(DirtySetType::Transform)) {
|
|
||||||
return cacheIt->second;
|
|
||||||
} else {
|
|
||||||
EntityWrapper parent = entity.Parent();
|
|
||||||
// Calculate orientation
|
|
||||||
glm::quat orientation = AbsoluteOrientation(parent) * glm::quat((const glm::vec3&)cTransformOrientation);
|
|
||||||
// Cache it
|
|
||||||
OrientationCache[entity] = orientation;
|
|
||||||
RecalculatedOrientations++;
|
|
||||||
// Unset dirty flag
|
|
||||||
cTransformOrientation.SetDirty(DirtySetType::Transform, false);
|
|
||||||
return orientation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3 TransformSystem::AbsoluteScale(World* world, EntityID entity)
|
|
||||||
{
|
|
||||||
return TransformSystem::AbsoluteScale(EntityWrapper(world, entity));
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3 TransformSystem::AbsoluteScale(EntityWrapper entity)
|
|
||||||
{
|
|
||||||
if (!entity.Valid()) {
|
|
||||||
return glm::vec3(1.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
auto cacheIt = ScaleCache.find(entity);
|
|
||||||
ComponentWrapper cTransform = entity["Transform"];
|
|
||||||
ComponentWrapper::SubscriptProxy cTransformScale = cTransform["Scale"];
|
|
||||||
if (cacheIt != ScaleCache.end() && !cTransformScale.Dirty(DirtySetType::Transform)) {
|
|
||||||
return cacheIt->second;
|
|
||||||
} else {
|
|
||||||
EntityWrapper parent = entity.Parent();
|
|
||||||
// Calculate scale
|
|
||||||
glm::vec3 scale = AbsoluteScale(parent) * (const glm::vec3&)cTransformScale;
|
|
||||||
// Cache it
|
|
||||||
ScaleCache[entity] = scale;
|
|
||||||
RecalculatedPositions++;
|
|
||||||
// Unset dirty flag
|
|
||||||
cTransformScale.SetDirty(DirtySetType::Transform, false);
|
|
||||||
return scale;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::mat4 TransformSystem::ModelMatrix(EntityID entityID, World* world)
|
|
||||||
{
|
|
||||||
return ModelMatrix(EntityWrapper(world, entityID));
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::mat4 TransformSystem::ModelMatrix(EntityWrapper entity)
|
|
||||||
{
|
|
||||||
auto cacheIt = MatrixCache.find(entity);
|
|
||||||
ComponentWrapper cTransform = entity["Transform"];
|
|
||||||
bool isDirty = cTransform["Position"].Dirty(DirtySetType::Transform) || cTransform["Orientation"].Dirty(DirtySetType::Transform) || cTransform["Scale"].Dirty(DirtySetType::Transform);
|
|
||||||
if (cacheIt != MatrixCache.end() && !isDirty) {
|
|
||||||
return cacheIt->second;
|
|
||||||
} else {
|
|
||||||
glm::mat4 matrix = glm::translate(AbsolutePosition(entity)) * glm::toMat4(AbsoluteOrientation(entity)) * glm::scale(AbsoluteScale(entity));
|
|
||||||
MatrixCache[entity] = matrix;
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::vec3 TransformSystem::TransformPoint(const glm::vec3& point, const glm::mat4& matrix)
|
|
||||||
{
|
|
||||||
return glm::vec3(matrix * glm::vec4(point.x, point.y, point.z, 1));
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
#include "Network/Client.h"
|
#include "Network/Client.h"
|
||||||
#include "Network/EPlayerDisconnected.h"
|
|
||||||
using namespace boost::asio::ip;
|
using namespace boost::asio::ip;
|
||||||
|
|
||||||
Client::Client(World* world, EventBroker* eventBroker)
|
Client::Client(World* world, EventBroker* eventBroker)
|
||||||
@@ -12,7 +12,7 @@ Client::Client(World* world, EventBroker* eventBroker)
|
|||||||
|
|
||||||
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
m_PlayerName = config->Get<std::string>("Networking.Name", "Raptorcopter");
|
m_PlayerName = config->Get<std::string>("Networking.Name", "Raptorcopter");
|
||||||
m_SendInputIntervalMs = config->Get<int>("Networking.SendInputIntervalMs", 33);
|
m_SendInputInterval = config->Get<int>("Networking.SendInputIntervalMs", 33) / 1000.0;
|
||||||
LOG_INFO("Client initialized");
|
LOG_INFO("Client initialized");
|
||||||
|
|
||||||
m_ServerlistRequest.Connect(m_PlayerName, "192.168.1.255", 32554);
|
m_ServerlistRequest.Connect(m_PlayerName, "192.168.1.255", 32554);
|
||||||
@@ -48,7 +48,7 @@ void Client::Connect(std::string address, int port)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::Update()
|
void Client::Update(double dt)
|
||||||
{
|
{
|
||||||
m_EventBroker->Process<Client>();
|
m_EventBroker->Process<Client>();
|
||||||
while (m_Unreliable.IsSocketAvailable()) {
|
while (m_Unreliable.IsSocketAvailable()) {
|
||||||
@@ -85,7 +85,9 @@ void Client::Update()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_SearchingForServers) {
|
if (m_SearchingForServers) {
|
||||||
if (m_SearchingTime < (1000* (std::clock() - m_StartSearchTime) / (double)CLOCKS_PER_SEC)) {
|
m_TimeSearched += dt;
|
||||||
|
if (m_SearchingTime < m_TimeSearched) {
|
||||||
|
m_TimeSearched = 0;
|
||||||
m_SearchingForServers = false;
|
m_SearchingForServers = false;
|
||||||
//displayServerlist();
|
//displayServerlist();
|
||||||
Events::DisplayServerlist e;
|
Events::DisplayServerlist e;
|
||||||
@@ -96,16 +98,25 @@ void Client::Update()
|
|||||||
|
|
||||||
if (m_IsConnected) {
|
if (m_IsConnected) {
|
||||||
// Don't send 1 input in 1 packet, bunch em up.
|
// Don't send 1 input in 1 packet, bunch em up.
|
||||||
if (m_SendInputIntervalMs < (1000 * (std::clock() - m_TimeSinceSentInputs) / (double)CLOCKS_PER_SEC)) {
|
m_TimeSinceSentInputs += dt;
|
||||||
|
if (m_SendInputInterval < m_TimeSinceSentInputs) {
|
||||||
sendInputCommands();
|
sendInputCommands();
|
||||||
m_TimeSinceSentInputs = std::clock();
|
m_TimeSinceSentInputs = 0;
|
||||||
}
|
}
|
||||||
// HACK: Send absolute player positions for now to avoid desync until we have reliable messages
|
// HACK: Send absolute player positions for now to avoid desync until we have reliable messages
|
||||||
sendLocalPlayerTransform();
|
sendLocalPlayerTransform();
|
||||||
|
|
||||||
hasServerTimedOut();
|
hasServerTimedOut();
|
||||||
}
|
}
|
||||||
//Network::Update();
|
|
||||||
|
if (ImGui::BeginPopupModal("Disconnected", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
|
||||||
|
ImGui::Text("You have been disconnected from server.\n\n");
|
||||||
|
ImGui::SetCursorPosX(ImGui::GetContentRegionAvailWidth() - 120);
|
||||||
|
if (ImGui::Button("OK", ImVec2(120, 0))) {
|
||||||
|
ImGui::CloseCurrentPopup();
|
||||||
|
}
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parseMessageType(Packet& packet)
|
void Client::parseMessageType(Packet& packet)
|
||||||
@@ -159,6 +170,9 @@ void Client::parseMessageType(Packet& packet)
|
|||||||
case MessageType::AmmoPickup:
|
case MessageType::AmmoPickup:
|
||||||
parseAmmoPickup(packet);
|
parseAmmoPickup(packet);
|
||||||
break;
|
break;
|
||||||
|
case MessageType::RemoveWorld:
|
||||||
|
parseRemoveWorld(packet);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -190,7 +204,7 @@ void Client::parseTCPConnect(Packet& packet)
|
|||||||
packet.WritePrimitive(m_PlayerID);
|
packet.WritePrimitive(m_PlayerID);
|
||||||
m_Unreliable.Send(packet);
|
m_Unreliable.Send(packet);
|
||||||
|
|
||||||
// LOG_INFO("Sent UDP Connect Server");
|
// LOG_INFO("Sent UDP Connect Server");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::parsePlayerConnected(Packet & packet)
|
void Client::parsePlayerConnected(Packet & packet)
|
||||||
@@ -336,6 +350,13 @@ void Client::parseAmmoPickup(Packet & packet)
|
|||||||
m_EventBroker->Publish(e);
|
m_EventBroker->Publish(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Client::parseRemoveWorld(Packet & packet)
|
||||||
|
{
|
||||||
|
removeWorld();
|
||||||
|
Events::Reset e;
|
||||||
|
m_EventBroker->Publish(e);
|
||||||
|
}
|
||||||
|
|
||||||
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
|
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
|
||||||
{
|
{
|
||||||
for (auto field : componentInfo.FieldsInOrder) {
|
for (auto field : componentInfo.FieldsInOrder) {
|
||||||
@@ -583,7 +604,7 @@ bool Client::OnConnectRequest(const Events::ConnectRequest& e)
|
|||||||
bool Client::OnSearchForServers(const Events::SearchForServers& e)
|
bool Client::OnSearchForServers(const Events::SearchForServers& e)
|
||||||
{
|
{
|
||||||
m_SearchingForServers = true;
|
m_SearchingForServers = true;
|
||||||
m_StartSearchTime = std::clock();
|
m_TimeSearched = 0;
|
||||||
m_Serverlist.clear();
|
m_Serverlist.clear();
|
||||||
Packet packet(MessageType::ServerlistRequest);
|
Packet packet(MessageType::ServerlistRequest);
|
||||||
m_ServerlistRequest.Broadcast(packet, 13); // TODO: Config
|
m_ServerlistRequest.Broadcast(packet, 13); // TODO: Config
|
||||||
@@ -663,6 +684,7 @@ void Client::hasServerTimedOut()
|
|||||||
if (timeSincePing > m_TimeoutMs) {
|
if (timeSincePing > m_TimeoutMs) {
|
||||||
// Clear everything and go to menu.
|
// Clear everything and go to menu.
|
||||||
LOG_INFO("Server has timed out, returning to menu, Beep Boop.");
|
LOG_INFO("Server has timed out, returning to menu, Beep Boop.");
|
||||||
|
ImGui::OpenPopup("Disconnected");
|
||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -706,19 +728,6 @@ void Client::displayServerlist()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Client::removeWorld()
|
|
||||||
{
|
|
||||||
std::vector<EntityID> childrenToBeDeleted;
|
|
||||||
auto rootEntites = m_World->GetDirectChildren(EntityID_Invalid);
|
|
||||||
for (auto it = rootEntites.first; it != rootEntites.second; it++) {
|
|
||||||
childrenToBeDeleted.push_back(it->second);
|
|
||||||
}
|
|
||||||
for (int i = 0; i < childrenToBeDeleted.size(); ++i) {
|
|
||||||
m_World->DeleteEntity(childrenToBeDeleted[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Client::createMainMenu()
|
void Client::createMainMenu()
|
||||||
{
|
{
|
||||||
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/StartMenu.xml");
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/StartMenu.xml");
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Network::Network(World* world, EventBroker* eventBroker)
|
|||||||
m_TimeoutMs = config->Get<int>("Networking.TimeoutMs", 20000);
|
m_TimeoutMs = config->Get<int>("Networking.TimeoutMs", 20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Network::Update()
|
void Network::Update(double dt)
|
||||||
{
|
{
|
||||||
updateNetworkData();
|
updateNetworkData();
|
||||||
}
|
}
|
||||||
@@ -92,3 +92,15 @@ void Network::popNetworkSegmentOfHeader(Packet & packet)
|
|||||||
packet.ReadPrimitive<int>();
|
packet.ReadPrimitive<int>();
|
||||||
packet.ReadPrimitive<int>();
|
packet.ReadPrimitive<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Network::removeWorld()
|
||||||
|
{
|
||||||
|
std::vector<EntityID> childrenToBeDeleted;
|
||||||
|
auto rootEntites = m_World->GetDirectChildren(EntityID_Invalid);
|
||||||
|
for (auto it = rootEntites.first; it != rootEntites.second; it++) {
|
||||||
|
childrenToBeDeleted.push_back(it->second);
|
||||||
|
}
|
||||||
|
for (int i = 0; i < childrenToBeDeleted.size(); ++i) {
|
||||||
|
m_World->DeleteEntity(childrenToBeDeleted[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,8 +5,8 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
|
|||||||
, m_ServerlistRequest(13)
|
, m_ServerlistRequest(13)
|
||||||
{
|
{
|
||||||
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
|
||||||
snapshotInterval = 1000 * config->Get<float>("Networking.SnapshotInterval", 0.05f);
|
snapshotInterval = config->Get<float>("Networking.SnapshotInterval", 0.05);
|
||||||
pingIntervalMs = config->Get<float>("Networking.PingIntervalMs", 1000);
|
pingInterval = config->Get<float>("Networking.PingIntervalMs", 1000) / 1000.0;
|
||||||
m_ServerName = config->Get<std::string>("Networking.Name", "Unnamed");
|
m_ServerName = config->Get<std::string>("Networking.Name", "Unnamed");
|
||||||
|
|
||||||
// Subscribe to events
|
// Subscribe to events
|
||||||
@@ -17,6 +17,7 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &Server::OnAmmoPickup);
|
EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &Server::OnAmmoPickup);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &Server::OnPlayerDeath);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &Server::OnPlayerDeath);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EWin, &Server::OnWin);
|
||||||
// BindWW
|
// BindWW
|
||||||
if (port == 0) {
|
if (port == 0) {
|
||||||
port = config->Get<float>("Networking.Port", 27666);
|
port = config->Get<float>("Networking.Port", 27666);
|
||||||
@@ -30,7 +31,7 @@ Server::~Server()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Server::Update()
|
void Server::Update(double dt)
|
||||||
{
|
{
|
||||||
m_Reliable.AcceptNewConnections(m_NextPlayerID, m_ConnectedPlayers);
|
m_Reliable.AcceptNewConnections(m_NextPlayerID, m_ConnectedPlayers);
|
||||||
|
|
||||||
@@ -86,26 +87,44 @@ void Server::Update()
|
|||||||
}
|
}
|
||||||
m_PlayersToDisconnect.clear();
|
m_PlayersToDisconnect.clear();
|
||||||
|
|
||||||
std::clock_t currentTime = std::clock();
|
|
||||||
// Send snapshot
|
// Send snapshot
|
||||||
if (snapshotInterval < (1000 * (currentTime - previousSnapshotMessage) / (double)CLOCKS_PER_SEC)) {
|
previousSnapshotMessage += dt;
|
||||||
|
if (snapshotInterval < previousSnapshotMessage) {
|
||||||
sendSnapshot();
|
sendSnapshot();
|
||||||
previousSnapshotMessage = currentTime;
|
previousSnapshotMessage = 0;
|
||||||
}
|
}
|
||||||
// Send pings each
|
// Send pings each
|
||||||
if (pingIntervalMs < (1000 * (currentTime - previousePingMessage) / (double)CLOCKS_PER_SEC)) {
|
previousPingMessage += dt;
|
||||||
|
if (pingInterval < previousPingMessage) {
|
||||||
sendPing();
|
sendPing();
|
||||||
previousePingMessage = currentTime;
|
previousPingMessage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Time out logic
|
// Time out logic
|
||||||
if (checkTimeOutInterval < (1000 * (currentTime - timOutTimer) / (double)CLOCKS_PER_SEC)) {
|
timeOutTimer += dt;
|
||||||
|
if (checkTimeOutInterval < timeOutTimer) {
|
||||||
checkForTimeOuts();
|
checkForTimeOuts();
|
||||||
timOutTimer = currentTime;
|
timeOutTimer = 0;
|
||||||
}
|
}
|
||||||
m_EventBroker->Process<Server>();
|
m_EventBroker->Process<Server>();
|
||||||
if (isReadingData) {
|
if (isReadingData) {
|
||||||
Network::Update();
|
Network::Update(dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_GameIsOver) {
|
||||||
|
auto pool = m_World->GetComponents("CapturePointGameMode");
|
||||||
|
if (pool != nullptr && pool->size() > 0) {
|
||||||
|
// Take the first CapturePointGameMode component found.
|
||||||
|
ComponentWrapper& modeComponent = *pool->begin();
|
||||||
|
// Decrease timer.
|
||||||
|
Field<double> timer = modeComponent["ResetCountdown"];
|
||||||
|
timer -= dt;
|
||||||
|
if (timer < 0) {
|
||||||
|
resetMap();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resetMap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +183,7 @@ void Server::reliableBroadcast(Packet& packet)
|
|||||||
|
|
||||||
void Server::unreliableBroadcast(Packet& packet)
|
void Server::unreliableBroadcast(Packet& packet)
|
||||||
{
|
{
|
||||||
m_Unreliable.SendToConnectedPlayers(packet, m_ConnectedPlayers);
|
m_Unreliable.SendToConnectedPlayers(packet, m_ConnectedPlayers);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send snapshot fields
|
// Send snapshot fields
|
||||||
@@ -173,10 +192,16 @@ void Server::sendSnapshot()
|
|||||||
Packet packet(MessageType::Snapshot);
|
Packet packet(MessageType::Snapshot);
|
||||||
addInputCommandsToPacket(packet);
|
addInputCommandsToPacket(packet);
|
||||||
addPlayersToPacket(packet, EntityID_Invalid);
|
addPlayersToPacket(packet, EntityID_Invalid);
|
||||||
//addChildrenToPacket(packet, EntityID_Invalid);
|
|
||||||
unreliableBroadcast(packet);
|
unreliableBroadcast(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send snapshot fields
|
||||||
|
void Server::createWorldSnapshot(Packet& packet)
|
||||||
|
{
|
||||||
|
addInputCommandsToPacket(packet);
|
||||||
|
addChildrenToPacket(packet, EntityID_Invalid);
|
||||||
|
}
|
||||||
|
|
||||||
void Server::addInputCommandsToPacket(Packet& packet)
|
void Server::addInputCommandsToPacket(Packet& packet)
|
||||||
{
|
{
|
||||||
// Number of input commands
|
// Number of input commands
|
||||||
@@ -379,8 +404,7 @@ void Server::parseTCPConnect(Packet & packet)
|
|||||||
m_Reliable.Send(connnectPacket, m_ConnectedPlayers.at(playerID));
|
m_Reliable.Send(connnectPacket, m_ConnectedPlayers.at(playerID));
|
||||||
|
|
||||||
Packet firstSnapshot(MessageType::Snapshot);
|
Packet firstSnapshot(MessageType::Snapshot);
|
||||||
addInputCommandsToPacket(firstSnapshot);
|
createWorldSnapshot(firstSnapshot);
|
||||||
addChildrenToPacket(firstSnapshot, EntityID_Invalid);
|
|
||||||
m_Reliable.Send(firstSnapshot);
|
m_Reliable.Send(firstSnapshot);
|
||||||
|
|
||||||
// Send notification that a player has connected
|
// Send notification that a player has connected
|
||||||
@@ -542,6 +566,13 @@ bool Server::OnPlayerDeath(const Events::PlayerDeath& e)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Server::OnWin(const Events::Win & e)
|
||||||
|
{
|
||||||
|
// Postpone the gameover reset
|
||||||
|
m_GameIsOver = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void Server::parseClientPing()
|
void Server::parseClientPing()
|
||||||
{
|
{
|
||||||
LOG_INFO("%i: Parsing ping", m_PacketID);
|
LOG_INFO("%i: Parsing ping", m_PacketID);
|
||||||
@@ -663,4 +694,20 @@ PlayerID Server::getPlayerIDFromEntityID(EntityID entityID)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Server::resetMap()
|
||||||
|
{
|
||||||
|
m_GameIsOver = false;
|
||||||
|
Events::Reset reset;
|
||||||
|
m_EventBroker->Publish(reset);
|
||||||
|
Packet removeMap(MessageType::RemoveWorld);
|
||||||
|
reliableBroadcast(removeMap);
|
||||||
|
removeWorld();
|
||||||
|
// Hardcoded for now.
|
||||||
|
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/CP_Rocky2.xml");
|
||||||
|
entityFile->MergeInto(m_World);
|
||||||
|
Packet newWorld(MessageType::Snapshot);
|
||||||
|
createWorldSnapshot(newWorld);
|
||||||
|
reliableBroadcast(newWorld);
|
||||||
}
|
}
|
||||||
@@ -362,6 +362,11 @@ void RenderSystem::fillPointLights(std::list<std::shared_ptr<RenderJob>>& jobs,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EntityWrapper entity(world, pointlightC.EntityID);
|
||||||
|
if (!isEntityVisible(entity)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<PointLightJob> pointLightJob = std::shared_ptr<PointLightJob>(new PointLightJob(transformC, pointlightC, m_World));
|
std::shared_ptr<PointLightJob> pointLightJob = std::shared_ptr<PointLightJob>(new PointLightJob(transformC, pointlightC, m_World));
|
||||||
jobs.push_back(pointLightJob);
|
jobs.push_back(pointLightJob);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -67,10 +67,19 @@ void Renderer::InitializeWindow()
|
|||||||
// Create a window
|
// Create a window
|
||||||
GLFWmonitor* monitor = nullptr;
|
GLFWmonitor* monitor = nullptr;
|
||||||
if (m_Fullscreen) {
|
if (m_Fullscreen) {
|
||||||
monitor = glfwGetPrimaryMonitor();
|
//monitor = glfwGetPrimaryMonitor();
|
||||||
|
//const GLFWvidmode* mode = glfwGetVideoMode(monitor);
|
||||||
|
|
||||||
|
//glfwWindowHint(GLFW_RED_BITS, mode->redBits);
|
||||||
|
//glfwWindowHint(GLFW_GREEN_BITS, mode->greenBits);
|
||||||
|
//glfwWindowHint(GLFW_BLUE_BITS, mode->blueBits);
|
||||||
|
//glfwWindowHint(GLFW_REFRESH_RATE, mode->refreshRate);
|
||||||
|
glfwWindowHint(GLFW_DECORATED, false);
|
||||||
|
glfwWindowHint(GLFW_AUTO_ICONIFY, false);
|
||||||
}
|
}
|
||||||
//glfwWindowHint(GLFW_SAMPLES, 8);
|
|
||||||
m_Window = glfwCreateWindow(m_Resolution.Width, m_Resolution.Height, "daydream", monitor, nullptr);
|
//glfwWindowHint(GLFW_SAMPLES, 8);
|
||||||
|
m_Window = glfwCreateWindow(m_Resolution.Width, m_Resolution.Height + 1, "daydream", monitor, nullptr);
|
||||||
if (!m_Window) {
|
if (!m_Window) {
|
||||||
LOG_ERROR("GLFW: Failed to create window");
|
LOG_ERROR("GLFW: Failed to create window");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
|
|||||||
@@ -30,10 +30,7 @@ SoundManager::SoundManager(World* world, EventBroker* eventBroker)
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundManager::OnPlayerSpawned);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &SoundManager::OnPlayerSpawned);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayQueueOnEntity, &SoundManager::OnPlayQueueOnEntity);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayQueueOnEntity, &SoundManager::OnPlayQueueOnEntity);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EChangeBGM, &SoundManager::OnChangeBGM);
|
EVENT_SUBSCRIBE_MEMBER(m_EChangeBGM, &SoundManager::OnChangeBGM);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &SoundManager::OnSetCamera);
|
||||||
Events::ChangeBGM e;
|
|
||||||
e.FilePath = "Audio/bgm/MenuMusic.wav";
|
|
||||||
m_EventBroker->Publish(e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SoundManager::~SoundManager()
|
SoundManager::~SoundManager()
|
||||||
@@ -67,8 +64,7 @@ void SoundManager::Update(double dt)
|
|||||||
deleteInactiveEmitters();
|
deleteInactiveEmitters();
|
||||||
updateEmitters(dt);
|
updateEmitters(dt);
|
||||||
updateListener(dt);
|
updateListener(dt);
|
||||||
if (m_DrumLoopHasBeenStarted)
|
matchBGMLoop();
|
||||||
matchBGMLoop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundManager::deleteInactiveEmitters()
|
void SoundManager::deleteInactiveEmitters()
|
||||||
@@ -363,15 +359,6 @@ bool SoundManager::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
|||||||
{
|
{
|
||||||
if (e.PlayerID == -1) { // Local player
|
if (e.PlayerID == -1) { // Local player
|
||||||
m_LocalPlayer = e.Player;
|
m_LocalPlayer = e.Player;
|
||||||
if (m_DrumLoopHasBeenStarted) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
m_CurrentBGMCombo = createSource("Audio/BGM/Layer2.wav");
|
|
||||||
m_CurrentBGMCombo->Type = SoundType::BGM;
|
|
||||||
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
|
|
||||||
setGain(m_CurrentBGMCombo, 0);
|
|
||||||
playSound(m_CurrentBGMCombo);
|
|
||||||
m_DrumLoopHasBeenStarted = true;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -394,7 +381,9 @@ bool SoundManager::OnPlayQueueOnEntity(const Events::PlayQueueOnEntity &e)
|
|||||||
bool SoundManager::OnChangeBGM(const Events::ChangeBGM &e)
|
bool SoundManager::OnChangeBGM(const Events::ChangeBGM &e)
|
||||||
{
|
{
|
||||||
if (m_CurrentBGM != nullptr) {
|
if (m_CurrentBGM != nullptr) {
|
||||||
stopSound(m_CurrentBGM);
|
if (getSourceState(m_CurrentBGM->ALsource) == AL_PLAYING) {
|
||||||
|
stopSound(m_CurrentBGM);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_CurrentBGM = createSource(e.FilePath);
|
m_CurrentBGM = createSource(e.FilePath);
|
||||||
m_CurrentBGM->Type = SoundType::BGM;
|
m_CurrentBGM->Type = SoundType::BGM;
|
||||||
@@ -403,6 +392,34 @@ bool SoundManager::OnChangeBGM(const Events::ChangeBGM &e)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SoundManager::OnSetCamera(const Events::SetCamera& e)
|
||||||
|
{
|
||||||
|
if (e.CameraEntity.Name() == "Overview_Camera_Start_Menu") {
|
||||||
|
if (m_CurrentBGMCombo != nullptr) {
|
||||||
|
if (getSourceState(m_CurrentBGMCombo->ALsource) == AL_PLAYING) {
|
||||||
|
stopSound(m_CurrentBGMCombo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Events::ChangeBGM changeBGM;
|
||||||
|
changeBGM.FilePath = "Audio/BGM/MenuMusic.wav";
|
||||||
|
m_EventBroker->Publish(changeBGM);
|
||||||
|
} else if (e.CameraEntity.Name() == "PickTeamCamera") {
|
||||||
|
Events::ChangeBGM changeBGM;
|
||||||
|
changeBGM.FilePath = "Audio/BGM/Layer1.wav";
|
||||||
|
m_EventBroker->Publish(changeBGM);
|
||||||
|
if (m_CurrentBGMCombo != nullptr) {
|
||||||
|
if (getSourceState(m_CurrentBGMCombo->ALsource) == AL_PLAYING) {
|
||||||
|
stopSound(m_CurrentBGMCombo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_CurrentBGMCombo = createSource("Audio/BGM/Layer2.wav");
|
||||||
|
m_CurrentBGMCombo->Type = SoundType::BGM;
|
||||||
|
alSourcei(m_CurrentBGMCombo->ALsource, AL_LOOPING, 1);
|
||||||
|
setGain(m_CurrentBGMCombo, 0);
|
||||||
|
playSound(m_CurrentBGMCombo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ALenum SoundManager::getSourceState(ALuint source)
|
ALenum SoundManager::getSourceState(ALuint source)
|
||||||
{
|
{
|
||||||
ALenum state;
|
ALenum state;
|
||||||
@@ -419,14 +436,14 @@ void SoundManager::setSoundProperties(Source* source, ComponentWrapper* soundCom
|
|||||||
{
|
{
|
||||||
float gain;
|
float gain;
|
||||||
switch (source->Type) {
|
switch (source->Type) {
|
||||||
case SoundType::SFX:
|
case SoundType::SFX:
|
||||||
gain = m_SFXVolumeChannel;
|
gain = m_SFXVolumeChannel;
|
||||||
break;
|
break;
|
||||||
case SoundType::BGM:
|
case SoundType::BGM:
|
||||||
gain = m_BGMVolumeChannel;
|
gain = m_BGMVolumeChannel;
|
||||||
break;
|
break;
|
||||||
case SoundType::Announcer:
|
case SoundType::Announcer:
|
||||||
gain = m_AnnouncerVolumeChannel;
|
gain = m_AnnouncerVolumeChannel;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
gain = 1.f;
|
gain = 1.f;
|
||||||
|
|||||||
+2
-2
@@ -232,10 +232,10 @@ void Game::Tick()
|
|||||||
PerformanceTimer::StartTimerAndStopPrevious("Network");
|
PerformanceTimer::StartTimerAndStopPrevious("Network");
|
||||||
m_EventBroker->Process<MultiplayerSnapshotFilter>();
|
m_EventBroker->Process<MultiplayerSnapshotFilter>();
|
||||||
if (m_NetworkClient != nullptr) {
|
if (m_NetworkClient != nullptr) {
|
||||||
m_NetworkClient->Update();
|
m_NetworkClient->Update(dt);
|
||||||
}
|
}
|
||||||
if (m_NetworkServer != nullptr) {
|
if (m_NetworkServer != nullptr) {
|
||||||
m_NetworkServer->Update();
|
m_NetworkServer->Update(dt);
|
||||||
}
|
}
|
||||||
//m_SoundManager->Update(dt);
|
//m_SoundManager->Update(dt);
|
||||||
|
|
||||||
|
|||||||
@@ -10,8 +10,26 @@ CapturePointSystem::CapturePointSystem(SystemParams params)
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
|
EVENT_SUBSCRIBE_MEMBER(m_ETriggerTouch, &CapturePointSystem::OnTriggerTouch);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
|
EVENT_SUBSCRIBE_MEMBER(m_ETriggerLeave, &CapturePointSystem::OnTriggerLeave);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured);
|
EVENT_SUBSCRIBE_MEMBER(m_ECaptured, &CapturePointSystem::OnCaptured);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EReset, &CapturePointSystem::OnReset);
|
||||||
|
Init();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CapturePointSystem::Init()
|
||||||
|
{
|
||||||
|
m_WinnerWasFound = false;
|
||||||
|
//need to track these variables for the captureSystem to work as per design!
|
||||||
|
m_RedTeamNextPossibleCapturePoint = m_NotACapturePoint;
|
||||||
|
m_BlueTeamNextPossibleCapturePoint = m_NotACapturePoint;
|
||||||
|
m_RedTeamHomeCapturePoint = m_NotACapturePoint;
|
||||||
|
m_BlueTeamHomeCapturePoint = m_NotACapturePoint;
|
||||||
|
m_NumberOfCapturePoints = 0;
|
||||||
|
m_ResetTimers = false;
|
||||||
|
m_RecentlyCapturedNeedNextCapturePointNow = false;
|
||||||
|
m_CapturePointNumberToEntityMap.clear();
|
||||||
|
//vectors which will keep track of enter/leave changes
|
||||||
|
m_ETriggerTouchVector.clear();
|
||||||
|
m_ETriggerLeaveVector.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
//here all capturepoints will update their component
|
//here all capturepoints will update their component
|
||||||
@@ -24,6 +42,9 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
if (m_WinnerWasFound) {
|
if (m_WinnerWasFound) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!capturePointEntity.Valid()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const int capturePointNumber = cCapturePoint["CapturePointNumber"];
|
const int capturePointNumber = cCapturePoint["CapturePointNumber"];
|
||||||
const bool hasTeamComponent = capturePointEntity.HasComponent("Team");
|
const bool hasTeamComponent = capturePointEntity.HasComponent("Team");
|
||||||
|
|
||||||
@@ -60,7 +81,7 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
}
|
}
|
||||||
|
|
||||||
//if we havent received all capturepoints yet, just return
|
//if we havent received all capturepoints yet, just return
|
||||||
if (m_NumberOfCapturePoints == 0 || m_NumberOfCapturePoints != m_CapturePointNumberToEntityMap.size()) {
|
if (m_NumberOfCapturePoints == 0 || m_NumberOfCapturePoints > m_CapturePointNumberToEntityMap.size()) {
|
||||||
m_CapturePointNumberToEntityMap.insert(std::make_pair(capturePointNumber, capturePointEntity));
|
m_CapturePointNumberToEntityMap.insert(std::make_pair(capturePointNumber, capturePointEntity));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -232,10 +253,10 @@ void CapturePointSystem::UpdateComponent(EntityWrapper& capturePointEntity, Comp
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CapturePointSystem::ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner) {
|
void CapturePointSystem::ChangeCapturePointModelsVisibility(EntityWrapper &capturePointModels, bool isOwner)
|
||||||
|
{
|
||||||
(Field<bool>)capturePointModels["Model"]["Visible"] = isOwner;
|
(Field<bool>)capturePointModels["Model"]["Visible"] = isOwner;
|
||||||
for (auto& capModel : capturePointModels.ChildrenWithComponent("Transform"))
|
for (auto& capModel : capturePointModels.ChildrenWithComponent("Transform")) {
|
||||||
{
|
|
||||||
if (capModel.HasComponent("Model")) {
|
if (capModel.HasComponent("Model")) {
|
||||||
(Field<bool>)capModel["Model"]["Visible"] = isOwner;
|
(Field<bool>)capModel["Model"]["Visible"] = isOwner;
|
||||||
}
|
}
|
||||||
@@ -269,3 +290,9 @@ bool CapturePointSystem::OnCaptured(const Events::Captured& e)
|
|||||||
m_ResetTimers = true;
|
m_ResetTimers = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CapturePointSystem::OnReset(const Events::Reset& e)
|
||||||
|
{
|
||||||
|
Init();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -9,6 +9,8 @@ ScoreScreenSystem::ScoreScreenSystem(SystemParams params)
|
|||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &ScoreScreenSystem::OnPlayerSpawn);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &ScoreScreenSystem::OnPlayerSpawn);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerConnected, &ScoreScreenSystem::OnPlayerConnected);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerConnected, &ScoreScreenSystem::OnPlayerConnected);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDisconnected, &ScoreScreenSystem::OnPlayerDisconnected);
|
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDisconnected, &ScoreScreenSystem::OnPlayerDisconnected);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EReset, &ScoreScreenSystem::OnReset);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &ScoreScreenSystem::OnInputCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt)
|
void ScoreScreenSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt)
|
||||||
@@ -156,3 +158,25 @@ bool ScoreScreenSystem::OnPlayerDisconnected(const Events::PlayerDisconnected& e
|
|||||||
m_DisconnectedIdentities.push_back(e.PlayerID);
|
m_DisconnectedIdentities.push_back(e.PlayerID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScoreScreenSystem::OnReset(const Events::Reset & e)
|
||||||
|
{
|
||||||
|
for (auto& it : m_PlayerIdentities) {
|
||||||
|
it.second.Deaths = 0;
|
||||||
|
it.second.Kills = 0;
|
||||||
|
it.second.Team = 1;
|
||||||
|
it.second.Player = EntityWrapper::Invalid;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ScoreScreenSystem::OnInputCommand(const Events::InputCommand & e)
|
||||||
|
{
|
||||||
|
if (e.Command != "PickTeam" || e.PlayerID == -1 || e.Value == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_PlayerIdentities.at(e.PlayerID).Team = e.Value;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -30,11 +30,6 @@ bool SoundSystem::OnPlayerSpawned(const Events::PlayerSpawned &e)
|
|||||||
Events::PlayAnonuncerVoice go;
|
Events::PlayAnonuncerVoice go;
|
||||||
go.FilePath = "Audio/Announcer/" + m_Announcer + "/Go.wav";
|
go.FilePath = "Audio/Announcer/" + m_Announcer + "/Go.wav";
|
||||||
m_EventBroker->Publish(go);
|
m_EventBroker->Publish(go);
|
||||||
{
|
|
||||||
Events::ChangeBGM ev;
|
|
||||||
ev.FilePath = "Audio/BGM/Layer1.wav";
|
|
||||||
m_EventBroker->Publish(ev);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ SpectatorCameraSystem::SpectatorCameraSystem(SystemParams params)
|
|||||||
{
|
{
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &SpectatorCameraSystem::OnInputCommand);
|
EVENT_SUBSCRIBE_MEMBER(m_EInputCommand, &SpectatorCameraSystem::OnInputCommand);
|
||||||
EVENT_SUBSCRIBE_MEMBER(m_EDisconnect, &SpectatorCameraSystem::OnDisconnect);
|
EVENT_SUBSCRIBE_MEMBER(m_EDisconnect, &SpectatorCameraSystem::OnDisconnect);
|
||||||
|
EVENT_SUBSCRIBE_MEMBER(m_EReset, &SpectatorCameraSystem::OnReset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SpectatorCameraSystem::Update(double dt)
|
void SpectatorCameraSystem::Update(double dt)
|
||||||
@@ -27,6 +28,14 @@ void SpectatorCameraSystem::Update(double dt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SpectatorCameraSystem::reset()
|
||||||
|
{
|
||||||
|
m_CamSetToTeamPick = false;
|
||||||
|
// They will also be set to menu, so unlock mouse just in case they were in game with locked mouse.
|
||||||
|
Events::UnlockMouse unlock;
|
||||||
|
m_EventBroker->Publish(unlock);
|
||||||
|
}
|
||||||
|
|
||||||
bool SpectatorCameraSystem::OnInputCommand(const Events::InputCommand& e)
|
bool SpectatorCameraSystem::OnInputCommand(const Events::InputCommand& e)
|
||||||
{
|
{
|
||||||
// Only the client should do this, and only if player is not spawned.
|
// Only the client should do this, and only if player is not spawned.
|
||||||
@@ -52,7 +61,11 @@ bool SpectatorCameraSystem::OnInputCommand(const Events::InputCommand& e)
|
|||||||
// TODO: 1 Signifies spectator, should probably have real enum here later.
|
// TODO: 1 Signifies spectator, should probably have real enum here later.
|
||||||
// Spectators should never end up at the class select, instead put them at the SpectatorCamera.
|
// Spectators should never end up at the class select, instead put them at the SpectatorCamera.
|
||||||
if (swapToClass && m_PickedTeam != 1) {
|
if (swapToClass && m_PickedTeam != 1) {
|
||||||
camName = "PickClassCamera";
|
if (m_PickedTeam == 2) {
|
||||||
|
camName = "PickClassCameraRed";
|
||||||
|
} else if (m_PickedTeam == 3) {
|
||||||
|
camName = "PickClassCameraBlue";
|
||||||
|
}
|
||||||
} else if (e.Command == "SwapToTeamPick") {
|
} else if (e.Command == "SwapToTeamPick") {
|
||||||
camName = "PickTeamCamera";
|
camName = "PickTeamCamera";
|
||||||
} else {
|
} else {
|
||||||
@@ -95,10 +108,13 @@ bool SpectatorCameraSystem::OnDisconnect(const Events::PlayerDisconnected& e)
|
|||||||
// If local player gets disconnected, they should be set to
|
// If local player gets disconnected, they should be set to
|
||||||
// the spectator camera next time a map loads that has one.
|
// the spectator camera next time a map loads that has one.
|
||||||
if (e.Entity == LocalPlayer.ID) {
|
if (e.Entity == LocalPlayer.ID) {
|
||||||
m_CamSetToTeamPick = false;
|
reset();
|
||||||
// They will also be set to menu, so unlock mouse just in case they were in game with locked mouse.
|
|
||||||
Events::UnlockMouse unlock;
|
|
||||||
m_EventBroker->Publish(unlock);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SpectatorCameraSystem::OnReset(const Events::Reset & e)
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ bool Material::findColorTexture(MaterialNode& material_node, MFnDependencyNode&
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||||
MGlobal::displayInfo(MString() + "find splat map");
|
MGlobal::displayInfo(MString() + "found color splat map");
|
||||||
return findSplatTextures(material_node, material_node.ColorMaps, MFnDependencyNode(AllConnections[i].node()));
|
return findSplatTextures(material_node, material_node.ColorMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -162,9 +162,9 @@ bool Material::findNormalTexture(MaterialNode& material_node, MFnDependencyNode&
|
|||||||
|
|
||||||
material_node.NormalMaps.push_back(newTexture);
|
material_node.NormalMaps.push_back(newTexture);
|
||||||
return true;
|
return true;
|
||||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
} else if (AllBumpConnections[j].node().hasFn(MFn::kLayeredTexture)) {
|
||||||
MGlobal::displayInfo(MString() + "find splat map");
|
MGlobal::displayInfo(MString() + "found normal splat map");
|
||||||
return findSplatTextures(material_node, material_node.NormalMaps, MFnDependencyNode(AllConnections[i].node()));
|
return findSplatTextures(material_node, material_node.NormalMaps, MFnDependencyNode(AllBumpConnections[j].node()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ bool Material::findSpecularTexture(MaterialNode& material_node, MFnDependencyNod
|
|||||||
material_node.type = MaterialNode::MaterialType::SingleTextures;
|
material_node.type = MaterialNode::MaterialType::SingleTextures;
|
||||||
return true;
|
return true;
|
||||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||||
MGlobal::displayInfo(MString() + "find splat map");
|
MGlobal::displayInfo(MString() + "found specular splat map");
|
||||||
return findSplatTextures(material_node, material_node.SpecularMaps, MFnDependencyNode(AllConnections[i].node()));
|
return findSplatTextures(material_node, material_node.SpecularMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ bool Material::findIncandescenceTexture(MaterialNode& material_node, MFnDependen
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
} else if (AllConnections[i].node().hasFn(MFn::kLayeredTexture)) {
|
||||||
MGlobal::displayInfo(MString() + "find splat map");
|
MGlobal::displayInfo(MString() + "found incandescens splat map");
|
||||||
return findSplatTextures(material_node, material_node.IncandescenceMaps, MFnDependencyNode(AllConnections[i].node()));
|
return findSplatTextures(material_node, material_node.IncandescenceMaps, MFnDependencyNode(AllConnections[i].node()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user