summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build-cmake-conan.yml116
-rw-r--r--.github/workflows/reLCS_msvc_amd64.yml2
-rw-r--r--.github/workflows/reLCS_msvc_x86.yml2
-rw-r--r--.travis.yml44
-rw-r--r--cmake/FindMilesSDK.cmake34
-rw-r--r--cmake/Findopusfile.cmake64
-rw-r--r--conanfile.py135
-rw-r--r--premake5.lua2
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/audio/AudioLogic.cpp1
-rw-r--r--src/audio/oal/stream.cpp2
-rw-r--r--src/audio/sampman_oal.cpp19
-rw-r--r--src/collision/Collision.cpp15
-rw-r--r--src/control/GameLogic.cpp2
-rw-r--r--src/control/Script.h3
-rw-r--r--src/control/Script2.cpp4
-rw-r--r--src/control/Script6.cpp26
-rw-r--r--src/control/Script7.cpp4
-rw-r--r--src/control/Script8.cpp6
-rw-r--r--src/core/Cam.cpp10
-rw-r--r--src/core/SurfaceTable.h1
-rw-r--r--src/modelinfo/VehicleModelInfo.cpp8
-rw-r--r--src/render/Font.cpp836
-rw-r--r--src/render/Font.h111
-rw-r--r--src/render/Hud.cpp8
-rw-r--r--src/render/MBlur.cpp3
-rw-r--r--src/render/Particle.cpp1015
-rw-r--r--src/render/Particle.h20
-rw-r--r--src/render/ParticleMgr.cpp32
-rw-r--r--src/render/ParticleMgr.h7
-rw-r--r--src/render/ParticleType.h9
-rw-r--r--src/render/Shadows.cpp18
-rw-r--r--src/render/Sprite.cpp13
-rw-r--r--src/render/Sprite.h2
-rw-r--r--src/render/Weather.cpp2
-rw-r--r--src/vehicles/Automobile.cpp2
-rw-r--r--src/vehicles/Bike.cpp2
-rw-r--r--src/vehicles/Boat.cpp3
-rw-r--r--src/weapons/Weapon.cpp26
m---------vendor/librw0
-rw-r--r--vendor/milessdk/include/mss.h151
-rw-r--r--vendor/milessdk/lib/mss32.libbin15570 -> 15570 bytes
42 files changed, 1519 insertions, 1243 deletions
diff --git a/.github/workflows/build-cmake-conan.yml b/.github/workflows/build-cmake-conan.yml
new file mode 100644
index 00000000..04bca81f
--- /dev/null
+++ b/.github/workflows/build-cmake-conan.yml
@@ -0,0 +1,116 @@
+name: reLCS 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 }} reLCS/master@ -if build -o reLCS: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 reLCS:build_type=RelWithDebInfo -s librw:build_type=RelWithDebInfo
+ env:
+ CONAN_SYSREQUIRES_MODE: enabled
+ - name: "Build reLCS (conan build)"
+ run: |
+ conan build ${{ github.workspace }} -if build -bf build -pf package
+ - name: "Package reLCS (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
diff --git a/.github/workflows/reLCS_msvc_amd64.yml b/.github/workflows/reLCS_msvc_amd64.yml
index 012051a9..f79df578 100644
--- a/.github/workflows/reLCS_msvc_amd64.yml
+++ b/.github/workflows/reLCS_msvc_amd64.yml
@@ -1,4 +1,4 @@
-name: reLCS_msvc_amd64
+name: reLCS premake amd64
on:
pull_request:
diff --git a/.github/workflows/reLCS_msvc_x86.yml b/.github/workflows/reLCS_msvc_x86.yml
index bffd545f..324f0754 100644
--- a/.github/workflows/reLCS_msvc_x86.yml
+++ b/.github/workflows/reLCS_msvc_x86.yml
@@ -1,4 +1,4 @@
-name: reLCS_msvc_x86
+name: reLCS premake x86
on:
pull_request:
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index c124a9f0..00000000
--- a/.travis.yml
+++ /dev/null
@@ -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
diff --git a/cmake/FindMilesSDK.cmake b/cmake/FindMilesSDK.cmake
new file mode 100644
index 00000000..57da3a6e
--- /dev/null
+++ b/cmake/FindMilesSDK.cmake
@@ -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()
diff --git a/cmake/Findopusfile.cmake b/cmake/Findopusfile.cmake
new file mode 100644
index 00000000..faae7645
--- /dev/null
+++ b/cmake/Findopusfile.cmake
@@ -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()
diff --git a/conanfile.py b/conanfile.py
new file mode 100644
index 00000000..69a77503
--- /dev/null
+++ b/conanfile.py
@@ -0,0 +1,135 @@
+from conans import ConanFile, CMake, tools
+from conans.errors import ConanException, ConanInvalidConfiguration
+import os
+import shutil
+import textwrap
+
+
+class ReLCSConan(ConanFile):
+ name = "reLCS"
+ 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("reLCS with opus support requires a libsndfile built with external libs (=ogg/flac/opus/vorbis)")
+
+ @property
+ def _reLCS_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("{}" reLCS)
+ """).format(self.install_folder.replace("\\", "/"),
+ self.source_folder.replace("\\", "/")))
+ except FileNotFoundError:
+ pass
+ cmake = CMake(self)
+ cmake.definitions["RELCS_AUDIO"] = self._reLCS_audio
+ cmake.definitions["RELCS_WITH_OPUS"] = self.options.with_opus
+ cmake.definitions["RELCS_INSTALL"] = True
+ cmake.definitions["RELCS_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()
diff --git a/premake5.lua b/premake5.lua
index 11a0bbbd..128f3cae 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -309,7 +309,7 @@ project "reLCS"
filter {}
if(os.getenv("GTA_LCS_RE_DIR")) then
- setpaths("$(GTA_LCS_RE_DIR)/", "%(cfg.buildtarget.name)", "")
+ setpaths("$(GTA_LCS_RE_DIR)/", "%(cfg.buildtarget.name)")
end
filter "platforms:win*"
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index dc204d17..ad72eb56 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,7 +36,7 @@ target_compile_definitions(${EXECUTABLE}
PRIVATE
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
LIBRW
- ${PROJECT}_NO_AUTOLINK
+ CMAKE_NO_AUTOLINK
)
if(LIBRW_PLATFORM_D3D9)
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp
index cd341eac..1f32890c 100644
--- a/src/audio/AudioLogic.cpp
+++ b/src/audio/AudioLogic.cpp
@@ -4106,6 +4106,7 @@ cAudioManager::SetupJumboFlySound(uint8 emittingVol)
m_sQueueSample.m_nLoopEnd = SampleManager.GetSampleLoopEndOffset(m_sQueueSample.m_nSampleIndex);
m_sQueueSample.m_fSpeedMultiplier = 4.0f;
m_sQueueSample.m_fSoundIntensity = SOUND_INTENSITY;
+ m_sQueueSample.m_bReleasingSoundFlag = false;
m_sQueueSample.m_nReleasingVolumeDivider = 5;
m_sQueueSample.m_bReverbFlag = true;
m_sQueueSample.m_bRequireReflection = false; // todo port fix to re3
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index 81a78381..19fa4ec4 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -4,7 +4,7 @@
#include "stream.h"
#include "sampman.h"
-#ifdef _WIN32
+#if defined _MSC_VER && !defined CMAKE_NO_AUTOLINK
#ifdef AUDIO_OAL_USE_SNDFILE
#pragma comment( lib, "libsndfile-1.lib" )
#endif
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index ef070825..ec85fc43 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -38,7 +38,7 @@
//TODO: max channels
//TODO: loop count
-#ifdef _WIN32
+#if defined _MSC_VER && !defined CMAKE_NO_AUTOLINK
#pragma comment( lib, "OpenAL32.lib" )
#endif
@@ -996,12 +996,14 @@ 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
{
-
+ 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);
@@ -1019,10 +1021,15 @@ cSampleManager::Initialise(void)
}
#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() )
diff --git a/src/collision/Collision.cpp b/src/collision/Collision.cpp
index c90390c4..703804d9 100644
--- a/src/collision/Collision.cpp
+++ b/src/collision/Collision.cpp
@@ -507,12 +507,14 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
for(i = 0; i < model.numSpheres; i++){
if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.spheres[i].surface)) continue;
if(TestLineSphere(*(CColLine*)newline, model.spheres[i]))
return true;
}
for(i = 0; i < model.numBoxes; i++){
if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.boxes[i].surface)) continue;
if(TestLineBox(*(CColLine*)newline, model.boxes[i]))
return true;
}
@@ -522,6 +524,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
VuTriangle vutri;
for(i = 0; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -539,6 +542,7 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
#endif
for(; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -1333,6 +1337,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float coldist = 1.0f;
for(i = 0; i < model.numSpheres; i++){
if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.spheres[i].surface)) continue;
if(ProcessLineSphere(*(CColLine*)newline, model.spheres[i], point, coldist))
point.Set(0, 0, model.spheres[i].surface, model.spheres[i].piece);
}
@@ -1348,6 +1353,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
CColTriangle *lasttri = nil;
for(i = 0; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -1367,6 +1373,7 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float dist;
for(; i < model.numTriangles; i++){
if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreShootThrough && IsShootThrough(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -1466,13 +1473,13 @@ CCollision::ProcessVerticalLine(const CColLine &line,
float coldist = 1.0f;
for(i = 0; i < model.numSpheres; i++){
- if(ignoreSeeThrough && IsSeeThrough(model.spheres[i].surface)) continue;
+ if(ignoreSeeThrough && IsSeeThroughVertical(model.spheres[i].surface)) continue;
if(ProcessLineSphere(*(CColLine*)newline, model.spheres[i], point, coldist))
point.Set(0, 0, model.spheres[i].surface, model.spheres[i].piece);
}
for(i = 0; i < model.numBoxes; i++){
- if(ignoreSeeThrough && IsSeeThrough(model.boxes[i].surface)) continue;
+ if(ignoreSeeThrough && IsSeeThroughVertical(model.boxes[i].surface)) continue;
if(ProcessLineBox(*(CColLine*)newline, model.boxes[i], point, coldist))
point.Set(0, 0, model.boxes[i].surface, model.boxes[i].piece);
}
@@ -1484,7 +1491,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
CColTriangle *lasttri = nil;
VuTriangle vutri;
for(i = 0; i < model.numTriangles; i++){
- if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreSeeThrough && IsSeeThroughVertical(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
@@ -1503,7 +1510,7 @@ CCollision::ProcessVerticalLine(const CColLine &line,
CVuVector pnt, normal;
float dist;
for(; i < model.numTriangles; i++){
- if(ignoreSeeThrough && IsSeeThrough(model.triangles[i].surface)) continue;
+ if(ignoreSeeThrough && IsSeeThroughVertical(model.triangles[i].surface)) continue;
CColTriangle *tri = &model.triangles[i];
model.vertices[tri->a].Unpack(vutri.v0);
diff --git a/src/control/GameLogic.cpp b/src/control/GameLogic.cpp
index 2eea9645..93e6c67d 100644
--- a/src/control/GameLogic.cpp
+++ b/src/control/GameLogic.cpp
@@ -393,7 +393,7 @@ CGameLogic::RestorePlayerStuffDuringResurrection(CPlayerPed *pPlayerPed, CVector
CWorld::Add(pPlayerPed);
CHud::ResetWastedText();
CStreaming::StreamZoneModels(pos);
- clearWaterDrop = true;
+ //clearWaterDrop = true;
}
void
diff --git a/src/control/Script.h b/src/control/Script.h
index aca148d2..233e00e5 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -605,10 +605,9 @@ public:
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
+ bool ThisIsAValidRandomCop(uint32 mi, int cop, int swat, int fbi, int army, int miami);
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal);
bool CheckDamagedWeaponType(int32 actual, int32 type);
- static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
-
void ReturnFromGosubOrFunction();
};
diff --git a/src/control/Script2.cpp b/src/control/Script2.cpp
index 5cac2bfd..9ef24751 100644
--- a/src/control/Script2.cpp
+++ b/src/control/Script2.cpp
@@ -1349,9 +1349,9 @@ int8 CRunningScript::ProcessCommands400To499(int32 command)
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(GET_INTEGER_PARAM(0));
script_assert(pPed);
- CVehicle* pVehicle = CPools::GetVehiclePool()->GetAt(GET_INTEGER_PARAM(1));
+ CObject* pObject = CPools::GetObjectPool()->GetAt(GET_INTEGER_PARAM(1));
pPed->bScriptObjectiveCompleted = false;
- pPed->SetObjective(OBJECTIVE_DESTROY_OBJECT, pVehicle);
+ pPed->SetObjective(OBJECTIVE_DESTROY_OBJECT, pObject);
return 0;
}
case COMMAND_SET_CHAR_OBJ_DESTROY_CAR:
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 02427eed..3a03ea9b 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -42,6 +42,19 @@
extern const char* scriptfile;
#endif
+bool CRunningScript::ThisIsAValidRandomCop(uint32 mi, int cop, int swat, int fbi, int army, int miami)
+{
+ switch (mi)
+ {
+ case MI_COP: if (cop) return true; break;
+ case MI_SWAT: if (swat) return true; break;
+ case MI_FBI: if (fbi) return true; break;
+ case MI_ARMY: if (army) return true; break;
+ default: if (mi >= MI_VICE1 && mi <= MI_VICE8 && miami) return true; break;
+ }
+ return false;
+}
+
bool CRunningScript::ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal)
{
switch (pedtype) {
@@ -66,19 +79,6 @@ bool CRunningScript::ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, in
}
}
-bool CRunningScript::ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami)
-{
- switch (mi)
- {
- case MI_COP: if (cop) return true;
- case MI_SWAT: if (swat) return true;
- case MI_FBI: if (fbi) return true;
- case MI_ARMY: if (army) return true;
- default:
- return miami && (mi >= MI_VICE1 && mi <= MI_VICE8);
- }
-}
-
int8 CRunningScript::ProcessCommands1000To1099(int32 command)
{
switch (command) {
diff --git a/src/control/Script7.cpp b/src/control/Script7.cpp
index b3f16106..a5c8e717 100644
--- a/src/control/Script7.cpp
+++ b/src/control/Script7.cpp
@@ -95,8 +95,8 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
CollectParameters(&m_nIp, 2);
CPed* pPed = CPools::GetPedPool()->GetAt(ScriptParams[0]);
script_assert(pPed);
- ScriptParams[0] = pPed->GetWeapon(ScriptParams[1]).m_eWeaponType;
- ScriptParams[1] = pPed->GetWeapon(ScriptParams[1]).m_nAmmoTotal;
+ ScriptParams[0] = pPed->GetWeapon(ScriptParams[1] - 1).m_eWeaponType;
+ ScriptParams[1] = pPed->GetWeapon(ScriptParams[1] - 1).m_nAmmoTotal;
ScriptParams[2] = CPickups::ModelForWeapon((eWeaponType)ScriptParams[0]);
StoreParameters(&m_nIp, 3);
return 0;
diff --git a/src/control/Script8.cpp b/src/control/Script8.cpp
index 2f52b150..afa213f2 100644
--- a/src/control/Script8.cpp
+++ b/src/control/Script8.cpp
@@ -66,7 +66,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
return 0;
case COMMAND_WANTED_STARS_ARE_FLASHING:
{
- CWanted *pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted;
+ CWanted* pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted;
UpdateCompareFlag(pWanted->m_nMinWantedLevel - pWanted->m_nWantedLevel > 0);
return 0;
}
@@ -136,7 +136,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
CTheScripts::ReadTextLabelFromScript(&m_nIp, key);
m_nIp += KEY_LENGTH_IN_SCRIPT;
CVector pos = pPlayerInfo->GetPos();
- CZone *infoZone = CTheZones::FindInformationZoneForPosition(&pos);
+ CZone* infoZone = CTheZones::FindInformationZoneForPosition(&pos);
UpdateCompareFlag(strncmp(key, infoZone->name, 8) == 0); // original code doesn't seem to be using strncmp in here and compare 2 ints instead
return 0;
}
@@ -352,7 +352,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_CREATE_DUST_EFFECT_FOR_CUTSCENE_HELI:
{
CollectParameters(&m_nIp, 3);
- CObject *pHeli = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
+ CObject* pHeli = CPools::GetObjectPool()->GetAt(ScriptParams[0]);
bool found = false;
float waterLevel = -1000.0f;
CVector pos = pHeli->GetPosition();
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp
index 581e219a..bb3a0fbe 100644
--- a/src/core/Cam.cpp
+++ b/src/core/Cam.cpp
@@ -4350,7 +4350,7 @@ CCam::ProcessArrestCamOne(void)
((CPed*)TheCamera.pTargetEntity)->m_pedIK.GetComponentPosition(TargetPos, PED_MID);
if(FindPlayerPed() && FindPlayerPed()->m_pArrestingCop)
cop = FindPlayerPed()->m_pArrestingCop;
- if(cop && CGeneral::GetRandomNumberInRange(0.0f, 0.1f) > 0.5f){
+ if(cop && CGeneral::GetRandomNumberInRange(0.0f, 1.0f) > 0.5f){
ArrestModes[0] = ARRESTCAM_OVERSHOULDER;
ArrestModes[1] = ARRESTCAM_ALONGGROUND;
ArrestModes[2] = ARRESTCAM_OVERSHOULDER;
@@ -4372,7 +4372,7 @@ CCam::ProcessArrestCamOne(void)
if(FindPlayerPed() && FindPlayerPed()->m_pArrestingCop)
cop = FindPlayerPed()->m_pArrestingCop;
- if(cop && CGeneral::GetRandomNumberInRange(0.0f, 0.1f) > 0.65f){
+ if(cop && CGeneral::GetRandomNumberInRange(0.0f, 1.0f) > 0.65f){
ArrestModes[0] = ARRESTCAM_OVERSHOULDER;
ArrestModes[1] = ARRESTCAM_LAMPPOST;
ArrestModes[2] = ARRESTCAM_ALONGGROUND;
@@ -4442,6 +4442,7 @@ CCam::ProcessArrestCamOne(void)
pStoredCopPed = nil;
}
+ Source = CamSource;
CVector OrigSource = Source;
TheCamera.AvoidTheGeometry(OrigSource, TargetPos, Source, FOV);
Front = TargetPos - Source;
@@ -4468,8 +4469,9 @@ CCam::ProcessArrestCamOne(void)
if(nUsingWhichCamera == ARRESTCAM_OVERSHOULDER && pStoredCopPed){
foundPos = GetLookOverShoulderPos(TheCamera.pTargetEntity, pStoredCopPed, TargetPos, CamSource);
- if(CamSource.z > Source.z + ARRESTCAM_S_ROTATION_UP*CTimer::GetTimeStep())
- CamSource.z = Source.z + ARRESTCAM_S_ROTATION_UP*CTimer::GetTimeStep();
+ float newZ = Source.z + ARRESTCAM_S_ROTATION_UP*CTimer::GetTimeStep();
+ if(CamSource.z > newZ)
+ CamSource.z = newZ;
}else if(nUsingWhichCamera >= ARRESTCAM_ALONGGROUND_RIGHT && nUsingWhichCamera <= ARRESTCAM_ALONGGROUND_LEFT_UP){
CamSource = Source;
Front = TargetPos - CamSource;
diff --git a/src/core/SurfaceTable.h b/src/core/SurfaceTable.h
index cd08c843..8ff43106 100644
--- a/src/core/SurfaceTable.h
+++ b/src/core/SurfaceTable.h
@@ -81,6 +81,7 @@ inline bool
IsShootThrough(uint8 surfType)
{
switch(surfType)
+ case SURFACE_TRANSPARENT_CLOTH:
case SURFACE_METAL_CHAIN_FENCE:
case SURFACE_TRANSPARENT_STONE:
case SURFACE_SCAFFOLD_POLE:
diff --git a/src/modelinfo/VehicleModelInfo.cpp b/src/modelinfo/VehicleModelInfo.cpp
index 6dc9e5b0..4caacc7f 100644
--- a/src/modelinfo/VehicleModelInfo.cpp
+++ b/src/modelinfo/VehicleModelInfo.cpp
@@ -1108,6 +1108,7 @@ CVehicleModelInfo::SetEnvironmentMapCB(RpAtomic *atomic, void *data)
void
CVehicleModelInfo::SetEnvironmentMap(void)
{
+/*
CSimpleModelInfo *wheelmi;
int32 i;
@@ -1125,6 +1126,7 @@ CVehicleModelInfo::SetEnvironmentMap(void)
for(i = 0; i < wheelmi->m_numAtomics; i++)
SetEnvironmentMapCB(wheelmi->m_atomics[i], nil);
}
+*/
#ifdef EXTENDED_PIPELINES
CustomPipes::AttachVehiclePipe(m_clump);
@@ -1139,21 +1141,23 @@ CVehicleModelInfo::LoadEnvironmentMaps(void)
txdslot = CTxdStore::FindTxdSlot("particle");
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(txdslot);
- if(gpWhiteTexture == nil){
+ /*if(gpWhiteTexture == nil){
gpWhiteTexture = RwTextureRead("white", nil);
RwTextureGetName(gpWhiteTexture)[0] = '@';
RwTextureSetFilterMode(gpWhiteTexture, rwFILTERLINEAR);
- }
+ }*/
CTxdStore::PopCurrentTxd();
}
void
CVehicleModelInfo::ShutdownEnvironmentMaps(void)
{
+/*
RwTextureDestroy(gpWhiteTexture);
gpWhiteTexture = nil;
RwFrameDestroy(pMatFxIdentityFrame);
pMatFxIdentityFrame = nil;
+*/
}
int
diff --git a/src/render/Font.cpp b/src/render/Font.cpp
index d15dc7d3..3798c5f2 100644
--- a/src/render/Font.cpp
+++ b/src/render/Font.cpp
@@ -390,7 +390,7 @@ CFont::InitPerFrame(void)
Details.anonymous_25 = 0;
FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
SetDropShadowPosition(0);
- NewLine = 0;
+ NewLine = false;
#ifdef BUTTON_ICONS
PS2Symbol = BUTTON_NONE;
#endif
@@ -543,6 +543,210 @@ bool CFont::IsAnsiCharacter(wchar *s)
#endif
void
+CFont::RenderFontBuffer()
+{
+ if (FontRenderStatePointer.pRenderState == (CFontRenderState*)FontRenderStateBuf) return;
+
+ float textPosX;
+ float textPosY;
+ CRGBA color;
+ bool bBold = false;
+ bool bFlash = false;
+
+ Sprite[RenderState.style].SetRenderState();
+ RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
+ RenderState = *(CFontRenderState*)&FontRenderStateBuf[0];
+ textPosX = RenderState.fTextPosX;
+ textPosY = RenderState.fTextPosY;
+ color = RenderState.color;
+ tFontRenderStatePointer pRenderStateBufPointer;
+ pRenderStateBufPointer.pRenderState = (CFontRenderState*)&FontRenderStateBuf[0];
+ for (++pRenderStateBufPointer.pRenderState; pRenderStateBufPointer.pStr < FontRenderStatePointer.pStr; pRenderStateBufPointer.pStr++) {
+ if (*pRenderStateBufPointer.pStr == '\0') {
+ tFontRenderStatePointer tmpPointer = pRenderStateBufPointer;
+ tmpPointer.pStr++;
+ tmpPointer.Align();
+ if (tmpPointer.pStr >= FontRenderStatePointer.pStr)
+ break;
+
+ RenderState = *(tmpPointer.pRenderState++);
+
+ pRenderStateBufPointer = tmpPointer;
+
+ textPosX = RenderState.fTextPosX;
+ textPosY = RenderState.fTextPosY;
+ color = RenderState.color;
+ }
+ if (*pRenderStateBufPointer.pStr == '~') {
+#ifdef BUTTON_ICONS
+ PS2Symbol = BUTTON_NONE;
+#endif
+ pRenderStateBufPointer.pStr = ParseToken(pRenderStateBufPointer.pStr, color, bFlash, bBold);
+#ifdef BUTTON_ICONS
+ if(PS2Symbol != BUTTON_NONE) {
+ DrawButton(textPosX, textPosY);
+ textPosX += Details.scaleY * 17.0f;
+ PS2Symbol = BUTTON_NONE;
+ }
+#endif
+ if (bFlash) {
+ if (CTimer::GetTimeInMilliseconds() - Details.nFlashTimer > 300) {
+ Details.bFlashState = !Details.bFlashState;
+ Details.nFlashTimer = CTimer::GetTimeInMilliseconds();
+ }
+ Details.color.alpha = Details.bFlashState ? 0 : 255;
+ }
+ if (!RenderState.bIsShadow)
+ RenderState.color = color;
+ }
+ wchar c = *pRenderStateBufPointer.pStr;
+ c -= ' ';
+ if (RenderState.bFontHalfTexture)
+ c = FindNewCharacter(c);
+ else if (c > 155)
+ c = '\0';
+
+ if (RenderState.slant != 0.0f)
+ textPosY = (RenderState.slantRefX - textPosX) * RenderState.slant + RenderState.slantRefY;
+ PrintChar(textPosX, textPosY, c);
+ if (bBold) {
+ PrintChar(textPosX + 1.0f, textPosY, c);
+ PrintChar(textPosX + 2.0f, textPosY, c);
+ textPosX += 2.0f;
+ }
+#ifdef FIX_BUGS
+ // PS2 uses different chars for some symbols
+ if (!RenderState.bFontHalfTexture && c == 30) c = 61; // wanted star
+#endif
+ textPosX += RenderState.scaleX * GetCharacterWidth(c);
+ if (c == '\0')
+ textPosX += RenderState.fExtraSpace;
+ }
+ CSprite2d::RenderVertexBuffer();
+ FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
+}
+
+#ifdef MORE_LANGUAGES
+bool
+CFont::PrintString(float x, float y, wchar *start, wchar *&end, float spwidth, float japX)
+{
+ wchar *s, c, unused;
+
+ if (IsJapanese()) {
+ float jx = 0.0f;
+ for (s = start; s < end; s++) {
+ if (*s == JAP_TERMINATION || *s == '~')
+ s = ParseToken(s, &unused, true);
+ if (NewLine) {
+ NewLine = false;
+ break;
+ }
+ jx += GetCharacterSize(*s - ' ');
+ }
+ s = start;
+ if (Details.centre)
+ x = japX - jx / 2.0f;
+ else if (Details.rightJustify)
+ x = japX - jx;
+ }
+
+ for (s = start; s < end; s++) {
+ if (*s == '~' || (IsJapanese() && *s == JAP_TERMINATION))
+ s = ParseToken(s, &unused);
+ if (NewLine && IsJapanese()) {
+ NewLine = false;
+ end = s;
+ return true;
+ }
+ c = *s - ' ';
+ if (Details.slant != 0.0f && !IsJapanese())
+ y = (Details.slantRefX - x) * Details.slant + Details.slantRefY;
+
+ PrintChar(x, y, c);
+ x += GetCharacterSize(c);
+ if (c == 0 && (!NewLine || !IsJapanese())) // space
+ x += spwidth;
+ }
+ return false;
+}
+#else
+void
+CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth)
+{
+ wchar *s;
+
+ if (RenderState.style != Details.style) {
+ RenderFontBuffer();
+ RenderState.style = Details.style;
+ }
+
+ float dropShadowPosition = Details.dropShadowPosition;
+ if (dropShadowPosition != 0.0f && (Details.style == FONT_BANK || Details.style == FONT_STANDARD)) {
+ CRGBA color = Details.color;
+ Details.color = Details.dropColor;
+ Details.dropShadowPosition = 0;
+ Details.bIsShadow = true;
+ if (Details.slant != 0.0f) {
+ Details.slantRefX += SCREEN_SCALE_X(dropShadowPosition);
+ Details.slantRefY += SCREEN_SCALE_Y(dropShadowPosition);
+ PrintString(SCREEN_SCALE_X(dropShadowPosition) + x, SCREEN_SCALE_Y(dropShadowPosition) + y, Details.anonymous_25, start, end, spwidth);
+ Details.slantRefX -= SCREEN_SCALE_X(dropShadowPosition);
+ Details.slantRefY -= SCREEN_SCALE_Y(dropShadowPosition);
+ } else {
+ PrintString(SCREEN_SCALE_X(dropShadowPosition) + x, SCREEN_SCALE_Y(dropShadowPosition) + y, Details.anonymous_25, start, end, spwidth);
+ }
+ Details.color = color;
+ Details.dropShadowPosition = dropShadowPosition;
+ Details.bIsShadow = false;
+ }
+ if (FontRenderStatePointer.pStr >= (wchar*)&FontRenderStateBuf[ARRAY_SIZE(FontRenderStateBuf)] - (end - start + 26)) // why 26?
+ RenderFontBuffer();
+ CFontRenderState *pRenderState = FontRenderStatePointer.pRenderState;
+ pRenderState->fTextPosX = x;
+ pRenderState->fTextPosY = y;
+ pRenderState->scaleX = Details.scaleX;
+ pRenderState->scaleY = Details.scaleY;
+ pRenderState->color = Details.color;
+ pRenderState->fExtraSpace = spwidth;
+ pRenderState->slant = Details.slant;
+ pRenderState->slantRefX = Details.slantRefX;
+ pRenderState->slantRefY = Details.slantRefY;
+ pRenderState->bFontHalfTexture = Details.bFontHalfTexture;
+ pRenderState->proportional = Details.proportional;
+ pRenderState->style = Details.style;
+ pRenderState->bIsShadow = Details.bIsShadow;
+ FontRenderStatePointer.pRenderState++;
+
+ for(s = start; s < end;){
+ if (*s == '~') {
+ for (wchar *i = ParseToken(s); s != i; FontRenderStatePointer.pStr++) {
+ *FontRenderStatePointer.pStr = *(s++);
+ }
+ if (Details.bFlash) {
+ if (CTimer::GetTimeInMilliseconds() - Details.nFlashTimer > 300) {
+ Details.bFlashState = !Details.bFlashState;
+ Details.nFlashTimer = CTimer::GetTimeInMilliseconds();
+ }
+ Details.color.a = Details.bFlashState ? 0 : 255;
+ }
+ } else
+ *(FontRenderStatePointer.pStr++) = *(s++);
+ }
+ *(FontRenderStatePointer.pStr++) = '\0';
+ FontRenderStatePointer.Align();
+}
+#endif
+
+void
+CFont::PrintStringFromBottom(float x, float y, wchar *str)
+{
+ y -= (32.0f * Details.scaleY / 2.0f + 2.0f * Details.scaleY) * GetNumberLines(x, y, str);
+ if (Details.slant == 0.0f)
+ y -= ((Details.slantRefX - x) * Details.slant + Details.slantRefY);
+ PrintString(x, y, str);
+}
+
+void
CFont::PrintString(float xstart, float ystart, wchar *s)
{
CRect rect;
@@ -893,126 +1097,6 @@ CFont::GetTextRect(CRect *rect, float xstart, float ystart, wchar *s)
}
}
-#ifdef MORE_LANGUAGES
-bool
-CFont::PrintString(float x, float y, wchar *start, wchar *&end, float spwidth, float japX)
-{
- wchar *s, c, unused;
-
- if (IsJapanese()) {
- float jx = 0.0f;
- for (s = start; s < end; s++) {
- if (*s == JAP_TERMINATION || *s == '~')
- s = ParseToken(s, &unused, true);
- if (NewLine) {
- NewLine = false;
- break;
- }
- jx += GetCharacterSize(*s - ' ');
- }
- s = start;
- if (Details.centre)
- x = japX - jx / 2.0f;
- else if (Details.rightJustify)
- x = japX - jx;
- }
-
- for (s = start; s < end; s++) {
- if (*s == '~' || (IsJapanese() && *s == JAP_TERMINATION))
- s = ParseToken(s, &unused);
- if (NewLine && IsJapanese()) {
- NewLine = false;
- end = s;
- return true;
- }
- c = *s - ' ';
- if (Details.slant != 0.0f && !IsJapanese())
- y = (Details.slantRefX - x) * Details.slant + Details.slantRefY;
-
- PrintChar(x, y, c);
- x += GetCharacterSize(c);
- if (c == 0 && (!NewLine || !IsJapanese())) // space
- x += spwidth;
- }
- return false;
-}
-#else
-void
-CFont::PrintString(float x, float y, uint32, wchar *start, wchar *end, float spwidth)
-{
- wchar *s;
-
- if (RenderState.style != Details.style) {
- RenderFontBuffer();
- RenderState.style = Details.style;
- }
-
- float dropShadowPosition = Details.dropShadowPosition;
- if (dropShadowPosition != 0.0f && (Details.style == FONT_BANK || Details.style == FONT_STANDARD)) {
- CRGBA color = Details.color;
- Details.color = Details.dropColor;
- Details.dropShadowPosition = 0;
- Details.bIsShadow = true;
- if (Details.slant != 0.0f) {
- Details.slantRefX += SCREEN_SCALE_X(dropShadowPosition);
- Details.slantRefY += SCREEN_SCALE_Y(dropShadowPosition);
- PrintString(SCREEN_SCALE_X(dropShadowPosition) + x, SCREEN_SCALE_Y(dropShadowPosition) + y, Details.anonymous_25, start, end, spwidth);
- Details.slantRefX -= SCREEN_SCALE_X(dropShadowPosition);
- Details.slantRefY -= SCREEN_SCALE_Y(dropShadowPosition);
- } else {
- PrintString(SCREEN_SCALE_X(dropShadowPosition) + x, SCREEN_SCALE_Y(dropShadowPosition) + y, Details.anonymous_25, start, end, spwidth);
- }
- Details.color = color;
- Details.dropShadowPosition = dropShadowPosition;
- Details.bIsShadow = false;
- }
- if (FontRenderStatePointer.pStr >= (wchar*)&FontRenderStateBuf[ARRAY_SIZE(FontRenderStateBuf)] - (end - start + 26)) // why 26?
- RenderFontBuffer();
- CFontRenderState *pRenderState = FontRenderStatePointer.pRenderState;
- pRenderState->fTextPosX = x;
- pRenderState->fTextPosY = y;
- pRenderState->scaleX = Details.scaleX;
- pRenderState->scaleY = Details.scaleY;
- pRenderState->color = Details.color;
- pRenderState->fExtraSpace = spwidth;
- pRenderState->slant = Details.slant;
- pRenderState->slantRefX = Details.slantRefX;
- pRenderState->slantRefY = Details.slantRefY;
- pRenderState->bFontHalfTexture = Details.bFontHalfTexture;
- pRenderState->proportional = Details.proportional;
- pRenderState->style = Details.style;
- pRenderState->bIsShadow = Details.bIsShadow;
- FontRenderStatePointer.pRenderState++;
-
- for(s = start; s < end;){
- if (*s == '~') {
- for (wchar *i = ParseToken(s); s != i; FontRenderStatePointer.pStr++) {
- *FontRenderStatePointer.pStr = *(s++);
- }
- if (Details.bFlash) {
- if (CTimer::GetTimeInMilliseconds() - Details.nFlashTimer > 300) {
- Details.bFlashState = !Details.bFlashState;
- Details.nFlashTimer = CTimer::GetTimeInMilliseconds();
- }
- Details.color.a = Details.bFlashState ? 0 : 255;
- }
- } else
- *(FontRenderStatePointer.pStr++) = *(s++);
- }
- *(FontRenderStatePointer.pStr++) = '\0';
- FontRenderStatePointer.Align();
-}
-#endif
-
-void
-CFont::PrintStringFromBottom(float x, float y, wchar *str)
-{
- y -= (32.0f * Details.scaleY / 2.0f + 2.0f * Details.scaleY) * GetNumberLines(x, y, str);
- if (Details.slant == 0.0f)
- y -= ((Details.slantRefX - x) * Details.slant + Details.slantRefY);
- PrintString(x, y, str);
-}
-
float
CFont::GetCharacterWidth(wchar c)
{
@@ -1252,6 +1336,118 @@ CFont::GetNextSpace(wchar *s)
return s;
}
+wchar*
+CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
+{
+ Details.anonymous_23 = false;
+ wchar *s = str + 1;
+ if (Details.color.r || Details.color.g || Details.color.b)
+ {
+ switch (*s)
+ {
+ case 'B':
+ bold = !bold;
+ break;
+ case 'b':
+ color.r = 27;
+ color.g = 89;
+ color.b = 130;
+ break;
+ case 'f':
+ flash = !flash;
+ break;
+ case 'g':
+ color.r = 255;
+ color.g = 150;
+ color.b = 225;
+ break;
+ case 'h':
+ color.r = 225;
+ color.g = 225;
+ color.b = 225;
+ break;
+ case 'l':
+ color.r = 0;
+ color.g = 0;
+ color.b = 0;
+ break;
+ case 'o':
+ color.r = 229;
+ color.g = 125;
+ color.b = 126;
+ break;
+ case 'p':
+ color.r = 168;
+ color.g = 110;
+ color.b = 252;
+ break;
+ case 'q':
+ color.r = 199;
+ color.g = 144;
+ color.b = 203;
+ break;
+ case 'r':
+ color.r = 255;
+ color.g = 150;
+ color.b = 225;
+ break;
+ case 't':
+ color.r = 86;
+ color.g = 212;
+ color.b = 146;
+ break;
+ case 'w':
+ color.r = 175;
+ color.g = 175;
+ color.b = 175;
+ break;
+#ifdef FIX_BUGS
+ case 'x':
+ color.r = 0;
+ color.g = 255;
+ color.b = 255;
+ break;
+#else
+ case 'x':
+ color.r = 132;
+ color.g = 146;
+ color.b = 197;
+ break;
+#endif
+ case 'y':
+ color.r = 255;
+ color.g = 227;
+ color.b = 79;
+ break;
+#ifdef BUTTON_ICONS
+ case 'U': PS2Symbol = BUTTON_UP; break;
+ case 'D': PS2Symbol = BUTTON_DOWN; break;
+ case '<': PS2Symbol = BUTTON_LEFT; break;
+ case '>': PS2Symbol = BUTTON_RIGHT; break;
+ case 'X': PS2Symbol = BUTTON_CROSS; break;
+ case 'O': PS2Symbol = BUTTON_CIRCLE; break;
+ case 'Q': PS2Symbol = BUTTON_SQUARE; break;
+ case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
+ case 'K': PS2Symbol = BUTTON_L1; break;
+ case 'M': PS2Symbol = BUTTON_L2; break;
+ case 'A': PS2Symbol = BUTTON_L3; break;
+ case 'J': PS2Symbol = BUTTON_R1; break;
+ case 'V': PS2Symbol = BUTTON_R2; break;
+ case 'C': PS2Symbol = BUTTON_R3; break;
+ case '(': PS2Symbol = BUTTON_RSTICK_LEFT; break;
+ case ')': PS2Symbol = BUTTON_RSTICK_RIGHT; break;
+#endif
+ default:
+ break;
+ }
+ }
+ while (*s != '~')
+ ++s;
+ if (*(++s) == '~')
+ s = ParseToken(s, color, flash, bold);
+ return s;
+}
+
#ifdef MORE_LANGUAGES
wchar*
CFont::ParseToken(wchar *s, bool japShit)
@@ -1313,7 +1509,7 @@ CFont::ParseToken(wchar *s)
break;
case 'N':
case 'n':
- NewLine = 1;
+ NewLine = true;
break;
case 'b':
Details.color.r = 27;
@@ -1424,116 +1620,22 @@ CFont::ParseToken(wchar *s)
}
#endif
-wchar*
-CFont::ParseToken(wchar* str, CRGBA &color, bool &flash, bool &bold)
+void
+CFont::FilterOutTokensFromString(wchar *str)
{
- Details.anonymous_23 = false;
- wchar *s = str + 1;
- if (Details.color.r || Details.color.g || Details.color.b)
- {
- switch (*s)
- {
- case 'B':
- bold = !bold;
- break;
- case 'b':
- color.r = 27;
- color.g = 89;
- color.b = 130;
- break;
- case 'f':
- flash = !flash;
- break;
- case 'g':
- color.r = 255;
- color.g = 150;
- color.b = 225;
- break;
- case 'h':
- color.r = 225;
- color.g = 225;
- color.b = 225;
- break;
- case 'l':
- color.r = 0;
- color.g = 0;
- color.b = 0;
- break;
- case 'o':
- color.r = 229;
- color.g = 125;
- color.b = 126;
- break;
- case 'p':
- color.r = 168;
- color.g = 110;
- color.b = 252;
- break;
- case 'q':
- color.r = 199;
- color.g = 144;
- color.b = 203;
- break;
- case 'r':
- color.r = 255;
- color.g = 150;
- color.b = 225;
- break;
- case 't':
- color.r = 86;
- color.g = 212;
- color.b = 146;
- break;
- case 'w':
- color.r = 175;
- color.g = 175;
- color.b = 175;
- break;
-#ifdef FIX_BUGS
- case 'x':
- color.r = 0;
- color.g = 255;
- color.b = 255;
- break;
-#else
- case 'x':
- color.r = 132;
- color.g = 146;
- color.b = 197;
- break;
-#endif
- case 'y':
- color.r = 255;
- color.g = 227;
- color.b = 79;
- break;
-#ifdef BUTTON_ICONS
- case 'U': PS2Symbol = BUTTON_UP; break;
- case 'D': PS2Symbol = BUTTON_DOWN; break;
- case '<': PS2Symbol = BUTTON_LEFT; break;
- case '>': PS2Symbol = BUTTON_RIGHT; break;
- case 'X': PS2Symbol = BUTTON_CROSS; break;
- case 'O': PS2Symbol = BUTTON_CIRCLE; break;
- case 'Q': PS2Symbol = BUTTON_SQUARE; break;
- case 'T': PS2Symbol = BUTTON_TRIANGLE; break;
- case 'K': PS2Symbol = BUTTON_L1; break;
- case 'M': PS2Symbol = BUTTON_L2; break;
- case 'A': PS2Symbol = BUTTON_L3; break;
- case 'J': PS2Symbol = BUTTON_R1; break;
- case 'V': PS2Symbol = BUTTON_R2; break;
- case 'C': PS2Symbol = BUTTON_R3; break;
- case '(': PS2Symbol = BUTTON_RSTICK_LEFT; break;
- case ')': PS2Symbol = BUTTON_RSTICK_RIGHT; break;
-#endif
- default:
- break;
+ int newIdx = 0;
+ wchar copy[256], *c;
+ UnicodeStrcpy(copy, str);
+
+ for (c = copy; *c != '\0'; c++) {
+ if (*c == '~') {
+ c++;
+ while (*c != '~') c++;
+ } else {
+ str[newIdx++] = *c;
}
}
- while (*s != '~')
- ++s;
- if (*(++s) == '~')
- s = ParseToken(s, color, flash, bold);
- return s;
+ str[newIdx] = '\0';
}
void
@@ -1543,139 +1645,90 @@ CFont::DrawFonts(void)
}
void
-CFont::RenderFontBuffer()
+CFont::SetScale(float x, float y)
{
- if (FontRenderStatePointer.pRenderState == (CFontRenderState*)FontRenderStateBuf) return;
-
- float textPosX;
- float textPosY;
- CRGBA color;
- bool bBold = false;
- bool bFlash = false;
+#ifdef MORE_LANGUAGES
+ /*if (IsJapanese()) {
+ x *= 1.35f;
+ y *= 1.25f;
+ }*/
+#endif
+ Details.scaleX = x;
+ Details.scaleY = y;
+}
- Sprite[RenderState.style].SetRenderState();
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- RenderState = *(CFontRenderState*)&FontRenderStateBuf[0];
- textPosX = RenderState.fTextPosX;
- textPosY = RenderState.fTextPosY;
- color = RenderState.color;
- tFontRenderStatePointer pRenderStateBufPointer;
- pRenderStateBufPointer.pRenderState = (CFontRenderState*)&FontRenderStateBuf[0];
- for (++pRenderStateBufPointer.pRenderState; pRenderStateBufPointer.pStr < FontRenderStatePointer.pStr; pRenderStateBufPointer.pStr++) {
- if (*pRenderStateBufPointer.pStr == '\0') {
- tFontRenderStatePointer tmpPointer = pRenderStateBufPointer;
- tmpPointer.pStr++;
- tmpPointer.Align();
- if (tmpPointer.pStr >= FontRenderStatePointer.pStr)
- break;
+void
+CFont::SetSlantRefPoint(float x, float y)
+{
+ Details.slantRefX = x;
+ Details.slantRefY = y;
+}
- RenderState = *(tmpPointer.pRenderState++);
+void
+CFont::SetSlant(float s)
+{
+ Details.slant = s;
+}
- pRenderStateBufPointer = tmpPointer;
+void
+CFont::SetColor(CRGBA col)
+{
+ Details.color = col;
+ if (Details.alphaFade < 255.0f)
+ Details.color.a *= Details.alphaFade / 255.0f;
+}
- textPosX = RenderState.fTextPosX;
- textPosY = RenderState.fTextPosY;
- color = RenderState.color;
- }
- if (*pRenderStateBufPointer.pStr == '~') {
-#ifdef BUTTON_ICONS
- PS2Symbol = BUTTON_NONE;
-#endif
- pRenderStateBufPointer.pStr = ParseToken(pRenderStateBufPointer.pStr, color, bFlash, bBold);
-#ifdef BUTTON_ICONS
- if(PS2Symbol != BUTTON_NONE) {
- DrawButton(textPosX, textPosY);
- textPosX += Details.scaleY * 17.0f;
- PS2Symbol = BUTTON_NONE;
- }
-#endif
- if (bFlash) {
- if (CTimer::GetTimeInMilliseconds() - Details.nFlashTimer > 300) {
- Details.bFlashState = !Details.bFlashState;
- Details.nFlashTimer = CTimer::GetTimeInMilliseconds();
- }
- Details.color.alpha = Details.bFlashState ? 0 : 255;
- }
- if (!RenderState.bIsShadow)
- RenderState.color = color;
- }
- wchar c = *pRenderStateBufPointer.pStr;
- c -= ' ';
- if (RenderState.bFontHalfTexture)
- c = FindNewCharacter(c);
- else if (c > 155)
- c = '\0';
+void
+CFont::SetJustifyOn(void)
+{
+ Details.justify = true;
+ Details.centre = false;
+ Details.rightJustify = false;
+}
- if (RenderState.slant != 0.0f)
- textPosY = (RenderState.slantRefX - textPosX) * RenderState.slant + RenderState.slantRefY;
- PrintChar(textPosX, textPosY, c);
- if (bBold) {
- PrintChar(textPosX + 1.0f, textPosY, c);
- PrintChar(textPosX + 2.0f, textPosY, c);
- textPosX += 2.0f;
- }
-#ifdef FIX_BUGS
- // PS2 uses different chars for some symbols
- if (!RenderState.bFontHalfTexture && c == 30) c = 61; // wanted star
-#endif
- textPosX += RenderState.scaleX * GetCharacterWidth(c);
- if (c == '\0')
- textPosX += RenderState.fExtraSpace;
- }
- CSprite2d::RenderVertexBuffer();
- FontRenderStatePointer.pRenderState = (CFontRenderState*)FontRenderStateBuf;
+void
+CFont::SetJustifyOff(void)
+{
+ Details.justify = false;
+ Details.rightJustify = false;
}
+void
+CFont::SetCentreOn(void)
+{
+ Details.centre = true;
+ Details.justify = false;
+ Details.rightJustify = false;
+}
void
-CFont::SetFontStyle(int16 style)
+CFont::SetCentreOff(void)
{
- if (style == FONT_HEADING) {
- Details.style = FONT_STANDARD;
- Details.bFontHalfTexture = true;
- } else {
- Details.style = style;
- Details.bFontHalfTexture = false;
- }
+ Details.centre = false;
}
-wchar CFont::FindNewCharacter(wchar c)
+void
+CFont::SetWrapx(float x)
{
- if (c >= 16 && c <= 26) return c + 128;
- if (c >= 8 && c <= 9) return c + 86;
- if (c == 4) return c + 89;
- if (c == 7) return 206;
- if (c == 14) return 207;
- if (c >= 33 && c <= 58) return c + 122;
- if (c >= 65 && c <= 90) return c + 90;
- if (c >= 96 && c <= 118) return c + 85;
- if (c >= 119 && c <= 140) return c + 62;
- if (c >= 141 && c <= 142) return 204;
- if (c == 143) return 205;
- if (c == 1) return 208;
- return c;
+ Details.wrapX = x;
}
-wchar
-CFont::character_code(uint8 c)
+void
+CFont::SetCentreSize(float s)
{
- if(c < 128)
- return c;
- return foreign_table[c-128];
+ Details.centreSize = s;
}
+void
+CFont::SetBackgroundOn(void)
+{
+ Details.background = true;
+}
void
-CFont::SetScale(float x, float y)
+CFont::SetBackgroundOff(void)
{
-#ifdef MORE_LANGUAGES
- /*if (IsJapanese()) {
- x *= 1.35f;
- y *= 1.25f;
- }*/
-#endif
- Details.scaleX = x;
- Details.scaleY = y;
+ Details.background = false;
}
void
@@ -1685,11 +1738,67 @@ CFont::SetBackgroundColor(CRGBA col)
}
void
-CFont::SetColor(CRGBA col)
+CFont::SetBackGroundOnlyTextOn(void)
{
- Details.color = col;
- if (Details.alphaFade < 255.0f)
- Details.color.a *= Details.alphaFade / 255.0f;
+ Details.backgroundOnlyText = true;
+}
+
+void
+CFont::SetBackGroundOnlyTextOff(void)
+{
+ Details.backgroundOnlyText = false;
+}
+
+void
+CFont::SetRightJustifyOn(void)
+{
+ Details.rightJustify = true;
+ Details.justify = false;
+ Details.centre = false;
+}
+
+void
+CFont::SetRightJustifyOff(void)
+{
+ Details.rightJustify = false;
+ Details.justify = false;
+ Details.centre = false;
+}
+
+void
+CFont::SetPropOff(void)
+{
+ Details.proportional = false;
+}
+
+void
+CFont::SetPropOn(void)
+{
+ Details.proportional = true;
+}
+
+void
+CFont::SetFontStyle(int16 style)
+{
+ if (style == FONT_HEADING) {
+ Details.style = FONT_STANDARD;
+ Details.bFontHalfTexture = true;
+ } else {
+ Details.style = style;
+ Details.bFontHalfTexture = false;
+ }
+}
+
+void
+CFont::SetRightJustifyWrap(float wrap)
+{
+ Details.rightJustifyWrap = wrap;
+}
+
+void
+CFont::SetAlphaFade(float fade)
+{
+ Details.alphaFade = fade;
}
void
@@ -1701,19 +1810,32 @@ CFont::SetDropColor(CRGBA col)
}
void
-CFont::FilterOutTokensFromString(wchar *str)
+CFont::SetDropShadowPosition(int16 pos)
{
- int newIdx = 0;
- wchar copy[256], *c;
- UnicodeStrcpy(copy, str);
+ Details.dropShadowPosition = pos;
+}
- for (c = copy; *c != '\0'; c++) {
- if (*c == '~') {
- c++;
- while (*c != '~') c++;
- } else {
- str[newIdx++] = *c;
- }
- }
- str[newIdx] = '\0';
+wchar CFont::FindNewCharacter(wchar c)
+{
+ if (c >= 16 && c <= 26) return c + 128;
+ if (c >= 8 && c <= 9) return c + 86;
+ if (c == 4) return c + 89;
+ if (c == 7) return 206;
+ if (c == 14) return 207;
+ if (c >= 33 && c <= 58) return c + 122;
+ if (c >= 65 && c <= 90) return c + 90;
+ if (c >= 96 && c <= 118) return c + 85;
+ if (c >= 119 && c <= 140) return c + 62;
+ if (c >= 141 && c <= 142) return 204;
+ if (c == 143) return 205;
+ if (c == 1) return 208;
+ return c;
}
+
+wchar
+CFont::character_code(uint8 c)
+{
+ if(c < 128)
+ return c;
+ return foreign_table[c-128];
+} \ No newline at end of file
diff --git a/src/render/Font.h b/src/render/Font.h
index 36424bf5..4b2dda2b 100644
--- a/src/render/Font.h
+++ b/src/render/Font.h
@@ -14,28 +14,28 @@ struct CFontDetails
float slant;
float slantRefX;
float slantRefY;
- bool justify;
- bool centre;
- bool rightJustify;
- bool background;
- bool backgroundOnlyText;
- bool proportional;
- bool bIsShadow;
- bool bFlash;
- bool bBold;
+ bool8 justify;
+ bool8 centre;
+ bool8 rightJustify;
+ bool8 background;
+ bool8 backgroundOnlyText;
+ bool8 proportional;
+ bool8 bIsShadow;
+ bool8 bFlash;
+ bool8 bBold;
float alphaFade;
CRGBA backgroundColor;
float wrapX;
float centreSize;
float rightJustifyWrap;
int16 style;
- bool bFontHalfTexture;
+ bool8 bFontHalfTexture;
uint32 bank;
int16 dropShadowPosition;
CRGBA dropColor;
- bool bFlashState;
+ bool8 bFlashState;
int nFlashTimer;
- bool anonymous_23;
+ bool8 anonymous_23;
uint32 anonymous_25;
};
@@ -51,10 +51,10 @@ struct CFontRenderState
float slant;
float slantRefX;
float slantRefY;
- bool bIsShadow;
- bool bFontHalfTexture;
- bool proportional;
- bool anonymous_14;
+ bool8 bIsShadow;
+ bool8 bFontHalfTexture;
+ bool8 proportional;
+ bool8 anonymous_14;
int16 style;
};
@@ -168,72 +168,33 @@ public:
static uint16 *ParseToken(wchar *s, bool japShit = false);
#else
static uint16 *ParseToken(wchar *s);
- static uint16* ParseToken(wchar *s, CRGBA &color, bool &flash, bool &bold);
+ static uint16 *ParseToken(wchar *s, CRGBA &color, bool &flash, bool &bold);
#endif
static void DrawFonts(void);
static void RenderFontBuffer(void);
static uint16 character_code(uint8 c);
- static CFontDetails GetDetails() { return Details; }
static void SetScale(float x, float y);
- static void SetSlantRefPoint(float x, float y) { Details.slantRefX = x; Details.slantRefY = y; }
- static void SetSlant(float s) { Details.slant = s; }
- static void SetJustifyOn(void) {
- Details.justify = true;
- Details.centre = false;
- Details.rightJustify = false;
- }
- static void SetJustifyOff(void) {
- Details.justify = false;
- Details.rightJustify = false;
- }
- static void SetRightJustifyOn(void) {
- Details.rightJustify = true;
- Details.justify = false;
- Details.centre = false;
- }
- static void SetRightJustifyOff(void) {
- Details.rightJustify = false;
- Details.justify = false;
- Details.centre = false;
- }
- static void SetCentreOn(void) {
- Details.centre = true;
- Details.justify = false;
- Details.rightJustify = false;
- }
- static void SetCentreOff(void) {
- Details.centre = false;
- }
- static void SetAlignment(uint8 alignment) {
- if (alignment == ALIGN_LEFT) {
- CFont::Details.justify = true;
- CFont::Details.centre = false;
- CFont::Details.rightJustify = false;
- }
- else if (alignment == ALIGN_CENTER) {
- CFont::Details.justify = false;
- CFont::Details.centre = true;
- CFont::Details.rightJustify = false;
- }
- else if (alignment == ALIGN_RIGHT) {
- CFont::Details.justify = false;
- CFont::Details.centre = false;
- CFont::Details.rightJustify = true;
- }
- }
- static void SetWrapx(float x) { Details.wrapX = x; }
- static void SetCentreSize(float s) { Details.centreSize = s; }
- static void SetBackgroundOn(void) { Details.background = true; }
- static void SetBackgroundOff(void) { Details.background = false; }
- static void SetBackGroundOnlyTextOn(void) { Details.backgroundOnlyText = true; }
- static void SetBackGroundOnlyTextOff(void) { Details.backgroundOnlyText = false; }
- static void SetPropOn(void) { Details.proportional = true; }
- static void SetPropOff(void) { Details.proportional = false; }
+ static void SetSlantRefPoint(float x, float y);
+ static void SetSlant(float s);
+ static void SetJustifyOn(void);
+ static void SetJustifyOff(void);
+ static void SetRightJustifyOn(void);
+ static void SetRightJustifyOff(void);
+ static void SetCentreOn(void);
+ static void SetCentreOff(void);
+ static void SetWrapx(float x);
+ static void SetCentreSize(float s);
+ static void SetBackgroundOn(void);
+ static void SetBackgroundOff(void);
+ static void SetBackGroundOnlyTextOn(void);
+ static void SetBackGroundOnlyTextOff(void);
+ static void SetPropOn(void);
+ static void SetPropOff(void);
static void SetFontStyle(int16 style);
- static void SetRightJustifyWrap(float wrap) { Details.rightJustifyWrap = wrap; }
- static void SetAlphaFade(float fade) { Details.alphaFade = fade; }
- static void SetDropShadowPosition(int16 pos) { Details.dropShadowPosition = pos; }
+ static void SetRightJustifyWrap(float wrap);
+ static void SetAlphaFade(float fade);
+ static void SetDropShadowPosition(int16 pos);
static void SetBackgroundColor(CRGBA col);
static void SetColor(CRGBA col);
static void SetDropColor(CRGBA col);
diff --git a/src/render/Hud.cpp b/src/render/Hud.cpp
index 350e8c45..f3181fa8 100644
--- a/src/render/Hud.cpp
+++ b/src/render/Hud.cpp
@@ -449,10 +449,10 @@ void CHud::Draw()
}
if (m_WeaponState != FADED_OUT) {
CWeapon *weapon = playerPed->GetWeapon();
- uint32 AmmoAmount = CWeaponInfo::GetWeaponInfo((eWeaponType)WeaponType)->m_nAmountofAmmunition;
- uint32 AmmoInClip = weapon->m_nAmmoInClip;
- uint32 TotalAmmo = weapon->m_nAmmoTotal;
- uint32 Ammo, Clip;
+ int32 AmmoAmount = CWeaponInfo::GetWeaponInfo((eWeaponType)WeaponType)->m_nAmountofAmmunition;
+ int32 AmmoInClip = weapon->m_nAmmoInClip;
+ int32 TotalAmmo = weapon->m_nAmmoTotal;
+ int32 Ammo, Clip;
if (AmmoAmount <= 1 || AmmoAmount >= 1000)
sprintf(sTemp, "%d", TotalAmmo);
diff --git a/src/render/MBlur.cpp b/src/render/MBlur.cpp
index 205f9d92..5abc94b9 100644
--- a/src/render/MBlur.cpp
+++ b/src/render/MBlur.cpp
@@ -591,6 +591,8 @@ CMBlur::AddRenderFx(RwCamera *cam, RwRect *rect, float z, FxType type)
void
CMBlur::OverlayRenderFx(RwCamera *cam, RwRaster *frontBuf)
{
+ //TODO(LCS)
+#if 0
bool drawWaterDrops = false;
RwIm2DVertex verts[4];
int red = (0.75f*CTimeCycle::GetDirectionalRed() + CTimeCycle::GetAmbientRed())*0.55f * 255;
@@ -796,4 +798,5 @@ CMBlur::OverlayRenderFx(RwCamera *cam, RwRaster *frontBuf)
RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE);
RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)FALSE);
pBufVertCount = 0;
+#endif
}
diff --git a/src/render/Particle.cpp b/src/render/Particle.cpp
index 51249844..d6ee36a1 100644
--- a/src/render/Particle.cpp
+++ b/src/render/Particle.cpp
@@ -12,6 +12,7 @@
#include "Replay.h"
#include "Stats.h"
#include "Weather.h"
+#include "WaterLevel.h"
#include "MBlur.h"
#include "main.h"
#include "AudioScriptObject.h"
@@ -212,7 +213,6 @@ RwRaster *gpLetterRaster;
RwTexture *gpSparkTex;
RwTexture *gpNewspaperTex;
RwTexture *gpGunSmokeTex;
-RwTexture *gpDotTex;
RwTexture *gpHeatHazeTex;
RwTexture *gpBeastieTex;
RwTexture *gpRainDripTex[MAX_RAINDRIP_FILES];
@@ -221,34 +221,30 @@ RwTexture *gpRainDripDarkTex[MAX_RAINDRIP_FILES];
RwRaster *gpSparkRaster;
RwRaster *gpNewspaperRaster;
RwRaster *gpGunSmokeRaster;
-RwRaster *gpDotRaster;
RwRaster *gpHeatHazeRaster;
RwRaster *gpBeastieRaster;
RwRaster *gpRainDripRaster[MAX_RAINDRIP_FILES];
RwRaster *gpRainDripDarkRaster[MAX_RAINDRIP_FILES];
+RwTexture *gpFireHoseTex;
+RwRaster *gpFireHoseRaster;
+
+RwTexture *gpMultiPlayerHitTex;
+RwRaster *gpMultiPlayerHitRaster;
+
float CParticle::ms_afRandTable[CParticle::RAND_TABLE_SIZE];
CParticle *CParticle::m_pUnusedListHead;
float CParticle::m_SinTable[CParticle::SIN_COS_TABLE_SIZE];
float CParticle::m_CosTable[CParticle::SIN_COS_TABLE_SIZE];
int32 Randomizer;
-int32 nParticleCreationInterval = 1;
float PARTICLE_WIND_TEST_SCALE = 0.002f;
-float fParticleScaleLimit = 0.5f;
-
-bool clearWaterDrop;
-int32 numWaterDropOnScreen;
#ifdef DEBUGMENU
SETTWEAKPATH("Particle");
-TWEAKINT32(nParticleCreationInterval, 0, 5, 1);
-TWEAKFLOAT(fParticleScaleLimit, 0.0f, 1.0f, 0.1f);
TWEAKFUNC(CParticle::ReloadConfig);
#endif
-
-
void CParticle::ReloadConfig()
{
debug("Initialising CParticleMgr...");
@@ -286,14 +282,6 @@ void CParticle::ReloadConfig()
gParticleArray[i].m_nFadeAlphaTimer = 0;
- gParticleArray[i].m_nCurrentZRotation = 0;
-
- gParticleArray[i].m_nZRotationTimer = 0;
-
- gParticleArray[i].m_fCurrentZRadius = 0.0f;
-
- gParticleArray[i].m_nZRadiusTimer = 0;
-
gParticleArray[i].m_nCurrentFrame = 0;
gParticleArray[i].m_nAnimationSpeedTimer = 0;
@@ -318,7 +306,7 @@ void CParticle::Initialise()
}
for ( int32 i = 0; i < SIN_COS_TABLE_SIZE; i++ )
- {
+ {
float angle = DEGTORAD(float(i) * float(360.0f / SIN_COS_TABLE_SIZE));
m_SinTable[i] = ::Sin(angle);
@@ -333,83 +321,98 @@ void CParticle::Initialise()
for ( int32 i = 0; i < MAX_SMOKE_FILES; i++ )
{
gpSmokeTex[i] = RwTextureRead(SmokeFiles[i], nil);
+ ASSERT(gpSmokeTex[i] != nil);
gpSmokeRaster[i] = RwTextureGetRaster(gpSmokeTex[i]);
}
gpSmoke2Tex = RwTextureRead("smokeII_3", nil);
+ ASSERT(gpSmoke2Tex != nil);
gpSmoke2Raster = RwTextureGetRaster(gpSmoke2Tex);
for ( int32 i = 0; i < MAX_RUBBER_FILES; i++ )
{
gpRubberTex[i] = RwTextureRead(RubberFiles[i], nil);
+ ASSERT(gpRubberTex[i] != nil);
gpRubberRaster[i] = RwTextureGetRaster(gpRubberTex[i]);
}
for ( int32 i = 0; i < MAX_RAINSPLASH_FILES; i++ )
{
gpRainSplashTex[i] = RwTextureRead(RainSplashFiles[i], nil);
+ ASSERT(gpRainSplashTex[i] != nil);
gpRainSplashRaster[i] = RwTextureGetRaster(gpRainSplashTex[i]);
}
for ( int32 i = 0; i < MAX_WATERSPRAY_FILES; i++ )
{
gpWatersprayTex[i] = RwTextureRead(WatersprayFiles[i], nil);
+ ASSERT(gpWatersprayTex[i] != nil);
gpWatersprayRaster[i] = RwTextureGetRaster(gpWatersprayTex[i]);
}
for ( int32 i = 0; i < MAX_EXPLOSIONMEDIUM_FILES; i++ )
{
gpExplosionMediumTex[i] = RwTextureRead(ExplosionMediumFiles[i], nil);
+ ASSERT(gpExplosionMediumTex[i] != nil);
gpExplosionMediumRaster[i] = RwTextureGetRaster(gpExplosionMediumTex[i]);
}
for ( int32 i = 0; i < MAX_GUNFLASH_FILES; i++ )
{
gpGunFlashTex[i] = RwTextureRead(GunFlashFiles[i], nil);
+ ASSERT(gpGunFlashTex[i] != nil);
gpGunFlashRaster[i] = RwTextureGetRaster(gpGunFlashTex[i]);
}
gpRainDropTex = RwTextureRead("raindrop4", nil);
+ ASSERT(gpRainDropTex != nil);
gpRainDropRaster = RwTextureGetRaster(gpRainDropTex);
-
for ( int32 i = 0; i < MAX_RAINSPLASHUP_FILES; i++ )
{
gpRainSplashupTex[i] = RwTextureRead(RainSplashupFiles[i], nil);
+ ASSERT(gpRainSplashupTex[i] != nil);
gpRainSplashupRaster[i] = RwTextureGetRaster(gpRainSplashupTex[i]);
}
for ( int32 i = 0; i < MAX_BIRDFRONT_FILES; i++ )
{
gpBirdfrontTex[i] = RwTextureRead(BirdfrontFiles[i], nil);
+ ASSERT(gpBirdfrontTex[i] != nil);
gpBirdfrontRaster[i] = RwTextureGetRaster(gpBirdfrontTex[i]);
}
for ( int32 i = 0; i < MAX_BOAT_FILES; i++ )
{
gpBoatTex[i] = RwTextureRead(BoatFiles[i], nil);
+ ASSERT(gpBoatTex[i] != nil);
gpBoatRaster[i] = RwTextureGetRaster(gpBoatTex[i]);
}
for ( int32 i = 0; i < MAX_CARDEBRIS_FILES; i++ )
{
gpCarDebrisTex[i] = RwTextureRead(CardebrisFiles[i], nil);
+ ASSERT(gpCarDebrisTex[i] != nil);
gpCarDebrisRaster[i] = RwTextureGetRaster(gpCarDebrisTex[i]);
}
for ( int32 i = 0; i < MAX_CARSPLASH_FILES; i++ )
{
gpCarSplashTex[i] = RwTextureRead(CarsplashFiles[i], nil);
+ ASSERT(gpCarSplashTex[i] != nil);
gpCarSplashRaster[i] = RwTextureGetRaster(gpCarSplashTex[i]);
}
gpBoatWakeTex = RwTextureRead("boatwake2", nil);
+ ASSERT(gpBoatWakeTex != nil);
gpBoatWakeRaster = RwTextureGetRaster(gpBoatWakeTex);
gpFlame1Tex = RwTextureRead("flame1", nil);
+ ASSERT(gpFlame1Tex != nil);
gpFlame1Raster = RwTextureGetRaster(gpFlame1Tex);
gpFlame5Tex = RwTextureRead("flame5", nil);
+ ASSERT(gpFlame5Tex != nil);
//#ifdef FIX_BUGS
#if 0
@@ -420,70 +423,92 @@ void CParticle::Initialise()
#endif
gpRainDropSmallTex = RwTextureRead("rainsmall", nil);
+ ASSERT(gpRainDropSmallTex != nil);
gpRainDropSmallRaster = RwTextureGetRaster(gpRainDropSmallTex);
gpBloodTex = RwTextureRead("blood", nil);
+ ASSERT(gpBloodTex != nil);
gpBloodRaster = RwTextureGetRaster(gpBloodTex);
gpLeafTex = RwTextureRead("gameleaf01_64", nil);
+ ASSERT(gpLeafTex != nil);
gpLeafRaster = RwTextureGetRaster(gpLeafTex);
gpLetterTex = RwTextureRead("letter", nil);
+ ASSERT(gpLetterTex != nil);
gpLetterRaster = RwTextureGetRaster(gpLetterTex);
gpCloudTex1 = RwTextureRead("cloud3", nil);
+ ASSERT(gpCloudTex1 != nil);
gpCloudRaster1 = RwTextureGetRaster(gpCloudTex1);
gpCloudTex4 = RwTextureRead("cloudmasked", nil);
+ ASSERT(gpCloudTex4 != nil);
gpCloudRaster4 = RwTextureGetRaster(gpCloudTex4);
gpBloodSmallTex = RwTextureRead("bloodsplat2", nil);
+ ASSERT(gpBloodSmallTex != nil);
gpBloodSmallRaster = RwTextureGetRaster(gpBloodSmallTex);
gpGungeTex = RwTextureRead("gunge", nil);
+ ASSERT(gpGungeTex != nil);
gpGungeRaster = RwTextureGetRaster(gpGungeTex);
gpCollisionSmokeTex = RwTextureRead("collisionsmoke", nil);
+ ASSERT(gpCollisionSmokeTex != nil);
gpCollisionSmokeRaster = RwTextureGetRaster(gpCollisionSmokeTex);
gpBulletHitTex = RwTextureRead("bullethitsmoke", nil);
+ ASSERT(gpBulletHitTex != nil);
gpBulletHitRaster = RwTextureGetRaster(gpBulletHitTex);
gpGunShellTex = RwTextureRead("gunshell", nil);
+ ASSERT(gpGunShellTex != nil);
gpGunShellRaster = RwTextureGetRaster(gpGunShellTex);
- gpPointlightTex = RwTextureRead("pointlight", nil);
+ gpPointlightTex = RwTextureRead("smoke5", nil);
+ ASSERT(gpPointlightTex != nil);
gpPointlightRaster = RwTextureGetRaster(gpPointlightTex);
gpSparkTex = RwTextureRead("spark", nil);
+ ASSERT(gpSparkTex != nil);
gpSparkRaster = RwTextureGetRaster(gpSparkTex);
- gpNewspaperTex = RwTextureRead("newspaper02_64", nil);
+ gpNewspaperTex = RwTextureRead("ballot_paper", nil);
+ ASSERT(gpNewspaperTex != nil);
gpNewspaperRaster = RwTextureGetRaster(gpNewspaperTex);
gpGunSmokeTex = RwTextureRead("gunsmoke3", nil);
+ ASSERT(gpGunSmokeTex != nil);
gpGunSmokeRaster = RwTextureGetRaster(gpGunSmokeTex);
- gpDotTex = RwTextureRead("dot", nil);
- gpDotRaster = RwTextureGetRaster(gpDotTex);
-
gpHeatHazeTex = RwTextureRead("heathaze", nil);
+ ASSERT(gpHeatHazeTex != nil);
gpHeatHazeRaster = RwTextureGetRaster(gpHeatHazeTex);
gpBeastieTex = RwTextureRead("beastie", nil);
+ ASSERT(gpBeastieTex != nil);
gpBeastieRaster = RwTextureGetRaster(gpBeastieTex);
gpRainDripTex[0] = RwTextureRead("raindrip64", nil);
+ ASSERT(gpRainDripTex[0] != nil);
gpRainDripRaster[0] = RwTextureGetRaster(gpRainDripTex[0]);
gpRainDripTex[1] = RwTextureRead("raindripb64", nil);
+ ASSERT(gpRainDripTex[1] != nil);
gpRainDripRaster[1] = RwTextureGetRaster(gpRainDripTex[1]);
gpRainDripDarkTex[0] = RwTextureRead("raindrip64_d", nil);
+ ASSERT(gpRainDripDarkTex[0] != nil);
gpRainDripDarkRaster[0] = RwTextureGetRaster(gpRainDripDarkTex[0]);
- gpRainDripDarkTex[1] = RwTextureRead("raindripb64_d", nil);
- gpRainDripDarkRaster[1] = RwTextureGetRaster(gpRainDripDarkTex[1]);
+ gpMultiPlayerHitTex = RwTextureRead("mphit", nil);
+ ASSERT(gpMultiPlayerHitTex != nil);
+ gpMultiPlayerHitRaster = RwTextureGetRaster(gpMultiPlayerHitTex);
+
+ gpFireHoseTex = RwTextureRead("firehose", nil);
+ ASSERT(gpFireHoseTex != nil);
+ gpFireHoseRaster = RwTextureGetRaster(gpFireHoseTex);
CTxdStore::PopCurrentTxd();
@@ -491,98 +516,84 @@ void CParticle::Initialise()
{
tParticleSystemData *entry = &mod_ParticleSystemManager.m_aParticles[i];
- switch ( i )
+ switch( i )
{
case PARTICLE_SPARK:
+ entry->m_ppRaster = &gpRainDropSmallRaster;
+ break;
+
case PARTICLE_SPARK_SMALL:
- case PARTICLE_RAINDROP_SMALL:
- case PARTICLE_HELI_ATTACK:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
-
+
case PARTICLE_WATER_SPARK:
entry->m_ppRaster = &gpSparkRaster;
break;
-
+
case PARTICLE_WHEEL_DIRT:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
case PARTICLE_SAND:
- case PARTICLE_STEAM2:
- case PARTICLE_STEAM_NY:
- case PARTICLE_STEAM_NY_SLOWMOTION:
- case PARTICLE_GROUND_STEAM:
- case PARTICLE_ENGINE_STEAM:
- case PARTICLE_PEDFOOT_DUST:
- case PARTICLE_CAR_DUST:
- case PARTICLE_EXHAUST_FUMES:
entry->m_ppRaster = &gpSmoke2Raster;
break;
-
+
case PARTICLE_WHEEL_WATER:
- case PARTICLE_WATER:
- case PARTICLE_SMOKE:
- case PARTICLE_SMOKE_SLOWMOTION:
- case PARTICLE_DRY_ICE:
- case PARTICLE_GARAGEPAINT_SPRAY:
- case PARTICLE_STEAM:
- case PARTICLE_WATER_CANNON:
- case PARTICLE_EXTINGUISH_STEAM:
- case PARTICLE_HELI_DUST:
- case PARTICLE_PAINT_SMOKE:
- case PARTICLE_BULLETHIT_SMOKE:
entry->m_ppRaster = gpSmokeRaster;
break;
-
+
case PARTICLE_BLOOD:
entry->m_ppRaster = &gpBloodRaster;
break;
-
+
case PARTICLE_BLOOD_SMALL:
+ entry->m_ppRaster = &gpBloodSmallRaster;
+ break;
+
case PARTICLE_BLOOD_SPURT:
entry->m_ppRaster = &gpBloodSmallRaster;
break;
-
+
case PARTICLE_DEBRIS:
- case PARTICLE_TREE_LEAVES:
entry->m_ppRaster = &gpLeafRaster;
break;
-
+
case PARTICLE_DEBRIS2:
entry->m_ppRaster = &gpGungeRaster;
break;
-
+
case PARTICLE_FLYERS:
entry->m_ppRaster = &gpNewspaperRaster;
break;
-
+
+ case PARTICLE_WATER:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
case PARTICLE_FLAME:
- case PARTICLE_CARFLAME:
entry->m_ppRaster = &gpFlame1Raster;
break;
-
+
case PARTICLE_FIREBALL:
entry->m_ppRaster = &gpFlame5Raster;
break;
-
+
case PARTICLE_GUNFLASH:
+ entry->m_ppRaster = gpGunFlashRaster;
+ break;
+
case PARTICLE_GUNFLASH_NOANIM:
entry->m_ppRaster = gpGunFlashRaster;
break;
-
-
+
case PARTICLE_GUNSMOKE:
- case PARTICLE_WATERDROP:
- case PARTICLE_BLOODDROP:
- case PARTICLE_HEATHAZE:
- case PARTICLE_HEATHAZE_IN_DIST:
entry->m_ppRaster = nil;
break;
-
+
case PARTICLE_GUNSMOKE2:
- case PARTICLE_BOAT_THRUSTJET:
- case PARTICLE_RUBBER_SMOKE:
entry->m_ppRaster = gpRubberRaster;
break;
-
+
case PARTICLE_CIGARETTE_SMOKE:
entry->m_ppRaster = &gpGunSmokeRaster;
break;
@@ -590,20 +601,56 @@ void CParticle::Initialise()
case PARTICLE_TEARGAS:
entry->m_ppRaster = &gpHeatHazeRaster;
break;
+
+ case PARTICLE_SMOKE:
+ case PARTICLE_SMOKE_SLOWMOTION:
+ case PARTICLE_DRY_ICE:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+ case PARTICLE_GARAGEPAINT_SPRAY:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
case PARTICLE_SHARD:
- case PARTICLE_RAINDROP:
- case PARTICLE_RAINDROP_2D:
entry->m_ppRaster = &gpRainDropRaster;
break;
-
+
case PARTICLE_SPLASH:
- case PARTICLE_PED_SPLASH:
- case PARTICLE_CAR_SPLASH:
- case PARTICLE_WATER_HYDRANT:
entry->m_ppRaster = gpCarSplashRaster;
break;
+
+ case PARTICLE_CARFLAME:
+ entry->m_ppRaster = &gpFlame1Raster;
+ break;
+
+ case PARTICLE_STEAM:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_STEAM2:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_STEAM_NY:
+ case PARTICLE_STEAM_NY_SLOWMOTION:
+ case PARTICLE_GROUND_STEAM:
+ case PARTICLE_HYDRANT_STEAM:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_ENGINE_STEAM:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_RAINDROP:
+ entry->m_ppRaster = &gpRainDropRaster;
+ break;
+ case PARTICLE_RAINDROP_SMALL:
+ entry->m_ppRaster = &gpRainDropSmallRaster;
+ break;
+
case PARTICLE_RAIN_SPLASH:
case PARTICLE_RAIN_SPLASH_BIGGROW:
entry->m_ppRaster = gpRainSplashRaster;
@@ -617,44 +664,140 @@ void CParticle::Initialise()
entry->m_ppRaster = gpWatersprayRaster;
break;
+ case PARTICLE_RAINDROP_2D:
+ entry->m_ppRaster = &gpRainDropRaster;
+ break;
+
case PARTICLE_EXPLOSION_MEDIUM:
+ entry->m_ppRaster = gpExplosionMediumRaster;
+ break;
+
case PARTICLE_EXPLOSION_LARGE:
+ entry->m_ppRaster = gpExplosionMediumRaster;
+ break;
+
case PARTICLE_EXPLOSION_MFAST:
+ entry->m_ppRaster = gpExplosionMediumRaster;
+ break;
+
case PARTICLE_EXPLOSION_LFAST:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
+ case PARTICLE_CAR_SPLASH:
+ entry->m_ppRaster = gpCarSplashRaster;
+ break;
+
case PARTICLE_BOAT_SPLASH:
entry->m_ppRaster = &gpBoatWakeRaster;
break;
+ case PARTICLE_BOAT_THRUSTJET:
+ entry->m_ppRaster = gpRubberRaster;
+ break;
+
+ case PARTICLE_WATER_HYDRANT:
+ entry->m_ppRaster = gpCarSplashRaster;
+ break;
+
+ case PARTICLE_WATER_CANNON:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_EXTINGUISH_STEAM:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_PED_SPLASH:
+ entry->m_ppRaster = gpCarSplashRaster;
+ break;
+
+ case PARTICLE_PEDFOOT_DUST:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_CAR_DUST:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_HELI_DUST:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_HELI_ATTACK:
+ entry->m_ppRaster = &gpRainDropSmallRaster;
+ break;
+
case PARTICLE_ENGINE_SMOKE:
+ entry->m_ppRaster = &gpCloudRaster4;
+ break;
+
case PARTICLE_ENGINE_SMOKE2:
+ case PARTICLE_ROCKET_SMOKE:
+ entry->m_ppRaster = &gpCloudRaster4;
+ break;
+
case PARTICLE_CARFLAME_SMOKE:
+ entry->m_ppRaster = &gpCloudRaster4;
+ break;
+
case PARTICLE_FIREBALL_SMOKE:
- case PARTICLE_ROCKET_SMOKE:
- case PARTICLE_TEST:
entry->m_ppRaster = &gpCloudRaster4;
break;
+ case PARTICLE_PAINT_SMOKE:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_TREE_LEAVES:
+ entry->m_ppRaster = &gpLeafRaster;
+ break;
+
case PARTICLE_CARCOLLISION_DUST:
- case PARTICLE_BURNINGRUBBER_SMOKE:
entry->m_ppRaster = &gpCollisionSmokeRaster;
break;
case PARTICLE_CAR_DEBRIS:
- case PARTICLE_HELI_DEBRIS:
case PARTICLE_BIRD_DEBRIS:
+ case PARTICLE_HELI_DEBRIS:
entry->m_ppRaster = gpCarDebrisRaster;
break;
+ case PARTICLE_EXHAUST_FUMES:
+ entry->m_ppRaster = &gpSmoke2Raster;
+ break;
+
+ case PARTICLE_RUBBER_SMOKE:
+ entry->m_ppRaster = gpRubberRaster;
+ break;
+
+ case PARTICLE_BURNINGRUBBER_SMOKE:
+ entry->m_ppRaster = &gpCollisionSmokeRaster;
+ break;
+
+ case PARTICLE_BULLETHIT_SMOKE:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
case PARTICLE_GUNSHELL_FIRST:
+ entry->m_ppRaster = &gpGunShellRaster;
+ break;
+
case PARTICLE_GUNSHELL:
+ entry->m_ppRaster = &gpGunShellRaster;
+ break;
+
case PARTICLE_GUNSHELL_BUMP1:
+ entry->m_ppRaster = &gpGunShellRaster;
+ break;
+
case PARTICLE_GUNSHELL_BUMP2:
entry->m_ppRaster = &gpGunShellRaster;
break;
+ case PARTICLE_TEST:
+ entry->m_ppRaster = &gpCloudRaster4;
+ break;
case PARTICLE_BIRD_FRONT:
entry->m_ppRaster = gpBirdfrontRaster;
@@ -667,6 +810,14 @@ void CParticle::Initialise()
case PARTICLE_BEASTIE:
entry->m_ppRaster = &gpBeastieRaster;
break;
+
+ case PARTICLE_FERRY_CHIM_SMOKE:
+ entry->m_ppRaster = gpSmokeRaster;
+ break;
+
+ case PARTICLE_MULTIPLAYER_HIT:
+ entry->m_ppRaster = &gpMultiPlayerHitRaster;
+ break;
}
}
@@ -754,8 +905,13 @@ void CParticle::Shutdown()
RwTextureDestroy(gpRainDripTex[i]);
gpRainDripTex[i] = nil;
- RwTextureDestroy(gpRainDripDarkTex[i]);
- gpRainDripDarkTex[i] = nil;
+#ifdef FIX_BUGS
+ if (gpRainDripDarkTex[i])
+#endif
+ {
+ RwTextureDestroy(gpRainDripDarkTex[i]);
+ gpRainDripDarkTex[i] = nil;
+ }
}
RwTextureDestroy(gpBoatWakeTex);
@@ -811,14 +967,18 @@ void CParticle::Shutdown()
RwTextureDestroy(gpGunSmokeTex);
gpGunSmokeTex = nil;
-
- RwTextureDestroy(gpDotTex);
- gpDotTex = nil;
+
RwTextureDestroy(gpHeatHazeTex);
gpHeatHazeTex = nil;
RwTextureDestroy(gpBeastieTex);
gpBeastieTex = nil;
+
+ RwTextureDestroy(gpMultiPlayerHitTex);
+ gpBeastieTex = nil;
+
+ RwTextureDestroy(gpFireHoseTex);
+ gpFireHoseTex = nil;
int32 slot;
@@ -870,24 +1030,12 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVector const &vecDir, CEntity *pEntity, float fSize, RwRGBA const &color, int32 nRotationSpeed, int32 nRotation, int32 nCurFrame, int32 nLifeSpan)
{
- if ( CTimer::GetIsPaused() )
+ if ( CTimer::GetIsPaused() /*TODO: || byte_355C47*/ )
return nil;
-
- if ( ( type == PARTICLE_ENGINE_SMOKE
- || type == PARTICLE_ENGINE_SMOKE2
- || type == PARTICLE_ENGINE_STEAM
- || type == PARTICLE_CARFLAME_SMOKE
- || type == PARTICLE_RUBBER_SMOKE
- || type == PARTICLE_BURNINGRUBBER_SMOKE
- || type == PARTICLE_EXHAUST_FUMES
- || type == PARTICLE_CARCOLLISION_DUST )
- && nParticleCreationInterval & CTimer::GetFrameCounter() )
- {
- return nil;
- }
-
+/*
if ( !CReplay::IsPlayingBack() )
CReplay::RecordParticle(type, vecPos, vecDir, fSize, color);
+*/
CParticle *pParticle = m_pUnusedListHead;
@@ -922,38 +1070,15 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
if ( psystem->m_nFadeAlphaTime )
pParticle->m_nFadeAlphaTimer /= psystem->m_nFadeAlphaTime;
- pParticle->m_nCurrentZRotation = psystem->m_nZRotationInitialAngle;
- pParticle->m_fCurrentZRadius = psystem->m_fInitialZRadius;
-
if ( nCurFrame != 0 )
pParticle->m_nCurrentFrame = nCurFrame;
else
pParticle->m_nCurrentFrame = psystem->m_nStartAnimationFrame;
-
- pParticle->m_nZRotationTimer = 0;
- pParticle->m_nZRadiusTimer = 0;
pParticle->m_nAnimationSpeedTimer = 0;
pParticle->m_fZGround = 0.0f;
-
- if ( type != PARTICLE_HEATHAZE )
- pParticle->m_vecPosition = vecPos;
- else
- {
- CVector screen;
- float w, h;
-
- if ( !CSprite::CalcScreenCoors(vecPos, &screen, &w, &h, true) )
- return nil;
-
- pParticle->m_vecPosition = screen;
- psystem->m_vecTextureStretch.x = w;
- psystem->m_vecTextureStretch.y = h;
- }
-
+ pParticle->m_vecPosition = vecPos;
pParticle->m_vecVelocity = vecDir;
-
- pParticle->m_vecParticleMovementOffset = CVector(0.0f, 0.0f, 0.0f);
pParticle->m_nTimeWhenColorWillBeChanged = 0;
if ( color.alpha != 0 )
@@ -1090,14 +1215,14 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
break;
case PARTICLE_EXPLOSION_MEDIUM:
- pParticle->m_nColorIntensity -= 30 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ?
+ pParticle->m_nColorIntensity -= 2 * 15 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ?
pParticle->m_nAnimationSpeedTimer = CGeneral::GetRandomNumber() & 7;
pParticle->m_fSize = CGeneral::GetRandomNumberInRange(0.3f, 0.8f);
pParticle->m_vecPosition.z -= CGeneral::GetRandomNumberInRange(-0.1f, 0.1f);
break;
case PARTICLE_EXPLOSION_LARGE:
- pParticle->m_nColorIntensity -= 30 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ?
+ pParticle->m_nColorIntensity -= 2 * 15 * (CGeneral::GetRandomNumber() & 1); // mb "+= -30 * rand" here ?
pParticle->m_nAnimationSpeedTimer = CGeneral::GetRandomNumber() & 7;
pParticle->m_fSize = CGeneral::GetRandomNumberInRange(0.8f, 1.4f);
pParticle->m_vecPosition.z -= CGeneral::GetRandomNumberInRange(-0.3f, 0.3f);
@@ -1123,7 +1248,7 @@ CParticle *CParticle::AddParticle(tParticleType type, CVector const &vecPos, CVe
void CParticle::Update()
{
- if ( CTimer::GetIsPaused() )
+ if ( CTimer::GetIsPaused() /*TODO: || byte_355C47*/ )
return;
CRGBA color(0, 0, 0, 0);
@@ -1136,7 +1261,9 @@ void CParticle::Update()
float fFricDeccel99 = pow(0.99f, CTimer::GetTimeStep());
CParticleObject::UpdateAll();
-
+
+ // no more erectedcocks
+#ifndef FIX_BUGS
// ejaculation at 23:00, 23:15, 23:30, 23:45
if ( CClock::ms_nGameClockHours == 23 &&
( CClock::ms_nGameClockMinutes == 0
@@ -1155,6 +1282,7 @@ void CParticle::Update()
1,
1000);
}
+#endif
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
@@ -1174,68 +1302,7 @@ void CParticle::Update()
CVector vecMoveStep = particle->m_vecVelocity * CTimer::GetTimeStep();
CVector vecPos = particle->m_vecPosition;
-
- if ( numWaterDropOnScreen == 0 )
- clearWaterDrop = false;
-
- if ( psystem->m_Type == PARTICLE_WATERDROP )
- {
- if ( CGame::IsInInterior() || clearWaterDrop == true )
- {
- bRemoveParticle = true;
- continue;
- }
-
- static uint8 nWaterDropCount;
-
- if ( nWaterDropCount == 5 )
- {
- vecMoveStep = CVector(0.0f, 0.0f, 0.0f);
- particle->m_nTimeWhenWillBeDestroyed += 1250;
- nWaterDropCount = 0;
- }
- else
- {
- if ( TheCamera.m_CameraAverageSpeed > 0.35f )
- {
- if ( vecMoveStep.Magnitude() > 0.5f )
- {
- if ( vecMoveStep.Magnitude() > 0.4f && vecMoveStep.Magnitude() < 0.8f )
- {
- vecMoveStep.x += TheCamera.m_CameraAverageSpeed * 1.5f;
- vecMoveStep.y += TheCamera.m_CameraAverageSpeed * 1.5f;
- }
- else if ( vecMoveStep.Magnitude() != 0.0f )
- {
- vecMoveStep.x += CGeneral::GetRandomNumberInRange(0.01f, 0.05f);
- vecMoveStep.y += CGeneral::GetRandomNumberInRange(0.01f, 0.05f);
- }
- }
- }
-
- nWaterDropCount++;
- }
-
- if ( vecPos.z <= 1.5f )
- vecMoveStep.z = 0.0f;
- }
-
- if ( psystem->m_Type == PARTICLE_HEATHAZE || psystem->m_Type == PARTICLE_HEATHAZE_IN_DIST )
- {
-#ifdef FIX_BUGS
- int32 nSinCosIndex = (int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) + SIN_COS_TABLE_SIZE) % SIN_COS_TABLE_SIZE;
-#else
- int32 nSinCosIndex = int32(DEGTORAD((float)particle->m_nRotation) * float(SIN_COS_TABLE_SIZE) / TWOPI) % SIN_COS_TABLE_SIZE;
-#endif
- vecMoveStep.x = Sin(nSinCosIndex);
- vecMoveStep.y = Sin(nSinCosIndex);
-
- if ( psystem->m_Type == PARTICLE_HEATHAZE_IN_DIST )
- particle->m_nRotation = int16((float)particle->m_nRotation + 0.75f);
- else
- particle->m_nRotation = int16((float)particle->m_nRotation + 1.0f);
- }
-
+
if ( psystem->m_Type == PARTICLE_BEASTIE )
{
#ifdef FIX_BUGS
@@ -1258,28 +1325,7 @@ void CParticle::Update()
}
vecPos += vecMoveStep;
-
- if ( psystem->m_Type == PARTICLE_FIREBALL )
- {
- AddParticle(PARTICLE_HEATHAZE, particle->m_vecPosition, CVector(0.0f, 0.0f, 0.0f),
- nil, particle->m_fSize * 5.0f);
- }
-
- if ( psystem->m_Type == PARTICLE_GUNSMOKE2 )
- {
- if ( CTimer::GetFrameCounter() & 10 )
- {
-#ifdef FIX_BUGS
- if ( FindPlayerPed() && FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN )
-#else
- if ( FindPlayerPed()->GetWeapon()->m_eWeaponType == WEAPONTYPE_MINIGUN )
-#endif
- {
- AddParticle(PARTICLE_HEATHAZE, particle->m_vecPosition, CVector(0.0f, 0.0f, 0.0f));
- }
- }
- }
-
+
if ( CWeather::Wind > 0.0f )
{
if ( vecMoveStep.Magnitude() != 0.0f )
@@ -1299,12 +1345,15 @@ void CParticle::Update()
|| psystem->m_Type == PARTICLE_BOAT_SPLASH
|| psystem->m_Type == PARTICLE_RAINDROP_2D )
{
- int32 nMaxDrops = int32(6.0f * TheCamera.m_CameraAverageSpeed + 1.0f);
+ //int32 nMaxDrops = int32(6.0f * TheCamera.m_CameraAverageSpeed + 1.0f);
float fDistToCam = 0.0f;
if ( psystem->m_Type == PARTICLE_BOAT_SPLASH || psystem->m_Type == PARTICLE_CAR_SPLASH )
{
- if ( vecPos.z + particle->m_fSize < 5.0f )
+ float fWaterLevel = 0.0f;
+ CWaterLevel::GetWaterLevelNoWaves(vecPos.x, vecPos.y, vecPos.z, &fWaterLevel);
+
+ if ( vecPos.z + particle->m_fSize < fWaterLevel )
{
bRemoveParticle = true;
continue;
@@ -1315,61 +1364,16 @@ void CParticle::Update()
case LOOKING_LEFT:
case LOOKING_RIGHT:
case LOOKING_FORWARD:
- nMaxDrops /= 2;
+ //nMaxDrops /= 2;
break;
default:
- nMaxDrops = 0;
+ //nMaxDrops = 0;
break;
}
fDistToCam = (TheCamera.GetPosition() - vecPos).Magnitude();
}
-
- if ( numWaterDropOnScreen < nMaxDrops && numWaterDropOnScreen < 63
- && fDistToCam < 10.0f
- && clearWaterDrop == false
- && !CGame::IsInInterior() )
- {
- CVector vecWaterdropTarget
- (
- CGeneral::GetRandomNumberInRange(-0.25f, 0.25f),
- CGeneral::GetRandomNumberInRange(0.1f, 0.75f),
- -0.01f
- );
-
- CVector vecWaterdropPos;
-
- if ( TheCamera.m_CameraAverageSpeed < 0.35f )
- vecWaterdropPos.x = (float)CGeneral::GetRandomNumberInRange(50, int32(SCREEN_WIDTH) - 50);
- else
- vecWaterdropPos.x = (float)CGeneral::GetRandomNumberInRange(200, int32(SCREEN_WIDTH) - 200);
-
- if ( psystem->m_Type == PARTICLE_BOAT_SPLASH || psystem->m_Type == PARTICLE_CAR_SPLASH )
- vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(SCREEN_HEIGHT / 2, SCREEN_HEIGHT);
- else
- {
- if ( TheCamera.m_CameraAverageSpeed < 0.35f )
- vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(0, int32(SCREEN_HEIGHT));
- else
- vecWaterdropPos.y = (float)CGeneral::GetRandomNumberInRange(150, int32(SCREEN_HEIGHT) - 200);
- }
-
- vecWaterdropPos.z = 2.0f;
-
- if ( AddParticle(PARTICLE_WATERDROP,
- vecWaterdropPos,
- vecWaterdropTarget,
- nil,
- CGeneral::GetRandomNumberInRange(0.1f, 0.15f),
- 0,
- 0,
- CGeneral::GetRandomNumber() & 1,
- 0) != nil )
- {
- numWaterDropOnScreen++;
- }
- }
}
if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed || particle->m_nAlpha == 0 )
@@ -1432,10 +1436,7 @@ void CParticle::Update()
}
else
size = particle->m_fSize + particle->m_fExpansionRate;
-
- if ( psystem->m_Type == PARTICLE_WATERDROP )
- size = (size - Abs(vecMoveStep.x) * 0.000150000007f) + (Abs(vecMoveStep.z) * 0.0500000007f); //TODO:
-
+
if ( size < 0.0f )
{
bRemoveParticle = true;
@@ -1716,28 +1717,6 @@ void CParticle::Update()
continue;
}
}
-
- if ( psystem->m_nZRotationAngleChangeAmount != 0 )
- {
- if ( particle->m_nZRotationTimer >= psystem->m_nZRotationChangeTime )
- {
- particle->m_nZRotationTimer = 0;
- particle->m_nCurrentZRotation += psystem->m_nZRotationAngleChangeAmount;
- }
- else
- ++particle->m_nZRotationTimer;
- }
-
- if ( psystem->m_fZRadiusChangeAmount != 0.0f )
- {
- if ( particle->m_nZRadiusTimer >= psystem->m_nZRadiusChangeTime )
- {
- particle->m_nZRadiusTimer = 0;
- particle->m_fCurrentZRadius += psystem->m_fZRadiusChangeAmount;
- }
- else
- ++particle->m_nZRadiusTimer;
- }
if ( psystem->m_nAnimationSpeed != 0 )
{
@@ -1764,21 +1743,6 @@ void CParticle::Update()
particle->m_nRotation += particle->m_nRotationStep;
#endif
- if ( particle->m_fCurrentZRadius != 0.0f )
- {
- int32 nSinCosIndex = particle->m_nCurrentZRotation % SIN_COS_TABLE_SIZE;
-
- float fX = (Cos(nSinCosIndex) - Sin(nSinCosIndex)) * particle->m_fCurrentZRadius;
-
- float fY = (Sin(nSinCosIndex) + Cos(nSinCosIndex)) * particle->m_fCurrentZRadius;
-
- vecPos -= particle->m_vecParticleMovementOffset;
-
- vecPos += CVector(fX, fY, 0.0f);
-
- particle->m_vecParticleMovementOffset = CVector(fX, fY, 0.0f);
- }
-
particle->m_vecPosition = vecPos;
}
}
@@ -1809,6 +1773,8 @@ void CParticle::Render()
RwRaster **frames = psystem->m_ppRaster;
tParticleType type = psystem->m_Type;
+ /*
+ something on ps2
if ( type == PARTICLE_ENGINE_SMOKE
|| type == PARTICLE_ENGINE_SMOKE2
|| type == PARTICLE_ENGINE_STEAM
@@ -1820,7 +1786,7 @@ void CParticle::Render()
{
particleBanned = true;
}
-
+ */
if ( particle )
{
if ( (flags & DRAW_OPAQUE) != (psystem->Flags & DRAW_OPAQUE)
@@ -1865,6 +1831,8 @@ void CParticle::Render()
if ( particle->m_nAlpha == 0 )
canDraw = false;
+ // TODO: psp vert buffer check
+
if ( canDraw && psystem->m_nFinalAnimationFrame != 0 && frames != nil )
{
RwRaster *curFrame = frames[particle->m_nCurrentFrame];
@@ -1878,11 +1846,7 @@ void CParticle::Render()
if ( canDraw && psystem->Flags & DRAWTOP2D )
{
- float screenZ = (particle->m_vecPosition.z - CDraw::GetNearClipZ())
- * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ())
- * CDraw::GetFarClipZ()
- / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * particle->m_vecPosition.z )
- + CSprite::GetNearScreenZ();
+ float screenZ = CalcScreenZ(particle->m_vecPosition.z);
float stretchTexW;
float stretchTexH;
@@ -1897,108 +1861,6 @@ void CParticle::Render()
stretchTexW = CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.x + 63.0f;
stretchTexH = CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.y + 63.0f;
}
-
-
- if ( i == PARTICLE_WATERDROP )
- {
- int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed;
-
- stretchTexH += (1.0f - (float)timeLeft ) * psystem->m_vecTextureStretch.y;
-
- RwRect rect;
-
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH));
-
- FxType fxtype;
-
- if ( particle->m_nCurrentFrame != 0 )
- fxtype = FXTYPE_WATER2;
- else
- fxtype = FXTYPE_WATER1;
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, fxtype);
-
- canDraw = false;
- }
-
- if ( i == PARTICLE_BLOODDROP )
- {
- int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed;
-
- stretchTexH += (1.0f + (float)timeLeft) * psystem->m_vecTextureStretch.y;
- stretchTexW += (1.0f - (float)timeLeft) * psystem->m_vecTextureStretch.x;
-
- RwRect rect;
-
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH));
-
- FxType fxtype;
-
- if ( particle->m_nCurrentFrame )
- fxtype = FXTYPE_BLOOD2;
- else
- fxtype = FXTYPE_BLOOD1;
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, fxtype);
-
- canDraw = false;
- }
-
- if ( i == PARTICLE_HEATHAZE_IN_DIST )
- {
- RwRect rect;
-
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH * 0.15f));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * stretchTexW));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * stretchTexH * 0.15f));
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_HEATHAZE);
-
- canDraw = false;
- }
-
- if ( i == PARTICLE_HEATHAZE )
- {
- RwRect rect;
-
- switch ( TheCamera.GetLookDirection() )
- {
- case LOOKING_LEFT:
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x * 2.0f));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
- rect.w = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
-
- break;
-
- case LOOKING_RIGHT:
- rect.x = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x * 4.0f));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
-
- break;
-
- default:
- rect.x = int32(particle->m_vecPosition.x - SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x));
- rect.y = int32(particle->m_vecPosition.y - SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
- rect.w = int32(particle->m_vecPosition.x + SCREEN_STRETCH_X(particle->m_fSize * psystem->m_vecTextureStretch.x));
- rect.h = int32(particle->m_vecPosition.y + SCREEN_STRETCH_Y(particle->m_fSize * psystem->m_vecTextureStretch.y));
-
- break;
- }
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_HEATHAZE);
-
- canDraw = false;
- }
if ( canDraw )
{
@@ -2064,6 +1926,8 @@ void CParticle::Render()
}
else if ( i == PARTICLE_WATER_HYDRANT )
{
+ float screenZ = CalcScreenZ(particle->m_vecPosition.z);
+
int32 timeLeft = (particle->m_nTimeWhenWillBeDestroyed - CTimer::GetTimeInMilliseconds()) / particle->m_nTimeWhenWillBeDestroyed;
w += (1.0f - (float)timeLeft) * psystem->m_vecTextureStretch.x;
@@ -2083,190 +1947,149 @@ void CParticle::Render()
h += CGeneral::GetRandomNumberInRange(0.1f, 1.0f) * psystem->m_vecTextureStretch.y;
}
- if ( i == PARTICLE_WATER_HYDRANT
- || (!particleBanned || SCREEN_WIDTH * fParticleScaleLimit >= w)
- && SCREEN_HEIGHT * fParticleScaleLimit >= h )
+ if ( particle->m_nRotation != 0 && i != PARTICLE_BEASTIE )
+ {
+ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
+ particle->m_fSize * w, particle->m_fSize * h,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ DEGTORAD((float)particle->m_nRotation),
+ particle->m_nAlpha);
+ }
+ else if ( psystem->Flags & SCREEN_TRAIL )
{
- if ( i == PARTICLE_WATER_HYDRANT )
+ float fRotation;
+ float fTrailLength;
+
+ if ( particle->m_fZGround == 0.0f )
{
- RwRect rect;
-
- if ( w > 0.0f )
- {
- rect.x = int32(coors.x - SCREEN_STRETCH_X(particle->m_fSize * w));
- rect.w = int32(coors.x + SCREEN_STRETCH_X(particle->m_fSize * w));
- }
- else
- {
- rect.w = int32(coors.x - SCREEN_STRETCH_X(particle->m_fSize * w));
- rect.x = int32(coors.x + SCREEN_STRETCH_X(particle->m_fSize * w));
- }
-
- if ( h > 0.0f )
- {
- rect.y = int32(coors.y - SCREEN_STRETCH_Y(particle->m_fSize * h));
- rect.h = int32(coors.y + SCREEN_STRETCH_Y(particle->m_fSize * h));
- }
- else
- {
- rect.h = int32(coors.y - SCREEN_STRETCH_Y(particle->m_fSize * h));
- rect.y = int32(coors.y + SCREEN_STRETCH_Y(particle->m_fSize * h));
- }
-
- float screenZ = (coors.z - CDraw::GetNearClipZ())
- * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ()) * CDraw::GetFarClipZ()
- / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * coors.z ) + CSprite::GetNearScreenZ();
-
- CMBlur::AddRenderFx(Scene.camera, &rect, screenZ, FXTYPE_SPLASH1);
+ fTrailLength = 0.0f;
+ fRotation = 0.0f;
}
else
{
- if ( particle->m_nRotation != 0 && i != PARTICLE_BEASTIE )
- {
- CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
- particle->m_fSize * w, particle->m_fSize * h,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- DEGTORAD((float)particle->m_nRotation),
- particle->m_nAlpha);
- }
- else if ( psystem->Flags & SCREEN_TRAIL )
- {
- float fRotation;
- float fTrailLength;
-
- if ( particle->m_fZGround == 0.0f )
- {
- fTrailLength = 0.0f;
- fRotation = 0.0f;
- }
- else
- {
- CVector2D vecDist
- (
- coors.x - particle->m_fZGround,
- coors.y - particle->m_fExpansionRate
- );
+ CVector2D vecDist
+ (
+ coors.x - particle->m_fZGround,
+ coors.y - particle->m_fExpansionRate
+ );
- float fDist = vecDist.Magnitude();
+ float fDist = vecDist.Magnitude();
- fTrailLength = fDist;
-
- float fRot = Asin(vecDist.x / fDist);
+ fTrailLength = fDist;
+
+ float fRot = Asin(vecDist.x / fDist);
- fRotation = fRot;
+ fRotation = fRot;
- if ( vecDist.y < 0.0f )
- fRotation = -1.0f * fRot + DEGTORAD(180.0f);
-
- float fSpeed = particle->m_vecVelocity.Magnitude();
-
- float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
-
- if ( fDist > fNewTrailLength )
- fTrailLength = fNewTrailLength;
- }
-
- CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
- particle->m_fSize * w,
- particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- fRotation,
- particle->m_nAlpha);
+ if ( vecDist.y < 0.0f )
+ fRotation = -1.0f * fRot + DEGTORAD(180.0f);
+
+ float fSpeed = particle->m_vecVelocity.Magnitude();
+
+ float fNewTrailLength = fSpeed * CTimer::GetTimeStep() * w * 2.0f;
+
+ if ( fDist > fNewTrailLength )
+ fTrailLength = fNewTrailLength;
+ }
+
+ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
+ particle->m_fSize * w,
+ particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ fRotation,
+ particle->m_nAlpha);
- particle->m_fZGround = coors.x; // WTF ?
- particle->m_fExpansionRate = coors.y; // WTF ?
- }
- else if ( psystem->Flags & SPEED_TRAIL )
- {
- CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity;
- float fRotation;
- float fTrailLength;
- CVector vecScreenPosition;
-
- if ( CSprite::CalcScreenCoors(vecPrevPos, &vecScreenPosition, &fTrailLength, &fRotation, true) )
- {
- CVector2D vecDist
- (
- coors.x - vecScreenPosition.x,
- coors.y - vecScreenPosition.y
- );
-
- float fDist = vecDist.Magnitude();
-
- fTrailLength = fDist;
-
- float fRot = Asin(vecDist.x / fDist);
-
- fRotation = fRot;
-
- if ( vecDist.y < 0.0f )
- fRotation = -1.0f * fRot + DEGTORAD(180.0f);
- }
- else
- {
- fRotation = 0.0f;
- fTrailLength = 0.0f;
- }
-
- CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
- particle->m_fSize * w,
- particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- fRotation,
- particle->m_nAlpha);
- }
- else if ( psystem->Flags & VERT_TRAIL )
- {
- float fTrailLength = fabsf(particle->m_vecVelocity.z * 10.0f);
-
- CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
- particle->m_fSize * w,
- (particle->m_fSize + fTrailLength * psystem->m_fTrailLengthMultiplier) * h,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- particle->m_nAlpha);
- }
- else if ( i == PARTICLE_RAINDROP_SMALL )
- {
- CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
- particle->m_fSize * w * 0.05f,
- particle->m_fSize * h,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- particle->m_nAlpha);
- }
- /*else if ( i == PARTICLE_BOAT_WAKE )*/
- else
- {
- CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
- particle->m_fSize * w,
- particle->m_fSize * h,
- particle->m_Color.red,
- particle->m_Color.green,
- particle->m_Color.blue,
- particle->m_nColorIntensity,
- 1.0f / coors.z,
- particle->m_nAlpha);
- }
+ particle->m_fZGround = coors.x; // WTF ?
+ particle->m_fExpansionRate = coors.y; // WTF ?
+ }
+ else if ( psystem->Flags & SPEED_TRAIL )
+ {
+ CVector vecPrevPos = particle->m_vecPosition - particle->m_vecVelocity;
+ float fRotation;
+ float fTrailLength;
+ CVector vecScreenPosition;
+
+ if ( CSprite::CalcScreenCoors(vecPrevPos, &vecScreenPosition, &fTrailLength, &fRotation, true) )
+ {
+ CVector2D vecDist
+ (
+ coors.x - vecScreenPosition.x,
+ coors.y - vecScreenPosition.y
+ );
+
+ float fDist = vecDist.Magnitude();
+
+ fTrailLength = fDist;
+
+ float fRot = Asin(vecDist.x / fDist);
+
+ fRotation = fRot;
+
+ if ( vecDist.y < 0.0f )
+ fRotation = -1.0f * fRot + DEGTORAD(180.0f);
+ }
+ else
+ {
+ fRotation = 0.0f;
+ fTrailLength = 0.0f;
}
+
+ CSprite::RenderBufferedOneXLUSprite_Rotate_Dimension(coors.x, coors.y, coors.z,
+ particle->m_fSize * w,
+ particle->m_fSize * h + fTrailLength * psystem->m_fTrailLengthMultiplier,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ fRotation,
+ particle->m_nAlpha);
+ }
+ else if ( psystem->Flags & VERT_TRAIL )
+ {
+ float fTrailLength = Abs(particle->m_vecVelocity.z * 10.0f);
+
+ CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
+ particle->m_fSize * w,
+ (particle->m_fSize + fTrailLength * psystem->m_fTrailLengthMultiplier) * h,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ particle->m_nAlpha);
+ }
+ else if ( i == PARTICLE_RAINDROP_SMALL )
+ {
+ CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
+ particle->m_fSize * w * 0.05f,
+ particle->m_fSize * h,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ particle->m_nAlpha);
+ }
+ else
+ {
+ CSprite::RenderBufferedOneXLUSprite(coors.x, coors.y, coors.z,
+ particle->m_fSize * w,
+ particle->m_fSize * h,
+ particle->m_Color.red,
+ particle->m_Color.green,
+ particle->m_Color.blue,
+ particle->m_nColorIntensity,
+ 1.0f / coors.z,
+ particle->m_nAlpha);
}
}
}
@@ -2295,9 +2118,6 @@ void CParticle::RemovePSystem(tParticleType type)
void CParticle::RemoveParticle(CParticle *pParticle, CParticle *pPrevParticle, tParticleSystemData *pPSystemData)
{
- if ( pPSystemData->m_Type == PARTICLE_WATERDROP )
- --numWaterDropOnScreen;
-
if ( pPrevParticle )
pPrevParticle->m_pNext = pParticle->m_pNext;
else
@@ -2397,18 +2217,7 @@ void CParticle::CalWindDir(CVector *vecDirIn, CVector *vecDirOut)
void CParticle::HandleShipsAtHorizonStuff()
{
- tParticleSystemData *psystemdata = &mod_ParticleSystemManager.m_aParticles[PARTICLE_SHIP_SIDE];
-
- for ( CParticle *particle = psystemdata->m_pParticles; particle; particle = particle->m_pNext )
- {
- if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed - 32000
- && CTimer::GetTimeInMilliseconds() < particle->m_nTimeWhenWillBeDestroyed - 22000 )
- {
- particle->m_nAlpha = Min(particle->m_nAlpha + 1, 96);
- }
- if ( CTimer::GetTimeInMilliseconds() > particle->m_nTimeWhenWillBeDestroyed - 10000 )
- particle->m_nFadeAlphaTimer = 1;
- }
+ ;
}
void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
@@ -2448,7 +2257,7 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
bRemoveParticle = true;
for ( int32 i = 0; i < 8; i++ )
- {
+ {
CParticle *pBirdDerbis = AddParticle(PARTICLE_BIRD_DEBRIS,
particle->m_vecPosition,
CVector
@@ -2474,7 +2283,7 @@ void CParticle::HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos)
}
void
-CEntity::AddSteamsFromGround(CVector *unused)
+CEntity::AddSteamsFromGround(CVector *unused) //todo
{
int i, n;
C2dEffect *effect;
diff --git a/src/render/Particle.h b/src/render/Particle.h
index 5542dc02..edfd9b77 100644
--- a/src/render/Particle.h
+++ b/src/render/Particle.h
@@ -18,11 +18,6 @@ public:
uint32 m_nTimeWhenWillBeDestroyed;
uint32 m_nTimeWhenColorWillBeChanged;
float m_fZGround;
- CVector m_vecParticleMovementOffset;
- int16 m_nCurrentZRotation;
- uint16 m_nZRotationTimer;
- float m_fCurrentZRadius;
- uint16 m_nZRadiusTimer;
uint8 m_nColorIntensity;
uint8 m_nAlpha;
float m_fSize;
@@ -35,12 +30,20 @@ public:
uint8 m_nCurrentFrame;
RwRGBA m_Color;
CParticle *m_pNext;
+
+ //CVector m_vecParticleMovementOffset;
+ //int16 m_nCurrentZRotation;
+ //uint16 m_nZRotationTimer;
+ //float m_fCurrentZRadius;
+ //uint16 m_nZRadiusTimer;
+ int32 field_4C;
+
CParticle()
{
;
}
-
+
~CParticle()
{
;
@@ -97,12 +100,9 @@ public:
static void HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos);
};
-extern bool clearWaterDrop;
-extern int32 numWaterDropOnScreen;
extern RwRaster *gpCarSplashRaster[];
extern RwRaster *gpHeatHazeRaster;
-extern RwRaster *gpDotRaster;
extern RwRaster *gpRainDripRaster[];
extern RwRaster *gpRainDripDarkRaster[];
-VALIDATE_SIZE(CParticle, 0x58);
+VALIDATE_SIZE(CParticle, 0x50);
diff --git a/src/render/ParticleMgr.cpp b/src/render/ParticleMgr.cpp
index f6919435..263c4ae1 100644
--- a/src/render/ParticleMgr.cpp
+++ b/src/render/ParticleMgr.cpp
@@ -4,18 +4,30 @@
#include "FileMgr.h"
#include "ParticleMgr.h"
+// --LCS: File done
+
cParticleSystemMgr mod_ParticleSystemManager;
const char *ParticleFilename = "PARTICLE.CFG";
cParticleSystemMgr::cParticleSystemMgr()
{
- memset(this, 0, sizeof(*this));
+#ifdef FIX_BUGS
+ m_aParticles = nil;
+#endif
+}
+
+cParticleSystemMgr::~cParticleSystemMgr()
+{
+#ifdef FIX_BUGS
+ delete [] m_aParticles;
+#endif
}
void cParticleSystemMgr::Initialise()
{
- LoadParticleData();
+ if ( gMakeResources )
+ LoadParticleData();
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
m_aParticles[i].m_pParticles = nil;
@@ -23,20 +35,30 @@ void cParticleSystemMgr::Initialise()
void cParticleSystemMgr::LoadParticleData()
{
- CFileMgr::SetDir("DATA");
- CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r");
+#ifdef FIX_BUGS
+ delete [] m_aParticles;
+#endif
+ m_aParticles = new tParticleSystemData[MAX_PARTICLES];
+
+ memset(m_aParticles, 0, sizeof(tParticleSystemData)*MAX_PARTICLES);
+
+ CFileMgr::SetDir("Data");
+ ssize_t len = CFileMgr::LoadFile(ParticleFilename, work_buff, ARRAY_SIZE(work_buff), "r");
CFileMgr::SetDir("");
+ ASSERT(!(len <= 0));
+
tParticleSystemData *entry = nil;
int32 type = PARTICLE_FIRST;
+ char *buffEnd = (char *)&work_buff[len];
char *lineStart = (char *)work_buff;
char *lineEnd = lineStart + 1;
char line[500];
char delims[4];
- while ( true )
+ while ( lineStart < buffEnd )
{
ASSERT(lineStart != nil);
ASSERT(lineEnd != nil);
diff --git a/src/render/ParticleMgr.h b/src/render/ParticleMgr.h
index f4afc018..16da2c5f 100644
--- a/src/render/ParticleMgr.h
+++ b/src/render/ParticleMgr.h
@@ -124,15 +124,18 @@ class cParticleSystemMgr
};
public:
- tParticleSystemData m_aParticles[MAX_PARTICLES];
+ tParticleSystemData *m_aParticles;//[MAX_PARTICLES];
cParticleSystemMgr();
+#ifdef FIX_BUGS
+ ~cParticleSystemMgr();
+#endif
void Initialise();
void LoadParticleData();
void RangeCheck(tParticleSystemData *pData) { }
};
-VALIDATE_SIZE(cParticleSystemMgr, 0x2FFC);
+VALIDATE_SIZE(cParticleSystemMgr, 0x4);
extern cParticleSystemMgr mod_ParticleSystemManager;
diff --git a/src/render/ParticleType.h b/src/render/ParticleType.h
index 9578083d..cb3d53f0 100644
--- a/src/render/ParticleType.h
+++ b/src/render/ParticleType.h
@@ -42,8 +42,6 @@ enum tParticleType
PARTICLE_RAIN_SPLASH_BIGGROW,
PARTICLE_RAIN_SPLASHUP,
PARTICLE_WATERSPRAY,
- PARTICLE_WATERDROP,
- PARTICLE_BLOODDROP,
PARTICLE_EXPLOSION_MEDIUM,
PARTICLE_EXPLOSION_LARGE,
PARTICLE_EXPLOSION_MFAST,
@@ -83,10 +81,11 @@ enum tParticleType
PARTICLE_SHIP_SIDE,
PARTICLE_BEASTIE,
PARTICLE_RAINDROP_2D,
- PARTICLE_HEATHAZE,
- PARTICLE_HEATHAZE_IN_DIST,
+ PARTICLE_FERRY_CHIM_SMOKE,
+ PARTICLE_MULTIPLAYER_HIT,
+ PARTICLE_HYDRANT_STEAM,
MAX_PARTICLES,
PARTICLE_FIRST = PARTICLE_SPARK,
- PARTICLE_LAST = PARTICLE_HEATHAZE_IN_DIST
+ PARTICLE_LAST = PARTICLE_HYDRANT_STEAM
}; \ No newline at end of file
diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp
index 2b1df555..ba902bae 100644
--- a/src/render/Shadows.cpp
+++ b/src/render/Shadows.cpp
@@ -76,14 +76,14 @@ CShadows::Init(void)
gpShadowBikeTex = RwTextureRead("shad_bike", nil);
gpShadowBaronTex = RwTextureRead("shad_rcbaron", nil);
gpShadowExplosionTex = RwTextureRead("shad_exp", nil);
- gpShadowHeadLightsTex = RwTextureRead("headlight", nil);
+ gpShadowHeadLightsTex = RwTextureRead("headlight_single", nil);
gpOutline1Tex = RwTextureRead("outline_64", nil);
gpOutline2Tex = RwTextureRead("outline2_64", nil);
gpOutline3Tex = RwTextureRead("outline3_64", nil);
gpBloodPoolTex = RwTextureRead("bloodpool_64", nil);
- gpReflectionTex = RwTextureRead("reflection01", nil);
+ //gpReflectionTex = RwTextureRead("reflection01", nil);
gpWalkDontTex = RwTextureRead("walk_dont", nil);
- gpCrackedGlassTex = RwTextureRead("wincrack_32", nil);
+ //gpCrackedGlassTex = RwTextureRead("wincrack_32", nil);
gpPostShadowTex = RwTextureRead("lamp_shad_64", nil);
CTxdStore::PopCurrentTxd();
@@ -99,9 +99,9 @@ CShadows::Init(void)
ASSERT(gpOutline2Tex != nil);
ASSERT(gpOutline3Tex != nil);
ASSERT(gpBloodPoolTex != nil);
- ASSERT(gpReflectionTex != nil);
+ //ASSERT(gpReflectionTex != nil);
ASSERT(gpWalkDontTex != nil);
- ASSERT(gpCrackedGlassTex != nil);
+ //ASSERT(gpCrackedGlassTex != nil);
ASSERT(gpPostShadowTex != nil);
@@ -178,9 +178,9 @@ CShadows::Shutdown(void)
ASSERT(gpOutline2Tex != nil);
ASSERT(gpOutline3Tex != nil);
ASSERT(gpBloodPoolTex != nil);
- ASSERT(gpReflectionTex != nil);
+ //ASSERT(gpReflectionTex != nil);
ASSERT(gpWalkDontTex != nil);
- ASSERT(gpCrackedGlassTex != nil);
+ //ASSERT(gpCrackedGlassTex != nil);
ASSERT(gpPostShadowTex != nil);
RwTextureDestroy(gpShadowCarTex);
@@ -194,9 +194,9 @@ CShadows::Shutdown(void)
RwTextureDestroy(gpOutline2Tex);
RwTextureDestroy(gpOutline3Tex);
RwTextureDestroy(gpBloodPoolTex);
- RwTextureDestroy(gpReflectionTex);
+ //RwTextureDestroy(gpReflectionTex);
RwTextureDestroy(gpWalkDontTex);
- RwTextureDestroy(gpCrackedGlassTex);
+ //RwTextureDestroy(gpCrackedGlassTex);
RwTextureDestroy(gpPostShadowTex);
}
diff --git a/src/render/Sprite.cpp b/src/render/Sprite.cpp
index ba6ab291..0e4d4fcd 100644
--- a/src/render/Sprite.cpp
+++ b/src/render/Sprite.cpp
@@ -10,6 +10,19 @@ float CSprite::m_f2DFarScreenZ;
float CSprite::m_fRecipNearClipPlane;
int32 CSprite::m_bFlushSpriteBufferSwitchZTest;
+float CalcScreenZ(float z)
+{
+ // LCS TODO: check
+
+ if ( z == 0.0f )
+ return CSprite::GetNearScreenZ();
+
+ return (z - CDraw::GetNearClipZ())
+ * (CSprite::GetFarScreenZ() - CSprite::GetNearScreenZ()) * CDraw::GetFarClipZ()
+ / ( (CDraw::GetFarClipZ() - CDraw::GetNearClipZ()) * z )
+ + CSprite::GetNearScreenZ();
+}
+
float
CSprite::CalcHorizonCoors(void)
{
diff --git a/src/render/Sprite.h b/src/render/Sprite.h
index fae6684e..952837a0 100644
--- a/src/render/Sprite.h
+++ b/src/render/Sprite.h
@@ -29,3 +29,5 @@ public:
static void RenderBufferedOneXLUSprite2D_Rotate_Dimension(float x, float y, float w, float h, const RwRGBA &colour, int16 intens, float rotation, uint8 alpha);
};
+
+extern float CalcScreenZ(float z); \ No newline at end of file
diff --git a/src/render/Weather.cpp b/src/render/Weather.cpp
index dba9ed14..59dcb02a 100644
--- a/src/render/Weather.cpp
+++ b/src/render/Weather.cpp
@@ -330,6 +330,7 @@ void CWeather::Update(void)
void CWeather::AddHeatHaze()
{
+ /*
if(TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN ||
TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED)
return;
@@ -341,6 +342,7 @@ void CWeather::AddHeatHaze()
pos.y = CGeneral::GetRandomNumberInRange(SCREEN_HEIGHT*0.4f, SCREEN_HEIGHT*0.9f);
pos.z = 100.0f;
CParticle::AddParticle(PARTICLE_HEATHAZE_IN_DIST, pos, CVector(0.0f, 0.0f, 0.0f));
+ */
}
void CWeather::AddBeastie()
diff --git a/src/vehicles/Automobile.cpp b/src/vehicles/Automobile.cpp
index 93861aa5..c915f7e2 100644
--- a/src/vehicles/Automobile.cpp
+++ b/src/vehicles/Automobile.cpp
@@ -1858,6 +1858,7 @@ CAutomobile::PreRender(void)
if(DotProduct(GetForward(), camDist) > 0.0f ||
TheCamera.GetLookDirection() == LOOKING_LEFT ||
TheCamera.GetLookDirection() == LOOKING_RIGHT){
+ /*
CParticle::AddParticle(PARTICLE_HEATHAZE, pos1, CVector(0.0f, 0.0f, 0.0f));
if(pHandling->Flags & HANDLING_DBL_EXHAUST)
CParticle::AddParticle(PARTICLE_HEATHAZE, pos2, CVector(0.0f, 0.0f, 0.0f));
@@ -1865,6 +1866,7 @@ CAutomobile::PreRender(void)
CParticle::AddParticle(PARTICLE_HEATHAZE, pos1, CVector(0.0f, 0.0f, 0.0f));
if(pHandling->Flags & HANDLING_DBL_EXHAUST)
CParticle::AddParticle(PARTICLE_HEATHAZE, pos2, CVector(0.0f, 0.0f, 0.0f));
+ */
}
}
diff --git a/src/vehicles/Bike.cpp b/src/vehicles/Bike.cpp
index cc57f1b4..6d70c22a 100644
--- a/src/vehicles/Bike.cpp
+++ b/src/vehicles/Bike.cpp
@@ -1724,7 +1724,7 @@ CBike::PreRender(void)
TheCamera.GetLookDirection() == LOOKING_RIGHT)
pos1 -= 0.2f*GetForward();
- CParticle::AddParticle(PARTICLE_HEATHAZE, pos1, CVector(0.0f, 0.0f, 0.0f));
+ //CParticle::AddParticle(PARTICLE_HEATHAZE, pos1, CVector(0.0f, 0.0f, 0.0f));
}
}
}
diff --git a/src/vehicles/Boat.cpp b/src/vehicles/Boat.cpp
index 622573b0..e97bfa0d 100644
--- a/src/vehicles/Boat.cpp
+++ b/src/vehicles/Boat.cpp
@@ -682,6 +682,7 @@ CBoat::ProcessControl(void)
}
// Spray waterdrops on screen
+ /*
if(TheCamera.GetLookingForwardFirstPerson() && FindPlayerVehicle() && FindPlayerVehicle()->IsBoat() &&
m_nDeltaVolumeUnderWater > 0 && numWaterDropOnScreen < 20){
CVector dropPos;
@@ -712,7 +713,7 @@ CBoat::ProcessControl(void)
if(CParticle::AddParticle(PARTICLE_WATERDROP, dropPos, dropDir, nil,
CGeneral::GetRandomNumberInRange(0.1f, 0.15f), dropColor, 0, 0, frm))
numWaterDropOnScreen++;
- }
+ }*/
if(m_fPrevVolumeUnderWater == 0.0f && m_fVolumeUnderWater > 0.0f && GetModelIndex() == MI_SKIMMER){
CVector splashDir(0.0f, 0.0f, 0.25f*speed);
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index e2213399..bc575e4a 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -645,9 +645,9 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
CVector dropDir(CGeneral::GetRandomNumberInRange(-0.15f, 0.15f), CGeneral::GetRandomNumberInRange(0.1f, 0.35f), 0.f);
CVector dropPos(CGeneral::GetRandomNumberInRange(SCREEN_STRETCH_X(50.0f), SCREEN_STRETCH_FROM_RIGHT(50.0f)),
CGeneral::GetRandomNumberInRange(SCREEN_STRETCH_Y(50.0f), SCREEN_STRETCH_FROM_BOTTOM(50.0f)), 1.f);
- CParticle::AddParticle(PARTICLE_BLOODDROP, dropPos, dropDir, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.15f),
+ /*CParticle::AddParticle(PARTICLE_BLOODDROP, dropPos, dropDir, nil, CGeneral::GetRandomNumberInRange(0.1f, 0.15f),
CRGBA(0, 0, 0, 0), 0, 0, CGeneral::GetRandomNumber() & 1, 0);
-
+ */
}
if (info->m_AnimToPlay == ASSOCGRP_KNIFE)
{
@@ -737,7 +737,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
{
nearCar->VehicleDamage(info->m_nDamage * (0.00075f * nearCar->pHandling->fMass), gaTempSphereColPoints[0].pieceB);
- CParticle::AddParticle(PARTICLE_HEATHAZE, gaTempSphereColPoints[0].point, CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0);
+ //CParticle::AddParticle(PARTICLE_HEATHAZE, gaTempSphereColPoints[0].point, CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0);
}
else
{
@@ -814,7 +814,7 @@ CWeapon::FireMelee(CEntity *shooter, CVector &fireSource)
CParticle::AddParticle(PARTICLE_SPARK, gaTempSphereColPoints[0].point, 0.1f * gaTempSphereColPoints[0].normal, 0, 0.0f, 0, 0, 0, 0);
}
- CParticle::AddParticle(PARTICLE_HEATHAZE, gaTempSphereColPoints[0].point, CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0);
+ //CParticle::AddParticle(PARTICLE_HEATHAZE, gaTempSphereColPoints[0].point, CVector(0.0f, 0.0f, 0.0f), 0, 0.0f, 0, 0, 0, 0);
if (!damageEntityRegistered)
{
@@ -911,7 +911,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
CWorld::bIncludeDeadPeds = true;
CWorld::bIncludeBikers = true;
- CWorld::ProcessLineOfSight(*fireSource, target, point, victim, true, true, true, true, true, false, false, true);
+ ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false);
CWorld::bIncludeDeadPeds = false;
CWorld::bIncludeBikers = false;
}
@@ -924,7 +924,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
shooterPed->TransformToNode(target, PED_HANDR);
CWorld::bIncludeBikers = true;
- CWorld::ProcessLineOfSight(*fireSource, target, point, victim, true, true, true, true, true, false, false, true);
+ ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false);
CWorld::bIncludeBikers = false;
}
}
@@ -935,7 +935,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
CWorld::bIncludeBikers = true;
CWorld::bIncludeDeadPeds = true;
CWorld::bIncludeCarTyres = true;
- CWorld::ProcessLineOfSight(source, target, point, victim, true, true, true, true, true, false, false, true);
+ ProcessLineOfSight(source, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false);
CWorld::bIncludeBikers = false;
CWorld::bIncludeDeadPeds = false;
CWorld::bIncludeCarTyres = false;
@@ -981,7 +981,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
target *= info->m_fRange;
target += *fireSource;
CWorld::pIgnoreEntity = shooter;
- CWorld::ProcessLineOfSight(*fireSource, target, point, victim, true, true, true, true, true, false, false, true);
+ ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false);
CWorld::pIgnoreEntity = nil;
int32 rotSpeed = 1;
@@ -1014,7 +1014,7 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
}
CWorld::bIncludeBikers = true;
- CWorld::ProcessLineOfSight(*fireSource, target, point, victim, true, true, true, true, true, false, false, true);
+ ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false);
CWorld::bIncludeBikers = false;
int32 rotSpeed = 1;
@@ -1683,7 +1683,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
CWorld::bIncludeCarTyres = true;
CWorld::bIncludeBikers = true;
CWorld::bIncludeDeadPeds = true;
- CWorld::ProcessLineOfSight(source, target, point, victim, true, true, true, true, true, false, false, true);
+ ProcessLineOfSight(source, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false);
CWorld::bIncludeDeadPeds = false;
CWorld::bIncludeCarTyres = false;
}
@@ -1716,7 +1716,7 @@ CWeapon::FireShotgun(CEntity *shooter, CVector *fireSource)
CWorld::bIncludeDeadPeds = true;
CWorld::bIncludeBikers = true;
- CWorld::ProcessLineOfSight(*fireSource, target, point, victim, true, true, true, true, true, false, false, true);
+ ProcessLineOfSight(*fireSource, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, false, false);
CWorld::bIncludeDeadPeds = false;
}
CWorld::bIncludeBikers = false;
@@ -2329,7 +2329,7 @@ CWeapon::FireM16_1stPerson(CEntity *shooter)
CVector source = cam->Source;
CVector target = cam->Front*info->m_fRange + source;
- if (CWorld::ProcessLineOfSight(source, target, point, victim, true, true, true, true, true, false, false, true)) {
+ if (ProcessLineOfSight(source, target, point, victim, m_eWeaponType, shooter, true, true, true, true, true, true, false)) {
CheckForShootingVehicleOccupant(&victim, &point, m_eWeaponType, source, target);
}
CWorld::pIgnoreEntity = nil;
@@ -3176,7 +3176,7 @@ CPed::IsPedDoingDriveByShooting(void)
bool
CWeapon::ProcessLineOfSight(CVector const &point1, CVector const &point2, CColPoint &point, CEntity *&entity, eWeaponType type, CEntity *shooter, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
{
- return CWorld::ProcessLineOfSight(point1, point2, point, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, ignoreSeeThrough, ignoreSomeObjects);
+ return CWorld::ProcessLineOfSight(point1, point2, point, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, false, ignoreSomeObjects, true);
}
diff --git a/vendor/librw b/vendor/librw
-Subproject 78d540fce0ca090b07377cee40d73eadfb7a699
+Subproject 61b288a9fe72ae4073c0ac5fd2a5815ed510c8c
diff --git a/vendor/milessdk/include/mss.h b/vendor/milessdk/include/mss.h
index 424fc6e4..b5b20bea 100644
--- a/vendor/milessdk/include/mss.h
+++ b/vendor/milessdk/include/mss.h
@@ -56,75 +56,86 @@ typedef struct _AILSOUNDINFO
void const *initial_ptr;
} AILSOUNDINFO;
-#define DLLEXPORT extern "C" __declspec(dllexport)
-
-DLLEXPORT S32 WINAPI AIL_enumerate_3D_providers(HPROENUM *next, HPROVIDER *dest, C8 **name);
-DLLEXPORT void WINAPI AIL_release_3D_sample_handle(H3DSAMPLE S);
-DLLEXPORT void WINAPI AIL_close_3D_provider(HPROVIDER lib);
-DLLEXPORT void WINAPI AIL_set_3D_provider_preference(HPROVIDER lib, C8 const *name, void const *val);
-DLLEXPORT M3DRESULT WINAPI AIL_open_3D_provider(HPROVIDER lib);
-DLLEXPORT C8 *WINAPI AIL_last_error(void);
-DLLEXPORT S32 WINAPI AIL_3D_room_type(HPROVIDER lib);
-DLLEXPORT void WINAPI AIL_set_3D_room_type(HPROVIDER lib, S32 room_type);
-DLLEXPORT void WINAPI AIL_3D_provider_attribute(HPROVIDER lib, C8 const *name, void *val);
-DLLEXPORT H3DSAMPLE WINAPI AIL_allocate_3D_sample_handle(HPROVIDER lib);
-DLLEXPORT void WINAPI AIL_set_3D_sample_effects_level(H3DSAMPLE S, F32 effects_level);
-DLLEXPORT void WINAPI AIL_set_3D_speaker_type(HPROVIDER lib, S32 speaker_type);
-DLLEXPORT HSTREAM WINAPI AIL_open_stream(HDIGDRIVER dig, C8 const *filename, S32 stream_mem);
-DLLEXPORT void WINAPI AIL_stream_ms_position(HSTREAM S, S32 *total_milliseconds, S32 *current_milliseconds);
-DLLEXPORT void WINAPI AIL_close_stream(HSTREAM stream);
-DLLEXPORT S32 WINAPI AIL_digital_handle_release(HDIGDRIVER drvr);
-DLLEXPORT S32 WINAPI AIL_digital_handle_reacquire(HDIGDRIVER drvr);
-DLLEXPORT C8 *WINAPI AIL_set_redist_directory(C8 const *dir);
-DLLEXPORT S32 WINAPI AIL_startup(void);
-DLLEXPORT S32 WINAPI AIL_set_preference(U32 number, S32 value);
-DLLEXPORT HDIGDRIVER WINAPI AIL_open_digital_driver(U32 frequency, S32 bits, S32 channel, U32 flags);
-DLLEXPORT void *WINAPI AIL_mem_alloc_lock(U32 size);
-DLLEXPORT HSAMPLE WINAPI AIL_allocate_sample_handle(HDIGDRIVER dig);
-DLLEXPORT void WINAPI AIL_init_sample(HSAMPLE S);
-DLLEXPORT void WINAPI AIL_set_sample_type(HSAMPLE S, S32 format, U32 flags);
-DLLEXPORT void WINAPI AIL_pause_stream(HSTREAM stream, S32 onoff);
-DLLEXPORT void WINAPI AIL_release_sample_handle(HSAMPLE S);
-DLLEXPORT void WINAPI AIL_mem_free_lock(void *ptr);
-DLLEXPORT void WINAPI AIL_close_digital_driver(HDIGDRIVER dig);
-DLLEXPORT void WINAPI AIL_shutdown(void);
-DLLEXPORT void WINAPI AIL_set_3D_sample_volume(H3DSAMPLE S, S32 volume);
-DLLEXPORT void WINAPI AIL_set_sample_volume(HSAMPLE S, S32 volume);
-DLLEXPORT void WINAPI AIL_set_sample_address(HSAMPLE S, void const *start, U32 len);
-DLLEXPORT S32 WINAPI AIL_set_3D_sample_info(H3DSAMPLE S, AILSOUNDINFO const *info);
-DLLEXPORT void WINAPI AIL_set_3D_position(H3DPOBJECT obj, F32 X, F32 Y, F32 Z);
-DLLEXPORT void WINAPI AIL_set_3D_sample_distances(H3DSAMPLE S, F32 max_dist, F32 min_dist);
-DLLEXPORT void WINAPI AIL_set_sample_pan(HSAMPLE S, S32 pan);
-DLLEXPORT void WINAPI AIL_set_sample_playback_rate(HSAMPLE S, S32 playback_rate);
-DLLEXPORT void WINAPI AIL_set_3D_sample_playback_rate(H3DSAMPLE S, S32 playback_rate);
-DLLEXPORT void WINAPI AIL_set_sample_loop_block(HSAMPLE S, S32 loop_start_offset, S32 loop_end_offset);
-DLLEXPORT void WINAPI AIL_set_3D_sample_loop_block(H3DSAMPLE S, S32 loop_start_offset, S32 loop_end_offset);
-DLLEXPORT void WINAPI AIL_set_sample_loop_count(HSAMPLE S, S32 loop_count);
-DLLEXPORT void WINAPI AIL_set_3D_sample_loop_count(H3DSAMPLE S, S32 loops);
-DLLEXPORT U32 WINAPI AIL_sample_status(HSAMPLE S);
-DLLEXPORT U32 WINAPI AIL_3D_sample_status(H3DSAMPLE S);
-DLLEXPORT void WINAPI AIL_start_sample(HSAMPLE S);
-DLLEXPORT void WINAPI AIL_start_3D_sample(H3DSAMPLE S);
-DLLEXPORT void WINAPI AIL_end_sample(HSAMPLE S);
-DLLEXPORT void WINAPI AIL_end_3D_sample(H3DSAMPLE S);
-DLLEXPORT void WINAPI AIL_set_stream_loop_count(HSTREAM stream, S32 count);
-DLLEXPORT S32 WINAPI AIL_service_stream(HSTREAM stream, S32 fillup);
-DLLEXPORT void WINAPI AIL_start_stream(HSTREAM stream);
-DLLEXPORT void WINAPI AIL_set_stream_ms_position(HSTREAM S, S32 milliseconds);
-DLLEXPORT void WINAPI AIL_set_stream_volume(HSTREAM stream, S32 volume);
-DLLEXPORT void WINAPI AIL_set_stream_pan(HSTREAM stream, S32 pan);
-DLLEXPORT S32 WINAPI AIL_stream_status(HSTREAM stream);
-
-typedef U32(WINAPI* AIL_file_open_callback)(char const * Filename, U32 * FileHandle);
-
-typedef void (WINAPI* AIL_file_close_callback) (U32 FileHandle);
-
-#define AIL_FILE_SEEK_BEGIN 0
-#define AIL_FILE_SEEK_CURRENT 1
-#define AIL_FILE_SEEK_END 2
-
-typedef S32(WINAPI* AIL_file_seek_callback) (U32 FileHandle, S32 Offset, U32 Type);
+typedef U32 (WINAPI *AIL_file_open_callback)(char const * Filename, U32 * FileHandle);
-typedef U32(WINAPI* AIL_file_read_callback) (U32 FileHandle, void* Buffer, U32 Bytes);
+typedef void (WINAPI *AIL_file_close_callback)(U32 FileHandle);
-DLLEXPORT void WINAPI AIL_set_file_callbacks(AIL_file_open_callback opencb, AIL_file_close_callback closecb, AIL_file_seek_callback seekcb, AIL_file_read_callback readcb);
+#define AIL_FILE_SEEK_BEGIN 0
+#define AIL_FILE_SEEK_CURRENT 1
+#define AIL_FILE_SEEK_END 2
+
+typedef S32(WINAPI *AIL_file_seek_callback)(U32 FileHandle, S32 Offset, U32 Type);
+
+typedef U32(WINAPI *AIL_file_read_callback)(U32 FileHandle, void* Buffer, U32 Bytes);
+
+#ifdef RE3MSS_EXPORTS
+#define RE3MSS_EXPORT __declspec(dllexport)
+#else
+#define RE3MSS_EXPORT __declspec(dllimport)
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+RE3MSS_EXPORT S32 WINAPI AIL_enumerate_3D_providers(HPROENUM *next, HPROVIDER *dest, C8 **name);
+RE3MSS_EXPORT void WINAPI AIL_release_3D_sample_handle(H3DSAMPLE S);
+RE3MSS_EXPORT void WINAPI AIL_close_3D_provider(HPROVIDER lib);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_provider_preference(HPROVIDER lib, C8 const *name, void const *val);
+RE3MSS_EXPORT M3DRESULT WINAPI AIL_open_3D_provider(HPROVIDER lib);
+RE3MSS_EXPORT C8 *WINAPI AIL_last_error(void);
+RE3MSS_EXPORT S32 WINAPI AIL_3D_room_type(HPROVIDER lib);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_room_type(HPROVIDER lib, S32 room_type);
+RE3MSS_EXPORT void WINAPI AIL_3D_provider_attribute(HPROVIDER lib, C8 const *name, void *val);
+RE3MSS_EXPORT H3DSAMPLE WINAPI AIL_allocate_3D_sample_handle(HPROVIDER lib);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_effects_level(H3DSAMPLE S, F32 effects_level);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_speaker_type(HPROVIDER lib, S32 speaker_type);
+RE3MSS_EXPORT HSTREAM WINAPI AIL_open_stream(HDIGDRIVER dig, C8 const *filename, S32 stream_mem);
+RE3MSS_EXPORT void WINAPI AIL_stream_ms_position(HSTREAM S, S32 *total_milliseconds, S32 *current_milliseconds);
+RE3MSS_EXPORT void WINAPI AIL_close_stream(HSTREAM stream);
+RE3MSS_EXPORT S32 WINAPI AIL_digital_handle_release(HDIGDRIVER drvr);
+RE3MSS_EXPORT S32 WINAPI AIL_digital_handle_reacquire(HDIGDRIVER drvr);
+RE3MSS_EXPORT C8 *WINAPI AIL_set_redist_directory(C8 const *dir);
+RE3MSS_EXPORT S32 WINAPI AIL_startup(void);
+RE3MSS_EXPORT S32 WINAPI AIL_set_preference(U32 number, S32 value);
+RE3MSS_EXPORT HDIGDRIVER WINAPI AIL_open_digital_driver(U32 frequency, S32 bits, S32 channel, U32 flags);
+RE3MSS_EXPORT void *WINAPI AIL_mem_alloc_lock(U32 size);
+RE3MSS_EXPORT HSAMPLE WINAPI AIL_allocate_sample_handle(HDIGDRIVER dig);
+RE3MSS_EXPORT void WINAPI AIL_init_sample(HSAMPLE S);
+RE3MSS_EXPORT void WINAPI AIL_set_sample_type(HSAMPLE S, S32 format, U32 flags);
+RE3MSS_EXPORT void WINAPI AIL_pause_stream(HSTREAM stream, S32 onoff);
+RE3MSS_EXPORT void WINAPI AIL_release_sample_handle(HSAMPLE S);
+RE3MSS_EXPORT void WINAPI AIL_mem_free_lock(void *ptr);
+RE3MSS_EXPORT void WINAPI AIL_close_digital_driver(HDIGDRIVER dig);
+RE3MSS_EXPORT void WINAPI AIL_shutdown(void);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_volume(H3DSAMPLE S, S32 volume);
+RE3MSS_EXPORT void WINAPI AIL_set_sample_volume(HSAMPLE S, S32 volume);
+RE3MSS_EXPORT void WINAPI AIL_set_sample_address(HSAMPLE S, void const *start, U32 len);
+RE3MSS_EXPORT S32 WINAPI AIL_set_3D_sample_info(H3DSAMPLE S, AILSOUNDINFO const *info);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_position(H3DPOBJECT obj, F32 X, F32 Y, F32 Z);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_distances(H3DSAMPLE S, F32 max_dist, F32 min_dist);
+RE3MSS_EXPORT void WINAPI AIL_set_sample_pan(HSAMPLE S, S32 pan);
+RE3MSS_EXPORT void WINAPI AIL_set_sample_playback_rate(HSAMPLE S, S32 playback_rate);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_playback_rate(H3DSAMPLE S, S32 playback_rate);
+RE3MSS_EXPORT void WINAPI AIL_set_sample_loop_block(HSAMPLE S, S32 loop_start_offset, S32 loop_end_offset);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_loop_block(H3DSAMPLE S, S32 loop_start_offset, S32 loop_end_offset);
+RE3MSS_EXPORT void WINAPI AIL_set_sample_loop_count(HSAMPLE S, S32 loop_count);
+RE3MSS_EXPORT void WINAPI AIL_set_3D_sample_loop_count(H3DSAMPLE S, S32 loops);
+RE3MSS_EXPORT U32 WINAPI AIL_sample_status(HSAMPLE S);
+RE3MSS_EXPORT U32 WINAPI AIL_3D_sample_status(H3DSAMPLE S);
+RE3MSS_EXPORT void WINAPI AIL_start_sample(HSAMPLE S);
+RE3MSS_EXPORT void WINAPI AIL_start_3D_sample(H3DSAMPLE S);
+RE3MSS_EXPORT void WINAPI AIL_end_sample(HSAMPLE S);
+RE3MSS_EXPORT void WINAPI AIL_end_3D_sample(H3DSAMPLE S);
+RE3MSS_EXPORT void WINAPI AIL_set_stream_loop_count(HSTREAM stream, S32 count);
+RE3MSS_EXPORT S32 WINAPI AIL_service_stream(HSTREAM stream, S32 fillup);
+RE3MSS_EXPORT void WINAPI AIL_start_stream(HSTREAM stream);
+RE3MSS_EXPORT void WINAPI AIL_set_stream_ms_position(HSTREAM S, S32 milliseconds);
+RE3MSS_EXPORT void WINAPI AIL_set_stream_volume(HSTREAM stream, S32 volume);
+RE3MSS_EXPORT void WINAPI AIL_set_stream_pan(HSTREAM stream, S32 pan);
+RE3MSS_EXPORT S32 WINAPI AIL_stream_status(HSTREAM stream);
+RE3MSS_EXPORT void WINAPI AIL_set_file_callbacks(AIL_file_open_callback opencb, AIL_file_close_callback closecb, AIL_file_seek_callback seekcb, AIL_file_read_callback readcb);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/vendor/milessdk/lib/mss32.lib b/vendor/milessdk/lib/mss32.lib
index 49cea2d2..e63a1a05 100644
--- a/vendor/milessdk/lib/mss32.lib
+++ b/vendor/milessdk/lib/mss32.lib
Binary files differ