#include <cObject.h>
Classes | |
struct | rBase |
struct | rDamageable |
Encapsulates attributes related to body damage and armor state. More... | |
struct | rEntity |
Encapsulates thoughtful behavior attributes and code. More... | |
struct | rNameable |
Encapsulates Textual descriptive texts about an object. More... | |
struct | rSocialised |
Encapsulates social behavior related attributes (merge with entity?). More... | |
struct | rTraceable |
Encapsulates physical state as far as movement is concerned. More... | |
Public Types | |
enum | Roles { NAMEABLE, SOCIALISED, TRACEABLE, COLLIDEABLE, DAMAGEABLE, ENTITY, MECH, BUILDING, TREE, IMMOBILE, RED, BLUE, GREEN, YELLOW, CIVIL, WOUNDED, SERIOUS, CRITICAL, DEAD, HUMANPLAYER, FRAGGED, MAX_ROLES } |
Enumeration of roles an object may assume. | |
Public Member Functions | |
cObject (cObject *original) | |
bool | hasRole (Roles role) |
Check wether this Object is playing the given role. | |
void | addRole (Roles role) |
Add a role this objects has to play. | |
void | remRole (Roles role) |
Remove a role this object wont play anymore. | |
bool | hasAllied (Roles role) |
Check wether an object playing a certain role is an ally. | |
void | addAllied (Roles role) |
Add roles which allies of this object play. | |
void | remAllied (Roles role) |
Remove objects playing a certain role from ally list. | |
bool | hasEnemy (Roles role) |
Check wether an object playing a certain role is an enemy. | |
void | addEnemy (Roles role) |
Add roles which enemies of this object play. | |
void | remEnemy (Roles role) |
Remove objects playing a certain role from enemy list. | |
virtual void | onSpawn () |
Called right after object was spawned into the world. | |
virtual void | onMessage (void *message) |
Called when a message was sent to (a group) this object (is a member of). | |
virtual void | onFrag () |
Called right after object has been removed from object list and index. | |
virtual void | multEyeMatrix () |
glMultiplies in the Object's camera matrix. | |
virtual void | setAsAudioListener () |
Sets this Object's location, orientation and vel. as Audio listener. | |
virtual void | animate (float dt) |
Advance internal timers,animation state and pose, check gamepad. | |
virtual void | transform () |
Precalculate neccessary transformations - matrices, mountpoints, pos .. | |
virtual void | drawSolid () |
Render solid non-translucent parts of the object. | |
virtual void | drawEffect () |
Render translucent object-parts and visual effects. | |
virtual void | drawHUD () |
Render HUD-contents as seen when looking through the objects-eyes. | |
virtual void | damageByParticle (float *localpos, float damage, cObject *enactor=NULL) |
virtual float | constrainParticle (float *worldpos, float radius=0.0f, float *localpos=NULL) |
virtual OID | enemyNearby () |
Search through world-database to find nearest enemy, returns OID. | |
virtual OID | disturbedBy () |
If object was disturbed by an enemy this may return it's OID. | |
virtual float | inDestinationRange () |
Has this object reached it's destination position? Fuzzyvalue in [0,1]. | |
virtual float | inMeeleRange () |
Is this object in "hand-to-hand"-combat range? Fuzzyvalue in [0,1]. | |
virtual float | inWeaponRange () |
Is this object in firing range. Fuzzyvalue in [0,1]. | |
virtual float | inTargetRange () |
Is this object in targeting/visual distance? Fuzzyvalue in [0,1]. | |
virtual void | do_moveTowards () |
Move towards move-target as fast as possible. | |
virtual void | do_moveNear () |
Move to move-target throttling down as target comes near. | |
virtual void | do_aimAt () |
Aim at aim-target. | |
virtual void | do_fireAt () |
Fire at aim-target - ie. just fire where object is aiming at right now. | |
virtual void | do_idle () |
Nothing to do for object - possibly idle animation. | |
virtual void | do_aimFor (OID target) |
Set aim towards given object - ie. set aim-target. | |
virtual void | do_moveFor (float *dest) |
Set movement towards given location. if aim target NULL then same. | |
Public Attributes | |
rBase * | base |
rNameable * | nameable |
rSocialised * | socialised |
rTraceable * | traceable |
rDamageable * | damageable |
rEntity * | entity |
Static Public Attributes | |
static int | ENABLE_TEXTURE_3D = 1 |
Switches 3D-Texturing on or off. | |
Friends | |
class | cWorld |
Generic Game-Object (Object with Roles) which collects as much common attributes as are needed by the different roles and as needed by World-Filtering (Worldsense for subclasses implementing the roles). This object does again hold as much methods as needed but without (real) implementation (which is subclass-responsibility). Nevertheless every method has an empty body or a body returning some default value, so that callers need not care about the kind of the object (roles) too much.
virtual float cObject::constrainParticle | ( | float * | worldpos, | |
float | radius = 0.0f , |
|||
float * | localpos = NULL | |||
) | [inline, virtual] |
Constrain the given world position particle or given radius to the object boundary hull ie. place the worldpos to the nearest boundary hull position if the worldpos is inside the object's hull. localpos delivers in case of impact the local position relative to the object of the corrected worldpos. input location vector in world coordinates. radius of the checked particle in world dimensions. output adjusted location vector.
Reimplemented in cAlert, cBuilding, cPadmap, cHeightmap, cMech, and cTree.
virtual void cObject::damageByParticle | ( | float * | localpos, | |
float | damage, | |||
cObject * | enactor = NULL | |||
) | [inline, virtual] |
Deal damage to the object with the damage arriving at or from the given local position ie. relative to the object itself. input location vector relative to the object. amount of damage to deal to the object. the object dealing the damage to this object.