summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt150
-rw-r--r--src/audio/oal/stream.cpp2
-rw-r--r--src/control/CarCtrl.cpp2
-rw-r--r--src/control/Script.cpp8
-rw-r--r--src/control/Script5.cpp10
-rw-r--r--src/render/Particle.cpp6
-rw-r--r--src/vehicles/Automobile.cpp20
7 files changed, 103 insertions, 95 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index ef322a9a..2f663061 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,89 +1,102 @@
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
-if(${RE3_AUDIO} STREQUAL "OAL")
- find_package(OpenAL REQUIRED)
- find_package(MPG123 REQUIRED)
- find_package(SndFile REQUIRED)
-endif()
-
-file(GLOB_RECURSE Sources "*.cpp" "*.h")
+file(GLOB_RECURSE RE3_SOURCES "*.cpp" "*.h" "*.rc")
-MACRO(HEADER_DIRECTORIES return_list)
- FILE(GLOB_RECURSE new_list *.cpp)
- SET(dir_list "animation"
- "audio"
- "collision"
- "control"
- "core"
- "entities"
- "extras"
- "fakerw"
- "math"
- "modelinfo"
- "objects"
- "peds"
- "render"
- "rw"
- "save"
- "skel"
- "text"
- "vehicles"
- "weapons")
- FOREACH(file_path ${new_list})
- GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
- SET(dir_list ${dir_list} ${dir_path})
- ENDFOREACH()
- LIST(REMOVE_DUPLICATES dir_list)
- SET(${return_list} ${dir_list})
-ENDMACRO()
+function(header_directories RETURN_LIST)
+ file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c)
+ set(RELDIRS)
+ foreach(SRC ${ALL_SRCS})
+ file(RELATIVE_PATH RELSRC "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}")
+ get_filename_component(RELDIR "${RELSRC}" DIRECTORY)
+ list(APPEND RELDIRS ${RELDIR})
+ endforeach()
+ list(REMOVE_DUPLICATES RELDIRS)
+ set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE)
+endfunction()
-HEADER_DIRECTORIES(header_list)
-include_directories(${header_list})
+header_directories(RE3_INCLUDES)
+add_executable(re3 WIN32
+ ${RE3_SOURCES}
+)
-add_executable(re3 ${Sources})
-target_link_libraries(re3 librw)
-target_link_libraries(re3 Threads::Threads)
-
-if(${RE3_AUDIO} STREQUAL "OAL")
- target_link_libraries(re3 ${OPENAL_LIBRARY})
- target_link_libraries(re3 ${MPG123_LIBRARIES})
- target_link_libraries(re3 ${SNDFILE_LIBRARIES})
-endif()
+target_link_libraries(re3 PRIVATE
+ librw::librw
+ Threads::Threads
+)
target_include_directories(re3
- INTERFACE
+ PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
- )
+ $<BUILD_INTERFACE:${RE3_INCLUDES}>
+)
target_compile_definitions(re3
PRIVATE
- "$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
- PUBLIC
- "RW_${RE3_PLATFORM}"
+ $<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
+ LIBRW
+ RE3_NO_AUTOLINK
+)
+
+if(LIBRW_PLATFORM_D3D9)
+ target_compile_definitions(re3
+ PUBLIC
+ USE_D3D9
)
+endif()
-target_compile_definitions(re3 PRIVATE LIBRW=1 AUDIO_OAL=1)
+if(RE3_AUDIO STREQUAL "OAL")
+ find_package(OpenAL REQUIRED)
+ target_include_directories(re3 PRIVATE ${OPENAL_INCLUDE_DIR})
+ target_link_libraries(re3 PRIVATE ${OPENAL_LIBRARY})
+ target_compile_definitions(re3 PRIVATE ${OPENAL_DEFINITIONS})
+ target_compile_definitions(re3 PRIVATE AUDIO_OAL)
+elseif(RE3_AUDIO STREQUAL "MSS")
+ find_package(MilesSDK REQUIRED)
+ target_compile_definitions(re3 PRIVATE AUDIO_MSS)
+ target_link_libraries(re3 PRIVATE MilesSDK::MilesSDK)
+endif()
+
+find_package(mpg123 REQUIRED)
+target_link_libraries(re3 PRIVATE
+ MPG123::libmpg123
+)
+if(RE3_WITH_OPUS)
+ find_package(opusfile REQUIRED)
+ target_link_libraries(re3 PRIVATE
+ opusfile::opusfile
+ )
+ target_compile_definitions(re3 PRIVATE AUDIO_OPUS)
+endif()
+if(RE3_WITH_LIBSNDFILE)
+ find_package(SndFile REQUIRED)
+ target_link_libraries(re3 PRIVATE
+ SndFile::SndFile
+ )
+ target_compile_definitions(re3 PRIVATE AUDIO_OAL_USE_SNDFILE)
+endif()
+
+target_compile_definitions(re3 PRIVATE )
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(re3
PRIVATE
"-Wall"
- )
- if (NOT RE3_PLATFORM_PS2)
+ )
+ if (NOT LIBRW_PLATFORM_PS2)
target_compile_options(re3
PRIVATE
- "-Wextra"
- "-Wdouble-promotion"
- "-Wpedantic"
- )
+ -Wextra
+ -Wdouble-promotion
+ -Wpedantic
+ )
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(re3
PUBLIC
- /wd4996 /wd4244
- )
+ /Zc:sizedDealloc-
+ )
endif()
set_target_properties(re3
@@ -94,20 +107,15 @@ set_target_properties(re3
CXX_STANDARD 11
CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON
- PREFIX ""
- )
+)
if(RE3_INSTALL)
- target_include_directories(re3
- INTERFACE
- $<INSTALL_INTERFACE:${RE3_INSTALL_INCLUDEDIR}>
- )
-
install(
TARGETS re3
EXPORT re3-targets
- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
- LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
- ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
- )
+ RUNTIME DESTINATION "."
+ )
+ if(MSVC)
+ install(FILES $<TARGET_PDB_FILE:re3> DESTINATION "." OPTIONAL)
+ endif()
endif()
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index ccb17577..74ed86f4 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -4,7 +4,7 @@
#include "stream.h"
#include "sampman.h"
-#ifdef _WIN32
+#if defined _MSC_VER && !defined RE3_NO_AUTOLINK
#ifdef AUDIO_OAL_USE_SNDFILE
#pragma comment( lib, "libsndfile-1.lib" )
#endif
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index cb4229eb..edf367b8 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -2415,7 +2415,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
*pHandbrake = true;
float maxAngle = FindMaxSteerAngle(pVehicle);
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
- float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward,
+ float speedMultiplier = FindSpeedMultiplier(CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y) - angleForward,
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 3563a2b4..09a696cf 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -260,12 +260,12 @@ const tScriptCommandData commands[] = {
REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
+ REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
+ REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
- REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
+ REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
+ REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
diff --git a/src/control/Script5.cpp b/src/control/Script5.cpp
index 751fefa2..e74a1081 100644
--- a/src/control/Script5.cpp
+++ b/src/control/Script5.cpp
@@ -2355,7 +2355,7 @@ int CTheScripts::FindFreeSlotInCollectiveArray()
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CollectiveArray[i].colIndex = colIndex) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2372,7 +2372,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CollectiveArray[i].colIndex = colIndex) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2389,7 +2389,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CollectiveArray[i].colIndex = colIndex) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2406,7 +2406,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CollectiveArray[i].colIndex = colIndex) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
@@ -2423,7 +2423,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
{
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
- if (CollectiveArray[i].colIndex = colIndex) {
+ if (CollectiveArray[i].colIndex == colIndex) {
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
if (pPed == nil) {
CollectiveArray[i].colIndex = -1;
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 08137d0c..6c643caf 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -1839,9 +1839,9 @@ void CParticle::AddJetExplosion(CVector const &vecPos, float fPower, float fSize
vecStepPos,
CVector
(
- CGeneral::GetRandomNumberInRange(-0.2f, 0.2f),
- CGeneral::GetRandomNumberInRange(-0.2f, 0.2f),
- CGeneral::GetRandomNumberInRange(-0.2f, 0.0f)
+ CGeneral::GetRandomNumberInRange(-0.02f, 0.02f),
+ CGeneral::GetRandomNumberInRange(-0.02f, 0.02f),
+ CGeneral::GetRandomNumberInRange(-0.02f, 0.0f)
),
nil,
fSize, color, 0, 0, 0, 0);
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 8f034126..ed187849 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -239,17 +239,17 @@ CAutomobile::ProcessControl(void)
// Improve grip of vehicles in certain cases
bool strongGrip1 = false;
bool strongGrip2 = false;
- if(FindPlayerVehicle() && this != FindPlayerVehicle() &&
+ if(FindPlayerVehicle() && this != FindPlayerVehicle() && FindPlayerPed()->m_pWanted->m_nWantedLevel > 3 &&
(AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE ||
- AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE)){
- if(FindPlayerSpeed().Magnitude() > 0.3f){
- strongGrip1 = true;
- if(FindPlayerSpeed().Magnitude() > 0.4f &&
- m_vecMoveSpeed.Magnitude() < 0.3f)
- strongGrip2 = true;
- else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f)
- strongGrip2 = true;
- }
+ AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_FARAWAY || AutoPilot.m_nCarMission == MISSION_BLOCKPLAYER_CLOSE) &&
+ FindPlayerSpeed().Magnitude() > 0.3f){
+
+ strongGrip1 = true;
+ if(FindPlayerSpeed().Magnitude() > 0.4f &&
+ m_vecMoveSpeed.Magnitude() < 0.3f)
+ strongGrip2 = true;
+ else if((GetPosition() - FindPlayerCoors()).Magnitude() > 50.0f)
+ strongGrip2 = true;
}
if(bIsBus)