Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9235 in orxonox.OLD for trunk/src/world_entities


Ignore:
Timestamp:
Jul 5, 2006, 4:39:02 PM (18 years ago)
Author:
bensch
Message:

merged the presentation back

Location:
trunk/src/world_entities
Files:
46 edited
16 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/WorldEntities.am

    r9061 r9235  
    44                world_entities/npcs/npc_test.cc \
    55                world_entities/npcs/ground_turret.cc \
     6                world_entities/npcs/space_turret.cc \
    67                world_entities/npcs/generic_npc.cc \
    78                world_entities/npcs/door.cc \
     9                world_entities/npcs/gate.cc \
    810                world_entities/npcs/repair_station.cc \
     11                world_entities/npcs/attractor_mine.cc \
    912                \
    1013                world_entities/environment.cc \
     
    2225                \
    2326                world_entities/weapons/test_gun.cc \
     27                world_entities/weapons/laser_cannon.cc \
    2428                world_entities/weapons/turret.cc \
    2529                world_entities/weapons/aiming_turret.cc \
     
    2832                world_entities/weapons/hyperblaster.cc \
    2933                world_entities/weapons/aim.cc \
     34                world_entities/weapons/aiming_system.cc \
    3035                world_entities/weapons/fps_sniper_rifle.cc \
     36                world_entities/weapons/boomerang_gun.cc \
    3137                \
    3238                world_entities/projectiles/bomb.cc \
    3339                world_entities/projectiles/laser.cc \
     40                world_entities/projectiles/rail_projectile.cc \
    3441                world_entities/projectiles/test_bullet.cc \
    3542                world_entities/projectiles/rocket.cc \
    3643                world_entities/projectiles/guided_missile.cc \
     44                world_entities/projectiles/boomerang_projectile.cc \
    3745                world_entities/projectiles/hyperblast.cc \
    3846                \
     
    7078                npcs/npc_test1.h \
    7179                npcs/ground_turret.h \
     80                npcs/space_turret.h \
    7281                npcs/door.cc \
    73                 npcs/repair_station.cc \
     82                npcs/repair_station.h \
     83                npcs/attractor_mine.h \
    7484                \
    7585                environment.h \
     
    8797                \
    8898                weapons/test_gun.h \
     99                weapons/laser_cannon.cc \
    89100                weapons/cannon.h \
    90101                weapons/hyperblaster.h \
     
    92103                weapons/aiming_turret.h \
    93104                weapons/targeting_turret.h \
     105                weapons/boomerang_gun.h \
    94106                weapons/aim.h \
     107                weapons/aiming_system.h \
    95108                weapons/fps_sniper_rifle.h \
    96109                \
    97110                projectiles/bomb.h \
    98111                projectiles/laser.h \
     112                projectiles/rail_projectile.h \
    99113                projectiles/test_bullet.h \
    100114                projectiles/rocket.h \
    101115                projectiles/guided_missile.h \
     116                projectiles/boomerang_projectile.h \
    102117                projectiles/hyperblast.h \
    103118                \
  • trunk/src/world_entities/camera.cc

    r7868 r9235  
    3636  this->setFovy(90);
    3737  this->setAspectRatio(1.2f);
    38   this->setClipRegion(.1, 2000);
     38  this->setClipRegion(.1, 10000);
    3939
    4040  this->setViewMode(Camera::ViewNormal);
  • trunk/src/world_entities/creatures/fps_player.cc

    r9110 r9235  
    2929#include "weapons/cannon.h"
    3030#include "weapons/fps_sniper_rifle.h"
     31#include "weapons/aiming_system.h"
    3132
    3233#include "aabb.h"
     34
    3335
    3436#include "key_mapper.h"
     
    5759{
    5860  this->setPlayer(NULL);
     61
     62  if( this->aimingSystem)
     63    delete this->aimingSystem;
    5964}
    6065
     
    8186{
    8287  this->setClassID(CL_FPS_PLAYER, "FPSPlayer");
    83 
    8488
    8589  this->bLeft = false;
     
    8993  this->bJump = false;
    9094  this->bPosBut = false;
     95  this->bFire = false;
    9196
    9297  this->xMouse = 0.0f;
     
    125130
    126131//   this->addWeapon(wpLeft, 1, 0);
    127   this->addWeapon(wpRight,1, 0);
     132  if( State::isOnline())
     133    this->addWeapon(wpRight,1, 0);
    128134  this->getWeaponManager().changeWeaponConfig(1);
    129135
    130136  this->getWeaponManager().setSlotCount(2);
    131 //   this->getWeaponManager().setSlotDirection(0, Quaternion(M_PI_2, Vector(0,1,0)));
     137  this->getWeaponManager().setSlotDirection(0, Quaternion(M_PI_4*-0.55f, Vector(0,0,1)));
    132138  this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    133139  this->getWeaponManager().setSlotDirection(1, Quaternion(M_PI_4*.5, Vector(1,0,0)));
     
    135141  this->getWeaponManager().setSlotPosition(1, Vector(5.0, 0.0, 0.0));
    136142
     143//   this->getWeaponManager().getFixedTarget()->setRelDir(Quaternion(M_PI_4*-0.6f, Vector(0,0,1)));
     144
    137145
    138146  this->getWeaponManager().setParentNode(&this->cameraNode);
     
    141149  this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
    142150  this->getWeaponManager().getFixedTarget()->setRelCoor(1000,0,0);
     151
     152  this->aimingSystem = new AimingSystem(this);
     153  //this->addChild(this->aimingSystem);
     154  wpRight->addChild(this->aimingSystem);
     155//   this->getWeaponManager().sl
    143156
    144157
     
    148161  registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) );
    149162  registerVar( new SynchronizeableBool( &bBackward, &bBackward, "bBackward", PERMISSION_OWNER ) );
     163  registerVar( new SynchronizeableBool( &bJump, &bJump, "bJump", PERMISSION_OWNER ) );
    150164  registerVar( new SynchronizeableFloat( &heading, &heading, "heading", PERMISSION_OWNER ) );
    151165  registerVar( new SynchronizeableFloat( &attitude, &attitude, "attitude", PERMISSION_OWNER ) );
     166
     167    //subscribe to collision reaction
     168  this->subscribeReaction(CREngine::CR_PHYSICS_FULL_WALK, CL_BSP_ENTITY);
     169
     170  this->initWeapon = false;
     171  this->damageTicker = 0.0f;
     172
     173  if( State::isOnline())
     174    toList( OM_PLAYERS );
    152175}
    153176
     
    192215  this->getWeaponManager().getFixedTarget()->setRelCoor(0,0,0);
    193216
    194 
    195   AABB* box = this->getModelAABB();
    196   if( box != NULL)
    197   {
    198     State::getCameraNode()->setRelCoor(0, box->halfLength[1] * 2.0f, 0);
    199     State::getCameraTargetNode()->setRelCoor(10, box->halfLength[1] * 2.0f, 0);
    200 
    201     this->getWeaponManager().setSlotPosition(0, Vector(1.5, box->halfLength[1] * 2.0f - 0.7, 1.1));
    202     this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * 2.0f, 0.0));
     217  if ( !State::isOnline() )
     218  {
     219    this->respawn();
    203220  }
    204221}
     
    219236{
    220237
    221   if( this->bPosBut)
    222   {
    223     this->bPosBut = false;
    224     printf("mechanic2:walkTo( %f, mtheight, %f)\n",this->getAbsCoorX(),this->getAbsCoorZ());
    225   }
    226 
    227   Playable::tick( time );
     238  if ( !this->initWeapon )
     239  {
     240    this->initWeapon = true;
     241
     242    this->cameraNode.setParentMode(PNODE_ROTATE_AND_MOVE);
     243
     244    this->getWeaponManager().getParentNode()->setParentMode(PNODE_ROTATE_AND_MOVE);
     245    this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode);
     246    this->getWeaponManager().getFixedTarget()->setParentMode(PNODE_ROTATE_AND_MOVE);
     247
     248
     249    this->aimingSystem->toList(OM_GROUP_01);
     250    this->aimingSystem->setParent(&this->cameraNode);
     251//     this->aimingSystem->setParentMode(PNODE_ROTATE_AND_MOVE);
     252    this->aimingSystem->setRelDir(Quaternion(M_PI_4*-0.58f, Vector(0,0,1)));
     253    this->aimingSystem->setRelCoor(0, -1, -1);
     254
     255
     256    AABB* box = this->getModelAABB();
     257    if( box != NULL)
     258    {
     259      float f = 1.0;
     260      this->cameraNode.setRelCoor(0, box->halfLength[1] * f, 0);
     261//       this->cameraNode.setRelCoor(10, box->halfLength[1] * f, 0);
     262
     263      float v = 0.1f;
     264      this->getWeaponManager().setSlotPosition(0, Vector(-8.0, box->halfLength[1] * v, 1.1));
     265      this->getWeaponManager().setSlotPosition(1, Vector(5.0, box->halfLength[1] * v, 0.0));
     266    }
     267  }
     268
     269
     270  this->getWeaponManager().tick(time);
     271  if( this->bFire)
     272  {
     273    this->getWeaponManager().fire();
     274
     275//     WorldEntity* target = this->aimingSystem->getNearestTarget();
     276//     if( target != NULL)
     277//     {
     278//       PRINTF(0)("hit hit hit, got: %s\n", target->getClassName());
     279//     }
     280//     else
     281//     {
     282//       PRINTF(0)("nothing hit\n");
     283//     }
     284  }
     285
     286
     287  //dealing damage
     288
     289  if ( State::isOnline() && SharedNetworkData::getInstance()->isGameServer() )
     290  {
     291    this->damageTicker -= time;
     292
     293    if ( this->damageTicker <= 0.0f && this->beFire() )
     294    {
     295      this->damageTicker = 0.25;
     296
     297      WorldEntity * victim = aimingSystem->getNearestTarget();
     298
     299      if ( victim )
     300      {
     301        PRINTF(0)("FIRE: hit %s\n", victim->getClassName());
     302        victim->hit( 20, this );
     303      }
     304      else
     305      {
     306        PRINTF(0)("FIRE: nothing hit\n");
     307      }
     308    }
     309  }
     310
    228311
    229312  if( ( xMouse != 0 || yMouse != 0 ) && (this->getOwner() == SharedNetworkData::getInstance()->getHostID() || !State::isOnline() ) )
     
    235318    attitude-= yMouse;
    236319
    237     if ( attitude > 2.05 )
    238       attitude = 2.05;
    239 
    240     else if ( attitude < -1.15 )
    241       attitude = -1.15;
     320
     321    if ( attitude > 1.95 )
     322      attitude = 1.95;
     323    else if ( attitude < -1.07 )
     324      attitude = -1.07;
    242325
    243326    xMouse = yMouse = 0;
     
    304387    this->fallVelocity += 300.0f * time;
    305388    velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity;
     389
     390//     PRINTF(0)("vel %f\n", this->fallVelocity);
    306391  }
    307392  else
     
    309394    this->fallVelocity = 0.0f;
    310395  }
    311 
    312396
    313397  this->shiftCoor( velocity*time );
     
    346430  }
    347431
     432  this->setOnGround(false);
     433  this->aimingSystem->flushList();
    348434}
    349435
     
    383469  }
    384470  else if( event.type == KeyMapper::PEV_JUMP)
     471  {
    385472    this->bJump = event.bPressed;
    386     this->bPosBut = event.bPressed;
    387 }
    388 
    389 
    390 
    391 
     473  }
     474  else if( event.type == KeyMapper::PEV_FIRE1)
     475  {
     476    this->bFire = event.bPressed;
     477  }
     478}
     479
     480
     481void FPSPlayer::respawn( )
     482{
     483  if( State::isOnline())
     484    toList( OM_PLAYERS );
     485
     486  this->damageTicker = 0.0f;
     487
     488  Playable::respawn();
     489}
     490
     491
     492void FPSPlayer::destroy( WorldEntity* killer )
     493{
     494  Playable::destroy( killer );
     495
     496  toList( OM_DEAD );
     497}
     498
  • trunk/src/world_entities/creatures/fps_player.h

    r9110 r9235  
    99
    1010#include "playable.h"
     11
     12
     13class AimingSystem;
    1114
    1215
     
    2730    virtual void reset();
    2831
     32    virtual void destroy(WorldEntity* killer);
     33    virtual void respawn();
    2934
    3035    virtual void tick(float time);
     
    4348    bool                  bJump;              //!< jumping
    4449    bool                  bPosBut;             //!< position button
     50    bool                  bFire;              //!< fire button
    4551
    4652    float                 xMouse;             //!< mouse moved in x-Direction
     
    5561    float                 fallVelocity;        //!< velocity for falling down
    5662    float                 jumpForce;           //!< the jump force
     63
     64    bool                  initWeapon;
     65
     66    AimingSystem*         aimingSystem;        //!< aiming system of the player
     67
     68    float                 damageTicker;        //!< ticker for dealing damage
    5769};
    5870
  • trunk/src/world_entities/effects/explosion.cc

    r7120 r9235  
    4040  this->toList(OM_DEAD_TICK);
    4141
    42   this->emitter = new BoxEmitter(Vector(10,10,10), 500, 45, M_2_PI);
     42  this->emitter = new BoxEmitter(Vector(10,10,10), 200, 45, M_2_PI);
    4343  this->emitter->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
    4444  this->emitter->setParent(this);
     
    8383    Explosion::explosionParticles->setLifeSpan(1.5, .3);
    8484    Explosion::explosionParticles->setRadius(0.0, 10);
    85     Explosion::explosionParticles->setRadius(.5, 15.0);
     85    Explosion::explosionParticles->setRadius(.5, 30.0);
    8686    Explosion::explosionParticles->setRadius(1.0, 10.0);
    8787    Explosion::explosionParticles->setColor(0.0, 1,0,0,1);
     
    113113void Explosion::tick (float dt)
    114114{
    115   printf("%f %f\n", this->lifeCycle, this->lifeTime);
    116115  this->lifeCycle += dt;
    117116  if(this->lifeTime < this->lifeCycle)
  • trunk/src/world_entities/environments/mapped_water.cc

    r9110 r9235  
    337337{
    338338  // it's not too nice, but it works fine
    339   PRINTF(0)("\nMappedWater XML Code:\n<MappedWater>\n  <waterpos>%f, %f, %f</waterpos>\n  <watersize>%f, %f</watersize>\n  <wateruv>%f</wateruv>\n  <waterflow>%f</waterflow>\n  <lightpos>%f, %f, %f</lightpos>\n  <waterangle>%f</waterangle>\n  <normalmapscale>%f</normalmapscale>\n  <shinesize>%f</waterpos>\n  <shinestrength>%f</shinestrength>\n  <reflstrength>%f</reflstrength>\n  <refraction>%f</refraction>\n  <watercolor>%f, %f, %f</watercolor>\n</MappedWater>\n", this->waterVerts[0], this->waterHeight, this->waterVerts[1], this->xWidth, this->zWidth, this->waterUV, this->waterFlow, this->lightPos.x, this->lightPos.y, this->lightPos.z, this->waterAngle, this->kNormalMapScale, this->shineSize, this->shineStrength, this->reflStrength, this->refraction, this->waterColor.x, this->waterColor.y, this->waterColor.z);
     339  PRINT(0)("\nMappedWater XML Code:\n<MappedWater>\n");
     340
     341  PRINT(0)("  <waterpos>%f, %f, %f</waterpos>\n", this->waterVerts[0], this->waterHeight, this->waterVerts[1]);
     342  PRINT(0)("  <watersize>%f, %f</watersize>\n", this->xWidth, this->zWidth);
     343  PRINT(0)("  <wateruv>%f</wateruv>\n", this->waterUV);
     344  PRINT(0)("  <waterflow>%f</waterflow>\n", this->waterFlow);
     345  PRINT(0)("  <lightpos>%f, %f, %f</lightpos>\n", this->lightPos.x, this->lightPos.y, this->lightPos.z);
     346  PRINT(0)("  <waterangle>%f</waterangle>\n", this->waterAngle);
     347  PRINT(0)("  <normalmapscale>%f</normalmapscale>\n", this->kNormalMapScale);
     348  PRINT(0)("  <shinesize>%f</shinesize>\n", this->shineSize);
     349  PRINT(0)("  <shinestrength>%f</shinestrength>\n", this->shineStrength);
     350  PRINT(0)("  <reflstrength>%f</reflstrength>\n", this->reflStrength);
     351  PRINT(0)("  <refraction>%f</refraction>\n", this->refraction);
     352  PRINT(0)("  <watercolor>%f, %f, %f</watercolor>\n", this->waterColor.x, this->waterColor.y, this->waterColor.z);
     353
     354  PRINT(0)("</MappedWater>\n");
    340355}
    341356
     
    475490
    476491        OrxGui::GLGuiSlider* lightPosX = new OrxGui::GLGuiSlider();
    477         lightPosX->setRange(-600, 600);
     492        lightPosX->setRange(-4000, 4000);
    478493        lightPosX->setValue(this->lightPos.x);
    479494        lightPosX->setStep(15);
     
    482497
    483498        OrxGui::GLGuiSlider* lightPosY = new OrxGui::GLGuiSlider();
    484         lightPosY->setRange(-600, 600);
     499        lightPosY->setRange(-4000, 4000);
    485500        lightPosY->setStep(15);
    486501        lightPosY->setValue(this->lightPos.y);
     
    489504
    490505        OrxGui::GLGuiSlider* lightPosZ = new OrxGui::GLGuiSlider();
    491         lightPosZ->setRange(-600, 600);
     506        lightPosZ->setRange(-4000, 4000);
    492507        lightPosZ->setStep(15);
    493508        lightPosZ->setValue(this->lightPos.z);
     
    504519
    505520        OrxGui::GLGuiSlider* waterHeight = new OrxGui::GLGuiSlider();
    506         waterHeight->setRange(-500, 500);
     521        waterHeight->setRange(100, 370);
    507522        waterHeight->setValue(this->waterHeight);
    508         waterHeight->setStep(10);
     523        waterHeight->setStep(4);
    509524        waterHeight->connect(SIGNAL(waterHeight, valueChanged), this, SLOT(MappedWater, setWaterHeight));
    510525        waterHeightBox->pack(waterHeight);
     
    547562  glDisable(GL_BLEND);
    548563
     564  // TODO change texture coords, so water doesnt look distorted when xWidth != zWidth
    549565  glBegin(GL_QUADS);
    550566  // The back left vertice for the water
  • trunk/src/world_entities/environments/model_entity.cc

    r7193 r9235  
    3232{
    3333  this->setClassID(CL_MODEL_ENTITY, "ModelEntity");
    34   this->toList(OM_ENVIRON_NOTICK);
     34  this->toList(OM_ENVIRON);
    3535
    3636  this->speed = NULL;
     
    7171void ModelEntity::setMomentum (float angle, float x, float y, float z)
    7272{
     73  Vector v(x,y,z);
     74  v.debug();
     75  v.normalize();
     76  v.debug();
     77
    7378  if (this->momentum == NULL)
    7479    this->momentum = new Quaternion;
    75   *this->momentum = Quaternion(angle, Vector(x, y, z));
     80  *this->momentum = Quaternion(angle, v);
     81
     82  this->momentum->debug();
    7683}
    7784
     
    8289
    8390  if (this->momentum != NULL)
    84     this->shiftDir(*this->momentum * dt);
     91  {
     92    this->shiftDir((*this->momentum * dt ).getNormalized());
     93    //this->getAbsDir().debug();
     94  }
    8595}
  • trunk/src/world_entities/npcs/generic_npc.cc

    r9110 r9235  
    8282{
    8383  this->setClassID(CL_GENERIC_NPC, "GenericNPC");
     84
    8485  this->toList(OM_GROUP_00);
    8586
     
    206207/**
    207208 * each animation has to be initialized here
     209 */
     210/**
     211 *
    208212 */
    209213void GenericNPC::initNPC()
     
    578582
    579583
    580 void GenericNPC::destroy()
     584void GenericNPC::destroy(WorldEntity* killer)
    581585{
    582586  int randi = (int)(5.0f * (float)rand()/(float)RAND_MAX);
  • trunk/src/world_entities/npcs/generic_npc.h

    r9061 r9235  
    7777
    7878
    79   void destroy();
     79  virtual void destroy(WorldEntity* killer);
    8080
    8181  private:
  • trunk/src/world_entities/npcs/ground_turret.cc

    r8777 r9235  
    176176}
    177177
    178 void GroundTurret::destroy()
     178void GroundTurret::destroy(WorldEntity* killer)
    179179{
    180180  this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90);
  • trunk/src/world_entities/npcs/ground_turret.h

    r7954 r9235  
    2525  virtual void leftWorld ();
    2626
    27   virtual void destroy();
     27  virtual void destroy(WorldEntity* killer);
    2828
    2929  virtual void draw() const;
  • trunk/src/world_entities/npcs/npc.cc

    r9003 r9235  
    1919
    2020#include "npc.h"
    21 
    22 
    23 using namespace std;
    2421
    2522
     
    5148void NPC::loadParams(const TiXmlElement* root)
    5249{
    53   if(root != NULL)
    5450   WorldEntity::loadParams(root);
    5551}
  • trunk/src/world_entities/npcs/npc_test.cc

    r8724 r9235  
    2323#include "shader.h"
    2424#include "state.h"
    25 #include "stdlibincl.h"
    2625#include "debug.h"
    2726
     27#include "loading/factory.h"
     28#include "loading/load_param.h"
    2829
    29 using namespace std;
     30#include "effects/explosion.h"
     31
     32CREATE_FACTORY(NPC2, CL_NPC_TEST2);
    3033
    3134
    32 NPC2::NPC2()
     35NPC2::NPC2(const TiXmlElement* root)
    3336  : NPC(NULL)
    3437{
     
    3639
    3740  if ((float)rand()/RAND_MAX > .5f)
    38     this->loadModel("models/ships/bolido.obj", 3);
     41    this->loadModel("models/ships/bolido.obj", 6);
    3942  else
    40     this->loadModel("models/ships/gobblin.obj", 3);
     43    this->loadModel("models/ships/gobblin.obj", 6);
     44
     45
     46
    4147
    4248  this->shader = NULL;
     
    4450    this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag");
    4551
    46   this->obj = gluNewQuadric();
     52  this->randomRotAxis = VECTOR_RAND(1);
    4753
    48   this->randomRotAxis = VECTOR_RAND(1);
     54  if (root != NULL)
     55    this->loadParams(root);
    4956}
    5057
     
    5461  if (this->shader)
    5562    Shader::unload(this->shader);
    56   gluDeleteQuadric(this->obj);
     63}
     64
     65
     66void NPC2::loadParams(const TiXmlElement* root)
     67{
     68  NPC::loadParams(root);
     69
     70}
     71
     72
     73void NPC2::destroy(WorldEntity* killer)
     74{
     75  Explosion::explode(this, Vector(10,10,10));
     76  this->toList(OM_DEAD);
     77
    5778}
    5879
     
    6788void NPC2::draw() const
    6889{
    69 //   glMatrixMode(GL_MODELVIEW);
    70 //   glPushMatrix();
    71 //   float matrix[4][4];
    72 //
    73 //   /* translate */
    74 //   glTranslatef (this->getAbsCoor ().x,
    75 //                 this->getAbsCoor ().y,
    76 //                 this->getAbsCoor ().z);
    77 //   /* rotate */
    78 //   this->getAbsDir ().matrix (matrix);
    79 //   glMultMatrixf((float*)matrix);
    80 //
     90  glMatrixMode(GL_MODELVIEW);
     91  glPushMatrix();
     92  float matrix[4][4];
     93
     94  /* translate */
     95  glTranslatef (this->getAbsCoor ().x,
     96                this->getAbsCoor ().y,
     97                this->getAbsCoor ().z);
     98  /* rotate */
     99  this->getAbsDir ().matrix (matrix);
     100  glMultMatrixf((float*)matrix);
     101
    81102//   if (this->shader != NULL && this->shader != Shader::getActiveShader())
    82103//     shader->activateShader();
    83 //   gluSphere(this->obj, 3, 10, 10);
     104
     105  this->getModel()->draw();
    84106//   shader->deactivateShader();
    85 //
    86 //
    87 // /*  if (this->model)
    88 //     this->model->draw();*/
    89 //   glPopMatrix();
     107
     108
     109/*  if (this->model)
     110    this->model->draw();*/
     111  glPopMatrix();
    90112}
    91113
     
    97119  //if (directin.len() < 100)
    98120//  this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0));
    99   this->shiftDir(Quaternion(dt, this->randomRotAxis));
     121//  this->shiftDir(Quaternion(dt, this->randomRotAxis));
    100122
    101123}
  • trunk/src/world_entities/npcs/npc_test.h

    r6981 r9235  
    1111
    1212 public:
    13   NPC2 ();
     13  NPC2 (const TiXmlElement* root);
    1414  virtual ~NPC2 ();
    1515
     16  virtual void loadParams(const TiXmlElement* root);
    1617
    1718  void addAI(AI* ai);
     19
     20  virtual void destroy(WorldEntity* killer);
    1821
    1922  virtual void tick(float dt);
     
    2326   Vector   randomRotAxis;
    2427   Shader*  shader;
    25    GLUquadricObj* obj;
    26 
    2728};
    2829
  • trunk/src/world_entities/npcs/npc_test1.cc

    r8724 r9235  
    2424#include "power_ups/turret_power_up.h"
    2525#include "power_ups/laser_power_up.h"
    26 
    27 using namespace std;
    2826
    2927
  • trunk/src/world_entities/playable.cc

    r9110 r9235  
    6767  this->bDead = false;
    6868
    69   //subscribe to collision reaction
    70   this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);
    7169
    7270  registerVar( new SynchronizeableInt( &score, &score, "score" ) );
     
    393391  PRINTF(0)("Playable respawn\n");
    394392  // only if this is the spaceship of the player
    395   if( this == State::getPlayer()->getPlayable())
     393  if( State::getGameRules() && State::getPlayer() && this == State::getPlayer()->getPlayable())
    396394    State::getGameRules()->onPlayerSpawn();
    397395
     
    403401
    404402
    405 void Playable::destroy()
    406 {
    407   Explosion::explode(dynamic_cast<PNode*>(this), Vector(1.0f, 1.0f, 1.0f));
    408 
    409 
     403void Playable::destroy(WorldEntity* killer)
     404{
    410405  if( !this->bDead)
    411406  {
     
    416411      if( this == State::getPlayer()->getPlayable())
    417412        State::getGameRules()->onPlayerDeath();
    418 
    419       //     this->toList(OM_GROUP_05);
    420       //HACK: moves the entity to an unknown place far far away: in the future, GameRules will look for that
    421       this->setAbsCoor(-2000.0, -2000.0, -2000.0);
    422 
    423       //explosion hack
    424 
    425413    }
    426414    this->bDead = true;
     415   
     416    if( State::getGameRules() != NULL)
     417      State::getGameRules()->registerKill(Kill(killer, this));
    427418  }
    428419}
  • trunk/src/world_entities/playable.h

    r9061 r9235  
    8080
    8181  // WorldEntity Extensions
    82   virtual void destroy();
     82  virtual void destroy(WorldEntity* killer);
    8383  virtual void respawn();
    8484  virtual void collidesWith(WorldEntity* entity, const Vector& location);
     
    9090  static const std::string& playmodeToString(Playable::Playmode playmode);
    9191  static const std::string playmodeNames[];
     92 
     93  inline bool beFire(){ return this->bFire; }
     94  inline void fire(bool bF){ this->bFire = bF;}
    9295
    9396protected:
  • trunk/src/world_entities/projectiles/guided_missile.cc

    r8362 r9235  
    3535  this->setClassID(CL_GUIDED_MISSILE, "GuidedMissile");
    3636
    37   this->loadModel("models/projectiles/orx-rocket.obj", .3);
     37  this->loadModel("models/projectiles/orx-rocket.obj", 2.0);
    3838  this->loadExplosionSound("sound/explosions/explosion_4.wav");
    3939
     
    8888    GuidedMissile::trailParticles->setLifeSpan(1.0, .3);
    8989    GuidedMissile::trailParticles->setRadius(0.0, .5);
    90     GuidedMissile::trailParticles->setRadius(0.2, 2.0);
    91     GuidedMissile::trailParticles->setRadius(.5, .8);
    92     GuidedMissile::trailParticles->setRadius(1.0, .8);
     90    GuidedMissile::trailParticles->setRadius(0.2, 4.0);
     91    GuidedMissile::trailParticles->setRadius(.5, 1.5);
     92    GuidedMissile::trailParticles->setRadius(1.0, 1.5);
    9393    GuidedMissile::trailParticles->setColor(0.0, 1,0,0,.7);
    9494    GuidedMissile::trailParticles->setColor(0.2, .8,.8,0,.5);
     
    135135{
    136136  if (this->hitEntity != entity)
    137     this->destroy();
     137    this->destroy( entity );
    138138  this->hitEntity = entity;
    139139}
     
    180180 *  the function gets called, when the projectile is destroyed
    181181 */
    182 void GuidedMissile::destroy ()
    183 {
    184   Projectile::destroy();
     182void GuidedMissile::destroy (WorldEntity* killer)
     183{
     184
     185  printf("THIS SHOULD WORLk\n");
     186
     187  Projectile::destroy( killer );
    185188  PRINTF(5)("DESTROY GuidedMissile\n");
    186189  this->lifeCycle = .95; //!< @todo calculate this usefully.
  • trunk/src/world_entities/projectiles/guided_missile.h

    r6622 r9235  
    2626    virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2727
    28     virtual void destroy ();
     28    virtual void destroy (WorldEntity* killer);
    2929
    3030    virtual void tick (float time);
  • trunk/src/world_entities/projectiles/hyperblast.cc

    r8362 r9235  
    126126 *  the function gets called, when the projectile is destroyed
    127127*/
    128 void Hyperblast::destroy ()
     128void Hyperblast::destroy (WorldEntity* killer)
    129129{
    130   Projectile::destroy();
     130  Projectile::destroy( killer );
    131131
    132132  PRINTF(5)("DESTROY Hyperblast\n");
  • trunk/src/world_entities/projectiles/hyperblast.h

    r6821 r9235  
    2727    virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2828
    29     virtual void destroy ();
     29    virtual void destroy (WorldEntity* killer);
    3030
    3131    virtual void tick (float time);
  • trunk/src/world_entities/projectiles/laser.cc

    r9061 r9235  
    4242
    4343  this->setMinEnergy(10);
    44   this->setHealthMax(10);
     44  this->setHealthMax(0);
    4545  this->lifeSpan = 5.0;
    4646
     
    8888  }
    8989
    90   this->setHealth(10);
     90  this->setDamage(0);
     91  this->setHealth(0);
    9192}
    9293
     
    107108{
    108109  if (this->hitEntity != entity && entity->isA(CL_NPC))
    109     this->destroy();
     110    this->destroy( entity );
    110111  this->hitEntity = entity;
    111112}
     
    128129 *  the function gets called, when the projectile is destroyed
    129130*/
    130 void Laser::destroy ()
     131void Laser::destroy (WorldEntity* killer)
    131132{
    132   Projectile::destroy();
     133  Projectile::destroy( killer );
    133134  PRINTF(5)("DESTROY Laser\n");
    134135  this->lifeCycle = .95; //!< @todo calculate this usefully.
  • trunk/src/world_entities/projectiles/laser.h

    r6622 r9235  
    2727    virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2828
    29     virtual void destroy ();
     29    virtual void destroy (WorldEntity* killer);
    3030
    3131    virtual void tick (float dt);
  • trunk/src/world_entities/projectiles/projectile.cc

    r8362 r9235  
    4141  /* character attributes */
    4242  this->setHealth(1.0f);
    43   this->setDamage(100.0f); // default damage of a projectile set to 100.0 damage points
     43  this->setDamage(1.0f); // default damage of a projectile set to 100.0 damage points
    4444
    4545  this->explosionBuffer = NULL;
     
    162162
    163163  if (this->tickLifeCycle(dt))
    164     this->destroy();
     164    this->destroy( NULL );
    165165}
    166166
     
    169169 *  the function gets called, when the projectile is destroyed
    170170*/
    171 void Projectile::destroy ()
     171void Projectile::destroy (WorldEntity* killer)
    172172{
    173173  if (this->explosionBuffer != NULL)
  • trunk/src/world_entities/projectiles/projectile.h

    r7460 r9235  
    4141    virtual void deactivate() = 0;
    4242
    43     virtual void destroy ();
     43    virtual void destroy (WorldEntity* killer);
    4444
    4545    virtual void tick (float dt);
  • trunk/src/world_entities/projectiles/rocket.cc

    r8362 r9235  
    128128{
    129129  if (this->hitEntity != entity)
    130     this->destroy();
     130    this->destroy( entity );
    131131  this->hitEntity = entity;
    132132}
     
    149149 *  the function gets called, when the projectile is destroyed
    150150*/
    151 void Rocket::destroy ()
     151void Rocket::destroy (WorldEntity* killer)
    152152{
    153   Projectile::destroy();
     153  Projectile::destroy( killer );
    154154
    155155  PRINTF(5)("DESTROY Rocket\n");
  • trunk/src/world_entities/projectiles/rocket.h

    r6622 r9235  
    2727    virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2828
    29     virtual void destroy ();
     29    virtual void destroy (WorldEntity* killer);
    3030
    3131    virtual void tick (float time);
  • trunk/src/world_entities/projectiles/test_bullet.cc

    r8362 r9235  
    119119{
    120120  if (this->hitEntity != entity && entity->isA(CL_NPC))
    121     this->destroy();
     121    this->destroy( entity );
    122122  this->hitEntity = entity;
    123123}
     
    147147 *  the function gets called, when the projectile is destroyed
    148148*/
    149 void TestBullet::destroy ()
     149void TestBullet::destroy (WorldEntity* killer)
    150150{
    151151  PRINTF(5)("DESTROY TestBullet\n");
  • trunk/src/world_entities/projectiles/test_bullet.h

    r6624 r9235  
    2727    virtual void collidesWith(WorldEntity* entity, const Vector& location);
    2828
    29     virtual void destroy ();
     29    virtual void destroy (WorldEntity* killer);
    3030
    3131    virtual void tick (float time);
  • trunk/src/world_entities/script_trigger.cc

    r9110 r9235  
    2929             ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    3030            //Properties
     31             ->addMethod("setName", ExecutorLua1<BaseObject, const std::string&>(&BaseObject::setName))
    3132             ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTarget))
    3233             ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTriggerParent))
     
    5152  this->toList(OM_COMMON);
    5253
     54  radius = 10;
    5355  returnCount = 1;
    5456  scriptFinished = false;
     
    7173 
    7274  }
     75 
    7376}
    7477
     
    215218void ScriptTrigger::setScript(const std::string& file)
    216219{
    217 
    218220  ScriptManager* scriptManager = State::getScriptManager();
    219221  if (scriptManager != NULL)
  • trunk/src/world_entities/skydome.cc

    r9006 r9235  
    11/*
    22   orxonox - the future of 3D-vertical-scrollers
    3  
     3
    44   Copyright (C) 2006 orx
    5  
     5
    66   This program is free software; you can redistribute it and/or modify
    77   it under the terms of the GNU General Public License as published by
    88   the Free Software Foundation; either version 2, or (at your option)
    99   any later version.
    10  
     10
    1111### File Specific:
    1212   main-programmer: hdavid, amaechler
     
    4747  this->toList(OM_BACKGROUND);
    4848  this->toReflectionList();
    49  
     49  this->indices = NULL;
     50  this->vertices = NULL;
     51  this->planeVertices = NULL;
     52  this->shader = NULL;
    5053  activateDome = false;
    5154
     
    9194  if(!activateDome)
    9295    return;
    93  
     96
    9497  glPushAttrib(GL_ENABLE_BIT);
    9598
    9699  glDisable(GL_LIGHTING);
    97100  glDisable(GL_BLEND);
     101  glDisable(GL_FOG);
    98102
    99103  glEnable(GL_TEXTURE_3D);
     
    105109  glTranslatef(0.0f,pRadius,0.0f);
    106110
    107 
    108111  glBegin(GL_TRIANGLES);
    109 
    110112  for (int i=0; i < numIndices; i++)
    111113  {
     
    115117    glVertex3f(planeVertices[indices[i]].x, planeVertices[indices[i]].y, planeVertices[indices[i]].z);
    116118  }
    117 
    118119  glEnd();
    119120
     121  WorldEntity::draw();
     122
    120123  glPopMatrix();
    121124
     
    128131void Skydome::generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius, float hTile, float vTile)
    129132{
    130   PRINTF(0)("Generating a sky plane");
     133  PRINTF(0)("Generating a sky plane\n");
    131134
    132135  // Make sure our vertex array is clear
  • trunk/src/world_entities/space_ships/cruizer.cc

    r9061 r9235  
    7878  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
    7979
    80   this->loadModel("models/ships/human_cruizer.obj", 0.05);
     80 // this->loadModel("models/ships/human_cruizer.obj", 0.05);
    8181
    8282}
  • trunk/src/world_entities/space_ships/helicopter.cc

    r8783 r9235  
    4343                            ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
    4444                            ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
    45                            
     45
    4646                       );
    4747
     
    124124void Helicopter::init()
    125125{
     126  this->chopperBuffer = NULL;
     127
    126128  this->setClassID(CL_HELICOPTER, "Helicopter");
    127 
    128129  PRINTF(4)("HELICOPTER INIT\n");
    129130
  • trunk/src/world_entities/space_ships/helicopter.h

    r8783 r9235  
    3939
    4040    virtual void process(const Event &event);
    41    
     41
    4242    virtual void moveUp(bool move){bAscend = move;};
    4343    virtual void moveDown(bool move){bDescend = move;};
     
    7878    float                 airViscosity;
    7979
    80     OrxSound::SoundSource soundSource;
    81     OrxSound::SoundBuffer*chopperBuffer;
     80    OrxSound::SoundSource  soundSource;
     81    OrxSound::SoundBuffer* chopperBuffer;
    8282
    8383};
  • trunk/src/world_entities/space_ships/hover.cc

    r8719 r9235  
    2525
    2626#include "util/loading/factory.h"
     27//#include "util/loading/resource_manager.h"
     28
    2729#include "key_mapper.h"
    2830#include "state.h"
     
    3436CREATE_FACTORY(Hover, CL_HOVER);
    3537
     38#include "script_class.h"
     39CREATE_SCRIPTABLE_CLASS(Hover, CL_HOVER,
     40                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     41                        //Coordinates
     42                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     43                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     44                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
     45                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     46                       );
     47
    3648/**
    3749 *  destructs the hover, deletes alocated memory
     
    4052{
    4153  this->setPlayer(NULL);
     54
     55  //if (this->hoverBuffer != NULL)
     56  //  ResourceManager::getInstance()->unload(this->hoverBuffer);
    4257}
    4358
     
    5873
    5974  this->loadParams(doc.RootElement());
     75
     76  //load sound
     77  //if (this->hoverBuffer != NULL)
     78  //  ResourceManager::getInstance()->unload(this->hoverBuffer);
     79  //this->hoverBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/engine/hover.wav", WAV);
     80
    6081}
    6182
     
    97118void Hover::init()
    98119{
     120
     121  //this->hitEntity = NULL;
     122  //this->hoverBuffer = NULL;
     123
    99124  //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    100125  this->setClassID(CL_HOVER, "Hover");
     
    112137  this->cameraLook = 0.0f;
    113138  this->rotation = 0.0f;
    114   this->acceleration = 25.0f;
     139  this->acceleration = 15.0f;
    115140  this->airFriction = 3.0f;
    116141
     
    206231  State::getCameraNode()->setRelCoorSoft(-10, 0,0);
    207232  State::getCameraTargetNode()->setParentSoft(&this->cameraNode);
     233
     234  //this->soundSource.play(this->hoverBuffer, 0.3f, true);
     235
    208236}
    209237
  • trunk/src/world_entities/space_ships/hover.h

    r7346 r9235  
    77#ifndef _HOVER_H
    88#define _HOVER_H
     9
     10//#include "sound_buffer.h"
     11//#include "sound_source.h"
    912
    1013#include "playable.h"
     
    6871    float                 airViscosity;
    6972
    70     WorldEntity* hitEntity;
     73    WorldEntity*          hitEntity;
     74
     75    //OrxSound::SoundSource  soundSource;
     76    //OrxSound::SoundBuffer* hoverBuffer;
    7177};
    7278
  • trunk/src/world_entities/space_ships/space_ship.cc

    r9110 r9235  
    5858CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP,
    5959                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     60                        ->addMethod("fire", ExecutorLua1<Playable, bool>(&Playable::fire))
     61                        ->addMethod("loadModel", ExecutorLua2<WorldEntity,const std::string& ,float>(&WorldEntity::loadModel2))
     62                        ->addMethod("setName", ExecutorLua1<BaseObject,const std::string&>(&BaseObject::setName))
     63                        ->addMethod("hide", ExecutorLua0<WorldEntity>(&WorldEntity::hide))
     64                        ->addMethod("unhide", ExecutorLua0<WorldEntity>(&WorldEntity::unhide))
    6065                       //Coordinates
    6166                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     
    352357//     return;
    353358
    354   // spaceship controlled movement
     359  // spaceship controlled movement fire(bool bF){ this->bFire = bF;}
    355360  //if (this->getOwner() == this->getHostID())
    356361    this->calculateVelocity(time);
     
    404409  Vector accel(0.0, 0.0, 0.0);
    405410  /*
    406   Vector rot(0.0, 0.0, 0.0); // wird benötigt für Helicopter
     411  Vector rot(0.0, 0.0, 0.0); // wird ben�igt fr Helicopter
    407412  */
    408413  //float rotVal = 0.0;
     
    513518}
    514519
    515 void SpaceShip::destroy( )
     520void SpaceShip::destroy( WorldEntity* killer )
    516521{
    517522  PRINTF(0)("spaceship destroy\n");
  • trunk/src/world_entities/space_ships/space_ship.h

    r9008 r9235  
    3737    virtual void leftWorld();
    3838   
    39     virtual void destroy();
     39    virtual void destroy(WorldEntity* killer);
    4040    virtual void respawn();
    4141
  • trunk/src/world_entities/space_ships/spacecraft_2d.cc

    r9110 r9235  
    3535#include "debug.h"
    3636
     37#include "script_class.h"
     38
     39
    3740CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D);
    3841
    39 /**
    40  *  destructs the spacecraft_2d, deletes alocated memory
    41  */
    42 Spacecraft2D::~Spacecraft2D ()
    43 {
    44   this->setPlayer(NULL);
    45   delete this->toTravelHeight;
    46 }
     42
     43CREATE_SCRIPTABLE_CLASS(Spacecraft2D, CL_SPACECRAFT_2D,
     44                        addMethod("hasPlayer", ExecutorLua0ret<Playable,bool>(&Playable::hasPlayer))
     45                        //Coordinates
     46                        ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor))
     47                        ->addMethod("getAbsCoorX", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorX))
     48                        ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY))
     49                        ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ))
     50                        ->addMethod("setAirFriction", ExecutorLua1<Spacecraft2D, float>(&Spacecraft2D::setAirFriction))
     51                       );
     52
    4753
    4854/**
     
    7682    this->loadParams(root);
    7783
     84
     85
    7886  //weapons:
    79   Weapon* wpRight = new TestGun(0);
    80   wpRight->setName("testGun Right");
    81   Weapon* wpLeft = new TestGun(1);
    82   wpLeft->setName("testGun Left");
    83   //Weapon* cannon = dynamic_cast<Weapon*>(Factory::fabricate(CL_HYPERBLASTER));
     87  Weapon* wpRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON));
     88  wpRight->setName("Cannon_Right");
     89  Weapon* wpLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_LASER_CANNON));
     90  wpLeft->setName("Cannon_Left");
     91
     92  Weapon* turretLeft = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN));
     93  wpRight->setName("Turret_Left");
     94  Weapon* turretRight = dynamic_cast<Weapon*>(Factory::fabricate(CL_BOOMERANG_GUN));
     95  wpLeft->setName("Turret_Right");
    8496
    8597  //  cannon->setName("BFG");
     
    8799  this->addWeapon(wpLeft, 1, 0);
    88100  this->addWeapon(wpRight,1 ,1);
     101  this->addWeapon(turretLeft, 1, 2);
     102  this->addWeapon(turretRight, 1, 3);
     103
    89104  //this->addWeapon(cannon, 0, 2);
    90105
    91106  this->getWeaponManager().changeWeaponConfig(1);
    92107  dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false);
     108}
     109
     110
     111/**
     112 * @brief destructs the spacecraft_2d, deletes alocated memory
     113 */
     114Spacecraft2D::~Spacecraft2D ()
     115{
     116  this->setPlayer(NULL);
     117  delete this->toTravelHeight;
    93118}
    94119
     
    109134  this->cameraLook = 0.0f;
    110135  this->rotation = 0.0f;
    111   this->acceleration = 10.0f;
    112   this->airFriction = 2.0f;
    113 
    114 
    115   this->setHealthMax(100);
    116   this->setHealth(100);
     136  this->acceleration = 20.0f;
     137  this->airFriction = 0.0f;
     138
     139
     140  this->setHealthMax(1000);
     141  this->setHealth(1000);
     142  this->setDamage(100.0f);
     143
    117144
    118145
     
    122149  this->travelNode = new PNode();
    123150
     151  this->loadModel("models/ships/mantawing.obj", 5.0f);
    124152
    125153  // camera - issue
     
    166194  this->getWeaponManager().setSlotCount(5);
    167195
    168   this->getWeaponManager().setSlotPosition(0, Vector(-0.28, 1.186, -2.750));
     196  this->getWeaponManager().setSlotPosition(0, Vector(1.843, -0.335, 2.029) * 5.0);
    169197  this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    170198
    171   this->getWeaponManager().setSlotPosition(1, Vector(-0.28, 1.186, 2.750));
     199  this->getWeaponManager().setSlotPosition(1, Vector(1.843, -0.335, -2.029) * 5.0);
    172200  this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
    173201
    174   this->getWeaponManager().setSlotPosition(2, Vector(-1.63, .809, -.003));
    175   this->getWeaponManager().setSlotCapability(2, WTYPE_HEAVY);
    176 
    177202  /// TODO: THESE ARE TOO MUCH
    178   this->getWeaponManager().setSlotPosition(3, Vector(-1.63, .678, -.652));
    179   this->getWeaponManager().setSlotDirection(3, Quaternion(-24/180 * M_PI, Vector(1,0,0)));
    180 
    181   this->getWeaponManager().setSlotPosition(4, Vector(-1.63, .678, .652));
    182   this->getWeaponManager().setSlotDirection(4, Quaternion(24/180 * M_PI, Vector(1,0,0)));
     203  this->getWeaponManager().setSlotPosition(2, Vector(-0.351, -.238, 1.406) * 5.0);
     204  this->getWeaponManager().setSlotDirection(2, Quaternion(-1.7, Vector(0,1,0)));
     205
     206  this->getWeaponManager().setSlotPosition(3, Vector(-0.351, -.238, -1.406) * 5.0);
     207  this->getWeaponManager().setSlotDirection(3, Quaternion(1.7, Vector(0,1,0)));
    183208
    184209  this->cameraNode.setRelCoor(1,5,0);
     
    193218  registerVar( new SynchronizeableFloat( &cameraLook, &cameraLook, "cameraLook", PERMISSION_OWNER ) );
    194219  registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) );
     220
     221
     222
    195223}
    196224
     
    285313
    286314        State::getCameraNode()->setParentSoft(this->travelNode);
    287         State::getCameraNode()->setRelCoorSoft(-3, 50,0);
     315        State::getCameraNode()->setRelCoorSoft(-3, 100,0);
    288316        State::getCameraTargetNode()->setParentSoft(this->travelNode);
    289         State::getCameraTargetNode()->setRelCoorSoft(0,0,0);
     317        State::getCameraTargetNode()->setRelCoorSoft(5,0,1);
    290318
    291319
     
    406434        if (this->toTravelHeight != NULL)
    407435        {
    408           this->travelNode->shiftCoor(Vector(0, (*toTravelHeight - this->travelNode->getAbsCoor().y) * dt, 0));
     436          this->travelNode->shiftCoor(Vector(0, (*toTravelHeight - this->travelNode->getAbsCoor().y) * dt * 10.0, 0));
    409437          if (fabsf(this->travelNode->getAbsCoor().y - *this->toTravelHeight) < .1)
    410438          {
     
    416444
    417445        accel.y = 0.0;
     446
    418447        Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration);
    419448        accelerationDir.y = 0.0;
     
    424453
    425454        this->velocity += (accelerationDir - damping)* dt;
     455
     456        if (this->getRelCoor().z > this->travelDistance.y && velocity.z > 0.0)
     457          this->velocity.z = 0.0f;
     458        if (this->getRelCoor().z < -this->travelDistance.y && velocity.z < 0.0)
     459          this->velocity.z = 0.0f;
     460
     461        if (this->getRelCoor().x > this->travelDistance.x && velocity.x > 0.0)
     462          this->velocity.x = 0.0f;
     463        if (this->getRelCoor().x < -this->travelDistance.x && velocity.x < 0.0)
     464          this->velocity.x = 0.0f;
     465
     466
    426467        this->shiftCoor (this->velocity * dt);
    427         this->setRelDirSoft(Quaternion(0, Vector(0,0,0)), 1.0f);
     468        if (accel.z == 0)
     469          this->setRelDirSoft(Quaternion(0, Vector(0,0,0)), 5.0f);
     470        else
     471          this->setRelDirSoft(Quaternion(this->velocity.z * .004, Vector(1,0,0)), 4.5f);
    428472      }
    429473      break;
     
    475519      else if (cameraLook < -M_PI_4)
    476520        cameraLook = -M_PI_4;
    477       //this->cameraNode.setRelDirSoft(this->direction,10);
    478521    }
    479522  }
  • trunk/src/world_entities/space_ships/spacecraft_2d.h

    r9110 r9235  
    2727    void setTravelDistance(const Vector2D& distance);
    2828    void setTravelDistance(float x, float y);
     29
     30    void setAirFriction(float friction) { this->airFriction = friction; };
    2931
    3032
  • trunk/src/world_entities/spawning_point.cc

    r9008 r9235  
    5757 
    5858  MessageManager::getInstance()->registerMessageHandler( MSGID_RESPAWN, respawnMessageHandler, NULL );
     59 
     60  this->setSynchronized( true );
    5961}
    6062
     
    102104void SpawningPoint::spawn(Playable* entity)
    103105{
     106  const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
     107 
     108  bool found = false;
     109 
     110  if ( !list )
     111    return;
     112   
     113  for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
     114  {
     115    if ( *it == entity )
     116    {
     117      found = true;
     118      break;
     119    }
     120  }
     121 
     122  if ( !found )
     123    return;
     124
    104125  PRINTF(0)("Spawningpoint spawns Entity (%s)\n", entity->getClassName());
    105126
     
    137158      this->spawn(it->entity);
    138159     
    139       if ( SharedNetworkData::getInstance()->isGameServer() )
     160      const std::list<BaseObject*> * list = ClassList::getList( CL_PLAYABLE );
     161 
     162      bool found = false;
     163 
     164      if ( !list )
     165        return;
     166   
     167      for ( std::list<BaseObject*>::const_iterator it2 = list->begin(); it2 != list->end(); it2++ )
     168      {
     169        if ( *it2 == it->entity )
     170        {
     171          found = true;
     172          break;
     173        }
     174      }
     175 
     176      if ( found && SharedNetworkData::getInstance()->isGameServer() )
    140177        this->sendRespawnMessage( it->entity->getUniqueID() );
    141178
     
    194231  assert( Converter::byteArrayToInt( data+INTSIZE, &uniqueId ) == INTSIZE );
    195232 
     233  PRINTF(0)("SPAWNMESSAGE %d\n", uniqueId);
     234 
    196235  SpawningPoint * sp = NULL;
    197236  Playable      * playable = NULL;
     
    203242    for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ )
    204243    {
    205       if ( dynamic_cast<SpawningPoint*>(*it)->getUniqueID() == uniqueId )
     244      PRINTF(0)("%d:%d\n", dynamic_cast<SpawningPoint*>(*it)->getUniqueID(), spUniqueId);
     245      if ( dynamic_cast<SpawningPoint*>(*it)->getUniqueID() == spUniqueId )
    206246      {
    207247        sp = dynamic_cast<SpawningPoint*>(*it);
     
    213253  if ( !sp )
    214254  {
    215     PRINTF(2)("could not find spawning point\n");
     255    PRINTF(0)("could not find spawning point\n");
    216256    return false;
    217257  }
     
    233273  if ( !playable )
    234274  {
    235     PRINTF(2)("could not find playable\n");
     275    PRINTF(0)("could not find playable\n");
    236276    return false;
    237277  }
  • trunk/src/world_entities/test_entity.cc

    r9003 r9235  
    116116  if( this->lastCollided != entity)
    117117  {
    118     this->destroy();
     118    this->destroy( entity );
    119119    this->lastCollided = entity;
    120120
     
    126126
    127127
    128 void TestEntity::destroy()
     128void TestEntity::destroy(WorldEntity* killer)
    129129{
    130130  if( this->bDeath)
  • trunk/src/world_entities/test_entity.h

    r8778 r9235  
    2525  void setAnim(int animationIndex, int animPlaybackMode);
    2626
    27   virtual void destroy();
     27  virtual void destroy(WorldEntity* killer);
    2828
    2929  virtual void tick (float time);
  • trunk/src/world_entities/weapons/fps_sniper_rifle.cc

    r9003 r9235  
    3333#include "fps_sniper_rifle.h"
    3434
     35
     36#include "effects/explosion.h"
    3537
    3638using namespace std;
     
    145147    return;
    146148
    147   pj->setParent(PNode::getNullParent());
     149//   Explosion::explode(this, Vector(0.1,0.1,0.1));
    148150
    149   pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*250 + VECTOR_RAND(5));
     151  pj->setParent(this);
     152  pj->setParentMode(PNODE_ROTATE_AND_MOVE);
    150153
    151   pj->setAbsCoor(this->getEmissionPoint());
     154  pj->setVelocity(this->getAbsDir().apply(Vector(1,0,0))*550 + VECTOR_RAND(5) );
     155
     156  pj->setAbsCoor(this->getEmissionPoint() + this->getAbsDirX() * 25.0f);
    152157  pj->setAbsDir(this->getAbsDir());
    153158  pj->activate();
  • trunk/src/world_entities/world_entity.cc

    r9110 r9235  
    8585
    8686  this->toList(OM_NULL);
    87  
     87
    8888  registerVar( new SynchronizeableString( &this->md2TextureFileName, &this->md2TextureFileName, "md2TextureFileName" ) );
    8989  modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName" ) );
    9090  scaling_handle = registerVarId( new SynchronizeableFloat( &scaling, &scaling, "scaling" ) );
    9191  list_handle = registerVarId( new SynchronizeableInt( (int*)&objectListNumber, &list_write, "list" ) );
    92  
     92
    9393  health_handle = registerVarId( new SynchronizeableFloat( &this->health, &this->health_write, "health" ) );
    9494  healthMax_handle = registerVarId( new SynchronizeableFloat( &this->healthMax, &this->healthMax_write, "maxHealth" ) );
     
    209209        this->buildObbTree(obbTreeDepth);
    210210    }
    211     else /*if(fileName.find(".md3") != std::string::npos)*/
     211    else if(fileName.find(".md3") != std::string::npos)
    212212    {
    213213      PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str());
     
    414414bool WorldEntity::registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB)
    415415{
     416  PRINTF(5)("registering collision of type: %s vs %s\n", entityA->getClassName(), entityB->getClassName());
    416417  // is there any handler listening?
    417418  if( !this->bReactive)
     
    571572 */
    572573void WorldEntity::reset()
    573 {}
     574{
     575  this->setHealth( this->getHealthMax() );
     576}
    574577
    575578/**
     
    742745  this->decreaseHealth(damage);
    743746
    744   PRINTF(0)("Hit me: %s now only %f/%f health\n", this->getClassName(), this->getHealth(), this->getHealthMax());
     747  PRINTF(5)("Hit me: %s now only %f/%f health\n", this->getClassName(), this->getHealth(), this->getHealthMax());
    745748
    746749  if( this->getHealth() > 0)
     
    750753  else
    751754  {
    752     this->destroy();
    753 
    754     if( State::getGameRules() != NULL)
    755       State::getGameRules()->registerKill(Kill(killer, this));
     755    this->destroy( killer );
    756756  }
    757757}
     
    761761 * destoys the world entity
    762762 */
    763 void WorldEntity::destroy()
     763void WorldEntity::destroy(WorldEntity* killer)
    764764{
    765765  this->toList(OM_DEAD);
     
    841841    this->toList( (OM_LIST)list_write );
    842842  }
    843  
     843
    844844  if ( std::find( id.begin(), id.end(), health_handle ) != id.end() )
    845845  {
    846846    this->setHealth( health_write );
    847847  }
    848  
     848
    849849  if ( std::find( id.begin(), id.end(), healthMax_handle ) != id.end() )
    850850  {
  • trunk/src/world_entities/world_entity.h

    r9110 r9235  
    4747
    4848  void loadModel(const std::string& fileName, float scaling = 1.0f, unsigned int modelNumber = 0, unsigned int obbTreeDepth = 4);
     49  void loadModel2(const std::string& fileN, float scal = 1.0f){this->loadModel(fileN,scal,0,4);}
    4950  void setModel(Model* model, unsigned int modelNumber = 0);
    5051  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
     
    7475/** @returns a reference to the obb tree of this worldentity */
    7576  inline BVTree* getOBBTree() const { return this->obbTree; };
     77  inline void setOBBTree(OBBTree* tree) { /*if( this->obbTree != NULL) delete this->obbTree;*/ this->obbTree = (BVTree*)tree; }
    7678  void drawBVTree(int depth, int drawMode) const;
    77   inline AABB* getModelAABB() { return (this->aabbNode)?this->aabbNode->getAABB():NULL;}
     79  inline AABB* getModelAABB() const { return (this->aabbNode)?this->aabbNode->getAABB():NULL;}
    7880
    7981  /* --- Collision Reaction Block --- */
     
    101103  virtual void hit(float damage, WorldEntity* killer);
    102104
    103   virtual void destroy();
     105  virtual void destroy( WorldEntity* killer );
    104106
    105107
     
    198200  int                     list_write;                      //!< entity's list
    199201  int                     list_handle;                     //!< handle for list changes
    200  
     202
    201203  float                   health_write;
    202204  int                     health_handle;
    203  
     205
    204206  float                   healthMax_write;
    205207  int                     healthMax_handle;
Note: See TracChangeset for help on using the changeset viewer.