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
|
||||
*.elf
|
||||
/.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)
|
||||
|
||||
project(re3 C CXX)
|
||||
set(EXECUTABLE re3)
|
||||
set(PROJECT RE3)
|
||||
|
||||
project(${EXECUTABLE} C CXX)
|
||||
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
||||
|
||||
if(WIN32)
|
||||
set(RE3_AUDIOS "NULL" "OAL" "MSS")
|
||||
set(${PROJECT}_AUDIOS "OAL" "MSS")
|
||||
else()
|
||||
set(RE3_AUDIOS "NULL" "OAL")
|
||||
set(${PROJECT}_AUDIOS "OAL")
|
||||
endif()
|
||||
|
||||
set(RE3_AUDIO "OAL" CACHE STRING "Audio")
|
||||
set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio")
|
||||
|
||||
set_property(CACHE RE3_AUDIO PROPERTY STRINGS ${RE3_AUDIOS})
|
||||
message(STATUS "RE3_AUDIO = ${RE3_AUDIO} (choices=${RE3_AUDIOS})")
|
||||
set("RE3_AUDIO_${RE3_AUDIO}" ON)
|
||||
if(NOT RE3_AUDIO IN_LIST RE3_AUDIOS)
|
||||
message(FATAL_ERROR "Illegal RE3_AUDIO=${RE3_AUDIO}")
|
||||
option(${PROJECT}_WITH_OPUS "Build ${EXECUTABLE} with opus support" OFF)
|
||||
option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF)
|
||||
|
||||
set_property(CACHE ${PROJECT}_AUDIO PROPERTY STRINGS ${${PROJECT}_AUDIOS})
|
||||
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()
|
||||
|
||||
if(RE3_INSTALL)
|
||||
include(GNUInstallDirs)
|
||||
set(RE3_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/re3")
|
||||
option(${PROJECT}_VENDORED_LIBRW "Use vendored librw" ON)
|
||||
if(${PROJECT}_VENDORED_LIBRW)
|
||||
add_subdirectory(vendor/librw)
|
||||
else()
|
||||
find_package(librw REQUIRED)
|
||||
endif()
|
||||
|
||||
add_subdirectory("vendor/librw")
|
||||
add_subdirectory(src)
|
||||
|
||||
if(RE3_INSTALL)
|
||||
include(CMakePackageConfigHelpers)
|
||||
configure_package_config_file(re3-config.cmake.in re3-config.cmake
|
||||
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
|
||||
)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/re3-config.cmake"
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
install(
|
||||
EXPORT re3-targets
|
||||
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
|
||||
)
|
||||
if(${PROJECT}_INSTALL)
|
||||
install(DIRECTORY gamefiles/ DESTINATION ".")
|
||||
if(LIBRW_PLATFORM_NULL)
|
||||
set(platform "-null")
|
||||
elseif(LIBRW_PLATFORM_PS2)
|
||||
set(platform "-ps2")
|
||||
elseif(LIBRW_PLATFORM_GL3)
|
||||
if(LIBRW_GL3_GFXLIB STREQUAL "GLFW")
|
||||
set(platform "-gl3-glfw")
|
||||
else()
|
||||
set(platform "-gl3-sdl2")
|
||||
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()
|
||||
|
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
|
||||
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`.
|
||||
|
||||
# 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
|
||||
#
|
||||
# SNDFILE_FOUND - system has libsndfile
|
||||
# SNDFILE_FOUND - system has libsndfile
|
||||
# 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
|
||||
#
|
||||
@ -15,53 +17,51 @@
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
||||
# in cache already
|
||||
set(SNDFILE_FOUND TRUE)
|
||||
else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
pkg_search_module(PKG_SNDFILE "sndfile")
|
||||
endif()
|
||||
|
||||
find_path(SNDFILE_INCLUDE_DIR
|
||||
find_path(SNDFILE_INCLUDE_DIR
|
||||
NAMES
|
||||
sndfile.h
|
||||
sndfile.h
|
||||
HINTS
|
||||
${PKG_SNDFILE_INCLUDE_DIRS}
|
||||
PATHS
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
)
|
||||
|
||||
find_library(SNDFILE_LIBRARY
|
||||
/usr/include
|
||||
/usr/local/include
|
||||
/opt/local/include
|
||||
/sw/include
|
||||
)
|
||||
|
||||
find_library(SNDFILE_LIBRARY
|
||||
NAMES
|
||||
sndfile
|
||||
sndfile
|
||||
HINTS
|
||||
${PKG_SNDFILE_LIBRARIES}
|
||||
PATHS
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
/usr/lib
|
||||
/usr/local/lib
|
||||
/opt/local/lib
|
||||
/sw/lib
|
||||
)
|
||||
|
||||
set(SNDFILE_INCLUDE_DIRS
|
||||
${SNDFILE_INCLUDE_DIR}
|
||||
)
|
||||
set(SNDFILE_LIBRARIES
|
||||
${SNDFILE_LIBRARY}
|
||||
)
|
||||
set(SNDFILE_CFLAGS "${PKG_SNDFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of libsndfile")
|
||||
|
||||
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)
|
||||
endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
|
||||
endif()
|
||||
|
||||
if (SNDFILE_FOUND)
|
||||
if (NOT SndFile_FIND_QUIETLY)
|
||||
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)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
|
||||
|
||||
# show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view
|
||||
mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
|
||||
|
||||
endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS)
|
||||
if(NOT TARGET SndFile::SndFile)
|
||||
add_library(__SndFile INTERFACE)
|
||||
target_compile_options(__SndFile INTERFACE ${SNDFILE_CFLAGS})
|
||||
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"
|
||||
}
|
||||
|
||||
newoption {
|
||||
trigger = "lto",
|
||||
description = "Use link time optimization"
|
||||
}
|
||||
|
||||
if(_OPTIONS["with-librw"]) then
|
||||
Librw = "vendor/librw"
|
||||
else
|
||||
@ -61,6 +66,7 @@ end
|
||||
workspace "re3"
|
||||
language "C++"
|
||||
configurations { "Debug", "Release" }
|
||||
startproject "re3"
|
||||
location "build"
|
||||
symbols "Full"
|
||||
staticruntime "off"
|
||||
@ -109,7 +115,10 @@ workspace "re3"
|
||||
|
||||
filter "configurations:Release"
|
||||
defines { "NDEBUG" }
|
||||
optimize "On"
|
||||
optimize "Speed"
|
||||
if(_OPTIONS["lto"]) then
|
||||
flags { "LinkTimeOptimization" }
|
||||
end
|
||||
|
||||
filter { "platforms:win*" }
|
||||
system "windows"
|
||||
@ -125,11 +134,9 @@ workspace "re3"
|
||||
|
||||
filter { "platforms:*x86*" }
|
||||
architecture "x86"
|
||||
floatingpoint "Fast"
|
||||
|
||||
filter { "platforms:*amd64*" }
|
||||
architecture "amd64"
|
||||
floatingpoint "Fast"
|
||||
|
||||
filter { "platforms:*arm*" }
|
||||
architecture "ARM"
|
||||
@ -164,11 +171,10 @@ workspace "re3"
|
||||
|
||||
filter {}
|
||||
|
||||
function setpaths (gamepath, exepath, scriptspath)
|
||||
scriptspath = scriptspath or ""
|
||||
function setpaths (gamepath, exepath)
|
||||
if (gamepath) then
|
||||
postbuildcommands {
|
||||
'{COPY} "%{cfg.buildtarget.abspath}" "' .. gamepath .. scriptspath .. '%{cfg.buildtarget.name}"'
|
||||
'{COPYFILE} "%{cfg.buildtarget.abspath}" "' .. gamepath .. '%{cfg.buildtarget.name}"'
|
||||
}
|
||||
debugdir (gamepath)
|
||||
if (exepath) then
|
||||
@ -178,7 +184,6 @@ workspace "re3"
|
||||
debugdir (gamepath .. (dir or ""))
|
||||
end
|
||||
end
|
||||
--targetdir ("bin/%{prj.name}/" .. scriptspath)
|
||||
end
|
||||
|
||||
if(_OPTIONS["with-librw"]) then
|
||||
@ -191,11 +196,9 @@ project "librw"
|
||||
|
||||
filter { "platforms:*x86*" }
|
||||
architecture "x86"
|
||||
floatingpoint "Fast"
|
||||
|
||||
filter { "platforms:*amd64*" }
|
||||
architecture "amd64"
|
||||
floatingpoint "Fast"
|
||||
|
||||
filter "platforms:win*"
|
||||
staticruntime "on"
|
||||
@ -302,7 +305,7 @@ project "re3"
|
||||
|
||||
filter {}
|
||||
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
|
||||
|
||||
filter "platforms:win*"
|
||||
@ -356,7 +359,7 @@ project "re3"
|
||||
filter "platforms:*RW33*"
|
||||
includedirs { "sdk/rwsdk/include/d3d8" }
|
||||
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" }
|
||||
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)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
if(${RE3_AUDIO} STREQUAL "OAL")
|
||||
find_package(OpenAL REQUIRED)
|
||||
find_package(MPG123 REQUIRED)
|
||||
find_package(SndFile REQUIRED)
|
||||
endif()
|
||||
file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
|
||||
|
||||
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)
|
||||
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(${PROJECT}_INCLUDES)
|
||||
|
||||
HEADER_DIRECTORIES(header_list)
|
||||
include_directories(${header_list})
|
||||
add_executable(${EXECUTABLE} WIN32
|
||||
${${PROJECT}_SOURCES}
|
||||
)
|
||||
|
||||
target_link_libraries(${EXECUTABLE} PRIVATE
|
||||
librw::librw
|
||||
Threads::Threads
|
||||
)
|
||||
|
||||
add_executable(re3 ${Sources})
|
||||
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
|
||||
target_include_directories(${EXECUTABLE}
|
||||
PRIVATE
|
||||
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>"
|
||||
PUBLIC
|
||||
"RW_${RE3_PLATFORM}"
|
||||
)
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
$<BUILD_INTERFACE:${${PROJECT}_INCLUDES}>
|
||||
)
|
||||
|
||||
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")
|
||||
target_compile_options(re3
|
||||
target_compile_options(${EXECUTABLE}
|
||||
PRIVATE
|
||||
"-Wall"
|
||||
)
|
||||
if (NOT RE3_PLATFORM_PS2)
|
||||
target_compile_options(re3
|
||||
)
|
||||
if (NOT LIBRW_PLATFORM_PS2)
|
||||
target_compile_options(${EXECUTABLE}
|
||||
PRIVATE
|
||||
"-Wextra"
|
||||
"-Wdouble-promotion"
|
||||
"-Wpedantic"
|
||||
)
|
||||
-Wextra
|
||||
-Wdouble-promotion
|
||||
-Wpedantic
|
||||
)
|
||||
endif()
|
||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||
target_compile_options(re3
|
||||
target_compile_options(${EXECUTABLE}
|
||||
PUBLIC
|
||||
/wd4996 /wd4244
|
||||
)
|
||||
/Zc:sizedDealloc-
|
||||
)
|
||||
endif()
|
||||
|
||||
set_target_properties(re3
|
||||
set_target_properties(${EXECUTABLE}
|
||||
PROPERTIES
|
||||
C_STANDARD 11
|
||||
C_EXTENSIONS OFF
|
||||
@ -94,20 +122,15 @@ set_target_properties(re3
|
||||
CXX_STANDARD 11
|
||||
CXX_EXTENSIONS OFF
|
||||
CXX_STANDARD_REQUIRED ON
|
||||
PREFIX ""
|
||||
)
|
||||
|
||||
if(RE3_INSTALL)
|
||||
target_include_directories(re3
|
||||
INTERFACE
|
||||
$<INSTALL_INTERFACE:${RE3_INSTALL_INCLUDEDIR}>
|
||||
)
|
||||
)
|
||||
|
||||
if(${PROJECT}_INSTALL)
|
||||
install(
|
||||
TARGETS re3
|
||||
EXPORT re3-targets
|
||||
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
|
||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||
)
|
||||
TARGETS ${EXECUTABLE}
|
||||
EXPORT ${EXECUTABLE}-targets
|
||||
RUNTIME DESTINATION "."
|
||||
)
|
||||
if(MSVC)
|
||||
install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
|
||||
endif()
|
||||
endif()
|
||||
|
@ -1,7 +1,11 @@
|
||||
#include "common.h"
|
||||
|
||||
#if defined _WIN32 && !defined __MINGW32__
|
||||
#if defined __MWERKS__
|
||||
#include <wctype.h>
|
||||
#else
|
||||
#include "ctype.h"
|
||||
#endif
|
||||
#else
|
||||
#include <cwctype>
|
||||
#endif
|
||||
@ -83,18 +87,18 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
|
||||
if(c1) s1++;
|
||||
if(c2) s2++;
|
||||
if(c1 == '\0' && c2 == '\0') return true;
|
||||
#if defined _WIN32 && !defined __MINGW32__
|
||||
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
|
||||
#else
|
||||
#ifndef ASCII_STRCMP
|
||||
if(iswdigit(c1) && iswdigit(c2))
|
||||
#else
|
||||
if(__ascii_iswdigit(c1) && __ascii_iswdigit(c2))
|
||||
#endif
|
||||
continue;
|
||||
#if defined _WIN32 && !defined __MINGW32__
|
||||
c1 = __ascii_toupper(c1);
|
||||
c2 = __ascii_toupper(c2);
|
||||
#else
|
||||
#ifndef ASCII_STRCMP
|
||||
c1 = toupper(c1);
|
||||
c2 = toupper(c2);
|
||||
#else
|
||||
c1 = __ascii_toupper(c1);
|
||||
c2 = __ascii_toupper(c2);
|
||||
#endif
|
||||
|
||||
if(c1 != c2)
|
||||
@ -111,7 +115,7 @@ GetModelFromName(const char *name)
|
||||
for(i = 0; i < MODELINFOSIZE; i++){
|
||||
mi = CModelInfo::GetModelInfo(i);
|
||||
if(mi && mi->GetRwObject() && RwObjectGetType(mi->GetRwObject()) == rpCLUMP &&
|
||||
strcmpIgnoringDigits(mi->GetName(), name))
|
||||
strcmpIgnoringDigits(mi->GetModelName(), name))
|
||||
return mi;
|
||||
}
|
||||
return nil;
|
||||
@ -134,7 +138,7 @@ CAnimBlendAssocGroup::CreateAssociations(const char *name)
|
||||
CAnimBlendHierarchy *anim = CAnimManager::GetAnimation(animBlock->firstIndex + i);
|
||||
CBaseModelInfo *model = GetModelFromName(anim->name);
|
||||
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();
|
||||
#ifdef PED_SKIN
|
||||
if(IsClumpSkinned(clump))
|
||||
|
@ -7,7 +7,7 @@
|
||||
CAnimBlendClumpData::CAnimBlendClumpData(void)
|
||||
{
|
||||
numFrames = 0;
|
||||
velocity = nil;
|
||||
velocity2d = nil;
|
||||
frames = nil;
|
||||
link.Init();
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "AnimBlendList.h"
|
||||
|
||||
|
||||
// TODO: put somewhere else
|
||||
struct AnimBlendFrameData
|
||||
{
|
||||
enum {
|
||||
@ -38,7 +37,10 @@ public:
|
||||
#ifdef PED_SKIN
|
||||
int32 modelNumber; // doesn't seem to be used
|
||||
#endif
|
||||
CVector *velocity;
|
||||
union {
|
||||
CVector2D *velocity2d;
|
||||
CVector *velocity3d;
|
||||
};
|
||||
// order of frames is determined by RW hierarchy
|
||||
AnimBlendFrameData *frames;
|
||||
|
||||
|
@ -29,7 +29,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
|
||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
|
||||
gpAnimBlendClump->velocity){
|
||||
gpAnimBlendClump->velocity2d){
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
|
||||
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
|
||||
else
|
||||
@ -138,11 +138,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
gpAnimBlendClump->velocity->x = transx - curx;
|
||||
gpAnimBlendClump->velocity->y = transy - cury;
|
||||
gpAnimBlendClump->velocity2d->x = transx - curx;
|
||||
gpAnimBlendClump->velocity2d->y = transy - cury;
|
||||
if(looped){
|
||||
gpAnimBlendClump->velocity->x += endx;
|
||||
gpAnimBlendClump->velocity->y += endy;
|
||||
gpAnimBlendClump->velocity2d->x += endx;
|
||||
gpAnimBlendClump->velocity2d->y += endy;
|
||||
}
|
||||
mat->pos.x = pos.x - transx;
|
||||
mat->pos.y = pos.y - transy;
|
||||
@ -218,9 +218,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame,
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
*gpAnimBlendClump->velocity = trans - cur;
|
||||
*gpAnimBlendClump->velocity3d = trans - cur;
|
||||
if(looped)
|
||||
*gpAnimBlendClump->velocity += end;
|
||||
*gpAnimBlendClump->velocity3d += end;
|
||||
mat->pos.x = (pos - trans).x + frame->resetPos.x;
|
||||
mat->pos.y = (pos - trans).y + frame->resetPos.y;
|
||||
mat->pos.z = (pos - trans).z + frame->resetPos.z;
|
||||
@ -241,7 +241,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
|
||||
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
|
||||
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
|
||||
gpAnimBlendClump->velocity){
|
||||
gpAnimBlendClump->velocity2d){
|
||||
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
|
||||
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
|
||||
else
|
||||
@ -353,11 +353,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
gpAnimBlendClump->velocity->x = transx - curx;
|
||||
gpAnimBlendClump->velocity->y = transy - cury;
|
||||
gpAnimBlendClump->velocity2d->x = transx - curx;
|
||||
gpAnimBlendClump->velocity2d->y = transy - cury;
|
||||
if(looped){
|
||||
gpAnimBlendClump->velocity->x += endx;
|
||||
gpAnimBlendClump->velocity->y += endy;
|
||||
gpAnimBlendClump->velocity2d->x += endx;
|
||||
gpAnimBlendClump->velocity2d->y += endy;
|
||||
}
|
||||
xform->t.x = pos.x - transx;
|
||||
xform->t.y = pos.y - transy;
|
||||
@ -433,9 +433,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
|
||||
}
|
||||
|
||||
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
|
||||
*gpAnimBlendClump->velocity = trans - cur;
|
||||
*gpAnimBlendClump->velocity3d = trans - cur;
|
||||
if(looped)
|
||||
*gpAnimBlendClump->velocity += end;
|
||||
*gpAnimBlendClump->velocity3d += end;
|
||||
xform->t.x = (pos - trans).x + frame->resetPos.x;
|
||||
xform->t.y = (pos - trans).y + frame->resetPos.y;
|
||||
xform->t.z = (pos - trans).z + frame->resetPos.z;
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "common.h"
|
||||
#include "common.h"
|
||||
|
||||
#include "AudioManager.h"
|
||||
#include "audio_enums.h"
|
||||
@ -38,7 +38,7 @@
|
||||
#include "ZoneCull.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 allChannels = channels + 2;
|
||||
|
||||
@ -3038,109 +3038,109 @@ cAudioManager::ProcessPedOneShots(cPedParams ¶ms)
|
||||
switch (sound) {
|
||||
case SOUND_STEP_START:
|
||||
case SOUND_STEP_END:
|
||||
if (!params.m_pPed->bIsLooking) {
|
||||
emittingVol = m_anRandomTable[3] % 15 + 45;
|
||||
if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
|
||||
emittingVol /= 2;
|
||||
maxDist = 400.f;
|
||||
switch (params.m_pPed->m_nSurfaceTouched) {
|
||||
case SURFACE_GRASS:
|
||||
sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
|
||||
break;
|
||||
case SURFACE_GRAVEL:
|
||||
case SURFACE_MUD_DRY:
|
||||
sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
|
||||
break;
|
||||
case SURFACE_CAR:
|
||||
case SURFACE_GARAGE_DOOR:
|
||||
case SURFACE_CAR_PANEL:
|
||||
case SURFACE_THICK_METAL_PLATE:
|
||||
case SURFACE_SCAFFOLD_POLE:
|
||||
case SURFACE_LAMP_POST:
|
||||
case SURFACE_FIRE_HYDRANT:
|
||||
case SURFACE_GIRDER:
|
||||
case SURFACE_METAL_CHAIN_FENCE:
|
||||
case SURFACE_CONTAINER:
|
||||
case SURFACE_NEWS_VENDOR:
|
||||
sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
|
||||
break;
|
||||
case SURFACE_SAND:
|
||||
sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
|
||||
break;
|
||||
case SURFACE_WATER:
|
||||
sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
|
||||
break;
|
||||
case SURFACE_WOOD_CRATES:
|
||||
case SURFACE_WOOD_BENCH:
|
||||
case SURFACE_WOOD_SOLID:
|
||||
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
|
||||
break;
|
||||
case SURFACE_HEDGE:
|
||||
sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
|
||||
break;
|
||||
default:
|
||||
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;
|
||||
if (params.m_pPed->bIsInTheAir)
|
||||
continue;
|
||||
emittingVol = m_anRandomTable[3] % 15 + 45;
|
||||
if (FindPlayerPed() != m_asAudioEntities[m_sQueueSample.m_nEntityIndex].m_pEntity)
|
||||
emittingVol /= 2;
|
||||
maxDist = 400.f;
|
||||
switch (params.m_pPed->m_nSurfaceTouched) {
|
||||
case SURFACE_GRASS:
|
||||
sampleIndex = m_anRandomTable[1] % 5 + SFX_FOOTSTEP_GRASS_1;
|
||||
break;
|
||||
case SURFACE_GRAVEL:
|
||||
case SURFACE_MUD_DRY:
|
||||
sampleIndex = m_anRandomTable[4] % 5 + SFX_FOOTSTEP_GRAVEL_1;
|
||||
break;
|
||||
case SURFACE_CAR:
|
||||
case SURFACE_GARAGE_DOOR:
|
||||
case SURFACE_CAR_PANEL:
|
||||
case SURFACE_THICK_METAL_PLATE:
|
||||
case SURFACE_SCAFFOLD_POLE:
|
||||
case SURFACE_LAMP_POST:
|
||||
case SURFACE_FIRE_HYDRANT:
|
||||
case SURFACE_GIRDER:
|
||||
case SURFACE_METAL_CHAIN_FENCE:
|
||||
case SURFACE_CONTAINER:
|
||||
case SURFACE_NEWS_VENDOR:
|
||||
sampleIndex = m_anRandomTable[0] % 5 + SFX_FOOTSTEP_METAL_1;
|
||||
break;
|
||||
case SURFACE_SAND:
|
||||
sampleIndex = (m_anRandomTable[4] & 3) + SFX_FOOTSTEP_SAND_1;
|
||||
break;
|
||||
case SURFACE_WATER:
|
||||
sampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
|
||||
break;
|
||||
case SURFACE_WOOD_CRATES:
|
||||
case SURFACE_WOOD_BENCH:
|
||||
case SURFACE_WOOD_SOLID:
|
||||
sampleIndex = m_anRandomTable[2] % 5 + SFX_FOOTSTEP_WOOD_1;
|
||||
break;
|
||||
case SURFACE_HEDGE:
|
||||
sampleIndex = m_anRandomTable[2] % 5 + SFX_COL_VEG_1;
|
||||
break;
|
||||
default:
|
||||
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] - 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;
|
||||
case SOUND_FALL_LAND:
|
||||
case SOUND_FALL_COLLAPSE:
|
||||
if (!ped->bIsLooking) {
|
||||
maxDist = SQR(30);
|
||||
emittingVol = m_anRandomTable[3] % 20 + 80;
|
||||
if (ped->m_nSurfaceTouched == SURFACE_WATER) {
|
||||
m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
|
||||
} else if (sound == SOUND_FALL_LAND) {
|
||||
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND;
|
||||
} 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;
|
||||
if (ped->bIsInTheAir)
|
||||
continue;
|
||||
maxDist = SQR(30);
|
||||
emittingVol = m_anRandomTable[3] % 20 + 80;
|
||||
if (ped->m_nSurfaceTouched == SURFACE_WATER) {
|
||||
m_sQueueSample.m_nSampleIndex = (m_anRandomTable[3] & 3) + SFX_FOOTSTEP_WATER_1;
|
||||
} else if (sound == SOUND_FALL_LAND) {
|
||||
m_sQueueSample.m_nSampleIndex = SFX_BODY_LAND;
|
||||
} 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;
|
||||
break;
|
||||
case SOUND_FIGHT_PUNCH_33:
|
||||
m_sQueueSample.m_nSampleIndex = SFX_FIGHT_1;
|
||||
@ -5788,7 +5788,7 @@ cAudioManager::GetCasualMaleOldTalkSfx(int16 sound)
|
||||
uint32
|
||||
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")) {
|
||||
return GetEightTalkSfx(sound);
|
||||
}
|
||||
|
@ -13,16 +13,19 @@
|
||||
|
||||
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 allChannels = channels + 2;
|
||||
|
||||
#define SPEED_OF_SOUND 343.f
|
||||
#define TIME_SPENT 50
|
||||
|
||||
cAudioManager::cAudioManager()
|
||||
{
|
||||
m_bIsInitialised = false;
|
||||
field_1 = 1;
|
||||
m_fSpeedOfSound = 6.86f;
|
||||
m_nTimeSpent = 50;
|
||||
m_bReverb = true;
|
||||
m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT;
|
||||
m_nTimeSpent = TIME_SPENT;
|
||||
m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
|
||||
m_nActiveSampleQueue = 1;
|
||||
ClearRequestedQueue();
|
||||
@ -945,7 +948,7 @@ cAudioManager::ClearActiveSamples()
|
||||
m_asActiveSamples[i].m_nCalculatedVolume = 0;
|
||||
m_asActiveSamples[i].m_nReleasingVolumeDivider = 0;
|
||||
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_nLoopsRemaining = 0;
|
||||
m_asActiveSamples[i].m_bRequireReflection = false;
|
||||
|
@ -185,7 +185,7 @@ class cAudioManager
|
||||
{
|
||||
public:
|
||||
bool m_bIsInitialised;
|
||||
uint8 field_1; // unused
|
||||
bool m_bReverb; // unused
|
||||
bool m_bFifthFrameFlag;
|
||||
uint8 m_nActiveSamples;
|
||||
uint8 field_4; // unused
|
||||
|
@ -13,8 +13,9 @@
|
||||
#include "World.h"
|
||||
#include "Zones.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;
|
||||
|
||||
struct tPoliceRadioZone {
|
||||
@ -160,7 +161,7 @@ cAudioManager::ServicePoliceRadio()
|
||||
if(CReplay::IsPlayingBack() || !FindPlayerPed() || !FindPlayerPed()->m_pWanted)
|
||||
return;
|
||||
#endif
|
||||
wantedLevel = FindPlayerPed()->m_pWanted->m_nWantedLevel;
|
||||
wantedLevel = FindPlayerPed()->m_pWanted->GetWantedLevel();
|
||||
if(!crimeReport) {
|
||||
if(wantedLevel != 0) {
|
||||
if(nLastSeen != 0) {
|
||||
@ -678,7 +679,7 @@ void
|
||||
cAudioManager::ReportCrime(eCrimeType type, const CVector &pos)
|
||||
{
|
||||
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]) {
|
||||
for (int32 i = 0; i < ARRAY_SIZE(m_sPoliceRadioQueue.crimes); i++) {
|
||||
if (m_sPoliceRadioQueue.crimes[i].type) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Wanted.h"
|
||||
#include "Crime.h"
|
||||
|
||||
struct cAMCrime {
|
||||
int32 type;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,7 @@
|
||||
#ifdef AUDIO_OAL
|
||||
#include <AL/al.h>
|
||||
|
||||
#define NUM_STREAMBUFFERS 4
|
||||
#define NUM_STREAMBUFFERS 8
|
||||
|
||||
class IDecoder
|
||||
{
|
||||
@ -57,7 +57,7 @@ public:
|
||||
class CStream
|
||||
{
|
||||
char m_aFilename[128];
|
||||
ALuint &m_alSource;
|
||||
ALuint *m_pAlSources;
|
||||
ALuint (&m_alBuffers)[NUM_STREAMBUFFERS];
|
||||
|
||||
bool m_bPaused;
|
||||
@ -73,20 +73,20 @@ class CStream
|
||||
IDecoder *m_pSoundFile;
|
||||
|
||||
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 SetGain(float gain);
|
||||
void Pause();
|
||||
void SetPlay(bool state);
|
||||
|
||||
bool FillBuffer(ALuint alBuffer);
|
||||
bool FillBuffer(ALuint *alBuffer);
|
||||
int32 FillBuffers();
|
||||
void ClearBuffers();
|
||||
public:
|
||||
static void Initialise();
|
||||
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();
|
||||
void Delete();
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "AudioSamples.h"
|
||||
|
||||
#define MAX_VOLUME 127
|
||||
@ -222,7 +221,7 @@ extern uint32 BankStartOffset[MAX_SFX_BANKS];
|
||||
extern int defaultProvider;
|
||||
#endif
|
||||
|
||||
#ifdef AUDIO_OPUS
|
||||
#if defined(OPUS_AUDIO_PATHS)
|
||||
static char StreamedNameTable[][25] = {
|
||||
"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",
|
||||
@ -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\\t3_b.OPUS", "AUDIO\\t3_c.OPUS", "AUDIO\\k1_b.OPUS", "AUDIO\\cat1.OPUS"};
|
||||
#else
|
||||
#if defined(PS2_AUDIO_PATHS)
|
||||
static char StreamedNameTable[][25]=
|
||||
{
|
||||
#ifdef PS2_AUDIO
|
||||
"AUDIO\\MUSIC\\HEAD.VB",
|
||||
"AUDIO\\MUSIC\\CLASS.VB",
|
||||
"AUDIO\\MUSIC\\KJAH.VB",
|
||||
@ -357,6 +356,8 @@ static char StreamedNameTable[][25]=
|
||||
"AUDIO\\MUSIC\\MISCOM.VB",
|
||||
"AUDIO\\MUSIC\\END.VB",
|
||||
#else
|
||||
static char StreamedNameTable[][25] =
|
||||
{
|
||||
"AUDIO\\HEAD.WAV",
|
||||
"AUDIO\\CLASS.WAV",
|
||||
"AUDIO\\KJAH.WAV",
|
||||
|
@ -1,8 +1,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#ifdef AUDIO_MSS
|
||||
#include <windows.h>
|
||||
#include <shobjidl.h>
|
||||
#include <shlobj.h>
|
||||
#include <shlguid.h>
|
||||
|
||||
#include <time.h>
|
||||
|
@ -1,17 +1,11 @@
|
||||
//#define JUICY_OAL
|
||||
|
||||
#ifdef AUDIO_OAL
|
||||
#include "sampman.h"
|
||||
|
||||
#include <time.h>
|
||||
|
||||
#include "eax.h"
|
||||
#include "eax-util.h"
|
||||
|
||||
#define WITHWINDOWS
|
||||
#include "common.h"
|
||||
#include "crossplatform.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <io.h>
|
||||
#include <AL/al.h>
|
||||
@ -19,8 +13,22 @@
|
||||
#include <AL/alext.h>
|
||||
#include <AL/efx.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
|
||||
|
||||
#include "common.h"
|
||||
#include "crossplatform.h"
|
||||
|
||||
#include "sampman.h"
|
||||
|
||||
#include "oal/oal_utils.h"
|
||||
#include "oal/aldlist.h"
|
||||
#include "oal/channel.h"
|
||||
@ -30,7 +38,7 @@
|
||||
#include "MusicManager.h"
|
||||
#include "Frontend.h"
|
||||
#include "Timer.h"
|
||||
#ifdef AUDIO_OPUS
|
||||
#ifdef AUDIO_OAL_USE_OPUS
|
||||
#include <opusfile.h>
|
||||
#endif
|
||||
|
||||
@ -85,7 +93,7 @@ char SampleBankDescFilename[] = "audio/sfx.SDT";
|
||||
char SampleBankDataFilename[] = "audio/sfx.RAW";
|
||||
|
||||
FILE *fpSampleDescHandle;
|
||||
#ifdef AUDIO_OPUS
|
||||
#ifdef OPUS_SFX
|
||||
OggOpusFile *fpSampleDataHandle;
|
||||
#else
|
||||
FILE *fpSampleDataHandle;
|
||||
@ -104,7 +112,7 @@ CChannel aChannel[MAXCHANNELS+MAX2DCHANNELS];
|
||||
uint8 nChannelVolume[MAXCHANNELS+MAX2DCHANNELS];
|
||||
|
||||
uint32 nStreamLength[TOTAL_STREAMED_SOUNDS];
|
||||
ALuint ALStreamSources[MAX_STREAMS];
|
||||
ALuint ALStreamSources[MAX_STREAMS][2];
|
||||
ALuint ALStreamBuffers[MAX_STREAMS][NUM_STREAMBUFFERS];
|
||||
|
||||
struct tMP3Entry
|
||||
@ -247,9 +255,9 @@ release_existing()
|
||||
if (stream)
|
||||
stream->ProviderTerm();
|
||||
|
||||
alDeleteSources(1, &ALStreamSources[i]);
|
||||
alDeleteBuffers(NUM_STREAMBUFFERS, ALStreamBuffers[i]);
|
||||
}
|
||||
alDeleteSources(MAX_STREAMS*2, ALStreamSources[0]);
|
||||
|
||||
CChannel::DestroyChannels();
|
||||
|
||||
@ -292,7 +300,10 @@ set_new_provider(int index)
|
||||
//TODO:
|
||||
_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);
|
||||
ASSERT(ALDevice != NULL);
|
||||
@ -327,10 +338,16 @@ set_new_provider(int index)
|
||||
}
|
||||
#endif
|
||||
|
||||
alGenSources(MAX_STREAMS*2, ALStreamSources[0]);
|
||||
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];
|
||||
if (stream)
|
||||
@ -393,6 +410,12 @@ set_new_provider(int index)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool
|
||||
IsThisTrackAt16KHz(uint32 track)
|
||||
{
|
||||
return track == STREAMED_SOUND_RADIO_CHAT;
|
||||
}
|
||||
|
||||
cSampleManager::cSampleManager(void)
|
||||
{
|
||||
;
|
||||
@ -967,33 +990,37 @@ cSampleManager::Initialise(void)
|
||||
#ifdef AUDIO_CACHE
|
||||
FILE *cacheFile = fcaseopen("audio\\sound.cache", "rb");
|
||||
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);
|
||||
fclose(cacheFile);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
||||
for ( int32 i = 0; i < TOTAL_STREAMED_SOUNDS; i++ )
|
||||
{
|
||||
aStream[0] = new CStream(StreamedNameTable[i], ALStreamSources[0], ALStreamBuffers[0]);
|
||||
|
||||
if ( aStream[0] && aStream[0]->IsOpened() )
|
||||
{
|
||||
debug("Cannot load audio cache\n");
|
||||
#endif
|
||||
|
||||
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()) {
|
||||
uint32 tatalms = aStream[0]->GetLengthMS();
|
||||
delete aStream[0];
|
||||
aStream[0] = NULL;
|
||||
|
||||
|
||||
nStreamLength[i] = tatalms;
|
||||
}
|
||||
else
|
||||
} else
|
||||
USERERROR("Can't open '%s'\n", StreamedNameTable[i]);
|
||||
}
|
||||
#ifdef AUDIO_CACHE
|
||||
cacheFile = fcaseopen("audio\\sound.cache", "wb");
|
||||
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
#endif
|
||||
if(cacheFile) {
|
||||
debug("Saving audio cache\n");
|
||||
fwrite(nStreamLength, sizeof(uint32), TOTAL_STREAMED_SOUNDS, cacheFile);
|
||||
fclose(cacheFile);
|
||||
} else {
|
||||
debug("Cannot save audio cache\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
{
|
||||
if ( !InitialiseSampleBanks() )
|
||||
@ -1210,7 +1237,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef AUDIO_OPUS
|
||||
#ifdef OPUS_SFX
|
||||
int samplesRead = 0;
|
||||
int samplesSize = nSampleBankSize[nBank] / 2;
|
||||
op_pcm_seek(fpSampleDataHandle, 0);
|
||||
@ -1323,7 +1350,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef AUDIO_OPUS
|
||||
#ifdef OPUS_SFX
|
||||
int samplesRead = 0;
|
||||
int samplesSize = m_aSamples[nComment].nSize / 2;
|
||||
op_pcm_seek(fpSampleDataHandle, m_aSamples[nComment].nOffset / 2);
|
||||
@ -1659,7 +1686,7 @@ cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
|
||||
|
||||
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);
|
||||
|
||||
aStream[nStream] = stream;
|
||||
@ -1734,7 +1761,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
||||
nFile = 0;
|
||||
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);
|
||||
|
||||
aStream[nStream] = stream;
|
||||
@ -1758,12 +1785,12 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
||||
}
|
||||
|
||||
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 {
|
||||
strcpy(filename, _mp3DirectoryPath);
|
||||
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()) {
|
||||
@ -1790,7 +1817,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
||||
{
|
||||
nFile = 0;
|
||||
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);
|
||||
|
||||
aStream[nStream] = stream;
|
||||
@ -1814,7 +1841,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
||||
}
|
||||
|
||||
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 {
|
||||
strcpy(filename, _mp3DirectoryPath);
|
||||
strcat(filename, e->aFilename);
|
||||
@ -1847,7 +1874,7 @@ cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
|
||||
|
||||
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);
|
||||
|
||||
aStream[nStream] = stream;
|
||||
@ -1970,7 +1997,7 @@ cSampleManager::InitialiseSampleBanks(void)
|
||||
fpSampleDescHandle = fcaseopen(SampleBankDescFilename, "rb");
|
||||
if ( fpSampleDescHandle == NULL )
|
||||
return false;
|
||||
#ifndef AUDIO_OPUS
|
||||
#ifndef OPUS_SFX
|
||||
fpSampleDataHandle = fcaseopen(SampleBankDataFilename, "rb");
|
||||
if ( fpSampleDataHandle == NULL )
|
||||
{
|
||||
@ -2000,6 +2027,7 @@ cSampleManager::InitialiseSampleBanks(void)
|
||||
}
|
||||
#endif
|
||||
#ifdef AUDIO_OPUS
|
||||
#ifdef OPUS_SFX
|
||||
int32 _nSampleDataEndOffset = m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nOffset + m_aSamples[TOTAL_AUDIO_SAMPLES - 1].nSize;
|
||||
#endif
|
||||
fclose(fpSampleDescHandle);
|
||||
|
@ -2245,12 +2245,12 @@ CCollision::DistToLine(const CVector *l0, const CVector *l1, const CVector *poin
|
||||
float dot = DotProduct(*point - *l0, *l1 - *l0);
|
||||
// Between 0 and len we're above the line.
|
||||
// if not, calculate distance to endpoint
|
||||
if(dot <= 0.0f)
|
||||
return (*point - *l0).Magnitude();
|
||||
if(dot >= lensq)
|
||||
return (*point - *l1).Magnitude();
|
||||
if(dot <= 0.0f) return (*point - *l0).Magnitude();
|
||||
if(dot >= lensq) return (*point - *l1).Magnitude();
|
||||
// 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
|
||||
@ -2733,4 +2733,4 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
|
||||
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
|
||||
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "common.h"
|
||||
|
||||
#include "TempColModels.h"
|
||||
#include "Game.h"
|
||||
|
||||
CColModel CTempColModels::ms_colModelPed1;
|
||||
CColModel CTempColModels::ms_colModelPed2;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Collision.h"
|
||||
#include "ColModel.h"
|
||||
|
||||
class CTempColModels
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
pVehicle->m_bSirenOrAlarm = true;
|
||||
}
|
||||
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);
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||
@ -110,7 +110,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
TellOccupantsToLeaveCar(pVehicle);
|
||||
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
|
||||
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
|
||||
pVehicle->m_bSirenOrAlarm = false;
|
||||
}
|
||||
}
|
||||
@ -121,7 +121,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
pVehicle->m_nCarHornTimer = 0;
|
||||
}
|
||||
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);
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||
@ -141,7 +141,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
pVehicle->m_bSirenOrAlarm = true;
|
||||
}
|
||||
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);
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||
@ -169,7 +169,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
TellOccupantsToLeaveCar(pVehicle);
|
||||
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
|
||||
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
|
||||
pVehicle->m_bSirenOrAlarm = false;
|
||||
}
|
||||
}
|
||||
@ -179,7 +179,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
pVehicle->m_nCarHornTimer = 0;
|
||||
}
|
||||
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);
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
|
||||
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;
|
||||
@ -283,7 +283,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
(FindPlayerVehicle() == pVehicle->AutoPilot.m_pTargetCar &&
|
||||
#endif
|
||||
(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
|
||||
)
|
||||
#endif
|
||||
@ -337,7 +337,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
}
|
||||
break;
|
||||
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 ||
|
||||
ABS(FindPlayerCoors().y - pVehicle->GetPosition().y) > 10.0f){
|
||||
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
|
||||
@ -351,7 +351,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
|
||||
TellOccupantsToLeaveCar(pVehicle);
|
||||
pVehicle->AutoPilot.m_nCruiseSpeed = 0;
|
||||
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
|
||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel <= 1)
|
||||
if (FindPlayerPed()->m_pWanted->GetWantedLevel() <= 1)
|
||||
pVehicle->m_bSirenOrAlarm = false;
|
||||
}
|
||||
}
|
||||
@ -486,7 +486,7 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
|
||||
case MI_RHINO:
|
||||
case MI_BARRACKS:
|
||||
pVehicle->SetUpDriver();
|
||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 1)
|
||||
if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 1)
|
||||
pVehicle->SetupPassenger(0);
|
||||
return;
|
||||
default:
|
||||
@ -541,7 +541,7 @@ void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
|
||||
|
||||
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 1: return 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)
|
||||
{
|
||||
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 1: return 25;
|
||||
case 2: return 34;
|
||||
@ -569,7 +569,7 @@ int32 CCarAI::FindPoliceCarSpeedForWantedLevel(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();
|
||||
if (FindPlayerVehicle()){
|
||||
if (distanceToPlayer < 10.0f)
|
||||
@ -586,7 +586,7 @@ void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
|
||||
else
|
||||
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();
|
||||
if (FindPlayerVehicle()) {
|
||||
if (distanceToPlayer < 10.0f)
|
||||
|
@ -124,18 +124,18 @@ CCarCtrl::GenerateOneRandomCar()
|
||||
CWanted* pWanted = pPlayer->m_pPed->m_pWanted;
|
||||
int carClass;
|
||||
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_nWantedLevel > 3 ||
|
||||
pWanted->m_nWantedLevel > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 ||
|
||||
pWanted->m_nWantedLevel > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) {
|
||||
/* Last pWanted->m_nWantedLevel > 1 is unnecessary but I added it for better readability. */
|
||||
pWanted->GetWantedLevel() > 3 ||
|
||||
pWanted->GetWantedLevel() > 2 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 5000 ||
|
||||
pWanted->GetWantedLevel() > 1 && CTimer::GetTimeInMilliseconds() > LastTimeLawEnforcerCreated + 8000)) {
|
||||
/* 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. */
|
||||
carClass = COPS;
|
||||
carModel = ChoosePoliceCarModel();
|
||||
}else{
|
||||
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. */
|
||||
/* In particular it means that cop cars never spawn if player has wanted level of 1. */
|
||||
return;
|
||||
@ -267,7 +267,7 @@ CCarCtrl::GenerateOneRandomCar()
|
||||
}
|
||||
if (!ThePaths.NewGenerateCarCreationCoors(vecTargetPos.x, vecTargetPos.y, frontX, frontY,
|
||||
preferredDistance, angleLimit, invertAngleLimitTest, &spawnPosition, &curNodeId, &nextNodeId,
|
||||
&positionBetweenNodes, carClass == COPS && pWanted->m_nWantedLevel >= 1))
|
||||
&positionBetweenNodes, carClass == COPS && pWanted->GetWantedLevel() >= 1))
|
||||
return;
|
||||
int16 colliding;
|
||||
CWorld::FindObjectsKindaColliding(spawnPosition, 10.0f, true, &colliding, 2, nil, false, true, true, false, false);
|
||||
@ -331,7 +331,7 @@ CCarCtrl::GenerateOneRandomCar()
|
||||
}
|
||||
case COPS:
|
||||
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_fMaxTrafficSpeed = pVehicle->AutoPilot.m_nCruiseSpeed / 2;
|
||||
pVehicle->AutoPilot.m_nCarMission = CCarAI::FindPoliceCarMissionForWantedLevel();
|
||||
@ -2415,7 +2415,7 @@ void CCarCtrl::SteerAICarWithPhysicsHeadingForTarget(CVehicle* pVehicle, CPhysic
|
||||
*pHandbrake = true;
|
||||
float maxAngle = FindMaxSteerAngle(pVehicle);
|
||||
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);
|
||||
float speedTarget = pVehicle->AutoPilot.m_nCruiseSpeed * speedMultiplier;
|
||||
float currentSpeed = pVehicle->GetMoveSpeed().Magnitude() * GAME_SPEED_TO_CARAI_SPEED;
|
||||
@ -2654,7 +2654,7 @@ void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
|
||||
|
||||
void CCarCtrl::GenerateEmergencyServicesCar(void)
|
||||
{
|
||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel > 3)
|
||||
if (FindPlayerPed()->m_pWanted->GetWantedLevel() > 3)
|
||||
return;
|
||||
if (NumFiretrucksOnDuty + NumAmbulancesOnDuty + NumParkedCars + NumMissionCars +
|
||||
NumLawEnforcerCars + NumRandomCars > MaxNumberOfCarsInUse)
|
||||
|
@ -126,7 +126,7 @@ CDarkel::DrawMessages()
|
||||
#if defined(PS2_HUD) || defined(FIX_BUGS)
|
||||
#ifdef FIX_BUGS
|
||||
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);
|
||||
#endif
|
||||
#else
|
||||
|
@ -159,7 +159,7 @@ CGameLogic::Update()
|
||||
pPlayerInfo.m_WBState = WBSTATE_PLAYING;
|
||||
int takeMoney;
|
||||
|
||||
switch (pPlayerInfo.m_pPed->m_pWanted->m_nWantedLevel) {
|
||||
switch (pPlayerInfo.m_pPed->m_pWanted->GetWantedLevel()) {
|
||||
case 0:
|
||||
case 1:
|
||||
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 }
|
||||
};
|
||||
|
||||
const int32 gaCarsToCollectIn60Seconds[] = { MI_CHEETAH, MI_TAXI, MI_ESPERANT, MI_SENTINEL, MI_IDAHO };
|
||||
|
||||
int32 CGarages::BankVansCollected;
|
||||
bool CGarages::BombsAreFree;
|
||||
bool CGarages::RespraysAreFree;
|
||||
@ -387,7 +389,7 @@ void CGarage::Update()
|
||||
m_eGarageState = GS_OPENING;
|
||||
DMAudio.PlayFrontEndSound(SOUND_GARAGE_OPENING, 1);
|
||||
bool bTakeMoney = false;
|
||||
if (FindPlayerPed()->m_pWanted->m_nWantedLevel != 0)
|
||||
if (FindPlayerPed()->m_pWanted->GetWantedLevel() != 0)
|
||||
bTakeMoney = true;
|
||||
FindPlayerPed()->m_pWanted->Reset();
|
||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_GARAGE);
|
||||
@ -1539,7 +1541,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
|
||||
m_bRecreateDoorOnNextRefresh = false;
|
||||
if (m_pDoor1) {
|
||||
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;
|
||||
else {
|
||||
if (m_bDoor1PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor1) & 0x7F))
|
||||
@ -1549,7 +1551,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
|
||||
}
|
||||
}
|
||||
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;
|
||||
else {
|
||||
if (m_bDoor1PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor1) & 0x7F))
|
||||
@ -1561,7 +1563,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
|
||||
}
|
||||
if (m_pDoor2) {
|
||||
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;
|
||||
else {
|
||||
if (m_bDoor2PoolIndex != (CPools::GetDummyPool()->GetIndex((CDummy*)m_pDoor2) & 0x7F))
|
||||
@ -1571,7 +1573,7 @@ void CGarage::RefreshDoorPointers(bool bCreate)
|
||||
}
|
||||
}
|
||||
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;
|
||||
else {
|
||||
if (m_bDoor2PoolIndex != (CPools::GetObjectPool()->GetIndex((CObject*)m_pDoor2) & 0x7F))
|
||||
@ -2424,3 +2426,41 @@ CGarages::IsModelIndexADoor(uint32 id)
|
||||
id == MI_CRUSHERBODY ||
|
||||
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
|
||||
#include "Automobile.h"
|
||||
#include "audio_enums.h"
|
||||
#include "Camera.h"
|
||||
#include "config.h"
|
||||
#include "Lists.h"
|
||||
|
||||
class CVehicle;
|
||||
class CCamera;
|
||||
|
||||
enum eGarageState
|
||||
{
|
||||
@ -81,6 +80,7 @@ VALIDATE_SIZE(CStoredCar, 0x28);
|
||||
|
||||
class CGarage
|
||||
{
|
||||
public:
|
||||
uint8 m_eGarageType;
|
||||
uint8 m_eGarageState;
|
||||
bool field_2; // unused
|
||||
@ -166,10 +166,11 @@ class CGarage
|
||||
void FindDoorsEntities();
|
||||
void FindDoorsEntitiesSectorList(CPtrList&, bool);
|
||||
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);
|
||||
@ -179,6 +180,7 @@ class CGarages
|
||||
enum {
|
||||
MESSAGE_LENGTH = 8
|
||||
};
|
||||
public:
|
||||
static int32 BankVansCollected;
|
||||
static bool BombsAreFree;
|
||||
static bool RespraysAreFree;
|
||||
@ -200,7 +202,6 @@ class CGarages
|
||||
static CStoredCar aCarsInSafeHouse3[NUM_GARAGE_STORED_CARS];
|
||||
static bool bCamShouldBeOutisde;
|
||||
|
||||
public:
|
||||
static void Init(void);
|
||||
#ifndef PS2
|
||||
static void Shutdown(void);
|
||||
@ -239,8 +240,8 @@ public:
|
||||
static bool IsModelIndexADoor(uint32 id);
|
||||
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
|
||||
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
|
||||
static void StopCarFromBlowingUp(CAutomobile*);
|
||||
|
||||
private:
|
||||
static bool IsCarSprayable(CVehicle*);
|
||||
static float FindDoorHeightForMI(int32);
|
||||
static void CloseHideOutGaragesBeforeSave(void);
|
||||
@ -249,9 +250,4 @@ private:
|
||||
static int32 GetBombTypeForGarageType(uint8 type) { return type - GARAGE_BOMBSHOP1 + 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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
@ -129,7 +129,7 @@ CPickup::CanBePickedUp(CPlayerPed *player)
|
||||
bool cannotBePickedUp =
|
||||
(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_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));
|
||||
return !cannotBePickedUp;
|
||||
}
|
||||
@ -456,7 +456,7 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
|
||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
|
||||
return true;
|
||||
} 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;
|
||||
player->SetWantedLevel(level);
|
||||
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
|
||||
class CPacManPickups
|
||||
{
|
||||
friend CPacManPickup;
|
||||
friend class CPacManPickup;
|
||||
|
||||
static CPacManPickup aPMPickUps[NUMPACMANPICKUPS];
|
||||
static CVector LastPickUpCoors;
|
||||
|
@ -305,7 +305,7 @@ void CReplay::RecordThisFrame(void)
|
||||
#endif
|
||||
tGeneralPacket* general = (tGeneralPacket*)&Record.m_pBase[Record.m_nOffset];
|
||||
general->type = REPLAYPACKET_GENERAL;
|
||||
general->camera_pos.CopyOnlyMatrix(&TheCamera.GetMatrix());
|
||||
general->camera_pos.CopyOnlyMatrix(TheCamera.GetMatrix());
|
||||
general->player_pos = FindPlayerCoors();
|
||||
general->in_rcvehicle = CWorld::Players[CWorld::PlayerInFocus].m_pRemoteVehicle ? true : false;
|
||||
Record.m_nOffset += sizeof(*general);
|
||||
@ -1457,7 +1457,7 @@ void CReplay::SaveReplayToHD(void)
|
||||
CFileMgr::SetDir("");
|
||||
}
|
||||
|
||||
void PlayReplayFromHD(void)
|
||||
void CReplay::PlayReplayFromHD(void)
|
||||
{
|
||||
CFileMgr::SetDirMyDocuments();
|
||||
int fr = CFileMgr::OpenFile("replay.rep", "rb");
|
||||
@ -1476,17 +1476,17 @@ void PlayReplayFromHD(void)
|
||||
return;
|
||||
}
|
||||
int slot;
|
||||
for (slot = 0; CFileMgr::Read(fr, (char*)CReplay::Buffers[slot], sizeof(CReplay::Buffers[slot])); slot++)
|
||||
CReplay::BufferStatus[slot] = CReplay::REPLAYBUFFER_PLAYBACK;
|
||||
CReplay::BufferStatus[slot - 1] = CReplay::REPLAYBUFFER_RECORD;
|
||||
while (slot < CReplay::NUM_REPLAYBUFFERS)
|
||||
CReplay::BufferStatus[slot++] = CReplay::REPLAYBUFFER_UNUSED;
|
||||
for (slot = 0; CFileMgr::Read(fr, (char*)Buffers[slot], sizeof(Buffers[slot])); slot++)
|
||||
BufferStatus[slot] = REPLAYBUFFER_PLAYBACK;
|
||||
BufferStatus[slot - 1] = REPLAYBUFFER_RECORD;
|
||||
while (slot < NUM_REPLAYBUFFERS)
|
||||
BufferStatus[slot++] = REPLAYBUFFER_UNUSED;
|
||||
CFileMgr::CloseFile(fr);
|
||||
CFileMgr::SetDir("");
|
||||
CReplay::TriggerPlayback(CReplay::REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false);
|
||||
CReplay::bPlayingBackFromFile = true;
|
||||
CReplay::bAllowLookAroundCam = true;
|
||||
CReplay::StreamAllNecessaryCarsAndPeds();
|
||||
TriggerPlayback(REPLAYCAMMODE_ASSTORED, 0.0f, 0.0f, 0.0f, false);
|
||||
bPlayingBackFromFile = true;
|
||||
bAllowLookAroundCam = true;
|
||||
StreamAllNecessaryCarsAndPeds();
|
||||
}
|
||||
|
||||
void CReplay::StreamAllNecessaryCarsAndPeds(void)
|
||||
|
@ -61,8 +61,6 @@ struct CStoredDetailedAnimationState
|
||||
uint16 aFlags2[NUM_PARTIAL_ANIMS_IN_REPLAY];
|
||||
};
|
||||
|
||||
void PlayReplayFromHD(void);
|
||||
|
||||
#ifdef GTA_REPLAY
|
||||
#define REPLAY_STUB
|
||||
#else
|
||||
@ -323,11 +321,9 @@ private:
|
||||
static void EmptyAllPools(void);
|
||||
static void MarkEverythingAsNew(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 ProcessLookAroundCam(void);
|
||||
static size_t FindSizeOfPacket(uint8);
|
||||
|
||||
/* Absolute nonsense, but how could this function end up being outside of class? */
|
||||
friend void PlayReplayFromHD(void);
|
||||
#endif
|
||||
};
|
||||
|
@ -46,8 +46,8 @@ CRoadBlocks::Init(void)
|
||||
void
|
||||
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},
|
||||
{1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} };
|
||||
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),
|
||||
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();
|
||||
if (!pEntityToAttack)
|
||||
pEntityToAttack = (CEntity*)FindPlayerPed();
|
||||
|
@ -329,7 +329,7 @@ void CSceneEdit::Draw(void)
|
||||
#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);
|
||||
#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
|
||||
if (nCommandDrawn == m_nCurrentCommand)
|
||||
CFont::SetColor(CRGBA(156, 91, 40, 255));
|
||||
@ -338,7 +338,7 @@ void CSceneEdit::Draw(void)
|
||||
#ifdef FIX_BUGS
|
||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(COMMAND_NAME_X_RIGHT), SCREEN_SCALE_Y(COMMAND_NAME_Y + i * COMMAND_NAME_HEIGHT), wstr);
|
||||
#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
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ uint16 CTheScripts::NumScriptDebugLines;
|
||||
uint16 CTheScripts::NumberOfIntroRectanglesThisFrame;
|
||||
uint16 CTheScripts::NumberOfIntroTextLinesThisFrame;
|
||||
uint8 CTheScripts::UseTextCommands;
|
||||
CMissionCleanup CTheScripts::MissionCleanup;
|
||||
CMissionCleanup CTheScripts::MissionCleanUp;
|
||||
CUpsideDownCarCheck CTheScripts::UpsideDownCars;
|
||||
CStuckCarCheck CTheScripts::StuckCars;
|
||||
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_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_LVAR_INT_TO_LVAR_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_INT_TO_VAR_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_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_LVAR_INT_TO_VAR_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_INT_TO_LVAR_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_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_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_LOAD_END_OF_GAME_TUNE, 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_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, ""),
|
||||
@ -1340,7 +1340,7 @@ void CMissionCleanup::Init()
|
||||
}
|
||||
}
|
||||
|
||||
CMissionCleanupEntity* CMissionCleanup::FindFree()
|
||||
cleanup_entity_struct* CMissionCleanup::FindFree()
|
||||
{
|
||||
for (int i = 0; i < MAX_CLEANUP; i++){
|
||||
if (m_sEntities[i].type == CLEANUP_UNUSED)
|
||||
@ -1352,7 +1352,7 @@ CMissionCleanupEntity* CMissionCleanup::FindFree()
|
||||
|
||||
void CMissionCleanup::AddEntityToList(int32 id, uint8 type)
|
||||
{
|
||||
CMissionCleanupEntity* pNew = FindFree();
|
||||
cleanup_entity_struct* pNew = FindFree();
|
||||
if (!pNew)
|
||||
return;
|
||||
pNew->id = id;
|
||||
@ -1444,10 +1444,16 @@ void CUpsideDownCarCheck::Init()
|
||||
|
||||
bool CUpsideDownCarCheck::IsCarUpsideDown(int32 id)
|
||||
{
|
||||
CVehicle* v = CPools::GetVehiclePool()->GetAt(id);
|
||||
return v->GetUp().z <= -0.97f &&
|
||||
v->GetMoveSpeed().Magnitude() < 0.01f &&
|
||||
v->GetTurnSpeed().Magnitude() < 0.02f;
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(id);
|
||||
return IsCarUpsideDown(pVehicle);
|
||||
}
|
||||
|
||||
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()
|
||||
@ -1470,7 +1476,7 @@ void CUpsideDownCarCheck::UpdateTimers()
|
||||
bool CUpsideDownCarCheck::AreAnyCarsUpsideDown()
|
||||
{
|
||||
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 false;
|
||||
@ -1481,8 +1487,10 @@ void CUpsideDownCarCheck::AddCarToCheck(int32 id)
|
||||
uint16 index = 0;
|
||||
while (index < MAX_UPSIDEDOWN_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
|
||||
index++;
|
||||
#ifdef FIX_BUGS
|
||||
if (index >= MAX_UPSIDEDOWN_CAR_CHECKS)
|
||||
return;
|
||||
#endif
|
||||
m_sCars[index].m_nVehicleIndex = id;
|
||||
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++){
|
||||
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;
|
||||
}
|
||||
@ -1551,7 +1559,10 @@ void CStuckCarCheck::AddCarToCheck(int32 id, float radius, uint32 time)
|
||||
int index = 0;
|
||||
while (index < MAX_STUCK_CAR_CHECKS && m_sCars[index].m_nVehicleIndex >= 0)
|
||||
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_vecPos = pv->GetPosition();
|
||||
m_sCars[index].m_nLastCheck = CTimer::GetTimeInMilliseconds();
|
||||
@ -1807,7 +1818,7 @@ void CTheScripts::Init()
|
||||
ScriptsArray[i].Init();
|
||||
ScriptsArray[i].AddScriptToList(&pIdleScripts);
|
||||
}
|
||||
MissionCleanup.Init();
|
||||
MissionCleanUp.Init();
|
||||
UpsideDownCars.Init();
|
||||
StuckCars.Init();
|
||||
CFileMgr::SetDir("data");
|
||||
@ -2069,7 +2080,9 @@ int8 CRunningScript::ProcessOneCommand()
|
||||
uint32 ip = m_nIp;
|
||||
if (command < ARRAY_SIZE(commands)) {
|
||||
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);
|
||||
m_nIp += 2;
|
||||
if (m_bNotFlag)
|
||||
strcat(commandInfo, "NOT ");
|
||||
if (commands[command].position == -1)
|
||||
@ -2119,7 +2132,7 @@ int8 CRunningScript::ProcessOneCommand()
|
||||
retval = ProcessCommands800To899(command);
|
||||
else if (command < 1000)
|
||||
retval = ProcessCommands900To999(command);
|
||||
#ifdef GTA_PS2
|
||||
#if GTA_VERSION <= GTA3_PS2_160
|
||||
else if (command < 1200)
|
||||
retval = ProcessCommands1000To1099(command);
|
||||
#else
|
||||
@ -3355,7 +3368,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DELETE_CHAR:
|
||||
@ -3381,7 +3394,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||
--CPopulation::ms_nTotalMissionPeds;
|
||||
}
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CHAR_WANDER_DIR:
|
||||
@ -3600,7 +3613,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||
ScriptParams[0] = handle;
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DELETE_CAR:
|
||||
@ -3613,7 +3626,7 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||
delete car;
|
||||
}
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CAR_GOTO_COORDINATES:
|
||||
@ -3731,9 +3744,9 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
|
||||
car->AutoPilot.m_nCruiseSpeed = *(float*)&ScriptParams[1];
|
||||
if (missionRetryScriptIndex == 40 && car->GetModelIndex() == MI_CHEETAH) // Turismo
|
||||
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
|
||||
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
|
||||
return 0;
|
||||
}
|
||||
@ -3930,7 +3943,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
return 0;
|
||||
if (strcmp(m_abScriptName, "love3") == 0) /* A Drop in the Ocean */
|
||||
CPickups::RemoveAllFloatingPickups();
|
||||
CTheScripts::MissionCleanup.Process();
|
||||
CTheScripts::MissionCleanUp.Process();
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_STORE_CAR_CHAR_IS_IN:
|
||||
@ -3953,7 +3966,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
pOld->bIsLocked = false;
|
||||
CCarCtrl::NumRandomCars++;
|
||||
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::NumRandomCars--;
|
||||
CTheScripts::StoreVehicleWasRandom = true;
|
||||
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||
break;
|
||||
case PARKED_VEHICLE:
|
||||
pCurrent->VehicleCreatedBy = MISSION_VEHICLE;
|
||||
CCarCtrl::NumMissionCars++;
|
||||
CCarCtrl::NumParkedCars--;
|
||||
CTheScripts::StoreVehicleWasRandom = true;
|
||||
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||
break;
|
||||
case MISSION_VEHICLE:
|
||||
case PERMANENT_VEHICLE:
|
||||
@ -4004,7 +4017,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
pOld->bIsLocked = false;
|
||||
CCarCtrl::NumRandomCars++;
|
||||
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::NumRandomCars--;
|
||||
CTheScripts::StoreVehicleWasRandom = true;
|
||||
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||
break;
|
||||
case PARKED_VEHICLE:
|
||||
pCurrent->VehicleCreatedBy = MISSION_VEHICLE;
|
||||
CCarCtrl::NumMissionCars++;
|
||||
CCarCtrl::NumParkedCars--;
|
||||
CTheScripts::StoreVehicleWasRandom = true;
|
||||
CTheScripts::MissionCleanup.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(CTheScripts::StoreVehicleIndex, CLEANUP_CAR);
|
||||
break;
|
||||
case MISSION_VEHICLE:
|
||||
case PERMANENT_VEHICLE:
|
||||
@ -4173,7 +4186,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DELETE_OBJECT:
|
||||
@ -4186,7 +4199,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
delete pObj;
|
||||
}
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_ADD_SCORE:
|
||||
@ -4221,7 +4234,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
return 0;
|
||||
case COMMAND_IS_WANTED_LEVEL_GREATER:
|
||||
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;
|
||||
case COMMAND_CLEAR_WANTED_LEVEL:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
@ -4411,7 +4424,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_WARP_PLAYER_FROM_CAR_TO_COORD:
|
||||
@ -4463,81 +4476,6 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
|
||||
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
|
||||
|
||||
bool CRunningScript::CanAllowMissionReplay()
|
||||
@ -4572,7 +4510,7 @@ void RetryMission(int type, int unk)
|
||||
else if (type == 2) {
|
||||
doingMissionRetry = false;
|
||||
AllowMissionReplay = 6;
|
||||
CTheScripts::MissionCleanup.Process();
|
||||
CTheScripts::MissionCleanUp.Process();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
#include "common.h"
|
||||
#include "Ped.h"
|
||||
#include "Font.h"
|
||||
#include "PedType.h"
|
||||
#include "Text.h"
|
||||
#include "Sprite2d.h"
|
||||
@ -19,27 +18,34 @@ extern int32 ScriptParams[32];
|
||||
void FlushLog();
|
||||
#define script_assert(_Expression) FlushLog(); assert(_Expression);
|
||||
|
||||
#define PICKUP_PLACEMENT_OFFSET 0.5f
|
||||
#define PED_FIND_Z_OFFSET 5.0f
|
||||
#define PICKUP_PLACEMENT_OFFSET (0.5f)
|
||||
#define PED_FIND_Z_OFFSET (5.0f)
|
||||
|
||||
#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
|
||||
#define UPSIDEDOWN_UP_THRESHOLD (-0.97f)
|
||||
#define UPSIDEDOWN_MOVE_SPEED_THRESHOLD (0.01f)
|
||||
#define UPSIDEDOWN_TURN_SPEED_THRESHOLD (0.02f)
|
||||
#define UPSIDEDOWN_TIMER_THRESHOLD (1000)
|
||||
|
||||
#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
|
||||
#define METERS_IN_FOOT 0.3048f
|
||||
#define FEET_IN_METER 3.28084f
|
||||
#define MILES_IN_METER (0.000621371192f)
|
||||
#define METERS_IN_FOOT (0.3048f)
|
||||
#define FEET_IN_METER (3.28084f)
|
||||
#else
|
||||
#define METERS_IN_FOOT 0.3f
|
||||
#define FEET_IN_METER 3.33f
|
||||
#define MILES_IN_METER (1 / 1670.f)
|
||||
#define METERS_IN_FOOT (0.3f)
|
||||
#define FEET_IN_METER (3.33f)
|
||||
#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
|
||||
#endif
|
||||
|
||||
@ -94,12 +100,12 @@ struct intro_text_line
|
||||
m_bCentered = false;
|
||||
m_bBackground = false;
|
||||
m_bBackgroundOnly = false;
|
||||
m_fWrapX = 182.0f; /* TODO: scaling as bugfix */
|
||||
m_fCenterSize = 640.0f; /* --||-- */
|
||||
m_fWrapX = 182.0f;
|
||||
m_fCenterSize = DEFAULT_SCREEN_WIDTH;
|
||||
m_sBackgroundColor = CRGBA(128, 128, 128, 128);
|
||||
m_bTextProportional = true;
|
||||
m_bTextBeforeFade = false;
|
||||
m_nFont = 2; /* enum? */
|
||||
m_nFont = FONT_HEADING;
|
||||
m_fAtX = 0.0f;
|
||||
m_fAtY = 0.0f;
|
||||
memset(&m_Text, 0, sizeof(m_Text));
|
||||
@ -134,7 +140,7 @@ enum {
|
||||
CLEANUP_OBJECT
|
||||
};
|
||||
|
||||
struct CMissionCleanupEntity
|
||||
struct cleanup_entity_struct
|
||||
{
|
||||
uint8 type;
|
||||
int32 id;
|
||||
@ -148,20 +154,20 @@ enum {
|
||||
|
||||
class CMissionCleanup
|
||||
{
|
||||
CMissionCleanupEntity m_sEntities[MAX_CLEANUP];
|
||||
public:
|
||||
cleanup_entity_struct m_sEntities[MAX_CLEANUP];
|
||||
uint8 m_nCount;
|
||||
|
||||
public:
|
||||
CMissionCleanup();
|
||||
|
||||
void Init();
|
||||
CMissionCleanupEntity* FindFree();
|
||||
cleanup_entity_struct* FindFree();
|
||||
void AddEntityToList(int32, uint8);
|
||||
void RemoveEntityFromList(int32, uint8);
|
||||
void Process();
|
||||
};
|
||||
|
||||
struct CUpsideDownCarCheckEntry
|
||||
struct upsidedown_car_data
|
||||
{
|
||||
int32 m_nVehicleIndex;
|
||||
uint32 m_nUpsideDownTimer;
|
||||
@ -169,11 +175,12 @@ struct CUpsideDownCarCheckEntry
|
||||
|
||||
class CUpsideDownCarCheck
|
||||
{
|
||||
CUpsideDownCarCheckEntry m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
|
||||
upsidedown_car_data m_sCars[MAX_UPSIDEDOWN_CAR_CHECKS];
|
||||
|
||||
public:
|
||||
void Init();
|
||||
bool IsCarUpsideDown(int32);
|
||||
bool IsCarUpsideDown(CVehicle*);
|
||||
void UpdateTimers();
|
||||
bool AreAnyCarsUpsideDown();
|
||||
void AddCarToCheck(int32);
|
||||
@ -191,7 +198,7 @@ struct stuck_car_data
|
||||
bool m_bStuck;
|
||||
|
||||
stuck_car_data() { }
|
||||
inline void Reset();
|
||||
void Reset();
|
||||
};
|
||||
|
||||
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 {
|
||||
VAR_LOCAL = 1,
|
||||
VAR_GLOBAL = 2,
|
||||
@ -268,6 +425,7 @@ enum {
|
||||
|
||||
class CTheScripts
|
||||
{
|
||||
public:
|
||||
static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
|
||||
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
|
||||
static int32 BaseBriefIdForContact[MAX_NUM_CONTACTS];
|
||||
@ -284,7 +442,7 @@ class CTheScripts
|
||||
static CStoredLine aStoredLines[MAX_NUM_STORED_LINES];
|
||||
static bool DbgFlag;
|
||||
static uint32 OnAMissionFlag;
|
||||
static CMissionCleanup MissionCleanup;
|
||||
static CMissionCleanup MissionCleanUp;
|
||||
static CStuckCarCheck StuckCars;
|
||||
static CUpsideDownCarCheck UpsideDownCars;
|
||||
static int32 StoreVehicleIndex;
|
||||
@ -309,7 +467,6 @@ class CTheScripts
|
||||
static uint16 CommandsExecuted;
|
||||
static uint16 ScriptsUpdated;
|
||||
|
||||
public:
|
||||
static void Init();
|
||||
static void Process();
|
||||
|
||||
@ -366,8 +523,6 @@ public:
|
||||
return Read4BytesFromScript(&tmp);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static CRunningScript* StartNewScript(uint32);
|
||||
|
||||
static void CleanUpThisVehicle(CVehicle*);
|
||||
@ -417,167 +572,12 @@ private:
|
||||
static void SetObjectiveForAllPedsInCollective(int, eObjective);
|
||||
#endif
|
||||
|
||||
friend class CRunningScript;
|
||||
friend class CHud;
|
||||
friend void CMissionCleanup::Process();
|
||||
#ifdef MISSION_REPLAY
|
||||
friend void RetryMission(int, int);
|
||||
#endif
|
||||
|
||||
#ifdef MISSION_SWITCHER
|
||||
public:
|
||||
static void SwitchToMission(int32 mission);
|
||||
#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
|
||||
extern int AllowMissionReplay;
|
||||
extern uint32 WaitForMissionActivate;
|
||||
|
@ -1033,7 +1033,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CPlayerPed* pPed = CWorld::Players[ScriptParams[0]].m_pPed;
|
||||
script_assert(pPed);
|
||||
ScriptParams[0] = pPed->m_pWanted->m_nWantedLevel;
|
||||
ScriptParams[0] = pPed->m_pWanted->GetWantedLevel();
|
||||
StoreParameters(&m_nIp, 1);
|
||||
return 0;
|
||||
}
|
||||
@ -1051,7 +1051,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
||||
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
CTheScripts::CleanUpThisPed(pPed);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_MARK_CAR_AS_NO_LONGER_NEEDED:
|
||||
@ -1060,7 +1060,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
CTheScripts::CleanUpThisVehicle(pVehicle);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_MARK_OBJECT_AS_NO_LONGER_NEEDED:
|
||||
@ -1069,7 +1069,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
||||
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
|
||||
CTheScripts::CleanUpThisObject(pObject);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DONT_REMOVE_CHAR:
|
||||
@ -1077,7 +1077,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
|
||||
script_assert(pPed);
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DONT_REMOVE_CAR:
|
||||
@ -1085,7 +1085,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
script_assert(pVehicle);
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_DONT_REMOVE_OBJECT:
|
||||
@ -1093,7 +1093,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CObject* pObject = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
|
||||
script_assert(pObject);
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_CREATE_CHAR_AS_PASSENGER:
|
||||
@ -1165,7 +1165,7 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
|
||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(pPed);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CHAR_OBJ_KILL_CHAR_ON_FOOT:
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "WaterLevel.h"
|
||||
#include "Weather.h"
|
||||
#include "Zones.h"
|
||||
#include "Wanted.h"
|
||||
|
||||
int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||
{
|
||||
@ -342,7 +343,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CGarages::SetFreeBombs(ScriptParams[0] != 0);
|
||||
return 0;
|
||||
#ifdef GTA_PS2
|
||||
#if GTA_VERSION <= GTA3_PS2_160
|
||||
case COMMAND_SET_POWERPOINT:
|
||||
{
|
||||
CollectParameters(&m_nIp, 7);
|
||||
@ -376,7 +377,7 @@ int8 CRunningScript::ProcessCommands500To599(int32 command)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif // GTA_PS2
|
||||
#endif // GTA_VERSION <= GTA3_PS2_160
|
||||
case COMMAND_SET_ALL_TAXI_LIGHTS:
|
||||
CollectParameters(&m_nIp, 1);
|
||||
CAutomobile::SetAllTaxiLights(ScriptParams[0] != 0);
|
||||
@ -1263,7 +1264,7 @@ int8 CRunningScript::ProcessCommands600To699(int32 command)
|
||||
ScriptParams[0] = CPools::GetObjectPool()->GetIndex(pObj);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_OBJECT);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_IS_BOAT:
|
||||
@ -1799,7 +1800,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
||||
pPed->bRespondsToThreats = false;
|
||||
++CPopulation::ms_nTotalMissionPeds;
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||
}
|
||||
ScriptParams[0] = ped_handle;
|
||||
StoreParameters(&m_nIp, 1);
|
||||
@ -1848,7 +1849,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
|
||||
pPed->bRespondsToThreats = false;
|
||||
++CPopulation::ms_nTotalMissionPeds;
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||
}
|
||||
ScriptParams[0] = ped_handle;
|
||||
StoreParameters(&m_nIp, 1);
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "WaterLevel.h"
|
||||
#include "World.h"
|
||||
#include "Zones.h"
|
||||
#include "Wanted.h"
|
||||
|
||||
int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||
{
|
||||
@ -148,7 +149,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||
++CCarCtrl::NumMissionCars;
|
||||
--CCarCtrl::NumRandomCars;
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
|
||||
}
|
||||
ScriptParams[0] = handle;
|
||||
StoreParameters(&m_nIp, 1);
|
||||
@ -180,7 +181,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||
++CCarCtrl::NumMissionCars;
|
||||
--CCarCtrl::NumRandomCars;
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(handle, CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(handle, CLEANUP_CAR);
|
||||
}
|
||||
ScriptParams[0] = handle;
|
||||
StoreParameters(&m_nIp, 1);
|
||||
@ -594,7 +595,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||
}
|
||||
}
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.RemoveEntityFromList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CHAR_STAY_IN_SAME_PLACE:
|
||||
@ -1002,7 +1003,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
|
||||
ScriptParams[0] = CPools::GetPedPool()->GetIndex(ped);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CHAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_SET_CHAR_OBJ_STEAL_ANY_CAR:
|
||||
@ -1417,7 +1418,7 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
|
||||
CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(ScriptParams[0]);
|
||||
script_assert(pVehicle);
|
||||
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)
|
||||
heading -= TWOPI;
|
||||
pVehicle->SetHeading(heading);
|
||||
|
@ -2075,6 +2075,80 @@ VALIDATESAVEBUF(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)
|
||||
{
|
||||
static CColPoint aTempColPoints[MAX_COLLISION_POINTS];
|
||||
@ -2281,7 +2355,7 @@ int CTheScripts::FindFreeSlotInCollectiveArray()
|
||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, int16 p1, int16 p2)
|
||||
{
|
||||
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);
|
||||
if (pPed == nil) {
|
||||
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)
|
||||
{
|
||||
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);
|
||||
if (pPed == nil) {
|
||||
CollectiveArray[i].colIndex = -1;
|
||||
@ -2315,7 +2389,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, CVector p1)
|
||||
{
|
||||
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);
|
||||
if (pPed == nil) {
|
||||
CollectiveArray[i].colIndex = -1;
|
||||
@ -2332,7 +2406,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective, void* p1)
|
||||
{
|
||||
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);
|
||||
if (pPed == nil) {
|
||||
CollectiveArray[i].colIndex = -1;
|
||||
@ -2349,7 +2423,7 @@ void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective ob
|
||||
void CTheScripts::SetObjectiveForAllPedsInCollective(int colIndex, eObjective objective)
|
||||
{
|
||||
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);
|
||||
if (pPed == nil) {
|
||||
CollectiveArray[i].colIndex = -1;
|
||||
@ -2368,7 +2442,7 @@ bool CTheScripts::IsPedStopped(CPed* pPed)
|
||||
{
|
||||
if (pPed->bInVehicle)
|
||||
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)
|
||||
@ -2381,7 +2455,7 @@ bool CTheScripts::IsPlayerStopped(CPlayerInfo* pPlayer)
|
||||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_LAUNCH) ||
|
||||
RpAnimBlendClumpGetAssociation(pPed->GetClump(), ANIM_JUMP_GLIDE))
|
||||
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)
|
||||
@ -2482,7 +2556,7 @@ void CTheScripts::UpdateObjectIndices()
|
||||
CBaseModelInfo* pModel = CModelInfo::GetModelInfo(j);
|
||||
if (!pModel)
|
||||
continue;
|
||||
strcpy(name, pModel->GetName());
|
||||
strcpy(name, pModel->GetModelName());
|
||||
#ifdef FIX_BUGS
|
||||
for (int k = 0; k < USED_OBJECT_NAME_LENGTH && name[k]; k++)
|
||||
#else
|
||||
|
@ -33,9 +33,12 @@
|
||||
#include "Zones.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)
|
||||
{
|
||||
#ifdef GTA_PS2
|
||||
#if GTA_VERSION <= GTA3_PS2_160
|
||||
char tmp[48];
|
||||
#endif
|
||||
switch (command) {
|
||||
@ -423,7 +426,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||
#ifdef USE_MEASUREMENTS_IN_METERS
|
||||
UpdateCompareFlag(true);
|
||||
#else
|
||||
UpdateCompareFlag(false)
|
||||
UpdateCompareFlag(false);
|
||||
#endif
|
||||
return 0;
|
||||
case COMMAND_CONVERT_METRES_TO_FEET:
|
||||
@ -604,7 +607,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||
ScriptParams[0] = CPools::GetVehiclePool()->GetIndex(pVehicle);
|
||||
StoreParameters(&m_nIp, 1);
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ScriptParams[0], CLEANUP_CAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ScriptParams[0], CLEANUP_CAR);
|
||||
return 0;
|
||||
}
|
||||
case COMMAND_START_BOAT_FOAM_ANIMATION:
|
||||
@ -746,7 +749,7 @@ int8 CRunningScript::ProcessCommands1000To1099(int32 command)
|
||||
pPed->m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER);
|
||||
return 0;
|
||||
}
|
||||
#ifndef GTA_PS2
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
default:
|
||||
script_assert(0);
|
||||
}
|
||||
@ -838,8 +841,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||
case COMMAND_ENABLE_PLAYER_CONTROL_CAMERA:
|
||||
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
|
||||
return 0;
|
||||
#ifndef GTA_PS2
|
||||
// To be precise, on PS2 previous handlers were in 1000-1099 function
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
// These are "beta" VC commands (with bugs)
|
||||
case COMMAND_SET_OBJECT_ROTATION:
|
||||
{
|
||||
@ -1119,7 +1121,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||
pPed->bRespondsToThreats = false;
|
||||
++CPopulation::ms_nTotalMissionPeds;
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||
}
|
||||
ScriptParams[0] = ped_handle;
|
||||
StoreParameters(&m_nIp, 1);
|
||||
@ -1166,7 +1168,7 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
|
||||
pPed->bRespondsToThreats = false;
|
||||
++CPopulation::ms_nTotalMissionPeds;
|
||||
if (m_bIsMissionScript)
|
||||
CTheScripts::MissionCleanup.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||
CTheScripts::MissionCleanUp.AddEntityToList(ped_handle, CLEANUP_CHAR);
|
||||
}
|
||||
ScriptParams[0] = ped_handle;
|
||||
StoreParameters(&m_nIp, 1);
|
||||
|
@ -1108,7 +1108,7 @@ enum {
|
||||
COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER,
|
||||
COMMAND_LOAD_END_OF_GAME_TUNE,
|
||||
COMMAND_ENABLE_PLAYER_CONTROL_CAMERA,
|
||||
#ifndef GTA_PS2
|
||||
#if GTA_VERSION > GTA3_PS2_160
|
||||
COMMAND_SET_OBJECT_ROTATION,
|
||||
COMMAND_GET_DEBUG_CAMERA_COORDINATES,
|
||||
COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR,
|
||||
|
@ -193,7 +193,7 @@ CCam::Process(void)
|
||||
break;
|
||||
case MODE_CAM_ON_A_STRING:
|
||||
#ifdef FREE_CAM
|
||||
if(CCamera::bFreeCam)
|
||||
if(CCamera::bFreeCam && !CVehicle::bCheat5)
|
||||
Process_FollowCar_SA(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
|
||||
else
|
||||
#endif
|
||||
@ -946,7 +946,7 @@ CVector
|
||||
CCam::DoAverageOnVector(const CVector &vec)
|
||||
{
|
||||
int i;
|
||||
CVector Average = { 0.0f, 0.0f, 0.0f };
|
||||
CVector Average(0.0f, 0.0f, 0.0f);
|
||||
|
||||
if(ResetStatics){
|
||||
m_iRunningVectorArrayPos = 0;
|
||||
@ -3829,11 +3829,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
||||
}
|
||||
|
||||
// stay inside sectors
|
||||
while(CWorld::GetSectorX(Source.x) > 95.0f)
|
||||
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||
Source.x -= 1.0f;
|
||||
while(CWorld::GetSectorX(Source.x) < 5.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;
|
||||
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
||||
Source.y += 1.0f;
|
||||
@ -3900,11 +3900,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
|
||||
}
|
||||
|
||||
// stay inside sectors
|
||||
while(CWorld::GetSectorX(Source.x) > 95.0f)
|
||||
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||
Source.x -= 1.0f;
|
||||
while(CWorld::GetSectorX(Source.x) < 5.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;
|
||||
while(CWorld::GetSectorY(Source.y) < 5.0f)
|
||||
Source.y += 1.0f;
|
||||
@ -3981,11 +3981,11 @@ CCam::Process_Editor(const CVector&, float, float, float)
|
||||
}
|
||||
|
||||
// stay inside sectors
|
||||
while(CWorld::GetSectorX(Source.x) > 95.0f)
|
||||
while(CWorld::GetSectorX(Source.x) > NUMSECTORS_X-5.0f)
|
||||
Source.x -= 1.0f;
|
||||
while(CWorld::GetSectorX(Source.x) < 5.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;
|
||||
while(CWorld::GetSectorY(Source.y) < 5.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
|
||||
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.
|
||||
// if (CCamera::m_bUseMouse3rdPerson)
|
||||
// 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 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;
|
||||
deltaBeta = Abs(deltaBeta);
|
||||
|
||||
door = FindPlayerPed()->m_vehEnterType;
|
||||
door = FindPlayerPed()->m_vehDoor;
|
||||
if(deltaBeta > HALFPI){
|
||||
if(((CPed*)pTargetEntity)->m_carInObjective){
|
||||
if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){
|
||||
@ -2293,7 +2293,7 @@ CCamera::StartTransition(int16 newMode)
|
||||
}
|
||||
#endif
|
||||
|
||||
door = FindPlayerPed()->m_vehEnterType;
|
||||
door = FindPlayerPed()->m_vehDoor;
|
||||
if(deltaBeta > HALFPI){
|
||||
if(((CVehicle*)pTargetEntity)->IsUpsideDown()){
|
||||
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())
|
||||
return false;
|
||||
#endif
|
||||
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
|
||||
if(FindPlayerPed()->m_pWanted->GetWantedLevel() < 1)
|
||||
return false;
|
||||
if(FindPlayerVehicle() == nil)
|
||||
return false;
|
||||
@ -2811,7 +2811,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
|
||||
if (CReplay::IsPlayingBack())
|
||||
return false;
|
||||
#endif
|
||||
if(FindPlayerPed()->m_pWanted->m_nWantedLevel < 1)
|
||||
if(FindPlayerPed()->m_pWanted->GetWantedLevel() < 1)
|
||||
return false;
|
||||
if(FindPlayerVehicle() == nil)
|
||||
return false;
|
||||
@ -3629,9 +3629,17 @@ CCamera::CalculateDerivedValues(void)
|
||||
bool
|
||||
CCamera::IsPointVisible(const CVector ¢er, const CMatrix *mat)
|
||||
{
|
||||
RwV3d c;
|
||||
c = center;
|
||||
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
|
||||
#ifdef GTA_PS2
|
||||
CVuVector c;
|
||||
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::GetFarClipZ()) 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
|
||||
CCamera::IsSphereVisible(const CVector ¢er, float radius, const CMatrix *mat)
|
||||
{
|
||||
RwV3d c;
|
||||
c = center;
|
||||
RwV3dTransformPoints(&c, &c, 1, &mat->m_matrix);
|
||||
#ifdef GTA_PS2
|
||||
CVuVector c;
|
||||
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::GetFarClipZ()) 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
|
||||
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 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++){
|
||||
if(box[i].y < CDraw::GetNearClipZ()) frustumTests[0]++;
|
||||
|
@ -641,7 +641,11 @@ public:
|
||||
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);
|
||||
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);
|
||||
|
@ -7,9 +7,6 @@
|
||||
#include "RwHelper.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
|
||||
{
|
||||
uint32 nSectorOffset;
|
||||
@ -60,7 +57,7 @@ CdStreamInitThread(void)
|
||||
|
||||
if ( gpReadInfo[i].hSemaphore == nil )
|
||||
{
|
||||
CDTRACE("failed to create sync semaphore");
|
||||
printf("%s: failed to create sync semaphore\n", "cdvd_stream");
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
@ -81,7 +78,7 @@ CdStreamInitThread(void)
|
||||
|
||||
if ( gCdStreamSema == nil )
|
||||
{
|
||||
CDTRACE("failed to create stream semaphore");
|
||||
printf("%s: failed to create stream semaphore\n", "cdvd_stream");
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
@ -90,7 +87,7 @@ CdStreamInitThread(void)
|
||||
|
||||
if ( _gCdStreamThread == nil )
|
||||
{
|
||||
CDTRACE("failed to create streaming thread");
|
||||
printf("%s: failed to create streaming thread\n", "cdvd_stream");
|
||||
ASSERT(0);
|
||||
return;
|
||||
}
|
||||
@ -138,7 +135,7 @@ CdStreamInit(int32 numChannels)
|
||||
gpReadInfo = (CdReadInfo *)LocalAlloc(LMEM_ZEROINIT, sizeof(CdReadInfo) * numChannels);
|
||||
ASSERT( gpReadInfo != nil );
|
||||
|
||||
CDDEBUG("read info %p", gpReadInfo);
|
||||
debug("%s: read info %p\n", "cdvd_stream", gpReadInfo);
|
||||
|
||||
CdStreamAddImage("MODELS\\GTA3.IMG");
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#endif
|
||||
|
||||
#define WITHDINPUT
|
||||
#include "common.h"
|
||||
#include "platform.h"
|
||||
#include "crossplatform.h" // for Windows version
|
||||
#include "crossplatform.h"
|
||||
#include "ControllerConfig.h"
|
||||
#include "Pad.h"
|
||||
#include "FileMgr.h"
|
||||
@ -35,6 +31,9 @@ CControllerConfigManager::CControllerConfigManager()
|
||||
|
||||
void CControllerConfigManager::MakeControllerActionsBlank()
|
||||
{
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
ms_padButtonsInited = 0;
|
||||
#endif
|
||||
for (int32 i = 0; i < MAX_CONTROLLERTYPES; i++)
|
||||
{
|
||||
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)
|
||||
{
|
||||
m_bFirstCapture = true;
|
||||
@ -392,6 +395,22 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
||||
if (buttons > 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
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
if ( AllValidWinJoys.m_aJoys[JOYSTICK1].m_nVendorID == 0x3427
|
||||
@ -404,49 +423,49 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
||||
|
||||
switch (btn)
|
||||
{
|
||||
case 16:
|
||||
IF_BTN_IN_RANGE(16)
|
||||
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
|
||||
case 15:
|
||||
IF_BTN_IN_RANGE(15)
|
||||
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
|
||||
case 14:
|
||||
IF_BTN_IN_RANGE(14)
|
||||
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
|
||||
case 13:
|
||||
IF_BTN_IN_RANGE(13)
|
||||
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
|
||||
case 12:
|
||||
case 11:
|
||||
IF_BTN_IN_RANGE(12)
|
||||
IF_BTN_IN_RANGE(11)
|
||||
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
|
||||
case 10:
|
||||
IF_BTN_IN_RANGE(10)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
|
||||
case 9:
|
||||
IF_BTN_IN_RANGE(9)
|
||||
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
|
||||
case 8:
|
||||
IF_BTN_IN_RANGE(8)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
|
||||
case 7:
|
||||
IF_BTN_IN_RANGE(7)
|
||||
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
|
||||
case 6:
|
||||
IF_BTN_IN_RANGE(6)
|
||||
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
|
||||
case 5:
|
||||
IF_BTN_IN_RANGE(5)
|
||||
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
|
||||
/*******************************************************************************************/
|
||||
case 4:
|
||||
IF_BTN_IN_RANGE(4)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 4, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_JUMPING, 4, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 4, JOYSTICK);
|
||||
case 3:
|
||||
IF_BTN_IN_RANGE(3)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 3, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_SPRINT, 3, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 3, JOYSTICK);
|
||||
case 2:
|
||||
IF_BTN_IN_RANGE(2)
|
||||
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 2, JOYSTICK);
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_FIREWEAPON, 2, JOYSTICK);
|
||||
#endif
|
||||
case 1:
|
||||
IF_BTN_IN_RANGE(1)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 1, JOYSTICK);
|
||||
/*******************************************************************************************/
|
||||
}
|
||||
@ -455,46 +474,46 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
|
||||
{
|
||||
switch (btn)
|
||||
{
|
||||
case 16:
|
||||
IF_BTN_IN_RANGE(16)
|
||||
SetControllerKeyAssociatedWithAction(GO_LEFT, 16, JOYSTICK);
|
||||
case 15:
|
||||
IF_BTN_IN_RANGE(15)
|
||||
SetControllerKeyAssociatedWithAction(GO_BACK, 15, JOYSTICK);
|
||||
case 14:
|
||||
IF_BTN_IN_RANGE(14)
|
||||
SetControllerKeyAssociatedWithAction(GO_RIGHT, 14, JOYSTICK);
|
||||
case 13:
|
||||
IF_BTN_IN_RANGE(13)
|
||||
SetControllerKeyAssociatedWithAction(GO_FORWARD, 13, JOYSTICK);
|
||||
case 12:
|
||||
case 11:
|
||||
IF_BTN_IN_RANGE(12)
|
||||
IF_BTN_IN_RANGE(11)
|
||||
SetControllerKeyAssociatedWithAction(PED_LOOKBEHIND, 11, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
|
||||
case 10:
|
||||
IF_BTN_IN_RANGE(10)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
|
||||
case 9:
|
||||
IF_BTN_IN_RANGE(9)
|
||||
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
|
||||
case 8:
|
||||
IF_BTN_IN_RANGE(8)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
|
||||
case 7:
|
||||
IF_BTN_IN_RANGE(7)
|
||||
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
|
||||
case 6:
|
||||
IF_BTN_IN_RANGE(6)
|
||||
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKRIGHT, 6, JOYSTICK);
|
||||
case 5:
|
||||
IF_BTN_IN_RANGE(5)
|
||||
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, 5, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_LOOKLEFT, 5, JOYSTICK);
|
||||
/*******************************************************************************************/
|
||||
case 4:
|
||||
IF_BTN_IN_RANGE(4)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_ENTER_EXIT, 4, JOYSTICK);
|
||||
case 3:
|
||||
IF_BTN_IN_RANGE(3)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_BRAKE, 3, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_JUMPING, 3, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_IN, 3, JOYSTICK);
|
||||
case 2:
|
||||
IF_BTN_IN_RANGE(2)
|
||||
SetControllerKeyAssociatedWithAction(VEHICLE_ACCELERATE, 2, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_SPRINT, 2, JOYSTICK);
|
||||
SetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, 2, JOYSTICK);
|
||||
case 1:
|
||||
IF_BTN_IN_RANGE(1)
|
||||
SetControllerKeyAssociatedWithAction(PED_FIREWEAPON, 1, JOYSTICK);
|
||||
#ifdef BIND_VEHICLE_FIREWEAPON
|
||||
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)
|
||||
{
|
||||
ResetSettingOrder(action);
|
||||
int numOfSettings = GetNumOfSettingsForAction(action);
|
||||
|
||||
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)
|
||||
@ -2847,8 +2867,10 @@ int32 CControllerConfigManager::GetMouseButtonAssociatedWithAction(e_ControllerA
|
||||
|
||||
void CControllerConfigManager::SetMouseButtonAssociatedWithAction(e_ControllerAction action, int32 button)
|
||||
{
|
||||
int numOfSettings = GetNumOfSettingsForAction(action);
|
||||
|
||||
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)
|
||||
@ -2871,7 +2893,7 @@ void CControllerConfigManager::ResetSettingOrder(e_ControllerAction action)
|
||||
for (int32 k = 0; k < MAX_CONTROLLERTYPES; k++)
|
||||
{
|
||||
int32 setorder = m_aSettings[action][k].m_ContSetOrder;
|
||||
if (setorder > i && setorder != KEYBOARD)
|
||||
if (setorder > i && setorder != 0)
|
||||
{
|
||||
if (init)
|
||||
{
|
||||
|
@ -155,6 +155,10 @@ public:
|
||||
tControllerConfigBind m_aSettings[MAX_CONTROLLERACTIONS][MAX_CONTROLLERTYPES];
|
||||
bool m_aSimCheckers[MAX_SIMS][MAX_CONTROLLERTYPES];
|
||||
bool m_bMouseAssociated;
|
||||
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
static uint32 ms_padButtonsInited;
|
||||
#endif
|
||||
|
||||
CControllerConfigManager();
|
||||
|
||||
|
@ -534,7 +534,7 @@ bool
|
||||
CFileLoader::StartLoadClumpFile(RwStream *stream, uint32 id)
|
||||
{
|
||||
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);
|
||||
}else{
|
||||
printf("FAILED\n");
|
||||
@ -548,7 +548,7 @@ CFileLoader::FinishLoadClumpFile(RwStream *stream, uint32 id)
|
||||
RpClump *clump;
|
||||
CClumpModelInfo *mi;
|
||||
|
||||
printf("Finish loading %s\n", CModelInfo::GetModelInfo(id)->GetName());
|
||||
printf("Finish loading %s\n", CModelInfo::GetModelInfo(id)->GetModelName());
|
||||
clump = RpClumpGtaStreamRead2(stream);
|
||||
|
||||
if(clump){
|
||||
@ -646,7 +646,6 @@ char *DoubleSidedNames[] = {
|
||||
"overpass_comse",
|
||||
"newdockbuilding",
|
||||
"newdockbuilding2",
|
||||
"newdockbuilding",
|
||||
"policeballhall",
|
||||
"fuzballdoor",
|
||||
"ind_land106",
|
||||
@ -670,7 +669,98 @@ char *DoubleSidedNames[] = {
|
||||
"railtrax_2b",
|
||||
"railtrax_straightss",
|
||||
"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[] = {
|
||||
"coast_treepatch",
|
||||
@ -1074,9 +1164,9 @@ SetModelInfoFlags(CSimpleModelInfo *mi, uint32 flags)
|
||||
|
||||
#ifdef HARDCODED_MODEL_FLAGS
|
||||
// mobile sets these flags in CFileLoader::SetRelatedModelInfoCB, but that's stupid
|
||||
if(MatchModelName(mi->GetName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
|
||||
if(MatchModelName(mi->GetName(), TreeNames)) mi->m_bIsTree = true;
|
||||
if(MatchModelName(mi->GetName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
|
||||
if(MatchModelName(mi->GetModelName(), DoubleSidedNames)) mi->m_bIsDoubleSided = true;
|
||||
if(MatchModelName(mi->GetModelName(), TreeNames)) mi->m_bIsTree = true;
|
||||
if(MatchModelName(mi->GetModelName(), OptimizedNames)) mi->m_bCanBeIgnored = true;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@ -1118,7 +1208,7 @@ CFileLoader::LoadObject(const char *line)
|
||||
}
|
||||
|
||||
mi = CModelInfo::AddSimpleModel(id);
|
||||
mi->SetName(model);
|
||||
mi->SetModelName(model);
|
||||
mi->SetNumAtomics(numObjs);
|
||||
mi->SetLodDistances(dist);
|
||||
SetModelInfoFlags(mi, flags);
|
||||
@ -1137,7 +1227,7 @@ CFileLoader::LoadMLO(const char *line)
|
||||
|
||||
sscanf(line, "%s %s %d %f", smth, name, &modelIndex, &someFloat);
|
||||
CMloModelInfo *minfo = CModelInfo::AddMloModel(modelIndex);
|
||||
minfo->SetName(name);
|
||||
minfo->SetModelName(name);
|
||||
minfo->field_34 = someFloat;
|
||||
int instId = CModelInfo::GetMloInstanceStore().allocPtr;
|
||||
minfo->firstInstance = instId;
|
||||
@ -1215,7 +1305,7 @@ CFileLoader::LoadTimeObject(const char *line)
|
||||
}
|
||||
|
||||
mi = CModelInfo::AddTimeModel(id);
|
||||
mi->SetName(model);
|
||||
mi->SetModelName(model);
|
||||
mi->SetNumAtomics(numObjs);
|
||||
mi->SetLodDistances(dist);
|
||||
SetModelInfoFlags(mi, flags);
|
||||
@ -1237,7 +1327,7 @@ CFileLoader::LoadClumpObject(const char *line)
|
||||
|
||||
if(sscanf(line, "%d %s %s", &id, model, txd) == 3){
|
||||
mi = CModelInfo::AddClumpModel(id);
|
||||
mi->SetName(model);
|
||||
mi->SetModelName(model);
|
||||
mi->SetTexDictionary(txd);
|
||||
mi->SetColModel(&CTempColModels::ms_colModelBBox);
|
||||
}
|
||||
@ -1261,7 +1351,7 @@ CFileLoader::LoadVehicleObject(const char *line)
|
||||
&frequency, &level, &comprules, &misc, &wheelScale);
|
||||
|
||||
mi = CModelInfo::AddVehicleModel(id);
|
||||
mi->SetName(model);
|
||||
mi->SetModelName(model);
|
||||
mi->SetTexDictionary(txd);
|
||||
for(p = gamename; *p; p++)
|
||||
if(*p == '_') *p = ' ';
|
||||
@ -1340,7 +1430,7 @@ CFileLoader::LoadPedObject(const char *line)
|
||||
return;
|
||||
|
||||
mi = CModelInfo::AddPedModel(id);
|
||||
mi->SetName(model);
|
||||
mi->SetModelName(model);
|
||||
mi->SetTexDictionary(txd);
|
||||
mi->SetColModel(&CTempColModels::ms_colModelPed1);
|
||||
mi->m_pedType = CPedType::FindPedType(pedType);
|
||||
@ -1814,7 +1904,7 @@ CFileLoader::ReloadObject(const char *line)
|
||||
#ifdef FIX_BUGS
|
||||
mi &&
|
||||
#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);
|
||||
SetModelInfoFlags(mi, flags);
|
||||
} else {
|
||||
|
@ -264,7 +264,7 @@ CFileMgr::SetDirMyDocuments(void)
|
||||
}
|
||||
|
||||
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;
|
||||
ssize_t n, len;
|
||||
@ -280,6 +280,7 @@ CFileMgr::LoadFile(const char *file, uint8 *buf, int unused, const char *mode)
|
||||
return -1;
|
||||
#endif
|
||||
len += n;
|
||||
assert(len < maxlen);
|
||||
}while(n == 0x4000);
|
||||
buf[len] = 0;
|
||||
myfclose(fd);
|
||||
|
@ -9,7 +9,7 @@ public:
|
||||
static void ChangeDir(const char *dir);
|
||||
static void SetDir(const char *dir);
|
||||
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) { return OpenFile(file, "rb"); }
|
||||
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 WITHWINDOWS
|
||||
#define WITHDINPUT
|
||||
#include "common.h"
|
||||
#ifndef PS2_MENU
|
||||
#include "crossplatform.h"
|
||||
@ -145,14 +141,6 @@ int8 CMenuManager::m_nDisplayMSAALevel = 0;
|
||||
int8 CMenuManager::m_PrefsIslandLoading = ISLAND_LOADING_LOW;
|
||||
#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;
|
||||
int8 CMenuManager::m_PrefsUseVibration;
|
||||
int8 CMenuManager::m_DisplayControllerOnFoot;
|
||||
@ -877,7 +865,11 @@ CMenuManager::CheckCodesForControls(int typeOfControl)
|
||||
m_bWaitingForNewKeyBind = false;
|
||||
m_KeyPressedCode = -1;
|
||||
m_bStartWaitingForKeyBind = false;
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
SaveINIControllerSettings();
|
||||
#else
|
||||
SaveSettings();
|
||||
#endif
|
||||
}
|
||||
|
||||
if (escPressed) {
|
||||
@ -885,7 +877,11 @@ CMenuManager::CheckCodesForControls(int typeOfControl)
|
||||
m_bWaitingForNewKeyBind = false;
|
||||
m_KeyPressedCode = -1;
|
||||
m_bStartWaitingForKeyBind = false;
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
SaveINIControllerSettings();
|
||||
#else
|
||||
SaveSettings();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1288,7 +1284,9 @@ CMenuManager::Draw()
|
||||
float smallestSliderBar = lineHeight * 0.1f;
|
||||
bool foundTheHoveringItem = false;
|
||||
wchar unicodeTemp[64];
|
||||
#ifdef ASPECT_RATIO_SCALE
|
||||
char asciiTemp[32];
|
||||
#endif
|
||||
|
||||
#ifdef MENU_MAP
|
||||
if (m_nCurrScreen == MENUPAGE_MAP) {
|
||||
@ -1462,18 +1460,34 @@ CMenuManager::Draw()
|
||||
#else
|
||||
switch (m_PrefsUseWideScreen) {
|
||||
case AR_AUTO:
|
||||
sprintf(asciiTemp, "AUTO");
|
||||
rightText = TheText.Get("FEM_AUT");
|
||||
break;
|
||||
case AR_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;
|
||||
case AR_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;
|
||||
}
|
||||
|
||||
AsciiToUnicode(asciiTemp, unicodeTemp);
|
||||
rightText = unicodeTemp;
|
||||
#endif
|
||||
break;
|
||||
case MENUACTION_RADIO:
|
||||
@ -1567,6 +1581,7 @@ CMenuManager::Draw()
|
||||
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[i];
|
||||
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
||||
|
||||
isOptionDisabled = option.m_CFOSelect->disableIfGameLoaded && !m_bGameNotLoaded;
|
||||
if (option.m_CFOSelect->onlyApplyOnEnter){
|
||||
if (m_nCurrOption != i) {
|
||||
if (option.m_CFOSelect->displayedValue != option.m_CFOSelect->lastSavedValue)
|
||||
@ -3568,13 +3583,21 @@ CMenuManager::LoadAllTextures()
|
||||
DMAudio.ChangeMusicMode(MUSICMODE_FRONTEND);
|
||||
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_STARTING, 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();
|
||||
|
||||
if (DMAudio.IsMP3RadioChannelAvailable()) {
|
||||
if (m_PrefsRadioStation > USERTRACK)
|
||||
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 10;
|
||||
m_PrefsRadioStation = CGeneral::GetRandomNumber() % (USERTRACK + 1);
|
||||
} else if (m_PrefsRadioStation > CHATTERBOX)
|
||||
m_PrefsRadioStation = CGeneral::GetRandomNumber() % 9;
|
||||
m_PrefsRadioStation = CGeneral::GetRandomNumber() % (CHATTERBOX + 1);
|
||||
|
||||
CFileMgr::SetDir("");
|
||||
//CFileMgr::SetDir("");
|
||||
@ -3709,6 +3732,16 @@ CMenuManager::LoadSettings()
|
||||
CFileMgr::CloseFile(fileHandle);
|
||||
CFileMgr::SetDir("");
|
||||
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
if (LoadINISettings()) {
|
||||
LoadINIControllerSettings();
|
||||
} else {
|
||||
// no re3.ini, create it
|
||||
SaveINISettings();
|
||||
SaveINIControllerSettings();
|
||||
}
|
||||
#endif
|
||||
|
||||
m_PrefsVsync = m_PrefsVsyncDisp;
|
||||
CRenderer::ms_lodDistScale = m_PrefsLOD;
|
||||
|
||||
@ -3747,15 +3780,12 @@ CMenuManager::LoadSettings()
|
||||
strcpy(m_PrefsSkinFile, DEFAULT_SKIN_NAME);
|
||||
strcpy(m_aSkinName, DEFAULT_SKIN_NAME);
|
||||
}
|
||||
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
LoadINISettings(); // needs frontend options to be loaded
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
CMenuManager::SaveSettings()
|
||||
{
|
||||
#ifndef LOAD_INI_SETTINGS
|
||||
static char RubbishString[48] = "stuffmorestuffevenmorestuff etc";
|
||||
|
||||
CFileMgr::SetDirMyDocuments();
|
||||
@ -3805,7 +3835,7 @@ CMenuManager::SaveSettings()
|
||||
CFileMgr::CloseFile(fileHandle);
|
||||
CFileMgr::SetDir("");
|
||||
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
#else
|
||||
SaveINISettings();
|
||||
#endif
|
||||
}
|
||||
@ -4115,19 +4145,19 @@ CMenuManager::Process(void)
|
||||
MouseButtonJustClicked = false;
|
||||
|
||||
if (CPad::GetPad(0)->GetLeftMouseJustDown())
|
||||
MouseButtonJustClicked = 1;
|
||||
MouseButtonJustClicked = rsMOUSELEFTBUTTON;
|
||||
else if (CPad::GetPad(0)->GetRightMouseJustUp())
|
||||
MouseButtonJustClicked = 3;
|
||||
MouseButtonJustClicked = rsMOUSERIGHTBUTTON;
|
||||
else if (CPad::GetPad(0)->GetMiddleMouseJustUp())
|
||||
MouseButtonJustClicked = 2;
|
||||
MouseButtonJustClicked = rsMOUSMIDDLEBUTTON;
|
||||
else if (CPad::GetPad(0)->GetMouseWheelUpJustUp())
|
||||
MouseButtonJustClicked = 4;
|
||||
MouseButtonJustClicked = rsMOUSEWHEELUPBUTTON;
|
||||
else if (CPad::GetPad(0)->GetMouseWheelDownJustUp())
|
||||
MouseButtonJustClicked = 5;
|
||||
MouseButtonJustClicked = rsMOUSEWHEELDOWNBUTTON;
|
||||
else if (CPad::GetPad(0)->GetMouseX1JustUp())
|
||||
MouseButtonJustClicked = 6;
|
||||
MouseButtonJustClicked = rsMOUSEX1BUTTON;
|
||||
else if (CPad::GetPad(0)->GetMouseX2JustUp())
|
||||
MouseButtonJustClicked = 7;
|
||||
MouseButtonJustClicked = rsMOUSEX2BUTTON;
|
||||
|
||||
JoyButtonJustClicked = ControlsManager.GetJoyButtonJustDown();
|
||||
|
||||
@ -5051,6 +5081,9 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
CVehicle::m_bDisableMouseSteering = true;
|
||||
TheCamera.m_bHeadBob = false;
|
||||
SaveSettings();
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
SaveINIControllerSettings();
|
||||
#endif
|
||||
}
|
||||
SetHelperText(2);
|
||||
break;
|
||||
@ -5090,6 +5123,9 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
case MENUACTION_CFO_DYNAMIC:
|
||||
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
|
||||
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
||||
if (option.m_CFOSelect->disableIfGameLoaded && !m_bGameNotLoaded)
|
||||
break;
|
||||
|
||||
if (!option.m_CFOSelect->onlyApplyOnEnter) {
|
||||
option.m_CFOSelect->displayedValue++;
|
||||
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;
|
||||
|
||||
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();
|
||||
|
||||
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
|
||||
@ -5257,12 +5294,12 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
case MENUACTION_WIDESCREEN:
|
||||
if (changeValueBy > 0) {
|
||||
m_PrefsUseWideScreen++;
|
||||
if (m_PrefsUseWideScreen > 2)
|
||||
if (m_PrefsUseWideScreen > AR_MAX-1)
|
||||
m_PrefsUseWideScreen = 0;
|
||||
} else {
|
||||
m_PrefsUseWideScreen--;
|
||||
if (m_PrefsUseWideScreen < 0)
|
||||
m_PrefsUseWideScreen = 2;
|
||||
m_PrefsUseWideScreen = AR_MAX-1;
|
||||
}
|
||||
DMAudio.PlayFrontEndSound(SOUND_FRONTEND_MENU_SETTING_CHANGE, 0);
|
||||
SaveSettings();
|
||||
@ -5316,6 +5353,9 @@ CMenuManager::ProcessButtonPresses(void)
|
||||
case MENUACTION_CFO_DYNAMIC:
|
||||
CMenuScreenCustom::CMenuEntry &option = aScreens[m_nCurrScreen].m_aEntries[m_nCurrOption];
|
||||
if (option.m_Action == MENUACTION_CFO_SELECT) {
|
||||
if (option.m_CFOSelect->disableIfGameLoaded && !m_bGameNotLoaded)
|
||||
break;
|
||||
|
||||
if (changeValueBy > 0) {
|
||||
option.m_CFOSelect->displayedValue++;
|
||||
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;
|
||||
|
||||
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();
|
||||
|
||||
if (option.m_CFOSelect->displayedValue != oldValue && option.m_CFOSelect->changeFunc)
|
||||
@ -5572,6 +5613,9 @@ CMenuManager::SwitchMenuOnAndOff()
|
||||
#endif
|
||||
ShutdownJustMenu();
|
||||
SaveSettings();
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
SaveINIControllerSettings();
|
||||
#endif
|
||||
m_bStartUpFrontEndRequested = false;
|
||||
pControlEdit = nil;
|
||||
m_bShutDownFrontEndRequested = false;
|
||||
|
@ -494,6 +494,7 @@ struct CCustomScreenLayout {
|
||||
struct CCFO
|
||||
{
|
||||
int8 *value;
|
||||
const char *saveCat;
|
||||
const char *save;
|
||||
};
|
||||
|
||||
@ -505,18 +506,21 @@ struct CCFOSelect : CCFO
|
||||
int8 displayedValue; // only if onlyApplyOnEnter enabled for now
|
||||
int8 lastSavedValue; // only if onlyApplyOnEnter enabled
|
||||
ChangeFunc changeFunc;
|
||||
bool disableIfGameLoaded;
|
||||
|
||||
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;
|
||||
if (value)
|
||||
this->lastSavedValue = this->displayedValue = *value;
|
||||
|
||||
this->saveCat = saveCat;
|
||||
this->save = save;
|
||||
this->rightTexts = (char**)rightTexts;
|
||||
this->numRightTexts = numRightTexts;
|
||||
this->onlyApplyOnEnter = onlyApplyOnEnter;
|
||||
this->changeFunc = changeFunc;
|
||||
this->disableIfGameLoaded = disableIfGameLoaded;
|
||||
}
|
||||
};
|
||||
|
||||
@ -526,8 +530,9 @@ struct CCFODynamic : CCFO
|
||||
ButtonPressFunc buttonPressFunc;
|
||||
|
||||
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->saveCat = saveCat;
|
||||
this->save = save;
|
||||
this->drawFunc = drawFunc;
|
||||
this->buttonPressFunc = buttonPressFunc;
|
||||
|
@ -1,6 +1,3 @@
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4005)
|
||||
#pragma warning( pop )
|
||||
#include "common.h"
|
||||
#include "platform.h"
|
||||
|
||||
@ -10,7 +7,6 @@
|
||||
#include "Accident.h"
|
||||
#include "Antennas.h"
|
||||
#include "Bridge.h"
|
||||
#include "Camera.h"
|
||||
#include "CarCtrl.h"
|
||||
#include "CarGen.h"
|
||||
#include "CdStream.h"
|
||||
@ -67,7 +63,6 @@
|
||||
#include "Shadows.h"
|
||||
#include "Skidmarks.h"
|
||||
#include "SpecialFX.h"
|
||||
#include "Sprite2d.h"
|
||||
#include "Stats.h"
|
||||
#include "Streaming.h"
|
||||
#include "SurfaceTable.h"
|
||||
|
@ -133,7 +133,7 @@ public:
|
||||
static bool faststricmp(const char *str1, const char *str2)
|
||||
{
|
||||
for (; *str1; str1++, str2++) {
|
||||
#if MUCH_SLOWER || !defined _WIN32 || defined __MINGW32__
|
||||
#ifndef ASCII_STRCMP
|
||||
if (toupper(*str1) != toupper(*str2))
|
||||
#else
|
||||
if (__ascii_toupper(*str1) != __ascii_toupper(*str2))
|
||||
|
@ -1,7 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "common.h"
|
||||
|
||||
class CPtrNode
|
||||
{
|
||||
public:
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "Collision.h"
|
||||
#include "ModelInfo.h"
|
||||
#include "Pad.h"
|
||||
#include "ControllerConfig.h"
|
||||
|
||||
// Menu screens array is at the bottom of the file.
|
||||
|
||||
@ -24,51 +25,51 @@
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
|
||||
#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
|
||||
#define VIDEOMODE_SELECTOR
|
||||
#endif
|
||||
|
||||
#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
|
||||
#define MULTISAMPLING_SELECTOR
|
||||
#endif
|
||||
|
||||
#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
|
||||
#define CUTSCENE_BORDERS_TOGGLE
|
||||
#endif
|
||||
|
||||
#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
|
||||
#define FREE_CAM_TOGGLE
|
||||
#endif
|
||||
|
||||
#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
|
||||
#define DUALPASS_SELECTOR
|
||||
#endif
|
||||
|
||||
#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
|
||||
#define ISLAND_LOADING_SELECTOR
|
||||
#endif
|
||||
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
#define POSTFX_SELECTORS \
|
||||
MENUACTION_CFO_SELECT, "FED_CLF", { new CCFOSelect((int8*)&CPostFX::EffectSwitch, "ColourFilter", filterNames, ARRAY_SIZE(filterNames), false, nil) }, \
|
||||
MENUACTION_CFO_SELECT, "FED_MBL", { new CCFOSelect((int8*)&CPostFX::MotionBlurOn, "MotionBlur", off_on, 2, 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, "Graphics", "MotionBlur", off_on, 2, false) },
|
||||
#else
|
||||
#define POSTFX_SELECTORS
|
||||
#endif
|
||||
|
||||
#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
|
||||
#define INVERT_PAD_SELECTOR
|
||||
#endif
|
||||
@ -292,6 +293,7 @@ void ScreenModeAfterChange(int8 before, int8 after)
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
wchar selectedJoystickUnicode[128];
|
||||
int cachedButtonNum = -1;
|
||||
|
||||
wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
||||
int numButtons;
|
||||
@ -320,6 +322,7 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
||||
|
||||
strcpy(gSelectedJoystickName, joyname);
|
||||
PSGLOBAL(joy1id) = found;
|
||||
cachedButtonNum = numButtons;
|
||||
}
|
||||
}
|
||||
if (PSGLOBAL(joy1id) == -1)
|
||||
@ -329,6 +332,18 @@ wchar* DetectJoystickDraw(bool* disabled, bool userHovering) {
|
||||
|
||||
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
|
||||
|
||||
CMenuScreenCustom aScreens[MENUPAGES] = {
|
||||
@ -405,7 +420,7 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
||||
CUTSCENE_BORDERS_TOGGLE
|
||||
FREE_CAM_TOGGLE
|
||||
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 },
|
||||
},
|
||||
#endif
|
||||
@ -418,9 +433,9 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
||||
MENUACTION_LANG_ITA, "FEL_ITA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
|
||||
MENUACTION_LANG_SPA, "FEL_SPA", { nil, SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS },
|
||||
#ifdef MORE_LANGUAGES
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, LangPolSelect) },
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, LangRusSelect) },
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, LangJapSelect) },
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_POL", { new CCFODynamic(nil, nil, nil, nil, LangPolSelect) },
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_RUS", { new CCFODynamic(nil, nil, nil, nil, LangRusSelect) },
|
||||
MENUACTION_CFO_DYNAMIC, "FEL_JAP", { new CCFODynamic(nil, nil, nil, nil, LangJapSelect) },
|
||||
#endif
|
||||
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 },
|
||||
#endif
|
||||
// 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 },
|
||||
},
|
||||
#endif
|
||||
@ -836,10 +851,10 @@ CMenuScreenCustom aScreens[MENUPAGES] = {
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
// MENUPAGE_DETECT_JOYSTICK
|
||||
{ "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_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 },
|
||||
},
|
||||
#endif
|
||||
|
@ -1,11 +1,4 @@
|
||||
#pragma warning( push )
|
||||
#pragma warning( disable : 4005)
|
||||
#if defined RW_D3D9 || defined RWLIBS
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#endif
|
||||
#pragma warning( pop )
|
||||
|
||||
#define WITHDINPUT
|
||||
#include "common.h"
|
||||
#include "crossplatform.h"
|
||||
#include "platform.h"
|
||||
@ -233,7 +226,7 @@ void ArmourCheat()
|
||||
void WantedLevelUpCheat()
|
||||
{
|
||||
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()
|
||||
@ -876,6 +869,30 @@ void CPad::AddToCheatString(char c)
|
||||
// "S1CD13TR1X" - SQUARE L1 CIRCLE DOWN L1 R1 TRIANGLE RIGHT L1 CROSS
|
||||
else if ( !_CHEATCMP("X1RT31DC1S") )
|
||||
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
|
||||
}
|
||||
#endif
|
||||
@ -1113,14 +1130,11 @@ void CPad::UpdatePads(void)
|
||||
bUpdate = false;
|
||||
|
||||
if ( bUpdate )
|
||||
{
|
||||
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)->OldState.Clear();
|
||||
#endif
|
||||
|
@ -7,7 +7,9 @@ CPlaceable::CPlaceable(void)
|
||||
m_matrix.SetScale(1.0f);
|
||||
}
|
||||
|
||||
CPlaceable::~CPlaceable(void) = default;
|
||||
CPlaceable::~CPlaceable(void)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
CPlaceable::SetHeading(float angle)
|
||||
|
@ -4,7 +4,7 @@ class CPlaceable
|
||||
{
|
||||
public:
|
||||
// disable allocation
|
||||
static void *operator new(size_t) = delete;
|
||||
static void *operator new(size_t);
|
||||
|
||||
CMatrix m_matrix;
|
||||
|
||||
|
@ -222,8 +222,8 @@ CPlayerInfo::Process(void)
|
||||
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
|
||||
} else if (carBelow->IsBoat()) {
|
||||
if (!carBelow->pDriver) {
|
||||
m_pPed->m_vehEnterType = 0;
|
||||
m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType);
|
||||
m_pPed->m_vehDoor = 0;
|
||||
m_pPed->SetEnterCar(carBelow, m_pPed->m_vehDoor);
|
||||
}
|
||||
} else {
|
||||
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "Collision.h"
|
||||
#include "ColModel.h"
|
||||
|
||||
enum eWastedBustedState
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ CPools::CheckPoolsEmpty()
|
||||
void
|
||||
CPools::MakeSureSlotInObjectPoolIsEmpty(int32 slot)
|
||||
{
|
||||
if (ms_pObjectPool->IsFreeSlot(slot)) return;
|
||||
if (ms_pObjectPool->GetIsFree(slot)) return;
|
||||
|
||||
CObject *object = ms_pObjectPool->GetSlot(slot);
|
||||
if (object->ObjectCreatedBy == TEMP_OBJECT) {
|
||||
@ -485,7 +485,7 @@ INITSAVEBUF
|
||||
#endif
|
||||
CopyToBuf(buf, CWanted::MaximumWantedLevel);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
#if (!defined(GTA_PS2_STUFF) && defined(RWLIBS)) || defined(__MWERKS__)
|
||||
#define WITHD3D
|
||||
#endif
|
||||
#include "config.h"
|
||||
#include "common.h"
|
||||
|
||||
@ -295,10 +298,10 @@ void CRadar::ClearBlipForEntity(eBlipType type, int32 id)
|
||||
int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
|
||||
{
|
||||
CVector2D corners[4] = {
|
||||
{ 1.0f, -1.0f }, // top right
|
||||
{ 1.0f, 1.0f }, // bottom right
|
||||
{ -1.0f, 1.0f }, // bottom left
|
||||
{ -1.0f, -1.0f }, // top left
|
||||
CVector2D( 1.0f, -1.0f ), // top right
|
||||
CVector2D( 1.0f, 1.0f ), // bottom right
|
||||
CVector2D( -1.0f, 1.0f ), // bottom left
|
||||
CVector2D( -1.0f, -1.0f ), // top left
|
||||
};
|
||||
CVector2D tmp;
|
||||
int i, j, n;
|
||||
@ -778,7 +781,7 @@ void CRadar::DrawRadarMask()
|
||||
CVector2D(-1.0, -1.0f)
|
||||
};
|
||||
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTURERASTER, (void*)nil);
|
||||
RwRenderStateSet(rwRENDERSTATEFOGENABLE, (void*)FALSE);
|
||||
RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
|
||||
RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT);
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "Sprite2d.h"
|
||||
#include "Draw.h"
|
||||
|
||||
enum eBlipType
|
||||
{
|
||||
@ -91,8 +92,28 @@ VALIDATE_SIZE(sRadarTrace, 0x30);
|
||||
#else
|
||||
#define RADAR_BOTTOM (47.0f)
|
||||
#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_HEIGHT (76.0f)
|
||||
#endif
|
||||
|
||||
class CRadar
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ public:
|
||||
static int32 NumberKillFrenziesPassed;
|
||||
static int32 PeopleKilledByOthers;
|
||||
static int32 HelisDestroyed;
|
||||
static int32 PedsKilledOfThisType[ePedType::NUM_PEDTYPES];
|
||||
static int32 PedsKilledOfThisType[NUM_PEDTYPES];
|
||||
static int32 TimesDied;
|
||||
static int32 TimesArrested;
|
||||
static int32 KillsSinceLastCheckpoint;
|
||||
|
@ -519,10 +519,18 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
||||
mi = CModelInfo::GetModelInfo(streamId);
|
||||
|
||||
// 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){
|
||||
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);
|
||||
#ifndef FIX_BUGS
|
||||
// if we're just waiting for it to load, don't remove this
|
||||
RemoveTxd(mi->GetTxdSlot());
|
||||
#endif
|
||||
ReRequestModel(streamId);
|
||||
RwStreamClose(stream, &mem);
|
||||
return false;
|
||||
@ -559,7 +567,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
||||
CTxdStore::RemoveRefWithoutDelete(mi->GetTxdSlot());
|
||||
|
||||
if(!success){
|
||||
debug("Failed to load %s\n", CModelInfo::GetModelInfo(streamId)->GetName());
|
||||
debug("Failed to load %s\n", CModelInfo::GetModelInfo(streamId)->GetModelName());
|
||||
RemoveModel(streamId);
|
||||
ReRequestModel(streamId);
|
||||
RwStreamClose(stream, &mem);
|
||||
@ -600,7 +608,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
||||
if(!success){
|
||||
ReRequestModel(streamId);
|
||||
if(streamId < STREAM_OFFSET_TXD)
|
||||
debug("Failed to load %s.dff\n", mi->GetName());
|
||||
debug("Failed to load %s.dff\n", mi->GetModelName());
|
||||
else
|
||||
debug("Failed to load %s.txd\n", CTxdStore::GetTxdName(streamId - STREAM_OFFSET_TXD));
|
||||
return false;
|
||||
@ -641,7 +649,7 @@ CStreaming::ConvertBufferToObject(int8 *buf, int32 streamId)
|
||||
timeDiff = endTime - startTime;
|
||||
if(timeDiff > 5){
|
||||
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
|
||||
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;
|
||||
if(timeDiff > 5){
|
||||
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
|
||||
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;
|
||||
|
||||
mi = CModelInfo::GetModelInfo(modelId);
|
||||
if(!CGeneral::faststrcmp(mi->GetName(), modelName)){
|
||||
if(!CGeneral::faststrcmp(mi->GetModelName(), modelName)){
|
||||
// Already have the correct name, just request it
|
||||
RequestModel(modelId, flags);
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(oldName, mi->GetName());
|
||||
mi->SetName(modelName);
|
||||
strcpy(oldName, mi->GetModelName());
|
||||
mi->SetModelName(modelName);
|
||||
|
||||
// What exactly is going on here?
|
||||
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),
|
||||
CTxdStore::GetNumRefs(modelIndex - STREAM_OFFSET_TXD), 2 * size, streamingInfo->m_flags);
|
||||
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);
|
||||
AsciiToUnicode(str, wstr);
|
||||
CFont::PrintString(24.0f, y, wstr);
|
||||
|
@ -37,6 +37,7 @@ public:
|
||||
int32 NumOfHelisRequired();
|
||||
void SetWantedLevel(int32);
|
||||
void SetWantedLevelNoDrop(int32 level);
|
||||
int32 GetWantedLevel() { return m_nWantedLevel; }
|
||||
void RegisterCrime(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
||||
void RegisterCrime_Immediately(eCrimeType type, const CVector &coors, uint32 id, bool policeDoesntCare);
|
||||
void ClearQdCrimes();
|
||||
|
@ -4,7 +4,6 @@
|
||||
#include "CopPed.h"
|
||||
#include "CutsceneMgr.h"
|
||||
#include "DMAudio.h"
|
||||
#include "Entity.h"
|
||||
#include "EventList.h"
|
||||
#include "Explosion.h"
|
||||
#include "Fire.h"
|
||||
@ -12,10 +11,7 @@
|
||||
#include "Glass.h"
|
||||
#include "Messages.h"
|
||||
#include "ModelIndices.h"
|
||||
#include "Object.h"
|
||||
#include "ParticleObject.h"
|
||||
#include "Ped.h"
|
||||
#include "PlayerPed.h"
|
||||
#include "Population.h"
|
||||
#include "ProjectileInfo.h"
|
||||
#include "Record.h"
|
||||
@ -24,7 +20,6 @@
|
||||
#include "RpAnimBlend.h"
|
||||
#include "Shadows.h"
|
||||
#include "TempColModels.h"
|
||||
#include "Vehicle.h"
|
||||
#include "WaterLevel.h"
|
||||
#include "World.h"
|
||||
|
||||
@ -785,10 +780,10 @@ CWorld::FindObjectsOfTypeInRange(uint32 modelId, const CVector &position, float
|
||||
*nEntitiesFound = 0;
|
||||
const CVector2D vecSectorStartPos(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 nStartY = Max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||
const int32 nStartX = Max(GetSectorIndexX(vecSectorStartPos.x), 0);
|
||||
const int32 nStartY = Max(GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||
const int32 nEndX = Min(GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||
CSector *pSector = GetSector(x, y);
|
||||
@ -1056,10 +1051,10 @@ CWorld::FindObjectsKindaColliding(const CVector &position, float radius, bool bC
|
||||
*nCollidingEntities = 0;
|
||||
const CVector2D vecSectorStartPos(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 nStartY = Max(CWorld::GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||
const int32 nStartX = Max(GetSectorIndexX(vecSectorStartPos.x), 0);
|
||||
const int32 nStartY = Max(GetSectorIndexY(vecSectorStartPos.y), 0);
|
||||
const int32 nEndX = Min(GetSectorIndexX(vecSectorEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(GetSectorIndexY(vecSectorEndPos.y), NUMSECTORS_Y - 1);
|
||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||
CSector *pSector = GetSector(x, y);
|
||||
@ -1135,10 +1130,10 @@ CWorld::FindObjectsIntersectingCube(const CVector &vecStartPos, const CVector &v
|
||||
{
|
||||
AdvanceCurrentScanCode();
|
||||
*nIntersecting = 0;
|
||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||
const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0);
|
||||
const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0);
|
||||
const int32 nEndX = Min(GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||
CSector *pSector = GetSector(x, y);
|
||||
@ -1216,10 +1211,10 @@ CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &boundingBox, co
|
||||
{
|
||||
AdvanceCurrentScanCode();
|
||||
*nEntitiesFound = 0;
|
||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
||||
const int32 nStartX = Max(GetSectorIndexX(fStartX), 0);
|
||||
const int32 nStartY = Max(GetSectorIndexY(fStartY), 0);
|
||||
const int32 nEndX = Min(GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||
CSector *pSector = GetSector(x, y);
|
||||
@ -1296,10 +1291,10 @@ CWorld::FindMissionEntitiesIntersectingCube(const CVector &vecStartPos, const CV
|
||||
{
|
||||
AdvanceCurrentScanCode();
|
||||
*nIntersecting = 0;
|
||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||
const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0);
|
||||
const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0);
|
||||
const int32 nEndX = Min(GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||
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 fEndX = x2 + 10.0f;
|
||||
float fEndY = y2 + 10.0f;
|
||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(fStartX), 0);
|
||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(fStartY), 0);
|
||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
||||
const int32 nStartX = Max(GetSectorIndexX(fStartX), 0);
|
||||
const int32 nStartY = Max(GetSectorIndexY(fStartY), 0);
|
||||
const int32 nEndX = Min(GetSectorIndexX(fEndX), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(GetSectorIndexY(fEndY), NUMSECTORS_Y - 1);
|
||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||
CSector *pSector = GetSector(x, y);
|
||||
@ -1854,9 +1849,9 @@ CWorld::Process(void)
|
||||
if(csObj->m_rwObject && RwObjectGetType(csObj->m_rwObject) == rpCLUMP &&
|
||||
RpAnimBlendClumpGetFirstAssociation(csObj->GetClump())) {
|
||||
RpAnimBlendClumpUpdateAnimations(csObj->GetClump(),
|
||||
0.02f * (csObj->IsObject()
|
||||
? CTimer::GetTimeStepNonClipped()
|
||||
: CTimer::GetTimeStep()));
|
||||
csObj->IsObject()
|
||||
? CTimer::GetTimeStepNonClippedInSeconds()
|
||||
: CTimer::GetTimeStepInSeconds());
|
||||
}
|
||||
csObj->ProcessControl();
|
||||
csObj->ProcessCollision();
|
||||
@ -1876,9 +1871,9 @@ CWorld::Process(void)
|
||||
#endif
|
||||
RpAnimBlendClumpGetFirstAssociation(movingEnt->GetClump())) {
|
||||
RpAnimBlendClumpUpdateAnimations(movingEnt->GetClump(),
|
||||
0.02f * (movingEnt->IsObject()
|
||||
? CTimer::GetTimeStepNonClipped()
|
||||
: CTimer::GetTimeStep()));
|
||||
movingEnt->IsObject()
|
||||
? CTimer::GetTimeStepNonClippedInSeconds()
|
||||
: CTimer::GetTimeStepInSeconds());
|
||||
}
|
||||
}
|
||||
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 vecEndPos(position.x + fRadius, position.y + fRadius);
|
||||
const int32 nStartX = Max(CWorld::GetSectorIndexX(vecStartPos.x), 0);
|
||||
const int32 nStartY = Max(CWorld::GetSectorIndexY(vecStartPos.y), 0);
|
||||
const int32 nEndX = Min(CWorld::GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(CWorld::GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||
const int32 nStartX = Max(GetSectorIndexX(vecStartPos.x), 0);
|
||||
const int32 nStartY = Max(GetSectorIndexY(vecStartPos.y), 0);
|
||||
const int32 nEndX = Min(GetSectorIndexX(vecEndPos.x), NUMSECTORS_X - 1);
|
||||
const int32 nEndY = Min(GetSectorIndexY(vecEndPos.y), NUMSECTORS_Y - 1);
|
||||
for(int32 y = nStartY; y <= nEndY; y++) {
|
||||
for(int32 x = nStartX; x <= nEndX; x++) {
|
||||
CSector *pSector = GetSector(x, y);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "Game.h"
|
||||
#include "Lists.h"
|
||||
#include "PlayerInfo.h"
|
||||
#include "Collision.h"
|
||||
|
||||
/* Sectors span from -2000 to 2000 in x and y.
|
||||
* With 100x100 sectors, each is 40x40 units. */
|
||||
@ -48,11 +49,6 @@ public:
|
||||
|
||||
VALIDATE_SIZE(CSector, 0x28);
|
||||
|
||||
class CEntity;
|
||||
struct CColPoint;
|
||||
struct CColLine;
|
||||
struct CStoredCollPoly;
|
||||
|
||||
class CWorld
|
||||
{
|
||||
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);
|
||||
|
||||
WriteSaveBuf(buffer, GetIndexForZonePointer(m_pPlayersZone));
|
||||
WriteSaveBuf(buffer, (int32)GetIndexForZonePointer(m_pPlayersZone));
|
||||
WriteSaveBuf(buffer, m_CurrLevel);
|
||||
WriteSaveBuf(buffer, FindIndex);
|
||||
WriteSaveBuf(buffer, (int16)0); // padding
|
||||
|
@ -105,8 +105,8 @@ public:
|
||||
static void SetPedGroup(uint16 zoneid, uint8 day, uint16 pedgroup);
|
||||
static int16 FindAudioZone(CVector *pos);
|
||||
static eLevelName FindZoneForPoint(const CVector &pos);
|
||||
static CZone *GetPointerForZoneIndex(int32 i) { return i == -1 ? nil : &ZoneArray[i]; }
|
||||
static int32 GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - ZoneArray; }
|
||||
static CZone *GetPointerForZoneIndex(ssize_t i) { return i == -1 ? nil : &ZoneArray[i]; }
|
||||
static ssize_t GetIndexForZonePointer(CZone *zone) { return zone == nil ? -1 : zone - ZoneArray; }
|
||||
static void AddZoneToAudioZoneArray(CZone *zone);
|
||||
static void InitialiseAudioZoneArray(void);
|
||||
static void SaveAllZones(uint8 *buffer, uint32 *length);
|
||||
|
@ -7,21 +7,47 @@
|
||||
#pragma warning(disable: 4838) // narrowing conversion
|
||||
#pragma warning(disable: 4996) // POSIX names
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#define __STDC_LIMIT_MACROS // so we get UINT32_MAX etc
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.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>
|
||||
#endif
|
||||
|
||||
#if defined _WIN32 && defined WITHD3D
|
||||
#include <windows.h>
|
||||
#ifndef USE_D3D9
|
||||
#include <d3d8types.h>
|
||||
#else
|
||||
#include <d3d9types.h>
|
||||
#ifdef WITHD3D
|
||||
#ifdef LIBRW
|
||||
#define WITH_D3D // librw includes d3d9 itself via this right now
|
||||
#else
|
||||
#ifndef USE_D3D9
|
||||
#include <d3d8.h>
|
||||
#else
|
||||
#include <d3d9.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef WITHDINPUT
|
||||
#define DIRECTINPUT_VERSION 0x0800
|
||||
#include <dinput.h>
|
||||
#endif
|
||||
|
||||
#include <rwcore.h>
|
||||
@ -52,14 +78,6 @@
|
||||
|
||||
#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 Min(a,b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
@ -70,8 +88,13 @@ typedef uint8_t uint8;
|
||||
typedef int8_t int8;
|
||||
typedef uint16_t uint16;
|
||||
typedef int16_t int16;
|
||||
#ifndef __MWERKS__
|
||||
typedef uint32_t uint32;
|
||||
typedef int32_t int32;
|
||||
#else
|
||||
typedef unsigned int uint32;
|
||||
typedef int int32;
|
||||
#endif
|
||||
typedef uintptr_t uintptr;
|
||||
typedef intptr_t intptr;
|
||||
typedef uint64_t uint64;
|
||||
@ -113,6 +136,11 @@ inline float _floatswap32(float f)
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
typedef uint8 bool8;
|
||||
typedef uint16 bool16;
|
||||
typedef uint32 bool32;
|
||||
|
||||
#if defined(_MSC_VER) || defined (__MWERKS__)
|
||||
typedef ptrdiff_t ssize_t;
|
||||
#endif
|
||||
|
||||
@ -154,7 +182,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
||||
#include "skeleton.h"
|
||||
#include "Draw.h"
|
||||
|
||||
#if defined(USE_PROPER_SCALING)
|
||||
#if defined(PROPER_SCALING) || defined(PS2_HUD)
|
||||
#ifdef FORCE_PC_SCALING
|
||||
#define DEFAULT_SCREEN_WIDTH (640)
|
||||
#define DEFAULT_SCREEN_HEIGHT (448)
|
||||
@ -188,8 +216,8 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
|
||||
#define SCREEN_HEIGHT ((float)RsGlobal.height)
|
||||
#endif
|
||||
|
||||
#define SCREEN_HEIGHT_PAL (512)
|
||||
#define SCREEN_HEIGHT_NTSC (448)
|
||||
#define SCREEN_HEIGHT_PAL ((float)512)
|
||||
#define SCREEN_HEIGHT_NTSC ((float)448)
|
||||
|
||||
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
|
||||
#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
|
||||
#define SCREEN_SCALE_AR(a) ((a) * DEFAULT_ASPECT_RATIO / SCREEN_ASPECT_RATIO)
|
||||
extern float ScaleAndCenterX(float x);
|
||||
#define SCALE_AND_CENTER_X(x) ScaleAndCenterX(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)))
|
||||
#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
|
||||
#define SCREEN_SCALE_AR(a) (a)
|
||||
#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; }
|
||||
#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 TWOPI (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__)
|
||||
#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 TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, 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__)
|
||||
#else
|
||||
#define TRACE(f, ...)
|
||||
#define USERERROR(f, ...)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#undef assert
|
||||
#ifndef MASTER
|
||||
#define assert(_Expression) (void)( (!!(_Expression)) || (re3_assert(#_Expression, __FILE__, __LINE__, __FUNCTION__), 0) )
|
||||
#else
|
||||
#define assert(_Expression)
|
||||
#endif
|
||||
#define ASSERT assert
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#define static_assert(bool_constexpr, message)
|
||||
#endif
|
||||
|
||||
#define _TODO(x)
|
||||
#define _TODOCONST(x) (x)
|
||||
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
#define VALIDATE_SIZE(struc, size) static_assert(sizeof(struc) == size, "Invalid structure size of " #struc)
|
||||
#ifdef CHECK_STRUCT_SIZES
|
||||
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
|
||||
#define VALIDATE_SIZE(struc, size)
|
||||
#endif
|
||||
@ -351,6 +423,7 @@ void re3_usererror(const char *format, ...);
|
||||
#define CONCAT_(x,y) x##y
|
||||
#define CONCAT(x,y) CONCAT_(x,y)
|
||||
|
||||
#ifdef DEBUGMENU
|
||||
// Tweaking stuff for debugmenu
|
||||
#define TWEAKPATH ___tw___TWEAKPATH
|
||||
#define SETTWEAKPATH(path) static const char *___tw___TWEAKPATH = path;
|
||||
@ -464,6 +537,7 @@ _TWEEKCLASS(CTweakUInt32, uint32);
|
||||
_TWEEKCLASS(CTweakFloat, float);
|
||||
|
||||
#undef _TWEEKCLASS
|
||||
#endif
|
||||
|
||||
#ifdef VALIDATE_SAVE_SIZE
|
||||
extern int32 _saveBufCount;
|
||||
|
@ -1,5 +1,8 @@
|
||||
#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 {
|
||||
NUMPLAYERS = 1, // 4 on PS2
|
||||
|
||||
@ -8,8 +11,11 @@ enum Config {
|
||||
MAX_CDCHANNELS = 5,
|
||||
|
||||
MODELINFOSIZE = 5500, // 3150 on PS2
|
||||
// TXDSTORESIZE = 850,
|
||||
#if defined __MWERKS__ || defined VANILLA_DEFINES
|
||||
TXDSTORESIZE = 850,
|
||||
#else
|
||||
TXDSTORESIZE = 1024, // for Xbox map
|
||||
#endif
|
||||
EXTRADIRSIZE = 128,
|
||||
CUTSCENEDIRSIZE = 512,
|
||||
|
||||
@ -228,11 +234,21 @@ enum Config {
|
||||
# define TIMEBARS // print debug timers
|
||||
#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 COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
|
||||
#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
|
||||
#ifdef DEBUGMENU
|
||||
#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.
|
||||
// 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 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 USE_TXD_CDIMAGE // generate and load textures from txd.img
|
||||
#define PS2_ALPHA_TEST // emulate ps2 alpha test
|
||||
#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_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
|
||||
#ifdef LIBRW
|
||||
#ifndef __WIIU__
|
||||
#define EXTENDED_COLOURFILTER // more options for colour filter (replaces mblur)
|
||||
#define EXTENDED_PIPELINES // custom render pipelines (includes Neo)
|
||||
#define SCREEN_DROPLETS // neo water droplets
|
||||
#define NEW_RENDERER // leeds-like world rendering, needs librw
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define FIX_SPRITES // fix sprites aspect ratio(moon, coronas, particle etc)
|
||||
|
||||
#ifndef EXTENDED_COLOURFILTER
|
||||
#undef SCREEN_DROPLETS // we need the backbuffer for this effect
|
||||
#endif
|
||||
@ -286,6 +307,7 @@ enum Config {
|
||||
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
|
||||
// #define BETA_SLIDING_TEXT
|
||||
#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 RADIO_OFF_TEXT
|
||||
#define PC_MENU
|
||||
@ -328,6 +350,11 @@ enum Config {
|
||||
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||
#endif
|
||||
|
||||
#ifdef MASTER
|
||||
#undef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
|
||||
#undef USE_BASIC_SCRIPT_DEBUG_OUTPUT
|
||||
#endif
|
||||
|
||||
// Replay
|
||||
//#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!)
|
||||
@ -355,11 +382,22 @@ enum Config {
|
||||
|
||||
// Audio
|
||||
#define RADIO_SCROLL_TO_PREV_STATION
|
||||
#ifndef AUDIO_OAL // is not working yet for openal
|
||||
#define AUDIO_CACHE // cache sound lengths to speed up the cold boot
|
||||
#endif
|
||||
//#define PS2_AUDIO // changes audio paths for cutscenes and radio to PS2 paths, needs vbdec to support VB with MSS
|
||||
#define AUDIO_CACHE
|
||||
//#define PS2_AUDIO_PATHS // changes audio paths for cutscenes and radio to PS2 paths (needs vbdec on MSS builds)
|
||||
//#define AUDIO_OAL_USE_SNDFILE // use libsndfile to decode WAVs instead of our internal decoder
|
||||
#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
|
||||
#define BIG_IMG // allows to read larger img files
|
||||
|
||||
@ -369,8 +407,91 @@ enum Config {
|
||||
#undef NO_ISLAND_LOADING
|
||||
#define PC_PARTICLE
|
||||
#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
|
||||
|
||||
#ifdef LIBRW
|
||||
// these are not supported with librw yet
|
||||
#if defined __MWERKS__ || defined VANILLA_DEFINES
|
||||
#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
|
||||
|
@ -3,6 +3,9 @@
|
||||
#include "rphanim.h"
|
||||
#include "rpskin.h"
|
||||
#include "rtbmp.h"
|
||||
#ifdef ANISOTROPIC_FILTERING
|
||||
#include "rpanisot.h"
|
||||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "CdStream.h"
|
||||
@ -121,6 +124,31 @@ bool gbPrintMemoryUsage;
|
||||
#define FOUND_GAME_TO_LOAD b_FoundRecentSavedGameWantToLoad
|
||||
#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
|
||||
ValidateVersion()
|
||||
{
|
||||
@ -168,7 +196,7 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
|
||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
||||
#endif
|
||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
|
||||
RwCameraClear(Scene.camera, &TopColor.rwRGBA, CLEARMODE);
|
||||
|
||||
if(!RsCameraBeginUpdate(Scene.camera))
|
||||
return false;
|
||||
@ -190,7 +218,7 @@ DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16
|
||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
|
||||
#endif
|
||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
||||
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||
|
||||
if(!RsCameraBeginUpdate(Scene.camera))
|
||||
return false;
|
||||
@ -407,6 +435,9 @@ PluginAttach(void)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#ifdef ANISOTROPIC_FILTERING
|
||||
RpAnisotPluginAttach();
|
||||
#endif
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
CustomPipes::CustomPipeRegister();
|
||||
#endif
|
||||
@ -850,6 +881,7 @@ ProcessSlowMode(void)
|
||||
float FramesPerSecondCounter;
|
||||
int32 FrameSamples;
|
||||
|
||||
#ifndef MASTER
|
||||
struct tZonePrint
|
||||
{
|
||||
char name[12];
|
||||
@ -870,8 +902,6 @@ tZonePrint ZonePrint[] =
|
||||
{ "no zone", CRect( 0.0f, 0.0f, 0.0f, 0.0f) }
|
||||
};
|
||||
|
||||
#ifndef MASTER
|
||||
|
||||
void
|
||||
PrintMemoryUsage(void)
|
||||
{
|
||||
@ -1160,9 +1190,126 @@ DisplayGameDebugText()
|
||||
}
|
||||
#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
|
||||
RenderScene(void)
|
||||
{
|
||||
#ifdef NEW_RENDERER
|
||||
if(gbNewRenderer){
|
||||
RenderScene_new();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
CClouds::Render();
|
||||
DoRWRenderHorizon();
|
||||
CRenderer::RenderRoads();
|
||||
@ -1195,6 +1342,12 @@ RenderDebugShit(void)
|
||||
void
|
||||
RenderEffects(void)
|
||||
{
|
||||
#ifdef NEW_RENDERER
|
||||
if(gbNewRenderer){
|
||||
RenderEffects_new();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
CGlass::Render();
|
||||
CWaterCannons::Render();
|
||||
CSpecialFX::Render();
|
||||
@ -1390,6 +1543,12 @@ Idle(void *arg)
|
||||
|
||||
PUSH_MEMID(MEMID_RENDERLIST);
|
||||
tbStartTimer(0, "CnstrRenderList");
|
||||
#ifdef NEW_RENDERER
|
||||
if(gbNewRenderer){
|
||||
CWorld::AdvanceCurrentScanCode(); // don't think this is even necessary
|
||||
CRenderer::ClearForFrame();
|
||||
}
|
||||
#endif
|
||||
CRenderer::ConstructRenderList();
|
||||
tbEndTimer("CnstrRenderList");
|
||||
|
||||
@ -1457,7 +1616,7 @@ Idle(void *arg)
|
||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||
#endif
|
||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
||||
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||
if(!RsCameraBeginUpdate(Scene.camera))
|
||||
goto popret;
|
||||
}
|
||||
@ -1523,7 +1682,7 @@ FrontendIdle(void)
|
||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||
#endif
|
||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
||||
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||
if(!RsCameraBeginUpdate(Scene.camera))
|
||||
return;
|
||||
|
||||
@ -1780,7 +1939,7 @@ void TheGame(void)
|
||||
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
|
||||
#endif
|
||||
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
|
||||
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
|
||||
RwCameraClear(Scene.camera, &gColourTop, CLEARMODE);
|
||||
RsCameraBeginUpdate(Scene.camera);
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,13 @@ void TheModelViewer(void);
|
||||
#endif
|
||||
|
||||
#ifdef LOAD_INI_SETTINGS
|
||||
void LoadINISettings();
|
||||
bool LoadINISettings();
|
||||
void SaveINISettings();
|
||||
void LoadINIControllerSettings();
|
||||
void SaveINIControllerSettings();
|
||||
#endif
|
||||
|
||||
#ifdef NEW_RENDERER
|
||||
extern bool gbNewRenderer;
|
||||
bool FredIsInFirstPersonCam(void);
|
||||
#endif
|
||||
|
482
src/core/re3.cpp
482
src/core/re3.cpp
@ -1,7 +1,6 @@
|
||||
#include <csignal>
|
||||
#define WITHWINDOWS
|
||||
#include "common.h"
|
||||
#include "crossplatform.h"
|
||||
#include "Renderer.h"
|
||||
#include "Credits.h"
|
||||
#include "Camera.h"
|
||||
@ -31,9 +30,12 @@
|
||||
#include "custompipes.h"
|
||||
#include "MemoryHeap.h"
|
||||
#include "FileMgr.h"
|
||||
#include "Camera.h"
|
||||
#include "MBlur.h"
|
||||
#include "ControllerConfig.h"
|
||||
|
||||
#ifdef DONT_TRUST_RECOGNIZED_JOYSTICKS
|
||||
#include "ControllerConfig.h"
|
||||
#include "crossplatform.h"
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
@ -92,16 +94,16 @@ CustomFrontendOptionsPopulate(void)
|
||||
if (fd) {
|
||||
#ifdef GRAPHICS_MENU_OPTIONS
|
||||
FrontendOptionSetCursor(MENUPAGE_GRAPHICS_SETTINGS, -3, false);
|
||||
FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
|
||||
FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
|
||||
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
|
||||
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
|
||||
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, "Graphics", "NeoRimLight");
|
||||
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
|
||||
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
|
||||
#else
|
||||
FrontendOptionSetCursor(MENUPAGE_DISPLAY_SETTINGS, -3, false);
|
||||
FrontendOptionAddSelect("FED_VPL", vehPipelineNames, ARRAY_SIZE(vehPipelineNames), (int8*)&CustomPipes::VehiclePipeSwitch, false, nil, "VehiclePipeline");
|
||||
FrontendOptionAddSelect("FED_PRM", off_on, 2, (int8*)&CustomPipes::RimlightEnable, false, nil, "NeoRimLight");
|
||||
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "NeoLightMaps");
|
||||
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "NeoRoadGloss");
|
||||
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, "Graphics", "NeoRimLight");
|
||||
FrontendOptionAddSelect("FED_WLM", off_on, 2, (int8*)&CustomPipes::LightmapEnable, false, nil, "Graphics", "NeoLightMaps");
|
||||
FrontendOptionAddSelect("FED_RGL", off_on, 2, (int8*)&CustomPipes::GlossEnable, false, nil, "Graphics", "NeoRoadGloss");
|
||||
#endif
|
||||
CFileMgr::CloseFile(fd);
|
||||
}
|
||||
@ -114,82 +116,303 @@ CustomFrontendOptionsPopulate(void)
|
||||
#include "ini_parser.hpp"
|
||||
|
||||
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();
|
||||
if (value && value[0] != '\0')
|
||||
return atoi(value);
|
||||
|
||||
return original;
|
||||
char *endPtr;
|
||||
if (value && value[0] != '\xBA') {
|
||||
*out = strtoul(value, &endPtr, 0);
|
||||
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();
|
||||
if (value && value[0] != '\0')
|
||||
return atof(value);
|
||||
|
||||
return original;
|
||||
char *endPtr;
|
||||
if (value && value[0] != '\xBA') {
|
||||
*out = strtoul(value, &endPtr, 0);
|
||||
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];
|
||||
if (atoi(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
|
||||
changed = true;
|
||||
sprintf(temp, "%u", val);
|
||||
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];
|
||||
if (atof(cfg.get(cat, key, "xxx").c_str()) != val) { // if .ini doesn't have our key, compare with xxx and forcefully add it
|
||||
changed = true;
|
||||
sprintf(temp, "%f", val);
|
||||
cfg.set(cat, key, temp);
|
||||
}
|
||||
sprintf(temp, "%u", (uint32)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
|
||||
// Written by assuming the codes below will run after _InputInitialiseJoys().
|
||||
strcpy(gSelectedJoystickName, cfg.get("DetectJoystick", "JoystickName", "").c_str());
|
||||
|
||||
if(gSelectedJoystickName[0] != '\0') {
|
||||
for (int i = 0; i <= GLFW_JOYSTICK_LAST; i++) {
|
||||
if (glfwJoystickPresent(i) && strncmp(gSelectedJoystickName, glfwGetJoystickName(i), strlen(gSelectedJoystickName)) == 0) {
|
||||
if (PSGLOBAL(joy1id) != -1) {
|
||||
PSGLOBAL(joy2id) = PSGLOBAL(joy1id);
|
||||
ReadIniIfExists("Controller", "JoystickName", gSelectedJoystickName, 128);
|
||||
#endif
|
||||
// force to default GTA behaviour (never overwrite bindings on joy change/initialization) if user init'ed/set bindings before we introduced that
|
||||
if (!ReadIniIfExists("Controller", "PadButtonsInited", &ControlsManager.ms_padButtonsInited)) {
|
||||
ControlsManager.ms_padButtonsInited = cfg.category_size("Bindings") != 0 ? 16 : 0;
|
||||
}
|
||||
|
||||
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;
|
||||
// 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;
|
||||
ControlsManager.SetControllerKeyAssociatedWithAction((e_ControllerAction)i, contKey, (eControllerType)contType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
bool migrate = cfg.category_size("FrontendOptions") != 0;
|
||||
for (int i = 0; i < MENUPAGES; i++) {
|
||||
for (int j = 0; j < NUM_MENUROWS; j++) {
|
||||
CMenuScreenCustom::CMenuEntry &option = aScreens[i].m_aEntries[j];
|
||||
@ -199,7 +422,13 @@ void LoadINISettings()
|
||||
// CFO check
|
||||
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
|
||||
// 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) {
|
||||
option.m_CFOSelect->lastSavedValue = option.m_CFOSelect->displayedValue = *option.m_CFO->value;
|
||||
}
|
||||
@ -208,28 +437,61 @@ void LoadINISettings()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
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
|
||||
return true;
|
||||
}
|
||||
|
||||
void SaveINISettings()
|
||||
{
|
||||
bool changed = false;
|
||||
char temp[4];
|
||||
#ifdef IMPROVED_VIDEOMODE
|
||||
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
|
||||
if (strncmp(cfg.get("DetectJoystick", "JoystickName", "").c_str(), gSelectedJoystickName, strlen(gSelectedJoystickName)) != 0) {
|
||||
changed = true;
|
||||
cfg.set("DetectJoystick", "JoystickName", gSelectedJoystickName);
|
||||
}
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
StoreIni("CustomPipesValues", "PostFXIntensity", CPostFX::Intensity);
|
||||
#endif
|
||||
#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
|
||||
#ifdef CUSTOM_FRONTEND_OPTIONS
|
||||
for (int i = 0; i < MENUPAGES; i++) {
|
||||
@ -240,25 +502,13 @@ void SaveINISettings()
|
||||
|
||||
if (option.m_Action < MENUACTION_NOTHING && option.m_CFO->save) {
|
||||
// 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
|
||||
|
||||
#ifdef EXTENDED_COLOURFILTER
|
||||
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");
|
||||
cfg.write_file("re3.ini");
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -563,6 +813,30 @@ DebugMenuPopulate(void)
|
||||
DebugMenuAddVarBool8("Render", "Frame limiter", &FrontEndMenuManager.m_PrefsFrameLimiter, nil);
|
||||
DebugMenuAddVarBool8("Render", "VSynch", &FrontEndMenuManager.m_PrefsVsync, nil);
|
||||
DebugMenuAddVar("Render", "Max FPS", &RsGlobal.maxFPS, nil, 1, 1, 1000, nil);
|
||||
#ifdef 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
|
||||
static const char *filternames[] = { "None", "Simple", "Normal", "Mobile" };
|
||||
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 Objects", &gbDontRenderObjects, 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
|
||||
DebugMenuAddVarBool8("Debug", "Print Memory Usage", &gbPrintMemoryUsage, nil);
|
||||
@ -654,7 +940,7 @@ DebugMenuPopulate(void)
|
||||
"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);
|
||||
DebugMenuAddCmd("Debug", "Start selected mission ", SwitchToMission);
|
||||
#endif
|
||||
@ -678,9 +964,13 @@ DebugMenuPopulate(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef __MWERKS__
|
||||
#ifndef MASTER
|
||||
const int re3_buffsize = 1024;
|
||||
static char re3_buff[re3_buffsize];
|
||||
#endif
|
||||
|
||||
#ifndef MASTER
|
||||
void re3_assert(const char *expr, const char *filename, unsigned int lineno, const char *func)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
@ -737,9 +1027,11 @@ void re3_assert(const char *expr, const char *filename, unsigned int lineno, con
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void re3_debug(const char *format, ...)
|
||||
{
|
||||
#ifndef MASTER
|
||||
va_list va;
|
||||
va_start(va, format);
|
||||
#ifdef _WIN32
|
||||
@ -755,8 +1047,10 @@ void re3_debug(const char *format, ...)
|
||||
printf("%s", re3_buff);
|
||||
#endif
|
||||
CDebug::DebugAddText(re3_buff);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef MASTER
|
||||
void re3_trace(const char *filename, unsigned int lineno, const char *func, const char *format, ...)
|
||||
{
|
||||
char buff[re3_buffsize *2];
|
||||
@ -776,7 +1070,9 @@ void re3_trace(const char *filename, unsigned int lineno, const char *func, cons
|
||||
|
||||
OutputDebugString(buff);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef MASTER
|
||||
void re3_usererror(const char *format, ...)
|
||||
{
|
||||
va_list va;
|
||||
@ -800,6 +1096,8 @@ void re3_usererror(const char *format, ...)
|
||||
assert(false);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef VALIDATE_SAVE_SIZE
|
||||
int32 _saveBufCount;
|
||||
|
@ -29,45 +29,59 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#define POOLFLAG_ID 0x7f
|
||||
#define POOLFLAG_ISFREE 0x80
|
||||
|
||||
template<typename T, typename U = T>
|
||||
class CPool
|
||||
{
|
||||
U *m_entries;
|
||||
union 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;
|
||||
uint8 *m_flags;
|
||||
int32 m_size;
|
||||
int32 m_allocPtr;
|
||||
|
||||
public:
|
||||
CPool(int32 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_allocPtr = 0;
|
||||
for(int i = 0; i < size; i++){
|
||||
m_flags[i].id = 0;
|
||||
m_flags[i].free = 1;
|
||||
SetId(i, 0);
|
||||
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() {
|
||||
Flush();
|
||||
}
|
||||
void Flush() {
|
||||
if (m_size > 0) {
|
||||
delete[] (uint8*)m_entries;
|
||||
delete[] (uint8*)m_flags;
|
||||
delete[] m_flags;
|
||||
m_entries = nil;
|
||||
m_flags = nil;
|
||||
m_size = 0;
|
||||
@ -93,9 +107,9 @@ public:
|
||||
m_allocPtr = 0;
|
||||
}
|
||||
#endif
|
||||
while(!m_flags[m_allocPtr].free);
|
||||
m_flags[m_allocPtr].free = 0;
|
||||
m_flags[m_allocPtr].id++;
|
||||
while(!GetIsFree(m_allocPtr));
|
||||
SetIsFree(m_allocPtr, false);
|
||||
SetId(m_allocPtr, GetId(m_allocPtr)+1);
|
||||
return (T*)&m_entries[m_allocPtr];
|
||||
}
|
||||
T *New(int32 handle){
|
||||
@ -105,36 +119,36 @@ public:
|
||||
}
|
||||
void SetNotFreeAt(int32 handle){
|
||||
int idx = handle>>8;
|
||||
m_flags[idx].free = 0;
|
||||
m_flags[idx].id = handle & 0x7F;
|
||||
SetIsFree(idx, false);
|
||||
SetId(idx, handle & POOLFLAG_ID);
|
||||
for(m_allocPtr = 0; m_allocPtr < m_size; m_allocPtr++)
|
||||
if(m_flags[m_allocPtr].free)
|
||||
if(GetIsFree(m_allocPtr))
|
||||
return;
|
||||
}
|
||||
void Delete(T *entry){
|
||||
int i = GetJustIndex(entry);
|
||||
m_flags[i].free = 1;
|
||||
SetIsFree(i, true);
|
||||
if(i < m_allocPtr)
|
||||
m_allocPtr = 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){
|
||||
#ifdef FIX_BUGS
|
||||
if (handle == -1)
|
||||
return nil;
|
||||
#endif
|
||||
return m_flags[handle>>8].u == (handle & 0xFF) ?
|
||||
return m_flags[handle>>8] == (handle & 0xFF) ?
|
||||
(T*)&m_entries[handle >> 8] : nil;
|
||||
}
|
||||
int32 GetIndex(T *entry){
|
||||
int i = GetJustIndex_NoFreeAssert(entry);
|
||||
return m_flags[i].u + (i<<8);
|
||||
return m_flags[i] + (i<<8);
|
||||
}
|
||||
int32 GetJustIndex(T *entry){
|
||||
int index = GetJustIndex_NoFreeAssert(entry);
|
||||
assert(!IsFreeSlot(index));
|
||||
assert(!GetIsFree(index));
|
||||
return index;
|
||||
}
|
||||
int32 GetJustIndex_NoFreeAssert(T* entry){
|
||||
@ -146,13 +160,12 @@ public:
|
||||
int i;
|
||||
int n = 0;
|
||||
for(i = 0; i < m_size; i++)
|
||||
if(!m_flags[i].free)
|
||||
if(!GetIsFree(i))
|
||||
n++;
|
||||
return n;
|
||||
}
|
||||
bool IsFreeSlot(int i) { return !!m_flags[i].free; }
|
||||
void ClearStorage(uint8 *&flags, U *&entries){
|
||||
delete[] (uint8*)flags;
|
||||
delete[] flags;
|
||||
delete[] (uint8*)entries;
|
||||
flags = nil;
|
||||
entries = nil;
|
||||
@ -161,7 +174,7 @@ public:
|
||||
void CopyBack(uint8 *&flags, U *&entries){
|
||||
memcpy(m_flags, flags, sizeof(uint8)*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;
|
||||
ClearStorage(flags, entries);
|
||||
debug("CopyBack:%d (/%d)\n", GetNoOfUsedSpaces(), m_size); /* Assumed inlining */
|
||||
|
@ -139,6 +139,7 @@ CEntity::DetachFromRwObject(void)
|
||||
m_matrix.Detach();
|
||||
}
|
||||
|
||||
#ifdef PED_SKIN
|
||||
RpAtomic*
|
||||
AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data)
|
||||
{
|
||||
@ -158,6 +159,7 @@ AtomicRemoveAnimFromSkinCB(RpAtomic *atomic, void *data)
|
||||
}
|
||||
return atomic;
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
CEntity::DeleteRwObject(void)
|
||||
@ -228,12 +230,8 @@ CEntity::GetBoundRadius(void)
|
||||
void
|
||||
CEntity::UpdateRwFrame(void)
|
||||
{
|
||||
if(m_rwObject){
|
||||
if(RwObjectGetType(m_rwObject) == rpATOMIC)
|
||||
RwFrameUpdateObjects(RpAtomicGetFrame((RpAtomic*)m_rwObject));
|
||||
else if(RwObjectGetType(m_rwObject) == rpCLUMP)
|
||||
RwFrameUpdateObjects(RpClumpGetFrame((RpClump*)m_rwObject));
|
||||
}
|
||||
if(m_rwObject)
|
||||
RwFrameUpdateObjects((RwFrame*)rwObjectGetParent(m_rwObject));
|
||||
}
|
||||
|
||||
#ifdef PED_SKIN
|
||||
@ -409,7 +407,11 @@ CEntity::GetIsOnScreen(void)
|
||||
bool
|
||||
CEntity::GetIsOnScreenComplex(void)
|
||||
{
|
||||
RwV3d boundBox[8];
|
||||
#ifdef GTA_PS2
|
||||
CVuVector boundBox[8];
|
||||
#else
|
||||
CVector boundBox[8];
|
||||
#endif
|
||||
|
||||
if(TheCamera.IsPointVisible(GetBoundCentre(), &TheCamera.GetCameraMatrix()))
|
||||
return true;
|
||||
@ -586,7 +588,7 @@ CEntity::SetupBigBuilding(void)
|
||||
if(m_level == LEVEL_GENERIC){
|
||||
if(mi->GetTxdSlot() != CTxdStore::FindTxdSlot("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)
|
||||
|
@ -303,14 +303,15 @@ CPhysical::GetHasCollidedWith(CEntity *ent)
|
||||
void
|
||||
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){
|
||||
for(j = i; j < m_nCollisionRecords-1; j++)
|
||||
m_aCollisionRecords[j] = m_aCollisionRecords[j+1];
|
||||
m_nCollisionRecords--;
|
||||
}
|
||||
} else
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -518,13 +519,12 @@ CPhysical::ApplyAirResistance(void)
|
||||
m_vecMoveSpeed *= f;
|
||||
m_vecTurnSpeed *= f;
|
||||
}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_vecTurnSpeed *= 0.99f;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
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)
|
||||
pointposB *= 0.8f;
|
||||
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->ApplyFrictionTurnForce(fB*-0.3f, pointposB);
|
||||
#else
|
||||
A->ApplyFrictionMoveForce(fB*-0.3f);
|
||||
A->ApplyFrictionTurnForce(fB*-0.3f, pointposB);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if(!A->bInfiniteMass){
|
||||
@ -881,14 +885,24 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
|
||||
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
||||
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
||||
|
||||
#ifdef FIX_BUGS // division by 0
|
||||
frictionDir = vOtherSpeedA;
|
||||
frictionDir.Normalise();
|
||||
#else
|
||||
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
||||
#endif
|
||||
|
||||
speedSum = (B->m_fMass*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(B->m_fMass + A->m_fMass);
|
||||
if(fOtherSpeedA > speedSum){
|
||||
impulseA = (speedSum - fOtherSpeedA) * A->m_fMass;
|
||||
impulseB = (speedSum - fOtherSpeedB) * B->m_fMass;
|
||||
impulseLimit = adhesiveLimit*CTimer::GetTimeStep();
|
||||
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);
|
||||
B->ApplyFrictionMoveForce(frictionDir*impulseB);
|
||||
return true;
|
||||
@ -907,7 +921,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
|
||||
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
||||
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
||||
|
||||
#ifdef FIX_BUGS // division by 0
|
||||
frictionDir = vOtherSpeedA;
|
||||
frictionDir.Normalise();
|
||||
#else
|
||||
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
||||
#endif
|
||||
float massB = B->GetMass(pointposB, frictionDir);
|
||||
speedSum = (massB*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(massB + A->m_fMass);
|
||||
if(fOtherSpeedA > speedSum){
|
||||
@ -935,7 +954,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
|
||||
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
||||
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
||||
|
||||
#ifdef FIX_BUGS // division by 0
|
||||
frictionDir = vOtherSpeedA;
|
||||
frictionDir.Normalise();
|
||||
#else
|
||||
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
||||
#endif
|
||||
float massA = A->GetMass(pointposA, frictionDir);
|
||||
speedSum = (B->m_fMass*fOtherSpeedB + massA*fOtherSpeedA)/(B->m_fMass + massA);
|
||||
if(fOtherSpeedA > speedSum){
|
||||
@ -963,7 +987,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
|
||||
fOtherSpeedA = vOtherSpeedA.Magnitude();
|
||||
fOtherSpeedB = vOtherSpeedB.Magnitude();
|
||||
|
||||
#ifdef FIX_BUGS // division by 0
|
||||
frictionDir = vOtherSpeedA;
|
||||
frictionDir.Normalise();
|
||||
#else
|
||||
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
|
||||
#endif
|
||||
float massA = A->GetMass(pointposA, frictionDir);
|
||||
float massB = B->GetMass(pointposB, frictionDir);
|
||||
speedSum = (massB*fOtherSpeedB + massA*fOtherSpeedA)/(massB + massA);
|
||||
@ -1000,7 +1029,12 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
|
||||
|
||||
fOtherSpeed = vOtherSpeed.Magnitude();
|
||||
if(fOtherSpeed > 0.0f){
|
||||
#ifdef FIX_BUGS // division by 0
|
||||
frictionDir = vOtherSpeed;
|
||||
frictionDir.Normalise();
|
||||
#else
|
||||
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
|
||||
#endif
|
||||
// not really impulse but speed
|
||||
// maybe use ApplyFrictionMoveForce instead?
|
||||
fImpulse = -fOtherSpeed;
|
||||
@ -1018,9 +1052,14 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
|
||||
|
||||
fOtherSpeed = vOtherSpeed.Magnitude();
|
||||
if(fOtherSpeed > 0.0f){
|
||||
#ifdef FIX_BUGS // division by 0
|
||||
frictionDir = vOtherSpeed;
|
||||
frictionDir.Normalise();
|
||||
#else
|
||||
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
|
||||
#endif
|
||||
fImpulse = -fOtherSpeed * m_fMass;
|
||||
impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5f;
|
||||
impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5;
|
||||
if(fImpulse < -impulseLimit) fImpulse = -impulseLimit;
|
||||
ApplyFrictionMoveForce(frictionDir*fImpulse);
|
||||
ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos);
|
||||
@ -1053,7 +1092,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||
int numCollisions;
|
||||
int mostColliding;
|
||||
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;
|
||||
CEntity *boat = nil;
|
||||
|
||||
@ -1111,7 +1150,8 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||
skipShift = true;
|
||||
Aobj->m_pCollidingEntity = B;
|
||||
}
|
||||
}
|
||||
} else
|
||||
skipShift = true;
|
||||
}else if(B->IsObject() && A->IsVehicle()){
|
||||
CObject *Bobj = (CObject*)B;
|
||||
if(Bobj->ObjectCreatedBy != TEMP_OBJECT &&
|
||||
@ -1126,7 +1166,8 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
|
||||
if(size.z < A->GetPosition().z ||
|
||||
(Invert(A->GetMatrix(), inv) * size).z < 0.0f)
|
||||
skipShift = true;
|
||||
}
|
||||
} else
|
||||
skipShift = true;
|
||||
}else if(IsBodyPart(A->GetModelIndex()) && B->IsPed())
|
||||
skipShift = true;
|
||||
else if(A->IsPed() && IsBodyPart(B->GetModelIndex()))
|
||||
@ -1498,8 +1539,8 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
|
||||
if(numCollisions <= 0)
|
||||
continue;
|
||||
|
||||
CVector moveSpeed = { 0.0f, 0.0f, 0.0f };
|
||||
CVector turnSpeed = { 0.0f, 0.0f, 0.0f };
|
||||
CVector moveSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||
CVector turnSpeed = CVector(0.0f, 0.0f, 0.0f);
|
||||
numResponses = 0;
|
||||
if(A->bHasContacted){
|
||||
for(i = 0; i < numCollisions; i++){
|
||||
@ -1858,8 +1899,8 @@ CPhysical::ProcessCollision(void)
|
||||
}else if(IsObject()){
|
||||
int responsecase = ((CObject*)this)->m_nSpecialCollisionResponseCases;
|
||||
if(responsecase == COLLRESPONSE_LAMPOST){
|
||||
CVector speedUp = { 0.0f, 0.0f, 0.0f };
|
||||
CVector speedDown = { 0.0f, 0.0f, 0.0f };
|
||||
CVector speedUp = CVector(0.0f, 0.0f, 0.0f);
|
||||
CVector speedDown = CVector(0.0f, 0.0f, 0.0f);
|
||||
speedUp.z = GetBoundRadius();
|
||||
speedDown.z = -speedUp.z;
|
||||
speedUp = Multiply3x3(GetMatrix(), speedUp);
|
||||
|
@ -1,4 +1,4 @@
|
||||
#define WITH_D3D
|
||||
#define WITHD3D
|
||||
#include "common.h"
|
||||
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
#ifdef LIBRW
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
||||
namespace CustomPipes {
|
||||
|
||||
@ -134,4 +134,12 @@ void AttachRimPipe(rw::Clump *clump);
|
||||
}
|
||||
|
||||
#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
|
||||
|
@ -1,9 +1,7 @@
|
||||
#define WITH_D3D
|
||||
#define WITHD3D
|
||||
#include "common.h"
|
||||
|
||||
#ifdef RW_D3D9
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
||||
#include "main.h"
|
||||
#include "RwHelper.h"
|
||||
#include "Lights.h"
|
||||
@ -16,6 +14,8 @@
|
||||
#include "World.h"
|
||||
#include "custompipes.h"
|
||||
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
||||
#ifndef LIBRW
|
||||
#error "Need librw for EXTENDED_PIPELINES"
|
||||
#endif
|
||||
@ -553,4 +553,168 @@ DestroyRimLightPipes(void)
|
||||
}
|
||||
|
||||
#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
|
||||
|
@ -1,8 +1,6 @@
|
||||
#include "common.h"
|
||||
|
||||
#ifdef RW_OPENGL
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
||||
#include "main.h"
|
||||
#include "RwHelper.h"
|
||||
#include "Lights.h"
|
||||
@ -15,6 +13,8 @@
|
||||
#include "World.h"
|
||||
#include "custompipes.h"
|
||||
|
||||
#ifdef EXTENDED_PIPELINES
|
||||
|
||||
#ifndef LIBRW
|
||||
#error "Need librw for EXTENDED_PIPELINES"
|
||||
#endif
|
||||
@ -614,4 +614,171 @@ CustomPipeRegisterGL(void)
|
||||
}
|
||||
|
||||
#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
|
||||
|
@ -123,7 +123,7 @@ void FrontendOptionAddBuiltinAction(const char* gxtKey, int action, int targetMe
|
||||
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();
|
||||
|
||||
@ -139,12 +139,14 @@ void FrontendOptionAddSelect(const char* gxtKey, const char** rightTexts, int8 n
|
||||
option.m_CFOSelect->displayedValue = *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->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();
|
||||
|
||||
@ -155,7 +157,8 @@ void FrontendOptionAddDynamic(const char* gxtKey, DrawFunc drawFunc, int8 *var,
|
||||
option.m_CFODynamic->drawFunc = drawFunc;
|
||||
option.m_CFODynamic->buttonPressFunc = buttonPressFunc;
|
||||
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,
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user