Loading...
Searching...
No Matches
CObject Class Referenceabstract

Base class for all 3D in-game objects. More...

`#include <src/object/object.h>`

Inheritance diagram for CObject:
[legend]

## Public Member Functions

| CObject (const CObject &)=delete
CObject & | operator= (const CObject &)=delete
ObjectType | GetType () const
| Returns object type.
int | GetID () const
| Returns object's unique id.
virtual void | Write (CLevelParserLine *line)=0
| Writes object properties to line in level file.
virtual void | Read (CLevelParserLine *line)=0
| Reads object properties from line in level file.
virtual void | UpdateInterface ()
| Updates all interface controls.
bool | Implements (ObjectInterfaceType type) const
| Check if object implements the given type of interface.
virtual Math::Vector | GetPosition () const
| Returns object's position.
virtual void | SetPosition (const Math::Vector &pos)
| Sets object's position.
virtual Math::Vector | GetRotation () const
| Returns object's rotation (Euler angles).
virtual void | SetRotation (const Math::Vector &rotation)
| Sets object's rotation (Euler angles).
virtual Math::Vector | GetScale () const
| Returns object's scale.
virtual void | SetScale (const Math::Vector &scale)
| Sets objects's scale.
void | SetScale (float scale)
| Sets objects's scale (uniform value).
void | SetCrashSpheres (const std::vector< Gfx::ModelCrashSphere > &crashSpheres)
| Sets crash spheres for object.
void | AddCrashSphere (const CrashSphere &crashSphere)
| Adds a new crash sphere.
int | GetCrashSphereCount ()
| Returns total number of crash spheres.
CrashSphere | GetFirstCrashSphere ()
| Returns the first crash sphere (assumes it exists).
std::vector< CrashSphere > | GetAllCrashSpheres ()
| Returns all crash spheres.
void | DeleteAllCrashSpheres ()
| Removes all crash spheres.
bool | CanCollideWith (CObject *other)
| Returns true if this object can collide with the other one.
Math::Sphere | GetCameraCollisionSphere ()
| Returns sphere used to test for camera collisions.
void | SetCameraCollisionSphere (const Math::Sphere &sphere)
| Sets sphere used to test for camera collisions.
virtual void | SetTransparency (float value)=0
| Sets the transparency of object.
void | SetAnimateOnReset (bool animateOnReset)
| Sets flag controlling animation effect on level reset.
bool | GetAnimateOnReset ()
| Returns flag controlling animation effect on level reset.
void | SetCollisions (bool collisions)
| Turns object collisions on/off.
bool | GetCollisions ()
| Returns true if collisions are enabled.
void | SetTeam (int team)
| Sets object team (shouldn't be called after creation because the model won't update!).
int | GetTeam ()
| Returns object team.
void | SetProxyActivate (bool activate)
| Enable object activation only after you come close.
bool | GetProxyActivate ()
| Returns close activation mode.
void | SetProxyDistance (float distance)
| Sets distance for close activation.
float | GetProxyDistance ()
| Returns distance for close activation.
CBot::CBotVar * | GetBotVar ()
| Returns CBot "object" variable associated with this object.
std::string | GetTooltipText ()
| Returns tooltip text for an object.
void | SetLock (bool lock)
| Set "lock" mode of an object (for example, a robot while it's being factored, or a building while it's built).
bool | GetLock ()
| Return "lock" mode of an object.
virtual bool | GetActive ()
| Is this object active (not dead)?
virtual bool | GetDetectable ()
| Is this object detectable (not dead and not underground)?
virtual bool | IsBulletWall ()
void | SetRotationX (float angle)
void | SetRotationY (float angle)
void | SetRotationZ (float angle)
float | GetRotationX ()
float | GetRotationY ()
float | GetRotationZ ()
void | SetScaleX (float angle)
void | SetScaleY (float angle)
void | SetScaleZ (float angle)
float | GetScaleX ()
float | GetScaleY ()
float | GetScaleZ ()
Public Member Functions inherited from COldObjectInterface
virtual void | Simplify ()
virtual void | DeletePart (int part)
virtual void | SetType (ObjectType type)
virtual int | GetObjectRank (int part)
virtual int | GetOption ()
virtual void | SetDrawFront (bool bDraw)
virtual void | FloorAdjust ()
virtual void | SetLinVibration (Math::Vector dir)
virtual void | SetCirVibration (Math::Vector dir)
virtual Math::Vector | GetTilt ()
virtual void | SetMasterParticle (int part, int parti)
virtual Math::Matrix * | GetWorldMatrix (int part)
virtual Character * | GetCharacter ()
virtual void | FlatParent ()
virtual void | SetVirusMode (bool bEnable)
virtual bool | GetVirusMode ()
virtual CAuto * | GetAuto ()

## Static Public Member Functions

static ObjectCreateParams | ReadCreateParams (CLevelParserLine *line)
| Reads params required for object creation.

## Protected Member Functions

