Merge remote-tracking branch 'origin/master' into FixNetworkBugs

This commit is contained in:
Jocke
2016-03-02 17:59:20 +01:00
29 changed files with 6198 additions and 122 deletions
+3
View File
@@ -6,6 +6,7 @@
#include "ObjectPool.h"
#include "ComponentPool.h"
#include "EventBroker.h"
struct EntityWrapper;
class World
{
@@ -49,6 +50,8 @@ public:
void SetName(EntityID entity, const std::string& name);
// Get the textual name of an entity
std::string GetName(EntityID entity) const;
// Get the first entity in the world with the name.
EntityWrapper GetFirstEntityByName(const std::string& name);
private:
EventBroker* m_EventBroker = nullptr;
@@ -27,7 +27,7 @@ public:
virtual bool OnCommand(const Events::InputCommand& e) override;
virtual void Reset();
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer);
void AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer, EntityID playerID);
virtual bool AssaultDashDoubleTapped() const { return m_AssaultDashDoubleTapped; }
virtual bool PlayerIsDashing() const { return m_PlayerIsDashing; }
@@ -41,6 +41,7 @@ protected:
bool m_Crouching = false;
//assault dash membervariables - needed to calculate the doubletap- and dashlogic
double m_AssaultDashDoubleTapDeltaTime = 0.0;
double m_DashEffectResetTimer = 0.0;
//i will let m_AssaultDashDoubleTapSensitivityTimer stay hardcoded, its not really a gamevariable (more an inputvariable),
//and its very unlikely that someone wants to change that value
const float m_AssaultDashDoubleTapSensitivityTimer = 0.25f;
@@ -51,7 +52,7 @@ protected:
bool m_ShiftDashing = false;
bool m_ValidDoubleTap = false;
//specialabilitys
//specialabilities
bool m_MovementKeyDown = false;
bool m_SpecialAbilityKeyDown = false;
int m_NumberOfMovementKeysDown = 0;
@@ -190,12 +191,19 @@ bool FirstPersonInputController<EventContext>::OnLockMouse(const Events::LockMou
}
template <typename EventContext>
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer) {
void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool isJumping, double assaultDashCoolDownMaxTimer, double& assaultDashCoolDownTimer, EntityID playerID) {
m_AssaultDashDoubleTapDeltaTime += dt;
m_DashEffectResetTimer += dt;
assaultDashCoolDownTimer -= dt;
//cooldown = assaultDashCoolDownMaxTimer sec, pretend the dash lasts 0.25 sec (for friction to do its work)
if (assaultDashCoolDownTimer > (assaultDashCoolDownMaxTimer - 0.25f)) {
m_PlayerIsDashing = true;
if (m_DashEffectResetTimer > 0.05) {
Events::DashAbility e;
e.Player = playerID;
m_EventBroker->Publish(e);
m_DashEffectResetTimer = 0.0;
}
} else {
m_PlayerIsDashing = false;
}
@@ -207,6 +215,9 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
m_AssaultDashDoubleTapped = true;
m_AssaultDashDoubleTapDeltaTime = 0.f;
Events::DashAbility e;
e.Player = playerID;
m_EventBroker->Publish(e);
return;
}
@@ -237,6 +248,7 @@ void FirstPersonInputController<EventContext>::AssaultDashCheck(double dt, bool
assaultDashCoolDownTimer = assaultDashCoolDownMaxTimer;
Events::DashAbility e;
e.Player = playerID;
m_EventBroker->Publish(e);
}
+5
View File
@@ -28,6 +28,7 @@
#include "Core/EPlayerSpawned.h"
#include "Core/EAmmoPickup.h"
#include "Network/ESearchForServers.h"
#include "../Game/Events/EDashAbility.h"
struct ServerInfo
{
@@ -107,6 +108,7 @@ private:
void parsePlayerDamage(Packet& packet);
void parseComponentDeletion(Packet& packet);
void parseDoubleJump(Packet& packet);
void parseDashEffect(Packet& packet);
void parseAmmoPickup(Packet& packet);
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
void parseSnapshot(Packet& packet);
@@ -135,6 +137,9 @@ private:
EventRelay< Client, Events::SearchForServers> m_ESearchForServers;
EventRelay<Client, Events::DoubleJump> m_EDoubleJump;
bool OnDoubleJump(Events::DoubleJump & e);
EventRelay<Client, Events::DashAbility> m_EDashAbility;
bool OnDashAbility(const Events::DashAbility& e);
bool OnSearchForServers(const Events::SearchForServers& e);
UDPClient m_ServerlistRequest;
std::vector<ServerInfo> m_Serverlist;
+1
View File
@@ -20,6 +20,7 @@ enum class MessageType
ComponentDeleted,
PlayerTransform,
OnDoubleJump,
OnDashEffect,
ServerlistRequest,
AmmoPickup,
Invalid
+1
View File
@@ -83,6 +83,7 @@ private:
void parseClientPing();
void parsePing();
bool parseDoubleJump(Packet& packet);
void parseDashEffect(Packet& packet);
void parseUDPConnect(Packet& packet);
void parseTCPConnect(Packet& packet);
void parseDisconnect();
+5 -1
View File
@@ -2,11 +2,15 @@
#define Events_DashAbility_h__
#include "Core/Event.h"
#include "Core/EntityWrapper.h"
namespace Events
{
struct DashAbility : public Event { };
struct DashAbility : public Event
{
EntityID Player;
};
}
@@ -0,0 +1,19 @@
#include "Common.h"
#include "Core/System.h"
class FloatingEffectSystem : public PureSystem
{
public:
FloatingEffectSystem(SystemParams params)
: System(params)
, PureSystem("FloatingEffect")
{ }
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt) override
{
ComponentWrapper& transform = m_World->GetComponent(component.EntityID, "Transform");
(double&)component["Time"] += dt;
(glm::vec3&)transform["Position"] = (float)(double)component["Amplitude"] * glm::sin((glm::two_pi<float>() / (float)(double)component["Period"]) * (float)(double)component["Time"]) * (glm::vec3)component["Axis"];
}
};
+5
View File
@@ -11,6 +11,7 @@
#include "Core/EntityFileParser.h"
#include "Core/EPlayerDeath.h"
#include "Core/EEntityDeleted.h"
class PlayerDeathSystem : public ImpureSystem
{
@@ -20,8 +21,12 @@ public:
virtual void Update(double dt) override;
private:
EntityWrapper m_LocalPlayerDeathEffect;
EventRelay<PlayerDeathSystem, Events::PlayerDeath> m_OnPlayerDeath;
bool OnPlayerDeath(Events::PlayerDeath& e);
EventRelay<PlayerDeathSystem, Events::EntityDeleted> m_EEntityDeleted;
bool OnEntityDeleted(Events::EntityDeleted& e);
void createDeathEffect(EntityWrapper player);
@@ -41,6 +41,8 @@ private:
bool OnPlayerSpawned(Events::PlayerSpawned& e);
EventRelay<PlayerMovementSystem, Events::DoubleJump> m_EDoubleJump;
bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e);
EventRelay<PlayerMovementSystem, Events::DashAbility> m_EDashAbility;
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e);
void updateMovementControllers(double dt);
void updateVelocity(EntityWrapper player, double dt);
+1 -1
View File
@@ -4,7 +4,7 @@ LoadMap=
; if true -> Pool allocation is not used when calling Allocate/Free, just use regular dynamic allocation.
; if false -> Use pool allocation.
DisableMemoryPool=false
RespawnTime = 8.0
RespawnTime = -1.0
EditorEnabled=false
OutOfBodyExperience=false
+1
View File
@@ -56,4 +56,5 @@
<xs:include schemaLocation="Components/DefenderWeapon.xsd"/>
<xs:include schemaLocation="Components/CapturePointGameMode.xsd"/>
<xs:include schemaLocation="Components/CapturePointArrowHUD.xsd"/>
<xs:include schemaLocation="Components/FloatingEffect.xsd"/>
</xs:schema>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<FloatingEffect xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FloatingEffect.xsd">
<Period>1</Period>
<Amplitude>1</Amplitude>
<Time>0</Time>
<Axis X="0" Y="0" Z="0"/>
<Position X="0" Y="0" Z="0"/>
</FloatingEffect>
@@ -0,0 +1,17 @@
<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="types">
<xs:import schemaLocation="../Types.xsd" namespace="types"/>
<xs:element name="FloatingEffect">
<xs:complexType>
<xs:all>
<xs:element name="Period" type="t:double" minOccurs="0"/>
<xs:element name="Amplitude" type="t:double" minOccurs="0"/>
<xs:element name="Time" type="t:double" minOccurs="0"/>
<xs:element name="Axis" type="t:Vector" minOccurs="0"/>
<xs:element name="Position" type="t:Vector" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
+18
View File
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="DashEffect" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Animation/>
<c:Lifetime>
<Lifetime>0.5</Lifetime>
</c:Lifetime>
<c:ExplosionEffect>
<Velocity X="0" Y="0" Z="0"/>
<TimeSinceDeath>0</TimeSinceDeath>
<ExplosionDuration>0.5</ExplosionDuration>
<EndColor A="0" B="0" G="0" R="0"/>
</c:ExplosionEffect>
<c:Model/>
<c:Transform/>
</Components>
</Entity>
+49 -49
View File
@@ -804,11 +804,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>3002.0048499272534</Time>
<Time>3297.0538973857279</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.00320033543" Z="0"/>
<Position X="-0" Y="-0.0338360146" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -825,7 +825,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="23665.3672" Z="0"/>
<Orientation X="0" Y="23901.0449" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -851,11 +851,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2981.7884295114754</Time>
<Time>3276.8374769699499</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.123386621" Z="-0"/>
<Position X="0" Y="0.0977828354" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -872,7 +872,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="23644.3164" Z="0"/>
<Orientation X="0" Y="23879.9941" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -898,11 +898,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2965.4934667508096</Time>
<Time>3260.542514209284</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.199960142" Z="-0"/>
<Position X="0" Y="0.19820635" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -919,7 +919,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="23585.6074" Z="0"/>
<Orientation X="0" Y="23821.2852" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -945,11 +945,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2922.0307477781698</Time>
<Time>3217.0797952366443</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0194334686" Z="0"/>
<Position X="-0" Y="-0.0497358106" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -966,7 +966,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5331.15967" Z="0"/>
<Orientation X="0" Y="5567.29199" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -992,11 +992,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2871.33224525081</Time>
<Time>3166.3812927092845</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.172897741" Z="-0"/>
<Position X="0" Y="0.186271787" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -1013,7 +1013,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5241.63037" Z="0"/>
<Orientation X="0" Y="5477.7627" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -1039,11 +1039,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2854.2794756870871</Time>
<Time>3149.3285231455616</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.154012829" Z="0"/>
<Position X="-0" Y="-0.171761468" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -1060,7 +1060,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="14694.2959" Z="0"/>
<Orientation X="0" Y="14930.6826" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -1086,11 +1086,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2839.2647225755118</Time>
<Time>3134.3137700339862</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.147846922" Z="-0"/>
<Position X="0" Y="0.166757002" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -1107,7 +1107,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="12585.2275" Z="0"/>
<Orientation X="0" Y="12821.6143" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -2242,7 +2242,7 @@
<Resource>Models/Props/Stones/AssaultHolder.mesh</Resource>
</c:Model>
<c:Transform>
<Position X="-3.47628784" Y="0.507368565" Z="0.99732101"/>
<Position X="-3.30188537" Y="0.507368565" Z="1.6052227"/>
</c:Transform>
</Components>
<Children/>
@@ -2355,11 +2355,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2746.6837512442808</Time>
<Time>3041.7327987027552</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.16754517" Z="0"/>
<Position X="-0" Y="-0.148809776" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -2376,7 +2376,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="16210.457" Z="0"/>
<Orientation X="0" Y="16446.9434" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -2402,11 +2402,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2732.8386366079758</Time>
<Time>3027.8876840664502</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0970942229" Z="0"/>
<Position X="-0" Y="-0.0691253543" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -2423,7 +2423,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5167.40771" Z="0"/>
<Orientation X="0" Y="5403.54004" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -2904,11 +2904,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2969.073541383088</Time>
<Time>3264.1225888415624</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.0458931364" Z="-0"/>
<Position X="0" Y="0.0752089471" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -2925,7 +2925,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="23639.0527" Z="0"/>
<Orientation X="0" Y="23874.7305" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -2951,11 +2951,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2948.85712096731</Time>
<Time>3243.9061684257845</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0866934955" Z="0"/>
<Position X="-0" Y="-0.0580219813" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -2972,7 +2972,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="23618.002" Z="0"/>
<Orientation X="0" Y="23853.6797" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -2998,11 +2998,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2932.5621582066442</Time>
<Time>3227.6112056651186</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.196187839" Z="0"/>
<Position X="-0" Y="-0.187905088" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -3019,7 +3019,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="23559.293" Z="0"/>
<Orientation X="0" Y="23794.9707" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -3045,11 +3045,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2889.0994392340044</Time>
<Time>3184.1484866924789</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.0615537763" Z="-0"/>
<Position X="0" Y="0.0900137872" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -3066,7 +3066,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5304.81885" Z="0"/>
<Orientation X="0" Y="5540.95117" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -3092,11 +3092,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2838.4009367066446</Time>
<Time>3133.4499841651191</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.190397173" Z="0"/>
<Position X="-0" Y="-0.197535709" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -3113,7 +3113,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5215.28955" Z="0"/>
<Orientation X="0" Y="5451.42188" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -3139,11 +3139,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2821.3481671429217</Time>
<Time>3116.3972146013962</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.177647248" Z="-0"/>
<Position X="0" Y="0.189699799" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -3160,7 +3160,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="14667.9326" Z="0"/>
<Orientation X="0" Y="14904.3193" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
@@ -3186,11 +3186,11 @@
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>2806.3334140313464</Time>
<Time>3101.3824614898208</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.173328787" Z="0"/>
<Position X="-0" Y="-0.186583459" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -3207,7 +3207,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="12558.8643" Z="0"/>
<Orientation X="0" Y="12795.251" Z="0"/>
</c:Transform>
<c:Trigger/>
</Components>
+114 -34
View File
@@ -802,8 +802,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>309.46063484238653</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.181836113" Z="0"/>
<Position X="-0" Y="-0.198473096" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -821,7 +826,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="24080.8184" Z="0"/>
<Orientation X="0" Y="24396.9355" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -844,8 +849,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>277.77588852554459</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.185762629" Z="-0"/>
<Position X="-0" Y="-0.129464492" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -863,7 +873,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="24059.7676" Z="0"/>
<Orientation X="0" Y="24375.8848" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -886,8 +896,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>265.69306053010564</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.167244121" Z="0"/>
<Position X="-0" Y="-0.164330602" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -905,7 +920,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="24001.0586" Z="0"/>
<Orientation X="0" Y="24317.1758" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -928,8 +943,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>254.01948784300018</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.0644967183" Z="0"/>
<Position X="0" Y="0.0122369174" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -947,7 +967,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5746.52246" Z="0"/>
<Orientation X="0" Y="6061.90527" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -970,8 +990,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>244.21618709850597</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.0994067639" Z="-0"/>
<Position X="0" Y="0.125630379" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -989,7 +1014,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5656.99316" Z="0"/>
<Orientation X="0" Y="5972.37598" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -1012,8 +1037,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>231.37430087102678</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.19803375" Z="-0"/>
<Position X="-0" Y="-0.184606224" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -1031,7 +1061,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="15110.7119" Z="0"/>
<Orientation X="0" Y="15425.6113" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -1054,8 +1084,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>219.21100328618962</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.11493478" Z="-0"/>
<Position X="-0" Y="-0.12308117" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -1073,7 +1108,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="13001.6436" Z="0"/>
<Orientation X="0" Y="13316.543" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -2318,8 +2353,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>192.42971043059836</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.143913418" Z="0"/>
<Position X="0" Y="0.195146352" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -2337,7 +2377,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="16626.7168" Z="0"/>
<Orientation X="0" Y="16942.834" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -2360,8 +2400,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>180.12130596231671</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.151800558" Z="0"/>
<Position X="0" Y="0.0743921027" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -2379,7 +2424,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5582.77051" Z="0"/>
<Orientation X="0" Y="5898.15332" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -2857,8 +2902,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>154.99927956894089</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.199556321" Z="-0"/>
<Position X="0" Y="0.000450141786" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -2876,7 +2926,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="24054.5039" Z="0"/>
<Orientation X="0" Y="24370.6191" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -2899,8 +2949,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>144.56072209865593</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.0983726978" Z="-0"/>
<Position X="0" Y="0.196372822" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -2918,7 +2973,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="24033.4531" Z="0"/>
<Orientation X="0" Y="24349.5703" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -2941,8 +2996,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>113.54515932497441</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="0" Y="0.199529812" Z="0"/>
<Position X="-0" Y="-0.197990373" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -2960,7 +3020,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="23974.7441" Z="0"/>
<Orientation X="0" Y="24290.8613" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -2983,8 +3043,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>101.62883282122999</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.129332498" Z="-0"/>
<Position X="-0" Y="-0.183840692" Z="-0"/>
</c:Transform>
</Components>
<Children>
@@ -3002,7 +3067,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5720.18164" Z="0"/>
<Orientation X="0" Y="6035.56445" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -3025,8 +3090,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>90.764091375525993</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.199750423" Z="-0"/>
<Position X="0" Y="0.135024786" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -3044,7 +3114,7 @@
<c:Transform>
<Position X="0" Y="2.36800003" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="5630.65234" Z="0"/>
<Orientation X="0" Y="5946.03516" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -3067,8 +3137,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>70.667870676407972</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.164693162" Z="-0"/>
<Position X="0" Y="0.172826052" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -3086,7 +3161,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="15084.3486" Z="0"/>
<Orientation X="0" Y="15399.248" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -3109,8 +3184,13 @@
<Children>
<Entity>
<Components>
<c:FloatingEffect>
<Axis X="0" Y="0.200000003" Z="0"/>
<Time>54.385750605052408</Time>
<Period>2</Period>
</c:FloatingEffect>
<c:Transform>
<Position X="-0" Y="-0.0709934905" Z="-0"/>
<Position X="0" Y="0.187255353" Z="0"/>
</c:Transform>
</Components>
<Children>
@@ -3128,7 +3208,7 @@
<c:Transform>
<Position X="0" Y="2.36784196" Z="0"/>
<Scale X="0.600000024" Y="0.600000024" Z="0.600000024"/>
<Orientation X="0" Y="12975.2803" Z="0"/>
<Orientation X="0" Y="13290.1797" Z="0"/>
</c:Transform>
</Components>
<Children/>
@@ -4222,7 +4302,7 @@
<HomePointForTeam>
<Blue/>
</HomePointForTeam>
<CapturePointMaxTimer>-15</CapturePointMaxTimer>
<CaptureTimer>-15</CaptureTimer>
<CapturePointNumber>4</CapturePointNumber>
</c:CapturePoint>
<c:Trigger/>
@@ -4444,7 +4524,7 @@
<Entity name="Directional">
<Components>
<c:DirectionalLight>
<Intensity>1</Intensity>
<Intensity>0.40000000596046448</Intensity>
</c:DirectionalLight>
<c:Transform>
<Orientation X="0" Y="1.16600001" Z="2.08000016"/>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Entity name="SpectatorCamera" xmlns:c="components" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../Types/Entity.xsd">
<Components>
<c:Camera/>
<c:Transform>
<Position X="0" Y="0" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="SpectatorHUD">
<Components>
<c:Transform>
<Position X="0" Y="0" Z="-0.5"/>
</c:Transform>
</Components>
<Children>
<Entity name="RespawnTimer">
<Components>
<c:Text>
<Content>Time to respawn: 0</Content>
<Resource>Fonts/DroidSans.ttf,64</Resource>
<Color A="1" B="0" G="1" R="0.784313738"/>
<Alignment>
<Left/>
</Alignment>
</c:Text>
<c:Transform>
<Position X="-0.115000000" Y="0.15304254" Z="0"/>
<Scale X="0.0250000004" Y="0.0250000004" Z="1"/>
</c:Transform>
</Components>
<Children/>
</Entity>
<Entity name="CapturePointHUD">
<Components>
<c:Transform>
<Position X="0" Y="0.190541431" Z="0"/>
<Scale X="0.0599999987" Y="0.0599999987" Z="0.0599999987"/>
</c:Transform>
</Components>
<Children>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>2</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="0.811270177" Y="0.440691769" Z="-0.100000001"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>3</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Sprite>
<c:Transform>
<Position X="1.62788737" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>4</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.300000012" B="1" G="1" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="-0.820431828" Y="0.441878349" Z="-0.100000001"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD>
<CapturePointNumber>1</CapturePointNumber>
</c:CapturePointHUD>
<c:Fill>
<Percentage>0.59265931447347009</Percentage>
<Color A="0.699999988" B="0" G="0" R="1"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="4.71238899"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
<Entity name="BackgroundHexagon">
<Components>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon.png</DiffuseTexture>
<GlowMap></GlowMap>
<Color A="0.699999988" B="0" G="0" R="1"/>
</c:Sprite>
<c:Transform>
<Position X="-1.58304751" Y="0.919596612" Z="0"/>
</c:Transform>
</Components>
<Children>
<Entity name="ProgressionHexagon">
<Components>
<c:CapturePointHUD/>
<c:Fill>
<Color A="0.699999988" B="1" G="0.200000003" R="0"/>
</c:Fill>
<c:Sprite>
<DiffuseTexture>Textures/Core/UnitHexagon_Rotated.png</DiffuseTexture>
<GlowMap></GlowMap>
</c:Sprite>
<c:Transform>
<Position X="0" Y="0" Z="0.00999999978"/>
<Scale X="0.800000012" Y="0.800000012" Z="0.800000012"/>
<Orientation X="0" Y="0" Z="1.57079637"/>
</c:Transform>
</Components>
<Children/>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
</Children>
</Entity>
+7
View File
@@ -53,6 +53,13 @@
<xs:element ref="c:WeaponAttachment" minOccurs="0"/>
<xs:element ref="c:DefenderWeapon" minOccurs="0"/>
<xs:element ref="c:CapturePointArrowHUD" minOccurs="0"/>
<xs:element ref="c:FloatingEffect" minOccurs="0"/>
<xs:element ref="c:AmmoPickup" minOccurs="0"/>
<xs:element ref="c:HealthPickup" minOccurs="0"/>
<xs:element ref="c:CapturePointGameMode" minOccurs="0"/>
<xs:element ref="c:DoubleJump" minOccurs="0"/>
<xs:element ref="c:HealthHUD" minOccurs="0"/>
<xs:element ref="c:SpriteIndicator" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
+13 -3
View File
@@ -1,6 +1,6 @@
#include "Core/EntityFileParser.h"
EntityFileParser::EntityFileParser(const EntityFile* entityFile)
EntityFileParser::EntityFileParser(const EntityFile* entityFile)
: m_EntityFile(entityFile)
{
m_Handler.SetStartEntityCallback(std::bind(&EntityFileParser::onStartEntity, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
@@ -33,13 +33,20 @@ void EntityFileParser::onStartEntity(EntityID entity, EntityID parent, const std
void EntityFileParser::onStartComponent(EntityID entity, const std::string& component)
{
EntityID realEntity = m_EntityIDMapper.at(entity);
m_World->AttachComponent(realEntity, component);
if (m_World->GetComponentPools().count(component) != 0) {
EntityID realEntity = m_EntityIDMapper.at(entity);
m_World->AttachComponent(realEntity, component);
} else {
LOG_ERROR("Tried to attach unregistered component \"%s\"! to entity #%i. Ignoring.", component.c_str(), entity);
}
//LOG_DEBUG("Attached component of type \"%s\" to entity #%i (%i)", component.c_str(), entity, realEntity);
}
void EntityFileParser::onStartComponentField(EntityID entity, const std::string& componentType, const std::string& fieldName, const std::map<std::string, std::string>& attributes)
{
if (m_World->GetComponentPools().count(componentType) == 0) {
return;
}
EntityID realEntity = m_EntityIDMapper.at(entity);
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
auto fieldIt = component.Info.Fields.find(fieldName);
@@ -61,6 +68,9 @@ void EntityFileParser::onStartComponentField(EntityID entity, const std::string&
void EntityFileParser::onFieldData(EntityID entity, const std::string& componentType, const std::string& fieldName, const char* fieldData)
{
if (m_World->GetComponentPools().count(componentType) == 0) {
return;
}
EntityID realEntity = m_EntityIDMapper.at(entity);
ComponentWrapper component = m_World->GetComponent(realEntity, componentType);
auto fieldIt = component.Info.Fields.find(fieldName);
+2 -2
View File
@@ -33,8 +33,8 @@ void _LOG(_LOG_LEVEL logLevel, const char* file, const char* func, unsigned int
va_end(args);
if (logLevel == LOG_LEVEL_ERROR) {
//std::cerr << file << ":" << line << " " << func << std::endl;
//std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
std::cerr << file << ":" << line << " " << func << std::endl;
std::cerr << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
} else {
std::cout << _LOG_LEVEL_PREFIX[logLevel] << message << std::endl;
}
+18
View File
@@ -1,6 +1,7 @@
#include "Core/World.h"
#include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h"
#include "Core/EntityWrapper.h"
World::~World()
{
@@ -151,6 +152,23 @@ std::string World::GetName(EntityID entity) const
}
}
EntityWrapper World::GetFirstEntityByName(const std::string& name)
{
auto itPair = GetDirectChildren(EntityID_Invalid);
for (auto it = itPair.first; it != itPair.second; it++) {
EntityID childEntityID = it->second;
EntityWrapper childEntity(this, childEntityID);
if (!childEntity.Valid()) {
continue;
}
EntityWrapper entityWithName = childEntity.Name() == name ? childEntity : childEntity.FirstChildByName(name);
if (entityWithName.Valid()) {
return entityWithName;
}
}
return EntityWrapper::Invalid;
}
EntityID World::generateEntityID()
{
// TODO: Make EntityID generation smarter
+2 -1
View File
@@ -265,7 +265,8 @@ EntityWrapper EditorSystem::importEntity(EntityWrapper parent, boost::filesystem
EntityFileParser fp(entityFile);
EntityID newEntity = fp.MergeEntities(parent.World, parent.ID);
return EntityWrapper(parent.World, newEntity);
} catch (const std::exception&) {
} catch (const std::exception& e) {
LOG_ERROR("Failed to import entity \"%s\": \"%s\"", filePath.string().c_str(), e.what());
return EntityWrapper::Invalid;
}
}
+33 -3
View File
@@ -33,6 +33,7 @@ void Client::Connect(std::string address, int port)
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Client::OnPlayerDamage);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &Client::OnPlayerSpawned);
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &Client::OnDoubleJump);
EVENT_SUBSCRIBE_MEMBER(m_EDashAbility, &Client::OnDashAbility);
EVENT_SUBSCRIBE_MEMBER(m_ESearchForServers, &Client::OnSearchForServers);
auto config = ResourceManager::Load<ConfigFile>("Config.ini");
m_Address = address;
@@ -143,6 +144,9 @@ void Client::parseMessageType(Packet& packet)
case MessageType::OnDoubleJump:
parseDoubleJump(packet);
break;
case MessageType::OnDashEffect:
parseDashEffect(packet);
break;
case MessageType::AmmoPickup:
parseAmmoPickup(packet);
break;
@@ -262,7 +266,7 @@ void Client::parseEntityDeletion(Packet & packet)
if (m_ServerIDToClientID.find(entityToDelete) != m_ServerIDToClientID.end()) {
EntityID localEntity = m_ServerIDToClientID.at(entityToDelete);
if (m_World->ValidEntity(localEntity)) {
if (m_World->HasComponent(localEntity,"Player")) {
if (m_World->HasComponent(localEntity, "Player")) {
Events::PlayerDeath e;
e.Player = EntityWrapper(m_World, localEntity);
m_EventBroker->Publish(e);
@@ -297,8 +301,22 @@ void Client::parseDoubleJump(Packet & packet)
}
}
void Client::parseDashEffect(Packet& packet)
{
EntityID serverID = packet.ReadPrimitive<EntityID>();
if (!serverClientMapsHasEntity(serverID)) {
return;
}
Events::DashAbility e;
e.Player = m_ServerIDToClientID.at(serverID);
if (e.Player != m_LocalPlayer.ID) {
m_EventBroker->Publish(e);
}
}
void Client::parseAmmoPickup(Packet & packet)
{
{
Events::AmmoPickup e;
e.AmmoGain = packet.ReadPrimitive<int>();
e.Player = m_LocalPlayer;
@@ -388,7 +406,7 @@ void Client::parseSnapshot(Packet& packet)
if (m_SnapshotFilter != nullptr) {
shouldApply = m_SnapshotFilter->FilterComponent(localEntity, newComponent);
}
if (shouldApply) {
if (shouldApply) {
ComponentWrapper currentComponent = m_World->GetComponent(localEntityID, componentType);
memcpy(currentComponent.Data, newComponent.Data, componentInfo.Stride);
}
@@ -518,6 +536,18 @@ bool Client::OnPlayerSpawned(const Events::PlayerSpawned& e)
return true;
}
bool Client::OnDashAbility(const Events::DashAbility& e)
{
if (!clientServerMapsHasEntity(e.Player) || e.Player != m_LocalPlayer.ID) {
return false;
}
Packet packet(MessageType::OnDashEffect);
packet.WritePrimitive(m_ClientIDToServerID.at(e.Player));
m_Reliable.Send(packet);
return true;
}
bool Client::OnSearchForServers(const Events::SearchForServers& e)
{
m_SearchingForServers = true;
+8
View File
@@ -141,6 +141,9 @@ void Server::parseMessageType(Packet& packet)
case MessageType::OnDoubleJump:
parseDoubleJump(packet);
break;
case MessageType::OnDashEffect:
parseDashEffect(packet);
break;
default:
break;
}
@@ -555,6 +558,11 @@ bool Server::parseDoubleJump(Packet & packet)
return true;
}
void Server::parseDashEffect(Packet& packet)
{
reliableBroadcast(packet);
}
void Server::parseOnInputCommand(Packet& packet)
{
PlayerID player = -1;
+2
View File
@@ -10,6 +10,7 @@
#include "Systems/SpawnerSystem.h"
#include "Systems/PlayerSpawnSystem.h"
#include "Systems/PlayerDeathSystem.h"
#include "Systems/FloatingEffectSystem.h"
#include "Core/EntityFileWriter.h"
#include "Game/Systems/CapturePointSystem.h"
#include "Game/Systems/CapturePointHUDSystem.h"
@@ -120,6 +121,7 @@ Game::Game(int argc, char* argv[])
++updateOrderLevel;
m_SystemPipeline->AddSystem<SoundSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<RaptorCopterSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<FloatingEffectSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<ExplosionEffectSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<HealthSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<PlayerMovementSystem>(updateOrderLevel);
+20
View File
@@ -4,6 +4,7 @@ PlayerDeathSystem::PlayerDeathSystem(SystemParams params)
: System(params)
{
EVENT_SUBSCRIBE_MEMBER(m_OnPlayerDeath, &PlayerDeathSystem::OnPlayerDeath);
EVENT_SUBSCRIBE_MEMBER(m_EEntityDeleted, &PlayerDeathSystem::OnEntityDeleted);
}
void PlayerDeathSystem::Update(double dt)
@@ -59,9 +60,28 @@ void PlayerDeathSystem::createDeathEffect(EntityWrapper player)
//camera (with lifetime) behind the player
if (player == LocalPlayer) {
m_LocalPlayerDeathEffect = deathEffectEW;
auto cam = deathEffectEW.FirstChildByName("Camera");
Events::SetCamera eSetCamera;
eSetCamera.CameraEntity = cam;
m_EventBroker->Publish(eSetCamera);
}
}
bool PlayerDeathSystem::OnEntityDeleted(Events::EntityDeleted& e)
{
// We only care about when the local players death effect is removed.
if (m_LocalPlayerDeathEffect.ID != e.DeletedEntity) {
return false;
}
// Look for the spectator camera entity in the level.
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
if (!spectatorCam.Valid() || !spectatorCam.HasComponent("Camera") || LocalPlayer.Valid()) {
return false;
}
Events::SetCamera eSetCamera;
eSetCamera.CameraEntity = spectatorCam;
m_EventBroker->Publish(eSetCamera);
return true;
}
+32 -5
View File
@@ -5,6 +5,7 @@ PlayerMovementSystem::PlayerMovementSystem(SystemParams params)
{
EVENT_SUBSCRIBE_MEMBER(m_EPlayerSpawned, &PlayerMovementSystem::OnPlayerSpawned);
EVENT_SUBSCRIBE_MEMBER(m_EDoubleJump, &PlayerMovementSystem::OnDoubleJump);
EVENT_SUBSCRIBE_MEMBER(m_EDashAbility, &PlayerMovementSystem::OnDashAbility);
}
PlayerMovementSystem::~PlayerMovementSystem()
@@ -72,7 +73,7 @@ void PlayerMovementSystem::updateMovementControllers(double dt)
ComponentWrapper cPhysics = player["Physics"];
//Assault Dash Check
if (player.HasComponent("DashAbility")) {
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], player["DashAbility"]["CoolDownTimer"]);
controller->AssaultDashCheck(dt, ((glm::vec3)cPhysics["Velocity"]).y != 0.0f, player["DashAbility"]["CoolDownMaxTimer"], player["DashAbility"]["CoolDownTimer"], player.ID);
}
wishDirection = controller->Movement() * glm::inverse(glm::quat(ori));
//this makes sure you can only dash in the 4 directions: forw,backw,left,right
@@ -313,11 +314,11 @@ bool PlayerMovementSystem::OnPlayerSpawned(Events::PlayerSpawned& e)
bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e)
{
// If entity does not exist, exit
if (!EntityWrapper(m_World, e.entityID).Valid()) {
if (!EntityWrapper(m_World, e.entityID).Valid()) {
return false;
}
// If entity IsLocalPlayer, exit
if (e.entityID == m_LocalPlayer.ID) {
if (e.entityID == m_LocalPlayer.ID) {
return false;
}
spawnHexagon(EntityWrapper(m_World, e.entityID));
@@ -325,11 +326,37 @@ bool PlayerMovementSystem::OnDoubleJump(Events::DoubleJump & e)
}
void PlayerMovementSystem::spawnHexagon(EntityWrapper target)
{
{
//put a hexagon at the entitys... feet?
auto hexagonEffect = ResourceManager::Load<EntityFile>("Schema/Entities/DoubleJumpHexagon.xml");
EntityFileParser parser(hexagonEffect);
EntityID hexagonEffectID = parser.MergeEntities(m_World);
EntityWrapper hexagonEW = EntityWrapper(m_World, hexagonEffectID);
hexagonEW["Transform"]["Position"] = (glm::vec3)target["Transform"]["Position"];
}
}
bool PlayerMovementSystem::OnDashAbility(Events::DashAbility & e)
{
EntityWrapper player(m_World, e.Player);
if (!player.Valid() || !IsClient || player.ID == LocalPlayer.ID) {
return false;
}
auto dashEffectResource = ResourceManager::Load<EntityFile>("Schema/Entities/DashEffect.xml");
EntityFileParser parser(dashEffectResource);
EntityID dashEffectID = parser.MergeEntities(m_World);
EntityWrapper dashEffect(m_World, dashEffectID);
auto playerModel = player.FirstChildByName("PlayerModel");
auto playerEntityModel = playerModel["Model"];
auto playerEntityAnimation = playerModel["Animation"];
playerEntityModel.Copy(dashEffect["Model"]);
playerEntityAnimation.Copy(dashEffect["Animation"]);
dashEffect["ExplosionEffect"]["EndColor"] = (glm::vec4)playerEntityModel["Color"];
((glm::vec4&)dashEffect["ExplosionEffect"]["EndColor"]).w = 0.f;
dashEffect["Animation"]["Speed1"] = 0.0;
dashEffect["Animation"]["Speed2"] = 0.0;
dashEffect["Animation"]["Speed3"] = 0.0;
dashEffect["Transform"]["Position"] = (glm::vec3)player["Transform"]["Position"];
dashEffect["Transform"]["Orientation"] = (glm::vec3)player["Transform"]["Orientation"];
return true;
}
+46 -20
View File
@@ -10,7 +10,7 @@ PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
m_NetworkEnabled = config->Get("Networking.StartNetwork", false);
m_ForcedRespawnTime = config->Get("Debug.RespawnTime", -1.0f);
m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0;
m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0 && IsServer;
}
void PlayerSpawnSystem::Update(double dt)
@@ -26,7 +26,21 @@ void PlayerSpawnSystem::Update(double dt)
// Increase timer.
double& timer = (double&)modeComponent["RespawnTime"];
timer += dt;
double maxRespawnTime = m_DbgConfigForceRespawn ? m_ForcedRespawnTime : (double)modeComponent["MaxRespawnTime"];
if (m_DbgConfigForceRespawn) {
(double&)modeComponent["MaxRespawnTime"] = m_ForcedRespawnTime;
}
double maxRespawnTime = (double)modeComponent["MaxRespawnTime"];
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
if (spectatorCam.Valid()) {
EntityWrapper HUD = spectatorCam.FirstChildByName("SpectatorHUD");
if (HUD.Valid()) {
EntityWrapper respawnTimer = spectatorCam.FirstChildByName("RespawnTimer");
if (respawnTimer.Valid()) {
//Update respawn time in the HUD element.
respawnTimer["Text"]["Content"] = std::to_string(1 + (int)(maxRespawnTime - timer));
}
}
}
if (timer < maxRespawnTime) {
return;
}
@@ -54,7 +68,14 @@ void PlayerSpawnSystem::Update(double dt)
// If the spawner has a team affiliation, check it
if (spawner.HasComponent("Team")) {
if ((int)spawner["Team"]["Team"] != req.Team) {
auto cSpawnerTeam = spawner["Team"];
if ((int)cSpawnerTeam["Team"] != req.Team) {
// Increase num spawned players if someone picks spectator, since it is valid to pick spectator
// but don't spawn anything, goto next spawnrequest.
if (req.Team == (int)cSpawnerTeam["Team"].Enum("Spectator")) {
++numSpawnedPlayers;
break;
}
continue;
}
}
@@ -75,9 +96,9 @@ void PlayerSpawnSystem::Update(double dt)
}
}
if (numSpawnedPlayers != (int)m_SpawnRequests.size()) {
LOG_DEBUG("%i players were supposed to be spawned, but %i was spawned.", (int)m_SpawnRequests.size(), numSpawnedPlayers);
LOG_DEBUG("%i players were supposed to be spawned or set as spectator, but only %i was handled.", (int)m_SpawnRequests.size(), numSpawnedPlayers);
} else {
LOG_DEBUG("%i players were spawned.", numSpawnedPlayers);
LOG_DEBUG("%i players were spawned or set as spectator.", numSpawnedPlayers);
}
m_SpawnRequests.clear();
}
@@ -88,24 +109,29 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
return false;
}
if (e.Value == 0) {
return false;
}
// A dead client should be able to swap to the spectator camera.
if (IsClient && !LocalPlayer.Valid()) {
// Set the spectator camera as active, if it exists.
// Find the camera.
EntityWrapper spectatorCam = m_World->GetFirstEntityByName("SpectatorCamera");
if (spectatorCam.Valid() && spectatorCam.HasComponent("Camera")) {
Events::SetCamera eSetCamera;
eSetCamera.CameraEntity = spectatorCam;
m_EventBroker->Publish(eSetCamera);
}
}
// Team picks should be processed ONLY server-side!
// Don't make a spawn request if we're the client.
if (!IsServer && m_NetworkEnabled) {
return false;
}
if (e.Value == 0) {
return false;
}
//TODO: Spectating?
//Right now, return if someone picks spectator.
//1 signifies spectator here, could not get Playerteam component since it may be invalid or without team comp.
if ((ComponentInfo::EnumType)e.Value == 1) {
return false;
}
//Check if the player already requested spawn.
// Check if the player already requested spawn.
auto iter = m_SpawnRequests.begin();
for (; iter != m_SpawnRequests.end(); ++iter) {
if (iter->PlayerID == e.PlayerID) {
@@ -114,11 +140,11 @@ bool PlayerSpawnSystem::OnInputCommand(Events::InputCommand& e)
}
if (iter != m_SpawnRequests.end()) {
//If player is in queue to spawn, then change their team affiliation in the request.
// If player is in queue to spawn, then change their team affiliation in the request.
iter->Team = (ComponentInfo::EnumType)e.Value;
} else if (m_PlayerEntities.count(e.PlayerID) == 0 || !m_PlayerEntities[e.PlayerID].Valid()) {
//If player is not in queue to spawn, then create a spawn request,
//but only if they are spectating and/or just connected.
// If player is not in queue to spawn, then create a spawn request,
// but only if they are spectating and/or just connected.
SpawnRequest req;
req.PlayerID = e.PlayerID;
req.Team = (ComponentInfo::EnumType)e.Value;