Changeset 9235 in orxonox.OLD for trunk/src/lib
- Timestamp:
- Jul 5, 2006, 4:39:02 PM (18 years ago)
- Location:
- trunk/src/lib
- Files:
-
- 31 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/collision_detection/obb_tree.cc
r8316 r9235 41 41 42 42 43 /** 44 * standard constructor 45 */ 46 OBBTree::OBBTree() 47 : BVTree() 48 {} 49 43 50 44 51 void OBBTree::init() … … 78 85 79 86 this->rootNode->spawnBVTree(modelInf, triangleIndexes, modelInf.numTriangles); 87 } 88 89 90 void OBBTree::createBox(Vector start, Vector end) 91 { 92 this->rootNode = new OBBTreeNode(*this, NULL, 1); 93 94 this->rootNode->createBox(start, end); 80 95 } 81 96 -
trunk/src/lib/collision_detection/obb_tree.h
r7711 r9235 23 23 public: 24 24 OBBTree(int depth, const modelInfo* modInfo, WorldEntity* entity); 25 OBBTree(); 25 26 virtual ~OBBTree(); 26 27 void init(); … … 28 29 virtual void spawnBVTree(const modelInfo& modelInf); 29 30 virtual void flushTree(); 31 32 void createBox(Vector start, Vector end); 30 33 31 34 virtual void collideWith(WorldEntity* entity1, WorldEntity* entity2); -
trunk/src/lib/collision_detection/obb_tree_node.cc
r9008 r9235 90 90 delete this->bvElement; 91 91 } 92 93 94 95 void 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 92 113 93 114 … … 561 582 bool OBBTreeNode::overlapTest(OBB* boxA, OBB* boxB, WorldEntity* nodeA, WorldEntity* nodeB) 562 583 { 584 563 585 //HACK remove this again 564 586 this->owner = nodeA; … … 677 699 void OBBTreeNode::drawBV(int depth, int drawMode, const Vector& color, bool top) const 678 700 { 701 679 702 /* this function can be used to draw the triangles and/or the points only */ 680 703 if( 1 /*drawMode & DRAW_MODEL || drawMode & DRAW_ALL*/) … … 682 705 if( depth == 0/*!(drawMode & DRAW_SINGLE && depth != 0)*/) 683 706 { 684 if( 1/*drawMode & DRAW_POINTS*/)707 if( 0 /*drawMode & DRAW_POINTS*/) 685 708 { 686 709 glBegin(GL_POINTS); -
trunk/src/lib/collision_detection/obb_tree_node.h
r7732 r9235 31 31 32 32 virtual void spawnBVTree(const modelInfo& modelInf, const int* triangleIndexes, int length); 33 void createBox(Vector start, Vector end); 33 34 34 35 virtual void collideWith(BVTreeNode* treeNode, WorldEntity* nodeA, WorldEntity* nodeB); … … 79 80 80 81 WorldEntity* owner; 82 81 83 }; 82 84 -
trunk/src/lib/collision_reaction/Makefile.am
r8490 r9235 10 10 collision_reaction.cc \ 11 11 cr_object_damage.cc \ 12 cr_physics_ground_walk.cc 12 cr_physics_ground_walk.cc \ 13 cr_physics_full_walk.cc 13 14 14 15 … … 21 22 collision_reaction.h \ 22 23 cr_object_damage.h \ 23 cr_physics_ground_walk.h 24 cr_physics_ground_walk.h \ 25 cr_physics_full_walk.h 24 26 -
trunk/src/lib/collision_reaction/collision_handle.cc
r8724 r9235 25 25 #include "cr_object_damage.h" 26 26 #include "cr_physics_ground_walk.h" 27 #include "cr_physics_full_walk.h" 27 28 28 29 #include "debug.h" … … 52 53 switch( type) 53 54 { 54 case CREngine::CR_PHYSICS_ STEP_BACK:55 // this->collisionReaction = new CRPhysicsGroundWalk();55 case CREngine::CR_PHYSICS_FULL_WALK: 56 this->collisionReaction = new CRPhysicsFullWalk(); 56 57 this->bContinuousPoll = true; 57 58 break; … … 229 230 for(; it < this->targetList.end(); it++) 230 231 { 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 231 254 if( collisionEvent->getEntityA() == this->owner) { 232 255 if( collisionEvent->getEntityB()->isA((ClassID)(*it))) { … … 256 279 for(; it < this->targetList.end(); it++) 257 280 { 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 258 303 if( collision->getEntityA() == this->owner) { 259 304 if( collision->getEntityA()->isA((ClassID)(*it))) -
trunk/src/lib/collision_reaction/cr_engine.h
r8190 r9235 30 30 CR_PHYSICS_MOMENTUM = 0, //!< physical reaction: conservervation of momentum 31 31 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 force33 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) 34 34 CR_PHYSICS_DAMAGE, //!< physical reaction: daling damage according to the object energy and their structural stability 35 35 -
trunk/src/lib/collision_reaction/cr_object_damage.cc
r9061 r9235 56 56 float damage = 0.0f; 57 57 58 PRINTF( 0)("Dealing damage - Handling collision: %s vs %s\n",58 PRINTF(4)("Dealing damage - Handling collision: %s vs %s\n", 59 59 collision->getEntityA()->getClassName(), 60 60 collision->getEntityB()->getClassName()); -
trunk/src/lib/collision_reaction/cr_physics_ground_walk.cc
r9110 r9235 71 71 72 72 float CR_MAX_WALK_HEIGHT = 15.0f; 73 float CR_THRESHOLD = 0.2f;74 73 75 74 float height = 0.0f; 76 float front = 0.0f;77 float back = 0.0f;78 float right = 0.0f;79 float left = 0.0f;80 75 81 76 … … 94 89 switch( ce->getType()) 95 90 { 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 wall113 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 wall133 entity->setAbsCoor(entity->getLastAbsCoor());134 }135 break;136 137 138 91 /* collision in the Y-AXIS */ 139 92 case COLLISION_TYPE_AXIS_Y_NEG: … … 153 106 { 154 107 entity->setAbsCoor(entity->getLastAbsCoor()); 155 PRINTF(0)("ground collision: reset pos\n");156 108 } 157 109 else … … 163 115 164 116 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 wall182 entity->setAbsCoor(entity->getLastAbsCoor());183 }184 break;185 186 187 // collision in the z-axis188 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 wall202 else if( ce->isInWall())203 {204 entity->setAbsCoor(entity->getLastAbsCoor());205 }206 break;207 117 } 208 118 } 209 119 //PRINTF(0)("collision distances: x: %f, y: %f, z: %f\n", front, height, side); 210 211 212 213 214 215 216 120 217 121 } -
trunk/src/lib/coord/p_node.cc
r8316 r9235 1089 1089 void PNode::varChangeHandler( std::list< int > & id ) 1090 1090 { 1091 Synchronizeable::varChangeHandler( id ); 1092 1091 1093 if ( std::find( id.begin(), id.end(), relCoordinate_handle ) != id.end() ) 1092 1094 { -
trunk/src/lib/graphics/effects/cloud_effect.cc
r9112 r9235 90 90 this->planetRadius = 1500; 91 91 this->divs = 15; 92 this->cloudActivate = false; 92 93 fadeSky = false; 93 94 fadeCloud = false; -
trunk/src/lib/graphics/effects/fog_effect.cc
r9112 r9235 20 20 #include "shell_command.h" 21 21 #include "script_class.h" 22 #include "cloud_effect.h" 22 23 23 24 // 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); 26 27 SHELL_COMMAND(fadein, FogEffect, fadeInFog); 27 28 SHELL_COMMAND(fadeout, FogEffect, fadeOutFog); … … 84 85 this->fogFadeInActivate = false; 85 86 this->fogFadeOutActivate = false; 87 88 this->cloudColor = Vector(0.2f, 0.3f, 0.3f); 89 this->skyColor = Vector(0.2f, 0.3f, 0.3f); 86 90 } 87 91 … … 93 97 WeatherEffect::loadParams(root); 94 98 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 102 108 LOAD_PARAM_START_CYCLE(root, element); 103 109 { 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"); 105 111 } 106 112 LOAD_PARAM_END_CYCLE(element); … … 125 131 126 132 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); 127 141 } 128 142 … … 184 198 185 199 if ( this->fogMode == GL_LINEAR) 186 this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFade InDuration ) + this->fogEnd;200 this->fogFadeEnd = 2000 * ( this->localTimer / this->fogFadeOutDuration ) + this->fogEnd; 187 201 else 188 this->fogFadeDensity = 1 - (( this->localTimer / this->fogFade InDuration ) * this->fogDensity);202 this->fogFadeDensity = 1 - (( this->localTimer / this->fogFadeOutDuration ) * this->fogDensity); 189 203 190 204 if ( this->localTimer >= this->fogFadeOutDuration ) … … 207 221 // If no manual FadeIn value was set, set a default value 208 222 if (!this->fogFadeInDuration > 0) 209 this->fogFadeInDuration = 20;223 this->fogFadeInDuration = 10; 210 224 211 225 // Reset local timer … … 227 241 this->fogFadeInActivate = false; 228 242 243 229 244 // If Fog is off, turn it on first 230 245 if (!this->fogActivate) … … 233 248 // If no manual FadeOut value was set, set a default value 234 249 if (!this->fogFadeOutDuration > 0) 235 this->fogFadeOutDuration = 20;250 this->fogFadeOutDuration = 10; 236 251 237 252 // set FogFadeOut activate … … 240 255 // Reset local timer 241 256 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 10 10 #include "glincl.h" 11 11 #include "vector.h" 12 13 class CloudEffect; 12 14 13 15 class FogEffect : public WeatherEffect … … 73 75 this->fogActivate = true; 74 76 } 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 } 75 86 76 87 void fadeInFog(); … … 109 120 Vector colorVector; 110 121 float localTimer; 122 123 Vector oldSkyColor; 124 Vector oldCloudColor; 125 Vector skyColor; 126 Vector cloudColor; 111 127 }; 112 128 -
trunk/src/lib/graphics/effects/lightning_effect.cc
r9112 r9235 112 112 } 113 113 114 //should load both texture 114 115 this->thunderTextureA = true; 115 116 this->setTexture(); 117 this->switchTexture(); 116 118 117 119 if (this->lightningMove) { -
trunk/src/lib/graphics/effects/rain_effect.cc
r9112 r9235 34 34 35 35 // 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); 38 38 SHELL_COMMAND(startraining, RainEffect, startRaining); 39 39 SHELL_COMMAND(stopraining, RainEffect, stopRaining); … … 96 96 */ 97 97 void RainEffect::init() { 98 99 this->rainParticles = NULL; 100 this->emitter = NULL; 101 this->rainBuffer = NULL; 102 this->windBuffer = NULL; 103 this->lightMan = NULL; 104 98 105 //Default values 99 106 this->rainActivate = false; … … 119 126 this->emitter = new PlaneEmitter(this->rainSize); 120 127 128 lightMan = LightManager::getInstance(); 121 129 } 122 130 … … 187 195 // If we're not fading, change color immediately 188 196 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); 192 202 } 193 203 … … 202 212 this->rainFadeOutActivate = false; 203 213 204 this->emitter->setSystem(NULL); 214 //if(this->emitter) 215 // this->emitter->setSystem(NULL); 216 //this->hideRain(); 205 217 206 218 // Stop Sound … … 208 220 209 221 // 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); 212 224 } 213 225 … … 242 254 243 255 // increase sound volume 244 if (!this->soundSource.isPlaying()) 256 if (progress > 0.5) { 257 if (!this->soundSource.isPlaying()) 245 258 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 } 247 261 248 262 if (progress >= 1) 249 263 this->rainFadeInActivate = false; 264 265 lightMan->setAmbientColor(1-progress, 1-progress, 1-progress); 250 266 } 251 267 … … 276 292 this->deactivate(); 277 293 } 294 lightMan->setAmbientColor(1-progress, 1-progress, 1-progress); 278 295 } 279 296 } -
trunk/src/lib/graphics/effects/rain_effect.h
r9006 r9235 132 132 float soundRainVolume; 133 133 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; 138 140 139 141 }; -
trunk/src/lib/graphics/effects/snow_effect.cc
r9112 r9235 28 28 #include "shell_command.h" 29 29 #include "script_class.h" 30 #include "cloud_effect.h" 30 31 31 32 #include "parser/tinyxml/tinyxml.h" … … 53 54 54 55 //load wind sound 55 if (this->snowWindForce > 1) {56 if (this->snowWindForce >= 1) { 56 57 if (this->windBuffer != NULL) 57 58 ResourceManager::getInstance()->unload(this->windBuffer); 58 59 this->windBuffer = (OrxSound::SoundBuffer*)ResourceManager::getInstance()->load("sound/atmosphere/wind.wav", WAV); 59 60 } 60 61 … … 87 88 LoadParam(root, "size", this, SnowEffect, size); 88 89 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); 89 93 90 94 LOAD_PARAM_START_CYCLE(root, element); … … 119 123 this->snowCoord = Vector(100,450,400); 120 124 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); 121 129 } 122 130 … … 149 157 if (this->snowWindForce != 0) 150 158 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); 151 167 152 168 } … … 162 178 if (this->windBuffer != NULL) 163 179 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); 164 184 } 165 185 -
trunk/src/lib/graphics/effects/snow_effect.h
r8495 r9235 16 16 class PlaneEmitter; 17 17 class PNode; 18 class CloudEffect; 18 19 19 20 #include "sound_source.h" … … 77 78 this->snowWindForce = force; 78 79 } 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 } 79 92 80 93 inline void setSnowOption(const std::string& option) { … … 97 110 float angle, randomAngle; 98 111 float alpha; 112 float fadeTime; 99 113 Vector snowCoord; 100 114 Vector2D snowSize; … … 110 124 OrxSound::SoundBuffer* windBuffer; 111 125 126 Vector oldSkyColor; 127 Vector oldCloudColor; 128 Vector skyColor; 129 Vector cloudColor; 112 130 }; 113 131 -
trunk/src/lib/graphics/importer/bsp_manager.cc
r9110 r9235 53 53 { 54 54 55 this->lastTex = -1; 55 56 this->parent = parent; 56 57 /*// open a BSP file … … 101 102 return 0; 102 103 } 104 105 103 106 /* 104 107 BspManager::BspManager(const char* fileName, float scale) … … 270 273 const float dMaxs = dir.x*(float)curLeaf.maxs[0] +dir.y*(float)curLeaf.maxs[1] +dir.z*(float)curLeaf.maxs[2] - dist; 271 274 272 if(dMins < - 50.0 && dMaxs < - 50.0) {275 if(dMins < -70.0 && dMaxs < -70.0) { 273 276 continue; 274 277 } … … 1371 1374 else 1372 1375 { 1373 if( this->outputFraction == 1.0f) 1376 if( this->outputFraction == 1.0f) // No collision Detected 1374 1377 { 1375 if( this->outputAllSolid ) 1378 if( this->outputAllSolid ) 1376 1379 { 1377 1380 this->collPlane = new plane; … … 1382 1385 SolidFlag = true; 1383 1386 } 1384 else 1387 else // No collision happened 1385 1388 { 1386 1389 yCollisionDown = false; … … 1388 1391 } 1389 1392 } 1390 else 1393 else // A collision has happended 1391 1394 { 1392 1395 yCollisionDown = true; 1393 1396 collPos = position + (down - position) * this->outputFraction; 1394 this->out = collPos; // why this????1395 1397 } 1396 1398 } -
trunk/src/lib/graphics/importer/md2/md2Model.cc
r9003 r9235 40 40 41 41 //! list of all different animations a std md2model supports 42 sAnim MD2Model::animationList[2 1] =42 sAnim MD2Model::animationList[22] = 43 43 { 44 44 // begin, end, fps, interruptable … … 64 64 { 190, 197, 10, 0 }, //!< DEATH_FALLBACKSLOW 65 65 { 198, 198, 5, 1 }, //!< BOOM 66 { 199, 204, 10, 1 }, //!< WALK (only for spectial models) 66 67 }; 67 68 -
trunk/src/lib/graphics/importer/md2/md2Model.h
r9003 r9235 30 30 #define MD2_VERSION 8 //!< the md2 version in the header 31 31 #define MD2_MAX_TRIANGLES 4096 //!< maximal triangles count 32 #define MD2_MAX_VERTICES 2048 //!< maximal vertices count33 #define MD2_MAX_TEXCOORDS 2048 //!< maximal tex coordinates32 #define MD2_MAX_VERTICES 3048 //!< maximal vertices count 33 #define MD2_MAX_TEXCOORDS 3048 //!< maximal tex coordinates 34 34 #define MD2_MAX_FRAMES 512 //!< maximal frames 35 35 #define MD2_MAX_SKINS 32 //!< maximal skins … … 92 92 DEATH_FALLBACKSLOW, 93 93 BOOM, 94 WALK, 94 95 95 96 MAX_ANIMATIONS … … 180 181 static sVec3D anorms[NUM_VERTEX_NORMALS]; //!< the anormals 181 182 static float anormsDots[SHADEDOT_QUANT][256]; //!< the anormals dot products 182 static sAnim animationList[2 1]; //!< the anomation list183 static sAnim animationList[22]; //!< the anomation list 183 184 //! again one of these strange id software parts 184 185 float* shadeDots; -
trunk/src/lib/gui/gl/glgui_handler.cc
r9022 r9235 33 33 /// TAKE THIS OUT OF HERE. 34 34 #include "graphics_engine.h" 35 #include "loading/resource_manager.h" 35 36 36 37 namespace OrxGui … … 74 75 this->_cursor->show(); 75 76 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 76 80 } 77 81 -
trunk/src/lib/network/handshake.cc
r8362 r9235 43 43 44 44 candel_id = registerVarId( new SynchronizeableInt( &localState.canDel, &remoteState.canDel, "canDel", PERMISSION_ALL ) ); 45 46 registerVar( new SynchronizeableString( &localState.preferedNickName, &remoteState.preferedNickName, "preferedNickName", PERMISSION_ALL ) ); 45 47 46 48 localState.completed = 0; -
trunk/src/lib/network/handshake.h
r7954 r9235 28 28 29 29 std::string errorString; 30 31 //additional data 32 std::string preferedNickName; 30 33 }; 31 34 … … 43 46 inline bool allowDel(){ return localState.canDel == 1; } 44 47 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; } 45 51 46 52 virtual void varChangeHandler( std::list<int> & id ); -
trunk/src/lib/network/network_game_manager.cc
r9110 r9235 42 42 #include "multiplayer_team_deathmatch.h" 43 43 44 #include "preferences.h" 45 44 46 45 47 /* using namespace std is default, this needs to be here */ … … 99 101 std::string playableModel = rules.getPlayableModelFileName( userId, team, playableClassId ); 100 102 std::string playableTexture = rules.getPlayableModelFileName( userId, team, playableClassId ); 103 float playableScale = rules.getPlayableScale( userId, team, playableClassId ); 101 104 102 105 BaseObject * bo = Factory::fabricate( playableClassId ); … … 107 110 Playable & playable = *(dynamic_cast<Playable*>(bo)); 108 111 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 ); 113 115 playable.setOwner( userId ); 114 116 playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); … … 125 127 stats->setPlayableUniqueId( playable.getUniqueID() ); 126 128 stats->setModelFileName( playableModel ); 129 130 if ( userId == 0 ) 131 stats->setNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Server" ) ); 127 132 128 133 if ( rules.isA( CL_MULTIPLAYER_TEAM_DEATHMATCH ) ) -
trunk/src/lib/network/network_stream.cc
r9059 r9235 37 37 #include "network_log.h" 38 38 39 #include "player_stats.h" 39 40 40 41 #include "lib/util/loading/factory.h" … … 153 154 assert( peers[0].handshake == NULL ); 154 155 peers[0].handshake = hs; 156 157 hs->setPreferedNickName( Preferences::getInstance()->getString( "multiplayer", "nickname", "Player" ) ); 158 155 159 // peers[0].handshake->setSynchronized( true ); 156 160 //this->connectSynchronizeable(*hs); … … 392 396 { 393 397 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 } 394 403 } 395 404 -
trunk/src/lib/network/player_stats.cc
r9110 r9235 22 22 #include "state.h" 23 23 #include "shared_network_data.h" 24 25 #include "preferences.h" 24 26 25 27 #include "debug.h" … … 187 189 void PlayerStats::setNickName( std::string nick ) 188 190 { 189 if ( isServer() )191 if ( SharedNetworkData::getInstance()->isGameServer() ) 190 192 { 191 193 this->nickName = nick; … … 226 228 if ( getStats( SharedNetworkData::getInstance()->getHostID() ) ) 227 229 getStats( SharedNetworkData::getInstance()->getHostID() )->setNickName( newNick ); 230 231 Preferences::getInstance()->setString( "multiplayer", "nickname", newNick ); 228 232 } 229 233 -
trunk/src/lib/particles/particle_system.cc
r7334 r9235 460 460 int i = 1; 461 461 Particle* tmpPart = this->deadList; 462 while (tmpPart = tmpPart->next) ++i;462 while (tmpPart = tmpPart->next) { ++i; } 463 463 PRINT(0)("count: %d\n", i); 464 464 } -
trunk/src/lib/script_engine/script.cc
r9061 r9235 26 26 CREATE_SCRIPTABLE_CLASS(Script, CL_SCRIPT, 27 27 addMethod("addObject", ExecutorLua2<Script,const std::string&, const std::string& >(&Script::addObject)) 28 ->addMethod("registerClass", ExecutorLua1<Script,const std::string&>(&Script::registerClass)) 28 29 ->addMethod("selectFunction", ExecutorLua2ret<Script, bool, const std::string&, int >(&Script::selectFunction)) 29 30 ->addMethod("executeFunction", ExecutorLua0ret<Script,bool >(&Script::executeFunction)) … … 78 79 bool Script::loadFile(const std::string& filename) 79 80 { 80 this->setName(filename);81 81 std::string filedest(ResourceManager::getInstance()->getDataDir()); 82 82 filedest += "scripts/" + filename; … … 95 95 if(error == 0) 96 96 { 97 97 currentFile = filename; 98 98 error = lua_pcall(luaState, 0, 0, 0); 99 99 100 100 if(error == 0) 101 101 { 102 currentFile = filename;103 102 return true; 104 103 } … … 358 357 bool success = false; 359 358 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"); 362 362 363 363 return success; … … 365 365 366 366 367 boolScript::registerClass( const std::string& className)367 void Script::registerClass( const std::string& className) 368 368 { 369 369 BaseObject* scriptClass = ClassList::getObject(className, CL_SCRIPT_CLASS); … … 378 378 tmpObj.name = ""; 379 379 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 { 380 392 return true; 381 393 } 382 394 } 383 395 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) 388 401 { 389 402 for(std::list<WorldObject>::const_iterator it = registeredObjects.begin(); it != registeredObjects.end(); it++ ) 390 403 { 391 if( (*it). type == type)404 if( (*it).name == name) 392 405 { 393 406 return true; … … 395 408 } 396 409 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 32 32 bool loadFile(const std::string& filename); 33 33 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 34 35 35 36 /// QUERRYING … … 64 65 int reportError(int error); //!< Get errormessage from the lua stack and print it. 65 66 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 instances67 67 bool classIsRegistered(const std::string& type); //!< Checks wheter the class "type" has already been registered with the script 68 68 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 352 352 if ((errorCode = alGetError()) != AL_NO_ERROR) 353 353 { 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)); 355 355 return false; 356 356 }
Note: See TracChangeset
for help on using the changeset viewer.