00001 /*************************************************************************** 00002 dummymovement.h - description 00003 ------------------- 00004 begin : Sun Aug 26 2001 00005 copyright : (C) 2001 by T Kontkanen 00006 email : tkontkanen@mail.com 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef DUMMYMOVEMENT_H 00019 #define DUMMYMOVEMENT_H 00020 00021 00026 #include "renderer.h" 00027 #include "ground.h" 00028 #include "game.h" 00029 #include "allincludes.h" 00030 #include "gamedefs.h" 00031 #include "vector.h" 00032 00033 class DummyMovement { 00034 public: 00035 DummyMovement( Game *pgame ); 00036 ~DummyMovement(); 00037 00038 Vector &getPosition() { return position; } 00039 float getSpeed() { return velocity; } 00040 float getAngle() { return angle; } 00041 float getPitch() { return pitch; } 00042 float getTilt() { return tilt; } 00043 00044 //action 00045 void moveSetDestination( Vector destpos ) { destPosition=destpos; } 00046 Vector &moveGetDestination() { return destPosition; } 00047 void moveStep(); // make a move (one call per frame) 00048 00049 void setPosition( Vector &pos ) { 00050 position=pos; 00051 position.setZ(mGround->getElevation( pos.x(), pos.y() ) );//set elevation 00052 moveSetDestination( pos ); 00053 } 00054 void setTurnRate( float rate ) { turnrate=rate; } 00055 void setTopSpeed( float speed ) { topspeed=speed; } 00056 void setAcceleration( float a ) { acceleration=a; } 00057 00058 private: 00059 // own data 00060 Vector position, destPosition; 00061 float angle, pitch, tilt; //angle=z-axis rotation, pitch=x-axis and tilt=y-axis 00062 float velocity; /* m/s */ 00063 float turnrate /* rad/s */, acceleration /* m/sē */, topspeed /* m/s */; 00064 float positionTolerance; // destination position tolerance in meters (radius) 00065 float turnrange_near, turnrange_far, radarresolution; // distance when unit starts turnign if wall or other unit is detected ahead 00066 00067 //needed information, don't use same names with Unit to avoid conficts (may be unnecessary?) 00068 Renderer *mRenderer; 00069 Ground *mGround; 00070 Game *mGame; 00071 }; 00072 00073 00074 #endif