mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-24 00:31:48 +01:00
commit
a8999bbf38
67
.github/workflows/reVC_msvc_amd64.yml
vendored
Normal file
67
.github/workflows/reVC_msvc_amd64.yml
vendored
Normal file
@ -0,0 +1,67 @@
|
||||
name: reVC_msvc_amd64
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
release:
|
||||
types: published
|
||||
env:
|
||||
GLEW_VER: "2.1.0"
|
||||
GLFW_VER: "3.3.2"
|
||||
GLEW_BASE: "glew-2.1.0"
|
||||
GLFW_BASE: "glfw-3.3.2.bin.WIN64"
|
||||
GLEW_FILE: "glew-2.1.0-win32.zip"
|
||||
GLFW_FILE: "glfw-3.3.2.bin.WIN64.zip"
|
||||
GLEW_URL: "https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0-win32.zip"
|
||||
GLFW_URL: "https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.bin.WIN64.zip"
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [win-amd64-librw_d3d9-oal, win-amd64-librw_gl3_glfw-oal]
|
||||
buildtype: [Debug, Release]
|
||||
steps:
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.0.1
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'true'
|
||||
- if: ${{ matrix.platform }} == "win-amd64-librw_gl3_glfw-mss"
|
||||
name: Download glew
|
||||
uses: carlosperate/download-file-action@v1.0.3
|
||||
with:
|
||||
file-url: ${{env.GLEW_URL}}
|
||||
- if: ${{ matrix.platform }} == "win-amd64-librw_gl3_glfw-mss"
|
||||
name: Download glfw
|
||||
uses: carlosperate/download-file-action@v1.0.3
|
||||
with:
|
||||
file-url: ${{env.GLFW_URL}}
|
||||
- if: ${{ matrix.platform }} == "win-amd64-librw_gl3_glfw-mss"
|
||||
name: Unpack archives
|
||||
run: |
|
||||
7z x ${{env.GLEW_FILE}}
|
||||
7z x ${{env.GLFW_FILE}}
|
||||
- name: Configure build
|
||||
run: |
|
||||
./premake5 vs2019 --with-librw --glewdir=${{env.GLEW_BASE}} --glfwdir64=${{env.GLFW_BASE}}
|
||||
- name: Build
|
||||
run: |
|
||||
msbuild -m build/reVC.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}}
|
||||
- name: Pack artifacts
|
||||
run: |
|
||||
7z a reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/*
|
||||
- name: Upload artifact to actions
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: reVC_${{matrix.buildtype}}_${{matrix.platform}}
|
||||
path: ./bin/${{matrix.platform}}/${{matrix.buildtype}}
|
||||
# - name: Upload artifact to Bintray
|
||||
# uses: hpcsc/upload-bintray-docker-action@v1
|
||||
# with:
|
||||
# repository: reVC
|
||||
# package: ${{matrix.buildtype}}_${{matrix.platform}}
|
||||
# version: 1.0-$(echo ${GITHUB_SHA}
|
||||
# sourcePath: ./bin/${{matrix.platform}}/${{matrix.buildtype}}
|
||||
# username: gtamodding
|
||||
# apiKey: ${{secrets.BINTRAY_API_KEY}}
|
68
.github/workflows/reVC_msvc_x86.yml
vendored
Normal file
68
.github/workflows/reVC_msvc_x86.yml
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
name: reVC_msvc_x86
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
release:
|
||||
types: published
|
||||
env:
|
||||
GLEW_VER: "2.1.0"
|
||||
GLFW_VER: "3.3.2"
|
||||
GLEW_BASE: "glew-2.1.0"
|
||||
GLFW_BASE: "glfw-3.3.2.bin.WIN32"
|
||||
GLEW_FILE: "glew-2.1.0-win32.zip"
|
||||
GLFW_FILE: "glfw-3.3.2.bin.WIN32.zip"
|
||||
GLEW_URL: "https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0-win32.zip"
|
||||
GLFW_URL: "https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.bin.WIN32.zip"
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [win-x86-librw_d3d9-mss, win-x86-librw_gl3_glfw-mss, win-x86-librw_d3d9-oal, win-x86-librw_gl3_glfw-oal]
|
||||
buildtype: [Debug, Release]
|
||||
steps:
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@v1.0.1
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'true'
|
||||
- if: ${{ matrix.platform }} == "win-x86-librw_gl3_glfw-mss"
|
||||
name: Download glew
|
||||
uses: carlosperate/download-file-action@v1.0.3
|
||||
with:
|
||||
file-url: ${{env.GLEW_URL}}
|
||||
- if: ${{ matrix.platform }} == "win-x86-librw_gl3_glfw-mss"
|
||||
name: Download glfw
|
||||
uses: carlosperate/download-file-action@v1.0.3
|
||||
with:
|
||||
file-url: ${{env.GLFW_URL}}
|
||||
- if: ${{ matrix.platform }} == "win-x86-librw_gl3_glfw-mss"
|
||||
name: Unpack archives
|
||||
run: |
|
||||
7z x ${{env.GLEW_FILE}}
|
||||
7z x ${{env.GLFW_FILE}}
|
||||
- name: Configure build
|
||||
run: |
|
||||
./premake5 vs2019 --with-librw --glewdir=${{env.GLEW_BASE}} --glfwdir32=${{env.GLFW_BASE}}
|
||||
- name: Build
|
||||
run: |
|
||||
msbuild -m build/reVC.sln /property:Configuration=${{matrix.buildtype}} /property:Platform=${{matrix.platform}}
|
||||
- name: Pack artifacts
|
||||
run: |
|
||||
7z a reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip ./bin/${{matrix.platform}}/${{matrix.buildtype}}/*
|
||||
- name: Upload artifact to actions
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: reVC_${{matrix.buildtype}}_${{matrix.platform}}
|
||||
path: reVC_${{matrix.buildtype}}_${{matrix.platform}}.zip
|
||||
# - name: Upload artifact to Bintray
|
||||
# uses: hpcsc/upload-bintray-docker-action@v1
|
||||
# with:
|
||||
# repository: reVC
|
||||
# package: ${{matrix.buildtype}}_${{matrix.platform}}
|
||||
# version: 1.0-$(echo ${GITHUB_SHA}
|
||||
# sourcePath: ./bin/${{matrix.platform}}/${{matrix.buildtype}}
|
||||
# username: gtamodding
|
||||
# apiKey: ${{secrets.BINTRAY_API_KEY}}
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -348,3 +348,7 @@ healthchecksdb
|
||||
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
||||
vendor/glew-2.1.0/
|
||||
vendor/glfw-3.3.2.bin.WIN32/
|
||||
vendor/glfw-3.3.2.bin.WIN64/
|
27
.gitmodules
vendored
27
.gitmodules
vendored
@ -1,15 +1,16 @@
|
||||
[submodule "librw"]
|
||||
path = librw
|
||||
url = https://github.com/aap/librw
|
||||
[submodule "opus"]
|
||||
path = opus
|
||||
url = https://github.com/xiph/opus.git
|
||||
branch = master
|
||||
[submodule "opusfile"]
|
||||
path = opusfile
|
||||
url = https://github.com/xiph/opusfile.git
|
||||
branch = master
|
||||
[submodule "ogg"]
|
||||
path = ogg
|
||||
[submodule "vendor/ogg"]
|
||||
path = vendor/ogg
|
||||
url = https://github.com/xiph/ogg.git
|
||||
branch = master
|
||||
[submodule "vendor/opus"]
|
||||
path = vendor/opus
|
||||
url = https://github.com/xiph/opus.git
|
||||
branch = master
|
||||
[submodule "vendor/opusfile"]
|
||||
path = vendor/opusfile
|
||||
url = https://github.com/xiph/opusfile.git
|
||||
branch = master
|
||||
[submodule "vendor/librw"]
|
||||
path = vendor/librw
|
||||
url = https://github.com/aap/librw.git
|
||||
branch = master
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1
librw
1
librw
@ -1 +0,0 @@
|
||||
Subproject commit 99c15d5ed78cc112e1055cc89452dd57df28da58
|
File diff suppressed because it is too large
Load Diff
@ -1,199 +0,0 @@
|
||||
Version 1.0.28 (2017-04-02)
|
||||
* Fix buffer overruns in FLAC and ID3 handling code.
|
||||
* Move to variable length header storage.
|
||||
* Fix detection of Large File Support for 32 bit systems.
|
||||
* Remove large stack allocations in ALAC handling code.
|
||||
* Remove all use of Variable Length Arrays.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.27 (2016-06-19)
|
||||
* Fix an SF_INFO seekable flag regression introduced in 1.0.26.
|
||||
* Fix potential infinite loops on malformed input files.
|
||||
* Add string metadata read/write for CAF and RF64.
|
||||
* Add handling of CUE chunks.
|
||||
* Fix endian-ness issues in PAF files.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.26 (2015-11-22)
|
||||
* Fix for CVE-2014-9496, SD2 buffer read overflow.
|
||||
* Fix for CVE-2014-9756, file_io.c divide by zero.
|
||||
* Fix for CVE-2015-7805, AIFF heap write overflow.
|
||||
* Add support for ALAC encoder in a CAF container.
|
||||
* Add support for Cart chunks in WAV files.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.25 (2011-07-13)
|
||||
* Fix for Secunia Advisory SA45125, heap overflow in PAF file handler.
|
||||
* Accept broken WAV files with blockalign == 0.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.24 (2011-03-23)
|
||||
* WAV files now have an 18 byte u-law and A-law fmt chunk.
|
||||
* Document virtual I/O functionality.
|
||||
* Two new methods rawHandle() and takeOwnership() in sndfile.hh.
|
||||
* AIFF fix for non-zero offset value in SSND chunk.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.23 (2010-10-10)
|
||||
* Add version metadata to Windows DLL.
|
||||
* Add a missing 'inline' to sndfile.hh.
|
||||
* Update docs.
|
||||
* Minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.22 (2010-10-04)
|
||||
* Couple of fixes for SDS file writer.
|
||||
* Fixes arising from static analysis.
|
||||
* Handle FLAC files with ID3 meta data at start of file.
|
||||
* Handle FLAC files which report zero length.
|
||||
* Other minor bug fixes and improvements.
|
||||
|
||||
Version 1.0.21 (2009-12-13)
|
||||
* Add a couple of new binary programs to programs/ dir.
|
||||
* Remove sndfile-jackplay (now in sndfile-tools package).
|
||||
* Add windows only function sf_wchar_open().
|
||||
* Bunch of minor bug fixes.
|
||||
|
||||
Version 1.0.20 (2009-05-14)
|
||||
* Fix potential heap overflow in VOC file parser (Tobias Klein, http://www.trapkit.de/).
|
||||
|
||||
Version 1.0.19 (2009-03-02)
|
||||
* Fix for CVE-2009-0186 (Alin Rad Pop, Secunia Research).
|
||||
* Huge number of minor bug fixes as a result of static analysis.
|
||||
|
||||
Version 1.0.18 (2009-02-07)
|
||||
* Add Ogg/Vorbis support (thanks to John ffitch).
|
||||
* Remove captive FLAC library.
|
||||
* Many new features and bug fixes.
|
||||
* Generate Win32 and Win64 pre-compiled binaries.
|
||||
|
||||
Version 1.0.17 (2006-08-31)
|
||||
* Add sndfile.hh C++ wrapper.
|
||||
* Update Win32 MinGW build instructions.
|
||||
* Minor bug fixes and cleanups.
|
||||
|
||||
Version 1.0.16 (2006-04-30)
|
||||
* Add support for Broadcast (BEXT) chunks in WAV files.
|
||||
* Implement new commands SFC_GET_SIGNAL_MAX and SFC_GET_MAX_ALL_CHANNELS.
|
||||
* Add support for RIFX (big endian WAV variant).
|
||||
* Fix configure script bugs.
|
||||
* Fix bug in INST and MARK chunk writing for AIFF files.
|
||||
|
||||
Version 1.0.15 (2006-03-16)
|
||||
* Fix some ia64 issues.
|
||||
* Fix precompiled DLL.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.14 (2006-02-19)
|
||||
* Really fix MinGW compile problems.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.13 (2006-01-21)
|
||||
* Fix for MinGW compiler problems.
|
||||
* Allow readin/write of instrument chunks from WAV and AIFF files.
|
||||
* Compile problem fix for Solaris compiler.
|
||||
* Minor cleanups and bug fixes.
|
||||
|
||||
Version 1.0.12 (2005-09-30)
|
||||
* Add support for FLAC and Apple's Core Audio Format (CAF).
|
||||
* Add virtual I/O interface (still needs docs).
|
||||
* Cygwin and other Win32 fixes.
|
||||
* Minor bug fixes and cleanups.
|
||||
|
||||
Version 1.0.11 (2004-11-15)
|
||||
* Add support for SD2 files.
|
||||
* Add read support for loop info in WAV and AIFF files.
|
||||
* Add more tests.
|
||||
* Improve type safety.
|
||||
* Minor optimisations and bug fixes.
|
||||
|
||||
Version 1.0.10 (2004-06-15)
|
||||
* Fix AIFF read/write mode bugs.
|
||||
* Add support for compiling Win32 DLLS using MinGW.
|
||||
* Fix problems resulting in failed compiles with gcc-2.95.
|
||||
* Improve test suite.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.9 (2004-03-30)
|
||||
* Add handling of AVR (Audio Visual Research) files.
|
||||
* Improve handling of WAVEFORMATEXTENSIBLE WAV files.
|
||||
* Fix for using pipes on Win32.
|
||||
|
||||
Version 1.0.8 (2004-03-14)
|
||||
* Correct peak chunk handing for files with > 16 tracks.
|
||||
* Fix for WAV files with huge number of CUE chunks.
|
||||
|
||||
Version 1.0.7 (2004-02-25)
|
||||
* Fix clip mode detection on ia64, MIPS and other CPUs.
|
||||
* Fix two MacOSX build problems.
|
||||
|
||||
Version 1.0.6 (2004-02-08)
|
||||
* Added support for native Win32 file access API (Ross Bencina).
|
||||
* New mode to add clippling then a converting from float/double to integer
|
||||
would otherwise wrap around.
|
||||
* Fixed a bug in reading/writing files > 2Gig on Linux, Solaris and others.
|
||||
* Many minor bug fixes.
|
||||
* Other random fixes for Win32.
|
||||
|
||||
Version 1.0.5 (2003-05-03)
|
||||
* Added support for HTK files.
|
||||
* Added new function sf_open_fd() to allow for secure opening of temporary
|
||||
files as well as reading/writing sound files embedded within larger
|
||||
container files.
|
||||
* Added string support for AIFF files.
|
||||
* Minor bug fixes and code cleanups.
|
||||
|
||||
Version 1.0.4 (2003-02-02)
|
||||
* Added suport of PVF and XI files.
|
||||
* Added functionality for setting and retreiving strings from sound files.
|
||||
* Minor code cleanups and bug fixes.
|
||||
|
||||
Version 1.0.3 (2002-12-09)
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.2 (2002-11-24)
|
||||
* Added support for VOX ADPCM.
|
||||
* Improved error reporting.
|
||||
* Added version scripting on Linux and Solaris.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.1 (2002-09-14)
|
||||
* Added MAT and MAT5 file formats.
|
||||
* Minor bug fixes.
|
||||
|
||||
Version 1.0.0 (2002-08-16)
|
||||
* Final release for 1.0.0.
|
||||
|
||||
Version 1.0.0rc6 (2002-08-14)
|
||||
* Release candidate 6 for the 1.0.0 series.
|
||||
* MacOS9 fixes.
|
||||
|
||||
Version 1.0.0rc5 (2002-08-10)
|
||||
* Release candidate 5 for the 1.0.0 series.
|
||||
* Changed the definition of sf_count_t which was causing problems when
|
||||
libsndfile was compiled with other libraries (ie WxWindows).
|
||||
* Minor bug fixes.
|
||||
* Documentation cleanup.
|
||||
|
||||
Version 1.0.0rc4 (2002-08-03)
|
||||
* Release candidate 4 for the 1.0.0 series.
|
||||
* Minor bug fixes.
|
||||
* Fix broken Win32 "make check".
|
||||
|
||||
Version 1.0.0rc3 (2002-08-02)
|
||||
* Release candidate 3 for the 1.0.0 series.
|
||||
* Fix bug where libsndfile was reading beyond the end of the data chunk.
|
||||
* Added on-the-fly header updates on write.
|
||||
* Fix a couple of documentation issues.
|
||||
|
||||
Version 1.0.0rc2 (2002-06-24)
|
||||
* Release candidate 2 for the 1.0.0 series.
|
||||
* Fix compile problem for Win32.
|
||||
|
||||
Version 1.0.0rc1 (2002-06-24)
|
||||
* Release candidate 1 for the 1.0.0 series.
|
||||
|
||||
Version 0.0.28 (2002-04-27)
|
||||
* Last offical release of 0.0.X series of the library.
|
||||
|
||||
Version 0.0.8 (1999-02-16)
|
||||
* First offical release.
|
@ -1,857 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 1999-2016 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** This program is free software; you can redistribute it and/or modify
|
||||
** it under the terms of the GNU Lesser General Public License as published by
|
||||
** the Free Software Foundation; either version 2.1 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU Lesser General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU Lesser General Public License
|
||||
** along with this program; if not, write to the Free Software
|
||||
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
** sndfile.h -- system-wide definitions
|
||||
**
|
||||
** API documentation is in the doc/ directory of the source code tarball
|
||||
** and at http://www.mega-nerd.com/libsndfile/api.html.
|
||||
*/
|
||||
|
||||
#ifndef SNDFILE_H
|
||||
#define SNDFILE_H
|
||||
|
||||
/* This is the version 1.0.X header file. */
|
||||
#define SNDFILE_1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* The following file types can be read and written.
|
||||
** A file type would consist of a major type (ie SF_FORMAT_WAV) bitwise
|
||||
** ORed with a minor type (ie SF_FORMAT_PCM). SF_FORMAT_TYPEMASK and
|
||||
** SF_FORMAT_SUBMASK can be used to separate the major and minor file
|
||||
** types.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ /* Major formats. */
|
||||
SF_FORMAT_WAV = 0x010000, /* Microsoft WAV format (little endian default). */
|
||||
SF_FORMAT_AIFF = 0x020000, /* Apple/SGI AIFF format (big endian). */
|
||||
SF_FORMAT_AU = 0x030000, /* Sun/NeXT AU format (big endian). */
|
||||
SF_FORMAT_RAW = 0x040000, /* RAW PCM data. */
|
||||
SF_FORMAT_PAF = 0x050000, /* Ensoniq PARIS file format. */
|
||||
SF_FORMAT_SVX = 0x060000, /* Amiga IFF / SVX8 / SV16 format. */
|
||||
SF_FORMAT_NIST = 0x070000, /* Sphere NIST format. */
|
||||
SF_FORMAT_VOC = 0x080000, /* VOC files. */
|
||||
SF_FORMAT_IRCAM = 0x0A0000, /* Berkeley/IRCAM/CARL */
|
||||
SF_FORMAT_W64 = 0x0B0000, /* Sonic Foundry's 64 bit RIFF/WAV */
|
||||
SF_FORMAT_MAT4 = 0x0C0000, /* Matlab (tm) V4.2 / GNU Octave 2.0 */
|
||||
SF_FORMAT_MAT5 = 0x0D0000, /* Matlab (tm) V5.0 / GNU Octave 2.1 */
|
||||
SF_FORMAT_PVF = 0x0E0000, /* Portable Voice Format */
|
||||
SF_FORMAT_XI = 0x0F0000, /* Fasttracker 2 Extended Instrument */
|
||||
SF_FORMAT_HTK = 0x100000, /* HMM Tool Kit format */
|
||||
SF_FORMAT_SDS = 0x110000, /* Midi Sample Dump Standard */
|
||||
SF_FORMAT_AVR = 0x120000, /* Audio Visual Research */
|
||||
SF_FORMAT_WAVEX = 0x130000, /* MS WAVE with WAVEFORMATEX */
|
||||
SF_FORMAT_SD2 = 0x160000, /* Sound Designer 2 */
|
||||
SF_FORMAT_FLAC = 0x170000, /* FLAC lossless file format */
|
||||
SF_FORMAT_CAF = 0x180000, /* Core Audio File format */
|
||||
SF_FORMAT_WVE = 0x190000, /* Psion WVE format */
|
||||
SF_FORMAT_OGG = 0x200000, /* Xiph OGG container */
|
||||
SF_FORMAT_MPC2K = 0x210000, /* Akai MPC 2000 sampler */
|
||||
SF_FORMAT_RF64 = 0x220000, /* RF64 WAV file */
|
||||
|
||||
/* Subtypes from here on. */
|
||||
|
||||
SF_FORMAT_PCM_S8 = 0x0001, /* Signed 8 bit data */
|
||||
SF_FORMAT_PCM_16 = 0x0002, /* Signed 16 bit data */
|
||||
SF_FORMAT_PCM_24 = 0x0003, /* Signed 24 bit data */
|
||||
SF_FORMAT_PCM_32 = 0x0004, /* Signed 32 bit data */
|
||||
|
||||
SF_FORMAT_PCM_U8 = 0x0005, /* Unsigned 8 bit data (WAV and RAW only) */
|
||||
|
||||
SF_FORMAT_FLOAT = 0x0006, /* 32 bit float data */
|
||||
SF_FORMAT_DOUBLE = 0x0007, /* 64 bit float data */
|
||||
|
||||
SF_FORMAT_ULAW = 0x0010, /* U-Law encoded. */
|
||||
SF_FORMAT_ALAW = 0x0011, /* A-Law encoded. */
|
||||
SF_FORMAT_IMA_ADPCM = 0x0012, /* IMA ADPCM. */
|
||||
SF_FORMAT_MS_ADPCM = 0x0013, /* Microsoft ADPCM. */
|
||||
|
||||
SF_FORMAT_GSM610 = 0x0020, /* GSM 6.10 encoding. */
|
||||
SF_FORMAT_VOX_ADPCM = 0x0021, /* OKI / Dialogix ADPCM */
|
||||
|
||||
SF_FORMAT_G721_32 = 0x0030, /* 32kbs G721 ADPCM encoding. */
|
||||
SF_FORMAT_G723_24 = 0x0031, /* 24kbs G723 ADPCM encoding. */
|
||||
SF_FORMAT_G723_40 = 0x0032, /* 40kbs G723 ADPCM encoding. */
|
||||
|
||||
SF_FORMAT_DWVW_12 = 0x0040, /* 12 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_16 = 0x0041, /* 16 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_24 = 0x0042, /* 24 bit Delta Width Variable Word encoding. */
|
||||
SF_FORMAT_DWVW_N = 0x0043, /* N bit Delta Width Variable Word encoding. */
|
||||
|
||||
SF_FORMAT_DPCM_8 = 0x0050, /* 8 bit differential PCM (XI only) */
|
||||
SF_FORMAT_DPCM_16 = 0x0051, /* 16 bit differential PCM (XI only) */
|
||||
|
||||
SF_FORMAT_VORBIS = 0x0060, /* Xiph Vorbis encoding. */
|
||||
|
||||
SF_FORMAT_ALAC_16 = 0x0070, /* Apple Lossless Audio Codec (16 bit). */
|
||||
SF_FORMAT_ALAC_20 = 0x0071, /* Apple Lossless Audio Codec (20 bit). */
|
||||
SF_FORMAT_ALAC_24 = 0x0072, /* Apple Lossless Audio Codec (24 bit). */
|
||||
SF_FORMAT_ALAC_32 = 0x0073, /* Apple Lossless Audio Codec (32 bit). */
|
||||
|
||||
/* Endian-ness options. */
|
||||
|
||||
SF_ENDIAN_FILE = 0x00000000, /* Default file endian-ness. */
|
||||
SF_ENDIAN_LITTLE = 0x10000000, /* Force little endian-ness. */
|
||||
SF_ENDIAN_BIG = 0x20000000, /* Force big endian-ness. */
|
||||
SF_ENDIAN_CPU = 0x30000000, /* Force CPU endian-ness. */
|
||||
|
||||
SF_FORMAT_SUBMASK = 0x0000FFFF,
|
||||
SF_FORMAT_TYPEMASK = 0x0FFF0000,
|
||||
SF_FORMAT_ENDMASK = 0x30000000
|
||||
} ;
|
||||
|
||||
/*
|
||||
** The following are the valid command numbers for the sf_command()
|
||||
** interface. The use of these commands is documented in the file
|
||||
** command.html in the doc directory of the source code distribution.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SFC_GET_LIB_VERSION = 0x1000,
|
||||
SFC_GET_LOG_INFO = 0x1001,
|
||||
SFC_GET_CURRENT_SF_INFO = 0x1002,
|
||||
|
||||
|
||||
SFC_GET_NORM_DOUBLE = 0x1010,
|
||||
SFC_GET_NORM_FLOAT = 0x1011,
|
||||
SFC_SET_NORM_DOUBLE = 0x1012,
|
||||
SFC_SET_NORM_FLOAT = 0x1013,
|
||||
SFC_SET_SCALE_FLOAT_INT_READ = 0x1014,
|
||||
SFC_SET_SCALE_INT_FLOAT_WRITE = 0x1015,
|
||||
|
||||
SFC_GET_SIMPLE_FORMAT_COUNT = 0x1020,
|
||||
SFC_GET_SIMPLE_FORMAT = 0x1021,
|
||||
|
||||
SFC_GET_FORMAT_INFO = 0x1028,
|
||||
|
||||
SFC_GET_FORMAT_MAJOR_COUNT = 0x1030,
|
||||
SFC_GET_FORMAT_MAJOR = 0x1031,
|
||||
SFC_GET_FORMAT_SUBTYPE_COUNT = 0x1032,
|
||||
SFC_GET_FORMAT_SUBTYPE = 0x1033,
|
||||
|
||||
SFC_CALC_SIGNAL_MAX = 0x1040,
|
||||
SFC_CALC_NORM_SIGNAL_MAX = 0x1041,
|
||||
SFC_CALC_MAX_ALL_CHANNELS = 0x1042,
|
||||
SFC_CALC_NORM_MAX_ALL_CHANNELS = 0x1043,
|
||||
SFC_GET_SIGNAL_MAX = 0x1044,
|
||||
SFC_GET_MAX_ALL_CHANNELS = 0x1045,
|
||||
|
||||
SFC_SET_ADD_PEAK_CHUNK = 0x1050,
|
||||
SFC_SET_ADD_HEADER_PAD_CHUNK = 0x1051,
|
||||
|
||||
SFC_UPDATE_HEADER_NOW = 0x1060,
|
||||
SFC_SET_UPDATE_HEADER_AUTO = 0x1061,
|
||||
|
||||
SFC_FILE_TRUNCATE = 0x1080,
|
||||
|
||||
SFC_SET_RAW_START_OFFSET = 0x1090,
|
||||
|
||||
SFC_SET_DITHER_ON_WRITE = 0x10A0,
|
||||
SFC_SET_DITHER_ON_READ = 0x10A1,
|
||||
|
||||
SFC_GET_DITHER_INFO_COUNT = 0x10A2,
|
||||
SFC_GET_DITHER_INFO = 0x10A3,
|
||||
|
||||
SFC_GET_EMBED_FILE_INFO = 0x10B0,
|
||||
|
||||
SFC_SET_CLIPPING = 0x10C0,
|
||||
SFC_GET_CLIPPING = 0x10C1,
|
||||
|
||||
SFC_GET_CUE_COUNT = 0x10CD,
|
||||
SFC_GET_CUE = 0x10CE,
|
||||
SFC_SET_CUE = 0x10CF,
|
||||
|
||||
SFC_GET_INSTRUMENT = 0x10D0,
|
||||
SFC_SET_INSTRUMENT = 0x10D1,
|
||||
|
||||
SFC_GET_LOOP_INFO = 0x10E0,
|
||||
|
||||
SFC_GET_BROADCAST_INFO = 0x10F0,
|
||||
SFC_SET_BROADCAST_INFO = 0x10F1,
|
||||
|
||||
SFC_GET_CHANNEL_MAP_INFO = 0x1100,
|
||||
SFC_SET_CHANNEL_MAP_INFO = 0x1101,
|
||||
|
||||
SFC_RAW_DATA_NEEDS_ENDSWAP = 0x1110,
|
||||
|
||||
/* Support for Wavex Ambisonics Format */
|
||||
SFC_WAVEX_SET_AMBISONIC = 0x1200,
|
||||
SFC_WAVEX_GET_AMBISONIC = 0x1201,
|
||||
|
||||
/*
|
||||
** RF64 files can be set so that on-close, writable files that have less
|
||||
** than 4GB of data in them are converted to RIFF/WAV, as per EBU
|
||||
** recommendations.
|
||||
*/
|
||||
SFC_RF64_AUTO_DOWNGRADE = 0x1210,
|
||||
|
||||
SFC_SET_VBR_ENCODING_QUALITY = 0x1300,
|
||||
SFC_SET_COMPRESSION_LEVEL = 0x1301,
|
||||
|
||||
/* Cart Chunk support */
|
||||
SFC_SET_CART_INFO = 0x1400,
|
||||
SFC_GET_CART_INFO = 0x1401,
|
||||
|
||||
/* Following commands for testing only. */
|
||||
SFC_TEST_IEEE_FLOAT_REPLACE = 0x6001,
|
||||
|
||||
/*
|
||||
** SFC_SET_ADD_* values are deprecated and will disappear at some
|
||||
** time in the future. They are guaranteed to be here up to and
|
||||
** including version 1.0.8 to avoid breakage of existing software.
|
||||
** They currently do nothing and will continue to do nothing.
|
||||
*/
|
||||
SFC_SET_ADD_DITHER_ON_WRITE = 0x1070,
|
||||
SFC_SET_ADD_DITHER_ON_READ = 0x1071
|
||||
} ;
|
||||
|
||||
|
||||
/*
|
||||
** String types that can be set and read from files. Not all file types
|
||||
** support this and even the file types which support one, may not support
|
||||
** all string types.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_STR_TITLE = 0x01,
|
||||
SF_STR_COPYRIGHT = 0x02,
|
||||
SF_STR_SOFTWARE = 0x03,
|
||||
SF_STR_ARTIST = 0x04,
|
||||
SF_STR_COMMENT = 0x05,
|
||||
SF_STR_DATE = 0x06,
|
||||
SF_STR_ALBUM = 0x07,
|
||||
SF_STR_LICENSE = 0x08,
|
||||
SF_STR_TRACKNUMBER = 0x09,
|
||||
SF_STR_GENRE = 0x10
|
||||
} ;
|
||||
|
||||
/*
|
||||
** Use the following as the start and end index when doing metadata
|
||||
** transcoding.
|
||||
*/
|
||||
|
||||
#define SF_STR_FIRST SF_STR_TITLE
|
||||
#define SF_STR_LAST SF_STR_GENRE
|
||||
|
||||
enum
|
||||
{ /* True and false */
|
||||
SF_FALSE = 0,
|
||||
SF_TRUE = 1,
|
||||
|
||||
/* Modes for opening files. */
|
||||
SFM_READ = 0x10,
|
||||
SFM_WRITE = 0x20,
|
||||
SFM_RDWR = 0x30,
|
||||
|
||||
SF_AMBISONIC_NONE = 0x40,
|
||||
SF_AMBISONIC_B_FORMAT = 0x41
|
||||
} ;
|
||||
|
||||
/* Public error values. These are guaranteed to remain unchanged for the duration
|
||||
** of the library major version number.
|
||||
** There are also a large number of private error numbers which are internal to
|
||||
** the library which can change at any time.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_ERR_NO_ERROR = 0,
|
||||
SF_ERR_UNRECOGNISED_FORMAT = 1,
|
||||
SF_ERR_SYSTEM = 2,
|
||||
SF_ERR_MALFORMED_FILE = 3,
|
||||
SF_ERR_UNSUPPORTED_ENCODING = 4
|
||||
} ;
|
||||
|
||||
|
||||
/* Channel map values (used with SFC_SET/GET_CHANNEL_MAP).
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_CHANNEL_MAP_INVALID = 0,
|
||||
SF_CHANNEL_MAP_MONO = 1,
|
||||
SF_CHANNEL_MAP_LEFT, /* Apple calls this 'Left' */
|
||||
SF_CHANNEL_MAP_RIGHT, /* Apple calls this 'Right' */
|
||||
SF_CHANNEL_MAP_CENTER, /* Apple calls this 'Center' */
|
||||
SF_CHANNEL_MAP_FRONT_LEFT,
|
||||
SF_CHANNEL_MAP_FRONT_RIGHT,
|
||||
SF_CHANNEL_MAP_FRONT_CENTER,
|
||||
SF_CHANNEL_MAP_REAR_CENTER, /* Apple calls this 'Center Surround', Msft calls this 'Back Center' */
|
||||
SF_CHANNEL_MAP_REAR_LEFT, /* Apple calls this 'Left Surround', Msft calls this 'Back Left' */
|
||||
SF_CHANNEL_MAP_REAR_RIGHT, /* Apple calls this 'Right Surround', Msft calls this 'Back Right' */
|
||||
SF_CHANNEL_MAP_LFE, /* Apple calls this 'LFEScreen', Msft calls this 'Low Frequency' */
|
||||
SF_CHANNEL_MAP_FRONT_LEFT_OF_CENTER, /* Apple calls this 'Left Center' */
|
||||
SF_CHANNEL_MAP_FRONT_RIGHT_OF_CENTER, /* Apple calls this 'Right Center */
|
||||
SF_CHANNEL_MAP_SIDE_LEFT, /* Apple calls this 'Left Surround Direct' */
|
||||
SF_CHANNEL_MAP_SIDE_RIGHT, /* Apple calls this 'Right Surround Direct' */
|
||||
SF_CHANNEL_MAP_TOP_CENTER, /* Apple calls this 'Top Center Surround' */
|
||||
SF_CHANNEL_MAP_TOP_FRONT_LEFT, /* Apple calls this 'Vertical Height Left' */
|
||||
SF_CHANNEL_MAP_TOP_FRONT_RIGHT, /* Apple calls this 'Vertical Height Right' */
|
||||
SF_CHANNEL_MAP_TOP_FRONT_CENTER, /* Apple calls this 'Vertical Height Center' */
|
||||
SF_CHANNEL_MAP_TOP_REAR_LEFT, /* Apple and MS call this 'Top Back Left' */
|
||||
SF_CHANNEL_MAP_TOP_REAR_RIGHT, /* Apple and MS call this 'Top Back Right' */
|
||||
SF_CHANNEL_MAP_TOP_REAR_CENTER, /* Apple and MS call this 'Top Back Center' */
|
||||
|
||||
SF_CHANNEL_MAP_AMBISONIC_B_W,
|
||||
SF_CHANNEL_MAP_AMBISONIC_B_X,
|
||||
SF_CHANNEL_MAP_AMBISONIC_B_Y,
|
||||
SF_CHANNEL_MAP_AMBISONIC_B_Z,
|
||||
|
||||
SF_CHANNEL_MAP_MAX
|
||||
} ;
|
||||
|
||||
|
||||
/* A SNDFILE* pointer can be passed around much like stdio.h's FILE* pointer. */
|
||||
|
||||
typedef struct SNDFILE_tag SNDFILE ;
|
||||
|
||||
/* The following typedef is system specific and is defined when libsndfile is
|
||||
** compiled. sf_count_t will be a 64 bit value when the underlying OS allows
|
||||
** 64 bit file offsets.
|
||||
** On windows, we need to allow the same header file to be compiler by both GCC
|
||||
** and the Microsoft compiler.
|
||||
*/
|
||||
|
||||
#if (defined (_MSCVER) || defined (_MSC_VER) && (_MSC_VER < 1310))
|
||||
typedef __int64 sf_count_t ;
|
||||
#define SF_COUNT_MAX 0x7fffffffffffffffi64
|
||||
#else
|
||||
typedef __int64 sf_count_t ;
|
||||
#define SF_COUNT_MAX 0x7FFFFFFFFFFFFFFFLL
|
||||
#endif
|
||||
|
||||
|
||||
/* A pointer to a SF_INFO structure is passed to sf_open () and filled in.
|
||||
** On write, the SF_INFO structure is filled in by the user and passed into
|
||||
** sf_open ().
|
||||
*/
|
||||
|
||||
struct SF_INFO
|
||||
{ sf_count_t frames ; /* Used to be called samples. Changed to avoid confusion. */
|
||||
int samplerate ;
|
||||
int channels ;
|
||||
int format ;
|
||||
int sections ;
|
||||
int seekable ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_INFO SF_INFO ;
|
||||
|
||||
/* The SF_FORMAT_INFO struct is used to retrieve information about the sound
|
||||
** file formats libsndfile supports using the sf_command () interface.
|
||||
**
|
||||
** Using this interface will allow applications to support new file formats
|
||||
** and encoding types when libsndfile is upgraded, without requiring
|
||||
** re-compilation of the application.
|
||||
**
|
||||
** Please consult the libsndfile documentation (particularly the information
|
||||
** on the sf_command () interface) for examples of its use.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ int format ;
|
||||
const char *name ;
|
||||
const char *extension ;
|
||||
} SF_FORMAT_INFO ;
|
||||
|
||||
/*
|
||||
** Enums and typedefs for adding dither on read and write.
|
||||
** See the html documentation for sf_command(), SFC_SET_DITHER_ON_WRITE
|
||||
** and SFC_SET_DITHER_ON_READ.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SFD_DEFAULT_LEVEL = 0,
|
||||
SFD_CUSTOM_LEVEL = 0x40000000,
|
||||
|
||||
SFD_NO_DITHER = 500,
|
||||
SFD_WHITE = 501,
|
||||
SFD_TRIANGULAR_PDF = 502
|
||||
} ;
|
||||
|
||||
typedef struct
|
||||
{ int type ;
|
||||
double level ;
|
||||
const char *name ;
|
||||
} SF_DITHER_INFO ;
|
||||
|
||||
/* Struct used to retrieve information about a file embedded within a
|
||||
** larger file. See SFC_GET_EMBED_FILE_INFO.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ sf_count_t offset ;
|
||||
sf_count_t length ;
|
||||
} SF_EMBED_FILE_INFO ;
|
||||
|
||||
/*
|
||||
** Struct used to retrieve cue marker information from a file
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
{ int32_t indx ;
|
||||
uint32_t position ;
|
||||
int32_t fcc_chunk ;
|
||||
int32_t chunk_start ;
|
||||
int32_t block_start ;
|
||||
uint32_t sample_offset ;
|
||||
char name [256] ;
|
||||
} SF_CUE_POINT ;
|
||||
|
||||
#define SF_CUES_VAR(count) \
|
||||
struct \
|
||||
{ uint32_t cue_count ; \
|
||||
SF_CUE_POINT cue_points [count] ; \
|
||||
}
|
||||
|
||||
typedef SF_CUES_VAR (100) SF_CUES ;
|
||||
|
||||
/*
|
||||
** Structs used to retrieve music sample information from a file.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ /*
|
||||
** The loop mode field in SF_INSTRUMENT will be one of the following.
|
||||
*/
|
||||
SF_LOOP_NONE = 800,
|
||||
SF_LOOP_FORWARD,
|
||||
SF_LOOP_BACKWARD,
|
||||
SF_LOOP_ALTERNATING
|
||||
} ;
|
||||
|
||||
typedef struct
|
||||
{ int gain ;
|
||||
char basenote, detune ;
|
||||
char velocity_lo, velocity_hi ;
|
||||
char key_lo, key_hi ;
|
||||
int loop_count ;
|
||||
|
||||
struct
|
||||
{ int mode ;
|
||||
uint32_t start ;
|
||||
uint32_t end ;
|
||||
uint32_t count ;
|
||||
} loops [16] ; /* make variable in a sensible way */
|
||||
} SF_INSTRUMENT ;
|
||||
|
||||
|
||||
|
||||
/* Struct used to retrieve loop information from a file.*/
|
||||
typedef struct
|
||||
{
|
||||
short time_sig_num ; /* any positive integer > 0 */
|
||||
short time_sig_den ; /* any positive power of 2 > 0 */
|
||||
int loop_mode ; /* see SF_LOOP enum */
|
||||
|
||||
int num_beats ; /* this is NOT the amount of quarter notes !!!*/
|
||||
/* a full bar of 4/4 is 4 beats */
|
||||
/* a full bar of 7/8 is 7 beats */
|
||||
|
||||
float bpm ; /* suggestion, as it can be calculated using other fields:*/
|
||||
/* file's length, file's sampleRate and our time_sig_den*/
|
||||
/* -> bpms are always the amount of _quarter notes_ per minute */
|
||||
|
||||
int root_key ; /* MIDI note, or -1 for None */
|
||||
int future [6] ;
|
||||
} SF_LOOP_INFO ;
|
||||
|
||||
|
||||
/* Struct used to retrieve broadcast (EBU) information from a file.
|
||||
** Strongly (!) based on EBU "bext" chunk format used in Broadcast WAVE.
|
||||
*/
|
||||
#define SF_BROADCAST_INFO_VAR(coding_hist_size) \
|
||||
struct \
|
||||
{ char description [256] ; \
|
||||
char originator [32] ; \
|
||||
char originator_reference [32] ; \
|
||||
char origination_date [10] ; \
|
||||
char origination_time [8] ; \
|
||||
uint32_t time_reference_low ; \
|
||||
uint32_t time_reference_high ; \
|
||||
short version ; \
|
||||
char umid [64] ; \
|
||||
char reserved [190] ; \
|
||||
uint32_t coding_history_size ; \
|
||||
char coding_history [coding_hist_size] ; \
|
||||
}
|
||||
|
||||
/* SF_BROADCAST_INFO is the above struct with coding_history field of 256 bytes. */
|
||||
typedef SF_BROADCAST_INFO_VAR (256) SF_BROADCAST_INFO ;
|
||||
|
||||
struct SF_CART_TIMER
|
||||
{ char usage [4] ;
|
||||
int32_t value ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_CART_TIMER SF_CART_TIMER ;
|
||||
|
||||
#define SF_CART_INFO_VAR(p_tag_text_size) \
|
||||
struct \
|
||||
{ char version [4] ; \
|
||||
char title [64] ; \
|
||||
char artist [64] ; \
|
||||
char cut_id [64] ; \
|
||||
char client_id [64] ; \
|
||||
char category [64] ; \
|
||||
char classification [64] ; \
|
||||
char out_cue [64] ; \
|
||||
char start_date [10] ; \
|
||||
char start_time [8] ; \
|
||||
char end_date [10] ; \
|
||||
char end_time [8] ; \
|
||||
char producer_app_id [64] ; \
|
||||
char producer_app_version [64] ; \
|
||||
char user_def [64] ; \
|
||||
int32_t level_reference ; \
|
||||
SF_CART_TIMER post_timers [8] ; \
|
||||
char reserved [276] ; \
|
||||
char url [1024] ; \
|
||||
uint32_t tag_text_size ; \
|
||||
char tag_text [p_tag_text_size] ; \
|
||||
}
|
||||
|
||||
typedef SF_CART_INFO_VAR (256) SF_CART_INFO ;
|
||||
|
||||
/* Virtual I/O functionality. */
|
||||
|
||||
typedef sf_count_t (*sf_vio_get_filelen) (void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_seek) (sf_count_t offset, int whence, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_read) (void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_write) (const void *ptr, sf_count_t count, void *user_data) ;
|
||||
typedef sf_count_t (*sf_vio_tell) (void *user_data) ;
|
||||
|
||||
struct SF_VIRTUAL_IO
|
||||
{ sf_vio_get_filelen get_filelen ;
|
||||
sf_vio_seek seek ;
|
||||
sf_vio_read read ;
|
||||
sf_vio_write write ;
|
||||
sf_vio_tell tell ;
|
||||
} ;
|
||||
|
||||
typedef struct SF_VIRTUAL_IO SF_VIRTUAL_IO ;
|
||||
|
||||
|
||||
/* Open the specified file for read, write or both. On error, this will
|
||||
** return a NULL pointer. To find the error number, pass a NULL SNDFILE
|
||||
** to sf_strerror ().
|
||||
** All calls to sf_open() should be matched with a call to sf_close().
|
||||
*/
|
||||
|
||||
SNDFILE* sf_open (const char *path, int mode, SF_INFO *sfinfo) ;
|
||||
|
||||
|
||||
/* Use the existing file descriptor to create a SNDFILE object. If close_desc
|
||||
** is TRUE, the file descriptor will be closed when sf_close() is called. If
|
||||
** it is FALSE, the descriptor will not be closed.
|
||||
** When passed a descriptor like this, the library will assume that the start
|
||||
** of file header is at the current file offset. This allows sound files within
|
||||
** larger container files to be read and/or written.
|
||||
** On error, this will return a NULL pointer. To find the error number, pass a
|
||||
** NULL SNDFILE to sf_strerror ().
|
||||
** All calls to sf_open_fd() should be matched with a call to sf_close().
|
||||
|
||||
*/
|
||||
|
||||
SNDFILE* sf_open_fd (int fd, int mode, SF_INFO *sfinfo, int close_desc) ;
|
||||
|
||||
SNDFILE* sf_open_virtual (SF_VIRTUAL_IO *sfvirtual, int mode, SF_INFO *sfinfo, void *user_data) ;
|
||||
|
||||
|
||||
/* sf_error () returns a error number which can be translated to a text
|
||||
** string using sf_error_number().
|
||||
*/
|
||||
|
||||
int sf_error (SNDFILE *sndfile) ;
|
||||
|
||||
|
||||
/* sf_strerror () returns to the caller a pointer to the current error message for
|
||||
** the given SNDFILE.
|
||||
*/
|
||||
|
||||
const char* sf_strerror (SNDFILE *sndfile) ;
|
||||
|
||||
|
||||
/* sf_error_number () allows the retrieval of the error string for each internal
|
||||
** error number.
|
||||
**
|
||||
*/
|
||||
|
||||
const char* sf_error_number (int errnum) ;
|
||||
|
||||
|
||||
/* The following two error functions are deprecated but they will remain in the
|
||||
** library for the foreseeable future. The function sf_strerror() should be used
|
||||
** in their place.
|
||||
*/
|
||||
|
||||
int sf_perror (SNDFILE *sndfile) ;
|
||||
int sf_error_str (SNDFILE *sndfile, char* str, size_t len) ;
|
||||
|
||||
|
||||
/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
|
||||
|
||||
int sf_command (SNDFILE *sndfile, int command, void *data, int datasize) ;
|
||||
|
||||
|
||||
/* Return TRUE if fields of the SF_INFO struct are a valid combination of values. */
|
||||
|
||||
int sf_format_check (const SF_INFO *info) ;
|
||||
|
||||
|
||||
/* Seek within the waveform data chunk of the SNDFILE. sf_seek () uses
|
||||
** the same values for whence (SEEK_SET, SEEK_CUR and SEEK_END) as
|
||||
** stdio.h function fseek ().
|
||||
** An offset of zero with whence set to SEEK_SET will position the
|
||||
** read / write pointer to the first data sample.
|
||||
** On success sf_seek returns the current position in (multi-channel)
|
||||
** samples from the start of the file.
|
||||
** Please see the libsndfile documentation for moving the read pointer
|
||||
** separately from the write pointer on files open in mode SFM_RDWR.
|
||||
** On error all of these functions return -1.
|
||||
*/
|
||||
|
||||
enum
|
||||
{ SF_SEEK_SET = SEEK_SET,
|
||||
SF_SEEK_CUR = SEEK_CUR,
|
||||
SF_SEEK_END = SEEK_END
|
||||
} ;
|
||||
|
||||
sf_count_t sf_seek (SNDFILE *sndfile, sf_count_t frames, int whence) ;
|
||||
|
||||
|
||||
/* Functions for retrieving and setting string data within sound files.
|
||||
** Not all file types support this features; AIFF and WAV do. For both
|
||||
** functions, the str_type parameter must be one of the SF_STR_* values
|
||||
** defined above.
|
||||
** On error, sf_set_string() returns non-zero while sf_get_string()
|
||||
** returns NULL.
|
||||
*/
|
||||
|
||||
int sf_set_string (SNDFILE *sndfile, int str_type, const char* str) ;
|
||||
|
||||
const char* sf_get_string (SNDFILE *sndfile, int str_type) ;
|
||||
|
||||
|
||||
/* Return the library version string. */
|
||||
|
||||
const char * sf_version_string (void) ;
|
||||
|
||||
/* Return the current byterate at this point in the file. The byte rate in this
|
||||
** case is the number of bytes per second of audio data. For instance, for a
|
||||
** stereo, 18 bit PCM encoded file with an 16kHz sample rate, the byte rate
|
||||
** would be 2 (stereo) * 2 (two bytes per sample) * 16000 => 64000 bytes/sec.
|
||||
** For some file formats the returned value will be accurate and exact, for some
|
||||
** it will be a close approximation, for some it will be the average bitrate for
|
||||
** the whole file and for some it will be a time varying value that was accurate
|
||||
** when the file was most recently read or written.
|
||||
** To get the bitrate, multiple this value by 8.
|
||||
** Returns -1 for unknown.
|
||||
*/
|
||||
int sf_current_byterate (SNDFILE *sndfile) ;
|
||||
|
||||
/* Functions for reading/writing the waveform data of a sound file.
|
||||
*/
|
||||
|
||||
sf_count_t sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) ;
|
||||
sf_count_t sf_write_raw (SNDFILE *sndfile, const void *ptr, sf_count_t bytes) ;
|
||||
|
||||
|
||||
/* Functions for reading and writing the data chunk in terms of frames.
|
||||
** The number of items actually read/written = frames * number of channels.
|
||||
** sf_xxxx_raw read/writes the raw data bytes from/to the file
|
||||
** sf_xxxx_short passes data in the native short format
|
||||
** sf_xxxx_int passes data in the native int format
|
||||
** sf_xxxx_float passes data in the native float format
|
||||
** sf_xxxx_double passes data in the native double format
|
||||
** All of these read/write function return number of frames read/written.
|
||||
*/
|
||||
|
||||
sf_count_t sf_readf_short (SNDFILE *sndfile, short *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_short (SNDFILE *sndfile, const short *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_int (SNDFILE *sndfile, const int *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_float (SNDFILE *sndfile, float *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_float (SNDFILE *sndfile, const float *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t sf_readf_double (SNDFILE *sndfile, double *ptr, sf_count_t frames) ;
|
||||
sf_count_t sf_writef_double (SNDFILE *sndfile, const double *ptr, sf_count_t frames) ;
|
||||
|
||||
|
||||
/* Functions for reading and writing the data chunk in terms of items.
|
||||
** Otherwise similar to above.
|
||||
** All of these read/write function return number of items read/written.
|
||||
*/
|
||||
|
||||
sf_count_t sf_read_short (SNDFILE *sndfile, short *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_short (SNDFILE *sndfile, const short *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_int (SNDFILE *sndfile, const int *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_float (SNDFILE *sndfile, float *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_float (SNDFILE *sndfile, const float *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t sf_read_double (SNDFILE *sndfile, double *ptr, sf_count_t items) ;
|
||||
sf_count_t sf_write_double (SNDFILE *sndfile, const double *ptr, sf_count_t items) ;
|
||||
|
||||
|
||||
/* Close the SNDFILE and clean up all memory allocations associated with this
|
||||
** file.
|
||||
** Returns 0 on success, or an error number.
|
||||
*/
|
||||
|
||||
int sf_close (SNDFILE *sndfile) ;
|
||||
|
||||
|
||||
/* If the file is opened SFM_WRITE or SFM_RDWR, call fsync() on the file
|
||||
** to force the writing of data to disk. If the file is opened SFM_READ
|
||||
** no action is taken.
|
||||
*/
|
||||
|
||||
void sf_write_sync (SNDFILE *sndfile) ;
|
||||
|
||||
|
||||
|
||||
/* The function sf_wchar_open() is Windows Only!
|
||||
** Open a file passing in a Windows Unicode filename. Otherwise, this is
|
||||
** the same as sf_open().
|
||||
**
|
||||
** In order for this to work, you need to do the following:
|
||||
**
|
||||
** #include <windows.h>
|
||||
** #define ENABLE_SNDFILE_WINDOWS_PROTOTYPES 1
|
||||
** #including <sndfile.h>
|
||||
*/
|
||||
|
||||
#if (defined (ENABLE_SNDFILE_WINDOWS_PROTOTYPES) && ENABLE_SNDFILE_WINDOWS_PROTOTYPES)
|
||||
SNDFILE* sf_wchar_open (LPCWSTR wpath, int mode, SF_INFO *sfinfo) ;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
/* Getting and setting of chunks from within a sound file.
|
||||
**
|
||||
** These functions allow the getting and setting of chunks within a sound file
|
||||
** (for those formats which allow it).
|
||||
**
|
||||
** These functions fail safely. Specifically, they will not allow you to overwrite
|
||||
** existing chunks or add extra versions of format specific reserved chunks but
|
||||
** should allow you to retrieve any and all chunks (may not be implemented for
|
||||
** all chunks or all file formats).
|
||||
*/
|
||||
|
||||
struct SF_CHUNK_INFO
|
||||
{ char id [64] ; /* The chunk identifier. */
|
||||
unsigned id_size ; /* The size of the chunk identifier. */
|
||||
unsigned datalen ; /* The size of that data. */
|
||||
void *data ; /* Pointer to the data. */
|
||||
} ;
|
||||
|
||||
typedef struct SF_CHUNK_INFO SF_CHUNK_INFO ;
|
||||
|
||||
/* Set the specified chunk info (must be done before any audio data is written
|
||||
** to the file). This will fail for format specific reserved chunks.
|
||||
** The chunk_info->data pointer must be valid until the file is closed.
|
||||
** Returns SF_ERR_NO_ERROR on success or non-zero on failure.
|
||||
*/
|
||||
int sf_set_chunk (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info) ;
|
||||
|
||||
/*
|
||||
** An opaque structure to an iterator over the all chunks of a given id
|
||||
*/
|
||||
typedef struct SF_CHUNK_ITERATOR SF_CHUNK_ITERATOR ;
|
||||
|
||||
/* Get an iterator for all chunks matching chunk_info.
|
||||
** The iterator will point to the first chunk matching chunk_info.
|
||||
** Chunks are matching, if (chunk_info->id) matches the first
|
||||
** (chunk_info->id_size) bytes of a chunk found in the SNDFILE* handle.
|
||||
** If chunk_info is NULL, an iterator to all chunks in the SNDFILE* handle
|
||||
** is returned.
|
||||
** The values of chunk_info->datalen and chunk_info->data are ignored.
|
||||
** If no matching chunks are found in the sndfile, NULL is returned.
|
||||
** The returned iterator will stay valid until one of the following occurs:
|
||||
** a) The sndfile is closed.
|
||||
** b) A new chunk is added using sf_set_chunk().
|
||||
** c) Another chunk iterator function is called on the same SNDFILE* handle
|
||||
** that causes the iterator to be modified.
|
||||
** The memory for the iterator belongs to the SNDFILE* handle and is freed when
|
||||
** sf_close() is called.
|
||||
*/
|
||||
SF_CHUNK_ITERATOR *
|
||||
sf_get_chunk_iterator (SNDFILE * sndfile, const SF_CHUNK_INFO * chunk_info) ;
|
||||
|
||||
/* Iterate through chunks by incrementing the iterator.
|
||||
** Increments the iterator and returns a handle to the new one.
|
||||
** After this call, iterator will no longer be valid, and you must use the
|
||||
** newly returned handle from now on.
|
||||
** The returned handle can be used to access the next chunk matching
|
||||
** the criteria as defined in sf_get_chunk_iterator().
|
||||
** If iterator points to the last chunk, this will free all resources
|
||||
** associated with iterator and return NULL.
|
||||
** The returned iterator will stay valid until sf_get_chunk_iterator_next
|
||||
** is called again, the sndfile is closed or a new chunk us added.
|
||||
*/
|
||||
SF_CHUNK_ITERATOR *
|
||||
sf_next_chunk_iterator (SF_CHUNK_ITERATOR * iterator) ;
|
||||
|
||||
|
||||
/* Get the size of the specified chunk.
|
||||
** If the specified chunk exists, the size will be returned in the
|
||||
** datalen field of the SF_CHUNK_INFO struct.
|
||||
** Additionally, the id of the chunk will be copied to the id
|
||||
** field of the SF_CHUNK_INFO struct and it's id_size field will
|
||||
** be updated accordingly.
|
||||
** If the chunk doesn't exist chunk_info->datalen will be zero, and the
|
||||
** id and id_size fields will be undefined.
|
||||
** The function will return SF_ERR_NO_ERROR on success or non-zero on
|
||||
** failure.
|
||||
*/
|
||||
int
|
||||
sf_get_chunk_size (const SF_CHUNK_ITERATOR * it, SF_CHUNK_INFO * chunk_info) ;
|
||||
|
||||
/* Get the specified chunk data.
|
||||
** If the specified chunk exists, up to chunk_info->datalen bytes of
|
||||
** the chunk data will be copied into the chunk_info->data buffer
|
||||
** (allocated by the caller) and the chunk_info->datalen field
|
||||
** updated to reflect the size of the data. The id and id_size
|
||||
** field will be updated according to the retrieved chunk
|
||||
** If the chunk doesn't exist chunk_info->datalen will be zero, and the
|
||||
** id and id_size fields will be undefined.
|
||||
** The function will return SF_ERR_NO_ERROR on success or non-zero on
|
||||
** failure.
|
||||
*/
|
||||
int
|
||||
sf_get_chunk_data (const SF_CHUNK_ITERATOR * it, SF_CHUNK_INFO * chunk_info) ;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* SNDFILE_H */
|
||||
|
@ -1,446 +0,0 @@
|
||||
/*
|
||||
** Copyright (C) 2005-2012 Erik de Castro Lopo <erikd@mega-nerd.com>
|
||||
**
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are
|
||||
** met:
|
||||
**
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * 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.
|
||||
** * Neither the author nor the names of any 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 OWNER 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
** The above modified BSD style license (GPL and LGPL compatible) applies to
|
||||
** this file. It does not apply to libsndfile itself which is released under
|
||||
** the GNU LGPL or the libsndfile test suite which is released under the GNU
|
||||
** GPL.
|
||||
** This means that this header file can be used under this modified BSD style
|
||||
** license, but the LGPL still holds for the libsndfile library itself.
|
||||
*/
|
||||
|
||||
/*
|
||||
** sndfile.hh -- A lightweight C++ wrapper for the libsndfile API.
|
||||
**
|
||||
** All the methods are inlines and all functionality is contained in this
|
||||
** file. There is no separate implementation file.
|
||||
**
|
||||
** API documentation is in the doc/ directory of the source code tarball
|
||||
** and at http://www.mega-nerd.com/libsndfile/api.html.
|
||||
*/
|
||||
|
||||
#ifndef SNDFILE_HH
|
||||
#define SNDFILE_HH
|
||||
|
||||
#include <sndfile.h>
|
||||
|
||||
#include <string>
|
||||
#include <new> // for std::nothrow
|
||||
|
||||
class SndfileHandle
|
||||
{ private :
|
||||
struct SNDFILE_ref
|
||||
{ SNDFILE_ref (void) ;
|
||||
~SNDFILE_ref (void) ;
|
||||
|
||||
SNDFILE *sf ;
|
||||
SF_INFO sfinfo ;
|
||||
int ref ;
|
||||
} ;
|
||||
|
||||
SNDFILE_ref *p ;
|
||||
|
||||
public :
|
||||
/* Default constructor */
|
||||
SndfileHandle (void) : p (NULL) {} ;
|
||||
SndfileHandle (const char *path, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
SndfileHandle (std::string const & path, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
SndfileHandle (int fd, bool close_desc, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
SndfileHandle (SF_VIRTUAL_IO &sfvirtual, void *user_data, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
|
||||
#ifdef ENABLE_SNDFILE_WINDOWS_PROTOTYPES
|
||||
SndfileHandle (LPCWSTR wpath, int mode = SFM_READ,
|
||||
int format = 0, int channels = 0, int samplerate = 0) ;
|
||||
#endif
|
||||
|
||||
~SndfileHandle (void) ;
|
||||
|
||||
SndfileHandle (const SndfileHandle &orig) ;
|
||||
SndfileHandle & operator = (const SndfileHandle &rhs) ;
|
||||
|
||||
/* Mainly for debugging/testing. */
|
||||
int refCount (void) const { return (p == NULL) ? 0 : p->ref ; }
|
||||
|
||||
operator bool () const { return (p != NULL) ; }
|
||||
|
||||
bool operator == (const SndfileHandle &rhs) const { return (p == rhs.p) ; }
|
||||
|
||||
sf_count_t frames (void) const { return p ? p->sfinfo.frames : 0 ; }
|
||||
int format (void) const { return p ? p->sfinfo.format : 0 ; }
|
||||
int channels (void) const { return p ? p->sfinfo.channels : 0 ; }
|
||||
int samplerate (void) const { return p ? p->sfinfo.samplerate : 0 ; }
|
||||
|
||||
int error (void) const ;
|
||||
const char * strError (void) const ;
|
||||
|
||||
int command (int cmd, void *data, int datasize) ;
|
||||
|
||||
sf_count_t seek (sf_count_t frames, int whence) ;
|
||||
|
||||
void writeSync (void) ;
|
||||
|
||||
int setString (int str_type, const char* str) ;
|
||||
|
||||
const char* getString (int str_type) const ;
|
||||
|
||||
static int formatCheck (int format, int channels, int samplerate) ;
|
||||
|
||||
sf_count_t read (short *ptr, sf_count_t items) ;
|
||||
sf_count_t read (int *ptr, sf_count_t items) ;
|
||||
sf_count_t read (float *ptr, sf_count_t items) ;
|
||||
sf_count_t read (double *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t write (const short *ptr, sf_count_t items) ;
|
||||
sf_count_t write (const int *ptr, sf_count_t items) ;
|
||||
sf_count_t write (const float *ptr, sf_count_t items) ;
|
||||
sf_count_t write (const double *ptr, sf_count_t items) ;
|
||||
|
||||
sf_count_t readf (short *ptr, sf_count_t frames) ;
|
||||
sf_count_t readf (int *ptr, sf_count_t frames) ;
|
||||
sf_count_t readf (float *ptr, sf_count_t frames) ;
|
||||
sf_count_t readf (double *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t writef (const short *ptr, sf_count_t frames) ;
|
||||
sf_count_t writef (const int *ptr, sf_count_t frames) ;
|
||||
sf_count_t writef (const float *ptr, sf_count_t frames) ;
|
||||
sf_count_t writef (const double *ptr, sf_count_t frames) ;
|
||||
|
||||
sf_count_t readRaw (void *ptr, sf_count_t bytes) ;
|
||||
sf_count_t writeRaw (const void *ptr, sf_count_t bytes) ;
|
||||
|
||||
/**< Raw access to the handle. SndfileHandle keeps ownership. */
|
||||
SNDFILE * rawHandle (void) ;
|
||||
|
||||
/**< Take ownership of handle, if reference count is 1. */
|
||||
SNDFILE * takeOwnership (void) ;
|
||||
} ;
|
||||
|
||||
/*==============================================================================
|
||||
** Nothing but implementation below.
|
||||
*/
|
||||
|
||||
inline
|
||||
SndfileHandle::SNDFILE_ref::SNDFILE_ref (void)
|
||||
: sf (NULL), sfinfo (), ref (1)
|
||||
{}
|
||||
|
||||
inline
|
||||
SndfileHandle::SNDFILE_ref::~SNDFILE_ref (void)
|
||||
{ if (sf != NULL) sf_close (sf) ; }
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (const char *path, int mode, int fmt, int chans, int srate)
|
||||
: p (NULL)
|
||||
{
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_open (path, mode, &p->sfinfo) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle const char * constructor */
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (std::string const & path, int mode, int fmt, int chans, int srate)
|
||||
: p (NULL)
|
||||
{
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_open (path.c_str (), mode, &p->sfinfo) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle std::string constructor */
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (int fd, bool close_desc, int mode, int fmt, int chans, int srate)
|
||||
: p (NULL)
|
||||
{
|
||||
if (fd < 0)
|
||||
return ;
|
||||
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_open_fd (fd, mode, &p->sfinfo, close_desc) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle fd constructor */
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (SF_VIRTUAL_IO &sfvirtual, void *user_data, int mode, int fmt, int chans, int srate)
|
||||
: p (NULL)
|
||||
{
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_open_virtual (&sfvirtual, mode, &p->sfinfo, user_data) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle std::string constructor */
|
||||
|
||||
inline
|
||||
SndfileHandle::~SndfileHandle (void)
|
||||
{ if (p != NULL && --p->ref == 0)
|
||||
delete p ;
|
||||
} /* SndfileHandle destructor */
|
||||
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (const SndfileHandle &orig)
|
||||
: p (orig.p)
|
||||
{ if (p != NULL)
|
||||
++p->ref ;
|
||||
} /* SndfileHandle copy constructor */
|
||||
|
||||
inline SndfileHandle &
|
||||
SndfileHandle::operator = (const SndfileHandle &rhs)
|
||||
{
|
||||
if (&rhs == this)
|
||||
return *this ;
|
||||
if (p != NULL && --p->ref == 0)
|
||||
delete p ;
|
||||
|
||||
p = rhs.p ;
|
||||
if (p != NULL)
|
||||
++p->ref ;
|
||||
|
||||
return *this ;
|
||||
} /* SndfileHandle assignment operator */
|
||||
|
||||
inline int
|
||||
SndfileHandle::error (void) const
|
||||
{ return sf_error (p->sf) ; }
|
||||
|
||||
inline const char *
|
||||
SndfileHandle::strError (void) const
|
||||
{ return sf_strerror (p->sf) ; }
|
||||
|
||||
inline int
|
||||
SndfileHandle::command (int cmd, void *data, int datasize)
|
||||
{ return sf_command (p->sf, cmd, data, datasize) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::seek (sf_count_t frame_count, int whence)
|
||||
{ return sf_seek (p->sf, frame_count, whence) ; }
|
||||
|
||||
inline void
|
||||
SndfileHandle::writeSync (void)
|
||||
{ sf_write_sync (p->sf) ; }
|
||||
|
||||
inline int
|
||||
SndfileHandle::setString (int str_type, const char* str)
|
||||
{ return sf_set_string (p->sf, str_type, str) ; }
|
||||
|
||||
inline const char*
|
||||
SndfileHandle::getString (int str_type) const
|
||||
{ return sf_get_string (p->sf, str_type) ; }
|
||||
|
||||
inline int
|
||||
SndfileHandle::formatCheck (int fmt, int chans, int srate)
|
||||
{
|
||||
SF_INFO sfinfo ;
|
||||
|
||||
sfinfo.frames = 0 ;
|
||||
sfinfo.channels = chans ;
|
||||
sfinfo.format = fmt ;
|
||||
sfinfo.samplerate = srate ;
|
||||
sfinfo.sections = 0 ;
|
||||
sfinfo.seekable = 0 ;
|
||||
|
||||
return sf_format_check (&sfinfo) ;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------*/
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::read (short *ptr, sf_count_t items)
|
||||
{ return sf_read_short (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::read (int *ptr, sf_count_t items)
|
||||
{ return sf_read_int (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::read (float *ptr, sf_count_t items)
|
||||
{ return sf_read_float (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::read (double *ptr, sf_count_t items)
|
||||
{ return sf_read_double (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::write (const short *ptr, sf_count_t items)
|
||||
{ return sf_write_short (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::write (const int *ptr, sf_count_t items)
|
||||
{ return sf_write_int (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::write (const float *ptr, sf_count_t items)
|
||||
{ return sf_write_float (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::write (const double *ptr, sf_count_t items)
|
||||
{ return sf_write_double (p->sf, ptr, items) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readf (short *ptr, sf_count_t frame_count)
|
||||
{ return sf_readf_short (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readf (int *ptr, sf_count_t frame_count)
|
||||
{ return sf_readf_int (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readf (float *ptr, sf_count_t frame_count)
|
||||
{ return sf_readf_float (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readf (double *ptr, sf_count_t frame_count)
|
||||
{ return sf_readf_double (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writef (const short *ptr, sf_count_t frame_count)
|
||||
{ return sf_writef_short (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writef (const int *ptr, sf_count_t frame_count)
|
||||
{ return sf_writef_int (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writef (const float *ptr, sf_count_t frame_count)
|
||||
{ return sf_writef_float (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writef (const double *ptr, sf_count_t frame_count)
|
||||
{ return sf_writef_double (p->sf, ptr, frame_count) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::readRaw (void *ptr, sf_count_t bytes)
|
||||
{ return sf_read_raw (p->sf, ptr, bytes) ; }
|
||||
|
||||
inline sf_count_t
|
||||
SndfileHandle::writeRaw (const void *ptr, sf_count_t bytes)
|
||||
{ return sf_write_raw (p->sf, ptr, bytes) ; }
|
||||
|
||||
inline SNDFILE *
|
||||
SndfileHandle::rawHandle (void)
|
||||
{ return (p ? p->sf : NULL) ; }
|
||||
|
||||
inline SNDFILE *
|
||||
SndfileHandle::takeOwnership (void)
|
||||
{
|
||||
if (p == NULL || (p->ref != 1))
|
||||
return NULL ;
|
||||
|
||||
SNDFILE * sf = p->sf ;
|
||||
p->sf = NULL ;
|
||||
delete p ;
|
||||
p = NULL ;
|
||||
return sf ;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_SNDFILE_WINDOWS_PROTOTYPES
|
||||
|
||||
inline
|
||||
SndfileHandle::SndfileHandle (LPCWSTR wpath, int mode, int fmt, int chans, int srate)
|
||||
: p (NULL)
|
||||
{
|
||||
p = new (std::nothrow) SNDFILE_ref () ;
|
||||
|
||||
if (p != NULL)
|
||||
{ p->ref = 1 ;
|
||||
|
||||
p->sfinfo.frames = 0 ;
|
||||
p->sfinfo.channels = chans ;
|
||||
p->sfinfo.format = fmt ;
|
||||
p->sfinfo.samplerate = srate ;
|
||||
p->sfinfo.sections = 0 ;
|
||||
p->sfinfo.seekable = 0 ;
|
||||
|
||||
p->sf = sf_wchar_open (wpath, mode, &p->sfinfo) ;
|
||||
} ;
|
||||
|
||||
return ;
|
||||
} /* SndfileHandle const wchar_t * constructor */
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* SNDFILE_HH */
|
||||
|
@ -1,159 +0,0 @@
|
||||
/*
|
||||
libmpg123: MPEG Audio Decoder library
|
||||
|
||||
separate header just for audio format definitions not tied to
|
||||
library code
|
||||
|
||||
copyright 1995-2020 by the mpg123 project
|
||||
free software under the terms of the LGPL 2.1
|
||||
see COPYING and AUTHORS files in distribution or http://mpg123.org
|
||||
*/
|
||||
|
||||
#ifndef MPG123_ENC_H
|
||||
#define MPG123_ENC_H
|
||||
|
||||
/** \file fmt123.h Audio format definitions. */
|
||||
|
||||
/** \defgroup mpg123_enc mpg123 PCM sample encodings
|
||||
* These are definitions for audio formats used by libmpg123 and
|
||||
* libout123.
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
/** An enum over all sample types possibly known to mpg123.
|
||||
* The values are designed as bit flags to allow bitmasking for encoding
|
||||
* families.
|
||||
* This is also why the enum is not used as type for actual encoding variables,
|
||||
* plain integers (at least 16 bit, 15 bit being used) cover the possible
|
||||
* combinations of these flags.
|
||||
*
|
||||
* Note that (your build of) libmpg123 does not necessarily support all these.
|
||||
* Usually, you can expect the 8bit encodings and signed 16 bit.
|
||||
* Also 32bit float will be usual beginning with mpg123-1.7.0 .
|
||||
* What you should bear in mind is that (SSE, etc) optimized routines may be
|
||||
* absent for some formats. We do have SSE for 16, 32 bit and float, though.
|
||||
* 24 bit integer is done via postprocessing of 32 bit output -- just cutting
|
||||
* the last byte, no rounding, even. If you want better, do it yourself.
|
||||
*
|
||||
* All formats are in native byte order. If you need different endinaness, you
|
||||
* can simply postprocess the output buffers (libmpg123 wouldn't do anything
|
||||
* else). The macro MPG123_SAMPLESIZE() can be helpful there.
|
||||
*/
|
||||
enum mpg123_enc_enum
|
||||
{
|
||||
/* 0000 0000 0000 1111 Some 8 bit integer encoding. */
|
||||
MPG123_ENC_8 = 0x00f
|
||||
/* 0000 0000 0100 0000 Some 16 bit integer encoding. */
|
||||
, MPG123_ENC_16 = 0x040
|
||||
/* 0100 0000 0000 0000 Some 24 bit integer encoding. */
|
||||
, MPG123_ENC_24 = 0x4000
|
||||
/* 0000 0001 0000 0000 Some 32 bit integer encoding. */
|
||||
, MPG123_ENC_32 = 0x100
|
||||
/* 0000 0000 1000 0000 Some signed integer encoding. */
|
||||
, MPG123_ENC_SIGNED = 0x080
|
||||
/* 0000 1110 0000 0000 Some float encoding. */
|
||||
, MPG123_ENC_FLOAT = 0xe00
|
||||
/* 0000 0000 1101 0000 signed 16 bit */
|
||||
, MPG123_ENC_SIGNED_16 = (MPG123_ENC_16|MPG123_ENC_SIGNED|0x10)
|
||||
/* 0000 0000 0110 0000 unsigned 16 bit */
|
||||
, MPG123_ENC_UNSIGNED_16 = (MPG123_ENC_16|0x20)
|
||||
/* 0000 0000 0000 0001 unsigned 8 bit */
|
||||
, MPG123_ENC_UNSIGNED_8 = 0x01
|
||||
/* 0000 0000 1000 0010 signed 8 bit */
|
||||
, MPG123_ENC_SIGNED_8 = (MPG123_ENC_SIGNED|0x02)
|
||||
/* 0000 0000 0000 0100 ulaw 8 bit */
|
||||
, MPG123_ENC_ULAW_8 = 0x04
|
||||
/* 0000 0000 0000 1000 alaw 8 bit */
|
||||
, MPG123_ENC_ALAW_8 = 0x08
|
||||
/* 0001 0001 1000 0000 signed 32 bit */
|
||||
, MPG123_ENC_SIGNED_32 = MPG123_ENC_32|MPG123_ENC_SIGNED|0x1000
|
||||
/* 0010 0001 0000 0000 unsigned 32 bit */
|
||||
, MPG123_ENC_UNSIGNED_32 = MPG123_ENC_32|0x2000
|
||||
/* 0101 0000 1000 0000 signed 24 bit */
|
||||
, MPG123_ENC_SIGNED_24 = MPG123_ENC_24|MPG123_ENC_SIGNED|0x1000
|
||||
/* 0110 0000 0000 0000 unsigned 24 bit */
|
||||
, MPG123_ENC_UNSIGNED_24 = MPG123_ENC_24|0x2000
|
||||
/* 0000 0010 0000 0000 32bit float */
|
||||
, MPG123_ENC_FLOAT_32 = 0x200
|
||||
/* 0000 0100 0000 0000 64bit float */
|
||||
, MPG123_ENC_FLOAT_64 = 0x400
|
||||
/* Any possibly known encoding from the list above. */
|
||||
, MPG123_ENC_ANY = ( MPG123_ENC_SIGNED_16 | MPG123_ENC_UNSIGNED_16
|
||||
| MPG123_ENC_UNSIGNED_8 | MPG123_ENC_SIGNED_8
|
||||
| MPG123_ENC_ULAW_8 | MPG123_ENC_ALAW_8
|
||||
| MPG123_ENC_SIGNED_32 | MPG123_ENC_UNSIGNED_32
|
||||
| MPG123_ENC_SIGNED_24 | MPG123_ENC_UNSIGNED_24
|
||||
| MPG123_ENC_FLOAT_32 | MPG123_ENC_FLOAT_64 )
|
||||
};
|
||||
|
||||
/** Get size of one PCM sample with given encoding.
|
||||
* This is included both in libmpg123 and libout123. Both offer
|
||||
* an API function to provide the macro results from library
|
||||
* compile-time, not that of you application. This most likely
|
||||
* does not matter as I do not expect any fresh PCM sample
|
||||
* encoding to appear. But who knows? Perhaps the encoding type
|
||||
* will be abused for funny things in future, not even plain PCM.
|
||||
* And, by the way: Thomas really likes the ?: operator.
|
||||
* \param enc the encoding (mpg123_enc_enum value)
|
||||
* \return size of one sample in bytes
|
||||
*/
|
||||
#define MPG123_SAMPLESIZE(enc) ( \
|
||||
(enc) < 1 \
|
||||
? 0 \
|
||||
: ( (enc) & MPG123_ENC_8 \
|
||||
? 1 \
|
||||
: ( (enc) & MPG123_ENC_16 \
|
||||
? 2 \
|
||||
: ( (enc) & MPG123_ENC_24 \
|
||||
? 3 \
|
||||
: ( ( (enc) & MPG123_ENC_32 \
|
||||
|| (enc) == MPG123_ENC_FLOAT_32 ) \
|
||||
? 4 \
|
||||
: ( (enc) == MPG123_ENC_FLOAT_64 \
|
||||
? 8 \
|
||||
: 0 \
|
||||
) ) ) ) ) )
|
||||
|
||||
/** Representation of zero in differing encodings.
|
||||
* This exists to define proper silence in various encodings without
|
||||
* having to link to libsyn123 to do actual conversions at runtime.
|
||||
* You have to handle big/little endian order yourself, though.
|
||||
* This takes the shortcut that any signed encoding has a zero with
|
||||
* all-zero bits. Unsigned linear encodings just have the highest bit set
|
||||
* (2^(n-1) for n bits), while the nonlinear 8-bit ones are special.
|
||||
* \param enc the encoding (mpg123_enc_enum value)
|
||||
* \param siz bytes per sample (return value of MPG123_SAMPLESIZE(enc))
|
||||
* \param off byte (octet) offset counted from LSB
|
||||
* \return unsigned byte value for the designated octet
|
||||
*/
|
||||
#define MPG123_ZEROSAMPLE(enc, siz, off) ( \
|
||||
(enc) == MPG123_ENC_ULAW_8 \
|
||||
? (off == 0 ? 0xff : 0x00) \
|
||||
: ( (enc) == MPG123_ENC_ALAW_8 \
|
||||
? (off == 0 ? 0xd5 : 0x00) \
|
||||
: ( (((enc) & (MPG123_ENC_SIGNED|MPG123_ENC_FLOAT)) || (siz) != ((off)+1)) \
|
||||
? 0x00 \
|
||||
: 0x80 \
|
||||
) ) )
|
||||
|
||||
/** Structure defining an audio format.
|
||||
* Providing the members as individual function arguments to define a certain
|
||||
* output format is easy enough. This struct makes is more comfortable to deal
|
||||
* with a list of formats.
|
||||
* Negative values for the members might be used to communicate use of default
|
||||
* values.
|
||||
*/
|
||||
struct mpg123_fmt
|
||||
{
|
||||
long rate; /**< sampling rate in Hz */
|
||||
int channels; /**< channel count */
|
||||
/** encoding code, can be single value or bitwise or of members of
|
||||
* mpg123_enc_enum */
|
||||
int encoding;
|
||||
};
|
||||
|
||||
/* @} */
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
1
ogg
1
ogg
@ -1 +0,0 @@
|
||||
Subproject commit 1e8d7cce266df61afc9d35db0283bbacc0237aba
|
1
opus
1
opus
@ -1 +0,0 @@
|
||||
Subproject commit 8aa7767207b1e3633004c26aecbb67d1c5118485
|
1
opusfile
1
opusfile
@ -1 +0,0 @@
|
||||
Subproject commit eb252537f374e30f7b68b84223c5a2303c05eca2
|
70
premake5.lua
70
premake5.lua
@ -2,21 +2,21 @@ newoption {
|
||||
trigger = "glewdir",
|
||||
value = "PATH",
|
||||
description = "Directory of GLEW",
|
||||
default = "glew-2.1.0"
|
||||
default = "vendor/glew-2.1.0"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "glfwdir64",
|
||||
value = "PATH",
|
||||
description = "Directory of glfw",
|
||||
default = "glfw-3.3.2.bin.WIN64",
|
||||
default = "vendor/glfw-3.3.2.bin.WIN64",
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "glfwdir32",
|
||||
value = "PATH",
|
||||
description = "Directory of glfw",
|
||||
default = "glfw-3.3.2.bin.WIN32",
|
||||
default = "vendor/glfw-3.3.2.bin.WIN32",
|
||||
}
|
||||
|
||||
newoption {
|
||||
@ -30,9 +30,9 @@ newoption {
|
||||
}
|
||||
|
||||
if(_OPTIONS["with-librw"]) then
|
||||
Librw = "librw"
|
||||
Librw = "vendor/librw"
|
||||
else
|
||||
Librw = os.getenv("LIBRW") or "librw"
|
||||
Librw = os.getenv("LIBRW") or "vendor/librw"
|
||||
end
|
||||
|
||||
function getsys(a)
|
||||
@ -77,6 +77,11 @@ workspace "reVC"
|
||||
"linux-arm-librw_gl3_glfw-oal",
|
||||
}
|
||||
|
||||
filter { "system:bsd" }
|
||||
platforms {
|
||||
"bsd-amd64-librw_gl3_glfw-oal"
|
||||
}
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "DEBUG" }
|
||||
|
||||
@ -90,6 +95,9 @@ workspace "reVC"
|
||||
filter { "platforms:linux*" }
|
||||
system "linux"
|
||||
|
||||
filter { "platforms:bsd*" }
|
||||
system "bsd"
|
||||
|
||||
filter { "platforms:*x86*" }
|
||||
architecture "x86"
|
||||
|
||||
@ -144,9 +152,14 @@ if(_OPTIONS["with-librw"]) then
|
||||
project "librw"
|
||||
kind "StaticLib"
|
||||
targetname "rw"
|
||||
targetdir "lib/%{cfg.platform}/%{cfg.buildcfg}"
|
||||
targetdir(path.join(Librw, "lib/%{cfg.platform}/%{cfg.buildcfg}"))
|
||||
files { path.join(Librw, "src/*.*") }
|
||||
files { path.join(Librw, "src/*/*.*") }
|
||||
|
||||
filter "platforms:bsd*"
|
||||
includedirs { "/usr/local/include" }
|
||||
libdirs { "/usr/local/lib" }
|
||||
|
||||
filter "platforms:*RW34*"
|
||||
flags { "ExcludeFromBuild" }
|
||||
filter {}
|
||||
@ -207,9 +220,9 @@ project "reVC"
|
||||
includedirs { "src/extras" }
|
||||
|
||||
if _OPTIONS["with-opus"] then
|
||||
includedirs { "ogg/include" }
|
||||
includedirs { "opus/include" }
|
||||
includedirs { "opusfile/include" }
|
||||
includedirs { "vendor/ogg/include" }
|
||||
includedirs { "vendor/opus/include" }
|
||||
includedirs { "vendor/opusfile/include" }
|
||||
end
|
||||
|
||||
filter "platforms:*mss"
|
||||
@ -219,9 +232,9 @@ project "reVC"
|
||||
|
||||
if _OPTIONS["with-opus"] then
|
||||
filter "platforms:win*"
|
||||
libdirs { "ogg/win32/VS2015/Win32/%{cfg.buildcfg}" }
|
||||
libdirs { "opus/win32/VS2015/Win32/%{cfg.buildcfg}" }
|
||||
libdirs { "opusfile/win32/VS2015/Win32/Release-NoHTTP" }
|
||||
libdirs { "vendor/ogg/win32/VS2015/Win32/%{cfg.buildcfg}" }
|
||||
libdirs { "vendor/opus/win32/VS2015/Win32/%{cfg.buildcfg}" }
|
||||
libdirs { "vendor/opusfile/win32/VS2015/Win32/Release-NoHTTP" }
|
||||
filter {}
|
||||
defines { "AUDIO_OPUS" }
|
||||
end
|
||||
@ -241,24 +254,26 @@ project "reVC"
|
||||
characterset ("MBCS")
|
||||
targetextension ".exe"
|
||||
|
||||
filter "platforms:win*oal"
|
||||
includedirs { "vendor/openal-soft/include" }
|
||||
includedirs { "vendor/libsndfile/include" }
|
||||
includedirs { "vendor/mpg123/include" }
|
||||
|
||||
filter "platforms:win-x86*oal"
|
||||
includedirs { "openal-soft/include" }
|
||||
includedirs { "libsndfile.32/include" }
|
||||
includedirs { "mpg123.32/include" }
|
||||
libdirs { "mpg123.32/lib" }
|
||||
libdirs { "libsndfile.32/lib" }
|
||||
libdirs { "openal-soft/libs/Win32" }
|
||||
libdirs { "vendor/mpg123/lib/Win32" }
|
||||
libdirs { "vendor/libsndfile/lib/Win32" }
|
||||
libdirs { "vendor/openal-soft/libs/Win32" }
|
||||
|
||||
filter "platforms:win-amd64*oal"
|
||||
includedirs { "openal-soft/include" }
|
||||
includedirs { "libsndfile.64/include" }
|
||||
includedirs { "mpg123.64/include" }
|
||||
libdirs { "mpg123.64/lib" }
|
||||
libdirs { "libsndfile.64/lib" }
|
||||
libdirs { "openal-soft/libs/Win64" }
|
||||
libdirs { "vendor/mpg123/lib/Win64" }
|
||||
libdirs { "vendor/libsndfile/lib/Win64" }
|
||||
libdirs { "vendor/openal-soft/libs/Win64" }
|
||||
|
||||
filter "platforms:linux*oal"
|
||||
links { "openal", "mpg123", "sndfile", "pthread" }
|
||||
|
||||
filter "platforms:bsd*oal"
|
||||
links { "openal", "mpg123", "sndfile", "pthread" }
|
||||
|
||||
if _OPTIONS["with-opus"] then
|
||||
filter {}
|
||||
@ -281,7 +296,7 @@ project "reVC"
|
||||
includedirs { "src/fakerw" }
|
||||
includedirs { Librw }
|
||||
if(_OPTIONS["with-librw"]) then
|
||||
libdirs { "lib/%{cfg.platform}/%{cfg.buildcfg}" }
|
||||
libdirs { "vendor/librw/lib/%{cfg.platform}/%{cfg.buildcfg}" }
|
||||
end
|
||||
links { "rw" }
|
||||
|
||||
@ -307,3 +322,8 @@ project "reVC"
|
||||
|
||||
filter "platforms:linux*gl3_glfw*"
|
||||
links { "GL", "GLEW", "glfw" }
|
||||
|
||||
filter "platforms:bsd*gl3_glfw*"
|
||||
links { "GL", "GLEW", "glfw", "sysinfo" }
|
||||
includedirs { "/usr/local/include" }
|
||||
libdirs { "/usr/local/lib" }
|
||||
|
@ -12,6 +12,7 @@ struct AnimBlendFrameData
|
||||
VELOCITY_EXTRACTION = 8,
|
||||
VELOCITY_EXTRACTION_3D = 0x10,
|
||||
UPDATE_KEYFRAMES = 0x20,
|
||||
UNK_COMPRESSED = 0x40,
|
||||
};
|
||||
|
||||
uint8 flag;
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
void RemoveAnimSequences(void);
|
||||
void Uncompress(void);
|
||||
void RemoveUncompressedData(void);
|
||||
bool IsCompressed() { return !!compressed; };
|
||||
};
|
||||
|
||||
VALIDATE_SIZE(CAnimBlendHierarchy, 0x28);
|
@ -19,6 +19,11 @@
|
||||
#include "RpAnimBlend.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "TempColModels.h"
|
||||
#include "ColStore.h"
|
||||
#include "Radar.h"
|
||||
#include "Pools.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
const struct {
|
||||
const char *szTrackName;
|
||||
@ -119,15 +124,22 @@ int32 CCutsceneMgr::ms_numCutsceneObjs;
|
||||
bool CCutsceneMgr::ms_loaded;
|
||||
bool CCutsceneMgr::ms_animLoaded;
|
||||
bool CCutsceneMgr::ms_useLodMultiplier;
|
||||
bool CCutsceneMgr::ms_camLoaded;
|
||||
char CCutsceneMgr::ms_cutsceneName[CUTSCENENAMESIZE];
|
||||
char CCutsceneMgr::ms_uncompressedAnims[8][32];
|
||||
uint32 CCutsceneMgr::ms_numUncompressedAnims;
|
||||
CAnimBlendAssocGroup CCutsceneMgr::ms_cutsceneAssociations;
|
||||
CVector CCutsceneMgr::ms_cutsceneOffset;
|
||||
float CCutsceneMgr::ms_cutsceneTimer;
|
||||
bool CCutsceneMgr::ms_wasCutsceneSkipped;
|
||||
uint32 CCutsceneMgr::ms_cutsceneLoadStatus;
|
||||
bool CCutsceneMgr::ms_useCutsceneShadows = true;
|
||||
|
||||
bool bCamLoaded;
|
||||
bool bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver; // pls don't shrink the name :P
|
||||
int32 NumberOfSavedWeapons;
|
||||
eWeaponType SavedWeaponIDs[TOTAL_WEAPON_SLOTS];
|
||||
int32 SavedWeaponAmmo[TOTAL_WEAPON_SLOTS];
|
||||
char uncompressedAnims[8][32];
|
||||
uint32 numUncompressedAnims;
|
||||
|
||||
|
||||
RpAtomic *
|
||||
CalculateBoundingSphereRadiusCB(RpAtomic *atomic, void *data)
|
||||
@ -151,15 +163,15 @@ CCutsceneMgr::Initialise(void)
|
||||
ms_loaded = false;
|
||||
ms_wasCutsceneSkipped = false;
|
||||
ms_running = false;
|
||||
ms_useLodMultiplier = false;
|
||||
ms_animLoaded = false;
|
||||
ms_cutsceneProcessing = false;
|
||||
ms_useLodMultiplier = false;
|
||||
|
||||
ms_pCutsceneDir = new CDirectory(CUTSCENEDIRSIZE);
|
||||
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
|
||||
|
||||
ms_numUncompressedAnims = 0;
|
||||
ms_uncompressedAnims[0][0] = '\0';
|
||||
numUncompressedAnims = 0;
|
||||
uncompressedAnims[0][0] = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
@ -178,9 +190,9 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||
|
||||
ms_cutsceneProcessing = true;
|
||||
ms_wasCutsceneSkipped = false;
|
||||
if (!strcasecmp(szCutsceneName, "jb"))
|
||||
ms_useLodMultiplier = true;
|
||||
CTimer::Suspend();
|
||||
if (!bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver)
|
||||
CStreaming::RemoveCurrentZonesModels();
|
||||
|
||||
ms_pCutsceneDir->numEntries = 0;
|
||||
ms_pCutsceneDir->ReadDirFile("ANIM\\CUTS.DIR");
|
||||
@ -200,7 +212,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||
CStreaming::MakeSpaceFor(size << 11);
|
||||
CStreaming::ImGonnaUseStreamingMemory();
|
||||
RwStreamSkip(stream, offset << 11);
|
||||
CAnimManager::LoadAnimFile(stream, true, ms_uncompressedAnims);
|
||||
CAnimManager::LoadAnimFile(stream, true, uncompressedAnims);
|
||||
ms_cutsceneAssociations.CreateAssociations(szCutsceneName);
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
ms_animLoaded = true;
|
||||
@ -217,9 +229,9 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
|
||||
CFileMgr::Seek(file, offset << 11, SEEK_SET);
|
||||
TheCamera.LoadPathSplines(file);
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
ms_camLoaded = true;
|
||||
bCamLoaded = true;
|
||||
} else {
|
||||
ms_camLoaded = false;
|
||||
bCamLoaded = false;
|
||||
}
|
||||
|
||||
CFileMgr::CloseFile(file);
|
||||
@ -252,7 +264,7 @@ void
|
||||
CCutsceneMgr::FinishCutscene()
|
||||
{
|
||||
ms_wasCutsceneSkipped = true;
|
||||
if (ms_camLoaded) {
|
||||
if (bCamLoaded) {
|
||||
CCutsceneMgr::ms_cutsceneTimer = TheCamera.GetCutSceneFinishTime() * 0.001f;
|
||||
TheCamera.FinishCutscene();
|
||||
}
|
||||
@ -264,7 +276,7 @@ CCutsceneMgr::FinishCutscene()
|
||||
void
|
||||
CCutsceneMgr::SetupCutsceneToStart(void)
|
||||
{
|
||||
if (ms_camLoaded) {
|
||||
if (bCamLoaded) {
|
||||
TheCamera.SetCamCutSceneOffSet(ms_cutsceneOffset);
|
||||
TheCamera.TakeControlWithSpline(JUMP_CUT);
|
||||
TheCamera.SetWideScreenOn();
|
||||
@ -276,7 +288,16 @@ CCutsceneMgr::SetupCutsceneToStart(void)
|
||||
assert(RwObjectGetType(ms_pCutsceneObjects[i]->m_rwObject) == rpCLUMP);
|
||||
if (CAnimBlendAssociation *pAnimBlendAssoc = RpAnimBlendClumpGetFirstAssociation((RpClump*)ms_pCutsceneObjects[i]->m_rwObject)) {
|
||||
assert(pAnimBlendAssoc->hierarchy->sequences[0].HasTranslation());
|
||||
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset + ((KeyFrameTrans*)pAnimBlendAssoc->hierarchy->sequences[0].GetKeyFrame(0))->translation);
|
||||
if (ms_pCutsceneObjects[i]->m_pAttachTo != nil) {
|
||||
pAnimBlendAssoc->flags &= (~ASSOC_HAS_TRANSLATION);
|
||||
} else {
|
||||
KeyFrameTrans* keyFrames;
|
||||
if (pAnimBlendAssoc->hierarchy->IsCompressed())
|
||||
keyFrames = ((KeyFrameTrans*)pAnimBlendAssoc->hierarchy->sequences[0].GetKeyFrameCompressed(0));
|
||||
else
|
||||
keyFrames = ((KeyFrameTrans*)pAnimBlendAssoc->hierarchy->sequences[0].GetKeyFrame(0));
|
||||
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset + keyFrames->translation);
|
||||
}
|
||||
pAnimBlendAssoc->SetRun();
|
||||
} else {
|
||||
ms_pCutsceneObjects[i]->SetPosition(ms_cutsceneOffset);
|
||||
@ -300,19 +321,31 @@ CCutsceneMgr::SetCutsceneAnim(const char *animName, CObject *pObject)
|
||||
CAnimBlendClumpData *pAnimBlendClumpData;
|
||||
|
||||
assert(RwObjectGetType(pObject->m_rwObject) == rpCLUMP);
|
||||
debug("Give cutscene anim %s\n", animName);
|
||||
RpAnimBlendClumpRemoveAllAssociations((RpClump*)pObject->m_rwObject);
|
||||
|
||||
pNewAnim = ms_cutsceneAssociations.CopyAnimation(animName);
|
||||
pNewAnim = ms_cutsceneAssociations.GetAnimation(animName);
|
||||
if (!pNewAnim) {
|
||||
debug("\n\nHaven't I told you I can't find the fucking animation %s\n\n\n", animName);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pNewAnim->hierarchy->IsCompressed())
|
||||
pNewAnim->hierarchy->compressed2 = true;
|
||||
|
||||
CStreaming::ImGonnaUseStreamingMemory();
|
||||
pNewAnim = ms_cutsceneAssociations.CopyAnimation(animName);
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
|
||||
pNewAnim->SetCurrentTime(0.0f);
|
||||
pNewAnim->flags |= ASSOC_HAS_TRANSLATION;
|
||||
pNewAnim->flags &= ~ASSOC_RUNNING;
|
||||
|
||||
pAnimBlendClumpData = *RPANIMBLENDCLUMPDATA(pObject->m_rwObject);
|
||||
pAnimBlendClumpData->link.Prepend(&pNewAnim->link);
|
||||
|
||||
if (pNewAnim->hierarchy->compressed2)
|
||||
pAnimBlendClumpData->frames->flag |= AnimBlendFrameData::UNK_COMPRESSED;
|
||||
}
|
||||
|
||||
void
|
||||
@ -327,25 +360,42 @@ CCutsceneMgr::AddCutsceneHead(CObject *pObject, int modelId)
|
||||
return nil;
|
||||
}
|
||||
|
||||
void UpdateCutsceneObjectBoundingBox(RpClump* clump, int modelId)
|
||||
{
|
||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
|
||||
CColModel* pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
|
||||
float radius = 0.0f;
|
||||
RpClumpForAllAtomics(clump, CalculateBoundingSphereRadiusCB, &radius);
|
||||
pColModel->boundingSphere.radius = radius;
|
||||
pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
|
||||
pColModel->boundingBox.max = CVector(radius, radius, radius);
|
||||
}
|
||||
}
|
||||
|
||||
CCutsceneObject *
|
||||
CCutsceneMgr::CreateCutsceneObject(int modelId)
|
||||
{
|
||||
CBaseModelInfo *pModelInfo;
|
||||
CColModel *pColModel;
|
||||
float radius;
|
||||
RpClump *clump;
|
||||
CCutsceneObject *pCutsceneObject;
|
||||
|
||||
CStreaming::ImGonnaUseStreamingMemory();
|
||||
debug("Created cutscene object %s\n", CModelInfo::GetModelInfo(modelId)->GetName());
|
||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05) {
|
||||
pModelInfo = CModelInfo::GetModelInfo(modelId);
|
||||
pColModel = &CTempColModels::ms_colModelCutObj[modelId - MI_CUTOBJ01];
|
||||
radius = 0.0f;
|
||||
|
||||
pModelInfo->SetColModel(pColModel);
|
||||
clump = (RpClump*)pModelInfo->GetRwObject();
|
||||
assert(RwObjectGetType((RwObject*)clump) == rpCLUMP);
|
||||
RpClumpForAllAtomics(clump, CalculateBoundingSphereRadiusCB, &radius);
|
||||
|
||||
UpdateCutsceneObjectBoundingBox((RpClump*)pModelInfo->GetRwObject(), modelId);
|
||||
} else if (modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL21) {
|
||||
pModelInfo = CModelInfo::GetModelInfo(modelId);
|
||||
if (pModelInfo->GetColModel() == &CTempColModels::ms_colModelPed1) {
|
||||
CColModel *colModel = new CColModel();
|
||||
colModel->boundingSphere.radius = 2.0f;
|
||||
colModel->boundingSphere.center = CVector(0.0f, 0.0f, 0.0f);
|
||||
pModelInfo->SetColModel(colModel, true);
|
||||
}
|
||||
pColModel = pModelInfo->GetColModel();
|
||||
float radius = 2.0f;
|
||||
pColModel->boundingSphere.radius = radius;
|
||||
pColModel->boundingBox.min = CVector(-radius, -radius, -radius);
|
||||
pColModel->boundingBox.max = CVector(radius, radius, radius);
|
||||
@ -353,7 +403,10 @@ CCutsceneMgr::CreateCutsceneObject(int modelId)
|
||||
|
||||
pCutsceneObject = new CCutsceneObject();
|
||||
pCutsceneObject->SetModelIndex(modelId);
|
||||
if (ms_useCutsceneShadows)
|
||||
pCutsceneObject->CreateShadow();
|
||||
ms_pCutsceneObjects[ms_numCutsceneObjs++] = pCutsceneObject;
|
||||
CStreaming::IHaveUsedStreamingMemory();
|
||||
return pCutsceneObject;
|
||||
}
|
||||
|
||||
@ -365,6 +418,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
|
||||
|
||||
ms_cutsceneProcessing = false;
|
||||
ms_useLodMultiplier = false;
|
||||
ms_useCutsceneShadows = true;
|
||||
|
||||
for (--ms_numCutsceneObjs; ms_numCutsceneObjs >= 0; ms_numCutsceneObjs--) {
|
||||
CWorld::Remove(ms_pCutsceneObjects[ms_numCutsceneObjs]);
|
||||
@ -374,14 +428,23 @@ CCutsceneMgr::DeleteCutsceneData(void)
|
||||
}
|
||||
ms_numCutsceneObjs = 0;
|
||||
|
||||
for (int i = MI_SPECIAL01; i < MI_SPECIAL21; i++) {
|
||||
CBaseModelInfo *minfo = CModelInfo::GetModelInfo(i);
|
||||
CColModel *colModel = minfo->GetColModel();
|
||||
if (colModel != &CTempColModels::ms_colModelPed1) {
|
||||
delete colModel;
|
||||
minfo->SetColModel(&CTempColModels::ms_colModelPed1);
|
||||
}
|
||||
}
|
||||
|
||||
if (ms_animLoaded)
|
||||
CAnimManager::RemoveLastAnimFile();
|
||||
|
||||
ms_animLoaded = false;
|
||||
ms_numUncompressedAnims = 0;
|
||||
ms_uncompressedAnims[0][0] = '\0';
|
||||
numUncompressedAnims = 0;
|
||||
uncompressedAnims[0][0] = '\0';
|
||||
|
||||
if (ms_camLoaded) {
|
||||
if (bCamLoaded) {
|
||||
TheCamera.RestoreWithJumpCut();
|
||||
TheCamera.SetWideScreenOff();
|
||||
TheCamera.DeleteCutSceneCamDataMemory();
|
||||
@ -397,10 +460,37 @@ CCutsceneMgr::DeleteCutsceneData(void)
|
||||
DMAudio.StopCutSceneMusic();
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||
}
|
||||
|
||||
CStreaming::ms_disableStreaming = false;
|
||||
CWorld::bProcessCutsceneOnly = false;
|
||||
|
||||
if(bCamLoaded)
|
||||
CGame::DrasticTidyUpMemory(TheCamera.GetScreenFadeStatus() == FADE_2);
|
||||
|
||||
if(ms_camLoaded)
|
||||
CGame::DrasticTidyUpMemory(TheCamera.GetScreenFadeStatus() == 2);
|
||||
|
||||
CPad::GetPad(0)->Clear(false);
|
||||
if (bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver) {
|
||||
CStreaming::LoadInitialPeds();
|
||||
CStreaming::LoadInitialWeapons();
|
||||
CStreaming::LoadInitialVehicles();
|
||||
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = false;
|
||||
|
||||
CPlayerPed *pPlayerPed = FindPlayerPed();
|
||||
for (int i = 0; i < NumberOfSavedWeapons; i++) {
|
||||
int32 weaponModelId = CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModelId;
|
||||
uint8 flags = CStreaming::ms_aInfoForModel[weaponModelId].m_flags;
|
||||
CStreaming::RequestModel(weaponModelId, STREAMFLAGS_DONT_REMOVE);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
if (CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id != -1) {
|
||||
CStreaming::RequestModel(CWeaponInfo::GetWeaponInfo(SavedWeaponIDs[i])->m_nModel2Id, 0);
|
||||
CStreaming::LoadAllRequestedModels(false);
|
||||
}
|
||||
if (!(flags & STREAMFLAGS_DONT_REMOVE))
|
||||
CStreaming::SetModelIsDeletable(weaponModelId);
|
||||
pPlayerPed->GiveWeapon(SavedWeaponIDs[i], SavedWeaponAmmo[i], true);
|
||||
}
|
||||
NumberOfSavedWeapons = 0;
|
||||
}
|
||||
|
||||
CTimer::Resume();
|
||||
}
|
||||
|
||||
@ -437,26 +527,156 @@ CCutsceneMgr::Update(void)
|
||||
|
||||
ms_cutsceneTimer += CTimer::GetTimeStepNonClippedInSeconds();
|
||||
|
||||
if (ms_camLoaded)
|
||||
for (int i = 0; i < ms_numCutsceneObjs; i++) {
|
||||
int modelId = ms_pCutsceneObjects[i]->GetModelIndex();
|
||||
if (modelId >= MI_CUTOBJ01 && modelId <= MI_CUTOBJ05)
|
||||
UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId);
|
||||
|
||||
if (ms_pCutsceneObjects[i]->m_pAttachTo != nil && modelId >= MI_SPECIAL01 && modelId <= MI_SPECIAL21)
|
||||
UpdateCutsceneObjectBoundingBox(ms_pCutsceneObjects[i]->GetClump(), modelId);
|
||||
}
|
||||
|
||||
if (bCamLoaded)
|
||||
if (CGeneral::faststricmp(ms_cutsceneName, "finale") && TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_FLYBY && ms_cutsceneLoadStatus == CUTSCENE_LOADING_0) {
|
||||
if (CPad::GetPad(0)->GetCrossJustDown()
|
||||
|| (CGame::playingIntro && CPad::GetPad(0)->GetStartJustDown())
|
||||
|| CPad::GetPad(0)->GetLeftMouseJustDown()
|
||||
|| CPad::GetPad(0)->GetEnterJustDown()
|
||||
|| CPad::GetPad(0)->GetCharJustDown(' '))
|
||||
FinishCutscene();
|
||||
FinishCutscene();
|
||||
}
|
||||
}
|
||||
|
||||
bool CCutsceneMgr::HasCutsceneFinished(void) { return !ms_camLoaded || TheCamera.GetPositionAlongSpline() == 1.0f; }
|
||||
bool CCutsceneMgr::HasCutsceneFinished(void) { return !bCamLoaded || TheCamera.GetPositionAlongSpline() == 1.0f; }
|
||||
|
||||
void
|
||||
CCutsceneMgr::LoadAnimationUncompressed(char const* name)
|
||||
{
|
||||
strcpy(ms_uncompressedAnims[ms_numUncompressedAnims], name);
|
||||
strcpy(uncompressedAnims[numUncompressedAnims], name);
|
||||
|
||||
// Because that's how CAnimManager knows the end of array
|
||||
++ms_numUncompressedAnims;
|
||||
assert(ms_numUncompressedAnims < ARRAY_SIZE(ms_uncompressedAnims));
|
||||
ms_uncompressedAnims[ms_numUncompressedAnims][0] = '\0';
|
||||
++numUncompressedAnims;
|
||||
assert(numUncompressedAnims < ARRAY_SIZE(uncompressedAnims));
|
||||
uncompressedAnims[numUncompressedAnims][0] = '\0';
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::AttachObjectToParent(CObject *pObject, CEntity *pAttachTo)
|
||||
{
|
||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = nil;
|
||||
((CCutsceneObject*)pObject)->m_pAttachTo = RpClumpGetFrame(pAttachTo->GetClump());
|
||||
|
||||
debug("Attach %s to %s\n", CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetName(), CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetName());
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame)
|
||||
{
|
||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = nil;
|
||||
((CCutsceneObject*)pObject)->m_pAttachTo = RpAnimBlendClumpFindFrame(pAttachTo->GetClump(), frame)->frame;
|
||||
debug("Attach %s to component %s of %s\n",
|
||||
CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetName(),
|
||||
frame,
|
||||
CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetName());
|
||||
if (RwObjectGetType(pObject->m_rwObject) == rpCLUMP) {
|
||||
RpClump *clump = (RpClump*)pObject->m_rwObject;
|
||||
if (IsClumpSkinned(clump))
|
||||
RpAtomicGetBoundingSphere(GetFirstAtomic(clump))->radius *= 1.1f;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int bone)
|
||||
{
|
||||
RpHAnimHierarchy *hanim = GetAnimHierarchyFromSkinClump(pAttachTo->GetClump());
|
||||
RwInt32 id = RpHAnimIDGetIndex(hanim, bone);
|
||||
RwMatrix *matrixArray = RpHAnimHierarchyGetMatrixArray(hanim);
|
||||
((CCutsceneObject*)pObject)->m_pAttachmentObject = pAttachTo;
|
||||
((CCutsceneObject*)pObject)->m_pAttachTo = &matrixArray[id];
|
||||
debug("Attach %s to %s\n",
|
||||
CModelInfo::GetModelInfo(pObject->GetModelIndex())->GetName(),
|
||||
CModelInfo::GetModelInfo(pAttachTo->GetModelIndex())->GetName());
|
||||
}
|
||||
|
||||
void
|
||||
CCutsceneMgr::RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver()
|
||||
{
|
||||
CStreaming::ms_disableStreaming = true;
|
||||
CColStore::RemoveAllCollision();
|
||||
CWorld::bProcessCutsceneOnly = true;
|
||||
ms_cutsceneProcessing = true;
|
||||
|
||||
for (int i = CPools::GetPedPool()->GetSize() - 1; i >= 0; i--) {
|
||||
CPed *pPed = CPools::GetPedPool()->GetSlot(i);
|
||||
if (pPed) {
|
||||
if (!pPed->IsPlayer() && pPed->CanBeDeleted()) {
|
||||
CWorld::Remove(pPed);
|
||||
delete pPed;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = CPools::GetVehiclePool()->GetSize() - 1; i >= 0; i--) {
|
||||
CVehicle *pVehicle = CPools::GetVehiclePool()->GetSlot(i);
|
||||
if (pVehicle) {
|
||||
if (pVehicle->CanBeDeleted()) {
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bIsEverythingRemovedFromTheWorldForTheBiggestFuckoffCutsceneEver = true;
|
||||
CStreaming::RemoveCurrentZonesModels();
|
||||
CStreaming::SetModelIsDeletable(MI_MALE01);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_MALE01);
|
||||
CStreaming::SetModelIsDeletable(MI_HMOCA);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_HMOCA);
|
||||
CStreaming::SetModelIsDeletable(MI_NIGHTSTICK);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_NIGHTSTICK);
|
||||
CStreaming::SetModelIsDeletable(MI_MISSILE);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_MISSILE);
|
||||
CStreaming::SetModelIsDeletable(MI_POLICE);
|
||||
CStreaming::SetModelTxdIsDeletable(MI_POLICE);
|
||||
|
||||
while (CStreaming::RemoveLoadedVehicle()) ;
|
||||
|
||||
CRadar::RemoveRadarSections();
|
||||
|
||||
for (int i = CPools::GetDummyPool()->GetSize() - 1; i >= 0; i--) {
|
||||
CDummy* pDummy = CPools::GetDummyPool()->GetSlot(i);
|
||||
if (pDummy)
|
||||
pDummy->DeleteRwObject();
|
||||
}
|
||||
|
||||
for (int i = CPools::GetObjectPool()->GetSize() - 1; i >= 0; i--) {
|
||||
CObject* pObject = CPools::GetObjectPool()->GetSlot(i);
|
||||
if (pObject)
|
||||
pObject->DeleteRwObject();
|
||||
}
|
||||
|
||||
for (int i = CPools::GetBuildingPool()->GetSize() - 1; i >= 0; i--) {
|
||||
CBuilding* pBuilding = CPools::GetBuildingPool()->GetSlot(i);
|
||||
if (pBuilding && pBuilding->GetClump() != nil && pBuilding->bIsBIGBuilding && pBuilding->bStreamBIGBuilding) {
|
||||
if (pBuilding->bIsBIGBuilding)
|
||||
CStreaming::RequestModel(pBuilding->GetModelIndex(), 0);
|
||||
if (!pBuilding->bImBeingRendered)
|
||||
pBuilding->DeleteRwObject();
|
||||
}
|
||||
}
|
||||
|
||||
CPlayerPed *pPlayerPed = FindPlayerPed();
|
||||
pPlayerPed->RemoveWeaponAnims(0, -1000.0f);
|
||||
NumberOfSavedWeapons = 0;
|
||||
|
||||
for (int i = 0; i < TOTAL_WEAPON_SLOTS; i++) {
|
||||
if (pPlayerPed->m_weapons[i].m_eWeaponType != WEAPONTYPE_UNARMED) {
|
||||
SavedWeaponIDs[NumberOfSavedWeapons] = pPlayerPed->m_weapons[i].m_eWeaponType;
|
||||
SavedWeaponAmmo[NumberOfSavedWeapons] = pPlayerPed->m_weapons[i].m_nAmmoTotal;
|
||||
NumberOfSavedWeapons++;
|
||||
}
|
||||
}
|
||||
|
||||
pPlayerPed->ClearWeapons();
|
||||
CGame::DrasticTidyUpMemory(true);
|
||||
}
|
@ -17,15 +17,13 @@ class CCutsceneMgr
|
||||
static bool ms_animLoaded;
|
||||
static bool ms_useLodMultiplier;
|
||||
|
||||
static bool ms_camLoaded;
|
||||
static char ms_cutsceneName[CUTSCENENAMESIZE];
|
||||
static char ms_uncompressedAnims[8][32];
|
||||
static uint32 ms_numUncompressedAnims;
|
||||
static CAnimBlendAssocGroup ms_cutsceneAssociations;
|
||||
static CVector ms_cutsceneOffset;
|
||||
static float ms_cutsceneTimer;
|
||||
static bool ms_wasCutsceneSkipped;
|
||||
static bool ms_cutsceneProcessing;
|
||||
static bool ms_useCutsceneShadows;
|
||||
public:
|
||||
static CDirectory *ms_pCutsceneDir;
|
||||
static uint32 ms_cutsceneLoadStatus;
|
||||
@ -54,4 +52,9 @@ public:
|
||||
static void DeleteCutsceneData(void);
|
||||
static void LoadAnimationUncompressed(char const*);
|
||||
static void Update(void);
|
||||
|
||||
static void AttachObjectToParent(CObject *pObject, CEntity *pAttachTo);
|
||||
static void AttachObjectToFrame(CObject *pObject, CEntity *pAttachTo, const char *frame);
|
||||
static void AttachObjectToBone(CObject *pObject, CObject *pAttachTo, int frame);
|
||||
static void RemoveEverythingFromTheWorldForTheBiggestFuckoffCutsceneEver();
|
||||
};
|
||||
|
@ -2756,7 +2756,6 @@ cAudioManager::ProcessPlane(cVehicleParams *params)
|
||||
ProcessCesna(params);
|
||||
break;
|
||||
default:
|
||||
debug("Plane Model Id is %d\n, ", params->m_pVehicle->GetModelIndex());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,16 @@
|
||||
#include "Pools.h"
|
||||
#include "DMAudio.h"
|
||||
|
||||
cAudioScriptObject::cAudioScriptObject()
|
||||
{
|
||||
Reset();
|
||||
};
|
||||
|
||||
cAudioScriptObject::~cAudioScriptObject()
|
||||
{
|
||||
Reset();
|
||||
};
|
||||
|
||||
void
|
||||
cAudioScriptObject::Reset()
|
||||
{
|
||||
|
@ -7,6 +7,9 @@ public:
|
||||
CVector Posn;
|
||||
int32 AudioEntity;
|
||||
|
||||
cAudioScriptObject();
|
||||
~cAudioScriptObject();
|
||||
|
||||
void Reset(); /// ok
|
||||
|
||||
static void* operator new(size_t);
|
||||
|
@ -247,7 +247,7 @@ cDMAudio::ReportCrime(eCrimeType crime, const CVector &pos)
|
||||
int32
|
||||
cDMAudio::CreateLoopingScriptObject(cAudioScriptObject *scriptObject)
|
||||
{
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, (CPhysical *)scriptObject);
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
||||
|
||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||
AudioManager.SetEntityStatus(audioEntity, true);
|
||||
@ -264,7 +264,7 @@ cDMAudio::DestroyLoopingScriptObject(int32 audioEntity)
|
||||
void
|
||||
cDMAudio::CreateOneShotScriptObject(cAudioScriptObject *scriptObject)
|
||||
{
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, (CPhysical *)scriptObject);
|
||||
int32 audioEntity = AudioManager.CreateEntity(AUDIOTYPE_SCRIPTOBJECT, scriptObject);
|
||||
|
||||
if ( AEHANDLE_IS_OK(audioEntity) )
|
||||
{
|
||||
|
@ -12,7 +12,8 @@ enum eRadioStation
|
||||
EMOTION,
|
||||
WAVE,
|
||||
USERTRACK,
|
||||
POLICE_RADIO,
|
||||
NUM_RADIOS = 10,
|
||||
POLICE_RADIO = 10,
|
||||
//TAXI_RADIO,
|
||||
RADIO_OFF,
|
||||
};
|
||||
|
@ -587,16 +587,16 @@ cSampleManager::Initialise(void)
|
||||
}
|
||||
|
||||
nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = (uintptr)malloc(nSampleBankSize[SAMPLEBANK_MAIN]);
|
||||
ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != NULL);
|
||||
ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0);
|
||||
|
||||
if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == NULL )
|
||||
if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == 0 )
|
||||
{
|
||||
Terminate();
|
||||
return false;
|
||||
}
|
||||
|
||||
nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX);
|
||||
ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != NULL);
|
||||
ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -146,9 +146,9 @@ enum eSound : uint16
|
||||
SOUND_PED_LEAVE_VEHICLE,
|
||||
SOUND_PED_EVADE,
|
||||
SOUND_PED_FLEE_RUN,
|
||||
SOUND_PED_CAR_COLLISION,
|
||||
SOUND_PED_BOAT_COLLISION,
|
||||
SOUND_PED_HORN_ACTIVE,
|
||||
SOUND_PED_CRASH_VEHICLE,
|
||||
SOUND_PED_CRASH_CAR,
|
||||
SOUND_PED_ANNOYED_DRIVER,
|
||||
SOUND_PED_147,
|
||||
SOUND_PED_SOLICIT,
|
||||
SOUND_PED_149,
|
||||
|
@ -81,6 +81,9 @@
|
||||
#define OFFSCREEN_DESPAWN_RANGE (40.0f)
|
||||
#define EXTENDED_RANGE_DESPAWN_MULTIPLIER (1.5f)
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
bool CCarCtrl::bMadDriversCheat;
|
||||
int CCarCtrl::NumLawEnforcerCars;
|
||||
int CCarCtrl::NumAmbulancesOnDuty;
|
||||
int CCarCtrl::NumFiretrucksOnDuty;
|
||||
@ -158,7 +161,7 @@ CCarCtrl::GenerateOneRandomCar()
|
||||
carModel = ChoosePoliceCarModel();
|
||||
}else{
|
||||
carModel = ChooseModel(&zone, &vecTargetPos, &carClass);
|
||||
if (carClass == COPS && pWanted->m_nWantedLevel >= 1 || carModel < 0)
|
||||
if (carModel == -1 || (carClass == COPS && pWanted->m_nWantedLevel >= 1))
|
||||
/* All cop spawns with wanted level are handled by condition above. */
|
||||
/* In particular it means that cop cars never spawn if player has wanted level of 1. */
|
||||
return;
|
||||
@ -664,7 +667,7 @@ CCarCtrl::GenerateOneRandomCar()
|
||||
nMadDrivers = 6;
|
||||
break;
|
||||
}
|
||||
if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers /* TODO(MIAMI): || mad drivers cheat */) {
|
||||
if ((CGeneral::GetRandomNumber() & 0x7F) < nMadDrivers || bMadDriversCheat) {
|
||||
pVehicle->SetStatus(STATUS_PHYSICS);
|
||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
|
||||
pVehicle->AutoPilot.m_nCruiseSpeed += 10;
|
||||
@ -758,7 +761,8 @@ CCarCtrl::ChooseCarRating(CZoneInfo* pZoneInfo)
|
||||
int32
|
||||
CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) {
|
||||
int32 model = -1;
|
||||
for (int i = 0; i < 10 && (model == -1 || !CStreaming::HasModelLoaded(model)); i++) {
|
||||
int32 i;
|
||||
for (i = 10; i > 0 && (model == -1 || !CStreaming::HasModelLoaded(model)); i--) {
|
||||
int rnd = CGeneral::GetRandomNumberInRange(0, 1000);
|
||||
|
||||
if (rnd < pZone->copThreshold) {
|
||||
@ -767,9 +771,9 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int j;
|
||||
int32 j;
|
||||
for (j = 0; j < NUM_GANG_CAR_CLASSES; j++) {
|
||||
if (rnd < pZone->gangThreshold[i]) {
|
||||
if (rnd < pZone->gangThreshold[j]) {
|
||||
*pClass = j + FIRST_GANG_CAR_RATING;
|
||||
model = ChooseGangCarModel(j);
|
||||
break;
|
||||
@ -782,6 +786,8 @@ CCarCtrl::ChooseModel(CZoneInfo* pZone, CVector* pPos, int* pClass) {
|
||||
*pClass = ChooseCarRating(pZone);
|
||||
model = ChooseCarModel(*pClass);
|
||||
}
|
||||
if (i == 0)
|
||||
return -1;
|
||||
return model;
|
||||
}
|
||||
|
||||
@ -950,6 +956,10 @@ CCarCtrl::RemoveCarsIfThePoolGetsFull(void)
|
||||
void
|
||||
CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
|
||||
{
|
||||
#ifdef FIX_BUGS
|
||||
if (pVehicle->bIsLocked)
|
||||
return;
|
||||
#endif
|
||||
CVector vecPlayerPos = FindPlayerCentreOfWorld(CWorld::PlayerInFocus);
|
||||
/* BUG: this variable is initialized only in if-block below but can be used outside of it. */
|
||||
if (!IsThisVehicleInteresting(pVehicle) && !pVehicle->bIsLocked &&
|
||||
@ -2515,7 +2525,7 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
|
||||
SteerAIBoatWithPhysicsAttackingPlayer(pVehicle, pSwerve, pAccel, pBrake, pHandbrake);
|
||||
return;
|
||||
case MISSION_PLANE_FLYTOCOORS:
|
||||
//SteerAIPlaneTowardsTargetCoors((CAutomobile*)pVehicle);
|
||||
SteerAIPlaneTowardsTargetCoors((CAutomobile*)pVehicle);
|
||||
return;
|
||||
case MISSION_SLOWLY_DRIVE_TOWARDS_PLAYER_1:
|
||||
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil,
|
||||
@ -2737,6 +2747,51 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
|
||||
pHeli->GetMatrix().GetUp() = up;
|
||||
}
|
||||
|
||||
void CCarCtrl::SteerAIPlaneTowardsTargetCoors(CAutomobile* pPlane)
|
||||
{
|
||||
CVector2D vecToTarget = pPlane->AutoPilot.m_vecDestinationCoors - pPlane->GetPosition();
|
||||
float fForwardZ = (pPlane->AutoPilot.m_vecDestinationCoors.z - pPlane->GetPosition().z) / vecToTarget.Magnitude();
|
||||
fForwardZ = clamp(fForwardZ, -0.3f, 0.3f);
|
||||
float angle = CGeneral::GetATanOfXY(vecToTarget.x, vecToTarget.y);
|
||||
while (angle > TWOPI)
|
||||
angle -= TWOPI;
|
||||
float difference = LimitRadianAngle(angle - pPlane->m_fOrientation);
|
||||
float steer = difference > 0.0f ? 0.04f : -0.04f;
|
||||
if (Abs(difference) < 0.2f)
|
||||
steer *= 5.0f * Abs(difference);
|
||||
pPlane->m_fPlaneSteer *= Pow(0.96f, CTimer::GetTimeStep());
|
||||
float steerChange = steer - pPlane->m_fPlaneSteer;
|
||||
float maxChange = 0.003f * CTimer::GetTimeStep();
|
||||
if (Abs(steerChange) < maxChange)
|
||||
pPlane->m_fPlaneSteer = steer;
|
||||
else if (steerChange < 0.0f)
|
||||
pPlane->m_fPlaneSteer -= maxChange;
|
||||
else
|
||||
pPlane->m_fPlaneSteer += maxChange;
|
||||
pPlane->m_fOrientation += pPlane->m_fPlaneSteer * CTimer::GetTimeStep();
|
||||
CVector up(0.0f, 0.0f, 1.0f);
|
||||
up.Normalise();
|
||||
CVector forward(Cos(pPlane->m_fOrientation), Sin(pPlane->m_fOrientation), fForwardZ);
|
||||
forward.Normalise();
|
||||
CVector right = CrossProduct(forward, up);
|
||||
right.z -= 5.0f * pPlane->m_fPlaneSteer;
|
||||
right.Normalise();
|
||||
up = CrossProduct(forward, right);
|
||||
up.Normalise();
|
||||
right = CrossProduct(forward, up);
|
||||
pPlane->GetMatrix().GetRight() = right;
|
||||
pPlane->GetMatrix().GetForward() = forward;
|
||||
pPlane->GetMatrix().GetUp() = up;
|
||||
float newSplit = 1.0f - Pow(0.95f, CTimer::GetTimeStep());
|
||||
float oldSplit = 1.0f - newSplit;
|
||||
#ifdef FIX_BUGS
|
||||
pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.GetCruiseSpeed() * 0.01f * forward * newSplit;
|
||||
#else
|
||||
pPlane->m_vecMoveSpeed = pPlane->m_vecMoveSpeed * oldSplit + pPlane->AutoPilot.m_nCruiseSpeed * 0.01f * forward * newSplit;
|
||||
#endif
|
||||
pPlane->m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerve, float* pAccel, float* pBrake, bool* pHandbrake)
|
||||
{
|
||||
CVector2D forward = pVehicle->GetForward();
|
||||
|
@ -145,6 +145,7 @@ public:
|
||||
return angle;
|
||||
}
|
||||
|
||||
static bool bMadDriversCheat;
|
||||
static int32 NumLawEnforcerCars;
|
||||
static int32 NumAmbulancesOnDuty;
|
||||
static int32 NumFiretrucksOnDuty;
|
||||
|
@ -32,9 +32,9 @@ int8 CDarkel::InterruptedWeapon;
|
||||
* makes game handle sounds & messages instead of SCM (just like in GTA2)
|
||||
* but it's never been used in the game. Has unused sliding text when frenzy completed etc.
|
||||
*/
|
||||
int8 CDarkel::bStandardSoundAndMessages;
|
||||
int8 CDarkel::bNeedHeadShot;
|
||||
int8 CDarkel::bProperKillFrenzy;
|
||||
bool CDarkel::bStandardSoundAndMessages;
|
||||
bool CDarkel::bNeedHeadShot;
|
||||
bool CDarkel::bProperKillFrenzy;
|
||||
uint16 CDarkel::Status;
|
||||
uint16 CDarkel::RegisteredKills[NUM_DEFAULT_MODELS];
|
||||
int32 CDarkel::ModelToKill;
|
||||
|
@ -24,9 +24,9 @@ private:
|
||||
static int32 AmmoInterruptedWeapon;
|
||||
static int32 KillsNeeded;
|
||||
static int8 InterruptedWeapon;
|
||||
static int8 bStandardSoundAndMessages;
|
||||
static int8 bNeedHeadShot;
|
||||
static int8 bProperKillFrenzy;
|
||||
static bool bStandardSoundAndMessages;
|
||||
static bool bNeedHeadShot;
|
||||
static bool bProperKillFrenzy;
|
||||
static uint16 Status;
|
||||
static uint16 RegisteredKills[NUM_DEFAULT_MODELS];
|
||||
static int32 ModelToKill;
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "Particle.h"
|
||||
#include "ColStore.h"
|
||||
#include "Automobile.h"
|
||||
#include "MBlur.h"
|
||||
|
||||
uint8 CGameLogic::ActivePlayers;
|
||||
uint8 CGameLogic::ShortCutState;
|
||||
@ -343,7 +344,10 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector
|
||||
pPlayerPed->bIsVisible = true;
|
||||
pPlayerPed->m_bloodyFootprintCountOrDeathTime = 0;
|
||||
pPlayerPed->bDoBloodyFootprints = false;
|
||||
//TODO(MIAMI): clear drunk stuff
|
||||
pPlayerPed->m_nDrunkenness = 0;
|
||||
pPlayerPed->m_nFadeDrunkenness = 0;
|
||||
CMBlur::ClearDrunkBlur();
|
||||
pPlayerPed->m_nDrunkCountdown = 0;
|
||||
pPlayerPed->ClearAdrenaline();
|
||||
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
|
||||
if (pPlayerPed->m_pFire)
|
||||
@ -368,7 +372,7 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector
|
||||
CWorld::ClearExcitingStuffFromArea(pos, 4000.0, 1);
|
||||
pPlayerPed->RestoreHeadingRate();
|
||||
CGame::currArea = AREA_MAIN_MAP;
|
||||
//CStreaming::RemoveBuildingsNotInArea(0); // TODO(MIAMI)
|
||||
CStreaming::RemoveBuildingsNotInArea(0);
|
||||
TheCamera.SetCameraDirectlyInFrontForFollowPed_CamOnAString();
|
||||
TheCamera.Restore();
|
||||
CReferences::RemoveReferencesToPlayer();
|
||||
|
@ -1324,7 +1324,7 @@ void CGarage::RemoveCarsBlockingDoorNotInside()
|
||||
if (!IsEntityTouching3D(pVehicle))
|
||||
continue;
|
||||
if (!IsPointInsideGarage(pVehicle->GetPosition())) {
|
||||
if (pVehicle->bIsLocked && pVehicle->CanBeDeleted()) {
|
||||
if (!pVehicle->bIsLocked && pVehicle->CanBeDeleted()) {
|
||||
CWorld::Remove(pVehicle);
|
||||
delete pVehicle;
|
||||
return; // WHY?
|
||||
@ -1817,8 +1817,9 @@ CVehicle* CStoredCar::RestoreCar()
|
||||
pVehicle->m_nRadioStation = m_nRadioStation;
|
||||
pVehicle->bFreebies = false;
|
||||
#ifdef FIX_BUGS
|
||||
((CAutomobile*)pVehicle)->m_bombType = m_nCarBombType;
|
||||
if (pVehicle->IsCar())
|
||||
#endif
|
||||
((CAutomobile*)pVehicle)->m_bombType = m_nCarBombType;
|
||||
pVehicle->bHasBeenOwnedByPlayer = true;
|
||||
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
|
||||
pVehicle->bBulletProof = m_bBulletproof;
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "PlayerInfo.h"
|
||||
#include "Vehicle.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
void
|
||||
CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uint16 model)
|
||||
{
|
||||
@ -35,17 +37,24 @@ CRemote::GivePlayerRemoteControlledCar(float x, float y, float z, float rot, uin
|
||||
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = car;
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->RegisterReference((CEntity**)&CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle);
|
||||
TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT);
|
||||
if (car->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE || car->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI) {
|
||||
TheCamera.TakeControl(car, CCam::MODE_CAM_ON_A_STRING, INTERPOLATION, CAMCONTROL_SCRIPT);
|
||||
TheCamera.SetZoomValueCamStringScript(0);
|
||||
} else
|
||||
TheCamera.TakeControl(car, CCam::MODE_BEHINDCAR, INTERPOLATION, CAMCONTROL_SCRIPT);
|
||||
}
|
||||
|
||||
void
|
||||
CRemote::TakeRemoteControlledCarFromPlayer(void)
|
||||
CRemote::TakeRemoteControlledCarFromPlayer(bool blowUp)
|
||||
{
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->VehicleCreatedBy = RANDOM_VEHICLE;
|
||||
CCarCtrl::NumMissionCars--;
|
||||
CCarCtrl::NumRandomCars++;
|
||||
if (CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->VehicleCreatedBy = RANDOM_VEHICLE;
|
||||
CCarCtrl::NumMissionCars--;
|
||||
CCarCtrl::NumRandomCars++;
|
||||
}
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bIsLocked = false;
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nTimeLostRemoteCar = CTimer::GetTimeInMilliseconds();
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_bInRemoteMode = true;
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bRemoveFromWorld = true;
|
||||
CWorld::Players[CWorld::PlayerInFocus].field_D5 = blowUp;
|
||||
CWorld::Players[CWorld::PlayerInFocus].field_D6 = true;
|
||||
}
|
||||
|
@ -4,5 +4,5 @@ class CRemote
|
||||
{
|
||||
public:
|
||||
static void GivePlayerRemoteControlledCar(float, float, float, float, uint16);
|
||||
static void TakeRemoteControlledCarFromPlayer(void);
|
||||
static void TakeRemoteControlledCarFromPlayer(bool blowUp = true);
|
||||
};
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "Text.h"
|
||||
#include "Camera.h"
|
||||
#include "Radar.h"
|
||||
#include "Fluff.h"
|
||||
|
||||
uint8 CReplay::Mode;
|
||||
CAddressInReplayBuffer CReplay::Record;
|
||||
@ -229,7 +230,7 @@ void CReplay::EnableReplays(void)
|
||||
void PlayReplayFromHD(void);
|
||||
void CReplay::Update(void)
|
||||
{
|
||||
if (CCutsceneMgr::IsCutsceneProcessing() || CTimer::GetIsPaused())
|
||||
if (CCutsceneMgr::IsCutsceneProcessing() || CTimer::GetIsPaused() || CScriptPaths::IsOneActive())
|
||||
return;
|
||||
switch (Mode){
|
||||
case MODE_RECORD:
|
||||
@ -1175,6 +1176,7 @@ void CReplay::StoreStuffInMem(void)
|
||||
if (ped)
|
||||
StoreDetailedPedAnimation(ped, &pPedAnims[i]);
|
||||
}
|
||||
CScriptPaths::Save_ForReplay();
|
||||
}
|
||||
|
||||
void CReplay::RestoreStuffFromMem(void)
|
||||
@ -1351,6 +1353,7 @@ void CReplay::RestoreStuffFromMem(void)
|
||||
}
|
||||
delete[] pPedAnims;
|
||||
pPedAnims = nil;
|
||||
CScriptPaths::Load_ForReplay();
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
|
||||
DMAudio.SetRadioInCar(OldRadioStation);
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -374,10 +374,10 @@ private:
|
||||
static int32 GetNewUniqueScriptSphereIndex(int32 index);
|
||||
static void RemoveScriptSphere(int32 index);
|
||||
static void RemoveScriptTextureDictionary();
|
||||
public:
|
||||
static void RemoveThisPed(CPed* pPed);
|
||||
|
||||
#ifdef MISSION_SWITCHER
|
||||
public:
|
||||
static void SwitchToMission(int32 mission);
|
||||
#endif
|
||||
|
||||
|
@ -4894,11 +4894,6 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
|
||||
if (ResetStatics) {
|
||||
FOV = DefaultFOV;
|
||||
|
||||
// TODO(Miami): Remove that when cam is done!
|
||||
// GTA 3 has this in veh. camera
|
||||
if (TheCamera.m_bIdleOn)
|
||||
TheCamera.m_uiTimeWeEnteredIdle = CTimer::GetTimeInMilliseconds();
|
||||
} else {
|
||||
if (isCar || isBike) {
|
||||
// 0.4f: CAR_FOV_START_SPEED
|
||||
@ -4933,18 +4928,13 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
||||
Rotating = false;
|
||||
m_bCollisionChecksOn = true;
|
||||
|
||||
|
||||
// TODO(Miami): Uncomment that when cam is done!
|
||||
|
||||
// Garage exit cam is not working well in III...
|
||||
// if (!TheCamera.m_bJustCameOutOfGarage)
|
||||
// {
|
||||
Alpha = 0.0f;
|
||||
Beta = car->GetForward().Heading() - HALFPI;
|
||||
if (TheCamera.m_bCamDirectlyInFront) {
|
||||
Beta += PI;
|
||||
if (!TheCamera.m_bJustCameOutOfGarage) {
|
||||
Alpha = 0.0f;
|
||||
Beta = car->GetForward().Heading() - HALFPI;
|
||||
if (TheCamera.m_bCamDirectlyInFront) {
|
||||
Beta += PI;
|
||||
}
|
||||
}
|
||||
// }
|
||||
|
||||
BetaSpeed = 0.0;
|
||||
AlphaSpeed = 0.0;
|
||||
|
@ -514,7 +514,12 @@ CCamera::Process(void)
|
||||
|
||||
int tableIndex = (int)(DEGTORAD(DrunkAngle)/TWOPI * CParticle::SIN_COS_TABLE_SIZE) & CParticle::SIN_COS_TABLE_SIZE-1;
|
||||
DrunkAngle += 5.0f;
|
||||
#ifndef FIX_BUGS
|
||||
// This just messes up interpolation, probably not what they intended
|
||||
// and multiplying the interpolated FOV is also a bit extreme
|
||||
// so let's not do any of this nonsense
|
||||
Cams[ActiveCam].FOV *= (1.0f + CMBlur::Drunkness);
|
||||
#endif
|
||||
|
||||
CamSource.x += -0.02f*CMBlur::Drunkness * CParticle::m_CosTable[tableIndex];
|
||||
CamSource.y += -0.02f*CMBlur::Drunkness * CParticle::m_SinTable[tableIndex];
|
||||
|
@ -150,9 +150,11 @@ CdStreamInit(int32 numChannels)
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
_gdwCdStreamFlags = O_RDONLY | O_NOATIME;
|
||||
|
||||
#else
|
||||
_gdwCdStreamFlags = O_RDONLY;
|
||||
#endif
|
||||
// People say it's slower
|
||||
/*
|
||||
if ( fsInfo.f_bsize <= CDSTREAM_SECTOR_SIZE )
|
||||
@ -400,9 +402,12 @@ void *CdStreamThread(void *param)
|
||||
if (gCdStreamThreadStatus == 0){
|
||||
gCdStreamThreadStatus = 1;
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
pid_t tid = syscall(SYS_gettid);
|
||||
int ret = setpriority(PRIO_PROCESS, tid, getpriority(PRIO_PROCESS, getpid()) + 1);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// spurious wakeup or we sent interrupt signal for flushing
|
||||
if(pChannel->nSectorsToRead == 0)
|
||||
|
@ -223,7 +223,6 @@ CColStore::EnsureCollisionIsInMemory(const CVector2D &pos)
|
||||
}
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
bool
|
||||
CColStore::HasCollisionLoaded(const CVector2D &pos)
|
||||
{
|
||||
|
@ -3049,6 +3049,18 @@ CColModel::GetTrianglePoint(CVector &v, int i) const
|
||||
v = vertices[i].Get();
|
||||
}
|
||||
|
||||
void*
|
||||
CColModel::operator new(size_t){
|
||||
CColModel *node = CPools::GetColModelPool()->New();
|
||||
assert(node);
|
||||
return node;
|
||||
}
|
||||
|
||||
void
|
||||
CColModel::operator delete(void *p, size_t){
|
||||
CPools::GetColModelPool()->Delete((CColModel*)p);
|
||||
}
|
||||
|
||||
CColModel&
|
||||
CColModel::operator=(const CColModel &other)
|
||||
{
|
||||
|
@ -181,7 +181,6 @@ struct CStoredCollPoly
|
||||
bool valid;
|
||||
};
|
||||
|
||||
//--MIAMI: done struct
|
||||
struct CColModel
|
||||
{
|
||||
CSphere boundingSphere;
|
||||
@ -208,6 +207,8 @@ struct CColModel
|
||||
void SetLinkPtr(CLink<CColModel*>*);
|
||||
void GetTrianglePoint(CVector &v, int i) const;
|
||||
|
||||
void *operator new(size_t);
|
||||
void operator delete(void *p, size_t);
|
||||
CColModel& operator=(const CColModel& other);
|
||||
};
|
||||
|
||||
|
@ -215,7 +215,10 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
|
||||
|
||||
SetControllerKeyAssociatedWithAction (PED_FIREWEAPON, rsPADINS, KEYBOARD);
|
||||
SetControllerKeyAssociatedWithAction (PED_FIREWEAPON, rsLCTRL, OPTIONAL_EXTRA);
|
||||
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
SetControllerKeyAssociatedWithAction (VEHICLE_FIREWEAPON, rsPADINS, KEYBOARD);
|
||||
SetControllerKeyAssociatedWithAction (VEHICLE_FIREWEAPON, rsLCTRL, OPTIONAL_EXTRA);
|
||||
#endif
|
||||
SetControllerKeyAssociatedWithAction (PED_CYCLE_WEAPON_LEFT, rsPADDEL, KEYBOARD);
|
||||
|
||||
SetControllerKeyAssociatedWithAction (PED_CYCLE_WEAPON_RIGHT, rsPADENTER, OPTIONAL_EXTRA); // BUG: must be KEYBOARD ?
|
||||
@ -285,6 +288,9 @@ void CControllerConfigManager::InitDefaultControlConfigMouse(CMouseControllerSta
|
||||
{
|
||||
m_bMouseAssociated = true;
|
||||
SetMouseButtonAssociatedWithAction(PED_FIREWEAPON, 1);
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
SetMouseButtonAssociatedWithAction(VEHICLE_FIREWEAPON, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (availableButtons.RMB)
|
||||
@ -371,6 +377,9 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 3, JOYSTICK);
|
||||
case 2:
|
||||
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 2, JOYSTICK);
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 2, JOYSTICK);
|
||||
#endif
|
||||
case 1:
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 1, JOYSTICK);
|
||||
/*******************************************************************************************/
|
||||
@ -422,6 +431,9 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 2, JOYSTICK);
|
||||
case 1:
|
||||
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 1, JOYSTICK);
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 1, JOYSTICK);
|
||||
#endif
|
||||
/*******************************************************************************************/
|
||||
}
|
||||
}
|
||||
@ -463,6 +475,9 @@ void CControllerConfigManager::InitialiseControllerActionNameArray()
|
||||
SETACTIONNAME(SHOW_MOUSE_POINTER_TOGGLE);
|
||||
SETACTIONNAME(CAMERA_CHANGE_VIEW_ALL_SITUATIONS);
|
||||
SETACTIONNAME(PED_FIREWEAPON);
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
SETACTIONNAME(VEHICLE_FIREWEAPON);
|
||||
#endif
|
||||
SETACTIONNAME(VEHICLE_ENTER_EXIT);
|
||||
SETACTIONNAME(GO_LEFT);
|
||||
SETACTIONNAME(GO_RIGHT);
|
||||
@ -651,12 +666,21 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown(int32 button,
|
||||
}
|
||||
|
||||
AffectControllerStateOn_ButtonDown_AllStates(button, type, *state);
|
||||
|
||||
#ifdef REGISTER_START_BUTTON
|
||||
if (button == 12)
|
||||
state->Start = 255;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CControllerConfigManager::AffectControllerStateOn_ButtonDown_Driving(int32 button, eControllerType type, CControllerState &state)
|
||||
{
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
if (button == GetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, type))
|
||||
state.Circle = 255;
|
||||
#endif
|
||||
if (button == GetControllerKeyAssociatedWithAction(VEHICLE_LOOKBEHIND, type))
|
||||
{
|
||||
state.LeftShoulder2 = 255;
|
||||
@ -807,7 +831,11 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown_ThirdPersonOnl
|
||||
void CControllerConfigManager::AffectControllerStateOn_ButtonDown_FirstAndThirdPersonOnly(int32 button, eControllerType type, CControllerState &state)
|
||||
{
|
||||
CPad *pad = CPad::GetPad(PAD1);
|
||||
|
||||
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
if (button == GetControllerKeyAssociatedWithAction(PED_FIREWEAPON, type))
|
||||
state.Circle = 255;
|
||||
#endif
|
||||
if (button == GetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, type))
|
||||
state.RightShoulder1 = 255;
|
||||
|
||||
@ -889,8 +917,11 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown_AllStates(int3
|
||||
{
|
||||
if (button == GetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, type))
|
||||
state.Select = 255;
|
||||
|
||||
#ifndef BIND_VEHICLE_FIREWEAPON
|
||||
if (button == GetControllerKeyAssociatedWithAction(PED_FIREWEAPON, type))
|
||||
state.Circle = 255;
|
||||
#endif
|
||||
|
||||
if (button == GetControllerKeyAssociatedWithAction(GO_LEFT, type))
|
||||
{
|
||||
@ -1060,6 +1091,11 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonUp(int32 button, eC
|
||||
{
|
||||
if (FrontEndMenuManager.GetIsMenuActive())
|
||||
AffectControllerStateOn_ButtonUp_All_Player_States(button, type, *state);
|
||||
|
||||
#ifdef REGISTER_START_BUTTON
|
||||
if (button == 12)
|
||||
state->Start = 0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1601,28 +1637,25 @@ bool CControllerConfigManager::GetIsMouseButtonUp(RsKeyCodes keycode)
|
||||
return false;
|
||||
}
|
||||
|
||||
#define CLEAR_ACTION_IF_NEEDED(action) \
|
||||
if (key == GetControllerKeyAssociatedWithAction(action, type))\
|
||||
ClearSettingsAssociatedWithAction(action, type);
|
||||
|
||||
void CControllerConfigManager::DeleteMatchingCommonControls(e_ControllerAction action, int32 key, eControllerType type)
|
||||
{
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
{
|
||||
if (key == GetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS,type))
|
||||
ClearSettingsAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_FIREWEAPON, type))
|
||||
ClearSettingsAssociatedWithAction(PED_FIREWEAPON, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(GO_LEFT, type))
|
||||
ClearSettingsAssociatedWithAction(GO_LEFT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(GO_RIGHT, type))
|
||||
ClearSettingsAssociatedWithAction(GO_RIGHT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(NETWORK_TALK, type))
|
||||
ClearSettingsAssociatedWithAction(NETWORK_TALK, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(SWITCH_DEBUG_CAM_ON, type))
|
||||
ClearSettingsAssociatedWithAction(SWITCH_DEBUG_CAM_ON, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(TOGGLE_DPAD, type))
|
||||
ClearSettingsAssociatedWithAction(TOGGLE_DPAD, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(TAKE_SCREEN_SHOT, type))
|
||||
ClearSettingsAssociatedWithAction(TAKE_SCREEN_SHOT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(SHOW_MOUSE_POINTER_TOGGLE, type))
|
||||
ClearSettingsAssociatedWithAction(SHOW_MOUSE_POINTER_TOGGLE, type);
|
||||
CLEAR_ACTION_IF_NEEDED(CAMERA_CHANGE_VIEW_ALL_SITUATIONS);
|
||||
#ifndef BIND_VEHICLE_FIREWEAPON
|
||||
CLEAR_ACTION_IF_NEEDED(PED_FIREWEAPON);
|
||||
#endif
|
||||
CLEAR_ACTION_IF_NEEDED(GO_LEFT);
|
||||
CLEAR_ACTION_IF_NEEDED(GO_RIGHT);
|
||||
CLEAR_ACTION_IF_NEEDED(NETWORK_TALK);
|
||||
CLEAR_ACTION_IF_NEEDED(SWITCH_DEBUG_CAM_ON);
|
||||
CLEAR_ACTION_IF_NEEDED(TOGGLE_DPAD);
|
||||
CLEAR_ACTION_IF_NEEDED(TAKE_SCREEN_SHOT);
|
||||
CLEAR_ACTION_IF_NEEDED(SHOW_MOUSE_POINTER_TOGGLE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1630,16 +1663,11 @@ void CControllerConfigManager::DeleteMatching3rdPersonControls(e_ControllerActio
|
||||
{
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
{
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, type))
|
||||
ClearSettingsAssociatedWithAction(PED_LOOKBEHIND, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, type))
|
||||
ClearSettingsAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, type))
|
||||
ClearSettingsAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_JUMPING, type))
|
||||
ClearSettingsAssociatedWithAction(PED_JUMPING, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_SPRINT, type))
|
||||
ClearSettingsAssociatedWithAction(PED_SPRINT, type);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_LOOKBEHIND);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_CYCLE_WEAPON_LEFT);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_CYCLE_WEAPON_RIGHT);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_JUMPING);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_SPRINT);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_DUCK, type))
|
||||
ClearSettingsAssociatedWithAction(PED_DUCK, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, type))
|
||||
@ -1647,12 +1675,9 @@ void CControllerConfigManager::DeleteMatching3rdPersonControls(e_ControllerActio
|
||||
|
||||
if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC)
|
||||
{
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_CYCLE_TARGET_LEFT, type))
|
||||
ClearSettingsAssociatedWithAction(PED_CYCLE_TARGET_LEFT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_CYCLE_TARGET_RIGHT, type))
|
||||
ClearSettingsAssociatedWithAction(PED_CYCLE_TARGET_RIGHT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, type))
|
||||
ClearSettingsAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, type);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_CYCLE_TARGET_LEFT);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_CYCLE_TARGET_RIGHT);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_CENTER_CAMERA_BEHIND_PLAYER);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1661,23 +1686,19 @@ void CControllerConfigManager::DeleteMatching1rst3rdPersonControls(e_ControllerA
|
||||
{
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
{
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, type))
|
||||
ClearSettingsAssociatedWithAction(PED_LOCK_TARGET, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(GO_FORWARD, type))
|
||||
ClearSettingsAssociatedWithAction(GO_FORWARD, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(GO_BACK, type))
|
||||
ClearSettingsAssociatedWithAction(GO_BACK, type);
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
CLEAR_ACTION_IF_NEEDED(PED_FIREWEAPON);
|
||||
#endif
|
||||
CLEAR_ACTION_IF_NEEDED(PED_LOCK_TARGET);
|
||||
CLEAR_ACTION_IF_NEEDED(GO_FORWARD);
|
||||
CLEAR_ACTION_IF_NEEDED(GO_BACK);
|
||||
|
||||
if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC)
|
||||
{
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_1RST_PERSON_LOOK_LEFT, type))
|
||||
ClearSettingsAssociatedWithAction(PED_1RST_PERSON_LOOK_LEFT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_1RST_PERSON_LOOK_RIGHT, type))
|
||||
ClearSettingsAssociatedWithAction(PED_1RST_PERSON_LOOK_RIGHT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_1RST_PERSON_LOOK_DOWN, type))
|
||||
ClearSettingsAssociatedWithAction(PED_1RST_PERSON_LOOK_DOWN, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_1RST_PERSON_LOOK_UP, type))
|
||||
ClearSettingsAssociatedWithAction(PED_1RST_PERSON_LOOK_UP, type);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_1RST_PERSON_LOOK_LEFT);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_1RST_PERSON_LOOK_RIGHT);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_1RST_PERSON_LOOK_DOWN);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_1RST_PERSON_LOOK_UP);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1686,34 +1707,23 @@ void CControllerConfigManager::DeleteMatchingVehicleControls(e_ControllerAction
|
||||
{
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
{
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_LOOKBEHIND, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_LOOKBEHIND, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_LOOKLEFT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_LOOKRIGHT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_LOOKBEHIND, type)) // note: dublicate
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_LOOKBEHIND, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_HORN, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_HORN, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_HANDBRAKE, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_ACCELERATE, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_BRAKE, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, type))
|
||||
ClearSettingsAssociatedWithAction(TOGGLE_SUBMISSIONS, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_TURRETLEFT, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_TURRETLEFT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_TURRETRIGHT, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_TURRETRIGHT, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_TURRETUP, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_TURRETUP, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_TURRETDOWN, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_TURRETDOWN, type);
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_FIREWEAPON);
|
||||
#endif
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_LOOKBEHIND);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_LOOKLEFT);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_LOOKRIGHT);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_LOOKBEHIND); // note: duplicate
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_HORN);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_HANDBRAKE);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_ACCELERATE);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_BRAKE);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_CHANGE_RADIO_STATION);
|
||||
CLEAR_ACTION_IF_NEEDED(TOGGLE_SUBMISSIONS);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_TURRETLEFT);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_TURRETRIGHT);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_TURRETUP);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_TURRETDOWN);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1721,8 +1731,7 @@ void CControllerConfigManager::DeleteMatchingVehicle_3rdPersonControls(e_Control
|
||||
{
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
{
|
||||
if (key == GetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, type))
|
||||
ClearSettingsAssociatedWithAction(VEHICLE_ENTER_EXIT, type);
|
||||
CLEAR_ACTION_IF_NEEDED(VEHICLE_ENTER_EXIT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1730,13 +1739,13 @@ void CControllerConfigManager::DeleteMatching1rstPersonControls(e_ControllerActi
|
||||
{
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
{
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, type))
|
||||
ClearSettingsAssociatedWithAction(PED_SNIPER_ZOOM_IN, type);
|
||||
if (key == GetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, type))
|
||||
ClearSettingsAssociatedWithAction(PED_SNIPER_ZOOM_OUT, type);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_SNIPER_ZOOM_IN);
|
||||
CLEAR_ACTION_IF_NEEDED(PED_SNIPER_ZOOM_OUT);
|
||||
}
|
||||
}
|
||||
|
||||
#undef CLEAR_ACTION_IF_NEEDED
|
||||
|
||||
void CControllerConfigManager::DeleteMatchingActionInitiators(e_ControllerAction action, int32 key, eControllerType type)
|
||||
{
|
||||
if (!GetIsKeyBlank(key, type))
|
||||
@ -1814,7 +1823,9 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
#ifndef BIND_VEHICLE_FIREWEAPON
|
||||
case PED_FIREWEAPON:
|
||||
#endif
|
||||
case GO_LEFT:
|
||||
case GO_RIGHT:
|
||||
case CAMERA_CHANGE_VIEW_ALL_SITUATIONS:
|
||||
@ -1839,6 +1850,9 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
|
||||
return ACTIONTYPE_3RDPERSON;
|
||||
break;
|
||||
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
case VEHICLE_FIREWEAPON:
|
||||
#endif
|
||||
case VEHICLE_LOOKBEHIND:
|
||||
case VEHICLE_LOOKLEFT:
|
||||
case VEHICLE_LOOKRIGHT:
|
||||
@ -1859,6 +1873,9 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
|
||||
return ACTIONTYPE_VEHICLE_3RDPERSON;
|
||||
break;
|
||||
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
case PED_FIREWEAPON:
|
||||
#endif
|
||||
case GO_FORWARD:
|
||||
case GO_BACK:
|
||||
case PED_1RST_PERSON_LOOK_LEFT:
|
||||
|
@ -34,6 +34,9 @@ enum e_ControllerAction
|
||||
PED_LOOKBEHIND,
|
||||
PED_DUCK,
|
||||
PED_ANSWER_PHONE,
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
VEHICLE_FIREWEAPON,
|
||||
#endif
|
||||
VEHICLE_ACCELERATE,
|
||||
VEHICLE_BRAKE,
|
||||
VEHICLE_CHANGE_RADIO_STATION,
|
||||
|
@ -19,4 +19,5 @@ public:
|
||||
static bool ReadLine(int fd, char *buf, int len);
|
||||
static int CloseFile(int fd);
|
||||
static int GetErrorReadWrite(int fd);
|
||||
static char *GetRootDirName() { return ms_rootDirName; }
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -160,7 +160,7 @@ enum eMenuScreen
|
||||
MENUPAGE_NEW_GAME = 1,
|
||||
MENUPAGE_BRIEFS = 2,
|
||||
MENUPAGE_SOUND_SETTINGS = 3,
|
||||
MENUPAGE_GRAPHICS_SETTINGS = 4,
|
||||
MENUPAGE_DISPLAY_SETTINGS = 4,
|
||||
MENUPAGE_LANGUAGE_SETTINGS = 5,
|
||||
MENUPAGE_MAP = 6,
|
||||
MENUPAGE_NEW_GAME_RELOAD = 7,
|
||||
@ -199,6 +199,9 @@ enum eMenuScreen
|
||||
MENUPAGE_CONTROLLER_PC_OLD3,
|
||||
MENUPAGE_CONTROLLER_PC_OLD4,
|
||||
MENUPAGE_CONTROLLER_DEBUG,
|
||||
#endif
|
||||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
MENUPAGE_GRAPHICS_SETTINGS,
|
||||
#endif
|
||||
MENUPAGES
|
||||
};
|
||||
@ -266,12 +269,28 @@ enum eMenuAction
|
||||
MENUACTION_MOUSESTEER,
|
||||
MENUACTION_UNK110,
|
||||
#ifdef IMPROVED_VIDEOMODE
|
||||
MENUACTION_SCREENMODE,
|
||||
MENUACTION_SCREENFORMAT,
|
||||
#endif
|
||||
#ifdef LEGACY_MENU_OPTIONS
|
||||
MENUACTION_CTRLVIBRATION,
|
||||
MENUACTION_CTRLCONFIG,
|
||||
#endif
|
||||
#ifdef ANISOTROPIC_FILTERING
|
||||
MENUACTION_MIPMAPS,
|
||||
MENUACTION_TEXTURE_FILTERING,
|
||||
#endif
|
||||
#ifdef MULTISAMPLING
|
||||
MENUACTION_MULTISAMPLING,
|
||||
#endif
|
||||
#ifdef NO_ISLAND_LOADING
|
||||
MENUACTION_ISLANDLOADING,
|
||||
#endif
|
||||
#ifdef PS2_ALPHA_TEST
|
||||
MENUACTION_PS2_ALPHA_TEST,
|
||||
#endif
|
||||
#ifdef CUTSCENE_BORDERS_SWITCH
|
||||
MENUACTION_CUTSCENEBORDERS,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum eCheckHover
|
||||
@ -318,6 +337,8 @@ enum eCheckHover
|
||||
HOVEROPTION_DECREASE_SFXVOLUME,
|
||||
HOVEROPTION_INCREASE_MOUSESENS,
|
||||
HOVEROPTION_DECREASE_MOUSESENS,
|
||||
HOVEROPTION_INCREASE_MP3BOOST,
|
||||
HOVEROPTION_DECREASE_MP3BOOST,
|
||||
HOVEROPTION_NOT_HOVERING,
|
||||
};
|
||||
|
||||
@ -574,6 +595,10 @@ public:
|
||||
int32 m_nPrefsSubsystem;
|
||||
int32 m_nSelectedScreenMode;
|
||||
#endif
|
||||
#ifdef MULTISAMPLING
|
||||
static int8 m_nPrefsMSAALevel;
|
||||
static int8 m_nDisplayMSAALevel;
|
||||
#endif
|
||||
|
||||
enum LANGUAGE
|
||||
{
|
||||
@ -601,7 +626,25 @@ public:
|
||||
|
||||
CMenuManager(void);
|
||||
~CMenuManager(void) { UnloadTextures(); }
|
||||
|
||||
|
||||
#ifdef NO_ISLAND_LOADING
|
||||
enum
|
||||
{
|
||||
ISLAND_LOADING_LOW = 0,
|
||||
ISLAND_LOADING_MEDIUM,
|
||||
ISLAND_LOADING_HIGH
|
||||
};
|
||||
|
||||
static int8 m_DisplayIslandLoading;
|
||||
static int8 m_PrefsIslandLoading;
|
||||
|
||||
#define ISLAND_LOADING_IS(p) if (CMenuManager::m_PrefsIslandLoading == CMenuManager::ISLAND_LOADING_##p)
|
||||
#define ISLAND_LOADING_ISNT(p) if (CMenuManager::m_PrefsIslandLoading != CMenuManager::ISLAND_LOADING_##p)
|
||||
#else
|
||||
#define ISLAND_LOADING_IS(p)
|
||||
#define ISLAND_LOADING_ISNT(p)
|
||||
#endif
|
||||
|
||||
void Initialise();
|
||||
void PrintMap();
|
||||
void SetFrontEndRenderStates();
|
||||
@ -633,7 +676,9 @@ public:
|
||||
static void PrintErrorMessage();
|
||||
void PrintStats();
|
||||
void Process();
|
||||
void ProcessButtonPresses();
|
||||
void ProcessList(bool &optionSelected, bool &goBack);
|
||||
void UserInput();
|
||||
void ProcessButtonPresses(uint8, uint8, uint8, uint8, int8);
|
||||
void ProcessFileActions();
|
||||
void ProcessOnOffMenuOptions();
|
||||
void RequestFrontEndShutDown();
|
||||
|
@ -1179,30 +1179,9 @@ CMenuManager::InitialiseMenuContents(void)
|
||||
|
||||
STAT_LINE("KGS_EXP", &CStats::KgsOfExplosivesUsed, 0, nil);
|
||||
|
||||
nTemp = (CStats::InstantHitsFiredByPlayer == 0 ? 0 : CStats::InstantHitsHitByPlayer * 100.0f / CStats::InstantHitsFiredByPlayer);
|
||||
STAT_LINE("ACCURA", &nTemp, 0, nil);
|
||||
|
||||
if (CStats::ElBurroTime > 0)
|
||||
STAT_LINE("ELBURRO", &CStats::ElBurroTime, 0, nil);
|
||||
|
||||
if (CStats::Record4x4One > 0)
|
||||
STAT_LINE("FEST_R1", &CStats::Record4x4One, 0, nil);
|
||||
|
||||
if (CStats::Record4x4Two > 0)
|
||||
STAT_LINE("FEST_R2", &CStats::Record4x4Two, 0, nil);
|
||||
|
||||
if (CStats::Record4x4Three > 0)
|
||||
STAT_LINE("FEST_R3", &CStats::Record4x4Three, 0, nil);
|
||||
|
||||
if (CStats::Record4x4Mayhem > 0)
|
||||
STAT_LINE("FEST_RM", &CStats::Record4x4Mayhem, 0, nil);
|
||||
|
||||
if (CStats::LongestFlightInDodo > 0)
|
||||
STAT_LINE("FEST_LF", &CStats::LongestFlightInDodo, 0, nil);
|
||||
|
||||
if (CStats::TimeTakenDefuseMission > 0)
|
||||
STAT_LINE("FEST_BD", &CStats::TimeTakenDefuseMission, 0, nil);
|
||||
|
||||
STAT_LINE("CAR_CRU", &CStats::CarsCrushed, 0, nil);
|
||||
|
||||
if (CStats::HighestScores[0] > 0)
|
||||
@ -1231,7 +1210,11 @@ CMenuManager::InitialiseMenuContents(void)
|
||||
STAT_LINE("FEST_H4", &CStats::HighestScores[4], 0, nil);
|
||||
|
||||
STAT_LINE("FESTDFM", &CStats::DistanceTravelledOnFoot, 0, nil);
|
||||
STAT_LINE("FESTDCM", &CStats::DistanceTravelledInVehicle, 0, nil);
|
||||
STAT_LINE("FESTDCM", &CStats::DistanceTravelledByCar, 0, nil);
|
||||
STAT_LINE("DISTBIM", &CStats::DistanceTravelledByBike, 0, nil);
|
||||
STAT_LINE("DISTBOM", &CStats::DistanceTravelledByBoat, 0, nil);
|
||||
STAT_LINE("DISTGOM", &CStats::DistanceTravelledByGolfCart, 0, nil);
|
||||
STAT_LINE("DISTHEM", &CStats::DistanceTravelledByHelicoptor, 0, nil);
|
||||
STAT_LINE("MMRAIN", &CStats::mmRain, 0, nil);
|
||||
nTemp = (int32)CStats::MaximumJumpDistance;
|
||||
STAT_LINE("MXCARDM", &nTemp, 0, nil);
|
||||
|
@ -89,6 +89,9 @@
|
||||
#include "Occlusion.h"
|
||||
#include "debugmenu.h"
|
||||
#include "Ropes.h"
|
||||
#include "WindModifiers.h"
|
||||
#include "postfx.h"
|
||||
#include "custompipes.h"
|
||||
|
||||
eLevelName CGame::currLevel;
|
||||
int32 CGame::currArea;
|
||||
@ -151,6 +154,9 @@ CGame::InitialiseOnceBeforeRW(void)
|
||||
CFileMgr::Initialise();
|
||||
CdStreamInit(MAX_CDCHANNELS);
|
||||
ValidateVersion();
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
CPostFX::InitOnce();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -288,10 +294,6 @@ bool CGame::InitialiseOnceAfterRW(void)
|
||||
DMAudio.SetEffectsFadeVol(127);
|
||||
DMAudio.SetMusicFadeVol(127);
|
||||
CWorld::Players[0].SetPlayerSkin(FrontEndMenuManager.m_PrefsSkinFile);
|
||||
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
CustomFrontendOptionsPopulate();
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -327,6 +329,7 @@ bool CGame::Initialise(const char* datFile)
|
||||
CDebug::DebugInitTextBuffer();
|
||||
ThePaths.Init();
|
||||
ThePaths.AllocatePathFindInfoMem(4500);
|
||||
CScriptPaths::Init();
|
||||
CWeather::Init();
|
||||
CCullZones::Init();
|
||||
COcclusion::Init();
|
||||
@ -355,6 +358,10 @@ bool CGame::Initialise(const char* datFile)
|
||||
CdStreamAddImage("MODELS\\GTA3.IMG");
|
||||
CFileLoader::LoadLevel("DATA\\DEFAULT.DAT");
|
||||
CFileLoader::LoadLevel(datFile);
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
// for generic fallback
|
||||
CustomPipes::SetTxdFindCallback();
|
||||
#endif
|
||||
CWorld::AddParticles();
|
||||
CVehicleModelInfo::LoadVehicleColours();
|
||||
CVehicleModelInfo::LoadEnvironmentMaps();
|
||||
@ -453,6 +460,7 @@ bool CGame::ShutDown(void)
|
||||
CReplay::FinishPlayback();
|
||||
CPlane::Shutdown();
|
||||
CTrain::Shutdown();
|
||||
CScriptPaths::Shutdown();
|
||||
CSpecialFX::Shutdown();
|
||||
#ifndef PS2
|
||||
CGarages::Shutdown();
|
||||
@ -567,6 +575,7 @@ void CGame::ReInitGameObjectVariables(void)
|
||||
CSpecialFX::Init();
|
||||
CRopes::Init();
|
||||
CWaterCannons::Init();
|
||||
CScriptPaths::Init();
|
||||
CParticle::ReloadConfig();
|
||||
|
||||
#ifdef PS2_MENU
|
||||
@ -607,10 +616,7 @@ void CGame::ShutDownForRestart(void)
|
||||
CWorld::ClearForRestart();
|
||||
CGameLogic::ClearShortCut();
|
||||
CTimer::Shutdown();
|
||||
CStreaming::FlushRequestList();
|
||||
CStreaming::DeleteAllRwObjects();
|
||||
CStreaming::RemoveAllUnusedModels();
|
||||
CStreaming::ms_disableStreaming = false;
|
||||
CStreaming::ReInit();
|
||||
CRadar::RemoveRadarSections();
|
||||
FrontEndMenuManager.UnloadTextures();
|
||||
CParticleObject::RemoveAllExpireableParticleObjects();
|
||||
@ -695,6 +701,7 @@ void CGame::Process(void)
|
||||
if (!CCutsceneMgr::IsCutsceneProcessing() && !CTimer::GetIsCodePaused())
|
||||
FrontEndMenuManager.Process();
|
||||
CStreaming::Update();
|
||||
CWindModifiers::Number = 0;
|
||||
if (!CTimer::GetIsPaused())
|
||||
{
|
||||
CTheZones::Update();
|
||||
@ -708,6 +715,7 @@ void CGame::Process(void)
|
||||
CWeather::Update();
|
||||
CTheScripts::Process();
|
||||
CCollision::Update();
|
||||
CScriptPaths::Update();
|
||||
CTrain::UpdateTrains();
|
||||
CPlane::UpdatePlanes();
|
||||
CHeli::UpdateHelis();
|
||||
|
@ -2,7 +2,43 @@
|
||||
#include "Frontend.h"
|
||||
#ifdef PC_MENU
|
||||
|
||||
// If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp.
|
||||
#ifdef CUTSCENE_BORDERS_SWITCH
|
||||
#define MENU_CUTSCENE_BORDERS_SWITCH(screen) MENUACTION_CUTSCENEBORDERS, "FEM_CSB", SAVESLOT_NONE, screen,
|
||||
#else
|
||||
#define MENU_CUTSCENE_BORDERS_SWITCH(screen)
|
||||
#endif
|
||||
|
||||
#ifdef IMPROVED_VIDEOMODE
|
||||
#define MENU_IMPROVED_VIDEOMODE(screen) MENUACTION_SCREENFORMAT, "FEM_SCF", SAVESLOT_NONE, screen,
|
||||
#else
|
||||
#define MENU_IMPROVED_VIDEOMODE(screen)
|
||||
#endif
|
||||
|
||||
#ifdef ANISOTROPIC_FILTERING
|
||||
#define MENU_MIPMAPS(screen) MENUACTION_MIPMAPS, "FED_MIP", SAVESLOT_NONE, screen,
|
||||
#define MENU_TEXTURE_FILTERING(screen) MENUACTION_TEXTURE_FILTERING, "FED_FIL", SAVESLOT_NONE, screen,
|
||||
#else
|
||||
#define MENU_MIPMAPS(screen)
|
||||
#define MENU_TEXTURE_FILTERING(screen)
|
||||
#endif
|
||||
|
||||
#ifdef MULTISAMPLING
|
||||
#define MENU_MULTISAMPLING(screen) MENUACTION_MULTISAMPLING, "FED_AAS", SAVESLOT_NONE, screen,
|
||||
#else
|
||||
#define MENU_MULTISAMPLING(screen)
|
||||
#endif
|
||||
|
||||
#ifdef NO_ISLAND_LOADING
|
||||
#define MENU_ISLAND_LOADING(screen) MENUACTION_ISLANDLOADING, "FEM_ISL", SAVESLOT_NONE, screen,
|
||||
#else
|
||||
#define MENU_ISLAND_LOADING(screen)
|
||||
#endif
|
||||
|
||||
#ifdef PS2_ALPHA_TEST
|
||||
#define MENU_PS2_ALPHA_TEST(screen) MENUACTION_PS2_ALPHA_TEST, "FEM_2PR", SAVESLOT_NONE, screen,
|
||||
#else
|
||||
#define MENU_PS2_ALPHA_TEST(screen)
|
||||
#endif
|
||||
|
||||
CMenuScreen aScreens[] = {
|
||||
// MENUPAGE_STATS = 0
|
||||
@ -44,24 +80,24 @@ CMenuScreen aScreens[] = {
|
||||
#endif
|
||||
|
||||
{ "FEH_DIS", MENUPAGE_OPTIONS, 2,
|
||||
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 78, MENUALIGN_LEFT,
|
||||
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 103, MENUALIGN_LEFT,
|
||||
MENUACTION_BRIGHTNESS, "FED_BRI", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 78, MENUALIGN_LEFT,
|
||||
MENUACTION_DRAWDIST, "FEM_LOD", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 103, MENUALIGN_LEFT,
|
||||
#ifdef LEGACY_MENU_OPTIONS
|
||||
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 128, MENUALIGN_LEFT,
|
||||
MENUACTION_FRAMESYNC, "FEM_VSC", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 128, MENUALIGN_LEFT,
|
||||
#endif
|
||||
MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 128 + Y_OFFSET/2, MENUALIGN_LEFT,
|
||||
MENUACTION_FRAMELIMIT, "FEM_FRM", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 128 + Y_OFFSET/2, MENUALIGN_LEFT,
|
||||
#ifdef LEGACY_MENU_OPTIONS
|
||||
MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 178, MENUALIGN_LEFT,
|
||||
MENUACTION_TRAILS, "FED_TRA", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 178, MENUALIGN_LEFT,
|
||||
#endif
|
||||
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 153 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 178 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_LEGENDS, "MAP_LEG", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 202 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_RADARMODE, "FED_RDR", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 228 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_HUD, "FED_HUD", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 253 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 278 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 153 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 178 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_LEGENDS, "MAP_LEG", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 202 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_RADARMODE, "FED_RDR", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 228 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_HUD, "FED_HUD", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 253 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 278 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
#ifdef IMPROVED_VIDEOMODE
|
||||
MENUACTION_SCREENMODE, "FED_POS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 40, 303 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 320, 328 + Y_OFFSET, MENUALIGN_CENTER,
|
||||
MENUACTION_SCREENFORMAT,"FED_POS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 40, 303 + Y_OFFSET, MENUALIGN_LEFT,
|
||||
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 320, 328 + Y_OFFSET, MENUALIGN_CENTER,
|
||||
MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, 320, 353 + Y_OFFSET, MENUALIGN_CENTER,
|
||||
#else
|
||||
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 320, 303 + Y_OFFSET, MENUALIGN_CENTER,
|
||||
@ -230,7 +266,7 @@ CMenuScreen aScreens[] = {
|
||||
{ "FET_OPT", MENUPAGE_NONE, 5,
|
||||
MENUACTION_CHANGEMENU, "FEO_CON", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, 320, 132, MENUALIGN_CENTER,
|
||||
MENUACTION_LOADRADIO, "FEO_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_CHANGEMENU, "FEO_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_CHANGEMENU, "FEO_DIS", SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_CHANGEMENU, "FEO_LAN", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_PLAYERSETUP, "FET_PS", SAVESLOT_NONE, MENUPAGE_SKIN_SELECT, 0, 0, MENUALIGN_CENTER,
|
||||
MENUACTION_GOBACK, "FEDS_TB", SAVESLOT_NONE, 0, 0, 0, MENUALIGN_CENTER,
|
||||
|
@ -11,7 +11,11 @@
|
||||
#include "platform.h"
|
||||
#ifdef XINPUT
|
||||
#include <xinput.h>
|
||||
#if !defined(PSAPI_VERSION) || (PSAPI_VERSION > 1)
|
||||
#pragma comment( lib, "Xinput9_1_0.lib" )
|
||||
#else
|
||||
#pragma comment( lib, "Xinput.lib" )
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "Pad.h"
|
||||
@ -41,6 +45,8 @@
|
||||
#include "Fluff.h"
|
||||
#include "Gangs.h"
|
||||
#include "platform.h"
|
||||
#include "Stats.h"
|
||||
#include "CarCtrl.h"
|
||||
|
||||
#ifdef GTA_PS2
|
||||
#include "eetypes.h"
|
||||
@ -59,6 +65,7 @@ bool CPad::bDisplayNoControllerMessage;
|
||||
bool CPad::bObsoleteControllerMessage;
|
||||
bool CPad::bOldDisplayNoControllerMessage;
|
||||
bool CPad::m_bMapPadOneToPadTwo;
|
||||
bool CPad::bHasPlayerCheated;
|
||||
#ifdef GTA_PS2
|
||||
unsigned char act_direct[6];
|
||||
unsigned char act_align[6];
|
||||
@ -228,6 +235,8 @@ void VehicleCheat(bool something, int model)
|
||||
CWorld::Add(vehicle);
|
||||
}
|
||||
}
|
||||
CStats::CheatedCount += 1000;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
void BlowUpCarsCheat()
|
||||
@ -287,6 +296,8 @@ void MayhemCheat()
|
||||
PED_FLAG_GANG2 | PED_FLAG_GANG3 | PED_FLAG_GANG4 | PED_FLAG_GANG5 |
|
||||
PED_FLAG_GANG6 | PED_FLAG_GANG7 | PED_FLAG_GANG8 | PED_FLAG_GANG9 |
|
||||
PED_FLAG_EMERGENCY | PED_FLAG_PROSTITUTE | PED_FLAG_CRIMINAL | PED_FLAG_SPECIAL );
|
||||
CStats::CheatedCount += 1000;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
void EverybodyAttacksPlayerCheat()
|
||||
@ -294,12 +305,17 @@ void EverybodyAttacksPlayerCheat()
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
for (int i = PEDTYPE_CIVMALE; i < PEDTYPE_SPECIAL; i++)
|
||||
CPedType::AddThreat(i, PED_FLAG_PLAYER1);
|
||||
|
||||
CStats::CheatedCount += 1000;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
void WeaponsForAllCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CPopulation::ms_bGivePedsWeapons = !CPopulation::ms_bGivePedsWeapons;
|
||||
CStats::CheatedCount += 1000;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
void FastTimeCheat()
|
||||
@ -380,19 +396,24 @@ void OnlyRenderWheelsCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CVehicle::bWheelsOnlyCheat = !CVehicle::bWheelsOnlyCheat;
|
||||
CStats::CheatedCount += 1000;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
|
||||
void ChittyChittyBangBangCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CVehicle::bAllDodosCheat = !CVehicle::bAllDodosCheat;
|
||||
CStats::CheatedCount += 1000;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
void StrongGripCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CVehicle::bCheat3 = !CVehicle::bCheat3;
|
||||
CStats::CheatedCount += 1000;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
void NastyLimbsCheat()
|
||||
@ -404,6 +425,7 @@ void FannyMagnetCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CPed::bFannyMagnetCheat = !CPed::bFannyMagnetCheat;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
void BlackCarsCheat()
|
||||
@ -420,6 +442,12 @@ void PinkCarsCheat()
|
||||
gbPinkCars = true;
|
||||
}
|
||||
|
||||
void MadCarsCheat()
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CCarCtrl::bMadDriversCheat = true;
|
||||
}
|
||||
|
||||
void NoSeaBedCheat(void)
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
@ -437,6 +465,7 @@ void BackToTheFuture(void)
|
||||
{
|
||||
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
|
||||
CVehicle::bHoverCheat = !CVehicle::bHoverCheat;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
void SuicideCheat(void) {
|
||||
@ -453,6 +482,8 @@ void DoChicksWithGunsCheat(void) {
|
||||
CStreaming::RemoveCurrentZonesModels();
|
||||
CGangs::SetGangPedModels(GANG_PLAYER, MI_HFYBE, MI_WFYBE);
|
||||
CGangs::SetGangWeapons(GANG_PLAYER, WEAPONTYPE_M4, WEAPONTYPE_M4);
|
||||
CStats::CheatedCount += 1000;
|
||||
CPad::bHasPlayerCheated = true;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
@ -611,6 +642,11 @@ void CPad::Clear(bool bResetPlayerControls)
|
||||
ShakeFreq = 0;
|
||||
ShakeDur = 0;
|
||||
|
||||
for (int32 i = 0; i < DRUNK_STEERING_BUFFER_SIZE; i++)
|
||||
SteeringLeftRightBuffer[i] = 0;
|
||||
|
||||
DrunkDrivingBufferUsed = 0;
|
||||
|
||||
if ( bResetPlayerControls )
|
||||
DisablePlayerControls = PLAYERCONTROL_ENABLED;
|
||||
|
||||
@ -1203,6 +1239,7 @@ void CPad::AddToPCCheatString(char c)
|
||||
// "MIAMITRAFFIC"
|
||||
else if (!Cheat_strncmp(KeyBoardCheatString, "FNMGNmWPNLVU")) {
|
||||
KeyBoardCheatString[0] = ' ';
|
||||
MadCarsCheat();
|
||||
}
|
||||
// "AHAIRDRESSERSCAR"
|
||||
else if (!Cheat_strncmp(KeyBoardCheatString, "UFJT_`VZF]QZPaUG")) {
|
||||
@ -1786,6 +1823,9 @@ void CPad::Update(int16 pad)
|
||||
|
||||
bHornHistory[iCurrHornHistory] = GetHorn();
|
||||
|
||||
for (int32 i = DRUNK_STEERING_BUFFER_SIZE - 2; i >= 0; i--) {
|
||||
SteeringLeftRightBuffer[i + 1] = SteeringLeftRightBuffer[i];
|
||||
}
|
||||
|
||||
if ( !bDisplayNoControllerMessage )
|
||||
CGame::bDemoMode = false;
|
||||
@ -1879,6 +1919,7 @@ int16 CPad::GetSteeringLeftRight(void)
|
||||
if ( ArePlayerControlsDisabled() )
|
||||
return 0;
|
||||
|
||||
int16 value;
|
||||
switch (CURMODE)
|
||||
{
|
||||
case 0:
|
||||
@ -1888,9 +1929,12 @@ int16 CPad::GetSteeringLeftRight(void)
|
||||
int16 dpad = (NewState.DPadRight - NewState.DPadLeft) / 2;
|
||||
|
||||
if ( Abs(axis) > Abs(dpad) )
|
||||
return axis;
|
||||
value = axis;
|
||||
else
|
||||
return dpad;
|
||||
value = dpad;
|
||||
|
||||
SteeringLeftRightBuffer[0] = value;
|
||||
value = SteeringLeftRightBuffer[DrunkDrivingBufferUsed];
|
||||
|
||||
break;
|
||||
}
|
||||
@ -1898,13 +1942,18 @@ int16 CPad::GetSteeringLeftRight(void)
|
||||
case 1:
|
||||
case 3:
|
||||
{
|
||||
return NewState.LeftStickX;
|
||||
|
||||
SteeringLeftRightBuffer[0] = NewState.LeftStickX;
|
||||
value = SteeringLeftRightBuffer[DrunkDrivingBufferUsed];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
value = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return value;
|
||||
}
|
||||
|
||||
int16 CPad::GetSteeringUpDown(void)
|
||||
@ -3067,7 +3116,7 @@ void CPad::ResetCheats(void)
|
||||
CVehicle::bCheat8 = false;
|
||||
gbBlackCars = false;
|
||||
gbPinkCars = false;
|
||||
|
||||
CCarCtrl::bMadDriversCheat = false;
|
||||
gbFastTime = false;
|
||||
CTimer::SetTimeScale(1.0f);
|
||||
}
|
||||
|
@ -141,9 +141,12 @@ public:
|
||||
enum
|
||||
{
|
||||
HORNHISTORY_SIZE = 5,
|
||||
DRUNK_STEERING_BUFFER_SIZE = 10,
|
||||
};
|
||||
CControllerState NewState;
|
||||
CControllerState OldState;
|
||||
int16 SteeringLeftRightBuffer[DRUNK_STEERING_BUFFER_SIZE];
|
||||
int32 DrunkDrivingBufferUsed;
|
||||
CControllerState PCTempKeyState;
|
||||
CControllerState PCTempJoyState;
|
||||
CControllerState PCTempMouseState;
|
||||
@ -171,6 +174,7 @@ public:
|
||||
static bool bObsoleteControllerMessage;
|
||||
static bool bOldDisplayNoControllerMessage;
|
||||
static bool m_bMapPadOneToPadTwo;
|
||||
static bool bHasPlayerCheated;
|
||||
|
||||
static CKeyboardState OldKeyState;
|
||||
static CKeyboardState NewKeyState;
|
||||
@ -262,6 +266,7 @@ public:
|
||||
static char *EditString(char *pStr, int32 nSize);
|
||||
static int32 *EditCodesForControls(int32 *pRsKeys, int32 nSize);
|
||||
uint32 InputHowLongAgo(void);
|
||||
void SetDrunkInputDelay(int32 delay) { DrunkDrivingBufferUsed = delay; }
|
||||
|
||||
#ifdef XINPUT
|
||||
void AffectFromXinput(uint32 pad);
|
||||
|
@ -30,7 +30,13 @@
|
||||
#include "World.h"
|
||||
#include "ZoneCull.h"
|
||||
#include "main.h"
|
||||
#include "Bike.h"
|
||||
#include "Automobile.h"
|
||||
#include "GameLogic.h"
|
||||
|
||||
CVector lastPlayerPos;
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::SetPlayerSkin(char *skin)
|
||||
{
|
||||
@ -38,6 +44,7 @@ CPlayerInfo::SetPlayerSkin(char *skin)
|
||||
LoadPlayerSkin();
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
const CVector &
|
||||
CPlayerInfo::GetPos()
|
||||
{
|
||||
@ -50,16 +57,16 @@ CPlayerInfo::GetPos()
|
||||
return m_pPed->GetPosition();
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::LoadPlayerSkin()
|
||||
{
|
||||
DeletePlayerSkin();
|
||||
|
||||
m_pSkinTexture = CPlayerSkin::GetSkinTexture(m_aSkinName);
|
||||
if (!m_pSkinTexture)
|
||||
m_pSkinTexture = CPlayerSkin::GetSkinTexture(DEFAULT_SKIN_NAME);
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::DeletePlayerSkin()
|
||||
{
|
||||
@ -69,6 +76,7 @@ CPlayerInfo::DeletePlayerSkin()
|
||||
}
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::KillPlayer()
|
||||
{
|
||||
@ -81,6 +89,7 @@ CPlayerInfo::KillPlayer()
|
||||
CStats::TimesDied++;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::ArrestPlayer()
|
||||
{
|
||||
@ -88,11 +97,13 @@ CPlayerInfo::ArrestPlayer()
|
||||
|
||||
m_WBState = WBSTATE_BUSTED;
|
||||
m_nWBTime = CTimer::GetTimeInMilliseconds();
|
||||
m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
|
||||
CDarkel::ResetOnPlayerDeath();
|
||||
CMessages::AddBigMessage(TheText.Get("BUSTED"), 5000, 2);
|
||||
CStats::TimesArrested++;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
bool
|
||||
CPlayerInfo::IsPlayerInRemoteMode()
|
||||
{
|
||||
@ -109,6 +120,7 @@ CPlayerInfo::PlayerFailedCriticalMission()
|
||||
CDarkel::ResetOnPlayerDeath();
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::Clear(void)
|
||||
{
|
||||
@ -125,6 +137,8 @@ CPlayerInfo::Clear(void)
|
||||
m_nTrafficMultiplier = 0;
|
||||
m_fRoadDensity = 1.0f;
|
||||
m_bInRemoteMode = false;
|
||||
field_D5 = false;
|
||||
field_D6 = false;
|
||||
m_bUnusedTaxiThing = false;
|
||||
m_nUnusedTaxiTimer = 0;
|
||||
m_nCollectedPackages = 0;
|
||||
@ -136,10 +150,25 @@ CPlayerInfo::Clear(void)
|
||||
m_nSexFrequency = 0;
|
||||
m_pHooker = nil;
|
||||
m_nTimeTankShotGun = 0;
|
||||
field_248 = 0;
|
||||
field_EC = 0;
|
||||
m_nUpsideDownCounter = 0;
|
||||
m_nTimeCarSpentOnTwoWheels = 0;
|
||||
m_nDistanceCarTravelledOnTwoWheels = 0;
|
||||
m_nTimeNotFullyOnGround = 0;
|
||||
m_nTimeSpentOnWheelie = 0;
|
||||
m_nDistanceTravelledOnWheelie = 0.0f;
|
||||
m_nTimeSpentOnStoppie = 0;
|
||||
m_nDistanceTravelledOnStoppie = 0.0f;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
m_nLastTimeCarSpentOnTwoWheels = 0;
|
||||
m_nLastDistanceCarTravelledOnTwoWheels = 0;
|
||||
m_nLastTimeSpentOnWheelie = 0;
|
||||
m_nLastDistanceTravelledOnWheelie = 0;
|
||||
m_nLastTimeSpentOnStoppie = 0;
|
||||
m_nLastDistanceTravelledOnStoppie = 0;
|
||||
m_bInfiniteSprint = false;
|
||||
m_bFastReload = false;
|
||||
m_bFireproof = false;
|
||||
m_nMaxHealth = m_nMaxArmour = 100;
|
||||
m_bGetOutOfJailFree = false;
|
||||
m_bGetOutOfHospitalFree = false;
|
||||
@ -147,22 +176,24 @@ CPlayerInfo::Clear(void)
|
||||
m_nPreviousTimeRewardedForExplosion = 0;
|
||||
m_nExplosionsSinceLastReward = 0;
|
||||
m_nHavocLevel = 0;
|
||||
m_fMediaAttention = 0;
|
||||
m_fMediaAttention = 0.0f;
|
||||
m_nCurrentBustedAudio = 1;
|
||||
m_nBustedAudioStatus = BUSTEDAUDIO_NONE;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::BlowUpRCBuggy(bool actually)
|
||||
{
|
||||
if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
|
||||
return;
|
||||
|
||||
CRemote::TakeRemoteControlledCarFromPlayer();
|
||||
CRemote::TakeRemoteControlledCarFromPlayer(actually);
|
||||
if (actually)
|
||||
m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
|
||||
{
|
||||
@ -174,6 +205,7 @@ CPlayerInfo::CancelPlayerEnteringCars(CVehicle *car)
|
||||
m_pPed->ClearObjective();
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::MakePlayerSafe(bool toggle)
|
||||
{
|
||||
@ -198,8 +230,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
|
||||
CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
|
||||
CReplay::DisableReplays();
|
||||
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
|
||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
|
||||
m_pPed->bBulletProof = false;
|
||||
@ -214,18 +245,21 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
|
||||
}
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
bool
|
||||
CPlayerInfo::IsRestartingAfterDeath()
|
||||
{
|
||||
return m_WBState == WBSTATE_WASTED;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
bool
|
||||
CPlayerInfo::IsRestartingAfterArrest()
|
||||
{
|
||||
return m_WBState == WBSTATE_BUSTED;
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
// lastCloseness is passed to other calls of this function
|
||||
void
|
||||
CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoundCentrePedDist, float *lastCloseness, CVehicle **closestCarOutput)
|
||||
@ -250,32 +284,7 @@ CPlayerInfo::EvaluateCarPosition(CEntity *carToTest, CPed *player, float carBoun
|
||||
}
|
||||
}
|
||||
|
||||
// There is something unfinished in here... Sadly all IDBs we have have it unfinished.
|
||||
void
|
||||
CPlayerInfo::AwardMoneyForExplosion(CVehicle *wreckedCar)
|
||||
{
|
||||
if (CTimer::GetTimeInMilliseconds() - m_nPreviousTimeRewardedForExplosion < 6000)
|
||||
++m_nExplosionsSinceLastReward;
|
||||
else
|
||||
m_nExplosionsSinceLastReward = 1;
|
||||
|
||||
m_nPreviousTimeRewardedForExplosion = CTimer::GetTimeInMilliseconds();
|
||||
int award = wreckedCar->pHandling->nMonetaryValue * 0.002f;
|
||||
sprintf(gString, "$%d", award);
|
||||
#ifdef MONEY_MESSAGES
|
||||
// This line is a leftover from PS2, I don't know what it was meant to be.
|
||||
// CVector sth(TheCamera.GetPosition() * 4.0f);
|
||||
|
||||
CMoneyMessages::RegisterOne(wreckedCar->GetPosition() + CVector(0.0f, 0.0f, 2.0f), gString, 0, 255, 0, 2.0f, 0.5f);
|
||||
#endif
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
|
||||
|
||||
for (int i = m_nExplosionsSinceLastReward; i > 1; --i) {
|
||||
CGeneral::GetRandomNumber();
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += award;
|
||||
}
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
|
||||
{
|
||||
@ -293,12 +302,19 @@ CPlayerInfo::SavePlayerInfo(uint8 *buf, uint32 *size)
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
|
||||
CopyToBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio);
|
||||
#undef CopyToBuf
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
|
||||
{
|
||||
@ -313,12 +329,19 @@ CPlayerInfo::LoadPlayerInfo(uint8 *buf, uint32 size)
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bInfiniteSprint);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFastReload);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bFireproof);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxHealth);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nMaxArmour);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfJailFree);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bGetOutOfHospitalFree);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName)
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_bDriveByAllowed);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_aPlayerName);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nBustedAudioStatus);
|
||||
CopyFromBuf(buf, CWorld::Players[CWorld::PlayerInFocus].m_nCurrentBustedAudio)
|
||||
#undef CopyFromBuf
|
||||
}
|
||||
|
||||
// --MIAMI: Done
|
||||
void
|
||||
CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1, float unk2, float unk3, float unk4, float* lastCloseness, CVehicle** closestCarOutput)
|
||||
{
|
||||
@ -333,7 +356,7 @@ CPlayerInfo::FindClosestCarSectorList(CPtrList& carList, CPed* ped, float unk1,
|
||||
&& (car->GetUp().z > 0.3f || (car->IsVehicle() && ((CVehicle*)car)->m_vehType == VEHICLE_TYPE_BIKE))) {
|
||||
CVector carCentre = car->GetBoundCentre();
|
||||
|
||||
if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f) {
|
||||
if (Abs(ped->GetPosition().z - carCentre.z) < 2.0f || car->IsCar() && carCentre.z < ped->GetPosition().z && ped->GetPosition().z - 4.f < carCentre.z) {
|
||||
float dist = (ped->GetPosition() - carCentre).Magnitude2D();
|
||||
if (dist <= 10.0f && !CCranes::IsThisCarBeingCarriedByAnyCrane(car)) {
|
||||
EvaluateCarPosition(car, ped, dist, lastCloseness, closestCarOutput);
|
||||
@ -367,6 +390,157 @@ CPlayerInfo::Process(void)
|
||||
if (startTaxiTimer)
|
||||
m_nUnusedTaxiTimer = CTimer::GetTimeInMilliseconds();
|
||||
|
||||
if (!m_pPed->InVehicle()) {
|
||||
m_nTimeCarSpentOnTwoWheels = 0;
|
||||
m_nTimeNotFullyOnGround = 0;
|
||||
m_nTimeSpentOnWheelie = 0;
|
||||
m_nTimeSpentOnStoppie = 0;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
} else if (m_pPed->m_pMyVehicle->IsCar()) {
|
||||
CAutomobile *car = (CAutomobile*)m_pPed->m_pMyVehicle;
|
||||
|
||||
if (car->m_nWheelsOnGround < 3)
|
||||
m_nTimeNotFullyOnGround += CTimer::GetTimeInMilliseconds();
|
||||
else
|
||||
m_nTimeNotFullyOnGround = 0;
|
||||
|
||||
if (car->m_aSuspensionSpringRatioPrev[2] == 1.f && car->m_aSuspensionSpringRatioPrev[3] == 1.f) {
|
||||
if (car->m_aSuspensionSpringRatioPrev[0] < 1.0f && car->m_aSuspensionSpringRatioPrev[1] < 1.0f && car->m_fDamageImpulse == 0.0f) {
|
||||
m_nTimeCarSpentOnTwoWheels += CTimer::GetTimeStepInMilliseconds();
|
||||
m_nDistanceCarTravelledOnTwoWheels += car->m_fDistanceTravelled;
|
||||
m_nCancelWheelStuntTimer = Max(0.0f, m_nCancelWheelStuntTimer - CTimer::GetTimeStepInMilliseconds() * 0.5f);
|
||||
|
||||
} else {
|
||||
if (m_nTimeCarSpentOnTwoWheels != 0 && m_nCancelWheelStuntTimer < 500) {
|
||||
m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds();
|
||||
} else {
|
||||
if (m_nTimeCarSpentOnTwoWheels >= 2000) {
|
||||
m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels;
|
||||
m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels;
|
||||
if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000)
|
||||
CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000;
|
||||
if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels)
|
||||
CStats::Longest2WheelDist = m_nDistanceCarTravelledOnTwoWheels;
|
||||
}
|
||||
m_nTimeCarSpentOnTwoWheels = 0;
|
||||
m_nDistanceCarTravelledOnTwoWheels = 0;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
}
|
||||
}
|
||||
} else if (car->m_aSuspensionSpringRatioPrev[0] == 1.0f && car->m_aSuspensionSpringRatioPrev[1] == 1.0f) {
|
||||
#ifdef FIX_BUGS
|
||||
if (car->m_aSuspensionSpringRatioPrev[2] < 1.f
|
||||
#else
|
||||
if (car->m_aSuspensionSpringRatioPrev[1] < 1.f
|
||||
#endif
|
||||
&& car->m_aSuspensionSpringRatioPrev[3] < 1.f && 0.0f == car->m_fDamageImpulse) {
|
||||
m_nTimeCarSpentOnTwoWheels += CTimer::GetTimeStepInMilliseconds();
|
||||
m_nDistanceCarTravelledOnTwoWheels += car->m_fDistanceTravelled;
|
||||
m_nCancelWheelStuntTimer = Max(0.0f, m_nCancelWheelStuntTimer - CTimer::GetTimeStepInMilliseconds() * 0.2f);
|
||||
|
||||
} else if (m_nTimeCarSpentOnTwoWheels != 0 && m_nCancelWheelStuntTimer < 500) {
|
||||
m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds();
|
||||
|
||||
} else {
|
||||
if (m_nTimeCarSpentOnTwoWheels >= 2000) {
|
||||
m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels;
|
||||
m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels;
|
||||
if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000)
|
||||
CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000;
|
||||
if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels)
|
||||
CStats::Longest2WheelDist = m_nDistanceCarTravelledOnTwoWheels;
|
||||
}
|
||||
m_nTimeCarSpentOnTwoWheels = 0;
|
||||
m_nDistanceCarTravelledOnTwoWheels = 0;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
}
|
||||
} else if (m_nTimeCarSpentOnTwoWheels != 0) {
|
||||
if (m_nTimeCarSpentOnTwoWheels >= 2000) {
|
||||
m_nLastTimeCarSpentOnTwoWheels = m_nTimeCarSpentOnTwoWheels;
|
||||
m_nLastDistanceCarTravelledOnTwoWheels = m_nDistanceCarTravelledOnTwoWheels;
|
||||
if (CStats::Longest2Wheel < m_nTimeCarSpentOnTwoWheels / 1000)
|
||||
CStats::Longest2Wheel = m_nTimeCarSpentOnTwoWheels / 1000;
|
||||
if (CStats::Longest2WheelDist < m_nDistanceCarTravelledOnTwoWheels)
|
||||
CStats::Longest2WheelDist = m_nDistanceCarTravelledOnTwoWheels;
|
||||
}
|
||||
m_nTimeCarSpentOnTwoWheels = 0;
|
||||
m_nDistanceCarTravelledOnTwoWheels = 0;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
}
|
||||
m_nTimeSpentOnWheelie = 0;
|
||||
m_nTimeSpentOnStoppie = 0;
|
||||
} else if (m_pPed->m_pMyVehicle->IsBike()) {
|
||||
CBike *bike = (CBike*)m_pPed->m_pMyVehicle;
|
||||
if (bike->m_aSuspensionSpringRatioPrev[0] == 1.0f && bike->m_aSuspensionSpringRatioPrev[1] == 1.0f) {
|
||||
if (bike->m_aSuspensionSpringRatioPrev[2] < 1.0f
|
||||
|| (bike->m_aSuspensionSpringRatioPrev[3] < 1.0f && 0.0f == bike->m_fDamageImpulse)) {
|
||||
m_nTimeSpentOnWheelie += CTimer::GetTimeStepInMilliseconds();
|
||||
m_nDistanceTravelledOnWheelie += bike->m_fDistanceTravelled;
|
||||
m_nCancelWheelStuntTimer = Max(0.0f, m_nCancelWheelStuntTimer - CTimer::GetTimeStepInMilliseconds() * 0.2f);
|
||||
|
||||
} else {
|
||||
if (m_nTimeSpentOnWheelie != 0 && m_nCancelWheelStuntTimer < 500) {
|
||||
m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds();
|
||||
} else {
|
||||
if (m_nTimeSpentOnWheelie >= 5000) {
|
||||
m_nLastTimeSpentOnWheelie = m_nTimeSpentOnWheelie;
|
||||
m_nLastDistanceTravelledOnWheelie = m_nDistanceTravelledOnWheelie;
|
||||
if (CStats::LongestWheelie < m_nTimeSpentOnWheelie / 1000)
|
||||
CStats::LongestWheelie = m_nTimeSpentOnWheelie / 1000;
|
||||
if (CStats::LongestWheelieDist < m_nDistanceTravelledOnWheelie)
|
||||
CStats::LongestWheelieDist = m_nDistanceTravelledOnWheelie;
|
||||
}
|
||||
m_nTimeSpentOnWheelie = 0;
|
||||
m_nDistanceTravelledOnWheelie = 0;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
}
|
||||
}
|
||||
} else if (m_nTimeSpentOnWheelie != 0) {
|
||||
if (m_nTimeSpentOnWheelie >= 5000) {
|
||||
m_nLastTimeSpentOnWheelie = m_nTimeSpentOnWheelie;
|
||||
m_nLastDistanceTravelledOnWheelie = m_nDistanceTravelledOnWheelie;
|
||||
if (CStats::LongestWheelie < m_nTimeSpentOnWheelie / 1000)
|
||||
CStats::LongestWheelie = m_nTimeSpentOnWheelie / 1000;
|
||||
if (CStats::LongestWheelieDist < m_nDistanceTravelledOnWheelie)
|
||||
CStats::LongestWheelieDist = m_nDistanceTravelledOnWheelie;
|
||||
}
|
||||
m_nTimeSpentOnWheelie = 0;
|
||||
m_nDistanceTravelledOnWheelie = 0;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
|
||||
} else if (bike->m_aSuspensionSpringRatioPrev[2] == 1.0f && bike->m_aSuspensionSpringRatioPrev[3] == 1.0f
|
||||
&& 0.0f == bike->m_fDamageImpulse) {
|
||||
m_nTimeSpentOnStoppie += CTimer::GetTimeStepInMilliseconds();
|
||||
m_nDistanceTravelledOnStoppie += bike->m_fDistanceTravelled;
|
||||
m_nCancelWheelStuntTimer = Max(0.0f, m_nCancelWheelStuntTimer - CTimer::GetTimeStepInMilliseconds() * 0.2f);
|
||||
|
||||
} else {
|
||||
if (m_nTimeSpentOnStoppie != 0 && m_nCancelWheelStuntTimer < 500) {
|
||||
m_nCancelWheelStuntTimer += CTimer::GetTimeStepInMilliseconds();
|
||||
} else {
|
||||
if (m_nTimeSpentOnStoppie >= 2000) {
|
||||
m_nLastTimeSpentOnStoppie = m_nTimeSpentOnStoppie;
|
||||
m_nLastDistanceTravelledOnStoppie = m_nDistanceTravelledOnStoppie;
|
||||
if (CStats::LongestStoppie < m_nTimeSpentOnStoppie / 1000)
|
||||
CStats::LongestStoppie = m_nTimeSpentOnStoppie / 1000;
|
||||
if (CStats::LongestStoppieDist < m_nDistanceTravelledOnStoppie)
|
||||
CStats::LongestStoppieDist = m_nDistanceTravelledOnStoppie;
|
||||
}
|
||||
m_nTimeSpentOnStoppie = 0;
|
||||
m_nDistanceTravelledOnStoppie = 0;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
}
|
||||
}
|
||||
m_nTimeCarSpentOnTwoWheels = 0;
|
||||
m_nTimeNotFullyOnGround = 0;
|
||||
} else {
|
||||
m_nTimeCarSpentOnTwoWheels = 0;
|
||||
m_nTimeNotFullyOnGround = 0;
|
||||
m_nTimeSpentOnWheelie = 0;
|
||||
m_nTimeSpentOnStoppie = 0;
|
||||
m_nCancelWheelStuntTimer = 0;
|
||||
}
|
||||
|
||||
// The effect that makes money counter does while earning/losing money
|
||||
if (m_nVisibleMoney != m_nMoney) {
|
||||
int diff = m_nMoney - m_nVisibleMoney;
|
||||
@ -395,7 +569,7 @@ CPlayerInfo::Process(void)
|
||||
m_fRoadDensity = ThePaths.CalcRoadDensity(playerPos.x, playerPos.y);
|
||||
}
|
||||
|
||||
m_fRoadDensity = clamp(m_fRoadDensity, 0.4f, 1.45f);
|
||||
m_fRoadDensity = clamp(m_fRoadDensity, 0.5f, 1.45f);
|
||||
|
||||
// Because vehicle enter/exit use same key binding.
|
||||
bool enterOrExitVeh;
|
||||
@ -404,39 +578,31 @@ CPlayerInfo::Process(void)
|
||||
else
|
||||
enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();
|
||||
|
||||
if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) {
|
||||
if (enterOrExitVeh && m_pPed->m_nPedState != PED_ANSWER_MOBILE && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) {
|
||||
if (m_pPed->bInVehicle) {
|
||||
if (!m_pRemoteVehicle) {
|
||||
CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;
|
||||
if (!surfaceBelowVeh || !CBridge::ThisIsABridgeObjectMovingUp(surfaceBelowVeh->GetModelIndex())) {
|
||||
CVehicle *veh = m_pPed->m_pMyVehicle;
|
||||
if (!veh->IsBoat() || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
|
||||
|
||||
// This condition will always return true, else block was probably WIP Miami code.
|
||||
if (veh->m_vehType != VEHICLE_TYPE_BIKE || veh->m_nDoorLock == CARLOCK_LOCKED_PLAYER_INSIDE) {
|
||||
if (veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) {
|
||||
if (veh->m_vecMoveSpeed.Magnitude() < 0.17f && CTimer::GetTimeScale() >= 0.5f && !veh->bIsInWater) {
|
||||
m_pPed->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
|
||||
}
|
||||
if (veh->GetStatus() != STATUS_WRECKED && veh->GetStatus() != STATUS_TRAIN_MOVING && veh->m_nDoorLock != CARLOCK_LOCKED_PLAYER_INSIDE) {
|
||||
bool canJumpOff = false;
|
||||
if (veh->m_vehType == VEHICLE_TYPE_BIKE) {
|
||||
canJumpOff = veh->CanPedJumpOffBike();
|
||||
} else if (veh->pDriver == m_pPed) {
|
||||
canJumpOff = veh->CanPedJumpOutCar();
|
||||
}
|
||||
} else {
|
||||
CVector sth = 0.7f * veh->GetRight() + veh->GetPosition();
|
||||
bool found = false;
|
||||
float groundZ = CWorld::FindGroundZFor3DCoord(sth.x, sth.y, 2.0f + sth.z, &found);
|
||||
|
||||
if (found)
|
||||
sth.z = 1.0f + groundZ;
|
||||
m_pPed->m_nPedState = PED_IDLE;
|
||||
m_pPed->SetMoveState(PEDMOVE_STILL);
|
||||
CPed::PedSetOutCarCB(0, m_pPed);
|
||||
CAnimManager::BlendAnimation(m_pPed->GetClump(), m_pPed->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
|
||||
CAnimManager::BlendAnimation(m_pPed->GetClump(), ASSOCGRP_STD, ANIM_FALL_LAND, 100.0f);
|
||||
m_pPed->SetPosition(sth);
|
||||
m_pPed->SetMoveState(PEDMOVE_STILL);
|
||||
m_pPed->m_vecMoveSpeed = veh->m_vecMoveSpeed;
|
||||
if (canJumpOff || veh->m_vecMoveSpeed.Magnitude() < 0.1f) {
|
||||
if (!veh->bIsInWater)
|
||||
m_pPed->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
|
||||
|
||||
} else if (veh->GetStatus() != STATUS_PLAYER && veh != CGameLogic::pShortCutTaxi) {
|
||||
veh->AutoPilot.m_nTempAction = TEMPACT_WAIT;
|
||||
veh->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// The code in here was under CPed::SetExitBoat in VC, did the same for here.
|
||||
m_pPed->SetExitBoat(veh);
|
||||
m_pPed->bTryingToReachDryLand = true;
|
||||
}
|
||||
@ -451,14 +617,10 @@ CPlayerInfo::Process(void)
|
||||
CEntity *surfaceBelow = m_pPed->m_pCurrentPhysSurface;
|
||||
if (surfaceBelow && surfaceBelow->IsVehicle()) {
|
||||
carBelow = (CVehicle*)surfaceBelow;
|
||||
if (carBelow->IsBoat()) {
|
||||
if (carBelow->IsBoat() && carBelow->m_modelIndex != MI_SKIMMER) {
|
||||
weAreOnBoat = true;
|
||||
m_pPed->bOnBoat = true;
|
||||
#ifdef VC_PED_PORTS
|
||||
if (carBelow->GetStatus() != STATUS_WRECKED && carBelow->GetUp().z > 0.3f)
|
||||
#else
|
||||
if (carBelow->GetStatus() != STATUS_WRECKED)
|
||||
#endif
|
||||
m_pPed->SetSeekBoatPosition(carBelow);
|
||||
}
|
||||
}
|
||||
@ -506,14 +668,15 @@ CPlayerInfo::Process(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_bInRemoteMode) {
|
||||
uint32 timeWithoutRemoteCar = CTimer::GetTimeInMilliseconds() - m_nTimeLostRemoteCar;
|
||||
if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING) {
|
||||
if (CTimer::GetPreviousTimeInMilliseconds() - m_nTimeLostRemoteCar < 1000 && timeWithoutRemoteCar >= 1000 && m_WBState == WBSTATE_PLAYING && field_D6) {
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(1.0f, 0);
|
||||
}
|
||||
if (timeWithoutRemoteCar > 2000) {
|
||||
if (m_WBState == WBSTATE_PLAYING) {
|
||||
if (m_WBState == WBSTATE_PLAYING && field_D6) {
|
||||
TheCamera.RestoreWithJumpCut();
|
||||
TheCamera.SetFadeColour(0, 0, 0);
|
||||
TheCamera.Fade(1.0f, 1);
|
||||
@ -525,6 +688,7 @@ CPlayerInfo::Process(void)
|
||||
CTimer::Update();
|
||||
}
|
||||
m_bInRemoteMode = false;
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle->bRemoveFromWorld = true;
|
||||
CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle = nil;
|
||||
if (FindPlayerVehicle()) {
|
||||
FindPlayerVehicle()->SetStatus(STATUS_PLAYER);
|
||||
@ -534,11 +698,10 @@ CPlayerInfo::Process(void)
|
||||
if (!(CTimer::GetFrameCounter() & 31)) {
|
||||
CVehicle *veh = FindPlayerVehicle();
|
||||
if (veh && m_pPed->bInVehicle && veh->GetUp().z < 0.0f
|
||||
&& veh->m_vecMoveSpeed.Magnitude() < 0.05f && veh->IsCar() && !veh->bIsInWater) {
|
||||
&& veh->m_vecMoveSpeed.Magnitude() < 0.05f && (veh->IsCar() || veh->IsBoat()) && !veh->bIsInWater) {
|
||||
|
||||
if (veh->GetUp().z < -0.5f) {
|
||||
m_nUpsideDownCounter += 2;
|
||||
|
||||
} else {
|
||||
m_nUpsideDownCounter++;
|
||||
}
|
||||
@ -562,8 +725,74 @@ CPlayerInfo::Process(void)
|
||||
if (veh->pPassengers[i])
|
||||
veh->pPassengers[i]->m_nZoneLevel = LEVEL_GENERIC;
|
||||
}
|
||||
CStats::DistanceTravelledInVehicle += veh->m_fDistanceTravelled;
|
||||
if(veh->m_modelIndex == MI_CADDY)
|
||||
CStats::DistanceTravelledByGolfCart += veh->m_fDistanceTravelled;
|
||||
else {
|
||||
if(veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI)
|
||||
CStats::DistanceTravelledByHelicoptor += veh->m_fDistanceTravelled;
|
||||
if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE)
|
||||
CStats::DistanceTravelledByPlane += veh->m_fDistanceTravelled;
|
||||
if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR)
|
||||
CStats::DistanceTravelledByCar += veh->m_fDistanceTravelled;
|
||||
if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE)
|
||||
CStats::DistanceTravelledByBike += veh->m_fDistanceTravelled;
|
||||
if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT)
|
||||
CStats::DistanceTravelledByBoat += veh->m_fDistanceTravelled;
|
||||
|
||||
if (veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_PLANE) {
|
||||
if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) {
|
||||
CStats::FlightTime += CTimer::GetTimeStep() * 16.f; // what a weird choice
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
CStats::DistanceTravelledOnFoot += FindPlayerPed()->m_fDistanceTravelled;
|
||||
}
|
||||
|
||||
if (m_pPed->m_pWanted->m_nWantedLevel && !CTheScripts::IsPlayerOnAMission()) {
|
||||
float maxDelta = 0.0f;
|
||||
static bool movedSignificantly = true;
|
||||
static bool thereIsACarPathNear = true;
|
||||
// there was one more guard without variable's itself???
|
||||
|
||||
if (CTimer::GetTimeInMilliseconds() / 20000 != CTimer::GetPreviousTimeInMilliseconds() / 20000) {
|
||||
float posChange = (lastPlayerPos - FindPlayerCoors()).Magnitude();
|
||||
movedSignificantly = posChange >= 10.0f;
|
||||
lastPlayerPos = FindPlayerCoors();
|
||||
thereIsACarPathNear = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 60.0f, true, false, false, false) != 0;
|
||||
}
|
||||
switch (m_pPed->m_pWanted->m_nWantedLevel) {
|
||||
case 1:
|
||||
maxDelta = 31.f;
|
||||
break;
|
||||
case 2:
|
||||
maxDelta = 62.f;
|
||||
break;
|
||||
case 3:
|
||||
maxDelta = 125.f;
|
||||
break;
|
||||
case 4:
|
||||
maxDelta = 250.f;
|
||||
break;
|
||||
case 5:
|
||||
maxDelta = 500.f;
|
||||
break;
|
||||
case 6:
|
||||
maxDelta = 1000.f;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
float increaseDelta = maxDelta - m_fMediaAttention;
|
||||
float increaseAttentionBy = CTimer::GetTimeStep() * 0.0001f * increaseDelta;
|
||||
if (increaseAttentionBy < 0.0f
|
||||
|| movedSignificantly && thereIsACarPathNear && !CCullZones::NoPolice() && !CCullZones::PoliceAbandonCars() && CGame::currArea == AREA_MAIN_MAP) {
|
||||
m_fMediaAttention += increaseAttentionBy;
|
||||
}
|
||||
} else {
|
||||
m_fMediaAttention = 0.0f;
|
||||
}
|
||||
CStats::HighestChaseValue = Max(m_fMediaAttention, CStats::HighestChaseValue);
|
||||
m_nMoney = Min(999999999, m_nMoney);
|
||||
m_nVisibleMoney = Min(999999999, m_nVisibleMoney);
|
||||
}
|
||||
|
@ -45,19 +45,33 @@ public:
|
||||
int8 m_WBState; // eWastedBustedState
|
||||
uint32 m_nWBTime;
|
||||
bool m_bInRemoteMode;
|
||||
bool field_D5;
|
||||
bool field_D6;
|
||||
uint32 m_nTimeLostRemoteCar;
|
||||
uint32 m_nTimeLastHealthLoss;
|
||||
uint32 m_nTimeLastArmourLoss;
|
||||
uint32 m_nTimeTankShotGun;
|
||||
int32 m_nTimeNotFullyOnGround;
|
||||
int32 m_nUpsideDownCounter;
|
||||
int32 field_248;
|
||||
int32 field_EC;
|
||||
int32 m_nTimeCarSpentOnTwoWheels;
|
||||
int32 m_nDistanceCarTravelledOnTwoWheels;
|
||||
int32 m_nTimeNotFullyOnGround;
|
||||
int32 m_nTimeSpentOnWheelie;
|
||||
float m_nDistanceTravelledOnWheelie;
|
||||
int32 m_nTimeSpentOnStoppie;
|
||||
float m_nDistanceTravelledOnStoppie;
|
||||
int32 m_nCancelWheelStuntTimer;
|
||||
int32 m_nLastTimeCarSpentOnTwoWheels;
|
||||
int32 m_nLastDistanceCarTravelledOnTwoWheels;
|
||||
int32 m_nLastTimeSpentOnWheelie;
|
||||
int32 m_nLastDistanceTravelledOnWheelie;
|
||||
int32 m_nLastTimeSpentOnStoppie;
|
||||
int32 m_nLastDistanceTravelledOnStoppie;
|
||||
int16 m_nTrafficMultiplier;
|
||||
int16 field_12A;
|
||||
float m_fRoadDensity;
|
||||
uint32 m_nPreviousTimeRewardedForExplosion;
|
||||
int32 m_nExplosionsSinceLastReward;
|
||||
int32 field_268;
|
||||
int32 field_272;
|
||||
uint32 m_nExplosionsSinceLastReward;
|
||||
uint32 m_nHavocLevel;
|
||||
float m_fMediaAttention;
|
||||
bool m_bInfiniteSprint;
|
||||
@ -76,7 +90,6 @@ public:
|
||||
void MakePlayerSafe(bool);
|
||||
void LoadPlayerSkin();
|
||||
void DeletePlayerSkin();
|
||||
void AwardMoneyForExplosion(CVehicle *vehicle);
|
||||
void SetPlayerSkin(char* skin);
|
||||
const CVector &GetPos();
|
||||
void Process(void);
|
||||
|
@ -22,21 +22,25 @@ CTreadablePool *CPools::ms_pTreadablePool;
|
||||
CObjectPool *CPools::ms_pObjectPool;
|
||||
CDummyPool *CPools::ms_pDummyPool;
|
||||
CAudioScriptObjectPool *CPools::ms_pAudioScriptObjectPool;
|
||||
CColModelPool *CPools::ms_pColModelPool;
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CPools::Initialise(void)
|
||||
{
|
||||
ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES);
|
||||
ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS);
|
||||
ms_pPedPool = new CPedPool(NUMPEDS);
|
||||
ms_pVehiclePool = new CVehiclePool(NUMVEHICLES);
|
||||
ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS);
|
||||
ms_pTreadablePool = new CTreadablePool(NUMTREADABLES);
|
||||
ms_pObjectPool = new CObjectPool(NUMOBJECTS);
|
||||
ms_pDummyPool = new CDummyPool(NUMDUMMIES);
|
||||
ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS);
|
||||
ms_pPtrNodePool = new CCPtrNodePool(NUMPTRNODES, "PtrNode");
|
||||
ms_pEntryInfoNodePool = new CEntryInfoNodePool(NUMENTRYINFOS, "EntryInfoNode");
|
||||
ms_pPedPool = new CPedPool(NUMPEDS, "Peds");
|
||||
ms_pVehiclePool = new CVehiclePool(NUMVEHICLES, "Vehicles");
|
||||
ms_pBuildingPool = new CBuildingPool(NUMBUILDINGS, "Buildings");
|
||||
ms_pTreadablePool = new CTreadablePool(NUMTREADABLES, "Treadables");
|
||||
ms_pObjectPool = new CObjectPool(NUMOBJECTS, "Objects");
|
||||
ms_pDummyPool = new CDummyPool(NUMDUMMIES, "Dummys");
|
||||
ms_pAudioScriptObjectPool = new CAudioScriptObjectPool(NUMAUDIOSCRIPTOBJECTS, "AudioScriptObj");
|
||||
ms_pColModelPool = new CColModelPool(NUMCOLMODELS, "ColModel");
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CPools::ShutDown(void)
|
||||
{
|
||||
@ -49,6 +53,7 @@ CPools::ShutDown(void)
|
||||
debug("Objects left %d\n", ms_pObjectPool->GetNoOfUsedSpaces());
|
||||
debug("Dummys left %d\n", ms_pDummyPool->GetNoOfUsedSpaces());
|
||||
debug("AudioScriptObjects left %d\n", ms_pAudioScriptObjectPool->GetNoOfUsedSpaces());
|
||||
debug("ColModels left %d\n", ms_pColModelPool->GetNoOfUsedSpaces());
|
||||
printf("Shutdown pool started\n");
|
||||
|
||||
delete ms_pPtrNodePool;
|
||||
@ -60,6 +65,7 @@ CPools::ShutDown(void)
|
||||
delete ms_pObjectPool;
|
||||
delete ms_pDummyPool;
|
||||
delete ms_pAudioScriptObjectPool;
|
||||
delete ms_pColModelPool;
|
||||
|
||||
printf("Shutdown pool done\n");
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ typedef CPool<CTreadable> CTreadablePool;
|
||||
typedef CPool<CObject, CCutsceneObject> CObjectPool;
|
||||
typedef CPool<CDummy, CDummyPed> CDummyPool;
|
||||
typedef CPool<cAudioScriptObject> CAudioScriptObjectPool;
|
||||
typedef CPool<CColModel> CColModelPool;
|
||||
|
||||
class CPools
|
||||
{
|
||||
@ -31,6 +32,7 @@ class CPools
|
||||
static CObjectPool *ms_pObjectPool;
|
||||
static CDummyPool *ms_pDummyPool;
|
||||
static CAudioScriptObjectPool *ms_pAudioScriptObjectPool;
|
||||
static CColModelPool *ms_pColModelPool;
|
||||
public:
|
||||
static CCPtrNodePool *GetPtrNodePool(void) { return ms_pPtrNodePool; }
|
||||
static CEntryInfoNodePool *GetEntryInfoNodePool(void) { return ms_pEntryInfoNodePool; }
|
||||
@ -41,6 +43,7 @@ public:
|
||||
static CObjectPool *GetObjectPool(void) { return ms_pObjectPool; }
|
||||
static CDummyPool *GetDummyPool(void) { return ms_pDummyPool; }
|
||||
static CAudioScriptObjectPool *GetAudioScriptObjectPool(void) { return ms_pAudioScriptObjectPool; }
|
||||
static CColModelPool *GetColModelPool(void) { return ms_pColModelPool; }
|
||||
|
||||
static void Initialise(void);
|
||||
static void ShutDown(void);
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define COORDBLIP_MARKER_COLOR_R 252
|
||||
#define COORDBLIP_MARKER_COLOR_G 138
|
||||
#define COORDBLIP_MARKER_COLOR_B 242
|
||||
#define COORDBLIP_MARKER_COLOR_A 255
|
||||
#define COORDBLIP_MARKER_COLOR_A 228
|
||||
|
||||
#define NUM_MAP_LEGENDS 75
|
||||
|
||||
|
@ -3,12 +3,14 @@
|
||||
#include "Stats.h"
|
||||
#include "Text.h"
|
||||
#include "World.h"
|
||||
#include "Pad.h"
|
||||
|
||||
#include <climits>
|
||||
|
||||
//TODO
|
||||
int32 CStats::SeagullsKilled;
|
||||
|
||||
int32 CStats::BoatsExploded;
|
||||
int32 CStats::WantedStarsAttained;
|
||||
int32 CStats::WantedStarsEvaded;
|
||||
int32 CStats::DaysPassed;
|
||||
int32 CStats::HeadsPopped;
|
||||
int32 CStats::CommercialPassed;
|
||||
@ -21,8 +23,25 @@ int32 CStats::PedsKilledOfThisType[NUM_PEDTYPES];
|
||||
int32 CStats::TimesDied;
|
||||
int32 CStats::TimesArrested;
|
||||
int32 CStats::KillsSinceLastCheckpoint;
|
||||
float CStats::DistanceTravelledInVehicle;
|
||||
float CStats::DistanceTravelledByCar;
|
||||
float CStats::DistanceTravelledByHelicoptor;
|
||||
float CStats::DistanceTravelledByBike;
|
||||
float CStats::DistanceTravelledByBoat;
|
||||
float CStats::DistanceTravelledByPlane;
|
||||
float CStats::DistanceTravelledByGolfCart;
|
||||
float CStats::DistanceTravelledOnFoot;
|
||||
int32 CStats::FlightTime;
|
||||
int32 CStats::TimesDrowned;
|
||||
int32 CStats::PhotosTaken;
|
||||
float CStats::LoanSharks;
|
||||
float CStats::StoresKnockedOff;
|
||||
float CStats::MovieStunts;
|
||||
float CStats::Assassinations;
|
||||
float CStats::PizzasDelivered;
|
||||
float CStats::GarbagePickups;
|
||||
float CStats::IceCreamSold;
|
||||
float CStats::TopShootingRangeScore;
|
||||
float CStats::ShootingRank;
|
||||
int32 CStats::ProgressMade;
|
||||
int32 CStats::TotalProgressInGame;
|
||||
int32 CStats::CarsExploded;
|
||||
@ -40,94 +59,155 @@ int32 CStats::MissionsGiven;
|
||||
int32 CStats::MissionsPassed;
|
||||
char CStats::LastMissionPassedName[8];
|
||||
int32 CStats::TotalLegitimateKills;
|
||||
int32 CStats::ElBurroTime;
|
||||
int32 CStats::Record4x4One;
|
||||
int32 CStats::Record4x4Two;
|
||||
int32 CStats::Record4x4Three;
|
||||
int32 CStats::Record4x4Mayhem;
|
||||
int32 CStats::LivesSavedWithAmbulance;
|
||||
int32 CStats::CriminalsCaught;
|
||||
int32 CStats::HighestLevelAmbulanceMission;
|
||||
int32 CStats::HighestLevelVigilanteMission;
|
||||
int32 CStats::HighestLevelFireMission;
|
||||
int32 CStats::FiresExtinguished;
|
||||
int32 CStats::TimeTakenDefuseMission;
|
||||
int32 CStats::TotalNumberKillFrenzies;
|
||||
int32 CStats::TotalNumberMissions;
|
||||
int32 CStats::RoundsFiredByPlayer;
|
||||
int32 CStats::KgsOfExplosivesUsed;
|
||||
int32 CStats::InstantHitsFiredByPlayer;
|
||||
int32 CStats::InstantHitsHitByPlayer;
|
||||
int32 CStats::BulletsThatHit;
|
||||
int32 CStats::BestTimeBombDefusal;
|
||||
int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES];
|
||||
int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
|
||||
int32 CStats::BestPositions[CStats::TOTAL_BEST_POSITIONS];
|
||||
bool CStats::PropertyOwned[CStats::TOTAL_PROPERTIES];
|
||||
int32 CStats::NumPropertyOwned;
|
||||
int32 CStats::PropertyDestroyed;
|
||||
float CStats::HighestChaseValue;
|
||||
int32 CStats::CheatedCount;
|
||||
int32 CStats::ShowChaseStatOnScreen;
|
||||
int32 CStats::PamphletMissionPassed;
|
||||
bool CStats::abSonyCDs[1];
|
||||
int32 CStats::BloodRingKills;
|
||||
int32 CStats::BloodRingTime;
|
||||
float CStats::FavoriteRadioStationList[NUM_RADIOS];
|
||||
|
||||
int32 CStats::Sprayings;
|
||||
float CStats::AutoPaintingBudget;
|
||||
int32 CStats::NoMoreHurricanes;
|
||||
float CStats::FashionBudget;
|
||||
float CStats::PropertyBudget;
|
||||
float CStats::WeaponBudget;
|
||||
int32 CStats::SafeHouseVisits;
|
||||
int32 CStats::TyresPopped;
|
||||
|
||||
int32 CStats::LongestWheelie;
|
||||
int32 CStats::LongestStoppie;
|
||||
int32 CStats::Longest2Wheel;
|
||||
float CStats::LongestWheelieDist;
|
||||
float CStats::LongestStoppieDist;
|
||||
float CStats::Longest2WheelDist;
|
||||
|
||||
// --MIAMI: functions below are done except TODOs, but there are some to be moved from Frontend
|
||||
|
||||
void CStats::Init()
|
||||
{
|
||||
PeopleKilledByOthers = 0;
|
||||
PeopleKilledByPlayer = 0;
|
||||
RoundsFiredByPlayer = 0;
|
||||
CarsExploded = 0;
|
||||
BoatsExploded = 0;
|
||||
RoundsFiredByPlayer = 0;
|
||||
for (int i = 0; i < NUM_PEDTYPES; i++)
|
||||
PedsKilledOfThisType[i] = 0;
|
||||
HelisDestroyed = 0;
|
||||
ProgressMade = 0;
|
||||
KgsOfExplosivesUsed = 0;
|
||||
InstantHitsFiredByPlayer = 0;
|
||||
InstantHitsHitByPlayer = 0;
|
||||
BulletsThatHit = 0;
|
||||
TyresPopped = 0;
|
||||
HeadsPopped = 0;
|
||||
WantedStarsAttained = 0;
|
||||
WantedStarsEvaded = 0;
|
||||
TimesArrested = 0;
|
||||
TimesDied = 0;
|
||||
DaysPassed = 0;
|
||||
NumberOfUniqueJumpsFound = 0;
|
||||
MaximumJumpFlips = 0;
|
||||
MaximumJumpSpins = 0;
|
||||
SafeHouseVisits = 0;
|
||||
Sprayings = 0;
|
||||
MaximumJumpDistance = 0;
|
||||
MaximumJumpHeight = 0;
|
||||
MaximumJumpFlips = 0;
|
||||
MaximumJumpSpins = 0;
|
||||
BestStuntJump = 0;
|
||||
NumberOfUniqueJumpsFound = 0;
|
||||
TotalNumberOfUniqueJumps = 0;
|
||||
Record4x4One = 0;
|
||||
Record4x4Two = 0;
|
||||
PassengersDroppedOffWithTaxi = 0;
|
||||
Record4x4Three = 0;
|
||||
MoneyMadeWithTaxi = 0;
|
||||
Record4x4Mayhem = 0;
|
||||
LivesSavedWithAmbulance = 0;
|
||||
ElBurroTime = 0;
|
||||
CriminalsCaught = 0;
|
||||
MissionsGiven = 0;
|
||||
HighestLevelAmbulanceMission = 0;
|
||||
MissionsPassed = 0;
|
||||
FiresExtinguished = 0;
|
||||
PassengersDroppedOffWithTaxi = 0;
|
||||
MoneyMadeWithTaxi = 0;
|
||||
DistanceTravelledOnFoot = 0;
|
||||
TimeTakenDefuseMission = 0;
|
||||
DistanceTravelledByCar = 0;
|
||||
DistanceTravelledByBike = 0;
|
||||
DistanceTravelledByBoat = 0;
|
||||
DistanceTravelledByGolfCart = 0;
|
||||
DistanceTravelledByHelicoptor = 0;
|
||||
#ifdef FIX_BUGS
|
||||
DistanceTravelledByPlane = 0;
|
||||
#endif
|
||||
LivesSavedWithAmbulance = 0;
|
||||
CriminalsCaught = 0;
|
||||
HighestLevelVigilanteMission = 0;
|
||||
HighestLevelAmbulanceMission = 0;
|
||||
HighestLevelFireMission = 0;
|
||||
FiresExtinguished = 0;
|
||||
PhotosTaken = 0;
|
||||
NumberKillFrenziesPassed = 0;
|
||||
DistanceTravelledInVehicle = 0;
|
||||
TotalNumberKillFrenzies = 0;
|
||||
TotalNumberMissions = 0;
|
||||
KillsSinceLastCheckpoint = 0;
|
||||
TotalLegitimateKills = 0;
|
||||
FlightTime = 0;
|
||||
TimesDrowned = 0;
|
||||
SeagullsKilled = 0;
|
||||
WeaponBudget = 0.0f;
|
||||
FashionBudget = 0.0f;
|
||||
LoanSharks = 0.0f;
|
||||
StoresKnockedOff = 0.0f;
|
||||
MovieStunts = 0.0f;
|
||||
Assassinations = 0.0f;
|
||||
PizzasDelivered = 0.0f;
|
||||
GarbagePickups = 0.0f;
|
||||
IceCreamSold = 0.0f;
|
||||
TopShootingRangeScore = 0.0f;
|
||||
ShootingRank = 0.0f;
|
||||
LongestWheelie = 0;
|
||||
LongestStoppie = 0;
|
||||
Longest2Wheel = 0;
|
||||
LongestWheelieDist = 0.0f;
|
||||
LongestStoppieDist = 0.0f;
|
||||
Longest2WheelDist = 0.0f;
|
||||
PropertyBudget = 0.0f;
|
||||
AutoPaintingBudget = 0.0f;
|
||||
PropertyDestroyed = 0;
|
||||
HighestChaseValue = 0.0f;
|
||||
CheatedCount = 0;
|
||||
|
||||
for (int i = 0; i < TOTAL_FASTEST_TIMES; i++)
|
||||
FastestTimes[i] = 0;
|
||||
for (int i = 0; i < TOTAL_HIGHEST_SCORES; i++)
|
||||
HighestScores[i] = 0;
|
||||
for (int i = 0; i < TOTAL_BEST_POSITIONS; i++)
|
||||
BestPositions[i] = INT_MAX;
|
||||
for (int i = 0; i < NUM_PEDTYPES; i++)
|
||||
PedsKilledOfThisType[i] = 0;
|
||||
|
||||
KillsSinceLastCheckpoint = 0;
|
||||
TotalLegitimateKills = 0;
|
||||
IndustrialPassed = 0;
|
||||
CommercialPassed = 0;
|
||||
SuburbanPassed = 0;
|
||||
|
||||
Sprayings = 0;
|
||||
AutoPaintingBudget = 0.0f;
|
||||
PamphletMissionPassed = 0;
|
||||
NoMoreHurricanes = 0;
|
||||
SafeHouseVisits = 0;
|
||||
ShowChaseStatOnScreen = 0;
|
||||
abSonyCDs[0] = 0;
|
||||
// TODO(Miami): Change this with PopulateFavoriteRadioStationList(); !!
|
||||
for (int i = 0; i < NUM_RADIOS; i++)
|
||||
FavoriteRadioStationList[i] = 0.0f;
|
||||
|
||||
NumPropertyOwned = 0;
|
||||
for (int i = 0; i < TOTAL_PROPERTIES; i++)
|
||||
PropertyOwned[i] = false;
|
||||
|
||||
BloodRingKills = 0;
|
||||
BloodRingTime = 0;
|
||||
}
|
||||
|
||||
void CStats::RegisterFastestTime(int32 index, int32 time)
|
||||
@ -151,31 +231,6 @@ void CStats::RegisterBestPosition(int32 index, int32 position)
|
||||
BestPositions[index] = Min(BestPositions[index], position);
|
||||
}
|
||||
|
||||
void CStats::RegisterElBurroTime(int32 time)
|
||||
{
|
||||
ElBurroTime = (ElBurroTime && ElBurroTime < time) ? ElBurroTime : time;
|
||||
}
|
||||
|
||||
void CStats::Register4x4OneTime(int32 time)
|
||||
{
|
||||
Record4x4One = (Record4x4One && Record4x4One < time) ? Record4x4One : time;
|
||||
}
|
||||
|
||||
void CStats::Register4x4TwoTime(int32 time)
|
||||
{
|
||||
Record4x4Two = (Record4x4Two && Record4x4Two < time) ? Record4x4Two : time;
|
||||
}
|
||||
|
||||
void CStats::Register4x4ThreeTime(int32 time)
|
||||
{
|
||||
Record4x4Three = (Record4x4Three && Record4x4Three < time) ? Record4x4Three : time;
|
||||
}
|
||||
|
||||
void CStats::Register4x4MayhemTime(int32 time)
|
||||
{
|
||||
Record4x4Mayhem = (Record4x4Mayhem && Record4x4Mayhem < time) ? Record4x4Mayhem : time;
|
||||
}
|
||||
|
||||
void CStats::AnotherLifeSavedWithAmbulance()
|
||||
{
|
||||
++LivesSavedWithAmbulance;
|
||||
@ -191,16 +246,21 @@ void CStats::RegisterLevelAmbulanceMission(int32 level)
|
||||
HighestLevelAmbulanceMission = Max(HighestLevelAmbulanceMission, level);
|
||||
}
|
||||
|
||||
void CStats::RegisterLevelVigilanteMission(int32 level)
|
||||
{
|
||||
HighestLevelVigilanteMission = Max(HighestLevelVigilanteMission, level);
|
||||
}
|
||||
|
||||
void CStats::RegisterLevelFireMission(int32 level)
|
||||
{
|
||||
HighestLevelFireMission = Max(HighestLevelFireMission, level);
|
||||
}
|
||||
|
||||
void CStats::AnotherFireExtinguished()
|
||||
{
|
||||
++FiresExtinguished;
|
||||
}
|
||||
|
||||
void CStats::RegisterTimeTakenDefuseMission(int32 time)
|
||||
{
|
||||
TimeTakenDefuseMission = (TimeTakenDefuseMission && TimeTakenDefuseMission < time) ? TimeTakenDefuseMission : time;
|
||||
}
|
||||
|
||||
void CStats::AnotherKillFrenzyPassed()
|
||||
{
|
||||
++NumberKillFrenziesPassed;
|
||||
@ -220,40 +280,88 @@ wchar *CStats::FindCriminalRatingString()
|
||||
{
|
||||
int rating = FindCriminalRatingNumber();
|
||||
|
||||
if (rating < 10) return TheText.Get("RATNG1");
|
||||
if (rating < 25) return TheText.Get("RATNG2");
|
||||
if (rating < 70) return TheText.Get("RATNG3");
|
||||
if (rating < 150) return TheText.Get("RATNG4");
|
||||
if (rating < 250) return TheText.Get("RATNG5");
|
||||
if (rating < 450) return TheText.Get("RATNG6");
|
||||
if (rating < 700) return TheText.Get("RATNG7");
|
||||
if (rating < 1000) return TheText.Get("RATNG8");
|
||||
if (rating < 1400) return TheText.Get("RATNG9");
|
||||
if (rating < 1900) return TheText.Get("RATNG10");
|
||||
if (rating < 2500) return TheText.Get("RATNG11");
|
||||
if (rating < 3200) return TheText.Get("RATNG12");
|
||||
if (rating < 4000) return TheText.Get("RATNG13");
|
||||
if (rating < 5000) return TheText.Get("RATNG14");
|
||||
return TheText.Get("RATNG15");
|
||||
if (rating < 0) {
|
||||
if (rating > -500) return TheText.Get("RATNG53");
|
||||
if (rating > -2000) return TheText.Get("RATNG54");
|
||||
if (rating > -4000) return TheText.Get("RATNG55");
|
||||
if (rating > -6000) return TheText.Get("RATNG56");
|
||||
return TheText.Get("RATNG57");
|
||||
}
|
||||
if (rating < 20) return TheText.Get("RATNG1");
|
||||
if (rating < 50) return TheText.Get("RATNG2");
|
||||
if (rating < 75) return TheText.Get("RATNG3");
|
||||
if (rating < 100) return TheText.Get("RATNG4");
|
||||
if (rating < 120) return TheText.Get("RATNG5");
|
||||
if (rating < 150) return TheText.Get("RATNG6");
|
||||
if (rating < 200) return TheText.Get("RATNG7");
|
||||
if (rating < 240) return TheText.Get("RATNG8");
|
||||
if (rating < 270) return TheText.Get("RATNG9");
|
||||
if (rating < 300) return TheText.Get("RATNG10");
|
||||
if (rating < 335) return TheText.Get("RATNG11");
|
||||
if (rating < 370) return TheText.Get("RATNG12");
|
||||
if (rating < 400) return TheText.Get("RATNG13");
|
||||
if (rating < 450) return TheText.Get("RATNG14");
|
||||
if (rating < 500) return TheText.Get("RATNG15");
|
||||
if (rating < 550) return TheText.Get("RATNG16");
|
||||
if (rating < 600) return TheText.Get("RATNG17");
|
||||
if (rating < 610) return TheText.Get("RATNG18");
|
||||
if (rating < 650) return TheText.Get("RATNG19");
|
||||
if (rating < 700) return TheText.Get("RATNG20");
|
||||
if (rating < 850) return TheText.Get("RATNG21");
|
||||
if (rating < 1000) return TheText.Get("RATNG22");
|
||||
if (rating < 1005) return TheText.Get("RATNG23");
|
||||
if (rating < 1150) return TheText.Get("RATNG24");
|
||||
if (rating < 1300) return TheText.Get(TimesArrested > 0 ? "RATNG25" : "RATNG24");
|
||||
if (rating < 1500) return TheText.Get("RATNG26");
|
||||
if (rating < 1700) return TheText.Get("RATNG27");
|
||||
if (rating < 2000) return TheText.Get("RATNG28");
|
||||
if (rating < 2100) return TheText.Get("RATNG29");
|
||||
if (rating < 2300) return TheText.Get("RATNG30");
|
||||
if (rating < 2500) return TheText.Get("RATNG31");
|
||||
if (rating < 2750) return TheText.Get("RATNG32");
|
||||
if (rating < 3000) return TheText.Get("RATNG33");
|
||||
if (rating < 3500) return TheText.Get("RATNG34");
|
||||
if (rating < 4000) return TheText.Get("RATNG35");
|
||||
if (rating < 5000) return TheText.Get("RATNG36");
|
||||
if (rating < 7500) return TheText.Get("RATNG37");
|
||||
if (rating < 10000) return TheText.Get("RATNG38");
|
||||
if (rating < 20000) return TheText.Get("RATNG39");
|
||||
if (rating < 30000) return TheText.Get("RATNG40");
|
||||
if (rating < 40000) return TheText.Get("RATNG41");
|
||||
if (rating < 50000) return TheText.Get("RATNG42");
|
||||
if (rating < 65000) return TheText.Get("RATNG43");
|
||||
if (rating < 80000) return TheText.Get("RATNG44");
|
||||
if (rating < 100000) return TheText.Get("RATNG45");
|
||||
if (rating < 150000) return TheText.Get("RATNG46");
|
||||
if (rating < 200000) return TheText.Get("RATNG47");
|
||||
if (rating < 300000) return TheText.Get("RATNG48");
|
||||
if (rating < 375000) return TheText.Get("RATNG49");
|
||||
if (rating < 500000) return TheText.Get(FlightTime / 60000 / 60 > 10 ? "RATNG50" : "RATNG49");
|
||||
if (rating < 1000000) return TheText.Get("RATNG51");
|
||||
return TheText.Get(CWorld::Players[CWorld::PlayerInFocus].m_nVisibleMoney > 10000000 ? "RATNG52" : "RATNG51");
|
||||
}
|
||||
|
||||
int32 CStats::FindCriminalRatingNumber()
|
||||
{
|
||||
int32 rating;
|
||||
|
||||
rating = FiresExtinguished + 10 * HighestLevelAmbulanceMission + CriminalsCaught + LivesSavedWithAmbulance
|
||||
rating = FiresExtinguished + 10 * HighestLevelFireMission + 10 * HighestLevelAmbulanceMission
|
||||
+ CriminalsCaught + LivesSavedWithAmbulance
|
||||
+ 30 * HelisDestroyed + TotalLegitimateKills - 3 * TimesArrested - 3 * TimesDied
|
||||
+ CWorld::Players[CWorld::PlayerInFocus].m_nMoney / 5000;
|
||||
if (rating <= 0) rating = 0;
|
||||
if (CPad::bHasPlayerCheated || CheatedCount > 0) {
|
||||
rating -= CheatedCount;
|
||||
if (rating <= -10000)
|
||||
rating = -10000;
|
||||
|
||||
if (InstantHitsFiredByPlayer > 100)
|
||||
rating += (float)CStats::InstantHitsHitByPlayer / (float)CStats::InstantHitsFiredByPlayer * 500.0f;
|
||||
} else if (rating <= 0) {
|
||||
rating = 0;
|
||||
}
|
||||
|
||||
if (RoundsFiredByPlayer > 100)
|
||||
rating += (float)CStats::BulletsThatHit / (float)CStats::RoundsFiredByPlayer * 500.0f;
|
||||
if (TotalProgressInGame)
|
||||
rating += (float)CStats::ProgressMade / (float)CStats::TotalProgressInGame * 1000.0f;
|
||||
if (!IndustrialPassed && rating >= 3521)
|
||||
rating = 3521;
|
||||
if (!CommercialPassed && rating >= 4552)
|
||||
rating = 4552;
|
||||
return rating;
|
||||
}
|
||||
|
||||
@ -265,11 +373,80 @@ float CStats::GetPercentageProgress()
|
||||
return Min(percentCompleted, 100.0f);
|
||||
}
|
||||
|
||||
void CStats::MoneySpentOnWeapons(int32 money)
|
||||
{
|
||||
WeaponBudget += money;
|
||||
}
|
||||
|
||||
void CStats::MoneySpentOnProperty(int32 money)
|
||||
{
|
||||
PropertyBudget += money;
|
||||
}
|
||||
|
||||
void CStats::MoneySpentOnAutoPainting(int32 money)
|
||||
{
|
||||
AutoPaintingBudget += money;
|
||||
}
|
||||
|
||||
void CStats::MoneySpentOnFashion(int32 money)
|
||||
{
|
||||
FashionBudget += money;
|
||||
}
|
||||
|
||||
void CStats::NumOfVisitsFromLoanSharks(int32 num)
|
||||
{
|
||||
LoanSharks += num;
|
||||
}
|
||||
|
||||
void CStats::NumOfStoresKnockedOff(int32 num)
|
||||
{
|
||||
StoresKnockedOff += num;
|
||||
}
|
||||
|
||||
void CStats::NumOfMovieStunts(int32 num)
|
||||
{
|
||||
MovieStunts += num;
|
||||
}
|
||||
|
||||
void CStats::NumOfAssassinations(int32 num)
|
||||
{
|
||||
Assassinations += num;
|
||||
}
|
||||
|
||||
void CStats::NumOfPizzasDelivered(int32 num)
|
||||
{
|
||||
PizzasDelivered += num;
|
||||
}
|
||||
|
||||
void CStats::NumOfGarbagePickups(int32 num)
|
||||
{
|
||||
GarbagePickups += num;
|
||||
}
|
||||
|
||||
void CStats::NumOfIceCreamSold(int32 num)
|
||||
{
|
||||
IceCreamSold += num;
|
||||
}
|
||||
|
||||
void CStats::AddNumBloodRingKills(int32 num)
|
||||
{
|
||||
BloodRingKills += num;
|
||||
}
|
||||
|
||||
void CStats::LongestTimeInBloodRing(int32 time)
|
||||
{
|
||||
if (BloodRingTime < time)
|
||||
BloodRingTime = time;
|
||||
}
|
||||
|
||||
void CStats::AddPropertyAsOwned(int32 id)
|
||||
{
|
||||
if (!PropertyOwned[id]) {
|
||||
PropertyOwned[id] = true;
|
||||
++NumPropertyOwned;
|
||||
}
|
||||
}
|
||||
|
||||
void CStats::SaveStats(uint8 *buf, uint32 *size)
|
||||
{
|
||||
CheckPointReachedSuccessfully();
|
||||
@ -277,18 +454,23 @@ void CStats::SaveStats(uint8 *buf, uint32 *size)
|
||||
*size = sizeof(PeopleKilledByPlayer) +
|
||||
sizeof(PeopleKilledByOthers) +
|
||||
sizeof(CarsExploded) +
|
||||
sizeof(BoatsExploded) +
|
||||
sizeof(TyresPopped) +
|
||||
sizeof(RoundsFiredByPlayer) +
|
||||
sizeof(PedsKilledOfThisType) +
|
||||
sizeof(HelisDestroyed) +
|
||||
sizeof(ProgressMade) +
|
||||
sizeof(TotalProgressInGame) +
|
||||
sizeof(KgsOfExplosivesUsed) +
|
||||
sizeof(InstantHitsFiredByPlayer) +
|
||||
sizeof(InstantHitsHitByPlayer) +
|
||||
sizeof(BulletsThatHit) +
|
||||
sizeof(HeadsPopped) +
|
||||
sizeof(WantedStarsAttained) +
|
||||
sizeof(WantedStarsEvaded) +
|
||||
sizeof(TimesArrested) +
|
||||
sizeof(TimesDied) +
|
||||
sizeof(DaysPassed) +
|
||||
sizeof(SafeHouseVisits) +
|
||||
sizeof(Sprayings) +
|
||||
sizeof(MaximumJumpDistance) +
|
||||
sizeof(MaximumJumpHeight) +
|
||||
sizeof(MaximumJumpFlips) +
|
||||
@ -297,50 +479,88 @@ void CStats::SaveStats(uint8 *buf, uint32 *size)
|
||||
sizeof(NumberOfUniqueJumpsFound) +
|
||||
sizeof(TotalNumberOfUniqueJumps) +
|
||||
sizeof(MissionsGiven) +
|
||||
sizeof(MissionsPassed) +
|
||||
sizeof(PassengersDroppedOffWithTaxi) +
|
||||
sizeof(MoneyMadeWithTaxi) +
|
||||
sizeof(IndustrialPassed) +
|
||||
sizeof(CommercialPassed) +
|
||||
sizeof(SuburbanPassed) +
|
||||
sizeof(ElBurroTime) +
|
||||
sizeof(PamphletMissionPassed) +
|
||||
sizeof(NoMoreHurricanes) +
|
||||
sizeof(DistanceTravelledOnFoot) +
|
||||
sizeof(DistanceTravelledInVehicle) +
|
||||
sizeof(Record4x4One) +
|
||||
sizeof(Record4x4Two) +
|
||||
sizeof(Record4x4Three) +
|
||||
sizeof(Record4x4Mayhem) +
|
||||
sizeof(DistanceTravelledByCar) +
|
||||
sizeof(DistanceTravelledByBike) +
|
||||
sizeof(DistanceTravelledByBoat) +
|
||||
sizeof(DistanceTravelledByGolfCart) +
|
||||
sizeof(DistanceTravelledByHelicoptor) +
|
||||
sizeof(DistanceTravelledByPlane) +
|
||||
sizeof(LivesSavedWithAmbulance) +
|
||||
sizeof(CriminalsCaught) +
|
||||
sizeof(HighestLevelAmbulanceMission) +
|
||||
sizeof(FiresExtinguished) +
|
||||
sizeof(TimeTakenDefuseMission) +
|
||||
sizeof(HighestLevelVigilanteMission) +
|
||||
sizeof(HighestLevelAmbulanceMission) +
|
||||
sizeof(HighestLevelFireMission) +
|
||||
sizeof(PhotosTaken) +
|
||||
sizeof(NumberKillFrenziesPassed) +
|
||||
sizeof(TotalNumberKillFrenzies) +
|
||||
sizeof(TotalNumberMissions) +
|
||||
sizeof(FlightTime) +
|
||||
sizeof(TimesDrowned) +
|
||||
sizeof(SeagullsKilled) +
|
||||
sizeof(WeaponBudget) +
|
||||
sizeof(FashionBudget) +
|
||||
sizeof(LoanSharks) +
|
||||
sizeof(StoresKnockedOff) +
|
||||
sizeof(MovieStunts) +
|
||||
sizeof(Assassinations) +
|
||||
sizeof(PizzasDelivered) +
|
||||
sizeof(GarbagePickups) +
|
||||
sizeof(IceCreamSold) +
|
||||
sizeof(TopShootingRangeScore) +
|
||||
sizeof(ShootingRank) +
|
||||
sizeof(LongestWheelie) +
|
||||
sizeof(LongestStoppie) +
|
||||
sizeof(Longest2Wheel) +
|
||||
sizeof(LongestWheelieDist) +
|
||||
sizeof(LongestStoppieDist) +
|
||||
sizeof(Longest2WheelDist) +
|
||||
sizeof(PropertyBudget) +
|
||||
sizeof(AutoPaintingBudget) +
|
||||
sizeof(PropertyDestroyed) +
|
||||
sizeof(NumPropertyOwned) +
|
||||
sizeof(BloodRingKills) +
|
||||
sizeof(BloodRingTime) +
|
||||
sizeof(PropertyOwned) +
|
||||
sizeof(HighestChaseValue) +
|
||||
sizeof(FastestTimes) +
|
||||
sizeof(HighestScores) +
|
||||
sizeof(BestPositions) +
|
||||
sizeof(KillsSinceLastCheckpoint) +
|
||||
sizeof(TotalLegitimateKills) +
|
||||
sizeof(LastMissionPassedName);
|
||||
sizeof(LastMissionPassedName) +
|
||||
sizeof(CheatedCount) +
|
||||
sizeof(FavoriteRadioStationList);
|
||||
|
||||
#define CopyToBuf(buf, data) memcpy(buf, &data, sizeof(data)); buf += sizeof(data);
|
||||
CopyToBuf(buf, PeopleKilledByPlayer);
|
||||
CopyToBuf(buf, PeopleKilledByOthers);
|
||||
CopyToBuf(buf, CarsExploded);
|
||||
CopyToBuf(buf, BoatsExploded);
|
||||
CopyToBuf(buf, TyresPopped);
|
||||
CopyToBuf(buf, RoundsFiredByPlayer);
|
||||
CopyToBuf(buf, PedsKilledOfThisType);
|
||||
CopyToBuf(buf, HelisDestroyed);
|
||||
CopyToBuf(buf, ProgressMade);
|
||||
CopyToBuf(buf, TotalProgressInGame);
|
||||
CopyToBuf(buf, KgsOfExplosivesUsed);
|
||||
CopyToBuf(buf, InstantHitsFiredByPlayer);
|
||||
CopyToBuf(buf, InstantHitsHitByPlayer);
|
||||
CopyToBuf(buf, BulletsThatHit);
|
||||
CopyToBuf(buf, HeadsPopped);
|
||||
CopyToBuf(buf, WantedStarsAttained);
|
||||
CopyToBuf(buf, WantedStarsEvaded);
|
||||
CopyToBuf(buf, TimesArrested);
|
||||
CopyToBuf(buf, TimesDied);
|
||||
CopyToBuf(buf, DaysPassed);
|
||||
CopyToBuf(buf, SafeHouseVisits);
|
||||
CopyToBuf(buf, Sprayings);
|
||||
CopyToBuf(buf, MaximumJumpDistance);
|
||||
CopyToBuf(buf, MaximumJumpHeight);
|
||||
CopyToBuf(buf, MaximumJumpFlips);
|
||||
@ -349,33 +569,67 @@ void CStats::SaveStats(uint8 *buf, uint32 *size)
|
||||
CopyToBuf(buf, NumberOfUniqueJumpsFound);
|
||||
CopyToBuf(buf, TotalNumberOfUniqueJumps);
|
||||
CopyToBuf(buf, MissionsGiven);
|
||||
CopyToBuf(buf, MissionsPassed);
|
||||
CopyToBuf(buf, PassengersDroppedOffWithTaxi);
|
||||
CopyToBuf(buf, MoneyMadeWithTaxi);
|
||||
CopyToBuf(buf, IndustrialPassed);
|
||||
CopyToBuf(buf, CommercialPassed);
|
||||
CopyToBuf(buf, SuburbanPassed);
|
||||
CopyToBuf(buf, ElBurroTime);
|
||||
CopyToBuf(buf, PamphletMissionPassed);
|
||||
CopyToBuf(buf, NoMoreHurricanes);
|
||||
CopyToBuf(buf, DistanceTravelledOnFoot);
|
||||
CopyToBuf(buf, DistanceTravelledInVehicle);
|
||||
CopyToBuf(buf, Record4x4One);
|
||||
CopyToBuf(buf, Record4x4Two);
|
||||
CopyToBuf(buf, Record4x4Three);
|
||||
CopyToBuf(buf, Record4x4Mayhem);
|
||||
CopyToBuf(buf, DistanceTravelledByCar);
|
||||
CopyToBuf(buf, DistanceTravelledByBike);
|
||||
CopyToBuf(buf, DistanceTravelledByBoat);
|
||||
CopyToBuf(buf, DistanceTravelledByGolfCart);
|
||||
CopyToBuf(buf, DistanceTravelledByHelicoptor);
|
||||
CopyToBuf(buf, DistanceTravelledByPlane);
|
||||
CopyToBuf(buf, LivesSavedWithAmbulance);
|
||||
CopyToBuf(buf, CriminalsCaught);
|
||||
CopyToBuf(buf, HighestLevelAmbulanceMission);
|
||||
CopyToBuf(buf, FiresExtinguished);
|
||||
CopyToBuf(buf, TimeTakenDefuseMission);
|
||||
CopyToBuf(buf, HighestLevelVigilanteMission);
|
||||
CopyToBuf(buf, HighestLevelAmbulanceMission);
|
||||
CopyToBuf(buf, HighestLevelFireMission);
|
||||
CopyToBuf(buf, PhotosTaken);
|
||||
CopyToBuf(buf, NumberKillFrenziesPassed);
|
||||
CopyToBuf(buf, TotalNumberKillFrenzies);
|
||||
CopyToBuf(buf, TotalNumberMissions);
|
||||
CopyToBuf(buf, FlightTime);
|
||||
CopyToBuf(buf, TimesDrowned);
|
||||
CopyToBuf(buf, SeagullsKilled);
|
||||
CopyToBuf(buf, WeaponBudget);
|
||||
CopyToBuf(buf, FashionBudget);
|
||||
CopyToBuf(buf, LoanSharks);
|
||||
CopyToBuf(buf, StoresKnockedOff);
|
||||
CopyToBuf(buf, MovieStunts);
|
||||
CopyToBuf(buf, Assassinations);
|
||||
CopyToBuf(buf, PizzasDelivered);
|
||||
CopyToBuf(buf, GarbagePickups);
|
||||
CopyToBuf(buf, IceCreamSold);
|
||||
CopyToBuf(buf, TopShootingRangeScore);
|
||||
CopyToBuf(buf, ShootingRank);
|
||||
CopyToBuf(buf, LongestWheelie);
|
||||
CopyToBuf(buf, LongestStoppie);
|
||||
CopyToBuf(buf, Longest2Wheel);
|
||||
CopyToBuf(buf, LongestWheelieDist);
|
||||
CopyToBuf(buf, LongestStoppieDist);
|
||||
CopyToBuf(buf, Longest2WheelDist);
|
||||
CopyToBuf(buf, PropertyBudget);
|
||||
CopyToBuf(buf, AutoPaintingBudget);
|
||||
CopyToBuf(buf, PropertyDestroyed);
|
||||
CopyToBuf(buf, NumPropertyOwned);
|
||||
CopyToBuf(buf, BloodRingKills);
|
||||
CopyToBuf(buf, BloodRingTime);
|
||||
CopyToBuf(buf, PropertyOwned);
|
||||
CopyToBuf(buf, HighestChaseValue);
|
||||
CopyToBuf(buf, FastestTimes);
|
||||
CopyToBuf(buf, HighestScores);
|
||||
CopyToBuf(buf, BestPositions);
|
||||
CopyToBuf(buf, KillsSinceLastCheckpoint);
|
||||
CopyToBuf(buf, TotalLegitimateKills);
|
||||
CopyToBuf(buf, LastMissionPassedName);
|
||||
CopyToBuf(buf, CheatedCount);
|
||||
// TODO(Miami): Set favourite radio stations!!
|
||||
CopyToBuf(buf, FavoriteRadioStationList);
|
||||
|
||||
assert(buf - buf_start == *size);
|
||||
#undef CopyToBuf
|
||||
@ -390,18 +644,23 @@ void CStats::LoadStats(uint8 *buf, uint32 size)
|
||||
CopyFromBuf(buf, PeopleKilledByPlayer);
|
||||
CopyFromBuf(buf, PeopleKilledByOthers);
|
||||
CopyFromBuf(buf, CarsExploded);
|
||||
CopyFromBuf(buf, BoatsExploded);
|
||||
CopyFromBuf(buf, TyresPopped);
|
||||
CopyFromBuf(buf, RoundsFiredByPlayer);
|
||||
CopyFromBuf(buf, PedsKilledOfThisType);
|
||||
CopyFromBuf(buf, HelisDestroyed);
|
||||
CopyFromBuf(buf, ProgressMade);
|
||||
CopyFromBuf(buf, TotalProgressInGame);
|
||||
CopyFromBuf(buf, KgsOfExplosivesUsed);
|
||||
CopyFromBuf(buf, InstantHitsFiredByPlayer);
|
||||
CopyFromBuf(buf, InstantHitsHitByPlayer);
|
||||
CopyFromBuf(buf, BulletsThatHit);
|
||||
CopyFromBuf(buf, HeadsPopped);
|
||||
CopyFromBuf(buf, WantedStarsAttained);
|
||||
CopyFromBuf(buf, WantedStarsEvaded);
|
||||
CopyFromBuf(buf, TimesArrested);
|
||||
CopyFromBuf(buf, TimesDied);
|
||||
CopyFromBuf(buf, DaysPassed);
|
||||
CopyFromBuf(buf, SafeHouseVisits);
|
||||
CopyFromBuf(buf, Sprayings);
|
||||
CopyFromBuf(buf, MaximumJumpDistance);
|
||||
CopyFromBuf(buf, MaximumJumpHeight);
|
||||
CopyFromBuf(buf, MaximumJumpFlips);
|
||||
@ -410,33 +669,66 @@ void CStats::LoadStats(uint8 *buf, uint32 size)
|
||||
CopyFromBuf(buf, NumberOfUniqueJumpsFound);
|
||||
CopyFromBuf(buf, TotalNumberOfUniqueJumps);
|
||||
CopyFromBuf(buf, MissionsGiven);
|
||||
CopyFromBuf(buf, MissionsPassed);
|
||||
CopyFromBuf(buf, PassengersDroppedOffWithTaxi);
|
||||
CopyFromBuf(buf, MoneyMadeWithTaxi);
|
||||
CopyFromBuf(buf, IndustrialPassed);
|
||||
CopyFromBuf(buf, CommercialPassed);
|
||||
CopyFromBuf(buf, SuburbanPassed);
|
||||
CopyFromBuf(buf, ElBurroTime);
|
||||
CopyFromBuf(buf, PamphletMissionPassed);
|
||||
CopyFromBuf(buf, NoMoreHurricanes);
|
||||
CopyFromBuf(buf, DistanceTravelledOnFoot);
|
||||
CopyFromBuf(buf, DistanceTravelledInVehicle);
|
||||
CopyFromBuf(buf, Record4x4One);
|
||||
CopyFromBuf(buf, Record4x4Two);
|
||||
CopyFromBuf(buf, Record4x4Three);
|
||||
CopyFromBuf(buf, Record4x4Mayhem);
|
||||
CopyFromBuf(buf, DistanceTravelledByCar);
|
||||
CopyFromBuf(buf, DistanceTravelledByBike);
|
||||
CopyFromBuf(buf, DistanceTravelledByBoat);
|
||||
CopyFromBuf(buf, DistanceTravelledByGolfCart);
|
||||
CopyFromBuf(buf, DistanceTravelledByHelicoptor);
|
||||
CopyFromBuf(buf, DistanceTravelledByPlane);
|
||||
CopyFromBuf(buf, LivesSavedWithAmbulance);
|
||||
CopyFromBuf(buf, CriminalsCaught);
|
||||
CopyFromBuf(buf, HighestLevelAmbulanceMission);
|
||||
CopyFromBuf(buf, FiresExtinguished);
|
||||
CopyFromBuf(buf, TimeTakenDefuseMission);
|
||||
CopyFromBuf(buf, HighestLevelVigilanteMission);
|
||||
CopyFromBuf(buf, HighestLevelAmbulanceMission);
|
||||
CopyFromBuf(buf, HighestLevelFireMission);
|
||||
CopyFromBuf(buf, PhotosTaken);
|
||||
CopyFromBuf(buf, NumberKillFrenziesPassed);
|
||||
CopyFromBuf(buf, TotalNumberKillFrenzies);
|
||||
CopyFromBuf(buf, TotalNumberMissions);
|
||||
CopyFromBuf(buf, FlightTime);
|
||||
CopyFromBuf(buf, TimesDrowned);
|
||||
CopyFromBuf(buf, SeagullsKilled);
|
||||
CopyFromBuf(buf, WeaponBudget);
|
||||
CopyFromBuf(buf, FashionBudget);
|
||||
CopyFromBuf(buf, LoanSharks);
|
||||
CopyFromBuf(buf, StoresKnockedOff);
|
||||
CopyFromBuf(buf, MovieStunts);
|
||||
CopyFromBuf(buf, Assassinations);
|
||||
CopyFromBuf(buf, PizzasDelivered);
|
||||
CopyFromBuf(buf, GarbagePickups);
|
||||
CopyFromBuf(buf, IceCreamSold);
|
||||
CopyFromBuf(buf, TopShootingRangeScore);
|
||||
CopyFromBuf(buf, ShootingRank);
|
||||
CopyFromBuf(buf, LongestWheelie);
|
||||
CopyFromBuf(buf, LongestStoppie);
|
||||
CopyFromBuf(buf, Longest2Wheel);
|
||||
CopyFromBuf(buf, LongestWheelieDist);
|
||||
CopyFromBuf(buf, LongestStoppieDist);
|
||||
CopyFromBuf(buf, Longest2WheelDist);
|
||||
CopyFromBuf(buf, PropertyBudget);
|
||||
CopyFromBuf(buf, AutoPaintingBudget);
|
||||
CopyFromBuf(buf, PropertyDestroyed);
|
||||
CopyFromBuf(buf, NumPropertyOwned);
|
||||
CopyFromBuf(buf, BloodRingKills);
|
||||
CopyFromBuf(buf, BloodRingTime);
|
||||
CopyFromBuf(buf, PropertyOwned);
|
||||
CopyFromBuf(buf, HighestChaseValue);
|
||||
CopyFromBuf(buf, FastestTimes);
|
||||
CopyFromBuf(buf, HighestScores);
|
||||
CopyFromBuf(buf, BestPositions);
|
||||
CopyFromBuf(buf, KillsSinceLastCheckpoint);
|
||||
CopyFromBuf(buf, TotalLegitimateKills);
|
||||
CopyFromBuf(buf, LastMissionPassedName);
|
||||
CopyFromBuf(buf, CheatedCount);
|
||||
CopyFromBuf(buf, FavoriteRadioStationList);
|
||||
|
||||
assert(buf - buf_start == size);
|
||||
#undef CopyFromBuf
|
||||
|
@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "PedType.h"
|
||||
#include "audio_enums.h"
|
||||
|
||||
class CStats
|
||||
{
|
||||
@ -8,11 +9,10 @@ public:
|
||||
enum {
|
||||
TOTAL_FASTEST_TIMES = 23,
|
||||
TOTAL_HIGHEST_SCORES = 5,
|
||||
TOTAL_BEST_POSITIONS = 1
|
||||
TOTAL_BEST_POSITIONS = 1,
|
||||
TOTAL_PROPERTIES = 15
|
||||
};
|
||||
//TODO
|
||||
static int32 SeagullsKilled;
|
||||
|
||||
static int32 DaysPassed;
|
||||
static int32 HeadsPopped;
|
||||
static int32 CommercialPassed;
|
||||
@ -25,9 +25,29 @@ public:
|
||||
static int32 TimesDied;
|
||||
static int32 TimesArrested;
|
||||
static int32 KillsSinceLastCheckpoint;
|
||||
static float DistanceTravelledInVehicle;
|
||||
static float DistanceTravelledByCar;
|
||||
static float DistanceTravelledByHelicoptor;
|
||||
static float DistanceTravelledByBike;
|
||||
static float DistanceTravelledByBoat;
|
||||
static float DistanceTravelledByPlane;
|
||||
static float DistanceTravelledByGolfCart;
|
||||
static float DistanceTravelledOnFoot;
|
||||
static int32 FlightTime;
|
||||
static int32 TimesDrowned;
|
||||
static int32 PhotosTaken;
|
||||
static float LoanSharks;
|
||||
static float StoresKnockedOff;
|
||||
static float MovieStunts;
|
||||
static float Assassinations;
|
||||
static float PizzasDelivered;
|
||||
static float GarbagePickups;
|
||||
static float IceCreamSold;
|
||||
static float TopShootingRangeScore;
|
||||
static float ShootingRank;
|
||||
static int32 CarsExploded;
|
||||
static int32 BoatsExploded;
|
||||
static int32 WantedStarsAttained;
|
||||
static int32 WantedStarsEvaded;
|
||||
static int32 PeopleKilledByPlayer;
|
||||
static int32 ProgressMade;
|
||||
static int32 TotalProgressInGame;
|
||||
@ -44,50 +64,60 @@ public:
|
||||
static int32 MissionsPassed;
|
||||
static char LastMissionPassedName[8];
|
||||
static int32 TotalLegitimateKills;
|
||||
static int32 ElBurroTime;
|
||||
static int32 Record4x4One;
|
||||
static int32 Record4x4Two;
|
||||
static int32 Record4x4Three;
|
||||
static int32 Record4x4Mayhem;
|
||||
static int32 LivesSavedWithAmbulance;
|
||||
static int32 CriminalsCaught;
|
||||
static int32 HighestLevelAmbulanceMission;
|
||||
static int32 HighestLevelVigilanteMission;
|
||||
static int32 HighestLevelFireMission;
|
||||
static int32 FiresExtinguished;
|
||||
static int32 TimeTakenDefuseMission;
|
||||
static int32 TotalNumberKillFrenzies;
|
||||
static int32 TotalNumberMissions;
|
||||
static int32 RoundsFiredByPlayer;
|
||||
static int32 KgsOfExplosivesUsed;
|
||||
static int32 InstantHitsFiredByPlayer;
|
||||
static int32 InstantHitsHitByPlayer;
|
||||
static int32 BulletsThatHit;
|
||||
static int32 BestTimeBombDefusal;
|
||||
static int32 FastestTimes[TOTAL_FASTEST_TIMES];
|
||||
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
|
||||
static int32 BestPositions[TOTAL_BEST_POSITIONS];
|
||||
static bool PropertyOwned[TOTAL_PROPERTIES];
|
||||
static int32 NumPropertyOwned;
|
||||
static int32 PropertyDestroyed;
|
||||
static float HighestChaseValue;
|
||||
static int32 CheatedCount;
|
||||
static int32 ShowChaseStatOnScreen;
|
||||
static int32 PamphletMissionPassed;
|
||||
static bool abSonyCDs[1];
|
||||
static int32 BloodRingKills;
|
||||
static int32 BloodRingTime;
|
||||
static float FavoriteRadioStationList[NUM_RADIOS];
|
||||
static int32 Sprayings;
|
||||
static float AutoPaintingBudget;
|
||||
static int32 NoMoreHurricanes;
|
||||
static float FashionBudget;
|
||||
static float PropertyBudget;
|
||||
static float WeaponBudget;
|
||||
static int32 SafeHouseVisits;
|
||||
static int32 TyresPopped;
|
||||
|
||||
static int32 LongestWheelie;
|
||||
static int32 LongestStoppie;
|
||||
static int32 Longest2Wheel;
|
||||
static float LongestWheelieDist;
|
||||
static float LongestStoppieDist;
|
||||
static float Longest2WheelDist;
|
||||
|
||||
public:
|
||||
static void Init(void);
|
||||
static void RegisterFastestTime(int32, int32);
|
||||
static void RegisterHighestScore(int32, int32);
|
||||
static void RegisterBestPosition(int32, int32);
|
||||
static void RegisterElBurroTime(int32);
|
||||
static void Register4x4OneTime(int32);
|
||||
static void Register4x4TwoTime(int32);
|
||||
static void Register4x4ThreeTime(int32);
|
||||
static void Register4x4MayhemTime(int32);
|
||||
static void AnotherLifeSavedWithAmbulance();
|
||||
static void AnotherCriminalCaught();
|
||||
static void RegisterLevelAmbulanceMission(int32);
|
||||
static void RegisterLevelVigilanteMission(int32);
|
||||
static void RegisterLevelFireMission(int32);
|
||||
static void AnotherFireExtinguished();
|
||||
static wchar *FindCriminalRatingString();
|
||||
static void RegisterTimeTakenDefuseMission(int32);
|
||||
static void AnotherKillFrenzyPassed();
|
||||
static void SetTotalNumberKillFrenzies(int32);
|
||||
static void SetTotalNumberMissions(int32);
|
||||
@ -98,5 +128,20 @@ public:
|
||||
static void LoadStats(uint8 *buf, uint32 size);
|
||||
static float GetPercentageProgress();
|
||||
|
||||
static void MoneySpentOnWeapons(int32);
|
||||
static void MoneySpentOnProperty(int32);
|
||||
static void MoneySpentOnAutoPainting(int32);
|
||||
static void MoneySpentOnFashion(int32);
|
||||
|
||||
static void NumOfVisitsFromLoanSharks(int32);
|
||||
static void NumOfStoresKnockedOff(int32);
|
||||
static void NumOfMovieStunts(int32);
|
||||
static void NumOfAssassinations(int32);
|
||||
static void NumOfPizzasDelivered(int32);
|
||||
static void NumOfGarbagePickups(int32);
|
||||
static void NumOfIceCreamSold(int32);
|
||||
static void AddNumBloodRingKills(int32);
|
||||
|
||||
static void LongestTimeInBloodRing(int32);
|
||||
static void AddPropertyAsOwned(int32);
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -93,6 +93,7 @@ public:
|
||||
static CStreamingChannel ms_channel[2];
|
||||
static int32 ms_channelError;
|
||||
static int32 ms_numVehiclesLoaded;
|
||||
static int32 ms_numPedsLoaded;
|
||||
static int32 ms_vehiclesLoaded[MAXVEHICLESLOADED];
|
||||
static int32 ms_lastVehicleDeleted;
|
||||
static bool ms_bIsPedFromPedGroupLoaded[NUMMODELSPERPEDGROUP];
|
||||
@ -110,6 +111,7 @@ public:
|
||||
|
||||
static void Init(void);
|
||||
static void Init2(void);
|
||||
static void ReInit(void);
|
||||
static void Shutdown(void);
|
||||
static void Update(void);
|
||||
static void LoadCdDirectory(void);
|
||||
@ -149,6 +151,7 @@ public:
|
||||
static void RemoveAnim(int32 id) { RemoveModel(id + STREAM_OFFSET_ANIM); }
|
||||
static void RemoveUnusedBuildings(eLevelName level);
|
||||
static void RemoveBuildings(eLevelName level);
|
||||
static void RemoveBuildingsNotInArea(int32 area);
|
||||
static void RemoveUnusedBigBuildings(eLevelName level);
|
||||
static void RemoveIslandsNotUsed(eLevelName level);
|
||||
static void RemoveBigBuildings(eLevelName level);
|
||||
@ -156,6 +159,7 @@ public:
|
||||
static bool RemoveLeastUsedModel(uint32 excludeMask);
|
||||
static void RemoveAllUnusedModels(void);
|
||||
static void RemoveUnusedModelsInLoadedList(void);
|
||||
static bool RemoveLoadedZoneModel(void);
|
||||
static int32 GetAvailableVehicleSlot(void);
|
||||
static bool IsTxdUsedByRequestedModels(int32 txdId);
|
||||
static bool AreAnimsUsedByRequestedModels(int32 animId);
|
||||
@ -187,9 +191,9 @@ public:
|
||||
static void IHaveUsedStreamingMemory(void);
|
||||
static void UpdateMemoryUsed(void);
|
||||
|
||||
static void AddModelsToRequestList(const CVector &pos);
|
||||
static void ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float xmin, float ymin, float xmax, float ymax);
|
||||
static void ProcessEntitiesInSectorList(CPtrList &list);
|
||||
static void AddModelsToRequestList(const CVector &pos, int32 flags);
|
||||
static void ProcessEntitiesInSectorList(CPtrList &list, float x, float y, float xmin, float ymin, float xmax, float ymax, int32 flags);
|
||||
static void ProcessEntitiesInSectorList(CPtrList &list, int32 flags);
|
||||
static void DeleteFarAwayRwObjects(const CVector &pos);
|
||||
static void DeleteAllRwObjects(void);
|
||||
static void DeleteRwObjectsAfterDeath(const CVector &pos);
|
||||
|
@ -6,6 +6,8 @@
|
||||
#include "Collision.h"
|
||||
#include "SurfaceTable.h"
|
||||
|
||||
//--MIAMI: file done
|
||||
|
||||
float CSurfaceTable::ms_aAdhesiveLimitTable[NUMADHESIVEGROUPS][NUMADHESIVEGROUPS];
|
||||
|
||||
void
|
||||
@ -148,3 +150,9 @@ CSurfaceTable::GetAdhesiveLimit(CColPoint &colpoint)
|
||||
{
|
||||
return ms_aAdhesiveLimitTable[GetAdhesionGroup(colpoint.surfaceB)][GetAdhesionGroup(colpoint.surfaceA)];
|
||||
}
|
||||
|
||||
bool
|
||||
CSurfaceTable::IsSoftLanding(uint8 surf)
|
||||
{
|
||||
return surf == SURFACE_GRASS || surf == SURFACE_SAND || surf == SURFACE_SAND_BEACH;
|
||||
}
|
||||
|
@ -96,4 +96,5 @@ public:
|
||||
static int GetAdhesionGroup(uint8 surfaceType);
|
||||
static float GetWetMultiplier(uint8 surfaceType);
|
||||
static float GetAdhesiveLimit(CColPoint &colpoint);
|
||||
static bool IsSoftLanding(uint8 surf);
|
||||
};
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "CopPed.h"
|
||||
#include "Wanted.h"
|
||||
#include "General.h"
|
||||
#include "Stats.h"
|
||||
|
||||
int32 CWanted::MaximumWantedLevel = 6;
|
||||
int32 CWanted::nMaximumWantedLevel = 9600;
|
||||
@ -308,7 +309,6 @@ CWanted::ReportCrimeNow(eCrimeType type, const CVector &coors, bool policeDoesnt
|
||||
UpdateWantedLevel();
|
||||
}
|
||||
|
||||
// TODO(Miami): Stats
|
||||
void
|
||||
CWanted::UpdateWantedLevel()
|
||||
{
|
||||
@ -318,36 +318,44 @@ CWanted::UpdateWantedLevel()
|
||||
m_nChaos = nMaximumWantedLevel;
|
||||
|
||||
if (m_nChaos >= 0 && m_nChaos < 50) {
|
||||
if (m_nWantedLevel == 1)
|
||||
++CStats::WantedStarsEvaded;
|
||||
m_nWantedLevel = 0;
|
||||
m_MaximumLawEnforcerVehicles = 0;
|
||||
m_MaxCops = 0;
|
||||
m_RoadblockDensity = 0;
|
||||
} else if (m_nChaos >= 50 && m_nChaos < 180) {
|
||||
CStats::WantedStarsAttained += 1 - m_nWantedLevel;
|
||||
m_nWantedLevel = 1;
|
||||
m_MaximumLawEnforcerVehicles = 1;
|
||||
m_MaxCops = 1;
|
||||
m_RoadblockDensity = 0;
|
||||
} else if (m_nChaos >= 180 && m_nChaos < 550) {
|
||||
CStats::WantedStarsAttained += 2 - m_nWantedLevel;
|
||||
m_nWantedLevel = 2;
|
||||
m_MaximumLawEnforcerVehicles = 2;
|
||||
m_MaxCops = 3;
|
||||
m_RoadblockDensity = 0;
|
||||
} else if (m_nChaos >= 550 && m_nChaos < 1200) {
|
||||
CStats::WantedStarsAttained += 3 - m_nWantedLevel;
|
||||
m_nWantedLevel = 3;
|
||||
m_MaximumLawEnforcerVehicles = 2;
|
||||
m_MaxCops = 4;
|
||||
m_RoadblockDensity = 12;
|
||||
} else if (m_nChaos >= 1200 && m_nChaos < 2400) {
|
||||
CStats::WantedStarsAttained += 4 - m_nWantedLevel;
|
||||
m_nWantedLevel = 4;
|
||||
m_MaximumLawEnforcerVehicles = 2;
|
||||
m_MaxCops = 6;
|
||||
m_RoadblockDensity = 18;
|
||||
} else if (m_nChaos >= 2400 && m_nChaos < 4800) {
|
||||
CStats::WantedStarsAttained += 5 - m_nWantedLevel;
|
||||
m_nWantedLevel = 5;
|
||||
m_MaximumLawEnforcerVehicles = 3;
|
||||
m_MaxCops = 8;
|
||||
m_RoadblockDensity = 24;
|
||||
} else if (m_nChaos >= 4800) {
|
||||
CStats::WantedStarsAttained += 6 - m_nWantedLevel;
|
||||
m_nWantedLevel = 6;
|
||||
m_MaximumLawEnforcerVehicles = 3;
|
||||
m_MaxCops = 10;
|
||||
@ -494,8 +502,7 @@ CWanted::UpdateCrimesQ(void)
|
||||
void
|
||||
CWanted::Suspend(void)
|
||||
{
|
||||
// TODO(Miami): Stats
|
||||
// dwStarsEvaded += m_nWantedLevel;
|
||||
CStats::WantedStarsEvaded += m_nWantedLevel;
|
||||
m_nMinChaos = m_nChaos;
|
||||
m_nMinWantedLevel = m_nWantedLevel;
|
||||
m_nLastTimeSuspended = CTimer::GetTimeInMilliseconds();
|
||||
|
@ -11,6 +11,8 @@
|
||||
#include "ZoneCull.h"
|
||||
#include "Zones.h"
|
||||
|
||||
//--MIAMI: done
|
||||
|
||||
int32 CCullZones::NumAttributeZones;
|
||||
CAttributeZone CCullZones::aAttributeZones[NUMATTRIBZONES];
|
||||
|
||||
@ -18,6 +20,7 @@ int32 CCullZones::CurrentWantedLevelDrop_Player;
|
||||
int32 CCullZones::CurrentFlags_Camera;
|
||||
int32 CCullZones::CurrentFlags_Player;
|
||||
bool CCullZones::bCurrentSubwayIsInvisible;
|
||||
bool CCullZones::bAtBeachForAudio;
|
||||
|
||||
void
|
||||
CCullZones::Init(void)
|
||||
@ -37,6 +40,7 @@ CCullZones::Update(void)
|
||||
switch(CTimer::GetFrameCounter() & 7){
|
||||
case 0:
|
||||
case 4:
|
||||
UpdateAtBeachForAudio();
|
||||
break;
|
||||
|
||||
case 2:
|
||||
@ -57,6 +61,27 @@ CCullZones::Update(void)
|
||||
}
|
||||
}
|
||||
|
||||
// TODO? put somewhere else?
|
||||
bool
|
||||
IsPointWithinArbitraryArea(float px, float py, float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)
|
||||
{
|
||||
if((px-x1)*(x2-x1) - (py-y1)*(y2-y1) < 0.0f) return false;
|
||||
if((px-x2)*(x3-x2) - (py-y2)*(y3-y2) < 0.0f) return false;
|
||||
if((px-x3)*(x4-x3) - (py-y3)*(y4-y3) < 0.0f) return false;
|
||||
if((px-x4)*(x1-x4) - (py-y4)*(y1-y4) < 0.0f) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
CCullZones::UpdateAtBeachForAudio(void)
|
||||
{
|
||||
bAtBeachForAudio = IsPointWithinArbitraryArea(TheCamera.GetPosition().x, TheCamera.GetPosition().y,
|
||||
400.0f, -1644.4f,
|
||||
751.9f, 1267.8f,
|
||||
971.9f, 1216.2f,
|
||||
840.0f, -1744.0f);
|
||||
}
|
||||
|
||||
void
|
||||
CCullZones::ForceCullZoneCoors(CVector coors)
|
||||
{
|
||||
|
@ -10,8 +10,9 @@ enum eZoneAttribs
|
||||
ATTRZONE_NOTCULLZONE = 0x20,
|
||||
ATTRZONE_DOINEEDCOLLISION = 0x40,
|
||||
ATTRZONE_SUBWAYVISIBLE = 0x80,
|
||||
|
||||
ATTRZONE_WATERFUDGE = 0x400,
|
||||
ATTRZONE_POLICEABANDONCARS = 0x100,
|
||||
ATTRZONE_ROOMFORAUDIO = 0x200,
|
||||
ATTRZONE_WATERFUDGE = 0x400,
|
||||
};
|
||||
|
||||
struct CAttributeZone
|
||||
@ -36,9 +37,11 @@ public:
|
||||
static int32 CurrentFlags_Camera;
|
||||
static int32 CurrentFlags_Player;
|
||||
static bool bCurrentSubwayIsInvisible;
|
||||
static bool bAtBeachForAudio;
|
||||
|
||||
static void Init(void);
|
||||
static void Update(void);
|
||||
static void UpdateAtBeachForAudio(void);
|
||||
static void ForceCullZoneCoors(CVector coors);
|
||||
static int32 FindAttributesForCoors(CVector coors, int32 *wantedLevel);
|
||||
static CAttributeZone *FindZoneWithStairsAttributeForPlayer(void);
|
||||
@ -55,9 +58,8 @@ public:
|
||||
static bool DoINeedToLoadCollision(void) { return (CurrentFlags_Player & ATTRZONE_DOINEEDCOLLISION) != 0; }
|
||||
static bool PlayerNoRain(void) { return (CurrentFlags_Player & ATTRZONE_NORAIN) != 0; }
|
||||
static bool CamNoRain(void) { return (CurrentFlags_Camera & ATTRZONE_NORAIN) != 0; }
|
||||
static bool PoliceAbandonCars(void) { return (CurrentFlags_Camera & ATTRZONE_POLICEABANDONCARS) != 0; }
|
||||
static bool InRoomForAudio(void) { return (CurrentFlags_Camera & ATTRZONE_ROOMFORAUDIO) != 0; }
|
||||
static bool WaterFudge(void) { return (CurrentFlags_Camera & ATTRZONE_WATERFUDGE) != 0; }
|
||||
static int32 GetWantedLevelDrop(void) { return CurrentWantedLevelDrop_Player; }
|
||||
|
||||
//--MIAMI: TODO
|
||||
static bool PoliceAbandonCars(void) { return false; }
|
||||
};
|
||||
|
@ -9,6 +9,8 @@
|
||||
#include "World.h"
|
||||
#include "Timer.h"
|
||||
|
||||
//--MIAMI: file almost done (loading/saving will perhaps stay different)
|
||||
|
||||
eLevelName CTheZones::m_CurrLevel;
|
||||
int16 CTheZones::FindIndex;
|
||||
|
||||
@ -26,14 +28,12 @@ CZoneInfo CTheZones::ZoneInfoArray[2*NUMINFOZONES];
|
||||
|
||||
#define SWAPF(a, b) { float t; t = a; a = b; b = t; }
|
||||
|
||||
//--MIAMI: done
|
||||
wchar*
|
||||
CZone::GetTranslatedName(void)
|
||||
{
|
||||
return TheText.Get(name);
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CTheZones::Init(void)
|
||||
{
|
||||
@ -124,7 +124,6 @@ CTheZones::Init(void)
|
||||
MapZoneArray[0].level = LEVEL_GENERIC;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CTheZones::Update(void)
|
||||
{
|
||||
@ -137,7 +136,6 @@ CTheZones::Update(void)
|
||||
m_CurrLevel = GetLevelFromPosition(&pos);
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CTheZones::CreateZone(char *name, eZoneType type,
|
||||
float minx, float miny, float minz,
|
||||
@ -204,7 +202,6 @@ CTheZones::CreateZone(char *name, eZoneType type,
|
||||
}
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CTheZones::PostZoneCreation(void)
|
||||
{
|
||||
@ -214,7 +211,6 @@ CTheZones::PostZoneCreation(void)
|
||||
InitialiseAudioZoneArray();
|
||||
}
|
||||
|
||||
//--MIAMI: done, but does nothing
|
||||
void
|
||||
CTheZones::CheckZonesForOverlap(void)
|
||||
{
|
||||
@ -231,7 +227,6 @@ CTheZones::CheckZonesForOverlap(void)
|
||||
}
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CTheZones::InsertZoneIntoZoneHierarchy(CZone *zone)
|
||||
{
|
||||
@ -241,7 +236,6 @@ CTheZones::InsertZoneIntoZoneHierarchy(CZone *zone)
|
||||
InsertZoneIntoZoneHierRecursive(zone, &NavigationZoneArray[0]);
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
bool
|
||||
CTheZones::InsertZoneIntoZoneHierRecursive(CZone *inner, CZone *outer)
|
||||
{
|
||||
@ -285,7 +279,6 @@ CTheZones::InsertZoneIntoZoneHierRecursive(CZone *inner, CZone *outer)
|
||||
return true;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
bool
|
||||
CTheZones::ZoneIsEntirelyContainedWithinOtherZone(CZone *inner, CZone *outer)
|
||||
{
|
||||
@ -310,7 +303,6 @@ CTheZones::ZoneIsEntirelyContainedWithinOtherZone(CZone *inner, CZone *outer)
|
||||
return true;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
bool
|
||||
CTheZones::PointLiesWithinZone(const CVector *v, CZone *zone)
|
||||
{
|
||||
@ -319,7 +311,6 @@ CTheZones::PointLiesWithinZone(const CVector *v, CZone *zone)
|
||||
zone->minz <= v->z && v->z <= zone->maxz;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
eLevelName
|
||||
CTheZones::GetLevelFromPosition(CVector const *v)
|
||||
{
|
||||
@ -333,7 +324,6 @@ CTheZones::GetLevelFromPosition(CVector const *v)
|
||||
return MapZoneArray[0].level;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
CZone*
|
||||
CTheZones::FindInformationZoneForPosition(const CVector *v)
|
||||
{
|
||||
@ -347,7 +337,6 @@ CTheZones::FindInformationZoneForPosition(const CVector *v)
|
||||
return &InfoZoneArray[0];
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
CZone*
|
||||
CTheZones::FindSmallestNavigationZoneForPosition(const CVector *v, bool findDefault, bool findNavig)
|
||||
{
|
||||
@ -370,7 +359,6 @@ CTheZones::FindSmallestNavigationZoneForPosition(const CVector *v, bool findDefa
|
||||
return best;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
int16
|
||||
CTheZones::FindZoneByLabelAndReturnIndex(char *name, eZoneType type)
|
||||
{
|
||||
@ -400,7 +388,6 @@ CTheZones::FindZoneByLabelAndReturnIndex(char *name, eZoneType type)
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
int16
|
||||
CTheZones::FindNextZoneByLabelAndReturnIndex(char *name, eZoneType type)
|
||||
{
|
||||
@ -431,7 +418,6 @@ CTheZones::FindNextZoneByLabelAndReturnIndex(char *name, eZoneType type)
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
CZoneInfo*
|
||||
CTheZones::GetZoneInfo(const CVector *v, uint8 day)
|
||||
{
|
||||
@ -556,7 +542,7 @@ CTheZones::SetZonePedInfo(uint16 zoneid, uint8 day, int16 pedDensity,
|
||||
info->gangPedThreshold[8] = info->gangPedThreshold[7];
|
||||
}
|
||||
|
||||
//--MIAMI: done, unused
|
||||
//--MIAMI: unused
|
||||
void
|
||||
CTheZones::SetCarDensity(uint16 zoneid, uint8 day, uint16 cardensity)
|
||||
{
|
||||
@ -565,7 +551,7 @@ CTheZones::SetCarDensity(uint16 zoneid, uint8 day, uint16 cardensity)
|
||||
ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight].carDensity = cardensity;
|
||||
}
|
||||
|
||||
//--MIAMI: done, unused
|
||||
//--MIAMI: unused
|
||||
void
|
||||
CTheZones::SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity)
|
||||
{
|
||||
@ -574,7 +560,6 @@ CTheZones::SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity)
|
||||
ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight].pedDensity = peddensity;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CTheZones::SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup)
|
||||
{
|
||||
@ -583,7 +568,6 @@ CTheZones::SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup)
|
||||
ZoneInfoArray[day ? zone->zoneinfoDay : zone->zoneinfoNight].pedGroup = pedgroup;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
int16
|
||||
CTheZones::FindAudioZone(CVector *pos)
|
||||
{
|
||||
@ -595,7 +579,6 @@ CTheZones::FindAudioZone(CVector *pos)
|
||||
return -1;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CTheZones::AddZoneToAudioZoneArray(CZone *zone)
|
||||
{
|
||||
@ -613,7 +596,6 @@ CTheZones::AddZoneToAudioZoneArray(CZone *zone)
|
||||
AudioZoneArray[NumberOfAudioZones++] = z;
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
CTheZones::InitialiseAudioZoneArray(void)
|
||||
{
|
||||
@ -645,7 +627,6 @@ CTheZones::InitialiseAudioZoneArray(void)
|
||||
}
|
||||
}
|
||||
|
||||
//--MIAMI: TODO
|
||||
void
|
||||
CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
||||
{
|
||||
@ -666,7 +647,7 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
||||
WriteSaveBuf(buffer, FindIndex);
|
||||
WriteSaveBuf(buffer, (int16)0); // padding
|
||||
|
||||
// TODO(MIAMI): implement SaveOneZone
|
||||
// TODO(MIAMI) ? implement SaveOneZone
|
||||
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++){
|
||||
CZone *zone = WriteSaveBuf(buffer, NavigationZoneArray[i]);
|
||||
zone->child = (CZone*)GetIndexForZonePointer(NavigationZoneArray[i].child);
|
||||
@ -676,6 +657,14 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
||||
|
||||
for(i = 0; i < ARRAY_SIZE(InfoZoneArray); i++){
|
||||
CZone *zone = WriteSaveBuf(buffer, InfoZoneArray[i]);
|
||||
/*
|
||||
The call of GetIndexForZonePointer is wrong, as it is
|
||||
meant for a different array, but the game doesn't brake
|
||||
if those fields are nil. Let's make sure they are.
|
||||
*/
|
||||
assert(InfoZoneArray[i].child == nil);
|
||||
assert(InfoZoneArray[i].parent == nil);
|
||||
assert(InfoZoneArray[i].next == nil);
|
||||
zone->child = (CZone*)GetIndexForZonePointer(InfoZoneArray[i].child);
|
||||
zone->parent = (CZone*)GetIndexForZonePointer(InfoZoneArray[i].parent);
|
||||
zone->next = (CZone*)GetIndexForZonePointer(InfoZoneArray[i].next);
|
||||
@ -691,11 +680,7 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
||||
for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++) {
|
||||
CZone* zone = WriteSaveBuf(buffer, MapZoneArray[i]);
|
||||
|
||||
/*
|
||||
The call of GetIndexForZonePointer is wrong, as it is
|
||||
meant for a different array, but the game doesn't brake
|
||||
if those fields are nil. Let's make sure they are.
|
||||
*/
|
||||
// see above
|
||||
assert(MapZoneArray[i].child == nil);
|
||||
assert(MapZoneArray[i].parent == nil);
|
||||
assert(MapZoneArray[i].next == nil);
|
||||
@ -713,7 +698,6 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
||||
VALIDATESAVEBUF(*size)
|
||||
}
|
||||
|
||||
//--MIAMI: TODO
|
||||
void
|
||||
CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
||||
{
|
||||
@ -726,7 +710,7 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
||||
FindIndex = ReadSaveBuf<int16>(buffer);
|
||||
ReadSaveBuf<int16>(buffer);
|
||||
|
||||
// TODO(MIAMI): implement LoadOneZone
|
||||
// TODO(MIAMI) ? implement LoadOneZone
|
||||
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++){
|
||||
NavigationZoneArray[i] = ReadSaveBuf<CZone>(buffer);
|
||||
|
||||
@ -738,6 +722,14 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
||||
for(i = 0; i < ARRAY_SIZE(InfoZoneArray); i++){
|
||||
InfoZoneArray[i] = ReadSaveBuf<CZone>(buffer);
|
||||
|
||||
/*
|
||||
The call of GetPointerForZoneIndex is wrong, as it is
|
||||
meant for a different array, but the game doesn't brake
|
||||
if save data stored is -1.
|
||||
*/
|
||||
InfoZoneArray[i].child = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].child);
|
||||
InfoZoneArray[i].parent = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].parent);
|
||||
InfoZoneArray[i].next = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].next);
|
||||
InfoZoneArray[i].child = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].child);
|
||||
InfoZoneArray[i].parent = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].parent);
|
||||
InfoZoneArray[i].next = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].next);
|
||||
@ -753,11 +745,7 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
|
||||
for(i = 0; i < ARRAY_SIZE(MapZoneArray); i++){
|
||||
MapZoneArray[i] = ReadSaveBuf<CZone>(buffer);
|
||||
|
||||
/*
|
||||
The call of GetPointerForZoneIndex is wrong, as it is
|
||||
meant for a different array, but the game doesn't brake
|
||||
if save data stored is -1.
|
||||
*/
|
||||
// see above
|
||||
MapZoneArray[i].child = GetPointerForZoneIndex((uintptr)MapZoneArray[i].child);
|
||||
MapZoneArray[i].parent = GetPointerForZoneIndex((uintptr)MapZoneArray[i].parent);
|
||||
MapZoneArray[i].next = GetPointerForZoneIndex((uintptr)MapZoneArray[i].next);
|
||||
|
@ -103,8 +103,8 @@ public:
|
||||
static void SetPedDensity(uint16 zoneid, uint8 day, uint16 peddensity);
|
||||
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
|
||||
static int16 FindAudioZone(CVector *pos);
|
||||
static CZone *GetPointerForZoneIndex(int32 i) { return i == -1 ? nil : &InfoZoneArray[i]; }
|
||||
static int32 GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - InfoZoneArray; }
|
||||
static CZone *GetPointerForZoneIndex(int32 i) { return i == -1 ? nil : &NavigationZoneArray[i]; }
|
||||
static int32 GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - NavigationZoneArray; }
|
||||
static void AddZoneToAudioZoneArray(CZone *zone);
|
||||
static void InitialiseAudioZoneArray(void);
|
||||
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
||||
|
@ -27,16 +27,16 @@ enum Config {
|
||||
|
||||
// Pool sizes
|
||||
NUMPTRNODES = 50000,
|
||||
NUMENTRYINFOS = 5400, // only 3200 in VC???
|
||||
NUMENTRYINFOS = 3200,
|
||||
NUMPEDS = 140,
|
||||
NUMVEHICLES = 110,
|
||||
NUMBUILDINGS = 7000,
|
||||
NUMTREADABLES = 1214, // 1 in VC
|
||||
NUMTREADABLES = 1,
|
||||
NUMOBJECTS = 460,
|
||||
NUMDUMMIES = 2802, // 2340 in VC
|
||||
NUMAUDIOSCRIPTOBJECTS = 256, // 192 in VC
|
||||
NUMDUMMIES = 2340,
|
||||
NUMAUDIOSCRIPTOBJECTS = 192,
|
||||
NUMCOLMODELS = 4400,
|
||||
NUMCUTSCENEOBJECTS = 50, // does not exist in VC
|
||||
// TODO(MIAMI): colmodel pool
|
||||
|
||||
NUMANIMBLOCKS = 35,
|
||||
NUMANIMATIONS = 450,
|
||||
@ -113,6 +113,7 @@ enum Config {
|
||||
NUMPHONES = 50,
|
||||
NUMPEDGROUPS = 67,
|
||||
NUMMODELSPERPEDGROUP = 16,
|
||||
MAXZONEPEDSLOADED = 8,
|
||||
NUMSHOTINFOS = 100,
|
||||
|
||||
NUMROADBLOCKS = 300,
|
||||
@ -224,7 +225,15 @@ enum Config {
|
||||
//#define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
|
||||
//#define NO_ISLAND_LOADING // disable loadscreen between islands via loading all island data at once, consumes more memory and CPU
|
||||
//#define USE_TEXTURE_POOL
|
||||
#define CUTSCENE_BORDERS_SWITCH
|
||||
//#define CUTSCENE_BORDERS_SWITCH
|
||||
//#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||
//#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||
//#define MULTISAMPLING // adds MSAA option TODO
|
||||
|
||||
#ifdef LIBRW
|
||||
// these are not supported with librw yet
|
||||
# undef MULTISAMPLING
|
||||
#endif
|
||||
|
||||
// Water & Particle
|
||||
#define PC_PARTICLE
|
||||
@ -244,6 +253,7 @@ enum Config {
|
||||
#define ALLCARSHELI_CHEAT
|
||||
#define ALT_DODO_CHEAT
|
||||
#define REGISTER_START_BUTTON
|
||||
//#define BIND_VEHICLE_FIREWEAPON // Adds ability to rebind fire key for 'in vehicle' controls
|
||||
|
||||
// Hud, frontend and radar
|
||||
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
|
||||
@ -254,12 +264,13 @@ enum Config {
|
||||
#ifndef PC_MENU
|
||||
# define PS2_MENU
|
||||
//# define PS2_MENU_USEALLPAGEICONS
|
||||
#else
|
||||
//# define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
|
||||
#else
|
||||
# define MAP_ENHANCEMENTS // Adding waypoint etc.
|
||||
# define TRIANGLE_BACK_BUTTON
|
||||
//# define CIRCLE_BACK_BUTTON
|
||||
//#define CUSTOM_FRONTEND_OPTIONS
|
||||
# define GRAPHICS_MENU_OPTIONS
|
||||
#define LEGACY_MENU_OPTIONS
|
||||
#define MUCH_SHORTER_OUTRO_SCREEN
|
||||
|
||||
|
@ -2,6 +2,10 @@
|
||||
#include "rpmatfx.h"
|
||||
#include "rphanim.h"
|
||||
#include "rpskin.h"
|
||||
#include "rtbmp.h"
|
||||
#ifndef LIBRW
|
||||
#include "rpanisot.h"
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "CdStream.h"
|
||||
@ -61,8 +65,10 @@
|
||||
#include "MemoryCard.h"
|
||||
#include "SceneEdit.h"
|
||||
#include "debugmenu.h"
|
||||
#include "Clock.h"
|
||||
#include "Occlusion.h"
|
||||
#include "Ropes.h"
|
||||
#include "custompipes.h"
|
||||
|
||||
GlobalScene Scene;
|
||||
|
||||
@ -279,6 +285,28 @@ DoFade(void)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
RwGrabScreen(RwCamera *camera, RwChar *filename)
|
||||
{
|
||||
char temp[255];
|
||||
RwImage *pImage = RsGrabScreen(camera);
|
||||
bool result = true;
|
||||
|
||||
if (pImage == nil)
|
||||
return false;
|
||||
|
||||
strcpy(temp, CFileMgr::GetRootDirName());
|
||||
strcat(temp, filename);
|
||||
|
||||
if (RtBMPImageWrite(pImage, &temp[0]) == nil)
|
||||
result = false;
|
||||
RwImageDestroy(pImage);
|
||||
return result;
|
||||
}
|
||||
|
||||
#define TILE_WIDTH 576
|
||||
#define TILE_HEIGHT 432
|
||||
|
||||
void
|
||||
DoRWStuffEndOfFrame(void)
|
||||
{
|
||||
@ -287,6 +315,20 @@ DoRWStuffEndOfFrame(void)
|
||||
FlushObrsPrintfs();
|
||||
RwCameraEndUpdate(Scene.camera);
|
||||
RsCameraShowRaster(Scene.camera);
|
||||
#ifndef MASTER
|
||||
char s[48];
|
||||
if (CPad::GetPad(1)->GetLeftShockJustDown()) {
|
||||
// try using both controllers for this thing... crazy bastards
|
||||
if (CPad::GetPad(0)->GetRightStickY() > 0) {
|
||||
sprintf(s, "screen%d%d.ras", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes);
|
||||
// TODO
|
||||
//RtTileRender(Scene.camera, TILE_WIDTH * 2, TILE_HEIGHT * 2, TILE_WIDTH, TILE_HEIGHT, &NewTileRendererCB, nil, s);
|
||||
} else {
|
||||
sprintf(s, "screen%d%d.bmp", CClock::ms_nGameClockHours, CClock::ms_nGameClockMinutes);
|
||||
RwGrabScreen(Scene.camera, s);
|
||||
}
|
||||
}
|
||||
#endif // !MASTER
|
||||
}
|
||||
|
||||
static RwBool
|
||||
@ -345,6 +387,12 @@ PluginAttach(void)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#ifndef LIBRW
|
||||
RpAnisotPluginAttach();
|
||||
#endif
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
CustomPipes::CustomPipeRegister();
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -358,7 +406,11 @@ Initialise3D(void *param)
|
||||
DebugMenuInit();
|
||||
DebugMenuPopulate();
|
||||
#endif // !DEBUGMENU
|
||||
return CGame::InitialiseRenderWare();
|
||||
bool ret = CGame::InitialiseRenderWare();
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
CustomPipes::CustomPipeInit(); // need Scene.world for this
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
return (FALSE);
|
||||
@ -367,6 +419,9 @@ Initialise3D(void *param)
|
||||
static void
|
||||
Terminate3D(void)
|
||||
{
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
CustomPipes::CustomPipeShutdown();
|
||||
#endif
|
||||
CGame::ShutdownRenderWare();
|
||||
#ifdef DEBUGMENU
|
||||
DebugMenuShutdown();
|
||||
@ -554,17 +609,13 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
|
||||
}
|
||||
}
|
||||
|
||||
//--MIAMI: done
|
||||
void
|
||||
LoadingIslandScreen(const char *levelName)
|
||||
{
|
||||
CSprite2d *splash;
|
||||
wchar *name;
|
||||
char str[100];
|
||||
wchar wstr[80];
|
||||
CRGBA col;
|
||||
|
||||
splash = LoadSplash(nil);
|
||||
name = TheText.Get(levelName);
|
||||
if(!DoRWStuffStartOfFrame(0, 0, 0, 0, 0, 0, 255))
|
||||
return;
|
||||
|
||||
@ -572,26 +623,10 @@ LoadingIslandScreen(const char *levelName)
|
||||
CSprite2d::InitPerFrame();
|
||||
CFont::InitPerFrame();
|
||||
DefinedState();
|
||||
col = CRGBA(255, 255, 255, 255);
|
||||
CRGBA col = CRGBA(255, 255, 255, 255);
|
||||
CRGBA col2 = CRGBA(0, 0, 0, 255);
|
||||
CSprite2d::DrawRect(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), col2);
|
||||
splash->Draw(CRect(0.0f, 0.0f, SCREEN_WIDTH, SCREEN_HEIGHT), col, col, col, col);
|
||||
CFont::SetBackgroundOff();
|
||||
CFont::SetScale(1.5f, 1.5f);
|
||||
CFont::SetPropOn();
|
||||
CFont::SetRightJustifyOn();
|
||||
CFont::SetRightJustifyWrap(150.0f);
|
||||
CFont::SetFontStyle(FONT_HEADING);
|
||||
sprintf(str, "WELCOME TO");
|
||||
AsciiToUnicode(str, wstr);
|
||||
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
|
||||
CFont::SetDropShadowPosition(3);
|
||||
CFont::SetColor(CRGBA(243, 237, 71, 255));
|
||||
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f));
|
||||
CFont::PrintString(SCREEN_WIDTH - 20, SCREEN_STRETCH_FROM_BOTTOM(110.0f), TheText.Get("WELCOME"));
|
||||
TextCopy(wstr, name);
|
||||
TheText.UpperCase(wstr);
|
||||
CFont::SetColor(CRGBA(243, 237, 71, 255));
|
||||
CFont::SetScale(SCREEN_STRETCH_X(1.2f), SCREEN_STRETCH_Y(1.2f));
|
||||
CFont::PrintString(SCREEN_WIDTH-20, SCREEN_STRETCH_FROM_BOTTOM(80.0f), wstr);
|
||||
CFont::DrawFonts();
|
||||
DoRWStuffEndOfFrame();
|
||||
}
|
||||
@ -852,7 +887,7 @@ RenderScene(void)
|
||||
CRenderer::RenderFadingInEntities();
|
||||
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
|
||||
CWeather::RenderRainStreaks();
|
||||
// CCoronas::RenderSunReflection
|
||||
CCoronas::RenderSunReflection();
|
||||
}
|
||||
|
||||
void
|
||||
@ -1065,6 +1100,12 @@ Idle(void *arg)
|
||||
tbEndTimer("PreRender");
|
||||
#endif
|
||||
|
||||
#ifdef FIX_BUGS
|
||||
// This has to be done BEFORE RwCameraBeginUpdate
|
||||
RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
|
||||
RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
|
||||
#endif
|
||||
|
||||
if(CWeather::LightningFlash && !CCullZones::CamNoRain()){
|
||||
if(!DoRWStuffStartOfFrame_Horizon(255, 255, 255, 255, 255, 255, 255))
|
||||
return;
|
||||
@ -1077,9 +1118,10 @@ Idle(void *arg)
|
||||
|
||||
DefinedState();
|
||||
|
||||
// BUG. This has to be done BEFORE RwCameraBeginUpdate
|
||||
#ifndef FIX_BUGS
|
||||
RwCameraSetFarClipPlane(Scene.camera, CTimeCycle::GetFarClip());
|
||||
RwCameraSetFogDistance(Scene.camera, CTimeCycle::GetFogStart());
|
||||
#endif
|
||||
|
||||
#ifdef TIMEBARS
|
||||
tbStartTimer(0, "RenderScene");
|
||||
@ -1088,6 +1130,11 @@ Idle(void *arg)
|
||||
#ifdef TIMEBARS
|
||||
tbEndTimer("RenderScene");
|
||||
#endif
|
||||
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
CustomPipes::EnvMapRender();
|
||||
#endif
|
||||
|
||||
RenderDebugShit();
|
||||
RenderEffects();
|
||||
|
||||
|
@ -20,6 +20,9 @@ extern bool gbShowTimebars;
|
||||
|
||||
class CSprite2d;
|
||||
|
||||
bool DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||
bool DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha);
|
||||
void DoRWStuffEndOfFrame(void);
|
||||
void InitialiseGame(void);
|
||||
void LoadingScreen(const char *str1, const char *str2, const char *splashscreen);
|
||||
void LoadingIslandScreen(const char *levelName);
|
||||
|
189
src/core/re3.cpp
189
src/core/re3.cpp
@ -7,6 +7,7 @@
|
||||
#include "Credits.h"
|
||||
#include "Camera.h"
|
||||
#include "Weather.h"
|
||||
#include "Timecycle.h"
|
||||
#include "Clock.h"
|
||||
#include "World.h"
|
||||
#include "Vehicle.h"
|
||||
@ -32,6 +33,9 @@
|
||||
#include "WaterLevel.h"
|
||||
#include "main.h"
|
||||
#include "Script.h"
|
||||
#include "MBlur.h"
|
||||
#include "postfx.h"
|
||||
#include "custompipes.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include "assert.h"
|
||||
@ -71,110 +75,6 @@ mysrand(unsigned int seed)
|
||||
myrand_seed = seed;
|
||||
}
|
||||
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
#include "frontendoption.h"
|
||||
#include "platform.h"
|
||||
|
||||
void ReloadFrontendOptions(void)
|
||||
{
|
||||
CustomFrontendOptionsPopulate();
|
||||
}
|
||||
|
||||
#ifdef MORE_LANGUAGES
|
||||
void LangPolSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_POLISH;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void LangRusSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_RUSSIAN;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void LangJapSelect(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
FrontEndMenuManager.m_PrefsLanguage = CMenuManager::LANGUAGE_JAPANESE;
|
||||
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
|
||||
FrontEndMenuManager.InitialiseChangedLanguageSettings();
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef IMPROVED_VIDEOMODE
|
||||
void ScreenModeChange(int8 displayedValue)
|
||||
{
|
||||
if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) {
|
||||
FrontEndMenuManager.m_nPrefsWindowed = displayedValue;
|
||||
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution
|
||||
FrontEndMenuManager.SetHelperText(0);
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FREE_CAM
|
||||
void ToggleFreeCam(int8 action)
|
||||
{
|
||||
if (action == FEOPTION_ACTION_SELECT) {
|
||||
TheCamera.bFreeCam = !TheCamera.bFreeCam;
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CUTSCENE_BORDERS_SWITCH
|
||||
void BorderModeChange(int8 displayedValue)
|
||||
{
|
||||
CMenuManager::m_PrefsCutsceneBorders = !!displayedValue;
|
||||
FrontEndMenuManager.SaveSettings();
|
||||
}
|
||||
#endif
|
||||
|
||||
// Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind
|
||||
void
|
||||
CustomFrontendOptionsPopulate(void)
|
||||
{
|
||||
RemoveCustomFrontendOptions(); // if exist
|
||||
|
||||
#ifdef MORE_LANGUAGES
|
||||
FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS);
|
||||
FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil);
|
||||
FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, LangRusSelect, nil);
|
||||
FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, LangJapSelect, nil);
|
||||
#endif
|
||||
|
||||
#ifdef IMPROVED_VIDEOMODE
|
||||
static const wchar *screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" };
|
||||
FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 8);
|
||||
FrontendOptionAddSelect(TheText.Get("SCRFOR"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil);
|
||||
#endif
|
||||
|
||||
#ifdef FREE_CAM
|
||||
static const wchar *text = (wchar*)L"TOGGLE FREE CAM";
|
||||
FrontendOptionSetPosition(MENUPAGE_CONTROLLER_PC, 1);
|
||||
FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil);
|
||||
#endif
|
||||
|
||||
#ifdef CUTSCENE_BORDERS_SWITCH
|
||||
static const wchar *off_on[] = { TheText.Get("FEM_OFF"), TheText.Get("FEM_ON") };
|
||||
FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 9);
|
||||
FrontendOptionAddSelect((const wchar *)L"CUTSCENE BORDERS", off_on, 2, (int8 *)&CMenuManager::m_PrefsCutsceneBorders, false, BorderModeChange, nil);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUGMENU
|
||||
void WeaponCheat1();
|
||||
void WeaponCheat2();
|
||||
@ -399,6 +299,12 @@ SETTWEAKPATH("TEST");
|
||||
TWEAKSWITCH(CWeather::NewWeatherType, 0, 3, wt, NULL);
|
||||
*/
|
||||
|
||||
void
|
||||
switchWeather(void)
|
||||
{
|
||||
CWeather::StreamAfterRainTimer = 0;
|
||||
}
|
||||
|
||||
void
|
||||
DebugMenuPopulate(void)
|
||||
{
|
||||
@ -406,17 +312,38 @@ DebugMenuPopulate(void)
|
||||
static const char *weathers[] = {
|
||||
"Sunny", "Cloudy", "Rainy", "Foggy", "Extrasunny", "Stormy"
|
||||
};
|
||||
static const char *extracols[] = {
|
||||
"1 - Malibu club",
|
||||
"2 - Strib club",
|
||||
"3 - Hotel",
|
||||
"4 - Bank",
|
||||
"5 - Police HQ",
|
||||
"6 - Mall",
|
||||
"7 - Rifle Range",
|
||||
"8 - Mansion",
|
||||
"9 - Dirt ring",
|
||||
"10 - Blood ring",
|
||||
"11 - Hot ring",
|
||||
"12 - Concert hall",
|
||||
"13 - Auntie Poulets",
|
||||
"14 - Intro at docks",
|
||||
"15 - Biker bar",
|
||||
"16 - Intro cafe",
|
||||
"17 - Studio",
|
||||
"18", "19", "20", "21", "22", "23", "24"
|
||||
};
|
||||
DebugMenuEntry *e;
|
||||
e = DebugMenuAddVar("Time & Weather", "Current Hour", &CClock::GetHoursRef(), nil, 1, 0, 23, nil);
|
||||
DebugMenuEntrySetWrap(e, true);
|
||||
e = DebugMenuAddVar("Time & Weather", "Current Minute", &CClock::GetMinutesRef(),
|
||||
[](){ CWeather::InterpolationValue = CClock::GetMinutes()/60.0f; }, 1, 0, 59, nil);
|
||||
DebugMenuEntrySetWrap(e, true);
|
||||
e = DebugMenuAddVar("Time & Weather", "Old Weather", (int16*)&CWeather::OldWeatherType, nil, 1, 0, 5, weathers);
|
||||
e = DebugMenuAddVar("Time & Weather", "Old Weather", (int16*)&CWeather::OldWeatherType, switchWeather, 1, 0, 5, weathers);
|
||||
DebugMenuEntrySetWrap(e, true);
|
||||
e = DebugMenuAddVar("Time & Weather", "New Weather", (int16*)&CWeather::NewWeatherType, nil, 1, 0, 5, weathers);
|
||||
e = DebugMenuAddVar("Time & Weather", "New Weather", (int16*)&CWeather::NewWeatherType, switchWeather, 1, 0, 5, weathers);
|
||||
DebugMenuEntrySetWrap(e, true);
|
||||
DebugMenuAddVar("Time & Weather", "Wind", (float*)&CWeather::Wind, nil, 0.1f, 0.0f, 1.0f);
|
||||
DebugMenuAddVarBool32("Time & Weather", "Extracolours On", &CTimeCycle::m_bExtraColourOn, nil);
|
||||
DebugMenuAddVar("Time & Weather", "Extracolour", &CTimeCycle::m_ExtraColour, nil, 1, 0, 23, extracols);
|
||||
DebugMenuAddVar("Time & Weather", "Time scale", (float*)&CTimer::GetTimeScale(), nil, 0.1f, 0.0f, 10.0f);
|
||||
|
||||
DebugMenuAddCmd("Cheats", "Weapon set 1", WeaponCheat1);
|
||||
@ -493,7 +420,27 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
||||
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
|
||||
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
|
||||
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);
|
||||
DebugMenuEntrySetWrap(e, true);
|
||||
DebugMenuAddVar("Render", "Intensity", &CPostFX::Intensity, nil, 0.05f, 0, 10.0f);
|
||||
DebugMenuAddVarBool8("Render", "Blur", &CPostFX::BlurOn, nil);
|
||||
DebugMenuAddVarBool8("Render", "Motion Blur", &CPostFX::MotionBlurOn, nil);
|
||||
#endif
|
||||
DebugMenuAddVar("Render", "Drunkness", &CMBlur::Drunkness, nil, 0.05f, 0, 1.0f);
|
||||
DebugMenuAddVarBool8("Render", "Occlusion debug", &bDisplayOccDebugStuff, nil);
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
static const char *vehpipenames[] = { "MatFX", "Neo" };
|
||||
e = DebugMenuAddVar("Render", "Vehicle Pipeline", &CustomPipes::VehiclePipeSwitch, nil,
|
||||
1, CustomPipes::VEHICLEPIPE_MATFX, CustomPipes::VEHICLEPIPE_NEO, vehpipenames);
|
||||
DebugMenuEntrySetWrap(e, true);
|
||||
DebugMenuAddVar("Render", "Neo Vehicle Shininess", &CustomPipes::VehicleShininess, nil, 0.1f, 0, 1.0f);
|
||||
DebugMenuAddVar("Render", "Neo Vehicle Specularity", &CustomPipes::VehicleSpecularity, nil, 0.1f, 0, 1.0f);
|
||||
DebugMenuAddVar("Render", "Neo Ped Rim light", &CustomPipes::RimlightMult, nil, 0.1f, 0, 1.0f);
|
||||
DebugMenuAddVar("Render", "Neo World Lightmaps", &CustomPipes::LightmapMult, nil, 0.1f, 0, 1.0f);
|
||||
DebugMenuAddVar("Render", "Neo Road Gloss", &CustomPipes::GlossMult, nil, 0.1f, 0, 1.0f);
|
||||
#endif
|
||||
DebugMenuAddVarBool8("Render", "Show Ped Paths", &gbShowPedPaths, nil);
|
||||
DebugMenuAddVarBool8("Render", "Show Car Paths", &gbShowCarPaths, nil);
|
||||
DebugMenuAddVarBool8("Render", "Show Car Path Links", &gbShowCarPathsLinks, nil);
|
||||
@ -520,9 +467,6 @@ DebugMenuPopulate(void)
|
||||
|
||||
DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
|
||||
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions);
|
||||
#endif
|
||||
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
|
||||
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
|
||||
|
||||
@ -534,7 +478,30 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil);
|
||||
#endif
|
||||
#ifdef MISSION_SWITCHER
|
||||
DebugMenuAddInt8("Debug", "Select mission no", &nextMissionToSwitch, nil, 1, 0, 96, nil);
|
||||
DebugMenuEntry *missionEntry;
|
||||
static const char* missions[] = {
|
||||
"Initial", "Intro", "An Old Friend", "The Party", "Back Alley Brawl", "Jury Fury", "Riot",
|
||||
"Treacherous Swine", "Mall Shootout", "Guardian Angels", "Sir, Yes Sir!", "All Hands On Deck!",
|
||||
"The Chase", "Phnom Penh '86", "The Fastest Boat", "Supply & Demand", "Rub Out", "Death Row",
|
||||
"Four Iron", "Demolition Man", "Two Bit Hit", "No Escape?", "The Shootist", "The Driver",
|
||||
"The Job", "Gun Runner", "Boomshine Saigon", "Recruitment Drive", "Dildo Dodo", "Martha's Mug Shot",
|
||||
"G-spotlight", "Shakedown", "Bar Brawl", "Cop Land", "Spilling the Beans", "Hit the Courier",
|
||||
"Printworks Buy", "Sunshine Autos", "Interglobal Films Buy", "Cherry Popper Icecreams Buy",
|
||||
"Kaufman Cabs Buy", "Malibu Club Buy", "The Boatyard Buy", "Pole Position Club Buy", "El Swanko Casa Buy",
|
||||
"Links View Apartment Buy", "Hyman Condo Buy", "Ocean Heighs Aprt. Buy", "1102 Washington Street Buy",
|
||||
"Vice Point Buy", "Skumole Shack Buy", "Cap the Collector", "Keep your Friends Close...",
|
||||
"Alloy Wheels of Steel", "Messing with the Man", "Hog Tied", "Stunt Boat Challenge", "Cannon Fodder",
|
||||
"Naval Engagement", "Trojan Voodoo", "Juju Scramble", "Bombs Away!", "Dirty Lickin's", "Love Juice",
|
||||
"Psycho Killer", "Publicity Tour", "Weapon Range", "Road Kill", "Waste the Wife", "Autocide",
|
||||
"Check Out at the Check In", "Loose Ends", "V.I.P.", "Friendly Rivalry", "Cabmaggedon", "TAXI DRIVER",
|
||||
"PARAMEDIC", "FIREFIGHTER", "VIGILANTE", "HOTRING", "BLOODRING", "DIRTRING", "Sunshine Autos Races",
|
||||
"Distribution", "Downtown Chopper Checkpoint", "Ocean Beach Chopper Checkpoint", "Vice Point Chopper Checkpoint",
|
||||
"Little Haiti Chopper Checkpoint", "Trial by Dirt", "Test Track", "PCJ Playground", "Cone Crazy",
|
||||
"PIZZA BOY", "RC Raider Pickup", "RC Bandit Race", "RC Baron Race", "Checkpoint Charlie"
|
||||
};
|
||||
|
||||
missionEntry = DebugMenuAddVar("Debug", "Select mission", &nextMissionToSwitch, nil, 1, 0, 96, missions);
|
||||
DebugMenuEntrySetWrap(missionEntry, true);
|
||||
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
|
||||
#endif
|
||||
extern bool PrintDebugCode;
|
||||
|
@ -45,7 +45,7 @@ class CPool
|
||||
|
||||
public:
|
||||
// TODO(MIAMI): remove ctor without name argument
|
||||
CPool(int size){
|
||||
CPool(int size, const char *name){
|
||||
// TODO: use new here
|
||||
m_entries = (U*)malloc(sizeof(U)*size);
|
||||
m_flags = (Flags*)malloc(sizeof(Flags)*size);
|
||||
@ -56,8 +56,6 @@ public:
|
||||
m_flags[i].free = 1;
|
||||
}
|
||||
}
|
||||
CPool(int size, const char *name)
|
||||
: CPool(size) {}
|
||||
~CPool() {
|
||||
Flush();
|
||||
}
|
||||
|
@ -33,7 +33,7 @@
|
||||
#include "WindModifiers.h"
|
||||
#include "Occlusion.h"
|
||||
|
||||
//--MIAMI: file almost done (see TODO)
|
||||
//--MIAMI: file done
|
||||
|
||||
int gBuildings;
|
||||
|
||||
|
536
src/extras/custompipes.cpp
Normal file
536
src/extras/custompipes.cpp
Normal file
@ -0,0 +1,536 @@
|
||||
#define WITH_D3D
|
||||
#include "common.h"
|
||||
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
||||
#include "main.h"
|
||||
#include "RwHelper.h"
|
||||
#include "Lights.h"
|
||||
#include "Timecycle.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Clock.h"
|
||||
#include "Weather.h"
|
||||
#include "TxdStore.h"
|
||||
#include "Renderer.h"
|
||||
#include "World.h"
|
||||
#include "custompipes.h"
|
||||
|
||||
#ifndef LIBRW
|
||||
#error "Need librw for EXTENDED_PIPELINES"
|
||||
#endif
|
||||
|
||||
namespace CustomPipes {
|
||||
|
||||
rw::int32 CustomMatOffset;
|
||||
|
||||
void*
|
||||
CustomMatCtor(void *object, int32, int32)
|
||||
{
|
||||
CustomMatExt *ext = GetCustomMatExt((rw::Material*)object);
|
||||
ext->glossTex = nil;
|
||||
ext->haveGloss = false;
|
||||
return object;
|
||||
}
|
||||
|
||||
void*
|
||||
CustomMatCopy(void *dst, void *src, int32, int32)
|
||||
{
|
||||
CustomMatExt *srcext = GetCustomMatExt((rw::Material*)src);
|
||||
CustomMatExt *dstext = GetCustomMatExt((rw::Material*)dst);
|
||||
dstext->glossTex = srcext->glossTex;
|
||||
dstext->haveGloss = srcext->haveGloss;
|
||||
return dst;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static rw::TexDictionary *neoTxd;
|
||||
|
||||
bool bRenderingEnvMap;
|
||||
int32 EnvMapSize = 128;
|
||||
rw::Camera *EnvMapCam;
|
||||
rw::Texture *EnvMapTex;
|
||||
rw::Texture *EnvMaskTex;
|
||||
static rw::RWDEVICE::Im2DVertex EnvScreenQuad[4];
|
||||
static int16 QuadIndices[6] = { 0, 1, 2, 0, 2, 3 };
|
||||
|
||||
static rw::Camera*
|
||||
CreateEnvMapCam(rw::World *world)
|
||||
{
|
||||
rw::Raster *fbuf = rw::Raster::create(EnvMapSize, EnvMapSize, 0, rw::Raster::CAMERATEXTURE);
|
||||
if(fbuf){
|
||||
rw::Raster *zbuf = rw::Raster::create(EnvMapSize, EnvMapSize, 0, rw::Raster::ZBUFFER);
|
||||
if(zbuf){
|
||||
rw::Frame *frame = rw::Frame::create();
|
||||
if(frame){
|
||||
rw::Camera *cam = rw::Camera::create();
|
||||
if(cam){
|
||||
cam->frameBuffer = fbuf;
|
||||
cam->zBuffer = zbuf;
|
||||
cam->setFrame(frame);
|
||||
cam->setNearPlane(0.1f);
|
||||
cam->setFarPlane(250.0f);
|
||||
rw::V2d vw = { 2.0f, 2.0f };
|
||||
cam->setViewWindow(&vw);
|
||||
world->addCamera(cam);
|
||||
EnvMapTex = rw::Texture::create(fbuf);
|
||||
EnvMapTex->setFilter(rw::Texture::LINEAR);
|
||||
|
||||
frame->matrix.right.x = -1.0f;
|
||||
frame->matrix.up.y = -1.0f;
|
||||
frame->matrix.update();
|
||||
return cam;
|
||||
}
|
||||
frame->destroy();
|
||||
}
|
||||
zbuf->destroy();
|
||||
}
|
||||
fbuf->destroy();
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
static void
|
||||
DestroyCam(rw::Camera *cam)
|
||||
{
|
||||
if(cam == nil)
|
||||
return;
|
||||
if(cam->frameBuffer){
|
||||
cam->frameBuffer->destroy();
|
||||
cam->frameBuffer = nil;
|
||||
}
|
||||
if(cam->zBuffer){
|
||||
cam->zBuffer->destroy();
|
||||
cam->zBuffer = nil;
|
||||
}
|
||||
rw::Frame *f = cam->getFrame();
|
||||
if(f){
|
||||
cam->setFrame(nil);
|
||||
f->destroy();
|
||||
}
|
||||
cam->world->removeCamera(cam);
|
||||
cam->destroy();
|
||||
}
|
||||
|
||||
void
|
||||
RenderEnvMapScene(void)
|
||||
{
|
||||
CRenderer::RenderRoads();
|
||||
CRenderer::RenderEverythingBarRoads();
|
||||
CRenderer::RenderFadingInEntities();
|
||||
}
|
||||
|
||||
void
|
||||
EnvMapRender(void)
|
||||
{
|
||||
if(VehiclePipeSwitch != VEHICLEPIPE_NEO)
|
||||
return;
|
||||
|
||||
RwCameraEndUpdate(Scene.camera);
|
||||
|
||||
// Neo does this differently, but i'm not quite convinced it's much better
|
||||
rw::V3d camPos = FindPlayerCoors();
|
||||
EnvMapCam->getFrame()->matrix.pos = camPos;
|
||||
EnvMapCam->getFrame()->transform(&EnvMapCam->getFrame()->matrix, rw::COMBINEREPLACE);
|
||||
|
||||
rw::RGBA skycol = { CTimeCycle::GetSkyBottomRed(), CTimeCycle::GetSkyBottomGreen(), CTimeCycle::GetSkyBottomBlue(), 255 };
|
||||
EnvMapCam->clear(&skycol, rwCAMERACLEARZ|rwCAMERACLEARIMAGE);
|
||||
RwCameraBeginUpdate(EnvMapCam);
|
||||
bRenderingEnvMap = true;
|
||||
RenderEnvMapScene();
|
||||
bRenderingEnvMap = false;
|
||||
|
||||
if(EnvMaskTex){
|
||||
rw::SetRenderState(rw::VERTEXALPHA, TRUE);
|
||||
rw::SetRenderState(rw::SRCBLEND, rw::BLENDZERO);
|
||||
rw::SetRenderState(rw::DESTBLEND, rw::BLENDSRCCOLOR);
|
||||
rw::SetRenderStatePtr(rw::TEXTURERASTER, EnvMaskTex->raster);
|
||||
rw::im2d::RenderIndexedPrimitive(rw::PRIMTYPETRILIST, EnvScreenQuad, 4, QuadIndices, 6);
|
||||
rw::SetRenderState(rw::SRCBLEND, rw::BLENDSRCALPHA);
|
||||
rw::SetRenderState(rw::DESTBLEND, rw::BLENDINVSRCALPHA);
|
||||
}
|
||||
RwCameraEndUpdate(EnvMapCam);
|
||||
|
||||
|
||||
RwCameraBeginUpdate(Scene.camera);
|
||||
|
||||
// debug env map
|
||||
// rw::SetRenderStatePtr(rw::TEXTURERASTER, EnvMapTex->raster);
|
||||
// rw::im2d::RenderIndexedPrimitive(rw::PRIMTYPETRILIST, EnvScreenQuad, 4, QuadIndices, 6);
|
||||
}
|
||||
|
||||
static void
|
||||
EnvMapInit(void)
|
||||
{
|
||||
if(neoTxd)
|
||||
EnvMaskTex = neoTxd->find("CarReflectionMask");
|
||||
|
||||
EnvMapCam = CreateEnvMapCam(Scene.world);
|
||||
|
||||
int width = EnvMapCam->frameBuffer->width;
|
||||
int height = EnvMapCam->frameBuffer->height;
|
||||
float screenZ = RwIm2DGetNearScreenZ();
|
||||
float recipZ = 1.0f/EnvMapCam->nearPlane;
|
||||
|
||||
EnvScreenQuad[0].setScreenX(0.0f);
|
||||
EnvScreenQuad[0].setScreenY(0.0f);
|
||||
EnvScreenQuad[0].setScreenZ(screenZ);
|
||||
EnvScreenQuad[0].setCameraZ(EnvMapCam->nearPlane);
|
||||
EnvScreenQuad[0].setRecipCameraZ(recipZ);
|
||||
EnvScreenQuad[0].setColor(255, 255, 255, 255);
|
||||
EnvScreenQuad[0].setU(0.0f, recipZ);
|
||||
EnvScreenQuad[0].setV(0.0f, recipZ);
|
||||
|
||||
EnvScreenQuad[1].setScreenX(0.0f);
|
||||
EnvScreenQuad[1].setScreenY(height);
|
||||
EnvScreenQuad[1].setScreenZ(screenZ);
|
||||
EnvScreenQuad[1].setCameraZ(EnvMapCam->nearPlane);
|
||||
EnvScreenQuad[1].setRecipCameraZ(recipZ);
|
||||
EnvScreenQuad[1].setColor(255, 255, 255, 255);
|
||||
EnvScreenQuad[1].setU(0.0f, recipZ);
|
||||
EnvScreenQuad[1].setV(1.0f, recipZ);
|
||||
|
||||
EnvScreenQuad[2].setScreenX(width);
|
||||
EnvScreenQuad[2].setScreenY(height);
|
||||
EnvScreenQuad[2].setScreenZ(screenZ);
|
||||
EnvScreenQuad[2].setCameraZ(EnvMapCam->nearPlane);
|
||||
EnvScreenQuad[2].setRecipCameraZ(recipZ);
|
||||
EnvScreenQuad[2].setColor(255, 255, 255, 255);
|
||||
EnvScreenQuad[2].setU(1.0f, recipZ);
|
||||
EnvScreenQuad[2].setV(1.0f, recipZ);
|
||||
|
||||
EnvScreenQuad[3].setScreenX(width);
|
||||
EnvScreenQuad[3].setScreenY(0.0f);
|
||||
EnvScreenQuad[3].setScreenZ(screenZ);
|
||||
EnvScreenQuad[3].setCameraZ(EnvMapCam->nearPlane);
|
||||
EnvScreenQuad[3].setRecipCameraZ(recipZ);
|
||||
EnvScreenQuad[3].setColor(255, 255, 255, 255);
|
||||
EnvScreenQuad[3].setU(1.0f, recipZ);
|
||||
EnvScreenQuad[3].setV(0.0f, recipZ);
|
||||
}
|
||||
|
||||
static void
|
||||
EnvMapShutdown(void)
|
||||
{
|
||||
EnvMapTex->raster = nil;
|
||||
EnvMapTex->destroy();
|
||||
EnvMapTex = nil;
|
||||
DestroyCam(EnvMapCam);
|
||||
EnvMapCam = nil;
|
||||
}
|
||||
|
||||
/*
|
||||
* Tweak values
|
||||
*/
|
||||
|
||||
#define INTERP_SETUP \
|
||||
int h1 = CClock::GetHours(); \
|
||||
int h2 = (h1+1)%24; \
|
||||
int w1 = CWeather::OldWeatherType; \
|
||||
int w2 = CWeather::NewWeatherType; \
|
||||
float timeInterp = (CClock::GetSeconds()/60.0f + CClock::GetMinutes())/60.0f; \
|
||||
float c0 = (1.0f-timeInterp)*(1.0f-CWeather::InterpolationValue); \
|
||||
float c1 = timeInterp*(1.0f-CWeather::InterpolationValue); \
|
||||
float c2 = (1.0f-timeInterp)*CWeather::InterpolationValue; \
|
||||
float c3 = timeInterp*CWeather::InterpolationValue;
|
||||
#define INTERP(v) v[h1][w1]*c0 + v[h2][w1]*c1 + v[h1][w2]*c2 + v[h2][w2]*c3;
|
||||
#define INTERPF(v,f) v[h1][w1].f*c0 + v[h2][w1].f*c1 + v[h1][w2].f*c2 + v[h2][w2].f*c3;
|
||||
|
||||
InterpolatedFloat::InterpolatedFloat(float init)
|
||||
{
|
||||
curInterpolator = 61; // compared against second
|
||||
for(int h = 0; h < 24; h++)
|
||||
for(int w = 0; w < NUMWEATHERS; w++)
|
||||
data[h][w] = init;
|
||||
}
|
||||
|
||||
void
|
||||
InterpolatedFloat::Read(char *s, int line, int field)
|
||||
{
|
||||
sscanf(s, "%f", &data[line][field]);
|
||||
}
|
||||
|
||||
float
|
||||
InterpolatedFloat::Get(void)
|
||||
{
|
||||
if(curInterpolator != CClock::GetSeconds()){
|
||||
INTERP_SETUP
|
||||
curVal = INTERP(data);
|
||||
curInterpolator = CClock::GetSeconds();
|
||||
}
|
||||
return curVal;
|
||||
}
|
||||
|
||||
InterpolatedColor::InterpolatedColor(const Color &init)
|
||||
{
|
||||
curInterpolator = 61; // compared against second
|
||||
for(int h = 0; h < 24; h++)
|
||||
for(int w = 0; w < NUMWEATHERS; w++)
|
||||
data[h][w] = init;
|
||||
}
|
||||
|
||||
void
|
||||
InterpolatedColor::Read(char *s, int line, int field)
|
||||
{
|
||||
int r, g, b, a;
|
||||
sscanf(s, "%i, %i, %i, %i", &r, &g, &b, &a);
|
||||
data[line][field] = Color(r/255.0f, g/255.0f, b/255.0f, a/255.0f);
|
||||
}
|
||||
|
||||
Color
|
||||
InterpolatedColor::Get(void)
|
||||
{
|
||||
if(curInterpolator != CClock::GetSeconds()){
|
||||
INTERP_SETUP
|
||||
curVal.r = INTERPF(data, r);
|
||||
curVal.g = INTERPF(data, g);
|
||||
curVal.b = INTERPF(data, b);
|
||||
curVal.a = INTERPF(data, a);
|
||||
curInterpolator = CClock::GetSeconds();
|
||||
}
|
||||
return curVal;
|
||||
}
|
||||
|
||||
void
|
||||
InterpolatedLight::Read(char *s, int line, int field)
|
||||
{
|
||||
int r, g, b, a;
|
||||
sscanf(s, "%i, %i, %i, %i", &r, &g, &b, &a);
|
||||
data[line][field] = Color(r/255.0f, g/255.0f, b/255.0f, a/100.0f);
|
||||
}
|
||||
|
||||
char*
|
||||
ReadTweakValueTable(char *fp, InterpolatedValue &interp)
|
||||
{
|
||||
char buf[24], *p;
|
||||
int c;
|
||||
int line, field;
|
||||
|
||||
line = 0;
|
||||
c = *fp++;
|
||||
while(c != '\0' && line < 24){
|
||||
field = 0;
|
||||
if(c != '\0' && c != '#'){
|
||||
while(c != '\0' && c != '\n' && field < NUMWEATHERS){
|
||||
p = buf;
|
||||
while(c != '\0' && c == '\t')
|
||||
c = *fp++;
|
||||
*p++ = c;
|
||||
while(c = *fp++, c != '\0' && c != '\t' && c != '\n')
|
||||
*p++ = c;
|
||||
*p++ = '\0';
|
||||
interp.Read(buf, line, field);
|
||||
field++;
|
||||
}
|
||||
line++;
|
||||
}
|
||||
while(c != '\0' && c != '\n')
|
||||
c = *fp++;
|
||||
c = *fp++;
|
||||
}
|
||||
return fp-1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo Vehicle pipe
|
||||
*/
|
||||
|
||||
int32 VehiclePipeSwitch = VEHICLEPIPE_NEO;
|
||||
float VehicleShininess = 1.0f;
|
||||
float VehicleSpecularity = 1.0f;
|
||||
InterpolatedFloat Fresnel(0.4f);
|
||||
InterpolatedFloat Power(18.0f);
|
||||
InterpolatedLight DiffColor(Color(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
InterpolatedLight SpecColor(Color(0.7f, 0.7f, 0.7f, 1.0f));
|
||||
rw::ObjPipeline *vehiclePipe;
|
||||
|
||||
void
|
||||
AttachVehiclePipe(rw::Atomic *atomic)
|
||||
{
|
||||
atomic->pipeline = vehiclePipe;
|
||||
}
|
||||
|
||||
void
|
||||
AttachVehiclePipe(rw::Clump *clump)
|
||||
{
|
||||
FORLIST(lnk, clump->atomics)
|
||||
AttachVehiclePipe(rw::Atomic::fromClump(lnk));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo World pipe
|
||||
*/
|
||||
|
||||
float LightmapMult = 1.0f;
|
||||
InterpolatedFloat WorldLightmapBlend(1.0f);
|
||||
rw::ObjPipeline *worldPipe;
|
||||
|
||||
void
|
||||
AttachWorldPipe(rw::Atomic *atomic)
|
||||
{
|
||||
atomic->pipeline = worldPipe;
|
||||
}
|
||||
|
||||
void
|
||||
AttachWorldPipe(rw::Clump *clump)
|
||||
{
|
||||
FORLIST(lnk, clump->atomics)
|
||||
AttachWorldPipe(rw::Atomic::fromClump(lnk));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo Gloss pipe
|
||||
*/
|
||||
|
||||
float GlossMult = 1.0f;
|
||||
rw::ObjPipeline *glossPipe;
|
||||
|
||||
rw::Texture*
|
||||
GetGlossTex(rw::Material *mat)
|
||||
{
|
||||
if(neoTxd == nil)
|
||||
return nil;
|
||||
CustomMatExt *ext = GetCustomMatExt(mat);
|
||||
if(!ext->haveGloss){
|
||||
char glossname[128];
|
||||
strcpy(glossname, mat->texture->name);
|
||||
strcat(glossname, "_gloss");
|
||||
ext->glossTex = neoTxd->find(glossname);
|
||||
ext->haveGloss = true;
|
||||
}
|
||||
return ext->glossTex;
|
||||
}
|
||||
|
||||
void
|
||||
AttachGlossPipe(rw::Atomic *atomic)
|
||||
{
|
||||
atomic->pipeline = glossPipe;
|
||||
}
|
||||
|
||||
void
|
||||
AttachGlossPipe(rw::Clump *clump)
|
||||
{
|
||||
FORLIST(lnk, clump->atomics)
|
||||
AttachWorldPipe(rw::Atomic::fromClump(lnk));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo Rim pipes
|
||||
*/
|
||||
|
||||
float RimlightMult = 1.0f;
|
||||
InterpolatedColor RampStart(Color(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
InterpolatedColor RampEnd(Color(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
InterpolatedFloat Offset(0.5f);
|
||||
InterpolatedFloat Scale(1.5f);
|
||||
InterpolatedFloat Scaling(2.0f);
|
||||
rw::ObjPipeline *rimPipe;
|
||||
rw::ObjPipeline *rimSkinPipe;
|
||||
|
||||
void
|
||||
AttachRimPipe(rw::Atomic *atomic)
|
||||
{
|
||||
if(rw::Skin::get(atomic->geometry))
|
||||
atomic->pipeline = rimSkinPipe;
|
||||
else
|
||||
atomic->pipeline = rimPipe;
|
||||
}
|
||||
|
||||
void
|
||||
AttachRimPipe(rw::Clump *clump)
|
||||
{
|
||||
FORLIST(lnk, clump->atomics)
|
||||
AttachRimPipe(rw::Atomic::fromClump(lnk));
|
||||
}
|
||||
|
||||
/*
|
||||
* High level stuff
|
||||
*/
|
||||
|
||||
void
|
||||
CustomPipeInit(void)
|
||||
{
|
||||
RwStream *stream = RwStreamOpen(rwSTREAMFILENAME, rwSTREAMREAD, "neo/neo.txd");
|
||||
if(stream == nil)
|
||||
printf("Error: couldn't open 'neo/neo.txd'\n");
|
||||
else{
|
||||
if(RwStreamFindChunk(stream, rwID_TEXDICTIONARY, nil, nil))
|
||||
neoTxd = RwTexDictionaryGtaStreamRead(stream);
|
||||
RwStreamClose(stream, nil);
|
||||
}
|
||||
|
||||
EnvMapInit();
|
||||
|
||||
CreateVehiclePipe();
|
||||
CreateWorldPipe();
|
||||
CreateGlossPipe();
|
||||
CreateRimLightPipes();
|
||||
}
|
||||
|
||||
void
|
||||
CustomPipeShutdown(void)
|
||||
{
|
||||
DestroyVehiclePipe();
|
||||
DestroyWorldPipe();
|
||||
DestroyGlossPipe();
|
||||
DestroyRimLightPipes();
|
||||
|
||||
EnvMapShutdown();
|
||||
|
||||
if(neoTxd){
|
||||
neoTxd->destroy();
|
||||
neoTxd = nil;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CustomPipeRegister(void)
|
||||
{
|
||||
#ifdef RW_OPENGL
|
||||
CustomPipeRegisterGL();
|
||||
#endif
|
||||
|
||||
CustomMatOffset = rw::Material::registerPlugin(sizeof(CustomMatExt), MAKECHUNKID(rwVENDORID_ROCKSTAR, 0x80),
|
||||
CustomMatCtor, nil, CustomMatCopy);
|
||||
}
|
||||
|
||||
|
||||
// Load textures from generic as fallback
|
||||
|
||||
rw::TexDictionary *genericTxd;
|
||||
rw::Texture *(*defaultFindCB)(const char *name);
|
||||
|
||||
static rw::Texture*
|
||||
customFindCB(const char *name)
|
||||
{
|
||||
rw::Texture *res = defaultFindCB(name);
|
||||
if(res == nil)
|
||||
res = genericTxd->find(name);
|
||||
return res;
|
||||
}
|
||||
|
||||
void
|
||||
SetTxdFindCallback(void)
|
||||
{
|
||||
int slot = CTxdStore::FindTxdSlot("generic");
|
||||
CTxdStore::AddRef(slot);
|
||||
// TODO: function for this
|
||||
genericTxd = CTxdStore::GetSlot(slot)->texDict;
|
||||
assert(genericTxd);
|
||||
if(defaultFindCB == nil)
|
||||
defaultFindCB = rw::Texture::findCB;
|
||||
rw::Texture::findCB = customFindCB;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
133
src/extras/custompipes.h
Normal file
133
src/extras/custompipes.h
Normal file
@ -0,0 +1,133 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
#ifdef LIBRW
|
||||
|
||||
namespace CustomPipes {
|
||||
|
||||
|
||||
|
||||
struct CustomMatExt
|
||||
{
|
||||
rw::Texture *glossTex;
|
||||
bool haveGloss;
|
||||
};
|
||||
extern rw::int32 CustomMatOffset;
|
||||
inline CustomMatExt *GetCustomMatExt(rw::Material *mat) {
|
||||
return PLUGINOFFSET(CustomMatExt, mat, CustomMatOffset);
|
||||
}
|
||||
|
||||
|
||||
struct Color
|
||||
{
|
||||
float r, g, b, a;
|
||||
Color(void) {}
|
||||
Color(float r, float g, float b, float a) : r(r), g(g), b(b), a(a) {}
|
||||
};
|
||||
|
||||
class InterpolatedValue
|
||||
{
|
||||
public:
|
||||
virtual void Read(char *s, int line, int field) = 0;
|
||||
};
|
||||
|
||||
class InterpolatedFloat : public InterpolatedValue
|
||||
{
|
||||
public:
|
||||
float data[24][NUMWEATHERS];
|
||||
float curInterpolator;
|
||||
float curVal;
|
||||
|
||||
InterpolatedFloat(float init);
|
||||
void Read(char *s, int line, int field);
|
||||
float Get(void);
|
||||
};
|
||||
|
||||
class InterpolatedColor : public InterpolatedValue
|
||||
{
|
||||
public:
|
||||
Color data[24][NUMWEATHERS];
|
||||
float curInterpolator;
|
||||
Color curVal;
|
||||
|
||||
InterpolatedColor(const Color &init);
|
||||
void Read(char *s, int line, int field);
|
||||
Color Get(void);
|
||||
};
|
||||
|
||||
class InterpolatedLight : public InterpolatedColor
|
||||
{
|
||||
public:
|
||||
InterpolatedLight(const Color &init) : InterpolatedColor(init) {}
|
||||
void Read(char *s, int line, int field);
|
||||
};
|
||||
|
||||
char *ReadTweakValueTable(char *fp, InterpolatedValue &interp);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CustomPipeRegister(void);
|
||||
void CustomPipeRegisterGL(void);
|
||||
void CustomPipeInit(void);
|
||||
void CustomPipeShutdown(void);
|
||||
void SetTxdFindCallback(void);
|
||||
|
||||
extern bool bRenderingEnvMap;
|
||||
extern int32 EnvMapSize;
|
||||
extern rw::Camera *EnvMapCam;
|
||||
extern rw::Texture *EnvMapTex;
|
||||
extern rw::Texture *EnvMaskTex;
|
||||
void EnvMapRender(void);
|
||||
|
||||
enum {
|
||||
VEHICLEPIPE_MATFX,
|
||||
VEHICLEPIPE_NEO
|
||||
};
|
||||
extern int32 VehiclePipeSwitch;
|
||||
extern float VehicleShininess;
|
||||
extern float VehicleSpecularity;
|
||||
extern InterpolatedFloat Fresnel;
|
||||
extern InterpolatedFloat Power;
|
||||
extern InterpolatedLight DiffColor;
|
||||
extern InterpolatedLight SpecColor;
|
||||
extern rw::ObjPipeline *vehiclePipe;
|
||||
void CreateVehiclePipe(void);
|
||||
void DestroyVehiclePipe(void);
|
||||
void AttachVehiclePipe(rw::Atomic *atomic);
|
||||
void AttachVehiclePipe(rw::Clump *clump);
|
||||
|
||||
extern float LightmapMult;
|
||||
extern InterpolatedFloat WorldLightmapBlend;
|
||||
extern rw::ObjPipeline *worldPipe;
|
||||
void CreateWorldPipe(void);
|
||||
void DestroyWorldPipe(void);
|
||||
void AttachWorldPipe(rw::Atomic *atomic);
|
||||
void AttachWorldPipe(rw::Clump *clump);
|
||||
|
||||
extern float GlossMult;
|
||||
extern rw::ObjPipeline *glossPipe;
|
||||
void CreateGlossPipe(void);
|
||||
void DestroyGlossPipe(void);
|
||||
void AttachGlossPipe(rw::Atomic *atomic);
|
||||
void AttachGlossPipe(rw::Clump *clump);
|
||||
rw::Texture *GetGlossTex(rw::Material *mat);
|
||||
|
||||
extern float RimlightMult;
|
||||
extern InterpolatedColor RampStart;
|
||||
extern InterpolatedColor RampEnd;
|
||||
extern InterpolatedFloat Offset;
|
||||
extern InterpolatedFloat Scale;
|
||||
extern InterpolatedFloat Scaling;
|
||||
extern rw::ObjPipeline *rimPipe;
|
||||
extern rw::ObjPipeline *rimSkinPipe;
|
||||
void CreateRimLightPipes(void);
|
||||
void DestroyRimLightPipes(void);
|
||||
void AttachRimPipe(rw::Atomic *atomic);
|
||||
void AttachRimPipe(rw::Clump *clump);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
527
src/extras/custompipes_d3d9.cpp
Normal file
527
src/extras/custompipes_d3d9.cpp
Normal file
@ -0,0 +1,527 @@
|
||||
#define WITH_D3D
|
||||
#include "common.h"
|
||||
|
||||
#ifdef RW_D3D9
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
||||
#include "main.h"
|
||||
#include "RwHelper.h"
|
||||
#include "Lights.h"
|
||||
#include "Timecycle.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Clock.h"
|
||||
#include "Weather.h"
|
||||
#include "TxdStore.h"
|
||||
#include "Renderer.h"
|
||||
#include "World.h"
|
||||
#include "custompipes.h"
|
||||
|
||||
#ifndef LIBRW
|
||||
#error "Need librw for EXTENDED_PIPELINES"
|
||||
#endif
|
||||
|
||||
extern RwTexture *gpWhiteTexture; // from vehicle model info
|
||||
|
||||
namespace CustomPipes {
|
||||
|
||||
enum {
|
||||
// rim pipe
|
||||
VSLOC_boneMatrices = rw::d3d::VSLOC_afterLights,
|
||||
VSLOC_viewVec = VSLOC_boneMatrices + 64*3,
|
||||
VSLOC_rampStart,
|
||||
VSLOC_rampEnd,
|
||||
VSLOC_rimData,
|
||||
|
||||
// gloss pipe
|
||||
VSLOC_eye = rw::d3d::VSLOC_afterLights,
|
||||
|
||||
VSLOC_reflProps,
|
||||
VSLOC_specLights
|
||||
};
|
||||
|
||||
/*
|
||||
* Neo Vehicle pipe
|
||||
*/
|
||||
|
||||
static void *neoVehicle_VS;
|
||||
static void *neoVehicle_PS;
|
||||
|
||||
void
|
||||
uploadSpecLights(void)
|
||||
{
|
||||
struct VsLight {
|
||||
rw::RGBAf color;
|
||||
float pos[4]; // unused
|
||||
rw::V3d dir;
|
||||
float power;
|
||||
} specLights[1 + NUMEXTRADIRECTIONALS];
|
||||
memset(specLights, 0, sizeof(specLights));
|
||||
for(int i = 0; i < 1+NUMEXTRADIRECTIONALS; i++)
|
||||
specLights[i].power = 1.0f;
|
||||
float power = Power.Get();
|
||||
Color speccol = SpecColor.Get();
|
||||
specLights[0].color.red = speccol.r;
|
||||
specLights[0].color.green = speccol.g;
|
||||
specLights[0].color.blue = speccol.b;
|
||||
specLights[0].dir = pDirect->getFrame()->getLTM()->at;
|
||||
specLights[0].power = power;
|
||||
for(int i = 0; i < NUMEXTRADIRECTIONALS; i++){
|
||||
if(pExtraDirectionals[i]->getFlags() & rw::Light::LIGHTATOMICS){
|
||||
specLights[1+i].color = pExtraDirectionals[i]->color;
|
||||
specLights[1+i].dir = pExtraDirectionals[i]->getFrame()->getLTM()->at;
|
||||
specLights[1+i].power = power*2.0f;
|
||||
}
|
||||
}
|
||||
rw::d3d::d3ddevice->SetVertexShaderConstantF(VSLOC_specLights, (float*)&specLights, 3*(1 + NUMEXTRADIRECTIONALS));
|
||||
}
|
||||
|
||||
void
|
||||
vehicleRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::d3d;
|
||||
using namespace rw::d3d9;
|
||||
|
||||
// TODO: make this less of a kludge
|
||||
if(VehiclePipeSwitch == VEHICLEPIPE_MATFX){
|
||||
matFXGlobals.pipelines[rw::platform]->render(atomic);
|
||||
return;
|
||||
}
|
||||
|
||||
int vsBits;
|
||||
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
|
||||
setIndices(header->indexBuffer);
|
||||
setVertexDeclaration(header->vertexDeclaration);
|
||||
|
||||
vsBits = lightingCB_Shader(atomic);
|
||||
uploadSpecLights();
|
||||
uploadMatrices(atomic->getFrame()->getLTM());
|
||||
|
||||
setVertexShader(neoVehicle_VS);
|
||||
|
||||
V3d eyePos = rw::engine->currentCamera->getFrame()->getLTM()->pos;
|
||||
d3ddevice->SetVertexShaderConstantF(VSLOC_eye, (float*)&eyePos, 1);
|
||||
|
||||
float reflProps[4];
|
||||
reflProps[0] = Fresnel.Get();
|
||||
reflProps[1] = SpecColor.Get().a;
|
||||
|
||||
d3d::setTexture(1, EnvMapTex);
|
||||
|
||||
SetRenderState(SRCBLEND, BLENDONE);
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
for(rw::uint32 i = 0; i < header->numMeshes; i++){
|
||||
Material *m = inst->material;
|
||||
|
||||
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||
|
||||
reflProps[2] = m->surfaceProps.specular * VehicleShininess;
|
||||
reflProps[3] = m->surfaceProps.specular == 0.0f ? 0.0f : VehicleSpecularity;
|
||||
d3ddevice->SetVertexShaderConstantF(VSLOC_reflProps, reflProps, 1);
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
if(m->texture)
|
||||
d3d::setTexture(0, m->texture);
|
||||
else
|
||||
d3d::setTexture(0, gpWhiteTexture);
|
||||
setPixelShader(neoVehicle_PS);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
|
||||
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
||||
}
|
||||
|
||||
void
|
||||
CreateVehiclePipe(void)
|
||||
{
|
||||
if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") == 0)
|
||||
printf("Error: couldn't open 'neo/carTweakingTable.dat'\n");
|
||||
else{
|
||||
char *fp = (char*)work_buff;
|
||||
fp = ReadTweakValueTable(fp, Fresnel);
|
||||
fp = ReadTweakValueTable(fp, Power);
|
||||
fp = ReadTweakValueTable(fp, DiffColor);
|
||||
fp = ReadTweakValueTable(fp, SpecColor);
|
||||
}
|
||||
|
||||
#include "shaders/neoVehicle_VS.inc"
|
||||
neoVehicle_VS = rw::d3d::createVertexShader(neoVehicle_VS_cso);
|
||||
assert(neoVehicle_VS);
|
||||
|
||||
#include "shaders/neoVehicle_PS.inc"
|
||||
neoVehicle_PS = rw::d3d::createPixelShader(neoVehicle_PS_cso);
|
||||
assert(neoVehicle_PS);
|
||||
|
||||
|
||||
rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::d3d9::defaultInstanceCB;
|
||||
pipe->uninstanceCB = rw::d3d9::defaultUninstanceCB;
|
||||
pipe->renderCB = vehicleRenderCB;
|
||||
vehiclePipe = pipe;
|
||||
}
|
||||
|
||||
void
|
||||
DestroyVehiclePipe(void)
|
||||
{
|
||||
rw::d3d::destroyVertexShader(neoVehicle_VS);
|
||||
neoVehicle_VS = nil;
|
||||
|
||||
((rw::d3d9::ObjPipeline*)vehiclePipe)->destroy();
|
||||
vehiclePipe = nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo World pipe
|
||||
*/
|
||||
|
||||
static void *neoWorld_VS;
|
||||
static void *neoWorldVC_PS;
|
||||
|
||||
static void
|
||||
worldRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::d3d;
|
||||
using namespace rw::d3d9;
|
||||
|
||||
int vsBits;
|
||||
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
|
||||
setIndices(header->indexBuffer);
|
||||
setVertexDeclaration(header->vertexDeclaration);
|
||||
|
||||
vsBits = lightingCB_Shader(atomic);
|
||||
uploadMatrices(atomic->getFrame()->getLTM());
|
||||
|
||||
|
||||
float lightfactor[4];
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
for(rw::uint32 i = 0; i < header->numMeshes; i++){
|
||||
Material *m = inst->material;
|
||||
|
||||
if(MatFX::getEffects(m) == MatFX::DUAL){
|
||||
setVertexShader(neoWorld_VS);
|
||||
|
||||
MatFX *matfx = MatFX::get(m);
|
||||
Texture *dualtex = matfx->getDualTexture();
|
||||
if(dualtex == nil)
|
||||
goto notex;
|
||||
d3d::setTexture(1, dualtex);
|
||||
lightfactor[0] = lightfactor[1] = lightfactor[2] = WorldLightmapBlend.Get()*LightmapMult;
|
||||
}else{
|
||||
notex:
|
||||
setVertexShader(default_amb_VS);
|
||||
|
||||
d3d::setTexture(1, nil);
|
||||
lightfactor[0] = lightfactor[1] = lightfactor[2] = 0.0f;
|
||||
}
|
||||
lightfactor[3] = m->color.alpha/255.0f;
|
||||
d3d::setTexture(0, m->texture);
|
||||
d3ddevice->SetPixelShaderConstantF(1, lightfactor, 1);
|
||||
|
||||
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||
|
||||
RGBA color = { 255, 255, 255, m->color.alpha };
|
||||
setMaterial(color, m->surfaceProps);
|
||||
|
||||
if(m->texture)
|
||||
d3d::setTexture(0, m->texture);
|
||||
else
|
||||
d3d::setTexture(0, gpWhiteTexture);
|
||||
setPixelShader(neoWorldVC_PS);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CreateWorldPipe(void)
|
||||
{
|
||||
if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") == 0)
|
||||
printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n");
|
||||
else
|
||||
ReadTweakValueTable((char*)work_buff, WorldLightmapBlend);
|
||||
|
||||
#include "shaders/default_UV2_VS.inc"
|
||||
neoWorld_VS = rw::d3d::createVertexShader(default_UV2_VS_cso);
|
||||
assert(neoWorld_VS);
|
||||
|
||||
#include "shaders/neoWorldVC_PS.inc"
|
||||
neoWorldVC_PS = rw::d3d::createPixelShader(neoWorldVC_PS_cso);
|
||||
assert(neoWorldVC_PS);
|
||||
|
||||
|
||||
rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::d3d9::defaultInstanceCB;
|
||||
pipe->uninstanceCB = rw::d3d9::defaultUninstanceCB;
|
||||
pipe->renderCB = worldRenderCB;
|
||||
worldPipe = pipe;
|
||||
}
|
||||
|
||||
void
|
||||
DestroyWorldPipe(void)
|
||||
{
|
||||
rw::d3d::destroyVertexShader(neoWorld_VS);
|
||||
neoWorld_VS = nil;
|
||||
rw::d3d::destroyPixelShader(neoWorldVC_PS);
|
||||
neoWorldVC_PS = nil;
|
||||
|
||||
|
||||
((rw::d3d9::ObjPipeline*)worldPipe)->destroy();
|
||||
worldPipe = nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo Gloss pipe
|
||||
*/
|
||||
|
||||
static void *neoGloss_VS;
|
||||
static void *neoGloss_PS;
|
||||
|
||||
static void
|
||||
glossRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||
{
|
||||
worldRenderCB(atomic, header);
|
||||
|
||||
using namespace rw;
|
||||
using namespace rw::d3d;
|
||||
using namespace rw::d3d9;
|
||||
|
||||
setVertexShader(neoGloss_VS);
|
||||
setPixelShader(neoGloss_PS);
|
||||
|
||||
V3d eyePos = rw::engine->currentCamera->getFrame()->getLTM()->pos;
|
||||
d3ddevice->SetVertexShaderConstantF(VSLOC_eye, (float*)&eyePos, 1);
|
||||
d3ddevice->SetPixelShaderConstantF(1, (float*)&GlossMult, 1);
|
||||
|
||||
SetRenderState(VERTEXALPHA, TRUE);
|
||||
SetRenderState(SRCBLEND, BLENDONE);
|
||||
SetRenderState(DESTBLEND, BLENDONE);
|
||||
SetRenderState(ZWRITEENABLE, FALSE);
|
||||
SetRenderState(ALPHATESTFUNC, ALPHAALWAYS);
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
for(rw::uint32 i = 0; i < header->numMeshes; i++){
|
||||
Material *m = inst->material;
|
||||
|
||||
if(m->texture){
|
||||
Texture *tex = GetGlossTex(m);
|
||||
if(tex){
|
||||
d3d::setTexture(0, tex);
|
||||
drawInst(header, inst);
|
||||
}
|
||||
}
|
||||
inst++;
|
||||
}
|
||||
|
||||
SetRenderState(ZWRITEENABLE, TRUE);
|
||||
SetRenderState(ALPHATESTFUNC, ALPHAGREATEREQUAL);
|
||||
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
||||
SetRenderState(DESTBLEND, BLENDINVSRCALPHA);
|
||||
}
|
||||
|
||||
void
|
||||
CreateGlossPipe(void)
|
||||
{
|
||||
#include "shaders/neoGloss_VS.inc"
|
||||
neoGloss_VS = rw::d3d::createVertexShader(neoGloss_VS_cso);
|
||||
assert(neoGloss_VS);
|
||||
|
||||
#include "shaders/neoGloss_PS.inc"
|
||||
neoGloss_PS = rw::d3d::createPixelShader(neoGloss_PS_cso);
|
||||
assert(neoGloss_PS);
|
||||
|
||||
|
||||
rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::d3d9::defaultInstanceCB;
|
||||
pipe->uninstanceCB = rw::d3d9::defaultUninstanceCB;
|
||||
pipe->renderCB = glossRenderCB;
|
||||
glossPipe = pipe;
|
||||
}
|
||||
|
||||
void
|
||||
DestroyGlossPipe(void)
|
||||
{
|
||||
((rw::d3d9::ObjPipeline*)glossPipe)->destroy();
|
||||
glossPipe = nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo Rim pipes
|
||||
*/
|
||||
|
||||
static void *neoRim_VS;
|
||||
static void *neoRimSkin_VS;
|
||||
|
||||
static void
|
||||
uploadRimData(bool enable)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::d3d;
|
||||
|
||||
V3d viewVec = rw::engine->currentCamera->getFrame()->getLTM()->at;
|
||||
d3ddevice->SetVertexShaderConstantF(VSLOC_viewVec, (float*)&viewVec, 1);
|
||||
float rimData[4];
|
||||
rimData[0] = Offset.Get();
|
||||
rimData[1] = Scale.Get();
|
||||
if(enable)
|
||||
rimData[2] = Scaling.Get()*RimlightMult;
|
||||
else
|
||||
rimData[2] = 0.0f;
|
||||
rimData[3] = 0.0f;
|
||||
d3ddevice->SetVertexShaderConstantF(VSLOC_rimData, rimData, 1);
|
||||
Color col = RampStart.Get();
|
||||
d3ddevice->SetVertexShaderConstantF(VSLOC_rampStart, (float*)&col, 1);
|
||||
col = RampEnd.Get();
|
||||
d3ddevice->SetVertexShaderConstantF(VSLOC_rampEnd, (float*)&col, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
rimRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::d3d;
|
||||
using namespace rw::d3d9;
|
||||
|
||||
int vsBits;
|
||||
setStreamSource(0, header->vertexStream[0].vertexBuffer, 0, header->vertexStream[0].stride);
|
||||
setIndices(header->indexBuffer);
|
||||
setVertexDeclaration(header->vertexDeclaration);
|
||||
|
||||
vsBits = lightingCB_Shader(atomic);
|
||||
uploadMatrices(atomic->getFrame()->getLTM());
|
||||
|
||||
setVertexShader(neoRim_VS);
|
||||
|
||||
uploadRimData(atomic->geometry->flags & Geometry::LIGHT);
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
for(rw::uint32 i = 0; i < header->numMeshes; i++){
|
||||
Material *m = inst->material;
|
||||
|
||||
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
if(m->texture){
|
||||
d3d::setTexture(0, m->texture);
|
||||
setPixelShader(default_tex_PS);
|
||||
}else
|
||||
setPixelShader(default_PS);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
rimSkinRenderCB(rw::Atomic *atomic, rw::d3d9::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::d3d;
|
||||
using namespace rw::d3d9;
|
||||
|
||||
int vsBits;
|
||||
|
||||
setStreamSource(0, (IDirect3DVertexBuffer9*)header->vertexStream[0].vertexBuffer,
|
||||
0, header->vertexStream[0].stride);
|
||||
setIndices((IDirect3DIndexBuffer9*)header->indexBuffer);
|
||||
setVertexDeclaration((IDirect3DVertexDeclaration9*)header->vertexDeclaration);
|
||||
|
||||
vsBits = lightingCB_Shader(atomic);
|
||||
uploadMatrices(atomic->getFrame()->getLTM());
|
||||
|
||||
uploadSkinMatrices(atomic);
|
||||
|
||||
setVertexShader(neoRimSkin_VS);
|
||||
|
||||
uploadRimData(atomic->geometry->flags & Geometry::LIGHT);
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
for(rw::uint32 i = 0; i < header->numMeshes; i++){
|
||||
Material *m = inst->material;
|
||||
|
||||
SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 255);
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
if(inst->material->texture){
|
||||
d3d::setTexture(0, m->texture);
|
||||
setPixelShader(default_tex_PS);
|
||||
}else
|
||||
setPixelShader(default_PS);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CreateRimLightPipes(void)
|
||||
{
|
||||
if(CFileMgr::LoadFile("neo/rimTweakingTable.dat", work_buff, sizeof(work_buff), "r") == 0)
|
||||
printf("Error: couldn't open 'neo/rimTweakingTable.dat'\n");
|
||||
else{
|
||||
char *fp = (char*)work_buff;
|
||||
fp = ReadTweakValueTable(fp, RampStart);
|
||||
fp = ReadTweakValueTable(fp, RampEnd);
|
||||
fp = ReadTweakValueTable(fp, Offset);
|
||||
fp = ReadTweakValueTable(fp, Scale);
|
||||
fp = ReadTweakValueTable(fp, Scaling);
|
||||
}
|
||||
|
||||
|
||||
#include "shaders/neoRim_VS.inc"
|
||||
neoRim_VS = rw::d3d::createVertexShader(neoRim_VS_cso);
|
||||
assert(neoRim_VS);
|
||||
|
||||
#include "shaders/neoRimSkin_VS.inc"
|
||||
neoRimSkin_VS = rw::d3d::createVertexShader(neoRimSkin_VS_cso);
|
||||
assert(neoRimSkin_VS);
|
||||
|
||||
|
||||
rw::d3d9::ObjPipeline *pipe = rw::d3d9::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::d3d9::defaultInstanceCB;
|
||||
pipe->uninstanceCB = rw::d3d9::defaultUninstanceCB;
|
||||
pipe->renderCB = rimRenderCB;
|
||||
rimPipe = pipe;
|
||||
|
||||
pipe = rw::d3d9::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::d3d9::skinInstanceCB;
|
||||
pipe->uninstanceCB = nil;
|
||||
pipe->renderCB = rimSkinRenderCB;
|
||||
rimSkinPipe = pipe;
|
||||
}
|
||||
|
||||
void
|
||||
DestroyRimLightPipes(void)
|
||||
{
|
||||
rw::d3d::destroyVertexShader(neoRim_VS);
|
||||
neoRim_VS = nil;
|
||||
|
||||
rw::d3d::destroyVertexShader(neoRimSkin_VS);
|
||||
neoRimSkin_VS = nil;
|
||||
|
||||
((rw::d3d9::ObjPipeline*)rimPipe)->destroy();
|
||||
rimPipe = nil;
|
||||
|
||||
((rw::d3d9::ObjPipeline*)rimSkinPipe)->destroy();
|
||||
rimSkinPipe = nil;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
623
src/extras/custompipes_gl.cpp
Normal file
623
src/extras/custompipes_gl.cpp
Normal file
@ -0,0 +1,623 @@
|
||||
#include "common.h"
|
||||
|
||||
#ifdef RW_OPENGL
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
||||
#include "main.h"
|
||||
#include "RwHelper.h"
|
||||
#include "Lights.h"
|
||||
#include "Timecycle.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Clock.h"
|
||||
#include "Weather.h"
|
||||
#include "TxdStore.h"
|
||||
#include "Renderer.h"
|
||||
#include "World.h"
|
||||
#include "custompipes.h"
|
||||
|
||||
#ifndef LIBRW
|
||||
#error "Need librw for EXTENDED_PIPELINES"
|
||||
#endif
|
||||
|
||||
namespace CustomPipes {
|
||||
|
||||
static int32 u_viewVec;
|
||||
static int32 u_rampStart;
|
||||
static int32 u_rampEnd;
|
||||
static int32 u_rimData;
|
||||
|
||||
static int32 u_lightMap;
|
||||
|
||||
static int32 u_eye;
|
||||
static int32 u_reflProps;
|
||||
static int32 u_specDir;
|
||||
static int32 u_specColor;
|
||||
|
||||
#define U(i) currentShader->uniformLocations[i]
|
||||
|
||||
/*
|
||||
* Neo Vehicle pipe
|
||||
*/
|
||||
|
||||
rw::gl3::Shader *neoVehicleShader;
|
||||
|
||||
static void
|
||||
uploadSpecLights(void)
|
||||
{
|
||||
using namespace rw::gl3;
|
||||
|
||||
rw::RGBAf colors[1 + NUMEXTRADIRECTIONALS];
|
||||
struct {
|
||||
rw::V3d dir;
|
||||
float power;
|
||||
} dirs[1 + NUMEXTRADIRECTIONALS];
|
||||
memset(colors, 0, sizeof(colors));
|
||||
memset(dirs, 0, sizeof(dirs));
|
||||
for(int i = 0; i < 1+NUMEXTRADIRECTIONALS; i++)
|
||||
dirs[i].power = 1.0f;
|
||||
float power = Power.Get();
|
||||
Color speccol = SpecColor.Get();
|
||||
colors[0].red = speccol.r;
|
||||
colors[0].green = speccol.g;
|
||||
colors[0].blue = speccol.b;
|
||||
dirs[0].dir = pDirect->getFrame()->getLTM()->at;
|
||||
dirs[0].power = power;
|
||||
for(int i = 0; i < NUMEXTRADIRECTIONALS; i++){
|
||||
if(pExtraDirectionals[i]->getFlags() & rw::Light::LIGHTATOMICS){
|
||||
colors[1+i] = pExtraDirectionals[i]->color;
|
||||
dirs[1+i].dir = pExtraDirectionals[i]->getFrame()->getLTM()->at;
|
||||
dirs[1+i].power = power*2.0f;
|
||||
}
|
||||
}
|
||||
glUniform4fv(U(u_specDir), 1 + NUMEXTRADIRECTIONALS, (float*)&dirs);
|
||||
glUniform4fv(U(u_specColor), 1 + NUMEXTRADIRECTIONALS, (float*)&colors);
|
||||
}
|
||||
|
||||
static void
|
||||
vehicleRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
// TODO: make this less of a kludge
|
||||
if(VehiclePipeSwitch == VEHICLEPIPE_MATFX){
|
||||
matFXGlobals.pipelines[rw::platform]->render(atomic);
|
||||
return;
|
||||
}
|
||||
|
||||
Material *m;
|
||||
|
||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||
lightingCB(atomic);
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(header->vao);
|
||||
#else
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
rw::int32 n = header->numMeshes;
|
||||
|
||||
neoVehicleShader->use();
|
||||
|
||||
V3d eyePos = rw::engine->currentCamera->getFrame()->getLTM()->pos;
|
||||
glUniform3fv(U(u_eye), 1, (float*)&eyePos);
|
||||
|
||||
uploadSpecLights();
|
||||
|
||||
float reflProps[4];
|
||||
reflProps[0] = Fresnel.Get();
|
||||
reflProps[1] = SpecColor.Get().a;
|
||||
|
||||
setTexture(1, EnvMapTex);
|
||||
|
||||
SetRenderState(SRCBLEND, BLENDONE);
|
||||
|
||||
while(n--){
|
||||
m = inst->material;
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
setTexture(0, m->texture);
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
reflProps[2] = m->surfaceProps.specular * VehicleShininess;
|
||||
reflProps[3] = m->surfaceProps.specular == 0.0f ? 0.0f : VehicleSpecularity;
|
||||
glUniform4fv(U(u_reflProps), 1, reflProps);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
|
||||
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
||||
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CreateVehiclePipe(void)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
if(CFileMgr::LoadFile("neo/carTweakingTable.dat", work_buff, sizeof(work_buff), "r") == 0)
|
||||
printf("Error: couldn't open 'neo/carTweakingTable.dat'\n");
|
||||
else{
|
||||
char *fp = (char*)work_buff;
|
||||
fp = ReadTweakValueTable(fp, Fresnel);
|
||||
fp = ReadTweakValueTable(fp, Power);
|
||||
fp = ReadTweakValueTable(fp, DiffColor);
|
||||
fp = ReadTweakValueTable(fp, SpecColor);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
#ifdef RW_GLES2
|
||||
#include "gl2_shaders/neoVehicle_fs_gl2.inc"
|
||||
#include "gl2_shaders/neoVehicle_vs_gl2.inc"
|
||||
#else
|
||||
#include "shaders/neoVehicle_fs_gl3.inc"
|
||||
#include "shaders/neoVehicle_vs_gl3.inc"
|
||||
#endif
|
||||
const char *vs[] = { shaderDecl, header_vert_src, neoVehicle_vert_src, nil };
|
||||
const char *fs[] = { shaderDecl, header_frag_src, neoVehicle_frag_src, nil };
|
||||
neoVehicleShader = Shader::create(vs, fs);
|
||||
assert(neoVehicleShader);
|
||||
}
|
||||
|
||||
|
||||
rw::gl3::ObjPipeline *pipe = rw::gl3::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::gl3::defaultInstanceCB;
|
||||
pipe->uninstanceCB = nil;
|
||||
pipe->renderCB = vehicleRenderCB;
|
||||
vehiclePipe = pipe;
|
||||
}
|
||||
|
||||
void
|
||||
DestroyVehiclePipe(void)
|
||||
{
|
||||
neoVehicleShader->destroy();
|
||||
neoVehicleShader = nil;
|
||||
|
||||
((rw::gl3::ObjPipeline*)vehiclePipe)->destroy();
|
||||
vehiclePipe = nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo World pipe
|
||||
*/
|
||||
|
||||
rw::gl3::Shader *neoWorldShader;
|
||||
|
||||
static void
|
||||
worldRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
Material *m;
|
||||
|
||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||
lightingCB(atomic);
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(header->vao);
|
||||
#else
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
rw::int32 n = header->numMeshes;
|
||||
|
||||
neoWorldShader->use();
|
||||
|
||||
float lightfactor[4];
|
||||
|
||||
while(n--){
|
||||
m = inst->material;
|
||||
|
||||
if(MatFX::getEffects(m) == MatFX::DUAL){
|
||||
MatFX *matfx = MatFX::get(m);
|
||||
Texture *dualtex = matfx->getDualTexture();
|
||||
if(dualtex == nil)
|
||||
goto notex;
|
||||
setTexture(1, dualtex);
|
||||
lightfactor[0] = lightfactor[1] = lightfactor[2] = WorldLightmapBlend.Get()*LightmapMult;
|
||||
}else{
|
||||
notex:
|
||||
setTexture(1, nil);
|
||||
lightfactor[0] = lightfactor[1] = lightfactor[2] = 0.0f;
|
||||
}
|
||||
lightfactor[3] = m->color.alpha/255.0f;
|
||||
glUniform4fv(U(u_lightMap), 1, lightfactor);
|
||||
|
||||
RGBA color = { 255, 255, 255, m->color.alpha };
|
||||
setMaterial(color, m->surfaceProps);
|
||||
|
||||
setTexture(0, m->texture);
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CreateWorldPipe(void)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
if(CFileMgr::LoadFile("neo/worldTweakingTable.dat", work_buff, sizeof(work_buff), "r") == 0)
|
||||
printf("Error: couldn't open 'neo/worldTweakingTable.dat'\n");
|
||||
else
|
||||
ReadTweakValueTable((char*)work_buff, WorldLightmapBlend);
|
||||
|
||||
{
|
||||
#ifdef RW_GLES2
|
||||
#include "gl2_shaders/neoWorldIII_fs_gl2.inc"
|
||||
#include "gl2_shaders/default_UV2_gl2.inc"
|
||||
#else
|
||||
#include "shaders/neoWorldVC_fs_gl3.inc"
|
||||
#include "shaders/default_UV2_gl3.inc"
|
||||
#endif
|
||||
const char *vs[] = { shaderDecl, header_vert_src, default_UV2_vert_src, nil };
|
||||
const char *fs[] = { shaderDecl, header_frag_src, neoWorldVC_frag_src, nil };
|
||||
neoWorldShader = Shader::create(vs, fs);
|
||||
assert(neoWorldShader);
|
||||
}
|
||||
|
||||
|
||||
rw::gl3::ObjPipeline *pipe = rw::gl3::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::gl3::defaultInstanceCB;
|
||||
pipe->uninstanceCB = nil;
|
||||
pipe->renderCB = worldRenderCB;
|
||||
worldPipe = pipe;
|
||||
}
|
||||
|
||||
void
|
||||
DestroyWorldPipe(void)
|
||||
{
|
||||
neoWorldShader->destroy();
|
||||
neoWorldShader = nil;
|
||||
|
||||
((rw::gl3::ObjPipeline*)worldPipe)->destroy();
|
||||
worldPipe = nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo Gloss pipe
|
||||
*/
|
||||
|
||||
rw::gl3::Shader *neoGlossShader;
|
||||
|
||||
static void
|
||||
glossRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
worldRenderCB(atomic, header);
|
||||
|
||||
Material *m;
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(header->vao);
|
||||
#else
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
rw::int32 n = header->numMeshes;
|
||||
|
||||
neoGlossShader->use();
|
||||
|
||||
V3d eyePos = rw::engine->currentCamera->getFrame()->getLTM()->pos;
|
||||
glUniform3fv(U(u_eye), 1, (float*)&eyePos);
|
||||
glUniform4fv(U(u_reflProps), 1, (float*)&GlossMult);
|
||||
|
||||
SetRenderState(VERTEXALPHA, TRUE);
|
||||
SetRenderState(SRCBLEND, BLENDONE);
|
||||
SetRenderState(DESTBLEND, BLENDONE);
|
||||
SetRenderState(ZWRITEENABLE, FALSE);
|
||||
SetRenderState(ALPHATESTFUNC, ALPHAALWAYS);
|
||||
|
||||
while(n--){
|
||||
m = inst->material;
|
||||
|
||||
RGBA color = { 255, 255, 255, m->color.alpha };
|
||||
setMaterial(color, m->surfaceProps);
|
||||
|
||||
if(m->texture){
|
||||
Texture *tex = GetGlossTex(m);
|
||||
if(tex){
|
||||
setTexture(0, tex);
|
||||
drawInst(header, inst);
|
||||
}
|
||||
}
|
||||
inst++;
|
||||
}
|
||||
|
||||
SetRenderState(ZWRITEENABLE, TRUE);
|
||||
SetRenderState(ALPHATESTFUNC, ALPHAGREATEREQUAL);
|
||||
SetRenderState(SRCBLEND, BLENDSRCALPHA);
|
||||
SetRenderState(DESTBLEND, BLENDINVSRCALPHA);
|
||||
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CreateGlossPipe(void)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
{
|
||||
#ifdef RW_GLES2
|
||||
#include "gl2_shaders/neoGloss_fs_gl2.inc"
|
||||
#include "gl2_shaders/neoGloss_vs_gl2.inc"
|
||||
#else
|
||||
#include "shaders/neoGloss_fs_gl3.inc"
|
||||
#include "shaders/neoGloss_vs_gl3.inc"
|
||||
#endif
|
||||
const char *vs[] = { shaderDecl, header_vert_src, neoGloss_vert_src, nil };
|
||||
const char *fs[] = { shaderDecl, header_frag_src, neoGloss_frag_src, nil };
|
||||
neoGlossShader = Shader::create(vs, fs);
|
||||
assert(neoGlossShader);
|
||||
}
|
||||
|
||||
rw::gl3::ObjPipeline *pipe = rw::gl3::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::gl3::defaultInstanceCB;
|
||||
pipe->uninstanceCB = nil;
|
||||
pipe->renderCB = glossRenderCB;
|
||||
glossPipe = pipe;
|
||||
}
|
||||
|
||||
void
|
||||
DestroyGlossPipe(void)
|
||||
{
|
||||
neoGlossShader->destroy();
|
||||
neoGlossShader = nil;
|
||||
|
||||
((rw::gl3::ObjPipeline*)glossPipe)->destroy();
|
||||
glossPipe = nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Neo Rim pipes
|
||||
*/
|
||||
|
||||
rw::gl3::Shader *neoRimShader;
|
||||
rw::gl3::Shader *neoRimSkinShader;
|
||||
|
||||
static void
|
||||
uploadRimData(bool enable)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
V3d viewVec = rw::engine->currentCamera->getFrame()->getLTM()->at;
|
||||
glUniform3fv(U(u_viewVec), 1, (float*)&viewVec);
|
||||
float rimData[4];
|
||||
rimData[0] = Offset.Get();
|
||||
rimData[1] = Scale.Get();
|
||||
if(enable)
|
||||
rimData[2] = Scaling.Get()*RimlightMult;
|
||||
else
|
||||
rimData[2] = 0.0f;
|
||||
rimData[3] = 0.0f;
|
||||
glUniform3fv(U(u_rimData), 1, rimData);
|
||||
Color col = RampStart.Get();
|
||||
glUniform4fv(U(u_rampStart), 1, (float*)&col);
|
||||
col = RampEnd.Get();
|
||||
glUniform4fv(U(u_rampEnd), 1, (float*)&col);
|
||||
}
|
||||
|
||||
static void
|
||||
rimSkinRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
Material *m;
|
||||
|
||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||
lightingCB(atomic);
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(header->vao);
|
||||
#else
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
rw::int32 n = header->numMeshes;
|
||||
|
||||
neoRimSkinShader->use();
|
||||
|
||||
uploadRimData(atomic->geometry->flags & Geometry::LIGHT);
|
||||
|
||||
uploadSkinMatrices(atomic);
|
||||
|
||||
while(n--){
|
||||
m = inst->material;
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
setTexture(0, m->texture);
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
rimRenderCB(rw::Atomic *atomic, rw::gl3::InstanceDataHeader *header)
|
||||
{
|
||||
using namespace rw;
|
||||
using namespace rw::gl3;
|
||||
|
||||
Material *m;
|
||||
|
||||
setWorldMatrix(atomic->getFrame()->getLTM());
|
||||
lightingCB(atomic);
|
||||
|
||||
#ifdef RW_GL_USE_VAOS
|
||||
glBindVertexArray(header->vao);
|
||||
#else
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, header->ibo);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, header->vbo);
|
||||
setAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
|
||||
InstanceData *inst = header->inst;
|
||||
rw::int32 n = header->numMeshes;
|
||||
|
||||
neoRimShader->use();
|
||||
|
||||
uploadRimData(atomic->geometry->flags & Geometry::LIGHT);
|
||||
|
||||
while(n--){
|
||||
m = inst->material;
|
||||
|
||||
setMaterial(m->color, m->surfaceProps);
|
||||
|
||||
setTexture(0, m->texture);
|
||||
|
||||
rw::SetRenderState(VERTEXALPHA, inst->vertexAlpha || m->color.alpha != 0xFF);
|
||||
|
||||
drawInst(header, inst);
|
||||
inst++;
|
||||
}
|
||||
#ifndef RW_GL_USE_VAOS
|
||||
disableAttribPointers(header->attribDesc, header->numAttribs);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CreateRimLightPipes(void)
|
||||
{
|
||||
using namespace rw::gl3;
|
||||
|
||||
if(CFileMgr::LoadFile("neo/rimTweakingTable.dat", work_buff, sizeof(work_buff), "r") == 0)
|
||||
printf("Error: couldn't open 'neo/rimTweakingTable.dat'\n");
|
||||
else{
|
||||
char *fp = (char*)work_buff;
|
||||
fp = ReadTweakValueTable(fp, RampStart);
|
||||
fp = ReadTweakValueTable(fp, RampEnd);
|
||||
fp = ReadTweakValueTable(fp, Offset);
|
||||
fp = ReadTweakValueTable(fp, Scale);
|
||||
fp = ReadTweakValueTable(fp, Scaling);
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef RW_GLES2
|
||||
#include "gl2_shaders/simple_fs_gl2.inc"
|
||||
#include "gl2_shaders/neoRimSkin_gl2.inc"
|
||||
#else
|
||||
#include "shaders/simple_fs_gl3.inc"
|
||||
#include "shaders/neoRimSkin_gl3.inc"
|
||||
#endif
|
||||
const char *vs[] = { shaderDecl, header_vert_src, neoRimSkin_vert_src, nil };
|
||||
const char *fs[] = { shaderDecl, header_frag_src, simple_frag_src, nil };
|
||||
neoRimSkinShader = Shader::create(vs, fs);
|
||||
assert(neoRimSkinShader);
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef RW_GLES2
|
||||
#include "gl2_shaders/simple_fs_gl2.inc"
|
||||
#include "gl2_shaders/neoRim_gl2.inc"
|
||||
#else
|
||||
#include "shaders/simple_fs_gl3.inc"
|
||||
#include "shaders/neoRim_gl3.inc"
|
||||
#endif
|
||||
const char *vs[] = { shaderDecl, header_vert_src, neoRim_vert_src, nil };
|
||||
const char *fs[] = { shaderDecl, header_frag_src, simple_frag_src, nil };
|
||||
neoRimShader = Shader::create(vs, fs);
|
||||
assert(neoRimShader);
|
||||
}
|
||||
|
||||
|
||||
rw::gl3::ObjPipeline *pipe = rw::gl3::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::gl3::defaultInstanceCB;
|
||||
pipe->uninstanceCB = nil;
|
||||
pipe->renderCB = rimRenderCB;
|
||||
rimPipe = pipe;
|
||||
|
||||
pipe = rw::gl3::ObjPipeline::create();
|
||||
pipe->instanceCB = rw::gl3::skinInstanceCB;
|
||||
pipe->uninstanceCB = nil;
|
||||
pipe->renderCB = rimSkinRenderCB;
|
||||
rimSkinPipe = pipe;
|
||||
}
|
||||
|
||||
void
|
||||
DestroyRimLightPipes(void)
|
||||
{
|
||||
neoRimShader->destroy();
|
||||
neoRimShader = nil;
|
||||
|
||||
neoRimSkinShader->destroy();
|
||||
neoRimSkinShader = nil;
|
||||
|
||||
((rw::gl3::ObjPipeline*)rimPipe)->destroy();
|
||||
rimPipe = nil;
|
||||
|
||||
((rw::gl3::ObjPipeline*)rimSkinPipe)->destroy();
|
||||
rimSkinPipe = nil;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
CustomPipeRegisterGL(void)
|
||||
{
|
||||
u_viewVec = rw::gl3::registerUniform("u_viewVec");
|
||||
u_rampStart = rw::gl3::registerUniform("u_rampStart");
|
||||
u_rampEnd = rw::gl3::registerUniform("u_rampEnd");
|
||||
u_rimData = rw::gl3::registerUniform("u_rimData");
|
||||
|
||||
u_lightMap = rw::gl3::registerUniform("u_lightMap");
|
||||
|
||||
u_eye = rw::gl3::registerUniform("u_eye");
|
||||
u_reflProps = rw::gl3::registerUniform("u_reflProps");
|
||||
u_specDir = rw::gl3::registerUniform("u_specDir");
|
||||
u_specColor = rw::gl3::registerUniform("u_specColor");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
492
src/extras/postfx.cpp
Normal file
492
src/extras/postfx.cpp
Normal file
@ -0,0 +1,492 @@
|
||||
#define WITHWINDOWS
|
||||
#define WITH_D3D
|
||||
#include "common.h"
|
||||
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
|
||||
#ifndef LIBRW
|
||||
#error "Need librw for EXTENDED_COLOURFILTER"
|
||||
#endif
|
||||
|
||||
#include "RwHelper.h"
|
||||
#include "Camera.h"
|
||||
#include "MBlur.h"
|
||||
#include "postfx.h"
|
||||
|
||||
RwRaster *CPostFX::pFrontBuffer;
|
||||
RwRaster *CPostFX::pBackBuffer;
|
||||
bool CPostFX::bJustInitialised;
|
||||
int CPostFX::EffectSwitch = POSTFX_NORMAL;
|
||||
bool CPostFX::BlurOn = false;
|
||||
bool CPostFX::MotionBlurOn = false;
|
||||
|
||||
static RwIm2DVertex Vertex[4];
|
||||
static RwIm2DVertex Vertex2[4];
|
||||
static RwImVertexIndex Index[6] = { 0, 1, 2, 0, 2, 3 };
|
||||
|
||||
#ifdef RW_D3D9
|
||||
void *colourfilterVC_PS;
|
||||
void *contrast_PS;
|
||||
#endif
|
||||
#ifdef RW_OPENGL
|
||||
int32 u_blurcolor;
|
||||
int32 u_contrastAdd;
|
||||
int32 u_contrastMult;
|
||||
rw::gl3::Shader *colourFilterVC;
|
||||
rw::gl3::Shader *contrast;
|
||||
#endif
|
||||
|
||||
void
|
||||
CPostFX::InitOnce(void)
|
||||
{
|
||||
#ifdef RW_OPENGL
|
||||
u_blurcolor = rw::gl3::registerUniform("u_blurcolor");
|
||||
u_contrastAdd = rw::gl3::registerUniform("u_contrastAdd");
|
||||
u_contrastMult = rw::gl3::registerUniform("u_contrastMult");
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CPostFX::Open(RwCamera *cam)
|
||||
{
|
||||
uint32 width = Pow(2.0f, int32(log2(RwRasterGetWidth (RwCameraGetRaster(cam))))+1);
|
||||
uint32 height = Pow(2.0f, int32(log2(RwRasterGetHeight(RwCameraGetRaster(cam))))+1);
|
||||
uint32 depth = RwRasterGetDepth(RwCameraGetRaster(cam));
|
||||
pFrontBuffer = RwRasterCreate(width, height, depth, rwRASTERTYPECAMERATEXTURE);
|
||||
pBackBuffer = RwRasterCreate(width, height, depth, rwRASTERTYPECAMERATEXTURE);
|
||||
bJustInitialised = true;
|
||||
|
||||
float zero, xmax, ymax;
|
||||
|
||||
if(RwRasterGetDepth(RwCameraGetRaster(cam)) == 16){
|
||||
zero = HALFPX;
|
||||
xmax = width + HALFPX;
|
||||
ymax = height + HALFPX;
|
||||
}else{
|
||||
zero = -HALFPX;
|
||||
xmax = width - HALFPX;
|
||||
ymax = height - HALFPX;
|
||||
}
|
||||
|
||||
RwIm2DVertexSetScreenX(&Vertex[0], zero);
|
||||
RwIm2DVertexSetScreenY(&Vertex[0], zero);
|
||||
RwIm2DVertexSetScreenZ(&Vertex[0], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&Vertex[0], RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetRecipCameraZ(&Vertex[0], 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetU(&Vertex[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetV(&Vertex[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[0], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX(&Vertex[1], zero);
|
||||
RwIm2DVertexSetScreenY(&Vertex[1], ymax);
|
||||
RwIm2DVertexSetScreenZ(&Vertex[1], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&Vertex[1], RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetRecipCameraZ(&Vertex[1], 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetU(&Vertex[1], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetV(&Vertex[1], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[1], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX(&Vertex[2], xmax);
|
||||
RwIm2DVertexSetScreenY(&Vertex[2], ymax);
|
||||
RwIm2DVertexSetScreenZ(&Vertex[2], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&Vertex[2], RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetRecipCameraZ(&Vertex[2], 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetU(&Vertex[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetV(&Vertex[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[2], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX(&Vertex[3], xmax);
|
||||
RwIm2DVertexSetScreenY(&Vertex[3], zero);
|
||||
RwIm2DVertexSetScreenZ(&Vertex[3], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&Vertex[3], RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetRecipCameraZ(&Vertex[3], 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetU(&Vertex[3], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetV(&Vertex[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, 255);
|
||||
|
||||
|
||||
RwIm2DVertexSetScreenX(&Vertex2[0], zero + 2.0f);
|
||||
RwIm2DVertexSetScreenY(&Vertex2[0], zero + 2.0f);
|
||||
RwIm2DVertexSetScreenZ(&Vertex2[0], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&Vertex2[0], RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetRecipCameraZ(&Vertex2[0], 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetU(&Vertex2[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetV(&Vertex2[0], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[0], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX(&Vertex2[1], 2.0f);
|
||||
RwIm2DVertexSetScreenY(&Vertex2[1], ymax + 2.0f);
|
||||
RwIm2DVertexSetScreenZ(&Vertex2[1], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&Vertex2[1], RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetRecipCameraZ(&Vertex2[1], 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetU(&Vertex2[1], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetV(&Vertex2[1], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[1], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX(&Vertex2[2], xmax + 2.0f);
|
||||
RwIm2DVertexSetScreenY(&Vertex2[2], ymax + 2.0f);
|
||||
RwIm2DVertexSetScreenZ(&Vertex2[2], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&Vertex2[2], RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetRecipCameraZ(&Vertex2[2], 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetU(&Vertex2[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetV(&Vertex2[2], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[2], 255, 255, 255, 255);
|
||||
|
||||
RwIm2DVertexSetScreenX(&Vertex2[3], xmax + 2.0f);
|
||||
RwIm2DVertexSetScreenY(&Vertex2[3], zero + 2.0f);
|
||||
RwIm2DVertexSetScreenZ(&Vertex2[3], RwIm2DGetNearScreenZ());
|
||||
RwIm2DVertexSetCameraZ(&Vertex2[3], RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetRecipCameraZ(&Vertex2[3], 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetU(&Vertex2[3], 1.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetV(&Vertex2[3], 0.0f, 1.0f/RwCameraGetNearClipPlane(cam));
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[3], 255, 255, 255, 255);
|
||||
|
||||
|
||||
#ifdef RW_D3D9
|
||||
#include "shaders/colourfilterVC_PS.inc"
|
||||
colourfilterVC_PS = rw::d3d::createPixelShader(colourfilterVC_PS_cso);
|
||||
#include "shaders/contrastPS.inc"
|
||||
contrast_PS = rw::d3d::createPixelShader(contrastPS_cso);
|
||||
#endif
|
||||
#ifdef RW_OPENGL
|
||||
using namespace rw::gl3;
|
||||
|
||||
{
|
||||
#ifdef RW_GLES2
|
||||
#include "gl2_shaders/im2d_gl2.inc"
|
||||
#include "gl2_shaders/colourfilterVC_fs_gl2.inc"
|
||||
#else
|
||||
#include "shaders/im2d_gl3.inc"
|
||||
#include "shaders/colourfilterVC_fs_gl3.inc"
|
||||
#endif
|
||||
const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil };
|
||||
const char *fs[] = { shaderDecl, header_frag_src, colourfilterVC_frag_src, nil };
|
||||
colourFilterVC = Shader::create(vs, fs);
|
||||
assert(colourFilterVC);
|
||||
}
|
||||
|
||||
{
|
||||
#ifdef RW_GLES2
|
||||
#include "gl2_shaders/im2d_gl2.inc"
|
||||
#include "gl2_shaders/contrast_fs_gl2.inc"
|
||||
#else
|
||||
#include "shaders/im2d_gl3.inc"
|
||||
#include "shaders/contrast_fs_gl3.inc"
|
||||
const char *vs[] = { shaderDecl, header_vert_src, im2d_vert_src, nil };
|
||||
const char *fs[] = { shaderDecl, header_frag_src, contrast_frag_src, nil };
|
||||
contrast = Shader::create(vs, fs);
|
||||
assert(contrast);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CPostFX::Close(void)
|
||||
{
|
||||
if(pFrontBuffer){
|
||||
RwRasterDestroy(pFrontBuffer);
|
||||
pFrontBuffer = nil;
|
||||
}
|
||||
if(pBackBuffer){
|
||||
RwRasterDestroy(pBackBuffer);
|
||||
pBackBuffer = nil;
|
||||
}
|
||||
#ifdef RW_D3D9
|
||||
if(colourfilterVC_PS){
|
||||
rw::d3d::destroyPixelShader(colourfilterVC_PS);
|
||||
colourfilterVC_PS = nil;
|
||||
}
|
||||
if(contrast_PS){
|
||||
rw::d3d::destroyPixelShader(contrast_PS);
|
||||
contrast_PS = nil;
|
||||
}
|
||||
#endif
|
||||
#ifdef RW_OPENGL
|
||||
if(colourFilterVC){
|
||||
colourFilterVC->destroy();
|
||||
colourFilterVC = nil;
|
||||
}
|
||||
if(contrast){
|
||||
contrast->destroy();
|
||||
contrast = nil;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CPostFX::RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[0], r*2, g*2, b*2, 30);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[1], r*2, g*2, b*2, 30);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[2], r*2, g*2, b*2, 30);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[3], r*2, g*2, b*2, 30);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[0], r*2, g*2, b*2, 30);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[1], r*2, g*2, b*2, 30);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[2], r*2, g*2, b*2, 30);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[3], r*2, g*2, b*2, 30);
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, BlurOn ? Vertex2 : Vertex, 4, Index, 6);
|
||||
|
||||
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[0], r, g, b, a);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, a);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[1], r, g, b, a);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, a);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[2], r, g, b, a);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, a);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, a);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, a);
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
|
||||
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, BlurOn ? Vertex2 : Vertex, 4, Index, 6);
|
||||
}
|
||||
|
||||
void
|
||||
CPostFX::RenderOverlaySniper(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[0], r, g, b, 80);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[1], r, g, b, 80);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[2], r, g, b, 80);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[3], r, g, b, 80);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
|
||||
}
|
||||
|
||||
float CPostFX::Intensity = 1.0f;
|
||||
|
||||
void
|
||||
CPostFX::RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a)
|
||||
{
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pBackBuffer);
|
||||
|
||||
if(EffectSwitch == POSTFX_MOBILE){
|
||||
float mult[3], add[3];
|
||||
mult[0] = (r-64)/256.0f + 1.4f;
|
||||
mult[1] = (g-64)/256.0f + 1.4f;
|
||||
mult[2] = (b-64)/256.0f + 1.4f;
|
||||
add[0] = r/1536.f - 0.05f;
|
||||
add[1] = g/1536.f - 0.05f;
|
||||
add[2] = b/1536.f - 0.05f;
|
||||
#ifdef RW_D3D9
|
||||
rw::d3d::d3ddevice->SetPixelShaderConstantF(10, mult, 1);
|
||||
rw::d3d::d3ddevice->SetPixelShaderConstantF(11, add, 1);
|
||||
|
||||
rw::d3d::im2dOverridePS = contrast_PS;
|
||||
#endif
|
||||
#ifdef RW_OPENGL
|
||||
rw::gl3::im2dOverrideShader = contrast;
|
||||
contrast->use();
|
||||
glUniform3fv(contrast->uniformLocations[u_contrastMult], 1, mult);
|
||||
glUniform3fv(contrast->uniformLocations[u_contrastAdd], 1, add);
|
||||
#endif
|
||||
}else{
|
||||
float f = Intensity;
|
||||
float blurcolors[4];
|
||||
blurcolors[0] = r*f/255.0f;
|
||||
blurcolors[1] = g*f/255.0f;
|
||||
blurcolors[2] = b*f/255.0f;
|
||||
blurcolors[3] = 30/255.0f;
|
||||
#ifdef RW_D3D9
|
||||
rw::d3d::d3ddevice->SetPixelShaderConstantF(10, blurcolors, 1);
|
||||
rw::d3d::im2dOverridePS = colourfilterVC_PS;
|
||||
#endif
|
||||
#ifdef RW_OPENGL
|
||||
rw::gl3::im2dOverrideShader = colourFilterVC;
|
||||
colourFilterVC->use();
|
||||
glUniform4fv(colourFilterVC->uniformLocations[u_blurcolor], 1, blurcolors);
|
||||
#endif
|
||||
}
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
|
||||
#ifdef RW_D3D9
|
||||
rw::d3d::im2dOverridePS = nil;
|
||||
#endif
|
||||
#ifdef RW_OPENGL
|
||||
rw::gl3::im2dOverrideShader = nil;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CPostFX::RenderMotionBlur(RwCamera *cam, uint32 blur)
|
||||
{
|
||||
if(blur == 0)
|
||||
return;
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, pFrontBuffer);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[0], 255, 255, 255, blur);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[1], 255, 255, 255, blur);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[2], 255, 255, 255, blur);
|
||||
RwIm2DVertexSetIntRGBA(&Vertex[3], 255, 255, 255, blur);
|
||||
|
||||
RwIm2DRenderIndexedPrimitive(rwPRIMTYPETRILIST, Vertex, 4, Index, 6);
|
||||
}
|
||||
|
||||
bool
|
||||
CPostFX::NeedBackBuffer(void)
|
||||
{
|
||||
// Current frame -- needed for non-blur effect
|
||||
switch(EffectSwitch){
|
||||
case POSTFX_OFF:
|
||||
case POSTFX_SIMPLE:
|
||||
// no actual rendering here
|
||||
return false;
|
||||
case POSTFX_NORMAL:
|
||||
if(MotionBlurOn)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
case POSTFX_MOBILE:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
CPostFX::NeedFrontBuffer(int32 type)
|
||||
{
|
||||
// Last frame -- needed for motion blur
|
||||
if(CMBlur::Drunkness > 0.0f)
|
||||
return true;
|
||||
if(type == MOTION_BLUR_SNIPER)
|
||||
return true;
|
||||
|
||||
switch(EffectSwitch){
|
||||
case POSTFX_OFF:
|
||||
case POSTFX_SIMPLE:
|
||||
// no actual rendering here
|
||||
return false;
|
||||
case POSTFX_NORMAL:
|
||||
if(MotionBlurOn)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
case POSTFX_MOBILE:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
CPostFX::Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha)
|
||||
{
|
||||
if(pFrontBuffer == nil)
|
||||
Open(cam);
|
||||
assert(pFrontBuffer);
|
||||
assert(pBackBuffer);
|
||||
|
||||
if(type == MOTION_BLUR_LIGHT_SCENE){
|
||||
SmoothColor(red, green, blue, blur);
|
||||
red = AvgRed;
|
||||
green = AvgGreen;
|
||||
blue = AvgBlue;
|
||||
blur = AvgAlpha;
|
||||
}
|
||||
|
||||
if(NeedBackBuffer()){
|
||||
RwRasterPushContext(pBackBuffer);
|
||||
RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
|
||||
RwRasterPopContext();
|
||||
}
|
||||
|
||||
DefinedState();
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERNEAREST);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
|
||||
|
||||
if(type == MOTION_BLUR_SNIPER){
|
||||
if(!bJustInitialised)
|
||||
RenderOverlaySniper(cam, red, green, blue, blur);
|
||||
}else switch(EffectSwitch){
|
||||
case POSTFX_OFF:
|
||||
case POSTFX_SIMPLE:
|
||||
// no actual rendering here
|
||||
break;
|
||||
case POSTFX_NORMAL:
|
||||
if(MotionBlurOn){
|
||||
if(!bJustInitialised)
|
||||
RenderOverlayBlur(cam, red, green, blue, blur);
|
||||
}else{
|
||||
RenderOverlayShader(cam, red, green, blue, blur);
|
||||
}
|
||||
break;
|
||||
case POSTFX_MOBILE:
|
||||
RenderOverlayShader(cam, red, green, blue, blur);
|
||||
break;
|
||||
}
|
||||
|
||||
if(!bJustInitialised)
|
||||
RenderMotionBlur(cam, 175.0f * CMBlur::Drunkness);
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
|
||||
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
|
||||
|
||||
if(NeedFrontBuffer(type)){
|
||||
RwRasterPushContext(pFrontBuffer);
|
||||
RwRasterRenderFast(RwCameraGetRaster(cam), 0, 0);
|
||||
RwRasterPopContext();
|
||||
bJustInitialised = false;
|
||||
}else
|
||||
bJustInitialised = true;
|
||||
}
|
||||
|
||||
int CPostFX::PrevRed[NUMAVERAGE], CPostFX::AvgRed;
|
||||
int CPostFX::PrevGreen[NUMAVERAGE], CPostFX::AvgGreen;
|
||||
int CPostFX::PrevBlue[NUMAVERAGE], CPostFX::AvgBlue;
|
||||
int CPostFX::PrevAlpha[NUMAVERAGE], CPostFX::AvgAlpha;
|
||||
int CPostFX::Next;
|
||||
int CPostFX::NumValues;
|
||||
|
||||
// This is rather annoying...the blur color can flicker slightly
|
||||
// which becomes very visible when amplified by the shader
|
||||
void
|
||||
CPostFX::SmoothColor(uint32 red, uint32 green, uint32 blue, uint32 alpha)
|
||||
{
|
||||
PrevRed[Next] = red;
|
||||
PrevGreen[Next] = green;
|
||||
PrevBlue[Next] = blue;
|
||||
PrevAlpha[Next] = alpha;
|
||||
Next = (Next+1) % NUMAVERAGE;
|
||||
NumValues = Min(NumValues+1, NUMAVERAGE);
|
||||
|
||||
AvgRed = 0;
|
||||
AvgGreen = 0;
|
||||
AvgBlue = 0;
|
||||
AvgAlpha = 0;
|
||||
for(int i = 0; i < NumValues; i++){
|
||||
AvgRed += PrevRed[i];
|
||||
AvgGreen += PrevGreen[i];
|
||||
AvgBlue += PrevBlue[i];
|
||||
AvgAlpha += PrevAlpha[i];
|
||||
}
|
||||
AvgRed /= NumValues;
|
||||
AvgGreen /= NumValues;
|
||||
AvgBlue /= NumValues;
|
||||
AvgAlpha /= NumValues;
|
||||
}
|
||||
|
||||
#endif
|
45
src/extras/postfx.h
Normal file
45
src/extras/postfx.h
Normal file
@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
|
||||
class CPostFX
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
POSTFX_OFF,
|
||||
POSTFX_SIMPLE,
|
||||
POSTFX_NORMAL,
|
||||
POSTFX_MOBILE
|
||||
};
|
||||
static RwRaster *pFrontBuffer;
|
||||
static RwRaster *pBackBuffer;
|
||||
static bool bJustInitialised;
|
||||
static int EffectSwitch;
|
||||
static bool BlurOn; // or use CMblur for that?
|
||||
static bool MotionBlurOn; // or use CMblur for that?
|
||||
static float Intensity;
|
||||
|
||||
// smooth blur color
|
||||
enum { NUMAVERAGE = 20 };
|
||||
static int PrevRed[NUMAVERAGE], AvgRed;
|
||||
static int PrevGreen[NUMAVERAGE], AvgGreen;
|
||||
static int PrevBlue[NUMAVERAGE], AvgBlue;
|
||||
static int PrevAlpha[NUMAVERAGE], AvgAlpha;
|
||||
static int Next;
|
||||
static int NumValues;
|
||||
|
||||
static void InitOnce(void);
|
||||
static void Open(RwCamera *cam);
|
||||
static void Close(void);
|
||||
static void RenderOverlayBlur(RwCamera *cam, int32 r, int32 g, int32 b, int32 a);
|
||||
static void RenderOverlaySniper(RwCamera *cam, int32 r, int32 g, int32 b, int32 a);
|
||||
static void RenderOverlayShader(RwCamera *cam, int32 r, int32 g, int32 b, int32 a);
|
||||
static void RenderMotionBlur(RwCamera *cam, uint32 blur);
|
||||
static void Render(RwCamera *cam, uint32 red, uint32 green, uint32 blue, uint32 blur, int32 type, uint32 bluralpha);
|
||||
static void SmoothColor(uint32 red, uint32 green, uint32 blue, uint32 alpha);
|
||||
static bool NeedBackBuffer(void);
|
||||
static bool NeedFrontBuffer(int32 type);
|
||||
static bool UseBlurColours(void) { return EffectSwitch != POSTFX_SIMPLE; }
|
||||
};
|
||||
|
||||
#endif
|
67
src/extras/shaders/Makefile
Normal file
67
src/extras/shaders/Makefile
Normal file
@ -0,0 +1,67 @@
|
||||
all: im2d_gl3.inc simple_fs_gl3.inc default_UV2_gl3.inc \
|
||||
colourfilterVC_fs_gl3.inc contrast_fs_gl3.inc \
|
||||
neoRim_gl3.inc neoRimSkin_gl3.inc \
|
||||
neoWorldVC_fs_gl3.inc neoGloss_vs_gl3.inc neoGloss_fs_gl3.inc \
|
||||
neoVehicle_vs_gl3.inc neoVehicle_fs_gl3.inc
|
||||
|
||||
im2d_gl3.inc: im2d.vert
|
||||
(echo 'const char *im2d_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' im2d.vert;\
|
||||
echo ';') >im2d_gl3.inc
|
||||
|
||||
colourfilterVC_fs_gl3.inc: colourfilterVC.frag
|
||||
(echo 'const char *colourfilterVC_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' colourfilterVC.frag;\
|
||||
echo ';') >colourfilterVC_fs_gl3.inc
|
||||
simple_fs_gl3.inc: simple.frag
|
||||
(echo 'const char *simple_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' simple.frag;\
|
||||
echo ';') >simple_fs_gl3.inc
|
||||
|
||||
default_UV2_gl3.inc: default_UV2.vert
|
||||
(echo 'const char *default_UV2_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' default_UV2.vert;\
|
||||
echo ';') >default_UV2_gl3.inc
|
||||
|
||||
|
||||
|
||||
contrast_fs_gl3.inc: contrast.frag
|
||||
(echo 'const char *contrast_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' contrast.frag;\
|
||||
echo ';') >contrast_fs_gl3.inc
|
||||
|
||||
|
||||
neoRim_gl3.inc: neoRim.vert
|
||||
(echo 'const char *neoRim_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' neoRim.vert;\
|
||||
echo ';') >neoRim_gl3.inc
|
||||
|
||||
neoRimSkin_gl3.inc: neoRimSkin.vert
|
||||
(echo 'const char *neoRimSkin_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' neoRimSkin.vert;\
|
||||
echo ';') >neoRimSkin_gl3.inc
|
||||
|
||||
neoWorldVC_fs_gl3.inc: neoWorldVC.frag
|
||||
(echo 'const char *neoWorldVC_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' neoWorldVC.frag;\
|
||||
echo ';') >neoWorldVC_fs_gl3.inc
|
||||
|
||||
neoGloss_fs_gl3.inc: neoGloss.frag
|
||||
(echo 'const char *neoGloss_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' neoGloss.frag;\
|
||||
echo ';') >neoGloss_fs_gl3.inc
|
||||
|
||||
neoGloss_vs_gl3.inc: neoGloss.vert
|
||||
(echo 'const char *neoGloss_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' neoGloss.vert;\
|
||||
echo ';') >neoGloss_vs_gl3.inc
|
||||
|
||||
neoVehicle_vs_gl3.inc: neoVehicle.vert
|
||||
(echo 'const char *neoVehicle_vert_src =';\
|
||||
sed 's/..*/"&\\n"/' neoVehicle.vert;\
|
||||
echo ';') >neoVehicle_vs_gl3.inc
|
||||
|
||||
neoVehicle_fs_gl3.inc: neoVehicle.frag
|
||||
(echo 'const char *neoVehicle_frag_src =';\
|
||||
sed 's/..*/"&\\n"/' neoVehicle.frag;\
|
||||
echo ';') >neoVehicle_fs_gl3.inc
|
26
src/extras/shaders/colourfilterVC.frag
Normal file
26
src/extras/shaders/colourfilterVC.frag
Normal file
@ -0,0 +1,26 @@
|
||||
uniform sampler2D tex0;
|
||||
uniform vec4 u_blurcolor;
|
||||
|
||||
in vec4 v_color;
|
||||
in vec2 v_tex0;
|
||||
in float v_fog;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
float a = u_blurcolor.a;
|
||||
vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);
|
||||
vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
|
||||
vec4 prev = dst;
|
||||
for(int i = 0; i < 5; i++){
|
||||
vec4 tmp = dst*(1.0-a) + prev*doublec*a;
|
||||
tmp += prev*u_blurcolor;
|
||||
tmp += prev*u_blurcolor;
|
||||
prev = clamp(tmp, 0.0, 1.0);
|
||||
}
|
||||
color.rgb = prev.rgb;
|
||||
color.a = 1.0f;
|
||||
}
|
||||
|
BIN
src/extras/shaders/colourfilterVC_PS.cso
Normal file
BIN
src/extras/shaders/colourfilterVC_PS.cso
Normal file
Binary file not shown.
23
src/extras/shaders/colourfilterVC_PS.hlsl
Normal file
23
src/extras/shaders/colourfilterVC_PS.hlsl
Normal file
@ -0,0 +1,23 @@
|
||||
sampler2D tex : register(s0);
|
||||
float4 blurcol : register(c10);
|
||||
|
||||
//float4 blurcols[10] : register(c15);
|
||||
|
||||
|
||||
float4 main(in float2 texcoord : TEXCOORD0) : COLOR0
|
||||
{
|
||||
float a = blurcol.a;
|
||||
|
||||
float4 doublec = saturate(blurcol*2);
|
||||
float4 dst = tex2D(tex, texcoord.xy);
|
||||
float4 prev = dst;
|
||||
for(int i = 0; i < 5; i++){
|
||||
// float4 doublec = saturate(blurcol*2);
|
||||
float4 tmp = dst*(1-a) + prev*doublec*a;
|
||||
tmp += prev*blurcol;
|
||||
tmp += prev*blurcol;
|
||||
prev = saturate(tmp);
|
||||
}
|
||||
prev.a = 1.0f;
|
||||
return prev;
|
||||
}
|
56
src/extras/shaders/colourfilterVC_PS.inc
Normal file
56
src/extras/shaders/colourfilterVC_PS.inc
Normal file
@ -0,0 +1,56 @@
|
||||
static unsigned char colourfilterVC_PS_cso[] = {
|
||||
0x00, 0x02, 0xff, 0xff, 0xfe, 0xff, 0x2b, 0x00, 0x43, 0x54, 0x41, 0x42,
|
||||
0x1c, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xff,
|
||||
0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
|
||||
0x70, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0a, 0x00,
|
||||
0x01, 0x00, 0x2a, 0x00, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x5c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00,
|
||||
0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x6c, 0x75, 0x72,
|
||||
0x63, 0x6f, 0x6c, 0x00, 0x01, 0x00, 0x03, 0x00, 0x01, 0x00, 0x04, 0x00,
|
||||
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x74, 0x65, 0x78, 0x00,
|
||||
0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x70, 0x73, 0x5f, 0x32, 0x5f, 0x30, 0x00, 0x4d,
|
||||
0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29,
|
||||
0x20, 0x48, 0x4c, 0x53, 0x4c, 0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72,
|
||||
0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72, 0x20, 0x39, 0x2e,
|
||||
0x32, 0x39, 0x2e, 0x39, 0x35, 0x32, 0x2e, 0x33, 0x31, 0x31, 0x31, 0x00,
|
||||
0x51, 0x00, 0x00, 0x05, 0x00, 0x00, 0x0f, 0xa0, 0x00, 0x00, 0x00, 0x40,
|
||||
0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x03, 0xb0,
|
||||
0x1f, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x90, 0x00, 0x08, 0x0f, 0xa0,
|
||||
0x42, 0x00, 0x00, 0x03, 0x00, 0x00, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0xb0,
|
||||
0x00, 0x08, 0xe4, 0xa0, 0x02, 0x00, 0x00, 0x03, 0x01, 0x00, 0x17, 0x80,
|
||||
0x0a, 0x00, 0xe4, 0xa0, 0x0a, 0x00, 0xe4, 0xa0, 0x05, 0x00, 0x00, 0x03,
|
||||
0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x01, 0x00, 0xe4, 0x80,
|
||||
0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80, 0x0a, 0x00, 0xff, 0xa0,
|
||||
0x02, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
|
||||
0x02, 0x00, 0x07, 0x80, 0x00, 0x00, 0xe4, 0x80, 0x0a, 0x00, 0xe4, 0xa0,
|
||||
0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
|
||||
0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80,
|
||||
0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80,
|
||||
0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
|
||||
0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80,
|
||||
0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80,
|
||||
0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
|
||||
0x03, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x04, 0x00, 0x07, 0x80,
|
||||
0x0a, 0x00, 0xff, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80,
|
||||
0x04, 0x00, 0x00, 0x04, 0x02, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x00, 0x00, 0x00, 0xa0, 0x04, 0x00, 0xe4, 0x80, 0x05, 0x00, 0x00, 0x03,
|
||||
0x01, 0x00, 0x07, 0x80, 0x01, 0x00, 0xe4, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x05, 0x00, 0x00, 0x03, 0x02, 0x00, 0x07, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x0a, 0x00, 0xe4, 0xa0, 0x12, 0x00, 0x00, 0x04, 0x03, 0x00, 0x07, 0x80,
|
||||
0x0a, 0x00, 0xff, 0xa0, 0x01, 0x00, 0xe4, 0x80, 0x00, 0x00, 0xe4, 0x80,
|
||||
0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x17, 0x80, 0x02, 0x00, 0xe4, 0x80,
|
||||
0x00, 0x00, 0x00, 0xa0, 0x03, 0x00, 0xe4, 0x80, 0x01, 0x00, 0x00, 0x02,
|
||||
0x00, 0x00, 0x08, 0x80, 0x00, 0x00, 0x55, 0xa0, 0x01, 0x00, 0x00, 0x02,
|
||||
0x00, 0x08, 0x0f, 0x80, 0x00, 0x00, 0xe4, 0x80, 0xff, 0xff, 0x00, 0x00
|
||||
};
|
28
src/extras/shaders/colourfilterVC_fs_gl3.inc
Normal file
28
src/extras/shaders/colourfilterVC_fs_gl3.inc
Normal file
@ -0,0 +1,28 @@
|
||||
const char *colourfilterVC_frag_src =
|
||||
"uniform sampler2D tex0;\n"
|
||||
"uniform vec4 u_blurcolor;\n"
|
||||
|
||||
"in vec4 v_color;\n"
|
||||
"in vec2 v_tex0;\n"
|
||||
"in float v_fog;\n"
|
||||
|
||||
"out vec4 color;\n"
|
||||
|
||||
"void\n"
|
||||
"main(void)\n"
|
||||
"{\n"
|
||||
" float a = u_blurcolor.a;\n"
|
||||
" vec4 doublec = clamp(u_blurcolor*2, 0.0, 1.0);\n"
|
||||
" vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));\n"
|
||||
" vec4 prev = dst;\n"
|
||||
" for(int i = 0; i < 5; i++){\n"
|
||||
" vec4 tmp = dst*(1.0-a) + prev*doublec*a;\n"
|
||||
" tmp += prev*u_blurcolor;\n"
|
||||
" tmp += prev*u_blurcolor;\n"
|
||||
" prev = clamp(tmp, 0.0, 1.0);\n"
|
||||
" }\n"
|
||||
" color.rgb = prev.rgb;\n"
|
||||
" color.a = 1.0f;\n"
|
||||
"}\n"
|
||||
|
||||
;
|
18
src/extras/shaders/contrast.frag
Normal file
18
src/extras/shaders/contrast.frag
Normal file
@ -0,0 +1,18 @@
|
||||
uniform sampler2D tex0;
|
||||
uniform vec3 u_contrastAdd;
|
||||
uniform vec3 u_contrastMult;
|
||||
|
||||
in vec4 v_color;
|
||||
in vec2 v_tex0;
|
||||
in float v_fog;
|
||||
|
||||
out vec4 color;
|
||||
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
vec4 dst = texture(tex0, vec2(v_tex0.x, 1.0-v_tex0.y));
|
||||
color.rgb = dst.rgb*u_contrastMult + u_contrastAdd;
|
||||
color.a = 1.0f;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user