Changeset 9869 in orxonox.OLD for trunk/src/world_entities/spectator.cc
- Timestamp:
- Oct 3, 2006, 12:19:30 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/world_entities/spectator.cc
r9406 r9869 22 22 #include "shared_network_data.h" 23 23 24 CREATE_FACTORY(Spectator, CL_SPECTATOR); 25 26 27 24 #include "class_id_DEPRECATED.h" 25 ObjectListDefinitionID(Spectator, CL_SPECTATOR); 26 CREATE_FACTORY(Spectator); 28 27 29 28 … … 58 57 { 59 58 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 60 this-> setClassID(CL_SPECTATOR, "Spectator");59 this->registerObject(this, Spectator::_objectList); 61 60 62 61 this->getWeaponManager().changeWeaponConfig(1); … … 89 88 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 90 89 91 90 92 91 registerVar( new SynchronizeableBool( &bLeft, &bLeft, "bLeft", PERMISSION_OWNER ) ); 93 92 registerVar( new SynchronizeableBool( &bRight, &bRight, "bRight", PERMISSION_OWNER ) ); … … 161 160 { 162 161 Playable::tick( time ); 163 162 164 163 if( ( xMouse != 0 || yMouse != 0 ) && this->getOwner() == SharedNetworkData::getInstance()->getHostID() ) 165 164 { 166 165 xMouse *= time / 10; 167 166 yMouse *= time / 10; 168 167 169 168 angleX -= xMouse; 170 169 angleY -= yMouse; 171 170 172 171 if ( angleY > 2.05 ) 173 172 angleY = 2.05; 174 173 175 174 if ( angleY < -1.15 ) 176 175 angleY = -1.15; 177 176 178 177 this->mouseDir = Quaternion( angleX, Vector( 0, 1, 0 ) ) * Quaternion( angleY, Vector( 0, 0, 1 ) ); 179 178 180 179 xMouse = yMouse = 0; 181 180 } 182 181 183 182 this->setAbsDir( this->mouseDir ); 184 183 185 184 Vector velocity; 186 185 187 186 if ( this->bForward ) 188 187 { 189 188 velocity += this->getAbsDirX(); 190 189 } 191 190 192 191 if ( this->bBackward ) 193 192 { 194 193 velocity -= this->getAbsDirX(); 195 194 } 196 195 197 196 if ( this->bRight ) 198 197 { 199 198 velocity += this->getAbsDirZ(); 200 199 } 201 200 202 201 if ( this->bLeft ) 203 202 { 204 203 velocity -= this->getAbsDirZ(); 205 204 } 206 205 207 206 velocity *= 100; 208 207 209 208 this->shiftCoor( velocity*time ); 210 209 }
Note: See TracChangeset
for help on using the changeset viewer.