[Orxonox-commit 4032] r8706 - in code/trunk: . data/defaultConfig data/gui/layouts data/gui/scripts data/levels data/levels/includes data/levels/templates data/overlays data/particle doc/api doc/api/groups src/libraries/core src/libraries/core/command src/libraries/network src/libraries/network/packet src/libraries/network/synchronisable src/libraries/util src/modules src/modules/docking src/modules/gametypes src/modules/notifications src/modules/notifications/dispatchers src/modules/objects src/modules/objects/collisionshapes src/modules/objects/triggers src/modules/overlays src/modules/overlays/hud src/modules/pickup src/modules/pickup/items src/modules/pong src/modules/portals src/modules/questsystem src/modules/tetris src/modules/weapons/projectiles src/modules/weapons/weaponmodes src/orxonox src/orxonox/collisionshapes src/orxonox/controllers src/orxonox/gamestates src/orxonox/gametypes src/orxonox/graphics src/orxonox/infos src/orxonox/interfaces src/orxonox/items src/orxonox/overlays src/orxonox/sound src/orxonox/weaponsystem src/orxonox/worldentities src/orxonox/worldentities/pawns
dafrick at orxonox.net
dafrick at orxonox.net
Tue Jun 14 20:53:29 CEST 2011
Author: dafrick
Date: 2011-06-14 20:53:28 +0200 (Tue, 14 Jun 2011)
New Revision: 8706
Added:
code/trunk/data/gui/layouts/DockingDialog.layout
code/trunk/data/gui/scripts/DockingDialog.lua
code/trunk/data/levels/docking.oxw
code/trunk/data/levels/includes/notifications.oxi
code/trunk/data/levels/includes/weaponSettingsAssff2.oxi
code/trunk/data/levels/includes/weaponSettingsImmTest.oxi
code/trunk/data/levels/quests.oxw
code/trunk/data/levels/shieldTest.oxw
code/trunk/data/levels/spaceRace.oxw
code/trunk/data/levels/templates/spaceshipAssff2.oxt
code/trunk/data/levels/templates/spaceshipImmTest.oxt
code/trunk/data/levels/tetris.oxw
code/trunk/data/particle/RingExp.particle
code/trunk/data/particle/RingExp2.particle
code/trunk/data/particle/RingExp3.particle
code/trunk/data/particle/Shield.particle
code/trunk/data/particle/weaponflare.particle
code/trunk/data/particle/weaponshoot.particle
code/trunk/doc/api/groups/Portals.dox
code/trunk/src/modules/docking/
code/trunk/src/modules/docking/CMakeLists.txt
code/trunk/src/modules/docking/Dock.cc
code/trunk/src/modules/docking/Dock.h
code/trunk/src/modules/docking/DockToShip.cc
code/trunk/src/modules/docking/DockToShip.h
code/trunk/src/modules/docking/DockingAnimation.cc
code/trunk/src/modules/docking/DockingAnimation.h
code/trunk/src/modules/docking/DockingController.cc
code/trunk/src/modules/docking/DockingController.h
code/trunk/src/modules/docking/DockingEffect.cc
code/trunk/src/modules/docking/DockingEffect.h
code/trunk/src/modules/docking/DockingPrecompiledHeaders.h
code/trunk/src/modules/docking/DockingPrereqs.h
code/trunk/src/modules/docking/DockingTarget.cc
code/trunk/src/modules/docking/DockingTarget.h
code/trunk/src/modules/docking/MoveToDockingTarget.cc
code/trunk/src/modules/docking/MoveToDockingTarget.h
code/trunk/src/modules/gametypes/
code/trunk/src/modules/gametypes/CMakeLists.txt
code/trunk/src/modules/gametypes/GametypesPrecompiledHeaders.h
code/trunk/src/modules/gametypes/GametypesPrereqs.h
code/trunk/src/modules/gametypes/RaceCheckPoint.cc
code/trunk/src/modules/gametypes/RaceCheckPoint.h
code/trunk/src/modules/gametypes/SpaceRace.cc
code/trunk/src/modules/gametypes/SpaceRace.h
code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc
code/trunk/src/modules/notifications/NotificationQueueCEGUI.h
code/trunk/src/modules/objects/SpaceBoundaries.cc
code/trunk/src/modules/objects/SpaceBoundaries.h
code/trunk/src/modules/overlays/hud/HUDBoostBar.cc
code/trunk/src/modules/overlays/hud/HUDBoostBar.h
code/trunk/src/modules/pickup/items/ShrinkPickup.cc
code/trunk/src/modules/pickup/items/ShrinkPickup.h
code/trunk/src/modules/tetris/
code/trunk/src/modules/tetris/CMakeLists.txt
code/trunk/src/modules/tetris/Tetris.cc
code/trunk/src/modules/tetris/Tetris.h
code/trunk/src/modules/tetris/TetrisCenterpoint.cc
code/trunk/src/modules/tetris/TetrisCenterpoint.h
code/trunk/src/modules/tetris/TetrisPrereqs.h
code/trunk/src/modules/tetris/TetrisStone.cc
code/trunk/src/modules/tetris/TetrisStone.h
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
code/trunk/src/modules/weapons/projectiles/BasicProjectile.h
code/trunk/src/orxonox/interfaces/NotificationListener.cc
Removed:
code/trunk/src/modules/docking/CMakeLists.txt
code/trunk/src/modules/docking/Dock.cc
code/trunk/src/modules/docking/Dock.h
code/trunk/src/modules/docking/DockToShip.cc
code/trunk/src/modules/docking/DockToShip.h
code/trunk/src/modules/docking/DockingAnimation.cc
code/trunk/src/modules/docking/DockingAnimation.h
code/trunk/src/modules/docking/DockingController.cc
code/trunk/src/modules/docking/DockingController.h
code/trunk/src/modules/docking/DockingEffect.cc
code/trunk/src/modules/docking/DockingEffect.h
code/trunk/src/modules/docking/DockingPrecompiledHeaders.h
code/trunk/src/modules/docking/DockingPrereqs.h
code/trunk/src/modules/docking/DockingTarget.cc
code/trunk/src/modules/docking/DockingTarget.h
code/trunk/src/modules/docking/MoveToDockingTarget.cc
code/trunk/src/modules/docking/MoveToDockingTarget.h
code/trunk/src/modules/gametypes/CMakeLists.txt
code/trunk/src/modules/gametypes/GametypesPrecompiledHeaders.h
code/trunk/src/modules/gametypes/GametypesPrereqs.h
code/trunk/src/modules/gametypes/RaceCheckPoint.cc
code/trunk/src/modules/gametypes/RaceCheckPoint.h
code/trunk/src/modules/gametypes/SpaceRace.cc
code/trunk/src/modules/gametypes/SpaceRace.h
code/trunk/src/modules/notifications/Notification.cc
code/trunk/src/modules/notifications/Notification.h
code/trunk/src/modules/overlays/hud/GametypeStatus.cc
code/trunk/src/modules/overlays/hud/GametypeStatus.h
code/trunk/src/modules/tetris/CMakeLists.txt
code/trunk/src/modules/tetris/Tetris.cc
code/trunk/src/modules/tetris/Tetris.h
code/trunk/src/modules/tetris/TetrisCenterpoint.cc
code/trunk/src/modules/tetris/TetrisCenterpoint.h
code/trunk/src/modules/tetris/TetrisPrereqs.h
code/trunk/src/modules/tetris/TetrisStone.cc
code/trunk/src/modules/tetris/TetrisStone.h
code/trunk/src/orxonox/worldentities/SpaceBoundaries.cc
code/trunk/src/orxonox/worldentities/SpaceBoundaries.h
Modified:
code/trunk/
code/trunk/data/defaultConfig/keybindings.ini
code/trunk/data/gui/layouts/QuestGUI.layout
code/trunk/data/gui/scripts/NotificationLayer.lua
code/trunk/data/gui/scripts/QuestGUI.lua
code/trunk/data/gui/scripts/SingleplayerMenu.lua
code/trunk/data/levels/FPSTest.oxw
code/trunk/data/levels/asteroids.oxw
code/trunk/data/levels/dynamicMatch.oxw
code/trunk/data/levels/earth.oxw
code/trunk/data/levels/emptyLevel.oxw
code/trunk/data/levels/events.oxw
code/trunk/data/levels/fightInOurBack.oxw
code/trunk/data/levels/includes/pickups.oxi
code/trunk/data/levels/includes/weaponSettingsAssff.oxi
code/trunk/data/levels/lastManStanding.oxw
code/trunk/data/levels/lastTeamStanding.oxw
code/trunk/data/levels/lastTeamStandingII.oxw
code/trunk/data/levels/myTestLevel.oxw
code/trunk/data/levels/notifications.oxw
code/trunk/data/levels/pickups.oxw
code/trunk/data/levels/pirateAttack.oxw
code/trunk/data/levels/planets.oxw
code/trunk/data/levels/pong.oxw
code/trunk/data/levels/portals.oxw
code/trunk/data/levels/presentation.oxw
code/trunk/data/levels/presentation09.oxw
code/trunk/data/levels/presentation09b.oxw
code/trunk/data/levels/presentationDM.oxw
code/trunk/data/levels/presentationFS10.oxw
code/trunk/data/levels/presentationFS102.oxw
code/trunk/data/levels/presentationFS10Ed.oxw
code/trunk/data/levels/presentationFS11.oxw
code/trunk/data/levels/presentationHS09.oxw
code/trunk/data/levels/presentationHS09b.oxw
code/trunk/data/levels/princessAeryn.oxw
code/trunk/data/levels/screenshot.oxw
code/trunk/data/levels/sound.oxw
code/trunk/data/levels/teamBaseMatch.oxw
code/trunk/data/levels/teamDeathMatch.oxw
code/trunk/data/levels/templates/lodInformation.oxt
code/trunk/data/levels/templates/pickupRepresentationTemplates.oxt
code/trunk/data/levels/templates/spaceshipAssff.oxt
code/trunk/data/levels/templates/spaceshipGhost.oxt
code/trunk/data/levels/templates/spaceshipH2.oxt
code/trunk/data/levels/templates/spaceshipHXY.oxt
code/trunk/data/levels/templates/spaceshipHXYSL.oxt
code/trunk/data/levels/templates/spaceshipPirate.oxt
code/trunk/data/levels/templates/spaceshipSwallow.oxt
code/trunk/data/levels/templates/spaceshipTransporter.oxt
code/trunk/data/levels/templates/spaceshipTransporterSL.oxt
code/trunk/data/levels/testStars.oxw
code/trunk/data/levels/testSwallow.oxw
code/trunk/data/levels/theTimeMachine.oxw
code/trunk/data/levels/tutorial.oxw
code/trunk/data/levels/underAttack.oxw
code/trunk/data/levels/waypoints.oxw
code/trunk/data/overlays/HUDTemplates3.oxo
code/trunk/data/overlays/debug.oxo
code/trunk/doc/api/Groups.dox
code/trunk/doc/api/groups/Triggers.dox
code/trunk/src/libraries/core/BaseObject.cc
code/trunk/src/libraries/core/ConfigValueContainer.h
code/trunk/src/libraries/core/CoreIncludes.h
code/trunk/src/libraries/core/GUIManager.cc
code/trunk/src/libraries/core/GUIManager.h
code/trunk/src/libraries/core/Game.cc
code/trunk/src/libraries/core/GraphicsManager.h
code/trunk/src/libraries/core/Identifier.h
code/trunk/src/libraries/core/Super.h
code/trunk/src/libraries/core/ThreadWin.cc
code/trunk/src/libraries/core/command/Functor.h
code/trunk/src/libraries/core/command/Shell.cc
code/trunk/src/libraries/network/LANDiscovery.cc
code/trunk/src/libraries/network/Server.cc
code/trunk/src/libraries/network/packet/Welcome.cc
code/trunk/src/libraries/network/packet/Welcome.h
code/trunk/src/libraries/network/synchronisable/Serialise.h
code/trunk/src/libraries/network/synchronisable/Synchronisable.cc
code/trunk/src/libraries/network/synchronisable/Synchronisable.h
code/trunk/src/libraries/util/Convert.h
code/trunk/src/libraries/util/Exception.h
code/trunk/src/libraries/util/Math.h
code/trunk/src/libraries/util/MultiTypeValue.h
code/trunk/src/libraries/util/ScopedSingletonManager.h
code/trunk/src/libraries/util/Serialise.h
code/trunk/src/libraries/util/SubString.h
code/trunk/src/modules/CMakeLists.txt
code/trunk/src/modules/notifications/CMakeLists.txt
code/trunk/src/modules/notifications/NotificationDispatcher.cc
code/trunk/src/modules/notifications/NotificationManager.cc
code/trunk/src/modules/notifications/NotificationManager.h
code/trunk/src/modules/notifications/NotificationQueue.cc
code/trunk/src/modules/notifications/NotificationQueue.h
code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc
code/trunk/src/modules/objects/CMakeLists.txt
code/trunk/src/modules/objects/ObjectsPrereqs.h
code/trunk/src/modules/objects/Script.cc
code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h
code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h
code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h
code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc
code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
code/trunk/src/modules/objects/triggers/DistanceTrigger.h
code/trunk/src/modules/objects/triggers/EventTrigger.h
code/trunk/src/modules/objects/triggers/MultiTrigger.cc
code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
code/trunk/src/modules/objects/triggers/Trigger.cc
code/trunk/src/modules/objects/triggers/TriggerBase.cc
code/trunk/src/modules/objects/triggers/TriggerBase.h
code/trunk/src/modules/overlays/OverlaysPrereqs.h
code/trunk/src/modules/overlays/hud/CMakeLists.txt
code/trunk/src/modules/overlays/hud/HUDBar.cc
code/trunk/src/modules/overlays/hud/HUDBar.h
code/trunk/src/modules/overlays/hud/HUDNavigation.cc
code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc
code/trunk/src/modules/pickup/PickupManager.h
code/trunk/src/modules/pickup/PickupPrereqs.h
code/trunk/src/modules/pickup/PickupRepresentation.cc
code/trunk/src/modules/pickup/items/CMakeLists.txt
code/trunk/src/modules/pong/PongBat.h
code/trunk/src/modules/portals/CMakeLists.txt
code/trunk/src/modules/portals/PortalEndPoint.cc
code/trunk/src/modules/portals/PortalEndPoint.h
code/trunk/src/modules/portals/PortalLink.cc
code/trunk/src/modules/portals/PortalLink.h
code/trunk/src/modules/portals/PortalsPrecompiledHeaders.h
code/trunk/src/modules/portals/PortalsPrereqs.h
code/trunk/src/modules/questsystem/QuestDescription.cc
code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
code/trunk/src/modules/questsystem/QuestManager.cc
code/trunk/src/modules/questsystem/QuestManager.h
code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
code/trunk/src/modules/weapons/projectiles/Projectile.cc
code/trunk/src/modules/weapons/projectiles/Projectile.h
code/trunk/src/modules/weapons/projectiles/Rocket.cc
code/trunk/src/modules/weapons/projectiles/Rocket.h
code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
code/trunk/src/orxonox/LevelManager.cc
code/trunk/src/orxonox/MoodManager.cc
code/trunk/src/orxonox/MoodManager.h
code/trunk/src/orxonox/collisionshapes/CollisionShape.cc
code/trunk/src/orxonox/collisionshapes/CollisionShape.h
code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc
code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h
code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc
code/trunk/src/orxonox/controllers/ArtificialController.cc
code/trunk/src/orxonox/controllers/ArtificialController.h
code/trunk/src/orxonox/controllers/Controller.h
code/trunk/src/orxonox/controllers/HumanController.cc
code/trunk/src/orxonox/controllers/HumanController.h
code/trunk/src/orxonox/gamestates/GSRoot.cc
code/trunk/src/orxonox/gamestates/GSRoot.h
code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
code/trunk/src/orxonox/gametypes/Dynamicmatch.h
code/trunk/src/orxonox/gametypes/Gametype.cc
code/trunk/src/orxonox/gametypes/Gametype.h
code/trunk/src/orxonox/gametypes/LastTeamStanding.cc
code/trunk/src/orxonox/graphics/Billboard.cc
code/trunk/src/orxonox/graphics/Billboard.h
code/trunk/src/orxonox/graphics/Camera.cc
code/trunk/src/orxonox/graphics/Camera.h
code/trunk/src/orxonox/infos/GametypeInfo.cc
code/trunk/src/orxonox/infos/GametypeInfo.h
code/trunk/src/orxonox/infos/PlayerInfo.cc
code/trunk/src/orxonox/infos/PlayerInfo.h
code/trunk/src/orxonox/interfaces/CMakeLists.txt
code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc
code/trunk/src/orxonox/interfaces/NotificationListener.h
code/trunk/src/orxonox/interfaces/PlayerTrigger.h
code/trunk/src/orxonox/items/Engine.cc
code/trunk/src/orxonox/items/Engine.h
code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
code/trunk/src/orxonox/overlays/OrxonoxOverlay.h
code/trunk/src/orxonox/sound/AmbientSound.cc
code/trunk/src/orxonox/weaponsystem/Munition.cc
code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
code/trunk/src/orxonox/weaponsystem/WeaponMode.h
code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc
code/trunk/src/orxonox/worldentities/CMakeLists.txt
code/trunk/src/orxonox/worldentities/CameraPosition.cc
code/trunk/src/orxonox/worldentities/ControllableEntity.cc
code/trunk/src/orxonox/worldentities/ControllableEntity.h
code/trunk/src/orxonox/worldentities/MobileEntity.cc
code/trunk/src/orxonox/worldentities/MobileEntity.h
code/trunk/src/orxonox/worldentities/SpawnPoint.cc
code/trunk/src/orxonox/worldentities/WorldEntity.cc
code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
code/trunk/src/orxonox/worldentities/pawns/Pawn.h
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
Log:
Merging presentation branch back into trunk.
There are many new features and also a lot of other changes and bugfixes, if you want to know, digg through the svn log.
Not everything is yet working as it should, but it should be fairly stable. If you habe any bug reports, just send me an email.
Property changes on: code/trunk
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/steering:5949-6091
/code/branches/tetris:8100-8107
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
+ /code/branches/ai:6592-7033
/code/branches/bigships:8137-8588
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dockingsystem:8101-8192
/code/branches/dockingsystem2:8196-8560
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gameimmersion:8102-8577
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/hudimprovements:7920-8672
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-8096,8098-8277
/code/branches/kicklib2:8282-8350
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/mac_osx:7789-8128,8135
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network6:7823-8315
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/ois_update:7506-7788
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup:8145-8555
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/portals:8087-8455
/code/branches/portals2:8460-8602
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786,8500-8705
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/spaceboundaries:8085-8457
/code/branches/spaceboundaries2:8460-8613
/code/branches/spacerace:8182-8630
/code/branches/steering:5949-6091,8140-8595
/code/branches/tetris:8100-8563
/code/branches/tutoriallevel:7827-8370
/code/branches/tutoriallevel2:8370-8452
/code/branches/tutoriallevel3:8453-8636
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051,8143-8591
/code/branches/weaponsystem:2742-2890
Modified: code/trunk/data/defaultConfig/keybindings.ini
===================================================================
--- code/trunk/data/defaultConfig/keybindings.ini 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/defaultConfig/keybindings.ini 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,7 +20,7 @@
KeyDivide=
KeyDown="scale -1 moveFrontBack"
KeyE="scale -1 rotateRoll"
-KeyEnd=boost
+KeyEnd="boost"
KeyEquals=
KeyEscape="keyESC"
KeyF="scale -1 moveUpDown"
@@ -118,7 +118,7 @@
KeySemicolon=
KeySlash=
KeySleep=
-KeySpace=boost
+KeySpace="boost"
KeyStop=
KeySystemRequest="printScreen"
KeyT="onpress fire 3"
Copied: code/trunk/data/gui/layouts/DockingDialog.layout (from rev 8705, code/branches/presentation/data/gui/layouts/DockingDialog.layout)
===================================================================
--- code/trunk/data/gui/layouts/DockingDialog.layout (rev 0)
+++ code/trunk/data/gui/layouts/DockingDialog.layout 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<GUILayout >
+ <Window Type="MenuWidgets/StaticImage" Name="orxonox/Docking/Background" >
+ <Property Name="FrameEnabled" Value="False" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+ <Property Name="BackgroundEnabled" Value="False" />
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/Docking/Title" >
+ <Property Name="Text" Value="Docking" />
+ <Property Name="Alpha" Value="0.8" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="HorzFormatting" Value="HorzCentred" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="UnifiedAreaRect" Value="{{0.25,0},{0.2875,0},{0.75,0},{0.7,0}}" />
+ <Window Type="MenuWidgets/Listbox" Name="orxonox/Docking/Docks" >
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.05,0},{0.15,0},{0.95,0},{0.85,0}}" />
+ </Window>
+ </Window>
+ <Window Type="MenuWidgets/Button" Name="orxonox/Docking/DockButton" >
+ <Property Name="Text" Value="Dock" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.2875,0},{0.725,0},{0.4875,0},{0.775,0}}" />
+ <Event Name="Clicked" Function="DockingDialog.dockButton_clicked"/>
+ </Window>
+ <Window Type="MenuWidgets/Button" Name="orxonox/Docking/CancelButton" >
+ <Property Name="Text" Value="Cancel" />
+ <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
+ <Property Name="UnifiedAreaRect" Value="{{0.5125,0},{0.725,0},{0.7125,0},{0.775,0}}" />
+ <Event Name="Clicked" Function="DockingDialog.cancelButton_clicked"/>
+ </Window>
+ </Window>
+</GUILayout>
Modified: code/trunk/data/gui/layouts/QuestGUI.layout
===================================================================
--- code/trunk/data/gui/layouts/QuestGUI.layout 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/gui/layouts/QuestGUI.layout 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,23 +1,78 @@
<?xml version="1.0" ?>
<GUILayout>
- <Window Type="MenuWidgets/StaticImage" Name="orxonox/QuestGUI/Background">
- <Property Name="UnifiedSize" Value="{{1.0,0},{1.0,0}}"/>
- <Property Name="Image" Value="set:MainMenuBackground image:Background"/>
- <Property Name="FrameEnabled" Value="set:true"/>
- <Property Name="BackgroundEnabled" Value="set:false"/>
- <Property Name="InheritsAlpha" Value="False" />
+ <Window Type="DefaultWindow" Name="orxonox/QuestGUI/Background">
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
- <Window Type="MenuWidgets/Titlebar" Name="orxonox/QuestGUI/Title">
- <Property Name="UnifiedPosition" Value="{{0.05,0},{0.05,0}}"/>
- <Property Name="UnifiedSize" Value="{{0.9,0},{0.05,0}}"/>
- <Property Name="Text" Value="Your Quests"/>
- </Window>
+ <Window Type="DefaultWindow" Name="orxonox/QuestGUI/MainWindow">
+ <Property Name="UnifiedAreaRect" Value="{{0.1,0},{0.1,0},{0.9,0},{0.9,0}}" />
- <Window Type="MenuWidgets/Listbox" Name="orxonox/QuestGUI/QuestsList">
- <Property Name="UnifiedPosition" Value="{{0.07,0},{0.18,0}}" />
- <Property Name="UnifiedSize" Value="{{0.86,0},{0.8,0}}" />
- <Property Name="Alpha" Value="0.8" />
+ <Window Type="MenuWidgets/Titlebar" Name="orxonox/QuestGUI/Title">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0,30}}" />
+ <Property Name="Text" Value="Your Quests"/>
+ </Window>
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/MainWindow/LeftPanel">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,30},{0.5,0},{1,0}}" />
+
+ <Window Type="MenuWidgets/TabButton" Name="orxonox/QuestGUI/ActiveQuestsButton">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{0.5,0},{0,30}}" />
+ <Property Name="Text" Value="active quests"/>
+ <Event Name="Clicked" Function="QuestGUI.showActiveQuestsButton_clicked"/>
+ </Window>
+ <Window Type="MenuWidgets/TabButton" Name="orxonox/QuestGUI/FinishedQuestsButton">
+ <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0,0},{1,0},{0,30}}" />
+ <Property Name="Text" Value="finished quests"/>
+ <Event Name="Clicked" Function="QuestGUI.showFinishedQuestsButton_clicked"/>
+ </Window>
+
+ <Window Type="MenuWidgets/Listbox" Name="orxonox/QuestGUI/QuestsList">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,30},{1,0},{1,0}}" />
+ <Event Name="ItemSelectionChanged" Function="QuestGUI.changeQuest_clicked"/>
+ </Window>
+ </Window>
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/MainWindow/RightPanel">
+ <Property Name="UnifiedAreaRect" Value="{{0.5,0},{0,30},{1,0},{1,0}}" />
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/Quest/Title">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0,30}}" />
+ <Property Name="Text" Value="Quest Title"/>
+ </Window>
+
+ <Window Type="MenuWidgets/ScrollablePane" Name="orxonox/QuestGUI/Quest/ScrollWrapper">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,30},{1,-4},{1,-4}}" />
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/Quest/Wrapper">
+ <Property Name="UnifiedAreaRect" Value="{{0,5},{0,5},{1,-5},{0,0}}" />
+ <Property Name="FrameEnabled" Value="false" />
+ <Property Name="Alpha" Value="0" />
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/Quest/Description">
+ <Property Name="UnifiedAreaRect" Value="{{0,5},{0,0},{1,-5},{0,0}}" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="HorzFormatting" Value="WordWrapLeftAligned" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="FrameEnabled" Value="false" />
+ <Property Name="Text" Value="Quest Description"/>
+ </Window>
+
+ <Window Type="MenuWidgets/Listbox" Name="orxonox/QuestGUI/Quest/SubquestsList">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Event Name="ItemSelectionChanged" Function="QuestGUI.changeToSubquest_clicked"/>
+ </Window>
+
+ <Window Type="MenuWidgets/StaticText" Name="orxonox/QuestGUI/Quest/Hints">
+ <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{0,0}}" />
+ <Property Name="InheritsAlpha" Value="False" />
+ <Property Name="VertFormatting" Value="TopAligned" />
+ <Property Name="FrameEnabled" Value="false" />
+ <Property Name="Text" Value="Hints:" />
+ </Window>
+ </Window>
+ </Window>
+ </Window>
</Window>
-
</Window>
</GUILayout>
Copied: code/trunk/data/gui/scripts/DockingDialog.lua (from rev 8705, code/branches/presentation/data/gui/scripts/DockingDialog.lua)
===================================================================
--- code/trunk/data/gui/scripts/DockingDialog.lua (rev 0)
+++ code/trunk/data/gui/scripts/DockingDialog.lua 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,69 @@
+-- DockingDialog.lua
+
+local P = createMenuSheet("DockingDialog")
+
+P.docks = {}
+
+function P.onLoad()
+
+ --button are arranged in a 1x2 matrix
+ P:setButton(1, 1, {
+ ["button"] = winMgr:getWindow("orxonox/Docking/DockButton"),
+ ["callback"] = P.dockButton_clicked
+ })
+
+ P:setButton(1, 2, {
+ ["button"] = winMgr:getWindow("orxonox/Docking/CancelButton"),
+ ["callback"] = P.cancelButton_clicked
+ })
+
+end
+
+function P.onShow()
+ orxonox.execute("setPause 1")
+ P.update()
+end
+
+function P.onHide()
+ orxonox.execute("setPause 0")
+end
+
+function P.update()
+ -- update dock list
+ P.docks = {}
+ local docks = orxonox.Dock:getNumberOfActiveDocks()
+ for i = 0, docks-1 do
+ table.insert(P.docks, orxonox.Dock:getActiveDockAtIndex(i))
+ end
+
+ local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/Docking/Docks"))
+ listbox:resetList()
+
+ for k in pairs(P.docks) do
+ local item = CEGUI.createListboxTextItem("Dock " .. k)
+ item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+ listbox:addItem(item)
+ if k == 1 then
+ listbox:setItemSelectState(item, true)
+ end
+ end
+end
+
+function P.dockButton_clicked(e)
+ local listbox = CEGUI.toListbox(winMgr:getWindow("orxonox/Docking/Docks"))
+ local choice = listbox:getFirstSelectedItem()
+ if choice ~= nil then
+ local index = listbox:getItemIndex(choice)
+ local dock = P.docks[index+1]
+ if dock ~= nil then
+ dock:dock()
+ end
+ end
+ hideMenuSheet(P.name)
+end
+
+function P.cancelButton_clicked(e)
+ hideMenuSheet(P.name)
+end
+
+return P
Modified: code/trunk/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/trunk/data/gui/scripts/NotificationLayer.lua 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/gui/scripts/NotificationLayer.lua 2011-06-14 18:53:28 UTC (rev 8706)
@@ -3,7 +3,6 @@
local P = createMenuSheet("NotificationLayer", true, TriBool.True, TriBool.True)
P.queueList = {}
-P.editMode = false
P.sampleWindow = nil
@@ -16,20 +15,29 @@
-- Creates a queue in the GUI.
function P.createQueue(name, size)
local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
- local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
- queue:setProperty("BackgroundColor", "00FFFFFF") -- Set background to be fully transparent.
+ --local queue = winMgr:createWindow("MenuWidgets/Listbox", "orxonox/NotificationLayer/Root/Queue/" .. name)
+ --queue:setProperty("BackgroundColor", "00FFFFFF") -- Set background to be fully transparent.
+ local queue = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/Queue/" .. name)
+ queue:setProperty("Alpha", 0.0)
+ --queue:setProperty("FrameEnabled", "false")
root:addChildWindow(queue)
- queue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
- queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queue, size))))
-
local queueTuple =
{
- ["window"] = queue,
- ["name"] = name,
- ["edit"] = nil,
- ["visible"] = false
+ ["window"] = queue,
+ ["name"] = name,
+ ["maxSize"] = size,
+ ["visible"] = false,
+ ["fontSize"] = 12,
+ ["fontColor"] = "FFFFFFFF",
+ ["alignment"] = "LeftAligned",
+ ["items"] = {},
+ ["first"] = 1,
+ ["last"] = 1
}
+
+ queue:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
+ queue:setSize(CEGUI.UVector2(CEGUI.UDim(1.0, 0), CEGUI.UDim(0, P.queueHeightHelper(queueTuple, size))))
P.queueList[name] = queueTuple -- name access
P.setVisible(queueTuple, false) -- Set the queue to invisible as long as there are no notifications in it.
@@ -40,6 +48,7 @@
local queue = P.queueList[queueName]
if queue ~= nil then
+ queue.window:getParent():removeChildWindow(queue.window)
winMgr:destroyWindow(queue.window)
end
P.queueList[queueName] = nil
@@ -51,15 +60,33 @@
if queue == nil then
return
end
- item = CEGUI.createListboxTextItem(notification)
- local listbox = CEGUI.toListbox(queue.window)
- -- Add the item to the top of the listbox.
- if listbox:getItemCount() == 0 then
- listbox:addItem(item)
- else
- listbox:insertItem(item, listbox:getListboxItemFromIndex(0))
+
+ if not guiMgr:usingOldCEGUI() then
+ notification = string.gsub(notification, "%[", "\\%[") -- escape '[' which is used to format text since cegui 0.7
end
+ local item = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/Queue/" .. queueName .. "/" .. queue.last)
+ item:setText(notification)
+ P.setItemFontHelper(item, queue, true)
+ -- Add the item to the top of the queue.
+ local itemHeight = P.itemHeightHelper(queue)
+ if queue.last-queue.first > 0 then -- If the queue is not empty move all items down
+ for i=queue.first,queue.last-1 do
+ local item = queue.items[i]
+ item:setYPosition(CEGUI.UDim(0, itemHeight*(queue.last-i)))
+ end
+ end
+ queue.window:addChildWindow(item)
+ item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(0, itemHeight)))
+ item:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 0), CEGUI.UDim(0, 0)))
+ item:setProperty("Alpha", 1.0)
+ item:setProperty("InheritsAlpha", "false")
+ item:setProperty("BackgroundEnabled", "false")
+ item:setProperty("FrameEnabled", "false")
+ item:setProperty("HorzFormatting", queue.alignment)
+ queue.items[queue.last] = item
+ queue.last = queue.last+1
+
-- If the queue has been invisible, set it to visible.
if queue.visible == false then
P.setVisible(queue, true)
@@ -72,28 +99,53 @@
if queue == nil then
return
end
- local listbox = CEGUI.toListbox(queue.window)
- -- Removes the item from the bottom of the listbox.
- listbox:removeItem(listbox:getListboxItemFromIndex(listbox:getItemCount()-1))
+ local item = queue.items[queue.first]
+ -- Removes the item from the bottom of the queue.
+ queue.window:removeChildWindow(item)
+ winMgr:destroyWindow(item)
+ queue.first = queue.first+1
-- Sets the queue to invisible if there are no more notifications in it.
- if listbox:getItemCount() == 0 then
+ if queue.last-queue.first == 0 then
P.setVisible(queue, false)
end
end
--- Removes a notification at a given index from the queue.
+-- Removes a notification at a given index from the queue. Where the 0th item is the newest and the nth the (n+1)th newest.
function P.removeNotification(queueName, index)
local queue = P.queueList[queueName]
if queue == nil then
return
end
- local listbox = CEGUI.toListbox(queue.window)
+
+ index = queue.last-tonumber(index)-1
+ --if index == queue.first then -- If we want to remove the oldest notification, we can just use pop.
+ -- P.popNotification(queueName)
+ -- return
+ --end
+
-- Removes the item.
- listbox:removeItem(listbox:getListboxItemFromIndex(tonumber(index)))
+ local item = queue.items[index]
+ queue.window:removeChildWindow(item)
+ winMgr:destroyWindow(item)
+ queue.items[index] = nil
+ -- Move the items below, up.
+ local itemHeight = P.itemHeightHelper(queue)
+ local moved = false
+ if index > queue.first then -- Move all older notifications up in the list.
+ for i=index-1,-1,queue.first do
+ cout(0, i)
+ item = queue.items[i]
+ item:setYposition(CEGUI.UDim(0, itemHeight*(queue.last-i-1)))
+ queue.items[i+1] = item
+ end
+ end
+ queue.items[queue.first] = nil
+ queue.first = queue.first+1
+
-- Sets the queue to invisible if there are no more notifications in it.
- if listbox:getItemCount() == 0 then
+ if queue.last-queue.first == 0 then
P.setVisible(queue, false)
end
end
@@ -104,8 +156,14 @@
if queue == nil then
return
end
- local listbox = CEGUI.toListbox(queue.window)
- CEGUI.toListbox(queue.window):resetList()
+ for i=queue.first,queue.last-1 do
+ local item = queue.items[i]
+ queue.window:removeChildWindow(item)
+ winMgr:destroyWindow(item)
+ end
+ queue.items = {}
+ queue.first = 1
+ queue.last = 1
-- Sets the queue to invisible.
P.setVisible(queue, false)
@@ -120,372 +178,120 @@
queue.visible = visible
end
--- Enter the edit mode of the notification layer.
-function P.enterEditMode()
- P.editMode = true
+-- Change the position of the queue.
+-- The parameters are (in order) 'name of the queue', 'relative x-position', 'absolute x-position in pixel', 'relative y-position', 'absolute y-position in pixel'.
+function P.moveQueue(queueName, relativeXPos, absoluteXPos, relativeYpos, absoluteYPos)
+ local queueWindow = P.queueList[queueName].window
+ queueWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(relativeXPos, absoluteXPos), CEGUI.UDim(relativeYpos, absoluteYPos)))
+end
- local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
-
- --Add control frame window.
- local window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/ControlWindow")
- local frame = tolua.cast(window, "CEGUI::FrameWindow")
- frame:setCloseButtonEnabled(false)
- frame:setText("NotificationLayer Control Window")
- frame:setSize(CEGUI.UVector2(CEGUI.UDim(0.7, 0), CEGUI.UDim(0.2, 0)))
- root:addChildWindow(window)
- local pane = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/ScrollingPane")
- pane:setSize(CEGUI.UVector2(CEGUI.UDim(1,-20), CEGUI.UDim(1,-30)))
- pane:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 10), CEGUI.UDim(0, 26)))
- window:addChildWindow(pane)
-
- vertOffset = 0
- horzOffset = 0
- -- Line to be able to create a new queue.
- local newQueueTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueTitle")
- newQueueTitle:setText("Create a new NotificationQueue:")
- local size = getMinTextSize(newQueueTitle)
- local textHeight = size[1]
- newQueueTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
- newQueueTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- pane:addChildWindow(newQueueTitle)
- horzOffset = horzOffset + size[2] + 5
- local newQueueName = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueName")
- newQueueName:setProperty("ReadOnly", "set:False")
- newQueueName:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
- newQueueName:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- horzOffset = horzOffset + size[2] + 5
- pane:addChildWindow(newQueueName)
- local create = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/CreateNewQueue")
- create:setText("create")
- P.sampleWindow:setText("create")
- size = getMinTextSize(P.sampleWindow)
- create:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]+20), CEGUI.UDim(0, textHeight)))
- create:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- orxonox.GUIManager:subscribeEventHelper(create, "Clicked", P.name .. ".createNewQueue_clicked")
- pane:addChildWindow(create)
- horzOffset = horzOffset + size[2]+20 + 5
- vertOffset = vertOffset + textHeight + 5
-
- horzOffset = 0
- -- Button to leave the edit mode.
- local leave = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/ControlWindow/LeaveEditModeButton")
- leave:setText("leave Edit Mode")
- P.sampleWindow:setText("leave Edit Mode")
- size = getMinTextSize(P.sampleWindow)
- leave:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]+20), CEGUI.UDim(0, textHeight)))
- leave:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- orxonox.GUIManager:subscribeEventHelper(leave, "Clicked", P.name .. ".leaveEditMode_clicked")
- pane:addChildWindow(leave)
- horzOffset = horzOffset + size[2]+20 + 5
- vertOffset = vertOffset + textHeight + 5
-
- --Replace all queues with FrameWindows
- for k,v in pairs(P.queueList) do
- if v ~= nil then
- local queue = P.queueList[k]
- -- Remove the window that displays the queue from the root window such that it is no longer displayed.
- root:removeChildWindow(v.window)
-
- -- Create the frame window, with options to edit the queue, that is displayed instead of the queue.
- local window = P.createQueueEditFrame(v.name)
- window:setArea(v.window:getArea()) -- Set the frame window size and position to the same as the queue.
-
- v.edit = window
- end
+-- Change the size of the queue.
+-- The parameters are (in order) 'name of the queue', 'relative width', 'absolute width in pixel', 'relative height', 'absolute heigth in pixel'.
+-- Additionally the last two parameters can be ommitted, which leads to the height being set such that all notifications can be displayed. using the size of the queue.
+function P.resizeQueue(queueName, relativeWidth, absoluteWidth, relativeHeight, absoluteHeigth)
+ local queue = P.queueList[queueName]
+ local queueWindow = queue.window
+ if queueWindow == nil then
+ return
end
+ if absoluteHeigth == nil then
+ absoluteHeigth = P.queueHeightHelper(queue, queue.maxSize)
+ relativeHeight = 0
+ end
+ queueWindow:setSize(CEGUI.UVector2(CEGUI.UDim(relativeWidth, absoluteWidth), CEGUI.UDim(relativeHeight, absoluteHeigth)))
end
--- Helper function. Creates a frame for the input queue.
-function P.createQueueEditFrame(queueName)
- local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
-
- window = winMgr:createWindow("MenuWidgets/FrameWindow", "orxonox/NotificationLayer/Root/EditMode/" .. queueName)
- local frame = tolua.cast(window, "CEGUI::FrameWindow")
- frame:setCloseButtonEnabled(true)
- orxonox.GUIManager:subscribeEventHelper(frame, "CloseClicked", P.name .. ".closeQueue_clicked")
- frame:setText("NotificationQueue \"" .. queueName .. "\"")
- root:addChildWindow(window)
- local pane = winMgr:createWindow("MenuWidgets/ScrollablePane", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/ScrollingPane")
- pane:setSize(CEGUI.UVector2(CEGUI.UDim(1,-20), CEGUI.UDim(1,-30)))
- pane:setPosition(CEGUI.UVector2(CEGUI.UDim(0, 10), CEGUI.UDim(0, 26)))
- window:addChildWindow(pane)
-
- local horzOffset = 0
- local vertOffset = 0
-
- -- The line that lets you edit the targets of the queue.
- local targetsTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/TargetsTitle")
- targetsTitle:setText("Targets:")
- local size = getMinTextSize(targetsTitle)
- local textHeight = size[1]
- targetsTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
- targetsTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- pane:addChildWindow(targetsTitle)
- horzOffset = horzOffset + size[2] + 5
- local targets = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets")
- targets:setProperty("ReadOnly", "set:False")
- local targetsText = orxonox.NotificationManager:getInstance():getQueue(queueName):getTargets()
- targets:setText(targetsText)
- P.sampleWindow:setText(targetsText)
- size = getMinTextSize(P.sampleWindow)
- targets:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
- targets:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- horzOffset = horzOffset + size[2]*2+20 + 5
- pane:addChildWindow(targets)
- local save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets/Save")
- save:setText("save")
- P.sampleWindow:setText("save")
- size = getMinTextSize(P.sampleWindow)
- local saveTextWidth = size[2]+20
- save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
- save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveTargets_clicked")
- pane:addChildWindow(save)
- horzOffset = horzOffset + saveTextWidth
- vertOffset = vertOffset + textHeight + 5
-
- horzOffset = 0
- -- The line that lets you edit the size of the queue.
- local sizeTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/SizeTitle")
- sizeTitle:setText("Size:")
- size = getMinTextSize(sizeTitle)
- sizeTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
- sizeTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- pane:addChildWindow(sizeTitle)
- horzOffset = horzOffset + size[2] + 5
- local queueSize = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size")
- queueSize:setProperty("ReadOnly", "set:False")
- local maxSize = orxonox.NotificationManager:getInstance():getQueue(queueName):getMaxSize()
- queueSize:setText(maxSize)
- P.sampleWindow:setText(maxSize)
- size = getMinTextSize(P.sampleWindow)
- queueSize:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
- queueSize:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- horzOffset = horzOffset + size[2]*2+20 + 5
- pane:addChildWindow(queueSize)
- save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size/Save")
- save:setText("save")
- P.sampleWindow:setText("save")
- size = getMinTextSize(P.sampleWindow)
- local saveTextWidth = size[2]+20
- save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
- save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveSize_clicked")
- pane:addChildWindow(save)
- horzOffset = horzOffset + saveTextWidth
- vertOffset = vertOffset + textHeight + 5
-
- horzOffset = 0
- -- The line that lets you edit the display time of the queue.
- local displayTimeTitle = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTimeTitle")
- displayTimeTitle:setText("Display time:")
- size = getMinTextSize(displayTimeTitle)
- displayTimeTitle:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]), CEGUI.UDim(0, textHeight)))
- displayTimeTitle:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- pane:addChildWindow(displayTimeTitle)
- horzOffset = horzOffset + size[2] + 5
- local displayTime = winMgr:createWindow("MenuWidgets/Editbox", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime")
- displayTime:setProperty("ReadOnly", "set:False")
- local time = orxonox.NotificationManager:getInstance():getQueue(queueName):getDisplayTime()
- displayTime:setText(time)
- P.sampleWindow:setText(time)
- size = getMinTextSize(P.sampleWindow)
- displayTime:setSize(CEGUI.UVector2(CEGUI.UDim(0, size[2]*2+20), CEGUI.UDim(0, textHeight)))
- displayTime:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- horzOffset = horzOffset + size[2]*2+20 + 5
- pane:addChildWindow(displayTime)
- save = winMgr:createWindow("MenuWidgets/Button", "orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime/Save")
- save:setText("save")
- P.sampleWindow:setText("save")
- size = getMinTextSize(P.sampleWindow)
- local saveTextWidth = size[2]+20
- save:setSize(CEGUI.UVector2(CEGUI.UDim(0, saveTextWidth), CEGUI.UDim(0, textHeight)))
- save:setPosition(CEGUI.UVector2(CEGUI.UDim(0, horzOffset), CEGUI.UDim(0, vertOffset)))
- orxonox.GUIManager:subscribeEventHelper(save, "Clicked", P.name .. ".saveDisplayTime_clicked")
- pane:addChildWindow(save)
- horzOffset = horzOffset + saveTextWidth
- vertOffset = vertOffset + textHeight + 5
-
- return window
-end
-
--- Leave the edit mode.
-function P.leaveEditMode()
- P.editMode = false
-
- local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
- --Replace all queues with FrameWindows
- for k,v in pairs(P.queueList) do
- if v ~= nil then
- -- Add the queue window to the root window to have it displayed again.
- root:addChildWindow(v.window)
- -- Set the size and position of the queue window to the size and position of the queue edit frame.
- v.window:setArea(v.edit:getArea())
- -- Destroy the edit frame.
- winMgr:destroyWindow(v.edit)
- v.edit = nil
- end
+-- Change the horizontal alignment of the displayed notifications.
+-- The parameters are the name of the queue and the alignment parameter,
+function P.changeQueueAlignment(queueName, alignment)
+ local queue = P.queueList[queueName]
+ local queueWindow = queue.window
+ if queueWindow == nil then
+ return
end
- --Remove control window
- winMgr:destroyWindow(winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/ControlWindow"))
-end
-
--- Is called after the sheet has been hidden.
-function P.onQuit()
- -- If we leave the edit mode we show the sheet again.
- if P.editMode then
- P.leaveEditMode()
- showMenuSheet(P.name, false, true)
+ queue.alignment = alignment
+ local item = nil
+ for i=queue.first,queue.last-1 do
+ item = queue.items[i]
+ item:setProperty("HorzFormatting", queue.alignment)
end
end
--- If the button to save the targets of a queue has been clicked.
-function P. saveTargets_clicked(e)
- local we = CEGUI.toWindowEventArgs(e)
- local name = we.window:getName()
-
- local match = string.gmatch(name, "EditMode/.*/Targets/Save")
- local nameStr = match()
- local queueName = string.sub(nameStr, 10, string.len(nameStr)-13)
-
- local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets")
- local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Targets/Save")
- local width = window:getWidth():asAbsolute(1)
-
- local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
- -- Set the new targets.
- queue:setTargets(window:getText())
- local targets = queue:getTargets()
-
- window:setText(targets)
- P.sampleWindow:setText(targets)
- local size = getMinTextSize(P.sampleWindow)
- -- Adjust the width of the targets field.
- window:setWidth(CEGUI.UDim(0, size[2]*2+20))
- -- Adjust the position of the save button after the targets field.
- save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
-end
-
--- If the button to save the size if a queue has been clicked.
-function P. saveSize_clicked(e)
- local we = CEGUI.toWindowEventArgs(e)
- local name = we.window:getName()
-
- local match = string.gmatch(name, "EditMode/.*/Size/Save")
- local nameStr = match()
- local queueName = string.sub(nameStr, 10, string.len(nameStr)-10)
-
- local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size")
- local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/Size/Save")
- local width = window:getWidth():asAbsolute(1)
-
- local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
- -- Set the new size.
- queue:setMaxSize(tonumber(window:getText()))
- local maxSize = queue:getMaxSize()
-
- window:setText(maxSize)
- P.sampleWindow:setText(maxSize)
- local size = getMinTextSize(P.sampleWindow)
- -- Adjust the width of the size field.
- window:setWidth(CEGUI.UDim(0, size[2]*2+20))
- -- Adjust the position of the save button after the size field.
- save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
-end
-
--- If the button to save the display time if a queue has been clicked.
-function P. saveDisplayTime_clicked(e)
- local we = CEGUI.toWindowEventArgs(e)
- local name = we.window:getName()
-
- local match = string.gmatch(name, "EditMode/.*/DisplayTime/Save")
- local nameStr = match()
- local queueName = string.sub(nameStr, 10, string.len(nameStr)-17)
-
- local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime")
- local save = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/" .. queueName .. "/DisplayTime/Save")
- local width = window:getWidth():asAbsolute(1)
-
- local queue = orxonox.NotificationManager:getInstance():getQueue(queueName)
- -- Set the new display time.
- queue:setDisplayTime(tonumber(window:getText()))
- local time = queue:getDisplayTime()
-
- window:setText(time)
- P.sampleWindow:setText(time)
- local size = getMinTextSize(P.sampleWindow)
- -- Adjust the width of the display time field.
- window:setWidth(CEGUI.UDim(0, size[2]*2+20))
- -- Adjust the position of the save button after the display time field.
- save:setXPosition(CEGUI.UDim(0, save:getXPosition():asAbsolute(1)-width+window:getWidth():asAbsolute(1)))
-end
-
--- if the button to create a new queue has been clicked.
-function P.createNewQueue_clicked(e)
- local window = winMgr:getWindow("orxonox/NotificationLayer/Root/EditMode/ControlWindow/NewQueueName")
- local name = window:getText()
-
- local queue = P.queueList[name]
- -- Test if a queue with that name already exists.
- if queue ~= nil then
- window:setText("Queue with that name already exists.")
+-- Change the font size of all notifications in a queue.
+-- The parameters are (in order) 'name of the queue', 'font size'.
+function P.changeQueueFontSize(queueName, size)
+ local queue = P.queueList[queueName]
+ local queueWindow = queue.window
+ if queueWindow == nil then
return
end
- -- Creates the new queue.
- orxonox.NotificationManager:getInstance():createQueue(name)
+ queue.fontSize = size
+ for i=queue.first,queue.last-1 do
+ P.setItemFontHelper(queue.items[i], queue, false)
+ end
+end
- queue = P.queueList[name]
- if queue == nil then
+-- Change the font color of all notifications in a queue.
+-- The parameters are (in order) 'name of the queue', 'ARGB of the font color in hex notation'.
+function P.changeQueueFontColor(queueName, color)
+ local queue = P.queueList[queueName]
+ local queueWindow = queue.window
+ if queueWindow == nil then
return
end
- -- Create the frame that represents the queue in edit mode, since that's what we're in.
- local frame = P.createQueueEditFrame(name)
- local root = winMgr:getWindow("orxonox/NotificationLayer/Root")
- -- Remove the queue window from the root window, since we're in edit mode.
- root:removeChildWindow(queue.window)
- -- Set the frame window size and position to that of the queue window.
- frame:setArea(queue.window:getArea())
- queue.edit = frame
-
- -- Reset the text to create a new queue.
- window:setText("")
+ queue.fontColor = color
+ for i=queue.first,queue.last-1 do
+ P.setItemFontHelper(queue.items[i], queue, true)
+ end
end
--- If the button to leave the edit mode has been clicked.
-function P.leaveEditMode_clicked(e)
- hideMenuSheet(P.name)
+-- Helper function to set the font size and color of a item of a queue.
+-- The parameters are (in order) 'the ListboxItem', 'the queue table', 'whether color should be changed as well'
+function P.setItemFontHelper(item, queue, changeColor)
+ --local item = tolua.cast(item, "CEGUI::ListboxTextItem")
+ local fontMgr = CEGUI.FontManager:getSingleton()
+ if (fontMgr["isFontPresent"] and fontMgr:isFontPresent("BlueHighway-" .. queue.fontSize)) or -- cegui 0.6
+ (fontMgr["isDefined"] and fontMgr:isDefined("BlueHighway-" .. queue.fontSize)) then -- cegui 0.7
+ item:setFont("BlueHighway-" .. queue.fontSize)
+ else
+ orxonox.GUIManager:addFontHelper("BlueHighway-" .. queue.fontSize, queue.fontSize, "bluehigh.ttf")
+ item:setFont("BlueHighway-" .. queue.fontSize)
+ end
+ if changeColor then
+ item:setProperty("TextColours", "tl:" .. queue.fontColor .. " tr:" .. queue.fontColor .. " bl:" .. queue.fontColor .. " br:" .. queue.fontColor .. "")
+ end
end
--- If the button to close the queue has been clicked.
-function P.closeQueue_clicked(e)
- local we = CEGUI.toWindowEventArgs(e)
- local name = we.window:getName()
-
- local match = string.gmatch(name, "EditMode/.*")
- local nameStr = match()
- local queueName = string.sub(nameStr, 10, string.len(nameStr))
-
- -- Destroy the frame window,
- winMgr:destroyWindow(P.queueList[queueName].edit)
- P.queueList[queueName].edit = nil
- -- Destroy the queue.
- orxonox.NotificationManager:getInstance():getQueue(queueName):destroy()
-end
-
-- Helper function. Returns height a queue needs to have to display 'size' items.
function P.queueHeightHelper(queue, size)
- local listbox = CEGUI.toListbox(queue)
- local item = CEGUI.createListboxTextItem("Text")
- listbox:addItem(item)
- local singleItemHeight = listbox:getTotalItemsHeight()
- local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue:getLookNFeel())
- local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue)
- local frameHeight = queue:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
- listbox:removeItem(item)
- return frameHeight + singleItemHeight*size
+ --local listbox = CEGUI.toListbox(queue.window)
+ --local item = CEGUI.createListboxTextItem("Text")
+ --P.setItemFontHelper(item, queue, false)
+ --listbox:addItem(item)
+ --local singleItemHeight = listbox:getTotalItemsHeight()
+ local singleItemHeight = P.itemHeightHelper(queue)
+ --local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue.window:getLookNFeel())
+ --local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue.window)
+ --local frameHeight = queue.window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
+ --listbox:removeItem(item)
+ --return frameHeight + singleItemHeight*size
+ return singleItemHeight*size + 1
end
+function P.itemHeightHelper(queue)
+ local item = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/NotificationLayer/Root/Test/")
+ item:setText("text")
+ P.setItemFontHelper(item, queue, true)
+ queue.window:addChildWindow(item)
+ item:setSize(CEGUI.UVector2(CEGUI.UDim(1, 0), CEGUI.UDim(1, 0)))
+ item:setProperty("FrameEnabled", "false")
+ local height = getStaticTextWindowHeight(item)
+ queue.window:removeChildWindow(item)
+ winMgr:destroyWindow(item)
+ return height
+end
+
return P
Modified: code/trunk/data/gui/scripts/QuestGUI.lua
===================================================================
--- code/trunk/data/gui/scripts/QuestGUI.lua 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/gui/scripts/QuestGUI.lua 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,33 +2,323 @@
local P = createMenuSheet("QuestGUI")
-P.rootWindow = nil
-P.detailsWindows = {}
+P.questManager = nil -- The QuestManager.
+P.showActive = true -- Whether the active or finished quest list is displayed.
+P.currentQuest = nil -- The quest that is currently displayed.
+P.player = nil -- The player the quests are displayed for.
P.quests = {}
-P.hints = {}
-P.player = nil
+P.subquests = {}
-- design parameters
-P.indentWidth = 20
P.scrollbarWidth = 13
-P.buttonHeight = 30
+P.frameHeigth = 18
+P.borderSize = 5
P.titleHeight = 26
-P.borderWidth = 5
-function P.onShow()
+--TODO:
+-- Highlight whether we are currently looking at active or finished quests
+-- Distinguish completed from failed quests
- local questsList = winMgr:getWindow("orxonox/QuestGUI/QuestsList")
+function P.onLoad()
+ P.questManager = orxonox.QuestManager:getInstance() -- Store the pointer to the QuestManager as an internal variable to allow for faster access,
+end
+function P.onShow()
+ -- Get the player.
P.player = orxonox.GUIManager:getInstance():getPlayer(P.name)
- P.rootWindow = P.createQuestGUI()
- questsList:addChildWindow(P.rootWindow)
+ -- Load the list of quests to be displayed.
+ P.loadQuestsList(P.currentQuest)
end
-function P.onHide()
- P.cleanup()
+-- Loads the list of quests, depending on P.showActive, either the active (P.showActive == true) or the finished, i.e. inactive quests are loaded.
+-- selectQuest is a pointer to a quest that should be selected, if it is nil the first quest is selected.
+function P.loadQuestsList(selectQuest)
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
+ P.clearQuestList()
+
+ local selectQuestId = nil
+ if selectQuest ~= nil then
+ selectQuestId = P.questManager:getId(selectQuest)
+ end
+
+ -- Iterate through all root-quests.
+ local numRootQuests = P.questManager:getNumRootQuests(P.player)
+ if numRootQuests > 0 then
+ local i = 0
+ while i <= numRootQuests-1 do
+ local quest = P.questManager:getRootQuest(P.player, i)
+ -- Insert the current quest into the list.
+ local item = P.insertQuest(list, quest)
+ -- If the quest was inserted in the list and is has the same id as the selectQuest (thus it is the same quest) it is selected.
+ if selectQuestId ~= nil and item ~= nil and selectQuestId == P.questManager:getId(quest) then
+ list:setItemSelectState(item, true)
+ end
+ -- Insert all subquests of this rootquest.
+ P.insertSubQuests(list, quest, selectQuestId)
+ i = i+1
+ end
+ -- If there were quests added to the list but there was no selectQuest specified (i.e. selectQuest was nil), the first item is selected.
+ if list:getItemCount() > 0 then
+ if selectQuestId == nil then
+ list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first quest.
+ end
+ -- If there werent any quests added the standard "no quests" message is loaded.
+ else
+ P.loadQuest()
+ end
+ end
end
+-- Helper function, recursively inserts all the (active or inactive, depending on P.showActive) subquests of the input quest.
+-- list is the list into which the subquests should be insterted.
+-- quest is the quest, whose subquests should be inserted.
+-- selectQuestId is the id of the quest that should be selected.
+function P.insertSubQuests(list, quest, selectQuestId)
+ -- Iterate through all sub-quests.
+ local numQuests = P.questManager:getNumSubQuests(quest, P.player)
+ if numQuests > 0 then
+ local i = 0
+ while i <= numQuests-1 do
+ local subquest = P.questManager:getSubQuest(quest, P.player, i)
+ -- Insert the current quest into the list.
+ local item = P.insertQuest(list, subquest)
+ -- If the quest was inserted in the list and is has the same id as the selectQuest (thus it is the same quest) it is selected.
+ if selectQuestId ~= nil and item ~= nil and selectQuestId == P.questManager:getId(subquest) then
+ list:setItemSelectState(item, true)
+ end
+ i = i+1
+ end
+ end
+end
+
+-- Helper function, inserts a quest into the list (depending whether active or inactive quests are being shown). Returns nil if the quest was not inserted.
+-- list is the list into which the quets should be inserted.
+-- quest is the quest to be inserted.
+function P.insertQuest(list, quest)
+ if P.showActive == quest:isActive(P.player) then
+ local item = CEGUI.createListboxTextItem(P.questManager:getDescription(quest):getTitle())
+ item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+ list:addItem(item)
+ table.insert(P.quests, quest)
+ return item
+ end
+ return nil
+end
+
+-- Loads the input quest.
+-- quest the quest to be loaded.
+function P.loadQuest(quest)
+
+ P.clearQuest() -- Clear the old quest.
+ if quest == nil then -- If quets is nil there is nothing to display.
+ return
+ else
+ local offset = 0
+
+ -- Load title and description
+ local description = P.questManager:getDescription(quest)
+ local titleWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Title")
+ titleWindow:setText(description:getTitle())
+ local descriptionWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Description")
+ descriptionWindow:setText(description:getDescription())
+ descriptionWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))
+ descriptionWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, P.borderSize)))
+ local height = getStaticTextWindowHeight(descriptionWindow)
+ descriptionWindow:setHeight(CEGUI.UDim(0, height))
+ offset = offset + height
+
+ -- Load subquests
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
+ local numQuests = P.questManager:getNumSubQuests(quest, P.player)
+ local i = 0
+ while i <= numQuests-1 do
+ local quest = P.questManager:getSubQuest(quest, P.player, i)
+ local item = CEGUI.createListboxTextItem(P.questManager:getDescription(quest):getTitle())
+ item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
+ list:addItem(item)
+ table.insert(P.subquests, quest)
+ i = i+1
+ end
+ height = list:getTotalItemsHeight()
+ if height > 0 then
+ height = height+P.frameHeigth
+ end
+ list:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, height)))
+ list:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset)))
+ offset = offset + height + P.borderSize
+
+ -- Load hints
+ local hintsWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Hints")
+ hintsWindow:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset)))
+ hintsWindow:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(0, 0)))
+ height = P.titleHeight
+ local numHints = P.questManager:getNumHints(quest, P.player)
+ local i = 0
+ while i <= numHints-1 do
+ local hint = P.questManager:getHints(quest, P.player, i)
+ height = height + P.insertHint(hintsWindow, hint, i, height)
+ i = i+1
+ end
+ if numHints == 0 then
+ height = 0
+ end
+ hintsWindow:setHeight(CEGUI.UDim(0, height))
+ offset = offset + height
+
+ -- Set the size of the wrapper
+ local window = winMgr:getWindow("orxonox/QuestGUI/Quest/Wrapper")
+ window:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize-P.scrollbarWidth), CEGUI.UDim(0,offset+P.borderSize)))
+ end
+
+ P.currentQuest = quest
+end
+
+-- Clear the currently displayed quest.
+function P.clearQuest()
+ -- clear title
+ local titleWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Title")
+ titleWindow:setText("no Quests")
+
+ -- clear description
+ local descriptionWindow = winMgr:getWindow("orxonox/QuestGUI/Quest/Description")
+ descriptionWindow:setText("There is currently no quest that can be displayed.")
+
+ -- clear list fo subquests
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
+ list:resetList()
+ list:setHeight(CEGUI.UDim(0, 0))
+ P.subquests = {}
+
+ -- clear hints
+ local hints = winMgr:getWindow("orxonox/QuestGUI/Quest/Hints")
+ local numChildren = hints:getChildCount()-2 -- TODO: HACK
+ local i = 0
+ while i < numChildren do
+ local hint = hints:getChild("orxonox/QuestGUI/Quest/Hints/" .. i)
+ if hint ~= nil then
+ hints:removeChildWindow(hint)
+ winMgr:destroyWindow(hint)
+ end
+ i = i+1
+ end
+ hints:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.scrollbarWidth-P.borderSize), CEGUI.UDim(0, 0)))
+
+ P.currentQuest = nil
+end
+
+-- Clear the quests list
+function P.clearQuestList()
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
+ list:resetList()
+ P.quests = {}
+end
+
+-- Select an input quest in the input list.
+-- list is the list in which the input quest is to be selected.
+-- quest is the quest to be selected.
+function P.selectQuest(list, quest)
+ if quest == nil then -- If the input quest is nil, there is nothing to be selected, an error is output and the first quest is selected instead.
+ cout(1, "Error in QuestGUI: selectQuest(), input quest is nil. Selecting first.")
+ list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first
+ return
+ end
+
+ local questId = P.questManager:getId(quest)
+ local found = false
+ local index = 0
+ -- Iterate over all quests currently in the list.
+ for k,v in pairs(P.quests) do
+ -- If the id's are the same we have found the quest.
+ if P.questManager:getId(v) == questId then
+ found = true
+ index = k-1
+ end
+ end
+
+ if found then -- If the quest was found it is selected.
+ list:setItemSelectState(list:getListboxItemFromIndex(index), true)
+ else -- If the quest isn't found an error is output and the first quest is selected instead.
+ cout(1, "Error in QuestGUI: selectQuest(), input quest is not in list. Selecting first.")
+ list:setItemSelectState(list:getListboxItemFromIndex(0), true) -- Select first
+ end
+end
+
+-- Helper function, insert the input hint into the input hintsWindow. Returns the height of the newly inserted hint.
+-- hintsWindow is the window in which the hint is to be inserted.
+-- hint is the hint to be inserted.
+-- index is the index of the hint.
+-- offset is the current offset in the hintsWindow.
+function P.insertHint(hintsWindow, hint, index, offset)
+ -- Create the window for the hint.
+ local window = winMgr:createWindow("MenuWidgets/StaticText", "orxonox/QuestGUI/Quest/Hints/" .. index)
+ window:setProperty("HorzFormatting", "WordWrapLeftAligned")
+ window:setProperty("VertFormatting", "TopAligned")
+ window:setProperty("FrameEnabled", "false")
+ window:setID(index)
+ hintsWindow:addChildWindow(window)
+ local description = P.questManager:getDescription(hint)
+ window:setText(description:getDescription())
+ window:setSize(CEGUI.UVector2(CEGUI.UDim(1, -P.borderSize), CEGUI.UDim(1, 0)))
+ local height = getStaticTextWindowHeight(window)
+ window:setHeight(CEGUI.UDim(0, height))
+ window:setPosition(CEGUI.UVector2(CEGUI.UDim(0, P.borderSize), CEGUI.UDim(0, offset)))
+ return height
+end
+
+-- Show the currently active quests in the quests list.
+function P.showActiveQuestsButton_clicked(e)
+ if P.showActive == false then
+ P.showActive = true
+ P.loadQuestsList()
+ end
+end
+
+-- Show the finished (i.e. inactive) quests in the quests list.
+function P.showFinishedQuestsButton_clicked(e)
+ if P.showActive == true then
+ P.showActive = false
+ P.loadQuestsList()
+ end
+end
+
+-- Change to a new quest.
+function P.changeQuest_clicked(e)
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
+ local choice = list:getFirstSelectedItem()
+ if choice ~= nil then
+ local index = list:getItemIndex(choice)
+ local quest = P.quests[index+1]
+ if quest ~= nil then
+ P.loadQuest(quest)
+ end
+ end
+end
+
+-- Change to a new subquest.
+function P.changeToSubquest_clicked(e)
+ local list = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/Quest/SubquestsList"))
+ local questsList = CEGUI.toListbox(winMgr:getWindow("orxonox/QuestGUI/QuestsList"))
+ local choice = list:getFirstSelectedItem()
+ if choice ~= nil then
+ local index = list:getItemIndex(choice)
+ local quest = P.subquests[index+1]
+ if quest ~= nil then
+ -- If the P.showActive must be changed to display the quest the quests list also has to be regenerated.
+ if quest:isActive(P.player) == P.showActive then
+ P.selectQuest(questsList, quest)
+ else
+ P.showActive = quest:isActive(P.player)
+ P.loadQuestsList(quest)
+ end
+ else
+ cout(1, "Error in QuestGUI: changeToSubquest(), quest was nil. Ignoring...")
+ end
+ end
+end
+
+-- old:
+--[[
function P.createQuestGUI()
local questManager = orxonox.QuestManager:getInstance()
@@ -282,7 +572,7 @@
winMgr:destroyWindow(P.detailsWindows[detailsNr])
P.detailsWindows[detailsNr] = nil
-end
+end --]]
return P
Modified: code/trunk/data/gui/scripts/SingleplayerMenu.lua
===================================================================
--- code/trunk/data/gui/scripts/SingleplayerMenu.lua 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/gui/scripts/SingleplayerMenu.lua 2011-06-14 18:53:28 UTC (rev 8706)
@@ -53,6 +53,7 @@
end
index = index + 1
end
+
for k,v in pairs(P.levelList) do
local item = CEGUI.createListboxTextItem(v:getName())
item:setSelectionBrushImage(menuImageSet, "MultiListSelectionBrush")
Modified: code/trunk/data/levels/FPSTest.oxw
===================================================================
--- code/trunk/data/levels/FPSTest.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/FPSTest.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,6 +20,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.1, 0.1, 0.1"
Modified: code/trunk/data/levels/asteroids.oxw
===================================================================
--- code/trunk/data/levels/asteroids.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/asteroids.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -13,6 +13,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Copied: code/trunk/data/levels/docking.oxw (from rev 8705, code/branches/presentation/data/levels/docking.oxw)
===================================================================
--- code/trunk/data/levels/docking.oxw (rev 0)
+++ code/trunk/data/levels/docking.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,210 @@
+<LevelInfo
+ name = "Transporter"
+ description = "Level with a Transporter. Demonstrates the docking system."
+ tags = ""
+/>
+
+<?lua
+ include("HUDTemplates3.oxo")
+ include("stats.oxo")
+ include("templates/spaceshipAssff.oxt")
+ include("templates/lodInformation.oxt")
+?>
+
+<Level
+ name = "Transporter"
+ description = "Docking example level"
+>
+ <templates>
+ <Template link="lodtemplate_default" />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.5, 0.5, 0.5"
+ skybox = "Orxonox/skypanoramagen1"
+ >
+
+ <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" />
+
+ <?lua for i = 1, 10, 1 do ?>
+ <SpawnPoint position="<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>,<?lua print(math.random() * 200 - 100) ?>" lookat="0,0,0" spawnclass="SpaceShip" pawndesign="spaceshipassff" />
+ <?lua end ?>
+
+
+
+ <SpaceShip
+ position = "280, 150, 115"
+ orientation = "0.5, 0.5, 0.5, 0.5"
+ hudtemplate = "spaceshiphud"
+ camerapositiontemplate = "spaceshipassffcameras"
+ engine = "spaceshipassffengine"
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = "3"
+ explosionchunks = "6"
+
+ health = "100"
+ maxhealth = "200"
+ initialhealth = "100"
+
+ primaryThrust = "100;"
+ auxilaryThrust = "30;"
+ rotationThrust = "25;"
+
+ collisionType = "dynamic"
+ mass = "100"
+ linearDamping = "0.7"
+ angularDamping = "0.9999999"
+ >
+ <attached>
+ <DistanceTriggerBeacon name="bcnSpaceShip" />
+ <DockingTarget name="spaceShip" />
+
+ <Model position="0,0,0" yaw="90" pitch="-90" roll="0" scale="4" mesh="assff.mesh" />
+ <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude="0.1" frequency="0.5" quadratic="1" />
+ <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude="0.1" frequency="0.5" phase="180" quadratic="1" />
+ <DistanceTriggerBeacon name="PlayerDistanceTrigger" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 3, 5" />
+ <BoxCollisionShape position="13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="0,0,7" halfExtents="3, 2, 2" />
+ <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" />
+ <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" />
+ </collisionShapes>
+<?lua
+ include("includes/weaponSettingsAssff.oxi")
+?>
+ </SpaceShip>
+
+
+
+
+ <Destroyer
+ position = "100,150,100"
+ collisionType = "dynamic"
+ mass = "100000"
+ velocity = "0,0,0"
+ angularDamping = "0.9999999"
+ health = "10000"
+ maxhealth = "10000"
+ initialhealth = "10000"
+ >
+
+ <attached>
+
+ <DistanceTriggerBeacon name="bcnDestroyer" />
+ <DockingTarget name="destroyer" />
+
+
+ <Dock orientation="0.5, 0.5, 0.5, 0.5">
+ <animations>
+ <MoveToDockingTarget target="destroyer" position="10,150,40" />
+ </animations>
+ <effects>
+ <DockToShip target="spaceShip" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event="dockMe" />
+ </execute>
+ </events>
+ <attached>
+ <DistanceTrigger position="0,0,-200" distance="30" target="Pawn" beaconMode="exclude" targetname="bcnDestroyer" name="dockMe" />
+ <Billboard position="0,0,-200" material="Examples/Flare" colour="1.0, 0, 0" />
+ </attached>
+ </Dock>
+
+
+ <TeamSpawnPoint team="1" position="150,0,7" direction="-1,0,0" roll="90" yaw="0" spawnclass="SpaceShip" pawndesign="spaceshipassff" />
+ <TeamSpawnPoint team="1" position="0,0,7" lookat="-1,0,0" roll="90" yaw="0" spawnclass="SpaceShip" pawndesign="spaceshipassff" />
+ <TeamSpawnPoint team="1" position="-50,0,7" lookat="-1,0,0" roll="90" yaw="0" spawnclass="SpaceShip" pawndesign="spaceshipassff" />
+ <TeamSpawnPoint team="1" position="100,0,7" lookat="-1,0,0" roll="90" yaw="0" spawnclass="SpaceShip" pawndesign="spaceshipassff" />
+ <TeamSpawnPoint team="1" position="50,0,7" lookat="-1,0,0" roll="90" yaw="0" spawnclass="SpaceShip" pawndesign="spaceshipassff" />
+ <?lua for i = 1, 100, 1 do ?>
+ <TeamSpawnPoint
+ team="0"
+ position="<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>,<?lua print((math.random() * 500 + 500) * (math.floor(math.random() + 0.5) * 2 - 1)) ?>"
+ lookat="0,0,0"
+ spawnclass="SpaceShip"
+ pawndesign="spaceshipassff"
+ />
+ <?lua end ?>
+
+ <Model mesh="Carrier.mesh" scale="5" />
+ <Backlight
+ mainstate="activity"
+ active="false"
+ scale="0.4"
+ name="bltest"
+ position=" 7.6, 0, 6"
+ colour="0.2, 0.65, 1.0, 1.0"
+ width="15"
+ length="1500"
+ lifetime="2"
+ elements="50"
+ trailmaterial="Trail/backlighttrail"
+ turnontime="1"
+ turnofftime="1"
+ material="Flares/ThrusterFlare1"
+ />
+ <Backlight
+ scale="1"
+ position=" 169, 75, -15"
+ colour="1, 0.85, 0.5, 0.5"
+ width="40"
+ length="1000"
+ lifetime="5"
+ elements="15"
+ trailmaterial="Trail/backlighttrail"
+ material="Examples/Flare"
+ />
+ <Backlight
+ scale="1"
+ position=" 169, -75, -15"
+ colour="1, 0.85, 0.5, 0.5"
+ width="40"
+ length="1000"
+ lifetime="5"
+ elements="15"
+ trailmaterial="Trail/backlighttrail"
+ material="Examples/Flare"
+ />
+ <?lua for i=0,8,1 do ?>
+ <BlinkingBillboard
+ position="<?lua print(200-270/8*i)?> ,15,2"
+ material="Examples/Flare"
+ colour="1.0, 0.5, 0.3"
+ phase="<?lua print(-360/8*i)?>"
+ amplitude="0.1"
+ frequency="0.5"
+ quadratic="1"
+ />
+
+ <BlinkingBillboard
+ position="<?lua print(200-270/8*i)?>,-15,2"
+ material="Examples/Flare"
+ colour="1.0, 0.5, 0.3"
+ phase="<?lua print(-360/8*i)?>"
+ amplitude="0.1"
+ frequency="0.5"
+ quadratic="1"
+ />
+ <?lua end ?>
+
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="70,0,-25" halfExtents="150, 50, 25" />
+ <BoxCollisionShape position="95,75,-16" halfExtents="70, 10, 12" />
+ <BoxCollisionShape position="95,-75,-16" halfExtents="70, 10, 12" />
+ <BoxCollisionShape position="77,47,30" halfExtents="110, 2, 30" />
+ <BoxCollisionShape position="77,-47,30" halfExtents="110, 2, 30" />
+ <BoxCollisionShape position="77,0,50" halfExtents="110, 45, 6" />
+ <BoxCollisionShape position="167,0,70" halfExtents="17, 20, 20" />
+ </collisionShapes>
+
+ </Destroyer>
+
+ </Scene>
+</Level>
Modified: code/trunk/data/levels/dynamicMatch.oxw
===================================================================
--- code/trunk/data/levels/dynamicMatch.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/dynamicMatch.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -15,6 +15,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/levels/earth.oxw
===================================================================
--- code/trunk/data/levels/earth.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/earth.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -18,6 +18,7 @@
<templates>
<Template link="lodtemplate_default" />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Template name=PortalDefault>
<PortalEndPoint>
Property changes on: code/trunk/data/levels/earth.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/data/levels/emptyLevel.oxw
===================================================================
--- code/trunk/data/levels/emptyLevel.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/emptyLevel.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -11,7 +11,7 @@
?>
<?lua
- include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipAssff2.oxt")
include("templates/spaceshipPirate.oxt")
?>
@@ -22,6 +22,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
@@ -29,7 +30,7 @@
>
<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"/>
- <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+ <SpawnPoint team=0 position="-200,0,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff2 />
</Scene>
</Level>
Modified: code/trunk/data/levels/events.oxw
===================================================================
--- code/trunk/data/levels/events.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/events.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -19,6 +19,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/levels/fightInOurBack.oxw
===================================================================
--- code/trunk/data/levels/fightInOurBack.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/fightInOurBack.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -67,6 +67,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<!-- Ausgang: Szene ===> ambientlight/skybox -->
<Scene
Copied: code/trunk/data/levels/includes/notifications.oxi (from rev 8705, code/branches/presentation/data/levels/includes/notifications.oxi)
===================================================================
--- code/trunk/data/levels/includes/notifications.oxi (rev 0)
+++ code/trunk/data/levels/includes/notifications.oxi 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,20 @@
+<Script code="showGUI NotificationLayer false true" needsGraphics="true" />
+
+<NotificationQueueCEGUI
+ name="all"
+ targets="questsystem"
+ displaySize="0.5, 0, 0, 0"
+ position="0, 10, 0.3, 0"
+/>
+
+<NotificationQueueCEGUI
+ name="info"
+ targets="gameinfo"
+ size=1
+ displayTime=-1
+ position="0.2, 0, 0.8, 0"
+ fontSize="24"
+ fontColor="1, 1, 0, 0.8"
+ alignment="HorzCentred"
+ displaySize="0.6, 0, 0, 0"
+/>
\ No newline at end of file
Modified: code/trunk/data/levels/includes/pickups.oxi
===================================================================
--- code/trunk/data/levels/includes/pickups.oxi 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/includes/pickups.oxi 2011-06-14 18:53:28 UTC (rev 8706)
@@ -201,7 +201,7 @@
<PickupRepresentation
pickupName = "Drone Pickup"
- pickupDescription = "Adds a Drone to the Players Spaceship"
+ pickupDescription = "Adds a Drone to the Player's Spaceship"
spawnerTemplate = "dronepickupRepresentation"
>
<pickup>
@@ -209,3 +209,35 @@
</pickup>
</PickupRepresentation>
+<!-- Shrink Pickup -->
+
+<PickupRepresentation
+ pickupName = "Small Shrink"
+ pickupDescription = "Shrinks the Ship by a bit"
+ spawnerTemplate = "smallshrinkpickupRepresentation"
+>
+ <pickup>
+ <ShrinkPickup template=smallshrinkpickup />
+ </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+ pickupName = "Medium Shrink"
+ pickupDescription = "Shrinks the Ship"
+ spawnerTemplate = "mediumshrinkpickupRepresentation"
+>
+ <pickup>
+ <ShrinkPickup template=mediumshrinkpickup />
+ </pickup>
+</PickupRepresentation>
+
+<PickupRepresentation
+ pickupName = "Huge Shrink"
+ pickupDescription = "Shrinks the Ship considerably"
+ spawnerTemplate = "hugeshrinkpickupRepresentation"
+>
+ <pickup>
+ <ShrinkPickup template=hugeshrinkpickup />
+ </pickup>
+</PickupRepresentation>
+
Modified: code/trunk/data/levels/includes/weaponSettingsAssff.oxi
===================================================================
--- code/trunk/data/levels/includes/weaponSettingsAssff.oxi 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/includes/weaponSettingsAssff.oxi 2011-06-14 18:53:28 UTC (rev 8706)
@@ -25,7 +25,7 @@
</attached>
<HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" />
<HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" />
- <LightningGun mode=1 muzzleoffset="0,0,0" damage=23 />
+ <LightningGun mode=1 muzzleoffset="0,0,0" damage=3.14159 shielddamage=20 />
</Weapon>
<Weapon>
<attached>
@@ -38,8 +38,8 @@
<LightningGun mode=1 muzzleoffset="0,0,0" damage=23 />
</Weapon>
<Weapon>
- <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=50 />
- <RocketFire mode=3 muzzleoffset="0,0,0" damage=100 />
+ <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=30 shielddamage=20 />
+ <RocketFire mode=3 muzzleoffset="0,0,0" damage=30 healthdamage=50 shielddamage=20 />
</Weapon>
</WeaponPack>
<WeaponPack>
Copied: code/trunk/data/levels/includes/weaponSettingsAssff2.oxi (from rev 8705, code/branches/presentation/data/levels/includes/weaponSettingsAssff2.oxi)
===================================================================
--- code/trunk/data/levels/includes/weaponSettingsAssff2.oxi (rev 0)
+++ code/trunk/data/levels/includes/weaponSettingsAssff2.oxi 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,55 @@
+ <weaponslots>
+ <WeaponSlot position="-15.0,-1.5,0" />
+ <WeaponSlot position=" 15.0,-1.5,0" />
+ <WeaponSlot position=" 0, 0,0" />
+ </weaponslots>
+ <weaponsets>
+ <WeaponSet firemode=0 />
+ <WeaponSet firemode=1 />
+ <WeaponSet firemode=2 />
+ <WeaponSet firemode=3 />
+ </weaponsets>
+ <weapons>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+ <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
+ <DefaultWeaponmodeLink firemode=2 weaponmode=2 />
+ <DefaultWeaponmodeLink firemode=3 weaponmode=3 />
+ </links>
+ <Weapon>
+ <attached>
+ <Model mesh="stunweapon.mesh" pitch="180" roll="0" yaw="0" position="-1.9,-.5,1" scale=".5" />
+ <BlinkingBillboard position="-1.9, -.5, -5.5" material="PE/lensflare" colour="0.128, 0.28, 1" amplitude=0.25 frequency=16 quadratic=0 />
+ </attached>
+ <HsW01 mode=0 munitionpershot=0 delay=0 healthamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" >
+ <attached>
+ <ParticleEmitter position="0,0,6.2" source="Orxonox/weaponshoot" />
+ </attached>
+ </HsW01>
+ <HsW01 mode=0 munitionpershot=0 delay=0 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" />
+ <LightningGun mode=1 muzzleoffset="0,0,0" shielddamage=23 />
+ </Weapon>
+ <Weapon>
+ <attached>
+ <Model mesh="stunweapon.mesh" pitch="180" roll="0" yaw="0" position="1.9,-.5,1" scale=".5"/>
+ <BlinkingBillboard position="1.9, -.5, -5.5" material="PE/lensflare" colour="0.128, 0.28, 1" amplitude=0.25 frequency=16 quadratic=0 />
+ </attached>
+ <HsW01 mode=0 munitionpershot=0 delay=0 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" />
+ <HsW01 mode=0 munitionpershot=0 delay=0.125 healthdamage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" />
+ <LightningGun mode=1 muzzleoffset="0,0,0" shielddamage=23 />
+ </Weapon>
+ <Weapon>
+ <SimpleRocketFire mode=2 muzzleoffset="0,0,0" damage=50 />
+ <RocketFire mode=3 muzzleoffset="0,0,0" damage=100 />
+ </Weapon>
+ </WeaponPack>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
+ </links>
+ <!--Weapon>
+ <EnergyDrink mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" />
+ </Weapon-->
+ </WeaponPack>
+ </weapons>
Copied: code/trunk/data/levels/includes/weaponSettingsImmTest.oxi (from rev 8705, code/branches/presentation/data/levels/includes/weaponSettingsImmTest.oxi)
===================================================================
--- code/trunk/data/levels/includes/weaponSettingsImmTest.oxi (rev 0)
+++ code/trunk/data/levels/includes/weaponSettingsImmTest.oxi 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,57 @@
+ <weaponslots>
+ <WeaponSlot position="-15.0,-1.5,0" />
+ <WeaponSlot position=" 15.0,-1.5,0" />
+ <WeaponSlot position=" 0, 0,0" />
+ </weaponslots>
+ <weaponsets>
+ <WeaponSet firemode=0 />
+ <WeaponSet firemode=1 />
+ <WeaponSet firemode=2 />
+ <WeaponSet firemode=3 />
+ </weaponsets>
+ <weapons>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=0 weaponmode=0 />
+ <DefaultWeaponmodeLink firemode=1 weaponmode=1 />
+ <DefaultWeaponmodeLink firemode=2 weaponmode=2 />
+ <DefaultWeaponmodeLink firemode=3 weaponmode=3 />
+ </links>
+ <!-- HsW01 is the standard Weapon, 4 slots => 4 Projectiles spawned at one click -->
+ <!-- LightningGun is the spiral weapon, 2 slots -->
+ <!-- SimpleRocket is the target-following rocket -->
+ <!-- Rocket is the player-guided rocket -->
+ <Weapon>
+ <attached>
+ <Model mesh="LightningGun.mesh" pitch="100" roll="90" yaw="90" position="0,-1.3,0" />
+ <!--Model mesh="LightningGun-s.mesh" pitch="78" roll="90" yaw="90" position="0.2,-1.3,0" /-->
+ <Model mesh="hs-w01_reduced.mesh" roll="90" pitch="-76" yaw="-90" position="-1.5,1,0.3" scale=0.6 />
+ </attached>
+ <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 0.1, 1.6,-2" />
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-1.6, 1.3,-2" />
+ <LightningGun mode=1 muzzleoffset="0,0,0" shielddamage=5 />
+ </Weapon>
+ <Weapon>
+ <attached>
+ <Model mesh="LightningGun.mesh" pitch="103" roll="90" yaw="90" position="0,-1.35,0" />
+ <!--Model mesh="LightningGun-s.mesh" pitch="103" roll="90" yaw="90" position="0.2,-1.35,0" /-->
+ <Model mesh="hs-w01_reduced.mesh" roll="90" pitch="-104" yaw="-90" position="0,1.3,0.3" scale=0.6 />
+ </attached>
+ <HsW01 mode=0 munitionpershot=0 delay=0 damage=3.14159 material="Flares/point_lensflare" muzzleoffset=" 1.6, 1.3, -2.0" />
+ <HsW01 mode=0 munitionpershot=0 delay=0.125 damage=3.14159 material="Flares/point_lensflare" muzzleoffset="-0.1, 1.6, -2.0" />
+ <LightningGun mode=1 muzzleoffset="0,0,0" healthdamage=0 shielddamage=500 />
+ </Weapon>
+ <Weapon>
+ <SimpleRocketFire mode=2 muzzleoffset="0,0,0" shielddamage=50 />
+ <RocketFire mode=3 muzzleoffset="0,0,0" healthdamage=80 shielddamage=20 />
+ </Weapon>
+ </WeaponPack>
+ <WeaponPack>
+ <links>
+ <DefaultWeaponmodeLink firemode=1 weaponmode=0 />
+ </links>
+ <!--Weapon>
+ <EnergyDrink mode=0 munitionpershot=0 delay=0 material="Flares/point_lensflare"muzzleoffset="2,-0.2,-1" />
+ </Weapon-->
+ </WeaponPack>
+ </weapons>
Modified: code/trunk/data/levels/lastManStanding.oxw
===================================================================
--- code/trunk/data/levels/lastManStanding.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/lastManStanding.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,6 +22,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
Modified: code/trunk/data/levels/lastTeamStanding.oxw
===================================================================
--- code/trunk/data/levels/lastTeamStanding.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/lastTeamStanding.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -21,11 +21,13 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
skybox = "Orxonox/skypanoramagen1"
>
+ <?lua include("includes/notifications.oxi") ?>
<?lua
include("includes/pickups.oxi")
Modified: code/trunk/data/levels/lastTeamStandingII.oxw
===================================================================
--- code/trunk/data/levels/lastTeamStandingII.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/lastTeamStandingII.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -21,6 +21,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
Modified: code/trunk/data/levels/myTestLevel.oxw
===================================================================
--- code/trunk/data/levels/myTestLevel.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/myTestLevel.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,6 +22,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
@@ -29,10 +30,12 @@
>
<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"/>
- <SpawnPoint team=0 position="0,0,0" lookat="2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+ <SpawnPoint team=0 position="0,0,0" direction="1,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
- <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="100" healthDecrease="0.1" position="0,0,0"/>
+ <SpaceBoundaries warnDistance="1" maxDistance="200" showDistance="150" reactionMode="0" healthDecrease="0.9" position="0,0,0"/>
+ <Billboard position="0,0,0" colour="1.0,1.0,1.0" material="Flares/backlightflare" scale=1 />
+
</Scene>
</Level>
Property changes on: code/trunk/data/levels/myTestLevel.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/data/levels/notifications.oxw
===================================================================
--- code/trunk/data/levels/notifications.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/notifications.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -18,14 +18,13 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
skybox = "Orxonox/skypanoramagen1"
>
- <Script code="showGUI NotificationLayer false true" needsGraphics="true" />
-
<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" />
<CommandNotification preMessage="Open the PickupInventory by pressing '" postMessage="'." command="OrxonoxOverlay toggleVisibility PickupInventory">
Modified: code/trunk/data/levels/pickups.oxw
===================================================================
--- code/trunk/data/levels/pickups.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/pickups.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,6 +22,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
@@ -189,5 +190,32 @@
</pickup>
</PickupSpawner>
+ <PickupSpawner position="-25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
+ <pickup>
+ <ShrinkPickup template ="smallshrinkpickup"/>
+ </pickup>
+ </PickupSpawner>
+
+ <PickupSpawner position="0,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
+ <pickup>
+ <ShrinkPickup template ="mediumshrinkpickup"/>
+ </pickup>
+ </PickupSpawner>
+
+ <PickupSpawner position="25,-50,-125" respawnTime="60" triggerDistance="20" maxSpawnedItems="5">
+ <pickup>
+ <ShrinkPickup template ="hugeshrinkpickup"/>
+ </pickup>
+ </PickupSpawner>
+
+ <!--StaticEntity position="0,-200,0" direction="0,-1,0" collisionType=static mass=500 friction=0.01 >
+ <attached>
+ <Model position="0,0,0" mesh="cube.mesh" scale3D="10,10,10" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10,10,10" />
+ </collisionShapes>
+ </StaticEntity-->
+
</Scene>
</Level>
Modified: code/trunk/data/levels/pirateAttack.oxw
===================================================================
--- code/trunk/data/levels/pirateAttack.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/pirateAttack.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -8,7 +8,6 @@
include("HUDTemplates3.oxo")
include("stats.oxo")
include("templates/spaceshipAssff.oxt")
- include("templates/spaceshipHXYSL.oxt")
include("templates/spaceshipPirate.oxt")
include("templates/lodInformation.oxt")
?>
@@ -34,6 +33,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.3, 0.3, 0.3"
Modified: code/trunk/data/levels/planets.oxw
===================================================================
--- code/trunk/data/levels/planets.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/planets.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -18,6 +18,7 @@
<templates>
<Template link="lodtemplate_default" />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
Modified: code/trunk/data/levels/pong.oxw
===================================================================
--- code/trunk/data/levels/pong.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/pong.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -14,7 +14,7 @@
<Template name=pongbatcameras defaults=0>
<PongBat>
<camerapositions>
- <CameraPosition position="0,200,0" pitch=-90 absolute=true />
+ <CameraPosition position="0,150,0" pitch=-90 absolute=true />
<CameraPosition position="0,50,160" drag=true mouselook=true />
<CameraPosition position="0,40,125" drag=true mouselook=true />
<CameraPosition position="0,30, 90" drag=true mouselook=true />
@@ -55,8 +55,9 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
- <WorldAmbientSound source="mainmenu.ogg" playOnLoad=true />
+ <WorldAmbientSound source="Ganymede.ogg" playOnLoad=true looping=true />
<PongBot />
@@ -66,11 +67,7 @@
>
<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" />
- <?lua
- for i = 1, 10, 1 do
- ?>
- <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" />
- <?lua end ?>
+ <SpawnPoint position="991.729, -110.11, 435.404" orientation="0.534038, 0.563456, 0.212168, 0.593553" />
<MovableEntity rotationrate=5 rotationaxis="0,0,1">
<attached>
Modified: code/trunk/data/levels/portals.oxw
===================================================================
--- code/trunk/data/levels/portals.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/portals.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,6 +20,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
@@ -34,8 +35,8 @@
</PortalEndPoint>
</Template>
- <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="PortalDefault"/>
- <PortalEndPoint position="-100,0,0" id="2" distance="40" target="MobileEntity" design="PortalDefault"/>
+ <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="PortalDefault" reenterDelay="0"/>
+ <PortalEndPoint position="-300,0,0" id="2" distance="40" target="MobileEntity" design="PortalDefault" reenterDelay="0"/>
<PortalLink fromID="1" toID="2" />
<PortalLink fromID="2" toID="1" />
Property changes on: code/trunk/data/levels/portals.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/data/levels/presentation.oxw
===================================================================
--- code/trunk/data/levels/presentation.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentation.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -18,6 +18,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.3, 0.3, 0.3"
Modified: code/trunk/data/levels/presentation09.oxw
===================================================================
--- code/trunk/data/levels/presentation09.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentation09.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,6 +20,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/levels/presentation09b.oxw
===================================================================
--- code/trunk/data/levels/presentation09b.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentation09b.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,6 +22,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/levels/presentationDM.oxw
===================================================================
--- code/trunk/data/levels/presentationDM.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentationDM.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -19,6 +19,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/levels/presentationFS10.oxw
===================================================================
--- code/trunk/data/levels/presentationFS10.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentationFS10.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -25,6 +25,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
Modified: code/trunk/data/levels/presentationFS102.oxw
===================================================================
--- code/trunk/data/levels/presentationFS102.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentationFS102.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,6 +20,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.1, 0.1, 0.1"
Modified: code/trunk/data/levels/presentationFS10Ed.oxw
===================================================================
--- code/trunk/data/levels/presentationFS10Ed.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentationFS10Ed.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,6 +20,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.1, 0.1, 0.1"
Modified: code/trunk/data/levels/presentationFS11.oxw
===================================================================
--- code/trunk/data/levels/presentationFS11.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentationFS11.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -12,6 +12,7 @@
<?lua
include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipAssff2.oxt")
include("templates/spaceshipPirate.oxt")
?>
@@ -26,10 +27,23 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
+ <NotificationQueueCEGUI
+ name="narrative"
+ targets="simpleNotification"
+ size=1
+ displayTime=30
+ position="0.2, 0, 0.1, 0"
+ fontSize="24"
+ fontColor="0.3, 1, 0.2, 0.8"
+ alignment="HorzCentred"
+ displaySize="0.6, 0, 0, 0"
+ />
+
<Scene
ambientlight = "0.8, 0.8, 0.8"
- skybox = "Orxonox/Starbox"
+ skybox = "Orxonox/skyboxempty"
>
<?lua
@@ -37,21 +51,238 @@
?>
<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"/>
- <SpawnPoint team=0 position="0,0,0" lookat="2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+ <!-- SOUND -->
+ <WorldAmbientSound source="Earth.ogg" looping="true" playOnLoad="true" />
+ <WorldAmbientSound source="Mars.ogg" looping="true">
+ <events>
+ <activity>
+ <DistanceTrigger position="-72369,803,2" distance=1700 target="Camera" />
+ </activity>
+ </events>
+ </WorldAmbientSound>
+ <WorldAmbientSound source="Jupiter.ogg" looping="true">
+ <events>
+ <activity>
+ <DistanceTrigger position="-73450,5067,-351" distance=800 target="Camera" />
+ </activity>
+ </events>
+ </WorldAmbientSound>
- <!-- PICKUPS -->
- <PickupSpawner position="-50,50,-125" triggerDistance="10" respawnTime="30" maxSpawnedItems="10">
- <pickup>
- <DronePickup template=dronepickup />
- </pickup>
- </PickupSpawner>
+ <!-- EARTH ORBIT -->
+ <DistanceTrigger name="spawntrigger" position="0,0,0" target="Pawn" distance=10 stayActive="true" />
+ <DistanceTrigger name="spawndelaytrigger1" position="0,0,0" target="Pawn" distance=10 stayActive="true" delay=1 />
+ <DistanceTrigger name="spawndelaytrigger2" position="0,0,0" target="Pawn" distance=10 stayActive="true" delay=7 />
+ <DistanceTrigger name="spawndelaytrigger3" position="0,0,0" target="Pawn" distance=10 stayActive="true" delay=12 />
+ <DistanceTrigger name="spawndelaytrigger4" position="0,0,0" target="Pawn" distance=10 stayActive="true" delay=15 />
+ <DistanceTrigger name="spawndelaytrigger5" position="0,0,0" target="Pawn" distance=10 stayActive="true" delay=25 />
+ <DistanceTrigger name="spawndelaytrigger6" position="0,0,0" target="Pawn" distance=10 stayActive="true" delay=35 />
+ <DistanceTrigger name="spawndelaytrigger7" position="0,0,0" target="Pawn" distance=10 stayActive="true" delay=40 />
+
+ <SpawnPoint position="0,0,0" lookat="-2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff>
+ <events>
+ <activity>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="spawndelaytrigger1" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+
+ <SimpleNotification message="Welcome to Earth Orbit" >
+ <events>
+ <trigger>
+ <EventListener event=spawntrigger />
+ </trigger>
+ </events>
+ </SimpleNotification>
+ <SimpleNotification message="Turn right to witness an explosion" >
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger1 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <!-- EARTH -->
+ <Planet
+ position="80500,0,0"
+ scale="63000"
+ collisionType="dynamic"
+ linearDamping="0.8"
+ angularDamping="0"
+ mass="5.9e21"
+ pitch="-90"
+ yaw="50"
+ mesh="planets/earth.mesh"
+ atmosphere="atmosphere1"
+ rotationaxis="0,1,0"
+ rotationrate="0.2"
+ atmospheresize="80.0f"
+ imagesize="1024.0f"
+ collisiondamage = 2
+ enablecollisiondamage = true
+ >
+ <attached>
+ <ForceField position="0,0,0" mode="newtonianGravity" diameter="140000" massDiameter="126000" mass="5.9e21" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="63000" position="0,0,0" />
+ </collisionShapes>
+ </Planet>
+
+ <!-- PARTICLE EFFECT -->
+
+ <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp" autostart="false" lifetime=500 loop=1 startdelay=2.5>
+ <events>
+ <spawn>
+ <EventListener event=spawndelaytrigger1 />
+ </spawn>
+ </events>
+ </ParticleSpawner>
+ <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp2" autostart="false" lifetime=500 loop=1 startdelay=2>
+ <events>
+ <spawn>
+ <EventListener event=spawndelaytrigger1 />
+ </spawn>
+ </events>
+ </ParticleSpawner>
+ <ParticleSpawner position="-50,50,-125" source="Orxonox/RingExp3" autostart="false" lifetime=500 loop=1 startdelay=2>
+ <events>
+ <spawn>
+ <EventListener event=spawndelaytrigger1 />
+ </spawn>
+ </events>
+ </ParticleSpawner>
+ <StaticEntity collisionType = "static" position = "-50,50,-125" scale=1 >
+ <attached>
+ <Model position="0,0,0" scale="2" mesh="ast1.mesh" />
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="8" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <SimpleNotification message="A particle effect by Tibor" >
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger2 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <!-- ENEMIES 1st ROUND -->
+
+ <SimpleNotification message="Enemies attacking" >
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger3 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <Script code="addBots 3" onLoad="false">
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger3 />
+ </trigger>
+ </events>
+ </Script>
+
+ <SpawnPoint position="100,0,0" lookat="-2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <EventListener event=spawnpointtrigger />
+ </activity>
+ </events>
+ </SpawnPoint>
+
+ <SpawnPoint position="0,-100,0" lookat="-2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <EventListener event=spawnpointtrigger />
+ </activity>
+ </events>
+ </SpawnPoint>
+
+ <SpawnPoint position="0,0,100" lookat="-2,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <EventListener event=spawnpointtrigger />
+ </activity>
+ </events>
+ </SpawnPoint>
+
+ <Trigger name="spawnpointtrigger" mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger1 />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event=portaltrigger />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+
+ <!-- SPACE BOUNDARY -->
+
+ <SpaceBoundaries warnDistance="1" maxDistance="400" showDistance="300" healthDecrease="0.1" position="-90000,0,0"/>
+ <SpaceBoundaries warnDistance="1" maxDistance="400" showDistance="300" healthDecrease="0.1" position="0,10000,0"/>
+ <SpaceBoundaries warnDistance="1" maxDistance="450" showDistance="300" healthDecrease="0.1" position="0,0,0"/>
+ <SpaceBoundaries warnDistance="1" maxDistance="400" showDistance="300" healthDecrease="0.1" position="-30000,0,0"/>
+
+ <SimpleNotification message="Notice the shields by Simon" >
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger4 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <SimpleNotification message="and space boundaries by Maurus" >
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger5 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <SimpleNotification message="Let's get out of here" >
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger6 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <Script code="killBots" onLoad="false">
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger6 />
+ </trigger>
+ </events>
+ </Script>
+
+ <SimpleNotification message="Boost enhancement by Dominik" >
+ <events>
+ <trigger>
+ <EventListener event=spawndelaytrigger7 />
+ </trigger>
+ </events>
+ </SimpleNotification>
- <!-- BOUNDARIES AND PORTALS -->
-
- <SpaceBoundaries warnDistance="1" maxDistance="400" showDistance="300" healthDecrease="0.1" position="0,0,0"/>
- <SpaceBoundaries warnDistance="1" maxDistance="400" showDistance="300" healthDecrease="0.1" position="-10000,0,0"/>
+ <!-- PORTALS -->
<Template name=PortalDefault>
<PortalEndPoint>
@@ -61,41 +292,189 @@
</PortalEndPoint>
</Template>
- <PortalEndPoint position="350,0,0" id="1" distance="40" target="MobileEntity" design="PortalDefault"/>
- <PortalEndPoint position="-10300,0,0" id="2" distance="40" target="MobileEntity" design="PortalDefault"/>
- <PortalLink fromID="1" toID="2" />
- <PortalLink fromID="2" toID="1" />
+ <PortalEndPoint position="-350,0,0" id="3" distance="40" target="MobileEntity" design="PortalDefault" active="false">
+ <events>
+ <activity>
+ <EventListener event=spawndelaytrigger6 />
+ </activity>
+ </events>
+ </PortalEndPoint>
+ <PortalEndPoint position="-72000,0,0" id="4" distance="40" target="MobileEntity" design="PortalDefault" />
+ <PortalLink fromID="3" toID="4" />
+ <PortalLink fromID="4" toID="3" />
+ <DistanceTrigger name="portaltrigger" position="-72000,0,0" target="Pawn" distance=10 stayActive="true" />
+ <DistanceTrigger name="portaldelaytrigger1" position="-72000,0,0" target="Pawn" distance=10 stayActive="true" delay=5 />
+ <DistanceTrigger name="portaldelaytrigger2" position="-72000,0,0" target="Pawn" distance=10 stayActive="true" delay=10 />
+ <DistanceTrigger name="portaldelaytrigger3" position="-72000,0,0" target="Pawn" distance=10 stayActive="true" delay=15 />
+ <DistanceTrigger name="portaldelaytrigger4" position="-72000,0,0" target="Pawn" distance=10 stayActive="true" delay=17 />
+ <SimpleNotification message="Welcome to Moon Orbit" >
+ <events>
+ <trigger>
+ <EventListener event=portaltrigger />
+ </trigger>
+ </events>
+ </SimpleNotification>
- <!-- MODELS, DEBRIS, ETC -->
+ <SimpleNotification message="Portals by Andreas" >
+ <events>
+ <trigger>
+ <EventListener event=portaldelaytrigger1 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+ <!-- MOON AREA -->
+
+ <!-- MOON -->
<Planet
- position="-5000,0,0"
- scale="400"
+ position="-80000,0,0"
+ scale="4000"
collisionType="dynamic"
linearDamping="0.8"
angularDamping="0"
- mass="10000000"
+ mass="7.36e19"
pitch="0"
- mesh="planets/muunilinst.mesh"
+ mesh="planets/moon.mesh"
atmosphere="atmosphere1"
- rotationaxis="1,0,0"
- rotationrate="1.0"
- atmospheresize="300.0f"
+ rotationaxis="0,1,0"
+ rotationrate="0.2"
+ atmospheresize="0.0f"
imagesize="1024.0f"
+ collisiondamage = 2
+ enablecollisiondamage = true
>
+ <attached>
+ <ForceField position="0,0,0" mode="newtonianGravity" diameter="40000" massDiameter="34740" mass="7.36e19" />
+ </attached>
<collisionShapes>
- <SphereCollisionShape radius="400" position="0,0,0" />
+ <SphereCollisionShape radius="4000" position="0,0,0" />
</collisionShapes>
</Planet>
- <MovableEntity position="0,0,0">
+ <SimpleNotification message="Hydrogen farmer/space station by Hans" >
+ <events>
+ <trigger>
+ <EventListener event=portaldelaytrigger2 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <!-- HYDROGEN FARMER & DOCKING -->
+ <SpaceShip position="-74000,2500,0" roll=90 yaw=180 pitch=20 mass=10000 health=100000 >
<attached>
- <Billboard position="-5000,0,0" material="Examples/Flare" colour="0, 0, 1" scale=10/>
+ <!-- Docking -->
+ <DistanceTriggerBeacon name="bcnDestroyer" />
+ <DockingTarget name="destroyer" />
+
+ <Model mesh="HydroHarvester.mesh" mass=10 position="0,0,0" scale=100 />
+ <!-- <Model mesh="cube.mesh" mass=10 position="-1120,0,0" scale3D="230,200,490" /> -->
+ <!-- <Model mesh="cube.mesh" mass=10 position="580,0,-960" scale3D="230,200,490" yaw=-120 /> -->
+ <!-- <Model mesh="cube.mesh" mass=10 position="580,0,960" scale3D="230,200,490" yaw=-240 /> -->
+ <!-- <Model mesh="cube.mesh" mass=10 position="0,0,0" scale3D="600,200,100" /> -->
</attached>
- </MovableEntity>
+ <collisionShapes>
+ <BoxCollisionShape position="-1120,0,0" halfExtents="230,200,490" />
+ <BoxCollisionShape position="580,0,-960" halfExtents="230,200,490" yaw=-120 />
+ <BoxCollisionShape position="580,0,960" halfExtents="230,200,490" yaw=-240 />
+ </collisionShapes>
+ </SpaceShip>
+ <Dock position="-73942, 1288, -255" roll=90 yaw=180 >
+ <animations>
+ <MoveToDockingTarget target="destroyer" />
+ </animations>
+ <effects>
+ <DockToShip target="spaceShip" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event="dockMe" />
+ </execute>
+ </events>
+ <attached>
+ <DistanceTrigger position="10,-202, -42" distance="800" target="Pawn"
+ beaconMode="exclude" targetname="bcnDestroyer" name="dockMe"
+ />
+ </attached>
+ </Dock>
+
+ <SpaceShip template="spaceshipassff2" position="-73915,3786,67" orientation="-0.14045, 0.68254, 0.68144, 0.223774" >
+ <attached>
+ <DockingTarget name="spaceShip" />
+ </attached>
+ </SpaceShip>
+
+ <!-- PICKUPS -->
+ <SimpleNotification message="Oh, what have we here?" >
+ <events>
+ <trigger>
+ <EventListener event=portaldelaytrigger3 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <SimpleNotification message="Shrink pickup by Sandro" >
+ <events>
+ <trigger>
+ <EventListener event=portaldelaytrigger4 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <PickupSpawner position="-72487,420,-63" respawnTime="10" triggerDistance="20" maxSpawnedItems="5" active="false">
+ <pickup>
+ <ShrinkPickup template ="smallshrinkpickup"/>
+ </pickup>
+ <events>
+ <activity>
+ <EventListener event=portaldelaytrigger3 />
+ </activity>
+ </events>
+ <attached>
+ <ParticleSpawner position="0,0,0" source="Orxonox/Shield" autostart="false" lifetime=500 loop=0 >
+ <events>
+ <spawn>
+ <EventListener event=portaldelaytrigger3 />
+ </spawn>
+ </events>
+ </ParticleSpawner>
+ </attached>
+ </PickupSpawner>
+
+ <SpaceBoundaries warnDistance="1" maxDistance="1700" showDistance="500" healthDecrease="0.1" position="-72369,803,2"/>
+ <SpaceBoundaries warnDistance="1" maxDistance="800" showDistance="300" healthDecrease="0.1" position="-73450,5067,-351"/>
+
+ <!-- FINISH -->
+
+ <DistanceTrigger name="dockingtrigger" position="-73942, 1288, -255" target="Pawn" distance=20 stayActive="true" />
+ <DistanceTrigger name="dockingdelaytrigger1" position="-73942, 1288, -255" target="Pawn" distance=20 stayActive="true" delay=3 />
+ <DistanceTrigger name="dockingdelaytrigger2" position="-73942, 1288, -255" target="Pawn" distance=20 stayActive="true" delay=10 />
+
+ <SimpleNotification message="Docking by Sven" >
+ <events>
+ <trigger>
+ <EventListener event=dockingtrigger />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <SimpleNotification message="Weapons by Jonas" >
+ <events>
+ <trigger>
+ <EventListener event=dockingdelaytrigger1 />
+ </trigger>
+ </events>
+ </SimpleNotification>
+
+ <SimpleNotification message="Steering enhancement by Manuel" >
+ <events>
+ <trigger>
+ <EventListener event=dockingdelaytrigger2 />
+ </trigger>
+ </events>
+ </SimpleNotification>
</Scene>
</Level>
Property changes on: code/trunk/data/levels/presentationFS11.oxw
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/data/levels/presentationHS09.oxw
===================================================================
--- code/trunk/data/levels/presentationHS09.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentationHS09.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -23,6 +23,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.6, 0.4, 0.4"
Modified: code/trunk/data/levels/presentationHS09b.oxw
===================================================================
--- code/trunk/data/levels/presentationHS09b.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/presentationHS09b.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -28,6 +28,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
Modified: code/trunk/data/levels/princessAeryn.oxw
===================================================================
--- code/trunk/data/levels/princessAeryn.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/princessAeryn.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -23,6 +23,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.3, 0.3, 0.3"
Copied: code/trunk/data/levels/quests.oxw (from rev 8705, code/branches/presentation/data/levels/quests.oxw)
===================================================================
--- code/trunk/data/levels/quests.oxw (rev 0)
+++ code/trunk/data/levels/quests.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,232 @@
+<LevelInfo
+ name = "Quests showcase"
+ description = "Level to test and showcase quests."
+ tags = "test, showcase"
+/>
+
+<?lua
+ include("HUDTemplates3.oxo")
+ include("stats.oxo")
+ include("templates/spaceshipAssff.oxt")
+ include("templates/lodInformation.oxt")
+?>
+
+<Level
+ name = "Questsystem"
+ description = "Just a few tests"
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.5, 0.5, 0.5"
+ skybox = "Orxonox/Starbox"
+ >
+
+ <Script code="showGUI NotificationLayer false true" needsGraphics="true" />
+
+ <GlobalQuest id="quest0">
+ <QuestDescription title="Quest 0" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+ Ut consequat leo ut quam congue semper et eget nibh. Nunc sit amet velit eu lorem pretium adipiscing eu ut ante. Nulla facilisi. Pellentesque interdum, neque nec consectetur vulputate, mauris risus feugiat nunc, ac sollicitudin neque quam ut tellus. Morbi elit velit, tincidunt et hendrerit eget, rutrum at erat. Duis eros nulla, faucibus vitae blandit vitae, pharetra sollicitudin justo." failMessage="Fail message 0" completeMessage="Complete message 0" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1">
+ <QuestDescription title="Quest 1" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor." failMessage="Fail message 1" completeMessage="Complete message 1" />
+ <hints>
+ <QuestHint id="quest1hint1">
+ <QuestDescription title="The super Hint." description="Be proud of yourself." />
+ </QuestHint>
+ <QuestHint id="quest1hint2">
+ <QuestDescription title="The super Hint2." description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor." />
+ </QuestHint>
+ <QuestHint id="quest1hint3">
+ <QuestDescription title="The super Hint3." description="Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus." />
+ </QuestHint>
+ </hints>
+ <subquests>
+ <GlobalQuest id="quest1.1">
+ <QuestDescription title="Quest 1: Subquest 1" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1.2">
+ <QuestDescription title="Quest 1: Subquest 2" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1.3">
+ <QuestDescription title="Quest 1: Subquest 3" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1.4">
+ <QuestDescription title="Quest 1: Subquest 4" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest1.5">
+ <QuestDescription title="Quest 1: Subquest 5" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ </subquests>
+ </GlobalQuest>
+ <GlobalQuest id="quest2">
+ <QuestDescription title="Quest 2" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac." failMessage="Fail message 2" completeMessage="Complete message 2" />
+ </GlobalQuest>
+ <GlobalQuest id="quest3">
+ <QuestDescription title="Quest 3" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit." failMessage="Fail message 1" completeMessage="Complete message 1" />
+ </GlobalQuest>
+ <GlobalQuest id="quest4">
+ <QuestDescription title="Quest 4" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. Integer a nisl odio, in iaculis tortor. Nam erat erat, commodo quis tincidunt et, congue at quam. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+
+ Ut consequat leo ut quam congue semper et eget nibh. Nunc sit amet velit eu lorem pretium adipiscing eu ut ante. Nulla facilisi. Pellentesque interdum, neque nec consectetur vulputate, mauris risus feugiat nunc, ac sollicitudin neque quam ut tellus. Morbi elit velit, tincidunt et hendrerit eget, rutrum at erat. Duis eros nulla, faucibus vitae blandit vitae, pharetra sollicitudin justo. Donec luctus est a tortor auctor feugiat." failMessage="Fail message 1" completeMessage="Complete message 1" />
+ </GlobalQuest>
+ <GlobalQuest id="quest5">
+ <QuestDescription title="Quest 5" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa." failMessage="Fail message 1" completeMessage="Complete message 1" />
+ </GlobalQuest>
+ <GlobalQuest id="quest6">
+ <QuestDescription title="Quest 6" description="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus at dolor quis dui gravida faucibus quis ut augue. Nulla sed accumsan nulla. Sed eleifend arcu ante, vel congue neque. Praesent vel felis sit amet lacus elementum laoreet at et massa. Pellentesque imperdiet orci sit amet sem gravida a ornare odio tempor. Donec posuere scelerisque purus, et porttitor ipsum dictum ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed non turpis non eros porttitor dignissim. Phasellus at elit vel diam gravida malesuada ut a lorem. Etiam vel lacus massa. In arcu neque, ultrices at placerat in, facilisis a metus. Curabitur erat nunc, molestie sed pretium ac, ullamcorper eget tellus. Vivamus tortor magna, mollis ut vulputate vel, lacinia nec neque. " failMessage="Fail message 1" completeMessage="Complete message 1" />
+ </GlobalQuest>
+
+ <EventMultiTrigger name=spawntrigger>
+ <events>
+ <trigger>
+ <SpawnPoint position="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
+ </trigger>
+ </events>
+ </EventMultiTrigger>
+
+ <QuestEffectBeacon times=1>
+ <effects>
+ <AddQuest questId="quest0" />
+ <AddQuest questId="quest1" />
+ <AddQuest questId="quest1.1" />
+ <AddQuest questId="quest1.2" />
+ <AddQuest questId="quest1.3" />
+ <AddQuest questId="quest1.4" />
+ <AddQuest questId="quest1.5" />
+ <AddQuest questId="quest2" />
+ <AddQuest questId="quest3" />
+ <AddQuest questId="quest4" />
+ <AddQuest questId="quest5" />
+ <AddQuest questId="quest6" />
+ <AddQuestHint hintId ="quest1hint1" />
+ <AddQuestHint hintId ="quest1hint2" />
+ <AddQuestHint hintId ="quest1hint3" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=spawntrigger />
+ </execute>
+ </events>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="-100,0,0" times=1>
+ <effects>
+ <FailQuest questId="quest1.1" />
+ <FailQuest questId="quest1.2" />
+ <FailQuest questId="quest1.3" />
+ <FailQuest questId="quest1.4" />
+ <FailQuest questId="quest1.5" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=dtrigger1 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0,0" material="Examples/Flare" />
+ <DistanceTrigger name=dtrigger1 position="0,0,0" distance=10 target="Pawn" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="100,0,0" times=-1>
+ <effects>
+ <CompleteQuest questId="quest0" />
+ <CompleteQuest questId="quest1" />
+ <CompleteQuest questId="quest1.1" />
+ <CompleteQuest questId="quest1.2" />
+ <CompleteQuest questId="quest1.3" />
+ <CompleteQuest questId="quest1.4" />
+ <CompleteQuest questId="quest1.5" />
+ <CompleteQuest questId="quest2" />
+ <CompleteQuest questId="quest3" />
+ <CompleteQuest questId="quest4" />
+ <CompleteQuest questId="quest5" />
+ <CompleteQuest questId="quest6" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=dtrigger2 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="0,1.0,0" material="Examples/Flare" />
+ <DistanceTrigger name=dtrigger2 position="0,0,0" distance=10 target="Pawn" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <!--QuestEffectBeacon position="0,0,100" times=-1>
+ <effects>
+ <AddQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=qebdt1 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,1.0,1.0" material="Examples/Flare" />
+ <DistanceTrigger name=qebdt1 position="0,0,0" distance=10 target="ControllableEntity" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="-100,0,0" times=-1>
+ <effects>
+ <FailQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=qebdt2 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0,0" material="Examples/Flare" />
+ <DistanceTrigger name=qebdt2 position="0,0,0" distance=10 target="ControllableEntity" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="100,0,0" times=-1>
+ <effects>
+ <CompleteQuest questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=qebdt3 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="0,1.0,0" material="Examples/Flare" />
+ <DistanceTrigger name=qebdt3 position="0,0,0" distance=10 target="ControllableEntity" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <QuestEffectBeacon position="0,100,0" times=-1>
+ <effects>
+ <AddQuestHint hintId="022a859d-08dd-4eac-a085-c28c29c06d48" />
+ </effects>
+ <events>
+ <execute>
+ <EventListener event=qebdt4 />
+ </execute>
+ </events>
+ <attached>
+ <Billboard position="0,0,0" colour="0,0,1.0" material="Examples/Flare" />
+ <DistanceTrigger name=qebdt4 position="0,0,0" distance=10 target="ControllableEntity" />
+ </attached>
+ </QuestEffectBeacon>
+
+ <ParticleEmitter name=firecenter position="0,0,0" source="Orxonox/fire3" active=false>
+ <events>
+ <activity>
+ <QuestListener questId="b80c2c60-e62c-4637-80f8-5aa18dc93b34" mode="complete" />
+ </activity>
+ </events>
+ </ParticleEmitter-->
+
+ </Scene>
+</Level>
+
Modified: code/trunk/data/levels/screenshot.oxw
===================================================================
--- code/trunk/data/levels/screenshot.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/screenshot.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -21,6 +21,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.7, 0.6, 0.6"
Copied: code/trunk/data/levels/shieldTest.oxw (from rev 8705, code/branches/presentation/data/levels/shieldTest.oxw)
===================================================================
--- code/trunk/data/levels/shieldTest.oxw (rev 0)
+++ code/trunk/data/levels/shieldTest.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,83 @@
+<LevelInfo
+ name = "Shield Testlevel"
+ description = "A simple Level with one shielded drone to shoot at"
+ tags = "test"
+/>
+
+<?lua
+ include("HUDTemplates3.oxo")
+ include("stats.oxo")
+ include("templates/spaceshipImmTest.oxt")
+ include("templates/lodInformation.oxt")
+?>
+
+<Level
+ name = "shieldTL"
+ description = "LEVEL-DESCRIPTION"
+>
+
+<templates>
+ <Template link=lodtemplate_default />
+</templates>
+<?lua include("includes/notifications.oxi") ?>
+
+<Scene
+ ambientlight = "0.8, 0.5, 0.5"
+ skybox = "Orxonox/Starbox"
+>
+
+<Drone name="meineDrohne"
+ primarythrust= "80"
+ auxilarythrust= "10"
+ rotationthrust= "10"
+ mass= "50"
+ linearDamping= "0.9"
+ angularDamping= "0.7"
+
+ health= 100
+ maxhealth= 150
+ inithealth= 200
+
+ shieldhealth= 100
+ initialshieldhealth= 200
+ maxshieldhealth= 250
+
+ shieldabsorption= 1
+
+ reloadrate= "10"
+ reloadwaittime= 1
+
+>
+ <attached>
+ <Model scale="4" mesh="drone.mesh"/>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 10, 10" />
+ </collisionShapes>
+</Drone>
+
+<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" />
+
+
+ <?lua
+ for i = 1, 10, 1 do
+ ?>
+ <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=spaceshipimmtest />
+ <?lua end ?>
+
+ <GlobalShader compositor="Bloom" visible=false>
+ <events>
+ <visibility>
+ <DistanceTrigger position="0,0,0" distance=30 target="Spectator" switch=true />
+ </visibility>
+ </events>
+ </GlobalShader>
+ <Model position="0,0,0" scale=8 mesh="ast1.mesh" />
+ <StaticEntity position="0,0,0" collisionType=static>
+ <collisionShapes>
+ <SphereCollisionShape radius="20" />
+ </collisionShapes>
+ </StaticEntity>
+
+ </Scene>
+</Level>
Modified: code/trunk/data/levels/sound.oxw
===================================================================
--- code/trunk/data/levels/sound.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/sound.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,6 +22,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
Copied: code/trunk/data/levels/spaceRace.oxw (from rev 8705, code/branches/presentation/data/levels/spaceRace.oxw)
===================================================================
--- code/trunk/data/levels/spaceRace.oxw (rev 0)
+++ code/trunk/data/levels/spaceRace.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,468 @@
+<LevelInfo
+ name = "Space Race"
+ description = "Test level for the gametype Space Race."
+ tags = "test"
+/>
+
+<?lua
+ include("stats.oxo")
+ include("HUDTemplates3.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<?lua
+ include("templates/spaceshipAssff.oxt")
+ include("templates/spaceshipPirate.oxt")
+?>
+
+<Level
+ name = "Space Race"
+ description = "Test level for the gametype Space Race."
+ gametype = SpaceRace
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.8, 0.8, 0.8"
+ skybox = "Orxonox/skyBoxMoreNebula"
+ >
+
+ <?lua math.randomseed(98) ?>
+
+ <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"/>
+
+ <SimpleNotification message="Reach the last check point within 150 seconds!!" />
+
+ <!-- ------------------SpawnPoint----------------- -->
+ <SpawnPoint position="0,-2100,0" lookat="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="true" >
+ <events>
+ <activity>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint2" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+
+ <!-- ------------------CheckPoints----------------- -->
+ <RaceCheckPoint name="checkpoint1" position="0,-2000,1000" direction="0,-1,1" collisionType="static" scale="1" distance="40" checkpointindex="0" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint2" position="0,-900,2300" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="1" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <SpawnPoint position="0,0,0" lookat="0,1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint2" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint3" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint3" position="0,700,2700" stayActive="true" direction="0,0,1" collisionType="static" scale="1" distance="40" checkpointindex="2" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <SpawnPoint position="0,0,0" lookat="0,1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint3" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint4" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint4" position="0,2100,2300" stayActive="true" direction="0,1,1" collisionType="static" scale="1" distance="40" checkpointindex="3" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger3" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint4" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint5" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint5" position="0,2200,500" stayActive="true" direction="0,1,0" collisionType="static" scale="1" distance="40" checkpointindex="4" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger4" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint5" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint6" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint6" position="0,1500,-800" stayActive="true" direction="0,1,-1" collisionType="static" scale="1" distance="40" checkpointindex="5" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger5" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint6" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint7" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint7" position="0,200,-1900" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="6" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger6" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint7" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint8" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint8" position="0,-700,-1400" stayActive="true" direction="0,-1,-1" collisionType="static" scale="1" distance="40" checkpointindex="7" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger7" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <Trigger mode="xor" invert="true" >
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint8" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ <EventTrigger invert="true">
+ <events>
+ <trigger>
+ <EventListener event="checkpoint9" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </Trigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint9" position="0,-1300,-800" stayActive="true" collisionType="static" scale="1" distance="40" checkpointindex="8" islast="false">
+ <attached>
+ <Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ <DistanceTrigger name="trigger8" position="0,0,0" distance=40 stayActive="true" />
+ <SpawnPoint position="0,0,0" lookat="0,-1000,0" spawnclass=SpaceShip pawndesign=spaceshipassff active="false" >
+ <events>
+ <activity>
+ <EventTrigger>
+ <events>
+ <trigger>
+ <EventListener event="checkpoint9" />
+ </trigger>
+ </events>
+ </EventTrigger>
+ </activity>
+ </events>
+ </SpawnPoint>
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <RaceCheckPoint name="checkpoint10" position="0,-2100,0" collisionType="static" scale="1" distance="40" checkpointindex="9" islast="true" timelimit="150">
+ <attached>
+ < Model mass="50" scale="50" mesh="raceCheckPoint.mesh" />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="0,0,-55" halfExtents="55, 10, 10" />
+ <BoxCollisionShape position="55,0,0" halfExtents="10, 10, 55" />
+ <BoxCollisionShape position="-55,0,0" halfExtents="10, 10, 55" />
+ </collisionShapes>
+ </RaceCheckPoint>
+
+ <!-- ------------------Planet----------------- -->
+ <Planet position="0,0,0" scale=300 pitch=-90 mesh="iceplanet.mesh" atmosphere="atmosphere1" rotationaxis="8,1,0" rotationrate="1" atmospheresize=224.0f imagesize=1024.0f />
+ <StaticEntity position="0,0,0" collisionType=static>
+ <collisionShapes>
+ <SphereCollisionShape radius="399" />
+ </collisionShapes>
+ </StaticEntity>
+
+ <!-- ---------------asteroid ellipse----------------- -->
+ <?lua
+ max = 20
+ for i = 0, max, 1
+ do
+ y = math.sin(i/max*6)*2000
+ z = math.cos(i/max*6)*2500
+ x = 0
+ ?>
+ <?lua
+ for k = 1, 15, 1
+ do
+ j = math.random()
+ ?>
+
+ <MovableEntity
+ position = "<?lua print(x + math.random() * 500) ?>,<?lua print(y + math.random() * 500) ?>,<?lua print(z + math.random() * 1000) ?>"
+ collisionType = "dynamic"
+ linearDamping = "0.5"
+ angularDamping = "0.01"
+ collisiondamage = "0.01"
+ enablecollisiondamage = "true"
+ scale="<?lua print(j * 5) ?>" >
+ <attached>
+ <Model position="0,0,0" scale="<?lua print(j * 10) ?>" mesh="ast<?lua print( math.mod(i,6) + 1) ?>.mesh">
+ <?lua if k == 5 then ?><attached><!-- ---------asteroid fog----- -->
+ <ParticleEmitter position="0,0,0" source="Orxonox/Steam" />
+ </attached> <?lua end ?>
+ </Model>
+ </attached>
+ <collisionShapes>
+ <SphereCollisionShape radius="<?lua print(j * 80) ?>" />
+ </collisionShapes>
+ </MovableEntity>
+ <?lua
+ end
+ ?>
+ <?lua end ?>
+
+ <!-- ---------------ForceFields----------------- -->
+ <ForceField position="0,-700,2700" direction="0,1,0" diameter=500 velocity=2000 length=600 />
+ <MovableEntity position="0,-400,2700">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,15,1 do ?>
+ <Billboard position="-200,<?lua print(i*40) ?>,0" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="200,<?lua print(i*40) ?>,0" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <ForceField position="0,2500,2000" direction="0,0,-1" diameter=250 velocity=2000 length=600 />
+ <MovableEntity position="0,2500,2000">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,15,1 do ?>
+ <Billboard position="-100,0,-<?lua print(i*40) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="100,0,-<?lua print(i*40) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <ForceField position="0,1300,-800" direction="0,-1,-1" diameter=250 velocity=2000 length=800 />
+ <MovableEntity position="0,1300,-800">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,20,1 do ?>
+ <Billboard position="-100,<?lua print(-i*40*0.7071) ?>,<?lua print(-i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="100,<?lua print(-i*40*0.7071) ?>,<?lua print(-i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <ForceField position="0,-1400,-700" direction="0,-1,1" diameter=250 velocity=2000 length=600 />
+ <MovableEntity position="0,-1400,-700">
+ <attached>
+ <Billboard position="0,0,0" material="Flares/ringflare2" colour="0.5,0,0" scale=2/>
+ <?lua for i=0,15,1 do ?>
+ <Billboard position="-100,<?lua print(-i*40*0.7071) ?>,<?lua print(i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <Billboard position="100,<?lua print(-i*40*0.7071) ?>,<?lua print(i*40*0.7071) ?>" material="Examples/Flare" colour="0.5,0,0" scale=1/>
+ <?lua end ?>
+ </attached>
+ </MovableEntity>
+
+ <!-- ---------------SpaceShips----------------- -->
+ <SpaceShip position="0,2000,2000" lookat="0,0,0" team=1 >
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WaypointPatrolController alertnessradius=1500 team=0 >
+ <waypoints>
+ <Model scale=0 position="0,2000,2000" />
+ </waypoints>
+ </WaypointPatrolController>
+ </controller>
+ </SpaceShip>
+
+ <SpaceShip position="0,2000,-2000" lookat="0,0,0" team=1 >
+ <templates>
+ <Template link=spaceshipassff />
+ </templates>
+ <controller>
+ <WaypointPatrolController alertnessradius=1500 team=0 >
+ <waypoints>
+ <Model scale=0 position="0,2000,-2000" />
+ </waypoints>
+ </WaypointPatrolController>
+ </controller>
+ </SpaceShip>
+
+ </Scene>
+</Level>
Modified: code/trunk/data/levels/teamBaseMatch.oxw
===================================================================
--- code/trunk/data/levels/teamBaseMatch.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/teamBaseMatch.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,6 +22,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/levels/teamDeathMatch.oxw
===================================================================
--- code/trunk/data/levels/teamDeathMatch.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/teamDeathMatch.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -21,6 +21,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.7, 0.6, 0.6"
Modified: code/trunk/data/levels/templates/lodInformation.oxt
===================================================================
--- code/trunk/data/levels/templates/lodInformation.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/lodInformation.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -13,6 +13,7 @@
<MeshLodInformation mesh=SemiCircleCockpit.mesh enabled=false/>
<MeshLodInformation mesh=SolarPanel.mesh enabled=false/>
<MeshLodInformation mesh=CuboidLandingZone.mesh enabled=false/>
+ <MeshLodInformation mesh=HydroHarvester.mesh enabled=false />
<!-- disable LOD for some debris meshes which caused a crash (fixed in Ogre 1.7.3) -->
<MeshLodInformation mesh=BodyDebris1.mesh enabled=false/>
Modified: code/trunk/data/levels/templates/pickupRepresentationTemplates.oxt
===================================================================
--- code/trunk/data/levels/templates/pickupRepresentationTemplates.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/pickupRepresentationTemplates.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -395,6 +395,81 @@
/>
</Template>
+<Template name=smallshrinkpickupRepresentation>
+ <PickupRepresentation>
+ <spawner-representation>
+ <StaticEntity>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=0.4 />
+ </attached>
+ </Billboard>
+ </attached>
+ </StaticEntity>
+ </spawner-representation>
+ </PickupRepresentation>
+</Template>
+
+<Template name=smallshrinkpickup>
+ <InvisiblePickup
+ duration = 10.0
+ shrinkFactor = 2.5
+ activaionType = "immediate"
+ durationType = "continuous"
+ />
+</Template>
+
+<Template name=mediumshrinkpickupRepresentation>
+ <PickupRepresentation>
+ <spawner-representation>
+ <StaticEntity>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=0.7 />
+ </attached>
+ </Billboard>
+ </attached>
+ </StaticEntity>
+ </spawner-representation>
+ </PickupRepresentation>
+</Template>
+
+<Template name=mediumshrinkpickup>
+ <InvisiblePickup
+ duration = 30.0
+ shrinkFactor = 5.0
+ activaionType = "immediate"
+ durationType = "continuous"
+ />
+</Template>
+
+<Template name=hugeshrinkpickupRepresentation>
+ <PickupRepresentation>
+ <spawner-representation>
+ <StaticEntity>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Sphere2" scale=0.1>
+ <attached>
+ <Billboard position="0,0,0" colour="1.0,0.55,1.0" material="Shrink" scale=1.0 />
+ </attached>
+ </Billboard>
+ </attached>
+ </StaticEntity>
+ </spawner-representation>
+ </PickupRepresentation>
+</Template>
+
+<Template name=hugeshrinkpickup>
+ <InvisiblePickup
+ duration = 60.0
+ shrinkFactor = 10.0
+ activaionType = "immediate"
+ durationType = "continuous"
+ />
+</Template>
+
<!-- Pickup Collection pickups -->
<Template name=triplehealthspeedinvisibilitypickupRepresentation>
Modified: code/trunk/data/levels/templates/spaceshipAssff.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipAssff.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipAssff.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,7 +2,6 @@
<SpaceShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshipassffcameras
- engine = spaceshipassffengine
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
@@ -11,15 +10,37 @@
maxhealth = 200
initialhealth = 100
- primaryThrust = 100;
- auxilaryThrust = 30;
- rotationThrust = 25;
+ shieldhealth = 30
+ initialshieldhealth = 30
+ maxshieldhealth = 50
+ shieldabsorption = 0.8
+ reloadrate = 1
+ reloadwaittime = 1
+ primaryThrust = 100
+ auxilaryThrust = 30
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 15
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
collisionType = "dynamic"
mass = 100
linearDamping = 0.7
angularDamping = 0.9999999
>
+ <engines>
+ <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine />
+ <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine />
+ </engines>
<attached>
<Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
<BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
@@ -76,29 +97,27 @@
<WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" looping=1 active=false/>
</EffectContainer>
<EffectContainer condition="not idle">
- <FadingBillboard mainstate=activity active=false scale=0.1 position="0, 0, 9" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
-<!--
- <Light mainstate=visibility position=" 8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
- <Light mainstate=visibility position="-8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
--->
+ <FadingBillboard mainstate=activity active=false scale=0.1 position="7.6, 0, 9" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.1 position="-7.6, 0, 9" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
</EffectContainer>
<EffectContainer condition="normal or brake">
</EffectContainer>
<EffectContainer condition="normal or boost">
- <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
- <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 0" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 0" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
</EffectContainer>
<EffectContainer condition="boost">
<Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
<Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
</EffectContainer>
- <EffectContainer condition="brake">
+<!-- <EffectContainer condition="brake">
<FadingBillboard mainstate=activity active=false scale=0.3 position=" 8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
<FadingBillboard mainstate=activity active=false scale=0.3 position="-8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
<FadingBillboard mainstate=activity active=false scale=0.15 position=" 8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
<FadingBillboard mainstate=activity active=false scale=0.15 position="-8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
</EffectContainer>
+-->
</MultiStateEngine>
</Template>
Copied: code/trunk/data/levels/templates/spaceshipAssff2.oxt (from rev 8705, code/branches/presentation/data/levels/templates/spaceshipAssff2.oxt)
===================================================================
--- code/trunk/data/levels/templates/spaceshipAssff2.oxt (rev 0)
+++ code/trunk/data/levels/templates/spaceshipAssff2.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,160 @@
+<Template name=spaceshipassff2>
+ <SpaceShip
+ hudtemplate = spaceshiphud
+ camerapositiontemplate = spaceshipassffcameras2
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = 3
+ explosionchunks = 6
+
+ health = 50
+ maxhealth = 100
+ initialhealth = 50
+
+ shieldhealth = 130
+ initialshieldhealth = 130
+ maxshieldhealth = 150
+ shieldabsorption = 0.95
+ reloadrate = 5
+ reloadwaittime = 0.5
+
+ primaryThrust = 100
+ auxilaryThrust = 30
+ rotationThrust = 50
+
+ lift = 1;
+ stallSpeed = 220;
+
+ boostPower = 10
+ boostPowerRate = 1
+ boostRate = 5
+ boostCooldownDuration = 10
+
+ shakeFrequency = 15
+ shakeAmplitude = 9
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+ >
+ <engines>
+ <MultiStateEngine position=" 7.6, 0, 6" template=spaceshipassffengine2 />
+ <MultiStateEngine position="-7.6, 0, 0" template=spaceshipassffengine2 />
+ </engines>
+ <attached>
+ <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
+ <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+ <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 3, 5" />
+ <BoxCollisionShape position="13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="0,0,7" halfExtents="3, 2, 2" />
+ <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" />
+ <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" />
+ </collisionShapes>
+<?lua
+ include("includes/weaponSettingsAssff2.oxi")
+?>
+ </SpaceShip>
+</Template>
+
+<Template name=spaceshipassffcameras2 defaults=0>
+ <SpaceShip>
+ <camerapositions>
+ <CameraPosition position="0,10, 40" drag=true mouselook=true />
+ <CameraPosition position="0,20, 80" drag=true mouselook=true />
+ <CameraPosition position="0,30,120" drag=true mouselook=true />
+ <!--CameraPosition position="0,150,-25" pitch=-90 drag=true />
+ <CameraPosition position="0,0,-40" yaw=180 drag=true />
+ <CameraPosition position="0,3,-14" yaw=0 />
+ <CameraPosition position="-50,5,-8" yaw=-90 drag=true />
+ <CameraPosition position="50,5,-8" yaw=90 drag=true /-->
+ </camerapositions>
+ </SpaceShip>
+</Template>
+
+<Template name=spaceshipassffengine2 baseclass=MultiStateEngine>
+ <MultiStateEngine
+ boostfactor = 2
+
+ speedfront = 150
+ speedback = 50
+ speedleftright = 50
+ speedupdown = 50
+
+ defEngineSndNormal = "sounds/Engine_low.ogg"
+ defEngineSndBoost = "sounds/Engine_high.ogg"
+
+ accelerationfront = 500
+ accelerationbrake = 500
+ accelerationback = 125
+ accelerationleftright = 125
+ accelerationupdown = 125
+ >
+ <EffectContainer condition="idle">
+ <WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" looping=1 active=false/>
+ </EffectContainer>
+ <EffectContainer condition="not idle">
+ <FadingBillboard mainstate=activity active=false scale=0.1 position="7.6, 0, 9" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.1 position="-7.6, 0, 9" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ </EffectContainer>
+ <EffectContainer condition="normal or brake">
+
+ </EffectContainer>
+ <EffectContainer condition="normal or boost">
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 0" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 0" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ </EffectContainer>
+ <EffectContainer condition="boost">
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+ </EffectContainer>
+<!-- <EffectContainer condition="brake">
+ <FadingBillboard mainstate=activity active=false scale=0.3 position=" 8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.3 position="-8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.15 position=" 8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.15 position="-8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
+ </EffectContainer>
+-->
+ </MultiStateEngine>
+</Template>
+
+<!--Template name=spaceshippirate>
+ <SpaceShip
+ health = 100
+ maxhealth = 200
+ initialhealth = 100
+
+ maxspeed = 250
+ maxsecondaryspeed = 50
+ maxrotation = 100
+ transacc = 200
+ rotacc = 140
+ transdamp = 75
+ >
+ <attached>
+ <Model position="0,-10,-45" yaw=90 pitch=-90 roll=0 scale=4 mesh="pirate.mesh" />
+ </attached>
+ </SpaceShip>
+</Template>
+
+<Template name=spaceshipspacecruiser>
+ <SpaceShip
+ health = 100
+ maxhealth = 200
+ initialhealth = 100
+
+ maxspeed = 250
+ maxsecondaryspeed = 50
+ maxrotation = 100
+ transacc = 200
+ rotacc = 140
+ transdamp = 75
+ >
+ <attached>
+ <Model position="8,-30,-120" yaw=90 pitch=-90 roll=0 scale=4 mesh="spacecruiser.mesh" />
+ </attached>
+ </SpaceShip>
+</Template-->
Modified: code/trunk/data/levels/templates/spaceshipGhost.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipGhost.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipGhost.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,7 +2,7 @@
<SpaceShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshipghostcameras
- engine = spaceshipghostengine
+
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
@@ -20,7 +20,9 @@
linearDamping = 0.7
angularDamping = 0.9999999
>
-
+ <engines>
+ <MultiStateEngine position="0,0,0" template=spaceshipghostengine/>
+ </engines>
<attached>
<Model position="0,0,0" scale=2 yaw=90 pitch=-90 roll=0 mesh="ghost.mesh" />
</attached>
Modified: code/trunk/data/levels/templates/spaceshipH2.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipH2.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipH2.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,7 +2,6 @@
<SpaceShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshipHtwocameras
- engine = spaceshipHtwoengine
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
@@ -24,7 +23,10 @@
<?lua
include("includes/weaponSettingsH2.oxi")
?>
+ <engines>
+ <MultiStateEngine position="0,0,0" template=spaceshipHtwoengine />
+ </engines>
<attached>
<Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale3D="3,0.833,0.833" mesh="h2_green.mesh" />
<BlinkingBillboard position=" 11.7,4.0,8.5" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
Modified: code/trunk/data/levels/templates/spaceshipHXY.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipHXY.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipHXY.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,6 +20,9 @@
linearDamping = 0.7
angularDamping = 0.9999999
>
+ <engines>
+ <MultiStateEngine position=" 0, 0, 0" template=spaceshipHXYengine />
+ </engines>
<attached>
<Model position="0,0,0" yaw=180 pitch=-90 roll=0 scale=4 mesh="HXY.mesh" />
</attached>
Modified: code/trunk/data/levels/templates/spaceshipHXYSL.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipHXYSL.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipHXYSL.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,7 +2,6 @@
<SpaceShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshipHXYcameras
- engine = spaceshipHXYengine
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
@@ -20,6 +19,9 @@
linearDamping = 0.7
angularDamping = 0.9999999
>
+ <engines>
+ <MultiStateEngine position=" 0, 0, 0" template=spaceshipHXYengine />
+ </engines>
<attached>
<Model position="0,0,0" yaw=180 pitch=-90 roll=0 scale=4 mesh="HXY.mesh" />
</attached>
@@ -37,54 +39,3 @@
?>
</SpaceShip>
</Template>
-
-<Template name=spaceshipHXYcameras defaults=0>
- <SpaceShip>
- <camerapositions>
- <CameraPosition position="0,8, 60" drag=true mouselook=true />
- <CameraPosition position="0,16, 120" drag=true mouselook=true />
- <CameraPosition position="0,24,180" drag=true mouselook=true />
- <CameraPosition position="0,60,10" pitch="-80" drag=true mouselook=true />
- </camerapositions>
- </SpaceShip>
-</Template>
-
-<Template name=spaceshipHXYengine baseclass=MultiStateEngine>
- <MultiStateEngine
- boostfactor = 6
-
- speedfront = 150
- speedback = 50
- speedleftright = 50
- speedupdown = 50
-
- accelerationfront = 500
- accelerationbrake = 500
- accelerationback = 125
- accelerationleftright = 125
- accelerationupdown = 125
- >
- <EffectContainer condition="idle">
- </EffectContainer>
- <EffectContainer condition="not idle">
-
- </EffectContainer>
- <EffectContainer condition="normal or brake">
-
- </EffectContainer>
- <EffectContainer condition="normal or boost">
- <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 2, 0, 20" colour="1, 0.7, 0.1, 1.0" width=10 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
- <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-2, 0, 20" colour="1, 0.7, 0.1, 1.0" width=10 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
- </EffectContainer>
- <EffectContainer condition="boost">
- <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 2, 0, 20" colour="1, 0.7, 0.1, 0.7" width=25 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
- <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-2, 0, 20" colour="1, 0.7, 0.1, 0.7" width=25 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
- </EffectContainer>
- <EffectContainer condition="brake">
- <FadingBillboard mainstate=activity active=false scale=0.3 position=" 2, 0, 20" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
- <FadingBillboard mainstate=activity active=false scale=0.3 position="-2, 0, 20" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
- <FadingBillboard mainstate=activity active=false scale=0.15 position=" 2, 0, 20" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
- <FadingBillboard mainstate=activity active=false scale=0.15 position="-2, 0, 20" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
- </EffectContainer>
- </MultiStateEngine>
-</Template>
Copied: code/trunk/data/levels/templates/spaceshipImmTest.oxt (from rev 8705, code/branches/presentation/data/levels/templates/spaceshipImmTest.oxt)
===================================================================
--- code/trunk/data/levels/templates/spaceshipImmTest.oxt (rev 0)
+++ code/trunk/data/levels/templates/spaceshipImmTest.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,106 @@
+<Template name=spaceshipimmtest>
+ <SpaceShip
+ hudtemplate = spaceshiphud
+ camerapositiontemplate = spaceshipassffcameras
+ engine = spaceshipassffengine
+ spawnparticlesource = "Orxonox/fairytwirl"
+ spawnparticleduration = 3
+ explosionchunks = 6
+
+ health = 100
+ maxhealth = 200
+ initialhealth = 100
+
+ primaryThrust = 100;
+ auxilaryThrust = 30;
+ rotationThrust = 25;
+
+ collisionType = "dynamic"
+ mass = 100
+ linearDamping = 0.7
+ angularDamping = 0.9999999
+
+ shakeFrequency = 15
+ >
+ <attached>
+ <Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="assff.mesh" />
+ <BlinkingBillboard position="17,-1.5,0" material="Examples/Flare" colour="1.0, 0.5, 0.3" amplitude=0.1 frequency=0.5 quadratic=1 />
+ <BlinkingBillboard position="-17,-1.5,0" material="Examples/Flare" colour="0.5, 1.0, 0.3" amplitude=0.1 frequency=0.5 phase=180 quadratic=1 />
+ </attached>
+ <collisionShapes>
+ <BoxCollisionShape position="0,0,0" halfExtents="10, 3, 5" />
+ <BoxCollisionShape position="13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="-13,-1.3,0" halfExtents="3, 1, 2" />
+ <BoxCollisionShape position="0,0,7" halfExtents="3, 2, 2" />
+ <BoxCollisionShape position="0,0.1,-11" halfExtents="2.2, 1.8, 6" />
+ <BoxCollisionShape position="0,0.1,-19" halfExtents="1.4, 1, 2" />
+ </collisionShapes>
+<?lua
+ include("includes/weaponSettingsImmTest.oxi")
+?>
+ </SpaceShip>
+</Template>
+
+<Template name=spaceshipassffcameras defaults=0>
+ <SpaceShip>
+ <camerapositions>
+ <CameraPosition position="0,10, 40" drag=true mouselook=true />
+ <CameraPosition position="0,20, 80" drag=true mouselook=true />
+ <CameraPosition position="0,30,120" drag=true mouselook=true />
+ <!--CameraPosition position="0,150,-25" pitch=-90 drag=true />
+ <CameraPosition position="0,0,-40" yaw=180 drag=true />
+ <CameraPosition position="0,3,-14" yaw=0 />
+ <CameraPosition position="-50,5,-8" yaw=-90 drag=true />
+ <CameraPosition position="50,5,-8" yaw=90 drag=true /-->
+ </camerapositions>
+ </SpaceShip>
+</Template>
+
+<Template name=spaceshipassffengine baseclass=MultiStateEngine>
+ <MultiStateEngine
+ boostfactor = 2
+
+ speedfront = 150
+ speedback = 50
+ speedleftright = 50
+ speedupdown = 50
+
+ defEngineSndNormal = "sounds/Engine_low.ogg"
+ defEngineSndBoost = "sounds/Engine_high.ogg"
+
+ accelerationfront = 500
+ accelerationbrake = 500
+ accelerationback = 125
+ accelerationleftright = 125
+ accelerationupdown = 125
+ >
+ <EffectContainer condition="idle">
+ <WorldSound mainstate="activity" source="sounds/Engine_idle.ogg" looping=1 active=false/>
+ </EffectContainer>
+ <EffectContainer condition="not idle">
+ <FadingBillboard mainstate=activity active=false scale=0.1 position="0, 0, 9" colour="0.2, 0.65, 1.0, 1.0" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+<!--
+ <Light mainstate=visibility position=" 8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
+ <Light mainstate=visibility position="-8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
+-->
+ </EffectContainer>
+ <EffectContainer condition="normal or brake">
+
+ </EffectContainer>
+ <EffectContainer condition="normal or boost">
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ </EffectContainer>
+ <EffectContainer condition="boost">
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+ <Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+ </EffectContainer>
+ <EffectContainer condition="brake">
+ <FadingBillboard mainstate=activity active=false scale=0.3 position=" 8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.3 position="-8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.15 position=" 8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
+ <FadingBillboard mainstate=activity active=false scale=0.15 position="-8, 0, 6" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
+ </EffectContainer>
+ </MultiStateEngine>
+</Template>
+
Modified: code/trunk/data/levels/templates/spaceshipPirate.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipPirate.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipPirate.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,7 +2,6 @@
<SpaceShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshippiratecameras
- engine = spaceshippirateengine
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
@@ -20,6 +19,9 @@
linearDamping = 0.7
angularDamping = 0.9999999
>
+ <engines>
+ <MultiStateEngine position=" 0, 0, 0" template=spaceshippirateengine />
+ </engines>
<attached>
<Model position="0,0,0" yaw=90 pitch=-90 roll=0 scale=4 mesh="pirate.mesh" />
<BlinkingBillboard position=" 12.7,-3.8,0" material="Examples/Flare" colour="1.0, 1.0, 1" amplitude=0.04 frequency=1 quadratic=1 />
Modified: code/trunk/data/levels/templates/spaceshipSwallow.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipSwallow.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipSwallow.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,7 +2,6 @@
<SpaceShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshipswallowcameras
- engine = spaceshipswallowengine
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
@@ -20,7 +19,9 @@
linearDamping = 0.7
angularDamping = 0.9999999
>
-
+ <engines>
+ <MultiStateEngine position=" 0, 0, 0" template=spaceshipswallowengine />
+ </engines>
<attached>
<Model position="0,0,0" scale=2 yaw=90 pitch=-90 roll=0 mesh="swallow_mat.mesh" />
</attached>
Modified: code/trunk/data/levels/templates/spaceshipTransporter.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipTransporter.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipTransporter.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,7 +2,6 @@
<SpaceShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshipTransportercameras
- engine = spaceshipTransporterengine
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
@@ -20,6 +19,9 @@
linearDamping = 0.7
angularDamping = 0.9999999
>
+ <engines>
+ <MultiStateEngine position=" 0, 0, 0" template=spaceshipTransporterengine />
+ </engines>
<attached>
<Model position="0,0,0" yaw=0 pitch=0 roll=0 scale=10 mesh="Transporter.mesh" />
</attached>
Modified: code/trunk/data/levels/templates/spaceshipTransporterSL.oxt
===================================================================
--- code/trunk/data/levels/templates/spaceshipTransporterSL.oxt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/templates/spaceshipTransporterSL.oxt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -2,7 +2,6 @@
<SpaceShip
hudtemplate = spaceshiphud
camerapositiontemplate = spaceshipTransportercameras
- engine = spaceshipTransporterengine
spawnparticlesource = "Orxonox/fairytwirl"
spawnparticleduration = 3
explosionchunks = 6
@@ -20,6 +19,9 @@
linearDamping = 0.7
angularDamping = 0.9999999
>
+ <engines>
+ <MultiStateEngine position=" 0, 0, 0" template=spaceshipTransporterengine />
+ </engines>
<attached>
<Model position="0,0,0" yaw=0 pitch=0 roll=0 scale=10 mesh="Transporter.mesh" />
</attached>
@@ -37,55 +39,3 @@
?>
</SpaceShip>
</Template>
-
-<Template name=spaceshipTransportercameras defaults=0>
- <SpaceShip>
- <camerapositions>
- <CameraPosition position="0,90,350" drag=true mouselook=true />
- <CameraPosition position="0,150, 400" drag=true mouselook=true />
- <CameraPosition position="0,200,550" drag=true mouselook=true />
- <CameraPosition position="0,120,200" pitch="-80" drag=true mouselook=true />
- </camerapositions>
- </SpaceShip>
-</Template>
-
-<Template name=spaceshipTransporterengine baseclass=MultiStateEngine>
- <MultiStateEngine
- boostfactor = 2
-
- speedfront = 50
- speedback = 10
- speedleftright = 10
- speedupdown = 10
-
-
- accelerationfront = 20
- accelerationbrake = 20
- accelerationback = 10
- accelerationleftright = 10
- accelerationupdown = 10
- >
- <EffectContainer condition="idle">
- </EffectContainer>
- <EffectContainer condition="not idle">
-
- </EffectContainer>
- <EffectContainer condition="normal or brake">
-
- </EffectContainer>
- <EffectContainer condition="normal or boost">
- <Backlight mainstate=activity active=false scale=2 name=bltest position=" 22, -10, 87" colour="1, 0.7, 0.1, 1.0" width=10 length=3000 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
- <Backlight mainstate=activity active=false scale=2 name=bltest position="-22, -10, 87" colour="1, 0.7, 0.1, 1.0" width=10 length=3000 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
- </EffectContainer>
- <EffectContainer condition="boost">
- <Backlight mainstate=activity active=false scale=3 name=bltest position=" 22, -10, 87" colour="1, 0.7, 0.1, 0.7" width=25 length=2000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
- <Backlight mainstate=activity active=false scale=3 name=bltest position="-22, -10, 87" colour="1, 0.7, 0.1, 0.7" width=25 length=2000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
- </EffectContainer>
- <EffectContainer condition="brake">
- <FadingBillboard mainstate=activity active=false scale=2 position=" 22, -10, 87" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
- <FadingBillboard mainstate=activity active=false scale=2 position="-22, -10, 87" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
- <FadingBillboard mainstate=activity active=false scale=1 position="22, -10, 87" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
- <FadingBillboard mainstate=activity active=false scale=1 position="-22, -10, 87" colour="1.0, 0.0, 0.0, 1.0" material="Flares/backlightflare" turnontime=0.5 turnofftime=0.5 />
- </EffectContainer>
- </MultiStateEngine>
-</Template>
Modified: code/trunk/data/levels/testStars.oxw
===================================================================
--- code/trunk/data/levels/testStars.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/testStars.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,6 +22,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.8, 0.8, 0.8"
Modified: code/trunk/data/levels/testSwallow.oxw
===================================================================
--- code/trunk/data/levels/testSwallow.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/testSwallow.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -21,6 +21,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Copied: code/trunk/data/levels/tetris.oxw (from rev 8705, code/branches/presentation/data/levels/tetris.oxw)
===================================================================
--- code/trunk/data/levels/tetris.oxw (rev 0)
+++ code/trunk/data/levels/tetris.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,62 @@
+<LevelInfo
+ name = "Tetris"
+ description = "Tetris in space!"
+ tags = ""
+/>
+
+<?lua
+ include("HUDTemplates3.oxo")
+ include("stats.oxo")
+ include("templates/lodInformation.oxt")
+?>
+
+<Template name=tetrisstonecameras defaults=0>
+ <TetrisStone>
+ <camerapositions>
+ <CameraPosition position="55,75,200" absolute=true />
+ <CameraPosition position="0,50,160" drag=true mouselook=true />
+ <CameraPosition position="0,50,0" pitch=-90 drag=true mouselook=true />
+ </camerapositions>
+ </TetrisStone>
+</Template>
+
+<Template name=tetrisstone>
+ <TetrisStone camerapositiontemplate=tetrisstonecameras>
+ <attached>
+ <Model position="0,0,0" mesh="crate.mesh" scale=1 />
+ </attached>
+ </TetrisStone>
+</Template>
+
+<Level
+ name = "Presentation"
+ description = "A simple testlevel"
+ gametype = "Tetris"
+>
+ <templates>
+ <Template link=lodtemplate_default />
+ </templates>
+ <?lua include("includes/notifications.oxi") ?>
+
+ <Scene
+ ambientlight = "0.5, 0.5, 0.5"
+ skybox = "Orxonox/skypanoramagen1"
+ >
+ <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" />
+
+ <?lua
+ for i = 1, 10, 1 do
+ ?>
+ <SpawnPoint position="<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>,<?lua print(math.random() * 1000 - 500) ?>" lookat="0,0,0" />
+ <?lua end ?>
+
+ <TetrisCenterpoint name=tetriscenter width=11 height=15 stoneSize=10 stoneTemplate=tetrisstone stoneSpeed=10 position="-55,-75,0">
+ <attached>
+ <Model position="55,-1,0" mesh="cube.mesh" scale3D="57,1,11" />
+ <Model position="-1,76,0" mesh="cube.mesh" scale3D="1,76,1" />
+ <Model position="111,76,0" mesh="cube.mesh" scale3D="1,76,1" />
+ </attached>
+ </TetrisCenterpoint>
+
+ </Scene>
+</Level>
Modified: code/trunk/data/levels/theTimeMachine.oxw
===================================================================
--- code/trunk/data/levels/theTimeMachine.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/theTimeMachine.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -67,6 +67,8 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
+
<Scene
ambientlight="0.8,0.8,0.8"
skybox="Orxonox/skypanoramagen2"
Modified: code/trunk/data/levels/tutorial.oxw
===================================================================
--- code/trunk/data/levels/tutorial.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/tutorial.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -18,6 +18,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/levels/underAttack.oxw
===================================================================
--- code/trunk/data/levels/underAttack.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/underAttack.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -14,6 +14,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/levels/waypoints.oxw
===================================================================
--- code/trunk/data/levels/waypoints.oxw 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/levels/waypoints.oxw 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,6 +20,7 @@
<templates>
<Template link=lodtemplate_default />
</templates>
+ <?lua include("includes/notifications.oxi") ?>
<Scene
ambientlight = "0.5, 0.5, 0.5"
Modified: code/trunk/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/trunk/data/overlays/HUDTemplates3.oxo 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/overlays/HUDTemplates3.oxo 2011-06-14 18:53:28 UTC (rev 8706)
@@ -34,7 +34,7 @@
name = "HealthBar1"
background = "Orxonox/HealthBarBackground"
size = "0.35, 0.0875"
- position = "0.0 , 0.95 "
+ position = "0.0 , 0.9 "
pickpoint = "0, 1"
bartexture = "healthbar_bar.png"
textfont = "VeraMono"
@@ -55,7 +55,7 @@
name = "SpeedBar1"
background = "Orxonox/BarBackground"
size = "0.35, 0.05"
- position = "0.0 , 1.0 "
+ position = "0.0 , 0.95 "
pickpoint = "0, 1"
correctaspect = false
>
@@ -64,6 +64,19 @@
<BarColour position = 1.0 colour = "0.7,0.2,0.2" />
</HUDSpeedBar>
+ <HUDBoostBar
+ name = "BoostBar1"
+ backgroundtex = "bar1.png"
+ size = "0.35, 0.05"
+ position = "0.0 , 1.0 "
+ pickpoint = "0, 1"
+ correctaspect = false
+ >
+ <BarColour position = 0.0 colour = "0.7,0.2,0.2" />
+ <BarColour position = 0.5 colour = "0.7,0.7,0.2" />
+ <BarColour position = 1.0 colour = "0.2,0.7,0.2" />
+ </HUDBoostBar>
+
<HUDNavigation
name = "Navigation"
correctaspect = true
Modified: code/trunk/data/overlays/debug.oxo
===================================================================
--- code/trunk/data/overlays/debug.oxo 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/data/overlays/debug.oxo 2011-06-14 18:53:28 UTC (rev 8706)
@@ -83,13 +83,5 @@
align = "center"
/>
- <GametypeStatus
- name = "state"
- position = "0.5, 0.85"
- font = "VeraMono"
- textsize = 0.05
- colour = "1.0, 1.0, 0.0, 0.8"
- align = "center"
- />
</OverlayGroup>
</Template>
Copied: code/trunk/data/particle/RingExp.particle (from rev 8705, code/branches/presentation/data/particle/RingExp.particle)
===================================================================
--- code/trunk/data/particle/RingExp.particle (rev 0)
+++ code/trunk/data/particle/RingExp.particle 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,135 @@
+
+particle_system Orxonox/RingExp
+{
+ quota 500
+ material PE/lensflare
+ particle_width 65
+ particle_height 40
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type oriented_self
+ billboard_origin center
+ billboard_rotation_type vertex
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Point
+ {
+ angle 55
+ colour 0.9 0.9 1 1
+ colour_range_start 0.9 0.9 1 1
+ colour_range_end 0.9 0.9 1 1
+ direction -1 0 0
+ emission_rate 1250
+ position 0 0 0
+ velocity 65
+ velocity_min 65
+ velocity_max 65
+ time_to_live 4
+ time_to_live_min 4
+ time_to_live_max 4
+ duration 0.1
+ duration_min 0.1
+ duration_max 0.1
+ repeat_delay 10
+ repeat_delay_min 10
+ repeat_delay_max 10
+ }
+
+ emitter Point
+ {
+ angle 55
+ colour 0.9 0.9 1 1
+ colour_range_start 0.9 0.9 1 1
+ colour_range_end 0.9 0.9 1 1
+ direction 1 0 0
+ emission_rate 1250
+ position 0 0 0
+ velocity 65
+ velocity_min 65
+ velocity_max 65
+ time_to_live 4
+ time_to_live_min 4
+ time_to_live_max 4
+ duration 0.1
+ duration_min 0.1
+ duration_max 0.1
+ repeat_delay 10
+ repeat_delay_min 10
+ repeat_delay_max 10
+ }
+
+ emitter Point
+ {
+ angle 55
+ colour 0.9 0.9 1 1
+ colour_range_start 0.9 0.9 1 1
+ colour_range_end 0.9 0.9 1 1
+ direction 0 0 -1
+ emission_rate 1250
+ position 0 0 0
+ velocity 65
+ velocity_min 65
+ velocity_max 65
+ time_to_live 4
+ time_to_live_min 4
+ time_to_live_max 4
+ duration 0.1
+ duration_min 0.1
+ duration_max 0.1
+ repeat_delay 10
+ repeat_delay_min 10
+ repeat_delay_max 10
+ }
+
+ emitter Point
+ {
+ angle 55
+ colour 0.9 0.9 1 1
+ colour_range_start 0.9 0.9 1 1
+ colour_range_end 0.9 0.9 1 1
+ direction 0 0 1
+ emission_rate 1250
+ position 0 0 0
+ velocity 65
+ velocity_min 65
+ velocity_max 65
+ time_to_live 4
+ time_to_live_min 4
+ time_to_live_max 4
+ duration 0.1
+ duration_min 0.1
+ duration_max 0.1
+ repeat_delay 10
+ repeat_delay_min 10
+ repeat_delay_max 10
+ }
+
+ affector DeflectorPlane
+ {
+ plane_point 0 -2 0
+ plane_normal 0 1 0
+ bounce 1
+ }
+
+ affector DeflectorPlane
+ {
+ plane_point 0 2 0
+ plane_normal 0 -1 0
+ bounce 1
+ }
+
+ affector ColourFader
+ {
+ red -0.3
+ green -0.3
+ blue -0.3
+ alpha -0.3
+ }
+
+}
Copied: code/trunk/data/particle/RingExp2.particle (from rev 8705, code/branches/presentation/data/particle/RingExp2.particle)
===================================================================
--- code/trunk/data/particle/RingExp2.particle (rev 0)
+++ code/trunk/data/particle/RingExp2.particle 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,58 @@
+
+particle_system Orxonox/RingExp2
+{
+ quota 500
+ material PE/ringflare
+ particle_width 35
+ particle_height 35
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type oriented_self
+ billboard_origin center
+ billboard_rotation_type vertex
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Point
+ {
+ angle 30
+ colour 1 1 1 1
+ colour_range_start 1 1 1 1
+ colour_range_end 1 0.7 0.7 1
+ direction 0 1 0
+ emission_rate 1000
+ position 0 0 0
+ velocity 50
+ velocity_min 50
+ velocity_max 100
+ time_to_live 4
+ time_to_live_min 4
+ time_to_live_max 4
+ duration 0.5
+ duration_min 0.5
+ duration_max 0.5
+ repeat_delay 10
+ repeat_delay_min 10
+ repeat_delay_max 10
+ }
+
+ affector ColourFader
+ {
+ red -0.3
+ green -0.3
+ blue -0.3
+ alpha -0.3
+ }
+
+ affector DirectionRandomiser
+ {
+ randomness 5
+ scope 1.0
+ keep_velocity true
+ }
+}
Copied: code/trunk/data/particle/RingExp3.particle (from rev 8705, code/branches/presentation/data/particle/RingExp3.particle)
===================================================================
--- code/trunk/data/particle/RingExp3.particle (rev 0)
+++ code/trunk/data/particle/RingExp3.particle 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,58 @@
+
+particle_system Orxonox/RingExp3
+{
+ quota 500
+ material PE/ringflare
+ particle_width 35
+ particle_height 35
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space false
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type oriented_self
+ billboard_origin center
+ billboard_rotation_type vertex
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter Point
+ {
+ angle 30
+ colour 1 1 1 1
+ colour_range_start 1 1 1 1
+ colour_range_end 1 0.7 0.7 1
+ direction 0 -1 0
+ emission_rate 1000
+ position 0 0 0
+ velocity 50
+ velocity_min 50
+ velocity_max 100
+ time_to_live 4
+ time_to_live_min 4
+ time_to_live_max 4
+ duration 0.5
+ duration_min 0.5
+ duration_max 0.5
+ repeat_delay 10
+ repeat_delay_min 10
+ repeat_delay_max 10
+ }
+
+ affector ColourFader
+ {
+ red -0.3
+ green -0.3
+ blue -0.3
+ alpha -0.3
+ }
+
+ affector DirectionRandomiser
+ {
+ randomness 5
+ scope 1.0
+ keep_velocity true
+ }
+}
Copied: code/trunk/data/particle/Shield.particle (from rev 8705, code/branches/presentation/data/particle/Shield.particle)
===================================================================
--- code/trunk/data/particle/Shield.particle (rev 0)
+++ code/trunk/data/particle/Shield.particle 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,49 @@
+
+particle_system Orxonox/Shield
+{
+ quota 2000
+ material PE/lensflare
+ particle_width 25
+ particle_height 25
+ cull_each false
+ renderer billboard
+ sorted false
+ local_space true
+ iteration_interval 0
+ nonvisible_update_timeout 0
+ billboard_type point
+ billboard_origin center
+ billboard_rotation_type texcoord
+ common_up_vector 0 1 0
+ point_rendering false
+ accurate_facing false
+
+ emitter HollowEllipsoid
+ {
+ angle 0
+ colour 0 0.298701 1 0.1
+ colour_range_start 0 0.298701 1 0.1
+ colour_range_end 0 0.298701 1 0.1
+ direction 0 1 0
+ emission_rate 2000
+ position 0 0 0
+ velocity 0
+ velocity_min 0
+ velocity_max 0
+ time_to_live 0.1
+ time_to_live_min 0.1
+ time_to_live_max 0.3
+ duration 0.1
+ duration_min 0.1
+ duration_max 0.2
+ repeat_delay 1000000
+ repeat_delay_min 1000000
+ repeat_delay_max 1000000
+ width 100
+ height 100
+ depth 100
+ inner_width 0.999999
+ inner_height 0.999999
+ inner_depth 0.999999
+ }
+}
Copied: code/trunk/data/particle/weaponflare.particle (from rev 8705, code/branches/presentation/data/particle/weaponflare.particle)
===================================================================
--- code/trunk/data/particle/weaponflare.particle (rev 0)
+++ code/trunk/data/particle/weaponflare.particle 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,46 @@
+
+particle_system Orxonox/weaponflare
+{
+ quota 10000
+ material PE/lensflare
+ particle_width 4
+ particle_height 4
+ cull_each false
+ renderer billboard
+ billboard_type point
+
+ emitter HollowEllipsoid
+ {
+ angle 0
+ colour 0.128 0.28 1 1
+ colour_range_start 0.128 0.28 1 1
+ colour_range_end 0.05 0.05 1 1
+ direction 0 0 0
+ emission_rate 130
+ position 0 0 0
+ velocity -0.8
+ velocity_min -0.8
+ velocity_max -0.8
+ time_to_live .000001
+ time_to_live_min .000001
+ time_to_live_max .000004
+ duration 0
+ duration_min 0
+ duration_max 0
+ repeat_delay 0
+ repeat_delay_min 0
+ repeat_delay_max 0
+ width 0.1
+ height 0.1
+ depth 0.1
+ inner_width 0.001
+ inner_height 0.001
+ inner_depth 0.001
+ }
+
+ affector LinearForce
+ {
+ force_vector 0 0 0
+ force_application add
+ }
+}
Copied: code/trunk/data/particle/weaponshoot.particle (from rev 8705, code/branches/presentation/data/particle/weaponshoot.particle)
===================================================================
--- code/trunk/data/particle/weaponshoot.particle (rev 0)
+++ code/trunk/data/particle/weaponshoot.particle 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,57 @@
+
+particle_system Orxonox/weaponshoot
+{
+ quota 2000
+ material PE/lensflare
+ particle_width 3
+ particle_height 3
+ cull_each false
+ renderer billboard
+ billboard_type point
+
+ emitter Point
+ {
+ angle 0.5
+ colour 0 0 0.8 1
+ colour_range_start 0 0 0.8 1
+ colour_range_end 0.1 0.1 0.9 1
+ direction 0 0 1
+ emission_rate 6
+ position 0 0 0
+ velocity 35
+ velocity_min 35
+ velocity_max 35
+ time_to_live 5
+ time_to_live_min 5
+ time_to_live_max 5
+ duration 1
+ duration_min 1
+ duration_max 1
+ repeat_delay 4
+ repeat_delay_min 4
+ repeat_delay_max 4
+ }
+
+ emitter Point
+ {
+ angle 90
+ colour 0 0 0.8 1
+ colour_range_start 0 0 0.8 1
+ colour_range_end 0.1 0.1 1 1
+ direction 0 0 -1
+ emission_rate 1500
+ position 0 0 0
+ velocity 15
+ velocity_min 15
+ velocity_max 15
+ time_to_live 0.005
+ time_to_live_min 0.005
+ time_to_live_max 0.0075
+ duration 0.75
+ duration_min 0.75
+ duration_max 0.75
+ repeat_delay 4.25
+ repeat_delay_min 4.25
+ repeat_delay_max 4.25
+ }
+}
Modified: code/trunk/doc/api/Groups.dox
===================================================================
--- code/trunk/doc/api/Groups.dox 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/doc/api/Groups.dox 2011-06-14 18:53:28 UTC (rev 8706)
@@ -152,6 +152,11 @@
*/
/**
+ @defgroup Portals Portals
+ @ingroup Modules
+*/
+
+/**
@defgroup Questsystem Questsystem
@ingroup Modules
*/
Copied: code/trunk/doc/api/groups/Portals.dox (from rev 8705, code/branches/presentation/doc/api/groups/Portals.dox)
===================================================================
--- code/trunk/doc/api/groups/Portals.dox (rev 0)
+++ code/trunk/doc/api/groups/Portals.dox 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,281 @@
+/**
+ @addtogroup Portals Portals
+ @ingroup Modules
+
+ This module allows you to place @ref orxonox::PortalEndPoint "PortalEndPoints" in space and connect pairs of them with a @ref orxonox::PortalLink "PortalLink" in order to allow fast travelling from A to B.
+
+ @section FastHowTo Fast HowTo: Including portals in a level
+ The simplest way to use portals is show by the following piece of xml-code
+ @code
+ <Template name=PortalDefault>
+ <PortalEndPoint>
+ <attached>
+ <Billboard material="Portals/Default" />
+ </attached>
+ </PortalEndPoint>
+ </Template>
+
+ <PortalEndPoint position="0,0,0" id="1" design="PortalDefault"/>
+ <PortalEndPoint position="-100,0,0" id="2" design="PortalDefault"/>
+ <PortalLink fromID="1" toID="2" />
+ @endcode
+ This
+ - creates two @ref orxonox::PortalEndPoint "PortalEndPoints", one at 0,0,0 and the other at -100,0,0
+ - makes them visible by attaching a Billboard made of the "Portals/Default" material to each of them and
+ - connects them, meaning that any @ref orxonox::Pawn "Pawn" which gets near 0,0,0 is immediately "warped" to -100,0,0 (but not the other way round)
+
+ @section IncludePortals Detailed HowTo: Including portals in a level
+ In the example above some default values are used. The full possibilities are shown below
+ @code
+ <Template name=PortalDefault>
+ <PortalEndPoint>
+ <attached>
+ <Billboard material="Portals/Default" />
+ </attached>
+ </PortalEndPoint>
+ </Template>
+
+ <Template name=PortalBig>
+ <PortalEndPoint>
+ <attached>
+ <Billboard material="Portals/Big" />
+ </attached>
+ </PortalEndPoint>
+ </Template>
+
+ <PortalEndPoint position="0,0,0" id="1" distance="40" target="MobileEntity" design="PortalDefault"/>
+ <PortalEndPoint position="-100,0,0" id="2" distance="40" target="MobileEntity" design="PortalBig"/>
+ <PortalLink fromID="1" toID="2" />
+ <PortalLink fromID="2" toID="1" />
+ @endcode
+
+ step by step
+ @subsection Templates "Templates"
+ In order to make @ref orxonox::PortalEndPoint "PortalEndPoints" visible in the game there must be something visible.
+ The idea (as shown above) is to define or include arbitrary Templates which make a PortalEndPoint visible and use them later by setting the design attribute of a @ref orxonox::PortalEndPoint "PortalEndPoint" to the template name
+ @subsection Parameters "Parameters"
+ - position: 3d-coordinate in space
+ - distance (default: 50): distance at which a valid entity gets pulled in (if the end point is an entrance).
+ - target (default: "Pawn"): the class which is able to enter this end point (if it is an entrance)
+ - design: the name of the @ref orxonox::Template "design template"
+*/
+
+/**
+ @addtogroup Pickup Pickup
+ @ingroup Modules
+
+ The Pickup module adds a special type of object to Orxonox, the so-called @ref orxonox::Pickupable "Pickupables". @ref orxonox::Pickupable "Pickupables" are objects that can be picked up (by virtually any entity, but commonly by the @ref orxonox::Pawn "Pawn") and have some kind of effect on the entity that picked the @ref orxonox::Pickupable "Pickupable" up.
+
+ @section IncludingPickups Including pickups in a level
+ @ref orxonox::Pickupable "Pickupables" are designed so that they can be included in levels fairly easily, while also ensuring, that the pickup itself (its game-logic component) and how it is represented (e.g. in the PickupInventory (the GUI that displays @ref orxonox::Pickupable "Pickupables") or in the game) are neatly seperated.
+ To be able to use @ref orxonox::Pickupable "Pickupables" in a level one must understand some basic concepts.
+ - @ref orxonox::Pickupable "Pickupables" are entities which (by itself) have no physical (or graphical) dimension. The simply represent the effect they will have on a @ref orxonox::PickupCarrier "PickupCarrier" (the entity that can pick up @ref orxonox::Pickupable "Pickupables", @ref orxonox::Pawn "Pawn" for example inherits from @ref orxonox::PickupSpawner "PickupSpawner" and thus is able to pick up and carry @ref orxonox::Pickupable "Pickupables"), when used and the mechanism that leads to that.
+ - The physical (or graphical) dimension of a pickup is called a @ref orxonox::PickupRepresentation "PickupRepresentation".
+ - The @ref orxonox::PickupRepresentation "PickupRepresentation" of a @ref orxonox::Pickupable "Pickupable" and the @ref orxonox::Pickupable "Pickupable" itself are linked to each other, in such a way that a @ref orxonox::PickupRepresentation "PickupRepresentation" can only represent one type of @ref orxonox::Pickupable "Pickupable".
+ - A type of @ref orxonox::Pickupable "Pickupable" is a specific pickup class (inheriting from @ref orxonox::Pickupable "Pickupable") with specific values for all its relevant parameters. This means, that a pickup of the same class with the same values for all parameters except for one is a different type of pickup and will therefore have a different @ref orxonox::PickupRepresentation "PickupRepresentation". Which parameters are the ones relevant to destinguish between two types of pickups can be defined in the class description of the specific pickup.
+ - The entity that actually gives a @ref orxonox::Pickupable "Pickupable" to a @ref orxonox::PickupCarrier "PickupCarrier" is called a @ref orxonox::PickupSpawner "PickupSpawner". A @ref orxonox::PickupSpawner "PickupSpawner" creates (based on some parameters) @ref orxonox::Pickupable "Pickupables" which then is picked up by the @ref orxonox::PickupCarrier "PickupCarrier", that caused the @ref orxonox::PickupSpawner "PickupSpawner" to spawn a new pickup. How the spawner looks in the game is defined by the @ref orxonox::PickupRepresentation "PickupRepresentation" of the @ref orxonox::Pickupable "Pickupable" it spawns.
+
+ @subsection UsingPredifinedPickups Using predefined pickups
+ There is a file called <code>pickupRepresentationTemplates.oxt</code> in <code>levels/templates</code>, which holds the templates for the @ref orxonox::PickupRepresentation "PickupRepresentations" and also templates for @ref orxonox::Pickupable "Pickupables". The templates for the @ref orxonox::PickupRepresentation "PickupRepresentations" define the @ref orxonox::StaticEntity "StaticEntities" that are attached to the @ref orxonox::PickupSpawner "PickupSpawners" to make them look like the @ref orxonox::Pickupable "Pickupable" they are spawning. The templates for the @ref orxonox::Pickupable "Pickupables" can be added just for ease of use.
+ If you want to use pickups you will have to include this file in your level file, somewhere above the Level-tag.
+ @code
+ <?lua
+ include("templates/pickupRepresentationTemplates.oxt")
+ ?>
+ ...
+ <Level>
+ ...
+ @endcode
+ There is another file called <code>pickups.oxi</code> in <code>level/includes</code> which creates all @ref orxonox::PickupRepresentation "PickupRepresentations" needed for the @ref orxonox::Pickupable "Pickupable" supplied by the <code>pickupRepresentationTemplates.oxt</code> file. This file will have to be included as well. It has to be somewhere after the opening Scene-tag and your first use of a pickup.
+ @code
+ <Scene>
+ ...
+ <?lua
+ include("includes/pickups.oxi")
+ ?>
+ @endcode
+ After that all the predefined pickups specified in those two files can be used just by creating a @ref orxonox::PickupSpawner "PickupSpawner" for them in the respective level.
+ For example:
+ @code
+ <PickupSpawner position="-100,0,-100" respawnTime="30" maxSpawnedItems="10">
+ <pickup>
+ <HealthPickup
+ health = 10
+ healthType = "limited"
+ activationType = "immediate"
+ durationType = "once"
+ />
+ </pickup>
+ </PickupSpawner>
+ @endcode
+ Please be aware, that the @ref orxonox::Pickupable "Pickupable" specified for the @ref orxonox::PickupSpawner "PickupSpawner", has to be exactly the same (including all parameters) to the one specified in the <code>pickups.oxi</code> file.
+ To make things simpler, one could just use the templates specified in the <code>pickupRepresentationTemplates.oxt</code> file. Which, following the previous example, would look like this:
+ @code
+ <PickupSpawner position="-100,0,-100" respawnTime="30" maxSpawnedItems="10">
+ <pickup>
+ <HealthPickup template="smallhealthpickup" />
+ </pickup>
+ </PickupSpawner>
+ @endcode
+
+ @subsection UnsingNon-PredefinedPickups Using non-predefined pickups
+ To include a type of pickup (which, as we remember, is the class of the @ref orxonox::Pickupable "Pickupable" with specific values for all the relevant parameters) in a level file, you can just create a new @ref orxonox::PickupSpawner "PickupSpawner" and specify the @ref orxonox::Pickupable "Pickupable".
+ @code
+ <PickupSpawner position="-100,0,-100" respawnTime="30" maxSpawnedItems="10">
+ <pickup>
+ <HealthPickup
+ health = 33
+ healthType = "limited"
+ activationType = "immediate"
+ durationType = "once"
+ />
+ </pickup>
+ </PickupSpawner>
+ @endcode
+ As can be seen in the <code>pickupRepresentationTemplates.oxt</code> file and the <code>pickups.oxi</code> file there is no @ref orxonox::PickupRepresentation "PickupRepresentation" defined for this type of pickup. Thus the default representation will be used.
+
+ To create an appropriate @ref orxonox::PickupRepresentation "PickupRepresentation" for the inserted pickup above, you can just create a @ref orxonox::PickupRepresentation "PickupRepresentation" within the scene (Within the Scene-tags).
+ @code
+ <PickupRepresentation
+ name = "My new health pickup"
+ description = "This is an awesome new health pickup."
+ spawnerTemplate = "mediumhealthpickupRepresentation"
+ inventoryRepresentation = "MediumHealth"
+ >
+ <pickup>
+ <HealthPickup
+ health = 33
+ healthType = "limited"
+ activationType = "immediate"
+ durationType = "once"
+ />
+ </pickup>
+ </PickupRepresentation>
+ @endcode
+ Notice, that the type of pickup specified for the @ref orxonox::PickupRepresentation "PickupRepresentation", naturally, needs to be the same (this is the way they can be connected). Also, we just used an existing <em>spawnerTemplate</em>, to make things simpler.
+
+ The next step is to create a <em>spawnerRepresentation</em> uniquely for our new type of pickup. Lets call it <code>newhealthpickupRepresentation</code>. Thus the parameter <em>spawnerTemplate</em> of the @ref orxonox::PickupRepresentation "PickupRepresentation" has to be changed to that value.
+ @code
+ spawnerTemplate = "newhealthpickupRepresentation"
+ @endcode
+ The <em>spawnerTemplate</em> defines how the @ref orxonox::PickupSpawner "PickupSpawner" is displayed in a level.
+ In our example case it could look like this:
+ @code
+ <Template name=newhealthpickupRepresentation>
+ <PickupRepresentation>
+ <spawner-representation>
+ <StaticEntity>
+ <attached>
+ -- Here you can put all the objects which define the look of the spawner. --
+ </attached>
+ </StaticEntity>
+ </spawner-representation>
+ </PickupRepresentation>
+ </Template>
+ @endcode
+ Please refer to the <code>pickupRepresentationTemplates.oxt</code> for more examples.
+
+ The @ref orxonox::PickupRepresentation "PickupRepresentation" also needs another parameter the <em>inventoryRepresentation</em>. This parameter defined how the @ref orxonox::Pickupable "Pickupable" is displayed in the PickupInventory (a menu to browse the currently equipped pickups).
+ @code
+ inventoryRepresentation = "MediumHealth"
+ @endcode
+ This is the name of an image defined in the PickupInventory imageset (<code>PickupInventory.imageset</code>), which can be found in <code>data_extern/gui/imagesets</code>.
+
+ This is all that has to be done. Now you have a new pickup type with an appropriate @ref orxonox::PickupRepresentation "PickupRepresentation" for your use. If you feel that your pickup is useful in general, please don't hesitate to create a template for the pickup and add your pickup to the <code>pickupRepresentationTemplates.oxt</code> file and the <code>pickups.oxi</code> file, so that anyone who wants to use it can do so quite easily.
+
+ There is also an additional way to create new types of pickups to be used in a level (without having to do any coding). There is a @ref orxonox::Pickupable "Pickupable" called the @ref orxonox::PickupCollection "PickupCollection", which is just a collection (hence the name) of @ref orxonox::Pickupable "Pickupables" (more precisely of @ref orxonox::CollectiblePickup "CollectiblePickups"), behaving as if it was just one @ref orxonox::Pickupable "Pickupable".
+ A @ref orxonox::PickupCollection "PickupCollection" can be created as follows:
+ @code
+ <PickupCollection>
+ <pickupables>
+ -- some pickups you want to have in your collection, e.g. --
+ <HealthPickup template=smallhealthpickup />
+ <HealthPickup health=50 healthRate=5 durationType=continuous activationType=immediate healthType=limited />
+ </pickupables>
+ </PickupCollection>
+ @endcode
+ Of which types of pickups a collection is made up is entirely up to the one creating the @ref orxonox::PickupCollection "PickupCollection", they can be mixed freely.
+
+ @section CreatingAPickup Creating a new pickup
+ Things have been fairly straightforward so far. Creating a @ref orxonox::Pickupable "Pickupable" form scratch isn't as easy. Therefore I'm just going to supply you with a recipe, or a set of steps you have to take, without which your pickup won't work and point out some common pitfalls.
+
+ @subsection CreatingAPickupClass Creating the class
+ For a new @ref orxonox::Pickupable "Pickupable" you need to create a new class in <code>>modules/pickup/items</code>. Your class needs to be derived from another pickup class, normally this would either be @ref orxonox::Pickupable "Pickupable", @ref orxonox::CollectiblePickup "CollectiblePickup" or @ref orxonox::Pickup "Pickup". @ref orxonox::Pickupable "Pickupable" is (as mentioned earlier) the base class of all things that can be picked up, thus of all pickups. @ref orxonox::CollectiblePickup "CollectiblePickup" is a (directly) derived class of @ref orxonox::Pickupable "Pickupable" and provides the additional functionality of enabling your pickup to be used in a @ref orxonox::PickupCollection "PickupCollection". However you are probably going to want to derive your class form @ref orxonox::Pickup "Pickup", because it is a @ref orxonox::CollectiblePickup "CollectiblePickup" and provides some useful methods. So have a look at @ref orxonox::Pickup "Pickup".
+ Once you have created your new pickup class you have to insert it in the <code>PickupPrereqs.h</code> file in the <code>modules/pickup</code> folder and in the <code>CMakeList.txt</code> file in the <code>modules/pickup/items</code> folder. Also have a look at other pickups to make sure you include all the necessary files in your class.
+
+ @subsection ChoosingTheCarriers Coosing the carriers
+ You also have to choose the entities that are allowed to pick your pickup up. After you have chosen the entity that carries your pickup, you need to do the following.
+ - The enity that carries your pickup needs to be derived from the @ref orxonox::PickupCarrier "PickupCarrier" interface. And you need to implement the @ref orxonox::PickupCarrier "PickupCarriers'" virtual functions <code>getCarrierChildren()</code> and <code>getCarrierParent()</code>. These tow methods are needed, because all pickups are initially picked up by a @ref orxonox::Pawn "Pawn" and then handed down to the entity that effectively carries them. With the above mentioned two function just that is accomplished. A hierarchical structure is established with one parent and a set of children, where the @ref orxonox::Pawn "Pawn" is the root node of this hierarchical structure, the only entity with no parent.
+ - Once you have done that you will also want to specify in your pickup which carriers can pick it up, this is done via the <code>addTarget()</code> function. So you have to make sure the target is added whenever one of your pickups is created (so, most conveniently somewhere in the constructor), with the following command.
+ @code
+ this->addTarget(ClassIdentifier<MyCarrierClass>::getIdentifier());
+ @endcode
+
+ @subsection CreatingTheInnerWorkings Creating the inner workings of your pickup
+ Now that we have the skeleton of a pickup and we have defined which carriers are allowed to pick our pickup up we are going to take a look at all the methods we can (or sometimes have to) overload from @ref orxonox::Pickupable "Pickupable", for our pickup to work properly. But first I will introduce some more concepts to make the need for these methods more obvious.
+ - Since one pickup class can by itself be many pickup types, we need a way to find out whether a particular instance of a pickup is of the same type as another instance of a pickup. To that end the @ref orxonox::PickupIdentifier "PickupIdentifier" was created. The @ref orxonox::PickupIdentifier "PickupIdentifier" accounts for the type of class your pickup is of and also for the parameters (and their values) that distinguish different types of pickups of the same class. Much of the functionality of the pickup module relies on this identifier being correct, thus it is very important to initialize it correctly. (We will see, how that is done in a short while.)
+ - Every @ref orxonox::Pickupable "Pickupable" has at least two states which are very important. The first is, whether the @ref orxonox::Pickupable "Pickupable" is currently in use or not and the second is whether the pickup is currently picked up or not.
+
+ Let's have a look at the important methods.
+ - <b>changedUsed()</b> The <code>changedUsed()</code> method is called whenever the state of the @ref orxonox::Pickupable "Pickupable" transits from being used to not being used or the other way around. Which means this method is probably the most important method you have at your fingertips, since it enables you to apply the effect of your pickup when it gets used and remove the effect as soon as it is no longer in use.
+ - <b>changedPickedUp()</b> The <code>changedPickedUp()</code> method is called whenever the state of the @ref orxonox::Pickupable "Pickupable" changes from being picked up to not being picked up or the other way around. For example if you want your pickup to be used as soon as it is picked up, this is the method you have to overload to achieve that behavior (or just let your pickup be derived from @ref orxonox::Pickup "Pickup", which implements exactly that behavior, if the <em>activationType</em> is set to <em>immediate</em>). You don't have to concern yourself with destroying the pickup or creating a spawner when it changes to not picked up, since that is already implemented with the @ref orxonox::Pickupable "Pickupable" and @ref orxonox::PickupCarrier "PickupCarrier" classes. If you want a different behavior, however, once again, this is the method.
+ - <b>changedCarrier()</b> The <code>changedCarrier()</code> method is called whenever the carrier of the @ref orxonox::Pickupable "Pickupable" changes. And by that I don't mean the class that is allowed to carry the pickup, but the object that actually carries (or carried) the pickup. Please do not overload this class to implement behavior for picked up -> not picked up transitions, use <code>changedPickedUp()</code> for that. For most pickup classes this method doesn't need to be overloaded. Where it is used, however is in the @ref orxonox::PickupCollection "PickupCollection" class, where the new carrier needed to be communicated to all pickups the collection consists of, whenever the carrier was changed.
+
+ Please be aware, that these three methods are methods registered with @ref Super.h "Super", meaning, that whenever overloading them, don't forget to call <code>SUPER(MyClass, myMethod);</code>.
+ Also when implementing the above methods you should think of what should happen in unexpected situations, e.g. when your pickup is unused manually and set to used again.
+ Additionally you should use the <code>destroy()</code> method of Pickupable instead of the method provided by @ref orxonox::OrxonoxClass "OrxonoxClass", meaning <code>Pickupable::destroy()</code> instead of plain <code>destroy()</code>.
+
+ - <b>clone()</b> The <code>clone()</code> method creates a new pickup of the same type as the pickup it is cloned from. So the cloned pickup is not exactly the same, as it doesn't necessarily completely reflect the status of the pickup it is cloned from, but it reflects all the parameters and their values, that distinguish different types of this pickup class. It needs to be implemented by every pickup class. And it is best if this is done in a very specific way. Below is shown how:
+ @code
+ void MyPickup::clone(OrxonoxClass*& item)
+ {
+ if(item == NULL)
+ item = new MyPickup(this);
+
+ SUPER(MyPickup, clone, item);
+
+ MyPickup* pickup = dynamic_cast<MyPickup*>(item);
+ // Here you should set all the important parameters (that distinguish the different types of this pickup), e.g.
+ pickup->setSomeParameter(this->getSomeParameter());
+ // You must also initialize the identifier of the new pickup, this is normally done in a member function called in
+ pickup->initializeIdentifier();
+ }
+ @endcode
+ - <b>initializeIdentifier()</b> The <code>initializeIdentifier()</code> method initializes (or more simply put, creates) the @ref orxonox::PickupIdentifier "PickupIdentifier" of the instance of your pickup. Since the important values of the parameters are not yet available in the constructor of your pickup this <code>initializeIdentifier()</code> method must be called as soon as they are available, which normally is in the <code>XMLPort()</code> method, and the <code>clone()</code> method, as seen above. In the <code>initializeIdentifier()</code> method you need to register each parameter that is important for the type of your pickup to its identifier, this is normally done as follows:
+ @code
+ void Pickup::initializeIdentifier(void)
+ {
+ // If the get method returns a string.
+ std::string val1 = this->getSomeParameter();
+ std::string type1 = "someParameter";
+ this->pickupIdentifier_->addParameter(type1, val1);
+ // If the get method doesn't return a string
+ std::stringstream stream;
+ stream << this->getSomeOtherParameter();
+ std::string type2 = "someOtherParameter";
+ std::string val2 = stream.str();
+ this->pickupIdentifier_->addParameter(type2, val2);
+ }
+ @endcode
+
+ Be aware, this only works for parameters that are simple enough, meaning with pointers for example it will, naturally, not work, and other ways must be found (this is for example done in @ref orxonox::PickupCollection "PickupCollection" with a derived class of the @ref orxonox::PickupIdentifier "PickupIdentifier", the @ref orxonox::PickupCollectionIdentifier "PickupCollectionIdentifier") or in the @ref orxonox::DronePickup "DronePickup" class by using a @ref orxonox::Template "Template".
+ - <b>createSpawner()</b> The <code>createSpawner()</code> method needs to be implemented by any pickup directly inheriting from @ref orxonox::Pickupable "Pickupable" (or directly from @ref orxonox::CollectiblePickup "CollectiblePickup"), so if you inherit from @ref orxonox::Pickup "Pickup", you don't need to implement this. It is used to create a @ref orxonox::PickupSpawner "PickupSpawner", when the pickup is dropped. A standard implementation would look like this.
+ @code
+ bool MyPickup::createSpawner(void)
+ {
+ new DroppedPickup(this, this, this->getCarrier());
+ return true;
+ }
+ @endcode
+
+ @section PickupTechnicalDetails Technical details
+
+ @image html pickupmodule.png
+*/
+
+/**
+ @defgroup PickupItems Items
+ @ingroup Pickup
+
+ The actual pickups can be found here.
+*/
Modified: code/trunk/doc/api/groups/Triggers.dox
===================================================================
--- code/trunk/doc/api/groups/Triggers.dox 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/doc/api/groups/Triggers.dox 2011-06-14 18:53:28 UTC (rev 8706)
@@ -54,7 +54,7 @@
- @b distance Which specifies the maximum distance at which the @ref orxonox::DistanceTrigger "DistanceTrigger" still triggers, i.e. its range. Default is <code>100</code>.
- @b target Which specifies the class of objects that can trigger the @ref orxonox::DistanceTrigger "DistanceTrigger". Default is <code>"Pawn"</code>.
- @b beaconMode Which specifies, whether the @ref orxonox::DistanceTrigger "DistanceTrigger" operates on @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacons" or not. If <em>off</em> the DistanceMultiTrigger works as usual. If set to <em>identify</em> the @ref orxonox::DistanceTrigger "DistanceTrigger" is only triggered by objects that have a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon", with the same name as specified in <em>targetname</em>, attached to them. If set to <em>exclude</em> the @ref orxonox::DistanceTrigger "DistanceTrigger" is only triggered by objects that don't have a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon", with the same name as specified in <em>targetname</em>, attached to them. Default is <em>off</em>.
- - @b targetname Which specifies the name @ref oroxnox::DistanceTriggerBeacon "DistanceTriggerBeacons" need to have to make the @ref orxonox::DistanceTrigger "DistanceTrigger" react to them if it is in <em>beacon-mode</em> (the beaconMode is not <em>off</em>).
+ - @b targetname Which specifies the name @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacons" need to have to make the @ref orxonox::DistanceTrigger "DistanceTrigger" react to them if it is in <em>beacon-mode</em> (the beaconMode is not <em>off</em>).
A simple @ref orxonox::DistanceTrigger "DistanceTrigger" could look like this:
@code
Modified: code/trunk/src/libraries/core/BaseObject.cc
===================================================================
--- code/trunk/src/libraries/core/BaseObject.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/BaseObject.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -194,14 +194,20 @@
*/
void BaseObject::addTemplate(Template* temp)
{
- this->templates_.insert(temp);
- if( temp->isLink() )
+ // network
+ if (temp->isLink())
{
- this->networkTemplateNames_.insert(temp->getLink());
- assert( !Template::getTemplate(temp->getLink())->isLink() );
+ this->networkTemplateNames_.insert(temp->getLink());
+
+ Template* link;
+ assert(!(link = Template::getTemplate(temp->getLink())) || !link->isLink());
+ link = NULL;
}
else
- this->networkTemplateNames_.insert(temp->getName());
+ this->networkTemplateNames_.insert(temp->getName());
+
+ // add template
+ this->templates_.insert(temp);
temp->applyOn(this);
}
Modified: code/trunk/src/libraries/core/ConfigValueContainer.h
===================================================================
--- code/trunk/src/libraries/core/ConfigValueContainer.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/ConfigValueContainer.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -108,7 +108,7 @@
@param value Only needed do determine the right type.
*/
template <class D, class V>
- ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const D& defvalue, const V& value)
+ ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const D& defvalue, const V&)
{
this->init(type, identifier, sectionname, varname);
this->initValue(static_cast<V>(defvalue));
@@ -124,7 +124,7 @@
@param value Only needed do determine the right type.
*/
template <class D, class V>
- ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const std::vector<D>& defvalue, const std::vector<V>& value)
+ ConfigValueContainer(ConfigFileType::Value type, Identifier* identifier, const std::string& sectionname, const std::string& varname, const std::vector<D>& defvalue, const std::vector<V>&)
{
this->init(type, identifier, sectionname, varname);
Modified: code/trunk/src/libraries/core/CoreIncludes.h
===================================================================
--- code/trunk/src/libraries/core/CoreIncludes.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/CoreIncludes.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -170,7 +170,7 @@
@param object Pointer to an OrxonoxClass
*/
template <class T>
- inline Identifier* ClassByObjectType(const T* object)
+ inline Identifier* ClassByObjectType(const T*)
{
return ClassIdentifier<T>::getIdentifier();
}
Modified: code/trunk/src/libraries/core/GUIManager.cc
===================================================================
--- code/trunk/src/libraries/core/GUIManager.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/GUIManager.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -37,12 +37,14 @@
#include <CEGUIDefaultLogger.h>
#include <CEGUIExceptions.h>
+#include <CEGUIFontManager.h>
#include <CEGUIInputEvent.h>
#include <CEGUIMouseCursor.h>
#include <CEGUIResourceProvider.h>
#include <CEGUISystem.h>
#include <CEGUIWindow.h>
#include <CEGUIWindowManager.h>
+#include <CEGUIXMLAttributes.h>
#include <elements/CEGUIListbox.h>
#include <elements/CEGUIListboxItem.h>
@@ -259,10 +261,13 @@
COUT(3) << "Initialising CEGUI." << std::endl;
+ this->oldCEGUI_ = false;
+
// Note: No SceneManager specified yet
#ifdef ORXONOX_OLD_CEGUI
guiRenderer_ = new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000);
resourceProvider_ = guiRenderer_->createResourceProvider();
+ this->oldCEGUI_ = true;
#else
guiRenderer_ = &OgreRenderer::create(*GraphicsManager::getInstance().getRenderWindow());
// We use our own RenderQueueListener so we can draw UNDER overlays
@@ -728,4 +733,46 @@
this->mouseLeft();
}
+ /**
+ @brief
+ Adds a new freetype font to the CEGUI system.
+ @param name
+ The name of the new font.
+ @param size
+ The font size of the new font in pixels.
+ @param fontName
+ The filename of the font.
+ */
+ /*static*/ void GUIManager::addFontHelper(const std::string& name, int size, const std::string& fontName)
+ {
+#ifdef ORXONOX_OLD_CEGUI
+ if(CEGUI::FontManager::getSingleton().isFontPresent(name)) // If a font with that name already exists.
+ return;
+
+ CEGUI::Font* font = NULL;
+ CEGUI::XMLAttributes xmlAttributes;
+
+ // Attributes specified within CEGUIFont
+ xmlAttributes.add("Name", name);
+ xmlAttributes.add("Filename", fontName);
+ xmlAttributes.add("ResourceGroup", "");
+ xmlAttributes.add("AutoScaled", "true");
+ xmlAttributes.add("NativeHorzRes", "800");
+ xmlAttributes.add("NativeVertRes", "600");
+
+ // Attributes specified within CEGUIXMLAttributes
+ xmlAttributes.add("Size", multi_cast<std::string>(size));
+ xmlAttributes.add("AntiAlias", "true");
+
+ font = CEGUI::FontManager::getSingleton().createFont("FreeType", xmlAttributes);
+ if(font != NULL)
+ font->load();
+#else
+ if(CEGUI::FontManager::getSingleton().isDefined(name)) // If a font with that name already exists.
+ return;
+
+ CEGUI::FontManager::getSingleton().createFreeTypeFont(name, (float)size, true, fontName, "", true, 800.0f, 600.0f);
+#endif
+ }
+
}
Modified: code/trunk/src/libraries/core/GUIManager.h
===================================================================
--- code/trunk/src/libraries/core/GUIManager.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/GUIManager.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -127,12 +127,19 @@
inline orxonox::PlayerInfo* getPlayer(const std::string& guiname) const { std::map<std::string, PlayerInfo*>::const_iterator it = this->players_.find(guiname); return (it != this->players_.end()) ? it->second : 0; } // tolua_export
// TODO: Temporary hack because the tolua exported CEGUI method does not seem to work
- static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); //tolua_export
- static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); //tolua_export
- static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); //tolua_export
+ static void subscribeEventHelper(CEGUI::Window* window, const std::string& event, const std::string& function); // tolua_export
+ static void setTooltipTextHelper(CEGUI::ListboxItem* item, const std::string& toooltip); // tolua_export
+ static void setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled); // tolua_export
+ static void addFontHelper(const std::string& name, int size, const std::string& fontName); // tolua_export
static GUIManager& getInstance() { return Singleton<GUIManager>::getInstance(); } // tolua_export
+ /**
+ @brief Check whether CEGUI is version < 0.7.
+ @return Returns true if the CEGUI version is < 0.7. False otherwise.
+ */
+ inline bool usingOldCEGUI(void) { return this->oldCEGUI_; } // tolua_export
+
private:
GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
@@ -184,7 +191,8 @@
// The used CEGUI scheme.
static const std::string defaultScheme_;
std::string guiScheme_;
-
+ bool oldCEGUI_;
+
int numScrollLines_; ///< How many lines to scroll in a list if the scroll wheel is used
}; // tolua_export
Modified: code/trunk/src/libraries/core/Game.cc
===================================================================
--- code/trunk/src/libraries/core/Game.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/Game.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -555,7 +555,7 @@
void Game::loadState(const std::string& name)
{
this->bChangingState_ = true;
- LOKI_ON_BLOCK_EXIT_OBJ(*this, &Game::resetChangingState);
+ LOKI_ON_BLOCK_EXIT_OBJ(*this, &Game::resetChangingState); (void)LOKI_ANONYMOUS_VARIABLE(scopeGuard);
// If state requires graphics, load it
Loki::ScopeGuard graphicsUnloader = Loki::MakeObjGuard(*this, &Game::unloadGraphics);
Modified: code/trunk/src/libraries/core/GraphicsManager.h
===================================================================
--- code/trunk/src/libraries/core/GraphicsManager.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/GraphicsManager.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -108,7 +108,7 @@
// event from Ogre::LogListener
void messageLogged(const std::string& message, Ogre::LogMessageLevel lml,
- bool maskDebug, const std::string& logName);
+ bool maskDebug, const std::string& logName);
// console commands
void printScreen();
Modified: code/trunk/src/libraries/core/Identifier.h
===================================================================
--- code/trunk/src/libraries/core/Identifier.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/Identifier.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -118,7 +118,7 @@
void setName(const std::string& name);
/// Returns the network ID to identify a class through the network.
- inline const uint32_t getNetworkID() const { return this->networkID_; }
+ inline uint32_t getNetworkID() const { return this->networkID_; }
void setNetworkID(uint32_t id);
/// Returns the unique ID of the class.
Modified: code/trunk/src/libraries/core/Super.h
===================================================================
--- code/trunk/src/libraries/core/Super.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/Super.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -99,9 +99,9 @@
SuperFunctionCondition<functionnumber + 1, T, 0, templatehack2>::superCheck(); \
} \
\
- static void apply(void* temp) {} \
+ static void apply(void*) {} \
\
- static void apply(baseclass* temp) \
+ static void apply(baseclass*) \
{ \
ClassIdentifier<T>* identifier = ClassIdentifier<T>::getIdentifier(); \
for (std::set<const Identifier*>::iterator it = identifier->getDirectChildrenIntern().begin(); it != identifier->getDirectChildrenIntern().end(); ++it) \
@@ -311,7 +311,7 @@
template <int functionnumber, class T>
struct SuperFunctionInitialization
{
- static void initialize(ClassIdentifier<T>* identifier) {}
+ static void initialize(ClassIdentifier<T>*) {}
};
/**
@@ -320,7 +320,7 @@
template <int functionnumber, class T>
struct SuperFunctionDestruction
{
- static void destroy(ClassIdentifier<T>* identifier) {}
+ static void destroy(ClassIdentifier<T>*) {}
};
Property changes on: code/trunk/src/libraries/core/ThreadWin.cc
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/libraries/core/command/Functor.h
===================================================================
--- code/trunk/src/libraries/core/command/Functor.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/command/Functor.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -410,29 +410,29 @@
// Helper class, used to call a function-pointer with a given object and parameters and to return its return-value (if available)
template <class R, class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3, param4, param5); } };
- template <class R, class O, bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<R, O, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3, param4); } };
- template <class R, class O, bool isconst, class P1, class P2, class P3> struct FunctorCaller<R, O, isconst, P1, P2, P3, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2, param3); } };
- template <class R, class O, bool isconst, class P1, class P2> struct FunctorCaller<R, O, isconst, P1, P2, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1, param2); } };
- template <class R, class O, bool isconst, class P1> struct FunctorCaller<R, O, isconst, P1, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(param1); } };
- template <class R, class O, bool isconst> struct FunctorCaller<R, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (object->*functionPointer)(); } };
+ template <class R, class O, bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<R, O, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { return (object->*functionPointer)(param1, param2, param3, param4); } };
+ template <class R, class O, bool isconst, class P1, class P2, class P3> struct FunctorCaller<R, O, isconst, P1, P2, P3, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { return (object->*functionPointer)(param1, param2, param3); } };
+ template <class R, class O, bool isconst, class P1, class P2> struct FunctorCaller<R, O, isconst, P1, P2, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(param1, param2); } };
+ template <class R, class O, bool isconst, class P1> struct FunctorCaller<R, O, isconst, P1, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(param1); } };
+ template <class R, class O, bool isconst> struct FunctorCaller<R, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (object->*functionPointer)(); } };
template <class O, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, P5> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, P5>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3, param4, param5); return MT_Type::Null; } };
- template <class O, bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3, param4); return MT_Type::Null; } };
- template <class O, bool isconst, class P1, class P2, class P3> struct FunctorCaller<void, O, isconst, P1, P2, P3, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2, param3); return MT_Type::Null; } };
- template <class O, bool isconst, class P1, class P2> struct FunctorCaller<void, O, isconst, P1, P2, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1, param2); return MT_Type::Null; } };
- template <class O, bool isconst, class P1> struct FunctorCaller<void, O, isconst, P1, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(param1); return MT_Type::Null; } };
- template <class O, bool isconst> struct FunctorCaller<void, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (object->*functionPointer)(); return MT_Type::Null; } };
+ template <class O, bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<void, O, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, P4, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { (object->*functionPointer)(param1, param2, param3, param4); return MT_Type::Null; } };
+ template <class O, bool isconst, class P1, class P2, class P3> struct FunctorCaller<void, O, isconst, P1, P2, P3, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, P3, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { (object->*functionPointer)(param1, param2, param3); return MT_Type::Null; } };
+ template <class O, bool isconst, class P1, class P2> struct FunctorCaller<void, O, isconst, P1, P2, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, P2, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(param1, param2); return MT_Type::Null; } };
+ template <class O, bool isconst, class P1> struct FunctorCaller<void, O, isconst, P1, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, P1, void, void, void, void>::Type functionPointer, O* object, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(param1); return MT_Type::Null; } };
+ template <class O, bool isconst> struct FunctorCaller<void, O, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, O, isconst, void, void, void, void, void>::Type functionPointer, O* object, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (object->*functionPointer)(); return MT_Type::Null; } };
template <class R, bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, P5> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2, param3, param4, param5); } };
- template <class R, bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2, param3, param4); } };
- template <class R, bool isconst, class P1, class P2, class P3> struct FunctorCaller<R, void, isconst, P1, P2, P3, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2, param3); } };
- template <class R, bool isconst, class P1, class P2> struct FunctorCaller<R, void, isconst, P1, P2, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1, param2); } };
- template <class R, bool isconst, class P1> struct FunctorCaller<R, void, isconst, P1, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(param1); } };
- template <class R, bool isconst> struct FunctorCaller<R, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { return (*functionPointer)(); } };
+ template <class R, bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<R, void, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { return (*functionPointer)(param1, param2, param3, param4); } };
+ template <class R, bool isconst, class P1, class P2, class P3> struct FunctorCaller<R, void, isconst, P1, P2, P3, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { return (*functionPointer)(param1, param2, param3); } };
+ template <class R, bool isconst, class P1, class P2> struct FunctorCaller<R, void, isconst, P1, P2, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(param1, param2); } };
+ template <class R, bool isconst, class P1> struct FunctorCaller<R, void, isconst, P1, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(param1); } };
+ template <class R, bool isconst> struct FunctorCaller<R, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<R, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { return (*functionPointer)(); } };
template <bool isconst, class P1, class P2, class P3, class P4, class P5> struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, P5> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, P5>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3, param4, param5); return MT_Type::Null; } };
- template <bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3, param4); return MT_Type::Null; } };
- template <bool isconst, class P1, class P2, class P3> struct FunctorCaller<void, void, isconst, P1, P2, P3, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2, param3); return MT_Type::Null; } };
- template <bool isconst, class P1, class P2> struct FunctorCaller<void, void, isconst, P1, P2, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1, param2); return MT_Type::Null; } };
- template <bool isconst, class P1> struct FunctorCaller<void, void, isconst, P1, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(param1); return MT_Type::Null; } };
- template <bool isconst> struct FunctorCaller<void, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType& param5) { (*functionPointer)(); return MT_Type::Null; } };
+ template <bool isconst, class P1, class P2, class P3, class P4> struct FunctorCaller<void, void, isconst, P1, P2, P3, P4, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, P4, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType& param4, const MultiType&) { (*functionPointer)(param1, param2, param3, param4); return MT_Type::Null; } };
+ template <bool isconst, class P1, class P2, class P3> struct FunctorCaller<void, void, isconst, P1, P2, P3, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, P3, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType& param3, const MultiType&, const MultiType&) { (*functionPointer)(param1, param2, param3); return MT_Type::Null; } };
+ template <bool isconst, class P1, class P2> struct FunctorCaller<void, void, isconst, P1, P2, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, P2, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType& param2, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(param1, param2); return MT_Type::Null; } };
+ template <bool isconst, class P1> struct FunctorCaller<void, void, isconst, P1, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, P1, void, void, void, void>::Type functionPointer, void*, const MultiType& param1, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(param1); return MT_Type::Null; } };
+ template <bool isconst> struct FunctorCaller<void, void, isconst, void, void, void, void, void> { static inline MultiType call(typename detail::FunctionPointer<void, void, isconst, void, void, void, void, void>::Type functionPointer, void*, const MultiType&, const MultiType&, const MultiType&, const MultiType&, const MultiType&) { (*functionPointer)(); return MT_Type::Null; } };
// Helper class, used to identify the header of a function-pointer (independent of its class)
template <class R, class P1, class P2, class P3, class P4, class P5>
Modified: code/trunk/src/libraries/core/command/Shell.cc
===================================================================
--- code/trunk/src/libraries/core/command/Shell.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/core/command/Shell.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -264,7 +264,7 @@
if (command == "")
return;
- size_t previous_offset = mod(this->historyOffset_ - 1, this->maxHistoryLength_);
+ size_t previous_offset = mod(static_cast<int>(this->historyOffset_) - 1, this->maxHistoryLength_);
if (previous_offset < this->commandHistory_.size() && command == this->commandHistory_[previous_offset])
return;
Modified: code/trunk/src/libraries/network/LANDiscovery.cc
===================================================================
--- code/trunk/src/libraries/network/LANDiscovery.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/network/LANDiscovery.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -37,7 +37,7 @@
namespace orxonox
{
- ManageScopedSingleton(LANDiscovery, ScopeID::Root, true);
+ ManageScopedSingleton(LANDiscovery, ScopeID::Graphics, true);
LANDiscovery::LANDiscovery()
{
@@ -48,7 +48,8 @@
LANDiscovery::~LANDiscovery()
{
- enet_host_destroy(this->host_);
+ if (this->host_ != NULL)
+ enet_host_destroy(this->host_);
}
void LANDiscovery::discover()
Modified: code/trunk/src/libraries/network/Server.cc
===================================================================
--- code/trunk/src/libraries/network/Server.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/network/Server.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -412,7 +412,7 @@
GamestateManager::setSynched(clientID);
COUT(4) << "sending welcome" << std::endl;
- packet::Welcome *w = new packet::Welcome(clientID, OBJECTID_UNKNOWN);
+ packet::Welcome *w = new packet::Welcome(clientID);
w->setPeerID(clientID);
b = w->send( static_cast<Host*>(this) );
assert(b);
Modified: code/trunk/src/libraries/network/packet/Welcome.cc
===================================================================
--- code/trunk/src/libraries/network/packet/Welcome.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/network/packet/Welcome.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -43,7 +43,7 @@
#define _CLIENTID _PACKETID + sizeof(Type::Value)
#define _ENDIANTEST _CLIENTID + sizeof(uint32_t)
- Welcome::Welcome( uint32_t clientID, uint32_t shipID )
+ Welcome::Welcome( uint32_t clientID )
: Packet()
{
flags_ = flags_ | PACKET_FLAGS_CLASSID;
Modified: code/trunk/src/libraries/network/packet/Welcome.h
===================================================================
--- code/trunk/src/libraries/network/packet/Welcome.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/network/packet/Welcome.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -40,7 +40,7 @@
class _NetworkExport Welcome : public Packet
{
public:
- Welcome( uint32_t clientID, uint32_t shipID );
+ Welcome( uint32_t clientID );
Welcome( uint8_t* data, uint32_t clientID );
virtual ~Welcome();
Modified: code/trunk/src/libraries/network/synchronisable/Serialise.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Serialise.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/network/synchronisable/Serialise.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -83,7 +83,7 @@
// These functions implement loading / saving / etc. for SmartPtr<T>
/** @brief returns the size of the objectID needed to synchronise the pointer */
- template <class T> inline uint32_t returnSize( const SmartPtr<T>& variable )
+ template <class T> inline uint32_t returnSize( const SmartPtr<T>& )
{
return sizeof(uint32_t);
}
Modified: code/trunk/src/libraries/network/synchronisable/Synchronisable.cc
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Synchronisable.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/network/synchronisable/Synchronisable.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -382,7 +382,6 @@
/**
* This function determines, wheter the object should be saved to the bytestream (according to its syncmode/direction)
- * @param id gamestate id
* @param mode Synchronisation mode (toclient, toserver or bidirectional)
* @return true/false
*/
@@ -396,7 +395,6 @@
/**
* This function determines, wheter the object should accept data from the bytestream (according to its syncmode/direction)
- * @param id gamestate id
* @param mode Synchronisation mode (toclient, toserver or bidirectional)
* @return true/false
*/
Modified: code/trunk/src/libraries/network/synchronisable/Synchronisable.h
===================================================================
--- code/trunk/src/libraries/network/synchronisable/Synchronisable.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/network/synchronisable/Synchronisable.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -49,6 +49,7 @@
namespace ObjectDirection{
enum Value{
+ None=0x0,
ToClient=0x1,
ToServer=0x2,
Bidirectional=0x3
Modified: code/trunk/src/libraries/util/Convert.h
===================================================================
--- code/trunk/src/libraries/util/Convert.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/util/Convert.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -142,7 +142,7 @@
template <class FromType, class ToType>
struct ConverterFallback
{
- ORX_FORCEINLINE static bool convert(ToType* output, const FromType& input)
+ ORX_FORCEINLINE static bool convert(ToType* /*output*/, const FromType& /*input*/)
{
COUT(2) << "Could not convert value of type " << typeid(FromType).name()
<< " to type " << typeid(ToType).name() << std::endl;
Modified: code/trunk/src/libraries/util/Exception.h
===================================================================
--- code/trunk/src/libraries/util/Exception.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/util/Exception.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -109,7 +109,7 @@
//! Returns the short developer written exception
virtual const std::string& getDescription() const { return this->description_; }
//! Returns the line number on which the exception occurred.
- virtual const unsigned int getLineNumber() const { return this->lineNumber_; }
+ virtual unsigned int getLineNumber() const { return this->lineNumber_; }
//! Returns the function in which the exception occurred.
virtual const std::string& getFunctionName() const { return this->functionName_; }
//! Returns the filename in which the exception occurred.
Modified: code/trunk/src/libraries/util/Math.h
===================================================================
--- code/trunk/src/libraries/util/Math.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/util/Math.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -173,7 +173,10 @@
if (x >= 0)
return (x % max);
else
- return ((x % max) + max);
+ {
+ T temp = x % max;
+ return (temp < 0) ? (temp + max) : temp;
+ }
}
/**
Modified: code/trunk/src/libraries/util/MultiTypeValue.h
===================================================================
--- code/trunk/src/libraries/util/MultiTypeValue.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/util/MultiTypeValue.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -254,11 +254,11 @@
{
return 4*returnSize(this->value_.x);
}
- template <> inline void MT_Value<void*>::importData( uint8_t*& mem )
+ template <> inline void MT_Value<void*>::importData( uint8_t*& /*mem*/ )
{
assert(0);
}
- template <> inline void MT_Value<void*>::exportData( uint8_t*& mem ) const
+ template <> inline void MT_Value<void*>::exportData( uint8_t*& /*mem*/ ) const
{
assert(0);
}
Modified: code/trunk/src/libraries/util/ScopedSingletonManager.h
===================================================================
--- code/trunk/src/libraries/util/ScopedSingletonManager.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/util/ScopedSingletonManager.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -246,12 +246,12 @@
}
//! Destroys the singleton instance - overloaded for OrxonoxClass, calls OrxonoxClass::destroy()
- void destroy(OrxonoxClass* ptr)
+ void destroy(OrxonoxClass*)
{
singletonPtr_->destroy();
}
//! Destroys the singleton instance - overloaded for void*, calls delete
- void destroy(void* ptr)
+ void destroy(void*)
{
delete singletonPtr_;
}
Modified: code/trunk/src/libraries/util/Serialise.h
===================================================================
--- code/trunk/src/libraries/util/Serialise.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/util/Serialise.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -86,7 +86,7 @@
// =========== bool
- template <> inline uint32_t returnSize( const bool& variable )
+ template <> inline uint32_t returnSize( const bool& )
{
return sizeof(uint8_t);
}
@@ -110,7 +110,7 @@
// =========== char
- template <> inline uint32_t returnSize( const char& variable )
+ template <> inline uint32_t returnSize( const char& )
{
return sizeof(uint8_t);
}
@@ -134,7 +134,7 @@
// =========== unsigned char
- template <> inline uint32_t returnSize( const unsigned char& variable )
+ template <> inline uint32_t returnSize( const unsigned char& )
{
return sizeof(uint8_t);
}
@@ -158,7 +158,7 @@
// =========== short
- template <> inline uint32_t returnSize( const short& variable )
+ template <> inline uint32_t returnSize( const short& )
{
return sizeof(int16_t);
}
@@ -182,7 +182,7 @@
// =========== unsigned short
- template <> inline uint32_t returnSize( const unsigned short& variable )
+ template <> inline uint32_t returnSize( const unsigned short& )
{
return sizeof(uint16_t);
}
@@ -206,7 +206,7 @@
// =========== int
- template <> inline uint32_t returnSize( const int& variable )
+ template <> inline uint32_t returnSize( const int& )
{
return sizeof(int32_t);
}
@@ -230,7 +230,7 @@
// =========== unsigned int
- template <> inline uint32_t returnSize( const unsigned int& variable )
+ template <> inline uint32_t returnSize( const unsigned int& )
{
return sizeof(uint32_t);
}
@@ -254,7 +254,7 @@
// =========== long
- template <> inline uint32_t returnSize( const long& variable )
+ template <> inline uint32_t returnSize( const long& )
{
return sizeof(int32_t);
}
@@ -278,7 +278,7 @@
// =========== unsigned long
- template <> inline uint32_t returnSize( const unsigned long& variable )
+ template <> inline uint32_t returnSize( const unsigned long& )
{
return sizeof(uint32_t);
}
@@ -302,7 +302,7 @@
// =========== long long
- template <> inline uint32_t returnSize( const long long& variable )
+ template <> inline uint32_t returnSize( const long long& )
{
return sizeof(int64_t);
}
@@ -326,7 +326,7 @@
// =========== unsigned long long
- template <> inline uint32_t returnSize( const unsigned long long& variable )
+ template <> inline uint32_t returnSize( const unsigned long long& )
{
return sizeof(uint64_t);
}
@@ -350,7 +350,7 @@
// =========== float
- template <> inline uint32_t returnSize( const float& variable )
+ template <> inline uint32_t returnSize( const float& )
{
return sizeof(uint32_t);
}
@@ -374,7 +374,7 @@
// =========== double
- template <> inline uint32_t returnSize( const double& variable )
+ template <> inline uint32_t returnSize( const double& )
{
return sizeof(uint64_t);
}
@@ -398,7 +398,7 @@
// =========== long double
- template <> inline uint32_t returnSize( const long double& variable )
+ template <> inline uint32_t returnSize( const long double& )
{
return sizeof(uint64_t);
}
@@ -451,7 +451,7 @@
// =========== Degree
- template <> inline uint32_t returnSize( const Degree& variable )
+ template <> inline uint32_t returnSize( const Degree& )
{
return sizeof(Ogre::Real);
}
@@ -478,7 +478,7 @@
// =========== Radian
- template <> inline uint32_t returnSize( const Radian& variable )
+ template <> inline uint32_t returnSize( const Radian& )
{
return sizeof(Ogre::Real);
}
Modified: code/trunk/src/libraries/util/SubString.h
===================================================================
--- code/trunk/src/libraries/util/SubString.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/libraries/util/SubString.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -109,7 +109,7 @@
SL_SAFEESCAPE, //!< In safe mode with the internal escape character, that escapes even the savemode character.
SL_COMMENT, //!< In Comment mode.
SL_PARENTHESES, //!< Between parentheses (usually '{' and '}')
- SL_PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing paranthesis character.
+ SL_PARENTHESESESCAPE, //!< Between parentheses with the internal escape character, that escapes even the closing parenthesis character.
};
public:
@@ -168,7 +168,7 @@
inline bool empty() const { return this->tokens_.empty(); }
/// Returns the number of tokens stored in this SubString
inline unsigned int size() const { return this->tokens_.size(); }
- /// Returns the i'th token from the subset of strings @param index The index of the requested doken
+ /// Returns the i'th token from the subset of strings @param index The index of the requested token
inline const std::string& operator[](unsigned int index) const { return this->tokens_[index]; }
/// Returns the i'th token from the subset of strings @param index The index of the requested token
inline const std::string& getString(unsigned int index) const { return (*this)[index]; }
@@ -208,7 +208,7 @@
char commentChar = '\0',
SPLIT_LINE_STATE start_state = SL_NORMAL);
- std::vector<std::string> tokens_; ///< The tokens after spliting the input line
+ std::vector<std::string> tokens_; ///< The tokens after splitting the input line
std::vector<bool> bTokenInSafemode_; ///< Saves for each token if it was in safe mode (between quotation marks or parenthesis)
};
}
Modified: code/trunk/src/modules/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,6 +26,7 @@
################ Sub Directories ################
ADD_SUBDIRECTORY(designtools)
+ADD_SUBDIRECTORY(gametypes)
ADD_SUBDIRECTORY(notifications)
ADD_SUBDIRECTORY(objects)
ADD_SUBDIRECTORY(overlays)
@@ -33,4 +34,6 @@
ADD_SUBDIRECTORY(pong)
ADD_SUBDIRECTORY(portals)
ADD_SUBDIRECTORY(questsystem)
+ADD_SUBDIRECTORY(tetris)
ADD_SUBDIRECTORY(weapons)
+ADD_SUBDIRECTORY(docking)
Deleted: code/trunk/src/modules/docking/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/modules/docking/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,21 +0,0 @@
-SET_SOURCE_FILES(DOCKING_SRC_FILES
- DockingTarget.cc
- DockingEffect.cc
- DockingAnimation.cc
- DockToShip.cc
- MoveToDockingTarget.cc
- DockingController.cc
- Dock.cc
-)
-
-ORXONOX_ADD_LIBRARY(docking
- MODULE
- FIND_HEADER_FILES
- TOLUA_FILES
- Dock.h
- PCH_FILE
- DockingPrecompiledHeaders.h
- LINK_LIBRARIES
- orxonox
- SOURCE_FILES ${DOCKING_SRC_FILES}
-)
Copied: code/trunk/src/modules/docking/CMakeLists.txt (from rev 8705, code/branches/presentation/src/modules/docking/CMakeLists.txt)
===================================================================
--- code/trunk/src/modules/docking/CMakeLists.txt (rev 0)
+++ code/trunk/src/modules/docking/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,21 @@
+SET_SOURCE_FILES(DOCKING_SRC_FILES
+ DockingTarget.cc
+ DockingEffect.cc
+ DockingAnimation.cc
+ DockToShip.cc
+ MoveToDockingTarget.cc
+ DockingController.cc
+ Dock.cc
+)
+
+ORXONOX_ADD_LIBRARY(docking
+ MODULE
+ FIND_HEADER_FILES
+ TOLUA_FILES
+ Dock.h
+ PCH_FILE
+ DockingPrecompiledHeaders.h
+ LINK_LIBRARIES
+ orxonox
+ SOURCE_FILES ${DOCKING_SRC_FILES}
+)
Deleted: code/trunk/src/modules/docking/Dock.cc
===================================================================
--- code/branches/presentation/src/modules/docking/Dock.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/Dock.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,292 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file Dock.cc
- @brief Docking system main class
-*/
-
-#include "Dock.h"
-
-#include "core/CoreIncludes.h"
-#include "core/LuaState.h"
-#include "core/GUIManager.h"
-#include "core/command/ConsoleCommand.h"
-#include "network/NetworkFunction.h"
-
-#include "infos/HumanPlayer.h"
-#include "interfaces/PlayerTrigger.h"
-#include "worldentities/pawns/Pawn.h"
-
-#include "ToluaBindDocking.h"
-
-namespace orxonox
-{
- // Register tolua_open function when loading the library
- DeclareToluaInterface(Docking);
-
- CreateFactory(Dock);
-
- SetConsoleCommand("Dock", "dock", &Dock::cmdDock).addShortcut().setAsInputCommand();
- SetConsoleCommand("Dock", "undock", &Dock::cmdUndock).addShortcut().setAsInputCommand();
-
- registerStaticNetworkFunction(Dock::showDockingDialog);
-
- Dock::Dock(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(Dock);
- }
-
- Dock::~Dock()
- {
- }
-
- void Dock::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Dock, XMLPort, xmlelement, mode);
-
- XMLPortObject(Dock, DockingEffect, "effects", addEffect, getEffect, xmlelement, mode);
- XMLPortObject(Dock, DockingAnimation, "animations", addAnimation, getAnimation, xmlelement, mode);
- XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
- }
-
- void Dock::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(Dock, XMLEventPort, xmlelement, mode);
-
- XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
- }
-
- bool Dock::execute(bool bTriggered, BaseObject* trigger)
- {
- PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
- PlayerInfo* player = NULL;
-
- // Check whether it is a player trigger and extract pawn from it
- if(pTrigger != NULL)
- {
- if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
- COUT(4) << "Docking:execute PlayerTrigger was not triggered by a player.." << std::endl;
- return false;
- }
- player = pTrigger->getTriggeringPlayer();
- }
- else
- {
- COUT(4) << "Docking::execute Not a player trigger, can't extract pawn from it.." << std::endl;
- return false;
- }
- if(player == NULL)
- {
- COUT(4) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
- return false;
- }
-
- if(bTriggered)
- {
- // Add player to this Docks candidates
- candidates_.insert(player);
-
- // Show docking dialog
- this->showDockingDialogHelper(player);
- }
- else
- {
- // Remove player from candidates list
- candidates_.erase(player);
- }
-
- return true;
- }
-
- void Dock::showDockingDialogHelper(PlayerInfo* player)
- {
- assert(player);
-
- if(!player->isHumanPlayer())
- return;
-
- if(GameMode::isMaster())
- {
- if(GameMode::showsGraphics())
- GUIManager::showGUI("DockingDialog");
- }
- else
- callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
-
- }
-
- /*static*/ void Dock::showDockingDialog()
- {
- if(GameMode::showsGraphics())
- GUIManager::showGUI("DockingDialog");
- }
-
- void Dock::cmdDock()
- {
- PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
- for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
- {
- if(it->dock(player))
- break;
- }
- }
-
- void Dock::cmdUndock()
- {
- PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
- for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
- {
- if(it->undock(player))
- break;
- }
- }
-
- bool Dock::dock(PlayerInfo* player)
- {
- // Check if player is a candidate
- if(candidates_.find(player) == candidates_.end())
- {
- COUT(2) << "Dock::dock Player is not a candidate!" << std::endl;
- return false;
- }
-
- candidates_.erase(player);
- docked_.insert(player);
-
- if (animations_.empty())
- return dockingAnimationFinished(player);
- else
- DockingAnimation::invokeAnimation(true, player, animations_);
-
- return true;
- }
-
- bool Dock::dockingAnimationFinished(PlayerInfo* player)
- {
- if(docked_.find(player) == docked_.end())
- {
- COUT(2) << "Dock::dockingAnimationFinished Player is not currently docked." << std::endl;
- return false;
- }
-
- DockingEffect::invokeEffect(true, player, effects_);
- return true;
- }
-
- bool Dock::undock(PlayerInfo* player)
- {
- // Check if player is docked to this Dock
- if(docked_.find(player) == docked_.end())
- {
- COUT(2) << "Dock::undock Player is not docked to this Dock." << std::endl;
- return false;
- }
-
- docked_.erase(player);
- candidates_.insert(player);
-
- DockingEffect::invokeEffect(false, player, effects_);
-
- if (animations_.empty())
- return undockingAnimationFinished(player);
- else
- DockingAnimation::invokeAnimation(false, player, animations_);
-
- return true;
- }
-
- bool Dock::undockingAnimationFinished(PlayerInfo* player) {
- COUT(4) << "Dock::undockingAnimationFinished executed" << std::endl;
- return true;
- }
-
- unsigned int Dock::getNumberOfActiveDocks()
- {
- int i = 0;
- PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
- for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
- {
- if(it->candidates_.find(player) != it->candidates_.end())
- i++;
- }
- return i;
- }
-
- Dock* Dock::getActiveDockAtIndex(unsigned int index)
- {
- PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
- for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
- {
- if(it->candidates_.find(player) != it->candidates_.end())
- {
- if(index == 0)
- return *it;
- index--;
- }
- }
- return NULL;
- }
-
- bool Dock::addEffect(DockingEffect* effect)
- {
- assert(effect);
- effects_.push_back(effect);
- return true;
- }
-
- const DockingEffect* Dock::getEffect(unsigned int i) const
- {
- for (std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
- {
- if(i == 0)
- return *effect;
- i--;
- }
- return NULL;
- }
-
- bool Dock::addAnimation(DockingAnimation* animation)
- {
- assert(animation);
- animation->setParent(this);
- animations_.push_back(animation);
- return true;
- }
-
- const DockingAnimation* Dock::getAnimation(unsigned int i) const
- {
- for (std::list<DockingAnimation*>::const_iterator animation = this->animations_.begin(); animation != this->animations_.end(); ++animation)
- {
- if(i == 0)
- return *animation;
- i--;
- }
- return NULL;
- }
-}
Copied: code/trunk/src/modules/docking/Dock.cc (from rev 8705, code/branches/presentation/src/modules/docking/Dock.cc)
===================================================================
--- code/trunk/src/modules/docking/Dock.cc (rev 0)
+++ code/trunk/src/modules/docking/Dock.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,292 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Dock.cc
+ @brief Docking system main class
+*/
+
+#include "Dock.h"
+
+#include "core/CoreIncludes.h"
+#include "core/LuaState.h"
+#include "core/GUIManager.h"
+#include "core/command/ConsoleCommand.h"
+#include "network/NetworkFunction.h"
+
+#include "infos/HumanPlayer.h"
+#include "interfaces/PlayerTrigger.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include "ToluaBindDocking.h"
+
+namespace orxonox
+{
+ // Register tolua_open function when loading the library
+ DeclareToluaInterface(Docking);
+
+ CreateFactory(Dock);
+
+ SetConsoleCommand("Dock", "dock", &Dock::cmdDock).addShortcut().setAsInputCommand();
+ SetConsoleCommand("Dock", "undock", &Dock::cmdUndock).addShortcut().setAsInputCommand();
+
+ registerStaticNetworkFunction(Dock::showDockingDialog);
+
+ Dock::Dock(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(Dock);
+ }
+
+ Dock::~Dock()
+ {
+ }
+
+ void Dock::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Dock, XMLPort, xmlelement, mode);
+
+ XMLPortObject(Dock, DockingEffect, "effects", addEffect, getEffect, xmlelement, mode);
+ XMLPortObject(Dock, DockingAnimation, "animations", addAnimation, getAnimation, xmlelement, mode);
+ XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
+ }
+
+ void Dock::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(Dock, XMLEventPort, xmlelement, mode);
+
+ XMLPortEventSink(Dock, BaseObject, "execute", execute, xmlelement, mode);
+ }
+
+ bool Dock::execute(bool bTriggered, BaseObject* trigger)
+ {
+ PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
+ PlayerInfo* player = NULL;
+
+ // Check whether it is a player trigger and extract pawn from it
+ if(pTrigger != NULL)
+ {
+ if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
+ COUT(4) << "Docking:execute PlayerTrigger was not triggered by a player.." << std::endl;
+ return false;
+ }
+ player = pTrigger->getTriggeringPlayer();
+ }
+ else
+ {
+ COUT(4) << "Docking::execute Not a player trigger, can't extract pawn from it.." << std::endl;
+ return false;
+ }
+ if(player == NULL)
+ {
+ COUT(4) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
+ return false;
+ }
+
+ if(bTriggered)
+ {
+ // Add player to this Docks candidates
+ candidates_.insert(player);
+
+ // Show docking dialog
+ this->showDockingDialogHelper(player);
+ }
+ else
+ {
+ // Remove player from candidates list
+ candidates_.erase(player);
+ }
+
+ return true;
+ }
+
+ void Dock::showDockingDialogHelper(PlayerInfo* player)
+ {
+ assert(player);
+
+ if(!player->isHumanPlayer())
+ return;
+
+ if(GameMode::isMaster())
+ {
+ if(GameMode::showsGraphics())
+ GUIManager::showGUI("DockingDialog");
+ }
+ else
+ callStaticNetworkFunction(Dock::showDockingDialog, player->getClientID());
+
+ }
+
+ /*static*/ void Dock::showDockingDialog()
+ {
+ if(GameMode::showsGraphics())
+ GUIManager::showGUI("DockingDialog");
+ }
+
+ void Dock::cmdDock()
+ {
+ PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
+ for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
+ {
+ if(it->dock(player))
+ break;
+ }
+ }
+
+ void Dock::cmdUndock()
+ {
+ PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
+ for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
+ {
+ if(it->undock(player))
+ break;
+ }
+ }
+
+ bool Dock::dock(PlayerInfo* player)
+ {
+ // Check if player is a candidate
+ if(candidates_.find(player) == candidates_.end())
+ {
+ COUT(2) << "Dock::dock Player is not a candidate!" << std::endl;
+ return false;
+ }
+
+ candidates_.erase(player);
+ docked_.insert(player);
+
+ if (animations_.empty())
+ return dockingAnimationFinished(player);
+ else
+ DockingAnimation::invokeAnimation(true, player, animations_);
+
+ return true;
+ }
+
+ bool Dock::dockingAnimationFinished(PlayerInfo* player)
+ {
+ if(docked_.find(player) == docked_.end())
+ {
+ COUT(2) << "Dock::dockingAnimationFinished Player is not currently docked." << std::endl;
+ return false;
+ }
+
+ DockingEffect::invokeEffect(true, player, effects_);
+ return true;
+ }
+
+ bool Dock::undock(PlayerInfo* player)
+ {
+ // Check if player is docked to this Dock
+ if(docked_.find(player) == docked_.end())
+ {
+ COUT(2) << "Dock::undock Player is not docked to this Dock." << std::endl;
+ return false;
+ }
+
+ docked_.erase(player);
+ candidates_.insert(player);
+
+ DockingEffect::invokeEffect(false, player, effects_);
+
+ if (animations_.empty())
+ return undockingAnimationFinished(player);
+ else
+ DockingAnimation::invokeAnimation(false, player, animations_);
+
+ return true;
+ }
+
+ bool Dock::undockingAnimationFinished(PlayerInfo* player) {
+ COUT(4) << "Dock::undockingAnimationFinished executed" << std::endl;
+ return true;
+ }
+
+ unsigned int Dock::getNumberOfActiveDocks()
+ {
+ int i = 0;
+ PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
+ for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
+ {
+ if(it->candidates_.find(player) != it->candidates_.end())
+ i++;
+ }
+ return i;
+ }
+
+ Dock* Dock::getActiveDockAtIndex(unsigned int index)
+ {
+ PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer();
+ for(ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)
+ {
+ if(it->candidates_.find(player) != it->candidates_.end())
+ {
+ if(index == 0)
+ return *it;
+ index--;
+ }
+ }
+ return NULL;
+ }
+
+ bool Dock::addEffect(DockingEffect* effect)
+ {
+ assert(effect);
+ effects_.push_back(effect);
+ return true;
+ }
+
+ const DockingEffect* Dock::getEffect(unsigned int i) const
+ {
+ for (std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)
+ {
+ if(i == 0)
+ return *effect;
+ i--;
+ }
+ return NULL;
+ }
+
+ bool Dock::addAnimation(DockingAnimation* animation)
+ {
+ assert(animation);
+ animation->setParent(this);
+ animations_.push_back(animation);
+ return true;
+ }
+
+ const DockingAnimation* Dock::getAnimation(unsigned int i) const
+ {
+ for (std::list<DockingAnimation*>::const_iterator animation = this->animations_.begin(); animation != this->animations_.end(); ++animation)
+ {
+ if(i == 0)
+ return *animation;
+ i--;
+ }
+ return NULL;
+ }
+}
Deleted: code/trunk/src/modules/docking/Dock.h
===================================================================
--- code/branches/presentation/src/modules/docking/Dock.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/Dock.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,109 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file Dock.h
- @brief Definition of Dock class
- @ingroup Docking
-*/
-
-#ifndef _Dock_H__
-#define _Dock_H__
-
-#include "DockingPrereqs.h"
-
-#include <set>
-
-#include "core/CoreIncludes.h"
-#include "core/EventIncludes.h"
-#include "core/XMLPort.h"
-
-#include "controllers/HumanController.h"
-
-#include "DockingAnimation.h"
-#include "DockingEffect.h"
-
-#include "worldentities/StaticEntity.h"
-
-namespace orxonox // tolua_export
-{ // tolua_export
-
- class _DockingExport Dock // tolua_export
- : public StaticEntity
- { // tolua_export
- public:
- Dock(BaseObject* creator);
- virtual ~Dock();
-
- // Trigger interface
- bool execute(bool bTriggered, BaseObject* trigger);
-
- // XML interface
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
-
- // XML functions
- bool addEffect(DockingEffect* effect); //!< Add a DockingEffect to the Dock.
- const DockingEffect* getEffect(unsigned int index) const; //!< Get the DockingEffect at a given index.
- bool addAnimation(DockingAnimation* animation); //!< Add a DockingAnimation to the Dock.
- const DockingAnimation* getAnimation(unsigned int index) const; //!< Get the DockingAnimation at a given index.
-
- // Docking/undocking logic, checks conditions and invokes the DockingAnimations
- bool dock(PlayerInfo* player); //!< Returns true if given player docked successfully (player must be a candidate)
- bool undock(PlayerInfo* player); //!< Undocks a player (player must be docked)
-
- // Animation logic
- bool dockingAnimationFinished(PlayerInfo* player); //!< Called when a docking animation finished
- bool undockingAnimationFinished(PlayerInfo* player); //!< Called when a undocking animation finished
-
- // LUA interface
- // tolua_begin
- void dock()
- { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); }
- static unsigned int getNumberOfActiveDocks();
- static Dock* getActiveDockAtIndex(unsigned int index);
- // tolua_end
-
- // Console commands
- static void cmdDock();
- static void cmdUndock();
-
- // Network functions
- void showDockingDialogHelper(PlayerInfo* player);
- static void showDockingDialog();
-
- private:
- std::set<PlayerInfo*> candidates_; //!< A set of all players which are allowed to dock using the console command.
- std::set<PlayerInfo*> docked_; //!< A set of all docked players
-
- std::list<DockingEffect*> effects_; //!< The list of DockingEffects to be executed when a player docks.
- std::list<DockingAnimation*> animations_; //!< The list of DockingAnimations to be executed before a player docks
- }; // tolua_export
-} // tolua_export
-
-#endif /* _Dock_H__ */
Copied: code/trunk/src/modules/docking/Dock.h (from rev 8705, code/branches/presentation/src/modules/docking/Dock.h)
===================================================================
--- code/trunk/src/modules/docking/Dock.h (rev 0)
+++ code/trunk/src/modules/docking/Dock.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,109 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Dock.h
+ @brief Definition of Dock class
+ @ingroup Docking
+*/
+
+#ifndef _Dock_H__
+#define _Dock_H__
+
+#include "DockingPrereqs.h"
+
+#include <set>
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/XMLPort.h"
+
+#include "controllers/HumanController.h"
+
+#include "DockingAnimation.h"
+#include "DockingEffect.h"
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox // tolua_export
+{ // tolua_export
+
+ class _DockingExport Dock // tolua_export
+ : public StaticEntity
+ { // tolua_export
+ public:
+ Dock(BaseObject* creator);
+ virtual ~Dock();
+
+ // Trigger interface
+ bool execute(bool bTriggered, BaseObject* trigger);
+
+ // XML interface
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+
+ // XML functions
+ bool addEffect(DockingEffect* effect); //!< Add a DockingEffect to the Dock.
+ const DockingEffect* getEffect(unsigned int index) const; //!< Get the DockingEffect at a given index.
+ bool addAnimation(DockingAnimation* animation); //!< Add a DockingAnimation to the Dock.
+ const DockingAnimation* getAnimation(unsigned int index) const; //!< Get the DockingAnimation at a given index.
+
+ // Docking/undocking logic, checks conditions and invokes the DockingAnimations
+ bool dock(PlayerInfo* player); //!< Returns true if given player docked successfully (player must be a candidate)
+ bool undock(PlayerInfo* player); //!< Undocks a player (player must be docked)
+
+ // Animation logic
+ bool dockingAnimationFinished(PlayerInfo* player); //!< Called when a docking animation finished
+ bool undockingAnimationFinished(PlayerInfo* player); //!< Called when a undocking animation finished
+
+ // LUA interface
+ // tolua_begin
+ void dock()
+ { this->dock(HumanController::getLocalControllerSingleton()->getPlayer()); }
+ static unsigned int getNumberOfActiveDocks();
+ static Dock* getActiveDockAtIndex(unsigned int index);
+ // tolua_end
+
+ // Console commands
+ static void cmdDock();
+ static void cmdUndock();
+
+ // Network functions
+ void showDockingDialogHelper(PlayerInfo* player);
+ static void showDockingDialog();
+
+ private:
+ std::set<PlayerInfo*> candidates_; //!< A set of all players which are allowed to dock using the console command.
+ std::set<PlayerInfo*> docked_; //!< A set of all docked players
+
+ std::list<DockingEffect*> effects_; //!< The list of DockingEffects to be executed when a player docks.
+ std::list<DockingAnimation*> animations_; //!< The list of DockingAnimations to be executed before a player docks
+ }; // tolua_export
+} // tolua_export
+
+#endif /* _Dock_H__ */
Deleted: code/trunk/src/modules/docking/DockToShip.cc
===================================================================
--- code/branches/presentation/src/modules/docking/DockToShip.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockToShip.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,101 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DockToShip.cc
- @brief Implementation of the DockToShip class.
-*/
-
-#include "DockingEffect.h"
-#include "DockToShip.h"
-#include "core/CoreIncludes.h"
-
-namespace orxonox
-{
- CreateFactory(DockToShip);
-
- DockToShip::DockToShip(BaseObject* creator) : DockingEffect(creator)
- {
- RegisterObject(DockToShip);
- COUT(4) << "DockToShip instance created.." << endl;
- }
-
- DockToShip::~DockToShip()
- {
-
- }
-
-
- void DockToShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) {
- SUPER(DockToShip, XMLPort, xmlelement, mode);
-
- XMLPortParam(DockToShip, "target", setTargetId, getTargetId, xmlelement, mode);
- }
-
- void DockToShip::setTargetId(const std::string& str) {
- this->target_ = str;
- }
-
- const std::string& DockToShip::getTargetId() const {
- return this->target_;
- }
-
-
- bool DockToShip::docking(PlayerInfo* player)
- {
- COUT(4) << "DockToShip::attach" << endl;
-
- DockingTarget *target = DockingEffect::findTarget(this->target_);
- if (target == NULL) {
- COUT(0) << "Can't retrieve target for '" << this->target_ << "'.." << std::endl;
- return false;
- }
-
- ControllableEntity *dockTo = (ControllableEntity*) target->getParent();
- if (dockTo == NULL) {
- COUT(2) << "Parent is not a ControllableEntity.." << std::endl;
- return false;
- }
-
- // Make sure target isn't removed when undocking
- dockTo->setDestroyWhenPlayerLeft(false);
- player->startTemporaryControl(dockTo);
-
- return true;
- }
-
- bool DockToShip::release(PlayerInfo* player)
- {
- COUT(4) << "DockToShip::release" << endl;
-
- player->stopTemporaryControl();
-
- return true;
- }
-}
-
Copied: code/trunk/src/modules/docking/DockToShip.cc (from rev 8705, code/branches/presentation/src/modules/docking/DockToShip.cc)
===================================================================
--- code/trunk/src/modules/docking/DockToShip.cc (rev 0)
+++ code/trunk/src/modules/docking/DockToShip.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,101 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DockToShip.cc
+ @brief Implementation of the DockToShip class.
+*/
+
+#include "DockingEffect.h"
+#include "DockToShip.h"
+#include "core/CoreIncludes.h"
+
+namespace orxonox
+{
+ CreateFactory(DockToShip);
+
+ DockToShip::DockToShip(BaseObject* creator) : DockingEffect(creator)
+ {
+ RegisterObject(DockToShip);
+ COUT(4) << "DockToShip instance created.." << endl;
+ }
+
+ DockToShip::~DockToShip()
+ {
+
+ }
+
+
+ void DockToShip::XMLPort(Element& xmlelement, XMLPort::Mode mode) {
+ SUPER(DockToShip, XMLPort, xmlelement, mode);
+
+ XMLPortParam(DockToShip, "target", setTargetId, getTargetId, xmlelement, mode);
+ }
+
+ void DockToShip::setTargetId(const std::string& str) {
+ this->target_ = str;
+ }
+
+ const std::string& DockToShip::getTargetId() const {
+ return this->target_;
+ }
+
+
+ bool DockToShip::docking(PlayerInfo* player)
+ {
+ COUT(4) << "DockToShip::attach" << endl;
+
+ DockingTarget *target = DockingEffect::findTarget(this->target_);
+ if (target == NULL) {
+ COUT(0) << "Can't retrieve target for '" << this->target_ << "'.." << std::endl;
+ return false;
+ }
+
+ ControllableEntity *dockTo = (ControllableEntity*) target->getParent();
+ if (dockTo == NULL) {
+ COUT(2) << "Parent is not a ControllableEntity.." << std::endl;
+ return false;
+ }
+
+ // Make sure target isn't removed when undocking
+ dockTo->setDestroyWhenPlayerLeft(false);
+ player->startTemporaryControl(dockTo);
+
+ return true;
+ }
+
+ bool DockToShip::release(PlayerInfo* player)
+ {
+ COUT(4) << "DockToShip::release" << endl;
+
+ player->stopTemporaryControl();
+
+ return true;
+ }
+}
+
Deleted: code/trunk/src/modules/docking/DockToShip.h
===================================================================
--- code/branches/presentation/src/modules/docking/DockToShip.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockToShip.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,74 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DockToShip.h
- @brief DockingEffect which transfers control from spaceship to docked ship ASDF
- @ingroup Docking
-*/
-
-#ifndef _DockToShip_H__
-#define _DockToShip_H__
-
-#include "DockingPrereqs.h"
-#include "DockToShip.h"
-
-#include "worldentities/ControllableEntity.h"
-
-
-namespace orxonox
-{
-
- /**
- @brief
- Allows players to dock onto a ship
-
- @author
- Sven Stucki
-
- @ingroup Docking
- */
- class _DockingExport DockToShip : public DockingEffect
- {
- public:
- DockToShip(BaseObject* creator);
- virtual ~DockToShip();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- void setTargetId(const std::string& str);
- const std::string& getTargetId() const;
-
- virtual bool docking(PlayerInfo* player); //!< Called when docking starts
- virtual bool release(PlayerInfo* player); //!< Called when player wants undock
- private:
- std::string target_;
- };
-
-}
-
-#endif /* _DockToShip_H__ */
Copied: code/trunk/src/modules/docking/DockToShip.h (from rev 8705, code/branches/presentation/src/modules/docking/DockToShip.h)
===================================================================
--- code/trunk/src/modules/docking/DockToShip.h (rev 0)
+++ code/trunk/src/modules/docking/DockToShip.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,74 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DockToShip.h
+ @brief DockingEffect which transfers control from spaceship to docked ship ASDF
+ @ingroup Docking
+*/
+
+#ifndef _DockToShip_H__
+#define _DockToShip_H__
+
+#include "DockingPrereqs.h"
+#include "DockToShip.h"
+
+#include "worldentities/ControllableEntity.h"
+
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ Allows players to dock onto a ship
+
+ @author
+ Sven Stucki
+
+ @ingroup Docking
+ */
+ class _DockingExport DockToShip : public DockingEffect
+ {
+ public:
+ DockToShip(BaseObject* creator);
+ virtual ~DockToShip();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ void setTargetId(const std::string& str);
+ const std::string& getTargetId() const;
+
+ virtual bool docking(PlayerInfo* player); //!< Called when docking starts
+ virtual bool release(PlayerInfo* player); //!< Called when player wants undock
+ private:
+ std::string target_;
+ };
+
+}
+
+#endif /* _DockToShip_H__ */
Deleted: code/trunk/src/modules/docking/DockingAnimation.cc
===================================================================
--- code/branches/presentation/src/modules/docking/DockingAnimation.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingAnimation.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,71 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DockingAnimation.cc
- @brief Implementation of the DockingAnimation class.
-*/
-
-#include "DockingAnimation.h"
-
-#include "DockingEffect.h" // For DockingEffect::findTarget
-
-namespace orxonox
-{
- DockingAnimation::DockingAnimation(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(DockingAnimation);
-
- this->parent_ = NULL;
- }
-
- DockingAnimation::~DockingAnimation()
- {
-
- }
-
- bool DockingAnimation::invokeAnimation(bool dock, PlayerInfo* player, std::list<DockingAnimation*> &animations)
- {
- bool check = true;
-
- for (std::list<DockingAnimation*>::iterator animation = animations.begin(); animation != animations.end(); animation++)
- {
- if(dock)
- check &= (*animation)->docking(player);
- else
- check &= (*animation)->release(player);
- }
-
- return check;
- }
-
- DockingTarget *DockingAnimation::findTarget(std::string name) {
- return DockingEffect::findTarget(name);
- }
-}
-
Copied: code/trunk/src/modules/docking/DockingAnimation.cc (from rev 8705, code/branches/presentation/src/modules/docking/DockingAnimation.cc)
===================================================================
--- code/trunk/src/modules/docking/DockingAnimation.cc (rev 0)
+++ code/trunk/src/modules/docking/DockingAnimation.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,71 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DockingAnimation.cc
+ @brief Implementation of the DockingAnimation class.
+*/
+
+#include "DockingAnimation.h"
+
+#include "DockingEffect.h" // For DockingEffect::findTarget
+
+namespace orxonox
+{
+ DockingAnimation::DockingAnimation(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(DockingAnimation);
+
+ this->parent_ = NULL;
+ }
+
+ DockingAnimation::~DockingAnimation()
+ {
+
+ }
+
+ bool DockingAnimation::invokeAnimation(bool dock, PlayerInfo* player, std::list<DockingAnimation*> &animations)
+ {
+ bool check = true;
+
+ for (std::list<DockingAnimation*>::iterator animation = animations.begin(); animation != animations.end(); animation++)
+ {
+ if(dock)
+ check &= (*animation)->docking(player);
+ else
+ check &= (*animation)->release(player);
+ }
+
+ return check;
+ }
+
+ DockingTarget *DockingAnimation::findTarget(std::string name) {
+ return DockingEffect::findTarget(name);
+ }
+}
+
Deleted: code/trunk/src/modules/docking/DockingAnimation.h
===================================================================
--- code/branches/presentation/src/modules/docking/DockingAnimation.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingAnimation.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,84 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DockingAnimation.h
- @brief Definition of the DockingAnimation class.
- @ingroup Docking
-*/
-
-#ifndef _DockingAnimation_H__
-#define _DockingAnimation_H__
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "infos/PlayerInfo.h"
-
-#include "DockingPrereqs.h"
-#include "DockingTarget.h"
-#include "Dock.h"
-
-
-#include <list>
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
-
- /**
- @brief
- Base class for docking animations used by @ref orxonox::Docking "Docks".
-
- @author
- Sven Stucki
-
- @ingroup Docking
- */
- class _DockingExport DockingAnimation : public BaseObject
- {
- public:
- DockingAnimation(BaseObject* creator);
- virtual ~DockingAnimation();
-
- virtual bool docking(PlayerInfo* player) = 0; //!< Called when a player starts docking
- virtual bool release(PlayerInfo* player) = 0; //!< Called when player wants to undock
-
- static bool invokeAnimation(bool dock, PlayerInfo* player, std::list<DockingAnimation*> &animations); //!< Invokes calls the docking or release method of all list entries
- static DockingTarget *findTarget(std::string name); //!< Iterates through all DockingTarget objects to find the one with name=target
-
- void setParent(Dock *parent) { this->parent_ = parent; }
-
- protected:
- Dock *parent_;
- std::set<PlayerInfo*> animations_; //!< Contains a list of currently running animations
- };
-
-}
-
-#endif /* _DockingAnimation_H__ */
Copied: code/trunk/src/modules/docking/DockingAnimation.h (from rev 8705, code/branches/presentation/src/modules/docking/DockingAnimation.h)
===================================================================
--- code/trunk/src/modules/docking/DockingAnimation.h (rev 0)
+++ code/trunk/src/modules/docking/DockingAnimation.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,84 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DockingAnimation.h
+ @brief Definition of the DockingAnimation class.
+ @ingroup Docking
+*/
+
+#ifndef _DockingAnimation_H__
+#define _DockingAnimation_H__
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "infos/PlayerInfo.h"
+
+#include "DockingPrereqs.h"
+#include "DockingTarget.h"
+#include "Dock.h"
+
+
+#include <list>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ Base class for docking animations used by @ref orxonox::Docking "Docks".
+
+ @author
+ Sven Stucki
+
+ @ingroup Docking
+ */
+ class _DockingExport DockingAnimation : public BaseObject
+ {
+ public:
+ DockingAnimation(BaseObject* creator);
+ virtual ~DockingAnimation();
+
+ virtual bool docking(PlayerInfo* player) = 0; //!< Called when a player starts docking
+ virtual bool release(PlayerInfo* player) = 0; //!< Called when player wants to undock
+
+ static bool invokeAnimation(bool dock, PlayerInfo* player, std::list<DockingAnimation*> &animations); //!< Invokes calls the docking or release method of all list entries
+ static DockingTarget *findTarget(std::string name); //!< Iterates through all DockingTarget objects to find the one with name=target
+
+ void setParent(Dock *parent) { this->parent_ = parent; }
+
+ protected:
+ Dock *parent_;
+ std::set<PlayerInfo*> animations_; //!< Contains a list of currently running animations
+ };
+
+}
+
+#endif /* _DockingAnimation_H__ */
Deleted: code/trunk/src/modules/docking/DockingController.cc
===================================================================
--- code/branches/presentation/src/modules/docking/DockingController.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingController.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,133 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-#include "DockingController.h"
-
-#include <cmath>
-
-#include "infos/PlayerInfo.h"
-#include "worldentities/ControllableEntity.h"
-#include "Dock.h"
-
-namespace orxonox
-{
- CreateFactory(DockingController);
-
- DockingController::DockingController(BaseObject* creator) : ArtificialController(creator)
- {
- RegisterObject(DockingController);
-
- this->dock_ = NULL;
- this->player_ = NULL;
- this->entity_ = NULL;
- }
-
- DockingController::~DockingController()
- {
-
- }
-
- void DockingController::tick(float dt)
- {
- ControllableEntity* entity = this->getControllableEntity();
- if (!entity)
- return;
-
- float distance = (this->dock_->getWorldPosition() - entity->getPosition()).length();
- Vector2 coord = get2DViewdirection( // I don't understand this too
- entity->getPosition(),
- entity->getOrientation() * WorldEntity::FRONT,
- entity->getOrientation() * WorldEntity::UP,
- dock_->getWorldPosition()
- );
-
- // adjust direction of spaceship
- if (distance > 10)
- {
- entity->rotateYaw(-1.0f * 0.8f * sgn(coord.x) * coord.x*coord.x);
- entity->rotatePitch(0.8f * sgn(coord.y) * coord.y*coord.y);
- }
-
- /*// adjust speed
- if (distance < 200 && entity->getVelocity().squaredLength() > dock->getVelocity().squaredLength())
- entity->moveFrontBack(0.2f);
- else
- entity->moveFrontBack(0.8f);*/
-
- entity->moveFrontBack(0.5f * log(distance/10.0f));
-
- if (distance < 20)
- this->positionReached();
-
- SUPER(DockingController, tick, dt);
- }
-
- void DockingController::takeControl(bool docking)
- {
- this->docking_ = docking;
-
- this->entity_ = this->player_->getControllableEntity();
- assert(this->entity_);
-
- if (docking)
- {
- COUT(4) << "DockingController::takeControl Taking over control." << std::endl;
-
- this->entity_->setDestroyWhenPlayerLeft(false);
- this->player_->pauseControl();
- this->entity_->setController(this);
- this->setControllableEntity(this->entity_);
- }
- }
-
- void DockingController::positionReached()
- {
- COUT(4) << "DockingController::positionReached() called." << std::endl;
-
- assert(this->player_);
- assert(this->dock_);
-
- // stop spaceship
- this->entity_->setPosition(this->dock_->getWorldPosition());
- this->entity_->setVelocity(0, 0, 0);
- this->entity_->setOrientation(this->dock_->getWorldOrientation());
-
- // give control back to player
- this->player_->startControl(this->entity_);
- this->setActive(false);
- this->controllableEntity_ = NULL;
-
- if (this->docking_)
- this->dock_->dockingAnimationFinished(this->player_);
- /*else
- dock->undockingAnimationFinished(player);*/
-
- this->destroy();
- }
-}
-
Copied: code/trunk/src/modules/docking/DockingController.cc (from rev 8705, code/branches/presentation/src/modules/docking/DockingController.cc)
===================================================================
--- code/trunk/src/modules/docking/DockingController.cc (rev 0)
+++ code/trunk/src/modules/docking/DockingController.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,133 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "DockingController.h"
+
+#include <cmath>
+
+#include "infos/PlayerInfo.h"
+#include "worldentities/ControllableEntity.h"
+#include "Dock.h"
+
+namespace orxonox
+{
+ CreateFactory(DockingController);
+
+ DockingController::DockingController(BaseObject* creator) : ArtificialController(creator)
+ {
+ RegisterObject(DockingController);
+
+ this->dock_ = NULL;
+ this->player_ = NULL;
+ this->entity_ = NULL;
+ }
+
+ DockingController::~DockingController()
+ {
+
+ }
+
+ void DockingController::tick(float dt)
+ {
+ ControllableEntity* entity = this->getControllableEntity();
+ if (!entity)
+ return;
+
+ float distance = (this->dock_->getWorldPosition() - entity->getPosition()).length();
+ Vector2 coord = get2DViewdirection( // I don't understand this too
+ entity->getPosition(),
+ entity->getOrientation() * WorldEntity::FRONT,
+ entity->getOrientation() * WorldEntity::UP,
+ dock_->getWorldPosition()
+ );
+
+ // adjust direction of spaceship
+ if (distance > 10)
+ {
+ entity->rotateYaw(-1.0f * 0.8f * sgn(coord.x) * coord.x*coord.x);
+ entity->rotatePitch(0.8f * sgn(coord.y) * coord.y*coord.y);
+ }
+
+ /*// adjust speed
+ if (distance < 200 && entity->getVelocity().squaredLength() > dock->getVelocity().squaredLength())
+ entity->moveFrontBack(0.2f);
+ else
+ entity->moveFrontBack(0.8f);*/
+
+ entity->moveFrontBack(0.5f * log(distance/10.0f));
+
+ if (distance < 20)
+ this->positionReached();
+
+ SUPER(DockingController, tick, dt);
+ }
+
+ void DockingController::takeControl(bool docking)
+ {
+ this->docking_ = docking;
+
+ this->entity_ = this->player_->getControllableEntity();
+ assert(this->entity_);
+
+ if (docking)
+ {
+ COUT(4) << "DockingController::takeControl Taking over control." << std::endl;
+
+ this->entity_->setDestroyWhenPlayerLeft(false);
+ this->player_->pauseControl();
+ this->entity_->setController(this);
+ this->setControllableEntity(this->entity_);
+ }
+ }
+
+ void DockingController::positionReached()
+ {
+ COUT(4) << "DockingController::positionReached() called." << std::endl;
+
+ assert(this->player_);
+ assert(this->dock_);
+
+ // stop spaceship
+ this->entity_->setPosition(this->dock_->getWorldPosition());
+ this->entity_->setVelocity(0, 0, 0);
+ this->entity_->setOrientation(this->dock_->getWorldOrientation());
+
+ // give control back to player
+ this->player_->startControl(this->entity_);
+ this->setActive(false);
+ this->controllableEntity_ = NULL;
+
+ if (this->docking_)
+ this->dock_->dockingAnimationFinished(this->player_);
+ /*else
+ dock->undockingAnimationFinished(player);*/
+
+ this->destroy();
+ }
+}
+
Deleted: code/trunk/src/modules/docking/DockingController.h
===================================================================
--- code/branches/presentation/src/modules/docking/DockingController.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingController.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,67 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _DockingController_H__
-#define _DockingController_H__
-
-#include "DockingPrereqs.h"
-
-#include "infos/PlayerInfo.h"
-#include "controllers/ArtificialController.h"
-#include "tools/interfaces/Tickable.h"
-#include "DockingController.h"
-
-namespace orxonox
-{
- class _DockingExport DockingController : public ArtificialController, public Tickable
- {
- public:
- DockingController(BaseObject* creator);
- virtual ~DockingController();
-
- virtual void tick(float dt);
-
- void takeControl(bool docking);
-
- void setDock(Dock* dock) { this->dock_ = dock; }
- void setPlayer(PlayerInfo* player) { this->player_ = player; }
-
- protected:
- virtual void positionReached();
-
- private:
- bool docking_;
-
- Dock* dock_;
- PlayerInfo* player_;
-
- ControllableEntity* entity_;
- };
-}
-
-#endif /* _DockingController_H__ */
Copied: code/trunk/src/modules/docking/DockingController.h (from rev 8705, code/branches/presentation/src/modules/docking/DockingController.h)
===================================================================
--- code/trunk/src/modules/docking/DockingController.h (rev 0)
+++ code/trunk/src/modules/docking/DockingController.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,67 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _DockingController_H__
+#define _DockingController_H__
+
+#include "DockingPrereqs.h"
+
+#include "infos/PlayerInfo.h"
+#include "controllers/ArtificialController.h"
+#include "tools/interfaces/Tickable.h"
+#include "DockingController.h"
+
+namespace orxonox
+{
+ class _DockingExport DockingController : public ArtificialController, public Tickable
+ {
+ public:
+ DockingController(BaseObject* creator);
+ virtual ~DockingController();
+
+ virtual void tick(float dt);
+
+ void takeControl(bool docking);
+
+ void setDock(Dock* dock) { this->dock_ = dock; }
+ void setPlayer(PlayerInfo* player) { this->player_ = player; }
+
+ protected:
+ virtual void positionReached();
+
+ private:
+ bool docking_;
+
+ Dock* dock_;
+ PlayerInfo* player_;
+
+ ControllableEntity* entity_;
+ };
+}
+
+#endif /* _DockingController_H__ */
Deleted: code/trunk/src/modules/docking/DockingEffect.cc
===================================================================
--- code/branches/presentation/src/modules/docking/DockingEffect.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingEffect.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,72 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DockingEffect.cc
- @brief Implementation of the DockingEffect class.
-*/
-
-#include "DockingEffect.h"
-
-namespace orxonox
-{
- DockingEffect::DockingEffect(BaseObject* creator) : BaseObject(creator)
- {
- RegisterObject(DockingEffect);
- }
-
- DockingEffect::~DockingEffect()
- {
-
- }
-
- bool DockingEffect::invokeEffect(bool dock, PlayerInfo* player, std::list<DockingEffect*> & effects)
- {
- bool check = true;
-
- for (std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
- {
- if (dock)
- check &= (*effect)->docking(player);
- else
- check &= (*effect)->release(player);
- }
-
- return check;
- }
-
- DockingTarget *DockingEffect::findTarget(std::string name) {
- for (ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin(); it != ObjectList<DockingTarget>::end(); ++it)
- {
- if ((*it)->getName().compare(name) == 0)
- return (*it);
- }
- return NULL;
- }
-}
-
Copied: code/trunk/src/modules/docking/DockingEffect.cc (from rev 8705, code/branches/presentation/src/modules/docking/DockingEffect.cc)
===================================================================
--- code/trunk/src/modules/docking/DockingEffect.cc (rev 0)
+++ code/trunk/src/modules/docking/DockingEffect.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,72 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DockingEffect.cc
+ @brief Implementation of the DockingEffect class.
+*/
+
+#include "DockingEffect.h"
+
+namespace orxonox
+{
+ DockingEffect::DockingEffect(BaseObject* creator) : BaseObject(creator)
+ {
+ RegisterObject(DockingEffect);
+ }
+
+ DockingEffect::~DockingEffect()
+ {
+
+ }
+
+ bool DockingEffect::invokeEffect(bool dock, PlayerInfo* player, std::list<DockingEffect*> & effects)
+ {
+ bool check = true;
+
+ for (std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)
+ {
+ if (dock)
+ check &= (*effect)->docking(player);
+ else
+ check &= (*effect)->release(player);
+ }
+
+ return check;
+ }
+
+ DockingTarget *DockingEffect::findTarget(std::string name) {
+ for (ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin(); it != ObjectList<DockingTarget>::end(); ++it)
+ {
+ if ((*it)->getName().compare(name) == 0)
+ return (*it);
+ }
+ return NULL;
+ }
+}
+
Deleted: code/trunk/src/modules/docking/DockingEffect.h
===================================================================
--- code/branches/presentation/src/modules/docking/DockingEffect.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingEffect.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,76 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DockingEffect.h
- @brief Definition of the DockingEffect class.
- @ingroup Docking
-*/
-
-#ifndef _DockingEffect_H__
-#define _DockingEffect_H__
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "infos/PlayerInfo.h"
-
-#include "DockingPrereqs.h"
-#include "DockingTarget.h"
-
-#include <list>
-#include "core/BaseObject.h"
-
-namespace orxonox
-{
-
- /**
- @brief
- Handles DockingEffects for @ref orxonox::Docking "Docks".
-
- @author
- Sven Stucki
-
- @ingroup Docking
- */
- class _DockingExport DockingEffect : public BaseObject
- {
- public:
- DockingEffect(BaseObject* creator);
- virtual ~DockingEffect();
-
- virtual bool docking(PlayerInfo* player) = 0; //!< Called when player docked
- virtual bool release(PlayerInfo* player) = 0; //!< Called when player wants to undock
-
- static bool invokeEffect(bool dock, PlayerInfo* player, std::list<DockingEffect*> & effects); //!< Invokes the event specific method of all DockingEffects in the list
- static DockingTarget *findTarget(std::string name); //!< Iterates through all DockingTarget objects to find the one with name=target
- };
-
-}
-
-#endif /* _DockingEffect_H__ */
Copied: code/trunk/src/modules/docking/DockingEffect.h (from rev 8705, code/branches/presentation/src/modules/docking/DockingEffect.h)
===================================================================
--- code/trunk/src/modules/docking/DockingEffect.h (rev 0)
+++ code/trunk/src/modules/docking/DockingEffect.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,76 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DockingEffect.h
+ @brief Definition of the DockingEffect class.
+ @ingroup Docking
+*/
+
+#ifndef _DockingEffect_H__
+#define _DockingEffect_H__
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "infos/PlayerInfo.h"
+
+#include "DockingPrereqs.h"
+#include "DockingTarget.h"
+
+#include <list>
+#include "core/BaseObject.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ Handles DockingEffects for @ref orxonox::Docking "Docks".
+
+ @author
+ Sven Stucki
+
+ @ingroup Docking
+ */
+ class _DockingExport DockingEffect : public BaseObject
+ {
+ public:
+ DockingEffect(BaseObject* creator);
+ virtual ~DockingEffect();
+
+ virtual bool docking(PlayerInfo* player) = 0; //!< Called when player docked
+ virtual bool release(PlayerInfo* player) = 0; //!< Called when player wants to undock
+
+ static bool invokeEffect(bool dock, PlayerInfo* player, std::list<DockingEffect*> & effects); //!< Invokes the event specific method of all DockingEffects in the list
+ static DockingTarget *findTarget(std::string name); //!< Iterates through all DockingTarget objects to find the one with name=target
+ };
+
+}
+
+#endif /* _DockingEffect_H__ */
Deleted: code/trunk/src/modules/docking/DockingPrecompiledHeaders.h
===================================================================
--- code/branches/presentation/src/modules/docking/DockingPrecompiledHeaders.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingPrecompiledHeaders.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,53 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
-*/
-
-#include "OrxonoxConfig.h"
-
-///////////////////////////////////////////
-///// Stable Headers /////
-///////////////////////////////////////////
-
-#include <LinearMath/btTransform.h>
-
-///////////////////////////////////////////
-///// All Rebuild Headers /////
-///////////////////////////////////////////
-
-#include "core/BaseObject.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-
-// Just in case some header included windows.h
-#undef min
-#undef max
Copied: code/trunk/src/modules/docking/DockingPrecompiledHeaders.h (from rev 8705, code/branches/presentation/src/modules/docking/DockingPrecompiledHeaders.h)
===================================================================
--- code/trunk/src/modules/docking/DockingPrecompiledHeaders.h (rev 0)
+++ code/trunk/src/modules/docking/DockingPrecompiledHeaders.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,53 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+*/
+
+#include "OrxonoxConfig.h"
+
+///////////////////////////////////////////
+///// Stable Headers /////
+///////////////////////////////////////////
+
+#include <LinearMath/btTransform.h>
+
+///////////////////////////////////////////
+///// All Rebuild Headers /////
+///////////////////////////////////////////
+
+#include "core/BaseObject.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+
+// Just in case some header included windows.h
+#undef min
+#undef max
Deleted: code/trunk/src/modules/docking/DockingPrereqs.h
===================================================================
--- code/branches/presentation/src/modules/docking/DockingPrereqs.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,76 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
- Shared library macros, enums, constants and forward declarations for the questsystem module
-*/
-
-#ifndef _DockingPrereqs_H__
-#define _DockingPrereqs_H__
-
-#include "OrxonoxConfig.h"
-#include "OrxonoxPrereqs.h"
-
-//-----------------------------------------------------------------------
-// Shared library settings
-//-----------------------------------------------------------------------
-
-#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(DOCKING_STATIC_BUILD)
-# ifdef DOCKING_SHARED_BUILD
-# define _DockingExport __declspec(dllexport)
-# else
-# if defined( __MINGW32__ )
-# define _DockingExport
-# else
-# define _DockingExport __declspec(dllimport)
-# endif
-# endif
-#elif defined ( ORXONOX_GCC_VISIBILITY )
-# define _DockingExport __attribute__ ((visibility("default")))
-#else
-# define _DockingExport
-#endif
-
-//-----------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------
-
-namespace orxonox
-{
- class Dock;
- class DockingAnimation;
- class DockingController;
- class DockingTarget;
- class DockingEffect;
- class DockToShip;
- class MoveToDockingTarget;
-}
-
-#endif /* _DockingPrereqs_H__ */
Copied: code/trunk/src/modules/docking/DockingPrereqs.h (from rev 8705, code/branches/presentation/src/modules/docking/DockingPrereqs.h)
===================================================================
--- code/trunk/src/modules/docking/DockingPrereqs.h (rev 0)
+++ code/trunk/src/modules/docking/DockingPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,76 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the questsystem module
+*/
+
+#ifndef _DockingPrereqs_H__
+#define _DockingPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(DOCKING_STATIC_BUILD)
+# ifdef DOCKING_SHARED_BUILD
+# define _DockingExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _DockingExport
+# else
+# define _DockingExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _DockingExport __attribute__ ((visibility("default")))
+#else
+# define _DockingExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class Dock;
+ class DockingAnimation;
+ class DockingController;
+ class DockingTarget;
+ class DockingEffect;
+ class DockToShip;
+ class MoveToDockingTarget;
+}
+
+#endif /* _DockingPrereqs_H__ */
Deleted: code/trunk/src/modules/docking/DockingTarget.cc
===================================================================
--- code/branches/presentation/src/modules/docking/DockingTarget.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingTarget.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,59 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DockingTarget.cc
- @brief Docking system main class
-*/
-
-#include "DockingTarget.h"
-#include "core/XMLPort.h"
-
-
-namespace orxonox
-{
- CreateFactory(DockingTarget);
-
- DockingTarget::DockingTarget(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(DockingTarget);
- }
-
- DockingTarget::~DockingTarget()
- {
- }
-
- void DockingTarget::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(DockingTarget, XMLPort, xmlelement, mode);
-
- COUT(4) << "DockingTarget with name '" << this->getName() << "' created.." << std::endl;
- }
-
-}
-
Copied: code/trunk/src/modules/docking/DockingTarget.cc (from rev 8705, code/branches/presentation/src/modules/docking/DockingTarget.cc)
===================================================================
--- code/trunk/src/modules/docking/DockingTarget.cc (rev 0)
+++ code/trunk/src/modules/docking/DockingTarget.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,59 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DockingTarget.cc
+ @brief Docking system main class
+*/
+
+#include "DockingTarget.h"
+#include "core/XMLPort.h"
+
+
+namespace orxonox
+{
+ CreateFactory(DockingTarget);
+
+ DockingTarget::DockingTarget(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(DockingTarget);
+ }
+
+ DockingTarget::~DockingTarget()
+ {
+ }
+
+ void DockingTarget::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(DockingTarget, XMLPort, xmlelement, mode);
+
+ COUT(4) << "DockingTarget with name '" << this->getName() << "' created.." << std::endl;
+ }
+
+}
+
Deleted: code/trunk/src/modules/docking/DockingTarget.h
===================================================================
--- code/branches/presentation/src/modules/docking/DockingTarget.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/DockingTarget.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,66 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file DockingTarget.h
- @brief Definition of the DockingTarget class.
- @ingroup Docking
-*/
-
-#ifndef _DockingTarget_H__
-#define _DockingTarget_H__
-
-#include "DockingPrereqs.h"
-
-#include "core/BaseObject.h"
-#include "worldentities/StaticEntity.h"
-
-namespace orxonox
-{
- /**
- @brief
- DockingTargets for @ref orxonox::Docking "Docks".
-
- @author
- Sven Stucki
-
- @ingroup Docking
- */
- class _DockingExport DockingTarget : public StaticEntity
- {
- public:
- DockingTarget(BaseObject* creator);
- virtual ~DockingTarget();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- };
-
-}
-
-#endif /* _DockingTarget_H__ */
Copied: code/trunk/src/modules/docking/DockingTarget.h (from rev 8705, code/branches/presentation/src/modules/docking/DockingTarget.h)
===================================================================
--- code/trunk/src/modules/docking/DockingTarget.h (rev 0)
+++ code/trunk/src/modules/docking/DockingTarget.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,66 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file DockingTarget.h
+ @brief Definition of the DockingTarget class.
+ @ingroup Docking
+*/
+
+#ifndef _DockingTarget_H__
+#define _DockingTarget_H__
+
+#include "DockingPrereqs.h"
+
+#include "core/BaseObject.h"
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ DockingTargets for @ref orxonox::Docking "Docks".
+
+ @author
+ Sven Stucki
+
+ @ingroup Docking
+ */
+ class _DockingExport DockingTarget : public StaticEntity
+ {
+ public:
+ DockingTarget(BaseObject* creator);
+ virtual ~DockingTarget();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ };
+
+}
+
+#endif /* _DockingTarget_H__ */
Deleted: code/trunk/src/modules/docking/MoveToDockingTarget.cc
===================================================================
--- code/branches/presentation/src/modules/docking/MoveToDockingTarget.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/MoveToDockingTarget.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,74 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file MoveToDockingTarget.h
- @brief Definition of the MoveToDockingTarget class.
- @ingroup Docking
-*/
-
-#include "MoveToDockingTarget.h"
-
-#include "core/XMLPort.h"
-
-namespace orxonox
-{
- CreateFactory(MoveToDockingTarget);
-
- MoveToDockingTarget::MoveToDockingTarget(BaseObject *creator) : DockingAnimation(creator)
- {
- RegisterObject(MoveToDockingTarget);
- }
-
- MoveToDockingTarget::~MoveToDockingTarget() {
-
- }
-
- bool MoveToDockingTarget::docking(PlayerInfo *player)
- {
- assert(this->parent_);
-
- DockingController *dockingController = new DockingController(this);
- dockingController->setDock(this->parent_);
- dockingController->setPlayer(player);
- dockingController->takeControl(true);
-
- return true;
- }
-
- bool MoveToDockingTarget::release(PlayerInfo *player)
- {
- //TODO: Investigate strange things...
- this->parent_->detach((WorldEntity*)player->getControllableEntity());
-
- this->parent_->undockingAnimationFinished(player);
- return true;
- }
-
-}
-
Copied: code/trunk/src/modules/docking/MoveToDockingTarget.cc (from rev 8705, code/branches/presentation/src/modules/docking/MoveToDockingTarget.cc)
===================================================================
--- code/trunk/src/modules/docking/MoveToDockingTarget.cc (rev 0)
+++ code/trunk/src/modules/docking/MoveToDockingTarget.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,74 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MoveToDockingTarget.h
+ @brief Definition of the MoveToDockingTarget class.
+ @ingroup Docking
+*/
+
+#include "MoveToDockingTarget.h"
+
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+ CreateFactory(MoveToDockingTarget);
+
+ MoveToDockingTarget::MoveToDockingTarget(BaseObject *creator) : DockingAnimation(creator)
+ {
+ RegisterObject(MoveToDockingTarget);
+ }
+
+ MoveToDockingTarget::~MoveToDockingTarget() {
+
+ }
+
+ bool MoveToDockingTarget::docking(PlayerInfo *player)
+ {
+ assert(this->parent_);
+
+ DockingController *dockingController = new DockingController(this);
+ dockingController->setDock(this->parent_);
+ dockingController->setPlayer(player);
+ dockingController->takeControl(true);
+
+ return true;
+ }
+
+ bool MoveToDockingTarget::release(PlayerInfo *player)
+ {
+ //TODO: Investigate strange things...
+ this->parent_->detach((WorldEntity*)player->getControllableEntity());
+
+ this->parent_->undockingAnimationFinished(player);
+ return true;
+ }
+
+}
+
Deleted: code/trunk/src/modules/docking/MoveToDockingTarget.h
===================================================================
--- code/branches/presentation/src/modules/docking/MoveToDockingTarget.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/docking/MoveToDockingTarget.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,67 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Sven Stucki
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file MoveToDockingTarget.h
- @brief Definition of the MoveToDockingTarget class.
- @ingroup Docking
-*/
-
-#ifndef _MoveToDockingTarget_H__
-#define _MoveToDockingTarget_H__
-
-#include "DockingPrereqs.h"
-#include "DockingAnimation.h"
-#include "DockingController.h"
-#include "Dock.h"
-
-namespace orxonox
-{
-
- /**
- @brief
- Base class for docking animations used by @ref orxonox::Docking "Docks".
-
- @author
- Sven Stucki
-
- @ingroup Docking
- */
- class _DockingExport MoveToDockingTarget : public DockingAnimation
- {
- public:
- MoveToDockingTarget(BaseObject* creator);
- virtual ~MoveToDockingTarget();
-
- virtual bool docking(PlayerInfo* player); //!< Called when a player starts docking
- virtual bool release(PlayerInfo* player); //!< Called when player wants to undock
- };
-
-}
-
-#endif /* _MoveToDockingTarget_H__ */
Copied: code/trunk/src/modules/docking/MoveToDockingTarget.h (from rev 8705, code/branches/presentation/src/modules/docking/MoveToDockingTarget.h)
===================================================================
--- code/trunk/src/modules/docking/MoveToDockingTarget.h (rev 0)
+++ code/trunk/src/modules/docking/MoveToDockingTarget.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,67 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Sven Stucki
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file MoveToDockingTarget.h
+ @brief Definition of the MoveToDockingTarget class.
+ @ingroup Docking
+*/
+
+#ifndef _MoveToDockingTarget_H__
+#define _MoveToDockingTarget_H__
+
+#include "DockingPrereqs.h"
+#include "DockingAnimation.h"
+#include "DockingController.h"
+#include "Dock.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+ Base class for docking animations used by @ref orxonox::Docking "Docks".
+
+ @author
+ Sven Stucki
+
+ @ingroup Docking
+ */
+ class _DockingExport MoveToDockingTarget : public DockingAnimation
+ {
+ public:
+ MoveToDockingTarget(BaseObject* creator);
+ virtual ~MoveToDockingTarget();
+
+ virtual bool docking(PlayerInfo* player); //!< Called when a player starts docking
+ virtual bool release(PlayerInfo* player); //!< Called when player wants to undock
+ };
+
+}
+
+#endif /* _MoveToDockingTarget_H__ */
Deleted: code/trunk/src/modules/gametypes/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/modules/gametypes/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/gametypes/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,16 +0,0 @@
-SET_SOURCE_FILES(GAMETYPES_SRC_FILES
- SpaceRace.cc
- RaceCheckPoint.cc
-)
-
-ORXONOX_ADD_LIBRARY(gametypes
- MODULE
- FIND_HEADER_FILES
- TOLUA_FILES
- PCH_FILE
- GametypesPrecompiledHeaders.h
- LINK_LIBRARIES
- orxonox
- objects
- SOURCE_FILES ${GAMETYPES_SRC_FILES}
-)
Copied: code/trunk/src/modules/gametypes/CMakeLists.txt (from rev 8705, code/branches/presentation/src/modules/gametypes/CMakeLists.txt)
===================================================================
--- code/trunk/src/modules/gametypes/CMakeLists.txt (rev 0)
+++ code/trunk/src/modules/gametypes/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,16 @@
+SET_SOURCE_FILES(GAMETYPES_SRC_FILES
+ SpaceRace.cc
+ RaceCheckPoint.cc
+)
+
+ORXONOX_ADD_LIBRARY(gametypes
+ MODULE
+ FIND_HEADER_FILES
+ TOLUA_FILES
+ PCH_FILE
+ GametypesPrecompiledHeaders.h
+ LINK_LIBRARIES
+ orxonox
+ objects
+ SOURCE_FILES ${GAMETYPES_SRC_FILES}
+)
Deleted: code/trunk/src/modules/gametypes/GametypesPrecompiledHeaders.h
===================================================================
--- code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/gametypes/GametypesPrecompiledHeaders.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,53 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
-*/
-
-#include "OrxonoxConfig.h"
-
-///////////////////////////////////////////
-///// Stable Headers /////
-///////////////////////////////////////////
-
-#include <LinearMath/btTransform.h>
-
-///////////////////////////////////////////
-///// All Rebuild Headers /////
-///////////////////////////////////////////
-
-#include "core/BaseObject.h"
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-
-// Just in case some header included windows.h
-#undef min
-#undef max
Copied: code/trunk/src/modules/gametypes/GametypesPrecompiledHeaders.h (from rev 8705, code/branches/presentation/src/modules/gametypes/GametypesPrecompiledHeaders.h)
===================================================================
--- code/trunk/src/modules/gametypes/GametypesPrecompiledHeaders.h (rev 0)
+++ code/trunk/src/modules/gametypes/GametypesPrecompiledHeaders.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,53 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+*/
+
+#include "OrxonoxConfig.h"
+
+///////////////////////////////////////////
+///// Stable Headers /////
+///////////////////////////////////////////
+
+#include <LinearMath/btTransform.h>
+
+///////////////////////////////////////////
+///// All Rebuild Headers /////
+///////////////////////////////////////////
+
+#include "core/BaseObject.h"
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+
+// Just in case some header included windows.h
+#undef min
+#undef max
Deleted: code/trunk/src/modules/gametypes/GametypesPrereqs.h
===================================================================
--- code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/gametypes/GametypesPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,70 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
- Shared library macros, enums, constants and forward declarations for the questsystem module
-*/
-
-#ifndef _GametypesPrereqs_H__
-#define _GametypesPrereqs_H__
-
-#include "OrxonoxConfig.h"
-#include "OrxonoxPrereqs.h"
-
-//-----------------------------------------------------------------------
-// Shared library settings
-//-----------------------------------------------------------------------
-
-#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Gametypes_STATIC_BUILD)
-# ifdef GAMETYPES_SHARED_BUILD
-# define _GametypesExport __declspec(dllexport)
-# else
-# if defined( __MINGW32__ )
-# define _GametypesExport
-# else
-# define _GametypesExport __declspec(dllimport)
-# endif
-# endif
-#elif defined ( ORXONOX_GCC_VISIBILITY )
-# define _GametypesExport __attribute__ ((visibility("default")))
-#else
-# define _GametypesExport
-#endif
-
-//-----------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------
-
-namespace orxonox
-{
- class SpaceRace;
-}
-
-#endif /* _GametypesPrereqs_H__ */
Copied: code/trunk/src/modules/gametypes/GametypesPrereqs.h (from rev 8705, code/branches/presentation/src/modules/gametypes/GametypesPrereqs.h)
===================================================================
--- code/trunk/src/modules/gametypes/GametypesPrereqs.h (rev 0)
+++ code/trunk/src/modules/gametypes/GametypesPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,70 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the questsystem module
+*/
+
+#ifndef _GametypesPrereqs_H__
+#define _GametypesPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(Gametypes_STATIC_BUILD)
+# ifdef GAMETYPES_SHARED_BUILD
+# define _GametypesExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _GametypesExport
+# else
+# define _GametypesExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _GametypesExport __attribute__ ((visibility("default")))
+#else
+# define _GametypesExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class SpaceRace;
+}
+
+#endif /* _GametypesPrereqs_H__ */
Deleted: code/trunk/src/modules/gametypes/RaceCheckPoint.cc
===================================================================
--- code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,118 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Mauro Salomon
- * Co-authors:
- * ...
- *
- */
-
-#include "RaceCheckPoint.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-#include "SpaceRace.h"
-#include "util/Convert.h"
-
-namespace orxonox
-{
- CreateFactory(RaceCheckPoint);
-
- RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
- {
- RegisterObject(RaceCheckPoint);
-
- this->bCheckpointIndex_ = 0;
- this->bIsLast_ = false;
- this->bTimeLimit_ = 0;
-
- this->setRadarObjectColour(ColourValue::Blue);
- this->setRadarObjectShape(RadarViewable::Triangle);
- this->setRadarVisibility(false);
- }
-
- RaceCheckPoint::~RaceCheckPoint()
- {
- }
-
- void RaceCheckPoint::tick(float dt)
- {
- SUPER(RaceCheckPoint, tick, dt);
-
- SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
- if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
- this->setRadarVisibility(true);
- else
- this->setRadarVisibility(false);
- }
-
-
- void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
-
- XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
- XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
- XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
- }
-
- void RaceCheckPoint::triggered(bool bIsTriggered)
- {
- DistanceTrigger::triggered(bIsTriggered);
-
- SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
- if (gametype && this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
- {
- gametype->clock_.capture();
- float time = gametype->clock_.getSecondsPrecise();
- if (this->bTimeLimit_!=0 && time > this->bTimeLimit_)
- {
- gametype->timeIsUp();
- gametype->end();
- }
- else if (this->getLast())
- gametype->end();
- else
- {
- gametype->newCheckpointReached();
- this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
- }
- }
- }
-
- void RaceCheckPoint::setTimelimit(float timeLimit)
- {
- this->bTimeLimit_ = timeLimit;
- if (this->bTimeLimit_ != 0)
- {
- SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
- if (gametype)
- {
- const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_)
- + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1) + "\n";
- COUT(3) << message;
- const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
- }
- }
- }
-
-}
Copied: code/trunk/src/modules/gametypes/RaceCheckPoint.cc (from rev 8705, code/branches/presentation/src/modules/gametypes/RaceCheckPoint.cc)
===================================================================
--- code/trunk/src/modules/gametypes/RaceCheckPoint.cc (rev 0)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,118 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "RaceCheckPoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+#include "SpaceRace.h"
+#include "util/Convert.h"
+
+namespace orxonox
+{
+ CreateFactory(RaceCheckPoint);
+
+ RaceCheckPoint::RaceCheckPoint(BaseObject* creator): DistanceTrigger(creator), RadarViewable(creator, static_cast<WorldEntity*>(this))
+ {
+ RegisterObject(RaceCheckPoint);
+
+ this->bCheckpointIndex_ = 0;
+ this->bIsLast_ = false;
+ this->bTimeLimit_ = 0;
+
+ this->setRadarObjectColour(ColourValue::Blue);
+ this->setRadarObjectShape(RadarViewable::Triangle);
+ this->setRadarVisibility(false);
+ }
+
+ RaceCheckPoint::~RaceCheckPoint()
+ {
+ }
+
+ void RaceCheckPoint::tick(float dt)
+ {
+ SUPER(RaceCheckPoint, tick, dt);
+
+ SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ if (this->getCheckpointIndex() == gametype->getCheckpointsReached())
+ this->setRadarVisibility(true);
+ else
+ this->setRadarVisibility(false);
+ }
+
+
+ void RaceCheckPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(RaceCheckPoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(RaceCheckPoint, "checkpointindex", setCheckpointIndex, getCheckpointIndex, xmlelement, mode).defaultValues(0);
+ XMLPortParam(RaceCheckPoint, "islast", setLast, getLast, xmlelement, mode).defaultValues(false);
+ XMLPortParam(RaceCheckPoint, "timelimit", setTimelimit, getTimeLimit, xmlelement, mode).defaultValues(0);
+ }
+
+ void RaceCheckPoint::triggered(bool bIsTriggered)
+ {
+ DistanceTrigger::triggered(bIsTriggered);
+
+ SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ if (gametype && this->getCheckpointIndex() == gametype->getCheckpointsReached() && bIsTriggered)
+ {
+ gametype->clock_.capture();
+ float time = gametype->clock_.getSecondsPrecise();
+ if (this->bTimeLimit_!=0 && time > this->bTimeLimit_)
+ {
+ gametype->timeIsUp();
+ gametype->end();
+ }
+ else if (this->getLast())
+ gametype->end();
+ else
+ {
+ gametype->newCheckpointReached();
+ this->setRadarObjectColour(ColourValue::Green); //sets the radar colour of the checkpoint to green if it is reached, else it is red.
+ }
+ }
+ }
+
+ void RaceCheckPoint::setTimelimit(float timeLimit)
+ {
+ this->bTimeLimit_ = timeLimit;
+ if (this->bTimeLimit_ != 0)
+ {
+ SpaceRace* gametype = orxonox_cast<SpaceRace*>(this->getGametype().get());
+ if (gametype)
+ {
+ const std::string& message = "You have " + multi_cast<std::string>(this->bTimeLimit_)
+ + " seconds to reach the check point " + multi_cast<std::string>(this->bCheckpointIndex_+1) + "\n";
+ COUT(3) << message;
+ const_cast<GametypeInfo*>(gametype->getGametypeInfo())->sendAnnounceMessage(message);
+ }
+ }
+ }
+
+}
Deleted: code/trunk/src/modules/gametypes/RaceCheckPoint.h
===================================================================
--- code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,78 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Mauro Salomon
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _RaceCheckPoint_H__
-#define _RaceCheckPoint_H__
-
-#include "gametypes/GametypesPrereqs.h"
-
-#include "objects/triggers/DistanceTrigger.h"
-#include "interfaces/RadarViewable.h"
-//#include <boost/concept_check.hpp>
-
-namespace orxonox
-{
- /**
- @brief
- The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
- !!! Don't forget to control the indexes of your check points and to set one last check point!!!
- */
- class _GametypesExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
- {
- public:
- RaceCheckPoint(BaseObject* creator);
- virtual ~RaceCheckPoint();
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void tick(float dt);
-
- protected:
- virtual void triggered(bool bIsTriggered);
- inline void setLast(bool isLast)
- { this->bIsLast_ = isLast; }
- inline bool getLast()
- { return this->bIsLast_; }
- inline void setCheckpointIndex(int checkpointIndex)
- { this->bCheckpointIndex_ = checkpointIndex; }
- inline int getCheckpointIndex()
- { return this->bCheckpointIndex_; }
- virtual void setTimelimit(float timeLimit);
- inline float getTimeLimit()
- { return this->bTimeLimit_;}
- inline const WorldEntity* getWorldEntity() const
- { return this; }
-
- private:
- int bCheckpointIndex_; //The index of this check point. This value will be compared with the number of check points reached in the level. The check points must be indexed in ascending order beginning from zero and without any jumps between the indexes.
- bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
- float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
-
- };
-}
-
-#endif /* _RaceCheckPoint_H__ */
\ No newline at end of file
Copied: code/trunk/src/modules/gametypes/RaceCheckPoint.h (from rev 8705, code/branches/presentation/src/modules/gametypes/RaceCheckPoint.h)
===================================================================
--- code/trunk/src/modules/gametypes/RaceCheckPoint.h (rev 0)
+++ code/trunk/src/modules/gametypes/RaceCheckPoint.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,78 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _RaceCheckPoint_H__
+#define _RaceCheckPoint_H__
+
+#include "gametypes/GametypesPrereqs.h"
+
+#include "objects/triggers/DistanceTrigger.h"
+#include "interfaces/RadarViewable.h"
+//#include <boost/concept_check.hpp>
+
+namespace orxonox
+{
+ /**
+ @brief
+ The RaceCheckPoint class enables the creation of a check point to use in a SpaceRace level.
+ !!! Don't forget to control the indexes of your check points and to set one last check point!!!
+ */
+ class _GametypesExport RaceCheckPoint : public DistanceTrigger, public RadarViewable
+ {
+ public:
+ RaceCheckPoint(BaseObject* creator);
+ virtual ~RaceCheckPoint();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void tick(float dt);
+
+ protected:
+ virtual void triggered(bool bIsTriggered);
+ inline void setLast(bool isLast)
+ { this->bIsLast_ = isLast; }
+ inline bool getLast()
+ { return this->bIsLast_; }
+ inline void setCheckpointIndex(int checkpointIndex)
+ { this->bCheckpointIndex_ = checkpointIndex; }
+ inline int getCheckpointIndex()
+ { return this->bCheckpointIndex_; }
+ virtual void setTimelimit(float timeLimit);
+ inline float getTimeLimit()
+ { return this->bTimeLimit_;}
+ inline const WorldEntity* getWorldEntity() const
+ { return this; }
+
+ private:
+ int bCheckpointIndex_; //The index of this check point. This value will be compared with the number of check points reached in the level. The check points must be indexed in ascending order beginning from zero and without any jumps between the indexes.
+ bool bIsLast_; //True if this check point is the last of the level. There can be only one last check point for each level and there must be a last check point in the level.
+ float bTimeLimit_; //The time limit (from the start of the level) to reach this check point. If the check point is reached after this time, the game ends and the player looses.
+
+ };
+}
+
+#endif /* _RaceCheckPoint_H__ */
\ No newline at end of file
Deleted: code/trunk/src/modules/gametypes/SpaceRace.cc
===================================================================
--- code/branches/presentation/src/modules/gametypes/SpaceRace.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/gametypes/SpaceRace.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,106 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Mauro Salomon
- * Co-authors:
- * ...
- *
- */
-
-#include "SpaceRace.h"
-
-#include "core/CoreIncludes.h"
-#include "network/Host.h"
-#include <util/Clock.h>
-#include <util/Math.h>
-#include "util/Convert.h"
-
-namespace orxonox
-{
- CreateUnloadableFactory(SpaceRace);
-
- SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
- {
- RegisterObject(SpaceRace);
- this->bCheckpointsReached_ = 0;
- this->bTimeIsUp_ = false;
- this->numberOfBots_ = 0;
- }
-
- void SpaceRace::end()
- {
- this->Gametype::end();
-
- if (this->bTimeIsUp_)
- {
- this->clock_.capture();
- int s = this->clock_.getSeconds();
- int ms = this->clock_.getMilliseconds()-1000*s;
- const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
- + "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1)
- + " before the time limit. You lose!";
- COUT(3) << message;
- const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
- Host::Broadcast(message);
- }
- else
- {
- this->clock_.capture();
- int s = this->clock_.getSeconds();
- int ms = this->clock_.getMilliseconds()-1000*s;
- const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
- + "." + multi_cast<std::string>(ms) + " seconds.";
- COUT(3) << message << std::endl;
- const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
- Host::Broadcast(message);
- float time = this->clock_.getSecondsPrecise();
- this->scores_.insert(time);
- std::set<float>::iterator it;
- for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
- COUT(3) << multi_cast<std::string>(*it) << std::endl;
- }
- }
-
- void SpaceRace::start()
- {
- Gametype::start();
-
- std::string message("The match has started! Reach the check points as quickly as possible!");
- COUT(3) << message << std::endl;
- Host::Broadcast(message);
- }
-
- void SpaceRace::newCheckpointReached()
- {
- this->bCheckpointsReached_++;
- this->clock_.capture();
- int s = this->clock_.getSeconds();
- int ms = this->clock_.getMilliseconds()-1000*s;
- const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
- + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
- + " seconds.\n";
- COUT(3) << message;
- const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
- Host::Broadcast(message);
- }
-
-}
\ No newline at end of file
Copied: code/trunk/src/modules/gametypes/SpaceRace.cc (from rev 8705, code/branches/presentation/src/modules/gametypes/SpaceRace.cc)
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.cc (rev 0)
+++ code/trunk/src/modules/gametypes/SpaceRace.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,106 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "SpaceRace.h"
+
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include <util/Clock.h>
+#include <util/Math.h>
+#include "util/Convert.h"
+
+namespace orxonox
+{
+ CreateUnloadableFactory(SpaceRace);
+
+ SpaceRace::SpaceRace(BaseObject* creator) : Gametype(creator)
+ {
+ RegisterObject(SpaceRace);
+ this->bCheckpointsReached_ = 0;
+ this->bTimeIsUp_ = false;
+ this->numberOfBots_ = 0;
+ }
+
+ void SpaceRace::end()
+ {
+ this->Gametype::end();
+
+ if (this->bTimeIsUp_)
+ {
+ this->clock_.capture();
+ int s = this->clock_.getSeconds();
+ int ms = this->clock_.getMilliseconds()-1000*s;
+ const std::string& message = multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms) + " seconds !!\n"
+ + "You didn't reach the check point " + multi_cast<std::string>(this->bCheckpointsReached_+1)
+ + " before the time limit. You lose!";
+ COUT(3) << message;
+ const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+ Host::Broadcast(message);
+ }
+ else
+ {
+ this->clock_.capture();
+ int s = this->clock_.getSeconds();
+ int ms = this->clock_.getMilliseconds()-1000*s;
+ const std::string& message = "You win!! You have reached the last check point after "+ multi_cast<std::string>(s)
+ + "." + multi_cast<std::string>(ms) + " seconds.";
+ COUT(3) << message << std::endl;
+ const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+ Host::Broadcast(message);
+ float time = this->clock_.getSecondsPrecise();
+ this->scores_.insert(time);
+ std::set<float>::iterator it;
+ for (it=this->scores_.begin(); it!=this->scores_.end(); it++)
+ COUT(3) << multi_cast<std::string>(*it) << std::endl;
+ }
+ }
+
+ void SpaceRace::start()
+ {
+ Gametype::start();
+
+ std::string message("The match has started! Reach the check points as quickly as possible!");
+ COUT(3) << message << std::endl;
+ Host::Broadcast(message);
+ }
+
+ void SpaceRace::newCheckpointReached()
+ {
+ this->bCheckpointsReached_++;
+ this->clock_.capture();
+ int s = this->clock_.getSeconds();
+ int ms = this->clock_.getMilliseconds()-1000*s;
+ const std::string& message = "Checkpoint " + multi_cast<std::string>(this->getCheckpointsReached())
+ + " reached after " + multi_cast<std::string>(s) + "." + multi_cast<std::string>(ms)
+ + " seconds.\n";
+ COUT(3) << message;
+ const_cast<GametypeInfo*>(this->getGametypeInfo())->sendAnnounceMessage(message);
+ Host::Broadcast(message);
+ }
+
+}
\ No newline at end of file
Deleted: code/trunk/src/modules/gametypes/SpaceRace.h
===================================================================
--- code/branches/presentation/src/modules/gametypes/SpaceRace.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/gametypes/SpaceRace.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,76 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Mauro Salomon
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _SpaceRace_H__
-#define _SpaceRace_H__
-
-#include "gametypes/Gametype.h"
-#include "gametypes/GametypesPrereqs.h"
-#include "RaceCheckPoint.h"
-#include <boost/concept_check.hpp>
-#include <util/Clock.h>
-#include <string.h>
-#include <set>
-
-namespace orxonox
-{
- /**
- @brief
- The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.
- */
- class _GametypesExport SpaceRace : public Gametype
- {
- friend class RaceCheckPoint;
-
- public:
- SpaceRace(BaseObject* creator);
- virtual ~SpaceRace() {}
-
- virtual void start();
- virtual void end();
-
- virtual void newCheckpointReached();
-
- inline void setCheckpointsReached(int n)
- { this->bCheckpointsReached_ = n;}
- inline int getCheckpointsReached()
- { return this->bCheckpointsReached_; }
- inline void timeIsUp()
- { this->bTimeIsUp_ = true;}
-
- protected:
-
- private:
- int bCheckpointsReached_; //The current number of check points reached by the player.
- std::set<float> scores_; //The times of the players are saved in a set.
- bool bTimeIsUp_; //True if one of the check points is reached too late.
- Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
- };
-}
-
-#endif /* _SpaceRace_H__ */
Copied: code/trunk/src/modules/gametypes/SpaceRace.h (from rev 8705, code/branches/presentation/src/modules/gametypes/SpaceRace.h)
===================================================================
--- code/trunk/src/modules/gametypes/SpaceRace.h (rev 0)
+++ code/trunk/src/modules/gametypes/SpaceRace.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,76 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Mauro Salomon
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _SpaceRace_H__
+#define _SpaceRace_H__
+
+#include "gametypes/Gametype.h"
+#include "gametypes/GametypesPrereqs.h"
+#include "RaceCheckPoint.h"
+#include <boost/concept_check.hpp>
+#include <util/Clock.h>
+#include <string.h>
+#include <set>
+
+namespace orxonox
+{
+ /**
+ @brief
+ The SpaceRace class enables the creation of a space race level, where the player has to reach check points in a given order.
+ */
+ class _GametypesExport SpaceRace : public Gametype
+ {
+ friend class RaceCheckPoint;
+
+ public:
+ SpaceRace(BaseObject* creator);
+ virtual ~SpaceRace() {}
+
+ virtual void start();
+ virtual void end();
+
+ virtual void newCheckpointReached();
+
+ inline void setCheckpointsReached(int n)
+ { this->bCheckpointsReached_ = n;}
+ inline int getCheckpointsReached()
+ { return this->bCheckpointsReached_; }
+ inline void timeIsUp()
+ { this->bTimeIsUp_ = true;}
+
+ protected:
+
+ private:
+ int bCheckpointsReached_; //The current number of check points reached by the player.
+ std::set<float> scores_; //The times of the players are saved in a set.
+ bool bTimeIsUp_; //True if one of the check points is reached too late.
+ Clock clock_; //The clock starts running at the beginning of the game. It is used to give the time at each check point, the give the time at the end of the game, and to stop the game if a check point is reached too late.
+ };
+}
+
+#endif /* _SpaceRace_H__ */
Modified: code/trunk/src/modules/notifications/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/notifications/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,8 +1,8 @@
SET_SOURCE_FILES(NOTIFICATIONS_SRC_FILES
- Notification.cc
NotificationDispatcher.cc
NotificationManager.cc
NotificationQueue.cc
+ NotificationQueueCEGUI.cc
)
ADD_SUBDIRECTORY(dispatchers)
@@ -12,7 +12,7 @@
FIND_HEADER_FILES
TOLUA_FILES
NotificationManager.h
- NotificationQueue.h
+ NotificationQueueCEGUI.h
PCH_FILE
NotificationsPrecompiledHeaders.h
LINK_LIBRARIES
Deleted: code/trunk/src/modules/notifications/Notification.cc
===================================================================
--- code/trunk/src/modules/notifications/Notification.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/Notification.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,77 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See thes
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file Notification.cc
- @brief Implementation of the Notification class.
-*/
-
-#include "Notification.h"
-
-#include "core/CoreIncludes.h"
-#include "NotificationManager.h"
-
-namespace orxonox
-{
-
- /**
- @brief
- Constructor. Creates a Notification with the input message and sender.
- @param message
- The message of the Notification.
- @param sender
- The sender of the Notification.
- */
- Notification::Notification(const std::string& message, const std::string& sender)
- {
- RegisterRootObject(Notification);
- this->initialize();
- this->message_ = message;
- this->sender_ = sender;
- }
-
- /**
- @brief
- Destructor.
- */
- Notification::~Notification()
- {
-
- }
-
- /**
- @brief
- Registers the object and sets some default values.
- */
- void Notification::initialize(void)
- {
- this->message_.clear();
- this->sender_ = NotificationManager::NONE;
- }
-
-}
Deleted: code/trunk/src/modules/notifications/Notification.h
===================================================================
--- code/trunk/src/modules/notifications/Notification.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/Notification.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,88 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Damian 'Mozork' Frick
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file Notification.h
- @brief Definition of the Notification class.
- @ingroup Notifications
-*/
-
-#ifndef _Notification_H__
-#define _Notification_H__
-
-#include "notifications/NotificationsPrereqs.h"
-
-#include <string>
-#include "core/OrxonoxClass.h"
-
-namespace orxonox
-{
-
- /**
- @brief
- A Notification represents a short message used to inform the player about something that just happened. With the @ref orxonox::NotificationManager "NotificationManager" a Notification can be sent from any part of orxonox and is then displayed by the proper @ref orxonox::NotificationQueue "NotificationQueue(s)" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueues" accepts).
-
- A Notification is just a datastructure that is used internally by the Notifications module.
-
- @author
- Damian 'Mozork' Frick
-
- @ingroup Notifications
- */
- class _NotificationsExport Notification : public OrxonoxClass
- {
- public:
- Notification(const std::string& message, const std::string& sender);
- virtual ~Notification();
-
- /**
- @brief Get the message of the Notification.
- @return Returns the message of the Notification.
- */
- inline const std::string & getMessage(void) const
- { return this->message_; }
-
- /**
- @brief Get the sender of the Notification.
- @return Returns the sender of the Notification.
- */
- inline const std::string & getSender(void) const
- { return this->sender_; }
-
- private:
- std::string message_; //!< The Notification message.
- std::string sender_; //!< The sender of the notification.
-
- void initialize(void); //!< Registers the object and sets some default values.
- void registerVariables(void) {}
-
- };
-
-}
-
-#endif /* _Notification_H__ */
Modified: code/trunk/src/modules/notifications/NotificationDispatcher.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationDispatcher.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/NotificationDispatcher.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -40,11 +40,10 @@
#include "network/Host.h"
#include "infos/PlayerInfo.h"
+#include "interfaces/NotificationListener.h"
#include "interfaces/PlayerTrigger.h"
#include "worldentities/pawns/Pawn.h"
-#include "NotificationManager.h"
-
namespace orxonox
{
@@ -60,7 +59,7 @@
{
RegisterObject(NotificationDispatcher);
- this->sender_ = NotificationManager::NONE;
+ this->sender_ = NotificationListener::NONE;
this->registerVariables();
}
@@ -113,7 +112,8 @@
if(GameMode::isStandalone() || Host::getPlayerID() == clientId || this->getSyncMode() == 0x0)
{
const std::string message = this->createNotificationMessage();
- NotificationManager::sendNotification(message, clientId, this->getSender());
+ // TODO: Make the type configurable.
+ NotificationListener::sendNotification(message, this->getSender(), notificationMessageType::info, notificationSendMode::network, clientId);
}
else if(GameMode::isServer())
{
@@ -139,7 +139,7 @@
COUT(4) << "NotificationDispatcher (&" << this << ") triggered." << std::endl;
PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
- Pawn* pawn = NULL;
+ PlayerInfo* player = NULL;
// If the trigger is a PlayerTrigger.
if(pTrigger != NULL)
@@ -147,26 +147,17 @@
if(!pTrigger->isForPlayer()) // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
return false;
else
- pawn = pTrigger->getTriggeringPlayer();
+ player = pTrigger->getTriggeringPlayer();
}
else
return false;
- if(pawn == NULL)
+ if(player == NULL)
{
COUT(4) << "The NotificationDispatcher was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
return false;
}
- // Extract the PlayerInfo from the Pawn.
- PlayerInfo* player = pawn->getPlayer();
-
- if(player == NULL)
- {
- COUT(3) << "The PlayerInfo* is NULL." << std::endl;
- return false;
- }
-
this->dispatch(player->getClientID());
return true;
Modified: code/trunk/src/modules/notifications/NotificationManager.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/NotificationManager.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -35,35 +35,19 @@
#include "core/command/ConsoleCommand.h"
#include "core/CoreIncludes.h"
-#include "core/GUIManager.h"
#include "core/LuaState.h"
-#include "network/Host.h"
-#include "network/NetworkFunction.h"
#include "util/ScopedSingletonManager.h"
#include "interfaces/NotificationListener.h"
-#include "Notification.h"
#include "NotificationQueue.h"
+#include "NotificationQueueCEGUI.h"
-#include "ToluaBindNotifications.h"
-
namespace orxonox
{
- const std::string NotificationManager::ALL("all");
- const std::string NotificationManager::NONE("none");
-
- // Register tolua_open function when loading the library.
- DeclareToluaInterface(Notifications);
-
ManageScopedSingleton(NotificationManager, ScopeID::Root, false);
- // Setting console command to enter the edit mode.
- SetConsoleCommand("enterEditMode", &NotificationManager::enterEditMode);
-
- registerStaticNetworkFunction(NotificationManager::sendNotification);
-
/**
@brief
Constructor. Registers the Object.
@@ -72,10 +56,6 @@
{
RegisterRootObject(NotificationManager);
- this->highestIndex_ = 0;
-
- ModifyConsoleCommand("enterEditMode").setObject(this);
-
COUT(3) << "NotificatioManager created." << std::endl;
}
@@ -85,8 +65,6 @@
*/
NotificationManager::~NotificationManager()
{
- ModifyConsoleCommand("enterEditMode").setObject(NULL);
-
// Destroys all Notifications.
for(std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it!= this->allNotificationsList_.end(); it++)
it->second->destroy();
@@ -105,7 +83,7 @@
std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin();
while(it != this->queues_.end())
{
- it->second->destroy(true);
+ it->second->destroy();
it = this->queues_.begin();
}
@@ -114,35 +92,77 @@
/**
@brief
- Sends a Notification with the specified message to the specified client from the specified sender.
+ Creates and registers a Notification with the input message from the input sender.
+ This is called by the NotificationListener, whenever a new notification arrives.
@param message
- The message that should be sent.
- @param clientId
- The id of the client the notification should be sent to.
+ The message of the new Notification.
@param sender
- The sender that sent the notification.
- @param isLocal
- If this is set to true (false is default), then the Notification is sent to the client where this function is executed, meaning the Notification is sent locally.
+ The name of the entity (of the collective) that sent the new Notification.
+ @param type
+ The type of the new Notification.
+ @return
+ Returns true if successful.
*/
- /*static*/ void NotificationManager::sendNotification(const std::string& message, unsigned int clientId, const std::string& sender, bool isLocal)
+ bool NotificationManager::registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)
{
- // If we're in standalone mode or we're already no the right client we create and send the Notification.
- if(GameMode::isStandalone() || isLocal || Host::getPlayerID() == clientId)
+ // TODO: Do something with the type.
+ Notification* notification = new Notification(message, sender, type);
+ return this->registerNotification(notification);
+ }
+
+ /**
+ @brief
+ Executes the input command from the input sender.
+ This is called by the NotificationListener, whenever a new command arrives.
+ @param command
+ The command to be executed,
+ @param sender
+ The The name of the entity (of the collective) that sent the command.
+ @return
+ Returns true if the command was successfully executed.
+ */
+ bool NotificationManager::executeCommand(notificationCommand::Value command, const std::string& sender)
+ {
+ bool commandExecuted = false;
+ if(command == notificationCommand::clear)
{
- Notification* notification = new Notification(message, sender);
- if(NotificationManager::getInstance().registerNotification(notification))
- COUT(3) << "Notification \"" << notification->getMessage() << "\" sent." << std::endl;
+ if(this->commandClear(sender))
+ commandExecuted = true;
}
- // If we're on the server (and the server is not the intended recipient of the Notification) we send it over the network.
- else if(GameMode::isServer())
+
+ if(commandExecuted)
+ COUT(3) << "Notification command \"" << NotificationListener::command2Str(command) << "\" executed." << endl;
+
+ return commandExecuted;
+ }
+
+ /**
+ @brief
+ The clear command. Clears all NotificationQueues that have its sender as a target.
+ @param sender
+ The sender of the clear command.
+ @return
+ Returns true if the command was successfully executed by at least one NotificationQueue, false if it was not executed.
+ */
+ bool NotificationManager::commandClear(const std::string& sender)
+ {
+ bool all = (sender == NotificationListener::ALL);
+ bool executed = false;
+ // Clear all NotificationQueues that have the input sender as target.
+ for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.
{
- callStaticNetworkFunction(NotificationManager::sendNotification, clientId, message, clientId, sender);
+ const std::set<std::string>& set = it->second->getTargetsSet();
+ // If either the sender is 'all', the NotificationQueue has as target all or the NotificationQueue has the input sender as a target.
+ if(all || set.find(NotificationListener::ALL) != set.end() || set.find(sender) != set.end())
+ executed = it->second->tidy() || executed;
}
+
+ return executed;
}
-
+
/**
@brief
- Registers a Notification within the NotificationManager and makes sure that the Notification is sent to all the NotificationListeners associated with its sender.
+ Registers a Notification within the NotificationManager and makes sure that the Notification is sent to all the NotificationQueues associated with its sender.
@param notification
The Notification to be registered.
@return
@@ -157,24 +177,23 @@
// Add the Notification to the list that holds all Notifications.
this->allNotificationsList_.insert(std::pair<std::time_t, Notification*>(time, notification));
- if(notification->getSender() == NotificationManager::NONE) // If the sender has no specific name, then the Notification is only added to the list of all Notifications.
+ if(notification->getSender() == NotificationListener::NONE) // If the sender has no specific name, then the Notification is only added to the list of all Notifications.
return true;
- bool all = false;
- if(notification->getSender() == NotificationManager::ALL) // If all are the sender, then the Notifications is added to every NotificationListener.
- all = true;
+ // If all are the sender, then the Notifications is added to every NotificationQueue.
+ bool all = (notification->getSender() == NotificationListener::ALL);
- // Insert the Notification in all NotificationListeners that have its sender as target.
- for(std::map<NotificationListener*, unsigned int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) // Iterate through all NotificationListeners.
+ // Insert the Notification in all NotificationQueues that have its sender as target.
+ for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.
{
- const std::set<std::string>& set = it->first->getTargetsSet();
- bool bAll = set.find(NotificationManager::ALL) != set.end();
- // If either the Notification has as sender 'all', the NotificationListener displays all Notifications or the NotificationListener has the sender of the Notification as target.
+ const std::set<std::string>& set = it->second->getTargetsSet();
+ bool bAll = set.find(NotificationListener::ALL) != set.end();
+ // If either the Notification has as sender 'all', the NotificationQueue displays all Notifications or the NotificationQueue has the sender of the Notification as target.
if(all || bAll || set.find(notification->getSender()) != set.end())
{
if(!bAll)
- this->notificationLists_[it->second]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationListener.
- it->first->update(notification, time); // Update the NotificationListener.
+ this->notificationLists_[it->second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue.
+ it->second->update(notification, time); // Update the NotificationQueue.
}
}
@@ -185,21 +204,21 @@
/**
@brief
- Unregisters a Notification within the NotificationManager for a given NotificationListener.
+ Unregisters a Notification within the NotificationManager for a given NotificationQueue.
@param notification
A pointer to the Notification to be unregistered.
- @param listener
- A pointer to the NotificationListener the Notification is unregistered for.
+ @param queue
+ A pointer to the NotificationQueue the Notification is unregistered for.
*/
- void NotificationManager::unregisterNotification(Notification* notification, NotificationListener* listener)
+ void NotificationManager::unregisterNotification(Notification* notification, NotificationQueue* queue)
{
assert(notification);
- assert(listener);
+ assert(queue);
- // Remove the Notification from the list of Notifications of the input NotificationListener.
- this->removeNotification(notification, *(this->notificationLists_.find(this->listenerList_.find(listener)->second)->second));
+ // Remove the Notification from the list of Notifications of the input NotificationQueue.
+ this->removeNotification(notification, *(this->notificationLists_.find(queue->getName())->second));
- COUT(4) << "Notification (&" << notification << ") unregistered with the NotificationManager from listener (&" << listener << ")" << std::endl;
+ COUT(4) << "Notification (&" << notification << ") unregistered with the NotificationManager from NotificationQueue " << queue->getName() << "." << std::endl;
}
/**
@@ -229,65 +248,123 @@
/**
@brief
- Registers a NotificationListener within the NotificationManager.
- @param listener
- The NotificationListener to be registered.
+ Fetches the Notifications for a specific NotificationQueue in a specified timeframe and stores them in the input map.
+ @param queue
+ The NotificationQueue the Notifications are fetched for.
+ @param map
+ A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
+ @param timeFrameStart
+ The start time of the timeframe.
+ @param timeFrameEnd
+ The end time of the timeframe.
@return
- Returns true if successful. Fales if the NotificationListener is already registered.
+ Returns true if successful.
*/
- bool NotificationManager::registerListener(NotificationListener* listener)
+ void NotificationManager::getNotifications(NotificationQueue* queue, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
{
- assert(listener);
+ assert(queue);
+ assert(map);
- // If the NotificationListener is already registered.
- if(this->listenerList_.find(listener) != this->listenerList_.end())
+ std::multimap<std::time_t, Notification*>* notifications = this->notificationLists_[queue->getName()]; // All the Notifications for the input NotificationQueue.
+
+ std::multimap<std::time_t,Notification*>::iterator it, itLowest, itHighest;
+ // Iterators pointing to the bounds specified by the specified start and end times of the time frame.
+ itLowest = notifications->lower_bound(timeFrameStart);
+ itHighest = notifications->upper_bound(timeFrameEnd);
+
+ for(it = itLowest; it != itHighest; it++) // Iterate through the Notifications from the start of the time frame to the end of it.
+ map->insert(std::pair<std::time_t, Notification*>(it->first, it->second)); // Add the found Notifications to the map.
+ }
+
+ /**
+ @brief
+ Fetches the newest Notifications for a specific NotificationQueue and stores them in the input map.
+ @param queue
+ The NotificationQueue the Notifications are fetched for.
+ @param map
+ A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
+ @param numberOfNotifications
+ The number of newest Notifications to be got.
+ @return
+ Returns true if successful.
+ */
+ void NotificationManager::getNewestNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications)
+ {
+ assert(queue);
+ assert(map);
+
+ std::multimap<std::time_t, Notification*>* notifications = this->notificationLists_[queue->getName()]; // All the Notifications for the input NotificationQueue.
+
+ if(!notifications->empty()) // If the list of Notifications is not empty.
+ {
+ std::multimap<std::time_t,Notification*>::iterator it = notifications->end();
+ for(int i = 0; i < numberOfNotifications; i++) // Iterate through the Notifications from the newest until we have the specified number of notifications.
+ {
+ it--;
+ map->insert(std::pair<std::time_t, Notification*>(it->first, it->second)); // Add the found Notifications to the map.
+ if(it == notifications->begin())
+ break;
+ }
+ }
+ }
+
+ /**
+ @brief
+ Registers a NotificationQueue.
+ This makes sure that the NotificationQueue can be accessed through lua by name. It also makes sure that the NotificationQueue is destroyed upon destruction of the NotificationManager.
+ @param queue
+ A pointer to the NotificationQueue to be registered.
+ @return
+ Returns true if successful. If e.g. the a NotificationQueue with that name already exists this returns false.
+ */
+ bool NotificationManager::registerQueue(NotificationQueue* queue)
+ {
+ assert(queue);
+
+ // If the NotificationQueue is already registered.
+ if(this->queues_.find(queue->getName()) != this->queues_.end())
return false;
- this->highestIndex_ += 1;
- unsigned int index = this->highestIndex_; // An identifier that identifies each registered NotificationListener uniquely.
+ this->queues_.insert(std::pair<const std::string, NotificationQueue*>(queue->getName(), queue)); // Add the NotificationQueue to the list of NotificationQueues.
- this->listenerList_[listener] = index; // Add the NotificationListener to the list of NotificationListeners.
+ const std::set<std::string>& set = queue->getTargetsSet();
- const std::set<std::string>& set = listener->getTargetsSet();
-
- // If all senders are the target of the NotificationListener, then the list of Notifications for that specific NotificationListener is the same as the list of all Notifications.
- bool bAll = set.find(NotificationManager::ALL) != set.end();
+ // If all senders are the target of the NotificationQueue, then the list of Notifications for that specific NotificationQueue is the same as the list of all Notifications.
+ bool bAll = set.find(NotificationListener::ALL) != set.end();
std::multimap<std::time_t, Notification*>* map = NULL;
if(bAll)
- this->notificationLists_[index] = &this->allNotificationsList_;
- // Else a new list (resp. multimap) is created and added to the list of Notification lists for NotificationListeners.
+ this->notificationLists_[queue->getName()] = &this->allNotificationsList_;
+ // Else a new list (resp. multimap) is created and added to the list of Notification lists for NotificationQueues.
else
{
- this->notificationLists_[index] = new std::multimap<std::time_t, Notification*>;
- map = this->notificationLists_[index];
+ this->notificationLists_[queue->getName()] = new std::multimap<std::time_t, Notification*>;
+ map = this->notificationLists_[queue->getName()];
}
- // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationListener.
+ // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue.
for(std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)
{
if(!bAll && set.find(it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.
map->insert(std::pair<std::time_t, Notification*>(it->first, it->second));
}
- listener->update(); // Update the listener.
-
- COUT(4) << "NotificationListener registered with the NotificationManager." << std::endl;
-
+ queue->update(); // Update the queue.
+
+ COUT(4) << "NotificationQueue '" << queue->getName() << "' registered with the NotificationManager." << std::endl;
return true;
}
/**
@brief
- Unregisters a NotificationListener within the NotificationManager.
- @param listener
- The NotificationListener to be unregistered.
+ Unregisters a NotificationQueue.
+ @param queue
+ A pointer to the NotificationQueue to be unregistered.
*/
- void NotificationManager::unregisterListener(NotificationListener* listener)
+ void NotificationManager::unregisterQueue(NotificationQueue* queue)
{
- assert(listener);
+ assert(queue);
- unsigned int identifier = this->listenerList_.find(listener)->second;
- std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(identifier)->second;
+ std::multimap<std::time_t, Notification*>* map = this->notificationLists_.find(queue->getName())->second;
// If the map is not the map of all Notifications, make sure all Notifications are unregistered.
std::multimap<std::time_t, Notification*>::iterator it = map->begin();
@@ -295,128 +372,93 @@
{
while(it != map->end())
{
- this->unregisterNotification(it->second, listener);
+ this->unregisterNotification(it->second, queue);
it = map->begin();
}
delete map;
}
- COUT(4) << "NotificationListener '" << identifier << "' unregistered with the NotificationManager." << std::endl;
-
- // Remove the NotificationListener from the list of NotificationListeners.
- this->listenerList_.erase(listener);
- // Remove the Notifications list that was associated with the input NotificationListener.
- this->notificationLists_.erase(identifier);
+ // Remove the NotificationQueue from the list of NotificationQueues.
+ this->queues_.erase(queue->getName());
+ // Remove the Notifications list that was associated with the input NotificationQueue.
+ this->notificationLists_.erase(queue->getName());
+
+ COUT(4) << "NotificationQueue '" << queue->getName() << "' unregistered with the NotificationManager." << std::endl;
}
/**
@brief
- Fetches the Notifications for a specific NotificationListener in a specified timeframe and stores them in the input map.
- @param listener
- The NotificationListener the Notifications are fetched for.
- @param map
- A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
- @param timeFrameStart
- The start time of the timeframe.
- @param timeFrameEnd
- The end time of the timeframe.
+ Get the NotificationQueue with the input name.
+ @param name
+ The name of the NotificationQueue.
@return
- Returns true if successful.
+ Returns a pointer to the NotificationQueue with the input name. Returns NULL if no NotificationQueue with such a name exists.
*/
- void NotificationManager::getNotifications(NotificationListener* listener, std::multimap<std::time_t,Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd)
+ NotificationQueue* NotificationManager::getQueue(const std::string & name)
{
- assert(listener);
- assert(map);
+ std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.find(name);
+ // Returns NULL if no such NotificationQueue exists.
+ if(it == this->queues_.end())
+ return NULL;
- std::multimap<std::time_t, Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; // All the Notifications for the input NotificationListener.
-
- std::multimap<std::time_t,Notification*>::iterator it, itLowest, itHighest;
- // Iterators pointing to the bounds specified by the specified start and end times of the time frame.
- itLowest = notifications->lower_bound(timeFrameStart);
- itHighest = notifications->upper_bound(timeFrameEnd);
-
- for(it = itLowest; it != itHighest; it++) // Iterate through the Notifications from the start of the time frame to the end of it.
- map->insert(std::pair<std::time_t, Notification*>(it->first, it->second)); // Add the found Notifications to the map.
+ return (*it).second;
}
/**
@brief
- Enters the edit mode of the NotificationLayer.
+ Loads all the NotificationQueues that should exist.
*/
- void NotificationManager::enterEditMode(void)
+ void NotificationManager::loadQueues(void)
{
- if(GameMode::showsGraphics())
- {
- GUIManager::getInstance().hideGUI("NotificationLayer");
- GUIManager::getInstance().showGUI("NotificationLayer", false, false);
- GUIManager::getInstance().getLuaState()->doString("NotificationLayer.enterEditMode()");
- }
+ /*NotificationQueueCEGUI* allQueue = new NotificationQueueCEGUI("all");
+ allQueue->setDisplaySize(Vector2(0.5, 0));
+ allQueue->setPosition(Vector4(0.0, 10, 0.3, 0));
+
+ NotificationQueueCEGUI* infoQueue = new NotificationQueueCEGUI("info", "gameinfo", 1, -1);
+ infoQueue->setPosition(Vector4(0.2, 0, 0.8, 0));
+ infoQueue->setFontSize(24);
+ infoQueue->setFontColor(Vector4(1.0, 1.0, 0.0, 0.8));
+ infoQueue->setAlignment("HorzCentred");
+ infoQueue->setDisplaySize(Vector2(0.6, 0.0));*/
}
+ // Notification class
+
/**
@brief
- Registers a NotificationQueue.
- This makes sure that the NotificationQueue can be attained through lua by name. It also makes sure that the NotificationQueue is destroyed upon destruction of the NotificationManager.
- @param queue
- A pointer to the NotificationQueue to be registered.
- @return
- Returns true if successful. If e.g. the a NotificationQueue with that name already exists this returns false.
- */
- bool NotificationManager::registerQueue(NotificationQueue* queue)
- {
- COUT(4) << "NotificationQueue '" << queue->getName() << "' registered with the NotificationManager." << std::endl;
- return this->queues_.insert(std::pair<const std::string, NotificationQueue*>(queue->getName(), queue)).second;
- }
+ Constructor. Creates a Notification with the input message and sender.
+ @param message
+ The message of the Notification.
+ @param sender
+ The sender of the Notification.
+ @param type
- /**
- @brief
- Unregisters a NotificationQueue.
- @param queue
- A pointer to the NotificationQueue to be unregistered.
*/
- void NotificationManager::unregisterQueue(NotificationQueue* queue)
+ Notification::Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type)
{
- COUT(4) << "NotificationQueue '" << queue->getName() << "' unregistered with the NotificationManager." << std::endl;
- this->queues_.erase(queue->getName());
+ this->initialize();
+ this->message_ = message;
+ this->sender_ = sender;
+ this->type_ = type;
}
/**
@brief
- Loads all the NotificationQueues that should exist.
+ Destructor.
*/
- void NotificationManager::loadQueues(void)
+ Notification::~Notification()
{
- new NotificationQueue("all");
- }
- /**
- @brief
- Creates a new NotificationQueue.
- This is used in lua.
- @param name
- The name of the new NotificationQueue.
- */
- void NotificationManager::createQueue(const std::string& name)
- {
- new NotificationQueue(name);
}
/**
@brief
- Get the NotificationQueue with the input name.
- @param name
- The name of the NotificationQueue.
- @return
- Returns a pointer to the NotificationQueue with the input name. Returns NULL if no NotificationQueue with such a name exists.
+ Registers the object and sets some default values.
*/
- NotificationQueue* NotificationManager::getQueue(const std::string & name)
+ void Notification::initialize(void)
{
- std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.find(name);
- // Returns NULL if no such NotificationQueue exists.
- if(it == this->queues_.end())
- return NULL;
-
- return (*it).second;
+ this->message_.clear();
+ this->sender_ = NotificationListener::NONE;
}
}
Modified: code/trunk/src/modules/notifications/NotificationManager.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationManager.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/NotificationManager.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -41,32 +41,86 @@
#include <map>
#include <string>
+#include "core/OrxonoxClass.h"
#include "util/Singleton.h"
-#include "core/OrxonoxClass.h"
+#include "interfaces/NotificationListener.h"
namespace orxonox // tolua_export
{ // tolua_export
/**
@brief
- The Singleton NotificationManager functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationListener "NotificationListeners".
- It receives, organizes @ref orxonox::Notification "Notifications" and the redistributes them to the specific @ref orxonox::NotificationListener "NotificationListeners".
- It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox::NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
+ A Notification represents a short message used to inform the player about something that just happened. With the @ref orxonox::NotificationManager "NotificationManager" a Notification can be sent from any part of orxonox and is then displayed by the proper @ref orxonox::NotificationQueue "NotificationQueue(s)" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueues" accepts).
+ A Notification is just a data structure that is used internally by the Notifications module.
+
@author
Damian 'Mozork' Frick
@ingroup Notifications
*/
+ class _NotificationsExport Notification
+ {
+ public:
+ Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type);
+ virtual ~Notification();
+
+ /**
+ @brief Destroys the Notification.
+ */
+ void destroy(void)
+ { delete this; }
+
+ /**
+ @brief Get the message of the Notification.
+ @return Returns the message of the Notification.
+ */
+ inline const std::string & getMessage(void) const
+ { return this->message_; }
+
+ /**
+ @brief Get the sender of the Notification.
+ @return Returns the sender of the Notification.
+ */
+ inline const std::string & getSender(void) const
+ { return this->sender_; }
+
+ /**
+ @brief Get the type of the Notification.
+ @return Returns an enum with the type of the Notification.
+ */
+ inline notificationMessageType::Value getType(void) const
+ { return this->type_; }
+
+ private:
+ std::string message_; //!< The Notification message.
+ std::string sender_; //!< The sender of the notification.
+ notificationMessageType::Value type_; //!< The type of the notification.
+
+ void initialize(void); //!< Registers the object and sets some default values.
+
+ };
+
+ /**
+ @brief
+ The Singleton NotificationManager is a NotificationListener and functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationQueue "NotificationQueues".
+ It receives, organizes @ref orxonox::Notification "Notifications" and the redistributes them to the specific @ref orxonox::NotificationQueue "NotificationQueues".
+ It also works as a liaison between the @ref orxonox::NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.
+
+ @author
+ Damian 'Mozork' Frick
+
+ @ingroup Notifications
+ */
class _NotificationsExport NotificationManager // tolua_export
- : public Singleton<NotificationManager>, public OrxonoxClass
+ : public Singleton<NotificationManager>, public NotificationListener
{ // tolua_export
friend class Singleton<NotificationManager>;
public:
NotificationManager();
virtual ~NotificationManager();
- virtual void preDestroy(void); //!< Is called before the object is destroyed.
+ virtual void preDestroy(void); // Is called before the object is destroyed.
/**
@brief Get the instance of the NotificationManager Singleton.
@@ -74,52 +128,45 @@
*/
static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export
- static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationListeners.
- static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener.
+ virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type);
+ virtual bool executeCommand(notificationCommand::Value command, const std::string& sender);
- //! Sends a Notification with the specified message to the specified client from the specified sender.
- static void sendNotification(const std::string& message, unsigned int clientId, const std::string& sender = NotificationManager::NONE, bool isLocal = false);
+ bool registerNotification(Notification* notification); // Registers a Notification within the NotificationManager.
+ void unregisterNotification(Notification* notification, NotificationQueue* queue); // Unregisters a Notification within the NotificationManager for a given NotificationQueue.
- bool registerNotification(Notification* notification); //!< Registers a Notification within the NotificationManager.
- void unregisterNotification(Notification* notification, NotificationListener* listener); //!< Unregisters a Notification within the NotificationManager for a given NotificationListener.
- bool registerListener(NotificationListener* listener); //!< Registers a NotificationListener within the NotificationManager.
- void unregisterListener(NotificationListener* listener); //!< Unregisters a NotificationListener withing the NotificationManager.
+ void getNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); // Fetches the Notifications for a specific NotificationQueue in a specified timeframe and stores them in the input map.
- void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, const std::time_t & timeFrameStart, const std::time_t & timeFrameEnd); //!< Fetches the Notifications for a specific NotificationListener in a specified timeframe and stores them in the input map.
-
/**
- @brief Fetches the Notifications for a specific NotificationListener in a timeframe from now-timeDelay to now and stores them in the input map.
- @param listener The NotificationListener the Notifications are fetched for.
+ @brief Fetches the Notifications for a specific NotificationQueue in a timeframe from (now-timeDelay) to now and stores them in the input map.
+ @param queue The NotificationQueue the Notifications are fetched for.
@param map A pointer to a multimap, in which the notifications are stored. The map needs to have been allocated.
@param timeDelay The timespan.
@return Returns true if successful.
*/
- void getNotifications(NotificationListener* listener, std::multimap<std::time_t, Notification*>* map, int timeDelay)
- { this->getNotifications(listener, map, std::time(0)-timeDelay, std::time(0)); }
+ void getNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int timeDelay)
+ { this->getNotifications(queue, map, std::time(0)-timeDelay, std::time(0)); }
- void enterEditMode(void); //!< Enters the edit mode of the NotificationLayer.
+ void getNewestNotifications(NotificationQueue* queue, std::multimap<std::time_t, Notification*>* map, int numberOfNotifications); // Fetches the newest Notifications for a specific NotificationQueue and stores them in the input map.
- bool registerQueue(NotificationQueue* queue); //!< Registers a NotificationQueue.
- void unregisterQueue(NotificationQueue* queue); //!< Unregisters a NotificationQueue.
+ bool registerQueue(NotificationQueue* queue); // Registers a NotificationQueue.
+ void unregisterQueue(NotificationQueue* queue); // Unregisters a NotificationQueue.
- // tolua_begin
- void loadQueues(void); //!< Loads all the NotificationQueues that should exist.
- void createQueue(const std::string& name); //!< Creates a new NotificationQueue.
- orxonox::NotificationQueue* getQueue(const std::string & name); //!< Get the NotificationQueue with the input name.
- // tolua_end
+ void loadQueues(void); // tolua_export // Loads all the NotificationQueues that should exist.
+ NotificationQueue* getQueue(const std::string & name); // Get the NotificationQueue with the input name.
+
private:
static NotificationManager* singletonPtr_s;
- unsigned int highestIndex_; //!< This variable holds the highest index (resp. key) in notificationLists_s, to secure that no key appears twice.
-
std::multimap<std::time_t, Notification*> allNotificationsList_; //!< Container where all Notifications are stored.
- std::map<NotificationListener*, unsigned int> listenerList_; //!< Container where all NotificationListeners are stored with a number as identifier.
- std::map<int,std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationListener), are stored.
+ std::map<const std::string, std::multimap<std::time_t, Notification*>*> notificationLists_; //!< Container where all Notifications, for each identifier (associated with a NotificationQueue), are stored.
std::map<const std::string, NotificationQueue*> queues_; //!< The list of NotificationQueues created by the NotificationManager.
- bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); //!< Helper method that removes an input Notification form an input map.
+ bool removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map); // Helper method that removes an input Notification form an input map.
+
+ // Commands
+ bool commandClear(const std::string& sender); // The clear command. Clears all NotificationQueues that have its sender as a target.
}; // tolua_export
Modified: code/trunk/src/modules/notifications/NotificationQueue.cc
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/NotificationQueue.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -37,20 +37,40 @@
#include <sstream>
#include "core/CoreIncludes.h"
-#include "core/GameMode.h"
-#include "core/GUIManager.h"
-#include "core/LuaState.h"
-#include "util/Convert.h"
+#include "core/XMLPort.h"
#include "util/SubString.h"
-#include "Notification.h"
-
namespace orxonox
{
+ CreateFactory(NotificationQueue);
+
/**
@brief
- Constructor. Creates and initializes the object.
+ Default constructor. Registers and initializes the object.
+ @param creator
+ The creator of the NotificationQueue.
+ */
+ NotificationQueue::NotificationQueue(BaseObject* creator) : BaseObject(creator), Synchronisable(creator), registered_(false)
+ {
+ RegisterObject(NotificationQueue);
+
+ this->size_ = 0;
+ this->tickTime_ = 0.0f;
+ this->maxSize_ = NotificationQueue::DEFAULT_SIZE;
+ this->displayTime_ = NotificationQueue::DEFAULT_DISPLAY_TIME;
+
+ this->creationTime_ = std::time(0);
+
+ this->registerVariables();
+ }
+
+ // TODO move to docu.
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ @param creator
+ The creator of the NotificationQueue
@param name
The name of the new NotificationQueue. It needs to be unique
@param senders
@@ -61,50 +81,7 @@
@param displayTime
The time during which a Notification is (at most) displayed.
*/
- NotificationQueue::NotificationQueue(const std::string& name, const std::string& senders, unsigned int size, unsigned int displayTime)
- {
- this->registered_ = false;
- RegisterRootObject(NotificationQueue);
-
- // Initialize.
- this->size_ = 0;
- this->tickTime_ = 0.0f;
-
- // Sets the input values.
- this->setTargets(senders);
- this->name_ = name;
- this->maxSize_ = size;
- this->setDisplayTime(displayTime);
-
- // Register the NotificationQueue with the NotificationManager.
- bool queueRegistered = NotificationManager::getInstance().registerQueue(this);
- this->registered_ = true;
- if(!queueRegistered) // If the registration has failed.
- {
- this->registered_ = false;
- COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl;
- return;
- }
-
- this->create(); // Creates the NotificationQueue in lua.
-
- // Register the NotificationQueue as NotificationListener with the NotificationManager.
- bool listenerRegistered = NotificationManager::getInstance().registerListener(this);
- if(!listenerRegistered) // If the registration has failed.
- {
- this->registered_ = false;
- // Remove the NotificationQueue in lua.
- if(GameMode::showsGraphics())
- GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")");
- NotificationManager::getInstance().unregisterQueue(this);
- COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl;
- return;
- }
-
- COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl;
- }
-
/**
@brief
Destructor.
@@ -113,42 +90,51 @@
{
this->targets_.clear();
- if(this->registered_) // If the NotificationQueue is registered.
+ if(this->isRegistered()) // If the NotificationQueue is registered.
{
this->clear(true);
// Unregister with the NotificationManager.
- NotificationManager::getInstance().unregisterListener(this);
NotificationManager::getInstance().unregisterQueue(this);
}
}
/**
@brief
- Destroys the NotificationQueue.
- Used in lua and NotificationManager.
- @param noGraphics
- If this is set to true (false is default), then the queue is not removed in lua. This is used to destroy the queue, after the GUIManager has been destroyed.
+ Is called when the name of the NotificationQueue has changed.
+ Clears and re-creates the NotificationQueue.
*/
- void NotificationQueue::destroy(bool noGraphics)
+ void NotificationQueue::changedName(void)
{
- // Remove the NotificationQueue in lua.
- if(GameMode::showsGraphics() && !noGraphics)
- GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")");
+ SUPER(NotificationQueue, changedName);
- COUT(3) << "NotificationQueue '" << this->getName() << "' destroyed." << std::endl;
+ if(this->isRegistered())
+ this->clear();
+
+ this->create();
- this->OrxonoxClass::destroy();
+ this->targetsChanged();
+ this->maxSizeChanged();
+ this->displayTimeChanged();
}
/**
@brief
- Creates the NotificationQueue in lua.
+ Creates the NotificationQueue.
*/
void NotificationQueue::create(void)
{
- if(GameMode::showsGraphics())
- GUIManager::getInstance().getLuaState()->doString("NotificationLayer.createQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->getMaxSize()) + ")");
+ // Register the NotificationQueue with the NotificationManager.
+ bool queueRegistered = NotificationManager::getInstance().registerQueue(this);
+ this->registered_ = true;
+ if(!queueRegistered) // If the registration has failed.
+ {
+ this->registered_ = false;
+ COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl;
+ return;
+ }
+
+ COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl;
}
/**
@@ -160,9 +146,9 @@
void NotificationQueue::tick(float dt)
{
this->tickTime_ += dt; // Add the time interval that has passed to the time counter.
- if(this->tickTime_ >= 1.0) // If the time counter is greater than 1s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
+ if(this->displayTime_ != INF && this->tickTime_ >= 1.0) // If the time counter is greater than 1 s all Notifications that have expired are removed, if it is smaller we wait to the next tick.
{
- this->timeLimit_.time = std::time(0)-this->displayTime_; // Container containig the current time.
+ this->timeLimit_.time = std::time(0)-this->displayTime_; // Container containing the current time.
std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator it = this->ordering_.begin();
// Iterate through all elements whose creation time is smaller than the current time minus the display time.
@@ -176,10 +162,34 @@
}
}
+ void NotificationQueue::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(NotificationQueue, XMLPort, xmlelement, mode);
+
+ XMLPortParam(NotificationQueue, "targets", setTargets, getTargets, xmlelement, mode).defaultValues(NotificationListener::ALL);
+ XMLPortParam(NotificationQueue, "size", setMaxSize, getMaxSize, xmlelement, mode);
+ XMLPortParam(NotificationQueue, "displayTime", setDisplayTime, getDisplayTime, xmlelement, mode);
+ }
+
+
/**
@brief
+ Registers Variables to be Synchronised.
+ Registers Variables which have to be synchronised to the network system.
+ */
+ void NotificationQueue::registerVariables()
+ {
+ registerVariable( this->name_, VariableDirection::ToClient, new NetworkCallback<NotificationQueue>(this, &NotificationQueue::changedName));
+ registerVariable( this->maxSize_, VariableDirection::ToClient, new NetworkCallback<NotificationQueue>(this, &NotificationQueue::maxSizeChanged));
+ registerVariable( this->targets_, VariableDirection::ToClient, new NetworkCallback<NotificationQueue>(this, &NotificationQueue::targetsChanged));
+ registerVariable( this->displayTime_, VariableDirection::ToClient, new NetworkCallback<NotificationQueue>(this, &NotificationQueue::displayTimeChanged));
+ }
+
+ /**
+ @brief
Updates the NotificationQueue.
Updates by clearing the queue and requesting all relevant Notifications from the NotificationManager and inserting them into the queue.
+ This is called by the NotificationManager when the Notifications have changed so much, that the NotificationQueue may have to re-initialize his operations.
*/
void NotificationQueue::update(void)
{
@@ -187,13 +197,19 @@
std::multimap<std::time_t, Notification*>* notifications = new std::multimap<std::time_t, Notification*>;
// Get the Notifications sent in the interval from now to now minus the display time.
- NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_);
+ if(this->displayTime_ == INF)
+ NotificationManager::getInstance().getNewestNotifications(this, notifications, this->getMaxSize());
+ else
+ NotificationManager::getInstance().getNotifications(this, notifications, this->displayTime_);
if(!notifications->empty())
{
- // Add all Notifications.
+ // Add all Notifications that have been created after this NotificationQueue was created.
for(std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)
- this->push(it->second, it->first);
+ {
+ if(it->first >= this->creationTime_)
+ this->push(it->second, it->first);
+ }
}
delete notifications;
@@ -221,7 +237,7 @@
/**
@brief
Adds (pushes) a Notification to the NotificationQueue.
- It inserts it into the storage containers, creates a corresponding container and pushes the Notification message to the GUI.
+ It inserts it into the storage containers, creates a corresponding container and pushes the notification message to the GUI.
@param notification
The Notification to be pushed.
@param time
@@ -245,11 +261,11 @@
// Insert the Notification at the begin of the list (vector, actually).
this->notifications_.insert(this->notifications_.begin(), container);
- // Push the Notification to the GUI.
- if(GameMode::showsGraphics())
- GUIManager::getInstance().getLuaState()->doString("NotificationLayer.pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")");
+ // Inform that a Notification was pushed.
+ this->notificationPushed(notification);
COUT(5) << "Notification \"" << notification->getMessage() << "\" pushed to NotificationQueue '" << this->getName() << "'" << endl;
+ COUT(3) << "NotificationQueue \"" << this->getName() << "\": " << notification->getMessage() << endl;
}
/**
@@ -278,9 +294,8 @@
delete container;
- // Pops the Notification from the GUI.
- if(GameMode::showsGraphics())
- GUIManager::getInstance().getLuaState()->doString("NotificationLayer.popNotification(\"" + this->getName() + "\")");
+ // Inform that a Notification was popped.
+ this->notificationPopped();
}
/**
@@ -304,16 +319,16 @@
delete *containerIterator;
- // Removes the Notification from the GUI.
- if(GameMode::showsGraphics())
- GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")");
+ // TODO: index automatically cast?
+ // Inform that a Notification was removed.
+ this->notificationRemoved(index);
}
/**
@brief
Clears the NotificationQueue by removing all NotificationContainers.
@param noGraphics
- If this is eset to true the GUI is not informed of the clearing of the NotificationQueue. This is needed only internally.
+ If this is set to true the GUI is not informed of the clearing of the NotificationQueue. This is needed only internally.
*/
void NotificationQueue::clear(bool noGraphics)
{
@@ -325,10 +340,6 @@
this->notifications_.clear();
this->size_ = 0;
-
- // Clear the NotificationQueue in the GUI.
- if(GameMode::showsGraphics() && !noGraphics)
- GUIManager::getInstance().getLuaState()->doString("NotificationLayer.clearQueue(\"" + this->getName() + "\")");
}
/**
@@ -353,9 +364,23 @@
if(this->maxSize_ == size)
return;
+ if(size == 0)
+ {
+ COUT(2) << "Trying to set maximal size of NotificationQueue '" << this->getName() << "' to 0. Ignoring..." << endl;
+ return;
+ }
+
this->maxSize_ = size;
+ this->maxSizeChanged();
+ }
- if(this->registered_)
+ /**
+ @brief
+ Is called when the maximum number of displayed Notifications has changed.
+ */
+ void NotificationQueue::maxSizeChanged(void)
+ {
+ if(this->isRegistered())
this->update();
}
@@ -363,24 +388,35 @@
@brief
Sets the maximum number of seconds a Notification is displayed.
@param time
- The number of seconds the Notifications is displayed.
- @return
- Returns true if successful.
+ The number of seconds a Notification is displayed.
*/
- void NotificationQueue::setDisplayTime(unsigned int time)
+ void NotificationQueue::setDisplayTime(int time)
{
if(this->displayTime_ == time)
return;
+ if(time != NotificationQueue::INF && time <= 0)
+ {
+ COUT(2) << "Trying to set display time of NotificationQueue '" << this->getName() << "' to non-positive value. Ignoring..." << endl;
+ }
+
this->displayTime_ = time;
+ this->displayTimeChanged();
+ }
- if(this->registered_)
+ /**
+ @brief
+ Is called when the maximum number of seconds a Notification is displayed has changed.
+ */
+ void NotificationQueue::displayTimeChanged(void)
+ {
+ if(this->isRegistered())
this->update();
}
/**
@brief
- Produces all targets of the NotificationQueue concatinated as string, with commas (',') as seperators.
+ Produces all targets of the NotificationQueue concatenated as string, with commas (',') as separators.
@return
Returns the targets as a string.
*/
@@ -406,7 +442,7 @@
Sets the targets of the NotificationQueue.
The targets are the senders whose Notifications are displayed in this queue.
@param targets
- Accepts a string of targets, each seperated by commas (','), spaces are ignored.
+ Accepts a string of targets, each separated by commas (','), spaces are ignored.
*/
void NotificationQueue::setTargets(const std::string & targets)
{
@@ -416,12 +452,35 @@
for(unsigned int i = 0; i < string.size(); i++)
this->targets_.insert(string[i]);
- if(this->registered_)
+ this->targetsChanged();
+ }
+
+ /**
+ @brief
+ Is called when the NotificationQueue's targets have changed.
+ */
+ void NotificationQueue::targetsChanged(void)
+ {
+ // TODO: Why?
+ if(this->isRegistered())
{
- NotificationManager::getInstance().unregisterListener(this);
- NotificationManager::getInstance().registerListener(this);
+ NotificationManager::getInstance().unregisterQueue(this);
+ NotificationManager::getInstance().registerQueue(this);
}
}
+ /**
+ @brief
+ Pops all Notifications from the NotificationQueue.
+ @return
+ Returns true if successful, false if not.
+ */
+ bool NotificationQueue::tidy(void)
+ {
+ while(this->size_ > 0)
+ this->pop();
+ return true;
+ }
+
}
Modified: code/trunk/src/modules/notifications/NotificationQueue.h
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueue.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/NotificationQueue.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -44,11 +44,12 @@
#include "NotificationManager.h"
+#include "core/BaseObject.h"
#include "tools/interfaces/Tickable.h"
-#include "interfaces/NotificationListener.h"
+#include "network/synchronisable/Synchronisable.h"
-namespace orxonox // tolua_export
-{ // tolua_export
+namespace orxonox
+{
/**
@brief
@@ -77,7 +78,7 @@
@brief
Displays @ref orxonox::Notification "Notifications" from specific senders.
- There are quite some parameters that influence the behaviour of the NotificationQueue:
+ There are quite some parameters that influence the behavior of the NotificationQueue:
- @b name The name of the NotificationQueue. It needs to be unique.
- @b senders The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays.
- @b size The size of the NotificationQueue, it specifies how many @ref orxonox::Notification "Notifications" are displayed at once at the most.
@@ -88,75 +89,108 @@
@ingroup Notifications
*/
- class _NotificationsExport NotificationQueue // tolua_export
- : public Tickable, public NotificationListener
- { // tolua_export
+ class _NotificationsExport NotificationQueue : public BaseObject, public Tickable, public Synchronisable
+ {
public:
- NotificationQueue(const std::string& name, const std::string& senders = NotificationManager::ALL, unsigned int size = NotificationQueue::DEFAULT_SIZE, unsigned int displayTime = NotificationQueue::DEFAULT_DISPLAY_TIME);
+ NotificationQueue(BaseObject* creator);
virtual ~NotificationQueue();
- //! Destroys the NotificationQueue.
- void destroy(bool noGraphics = false); // tolua_export
+ virtual void tick(float dt); // To update from time to time.
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- virtual void tick(float dt); //!< To update from time to time.
+ virtual void changedName(void);
+
+ void update(void); // Updates the NotificationQueue.
+ void update(Notification* notification, const std::time_t & time); // Updates the NotificationQueue by adding an new Notification.
- void update(void); //!< Updates the NotificationQueue.
- void update(Notification* notification, const std::time_t & time); //!< Updates the NotificationQueue by adding an new Notification.
-
// tolua_begin
/**
@brief Get the name of the NotificationQueue.
@return Returns the name.
*/
- inline const std::string& getName() const
- { return this->name_; }
+ inline const std::string& getName(void) const
+ { return this->BaseObject::getName(); }
- void setMaxSize(unsigned int size); //!< Sets the maximum number of displayed Notifications.
+ void setMaxSize(unsigned int size); // Sets the maximum number of displayed Notifications.
/**
@brief Returns the maximum number of Notifications displayed.
@return Returns maximum size.
*/
- inline unsigned int getMaxSize() const
+ inline unsigned int getMaxSize(void) const
{ return this->maxSize_; }
- void setDisplayTime(unsigned int time); //!< Sets the maximum number of seconds a Notification is displayed.
+ void setDisplayTime(int time); // Sets the maximum number of seconds a Notification is displayed.
/**
@brief Returns the time interval the Notification is displayed.
@return Returns the display time.
*/
- inline unsigned int getDisplayTime() const
+ inline int getDisplayTime(void) const
{ return this->displayTime_; }
// tolua_end
+ void maxSizeChanged(void); // Is called when the maximum number of displayed Notifications has changed.
+ void displayTimeChanged(void);
/**
@brief Returns the current number of Notifications displayed.
@return Returns the size of the NotificationQueue.
*/
- inline unsigned int getSize() const
+ inline unsigned int getSize(void) const
{ return this->size_; }
/**
@brief Returns the targets of this NotificationQueue, reps. the senders which Notifications are displayed in this NotificationQueue.
@return Returns a set of strings holding the different targets.
*/
- inline const std::set<std::string> & getTargetsSet()
+ inline const std::set<std::string> & getTargetsSet(void)
{ return this->targets_; }
- // tolua_begin
- void setTargets(const std::string & targets); //!< Set the targets of this NotificationQueue.
- const std::string& getTargets(void) const; //!< Returns a string consisting of the concatination of the targets.
- // tolua_end
+ void setTargets(const std::string & targets); // Set the targets of this NotificationQueue.
+ const std::string& getTargets(void) const; // Returns a string consisting of the concatenation of the targets.
+ void targetsChanged(void); // Is called when the NotificationQueue's targets have changed.
- private:
+ /**
+ @brief Check whether the NotificationQueue is registered with the NotificationManager.
+ @return Returns true if it is registered, false if not.
+ */
+ inline bool isRegistered(void)
+ { return this->registered_; }
+
+ bool tidy(void); // Pops all Notifications from the NotificationQueue.
+
+ protected:
+ void registerVariables();
+
+ /**
+ @brief Is called when a notification was pushed.
+ @param notification The Notification that was pushed.
+ */
+ virtual void notificationPushed(Notification* notification) {}
+ /**
+ @brief Is called when a notification was popped.
+ */
+ virtual void notificationPopped(void) {}
+ /**
+ @brief Is called when a notification was removed.
+ @param index The index the removed notification was at.
+ */
+ virtual void notificationRemoved(unsigned int index) {}
+
+ virtual void clear(bool noGraphics = false); // Clears the NotificationQueue by removing all NotificationContainers.
+
+ protected:
static const unsigned int DEFAULT_SIZE = 5; //!< The default maximum number of Notifications displayed.
static const unsigned int DEFAULT_DISPLAY_TIME = 30; //!< The default display time.
+ static const int INF = -1; //!< Constant denoting infinity.
- std::string name_; //!< The name of the NotificationQueue.
+ virtual void create(void); // Creates the NotificationQueue.
+ private:
+ time_t creationTime_; //!< The time this NotificationQueue was created.
+
unsigned int maxSize_; //!< The maximal number of Notifications displayed.
unsigned int size_; //!< The number of Notifications displayed.
- unsigned int displayTime_; //!< The time a Notification is displayed.
+ int displayTime_; //!< The time a Notification is displayed.
bool registered_; //!< Helper variable to remember whether the NotificationQueue is registered already.
@@ -168,18 +202,14 @@
float tickTime_; //!< Helper variable, to not have to check for Notifications that have been displayed too long, every tick.
NotificationContainer timeLimit_; //!< Helper object to check against to determine whether Notifications have expired.
- void create(void); //!< Creates the NotificationQueue in lua.
-
void setName(const std::string& name); //!< Sets the name of the NotificationQueue.
- void push(Notification* notification, const std::time_t & time); //!< Adds (pushes) a Notification to the NotificationQueue.
- void pop(void); //!< Removes (pops) the least recently added Notification form the NotificationQueue.
- void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); //!< Removes the Notification that is stored in the input NotificationContainer.
+ void push(Notification* notification, const std::time_t & time); // Adds (pushes) a Notification to the NotificationQueue.
+ void pop(void); // Removes (pops) the least recently added Notification form the NotificationQueue.
+ void remove(const std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator& containerIterator); // Removes the Notification that is stored in the input NotificationContainer.
- void clear(bool noGraphics = false); //!< Clears the NotificationQueue by removing all NotificationContainers.
+ };
- }; // tolua_export
+}
-} // tolua_export
-
-#endif /* _NotificationOverlay_H__ */
+#endif /* _NotificationQueue_H__ */
Copied: code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc (from rev 8705, code/branches/presentation/src/modules/notifications/NotificationQueueCEGUI.cc)
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc (rev 0)
+++ code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,373 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file NotificationQueueCEGUI.cc
+ @brief Implementation of the NotificationQueueCEGUI class.
+*/
+
+#include "NotificationQueueCEGUI.h"
+
+#include <sstream>
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "core/GUIManager.h"
+#include "core/LuaState.h"
+#include "core/XMLPort.h"
+#include "util/Convert.h"
+
+#include "ToluaBindNotifications.h"
+
+namespace orxonox
+{
+
+ CreateFactory(NotificationQueueCEGUI);
+
+ // Register tolua_open function when loading the library.
+ DeclareToluaInterface(Notifications);
+
+ /*static*/ const std::string NotificationQueueCEGUI::NOTIFICATION_LAYER("NotificationLayer");
+
+ NotificationQueueCEGUI::NotificationQueueCEGUI(BaseObject* creator) : NotificationQueue(creator)
+ {
+ RegisterObject(NotificationQueueCEGUI);
+
+ this->initialize();
+ this->registerVariables();
+ }
+
+ NotificationQueueCEGUI::~NotificationQueueCEGUI()
+ {
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() + "\")");
+ }
+
+ /**
+ @brief
+ Initializes The NotificationQueueCEGUI.
+ */
+ void NotificationQueueCEGUI::initialize(void)
+ {
+ this->displaySize_ = Vector4(1.0, 0.0, 0.0, 0.0);
+ this->position_ = Vector4(0.0, 0.0, 0.0, 0.0);
+ this->alignment_ = "LeftAligned";
+ this->fontSize_ = 12;
+ this->fontColor_ = Vector4(1.0, 1.0, 1.0, 1.0);
+ this->fontColorStr_ = "FFFFFFFF";
+ }
+
+ void NotificationQueueCEGUI::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(NotificationQueueCEGUI, XMLPort, xmlelement, mode);
+
+ XMLPortParam(NotificationQueueCEGUI, "position", setPosition, getPosition, xmlelement, mode);
+ XMLPortParam(NotificationQueueCEGUI, "fontSize", setFontSize, getFontSize, xmlelement, mode);
+ XMLPortParam(NotificationQueueCEGUI, "fontColor", setFontColor, getFontColor, xmlelement, mode);
+ XMLPortParam(NotificationQueueCEGUI, "alignment", setAlignment, getAlignment, xmlelement, mode);
+ XMLPortParam(NotificationQueueCEGUI, "displaySize", setDisplaySize, getDisplaySize, xmlelement, mode);
+ }
+
+ void NotificationQueueCEGUI::registerVariables()
+ {
+ registerVariable( this->position_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::positionChanged));
+ registerVariable( this->fontSize_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::fontSizeChanged));
+ registerVariable( this->fontColor_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::fontColorChanged));
+ registerVariable( this->alignment_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::alignmentChanged));
+ registerVariable( this->displaySize_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::displaySizeChanged));
+ }
+
+ void NotificationQueueCEGUI::changedName(void)
+ {
+ SUPER(NotificationQueueCEGUI, changedName);
+
+ this->positionChanged();
+ this->fontSizeChanged();
+ this->fontColorChanged();
+ this->alignmentChanged();
+ this->displaySizeChanged();
+ }
+
+ /**
+ @brief
+ Destroys the NotificationQueueCEGUI.
+ Used in lua and NotificationManager.
+ @param noGraphics
+ If this is set to true (false is default), then the queue is not removed in lua. This is used to destroy the queue, after the GUIManager has been destroyed.
+ */
+ void NotificationQueueCEGUI::destroy(bool noGraphics)
+ {
+ // Remove the NotificationQueue in lua.
+ if(this->isRegistered() && GameMode::showsGraphics() && !noGraphics)
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() + "\")");
+
+ NotificationQueue::destroy();
+ }
+
+ /**
+ @brief
+ Set the size of the window that displays the NotificationQueue.
+ @param size
+ The size is a vector with components:
+ - The relative width of the window. (A value between 0 and 1)
+ - The absolute width in pixels. (Additional to the relative width, can be negative)
+ - The relative height of the window. (A value between 0 and 1)
+ - The absolute height in pixels. (Additional to the relative width, can be negative.)
+ If both the 3rd and 4th component of size are set to 0 the height is set such that exactly as many Notifications fit as is the maximum size of the NotificationQueue (in terms of the number of Notifications).
+ */
+ void NotificationQueueCEGUI::setDisplaySize(const Vector4& size)
+ {
+ if(this->displaySize_ == size)
+ return;
+
+ if(size.x < 0.0 || size.x > 1.0 || size.z < 0.0 || size.z > 1.0)
+ {
+ COUT(2) << "The display size of the NotificationQueueCEGUI " << this->getName() << " was trying to be set, but the relative size was not in [0,1]. Aborting..." << endl;
+ return;
+ }
+
+ this->displaySize_ = size;
+ this->displaySizeChanged();
+ }
+
+ /**
+ @brief
+ Is called when the display size has changed.
+ */
+ void NotificationQueueCEGUI::displaySizeChanged(void)
+ {
+ if(this->isRegistered() && GameMode::showsGraphics())
+ {
+ if(this->displaySize_.z == 0.0 && this->displaySize_.w == 0.0)
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".resizeQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->displaySize_.x) + ", " + multi_cast<std::string>(this->displaySize_.y) + ")");
+ else
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".resizeQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->displaySize_.x) + ", " + multi_cast<std::string>(this->displaySize_.y) + ", " + multi_cast<std::string>(this->displaySize_.z) + ", " + multi_cast<std::string>(this->displaySize_.w) + ")");
+ }
+ }
+
+ /**
+ @brief
+ Set the position of the window that displays the NotificationQueue.
+ @param position
+ The position is a vector with components:
+ - The relative x-position of the window. (A value between 0 and 1)
+ - The absolute x-position in pixels. (Additional to the relative x-position, can be negative)
+ - The relative y-position of the window. (A value between 0 and 1)
+ - The absolute y-position in pixels. (Additional to the relative y-position, can be negative.)
+ */
+ void NotificationQueueCEGUI::setPosition(const Vector4& position)
+ {
+ if(this->position_ == position)
+ return;
+
+ if(position.x < 0.0 || position.x > 1.0 || position.z < 0.0 || position.z > 1.0)
+ {
+ COUT(2) << "The position the NotificationQueueCEGUI " << this->getName() << " was trying to be set, but the relative position was not in [0,1]. Aborting..." << endl;
+ return;
+ }
+
+ this->position_ = position;
+ this->positionChanged();
+ }
+
+ /**
+ @brief
+ Is called when the NotificationQueue's position has changed.
+ */
+ void NotificationQueueCEGUI::positionChanged(void)
+ {
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".moveQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->position_.x) + ", " + multi_cast<std::string>(this->position_.y) + ", " + multi_cast<std::string>(this->position_.z) + ", " + multi_cast<std::string>(this->position_.w) + ")");
+ }
+
+ /**
+ @brief
+ Set the horizontal alignment of the Notifications text.
+ @param alignment
+ The alignment of the Notifications, they are the possible string that the CEGUI Falagard StaticText HorzFormatting property can take.
+ @see http://cegui.org.uk/api_reference/classCEGUI_1_1FalagardStaticTextProperties_1_1HorzFormatting.html
+ */
+ void NotificationQueueCEGUI::setAlignment(const std::string& alignment)
+ {
+ if(this->alignment_ == alignment)
+ return;
+
+ // TODO: Check whether the alignment string is correct?
+ this->alignment_ = alignment;
+ this->alignmentChanged();
+ }
+
+ /**
+ @brief
+ Is called when the horizontal alignment of the Notifications text has changed.
+ */
+ void NotificationQueueCEGUI::alignmentChanged(void)
+ {
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueAlignment(\"" + this->getName() + "\", \"" + this->alignment_ + "\")");
+ }
+
+ /**
+ @brief
+ Set the font size of the text displayed by this NotificationQueue.
+ @param size
+ The font size.
+ */
+ void NotificationQueueCEGUI::setFontSize(unsigned int size)
+ {
+ if(this->fontSize_ == size)
+ return;
+
+ this->fontSize_ = size;
+ this->fontSizeChanged();
+ }
+
+ /**
+ @brief
+ Is called when the font size of the text displayed by this NotificationQueue has changed.
+ */
+ void NotificationQueueCEGUI::fontSizeChanged(void)
+ {
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontSize(\"" + this->getName() + "\", " + multi_cast<std::string>(this->fontSize_) + ")");
+ }
+
+ /**
+ @brief
+ Set the font color if the text displayed by this NotificationQueue.
+ @param color
+ The color is a vector with the components being RGBA and taking values from 0 to 1.
+ */
+ void NotificationQueueCEGUI::setFontColor(const Vector4& color)
+ {
+ if(this->fontColor_ == color)
+ return;
+
+ this->fontColor_ = color;
+ this->fontColorChanged();
+ }
+
+ /**
+ @brief
+ Is called when the font color if the text displayed by this NotificationQueue.
+ */
+ void NotificationQueueCEGUI::fontColorChanged(void)
+ {
+ // Convert to ARGB format.
+ std::stringstream stream;
+ for(unsigned int i = 0; i < 4; i++)
+ stream << std::hex << std::setw(2) << std::setfill('0') << int(this->fontColor_[(i+3)%4]*255);
+ this->fontColorStr_ = stream.str();
+
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontColor(\"" + this->getName() + "\", \"" + this->fontColorStr_ + "\")");
+ }
+
+ /**
+ @brief
+ Get the NotificationQueueCEGUI with the input name.
+ @param name
+ The name of the NotificationQueueCEGUI to be got.
+ @return
+ Returns a pointer to the NotificationQueueCEGUI, or NULL if it doesn't exist.
+ */
+ /*static*/ NotificationQueueCEGUI* NotificationQueueCEGUI::getQueue(const std::string& name)
+ {
+ NotificationQueue* queue = NotificationManager::getInstance().getQueue(name);
+ if(queue == NULL || !queue->isA(Class(NotificationQueueCEGUI)))
+ return NULL;
+ return static_cast<NotificationQueueCEGUI*>(queue);
+ }
+
+ /**
+ @brief
+ Is called by the NotificationQueue when a Notification was pushed.
+ @param notification
+ The Notification that was pushed.
+ */
+ void NotificationQueueCEGUI::notificationPushed(Notification* notification)
+ {
+ // Push the Notification to the GUI.
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")");
+ }
+
+ /**
+ @brief
+ Is called by the NotificationQueue when a Notification was popped.
+ */
+ void NotificationQueueCEGUI::notificationPopped(void)
+ {
+ // Pops the Notification from the GUI.
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".popNotification(\"" + this->getName() + "\")");
+ }
+
+ /**
+ @brief Is called when a notification was removed.
+ @param index The index the removed Notification was at.
+ */
+ void NotificationQueueCEGUI::notificationRemoved(unsigned int index)
+ {
+ // Removes the Notification from the GUI.
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")");
+ }
+
+ /**
+ @brief
+ Clears the NotificationQueue by removing all NotificationContainers.
+ @param noGraphics
+ If this is set to true the GUI is not informed of the clearing of the NotificationQueue. This is needed only internally.
+ */
+ void NotificationQueueCEGUI::clear(bool noGraphics)
+ {
+ NotificationQueue::clear(noGraphics);
+
+ // Clear the NotificationQueue in the GUI.
+ if(this->isRegistered() && GameMode::showsGraphics() && !noGraphics)
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".clearQueue(\"" + this->getName() + "\")");
+ }
+
+ /**
+ @brief
+ Creates the NotificationQueue in lua.
+ */
+ void NotificationQueueCEGUI::create(void)
+ {
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".removeQueue(\"" + this->getName() + "\")");
+
+ this->NotificationQueue::create();
+
+ if(this->isRegistered() && GameMode::showsGraphics())
+ GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".createQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->getMaxSize()) + ")");
+ }
+
+}
+
Copied: code/trunk/src/modules/notifications/NotificationQueueCEGUI.h (from rev 8705, code/branches/presentation/src/modules/notifications/NotificationQueueCEGUI.h)
===================================================================
--- code/trunk/src/modules/notifications/NotificationQueueCEGUI.h (rev 0)
+++ code/trunk/src/modules/notifications/NotificationQueueCEGUI.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,163 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file NotificationQueueCEGUI.h
+ @brief Definition of the NotificationQueueCEGUI class.
+ @ingroup Notifications
+*/
+
+#ifndef _NotificationOueueCEGUI_H__
+#define _NotificationOueueCEGUI_H__
+
+#include "notifications/NotificationsPrereqs.h"
+
+#include <string>
+#include "util/Math.h"
+
+#include "NotificationManager.h"
+
+#include "NotificationQueue.h"
+
+namespace orxonox // tolua_export
+{ // tolua_export
+
+ /**
+ @brief
+ Displays @ref orxonox::Notification "Notifications" using CEGUI.
+
+ Apart form the parameters inherited by the @ref orxonox::NotificationQueue "NotificationQueue", there are some more parameters that influence the behavior of the NotificationQueueCEGUI:
+ - @b displaySize The size of the window that displays the NotificationQueue.
+ - @b position The position if the window that displays the NotificationQueue.
+ - @b alignment The horizontal alignment of the displayed Notifications.
+ - @b fontSize The font size of the displayed Notifications.
+ - @b fontColor The font color of the displayed Notifications.
+
+ @author
+ Damian 'Mozork' Frick
+
+ @see NotificationQueue
+ @ingroup Notifications
+ */
+ class _NotificationsExport NotificationQueueCEGUI // tolua_export
+ : public NotificationQueue
+ { // tolua_export
+
+ public:
+ NotificationQueueCEGUI(BaseObject* creator);
+ virtual ~NotificationQueueCEGUI();
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ virtual void changedName(void);
+
+ void destroy(bool noGraphics = false); // Destroys the NotificationQueue.
+
+ void setDisplaySize(const Vector4& size); // Set the size of the window that displays the NotificationQueue.
+
+ /**
+ @brief Get the size of the window that displays the NotificationQueue.
+ @return Returns a vector with the display size.
+ */
+ inline const Vector4& getDisplaySize(void) const
+ { return this->displaySize_; }
+ void displaySizeChanged(void); // Is called when the display size has changed.
+
+ void setPosition(const Vector4& position); // Set the position of the window that displays the NotificationQueue.
+ /**
+ @brief Get the position of the window that displays the NotificationQueue.
+ @return Returns a vector with the position.
+ */
+ inline const Vector4& getPosition(void) const
+ { return this->position_; }
+ void positionChanged(void); // Is called when the NotificationQueue's position has changed.
+
+ void setAlignment(const std::string& alignment); // Set the horizontal alignment of the Notifications text.
+ /**
+ @brief Get the horizontal alignment of the Notifications text.
+ @return Returns a string with the horizontal alignment property.
+ */
+ inline const std::string& getAlignment(void)
+ { return this->alignment_; }
+ void alignmentChanged(void); // Is called when the horizontal alignment of the Notifications text has changed.
+
+ void setFontSize(unsigned int size); // Set the font size of the text displayed by this NotificationQueue.
+ /**
+ @brief Get the font size of the text displayed by this NotificationQueue.
+ @return Returns the font size.
+ */
+ inline unsigned int getFontSize(void)
+ { return this->fontSize_; }
+ void fontSizeChanged(void); // Is called when the font size of the text displayed by this NotificationQueue has changed.
+
+ void setFontColor(const Vector4& color); // Set the font color if the text displayed by this NotificationQueue.
+ /**
+ @brief Get the font color of the text displayed by this NotificationQueue.
+ @return Returns a vector with the components being RGBA, with values from 0 to 1.
+ */
+ inline const Vector4& getFontColor(void) const
+ { return this->fontColor_; }
+ /**
+ @brief Get the font color of the text displayed by this NotificationQueue.
+ @return Returns a string with the ARGB values in hexadecimal format.
+ */
+ inline const std::string& getFontColorStr(void) const
+ { return this->fontColorStr_; }
+ void fontColorChanged(void); // Is called when the font color if the text displayed by this NotificationQueue has changed.
+
+ static NotificationQueueCEGUI* getQueue(const std::string& name); // tolua_export // Get the NotificationQueueCEGUI with the input name.
+
+ protected:
+ void registerVariables();
+
+ virtual void create(void); // Creates the NotificationQueue in lua.
+
+ virtual void notificationPushed(Notification* notification); // Is called by the NotificationQueue when a Notification was pushed
+ virtual void notificationPopped(void); // Is called by the NotificationQueue when a Notification was popped.
+ virtual void notificationRemoved(unsigned int index); // Is called when a Notification was removed.
+
+ virtual void clear(bool noGraphics = false); // Clears the NotificationQueue by removing all NotificationContainers.
+
+ protected:
+ static const std::string NOTIFICATION_LAYER; //!< The name of the NotificationLayer menu sheet.
+
+ private:
+ Vector4 displaySize_; //!< The size of the window that displays the NotificationQueue.
+ Vector4 position_; //!< The position of the window that displays the NotificationQueue.
+ std::string alignment_; //!< The horizontal alignment of the Notifications text.
+ unsigned int fontSize_; //!< The font size of the Notifications text.
+ Vector4 fontColor_; //!< The font color of the Notifications text as a vector, in RGBA form, with values from 0 to 1.
+ std::string fontColorStr_; //!< The font color of the Notifications text as a string with the ARGB hexadecimal values.
+
+ void initialize(void); // Initializes The NotificationQueueCEGUI.
+
+ }; // tolua_export
+
+} // tolua_export
+
+#endif /* _NotificationQueueCEGUI_H__ */
Modified: code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc
===================================================================
--- code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/notifications/dispatchers/SimpleNotification.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -50,7 +50,7 @@
this->setSender("simpleNotification");
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
}
/**
Modified: code/trunk/src/modules/objects/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/objects/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -3,6 +3,7 @@
ForceField.cc
Planet.cc
Script.cc
+ SpaceBoundaries.cc
)
ADD_SUBDIRECTORY(collisionshapes)
Modified: code/trunk/src/modules/objects/ObjectsPrereqs.h
===================================================================
--- code/trunk/src/modules/objects/ObjectsPrereqs.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/ObjectsPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -71,6 +71,7 @@
class ForceField;
class Planet;
class Script;
+ class SpaceBoundaries;
// collisionshapes
class BoxCollisionShape;
Modified: code/trunk/src/modules/objects/Script.cc
===================================================================
--- code/trunk/src/modules/objects/Script.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/Script.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -139,7 +139,7 @@
COUT(4) << "Script (&" << this << ") triggered." << std::endl;
PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
- Pawn* pawn = NULL;
+ PlayerInfo* player = NULL;
// If the trigger is a PlayerTrigger.
if(pTrigger != NULL)
@@ -147,26 +147,17 @@
if(!pTrigger->isForPlayer()) // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
return false;
else
- pawn = pTrigger->getTriggeringPlayer();
+ player = pTrigger->getTriggeringPlayer();
}
else
return false;
- if(pawn == NULL) //TODO: Will this ever happen? If not, change in NotificationDispatcher as well.
+ if(player == NULL) //TODO: Will this ever happen? If not, change in NotificationDispatcher as well.
{
COUT(4) << "The Script was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
return false;
}
- // Extract the PlayerInfo from the Pawn.
- PlayerInfo* player = pawn->getPlayer();
-
- if(player == NULL)
- {
- COUT(3) << "The PlayerInfo* is NULL." << std::endl;
- return false;
- }
-
this->execute(player->getClientID());
return true;
}
Copied: code/trunk/src/modules/objects/SpaceBoundaries.cc (from rev 8705, code/branches/presentation/src/modules/objects/SpaceBoundaries.cc)
===================================================================
--- code/trunk/src/modules/objects/SpaceBoundaries.cc (rev 0)
+++ code/trunk/src/modules/objects/SpaceBoundaries.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,322 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Maurus Kaufmann
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "SpaceBoundaries.h"
+
+#include <OgreBillboardSet.h>
+
+#include "core/CoreIncludes.h"
+#include "core/ObjectListIterator.h"
+#include "core/XMLPort.h"
+
+#include "graphics/Billboard.h"
+#include "infos/PlayerInfo.h"
+#include "worldentities/WorldEntity.h"
+#include "worldentities/pawns/Pawn.h"
+
+namespace orxonox
+{
+ CreateFactory(SpaceBoundaries);
+
+ SpaceBoundaries::SpaceBoundaries(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(SpaceBoundaries);
+
+ this->setMaxDistance(3000);
+ this->setWarnDistance(this->getMaxDistance());
+ this->setShowDistance(this->getMaxDistance());
+ this->setReaction(0);
+ }
+ SpaceBoundaries::~SpaceBoundaries()
+ {
+ if (this->isInitialized())
+ {
+ this->pawnsIn_.clear();
+
+ for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)
+ {
+ if( current->billy != NULL)
+ {
+ delete current->billy;
+ }
+ }
+ this->billboards_.clear();
+ }
+ }
+
+ void SpaceBoundaries::checkWhoIsIn()
+ {
+ pawnsIn_.clear();
+ for(ObjectListIterator<Pawn> current = ObjectList<Pawn>::begin(); current != ObjectList<Pawn>::end(); ++current)
+ {
+ Pawn* currentPawn = *current;
+ if( this->reaction_ == 0 )
+ {
+ float distance = this->computeDistance(currentPawn);
+ if(distance <= this->maxDistance_)
+ {
+ pawnsIn_.push_back(currentPawn);
+ }
+ } else if (this->reaction_ == 2) {
+ float distance = this->computeDistance(currentPawn);
+ if(distance >= this->maxDistance_)
+ {
+ pawnsIn_.push_back(currentPawn);
+ }
+ } else {
+ pawnsIn_.push_back(currentPawn);
+ }
+ }
+ }
+
+ void SpaceBoundaries::positionBillboard(const Vector3& position, float alpha)
+ {
+ size_t current;
+ for (current = 0; current < this->billboards_.size(); ++current)
+ if (!this->billboards_[current].usedYet)
+ break;
+
+ if (current == this->billboards_.size())
+ {
+ Billboard* billboard = new Billboard(this);
+ billboard->setPosition(position);
+ billboard->setSyncMode(ObjectDirection::None);
+ this->setBillboardOptions(billboard);
+ BillboardAdministration ba = {true, billboard};
+ this->billboards_.push_back(ba);
+ }
+
+ this->billboards_[current].billy->setPosition(position);
+ this->billboards_[current].billy->setVisible(true);
+ this->billboards_[current].billy->setColour(ColourValue(1, 1, 1, alpha));
+ this->billboards_[current].usedYet = true;
+
+ Vector3 directionVector = (this->getPosition() - position).normalisedCopy(); // vector from the position of the billboard to the center of the sphere
+ this->billboards_[current].billy->setCommonDirection(directionVector);
+
+ Vector3 upVector = Vector3(directionVector.z, directionVector.z, -(directionVector.x + directionVector.y)); // vector perpendicular to the direction vector
+ upVector.normalise();
+ this->billboards_[current].billy->setCommonUpVector(upVector);
+ }
+
+ void SpaceBoundaries::setBillboardOptions(Billboard *billy)
+ {
+ if(billy != NULL)
+ {
+ billy->setMaterial("Grid");
+ billy->setBillboardType(Ogre::BBT_PERPENDICULAR_COMMON);
+ billy->setDefaultDimensions(150, 150);
+ billy->setVisible(true);
+ }
+ }
+
+ void SpaceBoundaries::removeAllBillboards()
+ {
+ for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++ )
+ {
+ current->usedYet = false;
+ current->billy->setVisible(false);
+ }
+ }
+
+ void SpaceBoundaries::setMaxDistance(float r)
+ {
+ this->maxDistance_ = r;
+ }
+ float SpaceBoundaries::getMaxDistance()
+ {
+ return this->maxDistance_;
+ }
+
+ void SpaceBoundaries::setWarnDistance(float r)
+ {
+ this->warnDistance_ = r;
+ }
+ float SpaceBoundaries::getWarnDistance()
+ {
+ return this->warnDistance_;
+ }
+
+ void SpaceBoundaries::setShowDistance(float r)
+ {
+ this->showDistance_ = r;
+ }
+ float SpaceBoundaries::getShowDistance()
+ {
+ return this->showDistance_;
+ }
+
+ void SpaceBoundaries::setHealthDecrease(float amount)
+ {
+ this->healthDecrease_ = amount/1000;
+ }
+ float SpaceBoundaries::getHealthDecrease()
+ {
+ return this->healthDecrease_;
+ }
+
+ void SpaceBoundaries::setReaction(int mode)
+ {
+ this->reaction_ = mode;
+ }
+ int SpaceBoundaries::getReaction()
+ {
+ return this->reaction_;
+ }
+
+ void SpaceBoundaries::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(SpaceBoundaries, XMLPort, xmlelement, mode);
+
+ XMLPortParam(SpaceBoundaries, "maxDistance", setMaxDistance, getMaxDistance, xmlelement, mode);
+ XMLPortParam(SpaceBoundaries, "warnDistance", setWarnDistance, getWarnDistance, xmlelement, mode);
+ XMLPortParam(SpaceBoundaries, "showDistance", setShowDistance, getShowDistance, xmlelement, mode);
+ XMLPortParam(SpaceBoundaries, "healthDecrease", setHealthDecrease, getHealthDecrease, xmlelement, mode);
+ XMLPortParam(SpaceBoundaries, "reactionMode", setReaction, getReaction, xmlelement, mode);
+ }
+
+ void SpaceBoundaries::tick(float dt)
+ {
+ this->checkWhoIsIn();
+ this->removeAllBillboards();
+
+ float distance;
+ bool humanItem;
+ for( std::list<WeakPtr<Pawn> >::iterator current = pawnsIn_.begin(); current != pawnsIn_.end(); current++ )
+ {
+ Pawn* currentPawn = current->get();
+ if( currentPawn && currentPawn->getNode() )
+ {
+ distance = this->computeDistance(currentPawn);
+ humanItem = this->isHumanPlayer(currentPawn);
+ COUT(5) << "Distance:" << distance << std::endl; // message for debugging
+ if(distance > this->warnDistance_ && distance < this->maxDistance_) // Display warning
+ {
+ if(humanItem)
+ {
+ this->displayWarning("Attention! You are close to the boundary!");
+ }
+ }
+ if(/* humanItem &&*/ abs(this->maxDistance_ - distance) < this->showDistance_ )
+ {
+ this->displayBoundaries(currentPawn, 1.0f - fabs(this->maxDistance_ - distance) / this->showDistance_); // Show the boundary
+ }
+ if(distance > this->maxDistance_ && (this->reaction_ == 1) )
+ {
+ if( humanItem )
+ {
+ COUT(5) << "Health should be decreasing!" << std::endl;
+ this->displayWarning("You are out of the area now!");
+ }
+ currentPawn->removeHealth( (distance - this->maxDistance_) * this->healthDecrease_);
+ }
+ if( (this->reaction_ == 0) && (distance + 100 > this->maxDistance_)) // Exception: A Pawn can't move more than 100 units per tick.
+ {
+ this->conditionalBounceBack(currentPawn, distance, dt);
+ }
+ if( this->reaction_ == 2 && (distance - 100 < this->maxDistance_) )
+ {
+ this->conditionalBounceBack(currentPawn, distance, dt);
+ }
+ }
+ }
+ }
+
+ float SpaceBoundaries::computeDistance(WorldEntity *item)
+ {
+ if(item != NULL)
+ {
+ Vector3 itemPosition = item->getPosition();
+ return (itemPosition.distance(this->getPosition()));
+ } else {
+ return -1;
+ }
+ }
+
+ void SpaceBoundaries::displayWarning(const std::string warnText)
+ {
+ // TODO
+ }
+
+ void SpaceBoundaries::displayBoundaries(Pawn *item, float alpha)
+ {
+
+ Vector3 direction = item->getPosition() - this->getPosition();
+ direction.normalise();
+
+ Vector3 boundaryPosition = this->getPosition() + direction * this->maxDistance_;
+
+ this->positionBillboard(boundaryPosition, alpha);
+ }
+
+ void SpaceBoundaries::conditionalBounceBack(Pawn *item, float currentDistance, float dt)
+ {
+ Vector3 normal = item->getPosition() - this->getPosition();
+ normal.normalise();
+ Vector3 velocity = item->getVelocity();
+ float normalSpeed = item->getVelocity().dotProduct(normal);
+
+ /* Check, whether the Pawn would leave the boundary in the next tick, if so send it back. */
+ if( this->reaction_ == 0 && currentDistance + normalSpeed * dt > this->maxDistance_ - 10 ) // -10: "security measure"
+ {
+ bounceBack(item, &normal, &velocity);
+ } else if (this->reaction_ == 2 && currentDistance - normalSpeed * dt < this->maxDistance_ + 10 ) // 10: "security measure"
+ {
+ normal = normal * (-1);
+ bounceBack(item, &normal, &velocity);
+ }
+ }
+
+ void SpaceBoundaries::bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity)
+ {
+ float dampingFactor = 0.5;
+ *velocity = velocity->reflect(*normal);
+ Vector3 acceleration = item->getAcceleration();
+ acceleration = acceleration.reflect(*normal);
+
+ item->lookAt( *velocity + this->getPosition() );
+
+ item->setAcceleration(acceleration * dampingFactor);
+ item->setVelocity(*velocity * dampingFactor);
+
+ item->setPosition( item->getPosition() - *normal * 10 ); // Set the position of the Pawn to be well inside the boundary.
+ }
+
+ bool SpaceBoundaries::isHumanPlayer(Pawn *item)
+ {
+ if(item != NULL)
+ {
+ if(item->getPlayer())
+ {
+ return item->getPlayer()->isHumanPlayer();
+ }
+ }
+ return false;
+ }
+
+}
Copied: code/trunk/src/modules/objects/SpaceBoundaries.h (from rev 8705, code/branches/presentation/src/modules/objects/SpaceBoundaries.h)
===================================================================
--- code/trunk/src/modules/objects/SpaceBoundaries.h (rev 0)
+++ code/trunk/src/modules/objects/SpaceBoundaries.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,138 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Maurus Kaufmann
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _SpaceBoundaries_H__
+#define _SpaceBoundaries_H__
+
+#include "objects/ObjectsPrereqs.h"
+
+#include <string>
+#include <list>
+#include <vector>
+
+#include "core/CoreIncludes.h"
+#include "core/WeakPtr.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+
+/**
+ at brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
+
+ Some attributes can/should be defined in the XML-File:
+ - 'position' : absolute position of the object of SpaceBoundaries in the level (usually 0,0,0)
+ - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
+ - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
+ inform the player that he'll soon be leaving the allowed area. (not implemented yet!)
+ - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
+ - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
+ 0: Reflect the space ship (default).
+ 1: Decrease Health of the space ship after having left the allowed area.
+ 2: Inverted Version of 0. Prohibit to fly INTO a defined area.
+ - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
+ Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
+
+Follow http://www.orxonox.net/wiki/SpaceBoundaries to get some further information.
+
+Examples:
+Two examples how one could include SpaceBoundaries in the XML-File. The first one uses reflection, the second one health decrease.
+ at code
+<SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="0" />
+ at endcode
+
+ at code
+<SpaceBoundaries position="0,0,0" maxDistance="1000" warnDistance="800" showDistance="100" reactionMode="1" healthDecrease="0.2" />
+ at endcode
+*/
+
+ class _ObjectsExport SpaceBoundaries : public StaticEntity, public Tickable
+ {
+ public:
+ SpaceBoundaries(BaseObject* creator);
+ ~SpaceBoundaries();
+
+ void setMaxDistance(float r);
+ float getMaxDistance();
+
+ void setWarnDistance(float r);
+ float getWarnDistance();
+
+ void setShowDistance(float r);
+ float getShowDistance();
+
+ void setHealthDecrease(float amount);
+ float getHealthDecrease();
+
+ void setReaction(int mode);
+ int getReaction();
+
+ void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+
+ void tick(float dt);
+
+ private:
+ struct BillboardAdministration{ bool usedYet; Billboard* billy; };
+
+ // Variabeln::
+ std::list<WeakPtr<Pawn> > pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle.
+
+ std::vector<BillboardAdministration> billboards_;
+
+ int reaction_; //!< Values: 0, 1, 2.
+ //!< 0: Reflection on boundary (Standard).
+ //!< 1: Decrease-Health-Mode.
+ //!< 2: Inverted Version of 0. Prohibit to fly INTO a defined area.
+ float maxDistance_; //!< Maximum allowed distance.
+ float warnDistance_; //!< Distance in which a warning is displayed.
+ float showDistance_; //!< Distance at which the boundaries are displayed.
+
+ float healthDecrease_; //!< Rate of health loss.
+
+ //RadarViewable* centerRadar_; //!< Representation of the space boundary in the radar.
+
+ // Funktionen::
+ float computeDistance(WorldEntity *item); //!< Compute distance to center point.
+ void displayWarning(const std::string warnText); //!< TODO: Implement.
+ void displayBoundaries(Pawn *item, float alpha);
+ void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
+ void bounceBack(Pawn *item, Vector3 *normal, Vector3 *velocity);
+ bool isHumanPlayer(Pawn *item);
+
+ void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
+
+ void positionBillboard(const Vector3& position, float alpha); //!< Display a Billboard at the position 'position'.
+ void setBillboardOptions(Billboard *billy);
+ void removeAllBillboards(); //!< Hide all elements of '*billboard_' and set their attribute 'usedYet' to 0.
+
+ };
+}
+
+#endif /* _SpaceBoundaries_H__ */
Modified: code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file BoxCollisionShape.cc
+ @brief Implementation of the BoxCollisionShape class.
+*/
+
#include "BoxCollisionShape.h"
#include <BulletCollision/CollisionShapes/btBoxShape.h>
@@ -38,18 +43,23 @@
{
CreateFactory(BoxCollisionShape);
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
BoxCollisionShape::BoxCollisionShape(BaseObject* creator) : CollisionShape(creator)
{
RegisterObject(BoxCollisionShape);
this->halfExtents_ = Vector3(1, 1, 1);
- updateShape();
+ this->updateShape();
this->registerVariables();
}
BoxCollisionShape::~BoxCollisionShape()
{
+ // TODO: Move to CollisionShape?
if (this->isInitialized())
delete this->collisionShape_;
}
@@ -69,6 +79,32 @@
XMLPortParamLoadOnly(BoxCollisionShape, "length", setLength, xmlelement, mode);
}
+ /**
+ @brief
+ Is called when the scale of the BoxCollisionShape has changed.
+ */
+ void BoxCollisionShape::changedScale()
+ {
+ CollisionShape::changedScale();
+
+ // Resize the internal collision shape
+ // TODO: Assuming setLocalScaling works.
+ // this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));
+ if(!this->hasUniformScaling())
+ {
+ CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+ return;
+ }
+
+ this->setHalfExtents(this->halfExtents_ * this->getScale());
+ }
+
+ /**
+ @brief
+ Creates a new internal collision shape for the BoxCollisionShape.
+ @return
+ Returns a pointer to the newly created btBoxShape.
+ */
btCollisionShape* BoxCollisionShape::createNewShape() const
{
return new btBoxShape(multi_cast<btVector3>(this->halfExtents_));
Modified: code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/collisionshapes/BoxCollisionShape.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -42,6 +42,17 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Wrapper for the bullet box collision shape class btBoxShape.
+
+ @author
+ Reto Grieder
+
+ @see btBoxShape
+ @ingroup Collisionshapes
+ */
class _ObjectsExport BoxCollisionShape : public CollisionShape
{
public:
@@ -50,32 +61,75 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- inline void setHalfExtents(const Vector3& extents)
- { this->halfExtents_ = extents; updateShape(); }
+ /**
+ @brief Set the half extents of the BoxCollisionShape.
+ If the half extent changes, this causes the internal collision shape to be recreated.
+ @param extents A vector with the half extents.
+ The x-component is half the length, the y-component is half the height and the z-component is half the width.
+ @return Returns true if the half extent has changed, false if not.
+ */
+ inline bool setHalfExtents(const Vector3& extents)
+ { if(this->halfExtents_ == extents) return false; this->halfExtents_ = extents; updateShape(); return true; }
+ /**
+ @brief Get the half extents of the BoxCollisionShape.
+ @return Returns a vector containing the half extents.
+ */
inline const Vector3& getHalfExtents() const
{ return halfExtents_;}
- inline void setWidth(float value)
- { this->halfExtents_.z = value / 2; updateShape(); }
+ /**
+ @brief Set the width of the BoxCollisionShape.
+ If the width changes, this causes the internal collision shape to be recreated.
+ @param value The width to be set.
+ @return Returns true if the width has changed, false if not.
+ */
+ inline bool setWidth(float value)
+ { if(this->halfExtents_.z == value/2.0f) return false; this->halfExtents_.z = value / 2.0f; updateShape(); return true; }
+ /**
+ @brief Get the width of the BoxCollisionShape.
+ @return Returns the width of the BoxCollisionShape.
+ */
inline float getWidth() const
- { return this->halfExtents_.z * 2; }
+ { return this->halfExtents_.z * 2.0f; }
- inline void setHeight(float value)
- { this->halfExtents_.y = value / 2; updateShape(); }
+ /**
+ @brief Set the height of the BoxCollisionShape.
+ If the height changes, this causes the internal collision shape to be recreated.
+ @param value The height to be set.
+ @return Returns true if the height has changed, false if not.
+ */
+ inline bool setHeight(float value)
+ { if(this->halfExtents_.y == value/2.0f) return false; this->halfExtents_.y = value / 2.0f; updateShape(); return true; }
+ /**
+ @brief Get the height of the BoxCollisionShape.
+ @return Returns the height of the BoxCollisionShape.
+ */
inline float getHeight() const
- { return this->halfExtents_.y * 2; }
+ { return this->halfExtents_.y * 2.0f; }
- inline void setLength(float value)
- { this->halfExtents_.x = value / 2; updateShape(); }
+ /**
+ @brief Set the length of the BoxCollisionShape.
+ If the length changes, this causes the internal collision shape to be recreated.
+ @param value The length to be set.
+ @return Returns true if the length has changed, false if not.
+ */
+ inline bool setLength(float value)
+ { if(this->halfExtents_.x == value/2.0f) return false; this->halfExtents_.x = value / 2.0f; updateShape(); return true; }
+ /**
+ @brief Get the length of the BoxCollisionShape.
+ @return Returns the length of the BoxCollisionShape.
+ */
inline float getLength() const
- { return this->halfExtents_.x * 2; }
+ { return this->halfExtents_.x * 2.0f; }
+ virtual void changedScale(); // Is called when the scale of the BoxCollisionShape has changed.
+
private:
void registerVariables();
- btCollisionShape* createNewShape() const;
+ btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the BoxCollisionShape.
- Vector3 halfExtents_;
+ Vector3 halfExtents_; //!< The half extents of the BoxCollisionShape. The x-component is half the length, the y-component is half the height and the z-component is half the width.
};
}
Modified: code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,17 +26,27 @@
*
*/
+/**
+ @file ConeCollisionShape.cc
+ @brief Implementation of the ConeCollisionShape class.
+*/
+
#include "ConeCollisionShape.h"
#include <BulletCollision/CollisionShapes/btConeShape.h>
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
namespace orxonox
{
CreateFactory(ConeCollisionShape);
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
ConeCollisionShape::ConeCollisionShape(BaseObject* creator) : CollisionShape(creator)
{
RegisterObject(ConeCollisionShape);
@@ -68,6 +78,34 @@
XMLPortParam(ConeCollisionShape, "height", setHeight, getHeight, xmlelement, mode);
}
+ /**
+ @brief
+ Is called when the scale of the ConeCollisionShape has changed.
+ */
+ void ConeCollisionShape::changedScale()
+ {
+ CollisionShape::changedScale();
+
+ // Resize the internal collision shape
+ // TODO: Assuming setLocalScaling works.
+ //this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));
+ if(!this->hasUniformScaling())
+ {
+ CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+ return;
+ }
+
+ this->radius_ *= this->getScale();
+ this->height_ *= this->getScale();
+ this->updateShape();
+ }
+
+ /**
+ @brief
+ Creates a new internal collision shape for the ConeCollisionShape.
+ @return
+ Returns a pointer to the newly created btConeShape.
+ */
btCollisionShape* ConeCollisionShape::createNewShape() const
{
return new btConeShape(this->radius_, this->height_);
Modified: code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/collisionshapes/ConeCollisionShape.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -40,6 +40,17 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Wrapper for the bullet cone collision shape class btConeShape.
+
+ @author
+ Reto Grieder
+
+ @see btConeShape
+ @ingroup Collisionshapes
+ */
class _ObjectsExport ConeCollisionShape : public CollisionShape
{
public:
@@ -48,23 +59,45 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- inline void setRadius(float value)
- { this->radius_ = value; updateShape(); }
+ /**
+ @brief Set the radius of the ConeCollisionShape.
+ If the radius changes, this causes the internal collision shape to be recreated.
+ @param value The radius to be set.
+ @return Returns true if the radius has changed, false if not.
+ */
+ inline bool setRadius(float value)
+ { if(this->radius_ == value) return false; this->radius_ = value; updateShape(); return true; }
+ /**
+ @brief Get the radius of the ConeCollisionShape.
+ @return Returns the radius of the ConeCollisionShape.
+ */
inline float getRadius() const
{ return radius_; }
- inline void setHeight(float value)
- { this->height_ = value; updateShape(); }
+ /**
+ @brief Set the height of the ConeCollisionShape.
+ If the height changes, this causes the internal collision shape to be recreated.
+ @param value The height to be set.
+ @return Returns true if the height has changed, false if not.
+ */
+ inline bool setHeight(float value)
+ { if(this->height_ == value) return false; this->height_ = value; updateShape(); return true; }
+ /**
+ @brief Get the height of the ConeCollisionShape.
+ @return Returns the height of the ConeCollisionShape.
+ */
inline float getHeight() const
{ return this->height_; }
+ virtual void changedScale(); // Is called when the scale of the ConeCollisionShape has changed.
+
private:
void registerVariables();
- btCollisionShape* createNewShape() const;
+ btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the ConeCollisionShape.
- float radius_;
- float height_;
+ float radius_; //!< The radius of the ConeCollisionShape.
+ float height_; //!< The height of the ConeCollisionShape.
};
}
Modified: code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file PlaneCollisionShape.cc
+ @brief Implementation of the PlaneCollisionShape class.
+*/
+
#include "PlaneCollisionShape.h"
#include <BulletCollision/CollisionShapes/btStaticPlaneShape.h>
@@ -38,6 +43,10 @@
{
CreateFactory(PlaneCollisionShape);
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
PlaneCollisionShape::PlaneCollisionShape(BaseObject* creator) : CollisionShape(creator)
{
RegisterObject(PlaneCollisionShape);
@@ -69,6 +78,32 @@
XMLPortParam(PlaneCollisionShape, "offset", setOffset, getOffset, xmlelement, mode);
}
+ /**
+ @brief
+ Is called when the scale of the PlaneCollisionShape has changed.
+ */
+ void PlaneCollisionShape::changedScale()
+ {
+ CollisionShape::changedScale();
+
+ // Resize the internal collision shape
+ // TODO: Assuming setLocalScaling works.
+ //this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));
+ if(!this->hasUniformScaling())
+ {
+ CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+ return;
+ }
+
+ this->setOffset(this->offset_*this->getScale());
+ }
+
+ /**
+ @brief
+ Creates a new internal collision shape for the PlaneCollisionShape.
+ @return
+ Returns a pointer to the newly created btStaticPlaneShape.
+ */
btCollisionShape* PlaneCollisionShape::createNewShape() const
{
return new btStaticPlaneShape(multi_cast<btVector3>(this->normal_), this->offset_);
Modified: code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/collisionshapes/PlaneCollisionShape.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -42,6 +42,17 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Wrapper for the bullet plane collision shape class btStaticPlaneShape.
+
+ @author
+ Martin Stypinski
+
+ @see btStaticPlaneShape
+ @ingroup Collisionshapes
+ */
class _ObjectsExport PlaneCollisionShape : public CollisionShape
{
public:
@@ -50,23 +61,45 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- inline void setNormal(const Vector3& normal)
- { this->normal_ = normal; updateShape(); }
- inline const Vector3& getNormal()
+ /**
+ @brief Set the normal of the PlaneCollisionShape.
+ If the normal changes, this causes the internal collision shape to be recreated.
+ @param normal The normal vector to be set.
+ @return Returns true if the normal has changed, false if not.
+ */
+ inline bool setNormal(const Vector3& normal)
+ { if(this->normal_ == normal) return false; this->normal_ = normal; updateShape(); return true; }
+ /**
+ @brief Get the normal of the PlaneCollisionShape.
+ @return Returns the normal vector of the PlaneCollisionShape.
+ */
+ inline const Vector3& getNormal() const
{ return normal_;}
- inline void setOffset(float offset)
- { this->offset_ = offset; updateShape(); }
- inline float getOffset()
+ /**
+ @brief Set the offset of the PlaneCollisionShape.
+ If the offset changes, this causes the internal collision shape to be recreated.
+ @param offset The offset to be set.
+ @return Returns true if the offset has changed, false if not.
+ */
+ inline bool setOffset(float offset)
+ { if(this->offset_ == offset) return false; this->offset_ = offset; updateShape(); return true; }
+ /**
+ @brief Get the offset of the PlaneCollisionShape.
+ @return Returns the offset of the PlaneCollisionShape.
+ */
+ inline float getOffset() const
{ return this->offset_;}
+ virtual void changedScale(); // Is called when the scale of the PlaneCollisionShape has changed.
+
private:
void registerVariables();
- btCollisionShape* createNewShape()const;
+ btCollisionShape* createNewShape() const; // Creates a new internal collision shape for the PlaneCollisionShape.
- Vector3 normal_;
- float offset_;
+ Vector3 normal_; //!< The normal vector of the PlaneCollisionShape.
+ float offset_; //!< The offset of the PlaneCollisionShape.
};
}
Modified: code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,17 +26,27 @@
*
*/
+/**
+ @file SphereCollisionShape.cc
+ @brief Implementation of the SphereCollisionShape class.
+*/
+
#include "SphereCollisionShape.h"
#include <BulletCollision/CollisionShapes/btSphereShape.h>
#include "core/CoreIncludes.h"
#include "core/XMLPort.h"
+#include "tools/BulletConversions.h"
namespace orxonox
{
CreateFactory(SphereCollisionShape);
+ /**
+ @brief
+ Constructor. registers and initializes the object.
+ */
SphereCollisionShape::SphereCollisionShape(BaseObject* creator) : CollisionShape(creator)
{
RegisterObject(SphereCollisionShape);
@@ -65,6 +75,32 @@
XMLPortParam(SphereCollisionShape, "radius", setRadius, getRadius, xmlelement, mode);
}
+ /**
+ @brief
+ Is called when the scale of the SphereCollisionShape has changed.
+ */
+ void SphereCollisionShape::changedScale()
+ {
+ CollisionShape::changedScale();
+
+ // Resize the internal collision shape
+ // TODO: Assuming setLocalScaling works.
+ //this->collisionShape_->setLocalScaling(multi_cast<btVector3>(this->getScale3D()));
+ if(!this->hasUniformScaling())
+ {
+ CCOUT(1) << "Error: Non-uniform scaling is not yet supported." << endl;
+ return;
+ }
+
+ this->setRadius(this->radius_*this->getScale());
+ }
+
+ /**
+ @brief
+ Creates a new internal collision shape for the SphereCollisionShape.
+ @return
+ Returns a pointer to the newly created btSphereShape.
+ */
btCollisionShape* SphereCollisionShape::createNewShape() const
{
return new btSphereShape(this->radius_);
Modified: code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h
===================================================================
--- code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/collisionshapes/SphereCollisionShape.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -40,6 +40,17 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Wrapper for the bullet sphere collision shape class btSphereShape.
+
+ @author
+ Reto Grieder
+
+ @see btSphereShape
+ @ingroup Collisionshapes
+ */
class _ObjectsExport SphereCollisionShape : public CollisionShape
{
public:
@@ -48,17 +59,29 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
- inline void setRadius(float radius)
- { this->radius_ = radius; updateShape(); }
+ /**
+ @brief Set the radius of the SphereCollisionShape.
+ If the radius changes, this causes the internal collision shape to be recreated.
+ @param radius The radius to be set.
+ @return Returns true if the radius has changed, false if not.
+ */
+ inline bool setRadius(float radius)
+ { if(this->radius_ == radius) return false; this->radius_ = radius; updateShape(); return true; }
+ /**
+ @brief Get the radius of the SphereCollisionShape.
+ @return Returns the radius of the SphereCollisionShape.
+ */
inline float getRadius() const
{ return this->radius_; }
+ virtual void changedScale(); // Is called when the scale of the SphereCollisionShape has changed.
+
private:
void registerVariables();
btCollisionShape* createNewShape() const;
- float radius_;
+ float radius_; //!< The radius of the SphereCollisionShape.
};
}
Modified: code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -52,13 +52,15 @@
@brief
Default Constructor. Registers the object and initializes default values.
*/
- DistanceMultiTrigger::DistanceMultiTrigger(BaseObject* creator) : MultiTrigger(creator), beaconMask_(NULL)
+ DistanceMultiTrigger::DistanceMultiTrigger(BaseObject* creator) : MultiTrigger(creator)
{
RegisterObject(DistanceMultiTrigger);
this->distance_ = 100.0f;
this->setBeaconModeDirect(distanceMultiTriggerBeaconMode::off);
this->targetName_ = "";
+ this->beaconMask_.exclude(Class(BaseObject));
+ this->beaconMask_.include(Class(DistanceTriggerBeacon));
}
/**
@@ -67,8 +69,7 @@
*/
DistanceMultiTrigger::~DistanceMultiTrigger()
{
- if(this->beaconMask_ != NULL)
- delete this->beaconMask_;
+
}
/**
@@ -134,7 +135,7 @@
ClassTreeMask targetMask = this->getTargetMask();
// If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons.
if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)
- targetMask = *this->beaconMask_;
+ targetMask = this->beaconMask_;
// Iterate through all objects that are targets of the DistanceMultiTrigger.
for(ClassTreeMaskObjectIterator it = targetMask.begin(); it != targetMask.end(); ++it)
@@ -206,12 +207,6 @@
void DistanceMultiTrigger::setBeaconModeDirect(distanceMultiTriggerBeaconMode::Value mode)
{
this->beaconMode_ = mode;
- if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify && this->beaconMask_ == NULL)
- {
- this->beaconMask_ = new ClassTreeMask();
- this->beaconMask_->exclude(Class(BaseObject));
- this->beaconMask_->include(Class(DistanceTriggerBeacon));
- }
}
/**
Modified: code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -151,7 +151,7 @@
distanceMultiTriggerBeaconMode::Value beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in.
std::string targetName_; //!< The target name, used in <em>single-target</em> mode.
- ClassTreeMask* beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
+ ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
std::map<WorldEntity*, WeakPtr<WorldEntity>* > range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger.
Modified: code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTrigger.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/DistanceTrigger.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -56,13 +56,15 @@
@param creator
The creator of this trigger.
*/
- DistanceTrigger::DistanceTrigger(BaseObject* creator) : Trigger(creator), beaconMask_(NULL)
+ DistanceTrigger::DistanceTrigger(BaseObject* creator) : Trigger(creator)
{
RegisterObject(DistanceTrigger);
this->distance_ = 100;
this->targetMask_.exclude(Class(BaseObject));
this->targetName_ = "";
+ this->beaconMask_.exclude(Class(BaseObject));
+ this->beaconMask_.include(Class(DistanceTriggerBeacon));
}
/**
@@ -71,9 +73,7 @@
*/
DistanceTrigger::~DistanceTrigger()
{
- // Delete the beacon mask if it exists.
- if(this->beaconMask_ != NULL)
- delete this->beaconMask_;
+
}
/**
@@ -158,7 +158,7 @@
ClassTreeMask targetMask = this->targetMask_;
// If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons.
if(this->beaconMode_ == distanceTriggerBeaconMode::identify)
- targetMask = *this->beaconMask_;
+ targetMask = this->beaconMask_;
// Iterate through all objects that are targets of the DistanceTrigger.
for (ClassTreeMaskObjectIterator it = targetMask.begin(); it != targetMask.end(); ++it)
@@ -204,8 +204,11 @@
if(this->beaconMode_ == distanceTriggerBeaconMode::identify)
entity = entity->getParent();
- Pawn* player = orxonox_cast<Pawn*>(entity);
- this->setTriggeringPlayer(player);
+ Pawn* pawn = orxonox_cast<Pawn*>(entity);
+ if(pawn != NULL)
+ this->setTriggeringPawn(pawn);
+ else
+ CCOUT(2) << "Pawn was NULL." << endl;
}
// Add the entity to the cache.
@@ -227,12 +230,6 @@
void DistanceTrigger::setBeaconModeDirect(distanceTriggerBeaconMode::Value mode)
{
this->beaconMode_ = mode;
- if(this->beaconMode_ == distanceTriggerBeaconMode::identify && this->beaconMask_ == NULL)
- {
- this->beaconMask_ = new ClassTreeMask();
- this->beaconMask_->exclude(Class(BaseObject));
- this->beaconMask_->include(Class(DistanceTriggerBeacon));
- }
}
/**
@@ -279,7 +276,9 @@
@brief
Check whether the DistanceTrigger is triggered.
It is triggered if it is triggered according only to its mode (i.e. its sub-triggers) and if a target is in range.
- @param
+ @param mode
+ The mode for which it is tested, whether the DistanceTrigger is triggered.
+ @return
Returns true if it is triggered ,false if not.
*/
bool DistanceTrigger::isTriggered(TriggerMode::Value mode)
Modified: code/trunk/src/modules/objects/triggers/DistanceTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/DistanceTrigger.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/DistanceTrigger.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -70,7 +70,7 @@
- @b distance Which specifies the maximum distance at which the DistanceTrigger still triggers, i.e. its range. Default is <code>100</code>.
- @b target Which specifies the class of objects that can trigger the DistanceTrigger. Default is <code>"Pawn"</code>.
- @b beaconMode Which specifies, whether the DistanceTrigger operates on @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacons" or not. If <em>off</em> the DistanceMultiTrigger works as usual. If set to <em>identify</em> the DistanceTrigger is only triggered by objects that have a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon", with the same name as specified in <em>targetname</em>, attached to them. If set to <em>exclude</em> the DistanceTrigger is only triggered by objects that don't have a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon", with the same name as specified in <em>targetname</em>, attached to them. Default is <em>off</em>.
- - @b targetname Which specifies the name @ref oroxnox::DistanceTriggerBeacon "DistanceTriggerBeacons" need to have to make the DistanceTrigger react to them if it is in <em>beacon-mode</em> (the beaconMode is not <em>off</em>).
+ - @b targetname Which specifies the name @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacons" need to have to make the DistanceTrigger react to them if it is in <em>beacon-mode</em> (the beaconMode is not <em>off</em>).
A simple DistanceTrigger could look like this:
@code
@@ -161,7 +161,7 @@
distanceTriggerBeaconMode::Value beaconMode_; //!< The beacon mode.
std::string targetName_; //!< The name a DistanceTriggerBeacon needs to have to make the DistanceTrigger react to it if in beacon-mode.
- ClassTreeMask* beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
+ ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons.
WeakPtr<WorldEntity> cache_; //!< Caches the entity that triggered the DistanceTrigger last.
};
Modified: code/trunk/src/modules/objects/triggers/EventTrigger.h
===================================================================
--- code/trunk/src/modules/objects/triggers/EventTrigger.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/EventTrigger.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -59,7 +59,7 @@
@endcode
@see Trigger
- For more information on @ref oroxnox::Trigger "Triggers".
+ For more information on @ref orxonox::Trigger "Triggers".
@author
Fabian 'x3n' Landau
Modified: code/trunk/src/modules/objects/triggers/MultiTrigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTrigger.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/MultiTrigger.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -62,7 +62,7 @@
this->bMultiTrigger_ = true;
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
}
/**
@@ -197,7 +197,6 @@
// If the activity is different from what it is now, change it and fire an Event.
if(bActive ^ this->isActive(state->originator))
{
-
bool bFire = true;
// Add the originator to the objects activating this MultiTrigger.
@@ -311,7 +310,6 @@
this->targetMask_.exclude(Class(TriggerBase), true);
// We only want WorldEntities
- //TODO: Really?
ClassTreeMask WEMask;
WEMask.include(Class(WorldEntity));
this->targetMask_ *= WEMask;
Modified: code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -72,7 +72,7 @@
if(pawn != NULL)
{
this->setForPlayer(true);
- this->setTriggeringPlayer(pawn);
+ this->setTriggeringPawn(pawn);
}
}
Modified: code/trunk/src/modules/objects/triggers/Trigger.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/Trigger.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/Trigger.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -75,7 +75,7 @@
this->attachOgreObject(this->debugBillboard_.getBillboardSet());
}
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
}
/**
Modified: code/trunk/src/modules/objects/triggers/TriggerBase.cc
===================================================================
--- code/trunk/src/modules/objects/triggers/TriggerBase.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/TriggerBase.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -70,7 +70,7 @@
this->bMultiTrigger_ = false;
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
}
/**
Modified: code/trunk/src/modules/objects/triggers/TriggerBase.h
===================================================================
--- code/trunk/src/modules/objects/triggers/TriggerBase.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/objects/triggers/TriggerBase.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -132,6 +132,12 @@
*/
inline int getActivations(void) const
{ return this->remainingActivations_; }
+ /**
+ @brief Check whether the trigger has still at least one remaining activation.
+ @return Returns true if the trigger has remaining activations (i.e. the number of remaining activations is not zero).
+ */
+ inline bool hasRemainingActivations(void) const
+ { return this->remainingActivations_ > 0 || this->remainingActivations_ == INF_s; }
/**
@brief Set the invert-mode of triggerhe trigger.
Modified: code/trunk/src/modules/overlays/OverlaysPrereqs.h
===================================================================
--- code/trunk/src/modules/overlays/OverlaysPrereqs.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/overlays/OverlaysPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -88,6 +88,7 @@
class HUDNavigation;
class HUDRadar;
class HUDSpeedBar;
+ class HUDBoostBar;
class HUDTimer;
class KillMessage;
class LastManStandingInfos;
Modified: code/trunk/src/modules/overlays/hud/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/overlays/hud/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/overlays/hud/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -3,10 +3,10 @@
HUDNavigation.cc
HUDRadar.cc
HUDSpeedBar.cc
+ HUDBoostBar.cc
HUDHealthBar.cc
HUDTimer.cc
ChatOverlay.cc
- GametypeStatus.cc
AnnounceMessage.cc
KillMessage.cc
DeathMessage.cc
Deleted: code/trunk/src/modules/overlays/hud/GametypeStatus.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/GametypeStatus.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/overlays/hud/GametypeStatus.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,126 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#include "GametypeStatus.h"
-
-#include "util/Convert.h"
-#include "core/CoreIncludes.h"
-#include "core/command/ConsoleCommand.h"
-#include "infos/GametypeInfo.h"
-#include "infos/PlayerInfo.h"
-#include "worldentities/ControllableEntity.h"
-#include "worldentities/pawns/Spectator.h"
-//#include "gametypes/Gametype.h"
-
-namespace orxonox
-{
- CreateFactory(GametypeStatus);
-
- static const std::string __CC_GametypeStatus_name = "GametypeStatus";
- static const std::string __CC_displayCaption_name = "displayCaption";
-
- SetConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name, &GametypeStatus::setDisplayCaption);
-
- GametypeStatus::GametypeStatus(BaseObject* creator) : OverlayText(creator)
- {
- RegisterObject(GametypeStatus);
-
- //this->game_ = 0;
- this->owner_ = 0;
- this->bNoCaption_ = false;
- //this->bForcedSpawn_ = false;
-
- ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(this);
- }
-
- GametypeStatus::~GametypeStatus()
- {
- ModifyConsoleCommand(__CC_GametypeStatus_name, __CC_displayCaption_name).setObject(0);
- }
-
- void GametypeStatus::tick(float dt)
- {
- SUPER(GametypeStatus, tick, dt);
-
- if (this->owner_ && this->owner_->getGametypeInfo() && this->owner_->getControllableEntity())
- {
- //if (this->game_)
- // this->bForcedSpawn_ = this->game_->getForceSpawn();
- //else
- // this->bForcedSpawn_ = false;
-
- const GametypeInfo* gtinfo = this->owner_->getGametypeInfo();
- ControllableEntity* ce = this->owner_->getControllableEntity();
-
- if (this->bNoCaption_) // No captions are displayed.
- {
- this->setCaption("");
- return;
- }
-
- if (!gtinfo->hasStarted() && !gtinfo->isStartCountdownRunning())
- {
- if (!this->owner_->isReadyToSpawn())
- this->setCaption("Press [Fire] to start the match");
- else
- this->setCaption("Waiting for other players");
- }
- else if (!gtinfo->hasEnded())
- {
- if (gtinfo->isStartCountdownRunning())
- this->setCaption(multi_cast<std::string>(static_cast<int>(ceil(gtinfo->getStartCountdown()))));
- else if (ce->isA(Class(Spectator))/*&&(!bForcedSpawn_)*/)
- this->setCaption("Press [Fire] to respawn");
- else
- this->setCaption("");
- }
- else
- this->setCaption("Game has ended");
- }
- }
-
-
- void GametypeStatus::changedOwner()
- {
- SUPER(GametypeStatus, changedOwner);
- //this->game_ = orxonox_cast<Gametype*>(this->getOwner());
- this->owner_ = orxonox_cast<PlayerInfo*>(this->getOwner());
- }
-
- /**
- @brief
- Sets whether the gametype status is displayed.
- @param bValue
- If true captions are displayed, if false, not.
- */
- void GametypeStatus::setDisplayCaption(bool bValue)
- {
- this->bNoCaption_ = !bValue;
- }
-
-}
Deleted: code/trunk/src/modules/overlays/hud/GametypeStatus.h
===================================================================
--- code/trunk/src/modules/overlays/hud/GametypeStatus.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/overlays/hud/GametypeStatus.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,58 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Fabian 'x3n' Landau
- * Co-authors:
- * ...
- *
- */
-
-#ifndef _GametypeStatus_H__
-#define _GametypeStatus_H__
-
-#include "overlays/OverlaysPrereqs.h"
-
-#include "tools/interfaces/Tickable.h"
-#include "overlays/OverlayText.h"
-
-namespace orxonox
-{
- class _OverlaysExport GametypeStatus : public OverlayText, public Tickable
- {
- public:
- GametypeStatus(BaseObject* creator);
- virtual ~GametypeStatus();
-
- virtual void tick(float dt);
- virtual void changedOwner();
-
- void setDisplayCaption(bool bValue); //!< Toggles whether the gametype status is displayed.
-
- private:
- //Gametype* game_;
- PlayerInfo* owner_;
- bool bNoCaption_;
- //bool bForcedSpawn_;
-
- };
-}
-#endif /* _GametypeStatus_H__ */
Modified: code/trunk/src/modules/overlays/hud/HUDBar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDBar.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/overlays/hud/HUDBar.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -25,6 +25,7 @@
* Felix Schulthess
* Fabian 'x3n' Landau
* Reto Grieder
+ * Benjamin Knecht
*
*/
Modified: code/trunk/src/modules/overlays/hud/HUDBar.h
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDBar.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/overlays/hud/HUDBar.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -25,6 +25,7 @@
* Felix Schulthess
* Fabian 'x3n' Landau
* Reto Grieder
+ * Benjamin Knecht
*
*/
Copied: code/trunk/src/modules/overlays/hud/HUDBoostBar.cc (from rev 8705, code/branches/presentation/src/modules/overlays/hud/HUDBoostBar.cc)
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDBoostBar.cc (rev 0)
+++ code/trunk/src/modules/overlays/hud/HUDBoostBar.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,89 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Benjamin Knecht
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "HUDBoostBar.h"
+
+#include "core/CoreIncludes.h"
+#include "worldentities/pawns/SpaceShip.h"
+#include "items/Engine.h"
+
+namespace orxonox
+{
+ CreateFactory(HUDBoostBar);
+
+ HUDBoostBar::HUDBoostBar(BaseObject* creator)
+ : HUDBar(creator)
+ {
+ RegisterObject(HUDBoostBar);
+
+ this->owner_ = 0;
+ this->flashInterval_ = 0.25f;
+ this->flashDt_ = 0.0f;
+ }
+
+ HUDBoostBar::~HUDBoostBar()
+ {
+ }
+
+ void HUDBoostBar::tick(float dt)
+ {
+ SUPER(HUDBoostBar, tick, dt);
+
+ if (this->owner_)
+ {
+ if (this->owner_->isBoostCoolingDown())
+ {
+ this->setBackgroundColour(ColourValue(0.7f, 0.2f, 0.2f));
+ if (this->flashDt_ <= 0.0f)
+ {
+ this->flashDt_ = this->flashInterval_;
+ this->setVisible(!this->isVisible());
+ }
+ else
+ this->flashDt_ -= dt;
+ }
+ else
+ {
+ this->flashDt_ = 0.0f;
+ this->show();
+ this->setBackgroundColour(ColourValue(0.2f, 0.7f, 0.2f));
+ }
+
+ float value = this->owner_->getBoostPower() / this->owner_->getInitialBoostPower();
+ this->setValue(value);
+ }
+ }
+
+ void HUDBoostBar::changedOwner()
+ {
+ SUPER(HUDBoostBar, changedOwner);
+
+ this->owner_ = orxonox_cast<SpaceShip*>(this->getOwner());
+ }
+}
+
Copied: code/trunk/src/modules/overlays/hud/HUDBoostBar.h (from rev 8705, code/branches/presentation/src/modules/overlays/hud/HUDBoostBar.h)
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDBoostBar.h (rev 0)
+++ code/trunk/src/modules/overlays/hud/HUDBoostBar.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,54 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Benjamin Knecht
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _HUDBoostBar_H__
+#define _HUDBoostBar_H__
+
+#include "overlays/OverlaysPrereqs.h"
+
+#include "tools/interfaces/Tickable.h"
+#include "HUDBar.h"
+
+namespace orxonox
+{
+ class _OverlaysExport HUDBoostBar : public HUDBar, public Tickable
+ {
+ public:
+ HUDBoostBar(BaseObject* creator);
+ virtual ~HUDBoostBar();
+
+ virtual void tick(float dt);
+ virtual void changedOwner();
+
+ private:
+ SpaceShip* owner_;
+ float flashInterval_;
+ float flashDt_;
+ };
+}
+#endif /* _HUDBoostBar_H__ */
Modified: code/trunk/src/modules/overlays/hud/HUDNavigation.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDNavigation.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/overlays/hud/HUDNavigation.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -341,7 +341,7 @@
panel->hide();
text->hide();
- ObjectInfo tempStruct = {panel, text, false};
+ ObjectInfo tempStruct = {panel, text, false /*, TODO: initialize wasOutOfView_ */};
activeObjectList_[object] = tempStruct;
this->background_->addChild ( panel );
Modified: code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc
===================================================================
--- code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -53,9 +53,9 @@
{
SUPER(HUDSpeedBar, tick, dt);
- if (this->owner_ && this->owner_->getEngine())
+ if (this->owner_)
{
- float value = this->owner_->getVelocity().length() / (this->owner_->getEngine()->getMaxSpeedFront() * this->owner_->getEngine()->getSpeedFactor() * this->owner_->getEngine()->getBoostFactor());
+ float value = this->owner_->getVelocity().length() / (this->owner_->getMaxSpeedFront() * this->owner_->getSpeedFactor() * this->owner_->getBoostFactor());
this->setValue(value);
}
}
Modified: code/trunk/src/modules/pickup/PickupManager.h
===================================================================
--- code/trunk/src/modules/pickup/PickupManager.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/pickup/PickupManager.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -147,7 +147,7 @@
@param pickup The Pickupable.
@return Returns true if the input Pickupable is still valid, false if not.
*/
- const bool isValidPickup(uint32_t pickup) const
+ bool isValidPickup(uint32_t pickup) const
{ return this->pickups_.find(pickup) != this->pickups_.end(); }
// tolua_end
Modified: code/trunk/src/modules/pickup/PickupPrereqs.h
===================================================================
--- code/trunk/src/modules/pickup/PickupPrereqs.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/pickup/PickupPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -84,6 +84,7 @@
class MetaPickup;
class SpeedPickup;
class ShieldPickup;
+ class ShrinkPickup;
}
Modified: code/trunk/src/modules/pickup/PickupRepresentation.cc
===================================================================
--- code/trunk/src/modules/pickup/PickupRepresentation.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/pickup/PickupRepresentation.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -56,7 +56,7 @@
RegisterObject(PickupRepresentation);
this->initialize();
- this->setSyncMode(0x0); // The default PickupRperesentation created by each PickupManager is not synchronised, since it only exists locally.
+ this->setSyncMode(ObjectDirection::None); // The default PickupRperesentation created by each PickupManager is not synchronised, since it only exists locally.
}
/**
Modified: code/trunk/src/modules/pickup/items/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/pickup/items/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/pickup/items/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -5,4 +5,5 @@
DronePickup.cc
SpeedPickup.cc
ShieldPickup.cc
+ ShrinkPickup.cc
)
Copied: code/trunk/src/modules/pickup/items/ShrinkPickup.cc (from rev 8705, code/branches/presentation/src/modules/pickup/items/ShrinkPickup.cc)
===================================================================
--- code/trunk/src/modules/pickup/items/ShrinkPickup.cc (rev 0)
+++ code/trunk/src/modules/pickup/items/ShrinkPickup.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,278 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+
+/**
+ @file ShrinkPickup.cc
+ @brief Implementation of the HealthPickup class.
+*/
+
+
+#include "ShrinkPickup.h"
+
+#include <sstream>
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "pickup/PickupIdentifier.h"
+#include "worldentities/pawns/Pawn.h"
+
+#include "weaponsystem/WeaponSlot.h"
+#include "weaponsystem/Weapon.h"
+#include "worldentities/CameraPosition.h"
+
+namespace orxonox
+{
+ CreateFactory(ShrinkPickup);
+
+ /**
+ @brief
+ Constructor: Initializes the Pickup.
+ */
+ ShrinkPickup::ShrinkPickup(BaseObject* creator) : Pickup(creator)
+ {
+ RegisterObject(ShrinkPickup);
+
+ this->initialize();
+ this->shrinkFactor_ = 5.0f;
+ this->shrinkSpeed_ = 5.0f;
+ this->duration_ = 5.0f;
+ this->isActive_ = false;
+ this->isTerminating_ = false;
+
+ this->size_ = 0;
+ this->defaultCameraPos_ = 0.0f;
+ this->defaultScale_ = Vector3::UNIT_SCALE;
+ this->actualScale_ = Vector3::UNIT_SCALE;
+ this->smallScale_ = Vector3::UNIT_SCALE;
+ this->defaultMass_ = 1.0f;
+ this->actualMass_ = 1.0f;
+ this->smallMass_ = 1.0f;
+ this->pawn_ = NULL;
+ }
+
+ ShrinkPickup::~ShrinkPickup()
+ {
+
+ }
+
+ void ShrinkPickup::initializeIdentifier(void)
+ {
+ std::stringstream stream;
+ stream << this->getShrinkFactor();
+ std::string type1 = "shrinkFactor";
+ std::string val1 = stream.str();
+ this->pickupIdentifier_->addParameter(type1, val1);
+
+ stream.clear();
+ stream << this->getDuration();
+ std::string val2 = stream.str();
+ std::string type2 = "duration";
+ this->pickupIdentifier_->addParameter(type2, val2);
+
+ stream.clear();
+ stream << this->getShrinkSpeed();
+ std::string val3 = stream.str();
+ std::string type3 = "shrinkSpeed";
+ this->pickupIdentifier_->addParameter(type3, val3);
+ }
+
+ /**
+ @brief
+ Method for creating a ShrinkhPickup object through XML.
+ */
+ void ShrinkPickup::XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode)
+ {
+ SUPER(ShrinkPickup, XMLPort, xmlelement, mode);
+
+ XMLPortParam(ShrinkPickup, "shrinkFactor", setShrinkFactor, getShrinkFactor, xmlelement, mode);
+ XMLPortParam(ShrinkPickup, "duration", setDuration, getDuration, xmlelement, mode);
+ XMLPortParam(ShrinkPickup, "shrinkSpeed", setShrinkSpeed, getShrinkSpeed, xmlelement, mode);
+
+ this->initializeIdentifier();
+ }
+
+ /**
+ @brief
+ Sets the shrinking factor.
+ @param factor
+ The factor.
+ */
+ void ShrinkPickup::setShrinkFactor(float factor)
+ {
+ this->shrinkFactor_ = factor;
+ }
+
+ /**
+ @brief
+ Sets the duration.
+ @param duration
+ The duration.
+ */
+ void ShrinkPickup::setDuration(float duration)
+ {
+ this->duration_ = duration;
+ }
+
+ /**
+ @brief
+ Sets the shrinking speed.
+ @param speed
+ The speed.
+ */
+ void ShrinkPickup::setShrinkSpeed(float speed)
+ {
+ this->shrinkSpeed_ = speed;
+ }
+
+ void ShrinkPickup::initialize(void)
+ {
+ this->addTarget(ClassIdentifier<Pawn>::getIdentifier());
+ }
+
+ /**
+ @brief
+ Prepares for shrinking (collecting several informations).
+ */
+ void ShrinkPickup::changedUsed(void)
+ {
+ SUPER(ShrinkPickup, changedUsed);
+
+ if(this->isUsed())
+ {
+ this->pawn_ = this->carrierToPawnHelper();
+ if(this->pawn_ == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.
+ this->Pickupable::destroy();
+
+ //Collect scaling information.
+ this->defaultScale_ = this->pawn_->getScale3D();
+ this->defaultMass_ = this->pawn_->getMass();
+
+ this->smallScale_ = this->defaultScale_ / this->shrinkFactor_;
+ this->smallMass_ = this->defaultMass_ / this->shrinkFactor_;
+
+ this->actualScale_ = this->defaultScale_;
+ this->actualMass_ = this->defaultMass_;
+
+ this->cameraPositions_ = this->pawn_->getCameraPositions();
+ this->size_ = this->cameraPositions_.size();
+ this->isActive_ = true; //start shrinking now.
+ this->durationTimer_.setTimer(this->duration_, false, createExecutor(createFunctor(&ShrinkPickup::terminate, this))); //Set timer for termination.
+ }
+ }
+
+ /**
+ @brief
+ Updates the scales of the ship.
+ @param dt
+ Time since last call.
+ */
+ void ShrinkPickup::tick(float dt)
+ {
+ if(this->isActive_ == true && this->actualScale_ > this->smallScale_) //if the ship has not reached the target scale, continue shrinking
+ {
+ float factor = 1 + dt*this->shrinkSpeed_;
+
+ this->actualScale_ /= factor;
+ this->actualMass_ /= factor;
+
+ this->pawn_->setScale3D(this->actualScale_);
+ this->pawn_->setMass(this->actualMass_);
+
+ for(int index = 0; index < this->size_; index++)
+ {
+ CameraPosition* cameraPos = this->pawn_->getCameraPosition(index);
+ if(cameraPos == NULL)
+ continue;
+ cameraPos->setPosition(cameraPos->getPosition()*factor);
+ }
+ }
+ else this->isActive_ = false;
+
+ if(this->isTerminating_ == true && this->actualScale_ < this->defaultScale_) //grow until the ship reaches its default scale.
+ {
+ float factor = 1 + dt*this->shrinkSpeed_;
+
+ this->actualScale_ *= factor;
+ this->actualMass_ *= factor;
+
+ this->pawn_->setScale3D(this->actualScale_);
+ this->pawn_->setMass(this->actualMass_);
+
+ for(int index = 0; index < this->size_; index++)
+ {
+ CameraPosition* cameraPos = this->pawn_->getCameraPosition(index);
+ if(cameraPos == NULL)
+ continue;
+ cameraPos->setPosition(cameraPos->getPosition()/factor);
+ }
+ }
+ else if(this->isTerminating_ == true)
+ this->Pickupable::destroy();
+
+ }
+
+ /**
+ @brief
+ Initializes the termination.
+ */
+ void ShrinkPickup::terminate(void)
+ {
+ this->isActive_ = false;
+ this->isTerminating_ = true;
+ setUsed(false);
+ }
+
+ Pawn* ShrinkPickup::carrierToPawnHelper(void)
+ {
+ PickupCarrier* carrier = this->getCarrier();
+ Pawn* pawn = dynamic_cast<Pawn*>(carrier);
+
+ return pawn;
+ }
+
+ /**
+ @brief
+ Creates a duplicate of the input OrxonoxClass.
+ @param item
+ A pointer to the Orxonox class.
+ */
+ void ShrinkPickup::clone(OrxonoxClass*& item)
+ {
+ if(item == NULL)
+ item = new ShrinkPickup(this);
+
+ SUPER(ShrinkPickup, clone, item);
+ ShrinkPickup* pickup = dynamic_cast<ShrinkPickup*>(item);
+ pickup->setShrinkFactor(this->getShrinkFactor());
+ pickup->setDuration(this->getDuration());
+ pickup->setShrinkSpeed(this->getShrinkSpeed());
+
+ pickup->initializeIdentifier();
+ }
+}
Copied: code/trunk/src/modules/pickup/items/ShrinkPickup.h (from rev 8705, code/branches/presentation/src/modules/pickup/items/ShrinkPickup.h)
===================================================================
--- code/trunk/src/modules/pickup/items/ShrinkPickup.h (rev 0)
+++ code/trunk/src/modules/pickup/items/ShrinkPickup.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,124 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file ShrinkPickup.h
+ @brief Declaration of the ShrinkPickup class.
+ @ingroup PickupItems
+*/
+
+
+#ifndef _ShrinkPickup_H__
+#define _ShrinkPickup_H__
+
+#include "pickup/PickupPrereqs.h"
+
+#include <string>
+#include <vector>
+
+#include "pickup/Pickup.h"
+#include "tools/interfaces/Tickable.h"
+
+namespace orxonox {
+
+ /**
+ @author
+ Sandro Sgier
+
+ @ingroup PickupItems
+ */
+
+ /**
+ @brief
+ The ShrinkPickup is a Pickupable that causes the pawn to shrink to a certain size for a certain time with a certain speed, all of them specified in the following variables:
+ - The @b shrinkFactor It determines how much the ship is going to shrink (e.g. the factor 2 would make the ship shrinking to half its size).
+ - The @b duration Specifies how long the ship will keep small.
+ - The @b shrinkSpeed Defines how fast the ship shrinks and grows.
+
+
+ An example of a XML implementation of a HealthPickup would be:
+ @code
+ <HealthPickup
+ shrinkFactor = "5.0"
+ duration = "5.0"
+ shrinkSpeed = "5.0"
+ />
+ @endcode
+
+ @author
+ Sandro Sgier
+
+ @ingroup PickupItems
+ */
+
+ class _PickupExport ShrinkPickup : public Pickup, public Tickable
+ {
+ public:
+ ShrinkPickup(BaseObject* creator); //!< Constructor.
+ virtual ~ShrinkPickup(); //!< Destructor.
+ virtual void changedUsed(void); //!< Is called when the pickup has transited from used to unused or the other way around.
+ virtual void clone(OrxonoxClass*& item); //!< Creates a duplicate of the input OrxonoxClass.
+ virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode);
+ inline float getShrinkFactor(void) const
+ { return this->shrinkFactor_; }
+ inline float getDuration(void) const
+ { return this->duration_; }
+ inline float getShrinkSpeed(void) const
+ { return this->shrinkSpeed_; }
+ void setShrinkFactor(float factor);
+ void setDuration(float duration);
+ void setShrinkSpeed(float speed);
+ void tick(float dt);
+
+ protected:
+ void initializeIdentifier(void);
+
+ private:
+ void initialize(void);
+ float duration_; //!< determines how long the pickup will be active
+ float shrinkFactor_; //shrink factor of the space ship
+ float shrinkSpeed_; //speed of shrinking
+ bool isActive_; //true if ship is shrinking or small
+ bool isTerminating_; //true if ship is growing
+ int size_; //number of camera positions
+ std::list<SmartPtr<CameraPosition> > cameraPositions_;
+ float defaultCameraPos_; //all default, actual and small values...
+ Ogre::Vector3 defaultScale_;
+ Ogre::Vector3 actualScale_;
+ Ogre::Vector3 smallScale_;
+ float defaultMass_;
+ float actualMass_;
+ float smallMass_;
+ Pawn* carrierToPawnHelper(void);
+ Pawn* pawn_;
+ Timer durationTimer_;
+ void terminate(void);
+ };
+}
+
+#endif
Modified: code/trunk/src/modules/pong/PongBat.h
===================================================================
--- code/trunk/src/modules/pong/PongBat.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/pong/PongBat.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -99,7 +99,7 @@
void setLength(float length)
{ this->length_ = length; }
/**
- @brief get the length of the bat.
+ @brief Get the length of the bat.
@return Returns the length of the bat (in z-direction) as percentage of the height of the playing field.
*/
float getLength() const
Property changes on: code/trunk/src/modules/portals/CMakeLists.txt
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/modules/portals/PortalEndPoint.cc
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/portals/PortalEndPoint.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,3 +1,31 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Andreas Büchel
+ * Co-authors:
+ * ...
+ *
+ */
+
#include "PortalEndPoint.h"
#include "core/XMLPort.h"
#include "objects/triggers/MultiTriggerContainer.h"
@@ -3,6 +31,6 @@
#include "portals/PortalLink.h"
#include "worldentities/MobileEntity.h"
+#include <ctime>
-
namespace orxonox
{
@@ -13,17 +41,23 @@
std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s;
- PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), id_(0), trigger_(NULL)
+ PortalEndPoint::PortalEndPoint(BaseObject* creator) : StaticEntity(creator), RadarViewable(creator, static_cast<WorldEntity*>(this)), id_(0), trigger_(NULL), reenterDelay_(0)
{
RegisterObject(PortalEndPoint);
+
this->trigger_ = new DistanceMultiTrigger(this);
this->trigger_->setName("portal");
this->attach(trigger_);
+
+ this->setRadarObjectColour(ColourValue::White);
+ this->setRadarObjectShape(RadarViewable::Dot);
+ this->setRadarVisibility(true);
}
PortalEndPoint::~PortalEndPoint()
{
- delete this->trigger_;
+ if(this->isInitialized() && this->trigger_ != NULL)
+ delete this->trigger_;
}
void PortalEndPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -32,6 +66,7 @@
XMLPortParam(PortalEndPoint, "id", setID, getID, xmlelement, mode);
XMLPortParam(PortalEndPoint, "design", setTemplate, getTemplate, xmlelement, mode);
+ XMLPortParam(PortalEndPoint, "reenterDelay", setReenterDelay, getReenterDelay, xmlelement, mode);
XMLPortParamExtern(PortalEndPoint, DistanceMultiTrigger, this->trigger_, "distance", setDistance, getDistance, xmlelement, mode);
XMLPortParamLoadOnly(PortalEndPoint, "target", setTarget, xmlelement, mode).defaultValues("Pawn");
@@ -63,7 +98,6 @@
DistanceMultiTrigger * originatingTrigger = orxonox_cast<DistanceMultiTrigger *>(cont->getOriginator());
if(originatingTrigger == 0)
{
- COUT(1) << "originator no DistanceMultiTrigger\n" << std::endl;
return true;
}
@@ -73,7 +107,7 @@
if(bTriggered)
{
- if(this->recentlyJumpedOut_.find(entity) == this->recentlyJumpedOut_.end()) // only enter the portal if not just jumped out of it
+ if(this->letsEnter(entity)) // only enter the portal if not just (this very moment) jumped out of it, or if the reenterDelay expired
{
PortalLink::use(entity, this);
}
@@ -86,14 +120,37 @@
return true;
}
+ void PortalEndPoint::changedActivity(void)
+ {
+ SUPER(PortalEndPoint, changedActivity);
+
+ this->setRadarVisibility(this->isActive());
+ }
+
+ bool PortalEndPoint::letsEnter(MobileEntity* entity)
+ {
+ // not allowed to enter if reenterDelay hasn't expired yet
+ std::map<MobileEntity *, time_t>::const_iterator time = this->jumpOutTimes_.find(entity);
+ if(time != this->jumpOutTimes_.end() && std::difftime(std::time(0),time->second) < this->reenterDelay_)
+ return false;
+
+ // not allowed to enter if jumped out of this portal and not left its activation radius yet
+ std::set<MobileEntity *>::const_iterator recent = this->recentlyJumpedOut_.find(entity);
+ if(recent != this->recentlyJumpedOut_.end())
+ return false;
+
+ return true;
+ }
+
void PortalEndPoint::jumpOut(MobileEntity* entity)
{
+ this->jumpOutTimes_[entity] = std::time(0);
this->recentlyJumpedOut_.insert(entity);
-
+
+ // adjust
entity->setPosition(this->getWorldPosition());
entity->rotate(this->getWorldOrientation());
entity->setVelocity(this->getWorldOrientation() * entity->getVelocity());
- entity->setVelocity(entity->getVelocity() * 1.5);
}
}
Property changes on: code/trunk/src/modules/portals/PortalEndPoint.cc
___________________________________________________________________
Deleted: svn:executable
- *
Added: svn:eol-style
+ native
Modified: code/trunk/src/modules/portals/PortalEndPoint.h
===================================================================
--- code/trunk/src/modules/portals/PortalEndPoint.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/portals/PortalEndPoint.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,3 +1,37 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Andreas Büchel
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ * @file PortalEndPoint.h
+ * @brief Declaration of the PortalEndPoint class.
+ * @ingroup Portals
+ */
+
#ifndef _PortalEndPoint_H__
#define _PortalEndPoint_H__
@@ -8,59 +42,67 @@
#include <map>
#include "worldentities/StaticEntity.h"
+#include "interfaces/RadarViewable.h"
#include "graphics/Billboard.h"
#include "objects/triggers/DistanceMultiTrigger.h"
#include "core/EventIncludes.h"
+#include <ctime>
namespace orxonox
{
- class _PortalsExport PortalEndPoint : public StaticEntity
+ /**
+ @brief
+ A PortalEndPoint serves as portal entrance and/or exit.
+
+ @ingroup Portals
+ */
+
+ class _PortalsExport PortalEndPoint : public StaticEntity, public RadarViewable
{
public:
PortalEndPoint(BaseObject* creator);
virtual ~PortalEndPoint();
+
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void changedActivity(void);
+
inline void setTarget(const std::string & target) //!< add types which are allowed to activate the PortalEndPoint
- {
- this->trigger_->addTarget(target);
- }
+ { this->trigger_->addTarget(target); }
void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint
+ inline void setReenterDelay(unsigned int seconds)
+ { this->reenterDelay_ = seconds; }
+ inline unsigned int getReenterDelay()
+ { return this->reenterDelay_; }
inline void setID(unsigned int id)
- {
- this->id_ = id;
- }
+ { this->id_ = id; }
inline unsigned int getID() const
- {
- return this->id_;
- }
+ { return this->id_; }
/// \brief Set templateName_ (the name of the design Template) and add that Template to this Object
inline void setTemplate(const std::string & name)
- {
- this->templateName_ = name;
- this->addTemplate(name);
- }
+ { this->templateName_ = name; this->addTemplate(name); }
/// \brief Get the name of the attached design template
inline const std::string & getTemplate()
- {
- return this->templateName_;
- }
+ { return this->templateName_; }
/*! \brief This function is called each time the DistanceMultiTrigger of this PortalEndPoint changed
- * \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
- * \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
- *
- * if bTriggered is \c true the triggering entity enters this portal (if it is an entrance)
- * otherwise the triggering entity is removed from the set of entities who recently jumped out of this portal */
+ \param bTriggered true if the trigger was triggered on, false if the trigger has switched to off
+ \param trigger the MultiTriggerContainer containing the triggering BaseObject (and trigger_ the portal's MultiDistanceTrigger which we already know)
+ */
bool execute(bool bTriggered, BaseObject* trigger);
/*! \brief Let an Entity jump out of this portal no matter where it was before
* \param entity The Entity which should jump out of this portal */
void jumpOut(MobileEntity * entity);
+
+ /** \brief Tells wether a certain Entity is allowed to enter the PortalEndPoint?
+ @return @c true if the entity not just came out of this portal and the reenterDelay has expired for it, @c false otherwise
+ */
+ bool letsEnter(MobileEntity* entity);
protected:
private:
@@ -70,7 +112,9 @@
DistanceMultiTrigger * trigger_; //!< the DistanceMultiTrigger which notices near entities of the defined type
std::string templateName_; //!< The name of the design template used for this endpoint
- std::set<MobileEntity *> recentlyJumpedOut_; //!< Entities which recently jumped out of this EndPoint, hence they shouldn't be pulled in again if the endpoint is the beginning of a link
+ int reenterDelay_;
+ std::map<MobileEntity *, time_t> jumpOutTimes_; //!< Stores the time at which a certain MobileEntity @ref jumpOut "jumped out" of this PortalEndPoint
+ std::set<MobileEntity *> recentlyJumpedOut_; //!< Stores the entities witch recently jumped out of this PortalEndPoint and haven't left the activation radius yet. This is needed in order to prevent them from beeing pulled into the PortalEndPoint they have just come out of.
};
}
Property changes on: code/trunk/src/modules/portals/PortalEndPoint.h
___________________________________________________________________
Deleted: svn:executable
- *
Added: svn:eol-style
+ native
Modified: code/trunk/src/modules/portals/PortalLink.cc
===================================================================
--- code/trunk/src/modules/portals/PortalLink.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/portals/PortalLink.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,3 +1,31 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Andreas Büchel
+ * Co-authors:
+ * ...
+ *
+ */
+
#include "PortalLink.h"
#include "core/XMLPort.h"
#include "objects/triggers/MultiTriggerContainer.h"
@@ -16,6 +44,7 @@
PortalLink::~PortalLink()
{
+
}
void PortalLink::XMLPort(Element& xmlelement, XMLPort::Mode mode)
@@ -36,17 +65,14 @@
{
if(entrance == 0)
{
- // TODO COUT
return;
}
- std::map<PortalEndPoint *, PortalEndPoint *>::iterator endpoint = PortalLink::links_s.find(entrance);
+ std::map<PortalEndPoint *, PortalEndPoint *>::iterator endpoints = PortalLink::links_s.find(entrance);
- if(endpoint == PortalLink::links_s.end()) // entrance has no corresponding exit
+ if(endpoints == PortalLink::links_s.end()) // entrance has no corresponding exit
return;
-
- endpoint->second->jumpOut(entity);
+
+ endpoints->second->jumpOut(entity);
}
-
-
}
Property changes on: code/trunk/src/modules/portals/PortalLink.cc
___________________________________________________________________
Deleted: svn:executable
- *
Added: svn:eol-style
+ native
Modified: code/trunk/src/modules/portals/PortalLink.h
===================================================================
--- code/trunk/src/modules/portals/PortalLink.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/portals/PortalLink.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,3 +1,37 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Andreas Büchel
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file PortalLink.h
+ @brief Declaration of the PortalLink class
+ @ingroup Portals
+ */
+
#ifndef _PortalLink_H__
#define _PortalLink_H__
@@ -11,6 +45,11 @@
namespace orxonox
{
+ /**
+ @brief
+ A PortalLink represents the connection between two @ref orxonox::PortalEndPoint "PortalEndPoints"
+ @ingroup Portals
+ */
class _PortalsExport PortalLink : public BaseObject
{
public:
@@ -33,18 +72,19 @@
{
return this->toID_;
}
- static void use(MobileEntity * entity, PortalEndPoint * entrance); //
+ /*! \brief Let an entity enter a certain PortalEndPoint
+ \param entity pointer to the entity which is entering a PortalEndPoint
+ \param entrance pointer to the PortalEndPoint to enter
+ */
+ static void use(MobileEntity * entity, PortalEndPoint * entrance); //!< let entity enter the PortalEndPoint pointed to by entrance
protected:
private:
- static std::map<PortalEndPoint *, PortalEndPoint *> links_s;
- unsigned int fromID_;
- unsigned int toID_;
- PortalEndPoint* from_;
- PortalEndPoint* to_;
- float activationRadius_;
- bool isNowPortable(WorldEntity * ent);
+ static std::map<PortalEndPoint *, PortalEndPoint *> links_s; //!< maps entrances to exits
+ unsigned int fromID_; //!< id of the entrance of this Link
+ unsigned int toID_; //!< id of the exit of this Link
+ PortalEndPoint* from_; //!< pointer to this Link's entrance
+ PortalEndPoint* to_; //!< pointer to this Link's exit
};
-
}
#endif /* _Portals_H__ */
Property changes on: code/trunk/src/modules/portals/PortalLink.h
___________________________________________________________________
Deleted: svn:executable
- *
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/portals/PortalsPrecompiledHeaders.h
___________________________________________________________________
Added: svn:eol-style
+ native
Property changes on: code/trunk/src/modules/portals/PortalsPrereqs.h
___________________________________________________________________
Added: svn:eol-style
+ native
Modified: code/trunk/src/modules/questsystem/QuestDescription.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestDescription.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/questsystem/QuestDescription.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -39,7 +39,7 @@
#include "infos/PlayerInfo.h"
-#include "notifications/NotificationManager.h"
+#include "interfaces/NotificationListener.h"
namespace orxonox
{
@@ -118,7 +118,7 @@
return false;
}
- NotificationManager::sendNotification(message, player->getClientID(), QuestDescription::SENDER);
+ NotificationListener::sendNotification(message, QuestDescription::SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
return true;
}
Modified: code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestEffectBeacon.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/questsystem/QuestEffectBeacon.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -112,7 +112,7 @@
}
PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger);
- Pawn* pawn = NULL;
+ PlayerInfo* player = NULL;
// If the trigger is a PlayerTrigger.
if(pTrigger != NULL)
@@ -120,26 +120,17 @@
if(!pTrigger->isForPlayer()) // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one.
return false;
else
- pawn = pTrigger->getTriggeringPlayer();
+ player = pTrigger->getTriggeringPlayer();
}
else
return false;
- if(pawn == NULL)
+ if(player == NULL)
{
COUT(4) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << std::endl;
return false;
}
- // Extract the PlayerInfo from the Pawn.
- PlayerInfo* player = pawn->getPlayer();
-
- if(player == NULL)
- {
- COUT(3) << "The PlayerInfo* is NULL." << std::endl;
- return false;
- }
-
COUT(4) << "QuestEffectBeacon executed on player: " << player << " ." << std::endl;
bool temp = QuestEffect::invokeEffects(player, this->effects_); // Invoke the QuestEffects on the PlayerInfo.
Modified: code/trunk/src/modules/questsystem/QuestManager.cc
===================================================================
--- code/trunk/src/modules/questsystem/QuestManager.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/questsystem/QuestManager.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -273,6 +273,9 @@
*/
int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player)
{
+ if(quest == NULL)
+ return this->getNumRootQuests(player);
+
std::list<Quest*> quests = quest->getSubQuestList();
int numQuests = 0;
for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
@@ -295,6 +298,9 @@
*/
Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index)
{
+ if(quest == NULL)
+ return this->getRootQuest(player, index);
+
std::list<Quest*> quests = quest->getSubQuestList();
for(std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)
{
@@ -311,7 +317,8 @@
The quest to get the hints of.
@param player
The player.
- @return Returns the number of QuestHints of the input Quest for the input player.
+ @return
+ Returns the number of QuestHints of the input Quest for the input player.
*/
int QuestManager::getNumHints(Quest* quest, PlayerInfo* player)
{
@@ -334,6 +341,8 @@
The player.
@param index
The index of the QuestHint.
+ @return
+ Returns a pointer to the index-th QuestHint of the input Quest for the input player.
*/
QuestHint* QuestManager::getHints(Quest* quest, PlayerInfo* player, int index)
{
@@ -348,6 +357,19 @@
/**
@brief
+ Get the parent-quest of the input Quest.
+ @param quest
+ The Quest to get the parent-quest of.
+ @return
+ Returns a pointer to the parent-quest of the input Quest.
+ */
+ Quest* QuestManager::getParentQuest(Quest* quest)
+ {
+ return quest->getParentQuest();
+ }
+
+ /**
+ @brief
Get the QuestDescription of the input Quest.
@param item
The Quest to get the QuestDescription of.
@@ -374,6 +396,32 @@
/**
@brief
+ Get the id of the input Quest.
+ @param item
+ The Quest to get the id of.
+ @return
+ Returns the id of the input Quest.
+ */
+ const std::string QuestManager::getId(Quest* item) const
+ {
+ return item->getId();
+ }
+
+ /**
+ @brief
+ Get the id of the input QuestHint.
+ @param item
+ The QuestHint to get the id of.
+ @return
+ Returns the id of the input QuestHint.
+ */
+ const std::string QuestManager::getId(QuestHint* item) const
+ {
+ return item->getId();
+ }
+
+ /**
+ @brief
Retrieve the player for a certain GUI.
@param guiName
The name of the GUI the player is retrieved for.
Modified: code/trunk/src/modules/questsystem/QuestManager.h
===================================================================
--- code/trunk/src/modules/questsystem/QuestManager.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/questsystem/QuestManager.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -80,8 +80,13 @@
int getNumHints(Quest* quest, orxonox::PlayerInfo* player); //!< Get the number of QuestHints of the input Quest for the input player.
QuestHint* getHints(Quest* quest, orxonox::PlayerInfo* player, int index); //!< Get the index-th QuestHint of the input Quest for the input player.
- QuestDescription* getDescription(Quest* item);
- QuestDescription* getDescription(QuestHint* item);
+ Quest* getParentQuest(Quest* quest); //!< Get the parent-quest of the input Quest.
+
+ QuestDescription* getDescription(Quest* item); //!< Get the QuestDescription of the input Quest.
+ QuestDescription* getDescription(QuestHint* item); //!< Get the QuestDescription of the input QuestHint.
+
+ const std::string getId(Quest* item) const; //!< Get the id of the input Quest.
+ const std::string getId(QuestHint* item) const; //!< Get the id of the input QuestHint.
// tolua_end
bool registerQuest(Quest* quest); //!< Registers a Quest in the QuestManager.
Deleted: code/trunk/src/modules/tetris/CMakeLists.txt
===================================================================
--- code/branches/presentation/src/modules/tetris/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/tetris/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,13 +0,0 @@
-SET_SOURCE_FILES(TETRIS_SRC_FILES
- Tetris.cc
- TetrisCenterpoint.cc
- TetrisStone.cc
-)
-
-ORXONOX_ADD_LIBRARY(tetris
- MODULE
- FIND_HEADER_FILES
- LINK_LIBRARIES
- orxonox
- SOURCE_FILES ${TETRIS_SRC_FILES}
-)
Copied: code/trunk/src/modules/tetris/CMakeLists.txt (from rev 8705, code/branches/presentation/src/modules/tetris/CMakeLists.txt)
===================================================================
--- code/trunk/src/modules/tetris/CMakeLists.txt (rev 0)
+++ code/trunk/src/modules/tetris/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,13 @@
+SET_SOURCE_FILES(TETRIS_SRC_FILES
+ Tetris.cc
+ TetrisCenterpoint.cc
+ TetrisStone.cc
+)
+
+ORXONOX_ADD_LIBRARY(tetris
+ MODULE
+ FIND_HEADER_FILES
+ LINK_LIBRARIES
+ orxonox
+ SOURCE_FILES ${TETRIS_SRC_FILES}
+)
Deleted: code/trunk/src/modules/tetris/Tetris.cc
===================================================================
--- code/branches/presentation/src/modules/tetris/Tetris.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/tetris/Tetris.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,293 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * ...
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file Tetris.cc
- @brief Implementation of the Tetris class.
-*/
-
-#include "Tetris.h"
-
-#include "core/CoreIncludes.h"
-#include "core/EventIncludes.h"
-#include "core/command/Executor.h"
-
-#include "gamestates/GSLevel.h"
-
-#include "TetrisCenterpoint.h"
-#include "TetrisStone.h"
-#include "infos/PlayerInfo.h"
-
-namespace orxonox
-{
-
- CreateUnloadableFactory(Tetris);
-
- /**
- @brief
- Constructor. Registers and initializes the object.
- */
- Tetris::Tetris(BaseObject* creator) : Deathmatch(creator)
- {
- RegisterObject(Tetris);
-
- this->activeStone_ = NULL;
-
- // Pre-set the timer, but don't start it yet.
- this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Tetris::startStone, this)));
- this->starttimer_.stopTimer();
-
- this->player_ = NULL;
- }
-
- /**
- @brief
- Destructor. Cleans up, if initialized.
- */
- Tetris::~Tetris()
- {
- if (this->isInitialized())
- this->cleanup();
- }
-
- /**
- @brief
- Cleans up the Gametype.
- */
- void Tetris::cleanup()
- {
-
- }
-
- void Tetris::tick(float dt)
- {
- SUPER(Tetris, tick, dt);
-
- if(this->activeStone_ != NULL)
- {
- if(!this->isValidStonePosition(this->activeStone_, this->activeStone_->getPosition()))
- {
- this->activeStone_->setVelocity(Vector3::ZERO);
- this->createStone();
- this->startStone();
- }
- }
- }
-
- bool Tetris::isValidMove(TetrisStone* stone, const Vector3& position)
- {
- assert(stone);
-
- if(position.x < this->center_->getStoneSize()/2.0) //!< If the stone touches the left edge of the level
- return false;
- else if(position.x > (this->center_->getWidth()-0.5)*this->center_->getStoneSize()) //!< If the stone touches the right edge of the level
- return false;
-
- for(std::vector<TetrisStone*>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
- {
- if(stone == *it)
- continue;
-
- const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
-
- if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize())
- return false;
- }
-
- return true;
- }
-
- bool Tetris::isValidStonePosition(TetrisStone* stone, const Vector3& position)
- {
- assert(stone);
-
- // we use a reverse iterator because we have to check for collisions with the topmost stones first
- for(std::vector<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it)
- {
- if(stone == *it)
- continue;
-
- const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
-
- if((position.x == currentStonePosition.x) && (position.y < currentStonePosition.y + this->center_->getStoneSize()))
- {
- this->activeStone_->setPosition(Vector3(this->activeStone_->getPosition().x, currentStonePosition.y+this->center_->getStoneSize(), this->activeStone_->getPosition().z));
- return false;
- }// This case applies if the stones overlap partially vertically
- }
-
- // after we checked for collision with all stones, we also check for collision with the bottom
- if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level
- {
- stone->setPosition(Vector3(stone->getPosition().x, this->center_->getStoneSize()/2.0f, stone->getPosition().z));
- return false;
- }
-
- return true;
- }
-
- /**
- @brief
- Starts the Tetris minigame.
- */
- void Tetris::start()
- {
- if (this->center_ != NULL) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place.
- {
- // Create the first stone.
- this->createStone();
- }
- else // If no centerpoint was specified, an error is thrown and the level is exited.
- {
- COUT(1) << "Error: No Centerpoint specified." << std::endl;
- GSLevel::startMainMenu();
- return;
- }
-
- // Start the timer. After it has expired the stone is started.
- this->starttimer_.startTimer();
-
- // Set variable to temporarily force the player to spawn.
- bool temp = this->bForceSpawn_;
- this->bForceSpawn_ = true;
-
- // Call start for the parent class.
- Deathmatch::start();
-
- // Reset the variable.
- this->bForceSpawn_ = temp;
- }
-
- /**
- @brief
- Ends the Tetris minigame.
- */
- void Tetris::end()
- {
- this->cleanup();
-
- // Call end for the parent class.
- Deathmatch::end();
- }
-
- /**
- @brief
- Spawns player.
- */
- void Tetris::spawnPlayersIfRequested()
- {
- // Spawn a human player.
- for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
- if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
- this->spawnPlayer(it->first);
- }
-
- /**
- @brief
- Spawns the input player.
- @param player
- The player to be spawned.
- */
- void Tetris::spawnPlayer(PlayerInfo* player)
- {
- assert(player);
-
- if(this->player_ == NULL)
- {
- this->player_ = player;
- this->players_[player].state_ = PlayerState::Alive;
- }
- }
-
- /**
- @brief
- Starts the first stone.
- */
- void Tetris::startStone(void)
- {
- if(this->player_ == NULL)
- return;
-
- unsigned int cameraIndex = 0;
- if(this->activeStone_ != NULL)
- {
- // Get camera settings
- cameraIndex = this->activeStone_->getCurrentCameraIndex();
- this->player_->stopControl();
- }
-
- // Make the last stone to be created the active stone.
- this->activeStone_ = this->stones_.back();
-
- this->player_->startControl(this->activeStone_);
- this->activeStone_->setVelocity(0.0f, -this->center_->getStoneSpeed(), 0.0f);
- this->activeStone_->setCameraPosition(cameraIndex);
- }
-
- /**
- @brief
- Creates a new stone.
- */
- void Tetris::createStone(void)
- {
- // Create a new stone and add it to the list of stones.
- TetrisStone* stone = new TetrisStone(this->center_);
- this->stones_.push_back(stone);
-
- // Apply the stone template to the stone.
- stone->addTemplate(this->center_->getStoneTemplate());
-
- // Attach the stone to the Centerpoint and set the position of the stone to be at the top middle.
- this->center_->attach(stone);
- float xPos = (this->center_->getWidth()/2 + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();
- float yPos = (this->center_->getHeight()-0.5f)*this->center_->getStoneSize();
- stone->setPosition(xPos, yPos, 0.0f);
- stone->setGame(this);
- }
-
- /**
- @brief
- Get the player.
- @return
- Returns a pointer to the player. If there is no player, NULL is returned.
- */
- PlayerInfo* Tetris::getPlayer(void) const
- {
- return this->player_;
- }
-
- /**
- @brief Set the TetrisCenterpoint (the playing field).
- @param center A pointer to the TetrisCenterpoint to be set.
- */
- void Tetris::setCenterpoint(TetrisCenterpoint* center)
- {
- this->center_ = center;
- }
-
-}
Copied: code/trunk/src/modules/tetris/Tetris.cc (from rev 8705, code/branches/presentation/src/modules/tetris/Tetris.cc)
===================================================================
--- code/trunk/src/modules/tetris/Tetris.cc (rev 0)
+++ code/trunk/src/modules/tetris/Tetris.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,293 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Tetris.cc
+ @brief Implementation of the Tetris class.
+*/
+
+#include "Tetris.h"
+
+#include "core/CoreIncludes.h"
+#include "core/EventIncludes.h"
+#include "core/command/Executor.h"
+
+#include "gamestates/GSLevel.h"
+
+#include "TetrisCenterpoint.h"
+#include "TetrisStone.h"
+#include "infos/PlayerInfo.h"
+
+namespace orxonox
+{
+
+ CreateUnloadableFactory(Tetris);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ Tetris::Tetris(BaseObject* creator) : Deathmatch(creator)
+ {
+ RegisterObject(Tetris);
+
+ this->activeStone_ = NULL;
+
+ // Pre-set the timer, but don't start it yet.
+ this->starttimer_.setTimer(1.0, false, createExecutor(createFunctor(&Tetris::startStone, this)));
+ this->starttimer_.stopTimer();
+
+ this->player_ = NULL;
+ }
+
+ /**
+ @brief
+ Destructor. Cleans up, if initialized.
+ */
+ Tetris::~Tetris()
+ {
+ if (this->isInitialized())
+ this->cleanup();
+ }
+
+ /**
+ @brief
+ Cleans up the Gametype.
+ */
+ void Tetris::cleanup()
+ {
+
+ }
+
+ void Tetris::tick(float dt)
+ {
+ SUPER(Tetris, tick, dt);
+
+ if(this->activeStone_ != NULL)
+ {
+ if(!this->isValidStonePosition(this->activeStone_, this->activeStone_->getPosition()))
+ {
+ this->activeStone_->setVelocity(Vector3::ZERO);
+ this->createStone();
+ this->startStone();
+ }
+ }
+ }
+
+ bool Tetris::isValidMove(TetrisStone* stone, const Vector3& position)
+ {
+ assert(stone);
+
+ if(position.x < this->center_->getStoneSize()/2.0) //!< If the stone touches the left edge of the level
+ return false;
+ else if(position.x > (this->center_->getWidth()-0.5)*this->center_->getStoneSize()) //!< If the stone touches the right edge of the level
+ return false;
+
+ for(std::vector<TetrisStone*>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)
+ {
+ if(stone == *it)
+ continue;
+
+ const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
+
+ if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize())
+ return false;
+ }
+
+ return true;
+ }
+
+ bool Tetris::isValidStonePosition(TetrisStone* stone, const Vector3& position)
+ {
+ assert(stone);
+
+ // we use a reverse iterator because we have to check for collisions with the topmost stones first
+ for(std::vector<TetrisStone*>::const_reverse_iterator it = this->stones_.rbegin(); it != this->stones_.rend(); ++it)
+ {
+ if(stone == *it)
+ continue;
+
+ const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone
+
+ if((position.x == currentStonePosition.x) && (position.y < currentStonePosition.y + this->center_->getStoneSize()))
+ {
+ this->activeStone_->setPosition(Vector3(this->activeStone_->getPosition().x, currentStonePosition.y+this->center_->getStoneSize(), this->activeStone_->getPosition().z));
+ return false;
+ }// This case applies if the stones overlap partially vertically
+ }
+
+ // after we checked for collision with all stones, we also check for collision with the bottom
+ if(position.y < this->center_->getStoneSize()/2.0f) //!< If the stone has reached the bottom of the level
+ {
+ stone->setPosition(Vector3(stone->getPosition().x, this->center_->getStoneSize()/2.0f, stone->getPosition().z));
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ @brief
+ Starts the Tetris minigame.
+ */
+ void Tetris::start()
+ {
+ if (this->center_ != NULL) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place.
+ {
+ // Create the first stone.
+ this->createStone();
+ }
+ else // If no centerpoint was specified, an error is thrown and the level is exited.
+ {
+ COUT(1) << "Error: No Centerpoint specified." << std::endl;
+ GSLevel::startMainMenu();
+ return;
+ }
+
+ // Start the timer. After it has expired the stone is started.
+ this->starttimer_.startTimer();
+
+ // Set variable to temporarily force the player to spawn.
+ bool temp = this->bForceSpawn_;
+ this->bForceSpawn_ = true;
+
+ // Call start for the parent class.
+ Deathmatch::start();
+
+ // Reset the variable.
+ this->bForceSpawn_ = temp;
+ }
+
+ /**
+ @brief
+ Ends the Tetris minigame.
+ */
+ void Tetris::end()
+ {
+ this->cleanup();
+
+ // Call end for the parent class.
+ Deathmatch::end();
+ }
+
+ /**
+ @brief
+ Spawns player.
+ */
+ void Tetris::spawnPlayersIfRequested()
+ {
+ // Spawn a human player.
+ for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+ if (it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))
+ this->spawnPlayer(it->first);
+ }
+
+ /**
+ @brief
+ Spawns the input player.
+ @param player
+ The player to be spawned.
+ */
+ void Tetris::spawnPlayer(PlayerInfo* player)
+ {
+ assert(player);
+
+ if(this->player_ == NULL)
+ {
+ this->player_ = player;
+ this->players_[player].state_ = PlayerState::Alive;
+ }
+ }
+
+ /**
+ @brief
+ Starts the first stone.
+ */
+ void Tetris::startStone(void)
+ {
+ if(this->player_ == NULL)
+ return;
+
+ unsigned int cameraIndex = 0;
+ if(this->activeStone_ != NULL)
+ {
+ // Get camera settings
+ cameraIndex = this->activeStone_->getCurrentCameraIndex();
+ this->player_->stopControl();
+ }
+
+ // Make the last stone to be created the active stone.
+ this->activeStone_ = this->stones_.back();
+
+ this->player_->startControl(this->activeStone_);
+ this->activeStone_->setVelocity(0.0f, -this->center_->getStoneSpeed(), 0.0f);
+ this->activeStone_->setCameraPosition(cameraIndex);
+ }
+
+ /**
+ @brief
+ Creates a new stone.
+ */
+ void Tetris::createStone(void)
+ {
+ // Create a new stone and add it to the list of stones.
+ TetrisStone* stone = new TetrisStone(this->center_);
+ this->stones_.push_back(stone);
+
+ // Apply the stone template to the stone.
+ stone->addTemplate(this->center_->getStoneTemplate());
+
+ // Attach the stone to the Centerpoint and set the position of the stone to be at the top middle.
+ this->center_->attach(stone);
+ float xPos = (this->center_->getWidth()/2 + ((this->center_->getWidth() % 2)*2-1)/2.0f)*this->center_->getStoneSize();
+ float yPos = (this->center_->getHeight()-0.5f)*this->center_->getStoneSize();
+ stone->setPosition(xPos, yPos, 0.0f);
+ stone->setGame(this);
+ }
+
+ /**
+ @brief
+ Get the player.
+ @return
+ Returns a pointer to the player. If there is no player, NULL is returned.
+ */
+ PlayerInfo* Tetris::getPlayer(void) const
+ {
+ return this->player_;
+ }
+
+ /**
+ @brief Set the TetrisCenterpoint (the playing field).
+ @param center A pointer to the TetrisCenterpoint to be set.
+ */
+ void Tetris::setCenterpoint(TetrisCenterpoint* center)
+ {
+ this->center_ = center;
+ }
+
+}
Deleted: code/trunk/src/modules/tetris/Tetris.h
===================================================================
--- code/branches/presentation/src/modules/tetris/Tetris.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/tetris/Tetris.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,93 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * ...
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file Tetris.h
- @brief Declaration of the Tetris class.
- @ingroup Tetris
-*/
-
-#ifndef _Tetris_H__
-#define _Tetris_H__
-
-#include "tetris/TetrisPrereqs.h"
-
-#include "tools/Timer.h"
-
-#include "gametypes/Deathmatch.h"
-
-namespace orxonox
-{
-
- /**
- @brief
-
- @author
-
- @ingroup Tetris
- */
- class _TetrisExport Tetris : public Deathmatch
- {
- public:
- Tetris(BaseObject* creator); //!< Constructor. Registers and initializes the object.
- virtual ~Tetris(); //!< Destructor. Cleans up, if initialized.
-
- virtual void start(void); //!< Starts the Tetris minigame.
- virtual void end(void); ///!< Ends the Tetris minigame.
-
- virtual void tick(float dt);
-
- virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player.
-
- void setCenterpoint(TetrisCenterpoint* center);
-
- PlayerInfo* getPlayer(void) const; //!< Get the player.
-
- bool isValidMove(TetrisStone* stone, const Vector3& position);
-
- protected:
- virtual void spawnPlayersIfRequested(); //!< Spawns player.
-
- private:
- void startStone(void); //!< Starts with the first stone.
- void createStone(void);
- void cleanup(void); //!< Cleans up the Gametype by destroying the ball and the bats.
- bool isValidStonePosition(TetrisStone* stone, const Vector3& position);
-
- PlayerInfo* player_;
-
- WeakPtr<TetrisCenterpoint> center_; //!< The playing field.
- std::vector<TetrisStone*> stones_; //!< A list of all stones in play.
- std::vector< std::vector<bool> > grid_;
- TetrisStone* activeStone_;
-
- Timer starttimer_; //!< A timer to delay the start of the game.
- };
-}
-
-#endif /* _Tetris_H__ */
Copied: code/trunk/src/modules/tetris/Tetris.h (from rev 8705, code/branches/presentation/src/modules/tetris/Tetris.h)
===================================================================
--- code/trunk/src/modules/tetris/Tetris.h (rev 0)
+++ code/trunk/src/modules/tetris/Tetris.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,93 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file Tetris.h
+ @brief Declaration of the Tetris class.
+ @ingroup Tetris
+*/
+
+#ifndef _Tetris_H__
+#define _Tetris_H__
+
+#include "tetris/TetrisPrereqs.h"
+
+#include "tools/Timer.h"
+
+#include "gametypes/Deathmatch.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+
+ @author
+
+ @ingroup Tetris
+ */
+ class _TetrisExport Tetris : public Deathmatch
+ {
+ public:
+ Tetris(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ virtual ~Tetris(); //!< Destructor. Cleans up, if initialized.
+
+ virtual void start(void); //!< Starts the Tetris minigame.
+ virtual void end(void); ///!< Ends the Tetris minigame.
+
+ virtual void tick(float dt);
+
+ virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player.
+
+ void setCenterpoint(TetrisCenterpoint* center);
+
+ PlayerInfo* getPlayer(void) const; //!< Get the player.
+
+ bool isValidMove(TetrisStone* stone, const Vector3& position);
+
+ protected:
+ virtual void spawnPlayersIfRequested(); //!< Spawns player.
+
+ private:
+ void startStone(void); //!< Starts with the first stone.
+ void createStone(void);
+ void cleanup(void); //!< Cleans up the Gametype by destroying the ball and the bats.
+ bool isValidStonePosition(TetrisStone* stone, const Vector3& position);
+
+ PlayerInfo* player_;
+
+ WeakPtr<TetrisCenterpoint> center_; //!< The playing field.
+ std::vector<TetrisStone*> stones_; //!< A list of all stones in play.
+ std::vector< std::vector<bool> > grid_;
+ TetrisStone* activeStone_;
+
+ Timer starttimer_; //!< A timer to delay the start of the game.
+ };
+}
+
+#endif /* _Tetris_H__ */
Deleted: code/trunk/src/modules/tetris/TetrisCenterpoint.cc
===================================================================
--- code/branches/presentation/src/modules/tetris/TetrisCenterpoint.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/tetris/TetrisCenterpoint.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,101 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * ...
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file TetrisCenterpoint.cc
- @brief Implementation of the TetrisCenterpoint class.
-*/
-
-#include "TetrisCenterpoint.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "Tetris.h"
-
-namespace orxonox
-{
- CreateFactory(TetrisCenterpoint);
-
- /**
- @brief
- Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
- */
- TetrisCenterpoint::TetrisCenterpoint(BaseObject* creator) : StaticEntity(creator)
- {
- RegisterObject(TetrisCenterpoint);
-
- this->width_ = 10;
- this->height_ = 11;
- this->stoneSize_ = 10.0f;
- this->stoneTemplate_ = "";
- this->stoneSpeed_ = 20.0f;
-
- this->checkGametype();
- }
-
- /**
- @brief
- Method to create a TetrisCenterpoint through XML.
- */
- void TetrisCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(TetrisCenterpoint, XMLPort, xmlelement, mode);
-
- XMLPortParam(TetrisCenterpoint, "width", setWidth, getWidth, xmlelement, mode); // die Breite
- XMLPortParam(TetrisCenterpoint, "height", setHeight, setWidth, xmlelement, mode); // die Grösse
- XMLPortParam(TetrisCenterpoint, "stoneSize", setStoneSize, getStoneSize, xmlelement, mode);
- XMLPortParam(TetrisCenterpoint, "stoneTemplate", setStoneTemplate, getStoneTemplate, xmlelement, mode);
- XMLPortParam(TetrisCenterpoint, "stoneSpeed", setStoneSpeed, getStoneSpeed, xmlelement, mode);
- }
-
- /**
- @brief
- Is called when the gametype has changed.
- */
- void TetrisCenterpoint::changedGametype()
- {
- SUPER(TetrisCenterpoint, changedGametype);
-
- // Check, whether it's still Tetris.
- this->checkGametype();
- }
-
- /**
- @brief
- Checks whether the gametype is Tetris and if it is, sets its centerpoint.
- */
- void TetrisCenterpoint::checkGametype()
- {
- if (this->getGametype() != NULL && this->getGametype()->isA(Class(Tetris)))
- {
- Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype().get());
- tetrisGametype->setCenterpoint(this);
- }
- }
-}
Copied: code/trunk/src/modules/tetris/TetrisCenterpoint.cc (from rev 8705, code/branches/presentation/src/modules/tetris/TetrisCenterpoint.cc)
===================================================================
--- code/trunk/src/modules/tetris/TetrisCenterpoint.cc (rev 0)
+++ code/trunk/src/modules/tetris/TetrisCenterpoint.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,101 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TetrisCenterpoint.cc
+ @brief Implementation of the TetrisCenterpoint class.
+*/
+
+#include "TetrisCenterpoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "Tetris.h"
+
+namespace orxonox
+{
+ CreateFactory(TetrisCenterpoint);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
+ */
+ TetrisCenterpoint::TetrisCenterpoint(BaseObject* creator) : StaticEntity(creator)
+ {
+ RegisterObject(TetrisCenterpoint);
+
+ this->width_ = 10;
+ this->height_ = 11;
+ this->stoneSize_ = 10.0f;
+ this->stoneTemplate_ = "";
+ this->stoneSpeed_ = 20.0f;
+
+ this->checkGametype();
+ }
+
+ /**
+ @brief
+ Method to create a TetrisCenterpoint through XML.
+ */
+ void TetrisCenterpoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+ {
+ SUPER(TetrisCenterpoint, XMLPort, xmlelement, mode);
+
+ XMLPortParam(TetrisCenterpoint, "width", setWidth, getWidth, xmlelement, mode); // die Breite
+ XMLPortParam(TetrisCenterpoint, "height", setHeight, setWidth, xmlelement, mode); // die Grösse
+ XMLPortParam(TetrisCenterpoint, "stoneSize", setStoneSize, getStoneSize, xmlelement, mode);
+ XMLPortParam(TetrisCenterpoint, "stoneTemplate", setStoneTemplate, getStoneTemplate, xmlelement, mode);
+ XMLPortParam(TetrisCenterpoint, "stoneSpeed", setStoneSpeed, getStoneSpeed, xmlelement, mode);
+ }
+
+ /**
+ @brief
+ Is called when the gametype has changed.
+ */
+ void TetrisCenterpoint::changedGametype()
+ {
+ SUPER(TetrisCenterpoint, changedGametype);
+
+ // Check, whether it's still Tetris.
+ this->checkGametype();
+ }
+
+ /**
+ @brief
+ Checks whether the gametype is Tetris and if it is, sets its centerpoint.
+ */
+ void TetrisCenterpoint::checkGametype()
+ {
+ if (this->getGametype() != NULL && this->getGametype()->isA(Class(Tetris)))
+ {
+ Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype().get());
+ tetrisGametype->setCenterpoint(this);
+ }
+ }
+}
Deleted: code/trunk/src/modules/tetris/TetrisCenterpoint.h
===================================================================
--- code/branches/presentation/src/modules/tetris/TetrisCenterpoint.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/tetris/TetrisCenterpoint.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,144 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * ...
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file TetrisCenterpoint.h
- @brief Declaration of the TetrisCenterpoint class.
- @ingroup Tetris
-*/
-
-#ifndef _TetrisCenterpoint_H__
-#define _TetrisCenterpoint_H__
-
-#include "tetris/TetrisPrereqs.h"
-
-#include <string>
-
-#include <util/Math.h>
-
-#include "worldentities/StaticEntity.h"
-
-namespace orxonox
-{
-
- /**
- @brief
-
-
- @author
-
- @ingroup Tetris
- */
- class _TetrisExport TetrisCenterpoint : public StaticEntity
- {
- public:
- TetrisCenterpoint(BaseObject* creator); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
- virtual ~TetrisCenterpoint() {}
-
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a TetrisCenterpoint through XML.
-
- virtual void changedGametype(); //!< Is called when the gametype has changed.
-
- /**
- @brief Set the width of the playing field.
- @param width The width in number of tiles.
- */
- void setWidth(unsigned int width)
- { this->width_ = width; }
- /**
- @brief Get the width of the playing field.
- @return Returns the width in number of tiles.
- */
- unsigned int getWidth(void) const
- { return this->width_; }
-
- /**
- @brief Set the height of the playing field.
- @param height The height in number of tiles.
- */
- void setHeight(unsigned int height)
- { this->height_ = height; }
- /**
- @brief Get the height of the playing field.
- @return Returns the height in number of tiles.
- */
- unsigned int getHeight(void) const
- { return this->height_; }
-
- /**
- @brief Set the size of a single stone.
- @param size The dimensions a stone has in the game world. (A stone is a cube)
- */
- void setStoneSize(float size)
- { this->stoneSize_ = size; }
- /**
- @brief Get the size of a single stone.
- @return Returns the dimensions a stone has in the game world.
- */
- float getStoneSize(void) const
- { return this->stoneSize_; }
-
- /**
- @brief Set the template for the stones.
- @param template The template name to be applied to each stone.
- */
- void setStoneTemplate(const std::string& templateName)
- { this->stoneTemplate_ = templateName; }
- /**
- @brief Get the template for the stones.
- @return Returns the template name to be applied to each stone.
- */
- const std::string& getStoneTemplate(void) const
- { return this->stoneTemplate_; }
-
- /**
- @brief Set the speed of the stones.
- @param speed The speed to be set.
- */
- void setStoneSpeed(float speed)
- { this->stoneSpeed_ = speed; }
- /**
- @brief Get the speed of the stones.
- @return Returns the speed a moving stone has.
- */
- float getStoneSpeed(void)
- { return this->stoneSpeed_; }
-
- private:
- void checkGametype(); //!< Checks whether the gametype is Tetris and if it is, sets its centerpoint.
-
- unsigned int width_;
- unsigned int height_;
- float stoneSize_;
- std::string stoneTemplate_;
- float stoneSpeed_;
-
- };
-}
-
-#endif /* _TetrisCenterpoint_H__ */
Copied: code/trunk/src/modules/tetris/TetrisCenterpoint.h (from rev 8705, code/branches/presentation/src/modules/tetris/TetrisCenterpoint.h)
===================================================================
--- code/trunk/src/modules/tetris/TetrisCenterpoint.h (rev 0)
+++ code/trunk/src/modules/tetris/TetrisCenterpoint.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,144 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TetrisCenterpoint.h
+ @brief Declaration of the TetrisCenterpoint class.
+ @ingroup Tetris
+*/
+
+#ifndef _TetrisCenterpoint_H__
+#define _TetrisCenterpoint_H__
+
+#include "tetris/TetrisPrereqs.h"
+
+#include <string>
+
+#include <util/Math.h>
+
+#include "worldentities/StaticEntity.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+
+
+ @author
+
+ @ingroup Tetris
+ */
+ class _TetrisExport TetrisCenterpoint : public StaticEntity
+ {
+ public:
+ TetrisCenterpoint(BaseObject* creator); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Tetris.
+ virtual ~TetrisCenterpoint() {}
+
+ virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method to create a TetrisCenterpoint through XML.
+
+ virtual void changedGametype(); //!< Is called when the gametype has changed.
+
+ /**
+ @brief Set the width of the playing field.
+ @param width The width in number of tiles.
+ */
+ void setWidth(unsigned int width)
+ { this->width_ = width; }
+ /**
+ @brief Get the width of the playing field.
+ @return Returns the width in number of tiles.
+ */
+ unsigned int getWidth(void) const
+ { return this->width_; }
+
+ /**
+ @brief Set the height of the playing field.
+ @param height The height in number of tiles.
+ */
+ void setHeight(unsigned int height)
+ { this->height_ = height; }
+ /**
+ @brief Get the height of the playing field.
+ @return Returns the height in number of tiles.
+ */
+ unsigned int getHeight(void) const
+ { return this->height_; }
+
+ /**
+ @brief Set the size of a single stone.
+ @param size The dimensions a stone has in the game world. (A stone is a cube)
+ */
+ void setStoneSize(float size)
+ { this->stoneSize_ = size; }
+ /**
+ @brief Get the size of a single stone.
+ @return Returns the dimensions a stone has in the game world.
+ */
+ float getStoneSize(void) const
+ { return this->stoneSize_; }
+
+ /**
+ @brief Set the template for the stones.
+ @param template The template name to be applied to each stone.
+ */
+ void setStoneTemplate(const std::string& templateName)
+ { this->stoneTemplate_ = templateName; }
+ /**
+ @brief Get the template for the stones.
+ @return Returns the template name to be applied to each stone.
+ */
+ const std::string& getStoneTemplate(void) const
+ { return this->stoneTemplate_; }
+
+ /**
+ @brief Set the speed of the stones.
+ @param speed The speed to be set.
+ */
+ void setStoneSpeed(float speed)
+ { this->stoneSpeed_ = speed; }
+ /**
+ @brief Get the speed of the stones.
+ @return Returns the speed a moving stone has.
+ */
+ float getStoneSpeed(void)
+ { return this->stoneSpeed_; }
+
+ private:
+ void checkGametype(); //!< Checks whether the gametype is Tetris and if it is, sets its centerpoint.
+
+ unsigned int width_;
+ unsigned int height_;
+ float stoneSize_;
+ std::string stoneTemplate_;
+ float stoneSpeed_;
+
+ };
+}
+
+#endif /* _TetrisCenterpoint_H__ */
Deleted: code/trunk/src/modules/tetris/TetrisPrereqs.h
===================================================================
--- code/branches/presentation/src/modules/tetris/TetrisPrereqs.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/tetris/TetrisPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,72 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- at file
- at brief
- Shared library macros, enums, constants and forward declarations for the tetris module
-*/
-
-#ifndef _TetrisPrereqs_H__
-#define _TetrisPrereqs_H__
-
-#include "OrxonoxConfig.h"
-#include "OrxonoxPrereqs.h"
-
-//-----------------------------------------------------------------------
-// Shared library settings
-//-----------------------------------------------------------------------
-
-#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(TETRIS_STATIC_BUILD)
-# ifdef TETRIS_SHARED_BUILD
-# define _TetrisExport __declspec(dllexport)
-# else
-# if defined( __MINGW32__ )
-# define _TetrisExport
-# else
-# define _TetrisExport __declspec(dllimport)
-# endif
-# endif
-#elif defined ( ORXONOX_GCC_VISIBILITY )
-# define _TetrisExport __attribute__ ((visibility("default")))
-#else
-# define _TetrisExport
-#endif
-
-//-----------------------------------------------------------------------
-// Forward declarations
-//-----------------------------------------------------------------------
-
-namespace orxonox
-{
- class Tetris;
- class TetrisCenterpoint;
- class TetrisStone;
-}
-
-#endif /* _TetrisPrereqs_H__ */
Copied: code/trunk/src/modules/tetris/TetrisPrereqs.h (from rev 8705, code/branches/presentation/src/modules/tetris/TetrisPrereqs.h)
===================================================================
--- code/trunk/src/modules/tetris/TetrisPrereqs.h (rev 0)
+++ code/trunk/src/modules/tetris/TetrisPrereqs.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,72 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Reto Grieder
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ at file
+ at brief
+ Shared library macros, enums, constants and forward declarations for the tetris module
+*/
+
+#ifndef _TetrisPrereqs_H__
+#define _TetrisPrereqs_H__
+
+#include "OrxonoxConfig.h"
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Shared library settings
+//-----------------------------------------------------------------------
+
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(TETRIS_STATIC_BUILD)
+# ifdef TETRIS_SHARED_BUILD
+# define _TetrisExport __declspec(dllexport)
+# else
+# if defined( __MINGW32__ )
+# define _TetrisExport
+# else
+# define _TetrisExport __declspec(dllimport)
+# endif
+# endif
+#elif defined ( ORXONOX_GCC_VISIBILITY )
+# define _TetrisExport __attribute__ ((visibility("default")))
+#else
+# define _TetrisExport
+#endif
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+ class Tetris;
+ class TetrisCenterpoint;
+ class TetrisStone;
+}
+
+#endif /* _TetrisPrereqs_H__ */
Deleted: code/trunk/src/modules/tetris/TetrisStone.cc
===================================================================
--- code/branches/presentation/src/modules/tetris/TetrisStone.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/tetris/TetrisStone.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,101 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * ...
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file TetrisStone.cc
- @brief Implementation of the TetrisStone class.
-*/
-
-#include "TetrisStone.h"
-
-#include "core/CoreIncludes.h"
-#include "core/XMLPort.h"
-
-#include "Tetris.h"
-
-namespace orxonox
-{
- CreateFactory(TetrisStone);
-
- /**
- @brief
- Constructor. Registers and initializes the object.
- */
- TetrisStone::TetrisStone(BaseObject* creator) : ControllableEntity(creator)
- {
- RegisterObject(TetrisStone);
-
- this->size_ = 10.0f;
- this->delay_ = false;
- this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
- }
-
- /**
- @brief
- Overloaded the function to rotate the stone.
- @param value
- A vector whose first component is the angle by which to rotate.
- */
- void TetrisStone::moveFrontBack(const Vector2& value)
- {
- if(value.x < 0)
- {
- this->setVelocity(this->getVelocity()*1.1);
- }
- }
-
- /**
- @brief
- Overloaded the function to steer the stone right and left
- @param value
- A vector whose first component is the direction in which we want to steer the stone.
- */
- void TetrisStone::moveRightLeft(const Vector2& value)
- {
- if(!this->delay_)
- {
- const Vector3& position = this->getPosition();
- Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
- if(!this->tetris_->isValidMove(this, newPos))
- return;
-
- this->setPosition(newPos);
- this->delay_ = true;
- this->delayTimer_.startTimer();
- }
- }
-
- /**
- @brief
- Is called when the player changed.
- */
- void TetrisStone::changedPlayer()
- {
- this->setVelocity(0, 0, 0);
- }
-}
Copied: code/trunk/src/modules/tetris/TetrisStone.cc (from rev 8705, code/branches/presentation/src/modules/tetris/TetrisStone.cc)
===================================================================
--- code/trunk/src/modules/tetris/TetrisStone.cc (rev 0)
+++ code/trunk/src/modules/tetris/TetrisStone.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,101 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TetrisStone.cc
+ @brief Implementation of the TetrisStone class.
+*/
+
+#include "TetrisStone.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+#include "Tetris.h"
+
+namespace orxonox
+{
+ CreateFactory(TetrisStone);
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
+ TetrisStone::TetrisStone(BaseObject* creator) : ControllableEntity(creator)
+ {
+ RegisterObject(TetrisStone);
+
+ this->size_ = 10.0f;
+ this->delay_ = false;
+ this->delayTimer_.setTimer(0.2f, false, createExecutor(createFunctor(&TetrisStone::enableMovement, this)));
+ }
+
+ /**
+ @brief
+ Overloaded the function to rotate the stone.
+ @param value
+ A vector whose first component is the angle by which to rotate.
+ */
+ void TetrisStone::moveFrontBack(const Vector2& value)
+ {
+ if(value.x < 0)
+ {
+ this->setVelocity(this->getVelocity()*1.1);
+ }
+ }
+
+ /**
+ @brief
+ Overloaded the function to steer the stone right and left
+ @param value
+ A vector whose first component is the direction in which we want to steer the stone.
+ */
+ void TetrisStone::moveRightLeft(const Vector2& value)
+ {
+ if(!this->delay_)
+ {
+ const Vector3& position = this->getPosition();
+ Vector3 newPos = Vector3(position.x+value.x/abs(value.x)*this->size_, position.y, position.z);
+ if(!this->tetris_->isValidMove(this, newPos))
+ return;
+
+ this->setPosition(newPos);
+ this->delay_ = true;
+ this->delayTimer_.startTimer();
+ }
+ }
+
+ /**
+ @brief
+ Is called when the player changed.
+ */
+ void TetrisStone::changedPlayer()
+ {
+ this->setVelocity(0, 0, 0);
+ }
+}
Deleted: code/trunk/src/modules/tetris/TetrisStone.h
===================================================================
--- code/branches/presentation/src/modules/tetris/TetrisStone.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/tetris/TetrisStone.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,92 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * ...
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file TetrisStone.h
- @brief Declaration of the TetrisStone class.
- @ingroup Tetris
-*/
-
-#ifndef _TetrisStone_H__
-#define _TetrisStone_H__
-
-#include "tetris/TetrisPrereqs.h"
-
-#include "worldentities/ControllableEntity.h"
-#include "tools/Timer.h"
-
-namespace orxonox
-{
-
- /**
- @brief
-
- @author
-
- @ingroup Tetris
- */
- class _TetrisExport TetrisStone : public ControllableEntity
- {
- public:
- TetrisStone(BaseObject* creator); //!< Constructor. Registers and initializes the object.
- virtual ~TetrisStone() {}
-
- virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
- virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
-
- virtual void changedPlayer(); //!< Is called when the player changed.
-
- /**
- @brief Set the size of the stone.
- @param size The dimensions a stone has in the game world. (A stone is a cube)
- */
- void setSize(float size)
- { this->size_ = size; }
- /**
- @brief Get the size of the stone.
- @return Returns the dimensions a stone has in the game world. (A stone is a cube)
- */
- float getSize(void) const
- { return this->size_; }
-
- void setGame(Tetris* tetris)
- { assert(tetris); tetris_ = tetris; }
-
- private:
- void enableMovement(void)
- { this->delay_ = false; }
-
- float size_; //!< The dimensions a stone has in the game world.
- bool delay_;
- Timer delayTimer_;
-
- Tetris* tetris_;
- };
-}
-
-#endif /* _TetrisStone_H__ */
Copied: code/trunk/src/modules/tetris/TetrisStone.h (from rev 8705, code/branches/presentation/src/modules/tetris/TetrisStone.h)
===================================================================
--- code/trunk/src/modules/tetris/TetrisStone.h (rev 0)
+++ code/trunk/src/modules/tetris/TetrisStone.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,92 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * ...
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file TetrisStone.h
+ @brief Declaration of the TetrisStone class.
+ @ingroup Tetris
+*/
+
+#ifndef _TetrisStone_H__
+#define _TetrisStone_H__
+
+#include "tetris/TetrisPrereqs.h"
+
+#include "worldentities/ControllableEntity.h"
+#include "tools/Timer.h"
+
+namespace orxonox
+{
+
+ /**
+ @brief
+
+ @author
+
+ @ingroup Tetris
+ */
+ class _TetrisExport TetrisStone : public ControllableEntity
+ {
+ public:
+ TetrisStone(BaseObject* creator); //!< Constructor. Registers and initializes the object.
+ virtual ~TetrisStone() {}
+
+ virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
+ virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
+
+ virtual void changedPlayer(); //!< Is called when the player changed.
+
+ /**
+ @brief Set the size of the stone.
+ @param size The dimensions a stone has in the game world. (A stone is a cube)
+ */
+ void setSize(float size)
+ { this->size_ = size; }
+ /**
+ @brief Get the size of the stone.
+ @return Returns the dimensions a stone has in the game world. (A stone is a cube)
+ */
+ float getSize(void) const
+ { return this->size_; }
+
+ void setGame(Tetris* tetris)
+ { assert(tetris); tetris_ = tetris; }
+
+ private:
+ void enableMovement(void)
+ { this->delay_ = false; }
+
+ float size_; //!< The dimensions a stone has in the game world.
+ bool delay_;
+ Timer delayTimer_;
+
+ Tetris* tetris_;
+ };
+}
+
+#endif /* _TetrisStone_H__ */
Copied: code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc (from rev 8705, code/branches/presentation/src/modules/weapons/projectiles/BasicProjectile.cc)
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc (rev 0)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,130 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * simonmie
+ * Co-authors:
+ * ...
+ *
+ */
+
+#include "BasicProjectile.h"
+
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/GameMode.h"
+#include "core/command/Executor.h"
+#include "objects/collisionshapes/SphereCollisionShape.h"
+#include "worldentities/pawns/Pawn.h"
+#include "graphics/ParticleSpawner.h"
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+ /**
+ @brief
+ Constructor. Registers the object and initializes some default values.
+ */
+ BasicProjectile::BasicProjectile() : OrxonoxClass()
+ {
+ RegisterRootObject(BasicProjectile);// - register the BasicProjectile class to the core
+
+ this->bDestroy_ = false;
+
+ // Default damage must be zero, otherwise it would be above zero if no settings are made in the weaponsettings xml file.
+ // same thing for all weaponmodes files
+ this->damage_ = 0;
+ this->healthdamage_ = 0;
+ this->shielddamage_ = 0;
+ }
+
+ BasicProjectile::~BasicProjectile()
+ {
+ }
+
+ /* The function called when a projectile hits another thing.
+ * calls the hit-function, starts the reload countdown, displays visual effects
+ * hit is defined in src/orxonox/worldentities/pawns/pawn.cc
+ */
+ bool BasicProjectile::basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_)
+ {
+ if (!this_->getBDestroy() && GameMode::isMaster())
+ {
+ if (otherObject == owner) //prevents you from shooting yourself
+ return false;
+
+ this_->setBDestroy(true); // If something is hit, the object is destroyed and can't hit something else.
+ // The projectile is destroyed by its tick()-function (in the following tick).
+
+ Pawn* victim = orxonox_cast<Pawn*>(otherObject); //if otherObject isn't a Pawn, then victim is NULL
+
+ WorldEntity* entity = orxonox_cast<WorldEntity*>(this_);
+ assert(entity); //entity must not be null
+
+
+ // if visual effects after destruction cause problems, put this block below the effects code block
+ if (victim)
+ {
+ victim->hit(owner, contactPoint, this_->getDamage(), this_->getHealthDamage(), this_->getShieldDamage());
+ victim->startReloadCountdown();
+ }
+
+ // visual effects for being hit, depending on whether the shield is hit or not
+ if (owner) //if the owner does not exist (anymore?), no effects are displayed.
+ {
+ // damping and explosion effect is only played if the victim is no pawn (see cast above)
+ // or if the victim is a pawn, has no shield left, is still alive and any damage goes to the health
+ if (!victim || (victim && !victim->hasShield() && victim->getHealth() > 0 && (this_->getDamage() > 0 || this_->getHealthDamage() > 0)))
+ {
+ {
+ ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
+ effect->setPosition(entity->getPosition());
+ effect->setOrientation(entity->getOrientation());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/explosion3");
+ effect->setLifetime(2.0f);
+ }
+ // second effect with same condition
+ {
+ ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
+ effect->setPosition(entity->getPosition());
+ effect->setOrientation(entity->getOrientation());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/smoke4");
+ effect->setLifetime(3.0f);
+ }
+ }
+
+ // victim->isAlive() is not false until the next tick, so getHealth() > 0 is used instead
+ if (victim && victim->hasShield() && (this_->getDamage() > 0 || this_->getShieldDamage() > 0) && victim->getHealth() > 0)
+ {
+ ParticleSpawner* effect = new ParticleSpawner(owner->getCreator());
+ effect->setDestroyAfterLife(true);
+ effect->setSource("Orxonox/Shield");
+ effect->setLifetime(0.5f);
+ victim->attach(effect);
+ }
+ }
+
+ }
+ return false;
+ }
+}
Copied: code/trunk/src/modules/weapons/projectiles/BasicProjectile.h (from rev 8705, code/branches/presentation/src/modules/weapons/projectiles/BasicProjectile.h)
===================================================================
--- code/trunk/src/modules/weapons/projectiles/BasicProjectile.h (rev 0)
+++ code/trunk/src/modules/weapons/projectiles/BasicProjectile.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,83 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * simonmie
+ * Co-authors:
+ * ...
+ *
+ */
+
+#ifndef _BasicProjectile_H__
+#define _BasicProjectile_H__
+
+#include "weapons/WeaponsPrereqs.h"
+
+#include "tools/Timer.h"
+#include "core/OrxonoxClass.h"
+
+namespace orxonox
+{
+ class _WeaponsExport BasicProjectile : public virtual OrxonoxClass
+ {
+ public:
+ BasicProjectile();
+
+ virtual ~BasicProjectile();
+
+ static bool basicCollidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint, Pawn* owner, BasicProjectile* this_);
+
+ void basicDestroyObject();
+
+ inline void setDamage(float damage)
+ { this->damage_ = damage; }
+ inline float getDamage() const
+ { return this->damage_; }
+
+ inline void setHealthDamage(float healthdamage)
+ { this->healthdamage_ = healthdamage; }
+ inline float getHealthDamage() const
+ { return this->healthdamage_; }
+
+ inline void setShieldDamage(float shielddamage)
+ { this->shielddamage_ = shielddamage; } //ShieldDamage wird korrekt gesettet vom XML-File
+ inline float getShieldDamage() const
+ { return this->shielddamage_; }
+
+
+ inline void setBDestroy(bool bDestroy)
+ { this->bDestroy_ = bDestroy; }
+ inline float getBDestroy() const
+ { return this->bDestroy_; }
+
+
+ private:
+// WeakPtr<Pawn> owner_; //owner cannot be set in BasicProjectile, because it's already defined in MobileEntity and Movable Entity
+
+ float damage_;
+ float healthdamage_;
+ float shielddamage_;
+
+ bool bDestroy_;
+ };
+}
+
+#endif /* _BasicProjectile_H__ */
Modified: code/trunk/src/modules/weapons/projectiles/CMakeLists.txt
===================================================================
--- code/trunk/src/modules/weapons/projectiles/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/projectiles/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -5,4 +5,5 @@
LightningGunProjectile.cc
Rocket.cc
SimpleRocket.cc
+ BasicProjectile.cc
)
Modified: code/trunk/src/modules/weapons/projectiles/Projectile.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Projectile.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/projectiles/Projectile.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -40,17 +40,14 @@
{
CreateFactory(Projectile);
- Projectile::Projectile(BaseObject* creator) : MovableEntity(creator)
+ Projectile::Projectile(BaseObject* creator) : MovableEntity(creator), BasicProjectile()
{
RegisterObject(Projectile);
this->setConfigValues();
- this->bDestroy_ = false;
this->owner_ = 0;
- this->damage_ = 15;
// Get notification about collisions
-
if (GameMode::isMaster())
{
this->setMass(1.0);
@@ -83,7 +80,7 @@
if (!this->isActive())
return;
- if (this->bDestroy_)
+ if (this->getBDestroy())
this->destroy(); // TODO: use a scheduler instead of deleting the object right here in tick()
}
@@ -93,40 +90,11 @@
this->destroy();
}
+ /* Calls the collidesAgainst function of BasicProjectile
+ */
bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
- if (!this->bDestroy_ && GameMode::isMaster())
- {
- if (otherObject == this->owner_)
- return false;
-
- this->bDestroy_ = true;
-
- if (this->owner_)
- {
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/explosion3");
- effect->setLifetime(2.0f);
- }
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/smoke4");
- effect->setLifetime(3.0f);
- }
- }
-
- Pawn* victim = orxonox_cast<Pawn*>(otherObject);
- if (victim)
- victim->hit(this->owner_, contactPoint, this->damage_);
- }
- return false;
+ return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
}
void Projectile::setOwner(Pawn* owner)
Modified: code/trunk/src/modules/weapons/projectiles/Projectile.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Projectile.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/projectiles/Projectile.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -34,9 +34,11 @@
#include "tools/Timer.h"
#include "worldentities/MovableEntity.h"
+#include "BasicProjectile.h"
+
namespace orxonox
{
- class _WeaponsExport Projectile : public MovableEntity
+ class _WeaponsExport Projectile : public MovableEntity, public BasicProjectile
{
public:
Projectile(BaseObject* creator);
@@ -48,20 +50,14 @@
virtual void tick(float dt);
virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);
- inline void setDamage(float damage)
- { this->damage_ = damage; }
- inline float getDamage() const
- { return this->damage_; }
-
void setOwner(Pawn* owner);
inline Pawn* getOwner() const
{ return this->owner_; }
+
private:
WeakPtr<Pawn> owner_;
float lifetime_;
- float damage_;
- bool bDestroy_;
Timer destroyTimer_;
};
}
Modified: code/trunk/src/modules/weapons/projectiles/Rocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -51,12 +51,11 @@
@brief
Constructor. Registers the object and initializes some default values.
*/
- Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator)
+ Rocket::Rocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
{
RegisterObject(Rocket);// - register the Rocket class to the core
this->localAngularVelocity_ = 0;
- this->bDestroy_ = false;
this->lifetime_ = 100;
if (GameMode::isMaster())
@@ -145,8 +144,8 @@
void Rocket::setOwner(Pawn* owner)
{
this->owner_ = owner;
- this->player_ = this->owner_->getPlayer();
- this->owner_->getPlayer()->startTemporaryControl(this);
+ this->player_ = this->getOwner()->getPlayer();
+ this->getOwner()->getPlayer()->startTemporaryControl(this);
if( GameMode::isMaster() )
{
@@ -174,48 +173,17 @@
if( GameMode::isMaster() )
{
- if( this->bDestroy_ )
+ if( this->getBDestroy() )
this->destroy();
}
}
+ /* Calls the collidesAgainst function of BasicProjectile
+ */
bool Rocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
- if (!this->bDestroy_ && GameMode::isMaster())
- {
- if (otherObject == this->owner_)
- return false;
-
- this->bDestroy_ = true;
-
- if (this->owner_)
- {
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/explosion4");
- effect->setLifetime(2.0f);
- }
-
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/smoke4");
- effect->setLifetime(3.0f);
- }
- }
-
- Pawn* victim = orxonox_cast<Pawn*>(otherObject);
- if (victim)
- victim->hit(this->owner_, contactPoint, this->damage_);
-// this->destroy();
- }
- return false;
+ return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
}
void Rocket::destroyObject()
@@ -232,19 +200,16 @@
void Rocket::fired(unsigned int firemode)
{
-// if (this->owner_)
-// {
- this->destroy();
-// }
+ this->destroy();
}
void Rocket::destructionEffect()
{
ParticleSpawner *effect1, *effect2;
- if( this->owner_ )
+ if( this->getOwner() )
{
- effect1 = new ParticleSpawner(this->owner_->getCreator());
- effect2 = new ParticleSpawner(this->owner_->getCreator());
+ effect1 = new ParticleSpawner(this->getOwner()->getCreator());
+ effect2 = new ParticleSpawner(this->getOwner()->getCreator());
}
else
{
Modified: code/trunk/src/modules/weapons/projectiles/Rocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/Rocket.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/projectiles/Rocket.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -34,6 +34,8 @@
#include "tools/Timer.h"
#include "worldentities/ControllableEntity.h"
+#include "BasicProjectile.h"
+
namespace orxonox
{
class ConeCollisionShape;
@@ -45,7 +47,7 @@
@author
Oli Scheuss
*/
- class _WeaponsExport Rocket : public ControllableEntity
+ class _WeaponsExport Rocket : public ControllableEntity, public BasicProjectile
{
public:
Rocket(BaseObject* creator);
@@ -108,17 +110,11 @@
inline Pawn* getOwner() const
{ return this->owner_; }
- inline void setDamage(float damage)
- { this->damage_ = damage; }
- inline float getDamage() const
- { return this->damage_; }
virtual void fired(unsigned int firemode);
private:
WeakPtr<Pawn> owner_;
Vector3 localAngularVelocity_;
- float damage_;
- bool bDestroy_;
WeakPtr<PlayerInfo> player_;
Timer destroyTimer_;
Modified: code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -47,16 +47,15 @@
CreateFactory(SimpleRocket);
- SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator)
+ SimpleRocket::SimpleRocket(BaseObject* creator) : ControllableEntity(creator), BasicProjectile()
{
RegisterObject(SimpleRocket);// - register the SimpleRocket class to the core
this->localAngularVelocity_ = 0;
- this->bDestroy_ = false;
this->lifetime_ = 120;
this->setMass(15);
- COUT(4) << "simplerocket constructed\n";
+// COUT(4) << "simplerocket constructed\n";
if (GameMode::isMaster())
{
@@ -114,7 +113,7 @@
} else
this->disableFire();
- if( this->bDestroy_ )
+ if( this->getBDestroy() )
this->destroy();
}
@@ -158,51 +157,15 @@
void SimpleRocket::setOwner(Pawn* owner)
{
this->owner_ = owner;
- this->player_ = this->owner_->getPlayer();
+ this->player_ = this->getOwner()->getPlayer();
}
-
-
+ /* Calls the collidesAgainst function of BasicProjectile
+ */
bool SimpleRocket::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)
{
- if (!this->bDestroy_ && GameMode::isMaster())
- {
- if (otherObject == this->owner_)
- return false;
-
- this->bDestroy_ = true;
-
- if (this->owner_)
- {
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/explosion4");
- effect->setLifetime(2.0f);
- }
-
- {
- ParticleSpawner* effect = new ParticleSpawner(this->owner_->getCreator());
- effect->setPosition(this->getPosition());
- effect->setOrientation(this->getOrientation());
- effect->setDestroyAfterLife(true);
- effect->setSource("Orxonox/smoke4");
- effect->setLifetime(3.0f);
- }
- }
-
- float dmg = this->damage_;
-// if (this->owner_)
-// dmg = this->owner_->getPickups().processModifiers(ModifierType::Damage, dmg, false);
-
- Pawn* victim = orxonox_cast<Pawn*>(otherObject);
- if (victim)
- victim->hit(this->owner_, contactPoint, dmg);
- }
- return false;
+ return BasicProjectile::basicCollidesAgainst(otherObject,contactPoint,this->getOwner(),this);
}
void SimpleRocket::destroyObject()
Modified: code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
===================================================================
--- code/trunk/src/modules/weapons/projectiles/SimpleRocket.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/projectiles/SimpleRocket.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -35,6 +35,8 @@
#include "worldentities/ControllableEntity.h"
#include "graphics/ParticleSpawner.h"
+#include "BasicProjectile.h"
+
namespace orxonox
{
class ConeCollisionShape;
@@ -45,7 +47,7 @@
@author
Gabriel Nadler (Original file: Oli Scheuss)
*/
- class _WeaponsExport SimpleRocket : public ControllableEntity
+ class _WeaponsExport SimpleRocket : public ControllableEntity, public BasicProjectile
{
public:
SimpleRocket(BaseObject* creator);
@@ -110,20 +112,14 @@
void setOwner(Pawn* owner);
inline Pawn* getOwner() const
{ return this->owner_; }
+
inline bool hasFuel() const
{ return this->fuel_; }
- inline void setDamage(float damage)
- { this->damage_ = damage; }
- inline float getDamage() const
- { return this->damage_; }
-
private:
WeakPtr<Pawn> owner_;
Vector3 localAngularVelocity_;
- float damage_;
- bool bDestroy_;
bool fuel_; //!< Bool is true while the rocket "has fuel"
Modified: code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Hagen Seifert
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -49,7 +49,7 @@
RegisterObject(EnergyDrink);
this->reloadTime_ = 0.25;
- this->damage_ = 15;
+ this->damage_ = 0; //default 15
this->speed_ = 2500;
this->delay_ = 0;
this->setMunitionName("FusionMunition");
@@ -96,6 +96,8 @@
muzzleFlash->setMaterial(this->material_);
}
+ /* Creates the projectile object, sets its properties to the EnergyDrink properties, calls muendungsfeuer()
+ */
void EnergyDrink::shot()
{
Projectile* projectile = new Projectile(this);
@@ -111,6 +113,8 @@
projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
+ projectile->setShieldDamage(this->getShieldDamage());
+ projectile->setHealthDamage(this->getHealthDamage());
EnergyDrink::muendungsfeuer();
}
Modified: code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/weaponmodes/FusionFire.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Martin Polak
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -47,12 +47,14 @@
this->reloadTime_ = 1.0;
this->bParallelReload_ = false;
- this->damage_ = 40;
+ this->damage_ = 0; //default 40
this->speed_ = 1250;
this->setMunitionName("FusionMunition");
}
+ /* Creates the projectile (BillboardProjectile) object, sets its properties to the FusionFire properties
+ */
void FusionFire::fire()
{
BillboardProjectile* projectile = new BillboardProjectile(this);
@@ -64,6 +66,9 @@
projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
+ projectile->setShieldDamage(this->getShieldDamage());
+ projectile->setHealthDamage(this->getHealthDamage());
+
projectile->setColour(ColourValue(1.0f, 0.7f, 0.3f, 1.0f));
}
}
Modified: code/trunk/src/modules/weapons/weaponmodes/HsW01.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/HsW01.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/weaponmodes/HsW01.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Hagen Seifert
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -50,7 +50,7 @@
RegisterObject(HsW01);
this->reloadTime_ = 0.25;
- this->damage_ = 15;
+ this->damage_ = 0; //default 15
this->speed_ = 2500;
this->delay_ = 0;
this->setMunitionName("LaserMunition");
@@ -108,6 +108,8 @@
muzzleFlash->setMaterial(this->material_);
}
+ /* Creates the projectile object, sets its properties to the HsW01 properties, calls muendungsfeuer()
+ */
void HsW01::shot()
{
assert( this->getWeapon() && this->getWeapon()->getWeaponPack() && this->getWeapon()->getWeaponPack()->getWeaponSystem() && this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn() );
@@ -125,6 +127,8 @@
projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
+ projectile->setShieldDamage(this->getShieldDamage());
+ projectile->setHealthDamage(this->getHealthDamage());
HsW01::muendungsfeuer();
}
Modified: code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/weaponmodes/LaserFire.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Martin Polak
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -44,12 +44,14 @@
RegisterObject(LaserFire);
this->reloadTime_ = 0.25;
- this->damage_ = 15;
+ this->damage_ = 0; //default 15
this->speed_ = 1250;
this->setMunitionName("LaserMunition");
}
+ /* Creates the projectile object, sets its properties to the LaserFire properties
+ */
void LaserFire::fire()
{
ParticleProjectile* projectile = new ParticleProjectile(this);
@@ -60,5 +62,7 @@
projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
+ projectile->setShieldDamage(this->getShieldDamage());
+ projectile->setHealthDamage(this->getHealthDamage());
}
}
Modified: code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/weaponmodes/LightningGun.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Joel Smely
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -44,7 +44,7 @@
RegisterObject(LightningGun);
this->reloadTime_ = 1;
- this->damage_ = 100;
+ this->damage_ = 0; //default 100
this->speed_ = 150;
this->setMunitionName("LaserMunition");
@@ -55,6 +55,8 @@
{
}
+ /* Creates the projectile (LightningGunProjectile) object, sets its properties to the LightningGun properties
+ */
void LightningGun::fire()
{
LightningGunProjectile* projectile = new LightningGunProjectile(this);
@@ -68,5 +70,7 @@
projectile->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
projectile->setDamage(this->getDamage());
+ projectile->setShieldDamage(this->getShieldDamage());
+ projectile->setHealthDamage(this->getHealthDamage());
}
}
Modified: code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/weaponmodes/RocketFire.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -47,7 +47,7 @@
this->reloadTime_ = 0.20f;
this->bParallelReload_ = false;
- this->damage_ = 100;
+ this->damage_ = 0;
this->speed_ = 500;
this->setMunitionName("RocketMunition");
@@ -58,6 +58,8 @@
{
}
+ /* Creates the Rocket object, sets its properties to the RocketFire properties
+ */
void RocketFire::fire()
{
Rocket* rocket = new Rocket(this);
@@ -70,5 +72,7 @@
rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
rocket->setDamage(this->getDamage());
+ rocket->setShieldDamage(this->getShieldDamage());
+ rocket->setHealthDamage(this->getHealthDamage());
}
}
Modified: code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc
===================================================================
--- code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Oliver Scheuss
* Co-authors:
- * ...
+ * simonmie
*
*/
@@ -49,7 +49,7 @@
this->reloadTime_ = 1;
this->bParallelReload_ = false;
- this->damage_ = 100;
+ this->damage_ = 0;
this->speed_ = 500;
this->setMunitionName("RocketMunition");
@@ -61,6 +61,8 @@
{
}
+ /* Creates the Rocket (RocketController) object, sets its properties to the SimpleRocketFire properties, sets target
+ */
void SimpleRocketFire::fire()
{
RocketController* con = new RocketController(this);
@@ -70,7 +72,11 @@
rocket->setPosition(this->getMuzzlePosition());
rocket->setVelocity(this->getMuzzleDirection()*this->speed_);
rocket->setOwner(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn());
+
rocket->setDamage(this->damage_);
+ rocket->setShieldDamage(this->getShieldDamage());
+ rocket->setHealthDamage(this->getHealthDamage());
+
WorldEntity* pawnn=static_cast<ControllableEntity*>(this->getWeapon()->getWeaponPack()->getWeaponSystem()->getPawn())->getTarget();
if (pawnn) con->setTarget(pawnn);
}
Modified: code/trunk/src/orxonox/LevelManager.cc
===================================================================
--- code/trunk/src/orxonox/LevelManager.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/LevelManager.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -221,6 +221,7 @@
this->nextIndex_ = 0;
this->nextLevel_ = this->availableLevels_.begin();
}
+
while(this->nextIndex_ != index)
{
this->nextIndex_++;
Modified: code/trunk/src/orxonox/MoodManager.cc
===================================================================
--- code/trunk/src/orxonox/MoodManager.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/MoodManager.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -92,8 +92,6 @@
}
- std::string MoodListener::mood_s;
-
MoodListener::MoodListener()
{
RegisterRootObject(MoodListener);
@@ -101,8 +99,7 @@
/*static*/ void MoodListener::changedMood(const std::string& mood)
{
- mood_s = mood;
for (ObjectList<MoodListener>::iterator it = ObjectList<MoodListener>::begin(); it; ++it)
- it->moodChanged(mood_s);
+ it->moodChanged(mood);
}
}
Modified: code/trunk/src/orxonox/MoodManager.h
===================================================================
--- code/trunk/src/orxonox/MoodManager.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/MoodManager.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -49,13 +49,10 @@
MoodListener();
virtual ~MoodListener() {}
- const std::string& getMood() const { return mood_s; }
-
private:
virtual void moodChanged(const std::string& mood) = 0;
static void changedMood(const std::string& mood);
- static std::string mood_s;
};
/*
Modified: code/trunk/src/orxonox/collisionshapes/CollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CollisionShape.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/collisionshapes/CollisionShape.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file CollisionShape.cc
+ @brief Implementation of the CollisionShape class.
+*/
+
#include "CollisionShape.h"
#include <BulletCollision/CollisionShapes/btCollisionShape.h>
@@ -38,6 +43,11 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
CollisionShape::CollisionShape(BaseObject* creator)
: BaseObject(creator)
, Synchronisable(creator)
@@ -50,13 +60,18 @@
this->position_ = Vector3::ZERO;
this->orientation_ = Quaternion::IDENTITY;
this->scale_ = Vector3::UNIT_SCALE;
+ this->uniformScale_ = true;
this->registerVariables();
}
+ /**
+ @brief
+ Destructor. Detaches the CollisionShape from its parent.
+ */
CollisionShape::~CollisionShape()
{
- // Detach from parent
+ // Detach from parent CompoundCollisionShape.
if (this->isInitialized() && this->parent_)
this->parent_->detach(this);
}
@@ -74,81 +89,181 @@
XMLPortParamLoadOnly(CollisionShape, "roll", roll, xmlelement, mode);
}
+ /**
+ @brief
+ Register variables that need synchronizing over the network.
+ */
void CollisionShape::registerVariables()
{
+ // Keep the shape's parent (can be either a CompoundCollisionShape or a WorldEntity) consistent over the network.
registerVariable(this->parentID_, VariableDirection::ToClient, new NetworkCallback<CollisionShape>(this, &CollisionShape::parentChanged));
}
- void CollisionShape::parentChanged()
- {
- Synchronisable* parent = Synchronisable::getSynchronisable(this->parentID_);
- // Parent can either be a WorldEntity or a CompoundCollisionShape. The reason is that the
- // internal collision shape (which is compound) of a WE doesn't get synchronised.
- CompoundCollisionShape* parentCCS = orxonox_cast<CompoundCollisionShape*>(parent);
- if (parentCCS)
- parentCCS->attach(this);
- else
- {
- WorldEntity* parentWE = orxonox_cast<WorldEntity*>(parent);
- if (parentWE)
- parentWE->attachCollisionShape(this);
- }
- }
-
+ /**
+ @brief
+ Notifies the CollisionShape of being attached to a CompoundCollisionShape.
+ @param newParent
+ A pointer to the CompoundCollisionShape the CollisionShape was attached to.
+ @return
+ Returns
+ */
bool CollisionShape::notifyBeingAttached(CompoundCollisionShape* newParent)
{
+ // If the CollisionShape is attached to a CompoundCollisionShapes, detach it.
if (this->parent_)
this->parent_->detach(this);
this->parent_ = newParent;
+ // If the new parent is a WorldEntityCollisionShape, the parentID is set to the objectID of the WorldEntity that is its owner.
+ // TODO: Why?
WorldEntityCollisionShape* parentWECCS = orxonox_cast<WorldEntityCollisionShape*>(newParent);
if (parentWECCS)
this->parentID_ = parentWECCS->getWorldEntityOwner()->getObjectID();
+ // Else it is set to the objectID of the CompoundCollisionShape.
else
this->parentID_ = newParent->getObjectID();
return true;
}
+ /**
+ @brief
+ Notifies the CollisionShape of being detached from a CompoundCollisionShape.
+ */
void CollisionShape::notifyDetached()
{
this->parent_ = 0;
this->parentID_ = OBJECTID_UNKNOWN;
}
+ /**
+ @brief
+ Updates the CompoundCollisionShape the CollisionShape belongs to (if it belongs to one), after the CollisionShape has changed.
+ */
void CollisionShape::updateParent()
{
if (this->parent_)
this->parent_->updateAttachedShape(this);
}
+ /**
+ @brief
+ Is called when the parentID of the CollisionShape has changed.
+ Attaches it to the object with the changed parentID, which can either be a CompoundCollisionShape or a WorldEntity.
+ */
+ void CollisionShape::parentChanged()
+ {
+ // Get the parent object from the network.
+ Synchronisable* parent = Synchronisable::getSynchronisable(this->parentID_);
+
+ // Parent can either be a WorldEntity or a CompoundCollisionShape. The reason is that the
+ // internal collision shape (which is compound) of a WE doesn't get synchronised.
+ CompoundCollisionShape* parentCCS = orxonox_cast<CompoundCollisionShape*>(parent);
+
+ // If the parent is a CompoundCollisionShape, attach the CollisionShape to it.
+ if (parentCCS)
+ parentCCS->attach(this);
+ else
+ {
+ // If the parent is a WorldEntity, attach the CollisionShape to its collision shapes.
+ WorldEntity* parentWE = orxonox_cast<WorldEntity*>(parent);
+ if (parentWE)
+ parentWE->attachCollisionShape(this);
+ }
+ }
+
+ /**
+ @brief
+ Check whether the CollisionShape has been either moved or rotated or both. (i.e. it doesn't have position zero and identity orientation any more)
+ @return
+ Returns true if it has been moved.
+ */
bool CollisionShape::hasTransform() const
{
return (!this->position_.positionEquals(Vector3(0, 0, 0), 0.001f) ||
!this->orientation_.equals(Quaternion(1,0,0,0), Degree(0.1f)));
}
+ /**
+ @brief
+ Set the scale of the CollisionShape.
+ Since the scale is a vector the CollisionShape can be scaled independently in each direction, allowing for linear distortions.
+ If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ Beware, non-uniform scaling (i.e. distortions) might not be supported by all CollisionShapes.
+ @param scale
+ The new scale to be set. Vector3::UNIT_SCALE is the initial scale.
+ */
void CollisionShape::setScale3D(const Vector3& scale)
{
- CCOUT(2) << "Warning: Cannot set the scale of a collision shape: Not yet implemented." << std::endl;
+ if(this->scale_ == scale)
+ return;
+
+ // If the vectors are not in the same direction, then this is no longer a uniform scaling.
+ if(scale_.crossProduct(scale).squaredLength() != 0.0f)
+ {
+ CCOUT(2) << "Warning: Non-uniform scaling is not yet supported." << endl;
+ return;
+ }
+
+ this->scale_ = scale;
+
+ this->changedScale();
+ this->updateParent();
}
+ /**
+ @brief
+ Set the (uniform) scale of the CollisionShape.
+ If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ @param scale
+ The scale to scale the CollisionShape with. 1.0f is the initial scale.
+ */
void CollisionShape::setScale(float scale)
{
- CCOUT(2) << "Warning: Cannot set the scale of a collision shape: Not yet implemented." << std::endl;
+ if(this->scale_.length() == scale)
+ return;
+
+ this->scale_ = Vector3::UNIT_SCALE*scale;
+
+ this->changedScale();
+ this->updateParent();
}
+ /**
+ @brief
+ Is called when the scale of the CollisionShape has changed.
+ */
+ void CollisionShape::changedScale()
+ {
+ // Adjust the position of the CollisionShape.
+ this->position_ *= this->getScale3D();
+ }
+
+ /**
+ @brief
+ Updates the shape.
+ Is called when the internal parameters of the shape have changed such that a new shape needs to be created.
+ */
void CollisionShape::updateShape()
{
btCollisionShape* oldShape = this->collisionShape_;
this->collisionShape_ = this->createNewShape();
+ // If the CollisionShape has been rescaled, scale the shape to fit the current scale.
+ if(this->scale_ != Vector3::UNIT_SCALE)
+ this->changedScale();
// When we recreate the shape, we have to inform the parent about this to update the shape
this->updateParent();
if (oldShape)
delete oldShape;
}
+ /**
+ @brief
+ Calculates the local inertia of the collision shape.
+ @todo
+ Document.
+ */
void CollisionShape::calculateLocalInertia(float mass, btVector3& inertia) const
{
if (this->collisionShape_)
Modified: code/trunk/src/orxonox/collisionshapes/CollisionShape.h
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CollisionShape.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/collisionshapes/CollisionShape.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,6 +26,12 @@
*
*/
+/**
+ @file CollisionShape.h
+ @brief Definition of the CollisionShape class.
+ @ingroup Collisionshapes
+*/
+
#ifndef _CollisionShape_H__
#define _CollisionShape_H__
@@ -37,6 +43,17 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Wrapper for bullet collision shape class btCollisionShape.
+
+ @author
+ Reto Grieder
+
+ @see btCollisionShape
+ @ingroup Collisionshapes
+ */
class _OrxonoxExport CollisionShape : public BaseObject, public Synchronisable
{
public:
@@ -45,52 +62,134 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+ /**
+ @brief Set the position of the CollisionShape.
+ If the position changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ @param position A vector indicating the new position.
+ */
inline void setPosition(const Vector3& position)
- { this->position_ = position; this->updateParent(); }
+ { if(this->position_ == position) return; this->position_ = position; this->updateParent(); }
+ /**
+ @brief Get the position of the CollisionShape.
+ @return Returns the position of the CollisionShape as a vector.
+ */
inline const Vector3& getPosition() const
{ return this->position_; }
+ /**
+ @brief Set the orientation of the CollisionShape.
+ If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ @param orientation A quaternion indicating the new orientation.
+ */
inline void setOrientation(const Quaternion& orientation)
- { this->orientation_ = orientation; this->updateParent(); }
+ { if(this->orientation_ == orientation) return; this->orientation_ = orientation; this->updateParent(); }
+ /**
+ @brief Get the orientation of the CollisionShape.
+ @return Returns the orientation of the CollisionShape as a quaternion.
+ */
inline const Quaternion& getOrientation() const
{ return this->orientation_; }
- void yaw(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Y)); }
- void pitch(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_X)); }
- void roll(const Degree& angle) { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Z)); }
+ /**
+ @brief Rotate the CollisionShape around the y-axis by the specified angle.
+ If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ @param angle The angle by which the CollisionShape is rotated.
+ */
+ void yaw(const Degree& angle)
+ { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Y)); }
+ /**
+ @brief Rotate the CollisionShape around the x-axis by the specified angle.
+ If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ @param angle The angle by which the CollisionShape is rotated.
+ */
+ void pitch(const Degree& angle)
+ { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_X)); }
+ /**
+ @brief Rotate the CollisionShape around the z-axis by the specified angle.
+ If the orientation changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ @param angle The angle by which the CollisionShape is rotated.
+ */
+ void roll(const Degree& angle)
+ { this->setOrientation(this->orientation_ * Quaternion(angle, Vector3::UNIT_Z)); }
- virtual void setScale3D(const Vector3& scale);
- virtual void setScale(float scale);
+ /**
+ @brief Scale the CollisionShape by the input vector.
+ Since the scale is a vector the CollisionShape can be scaled independently in each direction, allowing for linear distortions.
+ If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ Beware, non-uniform scaling (i.e. distortions) might not be supported by all CollisionShapes.
+ @param scale The scaling vector by which the CollisionShape is scaled.
+ */
+ inline void scale3D(const Vector3& scale)
+ { this->setScale3D(this->getScale3D()*scale); }
+ void setScale3D(const Vector3& scale); // Set the scale of the CollisionShape.
+ /**
+ @brief Get the scale of the CollisionShape.
+ @return Returns a vector indicating the scale of the CollisionShape.
+ */
inline const Vector3& getScale3D() const
{ return this->scale_; }
- void updateShape();
+ /**
+ @brief (Uniformly) scale the CollisionShape by the input scale.
+ If the scale changes, this causes the parent CompoundCollisionShape (if there is one) to be updated.
+ @param scale The value by which the CollisionShape is scaled.
+ */
+ inline void scale(float scale)
+ { this->setScale3D(this->getScale3D()*scale); }
+ void setScale(float scale); // Set the (uniform) scale of the CollisionShape.
+ /**
+ @brief Get the (uniform) scale of the CollisionShape.
+ This is only meaningful if the CollisionShape has uniform scaling.
+ @return Returns the (uniform) scale of the CollisionShape. Returns 0.0f if the scaling is non-uniform.
+ */
+ inline float getScale()
+ { if(this->hasUniformScaling()) return this->scale_.x; return 0.0f; }
- void calculateLocalInertia(float mass, btVector3& inertia) const;
+ /**
+ @brief Check whether the CollisionShape is uniformly scaled.
+ @return Returns true if the CollisionShape is uniformly scaled, false if not.
+ */
+ inline bool hasUniformScaling()
+ { return this->uniformScale_; }
+ virtual void changedScale(); // Is called when the scale of the CollisionShape has changed.
+ void updateShape(); // Updates the shape.
+
+ void calculateLocalInertia(float mass, btVector3& inertia) const; // Calculates the local inertia of the collision shape.
+
+ /**
+ @brief Get the bullet collision shape of this CollisionShape.
+ @return Returns a pointer to the bullet collision shape of this CollisionShape.
+ */
inline btCollisionShape* getCollisionShape() const
{ return this->collisionShape_; }
- bool hasTransform() const;
+ bool hasTransform() const; // Check whether the CollisionShape has been either moved or rotated or both.
- bool notifyBeingAttached(CompoundCollisionShape* newParent);
- void notifyDetached();
+ bool notifyBeingAttached(CompoundCollisionShape* newParent); // Notifies the CollisionShape of being attached to a CompoundCollisionShape.
+ void notifyDetached(); // Notifies the CollisionShape of being detached from a CompoundCollisionShape.
protected:
- virtual void updateParent();
- virtual void parentChanged();
+ virtual void updateParent(); // Updates the CompoundCollisionShape the CollisionShape belongs to, after the CollisionShape has changed.
+ virtual void parentChanged(); // Is called when the parentID of the CollisionShape has changed.
+
+ /**
+ @brief Create a new bullet collision shape depending on the internal parameters of the specific CollisionShape.
+ @return Returns a pointer to the new bullet collision shape.
+ */
virtual btCollisionShape* createNewShape() const = 0;
- btCollisionShape* collisionShape_;
- CompoundCollisionShape* parent_;
- unsigned int parentID_;
+ btCollisionShape* collisionShape_; //!< The bullet collision shape of this CollisionShape.
+ CompoundCollisionShape* parent_; //!< The CompoundCollisionShape this CollisionShape belongs to, NULL if it doesn't belong to one.
+ unsigned int parentID_; //!< The objectID of the parent of this CollisionShape, which can either be a CompoundCollisionShape or a WorldEntity.
private:
void registerVariables();
- Vector3 position_;
- Quaternion orientation_;
- Vector3 scale_;
+ Vector3 position_; //!< The position of the CollisionShape.
+ Quaternion orientation_; //!< The orientation of the CollisionShape.
+ Vector3 scale_; //!< The scale of the CollisionShape.
+ bool uniformScale_; //!< Whether the scale is uniform.
};
}
Modified: code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,6 +26,11 @@
*
*/
+/**
+ @file CompoundCollisionShape.cc
+ @brief Implementation of the CompoundCollisionShape class.
+*/
+
#include "CompoundCollisionShape.h"
#include <BulletCollision/CollisionShapes/btCompoundShape.h>
@@ -38,6 +43,10 @@
{
CreateFactory(CompoundCollisionShape);
+ /**
+ @brief
+ Constructor. Registers and initializes the object.
+ */
CompoundCollisionShape::CompoundCollisionShape(BaseObject* creator) : CollisionShape(creator)
{
RegisterObject(CompoundCollisionShape);
@@ -45,6 +54,11 @@
this->compoundShape_ = new btCompoundShape();
}
+ /**
+ @brief
+ Destructor.
+ Deletes all its children.
+ */
CompoundCollisionShape::~CompoundCollisionShape()
{
if (this->isInitialized())
@@ -69,38 +83,56 @@
XMLPortObject(CompoundCollisionShape, CollisionShape, "", attach, detach, xmlelement, mode);
}
+ /**
+ @brief
+ Attach the input CollisionShape to the CompoundCollisionShape.
+ @param shape
+ A pointer to the CollisionShape that is to be attached.
+ */
void CompoundCollisionShape::attach(CollisionShape* shape)
{
+ // If either the input shape is NULL or we try to attach the CollisionShape to itself.
if (!shape || static_cast<CollisionShape*>(this) == shape)
return;
+
if (this->attachedShapes_.find(shape) != this->attachedShapes_.end())
{
CCOUT(2) << "Warning: Attaching a CollisionShape twice is not yet supported." << std::endl;
return;
}
+ // Notify the CollisionShape that it is being attached to the CompoundCollisionShape.
if (!shape->notifyBeingAttached(this))
return;
+ // Attach it.
this->attachedShapes_[shape] = shape->getCollisionShape();
+ // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
if (shape->getCollisionShape())
{
- // Only actually attach if we didn't pick a CompoundCollisionShape with no content
btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition()));
+ // Add the btCollisionShape of the CollisionShape as a child shape to the btCompoundShape of the CompoundCollisionShape.
this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
this->updatePublicShape();
}
}
+ /**
+ @brief
+ Detach the input CollisionShape form the CompoundCollisionShape.
+ @param shape
+ A pointer to the CollisionShape to be detached.
+ */
void CompoundCollisionShape::detach(CollisionShape* shape)
{
+ // If the input CollisionShape is actually attached.
if (this->attachedShapes_.find(shape) != this->attachedShapes_.end())
{
this->attachedShapes_.erase(shape);
if (shape->getCollisionShape())
- this->compoundShape_->removeChildShape(shape->getCollisionShape());
+ this->compoundShape_->removeChildShape(shape->getCollisionShape()); // TODO: Apparently this is broken?
shape->notifyDetached();
this->updatePublicShape();
@@ -109,17 +141,30 @@
CCOUT(2) << "Warning: Cannot detach non child collision shape" << std::endl;
}
+ /**
+ @brief
+ Detach all attached CollisionShapes.
+ */
void CompoundCollisionShape::detachAll()
{
while (this->attachedShapes_.size() > 0)
this->detach(this->attachedShapes_.begin()->first);
}
+ /**
+ @brief
+ Update the input CollisionShape that is attached to the CompoundCollisionShape.
+ This is called when the input shape's internal collision shape (a btCollisionShape) has changed.
+ @param shape
+ A pointer to the CollisionShape to be updated.
+ */
void CompoundCollisionShape::updateAttachedShape(CollisionShape* shape)
{
if (!shape)
return;
+
std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.find(shape);
+ // Check whether the input shape belongs to this CompoundCollisionShape.
if (it == this->attachedShapes_.end())
{
CCOUT(2) << "Warning: Cannot update child shape: Instance not a child." << std::endl;
@@ -128,10 +173,11 @@
// Remove old btCollisionShape, stored in the children map
if (it->second)
- this->compoundShape_->removeChildShape(it->second);
+ this->compoundShape_->removeChildShape(it->second); // TODO: Apparently this is broken?
+
+ // Only actually attach if we didn't pick a CompoundCollisionShape with no content
if (shape->getCollisionShape())
{
- // Only actually attach if we didn't pick a CompoundCollisionShape with no content
btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition()));
this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
it->second = shape->getCollisionShape();
@@ -140,44 +186,59 @@
this->updatePublicShape();
}
+ /**
+ @brief
+ Updates the public shape, the collision shape this CompoundCollisionShape has to the outside.
+ */
void CompoundCollisionShape::updatePublicShape()
{
- btCollisionShape* primitive = 0;
- bool bPrimitive = true;
- bool bEmpty = true;
+ btCollisionShape* primitive = 0; // The primitive shape, if there is one.
+ bool bPrimitive = true; // Whether the CompoundCollisionShape has just one non-empty CollisionShape. And that shape also has no transformation.
+ bool bEmpty = true; // Whether the CompoundCollisionShape is empty.
+ // Iterate over all CollisionShapes that belong to this CompoundCollisionShape.
for (std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)
{
+ // TODO: Make sure this is correct.
if (it->second)
{
bEmpty = false;
- if (!it->first->hasTransform() && !bPrimitive)
+ if (!it->first->hasTransform() && bPrimitive)
primitive = it->second;
else
+ {
bPrimitive = false;
+ break;
+ }
}
}
+
+ // If there is no non-empty CollisionShape.
if (bEmpty)
{
+ // If there was none all along, nothing needs to be changed.
if (this->collisionShape_ == 0)
- {
- this->collisionShape_ = 0;
return;
- }
this->collisionShape_ = 0;
}
+ // If the CompoundCollisionShape is just a primitive.
+ // Only one shape to be added, no transform; return it directly.
else if (bPrimitive)
- {
- // --> Only one shape to be added, no transform; return it directly
this->collisionShape_ = primitive;
- }
+ // Make sure we use the compound shape when returning a btCollisionShape.
else
- {
- // Make sure we use the compound shape when returning a btCollisionShape
this->collisionShape_ = this->compoundShape_;
- }
+
this->updateParent();
}
+ /**
+ @brief
+ Get the attached CollisionShape at the given index.
+ @param index
+ The index of the desired CollisionShape.
+ @return
+ Returns a pointer to the attached CollisionShape at the given index.
+ */
CollisionShape* CompoundCollisionShape::getAttachedShape(unsigned int index) const
{
unsigned int i = 0;
@@ -189,4 +250,50 @@
}
return 0;
}
+
+ /**
+ @brief
+ Is called when the scale of the CompoundCollisionShape has changed.
+ Iterates over all attached CollisionShapes and scales them, then recomputes their compound shape.
+ */
+ void CompoundCollisionShape::changedScale()
+ {
+ CollisionShape::changedScale();
+
+ std::vector<CollisionShape*> shapes;
+ // Iterate through all attached CollisionShapes and add them to the list of shapes.
+ for(std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
+ shapes.push_back(it->first);
+
+ // Delete the compound shape and create a new one.
+ delete this->compoundShape_;
+ this->compoundShape_ = new btCompoundShape();
+
+ // Re-attach all CollisionShapes.
+ for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++)
+ {
+ CollisionShape* shape = *it;
+ shape->setScale3D(this->getScale3D());
+ // Only actually attach if we didn't pick a CompoundCollisionShape with no content.
+ if (shape->getCollisionShape())
+ {
+ btTransform transf(multi_cast<btQuaternion>(shape->getOrientation()), multi_cast<btVector3>(shape->getPosition()));
+ // Add the btCollisionShape of the CollisionShape as a child shape to the btCompoundShape of the CompoundCollisionShape.
+ this->compoundShape_->addChildShape(transf, shape->getCollisionShape());
+ }
+ }
+
+ this->updatePublicShape();
+
+ /*
+ // Iterate through all attached CollisionShapes
+ for(std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)
+ {
+ // Rescale the CollisionShape.
+ it->first->setScale3D(this->getScale3D());
+ this->updateAttachedShape(it->first);
+ }
+
+ this->updatePublicShape();*/
+ }
}
Modified: code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h
===================================================================
--- code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/collisionshapes/CompoundCollisionShape.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -26,6 +26,12 @@
*
*/
+/**
+ @file CompoundCollisionShape.h
+ @brief Definition of the CompoundCollisionShape class.
+ @ingroup Collisionshapes
+*/
+
#ifndef _CompoundCollisionShape_H__
#define _CompoundCollisionShape_H__
@@ -37,6 +43,17 @@
namespace orxonox
{
+
+ /**
+ @brief
+ Wrapper for the bullet compound collision shape class btCompoundShape.
+
+ @author
+ Reto Grieder
+
+ @see btCompoundShape
+ @ingroup Collisionshapes
+ */
class _OrxonoxExport CompoundCollisionShape : public CollisionShape
{
public:
@@ -52,6 +69,8 @@
void updateAttachedShape(CollisionShape* shape);
+ virtual void changedScale();
+
private:
void updatePublicShape();
inline virtual btCollisionShape* createNewShape() const
Modified: code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc
===================================================================
--- code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -42,7 +42,7 @@
this->worldEntityOwner_ = creator;
// suppress synchronisation
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
}
WorldEntityCollisionShape::~WorldEntityCollisionShape()
Modified: code/trunk/src/orxonox/controllers/ArtificialController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/controllers/ArtificialController.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -380,6 +380,11 @@
this->getControllableEntity()->moveFrontBack(1.2f*SPEED_MASTER + distance/300.0f);
}
}
+
+ if (distance < 10)
+ {
+ this->positionReached();
+ }
}
void ArtificialController::moveToTargetPosition()
@@ -387,7 +392,6 @@
this->moveToPosition(this->targetPosition_);
}
-
/**
@brief Unregisters a slave from its master. Initiated by a slave.
*/
Modified: code/trunk/src/orxonox/controllers/ArtificialController.h
===================================================================
--- code/trunk/src/orxonox/controllers/ArtificialController.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/controllers/ArtificialController.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -96,6 +96,8 @@
void moveToPosition(const Vector3& target);
void moveToTargetPosition();
+ virtual void positionReached() {}
+
void removeFromFormation();
void unregisterSlave();
void searchNewMaster();
Modified: code/trunk/src/orxonox/controllers/Controller.h
===================================================================
--- code/trunk/src/orxonox/controllers/Controller.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/controllers/Controller.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -49,8 +49,14 @@
inline PlayerInfo* getPlayer() const
{ return this->player_; }
- virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
+ virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) {};
+/* Override needed for different visual effects (e.g. in "NewHumanController.cc") depending on
+ the DIFFERENT AMOUNT OF DAMAGE done to the shield and to the health of "victim" (see Projectile.cc, Pawn.cc)
+
+// virtual inline void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage) {};
+*/
+
void setGodMode( bool mode ){ this->bGodMode_ = mode; }
bool getGodMode(){ return this->bGodMode_; }
Modified: code/trunk/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/controllers/HumanController.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -41,6 +41,7 @@
{
extern const std::string __CC_fire_name = "fire";
extern const std::string __CC_suicide_name = "suicide";
+ const std::string __CC_boost_name = "boost";
SetConsoleCommand("HumanController", "moveFrontBack", &HumanController::moveFrontBack ).addShortcut().setAsInputCommand();
SetConsoleCommand("HumanController", "moveRightLeft", &HumanController::moveRightLeft ).addShortcut().setAsInputCommand();
@@ -50,7 +51,7 @@
SetConsoleCommand("HumanController", "rotateRoll", &HumanController::rotateRoll ).addShortcut().setAsInputCommand();
SetConsoleCommand("HumanController", __CC_fire_name, &HumanController::fire ).addShortcut().keybindMode(KeybindMode::OnHold);
SetConsoleCommand("HumanController", "reload", &HumanController::reload ).addShortcut();
- SetConsoleCommand("HumanController", "boost", &HumanController::boost ).addShortcut().keybindMode(KeybindMode::OnHold);
+ SetConsoleCommand("HumanController", __CC_boost_name, &HumanController::keepBoost ).addShortcut().keybindMode(KeybindMode::OnHold);
SetConsoleCommand("HumanController", "greet", &HumanController::greet ).addShortcut();
SetConsoleCommand("HumanController", "switchCamera", &HumanController::switchCamera ).addShortcut();
SetConsoleCommand("HumanController", "mouseLook", &HumanController::mouseLook ).addShortcut();
@@ -65,14 +66,19 @@
CreateUnloadableFactory(HumanController);
HumanController* HumanController::localController_s = 0;
+ /*static*/ const float HumanController::BOOSTING_TIME = 0.1f;
HumanController::HumanController(BaseObject* creator) : Controller(creator)
{
RegisterObject(HumanController);
- controlPaused_ = false;
+ this->controlPaused_ = false;
+ this->boosting_ = false;
+ this->boosting_ = false;
HumanController::localController_s = this;
+ this->boostingTimeout_.setTimer(HumanController::BOOSTING_TIME, false, createExecutor(createFunctor(&HumanController::terminateBoosting, this)));
+ this->boostingTimeout_.stopTimer();
}
HumanController::~HumanController()
@@ -162,12 +168,51 @@
HumanController::localController_s->controllableEntity_->reload();
}
- void HumanController::boost()
+ /**
+ @brief
+ Static method,keeps boosting.
+ */
+ /*static*/ void HumanController::keepBoost()
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
- HumanController::localController_s->controllableEntity_->boost();
+ HumanController::localController_s->keepBoosting();
}
+
+ /**
+ @brief
+ Starts, or keeps the boosting mode.
+ Resets the boosting timeout and ells the ControllableEntity to boost (or not boost anymore).
+ */
+ void HumanController::keepBoosting(void)
+ {
+ if(this->boostingTimeout_.isActive())
+ {
+ this->boostingTimeout_.stopTimer();
+ this->boostingTimeout_.startTimer();
+ }
+ else
+ {
+ this->boosting_ = true;
+ this->boostingTimeout_.startTimer();
+
+ this->controllableEntity_->boost(this->boosting_);
+ COUT(4) << "Start boosting" << endl;
+ }
+ }
+ /**
+ @brief
+ Terminates the boosting mode.
+ */
+ void HumanController::terminateBoosting(void)
+ {
+ this->boosting_ = false;
+ this->boostingTimeout_.stopTimer();
+
+ this->controllableEntity_->boost(this->boosting_);
+ COUT(4) << "Stop boosting" << endl;
+ }
+
void HumanController::greet()
{
if (HumanController::localController_s && HumanController::localController_s->controllableEntity_)
Modified: code/trunk/src/orxonox/controllers/HumanController.h
===================================================================
--- code/trunk/src/orxonox/controllers/HumanController.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/controllers/HumanController.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -31,6 +31,7 @@
#include "OrxonoxPrereqs.h"
+#include "tools/Timer.h"
#include "tools/interfaces/Tickable.h"
#include "Controller.h"
@@ -63,7 +64,16 @@
virtual void doFire(unsigned int firemode);
static void reload();
- static void boost();
+ static void keepBoost(); // Static method, keeps boosting.
+ /**
+ @brief Check whether the HumanController is in boosting mode.
+ @return Returns true if it is, false if not.
+ */
+ inline bool isBoosting(void)
+ { return this->boosting_; }
+ void keepBoosting(void);
+ void terminateBoosting(void);
+
static void greet();
static void switchCamera();
static void mouseLook();
@@ -91,6 +101,12 @@
protected:
static HumanController* localController_s;
bool controlPaused_;
+
+ private:
+ bool boosting_; // Whether the HumanController is in boosting mode or not.
+ Timer boostingTimeout_; // A timer to check whether the player is no longer boosting.
+ static const float BOOSTING_TIME; // The time after it is checked, whether the player is no longer boosting.
+
}; // tolua_export
} // tolua_export
Modified: code/trunk/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/gamestates/GSRoot.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -44,6 +44,7 @@
DeclareGameState(GSRoot, "root", false, false);
static const std::string __CC_setTimeFactor_name = "setTimeFactor";
+ static const std::string __CC_getTimeFactor_name = "getTimeFactor";
static const std::string __CC_setPause_name = "setPause";
static const std::string __CC_pause_name = "pause";
@@ -51,6 +52,7 @@
SetConsoleCommand("printObjects", &GSRoot::printObjects).hide();
SetConsoleCommand(__CC_setTimeFactor_name, &GSRoot::setTimeFactor).accessLevel(AccessLevel::Master).defaultValues(1.0);
+ SetConsoleCommand(__CC_getTimeFactor_name, &GSRoot::getTimeFactor).accessLevel(AccessLevel::Master);
SetConsoleCommand(__CC_setPause_name, &GSRoot::setPause ).accessLevel(AccessLevel::Master).hide();
SetConsoleCommand(__CC_pause_name, &GSRoot::pause ).accessLevel(AccessLevel::Master);
@@ -88,6 +90,7 @@
TimeFactorListener::setTimeFactor(1.0f);
ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(this);
+ ModifyConsoleCommand(__CC_getTimeFactor_name).setObject(this);
ModifyConsoleCommand(__CC_setPause_name).setObject(this);
ModifyConsoleCommand(__CC_pause_name).setObject(this);
}
@@ -95,6 +98,7 @@
void GSRoot::deactivate()
{
ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(0);
+ ModifyConsoleCommand(__CC_getTimeFactor_name).setObject(0);
ModifyConsoleCommand(__CC_setPause_name).setObject(0);
ModifyConsoleCommand(__CC_pause_name).setObject(0);
}
@@ -152,6 +156,11 @@
}
}
+ float GSRoot::getTimeFactor()
+ {
+ return TimeFactorListener::getTimeFactor();
+ }
+
void GSRoot::pause()
{
if (GameMode::isMaster())
Modified: code/trunk/src/orxonox/gamestates/GSRoot.h
===================================================================
--- code/trunk/src/orxonox/gamestates/GSRoot.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/gamestates/GSRoot.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -53,6 +53,8 @@
void setPause(bool pause);
void pause();
+ float getTimeFactor();
+
static void delayedStartMainMenu(void);
protected:
Modified: code/trunk/src/orxonox/gametypes/Dynamicmatch.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Dynamicmatch.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/gametypes/Dynamicmatch.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -150,14 +150,7 @@
//Give new pig boost
SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
- if (spaceship && spaceship->getEngine())
- {
- spaceship->getEngine()->setSpeedFactor(5);
- WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());
- ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
- executor->setDefaultValue(0, ptr);
- new Timer(10, false, executor, true);
- }
+ grantPigBoost(spaceship);
}
//Case: notEnoughKillers: party change
@@ -251,15 +244,7 @@
}
//Give new pig boost
SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
- if (spaceship && spaceship->getEngine())
- {
- spaceship->getEngine()->setSpeedFactor(5);
- WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());
- ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
- executor->setDefaultValue(0, ptr);
- new Timer(10, false, executor, true);
- }
-
+ grantPigBoost(spaceship);
}
// killer vs piggy
else if (source==killer &&target==piggy) //party and colour switch
@@ -320,6 +305,19 @@
else return false;
}
+ void Dynamicmatch::grantPigBoost(orxonox::SpaceShip* spaceship)
+ {
+ // Give pig boost
+ if (spaceship)
+ {
+ spaceship->setSpeedFactor(5);
+ WeakPtr<SpaceShip>* ptr = new WeakPtr<SpaceShip>(spaceship);
+ ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
+ executor->setDefaultValue(0, ptr);
+ new Timer(10, false, executor, true);
+ }
+ }
+
void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring
{
if (!player)
@@ -596,7 +594,7 @@
return this->playerParty_[player];
}
- void Dynamicmatch::resetSpeedFactor(WeakPtr<Engine>* ptr)// helper function
+ void Dynamicmatch::resetSpeedFactor(WeakPtr<SpaceShip>* ptr)// helper function
{
if (*ptr)
{
Modified: code/trunk/src/orxonox/gametypes/Dynamicmatch.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Dynamicmatch.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/gametypes/Dynamicmatch.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -72,7 +72,8 @@
/*virtual void instructions();
virtual void furtherInstructions();*/
virtual void rewardPig();
- void resetSpeedFactor(WeakPtr<Engine>* ptr);
+ void grantPigBoost(SpaceShip* spaceship); // Added this, since it's used twice on different occasions.
+ void resetSpeedFactor(WeakPtr<SpaceShip>* ptr);
void tick (float dt);// used to end the game
SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
Modified: code/trunk/src/orxonox/gametypes/Gametype.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/Gametype.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/gametypes/Gametype.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -120,12 +120,21 @@
this->time_ -= dt;
}
- if (this->gtinfo_->bStartCountdownRunning_ && !this->gtinfo_->bStarted_)
- this->gtinfo_->startCountdown_ -= dt;
+ if (this->gtinfo_->isStartCountdownRunning() && !this->gtinfo_->hasStarted())
+ this->gtinfo_->countdownStartCountdown(dt);
- if (!this->gtinfo_->bStarted_)
+ if (!this->gtinfo_->hasStarted())
+ {
+ for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+ {
+ // Inform the GametypeInfo that the player is ready to spawn.
+ if(it->first->isHumanPlayer() && it->first->isReadyToSpawn())
+ this->gtinfo_->playerReadyToSpawn(it->first);
+ }
+
this->checkStart();
- else if (!this->gtinfo_->bEnded_)
+ }
+ else if (!this->gtinfo_->hasEnded())
this->spawnDeadPlayersIfRequested();
this->assignDefaultPawnsIfNeeded();
@@ -135,14 +144,14 @@
{
this->addBots(this->numberOfBots_);
- this->gtinfo_->bStarted_ = true;
+ this->gtinfo_->start();
this->spawnPlayersIfRequested();
}
void Gametype::end()
{
- this->gtinfo_->bEnded_ = true;
+ this->gtinfo_->end();
for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
{
@@ -172,6 +181,7 @@
void Gametype::playerEntered(PlayerInfo* player)
{
this->players_[player].state_ = PlayerState::Joined;
+ this->gtinfo_->playerEntered(player);
}
bool Gametype::playerLeft(PlayerInfo* player)
@@ -269,6 +279,9 @@
}
}
+ if(victim->getPlayer()->isHumanPlayer())
+ this->gtinfo_->pawnKilled(victim->getPlayer());
+
ControllableEntity* entity = this->defaultControllableEntity_.fabricate(victim->getCreator());
if (victim->getCamera())
{
@@ -305,33 +318,32 @@
SpawnPoint* Gametype::getBestSpawnPoint(PlayerInfo* player) const
{
+ // If there is at least one SpawnPoint.
if (this->spawnpoints_.size() > 0)
{
+ // Fallback spawn point if there is no active one, choose a random one.
SpawnPoint* fallbackSpawnPoint = NULL;
unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(this->spawnpoints_.size())));
unsigned int index = 0;
- std::set<SpawnPoint*> activeSpawnPoints = this->spawnpoints_;
+ std::vector<SpawnPoint*> activeSpawnPoints;
for (std::set<SpawnPoint*>::const_iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); ++it)
{
if (index == randomspawn)
fallbackSpawnPoint = (*it);
- if (!(*it)->isActive())
- activeSpawnPoints.erase(*it);
+ if (*it != NULL && (*it)->isActive())
+ activeSpawnPoints.push_back(*it);
++index;
}
- randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(this->spawnpoints_.size())));
- index = 0;
- for (std::set<SpawnPoint*>::const_iterator it = activeSpawnPoints.begin(); it != activeSpawnPoints.end(); ++it)
+ if(activeSpawnPoints.size() > 0)
{
- if (index == randomspawn)
- return (*it);
-
- ++index;
+ randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(activeSpawnPoints.size())));
+ return activeSpawnPoints[randomspawn];
}
+ COUT(2) << "Warning: Fallback SpawnPoint was used, because there were no active SpawnPoints." << endl;
return fallbackSpawnPoint;
}
return 0;
@@ -345,7 +357,7 @@
{
it->second.state_ = PlayerState::Dead;
- if (!it->first->isReadyToSpawn() || !this->gtinfo_->bStarted_)
+ if (!it->first->isReadyToSpawn() || !this->gtinfo_->hasStarted())
{
this->spawnPlayerAsDefaultPawn(it->first);
it->second.state_ = PlayerState::Dead;
@@ -356,14 +368,14 @@
void Gametype::checkStart()
{
- if (!this->gtinfo_->bStarted_)
+ if (!this->gtinfo_->hasStarted())
{
- if (this->gtinfo_->bStartCountdownRunning_)
+ if (this->gtinfo_->isStartCountdownRunning())
{
- if (this->gtinfo_->startCountdown_ <= 0)
+ if (this->gtinfo_->getStartCountdown() <= 0.0f)
{
- this->gtinfo_->bStartCountdownRunning_ = false;
- this->gtinfo_->startCountdown_ = 0;
+ this->gtinfo_->stopStartCountdown();
+ this->gtinfo_->setStartCountdown(0.0f);;
this->start();
}
}
@@ -388,10 +400,10 @@
{
// If in developer's mode, there is no start countdown.
if(Core::getInstance().inDevMode())
- this->gtinfo_->startCountdown_ = 0;
+ this->start();
else
- this->gtinfo_->startCountdown_ = this->initialStartCountdown_;
- this->gtinfo_->bStartCountdownRunning_ = true;
+ this->gtinfo_->setStartCountdown(this->initialStartCountdown_);
+ this->gtinfo_->startStartCountdown();
}
}
}
@@ -401,8 +413,10 @@
void Gametype::spawnPlayersIfRequested()
{
for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
+ {
if (it->first->isReadyToSpawn() || this->bForceSpawn_)
this->spawnPlayer(it->first);
+ }
}
void Gametype::spawnDeadPlayersIfRequested()
@@ -421,6 +435,10 @@
this->playerPreSpawn(player);
player->startControl(spawnpoint->spawn());
this->players_[player].state_ = PlayerState::Alive;
+
+ if(player->isHumanPlayer())
+ this->gtinfo_->playerSpawned(player);
+
this->playerPostSpawn(player);
}
else
Modified: code/trunk/src/orxonox/gametypes/Gametype.h
===================================================================
--- code/trunk/src/orxonox/gametypes/Gametype.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/gametypes/Gametype.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -77,9 +77,9 @@
{ return this->gtinfo_; }
inline bool hasStarted() const
- { return this->gtinfo_->bStarted_; }
+ { return this->gtinfo_->hasStarted(); }
inline bool hasEnded() const
- { return this->gtinfo_->bEnded_; }
+ { return this->gtinfo_->hasEnded(); }
virtual void start();
virtual void end();
@@ -113,14 +113,14 @@
{ this->spawnpoints_.insert(spawnpoint); }
inline bool isStartCountdownRunning() const
- { return this->gtinfo_->bStartCountdownRunning_; }
+ { return this->gtinfo_->isStartCountdownRunning(); }
inline float getStartCountdown() const
- { return this->gtinfo_->startCountdown_; }
+ { return this->gtinfo_->getStartCountdown(); }
inline void setHUDTemplate(const std::string& name)
- { this->gtinfo_->hudtemplate_ = name; }
+ { this->gtinfo_->setHUDTemplate(name); }
inline const std::string& getHUDTemplate() const
- { return this->gtinfo_->hudtemplate_; }
+ { return this->gtinfo_->getHUDTemplate(); }
void addBots(unsigned int amount);
void killBots(unsigned int amount = 0);
Modified: code/trunk/src/orxonox/gametypes/LastTeamStanding.cc
===================================================================
--- code/trunk/src/orxonox/gametypes/LastTeamStanding.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/gametypes/LastTeamStanding.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -54,10 +54,10 @@
this->respawnDelay = 4.0f;
this->setHUDTemplate("lastTeamStandingHUD");
}
-
+
LastTeamStanding::~LastTeamStanding()
{
- }
+ }
void LastTeamStanding::playerEntered(PlayerInfo* player)
{
@@ -68,12 +68,12 @@
playerLives_[player]=lives;
else
playerLives_[player]=getMinLives();//new players only get minimum of lives */
-
+
this->timeToAct_[player] = timeRemaining;
this->playerDelayTime_[player] = respawnDelay;
this->inGame_[player] = true;
unsigned int team = getTeam(player);
- if( team < 0|| team > teams_) // make sure getTeam returns a regular value
+ if(team >= eachTeamsPlayers.size()) // make sure getTeam returns a regular value
return;
if(this->eachTeamsPlayers[team]==0) //if a player is the first in his group, a new team is alive
this->teamsAlive++;
@@ -90,7 +90,7 @@
this->playerDelayTime_.erase(player);
this->inGame_.erase(player);
unsigned int team = getTeam(player);
- if( team < 0|| team > teams_) // make sure getTeam returns a regular value
+ if(team >= eachTeamsPlayers.size()) // make sure getTeam returns a regular value
return valid_player;
this->eachTeamsPlayers[team]--; // a player left the team
if(this->eachTeamsPlayers[team] == 0) // if it was the last player a team died
@@ -106,13 +106,13 @@
return true;
bool allow = TeamDeathmatch::allowPawnDeath(victim, originator);
if(!allow) {return allow;}
-
+
playerLives_[victim->getPlayer()] = playerLives_[victim->getPlayer()] - 1; //player lost a live
this->inGame_[victim->getPlayer()] = false; //if player dies, he isn't allowed to respawn immediately
if (playerLives_[victim->getPlayer()]<=0) //if player lost all lives
{
unsigned int team = getTeam(victim->getPlayer());
- if(team < 0|| team > teams_) // make sure getTeam returns a regular value
+ if(team >= eachTeamsPlayers.size()) // make sure getTeam returns a regular value
return allow;
this->eachTeamsPlayers[team]--;
if(eachTeamsPlayers[team] == 0) //last team member died
@@ -139,7 +139,7 @@
return true;
const std::string& message = ""; // resets Camper-Warning-message
this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
+ }
}
return allow;
}
@@ -162,10 +162,10 @@
if (!player)
return;
TeamDeathmatch::playerStartsControllingPawn(player,pawn);
-
+
this->timeToAct_[player] = timeRemaining + 3.0f + respawnDelay;//reset timer
this->playerDelayTime_[player] = respawnDelay;
-
+
std::map<PlayerInfo*, Player>::iterator it = this->players_.find(player);
if (it != this->players_.end())
{
@@ -173,7 +173,7 @@
return;
const std::string& message = ""; // resets Camper-Warning-message
this->gtinfo_->sendFadingMessage(message,it->first->getClientID());
- }
+ }
}
void LastTeamStanding::tick(float dt)
@@ -186,11 +186,11 @@
this->end();
}
for (std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)
- {
+ {
if (playerGetLives(it->first) <= 0)//Players without lives shouldn't be affected by time.
- continue;
+ continue;
it->second -= dt;//Decreases punishment time.
- if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
+ if (!inGame_[it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.
{
playerDelayTime_[it->first] -= dt;
if (playerDelayTime_[it->first] <= 0)
@@ -308,7 +308,7 @@
else
return 0;
}
-
+
void LastTeamStanding::setConfigValues()
{
SetConfigValue(lives, 4);
Modified: code/trunk/src/orxonox/graphics/Billboard.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Billboard.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/graphics/Billboard.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,14 +22,13 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * Maurus Kaufmann
*
*/
#include "Billboard.h"
#include "OgreBillboard.h"
-#include "OgreBillboardSet.h"
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
@@ -45,7 +44,7 @@
RegisterObject(Billboard);
this->colour_ = ColourValue::White;
- //this->rotation_ = 0;
+ this->rotation_ = 0;
this->registerVariables();
}
@@ -65,14 +64,14 @@
XMLPortParam(Billboard, "material", setMaterial, getMaterial, xmlelement, mode);
XMLPortParam(Billboard, "colour", setColour, getColour, xmlelement, mode).defaultValues(ColourValue::White);
- //XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
+ XMLPortParam(Billboard, "rotation", setRotation, getRotation, xmlelement, mode).defaultValues(0);
}
void Billboard::registerVariables()
{
registerVariable(this->material_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedMaterial));
registerVariable(this->colour_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedColour));
- //registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
+ registerVariable(this->rotation_, VariableDirection::ToClient, new NetworkCallback<Billboard>(this, &Billboard::changedRotation));
}
void Billboard::changedMaterial()
@@ -88,7 +87,7 @@
if (this->billboard_.getBillboardSet())
this->attachOgreObject(this->billboard_.getBillboardSet());
this->billboard_.setVisible(this->isVisible());
- //this->changedRotation();
+ this->changedRotation();
}
}
else
@@ -113,7 +112,7 @@
this->billboard_.setColour(this->colour_);
}
-/*
+
void Billboard::changedRotation()
{
if (this->billboard_.getBillboardSet())
@@ -127,12 +126,48 @@
}
}
}
-*/
+
void Billboard::changedVisibility()
{
SUPER(Billboard, changedVisibility);
this->billboard_.setVisible(this->isVisible());
}
+
+ void Billboard::setBillboardType(Ogre::BillboardType bbt)
+ {
+ Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+ if( bSet != NULL )
+ {
+ bSet->setBillboardType(bbt);
+ }
+ }
+
+ void Billboard::setCommonDirection(Vector3 vec)
+ {
+ Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+ if( bSet != NULL )
+ {
+ bSet->setCommonDirection( vec );
+ }
+ }
+
+ void Billboard::setCommonUpVector(Vector3 vec)
+ {
+ Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+ if( bSet != NULL )
+ {
+ bSet->setCommonUpVector( vec );
+ }
+ }
+
+ void Billboard::setDefaultDimensions(float width, float height)
+ {
+ Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet();
+ if( bSet != NULL )
+ {
+ bSet->setDefaultDimensions(width, height);
+ }
+ }
}
Modified: code/trunk/src/orxonox/graphics/Billboard.h
===================================================================
--- code/trunk/src/orxonox/graphics/Billboard.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/graphics/Billboard.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * Maurus Kaufmann
*
*/
@@ -31,6 +31,8 @@
#include "OrxonoxPrereqs.h"
+#include "OgreBillboardSet.h"
+
#include "util/Math.h"
#include "tools/BillboardSet.h"
#include "interfaces/TeamColourable.h"
@@ -61,16 +63,25 @@
inline const ColourValue& getColour() const
{ return this->colour_; }
-/*
+
inline void setRotation(const Radian& rotation)
{ this->rotation_ = rotation; this->changedRotation(); }
inline const Radian& getRotation() const
{ return this->rotation_; }
-*/
+
virtual void setTeamColour(const ColourValue& colour)
{ this->setColour(colour); }
+
+ void setBillboardType(Ogre::BillboardType bbt);
+
+ void setCommonDirection(Vector3 vec); //!< normalised Vector vec as argument
+
+ void setCommonUpVector(Vector3 vec); //!< normalised Vector vec as argument
+
+ void setDefaultDimensions(float width, float height);
+
protected:
inline BillboardSet& getBillboardSet()
{ return this->billboard_; }
@@ -80,12 +91,12 @@
private:
void registerVariables();
void changedMaterial();
- //void changedRotation();
+ void changedRotation();
BillboardSet billboard_;
std::string material_;
ColourValue colour_;
- //Radian rotation_;
+ Radian rotation_;
};
}
Modified: code/trunk/src/orxonox/graphics/Camera.cc
===================================================================
--- code/trunk/src/orxonox/graphics/Camera.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/graphics/Camera.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -70,7 +70,7 @@
this->bDrag_ = false;
this->lastDtLagged_ = false;
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
this->setConfigValues();
Modified: code/trunk/src/orxonox/graphics/Camera.h
===================================================================
--- code/trunk/src/orxonox/graphics/Camera.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/graphics/Camera.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -39,7 +39,8 @@
namespace orxonox
{
- class _OrxonoxExport Camera : public StaticEntity, public Tickable, public TimeFactorListener, public WindowEventListener
+
+ class _OrxonoxExport Camera : public StaticEntity, public Tickable, public TimeFactorListener, public WindowEventListener
{
friend class CameraManager;
Modified: code/trunk/src/orxonox/infos/GametypeInfo.cc
===================================================================
--- code/trunk/src/orxonox/infos/GametypeInfo.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/infos/GametypeInfo.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,18 +22,29 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * Damian 'Mozork' Frick
*
*/
+/**
+ @file GametypeInfo.cc
+ @brief Implementation of the GametypeInfo class
+*/
+
#include "GametypeInfo.h"
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
+#include "network/Host.h"
#include "network/NetworkFunction.h"
-#include "network/Host.h"
+#include "util/Convert.h"
+
+#include "controllers/HumanController.h"
#include "interfaces/GametypeMessageListener.h"
+#include "interfaces/NotificationListener.h"
+#include "PlayerInfo.h"
+
namespace orxonox
{
CreateUnloadableFactory(GametypeInfo);
@@ -44,14 +55,26 @@
registerMemberNetworkFunction(GametypeInfo, dispatchStaticMessage);
registerMemberNetworkFunction(GametypeInfo, dispatchFadingMessage);
+ registerMemberNetworkFunction(GametypeInfo, changedReadyToSpawn);
+ registerMemberNetworkFunction(GametypeInfo, changedSpawned);
+
+ /*static*/ const std::string GametypeInfo::NOTIFICATION_SENDER("gameinfo");
+
+ /**
+ @brief
+ Registers and initializes the object.
+ */
GametypeInfo::GametypeInfo(BaseObject* creator) : Info(creator)
{
RegisterObject(GametypeInfo);
-
+
this->bStarted_ = false;
this->bEnded_ = false;
- this->startCountdown_ = 0;
+ this->startCountdown_ = 0.0f;
this->bStartCountdownRunning_ = false;
+ this->counter_ = 0;
+ this->spawned_ = false;
+ this->readyToSpawn_ = false;
this->registerVariables();
}
@@ -62,13 +85,313 @@
void GametypeInfo::registerVariables()
{
- registerVariable(this->bStarted_, VariableDirection::ToClient);
- registerVariable(this->bEnded_, VariableDirection::ToClient);
+ registerVariable(this->bStarted_, VariableDirection::ToClient, new NetworkCallback<GametypeInfo>(this, &GametypeInfo::changedStarted));
+ registerVariable(this->bEnded_, VariableDirection::ToClient, new NetworkCallback<GametypeInfo>(this, &GametypeInfo::changedEnded));
+ registerVariable(this->bStartCountdownRunning_, VariableDirection::ToClient, new NetworkCallback<GametypeInfo>(this, &GametypeInfo::changedStartCountdownRunning));
registerVariable(this->startCountdown_, VariableDirection::ToClient);
- registerVariable(this->bStartCountdownRunning_, VariableDirection::ToClient);
+ registerVariable(this->counter_, VariableDirection::ToClient, new NetworkCallback<GametypeInfo>(this, &GametypeInfo::changedCountdownCounter));
registerVariable(this->hudtemplate_, VariableDirection::ToClient);
}
+ /**
+ @brief
+ Is called when the game has changed to started.
+ */
+ void GametypeInfo::changedStarted(void)
+ {
+ NotificationListener::sendCommand("clear", GametypeInfo::NOTIFICATION_SENDER);
+ }
+
+ /**
+ @brief
+ Is called when the game has changed to ended.
+ */
+ void GametypeInfo::changedEnded(void)
+ {
+ // If the game has ended, a "Game has ended" notification is displayed.
+ if(this->hasEnded())
+ NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER);
+ }
+
+ /**
+ @brief
+ Is called when the start countdown has been either started or stopped.
+ */
+ void GametypeInfo::changedStartCountdownRunning(void)
+ {
+ // Send first countdown notification if the countdown has started.
+ if(this->isReadyToSpawn() && !this->hasStarted() && this->isStartCountdownRunning() && !this->hasEnded())
+ NotificationListener::sendNotification(multi_cast<std::string>(this->counter_), GametypeInfo::NOTIFICATION_SENDER);
+ }
+
+ /**
+ @brief
+ Is called when the start countdown counter has changed.
+ */
+ void GametypeInfo::changedCountdownCounter(void)
+ {
+ // Send countdown notification if the counter has gone down.
+ if(this->isReadyToSpawn() && !this->hasStarted() && this->isStartCountdownRunning() && !this->hasEnded())
+ NotificationListener::sendNotification(multi_cast<std::string>(this->counter_), GametypeInfo::NOTIFICATION_SENDER);
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo that the local player has changed its ready to spawn status.
+ @param ready
+ Whether the player has become ready to spawn or not.
+ */
+ void GametypeInfo::changedReadyToSpawn(bool ready)
+ {
+ if(this->readyToSpawn_ == ready)
+ return;
+
+ this->readyToSpawn_ = ready;
+
+ // Send "Waiting for other players" if the player is ready to spawn but the game has not yet started nor is the countdown running.
+ if(this->readyToSpawn_ && !this->hasStarted() && !this->isStartCountdownRunning() && !this->hasEnded())
+ NotificationListener::sendNotification("Waiting for other players", GametypeInfo::NOTIFICATION_SENDER);
+ // Send current countdown if the player is ready to spawn and the countdown has already started.
+ else if(this->readyToSpawn_ && !this->hasStarted() && this->isStartCountdownRunning() && !this->hasEnded())
+ NotificationListener::sendNotification(multi_cast<std::string>(this->counter_), GametypeInfo::NOTIFICATION_SENDER);
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo that the game has started.
+ */
+ void GametypeInfo::start(void)
+ {
+ if(this->bStarted_)
+ return;
+
+ this->bStarted_ = true;
+ this->changedStarted();
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo that the game has ended.
+ */
+ void GametypeInfo::end(void)
+ {
+ if(this->bEnded_)
+ return;
+
+ this->bEnded_ = true;
+ this->changedEnded();
+ }
+
+ /**
+ @brief
+ Set the start countdown to the input value.
+ @param countdown
+ The countdown to be set.
+ */
+ void GametypeInfo::setStartCountdown(float countdown)
+ {
+ if(this->startCountdown_ == countdown || countdown < 0.0f)
+ return;
+
+ this->startCountdown_ = countdown;
+ // Set the counter to the ceiling of the current countdown.
+ this->counter_ = std::ceil(countdown);
+ this->changedCountdownCounter();
+ }
+
+ /**
+ @brief
+ Count down the start countdown by the specified value.
+ @param countDown
+ The amount by which we count down.
+ */
+ void GametypeInfo::countdownStartCountdown(float countDown)
+ {
+ float newCountdown = this->startCountdown_ - countDown;
+ // If we have switched integers or arrived at zero, we also count down the start countdown counter.
+ if(ceil(newCountdown) != ceil(this->startCountdown_) || newCountdown <= 0.0f)
+ this->countDown();
+ this->startCountdown_ = newCountdown;
+ }
+
+ /**
+ @brief
+ Count down the start countdown counter.
+ */
+ void GametypeInfo::countDown()
+ {
+ if(this->counter_ == 0)
+ return;
+
+ this->counter_--;
+ this->changedCountdownCounter();
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo about the start of the start countdown.
+ */
+ void GametypeInfo::startStartCountdown(void)
+ {
+ if(GameMode::isMaster())
+ {
+ if(this->bStartCountdownRunning_)
+ return;
+
+ this->bStartCountdownRunning_ = true;
+ this->changedStartCountdownRunning();
+ }
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo about the stop of the start countdown.
+ */
+ void GametypeInfo::stopStartCountdown(void)
+ {
+ if(GameMode::isMaster())
+ {
+ if(!this->bStartCountdownRunning_)
+ return;
+
+ this->bStartCountdownRunning_ = false;
+ this->changedStartCountdownRunning();
+ }
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo about a player that is ready to spawn.
+ @param player
+ The player that is ready to spawn.
+ */
+ void GametypeInfo::playerReadyToSpawn(PlayerInfo* player)
+ {
+ if(GameMode::isMaster())
+ {
+ // If the player has spawned already.
+ if(this->spawnedPlayers_.find(player) != this->spawnedPlayers_.end())
+ return;
+
+ this->spawnedPlayers_.insert(player);
+ this->setReadyToSpawnHelper(player, true);
+ }
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo about a player whose Pawn has been killed.
+ @param player
+ The player whose Pawn has been killed.
+ */
+ void GametypeInfo::pawnKilled(PlayerInfo* player)
+ {
+ if(GameMode::isMaster())
+ {
+ NotificationListener::sendNotification("Press [Fire] to respawn", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
+ // Remove the player from the list of players that have spawned, since it currently is not.
+ this->spawnedPlayers_.erase(player);
+ this->setReadyToSpawnHelper(player, false);
+ this->setSpawnedHelper(player, false);
+ }
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo about a player that has spawned.
+ @param player
+ The player that has spawned.
+ */
+ void GametypeInfo::playerSpawned(PlayerInfo* player)
+ {
+ if(GameMode::isMaster())
+ {
+ if(this->hasStarted() && !this->hasEnded())
+
+ this->setSpawnedHelper(player, true);
+ }
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo that the local player has changed its spawned status.
+ @param spawned
+ Whether the local player has changed to spawned or to not spawned.
+ */
+ void GametypeInfo::changedSpawned(bool spawned)
+ {
+ if(this->spawned_ == spawned)
+ return;
+
+ this->spawned_ = spawned;
+ // Clear the notifications if the Player has spawned.
+ if(this->spawned_ && !this->hasEnded())
+ NotificationListener::sendCommand("clear", GametypeInfo::NOTIFICATION_SENDER);
+ }
+
+ /**
+ @brief
+ Inform the GametypeInfo about a player that has entered,
+ @param player
+ The player that has entered.
+ */
+ void GametypeInfo::playerEntered(PlayerInfo* player)
+ {
+ if(GameMode::isMaster())
+ {
+ if( player->isHumanPlayer() )
+ {
+ // Display "Press [Fire] to start the match" if the game has not yet ended.
+ if(!this->hasEnded())
+ NotificationListener::sendNotification("Press [Fire] to start the match", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
+ // Else display "Game has ended".
+ else
+ NotificationListener::sendNotification("Game has ended", GametypeInfo::NOTIFICATION_SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());
+ }
+ }
+ }
+
+ /**
+ @brief
+ Helper method. Sends changedReadyToSpawn notifiers over the network.
+ @param player
+ The player that has changed its ready to spawn status.
+ @param ready
+ The new ready to spawn status.
+ */
+ void GametypeInfo::setReadyToSpawnHelper(PlayerInfo* player, bool ready)
+ {
+ if(GameMode::isMaster())
+ {
+ if(player->getClientID() == CLIENTID_SERVER)
+ this->changedReadyToSpawn(ready);
+ else
+ callMemberNetworkFunction(GametypeInfo, changedReadyToSpawn, this->getObjectID(), player->getClientID(), ready);
+ }
+ }
+
+ /**
+ @brief
+ Helper method. Sends changedSpawned notifiers over the network.
+ @param player
+ The player that has changed its spawned status.
+ @param ready
+ The new spawned status.
+ */
+ void GametypeInfo::setSpawnedHelper(PlayerInfo* player, bool spawned)
+ {
+ if(GameMode::isMaster())
+ {
+ if(player->getClientID() == CLIENTID_SERVER)
+ this->changedSpawned(spawned);
+ else
+ callMemberNetworkFunction(GametypeInfo, changedSpawned, this->getObjectID(), player->getClientID(), spawned);
+ }
+ }
+
+ // Announce messages.
+ // TODO: Replace with notifications.
+
void GametypeInfo::sendAnnounceMessage(const std::string& message)
{
if (GameMode::isMaster())
Modified: code/trunk/src/orxonox/infos/GametypeInfo.h
===================================================================
--- code/trunk/src/orxonox/infos/GametypeInfo.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/infos/GametypeInfo.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,20 +22,36 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * Damian 'Mozork' Frick
*
*/
+/**
+ @file GametypeInfo.h
+ @brief Definition of the GametypeInfo class
+*/
+
#ifndef _GametypeInfo_H__
#define _GametypeInfo_H__
#include "OrxonoxPrereqs.h"
#include <string>
+
#include "Info.h"
namespace orxonox
{
+
+ /**
+ @brief
+ The GametypeInfo class keeps track of the state of the game and provides facilities to inform the player about it.
+
+ @author
+ Fabian 'x3n' Landau
+ @author
+ Damian 'Mozork' Frick
+ */
class _OrxonoxExport GametypeInfo : public Info
{
friend class Gametype;
@@ -44,16 +60,62 @@
GametypeInfo(BaseObject* creator);
virtual ~GametypeInfo();
+ /**
+ @brief Get whether the game has started yet.
+ @return Returns true if the game has started, false if not.
+ */
inline bool hasStarted() const
{ return this->bStarted_; }
+ void changedStarted(void); // Is called when the game has changed to started.
+
+ /**
+ @brief Get whether the game has ended yet.
+ @return Returns true if the game has ended, false if not.
+ */
inline bool hasEnded() const
{ return this->bEnded_; }
+ void changedEnded(void); // Is called when the game has changed to ended.
+ /**
+ @brief Get whether the start countdown is currently running.
+ @return Returns true if the countdown is running, false if not.
+ */
inline bool isStartCountdownRunning() const
{ return this->bStartCountdownRunning_; }
+ void changedStartCountdownRunning(void); // Is called when the start countdown has been either started or stopped.
+
+ /**
+ @brief Get the current value of the start countdown.
+ @return Returns the current value of the start countdown.
+ */
inline float getStartCountdown() const
{ return this->startCountdown_; }
+ /**
+ @brief Get the current start countdown counter.
+ The start countdown counter only has integer values that correspond to the actually displayed countdown.
+ @return Returns the current integer countdown counter.
+ */
+ inline unsigned int getStartCountdownCounter() const
+ { return this->counter_; }
+ void changedCountdownCounter(void); // Is called when the start countdown counter has changed.
+
+ /**
+ @brief Get whether the local player is ready to spawn.
+ @return Returns true if the player is ready to spawn, false if not.
+ */
+ inline bool isReadyToSpawn() const
+ { return this->readyToSpawn_; }
+ void changedReadyToSpawn(bool ready); // Inform the GametypeInfo that the local player has changed its spawned status.
+
+ /**
+ @brief Get whether the local player is spawned.
+ @return Returns true if the local player is currently spawned, false if not.
+ */
+ inline bool isSpawned() const
+ { return this->spawned_; }
+ void changedSpawned(bool spawned); // Inform the GametypeInfo that the local player has changed its spawned status.
+
inline const std::string& getHUDTemplate() const
{ return this->hudtemplate_; }
@@ -69,15 +131,40 @@
void dispatchDeathMessage(const std::string& message);
void dispatchStaticMessage(const std::string& message,const ColourValue& colour);
void dispatchFadingMessage(const std::string& message);
+
+ protected:
+ void start(void); // Inform the GametypeInfo that the game has started.
+ void end(void); // Inform the GametypeInfo that the game has ended.
+ void setStartCountdown(float countdown); // Set the start countdown to the input value.
+ void countdownStartCountdown(float countDown); // Count down the start countdown by the specified value.
+ void countDown(); // Count down the start countdown counter.
+ void startStartCountdown(void); // Inform the GametypeInfo about the start of the start countdown.
+ void stopStartCountdown(void); // Inform the GametypeInfo about the stop of the start countdown.
+ void playerReadyToSpawn(PlayerInfo* player); // Inform the GametypeInfo about a player that is ready to spawn.
+ void pawnKilled(PlayerInfo* player); // Inform the GametypeInfo about a player whose Pawn has been killed.
+ void playerSpawned(PlayerInfo* player); // Inform the GametypeInfo about a player that has spawned.
+ void playerEntered(PlayerInfo* player); // Inform the GametypeInfo about a player that has entered,
+ inline void setHUDTemplate(const std::string& templateName)
+ { this->hudtemplate_ = templateName; };
+
private:
void registerVariables();
+ void setSpawnedHelper(PlayerInfo* player, bool spawned); // Helper method. Sends changedReadyToSpawn notifiers over the network.
+ void setReadyToSpawnHelper(PlayerInfo* player, bool ready); // Helper method. Sends changedSpawned notifiers over the network.
- bool bStarted_;
- bool bEnded_;
- bool bStartCountdownRunning_;
- float startCountdown_;
+ static const std::string NOTIFICATION_SENDER; //!< The name of the sender for the sending of notifications.
+
+ bool bStarted_; //!< Whether the game has started,
+ bool bEnded_; //!< Whether the game has ended.
+ bool bStartCountdownRunning_; //!< Whether the start countdown is running.
+ float startCountdown_; //!< The current value of the start countdown.
+ unsigned int counter_; //!< The current integer value of the start countdown, the start countdown counter.
std::string hudtemplate_;
+
+ std::set<PlayerInfo*> spawnedPlayers_; //!< A set of players that are currently spawned.
+ bool spawned_; //!< Whether the local Player is currently spawned.
+ bool readyToSpawn_; //!< Whether the local Player is ready to spawn.
};
}
Modified: code/trunk/src/orxonox/infos/PlayerInfo.cc
===================================================================
--- code/trunk/src/orxonox/infos/PlayerInfo.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/infos/PlayerInfo.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -50,7 +50,6 @@
this->controller_ = 0;
this->controllableEntity_ = 0;
this->controllableEntityID_ = OBJECTID_UNKNOWN;
- this->oldControllableEntity_ = 0;
this->gtinfo_ = 0;
this->gtinfoID_ = OBJECTID_UNKNOWN;
@@ -150,8 +149,9 @@
if (!entity || entity == this->controllableEntity_)
return;
- if (this->oldControllableEntity_)
+ while (this->previousControllableEntity_.size() > 0)
this->stopTemporaryControl();
+
if (this->controllableEntity_)
this->stopControl();
@@ -176,9 +176,8 @@
if (!entity)
return;
- assert( this->oldControllableEntity_==0 );
-
- this->oldControllableEntity_ = this->controllableEntity_;
+ this->controllableEntity_->destroyHud(); // HACK-ish
+ this->previousControllableEntity_.push_back(WeakPtr<ControllableEntity>(this->controllableEntity_));
this->controllableEntity_ = entity;
this->controllableEntityID_ = entity->getObjectID();
@@ -193,7 +192,7 @@
void PlayerInfo::stopControl()
{
- if ( this->oldControllableEntity_ )
+ while ( this->previousControllableEntity_.size() > 0)
this->stopTemporaryControl();
ControllableEntity* entity = this->controllableEntity_;
@@ -214,23 +213,43 @@
this->changedControllableEntity();
}
+ void PlayerInfo::pauseControl()
+ {
+ ControllableEntity* entity = this->controllableEntity_;
+
+ if (!entity)
+ return;
+
+ this->controllableEntity_->getController()->setActive(false);
+ //this->controllableEntity_->getController()->setControllableEntity(NULL);
+ this->controllableEntity_->setController(0);
+ }
+
void PlayerInfo::stopTemporaryControl()
{
ControllableEntity* entity = this->controllableEntity_;
- assert( this->controllableEntity_ && this->oldControllableEntity_ );
- if( !entity || !this->oldControllableEntity_ )
+ assert(this->controllableEntity_ != NULL);
+ if( !entity || this->previousControllableEntity_.size() == 0 )
return;
this->controllableEntity_->setController(0);
+ this->controllableEntity_->destroyHud(); // HACK-ish
- this->controllableEntity_ = this->oldControllableEntity_;
+// this->controllableEntity_ = this->previousControllableEntity_.back();
+ do {
+ this->controllableEntity_ = this->previousControllableEntity_.back();
+ } while(this->controllableEntity_ == NULL && this->previousControllableEntity_.size() > 0);
this->controllableEntityID_ = this->controllableEntity_->getObjectID();
- this->oldControllableEntity_ = 0;
+ this->previousControllableEntity_.pop_back();
- if ( this->controllableEntity_ && this->controller_)
+ if ( this->controllableEntity_ != NULL && this->controller_ != NULL)
this->controller_->setControllableEntity(this->controllableEntity_);
+ // HACK-ish
+ if(this->controllableEntity_ != NULL)
+ this->controllableEntity_->createHud();
+
if ( GameMode::isMaster() )
entity->removePlayer();
Modified: code/trunk/src/orxonox/infos/PlayerInfo.h
===================================================================
--- code/trunk/src/orxonox/infos/PlayerInfo.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/infos/PlayerInfo.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -67,6 +67,7 @@
void startControl(ControllableEntity* entity);
void stopControl();
+ void pauseControl();
void startTemporaryControl(ControllableEntity* entity);
void stopTemporaryControl();
@@ -97,7 +98,7 @@
bool bReadyToSpawn_;
Controller* controller_;
ControllableEntity* controllableEntity_;
- ControllableEntity* oldControllableEntity_;
+ std::vector< WeakPtr<ControllableEntity> > previousControllableEntity_; //!< List of the previous ControllableEntities if repeatedly startTemporary control was called. The ControllableEntity at the back is the most recent.
unsigned int controllableEntityID_;
const GametypeInfo* gtinfo_;
Modified: code/trunk/src/orxonox/interfaces/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/interfaces/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/interfaces/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,5 +1,6 @@
ADD_SOURCE_FILES(ORXONOX_SRC_FILES
InterfaceCompilation.cc
+ NotificationListener.cc
Pickupable.cc
PickupCarrier.cc
PickupListener.cc
Modified: code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc
===================================================================
--- code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/interfaces/InterfaceCompilation.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -41,6 +41,9 @@
#include "core/CoreIncludes.h"
+#include "infos/PlayerInfo.h"
+#include "worldentities/pawns/Pawn.h"
+
namespace orxonox
{
//----------------------------
@@ -58,10 +61,17 @@
{
RegisterRootObject(PlayerTrigger);
- this->player_ = NULL;
this->isForPlayer_ = false;
}
+ void PlayerTrigger::setTriggeringPawn(Pawn* pawn)
+ {
+ assert(pawn);
+ this->pawn_ = WeakPtr<Pawn>(pawn);
+ if (pawn)
+ this->player_ = WeakPtr<PlayerInfo>(pawn->getPlayer());
+ }
+
//----------------------------
// RadarListener
//----------------------------
@@ -85,12 +95,4 @@
{
RegisterRootObject(Rewardable);
}
-
- //----------------------------
- // NotificationListener
- //----------------------------
- NotificationListener::NotificationListener()
- {
- RegisterRootObject(NotificationListener);
- }
}
Copied: code/trunk/src/orxonox/interfaces/NotificationListener.cc (from rev 8705, code/branches/presentation/src/orxonox/interfaces/NotificationListener.cc)
===================================================================
--- code/trunk/src/orxonox/interfaces/NotificationListener.cc (rev 0)
+++ code/trunk/src/orxonox/interfaces/NotificationListener.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -0,0 +1,161 @@
+/*
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Damian 'Mozork' Frick
+ * Co-authors:
+ * ...
+ *
+ */
+
+/**
+ @file NotificationListener.cc
+ @brief Implementation of the NotificationListener class.
+*/
+
+#include "core/CoreIncludes.h"
+#include "network/Host.h"
+#include "network/NetworkFunction.h"
+#include "util/SubString.h"
+
+#include "interfaces/NotificationListener.h"
+
+namespace orxonox
+{
+
+ /*static*/ const std::string NotificationListener::ALL("all");
+ /*static*/ const std::string NotificationListener::NONE("none");
+
+ // Commands
+ /*static*/ const std::string NotificationListener::COMMAND_CLEAR("clear");
+ /*static*/ const std::string NotificationListener::COMMAND_NONE("none");
+
+ registerStaticNetworkFunction(NotificationListener::sendHelper);
+
+ NotificationListener::NotificationListener()
+ {
+ RegisterRootObject(NotificationListener);
+ }
+
+ /**
+ @brief
+ Helper method to send both notifications and commands over the network.
+ @param message
+ The message/command that should be sent.
+ @param sender
+ The sender that sent the notification/command.
+ @param sendMode
+ The mode in which the notification/command is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts.
+ @param clientId
+ The id of the client the notification/command should be sent to.
+ @param isCommand
+ Whether the message is a notification or a command.
+ @param messageType
+ The type of the notification, can be either 'info' or 'important'.
+ */
+ /*static*/ void NotificationListener::sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand, notificationMessageType::Value messageType)
+ {
+ // If we're in standalone mode or we're already no the right client we create and send the notification/command.
+ if(GameMode::isStandalone() || sendMode == notificationSendMode::local || (sendMode == notificationSendMode::network && Host::getPlayerID() == clientId))
+ {
+ sendHelper(message, sender, isCommand, messageType);
+ }
+ // If we're on the server (and the server is not the intended recipient of the notification/command) we send it over the network.
+ else if(GameMode::isServer() && sendMode == notificationSendMode::network && Host::getPlayerID() != clientId)
+ {
+ callStaticNetworkFunction(NotificationListener::sendHelper, clientId, message, sender, isCommand, (unsigned int)messageType);
+ }
+ else if(GameMode::isServer() && sendMode == notificationSendMode::broadcast)
+ {
+ // TODO: Works as intended?
+ callStaticNetworkFunction(NotificationListener::sendHelper, NETWORK_PEER_ID_BROADCAST, message, sender, isCommand, (unsigned int)messageType);
+ }
+ }
+
+ /**
+ @brief
+ Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
+ @param message
+ The notification/command to be sent/executed.
+ @param sender
+ The sender that sent the notification/command.
+ @param isCommand
+ Whether the message is a command or a notification.
+ @param messageType
+ The type of the notification.
+ */
+ /*static*/ void NotificationListener::sendHelper(const std::string& message, const std::string& sender, bool isCommand, unsigned int messageType)
+ {
+ // Iterate through all NotificationListeners and notify them by calling the method they overloaded.
+ for(ObjectList<NotificationListener>::iterator it = ObjectList<NotificationListener>::begin(); it != ObjectList<NotificationListener>::end(); ++it)
+ {
+ // If the notification is a message.
+ if(!isCommand)
+ it->registerNotification(message, sender, notificationMessageType::Value(messageType));
+
+ // If the notification is a command.
+ if(isCommand)
+ {
+ notificationCommand::Value command = str2Command(message);
+ if(command != notificationCommand::none)
+ it->executeCommand(command, sender);
+ }
+ }
+ }
+
+ /**
+ @brief
+ Helper method. Converts a string into the enum for a command.
+ @param string
+ The string to be converted.
+ @return
+ Returns the corresponding enum, notificationCommand::none if the command doesn't exist.
+ */
+ /*static*/ notificationCommand::Value NotificationListener::str2Command(const std::string& string)
+ {
+ notificationCommand::Value command = notificationCommand::none;
+
+ if(string == NotificationListener::COMMAND_CLEAR)
+ command = notificationCommand::clear;
+
+ return command;
+ }
+
+ /**
+ @brief
+ Helper method. Converts a command enum into its corresponding string.
+ @param command
+ The command to be converted.
+ @return
+ Returns the corresponding string.
+ */
+ /*static*/ const std::string& NotificationListener::command2Str(notificationCommand::Value command)
+ {
+ switch(command)
+ {
+ case notificationCommand::clear:
+ return NotificationListener::COMMAND_CLEAR;
+ default:
+ return NotificationListener::COMMAND_NONE;
+ }
+ }
+
+}
\ No newline at end of file
Modified: code/trunk/src/orxonox/interfaces/NotificationListener.h
===================================================================
--- code/trunk/src/orxonox/interfaces/NotificationListener.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/interfaces/NotificationListener.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -20,7 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Author:
- * Fabian 'x3n' Landau
+ * Damian 'Mozork' Frick
* Co-authors:
* ...
*
@@ -47,19 +47,47 @@
namespace orxonox
{
- class Notification;
+ // TODO: Document.
+ namespace notificationMessageType
+ {
+ enum Value {
+ info,
+ important
+ };
+ }
+
+ namespace notificationSendMode
+ {
+ enum Value {
+ local,
+ network,
+ broadcast
+ };
+ }
+
+ namespace notificationCommand
+ {
+ enum Value {
+ none,
+ clear
+ };
+ }
+ // TODO: Update doc.
/**
@brief
NotificationListener interface.
- The NotificationListener interface presents a means to being informed when @ref orxonox::Notification "Notifications" in the target set of this NotificationListener change. (e.g. @ref orxonox::Notification "Notifications" were added or removed)
- When inheriting from a NotificationListener it is important to register (in the constructor) and unregister (in the destructor) it to and from the @ref orxonox::NotificationManager "NotificationManager".
+ The NotificationListener interface (or more precisely abstract class) presents a means of being informed when a new @ref orxonox::Notification "Notification" is sent.
+ The NotificationListener can be used to send a new notification message (with NotificationListener::sendNotification() ) or a new notification command (with NotificationListener::sendCommand() ). Each NotificationListener is then informed about the new @ref orxonox::Notification "Notification" and can take appropriate action. Currently the only NotificationListener ist the @ref orxonox::NotificationManager "NotificationManager" singleton.
+ When inheriting from a NotificationListener it is important to provide an appropriate implementation of registerNotification() and executeCommand().
+
@author
- Fabian 'x3n' Landau
-
+ Damian 'Mozork' Frick
+
@ingroup Notifications
+ @todo Consistent terminology between message, notification and command.
*/
class _OrxonoxExport NotificationListener : virtual public OrxonoxClass
{
@@ -68,22 +96,62 @@
virtual ~NotificationListener() {}
/**
- @brief Get the senders that are targets of this NotificationListener.
- @return Returns the set of senders that are targets of this NotificationListener.
+ @brief Sends a Notification with the specified message to the specified client from the specified sender.
+ @param message The message that should be sent.
+ @param sender The sender that sent the notification. Default is 'none'.
+ @param messageType The type of the message, can be either 'info' or 'important'. Default is 'info'.
+ @param sendMode The mode in which the notification is sent, can be 'local' to send the notification to the client where this function is executed, 'network' if the notification is to be sent to the client with the specified clientID, or 'broadcast' if the notification should be sent to all hosts. Default is notificationSendMode::local.
+ @param clientId The id of the client the notification should be sent to. Default is 0.
*/
- virtual const std::set<std::string> & getTargetsSet(void) = 0;
+ static void sendNotification(const std::string& message, const std::string& sender = NotificationListener::NONE, notificationMessageType::Value messageType = notificationMessageType::info, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)
+ { NotificationListener::sendNetworkHelper(message, sender, sendMode, clientId, false, messageType); }
+ /**
+ @brief Sends a specified command to the specified client from the specified sender.
+ @param command The command that should be sent (and later executed).
+ @param sender The sender that sent the notification. Default is 'none'.
+ @param sendMode The mode in which the command is sent, can be 'local' to send the command to the client where this function is executed, 'network' if the command is to be sent to the client with the specified clientID, or 'broadcast' if the command should be sent to all hosts. Default is notificationSendMode::local.
+ @param clientId The id of the client the command should be sent to. Default is 0.
+ */
+ static void sendCommand(const std::string& command, const std::string& sender = NotificationListener::NONE, notificationSendMode::Value sendMode = notificationSendMode::local, unsigned int clientId = 0)
+ { NotificationListener::sendNetworkHelper(command, sender, sendMode, clientId, true); }
+ static void sendHelper(const std::string& message, const std::string& sender, bool isCommand = false, unsigned int messageMode = 0); // Helper method to register a notification/execute a command with all NotificationListeners after it has been sent over the network.
+
+ //TODO: Make protected?
+
/**
- @brief Updates the whole NotificationListener.
- This is called by the @ref orxonox::NotificationManager "NotificationManager" when the @ref orxonox::Notification "Notifications" have changed so much, that the NotificationListener may have to re-initialize his operations.
+ @brief Registers a notification with the NotificationListener.
+ This needs to be overloaded by each class inheriting from NotificationListener.
+ @param message The notification's message.
+ @param sender The sender of the notification.
+ @param type The type of the notification.
+ @return Returns true if the notification was successfully registered, false if not.
*/
- virtual void update(void) = 0;
+ virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)
+ { return false; }
/**
- @brief Updates the NotificationListener, when a new Notification has come in at the specified time.
- @param notification A pointer to the @ref orxonox::Notification "Notification".
- @param time The time the @ref orxonox::Notification "Notification" has come in.
+ @brief Executes a command with the NotificationListener
+ This needs to be overloaded by each class inheriting from NotificationListener.
+ @param command The command to be executed.
+ @param sender The sender of the command.
+ @return Returns true if the command was successfully executed, false if not.
*/
- virtual void update(Notification* notification, const std::time_t & time) = 0;
+ virtual bool executeCommand(notificationCommand::Value command, const std::string& sender) { return false; }
+
+ public:
+
+ static const std::string ALL; //!< Static string to indicate a sender that sends to all NotificationQueues.
+ static const std::string NONE; //!< Static string to indicate a sender that sends to no specific NotificationQueues.
+
+ //! Commands
+ static const std::string COMMAND_CLEAR;
+ static const std::string COMMAND_NONE;
+
+ protected:
+ static void sendNetworkHelper(const std::string& message, const std::string& sender, notificationSendMode::Value sendMode, unsigned int clientId, bool isCommand = false, notificationMessageType::Value messageType = notificationMessageType::info); // Helper method to send both notifications and commands over the network.
+
+ static notificationCommand::Value str2Command(const std::string& string); // Helper method. Converts a string into the enum for a command.
+ static const std::string& command2Str(notificationCommand::Value command); // Helper method. Converts a command enum into its corresponding string.
};
}
Modified: code/trunk/src/orxonox/interfaces/PlayerTrigger.h
===================================================================
--- code/trunk/src/orxonox/interfaces/PlayerTrigger.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/interfaces/PlayerTrigger.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -38,12 +38,13 @@
#include "OrxonoxPrereqs.h"
#include "core/OrxonoxClass.h"
+#include "core/WeakPtr.h"
namespace orxonox
{
/**
@brief
- PlayerTrigger is an interface if implemented by a specific trigger can be used to recover the Player (or more precisely the @ref orxonox::Pawn "Pawn") that triggered it.
+ PlayerTrigger is an interface if implemented by a specific trigger can be used to recover the Player (or the @ref orxonox::Pawn "Pawn") that triggered it.
@author
Damian 'Mozork' Frick
@@ -57,15 +58,22 @@
virtual ~PlayerTrigger() {}
/**
- @brief Returns the player that triggered the PlayerTrigger.
+ @brief Returns the Pawn that triggered the PlayerTrigger.
@return Returns a pointer to the Pawn that triggered the PlayerTrigger.
*/
- inline Pawn* getTriggeringPlayer(void) const
+ inline Pawn* getTriggeringPawn(void) const
+ { return this->pawn_.get(); }
+
+ /**
+ @brief Returns the player that triggered the PlayerTrigger.
+ @return Returns a pointer to the PlayerInfo that triggered the PlayerTrigger.
+ */
+ inline PlayerInfo* getTriggeringPlayer(void) const
{ return this->player_; }
/**
- @brief Checks whether the PlayerTrigger normally returns a Pawn.
- @return Returns true if the PlayerTrigger normally returns a Pawn.
+ @brief Checks whether the PlayerTrigger normally returns a Pawn/PlayerInfo.
+ @return Returns true if the PlayerTrigger normally returns a Pawn/PlayerInfo.
*/
inline bool isForPlayer(void) const
{ return this->isForPlayer_; }
@@ -75,8 +83,7 @@
@brief Set the player that triggered the PlayerTrigger. This is normally done by classes inheriting vom PlayerTrigger.
@param player A pointer to the Pawn that triggered the PlayerTrigger.
*/
- inline void setTriggeringPlayer(Pawn* player)
- { this->player_ = player; }
+ void setTriggeringPawn(Pawn* pawn);
/**
@brief Set whether the PlayerTrigger normally is triggered by Pawns.
@@ -86,7 +93,8 @@
{ this->isForPlayer_ = isForPlayer; }
private:
- Pawn* player_; //!< The player that triggered the PlayerTrigger.
+ WeakPtr<PlayerInfo> player_; //!< The player that triggered the PlayerTrigger.
+ WeakPtr<Pawn> pawn_; //!< The Pawn that triggered the PlayerTrigger.
bool isForPlayer_; //!< Is true when the PlayerTrigger should be set to normally be triggered by Pawns.
};
Modified: code/trunk/src/orxonox/items/Engine.cc
===================================================================
--- code/trunk/src/orxonox/items/Engine.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/items/Engine.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -34,7 +34,7 @@
#include "core/XMLPort.h"
#include "Scene.h"
#include "worldentities/pawns/SpaceShip.h"
-#include "tools/Shader.h"
+#include "core/Template.h"
namespace orxonox
{
@@ -46,6 +46,7 @@
this->ship_ = 0;
this->shipID_ = OBJECTID_UNKNOWN;
+ this->relativePosition_ = Vector3(0,0,0);
this->boostFactor_ = 1.5;
this->speedFactor_ = 1.0;
@@ -61,8 +62,6 @@
this->accelerationLeftRight_ = 0.0;
this->accelerationUpDown_ = 0.0;
- this->boostBlur_ = 0;
-
this->speedAdd_ = 0.0;
this->speedMultiply_ = 1.0;
@@ -72,12 +71,10 @@
Engine::~Engine()
{
- if (this->isInitialized() && this->ship_)
+ if (this->isInitialized())
{
- this->ship_->setEngine(0);
-
- if (this->boostBlur_)
- this->boostBlur_->destroy();
+ if (this->ship_ && this->ship_->hasEngine(this))
+ this->ship_->removeEngine(this);
}
}
@@ -97,15 +94,13 @@
XMLPortParam(Engine, "accelerationback", setAccelerationBack, setAccelerationBack, xmlelement, mode);
XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode);
XMLPortParam(Engine, "accelerationupdown", setAccelerationUpDown, setAccelerationUpDown, xmlelement, mode);
+
+ XMLPortParam(Engine, "position", setRelativePosition, getRelativePosition, xmlelement, mode);
+ XMLPortParam(Engine, "template", setEngineTemplate, getEngineTemplate, xmlelement, mode);
}
void Engine::setConfigValues()
{
- SetConfigValueExternal(bEnableMotionBlur_, "GraphicsSettings", "enableMotionBlur", true)
- .description("Enable or disable the motion blur effect when moving very fast")
- .callback(this, &Engine::changedEnableMotionBlur);
- SetConfigValueExternal(blurStrength_, "GraphicsSettings", "blurStrength", 3.0f)
- .description("Defines the strength of the motion blur effect");
}
void Engine::registerVariables()
@@ -162,7 +157,11 @@
SUPER(Engine, tick, dt);
- const Vector3& direction = this->getDirection();
+ Vector3 direction = this->getDirection();
+ float directionLength = direction.length();
+ if (directionLength > 1.0f)
+ direction /= directionLength; // normalize
+
Vector3 velocity = this->ship_->getLocalVelocity();
Vector3 acceleration = Vector3::ZERO;
@@ -201,33 +200,21 @@
acceleration.y = direction.y * this->accelerationUpDown_ * clamp((this->maxSpeedUpDown_ - velocity.y) / this->maxSpeedUpDown_, 0.0f, 1.0f);
}
- this->ship_->setAcceleration(this->ship_->getOrientation() * (acceleration*this->getSpeedMultiply()+Vector3(0,0,-this->getSpeedAdd())));
+ // NOTE: Bullet always uses global coordinates.
+ this->ship_->addAcceleration(this->ship_->getOrientation() * (acceleration*this->getSpeedMultiply()+Vector3(0,0,-this->getSpeedAdd())), this->ship_->getOrientation() * this->relativePosition_);
- if (!this->ship_->getPermanentBoost())
- this->ship_->setBoost(false);
- this->ship_->setSteeringDirection(Vector3::ZERO);
-
- if (this->bEnableMotionBlur_ && !this->boostBlur_ && this->ship_->hasLocalController() && this->ship_->hasHumanController())
+ // Hack to reset a temporary variable "direction"
+ this->ship_->oneEngineTickDone();
+ if(!this->ship_->hasEngineTicksRemaining())
{
- this->boostBlur_ = new Shader(this->ship_->getScene()->getSceneManager());
- this->boostBlur_->setCompositorName("Radial Blur");
+ this->ship_->setSteeringDirection(Vector3::ZERO);
+ this->ship_->resetEngineTicks();
}
-
- if (this->boostBlur_ && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
- {
- float blur = this->blurStrength_ * clamp((-velocity.z - this->maxSpeedFront_) / ((this->boostFactor_ - 1) * this->maxSpeedFront_), 0.0f, 1.0f);
-
- this->boostBlur_->setVisible(blur > 0);
- this->boostBlur_->setParameter(0, 0, "sampleStrength", blur);
- }
}
void Engine::changedActivity()
{
SUPER(Engine, changedActivity);
-
- if (this->boostBlur_)
- this->boostBlur_->setVisible(this->isVisible());
}
void Engine::addToSpaceShip(SpaceShip* ship)
@@ -237,14 +224,8 @@
if (ship)
{
this->shipID_ = ship->getObjectID();
- if (ship->getEngine() != this)
- ship->setEngine(this);
-
- if (this->boostBlur_)
- {
- this->boostBlur_->destroy();
- this->boostBlur_ = 0;
- }
+ if (!ship->hasEngine(this))
+ ship->addEngine(this);
}
}
@@ -266,12 +247,16 @@
return this->ship_->getWorldPosition();
}
- void Engine::changedEnableMotionBlur()
+ void Engine::loadEngineTemplate()
{
- if (!this->bEnableMotionBlur_)
+ if(!this->engineTemplate_.empty())
{
- this->boostBlur_->destroy();
- this->boostBlur_ = 0;
+ COUT(4)<<"Loading an engine template: "<<this->engineTemplate_<<"\n";
+ Template *temp = Template::getTemplate(this->engineTemplate_);
+ if(temp)
+ {
+ this->addTemplate(temp);
+ }
}
}
}
Modified: code/trunk/src/orxonox/items/Engine.h
===================================================================
--- code/trunk/src/orxonox/items/Engine.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/items/Engine.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -54,6 +54,11 @@
inline SpaceShip* getShip() const
{ return this->ship_; }
+ inline void setRelativePosition(const Vector3 &position)
+ { this->relativePosition_ = position; }
+ inline Vector3& getRelativePosition()
+ { return this->relativePosition_; }
+
inline void setBoostFactor(float factor)
{ this->boostFactor_ = factor; }
inline float getBoostFactor() const
@@ -118,18 +123,28 @@
inline void setSpeedMultiply(float speedMultiply)
{ this->speedMultiply_=speedMultiply; }
+
+ inline void setEngineTemplate(const std::string& temp)
+ { this->engineTemplate_ = temp; this->loadEngineTemplate(); }
+ inline const std::string& getEngineTemplate() const
+ { return this->engineTemplate_; }
+
protected:
virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const
{ return new std::vector<PickupCarrier*>(); }
virtual PickupCarrier* getCarrierParent(void) const;
+
+ void loadEngineTemplate();
private:
void registerVariables();
void networkcallback_shipID();
- void changedEnableMotionBlur();
+ std::string engineTemplate_;
+
SpaceShip* ship_;
unsigned int shipID_;
+ Vector3 relativePosition_;
float boostFactor_;
float speedFactor_;
@@ -147,10 +162,6 @@
float accelerationBack_;
float accelerationLeftRight_;
float accelerationUpDown_;
-
- Shader* boostBlur_;
- float blurStrength_;
- bool bEnableMotionBlur_;
};
}
Modified: code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -136,6 +136,7 @@
XMLPortParam(OrxonoxOverlay, "rotation", setRotation, getRotation, xmlelement, mode);
XMLPortParam(OrxonoxOverlay, "correctaspect", setAspectCorrection, getAspectCorrection, xmlelement, mode);
XMLPortParam(OrxonoxOverlay, "background", setBackgroundMaterial, getBackgroundMaterial, xmlelement, mode);
+ XMLPortParam(OrxonoxOverlay, "backgroundtex", setBackgroundTexture, getBackgroundTexture, xmlelement, mode);
}
void OrxonoxOverlay::changedName()
@@ -166,6 +167,34 @@
return BLANKSTRING;
}
+ //! Sets the background texture name and creates a new material if necessary
+ void OrxonoxOverlay::setBackgroundTexture(const std::string& texture)
+ {
+ if (this->background_ && this->background_->getMaterial().isNull() && !texture.empty())
+ {
+ // create new material
+ const std::string& materialname = "generated_material" + getUniqueNumberString();
+ Ogre::MaterialPtr material = static_cast<Ogre::MaterialPtr>(Ogre::MaterialManager::getSingleton().create(materialname, "General"));
+ material->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
+ Ogre::TextureUnitState* textureUnitState_ = material->getTechnique(0)->getPass(0)->createTextureUnitState();
+ textureUnitState_->setTextureName(texture);
+ textureUnitState_->setNumMipmaps(0);
+ this->background_->setMaterialName(materialname);
+ }
+ }
+
+ //! Returns the the texture name of the background
+ const std::string& OrxonoxOverlay::getBackgroundTexture() const
+ {
+ if (this->background_)
+ {
+ Ogre::TextureUnitState* tempTx = this->background_->getMaterial()->getTechnique(0)->getPass(0)->getTextureUnitState(0);
+ return tempTx->getTextureName();
+ }
+ else
+ return BLANKSTRING;
+ }
+
//! Called by BaseObject when visibility has changed.
void OrxonoxOverlay::changedVisibility()
{
@@ -405,9 +434,17 @@
}
}
- void OrxonoxOverlay::setBackgroundAlpha(float alpha) {
+ void OrxonoxOverlay::setBackgroundAlpha(float alpha)
+ {
Ogre::MaterialPtr ptr = this->background_->getMaterial();
Ogre::TextureUnitState* tempTx = ptr->getTechnique(0)->getPass(0)->getTextureUnitState(0);
tempTx->setAlphaOperation(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, alpha);
}
+
+ void OrxonoxOverlay::setBackgroundColour(ColourValue colour)
+ {
+ Ogre::MaterialPtr ptr = this->background_->getMaterial();
+ Ogre::TextureUnitState* tempTx = ptr->getTechnique(0)->getPass(0)->getTextureUnitState(0);
+ tempTx->setColourOperationEx(Ogre::LBX_MODULATE, Ogre::LBS_MANUAL, Ogre::LBS_CURRENT, colour);
+ }
}
Modified: code/trunk/src/orxonox/overlays/OrxonoxOverlay.h
===================================================================
--- code/trunk/src/orxonox/overlays/OrxonoxOverlay.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/overlays/OrxonoxOverlay.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -159,8 +159,13 @@
void setBackgroundMaterial(const std::string& material);
const std::string& getBackgroundMaterial() const;
+ void setBackgroundTexture(const std::string& texture);
+ const std::string& getBackgroundTexture() const;
+
void setBackgroundAlpha(float alpha);
+ void setBackgroundColour(ColourValue colour);
+
virtual void changedVisibility();
inline void setOwner(BaseObject* owner)
Modified: code/trunk/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/trunk/src/orxonox/sound/AmbientSound.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/sound/AmbientSound.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -81,14 +81,14 @@
void AmbientSound::setAmbientSource(const std::string& source)
{
this->ambientSource_ = source;
- this->moodChanged(this->getMood());
+ this->moodChanged(MoodManager::getInstance().getMood());
}
void AmbientSound::moodChanged(const std::string& mood)
{
if (GameMode::playsSound())
{
- const std::string& path = "ambient/" + MoodManager::getInstance().getMood() + '/' + this->ambientSource_;
+ const std::string& path = "ambient/" + mood + '/' + this->ambientSource_;
shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
if (fileInfo != NULL)
this->setSource(path);
Modified: code/trunk/src/orxonox/weaponsystem/Munition.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/Munition.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/weaponsystem/Munition.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -252,6 +252,8 @@
bool Munition::canAddMunition(unsigned int amount) const
{
+ // TODO: 'amount' is not used
+
if (!this->bAllowMunitionRefilling_)
return false;
@@ -333,6 +335,8 @@
bool Munition::canAddMagazines(unsigned int amount) const
{
+ // TODO: 'amount' is not used
+
if (this->bStackMunition_)
// If we stack munition, we can always add new magazines because they contribute directly to the munition
return (this->getNumMunition(0) < this->getMaxMunition());
Modified: code/trunk/src/orxonox/weaponsystem/WeaponMode.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -65,6 +65,8 @@
this->reloadTimer_.stopTimer();
this->damage_ = 0;
+ this->healthdamage_ = 0;
+ this->shielddamage_ = 0;
this->muzzleOffset_ = Vector3::ZERO;
this->muzzlePosition_ = Vector3::ZERO;
@@ -105,6 +107,8 @@
XMLPortParam(WeaponMode, "parallelreload", setParallelReload, getParallelReload, xmlelement, mode).description("If true, the weapon reloads in parallel to the magazine reloading");
XMLPortParam(WeaponMode, "damage", setDamage, getDamage, xmlelement, mode);
+ XMLPortParam(WeaponMode, "healthdamage", setHealthDamage, getHealthDamage, xmlelement, mode);
+ XMLPortParam(WeaponMode, "shielddamage", setShieldDamage, getShieldDamage, xmlelement, mode);
XMLPortParam(WeaponMode, "muzzleoffset", setMuzzleOffset, getMuzzleOffset, xmlelement, mode);
}
Modified: code/trunk/src/orxonox/weaponsystem/WeaponMode.h
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponMode.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/weaponsystem/WeaponMode.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -103,10 +103,19 @@
// Fire
inline void setDamage(float damage)
- { this->damage_ = damage; }
+ { this->damage_ = damage;}
inline float getDamage() const
{ return this->damage_; }
+ inline void setHealthDamage(float healthdamage)
+ { this->healthdamage_ = healthdamage; }
+ inline float getHealthDamage() const
+ { return this->healthdamage_; }
+ inline void setShieldDamage(float shielddamage)
+ { this->shielddamage_ = shielddamage;}
+ inline float getShieldDamage() const
+ { return this->shielddamage_; }
+
inline void setMuzzleOffset(const Vector3& offset)
{ this->muzzleOffset_ = offset; }
inline const Vector3& getMuzzleOffset() const
@@ -145,6 +154,8 @@
bool bParallelReload_;
float damage_;
+ float healthdamage_;
+ float shielddamage_;
Vector3 muzzleOffset_;
private:
Modified: code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc
===================================================================
--- code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/weaponsystem/WeaponSlot.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -45,7 +45,7 @@
this->weaponSystem_ = 0;
this->weapon_ = 0;
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
}
WeaponSlot::~WeaponSlot()
Modified: code/trunk/src/orxonox/worldentities/CMakeLists.txt
===================================================================
--- code/trunk/src/orxonox/worldentities/CMakeLists.txt 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/CMakeLists.txt 2011-06-14 18:53:28 UTC (rev 8706)
@@ -11,7 +11,6 @@
CameraPosition.cc
SpawnPoint.cc
TeamSpawnPoint.cc
- SpaceBoundaries.cc
)
ADD_SUBDIRECTORY(pawns)
Modified: code/trunk/src/orxonox/worldentities/CameraPosition.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/CameraPosition.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/CameraPosition.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -45,7 +45,7 @@
this->bAbsolute_ = false;
this->bRenderCamera_ = false;
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
}
CameraPosition::~CameraPosition()
Modified: code/trunk/src/orxonox/worldentities/ControllableEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -83,7 +83,6 @@
this->server_angular_velocity_ = Vector3::ZERO;
this->client_angular_velocity_ = Vector3::ZERO;
-
this->setConfigValues();
this->setPriority( Priority::VeryHigh );
this->registerVariables();
@@ -120,7 +119,7 @@
SUPER(ControllableEntity, XMLPort, xmlelement, mode);
XMLPortParam(ControllableEntity, "hudtemplate", setHudTemplate, getHudTemplate, xmlelement, mode);
- XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTemkplate, xmlelement, mode);
+ XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTemplate, xmlelement, mode);
XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode);
XMLPortObject(ControllableEntity, Controller, "controller", setXMLController, getXMLController, xmlelement, mode);
@@ -172,6 +171,40 @@
return 0;
}
+ unsigned int ControllableEntity::getCurrentCameraIndex() const
+ {
+ if (this->cameraPositions_.size() <= 0)
+ return 0;
+
+ unsigned int counter = 0;
+ for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)
+ {
+ if ((*it) == this->currentCameraPosition_)
+ break;
+ counter++;
+ }
+ if (counter >= this->cameraPositions_.size())
+ return 0;
+
+ return counter;
+ }
+
+ bool ControllableEntity::setCameraPosition(unsigned int index)
+ {
+ if(this->camera_ != NULL && this->cameraPositions_.size() > 0)
+ {
+ if(index >= this->cameraPositions_.size())
+ index = 0;
+
+ CameraPosition* position = this->getCameraPosition(index);
+ position->attachCamera(this->camera_);
+ this->currentCameraPosition_ = position;
+ return true;
+ }
+
+ return false;
+ }
+
void ControllableEntity::switchCamera()
{
if (this->camera_)
@@ -372,6 +405,12 @@
}
}
+ this->createHud();
+ }
+
+ // HACK-ish
+ void ControllableEntity::createHud(void)
+ {
if (!this->hud_ && GameMode::showsGraphics())
{
if (!this->hudtemplate_.empty())
@@ -383,6 +422,15 @@
}
}
+ void ControllableEntity::destroyHud(void)
+ {
+ if (this->hud_ != NULL)
+ {
+ this->hud_->destroy();
+ this->hud_ = NULL;
+ }
+ }
+
void ControllableEntity::stopLocalHumanControl()
{
if (this->camera_)
Modified: code/trunk/src/orxonox/worldentities/ControllableEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/ControllableEntity.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/ControllableEntity.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -92,7 +92,13 @@
virtual void fired(unsigned int firemode) {}
virtual void reload() {}
- virtual void boost() {}
+ /**
+ @brief Tells the ControllableEntity to either start or stop boosting.
+ This doesn't mean, that the ControllableEntity will do so, there might be additional restrictions on boosting, but if it can, then it will.
+ @param bBoost If true the ControllableEntity is told to start boosting, if false it is told to stop.
+ */
+ virtual void boost(bool bBoost) {}
+
virtual void greet() {}
virtual void switchCamera();
virtual void mouseLook();
@@ -109,10 +115,12 @@
CameraPosition* getCameraPosition(unsigned int index) const;
inline const std::list<SmartPtr<CameraPosition> >& getCameraPositions() const
{ return this->cameraPositions_; }
+ unsigned int getCurrentCameraIndex() const;
+ bool setCameraPosition(unsigned int index);
inline void setCameraPositionTemplate(const std::string& name)
{ this->cameraPositionTemplate_ = name; }
- inline const std::string& getCameraPositionTemkplate() const
+ inline const std::string& getCameraPositionTemplate() const
{ return this->cameraPositionTemplate_; }
inline void setReverseCamera(CameraPosition* camera)
@@ -167,6 +175,9 @@
inline void setHudTemplate(const std::string& name)
{ this->hudtemplate_ = name; }
+ // HACK-ish
+ void createHud(void);
+ void destroyHud(void);
Ogre::SceneNode* cameraPositionRootNode_;
Modified: code/trunk/src/orxonox/worldentities/MobileEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/MobileEntity.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/MobileEntity.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -142,11 +142,22 @@
void MobileEntity::setAcceleration(const Vector3& acceleration)
{
if (this->isDynamic())
+ {
this->physicalBody_->applyCentralForce(btVector3(acceleration.x * this->getMass(), acceleration.y * this->getMass(), acceleration.z * this->getMass()));
+ }
+ // If not bullet-managed (deprecated? SpaceShip doesn't use this anymore for movement)
this->linearAcceleration_ = acceleration;
}
+ void MobileEntity::addAcceleration(const Vector3 &acceleration, const Vector3 &relativePosition)
+ {
+ if(this->isDynamic())
+ {
+ this->physicalBody_->applyForce(this->getMass() * btVector3(acceleration.x, acceleration.y, acceleration.z), btVector3(relativePosition.x, relativePosition.y, relativePosition.z));
+ }
+ }
+
void MobileEntity::setAngularAcceleration(const Vector3& acceleration)
{
if (this->isDynamic())
Modified: code/trunk/src/orxonox/worldentities/MobileEntity.h
===================================================================
--- code/trunk/src/orxonox/worldentities/MobileEntity.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/MobileEntity.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -69,6 +69,12 @@
inline const Vector3& getAcceleration() const
{ return this->linearAcceleration_; }
+ // Added for making N engines work with spaceships
+ void addAcceleration(const Vector3& acceleration, const Vector3 &relativePosition);
+ inline void addAcceleration(float x, float y, float z)
+ { this->addAcceleration(Vector3(x, y, z), Vector3(0,0,0)); }
+ // Getter function above
+
void setAngularAcceleration(const Vector3& acceleration);
inline void setAngularAcceleration(float x, float y, float z)
{ this->setAngularAcceleration(Vector3(x, y, z)); }
@@ -82,7 +88,7 @@
inline void setRotationRate(Degree rate)
{ this->setAngularVelocity(this->getAngularVelocity().normalisedCopy() * rate.valueRadians()); }
inline Degree getRotationRate() const
- { return Degree(this->getAngularVelocity().length()); }
+ { return Radian(this->getAngularVelocity().length()); }
inline void setRotationAxis(const Vector3& axis)
{ this->setAngularVelocity(axis * this->getAngularVelocity().length()); }
Deleted: code/trunk/src/orxonox/worldentities/SpaceBoundaries.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/SpaceBoundaries.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/SpaceBoundaries.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,300 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Maurus Kaufmann
- * Co-authors:
- * ...
- *
- */
-
-#include "SpaceBoundaries.h"
-
-#include "worldentities/MobileEntity.h"
-#include "worldentities/ControllableEntity.h"
-#include "core/ObjectListIterator.h"
-#include "core/XMLPort.h"
-#include "worldentities/pawns/Pawn.h"
-#include "infos/PlayerInfo.h"
-#include "interfaces/RadarViewable.h"
-#include "graphics/Billboard.h"
-
-namespace orxonox
-{
- CreateFactory(SpaceBoundaries);
-
- SpaceBoundaries::SpaceBoundaries(BaseObject* creator) : StaticEntity(creator)
- {
- /* Standardwerte, die zum Tragen kommen,
- * falls im XML-File keine Werte spezifiziert wurden. */
- this->setMaxDistance(3000);
- this->setWarnDistance(2000);
- this->setShowDistance(2500);
- this->setHealthDecrease(1);
- this->setReaction(0);
-
- RegisterObject(SpaceBoundaries);
-
- // Show Boundaries on the radar.
- this->centerRadar_ = new RadarViewable(this, this);
- this->centerRadar_->setRadarObjectShape(RadarViewable::Dot);
- this->centerRadar_->setRadarVisibility(false);
- }
- SpaceBoundaries::~SpaceBoundaries()
- {
- if (this->isInitialized())
- {
- delete this->centerRadar_;
-
- this->pawnsIn_.clear();
-
- for( std::vector<billboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)
- {
- if( current->billy != NULL)
- {
- delete current->billy;
- }
- }
- this->billboards_.clear();
- }
- }
-
- void SpaceBoundaries::checkWhoIsIn()
- {
- pawnsIn_.clear();
- for(ObjectListIterator<Pawn> current = ObjectList<Pawn>::begin(); current != ObjectList<Pawn>::end(); ++current)
- {
- Pawn* currentPawn = *current;
- float distance = this->computeDistance(currentPawn);
- if(distance <= this->maxDistance_)
- {
- pawnsIn_.push_back(currentPawn);
- }
- }
- }
-
- void SpaceBoundaries::positionBillboard(const Vector3 position)
- {
- std::vector<billboardAdministration>::iterator current;
- for( current = this->billboards_.begin(); current != this->billboards_.end(); current++)
- {
- if(!current->usedYet)
- {
- break;
- }
- }
- if( current == this->billboards_.end() )
- {
- Billboard *tmp = new Billboard(this);
- this->setBillboardOptions( tmp );
- tmp->setPosition(position);
- billboardAdministration tmp2 = { true, tmp };
- this->billboards_.push_back( tmp2 );
-
- } else {
- current->billy->setPosition(position);
- current->billy->setVisible(true);
- current->usedYet = true;
- }
- }
-
- void SpaceBoundaries::setBillboardOptions(Billboard *billy)
- {
- if(billy != NULL)
- {
- billy->setMaterial("Shield");
- billy->setVisible(true);
- }
- }
-
- void SpaceBoundaries::removeAllBillboards()
- {
- for( std::vector<billboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++ )
- {
- current->usedYet = false;
- current->billy->setVisible(false);
- }
- }
-
- void SpaceBoundaries::setMaxDistance(float r)
- {
- this->maxDistance_ = r;
- }
- float SpaceBoundaries::getMaxDistance()
- {
- return this->maxDistance_;
- }
-
- void SpaceBoundaries::setWarnDistance(float r)
- {
- this->warnDistance_ = r;
- }
- float SpaceBoundaries::getWarnDistance()
- {
- return this->warnDistance_;
- }
-
- void SpaceBoundaries::setShowDistance(float r)
- {
- this->showDistance_ = r;
- }
- float SpaceBoundaries::getShowDistance()
- {
- return this->showDistance_;
- }
-
- void SpaceBoundaries::setHealthDecrease(float amount)
- {
- this->healthDecrease_ = amount/1000;
- }
- float SpaceBoundaries::getHealthDecrease()
- {
- return this->healthDecrease_;
- }
-
- void SpaceBoundaries::setReaction(int mode)
- {
- this->reaction_ = mode;
- }
- int SpaceBoundaries::getReaction()
- {
- return this->reaction_;
- }
-
- void SpaceBoundaries::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(SpaceBoundaries, XMLPort, xmlelement, mode);
-
- XMLPortParam(SpaceBoundaries, "maxDistance", setMaxDistance, getMaxDistance, xmlelement, mode);
- XMLPortParam(SpaceBoundaries, "warnDistance", setWarnDistance, getWarnDistance, xmlelement, mode);
- XMLPortParam(SpaceBoundaries, "healthDecrease", setHealthDecrease, getHealthDecrease, xmlelement, mode);
- XMLPortParam(SpaceBoundaries, "reactionMode", setReaction, getReaction, xmlelement, mode);
- }
-
- void SpaceBoundaries::tick(float dt)
- {
- this->checkWhoIsIn();
- this->removeAllBillboards();
- //COUT(0) << "Groesse der Liste: " << (int) pawnsIn_.size() << std::endl;
-
- float distance;
- bool humanItem;
- for( std::list<WeakPtr<Pawn> >::iterator current = pawnsIn_.begin(); current != pawnsIn_.end(); current++ )
- {
- Pawn* currentPawn = current->get();
- if( currentPawn && currentPawn->getNode() )
- {
- distance = this->computeDistance(currentPawn);
- humanItem = this->isHumanPlayer(currentPawn);
- //COUT(0) << "Distanz:" << distance << std::endl; // message for debugging
- if(distance > this->warnDistance_ && distance < this->maxDistance_) // Zeige Warnung an!
- {
- //COUT(0) << "You are near by the boundaries!" << std::endl; // message for debugging
- if(humanItem)
- {
- //COUT(0) << "humanItem ist true" << std::endl;
- this->displayWarning("Attention! You are near by the boundaries!");
- }
- }
- if( (this->maxDistance_ - distance) < this->showDistance_ )
- {
- this->displayBoundaries(currentPawn); // Zeige Grenze an!
- }
- if(distance > this->maxDistance_ && (this->reaction_ == 1) )
- {
- if( humanItem )
- {
- //COUT(0) << "Health should be decreasing!" << std::endl;
- this->displayWarning("You are out of the area now!");
- }
- currentPawn->removeHealth( (distance - this->maxDistance_) * this->healthDecrease_);
- }
- if( (this->reaction_ == 0) && (distance + 100 > this->maxDistance_)) // Annahme: Ein Pawn kann von einem Tick bis zum nächsten nicht mehr als 100 Distanzeinheiten zurücklegen.
- {
- this->conditionalBounceBack(currentPawn, distance, dt);
- }
- }
- }
- }
-
- float SpaceBoundaries::computeDistance(WorldEntity *item)
- {
- if(item != NULL)
- {
- Vector3 itemPosition = item->getPosition();
- return (itemPosition.distance(this->getPosition()));
- } else {
- return -1;
- }
- }
-
- void SpaceBoundaries::displayWarning(const std::string warnText)
- {
-
- }
-
- void SpaceBoundaries::displayBoundaries(Pawn *item)
- {
-
- Vector3 direction = item->getPosition() - this->getPosition();
- direction.normalise();
-
- Vector3 boundaryPosition = this->getPosition() + direction * this->maxDistance_;
-
- this->positionBillboard(boundaryPosition);
- }
-
- void SpaceBoundaries::conditionalBounceBack(Pawn *item, float currentDistance, float dt)
- {
- Vector3 normal = item->getPosition() - this->getPosition();
- normal.normalise();
- Vector3 velocity = item->getVelocity();
- float normalSpeed = item->getVelocity().dotProduct(normal);
-
- /* Checke, ob das Pawn innerhalb des nächsten Ticks, das erlaubte Gebiet verlassen würde.
- Falls ja: Spicke es zurück. */
- if( currentDistance + normalSpeed * dt > this->maxDistance_ )
- {
- float dampingFactor = 0.5;
- velocity = velocity.reflect(normal);
- Vector3 acceleration = item->getAcceleration();
- acceleration = acceleration.reflect(normal);
-
- item->lookAt( velocity + this->getPosition() );
-
- item->setAcceleration(acceleration * dampingFactor);
- item->setVelocity(velocity * dampingFactor);
- }
- }
-
- bool SpaceBoundaries::isHumanPlayer(Pawn *item)
- {
- if(item != NULL)
- {
- if(item->getPlayer())
- {
- return item->getPlayer()->isHumanPlayer();
- }
- }
- return false;
- }
-
-}
Deleted: code/trunk/src/orxonox/worldentities/SpaceBoundaries.h
===================================================================
--- code/trunk/src/orxonox/worldentities/SpaceBoundaries.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/SpaceBoundaries.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -1,129 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Maurus Kaufmann
- * Co-authors:
- * ...
- *
- */
-
- /* TODO: - Textmessages und Billboards sollen teils nur bei einem humanPlayer angezeigt werden, nicht bei allen (vgl. Netzwerk-Spiel mit mehreren humanPlayers)
- beachte hierzu folgende statische Funktion: 'static unsigned int Host::getPlayerID()'
- (file:///home/kmaurus/orxonox/spaceBoundaries/build/doc/api/html/classorxonox_1_1_host.html#9c1e3b39e3b42e467dfbf42902911ce2)
-
- - Kommentieren (Betrachte als Beispiel/Vorbild 'libraries/core/WeakPtr.h')
-
- - Wiki-SpaceBoundaries-Eintrag aktualisieren
- */
-
-#ifndef _SpaceBoundaries_H__
-#define _SpaceBoundaries_H__
-
-
-#include "core/CoreIncludes.h"
-#include "core/WeakPtr.h"
-#include "tools/interfaces/Tickable.h"
-#include "interfaces/RadarViewable.h"
-#include "worldentities/StaticEntity.h"
-#include "worldentities/WorldEntity.h"
-
-#include <string>
-#include <list>
-#include <map>
-#include <vector>
-
-namespace orxonox
-{
-
-/**
- at brief SpaceBoundaries gives level creators the possibility to bar Pawns from leaving a defined area (until now this area is a ball).
-
- Five attributes can/should be defined in the XML-File:
- - 'warnDistance' : If the distance between the pawn of the human player and 'position' is bigger than 'warnDistance', a message is displayed to
- inform the player that he'll soon be leaving the allowed area.
- - 'maxDistance' : defines the area, where a pawn is allowed to be (radius of a ball).
- - 'showDistance' : If the distance between the pawn and the boundary of the allowed area is smaller than 'showDistance', the boundary is shown.
- - 'healthDecrease' : a measure to define how fast the health of a pawn should decrease after leaving the allowed area (unnecessary if 'reactionMode' == 0).
- Recommended values: 0.1 (slow health decrease) to 5 (very fast health decrease)
- - 'reactionMode' : Integer-Value. Defines what effect appears if a space ship has crossed the boundaries.
- 0: Reflect the space ship (default).
- 1: Decrease Health of the space ship after having left the allowed area.
-*/
-
- class _OrxonoxExport SpaceBoundaries : public StaticEntity, public Tickable
- {
- public:
- SpaceBoundaries(BaseObject* creator);
- ~SpaceBoundaries();
-
- void checkWhoIsIn(); //!< Update the list 'pawnsIn_'.
-
- void positionBillboard(const Vector3 position); //!< Display a Billboard at the position 'position'.
- void setBillboardOptions(Billboard *billy);
- void removeAllBillboards(); //!< Hide all all elements of '*billboard_' and set their attribute 'usedYet' to 0.
-
- void setMaxDistance(float r);
- float getMaxDistance();
-
- void setWarnDistance(float r);
- float getWarnDistance();
-
- void setShowDistance(float r);
- float getShowDistance();
-
- void setHealthDecrease(float amount);
- float getHealthDecrease();
-
- void setReaction(int mode);
- int getReaction();
-
- void XMLPort(Element& xmlelement, XMLPort::Mode mode);
-
- void tick(float dt);
-
- private:
- struct billboardAdministration{ bool usedYet; Billboard* billy; };
-
- std::list<WeakPtr<Pawn> > pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle.
-
- std::vector<billboardAdministration> billboards_;
-
- int reaction_; //!< Werte: 0, 1. 0: Reflektion an Boundaries (Standard). 1: Health-Abzug-Modus.
- float maxDistance_; //!< maximal zulaessige Entfernung von 'this->getPosition()'.
- float warnDistance_; //!< Entfernung von 'this->getPosition()', ab der eine Warnung angezeigt wird, dass man bald das zulaessige Areal verlaesst.
- float showDistance_; //!< Definiert, wann die Grenzen visualisiert werden sollen.
-
- float healthDecrease_; //!< Mass fuer die Anzahl Health-Points, die nach ueberschreiten der Entfernung 'maxDistance_' von 'this->getPosition()' abgezogen werden.
- //!< Empfohlene Werte: 0.1 (langsame Health-Verminderung) bis 5 (sehr schnelle Health-Verminderung)
-
- RadarViewable* centerRadar_; //!< Repraesentation von SpaceBoundaries auf dem Radar.
-
- float computeDistance(WorldEntity *item); //!< Auf den Mittelpunkt 'this->getPosition()' bezogen.
- void displayWarning(const std::string warnText);
- void displayBoundaries(Pawn *item);
- void conditionalBounceBack(Pawn *item, float currentDistance, float dt);
- bool isHumanPlayer(Pawn *item);
-
- };
-}
-
-#endif /* _SpaceBoundaries_H__ */
Modified: code/trunk/src/orxonox/worldentities/SpawnPoint.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/SpawnPoint.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/SpawnPoint.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -49,7 +49,7 @@
else
COUT(1) << "Error: SpawnPoint has no Gametype" << std::endl;
- this->setSyncMode(0x0);
+ this->setSyncMode(ObjectDirection::None);
}
void SpawnPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
Modified: code/trunk/src/orxonox/worldentities/WorldEntity.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/WorldEntity.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/WorldEntity.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -641,15 +641,12 @@
*/
void WorldEntity::setScale3D(const Vector3& scale)
{
-/*
-HACK HACK HACK
- if (bScalePhysics && this->hasPhysics() && scale != Vector3::UNIT_SCALE)
+ // If physics is enabled scale the attached CollisionShape.
+ /*if (this->hasPhysics() && this->collisionShape_ != NULL)
{
- CCOUT(2) << "Warning: Cannot set the scale of a physical object: Not yet implemented. Ignoring scaling." << std::endl;
- return;
- }
-HACK HACK HACK
-*/
+ this->collisionShape_->setScale3D(scale);
+ }*/
+
this->node_->setScale(scale);
this->changedScale();
Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -22,7 +22,7 @@
* Author:
* Fabian 'x3n' Landau
* Co-authors:
- * ...
+ * Simon Miescher
*
*/
@@ -63,9 +63,16 @@
this->health_ = 0;
this->maxHealth_ = 0;
this->initialHealth_ = 0;
+
this->shieldHealth_ = 0;
+ this->initialShieldHealth_ = 0;
+ this->maxShieldHealth_ = 100; //otherwise shield might increase to float_max
this->shieldAbsorption_ = 0.5;
+ this->reloadRate_ = 0;
+ this->reloadWaitTime_ = 1.0f;
+ this->reloadWaitCountdown_ = 0;
+
this->lastHitOriginator_ = 0;
this->spawnparticleduration_ = 3.0f;
@@ -108,6 +115,8 @@
XMLPortParam(Pawn, "initialhealth", setInitialHealth, getInitialHealth, xmlelement, mode).defaultValues(100);
XMLPortParam(Pawn, "shieldhealth", setShieldHealth, getShieldHealth, xmlelement, mode).defaultValues(0);
+ XMLPortParam(Pawn, "initialshieldhealth", setInitialShieldHealth, getInitialShieldHealth, xmlelement, mode).defaultValues(0);
+ XMLPortParam(Pawn, "maxshieldhealth", setMaxShieldHealth, getMaxShieldHealth, xmlelement, mode).defaultValues(100);
XMLPortParam(Pawn, "shieldabsorption", setShieldAbsorption, getShieldAbsorption, xmlelement, mode).defaultValues(0);
XMLPortParam(Pawn, "spawnparticlesource", setSpawnParticleSource, getSpawnParticleSource, xmlelement, mode);
@@ -117,14 +126,18 @@
XMLPortObject(Pawn, WeaponSlot, "weaponslots", addWeaponSlot, getWeaponSlot, xmlelement, mode);
XMLPortObject(Pawn, WeaponSet, "weaponsets", addWeaponSet, getWeaponSet, xmlelement, mode);
XMLPortObject(Pawn, WeaponPack, "weapons", addWeaponPackXML, getWeaponPack, xmlelement, mode);
+
+ XMLPortParam(Pawn, "reloadrate", setReloadRate, getReloadRate, xmlelement, mode).defaultValues(0);
+ XMLPortParam(Pawn, "reloadwaittime", setReloadWaitTime, getReloadWaitTime, xmlelement, mode).defaultValues(1.0f);
}
void Pawn::registerVariables()
{
registerVariable(this->bAlive_, VariableDirection::ToClient);
registerVariable(this->health_, VariableDirection::ToClient);
- registerVariable(this->initialHealth_, VariableDirection::ToClient);
+ registerVariable(this->maxHealth_, VariableDirection::ToClient);
registerVariable(this->shieldHealth_, VariableDirection::ToClient);
+ registerVariable(this->maxShieldHealth_, VariableDirection::ToClient);
registerVariable(this->shieldAbsorption_, VariableDirection::ToClient);
registerVariable(this->bReload_, VariableDirection::ToServer);
registerVariable(this->aimPosition_, VariableDirection::ToServer); // For the moment this variable gets only transfered to the server
@@ -136,12 +149,25 @@
this->bReload_ = false;
+ // TODO: use the existing timer functions instead
+ if(this->reloadWaitCountdown_ > 0)
+ {
+ this->decreaseReloadCountdownTime(dt);
+ }
+ else
+ {
+ this->addShieldHealth(this->getReloadRate() * dt);
+ this->resetReloadCountdown();
+ }
+
if (GameMode::isMaster())
+ {
if (this->health_ <= 0 && bAlive_)
{
- this->fireEvent(); // Event to notify anyone who want's to know about the death.
+ this->fireEvent(); // Event to notify anyone who wants to know about the death.
this->death();
}
+ }
}
void Pawn::preDestroy()
@@ -167,63 +193,91 @@
ControllableEntity::removePlayer();
}
+
void Pawn::setHealth(float health)
{
- this->health_ = std::min(health, this->maxHealth_);
+ this->health_ = std::min(health, this->maxHealth_); //Health can't be set to a value bigger than maxHealth, otherwise it will be reduced at first hit
}
- void Pawn::damage(float damage, Pawn* originator)
+ void Pawn::setShieldHealth(float shieldHealth)
{
+ this->shieldHealth_ = std::min(shieldHealth, this->maxShieldHealth_);
+ }
+
+ void Pawn::setMaxShieldHealth(float maxshieldhealth)
+ {
+ this->maxShieldHealth_ = maxshieldhealth;
+ }
+
+ void Pawn::setReloadRate(float reloadrate)
+ {
+ this->reloadRate_ = reloadrate;
+ }
+
+ void Pawn::setReloadWaitTime(float reloadwaittime)
+ {
+ this->reloadWaitTime_ = reloadwaittime;
+ }
+
+ void Pawn::decreaseReloadCountdownTime(float dt)
+ {
+ this->reloadWaitCountdown_ -= dt;
+ }
+
+ void Pawn::damage(float damage, float healthdamage, float shielddamage, Pawn* originator)
+ {
if (this->getGametype() && this->getGametype()->allowPawnDamage(this, originator))
{
- //share the dealt damage to the shield and the Pawn.
- float shielddamage = damage*this->shieldAbsorption_;
- float healthdamage = damage*(1-this->shieldAbsorption_);
-
- // In case the shield can not take all the shield damage.
- if (shielddamage > this->getShieldHealth())
+ if (shielddamage >= this->getShieldHealth())
{
- healthdamage += shielddamage-this->getShieldHealth();
this->setShieldHealth(0);
+ this->setHealth(this->health_ - (healthdamage + damage));
}
+ else
+ {
+ this->setShieldHealth(this->shieldHealth_ - shielddamage);
- this->setHealth(this->health_ - healthdamage);
+ // remove remaining shieldAbsorpton-Part of damage from shield
+ shielddamage = damage * this->shieldAbsorption_;
+ shielddamage = std::min(this->getShieldHealth(),shielddamage);
+ this->setShieldHealth(this->shieldHealth_ - shielddamage);
- if (this->getShieldHealth() > 0)
- {
- this->setShieldHealth(this->shieldHealth_ - shielddamage);
+ // set remaining damage to health
+ this->setHealth(this->health_ - (damage - shielddamage) - healthdamage);
}
this->lastHitOriginator_ = originator;
-
- // play damage effect
}
}
- void Pawn::hit(Pawn* originator, const Vector3& force, float damage)
+// TODO: Still valid?
+/* HIT-Funktionen
+ Die hit-Funktionen muessen auch in src/orxonox/controllers/Controller.h angepasst werden! (Visuelle Effekte)
+
+*/
+
+ void Pawn::hit(Pawn* originator, const Vector3& force, float damage, float healthdamage, float shielddamage)
{
if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
{
- this->damage(damage, originator);
+ this->damage(damage, healthdamage, shielddamage, originator);
this->setVelocity(this->getVelocity() + force);
-
- // play hit effect
}
}
- void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage)
+
+ void Pawn::hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage, float shielddamage)
{
if (this->getGametype() && this->getGametype()->allowPawnHit(this, originator) && (!this->getController() || !this->getController()->getGodMode()) )
{
- this->damage(damage, originator);
+ this->damage(damage, healthdamage, shielddamage, originator);
if ( this->getController() )
- this->getController()->hit(originator, contactpoint, damage);
-
- // play hit effect
+ this->getController()->hit(originator, contactpoint, damage); // changed to damage, why shielddamage?
}
}
+
void Pawn::kill()
{
this->damage(this->health_);
Modified: code/trunk/src/orxonox/worldentities/pawns/Pawn.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/Pawn.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/pawns/Pawn.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -71,21 +71,61 @@
inline float getInitialHealth() const
{ return this->initialHealth_; }
- inline void setShieldHealth(float shieldHealth)
- { this->shieldHealth_ = shieldHealth; }
+ virtual void setShieldHealth(float shieldHealth);
+
inline float getShieldHealth()
{ return this->shieldHealth_; }
+ inline void addShieldHealth(float amount)
+ { this->setShieldHealth(this->shieldHealth_ + amount); }
+
+ inline bool hasShield()
+ { return (this->getShieldHealth() > 0); }
+
+ virtual void setMaxShieldHealth(float maxshieldhealth);
+ inline float getMaxShieldHealth() const
+ { return this->maxShieldHealth_; }
+
+ inline void setInitialShieldHealth(float initialshieldhealth)
+ { this->initialShieldHealth_ = initialshieldhealth; this->setShieldHealth(initialshieldhealth); }
+ inline float getInitialShieldHealth() const
+ { return this->initialShieldHealth_; }
+
+ inline void restoreInitialShieldHealth()
+ { this->setShieldHealth(this->initialShieldHealth_); }
+ inline void restoreMaxShieldHealth()
+ { this->setShieldHealth(this->maxShieldHealth_); }
+
inline void setShieldAbsorption(float shieldAbsorption)
{ this->shieldAbsorption_ = shieldAbsorption; }
inline float getShieldAbsorption()
{ return this->shieldAbsorption_; }
+ // TODO: Rename to shieldRechargeRate
+ virtual void setReloadRate(float reloadrate);
+ inline float getReloadRate() const
+ { return this->reloadRate_; }
+
+ virtual void setReloadWaitTime(float reloadwaittime);
+ inline float getReloadWaitTime() const
+ { return this->reloadWaitTime_; }
+
+ inline void resetReloadCountdown()
+ { this->reloadWaitCountdown_ = 0; }
+
+ inline void startReloadCountdown()
+ { this->reloadWaitCountdown_ = this->getReloadWaitTime(); } // TODO: Implement in Projectile.cc
+
+ virtual void decreaseReloadCountdownTime(float dt);
+
inline ControllableEntity* getLastHitOriginator() const
{ return this->lastHitOriginator_; }
- virtual void hit(Pawn* originator, const Vector3& force, float damage);
- virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
+ //virtual void hit(Pawn* originator, const Vector3& force, float damage);
+ //virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage);
+ virtual void hit(Pawn* originator, const Vector3& force, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
+ virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage, float healthdamage = 0.0f, float shielddamage = 0.0f);
+
virtual void kill();
virtual void fired(unsigned int firemode);
@@ -141,7 +181,8 @@
virtual void deatheffect();
virtual void spawneffect();
- virtual void damage(float damage, Pawn* originator = 0);
+ //virtual void damage(float damage, Pawn* originator = 0);
+ virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL);
bool bAlive_;
@@ -153,8 +194,14 @@
float health_;
float maxHealth_;
float initialHealth_;
+
float shieldHealth_;
+ float maxShieldHealth_;
+ float initialShieldHealth_;
float shieldAbsorption_; // Has to be between 0 and 1
+ float reloadRate_;
+ float reloadWaitTime_;
+ float reloadWaitCountdown_;
WeakPtr<Pawn> lastHitOriginator_;
Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.cc 2011-06-14 18:53:28 UTC (rev 8706)
@@ -34,14 +34,22 @@
#include "core/ConfigValueIncludes.h"
#include "core/Template.h"
#include "core/XMLPort.h"
+#include "tools/Shader.h"
+#include "util/Debug.h" // TODO: Needed?
+#include "util/Math.h"
+
+#include "graphics/Camera.h"
#include "items/Engine.h"
+#include "CameraManager.h"
+#include "Scene.h"
+
namespace orxonox
{
const float orientationGain = 100;
CreateFactory(SpaceShip);
- SpaceShip::SpaceShip(BaseObject* creator) : Pawn(creator)
+ SpaceShip::SpaceShip(BaseObject* creator) : Pawn(creator), boostBlur_(NULL)
{
RegisterObject(SpaceShip);
@@ -52,9 +60,7 @@
this->localLinearAcceleration_.setValue(0, 0, 0);
this->localAngularAcceleration_.setValue(0, 0, 0);
this->bBoost_ = false;
- this->bPermanentBoost_ = false;
this->steering_ = Vector3::ZERO;
- this->engine_ = 0;
this->boostPower_ = 10.0f;
this->initialBoostPower_ = 10.0f;
@@ -63,6 +69,9 @@
this->boostCooldownDuration_ = 5.0;
this->bBoostCooldown_ = false;
+ this->lift_ = 1.0f; // factor of the lift, standard is 1
+ this->stallSpeed_ = 220.0f; // max speed where lift is added
+
this->bInvertYAxis_ = false;
this->setDestroyWhenPlayerLeft(true);
@@ -73,21 +82,34 @@
// Get notification about collisions
this->enableCollisionCallback();
+ this->engineTicksNotDone = 0;
this->setConfigValues();
this->registerVariables();
+
+ this->cameraOriginalPosition_ = Vector3::UNIT_SCALE;
+ this->cameraOriginalOrientation_ = Quaternion::IDENTITY;
+
+ this->shakeFrequency_ = 15;
+ this->shakeAmplitude_ = 5;
+ this->shakeDt_ = 0;
}
SpaceShip::~SpaceShip()
{
- if (this->isInitialized() && this->engine_)
- this->engine_->destroy();
+ if (this->isInitialized())
+ {
+ this->removeAllEngines();
+
+ if (this->boostBlur_)
+ this->boostBlur_->destroy();
+ }
}
void SpaceShip::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(SpaceShip, XMLPort, xmlelement, mode);
- XMLPortParam(SpaceShip, "engine", setEngineTemplate, getEngineTemplate, xmlelement, mode);
+ //XMLPortParam(SpaceShip, "engine", setEngineTemplate, getEngineTemplate, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "primaryThrust", primaryThrust_, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "auxilaryThrust", auxilaryThrust_, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "rotationThrust", rotationThrust_, xmlelement, mode);
@@ -95,6 +117,12 @@
XMLPortParamVariable(SpaceShip, "boostPowerRate", boostPowerRate_, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "boostRate", boostRate_, xmlelement, mode);
XMLPortParamVariable(SpaceShip, "boostCooldownDuration", boostCooldownDuration_, xmlelement, mode);
+ XMLPortParamVariable(SpaceShip, "shakeFrequency", shakeFrequency_, xmlelement, mode);
+ XMLPortParamVariable(SpaceShip, "shakeAmplitude", shakeAmplitude_, xmlelement, mode);
+ XMLPortParamVariable(SpaceShip, "lift", lift_, xmlelement, mode);
+ XMLPortParamVariable(SpaceShip, "stallSpeed", stallSpeed_, xmlelement, mode);
+
+ XMLPortObject(SpaceShip, Engine, "engines", addEngine, getEngine, xmlelement, mode);
}
void SpaceShip::registerVariables()
@@ -102,11 +130,26 @@
registerVariable(this->primaryThrust_, VariableDirection::ToClient);
registerVariable(this->auxilaryThrust_, VariableDirection::ToClient);
registerVariable(this->rotationThrust_, VariableDirection::ToClient);
+ // TODO: Synchronization of boost needed?
+ registerVariable(this->boostPower_, VariableDirection::ToClient);
+ registerVariable(this->boostPowerRate_, VariableDirection::ToClient);
+ registerVariable(this->boostRate_, VariableDirection::ToClient);
+ registerVariable(this->boostCooldownDuration_, VariableDirection::ToClient);
+ registerVariable(this->shakeFrequency_, VariableDirection::ToClient);
+ registerVariable(this->shakeAmplitude_, VariableDirection::ToClient);
+ registerVariable(this->lift_, VariableDirection::ToClient);
+ registerVariable(this->stallSpeed_, VariableDirection::ToClient);
}
void SpaceShip::setConfigValues()
{
SetConfigValue(bInvertYAxis_, false).description("Set this to true for joystick-like mouse behaviour (mouse up = ship down).");
+
+ SetConfigValueExternal(bEnableMotionBlur_, "GraphicsSettings", "enableMotionBlur", true)
+ .description("Enable or disable the motion blur effect when moving very fast")
+ .callback(this, &SpaceShip::changedEnableMotionBlur);
+ SetConfigValueExternal(blurStrength_, "GraphicsSettings", "blurStrength", 3.0f)
+ .description("Defines the strength of the motion blur effect");
}
bool SpaceShip::isCollisionTypeLegal(WorldEntity::CollisionType type) const
@@ -127,62 +170,72 @@
if (this->hasLocalController())
{
-/*
- this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() * getMass() * this->auxilaryThrust_);
- this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() * getMass() * this->auxilaryThrust_);
- if (this->localLinearAcceleration_.z() > 0)
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->auxilaryThrust_);
- else
- this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() * getMass() * this->primaryThrust_);
- this->physicalBody_->applyCentralForce(physicalBody_->getWorldTransform().getBasis() * this->localLinearAcceleration_);
- this->localLinearAcceleration_.setValue(0, 0, 0);
-*/
+ // Handle mouse look
if (!this->isInMouseLook())
{
this->localAngularAcceleration_ *= this->getLocalInertia() * this->rotationThrust_;
this->physicalBody_->applyTorque(physicalBody_->getWorldTransform().getBasis() * this->localAngularAcceleration_);
}
-
this->localAngularAcceleration_.setValue(0, 0, 0);
+ // Charge boostPower
if(!this->bBoostCooldown_ && this->boostPower_ < this->initialBoostPower_)
{
this->boostPower_ += this->boostPowerRate_*dt;
}
+ // Use boostPower
if(this->bBoost_)
{
this->boostPower_ -=this->boostRate_*dt;
if(this->boostPower_ <= 0.0f)
{
- this->bBoost_ = false;
+ this->boost(false);
this->bBoostCooldown_ = true;
this->timer_.setTimer(this->boostCooldownDuration_, false, createExecutor(createFunctor(&SpaceShip::boostCooledDown, this)));
}
+
+ this->shakeCamera(dt);
}
+
+ // Enable Blur depending on settings
+ if (this->bEnableMotionBlur_ && !this->boostBlur_ && this->hasLocalController() && this->hasHumanController())
+ {
+ this->boostBlur_ = new Shader(this->getScene()->getSceneManager());
+ this->boostBlur_->setCompositorName("Radial Blur");
+ }
+
+ if (this->boostBlur_) // && this->maxSpeedFront_ != 0 && this->boostFactor_ != 1)
+ {
+ // TODO: this->maxSpeedFront_ gets fastest engine
+ float blur = this->blurStrength_ * clamp((-this->getLocalVelocity().z - 0.0f /*this->maxSpeedFront_*/) / ((150.0f /*boostFactor_*/ - 1) * 1.5f /*this->maxSpeedFront_*/), 0.0f, 1.0f);
+
+ // Show and hide blur effect depending on state of booster
+ if(this->bBoost_)
+ this->boostBlur_->setVisible(blur > 0);
+ else
+ this->boostBlur_->setVisible(false);
+
+ this->boostBlur_->setParameter(0, 0, "sampleStrength", blur);
+ }
}
}
- void SpaceShip::boostCooledDown(void)
- {
- this->bBoostCooldown_ = false;
- }
-
void SpaceShip::moveFrontBack(const Vector2& value)
{
this->localLinearAcceleration_.setZ(this->localLinearAcceleration_.z() - value.x);
- this->steering_.z = -value.x;
+ this->steering_.z -= value.x;
}
void SpaceShip::moveRightLeft(const Vector2& value)
{
this->localLinearAcceleration_.setX(this->localLinearAcceleration_.x() + value.x);
- this->steering_.x = value.x;
+ this->steering_.x += value.x;
}
void SpaceShip::moveUpDown(const Vector2& value)
{
this->localLinearAcceleration_.setY(this->localLinearAcceleration_.y() + value.x);
- this->steering_.y = value.x;
+ this->steering_.y += value.x;
}
void SpaceShip::rotateYaw(const Vector2& value)
@@ -190,13 +243,19 @@
this->localAngularAcceleration_.setY(this->localAngularAcceleration_.y() + value.x);
Pawn::rotateYaw(value);
+
+ //This function call adds a lift to the ship when it is rotating to make it's movement more "realistic" and enhance the feeling.
+ if (abs(this-> getLocalVelocity().z) < stallSpeed_) {this->moveRightLeft(-lift_ / 5 * value * sqrt(abs(this-> getLocalVelocity().z)));}
}
void SpaceShip::rotatePitch(const Vector2& value)
{
- this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x);
+ this->localAngularAcceleration_.setX(this->localAngularAcceleration_.x() + value.x*0.8f);
Pawn::rotatePitch(value);
+
+ //This function call adds a lift to the ship when it is pitching to make it's movement more "realistic" and enhance the feeling.
+ if (abs(this-> getLocalVelocity().z) < stallSpeed_) {this->moveUpDown(lift_ / 5 * value * sqrt(abs(this-> getLocalVelocity().z)));}
}
void SpaceShip::rotateRoll(const Vector2& value)
@@ -206,70 +265,181 @@
Pawn::rotateRoll(value);
}
- // TODO: something seems to call this function every tick, could probably handled a little more efficiently!
- void SpaceShip::setBoost(bool bBoost)
+ void SpaceShip::fire()
{
- if(bBoost == this->bBoost_)
- return;
+ }
- if(bBoost)
- this->boost();
- else
+ /**
+ @brief
+ Starts or stops boosting.
+ @param bBoost
+ Whether to start or stop boosting.
+ */
+ void SpaceShip::boost(bool bBoost)
+ {
+ if(bBoost && !this->bBoostCooldown_)
{
+ this->bBoost_ = true;
+ Camera* camera = CameraManager::getInstance().getActiveCamera();
+ this->cameraOriginalPosition_ = camera->getPosition();
+ this->cameraOriginalOrientation_ = camera->getOrientation();
+ }
+ if(!bBoost)
+ {
this->bBoost_ = false;
+ this->resetCamera();
}
}
- void SpaceShip::fire()
+ void SpaceShip::boostCooledDown(void)
{
+ this->bBoostCooldown_ = false;
}
+
+ void SpaceShip::shakeCamera(float dt)
+ {
+ //make sure the ship is only shaking if it's moving
+ if (this->getVelocity().squaredLength() > 80.0f)
+ {
+ this->shakeDt_ += dt;
+
+ float frequency = this->shakeFrequency_ * (this->getVelocity().squaredLength());
+
+ if (this->shakeDt_ >= 1.0f/frequency)
+ {
+ this->shakeDt_ -= 1.0f/frequency;
+ }
+
+ Degree angle = Degree(sin(this->shakeDt_ *2.0f* math::pi * frequency) * this->shakeAmplitude_);
+
+ //COUT(0) << "Angle: " << angle << std::endl;
+ Camera* camera = this->getCamera();
- void SpaceShip::boost()
+ //Shaking Camera effect
+ if (camera != 0)
+ {
+ camera->setOrientation(Vector3::UNIT_X, angle);
+ }
+ }
+ }
+
+ void SpaceShip::resetCamera()
{
- if(!this->bBoostCooldown_)
- this->bBoost_ = true;
+ Camera *camera = this->getCamera();
+
+ if (camera == 0)
+ {
+ COUT(2) << "Failed to reset camera!";
+ return;
+ }
+
+ this->shakeDt_ = 0;
+ camera->setPosition(this->cameraOriginalPosition_);
+ camera->setOrientation(this->cameraOriginalOrientation_);
}
- void SpaceShip::loadEngineTemplate()
+ void SpaceShip::backupCamera()
{
- if (!this->enginetemplate_.empty())
+ Camera* camera = CameraManager::getInstance().getActiveCamera();
+ if(camera != NULL)
{
- Template* temp = Template::getTemplate(this->enginetemplate_);
+ this->cameraOriginalPosition_ = camera->getPosition();
+ this->cameraOriginalOrientation_ = camera->getOrientation();
+ }
+ }
- if (temp)
- {
- Identifier* identifier = temp->getBaseclassIdentifier();
+ void SpaceShip::addEngine(orxonox::Engine* engine)
+ {
+ //COUT(0)<<"Adding an Engine: " << engine << endl;
+ this->engineList_.push_back(engine);
+ engine->addToSpaceShip(this);
+ this->resetEngineTicks();
+ }
- if (identifier)
- {
- BaseObject* object = identifier->fabricate(this);
- this->engine_ = orxonox_cast<Engine*>(object);
+ bool SpaceShip::hasEngine(Engine* engine)
+ {
+ for(unsigned int i=0; i<this->engineList_.size(); i++)
+ {
+ if(this->engineList_[i]==engine)
+ return true;
+ }
+ return false;
+ }
- if (this->engine_)
- {
- this->engine_->addTemplate(temp);
- this->engine_->addToSpaceShip(this);
- }
- else
- {
- object->destroy();
- }
- }
+ Engine* SpaceShip::getEngine(unsigned int i)
+ {
+ if(this->engineList_.size()>=i)
+ return 0;
+ else
+ return this->engineList_[i];
+ }
+
+ void SpaceShip::removeAllEngines()
+ {
+ while(this->engineList_.size())
+ this->engineList_.back()->destroy();
+ }
+
+ void SpaceShip::removeEngine(Engine* engine)
+ {
+ for(std::vector<Engine*>::iterator it=this->engineList_.begin(); it!=this->engineList_.end(); ++it)
+ {
+ if(*it==engine)
+ {
+ this->engineList_.erase(it);
+ return;
}
}
}
- void SpaceShip::setEngine(Engine* engine)
+ void SpaceShip::setSpeedFactor(float factor)
{
- this->engine_ = engine;
- if (engine && engine->getShip() != this)
- engine->addToSpaceShip(this);
+ for(unsigned int i=0; i<this->engineList_.size(); i++)
+ this->engineList_[i]->setSpeedFactor(factor);
}
+ float SpaceShip::getSpeedFactor() // Calculate mean SpeedFactor.
+ {
+ float ret = 0; unsigned int i = 0;
+ for(; i<this->engineList_.size(); i++)
+ ret += this->engineList_[i]->getSpeedFactor();
+ ret /= (float)i;
+ return ret;
+ }
+ float SpaceShip::getMaxSpeedFront()
+ {
+ float ret=0;
+ for(unsigned int i=0; i<this->engineList_.size(); i++)
+ {
+ if(this->engineList_[i]->getMaxSpeedFront() > ret)
+ ret = this->engineList_[i]->getMaxSpeedFront();
+ }
+ return ret;
+ }
+ float SpaceShip::getBoostFactor()
+ {
+ float ret = 0; unsigned int i=0;
+ for(; i<this->engineList_.size(); i++)
+ ret += this->engineList_[i]->getBoostFactor();
+ ret /= (float)i;
+ return ret;
+ }
+
std::vector<PickupCarrier*>* SpaceShip::getCarrierChildren(void) const
{
std::vector<PickupCarrier*>* list = new std::vector<PickupCarrier*>();
- list->push_back(this->engine_);
+ for(unsigned int i=0; i<this->engineList_.size(); i++)
+ list->push_back(this->engineList_[i]);
return list;
}
+
+ void SpaceShip::changedEnableMotionBlur()
+ {
+ if (!this->bEnableMotionBlur_)
+ {
+ this->boostBlur_->destroy();
+ this->boostBlur_ = 0;
+ }
+ }
+
}
Modified: code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h
===================================================================
--- code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h 2011-06-14 18:04:44 UTC (rev 8705)
+++ code/trunk/src/orxonox/worldentities/pawns/SpaceShip.h 2011-06-14 18:53:28 UTC (rev 8706)
@@ -58,30 +58,42 @@
virtual void rotateRoll(const Vector2& value);
virtual void fire();
- virtual void boost();
+ virtual void boost(bool bBoost); // Starts or stops boosting.
- void setEngine(Engine* engine);
- inline Engine* getEngine() const
- { return this->engine_; }
+ void addEngine(Engine* engine);
+ bool hasEngine(Engine* engine);
+ Engine* getEngine(unsigned int i); // This one's for XMLPort
+ inline const std::vector<Engine*>& getEngineList()
+ { return this->engineList_; }
+ void removeEngine(Engine* engine);
+ void removeAllEngines();
+ void setSpeedFactor(float factor);
+ float getSpeedFactor(); // Gets mean speed factor
+ float getMaxSpeedFront(); // gets largest speed forward
+ float getBoostFactor(); // gets mean boost factor
+
inline void setSteeringDirection(const Vector3& direction)
{ this->steering_ = direction; }
inline const Vector3& getSteeringDirection() const
{ return this->steering_; }
+ inline void resetEngineTicks()
+ { this->engineTicksNotDone = this->engineList_.size(); }
+ inline void oneEngineTickDone()
+ { this->engineTicksNotDone--; }
+ inline bool hasEngineTicksRemaining()
+ { return (this->engineTicksNotDone>0); }
- void setBoost(bool bBoost);
inline bool getBoost() const
{ return this->bBoost_; }
- inline void setEngineTemplate(const std::string& temp)
- { this->enginetemplate_ = temp; this->loadEngineTemplate(); }
- inline const std::string& getEngineTemplate() const
- { return this->enginetemplate_; }
+ inline float getBoostPower() const
+ { return this->boostPower_; }
+ inline float getInitialBoostPower() const
+ { return this->initialBoostPower_; }
- inline void setPermanentBoost(bool bPermanent)
- { this->bPermanentBoost_ = bPermanent; }
- inline bool getPermanentBoost() const
- { return this->bPermanentBoost_; }
+ inline bool isBoostCoolingDown() const
+ { return bBoostCooldown_; }
protected:
virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const;
@@ -89,12 +101,13 @@
bool bBoost_;
bool bBoostCooldown_;
- bool bPermanentBoost_;
float boostPower_;
float initialBoostPower_;
float boostRate_;
float boostPowerRate_;
float boostCooldownDuration_;
+ float lift_;
+ float stallSpeed_;
Vector3 steering_;
float primaryThrust_;
float auxilaryThrust_;
@@ -102,17 +115,32 @@
btVector3 localLinearAcceleration_;
btVector3 localAngularAcceleration_;
+ float shakeFrequency_;
+ float shakeAmplitude_;
+
private:
void registerVariables();
virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const;
-
- void loadEngineTemplate();
+ //All things booster
+ void changedEnableMotionBlur();
void boostCooledDown(void);
+
+ void resetCamera();
+ void backupCamera();
+ void shakeCamera(float dt);
- std::string enginetemplate_;
- Engine* engine_;
+ Shader* boostBlur_;
+ float blurStrength_;
+ bool bEnableMotionBlur_;
+
+ std::vector<Engine*> engineList_;
+ int engineTicksNotDone; // Used for knowing when to reset temporary variables.
Timer timer_;
+ Vector3 cameraOriginalPosition_;
+ Quaternion cameraOriginalOrientation_;
+
+ float shakeDt_;
};
}
More information about the Orxonox-commit
mailing list