Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpProjectileManager.cpp
Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | public: | ||||
virtual uint32_t LaunchProjectileAtPoint(const CFixedVector3D& launchPoint, const CFixedVector3D& target, fixed speed, fixed gravity, const std::wstring& actorName, const std::wstring& impactActorName, fixed impactAnimationLifetime) | virtual uint32_t LaunchProjectileAtPoint(const CFixedVector3D& launchPoint, const CFixedVector3D& target, fixed speed, fixed gravity, const std::wstring& actorName, const std::wstring& impactActorName, fixed impactAnimationLifetime) | ||||
{ | { | ||||
return LaunchProjectile(launchPoint, target, speed, gravity, actorName, impactActorName, impactAnimationLifetime); | return LaunchProjectile(launchPoint, target, speed, gravity, actorName, impactActorName, impactAnimationLifetime); | ||||
} | } | ||||
virtual void RemoveProjectile(uint32_t); | virtual void RemoveProjectile(uint32_t); | ||||
void RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, const CFrustum& frustum, bool culling, | void RenderModel(CSceneObject& model, const CVector3D& position, SceneCollector& collector, const CFrustum& frustum, bool culling, | ||||
const CLosQuerier& los, bool losRevealAll) const; | const CLosQuerier& los, bool losRevealAll) const; | ||||
private: | private: | ||||
struct Projectile | struct Projectile | ||||
{ | { | ||||
CUnit* unit; | CUnit* unit; | ||||
CVector3D origin; | CVector3D origin; | ||||
CVector3D pos; | CVector3D pos; | ||||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | if (m_Projectiles[i].id == id) | ||||
std::swap(m_Projectiles[i], m_Projectiles.back()); | std::swap(m_Projectiles[i], m_Projectiles.back()); | ||||
GetSimContext().GetUnitManager().DeleteUnit(m_Projectiles.back().unit); | GetSimContext().GetUnitManager().DeleteUnit(m_Projectiles.back().unit); | ||||
m_Projectiles.pop_back(); | m_Projectiles.pop_back(); | ||||
return; | return; | ||||
} | } | ||||
} | } | ||||
} | } | ||||
void CCmpProjectileManager::RenderModel(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, | void CCmpProjectileManager::RenderModel(CSceneObject& model, const CVector3D& position, SceneCollector& collector, | ||||
const CFrustum& frustum, bool culling, const CLosQuerier& los, bool losRevealAll) const | const CFrustum& frustum, bool culling, const CLosQuerier& los, bool losRevealAll) const | ||||
{ | { | ||||
// Don't display objects outside the visible area | // Don't display objects outside the visible area | ||||
ssize_t posi = (ssize_t)(0.5f + position.X / TERRAIN_TILE_SIZE); | ssize_t posi = (ssize_t)(0.5f + position.X / TERRAIN_TILE_SIZE); | ||||
ssize_t posj = (ssize_t)(0.5f + position.Z / TERRAIN_TILE_SIZE); | ssize_t posj = (ssize_t)(0.5f + position.Z / TERRAIN_TILE_SIZE); | ||||
if (!losRevealAll && !los.IsVisible(posi, posj)) | if (!losRevealAll && !los.IsVisible(posi, posj)) | ||||
return; | return; | ||||
Show All 28 Lines |
Wildfire Games · Phabricator