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

This commit is contained in:
stiffly
2016-03-13 22:33:23 +01:00
86 changed files with 7622 additions and 2200 deletions
+13 -1
View File
@@ -27,7 +27,7 @@ void EntityWrapper::AttachComponent(const char* componentName)
EntityWrapper EntityWrapper::Parent()
{
if (this->World == nullptr || this->ID == EntityID_Invalid) {
if (!Valid()) {
return EntityWrapper::Invalid;
} else {
return EntityWrapper(this->World, this->World->GetParent(this->ID));
@@ -36,6 +36,10 @@ EntityWrapper EntityWrapper::Parent()
EntityWrapper EntityWrapper::FirstParentByName(const std::string& parentEntityName)
{
if (!Valid()) {
return EntityWrapper::Invalid;
}
EntityWrapper entity = *this;
while (entity.Parent().Valid()) {
entity = entity.Parent();
@@ -48,6 +52,10 @@ EntityWrapper EntityWrapper::FirstParentByName(const std::string& parentEntityNa
EntityWrapper EntityWrapper::FirstChildByName(const std::string& name)
{
if (!Valid()) {
return EntityWrapper::Invalid;
}
return firstChildByNameRecursive(name, this->ID);
}
@@ -78,6 +86,10 @@ EntityWrapper EntityWrapper::FirstLevelChildByName(const std::string& name)
EntityWrapper EntityWrapper::FirstParentWithComponent(const std::string& componentType)
{
if (!Valid()) {
return EntityWrapper::Invalid;
}
EntityWrapper entity = *this;
while (entity.Parent().Valid()) {
entity = entity.Parent();
+19
View File
@@ -173,6 +173,9 @@ void Client::parseMessageType(Packet& packet)
case MessageType::RemoveWorld:
parseRemoveWorld(packet);
break;
case MessageType::KD:
parseKDEvent(packet);
break;
default:
break;
}
@@ -357,6 +360,22 @@ void Client::parseRemoveWorld(Packet & packet)
m_EventBroker->Publish(e);
}
void Client::parseKDEvent(Packet & packet)
{
Events::KillDeath e;
e.Casualty = packet.ReadPrimitive<int>();
e.CasualtyClass = packet.ReadPrimitive<int>();
e.CasualtyName = packet.ReadString();
e.CasualtyTeam = packet.ReadPrimitive<int>();
e.Killer = packet.ReadPrimitive<int>();
e.KillerClass = packet.ReadPrimitive<int>();
e.KillerName = packet.ReadString();
e.KillerTeam = packet.ReadPrimitive<int>();
m_EventBroker->Publish(e);
}
void Client::updateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID)
{
for (auto field : componentInfo.FieldsInOrder) {
+39
View File
@@ -560,9 +560,48 @@ bool Server::OnAmmoPickup(const Events::AmmoPickup & e)
bool Server::OnPlayerDeath(const Events::PlayerDeath& e)
{
Events::KillDeath eKD;
auto entity = e;
eKD.Casualty = getPlayerIDFromEntityID(e.Player.ID);
eKD.Killer = getPlayerIDFromEntityID(e.Killer.ID);
eKD.CasualtyName = m_ConnectedPlayers.at(getPlayerIDFromEntityID(e.Player.ID)).Name;
eKD.KillerName = m_ConnectedPlayers.at(getPlayerIDFromEntityID(e.Killer.ID)).Name;
if(entity.Player.HasComponent("Team")) {
eKD.CasualtyTeam = (const int&)entity.Player["Team"]["Team"];
}
if (entity.Killer.HasComponent("Team")) {
eKD.KillerTeam = (const int&)entity.Killer["Team"]["Team"];
}
if(entity.Player.HasComponent("DashAbility")) {
eKD.CasualtyClass = 1;
} else if (entity.Player.HasComponent("ShieldAbility")) {
eKD.CasualtyClass = 2;
} else if (entity.Player.HasComponent("SprintAbility")) {
eKD.CasualtyClass = 3;
}
if (entity.Killer.HasComponent("DashAbility")) {
eKD.KillerClass = 1;
} else if (entity.Killer.HasComponent("ShieldAbility")) {
eKD.KillerClass = 2;
} else if (entity.Killer.HasComponent("SprintAbility")) {
eKD.KillerClass = 3;
}
m_EventBroker->Publish(eKD);
Packet kdPacket(MessageType::KD);
kdPacket.WritePrimitive(eKD.Casualty);
kdPacket.WritePrimitive(eKD.CasualtyClass);
kdPacket.WriteString(eKD.CasualtyName);
kdPacket.WritePrimitive(eKD.CasualtyTeam);
kdPacket.WritePrimitive(eKD.Killer);
kdPacket.WritePrimitive(eKD.KillerClass);
kdPacket.WriteString(eKD.KillerName);
kdPacket.WritePrimitive(eKD.KillerTeam);
reliableBroadcast(kdPacket);
return false;
}
+12 -6
View File
@@ -76,18 +76,18 @@ void AnimationSystem::UpdateAnimations(double dt)
Field<std::string> res = modelEntity["Model"]["Resource"];
model = ResourceManager::Load<::Model, true>(res);
} catch (const std::exception&) {
return;
continue;
}
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
return;
continue;
}
const Skeleton::Animation* animation = skeleton->GetAnimation(animationC["AnimationName"]);
if (animation == nullptr) {
continue;;
continue;
}
double animationSpeed = (const double&)animationC["Speed"];
@@ -128,8 +128,8 @@ void AnimationSystem::UpdateAnimations(double dt)
void AnimationSystem::UpdateWeights(double dt)
{
for (auto it = m_AutoBlendQueues.begin(); it != m_AutoBlendQueues.end(); ) {
/* LOG_INFO("%s", it->first.Name().c_str());
it->second.PrintQueue();*/
//LOG_INFO("%s", it->first.Name().c_str());
//it->second.PrintQueue();
if(it->second.HasActiveBlendJob()) {
AutoBlendQueue::AutoBlendJob& blendJob = it->second.GetActiveBlendJob();
@@ -159,12 +159,13 @@ void AnimationSystem::UpdateWeights(double dt)
bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
{
if (!e.RootNode.Valid()) {
LOG_ERROR("%s, RootNode invalid %s", e.NodeName, e.RootNode.Name().c_str());
return false;
}
if (!e.RootNode.HasComponent("Model")) {
LOG_ERROR("%s, RootNode has no model %s", e.NodeName, e.RootNode.Name().c_str());
return false;
}
@@ -172,11 +173,13 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
try {
model = ResourceManager::Load<::Model, true>((std::string)e.RootNode["Model"]["Resource"]);
} catch (const std::exception&) {
LOG_ERROR("%s, RootNode model not finished loading %s", e.NodeName, e.RootNode.Name().c_str());
return false;
}
Skeleton* skeleton = model->m_RawModel->m_Skeleton;
if (skeleton == nullptr) {
LOG_ERROR("%s, RootNode skeleton invalid %s", e.NodeName, e.RootNode.Name().c_str());
return false;
}
@@ -184,6 +187,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
if (skeleton->BlendTrees.find(e.RootNode) != skeleton->BlendTrees.end()) {
blendTree = skeleton->BlendTrees.at(e.RootNode);
} else {
LOG_ERROR("%s, No blendtree was found invalid %s", e.NodeName, e.RootNode.Name().c_str());
return false;
}
@@ -194,6 +198,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
subTreeRoot = blendTree->GetSubTreeRoot(e.NodeName);
if (!subTreeRoot.Valid()) {
LOG_ERROR("%s, subTreeRoot invalid", e.NodeName);
return false;
}
@@ -238,6 +243,7 @@ bool AnimationSystem::OnAutoAnimationBlend(Events::AutoAnimationBlend& e)
subTreeRoot = entity;
if (!subTreeRoot.Valid()) {
LOG_ERROR("%s, subTreeRoot invalid", e.NodeName);
return false;
}
+1 -1
View File
@@ -1336,7 +1336,7 @@ void DrawFinalPass::DrawToDepthStencilBuffer(std::list<std::shared_ptr<RenderJob
} else {
frameBones = modelJob->Skeleton->GetTPose();
}
glUniformMatrix4fv(glGetUniformLocation(shaderHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
glUniformMatrix4fv(glGetUniformLocation(shaderSkinnedHandle, "Bones"), frameBones.size(), GL_FALSE, glm::value_ptr(frameBones[0]));
} else {
if (lastShader != m_FillDepthStencilBufferProgram->GetHandle()) {