Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5205 in orxonox.OLD


Ignore:
Timestamp:
Sep 18, 2005, 10:37:20 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: new ShellCommand, that allows the user to set the speed of the game
try: 'world [tab] speed [value]

Location:
trunk/src/story_entities
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/story_entities/world.cc

    r5175 r5205  
    2020#include "world.h"
    2121
     22#include "shell_command.h"
    2223
    2324#include "state.h"
     
    7374#include "npc.h"
    7475
     76SHELL_COMMAND(speed, World, setSpeed);
     77
    7578using namespace std;
    7679
     
    163166  this->debugWorldNr = worldID;
    164167
     168  this->setSpeed(1.0);
    165169  this->music = NULL;
    166170}
     
    870874        }
    871875
    872       this->dtS = (float)this->dt / 1000.0;
     876      this->dtS = (float)this->dt / 1000.0 * this->speed;
    873877      this->gameTime += this->dtS;
    874878
  • trunk/src/story_entities/world.h

    r5039 r5205  
    6868  void spawn(WorldEntity* entity, PNode* parentNode, Vector* relCoor, Quaternion* relDir);
    6969
     70  /** @param speed sets the speed of the Game */
     71  inline void setSpeed(float speed) { this->speed = speed; };
    7072  const char* getPath();
    7173  void setPath( const char* name);
     
    8082  Uint32 dt;                          //!< time needed to calculate this frame (in milliSeconds)
    8183  float dtS;                          //!< The time needed for caluculations in seconds
     84  float speed;                        //!< how fast the game flows
    8285  double gameTime;                    //!< this is where the game time is saved
    8386  bool bQuitOrxonox;                  //!< quit this application
Note: See TracChangeset for help on using the changeset viewer.