Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9235 in orxonox.OLD


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

merged the presentation back

Location:
trunk/src
Files:
90 edited
18 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/defs/class_id.h

    r9061 r9235  
    191191  CL_CRANE                      =    0x00000316,
    192192  CL_BRAKING_WALL               =    0X00000317,
     193  CL_AIMING_SYSTEM              =    0x00000318,
     194  CL_GATE                       =    0x00000319,
    193195
    194196  // Playables
     
    213215  // Weapons
    214216  CL_TEST_GUN                   =    0x000003a0,
    215   CL_TURRET                     =    0x000003a1,
    216   CL_AIMING_TURRET              =    0x000003a2,
    217   CL_CANNON                     =    0x000003a3,
    218   CL_TARGETING_TURRET           =    0x000003a4,
    219   CL_HYPERBLASTER               =    0x000003a5,
    220   CL_FPS_SNIPER_RIFLE           =    0x000003a6,
    221   CL_FPS_LASER_RIFLE            =    0x000003a7,
     217  CL_LASER_CANNON               =    0x000003a1,
     218  CL_TURRET                     =    0x000003a2,
     219  CL_AIMING_TURRET              =    0x000003a3,
     220  CL_CANNON                     =    0x000003a4,
     221  CL_TARGETING_TURRET           =    0x000003a5,
     222  CL_HYPERBLASTER               =    0x000003a6,
     223  CL_FPS_SNIPER_RIFLE           =    0x000003a7,
     224  CL_FPS_LASER_RIFLE            =    0x000003a8,
     225  CL_BOOMERANG_GUN              =    0x00000309,
    222226
    223227  // Projectiles
     
    225229  CL_ROCKET                     =    0x000003e1,
    226230  CL_LASER                      =    0x000003e2,
    227   CL_BOMB                       =    0x000003e3,
    228   CL_GROUND_TURRET              =    0x000003e4,
    229   CL_GUIDED_MISSILE             =    0x000003e5,
    230   CL_HYPERBLAST                 =    0x000003e6,
     231  CL_RAIL_PROJECTILE            =    0x000003e3,
     232  CL_BOMB                       =    0x000003e4,
     233  CL_GROUND_TURRET              =    0x000003e5,
     234  CL_SPACE_TURRET               =    0x000003e6,
     235  CL_GUIDED_MISSILE             =    0x000003e7,
     236  CL_HYPERBLAST                 =    0x000003e8,
     237  CL_BOOMERANG_PROJECTILE       =    0x00000309,
    231238
    232239  // NPC's
     
    234241  CL_NPC_TEST2                  =    0x00000402,
    235242  CL_GENERIC_NPC                =    0x00000403,
     243  CL_ATTRACTOR_MINE             =    0x00000404,
    236244
    237245  // Testing Entities
     
    276284  CL_COLLISION_REACTION         =    0X00000713,
    277285  CL_CR_PHYSICS_MOMENTUM        =    0X00000714,
    278   CL_CR_PHYSICS_GROUND          =    0X00000715,
    279   CL_CR_PHYSICS_GROUND_WALK     =    0X00000716,
     286  CL_CR_PHYSICS_GROUND_WALK     =    0X00000715,
     287  CL_CR_PHYSICS_FULL_WALK       =    0X00000716,
    280288  CL_CR_OBJECT_DAMAGE           =    0X00000717,
    281289  CL_CR_OBJECT_PICKUP           =    0X00000718,
  • trunk/src/lib/collision_detection/obb_tree.cc

    r8316 r9235  
    4141
    4242
     43/**
     44 *  standard constructor
     45 */
     46OBBTree::OBBTree()
     47  : BVTree()
     48{}
     49
    4350
    4451void OBBTree::init()
     
    7885
    7986  this->rootNode->spawnBVTree(modelInf, triangleIndexes, modelInf.numTriangles);
     87}
     88
     89
     90void OBBTree::createBox(Vector start, Vector end)
     91{
     92  this->rootNode = new OBBTreeNode(*this, NULL, 1);
     93
     94  this->rootNode->createBox(start, end);
    8095}
    8196
  • trunk/src/lib/collision_detection/obb_tree.h

    r7711 r9235  
    2323  public:
    2424    OBBTree(int depth, const modelInfo* modInfo, WorldEntity* entity);
     25    OBBTree();
    2526    virtual ~OBBTree();
    2627    void init();
     
    2829    virtual void spawnBVTree(const modelInfo& modelInf);
    2930    virtual void flushTree();
     31
     32    void createBox(Vector start, Vector end);
    3033
    3134    virtual void collideWith(WorldEntity* entity1, WorldEntity* entity2);
  • trunk/src/lib/collision_detection/obb_tree_node.cc

    r9008 r9235  
    9090    delete this->bvElement;
    9191}
     92
     93
     94
     95void OBBTreeNode::createBox(Vector start, Vector end)
     96{
     97
     98  this->bvElement = new OBB();
     99  this->nodeLeft = NULL;
     100  this->nodeRight = NULL;
     101//   this->depth = 0;
     102
     103  this->bvElement->center = (end - start) * 0.5f;
     104  this->bvElement->halfLength[0] = (end.x - start.x) * 0.5f;
     105  this->bvElement->halfLength[1] = (end.y - start.y) * 0.5f;
     106  this->bvElement->halfLength[2] = (end.z - start.z) * 0.5f;
     107
     108  this->bvElement->axis[0] = Vector(1,0,0);
     109  this->bvElement->axis[1] = Vector(0,1,0);
     110  this->bvElement->axis[2] = Vector(0,0,1);
     111}
     112
    92113
    93114
     
    561582bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB)
    562583{
     584
    563585  //HACK remove this again
    564586  this->owner = nodeA;
     
    677699void OBBTreeNode::drawBV(int depth, int drawMode, const Vector& color,  bool top) const
    678700{
     701
    679702  /* this function can be used to draw the triangles and/or the points only  */
    680703  if( 1 /*drawMode & DRAW_MODEL || drawMode & DRAW_ALL*/)
     
    682705    if( depth == 0/*!(drawMode & DRAW_SINGLE && depth != 0)*/)
    683706    {
    684       if( 1 /*drawMode & DRAW_POINTS*/)
     707      if( 0 /*drawMode & DRAW_POINTS*/)
    685708      {
    686709        glBegin(GL_POINTS);
  • trunk/src/lib/collision_detection/obb_tree_node.h

    r7732 r9235  
    3131
    3232    virtual void spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, int length);
     33    void createBox(Vector start, Vector end);
    3334
    3435    virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB);
     
    7980
    8081    WorldEntity*        owner;
     82
    8183};
    8284
  • trunk/src/lib/collision_reaction/Makefile.am

    r8490 r9235  
    1010                     collision_reaction.cc \
    1111                     cr_object_damage.cc \
    12                      cr_physics_ground_walk.cc
     12                     cr_physics_ground_walk.cc \
     13                     cr_physics_full_walk.cc
    1314
    1415
     
    2122                     collision_reaction.h \
    2223                     cr_object_damage.h \
    23                      cr_physics_ground_walk.h
     24                     cr_physics_ground_walk.h \
     25                     cr_physics_full_walk.h
    2426
  • trunk/src/lib/collision_reaction/collision_handle.cc

    r8724 r9235  
    2525#include "cr_object_damage.h"
    2626#include "cr_physics_ground_walk.h"
     27#include "cr_physics_full_walk.h"
    2728
    2829#include "debug.h"
     
    5253  switch( type)
    5354  {
    54     case CREngine::CR_PHYSICS_STEP_BACK:
    55 //       this->collisionReaction = new CRPhysicsGroundWalk();
     55    case CREngine::CR_PHYSICS_FULL_WALK:
     56      this->collisionReaction = new CRPhysicsFullWalk();
    5657      this->bContinuousPoll = true;
    5758      break;
     
    229230  for(; it < this->targetList.end(); it++)
    230231  {
     232//     if(collisionEvent->getEntityB()->isA(CL_AIMING_SYSTEM) || collisionEvent->getEntityA()->isA(CL_AIMING_SYSTEM))
     233//     {
     234//        PRINTF(0)("I am: %s colliding with: %s\n", owner->getClassName(), collisionEvent->getEntityB()->getClassName(), *it);
     235//        if( collisionEvent->getEntityA() == this->owner) {
     236//          PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
     237//          collisionEvent->getEntityB()->getClassName(), *it);
     238//          if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
     239//            PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     240//            collisionEvent->getEntityB()->getClassName(), *it);
     241//             }
     242//        }
     243//        else {
     244//          PRINTF(0)("I am not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
     245//          collisionEvent->getEntityB()->getClassName(), *it);
     246//          if( collisionEvent->getEntityA()->isA((ClassID)(*it))) {
     247//            PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     248//            collisionEvent->getEntityA()->getClassName(), *it);
     249//             }
     250//        }
     251//
     252//     }
     253
    231254    if( collisionEvent->getEntityA() == this->owner) {
    232255      if( collisionEvent->getEntityB()->isA((ClassID)(*it))) {
     
    256279  for(; it < this->targetList.end(); it++)
    257280  {
     281
     282//     if(collision->getEntityB()->isA(CL_AIMING_SYSTEM) || collision->getEntityA()->isA(CL_AIMING_SYSTEM))
     283//     {
     284//       PRINTF(0)("Shared!!! I am: %s colliding with: %s\n", owner->getClassName(), collision->getEntityB()->getClassName(), *it);
     285//       if( collision->getEntityA() == this->owner) {
     286//         PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
     287//         collision->getEntityB()->getClassName(), *it);
     288//         if( collision->getEntityB()->isA((ClassID)(*it))) {
     289//           PRINTF(0)("I am owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     290//           collision->getEntityB()->getClassName(), *it);
     291//         }
     292//       }
     293//       else {
     294//         PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter?\n", owner->getClassName(),
     295//         collision->getEntityB()->getClassName(), *it);
     296//         if( collision->getEntityA()->isA((ClassID)(*it))) {
     297//           PRINTF(0)("I'm not owner -> I am: %s colliding with: %s is a %i filter ok\n", owner->getClassName(),
     298//           collision->getEntityA()->getClassName(), *it);
     299//         }
     300//       }
     301//     }
     302
    258303    if( collision->getEntityA() == this->owner) {
    259304      if( collision->getEntityA()->isA((ClassID)(*it)))
  • trunk/src/lib/collision_reaction/cr_engine.h

    r8190 r9235  
    3030    CR_PHYSICS_MOMENTUM   = 0,    //!< physical reaction: conservervation of momentum
    3131    CR_PHYSICS_STEP_BACK,         //!< physical reaction: just go to the last position without collisions
    32     CR_PHYSICS_GROUND,            //!< physical reaction: stand on the ground, no movement: simulating simple normal force away from the gravity force
    33     CR_PHYSICS_GROUND_WALK,       //!< physical reaction: walking on the ground (inkl. hills etc)
     32    CR_PHYSICS_GROUND_WALK,       //!< physical reaction: stand on the ground, no movement: simulating simple normal force away from the gravity force
     33    CR_PHYSICS_FULL_WALK,         //!< physical reaction: walking on the ground (inkl. hills etc)
    3434    CR_PHYSICS_DAMAGE,            //!< physical reaction: daling damage according to the object energy and their structural stability
    3535
  • trunk/src/lib/collision_reaction/cr_object_damage.cc

    r9061 r9235  
    5656  float damage = 0.0f;
    5757
    58   PRINTF(0)("Dealing damage - Handling collision: %s vs %s\n",
     58  PRINTF(4)("Dealing damage - Handling collision: %s vs %s\n",
    5959            collision->getEntityA()->getClassName(),
    6060            collision->getEntityB()->getClassName());
  • trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc

    r9110 r9235  
    7171
    7272  float CR_MAX_WALK_HEIGHT = 15.0f;
    73   float CR_THRESHOLD = 0.2f;
    7473
    7574  float height = 0.0f;
    76   float front = 0.0f;
    77   float back = 0.0f;
    78   float right = 0.0f;
    79   float left = 0.0f;
    8075
    8176
     
    9489    switch( ce->getType())
    9590    {
    96         /* collision in the X-AXIS */
    97       case COLLISION_TYPE_AXIS_X:
    98         front = collPos.len() - box->halfLength[0];
    99 
    100         // object is beneath the plane (ground)
    101         if( front <= 0.0f )
    102         {
    103           Vector dirX = entity->getAbsDirX();
    104           dirX.y = 0.0f;
    105           dirX.normalize();
    106           Vector backoff = dirX * front;
    107 
    108           entity->shiftCoor(backoff);
    109         }
    110         else if( ce->isInWall())
    111         {
    112           // object is already in the wall
    113           entity->setAbsCoor(entity->getLastAbsCoor());
    114         }
    115         break;
    116 
    117       case COLLISION_TYPE_AXIS_X_NEG:
    118         back = collPos.len() - box->halfLength[0];
    119 
    120         // object is beneath the plane (ground)
    121         if( back <= 0.0f)
    122         {
    123           Vector dirX = entity->getAbsDirX();
    124           dirX.y = 0.0f;
    125           dirX.normalize();
    126           Vector backoff = dirX * back * -1.0f;
    127 
    128           entity->shiftCoor(backoff);
    129         }
    130         else if( ce->isInWall())
    131         {
    132           // object is already in the wall
    133           entity->setAbsCoor(entity->getLastAbsCoor());
    134         }
    135         break;
    136 
    137 
    13891        /* collision in the Y-AXIS */
    13992      case COLLISION_TYPE_AXIS_Y_NEG:
     
    153106        {
    154107          entity->setAbsCoor(entity->getLastAbsCoor());
    155           PRINTF(0)("ground collision: reset pos\n");
    156108        }
    157109        else
     
    163115
    164116
    165         /* collision in the Z-AXIS */
    166       case COLLISION_TYPE_AXIS_Z:
    167 
    168         right = collPos.len()  - box->halfLength[2];
    169 
    170         // object is beneath the plane (ground)
    171         if( right <= 0.0f )
    172         {
    173           Vector dirZ = entity->getAbsDirZ();
    174           dirZ.y = 0.0f;
    175           dirZ.normalize();
    176           Vector backoff = dirZ * right;
    177           entity->shiftCoor(backoff);
    178         }
    179         else if( ce->isInWall())
    180         {
    181           // object is already in the wall
    182           entity->setAbsCoor(entity->getLastAbsCoor());
    183         }
    184         break;
    185 
    186 
    187         // collision in the z-axis
    188       case COLLISION_TYPE_AXIS_Z_NEG:
    189 
    190         left = collPos.len()  - box->halfLength[2];
    191 
    192         // object is beneath the plane (ground)
    193         if( left <= 0.0f )
    194         {
    195           Vector dirZ = entity->getAbsDirZ();
    196           dirZ.y = 0.0f;
    197           dirZ.normalize();
    198           Vector backoff = dirZ * left*-1.0f;
    199           entity->shiftCoor(backoff);
    200         }
    201         // object is already in the wall
    202         else if( ce->isInWall())
    203         {
    204           entity->setAbsCoor(entity->getLastAbsCoor());
    205         }
    206         break;
    207117    }
    208118  }
    209119  //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side);
    210 
    211 
    212 
    213 
    214 
    215 
    216120
    217121}
  • trunk/src/lib/coord/p_node.cc

    r8316 r9235  
    10891089void PNode::varChangeHandler( std::list< int > & id )
    10901090{
     1091  Synchronizeable::varChangeHandler( id );
     1092 
    10911093  if ( std::find( id.begin(), id.end(), relCoordinate_handle ) != id.end() )
    10921094  {
  • trunk/src/lib/graphics/effects/cloud_effect.cc

    r9112 r9235  
    9090    this->planetRadius = 1500;
    9191    this->divs = 15;
     92    this->cloudActivate = false;
    9293    fadeSky = false;
    9394    fadeCloud = false;
  • trunk/src/lib/graphics/effects/fog_effect.cc

    r9112 r9235  
    2020#include "shell_command.h"
    2121#include "script_class.h"
     22#include "cloud_effect.h"
    2223
    2324// Define shell commands
    24 SHELL_COMMAND(activate, FogEffect, activateFog);
    25 SHELL_COMMAND(deactivate, FogEffect, deactivateFog);
     25//SHELL_COMMAND(activate, FogEffect, activateFog);
     26//SHELL_COMMAND(deactivate, FogEffect, deactivateFog);
    2627SHELL_COMMAND(fadein, FogEffect, fadeInFog);
    2728SHELL_COMMAND(fadeout, FogEffect, fadeOutFog);
     
    8485  this->fogFadeInActivate = false;
    8586  this->fogFadeOutActivate = false;
     87 
     88  this->cloudColor = Vector(0.2f, 0.3f, 0.3f);
     89  this->skyColor = Vector(0.2f, 0.3f, 0.3f);
    8690}
    8791
     
    9397    WeatherEffect::loadParams(root);
    9498
    95     LoadParam(root, "mode", this, FogEffect, setFogMode).describe("fog mode (linear, exponential)");;
    96     LoadParam(root, "density", this, FogEffect, setFogDensity).describe("fog density if exp. fog");;
    97     LoadParam(root, "range", this, FogEffect, setFogRange).describe("fog range: start, end");;
    98     LoadParam(root, "color", this, FogEffect, setFogColor).describe("fog color: r,g,b");;
    99     LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn).describe("duration of the fade in");;
    100     LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut).describe("duration of the fade out");;
    101 
     99    LoadParam(root, "mode", this, FogEffect, setFogMode).describe("fog mode (linear, exponential)");
     100    LoadParam(root, "density", this, FogEffect, setFogDensity).describe("fog density if exp. fog");
     101    LoadParam(root, "range", this, FogEffect, setFogRange).describe("fog range: start, end");
     102    LoadParam(root, "color", this, FogEffect, setFogColor).describe("fog color: r,g,b");
     103    LoadParam(root, "fadeinduration", this, FogEffect, setFogFadeIn).describe("duration of the fade in");
     104    LoadParam(root, "fadeoutduration", this, FogEffect, setFogFadeOut).describe("duration of the fade out");
     105    LoadParam(root, "cloudcolor", this, FogEffect, setCloudColor);
     106    LoadParam(root, "skycolor", this, FogEffect, setSkyColor);
     107   
    102108    LOAD_PARAM_START_CYCLE(root, element);
    103109    {
    104       LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate");;
     110      LoadParam_CYCLE(element, "option", this, FogEffect, setFogOption).describe("sets a fog option: activate");
    105111    }
    106112    LOAD_PARAM_END_CYCLE(element);
     
    125131
    126132    glEnable(GL_FOG);
     133   
     134    // Store cloud- and sky color before the snow
     135    this->oldCloudColor = CloudEffect::cloudColor;
     136    this->oldSkyColor   = CloudEffect::skyColor;
     137   
     138    // Change the colors
     139    CloudEffect::changeCloudColor(this->cloudColor, this->fogFadeInDuration);
     140    CloudEffect::changeSkyColor(this->skyColor, this->fogFadeInDuration);
    127141}
    128142
     
    184198
    185199        if ( this->fogMode == GL_LINEAR)
    186           this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFadeInDuration ) + this->fogEnd;
     200          this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFadeOutDuration ) + this->fogEnd;
    187201        else
    188             this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeInDuration ) * this->fogDensity);
     202            this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeOutDuration ) * this->fogDensity);
    189203
    190204        if ( this->localTimer >= this->fogFadeOutDuration )
     
    207221    // If no manual FadeIn value was set, set a default value
    208222    if (!this->fogFadeInDuration > 0)
    209         this->fogFadeInDuration = 20;
     223        this->fogFadeInDuration = 10;
    210224
    211225    // Reset local timer
     
    227241    this->fogFadeInActivate = false;
    228242
     243   
    229244    // If Fog is off, turn it on first
    230245    if (!this->fogActivate)
     
    233248    // If no manual FadeOut value was set, set a default value
    234249    if (!this->fogFadeOutDuration > 0)
    235         this->fogFadeOutDuration = 20;
     250        this->fogFadeOutDuration = 10;
    236251
    237252    // set FogFadeOut activate
     
    240255    // Reset local timer
    241256    this->localTimer = 0;
    242 }
    243 
     257
     258    // Restore the old cloud- and sky color
     259    CloudEffect::changeCloudColor(this->oldCloudColor, this->fogFadeOutDuration);
     260    CloudEffect::changeSkyColor(this->oldSkyColor, this->fogFadeOutDuration);
     261}
     262
  • trunk/src/lib/graphics/effects/fog_effect.h

    r8793 r9235  
    1010#include "glincl.h"
    1111#include "vector.h"
     12
     13class CloudEffect;
    1214
    1315class FogEffect : public WeatherEffect
     
    7375      this->fogActivate = true;
    7476  }
     77 
     78  inline void setCloudColor(float colorX, float colorY, float colorZ)
     79  {
     80    this->cloudColor = Vector(colorX, colorY, colorZ);
     81  }
     82  inline void setSkyColor(float colorX, float colorY, float colorZ)
     83  {
     84    this->skyColor = Vector(colorX, colorY, colorZ);
     85  }
    7586
    7687  void fadeInFog();
     
    109120  Vector        colorVector;
    110121  float         localTimer;
     122 
     123  Vector oldSkyColor;
     124  Vector oldCloudColor;
     125  Vector skyColor;
     126  Vector cloudColor;
    111127};
    112128
  • trunk/src/lib/graphics/effects/lightning_effect.cc

    r9112 r9235  
    112112    }
    113113
     114    //should load both texture
    114115    this->thunderTextureA = true;
    115116    this->setTexture();
     117    this->switchTexture();
    116118
    117119    if (this->lightningMove) {
  • trunk/src/lib/graphics/effects/rain_effect.cc

    r9112 r9235  
    3434
    3535// Define shell commands
    36 SHELL_COMMAND(activate, RainEffect, activateRain);
    37 SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
     36//SHELL_COMMAND(activate, RainEffect, activateRain);
     37//SHELL_COMMAND(deactivate, RainEffect, deactivateRain);
    3838SHELL_COMMAND(startraining, RainEffect, startRaining);
    3939SHELL_COMMAND(stopraining, RainEffect, stopRaining);
     
    9696 */
    9797void RainEffect::init() {
     98
     99    this->rainParticles = NULL;
     100    this->emitter = NULL;
     101    this->rainBuffer = NULL;
     102    this->windBuffer = NULL;
     103    this->lightMan = NULL;
     104
    98105    //Default values
    99106    this->rainActivate = false;
     
    119126    this->emitter = new PlaneEmitter(this->rainSize);
    120127
     128    lightMan = LightManager::getInstance();
    121129}
    122130
     
    187195    // If we're not fading, change color immediately
    188196    if (!this->rainFadeInActivate || !this->rainFadeOutActivate) {
    189         CloudEffect::changeCloudColor(this->cloudColor, 0);
    190         CloudEffect::changeSkyColor(this->skyColor, 0);
    191     }
     197        CloudEffect::changeCloudColor(this->cloudColor, 0.2);
     198        CloudEffect::changeSkyColor(this->skyColor, 0.2);
     199    }
     200
     201    //lightMan->setAmbientColor(.1,.1,.1);
    192202}
    193203
     
    202212    this->rainFadeOutActivate = false;
    203213
    204     this->emitter->setSystem(NULL);
     214    //if(this->emitter)
     215    //  this->emitter->setSystem(NULL);
     216    //this->hideRain();
    205217
    206218    // Stop Sound
     
    208220
    209221    // Restore the old cloud- and sky color
    210     CloudEffect::changeCloudColor(this->oldCloudColor, 0);
    211     CloudEffect::changeSkyColor(this->oldSkyColor, 0);
     222    CloudEffect::changeCloudColor(this->oldCloudColor, 0.2);
     223    CloudEffect::changeSkyColor(this->oldSkyColor, 0.2);
    212224}
    213225
     
    242254
    243255        // increase sound volume
    244         if (!this->soundSource.isPlaying())
     256        if (progress > 0.5) {
     257          if (!this->soundSource.isPlaying())
    245258            this->soundSource.play(this->rainBuffer, this->soundRainVolume, true);
    246         this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress);
     259          this->soundSource.gain(this->rainBuffer, this->soundRainVolume * progress * 2 - 0.5);
     260        }
    247261
    248262        if (progress >= 1)
    249263            this->rainFadeInActivate = false;
     264
     265        lightMan->setAmbientColor(1-progress, 1-progress, 1-progress);
    250266    }
    251267
     
    276292            this->deactivate();
    277293        }
     294        lightMan->setAmbientColor(1-progress, 1-progress, 1-progress);
    278295    }
    279296}
  • trunk/src/lib/graphics/effects/rain_effect.h

    r9006 r9235  
    132132  float                       soundRainVolume;
    133133
    134   Vector oldSkyColor;
    135   Vector oldCloudColor;
    136   Vector skyColor;
    137   Vector cloudColor;
     134  Vector                      oldSkyColor;
     135  Vector                      oldCloudColor;
     136  Vector                      skyColor;
     137  Vector                      cloudColor;
     138 
     139  LightManager*               lightMan;
    138140
    139141};
  • trunk/src/lib/graphics/effects/snow_effect.cc

    r9112 r9235  
    2828#include "shell_command.h"
    2929#include "script_class.h"
     30#include "cloud_effect.h"
    3031
    3132#include "parser/tinyxml/tinyxml.h"
     
    5354
    5455        //load wind sound
    55         if (this->snowWindForce > 1) {
     56        if (this->snowWindForce >= 1) {
    5657                if (this->windBuffer != NULL)
    5758                        ResourceManager::getInstance()->unload(this->windBuffer);
    58                         this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
     59          this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV);
    5960        }
    6061
     
    8788        LoadParam(root, "size", this, SnowEffect, size);
    8889        LoadParam(root, "coord", this, SnowEffect, coord);
     90  LoadParam(root, "cloudcolor", this, SnowEffect, setCloudColor);
     91  LoadParam(root, "skycolor", this, SnowEffect, setSkyColor);
     92  LoadParam(root, "fadetime", this, SnowEffect, setFadeTime);
    8993
    9094        LOAD_PARAM_START_CYCLE(root, element);
     
    119123        this->snowCoord = Vector(100,450,400);
    120124        this->snowWindForce = 1;
     125 
     126  this->fadeTime = 10;
     127  this->cloudColor = Vector(0.2f, 0.2f, 0.2f);
     128  this->skyColor = Vector(0.0f, 0.0f, 0.0f);
    121129}
    122130
     
    149157  if (this->snowWindForce != 0)
    150158    this->soundSource.play(this->windBuffer, 0.1f * this->snowWindForce, true);
     159 
     160  // Store cloud- and sky color before the snow
     161  this->oldCloudColor = CloudEffect::cloudColor;
     162  this->oldSkyColor   = CloudEffect::skyColor;
     163
     164  // Change the colors
     165  CloudEffect::changeCloudColor(this->cloudColor, this->fadeTime);
     166  CloudEffect::changeSkyColor(this->skyColor, this->fadeTime);
    151167
    152168}
     
    162178        if (this->windBuffer != NULL)
    163179                ResourceManager::getInstance()->unload(this->windBuffer);
     180 
     181  // Restore the old cloud- and sky color
     182  CloudEffect::changeCloudColor(this->oldCloudColor, this->fadeTime);
     183  CloudEffect::changeSkyColor(this->oldSkyColor, this->fadeTime);
    164184}
    165185
  • trunk/src/lib/graphics/effects/snow_effect.h

    r8495 r9235  
    1616class PlaneEmitter;
    1717class PNode;
     18class CloudEffect;
    1819
    1920#include "sound_source.h"
     
    7778        this->snowWindForce = force;
    7879    }
     80    inline void setCloudColor(float colorX, float colorY, float colorZ)
     81    {
     82      this->cloudColor = Vector(colorX, colorY, colorZ);
     83    }
     84    inline void setSkyColor(float colorX, float colorY, float colorZ)
     85    {
     86      this->skyColor = Vector(colorX, colorY, colorZ);
     87    }
     88    inline void setFadeTime(float time)
     89    {
     90      this->fadeTime = time;
     91    }
    7992
    8093    inline void setSnowOption(const std::string& option) {
     
    97110    float         angle, randomAngle;
    98111    float         alpha;
     112    float         fadeTime;
    99113    Vector        snowCoord;
    100114    Vector2D      snowSize;
     
    110124    OrxSound::SoundBuffer*    windBuffer;
    111125
     126    Vector oldSkyColor;
     127    Vector oldCloudColor;
     128    Vector skyColor;
     129    Vector cloudColor;
    112130};
    113131
  • trunk/src/lib/graphics/importer/bsp_manager.cc

    r9110 r9235  
    5353{
    5454
     55  this->lastTex = -1;
    5556  this->parent = parent;
    5657  /*// open a BSP file
     
    101102  return 0;
    102103}
     104
     105
    103106/*
    104107BspManager::BspManager(const char* fileName, float scale)
     
    270273        const float dMaxs = dir.x*(float)curLeaf.maxs[0] +dir.y*(float)curLeaf.maxs[1] +dir.z*(float)curLeaf.maxs[2] - dist;
    271274
    272         if(dMins < -50.0 && dMaxs < -  50.0) {
     275        if(dMins < -70.0 && dMaxs < -70.0) {
    273276          continue;
    274277        }
     
    13711374  else
    13721375  {
    1373     if( this->outputFraction == 1.0f)
     1376    if( this->outputFraction == 1.0f) // No collision Detected
    13741377    {
    1375       if( this->outputAllSolid )
     1378      if( this->outputAllSolid ) 
    13761379      {
    13771380        this->collPlane = new plane;
     
    13821385        SolidFlag = true;
    13831386      }
    1384       else
     1387      else      // No collision happened
    13851388      {
    13861389        yCollisionDown = false;
     
    13881391      }
    13891392    }
    1390     else
     1393    else           // A collision has happended
    13911394    {
    13921395      yCollisionDown = true;
    13931396      collPos = position + (down - position) * this->outputFraction;
    1394       this->out = collPos;        // why this????
    13951397    }
    13961398  }
  • trunk/src/lib/graphics/importer/md2/md2Model.cc

    r9003 r9235  
    4040
    4141//! list of all different animations a std md2model supports
    42 sAnim MD2Model::animationList[21] =
     42sAnim MD2Model::animationList[22] =
    4343  {
    4444 // begin, end, fps, interruptable
     
    6464    { 190, 197,  10, 0 },   //!< DEATH_FALLBACKSLOW
    6565    { 198, 198,  5, 1 },   //!< BOOM
     66    {  199, 204, 10, 1 },  //!< WALK (only for spectial models)
    6667  };
    6768
  • trunk/src/lib/graphics/importer/md2/md2Model.h

    r9003 r9235  
    3030#define MD2_VERSION                     8                                        //!< the md2 version in the header
    3131#define MD2_MAX_TRIANGLES               4096                                     //!< maximal triangles count
    32 #define MD2_MAX_VERTICES                2048                                     //!< maximal vertices count
    33 #define MD2_MAX_TEXCOORDS               2048                                     //!< maximal tex coordinates
     32#define MD2_MAX_VERTICES                3048                                     //!< maximal vertices count
     33#define MD2_MAX_TEXCOORDS               3048                                     //!< maximal tex coordinates
    3434#define MD2_MAX_FRAMES                  512                                      //!< maximal frames
    3535#define MD2_MAX_SKINS                   32                                       //!< maximal skins
     
    9292    DEATH_FALLBACKSLOW,
    9393    BOOM,
     94    WALK,
    9495
    9596    MAX_ANIMATIONS
     
    180181  static sVec3D       anorms[NUM_VERTEX_NORMALS];       //!< the anormals
    181182  static float        anormsDots[SHADEDOT_QUANT][256];  //!< the anormals dot products
    182   static sAnim        animationList[21];                //!< the anomation list
     183  static sAnim        animationList[22];                //!< the anomation list
    183184   //! again one of these strange id software parts
    184185  float*              shadeDots;
  • trunk/src/lib/gui/gl/glgui_handler.cc

    r9022 r9235  
    3333/// TAKE THIS OUT OF HERE.
    3434#include "graphics_engine.h"
     35#include "loading/resource_manager.h"
    3536
    3637namespace OrxGui
     
    7475    this->_cursor->show();
    7576    this->_cursor->setMaxBorders(Vector2D(GraphicsEngine::getInstance()->getResolutionX(), GraphicsEngine::getInstance()->getResolutionY()));
     77
     78    _cursor->loadTextureSequence(ResourceManager::getInstance()->getDataDir() + "/" + "maps/reap_mouse/reap_mouse_##.png", 1, 49);
     79
    7680  }
    7781
  • trunk/src/lib/network/handshake.cc

    r8362 r9235  
    4343
    4444  candel_id = registerVarId( new SynchronizeableInt( &localState.canDel, &remoteState.canDel, "canDel", PERMISSION_ALL ) );
     45 
     46  registerVar( new SynchronizeableString( &localState.preferedNickName, &remoteState.preferedNickName, "preferedNickName", PERMISSION_ALL ) );
    4547
    4648  localState.completed = 0;
  • trunk/src/lib/network/handshake.h

    r7954 r9235  
    2828 
    2929  std::string errorString;
     30 
     31  //additional data
     32  std::string preferedNickName;
    3033};
    3134
     
    4346    inline bool       allowDel(){ return localState.canDel == 1; }
    4447    inline void       del(){ localState.canDel = 1; }
     48   
     49    inline void       setPreferedNickName( const std::string & nick ){ localState.preferedNickName = nick; }
     50    inline std::string getPreferedNickName(){ return remoteState.preferedNickName; }
    4551   
    4652    virtual void varChangeHandler( std::list<int> & id );
  • trunk/src/lib/network/network_game_manager.cc

    r9110 r9235  
    4242#include "multiplayer_team_deathmatch.h"
    4343
     44#include "preferences.h"
     45
    4446
    4547/* using namespace std is default, this needs to be here */
     
    99101  std::string playableModel = rules.getPlayableModelFileName( userId, team, playableClassId );
    100102  std::string playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId );
     103  float       playableScale = rules.getPlayableScale( userId, team, playableClassId );
    101104 
    102105  BaseObject * bo = Factory::fabricate( playableClassId );
     
    107110  Playable & playable = *(dynamic_cast<Playable*>(bo));
    108111 
    109   if ( playableTexture != "" )
    110     playable.loadMD2Texture( playableTexture );
    111   if ( playableModel != "" )
    112     playable.loadModel( playableModel );
     112  playable.loadMD2Texture( playableTexture );
     113 
     114  playable.loadModel( playableModel, 100.0f );
    113115  playable.setOwner( userId );
    114116  playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
     
    125127  stats->setPlayableUniqueId( playable.getUniqueID() );
    126128  stats->setModelFileName( playableModel );
     129 
     130  if ( userId == 0 )
     131    stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) );
    127132 
    128133  if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH ) )
  • trunk/src/lib/network/network_stream.cc

    r9059 r9235  
    3737#include "network_log.h"
    3838
     39#include "player_stats.h"
    3940
    4041#include "lib/util/loading/factory.h"
     
    153154  assert( peers[0].handshake == NULL );
    154155  peers[0].handshake = hs;
     156 
     157  hs->setPreferedNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Player" ) );
     158 
    155159//   peers[0].handshake->setSynchronized( true );
    156160  //this->connectSynchronizeable(*hs);
     
    392396              {
    393397                handleNewClient( it->second.userId );
     398               
     399                if ( PlayerStats::getStats( it->second.userId ) && it->second.handshake->getPreferedNickName() != "" )
     400                {
     401                  PlayerStats::getStats( it->second.userId )->setNickName( it->second.handshake->getPreferedNickName() );
     402                }
    394403              }
    395404             
  • trunk/src/lib/network/player_stats.cc

    r9110 r9235  
    2222#include "state.h"
    2323#include "shared_network_data.h"
     24
     25#include "preferences.h"
    2426
    2527#include "debug.h"
     
    187189void PlayerStats::setNickName( std::string nick )
    188190{
    189   if ( isServer() )
     191  if ( SharedNetworkData::getInstance()->isGameServer() )
    190192  {
    191193    this->nickName = nick;
     
    226228  if ( getStats( SharedNetworkData::getInstance()->getHostID() ) )
    227229    getStats( SharedNetworkData::getInstance()->getHostID() )->setNickName( newNick );
     230   
     231  Preferences::getInstance()->setString( "multiplayer", "nickname", newNick );
    228232}
    229233
  • trunk/src/lib/particles/particle_system.cc

    r7334 r9235  
    460460    int i = 1;
    461461    Particle* tmpPart = this->deadList;
    462     while (tmpPart = tmpPart->next) ++i;
     462    while (tmpPart = tmpPart->next) { ++i; }
    463463    PRINT(0)("count: %d\n", i);
    464464  }
  • trunk/src/lib/script_engine/script.cc

    r9061 r9235  
    2626CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT,
    2727                    addMethod("addObject", ExecutorLua2<Script,const std::string&, const std::string& >(&Script::addObject))
     28                    ->addMethod("registerClass", ExecutorLua1<Script,const std::string&>(&Script::registerClass))
    2829                    ->addMethod("selectFunction", ExecutorLua2ret<Script, bool, const std::string&, int >(&Script::selectFunction))
    2930                    ->addMethod("executeFunction", ExecutorLua0ret<Script,bool >(&Script::executeFunction))
     
    7879bool Script::loadFile(const std::string& filename)
    7980 {
    80    this->setName(filename);
    8181   std::string filedest(ResourceManager::getInstance()->getDataDir());
    8282   filedest += "scripts/" + filename;
     
    9595   if(error == 0)
    9696   {
    97      
     97     currentFile = filename;
    9898     error = lua_pcall(luaState, 0, 0, 0);
    9999
    100100     if(error == 0)
    101101     {
    102       currentFile = filename;
    103102      return true;
    104103     }
     
    358357   bool success = false;
    359358   
    360    //success = this->registerClass(std::string("Vector"));
    361     success = this->registerClass("ScriptTrigger");
     359   //this->registerClass(std::string("Vector"));
     360    this->registerClass("ScriptTrigger");
     361  //  this->registerClass("AttractorMine");
    362362
    363363   return success;
     
    365365 
    366366 
    367  bool Script::registerClass( const std::string& className)
     367 void Script::registerClass( const std::string& className)
    368368 {
    369369   BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS);
     
    378378       tmpObj.name = "";
    379379       registeredObjects.push_back(tmpObj);
     380       return;
     381     }
     382   }
     383 
     384 }
     385
     386 bool Script::classIsRegistered(const std::string& type)
     387 {
     388   for(std::list<WorldObject>::const_iterator it = registeredObjects.begin(); it != registeredObjects.end(); it++ )
     389   {
     390     if( (*it).type == type)
     391     {
    380392       return true;
    381393     }
    382394   }
    383395   return false;
    384  
    385  }
    386 
    387  bool Script::classIsRegistered(const std::string& type)
     396 }
     397
     398
     399
     400 bool Script::objectIsAdded(const std::string& name)
    388401 {
    389402   for(std::list<WorldObject>::const_iterator it = registeredObjects.begin(); it != registeredObjects.end(); it++ )
    390403   {
    391      if( (*it).type == type)
     404     if( (*it).name == name)
    392405     {
    393406       return true;
     
    395408   }
    396409   return false;
    397  }
    398 
    399 
    400 
    401  bool Script::objectIsAdded(const std::string& name)
    402  {
    403    for(std::list<WorldObject>::const_iterator it = registeredObjects.begin(); it != registeredObjects.end(); it++ )
    404    {
    405      if( (*it).name == name)
    406      {
    407        return true;
    408      }
    409    }
    410    return false;
    411 
    412 
    413  }
     410
     411
     412 }
  • trunk/src/lib/script_engine/script.h

    r9061 r9235  
    3232    bool loadFile(const std::string& filename);
    3333    void addObject( const std::string& className,const std::string& objectName);
     34    void registerClass(const std::string& className);                           //!< Register a class but dont add any instances
    3435
    3536    /// QUERRYING
     
    6465    int  reportError(int error);                      //!< Get errormessage from the lua stack and print it.
    6566    bool registerStandartClasses();                   //!< Register all the classes that the script might need
    66     bool registerClass(const std::string& className); //!< Register a class but dont add any instances
    6767    bool classIsRegistered(const std::string& type);  //!< Checks wheter the class "type" has already been registered with the script
    6868    bool objectIsAdded(const std::string& name);      //!< Checks wheter the object "name" has already been added to the script
  • trunk/src/lib/sound/sound_engine.cc

    r8350 r9235  
    352352    if ((errorCode = alGetError()) != AL_NO_ERROR)
    353353    {
    354       PRINTF(1)("Error %s (line:%d): '%s'\n", error.c_str(), line, SoundEngine::getALErrorString(errorCode));
     354      //PRINTF(1)("Error %s (line:%d): '%s'\n", error.c_str(), line, SoundEngine::getALErrorString(errorCode));
    355355      return false;
    356356    }
  • trunk/src/orxonox.cc

    r8750 r9235  
    145145  SDL_QuitSubSystem(SDL_INIT_TIMER);
    146146  ClassList::debug();
     147 
     148  Preferences::getInstance()->save();
    147149
    148150  PRINT(3)
  • trunk/src/story_entities/game_world.cc

    r9110 r9235  
    6262#include "game_rules.h"
    6363
    64 using namespace std;
    65 
    6664#include "script_class.h"
    6765CREATE_SCRIPTABLE_CLASS(GameWorld, CL_GAME_WORLD,
    6866                        addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode))
     67                        ->addMethod("setSoundtrack", ExecutorLua1<GameWorld, const std::string&>(&GameWorld::setSoundtrack))
    6968                       );
    7069
     
    158157
    159158  PRINTF(3)("> Loading world: '%s'\n", getLoadFile().c_str());
    160 //  TiXmlElement* element;
    161 //  GameLoader* loader = GameLoader::getInstance();
     159  //  TiXmlElement* element;
     160  //  GameLoader* loader = GameLoader::getInstance();
    162161
    163162  if( getLoadFile().empty())
     
    233232
    234233
     234void GameWorld::setSoundtrack(const std::string& soundTrack)
     235{
     236  if (this->dataTank != NULL)
     237  {
     238    this->dataTank->setSoundTrack(soundTrack);
     239    this->dataTank->music->play();
     240  }
     241}
     242
     243
    235244/**
    236245 *  starts the GameWorld
     
    312321    /* update the state */
    313322    //this->update (); /// LESS REDUNDANCY.
    314 //      PNode::getNullParent()->updateNode(this->dtS);
     323    //      PNode::getNullParent()->updateNode(this->dtS);
    315324    PNode::getNullParent()->updateNode(this->dtS);
    316325
     
    459468  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
    460469      this->dataTank->objectManager->getObjectList(OM_GROUP_00_PROJ));
    461   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
    462       this->dataTank->objectManager->getObjectList(OM_GROUP_01));
     470  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
     471    this->dataTank->objectManager->getObjectList(OM_GROUP_00));
     472
     473  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
     474  this->dataTank->objectManager->getObjectList(OM_GROUP_02));
     475  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_02),
     476  this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
     477
    463478
    464479  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
     
    536551void GameWorld::renderPassReflection()
    537552{
    538     // clear buffer
     553  // clear buffer
    539554  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    540 //  glLoadIdentity();
     555  //  glLoadIdentity();
    541556
    542557  const std::list<BaseObject*>* reflectedWaters;
     
    562577      // draw everything to be included in the reflection
    563578      this->drawEntityList(State::getObjectManager()->getReflectionList());
    564 //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    565 //         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     579      //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
     580      //         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    566581
    567582      // clean up from reflection rendering
     
    578593void GameWorld::renderPassRefraction()
    579594{
    580     // clear buffer
     595  // clear buffer
    581596  glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
    582597  //glLoadIdentity();
     
    602617      // draw everything to be included in the reflection
    603618      this->drawEntityList(State::getObjectManager()->getReflectionList());
    604 //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
    605 //         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
     619      //       for (unsigned int i = 0; i < this->dataTank->drawLists.size(); ++i)
     620      //         this->drawEntityList(State::getObjectManager()->getObjectList(this->dataTank->drawLists[i]));
    606621
    607622      // clean up from reflection rendering
  • trunk/src/story_entities/game_world.h

    r8740 r9235  
    3131class GameWorld : public StoryEntity
    3232{
    33   public:
    34     GameWorld ();
    35     virtual ~GameWorld ();
     33public:
     34  GameWorld ();
     35  virtual ~GameWorld ();
    3636
    37     virtual void loadParams(const TiXmlElement* root);
     37  virtual void loadParams(const TiXmlElement* root);
    3838
    39     /* functions from story-entity */
    40     virtual ErrorMessage init();
    41     virtual ErrorMessage loadData();
    42     virtual ErrorMessage unloadData();
     39  /* functions from story-entity */
     40  virtual ErrorMessage init();
     41  virtual ErrorMessage loadData();
     42  virtual ErrorMessage unloadData();
    4343
    44     virtual bool start();
    45     virtual bool stop();
    46     virtual bool pause();
    47     virtual bool resume();
    48     virtual void run();
     44  virtual bool start();
     45  virtual bool stop();
     46  virtual bool pause();
     47  virtual bool resume();
     48  virtual void run();
    4949
    50     void setPlaymode(Playable::Playmode playmode);
    51     void setPlaymode(const std::string& playmode);
    52     /**  this returns the current game time @returns elapsed game time     */
    53     inline double getGameTime() { return this->gameTime; }
    54     /** sets the game speed @param speed speed of the Game */
    55     inline void setSpeed(float speed) { this->speed = speed; };
    56     /**  returns the track path of this world @returns the track path */
    57 
    58     void togglePNodeVisibility();
    59     void toggleBVVisibility(int level);
    60 
    61     inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
     50  void setPlaymode(Playable::Playmode playmode);
     51  void setPlaymode(const std::string& playmode);
     52  /**  this returns the current game time @returns elapsed game time     */
     53  inline double getGameTime() { return this->gameTime; }
     54  /** sets the game speed @param speed speed of the Game */
     55  inline void setSpeed(float speed) { this->speed = speed; };
     56  /**  returns the track path of this world @returns the track path */
    6257
    6358
    64   protected:
    65     /* world - running functions */
    66     virtual void synchronize();
    67     virtual void handleInput();
    68     virtual void tick(ObjectManager::EntityList worldEntity, float dt);
    69     virtual void tick();
    70     virtual void update();
    71     virtual void checkGameRules();
    72     virtual void collisionDetection();
    73     virtual void collisionReaction();
     59  void setSoundtrack(const std::string& soundTrack);
     60  void togglePNodeVisibility();
     61  void toggleBVVisibility(int level);
    7462
    75     void applyCameraSettings();
    76     void drawEntityList(const ObjectManager::EntityList& drawList ) const;
    77     virtual void renderPassReflection();
    78     virtual void renderPassRefraction();
    79     virtual void renderPassAll();
     63  inline void setSky(WorldEntity* sky) { this->dataTank->sky = sky; }
    8064
    8165
    82     virtual void display();
     66protected:
     67  /* world - running functions */
     68  virtual void synchronize();
     69  virtual void handleInput();
     70  virtual void tick(ObjectManager::EntityList worldEntity, float dt);
     71  virtual void tick();
     72  virtual void update();
     73  virtual void checkGameRules();
     74  virtual void collisionDetection();
     75  virtual void collisionReaction();
     76
     77  void applyCameraSettings();
     78  void drawEntityList(const ObjectManager::EntityList& drawList ) const;
     79  virtual void renderPassReflection();
     80  virtual void renderPassRefraction();
     81  virtual void renderPassAll();
    8382
    8483
    85   private:
    86     void displayLoadScreen();
    87     void releaseLoadScreen();
     84  virtual void display();
    8885
    8986
    90   protected:
    91     GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
    92     TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
     87private:
     88  void displayLoadScreen();
     89  void releaseLoadScreen();
    9390
    94     bool                showPNodes;                   //!< if the PNodes should be visible.
    95     bool                showBV;                       //!< if the Bounding Volumes should be visible.
    96     int                 showBVLevel;                  //!< the depth level of the displayed bounding volumes
    9791
    98     /* world timing */
    99     double              lastFrame;                    //!< last time of frame (in MiliSeconds)
    100     Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
    101     float               dtS;                          //!< The time needed for caluculations in seconds
    102     float               speed;                        //!< how fast the game flows
    103     double              gameTime;                     //!< this is where the game time is saved
    104     double              frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.
     92protected:
     93  GameWorldData*      dataTank;                     //!< reference to the GameWorld Data Tank
     94  TiXmlElement*       dataXML;                      //!< The XML-Element this World has been loaded with.
    10595
    106     GameRules*          gameRules;                    //!< Pointer to the data structure containig the game rules
     96  bool                showPNodes;                   //!< if the PNodes should be visible.
     97  bool                showBV;                       //!< if the Bounding Volumes should be visible.
     98  int                 showBVLevel;                  //!< the depth level of the displayed bounding volumes
    10799
    108   private:
    109     /* external modules interfaces */
    110     ScriptManager       scriptManager;
    111     OrxShell::Shell*    shell;
     100  /* world timing */
     101  double              lastFrame;                    //!< last time of frame (in MiliSeconds)
     102  Uint32              cycle;                        //!< The cycle we are in (starts with 0 and rises with every frame)
     103  float               dtS;                          //!< The time needed for caluculations in seconds
     104  float               speed;                        //!< how fast the game flows
     105  double              gameTime;                     //!< this is where the game time is saved
     106  double              frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.
     107
     108  GameRules*          gameRules;                    //!< Pointer to the data structure containig the game rules
     109
     110private:
     111  /* external modules interfaces */
     112  ScriptManager       scriptManager;
     113  OrxShell::Shell*    shell;
    112114};
    113115
  • trunk/src/story_entities/game_world_data.cc

    r9019 r9235  
    249249  this->tickLists.push_back(OM_GROUP_01);
    250250  this->tickLists.push_back(OM_GROUP_01_PROJ);
     251  this->tickLists.push_back(OM_GROUP_02);
    251252
    252253  this->drawLists.push_back(OM_ENVIRON_NOTICK);
    253254  this->drawLists.push_back(OM_ENVIRON);
    254   this->drawLists.push_back(OM_COMMON);
    255255  this->drawLists.push_back(OM_GROUP_00);
    256256  this->drawLists.push_back(OM_GROUP_00_PROJ);
    257257  this->drawLists.push_back(OM_GROUP_01);
    258258  this->drawLists.push_back(OM_GROUP_01_PROJ);
     259  this->drawLists.push_back(OM_GROUP_02);
     260  this->drawLists.push_back(OM_COMMON);
    259261
    260262  /* init the pnode tree */
     
    343345  LoadParamXML(root, "GameRule", this, GameWorldData, loadGameRule);
    344346
     347  LoadParam(root, "clip-region", this->localCamera, Camera, setClipRegion);
     348
    345349
    346350  //LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams);
    347351  //LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams);
    348352
    349   this->localCamera->setClipRegion(1, 10000.0);
    350353  if( this->sky != NULL)
    351354    this->localCamera->addChild(this->sky);
  • trunk/src/story_entities/menu/game_menu.cc

    r9110 r9235  
    4040
    4141#include "network_manager.h"
     42
     43#include "preferences.h"
    4244
    4345//! This creates a Factory to fabricate a GameMenu
     
    126128  this->levelsBox = NULL;
    127129  this->networkBox = NULL;
    128  
     130
    129131  this->clientNetworkBox = NULL;
    130132  this->serverNetworkBox = NULL;
     
    239241    {
    240242      OrxGui::GLGuiBox * box = new OrxGui::GLGuiBox();
    241      
     243
    242244      OrxGui::GLGuiButton* clientButton = new OrxGui::GLGuiPushButton("Client");
    243245      box->pack(clientButton);
     
    247249      box->pack(serverButton);
    248250      serverButton->connect(SIGNAL(serverButton, released), this, SLOT(GameMenu, showServerMenu));
    249      
     251
    250252      networkBox->pack( box );
    251253    }
     
    340342  OrxGui::GLGuiHandler::getInstance()->activateCursor();
    341343  OrxGui::GLGuiHandler::getInstance()->activate();
    342   OrxGui::GLGuiHandler::getInstance()->cursor()->loadTextureSequence(ResourceManager::getInstance()->getDataDir() + "/" + "maps/reap_mouse/reap_mouse_##.png", 1, 49);
    343344
    344345  /* now call the underlying*/
     
    518519    //this->serverNetworkBox = NULL;
    519520  }
    520  
     521
    521522  if ( !this->clientNetworkBox )
    522523  {
     
    526527      text->setText( "Host:" );
    527528      this->clientNetworkBox->pack( text );
    528      
     529
    529530      this->ipInputLine = new OrxGui::GLGuiInputLine( );
    530       this->ipInputLine->setText( "tardis-d08" );
     531      this->ipInputLine->setText( Preferences::getInstance()->getString( "multiplayer", "lastVisitedServer", "localhost" ) );
    531532      this->clientNetworkBox->pack( this->ipInputLine );
    532533      this->ipInputLine->connect(SIGNAL(ipInputLine, enterPushed), this, SLOT(GameMenu, connectToServer));
    533534      this->ipInputLine->select();
    534      
     535
    535536      OrxGui::GLGuiButton* connectButton = new OrxGui::GLGuiPushButton("Connect");
    536537      clientNetworkBox->pack(connectButton);
     
    538539    }
    539540  }
    540  
     541
    541542  this->networkBox->pack( this->clientNetworkBox );
    542  
     543
    543544  this->clientNetworkBox->showAll();
    544  
     545
    545546  //this->clientNetworkBox->setAbsCoor2D( 300.0f, 100.0f );
    546547}
     
    558559    //this->clientNetworkBox = NULL;
    559560  }
    560  
     561
    561562  if ( !this->serverNetworkBox )
    562563  {
     
    566567      text->setText( "Map:" );
    567568      this->serverNetworkBox->pack( text );
    568      
     569
    569570      OrxGui::GLGuiText * text2 = new OrxGui::GLGuiText();
    570571      text2->setText( "Multiplayer TeamDeathMatch Arena" );
    571572      this->serverNetworkBox->pack( text2 );
    572      
     573
    573574      OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server");
    574575      serverNetworkBox->pack(createButton);
     
    576577    }
    577578  }
    578  
     579
    579580  this->networkBox->pack( this->serverNetworkBox );
    580  
     581
    581582  this->serverNetworkBox->showAll();
    582  
     583
    583584  //this->serverNetworkBox->setAbsCoor2D( 300.0f, 100.0f );
    584585}
     
    590591{
    591592  PRINTF(0)("Connecting to %s\n", this->ipInputLine->_getText().c_str() );
    592  
     593
    593594  State::setOnline(true);
    594595  NetworkManager::getInstance()->establishConnection( this->ipInputLine->_getText(), 9999 );
    595  
     596
     597  Preferences::getInstance()->setString( "multiplayer", "lastVisitedServer", this->ipInputLine->_getText() );
     598
    596599  this->startLevel( 5 );
    597600}
     
    600603{
    601604  PRINTF(0)("Create server\n" );
    602  
     605
    603606  State::setOnline(true);
    604607  NetworkManager::getInstance()->createServer( 9999 );
    605  
     608
    606609  this->startLevel( 5 );
    607610}
  • trunk/src/story_entities/multi_player_world.cc

    r9110 r9235  
    9797  //CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), this->dataTank->objectManager->getObjectList(OM_PLAYERS));
    9898
    99   PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_PLAYERS_PROJ\n\n");
    100   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS_PROJ),
    101   this->dataTank->objectManager->getObjectList(OM_PLAYERS));
    10299  PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_GROUP_01_PROJ\n\n");
    103100  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS),
     
    106103  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS),
    107104    this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ));
     105  PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_PLAYERS_PROJ\n\n");
    108106  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS),
    109     this->dataTank->objectManager->getObjectList(OM_GROUP_00));
    110   CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS),
    111     this->dataTank->objectManager->getObjectList(OM_GROUP_01));
     107    this->dataTank->objectManager->getObjectList(OM_PLAYERS_PROJ));
     108
     109  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00),
     110  this->dataTank->objectManager->getObjectList(OM_PLAYERS));
     111  CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01),
     112  this->dataTank->objectManager->getObjectList(OM_PLAYERS));
    112113
    113114
  • trunk/src/story_entities/multi_player_world_data.cc

    r9008 r9235  
    109109ErrorMessage MultiPlayerWorldData::loadWorldEntities(const TiXmlElement* root)
    110110{
    111   /* load the spawning points */
    112   const TiXmlElement* element = root->FirstChildElement("SpawningPoints");
    113   if( element == NULL)
    114   {
    115     PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n");
    116   }
    117   else
    118   {
    119     element = element->FirstChildElement();
    120     // load Players/Objects/Whatever
    121     PRINTF(4)("Loading Spawning Points\n");
    122     while( element != NULL)
    123     {
    124       BaseObject* created = Factory::fabricate(element);
    125       if( created != NULL )
    126         printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());
    127 
    128       element = element->NextSiblingElement();
    129       glmis->step();
    130     }
    131     PRINTF(4)("Done loading Spawning Points\n");
     111  const TiXmlElement* element = NULL;
     112 
     113  if( NetworkManager::getInstance()->isGameServer() )
     114  {
     115    /* load the spawning points */
     116    element = root->FirstChildElement("SpawningPoints");
     117    if( element == NULL)
     118    {
     119      PRINTF(1)("NetworkWorld is missing 'SpawningPoints'\n");
     120    }
     121    else
     122    {
     123      element = element->FirstChildElement();
     124      // load Players/Objects/Whatever
     125      PRINTF(4)("Loading Spawning Points\n");
     126      while( element != NULL)
     127      {
     128        BaseObject* created = Factory::fabricate(element);
     129        if( created != NULL )
     130          printf("Created a Spawning Point %s: %s\n", created->getClassName(), created->getName());
     131
     132        element = element->NextSiblingElement();
     133        glmis->step();
     134      }
     135      PRINTF(4)("Done loading Spawning Points\n");
     136    }
    132137  }
    133138
  • trunk/src/util/hud.cc

    r9014 r9235  
    187187    this->_radar->setCenterNode(State::getPlayer()->getPlayable());
    188188    this->_radar->addEntityList(&State::getObjectManager()->getObjectList((OM_LIST)(State::getPlayer()->getPlayable()->getOMListNumber()+1)), Color(.4, .4, 1.0));
     189    this->_radar->addEntityList(&State::getObjectManager()->getObjectList(OM_GROUP_02), Color(1.0, .2, .2));
    189190    this->_radar->setAbsCoor2D(0.8 * this->resX, 0.01 * this->resY);
    190191    this->_radar->setWidgetSize(0.2 * this->resX, 0.2 * this->resY);
  • trunk/src/util/multiplayer_team_deathmatch.cc

    r9110 r9235  
    210210  while ( this->killList.begin() != this->killList.end() )
    211211  {
     212    PRINTF(0)("KKKKKKKKIIIIIIIIILLLLLLLLLLLLL\n");
    212213    onKill( this->killList.begin()->getVictim(), this->killList.begin()->getKiller() );
    213214    this->killList.erase( this->killList.begin() );
     
    305306    return "models/creatures/doom_guy.md2";
    306307  else if ( team == 1 )
    307     return "models/creatures/doom_guy.md2";
     308    return "models/creatures/male.md2";
    308309  else
    309310    return "";
    310311}
    311312
     313std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, ClassID classId )
     314{
     315  if ( classId == CL_FPS_PLAYER )
     316  {
     317    if ( team == 0 )
     318      return "maps/doom_guy.png";
     319    else
     320      return "maps/male_fiend.pcx";
     321  }
     322 
     323  return "";
     324}
     325
     326float MultiplayerTeamDeathmatch::getPlayableScale( int userId, int team, ClassID classId )
     327{
     328  if ( classId == CL_FPS_PLAYER )
     329  {
     330    return 10.0f;
     331  }
     332 
     333  return 1.0f;
     334}
     335
    312336/**
    313337 * calculate team score
     
    399423  if ( currentGameState == GAMESTATE_POST_GAME )
    400424  {
    401     State::getCurrentStoryEntity()->stop();
     425    //State::getCurrentStoryEntity()->stop();
    402426    this->bShowTeamChange = false;
    403427
     
    456480  std::string playableModel = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId );
    457481  std::string playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId );
     482  float       playableScale = getPlayableScale( userId, stats.getPreferedTeamId(), playableClassId );
    458483
    459484  BaseObject * bo = Factory::fabricate( playableClassId );
     
    464489  Playable & playable = *(dynamic_cast<Playable*>(bo));
    465490
    466   if ( playableTexture != "" )
    467     playable.loadMD2Texture( playableTexture );
    468   if ( playableModel != "" )
    469     playable.loadModel( playableModel );
     491  playable.loadMD2Texture( playableTexture );
     492  playable.loadModel( playableModel, playableScale );
    470493  playable.setOwner( userId );
    471494  playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() );
     
    687710{
    688711  if ( !victim )
    689     return;
     712  {
     713    PRINTF(0)("victim == NULL\n");
     714    return;
     715  }
    690716  if ( !killer )
    691     return;
     717  {
     718    PRINTF(0)("killer == NULL\n");
     719    return;
     720  }
    692721 
    693722  int killerUserId = killer->getOwner();
    694723  int victimUserId = victim->getOwner();
     724 
     725  PRINTF(0)("%d %d %x %x %s %s\n", killerUserId, victimUserId, killer, victim, killer->getClassName(), victim->getClassName());
    695726
    696727  PlayerStats & victimStats = *PlayerStats::getStats( victimUserId );
     
    698729 
    699730  if ( killerStats.getPlayable() != killer || victimStats.getPlayable() != victim )
    700     return;
     731  {
     732    PRINTF(0)("killerStats.getPlayable() != killer || victimStats.getPlayable() != victim\n");
     733    PRINTF(0)("%x %x %x %x\n", killerStats.getPlayable(), killer, victimStats.getPlayable(), victim );
     734    PRINTF(0)("%d %d %d %d\n", killerStats.getPlayable()->getUniqueID(), killer->getUniqueID(), victimStats.getPlayable()->getUniqueID(), victim->getUniqueID() );
     735    return;
     736  }
    701737
    702738  //check for suicide
     
    782818}
    783819
    784 std::string MultiplayerTeamDeathmatch::getPlayableModelTextureFileName( int userId, int team, ClassID classId )
    785 {
    786   if ( classId == CL_FPS_PLAYER )
    787   {
    788     return "maps/doom_guy.png";
    789   }
    790  
    791   return "";
    792 }
    793 
     820
  • trunk/src/util/multiplayer_team_deathmatch.h

    r9110 r9235  
    4141    virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId );
    4242    virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
     43    virtual float getPlayableScale( int userId, int team, ClassID classId );
    4344
    4445    virtual void registerSpawn( WorldEntity * we );
  • trunk/src/util/network_game_rules.cc

    r9110 r9235  
    6868
    6969
     70float NetworkGameRules::getPlayableScale( int userId, int team, ClassID classId )
     71{
     72  return 1.0f;
     73}
  • trunk/src/util/network_game_rules.h

    r9110 r9235  
    2424    virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId );
    2525    virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId );
     26    virtual float getPlayableScale( int userId, int team, ClassID classId );
    2627   
    2728    virtual PlayerStats * getNewPlayerStats( int userId ){ return new PlayerStats( userId ); }
  • 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.