| CObject (int id, ObjectType type)
| Constructor only accessible to subclasses.
virtual void | TransformCrashSphere (Math::Sphere &crashSphere)=0
| Transform crash sphere by object's world matrix.
virtual void | TransformCameraCollisionSphere (Math::Sphere &collisionSphere)=0
| Transform crash sphere by object's world matrix.

## Protected Attributes

const int | m_id
| unique identifier
ObjectType | m_type
| object type
ObjectInterfaceTypes | m_implementedInterfaces
| interfaces that the object implements
Math::Vector | m_position
Math::Vector | m_rotation
Math::Vector | m_scale
std::vector< CrashSphere > | m_crashSpheres
| crash spheres
Math::Sphere | m_cameraCollisionSphere
bool | m_animateOnReset
bool | m_collisions
int | m_team
bool | m_proxyActivate
float | m_proxyDistance
CBot::CBotVar * | m_botVar
bool | m_lock

## Detailed Description

Base class for all 3D in-game objects.

CObject serves as a base class for all in-game objects, including:

- buildings,
- robots,
- astronaut,
- plants,
- aliens.

As every object has its specific behavior, there are or will be separate subclasses for each of the specific objects. For the time being, old object interface is still present, but its functions will be moved to appropriate subclasses with time. The new CObject interface implemented here will feature only functions common to all objects.

## Constructor & Destructor Documentation

## CObject()

CObject::CObject | ( | int | id,
|  | ObjectType | type )

protected

Constructor only accessible to subclasses.

## Member Function Documentation

## GetType()

ObjectType CObject::GetType | ( |  | ) | const

inline

Returns object type.

## GetID()

int CObject::GetID | ( |  | ) | const

inline

Returns object's unique id.

## Write()

virtual void CObject::Write | ( | CLevelParserLine * | line | ) |

pure virtual

Writes object properties to line in level file.

Implemented in CBaseAlien, CExchangePost, COldObject, CShielder, and CStaticObject.

## Read()

virtual void CObject::Read | ( | CLevelParserLine * | line | ) |

pure virtual

Reads object properties from line in level file.

Implemented in CBaseAlien, CExchangePost, COldObject, CShielder, and CStaticObject.

## ReadCreateParams()

ObjectCreateParams CObject::ReadCreateParams | ( | CLevelParserLine * | line | ) |

static

Reads params required for object creation.

## UpdateInterface()

virtual void CObject::UpdateInterface | ( |  | ) |

inline virtual

Updates all interface controls.

Reimplemented in COldObject.

## Implements()

bool CObject::Implements | ( | ObjectInterfaceType | type | ) | const

inline

Check if object implements the given type of interface.

## GetPosition()

Math::Vector CObject::GetPosition | ( |  | ) | const

virtual

Returns object's position.

Reimplemented in COldObject.

## SetPosition()

void CObject::SetPosition | ( | const Math::Vector & | pos | ) |

virtual

Sets object's position.

Reimplemented in COldObject.

## GetRotation()

Math::Vector CObject::GetRotation | ( |  | ) | const

virtual

Returns object's rotation (Euler angles).

Angles are given in radians

Reimplemented in COldObject.

## SetRotation()

void CObject::SetRotation | ( | const Math::Vector & | rotation | ) |

virtual

Sets object's rotation (Euler angles).

Angles are given in radians

Reimplemented in COldObject.

## SetRotationX()

void CObject::SetRotationX | ( | float | angle | ) |

Shortcuts for rotation components

## SetRotationY()

void CObject::SetRotationY | ( | float | angle | ) |

Shortcuts for rotation components

## SetRotationZ()

void CObject::SetRotationZ | ( | float | angle | ) |

Shortcuts for rotation components

## GetRotationX()

float CObject::GetRotationX | ( |  | ) |

Shortcuts for rotation components

## GetRotationY()

float CObject::GetRotationY | ( |  | ) |

Shortcuts for rotation components

## GetRotationZ()

float CObject::GetRotationZ | ( |  | ) |

Shortcuts for rotation components

## GetScale()

Math::Vector CObject::GetScale | ( |  | ) | const

virtual

Returns object's scale.

Reimplemented in COldObject.

## SetScale() [1/2]

void CObject::SetScale | ( | const Math::Vector & | scale | ) |

virtual

Sets objects's scale.

Reimplemented in COldObject.

## SetScale() [2/2]

void CObject::SetScale | ( | float | scale | ) |

Sets objects's scale (uniform value).

## SetScaleX()

void CObject::SetScaleX | ( | float | angle | ) |

Shortcuts for scale components

## SetScaleY()

void CObject::SetScaleY | ( | float | angle | ) |

Shortcuts for scale components

## SetScaleZ()

void CObject::SetScaleZ | ( | float | angle | ) |

Shortcuts for scale components

## GetScaleX()

float CObject::GetScaleX | ( |  | ) |

Shortcuts for scale components

## GetScaleY()

float CObject::GetScaleY | ( |  | ) |

Shortcuts for scale components

## GetScaleZ()

float CObject::GetScaleZ | ( |  | ) |

Shortcuts for scale components

## SetCrashSpheres()

