Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2141 in orxonox.OLD for orxonox/branches/chris


Ignore:
Timestamp:
Jul 14, 2004, 3:31:42 PM (20 years ago)
Author:
chris
Message:

orxonox/branches/chris: added lots and lots of doxygen tags

Location:
orxonox/branches/chris/src
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/chris/src/command_node.cc

    r2115 r2141  
    2626using namespace std;
    2727
    28 
     28/**
     29        \brief constructs a CommandNode to handle remote input
     30        \param ID: unique denumerator to identify the node in the network
     31*/
    2932CommandNode::CommandNode (int ID)
    3033{
     
    3538}
    3639
     40/**
     41        \brief constructs a CommandNode to handle local input
     42        \param filename: The path and name of the file to load the key bindings from
     43*/
    3744CommandNode::CommandNode (char* filename = DEFAULT_KEYBIND_FILE)
    3845{
     
    4350}
    4451
     52/**
     53        \brief removes the CommandNode from memory
     54*/
    4555CommandNode::~CommandNode ()
    4656{
     
    4959}
    5060
     61/**
     62        \brief loads new key bindings from a file
     63        \param filename: The path and name of the file to load the bindings from
     64*/
    5165void CommandNode::load_bindings (char* filename)
    5266{
     
    101115}
    102116
     117/**
     118        \brief binds a WorldEntity to the CommandNode
     119        \param entity: Pointer to the entity to bind
     120*/
    103121void CommandNode::bind (WorldEntity* entity)
    104122{
     
    106124}
    107125
     126/**
     127        \brief removes an entity from the list of the CommandNode
     128        \param entity: Pointer to the entity to relese
     129*/
    108130void CommandNode::unbind (WorldEntity* entity)
    109131{
     
    129151}
    130152
     153/**
     154        \brief tells the CommandNode to run through all pending events and relay them accordingly
     155*/
    131156void CommandNode::process ()
    132157{
    133 perror("CommandNode|process()");
    134158        if( bLocalInput) process_local ();
    135159        else process_network ();
     
    208232}
    209233
     234/**
     235        \brief sets the network identifier of the CommandNode
     236        \param ID: the new ID to use
     237*/
    210238void CommandNode::set_netID (int ID)
    211239{
     240        netID = ID;
    212241}
    213242
  • orxonox/branches/chris/src/command_node.h

    r2105 r2141  
    3434        Other SDL_Events are passed to Orxonox::event_handler() to deal with them. If the CommandNode has been created
    3535        with bLocalInput set to false, it will query the network class for incoming commands that match his netID and pass
    36         them on to his WorldEntities.
     36        them on to it's WorldEntities.
    3737*/
    3838class CommandNode {
  • orxonox/branches/chris/src/ini_parser.cc

    r2066 r2141  
    1919using namespace std;
    2020
     21/**
     22        \brief constructs an IniParser using a file
     23        \param filename: the path and name of the file to parse
     24*/
    2125IniParser::IniParser (char* filename)
    2226{
     
    2630}
    2731
     32/**
     33        \brief removes the IniParser from memory
     34*/
    2835IniParser::~IniParser ()
    2936{
     
    3138}
    3239
     40/**
     41        \brief opens another file to parse
     42        \param filename: path and name of the new file to parse
     43        \return zero on success or -1 if an error occured;
     44*/
    3345int IniParser::open_file( char* filename)
    3446{
     
    4456}
    4557
     58/**
     59        \brief set the parsing cursor to the specified section
     60        \param section: the name of the section to set the cursor to
     61        \return zero on success or -1 if the section could not be found
     62*/
    4663int IniParser::get_section( char* section)
    4764{
     
    7794}
    7895
     96/**
     97        \brief gets the next VarName=VarValue pair from the parsing stream
     98        \param name: a pointer to a buffer to store the name of the entry
     99        \param value: a pointer to a buffer to store the value of the entry
     100        \return zero if the buffers have been filled with data or -1 if there are no entries left in the current section
     101*/
    79102int IniParser::next_var( char* name, char* value)
    80103{
     
    111134}
    112135
     136/**
     137        \brief directly acesses an entry in a section
     138        \param name: the name of the entry to find
     139        \param section: the section where the entry is to be found
     140        \param defvalue: what should be returned in case the entry cannot be found
     141        \return a pointer to a buffer conatining the value of the specified entry. This buffer will contain the data specified in defvalue in case the entry wasn't found
     142
     143        The returned pointer points to an internal buffer, so do not free it on your own. Do not give a NULL pointer to defvalue, this will certainly
     144        lead to unwanted behaviour.
     145*/
    113146char* IniParser::get_var( char* name, char* section, char* defvalue = "")
    114147{
  • orxonox/branches/chris/src/ini_parser.h

    r2066 r2141  
    1515#define PARSELINELENGHT 512
    1616
     17//! ini-file parser
     18/**
     19        This class can be used to load an initializer file and parse it's contents for variablename=value pairs.
     20*/
    1721class IniParser {
    1822 private:
  • orxonox/branches/chris/src/keynames.h

    r2066 r2141  
    1212#include <SDL/SDL.h>
    1313
     14/**
     15        \brief converts a button name string to a integer representing the corresponding SDL mouse button identifier
     16        \param name: the name of the mouse button
     17        \return an int containing the SDL identifier of the mouse button or -1 if the button name is not valid
     18*/
    1419int buttonname_to_SDLB( char* name);
     20
     21/**
     22        \brief converst a SDL mouse button identifier to a name string
     23        \param button: an SDL mouse button identifier
     24        \return a pointer to a string containing the name of the mouse button
     25*/
    1526char* SDLB_to_buttonname( int button);
     27
     28/**
     29        \brief converts a key name string to a integer representing the corresponding SDLK sym
     30        \param name: the name of the key
     31        \return the SDLK sym of the named key or -1 if the key name is not valid
     32*/
    1633int keyname_to_SDLK( char* name);
     34
     35/**
     36        \brief converts an SDLK sym to a name string
     37        \param key: the SDLK sym
     38        \return a pointer to a string containig the name of the key
     39*/
    1740char* SDLK_to_keyname( int key);
    1841
  • orxonox/branches/chris/src/message_structures.h

    r2066 r2141  
     1/*!
     2        \file message_structures.h
     3        \brief contains defintitons of messages that can be passed between classes
     4*/
    15
    26#ifndef _MESSAGESTRUCTURES_H
     
    59#define CMD_LENGHT 16
    610
    7         // structure that contains commands
     11//! structure that contains a command message
    812typedef struct
    913{
    10         char cmd[CMD_LENGHT];
    11         bool bUp;
     14        char cmd[CMD_LENGHT];   //!< the command delivered
     15        bool bUp;       //!< false = command was activated / true = command was deactivated
     16       
     17        //! if cmd is "cursor" the coordinates of the mouse cursor are stored here
     18        //!@{
    1219        Uint16 x, y;
    13         Sint16 xrel, yrel;
     20        //!@}
     21       
     22        //! if cmd is "cursor" the relative motion of the mouse cursor is stored here
     23        //!@{
     24        Sint16 xrel, yrel;
     25        //!@}
    1426} Command;
    1527
  • orxonox/branches/chris/src/orxonox.cc

    r2115 r2141  
    3232using namespace std;
    3333
     34/**
     35        \brief create a new Orxonox
     36*/
    3437Orxonox::Orxonox ()
    3538{
     
    3740}
    3841
    39 
    40 
     42/**
     43        \brief remove Orxonox from memory
     44*/
    4145Orxonox::~Orxonox ()
    4246{
     
    5963}
    6064
     65/**
     66        \brief this finds the config file
     67       
     68        Since the config file varies from user to user and since one may want to specify different config files
     69        for certain occasions or platforms this function finds the right config file for every occasion and stores
     70        it's path and name into configfilename
     71*/
    6172void Orxonox::get_config_file (int argc, char** argv)
    6273{
     
    7586}
    7687
     88/**
     89        \brief initialize Orxonox with command line
     90*/
    7791int Orxonox::init (int argc, char** argv)
    7892{
     
    107121}
    108122
     123/**
     124        \brief initializes SDL and OpenGL
     125*/
    109126int Orxonox::init_video ()
    110127{
     
    148165}
    149166
     167/**
     168        \brief initializes the sound engine
     169*/
    150170int Orxonox::init_sound ()
    151171{
     
    154174}
    155175
     176/**
     177        \brief initializes input functions
     178*/
    156179int Orxonox::init_input ()
    157180{
     
    162185}
    163186
    164 
     187/**
     188        \brief initializes network system
     189*/
    165190int Orxonox::init_networking ()
    166191{
     
    169194}
    170195
     196/**
     197        \brief initializes and loads resource files
     198*/
    171199int Orxonox::init_resources ()
    172200{
     
    175203}
    176204
     205/**
     206        \brief initializes the world
     207*/
    177208int Orxonox::init_world ()
    178209{
     
    185216}
    186217
     218/**
     219        \brief exits Orxonox
     220*/
    187221void Orxonox::quitGame()
    188222{
    189223        bQuitOrxonox = true;
    190224}
     225
     226/**
     227        \brief this runs all of Orxonox
     228*/
    191229void Orxonox::mainLoop()
    192230{
     
    211249}
    212250
     251/**
     252        \brief handles sprecial events from localinput
     253        \param event: an event not handled by the CommandNode
     254*/
    213255void Orxonox::event_handler (SDL_Event* event)
    214256{
     
    216258}
    217259
     260/**
     261        \brief synchronize local data with remote data
     262*/
    218263void Orxonox::synchronize ()
    219264{
     
    222267}
    223268
     269/**
     270        \brief run all input processing
     271*/
    224272void Orxonox::handle_input ()
    225273{
     
    229277}
    230278
     279/**
     280        \brief advance the timeline
     281*/
    231282void Orxonox::time_slice ()
    232283{
     
    241292}
    242293
     294/**
     295        \brief compute collision detection
     296*/
    243297void Orxonox::collision ()
    244298{
     
    246300}
    247301
     302/**
     303        \brief handle keyboard commands that are not meant for WorldEntities
     304        \param cmd: the command to handle
     305        \return true if the command was handled by the system or false if it may be passed to the WorldEntities
     306*/
    248307bool Orxonox::system_command (Command* cmd)
    249308{
    250         if( !strcmp( cmd->cmd, "quit") && !cmd->bUp)
     309        if( !strcmp( cmd->cmd, "quit"))
    251310        {
    252                 bQuitOrxonox = true;
     311                if( !cmd->bUp) bQuitOrxonox = true;
    253312                return true;
    254313        }
     
    256315}
    257316
     317/**
     318        \brief render the current frame
     319*/
    258320void Orxonox::display ()
    259321{
     
    269331}
    270332
     333/**
     334        \brief retrieve a pointer to the local Camera
     335        \return a pointer to localcamera
     336*/
    271337Camera* Orxonox::get_camera ()
    272338{
     
    274340}
    275341
     342/**
     343        \brief retrieve a pointer to the local CommandNode
     344        \return a pointer to localinput
     345*/
    276346CommandNode* Orxonox::get_localinput ()
    277347{
     
    279349}
    280350
     351/**
     352        \brief retrieve a pointer to the local World
     353        \return a pointer to world
     354*/
    281355World* Orxonox::get_world ()
    282356{
     
    296370       
    297371  (*orx).mainLoop();
     372
     373  delete orx;
    298374 
    299375  return 0;
  • orxonox/branches/chris/src/orxonox.h

    r2105 r2141  
     1/*!
     2    \file orxonox.h
     3    \brief Orxonox core functions
     4*/
    15
    26#ifndef ORXONOX_H
     
    1317class Camera;
    1418
     19//! Orxonox core singleton class
     20/**
     21*/
    1522class Orxonox {
    1623
  • orxonox/branches/chris/src/player.h

    r2101 r2141  
     1/*!
     2    \file player.h
     3    \brief Implements a basic controllable WorldEntity
     4*/
    15
    26#ifndef PLAYER_H
     
    59#include "world_entity.h"
    610
     11//! Basic controllable WorldEntity
    712class Player : public WorldEntity
    813{
  • orxonox/branches/chris/src/track.cc

    r2115 r2141  
    2020using namespace std;
    2121
     22/**
     23        \brief creates a null Track part
     24*/
    2225Track::Track ()
    2326{
     
    2831}
    2932
     33/**
     34        \brief creates a functional base Track part
     35        \param number: the ID if this Track part
     36        \param next: the ID of the next Track part
     37        \param start: pointer to an anchor point (Vector) representing the offset of this part
     38        \param finish: pointer to an anchor point (Vector) representing the end of this part
     39*/
    3040Track::Track (Uint32 number, Uint32 next, Vector* start, Vector* finish)
    3141{
     
    3646}
    3747
     48/**
     49        \brief removes the Track part from memory
     50*/
    3851Track::~Track ()
    3952{
    4053}
    4154
     55/**
     56        \brief calculate a camera Placement from a "look at"-Location
     57        \param lookat: the Location the camera should be centered on
     58        \param camplc: pointer to a buffer where the new camera Placement should be put into
     59       
     60        Theoretically you can place the camera wherever you want, but for the sake of common sense I suggest that you at least
     61        try to keep the thing that should be looked at inside camera boundaries.
     62*/
    4263void Track::map_camera (Location* lookat, Placement* camplc)
    4364{
    44 printf("Track|Mapping camera: %d (%f)\n", lookat->part, lookat->dist);
    4565        Line trace(*offset, *end - *offset);
    4666        float l = trace.len ();
     
    4868//      camplc->r = *offset + Vector(0,0,0.5);
    4969//      camplc->w = Quaternion (trace.a, Vector(0,0,1));
    50        
     70        float r = (lookat->dist)*PI / l;
    5171        camplc->r = trace.r + (trace.a * ((lookat->dist-10.0) / l)) + Vector(0,0,5.0);
    52         camplc->w = Quaternion(Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r)), Vector(0,0,1));
     72        camplc->w = Quaternion(Vector(0,0,0) - ((trace.r + (trace.a * ((lookat->dist) / l)) - camplc->r)), Vector(0,sin(r),cos(r)));
    5373       
    5474}
    5575
     76/**
     77        \brief calculate a Placement from a given Location
     78        \param loc: the Location the entity is in
     79        \param plc: a pointer to a buffer where the corresponding Placement should be put into
     80       
     81        There are no limitations to how you transform a Location into a Placement, but for the sake of placement compatibility between
     82        track parts you should make sure that the resulting Placement at dist == 0 is equal to the offset Vector and the Placement at
     83        dist == len() is equal to the end Vector. Elseway there will be ugly artifacts when transfering between track parts.
     84*/
    5685bool Track::map_coords (Location* loc, Placement* plc)
    5786{
    58 printf("Track|Mapping coords: %d (%f)\n", loc->part, loc->dist);
    5987        Line trace(*offset, *end - *offset);
    6088        float l = trace.len ();
     
    75103}
    76104
     105/**
     106        \brief this is called when a WorldEntity enters a Track part
     107        \param entity: pointer to the WorldEntity in question
     108       
     109        You can do stuff like add or remove effects, do some coordinate finetuning or whatever in here.
     110*/
    77111void Track::post_enter (WorldEntity* entity)
    78112{
    79113}
    80114
     115/**
     116        \brief this is called when a WorldEntity leaves a Track part
     117        \param entity: pointer to the WorldEntity in question
     118       
     119        You can do stuff like add or remove effects, do some coordinate finetuning or whatever in here.
     120*/
    81121void Track::post_leave (WorldEntity* entity)
    82122{
    83123}
    84124
     125/**
     126        \brief this is called every frame
     127        \param deltaT: amount of time passed since the last frame in seconds
     128       
     129        Do time based or polling scripts here.
     130*/
    85131void Track::tick (float deltaT)
    86132{
  • orxonox/branches/chris/src/track.h

    r2101 r2141  
     1/*!
     2    \file track.h
     3    \brief Basic level architecture
     4*/
    15
    26#ifndef TRACK_H
     
    59#include "stdincl.h"
    610
     11//!     The Red Line through a level
     12/**
     13        Handles level boundaries, bound movement mapping, camera placement and scripting.
     14        To create special levels with special camera movement, rules or whatever, derive from this base class.
     15*/
    716class Track
    817{
  • orxonox/branches/chris/src/vector.cc

    r2112 r2141  
    181181}
    182182
     183/**
     184        \brief creates a multiplicational identity Quaternion
     185*/
    183186Quaternion::Quaternion ()
    184187{
     
    187190}
    188191
     192/**
     193        \brief turns a rotation along an axis into a Quaternion
     194        \param angle: the amount of radians to rotate
     195        \param axis: the axis to rotate around
     196*/
    189197Quaternion::Quaternion (float angle, const Vector& axis)
    190198{
     
    193201}
    194202
     203/**
     204        \brief calculates a look_at rotation
     205        \param dir: the direction you want to look
     206        \param up: specify what direction up should be
     207       
     208        Mathematically this determines the rotation a (0,0,1)-Vector has to undergo to point the same way as dir.
     209        If you want to use this with cameras, you'll have to reverse the dir Vector (Vector(0,0,0) - your viewing direction)
     210        or you'll point the wrong way. You can use this for meshes as well (then you do not have to reverse the vector), but keep in mind that if you do that, the model's front
     211        has to point in +z direction, and left and right should be -x or +x respectively or the mesh wont rotate correctly.
     212*/
    195213Quaternion::Quaternion (const Vector& dir, const Vector& up)
    196214{
     
    222240}
    223241
     242/**
     243        \brief calculates a rotation from euler angles
     244        \param roll: the roll in radians
     245        \param pitch: the pitch in radians
     246        \param yaw: the yaw in radians
     247       
     248        I DO HONESTLY NOT EXACTLY KNOW WHICH ANGLE REPRESENTS WHICH ROTATION. And I do not know in what order they are applied,
     249        I just copy-pasted the code.
     250*/
    224251Quaternion::Quaternion (float roll, float pitch, float yaw)
    225252{
     
    244271}
    245272
     273/**
     274        \brief rotates one Quaternion by another
     275        \param q: another Quaternion to rotate this by
     276        \return a quaternion that represents the first one rotated by the second one (WARUNING: this operation is not commutative! e.g. (A*B) != (B*A))
     277*/
    246278Quaternion Quaternion::operator*(const Quaternion& q) const
    247279{
     
    266298}
    267299
     300/**
     301        \brief add two Quaternions
     302        \param q: another Quaternion
     303        \return the sum of both Quaternions
     304*/
    268305Quaternion Quaternion::operator+(const Quaternion& q) const
    269306{
     
    274311}
    275312
     313/**
     314        \brief subtract two Quaternions
     315        \param q: another Quaternion
     316        \return the difference of both Quaternions
     317*/
    276318Quaternion Quaternion::operator- (const Quaternion& q) const
    277319{
     
    282324}
    283325
     326/**
     327        \brief rotate a Vector by a Quaternion
     328        \param v: the Vector
     329        \return a new Vector representing v rotated by the Quaternion
     330*/
    284331Vector Quaternion::apply (Vector& v) const
    285332{
     
    291338}
    292339
     340/**
     341        \brief multiply a Quaternion with a real value
     342        \param f: a real value
     343        \return a new Quaternion containing the product
     344*/
    293345Quaternion Quaternion::operator*(const float& f) const
    294346{
     
    299351}
    300352
     353/**
     354        \brief divide a Quaternion by a real value
     355        \param f: a real value
     356        \return a new Quaternion containing the quotient
     357*/
    301358Quaternion Quaternion::operator/(const float& f) const
    302359{
     
    308365}
    309366
     367/**
     368        \brief calculate the conjugate value of the Quaternion
     369        \return the conjugate Quaternion
     370*/
    310371Quaternion Quaternion::conjugate() const
    311372{
     
    315376}
    316377
     378/**
     379        \brief calculate the norm of the Quaternion
     380        \return the norm of The Quaternion
     381*/
    317382float Quaternion::norm() const
    318383{
     
    320385}
    321386
     387/**
     388        \brief calculate the inverse value of the Quaternion
     389        \return the inverse Quaternion
     390       
     391        Note that this is equal to conjugate() if the Quaternion's norm is 1
     392*/
    322393Quaternion Quaternion::inverse() const
    323394{
     
    330401}
    331402
     403/**
     404        \brief convert the Quaternion to a 4x4 rotational glMatrix
     405        \param m: a buffer to store the Matrix in
     406*/
    332407void Quaternion::matrix (float m[4][4]) const
    333408{
     
    355430}
    356431
     432/**
     433        \brief convert a rotational 4x4 glMatrix into a Quaternion
     434        \param m: a 4x4 matrix in glMatrix order
     435*/
    357436Quaternion::Quaternion (float m[4][4])
    358437{
  • orxonox/branches/chris/src/vector.h

    r2112 r2141  
    1212#define PI 3.14159265359f
    1313
     14//! 3D Vector
     15/**
     16        Class to handle 3D Vectors
     17*/
    1418class Vector {
    1519
     
    4347{
    4448 public:
    45         Vector v;
    46         float w;
     49        Vector v;       //!< Imaginary Vector
     50        float w; //!< Real part of the number
    4751
    4852        Quaternion ();
  • orxonox/branches/chris/src/world.cc

    r2115 r2141  
    2727
    2828/**
    29    \brief Create a new World
     29   \brief create a new World
    3030   
    3131   This creates a new empty world!
     
    3636}
    3737
    38 
     38/**
     39   \brief remove the World from memory
     40*/
    3941World::~World ()
    4042{
     
    4345}
    4446
     47/**
     48   \brief checks for collisions
     49   
     50   This method runs through all WorldEntities known to the world and checks for collisions between them.
     51   In case of collisions the collide() method of the corresponding entities is called.
     52*/
    4553void World::collide ()
    4654{
     
    7583}
    7684
     85/**
     86   \brief runs through all entities calling their draw() methods
     87*/
    7788void World::draw ()
    7889{
     
    140151}
    141152
     153/**
     154   \brief updates Placements and notifies entities when they left the world
     155   
     156   This runs trough all WorldEntities and maps Locations to Placements if they are bound, checks
     157   whether they left the level boundaries and calls appropriate functions.
     158*/
    142159void World::update ()
    143160{
     
    190207}
    191208
     209/**
     210  \brief relays the passed time since the last frame to entities and Track parts
     211        \param deltaT: the time passed since the last frame in milliseconds
     212*/
    192213void World::time_slice (Uint32 deltaT)
    193214{
     
    209230}
    210231
     232/**
     233        \brief removes level data from memory
     234*/
    211235void World::unload()
    212236{
     
    215239}
    216240
     241/**
     242        \brief loads a simple level for testing purposes
     243*/
    217244void World::load_debug_level()
    218245{
     
    245272}
    246273
     274/**
     275        \brief calls the correct mapping function to convert a given "look at"-Location to a Camera Placement
     276*/
    247277void World::calc_camera_pos (Location* loc, Placement* plc)
    248278{
  • orxonox/branches/chris/src/world.h

    r2112 r2141  
     1/*!
     2    \file world.h
     3    \brief Holds and manages all game data
     4*/
    15
    26#ifndef WORLD_H
     
    812class WorldEntity;
    913
     14//! The game environment
    1015class World {
    1116
     
    4045};
    4146
     47/**
     48    \brief spawn a new WorldEntity at a Location
     49    \param loc: the Location where the Entity should be spawned
     50    \param owner: a pointer to the parent of the Entity
     51    \return a pointer to the new WorldEntity or NULL if there was an error
     52   
     53    You can use this function to spawn any derivation of WorldEntity you want, just specify the desired
     54    class within the template specification brackets. Do not attempt to spawn any classes that have NOT been
     55    derived from WorldEntity, you won't even be able to compile the code. Note that this version of spawn()
     56    works with both free and bound WorldEntities.
     57*/
    4258template<typename T> T* World::spawn(Location* loc = NULL, WorldEntity* owner = NULL)
    4359{
     
    6278}
    6379
     80/**
     81    \brief spawn a new WorldEntity at a Placement
     82    \param lplc: the placement where the Entity should be spawned
     83    \param owner: a pointer to the parent of the Entity
     84    \return a pointer to the new WorldEntity or NULL if there was an error
     85   
     86    You can use this function to spawn any FREE derivation of WorldEntity you want, just specify the desired
     87    class within the template specification brackets. Do not attempt to spawn any classes that have NOT been
     88    derived from WorldEntity, you won't even be able to compile the code. Note that this version of spawn()
     89    works with free WorldEntities only, you will provoke an error message if you try to spawn a bound Entity with
     90    a Placement.
     91*/
    6492template<typename T> T* World::spawn(Placement* plc, WorldEntity* owner = NULL)
    6593{
  • orxonox/branches/chris/src/world_entity.cc

    r2112 r2141  
    2424using namespace std;
    2525
    26 
    2726/**
    28    \brief
    29    \param v:
    30    \return
    31 */
    32 
    33 /**
    34    \brief Constructor
    35 
    36    This Constructor initializises the all WorldEntities. Everything, that is a part of the game-world is a child of WorldEntity. This class implements empty functions for all sort of operation a WorldEntity has to or can implement.
    37 This is some sort of standard interface to all WorldEntities...
     27   \brief standard constructor
     28   
     29   Every derived contructor HAS to call the previous one supplying the isFree parameter. This is necessary to distunguish
     30   between free and bound entities. The difference between them is simply the fact that the movement of a free entity is
     31   not bound to the track of a world. Use this to implement projectile or effect classes that do not have to travel along the track.
     32   To specify an entity to be free or bound set the default parameter in the declaration of the constructor.
     33   Theoretically you should never have to call the constructor of an Entity directly, for it is called by the spawn() function of the World
     34   class. So if you want to create a new entity at any time, call World::spawn(). It will handle everything that is necessary.
    3835*/
    3936WorldEntity::WorldEntity (bool isFree) : bFree(isFree)
     
    4340}
    4441
    45 WorldEntity::~WorldEntity () {}
     42/**
     43        \brief standard destructor
     44*/
     45WorldEntity::~WorldEntity ()
     46{
     47        if( collisioncluster != NULL) delete collisioncluster;
     48}
    4649
     50/**
     51        \brief get the Location of the WorldEntity
     52        \return a pointer to location
     53*/
    4754Location* WorldEntity::get_location ()
    4855{
     
    5057}
    5158
     59/**
     60        \brief get the Placement of the WorldEntity
     61        \return a pointer to placement
     62*/
    5263Placement* WorldEntity::get_placement ()
    5364{
     
    5566}
    5667
     68/**
     69        \brief query whether the WorldEntity in question is free
     70        \return true if the WorldEntity is free or false if it isn't
     71*/
    5772bool WorldEntity::isFree ()
    5873{
     
    6075}
    6176
     77/**
     78        \brief set the WorldEntity's collision hull
     79        \param newhull: a pointer to a completely assembled CollisionCluster
     80       
     81        Any previously assigned collision hull will be deleted on reassignment
     82*/
    6283void WorldEntity::set_collision (CollisionCluster* newhull)
    6384{
     
    6889
    6990/**
    70    \brief this method is called every tick
    71    \param time: the time since start of the world
    72 
    73    This function is called before every repaint of the world, to update every time dependent variable of the entity. If the entity moves, it has to calculate the new position every tick here in this function. Do not use this for animations.
     91        \brief this method is called every frame
     92        \param time: the time in seconds that has passed since the last tick
     93       
     94        Handle all stuff that should update with time inside this method (movement, animation, etc.)
    7495*/
    7596void WorldEntity::tick(float time)
    76 {}
     97{
     98}
    7799
    78100/**
    79    \brief the entity is painted to the screen with this function
     101   \brief the entity is drawn onto the screen with this function
    80102
    81103   This is a central function of an entity: call it to let the entity painted to the screen. Just override this function with whatever you want to be drawn.
     
    83105void WorldEntity::draw()
    84106{
    85 printf("WorldEntity|draw()\n");
    86107}
    87108
    88 /* virtual void WorldEntity::actionEvent(Event* event); */
    89109/**
    90    \brief this function is called, when two entities collide
    91    \param we: the world entity, with whom it collides
    92    \param loc: place where the collision happens
     110        \brief this function is called, when two entities collide
     111        \param other: the world entity with whom it collides
     112        \param ownhitflags: flags to the CollisionCluster subsections that registered an impact
     113        \param otherhitflags: flags to the CollisionCluster subsections of the other entity that registered an impact
     114
     115        Implement behaviour like damage application or other miscellaneous collision stuff in this function
    93116*/
    94117void WorldEntity::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) {}
     
    104127
    105128/**
    106    \brief this function is called, if the entity is to be destroied
     129   \brief this function is called when the entity is to be destroied
    107130   
    108131   This can be called, if eg. something realy bad happens :)
     
    110133void WorldEntity::destroy() {}
    111134
     135
     136/**
     137        \brief basic initialisation for bound Entities
     138*/
    112139void WorldEntity::init( Location* spawnloc, WorldEntity* spawnowner)
    113140{
     
    116143}
    117144
     145/**
     146        \brief basic initialisation for free Entities
     147*/
    118148void WorldEntity::init( Placement* spawnplc, WorldEntity* spawnowner)
    119149{
     
    122152}
    123153
     154/**
     155        \brief this is called immediately after the Entity has been constructed and initialized
     156       
     157        Put any initialisation code that requires knowledge of location (placement if the Entity is free) and owner of the entity here.
     158        DO NOT place such code in the constructor, those variables are set AFTER the entity is constucted.
     159*/
    124160void WorldEntity::post_spawn ()
    125161{
    126162}
    127163
     164/**
     165        \brief this handles incoming command messages
     166        \param cmd: a pointer to the incoming Command structure
     167       
     168        Put all code that handles Command messages here, this will mainly be called by the assigned CommandNode but can also be used
     169        to send commands from one WorldEntity to another.
     170*/
    128171void WorldEntity::command (Command* cmd)
    129172{
    130173}
    131174
     175/**
     176        \brief this is called by the local Camera to determine the point it should look at on the WorldEntity
     177        \param locbuf: a pointer to the buffer to fill with a location to look at
     178       
     179        You may put any Location you want into locbuf, the Camera will determine via the corresponding Track how
     180        to look at the location you return with this.
     181*/
    132182void WorldEntity::get_lookat (Location* locbuf)
    133183{
    134184}
    135185
     186/**
     187        \brief this method is called by the world if the WorldEntity leaves valid gamespace
     188       
     189        For free entities this means it left the Track boundaries. With bound entities it means its Location adresses a
     190        place that is not in the world anymore. In both cases you might have to take extreme measures (a.k.a. call destroy).
     191*/
    136192void WorldEntity::left_world ()
    137193{
  • orxonox/branches/chris/src/world_entity.h

    r2101 r2141  
     1/*!
     2    \file world_entity.h
     3    \brief Definition of the basic WorldEntity
     4*/
    15
    26#ifndef WORLD_ENTITY_H
     
    711class CollisionCluster;
    812
     13//! Basic class from which all interactive stuff in the world is derived from
    914class WorldEntity
    1015{       
Note: See TracChangeset for help on using the changeset viewer.