Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2077 in orxonox.OLD for orxonox/trunk/src/world.cc


Ignore:
Timestamp:
Jul 5, 2004, 9:51:48 PM (21 years ago)
Author:
patrick
Message:

/orxonox/trunk/src: making doxygen comments in worldentity, player, world; extending API of worldentity; inserting list.h in world - this version does not compile

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/world.cc

    r2036 r2077  
    2828#include "data_tank.h"
    2929
     30#include "list.h"
     31#include "world_entity.h"
     32
    3033#include "world.h"
    3134
     
    3740   \brief Create a new World
    3841   
    39    This creates a new empty world!
     42   This creates a new, empty world!
    4043*/
    4144World::World () {
    42   lastPlayer = null;
    43   lastNPC = null;
    44   lastEnv = null;
     45  //lastPlayer = null;
     46  //lastNPC = null;
     47  //lastEnv = null;
    4548  primitiveMove = 0;
    4649  step = 0;
     50
     51  //List<int> *list = new List<int>();
     52  npcList = new List<WorldEntity*>();
     53  playerList = new List<WorldEntity*>();
     54  envList = new List<WorldEntity*>();
    4755}
    4856
    4957
    5058World::~World () {}
     59
     60
     61
     62/**
     63   \brief Load a new World
     64   
     65   Load a new world. The old world (if any) will be unloaded and becomes unrecoverable.
     66*/
     67void World::loadWorld() {}
     68
     69
     70/**
     71   \brief Unloads a new World
     72   
     73   Unloads a world and frees the memory. You cant game until you have a new world loaded.
     74*/
     75void World::unloadWorld() {}
     76
     77
     78/**
     79   \brief Pause the game
     80   
     81   Pauses the game until the pause is released. During this time nothing moves at all and nothing is calculated. Use it if you have to go out of the game to read some mails...
     82*/
     83void World::pauseWorld() {}
     84
     85
     86/**
     87   \brief Save the game to file
     88   \param filename: the filename where the savegame should be saved to
     89   
     90   Saves the state of the game to a file. The state is catched like in a multiplayer game over a synchronisable interface.
     91*/
     92void World::saveGameState(char* filename) {}
     93
    5194
    5295
     
    59102bool World::addPlayer(Player* player)
    60103{
     104  WorldEntity *we;
     105  playerList->add(we);
     106  /*
    61107  playerList* listMember = new playerList;
    62108  listMember->player = player;
     
    72118    }
    73119  lastPlayer = listMember;
    74 }
    75 
     120  */
     121}
    76122
    77123/**
     
    79125   \param player A reference to the new npc object
    80126   
    81    Remove a new Player to the game.
     127   Remove a new Player to the game. This kills the player objects.
    82128*/
    83129bool World::removePlayer(Player* player) {
    84   cout << "World::removeNPC not implemented yet" << endl;
    85 }
    86 
     130  playerList->remove(player, LIST_FIND_BW);
     131}
     132
     133/**
     134   \brief Returns the player-entity controlled by the local gamer
     135   \return pointer to player object
     136   
     137   Remove a new Player to the game. This kills the player objects.
     138*/
    87139Player* World::getLocalPlayer()
    88140{
     
    99151bool World::addNPC(NPC* npc)
    100152{
     153  npcList->add(npc, LIST_ADD_NEXT);
     154  /*
    101155  npcList* listMember = new npcList;
    102156  listMember->npc = npc;
     
    112166    }
    113167  lastNPC = listMember;
     168  */
    114169}
    115170
     
    117172/**
    118173   \brief Remove Non-Player Character
    119    \param player A reference to the new npc object
    120    
    121    Remove a new Non-Player-Character to the game.
    122 */
    123 bool World::removeNPC(NPC* npc) {
    124 
     174   \param player A reference to the npc object
     175   
     176   Remove a Non-Player-Character to the game.
     177*/
     178bool World::removeNPC(NPC* npc)
     179{
     180  npcList->remove(npc, LIST_FIND_FW);
     181  /*
    125182  npcList* npcRef = lastNPC;
    126183  npcList* lastRef = lastNPC;
     
    128185    {
    129186      if ( npcRef->npc == npc ) {
    130         cout << "found" << endl;
     187        cout <
     188< "found" << endl;
    131189        if ( npcRef == lastRef ) {
    132190          lastNPC = lastNPC->next;
     
    148206    }
    149207  cout << "npc left" << endl;
     208  */
    150209}
    151210
     
    160219bool World::addEnv(Environment* env)
    161220{
     221  /*
    162222  envList* listMember = new envList;
    163223  listMember->env = env;
     
    173233    }
    174234  lastEnv = listMember;
     235  */
     236}
     237
     238/**
     239   \brief Remove an environmental object
     240   \param player A reference to the env object
     241   
     242   Remove a environment from the game.
     243*/
     244bool World::removeEnv(Environment* env)
     245{
     246 
    175247}
    176248
     
    189261  gluLookAt(0.0, -14.0 + DataTank::yOffset, 15.0, 0.0, 0.0 + DataTank::yOffset, 0.0, 0.0, 1.0, 0.0);
    190262  /* first draw all players */
     263
     264
     265  /*
    191266  playerList* tmpPlayer = lastPlayer;
    192267  Player* player = tmpPlayer->player;
     
    196271      tmpPlayer = tmpPlayer->next;
    197272    }
     273  */
    198274  /* second draw all npcs */
     275  /*
    199276  npcList* tmpNPC = lastNPC;
    200277  while( tmpNPC != null )
     
    203280      tmpNPC = tmpNPC->next;
    204281    }
     282  */
    205283
    206284  /* now draw the rest of the world: environement */
     285  /*
    207286  envList* tmpEnv = lastEnv;
    208287  while( tmpEnv != null )
     
    211290      tmpEnv = tmpEnv->next;
    212291    }
    213  
     292  */
     293
    214294  /* draw the ground grid  */
    215295  glColor3f(0.0, 1.0, 0.0);
     
    240320  DataTank::yOffset += step;
    241321
     322  /*
    242323  tmpPlayer = lastPlayer;
    243324  while( tmpPlayer != null )
     
    246327      tmpPlayer = tmpPlayer->next;
    247328    }
    248 
     329  */
    249330
    250331}
     
    291372void World::detectCollision()
    292373{
     374  /*
    293375  //cout << "World::detectCollision" << endl;
    294376  float xOff, yOff, zOff, radius;
    295377  npcList* tmpNPC, *tmpRef;
    296 
     378  */
    297379  //cout << "World::detectCollsions" << endl;
    298380  /* first: check if any player's shoots trigger a collision */
     381  /*
    299382  playerList* tmpPlayer = lastPlayer;
    300383  Player* player = tmpPlayer->player;
     
    318401                  //cout << "COLLISION " << endl;
    319402                  int state = tmpNPC->npc->hit();
     403  */
    320404                  /* state is a value that marks if the ship dies or not */
    321405                  /* if state == 0 the ship dies and we have to remove it */
     
    327411                    break;
    328412                  }
    329                   */
     413                 
    330414                }
    331415              shoota = shoota->next;
     
    338422      tmpPlayer = tmpPlayer->next;
    339423      //cout << "changing play done" << endl;
    340     }
    341 
     424     
     425    }
     426                  */
    342427  //cout << "World::detectCollisions middle" << endl;
    343428
    344429  /* second: check if any player hits an enemy */
     430/*
    345431  tmpPlayer = lastPlayer;
    346432  while( tmpPlayer != null )
     
    365451 
    366452 
    367 
     453*/
    368454  /* third: check if any enemy shoots a player */
    369455
     
    380466void World::testThaTest(void)
    381467{
     468/*
    382469  cout << "World::testThaTest() called" << endl;
    383   /* test addPlayer */
     470
    384471  cout << "addPlayer test..." << endl;
    385472  playerList* pl = lastPlayer;
     
    390477    }
    391478
    392   /* test addNPC */
     479
    393480  cout << "addNPC test..." << endl;
    394481  npcList* nl = lastNPC;
     
    400487
    401488
    402   /* test addEnv */
     489
    403490  cout << "addEnv test..." << endl;
    404491  envList* en = lastEnv;
     
    408495      en = en->next;
    409496    }
    410 
    411   /* test drawWorld() */
    412 }
     497*/
     498}
Note: See TracChangeset for help on using the changeset viewer.