mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-11-22 09:09:15 +01:00
Merge remote-tracking branch 'origin' into wiiu
This commit is contained in:
commit
155f057edf
116
.github/workflows/build-cmake-conan.yml
vendored
Normal file
116
.github/workflows/build-cmake-conan.yml
vendored
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
name: re3 conan+cmake
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
release:
|
||||||
|
types: published
|
||||||
|
jobs:
|
||||||
|
build-cmake:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: 'windows-latest'
|
||||||
|
platform: 'gl3'
|
||||||
|
gl3_gfxlib: 'glfw'
|
||||||
|
audio: 'openal'
|
||||||
|
# - os: 'windows-latest'
|
||||||
|
# platform: 'gl3'
|
||||||
|
# gl3_gfxlib: 'sdl2'
|
||||||
|
# audio: 'openal'
|
||||||
|
- os: 'windows-latest'
|
||||||
|
platform: 'd3d9'
|
||||||
|
audio: 'openal'
|
||||||
|
# - os: 'windows-latest'
|
||||||
|
# platform: 'd3d9'
|
||||||
|
# audio: 'miles'
|
||||||
|
- os: 'ubuntu-latest'
|
||||||
|
platform: 'gl3'
|
||||||
|
gl3_gfxlib: 'glfw'
|
||||||
|
audio: 'openal'
|
||||||
|
# - os: 'ubuntu-latest'
|
||||||
|
# platform: 'gl3'
|
||||||
|
# gl3_gfxlib: 'sdl2'
|
||||||
|
# audio: 'openal'
|
||||||
|
- os: 'macos-latest'
|
||||||
|
platform: 'gl3'
|
||||||
|
gl3_gfxlib: 'glfw'
|
||||||
|
audio: 'openal'
|
||||||
|
# - os: 'macos-latest'
|
||||||
|
# platform: 'gl3'
|
||||||
|
# gl3_gfxlib: 'sdl2'
|
||||||
|
# audio: 'openal'
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
continue-on-error: ${{ matrix.platform == 'ps2' || matrix.gl3_gfxlib == 'sdl2' || matrix.audio == 'miles' }}
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
- name: "Checkout Miles SDK Import Library project"
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
if: ${{ matrix.audio == 'miles' }}
|
||||||
|
with:
|
||||||
|
repository: 'withmorten/re3mss'
|
||||||
|
path: 're3mss'
|
||||||
|
- uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: '3.x'
|
||||||
|
- name: "Use XCode 11 as default (conan-center-index does not provide XCode 12 binaries at the moment)"
|
||||||
|
if: startsWith(matrix.os, 'macos')
|
||||||
|
run: |
|
||||||
|
sudo xcode-select --switch /Applications/Xcode_11.7.app
|
||||||
|
- name: "Setup conan"
|
||||||
|
run: |
|
||||||
|
python -m pip install conan
|
||||||
|
conan config init
|
||||||
|
conan config set log.print_run_commands=True
|
||||||
|
conan remote add bincrafters https://api.bintray.com/conan/bincrafters/public-conan
|
||||||
|
conan remote add madebr_ps2dev https://api.bintray.com/conan/madebr/ps2dev
|
||||||
|
- name: "Add os=playstation2 + gcc.version=3.2 to .conan/settings.yml"
|
||||||
|
shell: python
|
||||||
|
run: |
|
||||||
|
import os, yaml
|
||||||
|
settings_path = os.path.expanduser("~/.conan/settings.yml")
|
||||||
|
yml = yaml.safe_load(open(settings_path))
|
||||||
|
yml["os"]["playstation2"] = None
|
||||||
|
yml["compiler"]["gcc"]["version"].append("3.2")
|
||||||
|
yml["compiler"]["gcc"]["version"].sort()
|
||||||
|
yaml.safe_dump(yml, open(settings_path, "w"))
|
||||||
|
- name: "Create host profile"
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if test "${{ matrix.platform }}" = "ps2"; then
|
||||||
|
cp vendor/librw/conan/playstation2 host_profile
|
||||||
|
else
|
||||||
|
cp ~/.conan/profiles/default host_profile
|
||||||
|
fi
|
||||||
|
- name: "Export Playstation 2 CMake toolchain conan recipe"
|
||||||
|
run: |
|
||||||
|
conan export vendor/librw/cmake/ps2toolchain ps2dev-cmaketoolchain/master@
|
||||||
|
- name: "Export librw conan recipe"
|
||||||
|
run: |
|
||||||
|
conan export vendor/librw librw/master@
|
||||||
|
- name: "Export Miles SDK conan recipe"
|
||||||
|
if: ${{ matrix.audio == 'miles' }}
|
||||||
|
run: |
|
||||||
|
conan export re3mss miles-sdk/master@
|
||||||
|
- name: "Download/build dependencies (conan install)"
|
||||||
|
run: |
|
||||||
|
conan install ${{ github.workspace }} re3/master@ -if build -o re3:audio=${{ matrix.audio }} -o librw:platform=${{ matrix.platform }} -o librw:gl3_gfxlib=${{ matrix.gl3_gfxlib || 'glfw' }} --build missing -pr:h ./host_profile -pr:b default -s re3:build_type=RelWithDebInfo -s librw:build_type=RelWithDebInfo
|
||||||
|
env:
|
||||||
|
CONAN_SYSREQUIRES_MODE: enabled
|
||||||
|
- name: "Build re3 (conan build)"
|
||||||
|
run: |
|
||||||
|
conan build ${{ github.workspace }} -if build -bf build -pf package
|
||||||
|
- name: "Package re3 (conan package)"
|
||||||
|
run: |
|
||||||
|
conan package ${{ github.workspace }} -if build -bf build -pf package
|
||||||
|
- name: "Create binary package (cpack)"
|
||||||
|
working-directory: ./build
|
||||||
|
run: |
|
||||||
|
cpack -C RelWithDebInfo
|
||||||
|
- name: "Archive binary package (github artifacts)"
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: "${{ matrix.os }}-${{ matrix.platform }}"
|
||||||
|
path: build/*.tar.xz
|
||||||
|
if-no-files-found: error
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -358,3 +358,6 @@ sdk/
|
|||||||
*.rpx
|
*.rpx
|
||||||
*.elf
|
*.elf
|
||||||
/.vscode
|
/.vscode
|
||||||
|
codewarrior/re3_Data/
|
||||||
|
codewarrior/Release/
|
||||||
|
codewarrior/Debug/
|
||||||
|
44
.travis.yml
44
.travis.yml
@ -1,44 +0,0 @@
|
|||||||
language: cpp
|
|
||||||
dist: focal
|
|
||||||
os: linux
|
|
||||||
jobs:
|
|
||||||
include:
|
|
||||||
- env: TARGET=release_linux-amd64-librw_gl3_glfw-oal
|
|
||||||
os: linux
|
|
||||||
- env: TARGET=debug_linux-amd64-librw_gl3_glfw-oal
|
|
||||||
os: linux
|
|
||||||
- env: TARGET=release_macosx-amd64-librw_gl3_glfw-oal PREMAKE5=premake-5.0.0-alpha15
|
|
||||||
compiler: clang
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode12u
|
|
||||||
- env: TARGET=debug_macosx-amd64-librw_gl3_glfw-oal PREMAKE5=premake-5.0.0-alpha15
|
|
||||||
compiler: clang
|
|
||||||
os: osx
|
|
||||||
osx_image: xcode12u
|
|
||||||
addons:
|
|
||||||
apt:
|
|
||||||
update: true
|
|
||||||
packages:
|
|
||||||
- linux-libc-dev
|
|
||||||
- libopenal-dev
|
|
||||||
- libglew-dev
|
|
||||||
- libglfw3-dev
|
|
||||||
- libsndfile1-dev
|
|
||||||
- libmpg123-dev
|
|
||||||
- gcc-8-multilib
|
|
||||||
- g++-8-multilib
|
|
||||||
homebrew:
|
|
||||||
packages:
|
|
||||||
- libsndfile
|
|
||||||
- mpg123
|
|
||||||
- glew
|
|
||||||
- glfw
|
|
||||||
- openal-soft
|
|
||||||
script:
|
|
||||||
- mkdir -p "$TRAVIS_BUILD_DIR/build"
|
|
||||||
- cd "$TRAVIS_BUILD_DIR"
|
|
||||||
- if [ "$TRAVIS_OS_NAME" = linux ]; then ./premake5Linux --with-librw gmake2; fi
|
|
||||||
- if [ "$TRAVIS_OS_NAME" = osx ]; then curl -L -o "${PREMAKE5}.zip" "https://github.com/premake/premake-core/releases/download/v5.0.0-alpha15/${PREMAKE5}-src.zip" && unzip -q "${PREMAKE5}.zip" && cd "$PREMAKE5" && make -f Bootstrap.mak osx && cd .. && "./${PREMAKE5}/bin/release/premake5" --with-librw gmake2; fi
|
|
||||||
- cd build
|
|
||||||
- if [ "$TRAVIS_OS_NAME" = linux ]; then env CC=gcc-8 CXX=g++-8 make config=$TARGET -j4 verbose=1; fi
|
|
||||||
- if [ "$TRAVIS_OS_NAME" = osx ]; then make config=$TARGET -j4 verbose=1; fi
|
|
@ -1,44 +1,82 @@
|
|||||||
cmake_minimum_required(VERSION 3.8)
|
cmake_minimum_required(VERSION 3.8)
|
||||||
|
|
||||||
project(re3 C CXX)
|
set(EXECUTABLE re3)
|
||||||
|
set(PROJECT RE3)
|
||||||
|
|
||||||
|
project(${EXECUTABLE} C CXX)
|
||||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||||
|
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(RE3_AUDIOS "NULL" "OAL" "MSS")
|
set(${PROJECT}_AUDIOS "OAL" "MSS")
|
||||||
else()
|
else()
|
||||||
set(RE3_AUDIOS "NULL" "OAL")
|
set(${PROJECT}_AUDIOS "OAL")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(RE3_AUDIO "OAL" CACHE STRING "Audio")
|
set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio")
|
||||||
|
|
||||||
set_property(CACHE RE3_AUDIO PROPERTY STRINGS ${RE3_AUDIOS})
|
option(${PROJECT}_WITH_OPUS "Build ${EXECUTABLE} with opus support" OFF)
|
||||||
message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})")
|
option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF)
|
||||||
set("RE3_AUDIO_${RE3_AUDIO}" ON)
|
|
||||||
if(NOT RE3_AUDIO IN_LIST RE3_AUDIOS)
|
set_property(CACHE ${PROJECT}_AUDIO PROPERTY STRINGS ${${PROJECT}_AUDIOS})
|
||||||
message(FATAL_ERROR "Illegal RE3_AUDIO=${RE3_AUDIO}")
|
message(STATUS "${PROJECT}_AUDIO = ${${PROJECT}_AUDIO} (choices=${${PROJECT}_AUDIOS})")
|
||||||
|
set("${PROJECT}_AUDIO_${${PROJECT}_AUDIO}" ON)
|
||||||
|
if(NOT ${PROJECT}_AUDIO IN_LIST ${PROJECT}_AUDIOS)
|
||||||
|
message(FATAL_ERROR "Illegal ${PROJECT}_AUDIO=${${PROJECT}_AUDIO}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(RE3_INSTALL)
|
option(${PROJECT}_VENDORED_LIBRW "Use vendored librw" ON)
|
||||||
include(GNUInstallDirs)
|
if(${PROJECT}_VENDORED_LIBRW)
|
||||||
set(RE3_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/re3")
|
add_subdirectory(vendor/librw)
|
||||||
|
else()
|
||||||
|
find_package(librw REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory("vendor/librw")
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
if(RE3_INSTALL)
|
if(${PROJECT}_INSTALL)
|
||||||
include(CMakePackageConfigHelpers)
|
install(DIRECTORY gamefiles/ DESTINATION ".")
|
||||||
configure_package_config_file(re3-config.cmake.in re3-config.cmake
|
if(LIBRW_PLATFORM_NULL)
|
||||||
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
set(platform "-null")
|
||||||
)
|
elseif(LIBRW_PLATFORM_PS2)
|
||||||
install(
|
set(platform "-ps2")
|
||||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/re3-config.cmake"
|
elseif(LIBRW_PLATFORM_GL3)
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
if(LIBRW_GL3_GFXLIB STREQUAL "GLFW")
|
||||||
)
|
set(platform "-gl3-glfw")
|
||||||
install(
|
else()
|
||||||
EXPORT re3-targets
|
set(platform "-gl3-sdl2")
|
||||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
endif()
|
||||||
)
|
elseif(LIBRW_PLATFORM_D3D9)
|
||||||
|
set(platform "-d3d9")
|
||||||
|
endif()
|
||||||
|
if(${PROJECT}_AUDIO_OAL)
|
||||||
|
set(audio "-oal")
|
||||||
|
elseif(${PROJECT}_AUDIO_MSS)
|
||||||
|
set(audio "-mss")
|
||||||
|
endif()
|
||||||
|
if(${PROJECT}_WITH_OPUS)
|
||||||
|
set(audio "${audio}-opus")
|
||||||
|
endif()
|
||||||
|
if(NOT LIBRW_PLATFORM_PS2)
|
||||||
|
if(WIN32)
|
||||||
|
set(os "-win")
|
||||||
|
elseif(APPLE)
|
||||||
|
set(os "-apple")
|
||||||
|
elseif(UNIX)
|
||||||
|
set(os "-linux")
|
||||||
|
else()
|
||||||
|
set(compiler "-UNK")
|
||||||
|
message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
include(CMakeCPack.cmake)
|
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${platform}${audio}${os}${compiler}")
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTA III reversed")
|
||||||
|
set(CPACK_PACKAGE_VENDOR "GTAModding")
|
||||||
|
# FIXME: missing license (https://github.com/GTAmodding/re3/issues/794)
|
||||||
|
# set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||||
|
# set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
||||||
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
|
||||||
|
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
|
||||||
|
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
|
||||||
|
set(CPACK_GENERATOR "TXZ")
|
||||||
|
include(CPack)
|
||||||
endif()
|
endif()
|
||||||
|
88
README.md
88
README.md
@ -12,3 +12,91 @@ To build this project make sure you install the requried packages:
|
|||||||
You also need to build [libsndfile](https://github.com/libsndfile/libsndfile). To configure libsndfile for the Wii U take a look at this gist: https://gist.github.com/GaryOderNichts/475edaf03ff08ba100840608f92eade8
|
You also need to build [libsndfile](https://github.com/libsndfile/libsndfile). To configure libsndfile for the Wii U take a look at this gist: https://gist.github.com/GaryOderNichts/475edaf03ff08ba100840608f92eade8
|
||||||
Then clone this repo using `git clone --recursive https://github.com/GaryOderNichts/re3` and build using `make`.
|
Then clone this repo using `git clone --recursive https://github.com/GaryOderNichts/re3` and build using `make`.
|
||||||
To build the channel edit `CHANNEL_BUILD := 0` to `CHANNEL_BUILD := 1` in the `Makefile`.
|
To build the channel edit `CHANNEL_BUILD := 0` to `CHANNEL_BUILD := 1` in the `Makefile`.
|
||||||
|
|
||||||
|
# Original README
|
||||||
|
|
||||||
|
[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2FGTAmodding%2Fre3%2Fbadge%3Fref%3Dmaster&style=flat)](https://actions-badge.atrox.dev/GTAmodding/re3/goto?ref=master)
|
||||||
|
<a href="https://discord.gg/aKYAwCx92H"><img src="https://img.shields.io/badge/discord-join-7289DA.svg?logo=discord&longCache=true&style=flat" /></a>
|
||||||
|
|
||||||
|
## Intro
|
||||||
|
|
||||||
|
The aim of this project is to reverse GTA III for PC by replacing
|
||||||
|
parts of the game [one by one](https://en.wikipedia.org/wiki/Ship_of_Theseus)
|
||||||
|
such that we have a working game at all times.
|
||||||
|
|
||||||
|
## How can I try it?
|
||||||
|
|
||||||
|
- re3 requires game assets to work, so you **must** own [a copy of GTA III](https://store.steampowered.com/app/12100/Grand_Theft_Auto_III/).
|
||||||
|
- Build re3 or download [the latest nightly build](https://github.com/GTAmodding/re3/actions) (You must be logged in.)
|
||||||
|
- (Optional) If you want to use optional features like Russian language or menu map, copy the files in /gamefiles folder to your game root folder.
|
||||||
|
- Move re3.exe to GTA 3 directory and run it.
|
||||||
|
|
||||||
|
## Building from Source
|
||||||
|
|
||||||
|
If you gonna use premake, then before starting you may want to point GTA_III_RE_DIR environment variable to GTA3 root folder, if you want executable to be moved there via post-build script.
|
||||||
|
|
||||||
|
<details><summary>Linux Premake</summary>
|
||||||
|
|
||||||
|
For Linux using premake, proceed: [Building on Linux](https://github.com/GTAmodding/re3/wiki/Building-on-Linux)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>Linux Conan</summary>
|
||||||
|
|
||||||
|
Obtain source code.
|
||||||
|
```
|
||||||
|
git clone https://github.com/GTAmodding/re3.git
|
||||||
|
cd re3
|
||||||
|
git submodule init
|
||||||
|
git submodule update --recursive
|
||||||
|
```
|
||||||
|
Install python and conan, and then run build.
|
||||||
|
```
|
||||||
|
conan export vendor/librw librw/master@
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
conan install .. re3/master@ -if build -o re3:audio=openal -o librw:platform=gl3 -o librw:gl3_gfxlib=glfw --build missing -s re3:build_type=RelWithDebInfo -s librw:build_type=RelWithDebInfo
|
||||||
|
conan build .. -if build -bf build -pf package
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>FreeBSD</summary>
|
||||||
|
|
||||||
|
For FreeBSD using premake, proceed: [Building on FreeBSD](https://github.com/GTAmodding/re3/wiki/Building-on-FreeBSD)
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details><summary>Windows</summary>
|
||||||
|
|
||||||
|
Assuming you have Visual Studio:
|
||||||
|
- Clone the repo using the argument `--recursive`.
|
||||||
|
- Run one of the `premake-vsXXXX.cmd` variants on root folder.
|
||||||
|
- Open the project via Visual Studio
|
||||||
|
|
||||||
|
**If you use 64-bit D3D9**: We don't ship 64-bit Dx9 SDK. You need to download it from Microsoft if you don't have it(although it should come pre-installed after some Windows version)
|
||||||
|
|
||||||
|
**If you choose OpenAL on Windows** You must read [Running OpenAL build on Windows](https://github.com/GTAmodding/re3/wiki/Running-OpenAL-build-on-Windows).
|
||||||
|
</details>
|
||||||
|
|
||||||
|
> :information_source: There are various settings at the very bottom of [config.h](https://github.com/GTAmodding/re3/tree/master/src/core/config.h), you may want to take a look there. i.e. FIX_BUGS define fixes the bugs we've come across.
|
||||||
|
|
||||||
|
> :information_source: **Did you notice librw?** re3 uses completely homebrew RenderWare-replacement rendering engine; [librw](https://github.com/aap/librw/). librw comes as submodule of re3, but you also can use LIBRW enviorenment variable to specify path to your own librw.
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document
|
||||||
|
|
||||||
|
### Unreversed / incomplete classes (at least the ones we know)
|
||||||
|
The following classes have only unused or practically unused code left:
|
||||||
|
```
|
||||||
|
NameGrid.cpp - only on mobile (a player name grid, either a very early player name code ala GTA1 or a multiplayer leftover)
|
||||||
|
PedDebug.cpp - only on mobile (debug code)
|
||||||
|
HandlingMgr.cpp - debug functions from mobile
|
||||||
|
CFormationInfo - unused PedAI class that could be found on mobile
|
||||||
|
CVehicle::ProcessBikeWheel - early bike code (only on mobile)
|
||||||
|
CAutomobile::DebugCode - debug function from mobile
|
||||||
|
CBoat::DebugCode - debug function from mobile
|
||||||
|
CBoat::ModifyHandlingValue - debug function from mobile
|
||||||
|
CBoat::DisplayHandlingData - debug function from mobile
|
||||||
|
CStreaming::PrintRequestList - debug function from mobile
|
||||||
|
d3d8raster.c - only on PC (slight RW modification that we don't actually need)
|
||||||
|
```
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
# - Find mpg123
|
|
||||||
# Find the native mpg123 includes and library
|
|
||||||
#
|
|
||||||
# MPG123_INCLUDE_DIR - where to find mpg123.h
|
|
||||||
# MPG123_LIBRARIES - List of libraries when using mpg123.
|
|
||||||
# MPG123_FOUND - True if mpg123 found.
|
|
||||||
|
|
||||||
IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
|
|
||||||
# Already in cache, be silent
|
|
||||||
SET(MPG123_FIND_QUIETLY TRUE)
|
|
||||||
ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
|
|
||||||
|
|
||||||
FIND_PATH(MPG123_INCLUDE_DIR mpg123.h
|
|
||||||
PATHS "${MPG123_DIR}"
|
|
||||||
PATH_SUFFIXES include
|
|
||||||
)
|
|
||||||
|
|
||||||
FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0
|
|
||||||
PATHS "${MPG123_DIR}"
|
|
||||||
PATH_SUFFIXES lib
|
|
||||||
)
|
|
||||||
|
|
||||||
# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR)
|
|
||||||
|
|
||||||
# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if
|
|
||||||
# all listed variables are TRUE
|
|
||||||
INCLUDE(FindPackageHandleStandardArgs)
|
|
||||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR)
|
|
34
cmake/FindMilesSDK.cmake
Normal file
34
cmake/FindMilesSDK.cmake
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
# - Find Miles SDK
|
||||||
|
# Find the Miles SDK header + import library
|
||||||
|
#
|
||||||
|
# MilesSDK_INCLUDE_DIR - Where to find mss.h
|
||||||
|
# MilesSDK_LIBRARIES - List of libraries when using MilesSDK.
|
||||||
|
# MilesSDK_FOUND - True if Miles SDK found.
|
||||||
|
# MilesSDK::MilesSDK - Imported library of Miles SDK
|
||||||
|
|
||||||
|
find_path(MilesSDK_INCLUDE_DIR mss.h
|
||||||
|
PATHS "${MilesSDK_DIR}"
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
)
|
||||||
|
|
||||||
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
|
set(_miles_sdk_libname mss64)
|
||||||
|
else()
|
||||||
|
set(_miles_sdk_libname mss32)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_library(MilesSDK_LIBRARIES NAMES ${_miles_sdk_libname}
|
||||||
|
PATHS "${MilesSDK_DIR}"
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(MilesSDK DEFAULT_MSG MilesSDK_LIBRARIES MilesSDK_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(NOT TARGET MilesSDK::MilesSDK)
|
||||||
|
add_library(MilesSDK::MilesSDK UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(MilesSDK::MilesSDK PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${MilesSDK_LIBRARIES}
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${MilesSDK_INCLUDE_DIR}"
|
||||||
|
)
|
||||||
|
endif()
|
@ -4,9 +4,11 @@
|
|||||||
#
|
#
|
||||||
# Once done this will define
|
# Once done this will define
|
||||||
#
|
#
|
||||||
# SNDFILE_FOUND - system has libsndfile
|
# SNDFILE_FOUND - system has libsndfile
|
||||||
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory
|
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory
|
||||||
# SNDFILE_LIBRARIES - Link these to use libsndfile
|
# SNDFILE_LIBRARIES - Link these to use libsndfile
|
||||||
|
# SNDFILE_CFLAGS - Compile options to use libsndfile
|
||||||
|
# SndFile::SndFile - Imported library of libsndfile
|
||||||
#
|
#
|
||||||
# Copyright (C) 2006 Wengo
|
# Copyright (C) 2006 Wengo
|
||||||
#
|
#
|
||||||
@ -15,53 +17,51 @@
|
|||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
#
|
#
|
||||||
|
|
||||||
if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
find_package(PkgConfig QUIET)
|
||||||
# in cache already
|
if(PKG_CONFIG_FOUND)
|
||||||
set(SNDFILE_FOUND TRUE)
|
pkg_search_module(PKG_SNDFILE "sndfile")
|
||||||
else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
endif()
|
||||||
|
|
||||||
find_path(SNDFILE_INCLUDE_DIR
|
find_path(SNDFILE_INCLUDE_DIR
|
||||||
NAMES
|
NAMES
|
||||||
sndfile.h
|
sndfile.h
|
||||||
|
HINTS
|
||||||
|
${PKG_SNDFILE_INCLUDE_DIRS}
|
||||||
PATHS
|
PATHS
|
||||||
/usr/include
|
/usr/include
|
||||||
/usr/local/include
|
/usr/local/include
|
||||||
/opt/local/include
|
/opt/local/include
|
||||||
/sw/include
|
/sw/include
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(SNDFILE_LIBRARY
|
find_library(SNDFILE_LIBRARY
|
||||||
NAMES
|
NAMES
|
||||||
sndfile
|
sndfile
|
||||||
|
HINTS
|
||||||
|
${PKG_SNDFILE_LIBRARIES}
|
||||||
PATHS
|
PATHS
|
||||||
/usr/lib
|
/usr/lib
|
||||||
/usr/local/lib
|
/usr/local/lib
|
||||||
/opt/local/lib
|
/opt/local/lib
|
||||||
/sw/lib
|
/sw/lib
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SNDFILE_INCLUDE_DIRS
|
set(SNDFILE_CFLAGS "${PKG_SNDFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of libsndfile")
|
||||||
${SNDFILE_INCLUDE_DIR}
|
|
||||||
)
|
|
||||||
set(SNDFILE_LIBRARIES
|
|
||||||
${SNDFILE_LIBRARY}
|
|
||||||
)
|
|
||||||
|
|
||||||
if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
|
set(SNDFILE_INCLUDE_DIRS "${SNDFILE_INCLUDE_DIR}")
|
||||||
|
set(SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}")
|
||||||
|
|
||||||
|
if(SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
|
||||||
set(SNDFILE_FOUND TRUE)
|
set(SNDFILE_FOUND TRUE)
|
||||||
endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
|
endif()
|
||||||
|
|
||||||
if (SNDFILE_FOUND)
|
include(FindPackageHandleStandardArgs)
|
||||||
if (NOT SndFile_FIND_QUIETLY)
|
find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
|
||||||
message(STATUS "Found libsndfile: ${SNDFILE_LIBRARIES}")
|
|
||||||
endif (NOT SndFile_FIND_QUIETLY)
|
|
||||||
else (SNDFILE_FOUND)
|
|
||||||
if (SndFile_FIND_REQUIRED)
|
|
||||||
message(FATAL_ERROR "Could not find libsndfile")
|
|
||||||
endif (SndFile_FIND_REQUIRED)
|
|
||||||
endif (SNDFILE_FOUND)
|
|
||||||
|
|
||||||
# show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view
|
if(NOT TARGET SndFile::SndFile)
|
||||||
mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
|
add_library(__SndFile INTERFACE)
|
||||||
|
target_compile_options(__SndFile INTERFACE ${SNDFILE_CFLAGS})
|
||||||
endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
target_include_directories(__SndFile INTERFACE ${SNDFILE_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(__SndFile INTERFACE ${SNDFILE_LIBRARIES})
|
||||||
|
add_library(SndFile::SndFile ALIAS __SndFile)
|
||||||
|
endif()
|
||||||
|
38
cmake/Findmpg123.cmake
Normal file
38
cmake/Findmpg123.cmake
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
# - Find mpg123
|
||||||
|
# Find the native mpg123 includes and library
|
||||||
|
#
|
||||||
|
# mpg123_INCLUDE_DIR - Where to find mpg123.h
|
||||||
|
# mpg123_LIBRARIES - List of libraries when using mpg123.
|
||||||
|
# mpg123_CFLAGS - Compile options to use mpg123
|
||||||
|
# mpg123_FOUND - True if mpg123 found.
|
||||||
|
# MPG123::libmpg123 - Imported library of libmpg123
|
||||||
|
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_search_module(PKG_MPG123 mpg123)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(mpg123_INCLUDE_DIR mpg123.h
|
||||||
|
HINTS ${PKG_MPG123_INCLUDE_DIRS}
|
||||||
|
PATHS "${mpg123_DIR}"
|
||||||
|
PATH_SUFFIXES include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0
|
||||||
|
HINTS ${PKG_MPG123_LIBRARIES}
|
||||||
|
PATHS "${mpg123_DIR}"
|
||||||
|
PATH_SUFFIXES lib
|
||||||
|
)
|
||||||
|
|
||||||
|
set(mpg123_CFLAGS "${PKG_MPG123_CFLAGS_OTHER}" CACHE STRING "CFLAGS of mpg123")
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(mpg123 DEFAULT_MSG mpg123_LIBRARIES mpg123_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(NOT TARGET MPG123::libmpg123)
|
||||||
|
add_library(__libmpg123 INTERFACE)
|
||||||
|
target_compile_options(__libmpg123 INTERFACE ${mpg123_CFLAGS})
|
||||||
|
target_include_directories(__libmpg123 INTERFACE ${mpg123_INCLUDE_DIR})
|
||||||
|
target_link_libraries(__libmpg123 INTERFACE ${mpg123_LIBRARIES})
|
||||||
|
add_library(MPG123::libmpg123 ALIAS __libmpg123)
|
||||||
|
endif()
|
64
cmake/Findopusfile.cmake
Normal file
64
cmake/Findopusfile.cmake
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
# - Try to find opusfile
|
||||||
|
#
|
||||||
|
# Once done this will define
|
||||||
|
#
|
||||||
|
# OPUSFILE_FOUND - system has opusfile
|
||||||
|
# OPUSFILE_INCLUDE_DIRS - the opusfile include directories
|
||||||
|
# OPUSFILE_LIBRARIES - Link these to use opusfile
|
||||||
|
# OPUSFILE_CFLAGS - Compile options to use opusfile
|
||||||
|
# opusfile::opusfile - Imported library of opusfile
|
||||||
|
#
|
||||||
|
|
||||||
|
# FIXME: opusfile does not ship an official opusfile cmake script,
|
||||||
|
# rename this file/variables/target when/if it has.
|
||||||
|
|
||||||
|
find_package(PkgConfig QUIET)
|
||||||
|
if(PKG_CONFIG_FOUND)
|
||||||
|
pkg_search_module(PKG_OPUSFILE "opusfile")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_path(OPUSFILE_INCLUDE_DIR
|
||||||
|
NAMES
|
||||||
|
opusfile.h
|
||||||
|
PATH_SUFFIXES
|
||||||
|
opusfile
|
||||||
|
HINTS
|
||||||
|
${PKG_OPUSFILE_INCLUDE_DIRS}
|
||||||
|
PATHS
|
||||||
|
/usr/include
|
||||||
|
/usr/local/include
|
||||||
|
/opt/local/include
|
||||||
|
/sw/include
|
||||||
|
)
|
||||||
|
|
||||||
|
find_library(OPUSFILE_LIBRARY
|
||||||
|
NAMES
|
||||||
|
opusfile
|
||||||
|
HINTS
|
||||||
|
${PKG_OPUSFILE_LIBRARIES}
|
||||||
|
PATHS
|
||||||
|
/usr/lib
|
||||||
|
/usr/local/lib
|
||||||
|
/opt/local/lib
|
||||||
|
/sw/lib
|
||||||
|
)
|
||||||
|
|
||||||
|
set(OPUSFILE_CFLAGS "${PKG_OPUSFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of opusfile")
|
||||||
|
|
||||||
|
set(OPUSFILE_INCLUDE_DIRS "${OPUSFILE_INCLUDE_DIR}")
|
||||||
|
set(OPUSFILE_LIBRARIES "${OPUSFILE_LIBRARY}")
|
||||||
|
|
||||||
|
if (OPUSFILE_INCLUDE_DIRS AND OPUSFILE_LIBRARIES)
|
||||||
|
set(OPUSFILE_FOUND TRUE)
|
||||||
|
endif (OPUSFILE_INCLUDE_DIRS AND OPUSFILE_LIBRARIES)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
find_package_handle_standard_args(opusfile DEFAULT_MSG OPUSFILE_INCLUDE_DIRS OPUSFILE_LIBRARIES)
|
||||||
|
|
||||||
|
if(NOT TARGET opusfile::opusfile)
|
||||||
|
add_library(__opusfile INTERFACE)
|
||||||
|
target_compile_options(__opusfile INTERFACE ${OPUSFILE_CFLAGS})
|
||||||
|
target_include_directories(__opusfile INTERFACE ${OPUSFILE_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(__opusfile INTERFACE ${OPUSFILE_LIBRARIES})
|
||||||
|
add_library(opusfile::opusfile ALIAS __opusfile)
|
||||||
|
endif()
|
0
codewarrior/Debug/gta3.txt
Normal file
0
codewarrior/Debug/gta3.txt
Normal file
0
codewarrior/Release/gta3.txt
Normal file
0
codewarrior/Release/gta3.txt
Normal file
BIN
codewarrior/re3.mcp
Normal file
BIN
codewarrior/re3.mcp
Normal file
Binary file not shown.
135
conanfile.py
Normal file
135
conanfile.py
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
from conans import ConanFile, CMake, tools
|
||||||
|
from conans.errors import ConanException, ConanInvalidConfiguration
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
|
||||||
|
class Re3Conan(ConanFile):
|
||||||
|
name = "re3"
|
||||||
|
version = "master"
|
||||||
|
license = "???" # FIXME: https://github.com/GTAmodding/re3/issues/794
|
||||||
|
settings = "os", "arch", "compiler", "build_type"
|
||||||
|
generators = "cmake", "cmake_find_package"
|
||||||
|
options = {
|
||||||
|
"audio": ["openal", "miles"],
|
||||||
|
"with_libsndfile": [True, False],
|
||||||
|
"with_opus": [True, False],
|
||||||
|
}
|
||||||
|
default_options = {
|
||||||
|
"audio": "openal",
|
||||||
|
"with_libsndfile": False,
|
||||||
|
"with_opus": False,
|
||||||
|
# "libsndfile:with_external_libs": False,
|
||||||
|
# "mpg123:flexible_resampling": False,
|
||||||
|
# "mpg123:network": False,
|
||||||
|
# "mpg123:icy": False,
|
||||||
|
# "mpg123:id3v2": False,
|
||||||
|
# "mpg123:ieeefloat": False,
|
||||||
|
# "mpg123:layer1": False,
|
||||||
|
# "mpg123:layer2": False,
|
||||||
|
# "mpg123:layer3": False,
|
||||||
|
# "mpg123:moreinfo": False,
|
||||||
|
# "sdl2:vulkan": False,
|
||||||
|
# "sdl2:opengl": True,
|
||||||
|
# "sdl2:sdl2main": True,
|
||||||
|
}
|
||||||
|
no_copy_source = True
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _os_is_playstation2(self):
|
||||||
|
try:
|
||||||
|
return self.settings.os == "Playstation2"
|
||||||
|
except ConanException:
|
||||||
|
return False
|
||||||
|
|
||||||
|
def configure(self):
|
||||||
|
if self.options.audio != "openal":
|
||||||
|
self.options.with_libsndfile = False
|
||||||
|
|
||||||
|
def requirements(self):
|
||||||
|
self.requires("librw/{}".format(self.version))
|
||||||
|
self.requires("mpg123/1.26.4")
|
||||||
|
if self.options.audio == "openal":
|
||||||
|
self.requires("openal/1.21.0")
|
||||||
|
elif self.options.audio == "miles":
|
||||||
|
self.requires("miles-sdk/{}".format(self.version))
|
||||||
|
if self.options.with_libsndfile:
|
||||||
|
self.requires("libsndfile/1.0.30")
|
||||||
|
if self.options.with_opus:
|
||||||
|
self.requires("opusfile/0.12")
|
||||||
|
|
||||||
|
def export_sources(self):
|
||||||
|
for d in ("cmake", "src"):
|
||||||
|
shutil.copytree(src=d, dst=os.path.join(self.export_sources_folder, d))
|
||||||
|
self.copy("CMakeLists.txt")
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
if self.options["librw"].platform == "gl3" and self.options["librw"].gl3_gfxlib != "glfw":
|
||||||
|
raise ConanInvalidConfiguration("Only `glfw` is supported as gl3_gfxlib.")
|
||||||
|
#if not self.options.with_opus:
|
||||||
|
# if not self.options["libsndfile"].with_external_libs:
|
||||||
|
# raise ConanInvalidConfiguration("re3 with opus support requires a libsndfile built with external libs (=ogg/flac/opus/vorbis)")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def _re3_audio(self):
|
||||||
|
return {
|
||||||
|
"miles": "MSS",
|
||||||
|
"openal": "OAL",
|
||||||
|
}[str(self.options.audio)]
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
if self.source_folder == self.build_folder:
|
||||||
|
raise Exception("cannot build with source_folder == build_folder")
|
||||||
|
try:
|
||||||
|
os.unlink(os.path.join(self.install_folder, "Findlibrw.cmake"))
|
||||||
|
tools.save("FindOpenAL.cmake",
|
||||||
|
textwrap.dedent(
|
||||||
|
"""
|
||||||
|
set(OPENAL_FOUND ON)
|
||||||
|
set(OPENAL_INCLUDE_DIR ${OpenAL_INCLUDE_DIRS})
|
||||||
|
set(OPENAL_LIBRARY ${OpenAL_LIBRARIES})
|
||||||
|
set(OPENAL_DEFINITIONS ${OpenAL_DEFINITIONS})
|
||||||
|
"""), append=True)
|
||||||
|
if self.options["librw"].platform == "gl3" and self.options["librw"].gl3_gfxlib == "glfw":
|
||||||
|
tools.save("Findglfw3.cmake",
|
||||||
|
textwrap.dedent(
|
||||||
|
"""
|
||||||
|
if(NOT TARGET glfw)
|
||||||
|
message(STATUS "Creating glfw TARGET")
|
||||||
|
add_library(glfw INTERFACE IMPORTED)
|
||||||
|
set_target_properties(glfw PROPERTIES
|
||||||
|
INTERFACE_LINK_LIBRARIES CONAN_PKG::glfw)
|
||||||
|
endif()
|
||||||
|
"""), append=True)
|
||||||
|
tools.save("CMakeLists.txt",
|
||||||
|
textwrap.dedent(
|
||||||
|
"""
|
||||||
|
cmake_minimum_required(VERSION 3.0)
|
||||||
|
project(cmake_wrapper)
|
||||||
|
|
||||||
|
include("{}/conanbuildinfo.cmake")
|
||||||
|
conan_basic_setup(TARGETS NO_OUTPUT_DIRS)
|
||||||
|
|
||||||
|
add_subdirectory("{}" re3)
|
||||||
|
""").format(self.install_folder.replace("\\", "/"),
|
||||||
|
self.source_folder.replace("\\", "/")))
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
cmake = CMake(self)
|
||||||
|
cmake.definitions["RE3_AUDIO"] = self._re3_audio
|
||||||
|
cmake.definitions["RE3_WITH_OPUS"] = self.options.with_opus
|
||||||
|
cmake.definitions["RE3_INSTALL"] = True
|
||||||
|
cmake.definitions["RE3_VENDORED_LIBRW"] = False
|
||||||
|
env = {}
|
||||||
|
if self._os_is_playstation2:
|
||||||
|
cmake.definitions["CMAKE_TOOLCHAIN_FILE"] = self.deps_user_info["ps2dev-cmaketoolchain"].cmake_toolchain_file
|
||||||
|
env["PS2SDK"] = self.deps_cpp_info["ps2dev-ps2sdk"].rootpath
|
||||||
|
|
||||||
|
with tools.environment_append(env):
|
||||||
|
cmake.configure(source_folder=self.build_folder)
|
||||||
|
cmake.build()
|
||||||
|
|
||||||
|
def package(self):
|
||||||
|
cmake = CMake(self)
|
||||||
|
cmake.install()
|
Binary file not shown.
BIN
premake5.exe
BIN
premake5.exe
Binary file not shown.
25
premake5.lua
25
premake5.lua
@ -34,6 +34,11 @@ newoption {
|
|||||||
description = "Build with opus"
|
description = "Build with opus"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
trigger = "lto",
|
||||||
|
description = "Use link time optimization"
|
||||||
|
}
|
||||||
|
|
||||||
if(_OPTIONS["with-librw"]) then
|
if(_OPTIONS["with-librw"]) then
|
||||||
Librw = "vendor/librw"
|
Librw = "vendor/librw"
|
||||||
else
|
else
|
||||||
@ -61,6 +66,7 @@ end
|
|||||||
workspace "re3"
|
workspace "re3"
|
||||||
language "C++"
|
language "C++"
|
||||||
configurations { "Debug", "Release" }
|
configurations { "Debug", "Release" }
|
||||||
|
startproject "re3"
|
||||||
location "build"
|
location "build"
|
||||||
symbols "Full"
|
symbols "Full"
|
||||||
staticruntime "off"
|
staticruntime "off"
|
||||||
@ -109,7 +115,10 @@ workspace "re3"
|
|||||||
|
|
||||||
filter "configurations:Release"
|
filter "configurations:Release"
|
||||||
defines { "NDEBUG" }
|
defines { "NDEBUG" }
|
||||||
optimize "On"
|
optimize "Speed"
|
||||||
|
if(_OPTIONS["lto"]) then
|
||||||
|
flags { "LinkTimeOptimization" }
|
||||||
|
end
|
||||||
|
|
||||||
filter { "platforms:win*" }
|
filter { "platforms:win*" }
|
||||||
system "windows"
|
system "windows"
|
||||||
@ -125,11 +134,9 @@ workspace "re3"
|
|||||||
|
|
||||||
filter { "platforms:*x86*" }
|
filter { "platforms:*x86*" }
|
||||||
architecture "x86"
|
architecture "x86"
|
||||||
floatingpoint "Fast"
|
|
||||||
|
|
||||||
filter { "platforms:*amd64*" }
|
filter { "platforms:*amd64*" }
|
||||||
architecture "amd64"
|
architecture "amd64"
|
||||||
floatingpoint "Fast"
|
|
||||||
|
|
||||||
filter { "platforms:*arm*" }
|
filter { "platforms:*arm*" }
|
||||||
architecture "ARM"
|
architecture "ARM"
|
||||||
@ -164,11 +171,10 @@ workspace "re3"
|
|||||||
|
|
||||||
filter {}
|
filter {}
|
||||||
|
|
||||||
function setpaths (gamepath, exepath, scriptspath)
|
function setpaths (gamepath, exepath)
|
||||||
scriptspath = scriptspath or ""
|
|
||||||
if (gamepath) then
|
if (gamepath) then
|
||||||
postbuildcommands {
|
postbuildcommands {
|
||||||
'{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"'
|
'{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. '%{cfg.buildtarget.name}"'
|
||||||
}
|
}
|
||||||
debugdir (gamepath)
|
debugdir (gamepath)
|
||||||
if (exepath) then
|
if (exepath) then
|
||||||
@ -178,7 +184,6 @@ workspace "re3"
|
|||||||
debugdir (gamepath .. (dir or ""))
|
debugdir (gamepath .. (dir or ""))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--targetdir ("bin/%{prj.name}/" .. scriptspath)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if(_OPTIONS["with-librw"]) then
|
if(_OPTIONS["with-librw"]) then
|
||||||
@ -191,11 +196,9 @@ project "librw"
|
|||||||
|
|
||||||
filter { "platforms:*x86*" }
|
filter { "platforms:*x86*" }
|
||||||
architecture "x86"
|
architecture "x86"
|
||||||
floatingpoint "Fast"
|
|
||||||
|
|
||||||
filter { "platforms:*amd64*" }
|
filter { "platforms:*amd64*" }
|
||||||
architecture "amd64"
|
architecture "amd64"
|
||||||
floatingpoint "Fast"
|
|
||||||
|
|
||||||
filter "platforms:win*"
|
filter "platforms:win*"
|
||||||
staticruntime "on"
|
staticruntime "on"
|
||||||
@ -302,7 +305,7 @@ project "re3"
|
|||||||
|
|
||||||
filter {}
|
filter {}
|
||||||
if(os.getenv("GTA_III_RE_DIR")) then
|
if(os.getenv("GTA_III_RE_DIR")) then
|
||||||
setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "")
|
setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)")
|
||||||
end
|
end
|
||||||
|
|
||||||
filter "platforms:win*"
|
filter "platforms:win*"
|
||||||
@ -356,7 +359,7 @@ project "re3"
|
|||||||
filter "platforms:*RW33*"
|
filter "platforms:*RW33*"
|
||||||
includedirs { "sdk/rwsdk/include/d3d8" }
|
includedirs { "sdk/rwsdk/include/d3d8" }
|
||||||
libdirs { "sdk/rwsdk/lib/d3d8/release" }
|
libdirs { "sdk/rwsdk/lib/d3d8/release" }
|
||||||
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse" }
|
links { "rwcore", "rpworld", "rpmatfx", "rpskin", "rphanim", "rtbmp", "rtquat", "rtcharse", "rpanisot" }
|
||||||
defines { "RWLIBS" }
|
defines { "RWLIBS" }
|
||||||
linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
|
linkoptions "/SECTION:_rwcseg,ER!W /MERGE:_rwcseg=.text"
|
||||||
|
|
||||||
|
BIN
premake5Linux
BIN
premake5Linux
Binary file not shown.
@ -1,92 +1,120 @@
|
|||||||
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
set(THREADS_PREFER_PTHREAD_FLAG ON)
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
if(${RE3_AUDIO} STREQUAL "OAL")
|
file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
|
||||||
find_package(OpenAL REQUIRED)
|
|
||||||
find_package(MPG123 REQUIRED)
|
|
||||||
find_package(SndFile REQUIRED)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
file(GLOB_RECURSE Sources "*.cpp" "*.h")
|
function(header_directories RETURN_LIST)
|
||||||
|
file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c)
|
||||||
|
set(RELDIRS)
|
||||||
|
foreach(SRC ${ALL_SRCS})
|
||||||
|
file(RELATIVE_PATH RELSRC "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}")
|
||||||
|
get_filename_component(RELDIR "${RELSRC}" DIRECTORY)
|
||||||
|
list(APPEND RELDIRS ${RELDIR})
|
||||||
|
endforeach()
|
||||||
|
list(REMOVE_DUPLICATES RELDIRS)
|
||||||
|
set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE)
|
||||||
|
endfunction()
|
||||||
|
|
||||||
MACRO(HEADER_DIRECTORIES return_list)
|
header_directories(${PROJECT}_INCLUDES)
|
||||||
FILE(GLOB_RECURSE new_list *.cpp)
|
|
||||||
SET(dir_list "animation"
|
|
||||||
"audio"
|
|
||||||
"collision"
|
|
||||||
"control"
|
|
||||||
"core"
|
|
||||||
"entities"
|
|
||||||
"extras"
|
|
||||||
"fakerw"
|
|
||||||
"math"
|
|
||||||
"modelinfo"
|
|
||||||
"objects"
|
|
||||||
"peds"
|
|
||||||
"render"
|
|
||||||
"rw"
|
|
||||||
"save"
|
|
||||||
"skel"
|
|
||||||
"text"
|
|
||||||
"vehicles"
|
|
||||||
"weapons")
|
|
||||||
FOREACH(file_path ${new_list})
|
|
||||||
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
|
|
||||||
SET(dir_list ${dir_list} ${dir_path})
|
|
||||||
ENDFOREACH()
|
|
||||||
LIST(REMOVE_DUPLICATES dir_list)
|
|
||||||
SET(${return_list} ${dir_list})
|
|
||||||
ENDMACRO()
|
|
||||||
|
|
||||||
HEADER_DIRECTORIES(header_list)
|
add_executable(${EXECUTABLE} WIN32
|
||||||
include_directories(${header_list})
|
${${PROJECT}_SOURCES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||||
|
librw::librw
|
||||||
|
Threads::Threads
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(re3 ${Sources})
|
target_include_directories(${EXECUTABLE}
|
||||||
target_link_libraries(re3 librw)
|
|
||||||
target_link_libraries(re3 Threads::Threads)
|
|
||||||
|
|
||||||
if(${RE3_AUDIO} STREQUAL "OAL")
|
|
||||||
target_link_libraries(re3 ${OPENAL_LIBRARY})
|
|
||||||
target_link_libraries(re3 ${MPG123_LIBRARIES})
|
|
||||||
target_link_libraries(re3 ${SNDFILE_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(re3
|
|
||||||
INTERFACE
|
|
||||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_definitions(re3
|
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||||
PUBLIC
|
$<BUILD_INTERFACE:${${PROJECT}_INCLUDES}>
|
||||||
"RW_${RE3_PLATFORM}"
|
)
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_definitions(re3 PRIVATE LIBRW=1 AUDIO_OAL=1)
|
target_compile_definitions(${EXECUTABLE}
|
||||||
|
PRIVATE
|
||||||
|
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
|
||||||
|
LIBRW
|
||||||
|
${PROJECT}_NO_AUTOLINK
|
||||||
|
)
|
||||||
|
|
||||||
|
if(LIBRW_PLATFORM_D3D9)
|
||||||
|
target_compile_definitions(${EXECUTABLE}
|
||||||
|
PUBLIC
|
||||||
|
USE_D3D9
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${PROJECT}_AUDIO STREQUAL "OAL")
|
||||||
|
find_package(OpenAL REQUIRED)
|
||||||
|
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
|
||||||
|
target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
|
||||||
|
elseif(${PROJECT}_AUDIO STREQUAL "MSS")
|
||||||
|
find_package(MilesSDK REQUIRED)
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_MSS)
|
||||||
|
target_link_libraries(${EXECUTABLE} PRIVATE MilesSDK::MilesSDK)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
find_package(mpg123 REQUIRED)
|
||||||
|
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||||
|
MPG123::libmpg123
|
||||||
|
)
|
||||||
|
if(${PROJECT}_WITH_OPUS)
|
||||||
|
find_package(opusfile REQUIRED)
|
||||||
|
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||||
|
opusfile::opusfile
|
||||||
|
)
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OPUS)
|
||||||
|
endif()
|
||||||
|
if(${PROJECT}_WITH_LIBSNDFILE)
|
||||||
|
find_package(SndFile REQUIRED)
|
||||||
|
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||||
|
SndFile::SndFile
|
||||||
|
)
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL_USE_SNDFILE)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_compile_definitions(${EXECUTABLE} PRIVATE )
|
||||||
|
|
||||||
|
option(${PROJECT}_WITH_SANITIZERS "Use UB sanitizers (better crash log)" OFF)
|
||||||
|
option(${PROJECT}_WITH_ASAN "Use Address sanitizer (better crash log)" OFF)
|
||||||
|
|
||||||
|
if(${PROJECT}_WITH_SANITIZERS)
|
||||||
|
target_compile_options(${EXECUTABLE} PUBLIC
|
||||||
|
-fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability
|
||||||
|
-g3 -fno-omit-frame-pointer)
|
||||||
|
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=undefined,float-divide-by-zero,integer,implicit-conversion,implicit-integer-truncation,implicit-integer-arithmetic-value-change,local-bounds,nullability)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${PROJECT}_WITH_ASAN)
|
||||||
|
target_compile_options(${EXECUTABLE} PUBLIC -fsanitize=address -g3 -fno-omit-frame-pointer)
|
||||||
|
target_link_options(${EXECUTABLE} PUBLIC -fsanitize=address)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
||||||
target_compile_options(re3
|
target_compile_options(${EXECUTABLE}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"-Wall"
|
"-Wall"
|
||||||
)
|
)
|
||||||
if (NOT RE3_PLATFORM_PS2)
|
if (NOT LIBRW_PLATFORM_PS2)
|
||||||
target_compile_options(re3
|
target_compile_options(${EXECUTABLE}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"-Wextra"
|
-Wextra
|
||||||
"-Wdouble-promotion"
|
-Wdouble-promotion
|
||||||
"-Wpedantic"
|
-Wpedantic
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
target_compile_options(re3
|
target_compile_options(${EXECUTABLE}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
/wd4996 /wd4244
|
/Zc:sizedDealloc-
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set_target_properties(re3
|
set_target_properties(${EXECUTABLE}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
C_STANDARD 11
|
C_STANDARD 11
|
||||||
C_EXTENSIONS OFF
|
C_EXTENSIONS OFF
|
||||||
@ -94,20 +122,15 @@ set_target_properties(re3
|
|||||||
CXX_STANDARD 11
|
CXX_STANDARD 11
|
||||||
CXX_EXTENSIONS OFF
|
CXX_EXTENSIONS OFF
|
||||||
CXX_STANDARD_REQUIRED ON
|
CXX_STANDARD_REQUIRED ON
|
||||||
PREFIX ""
|
)
|
||||||
)
|
|
||||||
|
|
||||||
if(RE3_INSTALL)
|
|
||||||
target_include_directories(re3
|
|
||||||
INTERFACE
|
|
||||||
$<INSTALL_INTERFACE:${RE3_INSTALL_INCLUDEDIR}>
|
|
||||||
)
|
|
||||||
|
|
||||||
|
if(${PROJECT}_INSTALL)
|
||||||
install(
|
install(
|
||||||
TARGETS re3
|
TARGETS ${EXECUTABLE}
|
||||||
EXPORT re3-targets
|
EXPORT ${EXECUTABLE}-targets
|
||||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
RUNTIME DESTINATION "."
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
)
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
if(MSVC)
|
||||||
)
|
install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#if defined _WIN32 && !defined __MINGW32__
|
#if defined _WIN32 && !defined __MINGW32__
|
||||||
|
#if defined __MWERKS__
|
||||||
|
#include <wctype.h>
|
||||||
|
#else
|
||||||
#include "ctype.h"
|
#include "ctype.h"
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#include <cwctype>
|
#include <cwctype>
|
||||||
#endif
|
#endif
|
||||||
@ -83,18 +87,18 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
|
|||||||
if(c1) s1++;
|
if(c1) s1++;
|
||||||
if(c2) s2++;
|
if(c2) s2++;
|
||||||
if(c1 == '\0' && c2 == '\0') return true;
|
if(c1 == '\0' && c2 == '\0') return true;
|
||||||
#if defined _WIN32 && !defined __MINGW32__
|
#ifndef ASCII_STRCMP
|
||||||
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
|
|
||||||
#else
|
|
||||||
if(iswdigit(c1) && iswdigit(c2))
|
if(iswdigit(c1) && iswdigit(c2))
|
||||||
|
#else
|
||||||
|
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
|
||||||
#endif
|
#endif
|
||||||
continue;
|
continue;
|
||||||
#if defined _WIN32 && !defined __MINGW32__
|
#ifndef ASCII_STRCMP
|
||||||
c1 = __ascii_toupper(c1);
|
|
||||||
c2 = __ascii_toupper(c2);
|
|
||||||
#else
|
|
||||||
c1 = toupper(c1);
|
c1 = toupper(c1);
|
||||||
c2 = toupper(c2);
|
c2 = toupper(c2);
|
||||||
|
#else
|
||||||
|
c1 = __ascii_toupper(c1);
|
||||||
|
c2 = __ascii_toupper(c2);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(c1 != c2)
|
if(c1 != c2)
|
||||||
@ -111,7 +115,7 @@ GetModelFromName(const char *name)
|
|||||||
for(i = 0; i < MODELINFOSIZE; i++){
|
for(i = 0; i < MODELINFOSIZE; i++){
|
||||||
mi = CModelInfo::GetModelInfo(i);
|
mi = CModelInfo::GetModelInfo(i);
|
||||||
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
|
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
|
||||||
strcmpIgnoringDigits(mi->GetName(), name))
|
strcmpIgnoringDigits(mi->GetModelName(), name))
|
||||||
return mi;
|
return mi;
|
||||||
}
|
}
|
||||||
return nil;
|
return nil;
|
||||||
@ -134,7 +138,7 @@ CAnimBlendAssocGroup::CreateAssociations(const char *name)
|
|||||||
CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i);
|
CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i);
|
||||||
CBaseModelInfo *model = GetModelFromName(anim->name);
|
CBaseModelInfo *model = GetModelFromName(anim->name);
|
||||||
assert(model);
|
assert(model);
|
||||||
printf("Associated anim %s with model %s\n", anim->name, model->GetName());
|
printf("Associated anim %s with model %s\n", anim->name, model->GetModelName());
|
||||||
RpClump *clump = (RpClump*)model->CreateInstance();
|
RpClump *clump = (RpClump*)model->CreateInstance();
|
||||||
#ifdef PED_SKIN
|
#ifdef PED_SKIN
|
||||||
if(IsClumpSkinned(clump))
|
if(IsClumpSkinned(clump))
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
CAnimBlendClumpData::CAnimBlendClumpData(void)
|
CAnimBlendClumpData::CAnimBlendClumpData(void)
|
||||||
{
|
{
|
||||||
numFrames = 0;
|
numFrames = 0;
|
||||||
velocity = nil;
|
velocity2d = nil;
|
||||||
frames = nil;
|
frames = nil;
|
||||||
link.Init();
|
link.Init();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#include "AnimBlendList.h"
|
#include "AnimBlendList.h"
|
||||||
|
|
||||||
|
|
||||||
// TODO: put somewhere else
|
|
||||||
struct AnimBlendFrameData
|
struct AnimBlendFrameData
|
||||||
{
|
{
|
||||||
enum {
|
enum {
|
||||||
@ -38,7 +37,10 @@ public:
|
|||||||
#ifdef PED_SKIN
|
#ifdef PED_SKIN
|
||||||
int32 modelNumber; // doesn't seem to be used
|
int32 modelNumber; // doesn't seem to be used
|
||||||
#endif
|
#endif
|
||||||
CVector *velocity;
|
union {
|
||||||
|
CVector2D *velocity2d;
|
||||||
|
CVector *velocity3d;
|
||||||
|
};
|
||||||
// order of frames is determined by RW hierarchy
|
// order of frames is determined by RW hierarchy
|
||||||
AnimBlendFrameData *frames;
|
AnimBlendFrameData *frames;
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
|
|||||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||||
|
|
||||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
|
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
|
||||||
gpAnimBlendClump->velocity){
|
gpAnimBlendClump->velocity2d){
|
||||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
|
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
|
||||||
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
|
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
|
||||||
else
|
else
|
||||||
@ -138,11 +138,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||||
gpAnimBlendClump->velocity->x = transx - curx;
|
gpAnimBlendClump->velocity2d->x = transx - curx;
|
||||||
gpAnimBlendClump->velocity->y = transy - cury;
|
gpAnimBlendClump->velocity2d->y = transy - cury;
|
||||||
if(looped){
|
if(looped){
|
||||||
gpAnimBlendClump->velocity->x += endx;
|
gpAnimBlendClump->velocity2d->x += endx;
|
||||||
gpAnimBlendClump->velocity->y += endy;
|
gpAnimBlendClump->velocity2d->y += endy;
|
||||||
}
|
}
|
||||||
mat->pos.x = pos.x - transx;
|
mat->pos.x = pos.x - transx;
|
||||||
mat->pos.y = pos.y - transy;
|
mat->pos.y = pos.y - transy;
|
||||||
@ -218,9 +218,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||||
*gpAnimBlendClump->velocity = trans - cur;
|
*gpAnimBlendClump->velocity3d = trans - cur;
|
||||||
if(looped)
|
if(looped)
|
||||||
*gpAnimBlendClump->velocity += end;
|
*gpAnimBlendClump->velocity3d += end;
|
||||||
mat->pos.x = (pos - trans).x + frame->resetPos.x;
|
mat->pos.x = (pos - trans).x + frame->resetPos.x;
|
||||||
mat->pos.y = (pos - trans).y + frame->resetPos.y;
|
mat->pos.y = (pos - trans).y + frame->resetPos.y;
|
||||||
mat->pos.z = (pos - trans).z + frame->resetPos.z;
|
mat->pos.z = (pos - trans).z + frame->resetPos.z;
|
||||||
@ -241,7 +241,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
|
|||||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||||
|
|
||||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
|
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
|
||||||
gpAnimBlendClump->velocity){
|
gpAnimBlendClump->velocity2d){
|
||||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
|
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
|
||||||
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
|
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
|
||||||
else
|
else
|
||||||
@ -353,11 +353,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||||
gpAnimBlendClump->velocity->x = transx - curx;
|
gpAnimBlendClump->velocity2d->x = transx - curx;
|
||||||
gpAnimBlendClump->velocity->y = transy - cury;
|
gpAnimBlendClump->velocity2d->y = transy - cury;
|
||||||
if(looped){
|
if(looped){
|
||||||
gpAnimBlendClump->velocity->x += endx;
|
gpAnimBlendClump->velocity2d->x += endx;
|
||||||
gpAnimBlendClump->velocity->y += endy;
|
gpAnimBlendClump->velocity2d->y += endy;
|
||||||
}
|
}
|
||||||
xform->t.x = pos.x - transx;
|
xform->t.x = pos.x - transx;
|
||||||
xform->t.y = pos.y - transy;
|
xform->t.y = pos.y - transy;
|
||||||
@ -433,9 +433,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||||
*gpAnimBlendClump->velocity = trans - cur;
|
*gpAnimBlendClump->velocity3d = trans - cur;
|
||||||
if(looped)
|
if(looped)
|
||||||
*gpAnimBlendClump->velocity += end;
|
*gpAnimBlendClump->velocity3d += end;
|
||||||
xform->t.x = (pos - trans).x + frame->resetPos.x;
|
xform->t.x = (pos - trans).x + frame->resetPos.x;
|
||||||
xform->t.y = (pos - trans).y + frame->resetPos.y;
|
xform->t.y = (pos - trans).y + frame->resetPos.y;
|
||||||
xform->t.z = (pos - trans).z + frame->resetPos.z;
|
xform->t.z = (pos - trans).z + frame->resetPos.z;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "AudioManager.h"
|
#include "AudioManager.h"
|
||||||
#include "audio_enums.h"
|
#include "audio_enums.h"
|
||||||
@ -38,7 +38,7 @@
|
|||||||
#include "ZoneCull.h"
|
#include "ZoneCull.h"
|
||||||
#include "sampman.h"
|
#include "sampman.h"
|
||||||
|
|
||||||
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
|
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
|
||||||
const int policeChannel = channels + 1;
|
const int policeChannel = channels + 1;
|
||||||
const int allChannels = channels + 2;
|
const int allChannels = channels + 2;
|
||||||
|
|
||||||
@ -3038,109 +3038,109 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms)
|
|||||||
switch (sound) {
|
switch (sound) {
|
||||||
case SOUND_STEP_START:
|
case SOUND_STEP_START:
|
||||||
case SOUND_STEP_END:
|
case SOUND_STEP_END:
|
||||||
if (!params.m_pPed->bIsLooking) {
|
if (params.m_pPed->bIsInTheAir)
|
||||||
emittingVol = m_anRandomTable[3] % 15 + 45;
|
continue;
|
||||||
if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
|
emittingVol = m_anRandomTable[3] % 15 + 45;
|
||||||
emittingVol /= 2;
|
if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
|
||||||
maxDist = 400.f;
|
emittingVol /= 2;
|
||||||
switch (params.m_pPed->m_nSurfaceTouched) {
|
maxDist = 400.f;
|
||||||
case SURFACE_GRASS:
|
switch (params.m_pPed->m_nSurfaceTouched) {
|
||||||
sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
|
case SURFACE_GRASS:
|
||||||
break;
|
sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
|
||||||
case SURFACE_GRAVEL:
|
break;
|
||||||
case SURFACE_MUD_DRY:
|
case SURFACE_GRAVEL:
|
||||||
sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
|
case SURFACE_MUD_DRY:
|
||||||
break;
|
sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
|
||||||
case SURFACE_CAR:
|
break;
|
||||||
case SURFACE_GARAGE_DOOR:
|
case SURFACE_CAR:
|
||||||
case SURFACE_CAR_PANEL:
|
case SURFACE_GARAGE_DOOR:
|
||||||
case SURFACE_THICK_METAL_PLATE:
|
case SURFACE_CAR_PANEL:
|
||||||
case SURFACE_SCAFFOLD_POLE:
|
case SURFACE_THICK_METAL_PLATE:
|
||||||
case SURFACE_LAMP_POST:
|
case SURFACE_SCAFFOLD_POLE:
|
||||||
case SURFACE_FIRE_HYDRANT:
|
case SURFACE_LAMP_POST:
|
||||||
case SURFACE_GIRDER:
|
case SURFACE_FIRE_HYDRANT:
|
||||||
case SURFACE_METAL_CHAIN_FENCE:
|
case SURFACE_GIRDER:
|
||||||
case SURFACE_CONTAINER:
|
case SURFACE_METAL_CHAIN_FENCE:
|
||||||
case SURFACE_NEWS_VENDOR:
|
case SURFACE_CONTAINER:
|
||||||
sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
|
case SURFACE_NEWS_VENDOR:
|
||||||
break;
|
sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
|
||||||
case SURFACE_SAND:
|
break;
|
||||||
sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
|
case SURFACE_SAND:
|
||||||
break;
|
sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
|
||||||
case SURFACE_WATER:
|
break;
|
||||||
sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
|
case SURFACE_WATER:
|
||||||
break;
|
sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
|
||||||
case SURFACE_WOOD_CRATES:
|
break;
|
||||||
case SURFACE_WOOD_BENCH:
|
case SURFACE_WOOD_CRATES:
|
||||||
case SURFACE_WOOD_SOLID:
|
case SURFACE_WOOD_BENCH:
|
||||||
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
|
case SURFACE_WOOD_SOLID:
|
||||||
break;
|
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
|
||||||
case SURFACE_HEDGE:
|
break;
|
||||||
sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
|
case SURFACE_HEDGE:
|
||||||
break;
|
sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
|
||||||
default:
|
break;
|
||||||
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
|
default:
|
||||||
break;
|
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_CONCRETE_1;
|
||||||
}
|
break;
|
||||||
m_sQueueSample.m_nSampleIndex = sampleIndex;
|
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
|
||||||
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - 28;
|
|
||||||
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
|
|
||||||
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
|
|
||||||
switch (params.m_pPed->m_nMoveState) {
|
|
||||||
case PEDMOVE_WALK:
|
|
||||||
emittingVol /= 4;
|
|
||||||
m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
|
|
||||||
break;
|
|
||||||
case PEDMOVE_RUN:
|
|
||||||
emittingVol /= 2;
|
|
||||||
m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
|
|
||||||
break;
|
|
||||||
case PEDMOVE_SPRINT:
|
|
||||||
m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 5;
|
|
||||||
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
|
|
||||||
m_sQueueSample.m_fSoundIntensity = 20.0f;
|
|
||||||
m_sQueueSample.m_nLoopCount = 1;
|
|
||||||
m_sQueueSample.m_nLoopStart = 0;
|
|
||||||
m_sQueueSample.m_nLoopEnd = -1;
|
|
||||||
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
|
||||||
m_sQueueSample.m_bIs2D = false;
|
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = true;
|
|
||||||
m_sQueueSample.m_bRequireReflection = true;
|
|
||||||
}
|
}
|
||||||
|
m_sQueueSample.m_nSampleIndex = sampleIndex;
|
||||||
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
|
m_sQueueSample.m_nCounter = m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_awAudioEvent[i] - SOUND_STEP_START + 1;
|
||||||
|
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
|
||||||
|
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
|
||||||
|
switch (params.m_pPed->m_nMoveState) {
|
||||||
|
case PEDMOVE_WALK:
|
||||||
|
emittingVol /= 4;
|
||||||
|
m_sQueueSample.m_nFrequency = 9 * m_sQueueSample.m_nFrequency / 10;
|
||||||
|
break;
|
||||||
|
case PEDMOVE_RUN:
|
||||||
|
emittingVol /= 2;
|
||||||
|
m_sQueueSample.m_nFrequency = 11 * m_sQueueSample.m_nFrequency / 10;
|
||||||
|
break;
|
||||||
|
case PEDMOVE_SPRINT:
|
||||||
|
m_sQueueSample.m_nFrequency = 12 * m_sQueueSample.m_nFrequency / 10;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_sQueueSample.m_nReleasingVolumeModificator = 5;
|
||||||
|
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
|
||||||
|
m_sQueueSample.m_fSoundIntensity = 20.0f;
|
||||||
|
m_sQueueSample.m_nLoopCount = 1;
|
||||||
|
m_sQueueSample.m_nLoopStart = 0;
|
||||||
|
m_sQueueSample.m_nLoopEnd = -1;
|
||||||
|
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
||||||
|
m_sQueueSample.m_bIs2D = false;
|
||||||
|
m_sQueueSample.m_bReleasingSoundFlag = true;
|
||||||
|
m_sQueueSample.m_bRequireReflection = true;
|
||||||
break;
|
break;
|
||||||
case SOUND_FALL_LAND:
|
case SOUND_FALL_LAND:
|
||||||
case SOUND_FALL_COLLAPSE:
|
case SOUND_FALL_COLLAPSE:
|
||||||
if (!ped->bIsLooking) {
|
if (ped->bIsInTheAir)
|
||||||
maxDist = SQR(30);
|
continue;
|
||||||
emittingVol = m_anRandomTable[3] % 20 + 80;
|
maxDist = SQR(30);
|
||||||
if (ped->m_nSurfaceTouched == SURFACE_WATER) {
|
emittingVol = m_anRandomTable[3] % 20 + 80;
|
||||||
m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
|
if (ped->m_nSurfaceTouched == SURFACE_WATER) {
|
||||||
} else if (sound == SOUND_FALL_LAND) {
|
m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND;
|
} else if (sound == SOUND_FALL_LAND) {
|
||||||
} else {
|
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND;
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL;
|
} else {
|
||||||
}
|
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND_AND_FALL;
|
||||||
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
|
||||||
m_sQueueSample.m_nCounter = 1;
|
|
||||||
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
|
|
||||||
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
|
|
||||||
m_sQueueSample.m_nReleasingVolumeModificator = 2;
|
|
||||||
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
|
|
||||||
m_sQueueSample.m_fSoundIntensity = 30.0f;
|
|
||||||
m_sQueueSample.m_nLoopCount = 1;
|
|
||||||
m_sQueueSample.m_nLoopStart = 0;
|
|
||||||
m_sQueueSample.m_nLoopEnd = -1;
|
|
||||||
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
|
||||||
m_sQueueSample.m_bIs2D = false;
|
|
||||||
m_sQueueSample.m_bReleasingSoundFlag = true;
|
|
||||||
m_sQueueSample.m_bRequireReflection = true;
|
|
||||||
}
|
}
|
||||||
|
m_sQueueSample.m_nBankIndex = SFX_BANK_0;
|
||||||
|
m_sQueueSample.m_nCounter = 1;
|
||||||
|
m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
|
||||||
|
m_sQueueSample.m_nFrequency += RandomDisplacement(m_sQueueSample.m_nFrequency / 17);
|
||||||
|
m_sQueueSample.m_nReleasingVolumeModificator = 2;
|
||||||
|
m_sQueueSample.m_fSpeedMultiplier = 0.0f;
|
||||||
|
m_sQueueSample.m_fSoundIntensity = 30.0f;
|
||||||
|
m_sQueueSample.m_nLoopCount = 1;
|
||||||
|
m_sQueueSample.m_nLoopStart = 0;
|
||||||
|
m_sQueueSample.m_nLoopEnd = -1;
|
||||||
|
m_sQueueSample.m_nEmittingVolume = emittingVol;
|
||||||
|
m_sQueueSample.m_bIs2D = false;
|
||||||
|
m_sQueueSample.m_bReleasingSoundFlag = true;
|
||||||
|
m_sQueueSample.m_bRequireReflection = true;
|
||||||
break;
|
break;
|
||||||
case SOUND_FIGHT_PUNCH_33:
|
case SOUND_FIGHT_PUNCH_33:
|
||||||
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
|
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
|
||||||
@ -5788,7 +5788,7 @@ cAudioManager::GetCasualMaleOldTalkSfx(int16 sound)
|
|||||||
uint32
|
uint32
|
||||||
cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
|
cAudioManager::GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound)
|
||||||
{
|
{
|
||||||
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetName();
|
char *modelName = CModelInfo::GetModelInfo(modelIndex)->GetModelName();
|
||||||
if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) {
|
if (!CGeneral::faststricmp(modelName, "eight") || !CGeneral::faststricmp(modelName, "eight2")) {
|
||||||
return GetEightTalkSfx(sound);
|
return GetEightTalkSfx(sound);
|
||||||
}
|
}
|
||||||
|
@ -13,16 +13,19 @@
|
|||||||
|
|
||||||
cAudioManager AudioManager;
|
cAudioManager AudioManager;
|
||||||
|
|
||||||
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
|
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
|
||||||
const int policeChannel = channels + 1;
|
const int policeChannel = channels + 1;
|
||||||
const int allChannels = channels + 2;
|
const int allChannels = channels + 2;
|
||||||
|
|
||||||
|
#define SPEED_OF_SOUND 343.f
|
||||||
|
#define TIME_SPENT 50
|
||||||
|
|
||||||
cAudioManager::cAudioManager()
|
cAudioManager::cAudioManager()
|
||||||
{
|
{
|
||||||
m_bIsInitialised = false;
|
m_bIsInitialised = false;
|
||||||
field_1 = 1;
|
m_bReverb = true;
|
||||||
m_fSpeedOfSound = 6.86f;
|
m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT;
|
||||||
m_nTimeSpent = 50;
|
m_nTimeSpent = TIME_SPENT;
|
||||||
m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
|
m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
|
||||||
m_nActiveSampleQueue = 1;
|
m_nActiveSampleQueue = 1;
|
||||||
ClearRequestedQueue();
|
ClearRequestedQueue();
|
||||||
@ -945,7 +948,7 @@ cAudioManager::ClearActiveSamples()
|
|||||||
m_asActiveSamples[i].m_nCalculatedVolume = 0;
|
m_asActiveSamples[i].m_nCalculatedVolume = 0;
|
||||||
m_asActiveSamples[i].m_nReleasingVolumeDivider = 0;
|
m_asActiveSamples[i].m_nReleasingVolumeDivider = 0;
|
||||||
m_asActiveSamples[i].m_nVolumeChange = -1;
|
m_asActiveSamples[i].m_nVolumeChange = -1;
|
||||||
m_asActiveSamples[i].m_vecPos = {0.0f, 0.0f, 0.0f};
|
m_asActiveSamples[i].m_vecPos = CVector(0.0f, 0.0f, 0.0f);
|
||||||
m_asActiveSamples[i].m_bReverbFlag = false;
|
m_asActiveSamples[i].m_bReverbFlag = false;
|
||||||
m_asActiveSamples[i].m_nLoopsRemaining = 0;
|
m_asActiveSamples[i].m_nLoopsRemaining = 0;
|
||||||
m_asActiveSamples[i].m_bRequireReflection = false;
|
m_asActiveSamples[i].m_bRequireReflection = false;
|
||||||
|
@ -185,7 +185,7 @@ class cAudioManager
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool m_bIsInitialised;
|
bool m_bIsInitialised;
|
||||||
uint8 field_1; // unused
|
bool m_bReverb; // unused
|
||||||
bool m_bFifthFrameFlag;
|
bool m_bFifthFrameFlag;
|
||||||
uint8 m_nActiveSamples;
|
uint8 m_nActiveSamples;
|
||||||
uint8 field_4; // unused
|
uint8 field_4; // unused
|
||||||
|
@ -13,8 +13,9 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "sampman.h"
|
#include "sampman.h"
|
||||||
|
#include "Wanted.h"
|
||||||
|
|
||||||
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
|
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
|
||||||
const int policeChannel = channels + 1;
|
const int policeChannel = channels + 1;
|
||||||
|
|
||||||
struct tPoliceRadioZone {
|
struct tPoliceRadioZone {
|
||||||
@ -160,7 +161,7 @@ cAudioManager::ServicePoliceRadio()
|
|||||||
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
|
wantedLevel = FindPlayerPed()->m_pWanted->GetWantedLevel();
|
||||||
if(!crimeReport) {
|
if(!crimeReport) {
|
||||||
if(wantedLevel != 0) {
|
if(wantedLevel != 0) {
|
||||||
if(nLastSeen != 0) {
|
if(nLastSeen != 0) {
|
||||||
@ -678,7 +679,7 @@ void
|
|||||||
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
||||||
{
|
{
|
||||||
int32 lastCrime = ARRAY_SIZE(m_sPoliceRadioQueue.crimes);
|
int32 lastCrime = ARRAY_SIZE(m_sPoliceRadioQueue.crimes);
|
||||||
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 &&
|
if (m_bIsInitialised && MusicManager.m_nMusicMode != MUSICMODE_CUTSCENE && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 &&
|
||||||
(type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) {
|
(type > CRIME_NONE || type < NUM_CRIME_TYPES) && m_FrameCounter >= gMinTimeToNextReport[type]) {
|
||||||
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
||||||
if (m_sPoliceRadioQueue.crimes[i].type) {
|
if (m_sPoliceRadioQueue.crimes[i].type) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Wanted.h"
|
#include "Crime.h"
|
||||||
|
|
||||||
struct cAMCrime {
|
struct cAMCrime {
|
||||||
int32 type;
|
int32 type;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
|||||||
#ifdef AUDIO_OAL
|
#ifdef AUDIO_OAL
|
||||||
#include <AL/al.h>
|
#include <AL/al.h>
|
||||||
|
|
||||||
#define NUM_STREAMBUFFERS 4
|
#define NUM_STREAMBUFFERS 8
|
||||||
|
|
||||||
class IDecoder
|
class IDecoder
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ public:
|
|||||||
class CStream
|
class CStream
|
||||||
{
|
{
|
||||||
char m_aFilename[128];
|
char m_aFilename[128];
|
||||||
ALuint &m_alSource;
|
ALuint *m_pAlSources;
|
||||||
ALuint (&m_alBuffers)[NUM_STREAMBUFFERS];
|
ALuint (&m_alBuffers)[NUM_STREAMBUFFERS];
|
||||||
|
|
||||||
bool m_bPaused;
|
bool m_bPaused;
|
||||||
@ -73,20 +73,20 @@ class CStream
|
|||||||
IDecoder *m_pSoundFile;
|
IDecoder *m_pSoundFile;
|
||||||
|
|
||||||
bool HasSource();
|
bool HasSource();
|
||||||
void SetPosition(float x, float y, float z);
|
void SetPosition(int i, float x, float y, float z);
|
||||||
void SetPitch(float pitch);
|
void SetPitch(float pitch);
|
||||||
void SetGain(float gain);
|
void SetGain(float gain);
|
||||||
void Pause();
|
void Pause();
|
||||||
void SetPlay(bool state);
|
void SetPlay(bool state);
|
||||||
|
|
||||||
bool FillBuffer(ALuint alBuffer);
|
bool FillBuffer(ALuint *alBuffer);
|
||||||
int32 FillBuffers();
|
int32 FillBuffers();
|
||||||
void ClearBuffers();
|
void ClearBuffers();
|
||||||
public:
|
public:
|
||||||
static void Initialise();
|
static void Initialise();
|
||||||
static void Terminate();
|
static void Terminate();
|
||||||
|
|
||||||
CStream(char *filename, ALuint &source, ALuint (&buffers)[NUM_STREAMBUFFERS]);
|
CStream(char *filename, ALuint *sources, ALuint (&buffers)[NUM_STREAMBUFFERS], uint32 overrideSampleRate = 32000);
|
||||||
~CStream();
|
~CStream();
|
||||||
void Delete();
|
void Delete();
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "common.h"
|
|
||||||
#include "AudioSamples.h"
|
#include "AudioSamples.h"
|
||||||
|
|
||||||
#define MAX_VOLUME 127
|
#define MAX_VOLUME 127
|
||||||
@ -222,7 +221,7 @@ extern uint32 BankStartOffset[MAX_SFX_BANKS];
|
|||||||
extern int defaultProvider;
|
extern int defaultProvider;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef AUDIO_OPUS
|
#if defined(OPUS_AUDIO_PATHS)
|
||||||
static char StreamedNameTable[][25] = {
|
static char StreamedNameTable[][25] = {
|
||||||
"AUDIO\\HEAD.OPUS", "AUDIO\\CLASS.OPUS", "AUDIO\\KJAH.OPUS", "AUDIO\\RISE.OPUS", "AUDIO\\LIPS.OPUS", "AUDIO\\GAME.OPUS",
|
"AUDIO\\HEAD.OPUS", "AUDIO\\CLASS.OPUS", "AUDIO\\KJAH.OPUS", "AUDIO\\RISE.OPUS", "AUDIO\\LIPS.OPUS", "AUDIO\\GAME.OPUS",
|
||||||
"AUDIO\\MSX.OPUS", "AUDIO\\FLASH.OPUS", "AUDIO\\CHAT.OPUS", "AUDIO\\HEAD.OPUS", "AUDIO\\POLICE.OPUS", "AUDIO\\CITY.OPUS",
|
"AUDIO\\MSX.OPUS", "AUDIO\\FLASH.OPUS", "AUDIO\\CHAT.OPUS", "AUDIO\\HEAD.OPUS", "AUDIO\\POLICE.OPUS", "AUDIO\\CITY.OPUS",
|
||||||
@ -258,9 +257,9 @@ static char StreamedNameTable[][25] = {
|
|||||||
"AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS",
|
"AUDIO\\door_2.OPUS", "AUDIO\\door_3.OPUS", "AUDIO\\door_4.OPUS", "AUDIO\\door_5.OPUS", "AUDIO\\door_6.OPUS", "AUDIO\\t3_a.OPUS",
|
||||||
"AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"};
|
"AUDIO\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"};
|
||||||
#else
|
#else
|
||||||
|
#if defined(PS2_AUDIO_PATHS)
|
||||||
static char StreamedNameTable[][25]=
|
static char StreamedNameTable[][25]=
|
||||||
{
|
{
|
||||||
#ifdef PS2_AUDIO
|
|
||||||
"AUDIO\\MUSIC\\HEAD.VB",
|
"AUDIO\\MUSIC\\HEAD.VB",
|
||||||
"AUDIO\\MUSIC\\CLASS.VB",
|
"AUDIO\\MUSIC\\CLASS.VB",
|
||||||
"AUDIO\\MUSIC\\KJAH.VB",
|
"AUDIO\\MUSIC\\KJAH.VB",
|
||||||
@ -357,6 +356,8 @@ static char StreamedNameTable[][25]=
|
|||||||
"AUDIO\\MUSIC\\MISCOM.VB",
|
"AUDIO\\MUSIC\\MISCOM.VB",
|
||||||
"AUDIO\\MUSIC\\END.VB",
|
"AUDIO\\MUSIC\\END.VB",
|
||||||
#else
|
#else
|
||||||
|
static char StreamedNameTable[][25] =
|
||||||
|
{
|
||||||
"AUDIO\\HEAD.WAV",
|
"AUDIO\\HEAD.WAV",
|
||||||
"AUDIO\\CLASS.WAV",
|
"AUDIO\\CLASS.WAV",
|
||||||
"AUDIO\\KJAH.WAV",
|
"AUDIO\\KJAH.WAV",
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#ifdef AUDIO_MSS
|
#ifdef AUDIO_MSS
|
||||||
#include <windows.h>
|
#include <shlobj.h>
|
||||||
#include <shobjidl.h>
|
|
||||||
#include <shlguid.h>
|
#include <shlguid.h>
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
@ -1,17 +1,11 @@
|
|||||||
//#define JUICY_OAL
|
//#define JUICY_OAL
|
||||||
|
|
||||||
#ifdef AUDIO_OAL
|
#ifdef AUDIO_OAL
|
||||||
#include "sampman.h"
|
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "eax.h"
|
#include "eax.h"
|
||||||
#include "eax-util.h"
|
#include "eax-util.h"
|
||||||
|
|
||||||
#define WITHWINDOWS
|
|
||||||
#include "common.h"
|
|
||||||
#include "crossplatform.h"
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <io.h>
|
#include <io.h>
|
||||||
#include <AL/al.h>
|
#include <AL/al.h>
|
||||||
@ -19,8 +13,22 @@
|
|||||||
#include <AL/alext.h>
|
#include <AL/alext.h>
|
||||||
#include <AL/efx.h>
|
#include <AL/efx.h>
|
||||||
#include <AL/efx-presets.h>
|
#include <AL/efx-presets.h>
|
||||||
|
|
||||||
|
#pragma comment(lib, "OpenAL32.lib")
|
||||||
|
|
||||||
|
// for user MP3s
|
||||||
|
#include <direct.h>
|
||||||
|
#include <shlobj.h>
|
||||||
|
#include <shlguid.h>
|
||||||
|
#else
|
||||||
|
#define _getcwd getcwd
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "common.h"
|
||||||
|
#include "crossplatform.h"
|
||||||
|
|
||||||
|
#include "sampman.h"
|
||||||
|
|
||||||
#include "oal/oal_utils.h"
|
#include "oal/oal_utils.h"
|
||||||
#include "oal/aldlist.h"
|
#include "oal/aldlist.h"
|
||||||
#include "oal/channel.h"
|
#include "oal/channel.h"
|
||||||
@ -30,7 +38,7 @@
|
|||||||
#include "MusicManager.h"
|
#include "MusicManager.h"
|
||||||
#include "Frontend.h"
|
#include "Frontend.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
#ifdef AUDIO_OPUS
|
#ifdef AUDIO_OAL_USE_OPUS
|
||||||
#include <opusfile.h>
|
#include <opusfile.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -85,7 +93,7 @@ char SampleBankDescFilename[] = "audio/sfx.SDT";
|
|||||||
char SampleBankDataFilename[] = "audio/sfx.RAW";
|
char SampleBankDataFilename[] = "audio/sfx.RAW";
|
||||||
|
|
||||||
FILE *fpSampleDescHandle;
|
FILE *fpSampleDescHandle;
|
||||||
#ifdef AUDIO_OPUS
|
#ifdef OPUS_SFX
|
||||||
OggOpusFile *fpSampleDataHandle;
|
OggOpusFile *fpSampleDataHandle;
|
||||||
#else
|
#else
|
||||||
FILE *fpSampleDataHandle;
|
FILE *fpSampleDataHandle;
|
||||||
@ -104,7 +112,7 @@ CChannel aChannel[MAXCHANNELS+MAX2DCHANNELS];
|
|||||||
uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
|
uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
|
||||||
|
|
||||||
uint32 nStreamLength[TOTAL_STREAMED_SOUNDS];
|
uint32 nStreamLength[TOTAL_STREAMED_SOUNDS];
|
||||||
ALuint ALStreamSources[MAX_STREAMS];
|
ALuint ALStreamSources[MAX_STREAMS][2];
|
||||||
ALuint ALStreamBuffers[MAX_STREAMS][NUM_STREAMBUFFERS];
|
ALuint ALStreamBuffers[MAX_STREAMS][NUM_STREAMBUFFERS];
|
||||||
|
|
||||||
struct tMP3Entry
|
struct tMP3Entry
|
||||||
@ -247,9 +255,9 @@ release_existing()
|
|||||||
if (stream)
|
if (stream)
|
||||||
stream->ProviderTerm();
|
stream->ProviderTerm();
|
||||||
|
|
||||||
alDeleteSources(1, &ALStreamSources[i]);
|
|
||||||
alDeleteBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]);
|
alDeleteBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]);
|
||||||
}
|
}
|
||||||
|
alDeleteSources(MAX_STREAMS*2, ALStreamSources[0]);
|
||||||
|
|
||||||
CChannel::DestroyChannels();
|
CChannel::DestroyChannels();
|
||||||
|
|
||||||
@ -292,7 +300,10 @@ set_new_provider(int index)
|
|||||||
//TODO:
|
//TODO:
|
||||||
_maxSamples = MAXCHANNELS;
|
_maxSamples = MAXCHANNELS;
|
||||||
|
|
||||||
ALCint attr[] = {ALC_FREQUENCY,MAX_FREQ,0};
|
ALCint attr[] = {ALC_FREQUENCY,MAX_FREQ,
|
||||||
|
ALC_MONO_SOURCES, MAX_STREAMS * 2 + MAXCHANNELS,
|
||||||
|
0,
|
||||||
|
};
|
||||||
|
|
||||||
ALDevice = alcOpenDevice(providers[index].id);
|
ALDevice = alcOpenDevice(providers[index].id);
|
||||||
ASSERT(ALDevice != NULL);
|
ASSERT(ALDevice != NULL);
|
||||||
@ -327,10 +338,16 @@ set_new_provider(int index)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
alGenSources(MAX_STREAMS*2, ALStreamSources[0]);
|
||||||
for ( int32 i = 0; i < MAX_STREAMS; i++ )
|
for ( int32 i = 0; i < MAX_STREAMS; i++ )
|
||||||
{
|
{
|
||||||
alGenSources(1, &ALStreamSources[i]);
|
alGenBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]);
|
||||||
alGenBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]);
|
alSourcei(ALStreamSources[i][0], AL_SOURCE_RELATIVE, AL_TRUE);
|
||||||
|
alSource3f(ALStreamSources[i][0], AL_POSITION, 0.0f, 0.0f, 0.0f);
|
||||||
|
alSourcef(ALStreamSources[i][0], AL_GAIN, 1.0f);
|
||||||
|
alSourcei(ALStreamSources[i][1], AL_SOURCE_RELATIVE, AL_TRUE);
|
||||||
|
alSource3f(ALStreamSources[i][1], AL_POSITION, 0.0f, 0.0f, 0.0f);
|
||||||
|
alSourcef(ALStreamSources[i][1], AL_GAIN, 1.0f);
|
||||||
|
|
||||||
CStream *stream = aStream[i];
|
CStream *stream = aStream[i];
|
||||||
if (stream)
|
if (stream)
|
||||||
@ -393,6 +410,12 @@ set_new_provider(int index)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsThisTrackAt16KHz(uint32 track)
|
||||||
|
{
|
||||||
|
return track == STREAMED_SOUND_RADIO_CHAT;
|
||||||
|
}
|
||||||
|
|
||||||
cSampleManager::cSampleManager(void)
|
cSampleManager::cSampleManager(void)
|
||||||
{
|
{
|
||||||
;
|
;
|
||||||
@ -967,33 +990,37 @@ cSampleManager::Initialise(void)
|
|||||||
#ifdef AUDIO_CACHE
|
#ifdef AUDIO_CACHE
|
||||||
FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb");
|
FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb");
|
||||||
if (cacheFile) {
|
if (cacheFile) {
|
||||||
|
debug("Loadind audio cache (If game crashes around here, then your cache is corrupted, remove audio/sound.cache)\n");
|
||||||
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
fread(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||||
fclose(cacheFile);
|
fclose(cacheFile);
|
||||||
} else
|
} else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
debug("Cannot load audio cache\n");
|
||||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
#endif
|
||||||
{
|
|
||||||
aStream[0] = new CStream(StreamedNameTable[i], ALStreamSources[0], ALStreamBuffers[0]);
|
for(int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++) {
|
||||||
|
aStream[0] = new CStream(StreamedNameTable[i], ALStreamSources[0], ALStreamBuffers[0], IsThisTrackAt16KHz(i) ? 16000 : 32000);
|
||||||
if ( aStream[0] && aStream[0]->IsOpened() )
|
|
||||||
{
|
if(aStream[0] && aStream[0]->IsOpened()) {
|
||||||
uint32 tatalms = aStream[0]->GetLengthMS();
|
uint32 tatalms = aStream[0]->GetLengthMS();
|
||||||
delete aStream[0];
|
delete aStream[0];
|
||||||
aStream[0] = NULL;
|
aStream[0] = NULL;
|
||||||
|
|
||||||
nStreamLength[i] = tatalms;
|
nStreamLength[i] = tatalms;
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
USERERROR("Can't open '%s'\n", StreamedNameTable[i]);
|
USERERROR("Can't open '%s'\n", StreamedNameTable[i]);
|
||||||
}
|
}
|
||||||
#ifdef AUDIO_CACHE
|
#ifdef AUDIO_CACHE
|
||||||
cacheFile = fcaseopen("audio\\sound.cache", "wb");
|
cacheFile = fcaseopen("audio\\sound.cache", "wb");
|
||||||
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
if(cacheFile) {
|
||||||
fclose(cacheFile);
|
debug("Saving audio cache\n");
|
||||||
#endif
|
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||||
|
fclose(cacheFile);
|
||||||
|
} else {
|
||||||
|
debug("Cannot save audio cache\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
if ( !InitialiseSampleBanks() )
|
if ( !InitialiseSampleBanks() )
|
||||||
@ -1210,7 +1237,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AUDIO_OPUS
|
#ifdef OPUS_SFX
|
||||||
int samplesRead = 0;
|
int samplesRead = 0;
|
||||||
int samplesSize = nSampleBankSize[nBank] / 2;
|
int samplesSize = nSampleBankSize[nBank] / 2;
|
||||||
op_pcm_seek(fpSampleDataHandle, 0);
|
op_pcm_seek(fpSampleDataHandle, 0);
|
||||||
@ -1323,7 +1350,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef AUDIO_OPUS
|
#ifdef OPUS_SFX
|
||||||
int samplesRead = 0;
|
int samplesRead = 0;
|
||||||
int samplesSize = m_aSamples[nComment].nSize / 2;
|
int samplesSize = m_aSamples[nComment].nSize / 2;
|
||||||
op_pcm_seek(fpSampleDataHandle, m_aSamples[nComment].nOffset / 2);
|
op_pcm_seek(fpSampleDataHandle, m_aSamples[nComment].nOffset / 2);
|
||||||
@ -1659,7 +1686,7 @@ cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
|
|||||||
|
|
||||||
strcpy(filename, StreamedNameTable[nFile]);
|
strcpy(filename, StreamedNameTable[nFile]);
|
||||||
|
|
||||||
CStream *stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
|
CStream *stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
|
||||||
ASSERT(stream != NULL);
|
ASSERT(stream != NULL);
|
||||||
|
|
||||||
aStream[nStream] = stream;
|
aStream[nStream] = stream;
|
||||||
@ -1734,7 +1761,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
|||||||
nFile = 0;
|
nFile = 0;
|
||||||
strcat(filename, StreamedNameTable[nFile]);
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
|
|
||||||
CStream* stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
|
CStream* stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
|
||||||
ASSERT(stream != NULL);
|
ASSERT(stream != NULL);
|
||||||
|
|
||||||
aStream[nStream] = stream;
|
aStream[nStream] = stream;
|
||||||
@ -1758,12 +1785,12 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mp3->pLinkPath != NULL)
|
if (mp3->pLinkPath != NULL)
|
||||||
aStream[nStream] = new CStream(mp3->pLinkPath, ALStreamSources[nStream], ALStreamBuffers[nStream]);
|
aStream[nStream] = new CStream(mp3->pLinkPath, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
|
||||||
else {
|
else {
|
||||||
strcpy(filename, _mp3DirectoryPath);
|
strcpy(filename, _mp3DirectoryPath);
|
||||||
strcat(filename, mp3->aFilename);
|
strcat(filename, mp3->aFilename);
|
||||||
|
|
||||||
aStream[nStream] = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
|
aStream[nStream] = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aStream[nStream]->IsOpened()) {
|
if (aStream[nStream]->IsOpened()) {
|
||||||
@ -1790,7 +1817,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
|||||||
{
|
{
|
||||||
nFile = 0;
|
nFile = 0;
|
||||||
strcat(filename, StreamedNameTable[nFile]);
|
strcat(filename, StreamedNameTable[nFile]);
|
||||||
CStream* stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
|
CStream* stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
|
||||||
ASSERT(stream != NULL);
|
ASSERT(stream != NULL);
|
||||||
|
|
||||||
aStream[nStream] = stream;
|
aStream[nStream] = stream;
|
||||||
@ -1814,7 +1841,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (e->pLinkPath != NULL)
|
if (e->pLinkPath != NULL)
|
||||||
aStream[nStream] = new CStream(e->pLinkPath, ALStreamSources[nStream], ALStreamBuffers[nStream]);
|
aStream[nStream] = new CStream(e->pLinkPath, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
|
||||||
else {
|
else {
|
||||||
strcpy(filename, _mp3DirectoryPath);
|
strcpy(filename, _mp3DirectoryPath);
|
||||||
strcat(filename, e->aFilename);
|
strcat(filename, e->aFilename);
|
||||||
@ -1847,7 +1874,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
|||||||
|
|
||||||
strcpy(filename, StreamedNameTable[nFile]);
|
strcpy(filename, StreamedNameTable[nFile]);
|
||||||
|
|
||||||
CStream *stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream]);
|
CStream *stream = new CStream(filename, ALStreamSources[nStream], ALStreamBuffers[nStream], IsThisTrackAt16KHz(nFile) ? 16000 : 32000);
|
||||||
ASSERT(stream != NULL);
|
ASSERT(stream != NULL);
|
||||||
|
|
||||||
aStream[nStream] = stream;
|
aStream[nStream] = stream;
|
||||||
@ -1970,7 +1997,7 @@ cSampleManager::InitialiseSampleBanks(void)
|
|||||||
fpSampleDescHandle = fcaseopen(SampleBankDescFilename, "rb");
|
fpSampleDescHandle = fcaseopen(SampleBankDescFilename, "rb");
|
||||||
if ( fpSampleDescHandle == NULL )
|
if ( fpSampleDescHandle == NULL )
|
||||||
return false;
|
return false;
|
||||||
#ifndef AUDIO_OPUS
|
#ifndef OPUS_SFX
|
||||||
fpSampleDataHandle = fcaseopen(SampleBankDataFilename, "rb");
|
fpSampleDataHandle = fcaseopen(SampleBankDataFilename, "rb");
|
||||||
if ( fpSampleDataHandle == NULL )
|
if ( fpSampleDataHandle == NULL )
|
||||||
{
|
{
|
||||||
@ -2000,6 +2027,7 @@ cSampleManager::InitialiseSampleBanks(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef AUDIO_OPUS
|
#ifdef AUDIO_OPUS
|
||||||
|
#ifdef OPUS_SFX
|
||||||
int32 _nSampleDataEndOffset = m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nOffset + m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nSize;
|
int32 _nSampleDataEndOffset = m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nOffset + m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nSize;
|
||||||
#endif
|
#endif
|
||||||
fclose(fpSampleDescHandle);
|
fclose(fpSampleDescHandle);
|
||||||
|
@ -2245,12 +2245,12 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin
|
|||||||
float dot = DotProduct(*point - *l0, *l1 - *l0);
|
float dot = DotProduct(*point - *l0, *l1 - *l0);
|
||||||
// Between 0 and len we're above the line.
|
// Between 0 and len we're above the line.
|
||||||
// if not, calculate distance to endpoint
|
// if not, calculate distance to endpoint
|
||||||
if(dot <= 0.0f)
|
if(dot <= 0.0f) return (*point - *l0).Magnitude();
|
||||||
return (*point - *l0).Magnitude();
|
if(dot >= lensq) return (*point - *l1).Magnitude();
|
||||||
if(dot >= lensq)
|
|
||||||
return (*point - *l1).Magnitude();
|
|
||||||
// distance to line
|
// distance to line
|
||||||
return Sqrt((*point - *l0).MagnitudeSqr() - dot*dot/lensq);
|
float distSqr = (*point - *l0).MagnitudeSqr() - dot * dot / lensq;
|
||||||
|
if(distSqr <= 0.f) return 0.f;
|
||||||
|
return Sqrt(distSqr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// same as above but also return the point on the line
|
// same as above but also return the point on the line
|
||||||
@ -2733,4 +2733,4 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
|
|||||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
||||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#include "TempColModels.h"
|
#include "TempColModels.h"
|
||||||
|
#include "Game.h"
|
||||||
|
|
||||||
CColModel CTempColModels::ms_colModelPed1;
|
CColModel CTempColModels::ms_colModelPed1;
|
||||||
CColModel CTempColModels::ms_colModelPed2;
|
CColModel CTempColModels::ms_colModelPed2;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Collision.h"
|
#include "ColModel.h"
|
||||||
|
|
||||||
class CTempColModels
|
class CTempColModels
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
pVehicle->m_bSirenOrAlarm = true;
|
pVehicle->m_bSirenOrAlarm = true;
|
||||||
}
|
}
|
||||||
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
||||||
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
|
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
|
||||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||||
@ -110,7 +110,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
TellOccupantsToLeaveCar(pVehicle);
|
TellOccupantsToLeaveCar(pVehicle);
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
|
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
|
||||||
pVehicle->m_bSirenOrAlarm = false;
|
pVehicle->m_bSirenOrAlarm = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,7 +121,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
pVehicle->m_nCarHornTimer = 0;
|
pVehicle->m_nCarHornTimer = 0;
|
||||||
}
|
}
|
||||||
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
||||||
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())){
|
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())){
|
||||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||||
@ -141,7 +141,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
pVehicle->m_bSirenOrAlarm = true;
|
pVehicle->m_bSirenOrAlarm = true;
|
||||||
}
|
}
|
||||||
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
||||||
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
|
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
|
||||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||||
@ -169,7 +169,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
TellOccupantsToLeaveCar(pVehicle);
|
TellOccupantsToLeaveCar(pVehicle);
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
|
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
|
||||||
pVehicle->m_bSirenOrAlarm = false;
|
pVehicle->m_bSirenOrAlarm = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
pVehicle->m_nCarHornTimer = 0;
|
pVehicle->m_nCarHornTimer = 0;
|
||||||
}
|
}
|
||||||
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
||||||
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
|
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())) {
|
||||||
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||||
@ -283,7 +283,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
(FindPlayerVehicle() == pVehicle->AutoPilot.m_pTargetCar &&
|
(FindPlayerVehicle() == pVehicle->AutoPilot.m_pTargetCar &&
|
||||||
#endif
|
#endif
|
||||||
(FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
(FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
|
||||||
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice()))
|
(FindPlayerPed()->m_pWanted->GetWantedLevel() == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice()))
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
)
|
)
|
||||||
#endif
|
#endif
|
||||||
@ -337,7 +337,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && !CCullZones::NoPolice()){
|
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->GetWantedLevel() > 0 && !CCullZones::NoPolice()){
|
||||||
if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f ||
|
if (ABS(FindPlayerCoors().x - pVehicle->GetPosition().x) > 10.0f ||
|
||||||
ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){
|
ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
|
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
|
||||||
@ -351,7 +351,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
|||||||
TellOccupantsToLeaveCar(pVehicle);
|
TellOccupantsToLeaveCar(pVehicle);
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
||||||
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
|
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
|
||||||
pVehicle->m_bSirenOrAlarm = false;
|
pVehicle->m_bSirenOrAlarm = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -486,7 +486,7 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
|
|||||||
case MI_RHINO:
|
case MI_RHINO:
|
||||||
case MI_BARRACKS:
|
case MI_BARRACKS:
|
||||||
pVehicle->SetUpDriver();
|
pVehicle->SetUpDriver();
|
||||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 1)
|
if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 1)
|
||||||
pVehicle->SetupPassenger(0);
|
pVehicle->SetupPassenger(0);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
@ -541,7 +541,7 @@ void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
|
|||||||
|
|
||||||
uint8 CCarAI::FindPoliceCarMissionForWantedLevel()
|
uint8 CCarAI::FindPoliceCarMissionForWantedLevel()
|
||||||
{
|
{
|
||||||
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel){
|
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel()){
|
||||||
case 0:
|
case 0:
|
||||||
case 1: return MISSION_BLOCKPLAYER_FARAWAY;
|
case 1: return MISSION_BLOCKPLAYER_FARAWAY;
|
||||||
case 2: return (CGeneral::GetRandomNumber() & 3) >= 3 ? MISSION_RAMPLAYER_FARAWAY : MISSION_BLOCKPLAYER_FARAWAY;
|
case 2: return (CGeneral::GetRandomNumber() & 3) >= 3 ? MISSION_RAMPLAYER_FARAWAY : MISSION_BLOCKPLAYER_FARAWAY;
|
||||||
@ -555,7 +555,7 @@ uint8 CCarAI::FindPoliceCarMissionForWantedLevel()
|
|||||||
|
|
||||||
int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
|
int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
|
||||||
{
|
{
|
||||||
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) {
|
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel()) {
|
||||||
case 0: return CGeneral::GetRandomNumberInRange(12, 16);
|
case 0: return CGeneral::GetRandomNumberInRange(12, 16);
|
||||||
case 1: return 25;
|
case 1: return 25;
|
||||||
case 2: return 34;
|
case 2: return 34;
|
||||||
@ -569,7 +569,7 @@ int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
|
|||||||
|
|
||||||
void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
|
void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
|
||||||
{
|
{
|
||||||
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel == 1){
|
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() == 1){
|
||||||
float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude();
|
float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude();
|
||||||
if (FindPlayerVehicle()){
|
if (FindPlayerVehicle()){
|
||||||
if (distanceToPlayer < 10.0f)
|
if (distanceToPlayer < 10.0f)
|
||||||
@ -586,7 +586,7 @@ void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
|
|||||||
else
|
else
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = 25;
|
pVehicle->AutoPilot.m_nCruiseSpeed = 25;
|
||||||
}
|
}
|
||||||
}else if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel == 2){
|
}else if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() == 2){
|
||||||
float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude();
|
float distanceToPlayer = (pVehicle->GetPosition() - FindPlayerCoors()).Magnitude();
|
||||||
if (FindPlayerVehicle()) {
|
if (FindPlayerVehicle()) {
|
||||||
if (distanceToPlayer < 10.0f)
|
if (distanceToPlayer < 10.0f)
|
||||||
|
@ -124,18 +124,18 @@ CCarCtrl::GenerateOneRandomCar()
|
|||||||
CWanted* pWanted = pPlayer->m_pPed->m_pWanted;
|
CWanted* pWanted = pPlayer->m_pPed->m_pWanted;
|
||||||
int carClass;
|
int carClass;
|
||||||
int carModel;
|
int carModel;
|
||||||
if (pWanted->m_nWantedLevel > 1 && NumLawEnforcerCars < pWanted->m_MaximumLawEnforcerVehicles &&
|
if (pWanted->GetWantedLevel() > 1 && NumLawEnforcerCars < pWanted->m_MaximumLawEnforcerVehicles &&
|
||||||
pWanted->m_CurrentCops < pWanted->m_MaxCops && (
|
pWanted->m_CurrentCops < pWanted->m_MaxCops && (
|
||||||
pWanted->m_nWantedLevel > 3 ||
|
pWanted->GetWantedLevel() > 3 ||
|
||||||
pWanted->m_nWantedLevel > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 ||
|
pWanted->GetWantedLevel() > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 ||
|
||||||
pWanted->m_nWantedLevel > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) {
|
pWanted->GetWantedLevel() > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) {
|
||||||
/* Last pWanted->m_nWantedLevel > 1 is unnecessary but I added it for better readability. */
|
/* Last pWanted->GetWantedLevel() > 1 is unnecessary but I added it for better readability. */
|
||||||
/* Wouldn't be surprised it was there originally but was optimized out. */
|
/* Wouldn't be surprised it was there originally but was optimized out. */
|
||||||
carClass = COPS;
|
carClass = COPS;
|
||||||
carModel = ChoosePoliceCarModel();
|
carModel = ChoosePoliceCarModel();
|
||||||
}else{
|
}else{
|
||||||
carModel = ChooseModel(&zone, &vecTargetPos, &carClass);
|
carModel = ChooseModel(&zone, &vecTargetPos, &carClass);
|
||||||
if (carClass == COPS && pWanted->m_nWantedLevel >= 1)
|
if (carClass == COPS && pWanted->GetWantedLevel() >= 1)
|
||||||
/* All cop spawns with wanted level are handled by condition above. */
|
/* 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. */
|
/* In particular it means that cop cars never spawn if player has wanted level of 1. */
|
||||||
return;
|
return;
|
||||||
@ -267,7 +267,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||||||
}
|
}
|
||||||
if (!ThePaths.NewGenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
|
if (!ThePaths.NewGenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
|
||||||
preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId,
|
preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId,
|
||||||
&positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1))
|
&positionBetweenNodes, carClass == COPS && pWanted->GetWantedLevel() >= 1))
|
||||||
return;
|
return;
|
||||||
int16 colliding;
|
int16 colliding;
|
||||||
CWorld::FindObjectsKindaColliding(spawnPosition, 10.0f, true, &colliding, 2, nil, false, true, true, false, false);
|
CWorld::FindObjectsKindaColliding(spawnPosition, 10.0f, true, &colliding, 2, nil, false, true, true, false, false);
|
||||||
@ -331,7 +331,7 @@ CCarCtrl::GenerateOneRandomCar()
|
|||||||
}
|
}
|
||||||
case COPS:
|
case COPS:
|
||||||
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
|
||||||
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel != 0){
|
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->GetWantedLevel() != 0){
|
||||||
pVehicle->AutoPilot.m_nCruiseSpeed = CCarAI::FindPoliceCarSpeedForWantedLevel(pVehicle);
|
pVehicle->AutoPilot.m_nCruiseSpeed = CCarAI::FindPoliceCarSpeedForWantedLevel(pVehicle);
|
||||||
pVehicle->AutoPilot.m_fMaxTrafficSpeed = pVehicle->AutoPilot.m_nCruiseSpeed / 2;
|
pVehicle->AutoPilot.m_fMaxTrafficSpeed = pVehicle->AutoPilot.m_nCruiseSpeed / 2;
|
||||||
pVehicle->AutoPilot.m_nCarMission = CCarAI::FindPoliceCarMissionForWantedLevel();
|
pVehicle->AutoPilot.m_nCarMission = CCarAI::FindPoliceCarMissionForWantedLevel();
|
||||||
@ -2415,7 +2415,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
|
|||||||
*pHandbrake = true;
|
*pHandbrake = true;
|
||||||
float maxAngle = FindMaxSteerAngle(pVehicle);
|
float maxAngle = FindMaxSteerAngle(pVehicle);
|
||||||
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
|
steerAngle = Min(maxAngle, Max(-maxAngle, steerAngle));
|
||||||
float speedMultiplier = FindSpeedMultiplier(angleToTarget - angleForward,
|
float speedMultiplier = FindSpeedMultiplier(CGeneral::GetATanOfXY(targetX - pVehicle->GetPosition().x, targetY - pVehicle->GetPosition().y) - angleForward,
|
||||||
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
MIN_ANGLE_FOR_SPEED_LIMITING, MAX_ANGLE_FOR_SPEED_LIMITING, MIN_LOWERING_SPEED_COEFFICIENT);
|
||||||
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
||||||
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;
|
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;
|
||||||
@ -2654,7 +2654,7 @@ void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
|
|||||||
|
|
||||||
void CCarCtrl::GenerateEmergencyServicesCar(void)
|
void CCarCtrl::GenerateEmergencyServicesCar(void)
|
||||||
{
|
{
|
||||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 3)
|
if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 3)
|
||||||
return;
|
return;
|
||||||
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars +
|
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars +
|
||||||
NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse)
|
NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse)
|
||||||
|
@ -126,7 +126,7 @@ CDarkel::DrawMessages()
|
|||||||
#if defined(PS2_HUD) || defined(FIX_BUGS)
|
#if defined(PS2_HUD) || defined(FIX_BUGS)
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f - 1.0f), SCREEN_SCALE_Y(108.0f + 1.0f), gUString);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(34.0f - 1.0f), SCREEN_SCALE_Y(108.0f + 1.0f), gUString);
|
||||||
#else -
|
#else
|
||||||
CFont::PrintString(SCREEN_WIDTH-(34.0f - 1.0f), 108.0f + 1.0f, gUString);
|
CFont::PrintString(SCREEN_WIDTH-(34.0f - 1.0f), 108.0f + 1.0f, gUString);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
|
@ -159,7 +159,7 @@ CGameLogic::Update()
|
|||||||
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
||||||
int takeMoney;
|
int takeMoney;
|
||||||
|
|
||||||
switch (pPlayerInfo.m_pPed->m_pWanted->m_nWantedLevel) {
|
switch (pPlayerInfo.m_pPed->m_pWanted->GetWantedLevel()) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
takeMoney = 100;
|
takeMoney = 100;
|
||||||
|
@ -111,6 +111,8 @@ const int32 gaCarsToCollectInCraigsGarages[TOTAL_COLLECTCARS_GARAGES][TOTAL_COLL
|
|||||||
{ MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }
|
{ MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_LANDSTAL, MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO };
|
||||||
|
|
||||||
int32 CGarages::BankVansCollected;
|
int32 CGarages::BankVansCollected;
|
||||||
bool CGarages::BombsAreFree;
|
bool CGarages::BombsAreFree;
|
||||||
bool CGarages::RespraysAreFree;
|
bool CGarages::RespraysAreFree;
|
||||||
@ -387,7 +389,7 @@ void CGarage::Update()
|
|||||||
m_eGarageState = GS_OPENING;
|
m_eGarageState = GS_OPENING;
|
||||||
DMAudio.PlayFrontEndSound(SOUND_GARAGE_OPENING, 1);
|
DMAudio.PlayFrontEndSound(SOUND_GARAGE_OPENING, 1);
|
||||||
bool bTakeMoney = false;
|
bool bTakeMoney = false;
|
||||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel != 0)
|
if (FindPlayerPed()->m_pWanted->GetWantedLevel() != 0)
|
||||||
bTakeMoney = true;
|
bTakeMoney = true;
|
||||||
FindPlayerPed()->m_pWanted->Reset();
|
FindPlayerPed()->m_pWanted->Reset();
|
||||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE);
|
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE);
|
||||||
@ -1539,7 +1541,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
|
|||||||
m_bRecreateDoorOnNextRefresh = false;
|
m_bRecreateDoorOnNextRefresh = false;
|
||||||
if (m_pDoor1) {
|
if (m_pDoor1) {
|
||||||
if (m_bDoor1IsDummy) {
|
if (m_bDoor1IsDummy) {
|
||||||
if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1)))
|
if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor1)))
|
||||||
bNeedToFindDoorEntities = true;
|
bNeedToFindDoorEntities = true;
|
||||||
else {
|
else {
|
||||||
if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F))
|
if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F))
|
||||||
@ -1549,7 +1551,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1)))
|
if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor1)))
|
||||||
bNeedToFindDoorEntities = true;
|
bNeedToFindDoorEntities = true;
|
||||||
else {
|
else {
|
||||||
if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F))
|
if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F))
|
||||||
@ -1561,7 +1563,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
|
|||||||
}
|
}
|
||||||
if (m_pDoor2) {
|
if (m_pDoor2) {
|
||||||
if (m_bDoor2IsDummy) {
|
if (m_bDoor2IsDummy) {
|
||||||
if (CPools::GetDummyPool()->IsFreeSlot(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2)))
|
if (CPools::GetDummyPool()->GetIsFree(CPools::GetDummyPool()->GetJustIndex_NoFreeAssert((CDummy*)m_pDoor2)))
|
||||||
bNeedToFindDoorEntities = true;
|
bNeedToFindDoorEntities = true;
|
||||||
else {
|
else {
|
||||||
if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F))
|
if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F))
|
||||||
@ -1571,7 +1573,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (CPools::GetObjectPool()->IsFreeSlot(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2)))
|
if (CPools::GetObjectPool()->GetIsFree(CPools::GetObjectPool()->GetJustIndex_NoFreeAssert((CObject*)m_pDoor2)))
|
||||||
bNeedToFindDoorEntities = true;
|
bNeedToFindDoorEntities = true;
|
||||||
else {
|
else {
|
||||||
if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F))
|
if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F))
|
||||||
@ -2424,3 +2426,41 @@ CGarages::IsModelIndexADoor(uint32 id)
|
|||||||
id == MI_CRUSHERBODY ||
|
id == MI_CRUSHERBODY ||
|
||||||
id == MI_CRUSHERLID;
|
id == MI_CRUSHERLID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CGarages::StopCarFromBlowingUp(CAutomobile* pCar)
|
||||||
|
{
|
||||||
|
pCar->m_fFireBlowUpTimer = 0.0f;
|
||||||
|
pCar->m_fHealth = Max(pCar->m_fHealth, 300.0f);
|
||||||
|
pCar->Damage.SetEngineStatus(Max(pCar->Damage.GetEngineStatus(), 275));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGarage::Does60SecondsNeedThisCarAtAll(int mi)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
|
||||||
|
if (gaCarsToCollectIn60Seconds[i] == mi)
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGarage::Does60SecondsNeedThisCar(int mi)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
|
||||||
|
if (gaCarsToCollectIn60Seconds[i] == mi)
|
||||||
|
return m_bCollectedCarsState & BIT(i);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CGarage::MarkThisCarAsCollectedFor60Seconds(int mi)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < ARRAY_SIZE(gaCarsToCollectIn60Seconds); i++) {
|
||||||
|
if (gaCarsToCollectIn60Seconds[i] == mi)
|
||||||
|
m_bCollectedCarsState |= BIT(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CGarage::IsPlayerEntirelyInsideGarage()
|
||||||
|
{
|
||||||
|
return IsEntityEntirelyInside3D(FindPlayerVehicle() ? (CEntity*)FindPlayerVehicle() : (CEntity*)FindPlayerPed(), 0.0f);
|
||||||
|
}
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Automobile.h"
|
|
||||||
#include "audio_enums.h"
|
#include "audio_enums.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "Lists.h"
|
||||||
|
|
||||||
class CVehicle;
|
class CVehicle;
|
||||||
class CCamera;
|
|
||||||
|
|
||||||
enum eGarageState
|
enum eGarageState
|
||||||
{
|
{
|
||||||
@ -81,6 +80,7 @@ VALIDATE_SIZE(CStoredCar, 0x28);
|
|||||||
|
|
||||||
class CGarage
|
class CGarage
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
uint8 m_eGarageType;
|
uint8 m_eGarageType;
|
||||||
uint8 m_eGarageState;
|
uint8 m_eGarageState;
|
||||||
bool field_2; // unused
|
bool field_2; // unused
|
||||||
@ -166,10 +166,11 @@ class CGarage
|
|||||||
void FindDoorsEntities();
|
void FindDoorsEntities();
|
||||||
void FindDoorsEntitiesSectorList(CPtrList&, bool);
|
void FindDoorsEntitiesSectorList(CPtrList&, bool);
|
||||||
void PlayerArrestedOrDied();
|
void PlayerArrestedOrDied();
|
||||||
|
bool Does60SecondsNeedThisCarAtAll(int mi);
|
||||||
|
bool Does60SecondsNeedThisCar(int mi);
|
||||||
|
void MarkThisCarAsCollectedFor60Seconds(int mi);
|
||||||
|
bool IsPlayerEntirelyInsideGarage();
|
||||||
|
|
||||||
friend class CGarages;
|
|
||||||
friend class cAudioManager;
|
|
||||||
friend class CCamera;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(CGarage, 140);
|
VALIDATE_SIZE(CGarage, 140);
|
||||||
@ -179,6 +180,7 @@ class CGarages
|
|||||||
enum {
|
enum {
|
||||||
MESSAGE_LENGTH = 8
|
MESSAGE_LENGTH = 8
|
||||||
};
|
};
|
||||||
|
public:
|
||||||
static int32 BankVansCollected;
|
static int32 BankVansCollected;
|
||||||
static bool BombsAreFree;
|
static bool BombsAreFree;
|
||||||
static bool RespraysAreFree;
|
static bool RespraysAreFree;
|
||||||
@ -200,7 +202,6 @@ class CGarages
|
|||||||
static CStoredCar aCarsInSafeHouse3[NUM_GARAGE_STORED_CARS];
|
static CStoredCar aCarsInSafeHouse3[NUM_GARAGE_STORED_CARS];
|
||||||
static bool bCamShouldBeOutisde;
|
static bool bCamShouldBeOutisde;
|
||||||
|
|
||||||
public:
|
|
||||||
static void Init(void);
|
static void Init(void);
|
||||||
#ifndef PS2
|
#ifndef PS2
|
||||||
static void Shutdown(void);
|
static void Shutdown(void);
|
||||||
@ -239,8 +240,8 @@ public:
|
|||||||
static bool IsModelIndexADoor(uint32 id);
|
static bool IsModelIndexADoor(uint32 id);
|
||||||
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
|
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
|
||||||
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
|
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
|
||||||
|
static void StopCarFromBlowingUp(CAutomobile*);
|
||||||
|
|
||||||
private:
|
|
||||||
static bool IsCarSprayable(CVehicle*);
|
static bool IsCarSprayable(CVehicle*);
|
||||||
static float FindDoorHeightForMI(int32);
|
static float FindDoorHeightForMI(int32);
|
||||||
static void CloseHideOutGaragesBeforeSave(void);
|
static void CloseHideOutGaragesBeforeSave(void);
|
||||||
@ -249,9 +250,4 @@ private:
|
|||||||
static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 1; }
|
static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 1; }
|
||||||
static int32 GetCarsCollectedIndexForGarageType(uint8 type) { return type - GARAGE_COLLECTCARS_1; }
|
static int32 GetCarsCollectedIndexForGarageType(uint8 type) { return type - GARAGE_COLLECTCARS_1; }
|
||||||
|
|
||||||
friend class cAudioManager;
|
|
||||||
friend class CGarage;
|
|
||||||
#ifdef FIX_BUGS
|
|
||||||
friend class CReplay;
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
@ -40,7 +40,6 @@ bool
|
|||||||
isPhoneAvailable(int m_phoneId)
|
isPhoneAvailable(int m_phoneId)
|
||||||
{
|
{
|
||||||
return crimeReporters[m_phoneId] == nil || !crimeReporters[m_phoneId]->IsPointerValid() || crimeReporters[m_phoneId]->m_objective > OBJECTIVE_WAIT_ON_FOOT ||
|
return crimeReporters[m_phoneId] == nil || !crimeReporters[m_phoneId]->IsPointerValid() || crimeReporters[m_phoneId]->m_objective > OBJECTIVE_WAIT_ON_FOOT ||
|
||||||
crimeReporters[m_phoneId]->m_nLastPedState != PED_SEEK_POS &&
|
|
||||||
(crimeReporters[m_phoneId]->m_nPedState != PED_MAKE_CALL && crimeReporters[m_phoneId]->m_nPedState != PED_FACE_PHONE && crimeReporters[m_phoneId]->m_nPedState != PED_SEEK_POS);
|
(crimeReporters[m_phoneId]->m_nPedState != PED_MAKE_CALL && crimeReporters[m_phoneId]->m_nPedState != PED_FACE_PHONE && crimeReporters[m_phoneId]->m_nPedState != PED_SEEK_POS);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -129,7 +129,7 @@ CPickup::CanBePickedUp(CPlayerPed *player)
|
|||||||
bool cannotBePickedUp =
|
bool cannotBePickedUp =
|
||||||
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f)
|
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f)
|
||||||
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > 99.5f)
|
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > 99.5f)
|
||||||
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->m_nWantedLevel == 0)
|
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->GetWantedLevel() == 0)
|
||||||
|| (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
|
|| (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
|
||||||
return !cannotBePickedUp;
|
return !cannotBePickedUp;
|
||||||
}
|
}
|
||||||
@ -456,7 +456,7 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
|
|||||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
|
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
|
||||||
return true;
|
return true;
|
||||||
} else if (modelIndex == MI_PICKUP_BRIBE) {
|
} else if (modelIndex == MI_PICKUP_BRIBE) {
|
||||||
int32 level = FindPlayerPed()->m_pWanted->m_nWantedLevel - 1;
|
int32 level = FindPlayerPed()->m_pWanted->GetWantedLevel() - 1;
|
||||||
if (level < 0) level = 0;
|
if (level < 0) level = 0;
|
||||||
player->SetWantedLevel(level);
|
player->SetWantedLevel(level);
|
||||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
|
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
class CPacManPickups
|
class CPacManPickups
|
||||||
{
|
{
|
||||||
friend CPacManPickup;
|
friend class CPacManPickup;
|
||||||
|
|
||||||
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
|
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
|
||||||
static CVector LastPickUpCoors;
|
static CVector LastPickUpCoors;
|
||||||
|
@ -305,7 +305,7 @@ void CReplay::RecordThisFrame(void)
|
|||||||
#endif
|
#endif
|
||||||
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
|
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
|
||||||
general->type = REPLAYPACKET_GENERAL;
|
general->type = REPLAYPACKET_GENERAL;
|
||||||
general->camera_pos.CopyOnlyMatrix(&TheCamera.GetMatrix());
|
general->camera_pos.CopyOnlyMatrix(TheCamera.GetMatrix());
|
||||||
general->player_pos = FindPlayerCoors();
|
general->player_pos = FindPlayerCoors();
|
||||||
general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false;
|
general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false;
|
||||||
Record.m_nOffset += sizeof(*general);
|
Record.m_nOffset += sizeof(*general);
|
||||||
@ -1457,7 +1457,7 @@ void CReplay::SaveReplayToHD(void)
|
|||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayReplayFromHD(void)
|
void CReplay::PlayReplayFromHD(void)
|
||||||
{
|
{
|
||||||
CFileMgr::SetDirMyDocuments();
|
CFileMgr::SetDirMyDocuments();
|
||||||
int fr = CFileMgr::OpenFile("replay.rep", "rb");
|
int fr = CFileMgr::OpenFile("replay.rep", "rb");
|
||||||
@ -1476,17 +1476,17 @@ void PlayReplayFromHD(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int slot;
|
int slot;
|
||||||
for (slot = 0; CFileMgr::Read(fr, (char*)CReplay::Buffers[slot], sizeof(CReplay::Buffers[slot])); slot++)
|
for (slot = 0; CFileMgr::Read(fr, (char*)Buffers[slot], sizeof(Buffers[slot])); slot++)
|
||||||
CReplay::BufferStatus[slot] = CReplay::REPLAYBUFFER_PLAYBACK;
|
BufferStatus[slot] = REPLAYBUFFER_PLAYBACK;
|
||||||
CReplay::BufferStatus[slot - 1] = CReplay::REPLAYBUFFER_RECORD;
|
BufferStatus[slot - 1] = REPLAYBUFFER_RECORD;
|
||||||
while (slot < CReplay::NUM_REPLAYBUFFERS)
|
while (slot < NUM_REPLAYBUFFERS)
|
||||||
CReplay::BufferStatus[slot++] = CReplay::REPLAYBUFFER_UNUSED;
|
BufferStatus[slot++] = REPLAYBUFFER_UNUSED;
|
||||||
CFileMgr::CloseFile(fr);
|
CFileMgr::CloseFile(fr);
|
||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
CReplay::TriggerPlayback(CReplay::REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false);
|
TriggerPlayback(REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false);
|
||||||
CReplay::bPlayingBackFromFile = true;
|
bPlayingBackFromFile = true;
|
||||||
CReplay::bAllowLookAroundCam = true;
|
bAllowLookAroundCam = true;
|
||||||
CReplay::StreamAllNecessaryCarsAndPeds();
|
StreamAllNecessaryCarsAndPeds();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
||||||
|
@ -61,8 +61,6 @@ struct CStoredDetailedAnimationState
|
|||||||
uint16 aFlags2[NUM_PARTIAL_ANIMS_IN_REPLAY];
|
uint16 aFlags2[NUM_PARTIAL_ANIMS_IN_REPLAY];
|
||||||
};
|
};
|
||||||
|
|
||||||
void PlayReplayFromHD(void);
|
|
||||||
|
|
||||||
#ifdef GTA_REPLAY
|
#ifdef GTA_REPLAY
|
||||||
#define REPLAY_STUB
|
#define REPLAY_STUB
|
||||||
#else
|
#else
|
||||||
@ -323,11 +321,9 @@ private:
|
|||||||
static void EmptyAllPools(void);
|
static void EmptyAllPools(void);
|
||||||
static void MarkEverythingAsNew(void);
|
static void MarkEverythingAsNew(void);
|
||||||
static void SaveReplayToHD(void);
|
static void SaveReplayToHD(void);
|
||||||
|
static void PlayReplayFromHD(void); // out of class in III PC and later because of SecuROM
|
||||||
static void FindFirstFocusCoordinate(CVector *coord);
|
static void FindFirstFocusCoordinate(CVector *coord);
|
||||||
static void ProcessLookAroundCam(void);
|
static void ProcessLookAroundCam(void);
|
||||||
static size_t FindSizeOfPacket(uint8);
|
static size_t FindSizeOfPacket(uint8);
|
||||||
|
|
||||||
/* Absolute nonsense, but how could this function end up being outside of class? */
|
|
||||||
friend void PlayReplayFromHD(void);
|
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -46,8 +46,8 @@ CRoadBlocks::Init(void)
|
|||||||
void
|
void
|
||||||
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode)
|
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode)
|
||||||
{
|
{
|
||||||
static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f},
|
static const CVector vecRoadBlockOffets[6] = { CVector(-1.5, 1.8f, 0.0f), CVector(-1.5f, -1.8f, 0.0f), CVector(1.5f, 1.8f, 0.0f),
|
||||||
{1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} };
|
CVector(1.5f, -1.8f, 0.0f), CVector(-1.5f, 0.0f, 0.0f), CVector(1.5, 0.0, 0.0) };
|
||||||
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
|
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
|
||||||
if (!pEntityToAttack)
|
if (!pEntityToAttack)
|
||||||
pEntityToAttack = (CEntity*)FindPlayerPed();
|
pEntityToAttack = (CEntity*)FindPlayerPed();
|
||||||
|
@ -329,7 +329,7 @@ void CSceneEdit::Draw(void)
|
|||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT - SHADOW_OFFSET), SCREEN_SCALE_Y(COMMAND_NAME_Y + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
|
||||||
#else
|
#else
|
||||||
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT), wstr);
|
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT) + SHADOW_OFFSET, SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + SHADOW_OFFSET + i * COMMAND_NAME_HEIGHT, wstr);
|
||||||
#endif
|
#endif
|
||||||
if (nCommandDrawn == m_nCurrentCommand)
|
if (nCommandDrawn == m_nCurrentCommand)
|
||||||
CFont::SetColor(CRGBA(156, 91, 40, 255));
|
CFont::SetColor(CRGBA(156, 91, 40, 255));
|
||||||
@ -338,7 +338,7 @@ void CSceneEdit::Draw(void)
|
|||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
|
||||||
#else
|
#else
|
||||||
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT), wstr);
|
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH-COMMAND_NAME_X_RIGHT), SCREEN_SCALE_FROM_BOTTOM(DEFAULT_SCREEN_HEIGHT-COMMAND_NAME_Y) + i * COMMAND_NAME_HEIGHT, wstr);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ uint16 CTheScripts::NumScriptDebugLines;
|
|||||||
uint16 CTheScripts::NumberOfIntroRectanglesThisFrame;
|
uint16 CTheScripts::NumberOfIntroRectanglesThisFrame;
|
||||||
uint16 CTheScripts::NumberOfIntroTextLinesThisFrame;
|
uint16 CTheScripts::NumberOfIntroTextLinesThisFrame;
|
||||||
uint8 CTheScripts::UseTextCommands;
|
uint8 CTheScripts::UseTextCommands;
|
||||||
CMissionCleanup CTheScripts::MissionCleanup;
|
CMissionCleanup CTheScripts::MissionCleanUp;
|
||||||
CUpsideDownCarCheck CTheScripts::UpsideDownCars;
|
CUpsideDownCarCheck CTheScripts::UpsideDownCars;
|
||||||
CStuckCarCheck CTheScripts::StuckCars;
|
CStuckCarCheck CTheScripts::StuckCars;
|
||||||
uint16 CTheScripts::CommandsExecuted;
|
uint16 CTheScripts::CommandsExecuted;
|
||||||
@ -260,12 +260,12 @@ const tScriptCommandData commands[] = {
|
|||||||
REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
|
REGISTER_COMMAND(COMMAND_SET_LVAR_INT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ="),
|
||||||
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
||||||
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
||||||
REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
||||||
REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
||||||
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
REGISTER_COMMAND(COMMAND_CSET_VAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
||||||
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
REGISTER_COMMAND(COMMAND_CSET_VAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
||||||
REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
REGISTER_COMMAND(COMMAND_CSET_LVAR_INT_TO_LVAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
||||||
REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
REGISTER_COMMAND(COMMAND_CSET_LVAR_FLOAT_TO_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_INT, ), OUTPUT_ARGUMENTS(), false, 0, " =#"),
|
||||||
REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
|
REGISTER_COMMAND(COMMAND_ABS_VAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
|
||||||
REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
|
REGISTER_COMMAND(COMMAND_ABS_LVAR_INT, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
|
||||||
REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
|
REGISTER_COMMAND(COMMAND_ABS_VAR_FLOAT, INPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, 0, " ABS"),
|
||||||
@ -1225,7 +1225,7 @@ const tScriptCommandData commands[] = {
|
|||||||
REGISTER_COMMAND(COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
|
REGISTER_COMMAND(COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER, INPUT_ARGUMENTS(ARGTYPE_INT,), OUTPUT_ARGUMENTS(), false, -1, ""),
|
||||||
REGISTER_COMMAND(COMMAND_LOAD_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
|
REGISTER_COMMAND(COMMAND_LOAD_END_OF_GAME_TUNE, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
|
||||||
REGISTER_COMMAND(COMMAND_ENABLE_PLAYER_CONTROL_CAMERA, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
|
REGISTER_COMMAND(COMMAND_ENABLE_PLAYER_CONTROL_CAMERA, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(), false, -1, ""),
|
||||||
#ifndef GTA_PS2
|
#if GTA_VERSION > GTA3_PS2_160
|
||||||
REGISTER_COMMAND(COMMAND_SET_OBJECT_ROTATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
|
REGISTER_COMMAND(COMMAND_SET_OBJECT_ROTATION, INPUT_ARGUMENTS(ARGTYPE_INT, ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), OUTPUT_ARGUMENTS(), false, -1, ""),
|
||||||
REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
|
REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_COORDINATES, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
|
||||||
REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
|
REGISTER_COMMAND(COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR, INPUT_ARGUMENTS(), OUTPUT_ARGUMENTS(ARGTYPE_FLOAT, ARGTYPE_FLOAT, ARGTYPE_FLOAT,), false, -1, ""),
|
||||||
@ -1340,7 +1340,7 @@ void CMissionCleanup::Init()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CMissionCleanupEntity* CMissionCleanup::FindFree()
|
cleanup_entity_struct* CMissionCleanup::FindFree()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_CLEANUP; i++){
|
for (int i = 0; i < MAX_CLEANUP; i++){
|
||||||
if (m_sEntities[i].type == CLEANUP_UNUSED)
|
if (m_sEntities[i].type == CLEANUP_UNUSED)
|
||||||
@ -1352,7 +1352,7 @@ CMissionCleanupEntity* CMissionCleanup::FindFree()
|
|||||||
|
|
||||||
void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
|
void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
|
||||||
{
|
{
|
||||||
CMissionCleanupEntity* pNew = FindFree();
|
cleanup_entity_struct* pNew = FindFree();
|
||||||
if (!pNew)
|
if (!pNew)
|
||||||
return;
|
return;
|
||||||
pNew->id = id;
|
pNew->id = id;
|
||||||
@ -1444,10 +1444,16 @@ void CUpsideDownCarCheck::Init()
|
|||||||
|
|
||||||
bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id)
|
bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id)
|
||||||
{
|
{
|
||||||
CVehicle* v = CPools::GetVehiclePool()->GetAt(id);
|
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(id);
|
||||||
return v->GetUp().z <= -0.97f &&
|
return IsCarUpsideDown(pVehicle);
|
||||||
v->GetMoveSpeed().Magnitude() < 0.01f &&
|
}
|
||||||
v->GetTurnSpeed().Magnitude() < 0.02f;
|
|
||||||
|
bool CUpsideDownCarCheck::IsCarUpsideDown(CVehicle* pVehicle)
|
||||||
|
{
|
||||||
|
assert(pVehicle);
|
||||||
|
return pVehicle->GetUp().z <= UPSIDEDOWN_UP_THRESHOLD &&
|
||||||
|
pVehicle->GetMoveSpeed().Magnitude() < UPSIDEDOWN_MOVE_SPEED_THRESHOLD &&
|
||||||
|
pVehicle->GetTurnSpeed().Magnitude() < UPSIDEDOWN_TURN_SPEED_THRESHOLD;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CUpsideDownCarCheck::UpdateTimers()
|
void CUpsideDownCarCheck::UpdateTimers()
|
||||||
@ -1470,7 +1476,7 @@ void CUpsideDownCarCheck::UpdateTimers()
|
|||||||
bool CUpsideDownCarCheck::AreAnyCarsUpsideDown()
|
bool CUpsideDownCarCheck::AreAnyCarsUpsideDown()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
|
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
|
||||||
if (m_sCars[i].m_nVehicleIndex >= 0 && m_sCars[i].m_nUpsideDownTimer > 1000)
|
if (m_sCars[i].m_nVehicleIndex >= 0 && m_sCars[i].m_nUpsideDownTimer > UPSIDEDOWN_TIMER_THRESHOLD)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -1481,8 +1487,10 @@ void CUpsideDownCarCheck::AddCarToCheck(int32 id)
|
|||||||
uint16 index = 0;
|
uint16 index = 0;
|
||||||
while (index < MAX_UPSIDEDOWN_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
|
while (index < MAX_UPSIDEDOWN_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
|
||||||
index++;
|
index++;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
if (index >= MAX_UPSIDEDOWN_CAR_CHECKS)
|
if (index >= MAX_UPSIDEDOWN_CAR_CHECKS)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
m_sCars[index].m_nVehicleIndex = id;
|
m_sCars[index].m_nVehicleIndex = id;
|
||||||
m_sCars[index].m_nUpsideDownTimer = 0;
|
m_sCars[index].m_nUpsideDownTimer = 0;
|
||||||
}
|
}
|
||||||
@ -1501,7 +1509,7 @@ bool CUpsideDownCarCheck::HasCarBeenUpsideDownForAWhile(int32 id)
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
|
for (int i = 0; i < MAX_UPSIDEDOWN_CAR_CHECKS; i++){
|
||||||
if (m_sCars[i].m_nVehicleIndex == id)
|
if (m_sCars[i].m_nVehicleIndex == id)
|
||||||
return m_sCars[i].m_nUpsideDownTimer > 1000;
|
return m_sCars[i].m_nUpsideDownTimer > UPSIDEDOWN_TIMER_THRESHOLD;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1551,7 +1559,10 @@ void CStuckCarCheck::AddCarToCheck(int32 id, float radius, uint32 time)
|
|||||||
int index = 0;
|
int index = 0;
|
||||||
while (index < MAX_STUCK_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
|
while (index < MAX_STUCK_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
|
||||||
index++;
|
index++;
|
||||||
/* Would be nice to return if index >= MAX_STUCK_CAR_CHECKS... */
|
#ifdef FIX_BUGS
|
||||||
|
if (index >= MAX_STUCK_CAR_CHECKS)
|
||||||
|
return;
|
||||||
|
#endif
|
||||||
m_sCars[index].m_nVehicleIndex = id;
|
m_sCars[index].m_nVehicleIndex = id;
|
||||||
m_sCars[index].m_vecPos = pv->GetPosition();
|
m_sCars[index].m_vecPos = pv->GetPosition();
|
||||||
m_sCars[index].m_nLastCheck = CTimer::GetTimeInMilliseconds();
|
m_sCars[index].m_nLastCheck = CTimer::GetTimeInMilliseconds();
|
||||||
@ -1807,7 +1818,7 @@ void CTheScripts::Init()
|
|||||||
ScriptsArray[i].Init();
|
ScriptsArray[i].Init();
|
||||||
ScriptsArray[i].AddScriptToList(&pIdleScripts);
|
ScriptsArray[i].AddScriptToList(&pIdleScripts);
|
||||||
}
|
}
|
||||||
MissionCleanup.Init();
|
MissionCleanUp.Init();
|
||||||
UpsideDownCars.Init();
|
UpsideDownCars.Init();
|
||||||
StuckCars.Init();
|
StuckCars.Init();
|
||||||
CFileMgr::SetDir("data");
|
CFileMgr::SetDir("data");
|
||||||
@ -2069,7 +2080,9 @@ int8 CRunningScript::ProcessOneCommand()
|
|||||||
uint32 ip = m_nIp;
|
uint32 ip = m_nIp;
|
||||||
if (command < ARRAY_SIZE(commands)) {
|
if (command < ARRAY_SIZE(commands)) {
|
||||||
script_assert(commands[command].id == command);
|
script_assert(commands[command].id == command);
|
||||||
|
m_nIp -= 2;
|
||||||
sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp);
|
sprintf(commandInfo, m_nIp >= SIZE_MAIN_SCRIPT ? "M<%5d> " : "<%6d> ", m_nIp >= SIZE_MAIN_SCRIPT ? m_nIp - SIZE_MAIN_SCRIPT : m_nIp);
|
||||||
|
m_nIp += 2;
|
||||||
if (m_bNotFlag)
|
if (m_bNotFlag)
|
||||||
strcat(commandInfo, "NOT ");
|
strcat(commandInfo, "NOT ");
|
||||||
if (commands[command].position == -1)
|
if (commands[command].position == -1)
|
||||||
@ -2119,7 +2132,7 @@ int8 CRunningScript::ProcessOneCommand()
|
|||||||
retval = ProcessCommands800To899(command);
|
retval = ProcessCommands800To899(command);
|
||||||
else if (command < 1000)
|
else if (command < 1000)
|
||||||
retval = ProcessCommands900To999(command);
|
retval = ProcessCommands900To999(command);
|
||||||
#ifdef GTA_PS2
|
#if GTA_VERSION <= GTA3_PS2_160
|
||||||
else if (command < 1200)
|
else if (command < 1200)
|
||||||
retval = ProcessCommands1000To1099(command);
|
retval = ProcessCommands1000To1099(command);
|
||||||
#else
|
#else
|
||||||
@ -3355,7 +3368,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
|
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_DELETE_CHAR:
|
case COMMAND_DELETE_CHAR:
|
||||||
@ -3381,7 +3394,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
--CPopulation::ms_nTotalMissionPeds;
|
--CPopulation::ms_nTotalMissionPeds;
|
||||||
}
|
}
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_CHAR_WANDER_DIR:
|
case COMMAND_CHAR_WANDER_DIR:
|
||||||
@ -3600,7 +3613,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
ScriptParams[0] = handle;
|
ScriptParams[0] = handle;
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_DELETE_CAR:
|
case COMMAND_DELETE_CAR:
|
||||||
@ -3613,7 +3626,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
delete car;
|
delete car;
|
||||||
}
|
}
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_CAR_GOTO_COORDINATES:
|
case COMMAND_CAR_GOTO_COORDINATES:
|
||||||
@ -3731,9 +3744,9 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
|||||||
car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1];
|
car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1];
|
||||||
if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo
|
if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo
|
||||||
car->AutoPilot.m_nCruiseSpeed = 8 * car->AutoPilot.m_nCruiseSpeed / 10;
|
car->AutoPilot.m_nCruiseSpeed = 8 * car->AutoPilot.m_nCruiseSpeed / 10;
|
||||||
car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
|
car->AutoPilot.m_nCruiseSpeed = Min(car->AutoPilot.m_nCruiseSpeed, 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity);
|
||||||
#else
|
#else
|
||||||
car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fUnkMaxVelocity);
|
car->AutoPilot.m_nCruiseSpeed = Min(*(float*)&ScriptParams[1], 60.0f * car->pHandling->Transmission.fMaxCruiseVelocity);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3930,7 +3943,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
return 0;
|
return 0;
|
||||||
if (strcmp(m_abScriptName, "love3") == 0) /* A Drop in the Ocean */
|
if (strcmp(m_abScriptName, "love3") == 0) /* A Drop in the Ocean */
|
||||||
CPickups::RemoveAllFloatingPickups();
|
CPickups::RemoveAllFloatingPickups();
|
||||||
CTheScripts::MissionCleanup.Process();
|
CTheScripts::MissionCleanUp.Process();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_STORE_CAR_CHAR_IS_IN:
|
case COMMAND_STORE_CAR_CHAR_IS_IN:
|
||||||
@ -3953,7 +3966,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
pOld->bIsLocked = false;
|
pOld->bIsLocked = false;
|
||||||
CCarCtrl::NumRandomCars++;
|
CCarCtrl::NumRandomCars++;
|
||||||
CCarCtrl::NumMissionCars--;
|
CCarCtrl::NumMissionCars--;
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3964,14 +3977,14 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
CCarCtrl::NumMissionCars++;
|
CCarCtrl::NumMissionCars++;
|
||||||
CCarCtrl::NumRandomCars--;
|
CCarCtrl::NumRandomCars--;
|
||||||
CTheScripts::StoreVehicleWasRandom = true;
|
CTheScripts::StoreVehicleWasRandom = true;
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||||
break;
|
break;
|
||||||
case PARKED_VEHICLE:
|
case PARKED_VEHICLE:
|
||||||
pCurrent->VehicleCreatedBy = MISSION_VEHICLE;
|
pCurrent->VehicleCreatedBy = MISSION_VEHICLE;
|
||||||
CCarCtrl::NumMissionCars++;
|
CCarCtrl::NumMissionCars++;
|
||||||
CCarCtrl::NumParkedCars--;
|
CCarCtrl::NumParkedCars--;
|
||||||
CTheScripts::StoreVehicleWasRandom = true;
|
CTheScripts::StoreVehicleWasRandom = true;
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||||
break;
|
break;
|
||||||
case MISSION_VEHICLE:
|
case MISSION_VEHICLE:
|
||||||
case PERMANENT_VEHICLE:
|
case PERMANENT_VEHICLE:
|
||||||
@ -4004,7 +4017,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
pOld->bIsLocked = false;
|
pOld->bIsLocked = false;
|
||||||
CCarCtrl::NumRandomCars++;
|
CCarCtrl::NumRandomCars++;
|
||||||
CCarCtrl::NumMissionCars--;
|
CCarCtrl::NumMissionCars--;
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4015,14 +4028,14 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
CCarCtrl::NumMissionCars++;
|
CCarCtrl::NumMissionCars++;
|
||||||
CCarCtrl::NumRandomCars--;
|
CCarCtrl::NumRandomCars--;
|
||||||
CTheScripts::StoreVehicleWasRandom = true;
|
CTheScripts::StoreVehicleWasRandom = true;
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||||
break;
|
break;
|
||||||
case PARKED_VEHICLE:
|
case PARKED_VEHICLE:
|
||||||
pCurrent->VehicleCreatedBy = MISSION_VEHICLE;
|
pCurrent->VehicleCreatedBy = MISSION_VEHICLE;
|
||||||
CCarCtrl::NumMissionCars++;
|
CCarCtrl::NumMissionCars++;
|
||||||
CCarCtrl::NumParkedCars--;
|
CCarCtrl::NumParkedCars--;
|
||||||
CTheScripts::StoreVehicleWasRandom = true;
|
CTheScripts::StoreVehicleWasRandom = true;
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||||
break;
|
break;
|
||||||
case MISSION_VEHICLE:
|
case MISSION_VEHICLE:
|
||||||
case PERMANENT_VEHICLE:
|
case PERMANENT_VEHICLE:
|
||||||
@ -4173,7 +4186,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
|
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
|
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_DELETE_OBJECT:
|
case COMMAND_DELETE_OBJECT:
|
||||||
@ -4186,7 +4199,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
delete pObj;
|
delete pObj;
|
||||||
}
|
}
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_ADD_SCORE:
|
case COMMAND_ADD_SCORE:
|
||||||
@ -4221,7 +4234,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
return 0;
|
return 0;
|
||||||
case COMMAND_IS_WANTED_LEVEL_GREATER:
|
case COMMAND_IS_WANTED_LEVEL_GREATER:
|
||||||
CollectParameters(&m_nIp, 2);
|
CollectParameters(&m_nIp, 2);
|
||||||
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->m_pWanted->m_nWantedLevel > ScriptParams[1]);
|
UpdateCompareFlag(CWorld::Players[ScriptParams[0]].m_pPed->m_pWanted->GetWantedLevel() > ScriptParams[1]);
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_CLEAR_WANTED_LEVEL:
|
case COMMAND_CLEAR_WANTED_LEVEL:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
@ -4411,7 +4424,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
|
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_WARP_PLAYER_FROM_CAR_TO_COORD:
|
case COMMAND_WARP_PLAYER_FROM_CAR_TO_COORD:
|
||||||
@ -4463,81 +4476,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CRunningScript::Save(uint8*& buf)
|
|
||||||
{
|
|
||||||
#ifdef COMPATIBLE_SAVES
|
|
||||||
SkipSaveBuf(buf, 8);
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
WriteSaveBuf<char>(buf, m_abScriptName[i]);
|
|
||||||
WriteSaveBuf<uint32>(buf, m_nIp);
|
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
|
||||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
|
||||||
WriteSaveBuf<uint32>(buf, m_anStack[i]);
|
|
||||||
WriteSaveBuf<uint16>(buf, m_nStackPointer);
|
|
||||||
SkipSaveBuf(buf, 2);
|
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
|
||||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
|
||||||
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
|
|
||||||
WriteSaveBuf<bool>(buf, m_bCondResult);
|
|
||||||
WriteSaveBuf<bool>(buf, m_bIsMissionScript);
|
|
||||||
WriteSaveBuf<bool>(buf, m_bSkipWakeTime);
|
|
||||||
SkipSaveBuf(buf, 1);
|
|
||||||
WriteSaveBuf<uint32>(buf, m_nWakeTime);
|
|
||||||
WriteSaveBuf<uint16>(buf, m_nAndOrState);
|
|
||||||
WriteSaveBuf<bool>(buf, m_bNotFlag);
|
|
||||||
WriteSaveBuf<bool>(buf, m_bDeatharrestEnabled);
|
|
||||||
WriteSaveBuf<bool>(buf, m_bDeatharrestExecuted);
|
|
||||||
WriteSaveBuf<bool>(buf, m_bMissionFlag);
|
|
||||||
SkipSaveBuf(buf, 2);
|
|
||||||
#else
|
|
||||||
WriteSaveBuf(buf, *this);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRunningScript::Load(uint8*& buf)
|
|
||||||
{
|
|
||||||
#ifdef COMPATIBLE_SAVES
|
|
||||||
SkipSaveBuf(buf, 8);
|
|
||||||
for (int i = 0; i < 8; i++)
|
|
||||||
m_abScriptName[i] = ReadSaveBuf<char>(buf);
|
|
||||||
m_nIp = ReadSaveBuf<uint32>(buf);
|
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
|
||||||
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
|
||||||
m_anStack[i] = ReadSaveBuf<uint32>(buf);
|
|
||||||
m_nStackPointer = ReadSaveBuf<uint16>(buf);
|
|
||||||
SkipSaveBuf(buf, 2);
|
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
|
||||||
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
|
||||||
#endif
|
|
||||||
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
|
||||||
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
|
|
||||||
m_bCondResult = ReadSaveBuf<bool>(buf);
|
|
||||||
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
|
|
||||||
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
|
|
||||||
SkipSaveBuf(buf, 1);
|
|
||||||
m_nWakeTime = ReadSaveBuf<uint32>(buf);
|
|
||||||
m_nAndOrState = ReadSaveBuf<uint16>(buf);
|
|
||||||
m_bNotFlag = ReadSaveBuf<bool>(buf);
|
|
||||||
m_bDeatharrestEnabled = ReadSaveBuf<bool>(buf);
|
|
||||||
m_bDeatharrestExecuted = ReadSaveBuf<bool>(buf);
|
|
||||||
m_bMissionFlag = ReadSaveBuf<bool>(buf);
|
|
||||||
SkipSaveBuf(buf, 2);
|
|
||||||
#else
|
|
||||||
CRunningScript* n = next;
|
|
||||||
CRunningScript* p = prev;
|
|
||||||
*this = ReadSaveBuf<CRunningScript>(buf);
|
|
||||||
next = n;
|
|
||||||
prev = p;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
|
|
||||||
bool CRunningScript::CanAllowMissionReplay()
|
bool CRunningScript::CanAllowMissionReplay()
|
||||||
@ -4572,7 +4510,7 @@ void RetryMission(int type, int unk)
|
|||||||
else if (type == 2) {
|
else if (type == 2) {
|
||||||
doingMissionRetry = false;
|
doingMissionRetry = false;
|
||||||
AllowMissionReplay = 6;
|
AllowMissionReplay = 6;
|
||||||
CTheScripts::MissionCleanup.Process();
|
CTheScripts::MissionCleanUp.Process();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "common.h"
|
#include "Font.h"
|
||||||
#include "Ped.h"
|
|
||||||
#include "PedType.h"
|
#include "PedType.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
#include "Sprite2d.h"
|
#include "Sprite2d.h"
|
||||||
@ -19,27 +18,34 @@ extern int32 ScriptParams[32];
|
|||||||
void FlushLog();
|
void FlushLog();
|
||||||
#define script_assert(_Expression) FlushLog(); assert(_Expression);
|
#define script_assert(_Expression) FlushLog(); assert(_Expression);
|
||||||
|
|
||||||
#define PICKUP_PLACEMENT_OFFSET 0.5f
|
#define PICKUP_PLACEMENT_OFFSET (0.5f)
|
||||||
#define PED_FIND_Z_OFFSET 5.0f
|
#define PED_FIND_Z_OFFSET (5.0f)
|
||||||
|
|
||||||
#define SPHERE_MARKER_R 0
|
#define UPSIDEDOWN_UP_THRESHOLD (-0.97f)
|
||||||
#define SPHERE_MARKER_G 128
|
#define UPSIDEDOWN_MOVE_SPEED_THRESHOLD (0.01f)
|
||||||
#define SPHERE_MARKER_B 255
|
#define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f)
|
||||||
#define SPHERE_MARKER_A 128
|
#define UPSIDEDOWN_TIMER_THRESHOLD (1000)
|
||||||
#define SPHERE_MARKER_PULSE_PERIOD 2048
|
|
||||||
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
|
#define SPHERE_MARKER_R (0)
|
||||||
|
#define SPHERE_MARKER_G (128)
|
||||||
|
#define SPHERE_MARKER_B (255)
|
||||||
|
#define SPHERE_MARKER_A (128)
|
||||||
|
#define SPHERE_MARKER_PULSE_PERIOD (2048)
|
||||||
|
#define SPHERE_MARKER_PULSE_FRACTION (0.1f)
|
||||||
|
|
||||||
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
|
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
|
||||||
#define METERS_IN_FOOT 0.3048f
|
#define MILES_IN_METER (0.000621371192f)
|
||||||
#define FEET_IN_METER 3.28084f
|
#define METERS_IN_FOOT (0.3048f)
|
||||||
|
#define FEET_IN_METER (3.28084f)
|
||||||
#else
|
#else
|
||||||
#define METERS_IN_FOOT 0.3f
|
#define MILES_IN_METER (1 / 1670.f)
|
||||||
#define FEET_IN_METER 3.33f
|
#define METERS_IN_FOOT (0.3f)
|
||||||
|
#define FEET_IN_METER (3.33f)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define KEY_LENGTH_IN_SCRIPT 8
|
#define KEY_LENGTH_IN_SCRIPT (8)
|
||||||
|
|
||||||
#if GTA_VERSION <= GTA_PS2_160
|
#if GTA_VERSION <= GTA3_PS2_160
|
||||||
#define GTA_SCRIPT_COLLECTIVE
|
#define GTA_SCRIPT_COLLECTIVE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -94,12 +100,12 @@ struct intro_text_line
|
|||||||
m_bCentered = false;
|
m_bCentered = false;
|
||||||
m_bBackground = false;
|
m_bBackground = false;
|
||||||
m_bBackgroundOnly = false;
|
m_bBackgroundOnly = false;
|
||||||
m_fWrapX = 182.0f; /* TODO: scaling as bugfix */
|
m_fWrapX = 182.0f;
|
||||||
m_fCenterSize = 640.0f; /* --||-- */
|
m_fCenterSize = DEFAULT_SCREEN_WIDTH;
|
||||||
m_sBackgroundColor = CRGBA(128, 128, 128, 128);
|
m_sBackgroundColor = CRGBA(128, 128, 128, 128);
|
||||||
m_bTextProportional = true;
|
m_bTextProportional = true;
|
||||||
m_bTextBeforeFade = false;
|
m_bTextBeforeFade = false;
|
||||||
m_nFont = 2; /* enum? */
|
m_nFont = FONT_HEADING;
|
||||||
m_fAtX = 0.0f;
|
m_fAtX = 0.0f;
|
||||||
m_fAtY = 0.0f;
|
m_fAtY = 0.0f;
|
||||||
memset(&m_Text, 0, sizeof(m_Text));
|
memset(&m_Text, 0, sizeof(m_Text));
|
||||||
@ -134,7 +140,7 @@ enum {
|
|||||||
CLEANUP_OBJECT
|
CLEANUP_OBJECT
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CMissionCleanupEntity
|
struct cleanup_entity_struct
|
||||||
{
|
{
|
||||||
uint8 type;
|
uint8 type;
|
||||||
int32 id;
|
int32 id;
|
||||||
@ -148,20 +154,20 @@ enum {
|
|||||||
|
|
||||||
class CMissionCleanup
|
class CMissionCleanup
|
||||||
{
|
{
|
||||||
CMissionCleanupEntity m_sEntities[MAX_CLEANUP];
|
public:
|
||||||
|
cleanup_entity_struct m_sEntities[MAX_CLEANUP];
|
||||||
uint8 m_nCount;
|
uint8 m_nCount;
|
||||||
|
|
||||||
public:
|
|
||||||
CMissionCleanup();
|
CMissionCleanup();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
CMissionCleanupEntity* FindFree();
|
cleanup_entity_struct* FindFree();
|
||||||
void AddEntityToList(int32, uint8);
|
void AddEntityToList(int32, uint8);
|
||||||
void RemoveEntityFromList(int32, uint8);
|
void RemoveEntityFromList(int32, uint8);
|
||||||
void Process();
|
void Process();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct CUpsideDownCarCheckEntry
|
struct upsidedown_car_data
|
||||||
{
|
{
|
||||||
int32 m_nVehicleIndex;
|
int32 m_nVehicleIndex;
|
||||||
uint32 m_nUpsideDownTimer;
|
uint32 m_nUpsideDownTimer;
|
||||||
@ -169,11 +175,12 @@ struct CUpsideDownCarCheckEntry
|
|||||||
|
|
||||||
class CUpsideDownCarCheck
|
class CUpsideDownCarCheck
|
||||||
{
|
{
|
||||||
CUpsideDownCarCheckEntry m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
|
upsidedown_car_data m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void Init();
|
void Init();
|
||||||
bool IsCarUpsideDown(int32);
|
bool IsCarUpsideDown(int32);
|
||||||
|
bool IsCarUpsideDown(CVehicle*);
|
||||||
void UpdateTimers();
|
void UpdateTimers();
|
||||||
bool AreAnyCarsUpsideDown();
|
bool AreAnyCarsUpsideDown();
|
||||||
void AddCarToCheck(int32);
|
void AddCarToCheck(int32);
|
||||||
@ -191,7 +198,7 @@ struct stuck_car_data
|
|||||||
bool m_bStuck;
|
bool m_bStuck;
|
||||||
|
|
||||||
stuck_car_data() { }
|
stuck_car_data() { }
|
||||||
inline void Reset();
|
void Reset();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CStuckCarCheck
|
class CStuckCarCheck
|
||||||
@ -240,6 +247,156 @@ struct tBuildingSwap
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
enum {
|
||||||
|
#if GTA_VERSION > GTA3_PS2_160
|
||||||
|
MAX_STACK_DEPTH = 6,
|
||||||
|
#else
|
||||||
|
MAX_STACK_DEPTH = 4,
|
||||||
|
#endif
|
||||||
|
NUM_LOCAL_VARS = 16,
|
||||||
|
NUM_TIMERS = 2
|
||||||
|
};
|
||||||
|
|
||||||
|
class CRunningScript
|
||||||
|
{
|
||||||
|
enum {
|
||||||
|
ANDOR_NONE = 0,
|
||||||
|
ANDS_1 = 1,
|
||||||
|
ANDS_2,
|
||||||
|
ANDS_3,
|
||||||
|
ANDS_4,
|
||||||
|
ANDS_5,
|
||||||
|
ANDS_6,
|
||||||
|
ANDS_7,
|
||||||
|
ANDS_8,
|
||||||
|
ORS_1 = 21,
|
||||||
|
ORS_2,
|
||||||
|
ORS_3,
|
||||||
|
ORS_4,
|
||||||
|
ORS_5,
|
||||||
|
ORS_6,
|
||||||
|
ORS_7,
|
||||||
|
ORS_8
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
CRunningScript* next;
|
||||||
|
CRunningScript* prev;
|
||||||
|
char m_abScriptName[8];
|
||||||
|
uint32 m_nIp;
|
||||||
|
uint32 m_anStack[MAX_STACK_DEPTH];
|
||||||
|
uint16 m_nStackPointer;
|
||||||
|
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
|
||||||
|
bool m_bCondResult;
|
||||||
|
bool m_bIsMissionScript;
|
||||||
|
bool m_bSkipWakeTime;
|
||||||
|
uint32 m_nWakeTime;
|
||||||
|
uint16 m_nAndOrState;
|
||||||
|
bool m_bNotFlag;
|
||||||
|
bool m_bDeatharrestEnabled;
|
||||||
|
bool m_bDeatharrestExecuted;
|
||||||
|
bool m_bMissionFlag;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void SetIP(uint32 ip) { m_nIp = ip; }
|
||||||
|
CRunningScript* GetNext() const { return next; }
|
||||||
|
|
||||||
|
void Save(uint8*& buf);
|
||||||
|
void Load(uint8*& buf);
|
||||||
|
|
||||||
|
void UpdateTimers(float timeStep) {
|
||||||
|
m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
|
||||||
|
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Init();
|
||||||
|
void Process();
|
||||||
|
|
||||||
|
void RemoveScriptFromList(CRunningScript**);
|
||||||
|
void AddScriptToList(CRunningScript**);
|
||||||
|
|
||||||
|
static const uint32 nSaveStructSize;
|
||||||
|
|
||||||
|
void CollectParameters(uint32*, int16);
|
||||||
|
int32 CollectNextParameterWithoutIncreasingPC(uint32);
|
||||||
|
int32* GetPointerToScriptVariable(uint32*, int16);
|
||||||
|
void StoreParameters(uint32*, int16);
|
||||||
|
|
||||||
|
int8 ProcessOneCommand();
|
||||||
|
void DoDeatharrestCheck();
|
||||||
|
void UpdateCompareFlag(bool);
|
||||||
|
int16 GetPadState(uint16, uint16);
|
||||||
|
|
||||||
|
int8 ProcessCommands0To99(int32);
|
||||||
|
int8 ProcessCommands100To199(int32);
|
||||||
|
int8 ProcessCommands200To299(int32);
|
||||||
|
int8 ProcessCommands300To399(int32);
|
||||||
|
int8 ProcessCommands400To499(int32);
|
||||||
|
int8 ProcessCommands500To599(int32);
|
||||||
|
int8 ProcessCommands600To699(int32);
|
||||||
|
int8 ProcessCommands700To799(int32);
|
||||||
|
int8 ProcessCommands800To899(int32);
|
||||||
|
int8 ProcessCommands900To999(int32);
|
||||||
|
int8 ProcessCommands1000To1099(int32);
|
||||||
|
#if GTA_VERSION > GTA3_PS2_160
|
||||||
|
int8 ProcessCommands1100To1199(int32);
|
||||||
|
#endif
|
||||||
|
void LocatePlayerCommand(int32, uint32*);
|
||||||
|
void LocatePlayerCharCommand(int32, uint32*);
|
||||||
|
void LocatePlayerCarCommand(int32, uint32*);
|
||||||
|
void LocateCharCommand(int32, uint32*);
|
||||||
|
void LocateCharCharCommand(int32, uint32*);
|
||||||
|
void LocateCharCarCommand(int32, uint32*);
|
||||||
|
void LocateCharObjectCommand(int32, uint32*);
|
||||||
|
void LocateCarCommand(int32, uint32*);
|
||||||
|
void LocateSniperBulletCommand(int32, uint32*);
|
||||||
|
void PlayerInAreaCheckCommand(int32, uint32*);
|
||||||
|
void PlayerInAngledAreaCheckCommand(int32, uint32*);
|
||||||
|
void CharInAreaCheckCommand(int32, uint32*);
|
||||||
|
void CarInAreaCheckCommand(int32, uint32*);
|
||||||
|
|
||||||
|
#ifdef GTA_SCRIPT_COLLECTIVE
|
||||||
|
void LocateCollectiveCommand(int32, uint32*);
|
||||||
|
void LocateCollectiveCharCommand(int32, uint32*);
|
||||||
|
void LocateCollectiveCarCommand(int32, uint32*);
|
||||||
|
void LocateCollectivePlayerCommand(int32, uint32*);
|
||||||
|
void CollectiveInAreaCheckCommand(int32, uint32*);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MISSION_REPLAY
|
||||||
|
bool CanAllowMissionReplay();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||||
|
int CollectParameterForDebug(char* buf, bool& var);
|
||||||
|
void GetStoredParameterForDebug(char* buf);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
|
||||||
|
|
||||||
|
bool ThisIsAValidRandomPed(uint32 pedtype) {
|
||||||
|
switch (pedtype) {
|
||||||
|
case PEDTYPE_CIVMALE:
|
||||||
|
case PEDTYPE_CIVFEMALE:
|
||||||
|
case PEDTYPE_GANG1:
|
||||||
|
case PEDTYPE_GANG2:
|
||||||
|
case PEDTYPE_GANG3:
|
||||||
|
case PEDTYPE_GANG4:
|
||||||
|
case PEDTYPE_GANG5:
|
||||||
|
case PEDTYPE_GANG6:
|
||||||
|
case PEDTYPE_GANG7:
|
||||||
|
case PEDTYPE_GANG8:
|
||||||
|
case PEDTYPE_GANG9:
|
||||||
|
case PEDTYPE_CRIMINAL:
|
||||||
|
case PEDTYPE_PROSTITUTE:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
VAR_LOCAL = 1,
|
VAR_LOCAL = 1,
|
||||||
VAR_GLOBAL = 2,
|
VAR_GLOBAL = 2,
|
||||||
@ -268,6 +425,7 @@ enum {
|
|||||||
|
|
||||||
class CTheScripts
|
class CTheScripts
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
|
static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
|
||||||
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
|
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
|
||||||
static int32 BaseBriefIdForContact[MAX_NUM_CONTACTS];
|
static int32 BaseBriefIdForContact[MAX_NUM_CONTACTS];
|
||||||
@ -284,7 +442,7 @@ class CTheScripts
|
|||||||
static CStoredLine aStoredLines[MAX_NUM_STORED_LINES];
|
static CStoredLine aStoredLines[MAX_NUM_STORED_LINES];
|
||||||
static bool DbgFlag;
|
static bool DbgFlag;
|
||||||
static uint32 OnAMissionFlag;
|
static uint32 OnAMissionFlag;
|
||||||
static CMissionCleanup MissionCleanup;
|
static CMissionCleanup MissionCleanUp;
|
||||||
static CStuckCarCheck StuckCars;
|
static CStuckCarCheck StuckCars;
|
||||||
static CUpsideDownCarCheck UpsideDownCars;
|
static CUpsideDownCarCheck UpsideDownCars;
|
||||||
static int32 StoreVehicleIndex;
|
static int32 StoreVehicleIndex;
|
||||||
@ -309,7 +467,6 @@ class CTheScripts
|
|||||||
static uint16 CommandsExecuted;
|
static uint16 CommandsExecuted;
|
||||||
static uint16 ScriptsUpdated;
|
static uint16 ScriptsUpdated;
|
||||||
|
|
||||||
public:
|
|
||||||
static void Init();
|
static void Init();
|
||||||
static void Process();
|
static void Process();
|
||||||
|
|
||||||
@ -366,8 +523,6 @@ public:
|
|||||||
return Read4BytesFromScript(&tmp);
|
return Read4BytesFromScript(&tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
static CRunningScript* StartNewScript(uint32);
|
static CRunningScript* StartNewScript(uint32);
|
||||||
|
|
||||||
static void CleanUpThisVehicle(CVehicle*);
|
static void CleanUpThisVehicle(CVehicle*);
|
||||||
@ -417,167 +572,12 @@ private:
|
|||||||
static void SetObjectiveForAllPedsInCollective(int, eObjective);
|
static void SetObjectiveForAllPedsInCollective(int, eObjective);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
friend class CRunningScript;
|
|
||||||
friend class CHud;
|
|
||||||
friend void CMissionCleanup::Process();
|
|
||||||
#ifdef MISSION_REPLAY
|
|
||||||
friend void RetryMission(int, int);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MISSION_SWITCHER
|
#ifdef MISSION_SWITCHER
|
||||||
public:
|
public:
|
||||||
static void SwitchToMission(int32 mission);
|
static void SwitchToMission(int32 mission);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum {
|
|
||||||
MAX_STACK_DEPTH = 6, // 4 PS2
|
|
||||||
NUM_LOCAL_VARS = 16,
|
|
||||||
NUM_TIMERS = 2
|
|
||||||
};
|
|
||||||
|
|
||||||
class CRunningScript
|
|
||||||
{
|
|
||||||
enum {
|
|
||||||
ANDOR_NONE = 0,
|
|
||||||
ANDS_1 = 1,
|
|
||||||
ANDS_2,
|
|
||||||
ANDS_3,
|
|
||||||
ANDS_4,
|
|
||||||
ANDS_5,
|
|
||||||
ANDS_6,
|
|
||||||
ANDS_7,
|
|
||||||
ANDS_8,
|
|
||||||
ORS_1 = 21,
|
|
||||||
ORS_2,
|
|
||||||
ORS_3,
|
|
||||||
ORS_4,
|
|
||||||
ORS_5,
|
|
||||||
ORS_6,
|
|
||||||
ORS_7,
|
|
||||||
ORS_8
|
|
||||||
};
|
|
||||||
|
|
||||||
CRunningScript* next;
|
|
||||||
CRunningScript* prev;
|
|
||||||
char m_abScriptName[8];
|
|
||||||
uint32 m_nIp;
|
|
||||||
uint32 m_anStack[MAX_STACK_DEPTH];
|
|
||||||
uint16 m_nStackPointer;
|
|
||||||
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
|
|
||||||
bool m_bCondResult;
|
|
||||||
bool m_bIsMissionScript;
|
|
||||||
bool m_bSkipWakeTime;
|
|
||||||
uint32 m_nWakeTime;
|
|
||||||
uint16 m_nAndOrState;
|
|
||||||
bool m_bNotFlag;
|
|
||||||
bool m_bDeatharrestEnabled;
|
|
||||||
bool m_bDeatharrestExecuted;
|
|
||||||
bool m_bMissionFlag;
|
|
||||||
|
|
||||||
public:
|
|
||||||
void SetIP(uint32 ip) { m_nIp = ip; }
|
|
||||||
CRunningScript* GetNext() const { return next; }
|
|
||||||
|
|
||||||
void Save(uint8*& buf);
|
|
||||||
void Load(uint8*& buf);
|
|
||||||
|
|
||||||
void UpdateTimers(float timeStep) {
|
|
||||||
m_anLocalVariables[NUM_LOCAL_VARS] += timeStep;
|
|
||||||
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Init();
|
|
||||||
void Process();
|
|
||||||
|
|
||||||
void RemoveScriptFromList(CRunningScript**);
|
|
||||||
void AddScriptToList(CRunningScript**);
|
|
||||||
|
|
||||||
static const uint32 nSaveStructSize;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void CollectParameters(uint32*, int16);
|
|
||||||
int32 CollectNextParameterWithoutIncreasingPC(uint32);
|
|
||||||
int32* GetPointerToScriptVariable(uint32*, int16);
|
|
||||||
void StoreParameters(uint32*, int16);
|
|
||||||
|
|
||||||
int8 ProcessOneCommand();
|
|
||||||
void DoDeatharrestCheck();
|
|
||||||
void UpdateCompareFlag(bool);
|
|
||||||
int16 GetPadState(uint16, uint16);
|
|
||||||
|
|
||||||
int8 ProcessCommands0To99(int32);
|
|
||||||
int8 ProcessCommands100To199(int32);
|
|
||||||
int8 ProcessCommands200To299(int32);
|
|
||||||
int8 ProcessCommands300To399(int32);
|
|
||||||
int8 ProcessCommands400To499(int32);
|
|
||||||
int8 ProcessCommands500To599(int32);
|
|
||||||
int8 ProcessCommands600To699(int32);
|
|
||||||
int8 ProcessCommands700To799(int32);
|
|
||||||
int8 ProcessCommands800To899(int32);
|
|
||||||
int8 ProcessCommands900To999(int32);
|
|
||||||
int8 ProcessCommands1000To1099(int32);
|
|
||||||
#ifndef GTA_PS2
|
|
||||||
int8 ProcessCommands1100To1199(int32);
|
|
||||||
#endif
|
|
||||||
void LocatePlayerCommand(int32, uint32*);
|
|
||||||
void LocatePlayerCharCommand(int32, uint32*);
|
|
||||||
void LocatePlayerCarCommand(int32, uint32*);
|
|
||||||
void LocateCharCommand(int32, uint32*);
|
|
||||||
void LocateCharCharCommand(int32, uint32*);
|
|
||||||
void LocateCharCarCommand(int32, uint32*);
|
|
||||||
void LocateCharObjectCommand(int32, uint32*);
|
|
||||||
void LocateCarCommand(int32, uint32*);
|
|
||||||
void LocateSniperBulletCommand(int32, uint32*);
|
|
||||||
void PlayerInAreaCheckCommand(int32, uint32*);
|
|
||||||
void PlayerInAngledAreaCheckCommand(int32, uint32*);
|
|
||||||
void CharInAreaCheckCommand(int32, uint32*);
|
|
||||||
void CarInAreaCheckCommand(int32, uint32*);
|
|
||||||
|
|
||||||
#ifdef GTA_SCRIPT_COLLECTIVE
|
|
||||||
void LocateCollectiveCommand(int32, uint32*);
|
|
||||||
void LocateCollectiveCharCommand(int32, uint32*);
|
|
||||||
void LocateCollectiveCarCommand(int32, uint32*);
|
|
||||||
void LocateCollectivePlayerCommand(int32, uint32*);
|
|
||||||
void CollectiveInAreaCheckCommand(int32, uint32*);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef MISSION_REPLAY
|
|
||||||
bool CanAllowMissionReplay();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
|
||||||
int CollectParameterForDebug(char* buf, bool& var);
|
|
||||||
void GetStoredParameterForDebug(char* buf);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
|
|
||||||
|
|
||||||
bool ThisIsAValidRandomPed(uint32 pedtype) {
|
|
||||||
switch (pedtype) {
|
|
||||||
case PEDTYPE_CIVMALE:
|
|
||||||
case PEDTYPE_CIVFEMALE:
|
|
||||||
case PEDTYPE_GANG1:
|
|
||||||
case PEDTYPE_GANG2:
|
|
||||||
case PEDTYPE_GANG3:
|
|
||||||
case PEDTYPE_GANG4:
|
|
||||||
case PEDTYPE_GANG5:
|
|
||||||
case PEDTYPE_GANG6:
|
|
||||||
case PEDTYPE_GANG7:
|
|
||||||
case PEDTYPE_GANG8:
|
|
||||||
case PEDTYPE_GANG9:
|
|
||||||
case PEDTYPE_CRIMINAL:
|
|
||||||
case PEDTYPE_PROSTITUTE:
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
friend class CTheScripts;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef MISSION_REPLAY
|
#ifdef MISSION_REPLAY
|
||||||
extern int AllowMissionReplay;
|
extern int AllowMissionReplay;
|
||||||
extern uint32 WaitForMissionActivate;
|
extern uint32 WaitForMissionActivate;
|
||||||
|
@ -1033,7 +1033,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
||||||
script_assert(pPed);
|
script_assert(pPed);
|
||||||
ScriptParams[0] = pPed->m_pWanted->m_nWantedLevel;
|
ScriptParams[0] = pPed->m_pWanted->GetWantedLevel();
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1051,7 +1051,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||||
CTheScripts::CleanUpThisPed(pPed);
|
CTheScripts::CleanUpThisPed(pPed);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_MARK_CAR_AS_NO_LONGER_NEEDED:
|
case COMMAND_MARK_CAR_AS_NO_LONGER_NEEDED:
|
||||||
@ -1060,7 +1060,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||||
CTheScripts::CleanUpThisVehicle(pVehicle);
|
CTheScripts::CleanUpThisVehicle(pVehicle);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_MARK_OBJECT_AS_NO_LONGER_NEEDED:
|
case COMMAND_MARK_OBJECT_AS_NO_LONGER_NEEDED:
|
||||||
@ -1069,7 +1069,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
|
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
|
||||||
CTheScripts::CleanUpThisObject(pObject);
|
CTheScripts::CleanUpThisObject(pObject);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_DONT_REMOVE_CHAR:
|
case COMMAND_DONT_REMOVE_CHAR:
|
||||||
@ -1077,7 +1077,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||||
script_assert(pPed);
|
script_assert(pPed);
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_DONT_REMOVE_CAR:
|
case COMMAND_DONT_REMOVE_CAR:
|
||||||
@ -1085,7 +1085,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||||
script_assert(pVehicle);
|
script_assert(pVehicle);
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_DONT_REMOVE_OBJECT:
|
case COMMAND_DONT_REMOVE_OBJECT:
|
||||||
@ -1093,7 +1093,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
|
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
|
||||||
script_assert(pObject);
|
script_assert(pObject);
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_CREATE_CHAR_AS_PASSENGER:
|
case COMMAND_CREATE_CHAR_AS_PASSENGER:
|
||||||
@ -1165,7 +1165,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
|||||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
|
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_CHAR_OBJ_KILL_CHAR_ON_FOOT:
|
case COMMAND_SET_CHAR_OBJ_KILL_CHAR_ON_FOOT:
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "WaterLevel.h"
|
#include "WaterLevel.h"
|
||||||
#include "Weather.h"
|
#include "Weather.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
|
#include "Wanted.h"
|
||||||
|
|
||||||
int8 CRunningScript::ProcessCommands500To599(int32 command)
|
int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||||
{
|
{
|
||||||
@ -342,7 +343,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CGarages::SetFreeBombs(ScriptParams[0] != 0);
|
CGarages::SetFreeBombs(ScriptParams[0] != 0);
|
||||||
return 0;
|
return 0;
|
||||||
#ifdef GTA_PS2
|
#if GTA_VERSION <= GTA3_PS2_160
|
||||||
case COMMAND_SET_POWERPOINT:
|
case COMMAND_SET_POWERPOINT:
|
||||||
{
|
{
|
||||||
CollectParameters(&m_nIp, 7);
|
CollectParameters(&m_nIp, 7);
|
||||||
@ -376,7 +377,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif // GTA_PS2
|
#endif // GTA_VERSION <= GTA3_PS2_160
|
||||||
case COMMAND_SET_ALL_TAXI_LIGHTS:
|
case COMMAND_SET_ALL_TAXI_LIGHTS:
|
||||||
CollectParameters(&m_nIp, 1);
|
CollectParameters(&m_nIp, 1);
|
||||||
CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0);
|
CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0);
|
||||||
@ -1263,7 +1264,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
|
|||||||
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
|
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
|
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_IS_BOAT:
|
case COMMAND_IS_BOAT:
|
||||||
@ -1799,7 +1800,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||||||
pPed->bRespondsToThreats = false;
|
pPed->bRespondsToThreats = false;
|
||||||
++CPopulation::ms_nTotalMissionPeds;
|
++CPopulation::ms_nTotalMissionPeds;
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||||
}
|
}
|
||||||
ScriptParams[0] = ped_handle;
|
ScriptParams[0] = ped_handle;
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
@ -1848,7 +1849,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
|||||||
pPed->bRespondsToThreats = false;
|
pPed->bRespondsToThreats = false;
|
||||||
++CPopulation::ms_nTotalMissionPeds;
|
++CPopulation::ms_nTotalMissionPeds;
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||||
}
|
}
|
||||||
ScriptParams[0] = ped_handle;
|
ScriptParams[0] = ped_handle;
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
#include "WaterLevel.h"
|
#include "WaterLevel.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
|
#include "Wanted.h"
|
||||||
|
|
||||||
int8 CRunningScript::ProcessCommands800To899(int32 command)
|
int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||||
{
|
{
|
||||||
@ -148,7 +149,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
++CCarCtrl::NumMissionCars;
|
++CCarCtrl::NumMissionCars;
|
||||||
--CCarCtrl::NumRandomCars;
|
--CCarCtrl::NumRandomCars;
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
|
||||||
}
|
}
|
||||||
ScriptParams[0] = handle;
|
ScriptParams[0] = handle;
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
@ -180,7 +181,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
++CCarCtrl::NumMissionCars;
|
++CCarCtrl::NumMissionCars;
|
||||||
--CCarCtrl::NumRandomCars;
|
--CCarCtrl::NumRandomCars;
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
|
||||||
}
|
}
|
||||||
ScriptParams[0] = handle;
|
ScriptParams[0] = handle;
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
@ -594,7 +595,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_CHAR_STAY_IN_SAME_PLACE:
|
case COMMAND_SET_CHAR_STAY_IN_SAME_PLACE:
|
||||||
@ -1002,7 +1003,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
|||||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
|
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR:
|
case COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR:
|
||||||
@ -1417,7 +1418,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
|||||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||||
script_assert(pVehicle);
|
script_assert(pVehicle);
|
||||||
const CVector& pos = pVehicle->GetPosition();
|
const CVector& pos = pVehicle->GetPosition();
|
||||||
float heading = CGeneral::GetATanOfXY(pos.y - *(float*)&ScriptParams[2], pos.x - *(float*)&ScriptParams[1]) + HALFPI;
|
float heading = CGeneral::GetATanOfXY(pos.x - *(float*)&ScriptParams[1], pos.y - *(float*)&ScriptParams[2]) + HALFPI;
|
||||||
if (heading > TWOPI)
|
if (heading > TWOPI)
|
||||||
heading -= TWOPI;
|
heading -= TWOPI;
|
||||||
pVehicle->SetHeading(heading);
|
pVehicle->SetHeading(heading);
|
||||||
|
@ -2075,6 +2075,80 @@ VALIDATESAVEBUF(size)
|
|||||||
|
|
||||||
#undef SCRIPT_DATA_SIZE
|
#undef SCRIPT_DATA_SIZE
|
||||||
|
|
||||||
|
void CRunningScript::Save(uint8*& buf)
|
||||||
|
{
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
SkipSaveBuf(buf, 8);
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
WriteSaveBuf<char>(buf, m_abScriptName[i]);
|
||||||
|
WriteSaveBuf<uint32>(buf, m_nIp);
|
||||||
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
|
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||||
|
WriteSaveBuf<uint32>(buf, m_anStack[i]);
|
||||||
|
WriteSaveBuf<uint16>(buf, m_nStackPointer);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
|
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||||
|
WriteSaveBuf<int32>(buf, m_anLocalVariables[i]);
|
||||||
|
WriteSaveBuf<bool>(buf, m_bCondResult);
|
||||||
|
WriteSaveBuf<bool>(buf, m_bIsMissionScript);
|
||||||
|
WriteSaveBuf<bool>(buf, m_bSkipWakeTime);
|
||||||
|
SkipSaveBuf(buf, 1);
|
||||||
|
WriteSaveBuf<uint32>(buf, m_nWakeTime);
|
||||||
|
WriteSaveBuf<uint16>(buf, m_nAndOrState);
|
||||||
|
WriteSaveBuf<bool>(buf, m_bNotFlag);
|
||||||
|
WriteSaveBuf<bool>(buf, m_bDeatharrestEnabled);
|
||||||
|
WriteSaveBuf<bool>(buf, m_bDeatharrestExecuted);
|
||||||
|
WriteSaveBuf<bool>(buf, m_bMissionFlag);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
#else
|
||||||
|
WriteSaveBuf(buf, *this);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRunningScript::Load(uint8*& buf)
|
||||||
|
{
|
||||||
|
#ifdef COMPATIBLE_SAVES
|
||||||
|
SkipSaveBuf(buf, 8);
|
||||||
|
for (int i = 0; i < 8; i++)
|
||||||
|
m_abScriptName[i] = ReadSaveBuf<char>(buf);
|
||||||
|
m_nIp = ReadSaveBuf<uint32>(buf);
|
||||||
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
|
static_assert(MAX_STACK_DEPTH == 6, "Compatibility loss: MAX_STACK_DEPTH != 6");
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < MAX_STACK_DEPTH; i++)
|
||||||
|
m_anStack[i] = ReadSaveBuf<uint32>(buf);
|
||||||
|
m_nStackPointer = ReadSaveBuf<uint16>(buf);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
|
static_assert(NUM_LOCAL_VARS + NUM_TIMERS == 18, "Compatibility loss: NUM_LOCAL_VARS + NUM_TIMERS != 18");
|
||||||
|
#endif
|
||||||
|
for (int i = 0; i < NUM_LOCAL_VARS + NUM_TIMERS; i++)
|
||||||
|
m_anLocalVariables[i] = ReadSaveBuf<int32>(buf);
|
||||||
|
m_bCondResult = ReadSaveBuf<bool>(buf);
|
||||||
|
m_bIsMissionScript = ReadSaveBuf<bool>(buf);
|
||||||
|
m_bSkipWakeTime = ReadSaveBuf<bool>(buf);
|
||||||
|
SkipSaveBuf(buf, 1);
|
||||||
|
m_nWakeTime = ReadSaveBuf<uint32>(buf);
|
||||||
|
m_nAndOrState = ReadSaveBuf<uint16>(buf);
|
||||||
|
m_bNotFlag = ReadSaveBuf<bool>(buf);
|
||||||
|
m_bDeatharrestEnabled = ReadSaveBuf<bool>(buf);
|
||||||
|
m_bDeatharrestExecuted = ReadSaveBuf<bool>(buf);
|
||||||
|
m_bMissionFlag = ReadSaveBuf<bool>(buf);
|
||||||
|
SkipSaveBuf(buf, 2);
|
||||||
|
#else
|
||||||
|
CRunningScript* n = next;
|
||||||
|
CRunningScript* p = prev;
|
||||||
|
*this = ReadSaveBuf<CRunningScript>(buf);
|
||||||
|
next = n;
|
||||||
|
prev = p;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntity)
|
void CTheScripts::ClearSpaceForMissionEntity(const CVector& pos, CEntity* pEntity)
|
||||||
{
|
{
|
||||||
static CColPoint aTempColPoints[MAX_COLLISION_POINTS];
|
static CColPoint aTempColPoints[MAX_COLLISION_POINTS];
|
||||||
@ -2281,7 +2355,7 @@ int CTheScripts::FindFreeSlotInCollectiveArray()
|
|||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
@ -2298,7 +2372,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
|||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1, float p2)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
@ -2315,7 +2389,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
|||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
@ -2332,7 +2406,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
|||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
@ -2349,7 +2423,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
|||||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
|
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
for (int i = 0; i < MAX_NUM_COLLECTIVES; i++) {
|
||||||
if (CollectiveArray[i].colIndex = colIndex) {
|
if (CollectiveArray[i].colIndex == colIndex) {
|
||||||
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
CPed* pPed = CPools::GetPedPool()->GetAt(CollectiveArray[i].pedIndex);
|
||||||
if (pPed == nil) {
|
if (pPed == nil) {
|
||||||
CollectiveArray[i].colIndex = -1;
|
CollectiveArray[i].colIndex = -1;
|
||||||
@ -2368,7 +2442,7 @@ bool CTheScripts::IsPedStopped(CPed* pPed)
|
|||||||
{
|
{
|
||||||
if (pPed->bInVehicle)
|
if (pPed->bInVehicle)
|
||||||
return IsVehicleStopped(pPed->m_pMyVehicle);
|
return IsVehicleStopped(pPed->m_pMyVehicle);
|
||||||
return pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL;
|
return pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
|
bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
|
||||||
@ -2381,7 +2455,7 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
|
|||||||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
|
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
|
||||||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
|
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
|
||||||
return false;
|
return false;
|
||||||
return pPed->m_nMoveState == eMoveState::PEDMOVE_NONE || pPed->m_nMoveState == eMoveState::PEDMOVE_STILL;
|
return pPed->m_nMoveState == PEDMOVE_NONE || pPed->m_nMoveState == PEDMOVE_STILL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CTheScripts::IsVehicleStopped(CVehicle* pVehicle)
|
bool CTheScripts::IsVehicleStopped(CVehicle* pVehicle)
|
||||||
@ -2482,7 +2556,7 @@ void CTheScripts::UpdateObjectIndices()
|
|||||||
CBaseModelInfo* pModel = CModelInfo::GetModelInfo(j);
|
CBaseModelInfo* pModel = CModelInfo::GetModelInfo(j);
|
||||||
if (!pModel)
|
if (!pModel)
|
||||||
continue;
|
continue;
|
||||||
strcpy(name, pModel->GetName());
|
strcpy(name, pModel->GetModelName());
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
|
for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
|
||||||
#else
|
#else
|
||||||
|
@ -33,9 +33,12 @@
|
|||||||
#include "Zones.h"
|
#include "Zones.h"
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
|
|
||||||
|
// NB: on PS2 this file did not exist; ProcessCommands1000To1099 was in Script5.cpp and ProcessCommands1100To1199 was only added on PC
|
||||||
|
// however to avoid redundant copies of code, Script6.cpp is used with PS2 defines
|
||||||
|
|
||||||
int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||||
{
|
{
|
||||||
#ifdef GTA_PS2
|
#if GTA_VERSION <= GTA3_PS2_160
|
||||||
char tmp[48];
|
char tmp[48];
|
||||||
#endif
|
#endif
|
||||||
switch (command) {
|
switch (command) {
|
||||||
@ -423,7 +426,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||||||
#ifdef USE_MEASUREMENTS_IN_METERS
|
#ifdef USE_MEASUREMENTS_IN_METERS
|
||||||
UpdateCompareFlag(true);
|
UpdateCompareFlag(true);
|
||||||
#else
|
#else
|
||||||
UpdateCompareFlag(false)
|
UpdateCompareFlag(false);
|
||||||
#endif
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
case COMMAND_CONVERT_METRES_TO_FEET:
|
case COMMAND_CONVERT_METRES_TO_FEET:
|
||||||
@ -604,7 +607,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||||||
ScriptParams[0] = CPools::GetVehiclePool()->GetIndex(pVehicle);
|
ScriptParams[0] = CPools::GetVehiclePool()->GetIndex(pVehicle);
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CAR);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case COMMAND_START_BOAT_FOAM_ANIMATION:
|
case COMMAND_START_BOAT_FOAM_ANIMATION:
|
||||||
@ -746,7 +749,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
|||||||
pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER);
|
pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#ifndef GTA_PS2
|
#if GTA_VERSION > GTA3_PS2_160
|
||||||
default:
|
default:
|
||||||
script_assert(0);
|
script_assert(0);
|
||||||
}
|
}
|
||||||
@ -838,8 +841,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||||||
case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA:
|
case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA:
|
||||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
|
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
|
||||||
return 0;
|
return 0;
|
||||||
#ifndef GTA_PS2
|
#if GTA_VERSION > GTA3_PS2_160
|
||||||
// To be precise, on PS2 previous handlers were in 1000-1099 function
|
|
||||||
// These are "beta" VC commands (with bugs)
|
// These are "beta" VC commands (with bugs)
|
||||||
case COMMAND_SET_OBJECT_ROTATION:
|
case COMMAND_SET_OBJECT_ROTATION:
|
||||||
{
|
{
|
||||||
@ -1119,7 +1121,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||||||
pPed->bRespondsToThreats = false;
|
pPed->bRespondsToThreats = false;
|
||||||
++CPopulation::ms_nTotalMissionPeds;
|
++CPopulation::ms_nTotalMissionPeds;
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||||
}
|
}
|
||||||
ScriptParams[0] = ped_handle;
|
ScriptParams[0] = ped_handle;
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
@ -1166,7 +1168,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
|||||||
pPed->bRespondsToThreats = false;
|
pPed->bRespondsToThreats = false;
|
||||||
++CPopulation::ms_nTotalMissionPeds;
|
++CPopulation::ms_nTotalMissionPeds;
|
||||||
if (m_bIsMissionScript)
|
if (m_bIsMissionScript)
|
||||||
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||||
}
|
}
|
||||||
ScriptParams[0] = ped_handle;
|
ScriptParams[0] = ped_handle;
|
||||||
StoreParameters(&m_nIp, 1);
|
StoreParameters(&m_nIp, 1);
|
||||||
|
@ -1108,7 +1108,7 @@ enum {
|
|||||||
COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER,
|
COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER,
|
||||||
COMMAND_LOAD_END_OF_GAME_TUNE,
|
COMMAND_LOAD_END_OF_GAME_TUNE,
|
||||||
COMMAND_ENABLE_PLAYER_CONTROL_CAMERA,
|
COMMAND_ENABLE_PLAYER_CONTROL_CAMERA,
|
||||||
#ifndef GTA_PS2
|
#if GTA_VERSION > GTA3_PS2_160
|
||||||
COMMAND_SET_OBJECT_ROTATION,
|
COMMAND_SET_OBJECT_ROTATION,
|
||||||
COMMAND_GET_DEBUG_CAMERA_COORDINATES,
|
COMMAND_GET_DEBUG_CAMERA_COORDINATES,
|
||||||
COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR,
|
COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR,
|
||||||
|
@ -193,7 +193,7 @@ CCam::Process(void)
|
|||||||
break;
|
break;
|
||||||
case MODE_CAM_ON_A_STRING:
|
case MODE_CAM_ON_A_STRING:
|
||||||
#ifdef FREE_CAM
|
#ifdef FREE_CAM
|
||||||
if(CCamera::bFreeCam)
|
if(CCamera::bFreeCam && !CVehicle::bCheat5)
|
||||||
Process_FollowCar_SA(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
|
Process_FollowCar_SA(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
@ -946,7 +946,7 @@ CVector
|
|||||||
CCam::DoAverageOnVector(const CVector &vec)
|
CCam::DoAverageOnVector(const CVector &vec)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
CVector Average = { 0.0f, 0.0f, 0.0f };
|
CVector Average(0.0f, 0.0f, 0.0f);
|
||||||
|
|
||||||
if(ResetStatics){
|
if(ResetStatics){
|
||||||
m_iRunningVectorArrayPos = 0;
|
m_iRunningVectorArrayPos = 0;
|
||||||
@ -3829,11 +3829,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stay inside sectors
|
// stay inside sectors
|
||||||
while(CWorld::GetSectorX(Source.x) > 95.0f)
|
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||||
Source.x -= 1.0f;
|
Source.x -= 1.0f;
|
||||||
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
||||||
Source.x += 1.0f;
|
Source.x += 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) > 95.0f)
|
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
|
||||||
Source.y -= 1.0f;
|
Source.y -= 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
||||||
Source.y += 1.0f;
|
Source.y += 1.0f;
|
||||||
@ -3900,11 +3900,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stay inside sectors
|
// stay inside sectors
|
||||||
while(CWorld::GetSectorX(Source.x) > 95.0f)
|
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||||
Source.x -= 1.0f;
|
Source.x -= 1.0f;
|
||||||
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
||||||
Source.x += 1.0f;
|
Source.x += 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) > 95.0f)
|
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
|
||||||
Source.y -= 1.0f;
|
Source.y -= 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
||||||
Source.y += 1.0f;
|
Source.y += 1.0f;
|
||||||
@ -3981,11 +3981,11 @@ CCam::Process_Editor(const CVector&, float, float, float)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// stay inside sectors
|
// stay inside sectors
|
||||||
while(CWorld::GetSectorX(Source.x) > 95.0f)
|
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||||
Source.x -= 1.0f;
|
Source.x -= 1.0f;
|
||||||
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
while(CWorld::GetSectorX(Source.x) < 5.0f)
|
||||||
Source.x += 1.0f;
|
Source.x += 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) > 95.0f)
|
while(CWorld::GetSectorY(Source.y) > NUMSECTORS_X-5.0f)
|
||||||
Source.y -= 1.0f;
|
Source.y -= 1.0f;
|
||||||
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
||||||
Source.y += 1.0f;
|
Source.y += 1.0f;
|
||||||
@ -5039,11 +5039,15 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
|
|||||||
|
|
||||||
// Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA
|
// Using GetCarGun(LR/UD) will give us same unprocessed RightStick value as SA
|
||||||
float stickX = -(pad->GetCarGunLeftRight());
|
float stickX = -(pad->GetCarGunLeftRight());
|
||||||
float stickY = pad->GetCarGunUpDown();
|
float stickY = -pad->GetCarGunUpDown();
|
||||||
|
|
||||||
// In SA this is for not let num2/num8 move camera when Keyboard & Mouse controls are used.
|
// In SA this is for not let num2/num8 move camera when Keyboard & Mouse controls are used.
|
||||||
// if (CCamera::m_bUseMouse3rdPerson)
|
// if (CCamera::m_bUseMouse3rdPerson)
|
||||||
// stickY = 0.0f;
|
// stickY = 0.0f;
|
||||||
|
#ifdef INVERT_LOOK_FOR_PAD
|
||||||
|
if (CPad::bInvertLook4Pad)
|
||||||
|
stickY = -stickY;
|
||||||
|
#endif
|
||||||
|
|
||||||
float xMovement = Abs(stickX) * (FOV / 80.0f * 5.f / 70.f) * stickX * 0.007f * 0.007f;
|
float xMovement = Abs(stickX) * (FOV / 80.0f * 5.f / 70.f) * stickX * 0.007f * 0.007f;
|
||||||
float yMovement = Abs(stickY) * (FOV / 80.0f * 3.f / 70.f) * stickY * 0.007f * 0.007f;
|
float yMovement = Abs(stickY) * (FOV / 80.0f * 3.f / 70.f) * stickY * 0.007f * 0.007f;
|
||||||
|
@ -2212,7 +2212,7 @@ CCamera::StartTransition(int16 newMode)
|
|||||||
while(deltaBeta < -PI) deltaBeta += 2*PI;
|
while(deltaBeta < -PI) deltaBeta += 2*PI;
|
||||||
deltaBeta = Abs(deltaBeta);
|
deltaBeta = Abs(deltaBeta);
|
||||||
|
|
||||||
door = FindPlayerPed()->m_vehEnterType;
|
door = FindPlayerPed()->m_vehDoor;
|
||||||
if(deltaBeta > HALFPI){
|
if(deltaBeta > HALFPI){
|
||||||
if(((CPed*)pTargetEntity)->m_carInObjective){
|
if(((CPed*)pTargetEntity)->m_carInObjective){
|
||||||
if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){
|
if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){
|
||||||
@ -2293,7 +2293,7 @@ CCamera::StartTransition(int16 newMode)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
door = FindPlayerPed()->m_vehEnterType;
|
door = FindPlayerPed()->m_vehDoor;
|
||||||
if(deltaBeta > HALFPI){
|
if(deltaBeta > HALFPI){
|
||||||
if(((CVehicle*)pTargetEntity)->IsUpsideDown()){
|
if(((CVehicle*)pTargetEntity)->IsUpsideDown()){
|
||||||
if(door == CAR_DOOR_LF || door == CAR_DOOR_LR) // BUG: game checks LF twice
|
if(door == CAR_DOOR_LF || door == CAR_DOOR_LR) // BUG: game checks LF twice
|
||||||
@ -2783,7 +2783,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
|
|||||||
if (CReplay::IsPlayingBack())
|
if (CReplay::IsPlayingBack())
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
|
if(FindPlayerPed()->m_pWanted->GetWantedLevel() < 1)
|
||||||
return false;
|
return false;
|
||||||
if(FindPlayerVehicle() == nil)
|
if(FindPlayerVehicle() == nil)
|
||||||
return false;
|
return false;
|
||||||
@ -2811,7 +2811,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
|
|||||||
if (CReplay::IsPlayingBack())
|
if (CReplay::IsPlayingBack())
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
|
if(FindPlayerPed()->m_pWanted->GetWantedLevel() < 1)
|
||||||
return false;
|
return false;
|
||||||
if(FindPlayerVehicle() == nil)
|
if(FindPlayerVehicle() == nil)
|
||||||
return false;
|
return false;
|
||||||
@ -3629,9 +3629,17 @@ CCamera::CalculateDerivedValues(void)
|
|||||||
bool
|
bool
|
||||||
CCamera::IsPointVisible(const CVector ¢er, const CMatrix *mat)
|
CCamera::IsPointVisible(const CVector ¢er, const CMatrix *mat)
|
||||||
{
|
{
|
||||||
RwV3d c;
|
#ifdef GTA_PS2
|
||||||
c = center;
|
CVuVector c;
|
||||||
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
|
TransformPoint(c, *mat, center);
|
||||||
|
#else
|
||||||
|
CVector c = center;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
c = *mat * center;
|
||||||
|
#else
|
||||||
|
RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
if(c.y < CDraw::GetNearClipZ()) return false;
|
if(c.y < CDraw::GetNearClipZ()) return false;
|
||||||
if(c.y > CDraw::GetFarClipZ()) return false;
|
if(c.y > CDraw::GetFarClipZ()) return false;
|
||||||
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > 0.0f) return false;
|
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > 0.0f) return false;
|
||||||
@ -3644,9 +3652,17 @@ CCamera::IsPointVisible(const CVector ¢er, const CMatrix *mat)
|
|||||||
bool
|
bool
|
||||||
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
||||||
{
|
{
|
||||||
RwV3d c;
|
#ifdef GTA_PS2
|
||||||
c = center;
|
CVuVector c;
|
||||||
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
|
TransformPoint(c, *mat, center);
|
||||||
|
#else
|
||||||
|
CVector c = center;
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
c = *mat * center;
|
||||||
|
#else
|
||||||
|
RwV3dTransformPoints(&c, &c, 1, (RwMatrix*)mat);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
if(c.y + radius < CDraw::GetNearClipZ()) return false;
|
if(c.y + radius < CDraw::GetNearClipZ()) return false;
|
||||||
if(c.y - radius > CDraw::GetFarClipZ()) return false;
|
if(c.y - radius > CDraw::GetFarClipZ()) return false;
|
||||||
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > radius) return false;
|
if(c.x*m_vecFrustumNormals[0].x + c.y*m_vecFrustumNormals[0].y > radius) return false;
|
||||||
@ -3664,11 +3680,24 @@ CCamera::IsSphereVisible(const CVector ¢er, float radius)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CCamera::IsBoxVisible(RwV3d *box, const CMatrix *mat)
|
#ifdef GTA_PS2
|
||||||
|
CCamera::IsBoxVisible(CVuVector *box, const CMatrix *mat)
|
||||||
|
#else
|
||||||
|
CCamera::IsBoxVisible(CVector *box, const CMatrix *mat)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int frustumTests[6] = { 0 };
|
int frustumTests[6] = { 0 };
|
||||||
RwV3dTransformPoints(box, box, 8, &mat->m_matrix);
|
#ifdef GTA_PS2
|
||||||
|
TransformPoints(box, 8, *mat, box);
|
||||||
|
#else
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
for (i = 0; i < 8; i++)
|
||||||
|
box[i] = *mat * box[i];
|
||||||
|
#else
|
||||||
|
RwV3dTransformPoints(box, box, 8, (RwMatrix*)mat);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
for(i = 0; i < 8; i++){
|
for(i = 0; i < 8; i++){
|
||||||
if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++;
|
if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++;
|
||||||
|
@ -641,7 +641,11 @@ public:
|
|||||||
bool IsPointVisible(const CVector ¢er, const CMatrix *mat);
|
bool IsPointVisible(const CVector ¢er, const CMatrix *mat);
|
||||||
bool IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat);
|
bool IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat);
|
||||||
bool IsSphereVisible(const CVector ¢er, float radius);
|
bool IsSphereVisible(const CVector ¢er, float radius);
|
||||||
bool IsBoxVisible(RwV3d *box, const CMatrix *mat);
|
#ifdef GTA_PS2
|
||||||
|
bool IsBoxVisible(CVuVector *box, const CMatrix *mat);
|
||||||
|
#else
|
||||||
|
bool IsBoxVisible(CVector *box, const CMatrix *mat);
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
VALIDATE_SIZE(CCamera, 0xE9D8);
|
VALIDATE_SIZE(CCamera, 0xE9D8);
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "MemoryMgr.h"
|
#include "MemoryMgr.h"
|
||||||
|
|
||||||
#define CDDEBUG(f, ...) debug ("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
|
|
||||||
#define CDTRACE(f, ...) printf("%s: " f "\n", "cdvd_stream", ## __VA_ARGS__)
|
|
||||||
|
|
||||||
struct CdReadInfo
|
struct CdReadInfo
|
||||||
{
|
{
|
||||||
uint32 nSectorOffset;
|
uint32 nSectorOffset;
|
||||||
@ -60,7 +57,7 @@ CdStreamInitThread(void)
|
|||||||
|
|
||||||
if ( gpReadInfo[i].hSemaphore == nil )
|
if ( gpReadInfo[i].hSemaphore == nil )
|
||||||
{
|
{
|
||||||
CDTRACE("failed to create sync semaphore");
|
printf("%s: failed to create sync semaphore\n", "cdvd_stream");
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -81,7 +78,7 @@ CdStreamInitThread(void)
|
|||||||
|
|
||||||
if ( gCdStreamSema == nil )
|
if ( gCdStreamSema == nil )
|
||||||
{
|
{
|
||||||
CDTRACE("failed to create stream semaphore");
|
printf("%s: failed to create stream semaphore\n", "cdvd_stream");
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -90,7 +87,7 @@ CdStreamInitThread(void)
|
|||||||
|
|
||||||
if ( _gCdStreamThread == nil )
|
if ( _gCdStreamThread == nil )
|
||||||
{
|
{
|
||||||
CDTRACE("failed to create streaming thread");
|
printf("%s: failed to create streaming thread\n", "cdvd_stream");
|
||||||
ASSERT(0);
|
ASSERT(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -138,7 +135,7 @@ CdStreamInit(int32 numChannels)
|
|||||||
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
|
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
|
||||||
ASSERT( gpReadInfo != nil );
|
ASSERT( gpReadInfo != nil );
|
||||||
|
|
||||||
CDDEBUG("read info %p", gpReadInfo);
|
debug("%s: read info %p\n", "cdvd_stream", gpReadInfo);
|
||||||
|
|
||||||
CdStreamAddImage("MODELS\\GTA3.IMG");
|
CdStreamAddImage("MODELS\\GTA3.IMG");
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
#if defined RW_D3D9 || defined RWLIBS
|
#define WITHDINPUT
|
||||||
#define DIRECTINPUT_VERSION 0x0800
|
|
||||||
#include <dinput.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "crossplatform.h" // for Windows version
|
#include "crossplatform.h"
|
||||||
#include "ControllerConfig.h"
|
#include "ControllerConfig.h"
|
||||||
#include "Pad.h"
|
#include "Pad.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
@ -35,6 +31,9 @@ CControllerConfigManager::CControllerConfigManager()
|
|||||||
|
|
||||||
void CControllerConfigManager::MakeControllerActionsBlank()
|
void CControllerConfigManager::MakeControllerActionsBlank()
|
||||||
{
|
{
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
ms_padButtonsInited = 0;
|
||||||
|
#endif
|
||||||
for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++)
|
for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++)
|
||||||
{
|
{
|
||||||
for (int32 j = 0; j < MAX_CONTROLLERACTIONS; j++)
|
for (int32 j = 0; j < MAX_CONTROLLERACTIONS; j++)
|
||||||
@ -384,6 +383,10 @@ void CControllerConfigManager::InitDefaultControlConfigMouse(CMouseControllerSta
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
uint32 CControllerConfigManager::ms_padButtonsInited = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
||||||
{
|
{
|
||||||
m_bFirstCapture = true;
|
m_bFirstCapture = true;
|
||||||
@ -392,6 +395,22 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
|||||||
if (buttons > 16)
|
if (buttons > 16)
|
||||||
btn = 16;
|
btn = 16;
|
||||||
|
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
uint32 buttonMin = ms_padButtonsInited;
|
||||||
|
if (buttonMin >= btn)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ms_padButtonsInited = btn;
|
||||||
|
|
||||||
|
#define IF_BTN_IN_RANGE(n) \
|
||||||
|
case n: \
|
||||||
|
if (n <= buttonMin) \
|
||||||
|
return;
|
||||||
|
#else
|
||||||
|
#define IF_BTN_IN_RANGE(n) \
|
||||||
|
case n:
|
||||||
|
#endif
|
||||||
|
|
||||||
// Now we use SDL Game Controller DB
|
// Now we use SDL Game Controller DB
|
||||||
#if defined RW_D3D9 || defined RWLIBS
|
#if defined RW_D3D9 || defined RWLIBS
|
||||||
if ( AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
|
if ( AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
|
||||||
@ -404,49 +423,49 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
|||||||
|
|
||||||
switch (btn)
|
switch (btn)
|
||||||
{
|
{
|
||||||
case 16:
|
IF_BTN_IN_RANGE(16)
|
||||||
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
|
||||||
case 15:
|
IF_BTN_IN_RANGE(15)
|
||||||
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
|
||||||
case 14:
|
IF_BTN_IN_RANGE(14)
|
||||||
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
|
||||||
case 13:
|
IF_BTN_IN_RANGE(13)
|
||||||
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
|
||||||
case 12:
|
IF_BTN_IN_RANGE(12)
|
||||||
case 11:
|
IF_BTN_IN_RANGE(11)
|
||||||
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
|
||||||
case 10:
|
IF_BTN_IN_RANGE(10)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
|
||||||
case 9:
|
IF_BTN_IN_RANGE(9)
|
||||||
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
|
||||||
case 8:
|
IF_BTN_IN_RANGE(8)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
|
||||||
case 7:
|
IF_BTN_IN_RANGE(7)
|
||||||
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
|
||||||
case 6:
|
IF_BTN_IN_RANGE(6)
|
||||||
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
|
||||||
case 5:
|
IF_BTN_IN_RANGE(5)
|
||||||
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
|
||||||
/*******************************************************************************************/
|
/*******************************************************************************************/
|
||||||
case 4:
|
IF_BTN_IN_RANGE(4)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 4, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 4, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_JUMPING, 4, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_JUMPING, 4, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 4, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 4, JOYSTICK);
|
||||||
case 3:
|
IF_BTN_IN_RANGE(3)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 3, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 3, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_SPRINT, 3, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_SPRINT, 3, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 3, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 3, JOYSTICK);
|
||||||
case 2:
|
IF_BTN_IN_RANGE(2)
|
||||||
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 2, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 2, JOYSTICK);
|
||||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 2, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 2, JOYSTICK);
|
||||||
#endif
|
#endif
|
||||||
case 1:
|
IF_BTN_IN_RANGE(1)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 1, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 1, JOYSTICK);
|
||||||
/*******************************************************************************************/
|
/*******************************************************************************************/
|
||||||
}
|
}
|
||||||
@ -455,46 +474,46 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
|||||||
{
|
{
|
||||||
switch (btn)
|
switch (btn)
|
||||||
{
|
{
|
||||||
case 16:
|
IF_BTN_IN_RANGE(16)
|
||||||
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
|
||||||
case 15:
|
IF_BTN_IN_RANGE(15)
|
||||||
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
|
||||||
case 14:
|
IF_BTN_IN_RANGE(14)
|
||||||
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
|
||||||
case 13:
|
IF_BTN_IN_RANGE(13)
|
||||||
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
|
||||||
case 12:
|
IF_BTN_IN_RANGE(12)
|
||||||
case 11:
|
IF_BTN_IN_RANGE(11)
|
||||||
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
|
||||||
case 10:
|
IF_BTN_IN_RANGE(10)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
|
||||||
case 9:
|
IF_BTN_IN_RANGE(9)
|
||||||
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
|
||||||
case 8:
|
IF_BTN_IN_RANGE(8)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
|
||||||
case 7:
|
IF_BTN_IN_RANGE(7)
|
||||||
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
|
||||||
case 6:
|
IF_BTN_IN_RANGE(6)
|
||||||
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
|
||||||
case 5:
|
IF_BTN_IN_RANGE(5)
|
||||||
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
|
||||||
/*******************************************************************************************/
|
/*******************************************************************************************/
|
||||||
case 4:
|
IF_BTN_IN_RANGE(4)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 4, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 4, JOYSTICK);
|
||||||
case 3:
|
IF_BTN_IN_RANGE(3)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 3, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 3, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_JUMPING, 3, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_JUMPING, 3, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 3, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 3, JOYSTICK);
|
||||||
case 2:
|
IF_BTN_IN_RANGE(2)
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 2, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 2, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_SPRINT, 2, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_SPRINT, 2, JOYSTICK);
|
||||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 2, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 2, JOYSTICK);
|
||||||
case 1:
|
IF_BTN_IN_RANGE(1)
|
||||||
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 1, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 1, JOYSTICK);
|
||||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||||
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 1, JOYSTICK);
|
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 1, JOYSTICK);
|
||||||
@ -2835,9 +2854,10 @@ wchar *CControllerConfigManager::GetButtonComboText(e_ControllerAction action)
|
|||||||
void CControllerConfigManager::SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type)
|
void CControllerConfigManager::SetControllerKeyAssociatedWithAction(e_ControllerAction action, int32 key, eControllerType type)
|
||||||
{
|
{
|
||||||
ResetSettingOrder(action);
|
ResetSettingOrder(action);
|
||||||
|
int numOfSettings = GetNumOfSettingsForAction(action);
|
||||||
|
|
||||||
m_aSettings[action][type].m_Key = key;
|
m_aSettings[action][type].m_Key = key;
|
||||||
m_aSettings[action][type].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1;
|
m_aSettings[action][type].m_ContSetOrder = numOfSettings + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerAction action)
|
int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerAction action)
|
||||||
@ -2847,8 +2867,10 @@ int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerA
|
|||||||
|
|
||||||
void CControllerConfigManager::SetMouseButtonAssociatedWithAction(e_ControllerAction action, int32 button)
|
void CControllerConfigManager::SetMouseButtonAssociatedWithAction(e_ControllerAction action, int32 button)
|
||||||
{
|
{
|
||||||
|
int numOfSettings = GetNumOfSettingsForAction(action);
|
||||||
|
|
||||||
m_aSettings[action][MOUSE].m_Key = button;
|
m_aSettings[action][MOUSE].m_Key = button;
|
||||||
m_aSettings[action][MOUSE].m_ContSetOrder = GetNumOfSettingsForAction(action) + 1;
|
m_aSettings[action][MOUSE].m_ContSetOrder = numOfSettings + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
|
void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
|
||||||
@ -2871,7 +2893,7 @@ void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
|
|||||||
for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++)
|
for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++)
|
||||||
{
|
{
|
||||||
int32 setorder = m_aSettings[action][k].m_ContSetOrder;
|
int32 setorder = m_aSettings[action][k].m_ContSetOrder;
|
||||||
if (setorder > i && setorder != KEYBOARD)
|
if (setorder > i && setorder != 0)
|
||||||
{
|
{
|
||||||
if (init)
|
if (init)
|
||||||
{
|
{
|
||||||
|
@ -155,6 +155,10 @@ public:
|
|||||||
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
|
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
|
||||||
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
|
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
|
||||||
bool m_bMouseAssociated;
|
bool m_bMouseAssociated;
|
||||||
|
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
static uint32 ms_padButtonsInited;
|
||||||
|
#endif
|
||||||
|
|
||||||
CControllerConfigManager();
|
CControllerConfigManager();
|
||||||
|
|
||||||
|
@ -534,7 +534,7 @@ bool
|
|||||||
CFileLoader::StartLoadClumpFile(RwStream *stream, uint32 id)
|
CFileLoader::StartLoadClumpFile(RwStream *stream, uint32 id)
|
||||||
{
|
{
|
||||||
if(RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)){
|
if(RwStreamFindChunk(stream, rwID_CLUMP, nil, nil)){
|
||||||
printf("Start loading %s\n", CModelInfo::GetModelInfo(id)->GetName());
|
printf("Start loading %s\n", CModelInfo::GetModelInfo(id)->GetModelName());
|
||||||
return RpClumpGtaStreamRead1(stream);
|
return RpClumpGtaStreamRead1(stream);
|
||||||
}else{
|
}else{
|
||||||
printf("FAILED\n");
|
printf("FAILED\n");
|
||||||
@ -548,7 +548,7 @@ CFileLoader::FinishLoadClumpFile(RwStream *stream, uint32 id)
|
|||||||
RpClump *clump;
|
RpClump *clump;
|
||||||
CClumpModelInfo *mi;
|
CClumpModelInfo *mi;
|
||||||
|
|
||||||
printf("Finish loading %s\n", CModelInfo::GetModelInfo(id)->GetName());
|
printf("Finish loading %s\n", CModelInfo::GetModelInfo(id)->GetModelName());
|
||||||
clump = RpClumpGtaStreamRead2(stream);
|
clump = RpClumpGtaStreamRead2(stream);
|
||||||
|
|
||||||
if(clump){
|
if(clump){
|
||||||
@ -646,7 +646,6 @@ char *DoubleSidedNames[] = {
|
|||||||
"overpass_comse",
|
"overpass_comse",
|
||||||
"newdockbuilding",
|
"newdockbuilding",
|
||||||
"newdockbuilding2",
|
"newdockbuilding2",
|
||||||
"newdockbuilding",
|
|
||||||
"policeballhall",
|
"policeballhall",
|
||||||
"fuzballdoor",
|
"fuzballdoor",
|
||||||
"ind_land106",
|
"ind_land106",
|
||||||
@ -670,7 +669,98 @@ char *DoubleSidedNames[] = {
|
|||||||
"railtrax_2b",
|
"railtrax_2b",
|
||||||
"railtrax_straightss",
|
"railtrax_straightss",
|
||||||
"railtrax_bentr",
|
"railtrax_bentr",
|
||||||
|
"ind_land125",
|
||||||
|
"salvstrans",
|
||||||
|
"bridge_liftsec",
|
||||||
|
"subsign1",
|
||||||
|
"carparkfence",
|
||||||
|
"newairportwall4",
|
||||||
|
"apair_terminal",
|
||||||
|
"Helipad",
|
||||||
|
"bar_barrier10",
|
||||||
|
"damissionfence",
|
||||||
|
"sub_floodlite",
|
||||||
|
"suburbbridge1",
|
||||||
|
"damfencing",
|
||||||
|
"demfence08",
|
||||||
|
"damfence07",
|
||||||
|
"damfence06",
|
||||||
|
"damfence05",
|
||||||
|
"damfence04",
|
||||||
|
"damfence03",
|
||||||
|
"damfence02",
|
||||||
|
"damfence01",
|
||||||
|
"Dam_pod2",
|
||||||
|
"Dam_pod1",
|
||||||
|
"columansion_wall",
|
||||||
|
"wrckdhse020",
|
||||||
|
"wrckdhse01",
|
||||||
|
"arc_bridge",
|
||||||
|
"gRD_overpass19kbc",
|
||||||
|
"gRD_overpass19bkb",
|
||||||
|
"gRD_overpass19kb",
|
||||||
|
"gRD_overpass18kb",
|
||||||
|
"road_under",
|
||||||
|
"com_roadkb23",
|
||||||
|
"com_roadkb22",
|
||||||
|
"nbbridgerda",
|
||||||
|
"nbbridgerdb",
|
||||||
|
"policetenkb1",
|
||||||
|
"block3_scraper2",
|
||||||
|
"Clnm_cthdrlfcde",
|
||||||
|
"broadwaybuild",
|
||||||
|
"combillboard03",
|
||||||
|
"com_park3b",
|
||||||
|
"com_docksaa",
|
||||||
|
"newdockbuilding2",
|
||||||
|
"com_roadkb22",
|
||||||
|
"sidebarrier_gaz2",
|
||||||
|
"tunnelsupport1",
|
||||||
|
"skyscrpunbuilt2",
|
||||||
|
"cons_buid02",
|
||||||
|
"rail_platformw",
|
||||||
|
"railtrax_bent1",
|
||||||
|
"nrailstepswest",
|
||||||
|
"building_fucked",
|
||||||
|
"franksclb02",
|
||||||
|
"salvsdetail",
|
||||||
|
"crgoshp01",
|
||||||
|
"shp_wlkway",
|
||||||
|
"bar_barriergate1",
|
||||||
|
"plnt_pylon01",
|
||||||
|
"fishfctory",
|
||||||
|
"doc_crane_cab",
|
||||||
|
"nrailsteps",
|
||||||
|
"iten_club01",
|
||||||
|
"mak_Watertank",
|
||||||
|
"basketballcourt"
|
||||||
|
"carlift01",
|
||||||
|
"carlift02",
|
||||||
|
"iten_chinatown4",
|
||||||
|
"iten_details7",
|
||||||
|
"ind_customroad002"
|
||||||
|
"ind_brgrd1way",
|
||||||
|
"ind_customroad060",
|
||||||
|
"ind_customroad002",
|
||||||
|
"ind_land108",
|
||||||
|
"ind_customroad004",
|
||||||
|
"ind_customroad003",
|
||||||
|
"nbbridgcabls01",
|
||||||
|
"sbwy_tunl_bit",
|
||||||
|
"sbwy_tunl_bend",
|
||||||
|
"sbwy_tunl_cstm11",
|
||||||
|
"sbwy_tunl_cstm10",
|
||||||
|
"sbwy_tunl_cstm9",
|
||||||
|
"sbwy_tunl_cstm8",
|
||||||
|
"sbwy_tunl_cstm7",
|
||||||
|
"sbwy_tunl_cstm6",
|
||||||
|
"sbwy_tunl_cstm5",
|
||||||
|
"sbwy_tunl_cstm4",
|
||||||
|
"sbwy_tunl_cstm3",
|
||||||
|
"sbwy_tunl_cstm2",
|
||||||
|
"sbwy_tunl_cstm1",
|
||||||
""
|
""
|
||||||
|
|
||||||
};
|
};
|
||||||
char *TreeNames[] = {
|
char *TreeNames[] = {
|
||||||
"coast_treepatch",
|
"coast_treepatch",
|
||||||
@ -1074,9 +1164,9 @@ SetModelInfoFlags(CSimpleModelInfo *mi, uint32 flags)
|
|||||||
|
|
||||||
#ifdef HARDCODED_MODEL_FLAGS
|
#ifdef HARDCODED_MODEL_FLAGS
|
||||||
// mobile sets these flags in CFileLoader::SetRelatedModelInfoCB, but that's stupid
|
// mobile sets these flags in CFileLoader::SetRelatedModelInfoCB, but that's stupid
|
||||||
if(MatchModelName(mi->GetName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
|
if(MatchModelName(mi->GetModelName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
|
||||||
if(MatchModelName(mi->GetName(), TreeNames)) mi->m_bIsTree = true;
|
if(MatchModelName(mi->GetModelName(), TreeNames)) mi->m_bIsTree = true;
|
||||||
if(MatchModelName(mi->GetName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
|
if(MatchModelName(mi->GetModelName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -1118,7 +1208,7 @@ CFileLoader::LoadObject(const char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mi = CModelInfo::AddSimpleModel(id);
|
mi = CModelInfo::AddSimpleModel(id);
|
||||||
mi->SetName(model);
|
mi->SetModelName(model);
|
||||||
mi->SetNumAtomics(numObjs);
|
mi->SetNumAtomics(numObjs);
|
||||||
mi->SetLodDistances(dist);
|
mi->SetLodDistances(dist);
|
||||||
SetModelInfoFlags(mi, flags);
|
SetModelInfoFlags(mi, flags);
|
||||||
@ -1137,7 +1227,7 @@ CFileLoader::LoadMLO(const char *line)
|
|||||||
|
|
||||||
sscanf(line, "%s %s %d %f", smth, name, &modelIndex, &someFloat);
|
sscanf(line, "%s %s %d %f", smth, name, &modelIndex, &someFloat);
|
||||||
CMloModelInfo *minfo = CModelInfo::AddMloModel(modelIndex);
|
CMloModelInfo *minfo = CModelInfo::AddMloModel(modelIndex);
|
||||||
minfo->SetName(name);
|
minfo->SetModelName(name);
|
||||||
minfo->field_34 = someFloat;
|
minfo->field_34 = someFloat;
|
||||||
int instId = CModelInfo::GetMloInstanceStore().allocPtr;
|
int instId = CModelInfo::GetMloInstanceStore().allocPtr;
|
||||||
minfo->firstInstance = instId;
|
minfo->firstInstance = instId;
|
||||||
@ -1215,7 +1305,7 @@ CFileLoader::LoadTimeObject(const char *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
mi = CModelInfo::AddTimeModel(id);
|
mi = CModelInfo::AddTimeModel(id);
|
||||||
mi->SetName(model);
|
mi->SetModelName(model);
|
||||||
mi->SetNumAtomics(numObjs);
|
mi->SetNumAtomics(numObjs);
|
||||||
mi->SetLodDistances(dist);
|
mi->SetLodDistances(dist);
|
||||||
SetModelInfoFlags(mi, flags);
|
SetModelInfoFlags(mi, flags);
|
||||||
@ -1237,7 +1327,7 @@ CFileLoader::LoadClumpObject(const char *line)
|
|||||||
|
|
||||||
if(sscanf(line, "%d %s %s", &id, model, txd) == 3){
|
if(sscanf(line, "%d %s %s", &id, model, txd) == 3){
|
||||||
mi = CModelInfo::AddClumpModel(id);
|
mi = CModelInfo::AddClumpModel(id);
|
||||||
mi->SetName(model);
|
mi->SetModelName(model);
|
||||||
mi->SetTexDictionary(txd);
|
mi->SetTexDictionary(txd);
|
||||||
mi->SetColModel(&CTempColModels::ms_colModelBBox);
|
mi->SetColModel(&CTempColModels::ms_colModelBBox);
|
||||||
}
|
}
|
||||||
@ -1261,7 +1351,7 @@ CFileLoader::LoadVehicleObject(const char *line)
|
|||||||
&frequency, &level, &comprules, &misc, &wheelScale);
|
&frequency, &level, &comprules, &misc, &wheelScale);
|
||||||
|
|
||||||
mi = CModelInfo::AddVehicleModel(id);
|
mi = CModelInfo::AddVehicleModel(id);
|
||||||
mi->SetName(model);
|
mi->SetModelName(model);
|
||||||
mi->SetTexDictionary(txd);
|
mi->SetTexDictionary(txd);
|
||||||
for(p = gamename; *p; p++)
|
for(p = gamename; *p; p++)
|
||||||
if(*p == '_') *p = ' ';
|
if(*p == '_') *p = ' ';
|
||||||
@ -1340,7 +1430,7 @@ CFileLoader::LoadPedObject(const char *line)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mi = CModelInfo::AddPedModel(id);
|
mi = CModelInfo::AddPedModel(id);
|
||||||
mi->SetName(model);
|
mi->SetModelName(model);
|
||||||
mi->SetTexDictionary(txd);
|
mi->SetTexDictionary(txd);
|
||||||
mi->SetColModel(&CTempColModels::ms_colModelPed1);
|
mi->SetColModel(&CTempColModels::ms_colModelPed1);
|
||||||
mi->m_pedType = CPedType::FindPedType(pedType);
|
mi->m_pedType = CPedType::FindPedType(pedType);
|
||||||
@ -1814,7 +1904,7 @@ CFileLoader::ReloadObject(const char *line)
|
|||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
mi &&
|
mi &&
|
||||||
#endif
|
#endif
|
||||||
mi->GetModelType() == MITYPE_SIMPLE && !strcmp(mi->GetName(), model) && mi->m_numAtomics == numObjs) {
|
mi->GetModelType() == MITYPE_SIMPLE && !strcmp(mi->GetModelName(), model) && mi->m_numAtomics == numObjs) {
|
||||||
mi->SetLodDistances(dist);
|
mi->SetLodDistances(dist);
|
||||||
SetModelInfoFlags(mi, flags);
|
SetModelInfoFlags(mi, flags);
|
||||||
} else {
|
} else {
|
||||||
|
@ -264,7 +264,7 @@ CFileMgr::SetDirMyDocuments(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ssize_t
|
ssize_t
|
||||||
CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
|
CFileMgr::LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
ssize_t n, len;
|
ssize_t n, len;
|
||||||
@ -280,6 +280,7 @@ CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
|
|||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
len += n;
|
len += n;
|
||||||
|
assert(len < maxlen);
|
||||||
}while(n == 0x4000);
|
}while(n == 0x4000);
|
||||||
buf[len] = 0;
|
buf[len] = 0;
|
||||||
myfclose(fd);
|
myfclose(fd);
|
||||||
|
@ -9,7 +9,7 @@ public:
|
|||||||
static void ChangeDir(const char *dir);
|
static void ChangeDir(const char *dir);
|
||||||
static void SetDir(const char *dir);
|
static void SetDir(const char *dir);
|
||||||
static void SetDirMyDocuments(void);
|
static void SetDirMyDocuments(void);
|
||||||
static ssize_t LoadFile(const char *file, uint8 *buf, int unused, const char *mode);
|
static ssize_t LoadFile(const char *file, uint8 *buf, int maxlen, const char *mode);
|
||||||
static int OpenFile(const char *file, const char *mode);
|
static int OpenFile(const char *file, const char *mode);
|
||||||
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
|
static int OpenFile(const char *file) { return OpenFile(file, "rb"); }
|
||||||
static int OpenFileForWriting(const char *file);
|
static int OpenFileForWriting(const char *file);
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
#if defined RW_D3D9 || defined RWLIBS
|
|
||||||
#define DIRECTINPUT_VERSION 0x0800
|
|
||||||
#include <dinput.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FORCE_PC_SCALING
|
#define FORCE_PC_SCALING
|
||||||
#define WITHWINDOWS
|
#define WITHWINDOWS
|
||||||
|
#define WITHDINPUT
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#ifndef PS2_MENU
|
#ifndef PS2_MENU
|
||||||
#include "crossplatform.h"
|
#include "crossplatform.h"
|
||||||
@ -145,14 +141,6 @@ int8 CMenuManager::m_nDisplayMSAALevel = 0;
|
|||||||
int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW;
|
int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_PRECISE_MEASUREMENT_CONVERTION
|
|
||||||
#define MILES_IN_METER 0.000621371192f
|
|
||||||
#define FEET_IN_METER 3.28084f
|
|
||||||
#else
|
|
||||||
#define MILES_IN_METER (1 / 1670.f)
|
|
||||||
#define FEET_IN_METER 3.33f
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int32 CMenuManager::OS_Language = LANG_ENGLISH;
|
int32 CMenuManager::OS_Language = LANG_ENGLISH;
|
||||||
int8 CMenuManager::m_PrefsUseVibration;
|
int8 CMenuManager::m_PrefsUseVibration;
|
||||||
int8 CMenuManager::m_DisplayControllerOnFoot;
|
int8 CMenuManager::m_DisplayControllerOnFoot;
|
||||||
@ -877,7 +865,11 @@ CMenuManager::CheckCodesForControls(int typeOfControl)
|
|||||||
m_bWaitingForNewKeyBind = false;
|
m_bWaitingForNewKeyBind = false;
|
||||||
m_KeyPressedCode = -1;
|
m_KeyPressedCode = -1;
|
||||||
m_bStartWaitingForKeyBind = false;
|
m_bStartWaitingForKeyBind = false;
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
SaveINIControllerSettings();
|
||||||
|
#else
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (escPressed) {
|
if (escPressed) {
|
||||||
@ -885,7 +877,11 @@ CMenuManager::CheckCodesForControls(int typeOfControl)
|
|||||||
m_bWaitingForNewKeyBind = false;
|
m_bWaitingForNewKeyBind = false;
|
||||||
m_KeyPressedCode = -1;
|
m_KeyPressedCode = -1;
|
||||||
m_bStartWaitingForKeyBind = false;
|
m_bStartWaitingForKeyBind = false;
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
SaveINIControllerSettings();
|
||||||
|
#else
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1288,7 +1284,9 @@ CMenuManager::Draw()
|
|||||||
float smallestSliderBar = lineHeight * 0.1f;
|
float smallestSliderBar = lineHeight * 0.1f;
|
||||||
bool foundTheHoveringItem = false;
|
bool foundTheHoveringItem = false;
|
||||||
wchar unicodeTemp[64];
|
wchar unicodeTemp[64];
|
||||||
|
#ifdef ASPECT_RATIO_SCALE
|
||||||
char asciiTemp[32];
|
char asciiTemp[32];
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef MENU_MAP
|
#ifdef MENU_MAP
|
||||||
if (m_nCurrScreen == MENUPAGE_MAP) {
|
if (m_nCurrScreen == MENUPAGE_MAP) {
|
||||||
@ -1462,18 +1460,34 @@ CMenuManager::Draw()
|
|||||||
#else
|
#else
|
||||||
switch (m_PrefsUseWideScreen) {
|
switch (m_PrefsUseWideScreen) {
|
||||||
case AR_AUTO:
|
case AR_AUTO:
|
||||||
sprintf(asciiTemp, "AUTO");
|
rightText = TheText.Get("FEM_AUT");
|
||||||
break;
|
break;
|
||||||
case AR_4_3:
|
case AR_4_3:
|
||||||
sprintf(asciiTemp, "4:3");
|
sprintf(asciiTemp, "4:3");
|
||||||
|
AsciiToUnicode(asciiTemp, unicodeTemp);
|
||||||
|
rightText = unicodeTemp;
|
||||||
|
break;
|
||||||
|
case AR_5_4:
|
||||||
|
sprintf(asciiTemp, "5:4");
|
||||||
|
AsciiToUnicode(asciiTemp, unicodeTemp);
|
||||||
|
rightText = unicodeTemp;
|
||||||
|
break;
|
||||||
|
case AR_16_10:
|
||||||
|
sprintf(asciiTemp, "16:10");
|
||||||
|
AsciiToUnicode(asciiTemp, unicodeTemp);
|
||||||
|
rightText = unicodeTemp;
|
||||||
break;
|
break;
|
||||||
case AR_16_9:
|
case AR_16_9:
|
||||||
sprintf(asciiTemp, "16:9");
|
sprintf(asciiTemp, "16:9");
|
||||||
|
AsciiToUnicode(asciiTemp, unicodeTemp);
|
||||||
|
rightText = unicodeTemp;
|
||||||
|
break;
|
||||||
|
case AR_21_9:
|
||||||
|
sprintf(asciiTemp, "21:9");
|
||||||
|
AsciiToUnicode(asciiTemp, unicodeTemp);
|
||||||
|
rightText = unicodeTemp;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
AsciiToUnicode(asciiTemp, unicodeTemp);
|
|
||||||
rightText = unicodeTemp;
|
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case MENUACTION_RADIO:
|
case MENUACTION_RADIO:
|
||||||
@ -1567,6 +1581,7 @@ CMenuManager::Draw()
|
|||||||
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
|
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
|
||||||
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
||||||
|
|
||||||
|
isOptionDisabled = option.m_CFOSelect->disableIfGameLoaded && !m_bGameNotLoaded;
|
||||||
if (option.m_CFOSelect->onlyApplyOnEnter){
|
if (option.m_CFOSelect->onlyApplyOnEnter){
|
||||||
if (m_nCurrOption != i) {
|
if (m_nCurrOption != i) {
|
||||||
if (option.m_CFOSelect->displayedValue != option.m_CFOSelect->lastSavedValue)
|
if (option.m_CFOSelect->displayedValue != option.m_CFOSelect->lastSavedValue)
|
||||||
@ -3568,13 +3583,21 @@ CMenuManager::LoadAllTextures()
|
|||||||
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
|
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
|
||||||
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
|
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 0);
|
||||||
m_nCurrOption = 0;
|
m_nCurrOption = 0;
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
static bool firstTime = true;
|
||||||
|
if (firstTime) {
|
||||||
|
DMAudio.SetRadioInCar(m_PrefsRadioStation);
|
||||||
|
firstTime = false;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
m_PrefsRadioStation = DMAudio.GetRadioInCar();
|
m_PrefsRadioStation = DMAudio.GetRadioInCar();
|
||||||
|
|
||||||
if (DMAudio.IsMP3RadioChannelAvailable()) {
|
if (DMAudio.IsMP3RadioChannelAvailable()) {
|
||||||
if (m_PrefsRadioStation > USERTRACK)
|
if (m_PrefsRadioStation > USERTRACK)
|
||||||
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
|
m_PrefsRadioStation = CGeneral::GetRandomNumber() % (USERTRACK + 1);
|
||||||
} else if (m_PrefsRadioStation > CHATTERBOX)
|
} else if (m_PrefsRadioStation > CHATTERBOX)
|
||||||
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
|
m_PrefsRadioStation = CGeneral::GetRandomNumber() % (CHATTERBOX + 1);
|
||||||
|
|
||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
//CFileMgr::SetDir("");
|
//CFileMgr::SetDir("");
|
||||||
@ -3709,6 +3732,16 @@ CMenuManager::LoadSettings()
|
|||||||
CFileMgr::CloseFile(fileHandle);
|
CFileMgr::CloseFile(fileHandle);
|
||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
|
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
if (LoadINISettings()) {
|
||||||
|
LoadINIControllerSettings();
|
||||||
|
} else {
|
||||||
|
// no re3.ini, create it
|
||||||
|
SaveINISettings();
|
||||||
|
SaveINIControllerSettings();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_PrefsVsync = m_PrefsVsyncDisp;
|
m_PrefsVsync = m_PrefsVsyncDisp;
|
||||||
CRenderer::ms_lodDistScale = m_PrefsLOD;
|
CRenderer::ms_lodDistScale = m_PrefsLOD;
|
||||||
|
|
||||||
@ -3747,15 +3780,12 @@ CMenuManager::LoadSettings()
|
|||||||
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
|
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
|
||||||
strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
|
strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LOAD_INI_SETTINGS
|
|
||||||
LoadINISettings(); // needs frontend options to be loaded
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CMenuManager::SaveSettings()
|
CMenuManager::SaveSettings()
|
||||||
{
|
{
|
||||||
|
#ifndef LOAD_INI_SETTINGS
|
||||||
static char RubbishString[48] = "stuffmorestuffevenmorestuff etc";
|
static char RubbishString[48] = "stuffmorestuffevenmorestuff etc";
|
||||||
|
|
||||||
CFileMgr::SetDirMyDocuments();
|
CFileMgr::SetDirMyDocuments();
|
||||||
@ -3805,7 +3835,7 @@ CMenuManager::SaveSettings()
|
|||||||
CFileMgr::CloseFile(fileHandle);
|
CFileMgr::CloseFile(fileHandle);
|
||||||
CFileMgr::SetDir("");
|
CFileMgr::SetDir("");
|
||||||
|
|
||||||
#ifdef LOAD_INI_SETTINGS
|
#else
|
||||||
SaveINISettings();
|
SaveINISettings();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -4115,19 +4145,19 @@ CMenuManager::Process(void)
|
|||||||
MouseButtonJustClicked = false;
|
MouseButtonJustClicked = false;
|
||||||
|
|
||||||
if (CPad::GetPad(0)->GetLeftMouseJustDown())
|
if (CPad::GetPad(0)->GetLeftMouseJustDown())
|
||||||
MouseButtonJustClicked = 1;
|
MouseButtonJustClicked = rsMOUSELEFTBUTTON;
|
||||||
else if (CPad::GetPad(0)->GetRightMouseJustUp())
|
else if (CPad::GetPad(0)->GetRightMouseJustUp())
|
||||||
MouseButtonJustClicked = 3;
|
MouseButtonJustClicked = rsMOUSERIGHTBUTTON;
|
||||||
else if (CPad::GetPad(0)->GetMiddleMouseJustUp())
|
else if (CPad::GetPad(0)->GetMiddleMouseJustUp())
|
||||||
MouseButtonJustClicked = 2;
|
MouseButtonJustClicked = rsMOUSMIDDLEBUTTON;
|
||||||
else if (CPad::GetPad(0)->GetMouseWheelUpJustUp())
|
else if (CPad::GetPad(0)->GetMouseWheelUpJustUp())
|
||||||
MouseButtonJustClicked = 4;
|
MouseButtonJustClicked = rsMOUSEWHEELUPBUTTON;
|
||||||
else if (CPad::GetPad(0)->GetMouseWheelDownJustUp())
|
else if (CPad::GetPad(0)->GetMouseWheelDownJustUp())
|
||||||
MouseButtonJustClicked = 5;
|
MouseButtonJustClicked = rsMOUSEWHEELDOWNBUTTON;
|
||||||
else if (CPad::GetPad(0)->GetMouseX1JustUp())
|
else if (CPad::GetPad(0)->GetMouseX1JustUp())
|
||||||
MouseButtonJustClicked = 6;
|
MouseButtonJustClicked = rsMOUSEX1BUTTON;
|
||||||
else if (CPad::GetPad(0)->GetMouseX2JustUp())
|
else if (CPad::GetPad(0)->GetMouseX2JustUp())
|
||||||
MouseButtonJustClicked = 7;
|
MouseButtonJustClicked = rsMOUSEX2BUTTON;
|
||||||
|
|
||||||
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
|
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
|
||||||
|
|
||||||
@ -5051,6 +5081,9 @@ CMenuManager::ProcessButtonPresses(void)
|
|||||||
CVehicle::m_bDisableMouseSteering = true;
|
CVehicle::m_bDisableMouseSteering = true;
|
||||||
TheCamera.m_bHeadBob = false;
|
TheCamera.m_bHeadBob = false;
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
SaveINIControllerSettings();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
SetHelperText(2);
|
SetHelperText(2);
|
||||||
break;
|
break;
|
||||||
@ -5090,6 +5123,9 @@ CMenuManager::ProcessButtonPresses(void)
|
|||||||
case MENUACTION_CFO_DYNAMIC:
|
case MENUACTION_CFO_DYNAMIC:
|
||||||
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
|
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
|
||||||
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
||||||
|
if (option.m_CFOSelect->disableIfGameLoaded && !m_bGameNotLoaded)
|
||||||
|
break;
|
||||||
|
|
||||||
if (!option.m_CFOSelect->onlyApplyOnEnter) {
|
if (!option.m_CFOSelect->onlyApplyOnEnter) {
|
||||||
option.m_CFOSelect->displayedValue++;
|
option.m_CFOSelect->displayedValue++;
|
||||||
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts || option.m_CFOSelect->displayedValue < 0)
|
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts || option.m_CFOSelect->displayedValue < 0)
|
||||||
@ -5099,7 +5135,8 @@ CMenuManager::ProcessButtonPresses(void)
|
|||||||
|
|
||||||
*option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
|
*option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
|
||||||
|
|
||||||
if (option.m_CFOSelect->save)
|
// Now everything is saved in .ini, and LOAD_INI_SETTINGS is fundamental for CFO
|
||||||
|
// if (option.m_CFOSelect->save)
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
|
||||||
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
|
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
|
||||||
@ -5257,12 +5294,12 @@ CMenuManager::ProcessButtonPresses(void)
|
|||||||
case MENUACTION_WIDESCREEN:
|
case MENUACTION_WIDESCREEN:
|
||||||
if (changeValueBy > 0) {
|
if (changeValueBy > 0) {
|
||||||
m_PrefsUseWideScreen++;
|
m_PrefsUseWideScreen++;
|
||||||
if (m_PrefsUseWideScreen > 2)
|
if (m_PrefsUseWideScreen > AR_MAX-1)
|
||||||
m_PrefsUseWideScreen = 0;
|
m_PrefsUseWideScreen = 0;
|
||||||
} else {
|
} else {
|
||||||
m_PrefsUseWideScreen--;
|
m_PrefsUseWideScreen--;
|
||||||
if (m_PrefsUseWideScreen < 0)
|
if (m_PrefsUseWideScreen < 0)
|
||||||
m_PrefsUseWideScreen = 2;
|
m_PrefsUseWideScreen = AR_MAX-1;
|
||||||
}
|
}
|
||||||
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
|
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
@ -5316,6 +5353,9 @@ CMenuManager::ProcessButtonPresses(void)
|
|||||||
case MENUACTION_CFO_DYNAMIC:
|
case MENUACTION_CFO_DYNAMIC:
|
||||||
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
|
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
|
||||||
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
||||||
|
if (option.m_CFOSelect->disableIfGameLoaded && !m_bGameNotLoaded)
|
||||||
|
break;
|
||||||
|
|
||||||
if (changeValueBy > 0) {
|
if (changeValueBy > 0) {
|
||||||
option.m_CFOSelect->displayedValue++;
|
option.m_CFOSelect->displayedValue++;
|
||||||
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts)
|
if (option.m_CFOSelect->displayedValue >= option.m_CFOSelect->numRightTexts)
|
||||||
@ -5330,7 +5370,8 @@ CMenuManager::ProcessButtonPresses(void)
|
|||||||
|
|
||||||
*option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
|
*option.m_CFO->value = option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue;
|
||||||
|
|
||||||
if (option.m_CFOSelect->save)
|
// Now everything is saved in .ini, and LOAD_INI_SETTINGS is fundamental for CFO
|
||||||
|
// if (option.m_CFOSelect->save)
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
|
||||||
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
|
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
|
||||||
@ -5572,6 +5613,9 @@ CMenuManager::SwitchMenuOnAndOff()
|
|||||||
#endif
|
#endif
|
||||||
ShutdownJustMenu();
|
ShutdownJustMenu();
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
SaveINIControllerSettings();
|
||||||
|
#endif
|
||||||
m_bStartUpFrontEndRequested = false;
|
m_bStartUpFrontEndRequested = false;
|
||||||
pControlEdit = nil;
|
pControlEdit = nil;
|
||||||
m_bShutDownFrontEndRequested = false;
|
m_bShutDownFrontEndRequested = false;
|
||||||
|
@ -494,6 +494,7 @@ struct CCustomScreenLayout {
|
|||||||
struct CCFO
|
struct CCFO
|
||||||
{
|
{
|
||||||
int8 *value;
|
int8 *value;
|
||||||
|
const char *saveCat;
|
||||||
const char *save;
|
const char *save;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -505,18 +506,21 @@ struct CCFOSelect : CCFO
|
|||||||
int8 displayedValue; // only if onlyApplyOnEnter enabled for now
|
int8 displayedValue; // only if onlyApplyOnEnter enabled for now
|
||||||
int8 lastSavedValue; // only if onlyApplyOnEnter enabled
|
int8 lastSavedValue; // only if onlyApplyOnEnter enabled
|
||||||
ChangeFunc changeFunc;
|
ChangeFunc changeFunc;
|
||||||
|
bool disableIfGameLoaded;
|
||||||
|
|
||||||
CCFOSelect() {};
|
CCFOSelect() {};
|
||||||
CCFOSelect(int8* value, const char* save, const char** rightTexts, int8 numRightTexts, bool onlyApplyOnEnter, ChangeFunc changeFunc){
|
CCFOSelect(int8* value, const char* saveCat, const char* save, const char** rightTexts, int8 numRightTexts, bool onlyApplyOnEnter, ChangeFunc changeFunc = nil, bool disableIfGameLoaded = false){
|
||||||
this->value = value;
|
this->value = value;
|
||||||
if (value)
|
if (value)
|
||||||
this->lastSavedValue = this->displayedValue = *value;
|
this->lastSavedValue = this->displayedValue = *value;
|
||||||
|
|
||||||
|
this->saveCat = saveCat;
|
||||||
this->save = save;
|
this->save = save;
|
||||||
this->rightTexts = (char**)rightTexts;
|
this->rightTexts = (char**)rightTexts;
|
||||||
this->numRightTexts = numRightTexts;
|
this->numRightTexts = numRightTexts;
|
||||||
this->onlyApplyOnEnter = onlyApplyOnEnter;
|
this->onlyApplyOnEnter = onlyApplyOnEnter;
|
||||||
this->changeFunc = changeFunc;
|
this->changeFunc = changeFunc;
|
||||||
|
this->disableIfGameLoaded = disableIfGameLoaded;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -526,8 +530,9 @@ struct CCFODynamic : CCFO
|
|||||||
ButtonPressFunc buttonPressFunc;
|
ButtonPressFunc buttonPressFunc;
|
||||||
|
|
||||||
CCFODynamic() {};
|
CCFODynamic() {};
|
||||||
CCFODynamic(int8* value, const char* save, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc){
|
CCFODynamic(int8* value, const char* saveCat, const char* save, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc){
|
||||||
this->value = value;
|
this->value = value;
|
||||||
|
this->saveCat = saveCat;
|
||||||
this->save = save;
|
this->save = save;
|
||||||
this->drawFunc = drawFunc;
|
this->drawFunc = drawFunc;
|
||||||
this->buttonPressFunc = buttonPressFunc;
|
this->buttonPressFunc = buttonPressFunc;
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
#pragma warning( push )
|
|
||||||
#pragma warning( disable : 4005)
|
|
||||||
#pragma warning( pop )
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
@ -10,7 +7,6 @@
|
|||||||
#include "Accident.h"
|
#include "Accident.h"
|
||||||
#include "Antennas.h"
|
#include "Antennas.h"
|
||||||
#include "Bridge.h"
|
#include "Bridge.h"
|
||||||
#include "Camera.h"
|
|
||||||
#include "CarCtrl.h"
|
#include "CarCtrl.h"
|
||||||
#include "CarGen.h"
|
#include "CarGen.h"
|
||||||
#include "CdStream.h"
|
#include "CdStream.h"
|
||||||
@ -67,7 +63,6 @@
|
|||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
#include "Skidmarks.h"
|
#include "Skidmarks.h"
|
||||||
#include "SpecialFX.h"
|
#include "SpecialFX.h"
|
||||||
#include "Sprite2d.h"
|
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
#include "Streaming.h"
|
#include "Streaming.h"
|
||||||
#include "SurfaceTable.h"
|
#include "SurfaceTable.h"
|
||||||
|
@ -133,7 +133,7 @@ public:
|
|||||||
static bool faststricmp(const char *str1, const char *str2)
|
static bool faststricmp(const char *str1, const char *str2)
|
||||||
{
|
{
|
||||||
for (; *str1; str1++, str2++) {
|
for (; *str1; str1++, str2++) {
|
||||||
#if MUCH_SLOWER || !defined _WIN32 || defined __MINGW32__
|
#ifndef ASCII_STRCMP
|
||||||
if (toupper(*str1) != toupper(*str2))
|
if (toupper(*str1) != toupper(*str2))
|
||||||
#else
|
#else
|
||||||
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
|
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "common.h"
|
|
||||||
|
|
||||||
class CPtrNode
|
class CPtrNode
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
#include "Collision.h"
|
#include "Collision.h"
|
||||||
#include "ModelInfo.h"
|
#include "ModelInfo.h"
|
||||||
#include "Pad.h"
|
#include "Pad.h"
|
||||||
|
#include "ControllerConfig.h"
|
||||||
|
|
||||||
// Menu screens array is at the bottom of the file.
|
// Menu screens array is at the bottom of the file.
|
||||||
|
|
||||||
@ -24,51 +25,51 @@
|
|||||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||||
|
|
||||||
#ifdef IMPROVED_VIDEOMODE
|
#ifdef IMPROVED_VIDEOMODE
|
||||||
#define VIDEOMODE_SELECTOR MENUACTION_CFO_SELECT, "FEM_SCF", { new CCFOSelect((int8*)&FrontEndMenuManager.m_nPrefsWindowed, nil, screenModes, 2, true, ScreenModeAfterChange) },
|
#define VIDEOMODE_SELECTOR MENUACTION_CFO_SELECT, "FEM_SCF", { new CCFOSelect((int8*)&FrontEndMenuManager.m_nPrefsWindowed, "VideoMode", "Windowed", screenModes, 2, true, ScreenModeAfterChange, true) },
|
||||||
#else
|
#else
|
||||||
#define VIDEOMODE_SELECTOR
|
#define VIDEOMODE_SELECTOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MULTISAMPLING
|
#ifdef MULTISAMPLING
|
||||||
#define MULTISAMPLING_SELECTOR MENUACTION_CFO_DYNAMIC, "FED_AAS", { new CCFODynamic((int8*)&FrontEndMenuManager.m_nPrefsMSAALevel, "MultiSampling", MultiSamplingDraw, MultiSamplingButtonPress) },
|
#define MULTISAMPLING_SELECTOR MENUACTION_CFO_DYNAMIC, "FED_AAS", { new CCFODynamic((int8*)&FrontEndMenuManager.m_nPrefsMSAALevel, "Graphics", "MultiSampling", MultiSamplingDraw, MultiSamplingButtonPress) },
|
||||||
#else
|
#else
|
||||||
#define MULTISAMPLING_SELECTOR
|
#define MULTISAMPLING_SELECTOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CUTSCENE_BORDERS_SWITCH
|
#ifdef CUTSCENE_BORDERS_SWITCH
|
||||||
#define CUTSCENE_BORDERS_TOGGLE MENUACTION_CFO_SELECT, "FEM_CSB", { new CCFOSelect((int8 *)&CMenuManager::m_PrefsCutsceneBorders, "CutsceneBorders", off_on, 2, false, nil) },
|
#define CUTSCENE_BORDERS_TOGGLE MENUACTION_CFO_SELECT, "FEM_CSB", { new CCFOSelect((int8 *)&CMenuManager::m_PrefsCutsceneBorders, "Display", "CutsceneBorders", off_on, 2, false) },
|
||||||
#else
|
#else
|
||||||
#define CUTSCENE_BORDERS_TOGGLE
|
#define CUTSCENE_BORDERS_TOGGLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FREE_CAM
|
#ifdef FREE_CAM
|
||||||
#define FREE_CAM_TOGGLE MENUACTION_CFO_SELECT, "FEC_FRC", { new CCFOSelect((int8*)&TheCamera.bFreeCam, "FreeCam", off_on, 2, false, nil) },
|
#define FREE_CAM_TOGGLE MENUACTION_CFO_SELECT, "FEC_FRC", { new CCFOSelect((int8*)&TheCamera.bFreeCam, "Display", "FreeCam", off_on, 2, false) },
|
||||||
#else
|
#else
|
||||||
#define FREE_CAM_TOGGLE
|
#define FREE_CAM_TOGGLE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PS2_ALPHA_TEST
|
#ifdef PS2_ALPHA_TEST
|
||||||
#define DUALPASS_SELECTOR MENUACTION_CFO_SELECT, "FEM_2PR", { new CCFOSelect((int8*)&gPS2alphaTest, "PS2AlphaTest", off_on, 2, false, nil) },
|
#define DUALPASS_SELECTOR MENUACTION_CFO_SELECT, "FEM_2PR", { new CCFOSelect((int8*)&gPS2alphaTest, "Graphics", "PS2AlphaTest", off_on, 2, false) },
|
||||||
#else
|
#else
|
||||||
#define DUALPASS_SELECTOR
|
#define DUALPASS_SELECTOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NO_ISLAND_LOADING
|
#ifdef NO_ISLAND_LOADING
|
||||||
#define ISLAND_LOADING_SELECTOR MENUACTION_CFO_SELECT, "FEM_ISL", { new CCFOSelect((int8*)&CMenuManager::m_PrefsIslandLoading, "IslandLoading", islandLoadingOpts, ARRAY_SIZE(islandLoadingOpts), true, IslandLoadingAfterChange) },
|
#define ISLAND_LOADING_SELECTOR MENUACTION_CFO_SELECT, "FEM_ISL", { new CCFOSelect((int8*)&CMenuManager::m_PrefsIslandLoading, "Graphics", "IslandLoading", islandLoadingOpts, ARRAY_SIZE(islandLoadingOpts), true, IslandLoadingAfterChange) },
|
||||||
#else
|
#else
|
||||||
#define ISLAND_LOADING_SELECTOR
|
#define ISLAND_LOADING_SELECTOR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTENDED_COLOURFILTER
|
#ifdef EXTENDED_COLOURFILTER
|
||||||
#define POSTFX_SELECTORS \
|
#define POSTFX_SELECTORS \
|
||||||
MENUACTION_CFO_SELECT, "FED_CLF", { new CCFOSelect((int8*)&CPostFX::EffectSwitch, "ColourFilter", filterNames, ARRAY_SIZE(filterNames), false, nil) }, \
|
MENUACTION_CFO_SELECT, "FED_CLF", { new CCFOSelect((int8*)&CPostFX::EffectSwitch, "Graphics", "ColourFilter", filterNames, ARRAY_SIZE(filterNames), false) }, \
|
||||||
MENUACTION_CFO_SELECT, "FED_MBL", { new CCFOSelect((int8*)&CPostFX::MotionBlurOn, "MotionBlur", off_on, 2, false, nil) },
|
MENUACTION_CFO_SELECT, "FED_MBL", { new CCFOSelect((int8*)&CPostFX::MotionBlurOn, "Graphics", "MotionBlur", off_on, 2, false) },
|
||||||
#else
|
#else
|
||||||
#define POSTFX_SELECTORS
|
#define POSTFX_SELECTORS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef INVERT_LOOK_FOR_PAD
|
#ifdef INVERT_LOOK_FOR_PAD
|
||||||
#define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_IVP", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, "InvertPad", off_on, 2, false, nil) },
|
#define INVERT_PAD_SELECTOR MENUACTION_CFO_SELECT, "FEC_IVP", { new CCFOSelect((int8*)&CPad::bInvertLook4Pad, "Controller", "InvertPad", off_on, 2, false) },
|
||||||
#else
|
#else
|
||||||
#define INVERT_PAD_SELECTOR
|
#define INVERT_PAD_SELECTOR
|
||||||
#endif
|
#endif
|
||||||
@ -292,6 +293,7 @@ void ScreenModeAfterChange(int8 before, int8 after)
|
|||||||
|
|
||||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
wchar selectedJoystickUnicode[128];
|
wchar selectedJoystickUnicode[128];
|
||||||
|
int cachedButtonNum = -1;
|
||||||
|
|
||||||
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
||||||
int numButtons;
|
int numButtons;
|
||||||
@ -320,6 +322,7 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
|||||||
|
|
||||||
strcpy(gSelectedJoystickName, joyname);
|
strcpy(gSelectedJoystickName, joyname);
|
||||||
PSGLOBAL(joy1id) = found;
|
PSGLOBAL(joy1id) = found;
|
||||||
|
cachedButtonNum = numButtons;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (PSGLOBAL(joy1id) == -1)
|
if (PSGLOBAL(joy1id) == -1)
|
||||||
@ -329,6 +332,18 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
|||||||
|
|
||||||
return selectedJoystickUnicode;
|
return selectedJoystickUnicode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DetectJoystickGoBack() {
|
||||||
|
if (cachedButtonNum != -1) {
|
||||||
|
#ifdef LOAD_INI_SETTINGS
|
||||||
|
ControlsManager.InitDefaultControlConfigJoyPad(cachedButtonNum);
|
||||||
|
SaveINIControllerSettings();
|
||||||
|
#else
|
||||||
|
// Otherwise no way to save gSelectedJoystickName or ms_padButtonsInited anyway :shrug: Why do you even use this config.??
|
||||||
|
#endif
|
||||||
|
cachedButtonNum = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CMenuScreenCustom aScreens[MENUPAGES] = {
|
CMenuScreenCustom aScreens[MENUPAGES] = {
|
||||||
@ -405,7 +420,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
|||||||
CUTSCENE_BORDERS_TOGGLE
|
CUTSCENE_BORDERS_TOGGLE
|
||||||
FREE_CAM_TOGGLE
|
FREE_CAM_TOGGLE
|
||||||
MENUACTION_SUBTITLES, "FED_SUB", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
|
MENUACTION_SUBTITLES, "FED_SUB", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
|
||||||
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefDisplay) },
|
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, nil, RestoreDefDisplay) },
|
||||||
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
@ -418,9 +433,9 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
|||||||
MENUACTION_LANG_ITA, "FEL_ITA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
|
MENUACTION_LANG_ITA, "FEL_ITA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
|
||||||
MENUACTION_LANG_SPA, "FEL_SPA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
|
MENUACTION_LANG_SPA, "FEL_SPA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
|
||||||
#ifdef MORE_LANGUAGES
|
#ifdef MORE_LANGUAGES
|
||||||
MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, LangPolSelect) },
|
MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, nil, LangPolSelect) },
|
||||||
MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, LangRusSelect) },
|
MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, nil, LangRusSelect) },
|
||||||
MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, LangJapSelect) },
|
MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, nil, LangJapSelect) },
|
||||||
#endif
|
#endif
|
||||||
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
||||||
},
|
},
|
||||||
@ -828,7 +843,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
|||||||
MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
|
MENUACTION_TRAILS, "FED_TRA", { nil, SAVESLOT_NONE, MENUPAGE_DISPLAY_SETTINGS },
|
||||||
#endif
|
#endif
|
||||||
// re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined
|
// re3.cpp inserts here pipeline selectors if neo/neo.txd exists and EXTENDED_PIPELINES defined
|
||||||
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, RestoreDefGraphics) },
|
MENUACTION_CFO_DYNAMIC, "FET_DEF", { new CCFODynamic(nil, nil, nil, nil, RestoreDefGraphics) },
|
||||||
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
@ -836,10 +851,10 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
|||||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
// MENUPAGE_DETECT_JOYSTICK
|
// MENUPAGE_DETECT_JOYSTICK
|
||||||
{ "FEC_JOD", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC,
|
{ "FEC_JOD", MENUPAGE_CONTROLLER_PC, MENUPAGE_CONTROLLER_PC,
|
||||||
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 40, 60, 20, FONT_BANK, FESCREEN_LEFT_ALIGN, false, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), nil,
|
new CCustomScreenLayout({MENUSPRITE_MAINMENU, 40, 60, 20, FONT_BANK, FESCREEN_LEFT_ALIGN, false, MEDIUMTEXT_X_SCALE, MEDIUMTEXT_Y_SCALE}), DetectJoystickGoBack,
|
||||||
|
|
||||||
MENUACTION_LABEL, "FEC_JPR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
MENUACTION_LABEL, "FEC_JPR", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
||||||
MENUACTION_CFO_DYNAMIC, "FEC_JDE", { new CCFODynamic(nil, nil, DetectJoystickDraw, nil) },
|
MENUACTION_CFO_DYNAMIC, "FEC_JDE", { new CCFODynamic(nil, nil, nil, DetectJoystickDraw, nil) },
|
||||||
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
MENUACTION_CHANGEMENU, "FEDS_TB", { nil, SAVESLOT_NONE, MENUPAGE_NONE },
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
#pragma warning( push )
|
#define WITHDINPUT
|
||||||
#pragma warning( disable : 4005)
|
|
||||||
#if defined RW_D3D9 || defined RWLIBS
|
|
||||||
#define DIRECTINPUT_VERSION 0x0800
|
|
||||||
#include <dinput.h>
|
|
||||||
#endif
|
|
||||||
#pragma warning( pop )
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "crossplatform.h"
|
#include "crossplatform.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
@ -233,7 +226,7 @@ void ArmourCheat()
|
|||||||
void WantedLevelUpCheat()
|
void WantedLevelUpCheat()
|
||||||
{
|
{
|
||||||
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
|
CHud::SetHelpMessage(TheText.Get("CHEAT5"), true);
|
||||||
FindPlayerPed()->SetWantedLevel(Min(FindPlayerPed()->m_pWanted->m_nWantedLevel + 2, 6));
|
FindPlayerPed()->SetWantedLevel(Min(FindPlayerPed()->m_pWanted->GetWantedLevel() + 2, 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
void WantedLevelDownCheat()
|
void WantedLevelDownCheat()
|
||||||
@ -876,6 +869,30 @@ void CPad::AddToCheatString(char c)
|
|||||||
// "S1CD13TR1X" - SQUARE L1 CIRCLE DOWN L1 R1 TRIANGLE RIGHT L1 CROSS
|
// "S1CD13TR1X" - SQUARE L1 CIRCLE DOWN L1 R1 TRIANGLE RIGHT L1 CROSS
|
||||||
else if ( !_CHEATCMP("X1RT31DC1S") )
|
else if ( !_CHEATCMP("X1RT31DC1S") )
|
||||||
NastyLimbsCheat();
|
NastyLimbsCheat();
|
||||||
|
|
||||||
|
#ifdef KANGAROO_CHEAT
|
||||||
|
// "X1DUC3RLS3" - R1 SQUARE LEFT RIGHT R1 CIRCLE UP DOWN L1 CROSS
|
||||||
|
else if (!_CHEATCMP("X1DUC3RLS3"))
|
||||||
|
KangarooCheat();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MASTER
|
||||||
|
// "31UD13XUD" - DOWN UP CROSS R1 L1 DOWN UP L1 R1
|
||||||
|
else if (!_CHEATCMP("31UD13XUD"))
|
||||||
|
CPed::SwitchDebugDisplay();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ALLCARSHELI_CHEAT
|
||||||
|
// "UCCL3R1TT" - TRIANGLE TRIANGLE L1 RIGHT R1 LEFT CIRCLE CIRCLE UP
|
||||||
|
else if (!_CHEATCMP("UCCL3R1TT"))
|
||||||
|
AllCarsHeliCheat();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef ALT_DODO_CHEAT
|
||||||
|
// "DUU31XX13" - R1 L1 CROSS CROSS L1 R1 UP UP DOWN
|
||||||
|
else if (!_CHEATCMP("DUU31XX13"))
|
||||||
|
AltDodoCheat();
|
||||||
|
#endif
|
||||||
#undef _CHEATCMP
|
#undef _CHEATCMP
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1113,14 +1130,11 @@ void CPad::UpdatePads(void)
|
|||||||
bUpdate = false;
|
bUpdate = false;
|
||||||
|
|
||||||
if ( bUpdate )
|
if ( bUpdate )
|
||||||
{
|
|
||||||
GetPad(0)->Update(0);
|
GetPad(0)->Update(0);
|
||||||
#ifndef SQUEEZE_PERFORMANCE
|
|
||||||
GetPad(1)->Update(0);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(MASTER) && !defined(XINPUT)
|
#ifndef MASTER
|
||||||
|
GetPad(1)->Update(1);
|
||||||
|
#else
|
||||||
GetPad(1)->NewState.Clear();
|
GetPad(1)->NewState.Clear();
|
||||||
GetPad(1)->OldState.Clear();
|
GetPad(1)->OldState.Clear();
|
||||||
#endif
|
#endif
|
||||||
|
@ -7,7 +7,9 @@ CPlaceable::CPlaceable(void)
|
|||||||
m_matrix.SetScale(1.0f);
|
m_matrix.SetScale(1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlaceable::~CPlaceable(void) = default;
|
CPlaceable::~CPlaceable(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CPlaceable::SetHeading(float angle)
|
CPlaceable::SetHeading(float angle)
|
||||||
|
@ -4,7 +4,7 @@ class CPlaceable
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// disable allocation
|
// disable allocation
|
||||||
static void *operator new(size_t) = delete;
|
static void *operator new(size_t);
|
||||||
|
|
||||||
CMatrix m_matrix;
|
CMatrix m_matrix;
|
||||||
|
|
||||||
|
@ -222,8 +222,8 @@ CPlayerInfo::Process(void)
|
|||||||
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
|
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
|
||||||
} else if (carBelow->IsBoat()) {
|
} else if (carBelow->IsBoat()) {
|
||||||
if (!carBelow->pDriver) {
|
if (!carBelow->pDriver) {
|
||||||
m_pPed->m_vehEnterType = 0;
|
m_pPed->m_vehDoor = 0;
|
||||||
m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType);
|
m_pPed->SetEnterCar(carBelow, m_pPed->m_vehDoor);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow);
|
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Collision.h"
|
#include "ColModel.h"
|
||||||
|
|
||||||
enum eWastedBustedState
|
enum eWastedBustedState
|
||||||
{
|
{
|
||||||
|
@ -102,7 +102,7 @@ CPools::CheckPoolsEmpty()
|
|||||||
void
|
void
|
||||||
CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
|
CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
|
||||||
{
|
{
|
||||||
if (ms_pObjectPool->IsFreeSlot(slot)) return;
|
if (ms_pObjectPool->GetIsFree(slot)) return;
|
||||||
|
|
||||||
CObject *object = ms_pObjectPool->GetSlot(slot);
|
CObject *object = ms_pObjectPool->GetSlot(slot);
|
||||||
if (object->ObjectCreatedBy == TEMP_OBJECT) {
|
if (object->ObjectCreatedBy == TEMP_OBJECT) {
|
||||||
@ -485,7 +485,7 @@ INITSAVEBUF
|
|||||||
#endif
|
#endif
|
||||||
CopyToBuf(buf, CWanted::MaximumWantedLevel);
|
CopyToBuf(buf, CWanted::MaximumWantedLevel);
|
||||||
CopyToBuf(buf, CWanted::nMaximumWantedLevel);
|
CopyToBuf(buf, CWanted::nMaximumWantedLevel);
|
||||||
memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetName(), MAX_MODEL_NAME);
|
memcpy(buf, CModelInfo::GetModelInfo(pPed->GetModelIndex())->GetModelName(), MAX_MODEL_NAME);
|
||||||
SkipSaveBuf(buf, MAX_MODEL_NAME);
|
SkipSaveBuf(buf, MAX_MODEL_NAME);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
#if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__)
|
||||||
|
#define WITHD3D
|
||||||
|
#endif
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
@ -295,10 +298,10 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
|
|||||||
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
|
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
|
||||||
{
|
{
|
||||||
CVector2D corners[4] = {
|
CVector2D corners[4] = {
|
||||||
{ 1.0f, -1.0f }, // top right
|
CVector2D( 1.0f, -1.0f ), // top right
|
||||||
{ 1.0f, 1.0f }, // bottom right
|
CVector2D( 1.0f, 1.0f ), // bottom right
|
||||||
{ -1.0f, 1.0f }, // bottom left
|
CVector2D( -1.0f, 1.0f ), // bottom left
|
||||||
{ -1.0f, -1.0f }, // top left
|
CVector2D( -1.0f, -1.0f ), // top left
|
||||||
};
|
};
|
||||||
CVector2D tmp;
|
CVector2D tmp;
|
||||||
int i, j, n;
|
int i, j, n;
|
||||||
@ -778,7 +781,7 @@ void CRadar::DrawRadarMask()
|
|||||||
CVector2D(-1.0, -1.0f)
|
CVector2D(-1.0, -1.0f)
|
||||||
};
|
};
|
||||||
|
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
|
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)nil);
|
||||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
|
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
|
||||||
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
|
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Sprite2d.h"
|
#include "Sprite2d.h"
|
||||||
|
#include "Draw.h"
|
||||||
|
|
||||||
enum eBlipType
|
enum eBlipType
|
||||||
{
|
{
|
||||||
@ -91,8 +92,28 @@ VALIDATE_SIZE(sRadarTrace, 0x30);
|
|||||||
#else
|
#else
|
||||||
#define RADAR_BOTTOM (47.0f)
|
#define RADAR_BOTTOM (47.0f)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef FIX_RADAR
|
||||||
|
/*
|
||||||
|
The values are from an early screenshot taken before R* broke radar
|
||||||
|
#define RADAR_WIDTH (82.0f)
|
||||||
|
#define RADAR_HEIGHT (82.0f)
|
||||||
|
*/
|
||||||
|
#define RADAR_WIDTH ((CDraw::ms_bFixRadar) ? (82.0f) : (94.0f))
|
||||||
|
#define RADAR_HEIGHT ((CDraw::ms_bFixRadar) ? (82.0f) : (76.0f))
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
broken since forever, someone tried to fix size for 640x512(PAL)
|
||||||
|
http://aap.rockstarvision.com/pics/gta3/ps2screens/gta3_interface.jpg
|
||||||
|
but failed:
|
||||||
|
http://aap.rockstarvision.com/pics/gta3/artwork/gta3_artwork_16.jpg
|
||||||
|
most likely the guy used something like this:
|
||||||
|
int y = 82 * (640.0/512.0)/(640.0/480.0);
|
||||||
|
int x = y * (640.0/512.0);
|
||||||
|
*/
|
||||||
#define RADAR_WIDTH (94.0f)
|
#define RADAR_WIDTH (94.0f)
|
||||||
#define RADAR_HEIGHT (76.0f)
|
#define RADAR_HEIGHT (76.0f)
|
||||||
|
#endif
|
||||||
|
|
||||||
class CRadar
|
class CRadar
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ public:
|
|||||||
static int32 NumberKillFrenziesPassed;
|
static int32 NumberKillFrenziesPassed;
|
||||||
static int32 PeopleKilledByOthers;
|
static int32 PeopleKilledByOthers;
|
||||||
static int32 HelisDestroyed;
|
static int32 HelisDestroyed;
|
||||||
static int32 PedsKilledOfThisType[ePedType::NUM_PEDTYPES];
|
static int32 PedsKilledOfThisType[NUM_PEDTYPES];
|
||||||
static int32 TimesDied;
|
static int32 TimesDied;
|
||||||
static int32 TimesArrested;
|
static int32 TimesArrested;
|
||||||
static int32 KillsSinceLastCheckpoint;
|
static int32 KillsSinceLastCheckpoint;
|
||||||
|
@ -519,10 +519,18 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
|||||||
mi = CModelInfo::GetModelInfo(streamId);
|
mi = CModelInfo::GetModelInfo(streamId);
|
||||||
|
|
||||||
// Txd has to be loaded
|
// Txd has to be loaded
|
||||||
|
#ifdef FIX_BUGS
|
||||||
|
if(!HasTxdLoaded(mi->GetTxdSlot())){
|
||||||
|
#else
|
||||||
|
// texDict will exist even if only first part has loaded
|
||||||
if(CTxdStore::GetSlot(mi->GetTxdSlot())->texDict == nil){
|
if(CTxdStore::GetSlot(mi->GetTxdSlot())->texDict == nil){
|
||||||
debug("failed to load %s because TXD %s is not in memory\n", mi->GetName(), CTxdStore::GetTxdName(mi->GetTxdSlot()));
|
#endif
|
||||||
|
debug("failed to load %s because TXD %s is not in memory\n", mi->GetModelName(), CTxdStore::GetTxdName(mi->GetTxdSlot()));
|
||||||
RemoveModel(streamId);
|
RemoveModel(streamId);
|
||||||
|
#ifndef FIX_BUGS
|
||||||
|
// if we're just waiting for it to load, don't remove this
|
||||||
RemoveTxd(mi->GetTxdSlot());
|
RemoveTxd(mi->GetTxdSlot());
|
||||||
|
#endif
|
||||||
ReRequestModel(streamId);
|
ReRequestModel(streamId);
|
||||||
RwStreamClose(stream, &mem);
|
RwStreamClose(stream, &mem);
|
||||||
return false;
|
return false;
|
||||||
@ -559,7 +567,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
|||||||
CTxdStore::RemoveRefWithoutDelete(mi->GetTxdSlot());
|
CTxdStore::RemoveRefWithoutDelete(mi->GetTxdSlot());
|
||||||
|
|
||||||
if(!success){
|
if(!success){
|
||||||
debug("Failed to load %s\n", CModelInfo::GetModelInfo(streamId)->GetName());
|
debug("Failed to load %s\n", CModelInfo::GetModelInfo(streamId)->GetModelName());
|
||||||
RemoveModel(streamId);
|
RemoveModel(streamId);
|
||||||
ReRequestModel(streamId);
|
ReRequestModel(streamId);
|
||||||
RwStreamClose(stream, &mem);
|
RwStreamClose(stream, &mem);
|
||||||
@ -600,7 +608,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
|||||||
if(!success){
|
if(!success){
|
||||||
ReRequestModel(streamId);
|
ReRequestModel(streamId);
|
||||||
if(streamId < STREAM_OFFSET_TXD)
|
if(streamId < STREAM_OFFSET_TXD)
|
||||||
debug("Failed to load %s.dff\n", mi->GetName());
|
debug("Failed to load %s.dff\n", mi->GetModelName());
|
||||||
else
|
else
|
||||||
debug("Failed to load %s.txd\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD));
|
debug("Failed to load %s.txd\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD));
|
||||||
return false;
|
return false;
|
||||||
@ -641,7 +649,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
|||||||
timeDiff = endTime - startTime;
|
timeDiff = endTime - startTime;
|
||||||
if(timeDiff > 5){
|
if(timeDiff > 5){
|
||||||
if(streamId < STREAM_OFFSET_TXD)
|
if(streamId < STREAM_OFFSET_TXD)
|
||||||
debug("model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetName(), timeDiff);
|
debug("model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetModelName(), timeDiff);
|
||||||
else
|
else
|
||||||
debug("txd %s took %d ms\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD), timeDiff);
|
debug("txd %s took %d ms\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD), timeDiff);
|
||||||
}
|
}
|
||||||
@ -715,7 +723,7 @@ CStreaming::FinishLoadingLargeFile(int8 *buf, int32 streamId)
|
|||||||
timeDiff = endTime - startTime;
|
timeDiff = endTime - startTime;
|
||||||
if(timeDiff > 5){
|
if(timeDiff > 5){
|
||||||
if(streamId < STREAM_OFFSET_TXD)
|
if(streamId < STREAM_OFFSET_TXD)
|
||||||
debug("finish model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetName(), timeDiff);
|
debug("finish model %s took %d ms\n", CModelInfo::GetModelInfo(streamId)->GetModelName(), timeDiff);
|
||||||
else
|
else
|
||||||
debug("finish txd %s took %d ms\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD), timeDiff);
|
debug("finish txd %s took %d ms\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD), timeDiff);
|
||||||
}
|
}
|
||||||
@ -869,14 +877,14 @@ CStreaming::RequestSpecialModel(int32 modelId, const char *modelName, int32 flag
|
|||||||
uint32 pos, size;
|
uint32 pos, size;
|
||||||
|
|
||||||
mi = CModelInfo::GetModelInfo(modelId);
|
mi = CModelInfo::GetModelInfo(modelId);
|
||||||
if(!CGeneral::faststrcmp(mi->GetName(), modelName)){
|
if(!CGeneral::faststrcmp(mi->GetModelName(), modelName)){
|
||||||
// Already have the correct name, just request it
|
// Already have the correct name, just request it
|
||||||
RequestModel(modelId, flags);
|
RequestModel(modelId, flags);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(oldName, mi->GetName());
|
strcpy(oldName, mi->GetModelName());
|
||||||
mi->SetName(modelName);
|
mi->SetModelName(modelName);
|
||||||
|
|
||||||
// What exactly is going on here?
|
// What exactly is going on here?
|
||||||
if(CModelInfo::GetModelInfo(oldName, nil)){
|
if(CModelInfo::GetModelInfo(oldName, nil)){
|
||||||
@ -2777,7 +2785,7 @@ CStreaming::PrintStreamingBufferState()
|
|||||||
sprintf(str, "txd %s, refs %d, size %dK, flags 0x%x", CTxdStore::GetTxdName(modelIndex - STREAM_OFFSET_TXD),
|
sprintf(str, "txd %s, refs %d, size %dK, flags 0x%x", CTxdStore::GetTxdName(modelIndex - STREAM_OFFSET_TXD),
|
||||||
CTxdStore::GetNumRefs(modelIndex - STREAM_OFFSET_TXD), 2 * size, streamingInfo->m_flags);
|
CTxdStore::GetNumRefs(modelIndex - STREAM_OFFSET_TXD), 2 * size, streamingInfo->m_flags);
|
||||||
else
|
else
|
||||||
sprintf(str, "model %d,%s, refs%d, size%dK, flags%x", modelIndex, modelInfo->GetName(), modelInfo->GetNumRefs(), 2 * size,
|
sprintf(str, "model %d,%s, refs%d, size%dK, flags%x", modelIndex, modelInfo->GetModelName(), modelInfo->GetNumRefs(), 2 * size,
|
||||||
streamingInfo->m_flags);
|
streamingInfo->m_flags);
|
||||||
AsciiToUnicode(str, wstr);
|
AsciiToUnicode(str, wstr);
|
||||||
CFont::PrintString(24.0f, y, wstr);
|
CFont::PrintString(24.0f, y, wstr);
|
||||||
|
@ -37,6 +37,7 @@ public:
|
|||||||
int32 NumOfHelisRequired();
|
int32 NumOfHelisRequired();
|
||||||
void SetWantedLevel(int32);
|
void SetWantedLevel(int32);
|
||||||
void SetWantedLevelNoDrop(int32 level);
|
void SetWantedLevelNoDrop(int32 level);
|
||||||
|
int32 GetWantedLevel() { return m_nWantedLevel; }
|
||||||
void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
||||||
void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
||||||
void ClearQdCrimes();
|
void ClearQdCrimes();
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#include "CopPed.h"
|
#include "CopPed.h"
|
||||||
#include "CutsceneMgr.h"
|
#include "CutsceneMgr.h"
|
||||||
#include "DMAudio.h"
|
#include "DMAudio.h"
|
||||||
#include "Entity.h"
|
|
||||||
#include "EventList.h"
|
#include "EventList.h"
|
||||||
#include "Explosion.h"
|
#include "Explosion.h"
|
||||||
#include "Fire.h"
|
#include "Fire.h"
|
||||||
@ -12,10 +11,7 @@
|
|||||||
#include "Glass.h"
|
#include "Glass.h"
|
||||||
#include "Messages.h"
|
#include "Messages.h"
|
||||||
#include "ModelIndices.h"
|
#include "ModelIndices.h"
|
||||||
#include "Object.h"
|
|
||||||
#include "ParticleObject.h"
|
#include "ParticleObject.h"
|
||||||
#include "Ped.h"
|
|
||||||
#include "PlayerPed.h"
|
|
||||||
#include "Population.h"
|
#include "Population.h"
|
||||||
#include "ProjectileInfo.h"
|
#include "ProjectileInfo.h"
|
||||||
#include "Record.h"
|
#include "Record.h"
|
||||||
@ -24,7 +20,6 @@
|
|||||||
#include "RpAnimBlend.h"
|
#include "RpAnimBlend.h"
|
||||||
#include "Shadows.h"
|
#include "Shadows.h"
|
||||||
#include "TempColModels.h"
|
#include "TempColModels.h"
|
||||||
#include "Vehicle.h"
|
|
||||||
#include "WaterLevel.h"
|
#include "WaterLevel.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
@ -785,10 +780,10 @@ CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector &position, float
|
|||||||
*nEntitiesFound = 0;
|
*nEntitiesFound = 0;
|
||||||
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
|
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
|
||||||
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
|
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
|
||||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
|
const int32 nStartX = Max(GetSectorIndexX(vecSectorStartPos.x), 0);
|
||||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
const int32 nStartY = Max(GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = GetSector(x, y);
|
CSector *pSector = GetSector(x, y);
|
||||||
@ -1056,10 +1051,10 @@ CWorld::FindObjectsKindaColliding(const CVector &position, float radius, bool bC
|
|||||||
*nCollidingEntities = 0;
|
*nCollidingEntities = 0;
|
||||||
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
|
const CVector2D vecSectorStartPos(position.x - radius, position.y - radius);
|
||||||
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
|
const CVector2D vecSectorEndPos(position.x + radius, position.y + radius);
|
||||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecSectorStartPos.x), 0);
|
const int32 nStartX = Max(GetSectorIndexX(vecSectorStartPos.x), 0);
|
||||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
const int32 nStartY = Max(GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = GetSector(x, y);
|
CSector *pSector = GetSector(x, y);
|
||||||
@ -1135,10 +1130,10 @@ CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &v
|
|||||||
{
|
{
|
||||||
AdvanceCurrentScanCode();
|
AdvanceCurrentScanCode();
|
||||||
*nIntersecting = 0;
|
*nIntersecting = 0;
|
||||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0);
|
||||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0);
|
||||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = GetSector(x, y);
|
CSector *pSector = GetSector(x, y);
|
||||||
@ -1216,10 +1211,10 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, co
|
|||||||
{
|
{
|
||||||
AdvanceCurrentScanCode();
|
AdvanceCurrentScanCode();
|
||||||
*nEntitiesFound = 0;
|
*nEntitiesFound = 0;
|
||||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
const int32 nStartX = Max(GetSectorIndexX(fStartX), 0);
|
||||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
const int32 nStartY = Max(GetSectorIndexY(fStartY), 0);
|
||||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = GetSector(x, y);
|
CSector *pSector = GetSector(x, y);
|
||||||
@ -1296,10 +1291,10 @@ CWorld::FindMissionEntitiesIntersectingCube(const CVector &vecStartPos, const CV
|
|||||||
{
|
{
|
||||||
AdvanceCurrentScanCode();
|
AdvanceCurrentScanCode();
|
||||||
*nIntersecting = 0;
|
*nIntersecting = 0;
|
||||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0);
|
||||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0);
|
||||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = GetSector(x, y);
|
CSector *pSector = GetSector(x, y);
|
||||||
@ -1414,10 +1409,10 @@ CWorld::CallOffChaseForArea(float x1, float y1, float x2, float y2)
|
|||||||
float fStartY = y1 - 10.0f;
|
float fStartY = y1 - 10.0f;
|
||||||
float fEndX = x2 + 10.0f;
|
float fEndX = x2 + 10.0f;
|
||||||
float fEndY = y2 + 10.0f;
|
float fEndY = y2 + 10.0f;
|
||||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
const int32 nStartX = Max(GetSectorIndexX(fStartX), 0);
|
||||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
const int32 nStartY = Max(GetSectorIndexY(fStartY), 0);
|
||||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = GetSector(x, y);
|
CSector *pSector = GetSector(x, y);
|
||||||
@ -1854,9 +1849,9 @@ CWorld::Process(void)
|
|||||||
if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
|
if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
|
||||||
RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
|
RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
|
||||||
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(),
|
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(),
|
||||||
0.02f * (csObj->IsObject()
|
csObj->IsObject()
|
||||||
? CTimer::GetTimeStepNonClipped()
|
? CTimer::GetTimeStepNonClippedInSeconds()
|
||||||
: CTimer::GetTimeStep()));
|
: CTimer::GetTimeStepInSeconds());
|
||||||
}
|
}
|
||||||
csObj->ProcessControl();
|
csObj->ProcessControl();
|
||||||
csObj->ProcessCollision();
|
csObj->ProcessCollision();
|
||||||
@ -1876,9 +1871,9 @@ CWorld::Process(void)
|
|||||||
#endif
|
#endif
|
||||||
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
|
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
|
||||||
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(),
|
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(),
|
||||||
0.02f * (movingEnt->IsObject()
|
movingEnt->IsObject()
|
||||||
? CTimer::GetTimeStepNonClipped()
|
? CTimer::GetTimeStepNonClippedInSeconds()
|
||||||
: CTimer::GetTimeStep()));
|
: CTimer::GetTimeStepInSeconds());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
|
for(CPtrNode *node = ms_listMovingEntityPtrs.first; node; node = node->next) {
|
||||||
@ -2020,10 +2015,10 @@ CWorld::TriggerExplosion(const CVector &position, float fRadius, float fPower, C
|
|||||||
{
|
{
|
||||||
CVector2D vecStartPos(position.x - fRadius, position.y - fRadius);
|
CVector2D vecStartPos(position.x - fRadius, position.y - fRadius);
|
||||||
CVector2D vecEndPos(position.x + fRadius, position.y + fRadius);
|
CVector2D vecEndPos(position.x + fRadius, position.y + fRadius);
|
||||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0);
|
||||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0);
|
||||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
const int32 nEndX = Min(GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
const int32 nEndY = Min(GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||||
CSector *pSector = GetSector(x, y);
|
CSector *pSector = GetSector(x, y);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#include "Game.h"
|
#include "Game.h"
|
||||||
#include "Lists.h"
|
#include "Lists.h"
|
||||||
#include "PlayerInfo.h"
|
#include "PlayerInfo.h"
|
||||||
|
#include "Collision.h"
|
||||||
|
|
||||||
/* Sectors span from -2000 to 2000 in x and y.
|
/* Sectors span from -2000 to 2000 in x and y.
|
||||||
* With 100x100 sectors, each is 40x40 units. */
|
* With 100x100 sectors, each is 40x40 units. */
|
||||||
@ -48,11 +49,6 @@ public:
|
|||||||
|
|
||||||
VALIDATE_SIZE(CSector, 0x28);
|
VALIDATE_SIZE(CSector, 0x28);
|
||||||
|
|
||||||
class CEntity;
|
|
||||||
struct CColPoint;
|
|
||||||
struct CColLine;
|
|
||||||
struct CStoredCollPoly;
|
|
||||||
|
|
||||||
class CWorld
|
class CWorld
|
||||||
{
|
{
|
||||||
static CPtrList ms_bigBuildingsList[NUM_LEVELS];
|
static CPtrList ms_bigBuildingsList[NUM_LEVELS];
|
||||||
|
@ -649,7 +649,7 @@ CTheZones::SaveAllZones(uint8 *buffer, uint32 *size)
|
|||||||
|
|
||||||
WriteSaveHeader(buffer, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
|
WriteSaveHeader(buffer, 'Z', 'N', 'S', '\0', *size - SAVE_HEADER_SIZE);
|
||||||
|
|
||||||
WriteSaveBuf(buffer, GetIndexForZonePointer(m_pPlayersZone));
|
WriteSaveBuf(buffer, (int32)GetIndexForZonePointer(m_pPlayersZone));
|
||||||
WriteSaveBuf(buffer, m_CurrLevel);
|
WriteSaveBuf(buffer, m_CurrLevel);
|
||||||
WriteSaveBuf(buffer, FindIndex);
|
WriteSaveBuf(buffer, FindIndex);
|
||||||
WriteSaveBuf(buffer, (int16)0); // padding
|
WriteSaveBuf(buffer, (int16)0); // padding
|
||||||
|
@ -105,8 +105,8 @@ public:
|
|||||||
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
|
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
|
||||||
static int16 FindAudioZone(CVector *pos);
|
static int16 FindAudioZone(CVector *pos);
|
||||||
static eLevelName FindZoneForPoint(const CVector &pos);
|
static eLevelName FindZoneForPoint(const CVector &pos);
|
||||||
static CZone *GetPointerForZoneIndex(int32 i) { return i == -1 ? nil : &ZoneArray[i]; }
|
static CZone *GetPointerForZoneIndex(ssize_t i) { return i == -1 ? nil : &ZoneArray[i]; }
|
||||||
static int32 GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - ZoneArray; }
|
static ssize_t GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - ZoneArray; }
|
||||||
static void AddZoneToAudioZoneArray(CZone *zone);
|
static void AddZoneToAudioZoneArray(CZone *zone);
|
||||||
static void InitialiseAudioZoneArray(void);
|
static void InitialiseAudioZoneArray(void);
|
||||||
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
||||||
|
@ -7,21 +7,47 @@
|
|||||||
#pragma warning(disable: 4838) // narrowing conversion
|
#pragma warning(disable: 4838) // narrowing conversion
|
||||||
#pragma warning(disable: 4996) // POSIX names
|
#pragma warning(disable: 4996) // POSIX names
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#if defined _WIN32 && defined WITHWINDOWS
|
#ifdef __MWERKS__
|
||||||
|
#define AUDIO_MSS
|
||||||
|
#define RWLIBS // codewarrior doesn't support project level defines - so not even this is enough, but still catches most ifdefs
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !defined RW_D3D9 && defined LIBRW
|
||||||
|
#undef WITHD3D
|
||||||
|
#undef WITHDINPUT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if (defined WITHD3D && !defined LIBRW)
|
||||||
|
#define WITHWINDOWS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined _WIN32 && defined WITHWINDOWS && !defined _INC_WINDOWS
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined _WIN32 && defined WITHD3D
|
#ifdef WITHD3D
|
||||||
#include <windows.h>
|
#ifdef LIBRW
|
||||||
#ifndef USE_D3D9
|
#define WITH_D3D // librw includes d3d9 itself via this right now
|
||||||
#include <d3d8types.h>
|
#else
|
||||||
#else
|
#ifndef USE_D3D9
|
||||||
#include <d3d9types.h>
|
#include <d3d8.h>
|
||||||
|
#else
|
||||||
|
#include <d3d9.h>
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef WITHDINPUT
|
||||||
|
#define DIRECTINPUT_VERSION 0x0800
|
||||||
|
#include <dinput.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <rwcore.h>
|
#include <rwcore.h>
|
||||||
@ -52,14 +78,6 @@
|
|||||||
|
|
||||||
#define rwVENDORID_ROCKSTAR 0x0253F2
|
#define rwVENDORID_ROCKSTAR 0x0253F2
|
||||||
|
|
||||||
// Get rid of bullshit windows definitions, we're not running on an 8086
|
|
||||||
#ifdef far
|
|
||||||
#undef far
|
|
||||||
#endif
|
|
||||||
#ifdef near
|
|
||||||
#undef near
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define Max(a,b) ((a) > (b) ? (a) : (b))
|
#define Max(a,b) ((a) > (b) ? (a) : (b))
|
||||||
#define Min(a,b) ((a) < (b) ? (a) : (b))
|
#define Min(a,b) ((a) < (b) ? (a) : (b))
|
||||||
|
|
||||||
@ -70,8 +88,13 @@ typedef uint8_t uint8;
|
|||||||
typedef int8_t int8;
|
typedef int8_t int8;
|
||||||
typedef uint16_t uint16;
|
typedef uint16_t uint16;
|
||||||
typedef int16_t int16;
|
typedef int16_t int16;
|
||||||
|
#ifndef __MWERKS__
|
||||||
typedef uint32_t uint32;
|
typedef uint32_t uint32;
|
||||||
typedef int32_t int32;
|
typedef int32_t int32;
|
||||||
|
#else
|
||||||
|
typedef unsigned int uint32;
|
||||||
|
typedef int int32;
|
||||||
|
#endif
|
||||||
typedef uintptr_t uintptr;
|
typedef uintptr_t uintptr;
|
||||||
typedef intptr_t intptr;
|
typedef intptr_t intptr;
|
||||||
typedef uint64_t uint64;
|
typedef uint64_t uint64;
|
||||||
@ -113,6 +136,11 @@ inline float _floatswap32(float f)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
|
typedef uint8 bool8;
|
||||||
|
typedef uint16 bool16;
|
||||||
|
typedef uint32 bool32;
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) || defined (__MWERKS__)
|
||||||
typedef ptrdiff_t ssize_t;
|
typedef ptrdiff_t ssize_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -154,7 +182,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
|||||||
#include "skeleton.h"
|
#include "skeleton.h"
|
||||||
#include "Draw.h"
|
#include "Draw.h"
|
||||||
|
|
||||||
#if defined(USE_PROPER_SCALING)
|
#if defined(PROPER_SCALING) || defined(PS2_HUD)
|
||||||
#ifdef FORCE_PC_SCALING
|
#ifdef FORCE_PC_SCALING
|
||||||
#define DEFAULT_SCREEN_WIDTH (640)
|
#define DEFAULT_SCREEN_WIDTH (640)
|
||||||
#define DEFAULT_SCREEN_HEIGHT (448)
|
#define DEFAULT_SCREEN_HEIGHT (448)
|
||||||
@ -188,8 +216,8 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
|||||||
#define SCREEN_HEIGHT ((float)RsGlobal.height)
|
#define SCREEN_HEIGHT ((float)RsGlobal.height)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define SCREEN_HEIGHT_PAL (512)
|
#define SCREEN_HEIGHT_PAL ((float)512)
|
||||||
#define SCREEN_HEIGHT_NTSC (448)
|
#define SCREEN_HEIGHT_NTSC ((float)448)
|
||||||
|
|
||||||
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
|
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
|
||||||
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
|
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
|
||||||
@ -208,8 +236,13 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
|||||||
|
|
||||||
#ifdef ASPECT_RATIO_SCALE
|
#ifdef ASPECT_RATIO_SCALE
|
||||||
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
|
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
|
||||||
extern float ScaleAndCenterX(float x);
|
#define SCALE_AND_CENTER_X(x) ((SCREEN_WIDTH == DEFAULT_SCREEN_WIDTH) ? (x) : (SCREEN_WIDTH - SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH)) / 2 + SCREEN_SCALE_X((x)))
|
||||||
#define SCALE_AND_CENTER_X(x) ScaleAndCenterX(x)
|
#ifdef PROPER_SCALING
|
||||||
|
#ifndef FORCE_PC_SCALING
|
||||||
|
#undef SCREEN_SCALE_Y
|
||||||
|
#define SCREEN_SCALE_Y(a) CDraw::ScaleY(SCREEN_STRETCH_Y(a))
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
#define SCREEN_SCALE_AR(a) (a)
|
#define SCREEN_SCALE_AR(a) (a)
|
||||||
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
|
#define SCALE_AND_CENTER_X(x) SCREEN_STRETCH_X(x)
|
||||||
@ -290,6 +323,22 @@ extern wchar *AllocUnicode(const char*src);
|
|||||||
inline float sq(float x) { return x*x; }
|
inline float sq(float x) { return x*x; }
|
||||||
#define SQR(x) ((x) * (x))
|
#define SQR(x) ((x) * (x))
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#define M_E 2.71828182845904523536 // e
|
||||||
|
#define M_LOG2E 1.44269504088896340736 // log2(e)
|
||||||
|
#define M_LOG10E 0.434294481903251827651 // log10(e)
|
||||||
|
#define M_LN2 0.693147180559945309417 // ln(2)
|
||||||
|
#define M_LN10 2.30258509299404568402 // ln(10)
|
||||||
|
#define M_PI 3.14159265358979323846 // pi
|
||||||
|
#define M_PI_2 1.57079632679489661923 // pi/2
|
||||||
|
#define M_PI_4 0.785398163397448309616 // pi/4
|
||||||
|
#define M_1_PI 0.318309886183790671538 // 1/pi
|
||||||
|
#define M_2_PI 0.636619772367581343076 // 2/pi
|
||||||
|
#define M_2_SQRTPI 1.12837916709551257390 // 2/sqrt(pi)
|
||||||
|
#define M_SQRT2 1.41421356237309504880 // sqrt(2)
|
||||||
|
#define M_SQRT1_2 0.707106781186547524401 // 1/sqrt(2)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define PI (float)M_PI
|
#define PI (float)M_PI
|
||||||
#define TWOPI (PI*2)
|
#define TWOPI (PI*2)
|
||||||
#define HALFPI (PI/2)
|
#define HALFPI (PI/2)
|
||||||
@ -319,20 +368,43 @@ void re3_usererror(const char *format, ...);
|
|||||||
#define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__)
|
#define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
void debug(char *f, ...);
|
||||||
|
void Error(char *f, ...);
|
||||||
|
__inline__ void TRACE(char *f, ...) { } // this is re3 only, and so the function needs to be inline - this way no call actually gets placed
|
||||||
|
// USERERROR only gets used in oal builds ... once
|
||||||
|
#else
|
||||||
#define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__)
|
#define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__)
|
||||||
#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__)
|
|
||||||
#define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__)
|
#define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__)
|
||||||
|
#ifndef MASTER
|
||||||
|
#define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__)
|
||||||
#define USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__)
|
#define USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define TRACE(f, ...)
|
||||||
|
#define USERERROR(f, ...)
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef assert
|
#undef assert
|
||||||
|
#ifndef MASTER
|
||||||
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
|
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
|
||||||
|
#else
|
||||||
|
#define assert(_Expression)
|
||||||
|
#endif
|
||||||
#define ASSERT assert
|
#define ASSERT assert
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
#define static_assert(bool_constexpr, message)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define _TODO(x)
|
#define _TODO(x)
|
||||||
#define _TODOCONST(x) (x)
|
#define _TODOCONST(x) (x)
|
||||||
|
|
||||||
#ifdef CHECK_STRUCT_SIZES
|
#ifdef CHECK_STRUCT_SIZES
|
||||||
#define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc)
|
template<int s, int t> struct check_size {
|
||||||
|
static_assert(s == t, "Invalid structure size");
|
||||||
|
};
|
||||||
|
#define VALIDATE_SIZE(struc, size) check_size<sizeof(struc), size> struc ## Check
|
||||||
#else
|
#else
|
||||||
#define VALIDATE_SIZE(struc, size)
|
#define VALIDATE_SIZE(struc, size)
|
||||||
#endif
|
#endif
|
||||||
@ -351,6 +423,7 @@ void re3_usererror(const char *format, ...);
|
|||||||
#define CONCAT_(x,y) x##y
|
#define CONCAT_(x,y) x##y
|
||||||
#define CONCAT(x,y) CONCAT_(x,y)
|
#define CONCAT(x,y) CONCAT_(x,y)
|
||||||
|
|
||||||
|
#ifdef DEBUGMENU
|
||||||
// Tweaking stuff for debugmenu
|
// Tweaking stuff for debugmenu
|
||||||
#define TWEAKPATH ___tw___TWEAKPATH
|
#define TWEAKPATH ___tw___TWEAKPATH
|
||||||
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
|
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
|
||||||
@ -464,6 +537,7 @@ _TWEEKCLASS(CTweakUInt32, uint32);
|
|||||||
_TWEEKCLASS(CTweakFloat, float);
|
_TWEEKCLASS(CTweakFloat, float);
|
||||||
|
|
||||||
#undef _TWEEKCLASS
|
#undef _TWEEKCLASS
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VALIDATE_SAVE_SIZE
|
#ifdef VALIDATE_SAVE_SIZE
|
||||||
extern int32 _saveBufCount;
|
extern int32 _saveBufCount;
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// disables (most) stuff that wasn't in original gta3.exe - check section at the bottom of this file
|
||||||
|
//#define VANILLA_DEFINES
|
||||||
|
|
||||||
enum Config {
|
enum Config {
|
||||||
NUMPLAYERS = 1, // 4 on PS2
|
NUMPLAYERS = 1, // 4 on PS2
|
||||||
|
|
||||||
@ -8,8 +11,11 @@ enum Config {
|
|||||||
MAX_CDCHANNELS = 5,
|
MAX_CDCHANNELS = 5,
|
||||||
|
|
||||||
MODELINFOSIZE = 5500, // 3150 on PS2
|
MODELINFOSIZE = 5500, // 3150 on PS2
|
||||||
// TXDSTORESIZE = 850,
|
#if defined __MWERKS__ || defined VANILLA_DEFINES
|
||||||
|
TXDSTORESIZE = 850,
|
||||||
|
#else
|
||||||
TXDSTORESIZE = 1024, // for Xbox map
|
TXDSTORESIZE = 1024, // for Xbox map
|
||||||
|
#endif
|
||||||
EXTRADIRSIZE = 128,
|
EXTRADIRSIZE = 128,
|
||||||
CUTSCENEDIRSIZE = 512,
|
CUTSCENEDIRSIZE = 512,
|
||||||
|
|
||||||
@ -228,11 +234,21 @@ enum Config {
|
|||||||
# define TIMEBARS // print debug timers
|
# define TIMEBARS // print debug timers
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FIX_BUGS // fixes bugs that we've came across during reversing
|
#define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds.
|
||||||
#define MORE_LANGUAGES // Add more translations to the game
|
#define MORE_LANGUAGES // Add more translations to the game
|
||||||
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
|
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
|
||||||
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
|
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
|
||||||
|
|
||||||
|
#if defined(__LP64__) || defined(_WIN64)
|
||||||
|
#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define ASCII_STRCMP // use faster ascii str comparisons
|
||||||
|
|
||||||
|
#if !defined _WIN32 || defined __MWERKS__ || defined __MINGW32__ || defined VANILLA_DEFINES
|
||||||
|
#undef ASCII_STRCMP
|
||||||
|
#endif
|
||||||
|
|
||||||
// Just debug menu entries
|
// Just debug menu entries
|
||||||
#ifdef DEBUGMENU
|
#ifdef DEBUGMENU
|
||||||
#define MISSION_SWITCHER // from debug menu
|
#define MISSION_SWITCHER // from debug menu
|
||||||
@ -243,21 +259,26 @@ enum Config {
|
|||||||
//# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
|
//# define HARDCODED_MODEL_FLAGS // sets the flags enabled above from hardcoded model names.
|
||||||
// NB: keep this enabled unless your map IDEs have these flags baked in
|
// NB: keep this enabled unless your map IDEs have these flags baked in
|
||||||
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
|
||||||
|
#define PROPER_SCALING // use original DEFAULT_SCREEN_WIDTH/DEFAULT_SCREEN_HEIGHT from PS2 instead of PC(R* changed HEIGHT here to make radar look better, but broke other hud elements aspect ratio).
|
||||||
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
|
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
|
||||||
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
|
#define USE_TXD_CDIMAGE // generate and load textures from txd.img
|
||||||
#define PS2_ALPHA_TEST // emulate ps2 alpha test
|
#define PS2_ALPHA_TEST // emulate ps2 alpha test
|
||||||
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
|
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
|
||||||
// #define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
|
// #define DISABLE_LOADING_SCREEN // disable the loading screen which vastly improves the loading time
|
||||||
#define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync
|
#define DISABLE_VSYNC_ON_TEXTURE_CONVERSION // make texture conversion work faster by disabling vsync
|
||||||
|
#define ANISOTROPIC_FILTERING // set all textures to max anisotropic filtering
|
||||||
//#define USE_TEXTURE_POOL
|
//#define USE_TEXTURE_POOL
|
||||||
#ifdef LIBRW
|
#ifdef LIBRW
|
||||||
#ifndef __WIIU__
|
#ifndef __WIIU__
|
||||||
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||||
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||||
#define SCREEN_DROPLETS // neo water droplets
|
#define SCREEN_DROPLETS // neo water droplets
|
||||||
|
#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc)
|
||||||
|
|
||||||
#ifndef EXTENDED_COLOURFILTER
|
#ifndef EXTENDED_COLOURFILTER
|
||||||
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
|
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
|
||||||
#endif
|
#endif
|
||||||
@ -286,6 +307,7 @@ enum Config {
|
|||||||
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
|
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
|
||||||
// #define BETA_SLIDING_TEXT
|
// #define BETA_SLIDING_TEXT
|
||||||
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
|
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
|
||||||
|
#define FIX_RADAR // use radar size from early version before R* broke it
|
||||||
// #define XBOX_SUBTITLES // the infamous outlines
|
// #define XBOX_SUBTITLES // the infamous outlines
|
||||||
#define RADIO_OFF_TEXT
|
#define RADIO_OFF_TEXT
|
||||||
#define PC_MENU
|
#define PC_MENU
|
||||||
@ -328,6 +350,11 @@ enum Config {
|
|||||||
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef MASTER
|
||||||
|
#undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||||
|
#undef USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||||
|
#endif
|
||||||
|
|
||||||
// Replay
|
// Replay
|
||||||
//#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool!
|
//#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool!
|
||||||
//#define USE_BETA_REPLAY_MODE // adds another replay mode, a few seconds slomo (caution: buggy!)
|
//#define USE_BETA_REPLAY_MODE // adds another replay mode, a few seconds slomo (caution: buggy!)
|
||||||
@ -355,11 +382,22 @@ enum Config {
|
|||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
#define RADIO_SCROLL_TO_PREV_STATION
|
#define RADIO_SCROLL_TO_PREV_STATION
|
||||||
#ifndef AUDIO_OAL // is not working yet for openal
|
#define AUDIO_CACHE
|
||||||
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||||
#endif
|
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||||
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
|
#define AUDIO_OAL_USE_MPG123 // use mpg123 to support mp3 files
|
||||||
|
|
||||||
|
#ifdef AUDIO_OPUS
|
||||||
|
#define AUDIO_OAL_USE_OPUS // enable support of opus files
|
||||||
|
#define OPUS_AUDIO_PATHS // changes audio paths to opus paths (doesn't work if AUDIO_OAL_USE_OPUS isn't enabled)
|
||||||
|
#define OPUS_SFX // enable if your sfx.raw is encoded with opus (doesn't work if AUDIO_OAL_USE_OPUS isn't enabled)
|
||||||
|
|
||||||
|
#ifndef AUDIO_OAL_USE_OPUS
|
||||||
|
#undef OPUS_AUDIO_PATHS
|
||||||
|
#undef OPUS_SFX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
// IMG
|
// IMG
|
||||||
#define BIG_IMG // allows to read larger img files
|
#define BIG_IMG // allows to read larger img files
|
||||||
|
|
||||||
@ -369,8 +407,91 @@ enum Config {
|
|||||||
#undef NO_ISLAND_LOADING
|
#undef NO_ISLAND_LOADING
|
||||||
#define PC_PARTICLE
|
#define PC_PARTICLE
|
||||||
#define VC_PED_PORTS // To not process collisions always. But should be tested if that's really beneficial
|
#define VC_PED_PORTS // To not process collisions always. But should be tested if that's really beneficial
|
||||||
|
#define VC_RAIN_NERF // Reduces number of rain particles
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LIBRW
|
#if defined __MWERKS__ || defined VANILLA_DEFINES
|
||||||
// these are not supported with librw yet
|
#define FINAL
|
||||||
|
#undef CHATTYSPLASH
|
||||||
|
#undef TIMEBARS
|
||||||
|
//#define USE_MY_DOCUMENTS
|
||||||
|
|
||||||
|
#define MASTER
|
||||||
|
#undef VALIDATE_SAVE_SIZE
|
||||||
|
#undef NO_MOVIES
|
||||||
|
#undef DEBUGMENU
|
||||||
|
|
||||||
|
//#undef NASTY_GAME
|
||||||
|
//#undef NO_CDCHECK
|
||||||
|
|
||||||
|
#undef DRAW_GAME_VERSION_TEXT
|
||||||
|
#undef DRAW_MENU_VERSION_TEXT
|
||||||
|
|
||||||
|
#undef GTA_PS2_STUFF
|
||||||
|
#undef USE_PS2_RAND
|
||||||
|
#undef RANDOMSPLASH
|
||||||
|
#undef PS2_MATFX
|
||||||
|
|
||||||
|
#undef FIX_BUGS
|
||||||
|
#define THIS_IS_STUPID
|
||||||
|
#undef MORE_LANGUAGES
|
||||||
|
#undef COMPATIBLE_SAVES
|
||||||
|
#undef LOAD_INI_SETTINGS
|
||||||
|
|
||||||
|
#undef ASPECT_RATIO_SCALE
|
||||||
|
#undef PROPER_SCALING
|
||||||
|
//#undef DEFAULT_NATIVE_RESOLUTION
|
||||||
|
#undef PS2_ALPHA_TEST
|
||||||
|
#undef IMPROVED_VIDEOMODE
|
||||||
|
#undef DISABLE_LOADING_SCREEN
|
||||||
|
#undef DISABLE_VSYNC_ON_TEXTURE_CONVERSION
|
||||||
|
#undef ANISOTROPIC_FILTERING
|
||||||
|
//#define USE_TEXTURE_POOL // not possible because R* used custom RW33
|
||||||
|
|
||||||
|
#undef FIX_SPRITES
|
||||||
|
|
||||||
|
#define PC_PARTICLE
|
||||||
|
|
||||||
|
#undef XINPUT
|
||||||
|
#undef DETECT_PAD_INPUT_SWITCH
|
||||||
|
#undef KANGAROO_CHEAT
|
||||||
|
#undef ALLCARSHELI_CHEAT
|
||||||
|
#undef ALT_DODO_CHEAT
|
||||||
|
#undef REGISTER_START_BUTTON
|
||||||
|
#undef BIND_VEHICLE_FIREWEAPON
|
||||||
|
#undef BUTTON_ICONS
|
||||||
|
|
||||||
|
#undef HUD_ENHANCEMENTS
|
||||||
|
#undef TRIANGULAR_BLIPS
|
||||||
|
#undef FIX_RADAR
|
||||||
|
#undef RADIO_OFF_TEXT
|
||||||
|
|
||||||
|
#undef MENU_MAP
|
||||||
|
#undef SCROLLABLE_STATS_PAGE
|
||||||
|
#undef CUSTOM_FRONTEND_OPTIONS
|
||||||
|
|
||||||
|
#undef GRAPHICS_MENU_OPTIONS
|
||||||
|
#undef NO_ISLAND_LOADING
|
||||||
|
#undef CUTSCENE_BORDERS_SWITCH
|
||||||
|
#undef MULTISAMPLING
|
||||||
|
#undef INVERT_LOOK_FOR_PAD
|
||||||
|
|
||||||
|
#undef USE_DEBUG_SCRIPT_LOADER
|
||||||
|
#undef USE_MEASUREMENTS_IN_METERS
|
||||||
|
#undef USE_PRECISE_MEASUREMENT_CONVERTION
|
||||||
|
#undef MISSION_REPLAY
|
||||||
|
#undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||||
|
#undef USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||||
|
|
||||||
|
#define DONT_FIX_REPLAY_BUGS
|
||||||
|
|
||||||
|
#undef EXPLODING_AIRTRAIN
|
||||||
|
#undef CAMERA_PICKUP
|
||||||
|
#undef PED_SKIN
|
||||||
|
#undef ANIMATE_PED_COL_MODEL
|
||||||
|
#undef CANCELLABLE_CAR_ENTER
|
||||||
|
#undef IMPROVED_CAMERA
|
||||||
|
#undef FREE_CAM
|
||||||
|
#undef RADIO_SCROLL_TO_PREV_STATION
|
||||||
|
#undef BIG_IMG
|
||||||
#endif
|
#endif
|
||||||
|
@ -3,6 +3,9 @@
|
|||||||
#include "rphanim.h"
|
#include "rphanim.h"
|
||||||
#include "rpskin.h"
|
#include "rpskin.h"
|
||||||
#include "rtbmp.h"
|
#include "rtbmp.h"
|
||||||
|
#ifdef ANISOTROPIC_FILTERING
|
||||||
|
#include "rpanisot.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "CdStream.h"
|
#include "CdStream.h"
|
||||||
@ -121,6 +124,31 @@ bool gbPrintMemoryUsage;
|
|||||||
#define FOUND_GAME_TO_LOAD b_FoundRecentSavedGameWantToLoad
|
#define FOUND_GAME_TO_LOAD b_FoundRecentSavedGameWantToLoad
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
bool gbNewRenderer;
|
||||||
|
#define CLEARMODE (rwCAMERACLEARZ | rwCAMERACLEARSTENCIL)
|
||||||
|
#else
|
||||||
|
#define CLEARMODE (rwCAMERACLEARZ)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __MWERKS__
|
||||||
|
void
|
||||||
|
debug(char *fmt, ...)
|
||||||
|
{
|
||||||
|
#ifndef MASTER
|
||||||
|
// TODO put something here
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Error(char *fmt, ...)
|
||||||
|
{
|
||||||
|
#ifndef MASTER
|
||||||
|
// TODO put something here
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
ValidateVersion()
|
ValidateVersion()
|
||||||
{
|
{
|
||||||
@ -168,7 +196,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &TopColor.rwRGBA, CLEARMODE);
|
||||||
|
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
return false;
|
return false;
|
||||||
@ -190,7 +218,7 @@ DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||||
|
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
return false;
|
return false;
|
||||||
@ -407,6 +435,9 @@ PluginAttach(void)
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
#ifdef ANISOTROPIC_FILTERING
|
||||||
|
RpAnisotPluginAttach();
|
||||||
|
#endif
|
||||||
#ifdef EXTENDED_PIPELINES
|
#ifdef EXTENDED_PIPELINES
|
||||||
CustomPipes::CustomPipeRegister();
|
CustomPipes::CustomPipeRegister();
|
||||||
#endif
|
#endif
|
||||||
@ -850,6 +881,7 @@ ProcessSlowMode(void)
|
|||||||
float FramesPerSecondCounter;
|
float FramesPerSecondCounter;
|
||||||
int32 FrameSamples;
|
int32 FrameSamples;
|
||||||
|
|
||||||
|
#ifndef MASTER
|
||||||
struct tZonePrint
|
struct tZonePrint
|
||||||
{
|
{
|
||||||
char name[12];
|
char name[12];
|
||||||
@ -870,8 +902,6 @@ tZonePrint ZonePrint[] =
|
|||||||
{ "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) }
|
{ "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) }
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef MASTER
|
|
||||||
|
|
||||||
void
|
void
|
||||||
PrintMemoryUsage(void)
|
PrintMemoryUsage(void)
|
||||||
{
|
{
|
||||||
@ -1160,9 +1190,126 @@ DisplayGameDebugText()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
bool gbRenderRoads = true;
|
||||||
|
bool gbRenderEverythingBarRoads = true;
|
||||||
|
//bool gbRenderFadingInUnderwaterEntities = true;
|
||||||
|
bool gbRenderFadingInEntities = true;
|
||||||
|
bool gbRenderWater = true;
|
||||||
|
bool gbRenderBoats = true;
|
||||||
|
bool gbRenderVehicles = true;
|
||||||
|
bool gbRenderWorld0 = true;
|
||||||
|
bool gbRenderWorld1 = true;
|
||||||
|
bool gbRenderWorld2 = true;
|
||||||
|
|
||||||
|
void
|
||||||
|
MattRenderScene(void)
|
||||||
|
{
|
||||||
|
// this calls CMattRenderer::Render
|
||||||
|
/// CWorld::AdvanceCurrentScanCode();
|
||||||
|
// CMattRenderer::ResetRenderStates
|
||||||
|
/// CRenderer::ClearForFrame(); // before ConstructRenderList
|
||||||
|
// CClock::CalcEnvMapTimeMultiplicator
|
||||||
|
if(gbRenderWater)
|
||||||
|
CRenderer::RenderWater(); // actually CMattRenderer::RenderWater
|
||||||
|
// CClock::ms_EnvMapTimeMultiplicator = 1.0f;
|
||||||
|
// cWorldStream::ClearDynamics
|
||||||
|
/// CRenderer::ConstructRenderList(); // before PreRender
|
||||||
|
if(gbRenderWorld0)
|
||||||
|
CRenderer::RenderWorld(0); // roads
|
||||||
|
// CMattRenderer::ResetRenderStates
|
||||||
|
/// CRenderer::PreRender(); // has to be called before BeginUpdate because of cutscene shadows
|
||||||
|
CCoronas::RenderReflections();
|
||||||
|
if(gbRenderWorld1)
|
||||||
|
CRenderer::RenderWorld(1); // opaque
|
||||||
|
if(gbRenderRoads)
|
||||||
|
CRenderer::RenderRoads();
|
||||||
|
|
||||||
|
CRenderer::RenderPeds();
|
||||||
|
|
||||||
|
if(gbRenderBoats)
|
||||||
|
CRenderer::RenderBoats();
|
||||||
|
//if(gbRenderFadingInUnderwaterEntities)
|
||||||
|
// CRenderer::RenderFadingInUnderwaterEntities();
|
||||||
|
|
||||||
|
if(gbRenderEverythingBarRoads)
|
||||||
|
CRenderer::RenderEverythingBarRoads();
|
||||||
|
// seam fixer
|
||||||
|
// moved this:
|
||||||
|
// CRenderer::RenderFadingInEntities();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RenderScene_new(void)
|
||||||
|
{
|
||||||
|
CClouds::Render();
|
||||||
|
DoRWRenderHorizon();
|
||||||
|
|
||||||
|
MattRenderScene();
|
||||||
|
DefinedState();
|
||||||
|
// CMattRenderer::ResetRenderStates
|
||||||
|
// moved CRenderer::RenderBoats to before transparent water
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
bool FredIsInFirstPersonCam(void) { return false; }
|
||||||
|
void
|
||||||
|
RenderEffects_new(void)
|
||||||
|
{
|
||||||
|
CShadows::RenderStaticShadows();
|
||||||
|
// CRenderer::GenerateEnvironmentMap
|
||||||
|
CShadows::RenderStoredShadows();
|
||||||
|
CSkidmarks::Render();
|
||||||
|
CRubbish::Render();
|
||||||
|
|
||||||
|
// these aren't really effects
|
||||||
|
DefinedState();
|
||||||
|
if(FredIsInFirstPersonCam()){
|
||||||
|
DefinedState();
|
||||||
|
C3dMarkers::Render(); // normally rendered in CSpecialFX::Render()
|
||||||
|
if(gbRenderWorld2)
|
||||||
|
CRenderer::RenderWorld(2); // transparent
|
||||||
|
if(gbRenderVehicles)
|
||||||
|
CRenderer::RenderVehicles();
|
||||||
|
}else{
|
||||||
|
// flipped these two, seems to give the best result
|
||||||
|
if(gbRenderWorld2)
|
||||||
|
CRenderer::RenderWorld(2); // transparent
|
||||||
|
if(gbRenderVehicles)
|
||||||
|
CRenderer::RenderVehicles();
|
||||||
|
}
|
||||||
|
// better render these after transparent world
|
||||||
|
if(gbRenderFadingInEntities)
|
||||||
|
CRenderer::RenderFadingInEntities();
|
||||||
|
|
||||||
|
// actual effects here
|
||||||
|
CGlass::Render();
|
||||||
|
// CMattRenderer::ResetRenderStates
|
||||||
|
DefinedState();
|
||||||
|
CWeather::RenderRainStreaks();
|
||||||
|
// CWeather::AddSnow
|
||||||
|
CWaterCannons::Render();
|
||||||
|
CAntennas::Render();
|
||||||
|
CSpecialFX::Render();
|
||||||
|
CCoronas::Render();
|
||||||
|
CParticle::Render();
|
||||||
|
CPacManPickups::Render();
|
||||||
|
CWeaponEffects::Render();
|
||||||
|
CPointLights::RenderFogEffect();
|
||||||
|
CMovingThings::Render();
|
||||||
|
CRenderer::RenderFirstPersonVehicle();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
RenderScene(void)
|
RenderScene(void)
|
||||||
{
|
{
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(gbNewRenderer){
|
||||||
|
RenderScene_new();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
CClouds::Render();
|
CClouds::Render();
|
||||||
DoRWRenderHorizon();
|
DoRWRenderHorizon();
|
||||||
CRenderer::RenderRoads();
|
CRenderer::RenderRoads();
|
||||||
@ -1195,6 +1342,12 @@ RenderDebugShit(void)
|
|||||||
void
|
void
|
||||||
RenderEffects(void)
|
RenderEffects(void)
|
||||||
{
|
{
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(gbNewRenderer){
|
||||||
|
RenderEffects_new();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
CGlass::Render();
|
CGlass::Render();
|
||||||
CWaterCannons::Render();
|
CWaterCannons::Render();
|
||||||
CSpecialFX::Render();
|
CSpecialFX::Render();
|
||||||
@ -1390,6 +1543,12 @@ Idle(void *arg)
|
|||||||
|
|
||||||
PUSH_MEMID(MEMID_RENDERLIST);
|
PUSH_MEMID(MEMID_RENDERLIST);
|
||||||
tbStartTimer(0, "CnstrRenderList");
|
tbStartTimer(0, "CnstrRenderList");
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
if(gbNewRenderer){
|
||||||
|
CWorld::AdvanceCurrentScanCode(); // don't think this is even necessary
|
||||||
|
CRenderer::ClearForFrame();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
CRenderer::ConstructRenderList();
|
CRenderer::ConstructRenderList();
|
||||||
tbEndTimer("CnstrRenderList");
|
tbEndTimer("CnstrRenderList");
|
||||||
|
|
||||||
@ -1457,7 +1616,7 @@ Idle(void *arg)
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
goto popret;
|
goto popret;
|
||||||
}
|
}
|
||||||
@ -1523,7 +1682,7 @@ FrontendIdle(void)
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||||
if(!RsCameraBeginUpdate(Scene.camera))
|
if(!RsCameraBeginUpdate(Scene.camera))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1780,7 +1939,7 @@ void TheGame(void)
|
|||||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||||
#endif
|
#endif
|
||||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||||
RsCameraBeginUpdate(Scene.camera);
|
RsCameraBeginUpdate(Scene.camera);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,13 @@ void TheModelViewer(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LOAD_INI_SETTINGS
|
#ifdef LOAD_INI_SETTINGS
|
||||||
void LoadINISettings();
|
bool LoadINISettings();
|
||||||
void SaveINISettings();
|
void SaveINISettings();
|
||||||
|
void LoadINIControllerSettings();
|
||||||
|
void SaveINIControllerSettings();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
extern bool gbNewRenderer;
|
||||||
|
bool FredIsInFirstPersonCam(void);
|
||||||
#endif
|
#endif
|
||||||
|
482
src/core/re3.cpp
482
src/core/re3.cpp
@ -1,7 +1,6 @@
|
|||||||
#include <csignal>
|
#include <csignal>
|
||||||
#define WITHWINDOWS
|
#define WITHWINDOWS
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "crossplatform.h"
|
|
||||||
#include "Renderer.h"
|
#include "Renderer.h"
|
||||||
#include "Credits.h"
|
#include "Credits.h"
|
||||||
#include "Camera.h"
|
#include "Camera.h"
|
||||||
@ -31,9 +30,12 @@
|
|||||||
#include "custompipes.h"
|
#include "custompipes.h"
|
||||||
#include "MemoryHeap.h"
|
#include "MemoryHeap.h"
|
||||||
#include "FileMgr.h"
|
#include "FileMgr.h"
|
||||||
|
#include "Camera.h"
|
||||||
|
#include "MBlur.h"
|
||||||
|
#include "ControllerConfig.h"
|
||||||
|
|
||||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
#include "ControllerConfig.h"
|
#include "crossplatform.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
@ -92,16 +94,16 @@ CustomFrontendOptionsPopulate(void)
|
|||||||
if (fd) {
|
if (fd) {
|
||||||
#ifdef GRAPHICS_MENU_OPTIONS
|
#ifdef GRAPHICS_MENU_OPTIONS
|
||||||
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
|
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
|
||||||
FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
|
FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline");
|
||||||
FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
|
FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "Graphics", "NeoRimLight");
|
||||||
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
|
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
|
||||||
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
|
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
|
||||||
#else
|
#else
|
||||||
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
|
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
|
||||||
FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
|
FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "Graphics", "VehiclePipeline");
|
||||||
FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
|
FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "Graphics", "NeoRimLight");
|
||||||
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
|
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
|
||||||
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
|
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
|
||||||
#endif
|
#endif
|
||||||
CFileMgr::CloseFile(fd);
|
CFileMgr::CloseFile(fd);
|
||||||
}
|
}
|
||||||
@ -114,82 +116,303 @@ CustomFrontendOptionsPopulate(void)
|
|||||||
#include "ini_parser.hpp"
|
#include "ini_parser.hpp"
|
||||||
|
|
||||||
linb::ini cfg;
|
linb::ini cfg;
|
||||||
int CheckAndReadIniInt(const char *cat, const char *key, int original)
|
bool ReadIniIfExists(const char *cat, const char *key, uint32 *out)
|
||||||
{
|
{
|
||||||
std::string strval = cfg.get(cat, key, "");
|
std::string strval = cfg.get(cat, key, "\xBA");
|
||||||
const char *value = strval.c_str();
|
const char *value = strval.c_str();
|
||||||
if (value && value[0] != '\0')
|
char *endPtr;
|
||||||
return atoi(value);
|
if (value && value[0] != '\xBA') {
|
||||||
|
*out = strtoul(value, &endPtr, 0);
|
||||||
return original;
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
float CheckAndReadIniFloat(const char *cat, const char *key, float original)
|
bool ReadIniIfExists(const char *cat, const char *key, bool *out)
|
||||||
{
|
{
|
||||||
std::string strval = cfg.get(cat, key, "");
|
std::string strval = cfg.get(cat, key, "\xBA");
|
||||||
const char *value = strval.c_str();
|
const char *value = strval.c_str();
|
||||||
if (value && value[0] != '\0')
|
char *endPtr;
|
||||||
return atof(value);
|
if (value && value[0] != '\xBA') {
|
||||||
|
*out = strtoul(value, &endPtr, 0);
|
||||||
return original;
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckAndSaveIniInt(const char *cat, const char *key, int val, bool &changed)
|
bool ReadIniIfExists(const char *cat, const char *key, int32 *out)
|
||||||
|
{
|
||||||
|
std::string strval = cfg.get(cat, key, "\xBA");
|
||||||
|
const char *value = strval.c_str();
|
||||||
|
char *endPtr;
|
||||||
|
if (value && value[0] != '\xBA') {
|
||||||
|
*out = strtol(value, &endPtr, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ReadIniIfExists(const char *cat, const char *key, int8 *out)
|
||||||
|
{
|
||||||
|
std::string strval = cfg.get(cat, key, "\xBA");
|
||||||
|
const char *value = strval.c_str();
|
||||||
|
char *endPtr;
|
||||||
|
if (value && value[0] != '\xBA') {
|
||||||
|
*out = strtol(value, &endPtr, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ReadIniIfExists(const char *cat, const char *key, float *out)
|
||||||
|
{
|
||||||
|
std::string strval = cfg.get(cat, key, "\xBA");
|
||||||
|
const char *value = strval.c_str();
|
||||||
|
if (value && value[0] != '\xBA') {
|
||||||
|
*out = atof(value);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ReadIniIfExists(const char *cat, const char *key, char *out, int size)
|
||||||
|
{
|
||||||
|
std::string strval = cfg.get(cat, key, "\xBA");
|
||||||
|
const char *value = strval.c_str();
|
||||||
|
if (value && value[0] != '\xBA') {
|
||||||
|
strncpy(out, value, size);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void StoreIni(const char *cat, const char *key, uint32 val)
|
||||||
{
|
{
|
||||||
char temp[10];
|
char temp[10];
|
||||||
if (atoi(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
|
sprintf(temp, "%u", val);
|
||||||
changed = true;
|
cfg.set(cat, key, temp);
|
||||||
sprintf(temp, "%u", val);
|
|
||||||
cfg.set(cat, key, temp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CheckAndSaveIniFloat(const char *cat, const char *key, float val, bool &changed)
|
void StoreIni(const char *cat, const char *key, uint8 val)
|
||||||
{
|
{
|
||||||
char temp[10];
|
char temp[10];
|
||||||
if (atof(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
|
sprintf(temp, "%u", (uint32)val);
|
||||||
changed = true;
|
cfg.set(cat, key, temp);
|
||||||
sprintf(temp, "%f", val);
|
|
||||||
cfg.set(cat, key, temp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadINISettings()
|
void StoreIni(const char *cat, const char *key, int32 val)
|
||||||
{
|
{
|
||||||
cfg.load_file("re3.ini");
|
char temp[10];
|
||||||
|
sprintf(temp, "%d", val);
|
||||||
|
cfg.set(cat, key, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StoreIni(const char *cat, const char *key, int8 val)
|
||||||
|
{
|
||||||
|
char temp[10];
|
||||||
|
sprintf(temp, "%d", (int32)val);
|
||||||
|
cfg.set(cat, key, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StoreIni(const char *cat, const char *key, float val)
|
||||||
|
{
|
||||||
|
char temp[10];
|
||||||
|
sprintf(temp, "%f", val);
|
||||||
|
cfg.set(cat, key, temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void StoreIni(const char *cat, const char *key, char *val, int size)
|
||||||
|
{
|
||||||
|
cfg.set(cat, key, val);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *iniControllerActions[] = { "PED_FIREWEAPON", "PED_CYCLE_WEAPON_RIGHT", "PED_CYCLE_WEAPON_LEFT", "GO_FORWARD", "GO_BACK", "GO_LEFT", "GO_RIGHT", "PED_SNIPER_ZOOM_IN",
|
||||||
|
"PED_SNIPER_ZOOM_OUT", "VEHICLE_ENTER_EXIT", "CAMERA_CHANGE_VIEW_ALL_SITUATIONS", "PED_JUMPING", "PED_SPRINT", "PED_LOOKBEHIND",
|
||||||
|
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||||
|
"VEHICLE_FIREWEAPON",
|
||||||
|
#endif
|
||||||
|
"VEHICLE_ACCELERATE", "VEHICLE_BRAKE", "VEHICLE_CHANGE_RADIO_STATION", "VEHICLE_HORN", "TOGGLE_SUBMISSIONS", "VEHICLE_HANDBRAKE", "PED_1RST_PERSON_LOOK_LEFT",
|
||||||
|
"PED_1RST_PERSON_LOOK_RIGHT", "VEHICLE_LOOKLEFT", "VEHICLE_LOOKRIGHT", "VEHICLE_LOOKBEHIND", "VEHICLE_TURRETLEFT", "VEHICLE_TURRETRIGHT", "VEHICLE_TURRETUP", "VEHICLE_TURRETDOWN",
|
||||||
|
"PED_CYCLE_TARGET_LEFT", "PED_CYCLE_TARGET_RIGHT", "PED_CENTER_CAMERA_BEHIND_PLAYER", "PED_LOCK_TARGET", "NETWORK_TALK", "PED_1RST_PERSON_LOOK_UP", "PED_1RST_PERSON_LOOK_DOWN",
|
||||||
|
"_CONTROLLERACTION_36", "TOGGLE_DPAD", "SWITCH_DEBUG_CAM_ON", "TAKE_SCREEN_SHOT", "SHOW_MOUSE_POINTER_TOGGLE" };
|
||||||
|
|
||||||
|
const char *iniControllerTypes[] = { "kbd:", "2ndKbd:", "mouse:", "joy:" };
|
||||||
|
|
||||||
|
const char *iniMouseButtons[] = {"LEFT","MIDDLE","RIGHT","WHLUP","WHLDOWN","X1","X2"};
|
||||||
|
|
||||||
|
const char *iniKeyboardButtons[] = {"ESC","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12",
|
||||||
|
"INS","DEL","HOME","END","PGUP","PGDN","UP","DOWN","LEFT","RIGHT","DIVIDE","TIMES","PLUS","MINUS","PADDEL",
|
||||||
|
"PADEND","PADDOWN","PADPGDN","PADLEFT","PAD5","NUMLOCK","PADRIGHT","PADHOME","PADUP","PADPGUP","PADINS",
|
||||||
|
"PADENTER", "SCROLL","PAUSE","BACKSP","TAB","CAPSLK","ENTER","LSHIFT","RSHIFT","SHIFT","LCTRL","RCTRL","LALT",
|
||||||
|
"RALT", "LWIN", "RWIN", "APPS", "NULL"};
|
||||||
|
|
||||||
|
void LoadINIControllerSettings()
|
||||||
|
{
|
||||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
// Written by assuming the codes below will run after _InputInitialiseJoys().
|
ReadIniIfExists("Controller", "JoystickName", gSelectedJoystickName, 128);
|
||||||
strcpy(gSelectedJoystickName, cfg.get("DetectJoystick", "JoystickName", "").c_str());
|
#endif
|
||||||
|
// force to default GTA behaviour (never overwrite bindings on joy change/initialization) if user init'ed/set bindings before we introduced that
|
||||||
if(gSelectedJoystickName[0] != '\0') {
|
if (!ReadIniIfExists("Controller", "PadButtonsInited", &ControlsManager.ms_padButtonsInited)) {
|
||||||
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
|
ControlsManager.ms_padButtonsInited = cfg.category_size("Bindings") != 0 ? 16 : 0;
|
||||||
if (glfwJoystickPresent(i) && strncmp(gSelectedJoystickName, glfwGetJoystickName(i), strlen(gSelectedJoystickName)) == 0) {
|
}
|
||||||
if (PSGLOBAL(joy1id) != -1) {
|
|
||||||
PSGLOBAL(joy2id) = PSGLOBAL(joy1id);
|
for (int32 i = 0; i < MAX_CONTROLLERACTIONS; i++) {
|
||||||
|
char value[128];
|
||||||
|
if (ReadIniIfExists("Bindings", iniControllerActions[i], value, 128)) {
|
||||||
|
for (int32 j = 0; j < MAX_CONTROLLERTYPES; j++){
|
||||||
|
ControlsManager.ClearSettingsAssociatedWithAction((e_ControllerAction)i, (eControllerType)j);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (char *binding = strtok(value,", "); binding != nil; binding = strtok(nil, ", ")) {
|
||||||
|
int contType = -1;
|
||||||
|
for (int32 k = 0; k < ARRAY_SIZE(iniControllerTypes); k++) {
|
||||||
|
int len = strlen(iniControllerTypes[k]);
|
||||||
|
if (strncmp(binding, iniControllerTypes[k], len) == 0) {
|
||||||
|
contType = k;
|
||||||
|
binding += len;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (contType == -1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
int contKey;
|
||||||
|
if (contType == JOYSTICK) {
|
||||||
|
char *temp;
|
||||||
|
contKey = strtol(binding, &temp, 0);
|
||||||
|
|
||||||
|
} else if (contType == KEYBOARD || contType == OPTIONAL_EXTRA) {
|
||||||
|
if (strlen(binding) == 1) {
|
||||||
|
contKey = binding[0];
|
||||||
|
} else if(strcmp(binding, "SPC") == 0) {
|
||||||
|
contKey = ' ';
|
||||||
|
} else {
|
||||||
|
for (int32 k = 0; k < ARRAY_SIZE(iniKeyboardButtons); k++) {
|
||||||
|
if(strcmp(binding, iniKeyboardButtons[k]) == 0) {
|
||||||
|
contKey = 1000 + k;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (contType == MOUSE) {
|
||||||
|
for (int32 k = 0; k < ARRAY_SIZE(iniMouseButtons); k++) {
|
||||||
|
if(strcmp(binding, iniMouseButtons[k]) == 0) {
|
||||||
|
contKey = 1 + k;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
PSGLOBAL(joy1id) = i;
|
|
||||||
int count;
|
|
||||||
glfwGetJoystickButtons(PSGLOBAL(joy1id), &count);
|
|
||||||
|
|
||||||
// We need to init and reload bindings, because;
|
ControlsManager.SetControllerKeyAssociatedWithAction((e_ControllerAction)i, contKey, (eControllerType)contType);
|
||||||
// 1-joypad button number may differ with saved/prvly connected one
|
|
||||||
// 2-bindings are not init'ed if there is no joypad at the start
|
|
||||||
ControlsManager.InitDefaultControlConfigJoyPad(count);
|
|
||||||
CFileMgr::SetDirMyDocuments();
|
|
||||||
int32 gta3set = CFileMgr::OpenFile("gta3.set", "r");
|
|
||||||
if (gta3set) {
|
|
||||||
ControlsManager.LoadSettings(gta3set);
|
|
||||||
CFileMgr::CloseFile(gta3set);
|
|
||||||
}
|
|
||||||
CFileMgr::SetDir("");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SaveINIControllerSettings()
|
||||||
|
{
|
||||||
|
for (int32 i = 0; i < MAX_CONTROLLERACTIONS; i++) {
|
||||||
|
char value[128] = { '\0' };
|
||||||
|
|
||||||
|
// upper limit should've been GetNumOfSettingsForAction(i), but sadly even R* doesn't use it's own system correctly, and there are gaps between orders.
|
||||||
|
for (int32 j = SETORDER_1; j < MAX_SETORDERS; j++){
|
||||||
|
|
||||||
|
// We respect the m_ContSetOrder, and join/implode/order the bindings according to that; using comma as seperator.
|
||||||
|
for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++){
|
||||||
|
if (ControlsManager.m_aSettings[i][k].m_ContSetOrder == j) {
|
||||||
|
char next[32];
|
||||||
|
if (k == JOYSTICK) {
|
||||||
|
snprintf(next, 32, "%s%d,", iniControllerTypes[k], ControlsManager.m_aSettings[i][k].m_Key);
|
||||||
|
|
||||||
|
} else if (k == KEYBOARD || k == OPTIONAL_EXTRA) {
|
||||||
|
if (ControlsManager.m_aSettings[i][k].m_Key == ' ')
|
||||||
|
snprintf(next, 32, "%sSPC,", iniControllerTypes[k]);
|
||||||
|
else if (ControlsManager.m_aSettings[i][k].m_Key < 256)
|
||||||
|
snprintf(next, 32, "%s%c,", iniControllerTypes[k], ControlsManager.m_aSettings[i][k].m_Key);
|
||||||
|
else
|
||||||
|
snprintf(next, 32, "%s%s,", iniControllerTypes[k], iniKeyboardButtons[ControlsManager.m_aSettings[i][k].m_Key - 1000]);
|
||||||
|
|
||||||
|
} else if (k == MOUSE) {
|
||||||
|
snprintf(next, 32, "%s%s,", iniControllerTypes[k], iniMouseButtons[ControlsManager.m_aSettings[i][k].m_Key - 1]);
|
||||||
|
}
|
||||||
|
strcat(value, next);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int len = strlen(value);
|
||||||
|
if (len > 0)
|
||||||
|
value[len - 1] = '\0'; // to remove comma
|
||||||
|
|
||||||
|
StoreIni("Bindings", iniControllerActions[i], value, 128);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||||
|
StoreIni("Controller", "JoystickName", gSelectedJoystickName, 128);
|
||||||
|
#endif
|
||||||
|
StoreIni("Controller", "PadButtonsInited", ControlsManager.ms_padButtonsInited);
|
||||||
|
cfg.write_file("re3.ini");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LoadINISettings()
|
||||||
|
{
|
||||||
|
if (!cfg.load_file("re3.ini"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#ifdef IMPROVED_VIDEOMODE
|
||||||
|
ReadIniIfExists("VideoMode", "Width", &FrontEndMenuManager.m_nPrefsWidth);
|
||||||
|
ReadIniIfExists("VideoMode", "Height", &FrontEndMenuManager.m_nPrefsHeight);
|
||||||
|
ReadIniIfExists("VideoMode", "Depth", &FrontEndMenuManager.m_nPrefsDepth);
|
||||||
|
ReadIniIfExists("VideoMode", "Subsystem", &FrontEndMenuManager.m_nPrefsSubsystem);
|
||||||
|
// Windowed mode is loaded below in CUSTOM_FRONTEND_OPTIONS section
|
||||||
|
#else
|
||||||
|
ReadIniIfExists("Graphics", "VideoMode", &FrontEndMenuManager.m_nDisplayVideoMode);
|
||||||
|
#endif
|
||||||
|
ReadIniIfExists("Controller", "HeadBob1stPerson", &TheCamera.m_bHeadBob);
|
||||||
|
ReadIniIfExists("Controller", "VerticalMouseSens", &TheCamera.m_fMouseAccelVertical);
|
||||||
|
ReadIniIfExists("Controller", "HorizantalMouseSens", &TheCamera.m_fMouseAccelHorzntl);
|
||||||
|
ReadIniIfExists("Controller", "InvertMouseVertically", &MousePointerStateHelper.bInvertVertically);
|
||||||
|
ReadIniIfExists("Controller", "DisableMouseSteering", &CVehicle::m_bDisableMouseSteering);
|
||||||
|
ReadIniIfExists("Audio", "SfxVolume", &FrontEndMenuManager.m_PrefsSfxVolume);
|
||||||
|
ReadIniIfExists("Audio", "MusicVolume", &FrontEndMenuManager.m_PrefsMusicVolume);
|
||||||
|
ReadIniIfExists("Audio", "Radio", &FrontEndMenuManager.m_PrefsRadioStation);
|
||||||
|
ReadIniIfExists("Audio", "SpeakerType", &FrontEndMenuManager.m_PrefsSpeakers);
|
||||||
|
ReadIniIfExists("Audio", "Provider", &FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
|
||||||
|
ReadIniIfExists("Audio", "DynamicAcoustics", &FrontEndMenuManager.m_PrefsDMA);
|
||||||
|
ReadIniIfExists("Display", "Brightness", &FrontEndMenuManager.m_PrefsBrightness);
|
||||||
|
ReadIniIfExists("Display", "DrawDistance", &FrontEndMenuManager.m_PrefsLOD);
|
||||||
|
ReadIniIfExists("Display", "Subtitles", &FrontEndMenuManager.m_PrefsShowSubtitles);
|
||||||
|
ReadIniIfExists("Graphics", "AspectRatio", &FrontEndMenuManager.m_PrefsUseWideScreen);
|
||||||
|
ReadIniIfExists("Graphics", "VSync", &FrontEndMenuManager.m_PrefsVsyncDisp);
|
||||||
|
ReadIniIfExists("Graphics", "FrameLimiter", &FrontEndMenuManager.m_PrefsFrameLimiter);
|
||||||
|
ReadIniIfExists("Graphics", "Trails", &CMBlur::BlurOn);
|
||||||
|
ReadIniIfExists("General", "SkinFile", FrontEndMenuManager.m_PrefsSkinFile, 256);
|
||||||
|
ReadIniIfExists("Controller", "Method", &FrontEndMenuManager.m_ControlMethod);
|
||||||
|
ReadIniIfExists("General", "Language", &FrontEndMenuManager.m_PrefsLanguage);
|
||||||
|
|
||||||
|
#ifdef EXTENDED_COLOURFILTER
|
||||||
|
ReadIniIfExists("CustomPipesValues", "PostFXIntensity", &CPostFX::Intensity);
|
||||||
|
#endif
|
||||||
|
#ifdef EXTENDED_PIPELINES
|
||||||
|
ReadIniIfExists("CustomPipesValues", "NeoVehicleShininess", &CustomPipes::VehicleShininess);
|
||||||
|
ReadIniIfExists("CustomPipesValues", "NeoVehicleSpecularity", &CustomPipes::VehicleSpecularity);
|
||||||
|
ReadIniIfExists("CustomPipesValues", "RimlightMult", &CustomPipes::RimlightMult);
|
||||||
|
ReadIniIfExists("CustomPipesValues", "LightmapMult", &CustomPipes::LightmapMult);
|
||||||
|
ReadIniIfExists("CustomPipesValues", "GlossMult", &CustomPipes::GlossMult);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PROPER_SCALING
|
||||||
|
ReadIniIfExists("Draw", "ProperScaling", &CDraw::ms_bProperScaling);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_RADAR
|
||||||
|
ReadIniIfExists("Draw", "FixRadar", &CDraw::ms_bFixRadar);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_SPRITES
|
||||||
|
ReadIniIfExists("Draw", "FixSprites", &CDraw::ms_bFixSprites);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||||
|
bool migrate = cfg.category_size("FrontendOptions") != 0;
|
||||||
for (int i = 0; i < MENUPAGES; i++) {
|
for (int i = 0; i < MENUPAGES; i++) {
|
||||||
for (int j = 0; j < NUM_MENUROWS; j++) {
|
for (int j = 0; j < NUM_MENUROWS; j++) {
|
||||||
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
|
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
|
||||||
@ -199,7 +422,13 @@ void LoadINISettings()
|
|||||||
// CFO check
|
// CFO check
|
||||||
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
|
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
|
||||||
// CFO only supports saving uint8 right now
|
// CFO only supports saving uint8 right now
|
||||||
*option.m_CFO->value = CheckAndReadIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value);
|
|
||||||
|
// Migrate from old .ini to new .ini
|
||||||
|
if (migrate && ReadIniIfExists("FrontendOptions", option.m_CFO->save, option.m_CFO->value))
|
||||||
|
cfg.remove("FrontendOptions", option.m_CFO->save);
|
||||||
|
else
|
||||||
|
ReadIniIfExists(option.m_CFO->saveCat, option.m_CFO->save, option.m_CFO->value);
|
||||||
|
|
||||||
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
||||||
option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
|
option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
|
||||||
}
|
}
|
||||||
@ -208,28 +437,61 @@ void LoadINISettings()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTENDED_COLOURFILTER
|
return true;
|
||||||
CPostFX::Intensity = CheckAndReadIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity);
|
|
||||||
#endif
|
|
||||||
#ifdef EXTENDED_PIPELINES
|
|
||||||
CustomPipes::VehicleShininess = CheckAndReadIniFloat("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess);
|
|
||||||
CustomPipes::VehicleSpecularity = CheckAndReadIniFloat("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity);
|
|
||||||
CustomPipes::RimlightMult = CheckAndReadIniFloat("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult);
|
|
||||||
CustomPipes::LightmapMult = CheckAndReadIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult);
|
|
||||||
CustomPipes::GlossMult = CheckAndReadIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveINISettings()
|
void SaveINISettings()
|
||||||
{
|
{
|
||||||
bool changed = false;
|
#ifdef IMPROVED_VIDEOMODE
|
||||||
char temp[4];
|
StoreIni("VideoMode", "Width", FrontEndMenuManager.m_nPrefsWidth);
|
||||||
|
StoreIni("VideoMode", "Height", FrontEndMenuManager.m_nPrefsHeight);
|
||||||
|
StoreIni("VideoMode", "Depth", FrontEndMenuManager.m_nPrefsDepth);
|
||||||
|
StoreIni("VideoMode", "Subsystem", FrontEndMenuManager.m_nPrefsSubsystem);
|
||||||
|
// Windowed mode is loaded below in CUSTOM_FRONTEND_OPTIONS section
|
||||||
|
#else
|
||||||
|
StoreIni("Graphics", "VideoMode", FrontEndMenuManager.m_nDisplayVideoMode);
|
||||||
|
#endif
|
||||||
|
StoreIni("Controller", "HeadBob1stPerson", TheCamera.m_bHeadBob);
|
||||||
|
StoreIni("Controller", "VerticalMouseSens", TheCamera.m_fMouseAccelVertical);
|
||||||
|
StoreIni("Controller", "HorizantalMouseSens", TheCamera.m_fMouseAccelHorzntl);
|
||||||
|
StoreIni("Controller", "InvertMouseVertically", MousePointerStateHelper.bInvertVertically);
|
||||||
|
StoreIni("Controller", "DisableMouseSteering", CVehicle::m_bDisableMouseSteering);
|
||||||
|
StoreIni("Audio", "SfxVolume", FrontEndMenuManager.m_PrefsSfxVolume);
|
||||||
|
StoreIni("Audio", "MusicVolume", FrontEndMenuManager.m_PrefsMusicVolume);
|
||||||
|
StoreIni("Audio", "Radio", FrontEndMenuManager.m_PrefsRadioStation);
|
||||||
|
StoreIni("Audio", "SpeakerType", FrontEndMenuManager.m_PrefsSpeakers);
|
||||||
|
StoreIni("Audio", "Provider", FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
|
||||||
|
StoreIni("Audio", "DynamicAcoustics", FrontEndMenuManager.m_PrefsDMA);
|
||||||
|
StoreIni("Display", "Brightness", FrontEndMenuManager.m_PrefsBrightness);
|
||||||
|
StoreIni("Display", "DrawDistance", FrontEndMenuManager.m_PrefsLOD);
|
||||||
|
StoreIni("Display", "Subtitles", FrontEndMenuManager.m_PrefsShowSubtitles);
|
||||||
|
StoreIni("Graphics", "AspectRatio", FrontEndMenuManager.m_PrefsUseWideScreen);
|
||||||
|
StoreIni("Graphics", "VSync", FrontEndMenuManager.m_PrefsVsyncDisp);
|
||||||
|
StoreIni("Graphics", "FrameLimiter", FrontEndMenuManager.m_PrefsFrameLimiter);
|
||||||
|
StoreIni("Graphics", "Trails", CMBlur::BlurOn);
|
||||||
|
StoreIni("General", "SkinFile", FrontEndMenuManager.m_PrefsSkinFile, 256);
|
||||||
|
StoreIni("Controller", "Method", FrontEndMenuManager.m_ControlMethod);
|
||||||
|
StoreIni("General", "Language", FrontEndMenuManager.m_PrefsLanguage);
|
||||||
|
|
||||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
#ifdef EXTENDED_COLOURFILTER
|
||||||
if (strncmp(cfg.get("DetectJoystick", "JoystickName", "").c_str(), gSelectedJoystickName, strlen(gSelectedJoystickName)) != 0) {
|
StoreIni("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity);
|
||||||
changed = true;
|
#endif
|
||||||
cfg.set("DetectJoystick", "JoystickName", gSelectedJoystickName);
|
#ifdef EXTENDED_PIPELINES
|
||||||
}
|
StoreIni("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess);
|
||||||
|
StoreIni("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity);
|
||||||
|
StoreIni("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult);
|
||||||
|
StoreIni("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult);
|
||||||
|
StoreIni("CustomPipesValues", "GlossMult", CustomPipes::GlossMult);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PROPER_SCALING
|
||||||
|
StoreIni("Draw", "ProperScaling", CDraw::ms_bProperScaling);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_RADAR
|
||||||
|
StoreIni("Draw", "FixRadar", CDraw::ms_bFixRadar);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_SPRITES
|
||||||
|
StoreIni("Draw", "FixSprites", CDraw::ms_bFixSprites);
|
||||||
#endif
|
#endif
|
||||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||||
for (int i = 0; i < MENUPAGES; i++) {
|
for (int i = 0; i < MENUPAGES; i++) {
|
||||||
@ -240,25 +502,13 @@ void SaveINISettings()
|
|||||||
|
|
||||||
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
|
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
|
||||||
// Beware: CFO only supports saving uint8 right now
|
// Beware: CFO only supports saving uint8 right now
|
||||||
CheckAndSaveIniInt("FrontendOptions", option.m_CFO->save, *option.m_CFO->value, changed);
|
StoreIni(option.m_CFO->saveCat, option.m_CFO->save, *option.m_CFO->value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTENDED_COLOURFILTER
|
cfg.write_file("re3.ini");
|
||||||
CheckAndSaveIniFloat("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity, changed);
|
|
||||||
#endif
|
|
||||||
#ifdef EXTENDED_PIPELINES
|
|
||||||
CheckAndSaveIniFloat("CustomPipesValues", "NeoVehicleShininess", CustomPipes::VehicleShininess, changed);
|
|
||||||
CheckAndSaveIniFloat("CustomPipesValues", "NeoVehicleSpecularity", CustomPipes::VehicleSpecularity, changed);
|
|
||||||
CheckAndSaveIniFloat("CustomPipesValues", "RimlightMult", CustomPipes::RimlightMult, changed);
|
|
||||||
CheckAndSaveIniFloat("CustomPipesValues", "LightmapMult", CustomPipes::LightmapMult, changed);
|
|
||||||
CheckAndSaveIniFloat("CustomPipesValues", "GlossMult", CustomPipes::GlossMult, changed);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (changed)
|
|
||||||
cfg.write_file("re3.ini");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -563,6 +813,30 @@ DebugMenuPopulate(void)
|
|||||||
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
||||||
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
|
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
|
||||||
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
|
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
DebugMenuAddVarBool8("Render", "new renderer", &gbNewRenderer, nil);
|
||||||
|
extern bool gbRenderRoads;
|
||||||
|
extern bool gbRenderEverythingBarRoads;
|
||||||
|
//extern bool gbRenderFadingInUnderwaterEntities;
|
||||||
|
extern bool gbRenderFadingInEntities;
|
||||||
|
extern bool gbRenderWater;
|
||||||
|
extern bool gbRenderBoats;
|
||||||
|
extern bool gbRenderVehicles;
|
||||||
|
extern bool gbRenderWorld0;
|
||||||
|
extern bool gbRenderWorld1;
|
||||||
|
extern bool gbRenderWorld2;
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderRoads", &gbRenderRoads, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderEverythingBarRoads", &gbRenderEverythingBarRoads, nil);
|
||||||
|
// DebugMenuAddVarBool8("Render", "gbRenderFadingInUnderwaterEntities", &gbRenderFadingInUnderwaterEntities, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderFadingInEntities", &gbRenderFadingInEntities, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderWater", &gbRenderWater, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderBoats", &gbRenderBoats, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderVehicles", &gbRenderVehicles, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderWorld0", &gbRenderWorld0, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderWorld1", &gbRenderWorld1, nil);
|
||||||
|
DebugMenuAddVarBool8("Render", "gbRenderWorld2", &gbRenderWorld2, nil);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef EXTENDED_COLOURFILTER
|
#ifdef EXTENDED_COLOURFILTER
|
||||||
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
|
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
|
||||||
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);
|
e = DebugMenuAddVar("Render", "Colourfilter", &CPostFX::EffectSwitch, nil, 1, CPostFX::POSTFX_OFF, CPostFX::POSTFX_MOBILE, filternames);
|
||||||
@ -597,6 +871,18 @@ DebugMenuPopulate(void)
|
|||||||
DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil);
|
DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil);
|
||||||
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
|
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
|
||||||
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
|
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
|
||||||
|
|
||||||
|
#ifdef PROPER_SCALING
|
||||||
|
DebugMenuAddVarBool8("Draw", "Proper Scaling", &CDraw::ms_bProperScaling, nil);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_RADAR
|
||||||
|
DebugMenuAddVarBool8("Draw", "Fix Radar", &CDraw::ms_bFixRadar, nil);
|
||||||
|
#endif
|
||||||
|
#ifdef FIX_SPRITES
|
||||||
|
DebugMenuAddVarBool8("Draw", "Fix Sprites", &CDraw::ms_bFixSprites, nil);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef FINAL
|
#ifndef FINAL
|
||||||
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
|
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
|
||||||
@ -654,7 +940,7 @@ DebugMenuPopulate(void)
|
|||||||
"Uzi Money", "Toyminator", "Rigged To Blow", "Bullion Run", "Rumble", "The Exchange"
|
"Uzi Money", "Toyminator", "Rigged To Blow", "Bullion Run", "Rumble", "The Exchange"
|
||||||
};
|
};
|
||||||
|
|
||||||
missionEntry = DebugMenuAddVar("Debug", "Select mission", &nextMissionToSwitch, nil, 1, 0, 79, missions);
|
missionEntry = DebugMenuAddVar("Debug", "Select mission", &nextMissionToSwitch, nil, 1, 0, ARRAY_SIZE(missions) - 1, missions);
|
||||||
DebugMenuEntrySetWrap(missionEntry, true);
|
DebugMenuEntrySetWrap(missionEntry, true);
|
||||||
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
|
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
|
||||||
#endif
|
#endif
|
||||||
@ -678,9 +964,13 @@ DebugMenuPopulate(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __MWERKS__
|
||||||
|
#ifndef MASTER
|
||||||
const int re3_buffsize = 1024;
|
const int re3_buffsize = 1024;
|
||||||
static char re3_buff[re3_buffsize];
|
static char re3_buff[re3_buffsize];
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MASTER
|
||||||
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
|
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
|
||||||
{
|
{
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -737,9 +1027,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
|||||||
assert(false);
|
assert(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void re3_debug(const char *format, ...)
|
void re3_debug(const char *format, ...)
|
||||||
{
|
{
|
||||||
|
#ifndef MASTER
|
||||||
va_list va;
|
va_list va;
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
@ -755,8 +1047,10 @@ void re3_debug(const char *format, ...)
|
|||||||
printf("%s", re3_buff);
|
printf("%s", re3_buff);
|
||||||
#endif
|
#endif
|
||||||
CDebug::DebugAddText(re3_buff);
|
CDebug::DebugAddText(re3_buff);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef MASTER
|
||||||
void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)
|
void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)
|
||||||
{
|
{
|
||||||
char buff[re3_buffsize *2];
|
char buff[re3_buffsize *2];
|
||||||
@ -776,7 +1070,9 @@ void re3_trace(const char *filename, unsigned int lineno, const char *func, cons
|
|||||||
|
|
||||||
OutputDebugString(buff);
|
OutputDebugString(buff);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef MASTER
|
||||||
void re3_usererror(const char *format, ...)
|
void re3_usererror(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
@ -800,6 +1096,8 @@ void re3_usererror(const char *format, ...)
|
|||||||
assert(false);
|
assert(false);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef VALIDATE_SAVE_SIZE
|
#ifdef VALIDATE_SAVE_SIZE
|
||||||
int32 _saveBufCount;
|
int32 _saveBufCount;
|
||||||
|
@ -29,45 +29,59 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define POOLFLAG_ID 0x7f
|
||||||
|
#define POOLFLAG_ISFREE 0x80
|
||||||
|
|
||||||
template<typename T, typename U = T>
|
template<typename T, typename U = T>
|
||||||
class CPool
|
class CPool
|
||||||
{
|
{
|
||||||
U *m_entries;
|
U *m_entries;
|
||||||
union Flags {
|
uint8 *m_flags;
|
||||||
struct {
|
|
||||||
// bitfields are compiler and endian specific
|
|
||||||
#ifdef BIGENDIAN
|
|
||||||
uint8 free : 1;
|
|
||||||
uint8 id : 7;
|
|
||||||
#else
|
|
||||||
uint8 id : 7;
|
|
||||||
uint8 free : 1;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
uint8 u;
|
|
||||||
} *m_flags;
|
|
||||||
int32 m_size;
|
int32 m_size;
|
||||||
int32 m_allocPtr;
|
int32 m_allocPtr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CPool(int32 size){
|
CPool(int32 size){
|
||||||
m_entries = (U*)new uint8[sizeof(U)*size];
|
m_entries = (U*)new uint8[sizeof(U)*size];
|
||||||
m_flags = (Flags*)new uint8[sizeof(Flags)*size];
|
m_flags = new uint8[size];
|
||||||
m_size = size;
|
m_size = size;
|
||||||
m_allocPtr = 0;
|
m_allocPtr = 0;
|
||||||
for(int i = 0; i < size; i++){
|
for(int i = 0; i < size; i++){
|
||||||
m_flags[i].id = 0;
|
SetId(i, 0);
|
||||||
m_flags[i].free = 1;
|
SetIsFree(i, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetId(int i) const
|
||||||
|
{
|
||||||
|
return m_flags[i] & POOLFLAG_ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetIsFree(int i) const
|
||||||
|
{
|
||||||
|
return !!(m_flags[i] & POOLFLAG_ISFREE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetId(int i, int id)
|
||||||
|
{
|
||||||
|
m_flags[i] = (m_flags[i] & POOLFLAG_ISFREE) | (id & POOLFLAG_ID);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetIsFree(int i, bool isFree)
|
||||||
|
{
|
||||||
|
if (isFree)
|
||||||
|
m_flags[i] |= POOLFLAG_ISFREE;
|
||||||
|
else
|
||||||
|
m_flags[i] &= ~POOLFLAG_ISFREE;
|
||||||
|
}
|
||||||
|
|
||||||
~CPool() {
|
~CPool() {
|
||||||
Flush();
|
Flush();
|
||||||
}
|
}
|
||||||
void Flush() {
|
void Flush() {
|
||||||
if (m_size > 0) {
|
if (m_size > 0) {
|
||||||
delete[] (uint8*)m_entries;
|
delete[] (uint8*)m_entries;
|
||||||
delete[] (uint8*)m_flags;
|
delete[] m_flags;
|
||||||
m_entries = nil;
|
m_entries = nil;
|
||||||
m_flags = nil;
|
m_flags = nil;
|
||||||
m_size = 0;
|
m_size = 0;
|
||||||
@ -93,9 +107,9 @@ public:
|
|||||||
m_allocPtr = 0;
|
m_allocPtr = 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
while(!m_flags[m_allocPtr].free);
|
while(!GetIsFree(m_allocPtr));
|
||||||
m_flags[m_allocPtr].free = 0;
|
SetIsFree(m_allocPtr, false);
|
||||||
m_flags[m_allocPtr].id++;
|
SetId(m_allocPtr, GetId(m_allocPtr)+1);
|
||||||
return (T*)&m_entries[m_allocPtr];
|
return (T*)&m_entries[m_allocPtr];
|
||||||
}
|
}
|
||||||
T *New(int32 handle){
|
T *New(int32 handle){
|
||||||
@ -105,36 +119,36 @@ public:
|
|||||||
}
|
}
|
||||||
void SetNotFreeAt(int32 handle){
|
void SetNotFreeAt(int32 handle){
|
||||||
int idx = handle>>8;
|
int idx = handle>>8;
|
||||||
m_flags[idx].free = 0;
|
SetIsFree(idx, false);
|
||||||
m_flags[idx].id = handle & 0x7F;
|
SetId(idx, handle & POOLFLAG_ID);
|
||||||
for(m_allocPtr = 0; m_allocPtr < m_size; m_allocPtr++)
|
for(m_allocPtr = 0; m_allocPtr < m_size; m_allocPtr++)
|
||||||
if(m_flags[m_allocPtr].free)
|
if(GetIsFree(m_allocPtr))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
void Delete(T *entry){
|
void Delete(T *entry){
|
||||||
int i = GetJustIndex(entry);
|
int i = GetJustIndex(entry);
|
||||||
m_flags[i].free = 1;
|
SetIsFree(i, true);
|
||||||
if(i < m_allocPtr)
|
if(i < m_allocPtr)
|
||||||
m_allocPtr = i;
|
m_allocPtr = i;
|
||||||
}
|
}
|
||||||
T *GetSlot(int i){
|
T *GetSlot(int i){
|
||||||
return m_flags[i].free ? nil : (T*)&m_entries[i];
|
return GetIsFree(i) ? nil : (T*)&m_entries[i];
|
||||||
}
|
}
|
||||||
T *GetAt(int handle){
|
T *GetAt(int handle){
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
if (handle == -1)
|
if (handle == -1)
|
||||||
return nil;
|
return nil;
|
||||||
#endif
|
#endif
|
||||||
return m_flags[handle>>8].u == (handle & 0xFF) ?
|
return m_flags[handle>>8] == (handle & 0xFF) ?
|
||||||
(T*)&m_entries[handle >> 8] : nil;
|
(T*)&m_entries[handle >> 8] : nil;
|
||||||
}
|
}
|
||||||
int32 GetIndex(T *entry){
|
int32 GetIndex(T *entry){
|
||||||
int i = GetJustIndex_NoFreeAssert(entry);
|
int i = GetJustIndex_NoFreeAssert(entry);
|
||||||
return m_flags[i].u + (i<<8);
|
return m_flags[i] + (i<<8);
|
||||||
}
|
}
|
||||||
int32 GetJustIndex(T *entry){
|
int32 GetJustIndex(T *entry){
|
||||||
int index = GetJustIndex_NoFreeAssert(entry);
|
int index = GetJustIndex_NoFreeAssert(entry);
|
||||||
assert(!IsFreeSlot(index));
|
assert(!GetIsFree(index));
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
int32 GetJustIndex_NoFreeAssert(T* entry){
|
int32 GetJustIndex_NoFreeAssert(T* entry){
|
||||||
@ -146,13 +160,12 @@ public:
|
|||||||
int i;
|
int i;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
for(i = 0; i < m_size; i++)
|
for(i = 0; i < m_size; i++)
|
||||||
if(!m_flags[i].free)
|
if(!GetIsFree(i))
|
||||||
n++;
|
n++;
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
bool IsFreeSlot(int i) { return !!m_flags[i].free; }
|
|
||||||
void ClearStorage(uint8 *&flags, U *&entries){
|
void ClearStorage(uint8 *&flags, U *&entries){
|
||||||
delete[] (uint8*)flags;
|
delete[] flags;
|
||||||
delete[] (uint8*)entries;
|
delete[] (uint8*)entries;
|
||||||
flags = nil;
|
flags = nil;
|
||||||
entries = nil;
|
entries = nil;
|
||||||
@ -161,7 +174,7 @@ public:
|
|||||||
void CopyBack(uint8 *&flags, U *&entries){
|
void CopyBack(uint8 *&flags, U *&entries){
|
||||||
memcpy(m_flags, flags, sizeof(uint8)*m_size);
|
memcpy(m_flags, flags, sizeof(uint8)*m_size);
|
||||||
memcpy(m_entries, entries, sizeof(U)*m_size);
|
memcpy(m_entries, entries, sizeof(U)*m_size);
|
||||||
debug("Size copied:%d (%d)\n", sizeof(U)*m_size, sizeof(Flags)*m_size);
|
debug("Size copied:%d (%d)\n", sizeof(U)*m_size, m_size);
|
||||||
m_allocPtr = 0;
|
m_allocPtr = 0;
|
||||||
ClearStorage(flags, entries);
|
ClearStorage(flags, entries);
|
||||||
debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
|
debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
|
||||||
|
@ -139,6 +139,7 @@ CEntity::DetachFromRwObject(void)
|
|||||||
m_matrix.Detach();
|
m_matrix.Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PED_SKIN
|
||||||
RpAtomic*
|
RpAtomic*
|
||||||
AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data)
|
AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data)
|
||||||
{
|
{
|
||||||
@ -158,6 +159,7 @@ AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data)
|
|||||||
}
|
}
|
||||||
return atomic;
|
return atomic;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
CEntity::DeleteRwObject(void)
|
CEntity::DeleteRwObject(void)
|
||||||
@ -228,12 +230,8 @@ CEntity::GetBoundRadius(void)
|
|||||||
void
|
void
|
||||||
CEntity::UpdateRwFrame(void)
|
CEntity::UpdateRwFrame(void)
|
||||||
{
|
{
|
||||||
if(m_rwObject){
|
if(m_rwObject)
|
||||||
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
RwFrameUpdateObjects((RwFrame*)rwObjectGetParent(m_rwObject));
|
||||||
RwFrameUpdateObjects(RpAtomicGetFrame((RpAtomic*)m_rwObject));
|
|
||||||
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
|
||||||
RwFrameUpdateObjects(RpClumpGetFrame((RpClump*)m_rwObject));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PED_SKIN
|
#ifdef PED_SKIN
|
||||||
@ -409,7 +407,11 @@ CEntity::GetIsOnScreen(void)
|
|||||||
bool
|
bool
|
||||||
CEntity::GetIsOnScreenComplex(void)
|
CEntity::GetIsOnScreenComplex(void)
|
||||||
{
|
{
|
||||||
RwV3d boundBox[8];
|
#ifdef GTA_PS2
|
||||||
|
CVuVector boundBox[8];
|
||||||
|
#else
|
||||||
|
CVector boundBox[8];
|
||||||
|
#endif
|
||||||
|
|
||||||
if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix()))
|
if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix()))
|
||||||
return true;
|
return true;
|
||||||
@ -586,7 +588,7 @@ CEntity::SetupBigBuilding(void)
|
|||||||
if(m_level == LEVEL_GENERIC){
|
if(m_level == LEVEL_GENERIC){
|
||||||
if(mi->GetTxdSlot() != CTxdStore::FindTxdSlot("generic")){
|
if(mi->GetTxdSlot() != CTxdStore::FindTxdSlot("generic")){
|
||||||
mi->SetTexDictionary("generic");
|
mi->SetTexDictionary("generic");
|
||||||
printf("%d:%s txd has been set to generic\n", m_modelIndex, mi->GetName());
|
printf("%d:%s txd has been set to generic\n", m_modelIndex, mi->GetModelName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mi->m_lodDistances[0] > 2000.0f)
|
if(mi->m_lodDistances[0] > 2000.0f)
|
||||||
|
@ -303,14 +303,15 @@ CPhysical::GetHasCollidedWith(CEntity *ent)
|
|||||||
void
|
void
|
||||||
CPhysical::RemoveRefsToEntity(CEntity *ent)
|
CPhysical::RemoveRefsToEntity(CEntity *ent)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i = 0, j;
|
||||||
|
|
||||||
for(i = 0; i < m_nCollisionRecords; i++){
|
while(i < m_nCollisionRecords) {
|
||||||
if(m_aCollisionRecords[i] == ent){
|
if(m_aCollisionRecords[i] == ent){
|
||||||
for(j = i; j < m_nCollisionRecords-1; j++)
|
for(j = i; j < m_nCollisionRecords-1; j++)
|
||||||
m_aCollisionRecords[j] = m_aCollisionRecords[j+1];
|
m_aCollisionRecords[j] = m_aCollisionRecords[j+1];
|
||||||
m_nCollisionRecords--;
|
m_nCollisionRecords--;
|
||||||
}
|
} else
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,13 +519,12 @@ CPhysical::ApplyAirResistance(void)
|
|||||||
m_vecMoveSpeed *= f;
|
m_vecMoveSpeed *= f;
|
||||||
m_vecTurnSpeed *= f;
|
m_vecTurnSpeed *= f;
|
||||||
}else{
|
}else{
|
||||||
float f = Pow(1.0f/(m_fAirResistance*0.5f*m_vecMoveSpeed.MagnitudeSqr() + 1.0f), CTimer::GetTimeStep());
|
float f = Pow(1.0f/Abs(m_fAirResistance*0.5f*m_vecMoveSpeed.MagnitudeSqr() + 1.0f), CTimer::GetTimeStep());
|
||||||
m_vecMoveSpeed *= f;
|
m_vecMoveSpeed *= f;
|
||||||
m_vecTurnSpeed *= 0.99f;
|
m_vecTurnSpeed *= 0.99f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, float &impulseB)
|
CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, float &impulseB)
|
||||||
{
|
{
|
||||||
@ -783,9 +783,13 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
|
|||||||
if(B->GetStatus() == STATUS_PLAYER)
|
if(B->GetStatus() == STATUS_PLAYER)
|
||||||
pointposB *= 0.8f;
|
pointposB *= 0.8f;
|
||||||
if(CWorld::bNoMoreCollisionTorque){
|
if(CWorld::bNoMoreCollisionTorque){
|
||||||
// BUG: the game actually uses A here, but this can't be right
|
#ifdef FIX_BUGS
|
||||||
B->ApplyFrictionMoveForce(fB*-0.3f);
|
B->ApplyFrictionMoveForce(fB*-0.3f);
|
||||||
B->ApplyFrictionTurnForce(fB*-0.3f, pointposB);
|
B->ApplyFrictionTurnForce(fB*-0.3f, pointposB);
|
||||||
|
#else
|
||||||
|
A->ApplyFrictionMoveForce(fB*-0.3f);
|
||||||
|
A->ApplyFrictionTurnForce(fB*-0.3f, pointposB);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!A->bInfiniteMass){
|
if(!A->bInfiniteMass){
|
||||||
@ -881,14 +885,24 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
|
|||||||
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
||||||
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS // division by 0
|
||||||
|
frictionDir = vOtherSpeedA;
|
||||||
|
frictionDir.Normalise();
|
||||||
|
#else
|
||||||
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
||||||
|
#endif
|
||||||
|
|
||||||
speedSum = (B->m_fMass*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(B->m_fMass + A->m_fMass);
|
speedSum = (B->m_fMass*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(B->m_fMass + A->m_fMass);
|
||||||
if(fOtherSpeedA > speedSum){
|
if(fOtherSpeedA > speedSum){
|
||||||
impulseA = (speedSum - fOtherSpeedA) * A->m_fMass;
|
impulseA = (speedSum - fOtherSpeedA) * A->m_fMass;
|
||||||
impulseB = (speedSum - fOtherSpeedB) * B->m_fMass;
|
impulseB = (speedSum - fOtherSpeedB) * B->m_fMass;
|
||||||
impulseLimit = adhesiveLimit*CTimer::GetTimeStep();
|
impulseLimit = adhesiveLimit*CTimer::GetTimeStep();
|
||||||
if(impulseA < -impulseLimit) impulseA = -impulseLimit;
|
if(impulseA < -impulseLimit) impulseA = -impulseLimit;
|
||||||
if(impulseB > impulseLimit) impulseB = impulseLimit; // BUG: game has A's clamp again here, but this can't be right
|
#ifdef FIX_BUGS
|
||||||
|
if(impulseB > impulseLimit) impulseB = impulseLimit;
|
||||||
|
#else
|
||||||
|
if(impulseA < -impulseLimit) impulseA = -impulseLimit; // duplicate
|
||||||
|
#endif
|
||||||
A->ApplyFrictionMoveForce(frictionDir*impulseA);
|
A->ApplyFrictionMoveForce(frictionDir*impulseA);
|
||||||
B->ApplyFrictionMoveForce(frictionDir*impulseB);
|
B->ApplyFrictionMoveForce(frictionDir*impulseB);
|
||||||
return true;
|
return true;
|
||||||
@ -907,7 +921,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
|
|||||||
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
||||||
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS // division by 0
|
||||||
|
frictionDir = vOtherSpeedA;
|
||||||
|
frictionDir.Normalise();
|
||||||
|
#else
|
||||||
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
||||||
|
#endif
|
||||||
float massB = B->GetMass(pointposB, frictionDir);
|
float massB = B->GetMass(pointposB, frictionDir);
|
||||||
speedSum = (massB*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(massB + A->m_fMass);
|
speedSum = (massB*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(massB + A->m_fMass);
|
||||||
if(fOtherSpeedA > speedSum){
|
if(fOtherSpeedA > speedSum){
|
||||||
@ -935,7 +954,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
|
|||||||
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
||||||
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS // division by 0
|
||||||
|
frictionDir = vOtherSpeedA;
|
||||||
|
frictionDir.Normalise();
|
||||||
|
#else
|
||||||
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
||||||
|
#endif
|
||||||
float massA = A->GetMass(pointposA, frictionDir);
|
float massA = A->GetMass(pointposA, frictionDir);
|
||||||
speedSum = (B->m_fMass*fOtherSpeedB + massA*fOtherSpeedA)/(B->m_fMass + massA);
|
speedSum = (B->m_fMass*fOtherSpeedB + massA*fOtherSpeedA)/(B->m_fMass + massA);
|
||||||
if(fOtherSpeedA > speedSum){
|
if(fOtherSpeedA > speedSum){
|
||||||
@ -963,7 +987,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
|
|||||||
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
||||||
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
||||||
|
|
||||||
|
#ifdef FIX_BUGS // division by 0
|
||||||
|
frictionDir = vOtherSpeedA;
|
||||||
|
frictionDir.Normalise();
|
||||||
|
#else
|
||||||
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
||||||
|
#endif
|
||||||
float massA = A->GetMass(pointposA, frictionDir);
|
float massA = A->GetMass(pointposA, frictionDir);
|
||||||
float massB = B->GetMass(pointposB, frictionDir);
|
float massB = B->GetMass(pointposB, frictionDir);
|
||||||
speedSum = (massB*fOtherSpeedB + massA*fOtherSpeedA)/(massB + massA);
|
speedSum = (massB*fOtherSpeedB + massA*fOtherSpeedA)/(massB + massA);
|
||||||
@ -1000,7 +1029,12 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
|
|||||||
|
|
||||||
fOtherSpeed = vOtherSpeed.Magnitude();
|
fOtherSpeed = vOtherSpeed.Magnitude();
|
||||||
if(fOtherSpeed > 0.0f){
|
if(fOtherSpeed > 0.0f){
|
||||||
|
#ifdef FIX_BUGS // division by 0
|
||||||
|
frictionDir = vOtherSpeed;
|
||||||
|
frictionDir.Normalise();
|
||||||
|
#else
|
||||||
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
|
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
|
||||||
|
#endif
|
||||||
// not really impulse but speed
|
// not really impulse but speed
|
||||||
// maybe use ApplyFrictionMoveForce instead?
|
// maybe use ApplyFrictionMoveForce instead?
|
||||||
fImpulse = -fOtherSpeed;
|
fImpulse = -fOtherSpeed;
|
||||||
@ -1018,9 +1052,14 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
|
|||||||
|
|
||||||
fOtherSpeed = vOtherSpeed.Magnitude();
|
fOtherSpeed = vOtherSpeed.Magnitude();
|
||||||
if(fOtherSpeed > 0.0f){
|
if(fOtherSpeed > 0.0f){
|
||||||
|
#ifdef FIX_BUGS // division by 0
|
||||||
|
frictionDir = vOtherSpeed;
|
||||||
|
frictionDir.Normalise();
|
||||||
|
#else
|
||||||
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
|
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
|
||||||
|
#endif
|
||||||
fImpulse = -fOtherSpeed * m_fMass;
|
fImpulse = -fOtherSpeed * m_fMass;
|
||||||
impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5f;
|
impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5;
|
||||||
if(fImpulse < -impulseLimit) fImpulse = -impulseLimit;
|
if(fImpulse < -impulseLimit) fImpulse = -impulseLimit;
|
||||||
ApplyFrictionMoveForce(frictionDir*fImpulse);
|
ApplyFrictionMoveForce(frictionDir*fImpulse);
|
||||||
ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos);
|
ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos);
|
||||||
@ -1053,7 +1092,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
|||||||
int numCollisions;
|
int numCollisions;
|
||||||
int mostColliding;
|
int mostColliding;
|
||||||
CColPoint colpoints[MAX_COLLISION_POINTS];
|
CColPoint colpoints[MAX_COLLISION_POINTS];
|
||||||
CVector shift = { 0.0f, 0.0f, 0.0f };
|
CVector shift = CVector(0.0f, 0.0f, 0.0f);
|
||||||
bool doShift = false;
|
bool doShift = false;
|
||||||
CEntity *boat = nil;
|
CEntity *boat = nil;
|
||||||
|
|
||||||
@ -1111,7 +1150,8 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
|||||||
skipShift = true;
|
skipShift = true;
|
||||||
Aobj->m_pCollidingEntity = B;
|
Aobj->m_pCollidingEntity = B;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
|
skipShift = true;
|
||||||
}else if(B->IsObject() && A->IsVehicle()){
|
}else if(B->IsObject() && A->IsVehicle()){
|
||||||
CObject *Bobj = (CObject*)B;
|
CObject *Bobj = (CObject*)B;
|
||||||
if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
|
if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
|
||||||
@ -1126,7 +1166,8 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
|||||||
if(size.z < A->GetPosition().z ||
|
if(size.z < A->GetPosition().z ||
|
||||||
(Invert(A->GetMatrix(), inv) * size).z < 0.0f)
|
(Invert(A->GetMatrix(), inv) * size).z < 0.0f)
|
||||||
skipShift = true;
|
skipShift = true;
|
||||||
}
|
} else
|
||||||
|
skipShift = true;
|
||||||
}else if(IsBodyPart(A->GetModelIndex()) && B->IsPed())
|
}else if(IsBodyPart(A->GetModelIndex()) && B->IsPed())
|
||||||
skipShift = true;
|
skipShift = true;
|
||||||
else if(A->IsPed() && IsBodyPart(B->GetModelIndex()))
|
else if(A->IsPed() && IsBodyPart(B->GetModelIndex()))
|
||||||
@ -1498,8 +1539,8 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
|||||||
if(numCollisions <= 0)
|
if(numCollisions <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CVector moveSpeed = { 0.0f, 0.0f, 0.0f };
|
CVector moveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||||
CVector turnSpeed = { 0.0f, 0.0f, 0.0f };
|
CVector turnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||||
numResponses = 0;
|
numResponses = 0;
|
||||||
if(A->bHasContacted){
|
if(A->bHasContacted){
|
||||||
for(i = 0; i < numCollisions; i++){
|
for(i = 0; i < numCollisions; i++){
|
||||||
@ -1858,8 +1899,8 @@ CPhysical::ProcessCollision(void)
|
|||||||
}else if(IsObject()){
|
}else if(IsObject()){
|
||||||
int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases;
|
int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases;
|
||||||
if(responsecase == COLLRESPONSE_LAMPOST){
|
if(responsecase == COLLRESPONSE_LAMPOST){
|
||||||
CVector speedUp = { 0.0f, 0.0f, 0.0f };
|
CVector speedUp = CVector(0.0f, 0.0f, 0.0f);
|
||||||
CVector speedDown = { 0.0f, 0.0f, 0.0f };
|
CVector speedDown = CVector(0.0f, 0.0f, 0.0f);
|
||||||
speedUp.z = GetBoundRadius();
|
speedUp.z = GetBoundRadius();
|
||||||
speedDown.z = -speedUp.z;
|
speedDown.z = -speedUp.z;
|
||||||
speedUp = Multiply3x3(GetMatrix(), speedUp);
|
speedUp = Multiply3x3(GetMatrix(), speedUp);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#define WITH_D3D
|
#define WITHD3D
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#ifdef EXTENDED_PIPELINES
|
#ifdef EXTENDED_PIPELINES
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifdef EXTENDED_PIPELINES
|
|
||||||
#ifdef LIBRW
|
#ifdef LIBRW
|
||||||
|
#ifdef EXTENDED_PIPELINES
|
||||||
|
|
||||||
namespace CustomPipes {
|
namespace CustomPipes {
|
||||||
|
|
||||||
@ -134,4 +134,12 @@ void AttachRimPipe(rw::Clump *clump);
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace WorldRender{
|
||||||
|
extern int numBlendInsts[3];
|
||||||
|
void AtomicFirstPass(RpAtomic *atomic, int pass);
|
||||||
|
void AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha);
|
||||||
|
void RenderBlendPass(int pass);
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
#define WITH_D3D
|
#define WITHD3D
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#ifdef RW_D3D9
|
#ifdef RW_D3D9
|
||||||
#ifdef EXTENDED_PIPELINES
|
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "Lights.h"
|
#include "Lights.h"
|
||||||
@ -16,6 +14,8 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "custompipes.h"
|
#include "custompipes.h"
|
||||||
|
|
||||||
|
#ifdef EXTENDED_PIPELINES
|
||||||
|
|
||||||
#ifndef LIBRW
|
#ifndef LIBRW
|
||||||
#error "Need librw for EXTENDED_PIPELINES"
|
#error "Need librw for EXTENDED_PIPELINES"
|
||||||
#endif
|
#endif
|
||||||
@ -553,4 +553,168 @@ DestroyRimLightPipes(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
#ifndef LIBRW
|
||||||
|
#error "Need librw for NEW_PIPELINES"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace WorldRender
|
||||||
|
{
|
||||||
|
|
||||||
|
struct BuildingInst
|
||||||
|
{
|
||||||
|
rw::RawMatrix combinedMat;
|
||||||
|
rw::d3d9::InstanceDataHeader *instHeader;
|
||||||
|
uint8 fadeAlpha;
|
||||||
|
bool lighting;
|
||||||
|
};
|
||||||
|
BuildingInst blendInsts[3][2000];
|
||||||
|
int numBlendInsts[3];
|
||||||
|
|
||||||
|
static RwRGBAReal black;
|
||||||
|
|
||||||
|
static void
|
||||||
|
SetMatrix(BuildingInst *building, rw::Matrix *worldMat)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
RawMatrix world, worldview;
|
||||||
|
Camera *cam = engine->currentCamera;
|
||||||
|
convMatrix(&world, worldMat);
|
||||||
|
RawMatrix::mult(&worldview, &world, &cam->devView);
|
||||||
|
RawMatrix::mult(&building->combinedMat, &worldview, &cam->devProj);
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsTextureTransparent(RwTexture *tex)
|
||||||
|
{
|
||||||
|
if(tex == nil || tex->raster == nil)
|
||||||
|
return false;
|
||||||
|
return PLUGINOFFSET(rw::d3d::D3dRaster, tex->raster, rw::d3d::nativeRasterOffset)->hasAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render all opaque meshes and put atomics that needs blending
|
||||||
|
// into the deferred list.
|
||||||
|
void
|
||||||
|
AtomicFirstPass(RpAtomic *atomic, int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_D3D9);
|
||||||
|
building->fadeAlpha = 255;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
|
||||||
|
bool setupDone = false;
|
||||||
|
bool defer = false;
|
||||||
|
SetMatrix(building, atomic->getFrame()->getLTM());
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
if(inst->vertexAlpha || m->color.alpha != 255 ||
|
||||||
|
IsTextureTransparent(m->texture)){
|
||||||
|
defer = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// alright we're rendering this atomic
|
||||||
|
if(!setupDone){
|
||||||
|
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
|
||||||
|
setIndices(building->instHeader->indexBuffer);
|
||||||
|
setVertexDeclaration(building->instHeader->vertexDeclaration);
|
||||||
|
setVertexShader(default_amb_VS);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
|
||||||
|
if(building->lighting)
|
||||||
|
setAmbient(pAmbient->color);
|
||||||
|
else
|
||||||
|
setAmbient(black);
|
||||||
|
setupDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
|
||||||
|
if(m->texture){
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
setPixelShader(default_tex_PS);
|
||||||
|
}else
|
||||||
|
setPixelShader(default_PS);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
if(defer)
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (d3d9::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_D3D9);
|
||||||
|
building->fadeAlpha = fadeAlpha;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
SetMatrix(building, atomic->getFrame()->getLTM());
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RenderBlendPass(int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::d3d;
|
||||||
|
using namespace rw::d3d9;
|
||||||
|
|
||||||
|
setVertexShader(default_amb_VS);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||||
|
BuildingInst *building = &blendInsts[pass][i];
|
||||||
|
|
||||||
|
setStreamSource(0, building->instHeader->vertexStream[0].vertexBuffer, 0, building->instHeader->vertexStream[0].stride);
|
||||||
|
setIndices(building->instHeader->indexBuffer);
|
||||||
|
setVertexDeclaration(building->instHeader->vertexDeclaration);
|
||||||
|
d3ddevice->SetVertexShaderConstantF(VSLOC_combined, (float*)&building->combinedMat, 4);
|
||||||
|
if(building->lighting)
|
||||||
|
setAmbient(pAmbient->color);
|
||||||
|
else
|
||||||
|
setAmbient(black);
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255)
|
||||||
|
continue; // already done this one
|
||||||
|
|
||||||
|
rw::RGBA color = m->color;
|
||||||
|
color.alpha = (color.alpha * building->fadeAlpha)/255;
|
||||||
|
setMaterial(color, m->surfaceProps);
|
||||||
|
|
||||||
|
if(m->texture){
|
||||||
|
d3d::setTexture(0, m->texture);
|
||||||
|
setPixelShader(default_tex_PS);
|
||||||
|
}else
|
||||||
|
setPixelShader(default_PS);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
#ifdef RW_OPENGL
|
#ifdef RW_OPENGL
|
||||||
#ifdef EXTENDED_PIPELINES
|
|
||||||
|
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "RwHelper.h"
|
#include "RwHelper.h"
|
||||||
#include "Lights.h"
|
#include "Lights.h"
|
||||||
@ -15,6 +13,8 @@
|
|||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "custompipes.h"
|
#include "custompipes.h"
|
||||||
|
|
||||||
|
#ifdef EXTENDED_PIPELINES
|
||||||
|
|
||||||
#ifndef LIBRW
|
#ifndef LIBRW
|
||||||
#error "Need librw for EXTENDED_PIPELINES"
|
#error "Need librw for EXTENDED_PIPELINES"
|
||||||
#endif
|
#endif
|
||||||
@ -614,4 +614,171 @@ CustomPipeRegisterGL(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef NEW_RENDERER
|
||||||
|
#ifndef LIBRW
|
||||||
|
#error "Need librw for NEW_PIPELINES"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace WorldRender
|
||||||
|
{
|
||||||
|
|
||||||
|
struct BuildingInst
|
||||||
|
{
|
||||||
|
rw::Matrix matrix;
|
||||||
|
rw::gl3::InstanceDataHeader *instHeader;
|
||||||
|
uint8 fadeAlpha;
|
||||||
|
bool lighting;
|
||||||
|
};
|
||||||
|
BuildingInst blendInsts[3][2000];
|
||||||
|
int numBlendInsts[3];
|
||||||
|
|
||||||
|
static RwRGBAReal black;
|
||||||
|
|
||||||
|
static bool
|
||||||
|
IsTextureTransparent(RwTexture *tex)
|
||||||
|
{
|
||||||
|
if(tex == nil || tex->raster == nil)
|
||||||
|
return false;
|
||||||
|
return PLUGINOFFSET(rw::gl3::Gl3Raster, tex->raster, rw::gl3::nativeRasterOffset)->hasAlpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Render all opaque meshes and put atomics that needs blending
|
||||||
|
// into the deferred list.
|
||||||
|
void
|
||||||
|
AtomicFirstPass(RpAtomic *atomic, int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_GL3);
|
||||||
|
building->fadeAlpha = 255;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
|
||||||
|
WorldLights lights;
|
||||||
|
lights.numAmbients = 1;
|
||||||
|
lights.numDirectionals = 0;
|
||||||
|
lights.numLocals = 0;
|
||||||
|
if(building->lighting)
|
||||||
|
lights.ambient = pAmbient->color;
|
||||||
|
else
|
||||||
|
lights.ambient = black;
|
||||||
|
|
||||||
|
bool setupDone = false;
|
||||||
|
bool defer = false;
|
||||||
|
building->matrix = *atomic->getFrame()->getLTM();
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 i = 0; i < building->instHeader->numMeshes; i++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
|
||||||
|
if(inst->vertexAlpha || m->color.alpha != 255 ||
|
||||||
|
IsTextureTransparent(m->texture)){
|
||||||
|
defer = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// alright we're rendering this atomic
|
||||||
|
if(!setupDone){
|
||||||
|
defaultShader->use();
|
||||||
|
setWorldMatrix(&building->matrix);
|
||||||
|
#ifdef RW_GL_USE_VAOS
|
||||||
|
glBindVertexArray(building->instHeader->vao);
|
||||||
|
#else
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
|
||||||
|
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
setLights(&lights);
|
||||||
|
setupDone = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
setMaterial(m->color, m->surfaceProps);
|
||||||
|
|
||||||
|
setTexture(0, m->texture);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
#ifndef RW_GL_USE_VAOS
|
||||||
|
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
if(defer)
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
AtomicFullyTransparent(RpAtomic *atomic, int pass, int fadeAlpha)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
BuildingInst *building = &blendInsts[pass][numBlendInsts[pass]];
|
||||||
|
|
||||||
|
atomic->getPipeline()->instance(atomic);
|
||||||
|
building->instHeader = (gl3::InstanceDataHeader*)atomic->geometry->instData;
|
||||||
|
assert(building->instHeader != nil);
|
||||||
|
assert(building->instHeader->platform == PLATFORM_GL3);
|
||||||
|
building->fadeAlpha = fadeAlpha;
|
||||||
|
building->lighting = !!(atomic->geometry->flags & rw::Geometry::LIGHT);
|
||||||
|
building->matrix = *atomic->getFrame()->getLTM();
|
||||||
|
numBlendInsts[pass]++;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
RenderBlendPass(int pass)
|
||||||
|
{
|
||||||
|
using namespace rw;
|
||||||
|
using namespace rw::gl3;
|
||||||
|
|
||||||
|
defaultShader->use();
|
||||||
|
WorldLights lights;
|
||||||
|
lights.numAmbients = 1;
|
||||||
|
lights.numDirectionals = 0;
|
||||||
|
lights.numLocals = 0;
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for(i = 0; i < numBlendInsts[pass]; i++){
|
||||||
|
BuildingInst *building = &blendInsts[pass][i];
|
||||||
|
|
||||||
|
#ifdef RW_GL_USE_VAOS
|
||||||
|
glBindVertexArray(building->instHeader->vao);
|
||||||
|
#else
|
||||||
|
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, building->instHeader->ibo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, building->instHeader->vbo);
|
||||||
|
setAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
setWorldMatrix(&building->matrix);
|
||||||
|
if(building->lighting)
|
||||||
|
lights.ambient = pAmbient->color;
|
||||||
|
else
|
||||||
|
lights.ambient = black;
|
||||||
|
setLights(&lights);
|
||||||
|
|
||||||
|
InstanceData *inst = building->instHeader->inst;
|
||||||
|
for(rw::uint32 j = 0; j < building->instHeader->numMeshes; j++, inst++){
|
||||||
|
Material *m = inst->material;
|
||||||
|
if(!inst->vertexAlpha && m->color.alpha == 255 && !IsTextureTransparent(m->texture) && building->fadeAlpha == 255)
|
||||||
|
continue; // already done this one
|
||||||
|
|
||||||
|
rw::RGBA color = m->color;
|
||||||
|
color.alpha = (color.alpha * building->fadeAlpha)/255;
|
||||||
|
setMaterial(color, m->surfaceProps);
|
||||||
|
|
||||||
|
setTexture(0, m->texture);
|
||||||
|
|
||||||
|
drawInst(building->instHeader, inst);
|
||||||
|
}
|
||||||
|
#ifndef RW_GL_USE_VAOS
|
||||||
|
disableAttribPointers(building->instHeader->attribDesc, building->instHeader->numAttribs);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -123,7 +123,7 @@ void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMe
|
|||||||
option.m_TargetMenu = targetMenu;
|
option.m_TargetMenu = targetMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveName)
|
void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, const char* saveCat, const char* saveKey, bool disableIfGameLoaded)
|
||||||
{
|
{
|
||||||
int8 screenOptionOrder = RegisterNewOption();
|
int8 screenOptionOrder = RegisterNewOption();
|
||||||
|
|
||||||
@ -139,12 +139,14 @@ void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 n
|
|||||||
option.m_CFOSelect->displayedValue = *var;
|
option.m_CFOSelect->displayedValue = *var;
|
||||||
option.m_CFOSelect->lastSavedValue = *var;
|
option.m_CFOSelect->lastSavedValue = *var;
|
||||||
}
|
}
|
||||||
option.m_CFOSelect->save = saveName;
|
option.m_CFOSelect->saveCat = saveCat;
|
||||||
|
option.m_CFOSelect->save = saveKey;
|
||||||
option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter;
|
option.m_CFOSelect->onlyApplyOnEnter = onlyApplyOnEnter;
|
||||||
option.m_CFOSelect->changeFunc = changeFunc;
|
option.m_CFOSelect->changeFunc = changeFunc;
|
||||||
|
option.m_CFOSelect->disableIfGameLoaded = disableIfGameLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveName)
|
void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var, ButtonPressFunc buttonPressFunc, const char* saveCat, const char* saveKey)
|
||||||
{
|
{
|
||||||
int8 screenOptionOrder = RegisterNewOption();
|
int8 screenOptionOrder = RegisterNewOption();
|
||||||
|
|
||||||
@ -155,7 +157,8 @@ void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var,
|
|||||||
option.m_CFODynamic->drawFunc = drawFunc;
|
option.m_CFODynamic->drawFunc = drawFunc;
|
||||||
option.m_CFODynamic->buttonPressFunc = buttonPressFunc;
|
option.m_CFODynamic->buttonPressFunc = buttonPressFunc;
|
||||||
option.m_CFODynamic->value = var;
|
option.m_CFODynamic->value = var;
|
||||||
option.m_CFODynamic->save = saveName;
|
option.m_CFODynamic->saveCat = saveCat;
|
||||||
|
option.m_CFODynamic->save = saveKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 FrontendScreenAdd(const char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight,
|
uint8 FrontendScreenAdd(const char* gxtKey, eMenuSprites sprite, int prevPage, int columnWidth, int headerHeight, int lineHeight,
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user