- Timestamp:
- Dec 11, 2004, 8:38:55 PM (20 years ago)
- Location:
- orxonox/branches/dave/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/dave/src/Makefile.am
r3151 r3155 7 7 bin_PROGRAMS=orxonox 8 8 9 orxonox_SOURCES=orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc 9 orxonox_SOURCES=orxonox.cc world.cc player.cc data_tank.cc world_entity.cc vector.cc camera.cc collision.cc command_node.cc ini_parser.cc keynames.cc track.cc base_entity.cc game_loader.cc campaign.cc story_entity.cc object.cc environment.cc array.cc material.cc list.cc 10 10 noinst_HEADERS=ability.h data_tank.h npc.h stdincl.h ai.h environment.h orxonox.h synchronisable.h base_entity.h error.h player.h track.h camera.h ini_parser.h power_up.h vector.h collision.h keynames.h proto_class.h world.h command_node.h list.h shoot_laser.h world_entity.h coordinates.h message_structures.h shoot_rocket.h object.h array.h material.h list_template.h story_entity.h story_def.h game_loader.h campaign.h 11 11 -
orxonox/branches/dave/src/command_node.cc
r2860 r3155 186 186 strcpy( cmd.cmd, aliases->keys[event.key.keysym.sym]); 187 187 cmd.bUp = true; 188 cmd.tottime=0.0f; 189 188 190 if( strlen (cmd.cmd) > 0) relay (&cmd); 189 191 break; -
orxonox/branches/dave/src/command_node.h
r2860 r3155 23 23 */ 24 24 typedef struct 25 { 25 { 26 26 char keys[N_STD_KEYS][CMD_LENGHT]; 27 27 char buttons[N_BUTTONS][CMD_LENGHT]; … … 43 43 List* bound; //!< List of WorldEntites that recieve commands from this CommandNode 44 44 Sint32 coord[2]; 45 45 46 46 47 -
orxonox/branches/dave/src/message_structures.h
r2551 r3155 11 11 //! structure that contains a command message 12 12 typedef struct 13 { 13 { float tottime; 14 14 char cmd[CMD_LENGHT]; //!< the command delivered 15 15 bool bUp; //!< false = command was activated / true = command was deactivated -
orxonox/branches/dave/src/player.cc
r3151 r3155 19 19 #include "stdincl.h" 20 20 #include "collision.h" 21 #include "command_node.h" 21 22 22 23 using namespace std; … … 27 28 28 29 obj = new Object ("reaplow.obj"); 30 tottime=0.0f; 31 29 32 /* 30 33 objectList = glGenLists(1); … … 90 93 { 91 94 //printf("Player|recieved command [%s]\n", cmd->cmd); 95 tottime=cmd->tottime; 92 96 if( !strcmp( cmd->cmd, "up")) bUp = !cmd->bUp; 93 97 else if( !strcmp( cmd->cmd, "down")) bDown = !cmd->bUp; … … 137 141 Vector orthDirection(0.0, 0.0, 1.0); 138 142 orthDirection = orthDirection.cross(direction); 139 140 if( bUp) { accel = accel+(direction*acceleration); } 141 if( bDown) { accel = accel-(direction*acceleration); } 142 if( bLeft ) { accel = accel + (orthDirection*acceleration); } 143 if( bRight ) { accel = accel - (orthDirection*acceleration); } 143 if(tottime<1.5f) 144 tottime=tottime+4.0f*time; 145 else 146 tottime=1.5f; 147 if( bUp) { accel = accel+(direction*acceleration*pow(tottime,2.0f)); } 148 if( bDown) { accel = accel-(direction*acceleration*pow(tottime,2.0f)); } 149 if( bLeft ) { accel = accel + (orthDirection*acceleration*pow(tottime,2.0f)); } 150 if( bRight ) { accel = accel - (orthDirection*acceleration*pow(tottime,2.0f));} 144 151 if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */} 145 152 if( bDescend) {/* FIXME */} … … 156 163 157 164 /* this updates the player position on the track - user interaction */ 158 l->pos = l->pos + accel*time;165 l->pos = l->pos + (accel*time); 159 166 } 160 167 -
orxonox/branches/dave/src/player.h
r2860 r3155 9 9 #include "world_entity.h" 10 10 #include "object.h" 11 #include <math.h> 11 12 12 13 //! Basic controllable WorldEntity … … 39 40 GLuint objectList; 40 41 Object* obj; 42 float tottime; 41 43 42 44 void move (float time); -
orxonox/branches/dave/src/world.cc
r2860 r3155 185 185 glColor3f(1.0,0,0); 186 186 glBegin(GL_QUADS); 187 float height [500][ 50];188 Vector normal_vectors[500][ 50];187 float height [500][100]; 188 Vector normal_vectors[500][100]; 189 189 float size = 2; 190 for(int i=0;i<400;i+=1){ 191 for(int j=0;j<50;j+=1){ 192 normal_vectors[i][j].x=0; 193 normal_vectors[i][j].y=1; 194 normal_vectors[i][j].z=0; 195 196 197 198 } 199 } 200 190 201 191 202 192 for ( int i = 0; i<400; i+=1) 203 193 { 204 for (int j = 0; j< 50;j+=1)194 for (int j = 0; j<100;j+=1) 205 195 { 206 196 //height[i][j] = rand()/20046 + (j-25)*(j-25)/30; … … 208 198 } 209 199 } 210 for(int a=0;a<2;a+=1){200 //Die Hügel ein wenig glätten 211 201 for (int i=1;i<399 ;i+=1 ){ 212 for(int j=1;j< 49;j+=1){202 for(int j=1;j<99;j+=1){ 213 203 height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4; 214 204 215 205 } 216 206 } 217 }207 218 208 //Berechnung von normalen Vektoren 219 209 220 210 for(int i=1;i<399;i+=1){ 221 for(int j=1;j< 49 ;j+=1)222 223 { 224 Vector* v1 = new Vector (size*i, size*(j-25),height[i][j]-20 );225 Vector* v2 = new Vector (size*(i+1), size*(j-25),height[i+1][j]-20);226 Vector* v3 = new Vector (size*(i), size*(j-24),height[i][j+1]-20);227 Vector* v4 = new Vector (size*(i-1), size*(j-25),height[i-1][j]-20);228 Vector* v5 = new Vector (size*(i), size*(j-26),height[i][j-1]-20);211 for(int j=1;j<99 ;j+=1) 212 213 { 214 Vector* v1 = new Vector (size*i,size*(j-25)-50,height[i][j]-20 ); 215 Vector* v2 = new Vector (size*(i+1),size*(j-25)-50,height[i+1][j]-20); 216 Vector* v3 = new Vector (size*(i),size*(j-24)-50,height[i][j+1]-20); 217 Vector* v4 = new Vector (size*(i-1),size*(j-25)-50,height[i-1][j]-20); 218 Vector* v5 = new Vector (size*(i),size*(j-26)-50,height[i][j-1]-20); 229 219 230 220 Vector c1 = *v1 - *v2; … … 243 233 for ( int i = 0; i<400; i+=1) 244 234 { 245 for (int j = 0; j< 50;j+=1)235 for (int j = 0; j<100;j+=1) 246 236 { 247 Vector* v1 = new Vector (size*i, size*(j-25), height[i][j]-20 );248 Vector* v2 = new Vector (size*(i+1), size*(j-25), height[i+1][j]-20);249 Vector* v3 = new Vector (size*(i+1), size*(j-24), height[i+1][j+1]-20);250 Vector* v4 = new Vector (size*(i), size*(j-24), height[i][j+1]-20);237 Vector* v1 = new Vector (size*i, size*(j-25)-50, height[i][j]-20 ); 238 Vector* v2 = new Vector (size*(i+1), size*(j-25)-50, height[i+1][j]-20); 239 Vector* v3 = new Vector (size*(i+1), size*(j-24)-50, height[i+1][j+1]-20); 240 Vector* v4 = new Vector (size*(i), size*(j-24)-50, height[i][j+1]-20); 251 241 float a[3]; 252 242 if(height[i][j]<snowheight){
Note: See TracChangeset
for help on using the changeset viewer.