mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-22 09:09:15 +01:00
Merge branch 'master' of https://github.com/GTAmodding/re3 into wiiu
This commit is contained in:
commit
fc5bc0cb18
24
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
24
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**To Reproduce**
|
||||||
|
Steps to reproduce the behavior.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
If applicable, add screenshots to help explain your problem.
|
||||||
|
|
||||||
|
**Version**
|
||||||
|
Tell us what version you're running. Find out using the debug menu (Ctrl-M, Debug -> Version Text)
|
||||||
|
If you send a screenshot just enable it beforehand.
|
13
.github/pull_request_template.md
vendored
Normal file
13
.github/pull_request_template.md
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
As long as it's not linux/cross-platform skeleton/compatibility layer, all of the code on the repo that's not behind a preprocessor condition(like FIX_BUGS) are **completely** reversed code from original binaries.
|
||||||
|
|
||||||
|
We **don't** accept custom codes, as long as it's not wrapped via preprocessor conditions, or it's linux/cross-platform skeleton/compatibility layer.
|
||||||
|
|
||||||
|
We accept only these kinds of PRs;
|
||||||
|
|
||||||
|
- A new feature that exists in at least one of the GTAs (if it wasn't in III/VC then it doesn't have to be decompilation)
|
||||||
|
- Game, UI or UX bug fixes (if it's a fix to R* code, it should be behind FIX_BUGS)
|
||||||
|
- Platform-specific and/or unused code that's not been reversed yet
|
||||||
|
- Makes reversed code more understandable/accurate, as in "which code would produce this assembly".
|
||||||
|
- A new cross-platform skeleton/compatibility layer, or improvements to them
|
||||||
|
- Translation fixes, for languages R* supported/outsourced
|
||||||
|
- Code that increase maintainability
|
28
.github/workflows/build-switch.yml
vendored
Normal file
28
.github/workflows/build-switch.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
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 -DRE3_AUDIO=OAL -DLIBRW_PLATFORM=GL3 -DLIBRW_GL3_GFXLIB=GLFW -DRE3_WITH_OPUS=False -DRE3_VENDORED_LIBRW=True -DRE3_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/*.zip
|
||||||
|
if-no-files-found: error
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -355,9 +355,13 @@ vendor/glfw-3.3.2.bin.WIN64/
|
|||||||
|
|
||||||
sdk/
|
sdk/
|
||||||
|
|
||||||
*.rpx
|
codewarrior/re3.mcp
|
||||||
*.elf
|
|
||||||
/.vscode
|
|
||||||
codewarrior/re3_Data/
|
codewarrior/re3_Data/
|
||||||
codewarrior/Release/
|
codewarrior/Release/
|
||||||
codewarrior/Debug/
|
codewarrior/Debug/
|
||||||
|
|
||||||
|
src/extras/GitSHA1.cpp
|
||||||
|
|
||||||
|
*.rpx
|
||||||
|
*.elf
|
||||||
|
/.vscode
|
||||||
|
@ -1,11 +1,26 @@
|
|||||||
cmake_minimum_required(VERSION 3.8)
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
set(EXECUTABLE re3)
|
set(EXECUTABLE re3)
|
||||||
set(PROJECT RE3)
|
set(PROJECT RE3)
|
||||||
|
|
||||||
project(${EXECUTABLE} C CXX)
|
project(${EXECUTABLE} C CXX)
|
||||||
|
set(${PROJECT}_AUTHOR "${PROJECT} Team")
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
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 re3_platform_target)
|
||||||
|
function(re3_platform_target)
|
||||||
|
endfunction()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(${PROJECT}_AUDIOS "OAL" "MSS")
|
set(${PROJECT}_AUDIOS "OAL" "MSS")
|
||||||
else()
|
else()
|
||||||
@ -62,6 +77,8 @@ if(${PROJECT}_INSTALL)
|
|||||||
set(os "-apple")
|
set(os "-apple")
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
set(os "-linux")
|
set(os "-linux")
|
||||||
|
elseif(NINTENDO_SWITCH)
|
||||||
|
set(os "-switch")
|
||||||
else()
|
else()
|
||||||
set(compiler "-UNK")
|
set(compiler "-UNK")
|
||||||
message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)")
|
message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)")
|
||||||
|
202
README.md
202
README.md
@ -1,5 +1,5 @@
|
|||||||
# re3-wiiu
|
# re3-wiiu
|
||||||
<img src="https://github.com/GaryOderNichts/re3-wiiu/blob/wiiu/logo.png?raw=true" alt="re3 logo" width="200">
|
<img src="https://github.com/GaryOderNichts/re3-wiiu/blob/wiiu/res/images/logo_1024.png?raw=true" alt="re3 logo" width="200">
|
||||||
|
|
||||||
This is a port of GTA III to the Nintendo Wii U.
|
This is a port of GTA III to the Nintendo Wii U.
|
||||||
|
|
||||||
@ -15,36 +15,102 @@ Then clone this repo using `git clone --recursive https://github.com/GaryOderNic
|
|||||||
To build the channel edit `CHANNEL_BUILD := 0` to `CHANNEL_BUILD := 1` in the `Makefile`.
|
To build the channel edit `CHANNEL_BUILD := 0` to `CHANNEL_BUILD := 1` in the `Makefile`.
|
||||||
|
|
||||||
# Original README
|
# Original README
|
||||||
|
|
||||||
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=master)
|
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=master)
|
||||||
<a href="https://discord.gg/aKYAwCx92H"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
|
<a href="https://discord.gg/RFNbjsUMGg"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
|
||||||
|
|
||||||
## Intro
|
## Intro
|
||||||
|
|
||||||
The aim of this project is to reverse GTA III for PC by replacing
|
In this repository you'll find the fully reversed source code for GTA III ([master](https://github.com/GTAmodding/re3/tree/master/) branch) and GTA VC ([miami](https://github.com/GTAmodding/re3/tree/miami/) branch).
|
||||||
parts of the game [one by one](https://en.wikipedia.org/wiki/Ship_of_Theseus)
|
|
||||||
such that we have a working game at all times.
|
|
||||||
|
|
||||||
## How can I try it?
|
It has been tested and works on Windows, Linux, MacOS and FreeBSD, on x86, amd64, arm and arm64.\
|
||||||
|
Rendering is handled either by original RenderWare (D3D8)
|
||||||
|
or the reimplementation [librw](https://github.com/aap/librw) (D3D9, OpenGL 2.1 or above, OpenGL ES 2.0 or above).\
|
||||||
|
Audio is done with MSS (using dlls from original GTA) or OpenAL.
|
||||||
|
|
||||||
- re3 requires game assets to work, so you **must** own [a copy of GTA III](https://store.steampowered.com/app/12100/Grand_Theft_Auto_III/).
|
The project has also been ported to the [Nintendo Switch](https://github.com/AGraber/re3-nx/),
|
||||||
- Build re3 or download [the latest nightly build](https://github.com/GTAmodding/re3/actions) (You must be logged in.)
|
[Playstation Vita](https://github.com/Rinnegatamante/re3) and
|
||||||
- (Optional) If you want to use optional features like Russian language or menu map, copy the files in /gamefiles folder to your game root folder.
|
[Nintendo Wii U](https://github.com/GaryOderNichts/re3-wiiu/).
|
||||||
- Move re3.exe to GTA 3 directory and run it.
|
|
||||||
|
|
||||||
## Latest standalone executables to download
|
We cannot build for PS2 or Xbox yet. If you're interested in doing so, get in touch with us.
|
||||||
|
|
||||||
(Put content of selected archive into gamedir)
|
## Installation
|
||||||
|
|
||||||
- [MacOS 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/master/macos-latest-gl3.zip)
|
- re3 requires PC game assets to work, so you **must** own [a copy of GTA III](https://store.steampowered.com/app/12100/Grand_Theft_Auto_III/).
|
||||||
- [Linux 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/master/ubuntu-latest-gl3.zip)
|
- Build re3 or download the latest build:
|
||||||
- [Windows D3D9 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/master/windows-latest-d3d9.zip)
|
- [Windows D3D9 MSS 32bit](https://nightly.link/GTAmodding/re3/workflows/re3_msvc_x86/master/re3_Release_win-x86-librw_d3d9-mss.zip)
|
||||||
- [Windows OpenGL 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/master/windows-latest-gl3.zip)
|
- [Windows D3D9 64bit](https://nightly.link/GTAmodding/re3/workflows/re3_msvc_amd64/master/re3_Release_win-amd64-librw_d3d9-oal.zip)
|
||||||
- [Windows D3D9 MSS 32bit](https://nightly.link/GTAmodding/re3/workflows/re3_msvc_x86/master/re3_Release_win-x86-librw_d3d9-mss.zip)
|
- [Windows OpenGL 64bit](https://nightly.link/GTAmodding/re3/workflows/re3_msvc_amd64/master/re3_Release_win-amd64-librw_gl3_glfw-oal.zip)
|
||||||
|
- [Linux 64bit](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/master/ubuntu-18.04-gl3.zip)
|
||||||
|
- [MacOS 64bit x86-64](https://nightly.link/GTAmodding/re3/workflows/build-cmake-conan/master/macos-latest-gl3.zip)
|
||||||
|
- Extract the downloaded zip over your GTA 3 directory and run re3. The zip includes the binary, updated and additional gamefiles and in case of OpenAL the required dlls.
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
![re3 2021-02-11 22-57-03-23](https://user-images.githubusercontent.com/1521437/107704085-fbdabd00-6cbc-11eb-8406-8951a80ccb16.png)
|
||||||
|
![re3 2021-02-11 22-43-44-98](https://user-images.githubusercontent.com/1521437/107703339-cbdeea00-6cbb-11eb-8f0b-07daa105d470.png)
|
||||||
|
![re3 2021-02-11 22-46-33-76](https://user-images.githubusercontent.com/1521437/107703343-cd101700-6cbb-11eb-9ccd-012cb90524b7.png)
|
||||||
|
![re3 2021-02-11 22-50-29-54](https://user-images.githubusercontent.com/1521437/107703348-d00b0780-6cbb-11eb-8afd-054249c2b95e.png)
|
||||||
|
|
||||||
|
## Improvements
|
||||||
|
|
||||||
|
We have implemented a number of changes and improvements to the original game.
|
||||||
|
They can be configured in `core/config.h`.
|
||||||
|
Some of them can be toggled at runtime, some cannot.
|
||||||
|
|
||||||
|
* Fixed a lot of smaller and bigger bugs
|
||||||
|
* User files (saves and settings) stored in GTA root directory
|
||||||
|
* Settings stored in re3.ini file instead of gta3.set
|
||||||
|
* Debug menu to do and change various things (Ctrl-M to open)
|
||||||
|
* Debug camera (Ctrl-B to toggle)
|
||||||
|
* Rotatable camera
|
||||||
|
* XInput controller support (Windows)
|
||||||
|
* No loading screens between islands ("map memory usage" in menu)
|
||||||
|
* Skinned ped support (models from Xbox or Mobile)
|
||||||
|
* Rendering
|
||||||
|
* Widescreen support (properly scaled HUD, Menu and FOV)
|
||||||
|
* PS2 MatFX (vehicle reflections)
|
||||||
|
* PS2 alpha test (better rendering of transparency)
|
||||||
|
* PS2 particles
|
||||||
|
* Xbox vehicle rendering
|
||||||
|
* Xbox world lightmap rendering (needs Xbox map)
|
||||||
|
* Xbox ped rim light
|
||||||
|
* Xbox screen rain droplets
|
||||||
|
* More customizable colourfilter
|
||||||
|
* Menu
|
||||||
|
* Map
|
||||||
|
* More options
|
||||||
|
* Controller configuration menu
|
||||||
|
* ...
|
||||||
|
* Can load DFFs and TXDs from other platforms, possibly with a performance penalty
|
||||||
|
* ...
|
||||||
|
|
||||||
|
## To-Do
|
||||||
|
|
||||||
|
The following things would be nice to have/do:
|
||||||
|
|
||||||
|
* Fix physics for high FPS
|
||||||
|
* Improve performance on lower end devices, especially the OpenGL layer on the Raspberry Pi (if you have experience with this, please get in touch)
|
||||||
|
* Compare code with PS2 code (tedious, no good decompiler)
|
||||||
|
* [PS2 port](https://github.com/GTAmodding/re3/wiki/PS2-port)
|
||||||
|
* Xbox port (not quite as important)
|
||||||
|
* reverse remaining unused/debug functions
|
||||||
|
* compare CodeWarrior build with original binary for more accurate code (very tedious)
|
||||||
|
|
||||||
|
## Modding
|
||||||
|
|
||||||
|
Asset modifications (models, texture, handling, script, ...) should work the same way as with original GTA for the most part.
|
||||||
|
|
||||||
|
Mods that make changes to the code (dll/asi, CLEO, limit adjusters) will *not* work.
|
||||||
|
Some things these mods do are already implemented in re3 (much of SkyGFX, GInput, SilentPatch, Widescreen fix),
|
||||||
|
others can easily be achieved (increasing limis, see `config.h`),
|
||||||
|
others will simply have to be rewritten and integrated into the code directly.
|
||||||
|
Sorry for the inconvenience.
|
||||||
|
|
||||||
## Building from Source
|
## Building from Source
|
||||||
|
|
||||||
If you gonna use premake, then before starting you may want to point GTA_III_RE_DIR environment variable to GTA3 root folder, if you want executable to be moved there via post-build script.
|
When using premake, you may want to point GTA_III_RE_DIR environment variable to GTA3 root folder if you want the executable to be moved there via post-build script.
|
||||||
|
|
||||||
|
Clone the repository with `git clone --recursive https://github.com/GTAmodding/re3.git`. Then `cd re3` into the cloned repository.
|
||||||
|
|
||||||
<details><summary>Linux Premake</summary>
|
<details><summary>Linux Premake</summary>
|
||||||
|
|
||||||
@ -54,13 +120,6 @@ For Linux using premake, proceed: [Building on Linux](https://github.com/GTAmodd
|
|||||||
|
|
||||||
<details><summary>Linux Conan</summary>
|
<details><summary>Linux Conan</summary>
|
||||||
|
|
||||||
Obtain source code.
|
|
||||||
```
|
|
||||||
git clone https://github.com/GTAmodding/re3.git
|
|
||||||
cd re3
|
|
||||||
git submodule init
|
|
||||||
git submodule update --recursive
|
|
||||||
```
|
|
||||||
Install python and conan, and then run build.
|
Install python and conan, and then run build.
|
||||||
```
|
```
|
||||||
conan export vendor/librw librw/master@
|
conan export vendor/librw librw/master@
|
||||||
@ -71,6 +130,12 @@ conan build .. -if build -bf build -pf package
|
|||||||
```
|
```
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
|
<details><summary>MacOS Premake</summary>
|
||||||
|
|
||||||
|
For MacOS using premake, proceed: [Building on MacOS](https://github.com/GTAmodding/re3/wiki/Building-on-MacOS)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
<details><summary>FreeBSD</summary>
|
<details><summary>FreeBSD</summary>
|
||||||
|
|
||||||
For FreeBSD using premake, proceed: [Building on FreeBSD](https://github.com/GTAmodding/re3/wiki/Building-on-FreeBSD)
|
For FreeBSD using premake, proceed: [Building on FreeBSD](https://github.com/GTAmodding/re3/wiki/Building-on-FreeBSD)
|
||||||
@ -79,35 +144,76 @@ For FreeBSD using premake, proceed: [Building on FreeBSD](https://github.com/GTA
|
|||||||
|
|
||||||
<details><summary>Windows</summary>
|
<details><summary>Windows</summary>
|
||||||
|
|
||||||
Assuming you have Visual Studio:
|
Assuming you have Visual Studio 2015/2017/2019:
|
||||||
- Clone the repo using the argument `--recursive`.
|
|
||||||
- Run one of the `premake-vsXXXX.cmd` variants on root folder.
|
- Run one of the `premake-vsXXXX.cmd` variants on root folder.
|
||||||
- Open the project via Visual Studio
|
- Open build/re3.sln with Visual Studio and compile the solution.
|
||||||
|
|
||||||
**If you use 64-bit D3D9**: We don't ship 64-bit Dx9 SDK. You need to download it from Microsoft if you don't have it(although it should come pre-installed after some Windows version)
|
Microsoft recently discontinued its downloads of the DX9 SDK. You can download an archived version here: https://archive.org/details/dxsdk_jun10
|
||||||
|
|
||||||
**If you choose OpenAL on Windows** You must read [Running OpenAL build on Windows](https://github.com/GTAmodding/re3/wiki/Running-OpenAL-build-on-Windows).
|
**If you choose OpenAL on Windows** You must read [Running OpenAL build on Windows](https://github.com/GTAmodding/re3/wiki/Running-OpenAL-build-on-Windows).
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
> :information_source: There are various settings at the very bottom of [config.h](https://github.com/GTAmodding/re3/tree/master/src/core/config.h), you may want to take a look there. i.e. FIX_BUGS define fixes the bugs we've come across.
|
> :information_source: premake has an `--with-lto` option if you want the project to be compiled with Link Time Optimization.
|
||||||
|
|
||||||
> :information_source: **Did you notice librw?** re3 uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of re3, but you also can use LIBRW enviorenment variable to specify path to your own librw.
|
> :information_source: There are various settings in [config.h](https://github.com/GTAmodding/re3/tree/master/src/core/config.h), you may want to take a look there.
|
||||||
|
|
||||||
|
> :information_source: re3 uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of re3, but you also can use LIBRW enviorenment variable to specify path to your own librw.
|
||||||
|
|
||||||
|
If you feel the need, you can also use CodeWarrior 7 to compile re3 using the supplied codewarrior/re3.mcp project - this requires the original RW33 libraries, and the DX8 SDK. The build is unstable compared to the MSVC builds though, and is mostly meant to serve as a reference.
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document
|
As long as it's not linux/cross-platform skeleton/compatibility layer, all of the code on the repo that's not behind a preprocessor condition(like FIX_BUGS) are **completely** reversed code from original binaries.
|
||||||
|
|
||||||
### Unreversed / incomplete classes (at least the ones we know)
|
We **don't** accept custom codes, as long as it's not wrapped via preprocessor conditions, or it's linux/cross-platform skeleton/compatibility layer.
|
||||||
The following classes have only unused or practically unused code left:
|
|
||||||
```
|
We accept only these kinds of PRs;
|
||||||
NameGrid.cpp - only on mobile (a player name grid, either a very early player name code ala GTA1 or a multiplayer leftover)
|
|
||||||
PedDebug.cpp - only on mobile (debug code)
|
- A new feature that exists in at least one of the GTAs (if it wasn't in III/VC then it doesn't have to be decompilation)
|
||||||
HandlingMgr.cpp - debug functions from mobile
|
- Game, UI or UX bug fixes (if it's a fix to original code, it should be behind FIX_BUGS)
|
||||||
CFormationInfo - unused PedAI class that could be found on mobile
|
- Platform-specific and/or unused code that's not been reversed yet
|
||||||
CVehicle::ProcessBikeWheel - early bike code (only on mobile)
|
- Makes reversed code more understandable/accurate, as in "which code would produce this assembly".
|
||||||
CAutomobile::DebugCode - debug function from mobile
|
- A new cross-platform skeleton/compatibility layer, or improvements to them
|
||||||
CBoat::DebugCode - debug function from mobile
|
- Translation fixes, for languages original game supported
|
||||||
CBoat::ModifyHandlingValue - debug function from mobile
|
- Code that increase maintainability
|
||||||
CBoat::DisplayHandlingData - debug function from mobile
|
|
||||||
CStreaming::PrintRequestList - debug function from mobile
|
We have a [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) document that isn't followed or enforced very well.
|
||||||
d3d8raster.c - only on PC (slight RW modification that we don't actually need)
|
|
||||||
```
|
Do not use features from C++11 or later.
|
||||||
|
|
||||||
|
|
||||||
|
## History
|
||||||
|
|
||||||
|
re3 was started sometime in the spring of 2018,
|
||||||
|
initially as a way to test reversed collision and physics code
|
||||||
|
inside the game.
|
||||||
|
This was done by replacing single functions of the game
|
||||||
|
with their reversed counterparts using a dll.
|
||||||
|
|
||||||
|
After a bit of work the project lay dormant for about a year
|
||||||
|
and was picked up again and pushed to github in May 2019.
|
||||||
|
At the time I (aap) had reversed around 10k lines of code and estimated
|
||||||
|
the final game to have around 200-250k.
|
||||||
|
Others quickly joined the effort (Fire_Head, shfil, erorcun and Nick007J
|
||||||
|
in time order, and Serge a bit later) and we made very quick progress
|
||||||
|
throughout the summer of 2019
|
||||||
|
after which the pace slowed down a bit.
|
||||||
|
|
||||||
|
Due to everyone staying home during the start of the Corona pandemic
|
||||||
|
everybody had a lot of time to work on re3 again and
|
||||||
|
we finally got a standalone exe in April 2020 (around 180k lines by then).
|
||||||
|
|
||||||
|
After the initial excitement and fixing and polishing the code further,
|
||||||
|
reVC was started in early May 2020 by starting from re3 code,
|
||||||
|
not by starting from scratch replacing functions with a dll.
|
||||||
|
After a few months of mostly steady progress we considered reVC
|
||||||
|
finished in December.
|
||||||
|
|
||||||
|
Since then we have started reLCS, which is currently work in progress.
|
||||||
|
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
We don't feel like we're in a position to give this code a license.\
|
||||||
|
The code should only be used for educational, documentation and modding purposes.\
|
||||||
|
We do not encourage piracy or commercial use.\
|
||||||
|
Please keep derivate work open source and give proper credit.
|
||||||
|
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
|
@ -28,7 +28,7 @@ find_package_handle_standard_args(MilesSDK DEFAULT_MSG MilesSDK_LIBRARIES MilesS
|
|||||||
if(NOT TARGET MilesSDK::MilesSDK)
|
if(NOT TARGET MilesSDK::MilesSDK)
|
||||||
add_library(MilesSDK::MilesSDK UNKNOWN IMPORTED)
|
add_library(MilesSDK::MilesSDK UNKNOWN IMPORTED)
|
||||||
set_target_properties(MilesSDK::MilesSDK PROPERTIES
|
set_target_properties(MilesSDK::MilesSDK PROPERTIES
|
||||||
IMPORTED_LOCATION "${MilesSDK_LIBRARIES}
|
IMPORTED_LOCATION "${MilesSDK_LIBRARIES}"
|
||||||
INTERFACE_INCLUDE_DIRECTORIES "${MilesSDK_INCLUDE_DIR}"
|
INTERFACE_INCLUDE_DIRECTORIES "${MilesSDK_INCLUDE_DIR}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
@ -18,7 +18,7 @@ find_path(mpg123_INCLUDE_DIR mpg123.h
|
|||||||
PATH_SUFFIXES include
|
PATH_SUFFIXES include
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0
|
find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0 libmpg123-0
|
||||||
HINTS ${PKG_MPG123_LIBRARIES}
|
HINTS ${PKG_MPG123_LIBRARIES}
|
||||||
PATHS "${mpg123_DIR}"
|
PATHS "${mpg123_DIR}"
|
||||||
PATH_SUFFIXES lib
|
PATH_SUFFIXES lib
|
||||||
|
284
cmake/GetGitRevisionDescription.cmake
Normal file
284
cmake/GetGitRevisionDescription.cmake
Normal file
@ -0,0 +1,284 @@
|
|||||||
|
# - Returns a version string from Git
|
||||||
|
#
|
||||||
|
# These functions force a re-configure on each git commit so that you can
|
||||||
|
# trust the values of the variables in your build system.
|
||||||
|
#
|
||||||
|
# get_git_head_revision(<refspecvar> <hashvar> [ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR])
|
||||||
|
#
|
||||||
|
# Returns the refspec and sha hash of the current head revision
|
||||||
|
#
|
||||||
|
# git_describe(<var> [<additional arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the results of git describe on the source tree, and adjusting
|
||||||
|
# the output so that it tests false if an error occurs.
|
||||||
|
#
|
||||||
|
# git_describe_working_tree(<var> [<additional arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the results of git describe on the working tree (--dirty option),
|
||||||
|
# and adjusting the output so that it tests false if an error occurs.
|
||||||
|
#
|
||||||
|
# git_get_exact_tag(<var> [<additional arguments to git describe> ...])
|
||||||
|
#
|
||||||
|
# Returns the results of git describe --exact-match on the source tree,
|
||||||
|
# and adjusting the output so that it tests false if there was no exact
|
||||||
|
# matching tag.
|
||||||
|
#
|
||||||
|
# git_local_changes(<var>)
|
||||||
|
#
|
||||||
|
# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes.
|
||||||
|
# Uses the return code of "git diff-index --quiet HEAD --".
|
||||||
|
# Does not regard untracked files.
|
||||||
|
#
|
||||||
|
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# 2009-2020 Ryan Pavlik <ryan.pavlik@gmail.com> <abiryan@ryand.net>
|
||||||
|
# http://academic.cleardefinition.com
|
||||||
|
#
|
||||||
|
# Copyright 2009-2013, Iowa State University.
|
||||||
|
# Copyright 2013-2020, Ryan Pavlik
|
||||||
|
# Copyright 2013-2020, Contributors
|
||||||
|
# SPDX-License-Identifier: BSL-1.0
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
if(__get_git_revision_description)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(__get_git_revision_description YES)
|
||||||
|
|
||||||
|
# We must run the following at "include" time, not at function call time,
|
||||||
|
# to find the path to this module rather than the path to a calling list file
|
||||||
|
get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH)
|
||||||
|
|
||||||
|
# Function _git_find_closest_git_dir finds the next closest .git directory
|
||||||
|
# that is part of any directory in the path defined by _start_dir.
|
||||||
|
# The result is returned in the parent scope variable whose name is passed
|
||||||
|
# as variable _git_dir_var. If no .git directory can be found, the
|
||||||
|
# function returns an empty string via _git_dir_var.
|
||||||
|
#
|
||||||
|
# Example: Given a path C:/bla/foo/bar and assuming C:/bla/.git exists and
|
||||||
|
# neither foo nor bar contain a file/directory .git. This wil return
|
||||||
|
# C:/bla/.git
|
||||||
|
#
|
||||||
|
function(_git_find_closest_git_dir _start_dir _git_dir_var)
|
||||||
|
set(cur_dir "${_start_dir}")
|
||||||
|
set(git_dir "${_start_dir}/.git")
|
||||||
|
while(NOT EXISTS "${git_dir}")
|
||||||
|
# .git dir not found, search parent directories
|
||||||
|
set(git_previous_parent "${cur_dir}")
|
||||||
|
get_filename_component(cur_dir ${cur_dir} DIRECTORY)
|
||||||
|
if(cur_dir STREQUAL git_previous_parent)
|
||||||
|
# We have reached the root directory, we are not in git
|
||||||
|
set(${_git_dir_var}
|
||||||
|
""
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(git_dir "${cur_dir}/.git")
|
||||||
|
endwhile()
|
||||||
|
set(${_git_dir_var}
|
||||||
|
"${git_dir}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(get_git_head_revision _refspecvar _hashvar)
|
||||||
|
_git_find_closest_git_dir("${CMAKE_CURRENT_SOURCE_DIR}" GIT_DIR)
|
||||||
|
|
||||||
|
if("${ARGN}" STREQUAL "ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR")
|
||||||
|
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR TRUE)
|
||||||
|
else()
|
||||||
|
set(ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR FALSE)
|
||||||
|
endif()
|
||||||
|
if(NOT "${GIT_DIR}" STREQUAL "")
|
||||||
|
file(RELATIVE_PATH _relative_to_source_dir "${CMAKE_SOURCE_DIR}"
|
||||||
|
"${GIT_DIR}")
|
||||||
|
if("${_relative_to_source_dir}" MATCHES "[.][.]" AND NOT ALLOW_LOOKING_ABOVE_CMAKE_SOURCE_DIR)
|
||||||
|
# We've gone above the CMake root dir.
|
||||||
|
set(GIT_DIR "")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if("${GIT_DIR}" STREQUAL "")
|
||||||
|
set(${_refspecvar}
|
||||||
|
"GITDIR-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
set(${_hashvar}
|
||||||
|
"GITDIR-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Check if the current source dir is a git submodule or a worktree.
|
||||||
|
# In both cases .git is a file instead of a directory.
|
||||||
|
#
|
||||||
|
if(NOT IS_DIRECTORY ${GIT_DIR})
|
||||||
|
# The following git command will return a non empty string that
|
||||||
|
# points to the super project working tree if the current
|
||||||
|
# source dir is inside a git submodule.
|
||||||
|
# Otherwise the command will return an empty string.
|
||||||
|
#
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" rev-parse
|
||||||
|
--show-superproject-working-tree
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT "${out}" STREQUAL "")
|
||||||
|
# If out is empty, GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a submodule
|
||||||
|
file(READ ${GIT_DIR} submodule)
|
||||||
|
string(REGEX REPLACE "gitdir: (.*)$" "\\1" GIT_DIR_RELATIVE
|
||||||
|
${submodule})
|
||||||
|
string(STRIP ${GIT_DIR_RELATIVE} GIT_DIR_RELATIVE)
|
||||||
|
get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH)
|
||||||
|
get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE}
|
||||||
|
ABSOLUTE)
|
||||||
|
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||||
|
else()
|
||||||
|
# GIT_DIR/CMAKE_CURRENT_SOURCE_DIR is in a worktree
|
||||||
|
file(READ ${GIT_DIR} worktree_ref)
|
||||||
|
# The .git directory contains a path to the worktree information directory
|
||||||
|
# inside the parent git repo of the worktree.
|
||||||
|
#
|
||||||
|
string(REGEX REPLACE "gitdir: (.*)$" "\\1" git_worktree_dir
|
||||||
|
${worktree_ref})
|
||||||
|
string(STRIP ${git_worktree_dir} git_worktree_dir)
|
||||||
|
_git_find_closest_git_dir("${git_worktree_dir}" GIT_DIR)
|
||||||
|
set(HEAD_SOURCE_FILE "${git_worktree_dir}/HEAD")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
set(HEAD_SOURCE_FILE "${GIT_DIR}/HEAD")
|
||||||
|
endif()
|
||||||
|
set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data")
|
||||||
|
if(NOT EXISTS "${GIT_DATA}")
|
||||||
|
file(MAKE_DIRECTORY "${GIT_DATA}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT EXISTS "${HEAD_SOURCE_FILE}")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
set(HEAD_FILE "${GIT_DATA}/HEAD")
|
||||||
|
configure_file("${HEAD_SOURCE_FILE}" "${HEAD_FILE}" COPYONLY)
|
||||||
|
|
||||||
|
configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in"
|
||||||
|
"${GIT_DATA}/grabRef.cmake" @ONLY)
|
||||||
|
include("${GIT_DATA}/grabRef.cmake")
|
||||||
|
|
||||||
|
set(${_refspecvar}
|
||||||
|
"${HEAD_REF}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
set(${_hashvar}
|
||||||
|
"${HEAD_HASH}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_describe _var)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
find_package(Git QUIET)
|
||||||
|
endif()
|
||||||
|
get_git_head_revision(refspec hash)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
set(${_var}
|
||||||
|
"GIT-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
if(NOT hash)
|
||||||
|
set(${_var}
|
||||||
|
"HEAD-HASH-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# TODO sanitize
|
||||||
|
#if((${ARGN}" MATCHES "&&") OR
|
||||||
|
# (ARGN MATCHES "||") OR
|
||||||
|
# (ARGN MATCHES "\\;"))
|
||||||
|
# message("Please report the following error to the project!")
|
||||||
|
# message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}")
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
#message(STATUS "Arguments to execute_process: ${ARGN}")
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" describe --tags --always ${hash} ${ARGN}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE res
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT res EQUAL 0)
|
||||||
|
set(out "${out}-${res}-NOTFOUND")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${_var}
|
||||||
|
"${out}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_describe_working_tree _var)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
find_package(Git QUIET)
|
||||||
|
endif()
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
set(${_var}
|
||||||
|
"GIT-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" describe --dirty ${ARGN}
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE res
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(NOT res EQUAL 0)
|
||||||
|
set(out "${out}-${res}-NOTFOUND")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(${_var}
|
||||||
|
"${out}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_get_exact_tag _var)
|
||||||
|
git_describe(out --exact-match ${ARGN})
|
||||||
|
set(${_var}
|
||||||
|
"${out}"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(git_local_changes _var)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
find_package(Git QUIET)
|
||||||
|
endif()
|
||||||
|
get_git_head_revision(refspec hash)
|
||||||
|
if(NOT GIT_FOUND)
|
||||||
|
set(${_var}
|
||||||
|
"GIT-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
if(NOT hash)
|
||||||
|
set(${_var}
|
||||||
|
"HEAD-HASH-NOTFOUND"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND "${GIT_EXECUTABLE}" diff-index --quiet HEAD --
|
||||||
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
|
RESULT_VARIABLE res
|
||||||
|
OUTPUT_VARIABLE out
|
||||||
|
ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
if(res EQUAL 0)
|
||||||
|
set(${_var}
|
||||||
|
"CLEAN"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
else()
|
||||||
|
set(${_var}
|
||||||
|
"DIRTY"
|
||||||
|
PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
43
cmake/GetGitRevisionDescription.cmake.in
Normal file
43
cmake/GetGitRevisionDescription.cmake.in
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#
|
||||||
|
# Internal file for GetGitRevisionDescription.cmake
|
||||||
|
#
|
||||||
|
# Requires CMake 2.6 or newer (uses the 'function' command)
|
||||||
|
#
|
||||||
|
# Original Author:
|
||||||
|
# 2009-2010 Ryan Pavlik <rpavlik@iastate.edu> <abiryan@ryand.net>
|
||||||
|
# http://academic.cleardefinition.com
|
||||||
|
# Iowa State University HCI Graduate Program/VRAC
|
||||||
|
#
|
||||||
|
# Copyright 2009-2012, Iowa State University
|
||||||
|
# Copyright 2011-2015, Contributors
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
# SPDX-License-Identifier: BSL-1.0
|
||||||
|
|
||||||
|
set(HEAD_HASH)
|
||||||
|
|
||||||
|
file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024)
|
||||||
|
|
||||||
|
string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS)
|
||||||
|
if(HEAD_CONTENTS MATCHES "ref")
|
||||||
|
# named branch
|
||||||
|
string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}")
|
||||||
|
if(EXISTS "@GIT_DIR@/${HEAD_REF}")
|
||||||
|
configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY)
|
||||||
|
else()
|
||||||
|
configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY)
|
||||||
|
file(READ "@GIT_DATA@/packed-refs" PACKED_REFS)
|
||||||
|
if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}")
|
||||||
|
set(HEAD_HASH "${CMAKE_MATCH_1}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# detached HEAD
|
||||||
|
configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT HEAD_HASH)
|
||||||
|
file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024)
|
||||||
|
string(STRIP "${HEAD_HASH}" HEAD_HASH)
|
||||||
|
endif()
|
38
cmake/nx/NXFunctions.cmake
Normal file
38
cmake/nx/NXFunctions.cmake
Normal file
@ -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(re3_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()
|
Binary file not shown.
15378
codewarrior/re3.mcp.xml
Normal file
15378
codewarrior/re3.mcp.xml
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
gamefiles/TEXT/polish.gxt
Normal file → Executable file
BIN
gamefiles/TEXT/polish.gxt
Normal file → Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
gamefiles/models/frontend_ds3.txd
Normal file
BIN
gamefiles/models/frontend_ds3.txd
Normal file
Binary file not shown.
BIN
gamefiles/models/frontend_ds4.txd
Normal file
BIN
gamefiles/models/frontend_ds4.txd
Normal file
Binary file not shown.
BIN
gamefiles/models/frontend_nsw.txd
Normal file
BIN
gamefiles/models/frontend_nsw.txd
Normal file
Binary file not shown.
BIN
gamefiles/models/frontend_x360.txd
Normal file
BIN
gamefiles/models/frontend_x360.txd
Normal file
Binary file not shown.
BIN
gamefiles/models/frontend_xone.txd
Normal file
BIN
gamefiles/models/frontend_xone.txd
Normal file
Binary file not shown.
BIN
gamefiles/models/generic.txd
Normal file
BIN
gamefiles/models/generic.txd
Normal file
Binary file not shown.
BIN
gamefiles/models/nswbtns.txd
Normal file
BIN
gamefiles/models/nswbtns.txd
Normal file
Binary file not shown.
BIN
gamefiles/models/particle.txd
Normal file
BIN
gamefiles/models/particle.txd
Normal file
Binary file not shown.
BIN
gamefiles/models/ps3btns.txd
Normal file
BIN
gamefiles/models/ps3btns.txd
Normal file
Binary file not shown.
Binary file not shown.
132
premake5.lua
132
premake5.lua
@ -1,10 +1,3 @@
|
|||||||
newoption {
|
|
||||||
trigger = "glewdir",
|
|
||||||
value = "PATH",
|
|
||||||
description = "Directory of GLEW",
|
|
||||||
default = "vendor/glew-2.1.0"
|
|
||||||
}
|
|
||||||
|
|
||||||
newoption {
|
newoption {
|
||||||
trigger = "glfwdir64",
|
trigger = "glfwdir64",
|
||||||
value = "PATH",
|
value = "PATH",
|
||||||
@ -35,10 +28,22 @@ newoption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newoption {
|
newoption {
|
||||||
trigger = "lto",
|
trigger = "with-lto",
|
||||||
description = "Use link time optimization"
|
description = "Build with link time optimization"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
trigger = "no-git-hash",
|
||||||
|
description = "Don't print git commit hash into binary"
|
||||||
|
}
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
trigger = "no-full-paths",
|
||||||
|
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
|
||||||
@ -65,7 +70,7 @@ end
|
|||||||
|
|
||||||
workspace "re3"
|
workspace "re3"
|
||||||
language "C++"
|
language "C++"
|
||||||
configurations { "Debug", "Release", "Vanilla" }
|
configurations { "Debug", "Release" }
|
||||||
startproject "re3"
|
startproject "re3"
|
||||||
location "build"
|
location "build"
|
||||||
symbols "Full"
|
symbols "Full"
|
||||||
@ -77,6 +82,7 @@ workspace "re3"
|
|||||||
end
|
end
|
||||||
|
|
||||||
filter { "system:windows" }
|
filter { "system:windows" }
|
||||||
|
configurations { "Vanilla" }
|
||||||
platforms {
|
platforms {
|
||||||
"win-x86-RW33_d3d8-mss",
|
"win-x86-RW33_d3d8-mss",
|
||||||
"win-x86-librw_d3d9-mss",
|
"win-x86-librw_d3d9-mss",
|
||||||
@ -116,13 +122,10 @@ workspace "re3"
|
|||||||
filter "configurations:not Debug"
|
filter "configurations:not Debug"
|
||||||
defines { "NDEBUG" }
|
defines { "NDEBUG" }
|
||||||
optimize "Speed"
|
optimize "Speed"
|
||||||
if(_OPTIONS["lto"]) then
|
if(_OPTIONS["with-lto"]) then
|
||||||
flags { "LinkTimeOptimization" }
|
flags { "LinkTimeOptimization" }
|
||||||
end
|
end
|
||||||
|
|
||||||
filter "configurations:Vanilla"
|
|
||||||
defines { "VANILLA_DEFINES" }
|
|
||||||
|
|
||||||
filter { "platforms:win*" }
|
filter { "platforms:win*" }
|
||||||
system "windows"
|
system "windows"
|
||||||
|
|
||||||
@ -144,12 +147,18 @@ workspace "re3"
|
|||||||
filter { "platforms:*arm*" }
|
filter { "platforms:*arm*" }
|
||||||
architecture "ARM"
|
architecture "ARM"
|
||||||
|
|
||||||
filter { "platforms:macosx-arm64-*" }
|
filter { "platforms:macosx-arm64-*", "files:**.cpp"}
|
||||||
buildoptions { "-target", "arm64-apple-macos11", "-std=gnu++14" }
|
buildoptions { "-target", "arm64-apple-macos11", "-std=gnu++14" }
|
||||||
|
|
||||||
filter { "platforms:macosx-amd64-*" }
|
filter { "platforms:macosx-arm64-*", "files:**.c"}
|
||||||
|
buildoptions { "-target", "arm64-apple-macos11" }
|
||||||
|
|
||||||
|
filter { "platforms:macosx-amd64-*", "files:**.cpp"}
|
||||||
buildoptions { "-target", "x86_64-apple-macos10.12", "-std=gnu++14" }
|
buildoptions { "-target", "x86_64-apple-macos10.12", "-std=gnu++14" }
|
||||||
|
|
||||||
|
filter { "platforms:macosx-amd64-*", "files:**.c"}
|
||||||
|
buildoptions { "-target", "x86_64-apple-macos10.12" }
|
||||||
|
|
||||||
filter { "platforms:*librw_d3d9*" }
|
filter { "platforms:*librw_d3d9*" }
|
||||||
defines { "RW_D3D9" }
|
defines { "RW_D3D9" }
|
||||||
if(not _OPTIONS["with-librw"]) then
|
if(not _OPTIONS["with-librw"]) then
|
||||||
@ -158,7 +167,6 @@ workspace "re3"
|
|||||||
|
|
||||||
filter "platforms:*librw_gl3_glfw*"
|
filter "platforms:*librw_gl3_glfw*"
|
||||||
defines { "RW_GL3" }
|
defines { "RW_GL3" }
|
||||||
includedirs { path.join(_OPTIONS["glewdir"], "include") }
|
|
||||||
if(not _OPTIONS["with-librw"]) then
|
if(not _OPTIONS["with-librw"]) then
|
||||||
libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") }
|
libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") }
|
||||||
end
|
end
|
||||||
@ -169,9 +177,6 @@ workspace "re3"
|
|||||||
filter "platforms:*amd64-librw_gl3_glfw*"
|
filter "platforms:*amd64-librw_gl3_glfw*"
|
||||||
includedirs { path.join(_OPTIONS["glfwdir64"], "include") }
|
includedirs { path.join(_OPTIONS["glfwdir64"], "include") }
|
||||||
|
|
||||||
filter "platforms:win*librw_gl3_glfw*"
|
|
||||||
defines { "GLEW_STATIC" }
|
|
||||||
|
|
||||||
filter {}
|
filter {}
|
||||||
|
|
||||||
function setpaths (gamepath, exepath)
|
function setpaths (gamepath, exepath)
|
||||||
@ -196,6 +201,7 @@ project "librw"
|
|||||||
targetdir(path.join(Librw, "lib/%{cfg.platform}/%{cfg.buildcfg}"))
|
targetdir(path.join(Librw, "lib/%{cfg.platform}/%{cfg.buildcfg}"))
|
||||||
files { path.join(Librw, "src/*.*") }
|
files { path.join(Librw, "src/*.*") }
|
||||||
files { path.join(Librw, "src/*/*.*") }
|
files { path.join(Librw, "src/*/*.*") }
|
||||||
|
files { path.join(Librw, "src/gl/*/*.*") }
|
||||||
|
|
||||||
filter { "platforms:*x86*" }
|
filter { "platforms:*x86*" }
|
||||||
architecture "x86"
|
architecture "x86"
|
||||||
@ -204,6 +210,7 @@ project "librw"
|
|||||||
architecture "amd64"
|
architecture "amd64"
|
||||||
|
|
||||||
filter "platforms:win*"
|
filter "platforms:win*"
|
||||||
|
defines { "_CRT_SECURE_NO_WARNINGS", "_CRT_NONSTDC_NO_DEPRECATE" }
|
||||||
staticruntime "on"
|
staticruntime "on"
|
||||||
buildoptions { "/Zc:sizedDealloc-" }
|
buildoptions { "/Zc:sizedDealloc-" }
|
||||||
|
|
||||||
@ -211,8 +218,14 @@ project "librw"
|
|||||||
includedirs { "/usr/local/include" }
|
includedirs { "/usr/local/include" }
|
||||||
libdirs { "/usr/local/lib" }
|
libdirs { "/usr/local/lib" }
|
||||||
|
|
||||||
filter "platforms:macosx*"
|
|
||||||
-- Support MacPorts and Homebrew
|
-- Support MacPorts and Homebrew
|
||||||
|
filter "platforms:macosx-arm64-*"
|
||||||
|
includedirs { "/opt/local/include" }
|
||||||
|
includedirs {"/opt/homebrew/include" }
|
||||||
|
libdirs { "/opt/local/lib" }
|
||||||
|
libdirs { "/opt/homebrew/lib" }
|
||||||
|
|
||||||
|
filter "platforms:macosx-amd64-*"
|
||||||
includedirs { "/opt/local/include" }
|
includedirs { "/opt/local/include" }
|
||||||
includedirs {"/usr/local/include" }
|
includedirs {"/usr/local/include" }
|
||||||
libdirs { "/opt/local/lib" }
|
libdirs { "/opt/local/lib" }
|
||||||
@ -235,6 +248,10 @@ project "re3"
|
|||||||
targetname "re3"
|
targetname "re3"
|
||||||
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
|
targetdir "bin/%{cfg.platform}/%{cfg.buildcfg}"
|
||||||
|
|
||||||
|
if(_OPTIONS["with-librw"]) then
|
||||||
|
dependson "librw"
|
||||||
|
end
|
||||||
|
|
||||||
files { addSrcFiles("src") }
|
files { addSrcFiles("src") }
|
||||||
files { addSrcFiles("src/animation") }
|
files { addSrcFiles("src/animation") }
|
||||||
files { addSrcFiles("src/audio") }
|
files { addSrcFiles("src/audio") }
|
||||||
@ -249,7 +266,7 @@ project "re3"
|
|||||||
files { addSrcFiles("src/modelinfo") }
|
files { addSrcFiles("src/modelinfo") }
|
||||||
files { addSrcFiles("src/objects") }
|
files { addSrcFiles("src/objects") }
|
||||||
files { addSrcFiles("src/peds") }
|
files { addSrcFiles("src/peds") }
|
||||||
files { addSrcFiles("src/render") }
|
files { addSrcFiles("src/renderer") }
|
||||||
files { addSrcFiles("src/rw") }
|
files { addSrcFiles("src/rw") }
|
||||||
files { addSrcFiles("src/save") }
|
files { addSrcFiles("src/save") }
|
||||||
files { addSrcFiles("src/skel") }
|
files { addSrcFiles("src/skel") }
|
||||||
@ -258,6 +275,11 @@ project "re3"
|
|||||||
files { addSrcFiles("src/vehicles") }
|
files { addSrcFiles("src/vehicles") }
|
||||||
files { addSrcFiles("src/weapons") }
|
files { addSrcFiles("src/weapons") }
|
||||||
files { addSrcFiles("src/extras") }
|
files { addSrcFiles("src/extras") }
|
||||||
|
if(not _OPTIONS["no-git-hash"]) then
|
||||||
|
files { "src/extras/GitSHA1.cpp" } -- this won't be in repo in first build
|
||||||
|
else
|
||||||
|
removefiles { "src/extras/GitSHA1.cpp" } -- but it will be everytime after
|
||||||
|
end
|
||||||
|
|
||||||
includedirs { "src" }
|
includedirs { "src" }
|
||||||
includedirs { "src/animation" }
|
includedirs { "src/animation" }
|
||||||
@ -273,7 +295,7 @@ project "re3"
|
|||||||
includedirs { "src/modelinfo" }
|
includedirs { "src/modelinfo" }
|
||||||
includedirs { "src/objects" }
|
includedirs { "src/objects" }
|
||||||
includedirs { "src/peds" }
|
includedirs { "src/peds" }
|
||||||
includedirs { "src/render" }
|
includedirs { "src/renderer" }
|
||||||
includedirs { "src/rw" }
|
includedirs { "src/rw" }
|
||||||
includedirs { "src/save/" }
|
includedirs { "src/save/" }
|
||||||
includedirs { "src/skel/" }
|
includedirs { "src/skel/" }
|
||||||
@ -283,12 +305,19 @@ project "re3"
|
|||||||
includedirs { "src/weapons" }
|
includedirs { "src/weapons" }
|
||||||
includedirs { "src/extras" }
|
includedirs { "src/extras" }
|
||||||
|
|
||||||
|
if(not _OPTIONS["no-git-hash"]) then
|
||||||
|
defines { "USE_OUR_VERSIONING" }
|
||||||
|
end
|
||||||
|
|
||||||
if _OPTIONS["with-opus"] then
|
if _OPTIONS["with-opus"] then
|
||||||
includedirs { "vendor/ogg/include" }
|
includedirs { "vendor/ogg/include" }
|
||||||
includedirs { "vendor/opus/include" }
|
includedirs { "vendor/opus/include" }
|
||||||
includedirs { "vendor/opusfile/include" }
|
includedirs { "vendor/opusfile/include" }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
filter "configurations:Vanilla"
|
||||||
|
defines { "VANILLA_DEFINES" }
|
||||||
|
|
||||||
filter "platforms:*mss"
|
filter "platforms:*mss"
|
||||||
defines { "AUDIO_MSS" }
|
defines { "AUDIO_MSS" }
|
||||||
includedirs { "vendor/milessdk/include" }
|
includedirs { "vendor/milessdk/include" }
|
||||||
@ -308,7 +337,7 @@ project "re3"
|
|||||||
|
|
||||||
filter {}
|
filter {}
|
||||||
if(os.getenv("GTA_III_RE_DIR")) then
|
if(os.getenv("GTA_III_RE_DIR")) then
|
||||||
setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)")
|
setpaths(os.getenv("GTA_III_RE_DIR") .. "/", "%(cfg.buildtarget.name)")
|
||||||
end
|
end
|
||||||
|
|
||||||
filter "platforms:win*"
|
filter "platforms:win*"
|
||||||
@ -318,14 +347,39 @@ project "re3"
|
|||||||
linkoptions "/SAFESEH:NO"
|
linkoptions "/SAFESEH:NO"
|
||||||
characterset ("MBCS")
|
characterset ("MBCS")
|
||||||
targetextension ".exe"
|
targetextension ".exe"
|
||||||
|
if(_OPTIONS["no-full-paths"]) then
|
||||||
|
usefullpaths "off"
|
||||||
|
linkoptions "/PDBALTPATH:%_PDB%"
|
||||||
|
end
|
||||||
if(_OPTIONS["with-librw"]) then
|
if(_OPTIONS["with-librw"]) then
|
||||||
-- external librw is dynamic
|
-- external librw is dynamic
|
||||||
staticruntime "on"
|
staticruntime "on"
|
||||||
end
|
end
|
||||||
|
if(not _OPTIONS["no-git-hash"]) then
|
||||||
|
prebuildcommands { '"%{prj.location}..\\printHash.bat" "%{prj.location}..\\src\\extras\\GitSHA1.cpp"' }
|
||||||
|
end
|
||||||
|
|
||||||
|
filter "platforms:not win*"
|
||||||
|
if(not _OPTIONS["no-git-hash"]) then
|
||||||
|
prebuildcommands { '"%{prj.location}/../printHash.sh" "%{prj.location}/../src/extras/GitSHA1.cpp"' }
|
||||||
|
end
|
||||||
|
|
||||||
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" }
|
||||||
@ -349,6 +403,12 @@ project "re3"
|
|||||||
|
|
||||||
filter "platforms:macosx*oal"
|
filter "platforms:macosx*oal"
|
||||||
links { "openal", "mpg123", "sndfile", "pthread" }
|
links { "openal", "mpg123", "sndfile", "pthread" }
|
||||||
|
|
||||||
|
filter "platforms:macosx-arm64-*oal"
|
||||||
|
includedirs { "/opt/homebrew/opt/openal-soft/include" }
|
||||||
|
libdirs { "/opt/homebrew/opt/openal-soft/lib" }
|
||||||
|
|
||||||
|
filter "platforms:macosx-amd64-*oal"
|
||||||
includedirs { "/usr/local/opt/openal-soft/include" }
|
includedirs { "/usr/local/opt/openal-soft/include" }
|
||||||
libdirs { "/usr/local/opt/openal-soft/lib" }
|
libdirs { "/usr/local/opt/openal-soft/lib" }
|
||||||
|
|
||||||
@ -385,27 +445,33 @@ project "re3"
|
|||||||
libdirs { "sdk/dx8sdk/lib" }
|
libdirs { "sdk/dx8sdk/lib" }
|
||||||
|
|
||||||
filter "platforms:win-x86*gl3_glfw*"
|
filter "platforms:win-x86*gl3_glfw*"
|
||||||
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }
|
|
||||||
libdirs { path.join(_OPTIONS["glfwdir32"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) }
|
libdirs { path.join(_OPTIONS["glfwdir32"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) }
|
||||||
links { "opengl32", "glew32s", "glfw3" }
|
links { "opengl32", "glfw3" }
|
||||||
|
|
||||||
filter "platforms:win-amd64*gl3_glfw*"
|
filter "platforms:win-amd64*gl3_glfw*"
|
||||||
libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") }
|
|
||||||
libdirs { path.join(_OPTIONS["glfwdir64"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) }
|
libdirs { path.join(_OPTIONS["glfwdir64"], "lib-" .. string.gsub(_ACTION or '', "vs", "vc")) }
|
||||||
links { "opengl32", "glew32s", "glfw3" }
|
links { "opengl32", "glfw3" }
|
||||||
|
|
||||||
filter "platforms:linux*gl3_glfw*"
|
filter "platforms:linux*gl3_glfw*"
|
||||||
links { "GL", "GLEW", "glfw" }
|
links { "GL", "glfw" }
|
||||||
|
|
||||||
filter "platforms:bsd*gl3_glfw*"
|
filter "platforms:bsd*gl3_glfw*"
|
||||||
links { "GL", "GLEW", "glfw", "sysinfo" }
|
links { "GL", "glfw", "sysinfo" }
|
||||||
includedirs { "/usr/local/include" }
|
includedirs { "/usr/local/include" }
|
||||||
libdirs { "/usr/local/lib" }
|
libdirs { "/usr/local/lib" }
|
||||||
|
|
||||||
filter "platforms:macosx*gl3_glfw*"
|
filter "platforms:macosx-arm64-*gl3_glfw*"
|
||||||
links { "GLEW", "glfw" }
|
links { "glfw" }
|
||||||
linkoptions { "-framework OpenGL" }
|
linkoptions { "-framework OpenGL" }
|
||||||
includedirs { "/opt/local/include" }
|
includedirs { "/opt/local/include" }
|
||||||
includedirs { "/usr/local/include" }
|
includedirs {"/opt/homebrew/include" }
|
||||||
|
libdirs { "/opt/local/lib" }
|
||||||
|
libdirs { "/opt/homebrew/lib" }
|
||||||
|
|
||||||
|
filter "platforms:macosx-amd64-*gl3_glfw*"
|
||||||
|
links { "glfw" }
|
||||||
|
linkoptions { "-framework OpenGL" }
|
||||||
|
includedirs { "/opt/local/include" }
|
||||||
|
includedirs {"/usr/local/include" }
|
||||||
libdirs { "/opt/local/lib" }
|
libdirs { "/opt/local/lib" }
|
||||||
libdirs { "/usr/local/lib" }
|
libdirs { "/usr/local/lib" }
|
||||||
|
26
printHash.bat
Normal file
26
printHash.bat
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
REM creates version.h with HEAD commit hash
|
||||||
|
REM params: $1=full path to output file (usually points version.h)
|
||||||
|
|
||||||
|
setlocal enableextensions enabledelayedexpansion
|
||||||
|
|
||||||
|
cd /d "%~dp0"
|
||||||
|
|
||||||
|
break> %1
|
||||||
|
|
||||||
|
<nul set /p=^"#define GIT_SHA1 ^"^"> %1
|
||||||
|
|
||||||
|
where git
|
||||||
|
if "%errorlevel%" == "0" ( goto :havegit ) else ( goto :writeending )
|
||||||
|
|
||||||
|
:havegit
|
||||||
|
for /f %%v in ('git rev-parse --short HEAD') do set version=%%v
|
||||||
|
<nul set /p="%version%" >> %1
|
||||||
|
|
||||||
|
:writeending
|
||||||
|
|
||||||
|
echo ^" >> %1
|
||||||
|
echo const char* g_GIT_SHA1 = GIT_SHA1; >> %1
|
||||||
|
|
||||||
|
EXIT /B
|
14
printHash.sh
Executable file
14
printHash.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
if [ -z "${1}" ]
|
||||||
|
then
|
||||||
|
printf "%s\n" "Input the path to the file for writing the commit hash to."
|
||||||
|
else
|
||||||
|
printf "%s" "#define GIT_SHA1 \"" > $1
|
||||||
|
|
||||||
|
if (command -v "git" >/dev/null) then
|
||||||
|
git rev-parse --short HEAD | tr -d '\n' >> $1
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "%s\n" "\"" >> $1
|
||||||
|
printf "%s\n" "const char* g_GIT_SHA1 = GIT_SHA1;" >> $1
|
||||||
|
fi
|
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
BIN
res/images/logo_256.jpg
Normal file
BIN
res/images/logo_256.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -1,5 +1,5 @@
|
|||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
|
|
||||||
file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
|
file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
|
||||||
|
|
||||||
@ -17,6 +17,9 @@ endfunction()
|
|||||||
|
|
||||||
header_directories(${PROJECT}_INCLUDES)
|
header_directories(${PROJECT}_INCLUDES)
|
||||||
|
|
||||||
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/extras/GitSHA1.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/extras/GitSHA1.cpp" @ONLY)
|
||||||
|
list(APPEND ${PROJECT}_SOURCES "${CMAKE_CURRENT_BINARY_DIR}/extras/GitSHA1.cpp")
|
||||||
|
|
||||||
add_executable(${EXECUTABLE} WIN32
|
add_executable(${EXECUTABLE} WIN32
|
||||||
${${PROJECT}_SOURCES}
|
${${PROJECT}_SOURCES}
|
||||||
)
|
)
|
||||||
@ -36,7 +39,7 @@ target_compile_definitions(${EXECUTABLE}
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
|
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
|
||||||
LIBRW
|
LIBRW
|
||||||
${PROJECT}_NO_AUTOLINK
|
CMAKE_NO_AUTOLINK
|
||||||
)
|
)
|
||||||
|
|
||||||
if(LIBRW_PLATFORM_D3D9)
|
if(LIBRW_PLATFORM_D3D9)
|
||||||
@ -46,11 +49,18 @@ if(LIBRW_PLATFORM_D3D9)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE CMAKE_BUILD)
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE USE_OUR_VERSIONING)
|
||||||
|
|
||||||
if(${PROJECT}_AUDIO STREQUAL "OAL")
|
if(${PROJECT}_AUDIO STREQUAL "OAL")
|
||||||
find_package(OpenAL REQUIRED)
|
find_package(OpenAL REQUIRED)
|
||||||
|
if(TARGET OpenAL::OpenAL)
|
||||||
|
target_link_libraries(${EXECUTABLE} PRIVATE OpenAL::OpenAL)
|
||||||
|
else()
|
||||||
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
|
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
|
||||||
target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
|
target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
|
||||||
target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
|
target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
|
||||||
|
endif()
|
||||||
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
|
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
|
||||||
elseif(${PROJECT}_AUDIO STREQUAL "MSS")
|
elseif(${PROJECT}_AUDIO STREQUAL "MSS")
|
||||||
find_package(MilesSDK REQUIRED)
|
find_package(MilesSDK REQUIRED)
|
||||||
@ -114,13 +124,35 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NINTENDO_SWITCH)
|
||||||
|
set(${PROJECT}_C_CXX_EXTENSIONS ON)
|
||||||
|
else()
|
||||||
|
set(${PROJECT}_C_CXX_EXTENSIONS OFF)
|
||||||
|
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
|
||||||
C_EXTENSIONS OFF
|
C_EXTENSIONS ${${PROJECT}_C_CXX_EXTENSIONS}
|
||||||
C_STANDARD_REQUIRED ON
|
C_STANDARD_REQUIRED ON
|
||||||
CXX_STANDARD 11
|
CXX_STANDARD 11
|
||||||
CXX_EXTENSIONS OFF
|
CXX_EXTENSIONS ${${PROJECT}_C_CXX_EXTENSIONS}
|
||||||
CXX_STANDARD_REQUIRED ON
|
CXX_STANDARD_REQUIRED ON
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -134,3 +166,5 @@ if(${PROJECT}_INSTALL)
|
|||||||
install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
|
install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
re3_platform_target(${EXECUTABLE} INSTALL)
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
|
|
||||||
CAnimBlendLink link;
|
CAnimBlendLink link;
|
||||||
|
|
||||||
int numNodes; // taken from CAnimBlendClumpData::numFrames
|
int32 numNodes; // taken from CAnimBlendClumpData::numFrames
|
||||||
// NB: Order of these depends on order of nodes in Clump this was built from
|
// NB: Order of these depends on order of nodes in Clump this was built from
|
||||||
CAnimBlendNode *nodes;
|
CAnimBlendNode *nodes;
|
||||||
CAnimBlendHierarchy *hierarchy;
|
CAnimBlendHierarchy *hierarchy;
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "AnimBlendClumpData.h"
|
#include "AnimBlendClumpData.h"
|
||||||
#include "MemoryMgr.h"
|
#include "MemoryMgr.h"
|
||||||
|
|
||||||
|
|
||||||
CAnimBlendClumpData::CAnimBlendClumpData(void)
|
CAnimBlendClumpData::CAnimBlendClumpData(void)
|
||||||
{
|
{
|
||||||
numFrames = 0;
|
numFrames = 0;
|
||||||
|
@ -19,68 +19,68 @@ CAnimBlendAssocGroup *CAnimManager::ms_aAnimAssocGroups;
|
|||||||
CLinkList<CAnimBlendHierarchy*> CAnimManager::ms_animCache;
|
CLinkList<CAnimBlendHierarchy*> CAnimManager::ms_animCache;
|
||||||
|
|
||||||
AnimAssocDesc aStdAnimDescs[] = {
|
AnimAssocDesc aStdAnimDescs[] = {
|
||||||
{ ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
|
{ ANIM_STD_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
|
||||||
{ ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
|
{ ANIM_STD_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
|
||||||
{ ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
|
{ ANIM_STD_RUNFAST, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK },
|
||||||
{ ANIM_IDLE_STANCE, ASSOC_REPEAT },
|
{ ANIM_STD_IDLE, ASSOC_REPEAT },
|
||||||
{ ANIM_WALK_START, ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_STARTWALK, ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_RUN_STOP, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_RUNSTOP1, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_RUN_STOP_R, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_RUNSTOP2, ASSOC_DELETEFADEDOUT | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_IDLE_CAM, ASSOC_REPEAT | ASSOC_PARTIAL },
|
{ ANIM_STD_IDLE_CAM, ASSOC_REPEAT | ASSOC_PARTIAL },
|
||||||
{ ANIM_IDLE_HBHB, ASSOC_REPEAT | ASSOC_PARTIAL },
|
{ ANIM_STD_IDLE_HBHB, ASSOC_REPEAT | ASSOC_PARTIAL },
|
||||||
{ ANIM_IDLE_TIRED, ASSOC_REPEAT },
|
{ ANIM_STD_IDLE_TIRED, ASSOC_REPEAT },
|
||||||
{ ANIM_IDLE_ARMED, ASSOC_REPEAT | ASSOC_PARTIAL },
|
{ ANIM_STD_IDLE_BIGGUN, ASSOC_REPEAT | ASSOC_PARTIAL },
|
||||||
{ ANIM_IDLE_CHAT, ASSOC_REPEAT | ASSOC_PARTIAL },
|
{ ANIM_STD_CHAT, ASSOC_REPEAT | ASSOC_PARTIAL },
|
||||||
{ ANIM_IDLE_TAXI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_HAILTAXI, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_KO_SHOT_FRONT1, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
{ ANIM_STD_KO_FRONT, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SHOT_FRONT2, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
{ ANIM_STD_KO_LEFT, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SHOT_FRONT3, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
{ ANIM_STD_KO_BACK, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SHOT_FRONT4, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
{ ANIM_STD_KO_RIGHT, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SHOT_FACE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
{ ANIM_STD_KO_SHOT_FACE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SHOT_STOM, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_KO_SHOT_STOMACH, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_KO_SHOT_ARML, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
{ ANIM_STD_KO_SHOT_ARM_L, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SHOT_ARMR, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
{ ANIM_STD_KO_SHOT_ARM_R, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SHOT_LEGL, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_KO_SHOT_LEG_L, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_KO_SHOT_LEGR, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_KO_SHOT_LEG_R, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_KD_LEFT, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
{ ANIM_STD_SPINFORWARD_LEFT, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
||||||
{ ANIM_KD_RIGHT, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
{ ANIM_STD_SPINFORWARD_RIGHT, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SKID_FRONT, ASSOC_PARTIAL },
|
{ ANIM_STD_HIGHIMPACT_FRONT, ASSOC_PARTIAL },
|
||||||
{ ANIM_KO_SPIN_R, ASSOC_PARTIAL },
|
{ ANIM_STD_HIGHIMPACT_LEFT, ASSOC_PARTIAL },
|
||||||
{ ANIM_KO_SKID_BACK, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
{ ANIM_STD_HIGHIMPACT_BACK, ASSOC_PARTIAL | ASSOC_FRONTAL },
|
||||||
{ ANIM_KO_SPIN_L, ASSOC_PARTIAL },
|
{ ANIM_STD_HIGHIMPACT_RIGHT, ASSOC_PARTIAL },
|
||||||
{ ANIM_SHOT_FRONT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_HITBYGUN_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_SHOT_LEFT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_HITBYGUN_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_SHOT_BACK_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_HITBYGUN_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_SHOT_RIGHT_PARTIAL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_HITBYGUN_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_HIT_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HIT_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_HIT_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_HIT_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HIT_BACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_HIT_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_HIT_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FLOOR_HIT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_HIT_FLOOR, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
#if GTA_VERSION <= GTA3_PS2_160
|
#if GTA_VERSION <= GTA3_PS2_160
|
||||||
{ ANIM_HIT_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_HIT_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
#endif
|
#endif
|
||||||
{ ANIM_HIT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HIT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_HIT_CHEST, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HIT_CHEST, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_HIT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HIT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_HIT_WALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HIT_WALK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_HIT_WALL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HIT_WALL, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_FLOOR_HIT_F, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL },
|
{ ANIM_STD_HIT_FLOOR_FRONT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_FRONTAL },
|
||||||
{ ANIM_HIT_BEHIND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_HIT_BEHIND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_PUNCH_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_KICK_FLOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_KICKGROUND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_BAT_H, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_WEAPON_BAT_H, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_BAT_V, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_WEAPON_BAT_V, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_HGUN_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_WEAPON_HGUN_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_WEAPON_AK_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_WEAPON_AK_BODY, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_PUMP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_WEAPON_PUMP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_SNIPER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_WEAPON_SNIPER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_WEAPON_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_THROWU, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_THROW_UNDER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_START_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_START_THROW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_BOMBER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_DETONATE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_HGUN_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_HGUN_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_AK_RELOAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
#ifdef PC_PLAYER_CONTROLS
|
#ifdef PC_PLAYER_CONTROLS
|
||||||
// maybe wrong define, but unused anyway
|
// maybe wrong define, but unused anyway
|
||||||
{ ANIM_FPS_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_FPS_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
@ -91,121 +91,121 @@ AnimAssocDesc aStdAnimDescs[] = {
|
|||||||
{ ANIM_FPS_M16, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_FPS_M16, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FPS_ROCKET, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_FPS_ROCKET, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
#endif
|
#endif
|
||||||
{ ANIM_FIGHT_IDLE, ASSOC_REPEAT },
|
{ ANIM_STD_FIGHT_IDLE, ASSOC_REPEAT },
|
||||||
{ ANIM_FIGHT2_IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_FIGHT_2IDLE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FIGHT_SH_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_FIGHT_SHUFFLE_F, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_FIGHT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_FIGHT_BODYBLOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FIGHT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_FIGHT_HEAD, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FIGHT_KICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_FIGHT_KICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FIGHT_KNEE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_FIGHT_KNEE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FIGHT_LHOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_FIGHT_LHOOK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FIGHT_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_FIGHT_PUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_FIGHT_ROUNDHOUSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_FIGHT_ROUNDHOUSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_FIGHT_LONGKICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_FIGHT_LONGKICK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_FIGHT_PPUNCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_PARTIAL_PUNCH, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_CAR_JACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_JACKEDCAR_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_LJACKED_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_JACKEDCAR_LO_RHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_JACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_JACKEDCAR_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_LJACKED_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_JACKEDCAR_LO_LHS, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_QJACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_QUICKJACK, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_QJACKED, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_QUICKJACKED, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_ALIGN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_ALIGN_DOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_ALIGNHI_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_ALIGNHI_DOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_OPEN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_OPEN_DOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_DOORLOCKED_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CARDOOR_LOCKED_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_PULLOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_PULL_OUT_PED_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_PULLOUT_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_PULL_OUT_PED_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_GETIN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_GET_IN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_GETIN_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_GET_IN_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_CLOSEDOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_CLOSE_DOOR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_CLOSEDOOR_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_CLOSE_DOOR_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_ROLLDOOR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_ROLLDOOR_LOW, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_GETOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_GETOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_GETOUT_LOW_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_GETOUT_LO_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_CLOSE_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_CLOSE_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_ALIGN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_ALIGN_DOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_ALIGNHI_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_ALIGNHI_DOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_OPEN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_OPEN_DOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_DOORLOCKED_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CARDOOR_LOCKED_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_PULLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_PULL_OUT_PED_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_PULLOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_PULL_OUT_PED_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_GETIN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_GET_IN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_GETIN_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_GET_IN_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_CLOSEDOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_CLOSE_DOOR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_CLOSEDOOR_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_CLOSE_DOOR_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_SHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_SHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_LSHUFFLE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_SHUFFLE_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_SIT, ASSOC_DELETEFADEDOUT },
|
{ ANIM_STD_CAR_SIT, ASSOC_DELETEFADEDOUT },
|
||||||
{ ANIM_CAR_LSIT, ASSOC_DELETEFADEDOUT },
|
{ ANIM_STD_CAR_SIT_LO, ASSOC_DELETEFADEDOUT },
|
||||||
{ ANIM_CAR_SITP, ASSOC_DELETEFADEDOUT },
|
{ ANIM_STD_CAR_SIT_P, ASSOC_DELETEFADEDOUT },
|
||||||
{ ANIM_CAR_SITPLO, ASSOC_DELETEFADEDOUT },
|
{ ANIM_STD_CAR_SIT_P_LO, ASSOC_DELETEFADEDOUT },
|
||||||
{ ANIM_DRIVE_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_DRIVE_LEFT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_DRIVE_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_DRIVE_RIGHT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_DRIVE_LOW_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_DRIVE_LEFT_LO, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_DRIVE_LOW_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_DRIVE_RIGHT_LO, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_DRIVEBY_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_DRIVEBY_LEFT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_DRIVEBY_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_DRIVEBY_RIGHT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_LOOKBEHIND, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_DRIVE_BOAT, ASSOC_DELETEFADEDOUT },
|
{ ANIM_STD_BOAT_DRIVE, ASSOC_DELETEFADEDOUT },
|
||||||
{ ANIM_CAR_GETOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_GETOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_GETOUT_LOW_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_GETOUT_LO_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_CLOSE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_CLOSE_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_HOOKERTALK, ASSOC_REPEAT | ASSOC_PARTIAL },
|
{ ANIM_STD_CAR_HOOKERTALK, ASSOC_REPEAT | ASSOC_PARTIAL },
|
||||||
{ ANIM_COACH_OPEN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_COACH_OPEN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_COACH_OPEN_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_COACH_OPEN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_COACH_IN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_COACH_GET_IN_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_COACH_IN_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_COACH_GET_IN_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_COACH_OUT_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_COACH_GET_OUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_TRAIN_GETIN, ASSOC_PARTIAL },
|
{ ANIM_STD_TRAIN_GETIN, ASSOC_PARTIAL },
|
||||||
{ ANIM_TRAIN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_TRAIN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_CRAWLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CRAWLOUT_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_CAR_CRAWLOUT_RHS2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_CRAWLOUT_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_VAN_OPEN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_VAN_OPEN_DOOR_REAR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_VAN_GETIN_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_VAN_GET_IN_REAR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_VAN_CLOSE_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_VAN_CLOSE_DOOR_REAR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_VAN_GETOUT_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_VAN_GET_OUT_REAR_LHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_VAN_OPEN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_VAN_OPEN_DOOR_REAR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_VAN_GETIN, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_VAN_GET_IN_REAR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_VAN_CLOSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_VAN_CLOSE_DOOR_REAR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_VAN_GETOUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_VAN_GET_OUT_REAR_RHS, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_GETUP1, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_GET_UP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_GETUP2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_GET_UP_LEFT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_GETUP3, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_GET_UP_RIGHT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_GETUP_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_GET_UP_FRONT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_JUMP_LAUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_JUMP_LAUNCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_JUMP_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_JUMP_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_JUMP_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_JUMP_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_FALL_FALL, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_FALL, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_FALL_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_FALL_GLIDE, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_FALL_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_FALL_LAND, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_FALL_COLLAPSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_FALL_COLLAPSE, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_EV_STEP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_EVADE_STEP, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_EV_DIVE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
{ ANIM_STD_EVADE_DIVE, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION | ASSOC_FRONTAL },
|
||||||
{ ANIM_XPRESS_SCRATCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE },
|
{ ANIM_STD_XPRESS_SCRATCH, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_IDLE },
|
||||||
{ ANIM_ROAD_CROSS, ASSOC_REPEAT | ASSOC_PARTIAL },
|
{ ANIM_STD_ROADCROSS, ASSOC_REPEAT | ASSOC_PARTIAL },
|
||||||
{ ANIM_TURN_180, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_TURN180, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_ARREST_GUN, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_ARREST, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_DROWN, ASSOC_PARTIAL },
|
{ ANIM_STD_DROWN, ASSOC_PARTIAL },
|
||||||
{ ANIM_CPR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_MEDIC_CPR, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_DUCK_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_DUCK_DOWN, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_DUCK_LOW, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_DUCK_LOW, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_RBLOCK_CSHOOT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_RBLOCK_SHOOT, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
{ ANIM_WEAPON_THROWU2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_THROW_UNDER2, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_HANDSUP, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HANDSUP, ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_HANDSCOWER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
{ ANIM_STD_HANDSCOWER, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_HAS_TRANSLATION },
|
||||||
{ ANIM_FUCKU, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
{ ANIM_STD_PARTIAL_FUCKU, ASSOC_DELETEFADEDOUT | ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL | ASSOC_NOWALK },
|
||||||
{ ANIM_PHONE_IN, ASSOC_PARTIAL },
|
{ ANIM_STD_PHONE_IN, ASSOC_PARTIAL },
|
||||||
{ ANIM_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
{ ANIM_STD_PHONE_OUT, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
|
||||||
{ ANIM_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
{ ANIM_STD_PHONE_TALK, ASSOC_REPEAT | ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL },
|
||||||
};
|
};
|
||||||
#ifdef PC_PLAYER_CONTROLS
|
#ifdef PC_PLAYER_CONTROLS
|
||||||
AnimAssocDesc aStdAnimDescsSide[] = {
|
AnimAssocDesc aStdAnimDescsSide[] = {
|
||||||
{ ANIM_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
|
{ ANIM_STD_WALK, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
|
||||||
{ ANIM_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
|
{ ANIM_STD_RUN, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
|
||||||
{ ANIM_SPRINT, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
|
{ ANIM_STD_RUNFAST, ASSOC_REPEAT | ASSOC_MOVEMENT | ASSOC_HAS_TRANSLATION | ASSOC_WALK | ASSOC_HAS_X_TRANSLATION },
|
||||||
{ ANIM_IDLE_STANCE, ASSOC_REPEAT },
|
{ ANIM_STD_IDLE, ASSOC_REPEAT },
|
||||||
{ ANIM_WALK_START, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
|
{ ANIM_STD_STARTWALK, ASSOC_HAS_TRANSLATION | ASSOC_HAS_X_TRANSLATION },
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
char const *aStdAnimations[] = {
|
char const *aStdAnimations[] = {
|
||||||
|
@ -2,68 +2,82 @@
|
|||||||
|
|
||||||
enum AnimationId
|
enum AnimationId
|
||||||
{
|
{
|
||||||
ANIM_WALK,
|
ANIM_STD_WALK,
|
||||||
ANIM_RUN,
|
ANIM_STD_RUN,
|
||||||
ANIM_SPRINT,
|
ANIM_STD_RUNFAST,
|
||||||
ANIM_IDLE_STANCE,
|
ANIM_STD_IDLE,
|
||||||
ANIM_WALK_START,
|
ANIM_STD_STARTWALK,
|
||||||
ANIM_RUN_STOP,
|
ANIM_STD_RUNSTOP1,
|
||||||
ANIM_RUN_STOP_R,
|
ANIM_STD_RUNSTOP2,
|
||||||
ANIM_IDLE_CAM,
|
ANIM_STD_IDLE_CAM,
|
||||||
ANIM_IDLE_HBHB,
|
ANIM_STD_IDLE_HBHB,
|
||||||
ANIM_IDLE_TIRED,
|
ANIM_STD_IDLE_TIRED,
|
||||||
ANIM_IDLE_ARMED,
|
ANIM_STD_IDLE_BIGGUN,
|
||||||
ANIM_IDLE_CHAT,
|
ANIM_STD_CHAT,
|
||||||
ANIM_IDLE_TAXI,
|
ANIM_STD_HAILTAXI,
|
||||||
ANIM_KO_SHOT_FRONT1,
|
ANIM_STD_KO_FRONT,
|
||||||
ANIM_KO_SHOT_FRONT2,
|
ANIM_STD_KO_LEFT,
|
||||||
ANIM_KO_SHOT_FRONT3,
|
ANIM_STD_KO_BACK,
|
||||||
ANIM_KO_SHOT_FRONT4,
|
ANIM_STD_KO_RIGHT,
|
||||||
ANIM_KO_SHOT_FACE,
|
ANIM_STD_KO_SHOT_FACE,
|
||||||
ANIM_KO_SHOT_STOM,
|
ANIM_STD_KO_SHOT_STOMACH,
|
||||||
ANIM_KO_SHOT_ARML,
|
ANIM_STD_KO_SHOT_ARM_L,
|
||||||
ANIM_KO_SHOT_ARMR,
|
ANIM_STD_KO_SHOT_ARM_R,
|
||||||
ANIM_KO_SHOT_LEGL,
|
ANIM_STD_KO_SHOT_LEG_L,
|
||||||
ANIM_KO_SHOT_LEGR,
|
ANIM_STD_KO_SHOT_LEG_R,
|
||||||
ANIM_KD_LEFT,
|
ANIM_STD_SPINFORWARD_LEFT,
|
||||||
ANIM_KD_RIGHT,
|
ANIM_STD_SPINFORWARD_RIGHT,
|
||||||
ANIM_KO_SKID_FRONT,
|
ANIM_STD_HIGHIMPACT_FRONT,
|
||||||
ANIM_KO_SPIN_R, // named left in VC
|
ANIM_STD_HIGHIMPACT_LEFT,
|
||||||
ANIM_KO_SKID_BACK,
|
ANIM_STD_HIGHIMPACT_BACK,
|
||||||
ANIM_KO_SPIN_L, // named right in VC
|
ANIM_STD_HIGHIMPACT_RIGHT,
|
||||||
ANIM_SHOT_FRONT_PARTIAL,
|
ANIM_STD_HITBYGUN_FRONT,
|
||||||
ANIM_SHOT_LEFT_PARTIAL,
|
ANIM_STD_HITBYGUN_LEFT,
|
||||||
ANIM_SHOT_BACK_PARTIAL,
|
ANIM_STD_HITBYGUN_BACK,
|
||||||
ANIM_SHOT_RIGHT_PARTIAL,
|
ANIM_STD_HITBYGUN_RIGHT,
|
||||||
ANIM_HIT_FRONT,
|
ANIM_STD_HIT_FRONT,
|
||||||
ANIM_HIT_LEFT,
|
ANIM_STD_HIT_LEFT,
|
||||||
ANIM_HIT_BACK,
|
ANIM_STD_HIT_BACK,
|
||||||
ANIM_HIT_RIGHT,
|
ANIM_STD_HIT_RIGHT,
|
||||||
ANIM_FLOOR_HIT,
|
ANIM_STD_HIT_FLOOR,
|
||||||
|
|
||||||
|
/* names made up */
|
||||||
#if GTA_VERSION <= GTA3_PS2_160
|
#if GTA_VERSION <= GTA3_PS2_160
|
||||||
ANIM_HIT_BODY,
|
ANIM_STD_HIT_BODY,
|
||||||
#endif
|
#endif
|
||||||
ANIM_HIT_BODYBLOW,
|
ANIM_STD_HIT_BODYBLOW,
|
||||||
ANIM_HIT_CHEST,
|
ANIM_STD_HIT_CHEST,
|
||||||
ANIM_HIT_HEAD,
|
ANIM_STD_HIT_HEAD,
|
||||||
ANIM_HIT_WALK,
|
ANIM_STD_HIT_WALK,
|
||||||
ANIM_HIT_WALL,
|
/**/
|
||||||
ANIM_FLOOR_HIT_F,
|
|
||||||
ANIM_HIT_BEHIND,
|
ANIM_STD_HIT_WALL,
|
||||||
ANIM_PUNCH_R,
|
ANIM_STD_HIT_FLOOR_FRONT,
|
||||||
ANIM_KICK_FLOOR,
|
ANIM_STD_HIT_BEHIND,
|
||||||
ANIM_WEAPON_BAT_H,
|
ANIM_STD_PUNCH,
|
||||||
ANIM_WEAPON_BAT_V,
|
ANIM_STD_KICKGROUND,
|
||||||
ANIM_WEAPON_HGUN_BODY,
|
|
||||||
ANIM_WEAPON_AK_BODY,
|
/* names made up */
|
||||||
ANIM_WEAPON_PUMP,
|
ANIM_STD_WEAPON_BAT_H,
|
||||||
ANIM_WEAPON_SNIPER,
|
ANIM_STD_WEAPON_BAT_V,
|
||||||
ANIM_WEAPON_THROW,
|
ANIM_STD_WEAPON_HGUN_BODY,
|
||||||
ANIM_WEAPON_THROWU,
|
ANIM_STD_WEAPON_AK_BODY,
|
||||||
ANIM_WEAPON_START_THROW,
|
ANIM_STD_WEAPON_PUMP,
|
||||||
ANIM_BOMBER,
|
ANIM_STD_WEAPON_SNIPER,
|
||||||
ANIM_HGUN_RELOAD,
|
ANIM_STD_WEAPON_THROW,
|
||||||
ANIM_AK_RELOAD,
|
/**/
|
||||||
|
|
||||||
|
ANIM_STD_THROW_UNDER,
|
||||||
|
|
||||||
|
/* names made up */
|
||||||
|
ANIM_STD_START_THROW,
|
||||||
|
/**/
|
||||||
|
|
||||||
|
ANIM_STD_DETONATE,
|
||||||
|
|
||||||
|
/* names made up */
|
||||||
|
ANIM_STD_HGUN_RELOAD,
|
||||||
|
ANIM_STD_AK_RELOAD,
|
||||||
#ifdef PC_PLAYER_CONTROLS
|
#ifdef PC_PLAYER_CONTROLS
|
||||||
// maybe wrong define, but unused anyway
|
// maybe wrong define, but unused anyway
|
||||||
ANIM_FPS_PUNCH,
|
ANIM_FPS_PUNCH,
|
||||||
@ -74,113 +88,123 @@ enum AnimationId
|
|||||||
ANIM_FPS_M16,
|
ANIM_FPS_M16,
|
||||||
ANIM_FPS_ROCKET,
|
ANIM_FPS_ROCKET,
|
||||||
#endif
|
#endif
|
||||||
ANIM_FIGHT_IDLE,
|
/**/
|
||||||
ANIM_FIGHT2_IDLE,
|
|
||||||
ANIM_FIGHT_SH_F,
|
|
||||||
ANIM_FIGHT_BODYBLOW,
|
|
||||||
ANIM_FIGHT_HEAD,
|
|
||||||
ANIM_FIGHT_KICK,
|
|
||||||
ANIM_FIGHT_KNEE,
|
|
||||||
ANIM_FIGHT_LHOOK,
|
|
||||||
ANIM_FIGHT_PUNCH,
|
|
||||||
ANIM_FIGHT_ROUNDHOUSE,
|
|
||||||
ANIM_FIGHT_LONGKICK,
|
|
||||||
ANIM_FIGHT_PPUNCH,
|
|
||||||
ANIM_CAR_JACKED_RHS,
|
|
||||||
ANIM_CAR_LJACKED_RHS,
|
|
||||||
ANIM_CAR_JACKED_LHS,
|
|
||||||
ANIM_CAR_LJACKED_LHS,
|
|
||||||
ANIM_CAR_QJACK,
|
|
||||||
ANIM_CAR_QJACKED,
|
|
||||||
ANIM_CAR_ALIGN_LHS,
|
|
||||||
ANIM_CAR_ALIGNHI_LHS,
|
|
||||||
ANIM_CAR_OPEN_LHS,
|
|
||||||
ANIM_CAR_DOORLOCKED_LHS,
|
|
||||||
ANIM_CAR_PULLOUT_LHS,
|
|
||||||
ANIM_CAR_PULLOUT_LOW_LHS,
|
|
||||||
ANIM_CAR_GETIN_LHS,
|
|
||||||
ANIM_CAR_GETIN_LOW_LHS,
|
|
||||||
ANIM_CAR_CLOSEDOOR_LHS,
|
|
||||||
ANIM_CAR_CLOSEDOOR_LOW_LHS,
|
|
||||||
ANIM_CAR_ROLLDOOR,
|
|
||||||
ANIM_CAR_ROLLDOOR_LOW,
|
|
||||||
ANIM_CAR_GETOUT_LHS,
|
|
||||||
ANIM_CAR_GETOUT_LOW_LHS,
|
|
||||||
ANIM_CAR_CLOSE_LHS,
|
|
||||||
ANIM_CAR_ALIGN_RHS,
|
|
||||||
ANIM_CAR_ALIGNHI_RHS,
|
|
||||||
ANIM_CAR_OPEN_RHS,
|
|
||||||
ANIM_CAR_DOORLOCKED_RHS,
|
|
||||||
ANIM_CAR_PULLOUT_RHS,
|
|
||||||
ANIM_CAR_PULLOUT_LOW_RHS,
|
|
||||||
ANIM_CAR_GETIN_RHS,
|
|
||||||
ANIM_CAR_GETIN_LOW_RHS,
|
|
||||||
ANIM_CAR_CLOSEDOOR_RHS,
|
|
||||||
ANIM_CAR_CLOSEDOOR_LOW_RHS,
|
|
||||||
ANIM_CAR_SHUFFLE_RHS,
|
|
||||||
ANIM_CAR_LSHUFFLE_RHS,
|
|
||||||
ANIM_CAR_SIT,
|
|
||||||
ANIM_CAR_LSIT,
|
|
||||||
ANIM_CAR_SITP,
|
|
||||||
ANIM_CAR_SITPLO,
|
|
||||||
ANIM_DRIVE_L,
|
|
||||||
ANIM_DRIVE_R,
|
|
||||||
ANIM_DRIVE_LOW_L,
|
|
||||||
ANIM_DRIVE_LOW_R,
|
|
||||||
ANIM_DRIVEBY_L,
|
|
||||||
ANIM_DRIVEBY_R,
|
|
||||||
ANIM_CAR_LB,
|
|
||||||
ANIM_DRIVE_BOAT,
|
|
||||||
ANIM_CAR_GETOUT_RHS,
|
|
||||||
ANIM_CAR_GETOUT_LOW_RHS,
|
|
||||||
ANIM_CAR_CLOSE_RHS,
|
|
||||||
ANIM_CAR_HOOKERTALK,
|
|
||||||
ANIM_COACH_OPEN_L,
|
|
||||||
ANIM_COACH_OPEN_R,
|
|
||||||
ANIM_COACH_IN_L,
|
|
||||||
ANIM_COACH_IN_R,
|
|
||||||
ANIM_COACH_OUT_L,
|
|
||||||
ANIM_TRAIN_GETIN,
|
|
||||||
ANIM_TRAIN_GETOUT,
|
|
||||||
ANIM_CAR_CRAWLOUT_RHS,
|
|
||||||
ANIM_CAR_CRAWLOUT_RHS2,
|
|
||||||
ANIM_VAN_OPEN_L,
|
|
||||||
ANIM_VAN_GETIN_L,
|
|
||||||
ANIM_VAN_CLOSE_L,
|
|
||||||
ANIM_VAN_GETOUT_L,
|
|
||||||
ANIM_VAN_OPEN,
|
|
||||||
ANIM_VAN_GETIN,
|
|
||||||
ANIM_VAN_CLOSE,
|
|
||||||
ANIM_VAN_GETOUT,
|
|
||||||
ANIM_GETUP1,
|
|
||||||
ANIM_GETUP2,
|
|
||||||
ANIM_GETUP3,
|
|
||||||
ANIM_GETUP_FRONT,
|
|
||||||
ANIM_JUMP_LAUNCH,
|
|
||||||
ANIM_JUMP_GLIDE,
|
|
||||||
ANIM_JUMP_LAND,
|
|
||||||
ANIM_FALL_FALL,
|
|
||||||
ANIM_FALL_GLIDE,
|
|
||||||
ANIM_FALL_LAND,
|
|
||||||
ANIM_FALL_COLLAPSE,
|
|
||||||
ANIM_EV_STEP,
|
|
||||||
ANIM_EV_DIVE,
|
|
||||||
ANIM_XPRESS_SCRATCH,
|
|
||||||
ANIM_ROAD_CROSS,
|
|
||||||
ANIM_TURN_180,
|
|
||||||
ANIM_ARREST_GUN,
|
|
||||||
ANIM_DROWN,
|
|
||||||
ANIM_CPR,
|
|
||||||
ANIM_DUCK_DOWN,
|
|
||||||
ANIM_DUCK_LOW,
|
|
||||||
ANIM_RBLOCK_CSHOOT,
|
|
||||||
ANIM_WEAPON_THROWU2,
|
|
||||||
ANIM_HANDSUP,
|
|
||||||
ANIM_HANDSCOWER,
|
|
||||||
ANIM_FUCKU,
|
|
||||||
ANIM_PHONE_IN,
|
|
||||||
ANIM_PHONE_OUT,
|
|
||||||
ANIM_PHONE_TALK,
|
|
||||||
|
|
||||||
NUM_ANIMS
|
ANIM_STD_FIGHT_IDLE,
|
||||||
|
ANIM_STD_FIGHT_2IDLE,
|
||||||
|
ANIM_STD_FIGHT_SHUFFLE_F,
|
||||||
|
|
||||||
|
/* names made up */
|
||||||
|
ANIM_STD_FIGHT_BODYBLOW,
|
||||||
|
ANIM_STD_FIGHT_HEAD,
|
||||||
|
ANIM_STD_FIGHT_KICK,
|
||||||
|
ANIM_STD_FIGHT_KNEE,
|
||||||
|
ANIM_STD_FIGHT_LHOOK,
|
||||||
|
ANIM_STD_FIGHT_PUNCH,
|
||||||
|
ANIM_STD_FIGHT_ROUNDHOUSE,
|
||||||
|
ANIM_STD_FIGHT_LONGKICK,
|
||||||
|
/**/
|
||||||
|
|
||||||
|
ANIM_STD_PARTIAL_PUNCH,
|
||||||
|
ANIM_STD_JACKEDCAR_RHS,
|
||||||
|
ANIM_STD_JACKEDCAR_LO_RHS,
|
||||||
|
ANIM_STD_JACKEDCAR_LHS,
|
||||||
|
ANIM_STD_JACKEDCAR_LO_LHS,
|
||||||
|
ANIM_STD_QUICKJACK,
|
||||||
|
ANIM_STD_QUICKJACKED,
|
||||||
|
ANIM_STD_CAR_ALIGN_DOOR_LHS,
|
||||||
|
ANIM_STD_CAR_ALIGNHI_DOOR_LHS,
|
||||||
|
ANIM_STD_CAR_OPEN_DOOR_LHS,
|
||||||
|
ANIM_STD_CARDOOR_LOCKED_LHS,
|
||||||
|
ANIM_STD_CAR_PULL_OUT_PED_LHS,
|
||||||
|
ANIM_STD_CAR_PULL_OUT_PED_LO_LHS,
|
||||||
|
ANIM_STD_CAR_GET_IN_LHS,
|
||||||
|
ANIM_STD_CAR_GET_IN_LO_LHS,
|
||||||
|
ANIM_STD_CAR_CLOSE_DOOR_LHS,
|
||||||
|
ANIM_STD_CAR_CLOSE_DOOR_LO_LHS,
|
||||||
|
ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LHS,
|
||||||
|
ANIM_STD_CAR_CLOSE_DOOR_ROLLING_LO_LHS,
|
||||||
|
ANIM_STD_GETOUT_LHS,
|
||||||
|
ANIM_STD_GETOUT_LO_LHS,
|
||||||
|
ANIM_STD_CAR_CLOSE_LHS,
|
||||||
|
ANIM_STD_CAR_ALIGN_DOOR_RHS,
|
||||||
|
ANIM_STD_CAR_ALIGNHI_DOOR_RHS,
|
||||||
|
ANIM_STD_CAR_OPEN_DOOR_RHS,
|
||||||
|
ANIM_STD_CARDOOR_LOCKED_RHS,
|
||||||
|
ANIM_STD_CAR_PULL_OUT_PED_RHS,
|
||||||
|
ANIM_STD_CAR_PULL_OUT_PED_LO_RHS,
|
||||||
|
ANIM_STD_CAR_GET_IN_RHS,
|
||||||
|
ANIM_STD_CAR_GET_IN_LO_RHS,
|
||||||
|
ANIM_STD_CAR_CLOSE_DOOR_RHS,
|
||||||
|
ANIM_STD_CAR_CLOSE_DOOR_LO_RHS,
|
||||||
|
ANIM_STD_CAR_SHUFFLE_RHS,
|
||||||
|
ANIM_STD_CAR_SHUFFLE_LO_RHS,
|
||||||
|
ANIM_STD_CAR_SIT,
|
||||||
|
ANIM_STD_CAR_SIT_LO,
|
||||||
|
ANIM_STD_CAR_SIT_P,
|
||||||
|
ANIM_STD_CAR_SIT_P_LO,
|
||||||
|
ANIM_STD_CAR_DRIVE_LEFT,
|
||||||
|
ANIM_STD_CAR_DRIVE_RIGHT,
|
||||||
|
ANIM_STD_CAR_DRIVE_LEFT_LO,
|
||||||
|
ANIM_STD_CAR_DRIVE_RIGHT_LO,
|
||||||
|
ANIM_STD_CAR_DRIVEBY_LEFT,
|
||||||
|
ANIM_STD_CAR_DRIVEBY_RIGHT,
|
||||||
|
ANIM_STD_CAR_LOOKBEHIND,
|
||||||
|
ANIM_STD_BOAT_DRIVE,
|
||||||
|
ANIM_STD_GETOUT_RHS,
|
||||||
|
ANIM_STD_GETOUT_LO_RHS,
|
||||||
|
ANIM_STD_CAR_CLOSE_RHS,
|
||||||
|
ANIM_STD_CAR_HOOKERTALK,
|
||||||
|
ANIM_STD_COACH_OPEN_LHS,
|
||||||
|
ANIM_STD_COACH_OPEN_RHS,
|
||||||
|
ANIM_STD_COACH_GET_IN_LHS,
|
||||||
|
ANIM_STD_COACH_GET_IN_RHS,
|
||||||
|
ANIM_STD_COACH_GET_OUT_LHS,
|
||||||
|
ANIM_STD_TRAIN_GETIN,
|
||||||
|
ANIM_STD_TRAIN_GETOUT,
|
||||||
|
ANIM_STD_CRAWLOUT_LHS,
|
||||||
|
ANIM_STD_CRAWLOUT_RHS,
|
||||||
|
ANIM_STD_VAN_OPEN_DOOR_REAR_LHS,
|
||||||
|
ANIM_STD_VAN_GET_IN_REAR_LHS,
|
||||||
|
ANIM_STD_VAN_CLOSE_DOOR_REAR_LHS,
|
||||||
|
ANIM_STD_VAN_GET_OUT_REAR_LHS,
|
||||||
|
ANIM_STD_VAN_OPEN_DOOR_REAR_RHS,
|
||||||
|
ANIM_STD_VAN_GET_IN_REAR_RHS,
|
||||||
|
ANIM_STD_VAN_CLOSE_DOOR_REAR_RHS,
|
||||||
|
ANIM_STD_VAN_GET_OUT_REAR_RHS,
|
||||||
|
ANIM_STD_GET_UP,
|
||||||
|
ANIM_STD_GET_UP_LEFT,
|
||||||
|
ANIM_STD_GET_UP_RIGHT,
|
||||||
|
ANIM_STD_GET_UP_FRONT,
|
||||||
|
ANIM_STD_JUMP_LAUNCH,
|
||||||
|
ANIM_STD_JUMP_GLIDE,
|
||||||
|
ANIM_STD_JUMP_LAND,
|
||||||
|
ANIM_STD_FALL,
|
||||||
|
ANIM_STD_FALL_GLIDE,
|
||||||
|
ANIM_STD_FALL_LAND,
|
||||||
|
ANIM_STD_FALL_COLLAPSE,
|
||||||
|
ANIM_STD_EVADE_STEP,
|
||||||
|
ANIM_STD_EVADE_DIVE,
|
||||||
|
ANIM_STD_XPRESS_SCRATCH,
|
||||||
|
ANIM_STD_ROADCROSS,
|
||||||
|
ANIM_STD_TURN180,
|
||||||
|
ANIM_STD_ARREST,
|
||||||
|
ANIM_STD_DROWN,
|
||||||
|
ANIM_MEDIC_CPR,
|
||||||
|
ANIM_STD_DUCK_DOWN,
|
||||||
|
ANIM_STD_DUCK_LOW,
|
||||||
|
ANIM_STD_RBLOCK_SHOOT,
|
||||||
|
|
||||||
|
/* names made up */
|
||||||
|
ANIM_STD_THROW_UNDER2,
|
||||||
|
/**/
|
||||||
|
|
||||||
|
ANIM_STD_HANDSUP,
|
||||||
|
ANIM_STD_HANDSCOWER,
|
||||||
|
ANIM_STD_PARTIAL_FUCKU,
|
||||||
|
ANIM_STD_PHONE_IN,
|
||||||
|
ANIM_STD_PHONE_OUT,
|
||||||
|
ANIM_STD_PHONE_TALK,
|
||||||
|
|
||||||
|
ANIM_STD_NUM
|
||||||
};
|
};
|
@ -10,20 +10,39 @@
|
|||||||
|
|
||||||
const int CollisionSoundIntensity = 60;
|
const int CollisionSoundIntensity = 60;
|
||||||
|
|
||||||
cAudioCollisionManager::cAudioCollisionManager()
|
void
|
||||||
|
cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
|
||||||
|
float velocity)
|
||||||
{
|
{
|
||||||
m_sQueue.m_pEntity1 = nil;
|
float distSquared;
|
||||||
m_sQueue.m_pEntity2 = nil;
|
CVector v1;
|
||||||
m_sQueue.m_bSurface1 = SURFACE_DEFAULT;
|
CVector v2;
|
||||||
m_sQueue.m_bSurface2 = SURFACE_DEFAULT;
|
|
||||||
m_sQueue.m_fIntensity2 = 0.0f;
|
|
||||||
m_sQueue.m_fIntensity1 = 0.0f;
|
|
||||||
m_sQueue.m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
|
||||||
|
|
||||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
|
||||||
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
(velocity < 0.0016f && collisionPower < 0.01f))
|
||||||
|
return;
|
||||||
|
|
||||||
m_bCollisionsInQueue = 0;
|
if(entity1->IsBuilding()) {
|
||||||
|
v1 = v2 = entity2->GetPosition();
|
||||||
|
} else if(entity2->IsBuilding()) {
|
||||||
|
v1 = v2 = entity1->GetPosition();
|
||||||
|
} else {
|
||||||
|
v1 = entity1->GetPosition();
|
||||||
|
v2 = entity2->GetPosition();
|
||||||
|
}
|
||||||
|
CVector pos = (v1 + v2) * 0.5f;
|
||||||
|
distSquared = GetDistanceSquared(pos);
|
||||||
|
if(distSquared < SQR(CollisionSoundIntensity)) {
|
||||||
|
m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
|
||||||
|
m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
|
||||||
|
m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
|
||||||
|
m_sCollisionManager.m_sQueue.m_bSurface2 = surface2;
|
||||||
|
m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower;
|
||||||
|
m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity;
|
||||||
|
m_sCollisionManager.m_sQueue.m_vecPosition = pos;
|
||||||
|
m_sCollisionManager.m_sQueue.m_fDistance = distSquared;
|
||||||
|
m_sCollisionManager.AddCollisionToRequestedQueue();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -55,136 +74,71 @@ cAudioCollisionManager::AddCollisionToRequestedQueue()
|
|||||||
m_bIndicesTable[i] = collisionsIndex;
|
m_bIndicesTable[i] = collisionsIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
float
|
|
||||||
cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const
|
|
||||||
{
|
|
||||||
return GetCollisionRatio(c, 0.0f, 0.02f, 0.02f);
|
|
||||||
}
|
|
||||||
|
|
||||||
float
|
|
||||||
cAudioManager::GetCollisionOneShotRatio(int32 a, float b) const
|
|
||||||
{
|
|
||||||
float result;
|
|
||||||
|
|
||||||
switch(a) {
|
|
||||||
case SURFACE_DEFAULT:
|
|
||||||
case SURFACE_TARMAC:
|
|
||||||
case SURFACE_PAVEMENT:
|
|
||||||
case SURFACE_STEEP_CLIFF:
|
|
||||||
case SURFACE_TRANSPARENT_STONE: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break;
|
|
||||||
case SURFACE_GRASS:
|
|
||||||
case SURFACE_CARDBOARDBOX: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
|
|
||||||
case SURFACE_GRAVEL: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
|
|
||||||
case SURFACE_MUD_DRY: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
|
|
||||||
case SURFACE_CAR: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break;
|
|
||||||
case SURFACE_GLASS: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
|
|
||||||
case SURFACE_TRANSPARENT_CLOTH:
|
|
||||||
case SURFACE_THICK_METAL_PLATE: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break;
|
|
||||||
case SURFACE_GARAGE_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break;
|
|
||||||
case SURFACE_CAR_PANEL: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break;
|
|
||||||
case SURFACE_SCAFFOLD_POLE:
|
|
||||||
case SURFACE_METAL_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
|
|
||||||
case SURFACE_LAMP_POST: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
|
|
||||||
case SURFACE_FIRE_HYDRANT: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break;
|
|
||||||
case SURFACE_GIRDER: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break;
|
|
||||||
case SURFACE_METAL_CHAIN_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
|
|
||||||
case SURFACE_PED: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break;
|
|
||||||
case SURFACE_SAND: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
|
|
||||||
case SURFACE_WATER: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
|
|
||||||
case SURFACE_WOOD_CRATES: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break;
|
|
||||||
case SURFACE_WOOD_BENCH: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break;
|
|
||||||
case SURFACE_WOOD_SOLID: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break;
|
|
||||||
case SURFACE_RUBBER:
|
|
||||||
case SURFACE_WHEELBASE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
|
|
||||||
case SURFACE_PLASTIC: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break;
|
|
||||||
case SURFACE_HEDGE: result = GetCollisionRatio(b, 0.f, 0.5f, 0.5f); break;
|
|
||||||
case SURFACE_CONTAINER: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break;
|
|
||||||
case SURFACE_NEWS_VENDOR: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break;
|
|
||||||
default: result = 0.f; break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
float
|
|
||||||
cAudioManager::GetCollisionRatio(float a, float b, float c, float d) const
|
|
||||||
{
|
|
||||||
float e;
|
|
||||||
e = a;
|
|
||||||
if(a <= b) return 0.0f;
|
|
||||||
if(c <= a) e = c;
|
|
||||||
return (e - b) / d;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32
|
|
||||||
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
|
|
||||||
{
|
|
||||||
uint8 surface1 = audioCollision.m_bSurface1;
|
|
||||||
uint8 surface2 = audioCollision.m_bSurface2;
|
|
||||||
int32 vol;
|
|
||||||
float ratio;
|
|
||||||
|
|
||||||
if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
|
|
||||||
surface2 == SURFACE_HEDGE) {
|
|
||||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
|
|
||||||
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
|
|
||||||
vol = 50.f * ratio;
|
|
||||||
} else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
|
|
||||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
|
|
||||||
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
|
|
||||||
vol = 30.f * ratio;
|
|
||||||
} else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY ||
|
|
||||||
surface2 == SURFACE_MUD_DRY || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
|
|
||||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
|
|
||||||
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
|
|
||||||
vol = 50.f * ratio;
|
|
||||||
} else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
|
|
||||||
m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
|
|
||||||
vol = 40.f * ratio;
|
|
||||||
}
|
|
||||||
if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
|
|
||||||
return vol;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
|
cAudioManager::ServiceCollisions()
|
||||||
{
|
{
|
||||||
if(col.m_fIntensity2 > 0.0016f) {
|
int i, j;
|
||||||
uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
|
bool8 abRepeatedCollision1[NUMAUDIOCOLLISIONS];
|
||||||
if(emittingVol) {
|
bool8 abRepeatedCollision2[NUMAUDIOCOLLISIONS];
|
||||||
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
|
|
||||||
m_sQueueSample.m_nVolume =
|
m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
|
||||||
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
|
||||||
if(m_sQueueSample.m_nVolume) {
|
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||||
m_sQueueSample.m_nCounter = counter;
|
abRepeatedCollision1[i] = abRepeatedCollision2[i] = FALSE;
|
||||||
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
||||||
m_sQueueSample.m_bIs2D = false;
|
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 7;
|
int index = m_sCollisionManager.m_bIndicesTable[i];
|
||||||
m_sQueueSample.m_nLoopCount = 0;
|
if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1)
|
||||||
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
&& (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2)
|
||||||
m_sQueueSample.m_nLoopStart =
|
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
|
||||||
SampleManager.GetSampleLoopStartOffset(m_sQueueSample.m_nSampleIndex);
|
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
|
||||||
m_sQueueSample.m_nLoopEnd =
|
) {
|
||||||
SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
|
abRepeatedCollision1[index] = TRUE;
|
||||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
abRepeatedCollision2[j] = TRUE;
|
||||||
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
|
m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = false;
|
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||||
m_sQueueSample.m_nReleasingVolumeDivider = 5;
|
break;
|
||||||
m_sQueueSample.m_bReverbFlag = true;
|
|
||||||
m_sQueueSample.m_bRequireReflection = false;
|
|
||||||
AddSampleToRequestedQueue();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < NUMAUDIOCOLLISIONS; i++) {
|
||||||
|
if (!abRepeatedCollision2[i]) {
|
||||||
|
m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
|
||||||
|
m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
|
||||||
|
m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
|
||||||
|
m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = SURFACE_DEFAULT;
|
||||||
|
m_sCollisionManager.m_asCollisions2[i].m_fIntensity2 = 0.0f;
|
||||||
|
m_sCollisionManager.m_asCollisions2[i].m_fIntensity1 = 0.0f;
|
||||||
|
m_sCollisionManager.m_asCollisions2[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
m_sCollisionManager.m_asCollisions2[i].m_fDistance = 0.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
||||||
|
int index = m_sCollisionManager.m_bIndicesTable[i];
|
||||||
|
if (!abRepeatedCollision1[index]) {
|
||||||
|
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
||||||
|
if (!abRepeatedCollision2[j]) {
|
||||||
|
m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1;
|
||||||
|
m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1;
|
||||||
|
m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2;
|
||||||
|
m_sCollisionManager.m_asCollisions2[j].m_bSurface1 = m_sCollisionManager.m_asCollisions1[index].m_bSurface1;
|
||||||
|
m_sCollisionManager.m_asCollisions2[j].m_bSurface2 = m_sCollisionManager.m_asCollisions1[index].m_bSurface2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
|
||||||
|
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||||
|
m_sCollisionManager.m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||||
|
m_sCollisionManager.m_bCollisionsInQueue = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
|
static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
|
||||||
SFX_COL_TARMAC_1,
|
SFX_COL_TARMAC_1,
|
||||||
SFX_COL_GRASS_1,
|
SFX_COL_GRASS_1,
|
||||||
@ -222,9 +176,8 @@ static const int32 gOneShotCol[] = {SFX_COL_TARMAC_1,
|
|||||||
void
|
void
|
||||||
cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
||||||
{
|
{
|
||||||
|
uint16 s1;
|
||||||
int16 s1;
|
uint16 s2;
|
||||||
int16 s2;
|
|
||||||
|
|
||||||
int32 emittingVol;
|
int32 emittingVol;
|
||||||
float ratio;
|
float ratio;
|
||||||
@ -250,7 +203,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:
|
||||||
@ -307,17 +260,16 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
|||||||
if(counter >= 255) counter = 28;
|
if(counter >= 255) counter = 28;
|
||||||
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;
|
||||||
m_sQueueSample.m_bIs2D = false;
|
m_sQueueSample.m_bIs2D = FALSE;
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 11;
|
m_sQueueSample.m_nPriority = 11;
|
||||||
m_sQueueSample.m_nLoopCount = 1;
|
m_sQueueSample.m_nLoopCount = 1;
|
||||||
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
SET_EMITTING_VOLUME(emittingVol);
|
||||||
m_sQueueSample.m_nLoopStart = 0;
|
RESET_LOOP_OFFSETS
|
||||||
m_sQueueSample.m_nLoopEnd = -1;
|
|
||||||
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||||
m_sQueueSample.m_fSoundIntensity = CollisionSoundIntensity;
|
m_sQueueSample.m_MaxDistance = CollisionSoundIntensity;
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = true;
|
m_sQueueSample.m_bStatic = TRUE;
|
||||||
m_sQueueSample.m_bReverbFlag = true;
|
m_sQueueSample.m_bReverb = TRUE;
|
||||||
m_sQueueSample.m_bRequireReflection = false;
|
SET_SOUND_REFLECTION(FALSE);
|
||||||
AddSampleToRequestedQueue();
|
AddSampleToRequestedQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -325,101 +277,127 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::ServiceCollisions()
|
cAudioManager::SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter)
|
||||||
{
|
{
|
||||||
int i, j;
|
if(col.m_fIntensity2 > 0.0016f) {
|
||||||
bool abRepeatedCollision1[NUMAUDIOCOLLISIONS];
|
uint8 emittingVol = SetLoopingCollisionRequestedSfxFreqAndGetVol(col);
|
||||||
bool abRepeatedCollision2[NUMAUDIOCOLLISIONS];
|
if(emittingVol) {
|
||||||
|
m_sQueueSample.m_fDistance = Sqrt(col.m_fDistance);
|
||||||
m_sQueueSample.m_nEntityIndex = m_nCollisionEntity;
|
m_sQueueSample.m_nVolume =
|
||||||
|
ComputeVolume(emittingVol, CollisionSoundIntensity, m_sQueueSample.m_fDistance);
|
||||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
if(m_sQueueSample.m_nVolume > 0) {
|
||||||
abRepeatedCollision1[i] = abRepeatedCollision2[i] = false;
|
m_sQueueSample.m_nCounter = counter;
|
||||||
|
m_sQueueSample.m_vecPos = col.m_vecPosition;
|
||||||
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
m_sQueueSample.m_bIs2D = FALSE;
|
||||||
int index = m_sCollisionManager.m_bIndicesTable[i];
|
m_sQueueSample.m_nPriority = 7;
|
||||||
if ((m_sCollisionManager.m_asCollisions1[index].m_pEntity1 == m_sCollisionManager.m_asCollisions2[j].m_pEntity1)
|
m_sQueueSample.m_nLoopCount = 0;
|
||||||
&& (m_sCollisionManager.m_asCollisions1[index].m_pEntity2 == m_sCollisionManager.m_asCollisions2[j].m_pEntity2)
|
SET_EMITTING_VOLUME(emittingVol);
|
||||||
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface1 == m_sCollisionManager.m_asCollisions2[j].m_bSurface1)
|
SET_LOOP_OFFSETS(m_sQueueSample.m_nSampleIndex);
|
||||||
&& (m_sCollisionManager.m_asCollisions1[index].m_bSurface2 == m_sCollisionManager.m_asCollisions2[j].m_bSurface2)
|
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
|
||||||
) {
|
m_sQueueSample.m_MaxDistance = CollisionSoundIntensity;
|
||||||
abRepeatedCollision1[index] = true;
|
m_sQueueSample.m_bStatic = FALSE;
|
||||||
abRepeatedCollision2[j] = true;
|
m_sQueueSample.m_nFramesToPlay = 5;
|
||||||
m_sCollisionManager.m_asCollisions1[index].m_nBaseVolume = ++m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume;
|
m_sQueueSample.m_bReverb = TRUE;
|
||||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
SET_SOUND_REFLECTION(FALSE);
|
||||||
break;
|
AddSampleToRequestedQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < NUMAUDIOCOLLISIONS; i++) {
|
|
||||||
if (!abRepeatedCollision2[i]) {
|
|
||||||
m_sCollisionManager.m_asCollisions2[i].m_pEntity1 = nil;
|
|
||||||
m_sCollisionManager.m_asCollisions2[i].m_pEntity2 = nil;
|
|
||||||
m_sCollisionManager.m_asCollisions2[i].m_bSurface1 = SURFACE_DEFAULT;
|
|
||||||
m_sCollisionManager.m_asCollisions2[i].m_bSurface2 = SURFACE_DEFAULT;
|
|
||||||
m_sCollisionManager.m_asCollisions2[i].m_fIntensity2 = 0.0f;
|
|
||||||
m_sCollisionManager.m_asCollisions2[i].m_fIntensity1 = 0.0f;
|
|
||||||
m_sCollisionManager.m_asCollisions2[i].m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
|
||||||
m_sCollisionManager.m_asCollisions2[i].m_fDistance = 0.0f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < m_sCollisionManager.m_bCollisionsInQueue; i++) {
|
|
||||||
int index = m_sCollisionManager.m_bIndicesTable[i];
|
|
||||||
if (!abRepeatedCollision1[index]) {
|
|
||||||
for (j = 0; j < NUMAUDIOCOLLISIONS; j++) {
|
|
||||||
if (!abRepeatedCollision2[j]) {
|
|
||||||
m_sCollisionManager.m_asCollisions2[j].m_nBaseVolume = 1;
|
|
||||||
m_sCollisionManager.m_asCollisions2[j].m_pEntity1 = m_sCollisionManager.m_asCollisions1[index].m_pEntity1;
|
|
||||||
m_sCollisionManager.m_asCollisions2[j].m_pEntity2 = m_sCollisionManager.m_asCollisions1[index].m_pEntity2;
|
|
||||||
m_sCollisionManager.m_asCollisions2[j].m_bSurface1 = m_sCollisionManager.m_asCollisions1[index].m_bSurface1;
|
|
||||||
m_sCollisionManager.m_asCollisions2[j].m_bSurface2 = m_sCollisionManager.m_asCollisions1[index].m_bSurface2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SetUpOneShotCollisionSound(m_sCollisionManager.m_asCollisions1[index]);
|
|
||||||
SetUpLoopingCollisionSound(m_sCollisionManager.m_asCollisions1[index], j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
|
||||||
m_sCollisionManager.m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
|
||||||
m_sCollisionManager.m_bCollisionsInQueue = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
uint32
|
||||||
cAudioManager::ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower,
|
cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision)
|
||||||
float velocity)
|
|
||||||
{
|
{
|
||||||
float distSquared;
|
uint8 surface1 = audioCollision.m_bSurface1;
|
||||||
CVector v1;
|
uint8 surface2 = audioCollision.m_bSurface2;
|
||||||
CVector v2;
|
int32 vol;
|
||||||
|
float ratio;
|
||||||
|
|
||||||
if(!m_bIsInitialised || m_nCollisionEntity < 0 || m_nUserPause ||
|
if(surface1 == SURFACE_GRASS || surface2 == SURFACE_GRASS || surface1 == SURFACE_HEDGE ||
|
||||||
(velocity < 0.0016f && collisionPower < 0.01f))
|
surface2 == SURFACE_HEDGE) {
|
||||||
return;
|
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||||
|
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
|
||||||
if(entity1->IsBuilding()) {
|
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
|
||||||
v1 = v2 = entity2->GetPosition();
|
vol = 50.f * ratio;
|
||||||
} else if(entity2->IsBuilding()) {
|
} else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
|
||||||
v1 = v2 = entity1->GetPosition();
|
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||||
|
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
|
||||||
|
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
|
||||||
|
vol = 30.f * ratio;
|
||||||
|
} else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY ||
|
||||||
|
surface2 == SURFACE_MUD_DRY || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
|
||||||
|
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||||
|
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
|
||||||
|
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
|
||||||
|
vol = 50.f * ratio;
|
||||||
|
} else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
|
||||||
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
v1 = entity1->GetPosition();
|
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
|
||||||
v2 = entity2->GetPosition();
|
m_sQueueSample.m_nSampleIndex = SFX_SCRAPE_CAR_1;
|
||||||
}
|
m_sQueueSample.m_nFrequency = 10000.f * ratio + 10000;
|
||||||
CVector pos = (v1 + v2) * 0.5f;
|
vol = 40.f * ratio;
|
||||||
distSquared = GetDistanceSquared(pos);
|
|
||||||
if(distSquared < SQR(CollisionSoundIntensity)) {
|
|
||||||
m_sCollisionManager.m_sQueue.m_pEntity1 = entity1;
|
|
||||||
m_sCollisionManager.m_sQueue.m_pEntity2 = entity2;
|
|
||||||
m_sCollisionManager.m_sQueue.m_bSurface1 = surface1;
|
|
||||||
m_sCollisionManager.m_sQueue.m_bSurface2 = surface2;
|
|
||||||
m_sCollisionManager.m_sQueue.m_fIntensity1 = collisionPower;
|
|
||||||
m_sCollisionManager.m_sQueue.m_fIntensity2 = velocity;
|
|
||||||
m_sCollisionManager.m_sQueue.m_vecPosition = pos;
|
|
||||||
m_sCollisionManager.m_sQueue.m_fDistance = distSquared;
|
|
||||||
m_sCollisionManager.AddCollisionToRequestedQueue();
|
|
||||||
}
|
}
|
||||||
|
if(audioCollision.m_nBaseVolume < 2) vol = audioCollision.m_nBaseVolume * vol / 2;
|
||||||
|
return vol;
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cAudioManager::GetCollisionOneShotRatio(uint32 a, float b)
|
||||||
|
{
|
||||||
|
switch(a) {
|
||||||
|
case SURFACE_DEFAULT:
|
||||||
|
case SURFACE_TARMAC:
|
||||||
|
case SURFACE_PAVEMENT:
|
||||||
|
case SURFACE_STEEP_CLIFF:
|
||||||
|
case SURFACE_TRANSPARENT_STONE: return GetCollisionRatio(b, 10.f, 60.f, 50.f);
|
||||||
|
case SURFACE_GRASS:
|
||||||
|
case SURFACE_CARDBOARDBOX:
|
||||||
|
case SURFACE_GRAVEL:
|
||||||
|
case SURFACE_MUD_DRY: return GetCollisionRatio(b, 0.f, 2.f, 2.f);
|
||||||
|
case SURFACE_CAR: return GetCollisionRatio(b, 6.f, 50.f, 44.f);
|
||||||
|
case SURFACE_GLASS:
|
||||||
|
case SURFACE_METAL_CHAIN_FENCE: return GetCollisionRatio(b, 0.1f, 10.f, 9.9f);
|
||||||
|
case SURFACE_TRANSPARENT_CLOTH:
|
||||||
|
case SURFACE_THICK_METAL_PLATE: return GetCollisionRatio(b, 30.f, 130.f, 100.f);
|
||||||
|
case SURFACE_GARAGE_DOOR: return GetCollisionRatio(b, 20.f, 100.f, 80.f);
|
||||||
|
case SURFACE_CAR_PANEL: return GetCollisionRatio(b, 0.f, 4.f, 4.f);
|
||||||
|
case SURFACE_SCAFFOLD_POLE:
|
||||||
|
case SURFACE_METAL_GATE:
|
||||||
|
case SURFACE_LAMP_POST: return GetCollisionRatio(b, 1.f, 10.f, 9.f);
|
||||||
|
case SURFACE_FIRE_HYDRANT: return GetCollisionRatio(b, 1.f, 15.f, 14.f);
|
||||||
|
case SURFACE_GIRDER: return GetCollisionRatio(b, 8.f, 50.f, 42.f);
|
||||||
|
case SURFACE_PED: return GetCollisionRatio(b, 0.f, 20.f, 20.f);
|
||||||
|
case SURFACE_SAND:
|
||||||
|
case SURFACE_WATER:
|
||||||
|
case SURFACE_RUBBER:
|
||||||
|
case SURFACE_WHEELBASE: return GetCollisionRatio(b, 0.f, 10.f, 10.f);
|
||||||
|
case SURFACE_WOOD_CRATES: return GetCollisionRatio(b, 1.f, 4.f, 3.f);
|
||||||
|
case SURFACE_WOOD_BENCH: return GetCollisionRatio(b, 0.1f, 5.f, 4.9f);
|
||||||
|
case SURFACE_WOOD_SOLID: return GetCollisionRatio(b, 0.1f, 40.f, 39.9f);
|
||||||
|
case SURFACE_PLASTIC: return GetCollisionRatio(b, 0.1f, 4.f, 3.9f);
|
||||||
|
case SURFACE_HEDGE: return GetCollisionRatio(b, 0.f, 0.5f, 0.5f);
|
||||||
|
case SURFACE_CONTAINER: return GetCollisionRatio(b, 4.f, 40.f, 36.f);
|
||||||
|
case SURFACE_NEWS_VENDOR: return GetCollisionRatio(b, 0.f, 5.f, 5.f);
|
||||||
|
default: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cAudioManager::GetCollisionLoopingRatio(uint32 a, uint32 b, float c)
|
||||||
|
{
|
||||||
|
return GetCollisionRatio(c, 0.0f, 0.02f, 0.02f);
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
cAudioManager::GetCollisionRatio(float a, float b, float c, float d)
|
||||||
|
{
|
||||||
|
float e;
|
||||||
|
e = a;
|
||||||
|
if(a <= b) return 0.0f;
|
||||||
|
if(c <= a) e = c;
|
||||||
|
return (e - b) / d;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,18 @@ public:
|
|||||||
float m_fDistance;
|
float m_fDistance;
|
||||||
int32 m_nBaseVolume;
|
int32 m_nBaseVolume;
|
||||||
|
|
||||||
// no methods
|
cAudioCollision() { Reset(); }
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
m_pEntity1 = nil;
|
||||||
|
m_pEntity2 = nil;
|
||||||
|
m_bSurface1 = 0;
|
||||||
|
m_bSurface2 = 0;
|
||||||
|
m_fIntensity1 = m_fIntensity2 = 0.0f;
|
||||||
|
m_vecPosition = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
m_fDistance = 0.0f;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(cAudioCollision, 40);
|
VALIDATE_SIZE(cAudioCollision, 40);
|
||||||
@ -31,7 +42,15 @@ public:
|
|||||||
uint8 m_bCollisionsInQueue;
|
uint8 m_bCollisionsInQueue;
|
||||||
cAudioCollision m_sQueue;
|
cAudioCollision m_sQueue;
|
||||||
|
|
||||||
cAudioCollisionManager();
|
cAudioCollisionManager()
|
||||||
|
{
|
||||||
|
m_sQueue.Reset();
|
||||||
|
|
||||||
|
for(int i = 0; i < NUMAUDIOCOLLISIONS; i++)
|
||||||
|
m_bIndicesTable[i] = NUMAUDIOCOLLISIONS;
|
||||||
|
|
||||||
|
m_bCollisionsInQueue = 0;
|
||||||
|
}
|
||||||
void AddCollisionToRequestedQueue();
|
void AddCollisionToRequestedQueue();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -2,37 +2,64 @@
|
|||||||
|
|
||||||
#include "audio_enums.h"
|
#include "audio_enums.h"
|
||||||
#include "AudioCollision.h"
|
#include "AudioCollision.h"
|
||||||
#include "PoliceRadio.h"
|
#include "PolRadio.h"
|
||||||
|
|
||||||
class tSound
|
class tSound
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int32 m_nEntityIndex;
|
int32 m_nEntityIndex; // audio entity index
|
||||||
int32 m_nCounter;
|
#if GTA_VERSION >= GTA3_PC_10
|
||||||
int32 m_nSampleIndex;
|
uint32 m_nCounter; // I'm not sure what this is but it looks like a virtual counter to determine the same sound in queue
|
||||||
uint8 m_nBankIndex;
|
// Values higher than 255 are used by reflections
|
||||||
bool m_bIs2D;
|
#else
|
||||||
int32 m_nReleasingVolumeModificator;
|
uint8 m_nCounter;
|
||||||
uint32 m_nFrequency;
|
#endif
|
||||||
uint8 m_nVolume;
|
uint32 m_nSampleIndex; // An index of sample from AudioSamples.h
|
||||||
float m_fDistance;
|
uint8 m_nBankIndex; // A sound bank index. IDK what's the point of it here since samples are hardcoded anyway
|
||||||
int32 m_nLoopCount;
|
bool8 m_bIs2D; // If TRUE then sound is played in 2D space (such as frontend or police radio)
|
||||||
int32 m_nLoopStart;
|
uint32 m_nPriority; // The multiplier for the sound priority (see m_nFinalPriority below). Lesser value means higher priority
|
||||||
|
uint32 m_nFrequency; // Sound frequency, plain and simple
|
||||||
|
uint8 m_nVolume; // Sound volume (0..127), only used as an actual volume without EXTERNAL_3D_SOUND (see m_nEmittingVolume)
|
||||||
|
float m_fDistance; // Distance to camera (useless if m_bIs2D == TRUE)
|
||||||
|
uint32 m_nLoopCount; // 0 - always loop, 1 - don't loop, other values never seen
|
||||||
|
#ifndef GTA_PS2
|
||||||
|
// Loop offsets
|
||||||
|
uint32 m_nLoopStart;
|
||||||
int32 m_nLoopEnd;
|
int32 m_nLoopEnd;
|
||||||
uint8 m_nEmittingVolume;
|
#endif
|
||||||
float m_fSpeedMultiplier;
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
float m_fSoundIntensity;
|
uint8 m_nEmittingVolume; // The volume in 3D space, provided to 3D audio engine
|
||||||
bool m_bReleasingSoundFlag;
|
#endif
|
||||||
CVector m_vecPos;
|
float m_fSpeedMultiplier; // Used for doppler effect. 0.0f - unaffected by doppler
|
||||||
bool m_bReverbFlag;
|
#if GTA_VERSION >= GTA3_PC_10
|
||||||
uint8 m_nLoopsRemaining;
|
float m_MaxDistance; // The maximum distance at which sound could be heard. Minimum distance = MaxDistance / 5 or MaxDistance / 4 in case of emitting volume (useless if m_bIs2D == TRUE)
|
||||||
bool m_bRequireReflection; // Used for oneshots
|
#else
|
||||||
uint8 m_nOffset;
|
uint32 m_MaxDistance;
|
||||||
int32 m_nReleasingVolumeDivider;
|
#endif
|
||||||
bool m_bIsProcessed;
|
bool8 m_bStatic; // If TRUE then sound parameters cannot be changed during playback (frequency, position, etc.)
|
||||||
bool m_bLoopEnded;
|
CVector m_vecPos; // Position of sound in 3D space. Unused if m_bIs2D == TRUE
|
||||||
int32 m_nCalculatedVolume;
|
bool8 m_bReverb; // Toggles reverb effect
|
||||||
int8 m_nVolumeChange;
|
#ifdef AUDIO_REFLECTIONS
|
||||||
|
uint8 m_nReflectionDelay; // Number of frames before reflection could be played. This is calculated internally by AudioManager and shouldn't be set by queued sample
|
||||||
|
bool8 m_bReflections; // Add sound reflections
|
||||||
|
#endif
|
||||||
|
uint8 m_nPan; // Sound panning (0-127). Controls the volume of the playback coming from left and right speaker. Calculated internally unless m_bIs2D==TRUE.
|
||||||
|
// 0 = L 100% R 0%
|
||||||
|
// 63 = L 100% R 100%
|
||||||
|
// 127 = L 0% R 100%
|
||||||
|
uint32 m_nFramesToPlay; // Number of frames the sound would be played (if it stops being queued).
|
||||||
|
// This one is being set by queued sample for looping sounds, otherwise calculated inside AudioManager
|
||||||
|
|
||||||
|
// all fields below are internal to AudioManager calculations and aren't set by queued sample
|
||||||
|
bool8 m_bIsBeingPlayed; // Set to TRUE when the sound was added or changed on current frame to avoid it being overwritten
|
||||||
|
bool8 m_bIsPlayingFinished; // Not sure about the name. Set to TRUE when sampman channel becomes free
|
||||||
|
#if GTA_VERSION < GTA3_PC_10
|
||||||
|
int32 unk; // Only on PS2, used by static non-looped sounds (AFAIK)
|
||||||
|
// Looks like it's keeping a number of frames left to play with the purpose of setting m_bIsPlayingFinished=TRUE once value reaches 0
|
||||||
|
// Default value is -3 for whatever reason
|
||||||
|
#endif
|
||||||
|
uint32 m_nFinalPriority; // Actual value used to compare priority, calculated using volume and m_nPriority. Lesser value means higher priority
|
||||||
|
int8 m_nVolumeChange; // How much m_nVolume should reduce per each frame.
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(tSound, 92);
|
VALIDATE_SIZE(tSound, 92);
|
||||||
@ -45,8 +72,8 @@ class tAudioEntity
|
|||||||
public:
|
public:
|
||||||
eAudioType m_nType;
|
eAudioType m_nType;
|
||||||
void *m_pEntity;
|
void *m_pEntity;
|
||||||
bool m_bIsUsed;
|
bool8 m_bIsUsed;
|
||||||
uint8 m_bStatus;
|
bool8 m_bStatus;
|
||||||
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
|
int16 m_awAudioEvent[NUM_AUDIOENTITY_EVENTS];
|
||||||
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
|
float m_afVolume[NUM_AUDIOENTITY_EVENTS];
|
||||||
uint8 m_AudioEvents;
|
uint8 m_AudioEvents;
|
||||||
@ -57,12 +84,15 @@ VALIDATE_SIZE(tAudioEntity, 40);
|
|||||||
class tPedComment
|
class tPedComment
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int32 m_nSampleIndex;
|
uint32 m_nSampleIndex;
|
||||||
int32 m_nEntityIndex;
|
int32 m_nEntityIndex;
|
||||||
CVector m_vecPos;
|
CVector m_vecPos;
|
||||||
float m_fDistance;
|
float m_fDistance;
|
||||||
uint8 m_bVolume;
|
uint8 m_nVolume;
|
||||||
int8 m_nProcess;
|
int8 m_nProcess;
|
||||||
|
#if defined(EXTERNAL_3D_SOUND) && defined(FIX_BUGS)
|
||||||
|
uint8 m_nEmittingVolume;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(tPedComment, 28);
|
VALIDATE_SIZE(tPedComment, 28);
|
||||||
@ -93,22 +123,6 @@ public:
|
|||||||
|
|
||||||
VALIDATE_SIZE(cPedComments, 1164);
|
VALIDATE_SIZE(cPedComments, 1164);
|
||||||
|
|
||||||
class CEntity;
|
|
||||||
|
|
||||||
class cMissionAudio
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CVector m_vecPos;
|
|
||||||
bool m_bPredefinedProperties;
|
|
||||||
int32 m_nSampleIndex;
|
|
||||||
uint8 m_nLoadingStatus;
|
|
||||||
uint8 m_nPlayStatus;
|
|
||||||
bool m_bIsPlaying;
|
|
||||||
int32 m_nMissionAudioCounter;
|
|
||||||
bool m_bIsPlayed;
|
|
||||||
};
|
|
||||||
VALIDATE_SIZE(cMissionAudio, 32);
|
|
||||||
|
|
||||||
// name made up
|
// name made up
|
||||||
class cAudioScriptObjectManager
|
class cAudioScriptObjectManager
|
||||||
{
|
{
|
||||||
@ -122,6 +136,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
class cTransmission;
|
class cTransmission;
|
||||||
|
class CEntity;
|
||||||
class CPlane;
|
class CPlane;
|
||||||
class CVehicle;
|
class CVehicle;
|
||||||
class CPed;
|
class CPed;
|
||||||
@ -129,7 +144,7 @@ class CPed;
|
|||||||
class cPedParams
|
class cPedParams
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool m_bDistanceCalculated;
|
bool8 m_bDistanceCalculated;
|
||||||
float m_fDistance;
|
float m_fDistance;
|
||||||
CPed *m_pPed;
|
CPed *m_pPed;
|
||||||
|
|
||||||
@ -144,11 +159,11 @@ public:
|
|||||||
class cVehicleParams
|
class cVehicleParams
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool m_bDistanceCalculated;
|
bool8 m_bDistanceCalculated;
|
||||||
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()
|
||||||
@ -181,324 +196,375 @@ enum {
|
|||||||
MAX_REFLECTIONS,
|
MAX_REFLECTIONS,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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 };
|
||||||
|
|
||||||
class cAudioManager
|
class cAudioManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool m_bIsInitialised;
|
bool8 m_bIsInitialised;
|
||||||
bool m_bReverb; // unused
|
bool8 m_bIsSurround; // unused until VC
|
||||||
bool m_bFifthFrameFlag;
|
bool8 m_bReduceReleasingPriority;
|
||||||
uint8 m_nActiveSamples;
|
uint8 m_nActiveSamples;
|
||||||
uint8 field_4; // unused
|
bool8 m_bDoubleVolume; // unused
|
||||||
bool m_bDynamicAcousticModelingStatus;
|
#if GTA_VERSION >= GTA3_PC_10
|
||||||
|
bool8 m_bDynamicAcousticModelingStatus;
|
||||||
|
#endif
|
||||||
float m_fSpeedOfSound;
|
float m_fSpeedOfSound;
|
||||||
bool m_bTimerJustReset;
|
bool8 m_bTimerJustReset;
|
||||||
int32 m_nTimer;
|
int32 m_nTimer;
|
||||||
tSound m_sQueueSample;
|
tSound m_sQueueSample;
|
||||||
uint8 m_nActiveSampleQueue;
|
uint8 m_nActiveSampleQueue;
|
||||||
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
tSound m_asSamples[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC];
|
||||||
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_SOUNDS_SAMPLES_SLOTS];
|
uint8 m_abSampleQueueIndexTable[NUM_SOUNDS_SAMPLES_BANKS][NUM_CHANNELS_GENERIC];
|
||||||
uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
|
uint8 m_SampleRequestQueuesStatus[NUM_SOUNDS_SAMPLES_BANKS];
|
||||||
tSound m_asActiveSamples[NUM_SOUNDS_SAMPLES_SLOTS];
|
tSound m_asActiveSamples[NUM_CHANNELS_GENERIC];
|
||||||
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;
|
||||||
CVector m_avecReflectionsPos[NUM_AUDIO_REFLECTIONS];
|
#ifdef AUDIO_REFLECTIONS
|
||||||
float m_afReflectionsDistances[NUM_AUDIO_REFLECTIONS];
|
CVector m_avecReflectionsPos[MAX_REFLECTIONS];
|
||||||
|
float m_afReflectionsDistances[MAX_REFLECTIONS];
|
||||||
|
#endif
|
||||||
cAudioScriptObjectManager m_sAudioScriptObjectManager;
|
cAudioScriptObjectManager m_sAudioScriptObjectManager;
|
||||||
cPedComments m_sPedComments;
|
cPedComments m_sPedComments;
|
||||||
int32 m_nFireAudioEntity;
|
int32 m_nFireAudioEntity;
|
||||||
int32 m_nWaterCannonEntity;
|
int32 m_nWaterCannonEntity;
|
||||||
int32 m_nPoliceChannelEntity;
|
int32 m_nPoliceChannelEntity;
|
||||||
cPoliceRadioQueue m_sPoliceRadioQueue;
|
cPoliceRadioQueue m_sPoliceRadioQueue;
|
||||||
|
cAMCrime m_aCrimes[10];
|
||||||
int32 m_nFrontEndEntity;
|
int32 m_nFrontEndEntity;
|
||||||
int32 m_nCollisionEntity;
|
int32 m_nCollisionEntity;
|
||||||
cAudioCollisionManager m_sCollisionManager;
|
cAudioCollisionManager m_sCollisionManager;
|
||||||
int32 m_nProjectileEntity;
|
int32 m_nProjectileEntity;
|
||||||
int32 m_nBridgeEntity;
|
int32 m_nBridgeEntity;
|
||||||
cMissionAudio m_sMissionAudio;
|
|
||||||
|
// Mission audio stuff
|
||||||
|
CVector m_vecMissionAudioPosition;
|
||||||
|
bool8 m_bIsMissionAudio2D;
|
||||||
|
uint32 m_nMissionAudioSampleIndex;
|
||||||
|
uint8 m_nMissionAudioLoadingStatus;
|
||||||
|
uint8 m_nMissionAudioPlayStatus;
|
||||||
|
bool8 m_bIsMissionAudioPlaying;
|
||||||
|
int32 m_nMissionAudioFramesToPlay;
|
||||||
|
bool8 m_bIsMissionAudioAllowedToPlay;
|
||||||
|
|
||||||
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();
|
||||||
~cAudioManager();
|
~cAudioManager();
|
||||||
|
|
||||||
// getters
|
|
||||||
uint32 GetFrameCounter() const { return m_FrameCounter; }
|
|
||||||
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
|
|
||||||
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
|
|
||||||
int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; }
|
|
||||||
bool ShouldDuckMissionAudio() const { return m_sMissionAudio.m_nPlayStatus == 1; }
|
|
||||||
|
|
||||||
// "Should" be in alphabetic order, except "getXTalkSfx"
|
|
||||||
void AddDetailsToRequestedOrderList(uint8 sample);
|
|
||||||
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank,
|
|
||||||
uint8 counter, bool notLooping);
|
|
||||||
void AddReflectionsToRequestedQueue();
|
|
||||||
void AddReleasingSounds();
|
|
||||||
void AddSampleToRequestedQueue();
|
|
||||||
void AgeCrimes();
|
|
||||||
|
|
||||||
void CalculateDistance(bool &condition, float dist);
|
|
||||||
bool CheckForAnAudioFileOnCD() const;
|
|
||||||
void ClearActiveSamples();
|
|
||||||
void ClearMissionAudio();
|
|
||||||
void ClearRequestedQueue();
|
|
||||||
int32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2,
|
|
||||||
float speedMultiplier) const;
|
|
||||||
int32 ComputePan(float, CVector *);
|
|
||||||
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
|
|
||||||
int32 CreateEntity(eAudioType type, void *entity);
|
|
||||||
|
|
||||||
void DestroyAllGameCreatedEntities();
|
|
||||||
void DestroyEntity(int32 id);
|
|
||||||
void DoPoliceRadioCrackle();
|
|
||||||
|
|
||||||
// functions returning talk sfx,
|
|
||||||
// order from GetPedCommentSfx
|
|
||||||
uint32 GetPlayerTalkSfx(int16 sound);
|
|
||||||
uint32 GetCopTalkSfx(int16 sound);
|
|
||||||
uint32 GetSwatTalkSfx(int16 sound);
|
|
||||||
uint32 GetFBITalkSfx(int16 sound);
|
|
||||||
uint32 GetArmyTalkSfx(int16 sound);
|
|
||||||
uint32 GetMedicTalkSfx(int16 sound);
|
|
||||||
uint32 GetFiremanTalkSfx(int16 sound);
|
|
||||||
uint32 GetNormalMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetTaxiDriverTalkSfx(int16 sound);
|
|
||||||
uint32 GetPimpTalkSfx(int16 sound);
|
|
||||||
uint32 GetMafiaTalkSfx(int16 sound);
|
|
||||||
uint32 GetTriadTalkSfx(int16 sound);
|
|
||||||
uint32 GetDiabloTalkSfx(int16 sound);
|
|
||||||
uint32 GetYakuzaTalkSfx(int16 sound);
|
|
||||||
uint32 GetYardieTalkSfx(int16 sound);
|
|
||||||
uint32 GetColumbianTalkSfx(int16 sound);
|
|
||||||
uint32 GetHoodTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackCriminalTalkSfx(int16 sound);
|
|
||||||
uint32 GetWhiteCriminalTalkSfx(int16 sound);
|
|
||||||
uint32 GetMaleNo2TalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackProjectMaleTalkSfx(int16 sound, int32 model);
|
|
||||||
uint32 GetWhiteFatMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackFatMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackCasualFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetWhiteCasualFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetFemaleNo3TalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackFatFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetWhiteFatFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackFemaleProstituteTalkSfx(int16 sound);
|
|
||||||
uint32 GetWhiteFemaleProstituteTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackProjectFemaleOldTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackProjectFemaleYoungTalkSfx(int16 sound);
|
|
||||||
uint32 GetChinatownMaleOldTalkSfx(int16 sound);
|
|
||||||
uint32 GetChinatownMaleYoungTalkSfx(int16 sound);
|
|
||||||
uint32 GetChinatownFemaleOldTalkSfx(int16 sound);
|
|
||||||
uint32 GetChinatownFemaleYoungTalkSfx(int16 sound);
|
|
||||||
uint32 GetLittleItalyMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetLittleItalyFemaleOldTalkSfx(int16 sound);
|
|
||||||
uint32 GetLittleItalyFemaleYoungTalkSfx(int16 sound);
|
|
||||||
uint32 GetWhiteDockerMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackDockerMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetScumMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetScumFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetWhiteWorkerMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackWorkerMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetBusinessMaleYoungTalkSfx(int16 sound, int32 model);
|
|
||||||
uint32 GetBusinessMaleOldTalkSfx(int16 sound);
|
|
||||||
uint32 GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model);
|
|
||||||
uint32 GetBlackBusinessFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetSupermodelMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetSupermodelFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetStewardMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetStewardFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetFanMaleTalkSfx(int16 sound, int32 model);
|
|
||||||
uint32 GetFanFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetHospitalMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetHospitalFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetWhiteConstructionWorkerTalkSfx(int16 sound);
|
|
||||||
uint32 GetBlackConstructionWorkerTalkSfx(int16 sound);
|
|
||||||
uint32 GetShopperFemaleTalkSfx(int16 sound, int32 model);
|
|
||||||
uint32 GetStudentMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetStudentFemaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetCasualMaleOldTalkSfx(int16 sound);
|
|
||||||
|
|
||||||
uint32 GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound);
|
|
||||||
uint32 GetEightTalkSfx(int16 sound);
|
|
||||||
uint32 GetFrankieTalkSfx(int16 sound);
|
|
||||||
uint32 GetMistyTalkSfx(int16 sound);
|
|
||||||
uint32 GetOJGTalkSfx(int16 sound);
|
|
||||||
uint32 GetCatatalinaTalkSfx(int16 sound);
|
|
||||||
uint32 GetBomberTalkSfx(int16 sound);
|
|
||||||
uint32 GetSecurityGuardTalkSfx(int16 sound);
|
|
||||||
uint32 GetChunkyTalkSfx(int16 sound);
|
|
||||||
|
|
||||||
uint32 GetGenericMaleTalkSfx(int16 sound);
|
|
||||||
uint32 GetGenericFemaleTalkSfx(int16 sound);
|
|
||||||
// end of functions returning talk sfx
|
|
||||||
|
|
||||||
void GenerateIntegerRandomNumberTable();
|
|
||||||
char *Get3DProviderName(uint8 id) const;
|
|
||||||
uint8 GetCDAudioDriveLetter() const;
|
|
||||||
int8 GetCurrent3DProviderIndex() const;
|
|
||||||
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c) const; // not used
|
|
||||||
float GetCollisionOneShotRatio(int32 a, float b) const;
|
|
||||||
float GetCollisionRatio(float a, float b, float c, float d) const;
|
|
||||||
float GetDistanceSquared(const CVector &v) const;
|
|
||||||
int32 GetJumboTaxiFreq() const;
|
|
||||||
uint8 GetMissionAudioLoadingStatus() const;
|
|
||||||
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
|
|
||||||
uint8 GetNum3DProvidersAvailable() const;
|
|
||||||
int32 GetPedCommentSfx(CPed *ped, int32 sound);
|
|
||||||
void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset) const;
|
|
||||||
float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
|
|
||||||
cTransmission *transmission, float velocityChange);
|
|
||||||
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile,
|
|
||||||
cTransmission *transmission, float velocityChange);
|
|
||||||
|
|
||||||
bool HasAirBrakes(int32 model) const;
|
|
||||||
|
|
||||||
void Initialise();
|
void Initialise();
|
||||||
void InitialisePoliceRadio();
|
|
||||||
void InitialisePoliceRadioZones();
|
|
||||||
void InterrogateAudioEntities();
|
|
||||||
bool IsAudioInitialised() const;
|
|
||||||
bool IsMissionAudioSampleFinished();
|
|
||||||
bool IsMP3RadioChannelAvailable() const;
|
|
||||||
|
|
||||||
bool MissionScriptAudioUsesPoliceChannel(int32 soundMission) const;
|
|
||||||
|
|
||||||
void PlayLoadedMissionAudio();
|
|
||||||
void PlayOneShot(int32 index, uint16 sound, float vol);
|
|
||||||
void PlaySuspectLastSeen(float x, float y, float z);
|
|
||||||
void PlayerJustGotInCar() const;
|
|
||||||
void PlayerJustLeftCar() const;
|
|
||||||
void PostInitialiseGameSpecificSetup();
|
|
||||||
void PostTerminateGameSpecificShutdown();
|
|
||||||
void PreInitialiseGameSpecificSetup() const;
|
|
||||||
void PreloadMissionAudio(Const char *name);
|
|
||||||
void PreTerminateGameSpecificShutdown();
|
|
||||||
/// processX - main logic of adding new sounds
|
|
||||||
void ProcessActiveQueues();
|
|
||||||
bool ProcessAirBrakes(cVehicleParams& params);
|
|
||||||
void ProcessAirportScriptObject(uint8 sound);
|
|
||||||
bool ProcessBoatEngine(cVehicleParams& params);
|
|
||||||
bool ProcessBoatMovingOverWater(cVehicleParams& params);
|
|
||||||
void ProcessBridge();
|
|
||||||
void ProcessBridgeMotor();
|
|
||||||
void ProcessBridgeOneShots();
|
|
||||||
void ProcessBridgeWarning();
|
|
||||||
bool ProcessCarBombTick(cVehicleParams& params);
|
|
||||||
void ProcessCesna(cVehicleParams& params);
|
|
||||||
void ProcessCinemaScriptObject(uint8 sound);
|
|
||||||
void ProcessCrane();
|
|
||||||
void ProcessDocksScriptObject(uint8 sound);
|
|
||||||
bool ProcessEngineDamage(cVehicleParams& params);
|
|
||||||
void ProcessEntity(int32 sound);
|
|
||||||
void ProcessExplosions(int32 explosion);
|
|
||||||
void ProcessFireHydrant();
|
|
||||||
void ProcessFires(int32 entity);
|
|
||||||
void ProcessFrontEnd();
|
|
||||||
void ProcessGarages();
|
|
||||||
bool ProcessHelicopter(cVehicleParams& params);
|
|
||||||
void ProcessHomeScriptObject(uint8 sound);
|
|
||||||
void ProcessJumbo(cVehicleParams& params);
|
|
||||||
void ProcessJumboAccel(CPlane *plane);
|
|
||||||
void ProcessJumboDecel(CPlane *plane);
|
|
||||||
void ProcessJumboFlying();
|
|
||||||
void ProcessJumboLanding(CPlane *plane);
|
|
||||||
void ProcessJumboTakeOff(CPlane *plane);
|
|
||||||
void ProcessJumboTaxi();
|
|
||||||
void ProcessLaunderetteScriptObject(uint8 sound);
|
|
||||||
void ProcessLoopingScriptObject(uint8 sound);
|
|
||||||
void ProcessMissionAudio();
|
|
||||||
void ProcessModelCarEngine(cVehicleParams& params);
|
|
||||||
void ProcessOneShotScriptObject(uint8 sound);
|
|
||||||
void ProcessPed(CPhysical *ped);
|
|
||||||
void ProcessPedHeadphones(cPedParams ¶ms);
|
|
||||||
void ProcessPedOneShots(cPedParams ¶ms);
|
|
||||||
void ProcessPhysical(int32 id);
|
|
||||||
void ProcessPlane(cVehicleParams& params);
|
|
||||||
void ProcessPlayersVehicleEngine(cVehicleParams& params, CAutomobile *automobile);
|
|
||||||
void ProcessPoliceCellBeatingScriptObject(uint8 sound);
|
|
||||||
void ProcessPornCinema(uint8 sound);
|
|
||||||
void ProcessProjectiles();
|
|
||||||
void ProcessRainOnVehicle(cVehicleParams& params);
|
|
||||||
void ProcessReverb() const;
|
|
||||||
bool ProcessReverseGear(cVehicleParams& params);
|
|
||||||
void ProcessSawMillScriptObject(uint8 sound);
|
|
||||||
void ProcessScriptObject(int32 id);
|
|
||||||
void ProcessShopScriptObject(uint8 sound);
|
|
||||||
void ProcessSpecial();
|
|
||||||
bool ProcessTrainNoise(cVehicleParams& params);
|
|
||||||
void ProcessVehicle(CVehicle *vehicle);
|
|
||||||
bool ProcessVehicleDoors(cVehicleParams& params);
|
|
||||||
void ProcessVehicleEngine(cVehicleParams& params);
|
|
||||||
void ProcessVehicleHorn(cVehicleParams& params);
|
|
||||||
void ProcessVehicleOneShots(cVehicleParams& params);
|
|
||||||
bool ProcessVehicleReverseWarning(cVehicleParams& params);
|
|
||||||
bool ProcessVehicleRoadNoise(cVehicleParams& params);
|
|
||||||
bool ProcessVehicleSirenOrAlarm(cVehicleParams& params);
|
|
||||||
bool ProcessVehicleSkidding(cVehicleParams& params);
|
|
||||||
void ProcessWaterCannon(int32);
|
|
||||||
void ProcessWeather(int32 id);
|
|
||||||
bool ProcessWetRoadNoise(cVehicleParams& params);
|
|
||||||
void ProcessWorkShopScriptObject(uint8 sound);
|
|
||||||
|
|
||||||
int32 RandomDisplacement(uint32 seed) const;
|
|
||||||
void ReacquireDigitalHandle() const;
|
|
||||||
void ReleaseDigitalHandle() const;
|
|
||||||
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2,
|
|
||||||
float collisionPower, float intensity2);
|
|
||||||
void ReportCrime(eCrimeType crime, const CVector &pos);
|
|
||||||
void ResetAudioLogicTimers(uint32 timer);
|
|
||||||
void ResetPoliceRadio();
|
|
||||||
void ResetTimers(uint32 time);
|
|
||||||
|
|
||||||
void Service();
|
|
||||||
void ServiceCollisions();
|
|
||||||
void ServicePoliceRadio();
|
|
||||||
void ServicePoliceRadioChannel(uint8 wantedLevel);
|
|
||||||
void ServiceSoundEffects();
|
|
||||||
int8 SetCurrent3DProvider(uint8 which);
|
|
||||||
void SetDynamicAcousticModelingStatus(uint8 status);
|
|
||||||
void SetEffectsFadeVol(uint8 volume) const;
|
|
||||||
void SetEffectsMasterVolume(uint8 volume) const;
|
|
||||||
void SetEntityStatus(int32 id, uint8 status);
|
|
||||||
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
|
|
||||||
void SetMissionAudioLocation(float x, float y, float z);
|
|
||||||
void SetMissionScriptPoliceAudio(int32 sfx) const;
|
|
||||||
void SetMonoMode(uint8 mono);
|
|
||||||
void SetMusicFadeVol(uint8 volume) const;
|
|
||||||
void SetMusicMasterVolume(uint8 volume) const;
|
|
||||||
void SetSpeakerConfig(int32 conf) const;
|
|
||||||
void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
|
|
||||||
void SetUpOneShotCollisionSound(const cAudioCollision &col);
|
|
||||||
bool SetupCrimeReport();
|
|
||||||
bool SetupJumboEngineSound(uint8 vol, uint32 freq);
|
|
||||||
bool SetupJumboFlySound(uint8 emittingVol);
|
|
||||||
bool SetupJumboRumbleSound(uint8 emittingVol);
|
|
||||||
bool SetupJumboTaxiSound(uint8 vol);
|
|
||||||
bool SetupJumboWhineSound(uint8 emittingVol, uint32 freq);
|
|
||||||
void SetupPedComments(cPedParams ¶ms, uint16 sound);
|
|
||||||
void SetupSuspectLastSeenReport();
|
|
||||||
|
|
||||||
void Terminate();
|
void Terminate();
|
||||||
void TranslateEntity(Const CVector *v1, CVector *v2) const;
|
void Service();
|
||||||
|
int32 CreateEntity(eAudioType type, void *entity);
|
||||||
void UpdateGasPedalAudio(CAutomobile *automobile);
|
void DestroyEntity(int32 id);
|
||||||
void UpdateReflections();
|
bool8 GetEntityStatus(int32 id);
|
||||||
bool UsesReverseWarning(int32 model) const;
|
void SetEntityStatus(int32 id, bool8 status);
|
||||||
bool UsesSiren(int32 model) const;
|
void *GetEntityPointer(int32 id);
|
||||||
bool UsesSirenSwitching(int32 model) const;
|
void PlayOneShot(int32 index, uint16 sound, float vol);
|
||||||
|
void SetEffectsMasterVolume(uint8 volume);
|
||||||
|
void SetMusicMasterVolume(uint8 volume);
|
||||||
|
void SetEffectsFadeVol(uint8 volume);
|
||||||
|
void SetMusicFadeVol(uint8 volume);
|
||||||
|
void SetMonoMode(bool8 mono);
|
||||||
|
void ResetTimers(uint32 time);
|
||||||
|
void DestroyAllGameCreatedEntities();
|
||||||
|
|
||||||
#ifdef GTA_PC
|
#ifdef GTA_PC
|
||||||
// only used in pc
|
uint8 GetNum3DProvidersAvailable();
|
||||||
void AdjustSamplesVolume();
|
char *Get3DProviderName(uint8 id);
|
||||||
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
|
int8 GetCurrent3DProviderIndex();
|
||||||
|
int8 SetCurrent3DProvider(uint8 which);
|
||||||
|
void SetSpeakerConfig(int32 conf);
|
||||||
|
bool8 IsMP3RadioChannelAvailable();
|
||||||
|
void ReleaseDigitalHandle();
|
||||||
|
void ReacquireDigitalHandle();
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
|
void SetDynamicAcousticModelingStatus(bool8 status);
|
||||||
#endif
|
#endif
|
||||||
|
bool8 CheckForAnAudioFileOnCD();
|
||||||
|
char GetCDAudioDriveLetter();
|
||||||
|
bool8 IsAudioInitialised();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ServiceSoundEffects();
|
||||||
|
uint32 FL(float f); // not used
|
||||||
|
uint8 ComputeVolume(uint8 emittingVolume, float maxDistance, float distance);
|
||||||
|
void TranslateEntity(Const CVector *v1, CVector *v2);
|
||||||
|
int32 ComputePan(float, CVector *);
|
||||||
|
uint32 ComputeDopplerEffectedFrequency(uint32 oldFreq, float position1, float position2, float speedMultiplier); // inlined on PS2
|
||||||
|
int32 RandomDisplacement(uint32 seed);
|
||||||
|
void InterrogateAudioEntities(); // inlined on PS2
|
||||||
|
void AddSampleToRequestedQueue();
|
||||||
|
void AddDetailsToRequestedOrderList(uint8 sample); // inlined on PS2
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
|
void AddReflectionsToRequestedQueue();
|
||||||
|
void UpdateReflections();
|
||||||
|
#endif
|
||||||
|
void AddReleasingSounds();
|
||||||
|
void ProcessActiveQueues();
|
||||||
|
void ClearRequestedQueue(); // inlined on PS2
|
||||||
|
void ClearActiveSamples();
|
||||||
|
void GenerateIntegerRandomNumberTable(); // inlined on PS2
|
||||||
|
void LoadBankIfNecessary(uint8 bank); // this is used only on PS2 but technically not a platform code
|
||||||
|
|
||||||
|
#ifdef EXTERNAL_3D_SOUND // actually must have been && AUDIO_MSS as well
|
||||||
|
void AdjustSamplesVolume();
|
||||||
|
uint8 ComputeEmittingVolume(uint8 emittingVolume, float maxDistance, float distance);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// audio logic
|
||||||
|
void PreInitialiseGameSpecificSetup();
|
||||||
|
void PostInitialiseGameSpecificSetup();
|
||||||
|
void PreTerminateGameSpecificShutdown();
|
||||||
|
void PostTerminateGameSpecificShutdown();
|
||||||
|
void ResetAudioLogicTimers(uint32 timer);
|
||||||
|
void ProcessReverb();
|
||||||
|
float GetDistanceSquared(const CVector &v);
|
||||||
|
void CalculateDistance(bool8 &condition, float dist);
|
||||||
|
void ProcessSpecial();
|
||||||
|
void ProcessEntity(int32 sound);
|
||||||
|
void ProcessPhysical(int32 id);
|
||||||
|
|
||||||
|
// vehicles
|
||||||
|
void ProcessVehicle(CVehicle *vehicle);
|
||||||
|
void ProcessRainOnVehicle(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessReverseGear(cVehicleParams ¶ms);
|
||||||
|
void ProcessModelCarEngine(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessVehicleRoadNoise(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessWetRoadNoise(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessVehicleEngine(cVehicleParams ¶ms);
|
||||||
|
void UpdateGasPedalAudio(CAutomobile *automobile); // inlined on PS2
|
||||||
|
void PlayerJustGotInCar();
|
||||||
|
void PlayerJustLeftCar();
|
||||||
|
void AddPlayerCarSample(uint8 emittingVolume, uint32 freq, uint32 sample, uint8 bank, uint8 counter, bool8 notLooping);
|
||||||
|
void ProcessCesna(cVehicleParams ¶ms);
|
||||||
|
void ProcessPlayersVehicleEngine(cVehicleParams ¶ms, CAutomobile *automobile);
|
||||||
|
bool8 ProcessVehicleSkidding(cVehicleParams ¶ms);
|
||||||
|
float GetVehicleDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange);
|
||||||
|
float GetVehicleNonDriveWheelSkidValue(uint8 wheel, CAutomobile *automobile, cTransmission *transmission, float velocityChange); // inlined on PS2
|
||||||
|
void ProcessVehicleHorn(cVehicleParams ¶ms);
|
||||||
|
bool8 UsesSiren(uint32 model); // inlined on PS2
|
||||||
|
bool8 UsesSirenSwitching(uint32 model); // inlined on PS2
|
||||||
|
bool8 ProcessVehicleSirenOrAlarm(cVehicleParams ¶ms);
|
||||||
|
bool8 UsesReverseWarning(uint32 model); // inlined on PS2
|
||||||
|
bool8 ProcessVehicleReverseWarning(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessVehicleDoors(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessAirBrakes(cVehicleParams ¶ms);
|
||||||
|
bool8 HasAirBrakes(uint32 model); // inlined on PS2
|
||||||
|
bool8 ProcessEngineDamage(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessCarBombTick(cVehicleParams ¶ms);
|
||||||
|
void ProcessVehicleOneShots(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessTrainNoise(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessBoatEngine(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessBoatMovingOverWater(cVehicleParams ¶ms);
|
||||||
|
bool8 ProcessHelicopter(cVehicleParams ¶ms);
|
||||||
|
void ProcessPlane(cVehicleParams ¶ms); // inlined on PS2
|
||||||
|
void ProcessJumbo(cVehicleParams ¶ms);
|
||||||
|
void ProcessJumboTaxi(); // inlined on PS2
|
||||||
|
void ProcessJumboAccel(CPlane *plane);
|
||||||
|
void ProcessJumboTakeOff(CPlane *plane); // inlined on PS2
|
||||||
|
void ProcessJumboFlying(); // inlined on PS2
|
||||||
|
void ProcessJumboLanding(CPlane *plane); // inlined on PS2
|
||||||
|
void ProcessJumboDecel(CPlane *plane); // inlined on PS2
|
||||||
|
bool8 SetupJumboTaxiSound(uint8 vol);
|
||||||
|
bool8 SetupJumboWhineSound(uint8 emittingVol, uint32 freq);
|
||||||
|
bool8 SetupJumboEngineSound(uint8 vol, uint32 freq);
|
||||||
|
bool8 SetupJumboFlySound(uint8 emittingVol);
|
||||||
|
bool8 SetupJumboRumbleSound(uint8 emittingVol);
|
||||||
|
int32 GetJumboTaxiFreq(); // inlined on PS2
|
||||||
|
|
||||||
|
// peds
|
||||||
|
void ProcessPed(CPhysical *ped); // inlined on PS2
|
||||||
|
void ProcessPedHeadphones(cPedParams ¶ms);
|
||||||
|
void ProcessPedOneShots(cPedParams ¶ms);
|
||||||
|
|
||||||
|
// ped comments
|
||||||
|
void SetupPedComments(cPedParams ¶ms, uint16 sound);
|
||||||
|
int32 GetPedCommentSfx(CPed *ped, uint16 sound);
|
||||||
|
void GetPhrase(uint32 &phrase, uint32 &prevPhrase, uint32 sample, uint32 maxOffset); // inlined on PS2
|
||||||
|
uint32 GetPlayerTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetCopTalkSfx(uint16 sound);
|
||||||
|
uint32 GetSwatTalkSfx(uint16 sound);
|
||||||
|
uint32 GetFBITalkSfx(uint16 sound);
|
||||||
|
uint32 GetArmyTalkSfx(uint16 sound);
|
||||||
|
uint32 GetMedicTalkSfx(uint16 sound);
|
||||||
|
uint32 GetFiremanTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetBusinessMaleOldTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBusinessMaleYoungTalkSfx(uint16 sound, uint32 model);
|
||||||
|
uint32 GetMafiaTalkSfx(uint16 sound);
|
||||||
|
uint32 GetTriadTalkSfx(uint16 sound);
|
||||||
|
uint32 GetDiabloTalkSfx(uint16 sound);
|
||||||
|
uint32 GetYakuzaTalkSfx(uint16 sound);
|
||||||
|
uint32 GetYardieTalkSfx(uint16 sound);
|
||||||
|
uint32 GetColumbianTalkSfx(uint16 sound);
|
||||||
|
uint32 GetHoodTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackCriminalTalkSfx(uint16 sound);
|
||||||
|
uint32 GetWhiteCriminalTalkSfx(uint16 sound);
|
||||||
|
uint32 GetCasualMaleOldTalkSfx(uint16 sound);
|
||||||
|
uint32 GetCasualMaleYoungTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackCasualFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetWhiteCasualFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetFemaleNo3TalkSfx(uint16 sound);
|
||||||
|
uint32 GetWhiteBusinessFemaleTalkSfx(uint16 sound, uint32 model);
|
||||||
|
uint32 GetBlackFatFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetWhiteFatMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackFatMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetWhiteFatFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackFemaleProstituteTalkSfx(uint16 sound);
|
||||||
|
uint32 GetWhiteFemaleProstituteTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackProjectMaleTalkSfx(uint16 sound, uint32 model);
|
||||||
|
uint32 GetBlackProjectFemaleOldTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackProjectFemaleYoungTalkSfx(uint16 sound);
|
||||||
|
uint32 GetChinatownMaleOldTalkSfx(uint16 sound);
|
||||||
|
uint32 GetChinatownMaleYoungTalkSfx(uint16 sound);
|
||||||
|
uint32 GetChinatownFemaleOldTalkSfx(uint16 sound);
|
||||||
|
uint32 GetChinatownFemaleYoungTalkSfx(uint16 sound);
|
||||||
|
uint32 GetLittleItalyMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetLittleItalyFemaleOldTalkSfx(uint16 sound);
|
||||||
|
uint32 GetLittleItalyFemaleYoungTalkSfx(uint16 sound);
|
||||||
|
uint32 GetWhiteDockerMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackDockerMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetScumMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetScumFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetWhiteWorkerMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackWorkerMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackBusinessFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetSupermodelMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetSupermodelFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetStewardMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetStewardFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetFanMaleTalkSfx(uint16 sound, uint32 model);
|
||||||
|
uint32 GetFanFemaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetHospitalMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetHospitalFemaleTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetWhiteConstructionWorkerTalkSfx(uint16 sound);
|
||||||
|
uint32 GetBlackConstructionWorkerTalkSfx(uint16 sound);
|
||||||
|
uint32 GetShopperFemaleTalkSfx(uint16 sound, uint32 model);
|
||||||
|
uint32 GetStudentMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetStudentFemaleTalkSfx(uint16 sound);
|
||||||
|
|
||||||
|
uint32 GetSpecialCharacterTalkSfx(uint32 modelIndex, uint16 sound);
|
||||||
|
uint32 GetEightBallTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetSalvatoreTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetMistyTalkSfx(uint16 sound);
|
||||||
|
uint32 GetOldJapTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetCatalinaTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetBomberTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetSecurityGuardTalkSfx(uint16 sound);
|
||||||
|
uint32 GetChunkyTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
|
||||||
|
uint32 GetAsianTaxiDriverTalkSfx(uint16 sound); // inlined on PS2
|
||||||
|
uint32 GetPimpTalkSfx(uint16 sound);
|
||||||
|
uint32 GetNormalMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetGenericMaleTalkSfx(uint16 sound);
|
||||||
|
uint32 GetGenericFemaleTalkSfx(uint16 sound);
|
||||||
|
|
||||||
|
// particles
|
||||||
|
void ProcessExplosions(int32 explosion);
|
||||||
|
void ProcessFires(int32 entity);
|
||||||
|
void ProcessWaterCannon(int32);
|
||||||
|
|
||||||
|
// script objects
|
||||||
|
void ProcessScriptObject(int32 id); // inlined on PS2
|
||||||
|
void ProcessOneShotScriptObject(uint8 sound);
|
||||||
|
void ProcessLoopingScriptObject(uint8 sound);
|
||||||
|
void ProcessPornCinema(uint8 sound);
|
||||||
|
void ProcessWorkShopScriptObject(uint8 sound);
|
||||||
|
void ProcessSawMillScriptObject(uint8 sound);
|
||||||
|
void ProcessLaunderetteScriptObject(uint8 sound);
|
||||||
|
void ProcessShopScriptObject(uint8 sound);
|
||||||
|
void ProcessAirportScriptObject(uint8 sound);
|
||||||
|
void ProcessCinemaScriptObject(uint8 sound);
|
||||||
|
void ProcessDocksScriptObject(uint8 sound);
|
||||||
|
void ProcessHomeScriptObject(uint8 sound);
|
||||||
|
void ProcessPoliceCellBeatingScriptObject(uint8 sound);
|
||||||
|
|
||||||
|
// misc
|
||||||
|
void ProcessWeather(int32 id);
|
||||||
|
void ProcessFrontEnd();
|
||||||
|
void ProcessCrane();
|
||||||
|
void ProcessProjectiles();
|
||||||
|
void ProcessGarages();
|
||||||
|
void ProcessFireHydrant();
|
||||||
|
|
||||||
|
// bridge
|
||||||
|
void ProcessBridge(); // inlined on PS2
|
||||||
|
void ProcessBridgeWarning();
|
||||||
|
void ProcessBridgeMotor();
|
||||||
|
void ProcessBridgeOneShots();
|
||||||
|
|
||||||
|
// mission audio
|
||||||
|
bool8 MissionScriptAudioUsesPoliceChannel(uint32 soundMission);
|
||||||
|
void PreloadMissionAudio(Const char *name);
|
||||||
|
uint8 GetMissionAudioLoadingStatus();
|
||||||
|
void SetMissionAudioLocation(float x, float y, float z);
|
||||||
|
void PlayLoadedMissionAudio();
|
||||||
|
bool8 IsMissionAudioSampleFinished();
|
||||||
|
bool8 IsMissionAudioSamplePlaying() { return m_nMissionAudioPlayStatus == PLAY_STATUS_PLAYING; }
|
||||||
|
bool8 ShouldDuckMissionAudio() { return IsMissionAudioSamplePlaying(); }
|
||||||
|
void ClearMissionAudio();
|
||||||
|
void ProcessMissionAudio();
|
||||||
|
|
||||||
|
// police radio
|
||||||
|
void InitialisePoliceRadioZones();
|
||||||
|
void InitialisePoliceRadio();
|
||||||
|
void ResetPoliceRadio();
|
||||||
|
void SetMissionScriptPoliceAudio(uint32 sfx);
|
||||||
|
int8 GetMissionScriptPoliceAudioPlayingStatus();
|
||||||
|
void DoPoliceRadioCrackle();
|
||||||
|
void ServicePoliceRadio();
|
||||||
|
void ServicePoliceRadioChannel(uint8 wantedLevel);
|
||||||
|
bool8 SetupCrimeReport();
|
||||||
|
void SetupSuspectLastSeenReport();
|
||||||
|
void ReportCrime(eCrimeType crime, const CVector &pos);
|
||||||
|
void PlaySuspectLastSeen(float x, float y, float z);
|
||||||
|
void AgeCrimes(); // inlined on PS2
|
||||||
|
|
||||||
|
// collision stuff
|
||||||
|
void ReportCollision(CEntity *entity1, CEntity *entity2, uint8 surface1, uint8 surface2, float collisionPower, float intensity2);
|
||||||
|
void ServiceCollisions();
|
||||||
|
void SetUpOneShotCollisionSound(const cAudioCollision &col);
|
||||||
|
void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
|
||||||
|
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
|
||||||
|
float GetCollisionOneShotRatio(uint32 a, float b);
|
||||||
|
float GetCollisionLoopingRatio(uint32 a, uint32 b, float c); // not used
|
||||||
|
float GetCollisionRatio(float a, float b, float c, float d); // inlined on PS2
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef AUDIO_MSS
|
/*
|
||||||
|
Manual loop points are not on PS2 so let's have these macros to avoid massive ifndefs.
|
||||||
|
Setting these manually was pointless anyway since they never change from sdt values.
|
||||||
|
What were they thinking?
|
||||||
|
*/
|
||||||
|
#ifndef GTA_PS2
|
||||||
|
#define RESET_LOOP_OFFSETS \
|
||||||
|
m_sQueueSample.m_nLoopStart = 0; \
|
||||||
|
m_sQueueSample.m_nLoopEnd = -1;
|
||||||
|
#define SET_LOOP_OFFSETS(sample) \
|
||||||
|
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(sample); \
|
||||||
|
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(sample);
|
||||||
|
#else
|
||||||
|
#define RESET_LOOP_OFFSETS
|
||||||
|
#define SET_LOOP_OFFSETS(sample)
|
||||||
|
#endif
|
||||||
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
|
#define SET_EMITTING_VOLUME(vol) m_sQueueSample.m_nEmittingVolume = vol
|
||||||
|
#else
|
||||||
|
#define SET_EMITTING_VOLUME(vol)
|
||||||
|
#endif
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
|
#define SET_SOUND_REFLECTION(b) m_sQueueSample.m_bReflections = b
|
||||||
|
#else
|
||||||
|
#define SET_SOUND_REFLECTION(b)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(AUDIO_MSS) && !defined(PS2_AUDIO_CHANNELS)
|
||||||
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
static_assert(sizeof(cAudioManager) == 19220, "cAudioManager: error");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "AudioScriptObject.h"
|
#include "AudioScriptObject.h"
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
cAudioScriptObject::cAudioScriptObject()
|
cAudioScriptObject::cAudioScriptObject()
|
||||||
{
|
{
|
||||||
@ -23,25 +24,25 @@ cAudioScriptObject::Reset()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
cAudioScriptObject::operator new(size_t sz)
|
cAudioScriptObject::operator new(size_t sz) throw()
|
||||||
{
|
{
|
||||||
return CPools::GetAudioScriptObjectPool()->New();
|
return CPools::GetAudioScriptObjectPool()->New();
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
cAudioScriptObject::operator new(size_t sz, int handle)
|
cAudioScriptObject::operator new(size_t sz, int handle) throw()
|
||||||
{
|
{
|
||||||
return CPools::GetAudioScriptObjectPool()->New(handle);
|
return CPools::GetAudioScriptObjectPool()->New(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioScriptObject::operator delete(void *p, size_t sz)
|
cAudioScriptObject::operator delete(void *p, size_t sz) throw()
|
||||||
{
|
{
|
||||||
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioScriptObject::operator delete(void *p, int handle)
|
cAudioScriptObject::operator delete(void *p, int handle) throw()
|
||||||
{
|
{
|
||||||
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
CPools::GetAudioScriptObjectPool()->Delete((cAudioScriptObject *)p);
|
||||||
}
|
}
|
||||||
@ -53,12 +54,14 @@ cAudioScriptObject::LoadAllAudioScriptObjects(uint8 *buf, uint32 size)
|
|||||||
|
|
||||||
CheckSaveHeader(buf, 'A', 'U', 'D', '\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'A', 'U', 'D', '\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
int32 pool_size = ReadSaveBuf<int32>(buf);
|
int32 pool_size;
|
||||||
|
ReadSaveBuf(&pool_size, buf);
|
||||||
for (int32 i = 0; i < pool_size; i++) {
|
for (int32 i = 0; i < pool_size; i++) {
|
||||||
int handle = ReadSaveBuf<int32>(buf);
|
int32 handle;
|
||||||
|
ReadSaveBuf(&handle, buf);
|
||||||
cAudioScriptObject *p = new(handle) cAudioScriptObject;
|
cAudioScriptObject *p = new(handle) cAudioScriptObject;
|
||||||
assert(p != nil);
|
assert(p != nil);
|
||||||
*p = ReadSaveBuf<cAudioScriptObject>(buf);
|
ReadSaveBuf(p, buf);
|
||||||
p->AudioEntity = DMAudio.CreateLoopingScriptObject(p);
|
p->AudioEntity = DMAudio.CreateLoopingScriptObject(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,10 +12,10 @@ public:
|
|||||||
|
|
||||||
void Reset(); /// ok
|
void Reset(); /// ok
|
||||||
|
|
||||||
static void* operator new(size_t);
|
static void* operator new(size_t) throw();
|
||||||
static void* operator new(size_t, int);
|
static void* operator new(size_t, int) throw();
|
||||||
static void operator delete(void*, size_t);
|
static void operator delete(void*, size_t) throw();
|
||||||
static void operator delete(void*, int);
|
static void operator delete(void*, int) throw();
|
||||||
|
|
||||||
static void LoadAllAudioScriptObjects(uint8 *buf, uint32 size);
|
static void LoadAllAudioScriptObjects(uint8 *buf, uint32 size);
|
||||||
static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size);
|
static void SaveAllAudioScriptObjects(uint8 *buf, uint32 *size);
|
||||||
|
@ -38,8 +38,14 @@ cDMAudio::DestroyEntity(int32 audioEntity)
|
|||||||
AudioManager.DestroyEntity(audioEntity);
|
AudioManager.DestroyEntity(audioEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool8
|
||||||
|
cDMAudio::GetEntityStatus(int32 audioEntity)
|
||||||
|
{
|
||||||
|
return AudioManager.GetEntityStatus(audioEntity);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::SetEntityStatus(int32 audioEntity, uint8 status)
|
cDMAudio::SetEntityStatus(int32 audioEntity, bool8 status)
|
||||||
{
|
{
|
||||||
AudioManager.SetEntityStatus(audioEntity, status);
|
AudioManager.SetEntityStatus(audioEntity, status);
|
||||||
}
|
}
|
||||||
@ -57,7 +63,7 @@ cDMAudio::DestroyAllGameCreatedEntities(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::SetMonoMode(uint8 mono)
|
cDMAudio::SetMonoMode(bool8 mono)
|
||||||
{
|
{
|
||||||
AudioManager.SetMonoMode(mono);
|
AudioManager.SetMonoMode(mono);
|
||||||
}
|
}
|
||||||
@ -128,7 +134,7 @@ cDMAudio::SetSpeakerConfig(int32 config)
|
|||||||
AudioManager.SetSpeakerConfig(config);
|
AudioManager.SetSpeakerConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cDMAudio::IsMP3RadioChannelAvailable(void)
|
cDMAudio::IsMP3RadioChannelAvailable(void)
|
||||||
{
|
{
|
||||||
return AudioManager.IsMP3RadioChannelAvailable();
|
return AudioManager.IsMP3RadioChannelAvailable();
|
||||||
@ -147,12 +153,14 @@ cDMAudio::ReacquireDigitalHandle(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::SetDynamicAcousticModelingStatus(uint8 status)
|
cDMAudio::SetDynamicAcousticModelingStatus(bool8 status)
|
||||||
{
|
{
|
||||||
|
#ifdef AUDIO_REFLECTIONS
|
||||||
AudioManager.SetDynamicAcousticModelingStatus(status);
|
AudioManager.SetDynamicAcousticModelingStatus(status);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cDMAudio::CheckForAnAudioFileOnCD(void)
|
cDMAudio::CheckForAnAudioFileOnCD(void)
|
||||||
{
|
{
|
||||||
return AudioManager.CheckForAnAudioFileOnCD();
|
return AudioManager.CheckForAnAudioFileOnCD();
|
||||||
@ -164,12 +172,18 @@ cDMAudio::GetCDAudioDriveLetter(void)
|
|||||||
return AudioManager.GetCDAudioDriveLetter();
|
return AudioManager.GetCDAudioDriveLetter();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cDMAudio::IsAudioInitialised(void)
|
cDMAudio::IsAudioInitialised(void)
|
||||||
{
|
{
|
||||||
return AudioManager.IsAudioInitialised();
|
return AudioManager.IsAudioInitialised();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
cDMAudio::ResetPoliceRadio()
|
||||||
|
{
|
||||||
|
AudioManager.ResetPoliceRadio();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
|
cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
|
||||||
{
|
{
|
||||||
@ -182,7 +196,7 @@ cDMAudio::CreateLoopingScriptObject(cAudioScriptObject *scriptObject)
|
|||||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
||||||
|
|
||||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||||
AudioManager.SetEntityStatus(audioEntity, true);
|
AudioManager.SetEntityStatus(audioEntity, TRUE);
|
||||||
|
|
||||||
return audioEntity;
|
return audioEntity;
|
||||||
}
|
}
|
||||||
@ -200,7 +214,7 @@ cDMAudio::CreateOneShotScriptObject(cAudioScriptObject *scriptObject)
|
|||||||
|
|
||||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||||
{
|
{
|
||||||
AudioManager.SetEntityStatus(audioEntity, true);
|
AudioManager.SetEntityStatus(audioEntity, TRUE);
|
||||||
AudioManager.PlayOneShot(audioEntity, scriptObject->AudioId, 0.0f);
|
AudioManager.PlayOneShot(audioEntity, scriptObject->AudioId, 0.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -230,7 +244,7 @@ cDMAudio::PlayRadioAnnouncement(uint8 announcement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cDMAudio::PlayFrontEndTrack(uint8 track, uint8 frontendFlag)
|
cDMAudio::PlayFrontEndTrack(uint8 track, bool8 frontendFlag)
|
||||||
{
|
{
|
||||||
MusicManager.PlayFrontEndTrack(track, frontendFlag);
|
MusicManager.PlayFrontEndTrack(track, frontendFlag);
|
||||||
}
|
}
|
||||||
@ -295,7 +309,7 @@ cDMAudio::PlayLoadedMissionAudio(void)
|
|||||||
AudioManager.PlayLoadedMissionAudio();
|
AudioManager.PlayLoadedMissionAudio();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cDMAudio::IsMissionAudioSampleFinished(void)
|
cDMAudio::IsMissionAudioSampleFinished(void)
|
||||||
{
|
{
|
||||||
return AudioManager.IsMissionAudioSampleFinished();
|
return AudioManager.IsMissionAudioSampleFinished();
|
||||||
|
@ -22,11 +22,12 @@ public:
|
|||||||
|
|
||||||
int32 CreateEntity(eAudioType type, void *UID);
|
int32 CreateEntity(eAudioType type, void *UID);
|
||||||
void DestroyEntity(int32 audioEntity);
|
void DestroyEntity(int32 audioEntity);
|
||||||
void SetEntityStatus(int32 audioEntity, uint8 status);
|
bool8 GetEntityStatus(int32 audioEntity);
|
||||||
|
void SetEntityStatus(int32 audioEntity, bool8 status);
|
||||||
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
|
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
|
||||||
void DestroyAllGameCreatedEntities(void);
|
void DestroyAllGameCreatedEntities(void);
|
||||||
|
|
||||||
void SetMonoMode(uint8 mono);
|
void SetMonoMode(bool8 mono);
|
||||||
void SetEffectsMasterVolume(uint8 volume);
|
void SetEffectsMasterVolume(uint8 volume);
|
||||||
void SetMusicMasterVolume(uint8 volume);
|
void SetMusicMasterVolume(uint8 volume);
|
||||||
void SetEffectsFadeVol(uint8 volume);
|
void SetEffectsFadeVol(uint8 volume);
|
||||||
@ -40,18 +41,19 @@ public:
|
|||||||
|
|
||||||
void SetSpeakerConfig(int32 config);
|
void SetSpeakerConfig(int32 config);
|
||||||
|
|
||||||
bool IsMP3RadioChannelAvailable(void);
|
bool8 IsMP3RadioChannelAvailable(void);
|
||||||
|
|
||||||
void ReleaseDigitalHandle(void);
|
void ReleaseDigitalHandle(void);
|
||||||
void ReacquireDigitalHandle(void);
|
void ReacquireDigitalHandle(void);
|
||||||
|
|
||||||
void SetDynamicAcousticModelingStatus(uint8 status);
|
void SetDynamicAcousticModelingStatus(bool8 status);
|
||||||
|
|
||||||
bool CheckForAnAudioFileOnCD(void);
|
bool8 CheckForAnAudioFileOnCD(void);
|
||||||
|
|
||||||
char GetCDAudioDriveLetter(void);
|
char GetCDAudioDriveLetter(void);
|
||||||
bool IsAudioInitialised(void);
|
bool8 IsAudioInitialised(void);
|
||||||
|
|
||||||
|
void ResetPoliceRadio();
|
||||||
void ReportCrime(eCrimeType crime, CVector const &pos);
|
void ReportCrime(eCrimeType crime, CVector const &pos);
|
||||||
|
|
||||||
int32 CreateLoopingScriptObject(cAudioScriptObject *scriptObject);
|
int32 CreateLoopingScriptObject(cAudioScriptObject *scriptObject);
|
||||||
@ -64,7 +66,7 @@ public:
|
|||||||
|
|
||||||
void PlayFrontEndSound(uint16 frontend, uint32 volume);
|
void PlayFrontEndSound(uint16 frontend, uint32 volume);
|
||||||
void PlayRadioAnnouncement(uint8 announcement);
|
void PlayRadioAnnouncement(uint8 announcement);
|
||||||
void PlayFrontEndTrack(uint8 track, uint8 frontendFlag);
|
void PlayFrontEndTrack(uint8 track, bool8 frontendFlag);
|
||||||
void StopFrontEndTrack(void);
|
void StopFrontEndTrack(void);
|
||||||
|
|
||||||
void ResetTimers(uint32 time);
|
void ResetTimers(uint32 time);
|
||||||
@ -79,7 +81,7 @@ public:
|
|||||||
uint8 GetMissionAudioLoadingStatus(void);
|
uint8 GetMissionAudioLoadingStatus(void);
|
||||||
void SetMissionAudioLocation(float x, float y, float z);
|
void SetMissionAudioLocation(float x, float y, float z);
|
||||||
void PlayLoadedMissionAudio(void);
|
void PlayLoadedMissionAudio(void);
|
||||||
bool IsMissionAudioSampleFinished(void);
|
bool8 IsMissionAudioSampleFinished(void);
|
||||||
void ClearMissionAudio(void);
|
void ClearMissionAudio(void);
|
||||||
|
|
||||||
uint8 GetRadioInCar(void);
|
uint8 GetRadioInCar(void);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -15,48 +15,48 @@ class CVehicle;
|
|||||||
class cMusicManager
|
class cMusicManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool m_bIsInitialised;
|
bool8 m_bIsInitialised;
|
||||||
bool m_bDisabled;
|
bool8 m_bDisabled;
|
||||||
uint8 m_nMusicMode;
|
uint8 m_nMusicMode;
|
||||||
uint8 m_nCurrentStreamedSound;
|
uint8 m_nNextTrack;
|
||||||
uint8 m_nPreviousStreamedSound;
|
uint8 m_nPlayingTrack;
|
||||||
bool m_bFrontendTrackFinished;
|
bool8 m_bFrontendTrackFinished;
|
||||||
bool m_bPlayInFrontend;
|
bool8 m_bPlayInFrontend;
|
||||||
bool m_bSetNextStation;
|
bool8 m_bSetNextStation;
|
||||||
uint8 m_nAnnouncement;
|
uint8 m_nAnnouncement;
|
||||||
bool m_bPreviousPlayerInCar;
|
bool8 m_bPreviousPlayerInCar;
|
||||||
bool m_bPlayerInCar;
|
bool8 m_bPlayerInCar;
|
||||||
bool m_bAnnouncementInProgress;
|
bool8 m_bAnnouncementInProgress;
|
||||||
tStreamedSample m_aTracks[TOTAL_STREAMED_SOUNDS];
|
tStreamedSample m_aTracks[TOTAL_STREAMED_SOUNDS];
|
||||||
bool m_bResetTimers;
|
bool8 m_bResetTimers;
|
||||||
uint32 m_nResetTime;
|
uint32 m_nResetTime;
|
||||||
uint32 m_nLastTrackServiceTime;
|
uint32 m_nLastTrackServiceTime;
|
||||||
uint32 m_nTimer;
|
uint32 m_nTimer;
|
||||||
bool m_bDoTrackService;
|
bool8 m_bDoTrackService;
|
||||||
bool m_bIgnoreTimeDelay;
|
bool8 m_bIgnoreTimeDelay;
|
||||||
bool m_bDontServiceAmbienceTrack;
|
bool8 m_bVerifyAmbienceTrackStartedToPlay;
|
||||||
bool m_bRadioSetByScript;
|
bool8 m_bRadioSetByScript;
|
||||||
uint8 m_nRadioStation;
|
uint8 m_nRadioStationScript;
|
||||||
int32 m_nRadioPosition;
|
int32 m_nRadioPosition;
|
||||||
uint8 m_nRadioInCar;
|
uint8 m_nRadioInCar;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cMusicManager();
|
cMusicManager();
|
||||||
bool IsInitialised() { return m_bIsInitialised; }
|
bool8 IsInitialised() { return m_bIsInitialised; }
|
||||||
uint32 GetMusicMode() { return m_nMusicMode; }
|
uint32 GetMusicMode() { return m_nMusicMode; }
|
||||||
uint8 GetCurrentTrack() { return m_nCurrentStreamedSound; }
|
uint8 GetNextTrack() { return m_nNextTrack; }
|
||||||
|
|
||||||
bool Initialise();
|
bool8 Initialise();
|
||||||
void Terminate();
|
void Terminate();
|
||||||
|
|
||||||
void ChangeMusicMode(uint8 mode);
|
void ChangeMusicMode(uint8 mode);
|
||||||
void StopFrontEndTrack();
|
void StopFrontEndTrack();
|
||||||
|
|
||||||
bool PlayerInCar();
|
bool8 PlayerInCar();
|
||||||
void DisplayRadioStationName();
|
void DisplayRadioStationName();
|
||||||
|
|
||||||
void PlayAnnouncement(uint8);
|
void PlayAnnouncement(uint8);
|
||||||
void PlayFrontEndTrack(uint8, uint8);
|
void PlayFrontEndTrack(uint8, bool8);
|
||||||
void PreloadCutSceneMusic(uint8);
|
void PreloadCutSceneMusic(uint8);
|
||||||
void PlayPreloadedCutSceneMusic(void);
|
void PlayPreloadedCutSceneMusic(void);
|
||||||
void StopCutSceneMusic(void);
|
void StopCutSceneMusic(void);
|
||||||
@ -73,15 +73,15 @@ public:
|
|||||||
void ServiceAmbience();
|
void ServiceAmbience();
|
||||||
void ServiceTrack();
|
void ServiceTrack();
|
||||||
|
|
||||||
bool UsesPoliceRadio(CVehicle *veh);
|
bool8 UsesPoliceRadio(CVehicle *veh);
|
||||||
uint32 GetTrackStartPos(uint8);
|
uint32 GetTrackStartPos(uint8);
|
||||||
|
|
||||||
void ComputeAmbienceVol(uint8 reset, uint8& outVolume);
|
void ComputeAmbienceVol(bool8 reset, uint8& outVolume);
|
||||||
bool ServiceAnnouncement();
|
bool8 ServiceAnnouncement();
|
||||||
|
|
||||||
uint8 GetCarTuning();
|
uint8 GetCarTuning();
|
||||||
uint8 GetNextCarTuning();
|
uint8 GetNextCarTuning();
|
||||||
bool ChangeRadioChannel();
|
bool8 ChangeRadioChannel();
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(cMusicManager, 0x95C);
|
VALIDATE_SIZE(cMusicManager, 0x95C);
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
#include "AudioSamples.h"
|
#include "AudioSamples.h"
|
||||||
#include "MusicManager.h"
|
#include "MusicManager.h"
|
||||||
#include "PlayerPed.h"
|
#include "PlayerPed.h"
|
||||||
#include "PoliceRadio.h"
|
#include "PolRadio.h"
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
@ -15,9 +15,6 @@
|
|||||||
#include "sampman.h"
|
#include "sampman.h"
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
|
|
||||||
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
|
|
||||||
const int policeChannel = channels + 1;
|
|
||||||
|
|
||||||
struct tPoliceRadioZone {
|
struct tPoliceRadioZone {
|
||||||
char m_aName[8];
|
char m_aName[8];
|
||||||
uint32 m_nSampleIndex;
|
uint32 m_nSampleIndex;
|
||||||
@ -28,9 +25,9 @@ tPoliceRadioZone ZoneSfx[NUMAUDIOZONES];
|
|||||||
char SubZo2Label[8];
|
char SubZo2Label[8];
|
||||||
char SubZo3Label[8];
|
char SubZo3Label[8];
|
||||||
|
|
||||||
int32 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
|
||||||
@ -88,14 +85,12 @@ cAudioManager::InitialisePoliceRadioZones()
|
|||||||
void
|
void
|
||||||
cAudioManager::InitialisePoliceRadio()
|
cAudioManager::InitialisePoliceRadio()
|
||||||
{
|
{
|
||||||
m_sPoliceRadioQueue.policeChannelTimer = 0;
|
m_sPoliceRadioQueue.Reset();
|
||||||
m_sPoliceRadioQueue.policeChannelTimerSeconds = 0;
|
for (int32 i = 0; i < ARRAY_SIZE(m_aCrimes); i++)
|
||||||
m_sPoliceRadioQueue.policeChannelCounterSeconds = 0;
|
m_aCrimes[i].type = CRIME_NONE;
|
||||||
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++)
|
|
||||||
m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
|
||||||
|
|
||||||
SampleManager.SetChannelReverbFlag(policeChannel, false);
|
SampleManager.SetChannelReverbFlag(CHANNEL_POLICE_RADIO, FALSE);
|
||||||
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;
|
||||||
}
|
}
|
||||||
@ -104,22 +99,22 @@ void
|
|||||||
cAudioManager::ResetPoliceRadio()
|
cAudioManager::ResetPoliceRadio()
|
||||||
{
|
{
|
||||||
if (!m_bIsInitialised) return;
|
if (!m_bIsInitialised) return;
|
||||||
if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel);
|
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||||
InitialisePoliceRadio();
|
InitialisePoliceRadio();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::SetMissionScriptPoliceAudio(int32 sfx) const
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int8
|
int8
|
||||||
cAudioManager::GetMissionScriptPoliceAudioPlayingStatus() const
|
cAudioManager::GetMissionScriptPoliceAudioPlayingStatus()
|
||||||
{
|
{
|
||||||
return g_nMissionAudioPlayingStatus;
|
return g_nMissionAudioPlayingStatus;
|
||||||
}
|
}
|
||||||
@ -131,19 +126,18 @@ cAudioManager::DoPoliceRadioCrackle()
|
|||||||
m_sQueueSample.m_nCounter = 0;
|
m_sQueueSample.m_nCounter = 0;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
|
m_sQueueSample.m_nSampleIndex = SFX_POLICE_RADIO_CRACKLE;
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
m_sQueueSample.m_bIs2D = true;
|
m_sQueueSample.m_bIs2D = TRUE;
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 10;
|
m_sQueueSample.m_nPriority = 10;
|
||||||
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
|
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_POLICE_RADIO_CRACKLE);
|
||||||
m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15;
|
m_sQueueSample.m_nVolume = m_anRandomTable[2] % 20 + 15;
|
||||||
m_sQueueSample.m_nLoopCount = 0;
|
m_sQueueSample.m_nLoopCount = 0;
|
||||||
m_sQueueSample.m_nEmittingVolume = m_sQueueSample.m_nVolume;
|
SET_EMITTING_VOLUME(m_sQueueSample.m_nVolume);
|
||||||
m_sQueueSample.m_nLoopStart = SampleManager.GetSampleLoopStartOffset(SFX_POLICE_RADIO_CRACKLE);
|
SET_LOOP_OFFSETS(SFX_POLICE_RADIO_CRACKLE)
|
||||||
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(SFX_POLICE_RADIO_CRACKLE);
|
m_sQueueSample.m_bStatic = FALSE;
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = false;
|
m_sQueueSample.m_bReverb = FALSE;
|
||||||
m_sQueueSample.m_bReverbFlag = false;
|
m_sQueueSample.m_nPan = 63;
|
||||||
m_sQueueSample.m_nOffset = 63;
|
m_sQueueSample.m_nFramesToPlay = 3;
|
||||||
m_sQueueSample.m_nReleasingVolumeDivider = 3;
|
SET_SOUND_REFLECTION(FALSE);
|
||||||
m_sQueueSample.m_bRequireReflection = false;
|
|
||||||
AddSampleToRequestedQueue();
|
AddSampleToRequestedQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,8 +149,8 @@ cAudioManager::ServicePoliceRadio()
|
|||||||
|
|
||||||
if(!m_bIsInitialised) return;
|
if(!m_bIsInitialised) return;
|
||||||
|
|
||||||
if(m_nUserPause == 0) {
|
if(!m_nUserPause) {
|
||||||
bool 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)
|
||||||
return;
|
return;
|
||||||
@ -165,7 +159,11 @@ cAudioManager::ServicePoliceRadio()
|
|||||||
if(!crimeReport) {
|
if(!crimeReport) {
|
||||||
if(wantedLevel != 0) {
|
if(wantedLevel != 0) {
|
||||||
if(nLastSeen != 0) {
|
if(nLastSeen != 0) {
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
nLastSeen -= CTimer::GetLogicalFramesPassed();
|
||||||
|
#else
|
||||||
--nLastSeen;
|
--nLastSeen;
|
||||||
|
#endif
|
||||||
} else {
|
} else {
|
||||||
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
|
nLastSeen = m_anRandomTable[1] % 1000 + 2000;
|
||||||
SetupSuspectLastSeenReport();
|
SetupSuspectLastSeenReport();
|
||||||
@ -179,104 +177,104 @@ cAudioManager::ServicePoliceRadio()
|
|||||||
void
|
void
|
||||||
cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
cAudioManager::ServicePoliceRadioChannel(uint8 wantedLevel)
|
||||||
{
|
{
|
||||||
bool processed = false;
|
bool8 processed = FALSE;
|
||||||
uint32 sample;
|
uint32 sample;
|
||||||
int32 freq;
|
int32 freq;
|
||||||
|
|
||||||
static int cWait = 0;
|
static int cWait = 0;
|
||||||
static bool bChannelOpen = false;
|
static bool8 bChannelOpen = FALSE;
|
||||||
static uint8 bMissionAudioPhysicalPlayingStatus = 0;
|
static uint8 bMissionAudioPhysicalPlayingStatus = PLAY_STATUS_STOPPED;
|
||||||
static int32 PoliceChannelFreq = 5500;
|
static int32 PoliceChannelFreq = 5500;
|
||||||
|
|
||||||
if (!m_bIsInitialised) return;
|
if (!m_bIsInitialised) return;
|
||||||
|
|
||||||
if (m_nUserPause != 0) {
|
if (m_nUserPause) {
|
||||||
if (SampleManager.GetChannelUsedFlag(policeChannel)) SampleManager.StopChannel(policeChannel);
|
if (SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
|
||||||
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == 1 &&
|
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING &&
|
||||||
SampleManager.IsStreamPlaying(1)) {
|
SampleManager.IsStreamPlaying(1)) {
|
||||||
SampleManager.PauseStream(1, 1);
|
SampleManager.PauseStream(TRUE, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (m_nPreviousUserPause && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES &&
|
if (m_nPreviousUserPause && g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES &&
|
||||||
bMissionAudioPhysicalPlayingStatus == 1) {
|
bMissionAudioPhysicalPlayingStatus == PLAY_STATUS_PLAYING) {
|
||||||
SampleManager.PauseStream(0, 1);
|
SampleManager.PauseStream(FALSE, 1);
|
||||||
}
|
}
|
||||||
if (m_sPoliceRadioQueue.policeChannelTimer == 0) bChannelOpen = false;
|
if (m_sPoliceRadioQueue.m_nSamplesInQueue == 0) bChannelOpen = FALSE;
|
||||||
if (cWait) {
|
if (cWait) {
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
cWait -= CTimer::GetLogicalFramesPassed();
|
||||||
|
#else
|
||||||
--cWait;
|
--cWait;
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && !bChannelOpen) {
|
if (g_nMissionAudioSfx != TOTAL_AUDIO_SAMPLES && !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 = TOTAL_AUDIO_SAMPLES;
|
g_nMissionAudioSfx = TOTAL_AUDIO_SAMPLES;
|
||||||
cWait = 30;
|
cWait = 30;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!SampleManager.GetChannelUsedFlag(policeChannel)) {
|
} else if (!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO)) {
|
||||||
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
|
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
|
||||||
SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 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 == TOTAL_AUDIO_SAMPLES || g_nMissionAudioPlayingStatus != 1) &&
|
if ((g_nMissionAudioSfx == TOTAL_AUDIO_SAMPLES || g_nMissionAudioPlayingStatus != PLAY_STATUS_PLAYING) &&
|
||||||
!SampleManager.GetChannelUsedFlag(policeChannel) && m_sPoliceRadioQueue.policeChannelTimer) {
|
!SampleManager.GetChannelUsedFlag(CHANNEL_POLICE_RADIO) && m_sPoliceRadioQueue.m_nSamplesInQueue != 0) {
|
||||||
if (m_sPoliceRadioQueue.policeChannelTimer) {
|
sample = m_sPoliceRadioQueue.Remove();
|
||||||
sample = m_sPoliceRadioQueue.crimesSamples[m_sPoliceRadioQueue.policeChannelCounterSeconds];
|
|
||||||
m_sPoliceRadioQueue.policeChannelTimer--;
|
|
||||||
m_sPoliceRadioQueue.policeChannelCounterSeconds = (m_sPoliceRadioQueue.policeChannelCounterSeconds + 1) % 60;
|
|
||||||
} else {
|
|
||||||
sample = TOTAL_AUDIO_SAMPLES;
|
|
||||||
}
|
|
||||||
if (wantedLevel == 0) {
|
if (wantedLevel == 0) {
|
||||||
if (gSpecialSuspectLastSeenReport) {
|
if (gSpecialSuspectLastSeenReport) {
|
||||||
gSpecialSuspectLastSeenReport = 0;
|
gSpecialSuspectLastSeenReport = FALSE;
|
||||||
} else if (((sample >= SFX_POLICE_RADIO_MESSAGE_NOISE_1) && (sample <= SFX_POLICE_RADIO_MESSAGE_NOISE_3)) || sample == TOTAL_AUDIO_SAMPLES) {
|
} else if (((sample >= SFX_POLICE_RADIO_MESSAGE_NOISE_1) && (sample <= SFX_POLICE_RADIO_MESSAGE_NOISE_3)) || sample == TOTAL_AUDIO_SAMPLES) {
|
||||||
bChannelOpen = false;
|
bChannelOpen = FALSE;
|
||||||
processed = true;
|
processed = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (sample == TOTAL_AUDIO_SAMPLES) {
|
if (sample == TOTAL_AUDIO_SAMPLES) {
|
||||||
if (!processed) cWait = 30;
|
if (!processed) cWait = 30;
|
||||||
} else {
|
} else {
|
||||||
SampleManager.InitialiseChannel(policeChannel, sample, 0);
|
SampleManager.InitialiseChannel(CHANNEL_POLICE_RADIO, sample, SFX_BANK_0);
|
||||||
switch (sample) {
|
switch (sample) {
|
||||||
case SFX_POLICE_RADIO_MESSAGE_NOISE_1:
|
case SFX_POLICE_RADIO_MESSAGE_NOISE_1:
|
||||||
case SFX_POLICE_RADIO_MESSAGE_NOISE_2:
|
case SFX_POLICE_RADIO_MESSAGE_NOISE_2:
|
||||||
case SFX_POLICE_RADIO_MESSAGE_NOISE_3:
|
case SFX_POLICE_RADIO_MESSAGE_NOISE_3:
|
||||||
freq = m_anRandomTable[4] % 2000 + 10025;
|
freq = m_anRandomTable[4] % 2000 + 10025;
|
||||||
bChannelOpen = bChannelOpen == false;
|
bChannelOpen = bChannelOpen == FALSE;
|
||||||
break;
|
break;
|
||||||
default: freq = SampleManager.GetSampleBaseFrequency(sample); break;
|
default: freq = SampleManager.GetSampleBaseFrequency(sample); break;
|
||||||
}
|
}
|
||||||
PoliceChannelFreq = freq;
|
PoliceChannelFreq = freq;
|
||||||
SampleManager.SetChannelFrequency(policeChannel, freq);
|
SampleManager.SetChannelFrequency(CHANNEL_POLICE_RADIO, freq);
|
||||||
SampleManager.SetChannelVolume(policeChannel, 100);
|
SampleManager.SetChannelVolume(CHANNEL_POLICE_RADIO, 100);
|
||||||
SampleManager.SetChannelPan(policeChannel, 63);
|
SampleManager.SetChannelPan(CHANNEL_POLICE_RADIO, 63);
|
||||||
SampleManager.SetChannelLoopCount(policeChannel, 1);
|
#ifndef GTA_PS2
|
||||||
SampleManager.SetChannelLoopPoints(policeChannel, 0, -1);
|
SampleManager.SetChannelLoopCount(CHANNEL_POLICE_RADIO, 1);
|
||||||
SampleManager.StartChannel(policeChannel);
|
SampleManager.SetChannelLoopPoints(CHANNEL_POLICE_RADIO, 0, -1);
|
||||||
|
#endif
|
||||||
|
SampleManager.StartChannel(CHANNEL_POLICE_RADIO);
|
||||||
}
|
}
|
||||||
if (processed) ResetPoliceRadio();
|
if (processed) ResetPoliceRadio();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cAudioManager::SetupCrimeReport()
|
cAudioManager::SetupCrimeReport()
|
||||||
{
|
{
|
||||||
int16 audioZoneId;
|
int16 audioZoneId;
|
||||||
@ -288,23 +286,23 @@ cAudioManager::SetupCrimeReport()
|
|||||||
float quarterX;
|
float quarterX;
|
||||||
float quarterY;
|
float quarterY;
|
||||||
int i;
|
int i;
|
||||||
int32 sampleIndex;
|
uint32 sampleIndex;
|
||||||
bool processed = false;
|
bool8 processed = FALSE;
|
||||||
|
|
||||||
if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return false;
|
if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) return FALSE;
|
||||||
|
|
||||||
if (60 - m_sPoliceRadioQueue.policeChannelTimer <= 9) {
|
if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue <= 9) {
|
||||||
AgeCrimes();
|
AgeCrimes();
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
for (i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||||
if (m_sPoliceRadioQueue.crimes[i].type != CRIME_NONE)
|
if (m_aCrimes[i].type != CRIME_NONE)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) return false;
|
if (i == ARRAY_SIZE(m_aCrimes)) return FALSE;
|
||||||
audioZoneId = CTheZones::FindAudioZone(&m_sPoliceRadioQueue.crimes[i].position);
|
audioZoneId = CTheZones::FindAudioZone(&m_aCrimes[i].position);
|
||||||
if (audioZoneId >= 0 && audioZoneId < NUMAUDIOZONES) {
|
if (audioZoneId >= 0 && audioZoneId < NUMAUDIOZONES) {
|
||||||
zone = CTheZones::GetAudioZone(audioZoneId);
|
zone = CTheZones::GetAudioZone(audioZoneId);
|
||||||
for (int j = 0; j < NUMAUDIOZONES; j++) {
|
for (int j = 0; j < NUMAUDIOZONES; j++) {
|
||||||
@ -313,14 +311,14 @@ cAudioManager::SetupCrimeReport()
|
|||||||
m_sPoliceRadioQueue.Add(m_anRandomTable[4] % 3 + SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
m_sPoliceRadioQueue.Add(m_anRandomTable[4] % 3 + SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||||
m_sPoliceRadioQueue.Add(m_anRandomTable[0] % 3 + SFX_WEVE_GOT);
|
m_sPoliceRadioQueue.Add(m_anRandomTable[0] % 3 + SFX_WEVE_GOT);
|
||||||
m_sPoliceRadioQueue.Add(m_anRandomTable[1] % 2 + SFX_A_10_1);
|
m_sPoliceRadioQueue.Add(m_anRandomTable[1] % 2 + SFX_A_10_1);
|
||||||
switch (m_sPoliceRadioQueue.crimes[i].type) {
|
switch (m_aCrimes[i].type) {
|
||||||
case CRIME_PED_BURNED: m_sPoliceRadioQueue.crimes[i].type = CRIME_HIT_PED; break;
|
case CRIME_PED_BURNED: m_aCrimes[i].type = CRIME_HIT_PED; break;
|
||||||
case CRIME_COP_BURNED: m_sPoliceRadioQueue.crimes[i].type = CRIME_HIT_COP; break;
|
case CRIME_COP_BURNED: m_aCrimes[i].type = CRIME_HIT_COP; break;
|
||||||
case CRIME_VEHICLE_BURNED: m_sPoliceRadioQueue.crimes[i].type = CRIME_STEAL_CAR; break;
|
case CRIME_VEHICLE_BURNED: m_aCrimes[i].type = CRIME_STEAL_CAR; break;
|
||||||
case CRIME_DESTROYED_CESSNA: m_sPoliceRadioQueue.crimes[i].type = CRIME_SHOOT_HELI; break;
|
case CRIME_DESTROYED_CESSNA: m_aCrimes[i].type = CRIME_SHOOT_HELI; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
m_sPoliceRadioQueue.Add(m_sPoliceRadioQueue.crimes[i].type + SFX_CRIME_1 - 1);
|
m_sPoliceRadioQueue.Add(m_aCrimes[i].type + SFX_CRIME_1 - 1);
|
||||||
m_sPoliceRadioQueue.Add(SFX_IN);
|
m_sPoliceRadioQueue.Add(SFX_IN);
|
||||||
if (sampleIndex == SFX_POLICE_RADIO_SHORESIDE_VALE &&
|
if (sampleIndex == SFX_POLICE_RADIO_SHORESIDE_VALE &&
|
||||||
(strcmp(zone->name, SubZo2Label) == 0 || strcmp(zone->name, SubZo3Label) == 0)) {
|
(strcmp(zone->name, SubZo2Label) == 0 || strcmp(zone->name, SubZo3Label) == 0)) {
|
||||||
@ -334,17 +332,17 @@ cAudioManager::SetupCrimeReport()
|
|||||||
quarterX = 0.25f * rangeX;
|
quarterX = 0.25f * rangeX;
|
||||||
quarterY = 0.25f * rangeY;
|
quarterY = 0.25f * rangeY;
|
||||||
|
|
||||||
if (m_sPoliceRadioQueue.crimes[i].position.y > halfY + quarterY) {
|
if (m_aCrimes[i].position.y > halfY + quarterY) {
|
||||||
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
||||||
processed = true;
|
processed = TRUE;
|
||||||
} else if (m_sPoliceRadioQueue.crimes[i].position.y < halfY - quarterY) {
|
} else if (m_aCrimes[i].position.y < halfY - quarterY) {
|
||||||
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
||||||
processed = true;
|
processed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_sPoliceRadioQueue.crimes[i].position.x > halfX + quarterX)
|
if (m_aCrimes[i].position.x > halfX + quarterX)
|
||||||
m_sPoliceRadioQueue.Add(SFX_EAST);
|
m_sPoliceRadioQueue.Add(SFX_EAST);
|
||||||
else if (m_sPoliceRadioQueue.crimes[i].position.x < halfX - quarterX)
|
else if (m_aCrimes[i].position.x < halfX - quarterX)
|
||||||
m_sPoliceRadioQueue.Add(SFX_WEST);
|
m_sPoliceRadioQueue.Add(SFX_WEST);
|
||||||
else if (!processed)
|
else if (!processed)
|
||||||
m_sPoliceRadioQueue.Add(SFX_CENTRAL);
|
m_sPoliceRadioQueue.Add(SFX_CENTRAL);
|
||||||
@ -357,9 +355,9 @@ cAudioManager::SetupCrimeReport()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
m_aCrimes[i].type = CRIME_NONE;
|
||||||
AgeCrimes();
|
AgeCrimes();
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -530,7 +528,7 @@ cAudioManager::SetupSuspectLastSeenReport()
|
|||||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
||||||
veh = FindPlayerVehicle();
|
veh = FindPlayerVehicle();
|
||||||
if (veh != nil) {
|
if (veh != nil) {
|
||||||
if (60 - m_sPoliceRadioQueue.policeChannelTimer > 9) {
|
if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 9) {
|
||||||
color1 = veh->m_currentColour1;
|
color1 = veh->m_currentColour1;
|
||||||
if (color1 >= ARRAY_SIZE(gCarColourTable)) {
|
if (color1 >= ARRAY_SIZE(gCarColourTable)) {
|
||||||
debug("\n *** UNKNOWN CAR COLOUR %d *** ", color1);
|
debug("\n *** UNKNOWN CAR COLOUR %d *** ", color1);
|
||||||
@ -663,7 +661,7 @@ cAudioManager::SetupSuspectLastSeenReport()
|
|||||||
m_sPoliceRadioQueue.Add(TOTAL_AUDIO_SAMPLES);
|
m_sPoliceRadioQueue.Add(TOTAL_AUDIO_SAMPLES);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (60 - m_sPoliceRadioQueue.policeChannelTimer > 4) {
|
} else if (POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 4) {
|
||||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_SUSPECT);
|
||||||
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_ON_FOOT);
|
m_sPoliceRadioQueue.Add(SFX_POLICE_RADIO_ON_FOOT);
|
||||||
@ -673,19 +671,17 @@ cAudioManager::SetupSuspectLastSeenReport()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
||||||
{
|
{
|
||||||
int32 lastCrime = ARRAY_SIZE(m_sPoliceRadioQueue.crimes);
|
int32 lastCrime = ARRAY_SIZE(m_aCrimes);
|
||||||
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 &&
|
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 &&
|
||||||
(type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) {
|
(type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) {
|
||||||
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
for (int32 i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||||
if (m_sPoliceRadioQueue.crimes[i].type) {
|
if (m_aCrimes[i].type != CRIME_NONE) {
|
||||||
if (m_sPoliceRadioQueue.crimes[i].type == type) {
|
if (m_aCrimes[i].type == type) {
|
||||||
m_sPoliceRadioQueue.crimes[i].position = pos;
|
m_aCrimes[i].position = pos;
|
||||||
m_sPoliceRadioQueue.crimes[i].timer = 0;
|
m_aCrimes[i].timer = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -693,10 +689,10 @@ cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastCrime < ARRAY_SIZE(m_sPoliceRadioQueue.crimes)) {
|
if (lastCrime < ARRAY_SIZE(m_aCrimes)) {
|
||||||
m_sPoliceRadioQueue.crimes[lastCrime].type = type;
|
m_aCrimes[lastCrime].type = type;
|
||||||
m_sPoliceRadioQueue.crimes[lastCrime].position = pos;
|
m_aCrimes[lastCrime].position = pos;
|
||||||
m_sPoliceRadioQueue.crimes[lastCrime].timer = 0;
|
m_aCrimes[lastCrime].timer = 0;
|
||||||
gMinTimeToNextReport[type] = m_FrameCounter + 500;
|
gMinTimeToNextReport[type] = m_FrameCounter + 500;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -714,12 +710,12 @@ cAudioManager::PlaySuspectLastSeen(float x, float y, float z)
|
|||||||
float quarterX;
|
float quarterX;
|
||||||
float quarterY;
|
float quarterY;
|
||||||
int32 sample;
|
int32 sample;
|
||||||
bool processed = false;
|
bool8 processed = false;
|
||||||
CVector vec = CVector(x, y, z);
|
CVector vec = CVector(x, y, z);
|
||||||
|
|
||||||
if (!m_bIsInitialised) return;
|
if (!m_bIsInitialised) return;
|
||||||
|
|
||||||
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && 60 - m_sPoliceRadioQueue.policeChannelTimer > 9) {
|
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && POLICE_RADIO_QUEUE_MAX_SAMPLES - m_sPoliceRadioQueue.m_nSamplesInQueue > 9) {
|
||||||
audioZone = CTheZones::FindAudioZone(&vec);
|
audioZone = CTheZones::FindAudioZone(&vec);
|
||||||
if (audioZone >= 0 && audioZone < NUMAUDIOZONES) {
|
if (audioZone >= 0 && audioZone < NUMAUDIOZONES) {
|
||||||
zone = CTheZones::GetAudioZone(audioZone);
|
zone = CTheZones::GetAudioZone(audioZone);
|
||||||
@ -745,10 +741,10 @@ cAudioManager::PlaySuspectLastSeen(float x, float y, float z)
|
|||||||
|
|
||||||
if (vec.y > halfY + quarterY) {
|
if (vec.y > halfY + quarterY) {
|
||||||
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
m_sPoliceRadioQueue.Add(SFX_NORTH);
|
||||||
processed = true;
|
processed = TRUE;
|
||||||
} else if (vec.y < halfY - quarterY) {
|
} else if (vec.y < halfY - quarterY) {
|
||||||
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
m_sPoliceRadioQueue.Add(SFX_SOUTH);
|
||||||
processed = true;
|
processed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vec.x > halfX + quarterX)
|
if (vec.x > halfX + quarterX)
|
||||||
@ -761,7 +757,7 @@ cAudioManager::PlaySuspectLastSeen(float x, float y, float z)
|
|||||||
m_sPoliceRadioQueue.Add(sample);
|
m_sPoliceRadioQueue.Add(sample);
|
||||||
m_sPoliceRadioQueue.Add(m_anRandomTable[2] % 3 + SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
m_sPoliceRadioQueue.Add(m_anRandomTable[2] % 3 + SFX_POLICE_RADIO_MESSAGE_NOISE_1);
|
||||||
m_sPoliceRadioQueue.Add(TOTAL_AUDIO_SAMPLES);
|
m_sPoliceRadioQueue.Add(TOTAL_AUDIO_SAMPLES);
|
||||||
gSpecialSuspectLastSeenReport = true;
|
gSpecialSuspectLastSeenReport = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -772,9 +768,9 @@ cAudioManager::PlaySuspectLastSeen(float x, float y, float z)
|
|||||||
void
|
void
|
||||||
cAudioManager::AgeCrimes()
|
cAudioManager::AgeCrimes()
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
for (uint8 i = 0; i < ARRAY_SIZE(m_aCrimes); i++) {
|
||||||
if (m_sPoliceRadioQueue.crimes[i].type != CRIME_NONE) {
|
if (m_aCrimes[i].type != CRIME_NONE) {
|
||||||
if (++m_sPoliceRadioQueue.crimes[i].timer > 1500) m_sPoliceRadioQueue.crimes[i].type = CRIME_NONE;
|
if (++m_aCrimes[i].timer > 1500) m_aCrimes[i].type = CRIME_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
66
src/audio/PolRadio.h
Normal file
66
src/audio/PolRadio.h
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Crime.h"
|
||||||
|
#include "AudioSamples.h"
|
||||||
|
|
||||||
|
struct cAMCrime {
|
||||||
|
int32 type;
|
||||||
|
CVector position;
|
||||||
|
uint16 timer;
|
||||||
|
|
||||||
|
cAMCrime()
|
||||||
|
{
|
||||||
|
type = CRIME_NONE;
|
||||||
|
position = CVector(0.0f, 0.0f, 0.0f);
|
||||||
|
timer = 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
VALIDATE_SIZE(cAMCrime, 20);
|
||||||
|
|
||||||
|
#define POLICE_RADIO_QUEUE_MAX_SAMPLES 60
|
||||||
|
|
||||||
|
class cPoliceRadioQueue
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int32 m_aSamples[POLICE_RADIO_QUEUE_MAX_SAMPLES];
|
||||||
|
uint8 m_nSamplesInQueue;
|
||||||
|
uint8 m_nAddOffset;
|
||||||
|
uint8 m_nRemoveOffset;
|
||||||
|
|
||||||
|
cPoliceRadioQueue()
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Reset()
|
||||||
|
{
|
||||||
|
m_nAddOffset = 0;
|
||||||
|
m_nRemoveOffset = 0;
|
||||||
|
m_nSamplesInQueue = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool8 Add(uint32 sample)
|
||||||
|
{
|
||||||
|
if (m_nSamplesInQueue != POLICE_RADIO_QUEUE_MAX_SAMPLES) {
|
||||||
|
m_aSamples[m_nAddOffset] = sample;
|
||||||
|
m_nSamplesInQueue++;
|
||||||
|
m_nAddOffset = (m_nAddOffset + 1) % POLICE_RADIO_QUEUE_MAX_SAMPLES;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 Remove()
|
||||||
|
{
|
||||||
|
if (m_nSamplesInQueue != 0) {
|
||||||
|
uint32 sample = m_aSamples[m_nRemoveOffset];
|
||||||
|
m_nSamplesInQueue--;
|
||||||
|
m_nRemoveOffset = (m_nRemoveOffset + 1) % POLICE_RADIO_QUEUE_MAX_SAMPLES;
|
||||||
|
return sample;
|
||||||
|
}
|
||||||
|
return TOTAL_AUDIO_SAMPLES;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
VALIDATE_SIZE(cPoliceRadioQueue, 244);
|
@ -1,46 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "Crime.h"
|
|
||||||
|
|
||||||
struct cAMCrime {
|
|
||||||
int32 type;
|
|
||||||
CVector position;
|
|
||||||
uint16 timer;
|
|
||||||
|
|
||||||
cAMCrime()
|
|
||||||
{
|
|
||||||
type = CRIME_NONE;
|
|
||||||
position = CVector(0.0f, 0.0f, 0.0f);
|
|
||||||
timer = 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
VALIDATE_SIZE(cAMCrime, 20);
|
|
||||||
|
|
||||||
class cPoliceRadioQueue
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
int32 crimesSamples[60];
|
|
||||||
uint8 policeChannelTimer;
|
|
||||||
uint8 policeChannelTimerSeconds;
|
|
||||||
uint8 policeChannelCounterSeconds;
|
|
||||||
cAMCrime crimes[10];
|
|
||||||
|
|
||||||
cPoliceRadioQueue()
|
|
||||||
{
|
|
||||||
policeChannelTimerSeconds = 0;
|
|
||||||
policeChannelCounterSeconds = 0;
|
|
||||||
policeChannelTimer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Add(uint32 sample)
|
|
||||||
{
|
|
||||||
if (policeChannelTimer != 60) {
|
|
||||||
crimesSamples[policeChannelTimerSeconds] = sample;
|
|
||||||
policeChannelTimer++;
|
|
||||||
policeChannelTimerSeconds = (policeChannelTimerSeconds + 1) % 60;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
VALIDATE_SIZE(cPoliceRadioQueue, 444);
|
|
@ -12,8 +12,9 @@ enum eRadioStation
|
|||||||
FLASHBACK,
|
FLASHBACK,
|
||||||
CHATTERBOX,
|
CHATTERBOX,
|
||||||
USERTRACK,
|
USERTRACK,
|
||||||
POLICE_RADIO,
|
POLICE_RADIO = 10,
|
||||||
RADIO_OFF,
|
NUM_RADIOS = 10,
|
||||||
|
RADIO_OFF = 11,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eMusicMode
|
enum eMusicMode
|
||||||
@ -253,3 +254,25 @@ enum eAudioType
|
|||||||
AUDIOTYPE_POLICERADIO,
|
AUDIOTYPE_POLICERADIO,
|
||||||
TOTAL_AUDIO_TYPES,
|
TOTAL_AUDIO_TYPES,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef GTA_PS2
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
NUM_CHANNELS_GENERIC = 43,
|
||||||
|
CHANNEL_POLICE_RADIO = NUM_CHANNELS_GENERIC,
|
||||||
|
CHANNEL_MISSION_AUDIO,
|
||||||
|
CHANNEL_PLAYER_VEHICLE_ENGINE,
|
||||||
|
NUM_CHANNELS
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
#ifdef PS2_AUDIO_CHANNELS
|
||||||
|
NUM_CHANNELS_GENERIC = 43,
|
||||||
|
#else
|
||||||
|
NUM_CHANNELS_GENERIC = 27,
|
||||||
|
#endif
|
||||||
|
CHANNEL_POLICE_RADIO,
|
||||||
|
NUM_CHANNELS
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
@ -24,12 +24,6 @@
|
|||||||
|
|
||||||
#include "aldlist.h"
|
#include "aldlist.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#define _stricmp strcasecmp
|
|
||||||
#define _strnicmp strncasecmp
|
|
||||||
#define _strdup strdup
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef AUDIO_OAL
|
#ifdef AUDIO_OAL
|
||||||
/*
|
/*
|
||||||
* Init call
|
* Init call
|
||||||
@ -47,8 +41,8 @@ ALDeviceList::ALDeviceList()
|
|||||||
defaultDeviceIndex = 0;
|
defaultDeviceIndex = 0;
|
||||||
|
|
||||||
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) {
|
if (alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")) {
|
||||||
devices = (char *)alcGetString(NULL, ALC_DEVICE_SPECIFIER);
|
devices = (char *)alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER);
|
||||||
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER);
|
defaultDeviceName = (char *)alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER);
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
// go through device list (each device terminated with a single NULL, list terminated with double NULL)
|
||||||
@ -62,17 +56,11 @@ ALDeviceList::ALDeviceList()
|
|||||||
if (context) {
|
if (context) {
|
||||||
alcMakeContextCurrent(context);
|
alcMakeContextCurrent(context);
|
||||||
// if new actual device name isn't already in the list, then add it...
|
// if new actual device name isn't already in the list, then add it...
|
||||||
actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
|
actualDeviceName = alcGetString(device, ALC_ALL_DEVICES_SPECIFIER);
|
||||||
bool bNewName = true;
|
if ((actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
|
||||||
for (unsigned int i = 0; i < GetNumDevices(); i++) {
|
ALDEVICEINFO &ALDeviceInfo = aDeviceInfo[nNumOfDevices++];
|
||||||
if (strcmp(GetDeviceName(i), actualDeviceName) == 0) {
|
|
||||||
bNewName = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
|
|
||||||
ALDEVICEINFO ALDeviceInfo;
|
|
||||||
ALDeviceInfo.bSelected = true;
|
ALDeviceInfo.bSelected = true;
|
||||||
ALDeviceInfo.strDeviceName = _strdup(actualDeviceName);
|
ALDeviceInfo.SetName(actualDeviceName);
|
||||||
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion);
|
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion);
|
||||||
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion);
|
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion);
|
||||||
|
|
||||||
@ -105,8 +93,6 @@ ALDeviceList::ALDeviceList()
|
|||||||
|
|
||||||
// Get Source Count
|
// Get Source Count
|
||||||
ALDeviceInfo.uiSourceCount = GetMaxNumSources();
|
ALDeviceInfo.uiSourceCount = GetMaxNumSources();
|
||||||
|
|
||||||
aDeviceInfo[nNumOfDevices++] = ALDeviceInfo;
|
|
||||||
}
|
}
|
||||||
alcMakeContextCurrent(NULL);
|
alcMakeContextCurrent(NULL);
|
||||||
alcDestroyContext(context);
|
alcDestroyContext(context);
|
||||||
|
@ -21,7 +21,7 @@ enum
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct ALDEVICEINFO {
|
struct ALDEVICEINFO {
|
||||||
const char *strDeviceName;
|
char *strDeviceName;
|
||||||
int iMajorVersion;
|
int iMajorVersion;
|
||||||
int iMinorVersion;
|
int iMinorVersion;
|
||||||
unsigned int uiSourceCount;
|
unsigned int uiSourceCount;
|
||||||
@ -33,6 +33,19 @@ struct ALDEVICEINFO {
|
|||||||
strDeviceName = NULL;
|
strDeviceName = NULL;
|
||||||
Extensions = 0;
|
Extensions = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~ALDEVICEINFO()
|
||||||
|
{
|
||||||
|
delete[] strDeviceName;
|
||||||
|
strDeviceName = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetName(const char *name)
|
||||||
|
{
|
||||||
|
if(strDeviceName) delete[] strDeviceName;
|
||||||
|
strDeviceName = new char[strlen(name) + 1];
|
||||||
|
strcpy(strDeviceName, name);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef ALDEVICEINFO *LPALDEVICEINFO;
|
typedef ALDEVICEINFO *LPALDEVICEINFO;
|
||||||
|
@ -10,18 +10,22 @@
|
|||||||
|
|
||||||
extern bool IsFXSupported();
|
extern bool IsFXSupported();
|
||||||
|
|
||||||
ALuint alSources[MAXCHANNELS+MAX2DCHANNELS];
|
ALuint alSources[NUM_CHANNELS];
|
||||||
ALuint alFilters[MAXCHANNELS+MAX2DCHANNELS];
|
ALuint alFilters[NUM_CHANNELS];
|
||||||
ALuint alBuffers[MAXCHANNELS+MAX2DCHANNELS];
|
ALuint alBuffers[NUM_CHANNELS];
|
||||||
bool bChannelsCreated = false;
|
bool bChannelsCreated = false;
|
||||||
|
|
||||||
|
int32 CChannel::channelsThatNeedService = 0;
|
||||||
|
|
||||||
|
uint8 tempStereoBuffer[PED_BLOCKSIZE * 2];
|
||||||
|
|
||||||
void
|
void
|
||||||
CChannel::InitChannels()
|
CChannel::InitChannels()
|
||||||
{
|
{
|
||||||
alGenSources(MAXCHANNELS+MAX2DCHANNELS, alSources);
|
alGenSources(NUM_CHANNELS, alSources);
|
||||||
alGenBuffers(MAXCHANNELS+MAX2DCHANNELS, alBuffers);
|
alGenBuffers(NUM_CHANNELS, alBuffers);
|
||||||
if (IsFXSupported())
|
if (IsFXSupported())
|
||||||
alGenFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters);
|
alGenFilters(NUM_CHANNELS, alFilters);
|
||||||
bChannelsCreated = true;
|
bChannelsCreated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -30,13 +34,13 @@ CChannel::DestroyChannels()
|
|||||||
{
|
{
|
||||||
if (bChannelsCreated)
|
if (bChannelsCreated)
|
||||||
{
|
{
|
||||||
alDeleteSources(MAXCHANNELS + MAX2DCHANNELS, alSources);
|
alDeleteSources(NUM_CHANNELS, alSources);
|
||||||
memset(alSources, 0, sizeof(alSources));
|
memset(alSources, 0, sizeof(alSources));
|
||||||
alDeleteBuffers(MAXCHANNELS + MAX2DCHANNELS, alBuffers);
|
alDeleteBuffers(NUM_CHANNELS, alBuffers);
|
||||||
memset(alBuffers, 0, sizeof(alBuffers));
|
memset(alBuffers, 0, sizeof(alBuffers));
|
||||||
if (IsFXSupported())
|
if (IsFXSupported())
|
||||||
{
|
{
|
||||||
alDeleteFilters(MAXCHANNELS + MAX2DCHANNELS, alFilters);
|
alDeleteFilters(NUM_CHANNELS, alFilters);
|
||||||
memset(alFilters, 0, sizeof(alFilters));
|
memset(alFilters, 0, sizeof(alFilters));
|
||||||
}
|
}
|
||||||
bChannelsCreated = false;
|
bChannelsCreated = false;
|
||||||
@ -48,6 +52,7 @@ CChannel::CChannel()
|
|||||||
{
|
{
|
||||||
Data = nil;
|
Data = nil;
|
||||||
DataSize = 0;
|
DataSize = 0;
|
||||||
|
bIs2D = false;
|
||||||
SetDefault();
|
SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +64,9 @@ void CChannel::SetDefault()
|
|||||||
|
|
||||||
Position[0] = 0.0f; Position[1] = 0.0f; Position[2] = 0.0f;
|
Position[0] = 0.0f; Position[1] = 0.0f; Position[2] = 0.0f;
|
||||||
Distances[0] = 0.0f; Distances[1] = FLT_MAX;
|
Distances[0] = 0.0f; Distances[1] = FLT_MAX;
|
||||||
|
|
||||||
LoopCount = 1;
|
LoopCount = 1;
|
||||||
|
LastProcessedOffset = UINT32_MAX;
|
||||||
LoopPoints[0] = 0; LoopPoints[1] = -1;
|
LoopPoints[0] = 0; LoopPoints[1] = -1;
|
||||||
|
|
||||||
Frequency = MAX_FREQ;
|
Frequency = MAX_FREQ;
|
||||||
@ -67,6 +74,10 @@ void CChannel::SetDefault()
|
|||||||
|
|
||||||
void CChannel::Reset()
|
void CChannel::Reset()
|
||||||
{
|
{
|
||||||
|
// Here is safe because ctor don't call this
|
||||||
|
if (LoopCount > 1)
|
||||||
|
channelsThatNeedService--;
|
||||||
|
|
||||||
ClearBuffer();
|
ClearBuffer();
|
||||||
SetDefault();
|
SetDefault();
|
||||||
}
|
}
|
||||||
@ -82,6 +93,7 @@ void CChannel::Init(uint32 _id, bool Is2D)
|
|||||||
|
|
||||||
if ( Is2D )
|
if ( Is2D )
|
||||||
{
|
{
|
||||||
|
bIs2D = true;
|
||||||
alSource3f(alSources[id], AL_POSITION, 0.0f, 0.0f, 0.0f);
|
alSource3f(alSources[id], AL_POSITION, 0.0f, 0.0f, 0.0f);
|
||||||
alSourcef(alSources[id], AL_GAIN, 1.0f);
|
alSourcef(alSources[id], AL_GAIN, 1.0f);
|
||||||
}
|
}
|
||||||
@ -105,6 +117,19 @@ void CChannel::Start()
|
|||||||
if ( !HasSource() ) return;
|
if ( !HasSource() ) return;
|
||||||
if ( !Data ) return;
|
if ( !Data ) return;
|
||||||
|
|
||||||
|
if ( bIs2D )
|
||||||
|
{
|
||||||
|
// convert mono data to stereo
|
||||||
|
int16 *monoData = (int16*)Data;
|
||||||
|
int16 *stereoData = (int16*)tempStereoBuffer;
|
||||||
|
for (size_t i = 0; i < DataSize / 2; i++)
|
||||||
|
{
|
||||||
|
*(stereoData++) = *monoData;
|
||||||
|
*(stereoData++) = *(monoData++);
|
||||||
|
}
|
||||||
|
alBufferData(alBuffers[id], AL_FORMAT_STEREO16, tempStereoBuffer, DataSize * 2, Frequency);
|
||||||
|
}
|
||||||
|
else
|
||||||
alBufferData(alBuffers[id], AL_FORMAT_MONO16, Data, DataSize, Frequency);
|
alBufferData(alBuffers[id], AL_FORMAT_MONO16, Data, DataSize, Frequency);
|
||||||
if ( LoopPoints[0] != 0 && LoopPoints[0] != -1 )
|
if ( LoopPoints[0] != 0 && LoopPoints[0] != -1 )
|
||||||
alBufferiv(alBuffers[id], AL_LOOP_POINTS_SOFT, LoopPoints);
|
alBufferiv(alBuffers[id], AL_LOOP_POINTS_SOFT, LoopPoints);
|
||||||
@ -174,10 +199,51 @@ void CChannel::SetCurrentFreq(uint32 freq)
|
|||||||
SetPitch(ALfloat(freq) / Frequency);
|
SetPitch(ALfloat(freq) / Frequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChannel::SetLoopCount(int32 loopCount) // fake. TODO:
|
void CChannel::SetLoopCount(int32 count)
|
||||||
{
|
{
|
||||||
if ( !HasSource() ) return;
|
if ( !HasSource() ) return;
|
||||||
alSourcei(alSources[id], AL_LOOPING, loopCount == 1 ? AL_FALSE : AL_TRUE);
|
|
||||||
|
// 0: loop indefinitely, 1: play one time, 2: play two times etc...
|
||||||
|
// only > 1 needs manual processing
|
||||||
|
|
||||||
|
if (LoopCount > 1 && count < 2)
|
||||||
|
channelsThatNeedService--;
|
||||||
|
else if (LoopCount < 2 && count > 1)
|
||||||
|
channelsThatNeedService++;
|
||||||
|
|
||||||
|
alSourcei(alSources[id], AL_LOOPING, count == 1 ? AL_FALSE : AL_TRUE);
|
||||||
|
LoopCount = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CChannel::Update()
|
||||||
|
{
|
||||||
|
if (!HasSource()) return false;
|
||||||
|
if (LoopCount < 2) return false;
|
||||||
|
|
||||||
|
ALint state;
|
||||||
|
alGetSourcei(alSources[id], AL_SOURCE_STATE, &state);
|
||||||
|
if (state == AL_STOPPED) {
|
||||||
|
debug("Looping channels(%d in this case) shouldn't report AL_STOPPED, but nvm\n", id);
|
||||||
|
SetLoopCount(1);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
assert(channelsThatNeedService > 0 && "Ref counting is broken");
|
||||||
|
|
||||||
|
ALint offset;
|
||||||
|
alGetSourcei(alSources[id], AL_SAMPLE_OFFSET, &offset);
|
||||||
|
|
||||||
|
// Rewound
|
||||||
|
if (offset < LastProcessedOffset) {
|
||||||
|
LoopCount--;
|
||||||
|
if (LoopCount == 1) {
|
||||||
|
// Playing last tune...
|
||||||
|
channelsThatNeedService--;
|
||||||
|
alSourcei(alSources[id], AL_LOOPING, AL_FALSE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LastProcessedOffset = offset;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CChannel::SetLoopPoints(ALint start, ALint end)
|
void CChannel::SetLoopPoints(ALint start, ALint end)
|
||||||
@ -209,6 +275,7 @@ void CChannel::SetPan(int32 pan)
|
|||||||
void CChannel::ClearBuffer()
|
void CChannel::ClearBuffer()
|
||||||
{
|
{
|
||||||
if ( !HasSource() ) return;
|
if ( !HasSource() ) return;
|
||||||
|
alSourcei(alSources[id], AL_LOOPING, AL_FALSE);
|
||||||
alSourcei(alSources[id], AL_BUFFER, AL_NONE);
|
alSourcei(alSources[id], AL_BUFFER, AL_NONE);
|
||||||
|
|
||||||
#ifdef BIGENDIAN
|
#ifdef BIGENDIAN
|
||||||
|
@ -19,7 +19,11 @@ class CChannel
|
|||||||
float Distances[2];
|
float Distances[2];
|
||||||
int32 LoopCount;
|
int32 LoopCount;
|
||||||
ALint LoopPoints[2];
|
ALint LoopPoints[2];
|
||||||
|
ALint LastProcessedOffset;
|
||||||
|
bool bIs2D;
|
||||||
public:
|
public:
|
||||||
|
static int32 channelsThatNeedService;
|
||||||
|
|
||||||
static void InitChannels();
|
static void InitChannels();
|
||||||
static void DestroyChannels();
|
static void DestroyChannels();
|
||||||
|
|
||||||
@ -37,7 +41,7 @@ public:
|
|||||||
void SetVolume(int32 vol);
|
void SetVolume(int32 vol);
|
||||||
void SetSampleData(void *_data, size_t _DataSize, int32 freq);
|
void SetSampleData(void *_data, size_t _DataSize, int32 freq);
|
||||||
void SetCurrentFreq(uint32 freq);
|
void SetCurrentFreq(uint32 freq);
|
||||||
void SetLoopCount(int32 loopCount); // fake
|
void SetLoopCount(int32 count);
|
||||||
void SetLoopPoints(ALint start, ALint end);
|
void SetLoopPoints(ALint start, ALint end);
|
||||||
void SetPosition(float x, float y, float z);
|
void SetPosition(float x, float y, float z);
|
||||||
void SetDistances(float max, float min);
|
void SetDistances(float max, float min);
|
||||||
@ -45,6 +49,7 @@ public:
|
|||||||
void ClearBuffer();
|
void ClearBuffer();
|
||||||
void SetReverbMix(ALuint slot, float mix);
|
void SetReverbMix(ALuint slot, float mix);
|
||||||
void UpdateReverb(ALuint slot);
|
void UpdateReverb(ALuint slot);
|
||||||
|
bool Update();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -1,12 +1,8 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#ifdef AUDIO_OAL
|
#ifdef AUDIO_OAL
|
||||||
#include "stream.h"
|
|
||||||
#include "sampman.h"
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <malloc.h>
|
|
||||||
|
|
||||||
#if defined _MSC_VER && !defined RE3_NO_AUTOLINK
|
#if defined _MSC_VER && !defined CMAKE_NO_AUTOLINK
|
||||||
#ifdef AUDIO_OAL_USE_SNDFILE
|
#ifdef AUDIO_OAL_USE_SNDFILE
|
||||||
#pragma comment( lib, "libsndfile-1.lib" )
|
#pragma comment( lib, "libsndfile-1.lib" )
|
||||||
#endif
|
#endif
|
||||||
@ -28,6 +24,29 @@
|
|||||||
#include <opusfile.h>
|
#include <opusfile.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <queue>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
|
#include <mutex>
|
||||||
|
#include <condition_variable>
|
||||||
|
#include "MusicManager.h"
|
||||||
|
#include "stream.h"
|
||||||
|
|
||||||
|
std::thread gAudioThread;
|
||||||
|
std::mutex gAudioThreadQueueMutex;
|
||||||
|
std::condition_variable gAudioThreadCv;
|
||||||
|
bool gAudioThreadTerm = false;
|
||||||
|
std::queue<CStream*> gStreamsToProcess; // values are not unique, we will handle that ourself
|
||||||
|
std::queue<std::pair<IDecoder*, void*>> gStreamsToClose;
|
||||||
|
#else
|
||||||
|
#include "stream.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "sampman.h"
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include "crossplatform.h"
|
#include "crossplatform.h"
|
||||||
#endif
|
#endif
|
||||||
@ -45,6 +64,10 @@ class CSortStereoBuffer
|
|||||||
{
|
{
|
||||||
uint16* PcmBuf;
|
uint16* PcmBuf;
|
||||||
size_t BufSize;
|
size_t BufSize;
|
||||||
|
//#ifdef MULTITHREADED_AUDIO
|
||||||
|
// std::mutex Mutex;
|
||||||
|
//#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CSortStereoBuffer() : PcmBuf(nil), BufSize(0) {}
|
CSortStereoBuffer() : PcmBuf(nil), BufSize(0) {}
|
||||||
~CSortStereoBuffer()
|
~CSortStereoBuffer()
|
||||||
@ -71,6 +94,9 @@ public:
|
|||||||
|
|
||||||
void SortStereo(void* buf, size_t size)
|
void SortStereo(void* buf, size_t size)
|
||||||
{
|
{
|
||||||
|
//#ifdef MULTITHREADED_AUDIO
|
||||||
|
// std::lock_guard<std::mutex> lock(Mutex);
|
||||||
|
//#endif
|
||||||
uint16* InBuf = (uint16*)buf;
|
uint16* InBuf = (uint16*)buf;
|
||||||
uint16* OutBuf = GetBuffer(size);
|
uint16* OutBuf = GetBuffer(size);
|
||||||
|
|
||||||
@ -140,7 +166,7 @@ public:
|
|||||||
else
|
else
|
||||||
StepIndex--;
|
StepIndex--;
|
||||||
|
|
||||||
StepIndex = clamp(StepIndex, 0, 88);
|
StepIndex = Clamp(StepIndex, 0, 88);
|
||||||
|
|
||||||
int delta = step >> 3;
|
int delta = step >> 3;
|
||||||
if (adpcm & 1) delta += step >> 2;
|
if (adpcm & 1) delta += step >> 2;
|
||||||
@ -149,7 +175,7 @@ public:
|
|||||||
if (adpcm & 8) delta = -delta;
|
if (adpcm & 8) delta = -delta;
|
||||||
|
|
||||||
int newSample = Sample + delta;
|
int newSample = Sample + delta;
|
||||||
Sample = clamp(newSample, -32768, 32767);
|
Sample = Clamp(newSample, -32768, 32767);
|
||||||
return Sample;
|
return Sample;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -285,6 +311,10 @@ public:
|
|||||||
#undef CLOSE_ON_ERROR
|
#undef CLOSE_ON_ERROR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileOpen()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
~CWavFile()
|
~CWavFile()
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
@ -295,6 +325,7 @@ public:
|
|||||||
return m_bIsOpen;
|
return m_bIsOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32 GetSampleSize()
|
uint32 GetSampleSize()
|
||||||
{
|
{
|
||||||
return sizeof(uint16);
|
return sizeof(uint16);
|
||||||
@ -466,6 +497,10 @@ public:
|
|||||||
m_pfSound = sf_open_virtual(&vio, SFM_READ, &m_soundInfo, m_fileHandle);
|
m_pfSound = sf_open_virtual(&vio, SFM_READ, &m_soundInfo, m_fileHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileOpen()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
~CSndFile()
|
~CSndFile()
|
||||||
{
|
{
|
||||||
if ( m_pfSound )
|
if ( m_pfSound )
|
||||||
@ -644,68 +679,73 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AUDIO_OAL_USE_MPG123
|
#ifdef AUDIO_OAL_USE_MPG123
|
||||||
// fuzzy seek eliminates stutter when playing ADF but spams errors a lot (nothing breaks though)
|
|
||||||
#define MP3_USE_FUZZY_SEEK
|
|
||||||
static ssize_t mpg123_read_replacement(void* handle, void* data, size_t size)
|
|
||||||
{
|
|
||||||
return fread(data, 1, size, (FILE*)handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
static off_t mpg123_seek_replacement(void* handle, off_t offset, int whence)
|
|
||||||
{
|
|
||||||
fseek((FILE*)handle, offset, whence);
|
|
||||||
return ftell((FILE*)handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
class CMP3File : public IDecoder
|
class CMP3File : public IDecoder
|
||||||
{
|
{
|
||||||
|
protected:
|
||||||
mpg123_handle *m_pMH;
|
mpg123_handle *m_pMH;
|
||||||
bool m_bOpened;
|
bool m_bOpened;
|
||||||
uint32 m_nRate;
|
uint32 m_nRate;
|
||||||
uint32 m_nChannels;
|
uint32 m_nChannels;
|
||||||
FILE* m_fileHandle;
|
const char* m_pPath;
|
||||||
|
bool m_bFileNotOpenedYet;
|
||||||
char* m_buffer;
|
char* m_buffer;
|
||||||
|
|
||||||
|
CMP3File() :
|
||||||
|
m_pMH(nil),
|
||||||
|
m_bOpened(false),
|
||||||
|
m_nRate(0),
|
||||||
|
m_bFileNotOpenedYet(false),
|
||||||
|
m_nChannels(0),
|
||||||
|
m_buffer(NULL) {}
|
||||||
public:
|
public:
|
||||||
CMP3File(const char *path) :
|
CMP3File(const char *path) :
|
||||||
m_pMH(nil),
|
m_pMH(nil),
|
||||||
m_bOpened(false),
|
m_bOpened(false),
|
||||||
m_nRate(0),
|
m_nRate(0),
|
||||||
m_nChannels(0),
|
m_nChannels(0),
|
||||||
m_fileHandle(NULL),
|
m_pPath(path),
|
||||||
|
m_bFileNotOpenedYet(false),
|
||||||
m_buffer(NULL)
|
m_buffer(NULL)
|
||||||
{
|
{
|
||||||
m_pMH = mpg123_new(nil, nil);
|
m_pMH = mpg123_new(nil, nil);
|
||||||
if ( m_pMH )
|
if ( m_pMH )
|
||||||
{
|
{
|
||||||
#ifdef MP3_USE_FUZZY_SEEK
|
mpg123_param(m_pMH, MPG123_FLAGS, MPG123_SEEKBUFFER | MPG123_GAPLESS, 0.0);
|
||||||
mpg123_param(m_pMH, MPG123_FLAGS, MPG123_FUZZY | MPG123_SEEKBUFFER | MPG123_GAPLESS | MPG123_QUIET, 0.0);
|
|
||||||
|
m_bOpened = true;
|
||||||
|
m_bFileNotOpenedYet = true;
|
||||||
|
// It's possible to move this to audioFileOpsThread(), but effect isn't noticable + probably not compatible with our current cutscene audio handling
|
||||||
|
#if 1
|
||||||
|
FileOpen();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FileOpen()
|
||||||
|
{
|
||||||
|
if(!m_bFileNotOpenedYet) return;
|
||||||
|
|
||||||
|
FILE* f = fopen(m_pPath, "rb");
|
||||||
|
|
||||||
|
m_buffer = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
||||||
|
setvbuf(f, m_buffer, _IOFBF, IO_BUFFER_SIZE);
|
||||||
|
|
||||||
long rate = 0;
|
long rate = 0;
|
||||||
int channels = 0;
|
int channels = 0;
|
||||||
int encoding = 0;
|
int encoding = 0;
|
||||||
|
m_bOpened = mpg123_replace_reader_handle(m_pMH, mpg123_read_replacement, mpg123_seek_replacement, mpg123_close_replacement) == MPG123_OK
|
||||||
m_buffer = (char*) memalign(0x40, IO_BUFFER_SIZE);
|
&& mpg123_open_handle(m_pMH, f) == MPG123_OK
|
||||||
|
|
||||||
m_fileHandle = fopen(path, "rb");
|
|
||||||
if (!m_fileHandle) {
|
|
||||||
m_bOpened = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
setvbuf(m_fileHandle, m_buffer, _IOFBF, IO_BUFFER_SIZE);
|
|
||||||
|
|
||||||
m_bOpened = mpg123_replace_reader_handle(m_pMH, mpg123_read_replacement, mpg123_seek_replacement, NULL) == MPG123_OK
|
|
||||||
&& mpg123_open_handle(m_pMH, m_fileHandle) == MPG123_OK
|
|
||||||
&& mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK;
|
&& mpg123_getformat(m_pMH, &rate, &channels, &encoding) == MPG123_OK;
|
||||||
|
|
||||||
m_nRate = rate;
|
m_nRate = rate;
|
||||||
m_nChannels = channels;
|
m_nChannels = channels;
|
||||||
|
|
||||||
if ( IsOpened() )
|
if(IsOpened()) {
|
||||||
{
|
|
||||||
mpg123_format_none(m_pMH);
|
mpg123_format_none(m_pMH);
|
||||||
mpg123_format(m_pMH, rate, channels, encoding);
|
mpg123_format(m_pMH, rate, channels, encoding);
|
||||||
}
|
}
|
||||||
}
|
m_bFileNotOpenedYet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
~CMP3File()
|
~CMP3File()
|
||||||
@ -715,9 +755,6 @@ public:
|
|||||||
mpg123_close(m_pMH);
|
mpg123_close(m_pMH);
|
||||||
mpg123_delete(m_pMH);
|
mpg123_delete(m_pMH);
|
||||||
|
|
||||||
if (m_fileHandle) {
|
|
||||||
fclose(m_fileHandle);
|
|
||||||
}
|
|
||||||
free(m_buffer);
|
free(m_buffer);
|
||||||
|
|
||||||
m_pMH = nil;
|
m_pMH = nil;
|
||||||
@ -736,7 +773,7 @@ public:
|
|||||||
|
|
||||||
uint32 GetSampleCount()
|
uint32 GetSampleCount()
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return 0;
|
if ( !IsOpened() || m_bFileNotOpenedYet ) return 0;
|
||||||
return mpg123_length(m_pMH);
|
return mpg123_length(m_pMH);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -752,19 +789,19 @@ public:
|
|||||||
|
|
||||||
void Seek(uint32 milliseconds)
|
void Seek(uint32 milliseconds)
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return;
|
if ( !IsOpened() || m_bFileNotOpenedYet ) return;
|
||||||
mpg123_seek(m_pMH, ms2samples(milliseconds), SEEK_SET);
|
mpg123_seek(m_pMH, ms2samples(milliseconds), SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Tell()
|
uint32 Tell()
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return 0;
|
if ( !IsOpened() || m_bFileNotOpenedYet ) return 0;
|
||||||
return samples2ms(mpg123_tell(m_pMH));
|
return samples2ms(mpg123_tell(m_pMH));
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Decode(void *buffer)
|
uint32 Decode(void *buffer)
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return 0;
|
if ( !IsOpened() || m_bFileNotOpenedYet ) return 0;
|
||||||
|
|
||||||
size_t size;
|
size_t size;
|
||||||
int err = mpg123_read(m_pMH, (unsigned char *)buffer, GetBufferSize(), &size);
|
int err = mpg123_read(m_pMH, (unsigned char *)buffer, GetBufferSize(), &size);
|
||||||
@ -806,7 +843,7 @@ public:
|
|||||||
static short quantize(double sample)
|
static short quantize(double sample)
|
||||||
{
|
{
|
||||||
int a = int(sample + 0.5);
|
int a = int(sample + 0.5);
|
||||||
return short(clamp(a, -32768, 32767));
|
return short(Clamp(a, -32768, 32767));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Decode(void* _inbuf, int16* _outbuf, size_t size)
|
void Decode(void* _inbuf, int16* _outbuf, size_t size)
|
||||||
@ -895,6 +932,10 @@ public:
|
|||||||
m_ppVagBuffers[i] = new uint8[VB_BLOCK_SIZE];
|
m_ppVagBuffers[i] = new uint8[VB_BLOCK_SIZE];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileOpen()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
~CVbFile()
|
~CVbFile()
|
||||||
{
|
{
|
||||||
if (m_pFile)
|
if (m_pFile)
|
||||||
@ -1048,6 +1089,10 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileOpen()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
~COpusFile()
|
~COpusFile()
|
||||||
{
|
{
|
||||||
if (m_FileH)
|
if (m_FileH)
|
||||||
@ -1112,11 +1157,173 @@ public:
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// For multi-thread: Someone always acquire stream's mutex before entering here
|
||||||
|
void
|
||||||
|
CStream::BuffersShouldBeFilled()
|
||||||
|
{
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
||||||
|
std::queue<std::pair<ALuint, ALuint>> tempQueue;
|
||||||
|
for(int i = 0; i < NUM_STREAMBUFFERS / 2; i++) {
|
||||||
|
tempQueue.push(std::pair<ALuint, ALuint>(m_alBuffers[i * 2], m_alBuffers[i * 2 + 1]));
|
||||||
|
}
|
||||||
|
m_fillBuffers.swap(tempQueue);
|
||||||
|
|
||||||
|
FlagAsToBeProcessed();
|
||||||
|
|
||||||
|
m_bActive = true; // to allow Update() to queue the filled buffers & play
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
std::queue<std::pair<ALuint, ALuint>>().swap(m_fillBuffers);
|
||||||
|
#endif
|
||||||
|
if ( FillBuffers() != 0 )
|
||||||
|
{
|
||||||
|
SetPlay(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// returns whether it's queued (not on multi-thread)
|
||||||
|
bool
|
||||||
|
CStream::BufferShouldBeFilledAndQueued(std::pair<ALuint, ALuint>* bufs)
|
||||||
|
{
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE)
|
||||||
|
m_fillBuffers.push(*bufs);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
ALuint alBuffers[2] = {(*bufs).first, (*bufs).second}; // left - right
|
||||||
|
if (FillBuffer(alBuffers)) {
|
||||||
|
alSourceQueueBuffers(m_pAlSources[0], 1, &alBuffers[0]);
|
||||||
|
alSourceQueueBuffers(m_pAlSources[1], 1, &alBuffers[1]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
void
|
||||||
|
CStream::FlagAsToBeProcessed(bool close)
|
||||||
|
{
|
||||||
|
if (!close && MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gAudioThreadQueueMutex.lock();
|
||||||
|
if (close)
|
||||||
|
gStreamsToClose.push(std::pair<IDecoder*, void*>(m_pSoundFile ? m_pSoundFile : nil, m_pBuffer ? m_pBuffer : nil));
|
||||||
|
else
|
||||||
|
gStreamsToProcess.push(this);
|
||||||
|
|
||||||
|
gAudioThreadQueueMutex.unlock();
|
||||||
|
|
||||||
|
gAudioThreadCv.notify_one();
|
||||||
|
}
|
||||||
|
|
||||||
|
void audioFileOpsThread()
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
CStream *stream;
|
||||||
|
{
|
||||||
|
// Just a semaphore
|
||||||
|
std::unique_lock<std::mutex> queueMutex(gAudioThreadQueueMutex);
|
||||||
|
gAudioThreadCv.wait(queueMutex, [] { return gStreamsToProcess.size() > 0 || gStreamsToClose.size() > 0 || gAudioThreadTerm; });
|
||||||
|
if (gAudioThreadTerm)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!gStreamsToClose.empty()) {
|
||||||
|
auto streamToClose = gStreamsToClose.front();
|
||||||
|
gStreamsToClose.pop();
|
||||||
|
if (streamToClose.first) { // pSoundFile
|
||||||
|
delete streamToClose.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (streamToClose.second) { // pBuffer
|
||||||
|
free(streamToClose.second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!gStreamsToProcess.empty()) {
|
||||||
|
stream = gStreamsToProcess.front();
|
||||||
|
gStreamsToProcess.pop();
|
||||||
|
} else
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_lock<std::mutex> lock(stream->m_mutex);
|
||||||
|
|
||||||
|
std::pair<ALuint, ALuint> buffers, *lastBufAddr;
|
||||||
|
bool insertBufsAfterCheck = false;
|
||||||
|
|
||||||
|
do {
|
||||||
|
if (!stream->IsOpened()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stream->m_bReset)
|
||||||
|
break;
|
||||||
|
|
||||||
|
// We gave up this idea for now
|
||||||
|
/*
|
||||||
|
stream->m_pSoundFile->FileOpen();
|
||||||
|
|
||||||
|
// Deffered allocation, do it now
|
||||||
|
if (stream->m_pBuffer == nil) {
|
||||||
|
stream->m_pBuffer = malloc(stream->m_pSoundFile->GetBufferSize());
|
||||||
|
ASSERT(stream->m_pBuffer != nil);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (stream->m_bDoSeek) {
|
||||||
|
stream->m_bDoSeek = false;
|
||||||
|
int pos = stream->m_SeekPos;
|
||||||
|
lock.unlock();
|
||||||
|
stream->m_pSoundFile->Seek(pos);
|
||||||
|
lock.lock();
|
||||||
|
|
||||||
|
continue; // let's do the checks again, make sure we didn't miss anything while Seeking
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insertBufsAfterCheck) {
|
||||||
|
stream->m_queueBuffers.push(buffers);
|
||||||
|
insertBufsAfterCheck = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!stream->m_fillBuffers.empty()) {
|
||||||
|
lastBufAddr = &stream->m_fillBuffers.front();
|
||||||
|
buffers = *lastBufAddr;
|
||||||
|
lock.unlock();
|
||||||
|
|
||||||
|
ALuint alBuffers[2] = {buffers.first, buffers.second}; // left - right
|
||||||
|
bool filled = stream->FillBuffer(alBuffers);
|
||||||
|
|
||||||
|
lock.lock();
|
||||||
|
|
||||||
|
// Make sure queue isn't touched after we released mutex
|
||||||
|
if (!stream->m_fillBuffers.empty() && lastBufAddr == &stream->m_fillBuffers.front()) {
|
||||||
|
stream->m_fillBuffers.pop();
|
||||||
|
if (filled)
|
||||||
|
insertBufsAfterCheck = true; // Also make sure stream's properties aren't changed. So make one more pass, and push it to m_queueBuffers only if it pass checks again.
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
break;
|
||||||
|
|
||||||
|
} while (true);
|
||||||
|
|
||||||
|
} while(true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void CStream::Initialise()
|
void CStream::Initialise()
|
||||||
{
|
{
|
||||||
#ifdef AUDIO_OAL_USE_MPG123
|
#ifdef AUDIO_OAL_USE_MPG123
|
||||||
mpg123_init();
|
mpg123_init();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
gAudioThread = std::thread(audioFileOpsThread);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStream::Terminate()
|
void CStream::Terminate()
|
||||||
@ -1124,21 +1331,56 @@ void CStream::Terminate()
|
|||||||
#ifdef AUDIO_OAL_USE_MPG123
|
#ifdef AUDIO_OAL_USE_MPG123
|
||||||
mpg123_exit();
|
mpg123_exit();
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
gAudioThreadQueueMutex.lock();
|
||||||
|
gAudioThreadTerm = true;
|
||||||
|
gAudioThreadQueueMutex.unlock();
|
||||||
|
|
||||||
|
gAudioThreadCv.notify_one();
|
||||||
|
gAudioThread.join();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS], uint32 overrideSampleRate) :
|
CStream::CStream(ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS]) :
|
||||||
m_pAlSources(sources),
|
m_pAlSources(sources),
|
||||||
m_alBuffers(buffers),
|
m_alBuffers(buffers),
|
||||||
m_pBuffer(nil),
|
m_pBuffer(nil),
|
||||||
m_bPaused(false),
|
m_bPaused(false),
|
||||||
m_bActive(false),
|
m_bActive(false),
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
m_bIExist(false),
|
||||||
|
m_bDoSeek(false),
|
||||||
|
m_SeekPos(0),
|
||||||
|
#endif
|
||||||
m_pSoundFile(nil),
|
m_pSoundFile(nil),
|
||||||
m_bReset(false),
|
m_bReset(false),
|
||||||
m_nVolume(0),
|
m_nVolume(0),
|
||||||
m_nPan(0),
|
m_nPan(0),
|
||||||
m_nPosBeforeReset(0)
|
m_nPosBeforeReset(0),
|
||||||
|
m_nLoopCount(1)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CStream::Open(const char* filename, uint32 overrideSampleRate)
|
||||||
|
{
|
||||||
|
if (IsOpened()) return false;
|
||||||
|
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
m_bDoSeek = false;
|
||||||
|
m_SeekPos = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_bPaused = false;
|
||||||
|
m_bActive = false;
|
||||||
|
m_bReset = false;
|
||||||
|
m_nVolume = 0;
|
||||||
|
m_nPan = 0;
|
||||||
|
m_nPosBeforeReset = 0;
|
||||||
|
m_nLoopCount = 1;
|
||||||
|
|
||||||
// Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/)
|
// Be case-insensitive on linux (from https://github.com/OneSadCookie/fcaseopen/)
|
||||||
#if !defined(_WIN32)
|
#if !defined(_WIN32)
|
||||||
char *real = casepath(filename);
|
char *real = casepath(filename);
|
||||||
@ -1175,10 +1417,12 @@ CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBU
|
|||||||
else
|
else
|
||||||
m_pSoundFile = nil;
|
m_pSoundFile = nil;
|
||||||
|
|
||||||
if ( IsOpened() )
|
if ( m_pSoundFile && m_pSoundFile->IsOpened() )
|
||||||
{
|
{
|
||||||
m_pBuffer = malloc(m_pSoundFile->GetBufferSize());
|
uint32 bufSize = m_pSoundFile->GetBufferSize();
|
||||||
ASSERT(m_pBuffer!=nil);
|
if(bufSize != 0) { // Otherwise it's deferred
|
||||||
|
m_pBuffer = malloc(bufSize);
|
||||||
|
ASSERT(m_pBuffer != nil);
|
||||||
|
|
||||||
DEV("AvgSamplesPerSec: %d\n", m_pSoundFile->GetAvgSamplesPerSec());
|
DEV("AvgSamplesPerSec: %d\n", m_pSoundFile->GetAvgSamplesPerSec());
|
||||||
DEV("SampleCount: %d\n", m_pSoundFile->GetSampleCount());
|
DEV("SampleCount: %d\n", m_pSoundFile->GetSampleCount());
|
||||||
@ -1187,18 +1431,38 @@ CStream::CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBU
|
|||||||
DEV("Buffer Samples: %d\n", m_pSoundFile->GetBufferSamples());
|
DEV("Buffer Samples: %d\n", m_pSoundFile->GetBufferSamples());
|
||||||
DEV("Buffer sec: %f\n", (float(m_pSoundFile->GetBufferSamples()) / float(m_pSoundFile->GetChannels())/ float(m_pSoundFile->GetSampleRate())));
|
DEV("Buffer sec: %f\n", (float(m_pSoundFile->GetBufferSamples()) / float(m_pSoundFile->GetChannels())/ float(m_pSoundFile->GetSampleRate())));
|
||||||
DEV("Length MS: %02d:%02d\n", (m_pSoundFile->GetLength() / 1000) / 60, (m_pSoundFile->GetLength() / 1000) % 60);
|
DEV("Length MS: %02d:%02d\n", (m_pSoundFile->GetLength() / 1000) / 60, (m_pSoundFile->GetLength() / 1000) % 60);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
m_bIExist = true;
|
||||||
|
#endif
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CStream::~CStream()
|
CStream::~CStream()
|
||||||
{
|
{
|
||||||
Delete();
|
assert(!IsOpened());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStream::Delete()
|
void CStream::Close()
|
||||||
{
|
{
|
||||||
|
if(!IsOpened()) return;
|
||||||
|
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
Stop();
|
||||||
|
ClearBuffers();
|
||||||
|
m_bIExist = false;
|
||||||
|
std::queue<std::pair<ALuint, ALuint>>().swap(m_fillBuffers);
|
||||||
|
tsQueue<std::pair<ALuint, ALuint>>().swapNts(m_queueBuffers); // TSness not required, mutex is acquired
|
||||||
|
}
|
||||||
|
|
||||||
|
FlagAsToBeProcessed(true);
|
||||||
|
#else
|
||||||
|
|
||||||
Stop();
|
Stop();
|
||||||
ClearBuffers();
|
ClearBuffers();
|
||||||
|
|
||||||
@ -1213,6 +1477,7 @@ void CStream::Delete()
|
|||||||
free(m_pBuffer);
|
free(m_pBuffer);
|
||||||
m_pBuffer = nil;
|
m_pBuffer = nil;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStream::HasSource()
|
bool CStream::HasSource()
|
||||||
@ -1220,9 +1485,14 @@ bool CStream::HasSource()
|
|||||||
return (m_pAlSources[0] != AL_NONE) && (m_pAlSources[1] != AL_NONE);
|
return (m_pAlSources[0] != AL_NONE) && (m_pAlSources[1] != AL_NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// m_bIExist only written in main thread, thus mutex is not needed on main thread
|
||||||
bool CStream::IsOpened()
|
bool CStream::IsOpened()
|
||||||
{
|
{
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
return m_bIExist;
|
||||||
|
#else
|
||||||
return m_pSoundFile && m_pSoundFile->IsOpened();
|
return m_pSoundFile && m_pSoundFile->IsOpened();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStream::IsPlaying()
|
bool CStream::IsPlaying()
|
||||||
@ -1234,8 +1504,16 @@ bool CStream::IsPlaying()
|
|||||||
ALint sourceState[2];
|
ALint sourceState[2];
|
||||||
alGetSourcei(m_pAlSources[0], AL_SOURCE_STATE, &sourceState[0]);
|
alGetSourcei(m_pAlSources[0], AL_SOURCE_STATE, &sourceState[0]);
|
||||||
alGetSourcei(m_pAlSources[1], AL_SOURCE_STATE, &sourceState[1]);
|
alGetSourcei(m_pAlSources[1], AL_SOURCE_STATE, &sourceState[1]);
|
||||||
if ( m_bActive || sourceState[0] == AL_PLAYING || sourceState[1] == AL_PLAYING)
|
if (sourceState[0] == AL_PLAYING || sourceState[1] == AL_PLAYING)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
// Streams are designed in such a way that m_fillBuffers and m_queueBuffers will be *always* filled if audio is playing, and mutex is acquired
|
||||||
|
if (!m_fillBuffers.empty() || !m_queueBuffers.emptyNts())
|
||||||
|
return true;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -1297,20 +1575,37 @@ void CStream::SetVolume(uint32 nVol)
|
|||||||
|
|
||||||
void CStream::SetPan(uint8 nPan)
|
void CStream::SetPan(uint8 nPan)
|
||||||
{
|
{
|
||||||
m_nPan = clamp((int8)nPan - 63, 0, 63);
|
m_nPan = Clamp((int8)nPan - 63, 0, 63);
|
||||||
SetPosition(0, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
|
SetPosition(0, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
|
||||||
|
|
||||||
m_nPan = clamp((int8)nPan + 64, 64, 127);
|
m_nPan = Clamp((int8)nPan + 64, 64, 127);
|
||||||
SetPosition(1, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
|
SetPosition(1, (m_nPan - 63) / 64.0f, 0.0f, Sqrt(1.0f - SQR((m_nPan - 63) / 64.0f)));
|
||||||
|
|
||||||
m_nPan = nPan;
|
m_nPan = nPan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Should only be called if source is stopped
|
||||||
void CStream::SetPosMS(uint32 nPos)
|
void CStream::SetPosMS(uint32 nPos)
|
||||||
{
|
{
|
||||||
if ( !IsOpened() ) return;
|
if ( !IsOpened() ) return;
|
||||||
|
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
std::queue<std::pair<ALuint, ALuint>>().swap(m_fillBuffers);
|
||||||
|
tsQueue<std::pair<ALuint, ALuint>>().swapNts(m_queueBuffers); // TSness not required, second thread always access it when stream mutex acquired
|
||||||
|
|
||||||
|
if (MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE) {
|
||||||
|
m_bDoSeek = true;
|
||||||
|
m_SeekPos = nPos;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
m_pSoundFile->Seek(nPos);
|
m_pSoundFile->Seek(nPos);
|
||||||
|
}
|
||||||
ClearBuffers();
|
ClearBuffers();
|
||||||
|
|
||||||
|
// adding to gStreamsToProcess not needed, someone always calls Start() / BuffersShouldBeFilled() after SetPosMS
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 CStream::GetPosMS()
|
uint32 CStream::GetPosMS()
|
||||||
@ -1318,10 +1613,16 @@ uint32 CStream::GetPosMS()
|
|||||||
if ( !HasSource() ) return 0;
|
if ( !HasSource() ) return 0;
|
||||||
if ( !IsOpened() ) return 0;
|
if ( !IsOpened() ) return 0;
|
||||||
|
|
||||||
|
// Deferred init causes division by zero
|
||||||
|
if (m_pSoundFile->GetChannels() == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
ALint offset;
|
ALint offset;
|
||||||
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
|
//alGetSourcei(m_alSource, AL_SAMPLE_OFFSET, &offset);
|
||||||
alGetSourcei(m_pAlSources[0], AL_BYTE_OFFSET, &offset);
|
alGetSourcei(m_pAlSources[0], AL_BYTE_OFFSET, &offset);
|
||||||
|
|
||||||
|
//std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
return m_pSoundFile->Tell()
|
return m_pSoundFile->Tell()
|
||||||
- m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS/2-1)) / m_pSoundFile->GetChannels()
|
- m_pSoundFile->samples2ms(m_pSoundFile->GetBufferSamples() * (NUM_STREAMBUFFERS/2-1)) / m_pSoundFile->GetChannels()
|
||||||
+ m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize()) / m_pSoundFile->GetChannels();
|
+ m_pSoundFile->samples2ms(offset/m_pSoundFile->GetSampleSize()) / m_pSoundFile->GetChannels();
|
||||||
@ -1335,6 +1636,7 @@ uint32 CStream::GetLengthMS()
|
|||||||
|
|
||||||
bool CStream::FillBuffer(ALuint *alBuffer)
|
bool CStream::FillBuffer(ALuint *alBuffer)
|
||||||
{
|
{
|
||||||
|
#ifndef MULTITHREADED_AUDIO
|
||||||
if ( !HasSource() )
|
if ( !HasSource() )
|
||||||
return false;
|
return false;
|
||||||
if ( !IsOpened() )
|
if ( !IsOpened() )
|
||||||
@ -1343,6 +1645,7 @@ bool CStream::FillBuffer(ALuint *alBuffer)
|
|||||||
return false;
|
return false;
|
||||||
if ( !(alBuffer[1] != AL_NONE && alIsBuffer(alBuffer[1])) )
|
if ( !(alBuffer[1] != AL_NONE && alIsBuffer(alBuffer[1])) )
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
|
|
||||||
uint32 size = m_pSoundFile->Decode(m_pBuffer);
|
uint32 size = m_pSoundFile->Decode(m_pBuffer);
|
||||||
if( size == 0 )
|
if( size == 0 )
|
||||||
@ -1359,6 +1662,26 @@ bool CStream::FillBuffer(ALuint *alBuffer)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
bool CStream::QueueBuffers()
|
||||||
|
{
|
||||||
|
bool buffersQueued = false;
|
||||||
|
std::pair<ALuint, ALuint> buffers;
|
||||||
|
while (m_queueBuffers.peekPop(&buffers)) // beware: m_queueBuffers is tsQueue
|
||||||
|
{
|
||||||
|
ALuint leftBuf = buffers.first;
|
||||||
|
ALuint rightBuf = buffers.second;
|
||||||
|
|
||||||
|
alSourceQueueBuffers(m_pAlSources[0], 1, &leftBuf);
|
||||||
|
alSourceQueueBuffers(m_pAlSources[1], 1, &rightBuf);
|
||||||
|
|
||||||
|
buffersQueued = true;
|
||||||
|
}
|
||||||
|
return buffersQueued;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Only used in single-threaded audio or cutscene audio
|
||||||
int32 CStream::FillBuffers()
|
int32 CStream::FillBuffers()
|
||||||
{
|
{
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
@ -1388,11 +1711,33 @@ void CStream::ClearBuffers()
|
|||||||
alSourceUnqueueBuffers(m_pAlSources[1], 1, &value);
|
alSourceUnqueueBuffers(m_pAlSources[1], 1, &value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CStream::Setup()
|
bool CStream::Setup(bool imSureQueueIsEmpty, bool lock)
|
||||||
{
|
{
|
||||||
if ( IsOpened() )
|
if ( IsOpened() )
|
||||||
{
|
{
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
if (lock)
|
||||||
|
m_mutex.lock();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (!imSureQueueIsEmpty) {
|
||||||
|
Stop();
|
||||||
|
ClearBuffers();
|
||||||
|
}
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
if (MusicManager.m_nMusicMode == MUSICMODE_CUTSCENE) {
|
||||||
m_pSoundFile->Seek(0);
|
m_pSoundFile->Seek(0);
|
||||||
|
} else {
|
||||||
|
m_bDoSeek = true;
|
||||||
|
m_SeekPos = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lock)
|
||||||
|
m_mutex.unlock();
|
||||||
|
#else
|
||||||
|
m_pSoundFile->Seek(0);
|
||||||
|
#endif
|
||||||
|
|
||||||
//SetPosition(0.0f, 0.0f, 0.0f);
|
//SetPosition(0.0f, 0.0f, 0.0f);
|
||||||
SetPitch(1.0f);
|
SetPitch(1.0f);
|
||||||
//SetPan(m_nPan);
|
//SetPan(m_nPan);
|
||||||
@ -1402,6 +1747,13 @@ bool CStream::Setup()
|
|||||||
return IsOpened();
|
return IsOpened();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CStream::SetLoopCount(int32 count)
|
||||||
|
{
|
||||||
|
if ( !HasSource() ) return;
|
||||||
|
|
||||||
|
m_nLoopCount = count;
|
||||||
|
}
|
||||||
|
|
||||||
void CStream::SetPlay(bool state)
|
void CStream::SetPlay(bool state)
|
||||||
{
|
{
|
||||||
if ( !HasSource() ) return;
|
if ( !HasSource() ) return;
|
||||||
@ -1438,8 +1790,12 @@ void CStream::SetPlay(bool state)
|
|||||||
void CStream::Start()
|
void CStream::Start()
|
||||||
{
|
{
|
||||||
if ( !HasSource() ) return;
|
if ( !HasSource() ) return;
|
||||||
if ( FillBuffers() != 0 )
|
|
||||||
SetPlay(true);
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
tsQueue<std::pair<ALuint, ALuint>>().swapNts(m_queueBuffers); // TSness not required, second thread always access it when stream mutex acquired
|
||||||
|
#endif
|
||||||
|
BuffersShouldBeFilled();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStream::Stop()
|
void CStream::Stop()
|
||||||
@ -1461,52 +1817,95 @@ void CStream::Update()
|
|||||||
|
|
||||||
if ( !m_bPaused )
|
if ( !m_bPaused )
|
||||||
{
|
{
|
||||||
ALint sourceState[2];
|
|
||||||
ALint buffersProcessed[2] = { 0, 0 };
|
bool buffersQueuedAndStarted = false;
|
||||||
|
bool buffersQueuedButNotStarted = false;
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
// Put it in here because we need totalBuffers after queueing to decide when to loop audio
|
||||||
|
if (m_bActive)
|
||||||
|
{
|
||||||
|
buffersQueuedAndStarted = QueueBuffers();
|
||||||
|
if(buffersQueuedAndStarted) {
|
||||||
|
SetPlay(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
ALint totalBuffers[2] = {0, 0};
|
||||||
|
ALint buffersProcessed[2] = {0, 0};
|
||||||
|
|
||||||
// Relying a lot on left buffer states in here
|
// Relying a lot on left buffer states in here
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
//alSourcef(m_pAlSources[0], AL_ROLLOFF_FACTOR, 0.0f);
|
//alSourcef(m_pAlSources[0], AL_ROLLOFF_FACTOR, 0.0f);
|
||||||
alGetSourcei(m_pAlSources[0], AL_SOURCE_STATE, &sourceState[0]);
|
alGetSourcei(m_pAlSources[0], AL_BUFFERS_QUEUED, &totalBuffers[0]);
|
||||||
alGetSourcei(m_pAlSources[0], AL_BUFFERS_PROCESSED, &buffersProcessed[0]);
|
alGetSourcei(m_pAlSources[0], AL_BUFFERS_PROCESSED, &buffersProcessed[0]);
|
||||||
//alSourcef(m_pAlSources[1], AL_ROLLOFF_FACTOR, 0.0f);
|
//alSourcef(m_pAlSources[1], AL_ROLLOFF_FACTOR, 0.0f);
|
||||||
alGetSourcei(m_pAlSources[1], AL_SOURCE_STATE, &sourceState[1]);
|
alGetSourcei(m_pAlSources[1], AL_BUFFERS_QUEUED, &totalBuffers[1]);
|
||||||
alGetSourcei(m_pAlSources[1], AL_BUFFERS_PROCESSED, &buffersProcessed[1]);
|
alGetSourcei(m_pAlSources[1], AL_BUFFERS_PROCESSED, &buffersProcessed[1]);
|
||||||
} while (buffersProcessed[0] != buffersProcessed[1]);
|
} while (buffersProcessed[0] != buffersProcessed[1]);
|
||||||
|
|
||||||
ALint looping = AL_FALSE;
|
|
||||||
alGetSourcei(m_pAlSources[0], AL_LOOPING, &looping);
|
|
||||||
|
|
||||||
if ( looping == AL_TRUE )
|
|
||||||
{
|
|
||||||
TRACE("stream set looping");
|
|
||||||
alSourcei(m_pAlSources[0], AL_LOOPING, AL_TRUE);
|
|
||||||
alSourcei(m_pAlSources[1], AL_LOOPING, AL_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
assert(buffersProcessed[0] == buffersProcessed[1]);
|
assert(buffersProcessed[0] == buffersProcessed[1]);
|
||||||
|
|
||||||
while( buffersProcessed[0]-- )
|
// Correcting OpenAL concepts here:
|
||||||
|
// AL_BUFFERS_QUEUED = Number of *all* buffers in queue, including processed, processing and pending
|
||||||
|
// AL_BUFFERS_PROCESSED = Index of the buffer being processing right now. Buffers coming after that(have greater index) are pending buffers.
|
||||||
|
// which means: totalBuffers[0] - buffersProcessed[0] = pending buffers
|
||||||
|
|
||||||
|
// We should wait queue to be cleared to loop track, because position calculation relies on queue.
|
||||||
|
if (m_nLoopCount != 1 && m_bActive && totalBuffers[0] == 0)
|
||||||
|
{
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
if (m_fillBuffers.empty() && m_queueBuffers.emptyNts()) // we already acquired stream mutex, which is enough for second thread. thus Nts variant
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
Setup(true, false);
|
||||||
|
BuffersShouldBeFilled(); // will also call SetPlay(true)
|
||||||
|
if (m_nLoopCount != 0)
|
||||||
|
m_nLoopCount--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
static std::queue<std::pair<ALuint, ALuint>> tempFillBuffer;
|
||||||
|
|
||||||
|
while ( buffersProcessed[0]-- )
|
||||||
{
|
{
|
||||||
ALuint buffer[2];
|
ALuint buffer[2];
|
||||||
|
|
||||||
alSourceUnqueueBuffers(m_pAlSources[0], 1, &buffer[0]);
|
alSourceUnqueueBuffers(m_pAlSources[0], 1, &buffer[0]);
|
||||||
alSourceUnqueueBuffers(m_pAlSources[1], 1, &buffer[1]);
|
alSourceUnqueueBuffers(m_pAlSources[1], 1, &buffer[1]);
|
||||||
|
|
||||||
if (m_bActive && FillBuffer(buffer))
|
if (m_bActive)
|
||||||
{
|
{
|
||||||
alSourceQueueBuffers(m_pAlSources[0], 1, &buffer[0]);
|
tempFillBuffer.push(std::pair<ALuint, ALuint>(buffer[0], buffer[1]));
|
||||||
alSourceQueueBuffers(m_pAlSources[1], 1, &buffer[1]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sourceState[0] != AL_PLAYING )
|
if (m_bActive && buffersProcessed[1])
|
||||||
{
|
{
|
||||||
alGetSourcei(m_pAlSources[0], AL_BUFFERS_PROCESSED, &buffersProcessed[0]);
|
#ifdef MULTITHREADED_AUDIO
|
||||||
SetPlay(buffersProcessed[0]!=0);
|
m_mutex.lock();
|
||||||
|
#endif
|
||||||
|
while (!tempFillBuffer.empty()) {
|
||||||
|
auto elem = tempFillBuffer.front();
|
||||||
|
tempFillBuffer.pop();
|
||||||
|
buffersQueuedButNotStarted = BufferShouldBeFilledAndQueued(&elem);
|
||||||
}
|
}
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
m_mutex.unlock();
|
||||||
|
FlagAsToBeProcessed();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Source may be starved to audio and stopped itself
|
||||||
|
if (m_bActive && !buffersQueuedAndStarted && (buffersQueuedButNotStarted || (totalBuffers[1] - buffersProcessed[1] != 0)))
|
||||||
|
SetPlay(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1514,27 +1913,45 @@ void CStream::ProviderInit()
|
|||||||
{
|
{
|
||||||
if ( m_bReset )
|
if ( m_bReset )
|
||||||
{
|
{
|
||||||
if ( Setup() )
|
if ( Setup(true, false) ) // lock not needed, thread can't process streams with m_bReset set
|
||||||
{
|
{
|
||||||
SetPan(m_nPan);
|
SetPan(m_nPan);
|
||||||
SetVolume(m_nVolume);
|
SetVolume(m_nVolume);
|
||||||
|
SetLoopCount(m_nLoopCount);
|
||||||
SetPosMS(m_nPosBeforeReset);
|
SetPosMS(m_nPosBeforeReset);
|
||||||
if (m_bActive)
|
#ifdef MULTITHREADED_AUDIO
|
||||||
FillBuffers();
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
SetPlay(m_bActive);
|
#endif
|
||||||
if ( m_bPaused )
|
if(m_bActive)
|
||||||
|
BuffersShouldBeFilled();
|
||||||
|
|
||||||
|
if (m_bPaused)
|
||||||
Pause();
|
Pause();
|
||||||
}
|
|
||||||
|
|
||||||
m_bReset = false;
|
m_bReset = false;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
std::unique_lock<std::mutex> lock(m_mutex);
|
||||||
|
#endif
|
||||||
|
m_bReset = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CStream::ProviderTerm()
|
void CStream::ProviderTerm()
|
||||||
{
|
{
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
|
||||||
|
// unlike Close() we will reuse this stream, so clearing queues are important.
|
||||||
|
std::queue<std::pair<ALuint, ALuint>>().swap(m_fillBuffers);
|
||||||
|
tsQueue<std::pair<ALuint, ALuint>>().swapNts(m_queueBuffers); // stream mutex is already acquired, thus Nts variant
|
||||||
|
#endif
|
||||||
m_bReset = true;
|
m_bReset = true;
|
||||||
m_nPosBeforeReset = GetPosMS();
|
m_nPosBeforeReset = GetPosMS();
|
||||||
|
|
||||||
|
Stop();
|
||||||
ClearBuffers();
|
ClearBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ public:
|
|||||||
virtual ~IDecoder() { }
|
virtual ~IDecoder() { }
|
||||||
|
|
||||||
virtual bool IsOpened() = 0;
|
virtual bool IsOpened() = 0;
|
||||||
|
virtual void FileOpen() = 0;
|
||||||
|
|
||||||
virtual uint32 GetSampleSize() = 0;
|
virtual uint32 GetSampleSize() = 0;
|
||||||
virtual uint32 GetSampleCount() = 0;
|
virtual uint32 GetSampleCount() = 0;
|
||||||
@ -48,12 +49,70 @@ public:
|
|||||||
|
|
||||||
uint32 GetLength()
|
uint32 GetLength()
|
||||||
{
|
{
|
||||||
|
FileOpen(); // abort deferred init, we need length now - game has to cache audio file sizes
|
||||||
return float(GetSampleCount()) * 1000.0f / float(GetSampleRate());
|
return float(GetSampleCount()) * 1000.0f / float(GetSampleRate());
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual uint32 Decode(void *buffer) = 0;
|
virtual uint32 Decode(void *buffer) = 0;
|
||||||
};
|
};
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
template <typename T> class tsQueue
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
tsQueue() : count(0) { }
|
||||||
|
|
||||||
|
void push(const T &value)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
m_queue.push(value);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool peekPop(T *retVal)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
if (count == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
*retVal = m_queue.front();
|
||||||
|
m_queue.pop();
|
||||||
|
count--;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void swapNts(tsQueue<T> &replaceWith)
|
||||||
|
{
|
||||||
|
m_queue.swap(replaceWith.m_queue);
|
||||||
|
replaceWith.count = count;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void swapTs(tsQueue<T> &replaceWith)
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
std::lock_guard<std::mutex> lock2(replaceWith.m_mutex);
|
||||||
|
swapNts(replaceWith);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
bool emptyNts()
|
||||||
|
{
|
||||||
|
return count == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
bool emptyTs()
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(m_mutex);
|
||||||
|
return emptyNts();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
std::queue<T> m_queue;
|
||||||
|
int count;
|
||||||
|
mutable std::mutex m_mutex;
|
||||||
|
};
|
||||||
|
#endif
|
||||||
class CStream
|
class CStream
|
||||||
{
|
{
|
||||||
char m_aFilename[128];
|
char m_aFilename[128];
|
||||||
@ -63,15 +122,34 @@ class CStream
|
|||||||
bool m_bPaused;
|
bool m_bPaused;
|
||||||
bool m_bActive;
|
bool m_bActive;
|
||||||
|
|
||||||
|
public:
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
std::mutex m_mutex;
|
||||||
|
std::queue<std::pair<ALuint, ALuint>> m_fillBuffers; // left and right buffer
|
||||||
|
tsQueue<std::pair<ALuint, ALuint>> m_queueBuffers;
|
||||||
|
// std::condition_variable m_closeCv;
|
||||||
|
bool m_bDoSeek;
|
||||||
|
uint32 m_SeekPos;
|
||||||
|
bool m_bIExist;
|
||||||
|
#endif
|
||||||
|
|
||||||
void *m_pBuffer;
|
void *m_pBuffer;
|
||||||
|
|
||||||
bool m_bReset;
|
bool m_bReset;
|
||||||
uint32 m_nVolume;
|
uint32 m_nVolume;
|
||||||
uint8 m_nPan;
|
uint8 m_nPan;
|
||||||
uint32 m_nPosBeforeReset;
|
uint32 m_nPosBeforeReset;
|
||||||
|
int32 m_nLoopCount;
|
||||||
|
|
||||||
IDecoder *m_pSoundFile;
|
IDecoder *m_pSoundFile;
|
||||||
|
|
||||||
|
void BuffersShouldBeFilled(); // all
|
||||||
|
bool BufferShouldBeFilledAndQueued(std::pair<ALuint, ALuint>*); // two (left-right)
|
||||||
|
#ifdef MULTITHREADED_AUDIO
|
||||||
|
void FlagAsToBeProcessed(bool close = false);
|
||||||
|
bool QueueBuffers();
|
||||||
|
#endif
|
||||||
|
|
||||||
bool HasSource();
|
bool HasSource();
|
||||||
void SetPosition(int i, float x, float y, float z);
|
void SetPosition(int i, float x, float y, float z);
|
||||||
void SetPitch(float pitch);
|
void SetPitch(float pitch);
|
||||||
@ -82,13 +160,15 @@ class CStream
|
|||||||
bool FillBuffer(ALuint *alBuffer);
|
bool FillBuffer(ALuint *alBuffer);
|
||||||
int32 FillBuffers();
|
int32 FillBuffers();
|
||||||
void ClearBuffers();
|
void ClearBuffers();
|
||||||
public:
|
//public:
|
||||||
static void Initialise();
|
static void Initialise();
|
||||||
static void Terminate();
|
static void Terminate();
|
||||||
|
|
||||||
CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS], uint32 overrideSampleRate = 32000);
|
CStream(ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS]);
|
||||||
~CStream();
|
~CStream();
|
||||||
void Delete();
|
void Delete();
|
||||||
|
bool Open(const char *filename, uint32 overrideSampleRate = 32000);
|
||||||
|
void Close();
|
||||||
|
|
||||||
bool IsOpened();
|
bool IsOpened();
|
||||||
bool IsPlaying();
|
bool IsPlaying();
|
||||||
@ -99,10 +179,11 @@ public:
|
|||||||
uint32 GetPosMS();
|
uint32 GetPosMS();
|
||||||
uint32 GetLengthMS();
|
uint32 GetLengthMS();
|
||||||
|
|
||||||
bool Setup();
|
bool Setup(bool imSureQueueIsEmpty = false, bool lock = true);
|
||||||
void Start();
|
void Start();
|
||||||
void Stop();
|
void Stop();
|
||||||
void Update(void);
|
void Update(void);
|
||||||
|
void SetLoopCount(int32);
|
||||||
|
|
||||||
void ProviderInit();
|
void ProviderInit();
|
||||||
void ProviderTerm();
|
void ProviderTerm();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "AudioSamples.h"
|
#include "AudioSamples.h"
|
||||||
|
#include "audio_enums.h"
|
||||||
|
|
||||||
#define MAX_VOLUME 127
|
#define MAX_VOLUME 127
|
||||||
#define MAX_FREQ DIGITALRATE
|
#define MAX_FREQ DIGITALRATE
|
||||||
@ -99,10 +100,15 @@ enum
|
|||||||
|
|
||||||
#define MAXPROVIDERS 64
|
#define MAXPROVIDERS 64
|
||||||
|
|
||||||
#define MAXCHANNELS 28
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
#define MAXCHANNELS_SURROUND 24
|
#define MAXCHANNELS (NUM_CHANNELS_GENERIC+1)
|
||||||
|
#define MAXCHANNELS_SURROUND (MAXCHANNELS-4)
|
||||||
#define MAX2DCHANNELS 1
|
#define MAX2DCHANNELS 1
|
||||||
#define CHANNEL2D MAXCHANNELS
|
#else
|
||||||
|
#define MAXCHANNELS 0
|
||||||
|
#define MAXCHANNELS_SURROUND 0
|
||||||
|
#define MAX2DCHANNELS NUM_CHANNELS
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_STREAMS 2
|
#define MAX_STREAMS 2
|
||||||
|
|
||||||
@ -114,7 +120,13 @@ enum
|
|||||||
#define DIGITALBITS 16
|
#define DIGITALBITS 16
|
||||||
#define DIGITALCHANNELS 2
|
#define DIGITALCHANNELS 2
|
||||||
|
|
||||||
#define MAX_DIGITAL_MIXER_CHANNELS 32
|
#ifdef FIX_BUGS
|
||||||
|
#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2+MAX2DCHANNELS)
|
||||||
|
#else
|
||||||
|
#define MAX_DIGITAL_MIXER_CHANNELS (MAXCHANNELS+MAX_STREAMS*2)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static_assert( NUM_CHANNELS == MAXCHANNELS + MAX2DCHANNELS, "The number of channels doesn't match with an enum" );
|
||||||
|
|
||||||
class cSampleManager
|
class cSampleManager
|
||||||
{
|
{
|
||||||
@ -122,10 +134,10 @@ class cSampleManager
|
|||||||
uint8 m_nMusicVolume;
|
uint8 m_nMusicVolume;
|
||||||
uint8 m_nEffectsFadeVolume;
|
uint8 m_nEffectsFadeVolume;
|
||||||
uint8 m_nMusicFadeVolume;
|
uint8 m_nMusicFadeVolume;
|
||||||
uint8 m_nMonoMode;
|
bool8 m_nMonoMode;
|
||||||
char unk;
|
char unk;
|
||||||
char m_szCDRomRootPath[80];
|
char m_szCDRomRootPath[80];
|
||||||
bool m_bInitialised;
|
bool8 m_bInitialised;
|
||||||
uint8 m_nNumberOfProviders;
|
uint8 m_nNumberOfProviders;
|
||||||
char *m_aAudioProviders[MAXPROVIDERS];
|
char *m_aAudioProviders[MAXPROVIDERS];
|
||||||
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
|
tSample m_aSamples[TOTAL_AUDIO_SAMPLES];
|
||||||
@ -137,6 +149,7 @@ public:
|
|||||||
cSampleManager(void);
|
cSampleManager(void);
|
||||||
~cSampleManager(void);
|
~cSampleManager(void);
|
||||||
|
|
||||||
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
void SetSpeakerConfig(int32 nConfig);
|
void SetSpeakerConfig(int32 nConfig);
|
||||||
uint32 GetMaximumSupportedChannels(void);
|
uint32 GetMaximumSupportedChannels(void);
|
||||||
|
|
||||||
@ -148,16 +161,17 @@ public:
|
|||||||
|
|
||||||
int8 GetCurrent3DProviderIndex(void);
|
int8 GetCurrent3DProviderIndex(void);
|
||||||
int8 SetCurrent3DProvider(uint8 which);
|
int8 SetCurrent3DProvider(uint8 which);
|
||||||
|
#endif
|
||||||
|
|
||||||
bool IsMP3RadioChannelAvailable(void);
|
bool8 IsMP3RadioChannelAvailable(void);
|
||||||
|
|
||||||
void ReleaseDigitalHandle (void);
|
void ReleaseDigitalHandle (void);
|
||||||
void ReacquireDigitalHandle(void);
|
void ReacquireDigitalHandle(void);
|
||||||
|
|
||||||
bool Initialise(void);
|
bool8 Initialise(void);
|
||||||
void Terminate (void);
|
void Terminate (void);
|
||||||
|
|
||||||
bool CheckForAnAudioFileOnCD(void);
|
bool8 CheckForAnAudioFileOnCD(void);
|
||||||
char GetCDAudioDriveLetter (void);
|
char GetCDAudioDriveLetter (void);
|
||||||
|
|
||||||
void UpdateEffectsVolume(void);
|
void UpdateEffectsVolume(void);
|
||||||
@ -166,14 +180,14 @@ public:
|
|||||||
void SetMusicMasterVolume (uint8 nVolume);
|
void SetMusicMasterVolume (uint8 nVolume);
|
||||||
void SetEffectsFadeVolume (uint8 nVolume);
|
void SetEffectsFadeVolume (uint8 nVolume);
|
||||||
void SetMusicFadeVolume (uint8 nVolume);
|
void SetMusicFadeVolume (uint8 nVolume);
|
||||||
void SetMonoMode (uint8 nMode);
|
void SetMonoMode (bool8 nMode);
|
||||||
|
|
||||||
bool LoadSampleBank (uint8 nBank);
|
bool8 LoadSampleBank (uint8 nBank);
|
||||||
void UnloadSampleBank (uint8 nBank);
|
void UnloadSampleBank (uint8 nBank);
|
||||||
bool IsSampleBankLoaded(uint8 nBank);
|
bool8 IsSampleBankLoaded(uint8 nBank);
|
||||||
|
|
||||||
bool IsPedCommentLoaded(uint32 nComment);
|
bool8 IsPedCommentLoaded(uint32 nComment);
|
||||||
bool LoadPedComment (uint32 nComment);
|
bool8 LoadPedComment (uint32 nComment);
|
||||||
int32 GetBankContainingSound(uint32 offset);
|
int32 GetBankContainingSound(uint32 offset);
|
||||||
|
|
||||||
int32 _GetPedCommentSlot(uint32 nComment);
|
int32 _GetPedCommentSlot(uint32 nComment);
|
||||||
@ -183,35 +197,37 @@ public:
|
|||||||
int32 GetSampleLoopEndOffset (uint32 nSample);
|
int32 GetSampleLoopEndOffset (uint32 nSample);
|
||||||
uint32 GetSampleLength (uint32 nSample);
|
uint32 GetSampleLength (uint32 nSample);
|
||||||
|
|
||||||
bool UpdateReverb(void);
|
bool8 UpdateReverb(void);
|
||||||
|
|
||||||
void SetChannelReverbFlag (uint32 nChannel, uint8 nReverbFlag);
|
void SetChannelReverbFlag (uint32 nChannel, bool8 nReverbFlag);
|
||||||
bool InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
|
bool8 InitialiseChannel (uint32 nChannel, uint32 nSfx, uint8 nBank);
|
||||||
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
|
void SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume);
|
||||||
void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
|
void SetChannel3DPosition (uint32 nChannel, float fX, float fY, float fZ);
|
||||||
void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
|
void SetChannel3DDistances (uint32 nChannel, float fMax, float fMin);
|
||||||
|
#endif
|
||||||
void SetChannelVolume (uint32 nChannel, uint32 nVolume);
|
void SetChannelVolume (uint32 nChannel, uint32 nVolume);
|
||||||
void SetChannelPan (uint32 nChannel, uint32 nPan);
|
void SetChannelPan (uint32 nChannel, uint32 nPan);
|
||||||
void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
|
void SetChannelFrequency (uint32 nChannel, uint32 nFreq);
|
||||||
void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd);
|
void SetChannelLoopPoints (uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd);
|
||||||
void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount);
|
void SetChannelLoopCount (uint32 nChannel, uint32 nLoopCount);
|
||||||
bool GetChannelUsedFlag (uint32 nChannel);
|
bool8 GetChannelUsedFlag (uint32 nChannel);
|
||||||
void StartChannel (uint32 nChannel);
|
void StartChannel (uint32 nChannel);
|
||||||
void StopChannel (uint32 nChannel);
|
void StopChannel (uint32 nChannel);
|
||||||
|
|
||||||
void PreloadStreamedFile (uint8 nFile, uint8 nStream);
|
void PreloadStreamedFile (uint8 nFile, uint8 nStream = 0);
|
||||||
void PauseStream (uint8 nPauseFlag, uint8 nStream);
|
void PauseStream (bool8 nPauseFlag, uint8 nStream = 0);
|
||||||
void StartPreloadedStreamedFile (uint8 nStream);
|
void StartPreloadedStreamedFile (uint8 nStream = 0);
|
||||||
bool StartStreamedFile (uint8 nFile, uint32 nPos, uint8 nStream);
|
bool8 StartStreamedFile (uint8 nFile, uint32 nPos, uint8 nStream = 0);
|
||||||
void StopStreamedFile (uint8 nStream);
|
void StopStreamedFile (uint8 nStream = 0);
|
||||||
int32 GetStreamedFilePosition (uint8 nStream);
|
int32 GetStreamedFilePosition (uint8 nStream = 0);
|
||||||
void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream);
|
void SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, bool8 nEffectFlag, uint8 nStream = 0);
|
||||||
int32 GetStreamedFileLength (uint8 nStream);
|
int32 GetStreamedFileLength (uint8 nStream = 0);
|
||||||
bool IsStreamPlaying (uint8 nStream);
|
bool8 IsStreamPlaying (uint8 nStream = 0);
|
||||||
#ifdef AUDIO_OAL
|
#ifdef AUDIO_OAL
|
||||||
void Service(void);
|
void Service(void);
|
||||||
#endif
|
#endif
|
||||||
bool InitialiseSampleBanks(void);
|
bool8 InitialiseSampleBanks(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern cSampleManager SampleManager;
|
extern cSampleManager SampleManager;
|
||||||
@ -257,8 +273,8 @@ static char StreamedNameTable[][25] = {
|
|||||||
"AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS",
|
"AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS",
|
||||||
"AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"};
|
"AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"};
|
||||||
#else
|
#else
|
||||||
#if defined(PS2_AUDIO_PATHS)
|
#ifdef PS2_AUDIO_PATHS
|
||||||
static char StreamedNameTable[][25]=
|
static char PS2StreamedNameTable[][25]=
|
||||||
{
|
{
|
||||||
"AUDIO\\MUSIC\\HEAD.VB",
|
"AUDIO\\MUSIC\\HEAD.VB",
|
||||||
"AUDIO\\MUSIC\\CLASS.VB",
|
"AUDIO\\MUSIC\\CLASS.VB",
|
||||||
@ -355,105 +371,207 @@ static char StreamedNameTable[][25]=
|
|||||||
"AUDIO\\PHONE\\MT_PH4.VB",
|
"AUDIO\\PHONE\\MT_PH4.VB",
|
||||||
"AUDIO\\MUSIC\\MISCOM.VB",
|
"AUDIO\\MUSIC\\MISCOM.VB",
|
||||||
"AUDIO\\MUSIC\\END.VB",
|
"AUDIO\\MUSIC\\END.VB",
|
||||||
#else
|
"AUDIO\\lib_a1.WAV",
|
||||||
static char StreamedNameTable[][25] =
|
"AUDIO\\lib_a2.WAV",
|
||||||
{
|
"AUDIO\\lib_a.WAV",
|
||||||
"AUDIO\\HEAD.WAV",
|
"AUDIO\\lib_b.WAV",
|
||||||
"AUDIO\\CLASS.WAV",
|
"AUDIO\\lib_c.WAV",
|
||||||
"AUDIO\\KJAH.WAV",
|
"AUDIO\\lib_d.WAV",
|
||||||
"AUDIO\\RISE.WAV",
|
"AUDIO\\l2_a.WAV",
|
||||||
"AUDIO\\LIPS.WAV",
|
"AUDIO\\j4t_1.WAV",
|
||||||
"AUDIO\\GAME.WAV",
|
"AUDIO\\j4t_2.WAV",
|
||||||
"AUDIO\\MSX.WAV",
|
"AUDIO\\j4t_3.WAV",
|
||||||
"AUDIO\\FLASH.WAV",
|
"AUDIO\\j4t_4.WAV",
|
||||||
"AUDIO\\CHAT.WAV",
|
"AUDIO\\j4_a.WAV",
|
||||||
"AUDIO\\HEAD.WAV",
|
"AUDIO\\j4_b.WAV",
|
||||||
"AUDIO\\POLICE.WAV",
|
"AUDIO\\j4_c.WAV",
|
||||||
"AUDIO\\CITY.WAV",
|
"AUDIO\\j4_d.WAV",
|
||||||
"AUDIO\\WATER.WAV",
|
"AUDIO\\j4_e.WAV",
|
||||||
"AUDIO\\COMOPEN.WAV",
|
"AUDIO\\j4_f.WAV",
|
||||||
"AUDIO\\SUBOPEN.WAV",
|
"AUDIO\\j6_1.WAV",
|
||||||
"AUDIO\\JB.MP3",
|
"AUDIO\\j6_a.WAV",
|
||||||
"AUDIO\\BET.MP3",
|
"AUDIO\\j6_b.WAV",
|
||||||
"AUDIO\\L1_LG.MP3",
|
"AUDIO\\j6_c.WAV",
|
||||||
"AUDIO\\L2_DSB.MP3",
|
"AUDIO\\j6_d.WAV",
|
||||||
"AUDIO\\L3_DM.MP3",
|
"AUDIO\\t4_a.WAV",
|
||||||
"AUDIO\\L4_PAP.MP3",
|
"AUDIO\\s1_a.WAV",
|
||||||
"AUDIO\\L5_TFB.MP3",
|
"AUDIO\\s1_a1.WAV",
|
||||||
"AUDIO\\J0_DM2.MP3",
|
"AUDIO\\s1_b.WAV",
|
||||||
"AUDIO\\J1_LFL.MP3",
|
"AUDIO\\s1_c.WAV",
|
||||||
"AUDIO\\J2_KCL.MP3",
|
"AUDIO\\s1_c1.WAV",
|
||||||
"AUDIO\\J3_VH.MP3",
|
"AUDIO\\s1_d.WAV",
|
||||||
"AUDIO\\J4_ETH.MP3",
|
"AUDIO\\s1_e.WAV",
|
||||||
"AUDIO\\J5_DST.MP3",
|
"AUDIO\\s1_f.WAV",
|
||||||
"AUDIO\\J6_TBJ.MP3",
|
"AUDIO\\s1_g.WAV",
|
||||||
"AUDIO\\T1_TOL.MP3",
|
"AUDIO\\s1_h.WAV",
|
||||||
"AUDIO\\T2_TPU.MP3",
|
"AUDIO\\s1_i.WAV",
|
||||||
"AUDIO\\T3_MAS.MP3",
|
"AUDIO\\s1_j.WAV",
|
||||||
"AUDIO\\T4_TAT.MP3",
|
"AUDIO\\s1_k.WAV",
|
||||||
"AUDIO\\T5_BF.MP3",
|
"AUDIO\\s1_l.WAV",
|
||||||
"AUDIO\\S0_MAS.MP3",
|
"AUDIO\\s3_a.WAV",
|
||||||
"AUDIO\\S1_PF.MP3",
|
"AUDIO\\s3_b.WAV",
|
||||||
"AUDIO\\S2_CTG.MP3",
|
"AUDIO\\el3_a.WAV",
|
||||||
"AUDIO\\S3_RTC.MP3",
|
"AUDIO\\mf1_a.WAV",
|
||||||
"AUDIO\\S5_LRQ.MP3",
|
"AUDIO\\mf2_a.WAV",
|
||||||
"AUDIO\\S4_BDBA.MP3",
|
"AUDIO\\mf3_a.WAV",
|
||||||
"AUDIO\\S4_BDBB.MP3",
|
"AUDIO\\mf3_b.WAV",
|
||||||
"AUDIO\\S2_CTG2.MP3",
|
"AUDIO\\mf3_b1.WAV",
|
||||||
"AUDIO\\S4_BDBD.MP3",
|
"AUDIO\\mf3_c.WAV",
|
||||||
"AUDIO\\S5_LRQB.MP3",
|
"AUDIO\\mf4_a.WAV",
|
||||||
"AUDIO\\S5_LRQC.MP3",
|
"AUDIO\\mf4_b.WAV",
|
||||||
"AUDIO\\A1_SSO.WAV",
|
"AUDIO\\mf4_c.WAV",
|
||||||
"AUDIO\\A2_PP.WAV",
|
"AUDIO\\a1_a.WAV",
|
||||||
"AUDIO\\A3_SS.WAV",
|
"AUDIO\\a3_a.WAV",
|
||||||
"AUDIO\\A4_PDR.WAV",
|
"AUDIO\\a5_a.WAV",
|
||||||
"AUDIO\\A5_K2FT.WAV",
|
"AUDIO\\a4_a.WAV",
|
||||||
"AUDIO\\K1_KBO.MP3",
|
"AUDIO\\a4_b.WAV",
|
||||||
"AUDIO\\K2_GIS.MP3",
|
"AUDIO\\a4_c.WAV",
|
||||||
"AUDIO\\K3_DS.MP3",
|
"AUDIO\\a4_d.WAV",
|
||||||
"AUDIO\\K4_SHI.MP3",
|
"AUDIO\\k1_a.WAV",
|
||||||
"AUDIO\\K5_SD.MP3",
|
"AUDIO\\k3_a.WAV",
|
||||||
"AUDIO\\R0_PDR2.MP3",
|
"AUDIO\\r1_a.WAV",
|
||||||
"AUDIO\\R1_SW.MP3",
|
"AUDIO\\r2_a.WAV",
|
||||||
"AUDIO\\R2_AP.MP3",
|
"AUDIO\\r2_b.WAV",
|
||||||
"AUDIO\\R3_ED.MP3",
|
"AUDIO\\r2_c.WAV",
|
||||||
"AUDIO\\R4_GF.MP3",
|
"AUDIO\\r2_d.WAV",
|
||||||
"AUDIO\\R5_PB.MP3",
|
"AUDIO\\r2_e.WAV",
|
||||||
"AUDIO\\R6_MM.MP3",
|
"AUDIO\\r2_f.WAV",
|
||||||
"AUDIO\\D1_STOG.MP3",
|
"AUDIO\\r2_g.WAV",
|
||||||
"AUDIO\\D2_KK.MP3",
|
"AUDIO\\r2_h.WAV",
|
||||||
"AUDIO\\D3_ADO.MP3",
|
"AUDIO\\r5_a.WAV",
|
||||||
"AUDIO\\D5_ES.MP3",
|
"AUDIO\\r6_a.WAV",
|
||||||
"AUDIO\\D7_MLD.MP3",
|
"AUDIO\\r6_a1.WAV",
|
||||||
"AUDIO\\D4_GTA.MP3",
|
"AUDIO\\r6_b.WAV",
|
||||||
"AUDIO\\D4_GTA2.MP3",
|
"AUDIO\\lo2_a.WAV",
|
||||||
"AUDIO\\D6_STS.MP3",
|
"AUDIO\\lo6_a.WAV",
|
||||||
"AUDIO\\A6_BAIT.WAV",
|
"AUDIO\\yd2_a.WAV",
|
||||||
"AUDIO\\A7_ETG.WAV",
|
"AUDIO\\yd2_b.WAV",
|
||||||
"AUDIO\\A8_PS.WAV",
|
"AUDIO\\yd2_c.WAV",
|
||||||
"AUDIO\\A9_ASD.WAV",
|
"AUDIO\\yd2_c1.WAV",
|
||||||
"AUDIO\\K4_SHI2.MP3",
|
"AUDIO\\yd2_d.WAV",
|
||||||
"AUDIO\\C1_TEX.MP3",
|
"AUDIO\\yd2_e.WAV",
|
||||||
"AUDIO\\EL_PH1.MP3",
|
"AUDIO\\yd2_f.WAV",
|
||||||
"AUDIO\\EL_PH2.MP3",
|
"AUDIO\\yd2_g.WAV",
|
||||||
"AUDIO\\EL_PH3.MP3",
|
"AUDIO\\yd2_h.WAV",
|
||||||
"AUDIO\\EL_PH4.MP3",
|
"AUDIO\\yd2_ass.WAV",
|
||||||
"AUDIO\\YD_PH1.MP3",
|
"AUDIO\\yd2_ok.WAV",
|
||||||
"AUDIO\\YD_PH2.MP3",
|
"AUDIO\\h5_a.WAV",
|
||||||
"AUDIO\\YD_PH3.MP3",
|
"AUDIO\\h5_b.WAV",
|
||||||
"AUDIO\\YD_PH4.MP3",
|
"AUDIO\\h5_c.WAV",
|
||||||
"AUDIO\\HD_PH1.MP3",
|
"AUDIO\\ammu_a.WAV",
|
||||||
"AUDIO\\HD_PH2.MP3",
|
"AUDIO\\ammu_b.WAV",
|
||||||
"AUDIO\\HD_PH3.MP3",
|
"AUDIO\\ammu_c.WAV",
|
||||||
"AUDIO\\HD_PH4.MP3",
|
"AUDIO\\door_1.WAV",
|
||||||
"AUDIO\\HD_PH5.MP3",
|
"AUDIO\\door_2.WAV",
|
||||||
"AUDIO\\MT_PH1.MP3",
|
"AUDIO\\door_3.WAV",
|
||||||
"AUDIO\\MT_PH2.MP3",
|
"AUDIO\\door_4.WAV",
|
||||||
"AUDIO\\MT_PH3.MP3",
|
"AUDIO\\door_5.WAV",
|
||||||
"AUDIO\\MT_PH4.MP3",
|
"AUDIO\\door_6.WAV",
|
||||||
"AUDIO\\MISCOM.WAV",
|
"AUDIO\\t3_a.WAV",
|
||||||
"AUDIO\\END.MP3",
|
"AUDIO\\t3_b.WAV",
|
||||||
#endif
|
"AUDIO\\t3_c.WAV",
|
||||||
|
"AUDIO\\k1_b.WAV",
|
||||||
|
"AUDIO\\cat1.WAV"
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static char StreamedNameTable[][25] =
|
||||||
|
{
|
||||||
|
"AUDIO\\HEAD.WAV",
|
||||||
|
"AUDIO\\CLASS.WAV",
|
||||||
|
"AUDIO\\KJAH.WAV",
|
||||||
|
"AUDIO\\RISE.WAV",
|
||||||
|
"AUDIO\\LIPS.WAV",
|
||||||
|
"AUDIO\\GAME.WAV",
|
||||||
|
"AUDIO\\MSX.WAV",
|
||||||
|
"AUDIO\\FLASH.WAV",
|
||||||
|
"AUDIO\\CHAT.WAV",
|
||||||
|
"AUDIO\\HEAD.WAV",
|
||||||
|
"AUDIO\\POLICE.WAV",
|
||||||
|
"AUDIO\\CITY.WAV",
|
||||||
|
"AUDIO\\WATER.WAV",
|
||||||
|
"AUDIO\\COMOPEN.WAV",
|
||||||
|
"AUDIO\\SUBOPEN.WAV",
|
||||||
|
"AUDIO\\JB.MP3",
|
||||||
|
"AUDIO\\BET.MP3",
|
||||||
|
"AUDIO\\L1_LG.MP3",
|
||||||
|
"AUDIO\\L2_DSB.MP3",
|
||||||
|
"AUDIO\\L3_DM.MP3",
|
||||||
|
"AUDIO\\L4_PAP.MP3",
|
||||||
|
"AUDIO\\L5_TFB.MP3",
|
||||||
|
"AUDIO\\J0_DM2.MP3",
|
||||||
|
"AUDIO\\J1_LFL.MP3",
|
||||||
|
"AUDIO\\J2_KCL.MP3",
|
||||||
|
"AUDIO\\J3_VH.MP3",
|
||||||
|
"AUDIO\\J4_ETH.MP3",
|
||||||
|
"AUDIO\\J5_DST.MP3",
|
||||||
|
"AUDIO\\J6_TBJ.MP3",
|
||||||
|
"AUDIO\\T1_TOL.MP3",
|
||||||
|
"AUDIO\\T2_TPU.MP3",
|
||||||
|
"AUDIO\\T3_MAS.MP3",
|
||||||
|
"AUDIO\\T4_TAT.MP3",
|
||||||
|
"AUDIO\\T5_BF.MP3",
|
||||||
|
"AUDIO\\S0_MAS.MP3",
|
||||||
|
"AUDIO\\S1_PF.MP3",
|
||||||
|
"AUDIO\\S2_CTG.MP3",
|
||||||
|
"AUDIO\\S3_RTC.MP3",
|
||||||
|
"AUDIO\\S5_LRQ.MP3",
|
||||||
|
"AUDIO\\S4_BDBA.MP3",
|
||||||
|
"AUDIO\\S4_BDBB.MP3",
|
||||||
|
"AUDIO\\S2_CTG2.MP3",
|
||||||
|
"AUDIO\\S4_BDBD.MP3",
|
||||||
|
"AUDIO\\S5_LRQB.MP3",
|
||||||
|
"AUDIO\\S5_LRQC.MP3",
|
||||||
|
"AUDIO\\A1_SSO.WAV",
|
||||||
|
"AUDIO\\A2_PP.WAV",
|
||||||
|
"AUDIO\\A3_SS.WAV",
|
||||||
|
"AUDIO\\A4_PDR.WAV",
|
||||||
|
"AUDIO\\A5_K2FT.WAV",
|
||||||
|
"AUDIO\\K1_KBO.MP3",
|
||||||
|
"AUDIO\\K2_GIS.MP3",
|
||||||
|
"AUDIO\\K3_DS.MP3",
|
||||||
|
"AUDIO\\K4_SHI.MP3",
|
||||||
|
"AUDIO\\K5_SD.MP3",
|
||||||
|
"AUDIO\\R0_PDR2.MP3",
|
||||||
|
"AUDIO\\R1_SW.MP3",
|
||||||
|
"AUDIO\\R2_AP.MP3",
|
||||||
|
"AUDIO\\R3_ED.MP3",
|
||||||
|
"AUDIO\\R4_GF.MP3",
|
||||||
|
"AUDIO\\R5_PB.MP3",
|
||||||
|
"AUDIO\\R6_MM.MP3",
|
||||||
|
"AUDIO\\D1_STOG.MP3",
|
||||||
|
"AUDIO\\D2_KK.MP3",
|
||||||
|
"AUDIO\\D3_ADO.MP3",
|
||||||
|
"AUDIO\\D5_ES.MP3",
|
||||||
|
"AUDIO\\D7_MLD.MP3",
|
||||||
|
"AUDIO\\D4_GTA.MP3",
|
||||||
|
"AUDIO\\D4_GTA2.MP3",
|
||||||
|
"AUDIO\\D6_STS.MP3",
|
||||||
|
"AUDIO\\A6_BAIT.WAV",
|
||||||
|
"AUDIO\\A7_ETG.WAV",
|
||||||
|
"AUDIO\\A8_PS.WAV",
|
||||||
|
"AUDIO\\A9_ASD.WAV",
|
||||||
|
"AUDIO\\K4_SHI2.MP3",
|
||||||
|
"AUDIO\\C1_TEX.MP3",
|
||||||
|
"AUDIO\\EL_PH1.MP3",
|
||||||
|
"AUDIO\\EL_PH2.MP3",
|
||||||
|
"AUDIO\\EL_PH3.MP3",
|
||||||
|
"AUDIO\\EL_PH4.MP3",
|
||||||
|
"AUDIO\\YD_PH1.MP3",
|
||||||
|
"AUDIO\\YD_PH2.MP3",
|
||||||
|
"AUDIO\\YD_PH3.MP3",
|
||||||
|
"AUDIO\\YD_PH4.MP3",
|
||||||
|
"AUDIO\\HD_PH1.MP3",
|
||||||
|
"AUDIO\\HD_PH2.MP3",
|
||||||
|
"AUDIO\\HD_PH3.MP3",
|
||||||
|
"AUDIO\\HD_PH4.MP3",
|
||||||
|
"AUDIO\\HD_PH5.MP3",
|
||||||
|
"AUDIO\\MT_PH1.MP3",
|
||||||
|
"AUDIO\\MT_PH2.MP3",
|
||||||
|
"AUDIO\\MT_PH3.MP3",
|
||||||
|
"AUDIO\\MT_PH4.MP3",
|
||||||
|
"AUDIO\\MISCOM.WAV",
|
||||||
|
"AUDIO\\END.MP3",
|
||||||
"AUDIO\\lib_a1.WAV",
|
"AUDIO\\lib_a1.WAV",
|
||||||
"AUDIO\\lib_a2.WAV",
|
"AUDIO\\lib_a2.WAV",
|
||||||
"AUDIO\\lib_a.WAV",
|
"AUDIO\\lib_a.WAV",
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
|||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
|
|
||||||
cSampleManager SampleManager;
|
cSampleManager SampleManager;
|
||||||
bool _bSampmanInitialised = false;
|
bool8 _bSampmanInitialised = FALSE;
|
||||||
|
|
||||||
uint32 BankStartOffset[MAX_SFX_BANKS];
|
uint32 BankStartOffset[MAX_SFX_BANKS];
|
||||||
uint32 nNumMP3s;
|
uint32 nNumMP3s;
|
||||||
@ -19,6 +19,7 @@ cSampleManager::~cSampleManager(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
void cSampleManager::SetSpeakerConfig(int32 nConfig)
|
void cSampleManager::SetSpeakerConfig(int32 nConfig)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -59,8 +60,9 @@ int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::IsMP3RadioChannelAvailable(void)
|
cSampleManager::IsMP3RadioChannelAvailable(void)
|
||||||
{
|
{
|
||||||
return nNumMP3s != 0;
|
return nNumMP3s != 0;
|
||||||
@ -75,10 +77,10 @@ void cSampleManager::ReacquireDigitalHandle(void)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::Initialise(void)
|
cSampleManager::Initialise(void)
|
||||||
{
|
{
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -87,9 +89,9 @@ cSampleManager::Terminate(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSampleManager::CheckForAnAudioFileOnCD(void)
|
bool8 cSampleManager::CheckForAnAudioFileOnCD(void)
|
||||||
{
|
{
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
char cSampleManager::GetCDAudioDriveLetter(void)
|
char cSampleManager::GetCDAudioDriveLetter(void)
|
||||||
@ -128,11 +130,11 @@ cSampleManager::SetMonoMode(uint8 nMode)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::LoadSampleBank(uint8 nBank)
|
cSampleManager::LoadSampleBank(uint8 nBank)
|
||||||
{
|
{
|
||||||
ASSERT( nBank < MAX_SFX_BANKS );
|
ASSERT( nBank < MAX_SFX_BANKS );
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -141,20 +143,20 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
|
|||||||
ASSERT( nBank < MAX_SFX_BANKS );
|
ASSERT( nBank < MAX_SFX_BANKS );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::IsSampleBankLoaded(uint8 nBank)
|
cSampleManager::IsSampleBankLoaded(uint8 nBank)
|
||||||
{
|
{
|
||||||
ASSERT( nBank < MAX_SFX_BANKS );
|
ASSERT( nBank < MAX_SFX_BANKS );
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::IsPedCommentLoaded(uint32 nComment)
|
cSampleManager::IsPedCommentLoaded(uint32 nComment)
|
||||||
{
|
{
|
||||||
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
|
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -164,11 +166,11 @@ cSampleManager::_GetPedCommentSlot(uint32 nComment)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::LoadPedComment(uint32 nComment)
|
cSampleManager::LoadPedComment(uint32 nComment)
|
||||||
{
|
{
|
||||||
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
|
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
@ -205,56 +207,58 @@ cSampleManager::GetSampleLength(uint32 nSample)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool cSampleManager::UpdateReverb(void)
|
bool8 cSampleManager::UpdateReverb(void)
|
||||||
{
|
{
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag)
|
cSampleManager::SetChannelReverbFlag(uint32 nChannel, bool8 nReverbFlag)
|
||||||
{
|
{
|
||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
|
||||||
{
|
{
|
||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef EXTERNAL_3D_SOUND
|
||||||
void
|
void
|
||||||
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
|
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
|
||||||
{
|
{
|
||||||
ASSERT( nChannel != CHANNEL2D );
|
ASSERT( nChannel < MAXCHANNELS );
|
||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
|
cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
|
||||||
{
|
{
|
||||||
ASSERT( nChannel != CHANNEL2D );
|
ASSERT( nChannel < MAXCHANNELS );
|
||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
|
cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
|
||||||
{
|
{
|
||||||
ASSERT( nChannel != CHANNEL2D );
|
ASSERT( nChannel < MAXCHANNELS );
|
||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
|
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
|
||||||
{
|
{
|
||||||
ASSERT( nChannel == CHANNEL2D );
|
ASSERT( nChannel >= MAXCHANNELS );
|
||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
|
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
|
||||||
{
|
{
|
||||||
ASSERT(nChannel == CHANNEL2D);
|
ASSERT( nChannel >= MAXCHANNELS );
|
||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -276,12 +280,12 @@ cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
|
|||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
|
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
|
||||||
{
|
{
|
||||||
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -303,7 +307,7 @@ cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream)
|
cSampleManager::PauseStream(bool8 nPauseFlag, uint8 nStream)
|
||||||
{
|
{
|
||||||
ASSERT( nStream < MAX_STREAMS );
|
ASSERT( nStream < MAX_STREAMS );
|
||||||
}
|
}
|
||||||
@ -314,12 +318,12 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
|
|||||||
ASSERT( nStream < MAX_STREAMS );
|
ASSERT( nStream < MAX_STREAMS );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
||||||
{
|
{
|
||||||
ASSERT( nStream < MAX_STREAMS );
|
ASSERT( nStream < MAX_STREAMS );
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -350,19 +354,19 @@ cSampleManager::GetStreamedFileLength(uint8 nStream)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::IsStreamPlaying(uint8 nStream)
|
cSampleManager::IsStreamPlaying(uint8 nStream)
|
||||||
{
|
{
|
||||||
ASSERT( nStream < MAX_STREAMS );
|
ASSERT( nStream < MAX_STREAMS );
|
||||||
|
|
||||||
return false;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool8
|
||||||
cSampleManager::InitialiseSampleBanks(void)
|
cSampleManager::InitialiseSampleBanks(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return true;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -160,7 +160,7 @@ enum eSound
|
|||||||
SOUND_FRONTEND_MONO,
|
SOUND_FRONTEND_MONO,
|
||||||
SOUND_FRONTEND_AUDIO_TEST,
|
SOUND_FRONTEND_AUDIO_TEST,
|
||||||
SOUND_FRONTEND_FAIL,
|
SOUND_FRONTEND_FAIL,
|
||||||
SOUND_FRONTEND_NO_RADIO,
|
SOUND_FRONTEND_RADIO_TURN_OFF,
|
||||||
SOUND_FRONTEND_RADIO_CHANGE,
|
SOUND_FRONTEND_RADIO_CHANGE,
|
||||||
SOUND_HUD,
|
SOUND_HUD,
|
||||||
SOUND_AMMUNATION_WELCOME_1,
|
SOUND_AMMUNATION_WELCOME_1,
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
|
|
||||||
void *CBuilding::operator new(size_t sz) { return CPools::GetBuildingPool()->New(); }
|
void *CBuilding::operator new(size_t sz) throw() { return CPools::GetBuildingPool()->New(); }
|
||||||
void CBuilding::operator delete(void *p, size_t sz) { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
|
void CBuilding::operator delete(void *p, size_t sz) throw() { CPools::GetBuildingPool()->Delete((CBuilding*)p); }
|
||||||
|
|
||||||
void
|
void
|
||||||
CBuilding::ReplaceWithNewModel(int32 id)
|
CBuilding::ReplaceWithNewModel(int32 id)
|
||||||
|
@ -9,8 +9,8 @@ public:
|
|||||||
m_type = ENTITY_TYPE_BUILDING;
|
m_type = ENTITY_TYPE_BUILDING;
|
||||||
bUsesCollision = true;
|
bUsesCollision = true;
|
||||||
}
|
}
|
||||||
static void *operator new(size_t);
|
static void *operator new(size_t) throw();
|
||||||
static void operator delete(void*, size_t);
|
static void operator delete(void*, size_t) throw();
|
||||||
|
|
||||||
void ReplaceWithNewModel(int32 id);
|
void ReplaceWithNewModel(int32 id);
|
||||||
|
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
#include "Treadable.h"
|
#include "Treadable.h"
|
||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
|
|
||||||
void *CTreadable::operator new(size_t sz) { return CPools::GetTreadablePool()->New(); }
|
void *CTreadable::operator new(size_t sz) throw() { return CPools::GetTreadablePool()->New(); }
|
||||||
void CTreadable::operator delete(void *p, size_t sz) { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
|
void CTreadable::operator delete(void *p, size_t sz) throw() { CPools::GetTreadablePool()->Delete((CTreadable*)p); }
|
||||||
|
@ -5,8 +5,8 @@
|
|||||||
class CTreadable : public CBuilding
|
class CTreadable : public CBuilding
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void *operator new(size_t);
|
static void *operator new(size_t) throw();
|
||||||
static void operator delete(void*, size_t);
|
static void operator delete(void*, size_t) throw();
|
||||||
|
|
||||||
int16 m_nodeIndices[2][12]; // first car, then ped
|
int16 m_nodeIndices[2][12]; // first car, then ped
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ GetCollisionInSectorList(CPtrList &list)
|
|||||||
|
|
||||||
for(node = list.first; node; node = node->next){
|
for(node = list.first; node; node = node->next){
|
||||||
e = (CEntity*)node->item;
|
e = (CEntity*)node->item;
|
||||||
level = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel()->level;
|
level = CModelInfo::GetColModel(e->GetModelIndex())->level;
|
||||||
if(level != LEVEL_GENERIC)
|
if(level != LEVEL_GENERIC)
|
||||||
return (eLevelName)level;
|
return (eLevelName)level;
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
#include "Curves.h"
|
#include "Curves.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
|
|
||||||
void CAutoPilot::ModifySpeed(float speed)
|
void CAutoPilot::ModifySpeed(float speed)
|
||||||
{
|
{
|
||||||
@ -49,78 +50,79 @@ void CAutoPilot::RemoveOnePathNode()
|
|||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
void CAutoPilot::Save(uint8*& buf)
|
void CAutoPilot::Save(uint8*& buf)
|
||||||
{
|
{
|
||||||
WriteSaveBuf<int32>(buf, m_nCurrentRouteNode);
|
WriteSaveBuf(buf, m_nCurrentRouteNode);
|
||||||
WriteSaveBuf<int32>(buf, m_nNextRouteNode);
|
WriteSaveBuf(buf, m_nNextRouteNode);
|
||||||
WriteSaveBuf<int32>(buf, m_nPrevRouteNode);
|
WriteSaveBuf(buf, m_nPrevRouteNode);
|
||||||
WriteSaveBuf<uint32>(buf, m_nTimeEnteredCurve);
|
WriteSaveBuf(buf, m_nTimeEnteredCurve);
|
||||||
WriteSaveBuf<uint32>(buf, m_nTimeToSpendOnCurrentCurve);
|
WriteSaveBuf(buf, m_nTimeToSpendOnCurrentCurve);
|
||||||
WriteSaveBuf<uint32>(buf, m_nCurrentPathNodeInfo);
|
WriteSaveBuf(buf, m_nCurrentPathNodeInfo);
|
||||||
WriteSaveBuf<uint32>(buf, m_nNextPathNodeInfo);
|
WriteSaveBuf(buf, m_nNextPathNodeInfo);
|
||||||
WriteSaveBuf<uint32>(buf, m_nPreviousPathNodeInfo);
|
WriteSaveBuf(buf, m_nPreviousPathNodeInfo);
|
||||||
WriteSaveBuf<uint32>(buf, m_nAntiReverseTimer);
|
WriteSaveBuf(buf, m_nAntiReverseTimer);
|
||||||
WriteSaveBuf<uint32>(buf, m_nTimeToStartMission);
|
WriteSaveBuf(buf, m_nTimeToStartMission);
|
||||||
WriteSaveBuf<int8>(buf, m_nPreviousDirection);
|
WriteSaveBuf(buf, m_nPreviousDirection);
|
||||||
WriteSaveBuf<int8>(buf, m_nCurrentDirection);
|
WriteSaveBuf(buf, m_nCurrentDirection);
|
||||||
WriteSaveBuf<int8>(buf, m_nNextDirection);
|
WriteSaveBuf(buf, m_nNextDirection);
|
||||||
WriteSaveBuf<int8>(buf, m_nCurrentLane);
|
WriteSaveBuf(buf, m_nCurrentLane);
|
||||||
WriteSaveBuf<int8>(buf, m_nNextLane);
|
WriteSaveBuf(buf, m_nNextLane);
|
||||||
WriteSaveBuf<uint8>(buf, m_nDrivingStyle);
|
WriteSaveBuf(buf, m_nDrivingStyle);
|
||||||
WriteSaveBuf<uint8>(buf, m_nCarMission);
|
WriteSaveBuf(buf, m_nCarMission);
|
||||||
WriteSaveBuf<uint8>(buf, m_nTempAction);
|
WriteSaveBuf(buf, m_nTempAction);
|
||||||
WriteSaveBuf<uint32>(buf, m_nTimeTempAction);
|
WriteSaveBuf(buf, m_nTimeTempAction);
|
||||||
WriteSaveBuf<float>(buf, m_fMaxTrafficSpeed);
|
WriteSaveBuf(buf, m_fMaxTrafficSpeed);
|
||||||
WriteSaveBuf<uint8>(buf, m_nCruiseSpeed);
|
WriteSaveBuf(buf, m_nCruiseSpeed);
|
||||||
uint8 flags = 0;
|
uint8 flags = 0;
|
||||||
if (m_bSlowedDownBecauseOfCars) flags |= BIT(0);
|
if (m_bSlowedDownBecauseOfCars) flags |= BIT(0);
|
||||||
if (m_bSlowedDownBecauseOfPeds) flags |= BIT(1);
|
if (m_bSlowedDownBecauseOfPeds) flags |= BIT(1);
|
||||||
if (m_bStayInCurrentLevel) flags |= BIT(2);
|
if (m_bStayInCurrentLevel) flags |= BIT(2);
|
||||||
if (m_bStayInFastLane) flags |= BIT(3);
|
if (m_bStayInFastLane) flags |= BIT(3);
|
||||||
if (m_bIgnorePathfinding) flags |= BIT(4);
|
if (m_bIgnorePathfinding) flags |= BIT(4);
|
||||||
WriteSaveBuf<uint8>(buf, flags);
|
WriteSaveBuf(buf, flags);
|
||||||
SkipSaveBuf(buf, 2);
|
ZeroSaveBuf(buf, 2);
|
||||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.x);
|
WriteSaveBuf(buf, m_vecDestinationCoors.x);
|
||||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.y);
|
WriteSaveBuf(buf, m_vecDestinationCoors.y);
|
||||||
WriteSaveBuf<float>(buf, m_vecDestinationCoors.z);
|
WriteSaveBuf(buf, m_vecDestinationCoors.z);
|
||||||
SkipSaveBuf(buf, 32);
|
ZeroSaveBuf(buf, 32);
|
||||||
WriteSaveBuf<int16>(buf, m_nPathFindNodesCount);
|
WriteSaveBuf(buf, m_nPathFindNodesCount);
|
||||||
SkipSaveBuf(buf, 6);
|
ZeroSaveBuf(buf, 6);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CAutoPilot::Load(uint8*& buf)
|
void CAutoPilot::Load(uint8*& buf)
|
||||||
{
|
{
|
||||||
m_nCurrentRouteNode = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nCurrentRouteNode, buf);
|
||||||
m_nNextRouteNode = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nNextRouteNode, buf);
|
||||||
m_nPrevRouteNode = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_nPrevRouteNode, buf);
|
||||||
m_nTimeEnteredCurve = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nTimeEnteredCurve, buf);
|
||||||
m_nTimeToSpendOnCurrentCurve = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nTimeToSpendOnCurrentCurve, buf);
|
||||||
m_nCurrentPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nCurrentPathNodeInfo, buf);
|
||||||
m_nNextPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nNextPathNodeInfo, buf);
|
||||||
m_nPreviousPathNodeInfo = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nPreviousPathNodeInfo, buf);
|
||||||
m_nAntiReverseTimer = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nAntiReverseTimer, buf);
|
||||||
m_nTimeToStartMission = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nTimeToStartMission, buf);
|
||||||
m_nPreviousDirection = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nPreviousDirection, buf);
|
||||||
m_nCurrentDirection = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nCurrentDirection, buf);
|
||||||
m_nNextDirection = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nNextDirection, buf);
|
||||||
m_nCurrentLane = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nCurrentLane, buf);
|
||||||
m_nNextLane = ReadSaveBuf<int8>(buf);
|
ReadSaveBuf(&m_nNextLane, buf);
|
||||||
m_nDrivingStyle = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nDrivingStyle, buf);
|
||||||
m_nCarMission = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nCarMission, buf);
|
||||||
m_nTempAction = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nTempAction, buf);
|
||||||
m_nTimeTempAction = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nTimeTempAction, buf);
|
||||||
m_fMaxTrafficSpeed = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_fMaxTrafficSpeed, buf);
|
||||||
m_nCruiseSpeed = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&m_nCruiseSpeed, buf);
|
||||||
uint8 flags = ReadSaveBuf<uint8>(buf);
|
uint8 flags;
|
||||||
|
ReadSaveBuf(&flags, buf);
|
||||||
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
m_bSlowedDownBecauseOfCars = !!(flags & BIT(0));
|
||||||
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
m_bSlowedDownBecauseOfPeds = !!(flags & BIT(1));
|
||||||
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
m_bStayInCurrentLevel = !!(flags & BIT(2));
|
||||||
m_bStayInFastLane = !!(flags & BIT(3));
|
m_bStayInFastLane = !!(flags & BIT(3));
|
||||||
m_bIgnorePathfinding = !!(flags & BIT(4));
|
m_bIgnorePathfinding = !!(flags & BIT(4));
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
m_vecDestinationCoors.x = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_vecDestinationCoors.x, buf);
|
||||||
m_vecDestinationCoors.y = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_vecDestinationCoors.y, buf);
|
||||||
m_vecDestinationCoors.z = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&m_vecDestinationCoors.z, buf);
|
||||||
SkipSaveBuf(buf, 32);
|
SkipSaveBuf(buf, 32);
|
||||||
m_nPathFindNodesCount = ReadSaveBuf<int16>(buf);
|
ReadSaveBuf(&m_nPathFindNodesCount, buf);
|
||||||
SkipSaveBuf(buf, 6);
|
SkipSaveBuf(buf, 6);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
@ -57,8 +57,8 @@ public:
|
|||||||
int32 m_nCurrentRouteNode;
|
int32 m_nCurrentRouteNode;
|
||||||
int32 m_nNextRouteNode;
|
int32 m_nNextRouteNode;
|
||||||
int32 m_nPrevRouteNode;
|
int32 m_nPrevRouteNode;
|
||||||
uint32 m_nTimeEnteredCurve;
|
int32 m_nTimeEnteredCurve;
|
||||||
uint32 m_nTimeToSpendOnCurrentCurve;
|
int32 m_nTimeToSpendOnCurrentCurve;
|
||||||
uint32 m_nCurrentPathNodeInfo;
|
uint32 m_nCurrentPathNodeInfo;
|
||||||
uint32 m_nNextPathNodeInfo;
|
uint32 m_nNextPathNodeInfo;
|
||||||
uint32 m_nPreviousPathNodeInfo;
|
uint32 m_nPreviousPathNodeInfo;
|
||||||
|
@ -510,8 +510,18 @@ void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle)
|
|||||||
{
|
{
|
||||||
if (pVehicle->pDriver){
|
if (pVehicle->pDriver){
|
||||||
pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
|
pVehicle->pDriver->SetObjective(OBJECTIVE_LEAVE_CAR, pVehicle);
|
||||||
if (pVehicle->GetModelIndex() == MI_AMBULAN)
|
switch (pVehicle->GetModelIndex()) {
|
||||||
|
case MI_FIRETRUCK:
|
||||||
|
case MI_FBICAR:
|
||||||
|
case MI_ENFORCER:
|
||||||
|
case MI_BARRACKS:
|
||||||
|
case MI_RHINO:
|
||||||
|
case MI_POLICE:
|
||||||
|
break;
|
||||||
|
case MI_AMBULAN:
|
||||||
pVehicle->pDriver->Say(SOUND_PED_LEAVE_VEHICLE);
|
pVehicle->pDriver->Say(SOUND_PED_LEAVE_VEHICLE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
int timer = 100;
|
int timer = 100;
|
||||||
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++){
|
for (int i = 0; i < pVehicle->m_nNumMaxPassengers; i++){
|
||||||
|
@ -77,7 +77,7 @@ int32 CCarCtrl::NumRandomCars;
|
|||||||
int32 CCarCtrl::NumParkedCars;
|
int32 CCarCtrl::NumParkedCars;
|
||||||
int32 CCarCtrl::NumPermanentCars;
|
int32 CCarCtrl::NumPermanentCars;
|
||||||
int8 CCarCtrl::CountDownToCarsAtStart;
|
int8 CCarCtrl::CountDownToCarsAtStart;
|
||||||
int32 CCarCtrl::MaxNumberOfCarsInUse = 12;
|
int32 CCarCtrl::MaxNumberOfCarsInUse = DEFAULT_MAX_NUMBER_OF_CARS;
|
||||||
uint32 CCarCtrl::LastTimeLawEnforcerCreated;
|
uint32 CCarCtrl::LastTimeLawEnforcerCreated;
|
||||||
uint32 CCarCtrl::LastTimeFireTruckCreated;
|
uint32 CCarCtrl::LastTimeFireTruckCreated;
|
||||||
uint32 CCarCtrl::LastTimeAmbulanceCreated;
|
uint32 CCarCtrl::LastTimeAmbulanceCreated;
|
||||||
@ -354,7 +354,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||||||
pVehicle->m_bSirenOrAlarm = true;
|
pVehicle->m_bSirenOrAlarm = true;
|
||||||
pVehicle->AutoPilot.m_nNextPathNodeInfo = connectionId;
|
pVehicle->AutoPilot.m_nNextPathNodeInfo = connectionId;
|
||||||
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane = CGeneral::GetRandomNumber() % lanesOnCurrentRoad;
|
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane = CGeneral::GetRandomNumber() % lanesOnCurrentRoad;
|
||||||
CColBox* boundingBox = &CModelInfo::GetModelInfo(pVehicle->GetModelIndex())->GetColModel()->boundingBox;
|
CColBox* boundingBox = &CModelInfo::GetColModel(pVehicle->GetModelIndex())->boundingBox;
|
||||||
float carLength = 1.0f + (boundingBox->max.y - boundingBox->min.y) / 2;
|
float carLength = 1.0f + (boundingBox->max.y - boundingBox->min.y) / 2;
|
||||||
float distanceBetweenNodes = (pCurNode->GetPosition() - pNextNode->GetPosition()).Magnitude2D();
|
float distanceBetweenNodes = (pCurNode->GetPosition() - pNextNode->GetPosition()).Magnitude2D();
|
||||||
/* If car is so long that it doesn't fit between two car nodes, place it directly in the middle. */
|
/* If car is so long that it doesn't fit between two car nodes, place it directly in the middle. */
|
||||||
@ -731,6 +731,7 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
|||||||
}
|
}
|
||||||
float distanceToPlayer = (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D();
|
float distanceToPlayer = (pVehicle->GetPosition() - vecPlayerPos).Magnitude2D();
|
||||||
float threshold = 50.0f;
|
float threshold = 50.0f;
|
||||||
|
#ifndef EXTENDED_OFFSCREEN_DESPAWN_RANGE
|
||||||
if (pVehicle->GetIsOnScreen() ||
|
if (pVehicle->GetIsOnScreen() ||
|
||||||
TheCamera.Cams[TheCamera.ActiveCam].LookingLeft ||
|
TheCamera.Cams[TheCamera.ActiveCam].LookingLeft ||
|
||||||
TheCamera.Cams[TheCamera.ActiveCam].LookingRight ||
|
TheCamera.Cams[TheCamera.ActiveCam].LookingRight ||
|
||||||
@ -741,7 +742,9 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
|||||||
pVehicle->GetModelIndex() == MI_FIRETRUCK ||
|
pVehicle->GetModelIndex() == MI_FIRETRUCK ||
|
||||||
pVehicle->bIsLawEnforcer ||
|
pVehicle->bIsLawEnforcer ||
|
||||||
pVehicle->bIsCarParkVehicle
|
pVehicle->bIsCarParkVehicle
|
||||||
){
|
)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
threshold = 130.0f * TheCamera.GenerationDistMultiplier;
|
threshold = 130.0f * TheCamera.GenerationDistMultiplier;
|
||||||
}
|
}
|
||||||
if (pVehicle->bExtendedRange)
|
if (pVehicle->bExtendedRange)
|
||||||
@ -770,17 +773,19 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
|||||||
delete pVehicle;
|
delete pVehicle;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pVehicle->GetStatus() != STATUS_WRECKED || pVehicle->m_nTimeOfDeath == 0)
|
if (pVehicle->GetStatus() == STATUS_WRECKED) {
|
||||||
return;
|
if (pVehicle->m_nTimeOfDeath != 0) {
|
||||||
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
|
if (CTimer::GetTimeInMilliseconds() > pVehicle->m_nTimeOfDeath + 60000 &&
|
||||||
!(pVehicle->GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(pVehicle)) ){
|
!(pVehicle->GetIsOnScreen() && CRenderer::IsEntityCullZoneVisible(pVehicle))) {
|
||||||
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(7.5f)){
|
if ((pVehicle->GetPosition() - vecPlayerPos).MagnitudeSqr() > SQR(7.5f)) {
|
||||||
if (!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())){
|
if (!CGarages::IsPointWithinHideOutGarage(pVehicle->GetPosition())) {
|
||||||
CWorld::Remove(pVehicle);
|
CWorld::Remove(pVehicle);
|
||||||
delete pVehicle;
|
delete pVehicle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32
|
int32
|
||||||
@ -805,8 +810,8 @@ CCarCtrl::UpdateCarOnRails(CVehicle* pVehicle)
|
|||||||
pVehicle->AutoPilot.ModifySpeed(0.0f);
|
pVehicle->AutoPilot.ModifySpeed(0.0f);
|
||||||
if (CTimer::GetTimeInMilliseconds() > pVehicle->AutoPilot.m_nTempAction){
|
if (CTimer::GetTimeInMilliseconds() > pVehicle->AutoPilot.m_nTempAction){
|
||||||
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
||||||
pVehicle->AutoPilot.m_nAntiReverseTimer = 0;
|
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
|
||||||
pVehicle->AutoPilot.m_nTimeToStartMission = 0;
|
pVehicle->AutoPilot.m_nTimeToStartMission = CTimer::GetTimeInMilliseconds();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1330,8 +1335,8 @@ void CCarCtrl::WeaveForOtherCar(CEntity* pOtherEntity, CVehicle* pVehicle, float
|
|||||||
forward.NormaliseSafe();
|
forward.NormaliseSafe();
|
||||||
float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y);
|
float forwardAngle = CGeneral::GetATanOfXY(forward.x, forward.y);
|
||||||
float angleDiff = angleBetweenVehicles - forwardAngle;
|
float angleDiff = angleBetweenVehicles - forwardAngle;
|
||||||
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * sin(angleDiff));
|
float lenProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.y * Sin(angleDiff));
|
||||||
float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * cos(angleDiff));
|
float widthProjection = ABS(pOtherCar->GetColModel()->boundingBox.max.x * Cos(angleDiff));
|
||||||
float lengthToEvade = (2 * (lenProjection + widthProjection) + WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x) / distance;
|
float lengthToEvade = (2 * (lenProjection + widthProjection) + WIDTH_COEF_TO_WEAVE_SAFELY * 2 * pVehicle->GetColModel()->boundingBox.max.x) / distance;
|
||||||
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveLeft);
|
float diffToLeftAngle = LimitRadianAngle(angleBetweenVehicles - *pAngleToWeaveLeft);
|
||||||
diffToLeftAngle = ABS(diffToLeftAngle);
|
diffToLeftAngle = ABS(diffToLeftAngle);
|
||||||
@ -2718,7 +2723,7 @@ bool CCarCtrl::GenerateOneEmergencyServicesCar(uint32 mi, CVector vecPos)
|
|||||||
attempts += 1;
|
attempts += 1;
|
||||||
}
|
}
|
||||||
if (attempts >= 5)
|
if (attempts >= 5)
|
||||||
return nil;
|
return false;
|
||||||
CAutomobile* pVehicle = new CAutomobile(mi, RANDOM_VEHICLE);
|
CAutomobile* pVehicle = new CAutomobile(mi, RANDOM_VEHICLE);
|
||||||
pVehicle->AutoPilot.m_vecDestinationCoors = vecPos;
|
pVehicle->AutoPilot.m_vecDestinationCoors = vecPos;
|
||||||
pVehicle->SetPosition(spawnPos);
|
pVehicle->SetPosition(spawnPos);
|
||||||
|
@ -24,13 +24,7 @@
|
|||||||
#include "Vehicle.h"
|
#include "Vehicle.h"
|
||||||
#include "Wanted.h"
|
#include "Wanted.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
#define CRUSHER_GARAGE_X1 (1135.5f)
|
|
||||||
#define CRUSHER_GARAGE_Y1 (57.0f)
|
|
||||||
#define CRUSHER_GARAGE_Z1 (-1.0f)
|
|
||||||
#define CRUSHER_GARAGE_X2 (1149.5f)
|
|
||||||
#define CRUSHER_GARAGE_Y2 (63.7f)
|
|
||||||
#define CRUSHER_GARAGE_Z2 (3.5f)
|
|
||||||
|
|
||||||
#define ROTATED_DOOR_OPEN_SPEED (0.015f)
|
#define ROTATED_DOOR_OPEN_SPEED (0.015f)
|
||||||
#define ROTATED_DOOR_CLOSE_SPEED (0.02f)
|
#define ROTATED_DOOR_CLOSE_SPEED (0.02f)
|
||||||
@ -160,7 +154,7 @@ void CGarages::Init(void)
|
|||||||
aCarsInSafeHouse3[i].Init();
|
aCarsInSafeHouse3[i].Init();
|
||||||
hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
|
hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
|
||||||
if (hGarages >= 0)
|
if (hGarages >= 0)
|
||||||
DMAudio.SetEntityStatus(hGarages, true);
|
DMAudio.SetEntityStatus(hGarages, TRUE);
|
||||||
AddOne(
|
AddOne(
|
||||||
CVector(CRUSHER_GARAGE_X1, CRUSHER_GARAGE_Y1, CRUSHER_GARAGE_Z1),
|
CVector(CRUSHER_GARAGE_X1, CRUSHER_GARAGE_Y1, CRUSHER_GARAGE_Z1),
|
||||||
CVector(CRUSHER_GARAGE_X2, CRUSHER_GARAGE_Y2, CRUSHER_GARAGE_Z2),
|
CVector(CRUSHER_GARAGE_X2, CRUSHER_GARAGE_Y2, CRUSHER_GARAGE_Z2),
|
||||||
@ -1882,11 +1876,12 @@ void CStoredCar::StoreCar(CVehicle* pVehicle)
|
|||||||
m_nRadioStation = pVehicle->m_nRadioStation;
|
m_nRadioStation = pVehicle->m_nRadioStation;
|
||||||
m_nVariationA = pVehicle->m_aExtras[0];
|
m_nVariationA = pVehicle->m_aExtras[0];
|
||||||
m_nVariationB = pVehicle->m_aExtras[1];
|
m_nVariationB = pVehicle->m_aExtras[1];
|
||||||
m_bBulletproof = pVehicle->bBulletProof;
|
m_nFlags = 0;
|
||||||
m_bFireproof = pVehicle->bFireProof;
|
if (pVehicle->bBulletProof) m_nFlags |= FLAG_BULLETPROOF;
|
||||||
m_bExplosionproof = pVehicle->bExplosionProof;
|
if (pVehicle->bFireProof) m_nFlags |= FLAG_FIREPROOF;
|
||||||
m_bCollisionproof = pVehicle->bCollisionProof;
|
if (pVehicle->bExplosionProof) m_nFlags |= FLAG_EXPLOSIONPROOF;
|
||||||
m_bMeleeproof = pVehicle->bMeleeProof;
|
if (pVehicle->bCollisionProof) m_nFlags |= FLAG_COLLISIONPROOF;
|
||||||
|
if (pVehicle->bMeleeProof) m_nFlags |= FLAG_MELEEPROOF;
|
||||||
if (pVehicle->IsCar())
|
if (pVehicle->IsCar())
|
||||||
m_nCarBombType = ((CAutomobile*)pVehicle)->m_bombType;
|
m_nCarBombType = ((CAutomobile*)pVehicle)->m_bombType;
|
||||||
}
|
}
|
||||||
@ -1935,11 +1930,11 @@ CVehicle* CStoredCar::RestoreCar()
|
|||||||
}
|
}
|
||||||
pVehicle->bHasBeenOwnedByPlayer = true;
|
pVehicle->bHasBeenOwnedByPlayer = true;
|
||||||
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||||
pVehicle->bBulletProof = m_bBulletproof;
|
if (m_nFlags & FLAG_BULLETPROOF) pVehicle->bBulletProof = true;
|
||||||
pVehicle->bFireProof = m_bFireproof;
|
if (m_nFlags & FLAG_FIREPROOF) pVehicle->bFireProof = true;
|
||||||
pVehicle->bExplosionProof = m_bExplosionproof;
|
if (m_nFlags & FLAG_EXPLOSIONPROOF) pVehicle->bExplosionProof = true;
|
||||||
pVehicle->bCollisionProof = m_bCollisionproof;
|
if (m_nFlags & FLAG_COLLISIONPROOF) pVehicle->bCollisionProof = true;
|
||||||
pVehicle->bMeleeProof = m_bMeleeproof;
|
if (m_nFlags & FLAG_MELEEPROOF) pVehicle->bMeleeProof = true;
|
||||||
return pVehicle;
|
return pVehicle;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2028,7 +2023,7 @@ void CGarages::GivePlayerDetonator()
|
|||||||
|
|
||||||
float CGarages::FindDoorHeightForMI(int32 mi)
|
float CGarages::FindDoorHeightForMI(int32 mi)
|
||||||
{
|
{
|
||||||
return CModelInfo::GetModelInfo(mi)->GetColModel()->boundingBox.max.z - CModelInfo::GetModelInfo(mi)->GetColModel()->boundingBox.min.z - 0.1f;
|
return CModelInfo::GetColModel(mi)->boundingBox.max.z - CModelInfo::GetColModel(mi)->boundingBox.min.z - 0.1f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGarage::TidyUpGarage()
|
void CGarage::TidyUpGarage()
|
||||||
@ -2310,6 +2305,9 @@ void CGarages::Save(uint8 * buf, uint32 * size)
|
|||||||
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
|
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
|
||||||
#else
|
#else
|
||||||
* size = 5484;
|
* size = 5484;
|
||||||
|
#endif
|
||||||
|
#if !defined THIS_IS_STUPID && !defined FIX_GARAGE_SIZE && defined COMPATIBLE_SAVES
|
||||||
|
memset(buf + 5240, 0, *size - 5240); // garbage data is written otherwise
|
||||||
#endif
|
#endif
|
||||||
CloseHideOutGaragesBeforeSave();
|
CloseHideOutGaragesBeforeSave();
|
||||||
WriteSaveBuf(buf, NumGarages);
|
WriteSaveBuf(buf, NumGarages);
|
||||||
@ -2326,8 +2324,47 @@ void CGarages::Save(uint8 * buf, uint32 * size)
|
|||||||
WriteSaveBuf(buf, aCarsInSafeHouse2[i]);
|
WriteSaveBuf(buf, aCarsInSafeHouse2[i]);
|
||||||
WriteSaveBuf(buf, aCarsInSafeHouse3[i]);
|
WriteSaveBuf(buf, aCarsInSafeHouse3[i]);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < NUM_GARAGES; i++)
|
for (int i = 0; i < NUM_GARAGES; i++) {
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_eGarageType);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_eGarageState);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].field_2);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bClosingWithoutTargetCar);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bDeactivated);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bResprayHappened);
|
||||||
|
ZeroSaveBuf(buf, 2);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_nTargetModelIndex);
|
||||||
|
ZeroSaveBuf(buf, 4 + 4);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bDoor1PoolIndex);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bDoor2PoolIndex);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bDoor1IsDummy);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bDoor2IsDummy);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bRecreateDoorOnNextRefresh);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bRotatedDoor);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bCameraFollowsPlayer);
|
||||||
|
ZeroSaveBuf(buf, 1);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fX1);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fX2);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fY1);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fY2);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fZ1);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fZ2);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fDoorPos);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fDoorHeight);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fDoor1X);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fDoor1Y);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fDoor2X);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fDoor2Y);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fDoor1Z);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_fDoor2Z);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_nTimeToStartAction);
|
||||||
|
WriteSaveBuf(buf, aGarages[i].m_bCollectedCarsState);
|
||||||
|
ZeroSaveBuf(buf, 3 + 4 + 4);
|
||||||
|
ZeroSaveBuf(buf, sizeof(aGarages[i].m_sStoredCar));
|
||||||
|
#else
|
||||||
WriteSaveBuf(buf, aGarages[i]);
|
WriteSaveBuf(buf, aGarages[i]);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
#ifdef FIX_GARAGE_SIZE
|
#ifdef FIX_GARAGE_SIZE
|
||||||
VALIDATESAVEBUF(*size);
|
VALIDATESAVEBUF(*size);
|
||||||
#endif
|
#endif
|
||||||
@ -2338,11 +2375,7 @@ const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
|
|||||||
m_nModelIndex = other.m_nModelIndex;
|
m_nModelIndex = other.m_nModelIndex;
|
||||||
m_vecPos = other.m_vecPos;
|
m_vecPos = other.m_vecPos;
|
||||||
m_vecAngle = other.m_vecAngle;
|
m_vecAngle = other.m_vecAngle;
|
||||||
m_bBulletproof = other.m_bBulletproof;
|
m_nFlags = other.m_nFlags;
|
||||||
m_bFireproof = other.m_bFireproof;
|
|
||||||
m_bExplosionproof = other.m_bExplosionproof;
|
|
||||||
m_bCollisionproof = other.m_bCollisionproof;
|
|
||||||
m_bMeleeproof = other.m_bMeleeproof;
|
|
||||||
m_nPrimaryColor = other.m_nPrimaryColor;
|
m_nPrimaryColor = other.m_nPrimaryColor;
|
||||||
m_nSecondaryColor = other.m_nSecondaryColor;
|
m_nSecondaryColor = other.m_nSecondaryColor;
|
||||||
m_nRadioStation = other.m_nRadioStation;
|
m_nRadioStation = other.m_nRadioStation;
|
||||||
@ -2356,27 +2389,68 @@ void CGarages::Load(uint8* buf, uint32 size)
|
|||||||
{
|
{
|
||||||
#ifdef FIX_GARAGE_SIZE
|
#ifdef FIX_GARAGE_SIZE
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
|
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
|
||||||
#else
|
#else
|
||||||
assert(size == 5484);
|
assert(size == 5484);
|
||||||
#endif
|
#endif
|
||||||
CloseHideOutGaragesBeforeSave();
|
CloseHideOutGaragesBeforeSave();
|
||||||
NumGarages = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&NumGarages, buf);
|
||||||
BombsAreFree = ReadSaveBuf<uint32>(buf);
|
int32 tempInt;
|
||||||
RespraysAreFree = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&tempInt, buf);
|
||||||
CarsCollected = ReadSaveBuf<int32>(buf);
|
BombsAreFree = tempInt ? true : false;
|
||||||
BankVansCollected = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&tempInt, buf);
|
||||||
PoliceCarsCollected = ReadSaveBuf<int32>(buf);
|
RespraysAreFree = tempInt ? true : false;
|
||||||
|
ReadSaveBuf(&CarsCollected, buf);
|
||||||
|
ReadSaveBuf(&BankVansCollected, buf);
|
||||||
|
ReadSaveBuf(&PoliceCarsCollected, buf);
|
||||||
for (int i = 0; i < TOTAL_COLLECTCARS_GARAGES; i++)
|
for (int i = 0; i < TOTAL_COLLECTCARS_GARAGES; i++)
|
||||||
CarTypesCollected[i] = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&CarTypesCollected[i], buf);
|
||||||
LastTimeHelpMessage = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&LastTimeHelpMessage, buf);
|
||||||
for (int i = 0; i < NUM_GARAGE_STORED_CARS; i++) {
|
for (int i = 0; i < NUM_GARAGE_STORED_CARS; i++) {
|
||||||
aCarsInSafeHouse1[i] = ReadSaveBuf<CStoredCar>(buf);
|
ReadSaveBuf(&aCarsInSafeHouse1[i], buf);
|
||||||
aCarsInSafeHouse2[i] = ReadSaveBuf<CStoredCar>(buf);
|
ReadSaveBuf(&aCarsInSafeHouse2[i], buf);
|
||||||
aCarsInSafeHouse3[i] = ReadSaveBuf<CStoredCar>(buf);
|
ReadSaveBuf(&aCarsInSafeHouse3[i], buf);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < NUM_GARAGES; i++) {
|
for (int i = 0; i < NUM_GARAGES; i++) {
|
||||||
aGarages[i] = ReadSaveBuf<CGarage>(buf);
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
ReadSaveBuf(&aGarages[i].m_eGarageType, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_eGarageState, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].field_2, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bClosingWithoutTargetCar, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bDeactivated, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bResprayHappened, buf);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_nTargetModelIndex, buf);
|
||||||
|
SkipSaveBuf(buf, 4 + 4);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bDoor1PoolIndex, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bDoor2PoolIndex, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bDoor1IsDummy, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bDoor2IsDummy, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bRecreateDoorOnNextRefresh, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bRotatedDoor, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bCameraFollowsPlayer, buf);
|
||||||
|
SkipSaveBuf(buf, 1);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fX1, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fX2, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fY1, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fY2, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fZ1, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fZ2, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fDoorPos, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fDoorHeight, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fDoor1X, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fDoor1Y, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fDoor2X, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fDoor2Y, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fDoor1Z, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_fDoor2Z, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_nTimeToStartAction, buf);
|
||||||
|
ReadSaveBuf(&aGarages[i].m_bCollectedCarsState, buf);
|
||||||
|
SkipSaveBuf(buf, 3 + 4 + 4);
|
||||||
|
SkipSaveBuf(buf, sizeof(aGarages[i].m_sStoredCar));
|
||||||
|
#else
|
||||||
|
ReadSaveBuf(&aGarages[i], buf);
|
||||||
|
#endif
|
||||||
aGarages[i].m_pDoor1 = nil;
|
aGarages[i].m_pDoor1 = nil;
|
||||||
aGarages[i].m_pDoor2 = nil;
|
aGarages[i].m_pDoor2 = nil;
|
||||||
aGarages[i].m_pTarget = nil;
|
aGarages[i].m_pTarget = nil;
|
||||||
|
@ -51,14 +51,17 @@ enum
|
|||||||
|
|
||||||
class CStoredCar
|
class CStoredCar
|
||||||
{
|
{
|
||||||
|
enum {
|
||||||
|
FLAG_BULLETPROOF = 0x1,
|
||||||
|
FLAG_FIREPROOF = 0x2,
|
||||||
|
FLAG_EXPLOSIONPROOF = 0x4,
|
||||||
|
FLAG_COLLISIONPROOF = 0x8,
|
||||||
|
FLAG_MELEEPROOF = 0x10,
|
||||||
|
};
|
||||||
int32 m_nModelIndex;
|
int32 m_nModelIndex;
|
||||||
CVector m_vecPos;
|
CVector m_vecPos;
|
||||||
CVector m_vecAngle;
|
CVector m_vecAngle;
|
||||||
int32 m_bBulletproof : 1;
|
int32 m_nFlags;
|
||||||
int32 m_bFireproof : 1;
|
|
||||||
int32 m_bExplosionproof : 1;
|
|
||||||
int32 m_bCollisionproof : 1;
|
|
||||||
int32 m_bMeleeproof : 1;
|
|
||||||
int8 m_nPrimaryColor;
|
int8 m_nPrimaryColor;
|
||||||
int8 m_nSecondaryColor;
|
int8 m_nSecondaryColor;
|
||||||
int8 m_nRadioStation;
|
int8 m_nRadioStation;
|
||||||
@ -78,6 +81,13 @@ VALIDATE_SIZE(CStoredCar, 0x28);
|
|||||||
|
|
||||||
#define SWITCH_GARAGE_DISTANCE_CLOSE 40.0f
|
#define SWITCH_GARAGE_DISTANCE_CLOSE 40.0f
|
||||||
|
|
||||||
|
#define CRUSHER_GARAGE_X1 (1135.5f)
|
||||||
|
#define CRUSHER_GARAGE_Y1 (57.0f)
|
||||||
|
#define CRUSHER_GARAGE_Z1 (-1.0f)
|
||||||
|
#define CRUSHER_GARAGE_X2 (1149.5f)
|
||||||
|
#define CRUSHER_GARAGE_Y2 (63.7f)
|
||||||
|
#define CRUSHER_GARAGE_Z2 (3.5f)
|
||||||
|
|
||||||
class CGarage
|
class CGarage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -87,7 +97,7 @@ public:
|
|||||||
bool m_bClosingWithoutTargetCar;
|
bool m_bClosingWithoutTargetCar;
|
||||||
bool m_bDeactivated;
|
bool m_bDeactivated;
|
||||||
bool m_bResprayHappened;
|
bool m_bResprayHappened;
|
||||||
int m_nTargetModelIndex;
|
int32 m_nTargetModelIndex;
|
||||||
CEntity *m_pDoor1;
|
CEntity *m_pDoor1;
|
||||||
CEntity *m_pDoor2;
|
CEntity *m_pDoor2;
|
||||||
uint8 m_bDoor1PoolIndex;
|
uint8 m_bDoor1PoolIndex;
|
||||||
|
@ -8,112 +8,111 @@
|
|||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
#include "OnscreenTimer.h"
|
#include "OnscreenTimer.h"
|
||||||
|
|
||||||
void COnscreenTimer::Init() {
|
void
|
||||||
|
COnscreenTimer::Init()
|
||||||
|
{
|
||||||
m_bDisabled = false;
|
m_bDisabled = false;
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
||||||
m_sEntries[i].m_nTimerOffset = 0;
|
m_sEntries[i].m_nTimerOffset = 0;
|
||||||
m_sEntries[i].m_nCounterOffset = 0;
|
m_sEntries[i].m_nCounterOffset = 0;
|
||||||
|
|
||||||
for(uint32 j = 0; j < 10; j++) {
|
for(uint32 j = 0; j < 10; j++) {
|
||||||
m_sEntries[i].m_aTimerText[j] = 0;
|
m_sEntries[i].m_aTimerText[j] = '\0';
|
||||||
m_sEntries[i].m_aCounterText[j] = 0;
|
m_sEntries[i].m_aCounterText[j] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
||||||
m_sEntries[i].m_bTimerProcessed = 0;
|
m_sEntries[i].m_bTimerProcessed = false;
|
||||||
m_sEntries[i].m_bCounterProcessed = 0;
|
m_sEntries[i].m_bCounterProcessed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::Process() {
|
void
|
||||||
if(!CReplay::IsPlayingBack() && !m_bDisabled) {
|
COnscreenTimer::Process()
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
{
|
||||||
|
if(!CReplay::IsPlayingBack() && !m_bDisabled)
|
||||||
|
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++)
|
||||||
m_sEntries[i].Process();
|
m_sEntries[i].Process();
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::ProcessForDisplay() {
|
void
|
||||||
|
COnscreenTimer::ProcessForDisplay()
|
||||||
|
{
|
||||||
if(CHud::m_Wants_To_Draw_Hud) {
|
if(CHud::m_Wants_To_Draw_Hud) {
|
||||||
m_bProcessed = false;
|
m_bProcessed = false;
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++)
|
||||||
if(m_sEntries[i].ProcessForDisplay()) {
|
if(m_sEntries[i].ProcessForDisplay())
|
||||||
m_bProcessed = true;
|
m_bProcessed = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::ClearCounter(uint32 offset) {
|
void
|
||||||
|
COnscreenTimer::ClearCounter(uint32 offset)
|
||||||
|
{
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
||||||
if(offset == m_sEntries[i].m_nCounterOffset) {
|
if(offset == m_sEntries[i].m_nCounterOffset) {
|
||||||
m_sEntries[i].m_nCounterOffset = 0;
|
m_sEntries[i].m_nCounterOffset = 0;
|
||||||
m_sEntries[i].m_aCounterText[0] = 0;
|
m_sEntries[i].m_aCounterText[0] = '\0';
|
||||||
m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER;
|
||||||
m_sEntries[i].m_bCounterProcessed = 0;
|
m_sEntries[i].m_bCounterProcessed = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::ClearClock(uint32 offset) {
|
void
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
COnscreenTimer::ClearClock(uint32 offset)
|
||||||
|
{
|
||||||
|
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++)
|
||||||
if(offset == m_sEntries[i].m_nTimerOffset) {
|
if(offset == m_sEntries[i].m_nTimerOffset) {
|
||||||
m_sEntries[i].m_nTimerOffset = 0;
|
m_sEntries[i].m_nTimerOffset = 0;
|
||||||
m_sEntries[i].m_aTimerText[0] = 0;
|
m_sEntries[i].m_aTimerText[0] = '\0';
|
||||||
m_sEntries[i].m_bTimerProcessed = 0;
|
m_sEntries[i].m_bTimerProcessed = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text) {
|
void
|
||||||
uint32 i = 0;
|
COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text)
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
{
|
||||||
|
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++)
|
||||||
if(m_sEntries[i].m_nCounterOffset == 0) {
|
if(m_sEntries[i].m_nCounterOffset == 0) {
|
||||||
break;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_sEntries[i].m_nCounterOffset = offset;
|
m_sEntries[i].m_nCounterOffset = offset;
|
||||||
if(text) {
|
if (text)
|
||||||
strncpy(m_sEntries[i].m_aCounterText, text, 10);
|
strncpy(m_sEntries[i].m_aCounterText, text, 10);
|
||||||
} else {
|
else
|
||||||
m_sEntries[i].m_aCounterText[0] = 0;
|
m_sEntries[i].m_aCounterText[0] = '\0';
|
||||||
}
|
|
||||||
|
|
||||||
m_sEntries[i].m_nType = type;
|
m_sEntries[i].m_nType = type;
|
||||||
}
|
|
||||||
|
|
||||||
void COnscreenTimer::AddClock(uint32 offset, char* text) {
|
|
||||||
uint32 i = 0;
|
|
||||||
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
|
|
||||||
if(m_sEntries[i].m_nTimerOffset == 0) {
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
void
|
||||||
|
COnscreenTimer::AddClock(uint32 offset, char* text)
|
||||||
|
{
|
||||||
|
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++)
|
||||||
|
if(m_sEntries[i].m_nTimerOffset == 0) {
|
||||||
m_sEntries[i].m_nTimerOffset = offset;
|
m_sEntries[i].m_nTimerOffset = offset;
|
||||||
if(text) {
|
if (text)
|
||||||
strncpy(m_sEntries[i].m_aTimerText, text, 10);
|
strncpy(m_sEntries[i].m_aTimerText, text, 10);
|
||||||
} else {
|
else
|
||||||
m_sEntries[i].m_aTimerText[0] = 0;
|
m_sEntries[i].m_aTimerText[0] = '\0';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimerEntry::Process() {
|
void
|
||||||
if(m_nTimerOffset == 0) {
|
COnscreenTimerEntry::Process()
|
||||||
|
{
|
||||||
|
if(m_nTimerOffset == 0)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nTimerOffset);
|
int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nTimerOffset);
|
||||||
int32 oldTime = BSWAP32(*timerPtr);
|
int32 oldTime = BSWAP32(*timerPtr);
|
||||||
int32 newTime = oldTime - int32(CTimer::GetTimeStepInSeconds() * 1000);
|
int32 newTime = oldTime - int32(CTimer::GetTimeStepInMilliseconds());
|
||||||
if(newTime < 0) {
|
if(newTime < 0) {
|
||||||
*timerPtr = 0;
|
*timerPtr = 0;
|
||||||
m_bTimerProcessed = 0;
|
m_bTimerProcessed = false;
|
||||||
m_nTimerOffset = 0;
|
m_nTimerOffset = 0;
|
||||||
m_aTimerText[0] = 0;
|
m_aTimerText[0] = '\0';
|
||||||
} else {
|
} else {
|
||||||
*timerPtr = BSWAP32(newTime);
|
*timerPtr = BSWAP32(newTime);
|
||||||
int32 oldTimeSeconds = oldTime / 1000;
|
int32 oldTimeSeconds = oldTime / 1000;
|
||||||
@ -123,13 +122,14 @@ void COnscreenTimerEntry::Process() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool COnscreenTimerEntry::ProcessForDisplay() {
|
bool
|
||||||
|
COnscreenTimerEntry::ProcessForDisplay()
|
||||||
|
{
|
||||||
m_bTimerProcessed = false;
|
m_bTimerProcessed = false;
|
||||||
m_bCounterProcessed = false;
|
m_bCounterProcessed = false;
|
||||||
|
|
||||||
if(m_nTimerOffset == 0 && m_nCounterOffset == 0) {
|
if(m_nTimerOffset == 0 && m_nCounterOffset == 0)
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if(m_nTimerOffset != 0) {
|
if(m_nTimerOffset != 0) {
|
||||||
m_bTimerProcessed = true;
|
m_bTimerProcessed = true;
|
||||||
@ -143,13 +143,17 @@ bool COnscreenTimerEntry::ProcessForDisplay() {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimerEntry::ProcessForDisplayClock() {
|
void
|
||||||
|
COnscreenTimerEntry::ProcessForDisplayClock()
|
||||||
|
{
|
||||||
uint32 time = BSWAP32(*CTheScripts::GetPointerToScriptVariable(m_nTimerOffset));
|
uint32 time = BSWAP32(*CTheScripts::GetPointerToScriptVariable(m_nTimerOffset));
|
||||||
sprintf(m_bTimerBuffer, "%02d:%02d", time / 1000 / 60,
|
sprintf(m_bTimerBuffer, "%02d:%02d", time / 1000 / 60,
|
||||||
time / 1000 % 60);
|
time / 1000 % 60);
|
||||||
}
|
}
|
||||||
|
|
||||||
void COnscreenTimerEntry::ProcessForDisplayCounter() {
|
void
|
||||||
|
COnscreenTimerEntry::ProcessForDisplayCounter()
|
||||||
|
{
|
||||||
uint32 counter = BSWAP32(*CTheScripts::GetPointerToScriptVariable(m_nCounterOffset));
|
uint32 counter = BSWAP32(*CTheScripts::GetPointerToScriptVariable(m_nCounterOffset));
|
||||||
sprintf(m_bCounterBuffer, "%d", counter);
|
sprintf(m_bCounterBuffer, "%d", counter);
|
||||||
}
|
}
|
||||||
|
@ -201,8 +201,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
|
|||||||
const float fBoundMaxY = boundingBox.max.y + 0.3f;
|
const float fBoundMaxY = boundingBox.max.y + 0.3f;
|
||||||
const float fBoundMinY = boundingBox.min.y - 0.3f;
|
const float fBoundMinY = boundingBox.min.y - 0.3f;
|
||||||
const float fBoundMaxX = boundingBox.max.x + 0.3f;
|
const float fBoundMaxX = boundingBox.max.x + 0.3f;
|
||||||
const float fDistanceX = pPosition->x - pEntity->m_matrix.GetPosition().x;
|
const float fDistanceX = pPosition->x - pEntity->GetMatrix().GetPosition().x;
|
||||||
const float fDistanceY = pPosition->y - pEntity->m_matrix.GetPosition().y;
|
const float fDistanceY = pPosition->y - pEntity->GetMatrix().GetPosition().y;
|
||||||
const float fBoundRadius = pEntity->GetBoundRadius();
|
const float fBoundRadius = pEntity->GetBoundRadius();
|
||||||
CVector vecBoundCentre;
|
CVector vecBoundCentre;
|
||||||
pEntity->GetBoundCentre(vecBoundCentre);
|
pEntity->GetBoundCentre(vecBoundCentre);
|
||||||
@ -216,8 +216,8 @@ CPedPath::AddBlockade(CEntity *pEntity, CPedPathNode(*pathNodes)[40], CVector *p
|
|||||||
if (!pathNodes[x][y].bBlockade) {
|
if (!pathNodes[x][y].bBlockade) {
|
||||||
const float pointY = y * 0.7f + fDistanceY;
|
const float pointY = y * 0.7f + fDistanceY;
|
||||||
CVector2D point(pointX, pointY);
|
CVector2D point(pointX, pointY);
|
||||||
if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->m_matrix.GetRight()))) {
|
if (fBoundMaxX > Abs(DotProduct2D(point, pEntity->GetMatrix().GetRight()))) {
|
||||||
float fDotProduct = DotProduct2D(point, pEntity->m_matrix.GetForward());
|
float fDotProduct = DotProduct2D(point, pEntity->GetMatrix().GetForward());
|
||||||
if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
|
if (fBoundMaxY > fDotProduct && fBoundMinY < fDotProduct)
|
||||||
pathNodes[x][y].bBlockade = true;
|
pathNodes[x][y].bBlockade = true;
|
||||||
}
|
}
|
||||||
|
@ -13,10 +13,17 @@
|
|||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
#include "AnimBlendAssociation.h"
|
#include "AnimBlendAssociation.h"
|
||||||
#include "soundlist.h"
|
#include "soundlist.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
#define PHONEINFO_SAVE_SIZE 0xA30
|
||||||
|
#else
|
||||||
|
#define PHONEINFO_SAVE_SIZE sizeof(CPhoneInfo)
|
||||||
|
#endif
|
||||||
|
|
||||||
CPhoneInfo gPhoneInfo;
|
CPhoneInfo gPhoneInfo;
|
||||||
|
|
||||||
bool CPhoneInfo::bDisplayingPhoneMessage; // is phone picked up
|
bool CPhoneInfo::bDisplayingPhoneMessage; // is phone picked up
|
||||||
@ -58,9 +65,9 @@ CPhoneInfo::Update(void)
|
|||||||
TheCamera.SetWideScreenOff();
|
TheCamera.SetWideScreenOff();
|
||||||
pPhoneDisplayingMessages = nil;
|
pPhoneDisplayingMessages = nil;
|
||||||
bDisplayingPhoneMessage = false;
|
bDisplayingPhoneMessage = false;
|
||||||
CAnimBlendAssociation *talkAssoc = RpAnimBlendClumpGetAssociation(player->GetClump(), ANIM_PHONE_TALK);
|
CAnimBlendAssociation *talkAssoc = RpAnimBlendClumpGetAssociation(player->GetClump(), ANIM_STD_PHONE_TALK);
|
||||||
if (talkAssoc && talkAssoc->blendAmount > 0.5f) {
|
if (talkAssoc && talkAssoc->blendAmount > 0.5f) {
|
||||||
CAnimBlendAssociation *endAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_OUT, 8.0f);
|
CAnimBlendAssociation *endAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_OUT, 8.0f);
|
||||||
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
|
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
|
||||||
endAssoc->SetFinishCallback(PhonePutDownCB, player);
|
endAssoc->SetFinishCallback(PhonePutDownCB, player);
|
||||||
} else {
|
} else {
|
||||||
@ -117,7 +124,7 @@ CPhoneInfo::Update(void)
|
|||||||
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
|
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
|
||||||
TheCamera.SetWideScreenOn();
|
TheCamera.SetWideScreenOn();
|
||||||
playerInfo->MakePlayerSafe(true);
|
playerInfo->MakePlayerSafe(true);
|
||||||
CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f);
|
CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_IN, 4.0f);
|
||||||
phonePickAssoc->SetFinishCallback(PhonePickUpCB, &m_aPhones[phoneId]);
|
phonePickAssoc->SetFinishCallback(PhonePickUpCB, &m_aPhones[phoneId]);
|
||||||
bPickingUpPhone = true;
|
bPickingUpPhone = true;
|
||||||
pCallBackPed = player;
|
pCallBackPed = player;
|
||||||
@ -208,12 +215,29 @@ CPhoneInfo::IsMessageBeingDisplayed(int phoneId)
|
|||||||
return pPhoneDisplayingMessages == &m_aPhones[phoneId];
|
return pPhoneDisplayingMessages == &m_aPhones[phoneId];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
static inline void
|
||||||
|
LoadPhone(CPhone &phone, uint8 *&buf)
|
||||||
|
{
|
||||||
|
ReadSaveBuf(&phone.m_vecPos, buf);
|
||||||
|
SkipSaveBuf(buf, 6 * 4);
|
||||||
|
ReadSaveBuf<uint32>(&phone.m_repeatedMessagePickupStart, buf);
|
||||||
|
uint32 tmp;
|
||||||
|
ReadSaveBuf(&tmp, buf);
|
||||||
|
phone.m_pEntity = (CEntity*)(uintptr)tmp;
|
||||||
|
ReadSaveBuf<PhoneState>(&phone.m_nState, buf);
|
||||||
|
ReadSaveBuf<bool>(&phone.m_visibleToCam, buf);
|
||||||
|
SkipSaveBuf(buf, 3);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
CPhoneInfo::Load(uint8 *buf, uint32 size)
|
CPhoneInfo::Load(uint8 *buf, uint32 size)
|
||||||
{
|
{
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
int max = ReadSaveBuf<int32>(buf);
|
int32 max, scriptPhonesMax;
|
||||||
int scriptPhonesMax = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&max, buf);
|
||||||
|
ReadSaveBuf(&scriptPhonesMax, buf);
|
||||||
|
|
||||||
#ifdef PEDS_REPORT_CRIMES_ON_PHONE
|
#ifdef PEDS_REPORT_CRIMES_ON_PHONE
|
||||||
m_nMax = Min(NUMPHONES, max);
|
m_nMax = Min(NUMPHONES, max);
|
||||||
@ -223,7 +247,13 @@ INITSAVEBUF
|
|||||||
|
|
||||||
// We can do it without touching saves. We'll only load script phones, others are already loaded in Initialise
|
// We can do it without touching saves. We'll only load script phones, others are already loaded in Initialise
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++) {
|
||||||
CPhone phoneToLoad = ReadSaveBuf<CPhone>(buf);
|
CPhone phoneToLoad;
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
phoneToLoad.m_apMessages[0]=phoneToLoad.m_apMessages[1]=phoneToLoad.m_apMessages[2]=phoneToLoad.m_apMessages[3]=phoneToLoad.m_apMessages[4]=phoneToLoad.m_apMessages[5] = nil;
|
||||||
|
LoadPhone(phoneToLoad, buf);
|
||||||
|
#else
|
||||||
|
ReadSaveBuf(&phoneToLoad, buf);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (ignoreOtherPhones)
|
if (ignoreOtherPhones)
|
||||||
continue;
|
continue;
|
||||||
@ -249,7 +279,11 @@ INITSAVEBUF
|
|||||||
m_nScriptPhonesMax = scriptPhonesMax;
|
m_nScriptPhonesMax = scriptPhonesMax;
|
||||||
|
|
||||||
for (int i = 0; i < NUMPHONES; i++) {
|
for (int i = 0; i < NUMPHONES; i++) {
|
||||||
m_aPhones[i] = ReadSaveBuf<CPhone>(buf);
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
LoadPhone(m_aPhones[i], buf);
|
||||||
|
#else
|
||||||
|
ReadSaveBuf(&m_aPhones[i], buf);
|
||||||
|
#endif
|
||||||
// It's saved as building pool index in save file, convert it to true entity
|
// It's saved as building pool index in save file, convert it to true entity
|
||||||
if (m_aPhones[i].m_pEntity) {
|
if (m_aPhones[i].m_pEntity) {
|
||||||
m_aPhones[i].m_pEntity = CPools::GetBuildingPool()->GetSlot((uintptr)m_aPhones[i].m_pEntity - 1);
|
m_aPhones[i].m_pEntity = CPools::GetBuildingPool()->GetSlot((uintptr)m_aPhones[i].m_pEntity - 1);
|
||||||
@ -373,7 +407,7 @@ CPhoneInfo::Initialise(void)
|
|||||||
void
|
void
|
||||||
CPhoneInfo::Save(uint8 *buf, uint32 *size)
|
CPhoneInfo::Save(uint8 *buf, uint32 *size)
|
||||||
{
|
{
|
||||||
*size = sizeof(CPhoneInfo);
|
*size = PHONEINFO_SAVE_SIZE;
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
WriteSaveBuf(buf, m_nMax);
|
WriteSaveBuf(buf, m_nMax);
|
||||||
WriteSaveBuf(buf, m_nScriptPhonesMax);
|
WriteSaveBuf(buf, m_nScriptPhonesMax);
|
||||||
@ -382,12 +416,24 @@ INITSAVEBUF
|
|||||||
#else
|
#else
|
||||||
for (int phoneId = 0; phoneId < NUMPHONES; phoneId++) {
|
for (int phoneId = 0; phoneId < NUMPHONES; phoneId++) {
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
WriteSaveBuf(buf, m_aPhones[phoneId].m_vecPos);
|
||||||
|
ZeroSaveBuf(buf, 6 * 4);
|
||||||
|
WriteSaveBuf(buf, m_aPhones[phoneId].m_repeatedMessagePickupStart);
|
||||||
|
// Convert entity pointer to building pool index while saving
|
||||||
|
int32 tmp = m_aPhones[phoneId].m_pEntity ? CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert((CBuilding*)m_aPhones[phoneId].m_pEntity) + 1 : 0;
|
||||||
|
WriteSaveBuf(buf, tmp);
|
||||||
|
WriteSaveBuf(buf, m_aPhones[phoneId].m_nState);
|
||||||
|
WriteSaveBuf(buf, m_aPhones[phoneId].m_visibleToCam);
|
||||||
|
ZeroSaveBuf(buf, 3);
|
||||||
|
#else
|
||||||
CPhone* phone = WriteSaveBuf(buf, m_aPhones[phoneId]);
|
CPhone* phone = WriteSaveBuf(buf, m_aPhones[phoneId]);
|
||||||
|
|
||||||
// Convert entity pointer to building pool index while saving
|
// Convert entity pointer to building pool index while saving
|
||||||
if (phone->m_pEntity) {
|
if (phone->m_pEntity) {
|
||||||
phone->m_pEntity = (CEntity*) (CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert((CBuilding*)phone->m_pEntity) + 1);
|
phone->m_pEntity = (CEntity*) (CPools::GetBuildingPool()->GetJustIndex_NoFreeAssert((CBuilding*)phone->m_pEntity) + 1);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
VALIDATESAVEBUF(*size)
|
VALIDATESAVEBUF(*size)
|
||||||
}
|
}
|
||||||
@ -442,10 +488,10 @@ PhonePickUpCB(CAnimBlendAssociation *assoc, void *arg)
|
|||||||
|
|
||||||
CPed *ped = CPhoneInfo::pCallBackPed;
|
CPed *ped = CPhoneInfo::pCallBackPed;
|
||||||
ped->m_nMoveState = PEDMOVE_STILL;
|
ped->m_nMoveState = PEDMOVE_STILL;
|
||||||
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_IDLE_STANCE, 8.0f);
|
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_STD_IDLE, 8.0f);
|
||||||
|
|
||||||
if (assoc->blendAmount > 0.5f && ped)
|
if (assoc->blendAmount > 0.5f && ped)
|
||||||
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_PHONE_TALK, 8.0f);
|
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_STD_PHONE_TALK, 8.0f);
|
||||||
|
|
||||||
CPhoneInfo::pCallBackPed = nil;
|
CPhoneInfo::pCallBackPed = nil;
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
#include "Replay.h"
|
#include "Replay.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "SaveBuf.h"
|
||||||
#include "Script.h"
|
#include "Script.h"
|
||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
@ -31,6 +32,12 @@
|
|||||||
#include "WaterLevel.h"
|
#include "WaterLevel.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
#define PICKUPS_SAVE_SIZE 0x24C0
|
||||||
|
#else
|
||||||
|
#define PICKUPS_SAVE_SIZE sizeof(aPickUps)
|
||||||
|
#endif
|
||||||
|
|
||||||
CPickup CPickups::aPickUps[NUMPICKUPS];
|
CPickup CPickups::aPickUps[NUMPICKUPS];
|
||||||
int16 CPickups::NumMessages;
|
int16 CPickups::NumMessages;
|
||||||
int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS];
|
int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS];
|
||||||
@ -689,8 +696,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
|||||||
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
|
entity->bDoNotRender = CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame;
|
||||||
|
|
||||||
if (!entity->bDoNotRender) {
|
if (!entity->bDoNotRender) {
|
||||||
float s = Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800));
|
float modifiedSin = 0.3f * (Sin((float)((CTimer::GetTimeInMilliseconds() + (uintptr)entity) & 0x7FF) * DEGTORAD(360.0f / 0x800)) + 1.0f);
|
||||||
float modifiedSin = 0.3f * (s + 1.0f);
|
|
||||||
|
|
||||||
|
|
||||||
int16 colorId;
|
int16 colorId;
|
||||||
@ -749,7 +755,20 @@ CPickups::DoPickUpEffects(CEntity *entity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), aWeaponScale[colorId]);
|
float angle = (float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800);
|
||||||
|
float c = Cos(angle) * aWeaponScale[colorId];
|
||||||
|
float s = Sin(angle) * aWeaponScale[colorId];
|
||||||
|
|
||||||
|
// we know from SA they were setting each field manually like this
|
||||||
|
entity->GetMatrix().rx = c;
|
||||||
|
entity->GetMatrix().ry = s;
|
||||||
|
entity->GetMatrix().rz = 0.0f;
|
||||||
|
entity->GetMatrix().fx = -s;
|
||||||
|
entity->GetMatrix().fy = c;
|
||||||
|
entity->GetMatrix().fz = 0.0f;
|
||||||
|
entity->GetMatrix().ux = 0.0f;
|
||||||
|
entity->GetMatrix().uy = 0.0f;
|
||||||
|
entity->GetMatrix().uz = aWeaponScale[colorId];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -987,18 +1006,31 @@ CPickups::Load(uint8 *buf, uint32 size)
|
|||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
|
|
||||||
for (int32 i = 0; i < NUMPICKUPS; i++) {
|
for (int32 i = 0; i < NUMPICKUPS; i++) {
|
||||||
aPickUps[i] = ReadSaveBuf<CPickup>(buf);
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
ReadSaveBuf(&aPickUps[i].m_eType, buf);
|
||||||
|
ReadSaveBuf(&aPickUps[i].m_bRemoved, buf);
|
||||||
|
ReadSaveBuf(&aPickUps[i].m_nQuantity, buf);
|
||||||
|
int32 tmp;
|
||||||
|
ReadSaveBuf(&tmp, buf);
|
||||||
|
aPickUps[i].m_pObject = aPickUps[i].m_eType != PICKUP_NONE && tmp != 0 ? CPools::GetObjectPool()->GetSlot(tmp - 1) : nil;
|
||||||
|
ReadSaveBuf(&aPickUps[i].m_nTimer, buf);
|
||||||
|
ReadSaveBuf(&aPickUps[i].m_eModelIndex, buf);
|
||||||
|
ReadSaveBuf(&aPickUps[i].m_nIndex, buf);
|
||||||
|
ReadSaveBuf(&aPickUps[i].m_vecPos, buf);
|
||||||
|
#else
|
||||||
|
ReadSaveBuf(&aPickUps[i], buf);
|
||||||
|
|
||||||
if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].m_pObject != nil)
|
if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].m_pObject != nil)
|
||||||
aPickUps[i].m_pObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pObject - 1);
|
aPickUps[i].m_pObject = CPools::GetObjectPool()->GetSlot((uintptr)aPickUps[i].m_pObject - 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CollectedPickUpIndex = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&CollectedPickUpIndex, buf);
|
||||||
ReadSaveBuf<uint16>(buf);
|
SkipSaveBuf(buf, 2);
|
||||||
NumMessages = 0;
|
NumMessages = 0;
|
||||||
|
|
||||||
for (uint16 i = 0; i < NUMCOLLECTEDPICKUPS; i++)
|
for (uint16 i = 0; i < NUMCOLLECTEDPICKUPS; i++)
|
||||||
aPickUpsCollected[i] = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&aPickUpsCollected[i], buf);
|
||||||
|
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
}
|
}
|
||||||
@ -1006,14 +1038,26 @@ VALIDATESAVEBUF(size)
|
|||||||
void
|
void
|
||||||
CPickups::Save(uint8 *buf, uint32 *size)
|
CPickups::Save(uint8 *buf, uint32 *size)
|
||||||
{
|
{
|
||||||
*size = sizeof(aPickUps) + sizeof(uint16) + sizeof(uint16) + sizeof(aPickUpsCollected);
|
*size = PICKUPS_SAVE_SIZE + sizeof(uint16) + sizeof(uint16) + sizeof(aPickUpsCollected);
|
||||||
|
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
|
|
||||||
for (int32 i = 0; i < NUMPICKUPS; i++) {
|
for (int32 i = 0; i < NUMPICKUPS; i++) {
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
WriteSaveBuf(buf, aPickUps[i].m_eType);
|
||||||
|
WriteSaveBuf(buf, aPickUps[i].m_bRemoved);
|
||||||
|
WriteSaveBuf(buf, aPickUps[i].m_nQuantity);
|
||||||
|
int32 tmp = aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].m_pObject != nil ? CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(aPickUps[i].m_pObject) + 1 : 0;
|
||||||
|
WriteSaveBuf(buf, tmp);
|
||||||
|
WriteSaveBuf(buf, aPickUps[i].m_nTimer);
|
||||||
|
WriteSaveBuf(buf, aPickUps[i].m_eModelIndex);
|
||||||
|
WriteSaveBuf(buf, aPickUps[i].m_nIndex);
|
||||||
|
WriteSaveBuf(buf, aPickUps[i].m_vecPos);
|
||||||
|
#else
|
||||||
CPickup *buf_pickup = WriteSaveBuf(buf, aPickUps[i]);
|
CPickup *buf_pickup = WriteSaveBuf(buf, aPickUps[i]);
|
||||||
if (buf_pickup->m_eType != PICKUP_NONE && buf_pickup->m_pObject != nil)
|
if (buf_pickup->m_eType != PICKUP_NONE && buf_pickup->m_pObject != nil)
|
||||||
buf_pickup->m_pObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(buf_pickup->m_pObject) + 1);
|
buf_pickup->m_pObject = (CObject*)(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert(buf_pickup->m_pObject) + 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
WriteSaveBuf(buf, CollectedPickUpIndex);
|
WriteSaveBuf(buf, CollectedPickUpIndex);
|
||||||
@ -1330,6 +1374,8 @@ CPacManPickups::Render()
|
|||||||
{
|
{
|
||||||
if (!bPMActive) return;
|
if (!bPMActive) return;
|
||||||
|
|
||||||
|
PUSH_RENDERGROUP("CPacManPickups::Render");
|
||||||
|
|
||||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, FALSE);
|
||||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||||
@ -1363,6 +1409,8 @@ CPacManPickups::Render()
|
|||||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE);
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, FALSE);
|
||||||
|
|
||||||
|
POP_RENDERGROUP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -404,8 +404,8 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
CAnimBlendAssociation* main = RpAnimBlendClumpGetMainAssociation((RpClump*)ped->m_rwObject, &second, &blend_amount);
|
CAnimBlendAssociation* main = RpAnimBlendClumpGetMainAssociation((RpClump*)ped->m_rwObject, &second, &blend_amount);
|
||||||
if (main){
|
if (main){
|
||||||
state->animId = main->animId;
|
state->animId = main->animId;
|
||||||
state->time = 255.0f / 4.0f * clamp(main->currentTime, 0.0f, 4.0f);
|
state->time = 255.0f / 4.0f * Clamp(main->currentTime, 0.0f, 4.0f);
|
||||||
state->speed = 255.0f / 3.0f * clamp(main->speed, 0.0f, 3.0f);
|
state->speed = 255.0f / 3.0f * Clamp(main->speed, 0.0f, 3.0f);
|
||||||
}else{
|
}else{
|
||||||
state->animId = 3;
|
state->animId = 3;
|
||||||
state->time = 0;
|
state->time = 0;
|
||||||
@ -413,9 +413,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
}
|
}
|
||||||
if (second) {
|
if (second) {
|
||||||
state->secAnimId = second->animId;
|
state->secAnimId = second->animId;
|
||||||
state->secTime = 255.0f / 4.0f * clamp(second->currentTime, 0.0f, 4.0f);
|
state->secTime = 255.0f / 4.0f * Clamp(second->currentTime, 0.0f, 4.0f);
|
||||||
state->secSpeed = 255.0f / 3.0f * clamp(second->speed, 0.0f, 3.0f);
|
state->secSpeed = 255.0f / 3.0f * Clamp(second->speed, 0.0f, 3.0f);
|
||||||
state->blendAmount = 255.0f / 2.0f * clamp(blend_amount, 0.0f, 2.0f);
|
state->blendAmount = 255.0f / 2.0f * Clamp(blend_amount, 0.0f, 2.0f);
|
||||||
}else{
|
}else{
|
||||||
state->secAnimId = 0;
|
state->secAnimId = 0;
|
||||||
state->secTime = 0;
|
state->secTime = 0;
|
||||||
@ -425,9 +425,9 @@ void CReplay::StorePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
CAnimBlendAssociation* partial = RpAnimBlendClumpGetMainPartialAssociation((RpClump*)ped->m_rwObject);
|
CAnimBlendAssociation* partial = RpAnimBlendClumpGetMainPartialAssociation((RpClump*)ped->m_rwObject);
|
||||||
if (partial) {
|
if (partial) {
|
||||||
state->partAnimId = partial->animId;
|
state->partAnimId = partial->animId;
|
||||||
state->partAnimTime = 255.0f / 4.0f * clamp(partial->currentTime, 0.0f, 4.0f);
|
state->partAnimTime = 255.0f / 4.0f * Clamp(partial->currentTime, 0.0f, 4.0f);
|
||||||
state->partAnimSpeed = 255.0f / 3.0f * clamp(partial->speed, 0.0f, 3.0f);
|
state->partAnimSpeed = 255.0f / 3.0f * Clamp(partial->speed, 0.0f, 3.0f);
|
||||||
state->partBlendAmount = 255.0f / 2.0f * clamp(partial->blendAmount, 0.0f, 2.0f);
|
state->partBlendAmount = 255.0f / 2.0f * Clamp(partial->blendAmount, 0.0f, 2.0f);
|
||||||
}else{
|
}else{
|
||||||
state->partAnimId = 0;
|
state->partAnimId = 0;
|
||||||
state->partAnimTime = 0;
|
state->partAnimTime = 0;
|
||||||
@ -442,11 +442,11 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||||||
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainAssociation_N((RpClump*)ped->m_rwObject, i);
|
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainAssociation_N((RpClump*)ped->m_rwObject, i);
|
||||||
if (assoc){
|
if (assoc){
|
||||||
state->aAnimId[i] = assoc->animId;
|
state->aAnimId[i] = assoc->animId;
|
||||||
state->aCurTime[i] = 255.0f / 4.0f * clamp(assoc->currentTime, 0.0f, 4.0f);
|
state->aCurTime[i] = 255.0f / 4.0f * Clamp(assoc->currentTime, 0.0f, 4.0f);
|
||||||
state->aSpeed[i] = 255.0f / 3.0f * clamp(assoc->speed, 0.0f, 3.0f);
|
state->aSpeed[i] = 255.0f / 3.0f * Clamp(assoc->speed, 0.0f, 3.0f);
|
||||||
state->aBlendAmount[i] = 255.0f / 2.0f * clamp(assoc->blendAmount, 0.0f, 2.0f);
|
state->aBlendAmount[i] = 255.0f / 2.0f * Clamp(assoc->blendAmount, 0.0f, 2.0f);
|
||||||
#ifdef FIX_REPLAY_BUGS
|
#ifdef FIX_REPLAY_BUGS
|
||||||
state->aBlendDelta[i] = 127.0f / 32.0f * clamp(assoc->blendDelta, -16.0f, 16.0f);
|
state->aBlendDelta[i] = 127.0f / 32.0f * Clamp(assoc->blendDelta, -16.0f, 16.0f);
|
||||||
#endif
|
#endif
|
||||||
state->aFlags[i] = assoc->flags;
|
state->aFlags[i] = assoc->flags;
|
||||||
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
||||||
@ -457,7 +457,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||||||
state->aFunctionCallbackID[i] = 0;
|
state->aFunctionCallbackID[i] = 0;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
state->aAnimId[i] = NUM_ANIMS;
|
state->aAnimId[i] = ANIM_STD_NUM;
|
||||||
state->aCurTime[i] = 0;
|
state->aCurTime[i] = 0;
|
||||||
state->aSpeed[i] = 85;
|
state->aSpeed[i] = 85;
|
||||||
state->aFunctionCallbackID[i] = 0;
|
state->aFunctionCallbackID[i] = 0;
|
||||||
@ -468,11 +468,11 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||||||
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainPartialAssociation_N((RpClump*)ped->m_rwObject, i);
|
CAnimBlendAssociation* assoc = RpAnimBlendClumpGetMainPartialAssociation_N((RpClump*)ped->m_rwObject, i);
|
||||||
if (assoc) {
|
if (assoc) {
|
||||||
state->aAnimId2[i] = assoc->animId;
|
state->aAnimId2[i] = assoc->animId;
|
||||||
state->aCurTime2[i] = 255.0f / 4.0f * clamp(assoc->currentTime, 0.0f, 4.0f);
|
state->aCurTime2[i] = 255.0f / 4.0f * Clamp(assoc->currentTime, 0.0f, 4.0f);
|
||||||
state->aSpeed2[i] = 255.0f / 3.0f * clamp(assoc->speed, 0.0f, 3.0f);
|
state->aSpeed2[i] = 255.0f / 3.0f * Clamp(assoc->speed, 0.0f, 3.0f);
|
||||||
state->aBlendAmount2[i] = 255.0f / 2.0f * clamp(assoc->blendAmount, 0.0f, 2.0f);
|
state->aBlendAmount2[i] = 255.0f / 2.0f * Clamp(assoc->blendAmount, 0.0f, 2.0f);
|
||||||
#ifdef FIX_REPLAY_BUGS
|
#ifdef FIX_REPLAY_BUGS
|
||||||
state->aBlendDelta2[i] = 127.0f / 16.0f * clamp(assoc->blendDelta, -16.0f, 16.0f);
|
state->aBlendDelta2[i] = 127.0f / 16.0f * Clamp(assoc->blendDelta, -16.0f, 16.0f);
|
||||||
#endif
|
#endif
|
||||||
state->aFlags2[i] = assoc->flags;
|
state->aFlags2[i] = assoc->flags;
|
||||||
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
if (assoc->callbackType == CAnimBlendAssociation::CB_FINISH || assoc->callbackType == CAnimBlendAssociation::CB_DELETE) {
|
||||||
@ -484,7 +484,7 @@ void CReplay::StoreDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationState
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
state->aAnimId2[i] = NUM_ANIMS;
|
state->aAnimId2[i] = ANIM_STD_NUM;
|
||||||
state->aCurTime2[i] = 0;
|
state->aCurTime2[i] = 0;
|
||||||
state->aSpeed2[i] = 85;
|
state->aSpeed2[i] = 85;
|
||||||
state->aFunctionCallbackID2[i] = 0;
|
state->aFunctionCallbackID2[i] = 0;
|
||||||
@ -558,7 +558,7 @@ void CReplay::RetrievePedAnimation(CPed *ped, CStoredAnimationState *state)
|
|||||||
float time = state->partAnimTime * 4.0f / 255.0f;
|
float time = state->partAnimTime * 4.0f / 255.0f;
|
||||||
float speed = state->partAnimSpeed * 3.0f / 255.0f;
|
float speed = state->partAnimSpeed * 3.0f / 255.0f;
|
||||||
float blend = state->partBlendAmount * 2.0f / 255.0f;
|
float blend = state->partBlendAmount * 2.0f / 255.0f;
|
||||||
if (blend > 0.0f && state->partAnimId != ANIM_IDLE_STANCE){
|
if (blend > 0.0f && state->partAnimId != ANIM_STD_IDLE){
|
||||||
CAnimBlendAssociation* anim3 = CAnimManager::BlendAnimation(
|
CAnimBlendAssociation* anim3 = CAnimManager::BlendAnimation(
|
||||||
(RpClump*)ped->m_rwObject, ASSOCGRP_STD, (AnimationId)state->partAnimId, 1000.0f);
|
(RpClump*)ped->m_rwObject, ASSOCGRP_STD, (AnimationId)state->partAnimId, 1000.0f);
|
||||||
anim3->SetCurrentTime(time);
|
anim3->SetCurrentTime(time);
|
||||||
@ -578,7 +578,7 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
|
|||||||
assoc->SetBlend(0.0f, -1.0f);
|
assoc->SetBlend(0.0f, -1.0f);
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++) {
|
for (int i = 0; i < NUM_MAIN_ANIMS_IN_REPLAY; i++) {
|
||||||
if (state->aAnimId[i] == NUM_ANIMS)
|
if (state->aAnimId[i] == ANIM_STD_NUM)
|
||||||
continue;
|
continue;
|
||||||
#ifdef FIX_REPLAY_BUGS
|
#ifdef FIX_REPLAY_BUGS
|
||||||
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
|
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
|
||||||
@ -607,7 +607,7 @@ void CReplay::RetrieveDetailedPedAnimation(CPed *ped, CStoredDetailedAnimationSt
|
|||||||
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
|
anim->SetDeleteCallback(FindCBFunction(callback & 0x7F), ped);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < NUM_PARTIAL_ANIMS_IN_REPLAY; i++) {
|
for (int i = 0; i < NUM_PARTIAL_ANIMS_IN_REPLAY; i++) {
|
||||||
if (state->aAnimId2[i] == NUM_ANIMS)
|
if (state->aAnimId2[i] == ANIM_STD_NUM)
|
||||||
continue;
|
continue;
|
||||||
#ifdef FIX_REPLAY_BUGS
|
#ifdef FIX_REPLAY_BUGS
|
||||||
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
|
CAnimBlendAssociation* anim = CAnimManager::AddAnimation(ped->GetClump(),
|
||||||
@ -1232,7 +1232,7 @@ void CReplay::RestoreStuffFromMem(void)
|
|||||||
ped->SetModelIndex(mi);
|
ped->SetModelIndex(mi);
|
||||||
ped->m_pVehicleAnim = nil;
|
ped->m_pVehicleAnim = nil;
|
||||||
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
|
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
|
||||||
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
|
DMAudio.SetEntityStatus(ped->m_audioEntityId, TRUE);
|
||||||
CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
|
CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
|
||||||
if (ped->m_wepModelID >= 0)
|
if (ped->m_wepModelID >= 0)
|
||||||
ped->AddWeaponModel(ped->m_wepModelID);
|
ped->AddWeaponModel(ped->m_wepModelID);
|
||||||
@ -1270,7 +1270,7 @@ void CReplay::RestoreStuffFromMem(void)
|
|||||||
car->SetDoorDamage(CAR_DOOR_RR, DOOR_REAR_RIGHT, true);
|
car->SetDoorDamage(CAR_DOOR_RR, DOOR_REAR_RIGHT, true);
|
||||||
}
|
}
|
||||||
vehicle->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, vehicle);
|
vehicle->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, vehicle);
|
||||||
DMAudio.SetEntityStatus(vehicle->m_audioEntityId, true);
|
DMAudio.SetEntityStatus(vehicle->m_audioEntityId, TRUE);
|
||||||
CCarCtrl::UpdateCarCount(vehicle, false);
|
CCarCtrl::UpdateCarCount(vehicle, false);
|
||||||
if ((mi == MI_AIRTRAIN || mi == MI_DEADDODO) && vehicle->m_rwObject){
|
if ((mi == MI_AIRTRAIN || mi == MI_DEADDODO) && vehicle->m_rwObject){
|
||||||
CVehicleModelInfo* info = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi);
|
CVehicleModelInfo* info = (CVehicleModelInfo*)CModelInfo::GetModelInfo(mi);
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "Restart.h"
|
#include "Restart.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "PathFind.h"
|
#include "PathFind.h"
|
||||||
|
|
||||||
@ -173,29 +174,28 @@ INITSAVEBUF
|
|||||||
CheckSaveHeader(buf, 'R','S','T','\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'R','S','T','\0', size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||||
HospitalRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
ReadSaveBuf(&HospitalRestartPoints[i], buf);
|
||||||
HospitalRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&HospitalRestartHeadings[i], buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
for (int i = 0; i < NUM_RESTART_POINTS; i++) {
|
||||||
PoliceRestartPoints[i] = ReadSaveBuf<CVector>(buf);
|
ReadSaveBuf(&PoliceRestartPoints[i], buf);
|
||||||
PoliceRestartHeadings[i] = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&PoliceRestartHeadings[i], buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
NumberOfHospitalRestarts = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&NumberOfHospitalRestarts, buf);
|
||||||
NumberOfPoliceRestarts = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&NumberOfPoliceRestarts, buf);
|
||||||
bOverrideRestart = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&bOverrideRestart, buf);
|
||||||
|
|
||||||
// skip something unused
|
// skip something unused
|
||||||
ReadSaveBuf<uint8>(buf);
|
SkipSaveBuf(buf, 3);
|
||||||
ReadSaveBuf<uint16>(buf);
|
|
||||||
|
|
||||||
OverridePosition = ReadSaveBuf<CVector>(buf);
|
ReadSaveBuf(&OverridePosition, buf);
|
||||||
OverrideHeading = ReadSaveBuf<float>(buf);
|
ReadSaveBuf(&OverrideHeading, buf);
|
||||||
bFadeInAfterNextDeath = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&bFadeInAfterNextDeath, buf);
|
||||||
bFadeInAfterNextArrest = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&bFadeInAfterNextArrest, buf);
|
||||||
OverrideHospitalLevel = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&OverrideHospitalLevel, buf);
|
||||||
OverridePoliceStationLevel = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&OverridePoliceStationLevel, buf);
|
||||||
VALIDATESAVEBUF(size);
|
VALIDATESAVEBUF(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,11 +51,11 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
|
|||||||
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
|
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
|
||||||
if (!pEntityToAttack)
|
if (!pEntityToAttack)
|
||||||
pEntityToAttack = (CEntity*)FindPlayerPed();
|
pEntityToAttack = (CEntity*)FindPlayerPed();
|
||||||
CColModel* pPoliceColModel = CModelInfo::GetModelInfo(MI_POLICE)->GetColModel();
|
CColModel* pPoliceColModel = CModelInfo::GetColModel(MI_POLICE);
|
||||||
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
|
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
|
||||||
for (int32 i = 0; i < 2; i++) {
|
for (int32 i = 0; i < 2; i++) {
|
||||||
const int32 roadBlockIndex = i + 2 * roadBlockType;
|
const int32 roadBlockIndex = i + 2 * roadBlockType;
|
||||||
CVector posForZ = pVehicle->m_matrix * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
|
CVector posForZ = pVehicle->GetMatrix() * (fRadius * vecRoadBlockOffets[roadBlockIndex]);
|
||||||
int32 modelInfoId = MI_COP;
|
int32 modelInfoId = MI_COP;
|
||||||
eCopType copType = COP_STREET;
|
eCopType copType = COP_STREET;
|
||||||
switch (pVehicle->GetModelIndex())
|
switch (pVehicle->GetModelIndex())
|
||||||
@ -80,9 +80,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
|
|||||||
pCopPed->SetCurrentWeapon(WEAPONTYPE_COLT45);
|
pCopPed->SetCurrentWeapon(WEAPONTYPE_COLT45);
|
||||||
CPedPlacement::FindZCoorForPed(&posForZ);
|
CPedPlacement::FindZCoorForPed(&posForZ);
|
||||||
pCopPed->SetPosition(posForZ);
|
pCopPed->SetPosition(posForZ);
|
||||||
CVector vecSavedPos = pCopPed->GetPosition();
|
pCopPed->SetOrientation(0.0f, 0.0f, -HALFPI);
|
||||||
pCopPed->m_matrix.SetRotate(0.0f, 0.0f, -HALFPI);
|
|
||||||
pCopPed->m_matrix.GetPosition() += vecSavedPos;
|
|
||||||
pCopPed->m_bIsDisabledCop = true;
|
pCopPed->m_bIsDisabledCop = true;
|
||||||
pCopPed->SetIdle();
|
pCopPed->SetIdle();
|
||||||
pCopPed->bKindaStayInSamePlace = true;
|
pCopPed->bKindaStayInSamePlace = true;
|
||||||
@ -132,7 +130,7 @@ CRoadBlocks::GenerateRoadBlocks(void)
|
|||||||
vehicleId = MI_ENFORCER;
|
vehicleId = MI_ENFORCER;
|
||||||
if (!CStreaming::HasModelLoaded(vehicleId))
|
if (!CStreaming::HasModelLoaded(vehicleId))
|
||||||
vehicleId = MI_POLICE;
|
vehicleId = MI_POLICE;
|
||||||
CColModel *pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel();
|
CColModel *pVehicleColModel = CModelInfo::GetColModel(vehicleId);
|
||||||
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
|
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
|
||||||
int16 radius = (int16)(fMapObjectRadius / fModelRadius);
|
int16 radius = (int16)(fMapObjectRadius / fModelRadius);
|
||||||
if (radius >= 6)
|
if (radius >= 6)
|
||||||
@ -153,8 +151,8 @@ CRoadBlocks::GenerateRoadBlocks(void)
|
|||||||
offsetMatrix.GetPosition() = CVector(0.0f, i * fModelRadius - fOffset, 0.6f);
|
offsetMatrix.GetPosition() = CVector(0.0f, i * fModelRadius - fOffset, 0.6f);
|
||||||
else
|
else
|
||||||
offsetMatrix.GetPosition() = CVector(i * fModelRadius - fOffset, 0.0f, 0.6f);
|
offsetMatrix.GetPosition() = CVector(i * fModelRadius - fOffset, 0.0f, 0.6f);
|
||||||
CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix;
|
CMatrix vehicleMatrix = mapObject->GetMatrix() * offsetMatrix;
|
||||||
float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
|
float fModelRadius = CModelInfo::GetColModel(vehicleId)->boundingSphere.radius - 0.25f;
|
||||||
int16 colliding = 0;
|
int16 colliding = 0;
|
||||||
CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
|
CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
|
||||||
if (!colliding) {
|
if (!colliding) {
|
||||||
@ -162,10 +160,10 @@ CRoadBlocks::GenerateRoadBlocks(void)
|
|||||||
pVehicle->SetStatus(STATUS_ABANDONED);
|
pVehicle->SetStatus(STATUS_ABANDONED);
|
||||||
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
|
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
|
||||||
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
|
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
|
||||||
pVehicle->m_matrix = vehicleMatrix;
|
pVehicle->SetMatrix(vehicleMatrix);
|
||||||
pVehicle->PlaceOnRoadProperly();
|
pVehicle->PlaceOnRoadProperly();
|
||||||
pVehicle->SetIsStatic(false);
|
pVehicle->SetIsStatic(false);
|
||||||
pVehicle->m_matrix.UpdateRW();
|
pVehicle->GetMatrix().UpdateRW();
|
||||||
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||||
pVehicle->bIsLocked = false;
|
pVehicle->bIsLocked = false;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -370,6 +370,13 @@ public:
|
|||||||
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||||
int CollectParameterForDebug(char* buf, bool& var);
|
int CollectParameterForDebug(char* buf, bool& var);
|
||||||
void GetStoredParameterForDebug(char* buf);
|
void GetStoredParameterForDebug(char* buf);
|
||||||
|
void LogOnStartProcessing();
|
||||||
|
void LogBeforeProcessingCommand(int32 command);
|
||||||
|
void LogAfterProcessingCommand(int32 command);
|
||||||
|
|
||||||
|
static char commandInfo[];
|
||||||
|
static uint32 storedIp;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
|
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
|
||||||
@ -576,6 +583,17 @@ public:
|
|||||||
public:
|
public:
|
||||||
static void SwitchToMission(int32 mission);
|
static void SwitchToMission(int32 mission);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||||
|
static int ScriptToLoad;
|
||||||
|
static int OpenScript();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||||
|
static void LogAfterScriptInitializing();
|
||||||
|
static void LogBeforeScriptProcessing();
|
||||||
|
static void LogAfterScriptProcessing();
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
@ -587,9 +605,22 @@ extern int missionRetryScriptIndex;
|
|||||||
extern bool doingMissionRetry;
|
extern bool doingMissionRetry;
|
||||||
|
|
||||||
uint32 AddExtraDeathDelay();
|
uint32 AddExtraDeathDelay();
|
||||||
void RetryMission(int, int);
|
void RetryMission(int, int unk = 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_DEBUG_SCRIPT_LOADER
|
enum {
|
||||||
extern int scriptToLoad;
|
MISSION_RETRY_TYPE_SUGGEST_TO_PLAYER = 0,
|
||||||
|
MISSION_RETRY_TYPE_1,
|
||||||
|
MISSION_RETRY_TYPE_BEGIN_RESTARTING
|
||||||
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MISSION_RETRY_STAGE_NORMAL = 0,
|
||||||
|
MISSION_RETRY_STAGE_WAIT_FOR_SCRIPT_TO_TERMINATE,
|
||||||
|
MISSION_RETRY_STAGE_START_PROCESSING,
|
||||||
|
MISSION_RETRY_STAGE_WAIT_FOR_DELAY,
|
||||||
|
MISSION_RETRY_STAGE_WAIT_FOR_MENU,
|
||||||
|
MISSION_RETRY_STAGE_WAIT_FOR_USER,
|
||||||
|
MISSION_RETRY_STAGE_START_RESTARTING,
|
||||||
|
MISSION_RETRY_STAGE_WAIT_FOR_TIMER_AFTER_RESTART,
|
||||||
|
};
|
||||||
#endif
|
#endif
|
@ -437,8 +437,8 @@ int8 CRunningScript::ProcessCommands300To399(int32 command)
|
|||||||
float length = *(float*)&ScriptParams[5];
|
float length = *(float*)&ScriptParams[5];
|
||||||
float x, y;
|
float x, y;
|
||||||
if (angle != 0.0f){
|
if (angle != 0.0f){
|
||||||
y = cos(angle) * length;
|
y = Cos(angle) * length;
|
||||||
x = sin(angle) * length;
|
x = Sin(angle) * length;
|
||||||
}else{
|
}else{
|
||||||
y = length;
|
y = length;
|
||||||
x = 0.0f;
|
x = 0.0f;
|
||||||
@ -913,7 +913,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
if (strcmp(m_abScriptName, "camera") == 0){
|
if (strcmp(m_abScriptName, "camera") == 0){
|
||||||
pPlayer->m_pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
pPlayer->m_pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f);
|
||||||
pPlayer->m_pPed->SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
pPlayer->m_pPed->SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
CAnimManager::BlendAnimation((RpClump*)pPlayer->m_pPed->m_rwObject, pPlayer->m_pPed->m_animGroup, ANIM_IDLE_STANCE, 1000.0f);
|
CAnimManager::BlendAnimation((RpClump*)pPlayer->m_pPed->m_rwObject, pPlayer->m_pPed->m_animGroup, ANIM_STD_IDLE, 1000.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -1156,7 +1156,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
AnimationId anim = pVehicle->GetDriverAnim();
|
AnimationId anim = pVehicle->GetDriverAnim();
|
||||||
#else
|
#else
|
||||||
AnimationId anim = pVehicle->bLowVehicle ? ANIM_CAR_LSIT : ANIM_CAR_SIT;
|
AnimationId anim = pVehicle->bLowVehicle ? ANIM_STD_CAR_SIT_LO : ANIM_STD_CAR_SIT;
|
||||||
#endif
|
#endif
|
||||||
pPed->m_pVehicleAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, anim, 100.0f);
|
pPed->m_pVehicleAnim = CAnimManager::BlendAnimation(pPed->GetClump(), ASSOCGRP_STD, anim, 100.0f);
|
||||||
pPed->StopNonPartialAnims();
|
pPed->StopNonPartialAnims();
|
||||||
|
@ -417,7 +417,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||||||
pPed->FlagToDestroyWhenNextProcessed();
|
pPed->FlagToDestroyWhenNextProcessed();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
|
pPed->SetDie(ANIM_STD_KO_FRONT, 4.0f, 0.0f);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true);
|
pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
|
pPed->SetDie(ANIM_STD_KO_FRONT, 4.0f, 0.0f);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true);
|
pPed->ApplyHeadShot(WEAPONTYPE_SNIPERRIFLE, pPed->GetNodePosition(PED_HEAD), true);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pPed->SetDie(ANIM_KO_SHOT_FRONT1, 4.0f, 0.0f);
|
pPed->SetDie(ANIM_STD_KO_FRONT, 4.0f, 0.0f);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -735,7 +735,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CPlayerPed* pPlayerPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
CPlayerPed* pPlayerPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
||||||
script_assert(pPlayerPed);
|
script_assert(pPlayerPed);
|
||||||
pPlayerPed->m_fArmour = clamp(pPlayerPed->m_fArmour + ScriptParams[1], 0.0f, 100.0f);
|
pPlayerPed->m_fArmour = Clamp(pPlayerPed->m_fArmour + ScriptParams[1], 0.0f, 100.0f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_ADD_ARMOUR_TO_CHAR:
|
case COMMAND_ADD_ARMOUR_TO_CHAR:
|
||||||
@ -743,7 +743,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||||
script_assert(pPed);
|
script_assert(pPed);
|
||||||
pPed->m_fArmour = clamp(pPed->m_fArmour + ScriptParams[1], 0.0f, 100.0f);
|
pPed->m_fArmour = Clamp(pPed->m_fArmour + ScriptParams[1], 0.0f, 100.0f);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_OPEN_GARAGE:
|
case COMMAND_OPEN_GARAGE:
|
||||||
@ -793,7 +793,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
pPed->m_pVehicleAnim = nil;
|
pPed->m_pVehicleAnim = nil;
|
||||||
pPed->RestartNonPartialAnims();
|
pPed->RestartNonPartialAnims();
|
||||||
pPed->SetMoveState(PEDMOVE_NONE);
|
pPed->SetMoveState(PEDMOVE_NONE);
|
||||||
CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
|
CAnimManager::BlendAnimation(pPed->GetClump(), pPed->m_animGroup, ANIM_STD_IDLE, 100.0f);
|
||||||
pos.z += pPed->GetDistanceFromCentreOfMassToBaseOfModel();
|
pos.z += pPed->GetDistanceFromCentreOfMassToBaseOfModel();
|
||||||
pPed->Teleport(pos);
|
pPed->Teleport(pos);
|
||||||
CTheScripts::ClearSpaceForMissionEntity(pos, pPed);
|
CTheScripts::ClearSpaceForMissionEntity(pos, pPed);
|
||||||
@ -1327,7 +1327,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
|
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
|
||||||
DMAudio.PlayFrontEndTrack(ScriptParams[0] + STREAMED_SOUND_MISSION_COMPLETED - 1, 0);
|
DMAudio.PlayFrontEndTrack(ScriptParams[0] + STREAMED_SOUND_MISSION_COMPLETED - 1, FALSE);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_CLEAR_AREA:
|
case COMMAND_CLEAR_AREA:
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#include "Pools.h"
|
#include "Pools.h"
|
||||||
#include "Population.h"
|
#include "Population.h"
|
||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
|
#include "SaveBuf.h"
|
||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
@ -948,10 +949,10 @@ void CRunningScript::PlayerInAngledAreaCheckCommand(int32 command, uint32* pIp)
|
|||||||
initAngle -= TWOPI;
|
initAngle -= TWOPI;
|
||||||
// it looks like the idea is to use a rectangle using the diagonal of the rectangle as
|
// it looks like the idea is to use a rectangle using the diagonal of the rectangle as
|
||||||
// the side of new rectangle, with "length" being the length of second side
|
// the side of new rectangle, with "length" being the length of second side
|
||||||
float rotatedSupX = supX + side2length * sin(initAngle);
|
float rotatedSupX = supX + side2length * Sin(initAngle);
|
||||||
float rotatedSupY = supY - side2length * cos(initAngle);
|
float rotatedSupY = supY - side2length * Cos(initAngle);
|
||||||
float rotatedInfX = infX + side2length * sin(initAngle);
|
float rotatedInfX = infX + side2length * Sin(initAngle);
|
||||||
float rotatedInfY = infY - side2length * cos(initAngle);
|
float rotatedInfY = infY - side2length * Cos(initAngle);
|
||||||
float side1X = supX - infX;
|
float side1X = supX - infX;
|
||||||
float side1Y = supY - infY;
|
float side1Y = supY - infY;
|
||||||
float side1Length = CVector2D(side1X, side1Y).Magnitude();
|
float side1Length = CVector2D(side1X, side1Y).Magnitude();
|
||||||
@ -1238,10 +1239,10 @@ void CRunningScript::DoDeatharrestCheck()
|
|||||||
if (!pPlayer->IsRestartingAfterDeath() && !pPlayer->IsRestartingAfterArrest() && !CTheScripts::UpsideDownCars.AreAnyCarsUpsideDown())
|
if (!pPlayer->IsRestartingAfterDeath() && !pPlayer->IsRestartingAfterArrest() && !CTheScripts::UpsideDownCars.AreAnyCarsUpsideDown())
|
||||||
return;
|
return;
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
if (AllowMissionReplay != 0)
|
if (AllowMissionReplay != MISSION_RETRY_STAGE_NORMAL)
|
||||||
return;
|
return;
|
||||||
if (CanAllowMissionReplay())
|
if (CanAllowMissionReplay())
|
||||||
AllowMissionReplay = 1;
|
AllowMissionReplay = MISSION_RETRY_STAGE_WAIT_FOR_SCRIPT_TO_TERMINATE;
|
||||||
#endif
|
#endif
|
||||||
script_assert(m_nStackPointer > 0);
|
script_assert(m_nStackPointer > 0);
|
||||||
while (m_nStackPointer > 1)
|
while (m_nStackPointer > 1)
|
||||||
@ -2002,21 +2003,25 @@ void CTheScripts::LoadAllScripts(uint8* buf, uint32 size)
|
|||||||
Init();
|
Init();
|
||||||
INITSAVEBUF
|
INITSAVEBUF
|
||||||
CheckSaveHeader(buf, 'S', 'C', 'R', '\0', size - SAVE_HEADER_SIZE);
|
CheckSaveHeader(buf, 'S', 'C', 'R', '\0', size - SAVE_HEADER_SIZE);
|
||||||
uint32 varSpace = ReadSaveBuf<uint32>(buf);
|
uint32 varSpace, type, handle;
|
||||||
|
uint32 tmp;
|
||||||
|
|
||||||
|
ReadSaveBuf(&varSpace, buf);
|
||||||
for (uint32 i = 0; i < varSpace; i++)
|
for (uint32 i = 0; i < varSpace; i++)
|
||||||
ScriptSpace[i] = ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&ScriptSpace[i], buf);
|
||||||
script_assert(ReadSaveBuf<uint32>(buf) == SCRIPT_DATA_SIZE);
|
ReadSaveBuf(&tmp, buf);
|
||||||
OnAMissionFlag = ReadSaveBuf<uint32>(buf);
|
script_assert(tmp == SCRIPT_DATA_SIZE);
|
||||||
|
ReadSaveBuf(&OnAMissionFlag, buf);
|
||||||
for (uint32 i = 0; i < MAX_NUM_CONTACTS; i++) {
|
for (uint32 i = 0; i < MAX_NUM_CONTACTS; i++) {
|
||||||
OnAMissionForContactFlag[i] = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&OnAMissionForContactFlag[i], buf);
|
||||||
BaseBriefIdForContact[i] = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&BaseBriefIdForContact[i], buf);
|
||||||
}
|
}
|
||||||
for (uint32 i = 0; i < MAX_NUM_COLLECTIVES; i++)
|
for (uint32 i = 0; i < MAX_NUM_COLLECTIVES; i++)
|
||||||
CollectiveArray[i] = ReadSaveBuf<tCollectiveData>(buf);
|
ReadSaveBuf(&CollectiveArray[i], buf);
|
||||||
NextFreeCollectiveIndex = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&NextFreeCollectiveIndex, buf);
|
||||||
for (uint32 i = 0; i < MAX_NUM_BUILDING_SWAPS; i++) {
|
for (uint32 i = 0; i < MAX_NUM_BUILDING_SWAPS; i++) {
|
||||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&type, buf);
|
||||||
uint32 handle = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&handle, buf);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0:
|
case 0:
|
||||||
BuildingSwapArray[i].m_pBuilding = nil;
|
BuildingSwapArray[i].m_pBuilding = nil;
|
||||||
@ -2030,14 +2035,14 @@ INITSAVEBUF
|
|||||||
default:
|
default:
|
||||||
script_assert(false);
|
script_assert(false);
|
||||||
}
|
}
|
||||||
BuildingSwapArray[i].m_nNewModel = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&BuildingSwapArray[i].m_nNewModel, buf);
|
||||||
BuildingSwapArray[i].m_nOldModel = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&BuildingSwapArray[i].m_nOldModel, buf);
|
||||||
if (BuildingSwapArray[i].m_pBuilding)
|
if (BuildingSwapArray[i].m_pBuilding)
|
||||||
BuildingSwapArray[i].m_pBuilding->ReplaceWithNewModel(BuildingSwapArray[i].m_nNewModel);
|
BuildingSwapArray[i].m_pBuilding->ReplaceWithNewModel(BuildingSwapArray[i].m_nNewModel);
|
||||||
}
|
}
|
||||||
for (uint32 i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
|
for (uint32 i = 0; i < MAX_NUM_INVISIBILITY_SETTINGS; i++) {
|
||||||
uint32 type = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&type, buf);
|
||||||
uint32 handle = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&handle, buf);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case 0:
|
case 0:
|
||||||
InvisibilitySettingArray[i] = nil;
|
InvisibilitySettingArray[i] = nil;
|
||||||
@ -2060,14 +2065,20 @@ INITSAVEBUF
|
|||||||
if (InvisibilitySettingArray[i])
|
if (InvisibilitySettingArray[i])
|
||||||
InvisibilitySettingArray[i]->bIsVisible = false;
|
InvisibilitySettingArray[i]->bIsVisible = false;
|
||||||
}
|
}
|
||||||
script_assert(ReadSaveBuf<bool>(buf) == bUsingAMultiScriptFile);
|
bool tmpBool;
|
||||||
ReadSaveBuf<uint8>(buf);
|
ReadSaveBuf(&tmpBool, buf);
|
||||||
ReadSaveBuf<uint16>(buf);
|
script_assert(tmpBool == bUsingAMultiScriptFile);
|
||||||
script_assert(ReadSaveBuf<uint32>(buf) == MainScriptSize);
|
SkipSaveBuf(buf, 3);
|
||||||
script_assert(ReadSaveBuf<uint32>(buf) == LargestMissionScriptSize);
|
ReadSaveBuf(&tmp, buf);
|
||||||
script_assert(ReadSaveBuf<uint16>(buf) == NumberOfMissionScripts);
|
script_assert(tmp == MainScriptSize);
|
||||||
ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&tmp, buf);
|
||||||
uint32 runningScripts = ReadSaveBuf<uint32>(buf);
|
script_assert(tmp == LargestMissionScriptSize);
|
||||||
|
uint16 tmp16;
|
||||||
|
ReadSaveBuf(&tmp16, buf);
|
||||||
|
script_assert(tmp16 == NumberOfMissionScripts);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
uint32 runningScripts;
|
||||||
|
ReadSaveBuf(&runningScripts, buf);
|
||||||
for (uint32 i = 0; i < runningScripts; i++)
|
for (uint32 i = 0; i < runningScripts; i++)
|
||||||
StartNewScript(0)->Load(buf);
|
StartNewScript(0)->Load(buf);
|
||||||
VALIDATESAVEBUF(size)
|
VALIDATESAVEBUF(size)
|
||||||
@ -2078,33 +2089,33 @@ VALIDATESAVEBUF(size)
|
|||||||
void CRunningScript::Save(uint8*& buf)
|
void CRunningScript::Save(uint8*& buf)
|
||||||
{
|
{
|
||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
SkipSaveBuf(buf, 8);
|
ZeroSaveBuf(buf, 8);
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
WriteSaveBuf<char>(buf, m_abScriptName[i]);
|
WriteSaveBuf(buf, m_abScriptName[i]);
|
||||||
WriteSaveBuf<uint32>(buf, m_nIp);
|
WriteSaveBuf(buf, m_nIp);
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||||
WriteSaveBuf<uint32>(buf, m_anStack[i]);
|
WriteSaveBuf(buf, m_anStack[i]);
|
||||||
WriteSaveBuf<uint16>(buf, m_nStackPointer);
|
WriteSaveBuf(buf, m_nStackPointer);
|
||||||
SkipSaveBuf(buf, 2);
|
ZeroSaveBuf(buf, 2);
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||||
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
|
WriteSaveBuf(buf, m_anLocalVariables[i]);
|
||||||
WriteSaveBuf<bool>(buf, m_bCondResult);
|
WriteSaveBuf(buf, m_bCondResult);
|
||||||
WriteSaveBuf<bool>(buf, m_bIsMissionScript);
|
WriteSaveBuf(buf, m_bIsMissionScript);
|
||||||
WriteSaveBuf<bool>(buf, m_bSkipWakeTime);
|
WriteSaveBuf(buf, m_bSkipWakeTime);
|
||||||
SkipSaveBuf(buf, 1);
|
ZeroSaveBuf(buf, 1);
|
||||||
WriteSaveBuf<uint32>(buf, m_nWakeTime);
|
WriteSaveBuf(buf, m_nWakeTime);
|
||||||
WriteSaveBuf<uint16>(buf, m_nAndOrState);
|
WriteSaveBuf(buf, m_nAndOrState);
|
||||||
WriteSaveBuf<bool>(buf, m_bNotFlag);
|
WriteSaveBuf(buf, m_bNotFlag);
|
||||||
WriteSaveBuf<bool>(buf, m_bDeatharrestEnabled);
|
WriteSaveBuf(buf, m_bDeatharrestEnabled);
|
||||||
WriteSaveBuf<bool>(buf, m_bDeatharrestExecuted);
|
WriteSaveBuf(buf, m_bDeatharrestExecuted);
|
||||||
WriteSaveBuf<bool>(buf, m_bMissionFlag);
|
WriteSaveBuf(buf, m_bMissionFlag);
|
||||||
SkipSaveBuf(buf, 2);
|
ZeroSaveBuf(buf, 2);
|
||||||
#else
|
#else
|
||||||
WriteSaveBuf(buf, *this);
|
WriteSaveBuf(buf, *this);
|
||||||
#endif
|
#endif
|
||||||
@ -2115,35 +2126,35 @@ void CRunningScript::Load(uint8*& buf)
|
|||||||
#ifdef COMPATIBLE_SAVES
|
#ifdef COMPATIBLE_SAVES
|
||||||
SkipSaveBuf(buf, 8);
|
SkipSaveBuf(buf, 8);
|
||||||
for (int i = 0; i < 8; i++)
|
for (int i = 0; i < 8; i++)
|
||||||
m_abScriptName[i] = ReadSaveBuf<char>(buf);
|
ReadSaveBuf(&m_abScriptName[i], buf);
|
||||||
m_nIp = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nIp, buf);
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||||
m_anStack[i] = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_anStack[i], buf);
|
||||||
m_nStackPointer = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&m_nStackPointer, buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||||
#endif
|
#endif
|
||||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||||
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
|
ReadSaveBuf(&m_anLocalVariables[i], buf);
|
||||||
m_bCondResult = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bCondResult, buf);
|
||||||
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bIsMissionScript, buf);
|
||||||
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bSkipWakeTime, buf);
|
||||||
SkipSaveBuf(buf, 1);
|
SkipSaveBuf(buf, 1);
|
||||||
m_nWakeTime = ReadSaveBuf<uint32>(buf);
|
ReadSaveBuf(&m_nWakeTime, buf);
|
||||||
m_nAndOrState = ReadSaveBuf<uint16>(buf);
|
ReadSaveBuf(&m_nAndOrState, buf);
|
||||||
m_bNotFlag = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bNotFlag, buf);
|
||||||
m_bDeatharrestEnabled = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bDeatharrestEnabled, buf);
|
||||||
m_bDeatharrestExecuted = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bDeatharrestExecuted, buf);
|
||||||
m_bMissionFlag = ReadSaveBuf<bool>(buf);
|
ReadSaveBuf(&m_bMissionFlag, buf);
|
||||||
SkipSaveBuf(buf, 2);
|
SkipSaveBuf(buf, 2);
|
||||||
#else
|
#else
|
||||||
CRunningScript* n = next;
|
CRunningScript* n = next;
|
||||||
CRunningScript* p = prev;
|
CRunningScript* p = prev;
|
||||||
*this = ReadSaveBuf<CRunningScript>(buf);
|
ReadSaveBuf(this, buf);
|
||||||
next = n;
|
next = n;
|
||||||
prev = p;
|
prev = p;
|
||||||
#endif
|
#endif
|
||||||
@ -2450,10 +2461,10 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
|
|||||||
CPed* pPed = pPlayer->m_pPed;
|
CPed* pPed = pPlayer->m_pPed;
|
||||||
if (pPed->bInVehicle)
|
if (pPed->bInVehicle)
|
||||||
return IsVehicleStopped(pPed->m_pMyVehicle);
|
return IsVehicleStopped(pPed->m_pMyVehicle);
|
||||||
if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP) ||
|
if (RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_RUNSTOP1) ||
|
||||||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_RUN_STOP_R) ||
|
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_RUNSTOP2) ||
|
||||||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
|
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_JUMP_LAUNCH) ||
|
||||||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
|
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_STD_JUMP_GLIDE))
|
||||||
return false;
|
return false;
|
||||||
return pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL;
|
return pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL;
|
||||||
}
|
}
|
||||||
|
@ -82,8 +82,8 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
AllowMissionReplay = 0;
|
AllowMissionReplay = MISSION_RETRY_STAGE_NORMAL;
|
||||||
SaveGameForPause(3);
|
SaveGameForPause(SAVE_TYPE_QUICKSAVE_FOR_MISSION_REPLAY);
|
||||||
#endif
|
#endif
|
||||||
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
|
CPlayerInfo* pPlayerInfo = &CWorld::Players[ScriptParams[0]];
|
||||||
CPad::GetPad(ScriptParams[0])->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
|
CPad::GetPad(ScriptParams[0])->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
|
||||||
@ -304,8 +304,12 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||||||
#endif
|
#endif
|
||||||
CTimer::Suspend();
|
CTimer::Suspend();
|
||||||
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
|
int offset = CTheScripts::MultiScriptArray[ScriptParams[0]];
|
||||||
|
#ifdef USE_DEBUG_SCRIPT_LOADER
|
||||||
|
int handle = CTheScripts::OpenScript();
|
||||||
|
#else
|
||||||
CFileMgr::ChangeDir("\\");
|
CFileMgr::ChangeDir("\\");
|
||||||
int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
|
int handle = CFileMgr::OpenFile("data\\main.scm", "rb");
|
||||||
|
#endif
|
||||||
CFileMgr::Seek(handle, offset, 0);
|
CFileMgr::Seek(handle, offset, 0);
|
||||||
CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
|
CFileMgr::Read(handle, (const char*)&CTheScripts::ScriptSpace[SIZE_MAIN_SCRIPT], SIZE_MISSION_SCRIPT);
|
||||||
CFileMgr::CloseFile(handle);
|
CFileMgr::CloseFile(handle);
|
||||||
|
1441
src/control/ScriptDebug.cpp
Normal file
1441
src/control/ScriptDebug.cpp
Normal file
File diff suppressed because it is too large
Load Diff
@ -230,7 +230,7 @@ CAnimViewer::Update(void)
|
|||||||
if (modelInfo->GetModelType() == MITYPE_PED) {
|
if (modelInfo->GetModelType() == MITYPE_PED) {
|
||||||
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
|
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
|
||||||
|
|
||||||
if (animId > ANIM_IDLE_STANCE)
|
if (animId > ANIM_STD_IDLE)
|
||||||
animGroup = ASSOCGRP_STD;
|
animGroup = ASSOCGRP_STD;
|
||||||
|
|
||||||
if (reloadIFP) {
|
if (reloadIFP) {
|
||||||
@ -318,14 +318,14 @@ CAnimViewer::Update(void)
|
|||||||
CMessages::AddMessage(gUString, 1000, 0);
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else if (pad->GetCircleJustDown()) {
|
} else if (pad->GetCircleJustDown()) {
|
||||||
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE);
|
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_STD_IDLE);
|
||||||
AsciiToUnicode("Idle animation playing", gUString);
|
AsciiToUnicode("Idle animation playing", gUString);
|
||||||
CMessages::AddMessage(gUString, 1000, 0);
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else if (pad->GetDPadUpJustDown()) {
|
} else if (pad->GetDPadUpJustDown()) {
|
||||||
animId--;
|
animId--;
|
||||||
if (animId < 0) {
|
if (animId < 0) {
|
||||||
animId = NUM_ANIMS - 1;
|
animId = ANIM_STD_NUM - 1;
|
||||||
}
|
}
|
||||||
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ CAnimViewer::Update(void)
|
|||||||
CMessages::AddMessage(gUString, 1000, 0);
|
CMessages::AddMessage(gUString, 1000, 0);
|
||||||
|
|
||||||
} else if (pad->GetDPadDownJustDown()) {
|
} else if (pad->GetDPadDownJustDown()) {
|
||||||
animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1);
|
animId = (animId == (ANIM_STD_NUM - 1) ? 0 : animId + 1);
|
||||||
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
|
||||||
|
|
||||||
sprintf(gString, "Current anim: %d", animId);
|
sprintf(gString, "Current anim: %d", animId);
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user