Changeset 3238 in orxonox.OLD for orxonox/branches/nico/src/player.cc
- Timestamp:
- Dec 20, 2004, 2:42:54 AM (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/nico/src/player.cc
r2969 r3238 26 26 { 27 27 28 obj = new Object("reaplow.obj");28 this->obj = new Object("reaplow.obj"); 29 29 /* 30 30 objectList = glGenLists(1); … … 54 54 } 55 55 56 Player::~Player () 57 56 Player::~Player() 58 57 { 58 delete this->obj; 59 59 } 60 60 61 void Player::post _spawn()61 void Player::postSpawn() 62 62 { 63 travel _speed = 15.0;63 travelSpeed = 15.0; 64 64 velocity = Vector(); 65 65 bUp = bDown = bLeft = bRight = bAscend = bDescend = false; 66 66 bFire = false; 67 67 acceleration = 10.0; 68 set _collision (new CollisionCluster(1.0, Vector(0,0,0)));68 setCollision(new CollisionCluster(1.0, Vector(0,0,0))); 69 69 } 70 70 71 void Player::tick 71 void Player::tick(float time) 72 72 { 73 74 73 // movement 74 move (time); 75 75 } 76 76 77 void Player::hit 77 void Player::hit(WorldEntity* weapon, Vector loc) 78 78 { 79 79 } 80 80 81 void Player::destroy 81 void Player::destroy() 82 82 { 83 83 } 84 84 85 void Player::collide (WorldEntity* other,Uint32 ownhitflags, Uint32 otherhitflags)85 void Player::collide(WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags) 86 86 { 87 87 } 88 88 89 void Player::command 89 void Player::command(Command* cmd) 90 90 { 91 91 //printf("Player|recieved command [%s]\n", cmd->cmd); … … 97 97 } 98 98 99 void Player::draw 99 void Player::draw() 100 100 { 101 101 glMatrixMode(GL_MODELVIEW); … … 103 103 float matrix[4][4]; 104 104 105 glTranslatef(get _placement()->r.x,get_placement()->r.y,get_placement()->r.z);106 get _placement()->w.matrix (matrix);107 glMultMatrixf 105 glTranslatef(getPlacement()->r.x, getPlacement()->r.y, getPlacement()->r.z); 106 getPlacement()->w.matrix (matrix); 107 glMultMatrixf((float*)matrix); 108 108 109 glMatrixMode 110 glRotatef 109 glMatrixMode(GL_MODELVIEW); 110 glRotatef(-90, 0,1,0); 111 111 obj->draw(); 112 // glCallList(objectList);112 // glCallList(objectList); 113 113 114 114 115 115 116 //printf("Player@%f/%f/%f\n", get_placement()->r.x, get_placement()->r.y, get_placement()->r.z);117 116 } 118 117 119 void Player::get _lookat(Location* locbuf)118 void Player::getLookat(Location* locbuf) 120 119 { 121 *locbuf = *get_location();122 120 *locbuf = *getLocation(); 121 //locbuf->dist += 5.0; 123 122 } 124 123 125 void Player::left _world()124 void Player::leftWorld() 126 125 { 127 126 } 128 127 129 void Player::move 128 void Player::move(float time) 130 129 { 131 130 Vector accel(0.0, 0.0, 0.0); 132 /* FIXME: calculating the direction and orthDirection every time _slice is redundant! save it somewhere */133 Placement *pos = get _placement();131 /* FIXME: calculating the direction and orthDirection every timeSlice is redundant! save it somewhere */ 132 Placement *pos = getPlacement(); 134 133 /* calculate the direction in which the craft is heading */ 135 134 Vector direction(0.0, 0.0, 1.0); … … 143 142 if( bRight ) { accel = accel - (orthDirection*acceleration); } 144 143 if( bAscend ) { /* not yet implemented but just: (0,0,1)*acceleration */} 145 if( bDescend) {/* FIXME */} 144 if( bDescend) {/* FIXME */} /* \todo up and down player movement */ 146 145 147 Location* l = get _location();146 Location* l = getLocation(); 148 147 149 148 // r(t) = r(0) + v(0)*t + 1/2*a*t^2 … … 153 152 154 153 /* this the base-speed of the player: determines how fast and how the player follows the track*/ 155 l->dist = l->dist + travel _speed * time;154 l->dist = l->dist + travelSpeed * time; 156 155 157 156 /* this updates the player position on the track - user interaction */ 158 157 l->pos = l->pos + accel*time; 159 158 } 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
Note: See TracChangeset
for help on using the changeset viewer.