Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


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

merged the presentation back

Location:
trunk/src/lib
Files:
31 edited
2 copied

Legend:

Unmodified
Added
Removed
  • 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    }
Note: See TracChangeset for help on using the changeset viewer.