Changeset 7908 for code/forks
- Timestamp:
- Feb 17, 2011, 5:47:22 AM (14 years ago)
- Location:
- code/forks/sandbox_light
- Files:
-
- 35 added
- 169 deleted
- 35 edited
Legend:
- Unmodified
- Added
- Removed
-
code/forks/sandbox_light/CMakeLists.txt
r7383 r7908 52 52 SET(DEFAULT_LIBRARY_PATH lib) 53 53 SET(DEFAULT_ARCHIVE_PATH lib/static) 54 SET(DEFAULT_MODULE_PATH lib/modules)55 54 SET(DEFAULT_DOC_PATH doc) 56 55 SET(DEFAULT_DATA_PATH data) … … 62 61 SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LIBRARY_PATH}) 63 62 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_ARCHIVE_PATH}) 64 SET(CMAKE_MODULE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_MODULE_PATH})65 63 SET(CMAKE_DOC_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_DOC_PATH}) 66 64 # Data directories are only inputs, no delclaration here 67 65 SET(CMAKE_CONFIG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_CONFIG_PATH}) 68 66 SET(CMAKE_LOG_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${DEFAULT_LOG_PATH}) 69 70 # Set the extension of the dynamic modules71 SET(ORXONOX_MODULE_EXTENSION ".module")72 67 73 68 # Sets where to find the external libraries like OgreMain.dll at runtime -
code/forks/sandbox_light/INSTALL
r7248 r7908 9 9 (for windows there are already precompiled packages on the website) 10 10 11 OGRE 3D Graphics Engine 1.4 - 1.712 CEGUI (Crazy Eddie's GUI System) 0.5 - 0.613 11 Boost libraries 1.35 - 14 ENet (Network library) 1.1 - 1.215 Lua (scripting language) 5.0 - 5.116 Tcl (shell script language) 8.4 - 8.517 OpenAL (audio) (no version requirements specified yet)18 ALUT (audio) (no version requirements specified yet)19 LibOgg (no version requirements specified yet)20 LibVorbis (no version requirements specified yet)21 ZLib (compression) (no version requirements specified yet)22 23 OGRE supports both OpenGL and DirectX9 rendering. You will also need OGRE for the dedicated server!24 12 25 13 Further information about installing and running this application can be found on -
code/forks/sandbox_light/bin/CMakeLists.txt
r7801 r7908 26 26 27 27 # Create run scripts for Windows to manually add the DLL path when executing 28 SET(RUN_SCRIPTS run standalone client1 client2 server dedicated dedicatedClient masterserver)28 SET(RUN_SCRIPTS run) 29 29 IF(WIN32) 30 30 FOREACH(_script ${RUN_SCRIPTS}) -
code/forks/sandbox_light/cmake/InstallConfig.cmake
r7163 r7908 43 43 SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_LIBRARY_PATH}) 44 44 SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_ARCHIVE_PATH}) 45 SET(MODULE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_MODULE_PATH})46 45 SET(DOC_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DOC_PATH}) 47 46 SET(DATA_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${DEFAULT_DATA_PATH}) … … 55 54 SET(LIBRARY_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox) 56 55 SET(ARCHIVE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox/static) 57 SET(MODULE_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib/games/orxonox/modules)58 56 SET(DOC_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox) 59 57 SET(DATA_INSTALL_DIRECTORY ${CMAKE_INSTALL_PREFIX}/share/games/orxonox) -
code/forks/sandbox_light/cmake/LibraryConfig.cmake
r7459 r7908 93 93 # Performs the search and sets the variables # 94 94 95 FIND_PACKAGE(OGRE 1.4 REQUIRED) 96 #FIND_PACKAGE(ENet 1.1 REQUIRED) 97 FIND_PACKAGE(Ogg REQUIRED) 98 FIND_PACKAGE(Vorbis REQUIRED) 99 FIND_PACKAGE(ALUT REQUIRED) 100 FIND_PACKAGE(ZLIB REQUIRED) 101 IF(POCO_REQUIRED) 102 FIND_PACKAGE(POCO REQUIRED) 103 ENDIF() 95 #FIND_PACKAGE(POCO REQUIRED) 104 96 IF(WIN32) 105 97 FIND_PACKAGE(DbgHelp) 106 FIND_PACKAGE(DirectX REQUIRED)107 98 ENDIF() 108 109 ##### CEGUI #####110 # We make use of the CEGUI script module called CEGUILua.111 # However there is a small issue with that: We use Tolua, a C++ binding112 # generator ourselves. And we also have to use our bindings in the same113 # lua state is CEGUILua's. Unfortunately this implies that both lua runtime114 # version are equal or else you get segmentation faults.115 # In order to match the Lua versions we decided to ship CEGUILua in our116 # repository, mainly because there is no way to determine which version of117 # Lua CEGUILua was linked against (you'd have to specify yourself) and secondly118 # because we can then choose the Lua version. Future plans might involve only119 # accepting Lua 5.1.120 121 # Insert all internally supported CEGUILua versions here122 SET(CEGUILUA_INTERNAL_SUPPORT 0.5.0 0.6.0 0.6.1 0.6.2)123 OPTION(CEGUILUA_USE_EXTERNAL_LIBRARY "Force the use of external CEGUILua library" OFF)124 FIND_PACKAGE(CEGUI 0.5 REQUIRED)125 126 ##### Lua #####127 IF(CEGUILUA_USE_EXTERNAL_LIBRARY)128 COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison)129 IF(version_comparison LESS 0)130 SET(LUA_VERSION_REQUEST 5.0)131 ELSE()132 SET(LUA_VERSION_REQUEST 5.1)133 ENDIF()134 ELSE()135 SET(LUA_VERSION_REQUEST 5)136 ENDIF()137 FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED)138 139 ##### OpenAL #####140 FIND_PACKAGE(OpenAL REQUIRED)141 # Also use parent include dir (without AL/) for ALUT142 IF(OPENAL_INCLUDE_DIR MATCHES "/AL$")143 GET_FILENAME_COMPONENT(ALT_OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} PATH)144 ENDIF()145 SET(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR} ${ALT_OPENAL_INCLUDE_DIR})146 # Notfiy user147 FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)148 # Hide variables created by the script149 MARK_AS_ADVANCED(OPENAL_INCLUDE_DIR OPENAL_LIBRARY)150 151 ##### Tcl #####152 # We only require Tcl, so avoid confusing user about other Tcl stuff by153 # applying a little workaround154 SET(Tclsh_FIND_QUIETLY TRUE)155 FIND_PACKAGE(TCL QUIET)156 # Display messages separately157 SET(TCL_FIND_QUIETLY FALSE)158 FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)159 99 160 100 ##### Boost ##### … … 176 116 IF(WIN32) 177 117 OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE) 178 OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)179 #OPTION(LINK_ENET_DYNAMIC "Link ENet dynamically on Windows" TRUE)180 OPTION(LINK_OGRE_DYNAMIC "Link OGRE dynamically on Windows" TRUE)181 OPTION(LINK_TCL_DYNAMIC "Link TCL dynamically on Windows" TRUE)182 OPTION(LINK_ZLIB_DYNAMIC "Link ZLib dynamically on Windows" TRUE)183 COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)184 IF(_version_comparison LESS 0)185 OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)186 ELSE(_version_comparison LESS 0)187 OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)188 ENDIF(_version_comparison LESS 0)189 118 190 119 IF(DEPENDENCY_PACKAGE_ENABLE) 191 MARK_AS_ADVANCED( 192 LINK_BOOST_DYNAMIC LINK_CEGUI_DYNAMIC #LINK_ENET_DYNAMIC 193 LINK_OGRE_DYNAMIC LINK_TCL_DYNAMIC LINK_ZLIB_DYNAMIC 194 LINK_LUA_DYNAMIC 195 ) 120 MARK_AS_ADVANCED(LINK_BOOST_DYNAMIC) 196 121 ENDIF() 197 122 ENDIF(WIN32) 198 199 200 ################# OGRE Plugins ##################201 202 # More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager203 SET(OGRE_PLUGINS_INT Plugin_ParticleFX)204 IF(WIN32)205 # CG program manager is probably DirectX related (not available under unix)206 LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)207 ENDIF(WIN32)208 SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING209 "Specify which OGRE plugins to load. Existance check is performed.")210 211 # Check the plugins and determine the plugin folder212 # You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}213 INCLUDE(CheckOGREPlugins)214 CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})215 -
code/forks/sandbox_light/cmake/LibraryConfigTardis.cmake
r6746 r7908 72 72 LIST(APPEND CMAKE_LIBRARY_PATH "/usr/pack/ogre-1.6.1-sd/i686-debian-linux5.0") 73 73 74 #SET(ENV{CEGUIDIR} "/usr/pack/cegui-0.6.2-sd;/usr/pack/cegui-0.6.2-sd/i686-debian-linux5.0")75 #SET(ENV{ENETDIR} "/usr/pack/enet-1.2-sd;/usr/pack/enet-1.2-sd/i686-debian-linux4.0")76 #SET(ENV{ALUTDIR} "/usr/pack/openal-0.0.8-cl;/usr/pack/openal-0.0.8-cl/i686-debian-linux3.1")77 #SET(ENV{OGGDIR} "/usr/pack/oggvorbis-1.0-ds;/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0")78 #SET(ENV{VORBISDIR} "/usr/pack/oggvorbis-1.0-ds;/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0")79 #SET(ENV{LUA_DIR} "/usr/pack/lua-5.1.4-sd;/usr/pack/lua-5.1.4-sd/i686-debian-linux4.0")80 #SET(ENV{OGRE_HOME} "/usr/pack/ogre-1.4.9-sd;/usr/pack/ogre-1.4.9-sd/i686-debian-linux4.0")81 #SET(ENV{OPENALDIR} "/usr/pack/openal-0.0.8-cl;/usr/pack/openal-0.0.8-cl/i686-debian-linux3.1")82 #SET(TCL_INCLUDE_PATH "/usr/pack/tcltk-8.4.9.linux-mo/include")83 74 ENDIF(TARDIS) -
code/forks/sandbox_light/cmake/PackageConfig.cmake
r7459 r7908 78 78 79 79 # Include paths and other special treatments 80 SET(ENV{ALUTDIR} ${DEP_INCLUDE_DIR}/freealut)81 80 SET(ENV{BOOST_ROOT} ${DEP_INCLUDE_DIR}/boost) 82 SET(ENV{CEGUIDIR} ${DEP_INCLUDE_DIR}/cegui)83 81 SET(ENV{DBGHELP_DIR} ${DEP_INCLUDE_DIR}/dbghelp) 84 SET(ENV{DXSDK_DIR} ${DEP_INCLUDE_DIR}/directx)85 #SET(ENV{ENETDIR} ${DEP_INCLUDE_DIR}/enet)86 SET(ENV{LUA_DIR} ${DEP_INCLUDE_DIR}/lua)87 SET(ENV{OGGDIR} ${DEP_INCLUDE_DIR}/libogg)88 SET(ENV{VORBISDIR} ${DEP_INCLUDE_DIR}/libvorbis)89 SET(ENV{OGRE_HOME} ${DEP_INCLUDE_DIR}/ogre)90 SET(ENV{OGRE_PLUGIN_DIR} ${DEP_BINARY_DIR})91 SET(ENV{OPENALDIR} ${DEP_INCLUDE_DIR}/openal)92 82 SET(ENV{POCODIR} ${DEP_INCLUDE_DIR}/poco) 93 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/tcl/include)94 LIST(APPEND CMAKE_INCLUDE_PATH ${DEP_INCLUDE_DIR}/zlib/include)95 83 96 84 ### INSTALL ### 97 98 # Tcl script library99 INSTALL(100 DIRECTORY ${DEP_LIBRARY_DIR}/tcl/101 DESTINATION lib/tcl102 )103 85 104 86 # On Windows, DLLs have to be in the executable folder, install them -
code/forks/sandbox_light/cmake/PackageConfigMSVC.cmake
r7818 r7908 54 54 # Certain find scripts don't behave as ecpected to we have 55 55 # to specify the libraries ourselves. 56 SET(TCL_LIBRARY ${DEP_LIBRARY_DIR}/tcl85.lib CACHE FILEPATH "") 57 SET(ZLIB_LIBRARY ${DEP_LIBRARY_DIR}/zdll.lib CACHE FILEPATH "") 56 #SET(ZLIB_LIBRARY ${DEP_LIBRARY_DIR}/zdll.lib CACHE FILEPATH "") 58 57 59 58 ENDIF(MSVC) -
code/forks/sandbox_light/cmake/PackageConfigMinGW.cmake
r5781 r7908 47 47 # Certain find scripts don't behave as ecpected to we have 48 48 # to specify the libraries ourselves. 49 SET(TCL_LIBRARY ${DEP_BINARY_DIR}/tcl85.dll CACHE FILEPATH "") 50 SET(ZLIB_LIBRARY ${DEP_BINARY_DIR}/zlib1.dll CACHE FILEPATH "") 49 #SET(ZLIB_LIBRARY ${DEP_BINARY_DIR}/zlib1.dll CACHE FILEPATH "") 51 50 52 51 ENDIF(MINGW) -
code/forks/sandbox_light/cmake/tools/TargetUtilities.cmake
r7818 r7908 34 34 # NO_DLL_INTERFACE: Link statically with MSVC 35 35 # NO_SOURCE_GROUPS: Don't create msvc source groups 36 # MODULE: For dynamic module libraries (libraries only)37 36 # WIN32: Inherited from ADD_EXECUTABLE (executables only) 38 37 # PCH_NO_DEFAULT: Do not make precompiled header files default if … … 46 45 # SOURCE_FILES: Source files for the target 47 46 # DEFINE_SYMBOL: Sets the DEFINE_SYMBOL target property 48 # TOLUA_FILES: Files with tolua interface49 47 # PCH_FILE: Precompiled header file 50 48 # PCH_EXCLUDE: Source files to be excluded from PCH support … … 60 58 INCLUDE(CMakeDependentOption) 61 59 INCLUDE(CapitaliseName) 62 INCLUDE(GenerateToluaBindings)63 60 INCLUDE(ParseMacroArguments) 64 61 INCLUDE(SourceFileUtilities) … … 85 82 NO_INSTALL NO_VERSION ${_additional_switches}) 86 83 SET(_list_names LINK_LIBRARIES VERSION SOURCE_FILES 87 DEFINE_SYMBOL TOLUA_FILESPCH_FILE84 DEFINE_SYMBOL PCH_FILE 88 85 PCH_EXCLUDE OUTPUT_NAME) 89 86 … … 165 162 LIST(REMOVE_DUPLICATES _${_target_name}_files) 166 163 167 # TOLUA_FILES168 IF(_arg_TOLUA_FILES)169 GENERATE_TOLUA_BINDINGS(${_target_name_capitalised} _${_target_name}_files170 INPUTFILES ${_arg_TOLUA_FILES})171 ENDIF()172 173 164 # First part (pre target) of precompiled header files 174 165 IF(PCH_COMPILER_SUPPORT AND _arg_PCH_FILE) … … 258 249 ENDIF() 259 250 260 # Configure modules261 IF (_arg_MODULE)262 SET_TARGET_PROPERTIES(${_target_name} PROPERTIES263 RUNTIME_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Windows264 LIBRARY_OUTPUT_DIRECTORY ${CMAKE_MODULE_OUTPUT_DIRECTORY} # Unix265 )266 ADD_MODULE(${_target_name})267 # Ensure that the main program depends on the module268 SET(ORXONOX_MODULES ${ORXONOX_MODULES} ${_target_name} CACHE STRING "" FORCE)269 ENDIF()270 271 251 # Static library flags are not globally available 272 252 IF(ORXONOX_STATIC_LINKER_FLAGS) … … 306 286 # Install all targets except for static ones (executables also have SHARED in _link_mode) 307 287 IF(${_link_mode} STREQUAL "SHARED" AND NOT _arg_NO_INSTALL) 308 IF(_arg_MODULE) 309 INSTALL(TARGETS ${_target_name} 310 RUNTIME DESTINATION ${MODULE_INSTALL_DIRECTORY} 311 LIBRARY DESTINATION ${MODULE_INSTALL_DIRECTORY} 312 ) 313 ELSE() 314 INSTALL(TARGETS ${_target_name} 315 RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY} 316 LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY} 317 ) 318 ENDIF() 288 INSTALL(TARGETS ${_target_name} 289 RUNTIME DESTINATION ${RUNTIME_INSTALL_DIRECTORY} 290 LIBRARY DESTINATION ${LIBRARY_INSTALL_DIRECTORY} 291 ) 319 292 ENDIF() 320 293 321 294 ENDMACRO(TU_ADD_TARGET) 322 323 324 # Creates a helper file with name <name_of_the_library>${ORXONOX_MODULE_EXTENSION}325 # This helps finding dynamically loadable modules at runtime326 327 FUNCTION(ADD_MODULE _target)328 # We use the properties to get the name because the librarys name may differ from329 # the target name (for example orxonox <-> liborxonox)330 331 GET_TARGET_PROPERTY(_target_loc ${_target} LOCATION)332 GET_FILENAME_COMPONENT(_target_name ${_target_loc} NAME_WE)333 334 IF(CMAKE_CONFIGURATION_TYPES)335 FOREACH(_config ${CMAKE_CONFIGURATION_TYPES})336 SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_config}/${_target_name}${ORXONOX_MODULE_EXTENSION})337 338 FILE(WRITE ${_module_filename})339 340 INSTALL(341 FILES ${_module_filename}342 DESTINATION ${MODULE_INSTALL_DIRECTORY}343 CONFIGURATIONS ${_config}344 )345 ENDFOREACH()346 ELSE()347 SET(_module_filename ${CMAKE_MODULE_OUTPUT_DIRECTORY}/${_target_name}${ORXONOX_MODULE_EXTENSION})348 349 FILE(WRITE ${_module_filename})350 351 INSTALL(352 FILES ${_module_filename}353 DESTINATION ${MODULE_INSTALL_DIRECTORY}354 )355 ENDIF()356 ENDFUNCTION(ADD_MODULE) -
code/forks/sandbox_light/data/CMakeLists.txt
r7163 r7908 29 29 SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 30 30 SET(DATA_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE) 31 32 # Specify data directory33 GET_FILENAME_COMPONENT(_search_path_1 ${CMAKE_SOURCE_DIR}/../data_extern ABSOLUTE)34 FIND_PATH(EXTERNAL_DATA_DIRECTORY resources.oxr35 PATHS36 ${CMAKE_SOURCE_DIR}/data_extern37 ${_search_path_1}38 NO_CMAKE_PATH NO_CMAKE_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH39 )40 41 IF(NOT EXTERNAL_DATA_DIRECTORY)42 MESSAGE(STATUS "Warning: External data directory not found. If you want to compile while downloading the data files, you will have to recompile about four files afterwards and relink everything.")43 MESSAGE(STATUS "You can specify your own folder with the EXTERNAL_DATA_DIRECTORY variable. Default location for the path is orxonox_root/data_extern")44 # Temporary override to the default location.45 SET(EXTERNAL_DATA_DIRECTORY ${CMAKE_SOURCE_DIR}/data_extern)46 ENDIF()47 48 49 ################ Installation #################50 51 # Internal directory52 INSTALL(53 DIRECTORY ${DATA_DIRECTORY}/54 DESTINATION ${DATA_INSTALL_DIRECTORY}55 REGEX "\\.svn$|_svn$|CMakeLists.txt|InstallScript.cmake" EXCLUDE56 )57 # External directory58 INSTALL(59 DIRECTORY ${EXTERNAL_DATA_DIRECTORY}/60 DESTINATION ${DATA_INSTALL_DIRECTORY}61 REGEX "\\.svn$|_svn$|resources\\.oxr|AUTHORS|LICENSE" EXCLUDE62 )63 # Configure the install scripts (variables not available during installation)64 CONFIGURE_FILE(DataInstallScript.cmake ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake @ONLY)65 # Join both resources.oxr files66 INSTALL(SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/DataInstallScript.cmake) -
code/forks/sandbox_light/doc/api/Groups.dox
r7679 r7908 44 44 45 45 /** 46 @defgroup Class Class management47 @ingroup Core48 */49 50 /**51 @defgroup Object Object management52 @ingroup Core53 */54 55 /**56 46 @defgroup Command Command 57 47 @ingroup Core … … 64 54 65 55 /** 66 @defgroup Input Input67 @ingroup Core68 */69 70 /**71 56 @defgroup Management Management 72 57 @ingroup Core 73 58 */ 74 75 /**76 @defgroup XML XML77 @ingroup Core78 */79 80 /**81 @defgroup Network Network82 83 The network library is used to connect clients and server, to synchronize objects and variables, and84 to transmit network function calls. It contains the central @ref orxonox::Server "Server" and85 @ref orxonox::Client "Client" classes as well as several functions and macros for86 @ref orxonox::Synchronisable "synchronisable" classes.87 */88 89 /**90 @defgroup Tools Tools91 92 The tools are a bunch of utilities that belong to the Orxonox library, but are independent of other93 features.94 */95 96 /**97 @defgroup Orxonox Orxonox98 99 The Orxonox library contains the central and most important classes of the game. Managers, interfaces,100 base-classes, and more are located in Orxonox. More specialized classes that inherit of the base-classes101 in Orxonox are often sourced out to the modules.102 */103 104 /**105 @defgroup Modules Modules106 107 The modules are libraries that depend on the Orxonox library and that are loaded dynamically on runtime108 (in contrast to statically loaded libraries like util and core). Each module contains some classes that109 are usually connected to each other, but they are independent of other modules. However modules can still110 link to other modules, but only in a hierarchical order, no circular dependencies.111 */112 113 /**114 @defgroup Designtools Designtools115 @ingroup Modules116 */117 118 /**119 @defgroup Notifications Notifications120 @ingroup Modules121 122 @ref orxonox::Notification "Notifications" are short messages, that can be sent from anywhere in Orxonox and then are displayed on the screen to inform the user about some occurence he has to know about. Such an occurence could be, that he just shot and killed his Archnemesis Overlord3, that he just got a new Pickup or that he received a Quest and needs to have a look at the Quest-Menu.123 124 @section NotificationsUsage Usage125 Let's very briefly talk about what you have to do to either send @ref orxonox::Notification "Notifications" from some part of Orxonox or display Notifications on your screen.126 127 @subsection NotifictionsSending Sending notifications128 Sending a new @ref orxonox::Notification "Notification" from (almost) anywhere in Orxonox is fairly easy.129 You first have to decide on a message, it shouldn't be too long but be long enough to get your point accross.130 Then you have to decide on a sender. The sender is a string by which the different @ref orxonox::NotificationQueue "NotificationQueues" (the entities that display the @ref orxonox::Notification "Notifications") can decide whether they should display the @ref orxonox::Notification "Notification" or not. So the sender is some string that identifies a group of @ref orxonox::Notification "Notifications" that have something in common or some entity that is sending them. For example: All @ref orxonox::Notification "Notifications" sent by any part of the Questsystem have "questsystem" as sender and thus we could create a @ref orxonox::NotificationQueue "NotificationQueue" that only displays @ref orxonox::Notification "Notifications" from the Questsystem, but more to that later.131 And lastly you have to decide to whom you want to send this @ref orxonox::Notification "Notification". You have to get the clientId of the intended recipient (e.g. trough a @ref orxonox::PlayerInfo "PlayerInfo") or you only send the @ref orxonox::Notification "Notification" locally, either by setting the clientId to Host::getPlayerID() or by setting the variable 'isLocal' to true, and setting clientId to what ever you want, since it will be ignored.132 Once you have decided all that you can send the Notification by calling:133 @code134 NotificationManager::sendNotification(message, clientId, sender, isLocal); // isLocal = false can be ommitted since that is the default value.135 @endcode136 137 @subsection NotificationsDisplay Displaying notifications138 Displaying @ref orxonox::Notification "Notifications" is even easier, all you need to do is to load the NotificationLayer in the level, where you want @ref orxonox::Notification "Notifications" displayed. You can either do this manually by executing the following command in the console:139 @code140 showGUI NotificationLayer false true141 @endcode142 Or automatically, by adding a @ref orxonox::Script "Script" to the levelfile that does it for you:143 @code144 <Script code="showGUI NotificationLayer false true" needsGraphics="true" />145 @endcode146 147 If you want to change the way the @ref orxonox::Notification "Notifications" are displayed, you can enter the (at this point rather rudimentary) edit mode and add new @ref orxonox::NotificationQueue "NotificationQueues" or change position and properties of the existing ones, by executing the following command in the console:148 @code149 enterEditMode150 @endcode151 152 @section NotificationsTechincalDetails Technical details153 The Notifications module has three major parts that interact with each other. First there is the @ref orxonox::NotificationQueue "NotificationQueue", this is the entity that (logically, not effectively) displays @ref orxonox::Notification "Notifications" according to some rules, then there is the NotificationLayer, which is the GUI which (actually) displays @ref orxonox::Notification "Notifications" by visualizing the @ref orxonox::NotificationQueue "NotificationQueues" and as a result also the @ref orxonox::Notification "Notifications", that are displayed by the respective @ref orxonox::NotificationQueue "NotificationQueues" and lastly there is the @ref orxonox::NotificationManager "NotificationManager", which connects these two.154 155 @subsection NotificationQueue NotificationQueue156 The @ref orxonox::NotificationQueue "NotificationQueue" is the entity, that (as said earlier) logically displays @ref orxonox::Notification "Notifications". Furthermore a @ref orxonox::NotificationQueue "NotificationQueue" displays only a subset of all the @ref orxonox::Notification "Notifications". The parameters that reduce the range of displayed @ref orxonox::Notification "Notifications" are:157 - @b senders The senders, the set of targets of a @ref orxonox::NotificationQueue "NotificationQueue" is the set of senders a @ref orxonox::NotificationQueue "NotificationQueue" displays @ref orxonox::Notification "Notifications" from. E.g. If one would set the senders to "questsystem" then only @ref orxonox::Notification "Notifications" from the Questsystem would be displayed in that particular queue. If you set senders to "all" then all Notifications will be displayed. Different senders can be concatinated with commas.158 - @b size The size specifies how many @ref orxonox::Notification "Notifications" are displayed at the most, if there are more @ref orxonox::Notification "Notifications" that could be displayed, then only the most recent are displayed.159 - @b displayTime The display time specifies how long a @ref orxonox::Notification "Notification" is displayed at the most.160 161 @subsection NotificationLayer NotificationLayer162 The NotificationLayer is a GUI sheet, that displays all the @ref orxonox::NotificationQueue "NotificationQueues" and their @ref orxonox::Notification "Notifications". In its normal mode of operation it is transparent to input, meaning that it only functions as a means of displaying, however if switched to edit mode the NotificationLayer no longer is transparent to input and allows for the adding, removal and modification of @ref orxonox::NotificationQueue "NotificationQueues". For every @ref orxonox::NotificationQueue "NotificationQueue" there is the equivalent representation in the NotificationLayer. So @ref orxonox::NotificationQueue "NotificationQueues" are not each represented by a GUI sheet, but thely all belong to one and the same GUI sheet, the NotificationLayer.163 164 @subsection NotificationManager NotificationManager165 The @ref orxonox::NotificationManager "NotificationManager" is (hence the name) the managing entity in this setting. It is responsible for the registering and unregistering of @ref orxonox::NotificationListener "NotificationListeners" (which the @ref orxonox::NotificationQueue "NotificationQueue" is) and also informs them about changes related to @ref orxonox::Notification "Notifications". It is also responsible for the creation and destruction of @ref orxonox::NotificationQueue "NotificationQueues" through the NotificationLayer and is also the point of approach for the NotificationLayer to get information it needs to display the queues. Finally the @ref orxonox::NotificationManager "NotificationManager" is responsible for sending (and in the process creating) @ref orxonox::Notification "Notifications" and is a means for the @ref orxonox::NotificationQueue "NotificationQueues" to get the information they need about @ref orxonox::Notification "Notifications".166 167 @subsection Notification Notification168 The @ref orxonox::Notification "Notification" class is more or less a data structure that groups the notification message and the sender, and possibly other future parameters, together to form a comprehensive structure that we call Notification.169 170 Additionally there is another important class of objects belonging to the Notifications module. The @ref orxonox::NotificationDispatcher "NotificationDispatchers".171 172 @subsection NotificationDispatcher NotificationDispatcher173 @ref orxonox::NotificationDispatcher "NotificationDispatchers" are entities that are instantiated in a level file (through XML) and that dispatch (or send) a specific @ref orxonox::Notification "Notification" upon having received a triggering event.174 175 @defgroup NotificationDispatchers Dispatchers176 @ingroup Notifications177 178 @ref orxonox::NotificationDispatcher "NotificationDispatchers" are entities that are instantiated in a level file (through XML) and that dispatch (or send) a specific @ref orxonox::Notification "Notification" upon having received a triggering event.179 180 At this point there are two @ref orxonox::NotificationDispatcher "NotificationDispatchers", the @ref orxonox::SimpleNotification "SimpleNotification", which just displays a specified message, and the @ref orxonox::CommandNotification "CommandNotification" which displays a message with a binding for a specified command in it.181 */182 183 /**184 @defgroup Objects Objects185 @ingroup Modules186 187 @defgroup Collisionshapes Collisionshapes188 @ingroup Objects189 190 @defgroup Eventsystem Eventsystem191 @ingroup Objects192 193 @defgroup Triggers Triggers194 @ingroup Objects195 196 Triggers are objects which react to certain events. They can be combined and used as simple overlay logic in levels.197 198 @defgroup NormalTrigger Trigger199 @ingroup Triggers200 201 @defgroup MultiTrigger MultiTrigger202 @ingroup Triggers203 204 @ref orxonox::MultiTrigger "MultiTriggers" are (as they are @ref orxonox::TriggerBase "Triggers") objects which react to certain events. They offer all the functionality that the common @ref orxonox::Trigger "Triggers" do with one significant difference. The common @ref orxonox::Trigger "Trigger" has just one state, it can either be <em>triggered</em> or <em>not triggered</em>, it doesn't discriminate between who's triggering (or not triggering) it. A @ref orxonox::MultiTrigger "MultiTrigger", on the other hand, has a distinct state (<em>triggered</em> or <em>not triggered</em>) for each entity that is defined as being able to trigger said @ref orxonox::MultiTrigger "MultiTrigger".205 206 This difference becomes significant, when, for example, you want a @ref orxonox::DistanceTrigger "DistanceTrigger" to trigger a @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" to hand out a @ref orxonox::Quest "Quest" to any @ref orxonox::Pawn "Pawn" that enters its range. With a simple @ref orxonox::DistanceTrigger "DistanceTrigger" (as opposed to the more complex @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger") the first @ref orxonox::Pawn "Pawn" to be in range would trigger it an receive the @ref orxonox::Quest "Quest", however if a second @ref orxonox::Pawn "Pawn" would enter the range, while the first @ref orxonox::Pawn "Pawn" still is in the range nothing would happen and even after the first @ref orxonox::Pawn "Pawn" left nothing would happen, since the whole time the @ref orxonox::DistanceTrigger "DistanceTrigger" would just be triggered. In contrast with a @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" the first @ref orxonox::Pawn "Pawn" would enter the range and the @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" would have the state <em>triggered</em> for this exact @ref orxonox::Pawn "Pawn" (but for none else) and thus the @ref orxonox::Pawn "Pawn" would receive the @ref orxonox::Quest "Quest" and when the second @ref orxonox::Pawn "Pawn" enters the range the state of the @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" for that second @ref orxonox::Pawn "Pawn" would change to <em>triggered</em> and it would receive the @ref orxonox::Quest "Quest" as well.207 208 @section WhenToUseMultiTriggers When to use MultiTriggers209 Consequentially you would use @ref orxonox::MultiTrigger "MultiTriggers" (instead of common @ref orxonox::Trigger "Triggers"), when it is important that the trigger has different states for each triggering entity and when that fact is essential in the concept of the object that reacts to the triggering. However you should not just use @ref orxonox::MultiTrigger "MultiTrigger" instead of @ref orxonox::Trigger "Trigger", when in doubt, because @ref orxonox::MultiTrigger "MultiTrigger" produces significantly more overhead than @ref orxonox::Trigger "Trigger" due to the added complexity.210 211 @section HowToUseMultiTriggers How to use MultiTriggers212 ...213 214 @section MultiTriggerTechnicalDetails Technical Details215 A common @ref orxonox::Trigger "Trigger" is an object that can either be <em>active</em> or <em>inactive</em>, with a specified behavior how to switch between the two. A @ref orxonox::MultiTrigger "MultiTrigger" generalizes that behavior for multiple objects triggering the trigger. A @ref orxonox::MultiTrigger "MultiTrigger" can be <em>active</em> or <em>inactive</em> for any object triggering it, with the state for each object being completely independent of the state for all other objects. Each time a switch occurs an @ref orxonox::Event "Event" is fired, with a @ref orxonox::MultiTriggerContainer "MultiTriggerContainer" as the originator, containing a pointer to the @ref orxonox::MultiTrigger "MultiTrigger" that caused the @ref orxonox::Event "Event" and a pointer to the object that caused the trigger to change it's activity. This way the entity that reacts to the @ref orxonox::MultiTrigger "MultiTrigger" triggering receives the information it needs about the entity that triggered the @ref orxonox::MultiTrigger "MultiTrigger".216 217 Also, just as with all triggers, @ref orxonox::MultiTrigger "MultiTriggers" can be nested (event with triggers other than @ref orxonox::MultiTrigger "MultiTriggers").218 @code219 <MultiTrigger switch="true" delay="2">220 <DistanceMultiTrigger position="100,0,0" distance="80" />221 <EventTrigger ... />222 </Trigger>223 @endcode224 225 @ref orxonox::MultiTrigger "MultiTriggers" also allow for additional complexity which can be added through the choice of the parameters (some of which are also present in the common @ref orxonox::Trigger "Trigger") explained (briefly) below.226 But first it is important to understand a small implementational detail. There is a distinction between the @ref orxonox::MultiTrigger "MultiTrigger" being triggered (there is the state <em>triggered</em> for that) and the @ref orxonox::MultiTrigger "MultiTrigger" being active (for that is the state <em>activity</em>). From the outside only the <em>activity</em> is visible (and has above been referred to as <em>triggered</em> for the sake of comprehensibility). The state <em>triggered</em> tells us whether the trigger is actually triggered, but it could pretend (for some reason, some of which we will see shortly) to be <em>triggered</em> to the outside, while it in fact isn't (but it would then be <em>active</em>). The standard behavior is, that the <em>activity</em> changes, when the @ref orxonox::MultiTrigger "MultiTrigger" transits from being triggered to not being triggered or the other way around. So to the inside a @ref orxonox::MultiTrigger "MultiTrigger" being <em>active</em> is synonymous to the @ref orxonox::MultiTrigger "MultiTrigger" being <em>triggered</em> to the outside.227 228 The parameters of the @ref orxonox::MultiTrigger "MultiTrigger" are:229 - @b delay The delay is the time in seconds, that the trigger waits until it reacts (i.e. changes it's state) to the triggering condition being fulfilled. Internally this is handled by a state queue coupled with a counter, for each state that is delayed. The state becomes <em>active</em> when the counter runs out. This allows the @ref orxonox::MultiTrigger "MultiTrigger" to work even if the delay changes at runtime. However if the delay changes it only affects newly arriving states not the ones already in the queue. The default is <code>0</code>.230 - @b switch Switch is a boolean, if <code>true</code> the @ref orxonox::MultiTrigger "MultiTrigger" is in <em>switch-mode</em>, meaning, that the <em>activity</em> changes only when the trigger is triggered, not when it is un-triggered (Just like a light switch does). This means, that in <em>switch-mode</em> the <em>activity</em> only changes, when the trigger changes from not being triggered to being triggered but not the other way around. The default is <code>false</code>.231 - @b stayActive Stay active is also a boolean, if <code>true</code> the @ref orxonox::MultiTrigger "MultiTrigger" stays active after it has been activated as many times as specified by the parameter <em>activations</em>. In essence this means, that after the last time it is activated it cannot be deactivated. The default is <code>false</code>.232 - @b activations Activations is the number of times the @ref orxonox::MultiTrigger "MultiTrigger" can be activated until the trigger can't be triggered anymore. The default is <code>-1</code>, which denotes infinity.233 - @b invert Invert is a boolean, if <code>true</code> the @ref orxonox::MultiTrigger "MultiTrigger" is in <em>invert-mode</em>, meaning, that if the triggering condition is fulfilled the @ref orxonox::MultiTrigger "MultiTrigger" will have the state <em>not triggered</em> and and if the condition is not fulfilled it will have the state <em>triggered</em>. In short it inverts the behavior of the @ref orxonox::MultiTrigger "MultiTrigger". The default is <code>false</code>.234 - @b simultaneousTriggerers The number of simultaneous triggerers limits the number of objects that are allowed to trigger the @ref orxonox::MultiTrigger "MultiTrigger" at the same time. Or more precisely, the number of distinct objects the @ref orxonox::MultiTrigger "MultiTrigger" has positive <em>triggered</em> states for, at each point in time. The default is <code>-1</code>, which denotes infinity.235 - @b mode The mode describes how the @ref orxonox::MultiTrigger "MultiTrigger" acts in relation to all the triggers (its children), that are appended to it. There are 3 modes: <em>and</em>, meaning that the @ref orxonox::MultiTrigger "MultiTrigger" can only be triggered if all the appended triggers are active. <em>or</em>, meaning that the @ref orxonox::MultiTrigger "MultiTrigger" can only be triggered if at least one of the appended triggers is active. And <em>xor</em>, meaning that the @ref orxonox::MultiTrigger "MultiTrigger" can only be triggered if one and only one appended trigger is active. Note, that I wrote 'can only be active', that implies, that there is an additional condition to the <em>activity</em> of the @ref orxonox::MultiTrigger "MultiTrigger" and that is the fulfillment of the triggering condition (the @ref orxonox::MultiTrigger "MultiTrigger" class itself doesn't have one, but all derived classes should). Also bear in mind, that the <em>activity</em> of a @ref orxonox::MultiTrigger "MultiTrigger" is still coupled to the object that triggered it. The default is <em>and</em>.236 - @b broadcast Broadcast is a boolean, if <code>true</code> the @ref orxonox::MultiTrigger "MultiTrigger" is in <em>broadcast-mode</em>, meaning, that all trigger events that are caused by no originator (originator is <code>NULL</code>) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this @ref orxonox::MultiTrigger "MultiTrigger". The default is <code>false</code>.237 - @b target The target describes the kind of objects that are allowed to trigger this @ref orxonox::MultiTrigger "MultiTrigger". The parameter has to be set to the class name of the class that is allowed to trigger the @ref orxonox::MultiTrigger "MultiTrigger". The default is <code>Pawn</code>.238 239 @subsection Sub-typesOfMultiTriggers Sub-types of MultiTriggers240 241 @subsubsection EventMultiTrigger EventMultiTrigger242 An @ref orxonox::EventMultiTrigger "EventMultiTrigger" can either be used to broadcast an @ref orxonox::Event "Event" that does not come from a @ref orxonox::MultiTrigger "MultiTrigger" to all entities that are targets of the @ref orxonox::EventMultiTrigger "EventMultiTrigger" or, more in line with its prototype the @ref orxonox::EventTrigger "EventTrigger", to be triggered for an entity when an @ref orxonox::Event "Event" that was caused by an entity of the same type is captured.243 244 A common usage could look like this:245 @code246 <EventMultiTrigger invert="true" delay="1">247 <events>248 <trigger>249 <MultiTrigger ... />250 <Trigger ... />251 </trigger>252 </events>253 </EventMultiTrigger>254 @endcode255 256 @subsubsection DistanceMultiTrigger DistanceMultiTrigger257 A @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" is the MultiTrigger equivalent of the @ref orxonox::DistanceTrigger "DistanceTrigger" and works just the same way. It triggers (now separately for each object triggering it, since it's a @ref orxonox::MultiTrigger "MultiTrigger") whenever an object that is a target of the @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" is in the specified range.258 259 Two additional parameters can be specified for the @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" are the <em>distance</em>, which defines the maximum distance at which an object still triggers the @ref orxonox:: "DistanceMultiTrigger", and the <em>targetname</em>. Setting the <em>targename</em> puts the @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" in <em>single-target mode</em>. In this mode the @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" can only be triggered by objects that have a @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" with the name specified by <em>targetname</em> directly attached. For the <em>single-target mode</em> to work the target of the @ref orxonox::DistanceMultiTrigger "DistanceMultiTrigger" has to be set to <code>DistanceTriggerBeacon</code>.260 261 A common usage (without @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon") would look like this:262 @code263 <DistanceMultiTrigger position="0,0,0" switch="true" target="Pawn" distance="20" />264 @endcode265 266 With @ref orxonox::DistanceTriggerBeacon "DistanceTriggerBeacon" it would look like this:267 @code268 <DistanceMultiTrigger position="0,0,0" target="DistanceMultiTrigger" targetname="beacon1" distance="30" />269 @endcode270 */271 272 /**273 @defgroup Overlays Overlays274 @ingroup Modules275 */276 277 /**278 @defgroup Pickup Pickup279 @ingroup Modules280 281 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.282 283 @section IncludingPickups Including pickups in a level284 @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.285 To be able to use @ref orxonox::Pickupable "Pickupables" in a level one must understand some basic concepts.286 - @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.287 - The physical (or graphical) dimension of a pickup is called a @ref orxonox::PickupRepresentation "PickupRepresentation".288 - 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".289 - 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.290 - 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.291 292 @subsection UsingPredifinedPickups Using predefined pickups293 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.294 If you want to use pickups you will have to include this file in your level file, somewhere above the Level-tag.295 @code296 <?lua297 include("templates/pickupRepresentationTemplates.oxt")298 ?>299 ...300 <Level>301 ...302 @endcode303 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.304 @code305 <Scene>306 ...307 <?lua308 include("includes/pickups.oxi")309 ?>310 @endcode311 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.312 For example:313 @code314 <PickupSpawner position="-100,0,-100" respawnTime="30" maxSpawnedItems="10">315 <pickup>316 <HealthPickup317 health = 10318 healthType = "limited"319 activationType = "immediate"320 durationType = "once"321 />322 </pickup>323 </PickupSpawner>324 @endcode325 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.326 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:327 @code328 <PickupSpawner position="-100,0,-100" respawnTime="30" maxSpawnedItems="10">329 <pickup>330 <HealthPickup template="smallhealthpickup" />331 </pickup>332 </PickupSpawner>333 @endcode334 335 @subsection UnsingNon-PredefinedPickups Using non-predefined pickups336 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".337 @code338 <PickupSpawner position="-100,0,-100" respawnTime="30" maxSpawnedItems="10">339 <pickup>340 <HealthPickup341 health = 33342 healthType = "limited"343 activationType = "immediate"344 durationType = "once"345 />346 </pickup>347 </PickupSpawner>348 @endcode349 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.350 351 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).352 @code353 <PickupRepresentation354 name = "My new health pickup"355 description = "This is an awesome new health pickup."356 spawnerTemplate = "mediumhealthpickupRepresentation"357 inventoryRepresentation = "MediumHealth"358 >359 <pickup>360 <HealthPickup361 health = 33362 healthType = "limited"363 activationType = "immediate"364 durationType = "once"365 />366 </pickup>367 </PickupRepresentation>368 @endcode369 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.370 371 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.372 @code373 spawnerTemplate = "newhealthpickupRepresentation"374 @endcode375 The <em>spawnerTemplate</em> defines how the @ref orxonox::PickupSpawner "PickupSpawner" is displayed in a level.376 In our example case it could look like this:377 @code378 <Template name=newhealthpickupRepresentation>379 <PickupRepresentation>380 <spawner-representation>381 <StaticEntity>382 <attached>383 -- Here you can put all the objects which define the look of the spawner. --384 </attached>385 </StaticEntity>386 </spawner-representation>387 </PickupRepresentation>388 </Template>389 @endcode390 Please refer to the <code>pickupRepresentationTemplates.oxt</code> for more examples.391 392 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).393 @code394 inventoryRepresentation = "MediumHealth"395 @endcode396 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>.397 398 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.399 400 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".401 A @ref orxonox::PickupCollection "PickupCollection" can be created as follows:402 @code403 <PickupCollection>404 <pickupables>405 -- some pickups you want to have in your collection, e.g. --406 <HealthPickup template=smallhealthpickup />407 <HealthPickup health=50 healthRate=5 durationType=continuous activationType=immediate healthType=limited />408 </pickupables>409 </PickupCollection>410 @endcode411 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.412 413 @section CreatingAPickup Creating a new pickup414 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.415 416 @subsection CreatingAPickupClass Creating the class417 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".418 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.419 420 @subsection ChoosingTheCarriers Coosing the carriers421 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.422 - 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.423 - 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.424 @code425 this->addTarget(ClassIdentifier<MyCarrierClass>::getIdentifier());426 @endcode427 428 @subsection CreatingTheInnerWorkings Creating the inner workings of your pickup429 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.430 - 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.)431 - 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.432 433 Let's have a look at the important methods.434 - <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.435 - <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.436 - <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.437 438 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>.439 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.440 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>.441 442 - <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:443 @code444 void MyPickup::clone(OrxonoxClass*& item)445 {446 if(item == NULL)447 item = new MyPickup(this);448 449 SUPER(MyPickup, clone, item);450 451 MyPickup* pickup = dynamic_cast<MyPickup*>(item);452 // Here you should set all the important parameters (that distinguish the different types of this pickup), e.g.453 pickup->setSomeParameter(this->getSomeParameter());454 // You must also initialize the identifier of the new pickup, this is normally done in a member function called in455 pickup->initializeIdentifier();456 }457 @endcode458 - <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:459 @code460 void Pickup::initializeIdentifier(void)461 {462 // If the get method returns a string.463 std::string val1 = this->getSomeParameter();464 std::string type1 = "someParameter";465 this->pickupIdentifier_->addParameter(type1, val1);466 // If the get method doesn't return a string467 std::stringstream stream;468 stream << this->getSomeOtherParameter();469 std::string type2 = "someOtherParameter";470 std::string val2 = stream.str();471 this->pickupIdentifier_->addParameter(type2, val2);472 }473 @endcode474 475 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".476 - <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.477 @code478 bool MyPickup::createSpawner(void)479 {480 new DroppedPickup(this, this, this->getCarrier());481 return true;482 }483 @endcode484 485 @section PickupTechnicalDetails Technical details486 487 @image html pickupmodule.png488 489 @defgroup PickupItems Items490 @ingroup Pickup491 492 The actual pickups can be found here.493 */494 495 /**496 @defgroup Pong Pong497 @ingroup Modules498 */499 500 /**501 @defgroup Questsystem Questsystem502 @ingroup Modules503 504 The Questsystem is a module that enhances Orxonox with @ref orxonox::Quest "Quests". @ref orxonox::Quest "Quests" are objects that challenge the player that receives such an object to fulfill some specific task (e.g. Rescue a princess, fetch some rare metal alloy, destroy the evil pirates den, ...). Upon having fulfilled that task the player can be rewarded with some kind of reward. Quests can be hierarchically structured, meaning that to fulfill some @ref orxonox::Quest "Quest" you first have to fulfill all (or some, depending on the quest) sub-quests.505 506 @section QuestsystemTechnicalDetails Technical details507 The Questsystem essentially consists of the @ref orxonox::Quest "Quest" entity which is the quest itself (and sub- or helper-entities, such as @ref orxonox::QuestHint "QuestHint" (hints for quests) or @ref orxonox::QuestDescription "QuestDescription" (descriptions for quests and hints, to separate content from function)), the @ref orxonox::QuestEffect "QuestEffect" and @ref orxonox::QuestListener "QuestListener" entities which are the only tools for quests to have any influence on the game world. By enabling quests to have @ref orxonox::QuestEffect "QuestEffects" they are able to (for example) fail or complete other quests, activate hints, give rewards or even add a quest to a player. @ref orxonox::QuestListener "QuestListeners" on the other hand can be used by any object to react to a status change of a quest. The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is the physical entity which finally makes quests available for the player in the game, by being able to invoke a @ref orxonox::QuestEffect "QuestEffect" on a player (under some conditions).508 @image html questsystem.png509 510 @section CreatingQuests Creating Quests511 512 @subsection CreatingTheQuestHierarchy Creating the Quest-Hierarchy513 To start you have to create a Quest-Hierarchy in the XML-Levelfile by hierarchically nesting your quests. There are two types of Quests you can use, the LocalQuest and the GlobalQuest.514 515 @subsubsection LocalQuest LocalQuest516 A @ref orxonox::LocalQuest "LocalQuest" is a @ref orxonox::Quest "Quest" which has different states for each player, that means each @ref orxonox::LocalQuest "LocalQuest" can be obtained and completed (or failed) by each player in parallel. A questId is some string that uniquely identifies the quest, this can either be a name or, to ensure uniqueness, you can use a GUID generator (<a href="http://www.google.com/search?q=guid+generator">google</a> or you can use this <a href="http://www.famkruithof.net/uuid/uuidgen">generator</a>). The advantage of GUID is, that you can be quite sure that your id is unique, the drawback is, that it provides less overview and can be quite confusing when looking at the level file. So make your own choice.517 518 Creating a @ref orxonox::LocalQuest "LocalQuest" in XML goes as follows:519 @code520 <LocalQuest id="questId">521 <QuestDescription title="Title" description="Description." /> //The description of the quest.522 <subquests>523 <Quest id ="questId1" /> //A list of n subquest, be aware, each of the <Quest /> tags must have a description and so on and so forth as well.524 ...525 <Quest id="questIdn" />526 </subquests>527 <hints>528 <QuestHint id="hintId1" /> //A list of n QuestHints, see QuestHint for the full XML representation of those.529 ...530 <QuestHint id="hintIdn" />531 </hints>532 <fail-effects>533 <QuestEffect /> //A list of QuestEffects, invoked when the Quest is failed, see QuestEffect for the full XML representation.534 ...535 <QuestEffect />536 </fail-effects>537 <complete-effects>538 <QuestEffect /> //A list of QuestEffects, invoked when the Quest is completed, see QuestEffect for the full XML representation.539 ...540 <QuestEffect />541 </complete-effects>542 </LocalQuest>543 @endcode544 545 @subsubsection GlobalQuest GlobalQuest546 @ref orxonox::GlobalQuest "GlobalQuests" are different, they can be obtained by every player but the changes made to the @ref orxonox::Quest "Quest" (e.g. completion of the quest) affect all owners of the quest. A short example: There are 3 Players, A, B and C. Player A obtains the quest, a while later player B obtains the quest and completes it. Since it is a @ref orxonox::GlobalQuest "GlobalQuest" it is completed for all players having obtained the Quest which means it is also completed for player A. Player C though, never having obtained the quest, can now never complete it.547 548 Creating a @ref orxonox::GlobalQuest "GlobalQuest" in XML goes as follows:549 @code550 <GlobalQuest id="questId">551 <QuestDescription title="Title" description="Description." /> //The description of the quest.552 <subquests>553 <Quest id ="questId1" /> //A list of n subquest, be aware, each of the <Quest /> tags must have a description and so on and so forth as well.554 ...555 <Quest id="questIdn" />556 </subquests>557 <hints>558 <QuestHint id="hintId1" /> //A list of n QuestHints, see QuestHint for the full XML representation of those.559 ...560 <QuestHint id="hintIdn" />561 </hints>562 <fail-effects>563 <QuestEffect /> //A list of QuestEffects, invoked on all players possessing this quest, when the Quest is failed, see QuestEffect for the full XML representation.564 ...565 <QuestEffect />566 </fail-effects>567 <complete-effects>568 <QuestEffect /> //A list of QuestEffects, invoked on all players possessing this quest, when the Quest is completed, see QuestEffect for the full XML representation.569 ...570 <QuestEffect />571 </complete-effects>572 <reward-effects>573 <QuestEffect /> //A list of QuestEffects, invoked on the player completing this quest. See QuestEffect for the full XML representation.574 ...575 <QuestEffect />576 </reward-effects>577 </GlobalQuest>578 @endcode579 580 As you may see that another difference between a @ref orxonox::GlobalQuest "GlobalQuest" and a @ref orxonox::LocalQuest "LocalQuest" is, that with a @ref orxonox::GlobalQuest "GlobalQuest" having @ref orxonox::AddReward "RewardEffects", the RewardEffects are only executed on the player completing the quest. Additionally @ref orxonox::CompleteQuest "CompleteEffects" are executed on all players having obtained the quest before it was completed, when it is completed., while with a @ref orxonox::LocalQuest "LocalQuest" each player that completes a quest, completes it for himself alone, but also gets the reward, regardless whether another player completed the quest before him.581 582 @subsubsection QuestHint QuestHint583 @ref orxonox::QuestHint "QuestHints" can be used to give a player useful information for @ref orxonox::Quest "Quests" he is working on completing. @ref orxonox::QuestHint "QuestHints" cannot have any side effects, but also have an identifier which follows the same form as in the @ref orxonox::Quest "Quests".584 585 Creating a @ref orxonox::QuestHint "QuestHint" in XML goes as follows:586 @code587 <QuestHint id="hintId">588 <QuestDesctription title="" description="" />589 </QuestHint>590 @endcode591 592 @subsubsection QuestDescription QuestDescription593 Each @ref orxonox::Quest "Quest" (and also each @ref orxonox::QuestHint "QuestHint") must have a @ref orxonox::QuestDescription "QuestDescription" consisting of a title and description, and for @ref orxonox::Quest "Quests" also messages for the event the quest is either failed or completed. Of course these are (as is the title and the description) optional.594 595 Creating a @ref orxonox::QuestDescription "QuestDescription" in XML goes as follows:596 @code597 <QuestDescription title="Title" description="Description Text" failMessage="You fail." completeMessage="You win!" />598 @endcode599 600 @subsection CreatingSideEffects Creating side effects601 @ref orxonox::Quest "Quests" can have side effects, in fact that is mostly what they are about. This means that they can have an influence on the game world. @ref orxonox::Quest "Quests" do that through two distinct devices, @ref orxonox::QuestEffect "QuestEffects" (active) and @ref orxonox::QuestListener "QuestListeners" (passive).602 603 @subsubsection QuestEffect QuestEffect604 A @ref orxonox::QuestEffect "QuestEffect" is the first (and probably most important) device for @ref orxonox::Quest "Quests" to have side effects. There are two entities that can have @ref orxonox::QuestEffect "QuestEffects": @ref orxonox::Quest "Quests" and @ref orxonox::QuestEffectBeacon "QuestEffectBeacons" (which will be explained later on). @ref orxonox::QuestEffect "QuestEffects", for example, can start a @ref orxonox::Quest "Quest" for a player, complete/fail @ref orxonox::Quest "Quests" for a player, add a @ref orxonox::QuestHint "QuestHint" or a @ref orxonox::Rewardable "Reward" to a player, and potentially much, much more.605 606 These @ref orxonox::QuestEffect "QuestEffects" are implemented so far, but feel free to <a href="http://www.orxonox.net/wiki/DamianFrick">contact me</a> if you have suggestions for new @ref orxonox::QuestEffect "QuestEffects" or if you need help implementing a new one yourself.607 608 @paragraph AddQuest AddQuest609 This @ref orxonox::QuestEffect "QuestEffect" adds (respectively starts) a @ref orxonox::Quest "Quest" (identified by the given questId) to the player.610 @code611 <AddQuest questId="id" /> //Where id identifies the Quest that should be added.612 @endcode613 614 @paragraph FailQuest FailQuest615 This @ref orxonox::QuestEffect "QuestEffect" fails a @ref orxonox::Quest "Quest" (identified by the given questId) for the player.616 @code617 <FailQuest questId="id" /> //Where id identifies the Quest that should be added.618 @endcode619 620 @paragraph CompleteQuest CompleteQuest621 This @ref orxonox::QuestEffect "QuestEffect" completes a @ref orxonox::Quest "Quest" (identified by the given questId) for the player.622 @code623 <CompleteQuest questId="id" /> //Where id identifies the Quest that should be added.624 @endcode625 626 @paragraph AddQuestHint AddQuestHint627 This @ref orxonox::QuestEffect "QuestEffect" adds a @ref orxonox::QuestHint "QuestHint" to a @ref orxonox::Quest "Quest" (identified by the given questId) of a player.628 @code629 <AddQuestHint hintId="id" /> //Where id identifies the QuestHint that should be added.630 @endcode631 632 @paragraph AddReward AddReward633 This @ref orxonox::QuestEffect "QuestEffect" adds a @ref orxonox::Rewardable "Rewardable" (@ref orxonox::Rewardable "Rewardable" is an Interface which can be implemented by an object that its creator thinks should be able to be rewarded a player for completing (or failing for that matter) a @ref orxonox::Quest "Quest") to the player. @ref Pickup Pickups for example wold be good @ref orxonox::Rewardable "Rewardables".634 @code635 <AddReward>636 <Rewardable /> //A list of Rewardable objects to be rewarded the player, see the specific Rewardables for their respective XML representations.637 ...638 <Rewardable />639 </AddReward>640 @endcode641 642 @subsubsection QuestListener QuestListener643 The @ref orxonox::QuestListener "QuestListener" is the second device you can use to create side effects. As opposed to @ref orxonox::QuestEffect "QuestEffects" (that are executed (or invoked) either as a result of failing or completing a Quest or by a @ref orxonox::QuestEffectBeacon "QuestEffectBeacon"), @ref orxonox::QuestListener "QuestListeners" are passive, meaning that they relay information regarding status changes of @ref orxonox::Quest "Quests" rather than enforcing status changes. @ref orxonox::QuestListener "QuestListeners" have a certain mode (all, start, complete or fail) and a @ref orxonox::Quest "Quest" which they belong to (resp. to which they react). You then can use @ref orxonox::QuestListener "QuestListeners" to make basically any object aware of when the status of the given @ref orxonox::Quest "Quest" changes (the way you defined through the mode) and take any action you may think of.644 645 Here is an example of the usage of @ref orxonox::QuestListener "QuestListeners" in XML:646 @code647 <BaseObject> // The object that should react to the status change of a Quest.648 <events>649 <function> // Where function is the method of the object that schould be executed. Normally this would be visibility or activity.650 <QuestListener questId="someQuestId" mode="someMode" /> // Where someQuestId is the identifier for the Quest the QuestListener is reacting to, and someMode is the kind of status change the QUestListener reacts to (all, start, complete or fail).651 </function>652 </events>653 </BaseObject>654 @endcode655 656 I hope this example has made the usage of @ref orxonox::QuestListener "QuestListeners" a little clearer. The @ref orxonox::QuestListener "QuestListener" actually reacts exactly as any @ref orxonox::Trigger "Trigger" or @ref orxonox::EventListener "EventListener" would (although the @ref orxonox::QuestListener "QuestListener" is really neighter the one nor the other) which means you can use it in exactly the same way you would use one of the above, it just reacts to a different thing. Namely to the change in a @ref orxonox::Quest "Quests" status.657 658 @subsection PuttingTheQuestsInTheGameWorld Putting the Quests in the game world659 As of now we know how to create @ref orxonox::Quest "Quests" and @ref orxonox::QuestHint "QuestHints", we have a way for quests to add new quests, or even complete/fail other quests. We also have a way of reacting to a status change in a @ref orxonox::Quest "Quest". In short we know how quests can be created, how they can influence other quests and how we can react to changes in quests. But our @ref orxonox::Quest "Quests" have no ties (well, not really at least) to the game world as of yet, meaning, that the game world cannot influence quests. For this we have @ref orxonox::QuestEffectBeacon "QuestEffectBeacons".660 661 @subsubsection QuestEffectBeacon QuestEffectBeacon662 The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is a @ref orxonox::StaticEntity "StaticEntity" and has the ability to (when triggered trough some circumstance) invoke a specified list of @ref orxonox::QuestEffect "QuestEffects" on the player triggering the @ref orxonox::QuestEffectBeacon "QuestEffectBeacon".663 664 Creating a @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" in XML goes as follows:665 @code666 <QuestEffectBeacon times=n> //Where 'n' is either a number >= 0, which means the QuestEffectBeacon can be executed n times. Or n = -1, which means the QuestEffectBeacon can be executed an infinite number of times.667 <effects>668 <QuestEffect /> //A list of QuestEffects, invoked when the QuestEffectBeacon is executed, see QuestEffect for the full XML representation.669 ...670 <QuestEffect />671 </effects>672 <events>673 <execute>674 <EventListener event=eventIdString />675 </execute>676 </events>677 <attached>678 <PlayerTrigger name=eventIdString /> //A PlayerTrigger triggering the execution of the QuestEffectBeacon.679 </attached>680 </QuestEffectBeacon>681 @endcode682 683 The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" can only be executed a defined number of times (where -1 times stands for an infinite number of times) and the @ref orxonox::QuestEffect "QuestEffects" are invoked whenever the method 'execute' is called, which is (indirectly through an @ref orxonox::EventListener "EventListener", because I wanted to attach the @ref orxonox::PlayerTrigger "PlayerTrigger" so that its position is always relative to the @ref orxonox::QuestEffectBeacon "QuestEffectBeacons" position) done by the @ref orxonox::PlayerTrigger "PlayerTrigger".684 685 A @ref orxonox::PlayerTrigger "PlayerTrigger" is a special sort of @ref orxonox::Trigger "Trigger" that knows the player that triggered it and therefore can be asked who that was. This allows the @ref orxonox::QuestEffect "QuestEffects" to be executed on the right player.686 687 @section SampleQuest Sample quest688 To get your head around all of this and see some of the things mentioned here in action you might want to check out the "The Tale of Princess Aeryn"-Quest (Levelfile: princessAeryn.oxw) in the level-folder.689 */690 691 /**692 @defgroup QuestEffects Effects693 @ingroup Questsystem694 695 A @ref orxonox::QuestEffect "QuestEffect" is a device for @ref orxonox::Quest "Quests" to have side effects. There are two entities that can have @ref orxonox::QuestEffect "QuestEffects": @ref orxonox::Quest "Quests" and \ref orxonox::QuestEffectBeacon "QuestEffectBeacons". @ref orxonox::QuestEffect "QuestEffects", for example, can start a @ref orxonox::Quest "Quest" for a player, complete/fail @ref orxonox::Quest "Quests" for a player, add a @ref orxonox::QuestHint "QuestHint" or a @ref orxonox::Rewardable "Reward" to a player, and potentially much, much more.696 */697 698 /**699 @defgroup Weapons Weapons700 @ingroup Modules701 */ -
code/forks/sandbox_light/doc/api/main.dox
r7401 r7908 1 1 /** 2 2 @mainpage 3 4 @image html orxonox.jpg5 3 6 4 This is the documentation of Orxonox. It contains descriptions of our classes and functions and -
code/forks/sandbox_light/src/CMakeLists.txt
r7819 r7908 38 38 # If no defines are specified, these libs get linked statically 39 39 ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC) 40 #ADD_COMPILER_FLAGS("-DENET_DLL" WIN32 LINK_ENET_DYNAMIC)41 ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL" WIN32 LINK_LUA_DYNAMIC)42 ADD_COMPILER_FLAGS("-DZLIB_DLL" WIN32 LINK_ZLIB_DYNAMIC)43 40 # If no defines are specified, these libs get linked dynamically 44 ADD_COMPILER_FLAGS("-DCEGUI_STATIC" WIN32 NOT LINK_CEGUI_DYNAMIC) 45 ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB" WIN32 NOT LINK_OGRE_DYNAMIC) 46 ADD_COMPILER_FLAGS("-DSTATIC_BUILD" WIN32 NOT LINK_TCL_DYNAMIC) 41 #ADD_COMPILER_FLAGS("-DSTATIC_BUILD" WIN32 NOT LINK_TCL_DYNAMIC) 47 42 48 43 ######### Library Behaviour (external) ########## 49 50 # Use TinyXML++51 ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")52 44 53 45 # Default linking for externals is SHARED … … 59 51 SET(_external_shared_link FALSE) 60 52 ENDIF() 61 # If no defines are specified, these libs get linked dynamically62 ADD_COMPILER_FLAGS("-DCEGUILUA_STATIC" WIN32 NOT _external_shared_link)63 ADD_COMPILER_FLAGS("-DENET_DLL" WIN32 _external_shared_link)64 ADD_COMPILER_FLAGS("-DOGRE_GUIRENDERER_STATIC_LIB" WIN32 NOT _external_shared_link)65 ADD_COMPILER_FLAGS("-DOIS_STATIC_LIB" WIN32 NOT _external_shared_link)66 ADD_COMPILER_FLAGS("-DTOLUA_STATIC_BUILD" WIN32 NOT _external_shared_link)67 53 68 54 ############## Include Directories ############## … … 71 57 INCLUDE_DIRECTORIES( 72 58 # External 73 ${OGRE_INCLUDE_DIR}74 ${CEGUI_INCLUDE_DIR}75 #${ENET_INCLUDE_DIR}76 59 ${Boost_INCLUDE_DIRS} 77 60 ${POCO_INCLUDE_DIR} 78 ${OPENAL_INCLUDE_DIRS}79 ${ALUT_INCLUDE_DIR}80 ${VORBIS_INCLUDE_DIR}81 ${OGG_INCLUDE_DIR}82 ${LUA_INCLUDE_DIR}83 ${TCL_INCLUDE_PATH}84 ${DIRECTX_INCLUDE_DIR}85 ${ZLIB_INCLUDE_DIR}86 61 87 62 # All includes in "externals" should be prefixed with the path … … 89 64 ${CMAKE_CURRENT_SOURCE_DIR}/external 90 65 # Include directories needed even if only included by Orxonox 91 ${CMAKE_CURRENT_SOURCE_DIR}/external/bullet 92 ${CMAKE_CURRENT_SOURCE_DIR}/external/ois 66 #${CMAKE_CURRENT_SOURCE_DIR}/external/ois 93 67 94 68 # OrxonoxConfig.h … … 96 70 ) 97 71 98 IF(CEGUILUA_USE_INTERNAL_LIBRARY)99 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/external/ceguilua/ceguilua-${CEGUI_VERSION})100 ENDIF()101 102 72 IF (DBGHELP_FOUND) 103 73 INCLUDE_DIRECTORIES(${DBGHELP_INCLUDE_DIR}) 104 74 ENDIF() 105 106 ################### Tolua Bind ##################107 108 # Create directory because the tolua application doesn't work otherwise109 IF(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})110 FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})111 ENDIF()112 113 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/toluabind/${CMAKE_CFG_INTDIR})114 75 115 76 ################ Sub Directories ################ … … 118 79 ADD_SUBDIRECTORY(libraries) 119 80 ADD_SUBDIRECTORY(orxonox) 120 ADD_SUBDIRECTORY(modules)121 81 122 82 ################## Executable ################### … … 141 101 OUTPUT_NAME orxonox 142 102 ) 143 # Main executable should depend on all modules144 ADD_DEPENDENCIES(orxonox-main ${ORXONOX_MODULES})145 103 146 104 # Get name to configure the run scripts -
code/forks/sandbox_light/src/SpecialConfig.h.in
r7818 r7908 42 42 #include "OrxonoxConfig.h" 43 43 44 #cmakedefine CEGUILUA_USE_INTERNAL_LIBRARY ///< Set whether we must suffix "ceguilua/" for the CEGUILua.h include45 46 44 #cmakedefine DEPENDENCY_PACKAGE_ENABLE ///< Defined if a precompiled depdency package was used. We then copy all libraries too when installing. 47 45 … … 61 59 const char defaultLibraryPath[] = "@DEFAULT_LIBRARY_PATH@"; 62 60 const char defaultArchivePath[] = "@DEFAULT_ARCHIVE_PATH@"; 63 const char defaultModulePath[] = "@DEFAULT_MODULE_PATH@";64 61 const char defaultDocPath[] = "@DEFAULT_DOC_PATH@"; 65 62 const char defaultDataPath[] = "@DEFAULT_DATA_PATH@"; … … 70 67 // INSTALLATION PATHS 71 68 const char dataInstallDirectory[] = "@DATA_INSTALL_DIRECTORY@"; 72 const char moduleInstallDirectory[] = "@MODULE_INSTALL_DIRECTORY@";73 69 #endif 74 70 75 71 // DEVELOPMENT RUN PATHS 76 72 const char dataDevDirectory[] = "@DATA_DIRECTORY@"; 77 const char externalDataDevDirectory[] = "@EXTERNAL_DATA_DIRECTORY@";78 73 #ifdef CMAKE_CONFIGURATION_TYPES 79 const char moduleDevDirectory[] = "@CMAKE_MODULE_OUTPUT_DIRECTORY@/" CMAKE_INTDIR;80 74 const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@/" CMAKE_INTDIR; 81 75 const char logDevDirectory[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@/" CMAKE_INTDIR; 82 76 #else 83 const char moduleDevDirectory[] = "@CMAKE_MODULE_OUTPUT_DIRECTORY@";84 77 const char configDevDirectory[] = "@CMAKE_CONFIG_OUTPUT_DIRECTORY@"; 85 78 const char logDevDirectory[] = "@CMAKE_LOG_OUTPUT_DIRECTORY@"; … … 90 83 #endif 91 84 92 // Module extension93 const char moduleExtension[] = "@ORXONOX_MODULE_EXTENSION@";94 95 // OGRE PLUGINS96 #ifdef NDEBUG97 const char ogrePlugins[] = "@OGRE_PLUGINS_RELEASE@";98 # ifdef DEPENDENCY_PACKAGE_ENABLE99 const char ogrePluginsDirectory[] = ".";100 # else101 const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_RELEASE@";102 # endif103 #else104 const char ogrePlugins[] = "@OGRE_PLUGINS_DEBUG@";105 # ifdef DEPENDENCY_PACKAGE_ENABLE106 const char ogrePluginsDirectory[] = ".";107 # else108 const char ogrePluginsDirectory[] = "@OGRE_PLUGINS_FOLDER_DEBUG@";109 # endif110 #endif111 85 } } 112 86 -
code/forks/sandbox_light/src/external/CMakeLists.txt
r7459 r7908 20 20 ################ Sub Directories ################ 21 21 22 ADD_SUBDIRECTORY(tolua)23 24 # Include CEGUILua if not requested otherwise25 IF(CEGUILUA_USE_INTERNAL_LIBRARY)26 IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})27 MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")28 ENDIF()29 30 ADD_SUBDIRECTORY(ceguilua)31 SET(CEGUILUA_LIBRARY ${CEGUILUA_LIBRARY} PARENT_SCOPE)32 ENDIF()33 34 ADD_SUBDIRECTORY(bullet)35 ADD_SUBDIRECTORY(cpptcl)36 ADD_SUBDIRECTORY(enet)37 22 ADD_SUBDIRECTORY(loki) 38 ADD_SUBDIRECTORY(ogreceguirenderer) 39 ADD_SUBDIRECTORY(ois) 40 ADD_SUBDIRECTORY(tinyxml) 23 ADD_SUBDIRECTORY(ogremath) -
code/forks/sandbox_light/src/libraries/CMakeLists.txt
r7401 r7908 24 24 ADD_SUBDIRECTORY(util) 25 25 ADD_SUBDIRECTORY(core) 26 ADD_SUBDIRECTORY(network)27 ADD_SUBDIRECTORY(tools) -
code/forks/sandbox_light/src/libraries/core/CMakeLists.txt
r7284 r7908 20 20 SET_SOURCE_FILES(CORE_SRC_FILES 21 21 CommandLineParser.cc 22 ConfigValueContainer.cc23 22 Core.cc 24 DynLib.cc25 DynLibManager.cc26 Event.cc27 Game.cc28 GameMode.cc29 GameState.cc30 GraphicsManager.cc31 GUIManager.cc32 Language.cc33 LuaState.cc34 ObjectListBase.cc35 OrxonoxClass.cc36 Resource.cc37 WindowEventListener.cc38 39 # hierarchy40 Identifier.cc41 MetaObjectList.cc42 43 # level44 BaseObject.cc45 ClassTreeMask.cc46 Loader.cc47 Namespace.cc48 NamespaceNode.cc49 Template.cc50 XMLPort.cc51 XMLNameListener.cc52 53 COMPILATION_BEGIN FilesystemCompilation.cc54 command/ArgumentCompletionFunctions.cc55 ConfigFileManager.cc56 MemoryArchive.cc57 23 PathConfig.cc 58 COMPILATION_END59 60 # multithreading61 ThreadPool.cc62 COMPILATION_BEGIN ThreadCompilation.cc63 command/TclThreadManager.cc64 Thread.cc65 COMPILATION_END66 24 ) 67 68 ADD_SUBDIRECTORY(command)69 ADD_SUBDIRECTORY(input)70 25 71 26 ORXONOX_ADD_LIBRARY(core 72 27 FIND_HEADER_FILES 73 TOLUA_FILES74 command/CommandExecutor.h75 ConfigFileManager.h76 Game.h77 GameMode.h78 GUIManager.h79 Loader.h80 LuaState.h81 PathConfig.h82 input/InputManager.h83 input/KeyBinder.h84 input/KeyBinderManager.h85 PCH_FILE86 CorePrecompiledHeaders.h87 28 LINK_LIBRARIES 88 ${OGRE_LIBRARY}89 29 ${Boost_FILESYSTEM_LIBRARY} 90 30 ${Boost_SYSTEM_LIBRARY} # Filesystem dependency 91 ${Boost_THREAD_LIBRARY}92 ${Boost_DATE_TIME_LIBRARY} # Thread dependency93 ${CEGUI_LIBRARY}94 ${CEGUILUA_LIBRARY}95 ${LUA_LIBRARIES}96 cpptcl_orxonox97 ogreceguirenderer_orxonox98 ois_orxonox99 tinyxml_orxonox100 tolua_orxonox101 31 util 102 32 SOURCE_FILES -
code/forks/sandbox_light/src/libraries/core/Core.cc
r7872 r7908 51 51 #endif 52 52 53 #include "util/Clock.h"54 53 #include "util/Debug.h" 55 #include "util/Exception.h"56 #include "util/Scope.h"57 #include "util/ScopedSingletonManager.h"58 54 #include "util/SignalHandler.h" 59 55 #include "PathConfig.h" 60 56 #include "CommandLineParser.h" 61 #include "ConfigFileManager.h"62 #include "ConfigValueIncludes.h"63 #include "CoreIncludes.h"64 #include "DynLibManager.h"65 #include "GameMode.h"66 #include "GraphicsManager.h"67 #include "GUIManager.h"68 #include "Identifier.h"69 #include "Language.h"70 #include "LuaState.h"71 #include "command/ConsoleCommand.h"72 #include "command/IOConsole.h"73 #include "command/TclBind.h"74 #include "command/TclThreadManager.h"75 #include "input/InputManager.h"76 57 77 58 namespace orxonox … … 80 61 Core* Core::singletonPtr_s = 0; 81 62 82 SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file");83 SetCommandLineSwitch(noIOConsole).information("Use this if you don't want to use the IOConsole (for instance for Lua debugging)");84 85 63 #ifdef ORXONOX_PLATFORM_WINDOWS 86 64 SetCommandLineArgument(limitToCPU, 1).information("Limits the program to one CPU/core (1, 2, 3, etc.). Default is the first core (faster than off)"); … … 88 66 89 67 Core::Core(const std::string& cmdLine) 90 // Cleanup guard for identifier destruction (incl. XMLPort, configValues, consoleCommands)91 : identifierDestroyer_(Identifier::destroyAllIdentifiers)92 // Cleanup guard for external console commands that don't belong to an Identifier93 , consoleCommandDestroyer_(ConsoleCommand::destroyAll)94 , bGraphicsLoaded_(false)95 , bStartIOConsole_(true)96 , lastLevelTimestamp_(0)97 , ogreConfigTimestamp_(0)98 68 { 99 69 // Set the hard coded fixed paths 100 70 this->pathConfig_.reset(new PathConfig()); 101 102 // Create a new dynamic library manager103 this->dynLibManager_.reset(new DynLibManager());104 105 // Load modules106 const std::vector<std::string>& modulePaths = this->pathConfig_->getModulePaths();107 for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it)108 {109 try110 {111 this->dynLibManager_->load(*it);112 }113 catch (...)114 {115 COUT(1) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << std::endl;116 }117 }118 71 119 72 // Parse command line arguments AFTER the modules have been loaded (static code!) … … 143 96 #endif 144 97 145 // Manage ini files and set the default settings file (usually orxonox.ini)146 this->configFileManager_.reset(new ConfigFileManager());147 this->configFileManager_->setFilename(ConfigFileType::Settings,148 CommandLineParser::getValue("settingsFile").getString());149 150 // Required as well for the config values151 this->languageInstance_.reset(new Language());152 153 // Do this soon after the ConfigFileManager has been created to open up the154 // possibility to configure everything below here155 ClassIdentifier<Core>::getIdentifier("Core")->initialiseObject(this, "Core", true);156 this->setConfigValues();157 158 // create persistent io console159 if (CommandLineParser::getValue("noIOConsole").getBool())160 {161 ModifyConfigValue(bStartIOConsole_, tset, false);162 }163 if (this->bStartIOConsole_)164 this->ioConsole_.reset(new IOConsole());165 166 // creates the class hierarchy for all classes with factories167 Identifier::createClassHierarchy();168 169 // Load OGRE excluding the renderer and the render window170 this->graphicsManager_.reset(new GraphicsManager(false));171 172 // initialise Tcl173 this->tclBind_.reset(new TclBind(PathConfig::getDataPathString()));174 this->tclThreadManager_.reset(new TclThreadManager(tclBind_->getTclInterpreter()));175 176 // Create singletons that always exist (in other libraries)177 this->rootScope_.reset(new Scope<ScopeID::Root>());178 179 98 // Generate documentation instead of normal run? 180 99 std::string docFilename; … … 199 118 Core::~Core() 200 119 { 201 // Remove us from the object lists again to avoid problems when destroying them202 this->unregisterObject();203 }204 205 //! Function to collect the SetConfigValue-macro calls.206 void Core::setConfigValues()207 {208 #ifdef ORXONOX_RELEASE209 const unsigned int defaultLevelLogFile = 3;210 #else211 const unsigned int defaultLevelLogFile = 4;212 #endif213 SetConfigValueExternal(softDebugLevelLogFile_, "OutputHandler", "softDebugLevelLogFile", defaultLevelLogFile)214 .description("The maximum level of debug output shown in the log file");215 OutputHandler::getInstance().setSoftDebugLevel(OutputHandler::logFileOutputListenerName_s, this->softDebugLevelLogFile_);216 217 SetConfigValue(language_, Language::getInstance().defaultLanguage_)218 .description("The language of the in game text")219 .callback(this, &Core::languageChanged);220 SetConfigValue(bInitRandomNumberGenerator_, true)221 .description("If true, all random actions are different each time you start the game")222 .callback(this, &Core::initRandomNumberGenerator);223 SetConfigValue(bStartIOConsole_, true)224 .description("Set to false if you don't want to use the IOConsole (for Lua debugging for instance)");225 SetConfigValue(lastLevelTimestamp_, 0)226 .description("Timestamp when the last level was started.");227 SetConfigValue(ogreConfigTimestamp_, 0)228 .description("Timestamp when the ogre config file was changed.");229 }230 231 //! Callback function if the language has changed.232 void Core::languageChanged()233 {234 // Read the translation file after the language was configured235 Language::getInstance().readTranslatedLanguageFile();236 120 } 237 121 … … 245 129 bInitialized = true; 246 130 } 247 }248 249 void Core::loadGraphics()250 {251 // Any exception should trigger this, even in upgradeToGraphics (see its remarks)252 Loki::ScopeGuard unloader = Loki::MakeObjGuard(*this, &Core::unloadGraphics);253 254 // Upgrade OGRE to receive a render window255 try256 {257 graphicsManager_->upgradeToGraphics();258 }259 catch (const InitialisationFailedException&)260 {261 // Exit the application if the Ogre config dialog was canceled262 COUT(1) << Exception::handleMessage() << std::endl;263 exit(EXIT_FAILURE);264 }265 catch (...)266 {267 // Recovery from this is very difficult. It requires to completely268 // destroy Ogre related objects and load again (without graphics).269 // However since Ogre 1.7 there seems to be a problem when Ogre270 // throws an exception and the graphics engine then gets destroyed271 // and reloaded between throw and catch (access violation in MSVC).272 // That's why we abort completely and only display the exception.273 COUT(1) << "An exception occurred during upgrade to graphics. "274 << "That is unrecoverable. The message was:" << endl275 << Exception::handleMessage() << endl;276 abort();277 }278 279 // Calls the InputManager which sets up the input devices.280 inputManager_.reset(new InputManager());281 282 // Load the CEGUI interface283 guiManager_.reset(new GUIManager(inputManager_->getMousePosition()));284 285 bGraphicsLoaded_ = true;286 GameMode::bShowsGraphics_s = true;287 288 // Load some sort of a debug overlay (only denoted by its name, "debug.oxo")289 graphicsManager_->loadDebugOverlay();290 291 // Create singletons associated with graphics (in other libraries)292 graphicsScope_.reset(new Scope<ScopeID::Graphics>());293 294 unloader.Dismiss();295 }296 297 void Core::unloadGraphics()298 {299 this->graphicsScope_.reset();300 this->guiManager_.reset();301 this->inputManager_.reset();302 this->graphicsManager_.reset();303 304 // Load Ogre::Root again, but without the render system305 try306 { this->graphicsManager_.reset(new GraphicsManager(false)); }307 catch (...)308 {309 COUT(0) << "An exception occurred during 'unloadGraphics':" << Exception::handleMessage() << std::endl310 << "Another exception might be being handled which may lead to undefined behaviour!" << std::endl311 << "Terminating the program." << std::endl;312 abort();313 }314 315 bGraphicsLoaded_ = false;316 GameMode::bShowsGraphics_s = false;317 }318 319 //! Sets the language in the config-file back to the default.320 void Core::resetLanguage()321 {322 ResetConfigValue(language_);323 131 } 324 132 … … 368 176 #endif 369 177 } 370 371 void Core::preUpdate(const Clock& time)372 {373 // Update singletons before general ticking374 ScopedSingletonManager::preUpdate<ScopeID::Root>(time);375 if (this->bGraphicsLoaded_)376 {377 // Process input events378 this->inputManager_->preUpdate(time);379 // Update GUI380 this->guiManager_->preUpdate(time);381 // Update singletons before general ticking382 ScopedSingletonManager::preUpdate<ScopeID::Graphics>(time);383 }384 // Process console events and status line385 if (this->ioConsole_ != NULL)386 this->ioConsole_->preUpdate(time);387 // Process thread commands388 this->tclThreadManager_->preUpdate(time);389 }390 391 void Core::postUpdate(const Clock& time)392 {393 // Update singletons just before rendering394 ScopedSingletonManager::postUpdate<ScopeID::Root>(time);395 if (this->bGraphicsLoaded_)396 {397 // Update singletons just before rendering398 ScopedSingletonManager::postUpdate<ScopeID::Graphics>(time);399 // Render (doesn't throw)400 this->graphicsManager_->postUpdate(time);401 }402 }403 404 void Core::updateLastLevelTimestamp()405 {406 ModifyConfigValue(lastLevelTimestamp_, set, static_cast<long long>(time(NULL)));407 }408 409 void Core::updateOgreConfigTimestamp()410 {411 ModifyConfigValue(ogreConfigTimestamp_, set, static_cast<long long>(time(NULL)));412 }413 178 } -
code/forks/sandbox_light/src/libraries/core/Core.h
r7870 r7908 46 46 #include <string> 47 47 #include <boost/scoped_ptr.hpp> 48 #include <loki/ScopeGuard.h>49 48 50 49 #include "util/Singleton.h" 51 #include "OrxonoxClass.h"52 50 53 51 namespace orxonox … … 59 57 You should only create this singleton once because it destroys the identifiers! 60 58 */ 61 class _CoreExport Core : public Singleton<Core> , public OrxonoxClass59 class _CoreExport Core : public Singleton<Core> 62 60 { 63 typedef Loki::ScopeGuardImpl0<void (*)()> SimpleScopeGuard;64 61 friend class Singleton<Core>; 65 friend class Game;66 62 67 63 public: … … 76 72 ~Core(); 77 73 78 void setConfigValues();79 80 //! Returns the configured language.81 const std::string& getLanguage()82 { return this->language_; }83 void resetLanguage();84 85 void updateLastLevelTimestamp();86 inline long long getLastLevelTimestamp() const87 { return this->lastLevelTimestamp_; }88 89 void updateOgreConfigTimestamp();90 inline long long getOgreConfigTimestamp() const91 { return this->ogreConfigTimestamp_; }92 93 74 private: 94 75 Core(const Core&); //!< Don't use (undefined symbol) 95 76 96 void languageChanged();97 77 void initRandomNumberGenerator(); 98 78 99 void preUpdate(const Clock& time); 100 void postUpdate(const Clock& time); 79 void setThreadAffinity(int limitToCPU); 101 80 102 void loadGraphics();103 void unloadGraphics();104 105 void setThreadAffinity(int limitToCPU);106 81 // MANAGED SINGLETONS/OBJECTS 107 82 // Mind the order for the destruction! 108 83 scoped_ptr<PathConfig> pathConfig_; 109 scoped_ptr<DynLibManager> dynLibManager_;110 84 scoped_ptr<SignalHandler> signalHandler_; 111 SimpleScopeGuard identifierDestroyer_;112 SimpleScopeGuard consoleCommandDestroyer_;113 scoped_ptr<ConfigFileManager> configFileManager_;114 scoped_ptr<Language> languageInstance_;115 scoped_ptr<IOConsole> ioConsole_;116 scoped_ptr<TclBind> tclBind_;117 scoped_ptr<TclThreadManager> tclThreadManager_;118 scoped_ptr<Scope<ScopeID::Root> > rootScope_;119 // graphical120 scoped_ptr<GraphicsManager> graphicsManager_; //!< Interface to OGRE121 scoped_ptr<InputManager> inputManager_; //!< Interface to OIS122 scoped_ptr<GUIManager> guiManager_; //!< Interface to GUI123 scoped_ptr<Scope<ScopeID::Graphics> > graphicsScope_;124 85 125 bool bGraphicsLoaded_;126 86 int softDebugLevelLogFile_; //!< The debug level for the log file (belongs to OutputHandler) 127 std::string language_; //!< The language128 87 bool bInitRandomNumberGenerator_; //!< If true, srand(time(0)) is called 129 bool bStartIOConsole_; //!< Set to false if you don't want to use the IOConsole130 long long lastLevelTimestamp_; ///< Timestamp when the last level was started131 long long ogreConfigTimestamp_; ///< Timestamp wehen the ogre config level was modified132 88 133 89 static Core* singletonPtr_s; -
code/forks/sandbox_light/src/libraries/core/CorePrereqs.h
r7849 r7908 65 65 namespace orxonox 66 66 { 67 static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1);68 67 } 69 68 … … 74 73 namespace orxonox 75 74 { 76 namespace XMLPort77 {78 enum Mode79 {80 NOP,81 LoadObject,82 SaveObject,83 ExpandObject84 };85 }86 87 namespace ConfigFileType88 {89 enum Value90 {91 Settings,92 JoyStickCalibration,93 CommandHistory94 // Don't forget to adjust the array size in the ConfigFileManager when adding a new entry here!95 };96 }97 98 namespace KeybindMode99 {100 enum Value101 {102 OnPress,103 OnHold,104 OnRelease,105 None106 };107 };108 75 } 109 76 … … 114 81 namespace orxonox 115 82 { 116 typedef std::string LanguageEntryLabel;117 118 template <class T, class U>119 T orxonox_cast(U*);120 121 class BaseObject;122 template <class T>123 class ClassFactory;124 template <class T>125 class ClassIdentifier;126 class ClassTreeMask;127 class ClassTreeMaskIterator;128 class ClassTreeMaskNode;129 class ClassTreeMaskObjectIterator;130 83 class CommandLineParser; 131 84 class CommandLineArgument; 132 class ConfigFile;133 class ConfigFileEntry;134 class ConfigFileEntryComment;135 class ConfigFileEntryValue;136 class ConfigFileManager;137 class ConfigFileSection;138 class ConfigValueContainer;139 85 class Core; 140 class DestructionListener;141 class DynLib;142 class DynLibManager;143 struct Event;144 class EventState;145 class Factory;146 class Game;147 class GameState;148 struct GameStateInfo;149 struct GameStateTreeNode;150 class GraphicsManager;151 class GUIManager;152 class Identifier;153 template <class T>154 class Iterator;155 class Language;156 class LuaFunctor;157 class LuaState;158 class MemoryArchive;159 class MemoryArchiveFactory;160 class MetaObjectList;161 class MetaObjectListElement;162 class Namespace;163 class NamespaceNode;164 template <class T>165 class ObjectList;166 class ObjectListBase;167 class ObjectListBaseElement;168 template <class T>169 class ObjectListElement;170 template <class T>171 class ObjectListIterator;172 class OgreWindowEventListener;173 class OrxonoxClass;174 86 class PathConfig; 175 struct ResourceInfo;176 class SettingsConfigFile;177 template <class T>178 class SmartPtr;179 template <class T>180 class SubclassIdentifier;181 class Template;182 class Thread;183 class ThreadPool;184 template <class T>185 class WeakPtr;186 class WindowEventListener;187 class XMLFile;188 class XMLNameListener;189 template <class T, class O>190 class XMLPortClassObjectContainer;191 template <class T>192 class XMLPortClassParamContainer;193 class XMLPortObjectContainer;194 class XMLPortParamContainer;195 196 // Command197 class ArgumentCompleter;198 class ArgumentCompletionListElement;199 class CommandEvaluation;200 class ConsoleCommand;201 class Executor;202 template <class T>203 class ExecutorMember;204 class ExecutorStatic;205 class Functor;206 template <class O>207 class FunctorMember;208 typedef FunctorMember<void> FunctorStatic;209 template <class F, class O>210 class FunctorPointer;211 class IOConsole;212 class IRC;213 class Shell;214 class ShellListener;215 class TclBind;216 struct TclInterpreterBundle;217 template <class T>218 class TclThreadList;219 class TclThreadManager;220 221 // Input222 class BaseCommand;223 class BufferedParamCommand;224 class Button;225 class HalfAxis;226 class InputBuffer;227 class InputDevice;228 template <class Traits>229 class InputDeviceTemplated;230 class InputHandler;231 class InputManager;232 class InputState;233 struct InputStatePriority;234 class JoyStickQuantityListener;235 class JoyStick;236 class KeyBinder;237 class KeyBinderManager;238 class Keyboard;239 class KeyDetector;240 class KeyEvent;241 class Mouse;242 class ParamCommand;243 class SimpleCommand;244 }245 246 #include "command/FunctorPtr.h"247 #include "command/ExecutorPtr.h"248 249 // CppTcl250 namespace Tcl251 {252 class interpreter;253 class object;254 87 } 255 88 … … 278 111 } 279 112 #endif 280 class thread;281 class mutex;282 class shared_mutex;283 class condition_variable;284 }285 286 // Ogre287 namespace Ogre288 {289 class DataStream;290 template <class T> class SharedPtr;291 typedef SharedPtr<DataStream> DataStreamPtr;292 }293 namespace orxonox294 {295 // Import the Ogre::DataStream296 using Ogre::DataStream;297 using Ogre::DataStreamPtr;298 }299 300 // CEGUI301 namespace CEGUI302 {303 class DefaultLogger;304 class Logger;305 class LuaScriptModule;306 307 class OgreCEGUIRenderer;308 class OgreCEGUIResourceProvider;309 class OgreCEGUITexture;310 }311 312 // Lua313 struct lua_State;314 315 // TinyXML and TinyXML++316 class TiXmlString;317 class TiXmlOutStream;318 class TiXmlNode;319 class TiXmlHandle;320 class TiXmlDocument;321 class TiXmlElement;322 class TiXmlComment;323 class TiXmlUnknown;324 class TiXmlAttribute;325 class TiXmlText;326 class TiXmlDeclaration;327 class TiXmlParsingData;328 namespace ticpp329 {330 class Document;331 class Element;332 class Declaration;333 class StylesheetReference;334 class Text;335 class Comment;336 class Attribute;337 }338 namespace orxonox339 {340 using ticpp::Element;341 113 } 342 114 -
code/forks/sandbox_light/src/libraries/core/PathConfig.cc
r6417 r7908 76 76 : rootPath_(*(new bf::path())) 77 77 , executablePath_(*(new bf::path())) 78 , modulePath_(*(new bf::path()))79 78 , dataPath_(*(new bf::path())) 80 , externalDataPath_(*(new bf::path()))81 79 , configPath_(*(new bf::path())) 82 80 , logPath_(*(new bf::path())) … … 138 136 COUT(1) << "Running from the build tree." << std::endl; 139 137 PathConfig::bDevRun_ = true; 140 modulePath_ = specialConfig::moduleDevDirectory;141 138 } 142 139 else … … 153 150 ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?"); 154 151 155 // Module path is fixed as well156 modulePath_ = rootPath_ / specialConfig::defaultModulePath;157 158 152 #else 159 153 160 154 // There is no root path, so don't set it at all 161 // Module path is fixed as well162 modulePath_ = specialConfig::moduleInstallDirectory;163 155 164 156 #endif … … 170 162 delete &rootPath_; 171 163 delete &executablePath_; 172 delete &modulePath_;173 164 delete &dataPath_; 174 delete &externalDataPath_;175 165 delete &configPath_; 176 166 delete &logPath_; … … 184 174 configPath_ = specialConfig::configDevDirectory; 185 175 logPath_ = specialConfig::logDevDirectory; 186 187 // Check for data path override by the command line188 if (!CommandLineParser::getArgument("externalDataPath")->hasDefaultValue())189 externalDataPath_ = CommandLineParser::getValue("externalDataPath").getString();190 else191 externalDataPath_ = specialConfig::externalDataDevDirectory;192 176 } 193 177 else … … 251 235 } 252 236 253 std::vector<std::string> PathConfig::getModulePaths()254 {255 std::vector<std::string> modulePaths;256 257 // We search for helper files with the following extension258 const std::string& moduleextension = specialConfig::moduleExtension;259 size_t moduleextensionlength = moduleextension.size();260 261 // Add that path to the PATH variable in case a module depends on another one262 std::string pathVariable(getenv("PATH"));263 putenv(const_cast<char*>(("PATH=" + pathVariable + ';' + modulePath_.string()).c_str()));264 265 // Make sure the path exists, otherwise don't load modules266 if (!boost::filesystem::exists(modulePath_))267 return modulePaths;268 269 boost::filesystem::directory_iterator file(modulePath_);270 boost::filesystem::directory_iterator end;271 272 // Iterate through all files273 while (file != end)274 {275 const std::string& filename = file->BOOST_LEAF_FUNCTION();276 277 // Check if the file ends with the exension in question278 if (filename.size() > moduleextensionlength)279 {280 if (filename.substr(filename.size() - moduleextensionlength) == moduleextension)281 {282 // We've found a helper file283 const std::string& library = filename.substr(0, filename.size() - moduleextensionlength);284 modulePaths.push_back((modulePath_ / library).file_string());285 }286 }287 ++file;288 }289 290 return modulePaths;291 }292 293 237 /*static*/ std::string PathConfig::getRootPathString() 294 238 { … … 306 250 } 307 251 308 /*static*/ std::string PathConfig::getExternalDataPathString()309 {310 return getInstance().externalDataPath_.string() + '/';311 }312 313 252 /*static*/ std::string PathConfig::getConfigPathString() 314 253 { … … 320 259 return getInstance().logPath_.string() + '/'; 321 260 } 322 323 /*static*/ std::string PathConfig::getModulePathString()324 {325 return getInstance().modulePath_.string() + '/';326 }327 261 } -
code/forks/sandbox_light/src/libraries/core/PathConfig.h
r7427 r7908 85 85 static const boost::filesystem::path& getDataPath() 86 86 { return getInstance().dataPath_; } 87 //! Returns the path to the external data files as boost::filesystem::path88 static const boost::filesystem::path& getExternalDataPath()89 { return getInstance().externalDataPath_; }90 87 //! Returns the path to the config files as boost::filesystem::path 91 88 static const boost::filesystem::path& getConfigPath() … … 94 91 static const boost::filesystem::path& getLogPath() 95 92 { return getInstance().logPath_; } 96 //! Returns the path to the modules as boost::filesystem::path97 static const boost::filesystem::path& getModulePath()98 { return getInstance().modulePath_; }99 93 100 94 //! Returns the path to the root folder as std::string … … 104 98 //! Returns the path to the data files as std::string 105 99 static std::string getDataPathString(); 106 //! Returns the path to the external data files as std::string107 static std::string getExternalDataPathString();108 100 //! Returns the path to the config files as std::string 109 101 static std::string getConfigPathString(); //tolua_export 110 102 //! Returns the path to the log files as std::string 111 103 static std::string getLogPathString(); 112 //! Returns the path to the modules as std::string113 static std::string getModulePathString();114 104 115 105 //! Return trrue for runs in the build directory (not installed) … … 126 116 */ 127 117 void setConfigurablePaths(); 128 //! Returns a list with all modules declared by a *.module file in the module folder.129 std::vector<std::string> getModulePaths();130 118 131 119 //! Path to the parent directory of the ones above if program was installed with relativ paths 132 120 boost::filesystem::path& rootPath_; 133 121 boost::filesystem::path& executablePath_; //!< Path to the executable 134 boost::filesystem::path& modulePath_; //!< Path to the modules135 122 boost::filesystem::path& dataPath_; //!< Path to the data files folder 136 boost::filesystem::path& externalDataPath_; //!< Path to the external data files folder137 123 boost::filesystem::path& configPath_; //!< Path to the config files folder 138 124 boost::filesystem::path& logPath_; //!< Path to the log files folder -
code/forks/sandbox_light/src/libraries/util/CMakeLists.txt
r7449 r7908 21 21 Clock.cc 22 22 Exception.cc 23 ExprParser.cc24 23 Math.cc 25 24 MultiType.cc 26 Scope.cc27 25 StringUtils.cc 28 26 COMPILATION_BEGIN StableCompilation.cc 29 Clipboard.cc30 27 Convert.cc 31 28 CRC32.cc 32 29 OutputHandler.cc 33 ScopedSingletonManager.cc34 30 SharedPtr.cc 35 31 SignalHandler.cc … … 54 50 FIND_HEADER_FILES 55 51 LINK_LIBRARIES 56 ${CEGUI_LIBRARY} 57 ${OGRE_LIBRARY} 52 ogremath_orxonox 58 53 SOURCE_FILES 59 54 ${UTIL_SRC_FILES} -
code/forks/sandbox_light/src/libraries/util/Clock.cc
r7401 r7908 28 28 29 29 #include "Clock.h" 30 #include < OgreTimer.h>30 #include <ogremath/OgreTimer.h> 31 31 32 32 namespace orxonox -
code/forks/sandbox_light/src/libraries/util/Exception.cc
r7401 r7908 35 35 #include "Exception.h" 36 36 37 #include <CEGUIExceptions.h>38 37 #include "Debug.h" 39 38 … … 99 98 return ex.what(); 100 99 } 101 catch (const CEGUI::Exception& ex)102 {103 #if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6104 return GeneralException(ex.getMessage().c_str()).getDescription();105 #else106 return GeneralException(ex.getMessage().c_str(), ex.getLine(),107 ex.getFileName().c_str(), ex.getName().c_str()).getDescription();108 #endif109 }110 100 catch (...) 111 101 { -
code/forks/sandbox_light/src/libraries/util/Math.cc
r7401 r7908 34 34 #include "Math.h" 35 35 36 #include < OgrePlane.h>36 #include <ogremath/OgrePlane.h> 37 37 38 38 #include "MathConvert.h" -
code/forks/sandbox_light/src/libraries/util/Math.h
r7427 r7908 47 47 #include <cstdlib> 48 48 49 #include < OgreMath.h>50 #include < OgreVector2.h>51 #include < OgreVector3.h>52 #include < OgreVector4.h>53 #include < OgreQuaternion.h>54 #include < OgreColourValue.h>49 #include <ogremath/OgreMath.h> 50 #include <ogremath/OgreVector2.h> 51 #include <ogremath/OgreVector3.h> 52 #include <ogremath/OgreVector4.h> 53 #include <ogremath/OgreQuaternion.h> 54 #include <ogremath/OgreColourValue.h> 55 55 56 56 // Certain headers might define unwanted macros... -
code/forks/sandbox_light/src/libraries/util/MultiType.h
r7401 r7908 100 100 #include <cassert> 101 101 #include <string> 102 #include < OgreVector2.h>103 #include < OgreVector3.h>104 #include < OgreVector4.h>105 #include < OgreQuaternion.h>106 #include < OgreColourValue.h>102 #include <ogremath/OgreVector2.h> 103 #include <ogremath/OgreVector3.h> 104 #include <ogremath/OgreVector4.h> 105 #include <ogremath/OgreQuaternion.h> 106 #include <ogremath/OgreColourValue.h> 107 107 #include <loki/TypeTraits.h> 108 108 #include "mbool.h" … … 260 260 261 261 virtual void toString(std::ostream& outstream) const = 0; 262 263 virtual void importData( uint8_t*& mem )=0;264 virtual void exportData( uint8_t*& mem ) const=0;265 virtual uint8_t getSize() const=0;266 262 267 263 MT_Type::Value type_; ///< The type of the current value … … 374 370 std::string getTypename() const; 375 371 376 /// Saves the value of the MT to a bytestream (pointed at by mem) and increases mem pointer by size of MT377 inline void exportData(uint8_t*& mem) const { assert(sizeof(MT_Type::Value)<=8); *static_cast<uint8_t*>(mem) = this->getType(); mem+=sizeof(uint8_t); this->value_->exportData(mem); }378 /// Loads the value of the MT from a bytestream (pointed at by mem) and increases mem pointer by size of MT379 inline void importData(uint8_t*& mem) { assert(sizeof(MT_Type::Value)<=8); this->setType(static_cast<MT_Type::Value>(*static_cast<uint8_t*>(mem))); mem+=sizeof(uint8_t); this->value_->importData(mem); }380 /// Saves the value of the MT to a bytestream and increases pointer to bytestream by size of MT381 inline uint8_t*& operator << (uint8_t*& mem) { importData(mem); return mem; }382 /// Loads the value of the MT to a bytestream and increases pointer to bytestream by size of MT383 inline void operator >> (uint8_t*& mem) const { exportData(mem); }384 inline uint32_t getNetworkSize() const { assert(this->value_); return this->value_->getSize() + sizeof(uint8_t); }385 386 372 /// Checks whether the value is a default one (assigned after a failed conversion) 387 373 bool hasDefaultValue() const { return this->value_->hasDefaultValue(); } -
code/forks/sandbox_light/src/libraries/util/MultiTypeValue.h
r7401 r7908 43 43 #include "MathConvert.h" 44 44 #include "MultiType.h" 45 #include "Serialise.h"46 45 47 46 namespace orxonox … … 155 154 inline void toString(std::ostream& outstream) const { outstream << this->value_; } 156 155 157 /// loads data from the bytestream (mem) into the MT and increases the bytestream pointer by the size of the data158 inline void importData( uint8_t*& mem ) { loadAndIncrease( /*(const T&)*/this->value_, mem ); }159 /// saves data from the MT into the bytestream (mem) and increases the bytestream pointer by the size of the data160 inline void exportData( uint8_t*& mem ) const { saveAndIncrease( /*(const T&)*/this->value_, mem ); }161 /// returns the size of the data that would be saved by exportData162 inline uint8_t getSize() const { return returnSize( this->value_ ); }163 164 156 T value_; ///< The stored value 165 157 }; 166 167 // Import / Export specialisation168 // ColourValue169 template <> inline void MT_Value<ColourValue>::importData( uint8_t*& mem )170 {171 loadAndIncrease( this->value_.r, mem );172 loadAndIncrease( this->value_.g, mem );173 loadAndIncrease( this->value_.b, mem );174 loadAndIncrease( this->value_.a, mem );175 }176 template <> inline void MT_Value<ColourValue>::exportData( uint8_t*& mem ) const177 {178 saveAndIncrease( this->value_.r, mem );179 saveAndIncrease( this->value_.g, mem );180 saveAndIncrease( this->value_.b, mem );181 saveAndIncrease( this->value_.a, mem );182 }183 template <> inline uint8_t MT_Value<ColourValue>::getSize() const184 {185 return 4*returnSize(this->value_.r);186 }187 // Ogre::Quaternion188 template <> inline void MT_Value<Ogre::Quaternion>::importData( uint8_t*& mem )189 {190 loadAndIncrease( this->value_.x, mem );191 loadAndIncrease( this->value_.y, mem );192 loadAndIncrease( this->value_.z, mem );193 loadAndIncrease( this->value_.w, mem );194 }195 template <> inline void MT_Value<Ogre::Quaternion>::exportData( uint8_t*& mem ) const196 {197 saveAndIncrease( this->value_.x, mem );198 saveAndIncrease( this->value_.y, mem );199 saveAndIncrease( this->value_.z, mem );200 saveAndIncrease( this->value_.w, mem );201 }202 template <> inline uint8_t MT_Value<Ogre::Quaternion>::getSize() const203 {204 return 4*returnSize(this->value_.x);205 }206 // Ogre::Vector2207 template <> inline void MT_Value<Ogre::Vector2>::importData( uint8_t*& mem )208 {209 loadAndIncrease( this->value_.x, mem );210 loadAndIncrease( this->value_.y, mem );211 }212 template <> inline void MT_Value<Ogre::Vector2>::exportData( uint8_t*& mem ) const213 {214 saveAndIncrease( this->value_.x, mem );215 saveAndIncrease( this->value_.y, mem );216 }217 template <> inline uint8_t MT_Value<Ogre::Vector2>::getSize() const218 {219 return 2*returnSize(this->value_.x);220 }221 // Ogre::Vector3222 template <> inline void MT_Value<Ogre::Vector3>::importData( uint8_t*& mem )223 {224 loadAndIncrease( this->value_.x, mem );225 loadAndIncrease( this->value_.y, mem );226 loadAndIncrease( this->value_.z, mem );227 }228 template <> inline void MT_Value<Ogre::Vector3>::exportData( uint8_t*& mem ) const229 {230 saveAndIncrease( this->value_.x, mem );231 saveAndIncrease( this->value_.y, mem );232 saveAndIncrease( this->value_.z, mem );233 }234 template <> inline uint8_t MT_Value<Ogre::Vector3>::getSize() const235 {236 return 3*returnSize(this->value_.x);237 }238 // Ogre::Vector4239 template <> inline void MT_Value<Ogre::Vector4>::importData( uint8_t*& mem )240 {241 loadAndIncrease( this->value_.x, mem );242 loadAndIncrease( this->value_.y, mem );243 loadAndIncrease( this->value_.z, mem );244 loadAndIncrease( this->value_.w, mem );245 }246 template <> inline void MT_Value<Ogre::Vector4>::exportData( uint8_t*& mem ) const247 {248 saveAndIncrease( this->value_.x, mem );249 saveAndIncrease( this->value_.y, mem );250 saveAndIncrease( this->value_.z, mem );251 saveAndIncrease( this->value_.w, mem );252 }253 template <> inline uint8_t MT_Value<Ogre::Vector4>::getSize() const254 {255 return 4*returnSize(this->value_.x);256 }257 template <> inline void MT_Value<void*>::importData( uint8_t*& mem )258 {259 assert(0);260 }261 template <> inline void MT_Value<void*>::exportData( uint8_t*& mem ) const262 {263 assert(0);264 }265 template <> inline uint8_t MT_Value<void*>::getSize() const266 {267 assert(0); return 0;268 }269 158 } 270 159 -
code/forks/sandbox_light/src/libraries/util/UtilPrereqs.h
r6417 r7908 64 64 namespace orxonox 65 65 { 66 namespace ScopeID67 {68 //!A list of available scopes for the Scope template.69 enum Value70 {71 Root,72 Graphics73 };74 }75 66 } 76 67 … … 83 74 class Clock; 84 75 class Exception; 85 class ExprParser;86 76 class IntVector2; 87 77 class IntVector3; … … 89 79 class OutputHandler; 90 80 class OutputListener; 91 template <ScopeID::Value>92 class Scope;93 template <class, ScopeID::Value>94 class ScopedSingleton;95 class ScopeListener;96 81 class SignalHandler; 97 82 template <class T> -
code/forks/sandbox_light/src/orxonox/CMakeLists.txt
r7648 r7908 24 24 25 25 SET_SOURCE_FILES(ORXONOX_SRC_FILES 26 Level.cc27 LevelInfo.cc28 LevelManager.cc29 26 Main.cc 30 MoodManager.cc31 PawnManager.cc32 PlayerManager.cc33 Radar.cc34 ChatHistory.cc35 ChatInputHandler.cc36 # Test.cc37 COMPILATION_BEGIN SceneCompilation.cc38 CameraManager.cc39 Scene.cc40 COMPILATION_END41 27 ) 42 43 ADD_SUBDIRECTORY(collisionshapes)44 ADD_SUBDIRECTORY(controllers)45 ADD_SUBDIRECTORY(gamestates)46 ADD_SUBDIRECTORY(gametypes)47 ADD_SUBDIRECTORY(graphics)48 ADD_SUBDIRECTORY(infos)49 ADD_SUBDIRECTORY(interfaces)50 ADD_SUBDIRECTORY(items)51 ADD_SUBDIRECTORY(overlays)52 ADD_SUBDIRECTORY(pickup)53 ADD_SUBDIRECTORY(sound)54 ADD_SUBDIRECTORY(weaponsystem)55 ADD_SUBDIRECTORY(worldentities)56 28 57 29 ORXONOX_ADD_LIBRARY(orxonox 58 30 FIND_HEADER_FILES 59 TOLUA_FILES60 ChatInputHandler.h61 LevelInfo.h62 LevelManager.h63 MoodManager.h64 controllers/HumanController.h65 infos/PlayerInfo.h66 sound/SoundManager.h67 31 PCH_FILE 68 32 OrxonoxPrecompiledHeaders.h … … 70 34 ${Boost_FILESYSTEM_LIBRARY} 71 35 ${Boost_SYSTEM_LIBRARY} # Filesystem dependency 72 ${Boost_THREAD_LIBRARY}73 ${Boost_DATE_TIME_LIBRARY} # Thread dependency74 ${OGRE_LIBRARY}75 ${OPENAL_LIBRARY}76 ${ALUT_LIBRARY}77 ${VORBISFILE_LIBRARY}78 ${VORBIS_LIBRARY}79 ${OGG_LIBRARY}80 tinyxml_orxonox81 tolua_orxonox82 bullet_orxonox83 36 util 84 37 core 85 network86 tools87 38 SOURCE_FILES ${ORXONOX_SRC_FILES} 88 39 ) -
code/forks/sandbox_light/src/orxonox/Main.cc
r7801 r7908 37 37 38 38 #include "core/CommandLineParser.h" 39 #include "core/Game.h" 40 #include "core/LuaState.h" 41 #include "ToluaBindOrxonox.h" 42 #include "ToluaBindNetwork.h" 43 44 DeclareToluaInterface(Orxonox); 45 DeclareToluaInterface(Network); 39 #include "core/Core.h" 46 40 47 41 namespace orxonox 48 42 { 49 SetCommandLineSwitch(console).information("Start in console mode (text IO only)");50 SetCommandLineSwitch(server).information("Start in server mode");51 SetCommandLineSwitch(client).information("Start in client mode");52 SetCommandLineSwitch(dedicated).information("Start in dedicated server mode");53 SetCommandLineSwitch(standalone).information("Start in standalone mode");54 SetCommandLineSwitch(dedicatedClient).information("Start in dedicated client mode");55 56 /* ADD masterserver command */57 SetCommandLineSwitch(masterserver).information("Start in masterserver mode");58 59 43 SetCommandLineArgument(generateDoc, "") 60 44 .information("Generates a Doxygen file from things like SetConsoleCommand"); … … 66 50 int main(const std::string& strCmdLine) 67 51 { 68 Game* game = new Game(strCmdLine);52 Core* core = new Core(strCmdLine); 69 53 70 54 if (CommandLineParser::getValue("generateDoc").getString().empty()) 71 55 { 72 /* TODO make this clear */ 73 game->setStateHierarchy( 74 "root" 75 " graphics" 76 " mainMenu" 77 " standalone,server,client" 78 " level" 79 " server,client,masterserver" 80 " level" 81 ); 82 83 game->requestState("root"); 84 85 // Some development hacks (not really, but in the future, these calls won't make sense anymore) 86 if (CommandLineParser::getValue("standalone").getBool()) 87 Game::getInstance().requestStates("graphics, standalone, level"); 88 else if (CommandLineParser::getValue("server").getBool()) 89 Game::getInstance().requestStates("graphics, server, level"); 90 else if (CommandLineParser::getValue("client").getBool()) 91 Game::getInstance().requestStates("graphics, client, level"); 92 else if (CommandLineParser::getValue("dedicated").getBool()) 93 Game::getInstance().requestStates("server, level"); 94 else if (CommandLineParser::getValue("dedicatedClient").getBool()) 95 Game::getInstance().requestStates("client, level"); 96 /* ADD masterserver command */ 97 else if (CommandLineParser::getValue("masterserver").getBool()) 98 Game::getInstance().requestStates("masterserver"); 99 else 100 { 101 if (!CommandLineParser::getValue("console").getBool()) 102 Game::getInstance().requestStates("graphics, mainMenu"); 103 } 104 105 game->run(); 56 // Start your program here 106 57 } 107 58 108 delete game;59 delete core; 109 60 110 61 return 0; -
code/forks/sandbox_light/src/orxonox/OrxonoxPrecompiledHeaders.h
r7284 r7908 38 38 #include "OrxonoxConfig.h" 39 39 40 ///////////////////////////////////////////41 ///// Stable Headers /////42 ///////////////////////////////////////////43 44 #include <cassert> // 8745 #include <cstring> // 8746 #include <fstream> // 8747 #include <iostream> // 8748 #include <map> // 8749 #include <set> // 8750 #include <sstream> // 8751 #include <string> // 8752 #include <vector> // 8753 #include <list> // 8654 #include <ctime> // 8255 #include <cmath> // 8156 #include <deque> // 8157 #include <queue> // 8158 59 #include <OgreMath.h> // 8160 #include <OgreVector2.h> // 8161 #include <OgreVector3.h> // 8162 #include <OgreVector4.h> // 8163 #include <OgreQuaternion.h> // 8164 #include <OgreColourValue.h> // 8165 66 #include "util/OgreForwardRefs.h" // 6767 #include <LinearMath/btMotionState.h> // 6068 #include "util/SubString.h" // 5569 #include <tinyxml/ticpp.h> // 4170 71 //#include <OgreRenderable.h> // 14, 5.1MB72 //#include <OgreSceneNode.h> // 13, 1MB73 //#include <OgreResourceGroupManager.h> // 12, 1.5MB74 //#include <OgreTexture.h> // 11, 0.6MB75 //#include <OgreMovableObject.h> // 10, 1.6MB76 //#include <OgreSceneManager.h> // 9, 8.7MB77 78 ///////////////////////////////////////////79 ///// All Rebuild Headers /////80 ///////////////////////////////////////////81 82 #include "core/BaseObject.h" // 8283 #include "core/CoreIncludes.h" // 8084 85 ///////////////////////////////////////////86 ///// Not so Stable Headers /////87 ///////////////////////////////////////////88 89 #include "network/synchronisable/Synchronisable.h" // 7090 #include "util/MultiType.h" // 6591 #include "core/command/Executor.h" // 5592 //#include "core/XMLPort.h" // 4193 94 95 40 // Just in case some header included windows.h 96 41 #undef min -
code/forks/sandbox_light/src/orxonox/OrxonoxPrereqs.h
r7854 r7908 37 37 38 38 #include "OrxonoxConfig.h" 39 #include "tools/ToolsPrereqs.h"40 39 41 40 //----------------------------------------------------------------------- … … 65 64 namespace orxonox 66 65 { 67 class CameraManager;68 class Level;69 class LevelInfo;70 class LevelInfoItem;71 class LevelManager;72 class PawnManager;73 class PlayerManager;74 class Radar;75 class Scene;76 77 // collisionshapes78 class CollisionShape;79 class CompoundCollisionShape;80 class WorldEntityCollisionShape;81 82 // controllers83 class AIController;84 class ArtificialController;85 class Controller;86 class DroneController;87 class HumanController;88 class ScriptController;89 class WaypointController;90 class WaypointPatrolController;91 92 // gametypes93 class Asteroids;94 class Deathmatch;95 class Dynamicmatch;96 class Gametype;97 class LastManStanding;98 class TeamBaseMatch;99 class TeamDeathmatch;100 class UnderAttack;101 102 // graphics103 class Backlight;104 class Billboard;105 class BlinkingBillboard;106 class Camera;107 class FadingBillboard;108 class GlobalShader;109 class Light;110 class Model;111 class ParticleEmitter;112 class ParticleSpawner;113 114 // infos115 class Bot;116 class GametypeInfo;117 class HumanPlayer;118 class Info;119 class PlayerInfo;120 121 // interfaces122 class GametypeMessageListener;123 class NotificationListener;124 class Pickupable;125 class PickupCarrier;126 class PlayerTrigger;127 class RadarListener;128 class RadarViewable;129 class Rewardable;130 class TeamColourable;131 132 // items133 class Engine;134 class Item;135 class MultiStateEngine;136 137 // overlays138 class InGameConsole;139 class Map;140 class OrxonoxOverlay;141 class OverlayGroup;142 143 // pickup144 class PickupIdentifier;145 146 //sound147 class AmbientSound;148 class BaseSound;149 class SoundBuffer;150 class SoundManager;151 class SoundStreamer;152 class WorldSound;153 class WorldAmbientSound;154 155 // weaponsystem156 class DefaultWeaponmodeLink;157 class Munition;158 class Weapon;159 class WeaponMode;160 class WeaponPack;161 class WeaponSet;162 class WeaponSlot;163 class WeaponSystem;164 165 // worldentities166 class BigExplosion;167 class CameraPosition;168 class ControllableEntity;169 class Drone;170 class EffectContainer;171 class ExplosionChunk;172 class MobileEntity;173 class MovableEntity;174 class SpawnPoint;175 class StaticEntity;176 class TeamSpawnPoint;177 class WorldEntity;178 class Rocket;179 // worldentities, pawns180 class Destroyer;181 class Pawn;182 class SpaceShip;183 class Spectator;184 class TeamBaseMatchBase;185 66 } 186 67 187 // Bullet Physics Engine188 class btTransform;189 class btVector3;190 191 class btRigidBody;192 class btCollisionObject;193 class btGhostObject;194 class btManifoldPoint;195 196 class btCollisionShape;197 class btSphereShape;198 class btCompoundShape;199 class btStaticPlaneShape;200 201 class btDiscreteDynamicsWorld;202 class bt32BitAxisSweep3;203 class btDefaultCollisionConfiguration;204 class btCollisionDispatcher;205 class btSequentialImpulseConstraintSolver;206 207 // ALUT208 typedef struct ALCcontext_struct ALCcontext;209 typedef struct ALCdevice_struct ALCdevice;210 typedef unsigned int ALuint;211 typedef int ALint;212 typedef int ALenum;213 214 68 #endif /* _OrxonoxPrereqs_H__ */
Note: See TracChangeset
for help on using the changeset viewer.