Compare commits
42 commits
character-
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
bc1e6762c9 | ||
|
92d42fc551 | ||
|
3482719e4f | ||
|
e9bbc08ec3 | ||
|
ad6df32c97 | ||
|
fdda384297 | ||
|
0b66e87bac | ||
|
1ef00f4728 | ||
|
a5f891141d | ||
|
373087790b | ||
|
d5d6b87107 | ||
|
357388914c | ||
|
9e51780378 | ||
|
59a990b5e2 | ||
|
9cacd1ddd0 | ||
|
b4432595b4 | ||
|
afdd80f3b3 | ||
|
d88156748f | ||
e77e40085b | |||
|
e4fb659206 | ||
|
32be20aeb3 | ||
|
452baa3a16 | ||
|
e2f6ee3b7a | ||
|
9ee347f725 | ||
|
4480914dc5 | ||
|
7f7bc412b4 | ||
|
483f0a8f10 | ||
|
c15b8d69a6 | ||
|
0695fe9d51 | ||
|
b98ffc5bec | ||
|
e1dd7b7661 | ||
|
41caea6048 | ||
|
e87822556a | ||
|
c3f52a29fe | ||
ef12fff06b | |||
|
e265fb43d2 | ||
2aceec0ed2 | |||
077b2bba70 | |||
bd0698eb0d | |||
143288876b | |||
a0f6e13ac7 | |||
f3465b742a |
440 changed files with 3038 additions and 2980 deletions
107
CMakeLists.txt
107
CMakeLists.txt
|
@ -13,9 +13,11 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
project(reone)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
add_subdirectory(src/external/s3tc)
|
||||
|
||||
option(BUILD_TOOLS "build tools executable" ON)
|
||||
|
@ -25,7 +27,7 @@ option(BUILD_TESTS "build unit tests" OFF)
|
|||
option(USE_EXTERNAL_GLM "use GLM library from external subdirectory" ON)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
|
||||
find_package(Boost REQUIRED COMPONENTS filesystem program_options system)
|
||||
find_package(Boost REQUIRED COMPONENTS filesystem program_options system OPTIONAL_COMPONENTS unit_test_framework)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(MAD REQUIRED)
|
||||
|
@ -67,7 +69,6 @@ set(COMMON_HEADERS
|
|||
src/engine/common/mediastream.h
|
||||
src/engine/common/pathutil.h
|
||||
src/engine/common/random.h
|
||||
src/engine/common/stopwatch.h
|
||||
src/engine/common/streamreader.h
|
||||
src/engine/common/streamutil.h
|
||||
src/engine/common/streamwriter.h
|
||||
|
@ -78,7 +79,6 @@ set(COMMON_SOURCES
|
|||
src/engine/common/log.cpp
|
||||
src/engine/common/pathutil.cpp
|
||||
src/engine/common/random.cpp
|
||||
src/engine/common/stopwatch.cpp
|
||||
src/engine/common/streamreader.cpp
|
||||
src/engine/common/streamutil.cpp
|
||||
src/engine/common/streamwriter.cpp
|
||||
|
@ -86,6 +86,7 @@ set(COMMON_SOURCES
|
|||
|
||||
add_library(libcommon STATIC ${COMMON_HEADERS} ${COMMON_SOURCES})
|
||||
set_target_properties(libcommon PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libcommon PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libcommon static library
|
||||
|
||||
|
@ -154,6 +155,7 @@ set(RESOURCE_SOURCES
|
|||
|
||||
add_library(libresource STATIC ${RESOURCE_HEADERS} ${RESOURCE_SOURCES})
|
||||
set_target_properties(libresource PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libresource PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libresource static library
|
||||
|
||||
|
@ -251,6 +253,7 @@ set(GRAPHICS_SOURCES
|
|||
|
||||
add_library(libgraphics STATIC ${GRAPHICS_HEADERS} ${GRAPHICS_SOURCES})
|
||||
set_target_properties(libgraphics PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libgraphics PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libgraphics static library
|
||||
|
||||
|
@ -280,6 +283,7 @@ set(AUDIO_SOURCES
|
|||
|
||||
add_library(libaudio STATIC ${AUDIO_HEADERS} ${AUDIO_SOURCES})
|
||||
set_target_properties(libaudio PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libaudio PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libaudio static library
|
||||
|
||||
|
@ -295,6 +299,7 @@ set(VIDEO_SOURCES
|
|||
|
||||
add_library(libvideo STATIC ${VIDEO_HEADERS} ${VIDEO_SOURCES})
|
||||
set_target_properties(libvideo PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libvideo PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libvideo static library
|
||||
|
||||
|
@ -303,14 +308,14 @@ set_target_properties(libvideo PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINAR
|
|||
set(SCENE_HEADERS
|
||||
src/engine/scene/animeventlistener.h
|
||||
src/engine/scene/animproperties.h
|
||||
src/engine/scene/node/cameranode.h
|
||||
src/engine/scene/node/dummynode.h
|
||||
src/engine/scene/node/emitternode.h
|
||||
src/engine/scene/node/grassnode.h
|
||||
src/engine/scene/node/lightnode.h
|
||||
src/engine/scene/node/meshnode.h
|
||||
src/engine/scene/node/camera.h
|
||||
src/engine/scene/node/dummy.h
|
||||
src/engine/scene/node/emitter.h
|
||||
src/engine/scene/node/grass.h
|
||||
src/engine/scene/node/light.h
|
||||
src/engine/scene/node/mesh.h
|
||||
src/engine/scene/node/model.h
|
||||
src/engine/scene/node/modelnode.h
|
||||
src/engine/scene/node/modelnodescenenode.h
|
||||
src/engine/scene/node/scenenode.h
|
||||
src/engine/scene/nodeelement.h
|
||||
src/engine/scene/pipeline/control.h
|
||||
|
@ -320,14 +325,14 @@ set(SCENE_HEADERS
|
|||
src/engine/scene/types.h)
|
||||
|
||||
set(SCENE_SOURCES
|
||||
src/engine/scene/node/cameranode.cpp
|
||||
src/engine/scene/node/emitternode.cpp
|
||||
src/engine/scene/node/grassnode.cpp
|
||||
src/engine/scene/node/lightnode.cpp
|
||||
src/engine/scene/node/meshnode.cpp
|
||||
src/engine/scene/node/camera.cpp
|
||||
src/engine/scene/node/emitter.cpp
|
||||
src/engine/scene/node/grass.cpp
|
||||
src/engine/scene/node/light.cpp
|
||||
src/engine/scene/node/mesh.cpp
|
||||
src/engine/scene/node/model.cpp
|
||||
src/engine/scene/node/model_animation.cpp
|
||||
src/engine/scene/node/modelnode.cpp
|
||||
src/engine/scene/node/modelnode_animation.cpp
|
||||
src/engine/scene/node/modelnodescenenode.cpp
|
||||
src/engine/scene/node/scenenode.cpp
|
||||
src/engine/scene/pipeline/control.cpp
|
||||
src/engine/scene/pipeline/world.cpp
|
||||
|
@ -336,6 +341,7 @@ set(SCENE_SOURCES
|
|||
|
||||
add_library(libscene STATIC ${SCENE_HEADERS} ${SCENE_SOURCES})
|
||||
set_target_properties(libscene PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libscene PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libscene static library
|
||||
|
||||
|
@ -350,6 +356,7 @@ set(GUI_HEADERS
|
|||
src/engine/gui/control/panel.h
|
||||
src/engine/gui/control/progressbar.h
|
||||
src/engine/gui/control/scrollbar.h
|
||||
src/engine/gui/control/slider.h
|
||||
src/engine/gui/control/togglebutton.h
|
||||
src/engine/gui/gui.h
|
||||
src/engine/gui/scenebuilder.h
|
||||
|
@ -364,6 +371,7 @@ set(GUI_SOURCES
|
|||
src/engine/gui/control/listbox.cpp
|
||||
src/engine/gui/control/panel.cpp
|
||||
src/engine/gui/control/progressbar.cpp
|
||||
src/engine/gui/control/slider.cpp
|
||||
src/engine/gui/control/scrollbar.cpp
|
||||
src/engine/gui/control/togglebutton.cpp
|
||||
src/engine/gui/gui.cpp
|
||||
|
@ -372,6 +380,7 @@ set(GUI_SOURCES
|
|||
|
||||
add_library(libgui STATIC ${GUI_HEADERS} ${GUI_SOURCES})
|
||||
set_target_properties(libgui PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libgui PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libgui static library
|
||||
|
||||
|
@ -380,10 +389,13 @@ set_target_properties(libgui PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_
|
|||
set(SCRIPT_HEADERS
|
||||
src/engine/script/enginetype.h
|
||||
src/engine/script/execution.h
|
||||
src/engine/script/executioncontext.h
|
||||
src/engine/script/executionstate.h
|
||||
src/engine/script/instrutil.h
|
||||
src/engine/script/ncsreader.h
|
||||
src/engine/script/program.h
|
||||
src/engine/script/routine.h
|
||||
src/engine/script/routineprovider.h
|
||||
src/engine/script/services.h
|
||||
src/engine/script/scripts.h
|
||||
src/engine/script/types.h
|
||||
|
@ -401,6 +413,7 @@ set(SCRIPT_SOURCES
|
|||
|
||||
add_library(libscript STATIC ${SCRIPT_HEADERS} ${SCRIPT_SOURCES})
|
||||
set_target_properties(libscript PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libscript PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libscript static library
|
||||
|
||||
|
@ -408,7 +421,7 @@ set_target_properties(libscript PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINA
|
|||
|
||||
set(GAME_HEADERS
|
||||
src/engine/game/action/action.h
|
||||
src/engine/game/action/commandaction.h
|
||||
src/engine/game/action/docommand.h
|
||||
src/engine/game/action/follow.h
|
||||
src/engine/game/action/locationaction.h
|
||||
src/engine/game/action/movetolocation.h
|
||||
|
@ -419,14 +432,14 @@ set(GAME_HEADERS
|
|||
src/engine/game/action/startconversation.h
|
||||
src/engine/game/action/usefeat.h
|
||||
src/engine/game/action/useskill.h
|
||||
src/engine/game/action/waitaction.h
|
||||
src/engine/game/action/wait.h
|
||||
src/engine/game/animationutil.h
|
||||
src/engine/game/camera/animatedcamera.h
|
||||
src/engine/game/camera/animated.h
|
||||
src/engine/game/camera/camera.h
|
||||
src/engine/game/camera/camerastyle.h
|
||||
src/engine/game/camera/dialogcamera.h
|
||||
src/engine/game/camera/dialog.h
|
||||
src/engine/game/camera/firstperson.h
|
||||
src/engine/game/camera/staticcamera.h
|
||||
src/engine/game/camera/static.h
|
||||
src/engine/game/camera/thirdperson.h
|
||||
src/engine/game/character.h
|
||||
src/engine/game/console.h
|
||||
|
@ -450,7 +463,6 @@ set(GAME_HEADERS
|
|||
src/engine/game/enginetype/talent.h
|
||||
src/engine/game/footstepsounds.h
|
||||
src/engine/game/game.h
|
||||
src/engine/game/gameidutil.h
|
||||
src/engine/game/gui/barkbubble.h
|
||||
src/engine/game/gui/chargen/abilities.h
|
||||
src/engine/game/gui/chargen/chargen.h
|
||||
|
@ -463,7 +475,6 @@ set(GAME_HEADERS
|
|||
src/engine/game/gui/chargen/quick.h
|
||||
src/engine/game/gui/chargen/quickorcustom.h
|
||||
src/engine/game/gui/chargen/skills.h
|
||||
src/engine/game/gui/colorutil.h
|
||||
src/engine/game/gui/container.h
|
||||
src/engine/game/gui/conversation.h
|
||||
src/engine/game/gui/computer.h
|
||||
|
@ -524,12 +535,12 @@ set(GAME_HEADERS
|
|||
set(GAME_SOURCES
|
||||
src/engine/game/actionexecutor.cpp
|
||||
src/engine/game/animationutil.cpp
|
||||
src/engine/game/camera/animatedcamera.cpp
|
||||
src/engine/game/camera/animated.cpp
|
||||
src/engine/game/camera/camera.cpp
|
||||
src/engine/game/camera/camerastyle.cpp
|
||||
src/engine/game/camera/dialogcamera.cpp
|
||||
src/engine/game/camera/dialog.cpp
|
||||
src/engine/game/camera/firstperson.cpp
|
||||
src/engine/game/camera/staticcamera.cpp
|
||||
src/engine/game/camera/static.cpp
|
||||
src/engine/game/camera/thirdperson.cpp
|
||||
src/engine/game/combat/combat.cpp
|
||||
src/engine/game/combat/combat_attack.cpp
|
||||
|
@ -549,10 +560,10 @@ set(GAME_SOURCES
|
|||
src/engine/game/dialog.cpp
|
||||
src/engine/game/footstepsounds.cpp
|
||||
src/engine/game/game.cpp
|
||||
src/engine/game/game_id.cpp
|
||||
src/engine/game/game_kotor.cpp
|
||||
src/engine/game/game_save.cpp
|
||||
src/engine/game/game_tsl.cpp
|
||||
src/engine/game/gameidutil.cpp
|
||||
src/engine/game/gui/barkbubble.cpp
|
||||
src/engine/game/gui/chargen/abilities.cpp
|
||||
src/engine/game/gui/chargen/chargen.cpp
|
||||
|
@ -565,7 +576,6 @@ set(GAME_SOURCES
|
|||
src/engine/game/gui/chargen/quick.cpp
|
||||
src/engine/game/gui/chargen/quickorcustom.cpp
|
||||
src/engine/game/gui/chargen/skills.cpp
|
||||
src/engine/game/gui/colorutil.cpp
|
||||
src/engine/game/gui/computer.cpp
|
||||
src/engine/game/gui/container.cpp
|
||||
src/engine/game/gui/conversation.cpp
|
||||
|
@ -655,6 +665,7 @@ set(GAME_SOURCES
|
|||
|
||||
add_library(libgame STATIC ${GAME_HEADERS} ${GAME_SOURCES})
|
||||
set_target_properties(libgame PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
target_precompile_headers(libgame PRIVATE src/engine/pch.h)
|
||||
|
||||
## END libgame static library
|
||||
|
||||
|
@ -662,6 +673,7 @@ set_target_properties(libgame PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY
|
|||
|
||||
set(REONE_HEADERS
|
||||
src/engine/engine.h
|
||||
src/engine/pch.h
|
||||
src/engine/program.h)
|
||||
|
||||
set(REONE_SOURCES
|
||||
|
@ -675,6 +687,7 @@ endif()
|
|||
|
||||
add_executable(reone ${REONE_HEADERS} ${REONE_SOURCES})
|
||||
set_target_properties(reone PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
target_precompile_headers(reone PRIVATE src/engine/pch.h)
|
||||
|
||||
target_link_libraries(reone PRIVATE
|
||||
libgame libscript libgui libscene libvideo libaudio libgraphics libresource libcommon
|
||||
|
@ -719,6 +732,7 @@ if(BUILD_TOOLS)
|
|||
|
||||
add_executable(reone-tools ${TOOLS_HEADERS} ${TOOLS_SOURCES})
|
||||
set_target_properties(reone-tools PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
target_precompile_headers(reone-tools PRIVATE src/engine/pch.h)
|
||||
|
||||
target_link_libraries(reone-tools PRIVATE
|
||||
libgraphics libresource libcommon
|
||||
|
@ -760,6 +774,7 @@ if(BUILD_LAUNCHER)
|
|||
target_link_libraries(reone-launcher ${wxWidgets_LIBRARIES} ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_SYSTEM_LIBRARY})
|
||||
|
||||
set_target_properties(reone-launcher PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
||||
target_precompile_headers(reone-launcher PRIVATE src/engine/pch.h)
|
||||
list(APPEND InstallTargets reone-launcher)
|
||||
else()
|
||||
message(WARNING "wxWidgets not found - launcher cannot be built")
|
||||
|
@ -772,21 +787,25 @@ endif()
|
|||
## Unit tests
|
||||
|
||||
if(BUILD_TESTS)
|
||||
set(TEST_SOURCES
|
||||
src/tests/common/streamreader.cpp
|
||||
src/tests/common/timer.cpp
|
||||
src/tests/game/pathfinder.cpp
|
||||
src/tests/main.cpp
|
||||
src/tests/resource/gffstruct.cpp
|
||||
src/tests/script/execution.cpp)
|
||||
|
||||
add_executable(reone-tests ${TEST_SOURCES})
|
||||
target_link_libraries(reone-tests PRIVATE libgame libscript libresource libcommon ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
|
||||
if(WIN32)
|
||||
target_link_libraries(reone-tests PRIVATE SDL2::SDL2)
|
||||
else()
|
||||
target_link_libraries(reone-tests PRIVATE ${SDL2_LIBRARIES})
|
||||
endif()
|
||||
target_precompile_headers(reone-tests PRIVATE src/engine/pch.h)
|
||||
|
||||
enable_testing()
|
||||
file(GLOB TEST_FILES "src/tests/*.cpp")
|
||||
foreach(TEST_FILE ${TEST_FILES})
|
||||
get_filename_component(TEST_NAME "${TEST_FILE}" NAME_WE)
|
||||
add_executable(test_${TEST_NAME} ${TEST_FILE})
|
||||
target_link_libraries(test_${TEST_NAME} PRIVATE libgame libscript libresource libcommon ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(test_${TEST_NAME} PRIVATE SDL2::SDL2)
|
||||
else()
|
||||
target_link_libraries(test_${TEST_NAME} PRIVATE ${SDL2_LIBRARIES})
|
||||
endif()
|
||||
|
||||
add_test(${TEST_NAME} test_${TEST_NAME})
|
||||
endforeach()
|
||||
add_test(reone-tests reone-tests)
|
||||
endif()
|
||||
|
||||
## END Unit tests
|
||||
|
|
17
README.md
17
README.md
|
@ -1,14 +1,21 @@
|
|||
# reone
|
||||
|
||||
[![Build Status](https://github.com/seedhartha/reone/actions/workflows/cmake.yml/badge.svg)](https://github.com/seedhartha/reone/actions/workflows/cmake.yml)
|
||||
[![Coverity Scan Build Status](https://scan.coverity.com/projects/21827/badge.svg)](https://scan.coverity.com/projects/seedhartha-reone)
|
||||
|
||||
reone is a free and open source game engine, capable of running Star Wars: Knights of the Old Republic and its sequel, The Sith Lords. We aim to provide an engine that is flexible and modern, and can be used to:
|
||||
|
||||
- Play KotOR and TSL from beginning to end
|
||||
- Create mods that drastically change the gameplay or improve the visuals
|
||||
|
||||
The project is in the early stages of development at this point: resource management, scene management, rendering, audio, GUI and scripting subsystems are already implemented, while game mechanics are actively being worked on. See project [gallery](https://github.com/seedhartha/reone/wiki/Gallery) and [roadmap](https://github.com/seedhartha/reone/wiki/Roadmap) in the Wiki.
|
||||
The project is at a mid-stage of development: most engine subsystems have already been implemented, while game mechanics are actively being worked on. See project [gallery](https://github.com/seedhartha/reone/wiki/Gallery) and [roadmap](https://github.com/seedhartha/reone/wiki/Roadmap) in the Wiki.
|
||||
|
||||
## Legal Stance
|
||||
|
||||
reone adheres to clean-room design principles. We do not condone the use of decompilation - instead, we rely on publicly available information (e.g., file format specification provided by BioWare) and our own observations of the game and its resources.
|
||||
|
||||
We do not distribute copyrighted materials - instead, we require our users and developers to obtain a legal copy of the game.
|
||||
|
||||
Lastly, reone is explicitly a non-commercial project: we do not seek to gain profit, neither through donations nor other means.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -32,15 +39,15 @@ Install [Visual C++ Redistributable](https://aka.ms/vs/16/release/vc_redist.x64.
|
|||
|
||||
## Usage
|
||||
|
||||
Launch reone either using the launcher application, or from the command line:
|
||||
Launch reone using the launcher application or from the command line:
|
||||
|
||||
`reone --game C:\swkotor`
|
||||
|
||||
## Configuration
|
||||
|
||||
reone can be configured from either the launcher, the configuration file, or the command line.
|
||||
reone can be configured via the launcher, the configuration file or the command line.
|
||||
|
||||
Configuration file, named "reone.cfg", must be located in the current directory. See a complete list of program options [here](https://github.com/seedhartha/reone/wiki/Program-options).
|
||||
Configuration file, named "reone.cfg", must be located in the current directory. See complete list of program options [here](https://github.com/seedhartha/reone/wiki/Program-options).
|
||||
|
||||
## Similar Projects
|
||||
|
||||
|
|
|
@ -18,9 +18,11 @@
|
|||
#include "files.h"
|
||||
|
||||
#include "../common/streamutil.h"
|
||||
#include "../resource/resources.h"
|
||||
|
||||
#include "format/mp3reader.h"
|
||||
#include "format/wavreader.h"
|
||||
#include "stream.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
|
|
@ -17,17 +17,20 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../common/cache.h"
|
||||
#include "../resource/resources.h"
|
||||
|
||||
#include "stream.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace resource {
|
||||
|
||||
class Resources;
|
||||
|
||||
}
|
||||
|
||||
namespace audio {
|
||||
|
||||
class AudioStream;
|
||||
|
||||
class AudioFiles : public MemoryCache<std::string, AudioStream> {
|
||||
public:
|
||||
AudioFiles(resource::Resources &resources);
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "mp3reader.h"
|
||||
|
||||
#include "../stream.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,19 +17,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "mad.h"
|
||||
|
||||
#include "../stream.h"
|
||||
#include "../../common/types.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace audio {
|
||||
|
||||
class AudioStream;
|
||||
|
||||
class Mp3Reader : boost::noncopyable {
|
||||
public:
|
||||
void load(const std::shared_ptr<std::istream> &stream);
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
#include "wavreader.h"
|
||||
|
||||
#include <utility>
|
||||
|
||||
#include "../../common/streamutil.h"
|
||||
|
||||
#include "../stream.h"
|
||||
|
||||
#include "mp3reader.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "../../resource/format/binreader.h"
|
||||
|
||||
#include "../stream.h"
|
||||
#include "../types.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
|
@ -30,6 +30,8 @@ enum class WavAudioFormat {
|
|||
IMAADPCM = 0x11
|
||||
};
|
||||
|
||||
class AudioStream;
|
||||
|
||||
class WavReader : public resource::BinaryReader {
|
||||
public:
|
||||
WavReader();
|
||||
|
|
|
@ -17,20 +17,12 @@
|
|||
|
||||
#include "player.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "glm/gtx/norm.hpp"
|
||||
|
||||
#include "AL/al.h"
|
||||
|
||||
#include "../common/log.h"
|
||||
#include "../common/guardutil.h"
|
||||
|
||||
#include "files.h"
|
||||
#include "options.h"
|
||||
#include "soundhandle.h"
|
||||
#include "soundinstance.h"
|
||||
#include "stream.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -41,8 +33,7 @@ namespace audio {
|
|||
static constexpr float kMaxPositionalSoundDistance = 16.0f;
|
||||
static constexpr float kMaxPositionalSoundDistance2 = kMaxPositionalSoundDistance * kMaxPositionalSoundDistance;
|
||||
|
||||
AudioPlayer::AudioPlayer(AudioOptions opts, AudioFiles *files) : _opts(move(opts)), _files(files) {
|
||||
ensureNotNull(files, "files");
|
||||
AudioPlayer::AudioPlayer(AudioOptions opts, AudioFiles &files) : _opts(move(opts)), _files(files) {
|
||||
}
|
||||
|
||||
void AudioPlayer::init() {
|
||||
|
@ -117,7 +108,7 @@ void AudioPlayer::deinit() {
|
|||
}
|
||||
|
||||
shared_ptr<SoundHandle> AudioPlayer::play(const string &resRef, AudioType type, bool loop, float gain, bool positional, glm::vec3 position) {
|
||||
shared_ptr<AudioStream> stream(_files->get(resRef));
|
||||
shared_ptr<AudioStream> stream(_files.get(resRef));
|
||||
if (!stream) {
|
||||
warn("AudioPlayer: file not found: " + resRef);
|
||||
return nullptr;
|
||||
|
|
|
@ -17,33 +17,21 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "AL/alc.h"
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "files.h"
|
||||
#include "options.h"
|
||||
#include "soundinstance.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace audio {
|
||||
|
||||
class AudioFiles;
|
||||
class AudioStream;
|
||||
class SoundHandle;
|
||||
class SoundInstance;
|
||||
|
||||
class AudioPlayer : boost::noncopyable {
|
||||
public:
|
||||
AudioPlayer(AudioOptions opts, AudioFiles *files);
|
||||
AudioPlayer(AudioOptions opts, AudioFiles &files);
|
||||
~AudioPlayer();
|
||||
|
||||
void init();
|
||||
|
@ -56,7 +44,7 @@ public:
|
|||
|
||||
private:
|
||||
AudioOptions _opts;
|
||||
AudioFiles *_files;
|
||||
AudioFiles &_files;
|
||||
|
||||
ALCdevice *_device { nullptr };
|
||||
ALCcontext *_context { nullptr };
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
#include "services.h"
|
||||
|
||||
#include "../resource/services.h"
|
||||
|
||||
#include "files.h"
|
||||
#include "player.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace reone::resource;
|
||||
|
@ -33,7 +38,7 @@ AudioServices::AudioServices(AudioOptions options, ResourceServices &resource) :
|
|||
void AudioServices::init() {
|
||||
_files = make_unique<AudioFiles>(_resource.resources());
|
||||
|
||||
_player = make_unique<AudioPlayer>(_options, _files.get());
|
||||
_player = make_unique<AudioPlayer>(_options, *_files);
|
||||
_player->init();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,20 +17,21 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../resource/services.h"
|
||||
|
||||
#include "files.h"
|
||||
#include "options.h"
|
||||
#include "player.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace resource {
|
||||
|
||||
class ResourceServices;
|
||||
|
||||
}
|
||||
|
||||
namespace audio {
|
||||
|
||||
class AudioFiles;
|
||||
class AudioPlayer;
|
||||
|
||||
class AudioServices : boost::noncopyable {
|
||||
public:
|
||||
AudioServices(AudioOptions options, resource::ResourceServices &resource);
|
||||
|
|
|
@ -17,12 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace audio {
|
||||
|
|
|
@ -17,14 +17,11 @@
|
|||
|
||||
#include "soundinstance.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#include "AL/al.h"
|
||||
|
||||
#include "../common/guardutil.h"
|
||||
#include "../common/log.h"
|
||||
|
||||
#include "soundhandle.h"
|
||||
#include "stream.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -34,12 +31,14 @@ namespace audio {
|
|||
|
||||
static constexpr int kMaxBufferCount = 8;
|
||||
|
||||
SoundInstance::SoundInstance(const shared_ptr<AudioStream> &stream, bool loop, float gain, bool positional, glm::vec3 position) :
|
||||
SoundInstance::SoundInstance(shared_ptr<AudioStream> stream, bool loop, float gain, bool positional, glm::vec3 position) :
|
||||
_stream(stream),
|
||||
_loop(loop),
|
||||
_gain(gain),
|
||||
_positional(positional),
|
||||
_handle(make_shared<SoundHandle>(stream->duration(), move(position))) {
|
||||
|
||||
ensureNotNull(stream, "stream");
|
||||
}
|
||||
|
||||
void SoundInstance::init() {
|
||||
|
|
|
@ -17,24 +17,16 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "stream.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace audio {
|
||||
|
||||
class AudioStream;
|
||||
class SoundHandle;
|
||||
|
||||
class SoundInstance {
|
||||
public:
|
||||
SoundInstance(const std::shared_ptr<AudioStream> &stream, bool loop, float gain, bool positional, glm::vec3 position);
|
||||
SoundInstance(std::shared_ptr<AudioStream> stream, bool loop, float gain, bool positional, glm::vec3 position);
|
||||
SoundInstance(SoundInstance &&) = default;
|
||||
~SoundInstance();
|
||||
|
||||
|
|
|
@ -17,11 +17,6 @@
|
|||
|
||||
#include "stream.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include "AL/al.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../common/types.h"
|
||||
|
||||
#include "types.h"
|
||||
|
|
|
@ -17,13 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "guardutil.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,11 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace reone {
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace reone {
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,11 +17,6 @@
|
|||
|
||||
#include "log.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,11 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,14 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
namespace reone {
|
||||
|
||||
template <class Frame>
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#include "pathutil.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace reone {
|
||||
|
||||
boost::filesystem::path getPathIgnoreCase(const boost::filesystem::path &basePath, const std::string &relPath, bool logNotFound = true);
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#include "random.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <random>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#include "streamreader.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "guardutil.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,15 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <istream>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/endian/conversion.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "streamutil.h"
|
||||
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace io = boost::iostreams;
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
#include <memory>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "streamwriter.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "guardutil.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,15 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <string>
|
||||
|
||||
#include <boost/endian/conversion.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "timer.h"
|
||||
|
||||
#include "glm/common.hpp"
|
||||
|
||||
namespace reone {
|
||||
|
||||
Timer::Timer(float timeout) {
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace reone {
|
||||
|
||||
struct DebugChannels {
|
||||
|
|
|
@ -17,11 +17,25 @@
|
|||
|
||||
#include "engine.h"
|
||||
|
||||
#include "audio/player.h"
|
||||
#include "audio/services.h"
|
||||
#include "game/game.h"
|
||||
#include "graphics/context.h"
|
||||
#include "graphics/features.h"
|
||||
#include "graphics/fonts.h"
|
||||
#include "graphics/lip/lips.h"
|
||||
#include "graphics/materials.h"
|
||||
#include "graphics/mesh/meshes.h"
|
||||
#include "graphics/model/models.h"
|
||||
#include "graphics/pbribl.h"
|
||||
#include "graphics/renderbuffer.h"
|
||||
#include "graphics/services.h"
|
||||
#include "graphics/walkmesh/walkmeshes.h"
|
||||
#include "graphics/window.h"
|
||||
#include "resource/resourceprovider.h"
|
||||
#include "resource/services.h"
|
||||
#include "scene/services.h"
|
||||
#include "scene/pipeline/world.h"
|
||||
#include "script/services.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "game/options.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -19,10 +19,14 @@
|
|||
|
||||
#include "action.h"
|
||||
|
||||
#include "../../script/types.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace script {
|
||||
|
||||
struct ExecutionContext;
|
||||
|
||||
}
|
||||
|
||||
namespace game {
|
||||
|
||||
class CommandAction : public Action {
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "action.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "action.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "../../common/guardutil.h"
|
||||
|
||||
#include "action.h"
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "objectaction.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "glm/common.hpp"
|
||||
|
||||
#include "../../common/timer.h"
|
||||
|
||||
#include "action.h"
|
|
@ -17,18 +17,15 @@
|
|||
|
||||
#include "actionexecutor.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "SDL2/SDL_timer.h"
|
||||
|
||||
#include "../common/log.h"
|
||||
#include "../common/guardutil.h"
|
||||
#include "../scene/types.h"
|
||||
#include "../script/execution.h"
|
||||
#include "../script/executioncontext.h"
|
||||
|
||||
#include "action/usefeat.h"
|
||||
#include "action/useskill.h"
|
||||
#include "action/waitaction.h"
|
||||
#include "action/wait.h"
|
||||
#include "enginetype/location.h"
|
||||
#include "game.h"
|
||||
#include "object/area.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "action/commandaction.h"
|
||||
#include "action/docommand.h"
|
||||
#include "action/follow.h"
|
||||
#include "action/locationaction.h"
|
||||
#include "action/movetolocation.h"
|
||||
|
|
|
@ -15,16 +15,11 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "animatedcamera.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
#include "animated.h"
|
||||
|
||||
#include "../../graphics/types.h"
|
||||
#include "../../graphics/model/models.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../scene/node/cameranode.h"
|
||||
#include "../../scene/node/camera.h"
|
||||
#include "../../scene/node/model.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -74,12 +69,12 @@ bool AnimatedCamera::isAnimationFinished() const {
|
|||
return _model ? _model->isAnimationFinished() : false;
|
||||
}
|
||||
|
||||
void AnimatedCamera::setModel(const shared_ptr<Model> &model) {
|
||||
void AnimatedCamera::setModel(shared_ptr<Model> model) {
|
||||
if ((_model && _model->model() == model) ||
|
||||
(!_model && !model)) return;
|
||||
|
||||
if (model) {
|
||||
_model = make_unique<ModelSceneNode>(model, ModelUsage::Camera, _sceneGraph);
|
||||
_model = make_unique<ModelSceneNode>(move(model), ModelUsage::Camera, _sceneGraph);
|
||||
_model->attach("camerahook", _sceneNode);
|
||||
} else {
|
||||
_model.reset();
|
|
@ -17,17 +17,22 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "../../scene/node/modelnode.h"
|
||||
#include "../../scene/scenegraph.h"
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
#include "camera.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace graphics {
|
||||
|
||||
class Model;
|
||||
|
||||
}
|
||||
|
||||
namespace scene {
|
||||
|
||||
class ModelSceneNode;
|
||||
|
||||
}
|
||||
|
||||
namespace game {
|
||||
|
||||
const float kDefaultAnimCamFOV = 55.0f;
|
||||
|
@ -42,7 +47,7 @@ public:
|
|||
|
||||
bool isAnimationFinished() const;
|
||||
|
||||
void setModel(const std::shared_ptr<graphics::Model> &model);
|
||||
void setModel(std::shared_ptr<graphics::Model> model);
|
||||
void setFieldOfView(float fovy);
|
||||
|
||||
private:
|
|
@ -17,16 +17,15 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "SDL2/SDL_events.h"
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "../../scene/node/cameranode.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace scene {
|
||||
|
||||
class CameraSceneNode;
|
||||
class SceneGraph;
|
||||
|
||||
}
|
||||
|
||||
namespace game {
|
||||
|
||||
class Camera {
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include "camerastyle.h"
|
||||
|
||||
#include "../../resource/2da.h"
|
||||
#include "../../resource/resources.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,10 +17,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../../resource/2da.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace resource {
|
||||
|
||||
class TwoDA;
|
||||
|
||||
}
|
||||
|
||||
namespace game {
|
||||
|
||||
struct CameraStyle {
|
||||
|
|
|
@ -15,9 +15,10 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dialogcamera.h"
|
||||
#include "dialog.h"
|
||||
|
||||
#include "glm/ext.hpp"
|
||||
#include "../../graphics/types.h"
|
||||
#include "../../scene/node/camera.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -33,16 +34,16 @@ DialogCamera::DialogCamera(float aspect, const CameraStyle &style, SceneGraph *s
|
|||
_sceneNode = make_shared<CameraSceneNode>("", move(projection), sceneGraph);
|
||||
}
|
||||
|
||||
void DialogCamera::setSpeakerPosition(const glm::vec3 &position) {
|
||||
void DialogCamera::setSpeakerPosition(glm::vec3 position) {
|
||||
if (_speakerPosition != position) {
|
||||
_speakerPosition = position;
|
||||
_speakerPosition = move(position);
|
||||
updateSceneNode();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogCamera::setListenerPosition(const glm::vec3 &position) {
|
||||
void DialogCamera::setListenerPosition(glm::vec3 position) {
|
||||
if (_listenerPosition != position) {
|
||||
_listenerPosition = position;
|
||||
_listenerPosition = move(position);
|
||||
updateSceneNode();
|
||||
}
|
||||
}
|
||||
|
@ -54,8 +55,8 @@ void DialogCamera::setVariant(Variant variant) {
|
|||
}
|
||||
}
|
||||
|
||||
void DialogCamera::setFindObstacle(const function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> &fn) {
|
||||
_findObstacle = fn;
|
||||
void DialogCamera::setFindObstacle(function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> fn) {
|
||||
_findObstacle = move(fn);
|
||||
}
|
||||
|
||||
void DialogCamera::updateSceneNode() {
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "../../scene/scenegraph.h"
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
#include "camera.h"
|
||||
|
@ -42,10 +38,10 @@ public:
|
|||
|
||||
DialogCamera(float aspect, const CameraStyle &style, scene::SceneGraph *sceneGraph);
|
||||
|
||||
void setSpeakerPosition(const glm::vec3 &position);
|
||||
void setListenerPosition(const glm::vec3 &position);
|
||||
void setSpeakerPosition(glm::vec3 position);
|
||||
void setListenerPosition(glm::vec3 position);
|
||||
void setVariant(Variant variant);
|
||||
void setFindObstacle(const std::function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> &fn);
|
||||
void setFindObstacle(std::function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> fn);
|
||||
|
||||
private:
|
||||
glm::vec3 _speakerPosition { 0.0f };
|
|
@ -17,9 +17,8 @@
|
|||
|
||||
#include "firstperson.h"
|
||||
|
||||
#include "glm/ext.hpp"
|
||||
|
||||
#include "../../graphics/types.h"
|
||||
#include "../../scene/node/camera.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -44,9 +44,10 @@ private:
|
|||
bool _moveRight { false };
|
||||
|
||||
bool handleMouseMotion(const SDL_MouseMotionEvent &event);
|
||||
void updateSceneNode();
|
||||
bool handleKeyDown(const SDL_KeyboardEvent &event);
|
||||
bool handleKeyUp(const SDL_KeyboardEvent &event);
|
||||
|
||||
void updateSceneNode();
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "staticcamera.h"
|
||||
|
||||
#include "glm/ext.hpp"
|
||||
#include "static.h"
|
||||
|
||||
#include "../object/placeablecamera.h"
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "thirdperson.h"
|
||||
|
||||
#include "glm/ext.hpp"
|
||||
#include "../../scene/node/camera.h"
|
||||
|
||||
#include "../game.h"
|
||||
|
||||
|
@ -175,8 +175,8 @@ void ThirdPersonCamera::stopMovement() {
|
|||
_mouseLookMode = false;
|
||||
}
|
||||
|
||||
void ThirdPersonCamera::setTargetPosition(const glm::vec3 &position) {
|
||||
_targetPosition = position;
|
||||
void ThirdPersonCamera::setTargetPosition(glm::vec3 position) {
|
||||
_targetPosition = move(position);
|
||||
updateSceneNode();
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,8 @@ void ThirdPersonCamera::setFindObstacle(const function<bool(const glm::vec3 &, c
|
|||
_findObstacle = fn;
|
||||
}
|
||||
|
||||
void ThirdPersonCamera::setStyle(const CameraStyle &style) {
|
||||
_style = style;
|
||||
void ThirdPersonCamera::setStyle(CameraStyle style) {
|
||||
_style = move(style);
|
||||
updateSceneNode();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
#include "camera.h"
|
||||
#include "camerastyle.h"
|
||||
|
||||
|
@ -38,10 +34,10 @@ public:
|
|||
void update(float dt) override;
|
||||
void stopMovement() override;
|
||||
|
||||
void setTargetPosition(const glm::vec3 &position);
|
||||
void setTargetPosition(glm::vec3 position);
|
||||
void setFacing(float facing);
|
||||
void setFindObstacle(const std::function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> &fn);
|
||||
void setStyle(const CameraStyle& style);
|
||||
void setStyle(CameraStyle style);
|
||||
|
||||
private:
|
||||
Game *_game;
|
||||
|
|
|
@ -17,12 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
|
||||
#include "../../common/timer.h"
|
||||
#include "../../scene/services.h"
|
||||
|
||||
|
@ -120,7 +114,7 @@ private:
|
|||
|
||||
// Damage
|
||||
|
||||
std::vector<std::shared_ptr<DamageEffect>> getDamageEffects(std::shared_ptr<Creature> damager, bool offHand = false, float multiplier = 1.0f) const;
|
||||
std::vector<std::shared_ptr<DamageEffect>> getDamageEffects(std::shared_ptr<Creature> damager, bool offHand = false, int multiplier = 1) const;
|
||||
|
||||
// END Damage
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "combat.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "../../common/log.h"
|
||||
#include "../../common/random.h"
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ namespace reone {
|
|||
|
||||
namespace game {
|
||||
|
||||
vector<shared_ptr<DamageEffect>> Combat::getDamageEffects(shared_ptr<Creature> damager, bool offHand, float multiplier) const {
|
||||
vector<shared_ptr<DamageEffect>> Combat::getDamageEffects(shared_ptr<Creature> damager, bool offHand, int multiplier) const {
|
||||
shared_ptr<Item> weapon(damager->getEquippedItem(offHand ? InventorySlot::leftWeapon : InventorySlot::rightWeapon));
|
||||
int amount = 0;
|
||||
auto type = DamageType::Bludgeoning;
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
|
||||
#include "combat.h"
|
||||
|
||||
#include "glm/gtx/euler_angles.hpp"
|
||||
#include "glm/gtx/transform.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace reone::graphics;
|
||||
|
|
|
@ -17,16 +17,10 @@
|
|||
|
||||
#include "console.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "glm/ext.hpp"
|
||||
|
||||
#include "../common/log.h"
|
||||
#include "../graphics/font.h"
|
||||
#include "../graphics/fonts.h"
|
||||
#include "../graphics/mesh/mesh.h"
|
||||
#include "../graphics/mesh/meshes.h"
|
||||
#include "../graphics/shader/shaders.h"
|
||||
#include "../graphics/window.h"
|
||||
|
|
|
@ -17,17 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <queue>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "SDL2/SDL_events.h"
|
||||
|
||||
#include "../gui/textinput.h"
|
||||
#include "../graphics/font.h"
|
||||
#include "../graphics/options.h"
|
||||
|
|
|
@ -17,10 +17,12 @@
|
|||
|
||||
#include "cursors.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "../common/streamutil.h"
|
||||
#include "../graphics/cursor.h"
|
||||
#include "../graphics/services.h"
|
||||
#include "../graphics/texture/curreader.h"
|
||||
#include "../resource/resources.h"
|
||||
#include "../resource/services.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -17,19 +17,24 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../graphics/services.h"
|
||||
#include "../resource/services.h"
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace resource {
|
||||
|
||||
class ResourceServices;
|
||||
|
||||
}
|
||||
|
||||
namespace graphics {
|
||||
|
||||
class Cursor;
|
||||
class GraphicsServices;
|
||||
class Texture;
|
||||
|
||||
}
|
||||
|
||||
namespace game {
|
||||
|
||||
class Cursors : boost::noncopyable {
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
#include "savingthrows.h"
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "attributes.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "classes.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
#include "class.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include "../../resource/2da.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../resource/strings.h"
|
||||
|
||||
#include "classes.h"
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "../../resource/format/2dareader.h"
|
||||
#include "../../resource/services.h"
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "classes.h"
|
||||
|
||||
#include "../../resource/resources.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "../../graphics/texture/texture.h"
|
||||
|
||||
#include "../types.h"
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
#include "feats.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include "../../common/collectionutil.h"
|
||||
#include "../../resource/2da.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../resource/strings.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../../graphics/texture/textures.h"
|
||||
#include "../../resource/services.h"
|
||||
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "../../graphics/texture/texture.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
#include "skills.h"
|
||||
|
||||
#include "../../common/collectionutil.h"
|
||||
#include "../../graphics/texture/textures.h"
|
||||
#include "../../resource/2da.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../resource/strings.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../../graphics/services.h"
|
||||
#include "../../resource/services.h"
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "../../graphics/texture/texture.h"
|
||||
|
||||
#include "../types.h"
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
#include "spells.h"
|
||||
|
||||
#include "../../common/collectionutil.h"
|
||||
#include "../../resource/2da.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../resource/strings.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../../graphics/texture/textures.h"
|
||||
#include "../../resource/services.h"
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#include "dialog.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../common/guardutil.h"
|
||||
#include "../resource/strings.h"
|
||||
|
||||
|
|
|
@ -17,11 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../resource/format/gffreader.h"
|
||||
#include "../resource/strings.h"
|
||||
|
||||
|
|
|
@ -17,10 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "glm/common.hpp"
|
||||
|
||||
#include "../../script/enginetype.h"
|
||||
|
||||
#include "../types.h"
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "../../script/enginetype.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,9 +17,8 @@
|
|||
|
||||
#include "footstepsounds.h"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "../common/guardutil.h"
|
||||
#include "../resource/2da.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
|
|
@ -17,9 +17,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "../audio/files.h"
|
||||
#include "../audio/stream.h"
|
||||
#include "../common/cache.h"
|
||||
|
|
|
@ -17,16 +17,19 @@
|
|||
|
||||
#include "game.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "SDL2/SDL_timer.h"
|
||||
|
||||
#include "../audio/player.h"
|
||||
#include "../common/log.h"
|
||||
#include "../common/pathutil.h"
|
||||
#include "../graphics/features.h"
|
||||
#include "../graphics/lip/lips.h"
|
||||
#include "../graphics/model/models.h"
|
||||
#include "../graphics/pbribl.h"
|
||||
#include "../graphics/renderbuffer.h"
|
||||
#include "../graphics/walkmesh/walkmeshes.h"
|
||||
#include "../graphics/window.h"
|
||||
#include "../scene/pipeline/world.h"
|
||||
#include "../video/bikreader.h"
|
||||
|
||||
#include "gameidutil.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace reone::audio;
|
||||
|
@ -85,6 +88,7 @@ int Game::run() {
|
|||
void Game::init() {
|
||||
_gameId = determineGameID(_path);
|
||||
|
||||
initGUIColors();
|
||||
initResourceProviders();
|
||||
|
||||
_game = make_unique<GameServices>(*this, _resource, _graphics, _audio, _scene, _script);
|
||||
|
@ -103,8 +107,20 @@ void Game::init() {
|
|||
setCursorType(CursorType::Default);
|
||||
}
|
||||
|
||||
void Game::initGUIColors() {
|
||||
if (isTSL()) {
|
||||
_guiColorBase = glm::vec3(0.192157f, 0.768627f, 0.647059f);
|
||||
_guiColorHilight = glm::vec3(0.768627f, 0.768627f, 0.686275f);
|
||||
_guiColorDisabled = glm::vec3(0.513725f, 0.513725f, 0.415686f);
|
||||
} else {
|
||||
_guiColorBase = glm::vec3(0.0f, 0.639216f, 0.952941f);
|
||||
_guiColorHilight = glm::vec3(0.980392f, 1.0f, 0.0f);
|
||||
_guiColorDisabled = glm::vec3(0.0f, 0.349020f, 0.549020f);
|
||||
}
|
||||
}
|
||||
|
||||
void Game::initResourceProviders() {
|
||||
if (isTSL(_gameId)) {
|
||||
if (isTSL()) {
|
||||
initResourceProvidersForTSL();
|
||||
} else {
|
||||
initResourceProvidersForKotOR();
|
||||
|
@ -174,7 +190,7 @@ void Game::changeScreen(GameScreen screen) {
|
|||
}
|
||||
|
||||
string Game::getMainMenuMusic() const {
|
||||
return isTSL(_gameId) ? "mus_sion" : "mus_theme_cult";
|
||||
return isTSL() ? "mus_sion" : "mus_theme_cult";
|
||||
}
|
||||
|
||||
void Game::playMusic(const string &resRef) {
|
||||
|
@ -290,7 +306,7 @@ void Game::loadModuleResources(const string &moduleName) {
|
|||
fs::path lipsPath(getPathIgnoreCase(_path, kLipsDirectoryName));
|
||||
_resource.resources().indexErfFile(getPathIgnoreCase(lipsPath, moduleName + "_loc.mod"), true);
|
||||
|
||||
if (isTSL(_gameId)) {
|
||||
if (isTSL()) {
|
||||
_resource.resources().indexErfFile(getPathIgnoreCase(modulesPath, moduleName + "_dlg.erf"), true);
|
||||
}
|
||||
}
|
||||
|
@ -540,7 +556,7 @@ void Game::deinit() {
|
|||
}
|
||||
|
||||
void Game::startCharacterGeneration() {
|
||||
string imageResRef(isTSL(_gameId) ? "load_default" : "load_chargen");
|
||||
string imageResRef(isTSL() ? "load_default" : "load_chargen");
|
||||
withLoadingScreen(imageResRef, [this]() {
|
||||
if (!_charGen) {
|
||||
loadCharacterGeneration();
|
||||
|
@ -553,7 +569,7 @@ void Game::startCharacterGeneration() {
|
|||
}
|
||||
|
||||
string Game::getCharacterGenerationMusic() const {
|
||||
return isTSL(_gameId) ? "mus_main" : "mus_theme_rep";
|
||||
return isTSL() ? "mus_main" : "mus_theme_rep";
|
||||
}
|
||||
|
||||
void Game::quit() {
|
||||
|
|
|
@ -18,13 +18,6 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include "../audio/services.h"
|
||||
#include "../graphics/eventhandler.h"
|
||||
#include "../graphics/services.h"
|
||||
|
@ -103,7 +96,7 @@ public:
|
|||
Camera *getActiveCamera() const;
|
||||
std::shared_ptr<Object> getObjectById(uint32_t id) const;
|
||||
|
||||
GameID gameId() const { return _gameId; }
|
||||
GameID id() const { return _gameId; }
|
||||
const Options &options() const { return _options; }
|
||||
GameServices &services() { return *_game; }
|
||||
std::shared_ptr<Module> module() const { return _module; }
|
||||
|
@ -118,6 +111,13 @@ public:
|
|||
void setPaused(bool paused);
|
||||
void setRelativeMouseMode(bool relative);
|
||||
|
||||
// Game ID
|
||||
|
||||
bool isKotOR() const;
|
||||
bool isTSL() const;
|
||||
|
||||
// END Game ID
|
||||
|
||||
// Module loading
|
||||
|
||||
/**
|
||||
|
@ -174,6 +174,14 @@ public:
|
|||
|
||||
// END Saved games
|
||||
|
||||
// GUI colors
|
||||
|
||||
const glm::vec3 &getGUIColorBase() const { return _guiColorBase; }
|
||||
const glm::vec3 &getGUIColorHilight() const { return _guiColorHilight; }
|
||||
const glm::vec3 &getGUIColorDisabled() const { return _guiColorDisabled; }
|
||||
|
||||
// END GUI colors
|
||||
|
||||
// IEventHandler
|
||||
|
||||
bool handle(const SDL_Event &event) override;
|
||||
|
@ -247,6 +255,10 @@ private:
|
|||
std::unique_ptr<Console> _console;
|
||||
std::unique_ptr<ProfileOverlay> _profileOverlay;
|
||||
|
||||
glm::vec3 _guiColorBase { 0.0f };
|
||||
glm::vec3 _guiColorHilight { 0.0f };
|
||||
glm::vec3 _guiColorDisabled { 0.0f };
|
||||
|
||||
// END GUI
|
||||
|
||||
// Audio
|
||||
|
@ -271,16 +283,22 @@ private:
|
|||
|
||||
void update();
|
||||
|
||||
bool handleMouseButtonDown(const SDL_MouseButtonEvent &event);
|
||||
bool handleKeyDown(const SDL_KeyboardEvent &event);
|
||||
void loadNextModule();
|
||||
float measureFrameTime();
|
||||
void playMusic(const std::string &resRef);
|
||||
void runMainLoop();
|
||||
void toggleInGameCameraType();
|
||||
void updateCamera(float dt);
|
||||
void stopMovement();
|
||||
void changeScreen(GameScreen screen);
|
||||
|
||||
GameID determineGameID(const boost::filesystem::path &path) const;
|
||||
|
||||
void initGUIColors();
|
||||
|
||||
bool handleMouseButtonDown(const SDL_MouseButtonEvent &event);
|
||||
bool handleKeyDown(const SDL_KeyboardEvent &event);
|
||||
|
||||
void updateCamera(float dt);
|
||||
void updateVideo(float dt);
|
||||
void updateMusic();
|
||||
void updateSceneGraph(float dt);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "gameidutil.h"
|
||||
#include "game.h"
|
||||
|
||||
#include "../common/pathutil.h"
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace reone {
|
|||
|
||||
namespace game {
|
||||
|
||||
GameID determineGameID(const fs::path &gameDir) {
|
||||
GameID Game::determineGameID(const fs::path &gameDir) const {
|
||||
// If there is no swkotor2 executable, then this is KotOR
|
||||
fs::path exePath(getPathIgnoreCase(gameDir, "swkotor2.exe", false));
|
||||
if (exePath.empty()) return GameID::KotOR;
|
||||
|
@ -37,8 +37,12 @@ GameID determineGameID(const fs::path &gameDir) {
|
|||
return GameID::TSL;
|
||||
}
|
||||
|
||||
bool isTSL(GameID gameId) {
|
||||
switch (gameId) {
|
||||
bool Game::isKotOR() const {
|
||||
return _gameId == GameID::KotOR;
|
||||
}
|
||||
|
||||
bool Game::isTSL() const {
|
||||
switch (_gameId) {
|
||||
case GameID::TSL:
|
||||
case GameID::TSL_Steam:
|
||||
return true;
|
|
@ -21,13 +21,13 @@
|
|||
|
||||
#include "game.h"
|
||||
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
||||
#include "../common/streamutil.h"
|
||||
#include "../common/streamwriter.h"
|
||||
#include "../graphics/texture/tgawriter.h"
|
||||
#include "../resource/format/erfreader.h"
|
||||
#include "../resource/format/erfwriter.h"
|
||||
#include "../resource/format/gffwriter.h"
|
||||
#include "../scene/pipeline/world.h"
|
||||
|
||||
#include "enginetype/location.h"
|
||||
#include "party.h"
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "barkbubble.h"
|
||||
|
||||
#include "../../gui/control/label.h"
|
||||
|
||||
#include "../game.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -29,8 +27,6 @@ namespace reone {
|
|||
|
||||
namespace game {
|
||||
|
||||
static const char kBarkTextTag[] = "LBL_BARKTEXT";
|
||||
|
||||
BarkBubble::BarkBubble(Game *game) : GameGUI(game) {
|
||||
_resRef = getResRef("barkbubble");
|
||||
_scaling = ScalingMode::PositionRelativeToCenter;
|
||||
|
@ -38,8 +34,14 @@ BarkBubble::BarkBubble(Game *game) : GameGUI(game) {
|
|||
|
||||
void BarkBubble::load() {
|
||||
GUI::load();
|
||||
bindControls();
|
||||
|
||||
_rootControl->setVisible(false);
|
||||
hideControl(kBarkTextTag);
|
||||
_binding.lblBarkText->setVisible(false);
|
||||
}
|
||||
|
||||
void BarkBubble::bindControls() {
|
||||
_binding.lblBarkText = getControlPtr<Label>("LBL_BARKTEXT");
|
||||
}
|
||||
|
||||
void BarkBubble::update(float dt) {
|
||||
|
@ -51,25 +53,22 @@ void BarkBubble::update(float dt) {
|
|||
}
|
||||
|
||||
void BarkBubble::setBarkText(const string &text, float duration) {
|
||||
Label &lblBarkText = getControl<Label>(kBarkTextTag);
|
||||
|
||||
if (text.empty()) {
|
||||
_rootControl->setVisible(false);
|
||||
lblBarkText.setVisible(false);
|
||||
|
||||
_binding.lblBarkText->setVisible(false);
|
||||
} else {
|
||||
float textWidth = lblBarkText.text().font->measure(text);
|
||||
int lineCount = textWidth / static_cast<float>(lblBarkText.extent().width) + 1;
|
||||
int padding = lblBarkText.extent().left;
|
||||
float rootHeight = lineCount * lblBarkText.text().font->height() + 2 * padding;
|
||||
float labelHeight = lineCount * lblBarkText.text().font->height();
|
||||
float textWidth = _binding.lblBarkText->text().font->measure(text);
|
||||
int lineCount = static_cast<int>(textWidth / static_cast<float>(_binding.lblBarkText->extent().width)) + 1;
|
||||
int padding = _binding.lblBarkText->extent().left;
|
||||
float rootHeight = lineCount * _binding.lblBarkText->text().font->height() + 2 * padding;
|
||||
float labelHeight = lineCount * _binding.lblBarkText->text().font->height();
|
||||
|
||||
_rootControl->setVisible(true);
|
||||
_rootControl->setExtentHeight(static_cast<int>(rootHeight));
|
||||
|
||||
lblBarkText.setExtentHeight(static_cast<int>(labelHeight));
|
||||
lblBarkText.setTextMessage(text);
|
||||
lblBarkText.setVisible(true);
|
||||
_binding.lblBarkText->setExtentHeight(static_cast<int>(labelHeight));
|
||||
_binding.lblBarkText->setTextMessage(text);
|
||||
_binding.lblBarkText->setVisible(true);
|
||||
}
|
||||
|
||||
if (duration > 0.0f) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "gui.h"
|
||||
|
||||
#include "../../common/timer.h"
|
||||
#include "../../gui/control/label.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
|
@ -35,8 +36,14 @@ public:
|
|||
void setBarkText(const std::string &text, float duration);
|
||||
|
||||
private:
|
||||
struct Binding {
|
||||
std::shared_ptr<gui::Label> lblBarkText;
|
||||
} _binding;
|
||||
|
||||
std::string _barkText;
|
||||
Timer _timer;
|
||||
|
||||
void bindControls();
|
||||
};
|
||||
|
||||
} // namespace game
|
||||
|
|
|
@ -17,20 +17,12 @@
|
|||
|
||||
#include "abilities.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "glm/common.hpp"
|
||||
|
||||
#include "../../../gui/control/listbox.h"
|
||||
#include "../../../resource/strings.h"
|
||||
|
||||
#include "../../d20/classes.h"
|
||||
#include "../../game.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
#include "chargen.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -81,7 +73,7 @@ void CharGenAbilities::load() {
|
|||
for (auto &label : labels) {
|
||||
configureControl(label, [this](Control &control) {
|
||||
control.setFocusable(true);
|
||||
control.setHilightColor(getBaseColor(_game->gameId()));
|
||||
control.setHilightColor(_game->getGUIColorBase());
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -17,19 +17,14 @@
|
|||
|
||||
#include "chargen.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "../../../gui/scenebuilder.h"
|
||||
#include "../../../graphics/model/models.h"
|
||||
#include "../../../resource/resources.h"
|
||||
|
||||
#include "../../d20/classes.h"
|
||||
#include "../../game.h"
|
||||
#include "../../gameidutil.h"
|
||||
#include "../../portraits.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
||||
|
@ -329,7 +324,7 @@ void CharacterGeneration::finish() {
|
|||
party.addMember(kNpcPlayer, player);
|
||||
party.setPlayer(player);
|
||||
|
||||
string moduleName(_game->gameId() == GameID::KotOR ? "end_m01aa" : "001ebo");
|
||||
string moduleName(_game->id() == GameID::KotOR ? "end_m01aa" : "001ebo");
|
||||
_game->loadModule(moduleName);
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +399,7 @@ void CharacterGeneration::updateAttributes() {
|
|||
|
||||
const SavingThrows &throws = clazz->getSavingThrows(1);
|
||||
|
||||
if (isTSL(_game->gameId())) {
|
||||
if (_game->isTSL()) {
|
||||
setControlText("NEW_FORT_LBL", to_string(throws.fortitude));
|
||||
setControlText("NEW_REFL_LBL", to_string(throws.reflex));
|
||||
setControlText("NEW_WILL_LBL", to_string(throws.will));
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../../../scene/node/modelnode.h"
|
||||
#include "../../../scene/node/model.h"
|
||||
#include "../../../scene/scenegraph.h"
|
||||
|
||||
#include "../../character.h"
|
||||
|
|
|
@ -24,11 +24,8 @@
|
|||
|
||||
#include "../../d20/classes.h"
|
||||
#include "../../game.h"
|
||||
#include "../../gameidutil.h"
|
||||
#include "../../object/creature.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
#include "chargen.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -62,7 +59,7 @@ static map<ClassType, int> g_classDescStrRefs {
|
|||
ClassSelection::ClassSelection(Game *game) : GameGUI(game) {
|
||||
_resRef = getResRef("classsel");
|
||||
|
||||
if (game->gameId() == GameID::KotOR) {
|
||||
if (game->id() == GameID::KotOR) {
|
||||
loadBackground(BackgroundType::Menu);
|
||||
}
|
||||
|
||||
|
@ -83,12 +80,12 @@ void ClassSelection::setupClassButtons() {
|
|||
_enlargedButtonSize = glm::vec2(button1.extent().width, button1.extent().height);
|
||||
_defaultButtonSize = glm::vec2(button2.extent().width, button2.extent().height);
|
||||
|
||||
setupClassButton(0, Gender::Male, _game->gameId() == GameID::KotOR ? ClassType::Scoundrel : ClassType::JediConsular);
|
||||
setupClassButton(1, Gender::Male, _game->gameId() == GameID::KotOR ? ClassType::Scout : ClassType::JediSentinel);
|
||||
setupClassButton(2, Gender::Male, _game->gameId() == GameID::KotOR ? ClassType::Soldier : ClassType::JediGuardian);
|
||||
setupClassButton(3, Gender::Female, _game->gameId() == GameID::KotOR ? ClassType::Soldier : ClassType::JediGuardian);
|
||||
setupClassButton(4, Gender::Female, _game->gameId() == GameID::KotOR ? ClassType::Scout : ClassType::JediSentinel);
|
||||
setupClassButton(5, Gender::Female, _game->gameId() == GameID::KotOR ? ClassType::Scoundrel : ClassType::JediConsular);
|
||||
setupClassButton(0, Gender::Male, _game->id() == GameID::KotOR ? ClassType::Scoundrel : ClassType::JediConsular);
|
||||
setupClassButton(1, Gender::Male, _game->id() == GameID::KotOR ? ClassType::Scout : ClassType::JediSentinel);
|
||||
setupClassButton(2, Gender::Male, _game->id() == GameID::KotOR ? ClassType::Soldier : ClassType::JediGuardian);
|
||||
setupClassButton(3, Gender::Female, _game->id() == GameID::KotOR ? ClassType::Soldier : ClassType::JediGuardian);
|
||||
setupClassButton(4, Gender::Female, _game->id() == GameID::KotOR ? ClassType::Scout : ClassType::JediSentinel);
|
||||
setupClassButton(5, Gender::Female, _game->id() == GameID::KotOR ? ClassType::Scoundrel : ClassType::JediConsular);
|
||||
|
||||
setClassButtonEnlarged(0, false);
|
||||
}
|
||||
|
@ -187,8 +184,8 @@ shared_ptr<ModelSceneNode> ClassSelection::getCharacterModel(int appearance, Sce
|
|||
}
|
||||
|
||||
void ClassSelection::setButtonColors(Control &control) {
|
||||
control.setBorderColor(getBaseColor(_game->gameId()));
|
||||
control.setHilightColor(getHilightColor(_game->gameId()));
|
||||
control.setBorderColor(_game->getGUIColorBase());
|
||||
control.setHilightColor(_game->getGUIColorHilight());
|
||||
}
|
||||
|
||||
void ClassSelection::setClassButtonEnlarged(int index, bool enlarged) {
|
||||
|
|
|
@ -17,12 +17,8 @@
|
|||
|
||||
#include "custom.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../../game.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
#include "chargen.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -48,7 +44,7 @@ void CustomCharacterGeneration::load() {
|
|||
GUI::load();
|
||||
doSetStep(0);
|
||||
|
||||
if (_game->gameId() == GameID::KotOR) {
|
||||
if (_game->id() == GameID::KotOR) {
|
||||
setControlDiscardColor("LBL_BG", glm::vec3(0.0f, 0.0f, 0.082353f));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "feats.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
#include "chargen.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,12 +17,8 @@
|
|||
|
||||
#include "levelup.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../../game.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
using namespace reone::gui;
|
||||
using namespace reone::graphics;
|
||||
using namespace reone::resource;
|
||||
|
@ -44,7 +40,7 @@ void LevelUpMenu::load() {
|
|||
GUI::load();
|
||||
doSetStep(0);
|
||||
|
||||
if (_game->gameId() == GameID::KotOR) {
|
||||
if (_game->id() == GameID::KotOR) {
|
||||
setControlDiscardColor("LBL_DECORATION", glm::vec3(0.0f, 0.0f, 0.082353f));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
#include "../../game.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
#include "chargen.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue