Merge remote-tracking branch 'origin/master' into FriendlyHost/Join

This commit is contained in:
stiffly
2016-03-09 17:38:37 +01:00
59 changed files with 10601 additions and 11683 deletions
+9 -5
View File
@@ -45,7 +45,7 @@ void InputProxy::Update(double dt)
}
}
void InputProxy::Process()
void InputProxy::Process(bool suppressNewEvents /*= false*/)
{
for (auto& pair : m_CommandHandlers) {
const std::string& command = pair.first;
@@ -62,8 +62,10 @@ void InputProxy::Process()
e.PlayerID = -1;
e.Command = command;
e.Value = currentValue;
m_EventBroker->Publish(e);
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
if (!suppressNewEvents || e.Value == 0) {
m_EventBroker->Publish(e);
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
}
m_LastCommandValues[command] = currentValue;
}
}
@@ -78,8 +80,10 @@ void InputProxy::Process()
e.Value += value;
}
//e.Value = std::max(-1.f, std::min(e.Value, 1.f));
m_EventBroker->Publish(e);
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
if (!suppressNewEvents || e.Value == 0) {
m_EventBroker->Publish(e);
//LOG_DEBUG("Input: Published command %s=%f for player %i", e.Command.c_str(), e.Value, e.PlayerID);
}
}
m_CommandQueue.clear();
}
+1 -1
View File
@@ -10,7 +10,7 @@ BlurHUD::BlurHUD(IRenderer* renderer)
void BlurHUD::InitializeTextures()
{
m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false);
m_BlackTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/Black.png");
m_ScreenQuad = ResourceManager::Load<Model>("Models/Core/ScreenQuad.mesh");
}
+1 -1
View File
@@ -11,7 +11,7 @@ DrawBloomPass::DrawBloomPass(IRenderer* renderer, ConfigFile* config)
void DrawBloomPass::InitializeTextures()
{
m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false);
m_BlackTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/Black.png");
}
void DrawBloomPass::ChangeQuality(int quality)
+5 -5
View File
@@ -14,11 +14,11 @@ DrawFinalPass::DrawFinalPass(IRenderer* renderer, LightCullingPass* lightCulling
void DrawFinalPass::InitializeTextures()
{
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
m_BlackTexture = CommonFunctions::LoadTexture("Textures/Core/Black.png", false);
m_NeutralNormalTexture = CommonFunctions::LoadTexture("Textures/Core/NeutralNormalMap.png", false);
m_GreyTexture = CommonFunctions::LoadTexture("Textures/Core/Grey.png", false);
m_ErrorTexture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false);
m_WhiteTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/White.png");
m_BlackTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/Black.png");
m_NeutralNormalTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/NeutralNormalMap.png");
m_GreyTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/Grey.png");
m_ErrorTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/ErrorTexture.png");
}
void DrawFinalPass::InitializeFrameBuffers()
+9 -9
View File
@@ -10,31 +10,31 @@ Model::Model(std::string fileName)
case RawModel::MaterialType::SingleTextures:
{
RawModel::MaterialSingleTextures* materialSingleTexture = static_cast<RawModel::MaterialSingleTextures*>(materialProperty.material);
materialSingleTexture->ColorMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->ColorMap.TexturePath, false);
materialSingleTexture->NormalMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->NormalMap.TexturePath, false);
materialSingleTexture->SpecularMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->SpecularMap.TexturePath, false);
materialSingleTexture->IncandescenceMap.Texture = CommonFunctions::LoadTexture(materialSingleTexture->IncandescenceMap.TexturePath, false);
materialSingleTexture->ColorMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSingleTexture->ColorMap.TexturePath);
materialSingleTexture->NormalMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSingleTexture->NormalMap.TexturePath);
materialSingleTexture->SpecularMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSingleTexture->SpecularMap.TexturePath);
materialSingleTexture->IncandescenceMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSingleTexture->IncandescenceMap.TexturePath);
}
break;
case RawModel::MaterialType::SplatMapping:
{
RawModel::MaterialSplatMapping* materialSplatMapping = static_cast<RawModel::MaterialSplatMapping*>(materialProperty.material);
materialSplatMapping->SplatMap.Texture = CommonFunctions::LoadTexture(materialSplatMapping->SplatMap.TexturePath, false);
materialSplatMapping->SplatMap.Texture = CommonFunctions::TryLoadResource<Texture, false>(materialSplatMapping->SplatMap.TexturePath);
for (auto& texture : materialSplatMapping->ColorMaps)
{
texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false);
texture.Texture = CommonFunctions::TryLoadResource<Texture, false>(texture.TexturePath);
}
for (auto& texture : materialSplatMapping->NormalMaps)
{
texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false);
texture.Texture = CommonFunctions::TryLoadResource<Texture, false>(texture.TexturePath);
}
for (auto& texture : materialSplatMapping->SpecularMaps)
{
texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false);
texture.Texture = CommonFunctions::TryLoadResource<Texture, false>(texture.TexturePath);
}
for (auto& texture : materialSplatMapping->IncandescenceMaps)
{
texture.Texture = CommonFunctions::LoadTexture(texture.TexturePath, false);
texture.Texture = CommonFunctions::TryLoadResource<Texture, false>(texture.TexturePath);
}
}
break;
+2 -2
View File
@@ -220,8 +220,8 @@ PickData Renderer::Pick(glm::vec2 screenCoord)
void Renderer::InitializeTextures()
{
m_ErrorTexture = CommonFunctions::LoadTexture("Textures/Core/ErrorTexture.png", false);
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
m_ErrorTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/ErrorTexture.png");
m_WhiteTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/White.png");
}
+1 -1
View File
@@ -4,7 +4,7 @@ SSAOPass::SSAOPass(IRenderer* renderer, ConfigFile* config)
: m_Renderer(renderer)
, m_Config(config)
{
m_WhiteTexture = CommonFunctions::LoadTexture("Textures/Core/White.png", false);
m_WhiteTexture = CommonFunctions::TryLoadResource<Texture, false>("Textures/Core/White.png");
ChangeQuality(m_Config->Get<int>("SSAO.Quality", 0));
+2 -14
View File
@@ -4,18 +4,6 @@ Texture::Texture(std::string path)
{
PNG* img = ResourceManager::Load<PNG, true>(path); //TODO: Make this threaded. Catch exeptions in all other load places.
//PNG image(path);
//if (img->Width == 0 && img->Height == 0 || img->Format == Image::ImageFormat::Unknown) {
// //image = PNG("Textures/Core/ErrorTexture.png");
// //return; // Temporary fix to remove crash
// if (img->Width == 0 && img->Height == 0 || img->Format == Image::ImageFormat::Unknown) {
// LOG_ERROR("Couldn't even load the error texture. This is a dark day indeed.");
// return;
// }
//}
this->Width = img->Width;
this->Height = img->Height;
this->Data = img->Data;
@@ -29,9 +17,9 @@ Texture::Texture(std::string path)
format = GL_RGBA;
break;
}
// Construct the OpenGL texture
glGenTextures(1, &m_Texture);
glBindTexture(GL_TEXTURE_2D, m_Texture);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+11
View File
@@ -0,0 +1,11 @@
#include "Rendering/TextureSprite.h"
TextureSprite::TextureSprite(std::string path)
:Texture(path)
{
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST_MIPMAP_NEAREST);
GLERROR("Texture load");
}
@@ -1,23 +1,5 @@
#include "Rendering/Util/CommonFunctions.h"
Texture* CommonFunctions::LoadTexture(std::string path, bool threaded)
{
Texture* img;
try {
if(threaded) {
img = ResourceManager::Load<Texture, true>(path);
} else {
img = ResourceManager::Load<Texture, false>(path);
}
} catch (const Resource::StillLoadingException&) {
img = ResourceManager::Load<Texture>("Textures/Core/ErrorTexture.png");
} catch (const std::exception&) {
img = nullptr;
}
return img;
}
void CommonFunctions::GenerateTexture(GLuint* texture, GLenum wrapping, GLenum filtering, glm::vec2 dimensions, GLint internalFormat, GLint format, GLenum type)
{
glDeleteTextures(1, texture);
+5 -1
View File
@@ -39,6 +39,8 @@
#include "GUI/ButtonSystem.h"
#include "Game/Systems/MainMenuSystem.h"
#include "Game/Systems/ServerListSystem.h"
#include "Game/Systems/StartSystem.h"
#include "Rendering/TextureSprite.h"
Game::Game(int argc, char* argv[])
@@ -50,6 +52,7 @@ Game::Game(int argc, char* argv[])
ResourceManager::RegisterType<Model>("Model");
ResourceManager::RegisterType<RawModel>("RawModel");
ResourceManager::RegisterType<Texture>("Texture");
ResourceManager::RegisterType<TextureSprite>("TextureSprite");
ResourceManager::RegisterType<PNG>("Png");
ResourceManager::RegisterType<ShaderProgram>("ShaderProgram");
ResourceManager::RegisterType<EntityFile>("EntityFile");
@@ -153,6 +156,7 @@ Game::Game(int argc, char* argv[])
m_SystemPipeline->AddSystem<ScoreScreenSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<SpectatorCameraSystem>(updateOrderLevel);
m_SystemPipeline->AddSystem<ServerListSystem>(updateOrderLevel, m_Renderer);
m_SystemPipeline->AddSystem<StartSystem>(updateOrderLevel);
// Populate Octree with collidables
++updateOrderLevel;
m_SystemPipeline->AddSystem<FillOctreeSystem>(updateOrderLevel, m_OctreeCollision, "Collidable");
@@ -215,7 +219,7 @@ void Game::Tick()
PerformanceTimer::StartTimerAndStopPrevious("InputProxy");
m_InputProxy->Update(dt);
m_EventBroker->Swap();
m_InputProxy->Process();
m_InputProxy->Process(ImGui::GetIO().WantCaptureKeyboard || ImGui::GetIO().WantCaptureMouse);
m_EventBroker->Swap();
PerformanceTimer::StartTimerAndStopPrevious("SoundManager");
@@ -15,7 +15,9 @@ bool MultiplayerSnapshotFilter::FilterComponent(EntityWrapper entity, SharedComp
|| component.Info.Name == "AssaultWeapon"
|| component.Info.Name == "DefenderWeapon"
|| component.Info.Name == "Animation"
|| component.Info.Name == "AnimationOffset"
|| component.Info.Name == "Blend"
|| component.Info.Name == "BlendAdditive"
|| component.Info.Name == "BlendOverride"
|| entity.Name() == "PlayerName"
) {
return false;
+1 -1
View File
@@ -8,7 +8,7 @@ DamageIndicatorSystem::DamageIndicatorSystem(SystemParams params)
EVENT_SUBSCRIBE_MEMBER(m_ESetCamera, &DamageIndicatorSystem::OnSetCamera);
//load texture to cache
auto texture = CommonFunctions::LoadTexture("Textures/DamageIndicator.png", false);
auto texture = CommonFunctions::TryLoadResource<Texture, false>("Textures/DamageIndicator.png");
auto entityFile = ResourceManager::Load<EntityXMLFile>("Schema/Entities/DamageIndicator.xml");
m_NetworkEnabled = ResourceManager::Load<ConfigFile>("Config.ini")->Get("Networking.StartNetwork", false);
}
+10 -6
View File
@@ -2,13 +2,17 @@
void ExplosionEffectSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
{
if ((double)component["TimeSinceDeath"] > (double)component["ExplosionDuration"]) {
(double)component["TimeSinceDeath"] = 0.f;
double& delay = (double)component["Delay"];
if (delay > 0) {
delay = std::max(0.0, delay - dt);
}
(double&)component["TimeSinceDeath"] += dt;
//if ((bool)Component["Gravity"] == true) {
// (bool)Component["ExponentialAccelaration"] = false;
//}
if (delay <= 0) {
double& timeSinceDeath = component["TimeSinceDeath"];
timeSinceDeath += (double)component["Speed"] * dt;
if (timeSinceDeath < 0 || timeSinceDeath > (double)component["ExplosionDuration"]) {
timeSinceDeath = 0.0;
}
}
}
-1
View File
@@ -82,7 +82,6 @@ bool MainMenuSystem::OnInputCommand(const Events::InputCommand& e)
}
} else {
//Serverlist submenu is open, close it.
printf("\n\nMenuShit\n\n");
m_World->DeleteEntity(m_OpenSubMenu.ID);
m_OpenSubMenu = EntityWrapper::Invalid;
}
+33
View File
@@ -0,0 +1,33 @@
#include "../Game/Systems/StartSystem.h"
StartSystem::StartSystem(SystemParams params)
: System(params)
, ImpureSystem()
{
EVENT_SUBSCRIBE_MEMBER(m_ECameraActivated, &StartSystem::OnCameraActivated);
}
void StartSystem::Update(double dt)
{
auto cameras = m_World->GetComponents("Camera");
if(cameras == nullptr) {
return;
}
for(auto& cCamera: *cameras) {
EntityWrapper cameraEntity = EntityWrapper(m_World, cCamera.EntityID);
if(cameraEntity == m_ActiveCamera){
return;
}
if(cameraEntity.Name() == "Overview_Camera_Start_Menu") {
Events::SetCamera event;
event.CameraEntity = cameraEntity;
m_EventBroker->Publish(event);
}
}
}
bool StartSystem::OnCameraActivated(const Events::SetCamera& e)
{
m_ActiveCamera = e.CameraEntity;
return 1;
}
+10 -6
View File
@@ -7,17 +7,21 @@ void TextFieldReader::UpdateComponent(EntityWrapper& entity, ComponentWrapper& c
}
// Find the entity to read from
const std::string& parentEntityName = cAmmunitionHUD["ParentEntityName"];
const std::string& entityName = cAmmunitionHUD["ParentEntityName"];
const std::string& componentType = cAmmunitionHUD["ComponentType"];
EntityWrapper readEntity = entity;
if (!parentEntityName.empty()) {
readEntity = entity.FirstParentByName(parentEntityName);
if (!readEntity.Valid()) {
return;
if (entityName.empty()) {
if (!readEntity.HasComponent(componentType)) {
readEntity = readEntity.FirstParentWithComponent(componentType);
}
} else {
readEntity = entity.FirstParentByName(entityName);
}
if (!readEntity.Valid()) {
return;
}
// Find the component to read from
const std::string& componentType = cAmmunitionHUD["ComponentType"];
if (componentType.empty() || !readEntity.HasComponent(componentType)) {
return;
}
@@ -40,12 +40,16 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
magAmmo = glm::min(magSize, ammo);
isReloading = false;
if (wi.FirstPersonEntity.Valid()) {
wi.FirstPersonEntity["Model"]["Visible"] = true;
wi.FirstPersonEntity.FirstChildByName("ViewModel")["Model"]["Visible"] = true;
}
if (wi.ThirdPersonEntity.Valid()) {
wi.ThirdPersonEntity["Model"]["Visible"] = true;
}
}
double reloadTime = cWeapon["ReloadTime"];
if (isReloading && reloadTimer <= reloadTime / 2) {
}
// Restore view angle
if (IsClient) {
@@ -68,7 +72,7 @@ void AssaultWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
const float& movementSpeed = cPlayer["MovementSpeed"];
float speed = glm::length((const glm::vec3&)cPhysics["Velocity"]);
float animationWeight = glm::min(speed, movementSpeed) / movementSpeed;
EntityWrapper rootNode = wi.FirstPersonEntity.FirstParentWithComponent("Model");
EntityWrapper rootNode = wi.FirstPersonEntity;
if (rootNode.Valid()) {
EntityWrapper blend = rootNode.FirstChildByName("MovementBlend");
if (blend.Valid()) {
@@ -121,19 +125,40 @@ void AssaultWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi)
reloadTimer = reloadTime;
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Reload");
if (IsClient) {
// Spawn explosion effect
EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("FirstPersonReloadSpawner");
if (reloadEffectSpawner.Valid()) {
SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner);
playAnimationAndReturn(wi.FirstPersonEntity, "ActionBlend", "Reload");
// Third person anim
Events::AutoAnimationBlend b1;
b1.RootNode = wi.ThirdPersonPlayerModel;
b1.NodeName = "Reload";
b1.Restart = true;
b1.Start = true;
m_EventBroker->Publish(b1);
Events::AutoAnimationBlend b2;
b2.RootNode = wi.ThirdPersonPlayerModel;
b2.NodeName = "MovementBlend";
b2.AnimationEntity = wi.ThirdPersonPlayerModel.FirstChildByName("AssaultWeaponBlend").FirstChildByName("Reload");
m_EventBroker->Publish(b2);
// Spawn explosion effect
if (wi.FirstPersonEntity.Valid()) {
if (IsClient) {
EntityWrapper reloadEffectSpawner = wi.FirstPersonEntity.FirstChildByName("ReloadSpawner");
if (reloadEffectSpawner.Valid()) {
reloadEffectSpawner.DeleteChildren();
SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner);
}
}
if (wi.FirstPersonEntity.Valid()) {
wi.FirstPersonEntity["Model"]["Visible"] = false;
}
if (wi.ThirdPersonEntity.Valid()) {
wi.ThirdPersonEntity["Model"]["Visible"] = false;
wi.FirstPersonEntity.FirstChildByName("ViewModel")["Model"]["Visible"] = false;
}
if (wi.ThirdPersonEntity.Valid()) {
if (IsServer) {
EntityWrapper reloadEffectSpawner = wi.ThirdPersonEntity.FirstChildByName("ReloadSpawner");
if (reloadEffectSpawner.Valid()) {
reloadEffectSpawner.DeleteChildren();
SpawnerSystem::Spawn(reloadEffectSpawner, reloadEffectSpawner);
}
}
wi.ThirdPersonEntity["Model"]["Visible"] = false;
}
// Sound
@@ -190,7 +215,7 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
}
// Get weapon model based on current person
EntityWrapper weaponModelEntity = getRelevantWeaponModelEntity(wi);
EntityWrapper weaponModelEntity = getRelevantWeaponEntity(wi);
if (!weaponModelEntity.Valid()) {
return;
}
@@ -221,7 +246,19 @@ void AssaultWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
}
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeAssaultWeapon", "Fire");
playAnimationAndReturn(wi.FirstPersonEntity, "ActionBlend", "Fire");
// Third person anim
Events::AutoAnimationBlend b1;
b1.RootNode = wi.ThirdPersonPlayerModel;
b1.NodeName = "Fire";
b1.Restart = true;
b1.Start = true;
m_EventBroker->Publish(b1);
Events::AutoAnimationBlend b2;
b2.RootNode = wi.ThirdPersonPlayerModel;
b2.NodeName = "MovementBlend";
b2.AnimationEntity = wi.ThirdPersonPlayerModel.FirstChildByName("AssaultWeaponBlend").FirstChildByName("Fire");
m_EventBroker->Publish(b2);
// Sound
Events::PlaySoundOnEntity e;
@@ -36,7 +36,7 @@ void DefenderWeaponBehaviour::UpdateWeapon(ComponentWrapper cWeapon, WeaponInfo&
m_EventBroker->Publish(e);
} else {
isReloading = false;
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Idle");
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "ReloadEnd");
}
}
@@ -99,7 +99,21 @@ void DefenderWeaponBehaviour::OnReload(ComponentWrapper cWeapon, WeaponInfo& wi)
reloadTimer = reloadTime;
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Reload");
if (wi.FirstPersonEntity.Valid()) {
Events::AutoAnimationBlend eBlendStart;
eBlendStart.RootNode = wi.FirstPersonEntity;
eBlendStart.NodeName = "ReloadStart";
eBlendStart.Restart = true;
eBlendStart.Start = true;
m_EventBroker->Publish(eBlendStart);
Events::AutoAnimationBlend eBlendLoop;
eBlendLoop.RootNode = wi.FirstPersonEntity;
eBlendLoop.NodeName = "ReloadLoop";
eBlendLoop.Restart = true;
eBlendLoop.Start = true;
eBlendLoop.AnimationEntity = wi.FirstPersonEntity.FirstChildByName("ReloadStart");
m_EventBroker->Publish(eBlendLoop);
}
}
void DefenderWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi)
@@ -114,17 +128,18 @@ void DefenderWeaponBehaviour::OnHolster(ComponentWrapper cWeapon, WeaponInfo& wi
bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInfo& wi, const Events::InputCommand& e)
{
if (e.Command == "SpecialAbility" && IsServer) {
if (e.Command == "SpecialAbility") {
EntityWrapper attachment = wi.Player.FirstChildByName("ShieldAttachment");
if (attachment.Valid()) {
if (e.Value > 0) {
SpawnerSystem::Spawn(attachment, attachment);
if (IsServer) {
SpawnerSystem::Spawn(attachment, attachment);
}
EntityWrapper root = wi.FirstPersonEntity.FirstParentWithComponent("Model");
if (root.Valid()) {
EntityWrapper subTree = root.FirstChildByName("FinalBlend");
if (subTree.Valid()) {
EntityWrapper animationNode = subTree.FirstChildByName("Shield");
if (IsClient) {
EntityWrapper root = wi.FirstPersonEntity;
if (root.Valid()) {
EntityWrapper animationNode = root.FirstChildByName("Shield");
if (animationNode.Valid()) {
Events::AutoAnimationBlend eFireBlend;
eFireBlend.RootNode = root;
@@ -138,11 +153,10 @@ bool DefenderWeaponBehaviour::OnInputCommand(ComponentWrapper cWeapon, WeaponInf
} else {
attachment.DeleteChildren();
EntityWrapper root = wi.FirstPersonEntity.FirstParentWithComponent("Model");
if (root.Valid()) {
EntityWrapper subTree = root.FirstChildByName("FinalBlend");
if (subTree.Valid()) {
EntityWrapper animationNode = subTree.FirstChildByName("ActionBlend");
if (IsClient) {
EntityWrapper root = wi.FirstPersonEntity;
if (root.Valid()) {
EntityWrapper animationNode = root.FirstChildByName("ActionBlend");
if (animationNode.Valid()) {
Events::AutoAnimationBlend eFireBlend;
eFireBlend.RootNode = root;
@@ -232,7 +246,7 @@ void DefenderWeaponBehaviour::fireShell(ComponentWrapper cWeapon, WeaponInfo& wi
}
// Play animation
playAnimationAndReturn(wi.FirstPersonEntity, "BlendTreeDefenderWeapon", "Fire");
playAnimationAndReturn(wi.FirstPersonEntity, "FinalBlend", "Fire");
// Sound
Events::PlaySoundOnEntity e;
@@ -52,7 +52,7 @@ void SidearmWeaponBehaviour::fireBullet(ComponentWrapper cWeapon, WeaponInfo& wi
cWeapon["FireCooldown"] = 60.0 / (double)cWeapon["RPM"];
// Get weapon model based on current person
EntityWrapper weaponModelEntity = getRelevantWeaponModelEntity(wi);
EntityWrapper weaponModelEntity = getRelevantWeaponEntity(wi);
if (!weaponModelEntity.Valid()) {
return;
}