Changeset 10271 in orxonox.OLD for branches/playability/src/world_entities
- Timestamp:
- Jan 17, 2007, 6:15:21 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/projectiles/spike.cc
r10260 r10271 132 132 void Spike::tick (float dt) 133 133 { 134 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);135 134 Vector v = this->velocity * dt; 136 135 this->shiftCoor(v); … … 140 139 141 140 angle += rotationSpeed * dt; 142 143 /* printf( "spike tick\n" );*/144 141 } 145 142 … … 160 157 { 161 158 glPushAttrib(GL_ENABLE_BIT); 162 //glDisable(GL_LIGHTING);163 164 159 glMatrixMode(GL_MODELVIEW); 165 160 glPushMatrix(); … … 170 165 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z ); 171 166 glRotatef(angle, 1.0, 0.0, 0.0); 167 172 168 this->getAbsDir().matrix (matrix); 173 169 glMultMatrixf((float*)matrix); 174 170 this->getModel()->draw(); 175 171 176 // this->halo->draw();177 178 172 glPopMatrix(); 179 180 173 glPopAttrib(); 181 174 } -
branches/playability/src/world_entities/projectiles/spike_ball.cc
r10261 r10271 179 179 { 180 180 Spike* pj = NULL; 181 /* printf( "KA-" );*/ 181 182 updateFireDir(); 183 182 184 for ( int i = 0; i < this->getFragments(); i++) 183 185 { 184 186 pj = new Spike(); 185 187 assert( pj ); 186 /* printf(" %i", i);*/187 188 pj->setParent(PNode::getNullParent()); 188 189 189 pj->setVelocity(this->launcher[i].getNormalized() * 250.0);190 dynamic_cast<Spike*>(pj)->setVelocity(this->launcher[i].getNormalized() * 250.0); 190 191 191 192 pj->setParent(PNode::getNullParent()); 192 193 pj->setAbsCoor(this->getAbsCoor() + this->launcher[i] * this->size); 193 Quaternion q; 194 pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1))); 194 // Quaternion q; 195 // pj->setAbsDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1))); 196 pj->setRelDir(Quaternion(0, this->launcher[i])); 195 197 196 198 pj->toList(this->getOMListNumber()); 197 199 198 /*199 pj->setAbsCoor(this->getAbsCoor() + VECTOR_RAND(3));200 pj->setAbsDir(this->getAbsDir());*/201 200 pj->activate(); 202 201 } 203 /* printf( "BOOM\n" );*/204 202 } 205 203 … … 219 217 ca = cos (this->getAngle()); 220 218 sa = sin (this->getAngle()); 221 // final version below... easier to to cheat with the one above.222 219 223 220 m[0][0] = nx * nx * (1 - ca) + ca; … … 233 230 float x, y, z; 234 231 for (int i = 0; i < this->getFragments(); i++){ 235 // printf("%i ", i);236 232 x = m[0][0] * this->launcher[i].x + m[0][1] * this->launcher[i].y + m[0][2] * this->launcher[i].z; 237 233 y = m[1][0] * this->launcher[i].x + m[1][1] * this->launcher[i].y + m[1][2] * this->launcher[i].z; … … 240 236 this->launcher[i] = Vector (x, y, z); 241 237 } 242 // printf("\n");243 238 244 239 for( int i = 0; i < 3 ; i++) … … 254 249 void SpikeBall::tick (float dt) 255 250 { 256 //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1); 257 Vector v = this->getVelocity() * dt; 251 Vector v = this->velocity * dt; 258 252 this->shiftCoor(v); 259 253 260 // if(this->lifeCycle > .9){261 // /* printf("time to blow: ");*/262 // // this->weaponMan->fire();263 // /* this->blow();*/264 // }265 254 266 255 if (this->tickLifeCycle(dt)){ … … 270 259 271 260 this->updateAngle( dt ); 272 // angle += rotationSpeed * dt;273 261 } 274 262 … … 289 277 { 290 278 glPushAttrib(GL_ENABLE_BIT); 291 //glDisable(GL_LIGHTING);292 293 279 glMatrixMode(GL_MODELVIEW); 294 280 glPushMatrix(); … … 296 282 float matrix[4][4]; 297 283 glTranslatef (this->getAbsCoor ().x, this->getAbsCoor ().y, this->getAbsCoor ().z); 284 285 this->halo->draw(); 298 286 299 287 glRotatef(angle, this->getRotationAxis().x, this->getRotationAxis().y, this->getRotationAxis().z); … … 302 290 this->getModel()->draw(); 303 291 304 this->halo->draw();305 306 292 glPopMatrix(); 307 308 293 glPopAttrib(); 309 294 } -
branches/playability/src/world_entities/projectiles/spike_ball.h
r10260 r10271 41 41 virtual void draw () const; 42 42 43 //inline void setVelocity(Vector velocity) { this->velocity = velocity; }43 inline void setVelocity(Vector velocity) { this->velocity = velocity; } 44 44 45 45 // inline Vector getRotationVector() { return this->rotationVector; } … … 53 53 ParticleEmitter* emitter; 54 54 55 // float speed; 56 57 // float angle; 58 // float rotationSpeed; 59 // Vector rotationVector; 55 Vector velocity; 60 56 61 57 Billboard* halo; … … 63 59 WorldEntity* hitEntity; // FIXME TEMPORARY 64 60 65 // WeaponManager* weaponMan;66 67 61 void updateFireDir(); 68 62 virtual void blow(); 69 63 70 // int spikes;71 64 Vector* launcher; 72 65 float size; -
branches/playability/src/world_entities/projectiles/swarm_projectile.cc
r10261 r10271 219 219 220 220 221 /** old guiding funct uion*/221 /** old guiding function*/ 222 222 223 223 float projectileVelocity = this->getVelocity().len(); … … 229 229 if (likely(projectileVelocity != 0 || projectileVelocity != this->maxVelocity) ) 230 230 this->velocity *= (this->maxVelocity / projectileVelocity); // set speed to max 231 232 //printf("position: %f, %f, %f\n", this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z);233 // printf("target position: %f, %f, %f\n", this->target->getAbsCoor().x, this->target->getAbsCoor().y, this->target->getAbsCoor().z); 231 /* 232 printf("position: %f, %f, %f\n", this->getAbsCoor().x, this->getAbsCoor().y, this->getAbsCoor().z); 233 printf("target position: %f, %f, %f\n", this->target->getAbsCoor().x, this->target->getAbsCoor().y, this->target->getAbsCoor().z);*/ 234 234 235 235 this->shiftCoor(this->velocity * time); 236 236 237 238 237 /* 238 239 239 Vector pjV = this->getVelocity(); 240 240 Vector tV = this->target->getVelocity(); … … 244 244 245 245 float A = 2 * pT.len() * pT.len(); 246 float B = 2 * a.len() * tV.len();246 float B = 2 * a.len() * a.len(); 247 247 float D = 2 * sqrt(B * B - 4 * pT.len() * pT.len() *(tV.len() * tV.len() - pjV.len() * pjV.len())); 248 248 float tti; -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10270 r10271 201 201 202 202 this->weaponMan.changeWeaponConfig(3); 203 this->secWeaponMan.changeWeaponConfig( 0);203 this->secWeaponMan.changeWeaponConfig(1); 204 204 205 205 curWeaponPrimary = 3; -
branches/playability/src/world_entities/weapons/heavy_blaster.cc
r10261 r10271 41 41 } 42 42 delete [] this->emissionPoint; 43 44 delete [] this->shootAnim; 45 delete [] this->objComp; 43 delete [] this->shootAnim; 44 delete [] this->objComp; 46 45 /* 47 46 for(int j = 0; j < this->getSegs(); j++) -
branches/playability/src/world_entities/weapons/spike_launcher.cc
r10224 r10271 239 239 void SpikeLauncher::fire() 240 240 { 241 // temporary solution to test the module242 241 updateFireDir(VECTOR_RAND(1), 20); 243 242 244 printf("firing spikes\n");245 243 Projectile* pj = NULL; 246 244 for (int i = 0; i < this->spikes; i++) … … 250 248 return; 251 249 252 // pj->setVelocity(this->getVelocity()+(this->getAbsDir().apply(Vector(1,0,0))*115.0 + VECTOR_RAND(10)));253 250 pj->setVelocity(this->launcher[i].getNormalized() * 300.0); 254 251 … … 257 254 Quaternion q; 258 255 pj->setRelDir(q.lookAt(Vector(), this->launcher[i], VECTOR_RAND(1))); 259 // pj->setRelDir(90, this->launcher[i].x, this->launcher[i].y, this->launcher[i].z); 260 261 /* pj->toList(this->getOMListNumber());*/ 256 262 257 pj->activate(); 263 258 } -
branches/playability/src/world_entities/weapons/spike_thrower.cc
r10260 r10271 82 82 animation1->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 83 83 animation2->addKeyFrame(Vector(0, 0, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 84 animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); */85 /* 84 animation2->addKeyFrame(Vector(0, -.5, 0), Quaternion(), 0.3, ANIM_LINEAR, ANIM_CONSTANT); 85 86 86 animation1->setInfinity(ANIM_INF_CONSTANT); 87 87 animation2->setInfinity(ANIM_INF_CONSTANT);*/ … … 104 104 this->getProjectileFactory()->prepare(50); 105 105 106 //this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav");107 //this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav");108 //this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav");106 this->setActionSound(WA_SHOOT, "sound/explosions/explosion_1.wav"); 107 this->setActionSound(WA_ACTIVATE, "sound/vocals/missiles.wav"); 108 this->setActionSound(WA_RELOAD, "sound/vocals/reload.wav"); 109 109 110 110 } … … 156 156 pj->setParent(PNode::getNullParent()); 157 157 158 // pj->setVelocity(this->getParent()->getAbsDir().apply(Vector(1,0,0))*200 + this->getParent()->getParent()->getVelocity()); 159 pj->setVelocity(this->getParent()->getVelocity() + this->getAbsDir().apply(Vector(1,0,0))*160); 158 dynamic_cast<SpikeBall*>(pj)->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*110); 160 159 161 160 pj->setAbsCoor(this->getEmissionPoint());
Note: See TracChangeset
for help on using the changeset viewer.