Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3155 in orxonox.OLD for orxonox/branches/dave


Ignore:
Timestamp:
Dec 11, 2004, 8:38:55 PM (20 years ago)
Author:
dave
Message:

Bin dran die Bewegung smoother zu machen-first try

Location:
orxonox/branches/dave/src
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/dave/src/Makefile.am

    r3151 r3155  
    77bin_PROGRAMS=orxonox
    88
    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
     9orxonox_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 
    1010noinst_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
    1111
  • orxonox/branches/dave/src/command_node.cc

    r2860 r3155  
    186186          strcpy( cmd.cmd, aliases->keys[event.key.keysym.sym]);
    187187          cmd.bUp = true;
     188          cmd.tottime=0.0f;
     189         
    188190          if( strlen (cmd.cmd) > 0) relay (&cmd);
    189191          break;
  • orxonox/branches/dave/src/command_node.h

    r2860 r3155  
    2323*/
    2424typedef struct
    25 {
     25{ 
    2626  char keys[N_STD_KEYS][CMD_LENGHT];
    2727  char buttons[N_BUTTONS][CMD_LENGHT];
     
    4343  List* bound;  //!< List of WorldEntites that recieve commands from this CommandNode
    4444  Sint32 coord[2];
     45 
    4546 
    4647
  • orxonox/branches/dave/src/message_structures.h

    r2551 r3155  
    1111//! structure that contains a command message
    1212typedef struct
    13 {
     13{       float tottime;
    1414        char cmd[CMD_LENGHT];   //!< the command delivered
    1515        bool bUp;       //!< false = command was activated / true = command was deactivated
  • orxonox/branches/dave/src/player.cc

    r3151 r3155  
    1919#include "stdincl.h"
    2020#include "collision.h"
     21#include "command_node.h"
    2122
    2223using namespace std;
     
    2728
    2829  obj = new Object ("reaplow.obj");
     30  tottime=0.0f;
     31 
    2932  /*
    3033  objectList = glGenLists(1);
     
    9093{
    9194  //printf("Player|recieved command [%s]\n", cmd->cmd);
     95  tottime=cmd->tottime;
    9296  if( !strcmp( cmd->cmd, "up")) bUp = !cmd->bUp;
    9397  else if( !strcmp( cmd->cmd, "down")) bDown = !cmd->bUp;
     
    137141  Vector orthDirection(0.0, 0.0, 1.0);
    138142  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));}
    144151  if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */}
    145152  if( bDescend) {/* FIXME */}
     
    156163
    157164  /* this updates the player position on the track - user interaction */
    158   l->pos = l->pos + accel*time;
     165  l->pos = l->pos + (accel*time);
    159166}
    160167
  • orxonox/branches/dave/src/player.h

    r2860 r3155  
    99#include "world_entity.h"
    1010#include "object.h"
     11#include <math.h>
    1112
    1213//! Basic controllable WorldEntity
     
    3940  GLuint objectList;
    4041  Object* obj;
     42  float tottime;
    4143 
    4244  void move (float time);
  • orxonox/branches/dave/src/world.cc

    r2860 r3155  
    185185  glColor3f(1.0,0,0);
    186186  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];
    189189  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   
    201191       
    202192        for ( int i = 0; i<400; i+=1)
    203193      {
    204         for (int j = 0; j<50;j+=1)
     194        for (int j = 0; j<100;j+=1)
    205195          {
    206196            //height[i][j] = rand()/20046 + (j-25)*(j-25)/30;
     
    208198          }
    209199      }
    210          for(int a=0;a<2;a+=1){
     200         //Die Hügel ein wenig glätten
    211201         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){
    213203                         height[i][j]=(height[i+1][j]+height[i][j+1]+height[i-1][j]+height[i][j-1])/4;
    214204
    215205                 }
    216206         }
    217          }
     207         
    218208    //Berechnung von normalen Vektoren
    219209
    220210        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);
    229219               
    230220                Vector c1 = *v1 - *v2;
     
    243233        for ( int i = 0; i<400; i+=1)
    244234      {
    245         for (int j = 0; j<50;j+=1)
     235        for (int j = 0; j<100;j+=1)
    246236          {       
    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);
    251241            float a[3];
    252242                if(height[i][j]<snowheight){
Note: See TracChangeset for help on using the changeset viewer.