Compare commits
4 commits
master
...
extract-sc
Author | SHA1 | Date | |
---|---|---|---|
6ce883eac2 | |||
d619b92504 | |||
5c366d1f02 | |||
cb17043e41 |
440 changed files with 2979 additions and 3037 deletions
107
CMakeLists.txt
107
CMakeLists.txt
|
@ -13,11 +13,9 @@
|
|||
# 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.16)
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(reone)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
add_subdirectory(src/external/s3tc)
|
||||
|
||||
option(BUILD_TOOLS "build tools executable" ON)
|
||||
|
@ -27,7 +25,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 OPTIONAL_COMPONENTS unit_test_framework)
|
||||
find_package(Boost REQUIRED COMPONENTS filesystem program_options system)
|
||||
find_package(OpenGL REQUIRED)
|
||||
find_package(GLEW REQUIRED)
|
||||
find_package(MAD REQUIRED)
|
||||
|
@ -69,6 +67,7 @@ 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
|
||||
|
@ -79,6 +78,7 @@ 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,7 +86,6 @@ 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
|
||||
|
||||
|
@ -155,7 +154,6 @@ 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
|
||||
|
||||
|
@ -253,7 +251,6 @@ 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
|
||||
|
||||
|
@ -283,7 +280,6 @@ 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
|
||||
|
||||
|
@ -299,7 +295,6 @@ 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
|
||||
|
||||
|
@ -308,14 +303,14 @@ target_precompile_headers(libvideo PRIVATE src/engine/pch.h)
|
|||
set(SCENE_HEADERS
|
||||
src/engine/scene/animeventlistener.h
|
||||
src/engine/scene/animproperties.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/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/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
|
||||
|
@ -325,14 +320,14 @@ set(SCENE_HEADERS
|
|||
src/engine/scene/types.h)
|
||||
|
||||
set(SCENE_SOURCES
|
||||
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/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/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
|
||||
|
@ -341,7 +336,6 @@ 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
|
||||
|
||||
|
@ -356,7 +350,6 @@ 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
|
||||
|
@ -371,7 +364,6 @@ 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
|
||||
|
@ -380,7 +372,6 @@ 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
|
||||
|
||||
|
@ -389,13 +380,10 @@ target_precompile_headers(libgui PRIVATE src/engine/pch.h)
|
|||
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
|
||||
|
@ -413,7 +401,6 @@ 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
|
||||
|
||||
|
@ -421,7 +408,7 @@ target_precompile_headers(libscript PRIVATE src/engine/pch.h)
|
|||
|
||||
set(GAME_HEADERS
|
||||
src/engine/game/action/action.h
|
||||
src/engine/game/action/docommand.h
|
||||
src/engine/game/action/commandaction.h
|
||||
src/engine/game/action/follow.h
|
||||
src/engine/game/action/locationaction.h
|
||||
src/engine/game/action/movetolocation.h
|
||||
|
@ -432,14 +419,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/wait.h
|
||||
src/engine/game/action/waitaction.h
|
||||
src/engine/game/animationutil.h
|
||||
src/engine/game/camera/animated.h
|
||||
src/engine/game/camera/animatedcamera.h
|
||||
src/engine/game/camera/camera.h
|
||||
src/engine/game/camera/camerastyle.h
|
||||
src/engine/game/camera/dialog.h
|
||||
src/engine/game/camera/dialogcamera.h
|
||||
src/engine/game/camera/firstperson.h
|
||||
src/engine/game/camera/static.h
|
||||
src/engine/game/camera/staticcamera.h
|
||||
src/engine/game/camera/thirdperson.h
|
||||
src/engine/game/character.h
|
||||
src/engine/game/console.h
|
||||
|
@ -463,6 +450,7 @@ 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
|
||||
|
@ -475,6 +463,7 @@ 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
|
||||
|
@ -535,12 +524,12 @@ set(GAME_HEADERS
|
|||
set(GAME_SOURCES
|
||||
src/engine/game/actionexecutor.cpp
|
||||
src/engine/game/animationutil.cpp
|
||||
src/engine/game/camera/animated.cpp
|
||||
src/engine/game/camera/animatedcamera.cpp
|
||||
src/engine/game/camera/camera.cpp
|
||||
src/engine/game/camera/camerastyle.cpp
|
||||
src/engine/game/camera/dialog.cpp
|
||||
src/engine/game/camera/dialogcamera.cpp
|
||||
src/engine/game/camera/firstperson.cpp
|
||||
src/engine/game/camera/static.cpp
|
||||
src/engine/game/camera/staticcamera.cpp
|
||||
src/engine/game/camera/thirdperson.cpp
|
||||
src/engine/game/combat/combat.cpp
|
||||
src/engine/game/combat/combat_attack.cpp
|
||||
|
@ -560,10 +549,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
|
||||
|
@ -576,6 +565,7 @@ 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
|
||||
|
@ -665,7 +655,6 @@ 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
|
||||
|
||||
|
@ -673,7 +662,6 @@ target_precompile_headers(libgame PRIVATE src/engine/pch.h)
|
|||
|
||||
set(REONE_HEADERS
|
||||
src/engine/engine.h
|
||||
src/engine/pch.h
|
||||
src/engine/program.h)
|
||||
|
||||
set(REONE_SOURCES
|
||||
|
@ -687,7 +675,6 @@ 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
|
||||
|
@ -732,7 +719,6 @@ 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
|
||||
|
@ -774,7 +760,6 @@ 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")
|
||||
|
@ -787,25 +772,21 @@ 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()
|
||||
add_test(reone-tests reone-tests)
|
||||
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()
|
||||
endif()
|
||||
|
||||
## END Unit tests
|
||||
|
|
17
README.md
17
README.md
|
@ -1,21 +1,14 @@
|
|||
# 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 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.
|
||||
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.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
@ -39,15 +32,15 @@ Install [Visual C++ Redistributable](https://aka.ms/vs/16/release/vc_redist.x64.
|
|||
|
||||
## Usage
|
||||
|
||||
Launch reone using the launcher application or from the command line:
|
||||
Launch reone either using the launcher application, or from the command line:
|
||||
|
||||
`reone --game C:\swkotor`
|
||||
|
||||
## Configuration
|
||||
|
||||
reone can be configured via the launcher, the configuration file or the command line.
|
||||
reone can be configured from either the launcher, the configuration file, or the command line.
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
## Similar Projects
|
||||
|
||||
|
|
|
@ -18,11 +18,9 @@
|
|||
#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,20 +17,17 @@
|
|||
|
||||
#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,8 +17,6 @@
|
|||
|
||||
#include "mp3reader.h"
|
||||
|
||||
#include "../stream.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,16 +17,19 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "mad.h"
|
||||
|
||||
#include "../../common/types.h"
|
||||
#include "../stream.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace audio {
|
||||
|
||||
class AudioStream;
|
||||
|
||||
class Mp3Reader : boost::noncopyable {
|
||||
public:
|
||||
void load(const std::shared_ptr<std::istream> &stream);
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
#include "wavreader.h"
|
||||
|
||||
#include "../../common/streamutil.h"
|
||||
#include <utility>
|
||||
|
||||
#include "../stream.h"
|
||||
#include "../../common/streamutil.h"
|
||||
|
||||
#include "mp3reader.h"
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "../../resource/format/binreader.h"
|
||||
|
||||
#include "../types.h"
|
||||
#include "../stream.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
|
@ -30,8 +30,6 @@ enum class WavAudioFormat {
|
|||
IMAADPCM = 0x11
|
||||
};
|
||||
|
||||
class AudioStream;
|
||||
|
||||
class WavReader : public resource::BinaryReader {
|
||||
public:
|
||||
WavReader();
|
||||
|
|
|
@ -17,12 +17,20 @@
|
|||
|
||||
#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;
|
||||
|
||||
|
@ -33,7 +41,8 @@ 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) {
|
||||
AudioPlayer::AudioPlayer(AudioOptions opts, AudioFiles *files) : _opts(move(opts)), _files(files) {
|
||||
ensureNotNull(files, "files");
|
||||
}
|
||||
|
||||
void AudioPlayer::init() {
|
||||
|
@ -108,7 +117,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,21 +17,33 @@
|
|||
|
||||
#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 "types.h"
|
||||
#include "soundinstance.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();
|
||||
|
@ -44,7 +56,7 @@ public:
|
|||
|
||||
private:
|
||||
AudioOptions _opts;
|
||||
AudioFiles &_files;
|
||||
AudioFiles *_files;
|
||||
|
||||
ALCdevice *_device { nullptr };
|
||||
ALCcontext *_context { nullptr };
|
||||
|
|
|
@ -17,11 +17,6 @@
|
|||
|
||||
#include "services.h"
|
||||
|
||||
#include "../resource/services.h"
|
||||
|
||||
#include "files.h"
|
||||
#include "player.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace reone::resource;
|
||||
|
@ -38,7 +33,7 @@ AudioServices::AudioServices(AudioOptions options, ResourceServices &resource) :
|
|||
void AudioServices::init() {
|
||||
_files = make_unique<AudioFiles>(_resource.resources());
|
||||
|
||||
_player = make_unique<AudioPlayer>(_options, *_files);
|
||||
_player = make_unique<AudioPlayer>(_options, _files.get());
|
||||
_player->init();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,21 +17,20 @@
|
|||
|
||||
#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,6 +17,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace audio {
|
||||
|
|
|
@ -17,11 +17,14 @@
|
|||
|
||||
#include "soundinstance.h"
|
||||
|
||||
#include "../common/guardutil.h"
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
#include "AL/al.h"
|
||||
|
||||
#include "../common/log.h"
|
||||
|
||||
#include "soundhandle.h"
|
||||
#include "stream.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -31,14 +34,12 @@ namespace audio {
|
|||
|
||||
static constexpr int kMaxBufferCount = 8;
|
||||
|
||||
SoundInstance::SoundInstance(shared_ptr<AudioStream> stream, bool loop, float gain, bool positional, glm::vec3 position) :
|
||||
SoundInstance::SoundInstance(const 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,16 +17,24 @@
|
|||
|
||||
#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(std::shared_ptr<AudioStream> stream, bool loop, float gain, bool positional, glm::vec3 position);
|
||||
SoundInstance(const std::shared_ptr<AudioStream> &stream, bool loop, float gain, bool positional, glm::vec3 position);
|
||||
SoundInstance(SoundInstance &&) = default;
|
||||
~SoundInstance();
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
#include "stream.h"
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
#include "AL/al.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../common/types.h"
|
||||
|
||||
#include "types.h"
|
||||
|
|
|
@ -17,6 +17,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "guardutil.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace reone {
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace reone {
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
#include "log.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,6 +17,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
namespace reone {
|
||||
|
||||
template <class Frame>
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#include "pathutil.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "log.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#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,6 +17,9 @@
|
|||
|
||||
#include "random.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <random>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -15,23 +15,19 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "stopwatch.h"
|
||||
|
||||
#include "SDL2/SDL_timer.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace script {
|
||||
Stopwatch::Stopwatch() :
|
||||
_frequency(SDL_GetPerformanceFrequency()),
|
||||
_counter(SDL_GetPerformanceCounter()) {
|
||||
}
|
||||
|
||||
struct Variable;
|
||||
float Stopwatch::getElapsedTime() {
|
||||
return (SDL_GetPerformanceCounter() - _counter) / static_cast<float>(_frequency);
|
||||
}
|
||||
|
||||
class ScriptProgram;
|
||||
|
||||
struct ExecutionState {
|
||||
std::shared_ptr<ScriptProgram> program;
|
||||
std::vector<Variable> globals;
|
||||
std::vector<Variable> locals;
|
||||
uint32_t insOffset { 0 };
|
||||
};
|
||||
|
||||
} // namespace script
|
||||
|
||||
} // namespae reone
|
||||
} // namespace reone
|
|
@ -17,20 +17,25 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace script {
|
||||
|
||||
class Routine;
|
||||
|
||||
class IRoutineProvider {
|
||||
/**
|
||||
* Utility class for use in profiling.
|
||||
*/
|
||||
class Stopwatch {
|
||||
public:
|
||||
virtual ~IRoutineProvider() {
|
||||
}
|
||||
Stopwatch();
|
||||
|
||||
virtual const Routine &get(int index) = 0;
|
||||
/**
|
||||
* @return time in seconds, that elapsed from creation of this instance
|
||||
*/
|
||||
float getElapsedTime();
|
||||
|
||||
private:
|
||||
uint64_t _frequency { 0 };
|
||||
uint64_t _counter { 0 };
|
||||
};
|
||||
|
||||
} // namespace script
|
||||
|
||||
} // namespae reone
|
||||
} // namespace reone
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#include "streamreader.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "guardutil.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,6 +17,15 @@
|
|||
|
||||
#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,6 +17,8 @@
|
|||
|
||||
#include "streamutil.h"
|
||||
|
||||
#include <boost/iostreams/stream.hpp>
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace io = boost::iostreams;
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
#include <memory>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "streamwriter.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include "guardutil.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,6 +17,15 @@
|
|||
|
||||
#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,6 +17,8 @@
|
|||
|
||||
#include "timer.h"
|
||||
|
||||
#include "glm/common.hpp"
|
||||
|
||||
namespace reone {
|
||||
|
||||
Timer::Timer(float timeout) {
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace reone {
|
||||
|
||||
struct DebugChannels {
|
||||
|
|
|
@ -17,25 +17,11 @@
|
|||
|
||||
#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,6 +17,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "game/options.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -19,14 +19,10 @@
|
|||
|
||||
#include "action.h"
|
||||
|
||||
#include "../../script/types.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace script {
|
||||
|
||||
struct ExecutionContext;
|
||||
|
||||
}
|
||||
|
||||
namespace game {
|
||||
|
||||
class CommandAction : public Action {
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "action.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "action.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
#include "../../common/guardutil.h"
|
||||
|
||||
#include "action.h"
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "objectaction.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "glm/common.hpp"
|
||||
|
||||
#include "../../common/timer.h"
|
||||
|
||||
#include "action.h"
|
|
@ -17,15 +17,18 @@
|
|||
|
||||
#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/wait.h"
|
||||
#include "action/waitaction.h"
|
||||
#include "enginetype/location.h"
|
||||
#include "game.h"
|
||||
#include "object/area.h"
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "action/docommand.h"
|
||||
#include "action/commandaction.h"
|
||||
#include "action/follow.h"
|
||||
#include "action/locationaction.h"
|
||||
#include "action/movetolocation.h"
|
||||
|
|
|
@ -15,11 +15,16 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "animated.h"
|
||||
#include "animatedcamera.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "../../graphics/types.h"
|
||||
#include "../../scene/node/camera.h"
|
||||
#include "../../scene/node/model.h"
|
||||
#include "../../graphics/model/models.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../scene/node/cameranode.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -69,12 +74,12 @@ bool AnimatedCamera::isAnimationFinished() const {
|
|||
return _model ? _model->isAnimationFinished() : false;
|
||||
}
|
||||
|
||||
void AnimatedCamera::setModel(shared_ptr<Model> model) {
|
||||
void AnimatedCamera::setModel(const shared_ptr<Model> &model) {
|
||||
if ((_model && _model->model() == model) ||
|
||||
(!_model && !model)) return;
|
||||
|
||||
if (model) {
|
||||
_model = make_unique<ModelSceneNode>(move(model), ModelUsage::Camera, _sceneGraph);
|
||||
_model = make_unique<ModelSceneNode>(model, ModelUsage::Camera, _sceneGraph);
|
||||
_model->attach("camerahook", _sceneNode);
|
||||
} else {
|
||||
_model.reset();
|
|
@ -17,22 +17,17 @@
|
|||
|
||||
#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;
|
||||
|
@ -47,7 +42,7 @@ public:
|
|||
|
||||
bool isAnimationFinished() const;
|
||||
|
||||
void setModel(std::shared_ptr<graphics::Model> model);
|
||||
void setModel(const std::shared_ptr<graphics::Model> &model);
|
||||
void setFieldOfView(float fovy);
|
||||
|
||||
private:
|
|
@ -17,15 +17,16 @@
|
|||
|
||||
#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,7 +17,6 @@
|
|||
|
||||
#include "camerastyle.h"
|
||||
|
||||
#include "../../resource/2da.h"
|
||||
#include "../../resource/resources.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,14 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "../../resource/2da.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace resource {
|
||||
|
||||
class TwoDA;
|
||||
|
||||
}
|
||||
|
||||
namespace game {
|
||||
|
||||
struct CameraStyle {
|
||||
|
|
|
@ -15,10 +15,9 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "dialog.h"
|
||||
#include "dialogcamera.h"
|
||||
|
||||
#include "../../graphics/types.h"
|
||||
#include "../../scene/node/camera.h"
|
||||
#include "glm/ext.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -34,16 +33,16 @@ DialogCamera::DialogCamera(float aspect, const CameraStyle &style, SceneGraph *s
|
|||
_sceneNode = make_shared<CameraSceneNode>("", move(projection), sceneGraph);
|
||||
}
|
||||
|
||||
void DialogCamera::setSpeakerPosition(glm::vec3 position) {
|
||||
void DialogCamera::setSpeakerPosition(const glm::vec3 &position) {
|
||||
if (_speakerPosition != position) {
|
||||
_speakerPosition = move(position);
|
||||
_speakerPosition = position;
|
||||
updateSceneNode();
|
||||
}
|
||||
}
|
||||
|
||||
void DialogCamera::setListenerPosition(glm::vec3 position) {
|
||||
void DialogCamera::setListenerPosition(const glm::vec3 &position) {
|
||||
if (_listenerPosition != position) {
|
||||
_listenerPosition = move(position);
|
||||
_listenerPosition = position;
|
||||
updateSceneNode();
|
||||
}
|
||||
}
|
||||
|
@ -55,8 +54,8 @@ void DialogCamera::setVariant(Variant variant) {
|
|||
}
|
||||
}
|
||||
|
||||
void DialogCamera::setFindObstacle(function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> fn) {
|
||||
_findObstacle = move(fn);
|
||||
void DialogCamera::setFindObstacle(const function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> &fn) {
|
||||
_findObstacle = fn;
|
||||
}
|
||||
|
||||
void DialogCamera::updateSceneNode() {
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "../../scene/scenegraph.h"
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
#include "camera.h"
|
||||
|
@ -38,10 +42,10 @@ public:
|
|||
|
||||
DialogCamera(float aspect, const CameraStyle &style, scene::SceneGraph *sceneGraph);
|
||||
|
||||
void setSpeakerPosition(glm::vec3 position);
|
||||
void setListenerPosition(glm::vec3 position);
|
||||
void setSpeakerPosition(const glm::vec3 &position);
|
||||
void setListenerPosition(const glm::vec3 &position);
|
||||
void setVariant(Variant variant);
|
||||
void setFindObstacle(std::function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> fn);
|
||||
void setFindObstacle(const std::function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> &fn);
|
||||
|
||||
private:
|
||||
glm::vec3 _speakerPosition { 0.0f };
|
|
@ -17,8 +17,9 @@
|
|||
|
||||
#include "firstperson.h"
|
||||
|
||||
#include "glm/ext.hpp"
|
||||
|
||||
#include "../../graphics/types.h"
|
||||
#include "../../scene/node/camera.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -44,10 +44,9 @@ 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,7 +15,9 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "static.h"
|
||||
#include "staticcamera.h"
|
||||
|
||||
#include "glm/ext.hpp"
|
||||
|
||||
#include "../object/placeablecamera.h"
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
#include "thirdperson.h"
|
||||
|
||||
#include "../../scene/node/camera.h"
|
||||
#include "glm/ext.hpp"
|
||||
|
||||
#include "../game.h"
|
||||
|
||||
|
@ -175,8 +175,8 @@ void ThirdPersonCamera::stopMovement() {
|
|||
_mouseLookMode = false;
|
||||
}
|
||||
|
||||
void ThirdPersonCamera::setTargetPosition(glm::vec3 position) {
|
||||
_targetPosition = move(position);
|
||||
void ThirdPersonCamera::setTargetPosition(const glm::vec3 &position) {
|
||||
_targetPosition = position;
|
||||
updateSceneNode();
|
||||
}
|
||||
|
||||
|
@ -189,8 +189,8 @@ void ThirdPersonCamera::setFindObstacle(const function<bool(const glm::vec3 &, c
|
|||
_findObstacle = fn;
|
||||
}
|
||||
|
||||
void ThirdPersonCamera::setStyle(CameraStyle style) {
|
||||
_style = move(style);
|
||||
void ThirdPersonCamera::setStyle(const CameraStyle &style) {
|
||||
_style = style;
|
||||
updateSceneNode();
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
#include "camera.h"
|
||||
#include "camerastyle.h"
|
||||
|
||||
|
@ -34,10 +38,10 @@ public:
|
|||
void update(float dt) override;
|
||||
void stopMovement() override;
|
||||
|
||||
void setTargetPosition(glm::vec3 position);
|
||||
void setTargetPosition(const glm::vec3 &position);
|
||||
void setFacing(float facing);
|
||||
void setFindObstacle(const std::function<bool(const glm::vec3 &, const glm::vec3 &, glm::vec3 &)> &fn);
|
||||
void setStyle(CameraStyle style);
|
||||
void setStyle(const CameraStyle& style);
|
||||
|
||||
private:
|
||||
Game *_game;
|
||||
|
|
|
@ -17,6 +17,12 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <queue>
|
||||
#include <set>
|
||||
|
||||
#include "../../common/timer.h"
|
||||
#include "../../scene/services.h"
|
||||
|
||||
|
@ -114,7 +120,7 @@ private:
|
|||
|
||||
// Damage
|
||||
|
||||
std::vector<std::shared_ptr<DamageEffect>> getDamageEffects(std::shared_ptr<Creature> damager, bool offHand = false, int multiplier = 1) const;
|
||||
std::vector<std::shared_ptr<DamageEffect>> getDamageEffects(std::shared_ptr<Creature> damager, bool offHand = false, float multiplier = 1.0f) const;
|
||||
|
||||
// END Damage
|
||||
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#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, int multiplier) const {
|
||||
vector<shared_ptr<DamageEffect>> Combat::getDamageEffects(shared_ptr<Creature> damager, bool offHand, float multiplier) const {
|
||||
shared_ptr<Item> weapon(damager->getEquippedItem(offHand ? InventorySlot::leftWeapon : InventorySlot::rightWeapon));
|
||||
int amount = 0;
|
||||
auto type = DamageType::Bludgeoning;
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
|
||||
#include "combat.h"
|
||||
|
||||
#include "glm/gtx/euler_angles.hpp"
|
||||
#include "glm/gtx/transform.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
using namespace reone::graphics;
|
||||
|
|
|
@ -17,10 +17,16 @@
|
|||
|
||||
#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,6 +17,17 @@
|
|||
|
||||
#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,12 +17,10 @@
|
|||
|
||||
#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,24 +17,19 @@
|
|||
|
||||
#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,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <vector>
|
||||
|
||||
#include "../types.h"
|
||||
|
||||
#include "savingthrows.h"
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "attributes.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "classes.h"
|
||||
|
||||
using namespace std;
|
||||
|
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
#include "class.h"
|
||||
|
||||
#include "../../resource/2da.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../resource/strings.h"
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "classes.h"
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <vector>
|
||||
|
||||
#include "../../resource/format/2dareader.h"
|
||||
#include "../../resource/services.h"
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
#include "classes.h"
|
||||
|
||||
#include "../../resource/resources.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#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,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../../graphics/texture/textures.h"
|
||||
#include "../../resource/services.h"
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "../../graphics/texture/texture.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -18,10 +18,6 @@
|
|||
#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,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../../graphics/services.h"
|
||||
#include "../../resource/services.h"
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "../../graphics/texture/texture.h"
|
||||
|
||||
#include "../types.h"
|
||||
|
|
|
@ -18,9 +18,6 @@
|
|||
#include "spells.h"
|
||||
|
||||
#include "../../common/collectionutil.h"
|
||||
#include "../../resource/2da.h"
|
||||
#include "../../resource/resources.h"
|
||||
#include "../../resource/strings.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../../graphics/texture/textures.h"
|
||||
#include "../../resource/services.h"
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#include "dialog.h"
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../common/guardutil.h"
|
||||
#include "../resource/strings.h"
|
||||
|
||||
|
|
|
@ -17,6 +17,11 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/noncopyable.hpp>
|
||||
|
||||
#include "../resource/format/gffreader.h"
|
||||
#include "../resource/strings.h"
|
||||
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "glm/common.hpp"
|
||||
|
||||
#include "../../script/enginetype.h"
|
||||
|
||||
#include "../types.h"
|
||||
|
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "glm/vec3.hpp"
|
||||
|
||||
#include "../../script/enginetype.h"
|
||||
|
||||
namespace reone {
|
||||
|
|
|
@ -17,8 +17,9 @@
|
|||
|
||||
#include "footstepsounds.h"
|
||||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
#include "../common/guardutil.h"
|
||||
#include "../resource/2da.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace std::placeholders;
|
||||
|
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "../audio/files.h"
|
||||
#include "../audio/stream.h"
|
||||
#include "../common/cache.h"
|
||||
|
|
|
@ -17,19 +17,16 @@
|
|||
|
||||
#include "game.h"
|
||||
|
||||
#include "../audio/player.h"
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "SDL2/SDL_timer.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;
|
||||
|
@ -88,7 +85,6 @@ int Game::run() {
|
|||
void Game::init() {
|
||||
_gameId = determineGameID(_path);
|
||||
|
||||
initGUIColors();
|
||||
initResourceProviders();
|
||||
|
||||
_game = make_unique<GameServices>(*this, _resource, _graphics, _audio, _scene, _script);
|
||||
|
@ -107,20 +103,8 @@ 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()) {
|
||||
if (isTSL(_gameId)) {
|
||||
initResourceProvidersForTSL();
|
||||
} else {
|
||||
initResourceProvidersForKotOR();
|
||||
|
@ -190,7 +174,7 @@ void Game::changeScreen(GameScreen screen) {
|
|||
}
|
||||
|
||||
string Game::getMainMenuMusic() const {
|
||||
return isTSL() ? "mus_sion" : "mus_theme_cult";
|
||||
return isTSL(_gameId) ? "mus_sion" : "mus_theme_cult";
|
||||
}
|
||||
|
||||
void Game::playMusic(const string &resRef) {
|
||||
|
@ -306,7 +290,7 @@ void Game::loadModuleResources(const string &moduleName) {
|
|||
fs::path lipsPath(getPathIgnoreCase(_path, kLipsDirectoryName));
|
||||
_resource.resources().indexErfFile(getPathIgnoreCase(lipsPath, moduleName + "_loc.mod"), true);
|
||||
|
||||
if (isTSL()) {
|
||||
if (isTSL(_gameId)) {
|
||||
_resource.resources().indexErfFile(getPathIgnoreCase(modulesPath, moduleName + "_dlg.erf"), true);
|
||||
}
|
||||
}
|
||||
|
@ -556,7 +540,7 @@ void Game::deinit() {
|
|||
}
|
||||
|
||||
void Game::startCharacterGeneration() {
|
||||
string imageResRef(isTSL() ? "load_default" : "load_chargen");
|
||||
string imageResRef(isTSL(_gameId) ? "load_default" : "load_chargen");
|
||||
withLoadingScreen(imageResRef, [this]() {
|
||||
if (!_charGen) {
|
||||
loadCharacterGeneration();
|
||||
|
@ -569,7 +553,7 @@ void Game::startCharacterGeneration() {
|
|||
}
|
||||
|
||||
string Game::getCharacterGenerationMusic() const {
|
||||
return isTSL() ? "mus_main" : "mus_theme_rep";
|
||||
return isTSL(_gameId) ? "mus_main" : "mus_theme_rep";
|
||||
}
|
||||
|
||||
void Game::quit() {
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
|
||||
#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"
|
||||
|
@ -96,7 +103,7 @@ public:
|
|||
Camera *getActiveCamera() const;
|
||||
std::shared_ptr<Object> getObjectById(uint32_t id) const;
|
||||
|
||||
GameID id() const { return _gameId; }
|
||||
GameID gameId() const { return _gameId; }
|
||||
const Options &options() const { return _options; }
|
||||
GameServices &services() { return *_game; }
|
||||
std::shared_ptr<Module> module() const { return _module; }
|
||||
|
@ -111,13 +118,6 @@ public:
|
|||
void setPaused(bool paused);
|
||||
void setRelativeMouseMode(bool relative);
|
||||
|
||||
// Game ID
|
||||
|
||||
bool isKotOR() const;
|
||||
bool isTSL() const;
|
||||
|
||||
// END Game ID
|
||||
|
||||
// Module loading
|
||||
|
||||
/**
|
||||
|
@ -174,14 +174,6 @@ 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;
|
||||
|
@ -255,10 +247,6 @@ 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
|
||||
|
@ -283,22 +271,16 @@ 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);
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "game.h"
|
||||
#include "gameidutil.h"
|
||||
|
||||
#include "../common/pathutil.h"
|
||||
|
||||
|
@ -25,7 +25,7 @@ namespace reone {
|
|||
|
||||
namespace game {
|
||||
|
||||
GameID Game::determineGameID(const fs::path &gameDir) const {
|
||||
GameID determineGameID(const fs::path &gameDir) {
|
||||
// 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,12 +37,8 @@ GameID Game::determineGameID(const fs::path &gameDir) const {
|
|||
return GameID::TSL;
|
||||
}
|
||||
|
||||
bool Game::isKotOR() const {
|
||||
return _gameId == GameID::KotOR;
|
||||
}
|
||||
|
||||
bool Game::isTSL() const {
|
||||
switch (_gameId) {
|
||||
bool isTSL(GameID gameId) {
|
||||
switch (gameId) {
|
||||
case GameID::TSL:
|
||||
case GameID::TSL_Steam:
|
||||
return true;
|
|
@ -15,17 +15,23 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "slider.h"
|
||||
#pragma once
|
||||
|
||||
#include "../../graphics/renderbuffer.h"
|
||||
#include <boost/filesystem/path.hpp>
|
||||
|
||||
#include "types.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
namespace gui {
|
||||
namespace game {
|
||||
|
||||
Slider::Slider(GUI *gui) : Control(gui, ControlType::Slider) {
|
||||
}
|
||||
/**
|
||||
* @return GameID determined from the specified game directory
|
||||
*/
|
||||
GameID determineGameID(const boost::filesystem::path &gameDir);
|
||||
|
||||
} // namespace gui
|
||||
bool isTSL(GameID gameId);
|
||||
|
||||
} // namespace game
|
||||
|
||||
} // namespace reone
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
#include "barkbubble.h"
|
||||
|
||||
#include "../../gui/control/label.h"
|
||||
|
||||
#include "../game.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -27,6 +29,8 @@ namespace reone {
|
|||
|
||||
namespace game {
|
||||
|
||||
static const char kBarkTextTag[] = "LBL_BARKTEXT";
|
||||
|
||||
BarkBubble::BarkBubble(Game *game) : GameGUI(game) {
|
||||
_resRef = getResRef("barkbubble");
|
||||
_scaling = ScalingMode::PositionRelativeToCenter;
|
||||
|
@ -34,14 +38,8 @@ BarkBubble::BarkBubble(Game *game) : GameGUI(game) {
|
|||
|
||||
void BarkBubble::load() {
|
||||
GUI::load();
|
||||
bindControls();
|
||||
|
||||
_rootControl->setVisible(false);
|
||||
_binding.lblBarkText->setVisible(false);
|
||||
}
|
||||
|
||||
void BarkBubble::bindControls() {
|
||||
_binding.lblBarkText = getControlPtr<Label>("LBL_BARKTEXT");
|
||||
hideControl(kBarkTextTag);
|
||||
}
|
||||
|
||||
void BarkBubble::update(float dt) {
|
||||
|
@ -53,22 +51,25 @@ void BarkBubble::update(float dt) {
|
|||
}
|
||||
|
||||
void BarkBubble::setBarkText(const string &text, float duration) {
|
||||
Label &lblBarkText = getControl<Label>(kBarkTextTag);
|
||||
|
||||
if (text.empty()) {
|
||||
_rootControl->setVisible(false);
|
||||
_binding.lblBarkText->setVisible(false);
|
||||
lblBarkText.setVisible(false);
|
||||
|
||||
} else {
|
||||
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();
|
||||
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();
|
||||
|
||||
_rootControl->setVisible(true);
|
||||
_rootControl->setExtentHeight(static_cast<int>(rootHeight));
|
||||
|
||||
_binding.lblBarkText->setExtentHeight(static_cast<int>(labelHeight));
|
||||
_binding.lblBarkText->setTextMessage(text);
|
||||
_binding.lblBarkText->setVisible(true);
|
||||
lblBarkText.setExtentHeight(static_cast<int>(labelHeight));
|
||||
lblBarkText.setTextMessage(text);
|
||||
lblBarkText.setVisible(true);
|
||||
}
|
||||
|
||||
if (duration > 0.0f) {
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include "gui.h"
|
||||
|
||||
#include "../../common/timer.h"
|
||||
#include "../../gui/control/label.h"
|
||||
|
||||
namespace reone {
|
||||
|
||||
|
@ -36,14 +35,8 @@ 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,12 +17,20 @@
|
|||
|
||||
#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;
|
||||
|
@ -73,7 +81,7 @@ void CharGenAbilities::load() {
|
|||
for (auto &label : labels) {
|
||||
configureControl(label, [this](Control &control) {
|
||||
control.setFocusable(true);
|
||||
control.setHilightColor(_game->getGUIColorBase());
|
||||
control.setHilightColor(getBaseColor(_game->gameId()));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -17,14 +17,19 @@
|
|||
|
||||
#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;
|
||||
|
||||
|
@ -324,7 +329,7 @@ void CharacterGeneration::finish() {
|
|||
party.addMember(kNpcPlayer, player);
|
||||
party.setPlayer(player);
|
||||
|
||||
string moduleName(_game->id() == GameID::KotOR ? "end_m01aa" : "001ebo");
|
||||
string moduleName(_game->gameId() == GameID::KotOR ? "end_m01aa" : "001ebo");
|
||||
_game->loadModule(moduleName);
|
||||
}
|
||||
}
|
||||
|
@ -399,7 +404,7 @@ void CharacterGeneration::updateAttributes() {
|
|||
|
||||
const SavingThrows &throws = clazz->getSavingThrows(1);
|
||||
|
||||
if (_game->isTSL()) {
|
||||
if (isTSL(_game->gameId())) {
|
||||
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/model.h"
|
||||
#include "../../../scene/node/modelnode.h"
|
||||
#include "../../../scene/scenegraph.h"
|
||||
|
||||
#include "../../character.h"
|
||||
|
|
|
@ -24,8 +24,11 @@
|
|||
|
||||
#include "../../d20/classes.h"
|
||||
#include "../../game.h"
|
||||
#include "../../gameidutil.h"
|
||||
#include "../../object/creature.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
#include "chargen.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -59,7 +62,7 @@ static map<ClassType, int> g_classDescStrRefs {
|
|||
ClassSelection::ClassSelection(Game *game) : GameGUI(game) {
|
||||
_resRef = getResRef("classsel");
|
||||
|
||||
if (game->id() == GameID::KotOR) {
|
||||
if (game->gameId() == GameID::KotOR) {
|
||||
loadBackground(BackgroundType::Menu);
|
||||
}
|
||||
|
||||
|
@ -80,12 +83,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->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);
|
||||
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);
|
||||
|
||||
setClassButtonEnlarged(0, false);
|
||||
}
|
||||
|
@ -184,8 +187,8 @@ shared_ptr<ModelSceneNode> ClassSelection::getCharacterModel(int appearance, Sce
|
|||
}
|
||||
|
||||
void ClassSelection::setButtonColors(Control &control) {
|
||||
control.setBorderColor(_game->getGUIColorBase());
|
||||
control.setHilightColor(_game->getGUIColorHilight());
|
||||
control.setBorderColor(getBaseColor(_game->gameId()));
|
||||
control.setHilightColor(getHilightColor(_game->gameId()));
|
||||
}
|
||||
|
||||
void ClassSelection::setClassButtonEnlarged(int index, bool enlarged) {
|
||||
|
|
|
@ -17,8 +17,12 @@
|
|||
|
||||
#include "custom.h"
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include "../../game.h"
|
||||
|
||||
#include "../colorutil.h"
|
||||
|
||||
#include "chargen.h"
|
||||
|
||||
using namespace std;
|
||||
|
@ -44,7 +48,7 @@ void CustomCharacterGeneration::load() {
|
|||
GUI::load();
|
||||
doSetStep(0);
|
||||
|
||||
if (_game->id() == GameID::KotOR) {
|
||||
if (_game->gameId() == GameID::KotOR) {
|
||||
setControlDiscardColor("LBL_BG", glm::vec3(0.0f, 0.0f, 0.082353f));
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue