- Timestamp:
- Jul 5, 2006, 4:39:02 PM (18 years ago)
- Location:
- trunk/src
- Files:
-
- 90 edited
- 18 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defs/class_id.h
r9061 r9235 191 191 CL_CRANE = 0x00000316, 192 192 CL_BRAKING_WALL = 0X00000317, 193 CL_AIMING_SYSTEM = 0x00000318, 194 CL_GATE = 0x00000319, 193 195 194 196 // Playables … … 213 215 // Weapons 214 216 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, 222 226 223 227 // Projectiles … … 225 229 CL_ROCKET = 0x000003e1, 226 230 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, 231 238 232 239 // NPC's … … 234 241 CL_NPC_TEST2 = 0x00000402, 235 242 CL_GENERIC_NPC = 0x00000403, 243 CL_ATTRACTOR_MINE = 0x00000404, 236 244 237 245 // Testing Entities … … 276 284 CL_COLLISION_REACTION = 0X00000713, 277 285 CL_CR_PHYSICS_MOMENTUM = 0X00000714, 278 CL_CR_PHYSICS_GROUND 279 CL_CR_PHYSICS_ GROUND_WALK= 0X00000716,286 CL_CR_PHYSICS_GROUND_WALK = 0X00000715, 287 CL_CR_PHYSICS_FULL_WALK = 0X00000716, 280 288 CL_CR_OBJECT_DAMAGE = 0X00000717, 281 289 CL_CR_OBJECT_PICKUP = 0X00000718, -
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 } -
trunk/src/orxonox.cc
r8750 r9235 145 145 SDL_QuitSubSystem(SDL_INIT_TIMER); 146 146 ClassList::debug(); 147 148 Preferences::getInstance()->save(); 147 149 148 150 PRINT(3) -
trunk/src/story_entities/game_world.cc
r9110 r9235 62 62 #include "game_rules.h" 63 63 64 using namespace std;65 66 64 #include "script_class.h" 67 65 CREATE_SCRIPTABLE_CLASS(GameWorld, CL_GAME_WORLD, 68 66 addMethod("setPlaymode", ExecutorLua1<GameWorld,const std::string&>(&GameWorld::setPlaymode)) 67 ->addMethod("setSoundtrack", ExecutorLua1<GameWorld, const std::string&>(&GameWorld::setSoundtrack)) 69 68 ); 70 69 … … 158 157 159 158 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(); 162 161 163 162 if( getLoadFile().empty()) … … 233 232 234 233 234 void 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 235 244 /** 236 245 * starts the GameWorld … … 312 321 /* update the state */ 313 322 //this->update (); /// LESS REDUNDANCY. 314 // PNode::getNullParent()->updateNode(this->dtS);323 // PNode::getNullParent()->updateNode(this->dtS); 315 324 PNode::getNullParent()->updateNode(this->dtS); 316 325 … … 459 468 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_01), 460 469 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 463 478 464 479 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_GROUP_00), … … 536 551 void GameWorld::renderPassReflection() 537 552 { 538 553 // clear buffer 539 554 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 540 // glLoadIdentity();555 // glLoadIdentity(); 541 556 542 557 const std::list<BaseObject*>* reflectedWaters; … … 562 577 // draw everything to be included in the reflection 563 578 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])); 566 581 567 582 // clean up from reflection rendering … … 578 593 void GameWorld::renderPassRefraction() 579 594 { 580 595 // clear buffer 581 596 glClear( GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT); 582 597 //glLoadIdentity(); … … 602 617 // draw everything to be included in the reflection 603 618 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])); 606 621 607 622 // clean up from reflection rendering -
trunk/src/story_entities/game_world.h
r8740 r9235 31 31 class GameWorld : public StoryEntity 32 32 { 33 34 35 33 public: 34 GameWorld (); 35 virtual ~GameWorld (); 36 36 37 37 virtual void loadParams(const TiXmlElement* root); 38 38 39 40 41 42 39 /* functions from story-entity */ 40 virtual ErrorMessage init(); 41 virtual ErrorMessage loadData(); 42 virtual ErrorMessage unloadData(); 43 43 44 45 46 47 48 44 virtual bool start(); 45 virtual bool stop(); 46 virtual bool pause(); 47 virtual bool resume(); 48 virtual void run(); 49 49 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 */ 62 57 63 58 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); 74 62 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; } 80 64 81 65 82 virtual void display(); 66 protected: 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(); 83 82 84 83 85 private: 86 void displayLoadScreen(); 87 void releaseLoadScreen(); 84 virtual void display(); 88 85 89 86 90 protected:91 GameWorldData* dataTank; //!< reference to the GameWorld Data Tank92 TiXmlElement* dataXML; //!< The XML-Element this World has been loaded with.87 private: 88 void displayLoadScreen(); 89 void releaseLoadScreen(); 93 90 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 volumes97 91 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. 92 protected: 93 GameWorldData* dataTank; //!< reference to the GameWorld Data Tank 94 TiXmlElement* dataXML; //!< The XML-Element this World has been loaded with. 105 95 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 107 99 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 110 private: 111 /* external modules interfaces */ 112 ScriptManager scriptManager; 113 OrxShell::Shell* shell; 112 114 }; 113 115 -
trunk/src/story_entities/game_world_data.cc
r9019 r9235 249 249 this->tickLists.push_back(OM_GROUP_01); 250 250 this->tickLists.push_back(OM_GROUP_01_PROJ); 251 this->tickLists.push_back(OM_GROUP_02); 251 252 252 253 this->drawLists.push_back(OM_ENVIRON_NOTICK); 253 254 this->drawLists.push_back(OM_ENVIRON); 254 this->drawLists.push_back(OM_COMMON);255 255 this->drawLists.push_back(OM_GROUP_00); 256 256 this->drawLists.push_back(OM_GROUP_00_PROJ); 257 257 this->drawLists.push_back(OM_GROUP_01); 258 258 this->drawLists.push_back(OM_GROUP_01_PROJ); 259 this->drawLists.push_back(OM_GROUP_02); 260 this->drawLists.push_back(OM_COMMON); 259 261 260 262 /* init the pnode tree */ … … 343 345 LoadParamXML(root, "GameRule", this, GameWorldData, loadGameRule); 344 346 347 LoadParam(root, "clip-region", this->localCamera, Camera, setClipRegion); 348 345 349 346 350 //LoadParamXML(root, "ParticleEngine", ParticleEngine::getInstance(), ParticleEngine, loadParams); 347 351 //LoadParamXML(root, "PhysicsEngine", PhysicsEngine::getInstance(), PhysicsEngine, loadParams); 348 352 349 this->localCamera->setClipRegion(1, 10000.0);350 353 if( this->sky != NULL) 351 354 this->localCamera->addChild(this->sky); -
trunk/src/story_entities/menu/game_menu.cc
r9110 r9235 40 40 41 41 #include "network_manager.h" 42 43 #include "preferences.h" 42 44 43 45 //! This creates a Factory to fabricate a GameMenu … … 126 128 this->levelsBox = NULL; 127 129 this->networkBox = NULL; 128 130 129 131 this->clientNetworkBox = NULL; 130 132 this->serverNetworkBox = NULL; … … 239 241 { 240 242 OrxGui::GLGuiBox * box = new OrxGui::GLGuiBox(); 241 243 242 244 OrxGui::GLGuiButton* clientButton = new OrxGui::GLGuiPushButton("Client"); 243 245 box->pack(clientButton); … … 247 249 box->pack(serverButton); 248 250 serverButton->connect(SIGNAL(serverButton, released), this, SLOT(GameMenu, showServerMenu)); 249 251 250 252 networkBox->pack( box ); 251 253 } … … 340 342 OrxGui::GLGuiHandler::getInstance()->activateCursor(); 341 343 OrxGui::GLGuiHandler::getInstance()->activate(); 342 OrxGui::GLGuiHandler::getInstance()->cursor()->loadTextureSequence(ResourceManager::getInstance()->getDataDir() + "/" + "maps/reap_mouse/reap_mouse_##.png", 1, 49);343 344 344 345 /* now call the underlying*/ … … 518 519 //this->serverNetworkBox = NULL; 519 520 } 520 521 521 522 if ( !this->clientNetworkBox ) 522 523 { … … 526 527 text->setText( "Host:" ); 527 528 this->clientNetworkBox->pack( text ); 528 529 529 530 this->ipInputLine = new OrxGui::GLGuiInputLine( ); 530 this->ipInputLine->setText( "tardis-d08");531 this->ipInputLine->setText( Preferences::getInstance()->getString( "multiplayer", "lastVisitedServer", "localhost" ) ); 531 532 this->clientNetworkBox->pack( this->ipInputLine ); 532 533 this->ipInputLine->connect(SIGNAL(ipInputLine, enterPushed), this, SLOT(GameMenu, connectToServer)); 533 534 this->ipInputLine->select(); 534 535 535 536 OrxGui::GLGuiButton* connectButton = new OrxGui::GLGuiPushButton("Connect"); 536 537 clientNetworkBox->pack(connectButton); … … 538 539 } 539 540 } 540 541 541 542 this->networkBox->pack( this->clientNetworkBox ); 542 543 543 544 this->clientNetworkBox->showAll(); 544 545 545 546 //this->clientNetworkBox->setAbsCoor2D( 300.0f, 100.0f ); 546 547 } … … 558 559 //this->clientNetworkBox = NULL; 559 560 } 560 561 561 562 if ( !this->serverNetworkBox ) 562 563 { … … 566 567 text->setText( "Map:" ); 567 568 this->serverNetworkBox->pack( text ); 568 569 569 570 OrxGui::GLGuiText * text2 = new OrxGui::GLGuiText(); 570 571 text2->setText( "Multiplayer TeamDeathMatch Arena" ); 571 572 this->serverNetworkBox->pack( text2 ); 572 573 573 574 OrxGui::GLGuiButton* createButton = new OrxGui::GLGuiPushButton("Create Server"); 574 575 serverNetworkBox->pack(createButton); … … 576 577 } 577 578 } 578 579 579 580 this->networkBox->pack( this->serverNetworkBox ); 580 581 581 582 this->serverNetworkBox->showAll(); 582 583 583 584 //this->serverNetworkBox->setAbsCoor2D( 300.0f, 100.0f ); 584 585 } … … 590 591 { 591 592 PRINTF(0)("Connecting to %s\n", this->ipInputLine->_getText().c_str() ); 592 593 593 594 State::setOnline(true); 594 595 NetworkManager::getInstance()->establishConnection( this->ipInputLine->_getText(), 9999 ); 595 596 597 Preferences::getInstance()->setString( "multiplayer", "lastVisitedServer", this->ipInputLine->_getText() ); 598 596 599 this->startLevel( 5 ); 597 600 } … … 600 603 { 601 604 PRINTF(0)("Create server\n" ); 602 605 603 606 State::setOnline(true); 604 607 NetworkManager::getInstance()->createServer( 9999 ); 605 608 606 609 this->startLevel( 5 ); 607 610 } -
trunk/src/story_entities/multi_player_world.cc
r9110 r9235 97 97 //CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), this->dataTank->objectManager->getObjectList(OM_PLAYERS)); 98 98 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));102 99 PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_GROUP_01_PROJ\n\n"); 103 100 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), … … 106 103 CDEngine::getInstance()->checkCollisions(this->dataTank->objectManager->getObjectList(OM_PLAYERS), 107 104 this->dataTank->objectManager->getObjectList(OM_GROUP_01_PROJ)); 105 PRINTF(5)("\n-----------------------------------------\nchecking OM_PLAYERS vs OM_PLAYERS_PROJ\n\n"); 108 106 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)); 112 113 113 114 -
trunk/src/story_entities/multi_player_world_data.cc
r9008 r9235 109 109 ErrorMessage MultiPlayerWorldData::loadWorldEntities(const TiXmlElement* root) 110 110 { 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 } 132 137 } 133 138 -
trunk/src/util/hud.cc
r9014 r9235 187 187 this->_radar->setCenterNode(State::getPlayer()->getPlayable()); 188 188 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)); 189 190 this->_radar->setAbsCoor2D(0.8 * this->resX, 0.01 * this->resY); 190 191 this->_radar->setWidgetSize(0.2 * this->resX, 0.2 * this->resY); -
trunk/src/util/multiplayer_team_deathmatch.cc
r9110 r9235 210 210 while ( this->killList.begin() != this->killList.end() ) 211 211 { 212 PRINTF(0)("KKKKKKKKIIIIIIIIILLLLLLLLLLLLL\n"); 212 213 onKill( this->killList.begin()->getVictim(), this->killList.begin()->getKiller() ); 213 214 this->killList.erase( this->killList.begin() ); … … 305 306 return "models/creatures/doom_guy.md2"; 306 307 else if ( team == 1 ) 307 return "models/creatures/ doom_guy.md2";308 return "models/creatures/male.md2"; 308 309 else 309 310 return ""; 310 311 } 311 312 313 std::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 326 float 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 312 336 /** 313 337 * calculate team score … … 399 423 if ( currentGameState == GAMESTATE_POST_GAME ) 400 424 { 401 State::getCurrentStoryEntity()->stop();425 //State::getCurrentStoryEntity()->stop(); 402 426 this->bShowTeamChange = false; 403 427 … … 456 480 std::string playableModel = getPlayableModelFileName( userId, stats.getPreferedTeamId(), playableClassId ); 457 481 std::string playableTexture = getPlayableModelTextureFileName( userId, stats.getPreferedTeamId(), playableClassId ); 482 float playableScale = getPlayableScale( userId, stats.getPreferedTeamId(), playableClassId ); 458 483 459 484 BaseObject * bo = Factory::fabricate( playableClassId ); … … 464 489 Playable & playable = *(dynamic_cast<Playable*>(bo)); 465 490 466 if ( playableTexture != "" ) 467 playable.loadMD2Texture( playableTexture ); 468 if ( playableModel != "" ) 469 playable.loadModel( playableModel ); 491 playable.loadMD2Texture( playableTexture ); 492 playable.loadModel( playableModel, playableScale ); 470 493 playable.setOwner( userId ); 471 494 playable.setUniqueID( SharedNetworkData::getInstance()->getNewUniqueID() ); … … 687 710 { 688 711 if ( !victim ) 689 return; 712 { 713 PRINTF(0)("victim == NULL\n"); 714 return; 715 } 690 716 if ( !killer ) 691 return; 717 { 718 PRINTF(0)("killer == NULL\n"); 719 return; 720 } 692 721 693 722 int killerUserId = killer->getOwner(); 694 723 int victimUserId = victim->getOwner(); 724 725 PRINTF(0)("%d %d %x %x %s %s\n", killerUserId, victimUserId, killer, victim, killer->getClassName(), victim->getClassName()); 695 726 696 727 PlayerStats & victimStats = *PlayerStats::getStats( victimUserId ); … … 698 729 699 730 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 } 701 737 702 738 //check for suicide … … 782 818 } 783 819 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 41 41 virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId ); 42 42 virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId ); 43 virtual float getPlayableScale( int userId, int team, ClassID classId ); 43 44 44 45 virtual void registerSpawn( WorldEntity * we ); -
trunk/src/util/network_game_rules.cc
r9110 r9235 68 68 69 69 70 float NetworkGameRules::getPlayableScale( int userId, int team, ClassID classId ) 71 { 72 return 1.0f; 73 } -
trunk/src/util/network_game_rules.h
r9110 r9235 24 24 virtual std::string getPlayableModelFileName( int userId, int team, ClassID classId ); 25 25 virtual std::string getPlayableModelTextureFileName( int userId, int team, ClassID classId ); 26 virtual float getPlayableScale( int userId, int team, ClassID classId ); 26 27 27 28 virtual PlayerStats * getNewPlayerStats( int userId ){ return new PlayerStats( userId ); } -
trunk/src/world_entities/WorldEntities.am
r9061 r9235 4 4 world_entities/npcs/npc_test.cc \ 5 5 world_entities/npcs/ground_turret.cc \ 6 world_entities/npcs/space_turret.cc \ 6 7 world_entities/npcs/generic_npc.cc \ 7 8 world_entities/npcs/door.cc \ 9 world_entities/npcs/gate.cc \ 8 10 world_entities/npcs/repair_station.cc \ 11 world_entities/npcs/attractor_mine.cc \ 9 12 \ 10 13 world_entities/environment.cc \ … … 22 25 \ 23 26 world_entities/weapons/test_gun.cc \ 27 world_entities/weapons/laser_cannon.cc \ 24 28 world_entities/weapons/turret.cc \ 25 29 world_entities/weapons/aiming_turret.cc \ … … 28 32 world_entities/weapons/hyperblaster.cc \ 29 33 world_entities/weapons/aim.cc \ 34 world_entities/weapons/aiming_system.cc \ 30 35 world_entities/weapons/fps_sniper_rifle.cc \ 36 world_entities/weapons/boomerang_gun.cc \ 31 37 \ 32 38 world_entities/projectiles/bomb.cc \ 33 39 world_entities/projectiles/laser.cc \ 40 world_entities/projectiles/rail_projectile.cc \ 34 41 world_entities/projectiles/test_bullet.cc \ 35 42 world_entities/projectiles/rocket.cc \ 36 43 world_entities/projectiles/guided_missile.cc \ 44 world_entities/projectiles/boomerang_projectile.cc \ 37 45 world_entities/projectiles/hyperblast.cc \ 38 46 \ … … 70 78 npcs/npc_test1.h \ 71 79 npcs/ground_turret.h \ 80 npcs/space_turret.h \ 72 81 npcs/door.cc \ 73 npcs/repair_station.cc \ 82 npcs/repair_station.h \ 83 npcs/attractor_mine.h \ 74 84 \ 75 85 environment.h \ … … 87 97 \ 88 98 weapons/test_gun.h \ 99 weapons/laser_cannon.cc \ 89 100 weapons/cannon.h \ 90 101 weapons/hyperblaster.h \ … … 92 103 weapons/aiming_turret.h \ 93 104 weapons/targeting_turret.h \ 105 weapons/boomerang_gun.h \ 94 106 weapons/aim.h \ 107 weapons/aiming_system.h \ 95 108 weapons/fps_sniper_rifle.h \ 96 109 \ 97 110 projectiles/bomb.h \ 98 111 projectiles/laser.h \ 112 projectiles/rail_projectile.h \ 99 113 projectiles/test_bullet.h \ 100 114 projectiles/rocket.h \ 101 115 projectiles/guided_missile.h \ 116 projectiles/boomerang_projectile.h \ 102 117 projectiles/hyperblast.h \ 103 118 \ -
trunk/src/world_entities/camera.cc
r7868 r9235 36 36 this->setFovy(90); 37 37 this->setAspectRatio(1.2f); 38 this->setClipRegion(.1, 2000);38 this->setClipRegion(.1, 10000); 39 39 40 40 this->setViewMode(Camera::ViewNormal); -
trunk/src/world_entities/creatures/fps_player.cc
r9110 r9235 29 29 #include "weapons/cannon.h" 30 30 #include "weapons/fps_sniper_rifle.h" 31 #include "weapons/aiming_system.h" 31 32 32 33 #include "aabb.h" 34 33 35 34 36 #include "key_mapper.h" … … 57 59 { 58 60 this->setPlayer(NULL); 61 62 if( this->aimingSystem) 63 delete this->aimingSystem; 59 64 } 60 65 … … 81 86 { 82 87 this->setClassID(CL_FPS_PLAYER, "FPSPlayer"); 83 84 88 85 89 this->bLeft = false; … … 89 93 this->bJump = false; 90 94 this->bPosBut = false; 95 this->bFire = false; 91 96 92 97 this->xMouse = 0.0f; … … 125 130 126 131 // this->addWeapon(wpLeft, 1, 0); 127 this->addWeapon(wpRight,1, 0); 132 if( State::isOnline()) 133 this->addWeapon(wpRight,1, 0); 128 134 this->getWeaponManager().changeWeaponConfig(1); 129 135 130 136 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))); 132 138 this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 133 139 this->getWeaponManager().setSlotDirection(1, Quaternion(M_PI_4*.5, Vector(1,0,0))); … … 135 141 this->getWeaponManager().setSlotPosition(1, Vector(5.0, 0.0, 0.0)); 136 142 143 // this->getWeaponManager().getFixedTarget()->setRelDir(Quaternion(M_PI_4*-0.6f, Vector(0,0,1))); 144 137 145 138 146 this->getWeaponManager().setParentNode(&this->cameraNode); … … 141 149 this->getWeaponManager().getFixedTarget()->setParent(&this->cameraNode); 142 150 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 143 156 144 157 … … 148 161 registerVar( new SynchronizeableBool( &bForward, &bForward, "bForward", PERMISSION_OWNER ) ); 149 162 registerVar( new SynchronizeableBool( &bBackward, &bBackward, "bBackward", PERMISSION_OWNER ) ); 163 registerVar( new SynchronizeableBool( &bJump, &bJump, "bJump", PERMISSION_OWNER ) ); 150 164 registerVar( new SynchronizeableFloat( &heading, &heading, "heading", PERMISSION_OWNER ) ); 151 165 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 ); 152 175 } 153 176 … … 192 215 this->getWeaponManager().getFixedTarget()->setRelCoor(0,0,0); 193 216 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(); 203 220 } 204 221 } … … 219 236 { 220 237 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 228 311 229 312 if( ( xMouse != 0 || yMouse != 0 ) && (this->getOwner() == SharedNetworkData::getInstance()->getHostID() || !State::isOnline() ) ) … … 235 318 attitude-= yMouse; 236 319 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; 242 325 243 326 xMouse = yMouse = 0; … … 304 387 this->fallVelocity += 300.0f * time; 305 388 velocity -= Vector(0.0, 1.0, 0.0) * this->fallVelocity; 389 390 // PRINTF(0)("vel %f\n", this->fallVelocity); 306 391 } 307 392 else … … 309 394 this->fallVelocity = 0.0f; 310 395 } 311 312 396 313 397 this->shiftCoor( velocity*time ); … … 346 430 } 347 431 432 this->setOnGround(false); 433 this->aimingSystem->flushList(); 348 434 } 349 435 … … 383 469 } 384 470 else if( event.type == KeyMapper::PEV_JUMP) 471 { 385 472 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 481 void FPSPlayer::respawn( ) 482 { 483 if( State::isOnline()) 484 toList( OM_PLAYERS ); 485 486 this->damageTicker = 0.0f; 487 488 Playable::respawn(); 489 } 490 491 492 void 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 9 9 10 10 #include "playable.h" 11 12 13 class AimingSystem; 11 14 12 15 … … 27 30 virtual void reset(); 28 31 32 virtual void destroy(WorldEntity* killer); 33 virtual void respawn(); 29 34 30 35 virtual void tick(float time); … … 43 48 bool bJump; //!< jumping 44 49 bool bPosBut; //!< position button 50 bool bFire; //!< fire button 45 51 46 52 float xMouse; //!< mouse moved in x-Direction … … 55 61 float fallVelocity; //!< velocity for falling down 56 62 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 57 69 }; 58 70 -
trunk/src/world_entities/effects/explosion.cc
r7120 r9235 40 40 this->toList(OM_DEAD_TICK); 41 41 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); 43 43 this->emitter->addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT); 44 44 this->emitter->setParent(this); … … 83 83 Explosion::explosionParticles->setLifeSpan(1.5, .3); 84 84 Explosion::explosionParticles->setRadius(0.0, 10); 85 Explosion::explosionParticles->setRadius(.5, 15.0);85 Explosion::explosionParticles->setRadius(.5, 30.0); 86 86 Explosion::explosionParticles->setRadius(1.0, 10.0); 87 87 Explosion::explosionParticles->setColor(0.0, 1,0,0,1); … … 113 113 void Explosion::tick (float dt) 114 114 { 115 printf("%f %f\n", this->lifeCycle, this->lifeTime);116 115 this->lifeCycle += dt; 117 116 if(this->lifeTime < this->lifeCycle) -
trunk/src/world_entities/environments/mapped_water.cc
r9110 r9235 337 337 { 338 338 // 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"); 340 355 } 341 356 … … 475 490 476 491 OrxGui::GLGuiSlider* lightPosX = new OrxGui::GLGuiSlider(); 477 lightPosX->setRange(- 600, 600);492 lightPosX->setRange(-4000, 4000); 478 493 lightPosX->setValue(this->lightPos.x); 479 494 lightPosX->setStep(15); … … 482 497 483 498 OrxGui::GLGuiSlider* lightPosY = new OrxGui::GLGuiSlider(); 484 lightPosY->setRange(- 600, 600);499 lightPosY->setRange(-4000, 4000); 485 500 lightPosY->setStep(15); 486 501 lightPosY->setValue(this->lightPos.y); … … 489 504 490 505 OrxGui::GLGuiSlider* lightPosZ = new OrxGui::GLGuiSlider(); 491 lightPosZ->setRange(- 600, 600);506 lightPosZ->setRange(-4000, 4000); 492 507 lightPosZ->setStep(15); 493 508 lightPosZ->setValue(this->lightPos.z); … … 504 519 505 520 OrxGui::GLGuiSlider* waterHeight = new OrxGui::GLGuiSlider(); 506 waterHeight->setRange( -500, 500);521 waterHeight->setRange(100, 370); 507 522 waterHeight->setValue(this->waterHeight); 508 waterHeight->setStep( 10);523 waterHeight->setStep(4); 509 524 waterHeight->connect(SIGNAL(waterHeight, valueChanged), this, SLOT(MappedWater, setWaterHeight)); 510 525 waterHeightBox->pack(waterHeight); … … 547 562 glDisable(GL_BLEND); 548 563 564 // TODO change texture coords, so water doesnt look distorted when xWidth != zWidth 549 565 glBegin(GL_QUADS); 550 566 // The back left vertice for the water -
trunk/src/world_entities/environments/model_entity.cc
r7193 r9235 32 32 { 33 33 this->setClassID(CL_MODEL_ENTITY, "ModelEntity"); 34 this->toList(OM_ENVIRON _NOTICK);34 this->toList(OM_ENVIRON); 35 35 36 36 this->speed = NULL; … … 71 71 void ModelEntity::setMomentum (float angle, float x, float y, float z) 72 72 { 73 Vector v(x,y,z); 74 v.debug(); 75 v.normalize(); 76 v.debug(); 77 73 78 if (this->momentum == NULL) 74 79 this->momentum = new Quaternion; 75 *this->momentum = Quaternion(angle, Vector(x, y, z)); 80 *this->momentum = Quaternion(angle, v); 81 82 this->momentum->debug(); 76 83 } 77 84 … … 82 89 83 90 if (this->momentum != NULL) 84 this->shiftDir(*this->momentum * dt); 91 { 92 this->shiftDir((*this->momentum * dt ).getNormalized()); 93 //this->getAbsDir().debug(); 94 } 85 95 } -
trunk/src/world_entities/npcs/generic_npc.cc
r9110 r9235 82 82 { 83 83 this->setClassID(CL_GENERIC_NPC, "GenericNPC"); 84 84 85 this->toList(OM_GROUP_00); 85 86 … … 206 207 /** 207 208 * each animation has to be initialized here 209 */ 210 /** 211 * 208 212 */ 209 213 void GenericNPC::initNPC() … … 578 582 579 583 580 void GenericNPC::destroy( )584 void GenericNPC::destroy(WorldEntity* killer) 581 585 { 582 586 int randi = (int)(5.0f * (float)rand()/(float)RAND_MAX); -
trunk/src/world_entities/npcs/generic_npc.h
r9061 r9235 77 77 78 78 79 v oid destroy();79 virtual void destroy(WorldEntity* killer); 80 80 81 81 private: -
trunk/src/world_entities/npcs/ground_turret.cc
r8777 r9235 176 176 } 177 177 178 void GroundTurret::destroy( )178 void GroundTurret::destroy(WorldEntity* killer) 179 179 { 180 180 this->setAbsDirSoft(Quaternion(-90, Vector(0,0,1)), 90); -
trunk/src/world_entities/npcs/ground_turret.h
r7954 r9235 25 25 virtual void leftWorld (); 26 26 27 virtual void destroy( );27 virtual void destroy(WorldEntity* killer); 28 28 29 29 virtual void draw() const; -
trunk/src/world_entities/npcs/npc.cc
r9003 r9235 19 19 20 20 #include "npc.h" 21 22 23 using namespace std;24 21 25 22 … … 51 48 void NPC::loadParams(const TiXmlElement* root) 52 49 { 53 if(root != NULL)54 50 WorldEntity::loadParams(root); 55 51 } -
trunk/src/world_entities/npcs/npc_test.cc
r8724 r9235 23 23 #include "shader.h" 24 24 #include "state.h" 25 #include "stdlibincl.h"26 25 #include "debug.h" 27 26 27 #include "loading/factory.h" 28 #include "loading/load_param.h" 28 29 29 using namespace std; 30 #include "effects/explosion.h" 31 32 CREATE_FACTORY(NPC2, CL_NPC_TEST2); 30 33 31 34 32 NPC2::NPC2( )35 NPC2::NPC2(const TiXmlElement* root) 33 36 : NPC(NULL) 34 37 { … … 36 39 37 40 if ((float)rand()/RAND_MAX > .5f) 38 this->loadModel("models/ships/bolido.obj", 3);41 this->loadModel("models/ships/bolido.obj", 6); 39 42 else 40 this->loadModel("models/ships/gobblin.obj", 3); 43 this->loadModel("models/ships/gobblin.obj", 6); 44 45 46 41 47 42 48 this->shader = NULL; … … 44 50 this->shader = Shader::getShader("shaders/toon.vert", "shaders/toon.frag"); 45 51 46 this-> obj = gluNewQuadric();52 this->randomRotAxis = VECTOR_RAND(1); 47 53 48 this->randomRotAxis = VECTOR_RAND(1); 54 if (root != NULL) 55 this->loadParams(root); 49 56 } 50 57 … … 54 61 if (this->shader) 55 62 Shader::unload(this->shader); 56 gluDeleteQuadric(this->obj); 63 } 64 65 66 void NPC2::loadParams(const TiXmlElement* root) 67 { 68 NPC::loadParams(root); 69 70 } 71 72 73 void NPC2::destroy(WorldEntity* killer) 74 { 75 Explosion::explode(this, Vector(10,10,10)); 76 this->toList(OM_DEAD); 77 57 78 } 58 79 … … 67 88 void NPC2::draw() const 68 89 { 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 81 102 // if (this->shader != NULL && this->shader != Shader::getActiveShader()) 82 103 // shader->activateShader(); 83 // gluSphere(this->obj, 3, 10, 10); 104 105 this->getModel()->draw(); 84 106 // 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(); 90 112 } 91 113 … … 97 119 //if (directin.len() < 100) 98 120 // this->shiftCoor(direction *dt * 5 * exp(-direction.len() / 30.0)); 99 this->shiftDir(Quaternion(dt, this->randomRotAxis));121 // this->shiftDir(Quaternion(dt, this->randomRotAxis)); 100 122 101 123 } -
trunk/src/world_entities/npcs/npc_test.h
r6981 r9235 11 11 12 12 public: 13 NPC2 ( );13 NPC2 (const TiXmlElement* root); 14 14 virtual ~NPC2 (); 15 15 16 virtual void loadParams(const TiXmlElement* root); 16 17 17 18 void addAI(AI* ai); 19 20 virtual void destroy(WorldEntity* killer); 18 21 19 22 virtual void tick(float dt); … … 23 26 Vector randomRotAxis; 24 27 Shader* shader; 25 GLUquadricObj* obj;26 27 28 }; 28 29 -
trunk/src/world_entities/npcs/npc_test1.cc
r8724 r9235 24 24 #include "power_ups/turret_power_up.h" 25 25 #include "power_ups/laser_power_up.h" 26 27 using namespace std;28 26 29 27 -
trunk/src/world_entities/playable.cc
r9110 r9235 67 67 this->bDead = false; 68 68 69 //subscribe to collision reaction70 this->subscribeReaction(CREngine::CR_PHYSICS_GROUND_WALK, CL_BSP_ENTITY);71 69 72 70 registerVar( new SynchronizeableInt( &score, &score, "score" ) ); … … 393 391 PRINTF(0)("Playable respawn\n"); 394 392 // 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()) 396 394 State::getGameRules()->onPlayerSpawn(); 397 395 … … 403 401 404 402 405 void Playable::destroy() 406 { 407 Explosion::explode(dynamic_cast<PNode*>(this), Vector(1.0f, 1.0f, 1.0f)); 408 409 403 void Playable::destroy(WorldEntity* killer) 404 { 410 405 if( !this->bDead) 411 406 { … … 416 411 if( this == State::getPlayer()->getPlayable()) 417 412 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 that421 this->setAbsCoor(-2000.0, -2000.0, -2000.0);422 423 //explosion hack424 425 413 } 426 414 this->bDead = true; 415 416 if( State::getGameRules() != NULL) 417 State::getGameRules()->registerKill(Kill(killer, this)); 427 418 } 428 419 } -
trunk/src/world_entities/playable.h
r9061 r9235 80 80 81 81 // WorldEntity Extensions 82 virtual void destroy( );82 virtual void destroy(WorldEntity* killer); 83 83 virtual void respawn(); 84 84 virtual void collidesWith(WorldEntity* entity, const Vector& location); … … 90 90 static const std::string& playmodeToString(Playable::Playmode playmode); 91 91 static const std::string playmodeNames[]; 92 93 inline bool beFire(){ return this->bFire; } 94 inline void fire(bool bF){ this->bFire = bF;} 92 95 93 96 protected: -
trunk/src/world_entities/projectiles/guided_missile.cc
r8362 r9235 35 35 this->setClassID(CL_GUIDED_MISSILE, "GuidedMissile"); 36 36 37 this->loadModel("models/projectiles/orx-rocket.obj", .3);37 this->loadModel("models/projectiles/orx-rocket.obj", 2.0); 38 38 this->loadExplosionSound("sound/explosions/explosion_4.wav"); 39 39 … … 88 88 GuidedMissile::trailParticles->setLifeSpan(1.0, .3); 89 89 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); 93 93 GuidedMissile::trailParticles->setColor(0.0, 1,0,0,.7); 94 94 GuidedMissile::trailParticles->setColor(0.2, .8,.8,0,.5); … … 135 135 { 136 136 if (this->hitEntity != entity) 137 this->destroy( );137 this->destroy( entity ); 138 138 this->hitEntity = entity; 139 139 } … … 180 180 * the function gets called, when the projectile is destroyed 181 181 */ 182 void GuidedMissile::destroy () 183 { 184 Projectile::destroy(); 182 void GuidedMissile::destroy (WorldEntity* killer) 183 { 184 185 printf("THIS SHOULD WORLk\n"); 186 187 Projectile::destroy( killer ); 185 188 PRINTF(5)("DESTROY GuidedMissile\n"); 186 189 this->lifeCycle = .95; //!< @todo calculate this usefully. -
trunk/src/world_entities/projectiles/guided_missile.h
r6622 r9235 26 26 virtual void collidesWith(WorldEntity* entity, const Vector& location); 27 27 28 virtual void destroy ( );28 virtual void destroy (WorldEntity* killer); 29 29 30 30 virtual void tick (float time); -
trunk/src/world_entities/projectiles/hyperblast.cc
r8362 r9235 126 126 * the function gets called, when the projectile is destroyed 127 127 */ 128 void Hyperblast::destroy ( )128 void Hyperblast::destroy (WorldEntity* killer) 129 129 { 130 Projectile::destroy( );130 Projectile::destroy( killer ); 131 131 132 132 PRINTF(5)("DESTROY Hyperblast\n"); -
trunk/src/world_entities/projectiles/hyperblast.h
r6821 r9235 27 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 28 28 29 virtual void destroy ( );29 virtual void destroy (WorldEntity* killer); 30 30 31 31 virtual void tick (float time); -
trunk/src/world_entities/projectiles/laser.cc
r9061 r9235 42 42 43 43 this->setMinEnergy(10); 44 this->setHealthMax( 10);44 this->setHealthMax(0); 45 45 this->lifeSpan = 5.0; 46 46 … … 88 88 } 89 89 90 this->setHealth(10); 90 this->setDamage(0); 91 this->setHealth(0); 91 92 } 92 93 … … 107 108 { 108 109 if (this->hitEntity != entity && entity->isA(CL_NPC)) 109 this->destroy( );110 this->destroy( entity ); 110 111 this->hitEntity = entity; 111 112 } … … 128 129 * the function gets called, when the projectile is destroyed 129 130 */ 130 void Laser::destroy ( )131 void Laser::destroy (WorldEntity* killer) 131 132 { 132 Projectile::destroy( );133 Projectile::destroy( killer ); 133 134 PRINTF(5)("DESTROY Laser\n"); 134 135 this->lifeCycle = .95; //!< @todo calculate this usefully. -
trunk/src/world_entities/projectiles/laser.h
r6622 r9235 27 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 28 28 29 virtual void destroy ( );29 virtual void destroy (WorldEntity* killer); 30 30 31 31 virtual void tick (float dt); -
trunk/src/world_entities/projectiles/projectile.cc
r8362 r9235 41 41 /* character attributes */ 42 42 this->setHealth(1.0f); 43 this->setDamage(1 00.0f); // default damage of a projectile set to 100.0 damage points43 this->setDamage(1.0f); // default damage of a projectile set to 100.0 damage points 44 44 45 45 this->explosionBuffer = NULL; … … 162 162 163 163 if (this->tickLifeCycle(dt)) 164 this->destroy( );164 this->destroy( NULL ); 165 165 } 166 166 … … 169 169 * the function gets called, when the projectile is destroyed 170 170 */ 171 void Projectile::destroy ( )171 void Projectile::destroy (WorldEntity* killer) 172 172 { 173 173 if (this->explosionBuffer != NULL) -
trunk/src/world_entities/projectiles/projectile.h
r7460 r9235 41 41 virtual void deactivate() = 0; 42 42 43 virtual void destroy ( );43 virtual void destroy (WorldEntity* killer); 44 44 45 45 virtual void tick (float dt); -
trunk/src/world_entities/projectiles/rocket.cc
r8362 r9235 128 128 { 129 129 if (this->hitEntity != entity) 130 this->destroy( );130 this->destroy( entity ); 131 131 this->hitEntity = entity; 132 132 } … … 149 149 * the function gets called, when the projectile is destroyed 150 150 */ 151 void Rocket::destroy ( )151 void Rocket::destroy (WorldEntity* killer) 152 152 { 153 Projectile::destroy( );153 Projectile::destroy( killer ); 154 154 155 155 PRINTF(5)("DESTROY Rocket\n"); -
trunk/src/world_entities/projectiles/rocket.h
r6622 r9235 27 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 28 28 29 virtual void destroy ( );29 virtual void destroy (WorldEntity* killer); 30 30 31 31 virtual void tick (float time); -
trunk/src/world_entities/projectiles/test_bullet.cc
r8362 r9235 119 119 { 120 120 if (this->hitEntity != entity && entity->isA(CL_NPC)) 121 this->destroy( );121 this->destroy( entity ); 122 122 this->hitEntity = entity; 123 123 } … … 147 147 * the function gets called, when the projectile is destroyed 148 148 */ 149 void TestBullet::destroy ( )149 void TestBullet::destroy (WorldEntity* killer) 150 150 { 151 151 PRINTF(5)("DESTROY TestBullet\n"); -
trunk/src/world_entities/projectiles/test_bullet.h
r6624 r9235 27 27 virtual void collidesWith(WorldEntity* entity, const Vector& location); 28 28 29 virtual void destroy ( );29 virtual void destroy (WorldEntity* killer); 30 30 31 31 virtual void tick (float time); -
trunk/src/world_entities/script_trigger.cc
r9110 r9235 29 29 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 30 30 //Properties 31 ->addMethod("setName", ExecutorLua1<BaseObject, const std::string&>(&BaseObject::setName)) 31 32 ->addMethod("setTarget", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTarget)) 32 33 ->addMethod("setTriggerParent", ExecutorLua1<ScriptTrigger, const std::string&>(&ScriptTrigger::setTriggerParent)) … … 51 52 this->toList(OM_COMMON); 52 53 54 radius = 10; 53 55 returnCount = 1; 54 56 scriptFinished = false; … … 71 73 72 74 } 75 73 76 } 74 77 … … 215 218 void ScriptTrigger::setScript(const std::string& file) 216 219 { 217 218 220 ScriptManager* scriptManager = State::getScriptManager(); 219 221 if (scriptManager != NULL) -
trunk/src/world_entities/skydome.cc
r9006 r9235 1 1 /* 2 2 orxonox - the future of 3D-vertical-scrollers 3 3 4 4 Copyright (C) 2006 orx 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of the GNU General Public License as published by 8 8 the Free Software Foundation; either version 2, or (at your option) 9 9 any later version. 10 10 11 11 ### File Specific: 12 12 main-programmer: hdavid, amaechler … … 47 47 this->toList(OM_BACKGROUND); 48 48 this->toReflectionList(); 49 49 this->indices = NULL; 50 this->vertices = NULL; 51 this->planeVertices = NULL; 52 this->shader = NULL; 50 53 activateDome = false; 51 54 … … 91 94 if(!activateDome) 92 95 return; 93 96 94 97 glPushAttrib(GL_ENABLE_BIT); 95 98 96 99 glDisable(GL_LIGHTING); 97 100 glDisable(GL_BLEND); 101 glDisable(GL_FOG); 98 102 99 103 glEnable(GL_TEXTURE_3D); … … 105 109 glTranslatef(0.0f,pRadius,0.0f); 106 110 107 108 111 glBegin(GL_TRIANGLES); 109 110 112 for (int i=0; i < numIndices; i++) 111 113 { … … 115 117 glVertex3f(planeVertices[indices[i]].x, planeVertices[indices[i]].y, planeVertices[indices[i]].z); 116 118 } 117 118 119 glEnd(); 119 120 121 WorldEntity::draw(); 122 120 123 glPopMatrix(); 121 124 … … 128 131 void Skydome::generateSkyPlane(int divisions, float planetRadius, float atmosphereRadius, float hTile, float vTile) 129 132 { 130 PRINTF(0)("Generating a sky plane ");133 PRINTF(0)("Generating a sky plane\n"); 131 134 132 135 // Make sure our vertex array is clear -
trunk/src/world_entities/space_ships/cruizer.cc
r9061 r9235 78 78 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 79 79 80 this->loadModel("models/ships/human_cruizer.obj", 0.05);80 // this->loadModel("models/ships/human_cruizer.obj", 0.05); 81 81 82 82 } -
trunk/src/world_entities/space_ships/helicopter.cc
r8783 r9235 43 43 ->addMethod("getAbsCoorY", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorY)) 44 44 ->addMethod("getAbsCoorZ", ExecutorLua0ret<PNode, float>(&PNode::getAbsCoorZ)) 45 45 46 46 ); 47 47 … … 124 124 void Helicopter::init() 125 125 { 126 this->chopperBuffer = NULL; 127 126 128 this->setClassID(CL_HELICOPTER, "Helicopter"); 127 128 129 PRINTF(4)("HELICOPTER INIT\n"); 129 130 -
trunk/src/world_entities/space_ships/helicopter.h
r8783 r9235 39 39 40 40 virtual void process(const Event &event); 41 41 42 42 virtual void moveUp(bool move){bAscend = move;}; 43 43 virtual void moveDown(bool move){bDescend = move;}; … … 78 78 float airViscosity; 79 79 80 OrxSound::SoundSource soundSource;81 OrxSound::SoundBuffer* chopperBuffer;80 OrxSound::SoundSource soundSource; 81 OrxSound::SoundBuffer* chopperBuffer; 82 82 83 83 }; -
trunk/src/world_entities/space_ships/hover.cc
r8719 r9235 25 25 26 26 #include "util/loading/factory.h" 27 //#include "util/loading/resource_manager.h" 28 27 29 #include "key_mapper.h" 28 30 #include "state.h" … … 34 36 CREATE_FACTORY(Hover, CL_HOVER); 35 37 38 #include "script_class.h" 39 CREATE_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 36 48 /** 37 49 * destructs the hover, deletes alocated memory … … 40 52 { 41 53 this->setPlayer(NULL); 54 55 //if (this->hoverBuffer != NULL) 56 // ResourceManager::getInstance()->unload(this->hoverBuffer); 42 57 } 43 58 … … 58 73 59 74 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 60 81 } 61 82 … … 97 118 void Hover::init() 98 119 { 120 121 //this->hitEntity = NULL; 122 //this->hoverBuffer = NULL; 123 99 124 // this->setRelDir(Quaternion(M_PI, Vector(1,0,0))); 100 125 this->setClassID(CL_HOVER, "Hover"); … … 112 137 this->cameraLook = 0.0f; 113 138 this->rotation = 0.0f; 114 this->acceleration = 25.0f;139 this->acceleration = 15.0f; 115 140 this->airFriction = 3.0f; 116 141 … … 206 231 State::getCameraNode()->setRelCoorSoft(-10, 0,0); 207 232 State::getCameraTargetNode()->setParentSoft(&this->cameraNode); 233 234 //this->soundSource.play(this->hoverBuffer, 0.3f, true); 235 208 236 } 209 237 -
trunk/src/world_entities/space_ships/hover.h
r7346 r9235 7 7 #ifndef _HOVER_H 8 8 #define _HOVER_H 9 10 //#include "sound_buffer.h" 11 //#include "sound_source.h" 9 12 10 13 #include "playable.h" … … 68 71 float airViscosity; 69 72 70 WorldEntity* hitEntity; 73 WorldEntity* hitEntity; 74 75 //OrxSound::SoundSource soundSource; 76 //OrxSound::SoundBuffer* hoverBuffer; 71 77 }; 72 78 -
trunk/src/world_entities/space_ships/space_ship.cc
r9110 r9235 58 58 CREATE_SCRIPTABLE_CLASS(SpaceShip, CL_SPACE_SHIP, 59 59 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)) 60 65 //Coordinates 61 66 ->addMethod("setAbsCoor", ExecutorLua3<PNode,float,float,float>(&PNode::setAbsCoor)) … … 352 357 // return; 353 358 354 // spaceship controlled movement 359 // spaceship controlled movement fire(bool bF){ this->bFire = bF;} 355 360 //if (this->getOwner() == this->getHostID()) 356 361 this->calculateVelocity(time); … … 404 409 Vector accel(0.0, 0.0, 0.0); 405 410 /* 406 Vector rot(0.0, 0.0, 0.0); // wird ben ötigt für Helicopter411 Vector rot(0.0, 0.0, 0.0); // wird ben�igt fr Helicopter 407 412 */ 408 413 //float rotVal = 0.0; … … 513 518 } 514 519 515 void SpaceShip::destroy( )520 void SpaceShip::destroy( WorldEntity* killer ) 516 521 { 517 522 PRINTF(0)("spaceship destroy\n"); -
trunk/src/world_entities/space_ships/space_ship.h
r9008 r9235 37 37 virtual void leftWorld(); 38 38 39 virtual void destroy( );39 virtual void destroy(WorldEntity* killer); 40 40 virtual void respawn(); 41 41 -
trunk/src/world_entities/space_ships/spacecraft_2d.cc
r9110 r9235 35 35 #include "debug.h" 36 36 37 #include "script_class.h" 38 39 37 40 CREATE_FACTORY(Spacecraft2D, CL_SPACECRAFT_2D); 38 41 39 /** 40 * destructs the spacecraft_2d, deletes alocated memory 41 */ 42 Spacecraft2D::~Spacecraft2D () 43 { 44 this->setPlayer(NULL); 45 delete this->toTravelHeight; 46 } 42 43 CREATE_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 47 53 48 54 /** … … 76 82 this->loadParams(root); 77 83 84 85 78 86 //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"); 84 96 85 97 // cannon->setName("BFG"); … … 87 99 this->addWeapon(wpLeft, 1, 0); 88 100 this->addWeapon(wpRight,1 ,1); 101 this->addWeapon(turretLeft, 1, 2); 102 this->addWeapon(turretRight, 1, 3); 103 89 104 //this->addWeapon(cannon, 0, 2); 90 105 91 106 this->getWeaponManager().changeWeaponConfig(1); 92 107 dynamic_cast<Element2D*>(this->getWeaponManager().getFixedTarget())->setVisibility( false); 108 } 109 110 111 /** 112 * @brief destructs the spacecraft_2d, deletes alocated memory 113 */ 114 Spacecraft2D::~Spacecraft2D () 115 { 116 this->setPlayer(NULL); 117 delete this->toTravelHeight; 93 118 } 94 119 … … 109 134 this->cameraLook = 0.0f; 110 135 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 117 144 118 145 … … 122 149 this->travelNode = new PNode(); 123 150 151 this->loadModel("models/ships/mantawing.obj", 5.0f); 124 152 125 153 // camera - issue … … 166 194 this->getWeaponManager().setSlotCount(5); 167 195 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); 169 197 this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 170 198 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); 172 200 this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL); 173 201 174 this->getWeaponManager().setSlotPosition(2, Vector(-1.63, .809, -.003));175 this->getWeaponManager().setSlotCapability(2, WTYPE_HEAVY);176 177 202 /// 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))); 183 208 184 209 this->cameraNode.setRelCoor(1,5,0); … … 193 218 registerVar( new SynchronizeableFloat( &cameraLook, &cameraLook, "cameraLook", PERMISSION_OWNER ) ); 194 219 registerVar( new SynchronizeableFloat( &rotation, &rotation, "rotation", PERMISSION_OWNER ) ); 220 221 222 195 223 } 196 224 … … 285 313 286 314 State::getCameraNode()->setParentSoft(this->travelNode); 287 State::getCameraNode()->setRelCoorSoft(-3, 50,0);315 State::getCameraNode()->setRelCoorSoft(-3, 100,0); 288 316 State::getCameraTargetNode()->setParentSoft(this->travelNode); 289 State::getCameraTargetNode()->setRelCoorSoft( 0,0,0);317 State::getCameraTargetNode()->setRelCoorSoft(5,0,1); 290 318 291 319 … … 406 434 if (this->toTravelHeight != NULL) 407 435 { 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)); 409 437 if (fabsf(this->travelNode->getAbsCoor().y - *this->toTravelHeight) < .1) 410 438 { … … 416 444 417 445 accel.y = 0.0; 446 418 447 Vector accelerationDir = this->getAbsDir().apply(accel * this->acceleration); 419 448 accelerationDir.y = 0.0; … … 424 453 425 454 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 426 467 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); 428 472 } 429 473 break; … … 475 519 else if (cameraLook < -M_PI_4) 476 520 cameraLook = -M_PI_4; 477 //this->cameraNode.setRelDirSoft(this->direction,10);478 521 } 479 522 } -
trunk/src/world_entities/space_ships/spacecraft_2d.h
r9110 r9235 27 27 void setTravelDistance(const Vector2D& distance); 28 28 void setTravelDistance(float x, float y); 29 30 void setAirFriction(float friction) { this->airFriction = friction; }; 29 31 30 32 -
trunk/src/world_entities/spawning_point.cc
r9008 r9235 57 57 58 58 MessageManager::getInstance()->registerMessageHandler( MSGID_RESPAWN, respawnMessageHandler, NULL ); 59 60 this->setSynchronized( true ); 59 61 } 60 62 … … 102 104 void SpawningPoint::spawn(Playable* entity) 103 105 { 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 104 125 PRINTF(0)("Spawningpoint spawns Entity (%s)\n", entity->getClassName()); 105 126 … … 137 158 this->spawn(it->entity); 138 159 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() ) 140 177 this->sendRespawnMessage( it->entity->getUniqueID() ); 141 178 … … 194 231 assert( Converter::byteArrayToInt( data+INTSIZE, &uniqueId ) == INTSIZE ); 195 232 233 PRINTF(0)("SPAWNMESSAGE %d\n", uniqueId); 234 196 235 SpawningPoint * sp = NULL; 197 236 Playable * playable = NULL; … … 203 242 for ( std::list<BaseObject*>::const_iterator it = list->begin(); it != list->end(); it++ ) 204 243 { 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 ) 206 246 { 207 247 sp = dynamic_cast<SpawningPoint*>(*it); … … 213 253 if ( !sp ) 214 254 { 215 PRINTF( 2)("could not find spawning point\n");255 PRINTF(0)("could not find spawning point\n"); 216 256 return false; 217 257 } … … 233 273 if ( !playable ) 234 274 { 235 PRINTF( 2)("could not find playable\n");275 PRINTF(0)("could not find playable\n"); 236 276 return false; 237 277 } -
trunk/src/world_entities/test_entity.cc
r9003 r9235 116 116 if( this->lastCollided != entity) 117 117 { 118 this->destroy( );118 this->destroy( entity ); 119 119 this->lastCollided = entity; 120 120 … … 126 126 127 127 128 void TestEntity::destroy( )128 void TestEntity::destroy(WorldEntity* killer) 129 129 { 130 130 if( this->bDeath) -
trunk/src/world_entities/test_entity.h
r8778 r9235 25 25 void setAnim(int animationIndex, int animPlaybackMode); 26 26 27 virtual void destroy( );27 virtual void destroy(WorldEntity* killer); 28 28 29 29 virtual void tick (float time); -
trunk/src/world_entities/weapons/fps_sniper_rifle.cc
r9003 r9235 33 33 #include "fps_sniper_rifle.h" 34 34 35 36 #include "effects/explosion.h" 35 37 36 38 using namespace std; … … 145 147 return; 146 148 147 pj->setParent(PNode::getNullParent());149 // Explosion::explode(this, Vector(0.1,0.1,0.1)); 148 150 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); 150 153 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); 152 157 pj->setAbsDir(this->getAbsDir()); 153 158 pj->activate(); -
trunk/src/world_entities/world_entity.cc
r9110 r9235 85 85 86 86 this->toList(OM_NULL); 87 87 88 88 registerVar( new SynchronizeableString( &this->md2TextureFileName, &this->md2TextureFileName, "md2TextureFileName" ) ); 89 89 modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName" ) ); 90 90 scaling_handle = registerVarId( new SynchronizeableFloat( &scaling, &scaling, "scaling" ) ); 91 91 list_handle = registerVarId( new SynchronizeableInt( (int*)&objectListNumber, &list_write, "list" ) ); 92 92 93 93 health_handle = registerVarId( new SynchronizeableFloat( &this->health, &this->health_write, "health" ) ); 94 94 healthMax_handle = registerVarId( new SynchronizeableFloat( &this->healthMax, &this->healthMax_write, "maxHealth" ) ); … … 209 209 this->buildObbTree(obbTreeDepth); 210 210 } 211 else /*if(fileName.find(".md3") != std::string::npos)*/211 else if(fileName.find(".md3") != std::string::npos) 212 212 { 213 213 PRINTF(4)("fetching MD3 file: %s\n", fileName.c_str()); … … 414 414 bool WorldEntity::registerCollision(WorldEntity* entityA, WorldEntity* entityB, BoundingVolume* bvA, BoundingVolume* bvB) 415 415 { 416 PRINTF(5)("registering collision of type: %s vs %s\n", entityA->getClassName(), entityB->getClassName()); 416 417 // is there any handler listening? 417 418 if( !this->bReactive) … … 571 572 */ 572 573 void WorldEntity::reset() 573 {} 574 { 575 this->setHealth( this->getHealthMax() ); 576 } 574 577 575 578 /** … … 742 745 this->decreaseHealth(damage); 743 746 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()); 745 748 746 749 if( this->getHealth() > 0) … … 750 753 else 751 754 { 752 this->destroy(); 753 754 if( State::getGameRules() != NULL) 755 State::getGameRules()->registerKill(Kill(killer, this)); 755 this->destroy( killer ); 756 756 } 757 757 } … … 761 761 * destoys the world entity 762 762 */ 763 void WorldEntity::destroy( )763 void WorldEntity::destroy(WorldEntity* killer) 764 764 { 765 765 this->toList(OM_DEAD); … … 841 841 this->toList( (OM_LIST)list_write ); 842 842 } 843 843 844 844 if ( std::find( id.begin(), id.end(), health_handle ) != id.end() ) 845 845 { 846 846 this->setHealth( health_write ); 847 847 } 848 848 849 849 if ( std::find( id.begin(), id.end(), healthMax_handle ) != id.end() ) 850 850 { -
trunk/src/world_entities/world_entity.h
r9110 r9235 47 47 48 48 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);} 49 50 void setModel(Model* model, unsigned int modelNumber = 0); 50 51 Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; }; … … 74 75 /** @returns a reference to the obb tree of this worldentity */ 75 76 inline BVTree* getOBBTree() const { return this->obbTree; }; 77 inline void setOBBTree(OBBTree* tree) { /*if( this->obbTree != NULL) delete this->obbTree;*/ this->obbTree = (BVTree*)tree; } 76 78 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;} 78 80 79 81 /* --- Collision Reaction Block --- */ … … 101 103 virtual void hit(float damage, WorldEntity* killer); 102 104 103 virtual void destroy( );105 virtual void destroy( WorldEntity* killer ); 104 106 105 107 … … 198 200 int list_write; //!< entity's list 199 201 int list_handle; //!< handle for list changes 200 202 201 203 float health_write; 202 204 int health_handle; 203 205 204 206 float healthMax_write; 205 207 int healthMax_handle;
Note: See TracChangeset
for help on using the changeset viewer.