diff options
34 files changed, 1068 insertions, 435 deletions
diff --git a/.github/workflows/build-switch.yml b/.github/workflows/build-switch.yml new file mode 100644 index 00000000..fff4195f --- /dev/null +++ b/.github/workflows/build-switch.yml @@ -0,0 +1,29 @@ + +name: re3 cmake devkitA64 (Nintendo Switch) +on: + pull_request: + push: + release: + types: published +jobs: + build-nintendo-switch: + runs-on: ubuntu-latest + container: devkitpro/devkita64:latest + steps: + - uses: actions/checkout@v2 + with: + submodules: 'true' + - name: "Build files" + run: | + /opt/devkitpro/portlibs/switch/bin/aarch64-none-elf-cmake -S. -Bbuild -DREVC_AUDIO=OAL -DLIBRW_PLATFORM=GL3 -DLIBRW_GL3_GFXLIB=GLFW -DREVC_WITH_OPUS=False -DREVC_VENDORED_LIBRW=True -DREVC_INSTALL=True + cmake --build build --parallel + - name: "Create binary package (cpack)" + working-directory: ./build + run: | + cpack + - name: "Archive binary package (github artifacts)" + uses: actions/upload-artifact@v2 + with: + name: "switch-gl3" + path: build/*.tar.xz + if-no-files-found: error diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 327d8cc7..2ce82727 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -26,6 +26,24 @@ "compilerArgs": ["-ggdb"], "cStandard": "gnu11", "cppStandard": "gnu++14" + }, + { + "name": "devkitPro aarch64 (Nintendo Switch)", + "compilerPath": "${env:DEVKITPRO}/devkitA64/bin/aarch64-none-elf-g++", + "includePath": [ + "${default}", + "${env:DEVKITPRO}/portlibs/switch/include", + "${env:DEVKITPRO}/libnx/include" + ], + "intelliSenseMode": "gcc-arm64", + "cStandard": "gnu11", + "cppStandard": "gnu++11", + "defines": [ + "__SWITCH__", + "LIBRW", + "RW_GL3", + "AUDIO_OAL" + ] } ], "version": 4 diff --git a/.vscode/settings.json b/.vscode/settings.json index fee80960..624e08d9 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -2,8 +2,13 @@ "C_Cpp.default.cStandard": "gnu11", "C_Cpp.default.cppStandard": "gnu++14", "C_Cpp.default.includePath": [ + "src", "src/animation", "src/audio", + "src/audio/eax", + "src/audio/oal", + "src/buildings", + "src/collision", "src/control", "src/core", "src/entities", @@ -16,6 +21,7 @@ "src/renderer", "src/rw", "src/save", + "src/save/glfw", "src/skel", "src/text", "src/vehicles", diff --git a/CMakeLists.txt b/CMakeLists.txt index 199bfebc..04bc6be2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,27 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.14) set(EXECUTABLE reLCS) set(PROJECT RELCS) project(${EXECUTABLE} C CXX) +set(${PROJECT}_AUTHOR "${PROJECT} Team") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") include(GetGitRevisionDescription) get_git_head_revision(GIT_REFSPEC GIT_SHA1 "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR") message(STATUS "Building ${CMAKE_PROJECT_NAME} GIT SHA1: ${GIT_SHA1}") + +if(NINTENDO_SWITCH) + list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/nx") + include(NXFunctions) +endif() + +if(NOT COMMAND reVC_platform_target) + function(reVC_platform_target) + endfunction() +endif() + if(WIN32) set(${PROJECT}_AUDIOS "OAL" "MSS") else() @@ -66,6 +78,8 @@ if(${PROJECT}_INSTALL) set(os "-apple") elseif(UNIX) set(os "-linux") + elseif(NINTENDO_SWITCH) + set(os "-switch") else() set(compiler "-UNK") message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)") diff --git a/cmake/nx/NXFunctions.cmake b/cmake/nx/NXFunctions.cmake new file mode 100644 index 00000000..f67b3ebc --- /dev/null +++ b/cmake/nx/NXFunctions.cmake @@ -0,0 +1,38 @@ +if(NOT COMMAND nx_generate_nacp) + message(FATAL_ERROR "The `nx_generate_nacp` cmake command is not available. Please use an appropriate Nintendo Switch toolchain.") +endif() + +if(NOT COMMAND nx_create_nro) + message(FATAL_ERROR "The `nx_create_nro` cmake command is not available. Please use an appropriate Nintendo Switch toolchain.") +endif() + +set(CMAKE_EXECUTABLE_SUFFIX ".elf") + +function(reVC_platform_target TARGET) + cmake_parse_arguments(RPT "INSTALL" "" "" ${ARGN}) + + get_target_property(TARGET_TYPE "${TARGET}" TYPE) + if(TARGET_TYPE STREQUAL "EXECUTABLE") + nx_generate_nacp(${TARGET}.nacp + NAME "${TARGET}" + AUTHOR "${${PROJECT}_AUTHOR}" + VERSION "1.0.0-${GIT_SHA1}" + ) + + nx_create_nro(${TARGET} + NACP ${TARGET}.nacp + ICON "${PROJECT_SOURCE_DIR}/res/images/logo_256.jpg" + ) + + if(${PROJECT}_INSTALL AND RPT_INSTALL) + get_target_property(TARGET_OUTPUT_NAME ${TARGET} OUTPUT_NAME) + if(NOT TARGET_OUTPUT_NAME) + set(TARGET_OUTPUT_NAME "${TARGET}") + endif() + + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_OUTPUT_NAME}.nro" + DESTINATION "." + ) + endif() + endif() +endfunction() diff --git a/codewarrior/reVC.mcp.xml b/codewarrior/reVC.mcp.xml index 750fb675..64f985fd 100644 --- a/codewarrior/reVC.mcp.xml +++ b/codewarrior/reVC.mcp.xml @@ -1725,6 +1725,13 @@ </FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
+ <PATH>ScriptDebug.cpp</PATH>
+ <PATHFORMAT>Windows</PATHFORMAT>
+ <FILEKIND>Text</FILEKIND>
+ <FILEFLAGS>Debug</FILEFLAGS>
+ </FILE>
+ <FILE>
+ <PATHTYPE>Name</PATHTYPE>
<PATH>Script.cpp</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
@@ -4713,6 +4720,11 @@ </FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
+ <PATH>ScriptDebug.cpp</PATH>
+ <PATHFORMAT>Windows</PATHFORMAT>
+ </FILEREF>
+ <FILEREF>
+ <PATHTYPE>Name</PATHTYPE>
<PATH>Script.cpp</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
@@ -8250,6 +8262,13 @@ </FILE>
<FILE>
<PATHTYPE>Name</PATHTYPE>
+ <PATH>ScriptDebug.cpp</PATH>
+ <PATHFORMAT>Windows</PATHFORMAT>
+ <FILEKIND>Text</FILEKIND>
+ <FILEFLAGS>Debug</FILEFLAGS>
+ </FILE>
+ <FILE>
+ <PATHTYPE>Name</PATHTYPE>
<PATH>Script.cpp</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
<FILEKIND>Text</FILEKIND>
@@ -11238,6 +11257,11 @@ </FILEREF>
<FILEREF>
<PATHTYPE>Name</PATHTYPE>
+ <PATH>ScriptDebug.cpp</PATH>
+ <PATHFORMAT>Windows</PATHFORMAT>
+ </FILEREF>
+ <FILEREF>
+ <PATHTYPE>Name</PATHTYPE>
<PATH>Script.cpp</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
@@ -13783,6 +13807,12 @@ <FILEREF>
<TARGETNAME>Debug</TARGETNAME>
<PATHTYPE>Name</PATHTYPE>
+ <PATH>ScriptDebug.cpp</PATH>
+ <PATHFORMAT>Windows</PATHFORMAT>
+ </FILEREF>
+ <FILEREF>
+ <TARGETNAME>Debug</TARGETNAME>
+ <PATHTYPE>Name</PATHTYPE>
<PATH>Script.cpp</PATH>
<PATHFORMAT>Windows</PATHFORMAT>
</FILEREF>
diff --git a/gamefiles/models/frontend_nsw.txd b/gamefiles/models/frontend_nsw.txd Binary files differnew file mode 100644 index 00000000..cbd0afc7 --- /dev/null +++ b/gamefiles/models/frontend_nsw.txd diff --git a/gamefiles/models/nswbtns.txd b/gamefiles/models/nswbtns.txd Binary files differnew file mode 100644 index 00000000..9831ce54 --- /dev/null +++ b/gamefiles/models/nswbtns.txd diff --git a/logo.svg b/res/images/logo.svg index 3af9cb19..3af9cb19 100644 --- a/logo.svg +++ b/res/images/logo.svg diff --git a/logo.png b/res/images/logo_1024.png Binary files differindex 4d5a192d..4d5a192d 100644 --- a/logo.png +++ b/res/images/logo_1024.png diff --git a/res/images/logo_256.jpg b/res/images/logo_256.jpg Binary files differnew file mode 100644 index 00000000..b89cac6f --- /dev/null +++ b/res/images/logo_256.jpg diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9cce6641..4c3f111e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -54,9 +54,13 @@ target_compile_definitions(${EXECUTABLE} PRIVATE USE_OUR_VERSIONING) if(${PROJECT}_AUDIO STREQUAL "OAL") find_package(OpenAL REQUIRED) - target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR}) - target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY}) - target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS}) + if(TARGET OpenAL::OpenAL) + target_link_libraries(${EXECUTABLE} PRIVATE OpenAL::OpenAL) + else() + target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR}) + target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY}) + target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS}) + endif() target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL) elseif(${PROJECT}_AUDIO STREQUAL "MSS") find_package(MilesSDK REQUIRED) @@ -122,13 +126,19 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") ) endif() +if(NINTENDO_SWITCH) + set(${PROJECT}_C_CXX_EXTENSIONS ON) +else() + set(${PROJECT}_C_CXX_EXTENSIONS OFF) +endif() + set_target_properties(${EXECUTABLE} PROPERTIES C_STANDARD 11 - C_EXTENSIONS OFF + C_EXTENSIONS ${${PROJECT}_C_CXX_EXTENSIONS} C_STANDARD_REQUIRED ON CXX_STANDARD 11 - CXX_EXTENSIONS OFF + CXX_EXTENSIONS ${${PROJECT}_C_CXX_EXTENSIONS} CXX_STANDARD_REQUIRED ON ) @@ -142,3 +152,5 @@ if(${PROJECT}_INSTALL) install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL) endif() endif() + +reVC_platform_target(${EXECUTABLE} INSTALL) diff --git a/src/audio/AudioCollision.cpp b/src/audio/AudioCollision.cpp index 0a3c1edd..4bf6a404 100644 --- a/src/audio/AudioCollision.cpp +++ b/src/audio/AudioCollision.cpp @@ -268,7 +268,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col) SET_EMITTING_VOLUME(emittingVol); RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; + m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -297,7 +297,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity; + m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index e2cd4e75..f48259f9 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -924,7 +924,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -975,7 +975,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = 140.0f; + m_sQueueSample.m_SoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1000,7 +1000,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = 140.0f; + m_sQueueSample.m_SoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1016,7 +1016,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = 140.0f; + m_sQueueSample.m_SoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1060,7 +1060,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = 140.0f; + m_sQueueSample.m_SoundIntensity = 140.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1093,7 +1093,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_SoundIntensity = 30.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 30; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1128,7 +1128,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) SET_EMITTING_VOLUME(propellerSpeed * 100.0f); SET_LOOP_OFFSETS(SFX_SEAPLANE_PRO4) m_sQueueSample.m_fSpeedMultiplier = 5.0f; - m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_SoundIntensity = 20.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1159,7 +1159,7 @@ cAudioManager::ProcessCarHeli(cVehicleParams& params) SET_EMITTING_VOLUME(volumeModifier * 25.0f); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = 27.0f; + m_sQueueSample.m_SoundIntensity = 27.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1205,7 +1205,7 @@ cAudioManager::ProcessRainOnVehicle(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -1257,7 +1257,7 @@ cAudioManager::ProcessReverseGear(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = reverseGearIntensity; + m_sQueueSample.m_SoundIntensity = reverseGearIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1300,7 +1300,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) } if (acceletateState < brakeState) acceletateState = brakeState; - freq = Clamp2(5 * acceletateState + 22050, prevFreq, 30); + freq = Clamp2(5 * acceletateState + 22050, (int)prevFreq, 30); CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); m_sQueueSample.m_nVolume = ComputeVolume(70, SOUND_INTENSITY, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { @@ -1314,7 +1314,7 @@ cAudioManager::ProcessModelHeliVehicle(cVehicleParams& params) SET_EMITTING_VOLUME(70); SET_LOOP_OFFSETS(SFX_CAR_RC_HELI) m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1377,7 +1377,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) SET_EMITTING_VOLUME(volume); SET_LOOP_OFFSETS(SFX_RC_REV) m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1441,7 +1441,7 @@ cAudioManager::ProcessModelVehicle(cVehicleParams& params) SET_EMITTING_VOLUME(volume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -1510,7 +1510,7 @@ cAudioManager::ProcessVehicleFlatTyre(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(SFX_TYRE_BURST_L) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1575,7 +1575,7 @@ cAudioManager::ProcessVehicleRoadNoise(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1634,7 +1634,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; @@ -1646,7 +1646,7 @@ cAudioManager::ProcessWetRoadNoise(cVehicleParams& params) return TRUE; } -void +bool8 cAudioManager::ProcessVehicleEngine(cVehicleParams& params) { const float SOUND_INTENSITY = 50.0f; @@ -1674,197 +1674,199 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams& params) isMoped = FALSE; caddyBool = FALSE; traction = 0.0f; - if (params.m_fDistance >= SQR(SOUND_INTENSITY)) - return; - playerVeh = FindPlayerVehicle(); - veh = params.m_pVehicle; - if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) { - SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); - return; - } - if (!veh->bEngineOn) - return; - CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); - if (playerVeh == veh && veh->m_modelIndex != MI_CADDY) { - ProcessPlayersVehicleEngine(params, params.m_pVehicle); - return; - } - transmission = params.m_pTransmission; - if (transmission != nil) { - switch (veh->m_modelIndex) { - case MI_PIZZABOY: - case MI_FAGGIO: - isMoped = TRUE; - currentGear = transmission->nNumberOfGears; - break; - case MI_CADDY: - currentGear = transmission->nNumberOfGears; - caddyBool = TRUE; - break; - default: - currentGear = veh->m_nCurrentGear; - break; - } - switch (params.m_VehicleType) { - case VEHICLE_TYPE_CAR: - automobile = (CAutomobile*)veh; - wheelsOnGround = automobile->m_nDriveWheelsOnGround; - wheelsOnGroundPrev = automobile->m_nDriveWheelsOnGroundPrev; - wheelState = automobile->m_aWheelState; - gasPedalAudioPtr = &automobile->m_fGasPedalAudio; - break; - case VEHICLE_TYPE_BIKE: - bike = (CBike*)veh; - wheelsOnGround = bike->m_nDriveWheelsOnGround; - wheelsOnGroundPrev = bike->m_nDriveWheelsOnGroundPrev; - wheelState = bike->m_aWheelState; - gasPedalAudioPtr = &bike->m_fGasPedalAudio; - break; - default: - debug(" ** AUDIOLOG: Unrecognised vehicle type %d in ProcessVehicleEngine() * \n", params.m_VehicleType); - return; + if (params.m_fDistance < SQR(SOUND_INTENSITY)) { + playerVeh = FindPlayerVehicle(); + veh = params.m_pVehicle; + if (playerVeh == veh && veh->GetStatus() == STATUS_WRECKED) { + SampleManager.StopChannel(CHANNEL_PLAYER_VEHICLE_ENGINE); + return TRUE; } + if (veh->bEngineOn) { + CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); + if (playerVeh == veh && veh->m_modelIndex != MI_CADDY) { + ProcessPlayersVehicleEngine(params, params.m_pVehicle); + return TRUE; + } + transmission = params.m_pTransmission; + if (transmission != nil) { + switch (veh->m_modelIndex) { + case MI_PIZZABOY: + case MI_FAGGIO: + isMoped = TRUE; + currentGear = transmission->nNumberOfGears; + break; + case MI_CADDY: + currentGear = transmission->nNumberOfGears; + caddyBool = TRUE; + break; + default: + currentGear = veh->m_nCurrentGear; + break; + } + switch (params.m_VehicleType) { + case VEHICLE_TYPE_CAR: + automobile = (CAutomobile*)veh; + wheelsOnGround = automobile->m_nDriveWheelsOnGround; + wheelsOnGroundPrev = automobile->m_nDriveWheelsOnGroundPrev; + wheelState = automobile->m_aWheelState; + gasPedalAudioPtr = &automobile->m_fGasPedalAudio; + break; + case VEHICLE_TYPE_BIKE: + bike = (CBike*)veh; + wheelsOnGround = bike->m_nDriveWheelsOnGround; + wheelsOnGroundPrev = bike->m_nDriveWheelsOnGroundPrev; + wheelState = bike->m_aWheelState; + gasPedalAudioPtr = &bike->m_fGasPedalAudio; + break; + default: + debug(" ** AUDIOLOG: Unrecognised vehicle type %d in ProcessVehicleEngine() * \n", params.m_VehicleType); + return TRUE; + } - if (wheelsOnGround != 0) { - if (!veh->bIsHandbrakeOn || isMoped && caddyBool) { //mb bug, bcs it's can't be TRUE together - if (veh->GetStatus() == STATUS_SIMPLE || isMoped || caddyBool) { - traction = 0.0f; - } else { - switch (transmission->nDriveType) { - case '4': - if (params.m_VehicleType == VEHICLE_TYPE_BIKE) { - for (int i = 0; i < 2; i++) - if (wheelState[i] == WHEEL_STATE_SPINNING) - traction += 0.1f; - } else { - for (int i = 0; i < 4; i++) - if (wheelState[i] == WHEEL_STATE_SPINNING) - traction += 0.05f; - } - break; - case 'F': - if (params.m_VehicleType == VEHICLE_TYPE_BIKE) { - if (wheelState[BIKEWHEEL_FRONT] == WHEEL_STATE_SPINNING) - traction += 0.2f; + if (wheelsOnGround != 0) { + if (!veh->bIsHandbrakeOn || isMoped && caddyBool) { //mb bug, bcs it's can't be TRUE together + if (veh->GetStatus() == STATUS_SIMPLE || isMoped || caddyBool) { + traction = 0.0f; } else { - if (wheelState[CARWHEEL_FRONT_LEFT] == WHEEL_STATE_SPINNING) - traction += 0.1f; - if (wheelState[CARWHEEL_FRONT_RIGHT] == WHEEL_STATE_SPINNING) - traction += 0.1f; + switch (transmission->nDriveType) { + case '4': + if (params.m_VehicleType == VEHICLE_TYPE_BIKE) { + for (int i = 0; i < 2; i++) + if (wheelState[i] == WHEEL_STATE_SPINNING) + traction += 0.1f; + } else { + for (int i = 0; i < 4; i++) + if (wheelState[i] == WHEEL_STATE_SPINNING) + traction += 0.05f; + } + break; + case 'F': + if (params.m_VehicleType == VEHICLE_TYPE_BIKE) { + if (wheelState[BIKEWHEEL_FRONT] == WHEEL_STATE_SPINNING) + traction += 0.2f; + } else { + if (wheelState[CARWHEEL_FRONT_LEFT] == WHEEL_STATE_SPINNING) + traction += 0.1f; + if (wheelState[CARWHEEL_FRONT_RIGHT] == WHEEL_STATE_SPINNING) + traction += 0.1f; + } + break; + case 'R': + if (params.m_VehicleType == VEHICLE_TYPE_BIKE) { + if (wheelState[BIKEWHEEL_REAR] == WHEEL_STATE_SPINNING) + traction += 0.2f; + } else { + if (wheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING) + traction += 0.1f; + if (wheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING) + traction += 0.1f; + } + break; + default: + break; + } } - break; - case 'R': - if (params.m_VehicleType == VEHICLE_TYPE_BIKE) { - if (wheelState[BIKEWHEEL_REAR] == WHEEL_STATE_SPINNING) - traction += 0.2f; + } else if (params.m_fVelocityChange == 0.0f) { + traction = 0.9f; + } + if (transmission->fMaxVelocity <= 0.0f) { + relativeChange = 0.0f; + modificator = 0.0f; + } else { + if (!isMoped && !caddyBool) { + if (currentGear != 0) { + relativeGearChange = Min(1.0f, + params.m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f; + if (traction == 0.0f && veh->GetStatus() != STATUS_SIMPLE && + params.m_fVelocityChange < transmission->Gears[1].fShiftUpVelocity) + traction = 0.7f; + relativeChange = traction * *gasPedalAudioPtr * 0.95f + (1.0f - traction) * relativeGearChange; + } else { + relativeChange = Min(1.0f, + 1.0f - Abs((params.m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity)); + } + modificator = relativeChange; } else { - if (wheelState[CARWHEEL_REAR_LEFT] == WHEEL_STATE_SPINNING) - traction += 0.1f; - if (wheelState[CARWHEEL_REAR_RIGHT] == WHEEL_STATE_SPINNING) - traction += 0.1f; + modificator = Min(1.0f, Abs(params.m_fVelocityChange / transmission->fMaxVelocity > 1.0f)); } - break; - default: - break; } + } else { + if (wheelsOnGroundPrev != 0) + *gasPedalAudioPtr *= 0.4f; + relativeChange = *gasPedalAudioPtr; + modificator = relativeChange; } - } else if (params.m_fVelocityChange == 0.0f) { - traction = 0.9f; - } - if (transmission->fMaxVelocity <= 0.0f) { - relativeChange = 0.0f; - modificator = 0.0f; + if (currentGear != 0 || wheelsOnGround == 0) + freq = 1200 * currentGear + 18000.0f * modificator + 14000; + else if (params.m_VehicleType == VEHICLE_TYPE_BIKE) + freq = 22050; + else + freq = 13000.0f * modificator + 14000; + if (modificator >= 0.75f) + emittingVol = 90; + else + emittingVol = modificator * (4.0f / 3.0f) * 15.0f + 75; } else { - if (!isMoped && !caddyBool) { - if (currentGear != 0) { - relativeGearChange = Min(1.0f, - params.m_fVelocityChange - transmission->Gears[currentGear].fShiftDownVelocity) / transmission->fMaxVelocity * 2.5f; - if (traction == 0.0f && veh->GetStatus() != STATUS_SIMPLE && - params.m_fVelocityChange < transmission->Gears[1].fShiftUpVelocity) - traction = 0.7f; - relativeChange = traction * *gasPedalAudioPtr * 0.95f + (1.0f - traction) * relativeGearChange; + modificator = 0.0f; + emittingVol = 75; + } + if (veh->bIsDrowning) + emittingVol /= 4; + if (caddyBool) { + emittingVol = 100.0f * modificator; + freq = 2130.0f * modificator + 4270; + m_sQueueSample.m_nCounter = 2; + } + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); + if (m_sQueueSample.m_nVolume != 0) { + if (!caddyBool) { + if (veh->GetStatus() == STATUS_SIMPLE) { + if (modificator < 0.02f) { + m_sQueueSample.m_nSampleIndex = aEngineSounds[aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET][0]; + m_sQueueSample.m_nCounter = 52; + freq = 10000.0f * modificator + 22050; + } else { + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nAccelerationSampleIndex; + m_sQueueSample.m_nCounter = 2; + } } else { - relativeChange = Min(1.0f, - 1.0f - Abs((params.m_fVelocityChange - transmission->Gears[0].fShiftDownVelocity) / transmission->fMaxReverseVelocity)); + if (veh->m_fGasPedal < 0.02f) { + m_sQueueSample.m_nSampleIndex = aEngineSounds[aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET][0]; + m_sQueueSample.m_nCounter = 52; + freq = 10000.0f * modificator + 22050; + } else { + m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nAccelerationSampleIndex; + m_sQueueSample.m_nCounter = 2; + } } - modificator = relativeChange; - } else { - modificator = Min(1.0f, Abs(params.m_fVelocityChange / transmission->fMaxVelocity > 1.0f)); - } - } - } else { - if (wheelsOnGroundPrev != 0) - *gasPedalAudioPtr *= 0.4f; - relativeChange = *gasPedalAudioPtr; - modificator = relativeChange; - } - if (currentGear != 0 || wheelsOnGround == 0) - freq = 1200 * currentGear + 18000.0f * modificator + 14000; - else if (params.m_VehicleType == VEHICLE_TYPE_BIKE) - freq = 22050; - else - freq = 13000.0f * modificator + 14000; - if (modificator >= 0.75f) - emittingVol = 90; - else - emittingVol = modificator * (4.0f / 3.0f) * 15.0f + 75; - } else { - modificator = 0.0f; - emittingVol = 75; - } - if (veh->bIsDrowning) - emittingVol /= 4; - if (caddyBool) { - emittingVol = 100.0f * modificator; - freq = 2130.0f * modificator + 4270; - m_sQueueSample.m_nCounter = 2; - } - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, SOUND_INTENSITY, m_sQueueSample.m_fDistance); - if (m_sQueueSample.m_nVolume != 0) { - if (!caddyBool) { - if (veh->GetStatus() == STATUS_SIMPLE) { - if (modificator < 0.02f) { - m_sQueueSample.m_nSampleIndex = aEngineSounds[aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET][0]; - m_sQueueSample.m_nCounter = 52; - freq = 10000.0f * modificator + 22050; - } else { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nAccelerationSampleIndex; - m_sQueueSample.m_nCounter = 2; - } - } else { - if (veh->m_fGasPedal < 0.02f) { - m_sQueueSample.m_nSampleIndex = aEngineSounds[aVehicleSettings[params.m_nIndex].m_nBank - CAR_SFX_BANKS_OFFSET][0]; - m_sQueueSample.m_nCounter = 52; - freq = 10000.0f * modificator + 22050; + m_sQueueSample.m_nFrequency = freq + 100 * m_sQueueSample.m_nBankIndex % 1000; } else { - m_sQueueSample.m_nSampleIndex = aVehicleSettings[params.m_nIndex].m_nAccelerationSampleIndex; - m_sQueueSample.m_nCounter = 2; + if (FindVehicleOfPlayer() == params.m_pVehicle) + m_sQueueSample.m_nSampleIndex = SFX_CAR_AFTER_ACCEL_12; + else + m_sQueueSample.m_nSampleIndex = SFX_CAR_REV_GOLFCART; + m_sQueueSample.m_nFrequency = freq + 20 * m_sQueueSample.m_nBankIndex % 100; } + m_sQueueSample.m_nBankIndex = SFX_BANK_0; + m_sQueueSample.m_bIs2D = FALSE; + m_sQueueSample.m_nReleasingVolumeModificator = 3; + if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_TRUCK || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_TRUCK) + m_sQueueSample.m_nFrequency /= 2; + m_sQueueSample.m_nLoopCount = 0; + SET_EMITTING_VOLUME(emittingVol); + SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) + m_sQueueSample.m_fSpeedMultiplier = 6.0f; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_bReleasingSoundFlag = FALSE; + m_sQueueSample.m_nReleasingVolumeDivider = 8; + m_sQueueSample.m_bReverbFlag = TRUE; + m_sQueueSample.m_bRequireReflection = FALSE; + AddSampleToRequestedQueue(); } - m_sQueueSample.m_nFrequency = freq + 100 * m_sQueueSample.m_nBankIndex % 1000; - } else { - if (FindVehicleOfPlayer() == params.m_pVehicle) - m_sQueueSample.m_nSampleIndex = SFX_CAR_AFTER_ACCEL_12; - else - m_sQueueSample.m_nSampleIndex = SFX_CAR_REV_GOLFCART; - m_sQueueSample.m_nFrequency = freq + 20 * m_sQueueSample.m_nBankIndex % 100; } - m_sQueueSample.m_nBankIndex = SFX_BANK_0; - m_sQueueSample.m_bIs2D = FALSE; - m_sQueueSample.m_nReleasingVolumeModificator = 3; - if (m_sQueueSample.m_nSampleIndex == SFX_CAR_IDLE_TRUCK || m_sQueueSample.m_nSampleIndex == SFX_CAR_REV_TRUCK) - m_sQueueSample.m_nFrequency /= 2; - m_sQueueSample.m_nLoopCount = 0; - SET_EMITTING_VOLUME(emittingVol); - SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; - m_sQueueSample.m_bReleasingSoundFlag = FALSE; - m_sQueueSample.m_nReleasingVolumeDivider = 8; - m_sQueueSample.m_bReverbFlag = TRUE; - m_sQueueSample.m_bRequireReflection = FALSE; - AddSampleToRequestedQueue(); + return TRUE; } + return FALSE; } void @@ -1921,7 +1923,7 @@ cAudioManager::AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 samp SET_EMITTING_VOLUME(emittingVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 6.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_SoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -1947,7 +1949,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) SET_EMITTING_VOLUME(80); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = 200.0f; + m_sQueueSample.m_SoundIntensity = 200.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -1967,7 +1969,7 @@ cAudioManager::ProcessCesna(cVehicleParams ¶ms) SET_EMITTING_VOLUME(80); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = 90.0f; + m_sQueueSample.m_SoundIntensity = 90.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -2502,7 +2504,7 @@ cAudioManager::ProcessVehicleSkidding(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; @@ -2608,7 +2610,7 @@ cAudioManager::ProcessVehicleHorn(cVehicleParams& params) #endif SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 5.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; @@ -2689,7 +2691,7 @@ cAudioManager::ProcessVehicleSirenOrAlarm(cVehicleParams& params) SET_EMITTING_VOLUME(volume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 7.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -2735,7 +2737,7 @@ cAudioManager::ProcessVehicleReverseWarning(cVehicleParams& params) #endif SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; @@ -2780,7 +2782,7 @@ cAudioManager::ProcessVehicleDoors(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 1.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = TRUE; @@ -2825,7 +2827,7 @@ cAudioManager::ProcessAirBrakes(cVehicleParams& params) SET_EMITTING_VOLUME(volume); RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -2881,7 +2883,7 @@ cAudioManager::ProcessEngineDamage(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVolume); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; @@ -2929,7 +2931,7 @@ cAudioManager::ProcessCarBombTick(cVehicleParams& params) SET_EMITTING_VOLUME(EMITTING_VOLUME); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; @@ -2953,7 +2955,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) float maxDist; static uint8 GunIndex = 53; - for (int i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { + for (uint16 i = 0; i < m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_AudioEvents; i++) { noReflections = FALSE; isHeli = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; @@ -2998,7 +3000,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bRequireReflection = TRUE; break; } @@ -3038,7 +3040,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bRequireReflection = TRUE; break; } @@ -3052,7 +3054,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK); m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; } break; case SOUND_CAR_JUMP: case SOUND_CAR_JUMP_2: { @@ -3080,7 +3082,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency *= 2; m_sQueueSample.m_nReleasingVolumeModificator = 6; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; break; } case SOUND_CAR_TYRE_POP: { @@ -3095,7 +3097,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(2000); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[4] % 10 + 117; break; @@ -3113,7 +3115,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_STARTER); m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bRequireReflection = TRUE; break; } @@ -3126,7 +3128,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[4] % 10 + 30; break; @@ -3144,7 +3146,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[0] % 15 + 55; break; @@ -3157,7 +3159,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_SUSPENSION_SLOW_MOVE_LOOP); m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_nReleasingVolumeDivider = 7; noReflections = TRUE; maxDist = SQR(SOUND_INTENSITY); @@ -3173,7 +3175,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[1] % 15 + 55; break; @@ -3195,7 +3197,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = (7000.0f * relVol) + 6000; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; emittingVol = (35.0f * relVol); maxDist = SQR(SOUND_INTENSITY); break; @@ -3223,7 +3225,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 11025; m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 5.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[1] % 20 + 70; break; @@ -3241,7 +3243,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 2.0f; m_sQueueSample.m_nReleasingVolumeDivider = 3; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; emittingVol = (37.0f * vol * 625.0f / 24.0f) + 90; maxDist = SQR(SOUND_INTENSITY); noReflections = TRUE; @@ -3255,7 +3257,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_BOMB_BEEP); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); m_sQueueSample.m_bRequireReflection = TRUE; emittingVol = 60; @@ -3269,7 +3271,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_JUMBO_LAND_WHEELS); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[4] % 25 + 75; break; @@ -3291,7 +3293,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; break; } case SOUND_WEAPON_SHOT_FIRED: { @@ -3338,7 +3340,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bRequireReflection = TRUE; isHeli = TRUE; break; @@ -3392,7 +3394,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) #endif m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bRequireReflection = TRUE; break; } @@ -3408,7 +3410,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[3] % 20 + 90; break; @@ -3424,7 +3426,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ARM_BOMB); m_sQueueSample.m_nReleasingVolumeModificator = 0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bRequireReflection = TRUE; emittingVol = 50; maxDist = SQR(SOUND_INTENSITY); @@ -3464,7 +3466,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 16000; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); m_sQueueSample.m_bRequireReflection = TRUE; emittingVol = m_anRandomTable[4] % 20 + 90; @@ -3479,7 +3481,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency = RandomDisplacement(6000) + 16000; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; ++CrunchOffset; maxDist = SQR(SOUND_INTENSITY); emittingVol = m_anRandomTable[4] % 20 + 55; @@ -3501,7 +3503,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; maxDist = SQR(SOUND_INTENSITY); break; } @@ -3510,7 +3512,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) } if (params.m_fDistance < maxDist) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { if (noReflections) { m_sQueueSample.m_nLoopCount = 0; @@ -3523,7 +3525,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); m_sQueueSample.m_bReverbFlag = TRUE; if (isHeli) { - if (0.2f * m_sQueueSample.m_fSoundIntensity > m_sQueueSample.m_fDistance) { + if (0.2f * m_sQueueSample.m_SoundIntensity > m_sQueueSample.m_fDistance) { m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nOffset = 0; #ifdef THIS_IS_STUPID @@ -3596,7 +3598,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = TRUE; @@ -3618,7 +3620,7 @@ cAudioManager::ProcessTrainNoise(cVehicleParams& params) // SET_EMITTING_VOLUME(emittingVol); // SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) // m_sQueueSample.m_fSpeedMultiplier = 6.0f; - // m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + // m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; // m_sQueueSample.m_bReleasingSoundFlag = FALSE; // m_sQueueSample.m_nReleasingVolumeDivider = 3; // m_sQueueSample.m_bReverbFlag = TRUE; @@ -3740,7 +3742,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) SET_EMITTING_VOLUME(Vol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = intensity; + m_sQueueSample.m_SoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = TRUE; @@ -3764,7 +3766,7 @@ cAudioManager::ProcessBoatEngine(cVehicleParams& params) SET_EMITTING_VOLUME(80); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = intensity; + m_sQueueSample.m_SoundIntensity = intensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 7; m_sQueueSample.m_bReverbFlag = TRUE; @@ -3811,7 +3813,7 @@ cAudioManager::ProcessBoatMovingOverWater(cVehicleParams& params) SET_EMITTING_VOLUME(vol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_SoundIntensity = 50.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 6; m_sQueueSample.m_bReverbFlag = TRUE; @@ -3978,7 +3980,7 @@ cAudioManager::SetupJumboTaxiSound(uint8 vol) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; @@ -4009,7 +4011,7 @@ cAudioManager::SetupJumboWhineSound(uint8 emittingVol, uint32 freq) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; @@ -4039,7 +4041,7 @@ cAudioManager::SetupJumboEngineSound(uint8 vol, uint32 freq) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 4; m_sQueueSample.m_bReverbFlag = TRUE; @@ -4068,7 +4070,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 5; m_sQueueSample.m_bReverbFlag = TRUE; @@ -4098,7 +4100,7 @@ cAudioManager::SetupJumboRumbleSound(uint8 emittingVol) SET_EMITTING_VOLUME(emittingVol); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 12; m_sQueueSample.m_nOffset = 0; @@ -4248,7 +4250,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) } m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_SoundIntensity = 20.0f; m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS SET_EMITTING_VOLUME(emittingVol); @@ -4275,7 +4277,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_SoundIntensity = 30.0f; m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS SET_EMITTING_VOLUME(emittingVol); @@ -4372,7 +4374,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) ++iSound; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_SoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4427,7 +4429,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) narrowSoundRange = TRUE; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_SoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4451,7 +4453,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = 27000; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_SoundIntensity = 50.0f; maxDist = SQR(50); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; @@ -4474,7 +4476,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = 27000; m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; @@ -4499,7 +4501,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 22000; m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; emittingVol = 100; @@ -4524,7 +4526,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4544,7 +4546,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4564,7 +4566,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4585,7 +4587,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4605,7 +4607,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4624,7 +4626,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 17000; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4644,7 +4646,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4662,7 +4664,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 34000; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4681,7 +4683,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4699,7 +4701,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 43150; m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4718,7 +4720,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4741,7 +4743,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4760,7 +4762,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = (10 * m_sQueueSample.m_nEntityIndex & 2047) + SampleManager.GetSampleBaseFrequency(SFX_FLAMETHROWER_LEFT); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 0; SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) @@ -4780,7 +4782,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 32); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4838,7 +4840,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_SoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4901,7 +4903,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 120.0f; + m_sQueueSample.m_SoundIntensity = 120.0f; maxDist = SQR(120); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4920,7 +4922,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 4.0f; - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; maxDist = SQR(60); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4938,7 +4940,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 8); m_sQueueSample.m_nReleasingVolumeModificator = 7; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_SoundIntensity = 30.0f; maxDist = SQR(30); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4958,7 +4960,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = RandomDisplacement(1400) + 20000; m_sQueueSample.m_nReleasingVolumeModificator = 1; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.m_SoundIntensity = 40.0f; maxDist = SQR(40); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -4991,7 +4993,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 16); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_SoundIntensity = 30.0f; if (weaponType == WEAPONTYPE_UNARMED || weaponType == WEAPONTYPE_BRASSKNUCKLE) emittingVol = m_anRandomTable[1] % 10 + 35; else @@ -5020,7 +5022,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = (3 * m_sQueueSample.m_nFrequency) / 4; m_sQueueSample.m_nReleasingVolumeModificator = 6; m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_SoundIntensity = 20.0f; maxDist = SQR(20); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -5038,7 +5040,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_MINIGUN_FIRE_LEFT); m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = 150.0f; + m_sQueueSample.m_SoundIntensity = 150.0f; emittingVol = 127; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 0; @@ -5055,7 +5057,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = 18569; m_sQueueSample.m_nReleasingVolumeModificator = 2; m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = 150.0f; + m_sQueueSample.m_SoundIntensity = 150.0f; emittingVol = 127.0f * m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_afVolume[i]; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 0; @@ -5072,7 +5074,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_MINIGUN_STOP); m_sQueueSample.m_nReleasingVolumeModificator = 4; m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = 150.0f; + m_sQueueSample.m_SoundIntensity = 150.0f; maxDist = SQR(150); m_sQueueSample.m_nLoopCount = 1; RESET_LOOP_OFFSETS @@ -5115,7 +5117,7 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 3.0f; - m_sQueueSample.m_fSoundIntensity = 15.0f; + m_sQueueSample.m_SoundIntensity = 15.0f; maxDist = SQR(15); m_sQueueSample.m_nLoopCount = 0; SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) @@ -5135,10 +5137,10 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms) iSound = 21; if (params.m_fDistance < maxDist) { CalculateDistance(params.m_bDistanceCalculated, params.m_fDistance); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { if (stereo) { - if (m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_fSoundIntensity) { + if (m_sQueueSample.m_fDistance < 0.2f * m_sQueueSample.m_SoundIntensity) { m_sQueueSample.m_bIs2D = TRUE; m_sQueueSample.m_nOffset = 0; } else { @@ -8138,7 +8140,7 @@ cPedComments::Process() AudioManager.m_sQueueSample.m_nEmittingVolume = MAX_VOLUME; #endif AudioManager.m_sQueueSample.m_fSpeedMultiplier = 3.0f; - AudioManager.m_sQueueSample.m_fSoundIntensity = 40.0f; + AudioManager.m_sQueueSample.m_SoundIntensity = 40.0f; AudioManager.m_sQueueSample.m_bReleasingSoundFlag = TRUE; AudioManager.m_sQueueSample.m_vecPos = m_asPedComments[m_nActiveBank][m_nIndexMap[m_nActiveBank][0]].m_vecPos; AudioManager.m_sQueueSample.m_bReverbFlag = TRUE; @@ -8212,7 +8214,7 @@ cAudioManager::ProcessExplosions(int32 explosion) case EXPLOSION_ROCKET: case EXPLOSION_BARREL: case EXPLOSION_TANK_GRENADE: - m_sQueueSample.m_fSoundIntensity = 200.0f; + m_sQueueSample.m_SoundIntensity = 200.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 0; @@ -8220,7 +8222,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_bRequireReflection = TRUE; break; case EXPLOSION_MOLOTOV: - m_sQueueSample.m_fSoundIntensity = 150.0f; + m_sQueueSample.m_SoundIntensity = 150.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_3; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19000; m_sQueueSample.m_nReleasingVolumeModificator = 0; @@ -8229,7 +8231,7 @@ cAudioManager::ProcessExplosions(int32 explosion) break; case EXPLOSION_MINE: case EXPLOSION_HELI_BOMB: - m_sQueueSample.m_fSoundIntensity = 200.0f; + m_sQueueSample.m_SoundIntensity = 200.0f; m_sQueueSample.m_nSampleIndex = SFX_ROCKET_LEFT; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 12347; m_sQueueSample.m_nReleasingVolumeModificator = 0; @@ -8237,7 +8239,7 @@ cAudioManager::ProcessExplosions(int32 explosion) m_sQueueSample.m_bRequireReflection = TRUE; break; default: - m_sQueueSample.m_fSoundIntensity = 200.0f; + m_sQueueSample.m_SoundIntensity = 200.0f; m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; m_sQueueSample.m_nFrequency = RandomDisplacement(1000) + 19500; if (type == EXPLOSION_HELI) @@ -8248,9 +8250,9 @@ cAudioManager::ProcessExplosions(int32 explosion) } m_sQueueSample.m_vecPos = *CExplosion::GetExplosionPosition(i); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(MAX_VOLUME, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_fSpeedMultiplier = 2.0f; @@ -8280,7 +8282,7 @@ cAudioManager::ProcessFires(int32) if (entity) { switch (entity->GetType()) { case ENTITY_TYPE_BUILDING: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; emittingVol = 100; m_sQueueSample.m_nFrequency = 8 * SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE) / 10; @@ -8288,7 +8290,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nReleasingVolumeModificator = 6; break; case ENTITY_TYPE_PED: - m_sQueueSample.m_fSoundIntensity = 25.0f; + m_sQueueSample.m_SoundIntensity = 25.0f; m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE); emittingVol = 60; @@ -8296,7 +8298,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nReleasingVolumeModificator = 10; break; default: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); m_sQueueSample.m_nFrequency += i * (m_sQueueSample.m_nFrequency / 64); @@ -8304,7 +8306,7 @@ cAudioManager::ProcessFires(int32) m_sQueueSample.m_nReleasingVolumeModificator = 8; } } else { - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_CAR_ON_FIRE; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_CAR_ON_FIRE); emittingVol = 80; @@ -8312,9 +8314,9 @@ cAudioManager::ProcessFires(int32) } m_sQueueSample.m_vecPos = gFireManager.m_aFires[i].m_vecPos; distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_nBankIndex = SFX_BANK_0; @@ -8333,7 +8335,7 @@ cAudioManager::ProcessFires(int32) if (gFireManager.m_aFires[i].m_bExtinguishedWithWater) { gFireManager.m_aFires[i].m_bExtinguishedWithWater = FALSE; emittingVol = 100.0f * gFireManager.m_aFires[i].m_fWaterExtinguishCountdown; - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nFrequency = 19591; @@ -8370,7 +8372,7 @@ cAudioManager::ProcessWaterCannon(int32) m_sQueueSample.m_fDistance = Sqrt(distSquared); m_sQueueSample.m_nVolume = ComputeVolume(50, SOUND_INTENSITY, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_nSampleIndex = SFX_JUMBO_TAXI; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = 15591; @@ -8422,7 +8424,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) switch (sound) { case SCRIPT_SOUND_POLICE_CELL_DOOR_CLUNK: - m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.m_SoundIntensity = 40.0f; m_sQueueSample.m_nSampleIndex = SFX_COL_GATE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = 10600; @@ -8434,7 +8436,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bRequireReflection = TRUE; break; case SCRIPT_SOUND_GARAGE_DOOR_CLUNK: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_COL_CAR_PANEL_2; // huh? m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = 22000; @@ -8449,7 +8451,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) case SCRIPT_SOUND_BULLET_HIT_GROUND_1: case SCRIPT_SOUND_BULLET_HIT_GROUND_2: case SCRIPT_SOUND_BULLET_HIT_GROUND_3: - m_sQueueSample.m_fSoundIntensity = 50.0f; + m_sQueueSample.m_SoundIntensity = 50.0f; m_sQueueSample.m_nSampleIndex = m_anRandomTable[iSound % 5] % 3 + SFX_BULLET_WALL_1; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -8461,7 +8463,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) break; case SCRIPT_SOUND_WILLIE_CARD_SWIPE: emittingVolume = 70; - m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.m_SoundIntensity = 40.0f; m_sQueueSample.m_nSampleIndex = SFX_BOMB_BEEP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = 20159; @@ -8485,7 +8487,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) return; } case SCRIPT_SOUND_SEAPLANE_LOW_FUEL: - m_sQueueSample.m_fSoundIntensity = 1000.0f; + m_sQueueSample.m_SoundIntensity = 1000.0f; m_sQueueSample.m_nSampleIndex = SFX_SEAPLANE_LOW; m_sQueueSample.m_nBankIndex = SFX_BANK_0; emittingVolume = 100; @@ -8496,7 +8498,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bRequireReflection = FALSE; break; //case SCRIPT_SOUND_PAYPHONE_RINGING: - // m_sQueueSample.m_fSoundIntensity = 80.0f; + // m_sQueueSample.m_SoundIntensity = 80.0f; // m_sQueueSample.m_nSampleIndex = SFX_PHONE_RING; // m_sQueueSample.m_nBankIndex = SFX_BANK_0; // emittingVolume = 80; @@ -8507,7 +8509,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) // m_sQueueSample.m_bRequireReflection = FALSE; // break; case SCRIPT_SOUND_GLASS_BREAK_L: - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH; m_sQueueSample.m_nBankIndex = SFX_BANK_0; emittingVolume = 70; @@ -8517,7 +8519,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_GLASS_BREAK_S: - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_GLASS_SMASH; m_sQueueSample.m_nBankIndex = SFX_BANK_0; emittingVolume = 60; @@ -8527,7 +8529,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_GLASS_CRACK: - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK; m_sQueueSample.m_nBankIndex = SFX_BANK_0; emittingVolume = 70; @@ -8538,7 +8540,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_bRequireReflection = TRUE; break; case SCRIPT_SOUND_GLASS_LIGHT_BREAK: - m_sQueueSample.m_fSoundIntensity = 55.0f; + m_sQueueSample.m_SoundIntensity = 55.0f; m_sQueueSample.m_nSampleIndex = (m_anRandomTable[4] & 3) + SFX_GLASS_SHARD_1; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = RandomDisplacement(2000) + 19000; @@ -8548,7 +8550,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = RandomDisplacement(11) + 25; break; case SCRIPT_SOUND_BOX_DESTROYED_1: - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_WOODEN_BOX_SMASH; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; @@ -8559,7 +8561,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_BOX_DESTROYED_2: - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_CARDBOARD_BOX_SMASH; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 18600; @@ -8570,7 +8572,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = m_anRandomTable[2] % 20 + 80; break; case SCRIPT_SOUND_METAL_COLLISION: - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = m_anRandomTable[3] % 5 + SFX_COL_CAR_1; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -8582,7 +8584,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = m_anRandomTable[2] % 30 + 70; break; case SCRIPT_SOUND_TIRE_COLLISION: - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_TYRE_BUMP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -8594,7 +8596,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) emittingVolume = m_anRandomTable[2] % 30 + 60; break; case SCRIPT_SOUND_HIT_BALL: - m_sQueueSample.m_fSoundIntensity = 60.0f; + m_sQueueSample.m_SoundIntensity = 60.0f; m_sQueueSample.m_nSampleIndex = SFX_HIT_BALL; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); @@ -8635,7 +8637,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nFrequency = RandomDisplacement(1500) + 30000; m_sQueueSample.m_nReleasingVolumeModificator = 15; } - m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_SoundIntensity = 20.0f; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; @@ -8645,7 +8647,7 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BULLET_SHELL_HIT_GROUND_2; m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 11000; m_sQueueSample.m_nReleasingVolumeModificator = 18; - m_sQueueSample.m_fSoundIntensity = 20.0f; + m_sQueueSample.m_SoundIntensity = 20.0f; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_fSpeedMultiplier = 0.0f; m_sQueueSample.m_bIs2D = FALSE; @@ -8656,9 +8658,9 @@ cAudioManager::ProcessOneShotScriptObject(uint8 sound) } distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = iSound++; m_sQueueSample.m_nLoopCount = 1; @@ -8679,7 +8681,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) switch(sound) { case SCRIPT_SOUND_BANK_ALARM_LOOP: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_BUILDINGS_BANK_ALARM; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_BANK_ALARM; emittingVolume = 90; @@ -8691,7 +8693,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) break; case SCRIPT_SOUND_POLICE_CELL_DOOR_SLIDING_LOOP: case SCRIPT_SOUND_GARAGE_DOOR_SLIDING_LOOP: - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_GARAGE_DOOR_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; emittingVolume = 90; @@ -8702,7 +8704,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_SNORING_LOOP: - m_sQueueSample.m_fSoundIntensity = 6.0f; + m_sQueueSample.m_SoundIntensity = 6.0f; m_sQueueSample.m_nSampleIndex = SFX_BUILDING_SNORE; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_SNORING; emittingVolume = 25; @@ -8713,7 +8715,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_bIs2D = FALSE; break; case SCRIPT_SOUND_SHOOTING_RANGE_TARGET_MOVING_LOOP: - m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.m_SoundIntensity = 40.0f; m_sQueueSample.m_nSampleIndex = SFX_TANK_TURRET; m_sQueueSample.m_nBankIndex = SFX_BANK_0; emittingVolume = 60; @@ -8726,7 +8728,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_NEW_BUILDING_BAR_1: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_1; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_BAR_1; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8737,7 +8739,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_NEW_BUILDING_BAR_2: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_2; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_BAR_2; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8748,7 +8750,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_NEW_BUILDING_BAR_3: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_3; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_BAR_3; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8759,7 +8761,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_NEW_BUILDING_BAR_4: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_BAR_4; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_BAR_4; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8772,7 +8774,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BUILDING_MAL1; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_MALIBU_1; MusicManager.SetMalibuClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_MALIBU_1); - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8785,7 +8787,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BUILDING_MAL2; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_MALIBU_2; MusicManager.SetMalibuClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_MALIBU_2); - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8798,7 +8800,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BUILDING_MAL3; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_MALIBU_3; MusicManager.SetMalibuClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_MALIBU_3); - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8811,7 +8813,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BUILDING_STR1; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_STRIP_1; MusicManager.SetStripClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_STRIP_1); - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8824,7 +8826,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BUILDING_STR2; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_STRIP_2; MusicManager.SetStripClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_STRIP_2); - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8837,7 +8839,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) m_sQueueSample.m_nSampleIndex = SFX_BUILDING_STR3; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_STRIP_3; MusicManager.SetStripClubTrackPos(SCRIPT_SOUND_NEW_BUILDING_STRIP_3); - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8848,7 +8850,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) case SCRIPT_SOUND_NEW_BUILDING_CHURCH: m_sQueueSample.m_nSampleIndex = SFX_BUILDING_CHURCH; m_sQueueSample.m_nBankIndex = SFX_BANK_BUILDING_CHURCH; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; emittingVolume = 127; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); m_sQueueSample.m_nReleasingVolumeModificator = 3; @@ -8858,7 +8860,7 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) break; case SCRIPT_SOUND_NEW_WATERFALL: emittingVolume = 30; - m_sQueueSample.m_fSoundIntensity = 80.0f; + m_sQueueSample.m_SoundIntensity = 80.0f; m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = 20812; @@ -8871,9 +8873,9 @@ cAudioManager::ProcessLoopingScriptObject(uint8 sound) } distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if(distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + if(distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if(m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = 0; m_sQueueSample.m_bIs2D = FALSE; @@ -8900,21 +8902,23 @@ cAudioManager::ProcessWeather(int32 id) static uint8 iSound = 0; - if (m_asAudioEntities[id].m_AudioEvents != 0 && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) { - if (m_asAudioEntities[id].m_afVolume[0] >= 10.f) { - m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; - m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA; - m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; - vol = (m_asAudioEntities[id].m_afVolume[0] - 10.0f) + 40; - } else { + if (m_asAudioEntities[id].m_AudioEvents > 0 && m_asAudioEntities[id].m_awAudioEvent[0] == SOUND_LIGHTNING) { + if (m_asAudioEntities[id].m_afVolume[0] < 10.0f) { m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_2; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; - vol = (m_asAudioEntities[id].m_afVolume[0]) + 35; + vol = (m_asAudioEntities[id].m_afVolume[0] * 10.0f * 0.1f) + 35; + vol += 35; + } else { + m_sQueueSample.m_nSampleIndex = SFX_EXPLOSION_1; + m_sQueueSample.m_nBankIndex = SFX_BANK_GENERIC_EXTRA; + m_sQueueSample.m_nFrequency = RandomDisplacement(500) + 4000; + vol = ((m_asAudioEntities[id].m_afVolume[0] - 10.0f) * 10.0f * 0.1f); + vol += 40; } m_sQueueSample.m_nVolume = vol; if (TheCamera.SoundDistUp < 20.0f) - m_sQueueSample.m_nVolume /= 2; + m_sQueueSample.m_nVolume <<= 1; if (iSound == 4) iSound = 0; m_sQueueSample.m_nCounter = iSound++; @@ -9261,7 +9265,7 @@ cAudioManager::ProcessProjectiles() switch (CProjectileInfo::GetProjectileInfo(i)->m_eWeaponType) { case WEAPONTYPE_TEARGAS: emittingVol = 80; - m_sQueueSample.m_fSoundIntensity = 40.0f; + m_sQueueSample.m_SoundIntensity = 40.0f; m_sQueueSample.m_nSampleIndex = SFX_PALM_TREE_LO; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = 13879; @@ -9269,7 +9273,7 @@ cAudioManager::ProcessProjectiles() break; case WEAPONTYPE_MOLOTOV: emittingVol = 50; - m_sQueueSample.m_fSoundIntensity = 30.0f; + m_sQueueSample.m_SoundIntensity = 30.0f; m_sQueueSample.m_nSampleIndex = SFX_PED_ON_FIRE; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = 32 * SampleManager.GetSampleBaseFrequency(SFX_PED_ON_FIRE) / 25; @@ -9277,7 +9281,7 @@ cAudioManager::ProcessProjectiles() break; case WEAPONTYPE_ROCKET: emittingVol = 127; - m_sQueueSample.m_fSoundIntensity = 90.0f; + m_sQueueSample.m_SoundIntensity = 90.0f; m_sQueueSample.m_nSampleIndex = SFX_ROCKET_FLY; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_ROCKET_FLY); @@ -9290,9 +9294,9 @@ cAudioManager::ProcessProjectiles() m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_vecPos = CProjectileInfo::ms_apProjectile[i]->GetPosition(); distSquared = GetDistanceSquared(m_sQueueSample.m_vecPos); - if (distSquared < SQR(m_sQueueSample.m_fSoundIntensity)) { + if (distSquared < SQR(m_sQueueSample.m_SoundIntensity)) { m_sQueueSample.m_fDistance = Sqrt(distSquared); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume != 0) { m_sQueueSample.m_nCounter = i; m_sQueueSample.m_bIs2D = FALSE; @@ -9332,7 +9336,7 @@ cAudioManager::ProcessEscalators() m_sQueueSample.m_nReleasingVolumeModificator = 3; m_sQueueSample.m_fSpeedMultiplier = 3.0f; m_sQueueSample.m_nReleasingVolumeDivider = 5; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_nCounter = i; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; @@ -9377,7 +9381,7 @@ cAudioManager::ProcessExtraSounds() // SET_EMITTING_VOLUME(EMITTING_VOLUME); // SET_LOOP_OFFSETS(SFX_ARCADE) // m_sQueueSample.m_bReverbFlag = TRUE; - // m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + // m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; // m_sQueueSample.m_bRequireReflection = FALSE; // m_sQueueSample.m_nReleasingVolumeDivider = 3; // AddSampleToRequestedQueue(); @@ -9457,7 +9461,7 @@ cAudioManager::ProcessGarages() SET_EMITTING_VOLUME(90); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bRequireReflection = FALSE; AddSampleToRequestedQueue(); @@ -9487,7 +9491,7 @@ cAudioManager::ProcessGarages() m_sQueueSample.m_nReleasingVolumeModificator = 4; SET_EMITTING_VOLUME(60); m_sQueueSample.m_fSpeedMultiplier = 0.0f; - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReverbFlag = TRUE; m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_bReleasingSoundFlag = TRUE; @@ -9531,7 +9535,7 @@ cAudioManager::ProcessFireHydrant() m_sQueueSample.m_bIs2D = FALSE; m_sQueueSample.m_nLoopCount = 0; SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) - m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY; + m_sQueueSample.m_SoundIntensity = SOUND_INTENSITY; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; @@ -9591,7 +9595,7 @@ cAudioManager::ProcessBridgeWarning() SET_EMITTING_VOLUME(100); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = 450.0f; + m_sQueueSample.m_SoundIntensity = 450.0f; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 8; m_sQueueSample.m_bReverbFlag = FALSE; @@ -9617,7 +9621,7 @@ cAudioManager::ProcessBridgeMotor() SET_EMITTING_VOLUME(MAX_VOLUME); SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex) m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = bridgeIntensity; + m_sQueueSample.m_SoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = FALSE; m_sQueueSample.m_nReleasingVolumeDivider = 3; m_sQueueSample.m_bReverbFlag = FALSE; @@ -9651,7 +9655,7 @@ cAudioManager::ProcessBridgeOneShots() SET_EMITTING_VOLUME(MAX_VOLUME); RESET_LOOP_OFFSETS m_sQueueSample.m_fSpeedMultiplier = 2.0f; - m_sQueueSample.m_fSoundIntensity = bridgeIntensity; + m_sQueueSample.m_SoundIntensity = bridgeIntensity; m_sQueueSample.m_bReleasingSoundFlag = TRUE; m_sQueueSample.m_bReverbFlag = FALSE; m_sQueueSample.m_bRequireReflection = FALSE; diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index d1a4f439..77474c3a 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -697,7 +697,6 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample) m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample; } -#ifdef GTA_PC void cAudioManager::AddReflectionsToRequestedQueue() { @@ -719,7 +718,7 @@ cAudioManager::AddReflectionsToRequestedQueue() } else { emittingVolume = (9 * m_sQueueSample.m_nVolume) / 16; } - m_sQueueSample.m_fSoundIntensity /= 2.f; + m_sQueueSample.m_SoundIntensity /= 2.f; int halfOldFreq = oldFreq >> 1; @@ -728,12 +727,12 @@ cAudioManager::AddReflectionsToRequestedQueue() m_afReflectionsDistances[i] = (m_anRandomTable[i % 4] % 3) * 100.f / 8.f; reflectionDistance = m_afReflectionsDistances[i]; - if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_fSoundIntensity) { + if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_SoundIntensity) { m_sQueueSample.m_nLoopsRemaining = CTimer::GetIsSlowMotionActive() ? (reflectionDistance * 800.f / 1029.f) : (reflectionDistance * 500.f / 1029.f); if (m_sQueueSample.m_nLoopsRemaining > 3) { m_sQueueSample.m_fDistance = m_afReflectionsDistances[i]; SET_EMITTING_VOLUME(emittingVolume); - m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_fSoundIntensity, m_sQueueSample.m_fDistance); + m_sQueueSample.m_nVolume = ComputeVolume(emittingVolume, m_sQueueSample.m_SoundIntensity, m_sQueueSample.m_fDistance); if (m_sQueueSample.m_nVolume > emittingVolume / 16) { m_sQueueSample.m_nCounter = oldCounter + (i + 1) * 256; @@ -762,43 +761,87 @@ cAudioManager::AddReflectionsToRequestedQueue() void cAudioManager::UpdateReflections() { - CVector camPos = TheCamera.GetPosition(); + CVector camPos; CColPoint colpoint; CEntity *ent; +#if GTA_VERSION < GTAVC_PC_10 if (m_FrameCounter % 8 == 0) { + camPos = TheCamera.GetPosition(); + m_avecReflectionsPos[0] = camPos; + m_avecReflectionsPos[0].y += 50.0f; + if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true)) + m_afReflectionsDistances[0] = Distance(camPos, colpoint.point); + else + m_afReflectionsDistances[0] = 50.0f; + } else if ((m_FrameCounter + 1) % 8 == 0) { + camPos = TheCamera.GetPosition(); + m_avecReflectionsPos[1] = camPos; + m_avecReflectionsPos[1].y -= 50.0f; + if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true)) + m_afReflectionsDistances[1] = Distance(camPos, colpoint.point); + else + m_afReflectionsDistances[1] = 50.0f; + } else if ((m_FrameCounter + 2) % 8 == 0) { + camPos = TheCamera.GetPosition(); + m_avecReflectionsPos[2] = camPos; + m_avecReflectionsPos[2].x -= 50.0f; + if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true)) + m_afReflectionsDistances[2] = Distance(camPos, colpoint.point); + else + m_afReflectionsDistances[2] = 50.0f; + } else if ((m_FrameCounter + 3) % 8 == 0) { + camPos = TheCamera.GetPosition(); + m_avecReflectionsPos[3] = camPos; + m_avecReflectionsPos[3].x += 50.0f; + if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true)) + m_afReflectionsDistances[3] = Distance(camPos, colpoint.point); + else + m_afReflectionsDistances[3] = 50.0f; + } else if ((m_FrameCounter + 4) % 8 == 0) { + camPos = TheCamera.GetPosition(); + m_avecReflectionsPos[4] = camPos; + m_avecReflectionsPos[4].z += 50.0f; + if (CWorld::ProcessVerticalLine(camPos, m_avecReflectionsPos[4].z, colpoint, ent, true, false, false, false, true, false, nil)) + m_afReflectionsDistances[4] = colpoint.point.z - camPos.z; + else + m_afReflectionsDistances[4] = 50.0f; + } +#else + if (m_FrameCounter % 8 == 0) { + camPos = TheCamera.GetPosition(); m_avecReflectionsPos[0] = camPos; m_avecReflectionsPos[0].y += 100.f; if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[0], colpoint, ent, true, false, false, true, false, true, true)) m_afReflectionsDistances[0] = Distance(camPos, colpoint.point); else m_afReflectionsDistances[0] = 100.0f; - } else if ((m_FrameCounter + 1) % 8 == 0) { + camPos = TheCamera.GetPosition(); m_avecReflectionsPos[1] = camPos; m_avecReflectionsPos[1].y -= 100.0f; if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[1], colpoint, ent, true, false, false, true, false, true, true)) m_afReflectionsDistances[1] = Distance(camPos, colpoint.point); else m_afReflectionsDistances[1] = 100.0f; - } else if ((m_FrameCounter + 2) % 8 == 0) { + camPos = TheCamera.GetPosition(); m_avecReflectionsPos[2] = camPos; m_avecReflectionsPos[2].x -= 100.0f; if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[2], colpoint, ent, true, false, false, true, false, true, true)) m_afReflectionsDistances[2] = Distance(camPos, colpoint.point); else m_afReflectionsDistances[2] = 100.0f; - } else if ((m_FrameCounter + 3) % 8 == 0) { + camPos = TheCamera.GetPosition(); m_avecReflectionsPos[3] = camPos; m_avecReflectionsPos[3].x += 100.0f; if (CWorld::ProcessLineOfSight(camPos, m_avecReflectionsPos[3], colpoint, ent, true, false, false, true, false, true, true)) m_afReflectionsDistances[3] = Distance(camPos, colpoint.point); else m_afReflectionsDistances[3] = 100.0f; - } else if ((m_FrameCounter + 4) % 8 == 0) { + camPos = TheCamera.GetPosition(); camPos.y += 1.0f; m_avecReflectionsPos[4] = camPos; m_avecReflectionsPos[4].z += 100.0f; @@ -806,8 +849,8 @@ cAudioManager::UpdateReflections() m_afReflectionsDistances[4] = colpoint.point.z - camPos.z; else m_afReflectionsDistances[4] = 100.0f; - } else if ((m_FrameCounter + 5) % 8 == 0) { + camPos = TheCamera.GetPosition(); camPos.y -= 1.0f; m_avecReflectionsPos[5] = camPos; m_avecReflectionsPos[5].z += 100.0f; @@ -815,8 +858,8 @@ cAudioManager::UpdateReflections() m_afReflectionsDistances[5] = colpoint.point.z - camPos.z; else m_afReflectionsDistances[5] = 100.0f; - } else if ((m_FrameCounter + 6) % 8 == 0) { + camPos = TheCamera.GetPosition(); camPos.x -= 1.0f; m_avecReflectionsPos[6] = camPos; m_avecReflectionsPos[6].z += 100.0f; @@ -824,8 +867,8 @@ cAudioManager::UpdateReflections() m_afReflectionsDistances[6] = colpoint.point.z - camPos.z; else m_afReflectionsDistances[6] = 100.0f; - } else if ((m_FrameCounter + 7) % 8 == 0) { + camPos = TheCamera.GetPosition(); camPos.x += 1.0f; m_avecReflectionsPos[7] = camPos; m_avecReflectionsPos[7].z += 100.0f; @@ -834,8 +877,8 @@ cAudioManager::UpdateReflections() else m_afReflectionsDistances[7] = 100.0f; } +#endif } -#endif // GTA_PC void cAudioManager::AddReleasingSounds() @@ -863,7 +906,7 @@ cAudioManager::AddReleasingSounds() } } if (!toProcess[i]) { - if (sample.m_nCounter <= 255 || !sample.m_nLoopsRemaining) { + if (sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) { if (sample.m_nReleasingVolumeDivider == 0) continue; if (sample.m_nLoopCount == 0) { @@ -1005,7 +1048,7 @@ cAudioManager::ProcessActiveQueues() TranslateEntity(&sample.m_vecPos, &position); #ifdef EXTERNAL_3D_SOUND SampleManager.SetChannel3DPosition(j, position.x, position.y, position.z); - SampleManager.SetChannel3DDistances(j, sample.m_fSoundIntensity, 0.25f * sample.m_fSoundIntensity); + SampleManager.SetChannel3DDistances(j, sample.m_SoundIntensity, 0.25f * sample.m_SoundIntensity); #else sample.m_nOffset = ComputePan(sample.m_fDistance, &position); SampleManager.SetChannelPan(j, sample.m_nOffset); @@ -1094,14 +1137,14 @@ cAudioManager::ProcessActiveQueues() usedX = x; usedY = 0.0f; usedZ = 0.0f; - m_asActiveSamples[k].m_fSoundIntensity = 100000.0f; + m_asActiveSamples[k].m_SoundIntensity = 100000.0f; } else { usedX = position.x; usedY = position.y; usedZ = position.z; } SampleManager.SetChannel3DPosition(k, usedX, usedY, usedZ); - SampleManager.SetChannel3DDistances(k, m_asActiveSamples[k].m_fSoundIntensity, 0.25f * m_asActiveSamples[k].m_fSoundIntensity); + SampleManager.SetChannel3DDistances(k, m_asActiveSamples[k].m_SoundIntensity, 0.25f * m_asActiveSamples[k].m_SoundIntensity); #endif SampleManager.StartChannel(k); } @@ -1150,7 +1193,7 @@ cAudioManager::ClearActiveSamples() m_asActiveSamples[i].m_nLoopEnd = -1; #endif m_asActiveSamples[i].m_fSpeedMultiplier = 0.0f; - m_asActiveSamples[i].m_fSoundIntensity = 200.0f; + m_asActiveSamples[i].m_SoundIntensity = 200.0f; m_asActiveSamples[i].m_nOffset = 63; m_asActiveSamples[i].m_bReleasingSoundFlag = FALSE; m_asActiveSamples[i].m_nCalculatedVolume = 0; @@ -1186,7 +1229,7 @@ cAudioManager::AdjustSamplesVolume() tSound *pSample = &m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]]; if (!pSample->m_bIs2D) - pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_fSoundIntensity, pSample->m_fDistance); + pSample->m_nEmittingVolume = ComputeEmittingVolume(pSample->m_nEmittingVolume, pSample->m_SoundIntensity, pSample->m_fDistance); } } diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 59a8abe8..759cb0bf 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -27,10 +27,12 @@ public: uint8 m_nEmittingVolume; #endif float m_fSpeedMultiplier; - float m_fSoundIntensity; + float m_SoundIntensity; bool8 m_bReleasingSoundFlag; CVector m_vecPos; - bool8 m_bReverbFlag; +#ifndef GTA_PS2 + bool8 m_bReverbFlag; // TODO: ifdef all the occurrences +#endif uint8 m_nLoopsRemaining; bool8 m_bRequireReflection; // Used for oneshots uint8 m_nOffset; @@ -182,6 +184,24 @@ public: VALIDATE_SIZE(cVehicleParams, 0x1C); +#if GTA_VERSION < GTAVC_PC_10 +enum { + /* + REFLECTION_YMAX = 0, top + REFLECTION_YMIN = 1, bottom + REFLECTION_XMIN = 2, left + REFLECTION_XMAX = 3, right + REFLECTION_ZMAX = 4, + */ + + REFLECTION_TOP = 0, + REFLECTION_BOTTOM, + REFLECTION_LEFT, + REFLECTION_RIGHT, + REFLECTION_UP, + MAX_REFLECTIONS, +}; +#else enum { REFLECTION_NORTH = 0, REFLECTION_SOUTH, @@ -193,6 +213,7 @@ enum { REFLECTION_CEIL_EAST, MAX_REFLECTIONS, }; +#endif enum PLAY_STATUS { PLAY_STATUS_STOPPED = 0, PLAY_STATUS_PLAYING, PLAY_STATUS_FINISHED }; enum LOADING_STATUS { LOADING_STATUS_NOT_LOADED = 0, LOADING_STATUS_LOADED, LOADING_STATUS_FAILED }; @@ -219,10 +240,8 @@ public: tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES]; int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES]; int32 m_nAudioEntitiesTotal; -#ifdef GTA_PC CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS]; float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS]; -#endif cAudioScriptObjectManager m_sAudioScriptObjectManager; // miami @@ -301,10 +320,8 @@ public: void InterrogateAudioEntities(); // inlined void AddSampleToRequestedQueue(); void AddDetailsToRequestedOrderList(uint8 sample); // inlined in vc -#ifdef GTA_PC void AddReflectionsToRequestedQueue(); void UpdateReflections(); -#endif void AddReleasingSounds(); void ProcessActiveQueues(); void ClearRequestedQueue(); // inlined in vc @@ -341,7 +358,7 @@ public: void ProcessVehicleFlatTyre(cVehicleParams ¶ms); bool8 ProcessVehicleRoadNoise(cVehicleParams ¶ms); bool8 ProcessWetRoadNoise(cVehicleParams ¶ms); - void ProcessVehicleEngine(cVehicleParams ¶ms); + bool8 ProcessVehicleEngine(cVehicleParams ¶ms); void UpdateGasPedalAudio(CVehicle *veh, int vehType); void PlayerJustGotInCar(); void PlayerJustLeftCar(); diff --git a/src/core/ControllerConfig.cpp b/src/core/ControllerConfig.cpp index 72d31137..dbb0bd87 100644 --- a/src/core/ControllerConfig.cpp +++ b/src/core/ControllerConfig.cpp @@ -2673,6 +2673,14 @@ const char *PlayStationButtons[][MAX_CONTROLLERACTIONS] = #undef PS2_CROSS #undef PS2_SQUARE +const char *NintendoSwitchButtons_noIcons[][MAX_CONTROLLERACTIONS] = + CONTROLLER_BUTTONS("Y", "A", "B", "X", "L", "ZL", "LS", "R", "ZR", "RS", "BACK", "right stick up", "right stick down", "right stick left", "right stick right"); + +#ifdef BUTTON_ICONS +const char *NintendoSwitchButtons[][MAX_CONTROLLERACTIONS] = + CONTROLLER_BUTTONS("~T~", "~O~", "~X~", "~Q~", "~K~", "~M~", "~A~", "~J~", "~V~", "~C~", "BACK", "~H~", "~L~", "~(~", "~)~"); +#endif + #undef UP #undef DOWN #undef LEFT @@ -2698,6 +2706,9 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar * case CMenuManager::CONTROLLER_DUALSHOCK4: Buttons = CFont::ButtonsSlot != -1 ? PlayStationButtons : PlayStationButtons_noIcons; break; + case CMenuManager::CONTROLLER_NINTENDO_SWITCH: + Buttons = CFont::ButtonsSlot != -1 ? NintendoSwitchButtons : NintendoSwitchButtons_noIcons; + break; default: #endif Buttons = CFont::ButtonsSlot != -1 ? XboxButtons : XboxButtons_noIcons; @@ -2713,6 +2724,9 @@ void CControllerConfigManager::GetWideStringOfCommandKeys(uint16 action, wchar * case CMenuManager::CONTROLLER_DUALSHOCK4: Buttons = PlayStationButtons_noIcons; break; + case CMenuManager::CONTROLLER_NINTENDO_SWITCH: + Buttons = NintendoSwitchButtons_noIcons; + break; default: Buttons = XboxButtons_noIcons; break; diff --git a/src/core/Frontend.cpp b/src/core/Frontend.cpp index 98ac2bd5..b9eb193a 100644 --- a/src/core/Frontend.cpp +++ b/src/core/Frontend.cpp @@ -554,8 +554,12 @@ CMenuManager::CMenuManager() #endif #ifdef GAMEPAD_MENU +#ifdef __SWITCH__ + m_PrefsControllerType = CONTROLLER_NINTENDO_SWITCH; +#else m_PrefsControllerType = CONTROLLER_XBOXONE; #endif +#endif #ifdef MISSION_REPLAY m_bAttemptingMissionRetry = false; @@ -585,7 +589,11 @@ CMenuManager::Initialise(void) m_nCurrOption = 0; m_nOptionHighlightTransitionBlend = 0; CentreMousePointer(); +#ifdef GTA_HANDHELD + m_bShowMouse = false; +#else m_bShowMouse = true; +#endif m_fMapSize = MENU_Y(162.0f); // Y because of HOR+ m_fMapCenterX = MENU_X_LEFT_ALIGNED(320.0f); m_fMapCenterY = MENU_Y(225.0f); @@ -3174,9 +3182,6 @@ CMenuManager::LoadSettings() if (LoadINISettings()) { LoadINIControllerSettings(); } - // if no reVC.ini, create it, or update it with new values - SaveINISettings(); - SaveINIControllerSettings(); #endif #ifdef FIX_BUGS @@ -5987,6 +5992,7 @@ const char* controllerTypesPaths[] = { "MODELS/FRONTEND_DS4.TXD", "MODELS/FRONTEND_X360.TXD", "MODELS/FRONTEND_XONE.TXD", + "MODELS/FRONTEND_NSW.TXD", }; void @@ -6097,6 +6103,18 @@ CMenuManager::PrintController(void) TEXT_L2R2_Y += 5.0f; TEXT_SELECT_X += 3.0f; break; + case CONTROLLER_NINTENDO_SWITCH: + TEXT_L1_Y += 5.0f; + TEXT_L1_Y_VEH = TEXT_L1_Y; + TEXT_R1_Y += 5.0f; + TEXT_TRIANGLE_Y += 3.0f; + TEXT_CIRCLE_Y += 3.0f; + TEXT_CROSS_Y += 3.0f; + TEXT_LSTICK_Y -= 23.0f; + TEXT_DPAD_Y += 25.0; + TEXT_RSTICK_Y += 1.0f; + TEXT_R3_Y += 1.0f; + break; }; if (m_DisplayControllerOnFoot) { @@ -6393,6 +6411,7 @@ CMenuManager::PrintController(void) { case CONTROLLER_XBOXONE: case CONTROLLER_XBOX360: + case CONTROLLER_NINTENDO_SWITCH: CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE * 2 * scale * 0.65f), MENU_Y(SMALLESTTEXT_Y_SCALE * scale * 0.65f)); switch (m_PrefsLanguage) { @@ -6473,6 +6492,7 @@ CMenuManager::PrintController(void) { case CONTROLLER_XBOXONE: case CONTROLLER_XBOX360: + case CONTROLLER_NINTENDO_SWITCH: CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE * 2 * scale * 0.65f), MENU_Y(SMALLESTTEXT_Y_SCALE * scale * 0.65f)); switch (m_PrefsLanguage) { @@ -6556,6 +6576,7 @@ CMenuManager::PrintController(void) { case CONTROLLER_XBOXONE: case CONTROLLER_XBOX360: + case CONTROLLER_NINTENDO_SWITCH: CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE * 2 * scale * 0.65f), MENU_Y(SMALLESTTEXT_Y_SCALE * scale * 0.65f)); switch (m_PrefsLanguage) { @@ -6640,6 +6661,7 @@ CMenuManager::PrintController(void) { case CONTROLLER_XBOXONE: case CONTROLLER_XBOX360: + case CONTROLLER_NINTENDO_SWITCH: CFont::SetScale(MENU_X(SMALLESTTEXT_X_SCALE * 2 * scale * 0.65f), MENU_Y(SMALLESTTEXT_Y_SCALE * scale * 0.65f)); CFont::PrintStringFromBottom(MENU_X_LEFT_ALIGNED(X(TEXT_SQUARE_X)), MENU_Y(Y(TEXT_SQUARE_Y)), TheText.Get("FEC_SMT")); break; @@ -6682,6 +6704,9 @@ CMenuManager::LoadController(int8 type) case CONTROLLER_DUALSHOCK4: CFont::LoadButtons("MODELS/PS3BTNS.TXD"); break; + case CONTROLLER_NINTENDO_SWITCH: + CFont::LoadButtons("MODELS/NSWBTNS.TXD"); + break; default: CFont::LoadButtons("MODELS/X360BTNS.TXD"); break; diff --git a/src/core/Frontend.h b/src/core/Frontend.h index 276506b6..b9be5a82 100644 --- a/src/core/Frontend.h +++ b/src/core/Frontend.h @@ -731,6 +731,7 @@ public: CONTROLLER_DUALSHOCK4, CONTROLLER_XBOX360, CONTROLLER_XBOXONE, + CONTROLLER_NINTENDO_SWITCH, }; int8 m_PrefsControllerType; diff --git a/src/core/MenuScreensCustom.cpp b/src/core/MenuScreensCustom.cpp index ae20e2e7..ca3db581 100644 --- a/src/core/MenuScreensCustom.cpp +++ b/src/core/MenuScreensCustom.cpp @@ -37,7 +37,7 @@ #ifdef CUSTOM_FRONTEND_OPTIONS -#ifdef IMPROVED_VIDEOMODE +#if defined(IMPROVED_VIDEOMODE) && !defined(GTA_HANDHELD) #define VIDEOMODE_SELECTOR MENUACTION_CFO_SELECT, "FEM_SCF", { new CCFOSelect((int8*)&FrontEndMenuManager.m_nPrefsWindowed, "VideoMode", "Windowed", screenModes, 2, true, ScreenModeAfterChange, true) }, 0, 0, MENUALIGN_LEFT, #else #define VIDEOMODE_SELECTOR @@ -380,7 +380,7 @@ void DetectJoystickGoBack() { #endif #ifdef GAMEPAD_MENU -const char* controllerTypes[] = { "FEC_DS2", "FEC_DS3", "FEC_DS4", "FEC_360", "FEC_ONE" }; +const char* controllerTypes[] = { "FEC_DS2", "FEC_DS3", "FEC_DS4", "FEC_360", "FEC_ONE", "FEC_NSW" }; void ControllerTypeAfterChange(int8 before, int8 after) { FrontEndMenuManager.LoadController(after); @@ -430,6 +430,7 @@ CMenuScreenCustom aScreens[] = { { "FEH_DIS", MENUPAGE_OPTIONS, new CCustomScreenLayout({40, 78, 25, true}), nil, MENUACTION_BRIGHTNESS, "FED_BRI", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 0, 0, MENUALIGN_LEFT, MENUACTION_DRAWDIST, "FEM_LOD", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 0, 0, MENUALIGN_LEFT, + DENSITY_SLIDERS #ifdef LEGACY_MENU_OPTIONS MENUACTION_FRAMESYNC, "FEM_VSC", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 0, 0, MENUALIGN_LEFT, #endif @@ -449,7 +450,6 @@ CMenuScreenCustom aScreens[] = { DUALPASS_SELECTOR CUTSCENE_BORDERS_TOGGLE FREE_CAM_TOGGLE - DENSITY_SLIDERS POSTFX_SELECTORS // re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined MENUACTION_RESTOREDEF, "FET_DEF", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 320, 0, MENUALIGN_CENTER, @@ -459,9 +459,9 @@ CMenuScreenCustom aScreens[] = { { "FEH_DIS", MENUPAGE_OPTIONS, new CCustomScreenLayout({40, 78, 25, true}), nil, MENUACTION_BRIGHTNESS, "FED_BRI", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT, MENUACTION_DRAWDIST, "FEM_LOD", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT, + DENSITY_SLIDERS CUTSCENE_BORDERS_TOGGLE FREE_CAM_TOGGLE - DENSITY_SLIDERS MENUACTION_LEGENDS, "MAP_LEG", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT, MENUACTION_RADARMODE, "FED_RDR", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT, MENUACTION_HUD, "FED_HUD", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS }, 0, 0, MENUALIGN_LEFT, @@ -638,7 +638,11 @@ CMenuScreenCustom aScreens[] = { // MENUPAGE_OPTIONS = 27 { "FET_OPT", MENUPAGE_NONE, nil, nil, +#ifdef GTA_HANDHELD + MENUACTION_CHANGEMENU, "FEO_CON", {nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS}, 320, 132, MENUALIGN_CENTER, +#else MENUACTION_CHANGEMENU, "FEO_CON", {nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC}, 320, 132, MENUALIGN_CENTER, +#endif MENUACTION_LOADRADIO, "FEO_AUD", {nil, SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS}, 0, 0, MENUALIGN_CENTER, MENUACTION_CHANGEMENU, "FEO_DIS", {nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS}, 0, 0, MENUALIGN_CENTER, #ifdef GRAPHICS_MENU_OPTIONS @@ -694,7 +698,11 @@ CMenuScreenCustom aScreens[] = { { "", 0, nil, nil, }, #ifdef GAMEPAD_MENU +#ifdef GTA_HANDHELD + { "FET_AGS", MENUPAGE_OPTIONS, new CCustomScreenLayout({40, 78, 25, true, true}), nil, +#else { "FET_AGS", MENUPAGE_CONTROLLER_PC, new CCustomScreenLayout({40, 78, 25, true, true}), nil, +#endif MENUACTION_CTRLCONFIG, "FEC_CCF", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS }, 40, 76, MENUALIGN_LEFT, MENUACTION_CTRLDISPLAY, "FEC_CDP", { nil, SAVESLOT_NONE, MENUPAGE_CONTROLLER_SETTINGS }, 0, 0, MENUALIGN_LEFT, INVERT_PAD_SELECTOR @@ -760,7 +768,9 @@ CMenuScreenCustom aScreens[] = { // MENUPAGE_GRAPHICS_SETTINGS { "FET_GFX", MENUPAGE_OPTIONS, new CCustomScreenLayout({40, 78, 25, true, true}), GraphicsGoBack, +#ifndef GTA_HANDHELD MENUACTION_SCREENRES, "FED_RES", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, +#endif MENUACTION_WIDESCREEN, "FED_WIS", { nil, SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS }, 0, 0, MENUALIGN_LEFT, VIDEOMODE_SELECTOR #ifdef LEGACY_MENU_OPTIONS diff --git a/src/core/common.h b/src/core/common.h index 57961f08..916c4df5 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -11,6 +11,11 @@ #define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc #endif + +#ifdef __SWITCH__ +#include <switch.h> +#endif + #include <stdint.h> #include <string.h> #include <math.h> diff --git a/src/core/config.h b/src/core/config.h index db6a64ed..cf87e5eb 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -170,6 +170,11 @@ enum Config { #define GTA_VERSION GTAVC_PC_11 +// Enable configuration for handheld console ports +#if defined(__SWITCH__) || defined(PSP2) + #define GTA_HANDHELD +#endif + // TODO(MIAMI): someone ought to find and check out uses of these defines: //#define GTA3_STEAM_PATCH //#define GTAVC_JP_PATCH @@ -182,7 +187,9 @@ enum Config { # define PS2_MENU #elif defined GTA_PC # define EXTERNAL_3D_SOUND -# define PC_PLAYER_CONTROLS // mouse player/cam mode +# ifndef GTA_HANDHELD +# define PC_PLAYER_CONTROLS // mouse player/cam mode +# endif //# define GTA_REPLAY # define GTA_SCENE_EDIT # define PC_MENU @@ -343,7 +350,7 @@ enum Config { #if !defined(RW_GL3) && defined(_WIN32) #define XINPUT #endif -#if defined XINPUT || (defined RW_GL3 && !defined LIBRW_SDL2 && !defined __SWITCH__) +#if defined XINPUT || (defined RW_GL3 && !defined LIBRW_SDL2 && !defined GTA_HANDHELD) #define DETECT_JOYSTICK_MENU // Then we'll expect user to enter Controller->Detect joysticks if his joystick isn't detected at the start. #endif #define DETECT_PAD_INPUT_SWITCH // Adds automatic switch of pad related stuff between controller and kb/m @@ -365,7 +372,7 @@ enum Config { //# define PS2_MENU_USEALLPAGEICONS #else # define MAP_ENHANCEMENTS // Adding waypoint and better mouse support -# ifdef XINPUT +# if defined(XINPUT) || defined(GTA_HANDHELD) # define GAMEPAD_MENU // Add gamepad menu # endif # define TRIANGLE_BACK_BUTTON @@ -484,6 +491,14 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually #undef USE_CUTSCENE_SHADOW_FOR_PED #endif +#ifdef GTA_HANDHELD + #define IGNORE_MOUSE_KEYBOARD // ignore mouse & keyboard input +#endif + +#ifdef __SWITCH__ + #define USE_UNNAMED_SEM // named semaphores are unsupported on the switch +#endif + #endif // VANILLA_DEFINES #if defined(AUDIO_OAL) && !defined(EXTERNAL_3D_SOUND) diff --git a/src/core/re3.cpp b/src/core/re3.cpp index 7a3be156..1c57b2f5 100644 --- a/src/core/re3.cpp +++ b/src/core/re3.cpp @@ -48,9 +48,7 @@ #include "Population.h" #include "IniFile.h" -#ifdef DETECT_JOYSTICK_MENU #include "crossplatform.h" -#endif #ifndef _WIN32 #include "assert.h" diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp index 6d88db99..8657c426 100644 --- a/src/peds/Ped.cpp +++ b/src/peds/Ped.cpp @@ -1237,8 +1237,12 @@ CPed::ClearAimFlag(void) m_lookTimer = 0; } - if (IsPlayer()) + if (IsPlayer()) { ((CPlayerPed*)this)->m_fFPSMoveHeading = 0.0f; +#ifdef FREE_CAM + ((CPlayerPed*)this)->m_bFreeAimActive = false; +#endif + } } void diff --git a/src/peds/PedFight.cpp b/src/peds/PedFight.cpp index 6fd1e949..eda59f2e 100644 --- a/src/peds/PedFight.cpp +++ b/src/peds/PedFight.cpp @@ -347,11 +347,17 @@ CPed::SetAttack(CEntity *victim) if (m_pLookTarget) { SetAimFlag(m_pLookTarget); - } else if (this == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam()) { - SetAimFlag(m_fRotationCur); - ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch(); - } else if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) { - SetAimFlag(m_fRotationCur); +#ifdef FREE_CAM + } else if (this != FindPlayerPed() || !((CPlayerPed*)this)->m_bFreeAimActive) { +#else + } else { +#endif + if (this == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam()) { + SetAimFlag(m_fRotationCur); + ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch(); + } else if (curWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) { + SetAimFlag(m_fRotationCur); + } } } #ifdef FIX_BUGS @@ -823,6 +829,9 @@ CPed::Attack(void) if (!bIsDucking && !GetFireAnimNotDucking(ourWeapon) && ourWeapon->IsFlagSet(WEAPONFLAG_CANAIM_WITHARM)) m_pedIK.m_flags |= CPedIK::AIMS_WITH_ARM; else +#ifdef FREE_CAM + if (!IsPlayer() || !((CPlayerPed*)this)->m_bFreeAimActive) +#endif m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; } @@ -1019,6 +1028,15 @@ CPed::Attack(void) weaponAnimAssoc->SetCurrentTime(animLoopEnd); weaponAnimAssoc->flags &= ~ASSOC_RUNNING; SetPointGunAt(m_pPointGunAt); +#ifdef FREE_CAM + } else if (IsPlayer() && ((CPlayerPed*)this)->m_bFreeAimActive && GetWeapon()->m_eWeaponState != WEAPONSTATE_RELOADING) { + float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation); + SetLookFlag(limitedCam, true, true); + SetAimFlag(limitedCam); + SetLookTimer(INT32_MAX); + SetPointGunAt(nil); + ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch(); +#endif } else { ClearAimFlag(); diff --git a/src/peds/PlayerPed.cpp b/src/peds/PlayerPed.cpp index 88c1e6bf..3da6c500 100644 --- a/src/peds/PlayerPed.cpp +++ b/src/peds/PlayerPed.cpp @@ -98,6 +98,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1) m_nAttackDirToCheck = 0; m_nLastBusFareCollected = 0; idleAnimBlockIndex = CAnimManager::GetAnimationBlockIndex("playidles"); +#ifdef FREE_CAM + m_bFreeAimActive = false; +#endif } void @@ -1343,17 +1346,22 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) if ((padUsed->GetTarget() && CAN_AIM_WITH_ARM) || padUsed->GetWeapon()) { float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation); + m_cachedCamSource = TheCamera.Cams[TheCamera.ActiveCam].Source; + m_cachedCamFront = TheCamera.Cams[TheCamera.ActiveCam].Front; + m_cachedCamUp = TheCamera.Cams[TheCamera.ActiveCam].Up; + // On this one we can rotate arm. if (CAN_AIM_WITH_ARM) { - if (!padUsed->GetWeapon()) { // making this State != ATTACK still stops it after attack. Re-start it immediately! - SetPointGunAt(nil); - bIsPointingGunAt = false; // to not stop after attack - } pointedGun = 2; - SetLookFlag(limitedCam, true); + m_bFreeAimActive = true; + SetLookFlag(limitedCam, true, true); SetAimFlag(limitedCam); - SetLookTimer(INT32_MAX); // removing this makes head move for real, but I experinced some bugs. - + SetLookTimer(INT32_MAX); + ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch(); + if (m_nPedState != PED_ATTACK && m_nPedState != PED_AIM_GUN) { + // This is a seperate ped state just for pointing gun. Used for target button + SetPointGunAt(nil); + } } else { m_fRotationDest = limitedCam; changedHeadingRate = 2; @@ -1381,9 +1389,19 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed) changedHeadingRate = 0; RestoreHeadingRate(); } - if (pointedGun == 1 && m_nPedState != PED_ATTACK) { - pointedGun = 0; - ClearPointGunAt(); + if (pointedGun == 1) { + if (m_nPedState == PED_ATTACK) { + if (!padUsed->GetWeapon() && (m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) { + float limitedCam = CGeneral::LimitRadianAngle(-TheCamera.Orientation); + + SetAimFlag(limitedCam); + ((CPlayerPed*)this)->m_fFPSMoveHeading = TheCamera.Find3rdPersonQuickAimPitch(); + m_bFreeAimActive = true; + } + } else { + pointedGun = 0; + ClearPointGunAt(); + } } #endif diff --git a/src/peds/PlayerPed.h b/src/peds/PlayerPed.h index 1b7158b5..30b67199 100644 --- a/src/peds/PlayerPed.h +++ b/src/peds/PlayerPed.h @@ -44,6 +44,12 @@ public: float m_fGunSpinAngle; unsigned int m_nPadDownPressedInMilliseconds; unsigned int m_nLastBusFareCollected; +#ifdef FREE_CAM + bool m_bFreeAimActive; + CVector m_cachedCamSource; + CVector m_cachedCamFront; + CVector m_cachedCamUp; +#endif static bool bDontAllowWeaponChange; #ifndef MASTER diff --git a/src/skel/crossplatform.cpp b/src/skel/crossplatform.cpp index f7016b21..58ab7920 100644 --- a/src/skel/crossplatform.cpp +++ b/src/skel/crossplatform.cpp @@ -198,6 +198,20 @@ char* casepath(char const* path, bool checkPathFirst) size_t rl = 0; DIR* d; + char* c; + + #if defined(__SWITCH__) || defined(PSP2) + if( (c = strstr(p, ":/")) != NULL) // scheme used by some environments, eg. switch, vita + { + size_t deviceNameOffset = c - p + 3; + char* deviceNamePath = (char*)alloca(deviceNameOffset + 1); + strlcpy(deviceNamePath, p, deviceNameOffset); + deviceNamePath[deviceNameOffset] = 0; + d = opendir(deviceNamePath); + p = c + 1; + } + else + #endif if (p[0] == '/' || p[0] == '\\') { d = opendir("/"); @@ -212,7 +226,7 @@ char* casepath(char const* path, bool checkPathFirst) bool cantProceed = false; // just convert slashes in what's left in string, don't correct case of letters(because we can't) bool mayBeTrailingSlash = false; - char* c; + while (c = strsep(&p, "/\\")) { // May be trailing slash(allow), slash at the start(avoid), or multiple slashes(avoid) @@ -293,3 +307,133 @@ char *_strdate(char *buf) { return strdate(buf); } #endif + +#ifdef __SWITCH__ +/* Taken from glibc */ +char *realpath(const char *name, char *resolved) +{ + char *rpath, *dest = NULL; + const char *start, *end, *rpath_limit; + long int path_max; + + /* As per Single Unix Specification V2 we must return an error if + either parameter is a null pointer. We extend this to allow + the RESOLVED parameter to be NULL in case the we are expected to + allocate the room for the return value. */ + if (!name) + return NULL; + + /* As per Single Unix Specification V2 we must return an error if + the name argument points to an empty string. */ + if (name[0] == '\0') + return NULL; + +#ifdef PATH_MAX + path_max = PATH_MAX; +#else + path_max = pathconf(name, _PC_PATH_MAX); + if (path_max <= 0) + path_max = 1024; +#endif + + if (!resolved) + { + rpath = (char*)malloc(path_max); + if (!rpath) + return NULL; + } + else + rpath = resolved; + rpath_limit = rpath + path_max; + + if (name[0] != '/') + { + if (!getcwd(rpath, path_max)) + { + rpath[0] = '\0'; + goto error; + } + dest = (char*)memchr(rpath, '\0', path_max); + } + else + { + rpath[0] = '/'; + dest = rpath + 1; + } + + for (start = end = name; *start; start = end) + { + /* Skip sequence of multiple path-separators. */ + while (*start == '/') + ++start; + + /* Find end of path component. */ + for (end = start; *end && *end != '/'; ++end) + /* Nothing. */; + + if (end - start == 0) + break; + else if (end - start == 1 && start[0] == '.') + /* nothing */; + else if (end - start == 2 && start[0] == '.' && start[1] == '.') + { + /* Back up to previous component, ignore if at root already. */ + if (dest > rpath + 1) + while ((--dest)[-1] != '/') + ; + } + else + { + size_t new_size; + + if (dest[-1] != '/') + *dest++ = '/'; + + if (dest + (end - start) >= rpath_limit) + { + ptrdiff_t dest_offset = dest - rpath; + char *new_rpath; + + if (resolved) + { + if (dest > rpath + 1) + dest--; + *dest = '\0'; + goto error; + } + new_size = rpath_limit - rpath; + if (end - start + 1 > path_max) + new_size += end - start + 1; + else + new_size += path_max; + new_rpath = (char *)realloc(rpath, new_size); + if (!new_rpath) + goto error; + rpath = new_rpath; + rpath_limit = rpath + new_size; + + dest = rpath + dest_offset; + } + + dest = (char*)memcpy(dest, start, end - start); + *dest = '\0'; + } + } + if (dest > rpath + 1 && dest[-1] == '/') + --dest; + *dest = '\0'; + + return rpath; + +error: + if (!resolved) + free(rpath); + return NULL; +} + +ssize_t readlink (const char * __path, char * __buf, size_t __buflen) +{ + errno = ENOSYS; + return -1; +} +#endif diff --git a/src/skel/crossplatform.h b/src/skel/crossplatform.h index f37e64a1..4ab7d156 100644 --- a/src/skel/crossplatform.h +++ b/src/skel/crossplatform.h @@ -161,3 +161,28 @@ bool FindNextFile(HANDLE, WIN32_FIND_DATA*); void FileTimeToSystemTime(time_t*, SYSTEMTIME*); void GetDateFormat(int, int, SYSTEMTIME*, int, char*, int); #endif + +#ifdef __SWITCH__ + +// tweak glfw values for switch to match expected pc bindings +#ifdef GLFW_GAMEPAD_BUTTON_A + #undef GLFW_GAMEPAD_BUTTON_A +#endif +#define GLFW_GAMEPAD_BUTTON_A 1 + +#ifdef GLFW_GAMEPAD_BUTTON_B + #undef GLFW_GAMEPAD_BUTTON_B +#endif +#define GLFW_GAMEPAD_BUTTON_B 0 + +#ifdef GLFW_GAMEPAD_BUTTON_X + #undef GLFW_GAMEPAD_BUTTON_X +#endif +#define GLFW_GAMEPAD_BUTTON_X 3 + +#ifdef GLFW_GAMEPAD_BUTTON_Y + #undef GLFW_GAMEPAD_BUTTON_Y +#endif +#define GLFW_GAMEPAD_BUTTON_Y 2 + +#endif diff --git a/src/skel/events.cpp b/src/skel/events.cpp index 3e1e95b3..87447819 100644 --- a/src/skel/events.cpp +++ b/src/skel/events.cpp @@ -821,7 +821,9 @@ PadHandler(RsEvent event, void *param) RwBool AttachInputDevices(void) { +#ifndef IGNORE_MOUSE_KEYBOARD RsInputDeviceAttach(rsKEYBOARD, KeyboardHandler); +#endif RsInputDeviceAttach(rsPAD, PadHandler); diff --git a/src/skel/glfw/glfw.cpp b/src/skel/glfw/glfw.cpp index 8d07fb18..cd517232 100644 --- a/src/skel/glfw/glfw.cpp +++ b/src/skel/glfw/glfw.cpp @@ -12,12 +12,14 @@ DWORD _dwOperatingSystemVersion; #include "resource.h" #else long _dwOperatingSystemVersion; +#ifndef __SWITCH__ #ifndef __APPLE__ #include <sys/sysinfo.h> #else #include <mach/mach_host.h> #include <sys/sysctl.h> #endif +#endif #include <errno.h> #include <locale.h> #include <signal.h> @@ -51,7 +53,7 @@ long _dwOperatingSystemVersion; #include "MemoryMgr.h" // We found out that GLFW's keyboard input handling is still pretty delayed/not stable, so now we fetch input from X11 directly on Linux. -#if !defined _WIN32 && !defined __APPLE__ && !defined __SWITCH__ // && !defined WAYLAND +#if !defined _WIN32 && !defined __APPLE__ && !defined GTA_HANDHELD // && !defined WAYLAND #define GET_KEYBOARD_INPUT_FROM_X11 #endif @@ -331,6 +333,78 @@ psNativeTextureSupport(void) /* ***************************************************************************** */ + +#ifdef __SWITCH__ + +static HidVibrationValue SwitchVibrationValues[2]; +static HidVibrationDeviceHandle SwitchVibrationDeviceHandles[2][2]; +static HidVibrationDeviceHandle SwitchVibrationDeviceGC; + +static PadState SwitchPad; + +static Result HidInitializationResult[2]; +static Result HidInitializationGCResult; + +static void _psInitializeVibration() +{ + HidInitializationResult[0] = hidInitializeVibrationDevices(SwitchVibrationDeviceHandles[0], 2, HidNpadIdType_Handheld, HidNpadStyleTag_NpadHandheld); + if(R_FAILED(HidInitializationResult[0])) { + printf("Failed to initialize VibrationDevice for Handheld Mode\n"); + } + HidInitializationResult[1] = hidInitializeVibrationDevices(SwitchVibrationDeviceHandles[1], 2, HidNpadIdType_No1, HidNpadStyleSet_NpadFullCtrl); + if(R_FAILED(HidInitializationResult[1])) { + printf("Failed to initialize VibrationDevice for Detached Mode\n"); + } + HidInitializationGCResult = hidInitializeVibrationDevices(&SwitchVibrationDeviceGC, 1, HidNpadIdType_No1, HidNpadStyleTag_NpadGc); + if(R_FAILED(HidInitializationResult[1])) { + printf("Failed to initialize VibrationDevice for GC Mode\n"); + } + + SwitchVibrationValues[0].freq_low = 160.0f; + SwitchVibrationValues[0].freq_high = 320.0f; + + padConfigureInput(1, HidNpadStyleSet_NpadFullCtrl); + padInitializeDefault(&SwitchPad); +} + +static void _psHandleVibration() +{ + padUpdate(&SwitchPad); + + uint8 target_device = padIsHandheld(&SwitchPad) ? 0 : 1; + + if(R_SUCCEEDED(HidInitializationResult[target_device])) { + CPad* pad = CPad::GetPad(0); + + // value conversion based on SDL2 switch port + SwitchVibrationValues[0].amp_high = SwitchVibrationValues[0].amp_low = pad->ShakeFreq == 0 ? 0.0f : 320.0f; + SwitchVibrationValues[0].freq_low = pad->ShakeFreq == 0.0 ? 160.0f : (float)pad->ShakeFreq * 1.26f; + SwitchVibrationValues[0].freq_high = pad->ShakeFreq == 0.0 ? 320.0f : (float)pad->ShakeFreq * 1.26f; + + if (pad->ShakeDur < CTimer::GetTimeStepInMilliseconds()) + pad->ShakeDur = 0; + else + pad->ShakeDur -= CTimer::GetTimeStepInMilliseconds(); + if (pad->ShakeDur == 0) pad->ShakeFreq = 0; + + + if(target_device == 1 && R_SUCCEEDED(HidInitializationGCResult)) { + // gamecube rumble + hidSendVibrationGcErmCommand(SwitchVibrationDeviceGC, pad->ShakeFreq > 0 ? HidVibrationGcErmCommand_Start : HidVibrationGcErmCommand_Stop); + } + + memcpy(&SwitchVibrationValues[1], &SwitchVibrationValues[0], sizeof(HidVibrationValue)); + hidSendVibrationValues(SwitchVibrationDeviceHandles[target_device], SwitchVibrationValues, 2); + } +} +#else +static void _psInitializeVibration() {} +static void _psHandleVibration() {} +#endif + +/* + ***************************************************************************** + */ RwBool psInitialize(void) { @@ -407,6 +481,8 @@ psInitialize(void) InitialiseLanguage(); #endif + + _psInitializeVibration(); gGameState = GS_START_UP; TRACE("gGameState = GS_START_UP"); @@ -480,6 +556,9 @@ psInitialize(void) _dwMemAvailPhys = (uint64_t)(vm_stat.free_count * page_size); debug("Physical memory size %llu\n", _dwMemAvailPhys); debug("Available physical memory %llu\n", size); +#elif defined (__SWITCH__) + svcGetInfo(&_dwMemAvailPhys, InfoType_UsedMemorySize, CUR_PROCESS_HANDLE, 0); + debug("Physical memory size %llu\n", _dwMemAvailPhys); #else #ifndef __APPLE__ struct sysinfo systemInfo; @@ -982,13 +1061,15 @@ void psPostRWinit(void) RwVideoMode vm; RwEngineGetVideoModeInfo(&vm, GcurSelVM); + glfwSetFramebufferSizeCallback(PSGLOBAL(window), resizeCB); +#ifndef IGNORE_MOUSE_KEYBOARD #ifndef GET_KEYBOARD_INPUT_FROM_X11 glfwSetKeyCallback(PSGLOBAL(window), keypressCB); #endif - glfwSetFramebufferSizeCallback(PSGLOBAL(window), resizeCB); glfwSetScrollCallback(PSGLOBAL(window), scrollCB); glfwSetCursorPosCallback(PSGLOBAL(window), cursorCB); glfwSetCursorEnterCallback(PSGLOBAL(window), cursorEnterCB); +#endif glfwSetWindowIconifyCallback(PSGLOBAL(window), windowIconifyCB); glfwSetWindowFocusCallback(PSGLOBAL(window), windowFocusCB); glfwSetJoystickCallback(joysChangeCB); @@ -1824,7 +1905,7 @@ main(int argc, char *argv[]) InitMemoryMgr(); #endif -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__SWITCH__) struct sigaction act; act.sa_sigaction = terminateHandler; act.sa_flags = SA_SIGINFO; @@ -1968,10 +2049,12 @@ main(int argc, char *argv[]) #ifdef LOAD_INI_SETTINGS LoadINIControllerSettings(); - if (connectedPadButtons != 0) { - ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); - SaveINIControllerSettings(); - } + if (connectedPadButtons != 0) + ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); // add (connected-saved) amount of new button assignments on top of ours + + // these have 2 purposes: creating .ini at the start, and adding newly introduced settings to old .ini at the start + SaveINISettings(); + SaveINIControllerSettings(); #endif } @@ -2486,7 +2569,9 @@ void CapturePad(RwInt32 padID) if ( Abs(rightStickPos.y) > 0.3f ) pad->PCTempJoyState.RightStickY = (int32)(rightStickPos.y * 128.0f); } - + + _psHandleVibration(); + return; } diff --git a/src/skel/win/win.cpp b/src/skel/win/win.cpp index a6d8bea8..639f6272 100644 --- a/src/skel/win/win.cpp +++ b/src/skel/win/win.cpp @@ -2179,10 +2179,12 @@ WinMain(HINSTANCE instance, #ifdef LOAD_INI_SETTINGS LoadINIControllerSettings(); - if (connectedPadButtons != 0) { - ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); - SaveINIControllerSettings(); - } + if (connectedPadButtons != 0) + ControlsManager.InitDefaultControlConfigJoyPad(connectedPadButtons); // add (connected-saved) amount of new button assignments on top of ours + + // these have 2 purposes: creating .ini at the start, and adding newly introduced settings to old .ini at the start + SaveINISettings(); + SaveINIControllerSettings(); #endif } diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp index a249ee7f..810c1661 100644 --- a/src/vehicles/Automobile.cpp +++ b/src/vehicles/Automobile.cpp @@ -3600,6 +3600,7 @@ CAutomobile::ProcessBuoyancy(void) CVector impulse, point; if(mod_Buoyancy.ProcessBuoyancy(this, m_fBuoyancy, &point, &impulse)){ + bTouchingWater = true; float timeStep = Max(CTimer::GetTimeStep(), 0.01f); float impulseRatio = impulse.z / (GRAVITY * m_fMass * timeStep); float waterResistance = Pow(1.0f - 0.05f*impulseRatio, CTimer::GetTimeStep()); @@ -3614,7 +3615,7 @@ CAutomobile::ProcessBuoyancy(void) heliHitWaterHard = true; } }else{ - float strength = 1.0f/Max(8.0f*impulseRatio, 1.0f); + float strength = Max(8.0f*impulseRatio, 1.0f); ApplyMoveForce(-2.0f*impulse/strength); ApplyTurnForce(-impulse/strength, point); if(impulseRatio > 0.9f){ diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp index 39f2265f..31738dbc 100644 --- a/src/weapons/Weapon.cpp +++ b/src/weapons/Weapon.cpp @@ -49,6 +49,29 @@ bool CWeapon::bPhotographHasBeenTaken; int32 sniperPirateCheck = 0x00797743; // 'Cwy\0' ??? #endif +#ifdef FREE_CAM +static bool +Find3rdPersonCamTargetVectorFromCachedVectors(float dist, CVector pos, CVector& source, CVector& target, CVector camSource, CVector camFront, CVector camUp) +{ + if (CPad::GetPad(0)->GetLookBehindForPed()) { + source = pos; + target = dist * FindPlayerPed()->GetForward() + source; + return false; + } else { + float angleX = DEGTORAD((CCamera::m_f3rdPersonCHairMultX - 0.5f) * 1.8f * 0.5f * TheCamera.Cams[TheCamera.ActiveCam].FOV * CDraw::GetAspectRatio()); + float angleY = DEGTORAD((0.5f - CCamera::m_f3rdPersonCHairMultY) * 1.8f * 0.5f * TheCamera.Cams[TheCamera.ActiveCam].FOV); + source = camSource; + target = camFront; + target += camUp * Tan(angleY); + target += CrossProduct(camFront, camUp) * Tan(angleX); + target.Normalise(); + source += DotProduct(pos - source, target) * target; + target = dist * target + source; + return true; + } +} +#endif + CWeaponInfo * CWeapon::GetInfo() { @@ -943,17 +966,23 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource) } else if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() ) { - TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target); #ifdef FREE_CAM - CPed *shooterPed = (CPed *)shooter; - if((shooterPed->m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) { - target.x = info->m_fRange; - target.y = 0.0f; - target.z = 0.0f; + if (CCamera::bFreeCam) { + CPlayerPed* shooterPed = (CPlayerPed*)shooter; + Find3rdPersonCamTargetVectorFromCachedVectors(info->m_fRange, *fireSource, source, target, shooterPed->m_cachedCamSource, shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp); - shooterPed->TransformToNode(target, PED_HANDR); - } + if ((shooterPed->m_pedIK.m_flags & CPedIK::GUN_POINTED_SUCCESSFULLY) == 0) { + target.x = info->m_fRange; + target.y = 0.0f; + target.z = 0.0f; + + shooterPed->TransformToNode(target, PED_HANDR); + } + } else #endif + { + TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target); + } #ifdef FIX_BUGS // fix muzzleflash rotation @@ -1708,8 +1737,19 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource) if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() ) { - TheCamera.Find3rdPersonCamTargetVector(1.0f, *fireSource, source, target); - CVector Left = CrossProduct(TheCamera.Cams[TheCamera.ActiveCam].Front, TheCamera.Cams[TheCamera.ActiveCam].Up); + CVector Left; +#ifdef FREE_CAM + if (CCamera::bFreeCam) { + CPlayerPed* shooterPed = (CPlayerPed*)shooter; + Find3rdPersonCamTargetVectorFromCachedVectors(1.0f, *fireSource, source, target, shooterPed->m_cachedCamSource, shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp); + Left = CrossProduct(shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp); + } + else +#endif + { + TheCamera.Find3rdPersonCamTargetVector(1.0f, *fireSource, source, target); + Left = CrossProduct(TheCamera.Cams[TheCamera.ActiveCam].Front, TheCamera.Cams[TheCamera.ActiveCam].Up); + } float f = (i - (shootsAtOnce / 2)) * angleBetweenTwoShot; target = f * Left + target - source; @@ -2151,7 +2191,16 @@ CWeapon::FireAreaEffect(CEntity *shooter, CVector *fireSource) if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() ) { - TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target); +#ifdef FREE_CAM + if (CCamera::bFreeCam) { + CPlayerPed* shooterPed = (CPlayerPed*)shooter; + Find3rdPersonCamTargetVectorFromCachedVectors(info->m_fRange, *fireSource, source, target, shooterPed->m_cachedCamSource, shooterPed->m_cachedCamFront, shooterPed->m_cachedCamUp); + } + else +#endif + { + TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target); + } float norm = (1.0f / info->m_fRange); dir = (target - source) * norm; } |