Changeset 2077 in orxonox.OLD for orxonox/trunk/src/world.cc
- Timestamp:
- Jul 5, 2004, 9:51:48 PM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/world.cc
r2036 r2077 28 28 #include "data_tank.h" 29 29 30 #include "list.h" 31 #include "world_entity.h" 32 30 33 #include "world.h" 31 34 … … 37 40 \brief Create a new World 38 41 39 This creates a new empty world!42 This creates a new, empty world! 40 43 */ 41 44 World::World () { 42 lastPlayer = null;43 lastNPC = null;44 lastEnv = null;45 //lastPlayer = null; 46 //lastNPC = null; 47 //lastEnv = null; 45 48 primitiveMove = 0; 46 49 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*>(); 47 55 } 48 56 49 57 50 58 World::~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 */ 67 void 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 */ 75 void 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 */ 83 void 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 */ 92 void World::saveGameState(char* filename) {} 93 51 94 52 95 … … 59 102 bool World::addPlayer(Player* player) 60 103 { 104 WorldEntity *we; 105 playerList->add(we); 106 /* 61 107 playerList* listMember = new playerList; 62 108 listMember->player = player; … … 72 118 } 73 119 lastPlayer = listMember; 74 } 75 120 */ 121 } 76 122 77 123 /** … … 79 125 \param player A reference to the new npc object 80 126 81 Remove a new Player to the game. 127 Remove a new Player to the game. This kills the player objects. 82 128 */ 83 129 bool 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 */ 87 139 Player* World::getLocalPlayer() 88 140 { … … 99 151 bool World::addNPC(NPC* npc) 100 152 { 153 npcList->add(npc, LIST_ADD_NEXT); 154 /* 101 155 npcList* listMember = new npcList; 102 156 listMember->npc = npc; … … 112 166 } 113 167 lastNPC = listMember; 168 */ 114 169 } 115 170 … … 117 172 /** 118 173 \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 */ 178 bool World::removeNPC(NPC* npc) 179 { 180 npcList->remove(npc, LIST_FIND_FW); 181 /* 125 182 npcList* npcRef = lastNPC; 126 183 npcList* lastRef = lastNPC; … … 128 185 { 129 186 if ( npcRef->npc == npc ) { 130 cout << "found" << endl; 187 cout < 188 < "found" << endl; 131 189 if ( npcRef == lastRef ) { 132 190 lastNPC = lastNPC->next; … … 148 206 } 149 207 cout << "npc left" << endl; 208 */ 150 209 } 151 210 … … 160 219 bool World::addEnv(Environment* env) 161 220 { 221 /* 162 222 envList* listMember = new envList; 163 223 listMember->env = env; … … 173 233 } 174 234 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 */ 244 bool World::removeEnv(Environment* env) 245 { 246 175 247 } 176 248 … … 189 261 gluLookAt(0.0, -14.0 + DataTank::yOffset, 15.0, 0.0, 0.0 + DataTank::yOffset, 0.0, 0.0, 1.0, 0.0); 190 262 /* first draw all players */ 263 264 265 /* 191 266 playerList* tmpPlayer = lastPlayer; 192 267 Player* player = tmpPlayer->player; … … 196 271 tmpPlayer = tmpPlayer->next; 197 272 } 273 */ 198 274 /* second draw all npcs */ 275 /* 199 276 npcList* tmpNPC = lastNPC; 200 277 while( tmpNPC != null ) … … 203 280 tmpNPC = tmpNPC->next; 204 281 } 282 */ 205 283 206 284 /* now draw the rest of the world: environement */ 285 /* 207 286 envList* tmpEnv = lastEnv; 208 287 while( tmpEnv != null ) … … 211 290 tmpEnv = tmpEnv->next; 212 291 } 213 292 */ 293 214 294 /* draw the ground grid */ 215 295 glColor3f(0.0, 1.0, 0.0); … … 240 320 DataTank::yOffset += step; 241 321 322 /* 242 323 tmpPlayer = lastPlayer; 243 324 while( tmpPlayer != null ) … … 246 327 tmpPlayer = tmpPlayer->next; 247 328 } 248 329 */ 249 330 250 331 } … … 291 372 void World::detectCollision() 292 373 { 374 /* 293 375 //cout << "World::detectCollision" << endl; 294 376 float xOff, yOff, zOff, radius; 295 377 npcList* tmpNPC, *tmpRef; 296 378 */ 297 379 //cout << "World::detectCollsions" << endl; 298 380 /* first: check if any player's shoots trigger a collision */ 381 /* 299 382 playerList* tmpPlayer = lastPlayer; 300 383 Player* player = tmpPlayer->player; … … 318 401 //cout << "COLLISION " << endl; 319 402 int state = tmpNPC->npc->hit(); 403 */ 320 404 /* state is a value that marks if the ship dies or not */ 321 405 /* if state == 0 the ship dies and we have to remove it */ … … 327 411 break; 328 412 } 329 */413 330 414 } 331 415 shoota = shoota->next; … … 338 422 tmpPlayer = tmpPlayer->next; 339 423 //cout << "changing play done" << endl; 340 } 341 424 425 } 426 */ 342 427 //cout << "World::detectCollisions middle" << endl; 343 428 344 429 /* second: check if any player hits an enemy */ 430 /* 345 431 tmpPlayer = lastPlayer; 346 432 while( tmpPlayer != null ) … … 365 451 366 452 367 453 */ 368 454 /* third: check if any enemy shoots a player */ 369 455 … … 380 466 void World::testThaTest(void) 381 467 { 468 /* 382 469 cout << "World::testThaTest() called" << endl; 383 /* test addPlayer */ 470 384 471 cout << "addPlayer test..." << endl; 385 472 playerList* pl = lastPlayer; … … 390 477 } 391 478 392 /* test addNPC */ 479 393 480 cout << "addNPC test..." << endl; 394 481 npcList* nl = lastNPC; … … 400 487 401 488 402 /* test addEnv */ 489 403 490 cout << "addEnv test..." << endl; 404 491 envList* en = lastEnv; … … 408 495 en = en->next; 409 496 } 410 411 /* test drawWorld() */ 412 } 497 */ 498 }
Note: See TracChangeset
for help on using the changeset viewer.