PGE API 0.4
PR00F's Game Engine full documentation
|
Bullet class for PR00F's Game Engine Weapon Manager. More...
Bullet class for PR00F's Game Engine Weapon Manager.
Definition at line 34 of file WeaponManager.h.
#include <WeaponManager.h>
Public Types | |
enum | ParticleType { None , Smoke } |
enum | DamageAreaEffect { Constant , Linear } |
typedef uint32_t | BulletId |
Public Member Functions | |
Bullet (const WeaponId &wpnId, PR00FsUltimateRenderingEngine &gfx, pge_network::PgeNetworkConnectionHandle connHandle, TPureFloat wpn_px, TPureFloat wpn_py, TPureFloat wpn_pz, TPureFloat wpn_ax, TPureFloat wpn_ay, TPureFloat wpn_az, bool visible, TPureFloat sx, TPureFloat sy, TPureFloat sz, TPureFloat speed, TPureFloat gravity, TPureFloat drag, TPureBool fragile, TPureFloat fDistMax, const ParticleType &particleType, int nDamageAp, int nDamageHp, TPureFloat fDamageAreaSize, const DamageAreaEffect &eDamageAreaEffect, TPureFloat fDamageAreaPulse) | |
Ctor to be used by PGE server instance. | |
Bullet (const WeaponId &wpnId, PR00FsUltimateRenderingEngine &gfx, TPureFloat wpn_px, TPureFloat wpn_py, TPureFloat wpn_pz, TPureFloat wpn_ax, TPureFloat wpn_ay, TPureFloat wpn_az, bool visible, TPureFloat sx, TPureFloat sy, TPureFloat sz, TPureFloat speed, TPureFloat gravity, TPureFloat drag, const ParticleType &particleType, int nDamageHp, const TPureFloat &fDamageAreaSize, const DamageAreaEffect &eDamageAreaEffect, const TPureFloat &fDamageAreaPulse) | |
Ctor to be used by PGE client instance. | |
virtual | ~Bullet () |
User is expected to explicitly call Bullet::destroyReferenceObject() after they freed up all Bullet instances. | |
Bullet (const Bullet &)=delete | |
Bullet & | operator= (const Bullet &)=delete |
Bullet (Bullet &&)=delete | |
Bullet & | operator= (Bullet &&)=delete |
CConsole & | getConsole () const |
Returns access to console preset with logger module name as this class. | |
BulletId | getId () const |
const WeaponId & | getWeaponId () const |
pge_network::PgeNetworkConnectionHandle | getOwner () const |
const PurePosUpTarget & | getPut () const |
TPureFloat | getSpeed () const |
TPureFloat | getGravity () const |
TPureFloat | getDrag () const |
TPureBool | isFragile () const |
const ParticleType & | getParticleType () const |
int & | getParticleEmitPerNthPhysicsIterationCntr () |
const int & | getParticleEmitPerNthPhysicsIterationCntr () const |
int & | getParticlesEmittedTotal () |
const int & | getParticlesEmittedTotal () const |
TPureFloat | getTravelDistanceMax () const |
TPureFloat | getTravelledDistance () const |
int | getDamageAp () const |
Maximum damage to Player AP this bullet can cause. | |
int | getDamageHp () const |
Maximum damage to Player HP this bullet can cause. | |
TPureFloat | getAreaDamageSize () const |
const DamageAreaEffect & | getAreaDamageEffect () const |
TPureFloat | getAreaDamagePulse () const |
bool & | isCreateSentToClients () |
void | init (const WeaponId &wpnId, PR00FsUltimateRenderingEngine &gfx, pge_network::PgeNetworkConnectionHandle connHandle, TPureFloat wpn_px, TPureFloat wpn_py, TPureFloat wpn_pz, TPureFloat wpn_ax, TPureFloat wpn_ay, TPureFloat wpn_az, bool visible, TPureFloat sx, TPureFloat sy, TPureFloat sz, TPureFloat speed, TPureFloat gravity, TPureFloat drag, TPureBool fragile, TPureFloat fDistMax, const ParticleType &particleType, int nDamageAp, int nDamageHp, TPureFloat fDamageAreaSize, const DamageAreaEffect &eDamageAreaEffect, TPureFloat fDamageAreaPulse) |
Init to be used by PGE server instance. | |
void | init (const BulletId &id, const WeaponId &wpnId, PR00FsUltimateRenderingEngine &gfx, TPureFloat wpn_px, TPureFloat wpn_py, TPureFloat wpn_pz, TPureFloat wpn_ax, TPureFloat wpn_ay, TPureFloat wpn_az, bool visible, TPureFloat sx, TPureFloat sy, TPureFloat sz, TPureFloat speed, TPureFloat gravity, TPureFloat drag, const ParticleType &particleType, int nDamageHp, TPureFloat fDamageAreaSize, const DamageAreaEffect &eDamageAreaEffect, TPureFloat fDamageAreaPulse) |
Init to be used by PGE client instance. | |
void | Update (const unsigned int &nFactor) |
PureObject3D & | getObject3D () |
const PureObject3D & | getObject3D () const |
Static Public Member Functions | |
static const char * | getLoggerModuleName () |
Returns the logger module name of this class. | |
static BulletId | getGlobalBulletId () |
static void | resetGlobalBulletId () |
static void | destroyReferenceObject () |
Private Member Functions | |
void | build3dObject () |
Private Attributes | |
BulletId | m_id |
Unique bullet id for identifying. | |
WeaponId | m_wpnId |
Unique weapon id. | |
PR00FsUltimateRenderingEngine & | m_gfx |
pge_network::PgeNetworkConnectionHandle | m_connHandle |
Owner (shooter) of this bullet. | |
PurePosUpTarget | m_put |
PUT to calculate next position. | |
TPureFloat | m_speed |
Speed as defined by weapon file. | |
TPureFloat | m_gravity |
Gravity as defined by weapon file. | |
TPureFloat | m_drag |
Drag as defined by weapon file. | |
TPureBool | m_fragile |
Fragile flag as defined by weapon file. | |
TPureFloat | m_fDistMax |
Max distance as defined by weapon file. | |
TPureFloat | m_fDistTravelled |
Distance travelled so far. | |
ParticleType | m_particleType |
Emitted particle type. | |
int | m_nParticleEmitPerNthPhysicsIterCntr |
Counter to be used by particle emitter logic. | |
int | m_nParticlesEmittedCurrent |
Counter to be used by particle emitter logic. | |
int | m_nDamageAp |
Damage to AP as defined by weapon file. | |
int | m_nDamageHp |
Damage to HP as defined by weapon file. | |
TPureFloat | m_fDamageAreaSize |
Area damage size as defined by weapon file. | |
DamageAreaEffect | m_eDamageAreaEffect |
Area damage effect as defined by weapon file. | |
TPureFloat | m_fDamageAreaPulse |
Area damage pulse to HP as defined by weapon file. | |
PureObject3D * | m_obj |
Associated Pure object to be rendered. | |
bool | m_bCreateSentToClients |
Server should send update to clients about creation of new bullets. | |
Static Private Attributes | |
static BulletId | m_globalBulletId = 0 |
Next unique bullet id for identifying. | |
static PureObject3D * | m_pObjRef = nullptr |
Reference object for cloned bullet objects. | |
uint32_t Bullet::BulletId |
Definition at line 58 of file WeaponManager.h.
Enumerator | |
---|---|
Constant | |
Linear |
Definition at line 47 of file WeaponManager.h.
enum Bullet::ParticleType |
Enumerator | |
---|---|
None | |
Smoke |
Definition at line 41 of file WeaponManager.h.
Bullet::Bullet | ( | const WeaponId & | wpnId, |
PR00FsUltimateRenderingEngine & | gfx, | ||
pge_network::PgeNetworkConnectionHandle | connHandle, | ||
TPureFloat | wpn_px, | ||
TPureFloat | wpn_py, | ||
TPureFloat | wpn_pz, | ||
TPureFloat | wpn_ax, | ||
TPureFloat | wpn_ay, | ||
TPureFloat | wpn_az, | ||
bool | visible, | ||
TPureFloat | sx, | ||
TPureFloat | sy, | ||
TPureFloat | sz, | ||
TPureFloat | speed, | ||
TPureFloat | gravity, | ||
TPureFloat | drag, | ||
TPureBool | fragile, | ||
TPureFloat | fDistMax, | ||
const ParticleType & | particleType, | ||
int | nDamageAp, | ||
int | nDamageHp, | ||
TPureFloat | fDamageAreaSize, | ||
const DamageAreaEffect & | eDamageAreaEffect, | ||
TPureFloat | fDamageAreaPulse ) |
Ctor to be used by PGE server instance.
Definition at line 53 of file WeaponManager.cpp.
Bullet::Bullet | ( | const WeaponId & | wpnId, |
PR00FsUltimateRenderingEngine & | gfx, | ||
TPureFloat | wpn_px, | ||
TPureFloat | wpn_py, | ||
TPureFloat | wpn_pz, | ||
TPureFloat | wpn_ax, | ||
TPureFloat | wpn_ay, | ||
TPureFloat | wpn_az, | ||
bool | visible, | ||
TPureFloat | sx, | ||
TPureFloat | sy, | ||
TPureFloat | sz, | ||
TPureFloat | speed, | ||
TPureFloat | gravity, | ||
TPureFloat | drag, | ||
const ParticleType & | particleType, | ||
int | nDamageHp, | ||
const TPureFloat & | fDamageAreaSize, | ||
const DamageAreaEffect & | eDamageAreaEffect, | ||
const TPureFloat & | fDamageAreaPulse ) |
Ctor to be used by PGE client instance.
Definition at line 96 of file WeaponManager.cpp.
|
virtual |
User is expected to explicitly call Bullet::destroyReferenceObject() after they freed up all Bullet instances.
PGE also calls it when destroying the game, but the game might do it based on their use case.
Definition at line 134 of file WeaponManager.cpp.
|
delete |
|
delete |
|
private |
Definition at line 414 of file WeaponManager.cpp.
|
static |
Definition at line 40 of file WeaponManager.cpp.
const Bullet::DamageAreaEffect & Bullet::getAreaDamageEffect | ( | ) | const |
Definition at line 254 of file WeaponManager.cpp.
TPureFloat Bullet::getAreaDamagePulse | ( | ) | const |
Definition at line 259 of file WeaponManager.cpp.
TPureFloat Bullet::getAreaDamageSize | ( | ) | const |
Definition at line 249 of file WeaponManager.cpp.
CConsole & Bullet::getConsole | ( | ) | const |
Returns access to console preset with logger module name as this class.
Definition at line 142 of file WeaponManager.cpp.
int Bullet::getDamageAp | ( | ) | const |
Maximum damage to Player AP this bullet can cause.
Definition at line 227 of file WeaponManager.cpp.
int Bullet::getDamageHp | ( | ) | const |
Maximum damage to Player HP this bullet can cause.
It is the game's responsibility to calculate actual damage to player. A recommendation I was also doing in PRooFPS v0.2.7:
Definition at line 244 of file WeaponManager.cpp.
TPureFloat Bullet::getDrag | ( | ) | const |
Definition at line 177 of file WeaponManager.cpp.
|
static |
Definition at line 30 of file WeaponManager.cpp.
TPureFloat Bullet::getGravity | ( | ) | const |
Definition at line 172 of file WeaponManager.cpp.
Bullet::BulletId Bullet::getId | ( | ) | const |
Definition at line 147 of file WeaponManager.cpp.
|
static |
Returns the logger module name of this class.
Definition at line 25 of file WeaponManager.cpp.
PureObject3D & Bullet::getObject3D | ( | ) |
Definition at line 404 of file WeaponManager.cpp.
const PureObject3D & Bullet::getObject3D | ( | ) | const |
Definition at line 409 of file WeaponManager.cpp.
pge_network::PgeNetworkConnectionHandle Bullet::getOwner | ( | ) | const |
Definition at line 157 of file WeaponManager.cpp.
int & Bullet::getParticleEmitPerNthPhysicsIterationCntr | ( | ) |
Definition at line 192 of file WeaponManager.cpp.
const int & Bullet::getParticleEmitPerNthPhysicsIterationCntr | ( | ) | const |
Definition at line 197 of file WeaponManager.cpp.
int & Bullet::getParticlesEmittedTotal | ( | ) |
Definition at line 202 of file WeaponManager.cpp.
const int & Bullet::getParticlesEmittedTotal | ( | ) | const |
Definition at line 208 of file WeaponManager.cpp.
const Bullet::ParticleType & Bullet::getParticleType | ( | ) | const |
Definition at line 187 of file WeaponManager.cpp.
const PurePosUpTarget & Bullet::getPut | ( | ) | const |
Definition at line 162 of file WeaponManager.cpp.
TPureFloat Bullet::getSpeed | ( | ) | const |
Definition at line 167 of file WeaponManager.cpp.
TPureFloat Bullet::getTravelDistanceMax | ( | ) | const |
Definition at line 214 of file WeaponManager.cpp.
TPureFloat Bullet::getTravelledDistance | ( | ) | const |
Definition at line 219 of file WeaponManager.cpp.
const WeaponId & Bullet::getWeaponId | ( | ) | const |
Definition at line 152 of file WeaponManager.cpp.
void Bullet::init | ( | const BulletId & | id, |
const WeaponId & | wpnId, | ||
PR00FsUltimateRenderingEngine & | gfx, | ||
TPureFloat | wpn_px, | ||
TPureFloat | wpn_py, | ||
TPureFloat | wpn_pz, | ||
TPureFloat | wpn_ax, | ||
TPureFloat | wpn_ay, | ||
TPureFloat | wpn_az, | ||
bool | visible, | ||
TPureFloat | sx, | ||
TPureFloat | sy, | ||
TPureFloat | sz, | ||
TPureFloat | speed, | ||
TPureFloat | gravity, | ||
TPureFloat | drag, | ||
const ParticleType & | particleType, | ||
int | nDamageHp, | ||
TPureFloat | fDamageAreaSize, | ||
const DamageAreaEffect & | eDamageAreaEffect, | ||
TPureFloat | fDamageAreaPulse ) |
Init to be used by PGE client instance.
This also gets invoked by PgeObjectPool::create() when PooledBullet instances are stored there.
Definition at line 338 of file WeaponManager.cpp.
void Bullet::init | ( | const WeaponId & | wpnId, |
PR00FsUltimateRenderingEngine & | gfx, | ||
pge_network::PgeNetworkConnectionHandle | connHandle, | ||
TPureFloat | wpn_px, | ||
TPureFloat | wpn_py, | ||
TPureFloat | wpn_pz, | ||
TPureFloat | wpn_ax, | ||
TPureFloat | wpn_ay, | ||
TPureFloat | wpn_az, | ||
bool | visible, | ||
TPureFloat | sx, | ||
TPureFloat | sy, | ||
TPureFloat | sz, | ||
TPureFloat | speed, | ||
TPureFloat | gravity, | ||
TPureFloat | drag, | ||
TPureBool | fragile, | ||
TPureFloat | fDistMax, | ||
const ParticleType & | particleType, | ||
int | nDamageAp, | ||
int | nDamageHp, | ||
TPureFloat | fDamageAreaSize, | ||
const DamageAreaEffect & | eDamageAreaEffect, | ||
TPureFloat | fDamageAreaPulse ) |
Init to be used by PGE server instance.
This also gets invoked by PgeObjectPool::create() when PooledBullet instances are stored there.
Definition at line 269 of file WeaponManager.cpp.
bool & Bullet::isCreateSentToClients | ( | ) |
Definition at line 264 of file WeaponManager.cpp.
TPureBool Bullet::isFragile | ( | ) | const |
Definition at line 182 of file WeaponManager.cpp.
|
static |
Definition at line 35 of file WeaponManager.cpp.
void Bullet::Update | ( | const unsigned int & | nFactor | ) |
Definition at line 376 of file WeaponManager.cpp.
|
private |
Server should send update to clients about creation of new bullets.
By default false, client ignores.
Definition at line 262 of file WeaponManager.h.
|
private |
Owner (shooter) of this bullet.
Used by PGE server instance only.
Definition at line 242 of file WeaponManager.h.
|
private |
Drag as defined by weapon file.
Used by both PGE client and server instances.
Definition at line 246 of file WeaponManager.h.
|
private |
Area damage effect as defined by weapon file.
Used by both PGE client and server instances.
Definition at line 256 of file WeaponManager.h.
|
private |
Area damage pulse to HP as defined by weapon file.
Used by both PGE client and server instances.
Definition at line 257 of file WeaponManager.h.
|
private |
Area damage size as defined by weapon file.
Used by both PGE client and server instances.
Definition at line 255 of file WeaponManager.h.
|
private |
Max distance as defined by weapon file.
Used by PGE server instance only.
Definition at line 248 of file WeaponManager.h.
|
private |
Distance travelled so far.
Used by both PGE client and server instances.
Definition at line 249 of file WeaponManager.h.
|
private |
Fragile flag as defined by weapon file.
Used by PGE server instance only.
Definition at line 247 of file WeaponManager.h.
|
private |
Definition at line 241 of file WeaponManager.h.
|
staticprivate |
Next unique bullet id for identifying.
Used by PGE server instance only.
Definition at line 236 of file WeaponManager.h.
|
private |
Gravity as defined by weapon file.
Used by both PGE client and server instances.
Definition at line 245 of file WeaponManager.h.
|
private |
Unique bullet id for identifying.
Used by both PGE client and server instances.
Definition at line 239 of file WeaponManager.h.
|
private |
Damage to AP as defined by weapon file.
Used by PGE server instance only.
Definition at line 253 of file WeaponManager.h.
|
private |
Damage to HP as defined by weapon file.
Used by both PGE client and server instances.
Definition at line 254 of file WeaponManager.h.
|
private |
Counter to be used by particle emitter logic.
Used by both PGE client and server instances.
Definition at line 251 of file WeaponManager.h.
|
private |
Counter to be used by particle emitter logic.
Used by both PGE client and server instances.
Definition at line 252 of file WeaponManager.h.
|
private |
Associated Pure object to be rendered.
Used by PGE server and client instances. TODO: shared ptr would be better though, so deleting the obj earlier than bullet instance wouldn't be a problem.
Definition at line 259 of file WeaponManager.h.
|
private |
Emitted particle type.
Used by both PGE client and server instances.
Definition at line 250 of file WeaponManager.h.
|
staticprivate |
Reference object for cloned bullet objects.
Definition at line 237 of file WeaponManager.h.
|
private |
PUT to calculate next position.
Used by both PGE client and server instances.
Definition at line 243 of file WeaponManager.h.
|
private |
Speed as defined by weapon file.
Used by both PGE client and server instances.
Definition at line 244 of file WeaponManager.h.
|
private |
Unique weapon id.
Used by both PGE client and server instances.
Definition at line 240 of file WeaponManager.h.