Changeset 2036 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Jun 27, 2004, 7:48:44 PM (20 years ago)
- Location:
- orxonox/trunk/src
- Files:
-
- 6 added
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/Makefile.am
r1959 r2036 6 6 7 7 bin_PROGRAMS=orxonox 8 orxonox_SOURCES=orxonox.cc world.cc environment.cc player.cc npc.cc input_output.cc data_tank.cc ai.cc shoot_laser.cc shoot_rocket.cc 8 orxonox_SOURCES=orxonox.cc world.cc environment.cc player.cc npc.cc input_output.cc data_tank.cc ai.cc shoot_laser.cc shoot_rocket.cc world_entity.cc synchronisable.cc list.cc 9 9 10 10 # uncomment the following if bencoder requires the math library -
orxonox/trunk/src/Makefile.in
r2018 r2036 117 117 #"-O3 -pedantic -fPIC -ffast-math -I/usr/X11R6/include" 118 118 bin_PROGRAMS = orxonox 119 orxonox_SOURCES = orxonox.cc world.cc environment.cc player.cc npc.cc input_output.cc data_tank.cc ai.cc shoot_laser.cc shoot_rocket.cc 119 orxonox_SOURCES = orxonox.cc world.cc environment.cc player.cc npc.cc input_output.cc data_tank.cc ai.cc shoot_laser.cc shoot_rocket.cc world_entity.cc synchronisable.cc list.cc 120 120 subdir = src 121 121 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 … … 129 129 environment.$(OBJEXT) player.$(OBJEXT) npc.$(OBJEXT) \ 130 130 input_output.$(OBJEXT) data_tank.$(OBJEXT) ai.$(OBJEXT) \ 131 shoot_laser.$(OBJEXT) shoot_rocket.$(OBJEXT) 131 shoot_laser.$(OBJEXT) shoot_rocket.$(OBJEXT) \ 132 world_entity.$(OBJEXT) synchronisable.$(OBJEXT) list.$(OBJEXT) 132 133 orxonox_OBJECTS = $(am_orxonox_OBJECTS) 133 134 orxonox_LDADD = $(LDADD) … … 140 141 @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/ai.Po ./$(DEPDIR)/data_tank.Po \ 141 142 @AMDEP_TRUE@ ./$(DEPDIR)/environment.Po \ 142 @AMDEP_TRUE@ ./$(DEPDIR)/input_output.Po ./$(DEPDIR)/npc.Po \ 143 @AMDEP_TRUE@ ./$(DEPDIR)/orxonox.Po ./$(DEPDIR)/player.Po \ 144 @AMDEP_TRUE@ ./$(DEPDIR)/shoot_laser.Po \ 145 @AMDEP_TRUE@ ./$(DEPDIR)/shoot_rocket.Po ./$(DEPDIR)/world.Po 143 @AMDEP_TRUE@ ./$(DEPDIR)/input_output.Po ./$(DEPDIR)/list.Po \ 144 @AMDEP_TRUE@ ./$(DEPDIR)/npc.Po ./$(DEPDIR)/orxonox.Po \ 145 @AMDEP_TRUE@ ./$(DEPDIR)/player.Po ./$(DEPDIR)/shoot_laser.Po \ 146 @AMDEP_TRUE@ ./$(DEPDIR)/shoot_rocket.Po \ 147 @AMDEP_TRUE@ ./$(DEPDIR)/synchronisable.Po ./$(DEPDIR)/world.Po \ 148 @AMDEP_TRUE@ ./$(DEPDIR)/world_entity.Po 146 149 CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ 147 150 $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) … … 200 203 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/environment.Po@am__quote@ 201 204 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/input_output.Po@am__quote@ 205 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ 202 206 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/npc.Po@am__quote@ 203 207 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orxonox.Po@am__quote@ … … 205 209 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shoot_laser.Po@am__quote@ 206 210 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shoot_rocket.Po@am__quote@ 211 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/synchronisable.Po@am__quote@ 207 212 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/world.Po@am__quote@ 213 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/world_entity.Po@am__quote@ 208 214 209 215 .cc.o: -
orxonox/trunk/src/environment.cc
r1956 r2036 11 11 any later version. 12 12 13 ### File Specific :14 main-programmer: ...15 co-programmer: ...13 ### File Specific 14 main-programmer: Patrick Boenzli 15 co-programmer: 16 16 */ 17 17 18 #include <iostream> 19 #include <GL/glut.h> 20 #include <stdlib.h> 21 22 #include "data_tank.h" 18 23 19 24 #include "environment.h" 20 #include <iostream>21 22 25 23 26 using namespace std; 24 27 25 28 29 //Sorry Bensch 30 #define LEVEL_LENGTH 500 26 31 27 32 Environment::Environment () 33 : WorldEntity() 28 34 { 29 35 30 31 for (int x = 0; x < 10; x++) 36 /* 37 //Sorry Bensch: x,y = 10 38 for (int x = 0; x < 50; x++) 32 39 { 33 for (int y = 0; y < 10; y++)40 for (int y = 0; y < 50; y++) 34 41 { 35 mountainTest[x][y] = 42 mountainTest[x][y] =0; 36 43 37 44 } 38 45 } 39 40 for (int x = 1; x < 9; x++)46 //Sorry Bensch: x,y = 9 47 for (int x = 1; x < LEVEL_LENGTH; x++) 41 48 { 42 for (int y = 1; y < 9; y++)49 for (int y = 1; y < LEVEL_LENGTH; y++) 43 50 { 44 mountainTest[x][y] = (float)rand() / 900000000;45 51 //mountainTest[x][y] = (float)random() / 900000000; 52 mountainTest[x][y] = (float)(random() % 4); 46 53 } 47 54 } 55 */ 48 56 } 49 57 … … 53 61 54 62 55 56 void Environment::drawEnvironment() 63 void Environment::paint() 57 64 { 65 /* 58 66 glPushMatrix(); 59 67 //glScalef(0.5, 0.5, 1.0); … … 64 72 65 73 glBegin(GL_LINES); 66 for (int x = 0; x < 9; x += 1)74 for (int x = 0; x < LEVEL_LENGTH; x += 1) 67 75 { 68 for (int y = 0; y < 9; y += 1)76 for (int y = 0; y < 190; y += 1) 69 77 { 70 78 glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); … … 76 84 77 85 glBegin(GL_LINES); 78 for (int y = 0; y < 9; y += 1)86 for (int y = 0; y < LEVEL_LENGTH; y += 1) 79 87 { 80 for (int x = 0; x < 9 ; x += 1)88 for (int x = 0; x < 90; x += 1) 81 89 { 82 90 glVertex3f((float)(2*x), (float)(2*y), mountainTest[x][y]); … … 87 95 88 96 glPopMatrix(); 97 */ 89 98 } 90 99 100 void Environment::drawEnvironment() 101 { 102 103 } 104 -
orxonox/trunk/src/environment.h
r1956 r2036 1 1 2 #include <GL/glut.h> 3 #include <stdlib.h> 2 4 3 5 4 #ifndef ENVIRONEMENT_H 6 5 #define ENVIRONEMENT_H 7 6 8 #include "data_tank.h"9 7 10 class Environment { 8 #include "world_entity.h" 9 10 class Environment : public WorldEntity { 11 11 12 12 private: … … 21 21 ~Environment (); 22 22 23 void paint(void); 23 24 void drawEnvironment(void); 24 25 void setEnvPosition(void); -
orxonox/trunk/src/input_output.cc
r1956 r2036 16 16 */ 17 17 18 #include <iostream> 19 20 #include "world.h" 21 #include "input_output.h" 22 #include "player.h" 18 23 19 24 #include "input_output.h" 20 #include <iostream>21 25 22 26 using namespace std; -
orxonox/trunk/src/input_output.h
r1956 r2036 5 5 #define INPUT_OUTPUT_H 6 6 7 #include "world.h" 8 #include "input_output.h" 9 #include "player.h" 7 10 8 11 9 #include "data_tank.h" 10 11 class World; 12 class Player; 12 13 13 14 class InputOutput { -
orxonox/trunk/src/npc.cc
r1956 r2036 16 16 */ 17 17 18 #include <iostream> 19 #include <GL/glut.h> 20 21 #include "ai.h" 22 #include "data_tank.h" 18 23 19 24 #include "npc.h" 20 21 #include <iostream>22 23 25 24 26 using namespace std; 25 27 26 28 27 NPC::NPC () 29 NPC::NPC() 30 : WorldEntity() 28 31 { 29 32 hasDied = 0; … … 57 60 58 61 void NPC::addAI(AI* ai) 62 {} 63 64 void NPC::paint() 59 65 { 60 61 } 62 63 void NPC::drawNPC(void) 64 { 66 //cout << "WorldEntity::WorldEntity();" << endl; 65 67 /* fix: died flag approach is very stupid, just to show @ convention */ 66 68 if( hasDied == 0 ) { … … 73 75 } 74 76 77 void NPC::drawNPC() 78 { 79 80 } 81 75 82 76 83 /* define the reaction, if the ship is been hit */ … … 81 88 } 82 89 90 83 91 void NPC::die() 84 92 { -
orxonox/trunk/src/npc.h
r1956 r2036 3 3 #define NPC_H 4 4 5 /* openGL Headers */ 6 #include <GL/glut.h> 5 #include "world_entity.h" 7 6 8 #include "ai.h" 9 #include "data_tank.h" 7 class AI; 10 8 11 class NPC {9 class NPC : public WorldEntity { 12 10 13 11 public: … … 23 21 24 22 void drawNPC(void); 23 void paint(void); 25 24 void setPosition(float x, float y, float z); 26 25 void getPosition(float* x, float* y, float* z); -
orxonox/trunk/src/orxonox.cc
r1957 r2036 24 24 */ 25 25 26 /* class definition header */ 26 #include <iostream> 27 #include <cstdio> 28 #include <GL/glut.h> 29 30 #include "environment.h" 31 #include "world.h" 32 #include "input_output.h" 33 #include "data_tank.h" 34 #include "stdincl.h" 35 #include "player.h" 36 #include "npc.h" 37 #include "shoot_laser.h" 38 27 39 #include "orxonox.h" 28 40 29 30 41 using namespace std; 31 42 32 43 33 34 44 Orxonox::Orxonox () 35 45 { … … 40 50 41 51 Orxonox::~Orxonox () 42 { 43 glutSetKeyRepeat(GLUT_KEY_REPEAT_ON); 44 } 52 {} 45 53 46 54 … … 63 71 //int Orxonox::offsetY = 0; 64 72 73 65 74 Orxonox* Orxonox::getInstance (void) 66 75 { … … 79 88 //glutFullScreen(); 80 89 glutInitWindowPosition(100, 100); 81 glutCreateWindow(" orxOnox");90 glutCreateWindow("OrxonoX"); 82 91 glShadeModel(GL_FLAT); 83 92 /* window event dispatchers */ … … 138 147 io->setPlayerStep(19.2/fps); /* set player to propper speed */ 139 148 localPlayer->shootLaser->setShootStep(20.0/fps); /* set shoot speed */ 140 localPlayer->shootRocket->setShootStep(20.0/fps); /* set shoot speed */141 149 world->setWorldStep(7.0/fps); /* set the speed of the terrain moving away */ 142 150 fps = 0; -
orxonox/trunk/src/orxonox.h
r1956 r2036 1 2 3 1 4 2 #ifndef ORXONOX_H 5 3 #define ORXONOX_H 6 4 7 /* standard headers */ 8 #include <iostream> 9 #include <cstdio> 10 11 /* openGL Headers */ 12 #include <GL/glut.h> 13 14 15 #include "environment.h" 16 #include "world.h" 17 #include "input_output.h" 18 #include "data_tank.h" 19 #include "stdincl.h" 20 #include "player.h" 5 class World; 6 class InputOutput; 7 class Player; 21 8 22 9 … … 47 34 48 35 public: 49 50 36 static Orxonox* getInstance (void); 51 37 -
orxonox/trunk/src/player.cc
r1957 r2036 16 16 */ 17 17 18 #include <iostream> 19 #include <stdlib.h> 20 #include <GL/glut.h> 21 22 #include "shoot_laser.h" 23 #include "shoot_rocket.h" 24 #include "data_tank.h" 18 25 19 26 #include "player.h" 20 #include <iostream>21 #include <stdlib.h>22 23 27 24 28 using namespace std; 25 29 26 30 27 Player::Player () { 28 // cout << "Player::Player" << endl; 31 Player::Player() 32 : WorldEntity() { 33 //cout << "Player::Player" << endl; 29 34 xCor = yCor = zCor = 0; 30 35 shootLaser = new ShootLaser; … … 58 63 void Player::goX(float x) 59 64 { 60 //cout << "Player::goX" << endl;61 65 xCor += x; 62 66 } … … 73 77 } 74 78 79 80 75 81 void Player::shoot(int n) 76 82 { 83 77 84 // if (shootLaser->inhibitor++ <= 100) 78 79 80 81 82 83 84 85 shootLaser->addShoot(xCor, yCor, zCor); 86 // else if (shootLaser->inhibitor++ <= 200) 87 shootLaser->addShootExt(xCor, yCor, zCor, .1, .4, .0); 88 // else if (shootLaser->inhibitor++ <= 300) 89 shootLaser->addShootExt(xCor, yCor, zCor, -0.1, .4, .0); 90 // else 91 shootLaser->inhibitor =0; 85 92 86 87 88 89 90 91 92 93 //shootRocket->inhibitor =0;94 93 // if (shootRocket->inhibitor++ >=80) 94 { 95 shootRocket->addBackParable(xCor, yCor, zCor); 96 shootRocket->addSideAcc(xCor, yCor, zCor, RIGHT); 97 shootRocket->addSideAcc(xCor, yCor, zCor, LEFT); 98 shootRocket->addRotater(xCor, yCor, zCor); 99 // if (shootRocket->inhibitor >=90) 100 // shootRocket->inhibitor =0; 101 } 95 102 //cout << "Player::shoot" << endl; 103 104 /* 105 shootLaser->addShoot(xCor, yCor, zCor); 106 shootLaser->addShootExt(xCor, yCor, zCor, .1, .4, .0); 107 shootLaser->addShootExt(xCor, yCor, zCor, -0.1, .4, .0); 108 //shootRocket->addShoot(xCor, yCor, zCor); 109 //cout << "Player::shoot" << endl; 110 */ 96 111 } 97 112 … … 100 115 101 116 102 void Player:: drawPlayer(void)117 void Player::paint() 103 118 { 119 //cout << "Player::drawPlayer" << endl; 104 120 glPushMatrix(); 105 121 glTranslatef(xCor, yCor, 3.0); … … 110 126 shootLaser->drawShoot(); 111 127 shootRocket->drawShoot(); 112 //cout << "Player::drawPlayer " << endl;128 //cout << "Player::drawPlayer, end" << endl; 113 129 } 114 130 -
orxonox/trunk/src/player.h
r1956 r2036 3 3 #define PLAYER_H 4 4 5 /* openGL Headers */ 6 #include <GL/glut.h> 5 #include "world_entity.h" 7 6 8 #include "shoot_laser.h" 9 #include "shoot_rocket.h" 10 #include "data_tank.h" 7 class ShootLaser; 8 class ShootRocket; 11 9 12 class Player { 10 11 class Player : public WorldEntity 12 { 13 13 14 14 public: … … 23 23 float collisionRadius; 24 24 25 25 26 /* this player wanna shoot? so include a ref to ShootLaser */ 26 27 ShootLaser* shootLaser; … … 30 31 void getPosition(float* x, float* y, float* z); 31 32 void setCollisionRadius(float radius); 33 void paint(); 32 34 void goX(float x); 33 35 void goY(float y); -
orxonox/trunk/src/proto_class.h
r1956 r2036 4 4 5 5 #include "data_tank.h" 6 6 7 7 8 class ProtoClass { -
orxonox/trunk/src/shoot_laser.cc
r1956 r2036 17 17 18 18 19 #include "shoot_laser.h"20 19 20 21 #include <GL/glut.h> 21 22 #include <iostream> 22 23 24 #include "stdincl.h" 25 #include "data_tank.h" 26 27 #include "shoot_laser.h" 23 28 24 29 using namespace std; … … 134 139 cout << "ShootLaser::setShootStep to " << step << endl; 135 140 this->step = step; 141 cout << "ShootLaser::setShootStep end " << step << endl; 136 142 } 137 143 -
orxonox/trunk/src/shoot_laser.h
r1956 r2036 3 3 #define SHOOT_LASER_H 4 4 5 /* openGL Headers */6 #include <GL/glut.h>7 8 #include "stdincl.h"9 #include "data_tank.h"10 5 11 6 class ShootLaser { 12 13 7 14 8 public: -
orxonox/trunk/src/shoot_rocket.cc
r1957 r2036 17 17 18 18 19 #include <iostream> 20 #include <math.h> 21 #include <GL/glut.h> 22 23 #include "stdincl.h" 24 #include "data_tank.h" 25 #include "npc.h" 26 19 27 #include "shoot_rocket.h" 20 21 #include <iostream>22 23 28 24 29 using namespace std; -
orxonox/trunk/src/shoot_rocket.h
r1957 r2036 3 3 #define SHOOT_ROCKET_H 4 4 5 /* openGL Headers */6 #include <GL/glut.h>7 #include <math.h>8 5 9 #include "stdincl.h"10 #include "data_tank.h"11 #include "npc.h"12 6 13 7 enum RocketType { HOMING, SIDEACC, BACKPARABLE, ROTATER}; 14 8 enum RocketDirection {LEFT, RIGHT, UP, DOWN}; 15 9 10 16 11 class ShootRocket { 17 18 12 19 13 public: -
orxonox/trunk/src/world.cc
r1956 r2036 15 15 */ 16 16 17 #include <iostream> 18 #include <stdlib.h> 19 #include <cmath> 20 #include <GL/glut.h> 21 22 #include "npc.h" 23 #include "player.h" 24 #include "environment.h" 25 #include "shoot_laser.h" 26 #include "shoot_rocket.h" 27 #include "stdincl.h" 28 #include "data_tank.h" 17 29 18 30 #include "world.h" 19 31 20 #include <iostream>21 32 22 33 using namespace std; … … 174 185 void World::drawWorld(void) 175 186 { 187 176 188 glLoadIdentity(); 177 189 gluLookAt(0.0, -14.0 + DataTank::yOffset, 15.0, 0.0, 0.0 + DataTank::yOffset, 0.0, 0.0, 1.0, 0.0); … … 181 193 while( tmpPlayer != null ) 182 194 { 183 (*tmpPlayer->player).drawPlayer();195 tmpPlayer->player->paint(); 184 196 tmpPlayer = tmpPlayer->next; 185 197 } … … 188 200 while( tmpNPC != null ) 189 201 { 190 (*tmpNPC->npc). drawNPC();202 (*tmpNPC->npc).paint(); 191 203 tmpNPC = tmpNPC->next; 192 204 } … … 235 247 } 236 248 237 249 238 250 } 239 251 … … 254 266 void World::setWorldStep(float step) 255 267 { 268 //cout << "World::setWorldStep(" << step << ");" << endl; 256 269 this->step = step; 257 cout << "setting speed to " << step << endl;270 //cout << "setting speed to " << step << endl; 258 271 } 259 272 -
orxonox/trunk/src/world.h
r1956 r2036 1 2 3 1 4 2 #ifndef WORLD_H 5 3 #define WORLD_H 6 4 7 #include <stdlib.h> 8 #include <cmath> 5 class Player; 6 class NPC; 7 class Environment; 9 8 10 #include "npc.h"11 #include "player.h"12 #include "environment.h"13 #include "shoot_laser.h"14 #include "shoot_rocket.h"15 #include "stdincl.h"16 #include "data_tank.h"17 9 18 10 class World {
Note: See TracChangeset
for help on using the changeset viewer.