Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10117 in orxonox.OLD for branches/playability/src


Ignore:
Timestamp:
Dec 20, 2006, 12:31:27 AM (18 years ago)
Author:
marcscha
Message:

Last update, collision working again. SEGFAULT problems

Location:
branches/playability/src/world_entities
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/playability/src/world_entities/projectiles/lbolt.cc

    r10104 r10117  
    4747  this->setMinEnergy(1);
    4848  this->setHealthMax(0);
    49   this->lifeSpan = 5.0;
     49  this->lifeSpan = 2.0;
    5050
    5151  this->emitter = new DotEmitter(100, 5, M_2_PI);
  • branches/playability/src/world_entities/projectiles/mbolt.cc

    r10113 r10117  
    5353  this->setMinEnergy(4);
    5454  this->setHealthMax(0);
    55   this->lifeSpan = 5.0;
     55  this->lifeSpan = 3.0;
    5656  this->angle     = 0;
    5757
     
    137137  this->lifeCycle = 0.0;
    138138
    139   //this->toList(OM_NULL);
    140139  this->toList(OM_DEAD);
    141   //this->removeNode();
     140  this->removeNode();
    142141  MBolt::fastFactory->kill(this);
    143142}
     
    146145void MBolt::collidesWith(WorldEntity* entity, const Vector& location)
    147146{
    148   PRINTF(0)("MBolt collides pretest\n");
    149 
    150   if( entity == NULL)
     147
     148  if (this->hitEntity != entity)
     149    this->destroy( entity );
     150  this->hitEntity = entity;
     151  dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
     152  this->destroy(this);
     153 
     154  return;
     155
     156  if( entity == NULL || dynamic_cast<SpaceShip*>(entity) == NULL)
    151157    return;
    152158
    153   PRINTF(0)("MBolt collides\n");
    154159  dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
    155160  //entity->destroy(this);
     
    179184void MBolt::destroy (WorldEntity* killer)
    180185{
     186  //this->deactivate();
    181187  Projectile::destroy( killer );
    182188  PRINTF(5)("DESTROY MBolt\n");
     
    211217
    212218}
    213 
  • branches/playability/src/world_entities/projectiles/mbolt.h

    r10081 r10117  
    3535    virtual void draw () const;
    3636
    37 
    3837  private:
    3938    static FastFactory*               fastFactory;
  • branches/playability/src/world_entities/projectiles/swarm_projectile.cc

    r10109 r10117  
    136136    this->destroy( entity );
    137137  this->hitEntity = entity;
    138   dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
     138  //dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
    139139  this->destroy(this);
    140140}
  • branches/playability/src/world_entities/space_ships/space_ship.cc

    r10113 r10117  
    147147  Weapon* wpRight1 = new LightBlaster ();
    148148  wpRight1->setName( "LightBlaster");
    149   wpRight1->setParent( this);
     149  //wpRight1->setParent( this);
    150150  Weapon* wpLeft1 = new LightBlaster ();
    151151  wpLeft1->setName( "LightBlaster");
    152   wpLeft1->setParent( this);
     152  //wpLeft1->setParent( this);
    153153
    154154  Weapon* wpRight2 = new MediumBlaster ();
    155155  wpRight2->setName( "MediumBlaster");
    156   wpRight2->setParent( this);
     156  //wpRight2->setParent( this);
    157157  Weapon* wpLeft2 = new MediumBlaster ();
    158158  wpLeft2->setName( "MediumBlaster");
    159   wpLeft2->setParent( this);
     159  //wpLeft2->setParent( this);
    160160 
    161161  Weapon* wpRight3 = new HeavyBlaster ();
    162162  wpRight3->setName( "HeavyBlaster");
    163   wpRight3->setParent( this);
     163  //wpRight3->setParent( this);
    164164  Weapon* wpLeft3 = new HeavyBlaster ();
    165165  wpLeft3->setName( "HeavyBlaster");
    166   wpLeft3->setParent( this);
     166  //wpLeft3->setParent( this);
    167167
    168168  Weapon* cannon = new SwarmLauncher();
    169169  cannon->setName( "SwarmLauncher");
    170   cannon->setParent( this);
     170  //cannon->setParent( this);
    171171
    172172
     
    180180  this->secWeaponMan.addWeapon( cannon, 0, 0);
    181181
    182 
     182/*
    183183  wpRight1->requestAction(WA_ACTIVATE);
    184184  wpLeft1->requestAction(WA_ACTIVATE);
     
    190190
    191191  cannon->requestAction(WA_ACTIVATE);
    192 
     192*/
    193193 
    194194  this->weaponMan.changeWeaponConfig(1);
     
    418418void SpaceShip::collidesWith(WorldEntity* entity, const Vector& location)
    419419{
    420   PRINTF(0)("SPACESHIP COLLIDED WITH %s\n",entity->getCName());
    421420}
    422421
     
    669668
    670669void SpaceShip::damage(float pDamage, float eDamage){
    671   PRINTF(0)("ship hit for (%f,%f) \n",pDamage,eDamage);
     670  PRINTF(5)("ship hit for (%f,%f) \n",pDamage,eDamage);
    672671
    673672  if( this->shieldActive) {
     
    968967void SpaceShip::nextWeaponConfig()
    969968{
    970  
    971   this->curWeaponPrimary    = (curWeaponPrimary + 1) % 3;
    972   this->weaponMan.changeWeaponConfig(this->curWeaponPrimary);
     969  PRINTF(0)("Requested next weapon config!\n");
     970  this->weaponMan.nextWeaponConfig();
    973971  Playable::weaponConfigChanged();
    974972}
     
    979977void SpaceShip::previousWeaponConfig()
    980978{
    981   this->curWeaponPrimary    = (curWeaponPrimary + 1) % 3;
     979  this->curWeaponPrimary    = (this->curWeaponPrimary + 1) % 3;
    982980  this->weaponMan.changeWeaponConfig(this->curWeaponPrimary);
    983981  Playable::weaponConfigChanged();
    984982}
     983
     984void SpaceShip::hit(float damage, WorldEntity* killer)
     985{
     986  this->damage(killer->getDamage(),0);
     987  killer->collidesWith( this, this->getAbsCoor());
     988  //this->collidesWith(killer, this->getAbsCoor());
     989}
  • branches/playability/src/world_entities/space_ships/space_ship.h

    r10113 r10117  
    8282    void previousWeaponConfig();
    8383
    84     inline void hit(float damage, WorldEntity* killer) { this->collidesWith(killer, this->getAbsCoor()); killer->collidesWith(this, this->getAbsCoor()); } ;
     84    virtual void hit(float damage, WorldEntity* killer);
    8585
    8686  private:
  • branches/playability/src/world_entities/weapons/medium_blaster.cc

    r10109 r10117  
    1111#include "loading/fast_factory.h"
    1212
     13//#include "class_id_DEPRECATED.h"
     14//ObjectListDefinition(MediumBlaster);
    1315CREATE_FACTORY(MediumBlaster);
    1416/**
     
    6769  this->setCapability(WTYPE_ALLDIRS | WTYPE_DIRECTIONAL | WTYPE_LIGHT);
    6870  this->setProjectileTypeC("MBolt");   // FIXME temp project type until the blaste class exist
    69   this->prepareProjectiles(20);
     71  this->prepareProjectiles(100);
    7072
    7173  Animation3D* animation2 = this->getAnimation(WS_ACTIVATING, this);
     
    100102  pj->setAbsCoor(this->getEmissionPoint());
    101103  pj->setAbsDir(this->getAbsDir());
    102   pj->toList(OM_GROUP_01_PROJ);
    103104  pj->activate();
    104105}
Note: See TracChangeset for help on using the changeset viewer.