Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/simulation2/components/CCmpProjectileManager.cpp
/* Copyright (C) 2017 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 99 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(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, const CFrustum& frustum, bool culling, | ||||
ICmpRangeManager::CLosQuerier los, bool losRevealAll) const; | const ICmpRangeManager::CLosQuerier& los, bool losRevealAll) const; | ||||
private: | private: | ||||
struct Projectile | struct Projectile | ||||
{ | { | ||||
CUnit* unit; | CUnit* unit; | ||||
CVector3D origin; | CVector3D origin; | ||||
CVector3D pos; | CVector3D pos; | ||||
CVector3D v; | CVector3D v; | ||||
▲ Show 20 Lines • Show All 227 Lines • ▼ Show 20 Lines | if (m_Projectiles[i].id == id) | ||||
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(CModelAbstract& model, const CVector3D& position, SceneCollector& collector, | ||||
const CFrustum& frustum, bool culling, ICmpRangeManager::CLosQuerier los, bool losRevealAll) const | const CFrustum& frustum, bool culling, const ICmpRangeManager::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; | ||||
model.ValidatePosition(); | model.ValidatePosition(); | ||||
Show All 27 Lines |
Wildfire Games · Phabricator