mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
local work
This commit is contained in:
parent
949a6db4bc
commit
6240eefc7e
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
|
std::unordered_map<int32_t, float> RenderComponent::m_DurationCache{};
|
||||||
|
|
||||||
RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component(parent) {
|
RenderComponent::RenderComponent(Entity* parent, int32_t componentId) : Component(parent) {
|
||||||
m_Effects = std::vector<Effect*>();
|
m_Effects = std::vector<Effect*>();
|
||||||
m_LastAnimationName = "";
|
m_LastAnimationName = "";
|
||||||
if (componentId == -1) return;
|
if (componentId == -1) return;
|
||||||
@ -45,13 +45,10 @@ RenderComponent::RenderComponent(Entity* parent, int32_t componentId): Component
|
|||||||
|
|
||||||
RenderComponent::~RenderComponent() {
|
RenderComponent::~RenderComponent() {
|
||||||
for (Effect* eff : m_Effects) {
|
for (Effect* eff : m_Effects) {
|
||||||
if (eff) {
|
if (!eff) continue;
|
||||||
delete eff;
|
delete eff;
|
||||||
eff = nullptr;
|
eff = nullptr;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Effects.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||||
@ -59,9 +56,9 @@ void RenderComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitial
|
|||||||
|
|
||||||
outBitStream->Write<uint32_t>(m_Effects.size());
|
outBitStream->Write<uint32_t>(m_Effects.size());
|
||||||
|
|
||||||
for (Effect* eff : m_Effects) {
|
for (auto* eff : m_Effects) {
|
||||||
// Check that the effect is non-null
|
// Check that the effect is non-null
|
||||||
assert(eff);
|
DluAssert(eff);
|
||||||
|
|
||||||
outBitStream->Write<uint8_t>(eff->name.size());
|
outBitStream->Write<uint8_t>(eff->name.size());
|
||||||
for (const auto& value : eff->name)
|
for (const auto& value : eff->name)
|
||||||
@ -189,7 +186,6 @@ std::vector<Effect*>& RenderComponent::GetEffects() {
|
|||||||
return m_Effects;
|
return m_Effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float RenderComponent::PlayAnimation(Entity* self, const std::u16string& animation, float priority, float scale) {
|
float RenderComponent::PlayAnimation(Entity* self, const std::u16string& animation, float priority, float scale) {
|
||||||
if (!self) return 0.0f;
|
if (!self) return 0.0f;
|
||||||
return RenderComponent::PlayAnimation(self, GeneralUtils::UTF16ToWTF8(animation), priority, scale);
|
return RenderComponent::PlayAnimation(self, GeneralUtils::UTF16ToWTF8(animation), priority, scale);
|
||||||
@ -210,7 +206,6 @@ float RenderComponent::GetAnimationTime(Entity* self, const std::string& animati
|
|||||||
return RenderComponent::DoAnimation(self, animation, false);
|
return RenderComponent::DoAnimation(self, animation, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) {
|
float RenderComponent::DoAnimation(Entity* self, const std::string& animation, bool sendAnimation, float priority, float scale) {
|
||||||
float returnlength = 0.0f;
|
float returnlength = 0.0f;
|
||||||
if (!self) return returnlength;
|
if (!self) return returnlength;
|
||||||
|
@ -12,9 +12,6 @@ RigidbodyPhantomPhysicsComponent::RigidbodyPhantomPhysicsComponent(Entity* paren
|
|||||||
m_IsDirty = true;
|
m_IsDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
RigidbodyPhantomPhysicsComponent::~RigidbodyPhantomPhysicsComponent() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void RigidbodyPhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
void RigidbodyPhantomPhysicsComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags) {
|
||||||
outBitStream->Write(m_IsDirty || bIsInitialUpdate);
|
outBitStream->Write(m_IsDirty || bIsInitialUpdate);
|
||||||
if (m_IsDirty || bIsInitialUpdate) {
|
if (m_IsDirty || bIsInitialUpdate) {
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
* Copyright 2019
|
* Copyright 2019
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef RIGIDBODYPHANTOMPHYSICS_H
|
#ifndef __RIGIDBODYPHANTOMPHYSICS_H__
|
||||||
#define RIGIDBODYPHANTOMPHYSICS_H
|
#define __RIGIDBODYPHANTOMPHYSICS_H__
|
||||||
|
|
||||||
#include "BitStream.h"
|
#include "BitStream.h"
|
||||||
#include "dCommonVars.h"
|
#include "dCommonVars.h"
|
||||||
@ -22,7 +22,6 @@ public:
|
|||||||
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS;
|
inline static const eReplicaComponentType ComponentType = eReplicaComponentType::PHANTOM_PHYSICS;
|
||||||
|
|
||||||
RigidbodyPhantomPhysicsComponent(Entity* parent);
|
RigidbodyPhantomPhysicsComponent(Entity* parent);
|
||||||
~RigidbodyPhantomPhysicsComponent() override;
|
|
||||||
|
|
||||||
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate, unsigned int& flags);
|
||||||
|
|
||||||
@ -68,4 +67,4 @@ private:
|
|||||||
bool m_IsDirty;
|
bool m_IsDirty;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RIGIDBODYPHANTOMPHYSICS_H
|
#endif // __RIGIDBODYPHANTOMPHYSICS_H__
|
||||||
|
Loading…
Reference in New Issue
Block a user