#include <gameEntity.h>
Enum data | |
| enum | eError { kNone = 0, kNoEnt = -1, kBadValue = -2 } |
| Error code enums. More... | |
| enum | eState { kStateNone = 0, kStateIdle = 1, kStateForward, kStateBackward, kStateLeft, kStateRight, kStateRun, kStateJump, kStateWater, kStateAir, kStateAttack, kStateReload, kStateSwitch, kStateDamage, kStateDead, kStateDuck, kStateRemove, kStateEmpty } |
| State this entity is in. Can be used for animation, attack modifiers, movement, etc. More... | |
| static eState | string_to_eState (const char *str) |
| Get eState from a string value. | |
Creation methods | |
| Factory methods are the only way to create a CGameEntity (GE). | |
| static CGameEntity * | create_gameEntity (ENTITY *pEnt) |
| Factory creates a GE using the ENTITY. | |
| static CGameEntity * | create_gameEntity (char *filename) |
| Factory creates a GE from a filename. | |
| static CGameEntity * | create_gameEntity (ENTITY *pEnt, CGameEntityData *pData) |
| Factory creates a GE from an ENTITY and use a Data struct to init it. | |
| bool | data_load (CGameEntityData *pEntityData) |
| Set GE values/CMPs using data. | |
Public Member Functions | |
Destructor methods | |
| virtual | ~CGameEntity () |
| Destructor. | |
| void | remove () |
| Remove GE from the game. | |
Data methods | |
Uses the CMPs and ENTITY data to handle updates, actions, and edits. | |
| virtual bool | update () |
| Update this entity for one frame. | |
| virtual int | set (const EDIT_DATA &editData) |
| Set a value. | |
| virtual int | set (eCmp cmpType, const EDIT_DATA &editData) |
| Set a value in a single CMP. | |
| virtual int | get (EDIT_DATA &editData) |
| Get a value. | |
| virtual int | get (eCmp cmpType, EDIT_DATA &editData) |
| Get a value from a single CMP. | |
| virtual int | act (const ACTION_DATA &actData) |
| Preform an action. | |
| virtual int | act (eCmp cmpType, const ACTION_DATA &actData) |
| Use a single CMP to preform an action. | |
Event methods | |
Events are sent from the game engine to the ENTITY. | |
| eError | event_enable (const unsigned int bfEvent) |
| Enable an event. | |
| eError | event_disable (const unsigned int bfEvent) |
| Disable an event. | |
| bool | event_valid (const unsigned int bfEvent) |
| Is event valid? | |
State methods | |
The state of an GE (eState). | |
| void | state_clear () |
| Clear all states. | |
| void | state_set (eState state) |
| Set a state. | |
| void | state_reset (eState state) |
| Reset a state. | |
| bool | state_check (eState state) const |
| Check a state. | |
| bool | state_check (const CFlagSet< eState > &flagSet) const |
| Check a group of states. | |
CMP methods | |
CMP (components) add functionality to the GE. Each GE can have zero or more CMPs. | |
| bool | cmp_valid (eCmp type) |
| Has this CMP been added to this GE? | |
| bool | cmp_add (eCmp type) |
| Add a CMP to this GE. | |
| void | cmp_remove () |
| Remove all CMPs. | |
| CCmp * | cmp_get (eCmp type) |
| Get a CMP pointer. | |
Movement methods | |
Move the entity while handling collision. | |
| bool | move (const CVector3D &vec, int move_mode=-1) |
| Move the entity by the vector given (with collision). | |
| bool | move (const unit x, const unit y, const unit z, int move_mode=-1) |
| Move the entity by the vector given (with collision). | |
Rotation methods | |
Rotate the entity while handling collision. | |
| bool | rotate (const CAngle3D &ang, int move_mode=-1) |
| Rotate the entity by the angle given (with collision). | |
| bool | rotate (const unit pan, const unit tilt, const unit roll, int move_mode=-1) |
| Rotate the entity by the angle given (with collision). | |
Distance methods | |
Distance (in quants) moved in the last update. | |
| const CVector3D & | dist () const |
| Get distance moved. | |
| void | dist (const CVector3D &dist) |
| Set a new distance value. | |
| void | dist_add (const CVector3D &dist) |
| Add to the distance moved. | |
Position methods | |
The position of the ENTITY. | |
| CVector3D | pos () const |
| Get the current position. | |
| void | pos (const CVector3D &vec) |
| Set the position of the entity (without collision). | |
| void | pos (const unit x, const unit y, const unit z) |
| Set the position of the entity (without collision). | |
Angle methods | |
Rotation angle of the ENTITY. | |
| CAngle3D | ang () const |
| Get the current angle. | |
| void | ang (const CAngle3D &ang) |
| Set the angle of the entity (without collision). | |
| void | ang (const unit pan, const unit tilt, const unit roll) |
| Set the angle of the entity (without collision). | |
Skill methods | |
Skills are stored inside the ENTITY itself. | |
| var | skill (const int index) |
| Get an ENTITY skill as a VAR. | |
| float | skill_f (const int index) |
| Get an ENTITY skill as a float value. | |
| bool | skill (const int index, const int value) |
| Set a skill. | |
| bool | skill (const int index, const unit value) |
| Set a skill. | |
| bool | skill (const EDIT_SKILL_DATA *pData) |
| Set a skill. | |
Misc methods | |
| virtual bool | valid () const |
| Is ENTITY* valid? | |
| unsigned long | id () const |
| Get the GE's unique ID number. | |
| ENTITY * | pEnt () const |
| Get a pointer to the GE's acknex ENTITY. | |
Static Public Attributes | |
| static const int | kSkillGEID = 99 |
| Const. | |
| static const int | kSkillIndexMax = 98 |
| Max index value into the skill array. | |
Protected Member Functions | |
Construction methods | |
Construction methods are not to be used directly. Instead, you should always use a Factory method to create a GE. | |
| CGameEntity (ENTITY *pEnt) | |
| Create a basic GE. | |
| CGameEntity (char *filename) | |
| Create a GE from a filename. | |
| eError | init () |
| Init all values to their default. | |
Game Entities (GEs) are a collection of components (CCmp) attached to a single acknex ENTITY.
(c) 2007-2008 oP group Germany GbR. All rights reserved.
This source code is provided "as is" with no warranty and must not be distributed without written permission.
| enum CGameEntity::eError |
| enum CGameEntity::eState |
State this entity is in. Can be used for animation, attack modifiers, movement, etc.
| CGameEntity::CGameEntity | ( | ENTITY * | pEnt | ) | [protected] |
Create a basic GE.
| pEnt | Pointer to ENTITY used. |
| CGameEntity::CGameEntity | ( | char * | filename | ) | [protected] |
Create a GE from a filename.
| filename | Name of a valid ENTITY file (model, sprite, or map entity). |
| CGameEntity::eState CGameEntity::string_to_eState | ( | const char * | str | ) | [static] |
Get eState from a string value.
| str | String containing eState name. |
| str | take a string and return the eState |
| CGameEntity * CGameEntity::create_gameEntity | ( | ENTITY * | pEnt | ) | [static] |
Factory creates a GE using the ENTITY.
| pEnt | Pointer to ENTITY used by this GE. |
| pEnt | factory creates any type of CGameEntity, returns points |
| CGameEntity * CGameEntity::create_gameEntity | ( | char * | filename | ) | [static] |
Factory creates a GE from a filename.
| filename | Name of a valid ENTITY file (model, sprite, or map entity). |
| filename | factory creates any type of CGameEntity, returns points |
| CGameEntity * CGameEntity::create_gameEntity | ( | ENTITY * | pEnt, | |
| CGameEntityData * | pData | |||
| ) | [static] |
Factory creates a GE from an ENTITY and use a Data struct to init it.
| pEnt | Pointer to ENTITY used by this GE. | |
| pData | Data used to init the GE. |
| pData | same as above, but using CGameEntityData for data |
| bool CGameEntity::data_load | ( | CGameEntityData * | pEntityData | ) |
Set GE values/CMPs using data.
Load values, skills, CMPs, and their edit values from the GameEntityData passed in.
| pEntityData | Pointer to the data used. |
| CGameEntity::eError CGameEntity::init | ( | ) | [protected] |
Init all values to their default.
| void CGameEntity::remove | ( | ) |
Remove GE from the game.
Shuts down all the attached CMPs and flags this GE as "empty".
| bool CGameEntity::update | ( | ) | [virtual] |
Update this entity for one frame.
| int CGameEntity::set | ( | const EDIT_DATA & | editData | ) | [virtual] |
Set a value.
If we have a matching data type in any of the CMPs or base GE, set its value.
| editData | Data type and value (see EDIT_DATA struct). |
| editData | The data used to preform the action (see EDIT_DATA struct) |
| int CGameEntity::get | ( | EDIT_DATA & | editData | ) | [virtual] |
Get a value.
If we have a matching data type in any of the CMPs or base GE, get the value.
| editData | Data type we are looking for, and memory to store value (see EDIT_DATA struct). |
| editData | The data used to preform the action (see EDIT_DATA struct) |
Get a value from a single CMP.
If we have a matching data type in the CMP given, get the value.
| cmpType | The component we are checking | |
| editData | Data type we are looking for, and memory to store value (see EDIT_DATA struct). |
| int CGameEntity::act | ( | const ACTION_DATA & | actData | ) | [virtual] |
Preform an action.
Handle the action passed in (ignore if we do not handle the action type).
| actData | The data used to preform the action (see ACTION_DATA struct). |
| int CGameEntity::act | ( | eCmp | cmpType, | |
| const ACTION_DATA & | actData | |||
| ) | [virtual] |
Use a single CMP to preform an action.
Have a single CMP handle the action passed in (ignore if it does not handle the action type).
| cmpType | The component we are acting on | |
| actData | The data used to preform the action (see ACTION_DATA struct). |
| CGameEntity::eError CGameEntity::event_enable | ( | const unsigned int | bfEvent | ) |
Enable an event.
Set an event for this GE to react to.
| bfEvent | The event bit-flag we are enabling (see atypes.h for avalible ENABLE_EVENTS) |
| CGameEntity::eError CGameEntity::event_disable | ( | const unsigned int | bfEvent | ) |
Disable an event.
Disable checking for this type of event
| bfEvent | The event bit-flag we are disabling (see atypes.h for avalible ENABLE_EVENTS) |
| bool CGameEntity::event_valid | ( | const unsigned int | bfEvent | ) |
Is event valid?
Are we checking for this kind of event?
| bfEvent | The event bit-flag to check. |
| void CGameEntity::state_set | ( | eState | state | ) | [inline] |
Set a state.
| state | State to be set. |
| void CGameEntity::state_reset | ( | eState | state | ) | [inline] |
Reset a state.
| state | State to be reset. |
| bool CGameEntity::state_check | ( | eState | state | ) | const [inline] |
Check a state.
| state | State to check. |
Check a group of states.
| bool CGameEntity::cmp_valid | ( | eCmp | type | ) |
Has this CMP been added to this GE?
| type | The type of cmp to check. |
| bool CGameEntity::cmp_add | ( | eCmp | type | ) |
Add a CMP to this GE.
| type | The type of cmp to add. |
Get a CMP pointer.
| type | The CMP we want to get a pointer to |
| bool CGameEntity::move | ( | const CVector3D & | vec, | |
| int | move_mode = -1 | |||
| ) |
Move the entity by the vector given (with collision).
| vec | Movement vector. | |
| move_mode | Optional move_mode value (neg values use the default move_mode). |
| bool CGameEntity::move | ( | const unit | x, | |
| const unit | y, | |||
| const unit | z, | |||
| int | move_mode = -1 | |||
| ) |
Move the entity by the vector given (with collision).
| x | Movement in X | |
| y | Movement in Y | |
| z | Movement in Z | |
| move_mode | Optional move_mode value (neg values use the default move_mode) |
| bool CGameEntity::rotate | ( | const CAngle3D & | ang, | |
| int | move_mode = -1 | |||
| ) |
Rotate the entity by the angle given (with collision).
| ang | Movement vector | |
| move_mode | Optional move_mode value (neg values use the default move_mode) |
| bool CGameEntity::rotate | ( | const unit | pan, | |
| const unit | tilt, | |||
| const unit | roll, | |||
| int | move_mode = -1 | |||
| ) |
Rotate the entity by the angle given (with collision).
| pan | rotation around Z | |
| tilt | rotation around Y | |
| roll | rotation around X | |
| move_mode | Optional move_mode value (neg values use the default move_mode) |
| const CVector3D & CGameEntity::dist | ( | ) | const |
Get distance moved.
| void CGameEntity::dist | ( | const CVector3D & | dist | ) |
Set a new distance value.
| dist | Overwrites old value. |
| void CGameEntity::dist_add | ( | const CVector3D & | dist | ) |
Add to the distance moved.
| dist | Distance to add to the current value. |
| CVector3D CGameEntity::pos | ( | ) | const [inline] |
| void CGameEntity::pos | ( | const CVector3D & | vec | ) | [inline] |
Set the position of the entity (without collision).
| vec | New position of the entity |
| void CGameEntity::pos | ( | const unit | x, | |
| const unit | y, | |||
| const unit | z | |||
| ) | [inline] |
Set the position of the entity (without collision).
| x | New x position of the entity | |
| y | New y position of the entity | |
| z | New z position of the entity |
| CAngle3D CGameEntity::ang | ( | ) | const [inline] |
| void CGameEntity::ang | ( | const CAngle3D & | ang | ) | [inline] |
Set the angle of the entity (without collision).
| ang | New angle of the entity |
| void CGameEntity::ang | ( | const unit | pan, | |
| const unit | tilt, | |||
| const unit | roll | |||
| ) | [inline] |
Set the angle of the entity (without collision).
| pan | Entity's new pan | |
| tilt | Entity's new tilt | |
| roll | Entity's new roll |
| var CGameEntity::skill | ( | const int | index | ) | [inline] |
Get an ENTITY skill as a VAR.
| index | Index into the skill array (0-max) |
| float CGameEntity::skill_f | ( | const int | index | ) | [inline] |
Get an ENTITY skill as a float value.
| index | Index into the skill array (0-max) |
| bool CGameEntity::skill | ( | const int | index, | |
| const int | value | |||
| ) | [inline] |
Set a skill.
| index | Index into the skill array (0-max) | |
| value | Value we want to store |
| bool CGameEntity::skill | ( | const int | index, | |
| const unit | value | |||
| ) | [inline] |
Set a skill.
| index | Index into the skill array (0-max) | |
| value | Value we want to store |
| bool CGameEntity::skill | ( | const EDIT_SKILL_DATA * | pData | ) | [inline] |
Set a skill.
| pData | Data struct used to set a skill value |
| virtual bool CGameEntity::valid | ( | ) | const [inline, virtual] |
Is ENTITY* valid?
| unsigned long CGameEntity::id | ( | ) | const [inline] |
Get the GE's unique ID number.
| ENTITY* CGameEntity::pEnt | ( | ) | const [inline] |
Get a pointer to the GE's acknex ENTITY.
const int CGameEntity::kSkillGEID = 99 [static] |
Const.
Skill used to store the Game Entity ID
1.5.4