Changeset 9939 for code/trunk
- Timestamp:
- Dec 21, 2013, 11:16:54 PM (11 years ago)
- Location:
- code/trunk
- Files:
-
- 74 edited
- 47 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/data/defaultConfig/keybindings.ini
r9526 r9939 58 58 KeyLeftWindows= 59 59 KeyLessThan= 60 KeyM= 60 KeyM="WorldAmbientSound nextsong" 61 61 KeyMail= 62 62 KeyMediaSelect= -
code/trunk/data/gui/scripts/MiscConfigMenu.lua
r9016 r9939 38 38 table.insert(P.commandList, "HUDNavigation MarkerLimit_") 39 39 table.insert(P.commandList, "HUDNavigation showDistance") 40 table.insert(P.commandList, "HUDRadar RadarMode_") 40 41 41 42 P.nameList = {} … … 60 61 table.insert(P.nameList, "Marker Limit") 61 62 table.insert(P.nameList, "Show Distance next to cursor") 63 table.insert(P.nameList, "Set Radar on 3D mode") 62 64 63 65 P.linesList = {} -
code/trunk/data/levels/FPSTest.oxw
r9348 r9939 1 <!-- --> 1 2 <LevelInfo 2 3 name = "FPS testlevel" -
code/trunk/data/levels/Spacerace2.oxw
r9348 r9939 14 14 15 15 ?> 16 16 17 17 18 <?lua … … 107 108 108 109 <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /> 109 110 111 <!-- SOUNDS & MUSIC --> 112 <WorldSound name="scoreSound" position="-200,0,0" source="sounds/ReadyGo.ogg" > 113 <events> 114 <play> 115 <EventListener event="start" /> 116 </play> 117 </events> 118 </WorldSound> 119 <DistanceTrigger name="start" position="-200,0,0" target="Pawn" distance=100 stayActive="true" delay=0.5 /> 120 121 <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" /> 110 122 111 123 <!-- ------------------Planet----------------- --> -
code/trunk/data/levels/asteroidField.oxw
r9348 r9939 11 11 include("templates/lodInformation.oxt") 12 12 ?> 13 <WorldAmbientSound source="Asteroid_rocks.ogg" looping="true" playOnLoad="true" /> 13 14 14 15 <?lua -
code/trunk/data/levels/asteroids.oxw
r9348 r9939 5 5 screenshot = "asteroids.png" 6 6 /> 7 <WorldAmbientSound source="Asteroid_rocks.ogg" looping="true" playOnLoad="true" /> 7 8 8 9 <?lua -
code/trunk/data/levels/docking.oxw
r9348 r9939 1 <!-- --> 1 2 <LevelInfo 2 3 name = "Transporter" -
code/trunk/data/levels/dynamicMatch.oxw
r9348 r9939 5 5 screenshot = "dynamicMatch.png" 6 6 /> 7 <WorldAmbientSound source="Mars.ogg" looping="true" playOnLoad="true" /> 7 8 8 9 <?lua -
code/trunk/data/levels/gallery.oxw
r9763 r9939 36 36 all Objects are organized in columns 37 37 ----> 38 39 <!--- Spacestation ---> 40 <!--Model position="0,0,-160" yaw="90" pitch="-90" roll="0" scale="1" mesh="ss_box_lowpoly.mesh" /--> 41 <Model position="0, 20,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_box_lowpoly_ad1.mesh" /> 42 <Model position="0, 40,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_box_lowpoly_ad2.mesh" /> 43 <Model position="0, 60,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_box_lowpoly_ad3.mesh" /> 44 <Model position="0, 80,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_box_lowpoly_ad4.mesh" /> 45 <Model position="0,-20,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_tube.mesh" /> 46 <Model position="0,-40,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_tube_twd.mesh" /> 47 <Model position="0,-60,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_tube_x.mesh" /> 48 <Model position="0,-80,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_wall.mesh" /> 49 <Model position="0,-100,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_table_cracked.mesh" /> 50 <Model position="0,-120,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_table.mesh" /> 51 <Model position="0,-140,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_spind.mesh" /> 52 <Model position="0,-160,-160" yaw="90" pitch="-90" roll="0" scale="0.01" mesh="ss_machine.mesh" /> 53 <Model position="0,-180,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_flag_room.mesh" /> 54 <Model position="0,-200,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_flag_eu.mesh" /> 55 <Model position="0,-220,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_flag_csa.mesh" /> 56 <Model position="0,-240,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_flag_cau.mesh" /> 57 <Model position="0,-260,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_flag_aean.mesh" /> 58 <Model position="0,-280,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_door.mesh" /> 59 <Model position="0,-300,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_cylinder.mesh" /> 60 <Model position="0,-320,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_curve.mesh" /> 61 <Model position="0,-340,-160" yaw="90" pitch="-90" roll="0" scale="5" mesh="ss_chair.mesh" /> 62 38 63 39 64 <!--- Whole Objects ---> … … 152 177 <!--Model position="0,80,200" yaw="90" pitch="-90" roll="0" scale="5" mesh="SmallPart1.mesh" /--> 153 178 <Model position="0,-20,200" yaw="90" pitch="-90" roll="0" scale="4" mesh="raceCheckPoint.mesh" /> 154 <Model position="0,-40,200" yaw="90" pitch=" -90" roll="0" scale="0.5" mesh="Spacegate.mesh" />179 <Model position="0,-40,200" yaw="90" pitch="0" roll="0" scale="0.5" mesh="Spacegate.mesh" /> 155 180 156 181 <Model position="0,-60,200" yaw="90" pitch="-90" roll="0" scale="0.5" mesh="BigSpacegate.mesh" /> -
code/trunk/data/levels/lastManStanding.oxw
r9555 r9939 32 32 include("includes/pickups.oxi") 33 33 ?> 34 35 <WorldAmbientSound source="Nebula_metal.ogg" looping="true" playOnLoad="true" /> 34 36 35 37 <!----- Spawnpoints -
code/trunk/data/levels/lastTeamStanding.oxw
r9348 r9939 33 33 include("includes/pickups.oxi") 34 34 ?> 35 36 <WorldAmbientSound source="Nebula_metal.ogg" looping="true" playOnLoad="true" /> 35 37 36 38 <Bot /> -
code/trunk/data/levels/lastTeamStandingII.oxw
r9348 r9939 27 27 skybox = "Orxonox/skyBoxBasic" 28 28 > 29 <WorldAmbientSound source="Nebula_metal.ogg" looping="true" playOnLoad="true" /> 30 29 31 <!-- TODO: 30 32 1. make collisionshapes bulletproof: -> attach movable entity with dynamic collisionshape within a static collisionshape -
code/trunk/data/levels/maxim.oxw
r9664 r9939 1 <!-- --> 2 1 3 <LevelInfo 2 4 name = "Maxim's Test" … … 25 27 </templates> 26 28 <?lua include("includes/notifications.oxi") ?> 29 30 <WorldAmbientSound source="Nebula_metal.ogg" looping="true" playOnLoad="true" /> 27 31 28 32 <NotificationQueueCEGUI -
code/trunk/data/levels/missionOne.oxw
r9798 r9939 1 <!----> 1 2 <LevelInfo 2 3 name = "Mission One" -
code/trunk/data/levels/pickups.oxw
r9348 r9939 1 <!-- --> 1 2 <LevelInfo 2 3 name = "Pickups showcase" -
code/trunk/data/levels/pirateAttack.oxw
r9348 r9939 25 25 dofile("includes/CuboidSpaceStation.lua") 26 26 ?> 27 28 <WorldAmbientSound source="Mars.ogg" looping="true" playOnLoad="true" /> 27 29 28 30 <Level -
code/trunk/data/levels/pong.oxw
r9526 r9939 34 34 35 35 <Template name=pongball> 36 <PongBall> 36 <PongBall 37 defScoreSound = "sounds/PlayerWinScore_cut.ogg" 38 defBatSound = "sounds/Button.ogg" 39 defBoundarySound = "sounds/Button.ogg"> 37 40 <attached> 38 41 <Model mesh="sphere.mesh" scale=2 /> -
code/trunk/data/levels/portals.oxw
r9348 r9939 1 1 <!-- --> 2 2 <LevelInfo 3 3 name = "Portals" -
code/trunk/data/levels/presentation.oxw
r9016 r9939 1 <!-- --> 2 1 3 <LevelInfo 2 4 name = "Presentation" -
code/trunk/data/levels/presentationFS11.oxw
r9348 r9939 1 <!----> 2 1 3 <LevelInfo 2 4 name = "Presentation FS11" -
code/trunk/data/levels/quests.oxw
r9016 r9939 1 <!-- --> 1 2 <LevelInfo 2 3 name = "Quests showcase" -
code/trunk/data/levels/spaceRace.oxw
r9016 r9939 29 29 skybox = "Orxonox/skyBoxMoreNebula" 30 30 > 31 32 <!-- SOUNDS & MUSIC --> 33 <WorldSound name="scoreSound" position="0,-2100,0" source="sounds/ReadyGo.ogg" > 34 <events> 35 <play> 36 <EventListener event="start" /> 37 </play> 38 </events> 39 </WorldSound> 40 <DistanceTrigger name="start" position="0,-2100,0" target="Pawn" distance=100 stayActive="true" delay=0.5 /> 41 42 <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" /> 43 31 44 32 45 <?lua math.randomseed(98) ?> … … 463 476 </controller> 464 477 </SpaceShip> 478 479 465 480 466 481 </Scene> -
code/trunk/data/levels/surfaceRace.oxw
r9348 r9939 10 10 tags = "gametype" 11 11 /> 12 12 13 13 14 <?lua … … 445 446 ?> 446 447 <?lua end ?> 448 449 <!-- SOUNDS & MUSIC --> 450 <WorldSound name="scoreSound" position="0,8050,0" source="sounds/ReadyGo.ogg" > 451 <events> 452 <play> 453 <EventListener event="start" /> 454 </play> 455 </events> 456 </WorldSound> 457 <DistanceTrigger name="start" position="0,8050,0" target="Pawn" distance=100 stayActive="true" delay=0.5 /> 458 <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true" /> 447 459 448 460 </Scene> -
code/trunk/data/levels/teamBaseMatch.oxw
r9348 r9939 19 19 > 20 20 21 <WorldAmbientSound source="Jupiter.ogg" looping="true" playOnLoad="true" /> 22 21 23 <templates> 22 24 <Template link=lodtemplate_default /> -
code/trunk/data/levels/teamDeathMatch.oxw
r9348 r9939 22 22 </templates> 23 23 <?lua include("includes/notifications.oxi") ?> 24 25 <WorldAmbientSound source="Jupiter.ogg" looping="true" playOnLoad="true" /> 24 26 25 27 <Scene -
code/trunk/data/levels/templates/lodInformation.oxt
r9763 r9939 17 17 <MeshLodInformation mesh=turretHead.mesh enabled=false /> 18 18 <MeshLodInformation mesh=LaserBeam2.mesh enabled=false/> 19 <MeshLodInformation mesh=asteroid_ice.mesh enabled=false/> 20 <MeshLodInformation mesh=ast1.mesh lodQuality=0.1/> 21 <MeshLodInformation mesh=ast2.mesh lodQuality=0.1/> 22 <MeshLodInformation mesh=ast3.mesh lodQuality=0.1/> 23 <MeshLodInformation mesh=ast4.mesh lodQuality=0.1/> 24 <MeshLodInformation mesh=ast5.mesh lodQuality=0.1/> 25 <MeshLodInformation mesh=ast6.mesh lodQuality=0.1/> 19 26 20 27 <!-- disable LOD for some debris meshes which caused a crash (fixed in Ogre 1.7.3) --> 21 28 <MeshLodInformation mesh=BodyDebris1.mesh enabled=false/> 22 29 <MeshLodInformation mesh=WingDebris2.mesh enabled=false/> 30 <MeshLodInformation mesh=HeavyCruiser_body.mesh enabled=false/> 31 <MeshLodInformation mesh=HeavyCruiser_frontL.mesh enabled=false/> 32 <MeshLodInformation mesh=HeavyCruiser_frontR.mesh enabled=false/> 33 <MeshLodInformation mesh=HeavyCruiser_partL.mesh enabled=false/> 34 <MeshLodInformation mesh=HeavyCruiser_partR.mesh enabled=false/> 35 <MeshLodInformation mesh=HeavyCruiser_sidearmL.mesh enabled=false/> 36 <MeshLodInformation mesh=HeavyCruiser_sidearmLfront.mesh enabled=false/> 37 <MeshLodInformation mesh=HeavyCruiser_sidearmR.mesh enabled=false/> 38 <MeshLodInformation mesh=HeavyCruiser_sidearmRfront.mesh enabled=false/> 39 40 <MeshLodInformation mesh=ss_cylinder.mesh enabled=false/> 41 <MeshLodInformation mesh=ss_chair.mesh enabled=false/> 42 <MeshLodInformation mesh=ss_flag_room.mesh enabled=false/> 43 <MeshLodInformation mesh=ss_wall.mesh enabled=false/> 44 <MeshLodInformation mesh=ss_tube_twd.mesh enabled=false/> 45 <MeshLodInformation mesh=ss_spind.mesh enabled=false/> 46 23 47 </lodinformation> 24 48 </Level> -
code/trunk/data/levels/templates/spaceshipAssff.oxt
r8860 r9939 37 37 linearDamping = 0.7 38 38 angularDamping = 0.9999999 39 40 explosionSound = "sounds/Explosion2.ogg" 39 41 > 40 42 <engines> … … 82 84 defEngineSndNormal = "sounds/Engine_low.ogg" 83 85 defEngineSndBoost = "sounds/Engine_high.ogg" 84 86 85 87 accelerationfront = 500 86 88 accelerationbrake = 500 -
code/trunk/data/levels/turretTest.oxw
r9664 r9939 1 <!-- --> 2 1 3 <LevelInfo 2 4 name = "turret Test" -
code/trunk/data/levels/underAttack.oxw
r9348 r9939 1 <!----> 2 1 3 <LevelInfo 2 4 name = "Under Attack" … … 20 22 </templates> 21 23 <?lua include("includes/notifications.oxi") ?> 24 <WorldAmbientSound source="Jupiter.ogg" looping="true" playOnLoad="true" /> 22 25 23 26 <Scene -
code/trunk/data/overlays/HUD.oxo
r9526 r9939 68 68 <HUDRadar 69 69 name = "Radar" 70 background = "Orxonox/ Radar"70 background = "Orxonox/radar" 71 71 correctAspect = true 72 72 size = "0.17, 0.17" -
code/trunk/data/overlays/HUDTemplates3.oxo
r9526 r9939 108 108 /> 109 109 110 <HUDRadar 111 name = "Radar" 112 background = "Orxonox/Radar" 113 correctaspect = true 114 size = "0.17, 0.17" 115 position = "1.0, 1.0" 116 pickpoint = "1.0, 1.0" 117 rotation = 0 118 sensitivity = 1.0 119 halfDotSizeDistance = 3000 120 maximumDotSize = 0.1 110 <HUDRadar 111 name = "Radar" 112 background = "Orxonox/Radar3D" 113 material2D = "Orxonox/Radar" 114 material3DMiddle = "Orxonox/Radar3D" 115 material3DFront = "Orxonox/Radar3DFront" 116 material3DBack = "Orxonox/Radar3DBack" 117 correctaspect = true 118 size = "0.17, 0.17" 119 position = "1.0, 1.0" 120 pickpoint = "1.0, 1.0" 121 rotation = 0 122 sensitivity = 1.0 123 halfDotSizeDistance = 3000 124 detectionLimit = 10000.0 125 maximumDotSize = 0.1 126 maximumDotSize3D = 0.06 127 mapAngle3D = 0.6435011 121 128 /> 122 129 123 130 <HUDTimer 124 131 name = "Timer" -
code/trunk/data/overlays/debug.oxo
r8858 r9939 32 32 name = "RTRText" 33 33 position = "0.3, 0.09" 34 font = "Monofur" 35 textsize = 0.03 36 /> 37 38 <OverlayText 39 name = "PositionTextCaption" 40 position = "0.03, 0.13" 41 font = "Monofur" 42 caption = "Position: " 43 textsize = 0.03 44 /> 45 46 <DebugPositionText 47 name = "PositionText" 48 position = "0.3, 0.13" 34 49 font = "Monofur" 35 50 textsize = 0.03 -
code/trunk/src/libraries/util/Math.cc
r8400 r9939 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Wolfgang Roenninger 26 26 * 27 27 */ … … 147 147 148 148 /** 149 @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0 ° = 0, 180°= 1).149 @brief Gets the 2D viewing direction (up/down, left/right) to the position of the other object, multiplied with the viewing distance to the object (0� = 0, 180� = 1). 150 150 @param myposition My position 151 151 @param mydirection My viewing direction … … 189 189 else 190 190 return orxonox::Vector2( -sin_value * radius, cos_value * radius); 191 } 192 193 194 /** 195 @brief Gets the 2D project vector for the 3D Radar . 196 @param myposition My position 197 @param mydirection My viewing direction 198 @param myorthonormal My orthonormalvector (pointing upwards through my head) 199 @param otherposition The position of the other object 200 @param mapangle The angle between line of sight on screen and the 3Dmap-x/z-plain in radian 201 @param detectionlimit The limit in which objects are shown on the map 202 @return The viewing direction 203 */ 204 orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit) 205 { 206 // Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right 207 orxonox::Vector3 distance = otherposition - myposition; // get vector from Ship to object 208 209 // new coordinate system: x_axsis: mydirection (points front) 210 // y_axsis: myorthonormal (points up) 211 // z_axsis: myside (points right) 212 213 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get 3. base vector 214 215 distance = 4*distance / detectionlimit; // shrink vector on map 216 if(distance.length() > 1.0f) // if object would wander outside of the map 217 { 218 distance = distance / distance.length(); 219 } 220 221 // perform a coordinate transformation to get distance in relation of the position of the ship 222 orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside); 223 224 // calculate 2D vector on the map (with angle between x/z - plain and line of sight) 225 float xcoordinate = distanceShip.z; // z; cause x direction on screen is to the right side 226 float ycoordinate = distanceShip.x*sin(mapangle)+distanceShip.y*cos(mapangle); 227 return orxonox::Vector2(xcoordinate , ycoordinate); 228 } 229 230 /** 231 @brief Gets if a object is over the x/z - plain on map 232 @param myposition My position 233 @param mydirection My viewing direction 234 @param myorthonormal My orthonormalvector (pointing upwards through my head) 235 @param otherposition The position of the other object 236 @param mapangle The angle you look on the 3Dmap in radian 237 @return If distancevector to the other object has a positive y-coordinate 238 239 Examples: 240 Returns true if object is over x/z - plain 241 Returns false if object is below x/z -plain 242 */ 243 bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle) 244 { 245 // Orxonox Vectors: x_direction you are looking, y_direction points up, z_direction points to the right 246 orxonox::Vector3 distance = otherposition - myposition; 247 248 // new coordinate system: x_axsis: mydirection (points front) 249 // y_axsis: myorthonormal (points up) 250 // z_axsis: myside (points right) 251 252 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector from Ship to object 253 254 255 // perform a coordinate transformation to get distance in relation of the position of the ship 256 orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside); 257 258 if(distanceShip.y >= 0) 259 return true; 260 else 261 return false; 262 } 263 264 /** 265 @brief A value between 0 and 10, in order how other object is in front or in back 266 @param myposition My position 267 @param mydirection My viewing direction 268 @param myorthonormal My orthonormalvector (pointing upwards through my head) 269 @param otherposition The position of the other object 270 @param detectionlimit The limit in which objects are shown on the map 271 @return value between 0 and 100 272 */ 273 int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit) 274 { 275 orxonox::Vector3 distance = otherposition - myposition; // get vector from Ship to object 276 orxonox::Vector3 myside = mydirection.crossProduct(myorthonormal); // get vector to the side 277 278 distance = 4*distance / detectionlimit; // shrink vector on map 279 if(distance.length() > 1.0f) // if object would wander outside of the map 280 { 281 distance = distance / distance.length(); 282 } 283 284 // perform a coordinate transformation to get distance in relation of the position of the ship 285 orxonox::Vector3 distanceShip = getTransformedVector(distance, mydirection, myorthonormal, myside); 286 287 return (int) 50 - 100*distanceShip.x; 288 } 289 290 291 /** 292 @brief Gets the new vector after a coordinate transformation 293 @param distance Vector which will be transformed 294 @param mydirection New x basevector 295 @param myorthonormal New y basevector 296 @param otherposition New z basevector 297 @return direction in the new coordinates 298 299 x is vector in old coordinates 300 y is vector in old coordinates 301 T is transform matrix with: 302 T = (t1 , t2 , t3) 303 t1 = mydirection 304 t2 = myorthonormal 305 t3 = myside 306 307 y = T^(-1)*x 308 */ 309 orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside) 310 { 311 // inverse of the transform matrix 312 float determinant = +mydirection.x * (myorthonormal.y*myside.z - myside.y*myorthonormal.z) 313 -mydirection.y * (myorthonormal.x*myside.z - myorthonormal.z*myside.x) 314 +mydirection.z * (myorthonormal.x*myside.y - myorthonormal.y*myside.x); 315 float invdet = 1/determinant; 316 317 // transform matrix 318 orxonox::Vector3 xinvtransform; 319 orxonox::Vector3 yinvtransform; 320 orxonox::Vector3 zinvtransform; 321 322 xinvtransform.x = (myorthonormal.y * myside.z - myside.y * myorthonormal.z)*invdet; 323 xinvtransform.y = (mydirection.z * myside.y - mydirection.y * myside.z )*invdet; 324 xinvtransform.z = (mydirection.y * myorthonormal.z - mydirection.z * myorthonormal.y)*invdet; 325 yinvtransform.x = (myorthonormal.z * myside.x - myorthonormal.x * myside.z )*invdet; 326 yinvtransform.y = (mydirection.x * myside.z - mydirection.z * myside.x )*invdet; 327 yinvtransform.z = (myorthonormal.x * mydirection.z - mydirection.x * myorthonormal.z)*invdet; 328 zinvtransform.x = (myorthonormal.x * myside.y - myside.x * myorthonormal.y)*invdet; 329 zinvtransform.y = (myside.x * mydirection.y - mydirection.x * myside.y )*invdet; 330 zinvtransform.z = (mydirection.x * myorthonormal.y - myorthonormal.x * mydirection.y )*invdet; 331 332 // coordinate transformation 333 orxonox::Vector3 distanceShip; 334 distanceShip.x = xinvtransform.x * distance.x + yinvtransform.x * distance.y + zinvtransform.x * distance.z; 335 distanceShip.y = xinvtransform.y * distance.x + yinvtransform.y * distance.y + zinvtransform.y * distance.z; 336 distanceShip.z = xinvtransform.z * distance.x + yinvtransform.z * distance.y + zinvtransform.z * distance.z; 337 338 return distanceShip; 191 339 } 192 340 -
code/trunk/src/libraries/util/Math.h
r9550 r9939 23 23 * Fabian 'x3n' Landau 24 24 * Co-authors: 25 * ...25 * Wolfgang Roenninger 26 26 * 27 27 */ … … 92 92 _UtilExport orxonox::Vector2 get2DViewdirection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition); 93 93 _UtilExport orxonox::Vector2 get2DViewcoordinates(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition); 94 _UtilExport orxonox::Vector2 get3DProjection(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle, const float detectionlimit); 95 _UtilExport bool isObjectHigherThanShipOnMap(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float mapangle); 96 _UtilExport int determineMap3DZOrder(const orxonox::Vector3& myposition, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& otherposition, const float detectionlimit); 97 _UtilExport orxonox::Vector3 getTransformedVector(const orxonox::Vector3& distance, const orxonox::Vector3& mydirection, const orxonox::Vector3& myorthonormal, const orxonox::Vector3& myside); 94 98 _UtilExport orxonox::Vector3 getPredictedPosition(const orxonox::Vector3& myposition, float projectilespeed, const orxonox::Vector3& targetposition, const orxonox::Vector3& targetvelocity); 95 99 -
code/trunk/src/modules/CMakeLists.txt
r9348 r9939 39 39 ADD_SUBDIRECTORY(docking) 40 40 ADD_SUBDIRECTORY(towerdefense) 41 ADD_SUBDIRECTORY(invader) -
code/trunk/src/modules/docking/Dock.cc
r9667 r9939 69 69 XMLPortObject(Dock, DockingAnimation, "animations", addAnimation, getAnimation, xmlelement, mode); 70 70 XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode); 71 XMLPortEventSink(Dock, BaseObject, "undocking", undocking, xmlelement, mode); 72 71 73 } 72 74 … … 76 78 77 79 XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode); 78 } 80 81 XMLPortEventSink(Dock, BaseObject, "undocking", undocking, xmlelement, mode); 82 } 83 84 85 bool Dock::undocking(bool bTriggered, BaseObject* trigger) 86 { 87 88 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 89 PlayerInfo* player = NULL; 90 91 // Check whether it is a player trigger and extract pawn from it 92 if(pTrigger != NULL) 93 { 94 if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. 95 orxout(verbose, context::docking) << "Docking:execute PlayerTrigger was not triggered by a player.." << endl; 96 return false; 97 } 98 player = pTrigger->getTriggeringPlayer(); 99 } 100 else 101 { 102 orxout(verbose, context::docking) << "Docking::execute Not a player trigger, can't extract pawn from it.." << endl; 103 return false; 104 } 105 if(player == NULL) 106 { 107 orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl; 108 return false; 109 } 110 111 if(bTriggered) 112 { 113 // Add player to this Docks candidates 114 candidates_.insert(player); 115 116 // Show docking dialog 117 this->showUndockingDialogHelper(player); 118 } 119 else 120 { 121 // Remove player from candidates list 122 candidates_.erase(player); 123 } 124 125 return true; 126 } 127 128 79 129 80 130 bool Dock::execute(bool bTriggered, BaseObject* trigger) … … 119 169 return true; 120 170 } 171 172 173 void Dock::showUndockingDialogHelper(PlayerInfo* player) 174 { 175 assert(player); 176 177 if(!player->isHumanPlayer()) 178 return; 179 180 if(GameMode::isMaster()) 181 { 182 if(GameMode::showsGraphics()) 183 GUIManager::showGUI("UndockingDialog"); 184 } 185 else 186 callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID()); 187 188 } 121 189 122 190 void Dock::showDockingDialogHelper(PlayerInfo* player) … … 177 245 if (animations_.empty()) 178 246 return dockingAnimationFinished(player); 247 179 248 else 180 249 DockingAnimation::invokeAnimation(true, player, animations_); -
code/trunk/src/modules/docking/Dock.h
r9667 r9939 62 62 // Trigger interface 63 63 bool execute(bool bTriggered, BaseObject* trigger); 64 bool undocking(bool bTriggered, BaseObject* trigger); 64 65 65 66 // XML interface … … 85 86 void dock() 86 87 { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); } 88 void undock() 89 { this->undock(HumanController::getLocalControllerSingleton()->getPlayer()); } 87 90 static unsigned int getNumberOfActiveDocks(); 88 91 static Dock* getActiveDockAtIndex(unsigned int index); … … 95 98 // Network functions 96 99 void showDockingDialogHelper(PlayerInfo* player); 100 void showUndockingDialogHelper(PlayerInfo* player); 97 101 static void showDockingDialog(); 98 102 -
code/trunk/src/modules/docking/MoveToDockingTarget.cc
r9667 r9939 66 66 { 67 67 //TODO: Investigate strange things... 68 68 //this->parent_->detach((WorldEntity*)player->getControllableEntity()); 69 69 70 //TODO: Check the issue with this detach call. 71 //I have removed the line because the detach call only caused a warning and terminated. And because I didn't find a attach call either. 72 //Didn't find the need for the line. 70 73 this->parent_->undockingAnimationFinished(player); 71 74 return true; -
code/trunk/src/modules/objects/ForceField.cc
r9667 r9939 45 45 /*static*/ const std::string ForceField::modeSphere_s = "sphere"; 46 46 /*static*/ const std::string ForceField::modeInvertedSphere_s = "invertedSphere"; 47 48 /*static*/ const std::string ForceField::modeHomogen_s = "homogen"; 49 47 50 /*static*/ const std::string ForceField::modeNewtonianGravity_s = "newtonianGravity"; 48 51 /*static*/ const float ForceField::gravConstant_ = 6.673e-11; 49 52 /*static*/ const float ForceField::attenFactor_ = 1; 53 50 54 51 55 /** … … 89 93 XMLPortParam(ForceField, "length", setLength , getLength , xmlelement, mode).defaultValues(2000); 90 94 XMLPortParam(ForceField, "mode", setMode, getMode, xmlelement, mode); 95 XMLPortParam(ForceField, "forcedirection", setForceDirection, getForceDirection, xmlelement, mode).defaultValues(Vector3(0,-400,0)); 91 96 } 92 97 … … 196 201 } 197 202 } 203 else if(this->mode_ == forceFieldMode::homogen) 204 { 205 // Iterate over all objects that could possibly be affected by the ForceField. 206 for (ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it) 207 { 208 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition(); 209 float distance = distanceVector.length(); 210 if (distance < this->radius_ && distance > this->massRadius_) 211 { 212 // Add a Acceleration in forceDirection_. 213 // Vector3(0,0,0) is the direction, where the force should work. 214 it->addAcceleration(forceDirection_ , Vector3(0,0,0)); 215 } 216 } 217 } 198 218 } 199 219 … … 214 234 else if(mode == ForceField::modeNewtonianGravity_s) 215 235 this->mode_ = forceFieldMode::newtonianGravity; 236 237 else if(mode == ForceField::modeHomogen_s) 238 this->mode_ = forceFieldMode::homogen; 239 216 240 else 217 241 { … … 239 263 case forceFieldMode::newtonianGravity: 240 264 return ForceField::modeNewtonianGravity_s; 265 266 case forceFieldMode::homogen: 267 return ForceField::modeHomogen_s; 268 241 269 default: 242 270 return ForceField::modeTube_s; -
code/trunk/src/modules/objects/ForceField.h
r9667 r9939 1 1 2 /* 2 3 * ORXONOX - the hottest 3D action shooter ever to exist … … 57 58 sphere, //!< The ForceField has a spherical shape. 58 59 invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior. 59 newtonianGravity //!< The ForceField imitates Newtonian gravitation for use in stellar bodies. 60 newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies. 61 homogen //!< Local homogenous Force field with changeable direction for the Space Station 60 62 }; 61 63 } … … 66 68 67 69 The following parameters can be set to specify the behavior of the ForceField. 70 - @b forcedirection The direction and the strength of the homogenous force field. Default is 0,-400,0. 68 71 - @b velocity The amount of force the ForceField excerts. Default is 100. 69 72 - @b diameter The diameter of the ForceField. Default is 500. … … 147 150 { return this->halfLength_*2; } 148 151 152 inline void setForceDirection(Vector3 forcedir) 153 { this->forceDirection_ = forcedir; } 154 155 inline Vector3 getForceDirection() 156 { return this->forceDirection_; } 157 158 149 159 void setMode(const std::string& mode); //!< Set the mode of the ForceField. 150 160 const std::string& getMode(void); //!< Get the mode of the ForceField. … … 156 166 static const std::string modeInvertedSphere_s; 157 167 static const std::string modeNewtonianGravity_s; 168 169 static const std::string modeHomogen_s; 158 170 159 171 float velocity_; //!< The velocity of the ForceField. … … 167 179 //! Attenuation factor for Newtonian ForceFields 168 180 static const float attenFactor_; 181 Vector3 forceDirection_; 169 182 }; 170 183 } -
code/trunk/src/modules/overlays/OverlaysPrereqs.h
r9526 r9939 80 80 class BarColour; 81 81 class ChatOverlay; 82 class CountDown; 82 83 class DeathMessage; 83 84 class GametypeFadingMessage; -
code/trunk/src/modules/overlays/debugging/CMakeLists.txt
r5781 r9939 2 2 DebugFPSText.cc 3 3 DebugRTRText.cc 4 DebugPositionText.cc 4 5 ) -
code/trunk/src/modules/overlays/hud/CMakeLists.txt
r9348 r9939 18 18 PauseNotice.cc 19 19 LastTeamStandingInfos.cc 20 CountDown.cc 20 21 ) -
code/trunk/src/modules/overlays/hud/HUDNavigation.cc
r9667 r9939 74 74 OrxonoxOverlay(context) 75 75 { 76 RegisterObject(HUDNavigation) 77 ;this->setConfigValues();76 RegisterObject(HUDNavigation); 77 this->setConfigValues(); 78 78 79 79 // Set default values -
code/trunk/src/modules/overlays/hud/HUDRadar.cc
r9667 r9939 25 25 * Co-authors: 26 26 * Reto Grieder 27 * Wolfgang Roenninger 27 28 * 28 29 */ … … 41 42 #include "Scene.h" 42 43 #include "Radar.h" 44 #include "core/config/ConfigValueIncludes.h" 43 45 44 46 namespace orxonox … … 50 52 { 51 53 RegisterObject(HUDRadar); 54 this->setConfigValues(); 52 55 53 56 this->marker_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() … … 60 63 this->setHalfDotSizeDistance(3000.0f); 61 64 this->setMaximumDotSize(0.1f); 65 this->setMaximumDotSize3D(0.07f); 62 66 63 67 this->shapeMaterials_[RadarViewable::Dot] = "RadarDot.png"; 64 68 this->shapeMaterials_[RadarViewable::Triangle] = "RadarTriangle.png"; 65 69 this->shapeMaterials_[RadarViewable::Square] = "RadarSquare.png"; 66 this->setDetectionLimit( 10000.0f );67 70 this->owner_ = 0; 71 72 this->map3DFront_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 73 .createOverlayElement("Panel", "HUDRadar_mapDreiDFront_" + getUniqueNumberString())); 74 this->map3DFront_->setMaterialName("Orxonox/Radar3DFront"); 75 this->overlay_->add2D(this->map3DFront_); 76 this->map3DFront_->hide(); 77 78 this->map3DBack_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 79 .createOverlayElement("Panel", "HUDRadar_mapDreiDBack_" + getUniqueNumberString())); 80 this->map3DBack_->setMaterialName("Orxonox/Radar3DBack"); 81 this->overlay_->add2D(this->map3DBack_); 82 this->map3DBack_->hide(); 83 68 84 } 69 85 … … 73 89 { 74 90 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->marker_); 91 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DFront_); 92 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_); 93 75 94 for (std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it = this->radarObjects_.begin(); 76 95 it != this->radarObjects_.end(); ++it) … … 80 99 } 81 100 } 101 102 103 104 void HUDRadar::setConfigValues() 105 { 106 SetConfigValue(RadarMode_, true); 107 } 82 108 83 109 void HUDRadar::XMLPort(Element& xmlelement, XMLPort::Mode mode) … … 88 114 XMLPortParam(HUDRadar, "halfDotSizeDistance", setHalfDotSizeDistance, getHalfDotSizeDistance, xmlelement, mode); 89 115 XMLPortParam(HUDRadar, "maximumDotSize", setMaximumDotSize, getMaximumDotSize, xmlelement, mode); 116 XMLPortParam(HUDRadar, "maximumDotSize3D", setMaximumDotSize3D, getMaximumDotSize3D, xmlelement, mode); 117 XMLPortParam(HUDRadar, "material2D", set2DMaterial, get2DMaterial, xmlelement, mode); 118 XMLPortParam(HUDRadar, "material3DMiddle", set3DMaterial, get3DMaterial, xmlelement, mode); 119 XMLPortParam(HUDRadar, "material3DFront", set3DMaterialFront, get3DMaterialFront, xmlelement, mode); 120 XMLPortParam(HUDRadar, "material3DBack", set3DMaterialBack, get3DMaterialBack, xmlelement, mode); 121 XMLPortParam(HUDRadar, "mapAngle3D", setMapAngle, getMapAngle, xmlelement, mode); 122 XMLPortParam(HUDRadar, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode); 90 123 } 91 124 … … 152 185 // update the distances for all objects 153 186 std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it; 187 188 189 if(RadarMode_) 190 { 191 this->setBackgroundMaterial(material3D_); 192 this->map3DFront_->_notifyZOrder(this->overlay_->getZOrder() * 100 + 250); // it seems that the ZOrder of overlayelements is 100 times the ZOrder of the overlay 193 this->map3DBack_->_notifyZOrder(this->overlay_->getZOrder() * 100 - 250); // 250 a little bit buffer so that the two shels are displayed all in the front / in the back 194 this->map3DFront_->show(); 195 this->map3DBack_->show(); 196 } 197 else 198 { 199 this->setBackgroundMaterial(material2D_); 200 this->map3DFront_->hide(); 201 this->map3DBack_->hide(); 202 } 203 154 204 for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it ) 155 205 { … … 165 215 float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length(); 166 216 // calculate the size with 1/distance dependency for simplicity (instead of exp(-distance * lambda) 167 float size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale(); 217 218 float size; 219 if(RadarMode_) 220 size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale(); 221 else 222 size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale(); 168 223 it->second->setDimensions(size, size); 169 224 170 225 // calc position on radar... 171 Vector2 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition()); 226 Vector2 coord; 227 228 if(RadarMode_) 229 { 230 coord = get3DProjection(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), 0.6435011, detectionLimit_); 231 232 // set zOrder on screen 233 bool overXZPlain = isObjectHigherThanShipOnMap(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), this->mapAngle_); 234 235 int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_); 236 if(overXZPlain == false /*&& (it->second->getZOrder() > 100 * this->overlay_->getZOrder())*/) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay 237 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder); 238 if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/) 239 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder); 240 } 241 else 242 coord = get2DViewcoordinates(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition()); 243 172 244 coord *= math::pi / 3.5f; // small adjustment to make it fit the texture 173 245 it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f); 246 174 247 if( distance < detectionLimit_ || detectionLimit_ < 0 ) 175 248 it->second->show(); … … 182 255 this->marker_->setDimensions(size * 1.5f, size * 1.5f); 183 256 this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f); 257 if(RadarMode_) 258 this->marker_->_notifyZOrder(it->second->getZOrder() -1); 184 259 this->marker_->show(); 185 260 } -
code/trunk/src/modules/overlays/hud/HUDRadar.h
r9667 r9939 35 35 #include <map> 36 36 #include <vector> 37 #include <string> 37 38 38 39 #include "util/OgreForwardRefs.h" … … 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 52 53 virtual void changedOwner(); 54 void setConfigValues(); 53 55 54 56 private: … … 57 59 void setHalfDotSizeDistance(float distance) { this->halfDotSizeDistance_ = distance; } 58 60 59 void setDetectionLimit( float limit ) 60 { this->detectionLimit_ = limit; } 61 float getDetectionLimit() const 62 { return this->detectionLimit_; } 61 void setDetectionLimit( float limit ) { this->detectionLimit_ = limit; } 62 float getDetectionLimit() const { return this->detectionLimit_; } 63 63 64 64 float getMaximumDotSize() const { return this->maximumDotSize_; } 65 65 void setMaximumDotSize(float size) { this->maximumDotSize_ = size; } 66 66 67 float getMaximumDotSize3D() const { return this->maximumDotSize3D_; } 68 void setMaximumDotSize3D(float size) { this->maximumDotSize3D_ = size;} 69 70 std::string get2DMaterial() const {return this->material2D_; } 71 void set2DMaterial(std::string material2D) { this->material2D_ = material2D; } 72 73 std::string get3DMaterial() const {return this->material3D_; } 74 void set3DMaterial(std::string material3D) { this->material3D_ = material3D; } 75 76 std::string get3DMaterialFront() const {return this->material3DFront_; } 77 void set3DMaterialFront(std::string material3DFront) { this->material3DFront_ = material3DFront; } 78 79 std::string get3DMaterialBack() const {return this->material3DBack_; } 80 void set3DMaterialBack(std::string material3DBack) { this->material3DBack_ = material3DBack; } 81 67 82 float getRadarSensitivity() const { return this->sensitivity_; } 68 83 // used also by RadarListener interface! 69 84 void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; } 85 86 // Determines angle between line of sight and x/z-plain on the 3D minimap 87 float getMapAngle() const { return this->mapAngle_; } 88 void setMapAngle(float mapAngle) { this->mapAngle_ = mapAngle; } 70 89 71 90 // RadarListener interface … … 85 104 Ogre::PanelOverlayElement* marker_; 86 105 106 bool RadarMode_; // Determines, if Radar runs in 3D or 2D Mode 107 87 108 float halfDotSizeDistance_; 88 109 float maximumDotSize_; 110 float maximumDotSize3D_; 111 float mapAngle_; 112 113 std::string material2D_; //Material name for 2D map 114 std::string material3D_; //Material names For the 3D minimap 115 std::string material3DFront_; 116 std::string material3DBack_; 117 118 Ogre::PanelOverlayElement* map3DFront_; //Overlayelements for the 3D minimap to be able to draw the points in a semi 3D matter 119 Ogre::PanelOverlayElement* map3DBack_; 89 120 90 121 float sensitivity_; -
code/trunk/src/modules/pong/Pong.cc
r9667 r9939 47 47 #include "PongBot.h" 48 48 #include "PongAI.h" 49 49 50 namespace orxonox 50 51 { … … 117 118 } 118 119 } 120 119 121 } 120 122 -
code/trunk/src/modules/pong/PongBall.cc
r9667 r9939 40 40 41 41 #include "PongBat.h" 42 43 #include "sound/WorldSound.h" 44 #include "core/XMLPort.h" 42 45 43 46 namespace orxonox … … 66 69 67 70 this->registerVariables(); 71 72 //initialize sound 73 if (GameMode::isMaster()) 74 { 75 this->defScoreSound_ = new WorldSound(this->getContext()); 76 this->defScoreSound_->setVolume(1.0f); 77 this->defBatSound_ = new WorldSound(this->getContext()); 78 this->defBatSound_->setVolume(0.4f); 79 this->defBoundarySound_ = new WorldSound(this->getContext()); 80 this->defBoundarySound_->setVolume(0.5f); 81 } 82 else 83 { 84 this->defScoreSound_ = 0; 85 this->defBatSound_ = 0; 86 this->defBoundarySound_ = 0; 87 } 68 88 } 69 89 … … 81 101 delete[] this->batID_; 82 102 } 103 } 104 105 //xml port for loading sounds 106 void PongBall::XMLPort(Element& xmlelement, XMLPort::Mode mode) 107 { 108 SUPER(PongBall, XMLPort, xmlelement, mode); 109 XMLPortParam(PongBall, "defScoreSound", setDefScoreSound, getDefScoreSound, xmlelement, mode); 110 XMLPortParam(PongBall, "defBatSound", setDefBatSound, getDefBatSound, xmlelement, mode); 111 XMLPortParam(PongBall, "defBoundarySound", setDefBoundarySound, getDefBoundarySound, xmlelement, mode); 83 112 } 84 113 … … 117 146 if (position.z > this->fieldHeight_ / 2 || position.z < -this->fieldHeight_ / 2) 118 147 { 119 // Its velocity in z-direction is inverted (i.e. it bounces off). 148 defBoundarySound_->play(); //play boundary sound 149 // Its velocity in z-direction is inverted (i.e. it bounces off). 120 150 velocity.z = -velocity.z; 121 151 // And its position is set as to not overstep the boundary it has just crossed. … … 142 172 if (fabs(distance) <= 1) // If the bat is there to parry. 143 173 { 144 // Set the ball to be exactly at the boundary. 174 defBatSound_->play(); //play bat sound 175 // Set the ball to be exactly at the boundary. 145 176 position.x = this->fieldWidth_ / 2; 146 177 // Invert its velocity in x-direction (i.e. it bounces off). … … 155 186 else if (GameMode::isMaster() && position.x > this->fieldWidth_ / 2 * (1 + this->relMercyOffset_)) 156 187 { 188 defScoreSound_->play();//play score sound 157 189 if (this->getGametype() && this->bat_[0]) 158 190 { … … 169 201 if (fabs(distance) <= 1) // If the bat is there to parry. 170 202 { 171 // Set the ball to be exactly at the boundary. 203 defBatSound_->play(); //play bat sound 204 // Set the ball to be exactly at the boundary. 172 205 position.x = -this->fieldWidth_ / 2; 173 206 // Invert its velocity in x-direction (i.e. it bounces off). … … 182 215 else if (GameMode::isMaster() && position.x < -this->fieldWidth_ / 2 * (1 + this->relMercyOffset_)) 183 216 { 217 defScoreSound_->play();//play score sound 184 218 if (this->getGametype() && this->bat_[1]) 185 219 { … … 262 296 this->bat_[1] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[1])); 263 297 } 298 299 void PongBall::setDefScoreSound(const std::string &pongSound) 300 { 301 if( defScoreSound_ ) 302 defScoreSound_->setSource(pongSound); 303 else 304 assert(0); // This should never happen, because soundpointer is only available on master 305 } 306 307 const std::string& PongBall::getDefScoreSound() 308 { 309 if( defScoreSound_ ) 310 return defScoreSound_->getSource(); 311 else 312 assert(0); 313 return BLANKSTRING; 314 } 315 316 void PongBall::setDefBatSound(const std::string &pongSound) 317 { 318 if( defBatSound_ ) 319 defBatSound_->setSource(pongSound); 320 else 321 assert(0); // This should never happen, because soundpointer is only available on master 322 } 323 324 const std::string& PongBall::getDefBatSound() 325 { 326 if( defBatSound_ ) 327 return defBatSound_->getSource(); 328 else 329 assert(0); 330 return BLANKSTRING; 331 } 332 333 void PongBall::setDefBoundarySound(const std::string &pongSound) 334 { 335 if( defBoundarySound_ ) 336 defBoundarySound_->setSource(pongSound); 337 else 338 assert(0); // This should never happen, because soundpointer is only available on master 339 } 340 341 const std::string& PongBall::getDefBoundarySound() 342 { 343 if( defBoundarySound_ ) 344 return defBoundarySound_->getSource(); 345 else 346 assert(0); 347 return BLANKSTRING; 348 } 264 349 } -
code/trunk/src/modules/pong/PongBall.h
r9667 r9939 42 42 #include "worldentities/MovableEntity.h" 43 43 44 44 45 namespace orxonox 45 46 { … … 63 64 64 65 virtual void tick(float dt); 66 67 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 65 68 66 69 /** … … 123 126 static const float MAX_REL_Z_VELOCITY; 124 127 128 void setDefScoreSound(const std::string& engineSound); 129 const std::string& getDefScoreSound(); 130 void setDefBatSound(const std::string& engineSound); 131 const std::string& getDefBatSound(); 132 void setDefBoundarySound(const std::string& engineSound); 133 const std::string& getDefBoundarySound(); 134 125 135 private: 126 136 void registerVariables(); … … 135 145 unsigned int* batID_; //!< The object IDs of the bats, to be able to synchronize them over the network. 136 146 float relMercyOffset_; //!< Offset, that makes the player not loose, when, in all fairness, he would have. 147 WorldSound* defScoreSound_; 148 WorldSound* defBatSound_; 149 WorldSound* defBoundarySound_; 137 150 }; 138 151 } -
code/trunk/src/modules/pong/PongScore.cc
r9667 r9939 41 41 42 42 #include "Pong.h" 43 #include "sound/WorldSound.h" ///////////////////////////// 43 44 44 45 namespace orxonox -
code/trunk/src/modules/pong/PongScore.h
r9667 r9939 124 124 WeakPtr<PlayerInfo> player1_; //!< Store information about left player permanently. 125 125 WeakPtr<PlayerInfo> player2_; //!< Same for the right player. To end the game properly. 126 WorldSound* scoreSound_; 127 126 128 }; 127 129 } -
code/trunk/src/modules/weapons/weaponmodes/HsW01.h
r9667 r9939 59 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 60 60 61 pr ivate:61 protected: 62 62 /** 63 63 @brief Set the mesh. … … 109 109 { return this->delay_; } 110 110 111 v oid shot();111 virtual void shot(); 112 112 void muzzleflash(); 113 113 -
code/trunk/src/orxonox/MoodManager.h
r9667 r9939 51 51 52 52 private: 53 virtual voidmoodChanged(const std::string& mood) = 0;53 virtual bool moodChanged(const std::string& mood) = 0; 54 54 55 55 static void changedMood(const std::string& mood); -
code/trunk/src/orxonox/controllers/NewHumanController.cc
r9667 r9939 443 443 444 444 if (pawn) 445 pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 1200 );445 pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 3000 ); 446 446 447 447 if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != 0 ) -
code/trunk/src/orxonox/gamestates/GSMainMenu.cc
r9667 r9939 85 85 { 86 86 if (GameMode::playsSound()) 87 this->ambient_->destroy(); 87 this->ambient_->destroy(); //CHECK Thilo destroy ?preDestroy()? !!!!!!! 88 88 89 89 InputManager::getInstance().destroyState("MainMenuHackery"); -
code/trunk/src/orxonox/gametypes/Gametype.cc
r9667 r9939 171 171 entity->setOrientation(oldentity->getWorldOrientation()); 172 172 } 173 174 173 it->first->startControl(entity); 175 174 } -
code/trunk/src/orxonox/graphics/ParticleEmitter.cc
r9667 r9939 45 45 RegisterClass(ParticleEmitter); 46 46 47 ParticleEmitter::ParticleEmitter(Context* context) : StaticEntity(context)47 ParticleEmitter::ParticleEmitter(Context* context) : MovableEntity(context) 48 48 { 49 49 RegisterObject(ParticleEmitter); -
code/trunk/src/orxonox/graphics/ParticleEmitter.h
r9667 r9939 33 33 34 34 #include <string> 35 #include "worldentities/ StaticEntity.h"35 #include "worldentities/MovableEntity.h" 36 36 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport ParticleEmitter : public StaticEntity39 class _OrxonoxExport ParticleEmitter : public MovableEntity 40 40 { 41 41 public: -
code/trunk/src/orxonox/infos/PlayerInfo.cc
r9667 r9939 229 229 return; 230 230 231 this->controllableEntity_->getController()->setActive(false); 231 Controller* tmp =this->controllableEntity_->getController(); 232 if (tmp == NULL) 233 { 234 orxout(verbose) << "PlayerInfo: pauseControl, Controller is NULL " << endl; 235 return; 236 } 237 tmp->setActive(false); 232 238 //this->controllableEntity_->getController()->setControllableEntity(NULL); 233 239 this->controllableEntity_->setController(0); -
code/trunk/src/orxonox/interfaces/RadarViewable.h
r9667 r9939 63 63 virtual void setRadarName(const std::string& name) 64 64 { 65 // The following if-clause hides objects with radarname "HIDDEN" 66 if (name == "HIDDEN") 67 { 68 this->bVisibility_ = 0; 69 this->settingsChanged(); 70 } 65 71 if (this->radarName_ != name) 66 72 { -
code/trunk/src/orxonox/items/MultiStateEngine.cc
r9667 r9939 61 61 this->defEngineSndNormal_->setLooping(true); 62 62 this->defEngineSndBoost_->setLooping(true); 63 this->defEngineSndNormal_->setVolume(0.8f); 64 this->defEngineSndBoost_->setVolume(0.5f); 63 65 this->lua_ = new LuaState(); 64 66 } -
code/trunk/src/orxonox/sound/AmbientSound.cc
r8861 r9939 79 79 } 80 80 81 voidAmbientSound::setAmbientSource(const std::string& source)81 bool AmbientSound::setAmbientSource(const std::string& source) 82 82 { 83 83 this->ambientSource_ = source; 84 this->moodChanged(MoodManager::getInstance().getMood());84 return(this->moodChanged(MoodManager::getInstance().getMood())); 85 85 } 86 86 87 voidAmbientSound::moodChanged(const std::string& mood)87 bool AmbientSound::moodChanged(const std::string& mood) 88 88 { 89 89 if (GameMode::playsSound()) … … 95 95 orxout(user_info) << "Loading ambient sound " << path << "..." << endl; // TODO: make this output internal if we implement sound streaming 96 96 this->setSource(path); 97 98 // all went fine 99 return true; 97 100 } 98 101 else 99 102 { 100 103 orxout(internal_warning, context::sound) << this->ambientSource_ << ": Not a valid name! Ambient sound will not change." << endl; 104 105 // everything went southways 106 return false; 101 107 } 102 108 } 109 return false; 103 110 } 104 111 -
code/trunk/src/orxonox/sound/AmbientSound.h
r7856 r9939 54 54 void pause(); 55 55 56 voidsetAmbientSource(const std::string& source);56 bool setAmbientSource(const std::string& source); 57 57 inline const std::string& getAmbientSource() const 58 58 { return this->ambientSource_; } … … 68 68 void preDestroy(); 69 69 float getRealVolume(); 70 voidmoodChanged(const std::string& mood);70 bool moodChanged(const std::string& mood); 71 71 inline void ambientSourceChanged() 72 72 { this->setAmbientSource(this->ambientSource_); } -
code/trunk/src/orxonox/sound/BaseSound.cc
r9667 r9939 47 47 BaseSound::BaseSound() 48 48 : bPooling_(false) 49 , volume_( 1.0)49 , volume_(0.7) 50 50 , bLooping_(false) 51 51 , state_(Stopped) -
code/trunk/src/orxonox/sound/SoundManager.cc
r9667 r9939 218 218 .description("Defines the overall volume.") 219 219 .callback(this, &SoundManager::checkSoundVolumeValidity); 220 SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 1.0f)220 SetConfigValueAlias(volume_[SoundType::Music], "ambientVolume_", 0.7f) 221 221 .description("Defines the ambient volume.") 222 222 .callback(this, &SoundManager::checkAmbientVolumeValidity); -
code/trunk/src/orxonox/sound/WorldAmbientSound.cc
r9667 r9939 33 33 #include "core/XMLPort.h" 34 34 #include "AmbientSound.h" 35 #include "core/command/ConsoleCommand.h" 36 #include <exception> 37 35 38 36 39 namespace orxonox 37 40 { 41 SetConsoleCommand("WorldAmbientSound", "nextsong", &WorldAmbientSound::nextSong); 42 38 43 RegisterClass(WorldAmbientSound); 39 44 … … 44 49 this->ambientSound_ = new AmbientSound(); 45 50 this->registerVariables(); 51 soundList_.push_back("Earth.ogg"); 52 soundList_.push_back("Jupiter.ogg"); 53 soundList_.push_back("Mars.ogg"); 54 soundList_.push_back("allgorythm-lift_up.ogg"); 55 soundList_.push_back("allgorythm-resonance_blaster.ogg"); 56 soundList_.push_back("AlphaCentauri.ogg"); 57 soundList_.push_back("Asteroid_rocks.ogg"); 58 soundList_.push_back("Ganymede.ogg"); 59 soundList_.push_back("luke_grey_-_hypermode.ogg"); 60 46 61 } 47 48 62 WorldAmbientSound::~WorldAmbientSound() 49 63 { … … 51 65 { 52 66 this->ambientSound_->destroy(); 67 WorldAmbientSound::soundList_.clear(); 53 68 } 54 69 } … … 94 109 this->ambientSound_->stop(); 95 110 } 111 112 void WorldAmbientSound::nextSong() 113 { 114 115 //HACK: Assuption - there is only one WorldAmbientSound in a level and only one level is used. 116 for (ObjectList<WorldAmbientSound>::iterator it = ObjectList<WorldAmbientSound>::begin(); 117 it != ObjectList<WorldAmbientSound>::end(); ++it) 118 { 119 while(it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){ 120 WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size(); 121 } 122 WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size(); 123 } 124 } 96 125 } -
code/trunk/src/orxonox/sound/WorldAmbientSound.h
r9667 r9939 34 34 #include "core/BaseObject.h" 35 35 #include "network/synchronisable/Synchronisable.h" 36 #include <string> 37 #include <vector> 38 36 39 37 40 namespace orxonox … … 54 57 void play(); 55 58 59 //This function changes the current ambient song. 60 //You can call nextSong() active in the level 61 //by pressing the key 'M'. 62 static void nextSong(); 63 56 64 private: 57 65 void registerVariables(); 58 66 67 //Vector with the diffrent available level sounds. 68 //The sound names are pushed in the WorldAmbientSound-constructor. 69 static std::vector<std::string> soundList_; 70 71 // This value will be initialized below, don't make this into 72 // a const, since we want to change it in nextSong(). 73 static int soundNumber_; 74 75 59 76 AmbientSound* ambientSound_; 60 77 }; 78 79 // This is an initialization for the soundnumber variable. Since it is 80 // static, we have to initialize it this way. 81 int WorldAmbientSound::soundNumber_ = 0; 82 std::vector<std::string> WorldAmbientSound::soundList_; 83 61 84 } 62 85 -
code/trunk/src/orxonox/sound/WorldSound.cc
r9667 r9939 81 81 alSourcef(this->audioSource_, AL_REFERENCE_DISTANCE, refDist); 82 82 // TODO: 500 is very magical here. Derive something better 83 alSourcef(this->audioSource_, AL_MAX_DISTANCE, refDist * 500);83 alSourcef(this->audioSource_, AL_MAX_DISTANCE, refDist * 20); 84 84 } 85 85 this->tick(0); // update position, orientation and velocity -
code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
r9667 r9939 79 79 this->defSndWpnFire_ = new WorldSound(this->getContext()); 80 80 this->defSndWpnFire_->setLooping(false); 81 this->defSndWpnFire_->setVolume(0.8f); 81 82 this->bSoundAttached_ = false; 82 83 } -
code/trunk/src/orxonox/worldentities/BigExplosion.cc
r9667 r9939 43 43 RegisterClass(BigExplosion); 44 44 45 BigExplosion::BigExplosion(Context* context) : StaticEntity(context)45 BigExplosion::BigExplosion(Context* context) : MobileEntity(context) 46 46 { 47 47 RegisterObject(BigExplosion); 48 49 if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) ) 50 ThrowException(AbortLoading, "Can't create BigExplosion, no scene or no scene manager given."); 51 52 this->bStop_ = false; 53 this->LOD_ = LODParticle::Normal; 54 55 if ( GameMode::showsGraphics() ) 56 { 57 try 58 { 59 this->init(); 60 } 61 catch (const std::exception& ex) 62 { 63 orxout(internal_error) << "Couldn't load particle effect in BigExplosion: " << ex.what() << endl; 64 this->initZero(); 65 } 66 } 67 else 68 { 69 this->initZero(); 70 } 71 72 if (GameMode::isMaster()) 73 { 74 this->destroyTimer_.setTimer(rnd(2, 4), false, createExecutor(createFunctor(&BigExplosion::stop, this))); 75 } 76 77 this->registerVariables(); 78 } 79 80 BigExplosion::BigExplosion(Context* context, Vector3 initVelocity) : MobileEntity(context) 81 { 82 RegisterObject(BigExplosion); 83 this->setVelocity(initVelocity); 48 84 49 85 if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) ) … … 100 136 this->debris4_->setSyncMode(0); 101 137 102 this->explosion_ = new StaticEntity(this->getContext());138 this->explosion_ = new MobileEntity(this->getContext()); 103 139 this->explosion_->setSyncMode(0); 104 140 … … 148 184 this->debrisEntity4_->attach(debris4_); 149 185 186 // /////////////////////// 187 // TODO: particleSpawner is a static entity. It should probably be dynamic, for better explosions. 188 // 150 189 ParticleSpawner* effect = new ParticleSpawner(this->getContext()); 190 orxout() << "vel " << this->getVelocity() << endl; 191 // effect->setVelocity(this->getVelocity()); 151 192 effect->setDestroyAfterLife(true); 152 193 effect->setSource("Orxonox/explosion2b"); … … 155 196 156 197 ParticleSpawner* effect2 = new ParticleSpawner(this->getContext()); 198 // effect2->setVelocity(Vector3(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1))*rnd(10, 200)); 157 199 effect2->setDestroyAfterLife(true); 158 200 effect2->setSource("Orxonox/smoke6"); -
code/trunk/src/orxonox/worldentities/BigExplosion.h
r9667 r9939 22 22 * Author: 23 23 * Benjamin de Capitani 24 * Co-authors: 24 * Co-authors:§ 25 25 * ... 26 26 * … … 33 33 34 34 #include "tools/Timer.h" 35 #include " StaticEntity.h"35 #include "MobileEntity.h" 36 36 37 37 namespace orxonox 38 38 { 39 class _OrxonoxExport BigExplosion : public StaticEntity39 class _OrxonoxExport BigExplosion : public MobileEntity 40 40 { 41 41 public: 42 42 BigExplosion(Context* context); 43 BigExplosion(Context* context, Vector3 initVelocity); 43 44 virtual ~BigExplosion(); 44 45 … … 60 61 bool bStop_; 61 62 62 StaticEntity* explosion_;63 MobileEntity* explosion_; 63 64 64 65 MovableEntity* debrisEntity1_; -
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
r9667 r9939 46 46 #include "weaponsystem/WeaponPack.h" 47 47 #include "weaponsystem/WeaponSet.h" 48 #include "sound/WorldSound.h" 48 49 49 50 #include "controllers/FormationController.h" … … 100 101 101 102 this->setSyncMode(ObjectDirection::Bidirectional); // needed to synchronise e.g. aimposition 103 104 if (GameMode::isMaster()) 105 { 106 this->explosionSound_ = new WorldSound(this->getContext()); 107 this->explosionSound_->setVolume(1.0f); 108 } 109 else 110 { 111 this->explosionSound_ = 0; 112 } 102 113 } 103 114 … … 109 120 this->weaponSystem_->destroy(); 110 121 } 122 111 123 } 112 124 … … 135 147 XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f); 136 148 149 XMLPortParam(Pawn, "explosionSound", setExplosionSound, getExplosionSound, xmlelement, mode); 150 137 151 XMLPortParam ( RadarViewable, "radarname", setRadarName, getRadarName, xmlelement, mode ); 138 152 } 153 139 154 140 155 void Pawn::registerVariables() … … 290 305 void Pawn::kill() 291 306 { 292 307 this->damage(this->health_); 293 308 this->death(); 294 309 } … … 314 329 if (this->getGametype() && this->getGametype()->allowPawnDeath(this, this->lastHitOriginator_)) 315 330 { 316 // Set bAlive_ to false and wait for PawnManager to do the destruction 331 explosionSound_->play(); 332 // Set bAlive_ to false and wait for PawnManager to do the destruction 317 333 this->bAlive_ = false; 318 334 … … 365 381 this->setDestroyWhenPlayerLeft(false); 366 382 367 BigExplosion* chunk = new BigExplosion(this->getContext()); 383 orxout() << "big explosion: " << this->getVelocity() << endl; 384 BigExplosion* chunk = new BigExplosion(this->getContext(), this->getVelocity()); 368 385 chunk->setPosition(this->getPosition()); 386 // chunk->setVelocity(this->getVelocity()); 369 387 370 388 } … … 376 394 effect->setPosition(this->getPosition()); 377 395 effect->setOrientation(this->getOrientation()); 396 effect->setVelocity(this->getVelocity()); 378 397 effect->setDestroyAfterLife(true); 379 398 effect->setSource("Orxonox/explosion2b"); … … 384 403 effect->setPosition(this->getPosition()); 385 404 effect->setOrientation(this->getOrientation()); 405 effect->setVelocity(this->getVelocity()); 386 406 effect->setDestroyAfterLife(true); 387 407 effect->setSource("Orxonox/smoke6"); … … 392 412 effect->setPosition(this->getPosition()); 393 413 effect->setOrientation(this->getOrientation()); 414 effect->setVelocity(this->getVelocity()); 394 415 effect->setDestroyAfterLife(true); 395 416 effect->setSource("Orxonox/sparks"); … … 527 548 528 549 550 void Pawn::setExplosionSound(const std::string &explosionSound) 551 { 552 if(explosionSound_ ) 553 explosionSound_->setSource(explosionSound); 554 else 555 assert(0); // This should never happen, because soundpointer is only available on master 556 } 557 558 const std::string& Pawn::getExplosionSound() 559 { 560 if( explosionSound_ ) 561 return explosionSound_->getSource(); 562 else 563 assert(0); 564 return BLANKSTRING; 565 } 566 529 567 530 568 } -
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
r9667 r9939 36 36 #include "interfaces/RadarViewable.h" 37 37 #include "worldentities/ControllableEntity.h" 38 38 39 39 40 namespace orxonox // tolua_export … … 178 179 virtual void changedVisibility(); 179 180 181 void setExplosionSound(const std::string& engineSound); 182 const std::string& getExplosionSound(); 183 180 184 protected: 181 185 virtual void preDestroy(); … … 231 235 232 236 Vector3 aimPosition_; 237 238 WorldSound* explosionSound_; 239 233 240 }; // tolua_export 234 241 } // tolua_export
Note: See TracChangeset
for help on using the changeset viewer.