Changeset 9348 for code/trunk
- Timestamp:
- Aug 30, 2012, 11:08:17 PM (12 years ago)
- Location:
- code/trunk
- Files:
-
- 9 deleted
- 171 edited
- 17 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:ignore
-
old new 1 .project 1 2 build 2 3 codeblocks 4 dependencies 3 5 vs 4 dependencies
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
code/trunk/cmake/tools/BuildUnits.cmake
- Property svn:eol-style set to native
-
code/trunk/data/gui/layouts/GUILayout.xsd
r5781 r9348 2 2 <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> 3 3 4 <xsd:element name="GUILayout" type="GUILayoutType"/> 5 6 <xsd:complexType name="GUILayoutType"> 7 <xsd:sequence> 8 <xsd:element name="Window" type="WindowType" /> 9 </xsd:sequence> 10 <xsd:attribute name="Parent" type="xsd:string" use="optional" default=""/> 11 </xsd:complexType> 12 13 <xsd:complexType name="WindowType"> 14 <xsd:sequence> 15 <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> 16 <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> 17 <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> 18 <xsd:choice minOccurs="0" maxOccurs="unbounded"> 19 <xsd:element name="Window" type="WindowType" /> 20 <xsd:element name="AutoWindow" type="AutoWindowType" /> 21 </xsd:choice> 22 <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> 23 </xsd:sequence> 24 <xsd:attribute name="Type" type="xsd:string" use="required"/> 25 <xsd:attribute name="Name" type="xsd:string" use="optional" default="" /> 26 </xsd:complexType> 4 <xsd:element name="GUILayout" type="GUILayoutType"/> 27 5 28 <xsd:complexType name="AutoWindowType"> 29 <xsd:sequence> 30 <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> 31 <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> 32 <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> 33 <xsd:choice minOccurs="0" maxOccurs="unbounded"> 34 <xsd:element name="Window" type="WindowType" /> 35 <xsd:element name="AutoWindow" type="AutoWindowType" /> 36 </xsd:choice> 37 <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> 38 </xsd:sequence> 39 <xsd:attribute name="NameSuffix" type="xsd:string" use="required"/> 40 </xsd:complexType> 6 <xsd:complexType name="GUILayoutType"> 7 <xsd:sequence> 8 <xsd:element name="Window" type="WindowType" /> 9 </xsd:sequence> 10 <xsd:attribute name="Parent" type="xsd:string" use="optional" default=""/> 11 </xsd:complexType> 41 12 42 <xsd:complexType name="PropertyType"> 43 <xsd:simpleContent> 44 <xsd:extension base="xsd:string"> 45 <xsd:attribute name="Name" type="xsd:string" use="required"/> 46 <xsd:attribute name="Value" type="xsd:string" use="optional"/> 47 </xsd:extension> 48 </xsd:simpleContent> 49 </xsd:complexType> 13 <xsd:complexType name="WindowType"> 14 <xsd:sequence> 15 <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> 16 <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> 17 <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> 18 <xsd:choice minOccurs="0" maxOccurs="unbounded"> 19 <xsd:element name="Window" type="WindowType" /> 20 <xsd:element name="AutoWindow" type="AutoWindowType" /> 21 </xsd:choice> 22 <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> 23 </xsd:sequence> 24 <xsd:attribute name="Type" type="xsd:string" use="required"/> 25 <xsd:attribute name="Name" type="xsd:string" use="optional" default="" /> 26 </xsd:complexType> 50 27 51 <xsd:complexType name="LayoutImportType"> 52 <xsd:attribute name="Filename" type="xsd:string" use="required"/> 53 <xsd:attribute name="Prefix" type="xsd:string" use="optional" default="" /> 54 <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" /> 55 </xsd:complexType> 28 <xsd:complexType name="AutoWindowType"> 29 <xsd:sequence> 30 <xsd:element name="LayoutImport" type="LayoutImportType" minOccurs="0" maxOccurs="unbounded" /> 31 <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> 32 <xsd:element name="Event" type="EventType" minOccurs="0" maxOccurs="unbounded" /> 33 <xsd:choice minOccurs="0" maxOccurs="unbounded"> 34 <xsd:element name="Window" type="WindowType" /> 35 <xsd:element name="AutoWindow" type="AutoWindowType" /> 36 </xsd:choice> 37 <xsd:element name="Property" type="PropertyType" minOccurs="0" maxOccurs="unbounded" /> 38 </xsd:sequence> 39 <xsd:attribute name="NameSuffix" type="xsd:string" use="required"/> 40 </xsd:complexType> 56 41 57 <xsd:complexType name="EventType"> 58 <xsd:attribute name="Name" type="xsd:string" use="required"/> 59 <xsd:attribute name="Function" type="xsd:string" use="required"/> 60 </xsd:complexType> 42 <xsd:complexType name="PropertyType"> 43 <xsd:simpleContent> 44 <xsd:extension base="xsd:string"> 45 <xsd:attribute name="Name" type="xsd:string" use="required"/> 46 <xsd:attribute name="Value" type="xsd:string" use="optional"/> 47 </xsd:extension> 48 </xsd:simpleContent> 49 </xsd:complexType> 50 51 <xsd:complexType name="LayoutImportType"> 52 <xsd:attribute name="Filename" type="xsd:string" use="required"/> 53 <xsd:attribute name="Prefix" type="xsd:string" use="optional" default="" /> 54 <xsd:attribute name="ResourceGroup" type="xsd:string" use="optional" default="" /> 55 </xsd:complexType> 56 57 <xsd:complexType name="EventType"> 58 <xsd:attribute name="Name" type="xsd:string" use="required"/> 59 <xsd:attribute name="Function" type="xsd:string" use="required"/> 60 </xsd:complexType> 61 61 62 62 </xsd:schema> -
code/trunk/data/gui/layouts/InGamePickupHUD.layout
r7163 r9348 2 2 3 3 <GUILayout> 4 <Window Type="DefaultWindow" Name="orxonox/InGamePickupHUD_RootWindow" > 5 <Property Name="InheritsAlpha" Value="False" /> 6 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 7 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 8 <Window Type="TaharezLook/StaticImage" Name="orxonox/InGamePickupHUD_Overview" > 9 <Property Name="Font" Value="BlueHighway-12" /> 10 <Property Name="Text" Value="Pickup List" /> 11 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 12 <Property Name="UnifiedAreaRect" Value="{{0,5},{0.15,0},{0.2,0},{0.45,0}}" /> 13 <Property Name="Alpha" Value="0.3" /> 14 <!--Event Name="Clicked" Function="InGameMenu.button_return_clicked"/--> 15 <Window Type="TaharezLook/StaticText" Name="orxonox/InGamePickupHUD_PickupTitle" > 16 <Property Name="Alpha" Value="0.8"/> 17 <Property Name="Text" Value="Pickup List" /> 18 <Property Name="Font" Value="BlueHighway-10" /> 19 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 20 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,-20},{0,20}}" /> 21 </Window> 22 <Window Type="TaharezLook/Button" Name="orxonox/InGamePickupHUD_closeButton" > 23 <Property Name="Alpha" Value="0.8" /> 24 <Property Name="Font" Value="BlueHighway-12" /> 25 <Property Name="Text" Value="X" /> 26 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 27 <Property Name="UnifiedAreaRect" Value="{{1,-20},{0,0},{1,0},{0,20}}" /> 28 <!-- alle Grössen / anordnungen angepasst - da überschneidungen von absoluten 29 und relativen Positionsangaben (problematisch bei kleinen auflösungen) --> 30 <Event Name="Clicked" Function="InGamePickupHUD.close_button_clicked"/> 31 </Window> 32 <Window Type="TaharezLook/Listbox" Name="orxonox/InGamePickupHUD_PickupListBox"> 33 <Property Name="Alpha" Value="0.8" /> 34 <Property Name="Font" Value="BlueHighway-12" /> 35 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 36 <Property Name="UnifiedAreaRect" Value="{{0,5},{0,25},{1,-5},{1,-5}}" /> 37 <!-- 38 <Window Type="TaharezLook/ListboxItem" Name="orxonox/InGamePickupHUD_TestPickupOne"> 39 <Property Name="Alpha" Value="0.8" /> 40 <Property Name="Font" Value="BlueHighway-12" /> 41 <Property Name="Text" Value="First Pickup" /> 42 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 43 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,30},{1,0}}" /> 44 </Window> 45 --> 46 </Window> 47 48 </Window> 49 50 51 </Window> 52 4 <Window Type="DefaultWindow" Name="orxonox/InGamePickupHUD_RootWindow" > 5 <Property Name="InheritsAlpha" Value="False" /> 6 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 7 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" /> 8 <Window Type="TaharezLook/StaticImage" Name="orxonox/InGamePickupHUD_Overview" > 9 <Property Name="Font" Value="BlueHighway-12" /> 10 <Property Name="Text" Value="Pickup List" /> 11 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 12 <Property Name="UnifiedAreaRect" Value="{{0,5},{0.15,0},{0.2,0},{0.45,0}}" /> 13 <Property Name="Alpha" Value="0.3" /> 14 <!--Event Name="Clicked" Function="InGameMenu.button_return_clicked"/--> 15 <Window Type="TaharezLook/StaticText" Name="orxonox/InGamePickupHUD_PickupTitle" > 16 <Property Name="Alpha" Value="0.8"/> 17 <Property Name="Text" Value="Pickup List" /> 18 <Property Name="Font" Value="BlueHighway-10" /> 19 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 20 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,-20},{0,20}}" /> 21 </Window> 22 <Window Type="TaharezLook/Button" Name="orxonox/InGamePickupHUD_closeButton" > 23 <Property Name="Alpha" Value="0.8" /> 24 <Property Name="Font" Value="BlueHighway-12" /> 25 <Property Name="Text" Value="X" /> 26 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 27 <Property Name="UnifiedAreaRect" Value="{{1,-20},{0,0},{1,0},{0,20}}" /> 28 <!-- alle Grössen / anordnungen angepasst - da überschneidungen von absoluten 29 und relativen Positionsangaben (problematisch bei kleinen auflösungen) --> 30 <Event Name="Clicked" Function="InGamePickupHUD.close_button_clicked"/> 31 </Window> 32 <Window Type="TaharezLook/Listbox" Name="orxonox/InGamePickupHUD_PickupListBox"> 33 <Property Name="Alpha" Value="0.8" /> 34 <Property Name="Font" Value="BlueHighway-12" /> 35 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 36 <Property Name="UnifiedAreaRect" Value="{{0,5},{0,25},{1,-5},{1,-5}}" /> 37 <!-- 38 <Window Type="TaharezLook/ListboxItem" Name="orxonox/InGamePickupHUD_TestPickupOne"> 39 <Property Name="Alpha" Value="0.8" /> 40 <Property Name="Font" Value="BlueHighway-12" /> 41 <Property Name="Text" Value="First Pickup" /> 42 <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" /> 43 <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0,30},{1,0}}" /> 44 </Window> 45 --> 46 </Window> 47 </Window> 48 </Window> 53 49 </GUILayout> -
code/trunk/data/gui/layouts/SingleplayerConfigMenu.layout
- Property svn:eol-style set to native
-
code/trunk/data/gui/scripts/AudioMenu.lua
r8351 r9348 34 34 table.insert(themeList, "8-Bit Style") 35 35 table.insert(themeList, "Corny Jazz") 36 table.insert(themeList, "Metal") 36 37 for k,v in pairs(themeList) do 37 38 item = CEGUI.createListboxTextItem(v) … … 45 46 elseif orxonox.getConfig("MoodManager", "mood_") == "jazzy" then 46 47 listboxwindow:setItemSelectState(3,true) 48 elseif orxonox.getConfig("MoodManager", "mood_") == "metal" then 49 listboxwindow:setItemSelectState(4,true) 47 50 else 48 51 listboxwindow:setItemSelectState(0,true) … … 178 181 elseif listboxwindow:isItemSelected(3) then 179 182 orxonox.config("MoodManager", "mood_", "jazzy") 183 elseif listboxwindow:isItemSelected(4) then 184 orxonox.config("MoodManager", "mood_", "metal") 180 185 else 181 186 orxonox.config("MoodManager", "mood_", "default") -
code/trunk/data/gui/scripts/PickupInventory.lua
r7504 r9348 108 108 109 109 function P.createPickupEntry(index, pickup) 110 local representation = orxonox.PickupManager:getInstance():get PickupRepresentation(pickup.pickup)110 local representation = orxonox.PickupManager:getInstance():getRepresentation(pickup.representationName) 111 111 112 112 local name = "orxonox/PickupInventory/Box/Pickup" .. index … … 176 176 for k,v in pairs(P.detailsWindows) do 177 177 if v ~= nil then 178 winMgr:destroyWindow(v)178 P.destroyDetailWindow(k) 179 179 end 180 180 end … … 193 193 function P.createDetailsWindow(pickupIndex) 194 194 local pickup = P.pickupsList[pickupIndex] 195 local representation = orxonox.PickupManager:getInstance():get PickupRepresentation(pickup.pickup)195 local representation = orxonox.PickupManager:getInstance():getRepresentation(pickup.representationName) 196 196 197 197 local index = P.getNewDetailNumber() … … 323 323 local detailNr = tonumber(match()) 324 324 325 P.destroyDetailWindow(detailNr) 326 end 327 328 function P.destroyDetailWindow(detailNr) 325 329 local window = P.detailsWindows[detailNr] 326 330 winMgr:destroyWindow(window) -
code/trunk/data/gui/scripts/SingleplayerConfigMenu.lua
- Property svn:eol-style set to native
-
code/trunk/data/gui/scripts/SingleplayerMenu.lua
r9251 r9348 2 2 3 3 local P = createMenuSheet("SingleplayerMenu") 4 4 P.loadAlong = {"ShipSelectionMenu"} 5 5 P.levelList = {} 6 6 P.activeTabIndexes = {} 7 7 P.scrollbarWidth = 13 8 selectedlevel = {} -- level for ship selection 8 9 9 10 function P.onLoad() 10 11 P.createLevelList() 11 12 12 13 -- create tabs with desired tab as argument (nil for all) 13 14 P.createFilterTab("Gametypes", "gametype") … … 18 19 P.createFilterTab("Tests", "test") 19 20 P.createFilterTab("Show All", nil) 20 21 21 22 -- update description and screenshot boxes 22 23 P.SingleplayerSelectionChanged() 23 24 24 25 --buttons are arranged in a 1x3 matrix 25 26 P:setButton(1, 1, { … … 46 47 while index < size do 47 48 level = orxonox.LevelManager:getInstance():getAvailableLevelListItem(index) 48 if level ~= nilthen49 if (level ~= nil and level:getXMLFilename() ~= "_temp.oxw") then 49 50 local levelXMLFilename = level:getXMLFilename() 50 51 -- create an imageset for each screenshot … … 141 142 142 143 function P.SingleplayerStartButton_clicked(e) 143 local level = P.SingleplayerGetSelectedLevel() 144 if level ~= nil then 145 orxonox.execute("startGame " .. level:getXMLFilename()) 146 hideAllMenuSheets() 144 selectedlevel = P.SingleplayerGetSelectedLevel() 145 if selectedlevel ~= nil then 146 if selectedlevel:hasTag("shipselection") then 147 local shipSelectionMenu = showMenuSheet("ShipSelectionMenu", true) 148 shipSelectionMenu:update() 149 else 150 orxonox.execute("startGame " .. selectedlevel:getXMLFilename()) 151 hideAllMenuSheets() 152 end 147 153 end 148 154 end -
code/trunk/data/levels/FPSTest.oxw
r9016 r9348 23 23 <Scene 24 24 ambientlight = "0.1, 0.1, 0.1" 25 skybox = "Orxonox/sky panoramagen1"25 skybox = "Orxonox/skyBoxBasic" 26 26 gravity = "0,-1000,0" 27 27 negativeWorldRange = "-100000, -100000, -100000" -
code/trunk/data/levels/Spacerace2.oxw
- Property svn:eol-style set to native
r9016 r9348 12 12 13 13 include("templates/spaceshipAssff.oxt") 14 14 15 15 ?> 16 16 … … 37 37 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/> 38 38 39 40 41 <checkpoints> 42 43 <attached>44 <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />45 </attached>46 <collisionShapes>47 <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />48 <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />49 <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />50 <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />51 </collisionShapes>52 </RaceCheckPoint>53 54 <RaceCheckPoint name="checkpoint2" position="0,2100,2300" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false" nextcheckpoints="3,-1,-1">55 <attached>56 <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />57 </attached>58 <collisionShapes>59 <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />60 <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />61 <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />62 <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />63 </collisionShapes>64 </RaceCheckPoint>65 66 <RaceCheckPoint name="checkpoint3" position="0,700,2700" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false" nextcheckpoints="3,-1,-1">67 <attached>68 <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />69 </attached>70 <collisionShapes>71 <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />72 <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />73 <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />74 <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />75 </collisionShapes>76 </RaceCheckPoint>77 78 <RaceCheckPoint name="checkpoint4" position="0,-400,300" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="true">79 <attached>80 <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />81 </attached>82 <collisionShapes>83 <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />84 <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />85 <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />86 <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />87 </collisionShapes>88 </RaceCheckPoint>89 </checkpoints>90 </SpaceRaceManager>91 92 93 <SpaceShip position="0,0,200" lookat="0,0,0">39 40 <SpaceRaceManager> 41 <checkpoints> 42 <RaceCheckPoint name="checkpoint1" position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false" nextcheckpoints="1,2,-1"> 43 <attached> 44 <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" /> 45 </attached> 46 <collisionShapes> 47 <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" /> 48 <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" /> 49 <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" /> 50 <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" /> 51 </collisionShapes> 52 </RaceCheckPoint> 53 54 <RaceCheckPoint name="checkpoint2" position="0,2100,2300" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false" nextcheckpoints="3,-1,-1"> 55 <attached> 56 <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" /> 57 </attached> 58 <collisionShapes> 59 <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" /> 60 <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" /> 61 <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" /> 62 <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" /> 63 </collisionShapes> 64 </RaceCheckPoint> 65 66 <RaceCheckPoint name="checkpoint3" position="0,700,2700" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false" nextcheckpoints="3,-1,-1"> 67 <attached> 68 <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" /> 69 </attached> 70 <collisionShapes> 71 <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" /> 72 <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" /> 73 <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" /> 74 <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" /> 75 </collisionShapes> 76 </RaceCheckPoint> 77 78 <RaceCheckPoint name="checkpoint4" position="0,-400,300" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="true"> 79 <attached> 80 <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" /> 81 </attached> 82 <collisionShapes> 83 <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" /> 84 <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" /> 85 <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" /> 86 <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" /> 87 </collisionShapes> 88 </RaceCheckPoint> 89 </checkpoints> 90 </SpaceRaceManager> 91 92 93 <SpaceShip position="0,0,200" lookat="0,0,0"> 94 94 <templates> 95 95 <Template link=spaceshipassff /> … … 202 202 203 203 204 204 205 205 </Scene> 206 206 </Level> -
code/trunk/data/levels/asteroidField.oxw
- Property svn:eol-style set to native
r9016 r9348 39 39 40 40 <!-- Belt that's far away *** TURNED OFF FOR PERFORMANCE REASONS *** --> 41 <!-- Generate asteroid field and asteroid belt --> 41 <!-- Generate asteroid field and asteroid belt --> 42 42 <!-- 43 43 <?lua 44 45 44 dofile("includes/asteroidField.lua") 45 asteroidBelt(0, 0, 0, -48, -34, 70, 100, 200, 219900, 210000, 900, 1) 46 46 ?> 47 47 --> … … 50 50 <!-- triple large belt around the planet --> 51 51 <?lua 52 53 52 dofile("includes/asteroidField.lua") 53 asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 7190, 7800, 250, 1) 54 54 ?> 55 55 <?lua 56 57 56 dofile("includes/asteroidField.lua") 57 asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 10000, 11000, 300, 1) 58 58 ?> 59 59 <?lua 60 61 60 dofile("includes/asteroidField.lua") 61 asteroidBelt(15000, 0, 0, 30, 0, 30, 30, 50, 14000, 15000, 350, 1) 62 62 ?> 63 63 … … 95 95 96 96 97 97 98 98 </Scene> 99 99 </Level> -
code/trunk/data/levels/asteroids.oxw
r9016 r9348 149 149 150 150 151 <CheckPoint name=trigger1 position="-300,300,0" scale=1 isdestination=false isfirst=true stayactive=true distance=10 addtime= 30/>152 153 154 <CheckPoint name=trigger2 position="2200,600,0" scale=3 isdestination=false stayactive=true distance=100 addtime= 17>151 <CheckPoint name=trigger1 position="-300,300,0" scale=1 isdestination=false isfirst=true stayactive=true distance=10 addtime=24 /> 152 153 154 <CheckPoint name=trigger2 position="2200,600,0" scale=3 isdestination=false stayactive=true distance=100 addtime=20> 155 155 <events> 156 156 <activity> … … 203 203 204 204 205 <CheckPoint name=trigger3 position="4100,0,400" scale=3 isdestination=false stayactive=true distance=100 addtime=1 6>205 <CheckPoint name=trigger3 position="4100,0,400" scale=3 isdestination=false stayactive=true distance=100 addtime=10> 206 206 <events> 207 207 <activity> … … 254 254 255 255 256 <CheckPoint name=trigger4 position="5600,400,0" scale=3 isdestination=false stayactive=true distance=100 addtime=1 7>256 <CheckPoint name=trigger4 position="5600,400,0" scale=3 isdestination=false stayactive=true distance=100 addtime=10> 257 257 <events> 258 258 <activity> … … 305 305 306 306 307 <CheckPoint name=trigger5 position="7200,600,-200" scale=3 isdestination=false stayactive=true distance=100 addtime=1 6>307 <CheckPoint name=trigger5 position="7200,600,-200" scale=3 isdestination=false stayactive=true distance=100 addtime=10> 308 308 <events> 309 309 <activity> … … 356 356 357 357 358 <CheckPoint name=trigger6 position="9200, 800,-800" scale=3 isdestination=false stayactive=true distance=100 addtime= 22>358 <CheckPoint name=trigger6 position="9200, 800,-800" scale=3 isdestination=false stayactive=true distance=100 addtime=15> 359 359 <events> 360 360 <activity> -
code/trunk/data/levels/docking.oxw
r9016 r9348 21 21 <Scene 22 22 ambientlight = "0.5, 0.5, 0.5" 23 skybox = "Orxonox/sky panoramagen1"23 skybox = "Orxonox/skyBoxBasic" 24 24 > 25 25 -
code/trunk/data/levels/dynamicMatch.oxw
r9016 r9348 10 10 include("stats.oxo") 11 11 include("templates/spaceshipAssff.oxt") 12 include("templates/spaceshipSwallow.oxt") 13 include("templates/spaceshipPirate.oxt") 12 14 include("templates/spaceshipGhost.oxt") 13 15 include("dynamicMatchHUD.oxo") … … 39 41 <!-- -----------12-Spawnpoints around the planet------------- --> 40 42 <!-- inner Spawnpoints --> 41 <TeamSpawnPoint team=0 position="1000,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>42 <TeamSpawnPoint team=0 position="-1000,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>43 <TeamSpawnPoint team=0 position="0,1000,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>44 <TeamSpawnPoint team=0 position="0,-1000,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>45 <TeamSpawnPoint team=0 position="0,0,1000" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>46 <TeamSpawnPoint team=0 position="0,0,-1000" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>43 <TeamSpawnPoint team=0 position="1000,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 44 <TeamSpawnPoint team=0 position="-1000,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 45 <TeamSpawnPoint team=0 position="0,1000,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 46 <TeamSpawnPoint team=0 position="0,-1000,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 47 <TeamSpawnPoint team=0 position="0,0,1000" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 48 <TeamSpawnPoint team=0 position="0,0,-1000" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 47 49 <!--outer Spawnpoints --> 48 <TeamSpawnPoint team=0 position="2000,0,0" lookat="0,0,1" spawnclass=SpaceShip pawndesign=spaceship assff/>49 <TeamSpawnPoint team=0 position="-2000,0,0" lookat="0,0,-1" spawnclass=SpaceShip pawndesign=spaceship assff/>50 <TeamSpawnPoint team=0 position="0,2000,0" lookat="0,1,0" spawnclass=SpaceShip pawndesign=spaceship assff/>51 <TeamSpawnPoint team=0 position="0,-2000,0" lookat="0,-1,0" spawnclass=SpaceShip pawndesign=spaceship assff/>52 <TeamSpawnPoint team=0 position="0,0,2000" lookat="1,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>53 <TeamSpawnPoint team=0 position="0,0,-2000" lookat="-1,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>50 <TeamSpawnPoint team=0 position="2000,0,0" lookat="0,0,1" spawnclass=SpaceShip pawndesign=spaceshippirate/> 51 <TeamSpawnPoint team=0 position="-2000,0,0" lookat="0,0,-1" spawnclass=SpaceShip pawndesign=spaceshippirate/> 52 <TeamSpawnPoint team=0 position="0,2000,0" lookat="0,1,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 53 <TeamSpawnPoint team=0 position="0,-2000,0" lookat="0,-1,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 54 <TeamSpawnPoint team=0 position="0,0,2000" lookat="1,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 55 <TeamSpawnPoint team=0 position="0,0,-2000" lookat="-1,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 54 56 55 57 <?lua … … 64 66 createSpaceStationPar(0,2,1,2,1,4,1,50) 65 67 ?> 66 <TeamSpawnPoint team=2 position="20,20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>67 <TeamSpawnPoint team=2 position="-20,-20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>68 <TeamSpawnPoint team=2 position="-10,10,20" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceship assff/>68 <TeamSpawnPoint team=2 position="20,20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 69 <TeamSpawnPoint team=2 position="-20,-20,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 70 <TeamSpawnPoint team=2 position="-10,10,20" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate/> 69 71 </attached> 70 72 </StaticEntity> … … 90 92 <attached> 91 93 <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh"> 92 94 <attached><!-- ---------asteroid fog----- --> 93 95 <ParticleEmitter position="0,0,0" source="Orxonox/Steam" /> 94 96 </attached> 95 97 </Model> 96 98 </attached> 97 99 <?lua if i == 5 then ?><collisionShapes> -
code/trunk/data/levels/events.oxw
r9016 r9348 22 22 <Scene 23 23 ambientlight = "0.5, 0.5, 0.5" 24 skybox = "Orxonox/sky panoramagen1"24 skybox = "Orxonox/skyBoxBasic" 25 25 > 26 26 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/fightInOurBack.oxw
r9016 r9348 121 121 <Scene 122 122 ambientlight="0.8,0.8,0.8" 123 skybox="Orxonox/sky panoramagen1"123 skybox="Orxonox/skyBoxBasic" 124 124 > 125 125 -
code/trunk/data/levels/includes/CuboidSpaceStation.lua
r7163 r9348 1 1 ---------------------------------------------------------------------------------------------------- 2 2 -- This lua script creates a totally random generated space station for the orxonox computer game!-- 3 -- (c) Wallah 2008, published under GPL licence! 3 -- (c) Wallah 2008, published under GPL licence! -- 4 4 ---------------------------------------------------------------------------------------------------- 5 5 6 6 -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 7 -- IMPORTANT: If you need more parameters, do the following: copy the actual function (just the headline and the end statement) to the end of the file, 7 -- IMPORTANT: If you need more parameters, do the following: copy the actual function (just the headline and the end statement) to the end of the file, -- 8 8 -- like I did with createSpaceStation() and let that function call the new function where you can modify the parameters. For all parameters which the old function-- 9 9 -- doesn't have you just give the standard default values, which I have defined. This is to make sure, that anyone else who uses the old function can still use it-- 10 -- the same way he/she always did. If you want a function with less parameters, just create a new one at the end of the file and call this function with some 11 -- default values. REMEMBER: Function overloading is not possible, be sure to call your function differently from others already existing ones. 10 -- the same way he/she always did. If you want a function with less parameters, just create a new one at the end of the file and call this function with some -- 11 -- default values. REMEMBER: Function overloading is not possible, be sure to call your function differently from others already existing ones. -- 12 12 -------------------------------------------------------------------------------------------------------------------------------------------------------------------- 13 13 14 14 -- This function creates a randomly generated space station. 15 15 -- The first argument ranSeed, must be 0, or a positive Integer, if it is 0 your space station is always chosen randomly, if you give an integer, 16 -- 16 -- your space station will be generated randomly, but once you have the space station it will always be the same. 17 17 -- The argument xLength defines how large the space station will be into the x-direction. 18 18 -- The argument xVar defines how much the space station will vary at the ends in x-direction, this is so that the station is no cube. … … 37 37 -- Create a randomseed, so that the math.random() function is actually random. 38 38 if ranSeed == 0 then 39 39 math.randomseed(os.time()) 40 40 else 41 41 math.randomseed(ranSeed) 42 42 end 43 43 -- End create randomseed. … … 52 52 sSSize=30 53 53 if xLength>=yLength and xLength>=zLength then 54 54 sSSize=xLength+20 55 55 elseif yLength>=xLength and yLength>=zLength then 56 56 sSSize=yLength+20 57 57 elseif zLength>=xLength and zLength>=yLength then 58 58 sSSize=zLength+20 59 59 end 60 60 -- Define how many parts the space station has, this value has to be exact, so be sure to increment it if you're adding a new part. … … 78 78 pDim=6 79 79 -- Define the griddimension, be sure this value matches the size of a single space station part plus the size of a connection part, which means your parts must be: 80 -- 80 -- integer*(gridDim-connectionSize), then integer tells you how many griddimensions your part is. 81 81 gridDim=2.25 82 82 -- End define global parameters. … … 89 89 -- The parameters x,y,z are the axis of the space station, which iterate to sSSize, the maximal size of the space station. 90 90 -- The griddimension, this word I will use later, means that the distance of a point to the next point is gridDim in the game, so the absolute x-axis is x*gridDim*sSScale, 91 -- 91 -- and so on for the other dimensions y and z. 92 92 -- grid[x][y][z][0] contains 0 if there is no part at the position (x,y,z), otherwise 1. 93 93 -- grid[x][y][z][1] contains 0 if there is no connection from (x,y,z) in x-direction, "+" if there is one in the positive x-direction, 94 -- 94 -- "-" if there is one in the negative x-direction, "+-" if there are in both x-directions. 95 95 -- grid[x][y][z][2] contains 0 if there is no connection from (x,y,z) in y-direction, "+" if there is one in the positive y-direction, 96 -- 96 -- "-" if there is one in the negative y-direction, "+-" if there are in both y-directions. 97 97 -- grid[x][y][z][3] contains 0 if there is no connection from (x,y,z) in z-direction, "+" if there is one in the positive z-direction, 98 -- 98 -- "-" if there is one in the negative z-direction, "+-" if there are in both z-directions. 99 99 grid = {} 100 100 for x=-math.floor(sSSize/2),math.floor(sSSize/2) do 101 102 103 104 105 106 107 108 109 110 101 grid[x] = {} 102 for y=-math.floor(sSSize/2),math.floor(sSSize/2) do 103 grid[x][y]= {} 104 for z=-math.floor(sSSize/2),math.floor(sSSize/2) do 105 grid[x][y][z]={} 106 for i=0,3 do 107 grid[x][y][z][i]=0 108 end 109 end 110 end 111 111 end 112 112 -- End create 4-dim grid. … … 119 119 -- The first parameter i, tells us how many parts fit into the array, so it iterates from 1 to sSParts, each part has his own value i. 120 120 -- The second, third and fourth parameters are the relative coordinates of the part, you have to start at (0,0,0) and be sure you fill the array into the right direction. 121 -- 122 -- 121 -- A short example: your part is 2 griddimensions long and you place it in the game, that the relative coordinate point is at (0,0,0) and the part lies in the positive 122 -- z-axis, then you have to use the coordinate point (0,0,1). 123 123 -- The fifth parameter is an array with size 4, at index=0, you have to set 1 if your part covers the gridpoint at (x,y,z), otherwise 0. 124 -- 124 -- At index=1,2,3 you define the possible connection directions (1 for x, 2 for y and 3 for z), be sure to use the notation from above (0, "+-", "+", "-"). 125 125 bodyParts={} 126 126 for i=1,sSParts do 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 127 bodyParts[i]={} 128 for x=-math.floor(pDim/2),math.floor(pDim/2) do 129 bodyParts[i][x]={} 130 for y=-math.floor(pDim/2),math.floor(pDim/2) do 131 bodyParts[i][x][y]={} 132 for z=-math.floor(pDim/2),math.floor(pDim/2) do 133 bodyParts[i][x][y][z]={} 134 for k=0,3 do 135 bodyParts[i][x][y][z][k]=0 136 end 137 end 138 end 139 end 140 -- This contains the name of the mesh file. 141 bodyParts[i][0][0][0][4]="" 142 -- This contains the first possible rotation of your part, pitch=... yaw=... roll=... . 143 bodyParts[i][0][0][0][5]="" 144 -- This contains the second possible rotation of your part, pitch=... yaw=... roll=... . 145 bodyParts[i][0][0][0][6]="" 146 -- This contains the third possible rotation of your part, pitch=... yaw=... roll=... . 147 bodyParts[i][0][0][0][7]="" 148 -- Contains the movement rotation, rotationaxis=... rotationrate=... . 149 bodyParts[i][0][0][0][8]="" 150 -- Contains the attachment, if your part has an attachment, e.g. <ParticleEmitter .../>. 151 bodyParts[i][0][0][0][9]="" 152 -- Contains how many of this part you want to attach to your space station. 153 bodyParts[i][0][0][0][10]=1 154 154 end 155 155 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 193 193 194 194 -- Insert the CuboidConnectionBody, it is three griddimensions long and one wide and high and can have only connections at griddimension 1 195 -- 195 -- (except the side in direction of griddimension 2) and griddimension 3 (except the side in direction of griddimension 2). 196 196 bodyParts[3][0][0][0][4]="CuboidConnBody.mesh" 197 197 bodyParts[3][0][0][0][5]="pitch=-90" … … 373 373 --This function actualizes the grid, which I have to call always after I have added a new part to the space station. 374 374 function actualizeGrid(Index,x,y,z) 375 376 377 378 379 380 381 382 383 384 385 375 for i=math.floor(-pDim/2)+1,math.floor(pDim/2) do 376 for j=math.floor(-pDim/2)+1,math.floor(pDim/2) do 377 for k=math.floor(-pDim/2)+1,math.floor(pDim/2) do 378 if bodyParts[Index][i][j][k][0] == 1 then 379 for l=0,3 do 380 grid[x+i][y+j][z+k][l] = bodyParts[Index][i][j][k][l] 381 end 382 end 383 end 384 end 385 end 386 386 end 387 387 -- End actualizeGrid. … … 390 390 -- If the part fits there it returns 1, otherwise 0. 391 391 function checkPart(Index,x,y,z) 392 393 394 395 396 397 --which means that the part doesn't fit there.398 399 400 401 402 403 404 392 check=1 393 for i=math.floor(-pDim/2)+1,math.floor(pDim/2) do 394 for j=math.floor(-pDim/2)+1,math.floor(pDim/2) do 395 for k=math.floor(-pDim/2)+1,math.floor(pDim/2) do 396 -- If the part occupies the position (i,j,k), the grid must be empty there ((x+i, y+j, z+k)==0), if not, check is zero, 397 -- which means that the part doesn't fit there. 398 if bodyParts[Index][i][j][k][0] == 1 and grid[x+i][y+j][z+k][0] == 1 then 399 check=0 400 end 401 end 402 end 403 end 404 return check 405 405 end 406 406 -- End checkPart function. … … 408 408 -- This function prints the model with tempPartIndex in the bodyParts array at position lx,ly,lz. 409 409 -- If you need to rotate the model around his own axis, then you have to set movEntity true and define the details of the rotation in 410 -- 410 -- bodyParts[tempPartIndex][0][0][0][8]. 411 411 -- If your model needs to be rotated like bodyParts[tempPartIndex][0][0][0][5], then side must be 1, for bodyParts[tempPartIndex][0][0][0][6] side must be 2, 412 -- 412 -- for bodyParts[tempPartIndex][0][0][0][7] side must be 3. 413 413 function printModel(lx,ly,lz,tempPartIndex,movEntity,side) 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 414 if movEntity == true then 415 print("<MovableEntity scale=1 position=\"") print(lx*gridDim*sSScale) print(",") print(ly*gridDim*sSScale) print(",") print(lz*gridDim*sSScale) print("\" ") 416 print(bodyParts[tempPartIndex][0][0][0][8]) print(">") 417 print("<attached>") 418 lx=0 ly=0 lz=0 419 end 420 421 print("<Model position=\"") print(lx*gridDim*sSScale) print(",") print(ly*gridDim*sSScale) print(",") print(lz*gridDim*sSScale) 422 print("\" scale=") print(sSScale) print(" mesh= \"") print(bodyParts[tempPartIndex][0][0][0][4]) print("\"") 423 424 if side == 1 then 425 print(bodyParts[tempPartIndex][0][0][0][5]) print(">") 426 elseif side == 2 then 427 print(bodyParts[tempPartIndex][0][0][0][6]) print(">") 428 elseif side == 3 then 429 print(bodyParts[tempPartIndex][0][0][0][7]) print(">") 430 end 431 432 print("<attached>") 433 print(bodyParts[tempPartIndex][0][0][0][9]) 434 print("</attached>") 435 436 print("</Model>") 437 438 if movEntity == true then 439 print("</attached>") 440 print("</MovableEntity>") 441 end 442 442 end 443 443 -- End function printModel(). … … 446 446 -- The arguments lx,ly,lz are the coordinates of the grid, where you want to set the part. 447 447 -- The arguments xAxis,yAxis,zAxis can be 0 or 1, but only one argument out of the three can be 1. This means two of them must always be zero. You have to set xAxis to one, 448 -- 449 -- 448 -- if your part is attached to a side, which faces into the x-direction (negative or positive, this is later specified with Dir), that means the x-Axis is a normal vector 449 -- of the side to which you want to attach the part. The same for yAxis and zAxis. 450 450 -- The argument Dir must be 1 if your side, where you want to attach the part, faces into the positive direction, -1 if the side faces into the negative direction. The side 451 -- 452 -- 451 -- faces into the positive direction means, that the side of the side where the part will be attached is directed into the direction of the positive direction of the 452 -- corresponding axis. 453 453 -- The argument index is the index of the part for the bodyParts array. 454 454 -- The argument printMovEnt must be false if your part doesn't need to be attached to an extra MovableEntity. If your part must be attached to an extra MovableEntity 455 -- 455 -- this argument must be true. The extra MovableEntity is used to rotate the part around his own axis, or something like that. 456 456 -- The argument printSide is like the argument side of the printModel() function. It defines how your part will be rotated. Read the commentary there. 457 457 -- The function returns 0 if the part couldn't be set, because it did not fit there or there was no side to attach the part. It returns 1 if the part is successfully set. 458 458 function setPart(lx,ly,lz,xAxis,yAxis,zAxis,Dir,index,printMovEnt,printSide) 459 459 460 461 462 463 464 --a connection into the positive direction. Otherwise I look from the negative side and so the part of the station must have a connection into the negative direction.465 466 467 468 469 470 471 --at the next position is a part which can have a connection into the direction from where I look.472 473 474 475 476 477 478 479 480 481 482 483 460 partSet=0 461 -- For the bodyParts array I use 1 as x-, 2 as y- and 3 as z-Axis for the definition in which directions a part can have connections. 462 coord=1*xAxis+2*yAxis+3*zAxis 463 -- If I try to attach the part from the positive direction to the side of the space station, the part of the station (where I want to attach the new part) must have 464 -- a connection into the positive direction. Otherwise I look from the negative side and so the part of the station must have a connection into the negative direction. 465 if Dir==1 then 466 conn="+" 467 elseif Dir==-1 then 468 conn="-" 469 end 470 -- I look from the direction defined through Dir, and here I check, whether I have reached a side of the space station, which means at position lx,ly,lz is nothing and 471 -- at the next position is a part which can have a connection into the direction from where I look. 472 if grid[lx][ly][lz][0] == 0 and grid[lx+(-1*xAxis*Dir)][ly+(-1*yAxis*Dir)][lz+(-1*zAxis*Dir)][0] == 1 and (grid[lx+(-1*xAxis*Dir)][ly+(-1*yAxis*Dir)][lz+(-1*zAxis*Dir)][coord]=="+-" or grid[lx+(-1*xAxis*Dir)][ly+(-1*yAxis*Dir)][lz+(-1*zAxis*Dir)][coord]==conn) then 473 -- This checks whether the part fits at that position or not. 474 check=checkPart(index,lx,ly,lz) 475 if check == 1 then 476 -- This prints the part. 477 printModel(lx,ly,lz,index,printMovEnt,printSide) 478 partSet=1 479 -- This actualizes the grid array with the values of the array bodyParts at the position index. 480 actualizeGrid(index,lx,ly,lz) 481 end 482 end 483 return partSet 484 484 end 485 485 -- End function setPart(). … … 490 490 -- The argument parts is the number of different parts which you want to attach to a side. 491 491 function spiralSet(xAxis,yAxis,zAxis,Dir,index,parts,printMovEnt,printSide) 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 492 if index[0] ~= false then 493 -- The array vector contains the actual position where you try to set the part. vector[0],vector[1] and vector[3] contains the x,y,z-coordinate. 494 vector={} 495 -- This must be done, because there are different sides from where I try to attach a part. 496 coord1=1*yAxis+2*zAxis 497 coord2=math.mod(coord1+1,3) 498 coord3=math.mod(coord2+1,3) 499 500 for pc=1,parts do 501 tempIndex = index[pc] 502 for eachPart=1,bodyParts[tempIndex][0][0][0][10] do 503 partSet=0 504 vector[coord1]=math.floor(Dir*sSSize/2)-2*Dir 505 while vector[coord1]~=math.floor(-1*Dir*sSSize/2)+2*Dir and partSet==0 do 506 round=0 507 while round<=math.floor(sSSize/2)-2 and partSet==0 do 508 vector[coord2]=round 509 vector[coord3]=-round 510 while vector[coord3]<=round and partSet==0 do 511 partSet=setPart(vector[0],vector[1],vector[2],xAxis,yAxis,zAxis,Dir,tempIndex,printMovEnt,printSide) 512 vector[coord3]=vector[coord3]+1 513 end 514 while vector[coord2]>=-round and partSet==0 do 515 partSet=setPart(vector[0],vector[1],vector[2],xAxis,yAxis,zAxis,Dir,tempIndex,printMovEnt,printSide) 516 vector[coord2]=vector[coord2]-1 517 end 518 while vector[coord3]>-round and partSet==0 do 519 partSet=setPart(vector[0],vector[1],vector[2],xAxis,yAxis,zAxis,Dir,tempIndex,printMovEnt,printSide) 520 vector[coord3]=vector[coord3]-1 521 end 522 while vector[coord2]<=round and partSet==0 do 523 partSet=setPart(vector[0],vector[1],vector[2],xAxis,yAxis,zAxis,Dir,tempIndex,printMovEnt,printSide) 524 vector[coord2]=vector[coord2]+1 525 end 526 round=round+1 527 end 528 vector[coord1]=vector[coord1]-Dir 529 end 530 end 531 end 532 end 533 533 end 534 534 -- End function spiralSet(). … … 554 554 xMax=math.random(math.floor(xLength/2),math.floor(xLength/2)+xVar) 555 555 while x<xMax do 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 556 -- The same for the y- and z-direction. 557 y=math.random(-math.floor(yLength/2),-math.floor(yLength/2)+yVar) 558 yMax=math.random(math.floor(yLength/2),math.floor(yLength/2)+yVar) 559 while y<yMax do 560 yMax=math.random(math.floor(yLength/2),math.floor(yLength/2)+yVar) 561 z=math.random(-math.floor(zLength/2),-math.floor(zLength/2)+zVar) 562 zMax=math.random(math.floor(zLength/2),math.floor(zLength/2)+zVar) 563 while z<zMax do 564 -- This loop choses a bodypart, which fits at position (x,y,z). 565 -- If after the fifth time the part does still not fit we terminate the loop and set no part at postition (x,y,z). 566 partSet=0 567 counter=0 568 while counter<5 and partSet==0 do 569 -- This choses randomly a bodyPartIndex, which is the index used for the parts in the array bodyParts. 570 tempBodyPartIndex=math.random(1,sSBodyParts) 571 check=checkPart(tempBodyPartIndex,x,y,z) 572 -- If check == 1, this means that the part fits there, so we put it there and break the while true loop, to go on. 573 if check == 1 then 574 -- This prints the chosen part at position (x*gridDim*sSScale,y*gridDim*sSScale,z*gridDim*sSScale). 575 printModel(x,y,z,tempBodyPartIndex,false,1) 576 -- This actualizes the grid array with the values of the array bodyParts at the position tempBodyPartIndex, which is our randomly chosen part. 577 actualizeGrid(tempBodyPartIndex,x,y,z) 578 partSet=1 579 end 580 counter=counter+1 581 end 582 z=z+1 583 end 584 y=y+1 585 end 586 x=x+1 587 587 end 588 588 -- End attach all bodyparts. … … 593 593 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 594 594 -- Attach backParts, if there are some. 595 595 spiralSet(0,0,1,1,backPartsIndex,backParts,false,1) 596 596 -- End attach backParts. 597 597 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 599 599 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 600 600 -- Attach frontParts, if there are. 601 601 spiralSet(0,0,1,-1,frontPartsIndex,frontParts,false,1) 602 602 -- End attach frontParts. 603 603 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 605 605 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 606 606 -- Attach parts on the left side of the space station. 607 607 spiralSet(1,0,0,-1,leftSidePartsIndex,leftSideParts,true,1) 608 608 -- End attach left side parts. 609 609 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 611 611 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 612 612 -- Attach parts on the right side of the space station. 613 613 spiralSet(1,0,0,1,rightSidePartsIndex,rightSideParts,true,2) 614 614 -- End attach right side parts. 615 615 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 617 617 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 618 618 -- Attach parts on top of the space station. 619 619 spiralSet(0,1,0,1,topPartsIndex,topParts,true,1) 620 620 -- End attach top parts. 621 621 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- … … 627 627 -- This iterates through the whole grid array. 628 628 if connPartsIndex[0] ~= false then 629 630 631 632 633 634 --then it checks if that part can have a connection into the positive x-direction, if it can, it checks if there is a part at (x+1,y,z) and635 --if that part can have a connection into the negative x-direction, if both can, it prints the xml code to set a connection part.636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 629 for x=math.floor(-sSSize/2)+2,math.floor(sSSize/2)-2 do 630 for y=math.floor(-sSSize/2)+2,math.floor(sSSize/2)-2 do 631 for z=math.floor(-sSSize/2)+2,math.floor(sSSize/2)-2 do 632 tempConnPartIndex=connPartsIndex[math.random(1,connParts)] 633 -- This checks whether there has to be a connection part between (x,y,z) and (x+1,y,z) or not. First it checks if there is a part at (x,y,z) and 634 -- then it checks if that part can have a connection into the positive x-direction, if it can, it checks if there is a part at (x+1,y,z) and 635 -- if that part can have a connection into the negative x-direction, if both can, it prints the xml code to set a connection part. 636 if grid[x][y][z][0]==1 and (grid[x][y][z][1]=="+" or grid[x][y][z][1]=="+-") and grid[x+1][y][z][0]==1 and (grid[x+1][y][z][1]=="-" or grid[x+1][y][z][1]=="+-") then 637 -- This prints the connection part, the +1/2 is because the connection is set exactly in the middle of two gridpoints. 638 printModel(x+1/2,y,z,tempConnPartIndex,false,1) 639 end 640 -- The same as in the x-direction, but for the y-direction. 641 if grid[x][y][z][0]==1 and ( grid[x][y][z][2]=="+" or grid[x][y][z][2]=="+-" ) and grid[x][y+1][z][0]==1 and ( grid[x][y+1][z][2]=="-" or grid[x][y+1][z][2]=="+-" ) then 642 printModel(x,y+1/2,z,tempConnPartIndex,false,2) 643 end 644 -- The same as in the x-direction, but for the z-direction. 645 if grid[x][y][z][0]==1 and ( grid[x][y][z][3]=="+" or grid[x][y][z][3]=="+-" ) and grid[x][y][z+1][0]==1 and ( grid[x][y][z+1][3]=="-" or grid[x][y][z+1][3]=="+-" ) then 646 printModel(x,y,z+1/2,tempConnPartIndex,false,3) 647 end 648 end 649 end 650 end 651 651 end 652 652 -- End attach all connectionparts. … … 671 671 -- This function is for the lazy guys, which do not care how the space station looks like, so I use some good standard values. 672 672 function createSpaceStation() 673 673 createSpaceStationPar(0,4,1,2,1,6,1,100) 674 674 end 675 675 -- End createSpaceStaion() function. -
code/trunk/data/levels/includes/asteroidField.lua
- Property svn:eol-style set to native
r9016 r9348 1 1 --[[ fog generator 2 2 generates fog 3 4 5 3 posX, posY, posZ - position in space 4 size - size of billboard 5 brightness - [0,1] fog brightness 6 6 --]] 7 7 function generateFog(posX, posY, posZ, size, brightness) 8 9 print("position = \"") 10 print(posX) print(",") 11 print(posY) print(",") 12 print(posZ) print("\" ") 13 14 print(brightness) print(",") 15 print(brightness) print(",") 16 print(brightness) print("\" ") 17 18 19 8 print("<Billboard ") 9 print("position = \"") 10 print(posX) print(",") 11 print(posY) print(",") 12 print(posZ) print("\" ") 13 print("colour=\"") 14 print(brightness) print(",") 15 print(brightness) print(",") 16 print(brightness) print("\" ") 17 print("material=\"Smoke/Smoke\" scale=") 18 print(size) 19 print(" />") 20 20 end 21 21 22 22 --[[ asteroid field generator 23 23 generates asteroid field 24 25 26 27 28 24 posX, posY, posZ - position in space 25 minSize, maxSize - size boundaries of each asteroid 26 radius - size of the cube around position in space 27 count - number of asteroids 28 fog - enable fog 0/1 29 29 --]] 30 30 function asteroidField(posX, posY, posZ, minSize, maxSize, radius, count, fog) 31 for i = 1, count, 1 32 do 33 size = (math.random() * (maxSize - minSize)) + minSize 34 pX = (2 * math.random() * radius) - radius + posX 35 pY = (2 * math.random() * radius) - radius + posY 36 pZ = (2 * math.random() * radius) - radius + posZ 37 print("<StaticEntity ") 38 39 print("position = \"") 40 print(pX) print(",") 41 print(pY) print(",") 42 print(pZ) print("\" ") 43 44 print("scale = \"") print(size) print("\" ") 45 46 print("collisionType = static linearDamping = 0.8 angularDamping = 1 ") 47 print("collisiondamage = 1000 enablecollisiondamage = true>") 48 49 print("<attached>") 50 print("<Model mass=\"") print(size * 10) print("\" ") 51 print("mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" />") 52 print("</attached>") 53 54 print("<collisionShapes> ") 55 print("<SphereCollisionShape radius=\"") 56 print(size * 2.5) print("\" />") 57 print("</collisionShapes>") 58 59 print("</StaticEntity>") 60 61 if fog == 1 and i % 5 == 0 then 62 generateFog(pX, pY, pZ, radius*0.04, 0.2) 63 end 64 end 31 for i = 1, count, 1 do 32 size = (math.random() * (maxSize - minSize)) + minSize 33 pX = (2 * math.random() * radius) - radius + posX 34 pY = (2 * math.random() * radius) - radius + posY 35 pZ = (2 * math.random() * radius) - radius + posZ 36 print("<StaticEntity ") 37 38 print("position = \"") 39 print(pX) print(",") 40 print(pY) print(",") 41 print(pZ) print("\" ") 42 43 print("scale = \"") print(size) print("\" ") 44 45 print("collisionType = static linearDamping = 0.8 angularDamping = 1 ") 46 print("collisiondamage = 1000 enablecollisiondamage = true>") 47 48 print("<attached>") 49 print("<Model mass=\"") print(size * 10) print("\" ") 50 print("mesh=\"ast") print(math.mod(i,6) + 1) print(".mesh\" />") 51 print("</attached>") 52 53 print("<collisionShapes> ") 54 print("<SphereCollisionShape radius=\"") 55 print(size * 2.5) print("\" />") 56 print("</collisionShapes>") 57 58 print("</StaticEntity>") 59 60 if fog == 1 and i % 5 == 0 then 61 generateFog(pX, pY, pZ, radius*0.04, 0.2) 62 end 63 end 65 64 end 66 65 … … 68 67 --[[ asteroid belt generator 69 68 generates asteroid belt 70 71 72 73 74 75 69 posX, posY, posZ - position in space 70 yaw, pitch - rotation 71 minSize, maxSize - size boundaries of each asteroid 72 radius0, radius1 - inner/outer radius 73 count - number of asteroids 74 fog - enable fog 0/1 76 75 --]] 77 76 function asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog) 78 dPhi = (2 * math.pi) / segments 79 width = math.abs(radius1 - radius0) 80 radius = (radius1 + radius0) / 2 81 segmentCount = count / segments 82 83 print("<StaticEntity collisionType=static yaw=") print(yaw) 84 print(" pitch=") print(pitch) 85 86 print(" position = \"") 87 print(centerX) print(",") 88 print(centerY) print(",") 89 print(centerZ) print("\"") 90 print(">") 91 92 print("<attached>") 93 94 for i = 0, segments - 1, 1 95 do 96 asteroidField((radius * math.cos(i * dPhi)), 97 (radius * math.sin(i * dPhi)), 98 0, minSize, maxSize, width, segmentCount, fog) 99 end 100 101 print("</attached>") 102 print("</StaticEntity>") 77 dPhi = (2 * math.pi) / segments 78 width = math.abs(radius1 - radius0) 79 radius = (radius1 + radius0) / 2 80 segmentCount = count / segments 81 82 print("<StaticEntity collisionType=static yaw=") print(yaw) 83 print(" pitch=") print(pitch) 84 85 print(" position = \"") 86 print(centerX) print(",") 87 print(centerY) print(",") 88 print(centerZ) print("\"") 89 print(">") 90 91 print("<attached>") 92 93 for i = 0, segments - 1, 1 do 94 asteroidField((radius * math.cos(i * dPhi)), 95 (radius * math.sin(i * dPhi)), 96 0, minSize, maxSize, width, segmentCount, fog) 97 end 98 99 print("</attached>") 100 print("</StaticEntity>") 103 101 end -
code/trunk/data/levels/includes/pickups.oxi
r8713 r9348 3 3 4 4 <PickupRepresentation 5 name = "smallshieldpickup" 5 6 pickupName = "Small Shield Pickup" 6 7 pickupDescription = "Gives you a small-sized shield for 30 seconds." 7 8 inventoryRepresentation = "SmallShield" 8 9 spawnerTemplate = "smallshieldpickupRepresentation" 9 > 10 <pickup> 11 <ShieldPickup template=smallshieldpickup /> 12 </pickup> 13 </PickupRepresentation> 14 15 <PickupRepresentation 10 /> 11 12 <PickupRepresentation 13 name = "mediumshieldpickup" 16 14 pickupName = "Medium Shield Pickup" 17 15 pickupDescription = "Gives you a medium-sized shield for 30 seconds." 18 16 inventoryRepresentation = "MediumShield" 19 17 spawnerTemplate = "mediumshieldpickupRepresentation" 20 > 21 <pickup> 22 <ShieldPickup template=mediumshieldpickup /> 23 </pickup> 24 </PickupRepresentation> 25 26 <PickupRepresentation 18 /> 19 20 <PickupRepresentation 21 name = "hugeshieldpickup" 27 22 pickupName = "Huge Shield Pickup" 28 23 pickupDescription = "Gives you a big shield for 60 seconds." 29 24 inventoryRepresentation = "HugeShield" 30 25 spawnerTemplate = "hugeshieldpickupRepresentation" 31 > 32 <pickup> 33 <ShieldPickup template=hugeshieldpickup /> 34 </pickup> 35 </PickupRepresentation> 26 /> 36 27 37 28 <!-- Health pickups --> 38 29 39 30 <PickupRepresentation 31 name = "smallhealthpickup" 40 32 pickupName = "Small Health Boost" 41 33 pickupDescription = "Adds a small amout of health to the ship." 42 34 inventoryRepresentation = "SmallHealth" 43 35 spawnerTemplate = "smallhealthpickupRepresentation" 44 > 45 <pickup> 46 <HealthPickup template=smallhealthpickup /> 47 </pickup> 48 </PickupRepresentation> 49 50 <PickupRepresentation 36 /> 37 38 <PickupRepresentation 39 name = "mediumhealthpickup" 51 40 pickupName = "Medium Health Boost" 52 41 pickupDescription = "Adds a medium amout of health to the ship." 53 42 spawnerTemplate = "mediumhealthpickupRepresentation" 54 43 inventoryRepresentation = "MediumHealth" 55 > 56 <pickup> 57 <HealthPickup template=mediumhealthpickup /> 58 </pickup> 59 </PickupRepresentation> 60 61 <PickupRepresentation 44 /> 45 46 <PickupRepresentation 47 name = "hugehealthpickup" 62 48 pickupName = "Huge Health Boost" 63 49 pickupDescription = "Adds a huge amout of health to the ship." 64 50 spawnerTemplate = "hugehealthpickupRepresentation" 65 51 inventoryRepresentation = "HugeHealth" 66 > 67 <pickup> 68 <HealthPickup template=hugehealthpickup /> 69 </pickup> 70 </PickupRepresentation> 71 72 <PickupRepresentation 52 /> 53 54 <PickupRepresentation 55 name = "crazyhealthpickup" 73 56 pickupName = "Crazy Madness Health Boost" 74 57 pickupDescription = "Adds a crazy amout of health to the ship." 75 58 spawnerTemplate = "crazyhealthpickupRepresentation" 76 59 inventoryRepresentation = "CrazyMadnessHealth" 77 > 78 <pickup> 79 <HealthPickup template=crazyhealthpickup /> 80 </pickup> 81 </PickupRepresentation> 60 /> 82 61 83 62 <!-- Meta pickups --> 84 63 85 64 <PickupRepresentation 65 name = "use" 86 66 pickupName = "Use Pickup" 87 67 pickupDescription = "Uses all pickups you have." 88 68 spawnerTemplate = "usepickupRepresentation" 89 69 inventoryRepresentation = "usePickup" 90 > 91 <pickup> 92 <MetaPickup metaType="use" /> 93 </pickup> 94 </PickupRepresentation> 95 96 <PickupRepresentation 70 /> 71 72 <PickupRepresentation 73 name = "drop" 97 74 pickupName = "Drop Pickup" 98 75 pickupDescription = "Drops all pickups you have." 99 76 spawnerTemplate = "droppickupRepresentation" 100 77 inventoryRepresentation = "dropPickup" 101 > 102 <pickup> 103 <MetaPickup metaType="drop" /> 104 </pickup> 105 </PickupRepresentation> 78 /> 106 79 107 80 <!-- Speed pickups --> 108 81 109 82 <PickupRepresentation 83 name = "smallspeedpickup" 110 84 pickupName = "Small Speed Boost" 111 85 pickupDescription = "Multiplies Speed of the Ship by a small amount." 112 86 spawnerTemplate = "smallspeedpickupRepresentation" 113 87 inventoryRepresentation = "SmallSpeed" 114 > 115 <pickup> 116 <SpeedPickup template=smallspeedpickup /> 117 </pickup> 118 </PickupRepresentation> 119 120 <PickupRepresentation 88 /> 89 90 <PickupRepresentation 91 name = "mediumspeedpickup" 121 92 pickupName = "Medium Speed Boost" 122 93 pickupDescription = "Multiplies Speed of the Ship by a bigger amount." 123 94 spawnerTemplate = "mediumspeedpickupRepresentation" 124 95 inventoryRepresentation = "MediumSpeed" 125 > 126 <pickup> 127 <SpeedPickup template=mediumspeedpickup /> 128 </pickup> 129 </PickupRepresentation> 130 131 <PickupRepresentation 96 /> 97 98 <PickupRepresentation 99 name = "hugespeedpickup" 132 100 pickupName = "Huge Speed Boost" 133 101 pickupDescription = "Multiplies Speed of the Ship by a huge amount." 134 102 spawnerTemplate = "hugespeedpickupRepresentation" 135 103 inventoryRepresentation = "HugeSpeed" 136 > 137 <pickup> 138 <SpeedPickup template=hugespeedpickup /> 139 </pickup> 140 </PickupRepresentation> 141 142 <PickupRepresentation 104 /> 105 106 <PickupRepresentation 107 name = "smalljumppickup" 143 108 pickupName = "Small Jump Boost" 144 109 pickupDescription = "Boosts the Ship with a massive amount for a very short time." 145 110 spawnerTemplate = "smalljumppickupRepresentation" 146 111 inventoryRepresentation = "SmallSpeed" 147 > 148 <pickup> 149 <SpeedPickup template=smalljumppickup /> 150 </pickup> 151 </PickupRepresentation> 112 /> 152 113 153 114 <!-- Invisible pickups --> 154 115 155 116 <PickupRepresentation 117 name = "smallinvisiblepickup" 156 118 pickupName = "Small Invisibility" 157 119 pickupDescription = "Makes you invisible for 5 seconds." 158 120 spawnerTemplate = "smallinvisiblepickupRepresentation" 159 121 inventoryRepresentation = "SmallInvisible" 160 > 161 <pickup> 162 <InvisiblePickup template=smallinvisiblepickup /> 163 </pickup> 164 </PickupRepresentation> 165 166 <PickupRepresentation 122 /> 123 124 <PickupRepresentation 125 name = "mediuminvisiblepickup" 167 126 pickupName = "Medium Invisibility" 168 127 pickupDescription = "Makes you invisible for 10 seconds." 169 128 spawnerTemplate = "mediuminvisiblepickupRepresentation" 170 129 inventoryRepresentation = "MediumInvisible" 171 > 172 <pickup> 173 <InvisiblePickup template=mediuminvisiblepickup /> 174 </pickup> 175 </PickupRepresentation> 176 177 <PickupRepresentation 130 /> 131 132 <PickupRepresentation 133 name = "hugeinvisiblepickup" 178 134 pickupName = "Huge Invisibility" 179 135 pickupDescription = "Makes you invisible for 20 seconds." 180 136 spawnerTemplate = "hugeinvisiblepickupRepresentation" 181 137 inventoryRepresentation = "HugeInvisible" 182 > 183 <pickup> 184 <InvisiblePickup template=hugeinvisiblepickup /> 185 </pickup> 186 </PickupRepresentation> 138 /> 187 139 188 140 <!-- Pickup Collection pickups --> 189 141 190 142 <PickupRepresentation 143 name = "triplehealthspeedinvisibilitypickup" 191 144 pickupName = "Tri Pickup" 192 145 pickupDescription = "Adds health, speed and invisibility." 193 146 spawnerTemplate = "triplehealthspeedinvisibilitypickupRepresentation" 194 > 195 <pickup> 196 <PickupCollection template=triplehealthspeedinvisibilitypickup /> 197 </pickup> 198 </PickupRepresentation> 147 /> 199 148 200 149 <!-- Drone Pickup --> 201 150 202 151 <PickupRepresentation 152 name = "dronepickup" 203 153 pickupName = "Drone Pickup" 204 154 pickupDescription = "Adds a Drone to the Player's Spaceship" 205 155 spawnerTemplate = "dronepickupRepresentation" 206 > 207 <pickup> 208 <DronePickup template=dronepickup /> 209 </pickup> 210 </PickupRepresentation> 156 /> 157 158 <!-- DamageBoost Pickup --> 159 160 <PickupRepresentation 161 name = "smalldamageboostpickup" 162 pickupName = "Small DamageBoost Pickup" 163 pickupDescription = "Multiplies the ship damage with 2." 164 spawnerTemplate = "smalldamageboostpickupRepresentation" 165 inventoryRepresentation = "SmallDamageBoost" 166 /> 167 168 <PickupRepresentation 169 name = "mediumdamageboostpickup" 170 pickupName = "Medium DamageBoost Pickup" 171 pickupDescription = "Multiplies the ship damage with 5." 172 spawnerTemplate = "mediumdamageboostpickupRepresentation" 173 inventoryRepresentation = "MediumDamageBoost" 174 /> 175 176 <PickupRepresentation 177 name = "largedamageboostpickup" 178 pickupName = "Large DamageBoost Pickup" 179 pickupDescription = "Multiplies the ship damage with 7." 180 spawnerTemplate = "largedamageboostpickupRepresentation" 181 inventoryRepresentation = "LargeDamageBoost" 182 /> 211 183 212 184 <!-- Shrink Pickup --> 213 185 214 186 <PickupRepresentation 187 name = "smallshrinkpickup" 215 188 pickupName = "Small Shrink" 216 189 pickupDescription = "Shrinks the Ship by a bit" 217 190 spawnerTemplate = "smallshrinkpickupRepresentation" 218 191 inventoryRepresentation = "SmallShrink" 219 > 220 <pickup> 221 <ShrinkPickup template=smallshrinkpickup /> 222 </pickup> 223 </PickupRepresentation> 224 225 <PickupRepresentation 192 /> 193 194 <PickupRepresentation 195 name = "mediumshrinkpickup" 226 196 pickupName = "Medium Shrink" 227 197 pickupDescription = "Shrinks the Ship" 228 198 spawnerTemplate = "mediumshrinkpickupRepresentation" 229 199 inventoryRepresentation = "MediumShrink" 230 > 231 <pickup> 232 <ShrinkPickup template=mediumshrinkpickup /> 233 </pickup> 234 </PickupRepresentation> 235 236 <PickupRepresentation 200 /> 201 202 <PickupRepresentation 203 name = "hugeshrinkpickup" 237 204 pickupName = "Huge Shrink" 238 205 pickupDescription = "Shrinks the Ship considerably" 239 206 spawnerTemplate = "hugeshrinkpickupRepresentation" 240 207 inventoryRepresentation = "HugeShrink" 241 > 242 <pickup> 243 <ShrinkPickup template=hugeshrinkpickup /> 244 </pickup> 245 </PickupRepresentation> 246 208 /> -
code/trunk/data/levels/includes/weaponSettingsFPS.oxi
r8755 r9348 1 1 <weaponslots> 2 2 <WeaponSlot position="0,0,0" yaw=0 pitch=0 roll=0 /> 3 <!-- <WeaponSlot position="-0.5,0.8,2.5" yaw=0 pitch=0 roll=0 /> 3 <!-- 4 <WeaponSlot position="-0.5,0.8,2.5" yaw=0 pitch=0 roll=0 /> 4 5 <WeaponSlot position="15,-1.5,-25" yaw=0 pitch=0 roll=0 /> 5 <WeaponSlot position="0,0,-45" yaw=0 pitch=0 roll=0 /> --> 6 <WeaponSlot position="0,0,-45" yaw=0 pitch=0 roll=0 /> 7 --> 6 8 </weaponslots> 7 9 <weaponsets> … … 11 13 <weapons> 12 14 <WeaponPack firemode=0> 13 15 <links> 14 16 <DefaultWeaponmodeLink firemode=0 weaponmode=0 /> 15 17 <DefaultWeaponmodeLink firemode=1 weaponmode=1 /> 16 18 <DefaultWeaponmodeLink firemode=2 weaponmode=2 /> 17 19 </links> 18 19 20 20 <Weapon> 21 <HsW01 mode=0 munitionpershot=0 delay=0.0 damage=2.5 material="Flares/point_lensflare" muzzleoffset=" 0.7, -0.3, -3" /> 22 <LightningGun mode=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20/> 21 23 </Weapon> 22 24 <LaserGun … … 28 30 unlimitedMunition=true 29 31 /> 30 <!-- <LaserGun32 <!--LaserGun 31 33 position="0,0,0" 32 34 munitionType="LaserGunMunition" … … 45 47 speed="600" 46 48 unlimitedMunition=true 47 / >-->49 /--> 48 50 </WeaponPack> 49 51 </weapons> -
code/trunk/data/levels/includes/weaponSettingsSpacecruiser.oxi
- Property svn:eol-style set to native
-
code/trunk/data/levels/lastManStanding.oxw
r9016 r9348 33 33 ?> 34 34 35 <!----- Spawnpoints 35 <!----- Spawnpoints 36 36 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0"/> 37 37 <SpawnPoint team=0 position="-1150,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff /> … … 44 44 45 45 <!-- ------------ middle asteroid -------------- --> 46 <StaticEntity position="0,0,0" collisionType=static> 46 <StaticEntity position="0,0,0" collisionType=static> 47 47 <attached> 48 48 <MovableEntity position="0,20,0" rotationrate="-4.5" rotationaxis="0,1,0" > … … 50 50 <Model position="0,0,0" scale=140 mesh="asteroid_UV.mesh" shadow=true /> 51 51 <Model position="-160,40,28.4" scale=1 mesh="sphere.mesh" /><!--EasterEgg indicator--> 52 <PickupSpawner position="-160,40,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="15"><!--EasterEgg : invisible pickup is hidden inside the asteroid --> 53 <pickup> 54 <InvisiblePickup template=hugeinvisiblepickup /> 55 </pickup> 56 </PickupSpawner> 52 <PickupSpawner pickup=hugeinvisiblepickup position="-160,40,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="15" /><!--EasterEgg : invisible pickup is hidden inside the asteroid --> 57 53 </attached> 58 54 </MovableEntity> … … 79 75 <attached> 80 76 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh"> 81 77 </Model> 82 78 </attached> 83 79 <collisionShapes> … … 89 85 <attached> 90 86 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i+3,6) + 1) ?>.mesh"> 91 87 </Model> 92 88 </attached> 93 89 <collisionShapes> … … 99 95 <attached> 100 96 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*5,6) + 1) ?>.mesh"> 101 97 </Model> 102 98 </attached> 103 99 <collisionShapes> … … 109 105 <attached> 110 106 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*13+1,6) + 1) ?>.mesh"> 111 107 </Model> 112 108 </attached> 113 109 <collisionShapes> … … 119 115 <attached> 120 116 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*17,6) + 1) ?>.mesh"> 121 117 </Model> 122 118 </attached> 123 119 <collisionShapes> … … 130 126 <attached> 131 127 <Model position="0,0,0" scale=25 mesh="ast6.mesh"> 132 128 </Model> 133 129 </attached> 134 130 <collisionShapes> -
code/trunk/data/levels/lastTeamStanding.oxw
r9016 r9348 18 18 name = "Last Team Standing" 19 19 description = "testmap for gametype last team standing" 20 gametype = " TeamGametype"20 gametype = "LastTeamStanding" 21 21 > 22 22 <templates> … … 27 27 <Scene 28 28 ambientlight = "0.8, 0.8, 0.8" 29 skybox = "Orxonox/sky panoramagen1"29 skybox = "Orxonox/skyBoxBasic" 30 30 > 31 <?lua include("includes/notifications.oxi") ?>32 31 33 32 <?lua … … 48 47 </StaticEntity> 49 48 50 <PickupSpawner position="-160,60,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="10"><!--EasterEgg--> 51 <pickup> 52 <InvisiblePickup template=hugeinvisiblepickup /> 53 </pickup> 54 </PickupSpawner> 49 <PickupSpawner pickup=hugeinvisiblepickup position="-160,60,17" triggerDistance="20" respawnTime="5" maxSpawnedItems="10" /><!--EasterEgg--> 55 50 <StaticEntity position="-160,60,28.4"><!--EasterEgg-Indicator--> 56 51 <attached> … … 74 69 <attached> 75 70 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh"> 76 71 </Model> 77 72 </attached> 78 73 <collisionShapes> … … 84 79 <attached> 85 80 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i+3,6) + 1) ?>.mesh"> 86 81 </Model> 87 82 </attached> 88 83 <collisionShapes> … … 94 89 <attached> 95 90 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*5,6) + 1) ?>.mesh"> 96 91 </Model> 97 92 </attached> 98 93 <collisionShapes> … … 104 99 <attached> 105 100 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*13+1,6) + 1) ?>.mesh"> 106 101 </Model> 107 102 </attached> 108 103 <collisionShapes> … … 114 109 <attached> 115 110 <Model position="0,0,0" scale=15 mesh="ast<?lua print( math.mod(i*17,6) + 1) ?>.mesh"> 116 111 </Model> 117 112 </attached> 118 113 <collisionShapes> … … 125 120 <attached> 126 121 <Model position="0,0,0" scale=25 mesh="ast6.mesh"> 127 122 </Model> 128 123 </attached> 129 124 <collisionShapes> -
code/trunk/data/levels/lastTeamStandingII.oxw
r9016 r9348 25 25 <Scene 26 26 ambientlight = "0.8, 0.8, 0.8" 27 skybox = "Orxonox/sky panoramagen1"27 skybox = "Orxonox/skyBoxBasic" 28 28 > 29 29 <!-- TODO: -
code/trunk/data/levels/missionOne.oxw
- Property svn:eol-style set to native
r9257 r9348 1153 1153 1154 1154 <!-- @Objects: Pickup - find better place !! --> 1155 <PickupSpawner position="-48650,700,100" triggerDistance="70" respawnTime="30" maxSpawnedItems="1"> 1156 <pickup> 1157 <ShieldPickup template=hugeshieldpickup /> 1158 </pickup> 1159 </PickupSpawner> 1155 <PickupSpawner pickup=hugeshieldpickup position="-48650,700,100" triggerDistance="70" respawnTime="30" maxSpawnedItems="1" /> 1160 1156 1161 1157 -
code/trunk/data/levels/notifications.oxw
r9016 r9348 21 21 <Scene 22 22 ambientlight = "0.5, 0.5, 0.5" 23 skybox = "Orxonox/sky panoramagen1"23 skybox = "Orxonox/skyBoxBasic" 24 24 > 25 25 -
code/trunk/data/levels/old/CuboidSpaceStation.oxw
r7679 r9348 1 1 <?lua 2 2 include("HUDTemplates3.oxo") 3 3 ?> 4 4 5 5 <?lua 6 6 include("templates/spaceshipAssff.oxt") 7 7 ?> 8 8 9 9 <Level 10 11 10 name = "SpaceStation test Space!" 11 description = "All the new SpaceStations are created here!" 12 12 > 13 14 15 16 13 <Scene 14 ambientlight = "0.5, 0.5, 0.5" 15 skybox = "Orxonox/Starbox" 16 > 17 17 18 18 … … 20 20 <!--------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 21 21 <?lua 22 22 dofile("includes/CuboidSpaceStation.lua") 23 23 ?> 24 24 … … 29 29 ---> 30 30 <?lua 31 31 createSpaceStation() 32 32 ?> 33 33 … … 37 37 ---> 38 38 <PositionableEntity scale=1 position="0,0,-5000"> 39 40 41 42 43 39 <attached> 40 <?lua 41 createSpaceStation() 42 ?> 43 </attached> 44 44 </PositionableEntity> 45 45 … … 49 49 ---> 50 50 <MovableEntity scale=1 position="5000,0,0" velocity="50,0,0" yaw=-90> 51 52 53 54 55 51 <attached> 52 <?lua 53 createSpaceStation() 54 ?> 55 </attached> 56 56 </MovableEntity> 57 57 … … 61 61 ---> 62 62 <MovableEntity scale=1 position="-5000,0,0" rotationaxis="0,1,0" rotationrate=5> 63 64 65 66 67 63 <attached> 64 <?lua 65 createSpaceStation() 66 ?> 67 </attached> 68 68 </MovableEntity> 69 69 … … 77 77 ---> 78 78 <MovableEntity scale=1 position="0,0,0" rotationaxis="0,1,0" rotationrate=3> 79 80 81 82 83 84 85 86 87 88 79 <attached> 80 <MovableEntity scale=1 position="10000,0,0" rotationaxis="0,0,1" rotationrate=2> 81 <attached> 82 <?lua 83 -- Here I use the createSpaceStationPar(...) function, which has 8 arguments, see the .lua file at the top to understand them. 84 createSpaceStationPar(0,2,1,2,1,2,1,50) 85 ?> 86 </attached> 87 </MovableEntity> 88 </attached> 89 89 </MovableEntity> 90 90 … … 95 95 96 96 97 97 <ParticleSpawner position="0,0,0" source="Orxonox/BigExplosion1part3" lifetime=2.0 loop=0 autostart=0> 98 98 <events> 99 99 <spawn> -
code/trunk/data/levels/old/presentationPhysics.oxw
r7679 r9348 12 12 <Scene 13 13 ambientlight = "0.8, 0.8, 0.8" 14 skybox = "Orxonox/sky panoramagen1"14 skybox = "Orxonox/skyBoxBasic" 15 15 gravity = "0, -10, 0" 16 16 > -
code/trunk/data/levels/old/princessAeryn.oxw
r7679 r9348 15 15 <Scene 16 16 ambientlight = "0.3, 0.3, 0.3" 17 skybox = "Orxonox/sky panoramagen1"17 skybox = "Orxonox/skyBoxBasic" 18 18 > 19 19 -
code/trunk/data/levels/pickups.oxw
r9016 r9348 37 37 <!-- Shield pickups --> 38 38 39 <PickupSpawner position="-25,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 40 <pickup> 41 <ShieldPickup template=smallshieldpickup /> 42 </pickup> 43 </PickupSpawner> 44 45 <PickupSpawner position="0,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 46 <pickup> 47 <ShieldPickup template=mediumshieldpickup /> 48 </pickup> 49 </PickupSpawner> 50 51 <PickupSpawner position="25,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 52 <pickup> 53 <ShieldPickup template=hugeshieldpickup /> 54 </pickup> 55 </PickupSpawner> 39 <PickupSpawner pickup=smallshieldpickup position="-25,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 40 <PickupSpawner pickup=mediumshieldpickup position="0,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 41 <PickupSpawner pickup=hugeshieldpickup position="25,-25,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 56 42 57 43 <!-- Health pickups --> 58 44 59 <PickupSpawner position="-25,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> 60 <pickup> 61 <HealthPickup template=smallhealthpickup /> 62 </pickup> 63 </PickupSpawner> 64 65 <PickupSpawner position="0,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> 66 <pickup> 67 <HealthPickup template=mediumhealthpickup /> 68 </pickup> 69 </PickupSpawner> 70 71 <PickupSpawner position="25,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> 72 <pickup> 73 <HealthPickup template=hugehealthpickup /> 74 </pickup> 75 </PickupSpawner> 76 77 <PickupSpawner position="50,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> 78 <pickup> 79 <HealthPickup template=crazyhealthpickup /> 80 </pickup> 81 </PickupSpawner> 45 <PickupSpawner pickup=smallhealthpickup position="-25,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 46 <PickupSpawner pickup=mediumhealthpickup position="0,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 47 <PickupSpawner pickup=hugehealthpickup position="25,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 48 <PickupSpawner pickup=crazyhealthpickup position="50,0,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 82 49 83 50 <!-- Speed pickups --> 84 51 85 <PickupSpawner position="-25,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99"> 86 <pickup> 87 <SpeedPickup template=smallspeedpickup /> 88 </pickup> 89 </PickupSpawner> 90 91 <PickupSpawner position="0,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99"> 92 <pickup> 93 <SpeedPickup template=mediumspeedpickup /> 94 </pickup> 95 </PickupSpawner> 96 97 <PickupSpawner position="25,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99"> 98 <pickup> 99 <SpeedPickup template=hugespeedpickup /> 100 </pickup> 101 </PickupSpawner> 102 103 <PickupSpawner position="50,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99"> 104 <pickup> 105 <SpeedPickup template=smalljumppickup /> 106 </pickup> 107 </PickupSpawner> 52 <PickupSpawner pickup=smallspeedpickup position="-25,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" /> 53 <PickupSpawner pickup=mediumspeedpickup position="0,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" /> 54 <PickupSpawner pickup=hugespeedpickup position="25,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" /> 55 <PickupSpawner pickup=smalljumppickup position="50,25,-125" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" /> 108 56 109 57 <!-- Invisible pickups --> 110 58 111 <PickupSpawner position="-25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 112 <pickup> 113 <InvisiblePickup template=smallinvisiblepickup /> 114 </pickup> 115 </PickupSpawner> 116 117 <PickupSpawner position="0,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 118 <pickup> 119 <InvisiblePickup template=mediuminvisiblepickup /> 120 </pickup> 121 </PickupSpawner> 122 123 <PickupSpawner position="25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 124 <pickup> 125 <InvisiblePickup template=hugeinvisiblepickup /> 126 </pickup> 127 </PickupSpawner> 59 <PickupSpawner pickup=smallinvisiblepickup position="-25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 60 <PickupSpawner pickup=mediuminvisiblepickup position="0,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 61 <PickupSpawner pickup=hugeinvisiblepickup position="25,50,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 128 62 129 63 <!-- Meta pickups --> 130 64 131 <PickupSpawner position="-25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 132 <pickup> 133 <MetaPickup metaType="use" /> 134 </pickup> 135 </PickupSpawner> 136 137 <PickupSpawner position="0,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 138 <pickup> 139 <MetaPickup metaType="drop" /> 140 </pickup> 141 </PickupSpawner> 142 143 <PickupSpawner position="25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 144 <pickup> 145 <MetaPickup metaType="destroy" /> 146 </pickup> 147 </PickupSpawner> 148 149 <PickupSpawner position="50,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 150 <pickup> 151 <MetaPickup metaType="destroyCarrier" /> 152 </pickup> 153 </PickupSpawner> 65 <Template name=usemetapickup baseclass=MetaPickup> 66 <MetaPickup representation="use" metaType="use" /> 67 </Template> 68 69 <Template name=dropmetapickup baseclass=MetaPickup> 70 <MetaPickup representation="drop" metaType="drop" /> 71 </Template> 72 73 <Template name=destroymetapickup baseclass=MetaPickup> 74 <MetaPickup metaType="destroy" /> 75 </Template> 76 77 <Template name=destroycarriermetapickup baseclass=MetaPickup> 78 <MetaPickup metaType="destroyCarrier" /> 79 </Template> 80 81 <PickupSpawner pickup=usemetapickup position="-25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 82 <PickupSpawner pickup=dropmetapickup position="0,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 83 <PickupSpawner pickup=destroymetapickup position="25,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 84 <PickupSpawner pickup=destroycarriermetapickup position="50,75,-125" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 154 85 155 86 <!-- Pickup Collection pickups --> 156 87 157 <PickupSpawner position="-50,25,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> 158 <pickup> 159 <PickupCollection template=triplehealthspeedinvisibilitypickup /> 160 </pickup> 161 </PickupSpawner> 88 <PickupSpawner pickup=triplehealthspeedinvisibilitypickup position="-50,25,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 162 89 163 90 <!-- Drone pickup --> 164 91 165 <PickupSpawner position="-50,50,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> 166 <pickup> 167 <DronePickup template=dronepickup /> 168 </pickup> 169 </PickupSpawner> 92 <PickupSpawner pickup=dronepickup position="-50,50,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 93 94 <!-- DamageBoost pickup --> 95 96 <PickupSpawner pickup=smalldamageboostpickup position="-50,75,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 97 <PickupSpawner pickup=mediumdamageboostpickup position="-50,100,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 98 <PickupSpawner pickup=largedamageboostpickup position="-50,125,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 170 99 171 100 <!-- Other pickups --> … … 173 102 <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi --> 174 103 <PickupRepresentation 104 name = "MediumHealth" 175 105 pickupName = "Medium Health Pack" 176 106 pickupDescription = "Once used adds a medium amout of health to the ship." 177 107 spawnerTemplate = "mediumhealthpickupRepresentation" 178 108 inventoryRepresentation = "MediumHealth" 179 > 180 <pickup> 181 <HealthPickup health=500 activationType=immediate healthRate=10 durationType=continuous /> 182 </pickup> 183 </PickupRepresentation> 109 /> 184 110 185 < PickupSpawner position="-50,0,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">186 < pickup>187 <HealthPickup health=500 activationType=immediate healthRate=10 durationType=continuous />188 </pickup>189 < /PickupSpawner>111 <Template name=continuoushealthpickup baseclass=HealthPickup> 112 <HealthPickup representation="MediumHealth" health=500 activationType=immediate healthRate=10 durationType=continuous /> 113 </Template> 114 115 <PickupSpawner pickup=continuoushealthpickup position="-50,0,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 190 116 191 <PickupSpawner position="-25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5"> 192 <pickup> 193 <ShrinkPickup template ="smallshrinkpickup"/> 194 </pickup> 195 </PickupSpawner> 117 <PickupSpawner pickup="smallshrinkpickup" position="-25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 118 <PickupSpawner pickup="mediumshrinkpickup" position="0,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 119 <PickupSpawner pickup="hugeshrinkpickup" position="25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 120 121 <!-- @Objects: 4 boxes (uncontrolled pawns) --> 122 <Pawn team=1 health=30 position="0,100,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 4" > 123 <events> 124 <visibility> 125 <EventListener event="flying4" /> 126 </visibility> 127 </events> 128 <attached> 129 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> 130 </attached> 131 <collisionShapes> 132 <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" /> 133 </collisionShapes> 134 </Pawn> 196 135 197 <PickupSpawner position="0,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5"> 198 <pickup> 199 <ShrinkPickup template ="mediumshrinkpickup"/> 200 </pickup> 201 </PickupSpawner> 136 <Pawn team=1 health=30 position="0,200,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box RVName = "Box 3"> 137 <events> 138 <visibility> 139 <EventListener event="flying4" /> 140 </visibility> 141 </events> 142 <attached> 143 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> 144 </attached> 145 <collisionShapes> 146 <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" /> 147 </collisionShapes> 148 </Pawn> 202 149 203 <PickupSpawner position="25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5"> 204 <pickup> 205 <ShrinkPickup template ="hugeshrinkpickup"/> 206 </pickup> 207 </PickupSpawner> 150 <Pawn health=30 position="0,300,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1 RVName = "Box 2"> 151 <events> 152 <visibility> 153 <EventListener event="flying4" /> 154 </visibility> 155 </events> 156 <attached> 157 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> 158 </attached> 159 <collisionShapes> 160 <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" /> 161 </collisionShapes> 162 </Pawn> 163 164 <Pawn health=30 position="0,400,0" direction="0,-1,0" collisionType=dynamic mass=100000 name=box team=1 RVName = "Box 1"> 165 <events> 166 <visibility> 167 <EventListener event="flying4" /> 168 </visibility> 169 </events> 170 <attached> 171 <Model position="0,0,0" mesh="crate.mesh" scale3D="3,3,3" /> 172 </attached> 173 <collisionShapes> 174 <BoxCollisionShape position="0,0,0" halfExtents="15,15,15" /> 175 </collisionShapes> 176 </Pawn> 208 177 209 178 <!--StaticEntity position="0,-200,0" direction="0,-1,0" collisionType=static mass=500 friction=0.01 > -
code/trunk/data/levels/pirateAttack.oxw
r9016 r9348 39 39 <Scene 40 40 ambientlight = "0.3, 0.3, 0.3" 41 skybox = "Orxonox/sky panoramagen1"41 skybox = "Orxonox/skyBoxBasic" 42 42 > 43 43 -
code/trunk/data/levels/planets.oxw
r9016 r9348 21 21 <Scene 22 22 ambientlight = "0.8, 0.8, 0.8" 23 skybox = "Orxonox/sky panoramagen1"23 skybox = "Orxonox/skyBoxBasic" 24 24 > 25 25 -
code/trunk/data/levels/pong.oxw
r9016 r9348 57 57 <?lua include("includes/notifications.oxi") ?> 58 58 59 <WorldAmbientSound source="Ganymede.ogg" playOnLoad=true looping=true /> 60 59 <WorldAmbientSound source="Ganymede.ogg" looping="true" playOnLoad="true"/> 61 60 <PongBot /> 62 61 63 62 <Scene 64 63 ambientlight = "0.5, 0.5, 0.5" 65 skybox = "Orxonox/sky panoramagen1"64 skybox = "Orxonox/skyBoxBasic" 66 65 > 67 66 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> … … 92 91 <ParticleSpawner name=scoreeffect_left position="-120,0,-45" source="Orxonox/sparks2" lifetime=0.1 autostart=0 /> 93 92 94 <WorldSound name="scoreSound" position="0,0,0" source="sounds/pong_score.wav" > 93 <!-- TODO: Create a Pong Score Sound and include it here. 94 This WorldSound works, but doesn't make sense, since it is played together with ambient/moodDependedDirectory/Ganymede.ogg --> 95 <!--WorldSound name="scoreSound" position="0,0,0" source="ambient/default/Earth.ogg" > 95 96 <events> 96 97 <play> … … 98 99 </play> 99 100 </events> 100 </WorldSound >101 </WorldSound--> 101 102 102 103 <?lua -
code/trunk/data/levels/portals.oxw
r9016 r9348 23 23 <Scene 24 24 ambientlight = "0.5, 0.5, 0.5" 25 skybox = "Orxonox/sky panoramagen1"25 skybox = "Orxonox/skyBoxBasic" 26 26 > 27 27 … … 29 29 <PortalEndPoint> 30 30 <attached> 31 < Billboard material="Portals/Default"/>31 <Model mesh="Spacegate.mesh" yaw="90"/> 32 32 </attached> 33 33 </PortalEndPoint> … … 39 39 <PortalLink fromID="2" toID="1" /> 40 40 41 <!--PickupSpawner position="-200,0,0" triggerDistance="10" respawnTime="10" maxSpawnedItems="10"> 42 <pickup> 43 <DronePickup template=dronepickup /> 44 </pickup> 45 </PickupSpawner--> 41 <!--PickupSpawner pickup=dronepickup position="-200,0,0" triggerDistance="10" respawnTime="10" maxSpawnedItems="10" /--> 46 42 47 43 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/presentation09.oxw
r9016 r9348 22 22 <Scene 23 23 ambientlight = "0.5, 0.5, 0.5" 24 skybox = "Orxonox/sky panoramagen1"24 skybox = "Orxonox/skyBoxBasic" 25 25 > 26 26 -
code/trunk/data/levels/presentation09b.oxw
r9016 r9348 26 26 <Scene 27 27 ambientlight = "0.5, 0.5, 0.5" 28 skybox = "Orxonox/sky panoramagen2"28 skybox = "Orxonox/skyBoxSomeNebula" 29 29 > 30 30 … … 94 94 </SpaceShip> 95 95 96 <PickupSpawner position="-3800, 2500, 1500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5"> 97 <pickup> 98 <SpeedPickup template=smalljumppickup /> 99 </pickup> 100 </PickupSpawner> 96 <PickupSpawner pickup=smalljumppickup position="-3800, 2500, 1500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 101 97 102 98 <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi --> 103 99 <PickupRepresentation 100 name = "MediumHealth" 104 101 pickupName = "Medium Health Pack" 105 102 pickupDescription = "Once used adds a medium amout of health to the ship." 106 103 spawnerTemplate = "mediumhealthpickupRepresentation" 107 104 inventoryRepresentation = "MediumHealth" 108 > 109 <pickup> 110 <HealthPickup health=100 activationType="onUse" durationType="once" /> 111 </pickup> 112 </PickupRepresentation> 113 114 <PickupSpawner position="-4150,2750,1550" respawnTime="60" triggerDistance="20" maxSpawnedItems="5"> 115 <pickup> 116 <HealthPickup health=100 activationType=onUse durationType=once /> 117 </pickup> 118 </PickupSpawner> 119 120 <PickupSpawner position="2300, 4300, 2400" respawnTime="5" triggerDistance="20"> 121 <pickup> 122 <HealthPickup template=mediumhealthpickup /> 123 </pickup> 124 </PickupSpawner> 105 /> 106 107 <Template name=onusehealthpickup baseclass=HealthPickup> 108 <HealthPickup representation="MediumHealth" health=100 activationType=onUse durationType=once /> 109 </Template> 110 111 <PickupSpawner pickup=onusehealthpickup position="-4150,2750,1550" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 112 113 <PickupSpawner pickup=mediumhealthpickup position="2300, 4300, 2400" respawnTime="5" triggerDistance="20" /> 125 114 126 115 <Billboard position="-2500, 2400, 1500" material="Examples/Flare" /> -
code/trunk/data/levels/presentationDM.oxw
r9016 r9348 24 24 <Scene 25 25 ambientlight = "0.5, 0.5, 0.5" 26 skybox = "Orxonox/sky panoramagen1"26 skybox = "Orxonox/skyBoxBasic" 27 27 > 28 28 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/presentationFS10.oxw
r9016 r9348 102 102 <?lua end ?> 103 103 104 <PickupSpawner position="500,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 105 <pickup> 106 <DronePickup template=dronepickup /> 107 </pickup> 108 </PickupSpawner> 104 <PickupSpawner pickup=dronepickup position="500,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 109 105 110 106 <!-- Shield pickups --> 111 107 112 <PickupSpawner position="-25,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 113 <pickup> 114 <ShieldPickup template=hugeshieldpickup /> 115 </pickup> 116 </PickupSpawner> 108 <PickupSpawner pickup=hugeshieldpickup position="-25,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 117 109 118 110 <!-- Health pickups --> 119 111 120 <PickupSpawner position="0,-75,-500" triggerDistance="10" respawnTime="30" maxSpawnedItems="10"> 121 <pickup> 122 <HealthPickup template=hugehealthpickup /> 123 </pickup> 124 </PickupSpawner> 112 <PickupSpawner pickup=hugehealthpickup position="0,-75,-500" triggerDistance="10" respawnTime="30" maxSpawnedItems="10" /> 125 113 126 114 <!-- Speed pickups --> 127 115 128 <PickupSpawner position="25,-50,-500" triggerDistance="10" respawnTime="10" maxSpawnedItems="99"> 129 <pickup> 130 <SpeedPickup template=hugespeedpickup /> 131 </pickup> 132 </PickupSpawner> 133 134 <PickupSpawner position="50,-50,-500" triggerDistance="10" respawnTime="10" maxSpawnedItems="99"> 135 <pickup> 136 <SpeedPickup template=smalljumppickup /> 137 </pickup> 138 </PickupSpawner> 116 <PickupSpawner pickup=hugespeedpickup position="25,-50,-500" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" /> 117 <PickupSpawner pickup=smalljumppickup position="50,-50,-500" triggerDistance="10" respawnTime="10" maxSpawnedItems="99" /> 139 118 140 119 <!-- Invisible pickups --> 141 120 142 <PickupSpawner position="0,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10"> 143 <pickup> 144 <InvisiblePickup template=hugeinvisiblepickup /> 145 </pickup> 146 </PickupSpawner> 121 <PickupSpawner pickup=hugeinvisiblepickup position="0,-50,-500" triggerDistance="10" respawnTime="5" maxSpawnedItems="10" /> 147 122 148 123 <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi --> 149 124 <PickupRepresentation 125 name = "MediumHealth" 150 126 pickupName = "Medium Health Pack" 151 127 pickupDescription = "Once used adds a medium amout of health to the ship." 152 128 spawnerTemplate = "mediumhealthpickupRepresentation" 153 129 inventoryRepresentation = "MediumHealth" 154 > 155 <pickup> 156 <HealthPickup health=50 activationType="onUse" durationType="once" /> 157 </pickup> 158 </PickupRepresentation> 130 /> 159 131 160 < PickupSpawner position="25,-75,-500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">161 < pickup>162 <HealthPickup health=50 activationType=onUse durationType=once />163 </pickup> 164 < /PickupSpawner>132 <Template name=onusehealthpickup baseclass=HealthPickup> 133 <HealthPickup representation="MediumHealth" health=50 activationType=onUse durationType=once /> 134 </Template> 135 136 <PickupSpawner pickup=onusehealthpickup position="25,-75,-500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 165 137 166 138 </Scene> -
code/trunk/data/levels/presentationFS102.oxw
r9016 r9348 23 23 <Scene 24 24 ambientlight = "0.1, 0.1, 0.1" 25 skybox = "Orxonox/sky panoramagen1"25 skybox = "Orxonox/skyBoxBasic" 26 26 gravity = "0,-1000,0" 27 27 negativeWorldRange = "-100000, -100000, -100000" -
code/trunk/data/levels/presentationFS10Ed.oxw
r9016 r9348 23 23 <Scene 24 24 ambientlight = "0.1, 0.1, 0.1" 25 skybox = "Orxonox/sky panoramagen1"25 skybox = "Orxonox/skyBoxBasic" 26 26 gravity = "0,-1000,0" 27 27 negativeWorldRange = "-100000, -100000, -100000" … … 39 39 </collisionShapes> 40 40 </Pawn> 41 41 42 42 <Pawn health=100 position="0,-35,0" direction="0,-1,0" collisionType=dynamic mass=100000> 43 43 <attached> … … 48 48 </collisionShapes> 49 49 </Pawn> 50 50 51 51 <StaticEntity position="0,-50,0" direction="0,-1,0" collisionType=static mass=100000 > 52 52 <attached> … … 66 66 </collisionShapes> 67 67 </StaticEntity> 68 68 69 69 <StaticEntity position="600,-20,0" direction="0,-1,0" collisionType=static mass=100000 > 70 70 <attached> … … 84 84 </collisionShapes> 85 85 </StaticEntity> 86 86 87 87 <StaticEntity position="600,40,250" direction="0,-1,0" collisionType=static mass=100000 > 88 88 <attached> … … 93 93 </collisionShapes> 94 94 </StaticEntity> 95 96 95 96 97 97 <StaticEntity position="6000,0,10250" direction="0,0,0" collisionType=static mass=100000 > 98 98 <attached> … … 103 103 </collisionShapes> 104 104 </StaticEntity> 105 105 106 106 <Pawn health=100 position="530,70,1450" direction="-1,0,0" collisionType=dynamic mass=1 > 107 107 <attached> … … 112 112 </collisionShapes> 113 113 </Pawn> 114 114 115 115 <Pawn health=100 position="670,70,1450" direction="-1,0,0" collisionType=dynamic mass=1 > 116 116 <attached> … … 121 121 </collisionShapes> 122 122 </Pawn> 123 123 124 124 <Pawn health=100 position="600,70,1500" direction="0,0,-1" collisionType=dynamic mass=1 > 125 125 <attached> … … 130 130 </collisionShapes> 131 131 </Pawn> 132 132 133 133 <Pawn health=100 position="600,150,1450" direction="0,-1,0" collisionType=dynamic mass=1 > 134 134 <attached> … … 139 139 </collisionShapes> 140 140 </Pawn> 141 141 142 142 <Pawn health=100 position="600,35,1450" direction="0,-1,0" collisionType=dynamic mass=1 > 143 143 <attached> … … 148 148 </collisionShapes> 149 149 </Pawn> 150 150 151 151 152 152 <SpawnPoint position="0,300,0" direction="0, 0, 0" lookat="0,0,100000000" spawnclass=FpsPlayer pawndesign=fps /> … … 163 163 <attached> 164 164 <Model position="0,0,0" scale3D="<?lua print(j*100) ?>,<?lua print(g*100) ?>,<?lua print(h*100) ?>" mesh="cube<?lua 165 166 167 168 165 if math.mod(i,4)==0 then print('_green') end 166 if math.mod(i,4)==1 then print('_red') end 167 if math.mod(i,4)==2 then print('_orange') end 168 ?>.mesh" /> <!--if it's 3, cube.mesh is taken -> yellow --> 169 169 </attached> 170 170 <collisionShapes> -
code/trunk/data/levels/presentationFS11.oxw
r9016 r9348 422 422 </SimpleNotification> 423 423 424 <PickupSpawner position="-72487,420,-63" respawnTime="10" triggerDistance="20" maxSpawnedItems="5" active="false"> 425 <pickup> 426 <ShrinkPickup template ="smallshrinkpickup"/> 427 </pickup> 424 <PickupSpawner pickup="smallshrinkpickup" position="-72487,420,-63" respawnTime="10" triggerDistance="20" maxSpawnedItems="5" active="false"> 428 425 <events> 429 426 <activity> -
code/trunk/data/levels/presentationHS09.oxw
r9016 r9348 27 27 <Scene 28 28 ambientlight = "0.6, 0.4, 0.4" 29 skybox = "Orxonox/sky panoramagen2"29 skybox = "Orxonox/skyBoxSomeNebula" 30 30 > 31 31 … … 97 97 <Billboard material="Test/Fog" position="-3800, 2500, 1500" alpha="0.1" color="1, 1, 1, 0.1" scale="0.5" /> 98 98 99 <PickupSpawner position="-3800, 2500, 1500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5"> 100 <pickup> 101 <SpeedPickup template=smalljumppickup /> 102 </pickup> 103 </PickupSpawner> 99 <PickupSpawner pickup=smalljumppickup position="-3800, 2500, 1500" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 104 100 105 101 <!-- PickupRepresentation for the pickup below, since it is not a standard pickup provided by pickups.oxi --> 106 102 <PickupRepresentation 103 name = "MediumHealth" 107 104 pickupName = "Medium Health Pack" 108 105 pickupDescription = "Once used adds a medium amout of health to the ship." 109 106 spawnerTemplate = "mediumhealthpickupRepresentation" 110 107 inventoryRepresentation = "MediumHealth" 111 > 112 <pickup> 113 <HealthPickup health=100 activationType="onUse" durationType="once" /> 114 </pickup> 115 </PickupRepresentation> 116 117 <PickupSpawner position="-4150,2750,1550" respawnTime="60" triggerDistance="20" maxSpawnedItems="5"> 118 <pickup> 119 <HealthPickup health=100 activationType=onUse durationType=once /> 120 </pickup> 121 </PickupSpawner> 122 123 <PickupSpawner position="2300, 4300, 2400" respawnTime="5" triggerDistance="20"> 124 <pickup> 125 <HealthPickup template=mediumhealthpickup /> 126 </pickup> 127 </PickupSpawner> 108 /> 109 110 <Template name=onusehealthpickup baseclass=HealthPickup> 111 <HealthPickup representation="MediumHealth" health=100 activationType=onUse durationType=once /> 112 </Template> 113 114 <PickupSpawner pickup=onusehealthpickup position="-4150,2750,1550" respawnTime="60" triggerDistance="20" maxSpawnedItems="5" /> 115 116 <PickupSpawner pickup=mediumhealthpickup position="2300, 4300, 2400" respawnTime="5" triggerDistance="20" /> 128 117 129 118 <Billboard position="-2500, 2400, 1500" material="Examples/Flare" /> -
code/trunk/data/levels/presentationHS11.oxw
- Property svn:eol-style set to native
r9016 r9348 1 <!-- --> 2 3 1 4 <LevelInfo 2 5 name = "Presentation HS 2011" 3 description = " Oxonox Proudly Presents New Features From HS 2011"6 description = "New Features: Asteroid field/belt generator; Formationflight; HUD (Enemyhealthbar, displaying Names)" 4 7 tags = "presentation" 5 8 /> … … 79 82 </events> 80 83 </SimpleNotification> 84 85 81 86 82 87 … … 131 136 <?lua end ?> 132 137 133 134 135 136 137 138 <!-- @Triggers: "hintX" <-> delayed LetsGo --> 139 <EventTrigger name="hint1" activations="1" stayactive="true" delay=4.2> 140 <events> 141 <trigger> 142 <EventListener event="LetsGo" /> 143 </trigger> 144 </events> 145 </EventTrigger> 146 <EventTrigger name="hint2" activations="1" stayactive="true" delay=8.4> 147 <events> 148 <trigger> 149 <EventListener event="LetsGo" /> 150 </trigger> 151 </events> 152 </EventTrigger> 153 <EventTrigger name="hint3" activations="1" stayactive="true" delay=12.6> 154 <events> 155 <trigger> 156 <EventListener event="LetsGo" /> 157 </trigger> 158 </events> 159 </EventTrigger> 160 <EventTrigger name="hint4" activations="1" stayactive="true" delay=16.8> 161 <events> 162 <trigger> 163 <EventListener event="LetsGo" /> 164 </trigger> 165 </events> 166 </EventTrigger> 167 <EventTrigger name="hint5" activations="1" stayactive="true" delay=21> 168 <events> 169 <trigger> 170 <EventListener event="LetsGo" /> 171 </trigger> 172 </events> 173 </EventTrigger> 174 <EventTrigger name="hint6" activations="1" stayactive="true" delay=25.2> 175 <events> 176 <trigger> 177 <EventListener event="LetsGo" /> 178 </trigger> 179 </events> 180 </EventTrigger> 181 182 183 184 <SimpleNotification message="Make bots follow you: Press (1)" broadcast="true"> 185 <events> 186 <trigger> 187 <EventListener event=hint1 /> 188 </trigger> 189 </events> 190 </SimpleNotification> 191 192 <SimpleNotification message="Toggle group behaviour: Press (1)" broadcast="true"> 193 <events> 194 <trigger> 195 <EventListener event=hint2 /> 196 </trigger> 197 </events> 198 </SimpleNotification> 199 200 <SimpleNotification message="Tell the bots to defend you: Press (2)" broadcast="true"> 201 <events> 202 <trigger> 203 <EventListener event=hint3 /> 204 </trigger> 205 </events> 206 </SimpleNotification> 207 208 <SimpleNotification message="Make them attack opponents: Press (2) again" broadcast="true"> 209 <events> 210 <trigger> 211 <EventListener event=hint4 /> 212 </trigger> 213 </events> 214 </SimpleNotification> 215 216 <SimpleNotification message="Let the bots behave 'normal': Press (2) again" broadcast="true"> 217 <events> 218 <trigger> 219 <EventListener event=hint5 /> 220 </trigger> 221 </events> 222 </SimpleNotification> 223 224 <SimpleNotification message="Have a look at the console to verify this." broadcast="true"> 225 <events> 226 <trigger> 227 <EventListener event=hint6 /> 228 </trigger> 229 </events> 230 </SimpleNotification> 138 231 139 232 <!-- Generate asteroid field and asteroid belt --> 140 <!-- asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog) --> 233 <!-- asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog) --> 141 234 <?lua 142 143 235 dofile("includes/asteroidField.lua") 236 asteroidBelt(20000, 0, 13000, -48, -34, 70, 100, 200, 22000, 20000, 500, 1) 144 237 145 238 ?> -
code/trunk/data/levels/princessAeryn.oxw
r9016 r9348 26 26 <Scene 27 27 ambientlight = "0.3, 0.3, 0.3" 28 skybox = "Orxonox/sky panoramagen1"28 skybox = "Orxonox/skyBoxBasic" 29 29 > 30 30 -
code/trunk/data/levels/screenshot.oxw
r9016 r9348 25 25 <Scene 26 26 ambientlight = "0.7, 0.6, 0.6" 27 skybox = "Orxonox/sky panoramagen1"27 skybox = "Orxonox/skyBoxBasic" 28 28 > 29 29 <!--Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /--> -
code/trunk/data/levels/teamBaseMatch.oxw
r9016 r9348 26 26 <Scene 27 27 ambientlight = "0.5, 0.5, 0.5" 28 skybox = "Orxonox/sky panoramagen1"28 skybox = "Orxonox/skyBoxBasic" 29 29 > 30 30 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/teamDeathMatch.oxw
r9016 r9348 25 25 <Scene 26 26 ambientlight = "0.7, 0.6, 0.6" 27 skybox = "Orxonox/sky panoramagen1"27 skybox = "Orxonox/skyBoxBasic" 28 28 > 29 29 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/templates/FPS.oxt
r8858 r9348 17 17 linearDamping = 0.7 18 18 angularDamping = 0.9999999 19 friction 20 19 friction = 0.01 20 21 21 weapon = "hs-w01.mesh" 22 22 > … … 24 24 <BoxCollisionShape position="0,-20,0" halfExtents="15,25,15" /> 25 25 </collisionShapes> 26 26 27 27 <camerapositions> 28 28 <CameraPosition position="-1,1,2.2" drag=false mouselook=true /> 29 29 </camerapositions> 30 30 31 31 <?lua 32 32 include("../includes/weaponSettingsFPS.oxi") 33 33 ?> 34 34 … … 40 40 <camerapositions> 41 41 <CameraPosition position="0,0,20" drag=false mouselook=true /> 42 42 43 43 <!-- 44 44 CameraPosition position="0,150,-25" pitch=-90 drag=true /> … … 47 47 <CameraPosition position="-50,5,-8" yaw=-90 drag=true /> 48 48 <CameraPosition position="50,5,-8" yaw=90 drag=true / 49 49 50 50 </camerapositions> 51 51 </FpsPlayer> -
code/trunk/data/levels/templates/pickupRepresentationTemplates.oxt
r8706 r9348 17 17 </Template> 18 18 19 <Template name=smallshieldpickup >19 <Template name=smallshieldpickup baseclass=ShieldPickup> 20 20 <ShieldPickup 21 representation = "smallshieldpickup" 21 22 duration = 10 22 23 shieldabsorption = 0.7 … … 43 44 </Template> 44 45 45 <Template name=mediumshieldpickup >46 <Template name=mediumshieldpickup baseclass=ShieldPickup> 46 47 <ShieldPickup 48 representation = "mediumshieldpickup" 47 49 duration = 30 48 50 shieldabsorption = 0.8 … … 70 72 </Template> 71 73 72 <Template name=hugeshieldpickup >74 <Template name=hugeshieldpickup baseclass=ShieldPickup> 73 75 <ShieldPickup 76 representation = "hugeshieldpickup" 74 77 duration = 60 75 78 shieldabsorption = 0.95 … … 98 101 </Template> 99 102 100 <Template name=smallhealthpickup >103 <Template name=smallhealthpickup baseclass=HealthPickup> 101 104 <HealthPickup 105 representation = "smallhealthpickup" 102 106 health = 10 103 107 healthType = "limited" … … 123 127 </Template> 124 128 125 <Template name=mediumhealthpickup >129 <Template name=mediumhealthpickup baseclass=HealthPickup> 126 130 <HealthPickup 131 representation = "mediumhealthpickup" 127 132 health = 50 128 133 healthType = "limited" … … 148 153 </Template> 149 154 150 <Template name=hugehealthpickup >155 <Template name=hugehealthpickup baseclass=HealthPickup> 151 156 <HealthPickup 157 representation = "hugehealthpickup" 152 158 health = 100 153 159 healthType = "limited" … … 173 179 </Template> 174 180 175 <Template name=crazyhealthpickup >181 <Template name=crazyhealthpickup baseclass=HealthPickup> 176 182 <HealthPickup 183 representation = "crazyhealthpickup" 177 184 health = 1000 178 185 healthType = "permanent" … … 216 223 </Template> 217 224 225 <!-- DamageBoost pickups --> 226 227 <Template name=smalldamageboostpickupRepresentation> 228 <PickupRepresentation> 229 <spawner-representation> 230 <StaticEntity> 231 <attached> 232 <Billboard position="0,0,0" colour="0.95,0.10,0.05" material="Sphere2" scale=0.1 > 233 <attached> 234 <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageSmall" scale=0.7 /> 235 </attached> 236 </Billboard> 237 </attached> 238 </StaticEntity> 239 </spawner-representation> 240 </PickupRepresentation> 241 </Template> 242 243 <Template name=smalldamageboostpickup baseclass=DamageBoostPickup> 244 <DamageBoostPickup 245 representation = "smalldamageboostpickup" 246 duration = 10.0 247 damageMultiplier = 2.0 248 activationType = "immediate" 249 durationType = "continuous" 250 /> 251 </Template> 252 253 <Template name=mediumdamageboostpickupRepresentation> 254 <PickupRepresentation> 255 <spawner-representation> 256 <StaticEntity> 257 <attached> 258 <Billboard position="0,0,0" colour="0.95,0.10,0.05" material="Sphere2" scale=0.1 > 259 <attached> 260 <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageMedium" scale=0.7 /> 261 </attached> 262 </Billboard> 263 </attached> 264 </StaticEntity> 265 </spawner-representation> 266 </PickupRepresentation> 267 </Template> 268 269 <Template name=mediumdamageboostpickup baseclass=DamageBoostPickup> 270 <DamageBoostPickup 271 representation = "mediumdamageboostpickup" 272 duration = 10.0 273 damageMultiplier = 5.0 274 activationType = "immediate" 275 durationType = "continuous" 276 /> 277 </Template> 278 279 <Template name=largedamageboostpickupRepresentation> 280 <PickupRepresentation> 281 <spawner-representation> 282 <StaticEntity> 283 <attached> 284 <Billboard position="0,0,0" colour="0.95,0.10,0.05" material="Sphere2" scale=0.1 > 285 <attached> 286 <Billboard position="0,0,0" colour="0.30,0.30,0.30" material="damageLarge" scale=0.7 /> 287 </attached> 288 </Billboard> 289 </attached> 290 </StaticEntity> 291 </spawner-representation> 292 </PickupRepresentation> 293 </Template> 294 295 <Template name=largedamageboostpickup baseclass=DamageBoostPickup> 296 <DamageBoostPickup 297 representation = "largedamageboostpickup" 298 duration = 10.0 299 damageMultiplier = 7.0 300 activationType = "immediate" 301 durationType = "continuous" 302 /> 303 </Template> 304 305 218 306 <!-- Speed pickups --> 219 307 … … 234 322 </Template> 235 323 236 <Template name=smallspeedpickup >324 <Template name=smallspeedpickup baseclass=SpeedPickup> 237 325 <SpeedPickup 326 representation = "smallspeedpickup" 238 327 duration = 10.0 239 328 speedAdd = 0.0 … … 260 349 </Template> 261 350 262 <Template name=mediumspeedpickup >351 <Template name=mediumspeedpickup baseclass=SpeedPickup> 263 352 <SpeedPickup 353 representation = "mediumspeedpickup" 264 354 duration = 10.0 265 355 speedAdd = 0.0 … … 286 376 </Template> 287 377 288 <Template name=hugespeedpickup >378 <Template name=hugespeedpickup baseclass=SpeedPickup> 289 379 <SpeedPickup 380 representation = "hugespeedpickup" 290 381 duration = 10.0 291 382 speedAdd = 0.0 … … 312 403 </Template> 313 404 314 <Template name=smalljumppickup >405 <Template name=smalljumppickup baseclass=SpeedPickup> 315 406 <SpeedPickup 407 representation = "smalljumppickup" 316 408 duration = 0.7 317 409 speedAdd = 5000.0 … … 340 432 </Template> 341 433 342 <Template name=smallinvisiblepickup >434 <Template name=smallinvisiblepickup baseclass=InvisiblePickup> 343 435 <InvisiblePickup 436 representation = "smallinvisiblepickup" 344 437 duration = 5.0 345 438 activaionType = "immediate" … … 364 457 </Template> 365 458 366 <Template name=mediuminvisiblepickup >459 <Template name=mediuminvisiblepickup baseclass=InvisiblePickup> 367 460 <InvisiblePickup 461 representation = "mediuminvisiblepickup" 368 462 duration = 10.0 369 463 activaionType = "immediate" … … 388 482 </Template> 389 483 390 <Template name=hugeinvisiblepickup >484 <Template name=hugeinvisiblepickup baseclass=InvisiblePickup> 391 485 <InvisiblePickup 486 representation = "hugeinvisiblepickup" 392 487 duration = 20.0 393 488 activaionType = "immediate" … … 412 507 </Template> 413 508 414 <Template name=smallshrinkpickup> 415 <InvisiblePickup 509 <Template name=smallshrinkpickup baseclass=ShrinkPickup> 510 <ShrinkPickup 511 representation = "smallshrinkpickup" 416 512 duration = 10.0 417 513 shrinkFactor = 2.5 … … 437 533 </Template> 438 534 439 <Template name=mediumshrinkpickup> 440 <InvisiblePickup 535 <Template name=mediumshrinkpickup baseclass=ShrinkPickup> 536 <ShrinkPickup 537 representation = "mediumshrinkpickup" 441 538 duration = 30.0 442 539 shrinkFactor = 5.0 … … 462 559 </Template> 463 560 464 <Template name=hugeshrinkpickup> 465 <InvisiblePickup 561 <Template name=hugeshrinkpickup baseclass=ShrinkPickup> 562 <ShrinkPickup 563 representation = "hugeshrinkpickup" 466 564 duration = 60.0 467 565 shrinkFactor = 10.0 … … 491 589 </Template> 492 590 493 <Template name=triplehealthspeedinvisibilitypickup> 494 <PickupCollection> 591 <Template name=triplehealthspeedinvisibilitypickup baseclass=PickupCollection> 592 <PickupCollection 593 representation = "triplehealthspeedinvisibilitypickup" 594 > 495 595 <pickupables> 496 596 <HealthPickup template=mediumhealthpickup /> … … 551 651 </Template> 552 652 553 <Template name=dronepickup >554 <DronePickup droneTemplate=droneTemplate />555 </Template> 556 653 <Template name=dronepickup baseclass=DronePickup> 654 <DronePickup representation=dronepickup droneTemplate=droneTemplate /> 655 </Template> 656 -
code/trunk/data/levels/templates/spaceshipSpacecruiser.oxt
- Property svn:eol-style set to native
-
code/trunk/data/levels/testStars.oxw
r9016 r9348 30 30 <attached> 31 31 <Model pitch=180 position="0,0,0" scale=1.5 mesh="rocket_test.mesh" > 32 33 <ParticleEmitter pitch=0 roll=0 position="0,5,0" source="Orxonox/laser" lifetime=2.0 loop=1 startdelay=3.0/>34 <ParticleEmitter pitch=-90 roll=0 position="0,-5,0" source="Orxonox/particlecanon" lifetime=2.0 loop=1 startdelay=3.0/>35 <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/rocketfire" lifetime=2.0 loop=1 startdelay=3.0 />36 32 <attached> 33 <ParticleEmitter pitch=0 roll=0 position="0,5,0" source="Orxonox/laser" lifetime=2.0 loop=1 startdelay=3.0/> 34 <ParticleEmitter pitch=-90 roll=0 position="0,-5,0" source="Orxonox/particlecanon" lifetime=2.0 loop=1 startdelay=3.0/> 35 <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/rocketfire" lifetime=2.0 loop=1 startdelay=3.0 /> 36 <ParticleEmitter pitch=-90 roll=0 position="0,0,-2" source="Orxonox/smoke" lifetime=2.0 loop=1 startdelay=3.0 /> 37 37 </attached> 38 39 38 </Model> 39 </attached> 40 40 </Rocket--> 41 41 42 42 <CreateStars numStars="6000" material="Examples/Flare" colour="1,1,1" radius=10000 colourDiff=0.1/> 43 43 -
code/trunk/data/levels/testSwallow.oxw
r9016 r9348 23 23 <Scene 24 24 ambientlight = "0.5, 0.5, 0.5" 25 skybox = "Orxonox/sky panoramagen1"25 skybox = "Orxonox/skyBoxBasic" 26 26 > 27 27 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/tetris.oxw
r9016 r9348 9 9 include("HUDTemplates3.oxo") 10 10 include("stats.oxo") 11 include("tetrisHUD.oxo") 11 12 include("templates/lodInformation.oxt") 13 include("templates/spaceshipAssff.oxt") 14 include("templates/spaceshipGhost.oxt") 15 include("templates/spaceshipPirate.oxt") 16 include("templates/spaceshipSwallow.oxt") 17 include("templates/spaceshipTransporter.oxt") 18 include("templates/spaceshipH2.oxt") 12 19 ?> 13 20 … … 16 23 <camerapositions> 17 24 <CameraPosition position="55,75,200" absolute=true /> 18 <CameraPosition position="0,50,160" drag=true mouselook=true />19 <CameraPosition position="0,50,0" pitch=-90 drag=true mouselook=true />20 25 </camerapositions> 21 26 </TetrisStone> … … 25 30 <TetrisStone camerapositiontemplate=tetrisstonecameras> 26 31 <attached> 27 <Model position="0,0,0" mesh="crate.mesh" scale= 1/>32 <Model position="0,0,0" mesh="crate.mesh" scale=0.9 /> 28 33 </attached> 29 34 </TetrisStone> 30 35 </Template> 36 37 38 39 <Template name=tetrisbrickcameras defaults=0> 40 <TetrisBrick> 41 <camerapositions> 42 <CameraPosition position="55,75,200" absolute=true /> 43 <!--CameraPosition position="0,50,160" drag=true mouselook=true /> 44 <CameraPosition position="0,50,0" pitch=-90 drag=true mouselook=true /--> 45 </camerapositions> 46 </TetrisBrick> 47 </Template> 48 49 <Template name=tetrisbrick> 50 <TetrisBrick camerapositiontemplate=tetrisbrickcameras> 51 </TetrisBrick> 52 </Template> 53 31 54 32 55 <Level … … 40 63 <Scene 41 64 ambientlight = "0.5, 0.5, 0.5" 42 skybox = "Orxonox/sky panoramagen1"65 skybox = "Orxonox/skyBoxBasic" 43 66 > 67 <!--luke_grey_-_hypermode.ogg allgorythm-lift_up.ogg Fight1.ogg --> 68 <WorldAmbientSound 69 source="Ganymede.ogg" 70 looping="true" 71 playOnLoad="true" 72 /> 73 44 74 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> 75 45 76 46 77 <?lua … … 50 81 <?lua end ?> 51 82 52 <TetrisCenterpoint name=tetriscenter width=11 height=15 stoneSize=10 stoneTemplate=tetrisstone stoneSpeed=10 position="-55,-75,0">83 <TetrisCenterpoint name=tetriscenter width=11 height=15 stoneSize=10 stoneTemplate=tetrisstone brickTemplate=tetrisbrick stoneSpeed=10 position="-55,-75,0"> 53 84 <attached> 54 85 <Model position="55,-1,0" mesh="cube.mesh" scale3D="57,1,11" /> … … 56 87 <Model position="111,76,0" mesh="cube.mesh" scale3D="1,76,1" /> 57 88 </attached> 89 <!--collisionShapes> 90 <BoxCollisionShape position="55,-1,0" halfExtents="57,1,11" /> 91 <BoxCollisionShape position="-1,76,0" halfExtents="1,76,1" /> 92 <BoxCollisionShape position="111,76,0" halfExtents="1,76,1" /> 93 </collisionShapes--> 58 94 </TetrisCenterpoint> 59 95 96 <!-- ------------ insert eye candy here ---------------- --> 97 98 <!-- asteroidBelt(centerX, centerY, centerZ, yaw, pitch, segments, minSize, maxSize, radius0, radius1, count, fog) --> 99 <!-- DONT DARE TO TURN THE FOG ON, whithout finding a better belt position --> 100 <?lua 101 dofile("includes/asteroidField.lua") 102 asteroidBelt(10000, 0, 0, -40, -90, 70, 100, 200, 24000, 20000, 500, 0) 103 104 ?> 105 <!-- -------- 4 spaceships rotating around the tetris field --------- --> 106 <SpaceShip position="1000,-75,1" lookat="0,0,0"> 107 <templates> 108 <Template link=spaceshipswallow /> 109 </templates> 110 <controller> 111 <WaypointController team=10 accuracy=200> 112 <waypoints> 113 <Model mesh="cube.mesh" scale=0 position="1000,-75,0" /> 114 <Model mesh="cube.mesh" scale=0 position="650,-75,650" /> 115 <Model mesh="cube.mesh" scale=0 position="-55,-75,1000" /> 116 <Model mesh="cube.mesh" scale=0 position="-700,-75,650" /> 117 <Model mesh="cube.mesh" scale=0 position="-1000,-75,0" /> 118 <Model mesh="cube.mesh" scale=0 position="-700,-75,-650" /> 119 <Model mesh="cube.mesh" scale=0 position="-55,-75,-1000" /> 120 <Model mesh="cube.mesh" scale=0 position="650,-75,-650" /> 121 </waypoints> 122 </WaypointController> 123 </controller> 124 </SpaceShip> 125 126 <SpaceShip position="-500,-500,-400" lookat="0,0,0"> 127 <templates> 128 <Template link=spaceshippirate /> 129 </templates> 130 <controller> 131 <WaypointController team=10> 132 <waypoints> 133 <Model mesh="cube.mesh" scale=0 position="-1000,-200,0" /> 134 <Model mesh="cube.mesh" scale=0 position="-700,-150,650" /> 135 <Model mesh="cube.mesh" scale=0 position="-55,-75,1000" /> 136 <Model mesh="cube.mesh" scale=0 position="650,100,650" /> 137 <Model mesh="cube.mesh" scale=0 position="1000,150,0" /> 138 <Model mesh="cube.mesh" scale=0 position="650,100,-650" /> 139 <Model mesh="cube.mesh" scale=0 position="-55,0,-1000" /> 140 <Model mesh="cube.mesh" scale=0 position="-700,-100,-650" /> 141 </waypoints> 142 </WaypointController> 143 </controller> 144 </SpaceShip> 145 146 <SpaceShip position="-700,200,651" lookat="1,0,0"> 147 <templates> 148 <Template link=spaceshipghost /> 149 </templates> 150 <controller> 151 <WaypointController team=10 accuracy=300> 152 <waypoints> 153 <Model mesh="cube.mesh" scale=0 position="-700,200,650" /> 154 <Model mesh="cube.mesh" scale=0 position="-55,100,1000" /> 155 <Model mesh="cube.mesh" scale=0 position="650,0,650" /> 156 <Model mesh="cube.mesh" scale=0 position="1000,-100,0" /> 157 <Model mesh="cube.mesh" scale=0 position="650,0,-650" /> 158 <Model mesh="cube.mesh" scale=0 position="-55,100,-1000" /> 159 <Model mesh="cube.mesh" scale=0 position="-700,200,-650" /> 160 <Model mesh="cube.mesh" scale=0 position="-1000,300,0" /> 161 </waypoints> 162 </WaypointController> 163 </controller> 164 </SpaceShip> 165 166 <SpaceShip position="1000,-75,0" lookat="0,0,0"> 167 <templates> 168 <Template link=spaceshipHtwo /> 169 </templates> 170 <controller> 171 <WaypointController team=10> 172 <waypoints> 173 <Model mesh="cube.mesh" scale=0 position="400,240,400" /> 174 <Model mesh="cube.mesh" scale=0 position="-55,240,700" /> 175 <Model mesh="cube.mesh" scale=0 position="-500,240,400" /> 176 <Model mesh="cube.mesh" scale=0 position="-700,240,0" /> 177 <Model mesh="cube.mesh" scale=0 position="-500,240,-400" /> 178 <Model mesh="cube.mesh" scale=0 position="-55,240,-700" /> 179 <Model mesh="cube.mesh" scale=0 position="400,240,-400" /> 180 <Model mesh="cube.mesh" scale=0 position="700,240,0" /> 181 </waypoints> 182 </WaypointController> 183 </controller> 184 </SpaceShip> 185 186 187 60 188 </Scene> 61 189 </Level> -
code/trunk/data/levels/theTimeMachine.oxw
r9016 r9348 39 39 angularDamping = 0.9999999 40 40 > 41 <engines> 42 <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine /> 43 <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine /> 44 </engines> 41 45 <attached> 42 46 <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" /> … … 71 75 <Scene 72 76 ambientlight="0.8,0.8,0.8" 73 skybox="Orxonox/sky panoramagen2"77 skybox="Orxonox/skyBoxSomeNebula" 74 78 > 75 79 -
code/trunk/data/levels/tutorial.oxw
r9016 r9348 2 2 name = "Coding Tutorial" 3 3 description = "Level for the coding tutorial." 4 tags = "tutorial "4 tags = "tutorial, shipselection" 5 5 screenshot = "codingtutorial.png" 6 startingships = "spaceshipassff, spaceshipghost, spaceshipspacecruiser" 6 7 /> 7 8 … … 10 11 include("stats.oxo") 11 12 include("templates/spaceshipAssff.oxt") 13 include("templates/spaceshipGhost.oxt") 14 include("templates/spaceshipSpacecruiser.oxt") 12 15 include("templates/lodInformation.oxt") 13 16 ?> … … 21 24 <Scene 22 25 ambientlight = "0.5, 0.5, 0.5" 23 skybox = "Orxonox/sky panoramagen1"26 skybox = "Orxonox/skyBoxBasic" 24 27 > 25 26 27 28 29 28 <Drone name="meineDrohne" primarythrust="80" auxilarythrust="10" rotationthrust="10" mass= "50" linearDamping = "0.9" angularDamping = "0.7"> 30 29 <attached> … … 53 52 for i = 1, 10, 1 do 54 53 ?> 55 <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=s paceshipassff/>54 <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" spawnclass=SpaceShip pawndesign=shipselection /> 56 55 <?lua end ?> 57 56 -
code/trunk/data/levels/underAttack.oxw
r9257 r9348 12 12 include("templates/lodInformation.oxt") 13 13 ?> 14 <!--OUTDATED: include("underAttackHUD.oxo") -->15 14 16 15 <Level … … 24 23 <Scene 25 24 ambientlight = "0.5, 0.5, 0.5" 26 skybox = "Orxonox/sky panoramagen1"25 skybox = "Orxonox/skyBoxBasic" 27 26 > 28 27 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/levels/waypoints.oxw
r9016 r9348 23 23 <Scene 24 24 ambientlight = "0.5, 0.5, 0.5" 25 skybox = "Orxonox/sky panoramagen1"25 skybox = "Orxonox/skyBoxBasic" 26 26 > 27 27 <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" /> -
code/trunk/data/overlays/dynamicMatchHUD.oxo
r7679 r9348 2 2 <OverlayGroup name="DynamicmatcHUD" scale = "1, 1"> 3 3 4 <!--OverlayText 5 position = "0.02, 0.02" 6 pickpoint = "0.0, 0.0" 7 font = "ShareTechMono" 8 textsize = 0.04 9 colour = "1.0, 1.0, 1.0, 1.0" 10 align = "left" 11 caption = "Target:" 12 /> 13 14 <OverlayText 15 position = "0.02, 0.055" 16 pickpoint = "0.0, 0.0" 17 font = "ShareTechMono" 18 textsize = 0.04 19 colour = "1.0, 1.0, 1.0, 1.0" 20 align = "left" 21 caption = "Score:" 22 /--> 23 24 4 25 <GametypeStaticMessage 5 26 name = "staticmessage" -
code/trunk/data/overlays/lastManStandingHUD.oxo
r8178 r9348 1 1 <Template name="LastmanstandingHUD"> 2 <OverlayGroup name="DynamicmatcHUD" scale = "1, 1"> 3 4 <!--GametypeStaticMessage 5 name = "staticmessage" 6 position = "0.5, 0.01" 7 font = "VeraMono" 8 caption = "" 9 textsize = 0.033 10 colour = "1.0, 1.0, 0.5, 1.0" 11 align = "center" 12 /--> 13 14 <GametypeFadingMessage 15 name = "fadingmessage" 16 position = "0.5, 0.01" 17 font = "VeraMono" 18 textsize = 0.04 19 colour = "1.0, 1.0, 0.5, 1.0" 20 align = "center" 21 /> 22 23 <OverlayText 24 position = "0.02, 0.02" 25 pickpoint = "0.0, 0.0" 26 font = "ShareTechMono" 27 textsize = 0.04 28 colour = "1.0, 1.0, 1.0, 1.0" 29 align = "left" 30 caption = "Lives: " 31 /> 32 2 <OverlayGroup name="LastmanstandingHUD" scale = "1, 1"> 33 3 <LastManStandingInfos 34 4 position = "0.14, 0.02" … … 41 11 showlives = true 42 12 showplayers = false 13 /> 14 <OverlayText 15 position = "0.02, 0.02" 16 pickpoint = "0.0, 0.0" 17 font = "ShareTechMono" 18 textsize = 0.04 19 colour = "1.0, 1.0, 1.0, 1.0" 20 align = "left" 21 caption = "Lives: " 43 22 /> 44 23 -
code/trunk/data/overlays/lastTeamStandingHUD.oxo
r8351 r9348 1 1 <Template name="lastTeamStandingHUD"> 2 2 <OverlayGroup name="lastTeamStandingHUD" scale = "1, 1"> 3 <LastTeamStandingInfos 4 position = "0.14, 0.02" 5 pickpoint = "0.0, 0.0" 6 font = "ShareTechMono" 7 textsize = 0.04 8 colour = "1.0, 1.0, 1.0, 1.0" 9 align = "left" 3 10 4 <GametypeFadingMessage 5 name = "fadingmessage" 6 position = "0.5, 0.01" 7 font = "VeraMono" 8 textsize = 0.04 9 colour = "1.0, 1.0, 0.5, 1.0" 10 align = "center" 11 showlives = true 12 showteams = false 11 13 /> 12 14 … … 19 21 align = "left" 20 22 caption = "Lives: " 21 />22 23 <LastTeamStandingInfos24 position = "0.14, 0.02"25 pickpoint = "0.0, 0.0"26 font = "ShareTechMono"27 textsize = 0.0428 colour = "1.0, 1.0, 1.0, 1.0"29 align = "left"30 31 showlives = true32 showteams = false33 23 /> 34 24 -
code/trunk/doc/api/groups/Portals.dox
- Property svn:eol-style set to native
-
code/trunk/doc/api/groups/Weapons.dox
- Property svn:eol-style set to native
-
code/trunk/src/BuildUnitsConfigGCC.cmake
- Property svn:eol-style set to native
-
code/trunk/src/BuildUnitsConfigMSVC.cmake
- Property svn:eol-style set to native
-
code/trunk/src/external/enet/VERSION
- Property svn:eol-style set to native
-
code/trunk/src/external/tolua/README_ORXONOX
- Property svn:eol-style set to native
-
code/trunk/src/libraries/core/Super.h
r8866 r9348 280 280 SUPER_NOARGS(classname, functionname) 281 281 282 #define SUPER_clone(classname, functionname, ...) \283 SUPER_ARGS(classname, functionname, __VA_ARGS__)284 285 282 #define SUPER_changedCarrier(classname, functionname, ...) \ 286 283 SUPER_NOARGS(classname, functionname) … … 398 395 inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) \ 399 396 { \ 400 ( dynamic_cast<T*>(object))->T:: functionname397 (orxonox_cast<T*>(object))->T:: functionname 401 398 402 399 /* … … 508 505 inline void operator()( SUPER_CALL_ARGUMENTS##hasarguments(__VA_ARGS__) ) 509 506 { 510 ( dynamic_cast<T*>(object))->T:: functionname ( Call the function with it's arguments );507 (orxonox_cast<T*>(object))->T:: functionname ( Call the function with it's arguments ); 511 508 } 512 509 … … 566 563 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 567 564 568 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, clone, true, OrxonoxClass*& item) 569 (item) 570 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 571 572 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedCarrier, false) 573 () 574 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 575 576 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(13, changedPickedUp, false) 565 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(11, changedCarrier, false) 566 () 567 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; 568 569 SUPER_FUNCTION_GLOBAL_DECLARATION_PART1(12, changedPickedUp, false) 577 570 () 578 571 SUPER_FUNCTION_GLOBAL_DECLARATION_PART2; … … 632 625 SUPER_INTRUSIVE_DECLARATION(changedGametype); 633 626 SUPER_INTRUSIVE_DECLARATION(changedUsed); 634 SUPER_INTRUSIVE_DECLARATION(clone);635 627 SUPER_INTRUSIVE_DECLARATION(changedCarrier); 636 628 SUPER_INTRUSIVE_DECLARATION(changedPickedUp); -
code/trunk/src/libraries/core/Template.cc
r8858 r9348 149 149 orxout(verbose, context::templates) << object->getLoaderIndentation() << " aplying Template \"" << this->getName() << "\"..." << endl; 150 150 151 // check if the template is applied on an object of the right type 152 Identifier* identifier = Identifier::getIdentifierByString(this->getXMLElement().Value()); 153 if (!object->getIdentifier()->isA(identifier)) 154 orxout(internal_warning, context::templates) << "Template was defined for " << identifier->getName() << " but the object is of type " << object->getIdentifier()->getName() << endl; 155 151 156 Element temp = &const_cast<TiXmlElement&>(this->getXMLElement()); 152 157 -
code/trunk/src/libraries/core/XMLPort.h
r8858 r9348 197 197 ClassIdentifier<classname>::getIdentifier()->addXMLPortParamContainer(paramname, containername); \ 198 198 } \ 199 containername->port( dynamic_cast<BaseObject*>(this), object, xmlelement, mode)199 containername->port(orxonox_cast<BaseObject*>(this), object, xmlelement, mode) 200 200 201 201 // -------------------- -
code/trunk/src/libraries/core/command/ConsoleCommand.cc
r8858 r9348 594 594 @param bPrintError If true, an error is printed if the command doesn't exist 595 595 */ 596 /* static */ constConsoleCommand* ConsoleCommand::getCommand(const std::string& group, const std::string& name, bool bPrintError)596 /* static */ ConsoleCommand* ConsoleCommand::getCommand(const std::string& group, const std::string& name, bool bPrintError) 597 597 { 598 598 // find the group … … 624 624 @param bPrintError If true, an error is printed if the command doesn't exist 625 625 */ 626 /* static */ constConsoleCommand* ConsoleCommand::getCommandLC(const std::string& group, const std::string& name, bool bPrintError)626 /* static */ ConsoleCommand* ConsoleCommand::getCommandLC(const std::string& group, const std::string& name, bool bPrintError) 627 627 { 628 628 std::string groupLC = getLowercase(group); -
code/trunk/src/libraries/core/command/ConsoleCommand.h
r8858 r9348 382 382 public: 383 383 /// Constructor: Creates a manipulator for a given ConsoleCommand. 384 ConsoleCommandManipulator( const ConsoleCommand* command) : command_(const_cast<ConsoleCommand*>(command)) {}384 ConsoleCommandManipulator(ConsoleCommand* command) : command_(command) {} 385 385 386 386 /// Changes the current function of the command. @param function The new function-pointer @param bForce If true, the new function-pointer is always assigned, even if the headers don't match … … 619 619 620 620 /// Returns a manipulator for this command. 621 inline ConsoleCommandManipulator getManipulator() const621 inline ConsoleCommandManipulator getManipulator() 622 622 { return this; } 623 623 … … 667 667 668 668 /// Returns a command (shortcut) with given name. @param name The name of the command shortcut @param bPrintError If true, an error is printed if the command doesn't exist 669 static inline constConsoleCommand* getCommand(const std::string& name, bool bPrintError = false)669 static inline ConsoleCommand* getCommand(const std::string& name, bool bPrintError = false) 670 670 { return ConsoleCommand::getCommand("", name, bPrintError); } 671 671 /// Returns a command (shortcut) with given name in lowercase. @param name The lowercase name of the command shortcut @param bPrintError If true, an error is printed if the command doesn't exist 672 static inline constConsoleCommand* getCommandLC(const std::string& name, bool bPrintError = false)672 static inline ConsoleCommand* getCommandLC(const std::string& name, bool bPrintError = false) 673 673 { return ConsoleCommand::getCommandLC("", name, bPrintError); } 674 674 675 static constConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false);676 static constConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false);675 static ConsoleCommand* getCommand(const std::string& group, const std::string& name, bool bPrintError = false); 676 static ConsoleCommand* getCommandLC(const std::string& group, const std::string& name, bool bPrintError = false); 677 677 678 678 static void destroyAll(); -
code/trunk/src/libraries/util/output/ConsoleWriter.cc
- Property svn:eol-style set to native
-
code/trunk/src/modules/CMakeLists.txt
r8706 r9348 38 38 ADD_SUBDIRECTORY(weapons) 39 39 ADD_SUBDIRECTORY(docking) 40 ADD_SUBDIRECTORY(towerdefense) -
code/trunk/src/modules/docking/DockingController.cc
r8858 r9348 60 60 61 61 float distance = (this->dock_->getWorldPosition() - entity->getPosition()).length(); 62 Vector2 coord = get2DView direction( // I don't understand this too62 Vector2 coord = get2DViewcoordinates( // I don't understand this too 63 63 entity->getPosition(), 64 64 entity->getOrientation() * WorldEntity::FRONT, … … 70 70 if (distance > 10) 71 71 { 72 entity->rotateYaw(-1.0f * 0.8f * sgn(coord.x) * coord.x*coord.x);73 entity->rotatePitch(0.8f * sgn(coord.y) * coord.y*coord.y);72 entity->rotateYaw(-1.0f * 0.8f * clamp(coord.x * 10, -1.0f, 1.0f)); 73 entity->rotatePitch(0.8f * clamp(coord.y * 10, -1.0f, 1.0f)); 74 74 } 75 75 -
code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc
- Property svn:eol-style set to native
r9016 r9348 112 112 const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_) 113 113 + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1); 114 const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);114 gametype->getGametypeInfo()->sendAnnounceMessage(message); 115 115 ChatManager::message(message); 116 116 } -
code/trunk/src/modules/gametypes/OldRaceCheckPoint.h
- Property svn:eol-style set to native
-
code/trunk/src/modules/gametypes/OldSpaceRace.cc
- Property svn:eol-style set to native
r9016 r9348 58 58 + "You didn't reach the check point " + multi_cast<std::string>(this->checkpointsReached_+1) 59 59 + " before the time limit. You lose!"; 60 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);60 this->getGametypeInfo()->sendAnnounceMessage(message); 61 61 ChatManager::message(message); 62 62 } … … 68 68 const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s) 69 69 + "." + multi_cast<std::string>(ms) + " seconds."; 70 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);70 this->getGametypeInfo()->sendAnnounceMessage(message); 71 71 ChatManager::message(message); 72 72 /* … … 85 85 86 86 std::string message("The match has started! Reach the check points as quickly as possible!"); 87 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);87 this->getGametypeInfo()->sendAnnounceMessage(message); 88 88 ChatManager::message(message); 89 89 } … … 98 98 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) 99 99 + " seconds."; 100 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);100 this->getGametypeInfo()->sendAnnounceMessage(message); 101 101 ChatManager::message(message); 102 102 } -
code/trunk/src/modules/gametypes/OldSpaceRace.h
- Property svn:eol-style set to native
r9016 r9348 59 59 60 60 virtual void newCheckpointReached(); 61 virtual void addBots(unsigned int amount){} //<! overwrite function in order to bypass the addbots command. 62 //<! This is only a temporary solution. Better: create racingBots. 61 63 62 64 inline void setCheckpointsReached(int n) -
code/trunk/src/modules/gametypes/RaceCheckPoint.cc
r9263 r9348 97 97 std::string message = "You have " + multi_cast<std::string>(this->timeLimit_) 98 98 + " seconds to reach the check point " + multi_cast<std::string>(this->checkpointIndex_ + 1); 99 const_cast<GametypeInfo*>(this->getGametype()->getGametypeInfo())->sendAnnounceMessage(message);99 this->getGametype()->getGametypeInfo()->sendAnnounceMessage(message); 100 100 ChatManager::message(message); 101 101 } -
code/trunk/src/modules/gametypes/SpaceRace.cc
r9263 r9348 23 23 * Mauro Salomon 24 24 * Co-authors: 25 * ...25 * Celine Egger 26 26 * 27 27 */ … … 48 48 this->cantMove_ = false; 49 49 this->bTimeIsUp_ = false; 50 this->numberOfBots_ = 0; // quick fix: don't allow default-bots to enter the race 51 // remove this line, if a raceBot has been created. 50 52 } 51 53 … … 70 72 } 71 73 72 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);74 this->getGametypeInfo()->sendAnnounceMessage(message); 73 75 ChatManager::message(message); 74 76 } … … 97 99 98 100 std::string message = "The match has started! Reach the check points as quickly as possible!"; 99 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);101 this->getGametypeInfo()->sendAnnounceMessage(message); 100 102 ChatManager::message(message); 101 103 } … … 112 114 const std::string& message = "Checkpoint " + multi_cast<std::string>(checkpoint->getCheckpointIndex() + 1) 113 115 + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds."; 114 const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);116 this->getGametypeInfo()->sendAnnounceMessage(message); 115 117 ChatManager::message(message); 116 118 } -
code/trunk/src/modules/gametypes/SpaceRaceManager.cc
- Property svn:eol-style set to native
r9263 r9348 149 149 } 150 150 else 151 151 { 152 152 // adjust the radarvisibility 153 153 gametype->newCheckpointReached(newCheckpoint, player); -
code/trunk/src/modules/gametypes/SpaceRaceManager.h
- Property svn:eol-style set to native
-
code/trunk/src/modules/objects/triggers/CheckPoint.cc
r7601 r9348 109 109 if (bIsDestination_) 110 110 { 111 const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage("Congratulations - you have won the match!");111 gametype->getGametypeInfo()->sendAnnounceMessage("Congratulations - you have won the match!"); 112 112 gametype->end(); 113 113 } … … 115 115 if (!bIsFirst_ && !bIsDestination_) 116 116 { 117 const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage("Checkpoint reached");117 gametype->getGametypeInfo()->sendAnnounceMessage("Checkpoint reached"); 118 118 } 119 119 } -
code/trunk/src/modules/overlays/OverlaysPrereqs.h
r8706 r9348 95 95 class PauseNotice; 96 96 class TeamBaseMatchScore; 97 class UnderAttackHealthBar;98 97 99 98 // stats -
code/trunk/src/modules/overlays/hud/CMakeLists.txt
r9016 r9348 12 12 KillMessage.cc 13 13 DeathMessage.cc 14 UnderAttackHealthBar.cc15 14 TeamBaseMatchScore.cc 16 15 GametypeStaticMessage.cc -
code/trunk/src/modules/overlays/hud/HUDBoostBar.cc
- Property svn:eol-style set to native
-
code/trunk/src/modules/overlays/hud/HUDBoostBar.h
- Property svn:eol-style set to native
-
code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc
- Property svn:eol-style set to native
-
code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h
- Property svn:eol-style set to native
-
code/trunk/src/modules/overlays/hud/HUDNavigation.cc
r9257 r9348 55 55 namespace orxonox 56 56 { 57 bool compareDistance ( std::pair<RadarViewable*, unsigned int > a, std::pair<RadarViewable*, unsigned int > b ) 58 { 59 return a.second<b.second; 60 61 } 62 63 void HUDNavigation::setConfigValues() 64 { 65 SetConfigValue(markerLimit_, 3); 66 SetConfigValue(showDistance, false); 67 } 68 69 CreateFactory ( HUDNavigation ); 70 71 HUDNavigation::HUDNavigation ( BaseObject* creator ) 72 : OrxonoxOverlay ( creator ) 73 { 74 RegisterObject ( HUDNavigation ); 75 this->setConfigValues(); 76 77 // Set default values 78 this->setFont ( "Monofur" ); 79 this->setTextSize ( 0.05f ); 80 this->setNavMarkerSize ( 0.05f ); 81 this->setDetectionLimit( 10000.0f ); 82 } 83 84 HUDNavigation::~HUDNavigation() 85 { 86 if ( this->isInitialized() ) 87 { 88 for ( ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ) 89 removeObject ( ( it++ )->first ); 90 91 } 92 93 sortedObjectList_.clear(); 94 } 95 96 void HUDNavigation::XMLPort ( Element& xmlelement, XMLPort::Mode mode ) 97 { 98 SUPER ( HUDNavigation, XMLPort, xmlelement, mode ); 99 100 XMLPortParam ( HUDNavigation, "font", setFont, getFont, xmlelement, mode ); 101 XMLPortParam ( HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode ); 102 XMLPortParam ( HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode ); 103 XMLPortParam ( HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode ); 104 } 105 106 void HUDNavigation::setFont ( const std::string& font ) 107 { 108 const Ogre::ResourcePtr& fontPtr = Ogre::FontManager::getSingleton().getByName ( font ); 109 if ( fontPtr.isNull() ) 110 { 111 orxout(internal_warning) << "HUDNavigation: Font '" << font << "' not found" << endl; 112 return; 113 } 114 fontName_ = font; 115 for ( ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it ) 116 { 117 if ( it->second.text_ != NULL ) 118 it->second.text_->setFontName ( fontName_ ); 119 } 120 } 121 122 const std::string& HUDNavigation::getFont() const 123 { 124 return fontName_; 125 } 126 127 void HUDNavigation::setTextSize ( float size ) 128 { 129 if ( size <= 0.0f ) 130 { 131 orxout(internal_warning) << "HUDNavigation: Negative font size not allowed" << endl; 132 return; 133 } 134 textSize_ = size; 135 for ( ObjectMap::iterator it = activeObjectList_.begin(); it!=activeObjectList_.end(); ++it ) 136 { 137 if ( it->second.text_ ) 138 it->second.text_->setCharHeight ( size ); 139 } 140 } 141 142 float HUDNavigation::getTextSize() const 143 { 144 return textSize_; 145 } 146 147 float HUDNavigation::getArrowSizeX(int dist) 148 { 149 if (dist < 600) 150 dist = 600; 151 return this->getActualSize().x * 900 * navMarkerSize_ / dist; 152 } 153 154 float HUDNavigation::getArrowSizeY(int dist) 155 { 156 if (dist < 600) 157 dist = 600; 158 return this->getActualSize().y * 900 * navMarkerSize_ / dist; 159 } 160 161 void HUDNavigation::tick ( float dt ) 162 { 163 SUPER ( HUDNavigation, tick, dt ); 164 165 Camera* cam = CameraManager::getInstance().getActiveCamera(); 166 if ( cam == NULL ) 167 return; 168 const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 169 170 171 for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++listIt ) 172 { 173 listIt->second = ( int ) ( ( listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition() ).length() + 0.5f ); 174 } 175 176 sortedObjectList_.sort ( compareDistance ); 177 178 unsigned int markerCount_ = 0; 179 bool closeEnough_ = false; //only display objects that are close enough to be relevant for the player 180 181 // for (ObjectMap::iterator it = activeObjectList_.begin(); it != activeObjectList_.end(); ++it) 182 for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++markerCount_, ++listIt ) 183 { 184 ObjectMap::iterator it = activeObjectList_.find ( listIt->first ); 185 closeEnough_ = listIt->second < detectionLimit_ ; 186 // display radarviewables on HUD if the marker limit and max-distance is not exceeded 187 if ( markerCount_ < markerLimit_ && (closeEnough_ || detectionLimit_ < 0) ) 188 { 189 190 191 // Get Distance to HumanController and save it in the TextAreaOverlayElement. 192 int dist = listIt->second; 193 float textLength = 0.0f; 194 195 //display distance next to cursor 196 if (showDistance){ 197 it->second.text_->setCaption ( multi_cast<std::string> ( dist ) ); 198 textLength = multi_cast<std::string> ( dist ).size() * it->second.text_->getCharHeight() * 0.3f; 199 } 200 201 //display name next to cursor 202 else{ 203 it->second.text_->setCaption(it->first->getRadarName()); 204 textLength = it->first->getRadarName().size() * it->second.text_->getCharHeight() * 0.3f; 205 } 206 207 // Transform to screen coordinates 208 Vector3 pos = camTransform * it->first->getRVWorldPosition(); 209 210 bool outOfView = true; 211 if ( pos.z > 1.0 ) 57 bool compareDistance(std::pair<RadarViewable*, unsigned int> a, std::pair<RadarViewable*, unsigned int> b) 58 { 59 return a.second < b.second; 60 } 61 62 CreateFactory ( HUDNavigation ); 63 64 HUDNavigation::HUDNavigation(BaseObject* creator) : OrxonoxOverlay(creator) 65 { 66 RegisterObject(HUDNavigation); 67 this->setConfigValues(); 68 69 // Set default values 70 this->setFont("Monofur"); 71 this->setTextSize(0.05f); 72 this->setNavMarkerSize(0.05f); 73 this->setDetectionLimit(10000.0f); 74 } 75 76 HUDNavigation::~HUDNavigation() 77 { 78 if (this->isInitialized()) 79 { 80 for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end();) 81 removeObject((it++)->first); 82 } 83 this->sortedObjectList_.clear(); 84 } 85 86 void HUDNavigation::setConfigValues() 87 { 88 SetConfigValue(markerLimit_, 3); 89 SetConfigValue(showDistance_, false); 90 } 91 92 void HUDNavigation::XMLPort(Element& xmlelement, XMLPort::Mode mode) 93 { 94 SUPER(HUDNavigation, XMLPort, xmlelement, mode); 95 96 XMLPortParam(HUDNavigation, "font", setFont, getFont, xmlelement, mode); 97 XMLPortParam(HUDNavigation, "textSize", setTextSize, getTextSize, xmlelement, mode); 98 XMLPortParam(HUDNavigation, "navMarkerSize", setNavMarkerSize, getNavMarkerSize, xmlelement, mode); 99 XMLPortParam(HUDNavigation, "detectionLimit", setDetectionLimit, getDetectionLimit, xmlelement, mode); 100 } 101 102 void HUDNavigation::setFont(const std::string& font) 103 { 104 const Ogre::ResourcePtr& fontPtr = Ogre::FontManager::getSingleton().getByName(font); 105 if (fontPtr.isNull()) 106 { 107 orxout(internal_warning) << "HUDNavigation: Font '" << font << "' not found" << endl; 108 return; 109 } 110 this->fontName_ = font; 111 for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it) 112 { 113 if (it->second.text_ != NULL) 114 it->second.text_->setFontName(this->fontName_); 115 } 116 } 117 118 const std::string& HUDNavigation::getFont() const 119 { 120 return this->fontName_; 121 } 122 123 void HUDNavigation::setTextSize(float size) 124 { 125 if (size <= 0.0f) 126 { 127 orxout(internal_warning) << "HUDNavigation: Negative font size not allowed" << endl; 128 return; 129 } 130 this->textSize_ = size; 131 for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it!=this->activeObjectList_.end(); ++it) 132 { 133 if (it->second.text_) 134 it->second.text_->setCharHeight(size); 135 } 136 } 137 138 float HUDNavigation::getTextSize() const 139 { 140 return this->textSize_; 141 } 142 143 float HUDNavigation::getArrowSizeX(int dist) const 144 { 145 if (dist < 600) 146 dist = 600; 147 return this->getActualSize().x * 900 * this->navMarkerSize_ / dist; 148 } 149 150 float HUDNavigation::getArrowSizeY(int dist) const 151 { 152 if (dist < 600) 153 dist = 600; 154 return this->getActualSize().y * 900 * this->navMarkerSize_ / dist; 155 } 156 157 void HUDNavigation::tick(float dt) 158 { 159 SUPER(HUDNavigation, tick, dt); 160 161 Camera* cam = CameraManager::getInstance().getActiveCamera(); 162 if (cam == NULL) 163 return; 164 const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 165 166 167 for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt) 168 listIt->second = (int)((listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f); 169 170 this->sortedObjectList_.sort(compareDistance); 171 172 unsigned int markerCount = 0; 173 bool closeEnough = false; // only display objects that are close enough to be relevant for the player 174 175 for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt) 176 { 177 std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.find(listIt->first); 178 closeEnough = listIt->second < this->detectionLimit_; 179 // display radarviewables on HUD if the marker limit and max-distance is not exceeded 180 if (markerCount < this->markerLimit_ && (closeEnough || this->detectionLimit_ < 0)) 212 181 { 213 // z > 1.0 means that the object is behind the camera 214 outOfView = true; 215 // we have to switch all coordinates (if you don't know why, 216 // try linear algebra lectures, because I can't explain..) 217 pos.x = -pos.x; 218 pos.y = -pos.y; 219 } 220 else 221 outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0; 222 223 if ( outOfView ) 224 { 225 // Object is not in view 226 227 // Change material only if outOfView changed 228 if ( !it->second.wasOutOfView_ ) 182 // Get Distance to HumanController and save it in the TextAreaOverlayElement. 183 int dist = listIt->second; 184 float textLength = 0.0f; 185 186 if (this->showDistance_) 229 187 { 230 it->second.panel_->setMaterialName( TextureGenerator::getMaterialName( "arrows.png", it->first->getRadarObjectColour()) ); 231 it->second.wasOutOfView_ = true; 188 //display distance next to cursor 189 it->second.text_->setCaption(multi_cast<std::string>(dist)); 190 textLength = multi_cast<std::string>(dist).size() * it->second.text_->getCharHeight() * 0.3f; 232 191 } 233 234 //float xDistScale = this->getActualSize().x * 1000.0f * navMarkerSize_ / dist; 235 //float yDistScale = this->getActualSize().y * 1000.0f * navMarkerSize_ / dist; 236 237 // Adjust Arrowsize according to distance 238 it->second.panel_->setDimensions(getArrowSizeX(dist),getArrowSizeY(dist)); 239 240 // Switch between top, bottom, left and right position of the arrow at the screen border 241 if ( pos.x < pos.y ) 192 else 242 193 { 243 if ( pos.y > -pos.x ) 194 //display name next to cursor 195 it->second.text_->setCaption(it->first->getRadarName()); 196 textLength = it->first->getRadarName().size() * it->second.text_->getCharHeight() * 0.3f; 197 } 198 199 // Transform to screen coordinates 200 Vector3 pos = camTransform * it->first->getRVWorldPosition(); 201 202 bool outOfView = true; 203 if (pos.z > 1.0) 204 { 205 // z > 1.0 means that the object is behind the camera 206 outOfView = true; 207 // we have to switch all coordinates (if you don't know why, 208 // try linear algebra lectures, because I can't explain..) 209 pos.x = -pos.x; 210 pos.y = -pos.y; 211 } 212 else 213 outOfView = pos.x < -1.0 || pos.x > 1.0 || pos.y < -1.0 || pos.y > 1.0; 214 215 if (outOfView) 216 { 217 // Object is not in view 218 219 // Change material only if outOfView changed 220 if (!it->second.wasOutOfView_) 244 221 { 245 // Top 246 float position = pos.x / pos.y + 1.0f; 247 it->second.panel_->setPosition ( ( position - it->second.panel_->getWidth() ) * 0.5f, 0.0f ); 248 it->second.panel_->setUV ( 0.5f, 0.0f, 1.0f, 0.5f ); 249 it->second.text_->setLeft ( ( position - textLength ) * 0.5f ); 250 it->second.text_->setTop ( it->second.panel_->getHeight() ); 222 it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("arrows.png", it->first->getRadarObjectColour())); 223 it->second.wasOutOfView_ = true; 224 } 225 226 //float xDistScale = this->getActualSize().x * 1000.0f * this->navMarkerSize_ / dist; 227 //float yDistScale = this->getActualSize().y * 1000.0f * this->navMarkerSize_ / dist; 228 229 // Adjust Arrowsize according to distance 230 it->second.panel_->setDimensions(getArrowSizeX(dist), getArrowSizeY(dist)); 231 232 // Switch between top, bottom, left and right position of the arrow at the screen border 233 if (pos.x < pos.y) 234 { 235 if (pos.y > -pos.x) 236 { 237 // Top 238 float position = pos.x / pos.y + 1.0f; 239 it->second.panel_->setPosition((position - it->second.panel_->getWidth()) * 0.5f, 0.0f); 240 it->second.panel_->setUV(0.5f, 0.0f, 1.0f, 0.5f); 241 it->second.text_->setLeft((position - textLength) * 0.5f); 242 it->second.text_->setTop(it->second.panel_->getHeight()); 243 } 244 else 245 { 246 // Left 247 float position = pos.y / pos.x + 1.0f; 248 it->second.panel_->setPosition(0.0f, (position - it->second.panel_->getWidth()) * 0.5f); 249 it->second.panel_->setUV(0.0f, 0.0f, 0.5f, 0.5f); 250 it->second.text_->setLeft(it->second.panel_->getWidth() + 0.01f); 251 it->second.text_->setTop((position - it->second.text_->getCharHeight()) * 0.5f); 252 } 251 253 } 252 254 else 253 255 { 254 // Left 255 float position = pos.y / pos.x + 1.0f; 256 it->second.panel_->setPosition ( 0.0f, ( position - it->second.panel_->getWidth() ) * 0.5f ); 257 it->second.panel_->setUV ( 0.0f, 0.0f, 0.5f, 0.5f ); 258 it->second.text_->setLeft ( it->second.panel_->getWidth() + 0.01f ); 259 it->second.text_->setTop ( ( position - it->second.text_->getCharHeight() ) * 0.5f ); 256 if (pos.y < -pos.x) 257 { 258 // Bottom 259 float position = -pos.x / pos.y + 1.0f; 260 it->second.panel_->setPosition((position - it->second.panel_->getWidth()) * 0.5f, 1.0f - it->second.panel_->getHeight()); 261 it->second.panel_->setUV(0.0f, 0.5f, 0.5f, 1.0f ); 262 it->second.text_->setLeft((position - textLength) * 0.5f); 263 it->second.text_->setTop(1.0f - it->second.panel_->getHeight() - it->second.text_->getCharHeight()); 264 } 265 else 266 { 267 // Right 268 float position = -pos.y / pos.x + 1.0f; 269 it->second.panel_->setPosition(1.0f - it->second.panel_->getWidth(), (position - it->second.panel_->getHeight()) * 0.5f); 270 it->second.panel_->setUV(0.5f, 0.5f, 1.0f, 1.0f); 271 it->second.text_->setLeft(1.0f - it->second.panel_->getWidth() - textLength - 0.01f); 272 it->second.text_->setTop((position - it->second.text_->getCharHeight()) * 0.5f); 273 } 260 274 } 261 275 } 262 263 276 else 264 277 { 265 266 if ( pos.y < -pos.x ) 278 // Object is in view 279 280 // Change material only if outOfView changed 281 if (it->second.wasOutOfView_) 267 282 { 268 // Bottom 269 float position = -pos.x / pos.y + 1.0f; 270 it->second.panel_->setPosition ( ( position - it->second.panel_->getWidth() ) * 0.5f, 1.0f - it->second.panel_->getHeight() ); 271 it->second.panel_->setUV ( 0.0f, 0.5f, 0.5f, 1.0f ); 272 it->second.text_->setLeft ( ( position - textLength ) * 0.5f ); 273 it->second.text_->setTop ( 1.0f - it->second.panel_->getHeight() - it->second.text_->getCharHeight() ); 283 //it->second.panel_->setMaterialName("Orxonox/NavTDC"); 284 it->second.panel_->setMaterialName(TextureGenerator::getMaterialName("tdc.png", it->first->getRadarObjectColour())); 285 it->second.panel_->setDimensions(this->navMarkerSize_ * this->getActualSize().x, this->navMarkerSize_ * this->getActualSize().y); 286 it->second.wasOutOfView_ = false; 274 287 } 275 else 276 {277 // Right278 float position = -pos.y / pos.x + 1.0f;279 it->second.panel_->setPosition ( 1.0f - it->second.panel_->getWidth(), ( position - it->second.panel_->getHeight() ) * 0.5f);280 it->second.panel_->setUV ( 0.5f, 0.5f, 1.0f, 1.0f ); 281 it->second.text_->setLeft ( 1.0f - it->second.panel_->getWidth() - textLength - 0.01f );282 it->second.text_->setTop ( ( position - it->second.text_->getCharHeight() ) * 0.5f);283 }288 289 // Position marker 290 it->second.panel_->setUV(0.0f, 0.0f, 1.0f, 1.0f); 291 it->second.panel_->setLeft((pos.x + 1.0f - it->second.panel_->getWidth()) * 0.5f); 292 it->second.panel_->setTop((-pos.y + 1.0f - it->second.panel_->getHeight()) * 0.5f); 293 294 // Position text 295 it->second.text_->setLeft((pos.x + 1.0f + it->second.panel_->getWidth()) * 0.5f); 296 it->second.text_->setTop((-pos.y + 1.0f + it->second.panel_->getHeight()) * 0.5f); 284 297 } 298 299 // Make sure the overlays are shown 300 it->second.panel_->show(); 301 it->second.text_->show(); 285 302 } 286 else 303 else // do not display on HUD 287 304 { 288 // Object is in view 289 290 // Change material only if outOfView changed 291 if ( it->second.wasOutOfView_ ) 292 { 293 //it->second.panel_->setMaterialName ( "Orxonox/NavTDC" ); 294 it->second.panel_->setMaterialName( TextureGenerator::getMaterialName( "tdc.png", it->first->getRadarObjectColour()) ); 295 it->second.panel_->setDimensions ( navMarkerSize_ * this->getActualSize().x, navMarkerSize_ * this->getActualSize().y ); 296 it->second.wasOutOfView_ = false; 297 } 298 299 // Position marker 300 it->second.panel_->setUV ( 0.0f, 0.0f, 1.0f, 1.0f ); 301 it->second.panel_->setLeft ( ( pos.x + 1.0f - it->second.panel_->getWidth() ) * 0.5f ); 302 it->second.panel_->setTop ( ( -pos.y + 1.0f - it->second.panel_->getHeight() ) * 0.5f ); 303 304 // Position text 305 it->second.text_->setLeft ( ( pos.x + 1.0f + it->second.panel_->getWidth() ) * 0.5f ); 306 it->second.text_->setTop ( ( -pos.y + 1.0f + it->second.panel_->getHeight() ) * 0.5f ); 305 it->second.panel_->hide(); 306 it->second.text_->hide(); 307 307 } 308 309 // Make sure the overlays are shown 310 it->second.panel_->show(); 311 it->second.text_->show(); 312 } 313 else // do not display on HUD 314 { 315 it->second.panel_->hide(); 316 it->second.text_->hide(); 317 } 318 308 } 309 } 310 311 /** Overridden method of OrxonoxOverlay. 312 @details 313 Usually the entire overlay scales with scale(). 314 Here we obviously have to adjust this. 315 */ 316 void HUDNavigation::sizeChanged() 317 { 318 // Use size to compensate for aspect ratio if enabled. 319 float xScale = this->getActualSize().x; 320 float yScale = this->getActualSize().y; 321 322 for (std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it) 323 { 324 if (it->second.panel_ != NULL) 325 it->second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); 326 if (it->second.text_ != NULL) 327 it->second.text_->setCharHeight(it->second.text_->getCharHeight() * yScale); 328 } 329 } 330 331 void HUDNavigation::addObject(RadarViewable* object) 332 { 333 if (showObject(object) == false) 334 return; 335 336 if (this->activeObjectList_.size() >= this->markerLimit_) 337 if (object == NULL) 338 return; 339 340 // Object hasn't been added yet (we know that) 341 assert(this->activeObjectList_.find(object) == this->activeObjectList_.end()); 342 343 // Scales used for dimensions and text size 344 float xScale = this->getActualSize().x; 345 float yScale = this->getActualSize().y; 346 347 // Create everything needed to display the object on the radar and add it to the map 348 349 // Create arrow/marker 350 Ogre::PanelOverlayElement* panel = static_cast<Ogre::PanelOverlayElement*>( Ogre::OverlayManager::getSingleton() 351 .createOverlayElement("Panel", "HUDNavigation_navMarker_" + getUniqueNumberString())); 352 //panel->setMaterialName("Orxonox/NavTDC"); 353 panel->setMaterialName(TextureGenerator::getMaterialName("tdc.png", object->getRadarObjectColour())); 354 panel->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); 355 //panel->setColour(object->getRadarObjectColour()); 356 357 Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton() 358 .createOverlayElement("TextArea", "HUDNavigation_navText_" + getUniqueNumberString())); 359 text->setFontName(this->fontName_); 360 text->setCharHeight(text->getCharHeight() * yScale); 361 text->setColour(object->getRadarObjectColour()); 362 363 panel->hide(); 364 text->hide(); 365 366 ObjectInfo tempStruct = {panel, text, false /*, TODO: initialize wasOutOfView_ */}; 367 this->activeObjectList_[object] = tempStruct; 368 369 this->background_->addChild(panel); 370 this->background_->addChild(text); 371 372 this->sortedObjectList_.push_front(std::make_pair(object, (unsigned int)0)); 373 } 374 375 void HUDNavigation::removeObject(RadarViewable* viewable) 376 { 377 std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.find(viewable); 378 379 if (this->activeObjectList_.find(viewable) != this->activeObjectList_.end()) 380 { 381 // Detach overlays 382 this->background_->removeChild(it->second.panel_->getName()); 383 this->background_->removeChild(it->second.text_->getName()); 384 // Properly destroy the overlay elements (do not use delete!) 385 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.panel_); 386 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second.text_); 387 // Remove from the list 388 this->activeObjectList_.erase(viewable); 389 } 390 391 for (std::list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt) 392 { 393 if ((listIt->first) == viewable) 394 { 395 this->sortedObjectList_.erase(listIt); 396 break; 397 } 398 } 399 } 400 401 void HUDNavigation::objectChanged(RadarViewable* viewable) 402 { 403 // TODO: niceification neccessary ;) 404 removeObject(viewable); 405 addObject(viewable); 406 } 407 408 bool HUDNavigation::showObject(RadarViewable* rv) 409 { 410 if (rv == orxonox_cast<RadarViewable*>(this->getOwner())) 411 return false; 412 assert(rv->getWorldEntity()); 413 if (rv->getWorldEntity()->isVisible() == false || rv->getRadarVisibility() == false) 414 return false; 415 return true; 416 } 417 418 void HUDNavigation::changedOwner() 419 { 420 const std::set<RadarViewable*>& respawnObjects = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 421 for (std::set<RadarViewable*>::const_iterator it = respawnObjects.begin(); it != respawnObjects.end(); ++it) 422 { 423 if (!(*it)->isHumanShip_) 424 this->addObject(*it); 425 } 319 426 } 320 427 } 321 322 323 /** Overridden method of OrxonoxOverlay.324 @details325 Usually the entire overlay scales with scale().326 Here we obviously have to adjust this.327 */328 void HUDNavigation::sizeChanged()329 {330 // Use size to compensate for aspect ratio if enabled.331 float xScale = this->getActualSize().x;332 float yScale = this->getActualSize().y;333 334 for ( ObjectMap::iterator it = activeObjectList_.begin(); it!=activeObjectList_.end(); ++it )335 {336 if ( it->second.panel_ != NULL )337 it->second.panel_->setDimensions ( navMarkerSize_ * xScale, navMarkerSize_ * yScale );338 if ( it->second.text_ != NULL )339 it->second.text_->setCharHeight ( it->second.text_->getCharHeight() * yScale );340 }341 }342 343 void HUDNavigation::addObject ( RadarViewable* object )344 {345 if( showObject(object)==false )346 return;347 348 if ( activeObjectList_.size() >= markerLimit_ )349 if ( object == NULL )350 return;351 352 // Object hasn't been added yet (we know that)353 assert ( this->activeObjectList_.find ( object ) == this->activeObjectList_.end() );354 355 // Scales used for dimensions and text size356 float xScale = this->getActualSize().x;357 float yScale = this->getActualSize().y;358 359 // Create everything needed to display the object on the radar and add it to the map360 361 // Create arrow/marker362 Ogre::PanelOverlayElement* panel = static_cast<Ogre::PanelOverlayElement*> ( Ogre::OverlayManager::getSingleton()363 .createOverlayElement ( "Panel", "HUDNavigation_navMarker_" + getUniqueNumberString() ) );364 // panel->setMaterialName ( "Orxonox/NavTDC" );365 panel->setMaterialName( TextureGenerator::getMaterialName( "tdc.png", object->getRadarObjectColour()) );366 panel->setDimensions ( navMarkerSize_ * xScale, navMarkerSize_ * yScale );367 // panel->setColour( object->getRadarObjectColour() );368 369 Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*> ( Ogre::OverlayManager::getSingleton()370 .createOverlayElement ( "TextArea", "HUDNavigation_navText_" + getUniqueNumberString() ) );371 text->setFontName ( this->fontName_ );372 text->setCharHeight ( text->getCharHeight() * yScale );373 text->setColour( object->getRadarObjectColour() );374 375 panel->hide();376 text->hide();377 378 ObjectInfo tempStruct = {panel, text, false /*, TODO: initialize wasOutOfView_ */};379 activeObjectList_[object] = tempStruct;380 381 this->background_->addChild ( panel );382 this->background_->addChild ( text );383 384 sortedObjectList_.push_front ( std::make_pair ( object, ( unsigned int ) 0 ) );385 386 387 }388 389 void HUDNavigation::removeObject ( RadarViewable* viewable )390 {391 ObjectMap::iterator it = activeObjectList_.find ( viewable );392 393 if ( activeObjectList_.find ( viewable ) != activeObjectList_.end() )394 {395 // Detach overlays396 this->background_->removeChild ( it->second.panel_->getName() );397 this->background_->removeChild ( it->second.text_->getName() );398 // Properly destroy the overlay elements (do not use delete!)399 Ogre::OverlayManager::getSingleton().destroyOverlayElement ( it->second.panel_ );400 Ogre::OverlayManager::getSingleton().destroyOverlayElement ( it->second.text_ );401 // Remove from the list402 activeObjectList_.erase ( viewable );403 404 405 }406 407 for ( sortedList::iterator listIt = sortedObjectList_.begin(); listIt != sortedObjectList_.end(); ++listIt )408 {409 if ( (listIt->first) == viewable )410 {411 sortedObjectList_.erase ( listIt );412 break;413 }414 415 }416 417 }418 419 void HUDNavigation::objectChanged(RadarViewable* viewable)420 {421 // TODO: niceification neccessary ;)422 removeObject(viewable);423 addObject(viewable);424 }425 426 427 bool HUDNavigation::showObject(RadarViewable* rv)428 {429 if ( rv == dynamic_cast<RadarViewable*> ( this->getOwner() ) )430 return false;431 assert( rv->getWorldEntity() );432 if ( rv->getWorldEntity()->isVisible()==false || rv->getRadarVisibility()==false )433 return false;434 return true;435 }436 437 void HUDNavigation::changedOwner()438 {439 440 const std::set<RadarViewable*>& respawnObjects = this->getOwner()->getScene()->getRadar()->getRadarObjects();441 for ( std::set<RadarViewable*>::const_iterator it = respawnObjects.begin(); it != respawnObjects.end(); ++it )442 {443 if ( ! ( *it )->isHumanShip_ )444 this->addObject ( *it );445 }446 }447 448 } -
code/trunk/src/modules/overlays/hud/HUDNavigation.h
r9016 r9348 36 36 #include <string> 37 37 38 39 38 #include "util/OgreForwardRefs.h" 40 39 #include "tools/interfaces/Tickable.h" … … 44 43 namespace orxonox 45 44 { 46 class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener47 {48 public:49 HUDNavigation ( BaseObject* creator);50 virtual ~HUDNavigation();45 class _OverlaysExport HUDNavigation : public OrxonoxOverlay, public Tickable, public RadarListener 46 { 47 public: 48 HUDNavigation(BaseObject* creator); 49 virtual ~HUDNavigation(); 51 50 52 void setConfigValues();51 void setConfigValues(); 53 52 54 virtual void XMLPort ( Element& xmlelement, XMLPort::Mode mode);55 virtual void tick ( float dt);53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 virtual void tick(float dt); 56 55 57 // RadarListener interface58 virtual void addObject ( RadarViewable* object);59 virtual void removeObject ( RadarViewable* viewable);60 virtual void objectChanged ( RadarViewable* viewable);56 // RadarListener interface 57 virtual void addObject(RadarViewable* object); 58 virtual void removeObject(RadarViewable* viewable); 59 virtual void objectChanged(RadarViewable* viewable); 61 60 62 virtual void changedOwner();63 virtual void sizeChanged();64 virtual void angleChanged() { }65 virtual void positionChanged() { }66 virtual void radarTick ( float dt) {}61 virtual void changedOwner(); 62 virtual void sizeChanged(); 63 virtual void angleChanged() { } 64 virtual void positionChanged() { } 65 virtual void radarTick(float dt) {} 67 66 68 inline float getRadarSensitivity() const69 { return 1.0f; }67 inline float getRadarSensitivity() const 68 { return 1.0f; } 70 69 71 unsigned int getMarkerLimit() { return this->markerLimit_; } 70 inline unsigned int getMarkerLimit() const 71 { return this->markerLimit_; } 72 72 73 private: 74 struct ObjectInfo 75 { 76 Ogre::PanelOverlayElement* panel_; 77 Ogre::TextAreaOverlayElement* text_; 78 bool outOfView_; 79 bool wasOutOfView_; 73 private: 74 struct ObjectInfo 75 { 76 Ogre::PanelOverlayElement* panel_; 77 Ogre::TextAreaOverlayElement* text_; 78 bool outOfView_; 79 bool wasOutOfView_; 80 }; 80 81 82 bool showObject(RadarViewable* rv); 83 84 // XMLPort accessors 85 inline void setNavMarkerSize(float size) 86 { 87 navMarkerSize_ = size; 88 this->sizeChanged(); 89 } 90 inline float getNavMarkerSize() const 91 { return navMarkerSize_; } 92 inline void setDetectionLimit(float limit) 93 { this->detectionLimit_ = limit; } 94 inline float getDetectionLimit() const 95 { return this->detectionLimit_; } 96 97 void setTextSize(float size); 98 float getTextSize() const; 99 100 void setFont(const std::string& font); 101 const std::string& getFont() const; 102 103 float getArrowSizeX(int dist) const; 104 float getArrowSizeY(int dist) const; 105 106 std::map<RadarViewable*, ObjectInfo> activeObjectList_; 107 std::list<std::pair<RadarViewable*, unsigned int> > sortedObjectList_; 108 109 float navMarkerSize_; 110 std::string fontName_; 111 float textSize_; 112 bool showDistance_; 113 114 unsigned int markerLimit_; 115 float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value. 81 116 }; 82 83 bool showObject( RadarViewable* rv );84 85 // XMLPort accessors86 void setNavMarkerSize ( float size )87 { navMarkerSize_ = size; this->sizeChanged(); }88 float getNavMarkerSize() const89 { return navMarkerSize_; }90 void setDetectionLimit( float limit )91 { this->detectionLimit_ = limit; }92 float getDetectionLimit() const93 { return this->detectionLimit_; }94 95 void setTextSize ( float size );96 float getTextSize() const;97 98 void setFont ( const std::string& font );99 const std::string& getFont() const;100 101 typedef std::map<RadarViewable*, ObjectInfo > ObjectMap;102 ObjectMap activeObjectList_;103 104 typedef std::list < std::pair<RadarViewable*, unsigned int > > sortedList;105 sortedList sortedObjectList_;106 107 float getArrowSizeX(int dist);108 float getArrowSizeY(int dist);109 110 float navMarkerSize_;111 std::string fontName_;112 float textSize_;113 bool showDistance;114 115 unsigned int markerLimit_;116 float detectionLimit_; //!< Objects that are more far away than detectionLimit_ are not displayed on the HUD. 10000.0f is the default value.117 118 };119 117 } 120 118 -
code/trunk/src/modules/overlays/hud/HUDRadar.cc
r8891 r9348 92 92 void HUDRadar::addObject(RadarViewable* object) 93 93 { 94 if (object == dynamic_cast<RadarViewable*>(this->owner_))94 if (object == orxonox_cast<RadarViewable*>(this->owner_)) 95 95 return; 96 96 if( showObject(object) == false ) //do not show objects that are "invisible" or "radar invisible" … … 189 189 bool HUDRadar::showObject(RadarViewable* rv) 190 190 { 191 if ( rv == dynamic_cast<RadarViewable*> ( this->getOwner() ) )191 if ( rv == orxonox_cast<RadarViewable*> ( this->getOwner() ) ) 192 192 return false; 193 193 assert( rv->getWorldEntity() ); -
code/trunk/src/modules/pickup/CMakeLists.txt
r7163 r9348 1 1 SET_SOURCE_FILES(PICKUP_SRC_FILES 2 2 CollectiblePickup.cc 3 DroppedPickup.cc4 3 Pickup.cc 5 4 PickupCollection.cc 6 PickupCollectionIdentifier.cc7 5 PickupManager.cc 8 6 PickupRepresentation.cc -
code/trunk/src/modules/pickup/CollectiblePickup.cc
r7494 r9348 45 45 Registers the object and initializes variables. 46 46 */ 47 CollectiblePickup::CollectiblePickup() : isInCollection_(false)47 CollectiblePickup::CollectiblePickup() : collection_(NULL) 48 48 { 49 49 RegisterObject(CollectiblePickup); 50 51 this->collection_ = NULL;52 50 } 53 51 … … 58 56 CollectiblePickup::~CollectiblePickup() 59 57 { 60 61 } 62 63 /** 64 @brief 65 Is called by OrxonoxClass::destroy() before the object is actually destroyed. 66 */ 67 void CollectiblePickup::preDestroy(void) 68 { 69 this->Pickupable::preDestroy(); 70 71 // The PickupCollection has to be destroyed as well. 72 if(this->isInCollection()) 73 this->collection_->Pickupable::destroy(); 74 } 75 76 /** 77 @brief 78 Destroys a Pickupable. 79 */ 80 void CollectiblePickup::destroyPickup(void) 81 { 82 if(!this->isInCollection()) // If the CollectiblePickup is not in a PickupCollection the destroyPickup method of Pickupable is called. 83 this->Pickupable::destroyPickup(); 84 else // Else the ColectiblePickup is dropped and disabled, 85 { 86 this->drop(false); 87 if(this->isInCollection() && this->isEnabled()) // It is only disabled if it is enabled and still ina PickupCollection after having been dropped. 88 { 89 this->setDisabled(); 90 this->collection_->pickupDisabled(); 91 } 92 } 93 } 94 95 /** 96 @brief 97 Is called by the PickupCarrier when it is being destroyed. 98 */ 99 void CollectiblePickup::carrierDestroyed(void) 100 { 101 if(!this->isInCollection()) 102 this->Pickupable::destroy(); 103 else // If the CollectiblePickup is part of a PickupCollection it is just dropped instead of destroyed. 104 this->drop(false); 58 if (this->isInCollection()) 59 this->collection_->removePickupable(this); 105 60 } 106 61 … … 131 86 /** 132 87 @brief 133 Adds this CollectiblePickup to the inputPickupCollection.88 Notifies this CollectiblePickup that it was added to a PickupCollection. 134 89 @param collection 135 90 A pointer to the PickupCollection to which the CollectiblePickup should be added. 136 @return137 Returns true if the CollectiblePickup was successfully added to the PickupCollection.138 91 */ 139 bool CollectiblePickup::addToCollection(PickupCollection* collection)92 void CollectiblePickup::wasAddedToCollection(PickupCollection* collection) 140 93 { 141 if(this->isInCollection() || collection == NULL) //If the CollectiblePickup already is in a PickupCollection or if the input pointer is NULL.142 return false;143 144 this->isInCollection_ = true;145 94 this->collection_ = collection; 146 return true;147 95 } 148 96 149 97 /** 150 98 @brief 151 Removes this CollectiblePickup from its PickupCollection. 152 @return 153 Returns true if the CollectiblePickup was succcessfully removed. 99 Notifies this CollectiblePickup that it was removed from its PickupCollection. 154 100 */ 155 bool CollectiblePickup::removeFromCollection(void)101 void CollectiblePickup::wasRemovedFromCollection(void) 156 102 { 157 if(!this->isInCollection()) //If the CollectiblePickup is not in a PickupCollection.158 return false;159 160 this->isInCollection_ = false;161 103 this->collection_ = NULL; 162 return true;163 104 } 164 165 105 } -
code/trunk/src/modules/pickup/CollectiblePickup.h
r7547 r9348 55 55 class _PickupExport CollectiblePickup : public Pickupable 56 56 { 57 friend class PickupCollection; 57 58 58 59 public: … … 68 69 */ 69 70 bool isInCollection(void) const 70 { return this->isInCollection_; } 71 72 bool addToCollection(PickupCollection* collection); //!< Adds this CollectiblePickup to the input PickupCollection. 73 bool removeFromCollection(void); //!< Removes this CollectiblePickup from its PickupCollection. 74 75 void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed. 76 77 protected: 78 virtual void preDestroy(void); //!< Is called by OrxonoxClass::destroy() before the object is actually destroyed. 79 virtual void destroyPickup(void); //!< Destroys a Pickupable. 71 { return this->collection_ != NULL; } 80 72 81 73 private: 82 bool isInCollection_; //!< True if the CollectiblePickup is in a PickupCollection. 74 void wasAddedToCollection(PickupCollection* collection); 75 void wasRemovedFromCollection(void); 76 83 77 PickupCollection* collection_; //!< A pointer to the PickupCollection this CollectiblePickup is in. 84 85 78 }; 86 79 } -
code/trunk/src/modules/pickup/Pickup.cc
r8864 r9348 37 37 #include "util/StringUtils.h" 38 38 39 #include "pickup/PickupIdentifier.h" 40 41 #include "DroppedPickup.h" 39 #include "PickupSpawner.h" 42 40 43 41 namespace orxonox … … 86 84 /** 87 85 @brief 88 Initializes the PickupIdentififer of this Pickup.89 */90 void Pickup::initializeIdentifier(void)91 {92 std::string val1 = this->getActivationType();93 std::string type1 = "activationType";94 this->pickupIdentifier_->addParameter(type1, val1);95 96 std::string val2 = this->getDurationType();97 std::string type2 = "durationType";98 this->pickupIdentifier_->addParameter(type2, val2);99 }100 101 /**102 @brief103 86 Method for creating a Pickup object through XML. 104 87 */ … … 107 90 SUPER(Pickup, XMLPort, xmlelement, mode); 108 91 109 XMLPortParam(Pickup, "activationType", setActivationType, getActivationType, xmlelement, mode); 110 XMLPortParam(Pickup, "durationType", setDurationType, getDurationType, xmlelement, mode); 111 112 this->initializeIdentifier(); 92 XMLPortParam(Pickup, "representation", setRepresentationName, getRepresentationName, xmlelement, mode); 93 XMLPortParam(Pickup, "activationType", setActivationTypeAsString, getActivationTypeAsString, xmlelement, mode); 94 XMLPortParam(Pickup, "durationType", setDurationTypeAsString, getDurationTypeAsString, xmlelement, mode); 113 95 } 114 96 … … 119 101 Returns a string containing the activation type. 120 102 */ 121 const std::string& Pickup::getActivationType (void) const103 const std::string& Pickup::getActivationTypeAsString(void) const 122 104 { 123 switch(this-> activationType_)105 switch(this->getActivationType()) 124 106 { 125 107 case pickupActivationType::immediate: … … 138 120 Returns a string containing the duration type. 139 121 */ 140 const std::string& Pickup::getDurationType (void) const122 const std::string& Pickup::getDurationTypeAsString(void) const 141 123 { 142 switch(this-> durationType_)124 switch(this->getDurationType()) 143 125 { 144 126 case pickupDurationType::once: … … 157 139 The activation type of the Pickup as a string. 158 140 */ 159 void Pickup::setActivationType (const std::string& type)141 void Pickup::setActivationTypeAsString(const std::string& type) 160 142 { 161 143 if(type == Pickup::activationTypeImmediate_s) 162 this-> activationType_ = pickupActivationType::immediate;144 this->setActivationType(pickupActivationType::immediate); 163 145 else if(type == Pickup::activationTypeOnUse_s) 164 this-> activationType_ = pickupActivationType::onUse;146 this->setActivationType(pickupActivationType::onUse); 165 147 else 166 148 orxout(internal_error, context::pickups) << "Invalid activationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; … … 173 155 The duration type of the Pickup as a string. 174 156 */ 175 void Pickup::setDurationType (const std::string& type)157 void Pickup::setDurationTypeAsString(const std::string& type) 176 158 { 177 159 if(type == Pickup::durationTypeOnce_s) 178 this-> durationType_ = pickupDurationType::once;160 this->setDurationType(pickupDurationType::once); 179 161 else if(type == Pickup::durationTypeContinuous_s) 180 this-> durationType_ = pickupDurationType::continuous;162 this->setDurationType(pickupDurationType::continuous); 181 163 else 182 164 orxout(internal_error, context::pickups) << "Invalid durationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; … … 199 181 /** 200 182 @brief 201 Creates a duplicate of the OrxonoxClass.202 @param item203 A reference to the pointer of the item that we're duplicating.204 */205 void Pickup::clone(OrxonoxClass*& item)206 {207 if(item == NULL)208 item = new Pickup(this);209 210 SUPER(Pickup, clone, item);211 212 Pickup* pickup = dynamic_cast<Pickup*>(item);213 pickup->setActivationTypeDirect(this->getActivationTypeDirect());214 pickup->setDurationTypeDirect(this->getDurationTypeDirect());215 216 pickup->initializeIdentifier();217 }218 219 /**220 @brief221 183 Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 222 This method must be implemented by any class directly inheriting from Pickupable. It is most easily done by just creating a new DroppedPickup, e.g.:223 DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position);224 184 @return 225 185 Returns true if a spawner was created, false if not. … … 227 187 bool Pickup::createSpawner(void) 228 188 { 229 newDroppedPickup(this, this, this->getCarrier());189 PickupSpawner::createDroppedPickup(this, this, this->getCarrier()); 230 190 return true; 231 191 } -
code/trunk/src/modules/pickup/Pickup.h
r8108 r9348 105 105 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 106 106 107 virtual const std::string& getRepresentationName() const 108 { return this->representationName_; } 109 107 110 /** 108 111 @brief Get the activation type of the Pickup. 109 112 @return Returns the activation type of the Pickup. 110 113 */ 111 inline pickupActivationType::Value getActivationType Direct(void) const114 inline pickupActivationType::Value getActivationType(void) const 112 115 { return this->activationType_; } 113 116 /** … … 115 118 @return Returns the duration type of the Pickup. 116 119 */ 117 inline pickupDurationType::Value getDurationType Direct(void) const120 inline pickupDurationType::Value getDurationType(void) const 118 121 { return this->durationType_; } 119 122 120 const std::string& getActivationType (void) const; //!< Get the activation type of the Pickup.121 const std::string& getDurationType (void) const; //!< Get the duration type of the Pickup.123 const std::string& getActivationTypeAsString(void) const; //!< Get the activation type of the Pickup. 124 const std::string& getDurationTypeAsString(void) const; //!< Get the duration type of the Pickup. 122 125 123 126 /** … … 126 129 */ 127 130 inline bool isImmediate(void) const 128 { return this->getActivationType Direct() == pickupActivationType::immediate; }131 { return this->getActivationType() == pickupActivationType::immediate; } 129 132 /** 130 133 @brief Get whether the activation type is 'onUse'. … … 132 135 */ 133 136 inline bool isOnUse(void) const 134 { return this->getActivationType Direct() == pickupActivationType::onUse; }137 { return this->getActivationType() == pickupActivationType::onUse; } 135 138 /** 136 139 @brief Get whether the duration type is 'once'. … … 138 141 */ 139 142 inline bool isOnce(void) const 140 { return this->getDurationType Direct() == pickupDurationType::once; }143 { return this->getDurationType() == pickupDurationType::once; } 141 144 /** 142 145 @brief Get whether the duration type is 'continuous'. … … 144 147 */ 145 148 inline bool isContinuous(void) const 146 { return this->getDurationType Direct() == pickupDurationType::continuous; }149 { return this->getDurationType() == pickupDurationType::continuous; } 147 150 148 151 virtual void changedPickedUp(void); //!< Should be called when the pickup has transited from picked up to dropped or the other way around. 149 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the OrxonoxClass.150 152 151 153 protected: 152 v oid initializeIdentifier(void);154 virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 153 155 154 virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 156 /** 157 @brief Sets the representation name which refers to the name of the PickupRepresentation that is used to represent this pickup. 158 */ 159 inline void setRepresentationName(const std::string& name) 160 { this->representationName_ = name; } 155 161 156 162 /** … … 158 164 @param type The activation type of the Pickup. 159 165 */ 160 inline void setActivationType Direct(pickupActivationType::Value type)166 inline void setActivationType(pickupActivationType::Value type) 161 167 { this->activationType_ = type; } 162 168 /** … … 164 170 @param type The duration type of the Pickup. 165 171 */ 166 inline void setDurationType Direct(pickupDurationType::Value type)172 inline void setDurationType(pickupDurationType::Value type) 167 173 { this->durationType_ = type; } 168 174 169 void setActivationType (const std::string& type); //!< Set the activation type of the Pickup.170 void setDurationType (const std::string& type); //!< Set the duration type of the Pickup.175 void setActivationTypeAsString(const std::string& type); //!< Set the activation type of the Pickup. 176 void setDurationTypeAsString(const std::string& type); //!< Set the duration type of the Pickup. 171 177 172 178 private: 173 179 void initialize(void); //!< Initializes the member variables. 174 180 181 std::string representationName_; //!< The name of the associated PickupRepresentation. 175 182 pickupActivationType::Value activationType_; //!< The activation type of the Pickup. 176 183 pickupDurationType::Value durationType_; //!< The duration type of the Pickup. -
code/trunk/src/modules/pickup/PickupCollection.cc
r8305 r9348 38 38 39 39 #include "CollectiblePickup.h" 40 #include "DroppedPickup.h" 41 #include "PickupCollectionIdentifier.h" 40 #include "PickupSpawner.h" 42 41 43 42 #include "PickupCollection.h" … … 54 53 The creator of the object. 55 54 */ 56 PickupCollection::PickupCollection(BaseObject* creator) : BaseObject(creator) , pickupCollectionIdentifier_(NULL)55 PickupCollection::PickupCollection(BaseObject* creator) : BaseObject(creator) 57 56 { 58 57 RegisterObject(PickupCollection); 59 58 60 this->pickupCollectionIdentifier_ = new PickupCollectionIdentifier(this);61 this->usedCounter_ = 0;62 this->pickedUpCounter_ = 0;63 this->disabledCounter_ = 0;64 59 this->processingUsed_ = false; 65 60 this->processingPickedUp_ = false; … … 70 65 Destructor. Iterates through all Pickupables this PickupCollection consists of and destroys them if they haven't been already. 71 66 */ 72 PickupCollection::~ 67 PickupCollection::~PickupCollection() 73 68 { 74 69 // Destroy all Pickupables constructing this PickupCollection. 75 for(std:: vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)76 { 77 (*it)-> removeFromCollection();70 for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it) 71 { 72 (*it)->wasRemovedFromCollection(); 78 73 (*it)->destroy(); 79 74 } 80 75 this->pickups_.clear(); 81 82 if(this->pickupCollectionIdentifier_ != NULL)83 delete this->pickupCollectionIdentifier_;84 76 } 85 77 … … 92 84 SUPER(PickupCollection, XMLPort, xmlelement, mode); 93 85 86 XMLPortParam(PickupCollection, "representation", setRepresentationName, getRepresentationName, xmlelement, mode); 94 87 XMLPortObject(PickupCollection, CollectiblePickup, "pickupables", addPickupable, getPickupable, xmlelement, mode); 95 96 this->initializeIdentifier();97 }98 99 /**100 @brief101 Initializes the PickupIdentifier for this pickup.102 */103 void PickupCollection::initializeIdentifier(void)104 {105 for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)106 {107 this->pickupCollectionIdentifier_->addPickup((*it)->getPickupIdentifier());108 }109 88 } 110 89 … … 120 99 this->processingUsed_ = true; 121 100 // Change used for all Pickupables this PickupCollection consists of. 122 for(std:: vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)101 for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it) 123 102 (*it)->setUsed(this->isUsed()); 124 103 … … 138 117 return; 139 118 119 size_t numPickupsEnabled = 0; 120 size_t numPickupsInUse = 0; 121 for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it) 122 { 123 if ((*it)->isEnabled()) 124 ++numPickupsEnabled; 125 if ((*it)->isUsed()) 126 ++numPickupsInUse; 127 } 128 140 129 // If all the pickups are not in use but the PickupCollection is. 141 if( this->usedCounter_== 0 && this->isUsed())130 if(numPickupsInUse == 0 && this->isUsed()) 142 131 this->setUsed(false); 143 132 144 133 // If all the enabled pickups are in use but the PickupCollection is not. 145 if( this->usedCounter_ != 0 && this->usedCounter_ == this->pickups_.size()-this->disabledCounter_&& !this->isUsed())134 if(numPickupsInUse > 0 && numPickupsInUse == numPickupsEnabled && !this->isUsed()) 146 135 this->setUsed(true); 147 136 } … … 157 146 158 147 // Change the PickupCarrier for all Pickupables this PickupCollection consists of. 159 for(std:: vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)148 for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it) 160 149 { 161 150 if(this->getCarrier() == NULL) … … 177 166 this->processingPickedUp_ = true; 178 167 // Change the pickedUp status for all Pickupables this PickupCollection consists of. 179 for(std:: vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)180 (* it)->setPickedUp(this->isPickedUp());168 for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ) 169 (*(it++))->setPickedUp(this->isPickedUp()); 181 170 182 171 this->processingPickedUp_ = false; … … 195 184 return; 196 185 197 // If at least all the enabled pickups of this PickupCollection are no longer picked up. 198 if(this->pickedUpCounter_ <= this->disabledCounter_ && this->isPickedUp()) 186 // If at least all the enabled pickups of this PickupCollection are no longer picked up. 187 bool isOnePickupEnabledAndPickedUp = false; 188 for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it) 189 { 190 if ((*it)->isEnabled() && (*it)->isPickedUp()) 191 { 192 isOnePickupEnabledAndPickedUp = true; 193 break; 194 } 195 } 196 if(!isOnePickupEnabledAndPickedUp && this->isPickedUp()) 199 197 this->Pickupable::destroy(); 200 201 // If the PickupCollection is no longer picked up.202 if(!this->isPickedUp())203 this->pickedUpCounter_ = 0;204 }205 206 /**207 @brief208 Creates a duplicate of the input Pickupable.209 This method needs to be implemented by any Class inheriting from Pickupable.210 @param item211 A reference to a pointer to the OrxonoxClass that is to be duplicated.212 */213 void PickupCollection::clone(OrxonoxClass*& item)214 {215 if(item == NULL)216 item = new PickupCollection(this);217 218 SUPER(PickupCollection, clone, item);219 220 PickupCollection* pickup = dynamic_cast<PickupCollection*>(item);221 // Clone all Pickupables this PickupCollection consist of.222 for(std::vector<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)223 {224 Pickupable* newPickup = (*it)->clone();225 CollectiblePickup* collectible = static_cast<CollectiblePickup*>(newPickup);226 pickup->addPickupable(collectible);227 }228 229 pickup->initializeIdentifier();230 198 } 231 199 … … 240 208 bool PickupCollection::isTarget(const PickupCarrier* carrier) const 241 209 { 242 for(std:: vector<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); it++)210 for(std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it) 243 211 { 244 212 if(!carrier->isTarget(*it)) … … 247 215 248 216 return true; 249 }250 251 /**252 @brief253 Get the PickupIdentifier of this PickupCollection.254 This is in fact the PickupCollectionIdentifier.255 @return256 Returns a pointer to the PickupIdentifier of this PickupCollection.257 */258 const PickupIdentifier* PickupCollection::getPickupIdentifier(void) const259 {260 return this->pickupCollectionIdentifier_;261 217 } 262 218 … … 274 230 return false; 275 231 276 pickup->addToCollection(this);277 232 this->pickups_.push_back(pickup); 233 pickup->wasAddedToCollection(this); 234 this->pickupsChanged(); 278 235 return true; 279 236 } … … 289 246 const Pickupable* PickupCollection::getPickupable(unsigned int index) const 290 247 { 291 return this->pickups_[index]; 248 if(this->pickups_.size() >= index) 249 return NULL; 250 251 std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); 252 std::advance(it, index); 253 return *it; 254 } 255 256 /** 257 @brief 258 Removes the Pickup from the Collection. 259 @param pickup 260 The Pickup to be removed. 261 @return 262 Returns true if the pickup was in the collection. 263 */ 264 bool PickupCollection::removePickupable(CollectiblePickup* pickup) 265 { 266 for(std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it) 267 { 268 if (*it == pickup) 269 { 270 this->pickups_.erase(it); 271 pickup->wasRemovedFromCollection(); 272 this->pickupsChanged(); 273 return true; 274 } 275 } 276 return false; 292 277 } 293 278 … … 297 282 This is used internally by the CollectiblePickup class. 298 283 @param changed 299 The value the used status has changed to. 284 The value the used status has changed to. 300 285 */ 301 286 void PickupCollection::pickupChangedUsed(bool changed) 302 287 { 303 if(changed)304 this->usedCounter_++;305 else306 this->usedCounter_--;307 308 288 this->changedUsedAction(); 309 289 } … … 318 298 void PickupCollection::pickupChangedPickedUp(bool changed) 319 299 { 320 if(changed)321 this->pickedUpCounter_++;322 else323 this->pickedUpCounter_--;324 325 300 this->changedPickedUpAction(); 326 301 } … … 333 308 void PickupCollection::pickupDisabled(void) 334 309 { 335 this->disabledCounter_++; 310 } 311 312 /** 313 @brief 314 Helpfer function if the number of pickups in this collection has changed. 315 */ 316 void PickupCollection::pickupsChanged(void) 317 { 318 this->changedUsedAction(); 319 this->changedPickedUpAction(); 336 320 } 337 321 … … 339 323 @brief 340 324 Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 341 This method must be implemented by any class directly inheriting from Pickupable. It is most easily done by just creating a new DroppedPickup, e.g.:342 DroppedPickup(BaseObject* creator, Pickupable* pickup, const Vector3& position);343 325 @return 344 326 Returns true if a spawner was created, false if not. … … 346 328 bool PickupCollection::createSpawner(void) 347 329 { 348 newDroppedPickup(this, this, this->getCarrier());330 PickupSpawner::createDroppedPickup(this, this, this->getCarrier()); 349 331 return true; 350 332 } -
code/trunk/src/modules/pickup/PickupCollection.h
r8351 r9348 50 50 The PickupCollection combines different @ref orxonox::Pickupable "Pickupables" (more precisely @ref orxonox::CollectiblePickup "CollectiblePickups") to a coherent, single pickup and makes them seem (from the outside looking in) just as if they were just one @ref orxonox::Pickupable "Pickupable". 51 51 52 To differentiate between different types of @ref orxonox::PickupCollection "PickupCollections" (just as we differentiate between different types of @ref orxonox::Pickupable "Pickupables") we define a new identifyer called the @ref orxonox::PickupCollectionIdentifier "PickupCollectionIdentifier" which has pretty much the same properties as the @ref orxonox::PickupIdentifier "PickupIdentifier" but extende to @ref orxonox::PickupCollection "PickupCollections".53 54 52 A PickupCollection can be created in XML as follows: 55 53 @code … … 81 79 virtual void changedPickedUp(void); //!< Is called when the pickup has transited from picked up to dropped or the other way around. 82 80 83 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input pickup.84 85 81 virtual bool isTarget(const PickupCarrier* carrier) const; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection. 86 82 87 virtual const PickupIdentifier* getPickupIdentifier(void) const; //!< Get the PickupIdentifier of this PickupCollection. 83 inline void setRepresentationName(const std::string& name) 84 { this->representationName_ = name; } 85 virtual const std::string& getRepresentationName() const 86 { return this->representationName_; } 88 87 89 88 bool addPickupable(CollectiblePickup* pickup); //!< Add the input Pickupable to list of Pickupables combined by this PickupCollection. 90 89 const Pickupable* getPickupable(unsigned int index) const; //!< Get the Pickupable at the given index. 90 bool removePickupable(CollectiblePickup* pickup); //!< Removes the input Pickupable from the list of Pickupables in this PickupCollection. 91 92 inline const std::list<CollectiblePickup*>& getPickups() const 93 { return this->pickups_; } 91 94 92 95 void pickupChangedUsed(bool changed); //!< Informs the PickupCollection, that one of its pickups has changed its used status to the input value. … … 95 98 96 99 protected: 97 void initializeIdentifier(void); //!< Initializes the PickupIdentifier for this pickup.98 99 100 virtual bool createSpawner(void); //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 100 101 PickupCollectionIdentifier* pickupCollectionIdentifier_; //!< The PickupCollectionIdentifier of this PickupCollection. Is used to distinguish different PickupCollections amongst themselves.102 101 103 102 private: 104 103 void changedUsedAction(void); //!< Helper method. 105 104 void changedPickedUpAction(void); //!< Helper method. 105 void pickupsChanged(void); //!< Helper method. 106 106 107 std::vector<CollectiblePickup*> pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid. 108 109 unsigned int usedCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are in use. 110 unsigned int pickedUpCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are picked up. 111 unsigned int disabledCounter_; //!< Keeps track of the number of pickups of this PickupCollection, that are disabled. 107 std::string representationName_; //!< The name of the associated PickupRepresentation. 108 std::list<CollectiblePickup*> pickups_; //!< The list of the pointers of all the Pickupables this PickupCollection consists of. They are weak pointers to facilitate testing, whether the pointers are still valid. 112 109 113 110 bool processingUsed_; //!< Boolean to ensure, that the PickupCollection doesn't update its used status while its internal state is inconsistent. -
code/trunk/src/modules/pickup/PickupManager.cc
r8858 r9348 87 87 88 88 this->representations_.clear(); 89 this->representationsNetworked_.clear();90 89 91 90 // Destroying all the PickupInventoryContainers that are still there. … … 106 105 /** 107 106 @brief 108 Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents, on the server (or in standalone mode). 109 For every type of Pickupable (uniquely identified by a PickupIdentifier) there can be one (and just one) PickupRepresentation registered. 110 @param identifier 111 The PickupIdentifier identifying the Pickupable. 107 Registers a PickupRepresentation. 108 @param name 109 The representation's name. 112 110 @param representation 113 111 A pointer to the PickupRepresentation. … … 115 113 Returns true if successful and false if not. 116 114 */ 117 bool PickupManager::registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation) 118 { 119 assert(identifier); 115 bool PickupManager::registerRepresentation(const std::string& name, PickupRepresentation* representation) 116 { 120 117 assert(representation); 121 118 122 119 // If the list is not empty and Pickupable already has a Representation registered. 123 if(!this->representations_.empty() && this->representations_.find( identifier) != this->representations_.end())120 if(!this->representations_.empty() && this->representations_.find(name) != this->representations_.end()) 124 121 return false; 125 122 126 this->representations_[ identifier] = representation;123 this->representations_[name] = representation; 127 124 128 125 orxout(verbose, context::pickups) << "PickupRepresentation &" << representation << " registered with the PickupManager." << endl; … … 132 129 /** 133 130 @brief 134 Unegisters a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents, on the server (or in standalone mode). 135 @param identifier 136 The PickupIdentifier identifying the Pickupable. 137 @param representation 138 A pointer to the PickupRepresentation. 131 Unegisters a PickupRepresentation. 132 @param name 133 The representation's name. 139 134 @return 140 135 Returns true if successful and false if not. 141 136 */ 142 bool PickupManager::unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation) 143 { 144 assert(identifier); 145 assert(representation); 146 147 std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare>::iterator it = this->representations_.find(identifier); 137 bool PickupManager::unregisterRepresentation(const std::string& name) 138 { 139 std::map<std::string, PickupRepresentation*>::iterator it = this->representations_.find(name); 148 140 if(it == this->representations_.end()) // If the Pickupable is not registered in the first place. 149 141 return false; … … 151 143 this->representations_.erase(it); 152 144 153 orxout(verbose, context::pickups) << "PickupRepresentation &" << representation<< " unregistered with the PickupManager." << endl;145 orxout(verbose, context::pickups) << "PickupRepresentation &" << name << " unregistered with the PickupManager." << endl; 154 146 return true; 155 147 } … … 157 149 /** 158 150 @brief 159 Registers a PickupRepresentation on the host it was created. 160 @param representation 161 A pointer to the PickupRepresentation. 162 @return 163 Returns true if successful, false if not. 164 */ 165 bool PickupManager::registerRepresentation(PickupRepresentation* representation) 166 { 167 assert(representation); 168 169 // If the list is not empty and PickupRepresentation is already registered. 170 if(!this->representationsNetworked_.empty() && this->representationsNetworked_.find(representation->getObjectID()) != this->representationsNetworked_.end()) 171 return false; 172 173 this->representationsNetworked_[representation->getObjectID()] = representation; 174 return true; 175 } 176 177 /** 178 @brief 179 Unregisters a PickupRepresentation on the host it is being destroyed (which is the same host on which it was created). 180 @param representation 181 A pointer to the Pickuprepresentation. 182 @return 183 Returns true if successful, false if not. 184 */ 185 bool PickupManager::unregisterRepresentation(PickupRepresentation* representation) 186 { 187 assert(representation); 188 189 std::map<uint32_t, PickupRepresentation*>::iterator it = this->representationsNetworked_.find(representation->getObjectID()); 190 if(it == this->representationsNetworked_.end()) // If the Pickupable is not registered in the first place. 191 return false; 192 193 this->representationsNetworked_.erase(it); 194 return true; 195 } 196 197 /** 198 @brief 199 Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier. 200 @param identifier 201 The PickupIdentifier. 151 Get the PickupRepresentation with the given name. 152 @param name 153 The name of the PickupRepresentation. 202 154 @return 203 155 Returns a pointer to the PickupRepresentation. 204 156 */ 205 PickupRepresentation* PickupManager::getRepresentation(const PickupIdentifier* identifier)206 { 207 std::map< const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare>::iterator it = this->representations_.find(identifier);208 if(it == this->representations_.end()) // If there is no PickupRepresentation associated with the input PickupIdentifier.157 PickupRepresentation* PickupManager::getRepresentation(const std::string& name) 158 { 159 std::map<std::string, PickupRepresentation*>::iterator it = this->representations_.find(name); 160 if(it == this->representations_.end()) // If there is no PickupRepresentation associated with the input name. 209 161 { 210 162 orxout(verbose, context::pickups) << "PickupManager::getRepresentation() returned default representation." << endl; … … 353 305 { 354 306 // If there is no PickupRepresentation registered the default representation is used. 355 if(this->representations_.find(pickup->get PickupIdentifier()) == this->representations_.end())356 PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pick edUp);307 if(this->representations_.find(pickup->getRepresentationName()) == this->representations_.end()) 308 PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickup->getRepresentationName(), pickedUp); 357 309 else 358 PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->representations_[pickup->get PickupIdentifier()]->getObjectID(), pickedUp);310 PickupManager::pickupChangedPickedUpNetwork(index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickup->getRepresentationName(), pickedUp); 359 311 } 360 312 // If the concerned host is somewhere in the network, we call pickupChangedPickedUpNetwork() on its PickupManager. … … 362 314 { 363 315 // If there is no PickupRepresentation registered the default representation is used. 364 if(this->representations_.find(pickup->get PickupIdentifier()) == this->representations_.end())316 if(this->representations_.find(pickup->getRepresentationName()) == this->representations_.end()) 365 317 { 366 318 callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->defaultRepresentation_->getObjectID(), pickedUp); … … 368 320 else 369 321 { 370 callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->get PickupIdentifier()]->getObjectID(), pickedUp);322 callStaticNetworkFunction(PickupManager::pickupChangedPickedUpNetwork, clientId, index, pickup->isUsable(), this->representations_[pickup->getRepresentationName()]->getObjectID(), pickedUp); 371 323 } 372 324 } … … 388 340 The pickedUp status the Pickupable changed to. 389 341 */ 390 /*static*/ void PickupManager::pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, bool pickedUp)342 /*static*/ void PickupManager::pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, const std::string& representationName, bool pickedUp) 391 343 { 392 344 PickupManager& manager = PickupManager::getInstance(); // Get the PickupManager singleton on this host. … … 402 354 container->unusable = false; 403 355 container->representationObjectId = representationObjectId; 356 container->representationName = representationName; 404 357 // Insert the container into the pickupInventoryContainers_ list. 405 358 manager.pickupInventoryContainers_.insert(std::pair<uint32_t, PickupInventoryContainer*>(pickup, container)); … … 417 370 manager.updateGUI(); // Tell the PickupInventory that something has changed. 418 371 } 419 }420 421 /**422 @brief423 Get the PickupRepresentation of an input Pickupable.424 This method spares us the hassle to export the PickupIdentifier class to lua.425 @param pickup426 The number identifying the Pickupable whose PickupRepresentation should be returned.427 @return428 Returns the PickupRepresentation of the input Pickupable or NULL if an error occurred.429 */430 orxonox::PickupRepresentation* PickupManager::getPickupRepresentation(uint32_t pickup)431 {432 // Clear and rebuild the representationsNetworked_ list.433 //TODO: Better solution?434 this->representationsNetworked_.clear();435 for(ObjectList<PickupRepresentation>::iterator it = ObjectList<PickupRepresentation>::begin(); it != ObjectList<PickupRepresentation>::end(); ++it)436 this->representationsNetworked_[it->getObjectID()] = *it;437 438 // Get the container belonging to the input pickup, if not found return the default representation.439 std::map<uint32_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.find(pickup);440 if(it == this->pickupInventoryContainers_.end())441 return this->defaultRepresentation_;442 443 // Get the PickupRepresentation of the input pickup (through the objecId of the representation stored in the PickupInventoryContainer belonging to the pickup), if not found return the default representation.444 std::map<uint32_t, PickupRepresentation*>::iterator it2 = this->representationsNetworked_.find(it->second->representationObjectId);445 if(it2 == this->representationsNetworked_.end())446 return this->defaultRepresentation_;447 448 return it2->second;449 372 } 450 373 -
code/trunk/src/modules/pickup/PickupManager.h
r8706 r9348 41 41 #include "core/WeakPtr.h" 42 42 43 #include "pickup/PickupIdentifier.h"44 45 43 #include "PickupRepresentation.h" 46 44 … … 67 65 bool unusable; //!< Whether the @ref orxonox::Pickupable "Pickupable" is droppable. 68 66 uint32_t representationObjectId; //!< The objectId of the @ref orxonox::PickupRepresentation "PickupRepresentation" that represents the @ref orxonox::Pickupable "Pickupable". 67 std::string representationName; //!< The name of the associated PickupRepresentation 69 68 }; 70 69 // tolua_end … … 74 73 The PickupManager class manages @ref orxonox::Pickupable "Pickupables". 75 74 76 It has in essence two tasks to fulfill. Firstly it must link @ref orxonox::Pickupable "Pickupables" (through their @ref orxonox::PickupIdentifier "PickupIdentifiers") to theirrespective @ref orxonox::PickupRepresentation "PickupRepresentations". Secondly it manages the PickupInventory. (The PickupInventory is the GUI that displays @ref orxonox::Pickupable "Pickupables" for the covenience of the user.)75 It has in essence two tasks to fulfill. Firstly it must link @ref orxonox::Pickupable "Pickupables" (through their representation-name attribute) to the respective @ref orxonox::PickupRepresentation "PickupRepresentations". Secondly it manages the PickupInventory. (The PickupInventory is the GUI that displays @ref orxonox::Pickupable "Pickupables" for the covenience of the user.) 77 76 78 77 @section PickupManagerTechnicalDetails Technical details … … 86 85 87 86 Firstly there are a number of lists (where by list I really mean any kind of ordered data structure) kept. 88 - The @ref orxonox::PickupManager::representations_ "representations_" list links @ref orxonox::PickupRepresentation "PickupRepresentations" with @ref orxonox::PickupIdentifier "PickupIdentifiers" and can be used to get the @ref orxonox::PickupRepresentation "PickupRepresentation" for a given @ref orxonox::Pickupable "Pickupable". It is only populated on the server (or in standalone mode). Each @ref orxonox::PickupRepresentation "PickupRepresentation" that is generated through XML registers itself with the PickupManager and is thereby added to the list. 89 - The @ref orxonox::PickupManager::representationsNetworked_ "representationsNetworked_" list is the networked (hence the name) equivalent to the @ref orxonox::PickupManager::representations_ "representations_" list. It links an objectId of a @ref orxonox::PickupRepresentation "PickupRepresentation" to a @ref orxonox::PickupRepresentation "PickupRepresentation". This list is maintained on all hosts, each representation registers itself (in its constructor) with the PickupManager. Since the representations are synchronised they are created on each host. The "same" instance on each host is identified by the same objectId and that is why we store the representations with the objectId as key. We can then use this list to get a @ref orxonox::PickupRepresentation "PickupRepresentation" for a specific @ref orxonox::Pickupable "Pickupable" (or more precisely a number identifiying that particular pickup, but we'll see that, when we look at the next list) on a client to be used in the PickupInventory. 87 - The @ref orxonox::PickupManager::representations_ "representations_" list links @ref orxonox::PickupRepresentation "PickupRepresentations" with its name and can be used to get the @ref orxonox::PickupRepresentation "PickupRepresentation" for a given @ref orxonox::Pickupable "Pickupable". It is only populated on the server (or in standalone mode). Each @ref orxonox::PickupRepresentation "PickupRepresentation" that is generated through XML registers itself with the PickupManager and is thereby added to the list. 90 88 - The @ref orxonox::PickupManager::pickupInventoryContainers_ "pickupInventoryContainers_" list links a number identifying a @ref orxonox::Pickupable "Pickupable" to a data structure (the @ref orxonox::PickupInventoryContainer "PickupInventoryContainer"), which contains all necessary information about that @ref orxonox::Pickupable "Pickupable". This list is maintained on all hosts, a new container is inserted when a @ref orxonox::Pickupable "Pickupable" is picked up, but only if it has been picked up by the repsective host. This list is then used by the PickupInventory to access the required information and to get the correct @ref orxonox::PickupRepresentation "PickupRepresentation". 91 89 - The @ref orxonox::PickupManager::pickups_ "pickups_" list links a number identifiying a @ref orxonox::Pickupable "Pickupable" to a (weak pointer to a) @ref orxonox::Pickupable "Pickupable". It is only maintained by the server (or in standalone mode), to be able to use, unuse and drop @ref orxonox::Pickupable "Pickupables" through the PickupInventory. Since @ref orxonox::Pickupable "Pickupables" only exist on the server a client that wants to change a pickups status has so send a request over the network (with the number identifying the pickup) to the server and then the server facilitates the change, using this list to map from the identifyer to the actual @ref orxonox::Pickupable "Pickupable". … … 114 112 static PickupManager& getInstance() { return Singleton<PickupManager>::getInstance(); } // tolua_export 115 113 116 bool registerRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Registers a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.117 bool unregisterRepresentation(const PickupIdentifier* identifier, PickupRepresentation* representation); //!< Unegisters a PickupRepresentation together with the PickupIdentifier of the Pickupable the PickupRepresentation represents.114 bool registerRepresentation(const std::string& name, PickupRepresentation* representation); 115 bool unregisterRepresentation(const std::string& name); 118 116 119 bool registerRepresentation(PickupRepresentation* representation); //!< Registers a PickupRepresentation on the host it was created. 120 bool unregisterRepresentation(PickupRepresentation* representation); //!< Unregisters a PickupRepresentation on the host it is being destroyed. 121 122 PickupRepresentation* getRepresentation(const PickupIdentifier* identifier); //!< Get the PickupRepresentation representing the Pickupable with the input PickupIdentifier. 117 PickupRepresentation* getRepresentation(const std::string& name); // tolua_export 123 118 124 119 virtual void pickupChangedUsed(Pickupable* pickup, bool used); //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input used state. 125 120 static void pickupChangedUsedNetwork(uint32_t pickup, bool inUse, bool usable, bool unusable); //!< Helper method to react to the change in the used status of a Pickupable. 126 121 virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp); //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input pickedUp state. 127 static void pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, bool pickedUp); //!< Helper method to react to the change in the pickedUp status of a Pickupable.122 static void pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, const std::string& representationName, bool pickedUp); //!< Helper method to react to the change in the pickedUp status of a Pickupable. 128 123 129 124 // Methods to be used by the PickupInventory. 130 125 public: 131 126 // tolua_begin 132 orxonox::PickupRepresentation* getPickupRepresentation(uint32_t pickup); //!< Get the PickupRepresentation of an input indentifier for Pickupable.133 134 127 int getNumPickups(void); //!< Get the number of pickups currently picked up by the player. 135 128 /** … … 163 156 PickupRepresentation* defaultRepresentation_; //!< The default PickupRepresentation. 164 157 165 std::map<const PickupIdentifier*, PickupRepresentation*, PickupIdentifierCompare> representations_; //!< Map linking PickupIdentifiers (representing types of Pickupables) and PickupRepresentations. 166 std::map<uint32_t, PickupRepresentation*> representationsNetworked_; //!< Map linking the PickupRepresentation's objectId to the PickupRepresentation itself. It is used for networking purposes. 158 std::map<std::string, PickupRepresentation*> representations_; //!< Map linking PickupRepresentations and their names. 167 159 168 160 std::map<uint32_t, PickupInventoryContainer*> pickupInventoryContainers_; //!< Map linking a number identifying a Pickupable to a PickupInventoryContainer, which contains all necessary information about that Pickupable. -
code/trunk/src/modules/pickup/PickupPrereqs.h
r8706 r9348 70 70 71 71 class CollectiblePickup; 72 class DroppedPickup;73 72 class Pickup; 74 73 class PickupCollection; 75 class PickupCollectionIdentifier;76 74 class PickupManager; 77 75 class PickupRepresentation; … … 86 84 class ShieldPickup; 87 85 class ShrinkPickup; 88 86 class DamageBoostPickup; 89 87 } 90 88 -
code/trunk/src/modules/pickup/PickupRepresentation.cc
r8858 r9348 52 52 This is primarily for use of the PickupManager in creating a default PickupRepresentation. 53 53 */ 54 PickupRepresentation::PickupRepresentation() : BaseObject(NULL), Synchronisable(NULL), spawnerRepresentation_(NULL) , pickup_(NULL)54 PickupRepresentation::PickupRepresentation() : BaseObject(NULL), Synchronisable(NULL), spawnerRepresentation_(NULL) 55 55 { 56 56 RegisterObject(PickupRepresentation); … … 64 64 Default Constructor. Registers the object and initializes its member variables. 65 65 */ 66 PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), spawnerRepresentation_(NULL) , pickup_(NULL)66 PickupRepresentation::PickupRepresentation(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), spawnerRepresentation_(NULL) 67 67 { 68 68 RegisterObject(PickupRepresentation); … … 70 70 this->initialize(); 71 71 this->registerVariables(); 72 73 PickupManager::getInstance().registerRepresentation(this); // Registers the PickupRepresentation with the PickupManager.74 72 } 75 73 … … 84 82 85 83 if(this->isInitialized()) 86 { 87 if(GameMode::isMaster() && this->pickup_ != NULL) 88 { 89 PickupManager::getInstance().unregisterRepresentation(this->pickup_->getPickupIdentifier(), this); 90 } 91 PickupManager::getInstance().unregisterRepresentation(this); 92 } 84 PickupManager::getInstance().unregisterRepresentation(this->getName()); 93 85 } 94 86 … … 128 120 XMLPortParam(PickupRepresentation, "spawnerTemplate", setSpawnerTemplate, getSpawnerTemplate, xmlelement, mode); 129 121 XMLPortParam(PickupRepresentation, "inventoryRepresentation", setInventoryRepresentation, getInventoryRepresentation, xmlelement, mode); 130 XMLPortObject(PickupRepresentation, Pickupable, "pickup", setPickup, getPickup, xmlelement, mode);131 122 XMLPortObject(PickupRepresentation, StaticEntity, "spawner-representation", setSpawnerRepresentation, getSpawnerRepresentationIndex, xmlelement, mode); 132 133 if(GameMode::isMaster())134 {135 // Registers the PickupRepresentation with the PickupManager through the PickupIdentifier of the Pickupable it represents.136 PickupManager::getInstance().registerRepresentation(this->pickup_->getPickupIdentifier(), this);137 }138 139 if(this->spawnerRepresentation_ != NULL)140 this->spawnerRepresentation_->setVisible(false);141 123 142 124 orxout(verbose, context::pickups) << "PickupRepresentation created: name: '" << this->name_ << "', description: '" << this->description_ << "', spawnerTemplate: '" << this->spawnerTemplate_ << "'." << endl; … … 151 133 Returns a pointer to the StaticEntity. 152 134 */ 153 StaticEntity* PickupRepresentation:: getSpawnerRepresentation(PickupSpawner* spawner)135 StaticEntity* PickupRepresentation::createSpawnerRepresentation(PickupSpawner* spawner) 154 136 { 155 137 if(this->spawnerRepresentation_ == NULL) … … 158 140 if(this->spawnerTemplate_ == "") 159 141 { 160 orxout( verbose, context::pickups) << "PickupRepresentation: Spawner template is empty." << endl;142 orxout(internal_warning, context::pickups) << "PickupRepresentation: Spawner template is empty." << endl; 161 143 // If neither spawnerRepresentation nor spawnerTemplate was specified 162 144 return this->getDefaultSpawnerRepresentation(spawner); … … 165 147 } 166 148 167 StaticEntity* representation = this->spawnerRepresentation_; 168 representation->setVisible(true); 149 this->spawnerRepresentation_->setVisible(true); 150 StaticEntity* temp = this->spawnerRepresentation_; 151 this->spawnerRepresentation_ = NULL; 169 152 170 this->addTemplate(this->spawnerTemplate_);171 this->spawnerRepresentation_->setVisible(false);153 return temp; 154 } 172 155 173 return representation; 156 void PickupRepresentation::changedName() 157 { 158 // Registers the PickupRepresentation with the PickupManager. 159 PickupManager::getInstance().unregisterRepresentation(this->getOldName()); 160 PickupManager::getInstance().registerRepresentation(this->getName(), this); 161 } 162 163 void PickupRepresentation::setSpawnerRepresentation(StaticEntity* representation) 164 { 165 this->spawnerRepresentation_ = representation; 166 if(this->spawnerRepresentation_ != NULL) 167 this->spawnerRepresentation_->setVisible(false); 174 168 } 175 169 -
code/trunk/src/modules/pickup/PickupRepresentation.h
r7547 r9348 41 41 42 42 #include "interfaces/Pickupable.h" 43 #include "pickup/PickupIdentifier.h"44 43 #include "worldentities/StaticEntity.h" 45 44 … … 54 53 /** 55 54 @brief 56 The PickupRepresentation class represents a specific pickup type (identified by its @ref orxonox::PickupIdentifier "PickupIdentifier"). It defines the information displayed in the GUI (PickupInventory) and how @ref orxonox::PickupSpawner "PickupSpawners" that spawn the pickup type look like.55 The PickupRepresentation class represents a specific pickup type. It defines the information displayed in the GUI (PickupInventory) and how @ref orxonox::PickupSpawner "PickupSpawners" that spawn the pickup type look like. 57 56 They are created through XML and are registered with the @ref orxonox::PickupManager "PickupManager". 58 57 … … 64 63 spawnerTemplate = "awesomePickupRepresentation" 65 64 inventoryRepresentation = "AwesomePickup" 66 > 67 <pickup> 68 <SomePickup /> 69 </pickup> 70 </PickupRepresentation> 65 /> 71 66 @endcode 72 67 As you might have noticed, there is a parameter called <em>spawnerTemplate</em> and also another parameter called <em>inventoryRepresentation</em>. Let's first explain the second one, <em>inventoryRepresentation</em>. … … 133 128 */ 134 129 inline const std::string& getInventoryRepresentation(void) const { return this->inventoryRepresentation_; } // tolua_export 135 /**136 @brief Get the Pickupable represented by this PickupRepresentation.137 @param index The index.138 @return Returns (for index = 0) a pointer to the Pickupable. For index > 0 it returns NULL.139 */140 inline const Pickupable* getPickup(unsigned int index) const141 { if(index == 0) return this->pickup_; return NULL; }142 130 143 StaticEntity* getSpawnerRepresentation(PickupSpawner* spawner); //!< Get a spawnerRepresentation for a specific PickupSpawner. 131 virtual void changedName(); 132 133 StaticEntity* createSpawnerRepresentation(PickupSpawner* spawner); //!< Create a spawnerRepresentation for a specific PickupSpawner. 144 134 145 135 protected: … … 168 158 @param representation A pointer to the StaticEntity that is the spawnerRepresentation of this PickupRepresentation. 169 159 */ 170 inline void setSpawnerRepresentation(StaticEntity* representation)171 { this->spawnerRepresentation_ = representation; } 160 void setSpawnerRepresentation(StaticEntity* representation); 161 172 162 /** 173 163 @brief Set the image representing the pickup in the PickupInventory. … … 176 166 inline void setInventoryRepresentation(const std::string& image) 177 167 { this->inventoryRepresentation_ = image; } 178 /**179 @brief Set the Pickupable that is represented by this PickupRepresentation.180 @param pickup A pointer to the Pickupable.181 */182 inline void setPickup(Pickupable* pickup)183 { this->pickup_ = pickup; }184 168 185 169 private: … … 195 179 std::string inventoryRepresentation_; //!< The name of an image representing the pickup in the PickupInventory. 196 180 197 Pickupable* pickup_; //!< The Pickupable that is represented by this PickupRepresentation.198 199 181 }; // tolua_export 200 182 -
code/trunk/src/modules/pickup/PickupSpawner.cc
r8891 r9348 55 55 Pointer to the object which created this item. 56 56 */ 57 PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator), pickup_(NULL) 57 PickupSpawner::PickupSpawner(BaseObject* creator) : StaticEntity(creator), pickup_(NULL), representation_(NULL), pickupTemplate_(NULL) 58 58 { 59 59 RegisterObject(PickupSpawner); 60 60 61 61 this->initialize(); 62 }63 64 /**65 @brief66 Constructor, Creates a fully functional PickupSpawner.67 @param creator68 The creator of this PickupSpawner.69 @param pickup70 The Pickupable to be spawned by this PickupSpawner.71 @param triggerDistance72 The distance at which the PickupSpawner will trigger.73 @param respawnTime74 The minimum time between two spawns.75 @param maxSpawnedItems76 The maximum number of items spawned by this PickupSpawner.77 */78 PickupSpawner::PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems) : StaticEntity(creator), pickup_(NULL)79 {80 RegisterObject(PickupSpawner);81 82 this->initialize();83 84 this->pickup_ = pickup;85 86 this->triggerDistance_ = triggerDistance;87 this->respawnTime_ = respawnTime;88 this->setMaxSpawnedItems(maxSpawnedItems);89 90 if(this->pickup_ == NULL)91 {92 orxout(internal_warning, context::pickups) << "A PickupSpawner was created without a valid Pickupable. This won't work." << endl;93 this->setActive(false);94 }95 else96 {97 PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());98 this->attach(representation->getSpawnerRepresentation(this));99 this->setActive(true);100 }101 62 } 102 63 … … 112 73 this->spawnsRemaining_ = INF; 113 74 this->selfDestruct_ = false; 75 76 this->setPickupable(NULL); 114 77 } 115 78 … … 122 85 if(this->isInitialized() && this->selfDestruct_ && this->pickup_ != NULL) 123 86 this->pickup_->destroy(); 87 } 88 89 /** 90 @brief 91 Factory method, Creates a fully functional PickupSpawner. 92 @param creator 93 The creator of this PickupSpawner. 94 @param pickup 95 The Pickupable to be spawned by this PickupSpawner. 96 @param carrier 97 The PickupCarrier that carried the input pickup before it was dropped. 98 @param triggerDistance 99 The distance at which the PickupSpawner will trigger. 100 */ 101 /*static*/ PickupSpawner* PickupSpawner::createDroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance) 102 { 103 PickupSpawner* spawner = new PickupSpawner(creator); 104 105 spawner->setPickupable(pickup); 106 spawner->setTriggerDistance(triggerDistance); 107 spawner->setMaxSpawnedItems(1); 108 109 spawner->setPosition(carrier->getCarrierPosition()); 110 spawner->block(carrier); 111 112 return spawner; 124 113 } 125 114 … … 136 125 SUPER(PickupSpawner, XMLPort, xmlelement, mode); 137 126 138 XMLPortObject(PickupSpawner, Pickupable, "pickup", setPickupable, getPickupable, xmlelement, mode); 139 127 XMLPortParam(PickupSpawner, "pickup", setPickupTemplateName, getPickupTemplateName, xmlelement, mode); 140 128 XMLPortParam(PickupSpawner, "triggerDistance", setTriggerDistance, getTriggerDistance, xmlelement, mode); 141 129 XMLPortParam(PickupSpawner, "respawnTime", setRespawnTime, getRespawnTime, xmlelement, mode); 142 130 XMLPortParam(PickupSpawner, "maxSpawnedItems", setMaxSpawnedItems, getMaxSpawnedItems, xmlelement, mode); 143 144 if(this->pickup_ == NULL)145 {146 orxout(internal_warning, context::pickups) << "A PickupSpawner was created without a valid Pickupable. This won't work." << endl;147 this->setActive(false);148 }149 else150 {151 PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(this->pickup_->getPickupIdentifier());152 this->attach(representation->getSpawnerRepresentation(this));153 this->setActive(true);154 }155 }156 157 /**158 @brief159 Invoked when the activity has changed. Sets visibility of attached objects.160 */161 void PickupSpawner::changedActivity()162 {163 SUPER(PickupSpawner, changedActivity);164 165 if(GameMode::isMaster())166 this->setVisible(this->isActive());167 131 } 168 132 … … 199 163 200 164 Vector3 distance = it->getWorldPosition() - this->getWorldPosition(); 201 PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(*it);165 PickupCarrier* carrier = static_cast<PickupCarrier*>(*it); 202 166 // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked. 203 167 if(distance.length() < this->triggerDistance_ && carrier != NULL && this->blocked_.find(carrier) == this->blocked_.end()) … … 212 176 /** 213 177 @brief 178 Trigger the PickupSpawner. 179 Adds the pickup to the Pawn that triggered, sets the timer to re-activate and deactives the PickupSpawner. 180 @param carrier 181 Carrier which triggered the PickupSpawner. 182 */ 183 void PickupSpawner::trigger(PickupCarrier* carrier) 184 { 185 orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered and active." << endl; 186 187 PickupCarrier* target = carrier->getTarget(this->pickup_); 188 189 this->block(carrier); 190 191 assert(target); 192 bool pickedUp = this->pickup_->pickup(target); 193 assert(pickedUp); 194 pickedUp = false; // To avoid compiler warning. 195 196 this->setPickupable(NULL); 197 this->decrementSpawnsRemaining(); 198 } 199 200 void PickupSpawner::setPickupTemplateName(const std::string& name) 201 { 202 Template* temp = Template::getTemplate(name); 203 if (temp) 204 this->setPickupTemplate(temp); 205 } 206 207 void PickupSpawner::setPickupTemplate(Template* temp) 208 { 209 this->pickupTemplate_ = temp; 210 this->pickupTemplateName_ = temp->getName(); 211 212 this->setPickupable(this->createPickup()); 213 } 214 215 /** 216 @brief 214 217 Sets the maximum number of spawned items. 215 218 @param items … … 233 236 this->spawnsRemaining_--; 234 237 238 this->setActive(false); 239 235 240 if(this->spawnsRemaining_ != 0 && this->respawnTime_ > 0) 236 241 { 237 242 this->startRespawnTimer(); 238 239 this->setActive(false);240 243 this->fireEvent(); 241 244 } … … 243 246 { 244 247 orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") empty, selfdestruct initialized." << endl; 245 this->setActive(false);246 248 this->destroy(); 247 249 } … … 255 257 { 256 258 this->respawnTimer_.setTimer(this->respawnTime_, false, createExecutor(createFunctor(&PickupSpawner::respawnTimerCallback, this))); 259 } 260 261 /** 262 @brief 263 Invoked by the timer, re-activates the PickupSpawner. 264 */ 265 void PickupSpawner::respawnTimerCallback() 266 { 267 orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") reactivated." << endl; 268 269 this->setPickupable(this->createPickup()); 270 } 271 272 /** 273 @brief 274 Creates a new Pickupable. 275 @return 276 The Pickupable created. 277 */ 278 Pickupable* PickupSpawner::createPickup(void) 279 { 280 if(this->spawnsRemaining_ == 0) 281 { 282 orxout(internal_error, context::pickups) << "Massive Error: PickupSpawner still alive until having spawned last item." << endl; 283 return NULL; 284 } 285 286 if (this->pickupTemplate_ != NULL) 287 { 288 Identifier* identifier = this->pickupTemplate_->getBaseclassIdentifier(); 289 if (identifier != NULL) 290 { 291 Pickupable* pickup = orxonox_cast<Pickupable*>(identifier->fabricate(this)); 292 orxonox_cast<BaseObject*>(pickup)->addTemplate(this->pickupTemplate_); 293 return pickup; 294 } 295 else 296 orxout(internal_error, context::pickups) << "No base class defined in pickup-template " << this->pickupTemplateName_ << endl; 297 } 298 299 return NULL; 257 300 } 258 301 … … 265 308 void PickupSpawner::setPickupable(Pickupable* pickup) 266 309 { 267 if(this->pickup_ != NULL) 268 { 269 orxout(internal_error, context::pickups) << "In PickupSpawner (&" << this << "): setPickupable called, with this->pickup_ already set." << endl; 270 return; 271 } 272 if(pickup == NULL) 273 { 274 orxout(internal_error, context::pickups) << "In PickupSpawner (&" << this << "): Argument of setPickupable is NULL." << endl; 275 return; 310 if (this->representation_ != NULL) 311 { 312 this->representation_->destroy(); 313 this->representation_ = NULL; 314 } 315 316 if (pickup != NULL) 317 { 318 if (this->pickup_ != NULL) 319 this->pickup_->destroy(); 320 321 PickupRepresentation* representation = PickupManager::getInstance().getRepresentation(pickup->getRepresentationName()); 322 this->representation_ = representation->createSpawnerRepresentation(this); 323 this->attach(this->representation_); 324 this->setActive(true); 325 } 326 else 327 { 328 this->setActive(false); 276 329 } 277 330 278 331 this->pickup_ = pickup; 279 332 } 280 281 /**282 @brief283 Get the Pickupable that is spawned by this PickupSpawner.284 @return285 Returns the Pickupable that is spawned by this PickupSpawner.286 */287 const Pickupable* PickupSpawner::getPickupable(void) const288 {289 return this->pickup_;290 }291 292 /**293 @brief294 Trigger the PickupSpawner.295 Adds the pickup to the Pawn that triggered, sets the timer to re-activate and deactives the PickupSpawner.296 @param pawn297 Pawn which triggered the PickupSpawner.298 */299 void PickupSpawner::trigger(Pawn* pawn)300 {301 if(this->isActive()) // Checks whether PickupSpawner is active.302 {303 orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered and active." << endl;304 305 PickupCarrier* carrier = dynamic_cast<PickupCarrier*>(pawn);306 assert(carrier);307 308 // If the Pawn isn't a target of the Pickupable.309 if(!carrier->isTarget(this->pickup_))310 {311 orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") triggered but Pawn wasn't a target of the Pickupable." << endl;312 return;313 }314 315 PickupCarrier* target = carrier->getTarget(this->pickup_);316 Pickupable* pickup = this->getPickup();317 318 this->block(carrier);319 320 assert(pickup);321 assert(target);322 bool pickedUp = pickup->pickup(target);323 assert(pickedUp);324 pickedUp = false; // To avoid compiler warning.325 326 this->decrementSpawnsRemaining();327 }328 }329 330 /**331 @brief332 Creates a new Pickupable.333 @return334 The Pickupable created.335 */336 Pickupable* PickupSpawner::getPickup(void)337 {338 if(this->spawnsRemaining_ == 0)339 {340 orxout(internal_error, context::pickups) << "Massive Error: PickupSpawner still alive until having spawned last item." << endl;341 return NULL;342 }343 344 Pickupable* pickup = this->pickup_->clone();345 return pickup;346 }347 348 /**349 @brief350 Invoked by the timer, re-activates the PickupSpawner.351 */352 void PickupSpawner::respawnTimerCallback()353 {354 orxout(verbose, context::pickups) << "PickupSpawner (&" << this << ") reactivated." << endl;355 356 this->setActive(true);357 }358 333 } -
code/trunk/src/modules/pickup/PickupSpawner.h
r7549 r9348 78 78 public: 79 79 PickupSpawner(BaseObject* creator); //!< Default Constructor. 80 PickupSpawner(BaseObject* creator, Pickupable* pickup, float triggerDistance, float respawnTime, int maxSpawnedItems); //!< Constructor.81 80 virtual ~PickupSpawner(); //!< Destructor. 82 81 82 static PickupSpawner* createDroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0); 83 83 84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a PickupSpawner through XML. 84 virtual void changedActivity(); //!< Invoked when activity has changed (set visibilty).85 85 virtual void tick(float dt); //!< Tick, checks if any Pawn is close enough to trigger. 86 86 … … 103 103 inline int getMaxSpawnedItems(void) const 104 104 { return this->maxSpawnedItems_; } 105 /** 106 @brief Returns the name of the template which is used to create a pickup for this spawner. 107 */ 108 inline const std::string& getPickupTemplateName() const 109 { return this->pickupTemplateName_; } 110 /** 111 @brief Returns the template which is used to create a pickup for this spawner. 112 */ 113 inline Template* getPickupTemplate() const 114 {return this->pickupTemplate_; } 105 115 106 protected: 116 private: 117 void initialize(void); 118 119 void trigger(PickupCarrier* carrier); //!< Method called when a carrier is close enough. 120 void respawnTimerCallback(); //!< Method called when the timer runs out. 121 107 122 void decrementSpawnsRemaining(void); //!< Decrements the number of remaining spawns. 108 123 void startRespawnTimer(void); //!< Invoked by the timer, re-activates the PickupSpawner. … … 128 143 inline void setRespawnTime(float time) 129 144 { this->respawnTime_ = time; } 145 130 146 void setMaxSpawnedItems(int items); //!< Sets the maximum number of spawned items. 131 147 132 virtual Pickupable* getPickup(void); //!< Creates a new Pickupable. 148 void setPickupTemplateName(const std::string& name); 149 void setPickupTemplate(Template* temp); 133 150 151 Pickupable* createPickup(void); //!< Creates a new Pickupable. 134 152 void setPickupable(Pickupable* pickup); //!< Sets a Pickupable for the PickupSpawner to spawn. 135 const Pickupable* getPickupable(void) const; //!< Get the Pickupable that is spawned by this PickupSpawner.136 153 137 154 Pickupable* pickup_; //!< The pickup to be spawned. 138 139 private: 140 void initialize(void); 141 142 void trigger(Pawn* pawn); //!< Method called when a Pawn is close enough. 143 void respawnTimerCallback(); //!< Method called when the timer runs out. 155 StaticEntity* representation_; //!< The active representation of the spawner. 156 std::string pickupTemplateName_; //!< The name of the pickup template. 157 Template* pickupTemplate_; //!< The template to be used to create a pickupable. 144 158 145 159 int maxSpawnedItems_; //!< Maximum number of items spawned by this PickupSpawner. -
code/trunk/src/modules/pickup/items/CMakeLists.txt
r8706 r9348 7 7 ShieldPickup.cc 8 8 ShrinkPickup.cc 9 DamageBoostPickup.cc 9 10 ) -
code/trunk/src/modules/pickup/items/DronePickup.cc
r8858 r9348 39 39 40 40 #include "controllers/DroneController.h" 41 #include "pickup/PickupIdentifier.h"42 41 #include "worldentities/Drone.h" 43 42 #include "worldentities/pawns/Pawn.h" … … 75 74 { 76 75 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 77 this->setDurationType Direct(pickupDurationType::once);76 this->setDurationType(pickupDurationType::once); 78 77 this->droneTemplate_ = ""; 79 }80 81 /**82 @brief83 Initializes the PickupIdentifier of this pickup.84 */85 void DronePickup::initializeIdentifier(void)86 {87 std::string val = this->getDroneTemplate();88 std::string type = "droneTemplate";89 this->pickupIdentifier_->addParameter(type, val);90 78 } 91 79 … … 98 86 SUPER(DronePickup, XMLPort, xmlelement, mode); 99 87 XMLPortParam(DronePickup, "droneTemplate", setDroneTemplate, getDroneTemplate, xmlelement, mode); 100 101 this->initializeIdentifier();102 88 } 103 89 … … 108 94 The name of the Template to e set. 109 95 */ 110 void DronePickup::setDroneTemplate( std::stringtemplatename){96 void DronePickup::setDroneTemplate(const std::string& templatename){ 111 97 droneTemplate_ = templatename; 112 98 } … … 144 130 145 131 Controller* controller = drone->getController(); 146 DroneController* droneController = dynamic_cast<DroneController*>(controller);132 DroneController* droneController = orxonox_cast<DroneController*>(controller); 147 133 if(droneController != NULL) 148 134 { … … 175 161 { 176 162 PickupCarrier* carrier = this->getCarrier(); 177 Pawn* pawn = dynamic_cast<Pawn*>(carrier);163 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 178 164 179 165 if(pawn == NULL) … … 184 170 return pawn; 185 171 } 186 187 /**188 @brief189 Creates a duplicate of the input OrxonoxClass.190 @param item191 A pointer to the Orxonox class.192 */193 void DronePickup::clone(OrxonoxClass*& item)194 {195 if(item == NULL)196 item = new DronePickup(this);197 198 SUPER(DronePickup, clone, item);199 200 DronePickup* pickup = dynamic_cast<DronePickup*>(item);201 pickup->setDroneTemplate(this->getDroneTemplate());202 203 pickup->initializeIdentifier();204 }205 172 } -
code/trunk/src/modules/pickup/items/DronePickup.h
r7547 r9348 70 70 71 71 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 72 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.73 72 74 73 const std::string& getDroneTemplate() const; //!< Get the name of the droneTemplate. 75 74 76 75 protected: 77 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup. 78 79 void setDroneTemplate(std::string templatename); //!< Set the droneTemplate. 76 void setDroneTemplate(const std::string& templatename); //!< Set the droneTemplate. 80 77 81 78 private: -
code/trunk/src/modules/pickup/items/HealthPickup.cc
r8864 r9348 38 38 #include "core/XMLPort.h" 39 39 40 #include "pickup/PickupIdentifier.h"41 40 #include "worldentities/pawns/Pawn.h" 42 41 … … 87 86 /** 88 87 @brief 89 Initializes the PickupIdentifier of this pickup.90 */91 void HealthPickup::initializeIdentifier(void)92 {93 std::stringstream stream;94 stream << this->getHealth();95 std::string type1 = "health";96 std::string val1 = stream.str();97 this->pickupIdentifier_->addParameter(type1, val1);98 99 std::string val2 = this->getHealthType();100 std::string type2 = "healthType";101 this->pickupIdentifier_->addParameter(type2, val2);102 103 stream.clear();104 stream << this->getHealthRate();105 std::string val3 = stream.str();106 std::string type3 = "healthRate";107 this->pickupIdentifier_->addParameter(type3, val3);108 }109 110 /**111 @brief112 88 Method for creating a HealthPickup object through XML. 113 89 */ … … 118 94 XMLPortParam(HealthPickup, "health", setHealth, getHealth, xmlelement, mode); 119 95 XMLPortParam(HealthPickup, "healthRate", setHealthRate, getHealthRate, xmlelement, mode); 120 XMLPortParam(HealthPickup, "healthType", setHealthType , getHealthType, xmlelement, mode);96 XMLPortParam(HealthPickup, "healthType", setHealthTypeAsString, getHealthTypeAsString, xmlelement, mode); 121 97 122 98 if(!this->isContinuous()) 123 this->healthRate_ = 0.0f; 124 125 this->initializeIdentifier(); 99 this->setHealthRate(0.0f); // TODO: this logic should be inside tick(), not in XMLPort 126 100 } 127 101 … … 151 125 this->setHealth(this->getHealth()-health); 152 126 153 switch(this->getHealthType Direct())127 switch(this->getHealthType()) 154 128 { 155 129 case pickupHealthType::permanent: … … 198 172 199 173 float health = 0.0f; 200 switch(this->getHealthType Direct())174 switch(this->getHealthType()) 201 175 { 202 176 case pickupHealthType::permanent: … … 227 201 else 228 202 { 229 if(this->getHealthType Direct() == pickupHealthType::temporary)203 if(this->getHealthType() == pickupHealthType::temporary) 230 204 { 231 205 PickupCarrier* carrier = this->getCarrier(); 232 Pawn* pawn = dynamic_cast<Pawn*>(carrier);206 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 233 207 234 208 if(pawn == NULL) … … 264 238 { 265 239 PickupCarrier* carrier = this->getCarrier(); 266 Pawn* pawn = dynamic_cast<Pawn*>(carrier);240 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 267 241 268 242 if(pawn == NULL) … … 270 244 271 245 return pawn; 272 }273 274 /**275 @brief276 Creates a duplicate of the input OrxonoxClass.277 @param item278 A pointer to the Orxonox class.279 */280 void HealthPickup::clone(OrxonoxClass*& item)281 {282 if(item == NULL)283 item = new HealthPickup(this);284 285 SUPER(HealthPickup, clone, item);286 287 HealthPickup* pickup = dynamic_cast<HealthPickup*>(item);288 pickup->setHealth(this->getHealth());289 pickup->setHealthRate(this->getHealthRate());290 pickup->setHealthTypeDirect(this->getHealthTypeDirect());291 292 pickup->initializeIdentifier();293 246 } 294 247 … … 299 252 Returns the health type as a string. 300 253 */ 301 const std::string& HealthPickup::getHealthType (void) const302 { 303 switch(this->getHealthType Direct())254 const std::string& HealthPickup::getHealthTypeAsString(void) const 255 { 256 switch(this->getHealthType()) 304 257 { 305 258 case pickupHealthType::limited: … … 352 305 The type as a string. 353 306 */ 354 void HealthPickup::setHealthType (std::stringtype)307 void HealthPickup::setHealthTypeAsString(const std::string& type) 355 308 { 356 309 if(type == HealthPickup::healthTypeLimited_s) 357 this->setHealthType Direct(pickupHealthType::limited);310 this->setHealthType(pickupHealthType::limited); 358 311 else if(type == HealthPickup::healthTypeTemporary_s) 359 this->setHealthType Direct(pickupHealthType::temporary);312 this->setHealthType(pickupHealthType::temporary); 360 313 else if(type == HealthPickup::healthTypePermanent_s) 361 this->setHealthType Direct(pickupHealthType::permanent);314 this->setHealthType(pickupHealthType::permanent); 362 315 else 363 316 orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl; -
code/trunk/src/modules/pickup/items/HealthPickup.h
r7551 r9348 97 97 98 98 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 99 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.100 99 101 100 /** … … 116 115 @return Returns the health type as an enum. 117 116 */ 118 inline pickupHealthType::Value getHealthType Direct(void) const117 inline pickupHealthType::Value getHealthType(void) const 119 118 { return this->healthType_; } 120 const std::string& getHealthType (void) const; //!< Get the health type of this pickup.119 const std::string& getHealthTypeAsString(void) const; //!< Get the health type of this pickup. 121 120 122 121 protected: 123 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.124 125 122 void setHealth(float health); //!< Sets the health. 126 123 void setHealthRate(float speed); //!< Set the rate at which health is transferred if the pickup is continuous. … … 130 127 @param type The type of this pickup as an enum. 131 128 */ 132 inline void setHealthType Direct(pickupHealthType::Value type)129 inline void setHealthType(pickupHealthType::Value type) 133 130 { this->healthType_ = type; } 134 void setHealthType (std::stringtype); //!< Set the type of the HealthPickup.131 void setHealthTypeAsString(const std::string& type); //!< Set the type of the HealthPickup. 135 132 136 133 private: -
code/trunk/src/modules/pickup/items/InvisiblePickup.cc
r8858 r9348 40 40 #include "core/XMLPort.h" 41 41 42 #include "pickup/PickupIdentifier.h"43 42 #include "worldentities/pawns/Pawn.h" 44 43 … … 79 78 /** 80 79 @brief 81 Initializes the PickupIdentifier of this pickup.82 */83 void InvisiblePickup::initializeIdentifier(void)84 {85 std::stringstream stream;86 stream << this->getDuration();87 std::string type1 = "duration";88 std::string val1 = stream.str();89 this->pickupIdentifier_->addParameter(type1, val1);90 }91 92 /**93 @brief94 80 Method for creating a HealthPickup object through XML. 95 81 */ … … 98 84 SUPER(InvisiblePickup, XMLPort, xmlelement, mode); 99 85 XMLPortParam(InvisiblePickup, "duration", setDuration, getDuration, xmlelement, mode); 100 101 this->initializeIdentifier();102 86 } 103 87 … … 148 132 /** 149 133 @brief 150 Creates a duplicate of the input OrxonoxClass.151 @param item152 A pointer to the Orxonox class.153 */154 void InvisiblePickup::clone(OrxonoxClass*& item)155 {156 if(item == NULL)157 item = new InvisiblePickup(this);158 159 SUPER(InvisiblePickup, clone, item);160 161 InvisiblePickup* pickup = dynamic_cast<InvisiblePickup*>(item);162 pickup->setDuration(this->getDuration());163 pickup->initializeIdentifier();164 }165 166 /**167 @brief168 134 Sets the invisibility. 169 135 @param invisibility … … 202 168 { 203 169 PickupCarrier* carrier = this->getCarrier(); 204 Pawn* pawn = dynamic_cast<Pawn*>(carrier);170 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 205 171 206 172 if(pawn == NULL) -
code/trunk/src/modules/pickup/items/InvisiblePickup.h
r7547 r9348 72 72 InvisiblePickup(BaseObject* creator); //!< Constructor. 73 73 virtual ~InvisiblePickup(); //!< Destructor. 74 74 75 75 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode); //!< Method for creating a HealthPickup object through XML. 76 76 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 77 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.78 77 79 78 /** … … 91 90 92 91 protected: 93 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.94 95 92 bool setInvisible(bool invisibility); //!< Set the Pawn to be invisible or visible again. 96 93 void setDuration(float duration); //!< Sets the time the InvisibilityPickup will last. -
code/trunk/src/modules/pickup/items/MetaPickup.cc
r8858 r9348 36 36 37 37 #include "interfaces/PickupCarrier.h" 38 #include "pickup/PickupIdentifier.h"39 38 #include "worldentities/pawns/Pawn.h" 40 39 … … 80 79 this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier()); 81 80 82 this->setDurationType Direct(pickupDurationType::once);81 this->setDurationType(pickupDurationType::once); 83 82 this->metaType_ = pickupMetaType::none; 84 83 } … … 86 85 /** 87 86 @brief 88 Helper method to initialize the PickupIdentifier.89 */90 void MetaPickup::initializeIdentifier(void)91 {92 std::string val = this->getMetaType();93 std::string type = "metaType";94 this->pickupIdentifier_->addParameter(type, val);95 }96 97 /**98 @brief99 87 Method for creating a MetaPickup object through XML. 100 88 */ … … 103 91 SUPER(MetaPickup, XMLPort, xmlelement, mode); 104 92 105 XMLPortParam(MetaPickup, "metaType", setMetaType, getMetaType, xmlelement, mode); 106 107 this->initializeIdentifier(); 93 XMLPortParam(MetaPickup, "metaType", setMetaTypeAsString, getMetaTypeAsString, xmlelement, mode); 108 94 } 109 95 … … 121 107 { 122 108 PickupCarrier* carrier = this->getCarrier(); 123 if(this->getMetaType Direct() != pickupMetaType::none && carrier != NULL)109 if(this->getMetaType() != pickupMetaType::none && carrier != NULL) 124 110 { 125 111 // If the metaType is destroyCarrier, then the PickupCarrier is destroyed. 126 if(this->getMetaType Direct() == pickupMetaType::destroyCarrier)112 if(this->getMetaType() == pickupMetaType::destroyCarrier) 127 113 { 128 114 Pawn* pawn = orxonox_cast<Pawn*>(carrier); … … 139 125 140 126 // If the metaType is use, then the Pickupable is set to used. 141 if(this->getMetaType Direct() == pickupMetaType::use && !pickup->isUsed())127 if(this->getMetaType() == pickupMetaType::use && !pickup->isUsed()) 142 128 { 143 129 pickup->setUsed(true); 144 130 } 145 131 // If the metaType is drop, then the Pickupable is dropped. 146 else if(this->getMetaType Direct() == pickupMetaType::drop)132 else if(this->getMetaType() == pickupMetaType::drop) 147 133 { 148 134 pickup->drop(); 149 135 } 150 136 // If the metaType is destroy, then the Pickupable is destroyed. 151 else if(this->getMetaType Direct() == pickupMetaType::destroy)137 else if(this->getMetaType() == pickupMetaType::destroy) 152 138 { 153 139 pickup->Pickupable::destroy(); … … 161 147 /** 162 148 @brief 163 Creates a duplicate of the input OrxonoxClass.164 @param item165 A pointer to the Orxonox class.166 */167 void MetaPickup::clone(OrxonoxClass*& item)168 {169 if(item == NULL)170 item = new MetaPickup(this);171 172 SUPER(MetaPickup, clone, item);173 174 MetaPickup* pickup = dynamic_cast<MetaPickup*>(item);175 pickup->setMetaTypeDirect(this->getMetaTypeDirect());176 177 pickup->initializeIdentifier();178 }179 180 /**181 @brief182 149 Get the meta type of this MetaPickup. 183 150 @return 184 151 Returns a string with the meta type of the MetaPickup. 185 152 */ 186 const std::string& MetaPickup::getMetaType (void) const187 { 188 switch(this->getMetaType Direct())153 const std::string& MetaPickup::getMetaTypeAsString(void) const 154 { 155 switch(this->getMetaType()) 189 156 { 190 157 case pickupMetaType::none: … … 209 176 A string with the type to be set. 210 177 */ 211 void MetaPickup::setMetaType (const std::string& type)178 void MetaPickup::setMetaTypeAsString(const std::string& type) 212 179 { 213 180 if(type == MetaPickup::metaTypeNone_s) 214 181 { 215 this->setMetaType Direct(pickupMetaType::none);182 this->setMetaType(pickupMetaType::none); 216 183 } 217 184 else if(type == MetaPickup::metaTypeUse_s) 218 185 { 219 this->setMetaType Direct(pickupMetaType::use);186 this->setMetaType(pickupMetaType::use); 220 187 } 221 188 else if(type == MetaPickup::metaTypeDrop_s) 222 189 { 223 this->setMetaType Direct(pickupMetaType::drop);190 this->setMetaType(pickupMetaType::drop); 224 191 } 225 192 else if(type == MetaPickup::metaTypeDestroy_s) 226 193 { 227 this->setMetaType Direct(pickupMetaType::destroy);194 this->setMetaType(pickupMetaType::destroy); 228 195 } 229 196 else if(type == MetaPickup::metaTypeDestroyCarrier_s) 230 197 { 231 this->setMetaType Direct(pickupMetaType::destroyCarrier);198 this->setMetaType(pickupMetaType::destroyCarrier); 232 199 } 233 200 else -
code/trunk/src/modules/pickup/items/MetaPickup.h
r7547 r9348 69 69 70 70 The default value is <em>none</em>, which basically does nothing. 71 71 72 72 The parameter <b>activation type</b> can be used to specify, whether the MetaPickup is used upon pickup (<em>immediate</em>) or not (<em>onUse</em>). With <em>immediate</em> being the default. 73 73 … … 95 95 96 96 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 97 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.98 97 99 98 /** … … 101 100 @return Returns an enum with the meta type of the MetaPickup. 102 101 */ 103 inline pickupMetaType::Value getMetaType Direct(void) const102 inline pickupMetaType::Value getMetaType(void) const 104 103 { return this->metaType_; } 105 const std::string& getMetaType (void) const; //!< Get the meta type of this MetaPickup.104 const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup. 106 105 107 106 protected: 108 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.109 110 107 /** 111 108 @brief Set the meta type of the MetaPickup. 112 109 @param type The meta type as an enum. 113 110 */ 114 inline void setMetaType Direct(pickupMetaType::Value type)111 inline void setMetaType(pickupMetaType::Value type) 115 112 { this->metaType_ = type; } 116 void setMetaType (const std::string& type); //!< Set the meta type of this MetaPickup.113 void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup. 117 114 118 115 private: -
code/trunk/src/modules/pickup/items/ShieldPickup.cc
r8858 r9348 38 38 #include "core/XMLPort.h" 39 39 40 #include "pickup/PickupIdentifier.h"41 40 #include "worldentities/pawns/Pawn.h" 42 41 … … 80 79 /** 81 80 @brief 82 Initializes the PickupIdentifier of this pickup.83 */84 void ShieldPickup::initializeIdentifier(void)85 {86 std::stringstream stream;87 stream << this->getDuration();88 std::string type1 = "duration";89 std::string val1 = stream.str();90 this->pickupIdentifier_->addParameter(type1, val1);91 92 stream.clear();93 stream << this->getShieldHealth();94 std::string type2 = "ShieldHealth";95 std::string val2 = stream.str();96 this->pickupIdentifier_->addParameter(type2, val2);97 98 stream.clear();99 stream << this->getShieldAbsorption();100 std::string type3 = "ShieldAbsorption";101 std::string val3 = stream.str();102 this->pickupIdentifier_->addParameter(type3, val3);103 104 }105 106 /**107 @brief108 81 Method for creating a ShieldPickup object through XML. 109 82 */ … … 115 88 XMLPortParam(ShieldPickup, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode); 116 89 XMLPortParam(ShieldPickup, "duration", setDuration, getDuration, xmlelement, mode); 117 118 this->initializeIdentifier();119 90 } 120 91 … … 177 148 { 178 149 PickupCarrier* carrier = this->getCarrier(); 179 Pawn* pawn = dynamic_cast<Pawn*>(carrier);150 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 180 151 181 152 if(pawn == NULL) … … 184 155 } 185 156 return pawn; 186 }187 188 /**189 @brief190 Creates a duplicate of the input OrxonoxClass.191 @param item192 A pointer to the Orxonox class.193 */194 void ShieldPickup::clone(OrxonoxClass*& item)195 {196 if(item == NULL)197 item = new ShieldPickup(this);198 199 SUPER(ShieldPickup, clone, item);200 201 ShieldPickup* pickup = dynamic_cast<ShieldPickup*>(item);202 pickup->setDuration(this->getDuration());203 pickup->setShieldAbsorption(this->getShieldAbsorption());204 pickup->setShieldHealth(this->getShieldHealth());205 pickup->initializeIdentifier();206 157 } 207 158 -
code/trunk/src/modules/pickup/items/ShieldPickup.h
r7547 r9348 82 82 83 83 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 84 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.85 84 86 85 /** … … 104 103 105 104 protected: 106 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.107 105 void pickupTimerCallback(void); //!< Helper method. Is called by the Timer as soon as it expires. 108 106 -
code/trunk/src/modules/pickup/items/ShrinkPickup.cc
r8713 r9348 40 40 #include "core/XMLPort.h" 41 41 42 #include "pickup/PickupIdentifier.h"43 42 #include "worldentities/pawns/Pawn.h" 44 43 … … 81 80 } 82 81 83 void ShrinkPickup::initializeIdentifier(void)84 {85 std::stringstream stream;86 stream << this->getShrinkFactor();87 std::string type1 = "shrinkFactor";88 std::string val1 = stream.str();89 this->pickupIdentifier_->addParameter(type1, val1);90 91 stream.clear();92 stream << this->getDuration();93 std::string val2 = stream.str();94 std::string type2 = "duration";95 this->pickupIdentifier_->addParameter(type2, val2);96 97 stream.clear();98 stream << this->getShrinkDuration();99 std::string val3 = stream.str();100 std::string type3 = "shrinkDuration";101 this->pickupIdentifier_->addParameter(type3, val3);102 }103 104 82 /** 105 83 @brief … … 113 91 XMLPortParam(ShrinkPickup, "duration", setDuration, getDuration, xmlelement, mode); 114 92 XMLPortParam(ShrinkPickup, "shrinkDuration", setShrinkDuration, getShrinkDuration, xmlelement, mode); 115 116 this->initializeIdentifier(); 93 } 94 95 /** 96 @brief Sets the shrinking factor. 97 @param factor The factor, needs to greater than 1. 98 */ 99 void ShrinkPickup::setShrinkFactor(float factor) 100 { 101 if(factor <= 1.0f) 102 { 103 orxout(internal_warning, context::pickups) << "Invalid shrinking factor in ShrinkPickup. Ignoring.." << endl; 104 return; 105 } 106 this->shrinkFactor_ = factor; 107 } 108 109 /** 110 @brief Set the duration for which the ship remains shrunken. 111 @param duration The duration, needs to be non-negative. 112 */ 113 void ShrinkPickup::setDuration(float duration) 114 { 115 if(duration < 0.0f) 116 { 117 orxout(internal_warning, context::pickups) << "Invalid duration in ShrinkPickup. Ignoring.." << endl; 118 return; 119 } 120 this->duration_ = duration; 121 } 122 123 /** 124 @brief Set the shrink duration. 125 @param speed The shrink duration, needs to be positive. 126 */ 127 void ShrinkPickup::setShrinkDuration(float speed) 128 { 129 if(speed <= 0.0f) 130 { 131 orxout(internal_warning, context::pickups) << "Invalid shrink duration in ShrinkPickup. Ignoring.." << endl; 132 return; 133 } 134 this->shrinkDuration_ = speed; 117 135 } 118 136 … … 148 166 { 149 167 SUPER(ShrinkPickup, changedPickedUp); 150 168 151 169 if(!this->isPickedUp() && this->isActive_) 152 170 { … … 271 289 272 290 bool destroy = false; 273 291 274 292 // Stop shrinking if the desired size is reached. 275 293 if(this->timeRemainig_ <= 0.0f) … … 314 332 { 315 333 PickupCarrier* carrier = this->getCarrier(); 316 Pawn* pawn = dynamic_cast<Pawn*>(carrier);334 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 317 335 318 336 return pawn; 319 337 } 320 321 /**322 @brief323 Creates a duplicate of the input OrxonoxClass.324 @param item325 A pointer to the Orxonox class.326 */327 void ShrinkPickup::clone(OrxonoxClass*& item)328 {329 if(item == NULL)330 item = new ShrinkPickup(this);331 332 SUPER(ShrinkPickup, clone, item);333 ShrinkPickup* pickup = dynamic_cast<ShrinkPickup*>(item);334 pickup->setShrinkFactor(this->getShrinkFactor());335 pickup->setDuration(this->getDuration());336 pickup->setShrinkDuration(this->getShrinkDuration());337 338 pickup->initializeIdentifier();339 }340 338 } -
code/trunk/src/modules/pickup/items/ShrinkPickup.h
r8858 r9348 80 80 virtual void changedUsed(void); // Is called when the pickup has transited from used to unused or the other way around. 81 81 virtual void changedPickedUp(void); 82 virtual void clone(OrxonoxClass*& item); // Creates a duplicate of the input OrxonoxClass.83 82 84 83 /** … … 88 87 inline float getShrinkFactor(void) const 89 88 { return this->shrinkFactor_; } 90 /** 91 @brief Sets the shrinking factor. 92 @param factor The factor, needs to greater than 1. 93 */ 94 inline void setShrinkFactor(float factor) 95 { if(factor <= 1.0f) { orxout(internal_warning, context::pickups) << "Invalid shrinking factor in ShrinkPickup. Ignoring.." << endl; return; } this->shrinkFactor_ = factor; } 89 void setShrinkFactor(float factor); 90 96 91 /** 97 92 @brief Get the duration for which the ship remains shrunken. … … 100 95 inline float getDuration(void) const 101 96 { return this->duration_; } 102 /** 103 @brief Set the duration for which the ship remains shrunken. 104 @param duration The duration, needs to be non-negative. 105 */ 106 inline void setDuration(float duration) 107 { if(duration < 0.0f) { orxout(internal_warning, context::pickups) << "Invalid duration in ShrinkPickup. Ignoring.." << endl; return; } this->duration_ = duration; } 97 void setDuration(float duration); 98 108 99 /** 109 100 @brief Get the shrink speed. … … 112 103 inline float getShrinkDuration(void) const 113 104 { return this->shrinkDuration_; } 114 /** 115 @brief Set the shrink duration. 116 @param speed The shrink duration, needs to be positive. 117 */ 118 inline void setShrinkDuration(float speed) 119 { if(speed <= 0.0f) { orxout(internal_warning, context::pickups) << "Invalid shrink duration in ShrinkPickup. Ignoring.." << endl; return; } this->shrinkDuration_ = speed; } 120 121 protected: 122 void initializeIdentifier(void); 105 void setShrinkDuration(float speed); 123 106 124 107 private: … … 135 118 float currentFactor_; //!< The shrink factor that is currently applied. 136 119 float timeRemainig_; //!< The remaining shrink time. 137 120 138 121 Pawn* carrierToPawnHelper(void); 139 122 Timer durationTimer_; -
code/trunk/src/modules/pickup/items/SpeedPickup.cc
r8858 r9348 38 38 #include "core/XMLPort.h" 39 39 40 #include "pickup/PickupIdentifier.h"41 40 #include "worldentities/pawns/SpaceShip.h" 42 41 … … 80 79 /** 81 80 @brief 82 Initializes the PickupIdentifier of this pickup.83 */84 void SpeedPickup::initializeIdentifier(void)85 {86 std::stringstream stream;87 stream << this->getDuration();88 std::string type1 = "duration";89 std::string val1 = stream.str();90 this->pickupIdentifier_->addParameter(type1, val1);91 92 stream.clear();93 stream << this->getSpeedAdd();94 std::string type2 = "speedAdd";95 std::string val2 = stream.str();96 this->pickupIdentifier_->addParameter(type2, val2);97 98 stream.clear();99 stream << this->getSpeedMultiply();100 std::string type3 = "speedMultiply";101 std::string val3 = stream.str();102 this->pickupIdentifier_->addParameter(type3, val3);103 }104 105 /**106 @brief107 81 Method for creating a SpeedPickup object through XML. 108 82 */ … … 114 88 XMLPortParam(SpeedPickup, "speedAdd", setSpeedAdd, getSpeedAdd, xmlelement, mode); 115 89 XMLPortParam(SpeedPickup, "speedMultiply", setSpeedMultiply, getSpeedMultiply, xmlelement, mode); 116 117 this->initializeIdentifier();118 90 } 119 91 … … 176 148 { 177 149 PickupCarrier* carrier = this->getCarrier(); 178 SpaceShip* ship = dynamic_cast<SpaceShip*>(carrier);150 SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier); 179 151 180 152 if(ship == NULL) … … 184 156 185 157 return ship; 186 }187 188 /**189 @brief190 Creates a duplicate of the input OrxonoxClass.191 @param item192 A pointer to the Orxonox class.193 */194 void SpeedPickup::clone(OrxonoxClass*& item)195 {196 if(item == NULL)197 item = new SpeedPickup(this);198 199 SUPER(SpeedPickup, clone, item);200 201 SpeedPickup* pickup = dynamic_cast<SpeedPickup*>(item);202 pickup->setDuration(this->getDuration());203 pickup->setSpeedAdd(this->getSpeedAdd());204 pickup->setSpeedMultiply(this->getSpeedMultiply());205 206 pickup->initializeIdentifier();207 158 } 208 159 -
code/trunk/src/modules/pickup/items/SpeedPickup.h
r8727 r9348 81 81 82 82 virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around. 83 virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.84 83 85 84 /** … … 103 102 104 103 protected: 105 void initializeIdentifier(void); //!< Initializes the PickupIdentifier of this pickup.106 104 void pickupTimerCallback(void); //!< Function that gets called when timer ends. 107 105 … … 112 110 private: 113 111 void initialize(void); //!< Initializes the member variables. 114 SpaceShip* carrierToSpaceShipHelper(void); //!< Helper to transform the PickupCarrier to a SpaceS Hip, and throw an error message if the conversion fails.112 SpaceShip* carrierToSpaceShipHelper(void); //!< Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 115 113 116 114 Timer durationTimer_; //!< Timer. -
code/trunk/src/modules/pong/Pong.cc
r9258 r9348 256 256 Is called when the player scored. 257 257 */ 258 void Pong::playerScored(PlayerInfo* player )259 { 260 Deathmatch::playerScored(player );258 void Pong::playerScored(PlayerInfo* player, int score) 259 { 260 Deathmatch::playerScored(player, score); 261 261 262 262 if (this->center_ != NULL) // If there is a centerpoint. -
code/trunk/src/modules/pong/Pong.h
r9258 r9348 73 73 virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player. 74 74 75 virtual void playerScored(PlayerInfo* player ); //!< Is called when the player scored.75 virtual void playerScored(PlayerInfo* player, int score = 1); //!< Is called when the player scored. 76 76 77 77 /** -
code/trunk/src/modules/tetris/CMakeLists.txt
r8706 r9348 3 3 TetrisCenterpoint.cc 4 4 TetrisStone.cc 5 TetrisBrick.cc 6 TetrisScore.cc 5 7 ) 6 8 … … 10 12 LINK_LIBRARIES 11 13 orxonox 14 overlays 12 15 SOURCE_FILES ${TETRIS_SRC_FILES} 13 16 ) -
code/trunk/src/modules/tetris/Tetris.cc
r8858 r9348 23 23 * ... 24 24 * Co-authors: 25 * ... 26 * 25 * Johannes Ritz 26 * 27 * 28 * 29 * 30 *TASK c) end the game in a nicer way 31 *TASK d) save the highscore 32 *TASK e) eye candy 27 33 */ 28 34 … … 42 48 #include "TetrisCenterpoint.h" 43 49 #include "TetrisStone.h" 50 #include "TetrisBrick.h" 44 51 #include "infos/PlayerInfo.h" 45 52 … … 52 59 @brief 53 60 Constructor. Registers and initializes the object. 61 @ingroup Tetris 54 62 */ 55 63 Tetris::Tetris(BaseObject* creator) : Deathmatch(creator) … … 57 65 RegisterObject(Tetris); 58 66 59 this->active Stone_ = NULL;67 this->activeBrick_ = 0; 60 68 61 69 // Pre-set the timer, but don't start it yet. 62 this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Tetris::start Stone, this)));70 this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Tetris::startBrick, this))); 63 71 this->starttimer_.stopTimer(); 64 72 65 73 this->player_ = NULL; 74 this->setHUDTemplate("TetrisHUD"); 75 this->futureBrick_ = 0; 66 76 } 67 77 … … 82 92 void Tetris::cleanup() 83 93 { 84 94 if (this->activeBrick_) 95 { 96 this->activeBrick_->destroy(); 97 this->activeBrick_ = 0; 98 } 99 if (this->futureBrick_) 100 { 101 this->futureBrick_->destroy(); 102 this->futureBrick_ = 0; 103 } 104 105 for (std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 106 (*it)->destroy(); 107 this->stones_.clear(); 85 108 } 86 109 … … 89 112 SUPER(Tetris, tick, dt); 90 113 91 if(this->activeStone_ != NULL) 92 { 93 if(!this->isValidStonePosition(this->activeStone_, this->activeStone_->getPosition())) 94 { 95 this->activeStone_->setVelocity(Vector3::ZERO); 96 this->createStone(); 97 this->startStone(); 114 if((this->activeBrick_ != NULL)&&(!this->hasEnded())) 115 { 116 if(!this->isValidBrickPosition(this->activeBrick_)) 117 { 118 for (unsigned int i = 0; i < this->activeBrick_->getNumberOfStones(); i++) 119 this->stones_.push_back(this->activeBrick_->getStone(i)); 120 this->activeBrick_->setVelocity(Vector3::ZERO); 121 this->activeBrick_->releaseStones(this->center_); 122 this->findFullRows(); 123 this->startBrick(); 98 124 } 99 125 } … … 109 135 return false; 110 136 111 for(std::vector<TetrisStone*>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 112 { 113 if(stone == *it) 114 continue; 115 137 for(std::list<SmartPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 138 { 116 139 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone 117 140 … … 123 146 } 124 147 148 /** 149 @brief 150 Check for each stone in a brick if it is moved the right way. 151 */ 152 bool Tetris::isValidMove(TetrisBrick* brick, const Vector3& position, bool isRotation = false) 153 { 154 assert(brick); 155 156 for (unsigned int i = 0; i < brick->getNumberOfStones(); i++ ) 157 { 158 TetrisStone* stone = brick->getStone(i); 159 Vector3 stonePosition; //the current stone's offset to position 160 if(isRotation) 161 stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount()+1); 162 else 163 stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount()); 164 165 if(! this->isValidMove(stone, position + stonePosition )) 166 { 167 return false; 168 } 169 170 //catch illegal rotation (such that collisions with ground are not permitted) 171 if(isRotation) 172 { 173 if((position + stonePosition).y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level 174 { 175 return false; 176 } 177 } 178 } 179 return true; 180 181 } 182 183 184 125 185 bool Tetris::isValidStonePosition(TetrisStone* stone, const Vector3& position) 126 186 { 127 187 assert(stone); 128 188 129 // we use a reverse iterator because we have to check for collisions with the topmost stones first 130 for(std::vector<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it) 131 { 132 if(stone == *it) 189 // check for collisions with all stones 190 for(std::list<SmartPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 191 { 192 //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount()); 193 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone 194 //!< Saves the position of the currentStone 195 196 //filter out cases where the falling stone is already below a steady stone 197 if(position.y < currentStonePosition.y - this->center_->getStoneSize()/2.0f) 133 198 continue; 134 135 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone136 137 199 if((position.x == currentStonePosition.x) && (position.y < currentStonePosition.y + this->center_->getStoneSize())) 138 200 { 139 this->activeStone_->setPosition(Vector3(this->activeStone_->getPosition().x, currentStonePosition.y+this->center_->getStoneSize(), this->activeStone_->getPosition().z)); 201 float y_offset = static_cast<int>((this->activeBrick_->getPosition().y-currentStonePosition.y+10)/10)*10 + currentStonePosition.y; 202 if(y_offset < 0) //filter out extreme cases (very rare bug) 203 y_offset = 0; 204 this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, y_offset, this->activeBrick_->getPosition().z)); 140 205 return false; 141 206 }// This case applies if the stones overlap partially vertically … … 145 210 if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level 146 211 { 147 stone->setPosition(Vector3(stone->getPosition().x, this->center_->getStoneSize()/2.0f, stone->getPosition().z)); 212 float yOffset = stone->getPosition().y + this->center_->getStoneSize()/2.0f;//calculate offset 213 if(yOffset < 0) //catch brake-throughs 214 yOffset = 0; 215 this->activeBrick_->setPosition(Vector3(this->activeBrick_->getPosition().x, yOffset, this->activeBrick_->getPosition().z)); 148 216 return false; 149 217 } … … 151 219 return true; 152 220 } 221 /** 222 * @brief This function determines wether a brick touches another brick or the ground. 223 * 224 */ 225 bool Tetris::isValidBrickPosition(TetrisBrick* brick) 226 { 227 assert(brick); 228 229 const Vector3& brickPosition = this->activeBrick_->getPosition(); 230 231 // check all stones in the brick 232 for (unsigned int i = 0; i < brick->getNumberOfStones(); i++ ) 233 { 234 TetrisStone* stone = brick->getStone(i); 235 const Vector3& stonePosition = rotateVector(stone->getPosition(), brick->getRotationCount()); 236 if(! this->isValidStonePosition(stone, brickPosition + stonePosition) ) 237 { 238 // recurse because all stones have to checked again after the brick was re-positioned 239 this->isValidBrickPosition(brick); 240 return false; 241 } 242 } 243 return true; 244 } 245 246 /** 247 @brief 248 A Vector3 is rolled 90 * degrees * amount (anticlockwise rotation) 249 */ 250 Vector3 Tetris::rotateVector(Vector3 position, unsigned int amount) 251 { 252 float temp = 0; 253 for(unsigned int i = 0; i < amount; i++) 254 { 255 temp = position.x; 256 position.x = -position.y; 257 position.y = temp; 258 } 259 return position; 260 } 153 261 154 262 /** … … 160 268 if (this->center_ != NULL) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place. 161 269 { 162 // Create the first stone.163 this->create Stone();270 // Create the first brick. 271 this->createBrick(); 164 272 } 165 273 else // If no centerpoint was specified, an error is thrown and the level is exited. … … 190 298 void Tetris::end() 191 299 { 300 this->activeBrick_->setVelocity(Vector3::ZERO); 301 if(this->activeBrick_ != NULL) 302 { 303 this->player_->stopControl(); 304 } 305 192 306 this->cleanup(); 193 307 … … 225 339 } 226 340 227 /** 228 @brief 229 Starts the first stone. 230 */ 231 void Tetris::startStone(void) 341 342 343 void Tetris::startBrick(void) 232 344 { 233 345 if(this->player_ == NULL) … … 235 347 236 348 unsigned int cameraIndex = 0; 237 if(this->active Stone_ != NULL)349 if(this->activeBrick_ != NULL) 238 350 { 239 351 // Get camera settings 240 cameraIndex = this->active Stone_->getCurrentCameraIndex();352 cameraIndex = this->activeBrick_->getCurrentCameraIndex(); 241 353 this->player_->stopControl(); 242 } 243 244 // Make the last stone to be created the active stone. 245 this->activeStone_ = this->stones_.back(); 246 247 this->player_->startControl(this->activeStone_); 248 this->activeStone_->setVelocity(0.0f, -this->center_->getStoneSpeed(), 0.0f); 249 this->activeStone_->setCameraPosition(cameraIndex); 250 } 251 252 /** 253 @brief 254 Creates a new stone. 255 */ 256 void Tetris::createStone(void) 257 { 258 // Create a new stone and add it to the list of stones. 259 TetrisStone* stone = new TetrisStone(this->center_); 260 this->stones_.push_back(stone); 261 262 // Apply the stone template to the stone. 263 stone->addTemplate(this->center_->getStoneTemplate()); 264 265 // Attach the stone to the Centerpoint and set the position of the stone to be at the top middle. 266 this->center_->attach(stone); 354 // destroy old active brick 355 this->activeBrick_->destroy(); 356 } 357 358 // Make the last brick to be created the active brick. 359 this->activeBrick_ = this->futureBrick_; 360 this->futureBrick_ = 0; 361 362 // set its position 363 this->player_->startControl(this->activeBrick_); 267 364 float xPos = (this->center_->getWidth()/2 + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize(); 268 365 float yPos = (this->center_->getHeight()-0.5f)*this->center_->getStoneSize(); 269 stone->setPosition(xPos, yPos, 0.0f); 270 stone->setGame(this); 271 } 366 this->activeBrick_->setPosition(xPos, yPos, 0.0f); 367 this->activeBrick_->setVelocity(0.0f, -this->center_->getStoneSpeed(), 0.0f); 368 this->activeBrick_->setCameraPosition(cameraIndex); 369 370 // create a new future brick 371 this->createBrick(); 372 373 // check if the new brick is in a valid position, otherwise end the game 374 if (!this->isValidBrickPosition(this->activeBrick_)) 375 this->end(); 376 } 377 378 void Tetris::createBrick(void) //TODO: random rotation offset between 0 and 3 (times 90°) 379 { 380 // create new futureBrick_ 381 this->futureBrick_ = new TetrisBrick(this->center_); 382 383 384 // Apply the stone template to the stone. 385 this->futureBrick_->addTemplate(this->center_->getBrickTemplate()); 386 387 // Attach the brick to the Centerpoint and set the position of the brick to be at the left side. 388 this->center_->attach(this->futureBrick_); 389 float xPos = (this->center_->getWidth()*1.6f + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize(); 390 float yPos = (this->center_->getHeight()-5.1f)*this->center_->getStoneSize(); 391 this->futureBrick_->setPosition(xPos, yPos, 0.0f); 392 this->futureBrick_->setGame(this); 393 } 394 272 395 273 396 /** … … 282 405 } 283 406 407 /*TetrisCenterpoint* Tetris::getCenterpoint(void) const 408 { 409 return this->center_; 410 }*/ 411 284 412 /** 285 413 @brief Set the TetrisCenterpoint (the playing field). … … 291 419 } 292 420 421 /** 422 @brief Check each row if it is full. Removes all full rows. Update 423 @brief Manages score. 424 */ 425 void Tetris::findFullRows() 426 { 427 unsigned int correctPosition = 0; 428 unsigned int stonesPerRow = 0; 429 for (unsigned int row = 0; row < this->center_->getHeight(); row++) 430 { 431 stonesPerRow = 0; 432 for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ) 433 { 434 std::list<SmartPtr<TetrisStone> >::iterator it_temp = it++; 435 correctPosition = static_cast<unsigned int>(((*it_temp)->getPosition().y - 5)/this->center_->getStoneSize()); 436 if(correctPosition == row) 437 { 438 stonesPerRow++; 439 if(stonesPerRow == this->center_->getWidth()) 440 { 441 clearRow(row); 442 row--; //the row counter has to be decreased in order to detect multiple rows! 443 this->playerScored(this->player_);// add points 444 //increase the stone's speed 445 this->center_->setStoneSpeed(this->center_->getStoneSpeed()+1.0f); 446 } 447 } 448 } 449 } 450 } 451 452 void Tetris::clearRow(unsigned int row) 453 {// clear the full row 454 for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ) 455 { 456 if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row) 457 { 458 (*it)->destroy(); 459 this->stones_.erase(it++); 460 } 461 else 462 ++it; 463 } 464 // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug. 465 for(std::list<SmartPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it) 466 { 467 if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) > row) 468 (*it)->setPosition((*it)->getPosition()-Vector3(0,10,0)); 469 } 470 471 } 472 473 293 474 } -
code/trunk/src/modules/tetris/Tetris.h
r8706 r9348 56 56 public: 57 57 Tetris(BaseObject* creator); //!< Constructor. Registers and initializes the object. 58 virtual ~Tetris(); //!< Destructor. Cleans up, if initialized. 58 virtual ~Tetris(); //!< Destructor. Cleans up, if initialized. 59 59 60 60 virtual void start(void); //!< Starts the Tetris minigame. … … 68 68 69 69 PlayerInfo* getPlayer(void) const; //!< Get the player. 70 WeakPtr<TetrisCenterpoint> getCenterpoint(void) 71 { return this->center_; } 70 72 71 73 bool isValidMove(TetrisStone* stone, const Vector3& position); 74 bool isValidMove(TetrisBrick* brick, const Vector3& position, bool isRotation); 75 Vector3 rotateVector(Vector3 position, unsigned int amount); 72 76 73 77 protected: 74 78 virtual void spawnPlayersIfRequested(); //!< Spawns player. 75 79 80 76 81 private: 77 void start Stone(void); //!< Starts with the first stone.78 void create Stone(void);82 void startBrick(void); 83 void createBrick(void); 79 84 void cleanup(void); //!< Cleans up the Gametype by destroying the ball and the bats. 80 85 bool isValidStonePosition(TetrisStone* stone, const Vector3& position); 81 86 bool isValidBrickPosition(TetrisBrick* brick); 87 void findFullRows(void); 88 void clearRow(unsigned int row); 89 90 82 91 PlayerInfo* player_; 83 92 84 93 WeakPtr<TetrisCenterpoint> center_; //!< The playing field. 85 std:: vector<TetrisStone*> stones_; //!< A list of all stones in play.86 std::vector< std::vector<bool> > grid_;87 TetrisStone* activeStone_;88 94 std::list<SmartPtr<TetrisStone> > stones_; //!< A list of all stones in play. 95 WeakPtr<TetrisBrick> activeBrick_; 96 WeakPtr<TetrisBrick> futureBrick_; 97 89 98 Timer starttimer_; //!< A timer to delay the start of the game. 90 99 }; -
code/trunk/src/modules/tetris/TetrisCenterpoint.cc
r8706 r9348 30 30 @file TetrisCenterpoint.cc 31 31 @brief Implementation of the TetrisCenterpoint class. 32 @ingroup Tetris 32 33 */ 33 34 … … 55 56 this->stoneSize_ = 10.0f; 56 57 this->stoneTemplate_ = ""; 58 this->brickTemplate_ = ""; 57 59 this->stoneSpeed_ = 20.0f; 58 60 … … 69 71 70 72 XMLPortParam(TetrisCenterpoint, "width", setWidth, getWidth, xmlelement, mode); // die Breite 71 XMLPortParam(TetrisCenterpoint, "height", setHeight, setWidth, xmlelement, mode); // die Grösse73 XMLPortParam(TetrisCenterpoint, "height", setHeight, getHeight, xmlelement, mode); // die Grösse //was sollte das mit setWidth?? 72 74 XMLPortParam(TetrisCenterpoint, "stoneSize", setStoneSize, getStoneSize, xmlelement, mode); 73 75 XMLPortParam(TetrisCenterpoint, "stoneTemplate", setStoneTemplate, getStoneTemplate, xmlelement, mode); 76 XMLPortParam(TetrisCenterpoint, "brickTemplate", setBrickTemplate, getBrickTemplate, xmlelement, mode); 74 77 XMLPortParam(TetrisCenterpoint, "stoneSpeed", setStoneSpeed, getStoneSpeed, xmlelement, mode); 75 78 } -
code/trunk/src/modules/tetris/TetrisCenterpoint.h
r8706 r9348 45 45 46 46 namespace orxonox 47 { 47 {//idea: add 2 triggers to the centerpoint (one to determine when a box would go above the centerpoint; 48 //the other to find out when the lowest row is filled totally) 48 49 49 50 /** … … 118 119 119 120 /** 121 @brief Set the template for the bricks. 122 @param template The template name to be applied to each brick. 123 */ 124 void setBrickTemplate(const std::string& templateName) 125 { this->brickTemplate_ = templateName; } 126 /** 127 @brief Get the template for the bricks. 128 @return Returns the template name to be applied to each brick. 129 */ 130 const std::string& getBrickTemplate(void) const 131 { return this->brickTemplate_; } 132 133 /** 120 134 @brief Set the speed of the stones. 121 135 @param speed The speed to be set. … … 137 151 float stoneSize_; 138 152 std::string stoneTemplate_; 153 std::string brickTemplate_; 139 154 float stoneSpeed_; 140 155 -
code/trunk/src/modules/tetris/TetrisPrereqs.h
r8706 r9348 68 68 class TetrisCenterpoint; 69 69 class TetrisStone; 70 class TetrisBrick; 71 class TetrisScore; 70 72 } 71 73 -
code/trunk/src/modules/tetris/TetrisStone.cc
r8706 r9348 30 30 @file TetrisStone.cc 31 31 @brief Implementation of the TetrisStone class. 32 @ingroup Tetris 32 33 */ 33 34 … … 47 48 Constructor. Registers and initializes the object. 48 49 */ 49 TetrisStone::TetrisStone(BaseObject* creator) : ControllableEntity(creator)50 TetrisStone::TetrisStone(BaseObject* creator) : MovableEntity(creator) 50 51 { 51 52 RegisterObject(TetrisStone); 52 53 53 54 this->size_ = 10.0f; 54 55 this->delay_ = false; 55 56 this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this))); 57 this->lockRotation_ = false; 58 56 59 } 57 60 … … 64 67 void TetrisStone::moveFrontBack(const Vector2& value) 65 68 { 66 if(value.x < 0) 69 if(value.x < 0) //speedup on key down 67 70 { 68 71 this->setVelocity(this->getVelocity()*1.1); 72 } 73 else if(!this->lockRotation_) //rotate when key up is pressed 74 { 75 this->lockRotation_ = true; // multiple calls of this function have to be filtered out. 76 this->rotationTimer_.setTimer(0.1f, false, createExecutor(createFunctor(&TetrisStone::unlockRotation, this))); 77 Quaternion q(Degree(90), Vector3::UNIT_Z); 78 this->setOrientation(this->getOrientation()*q); //rotation: roll 90° 79 69 80 } 70 81 } -
code/trunk/src/modules/tetris/TetrisStone.h
r8706 r9348 38 38 #include "tetris/TetrisPrereqs.h" 39 39 40 #include "worldentities/ ControllableEntity.h"40 #include "worldentities/MovableEntity.h" 41 41 #include "tools/Timer.h" 42 42 … … 51 51 @ingroup Tetris 52 52 */ 53 class _TetrisExport TetrisStone : public ControllableEntity53 class _TetrisExport TetrisStone : public MovableEntity 54 54 { 55 55 public: … … 81 81 void enableMovement(void) 82 82 { this->delay_ = false; } 83 83 void unlockRotation(void) 84 { this->lockRotation_ = false; } 85 84 86 float size_; //!< The dimensions a stone has in the game world. 85 87 bool delay_; 88 bool lockRotation_; 86 89 Timer delayTimer_; 90 Timer rotationTimer_; ///!< This timer is used to filter out multiple rotation inputs. 87 91 88 92 Tetris* tetris_; -
code/trunk/src/modules/weapons/RocketController.cc
r8858 r9348 53 53 this->rocket_ = new SimpleRocket(this); 54 54 this->rocket_->setController(this); 55 this->setControllableEntity( dynamic_cast<ControllableEntity*>(this->rocket_));55 this->setControllableEntity(orxonox_cast<ControllableEntity*>(this->rocket_)); 56 56 } 57 57 -
code/trunk/src/orxonox/CMakeLists.txt
r8858 r9348 50 50 ADD_SUBDIRECTORY(items) 51 51 ADD_SUBDIRECTORY(overlays) 52 ADD_SUBDIRECTORY(pickup)53 52 ADD_SUBDIRECTORY(sound) 54 53 ADD_SUBDIRECTORY(weaponsystem) -
code/trunk/src/orxonox/CameraManager.cc
r8079 r9348 48 48 CameraManager::CameraManager() 49 49 { 50 RegisterRootObject(CameraManager); 51 50 52 assert(GameMode::showsGraphics()); 51 53 } -
code/trunk/src/orxonox/LevelInfo.cc
r9016 r9348 42 42 43 43 // LevelInfoItem 44 44 45 45 //! The list of allowed tags. 46 46 /*static*/ std::set<std::string> LevelInfoItem::possibleTags_s = std::set<std::string>(); … … 93 93 LevelInfoItem::possibleTags_s.insert("gametype"); 94 94 LevelInfoItem::possibleTags_s.insert("minigame"); 95 LevelInfoItem::possibleTags_s.insert("shipselection"); 95 96 } 96 97 } … … 106 107 SubString substr = SubString(tags, ",", " "); // Split the string into tags. 107 108 const std::vector<std::string>& strings = substr.getAllStrings(); 109 for (std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++) 110 this->addTag(*it, false); 111 112 this->tagsUpdated(); 113 } 114 /** 115 @brief 116 Set the starting ship models of the level 117 @param tags 118 A comma-seperated string of all the allowed ship models for the shipselection. 119 */ 120 void LevelInfoItem::setStartingShips(const std::string& ships) 121 { 122 SubString substr = SubString(ships, ",", " "); // Split the string into tags. 123 const std::vector<std::string>& strings = substr.getAllStrings(); 108 124 for(std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++) 109 this->add Tag(*it, false);110 111 this-> tagsUpdated();125 this->addStartingShip(*it, false); 126 127 this->startingshipsUpdated(); 112 128 } 113 129 … … 137 153 /** 138 154 @brief 155 Add a ship model to allowed models for the shipselection 156 @param ship 157 The ship model to be added. 158 @param update 159 Whether the comma-seperated string of all ship models should be updated. Default is true. 160 @return 161 Returns true if the ship was successfully added, if the ship was already present it returns false. 162 */ 163 bool LevelInfoItem::addStartingShip(const std::string& ship, bool update) 164 { 165 bool success = this->startingShips_.insert(ship).second; 166 if(update && success) 167 this->startingshipsUpdated(); 168 169 return success; 170 } 171 172 173 /** 174 @brief 139 175 Updates the comma-seperated string of all tags, if the set of tags has changed. 140 176 */ … … 155 191 } 156 192 193 /** 194 @brief 195 Updates the comma-seperated string of all ships, if the set of tags has changed. 196 */ 197 void LevelInfoItem::startingshipsUpdated(void) 198 { 199 std::stringstream stream; 200 std::set<std::string>::iterator temp; 201 for(std::set<std::string>::iterator it = this->startingShips_.begin(); it != this->startingShips_.end(); ) 202 { 203 temp = it; 204 if(++it == this->startingShips_.end()) // If this is the last ship we don't add a comma. 205 stream << *temp; 206 else 207 stream << *temp << ", "; 208 } 209 210 this->startingShipsString_ = std::string(stream.str()); 211 } 212 213 void LevelInfoItem::changeStartingShip(const std::string& model) 214 { 215 static std::string shipSelectionTag = "shipselection"; 216 //HACK: Read Level XML File, find "shipselection", replace with ship model 217 std::string levelPath = "../levels/"; 218 levelPath.append(this->getXMLFilename()); 219 std::string tempPath = "../levels/"; 220 tempPath.append("_temp.oxw"); 221 orxout(user_status) << levelPath << endl; 222 orxout(user_status) << tempPath << endl; 223 std::ifstream myLevel (levelPath.c_str()); 224 std::ofstream tempLevel (tempPath.c_str()); 225 while(!myLevel.eof()) 226 { 227 std::string buff; 228 std::getline(myLevel, buff); 229 std::string pawndesignString = "pawndesign="; 230 size_t found = buff.find(pawndesignString.append(shipSelectionTag)); 231 if (found!= std::string::npos) 232 buff = buff.substr(0, found + 11) + model + buff.substr(found+11+shipSelectionTag.length(), std::string::npos); 233 tempLevel.write(buff.c_str(), buff.length()); 234 tempLevel << std::endl; 235 } 236 myLevel.close(); 237 tempLevel.close(); 238 orxout(user_status) << "done" << endl; 239 } 240 241 157 242 // LevelInfo 158 243 … … 192 277 XMLPortParam(LevelInfo, "screenshot", setScreenshot, getScreenshot, xmlelement, mode); 193 278 XMLPortParam(LevelInfo, "tags", setTags, getTags, xmlelement, mode); 279 XMLPortParam(LevelInfo, "startingships", setStartingShips, getStartingShips, xmlelement, mode); 194 280 } 195 281 … … 207 293 info->setScreenshot(this->getScreenshot()); 208 294 info->setTags(this->getTags()); 295 info->setStartingShips(this->getStartingShips()); 209 296 return info; 210 297 } -
code/trunk/src/orxonox/LevelInfo.h
r9016 r9348 43 43 44 44 #include "core/BaseObject.h" 45 #include <iostream> 46 #include <fstream> 45 47 #include "core/OrxonoxClass.h" 46 48 … … 77 79 */ 78 80 inline const std::string& getName(void) const { return this->name_; } // tolua_export 79 81 80 82 /** 81 83 @brief Set the screenshot of the Level. … … 116 118 inline bool hasTag(const std::string& tag) const { return this->tags_.find(tag) != this->tags_.end(); } // tolua_export 117 119 120 void setStartingShips(const std::string& ships); //!< Set the starting ship models of the level 121 bool addStartingShip(const std::string& ship, bool update = true); //!< Add a model to shipselection 122 /** 123 @brief Get the set of starting ship models the Level allows 124 @return Returns a comma-seperated string of all the allowed ship models for the shipselection. 125 */ 126 inline const std::string& getStartingShips(void) const 127 { return this->startingShipsString_; } 128 /** 129 @brief Get whether the Level allows a specific starting ship model 130 @param ship The ship model for which is checked. 131 @return Returns true if the Level allows the input ship model 132 */ 133 inline bool hasStartingShip(const std::string& ship) const { return this->startingShips_.find(ship) != this->startingShips_.end(); } // tolua_export 134 inline void selectStartingShip(const std::string& ship) { this->changeStartingShip(ship); } // tolua_export 118 135 /** 119 136 @brief Get the XML-filename of the Level. … … 122 139 inline const std::string& getXMLFilename(void) const { return this->xmlfilename_; } // tolua_export 123 140 141 124 142 protected: 125 143 /** … … 133 151 134 152 private: 153 void changeStartingShip (const std::string& model); 154 void startingshipsUpdated(void); //!< Updates the comma-seperated string of all possible starting ships. 135 155 void tagsUpdated(void); //!< Updates the comma-seperated string of all tags, if the set of tags has changed. 136 137 156 static void initializeTags(void); //!< Initialize the set of allowed tags. 138 157 /** … … 152 171 std::set<std::string> tags_; //!< The set of tags the Level is tagged with. 153 172 std::string tagsString_; //!< The comma-seperated string of all the tags the Level is tagged with. 173 std::set<std::string> startingShips_; //!< The set of starting ship models the Level allows. 174 std::string startingShipsString_; //!< The comma-seperated string of all the allowed ship models for the shipselection. 154 175 }; // tolua_export 155 176 … … 161 182 - @b description The description of the level. 162 183 - @b screenshot The screenshot of the level. 163 - @b tags A comma-seperated string of tags. Allowed tags are: <em>test</em>, <em>singleplayer</em>, <em>multiplayer</em>, <em>showcase</em>, <em>tutorial</em>, <em>presentation</em> .164 184 - @b tags A comma-seperated string of tags. Allowed tags are: <em>test</em>, <em>singleplayer</em>, <em>multiplayer</em>, <em>showcase</em>, <em>tutorial</em>, <em>presentation</em>, <em>shipselection</em>. 185 - @b (optional) startingships The comma-seperated string of starting ship models 165 186 An example would be: 166 187 @code … … 176 197 @author 177 198 Damian 'Mozork' Frick 178 199 @edit 200 Matthias Hutter 179 201 @ingroup Orxonox 180 202 */ … … 186 208 187 209 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a LevelInfo object through XML. 188 210 189 211 /** 190 212 @brief Set the screenshot of the Level. … … 223 245 inline const std::string& getTags(void) const 224 246 { return this->LevelInfoItem::getTags(); } 247 /** 248 @brief Set the starting ship models of the level 249 @param A comma-seperated string of all the allowed ship models for the shipselection. 250 */ 251 inline void setStartingShips(const std::string& ships) 252 { this->LevelInfoItem::setStartingShips(ships); } 253 /** 254 @brief Get the starting ship models of the level 255 @return Returns a comma-seperated string of all the allowed ship models for the shipselection. 256 */ 257 inline const std::string& getStartingShips(void) const 258 { return this->LevelInfoItem::getStartingShips(); } 225 259 226 260 LevelInfoItem* copy(void); //!< Copies the contents of this LevelInfo object to a new LevelInfoItem object. 227 228 261 }; 229 262 … … 243 276 } 244 277 }; 245 278 246 279 } // tolua_export 247 280 -
code/trunk/src/orxonox/OrxonoxPrereqs.h
r8858 r9348 109 109 class TeamDeathmatch; 110 110 class UnderAttack; 111 class TeamGametype; 111 112 112 113 // graphics … … 150 151 class OrxonoxOverlay; 151 152 class OverlayGroup; 152 153 // pickup154 class PickupIdentifier;155 153 156 154 //sound -
code/trunk/src/orxonox/Scene.cc
r8858 r9348 258 258 void Scene::setSkybox(const std::string& skybox) 259 259 { 260 if (GameMode::showsGraphics() && this->sceneManager_) 261 this->sceneManager_->setSkyBox(true, skybox); 260 try 261 { 262 if (GameMode::showsGraphics() && this->sceneManager_) 263 this->sceneManager_->setSkyBox(true, skybox); 264 } 265 catch (const Ogre::Exception&) 266 { 267 orxout(internal_error) << "Could not load skybox '" << skybox << "':" << endl; 268 orxout(internal_error) << Exception::handleMessage() << endl; 269 } 262 270 263 271 this->skybox_ = skybox; -
code/trunk/src/orxonox/controllers/FormationController.cc
- Property svn:eol-style set to native
r9265 r9348 50 50 { 51 51 52 SetConsoleCommand("FormationController", "formationflight", &FormationController::formationflight);53 SetConsoleCommand("FormationController", "masteraction", &FormationController::masteraction);54 SetConsoleCommand("FormationController", "followme", &FormationController::followme);55 SetConsoleCommand("FormationController", "passivebehaviour", &FormationController::passivebehaviour);56 SetConsoleCommand("FormationController", "formationsize", &FormationController::formationsize);57 58 59 60 61 static const unsigned int STANDARD_MAX_FORMATION_SIZE = 9;62 static const int RADIUS_TO_SEARCH_FOR_MASTERS = 5000;63 static const float FORMATION_LENGTH = 110;64 static const float FORMATION_WIDTH = 110;65 static const int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy66 static const float SPEED_MASTER = 0.6f;67 static const float ROTATEFACTOR_MASTER = 0.2f;68 static const float SPEED_FREE = 0.8f;69 static const float ROTATEFACTOR_FREE = 0.8f;70 71 FormationController::FormationController(BaseObject* creator) : Controller(creator)72 {52 SetConsoleCommand("FormationController", "formationflight", &FormationController::formationflight); 53 SetConsoleCommand("FormationController", "masteraction", &FormationController::masteraction); 54 SetConsoleCommand("FormationController", "followme", &FormationController::followme); 55 SetConsoleCommand("FormationController", "passivebehaviour", &FormationController::passivebehaviour); 56 SetConsoleCommand("FormationController", "formationsize", &FormationController::formationsize); 57 58 59 60 61 static const unsigned int STANDARD_MAX_FORMATION_SIZE = 9; 62 static const int RADIUS_TO_SEARCH_FOR_MASTERS = 5000; 63 static const float FORMATION_LENGTH = 110; 64 static const float FORMATION_WIDTH = 110; 65 static const int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy 66 static const float SPEED_MASTER = 0.6f; 67 static const float ROTATEFACTOR_MASTER = 0.2f; 68 static const float SPEED_FREE = 0.8f; 69 static const float ROTATEFACTOR_FREE = 0.8f; 70 71 FormationController::FormationController(BaseObject* creator) : Controller(creator) 72 { 73 73 RegisterObject(FormationController); 74 74 … … 91 91 this->team_=-1; 92 92 this->target_.setCallback(createFunctor(&FormationController::targetDied, this)); 93 }94 95 FormationController::~FormationController()96 {97 if (this->isInitialized())93 } 94 95 FormationController::~FormationController() 96 { 97 if (this->isInitialized()) 98 98 { 99 99 this->removeFromFormation(); … … 123 123 } 124 124 } 125 }126 127 void FormationController::XMLPort(Element& xmlelement, XMLPort::Mode mode)125 } 126 127 void FormationController::XMLPort(Element& xmlelement, XMLPort::Mode mode) 128 128 { 129 129 SUPER(FormationController, XMLPort, xmlelement, mode); … … 137 137 138 138 139 /**139 /** 140 140 @brief Activates / deactivates formationflight behaviour 141 141 @param form activate formflight if form is true 142 142 */ 143 void FormationController::formationflight(const bool form)143 void FormationController::formationflight(const bool form) 144 144 { 145 145 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it) … … 168 168 } 169 169 170 /**170 /** 171 171 @brief Get all masters to do a "specific master action" 172 172 @param action which action to perform (integer, so it can be called with a console command (tmp solution)) … … 198 198 } 199 199 200 /**200 /** 201 201 @brief Sets shooting behaviour of pawns. 202 202 @param passive if true, bots won't shoot. … … 225 225 } 226 226 227 /**227 /** 228 228 @brief Sets maximal formation size 229 229 @param size maximal formation size. … … 280 280 } 281 281 282 Vector2 coord = get2DView direction(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);282 Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target); 283 283 float distance = (target - this->getControllableEntity()->getPosition()).length(); 284 284 float rotateX = clamp(coord.x * 10, -1.0f, 1.0f); 285 float rotateY = clamp(coord.y * 10, -1.0f, 1.0f); 285 286 286 287 if(this->state_ == FREE) … … 289 290 { 290 291 // Multiply with ROTATEFACTOR_FREE to make them a bit slower 291 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);292 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);293 } 294 295 if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength())292 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * rotateX); 293 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * rotateY); 294 } 295 296 if (this->target_ && distance < 200 && this->getControllableEntity()->getVelocity().squaredLength() > this->target_->getVelocity().squaredLength()) 296 297 { 297 298 this->getControllableEntity()->moveFrontBack(-0.05f); // They don't brake with full power to give the player a chance … … 305 306 if (this->target_ || distance > 10) 306 307 { 307 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);308 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);308 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_MASTER * rotateX); 309 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_MASTER * rotateY); 309 310 } 310 311 … … 320 321 { 321 322 322 this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * sgn(coord.x) * coord.x*coord.x);323 this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * sgn(coord.y) * coord.y*coord.y);323 this->getControllableEntity()->rotateYaw(-2.0f * ROTATEFACTOR_MASTER * rotateX); 324 this->getControllableEntity()->rotatePitch(2.0f * ROTATEFACTOR_MASTER * rotateY); 324 325 325 326 if (distance < 300) 326 327 { 327 328 329 330 328 if (bHasTargetOrientation_) 329 { 330 copyTargetOrientation(); 331 } 331 332 if (distance < 100) 332 { 333 { //linear speed reduction 333 334 this->getControllableEntity()->moveFrontBack(distance/100.0f*0.4f*SPEED_MASTER); 334 335 } else this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER); 336 337 } else { 335 } 336 else 337 this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER); 338 } 339 else 338 340 this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER + distance/300.0f); 339 }340 341 } 341 342 … … 343 344 { 344 345 this->positionReached(); 345 346 } 347 } 348 349 350 351 void FormationController::moveToTargetPosition()346 bHasTargetOrientation_=false; 347 } 348 } 349 350 351 352 void FormationController::moveToTargetPosition() 352 353 { 353 354 this->moveToPosition(this->targetPosition_); 354 355 } 355 356 356 //copy the Roll orientation of given Quaternion.357 void FormationController::copyOrientation(const Quaternion& orient)357 //copy the Roll orientation of given Quaternion. 358 void FormationController::copyOrientation(const Quaternion& orient) 358 359 { 359 360 //roll angle difference in radian … … 373 374 374 375 375 /**376 /** 376 377 @brief Unregisters a slave from its master. Initiated by a slave. 377 378 */ … … 463 464 } 464 465 } 465 /** 466 467 /** 466 468 @brief Commands the slaves of a master into a formation. Sufficiently fast not to be called within tick. Initiated by a master. 467 469 */ 468 469 void FormationController::commandSlaves() 470 void FormationController::commandSlaves() 470 471 { 471 472 if(this->state_ != MASTER) return; … … 481 482 } 482 483 else 483 484 // formation: 484 485 { 485 486 dest += 1.0f*orient*WorldEntity::BACK; 486 487 Vector3 pos = Vector3::ZERO; 487 488 bool left=true; 488 489 int i = 1; 489 490 … … 683 684 684 685 if (specificMasterActionHoldCount_ == 0) 685 686 { 686 687 this->specificMasterAction_ = NONE; 687 688 this->searchNewTarget(); 688 } 689 else specificMasterActionHoldCount_--; 689 } 690 else 691 specificMasterActionHoldCount_--; 690 692 } 691 693 … … 711 713 void FormationController::turn180() 712 714 { 713 714 715 716 717 718 715 Vector2 coord = get2DViewdirection(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, this->targetPosition_); 716 717 this->getControllableEntity()->rotateYaw(-2.0f * sgn(coord.x) * coord.x*coord.x); 718 this->getControllableEntity()->rotatePitch(2.0f * sgn(coord.y) * coord.y*coord.y); 719 720 this->getControllableEntity()->moveFrontBack(SPEED_MASTER); 719 721 } 720 722 … … 734 736 void FormationController::spin() 735 737 { 736 737 738 this->moveToTargetPosition(); 739 this->getControllableEntity()->rotateRoll(0.8f); 738 740 } 739 741 … … 773 775 if((humanPawn != NULL) && (allMasters.size() != 0)) 774 776 { 775 float posHuman = humanPawn->getPosition().length(); 776 float distance = 0.0f; 777 float minDistance = FLT_MAX; 778 int index = 0; 779 int i = 0; 780 781 for(std::vector<FormationController*>::iterator it = allMasters.begin(); it != allMasters.end(); it++, i++) 782 { 783 if (!FormationController::sameTeam((*it)->getControllableEntity(), humanPawn, (*it)->getGametype())) continue; 784 distance = posHuman - (*it)->getControllableEntity()->getPosition().length(); 785 if(distance < minDistance) index = i; 786 } 787 allMasters[index]->followInit(humanPawn); 788 } 789 790 } 791 792 793 794 777 float posHuman = humanPawn->getPosition().length(); 778 float distance = 0.0f; 779 float minDistance = FLT_MAX; 780 int index = 0; 781 int i = 0; 782 783 for(std::vector<FormationController*>::iterator it = allMasters.begin(); it != allMasters.end(); it++, i++) 784 { 785 if (!FormationController::sameTeam((*it)->getControllableEntity(), humanPawn, (*it)->getGametype())) continue; 786 distance = posHuman - (*it)->getControllableEntity()->getPosition().length(); 787 if(distance < minDistance) index = i; 788 } 789 allMasters[index]->followInit(humanPawn); 790 } 791 } 795 792 796 793 /** … … 814 811 } 815 812 816 /**813 /** 817 814 @brief Master begins to follow a randomly chosen human player of the same team. Is a "specific master action". 818 815 */ … … 842 839 843 840 844 /**841 /** 845 842 @brief Master follows target with adjusted speed. Called within tick. 846 843 */ … … 854 851 855 852 856 void FormationController::setTargetPosition(const Vector3& target)853 void FormationController::setTargetPosition(const Vector3& target) 857 854 { 858 855 this->targetPosition_ = target; … … 918 915 } 919 916 920 void FormationController::forgetTarget()917 void FormationController::forgetTarget() 921 918 { 922 919 this->target_ = 0; … … 924 921 } 925 922 926 void FormationController::targetDied()923 void FormationController::targetDied() 927 924 { 928 925 this->forgetTarget(); … … 930 927 } 931 928 932 bool FormationController::sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype)929 bool FormationController::sameTeam(ControllableEntity* entity1, ControllableEntity* entity2, Gametype* gametype) 933 930 { 934 931 if (entity1 == entity2) … … 1054 1051 return; 1055 1052 1056 Vector2 coord = get2DView direction(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target);1053 Vector2 coord = get2DViewcoordinates(this->getControllableEntity()->getPosition(), this->getControllableEntity()->getOrientation() * WorldEntity::FRONT, this->getControllableEntity()->getOrientation() * WorldEntity::UP, target); 1057 1054 float distance = (target - this->getControllableEntity()->getPosition()).length(); 1058 1055 … … 1060 1057 { 1061 1058 // Multiply with ROTATEFACTOR_FREE to make them a bit slower 1062 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * sgn(coord.x) * coord.x*coord.x);1063 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * sgn(coord.y) * coord.y*coord.y);1059 this->getControllableEntity()->rotateYaw(-1.0f * ROTATEFACTOR_FREE * clamp(coord.x * 10, -1.0f, 1.0f)); 1060 this->getControllableEntity()->rotatePitch(ROTATEFACTOR_FREE * clamp(coord.y * 10, -1.0f, 1.0f)); 1064 1061 this->getControllableEntity()->moveFrontBack(SPEED_FREE); 1065 1062 } -
code/trunk/src/orxonox/controllers/FormationController.h
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/controllers/NewHumanController.cc
r9016 r9348 298 298 //Used in HumanController for formationFlight 299 299 HumanController::hit(originator,contactpoint,damage); 300 300 301 301 if (this->showDamageOverlay_ && !this->controlPaused_ && this->controllableEntity_ && !this->controllableEntity_->isInMouseLook()) 302 302 { … … 397 397 try 398 398 { 399 wePtr = dynamic_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny()));399 wePtr = orxonox_cast<WorldEntity*>(Ogre::any_cast<OrxonoxClass*>(itr->movable->getUserAny())); 400 400 } 401 401 catch (...) -
code/trunk/src/orxonox/gamestates/GSRoot.cc
r8858 r9348 76 76 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it) 77 77 { 78 if (dynamic_cast<Synchronisable*>(*it)) 79 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << " id: " << dynamic_cast<Synchronisable*>(*it)->getObjectID() << endl; 78 Synchronisable* synchronisable = orxonox_cast<Synchronisable*>(*it); 79 if (synchronisable) 80 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl; 80 81 else 81 82 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << endl; -
code/trunk/src/orxonox/gametypes/Deathmatch.cc
r8858 r9348 114 114 } 115 115 116 void Deathmatch::playerScored(PlayerInfo* player )116 void Deathmatch::playerScored(PlayerInfo* player, int score) 117 117 { 118 Gametype::playerScored(player );118 Gametype::playerScored(player, score); 119 119 120 120 if (player) -
code/trunk/src/orxonox/gametypes/Deathmatch.h
r5781 r9348 48 48 49 49 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 50 virtual void playerScored(PlayerInfo* player );50 virtual void playerScored(PlayerInfo* player, int score = 1); 51 51 }; 52 52 } -
code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
r8858 r9348 31 31 //Low; Codeoptimierung und Dokumentation 32 32 33 /* 34 short gaming manual: 35 There are three different parties a player can belong to: victim, chaser or killer 36 Every player starts as chaser. As long as there are not enough victims and killers, you can change your and other player's parties by shooting them. 37 In order to win you have to earn as much points as possible: 38 - as victim by escaping the chasers 39 - as chaser by shooting the victim 40 - as killer by killing the chasers 41 42 43 What you shouldn't do is shooting at players of your own party. By doing so your score will decrease. 44 P.S: If you don't want to be a victim: Get rid of your part by shooting a chaser. 33 /** 34 @brief 35 Short Gaming Manual: 36 There are three different parties a player can belong to: victim, chaser or killer 37 Every player starts as chaser. As long as there are not enough victims and killers, you can change your and other player's parties by shooting them. 38 In order to win you have to earn as much points as possible: 39 - as victim by escaping the chasers 40 - as chaser by shooting the victim 41 - as killer by killing the chasers 42 43 44 What you shouldn't do is shooting at players of your own party. By doing so your score will decrease. 45 P.S: If you don't want to be a victim: Get rid of your part by shooting a chaser. 45 46 */ 46 47 #include "Dynamicmatch.h" … … 81 82 this->numberOf[killer]=0; 82 83 this->tutorial=true; 83 this->pointsPerTime= 0.0f;84 this->pointsPerTime=1.0f; 84 85 this->setHUDTemplate("DynamicmatchHUD"); 85 86 } … … 95 96 ColourValue(0.3f, 0.3f, 1.0f), //piggycolour 96 97 ColourValue(0.3f, 1.0f, 0.3f) //killercolour what about black: 0.0f, 0.0f, 0.0f 97 98 98 }; 99 99 static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue)); … … 111 111 if (victim && victim->getPlayer()) //&& originator && originator->getPlayer() ?? 112 112 { 113 int target= playerParty_[victim->getPlayer()];114 int source= playerParty_[originator->getPlayer()];113 int target = playerParty_[victim->getPlayer()]; 114 int source = playerParty_[originator->getPlayer()]; 115 115 116 116 //Case: Not Enough Pigs: party change (= party management) … … 151 151 152 152 //Give new pig boost 153 SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);153 SpaceShip* spaceship = orxonox_cast<SpaceShip*>(victim); 154 154 this->grantPigBoost(spaceship); 155 155 } … … 245 245 } 246 246 //Give new pig boost 247 SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);247 SpaceShip* spaceship = orxonox_cast<SpaceShip*>(victim); 248 248 this->grantPigBoost(spaceship); 249 249 } … … 276 276 else if (friendlyfire && (source == target)) 277 277 { 278 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer()); 279 if (it != this->players_.end()) 280 { 281 it->second.frags_--; 282 } 283 } 284 }// from far far away not to be removed! 278 this->playerScored(originator->getPlayer(), -1); 279 } 280 } 285 281 return false; //default: no damage 286 282 } … … 296 292 if (playerParty_[originator->getPlayer()] == killer) //reward the killer 297 293 { 298 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(originator->getPlayer()); 299 if (it != this->players_.end()) 300 { 301 it->second.frags_+=20; //value must be tested 302 } 303 } 304 return true; 294 this->playerScored(originator->getPlayer(), 25); 295 } 296 return true; 305 297 } 306 298 else return false; … … 309 301 /** 310 302 @brief 311 Grant the piggya boost.303 Grant the victim a boost. 312 304 @param spaceship 313 305 The SpaceShip to give the boost. … … 315 307 void Dynamicmatch::grantPigBoost(SpaceShip* spaceship) 316 308 { 317 // Give pigboost309 // Give victim boost 318 310 if (spaceship) 319 311 { 312 WeakPtr<SpaceShip>* ptr = new WeakPtr<SpaceShip>(spaceship); 313 if(ptr == NULL) 314 return; 320 315 spaceship->addSpeedFactor(5); 321 WeakPtr<SpaceShip>* ptr = new WeakPtr<SpaceShip>(spaceship);322 316 ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this)); 323 317 executor->setDefaultValue(0, ptr); … … 374 368 375 369 if (this->hasStarted() && !gameEnded_) 376 { pointsPerTime =pointsPerTime + dt; 377 gameTime_ = gameTime_ - dt; 378 if (pointsPerTime > 2.0f)//hard coded!! should be changed 379 { 380 pointsPerTime=0.0f; 370 { 371 pointsPerTime = pointsPerTime + dt; //increase points 372 gameTime_ = gameTime_ - dt; // decrease game time 373 if (pointsPerTime > 2.0f) //hard coded points for victim! should be changed 374 { 375 pointsPerTime = 0.0f; 381 376 rewardPig(); 382 377 } … … 408 403 } 409 404 405 /** 406 @brief The reward function is called every 2 seconds via the tick function and makes the victim score points. 407 */ 410 408 void Dynamicmatch::rewardPig() 411 409 { 412 410 for (std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden 413 411 { 414 if (it->second==piggy) 415 { 416 //Spieler mit der Pig-party frags++ 417 std::map<PlayerInfo*, Player>::iterator it2 = this->players_.find(it->first);// still not sure if right syntax 418 if (it2 != this->players_.end()) 419 { 420 it2->second.frags_++; 421 } 412 if (it->second==piggy)//Spieler mit der Pig-party frags++ 413 { 414 this->playerScored(it->first); 422 415 } 423 416 } … … 426 419 { 427 420 std::map<PlayerInfo*, int>::const_iterator it_player = this->playerParty_.find(player); 428 Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());421 Pawn* pawn = orxonox_cast<Pawn*>(player->getControllableEntity()); 429 422 if (pawn) 430 423 { … … 446 439 { 447 440 //pigs: 1 + every 6th player is a pig 448 if ( (1 +this->getNumberOfPlayers()/6) > numberOf[piggy])441 if ( (1 + getPlayerCount()/6) > numberOf[piggy]) 449 442 { 450 443 notEnoughPigs=true; … … 495 488 } 496 489 //killers: every 4th player is a killer 497 if ( getNumberOfPlayers()/4> numberOf[killer])490 if ( static_cast<unsigned int>(getPlayerCount()/4) > numberOf[killer]) 498 491 { 499 492 notEnoughKillers=true; -
code/trunk/src/orxonox/gametypes/Dynamicmatch.h
r8727 r9348 81 81 SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const; 82 82 83 83 84 protected: 85 inline int getPlayerCount() const 86 { return this->numberOf[chaser] + numberOf[piggy] + this->numberOf[killer]; } 84 87 85 88 std::map< PlayerInfo*, int > playerParty_; //player's parties are recorded here -
code/trunk/src/orxonox/gametypes/Gametype.cc
r9261 r9348 301 301 } 302 302 303 void Gametype::playerScored(PlayerInfo* player )303 void Gametype::playerScored(PlayerInfo* player, int score) 304 304 { 305 305 std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player); 306 306 if (it != this->players_.end()) 307 it->second.frags_ ++;307 it->second.frags_ += score; 308 308 } 309 309 -
code/trunk/src/orxonox/gametypes/Gametype.h
r9260 r9348 90 90 virtual bool playerChangedName(PlayerInfo* player); 91 91 92 virtual void playerScored(PlayerInfo* player );92 virtual void playerScored(PlayerInfo* player, int score = 1); 93 93 94 94 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0); … … 153 153 virtual void resetTimer(float t); 154 154 155 /** 156 @brief Get number of Players in game. 157 */ 155 158 inline unsigned int getNumberOfPlayers() const 156 { return this->gtinfo_->getNumberOfPlayers(); } 159 { return this->players_.size(); } 160 161 157 162 158 163 protected: -
code/trunk/src/orxonox/gametypes/LastManStanding.cc
r8858 r9348 211 211 if(!player->getControllableEntity()) 212 212 return; 213 Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());213 Pawn* pawn = orxonox_cast<Pawn*>(player->getControllableEntity()); 214 214 if(!pawn) 215 215 return; -
code/trunk/src/orxonox/gametypes/LastTeamStanding.cc
r8858 r9348 283 283 if(!player->getControllableEntity()) 284 284 return; 285 Pawn* pawn = dynamic_cast<Pawn*>(player->getControllableEntity());285 Pawn* pawn = orxonox_cast<Pawn*>(player->getControllableEntity()); 286 286 if(!pawn) 287 287 return; -
code/trunk/src/orxonox/gametypes/Mission.cc
- Property svn:eol-style set to native
r9016 r9348 63 63 { 64 64 this->missionAccomplished_ = false; 65 65 this->end(); 66 66 } 67 67 } … … 78 78 { 79 79 Gametype::end(); 80 /*if (this->missionAccomplished_) 80 /*if (this->missionAccomplished_) 81 81 this->gtinfo_->sendAnnounceMessage("Mission accomplished!"); 82 82 else 83 83 this->gtinfo_->sendAnnounceMessage("Mission failed!"); 84 **/84 */ 85 85 } 86 86 -
code/trunk/src/orxonox/gametypes/Mission.h
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/gametypes/TeamBaseMatch.cc
r8952 r9348 128 128 129 129 // collect Points for killing oppenents 130 void TeamBaseMatch::playerScored(PlayerInfo* player )130 void TeamBaseMatch::playerScored(PlayerInfo* player, int score) 131 131 { 132 132 int teamnr = this->getTeam(player); -
code/trunk/src/orxonox/gametypes/TeamBaseMatch.h
r5929 r9348 47 47 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator); 48 48 49 virtual void playerScored(PlayerInfo* player );49 virtual void playerScored(PlayerInfo* player, int score = 1); 50 50 virtual void showPoints(); 51 51 virtual void endGame(); -
code/trunk/src/orxonox/gametypes/TeamDeathmatch.cc
r7182 r9348 30 30 31 31 #include "core/CoreIncludes.h" 32 #include "core/ConfigValueIncludes.h" 33 #include "interfaces/TeamColourable.h" 34 #include "worldentities/TeamSpawnPoint.h" 32 #include "chat/ChatManager.h" 33 #include "infos/PlayerInfo.h" 35 34 #include "worldentities/pawns/Pawn.h" 36 35 … … 39 38 CreateUnloadableFactory(TeamDeathmatch); 40 39 41 TeamDeathmatch::TeamDeathmatch(BaseObject* creator) : Deathmatch(creator)40 TeamDeathmatch::TeamDeathmatch(BaseObject* creator) : TeamGametype(creator) 42 41 { 43 42 RegisterObject(TeamDeathmatch); 44 45 this->teams_ = 2;46 47 this->setConfigValues();48 43 } 49 44 50 void TeamDeathmatch::s etConfigValues()45 void TeamDeathmatch::start() 51 46 { 52 SetConfigValue(teams_, 2);47 TeamGametype::start(); 53 48 54 static ColourValue colours[] = 55 { 56 ColourValue(1.0f, 0.3f, 0.3f), 57 ColourValue(0.3f, 0.3f, 1.0f), 58 ColourValue(0.3f, 1.0f, 0.3f), 59 ColourValue(1.0f, 1.0f, 0.0f) 60 }; 61 static std::vector<ColourValue> defaultcolours(colours, colours + sizeof(colours) / sizeof(ColourValue)); 49 std::string message("The match has started!"); 50 ChatManager::message(message); 51 } 62 52 63 SetConfigValue(teamcolours_, defaultcolours); 53 void TeamDeathmatch::end() 54 { 55 TeamGametype::end(); 56 57 std::string message("The match has ended."); 58 ChatManager::message(message); 64 59 } 65 60 66 61 void TeamDeathmatch::playerEntered(PlayerInfo* player) 67 62 { 68 Deathmatch::playerEntered(player);63 TeamGametype::playerEntered(player); 69 64 70 std::vector<unsigned int> playersperteam(this->teams_, 0); 71 72 for (std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it) 73 if (it->second < static_cast<int>(this->teams_) && it->second >= 0) 74 playersperteam[it->second]++; 75 76 unsigned int minplayers = static_cast<unsigned int>(-1); 77 size_t minplayersteam = 0; 78 for (size_t i = 0; i < this->teams_; ++i) 79 { 80 if (playersperteam[i] < minplayers) 81 { 82 minplayers = playersperteam[i]; 83 minplayersteam = i; 84 } 85 } 86 87 this->teamnumbers_[player] = minplayersteam; 65 const std::string& message = player->getName() + " entered the game"; 66 ChatManager::message(message); 88 67 } 89 68 90 69 bool TeamDeathmatch::playerLeft(PlayerInfo* player) 91 70 { 92 bool valid_player = Deathmatch::playerLeft(player);71 bool valid_player = TeamGametype::playerLeft(player); 93 72 94 73 if (valid_player) 95 this->teamnumbers_.erase(player); 74 { 75 const std::string& message = player->getName() + " left the game"; 76 ChatManager::message(message); 77 } 78 79 return valid_player; 80 } 81 bool TeamDeathmatch::playerChangedName(PlayerInfo* player) 82 { 83 bool valid_player = TeamGametype::playerChangedName(player); 84 85 if (valid_player) 86 { 87 const std::string& message = player->getOldName() + " changed name to " + player->getName(); 88 ChatManager::message(message); 89 } 96 90 97 91 return valid_player; 98 92 } 99 93 100 bool TeamDeathmatch::allowPawnHit(Pawn* victim, Pawn* originator)94 void TeamDeathmatch::pawnKilled(Pawn* victim, Pawn* killer) 101 95 { 102 return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator); 96 if (victim && victim->getPlayer()) 97 { 98 std::string message; 99 if (killer) 100 { 101 if (killer->getPlayer()) 102 message = victim->getPlayer()->getName() + " was killed by " + killer->getPlayer()->getName(); 103 else 104 message = victim->getPlayer()->getName() + " was killed"; 105 } 106 else 107 message = victim->getPlayer()->getName() + " died"; 108 109 ChatManager::message(message); 110 } 111 112 Gametype::pawnKilled(victim, killer); 103 113 } 104 114 105 bool TeamDeathmatch::allowPawnDamage(Pawn* victim, Pawn* originator)115 void TeamDeathmatch::playerScored(PlayerInfo* player, int score) 106 116 { 107 return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator); 108 } 117 TeamGametype::playerScored(player, score); 109 118 110 bool TeamDeathmatch::allowPawnDeath(Pawn* victim, Pawn* originator) 111 { 112 return (!this->pawnsAreInTheSameTeam(victim, originator) || !originator); 113 } 114 115 SpawnPoint* TeamDeathmatch::getBestSpawnPoint(PlayerInfo* player) const 116 { 117 int desiredTeamNr = -1; 118 std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player); 119 if (it_player != this->teamnumbers_.end()) 120 desiredTeamNr = it_player->second; 121 122 // Only use spawnpoints of the own team (or non-team-spawnpoints) 123 std::set<SpawnPoint*> teamSpawnPoints = this->spawnpoints_; 124 for (std::set<SpawnPoint*>::iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ) 119 if (player) 125 120 { 126 if ((*it)->isA(Class(TeamSpawnPoint))) 127 { 128 TeamSpawnPoint* tsp = orxonox_cast<TeamSpawnPoint*>(*it); 129 if (tsp && static_cast<int>(tsp->getTeamNumber()) != desiredTeamNr) 130 { 131 teamSpawnPoints.erase(it++); 132 continue; 133 } 134 } 135 136 ++it; 137 } 138 139 SpawnPoint* fallbackSpawnPoint = NULL; 140 if (teamSpawnPoints.size() > 0) 141 { 142 unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 143 unsigned int index = 0; 144 // Get random fallback spawnpoint in case there is no active SpawnPoint. 145 for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it) 146 { 147 if (index == randomspawn) 148 { 149 fallbackSpawnPoint = (*it); 150 break; 151 } 152 153 ++index; 154 } 155 156 // Remove all inactive SpawnPoints from the list. 157 for (std::set<SpawnPoint*>::iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ) 158 { 159 if(!(*it)->isActive()) 160 { 161 teamSpawnPoints.erase(it++); 162 continue; 163 } 164 165 ++it; 166 } 167 168 randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 169 index = 0; 170 for (std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it) 171 { 172 if (index == randomspawn) 173 return (*it); 174 175 ++index; 176 } 177 178 return fallbackSpawnPoint; 179 } 180 181 return 0; 182 } 183 184 void TeamDeathmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) 185 { 186 if (!player) 187 return; 188 189 // Set the team colour 190 std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player); 191 if (it_player != this->teamnumbers_.end() && it_player->second >= 0 && it_player->second < static_cast<int>(this->teamcolours_.size())) 192 { 193 if (pawn) 194 { 195 pawn->setRadarObjectColour(this->teamcolours_[it_player->second]); 196 197 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 198 for (std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it) 199 { 200 if ((*it)->isA(Class(TeamColourable))) 201 { 202 TeamColourable* tc = orxonox_cast<TeamColourable*>(*it); 203 tc->setTeamColour(this->teamcolours_[it_player->second]); 204 } 205 } 206 } 121 const std::string& message = player->getName() + " scores!"; 122 ChatManager::message(message); 207 123 } 208 124 } 209 125 210 bool TeamDeathmatch::pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2)211 {212 if (pawn1 && pawn2)213 {214 std::map<PlayerInfo*, int>::const_iterator it1 = this->teamnumbers_.find(pawn1->getPlayer());215 std::map<PlayerInfo*, int>::const_iterator it2 = this->teamnumbers_.find(pawn2->getPlayer());216 217 if (it1 != this->teamnumbers_.end() && it2 != this->teamnumbers_.end())218 return (it1->second == it2->second);219 }220 return false;221 }222 223 int TeamDeathmatch::getTeam(PlayerInfo* player)224 {225 std::map<PlayerInfo*, int>::const_iterator it_player = this->teamnumbers_.find(player);226 if (it_player != this->teamnumbers_.end())227 return it_player->second;228 else229 return -1;230 }231 126 } -
code/trunk/src/orxonox/gametypes/TeamDeathmatch.h
r9016 r9348 31 31 32 32 #include "OrxonoxPrereqs.h" 33 34 #include <map> 35 #include <vector> 36 #include "Deathmatch.h" 33 #include "TeamGametype.h" 37 34 38 35 namespace orxonox 39 36 { 40 class _OrxonoxExport TeamDeathmatch : public Deathmatch37 class _OrxonoxExport TeamDeathmatch : public TeamGametype 41 38 { 42 39 public: … … 44 41 virtual ~TeamDeathmatch() {} 45 42 46 v oid setConfigValues();47 43 virtual void start(); 44 virtual void end(); 48 45 virtual void playerEntered(PlayerInfo* player); 49 46 virtual bool playerLeft(PlayerInfo* player); 47 virtual bool playerChangedName(PlayerInfo* player); 50 48 51 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0); 52 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); 53 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); 54 55 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn); 56 57 int getTeam(PlayerInfo* player); 58 inline const ColourValue& getTeamColour(int teamnr) const 59 { return this->teamcolours_[teamnr]; } 60 61 protected: 62 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const; 63 bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2); 64 65 std::map<PlayerInfo*, int> teamnumbers_; 66 std::vector<ColourValue> teamcolours_; 67 unsigned int teams_; 49 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); 50 virtual void playerScored(PlayerInfo* player, int score = 1); 68 51 }; 69 52 } -
code/trunk/src/orxonox/gametypes/TeamGametype.cc
- Property svn:eol-style set to native
r9048 r9348 89 89 } 90 90 91 /** 92 @brief 93 Function that determines the player's team number when entering the game for the first time. 94 Override this function for other team structures. 95 */ 91 96 void TeamGametype::findAndSetTeam(PlayerInfo* player) 92 97 { … … 130 135 this->allowedInGame_.erase(player); 131 136 } 132 133 137 134 138 return valid_player; -
code/trunk/src/orxonox/gametypes/TeamGametype.h
- Property svn:eol-style set to native
-
code/trunk/src/orxonox/gametypes/UnderAttack.cc
r9016 r9348 49 49 this->gameEnded_ = false; 50 50 51 //this->setHUDTemplate("UnderAttackHUD");52 //This HUD is in conflict with the HUDEnemyHealthBar53 51 this->setConfigValues(); 54 52 this->timesequence_ = static_cast<int>(this->gameTime_); -
code/trunk/src/orxonox/infos/GametypeInfo.cc
r9016 r9348 68 68 { 69 69 RegisterObject(GametypeInfo); 70 70 71 71 this->bStarted_ = false; 72 72 this->bEnded_ = false; … … 165 165 if(this->bStarted_) 166 166 { return;} 167 167 168 168 this->bStarted_ = true; 169 169 this->changedStarted(); 170 171 170 171 172 172 } 173 173 … … 195 195 if(this->startCountdown_ == countdown || countdown < 0.0f) 196 196 return; 197 197 198 198 this->startCountdown_ = countdown; 199 199 // Set the counter to the ceiling of the current countdown. … … 225 225 if(this->counter_ == 0) 226 226 return; 227 227 228 228 this->counter_--; 229 229 this->changedCountdownCounter(); … … 325 325 if(this->spawned_ == spawned) 326 326 return; 327 327 328 328 this->spawned_ = spawned; 329 329 // Clear the notifications if the Player has spawned. … … 395 395 // TODO: Replace with notifications. 396 396 397 void GametypeInfo::sendAnnounceMessage(const std::string& message) 397 void GametypeInfo::sendAnnounceMessage(const std::string& message) const 398 398 { 399 399 if (GameMode::isMaster()) … … 404 404 } 405 405 406 void GametypeInfo::sendAnnounceMessage(const std::string& message, unsigned int clientID) 406 void GametypeInfo::sendAnnounceMessage(const std::string& message, unsigned int clientID) const 407 407 { 408 408 if (GameMode::isMaster()) … … 415 415 } 416 416 417 void GametypeInfo::sendKillMessage(const std::string& message, unsigned int clientID) 417 void GametypeInfo::sendKillMessage(const std::string& message, unsigned int clientID) const 418 418 { 419 419 if (GameMode::isMaster()) … … 426 426 } 427 427 428 void GametypeInfo::sendDeathMessage(const std::string& message, unsigned int clientID) 428 void GametypeInfo::sendDeathMessage(const std::string& message, unsigned int clientID) const 429 429 { 430 430 if (GameMode::isMaster()) … … 437 437 } 438 438 439 void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour) 439 void GametypeInfo::sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour) const 440 440 { 441 441 if (GameMode::isMaster()) … … 448 448 } 449 449 450 void GametypeInfo::sendFadingMessage(const std::string& message, unsigned int clientID) 450 void GametypeInfo::sendFadingMessage(const std::string& message, unsigned int clientID) const 451 451 { 452 452 if (GameMode::isMaster()) … … 459 459 } 460 460 461 void GametypeInfo::dispatchAnnounceMessage(const std::string& message) 461 void GametypeInfo::dispatchAnnounceMessage(const std::string& message) const 462 462 { 463 463 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) … … 465 465 } 466 466 467 void GametypeInfo::dispatchKillMessage(const std::string& message) 467 void GametypeInfo::dispatchKillMessage(const std::string& message) const 468 468 { 469 469 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) … … 471 471 } 472 472 473 void GametypeInfo::dispatchDeathMessage(const std::string& message) 473 void GametypeInfo::dispatchDeathMessage(const std::string& message) const 474 474 { 475 475 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) … … 477 477 } 478 478 479 void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour) 479 void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour) const 480 480 { 481 481 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) … … 483 483 } 484 484 485 void GametypeInfo::dispatchFadingMessage(const std::string& message) 485 void GametypeInfo::dispatchFadingMessage(const std::string& message) const 486 486 { 487 487 for (ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it) -
code/trunk/src/orxonox/infos/GametypeInfo.h
r9016 r9348 68 68 { return this->bStarted_; } 69 69 void changedStarted(void); // Is called when the game has changed to started. 70 70 71 71 /** 72 72 @brief Get whether the game has ended yet. … … 108 108 { return this->readyToSpawn_; } 109 109 void changedReadyToSpawn(bool ready); // Inform the GametypeInfo that the local player has changed its spawned status. 110 110 111 111 /** 112 112 @brief Get whether the local player is spawned. … … 119 119 inline const std::string& getHUDTemplate() const 120 120 { return this->hudtemplate_; } 121 122 inline unsigned int getNumberOfPlayers() const123 { return this->spawnedPlayers_.size(); }124 121 125 void sendAnnounceMessage(const std::string& message) ;126 void sendAnnounceMessage(const std::string& message, unsigned int clientID) ;127 void sendKillMessage(const std::string& message, unsigned int clientID) ;128 void sendDeathMessage(const std::string& message, unsigned int clientID) ;129 void sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour) ;130 void sendFadingMessage(const std::string& message, unsigned int clientID) ;122 void sendAnnounceMessage(const std::string& message) const; 123 void sendAnnounceMessage(const std::string& message, unsigned int clientID) const; 124 void sendKillMessage(const std::string& message, unsigned int clientID) const; 125 void sendDeathMessage(const std::string& message, unsigned int clientID) const; 126 void sendStaticMessage(const std::string& message, unsigned int clientID, const ColourValue& colour) const; 127 void sendFadingMessage(const std::string& message, unsigned int clientID) const; 131 128 132 void dispatchAnnounceMessage(const std::string& message) ;133 void dispatchKillMessage(const std::string& message) ;134 void dispatchDeathMessage(const std::string& message) ;135 void dispatchStaticMessage(const std::string& message,const ColourValue& colour) ;136 void dispatchFadingMessage(const std::string& message) ;137 129 void dispatchAnnounceMessage(const std::string& message) const; 130 void dispatchKillMessage(const std::string& message) const; 131 void dispatchDeathMessage(const std::string& message) const; 132 void dispatchStaticMessage(const std::string& message,const ColourValue& colour) const; 133 void dispatchFadingMessage(const std::string& message) const; 134 138 135 protected: 139 136 void start(void); // Inform the GametypeInfo that the game has started. … … 165 162 unsigned int counter_; //!< The current integer value of the start countdown, the start countdown counter. 166 163 std::string hudtemplate_; 167 164 168 165 std::set<PlayerInfo*> spawnedPlayers_; //!< A set of players that are currently spawned. 169 166 bool spawned_; //!< Whether the local Player is currently spawned. -
code/trunk/src/orxonox/infos/PlayerInfo.cc
r9257 r9348 173 173 this->changedControllableEntity(); 174 174 175 175 RadarViewable* radarviewable = orxonox_cast<RadarViewable*>(entity); 176 176 if (radarviewable != NULL) 177 177 radarviewable->setRadarName(this->getName()); -
code/trunk/src/orxonox/interfaces/Pickupable.cc
r8866 r9348 39 39 40 40 #include "infos/PlayerInfo.h" 41 #include "pickup/PickupIdentifier.h"42 41 #include "worldentities/pawns/Pawn.h" 43 42 … … 52 51 Constructor. Registers the objects and initializes its member variables. 53 52 */ 54 Pickupable::Pickupable() : pickupIdentifier_(NULL),used_(false), pickedUp_(false)53 Pickupable::Pickupable() : used_(false), pickedUp_(false) 55 54 { 56 55 RegisterRootObject(Pickupable); … … 58 57 this->carrier_ = NULL; 59 58 60 this->pickupIdentifier_ = new PickupIdentifier(this);61 59 this->beingDestroyed_ = false; 62 60 this->enabled_ = true; … … 69 67 Pickupable::~Pickupable() 70 68 { 71 if(this->pickupIdentifier_ != NULL)72 {73 orxout(verbose, context::pickups) << "Pickupable (&" << this << ") destroyed." << endl;74 this->pickupIdentifier_->destroy();75 }76 69 } 77 70 … … 104 97 void Pickupable::destroyPickup(void) 105 98 { 106 if(!this-> beingDestroyed_)99 if(!this->isBeingDestroyed()) 107 100 this->OrxonoxClass::destroy(); 108 101 else … … 329 322 /** 330 323 @brief 331 Creates a duplicate of the Pickupable.332 @return333 Returns the clone of this pickup as a pointer to a Pickupable.334 */335 Pickupable* Pickupable::clone(void)336 {337 OrxonoxClass* item = NULL;338 this->clone(item);339 340 Pickupable* pickup = dynamic_cast<Pickupable*>(item);341 342 orxout(verbose, context::pickups) << "Pickupable (&" << this << ") cloned. Clone is new Pickupable (&" << pickup << ")." << endl;343 return pickup;344 }345 346 /**347 @brief348 324 Method to transcribe a Pickupable as a Rewardable to the player. 349 325 @param player -
code/trunk/src/orxonox/interfaces/Pickupable.h
r8866 r9348 53 53 Pickups (@ref orxonox::Pickupable "Pickupables") are objects that (quite unsurprisingly) can be picked up. Additionally they can be used and unused (transition from used to not used), and also dropped. 54 54 55 A class of Pickups can incorporate many different types of pickups (see @ref orxonox::PickupIdentifier "PickupIdentifier"), each type is uniquely defined by a @ref orxonox::PickupIdentifier "PickupIdentifier". Each pickup has such an identifier identiying its type. This means that two pickups of the same type have identifiers which are equal.56 57 55 @author 58 56 Damian 'Mozork' Frick … … 69 67 public: 70 68 virtual ~Pickupable(); //!< Default destructor. 69 70 //! @brief Returns the representation name which refers to the name of the PickupRepresentation that is used to represent this pickup. 71 virtual const std::string& getRepresentationName() const = 0; 71 72 72 73 /** … … 136 137 bool addTarget(Identifier* identifier); //!< Add a class, representetd by the input Identifier, as target of this Pickupable. 137 138 138 Pickupable* clone(void); //!< Creates a duplicate of the Pickupable.139 /**140 @brief Creates a duplicate of the input OrxonoxClass.141 This method needs to be implemented by any Class inheriting from Pickupable.142 @param item A reference to a pointer to the OrxonoxClass that is to be duplicated.143 */144 virtual void clone(OrxonoxClass*& item) {}145 146 /**147 @brief Get the PickupIdentifier of this Pickupable.148 @return Returns a pointer to the PickupIdentifier of this Pickupable.149 */150 virtual const PickupIdentifier* getPickupIdentifier(void) const151 { return this->pickupIdentifier_; }152 153 139 bool setUsed(bool used); //!< Sets the Pickupable to used or unused, depending on the input. 154 140 bool setPickedUp(bool pickedUp); //!< Helper method to set the Pickupable to either picked up or not picked up. … … 158 144 159 145 protected: 160 /**161 @brief Helper method to initialize the PickupIdentifier.162 */163 void initializeIdentifier(void) {}164 165 146 virtual void preDestroy(void); //!< A method that is called by OrxonoxClass::destroy() before the object is actually destroyed. 166 147 virtual void destroyPickup(void); //!< Destroys a Pickupable. … … 174 155 175 156 /** 157 @brief Check whether the Pickupable is in the process of being destroyed. 158 @return Returns true if so. 159 */ 160 inline bool isBeingDestroyed(void) 161 { return this->beingDestroyed_; } 162 163 /** 176 164 @brief Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 177 This method must be implemented by any class directly inheriting from Pickupable. It is most easily done by just creating a new DroppedPickup, e.g.: 178 DroppedPickup(BaseObject* creator, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance); 165 This method must be implemented by any class directly inheriting from Pickupable. 179 166 @return Returns true if a spawner was created, false if not. 180 167 */ 181 168 virtual bool createSpawner(void) = 0; 182 183 PickupIdentifier* pickupIdentifier_; //!< The PickupIdentifier of this Pickupable.184 169 185 170 private: … … 203 188 //! SUPER functions. 204 189 SUPER_FUNCTION(10, Pickupable, changedUsed, false); 205 SUPER_FUNCTION(12, Pickupable, changedCarrier, false); 206 SUPER_FUNCTION(13, Pickupable, changedPickedUp, false); 207 SUPER_FUNCTION(11, Pickupable, clone, false); 190 SUPER_FUNCTION(11, Pickupable, changedCarrier, false); 191 SUPER_FUNCTION(12, Pickupable, changedPickedUp, false); 208 192 } 209 193 -
code/trunk/src/orxonox/interfaces/RadarViewable.h
r9257 r9348 61 61 virtual ~RadarViewable(); 62 62 63 64 65 66 67 68 69 70 71 72 63 virtual void setRadarName(const std::string& name) 64 { 65 if (this->radarName_ != name) 66 { 67 this->radarName_ = name; 68 this->settingsChanged(); 69 } 70 } 71 const std::string& getRadarName() const 72 { return this->radarName_; } 73 73 74 74 inline void setRadarObjectCamouflage(float camouflage) … … 163 163 ColourValue radarObjectColour_; 164 164 float scale_; 165 165 std::string radarName_; 166 166 }; 167 167 } -
code/trunk/src/orxonox/worldentities/ControllableEntity.cc
r9016 r9348 87 87 this->setPriority( Priority::VeryHigh ); 88 88 this->registerVariables(); 89 89 this->team_ = -1; 90 90 } 91 91 … … 266 266 this->cameraPositionRootNode_->_update(true, false); // update the camera node because otherwise the camera will drag back in position which looks strange 267 267 268 NewHumanController* controller = dynamic_cast<NewHumanController*>(this->getController());268 NewHumanController* controller = orxonox_cast<NewHumanController*>(this->getController()); 269 269 if (controller) 270 270 controller->centerCursor(); -
code/trunk/src/orxonox/worldentities/ControllableEntity.h
r9255 r9348 164 164 void setTargetInternal( uint32_t targetID ); 165 165 166 167 168 169 166 inline void setTeam(int team) 167 { this->team_ = team; } 168 inline int getTeam() const 169 { return this->team_; } 170 170 171 171 protected: … … 243 243 WeakPtr<WorldEntity> target_; 244 244 245 245 int team_ ; //<! teamnumber 246 246 }; 247 247 } -
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
r9257 r9348 75 75 this->lastHitOriginator_ = 0; 76 76 77 // set damage multiplier to default value 1, meaning nominal damage 78 this->damageMultiplier_ = 1; 79 77 80 this->spawnparticleduration_ = 3.0f; 78 81 … … 228 231 void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator) 229 232 { 233 // Applies multiplier given by the DamageBoost Pickup. 234 if (originator) 235 damage *= originator->getDamageMultiplier(); 236 230 237 if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator)) 231 238 { -
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
r9254 r9348 144 144 virtual void addedWeaponPack(WeaponPack* wPack) {} 145 145 146 inline const WorldEntity* getWorldEntity() const147 { return const_cast<Pawn*>(this); }148 149 146 inline void setSpawnParticleSource(const std::string& source) 150 147 { this->spawnparticlesource_ = source; } … … 162 159 { return this->numexplosionchunks_; } 163 160 161 // These are used with the Damage Boost Pickup to use the damage multiplier. 162 inline void setDamageMultiplier(float multiplier) 163 { this->damageMultiplier_ = multiplier; } 164 inline float getDamageMultiplier() const 165 { return this->damageMultiplier_; } 166 167 164 168 virtual void startLocalHumanControl(); 165 169 … … 203 207 float maxShieldHealth_; 204 208 float initialShieldHealth_; 205 float shieldAbsorption_; // Has to be between 0 and 1209 float shieldAbsorption_; ///< Has to be between 0 and 1 206 210 float reloadRate_; 207 211 float reloadWaitTime_; 208 212 float reloadWaitCountdown_; 213 214 float damageMultiplier_; ///< Used by the Damage Boost Pickup. 209 215 210 216 WeakPtr<Pawn> lastHitOriginator_; -
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
r8892 r9348 133 133 { 134 134 SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down)."); 135 135 136 136 SetConfigValueExternal(bEnableMotionBlur_, "GraphicsSettings", "enableMotionBlur", true) 137 137 .description("Enable or disable the motion blur effect when moving very fast") … … 503 503 void SpaceShip::resetCamera() 504 504 { 505 506 505 if(this->hasLocalController() && this->hasHumanController()) 506 { 507 507 Camera *camera = this->getCamera(); 508 508 if (camera == 0) … … 514 514 camera->setPosition(this->cameraOriginalPosition_); 515 515 camera->setOrientation(this->cameraOriginalOrientation_); 516 516 } 517 517 } 518 518
Note: See TracChangeset
for help on using the changeset viewer.