Changeset 1858 in orxonox.OLD for orxonox/trunk/core
- Timestamp:
- May 5, 2004, 7:33:27 PM (21 years ago)
- Location:
- orxonox/trunk/core
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/core/npc.cc
r1855 r1858 19 19 #include "npc.h" 20 20 21 #include <iostream> 22 23 using namespace std; 21 24 22 25 … … 28 31 29 32 33 void NPC::setPosition(int x, int y, int z) 34 { 35 xCor = x; yCor = y; zCor = z; 36 } 37 38 void NPC::getPosition(int* x, int* y, int* z) 39 { 40 *x = xCor; 41 *y = yCor; 42 *z = zCor; 43 } 44 45 46 void NPC::drawNPC(void) 47 { 48 cout << "Player::drawNPC()" << endl; 49 } -
orxonox/trunk/core/npc.h
r1855 r1858 10 10 ~NPC (); 11 11 12 void drawNPC(void); 13 void setPosition(int x, int y, int z); 14 void getPosition(int* x, int* y, int* z); 15 16 private: 17 /* position of the non player space craft */ 18 12 19 int npcType; 20 21 int xCor; 22 int yCor; 23 int zCor; 24 ; 13 25 14 26 }; -
orxonox/trunk/core/orxonox.cc
r1856 r1858 72 72 glutDisplayFunc(display); 73 73 glutReshapeFunc(reshape); 74 glutKeyboardFunc(keyboard); 74 75 } 75 76 … … 88 89 } 89 90 91 92 void Orxonox::keyboard(unsigned char key, int x, int y) 93 { 94 switch(key) { 95 case 27: 96 exit 0; 97 break; 98 } 99 } 90 100 91 101 … … 122 132 (*wd).addPlayer(pl); 123 133 (*wd).addPlayer(pl); 134 135 NPC* nl = new NPC; 136 (*wd).addNPC(nl); 137 (*wd).addNPC(nl); 138 (*wd).addNPC(nl); 139 (*wd).addNPC(nl); 140 (*wd).addNPC(nl); 141 (*wd).addNPC(nl); 124 142 (*wd).testThaTest(); 125 143 -
orxonox/trunk/core/orxonox.h
r1856 r1858 23 23 static void display (void); 24 24 static void reshape (int w, int h); 25 static void keyboard(unsigned char key, int x, int y); 25 26 }; 26 27 -
orxonox/trunk/core/player.cc
r1856 r1858 14 14 15 15 #include "player.h" 16 #include <iostream> 16 17 17 18 using namespace std; … … 25 26 26 27 28 void Player::setPosition( int x, int y, int z) 29 { 30 xCor = x; yCor = y; zCor = z; 31 } 32 33 34 void Player::drawPlayer(void) 35 { 36 cout << "Player::drawPlayer()" << endl; 37 } -
orxonox/trunk/core/player.h
r1856 r1858 10 10 ~Player (); 11 11 12 void setPosition(int x, int y, int z); 13 void getPosition(int* x, int* y, int* z); 14 void drawPlayer(void); 15 12 16 private: 13 17 /* position of the space craft */ … … 16 20 int zCor; 17 21 22 23 18 24 }; 19 25 -
orxonox/trunk/core/world.cc
r1856 r1858 24 24 25 25 26 26 /** 27 \brief Create a new World 28 29 This creates a new empty world! 30 */ 27 31 World::World () { 28 32 lastPlayer = null; 33 lastNPC = null; 29 34 } 30 35 … … 57 62 58 63 64 /** 65 \brief Remove Player 66 \param player A reference to the new npc object 67 68 Remove a new Player to the game. 69 */ 70 bool World::removePlayer(Player* player) { 71 cout << "World::removeNPC not implemented yet" << endl; 72 } 73 74 75 /** 76 \brief Add Non-Player-Character 77 \param player A reference to the new npc object 78 79 Add a new Non-Player-Character to the game. Player has to be initialised previously 80 */ 81 bool World::addNPC(NPC* npc) 82 { 83 npcList* listMember = new npcList; 84 listMember->npc = npc; 85 if ( lastNPC != null ) 86 { 87 listMember->number = lastNPC->number + 1; 88 listMember->next = lastNPC; 89 } 90 else 91 { 92 listMember->number = 0; 93 listMember->next = null; 94 } 95 lastNPC = listMember; 96 } 97 98 99 /** 100 \brief Remove Non-Player-Character 101 \param player A reference to the new npc object 102 103 Remove a new Non-Player-Character to the game. 104 */ 105 bool World::removeNPC(NPC* npc) { 106 cout << "World::removeNPC not implemented yet" << endl; 107 } 108 109 110 111 /** 112 \brief Draws the World and all Objects contained 113 114 Calls the draw function of all: Objects, Players, Environement 115 */ 116 void World::drawWorld(void) 117 { 118 playerList* tmpPlayer = lastPlayer; 119 Player* player = tmpPlayer->player; 120 while( tmpPlayer != null ) 121 { 122 (*tmpPlayer->player).drawPlayer(); 123 tmpPlayer = tmpPlayer->next; 124 } 125 npcList* tmpNPC = lastNPC; 126 while( tmpNPC != null ) 127 { 128 (*tmpNPC->npc).drawNPC(); 129 tmpNPC = tmpNPC->next; 130 } 131 } 132 133 134 /** 135 \brief Updates the world and all its objects 136 137 Calculates the new state of the world. User-input and AI of 138 the enemies are accounted for. 139 */ 140 void World::updateWorld(void) 141 { 142 143 144 } 145 146 59 147 60 148 /** … … 63 151 testing, testing, testing... 64 152 */ 65 void World::testThaTest( )153 void World::testThaTest(void) 66 154 { 67 155 cout << "World::testThaTest() called" << endl; … … 75 163 } 76 164 165 /* test addNPC */ 166 cout << "addNPC test..." << endl; 167 npcList* nl = lastNPC; 168 while ( nl != null ) 169 { 170 cout << "npc " << nl->number << " was found" << endl; 171 nl = nl->next; 172 } 173 174 /* test drawWorld() */ 175 cout << "drawWorld()..." << endl; 176 drawWorld(); 177 77 178 cout << "World::testThaTest() finished" << endl; 78 179 } 79 80 bool World::removePlayer(Player* player) {}81 82 bool World::addNPC(NPC* npc) {}83 bool World::removeNPC(NPC* npc) {} -
orxonox/trunk/core/world.h
r1856 r1858 30 30 npcList* next; 31 31 NPC* npc; 32 int number; 32 33 }; 33 npcList* firstNPC;34 npcList* lastNPC; 34 35 35 36 bool addPlayer(Player* player); … … 39 40 bool removeNPC(NPC* npc); 40 41 42 43 void drawWorld(void); 44 void updateWorld(void); 41 45 void testThaTest(void); 42 46
Note: See TracChangeset
for help on using the changeset viewer.