mirror of
https://github.com/GTAmodding/re3.git
synced 2024-12-29 04:55:39 +00:00
Merge branch 'miami' into lcs
# Conflicts: # premake5.lua # src/audio/AudioLogic.cpp # src/audio/sampman_miles.cpp # src/audio/sampman_oal.cpp
This commit is contained in:
commit
136b25133d
20 changed files with 944 additions and 422 deletions
2
.github/workflows/build-switch.yml
vendored
2
.github/workflows/build-switch.yml
vendored
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
name: re3 cmake devkitA64 (Nintendo Switch)
|
name: reVC cmake devkitA64 (Nintendo Switch)
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
|
|
27
autoconf/LICENSE.txt
Normal file
27
autoconf/LICENSE.txt
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
Copyright (c) 2016 Blizzard Entertainment and individual contributors.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without modification,
|
||||||
|
are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
|
||||||
|
3. Neither the name of Premake nor the names of its contributors may be
|
||||||
|
used to endorse or promote products derived from this software without
|
||||||
|
specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||||
|
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
305
autoconf/api.lua
Normal file
305
autoconf/api.lua
Normal file
|
@ -0,0 +1,305 @@
|
||||||
|
---
|
||||||
|
-- Autoconfiguration.
|
||||||
|
-- Copyright (c) 2016 Blizzard Entertainment
|
||||||
|
-- Enhanced by re3
|
||||||
|
---
|
||||||
|
local p = premake
|
||||||
|
local autoconf = p.modules.autoconf
|
||||||
|
autoconf.cache = {}
|
||||||
|
autoconf.parameters = ""
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- register autoconfigure api.
|
||||||
|
---
|
||||||
|
p.api.register {
|
||||||
|
name = "autoconfigure",
|
||||||
|
scope = "config",
|
||||||
|
kind = "table"
|
||||||
|
}
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Check for a particular include file.
|
||||||
|
--
|
||||||
|
-- @cfg : Current config.
|
||||||
|
-- @variable : The variable to store the result, such as 'HAVE_STDINT_H'.
|
||||||
|
-- @filename : The header file to check for.
|
||||||
|
---
|
||||||
|
function check_include(cfg, variable, filename)
|
||||||
|
local res = autoconf.cache_compile(cfg, variable, function ()
|
||||||
|
p.outln('#include <' .. filename .. '>')
|
||||||
|
p.outln('int main(void) { return 0; }')
|
||||||
|
end)
|
||||||
|
|
||||||
|
if res.value then
|
||||||
|
autoconf.set_value(cfg, variable, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Check for size of a particular type.
|
||||||
|
--
|
||||||
|
-- @cfg : Current config.
|
||||||
|
-- @variable : The variable to use, such as 'SIZEOF_SIZE_T', this method will also add "'HAVE_' .. variable".
|
||||||
|
-- @type : The type to check.
|
||||||
|
-- @headers : An optional array of header files to include.
|
||||||
|
-- @defines : An optional array of defines to define.
|
||||||
|
---
|
||||||
|
function check_type_size(cfg, variable, type, headers, defines)
|
||||||
|
check_include(cfg, 'HAVE_SYS_TYPES_H', 'sys/types.h')
|
||||||
|
check_include(cfg, 'HAVE_STDINT_H', 'stdint.h')
|
||||||
|
check_include(cfg, 'HAVE_STDDEF_H', 'stddef.h')
|
||||||
|
|
||||||
|
local res = autoconf.cache_compile(cfg, variable .. cfg.platform,
|
||||||
|
function ()
|
||||||
|
if cfg.autoconf['HAVE_SYS_TYPES_H'] then
|
||||||
|
p.outln('#include <sys/types.h>')
|
||||||
|
end
|
||||||
|
|
||||||
|
if cfg.autoconf['HAVE_STDINT_H'] then
|
||||||
|
p.outln('#include <stdint.h>')
|
||||||
|
end
|
||||||
|
|
||||||
|
if cfg.autoconf['HAVE_STDDEF_H'] then
|
||||||
|
p.outln('#include <stddef.h>')
|
||||||
|
end
|
||||||
|
|
||||||
|
autoconf.include_defines(defines)
|
||||||
|
autoconf.include_headers(headers)
|
||||||
|
p.outln("")
|
||||||
|
p.outln("#define SIZE (sizeof(" .. type .. "))")
|
||||||
|
p.outln("char info_size[] = {'I', 'N', 'F', 'O', ':', 's','i','z','e','[',")
|
||||||
|
p.outln(" ('0' + ((SIZE / 10000)%10)),")
|
||||||
|
p.outln(" ('0' + ((SIZE / 1000)%10)),")
|
||||||
|
p.outln(" ('0' + ((SIZE / 100)%10)),")
|
||||||
|
p.outln(" ('0' + ((SIZE / 10)%10)),")
|
||||||
|
p.outln(" ('0' + (SIZE %10)),")
|
||||||
|
p.outln(" ']', '\\0'};")
|
||||||
|
p.outln("")
|
||||||
|
p.outln("int main(int argc, char *argv[]) {")
|
||||||
|
p.outln(" int require = 0;")
|
||||||
|
p.outln(" require += info_size[argc];")
|
||||||
|
p.outln(" (void)argv;")
|
||||||
|
p.outln(" return require;")
|
||||||
|
p.outln("}")
|
||||||
|
end,
|
||||||
|
function (e)
|
||||||
|
-- if the compile step succeeded, we should have a binary with 'INFO:size[*****]'
|
||||||
|
-- somewhere in there.
|
||||||
|
local content = io.readfile(e.binary)
|
||||||
|
if content then
|
||||||
|
local size = string.find(content, 'INFO:size')
|
||||||
|
if size then
|
||||||
|
e.size = tonumber(string.sub(content, size+10, size+14))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
)
|
||||||
|
|
||||||
|
if res.size then
|
||||||
|
autoconf.set_value(cfg, 'HAVE_' .. variable, 1)
|
||||||
|
autoconf.set_value(cfg, variable, res.size)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Check if the given struct or class has the specified member variable
|
||||||
|
--
|
||||||
|
-- @cfg : current config.
|
||||||
|
-- @variable : variable to store the result.
|
||||||
|
-- @type : the name of the struct or class you are interested in
|
||||||
|
-- @member : the member which existence you want to check
|
||||||
|
-- @headers : an optional array of header files to include.
|
||||||
|
-- @defines : An optional array of defines to define.
|
||||||
|
---
|
||||||
|
function check_struct_has_member(cfg, variable, type, member, headers, defines)
|
||||||
|
local res = autoconf.cache_compile(cfg, variable, function ()
|
||||||
|
autoconf.include_defines(defines)
|
||||||
|
autoconf.include_headers(headers)
|
||||||
|
p.outln('int main(void) {')
|
||||||
|
p.outln(' (void)sizeof(((' .. type .. '*)0)->' .. member ..');')
|
||||||
|
p.outln(' return 0;')
|
||||||
|
p.outln('}')
|
||||||
|
end)
|
||||||
|
|
||||||
|
if res.value then
|
||||||
|
autoconf.set_value(cfg, variable, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Check if a symbol exists as a function, variable, or macro
|
||||||
|
--
|
||||||
|
-- @cfg : current config.
|
||||||
|
-- @variable : variable to store the result.
|
||||||
|
-- @symbol : The symbol to check for.
|
||||||
|
-- @headers : an optional array of header files to include.
|
||||||
|
-- @defines : An optional array of defines to define.
|
||||||
|
---
|
||||||
|
function check_symbol_exists(cfg, variable, symbol, headers, defines)
|
||||||
|
local h = headers
|
||||||
|
local res = autoconf.cache_compile(cfg, variable, function ()
|
||||||
|
autoconf.include_defines(defines)
|
||||||
|
autoconf.include_headers(headers)
|
||||||
|
p.outln('int main(int argc, char** argv) {')
|
||||||
|
p.outln(' (void)argv;')
|
||||||
|
p.outln('#ifndef ' .. symbol)
|
||||||
|
p.outln(' return ((int*)(&' .. symbol .. '))[argc];')
|
||||||
|
p.outln('#else')
|
||||||
|
p.outln(' (void)argc;')
|
||||||
|
p.outln(' return 0;')
|
||||||
|
p.outln('#endif')
|
||||||
|
p.outln('}')
|
||||||
|
end)
|
||||||
|
|
||||||
|
if res.value then
|
||||||
|
autoconf.set_value(cfg, variable, 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- try compiling a piece of c/c++
|
||||||
|
---
|
||||||
|
function autoconf.try_compile(cfg, cpp)
|
||||||
|
local ts = autoconf.toolset(cfg)
|
||||||
|
if ts then
|
||||||
|
return ts.try_compile(cfg, cpp, autoconf.parameters)
|
||||||
|
else
|
||||||
|
p.warnOnce('autoconf', 'no toolset found, autoconf always failing.')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function autoconf.cache_compile(cfg, entry, func, post)
|
||||||
|
if not autoconf.cache[entry] then
|
||||||
|
local cpp = p.capture(func)
|
||||||
|
local res = autoconf.try_compile(cfg, cpp)
|
||||||
|
if res then
|
||||||
|
local e = { binary = res, value = true }
|
||||||
|
if post then
|
||||||
|
post(e)
|
||||||
|
end
|
||||||
|
autoconf.cache[entry] = e
|
||||||
|
else
|
||||||
|
autoconf.cache[entry] = { }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return autoconf.cache[entry]
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- get the current configured toolset, or the default.
|
||||||
|
---
|
||||||
|
function autoconf.toolset(cfg)
|
||||||
|
local ts = p.config.toolset(cfg)
|
||||||
|
if not ts then
|
||||||
|
local tools = {
|
||||||
|
-- Actually we always return nil on msc. see msc.lua
|
||||||
|
['vs2010'] = p.tools.msc,
|
||||||
|
['vs2012'] = p.tools.msc,
|
||||||
|
['vs2013'] = p.tools.msc,
|
||||||
|
['vs2015'] = p.tools.msc,
|
||||||
|
['vs2017'] = p.tools.msc,
|
||||||
|
['vs2019'] = p.tools.msc,
|
||||||
|
['gmake'] = premake.tools.gcc,
|
||||||
|
['gmake2'] = premake.tools.gcc,
|
||||||
|
['codelite'] = premake.tools.gcc,
|
||||||
|
['xcode4'] = premake.tools.clang,
|
||||||
|
}
|
||||||
|
ts = tools[_ACTION]
|
||||||
|
end
|
||||||
|
return ts
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- store the value of the variable in the configuration
|
||||||
|
---
|
||||||
|
function autoconf.set_value(cfg, variable, value)
|
||||||
|
cfg.autoconf[variable] = value
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- write the cfg.autoconf table to the file
|
||||||
|
---
|
||||||
|
function autoconf.writefile(cfg, filename)
|
||||||
|
if cfg.autoconf then
|
||||||
|
local file = io.open(filename, "w+")
|
||||||
|
for variable, value in pairs(cfg.autoconf) do
|
||||||
|
file:write('#define ' .. variable .. ' ' .. tostring(value) .. (_eol or '\n'))
|
||||||
|
end
|
||||||
|
file:close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
---
|
||||||
|
-- Utility method to add a table of headers.
|
||||||
|
---
|
||||||
|
function autoconf.include_headers(headers)
|
||||||
|
if headers ~= nil then
|
||||||
|
if type(headers) == "table" then
|
||||||
|
for _, v in ipairs(headers) do
|
||||||
|
p.outln('#include <' .. v .. '>')
|
||||||
|
end
|
||||||
|
else
|
||||||
|
p.outln('#include <' .. headers .. '>')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function autoconf.include_defines(defines)
|
||||||
|
if defines ~= nil then
|
||||||
|
if type(defines) == "table" then
|
||||||
|
for _, v in ipairs(defines) do
|
||||||
|
p.outln('#define ' .. v)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
p.outln('#define ' .. defines)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---
|
||||||
|
-- attach ourselfs to the running action.
|
||||||
|
---
|
||||||
|
p.override(p.action, 'call', function (base, name)
|
||||||
|
local a = p.action.get(name)
|
||||||
|
|
||||||
|
-- store the old callback.
|
||||||
|
local onBaseProject = a.onProject or a.onproject
|
||||||
|
|
||||||
|
-- override it with our own.
|
||||||
|
a.onProject = function(prj)
|
||||||
|
-- go through each configuration, and call the setup configuration methods.
|
||||||
|
for cfg in p.project.eachconfig(prj) do
|
||||||
|
cfg.autoconf = {}
|
||||||
|
if cfg.autoconfigure then
|
||||||
|
verbosef('Running auto config steps for "%s/%s".', prj.name, cfg.name)
|
||||||
|
for file, func in pairs(cfg.autoconfigure) do
|
||||||
|
func(cfg)
|
||||||
|
|
||||||
|
if not (file ~= "dontWrite") then
|
||||||
|
os.mkdir(cfg.objdir)
|
||||||
|
local filename = path.join(cfg.objdir, file)
|
||||||
|
autoconf.writefile(cfg, filename)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- then call the old onProject.
|
||||||
|
if onBaseProject then
|
||||||
|
onBaseProject(prj)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- now call the original action.call methods
|
||||||
|
base(name)
|
||||||
|
end)
|
18
autoconf/autoconf.lua
Normal file
18
autoconf/autoconf.lua
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
-- Autoconfiguration.
|
||||||
|
-- Copyright (c) 2016 Blizzard Entertainment
|
||||||
|
---
|
||||||
|
local p = premake
|
||||||
|
|
||||||
|
if not premake.modules.autoconf then
|
||||||
|
p.modules.autoconf = {}
|
||||||
|
p.modules.autoconf._VERSION = p._VERSION
|
||||||
|
|
||||||
|
verbosef('Loading autoconf module...')
|
||||||
|
include('api.lua')
|
||||||
|
include('msc.lua')
|
||||||
|
include('clang.lua')
|
||||||
|
include('gcc.lua')
|
||||||
|
end
|
||||||
|
|
||||||
|
return p.modules.autoconf
|
27
autoconf/clang.lua
Normal file
27
autoconf/clang.lua
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
-- Autoconfiguration.
|
||||||
|
-- Copyright (c) 2016 Blizzard Entertainment
|
||||||
|
---
|
||||||
|
local p = premake
|
||||||
|
local clang = p.tools.clang
|
||||||
|
|
||||||
|
function clang.try_compile(cfg, text, parameters)
|
||||||
|
-- write the text to a temporary file.
|
||||||
|
local cppFile = path.join(cfg.objdir, "temp.cpp")
|
||||||
|
if not io.writefile(cppFile, text) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if parameters == nil then
|
||||||
|
parameters = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local outFile = path.join(cfg.objdir, "temp.out")
|
||||||
|
|
||||||
|
-- compile that text file.
|
||||||
|
if os.execute('clang "' .. cppFile .. '" ' .. parameters .. ' -o "' .. outFile ..'" &> /dev/null') then
|
||||||
|
return outFile
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
27
autoconf/gcc.lua
Normal file
27
autoconf/gcc.lua
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
---
|
||||||
|
-- Autoconfiguration.
|
||||||
|
-- Copyright (c) 2016 Blizzard Entertainment
|
||||||
|
---
|
||||||
|
local p = premake
|
||||||
|
local gcc = p.tools.gcc
|
||||||
|
|
||||||
|
function gcc.try_compile(cfg, text, parameters)
|
||||||
|
-- write the text to a temporary file.
|
||||||
|
local cppFile = path.join(cfg.objdir, "temp.cpp")
|
||||||
|
if not io.writefile(cppFile, text) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if parameters == nil then
|
||||||
|
parameters = ""
|
||||||
|
end
|
||||||
|
|
||||||
|
local outFile = path.join(cfg.objdir, "temp.out")
|
||||||
|
|
||||||
|
-- compile that text file.
|
||||||
|
if os.execute('gcc "' .. cppFile .. '" ' .. parameters .. ' -o "' .. outFile ..'" &> /dev/null') then
|
||||||
|
return outFile
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
end
|
62
autoconf/msc.lua
Normal file
62
autoconf/msc.lua
Normal file
|
@ -0,0 +1,62 @@
|
||||||
|
---
|
||||||
|
-- Autoconfiguration.
|
||||||
|
-- Copyright (c) 2016 Blizzard Entertainment
|
||||||
|
---
|
||||||
|
local p = premake
|
||||||
|
local msc = p.tools.msc
|
||||||
|
|
||||||
|
-- "parameters" is unused, matter of fact this file is unused - re3
|
||||||
|
function msc.try_compile(cfg, text, parameters)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
--[[
|
||||||
|
-- write the text to a temporary file.
|
||||||
|
local cppFile = path.join(cfg.objdir, "temp.cpp")
|
||||||
|
if not io.writefile(cppFile, text) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
-- write out a batch file.
|
||||||
|
local batch = p.capture(function ()
|
||||||
|
p.outln('@echo off')
|
||||||
|
p.outln('SET mypath=%~dp0')
|
||||||
|
p.outln('pushd %mypath%')
|
||||||
|
|
||||||
|
local map = {
|
||||||
|
vs2010 = 'VS100COMNTOOLS',
|
||||||
|
vs2012 = 'VS110COMNTOOLS',
|
||||||
|
vs2013 = 'VS120COMNTOOLS',
|
||||||
|
vs2015 = 'VS140COMNTOOLS',
|
||||||
|
vs2017 = 'VS141COMNTOOLS',
|
||||||
|
vs2019 = 'VS142COMNTOOLS',
|
||||||
|
}
|
||||||
|
|
||||||
|
local a = map[_ACTION]
|
||||||
|
if a then
|
||||||
|
a = path.translate(os.getenv(a), '/')
|
||||||
|
a = path.join(a, '../../VC/vcvarsall.bat')
|
||||||
|
|
||||||
|
if cfg.platform == 'x86' then
|
||||||
|
p.outln('call "' .. a .. '" > NUL')
|
||||||
|
else
|
||||||
|
p.outln('call "' .. a .. '" amd64 > NUL')
|
||||||
|
end
|
||||||
|
|
||||||
|
p.outln('cl.exe /nologo temp.cpp > NUL')
|
||||||
|
else
|
||||||
|
error('Unsupported Visual Studio version: ' .. _ACTION)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local batchFile = path.join(cfg.objdir, "compile.bat")
|
||||||
|
if not io.writefile(batchFile, batch) then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
if os.execute(batchFile) then
|
||||||
|
return path.join(cfg.objdir, "temp.exe")
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
--]]
|
||||||
|
end
|
19
premake5.lua
19
premake5.lua
|
@ -42,6 +42,8 @@ newoption {
|
||||||
description = "Don't print full paths into binary"
|
description = "Don't print full paths into binary"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require("autoconf")
|
||||||
|
|
||||||
if(_OPTIONS["with-librw"]) then
|
if(_OPTIONS["with-librw"]) then
|
||||||
Librw = "vendor/librw"
|
Librw = "vendor/librw"
|
||||||
else
|
else
|
||||||
|
@ -376,6 +378,19 @@ project "reLCS"
|
||||||
filter "platforms:win*glfw*"
|
filter "platforms:win*glfw*"
|
||||||
staticruntime "off"
|
staticruntime "off"
|
||||||
|
|
||||||
|
filter "platforms:*glfw*"
|
||||||
|
premake.modules.autoconf.parameters = "-lglfw -lX11"
|
||||||
|
autoconfigure {
|
||||||
|
-- iterates all configs and runs on them
|
||||||
|
["dontWrite"] = function (cfg)
|
||||||
|
check_symbol_exists(cfg, "haveX11", "glfwGetX11Display", { "X11/Xlib.h", "X11/XKBlib.h", "GLFW/glfw3.h", "GLFW/glfw3native.h" }, "GLFW_EXPOSE_NATIVE_X11")
|
||||||
|
if cfg.autoconf["haveX11"] then
|
||||||
|
table.insert(cfg.links, "X11")
|
||||||
|
table.insert(cfg.defines, "GET_KEYBOARD_INPUT_FROM_X11")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
filter "platforms:win*oal"
|
filter "platforms:win*oal"
|
||||||
includedirs { "vendor/openal-soft/include" }
|
includedirs { "vendor/openal-soft/include" }
|
||||||
includedirs { "vendor/libsndfile/include" }
|
includedirs { "vendor/libsndfile/include" }
|
||||||
|
@ -392,10 +407,10 @@ project "reLCS"
|
||||||
libdirs { "vendor/openal-soft/libs/Win64" }
|
libdirs { "vendor/openal-soft/libs/Win64" }
|
||||||
|
|
||||||
filter "platforms:linux*oal"
|
filter "platforms:linux*oal"
|
||||||
links { "openal", "mpg123", "sndfile", "pthread", "X11" }
|
links { "openal", "mpg123", "sndfile", "pthread" }
|
||||||
|
|
||||||
filter "platforms:bsd*oal"
|
filter "platforms:bsd*oal"
|
||||||
links { "openal", "mpg123", "sndfile", "pthread", "X11" }
|
links { "openal", "mpg123", "sndfile", "pthread" }
|
||||||
|
|
||||||
filter "platforms:macosx*oal"
|
filter "platforms:macosx*oal"
|
||||||
links { "openal", "mpg123", "sndfile", "pthread" }
|
links { "openal", "mpg123", "sndfile", "pthread" }
|
||||||
|
|
|
@ -132,6 +132,22 @@ else()
|
||||||
set(${PROJECT}_C_CXX_EXTENSIONS OFF)
|
set(${PROJECT}_C_CXX_EXTENSIONS OFF)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(LIBRW_PLATFORM_GL3 AND LIBRW_GL3_GFXLIB STREQUAL "GLFW")
|
||||||
|
include(CheckSymbolExists)
|
||||||
|
|
||||||
|
set(CMAKE_REQUIRED_LIBRARIES glfw)
|
||||||
|
set(CMAKE_REQUIRED_DEFINITIONS -DGLFW_EXPOSE_NATIVE_X11)
|
||||||
|
check_symbol_exists(glfwGetX11Display "GLFW/glfw3.h;GLFW/glfw3native.h" GLFW_HAS_X11)
|
||||||
|
unset(CMAKE_REQUIRED_DEFINITIONS)
|
||||||
|
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
|
||||||
|
if (GLFW_HAS_X11)
|
||||||
|
find_package(X11 REQUIRED)
|
||||||
|
target_link_libraries(${EXECUTABLE} PRIVATE X11::X11)
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE GET_KEYBOARD_INPUT_FROM_X11)
|
||||||
|
endif (GLFW_HAS_X11)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(${EXECUTABLE}
|
set_target_properties(${EXECUTABLE}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
C_STANDARD 11
|
C_STANDARD 11
|
||||||
|
|
|
@ -205,7 +205,7 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
||||||
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
|
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
|
||||||
m_sQueueSample.m_nVolume =
|
m_sQueueSample.m_nVolume =
|
||||||
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
||||||
if(m_sQueueSample.m_nVolume) {
|
if(m_sQueueSample.m_nVolume > 0) {
|
||||||
m_sQueueSample.m_nSampleIndex = gOneShotCol[s1];
|
m_sQueueSample.m_nSampleIndex = gOneShotCol[s1];
|
||||||
switch(m_sQueueSample.m_nSampleIndex) {
|
switch(m_sQueueSample.m_nSampleIndex) {
|
||||||
case SFX_COL_TARMAC_1:
|
case SFX_COL_TARMAC_1:
|
||||||
|
@ -270,8 +270,8 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
||||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||||
m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity;
|
m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity;
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
|
m_sQueueSample.m_bReleasingSoundFlag = TRUE;
|
||||||
m_sQueueSample.m_bReverbFlag = TRUE;
|
SET_SOUND_REVERB(TRUE);
|
||||||
m_sQueueSample.m_bRequireReflection = FALSE;
|
SET_SOUND_REFLECTION(FALSE);
|
||||||
AddSampleToRequestedQueue();
|
AddSampleToRequestedQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -287,7 +287,7 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
|
||||||
if(emittingVol) {
|
if(emittingVol) {
|
||||||
CalculateDistance(distCalculated, m_sQueueSample.m_fDistance);
|
CalculateDistance(distCalculated, m_sQueueSample.m_fDistance);
|
||||||
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
m_sQueueSample.m_nVolume = ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
||||||
if(m_sQueueSample.m_nVolume) {
|
if(m_sQueueSample.m_nVolume > 0) {
|
||||||
m_sQueueSample.m_nCounter = counter;
|
m_sQueueSample.m_nCounter = counter;
|
||||||
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
|
@ -300,8 +300,8 @@ cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 coun
|
||||||
m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity;
|
m_sQueueSample.m_SoundIntensity = CollisionSoundIntensity;
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
|
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
|
||||||
m_sQueueSample.m_nReleasingVolumeDivider = 5;
|
m_sQueueSample.m_nReleasingVolumeDivider = 5;
|
||||||
m_sQueueSample.m_bReverbFlag = TRUE;
|
SET_SOUND_REVERB(TRUE);
|
||||||
m_sQueueSample.m_bRequireReflection = FALSE;
|
SET_SOUND_REFLECTION(FALSE);
|
||||||
AddSampleToRequestedQueue();
|
AddSampleToRequestedQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -32,7 +32,9 @@ cAudioManager::cAudioManager()
|
||||||
ClearActiveSamples();
|
ClearActiveSamples();
|
||||||
GenerateIntegerRandomNumberTable();
|
GenerateIntegerRandomNumberTable();
|
||||||
m_bDoubleVolume = FALSE;
|
m_bDoubleVolume = FALSE;
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
m_bDynamicAcousticModelingStatus = TRUE;
|
m_bDynamicAcousticModelingStatus = TRUE;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
|
for (int i = 0; i < NUM_AUDIOENTITIES; i++) {
|
||||||
m_asAudioEntities[i].m_bIsUsed = FALSE;
|
m_asAudioEntities[i].m_bIsUsed = FALSE;
|
||||||
|
@ -116,7 +118,9 @@ cAudioManager::Service()
|
||||||
if (m_bIsInitialised) {
|
if (m_bIsInitialised) {
|
||||||
m_nPreviousUserPause = m_nUserPause;
|
m_nPreviousUserPause = m_nUserPause;
|
||||||
m_nUserPause = CTimer::GetIsUserPaused();
|
m_nUserPause = CTimer::GetIsUserPaused();
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
UpdateReflections();
|
UpdateReflections();
|
||||||
|
#endif
|
||||||
ServiceSoundEffects();
|
ServiceSoundEffects();
|
||||||
MusicManager.Service();
|
MusicManager.Service();
|
||||||
}
|
}
|
||||||
|
@ -453,11 +457,13 @@ cAudioManager::ReacquireDigitalHandle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
void
|
void
|
||||||
cAudioManager::SetDynamicAcousticModelingStatus(bool8 status)
|
cAudioManager::SetDynamicAcousticModelingStatus(bool8 status)
|
||||||
{
|
{
|
||||||
m_bDynamicAcousticModelingStatus = status;
|
m_bDynamicAcousticModelingStatus = status;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool8
|
bool8
|
||||||
cAudioManager::CheckForAnAudioFileOnCD()
|
cAudioManager::CheckForAnAudioFileOnCD()
|
||||||
|
@ -513,7 +519,9 @@ cAudioManager::ServiceSoundEffects()
|
||||||
ClearActiveSamples();
|
ClearActiveSamples();
|
||||||
}
|
}
|
||||||
m_nActiveSampleQueue = m_nActiveSampleQueue == 1 ? 0 : 1;
|
m_nActiveSampleQueue = m_nActiveSampleQueue == 1 ? 0 : 1;
|
||||||
|
#ifdef AUDIO_REVERB
|
||||||
if(m_bReverb) ProcessReverb();
|
if(m_bReverb) ProcessReverb();
|
||||||
|
#endif
|
||||||
ProcessSpecial();
|
ProcessSpecial();
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
InterrogateAudioEntities();
|
InterrogateAudioEntities();
|
||||||
|
@ -638,9 +646,11 @@ cAudioManager::InterrogateAudioEntities()
|
||||||
void
|
void
|
||||||
cAudioManager::AddSampleToRequestedQueue()
|
cAudioManager::AddSampleToRequestedQueue()
|
||||||
{
|
{
|
||||||
int32 calculatedVolume;
|
uint32 calculatedVolume;
|
||||||
uint8 sampleIndex;
|
uint8 sampleIndex;
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
bool8 bReflections;
|
bool8 bReflections;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
|
if (m_sQueueSample.m_nSampleIndex < TOTAL_AUDIO_SAMPLES) {
|
||||||
calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume);
|
calculatedVolume = m_sQueueSample.m_nReleasingVolumeModificator * (MAX_VOLUME - m_sQueueSample.m_nVolume);
|
||||||
|
@ -654,11 +664,12 @@ cAudioManager::AddSampleToRequestedQueue()
|
||||||
}
|
}
|
||||||
m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
|
m_sQueueSample.m_nCalculatedVolume = calculatedVolume;
|
||||||
m_sQueueSample.m_bLoopEnded = FALSE;
|
m_sQueueSample.m_bLoopEnded = FALSE;
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
if (m_sQueueSample.m_bIs2D || CCullZones::InRoomForAudio()) {
|
if (m_sQueueSample.m_bIs2D || CCullZones::InRoomForAudio()) {
|
||||||
m_sQueueSample.m_bRequireReflection = FALSE;
|
m_sQueueSample.m_bRequireReflection = FALSE;
|
||||||
m_sQueueSample.m_nLoopsRemaining = 0;
|
m_sQueueSample.m_nLoopsRemaining = 0;
|
||||||
}
|
}
|
||||||
if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount) {
|
if (m_bDynamicAcousticModelingStatus && m_sQueueSample.m_nLoopCount > 0) {
|
||||||
bReflections = m_sQueueSample.m_bRequireReflection;
|
bReflections = m_sQueueSample.m_bRequireReflection;
|
||||||
} else {
|
} else {
|
||||||
bReflections = FALSE;
|
bReflections = FALSE;
|
||||||
|
@ -667,16 +678,20 @@ cAudioManager::AddSampleToRequestedQueue()
|
||||||
m_sQueueSample.m_bRequireReflection = FALSE;
|
m_sQueueSample.m_bRequireReflection = FALSE;
|
||||||
|
|
||||||
if ( m_bReverb && m_sQueueSample.m_bIs2D )
|
if ( m_bReverb && m_sQueueSample.m_bIs2D )
|
||||||
m_sQueueSample.field_4C = 30;
|
m_sQueueSample.m_nFrontRearOffset = 30;
|
||||||
|
#ifdef AUDIO_REVERB
|
||||||
if (!m_bDynamicAcousticModelingStatus)
|
if (!m_bDynamicAcousticModelingStatus)
|
||||||
m_sQueueSample.m_bReverbFlag = FALSE;
|
m_sQueueSample.m_bReverbFlag = FALSE;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
|
m_asSamples[m_nActiveSampleQueue][sampleIndex] = m_sQueueSample;
|
||||||
|
|
||||||
AddDetailsToRequestedOrderList(sampleIndex);
|
AddDetailsToRequestedOrderList(sampleIndex);
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
if (bReflections)
|
if (bReflections)
|
||||||
AddReflectionsToRequestedQueue();
|
AddReflectionsToRequestedQueue();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -684,7 +699,7 @@ void
|
||||||
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
|
cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
|
||||||
{
|
{
|
||||||
uint32 i = 0;
|
uint32 i = 0;
|
||||||
if (sample != 0) {
|
if (sample > 0) {
|
||||||
for (; i < sample; i++) {
|
for (; i < sample; i++) {
|
||||||
if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nCalculatedVolume >
|
if (m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]].m_nCalculatedVolume >
|
||||||
m_asSamples[m_nActiveSampleQueue][sample].m_nCalculatedVolume)
|
m_asSamples[m_nActiveSampleQueue][sample].m_nCalculatedVolume)
|
||||||
|
@ -697,6 +712,7 @@ cAudioManager::AddDetailsToRequestedOrderList(uint8 sample)
|
||||||
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
|
m_abSampleQueueIndexTable[m_nActiveSampleQueue][i] = sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
void
|
void
|
||||||
cAudioManager::AddReflectionsToRequestedQueue()
|
cAudioManager::AddReflectionsToRequestedQueue()
|
||||||
{
|
{
|
||||||
|
@ -720,7 +736,7 @@ cAudioManager::AddReflectionsToRequestedQueue()
|
||||||
}
|
}
|
||||||
m_sQueueSample.m_SoundIntensity /= 2.f;
|
m_sQueueSample.m_SoundIntensity /= 2.f;
|
||||||
|
|
||||||
int halfOldFreq = oldFreq >> 1;
|
uint32 halfOldFreq = oldFreq >> 1;
|
||||||
|
|
||||||
for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
|
for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) {
|
||||||
if ( CTimer::GetIsSlowMotionActive() )
|
if ( CTimer::GetIsSlowMotionActive() )
|
||||||
|
@ -736,15 +752,15 @@ cAudioManager::AddReflectionsToRequestedQueue()
|
||||||
|
|
||||||
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
|
if (m_sQueueSample.m_nVolume > emittingVolume / 16) {
|
||||||
m_sQueueSample.m_nCounter = oldCounter + (i + 1) * 256;
|
m_sQueueSample.m_nCounter = oldCounter + (i + 1) * 256;
|
||||||
if (m_sQueueSample.m_nLoopCount) {
|
if (m_sQueueSample.m_nLoopCount > 0) {
|
||||||
if ( CTimer::GetIsSlowMotionActive() ) {
|
if ( CTimer::GetIsSlowMotionActive() ) {
|
||||||
m_sQueueSample.m_nFrequency = halfOldFreq + ((halfOldFreq * i) / ARRAY_SIZE(m_afReflectionsDistances));
|
m_sQueueSample.m_nFrequency = halfOldFreq + ((halfOldFreq * i) / ARRAY_SIZE(m_afReflectionsDistances));
|
||||||
} else {
|
} else {
|
||||||
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
|
noise = RandomDisplacement(m_sQueueSample.m_nFrequency / 32);
|
||||||
if (noise <= 0)
|
if (noise > 0)
|
||||||
m_sQueueSample.m_nFrequency += noise;
|
|
||||||
else
|
|
||||||
m_sQueueSample.m_nFrequency -= noise;
|
m_sQueueSample.m_nFrequency -= noise;
|
||||||
|
else
|
||||||
|
m_sQueueSample.m_nFrequency += noise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator += 20;
|
m_sQueueSample.m_nReleasingVolumeModificator += 20;
|
||||||
|
@ -879,6 +895,7 @@ cAudioManager::UpdateReflections()
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif // AUDIO_REFLECTIONS
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::AddReleasingSounds()
|
cAudioManager::AddReleasingSounds()
|
||||||
|
@ -906,7 +923,10 @@ cAudioManager::AddReleasingSounds()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!toProcess[i]) {
|
if(!toProcess[i]) {
|
||||||
if (sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) {
|
#ifdef AUDIO_REFLECTIONS
|
||||||
|
if(sample.m_nCounter <= 255 || sample.m_nLoopsRemaining == 0) // check if not reflection
|
||||||
|
#endif
|
||||||
|
{
|
||||||
if (sample.m_nReleasingVolumeDivider == 0)
|
if (sample.m_nReleasingVolumeDivider == 0)
|
||||||
continue;
|
continue;
|
||||||
if (sample.m_nLoopCount == 0) {
|
if (sample.m_nLoopCount == 0) {
|
||||||
|
@ -1054,7 +1074,9 @@ cAudioManager::ProcessActiveQueues()
|
||||||
SampleManager.SetChannelPan(j, sample.m_nOffset);
|
SampleManager.SetChannelPan(j, sample.m_nOffset);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#if !defined(GTA_PS2) || defined(AUDIO_REVERB)
|
||||||
SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
|
SampleManager.SetChannelReverbFlag(j, sample.m_bReverbFlag);
|
||||||
|
#endif
|
||||||
break; //continue for i
|
break; //continue for i
|
||||||
}
|
}
|
||||||
sample.m_bIsProcessed = FALSE;
|
sample.m_bIsProcessed = FALSE;
|
||||||
|
@ -1074,14 +1096,17 @@ cAudioManager::ProcessActiveQueues()
|
||||||
for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
|
for (uint8 i = 0; i < m_SampleRequestQueuesStatus[m_nActiveSampleQueue]; i++) {
|
||||||
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
tSound &sample = m_asSamples[m_nActiveSampleQueue][m_abSampleQueueIndexTable[m_nActiveSampleQueue][i]];
|
||||||
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
|
if (!sample.m_bIsProcessed && !sample.m_bLoopEnded && m_asAudioEntities[sample.m_nEntityIndex].m_bIsUsed && sample.m_nSampleIndex < NO_SAMPLE) {
|
||||||
if (sample.m_nCounter > 255 && sample.m_nLoopCount != 0 && sample.m_nLoopsRemaining != 0) {
|
#ifdef AUDIO_REFLECTIONS
|
||||||
|
if (sample.m_nCounter > 255 && sample.m_nLoopCount > 0 && sample.m_nLoopsRemaining > 0) { // check if reflection
|
||||||
sample.m_nLoopsRemaining--;
|
sample.m_nLoopsRemaining--;
|
||||||
sample.m_nReleasingVolumeDivider = 1;
|
sample.m_nReleasingVolumeDivider = 1;
|
||||||
} else {
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
for (uint8 j = 0; j < m_nActiveSamples; j++) {
|
for (uint8 j = 0; j < m_nActiveSamples; j++) {
|
||||||
uint8 k = (j + field_6) % m_nActiveSamples;
|
uint8 k = (j + field_6) % m_nActiveSamples;
|
||||||
if (!m_asActiveSamples[k].m_bIsProcessed) {
|
if (!m_asActiveSamples[k].m_bIsProcessed) {
|
||||||
if (sample.m_nLoopCount != 0) {
|
if (sample.m_nLoopCount > 0) {
|
||||||
samplesPerFrame = sample.m_nFrequency / m_nTimeSpent;
|
samplesPerFrame = sample.m_nFrequency / m_nTimeSpent;
|
||||||
samplesToPlay = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
|
samplesToPlay = sample.m_nLoopCount * SampleManager.GetSampleLength(sample.m_nSampleIndex);
|
||||||
if (samplesPerFrame == 0)
|
if (samplesPerFrame == 0)
|
||||||
|
@ -1100,7 +1125,12 @@ cAudioManager::ProcessActiveQueues()
|
||||||
#else
|
#else
|
||||||
emittingVol = m_bDoubleVolume ? 2 * Min(63, m_asActiveSamples[j].m_nVolume) : m_asActiveSamples[j].m_nVolume;
|
emittingVol = m_bDoubleVolume ? 2 * Min(63, m_asActiveSamples[j].m_nVolume) : m_asActiveSamples[j].m_nVolume;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef GTA_PS2
|
||||||
|
{
|
||||||
|
SampleManager.InitialiseChannel(k, m_asActiveSamples[k].m_nSampleIndex, m_asActiveSamples[k].m_nBankIndex);
|
||||||
|
#else
|
||||||
if (SampleManager.InitialiseChannel(k, m_asActiveSamples[k].m_nSampleIndex, m_asActiveSamples[k].m_nBankIndex)) {
|
if (SampleManager.InitialiseChannel(k, m_asActiveSamples[k].m_nSampleIndex, m_asActiveSamples[k].m_nBankIndex)) {
|
||||||
|
#endif
|
||||||
SampleManager.SetChannelFrequency(k, m_asActiveSamples[k].m_nFrequency);
|
SampleManager.SetChannelFrequency(k, m_asActiveSamples[k].m_nFrequency);
|
||||||
bool8 isMobile = FALSE;
|
bool8 isMobile = FALSE;
|
||||||
for (int32 l = 0; l < MISSION_AUDIO_SLOTS; l++) {
|
for (int32 l = 0; l < MISSION_AUDIO_SLOTS; l++) {
|
||||||
|
@ -1122,9 +1152,13 @@ cAudioManager::ProcessActiveQueues()
|
||||||
SampleManager.SetChannelVolume(j, emittingVol);
|
SampleManager.SetChannelVolume(j, emittingVol);
|
||||||
SampleManager.SetChannelPan(j, m_asActiveSamples[j].m_nOffset);
|
SampleManager.SetChannelPan(j, m_asActiveSamples[j].m_nOffset);
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef GTA_PS2
|
||||||
SampleManager.SetChannelLoopPoints(k, m_asActiveSamples[k].m_nLoopStart, m_asActiveSamples[k].m_nLoopEnd);
|
SampleManager.SetChannelLoopPoints(k, m_asActiveSamples[k].m_nLoopStart, m_asActiveSamples[k].m_nLoopEnd);
|
||||||
SampleManager.SetChannelLoopCount(k, m_asActiveSamples[k].m_nLoopCount);
|
SampleManager.SetChannelLoopCount(k, m_asActiveSamples[k].m_nLoopCount);
|
||||||
|
#endif
|
||||||
|
#if !defined(GTA_PS2) || defined(AUDIO_REVERB)
|
||||||
SampleManager.SetChannelReverbFlag(k, m_asActiveSamples[k].m_bReverbFlag);
|
SampleManager.SetChannelReverbFlag(k, m_asActiveSamples[k].m_bReverbFlag);
|
||||||
|
#endif
|
||||||
#ifdef EXTERNAL_3D_SOUND
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
if (m_asActiveSamples[k].m_bIs2D) {
|
if (m_asActiveSamples[k].m_bIs2D) {
|
||||||
uint8 offset = m_asActiveSamples[k].m_nOffset;
|
uint8 offset = m_asActiveSamples[k].m_nOffset;
|
||||||
|
@ -1200,9 +1234,13 @@ cAudioManager::ClearActiveSamples()
|
||||||
m_asActiveSamples[i].m_nReleasingVolumeDivider = 0;
|
m_asActiveSamples[i].m_nReleasingVolumeDivider = 0;
|
||||||
m_asActiveSamples[i].m_nVolumeChange = -1;
|
m_asActiveSamples[i].m_nVolumeChange = -1;
|
||||||
m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f);
|
m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
#ifdef AUDIO_REVERB
|
||||||
m_asActiveSamples[i].m_bReverbFlag = FALSE;
|
m_asActiveSamples[i].m_bReverbFlag = FALSE;
|
||||||
|
#endif // AUDIO_REVERB
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
m_asActiveSamples[i].m_nLoopsRemaining = 0;
|
m_asActiveSamples[i].m_nLoopsRemaining = 0;
|
||||||
m_asActiveSamples[i].m_bRequireReflection = FALSE;
|
m_asActiveSamples[i].m_bRequireReflection = FALSE;
|
||||||
|
#endif // AUDIO_REFLECTIONS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,17 +10,17 @@ class tSound
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int32 m_nEntityIndex;
|
int32 m_nEntityIndex;
|
||||||
int32 m_nCounter;
|
uint32 m_nCounter;
|
||||||
int32 m_nSampleIndex;
|
uint32 m_nSampleIndex;
|
||||||
uint8 m_nBankIndex;
|
uint8 m_nBankIndex;
|
||||||
bool8 m_bIs2D;
|
bool8 m_bIs2D;
|
||||||
int32 m_nReleasingVolumeModificator;
|
uint32 m_nReleasingVolumeModificator;
|
||||||
uint32 m_nFrequency;
|
uint32 m_nFrequency;
|
||||||
uint8 m_nVolume;
|
uint8 m_nVolume;
|
||||||
float m_fDistance;
|
float m_fDistance;
|
||||||
int32 m_nLoopCount;
|
uint32 m_nLoopCount;
|
||||||
#ifndef GTA_PS2
|
#ifndef GTA_PS2
|
||||||
int32 m_nLoopStart;
|
uint32 m_nLoopStart;
|
||||||
int32 m_nLoopEnd;
|
int32 m_nLoopEnd;
|
||||||
#endif
|
#endif
|
||||||
#ifdef EXTERNAL_3D_SOUND
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
|
@ -30,17 +30,19 @@ public:
|
||||||
float m_SoundIntensity;
|
float m_SoundIntensity;
|
||||||
bool8 m_bReleasingSoundFlag;
|
bool8 m_bReleasingSoundFlag;
|
||||||
CVector m_vecPos;
|
CVector m_vecPos;
|
||||||
#ifndef GTA_PS2
|
#if !defined(GTA_PS2) || defined(AUDIO_REVERB) // GTA_PS2 because this field exists on mobile but not on PS2
|
||||||
bool8 m_bReverbFlag; // TODO: ifdef all the occurrences
|
bool8 m_bReverbFlag;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
uint8 m_nLoopsRemaining;
|
uint8 m_nLoopsRemaining;
|
||||||
bool8 m_bRequireReflection; // Used for oneshots
|
bool8 m_bRequireReflection; // Used for oneshots
|
||||||
|
#endif
|
||||||
uint8 m_nOffset;
|
uint8 m_nOffset;
|
||||||
uint8 field_4C;
|
uint8 m_nFrontRearOffset;
|
||||||
int32 m_nReleasingVolumeDivider;
|
uint32 m_nReleasingVolumeDivider;
|
||||||
bool8 m_bIsProcessed;
|
bool8 m_bIsProcessed;
|
||||||
bool8 m_bLoopEnded;
|
bool8 m_bLoopEnded;
|
||||||
int32 m_nCalculatedVolume;
|
uint32 m_nCalculatedVolume;
|
||||||
int8 m_nVolumeChange;
|
int8 m_nVolumeChange;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,7 +122,7 @@ class cMissionAudio
|
||||||
public:
|
public:
|
||||||
CVector m_vecPos[MISSION_AUDIO_SLOTS];
|
CVector m_vecPos[MISSION_AUDIO_SLOTS];
|
||||||
bool8 m_bPredefinedProperties[MISSION_AUDIO_SLOTS];
|
bool8 m_bPredefinedProperties[MISSION_AUDIO_SLOTS];
|
||||||
int32 m_nSampleIndex[MISSION_AUDIO_SLOTS];
|
uint32 m_nSampleIndex[MISSION_AUDIO_SLOTS];
|
||||||
uint8 m_nLoadingStatus[MISSION_AUDIO_SLOTS];
|
uint8 m_nLoadingStatus[MISSION_AUDIO_SLOTS];
|
||||||
uint8 m_nPlayStatus[MISSION_AUDIO_SLOTS];
|
uint8 m_nPlayStatus[MISSION_AUDIO_SLOTS];
|
||||||
bool8 m_bIsPlaying[MISSION_AUDIO_SLOTS];
|
bool8 m_bIsPlaying[MISSION_AUDIO_SLOTS];
|
||||||
|
@ -170,7 +172,7 @@ public:
|
||||||
float m_fDistance;
|
float m_fDistance;
|
||||||
CVehicle *m_pVehicle;
|
CVehicle *m_pVehicle;
|
||||||
cTransmission *m_pTransmission;
|
cTransmission *m_pTransmission;
|
||||||
int32 m_nIndex;
|
uint32 m_nIndex;
|
||||||
float m_fVelocityChange;
|
float m_fVelocityChange;
|
||||||
|
|
||||||
cVehicleParams()
|
cVehicleParams()
|
||||||
|
@ -225,10 +227,10 @@ class cAudioManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool8 m_bIsInitialised;
|
bool8 m_bIsInitialised;
|
||||||
uint8 m_bReverb; // unused
|
bool8 m_bReverb; // unused
|
||||||
bool8 m_bFifthFrameFlag;
|
bool8 m_bFifthFrameFlag;
|
||||||
uint8 m_nActiveSamples;
|
uint8 m_nActiveSamples;
|
||||||
uint8 m_bDoubleVolume; // unused
|
bool8 m_bDoubleVolume; // unused
|
||||||
bool8 m_bDynamicAcousticModelingStatus;
|
bool8 m_bDynamicAcousticModelingStatus;
|
||||||
int8 field_6;
|
int8 field_6;
|
||||||
float m_fSpeedOfSound;
|
float m_fSpeedOfSound;
|
||||||
|
@ -243,8 +245,10 @@ public:
|
||||||
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
|
tAudioEntity m_asAudioEntities[NUM_AUDIOENTITIES];
|
||||||
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
|
int32 m_anAudioEntityIndices[NUM_AUDIOENTITIES];
|
||||||
int32 m_nAudioEntitiesTotal;
|
int32 m_nAudioEntitiesTotal;
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
CVector m_avecReflectionsPos[MAX_REFLECTIONS];
|
CVector m_avecReflectionsPos[MAX_REFLECTIONS];
|
||||||
float m_afReflectionsDistances[MAX_REFLECTIONS];
|
float m_afReflectionsDistances[MAX_REFLECTIONS];
|
||||||
|
#endif
|
||||||
cAudioScriptObjectManager m_sAudioScriptObjectManager;
|
cAudioScriptObjectManager m_sAudioScriptObjectManager;
|
||||||
|
|
||||||
// miami
|
// miami
|
||||||
|
@ -272,8 +276,8 @@ public:
|
||||||
uint8 field_5538; // something related to phone dialogues
|
uint8 field_5538; // something related to phone dialogues
|
||||||
int32 m_anRandomTable[5];
|
int32 m_anRandomTable[5];
|
||||||
uint8 m_nTimeSpent;
|
uint8 m_nTimeSpent;
|
||||||
uint8 m_nUserPause;
|
bool8 m_nUserPause;
|
||||||
uint8 m_nPreviousUserPause;
|
bool8 m_nPreviousUserPause;
|
||||||
uint32 m_FrameCounter;
|
uint32 m_FrameCounter;
|
||||||
|
|
||||||
cAudioManager();
|
cAudioManager();
|
||||||
|
@ -307,7 +311,9 @@ public:
|
||||||
bool8 IsMP3RadioChannelAvailable();
|
bool8 IsMP3RadioChannelAvailable();
|
||||||
void ReleaseDigitalHandle();
|
void ReleaseDigitalHandle();
|
||||||
void ReacquireDigitalHandle();
|
void ReacquireDigitalHandle();
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
void SetDynamicAcousticModelingStatus(bool8 status);
|
void SetDynamicAcousticModelingStatus(bool8 status);
|
||||||
|
#endif
|
||||||
bool8 CheckForAnAudioFileOnCD();
|
bool8 CheckForAnAudioFileOnCD();
|
||||||
char GetCDAudioDriveLetter();
|
char GetCDAudioDriveLetter();
|
||||||
bool8 IsAudioInitialised();
|
bool8 IsAudioInitialised();
|
||||||
|
@ -323,8 +329,10 @@ public:
|
||||||
void InterrogateAudioEntities(); // inlined
|
void InterrogateAudioEntities(); // inlined
|
||||||
void AddSampleToRequestedQueue();
|
void AddSampleToRequestedQueue();
|
||||||
void AddDetailsToRequestedOrderList(uint8 sample); // inlined in vc
|
void AddDetailsToRequestedOrderList(uint8 sample); // inlined in vc
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
void AddReflectionsToRequestedQueue();
|
void AddReflectionsToRequestedQueue();
|
||||||
void UpdateReflections();
|
void UpdateReflections();
|
||||||
|
#endif
|
||||||
void AddReleasingSounds();
|
void AddReleasingSounds();
|
||||||
void ProcessActiveQueues();
|
void ProcessActiveQueues();
|
||||||
void ClearRequestedQueue(); // inlined in vc
|
void ClearRequestedQueue(); // inlined in vc
|
||||||
|
@ -614,6 +622,16 @@ public:
|
||||||
#else
|
#else
|
||||||
#define SET_EMITTING_VOLUME(vol)
|
#define SET_EMITTING_VOLUME(vol)
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
|
#define SET_SOUND_REFLECTION(b) m_sQueueSample.m_bRequireReflection = b
|
||||||
|
#else
|
||||||
|
#define SET_SOUND_REFLECTION(b)
|
||||||
|
#endif
|
||||||
|
#ifdef AUDIO_REVERB
|
||||||
|
#define SET_SOUND_REVERB(b) m_sQueueSample.m_bReverbFlag = b
|
||||||
|
#else
|
||||||
|
#define SET_SOUND_REVERB(b)
|
||||||
|
#endif
|
||||||
|
|
||||||
//#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
|
//#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
|
||||||
//static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
|
//static_assert(sizeof(cAudioManager) == 0x5558, "cAudioManager: error");
|
||||||
|
|
|
@ -169,7 +169,9 @@ cDMAudio::ReacquireDigitalHandle(void)
|
||||||
void
|
void
|
||||||
cDMAudio::SetDynamicAcousticModelingStatus(bool8 status)
|
cDMAudio::SetDynamicAcousticModelingStatus(bool8 status)
|
||||||
{
|
{
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
AudioManager.SetDynamicAcousticModelingStatus(status);
|
AudioManager.SetDynamicAcousticModelingStatus(status);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool8
|
bool8
|
||||||
|
|
|
@ -263,7 +263,7 @@ cMusicManager::GetRadioInCar(void)
|
||||||
CVehicle* veh = AudioManager.FindVehicleOfPlayer();
|
CVehicle* veh = AudioManager.FindVehicleOfPlayer();
|
||||||
if (veh != nil) {
|
if (veh != nil) {
|
||||||
if (UsesPoliceRadio(veh) || UsesTaxiRadio(veh)) {
|
if (UsesPoliceRadio(veh) || UsesTaxiRadio(veh)) {
|
||||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
|
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
|
||||||
return STREAMED_SOUND_RADIO_POLICE;
|
return STREAMED_SOUND_RADIO_POLICE;
|
||||||
return m_nRadioInCar;
|
return m_nRadioInCar;
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ cMusicManager::GetRadioInCar(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
|
if (m_nRadioInCar == NO_TRACK || (CReplay::IsPlayingBack() && !AudioManager.m_nUserPause))
|
||||||
return RADIO_OFF;
|
return RADIO_OFF;
|
||||||
return m_nRadioInCar;
|
return m_nRadioInCar;
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@ cMusicManager::ServiceFrontEndMode()
|
||||||
} else {
|
} else {
|
||||||
if (m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER)
|
if (m_nPlayingTrack == STREAMED_SOUND_RADIO_MP3_PLAYER)
|
||||||
SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0);
|
SampleManager.StartStreamedFile(STREAMED_SOUND_RADIO_MP3_PLAYER, 0);
|
||||||
else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && AudioManager.m_nUserPause == 0)
|
else if (m_nPlayingTrack == STREAMED_SOUND_MISSION_COMPLETED && !AudioManager.m_nUserPause)
|
||||||
ChangeMusicMode(MUSICMODE_GAME);
|
ChangeMusicMode(MUSICMODE_GAME);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -24,8 +24,8 @@ struct tPoliceRadioZone {
|
||||||
tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
|
tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
|
||||||
|
|
||||||
uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
|
uint32 g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
|
||||||
int8 g_nMissionAudioPlayingStatus = 2;
|
int8 g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
|
||||||
uint8 gSpecialSuspectLastSeenReport;
|
bool8 gSpecialSuspectLastSeenReport;
|
||||||
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
|
uint32 gMinTimeToNextReport[NUM_CRIME_TYPES];
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -64,8 +64,9 @@ cAudioManager::InitialisePoliceRadio()
|
||||||
m_sPoliceRadioQueue.policeChannelCounterSeconds = 0;
|
m_sPoliceRadioQueue.policeChannelCounterSeconds = 0;
|
||||||
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++)
|
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++)
|
||||||
m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
||||||
|
#if !defined(GTA_PS2) || defined(AUDIO_REVERB)
|
||||||
SampleManager.SetChannelReverbFlag(CHANNEL_POLICE_RADIO, FALSE);
|
SampleManager.SetChannelReverbFlag(CHANNEL_POLICE_RADIO, FALSE);
|
||||||
|
#endif
|
||||||
gSpecialSuspectLastSeenReport = FALSE;
|
gSpecialSuspectLastSeenReport = FALSE;
|
||||||
for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++)
|
for (int32 i = 0; i < ARRAY_SIZE(gMinTimeToNextReport); i++)
|
||||||
gMinTimeToNextReport[i] = m_FrameCounter;
|
gMinTimeToNextReport[i] = m_FrameCounter;
|
||||||
|
@ -83,8 +84,8 @@ void
|
||||||
cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx)
|
cAudioManager::SetMissionScriptPoliceAudio(uint32 sfx)
|
||||||
{
|
{
|
||||||
if (!m_bIsInitialised) return;
|
if (!m_bIsInitialised) return;
|
||||||
if (g_nMissionAudioPlayingStatus != 1) {
|
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) {
|
||||||
g_nMissionAudioPlayingStatus = 0;
|
g_nMissionAudioPlayingStatus = PLAY_STATUS_STOPPED;
|
||||||
g_nMissionAudioSfx = sfx;
|
g_nMissionAudioSfx = sfx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -110,10 +111,10 @@ cAudioManager::DoPoliceRadioCrackle()
|
||||||
SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
|
SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
|
||||||
SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE)
|
SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE)
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
|
m_sQueueSample.m_bReleasingSoundFlag = FALSE;
|
||||||
m_sQueueSample.m_bReverbFlag = FALSE;
|
SET_SOUND_REVERB(FALSE);
|
||||||
m_sQueueSample.m_nOffset = 63;
|
m_sQueueSample.m_nOffset = 63;
|
||||||
m_sQueueSample.m_nReleasingVolumeDivider = 3;
|
m_sQueueSample.m_nReleasingVolumeDivider = 3;
|
||||||
m_sQueueSample.m_bRequireReflection = FALSE;
|
SET_SOUND_REFLECTION(FALSE);
|
||||||
AddSampleToRequestedQueue();
|
AddSampleToRequestedQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +126,7 @@ cAudioManager::ServicePoliceRadio()
|
||||||
|
|
||||||
if(!m_bIsInitialised) return;
|
if(!m_bIsInitialised) return;
|
||||||
|
|
||||||
if(m_nUserPause == 0) {
|
if(!m_nUserPause) {
|
||||||
bool8 crimeReport = SetupCrimeReport();
|
bool8 crimeReport = SetupCrimeReport();
|
||||||
#ifdef FIX_BUGS // Crash at 0x5fe6ef
|
#ifdef FIX_BUGS // Crash at 0x5fe6ef
|
||||||
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
||||||
|
@ -162,20 +163,20 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||||
|
|
||||||
static int cWait = 0;
|
static int cWait = 0;
|
||||||
static bool8 bChannelOpen = FALSE;
|
static bool8 bChannelOpen = FALSE;
|
||||||
static uint8 bMissionAudioPhysicalPlayingStatus = 0;
|
static uint8 bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
|
||||||
static int32 PoliceChannelFreq = 22050;
|
static int32 PoliceChannelFreq = 22050;
|
||||||
|
|
||||||
if (!m_bIsInitialised) return;
|
if (!m_bIsInitialised) return;
|
||||||
|
|
||||||
if (m_nUserPause != 0) {
|
if (m_nUserPause) {
|
||||||
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||||
if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == 1 &&
|
if (g_nMissionAudioSfx != NO_SAMPLE && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
|
||||||
SampleManager.IsStreamPlaying(1)) {
|
SampleManager.IsStreamPlaying(1)) {
|
||||||
SampleManager.PauseStream(TRUE, 1);
|
SampleManager.PauseStream(TRUE, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_nPreviousUserPause && g_nMissionAudioSfx != NO_SAMPLE &&
|
if (m_nPreviousUserPause && g_nMissionAudioSfx != NO_SAMPLE &&
|
||||||
bMissionAudioPhysicalPlayingStatus == 1) {
|
bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
|
||||||
SampleManager.PauseStream(FALSE, 1);
|
SampleManager.PauseStream(FALSE, 1);
|
||||||
}
|
}
|
||||||
if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = FALSE;
|
if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = FALSE;
|
||||||
|
@ -188,17 +189,17 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (g_nMissionAudioSfx != NO_SAMPLE && !bChannelOpen) {
|
if (g_nMissionAudioSfx != NO_SAMPLE && !bChannelOpen) {
|
||||||
if (g_nMissionAudioPlayingStatus) {
|
if (g_nMissionAudioPlayingStatus != PLAY_STATUS_STOPPED) {
|
||||||
if (g_nMissionAudioPlayingStatus == 1 && !bMissionAudioPhysicalPlayingStatus &&
|
if (g_nMissionAudioPlayingStatus == PLAY_STATUS_PLAYING && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_STOPPED &&
|
||||||
SampleManager.IsStreamPlaying(1)) {
|
SampleManager.IsStreamPlaying(1)) {
|
||||||
bMissionAudioPhysicalPlayingStatus = 1;
|
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_PLAYING;
|
||||||
}
|
}
|
||||||
if (bMissionAudioPhysicalPlayingStatus == 1) {
|
if (bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
|
||||||
if (SampleManager.IsStreamPlaying(1)) {
|
if (SampleManager.IsStreamPlaying(1)) {
|
||||||
DoPoliceRadioCrackle();
|
DoPoliceRadioCrackle();
|
||||||
} else {
|
} else {
|
||||||
bMissionAudioPhysicalPlayingStatus = 2;
|
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_FINISHED;
|
||||||
g_nMissionAudioPlayingStatus = 2;
|
g_nMissionAudioPlayingStatus = PLAY_STATUS_FINISHED;
|
||||||
g_nMissionAudioSfx = NO_SAMPLE;
|
g_nMissionAudioSfx = NO_SAMPLE;
|
||||||
cWait = 30;
|
cWait = 30;
|
||||||
}
|
}
|
||||||
|
@ -208,13 +209,13 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||||
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
|
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
|
||||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
|
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, TRUE, 1);
|
||||||
SampleManager.StartPreloadedStreamedFile(1);
|
SampleManager.StartPreloadedStreamedFile(1);
|
||||||
g_nMissionAudioPlayingStatus = 1;
|
g_nMissionAudioPlayingStatus = PLAY_STATUS_PLAYING;
|
||||||
bMissionAudioPhysicalPlayingStatus = 0;
|
bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bChannelOpen) DoPoliceRadioCrackle();
|
if (bChannelOpen) DoPoliceRadioCrackle();
|
||||||
if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != 1) &&
|
if ((g_nMissionAudioSfx == NO_SAMPLE || g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) &&
|
||||||
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.policeChannelTimer) {
|
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.policeChannelTimer) {
|
||||||
if (m_sPoliceRadioQueue.policeChannelTimer) {
|
if (m_sPoliceRadioQueue.policeChannelTimer) {
|
||||||
sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds];
|
sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds];
|
||||||
|
@ -225,7 +226,7 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||||
}
|
}
|
||||||
if (wantedLevel == 0) {
|
if (wantedLevel == 0) {
|
||||||
if (gSpecialSuspectLastSeenReport) {
|
if (gSpecialSuspectLastSeenReport) {
|
||||||
gSpecialSuspectLastSeenReport = 0;
|
gSpecialSuspectLastSeenReport = FALSE;
|
||||||
} else if (sample == SFX_POLICE_RADIO_MESSAGE_NOISE_1) {
|
} else if (sample == SFX_POLICE_RADIO_MESSAGE_NOISE_1) {
|
||||||
bChannelOpen = FALSE;
|
bChannelOpen = FALSE;
|
||||||
processed = TRUE;
|
processed = TRUE;
|
||||||
|
@ -246,8 +247,10 @@ cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||||
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq);
|
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq);
|
||||||
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
|
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
|
||||||
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
|
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
|
||||||
|
#ifndef GTA_PS2
|
||||||
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
|
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
|
||||||
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
|
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
|
||||||
|
#endif
|
||||||
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
|
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
|
||||||
}
|
}
|
||||||
if (processed) ResetPoliceRadio();
|
if (processed) ResetPoliceRadio();
|
||||||
|
|
|
@ -1757,6 +1757,7 @@ cSampleManager::UpdateReverb(void)
|
||||||
|
|
||||||
float fRatio = 0.0f;
|
float fRatio = 0.0f;
|
||||||
|
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
#define MIN_DIST 0.5f
|
#define MIN_DIST 0.5f
|
||||||
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
|
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
|
||||||
|
|
||||||
|
@ -1770,6 +1771,7 @@ cSampleManager::UpdateReverb(void)
|
||||||
|
|
||||||
#undef CALCULATE_RATIO
|
#undef CALCULATE_RATIO
|
||||||
#undef MIN_DIST
|
#undef MIN_DIST
|
||||||
|
#endif
|
||||||
|
|
||||||
fRatio = Clamp(fRatio, 0.0f, 0.6f);
|
fRatio = Clamp(fRatio, 0.0f, 0.6f);
|
||||||
|
|
||||||
|
@ -2267,7 +2269,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
|
||||||
bool8
|
bool8
|
||||||
cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
{
|
{
|
||||||
int i = 0;
|
uint32 i = 0;
|
||||||
uint32 position = nPos;
|
uint32 position = nPos;
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
|
|
||||||
|
@ -2348,7 +2350,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
if ( !_pMP3List )
|
if ( !_pMP3List )
|
||||||
{
|
{
|
||||||
nFile = 0;
|
nFile = 0;
|
||||||
_bIsMp3Active = 0;
|
_bIsMp3Active = FALSE;
|
||||||
strcpy(filename, m_MiscomPath);
|
strcpy(filename, m_MiscomPath);
|
||||||
strcat(filename, StreamedNameTable[nFile]);
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
strcat(filename, ".VB");
|
strcat(filename, ".VB");
|
||||||
|
@ -2396,7 +2398,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_bIsMp3Active = 0;
|
_bIsMp3Active = FALSE;
|
||||||
}
|
}
|
||||||
while ( ++i < nNumMP3s );
|
while ( ++i < nNumMP3s );
|
||||||
position = 0;
|
position = 0;
|
||||||
|
|
|
@ -1474,6 +1474,7 @@ bool8 cSampleManager::UpdateReverb(void)
|
||||||
|
|
||||||
float fRatio = 0.0f;
|
float fRatio = 0.0f;
|
||||||
|
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
#define MIN_DIST 0.5f
|
#define MIN_DIST 0.5f
|
||||||
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
|
#define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0)
|
||||||
|
|
||||||
|
@ -1487,6 +1488,7 @@ bool8 cSampleManager::UpdateReverb(void)
|
||||||
|
|
||||||
#undef CALCULATE_RATIO
|
#undef CALCULATE_RATIO
|
||||||
#undef MIN_DIST
|
#undef MIN_DIST
|
||||||
|
#endif
|
||||||
|
|
||||||
fRatio = Clamp(fRatio, 0.0f, 0.6f);
|
fRatio = Clamp(fRatio, 0.0f, 0.6f);
|
||||||
|
|
||||||
|
@ -1768,7 +1770,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
|
||||||
bool8
|
bool8
|
||||||
cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
{
|
{
|
||||||
int i = 0;
|
uint32 i = 0;
|
||||||
uint32 position = nPos;
|
uint32 position = nPos;
|
||||||
char filename[MAX_PATH];
|
char filename[MAX_PATH];
|
||||||
|
|
||||||
|
@ -1853,7 +1855,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
if ( !_pMP3List )
|
if ( !_pMP3List )
|
||||||
{
|
{
|
||||||
nFile = 0;
|
nFile = 0;
|
||||||
_bIsMp3Active = 0;
|
_bIsMp3Active = FALSE;
|
||||||
sprintf(filename, "%s.VB", StreamedNameTable[nFile]);
|
sprintf(filename, "%s.VB", StreamedNameTable[nFile]);
|
||||||
|
|
||||||
CStream* stream = aStream[nStream];
|
CStream* stream = aStream[nStream];
|
||||||
|
@ -1900,7 +1902,7 @@ cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
_bIsMp3Active = 0;
|
_bIsMp3Active = FALSE;
|
||||||
}
|
}
|
||||||
while ( ++i < nNumMP3s );
|
while ( ++i < nNumMP3s );
|
||||||
position = 0;
|
position = 0;
|
||||||
|
|
|
@ -186,6 +186,7 @@ enum Config {
|
||||||
# define PS2_MENU
|
# define PS2_MENU
|
||||||
#elif defined GTA_PC
|
#elif defined GTA_PC
|
||||||
# define EXTERNAL_3D_SOUND
|
# define EXTERNAL_3D_SOUND
|
||||||
|
# define AUDIO_REVERB
|
||||||
# ifndef GTA_HANDHELD
|
# ifndef GTA_HANDHELD
|
||||||
# define PC_PLAYER_CONTROLS // mouse player/cam mode
|
# define PC_PLAYER_CONTROLS // mouse player/cam mode
|
||||||
# endif
|
# endif
|
||||||
|
@ -232,6 +233,7 @@ enum Config {
|
||||||
#define DONT_FIX_REPLAY_BUGS
|
#define DONT_FIX_REPLAY_BUGS
|
||||||
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
|
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
|
||||||
//#define USE_TEXTURE_POOL // not possible because R* used custom RW33
|
//#define USE_TEXTURE_POOL // not possible because R* used custom RW33
|
||||||
|
#define AUDIO_REFLECTIONS
|
||||||
#else
|
#else
|
||||||
// This enables things from the PS2 version on PC
|
// This enables things from the PS2 version on PC
|
||||||
#define GTA_PS2_STUFF
|
#define GTA_PS2_STUFF
|
||||||
|
@ -449,6 +451,8 @@ static_assert(false, "SUPPORT_XBOX_SCRIPT and SUPPORT_MOBILE_SCRIPT are mutually
|
||||||
// Audio
|
// Audio
|
||||||
#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
|
#define EXTERNAL_3D_SOUND // use external engine to simulate 3d audio spatialization. OpenAL would not work without it (because it works in a 3d space
|
||||||
// originally and making it work in 2d only requires more resource). Will not work on PS2
|
// originally and making it work in 2d only requires more resource). Will not work on PS2
|
||||||
|
#define AUDIO_REFLECTIONS // Enable audio reflections. This is enabled in all vanilla versions
|
||||||
|
#define AUDIO_REVERB // Enable audio reverb. It was disabled in PS2 and mobile versions
|
||||||
#define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS
|
#define RADIO_SCROLL_TO_PREV_STATION // Won't work without FIX_BUGS
|
||||||
//#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
//#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||||
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 41 (PSP and mobile have 21 originally)
|
#define PS2_AUDIO_CHANNELS // increases the maximum number of audio channels to PS2 value of 41 (PSP and mobile have 21 originally)
|
||||||
|
|
|
@ -52,11 +52,7 @@ long _dwOperatingSystemVersion;
|
||||||
#include "Font.h"
|
#include "Font.h"
|
||||||
#include "MemoryMgr.h"
|
#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.
|
// This is defined on project-level, via premake5 or cmake
|
||||||
#if !defined _WIN32 && !defined __APPLE__ && !defined GTA_HANDHELD // && !defined WAYLAND
|
|
||||||
#define GET_KEYBOARD_INPUT_FROM_X11
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef GET_KEYBOARD_INPUT_FROM_X11
|
#ifdef GET_KEYBOARD_INPUT_FROM_X11
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
|
|
Loading…
Reference in a new issue