void CObject::SetCrashSpheres | ( | const std::vector< Gfx::ModelCrashSphere > & | crashSpheres | ) |

Sets crash spheres for object.

## AddCrashSphere()

void CObject::AddCrashSphere | ( | const CrashSphere & | crashSphere | ) |

Adds a new crash sphere.

Crash sphere position is given in object coordinates

## GetCrashSphereCount()

int CObject::GetCrashSphereCount | ( |  | ) |

Returns total number of crash spheres.

## GetFirstCrashSphere()

CrashSphere CObject::GetFirstCrashSphere | ( |  | ) |

Returns the first crash sphere (assumes it exists).

Crash sphere position is returned in world coordinates

## GetAllCrashSpheres()

std::vector< CrashSphere > CObject::GetAllCrashSpheres | ( |  | ) |

Returns all crash spheres.

Crash sphere position is returned in world coordinates

## DeleteAllCrashSpheres()

void CObject::DeleteAllCrashSpheres | ( |  | ) |

Removes all crash spheres.

## CanCollideWith()

bool CObject::CanCollideWith | ( | CObject * | other | ) |

Returns true if this object can collide with the other one.

## GetCameraCollisionSphere()

Math::Sphere CObject::GetCameraCollisionSphere | ( |  | ) |

Returns sphere used to test for camera collisions.

## SetCameraCollisionSphere()

void CObject::SetCameraCollisionSphere | ( | const Math::Sphere & | sphere | ) |

Sets sphere used to test for camera collisions.

## SetTransparency()

virtual void CObject::SetTransparency | ( | float | value | ) |

pure virtual

Sets the transparency of object.

Implemented in COldObject, and CStaticObject.

## SetAnimateOnReset()

void CObject::SetAnimateOnReset | ( | bool | animateOnReset | ) |

Sets flag controlling animation effect on level reset.

## GetAnimateOnReset()

bool CObject::GetAnimateOnReset | ( |  | ) |

Returns flag controlling animation effect on level reset.

## SetCollisions()

void CObject::SetCollisions | ( | bool | collisions | ) |

Turns object collisions on/off.

## GetCollisions()

bool CObject::GetCollisions | ( |  | ) |

Returns true if collisions are enabled.

## SetTeam()

void CObject::SetTeam | ( | int | team | ) |

Sets object team (shouldn't be called after creation because the model won't update!).

## GetTeam()

int CObject::GetTeam | ( |  | ) |

Returns object team.

## SetProxyActivate()

void CObject::SetProxyActivate | ( | bool | activate | ) |

Enable object activation only after you come close.

## GetProxyActivate()

bool CObject::GetProxyActivate | ( |  | ) |

Returns close activation mode.

## SetProxyDistance()

void CObject::SetProxyDistance | ( | float | distance | ) |

Sets distance for close activation.

## GetProxyDistance()

float CObject::GetProxyDistance | ( |  | ) |

Returns distance for close activation.

## GetBotVar()

CBot::CBotVar * CObject::GetBotVar | ( |  | ) |

Returns CBot "object" variable associated with this object.

## GetTooltipText()

std::string CObject::GetTooltipText | ( |  | ) |

Returns tooltip text for an object.

## SetLock()

void CObject::SetLock | ( | bool | lock | ) |

Set "lock" mode of an object (for example, a robot while it's being factored, or a building while it's built).

## GetLock()

bool CObject::GetLock | ( |  | ) |

Return "lock" mode of an object.

## GetActive()

virtual bool CObject::GetActive | ( |  | ) |

inline virtual

Is this object active (not dead)?

Reimplemented in COldObject.

## GetDetectable()

virtual bool CObject::GetDetectable | ( |  | ) |

inline virtual

Is this object detectable (not dead and not underground)?

Reimplemented in COldObject.

## IsBulletWall()

virtual bool CObject::IsBulletWall | ( |  | ) |

inline virtual

Returns true if this object can collide with bullets even though it's not damageable itself This is useful to make Barriers protect from bullets

Todo
  It will work like this for now but later I'd like to refactor this to something more manageable ~krzys_h

Reimplemented in COldObject.

## TransformCrashSphere()

virtual void CObject::TransformCrashSphere | ( | Math::Sphere & | crashSphere | ) |

protected pure virtual

Transform crash sphere by object's world matrix.

Implemented in COldObject, and CStaticObject.

## TransformCameraCollisionSphere()

virtual void CObject::TransformCameraCollisionSphere | ( | Math::Sphere & | collisionSphere | ) |

protected pure virtual

Transform crash sphere by object's world matrix.

Implemented in COldObject, and CStaticObject.

## Member Data Documentation

## m_id

const int CObject::m_id

protected

unique identifier

## m_type

ObjectType CObject::m_type

protected

object type

## m_implementedInterfaces

ObjectInterfaceTypes CObject::m_implementedInterfaces

protected

interfaces that the object implements

## m_crashSpheres

std::vector<CrashSphere> CObject::m_crashSpheres

protected

crash spheres

The documentation for this class was generated from the following files:

- src/object/object.h
- src/object/object.cpp