1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 04:40:00 +00:00

Merge branch 'miami' into lcs

* miami:
  Fix backface culling of cutscene objects
  more renames
  anim velocity union
  rename m_vehEnterType -> m_vehDoor
  Port cmake improvements to miami
  some loose ends
  move TODO to Readme
  Fix build without FIX_BUGS, divide to 0 fixes
This commit is contained in:
Sergeanur 2021-01-13 14:56:25 +02:00
commit ff057838ec
30 changed files with 563 additions and 454 deletions

View file

@ -1,44 +1,82 @@
cmake_minimum_required(VERSION 3.8) cmake_minimum_required(VERSION 3.8)
project(reVC C CXX) set(EXECUTABLE reVC)
set(PROJECT REVC)
project(${EXECUTABLE} C CXX)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
if(WIN32) if(WIN32)
set(REVC_AUDIOS "NULL" "OAL" "MSS") set(${PROJECT}_AUDIOS "OAL" "MSS")
else() else()
set(REVC_AUDIOS "NULL" "OAL") set(${PROJECT}_AUDIOS "OAL")
endif() endif()
set(REVC_AUDIO "OAL" CACHE STRING "Audio") set(${PROJECT}_AUDIO "OAL" CACHE STRING "Audio")
set_property(CACHE REVC_AUDIO PROPERTY STRINGS ${REVC_AUDIOS}) option(${PROJECT}_WITH_OPUS "Build ${EXECUTABLE} with opus support" OFF)
message(STATUS "REVC_AUDIO = ${REVC_AUDIO} (choices=${REVC_AUDIOS})") option(${PROJECT}_WITH_LIBSNDFILE "Build ${EXECUTABLE} with libsndfile (instead of internal decoder)" OFF)
set("REVC_AUDIO_${REVC_AUDIO}" ON)
if(NOT REVC_AUDIO IN_LIST REVC_AUDIOS) set_property(CACHE ${PROJECT}_AUDIO PROPERTY STRINGS ${${PROJECT}_AUDIOS})
message(FATAL_ERROR "Illegal REVC_AUDIO=${REVC_AUDIO}") message(STATUS "${PROJECT}_AUDIO = ${${PROJECT}_AUDIO} (choices=${${PROJECT}_AUDIOS})")
set("${PROJECT}_AUDIO_${${PROJECT}_AUDIO}" ON)
if(NOT ${PROJECT}_AUDIO IN_LIST ${PROJECT}_AUDIOS)
message(FATAL_ERROR "Illegal ${PROJECT}_AUDIO=${${PROJECT}_AUDIO}")
endif() endif()
if(REVC_INSTALL) option(${PROJECT}_VENDORED_LIBRW "Use vendored librw" ON)
include(GNUInstallDirs) if(${PROJECT}_VENDORED_LIBRW)
set(REVC_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/reVC") add_subdirectory(vendor/librw)
else()
find_package(librw REQUIRED)
endif() endif()
add_subdirectory("vendor/librw")
add_subdirectory(src) add_subdirectory(src)
if(REVC_INSTALL) if(${PROJECT}_INSTALL)
include(CMakePackageConfigHelpers) install(DIRECTORY gamefiles/ DESTINATION ".")
configure_package_config_file(reVC-config.cmake.in reVC-config.cmake if(LIBRW_PLATFORM_NULL)
INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}" set(platform "-null")
) elseif(LIBRW_PLATFORM_PS2)
install( set(platform "-ps2")
FILES "${CMAKE_CURRENT_BINARY_DIR}/reVC-config.cmake" elseif(LIBRW_PLATFORM_GL3)
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" if(LIBRW_GL3_GFXLIB STREQUAL "GLFW")
) set(platform "-gl3-glfw")
install( else()
EXPORT reVC-targets set(platform "-gl3-sdl2")
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}" endif()
) elseif(LIBRW_PLATFORM_D3D9)
set(platform "-d3d9")
endif()
if(${PROJECT}_AUDIO_OAL)
set(audio "-oal")
elseif(${PROJECT}_AUDIO_MSS)
set(audio "-mss")
endif()
if(${PROJECT}_WITH_OPUS)
set(audio "${audio}-opus")
endif()
if(NOT LIBRW_PLATFORM_PS2)
if(WIN32)
set(os "-win")
elseif(APPLE)
set(os "-apple")
elseif(UNIX)
set(os "-linux")
else()
set(compiler "-UNK")
message(WARNING "Unknown os. Created cpack package will be wrong. (override using cpack -P)")
endif()
endif()
include(CMakeCPack.cmake) set(CPACK_PACKAGE_NAME "${PROJECT_NAME}${platform}${audio}${os}${compiler}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GTA III reversed")
set(CPACK_PACKAGE_VENDOR "GTAModding")
# FIXME: missing license (https://github.com/GTAmodding/re3/issues/794)
# set(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/LICENSE")
# set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CPACK_PACKAGE_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}")
set(CPACK_GENERATOR "TXZ")
include(CPack)
endif() endif()

View file

@ -35,6 +35,13 @@ There are various settings at the very bottom of [config.h](https://github.com/G
## Contributing ## Contributing
Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document Please read the [Coding Style](https://github.com/GTAmodding/re3/blob/master/CODING_STYLE.md) Document
### Unreversed / incomplete classes (at least the ones we know) ### Unreversed / incomplete classes
See [VC todo list](https://github.com/GTAmodding/re3/wiki/VC-todo)
PS2/Mobile stuff:
src/core/Pad.cpp
src/core/main.cpp
src/core/Frontend_PS2.cpp
src/core/FrontEndControls.cpp
src/save/MemoryCard.cpp

View file

@ -1,28 +0,0 @@
# - Find mpg123
# Find the native mpg123 includes and library
#
# MPG123_INCLUDE_DIR - where to find mpg123.h
# MPG123_LIBRARIES - List of libraries when using mpg123.
# MPG123_FOUND - True if mpg123 found.
IF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
# Already in cache, be silent
SET(MPG123_FIND_QUIETLY TRUE)
ENDIF(MPG123_INCLUDE_DIR AND MPG123_LIBRARIES)
FIND_PATH(MPG123_INCLUDE_DIR mpg123.h
PATHS "${MPG123_DIR}"
PATH_SUFFIXES include
)
FIND_LIBRARY(MPG123_LIBRARIES NAMES mpg123 mpg123-0
PATHS "${MPG123_DIR}"
PATH_SUFFIXES lib
)
# MARK_AS_ADVANCED(MPG123_LIBRARIES MPG123_INCLUDE_DIR)
# handle the QUIETLY and REQUIRED arguments and set MPG123_FOUND to TRUE if
# all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MPG123 DEFAULT_MSG MPG123_LIBRARIES MPG123_INCLUDE_DIR)

View file

@ -4,9 +4,11 @@
# #
# Once done this will define # Once done this will define
# #
# SNDFILE_FOUND - system has libsndfile # SNDFILE_FOUND - system has libsndfile
# SNDFILE_INCLUDE_DIRS - the libsndfile include directory # SNDFILE_INCLUDE_DIRS - the libsndfile include directory
# SNDFILE_LIBRARIES - Link these to use libsndfile # SNDFILE_LIBRARIES - Link these to use libsndfile
# SNDFILE_CFLAGS - Compile options to use libsndfile
# SndFile::SndFile - Imported library of libsndfile
# #
# Copyright (C) 2006 Wengo # Copyright (C) 2006 Wengo
# #
@ -15,53 +17,51 @@
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
# #
if (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) find_package(PkgConfig QUIET)
# in cache already if(PKG_CONFIG_FOUND)
set(SNDFILE_FOUND TRUE) pkg_search_module(PKG_SNDFILE "sndfile")
else (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) endif()
find_path(SNDFILE_INCLUDE_DIR find_path(SNDFILE_INCLUDE_DIR
NAMES NAMES
sndfile.h sndfile.h
HINTS
${PKG_SNDFILE_INCLUDE_DIRS}
PATHS PATHS
/usr/include /usr/include
/usr/local/include /usr/local/include
/opt/local/include /opt/local/include
/sw/include /sw/include
) )
find_library(SNDFILE_LIBRARY find_library(SNDFILE_LIBRARY
NAMES NAMES
sndfile sndfile
HINTS
${PKG_SNDFILE_LIBRARIES}
PATHS PATHS
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
/opt/local/lib /opt/local/lib
/sw/lib /sw/lib
) )
set(SNDFILE_INCLUDE_DIRS set(SNDFILE_CFLAGS "${PKG_SNDFILE_CFLAGS_OTHER}" CACHE STRING "CFLAGS of libsndfile")
${SNDFILE_INCLUDE_DIR}
)
set(SNDFILE_LIBRARIES
${SNDFILE_LIBRARY}
)
if (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES) set(SNDFILE_INCLUDE_DIRS "${SNDFILE_INCLUDE_DIR}")
set(SNDFILE_LIBRARIES "${SNDFILE_LIBRARY}")
if(SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES)
set(SNDFILE_FOUND TRUE) set(SNDFILE_FOUND TRUE)
endif (SNDFILE_INCLUDE_DIRS AND SNDFILE_LIBRARIES) endif()
if (SNDFILE_FOUND) include(FindPackageHandleStandardArgs)
if (NOT SndFile_FIND_QUIETLY) find_package_handle_standard_args(SndFile DEFAULT_MSG SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES)
message(STATUS "Found libsndfile: ${SNDFILE_LIBRARIES}")
endif (NOT SndFile_FIND_QUIETLY)
else (SNDFILE_FOUND)
if (SndFile_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libsndfile")
endif (SndFile_FIND_REQUIRED)
endif (SNDFILE_FOUND)
# show the SNDFILE_INCLUDE_DIRS and SNDFILE_LIBRARIES variables only in the advanced view if(NOT TARGET SndFile::SndFile)
mark_as_advanced(SNDFILE_INCLUDE_DIRS SNDFILE_LIBRARIES) add_library(__SndFile INTERFACE)
target_compile_options(__SndFile INTERFACE ${SNDFILE_CFLAGS})
endif (SNDFILE_LIBRARIES AND SNDFILE_INCLUDE_DIRS) target_include_directories(__SndFile INTERFACE ${SNDFILE_INCLUDE_DIRS})
target_link_libraries(__SndFile INTERFACE ${SNDFILE_LIBRARIES})
add_library(SndFile::SndFile ALIAS __SndFile)
endif()

38
cmake/Findmpg123.cmake Normal file
View file

@ -0,0 +1,38 @@
# - Find mpg123
# Find the native mpg123 includes and library
#
# mpg123_INCLUDE_DIR - Where to find mpg123.h
# mpg123_LIBRARIES - List of libraries when using mpg123.
# mpg123_CFLAGS - Compile options to use mpg123
# mpg123_FOUND - True if mpg123 found.
# MPG123::libmpg123 - Imported library of libmpg123
find_package(PkgConfig QUIET)
if(PKG_CONFIG_FOUND)
pkg_search_module(PKG_MPG123 mpg123)
endif()
find_path(mpg123_INCLUDE_DIR mpg123.h
HINTS ${PKG_MPG123_INCLUDE_DIRS}
PATHS "${mpg123_DIR}"
PATH_SUFFIXES include
)
find_library(mpg123_LIBRARIES NAMES mpg123 mpg123-0
HINTS ${PKG_MPG123_LIBRARIES}
PATHS "${mpg123_DIR}"
PATH_SUFFIXES lib
)
set(mpg123_CFLAGS "${PKG_MPG123_CFLAGS_OTHER}" CACHE STRING "CFLAGS of mpg123")
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(mpg123 DEFAULT_MSG mpg123_LIBRARIES mpg123_INCLUDE_DIR)
if(NOT TARGET MPG123::libmpg123)
add_library(__libmpg123 INTERFACE)
target_compile_options(__libmpg123 INTERFACE ${mpg123_CFLAGS})
target_include_directories(__libmpg123 INTERFACE ${mpg123_INCLUDE_DIR})
target_link_libraries(__libmpg123 INTERFACE ${mpg123_LIBRARIES})
add_library(MPG123::libmpg123 ALIAS __libmpg123)
endif()

View file

@ -1,92 +1,105 @@
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
if(${REVC_AUDIO} STREQUAL "OAL") file(GLOB_RECURSE ${PROJECT}_SOURCES "*.cpp" "*.h" "*.rc")
find_package(OpenAL REQUIRED)
find_package(MPG123 REQUIRED)
find_package(SndFile REQUIRED)
endif()
file(GLOB_RECURSE Sources "*.cpp" "*.h") function(header_directories RETURN_LIST)
file(GLOB_RECURSE ALL_SRCS *.h *.cpp *.c)
set(RELDIRS)
foreach(SRC ${ALL_SRCS})
file(RELATIVE_PATH RELSRC "${CMAKE_CURRENT_SOURCE_DIR}" "${SRC}")
get_filename_component(RELDIR "${RELSRC}" DIRECTORY)
list(APPEND RELDIRS ${RELDIR})
endforeach()
list(REMOVE_DUPLICATES RELDIRS)
set(${RETURN_LIST} ${RELDIRS} PARENT_SCOPE)
endfunction()
MACRO(HEADER_DIRECTORIES return_list) header_directories(${PROJECT}_INCLUDES)
FILE(GLOB_RECURSE new_list *.cpp)
SET(dir_list "animation"
"audio"
"collision"
"control"
"core"
"entities"
"extras"
"fakerw"
"math"
"modelinfo"
"objects"
"peds"
"render"
"rw"
"save"
"skel"
"text"
"vehicles"
"weapons")
FOREACH(file_path ${new_list})
GET_FILENAME_COMPONENT(dir_path ${file_path} PATH)
SET(dir_list ${dir_list} ${dir_path})
ENDFOREACH()
LIST(REMOVE_DUPLICATES dir_list)
SET(${return_list} ${dir_list})
ENDMACRO()
HEADER_DIRECTORIES(header_list) add_executable(${EXECUTABLE} WIN32
include_directories(${header_list}) ${${PROJECT}_SOURCES}
)
target_link_libraries(${EXECUTABLE} PRIVATE
librw::librw
Threads::Threads
)
add_executable(reVC ${Sources}) target_include_directories(${EXECUTABLE}
target_link_libraries(reVC librw)
target_link_libraries(reVC Threads::Threads)
if(${REVC_AUDIO} STREQUAL "OAL")
target_link_libraries(reVC ${OPENAL_LIBRARY})
target_link_libraries(reVC ${MPG123_LIBRARIES})
target_link_libraries(reVC ${SNDFILE_LIBRARIES})
endif()
target_include_directories(reVC
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
)
target_compile_definitions(reVC
PRIVATE PRIVATE
"$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>" $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
PUBLIC $<BUILD_INTERFACE:${${PROJECT}_INCLUDES}>
"RW_${REVC_PLATFORM}" )
)
target_compile_definitions(reVC PRIVATE LIBRW=1 AUDIO_OAL=1) target_compile_definitions(${EXECUTABLE}
PRIVATE
$<IF:$<CONFIG:DEBUG>,DEBUG,NDEBUG>
LIBRW
${PROJECT}_NO_AUTOLINK
)
if(LIBRW_PLATFORM_D3D9)
target_compile_definitions(${EXECUTABLE}
PUBLIC
USE_D3D9
)
endif()
if(${PROJECT}_AUDIO STREQUAL "OAL")
find_package(OpenAL REQUIRED)
target_include_directories(${EXECUTABLE} PRIVATE ${OPENAL_INCLUDE_DIR})
target_link_libraries(${EXECUTABLE} PRIVATE ${OPENAL_LIBRARY})
target_compile_definitions(${EXECUTABLE} PRIVATE ${OPENAL_DEFINITIONS})
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL)
elseif(${PROJECT}_AUDIO STREQUAL "MSS")
find_package(MilesSDK REQUIRED)
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_MSS)
target_link_libraries(${EXECUTABLE} PRIVATE MilesSDK::MilesSDK)
endif()
find_package(mpg123 REQUIRED)
target_link_libraries(${EXECUTABLE} PRIVATE
MPG123::libmpg123
)
if(${PROJECT}_WITH_OPUS)
find_package(opusfile REQUIRED)
target_link_libraries(${EXECUTABLE} PRIVATE
opusfile::opusfile
)
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OPUS)
endif()
if(${PROJECT}_WITH_LIBSNDFILE)
find_package(SndFile REQUIRED)
target_link_libraries(${EXECUTABLE} PRIVATE
SndFile::SndFile
)
target_compile_definitions(${EXECUTABLE} PRIVATE AUDIO_OAL_USE_SNDFILE)
endif()
target_compile_definitions(${EXECUTABLE} PRIVATE )
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
target_compile_options(reVC target_compile_options(${EXECUTABLE}
PRIVATE PRIVATE
"-Wall" "-Wall"
) )
if (NOT REVC_PLATFORM_PS2) if (NOT LIBRW_PLATFORM_PS2)
target_compile_options(reVC target_compile_options(${EXECUTABLE}
PRIVATE PRIVATE
"-Wextra" -Wextra
"-Wdouble-promotion" -Wdouble-promotion
"-Wpedantic" -Wpedantic
) )
endif() endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(reVC target_compile_options(${EXECUTABLE}
PUBLIC PUBLIC
/wd4996 /wd4244 /Zc:sizedDealloc-
) )
endif() endif()
set_target_properties(reVC set_target_properties(${EXECUTABLE}
PROPERTIES PROPERTIES
C_STANDARD 11 C_STANDARD 11
C_EXTENSIONS OFF C_EXTENSIONS OFF
@ -94,20 +107,15 @@ set_target_properties(reVC
CXX_STANDARD 11 CXX_STANDARD 11
CXX_EXTENSIONS OFF CXX_EXTENSIONS OFF
CXX_STANDARD_REQUIRED ON CXX_STANDARD_REQUIRED ON
PREFIX "" )
)
if(REVC_INSTALL)
target_include_directories(reVC
INTERFACE
$<INSTALL_INTERFACE:${REVC_INSTALL_INCLUDEDIR}>
)
if(${PROJECT}_INSTALL)
install( install(
TARGETS reVC TARGETS ${EXECUTABLE}
EXPORT reVC-targets EXPORT ${EXECUTABLE}-targets
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" RUNTIME DESTINATION "."
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" )
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" if(MSVC)
) install(FILES $<TARGET_PDB_FILE:${EXECUTABLE}> DESTINATION "." OPTIONAL)
endif()
endif() endif()

View file

@ -8,7 +8,7 @@
CAnimBlendClumpData::CAnimBlendClumpData(void) CAnimBlendClumpData::CAnimBlendClumpData(void)
{ {
numFrames = 0; numFrames = 0;
velocity = nil; velocity2d = nil;
frames = nil; frames = nil;
link.Init(); link.Init();
} }

View file

@ -3,7 +3,6 @@
#include "AnimBlendList.h" #include "AnimBlendList.h"
// TODO: put somewhere else
struct AnimBlendFrameData struct AnimBlendFrameData
{ {
enum { enum {
@ -31,7 +30,10 @@ class CAnimBlendClumpData
public: public:
CAnimBlendLink link; CAnimBlendLink link;
int32 numFrames; int32 numFrames;
CVector *velocity; union {
CVector2D *velocity2d;
CVector *velocity3d;
};
// order of frames is determined by RW hierarchy // order of frames is determined by RW hierarchy
AnimBlendFrameData *frames; AnimBlendFrameData *frames;

View file

@ -33,7 +33,7 @@ FrameUpdateCallBackNonSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg); FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(frame, arg);
else else
@ -142,11 +142,11 @@ FrameUpdateCallBackWithVelocityExtractionNonSkinned(AnimBlendFrameData *frame, v
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
gpAnimBlendClump->velocity->x = transx - curx; gpAnimBlendClump->velocity2d->x = transx - curx;
gpAnimBlendClump->velocity->y = transy - cury; gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){ if(looped){
gpAnimBlendClump->velocity->x += endx; gpAnimBlendClump->velocity2d->x += endx;
gpAnimBlendClump->velocity->y += endy; gpAnimBlendClump->velocity2d->y += endy;
} }
mat->pos.x = pos.x - transx; mat->pos.x = pos.x - transx;
mat->pos.y = pos.y - transy; mat->pos.y = pos.y - transy;
@ -222,9 +222,9 @@ FrameUpdateCallBackWith3dVelocityExtractionNonSkinned(AnimBlendFrameData *frame,
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.x = (pos - trans).x + frame->resetPos.x;
mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.y = (pos - trans).y + frame->resetPos.y;
mat->pos.z = (pos - trans).z + frame->resetPos.z; mat->pos.z = (pos - trans).z + frame->resetPos.z;
@ -244,7 +244,7 @@ FrameUpdateCallBackSkinned(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D) if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION_3D)
FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg); FrameUpdateCallBackWith3dVelocityExtractionSkinned(frame, arg);
else else
@ -354,11 +354,11 @@ FrameUpdateCallBackWithVelocityExtractionSkinned(AnimBlendFrameData *frame, void
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
gpAnimBlendClump->velocity->x = transx - curx; gpAnimBlendClump->velocity2d->x = transx - curx;
gpAnimBlendClump->velocity->y = transy - cury; gpAnimBlendClump->velocity2d->y = transy - cury;
if(looped){ if(looped){
gpAnimBlendClump->velocity->x += endx; gpAnimBlendClump->velocity2d->x += endx;
gpAnimBlendClump->velocity->y += endy; gpAnimBlendClump->velocity2d->y += endy;
} }
xform->t.x = pos.x - transx; xform->t.x = pos.x - transx;
xform->t.y = pos.y - transy; xform->t.y = pos.y - transy;
@ -434,9 +434,9 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.x = (pos - trans).x + frame->resetPos.x;
xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.y = (pos - trans).y + frame->resetPos.y;
xform->t.z = (pos - trans).z + frame->resetPos.z; xform->t.z = (pos - trans).z + frame->resetPos.z;
@ -446,7 +446,7 @@ FrameUpdateCallBackWith3dVelocityExtractionSkinned(AnimBlendFrameData *frame, vo
void void
FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg) FrameUpdateCallBackOffscreen(AnimBlendFrameData *frame, void *arg)
{ {
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity) if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && gpAnimBlendClump->velocity2d)
FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg); FrameUpdateCallBackWithVelocityExtractionSkinned(frame, arg);
} }
@ -466,7 +466,7 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(updateData->foobar) if(updateData->foobar)
for(node = updateData->nodes; *node; node++) for(node = updateData->nodes; *node; node++)
if((*node)->sequence && (*node)->association->IsPartial()) if((*node)->sequence && (*node)->association->IsPartial())
@ -511,9 +511,9 @@ FrameUpdateCallBackNonSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
mat->pos.x = (pos - trans).x + frame->resetPos.x; mat->pos.x = (pos - trans).x + frame->resetPos.x;
mat->pos.y = (pos - trans).y + frame->resetPos.y; mat->pos.y = (pos - trans).y + frame->resetPos.y;
mat->pos.z = (pos - trans).z + frame->resetPos.z; mat->pos.z = (pos - trans).z + frame->resetPos.z;
@ -573,7 +573,7 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg; AnimBlendFrameUpdateData *updateData = (AnimBlendFrameUpdateData*)arg;
if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION && if(frame->flag & AnimBlendFrameData::VELOCITY_EXTRACTION &&
gpAnimBlendClump->velocity){ gpAnimBlendClump->velocity2d){
if(updateData->foobar) if(updateData->foobar)
for(node = updateData->nodes; *node; node++) for(node = updateData->nodes; *node; node++)
if((*node)->sequence && (*node)->association->IsPartial()) if((*node)->sequence && (*node)->association->IsPartial())
@ -620,9 +620,9 @@ FrameUpdateCallBackSkinnedCompressed(AnimBlendFrameData *frame, void *arg)
} }
if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){ if((frame->flag & AnimBlendFrameData::IGNORE_TRANSLATION) == 0){
*gpAnimBlendClump->velocity = trans - cur; *gpAnimBlendClump->velocity3d = trans - cur;
if(looped) if(looped)
*gpAnimBlendClump->velocity += end; *gpAnimBlendClump->velocity3d += end;
xform->t.x = (pos - trans).x + frame->resetPos.x; xform->t.x = (pos - trans).x + frame->resetPos.x;
xform->t.y = (pos - trans).y + frame->resetPos.y; xform->t.y = (pos - trans).y + frame->resetPos.y;
xform->t.z = (pos - trans).z + frame->resetPos.z; xform->t.z = (pos - trans).z + frame->resetPos.z;

View file

@ -437,7 +437,7 @@ RpAnimBlendNodeUpdateKeyframes(AnimBlendFrameData *frames, AnimBlendFrameUpdateD
CAnimBlendAssociation *a = (*node)->association; CAnimBlendAssociation *a = (*node)->association;
for(i = 0; i < numNodes; i++) for(i = 0; i < numNodes; i++)
if((frames[i].flag & AnimBlendFrameData::VELOCITY_EXTRACTION) == 0 || if((frames[i].flag & AnimBlendFrameData::VELOCITY_EXTRACTION) == 0 ||
gpAnimBlendClump->velocity == nil){ gpAnimBlendClump->velocity2d == nil){
if((*node)[i].sequence) if((*node)[i].sequence)
(*node)[i].FindKeyFrame(a->currentTime - a->timeStep); (*node)[i].FindKeyFrame(a->currentTime - a->timeStep);
} }

View file

@ -785,20 +785,20 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
}else{ }else{
pPed->m_pMyVehicle->RemovePassenger(pPed); pPed->m_pMyVehicle->RemovePassenger(pPed);
} }
if (pPed->m_vehEnterType) { if (pPed->m_vehDoor) {
if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR) { if (pPed->GetPedState() == PED_EXIT_CAR || pPed->GetPedState() == PED_DRAG_FROM_CAR) {
uint8 flags = 0; uint8 flags = 0;
if (pPed->m_pMyVehicle->IsBike()) { if (pPed->m_pMyVehicle->IsBike()) {
if (pPed->m_vehEnterType == CAR_DOOR_LF || if (pPed->m_vehDoor == CAR_DOOR_LF ||
pPed->m_vehEnterType == CAR_DOOR_RF || pPed->m_vehDoor == CAR_DOOR_RF ||
pPed->m_vehEnterType == CAR_WINDSCREEN) pPed->m_vehDoor == CAR_WINDSCREEN)
flags = CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_RF; flags = CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_RF;
else if (pPed->m_vehEnterType == CAR_DOOR_LR || else if (pPed->m_vehDoor == CAR_DOOR_LR ||
pPed->m_vehEnterType == CAR_DOOR_RR) pPed->m_vehDoor == CAR_DOOR_RR)
flags = CAR_DOOR_FLAG_LR | CAR_DOOR_FLAG_RR; flags = CAR_DOOR_FLAG_LR | CAR_DOOR_FLAG_RR;
} }
else { else {
switch (pPed->m_vehEnterType) { switch (pPed->m_vehDoor) {
case CAR_DOOR_LF: case CAR_DOOR_LF:
flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_LF : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR; flags = pPed->m_pMyVehicle->m_nNumMaxPassengers != 0 ? CAR_DOOR_FLAG_LF : CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_LR;
break; break;
@ -814,7 +814,7 @@ int8 CRunningScript::ProcessCommands800To899(int32 command)
} }
} }
pPed->m_pMyVehicle->m_nGettingOutFlags &= ~flags; pPed->m_pMyVehicle->m_nGettingOutFlags &= ~flags;
pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehEnterType, NUM_STD_ANIMS, 0.0f); pPed->m_pMyVehicle->ProcessOpenDoor(pPed->m_vehDoor, NUM_STD_ANIMS, 0.0f);
} }
} }
} }

View file

@ -2353,7 +2353,7 @@ CCamera::StartTransition(int16 newMode)
while(deltaBeta < -PI) deltaBeta += 2*PI; while(deltaBeta < -PI) deltaBeta += 2*PI;
deltaBeta = Abs(deltaBeta); deltaBeta = Abs(deltaBeta);
door = FindPlayerPed()->m_vehEnterType; door = FindPlayerPed()->m_vehDoor;
if(deltaBeta > HALFPI){ if(deltaBeta > HALFPI){
if(((CPed*)pTargetEntity)->m_carInObjective){ if(((CPed*)pTargetEntity)->m_carInObjective){
if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){ if(((CPed*)pTargetEntity)->m_carInObjective->IsUpsideDown()){

View file

@ -390,8 +390,8 @@ CPlayerInfo::Process(void)
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow); m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_PASSENGER, carBelow);
} else if (carBelow->IsBoat()) { } else if (carBelow->IsBoat()) {
if (!carBelow->pDriver) { if (!carBelow->pDriver) {
m_pPed->m_vehEnterType = 0; m_pPed->m_vehDoor = 0;
m_pPed->SetEnterCar(carBelow, m_pPed->m_vehEnterType); m_pPed->SetEnterCar(carBelow, m_pPed->m_vehDoor);
} }
} else { } else {
m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow); m_pPed->SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carBelow);

View file

@ -240,12 +240,16 @@ enum Config {
# define TIMEBARS // print debug timers # define TIMEBARS // print debug timers
#endif #endif
#define FIX_BUGS // fixes bugs that we've came across during reversing, TODO: use this more #define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds.
//#define MORE_LANGUAGES // Add more translations to the game //#define MORE_LANGUAGES // Add more translations to the game
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible #define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS #define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
#define FIX_HIGH_FPS_BUGS_ON_FRONTEND #define FIX_HIGH_FPS_BUGS_ON_FRONTEND
#if defined(__LP64__) || defined(_WIN64)
#define FIX_BUGS_64 // Must have fixes to be able to run 64 bit build
#endif
// Just debug menu entries // Just debug menu entries
#ifdef DEBUGMENU #ifdef DEBUGMENU
#define RELOADABLES // some debug menu options to reload TXD files #define RELOADABLES // some debug menu options to reload TXD files

View file

@ -1426,11 +1426,13 @@ Idle(void *arg)
CSprite2d::InitPerFrame(); CSprite2d::InitPerFrame();
CFont::InitPerFrame(); CFont::InitPerFrame();
PUSH_MEMID(MEMID_GAME_PROCESS);
CPointLights::InitPerFrame(); CPointLights::InitPerFrame();
tbStartTimer(0, "CGame::Process"); tbStartTimer(0, "CGame::Process");
CGame::Process(); CGame::Process();
tbEndTimer("CGame::Process"); tbEndTimer("CGame::Process");
POP_MEMID();
tbStartTimer(0, "DMAudio.Service"); tbStartTimer(0, "DMAudio.Service");
DMAudio.Service(); DMAudio.Service();
@ -1452,6 +1454,8 @@ Idle(void *arg)
if(arg == nil) if(arg == nil)
return; return;
PUSH_MEMID(MEMID_RENDER);
if(!FrontEndMenuManager.m_bMenuActive && TheCamera.GetScreenFadeStatus() != FADE_2) if(!FrontEndMenuManager.m_bMenuActive && TheCamera.GetScreenFadeStatus() != FADE_2)
{ {
// This is from SA, but it's nice for windowed mode // This is from SA, but it's nice for windowed mode

View file

@ -883,9 +883,13 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(B->GetStatus() == STATUS_PLAYER) if(B->GetStatus() == STATUS_PLAYER)
pointposB *= 0.8f; pointposB *= 0.8f;
if(CWorld::bNoMoreCollisionTorque){ if(CWorld::bNoMoreCollisionTorque){
// BUG: the game actually uses A here, but this can't be right #ifdef FIX_BUGS
B->ApplyFrictionMoveForce(fB*-0.3f); B->ApplyFrictionMoveForce(fB*-0.3f);
B->ApplyFrictionTurnForce(fB*-0.3f, pointposB); B->ApplyFrictionTurnForce(fB*-0.3f, pointposB);
#else
A->ApplyFrictionMoveForce(fB*-0.3f);
A->ApplyFrictionTurnForce(fB*-0.3f, pointposB);
#endif
} }
} }
if(!A->bInfiniteMass){ if(!A->bInfiniteMass){
@ -1054,7 +1058,13 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedA = vOtherSpeedA.Magnitude();
fOtherSpeedB = vOtherSpeedB.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude();
#ifdef FIX_BUGS // division by 0
frictionDir = vOtherSpeedA;
frictionDir.Normalise();
#else
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
#endif
speedSum = (B->m_fMass*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(B->m_fMass + A->m_fMass); speedSum = (B->m_fMass*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(B->m_fMass + A->m_fMass);
if(fOtherSpeedA > speedSum){ if(fOtherSpeedA > speedSum){
impulseA = (speedSum - fOtherSpeedA) * A->m_fMass; impulseA = (speedSum - fOtherSpeedA) * A->m_fMass;
@ -1084,7 +1094,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedA = vOtherSpeedA.Magnitude();
fOtherSpeedB = vOtherSpeedB.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude();
#ifdef FIX_BUGS // division by 0
frictionDir = vOtherSpeedA;
frictionDir.Normalise();
#else
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
#endif
float massB = B->GetMass(pointposB, frictionDir); float massB = B->GetMass(pointposB, frictionDir);
speedSum = (massB*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(massB + A->m_fMass); speedSum = (massB*fOtherSpeedB + A->m_fMass*fOtherSpeedA)/(massB + A->m_fMass);
if(fOtherSpeedA > speedSum){ if(fOtherSpeedA > speedSum){
@ -1112,7 +1127,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedA = vOtherSpeedA.Magnitude();
fOtherSpeedB = vOtherSpeedB.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude();
#ifdef FIX_BUGS // division by 0
frictionDir = vOtherSpeedA;
frictionDir.Normalise();
#else
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
#endif
float massA = A->GetMass(pointposA, frictionDir); float massA = A->GetMass(pointposA, frictionDir);
speedSum = (B->m_fMass*fOtherSpeedB + massA*fOtherSpeedA)/(B->m_fMass + massA); speedSum = (B->m_fMass*fOtherSpeedB + massA*fOtherSpeedA)/(B->m_fMass + massA);
if(fOtherSpeedA > speedSum){ if(fOtherSpeedA > speedSum){
@ -1140,7 +1160,12 @@ CPhysical::ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint)
fOtherSpeedA = vOtherSpeedA.Magnitude(); fOtherSpeedA = vOtherSpeedA.Magnitude();
fOtherSpeedB = vOtherSpeedB.Magnitude(); fOtherSpeedB = vOtherSpeedB.Magnitude();
#ifdef FIX_BUGS // division by 0
frictionDir = vOtherSpeedA;
frictionDir.Normalise();
#else
frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA); frictionDir = vOtherSpeedA * (1.0f/fOtherSpeedA);
#endif
float massA = A->GetMass(pointposA, frictionDir); float massA = A->GetMass(pointposA, frictionDir);
float massB = B->GetMass(pointposB, frictionDir); float massB = B->GetMass(pointposB, frictionDir);
speedSum = (massB*fOtherSpeedB + massA*fOtherSpeedA)/(massB + massA); speedSum = (massB*fOtherSpeedB + massA*fOtherSpeedA)/(massB + massA);
@ -1178,7 +1203,12 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
fOtherSpeed = vOtherSpeed.Magnitude(); fOtherSpeed = vOtherSpeed.Magnitude();
if(fOtherSpeed > 0.0f){ if(fOtherSpeed > 0.0f){
#ifdef FIX_BUGS // division by 0
frictionDir = vOtherSpeed;
frictionDir.Normalise();
#else
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed); frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
#endif
// not really impulse but speed // not really impulse but speed
// maybe use ApplyFrictionMoveForce instead? // maybe use ApplyFrictionMoveForce instead?
fImpulse = -fOtherSpeed; fImpulse = -fOtherSpeed;
@ -1196,7 +1226,12 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
fOtherSpeed = vOtherSpeed.Magnitude(); fOtherSpeed = vOtherSpeed.Magnitude();
if(fOtherSpeed > 0.0f){ if(fOtherSpeed > 0.0f){
#ifdef FIX_BUGS // division by 0
frictionDir = vOtherSpeed;
frictionDir.Normalise();
#else
frictionDir = vOtherSpeed * (1.0f/fOtherSpeed); frictionDir = vOtherSpeed * (1.0f/fOtherSpeed);
#endif
fImpulse = -fOtherSpeed * m_fMass; fImpulse = -fOtherSpeed * m_fMass;
impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5; impulseLimit = adhesiveLimit*CTimer::GetTimeStep() * 1.5;
if(fImpulse < -impulseLimit) fImpulse = -impulseLimit; if(fImpulse < -impulseLimit) fImpulse = -impulseLimit;

View file

@ -46,7 +46,7 @@ CCutsceneObject::SetModelIndex(uint32 id)
CEntity::SetModelIndex(id); CEntity::SetModelIndex(id);
assert(RwObjectGetType(m_rwObject) == rpCLUMP); assert(RwObjectGetType(m_rwObject) == rpCLUMP);
RpAnimBlendClumpInit((RpClump*)m_rwObject); RpAnimBlendClumpInit((RpClump*)m_rwObject);
(*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = &m_vecMoveSpeed; (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity3d = &m_vecMoveSpeed;
(*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D; (*RPANIMBLENDCLUMPDATA(m_rwObject))->frames[0].flag |= AnimBlendFrameData::VELOCITY_EXTRACTION_3D;
} }

View file

@ -113,15 +113,15 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_attackTimer = 0; m_attackTimer = 0;
m_timerUnused = 0; m_timerUnused = 0;
m_lookTimer = 0; m_lookTimer = 0;
m_standardTimer = 0; m_chatTimer = 0;
m_shootTimer = 0; m_shootTimer = 0;
m_hitRecoverTimer = 0; m_carJackTimer = 0;
m_duckAndCoverTimer = 0; m_duckAndCoverTimer = 0;
m_moved = CVector2D(0.0f, 0.0f); m_moved = CVector2D(0.0f, 0.0f);
m_fRotationCur = 0.0f; m_fRotationCur = 0.0f;
m_headingRate = 15.0f; m_headingRate = 15.0f;
m_fRotationDest = 0.0f; m_fRotationDest = 0.0f;
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
m_walkAroundType = 0; m_walkAroundType = 0;
m_pCurrentPhysSurface = nil; m_pCurrentPhysSurface = nil;
m_vecOffsetFromPhysSurface = CVector(0.0f, 0.0f, 0.0f); m_vecOffsetFromPhysSurface = CVector(0.0f, 0.0f, 0.0f);
@ -381,7 +381,7 @@ CPed::~CPed(void)
GetPedAttractorManager()->DeRegisterPed(this, m_attractor); GetPedAttractorManager()->DeRegisterPed(this, m_attractor);
CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this)); CRadar::ClearBlipForEntity(BLIP_CHAR, CPools::GetPedPool()->GetIndex(this));
if (InVehicle()){ if (InVehicle()){
uint8 door_flag = GetCarDoorFlag(m_vehEnterType); uint8 door_flag = GetCarDoorFlag(m_vehDoor);
if (m_pMyVehicle->pDriver == this) if (m_pMyVehicle->pDriver == this)
m_pMyVehicle->pDriver = nil; m_pMyVehicle->pDriver = nil;
else { else {
@ -434,8 +434,7 @@ CPed::SetModelIndex(uint32 mi)
if (!CanUseTorsoWhenLooking()) if (!CanUseTorsoWhenLooking())
m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY; m_pedIK.m_flags |= CPedIK::LOOKAROUND_HEAD_ONLY;
// This is a mistake by R*, velocity is CVector, whereas m_vecAnimMoveDelta is CVector2D. (*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity2d = &m_vecAnimMoveDelta;
(*RPANIMBLENDCLUMPDATA(m_rwObject))->velocity = (CVector*) &m_vecAnimMoveDelta;
if(modelInfo->GetHitColModel() == nil) if(modelInfo->GetHitColModel() == nil)
modelInfo->CreateHitColModelSkinned(GetClump()); modelInfo->CreateHitColModelSkinned(GetClump());
@ -1299,7 +1298,8 @@ CPed::ScanForInterestingStuff(void)
if (LookForInterestingNodes()) if (LookForInterestingNodes())
return; return;
if (m_nPedType == PEDTYPE_CRIMINAL && m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { if (m_nPedType == PEDTYPE_CRIMINAL && m_carJackTimer < CTimer::GetTimeInMilliseconds()) {
// Find a car to steal or a ped to mug if we haven't already decided to steal a car
if (CGeneral::GetRandomNumber() % 100 < 10) { if (CGeneral::GetRandomNumber() % 100 < 10) {
int mostExpensiveVehAround = -1; int mostExpensiveVehAround = -1;
int bestMonetaryValue = 0; int bestMonetaryValue = 0;
@ -1322,10 +1322,10 @@ CPed::ScanForInterestingStuff(void)
} }
if (bestMonetaryValue > 2000 && mostExpensiveVehAround != -1 && vehicles[mostExpensiveVehAround]) { if (bestMonetaryValue > 2000 && mostExpensiveVehAround != -1 && vehicles[mostExpensiveVehAround]) {
SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, vehicles[mostExpensiveVehAround]); SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, vehicles[mostExpensiveVehAround]);
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
return; return;
} }
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
} else if (m_objective != OBJECTIVE_MUG_CHAR && !(CGeneral::GetRandomNumber() & 7)) { } else if (m_objective != OBJECTIVE_MUG_CHAR && !(CGeneral::GetRandomNumber() & 7)) {
CPed *charToMug = nil; CPed *charToMug = nil;
for (int i = 0; i < m_numNearPeds; ++i) { for (int i = 0; i < m_numNearPeds; ++i) {
@ -1347,13 +1347,13 @@ CPed::ScanForInterestingStuff(void)
if (charToMug) if (charToMug)
SetObjective(OBJECTIVE_MUG_CHAR, charToMug); SetObjective(OBJECTIVE_MUG_CHAR, charToMug);
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
} }
} }
if (m_nPedState == PED_WANDER_PATH) { if (m_nPedState == PED_WANDER_PATH) {
if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.5f) { if (CGeneral::GetRandomNumberInRange(0.0f, 1.0f) < 0.5f) {
if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (CTimer::GetTimeInMilliseconds() > m_chatTimer) {
for (int i = 0; i < m_numNearPeds; i ++) { for (int i = 0; i < m_numNearPeds; i ++) {
if (m_nearPeds[i] && m_nearPeds[i]->m_nPedState == PED_WANDER_PATH) { if (m_nearPeds[i] && m_nearPeds[i]->m_nPedState == PED_WANDER_PATH) {
if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() < 1.8f if ((GetPosition() - m_nearPeds[i]->GetPosition()).Magnitude() < 1.8f
@ -1369,7 +1369,7 @@ CPed::ScanForInterestingStuff(void)
} }
} }
} else { } else {
m_standardTimer = CTimer::GetTimeInMilliseconds() + 200; m_chatTimer = CTimer::GetTimeInMilliseconds() + 200;
} }
} }
} }
@ -3656,7 +3656,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (Abs(angleDiffBtwObjCenterAndForward) >= objTopRightHeading) { if (Abs(angleDiffBtwObjCenterAndForward) >= objTopRightHeading) {
if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) { if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) {
if ((angleDiffBtwObjCenterAndForward <= 0.0f || objUpsideDown) && (angleDiffBtwObjCenterAndForward < 0.0f || !objUpsideDown)) { if ((angleDiffBtwObjCenterAndForward <= 0.0f || objUpsideDown) && (angleDiffBtwObjCenterAndForward < 0.0f || !objUpsideDown)) {
if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) { if (goingToEnterCar && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)) {
m_walkAroundType = 0; m_walkAroundType = 0;
} else { } else {
if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) >= 0.0f) { if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) >= 0.0f) {
@ -3674,7 +3674,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} }
} }
} else { } else {
if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) { if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)) {
m_walkAroundType = 0; m_walkAroundType = 0;
} else { } else {
if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) <= 0.0f) { if (CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) <= 0.0f) {
@ -3692,7 +3692,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} }
} }
} }
} else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
|| CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) < 0.0f) { || CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) < 0.0f) {
if (entityOnTopLeftOfObj == 1 || entityOnTopLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) { if (entityOnTopLeftOfObj == 1 || entityOnTopLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) {
m_walkAroundType = 3; m_walkAroundType = 3;
@ -3700,7 +3700,7 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} else if (entityOnTopRightOfObj == 1 || entityOnTopRightOfObj && !entityOnTopLeftOfObj && !entityOnBottomLeftOfObj) { } else if (entityOnTopRightOfObj == 1 || entityOnTopRightOfObj && !entityOnTopLeftOfObj && !entityOnBottomLeftOfObj) {
m_walkAroundType = 4; m_walkAroundType = 4;
} }
} else if (goingToEnterCar && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) } else if (goingToEnterCar && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
|| CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) > 0.0f) { || CGeneral::LimitRadianAngle(m_fRotationDest - angleToFaceObjCenter) > 0.0f) {
if (entityOnBottomLeftOfObj == 1 || entityOnBottomLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) { if (entityOnBottomLeftOfObj == 1 || entityOnBottomLeftOfObj && !entityOnTopRightOfObj && !entityOnBottomRightOfObj) {
m_walkAroundType = 2; m_walkAroundType = 2;
@ -3723,10 +3723,10 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
if (Abs(angleDiffBtwObjCenterAndForward) < objTopRightHeading) { if (Abs(angleDiffBtwObjCenterAndForward) < objTopRightHeading) {
if (goingToEnterCar) { if (goingToEnterCar) {
if (goingToEnterCarAndItsVan) { if (goingToEnterCarAndItsVan) {
if (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) if (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR)
return; return;
} }
if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) { if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnBottomRightOfObj || entityOnBottomLeftOfObj)) {
m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI); m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI);
localPosToHead.x = adjustedColMax.x; localPosToHead.x = adjustedColMax.x;
localPosToHead.z = 0.0f; localPosToHead.z = 0.0f;
@ -3755,9 +3755,9 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} else { } else {
if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) { if (PI - objTopRightHeading >= Abs(angleDiffBtwObjCenterAndForward)) {
if (angleDiffBtwObjCenterAndForward <= 0.0f) { if (angleDiffBtwObjCenterAndForward <= 0.0f) {
if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR) { if (!goingToEnterCar || !goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR) {
if (goingToEnterCar) { if (goingToEnterCar) {
if (m_vehEnterType == CAR_DOOR_RF || (m_vehEnterType == CAR_DOOR_RR && !goingToEnterCarAndItsVan)) if (m_vehDoor == CAR_DOOR_RF || (m_vehDoor == CAR_DOOR_RR && !goingToEnterCarAndItsVan))
return; return;
} }
if (m_walkAroundType == 4 || m_walkAroundType == 3 if (m_walkAroundType == 4 || m_walkAroundType == 3
@ -3779,14 +3779,14 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
localPosToHead.z = 0.0f; localPosToHead.z = 0.0f;
localPosToHead.y = adjustedColMin.y; localPosToHead.y = adjustedColMin.y;
} }
} else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR)) { } else if (goingToEnterCar && goingToEnterCarAndItsVan && (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR)) {
m_fRotationDest = CGeneral::LimitRadianAngle(PI + dirToSet); m_fRotationDest = CGeneral::LimitRadianAngle(PI + dirToSet);
localPosToHead.x = adjustedColMin.x; localPosToHead.x = adjustedColMin.x;
localPosToHead.z = 0.0f; localPosToHead.z = 0.0f;
localPosToHead.y = adjustedColMin.y; localPosToHead.y = adjustedColMin.y;
} else { } else {
if (goingToEnterCar) { if (goingToEnterCar) {
if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR && !goingToEnterCarAndItsVan) if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR && !goingToEnterCarAndItsVan)
return; return;
} }
if (m_walkAroundType == 1 || m_walkAroundType == 2 if (m_walkAroundType == 1 || m_walkAroundType == 2
@ -3804,8 +3804,8 @@ CPed::SetDirectionToWalkAroundObject(CEntity *obj)
} }
} }
} else { } else {
if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehEnterType != CAR_DOOR_LR && m_vehEnterType != CAR_DOOR_RR)) { if (goingToEnterCar && (!goingToEnterCarAndItsVan || m_vehDoor != CAR_DOOR_LR && m_vehDoor != CAR_DOOR_RR)) {
if (m_vehEnterType != CAR_DOOR_LF && m_vehEnterType != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) { if (m_vehDoor != CAR_DOOR_LF && m_vehDoor != CAR_DOOR_LR && (!entityOnTopRightOfObj || entityOnTopLeftOfObj)) {
m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI); m_fRotationDest = CGeneral::LimitRadianAngle(dirToSet - HALFPI);
localPosToHead.x = adjustedColMax.x; localPosToHead.x = adjustedColMax.x;
@ -4099,9 +4099,9 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
if (veh && veh->IsBike()) if (veh && veh->IsBike())
// BUG? // BUG?
veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehEnterType); veh->m_nGettingOutFlags &= ~GetBikeDoorFlag(ped->m_vehDoor);
else else
veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehEnterType); veh->m_nGettingOutFlags &= ~GetCarDoorFlag(ped->m_vehDoor);
if (veh->pDriver == ped) { if (veh->pDriver == ped) {
veh->RemoveDriver(); veh->RemoveDriver();
@ -4123,7 +4123,7 @@ CPed::PedSetOutCarCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->bIsBus && !veh->IsUpsideDown() && !veh->IsOnItsSide()) { if (veh->bIsBus && !veh->IsUpsideDown() && !veh->IsOnItsSide()) {
float angleAfterExit; float angleAfterExit;
if (ped->m_vehEnterType == CAR_DOOR_LF) { if (ped->m_vehDoor == CAR_DOOR_LF) {
angleAfterExit = HALFPI + veh->GetForward().Heading(); angleAfterExit = HALFPI + veh->GetForward().Heading();
} else { } else {
angleAfterExit = veh->GetForward().Heading() - HALFPI; angleAfterExit = veh->GetForward().Heading() - HALFPI;
@ -4174,7 +4174,7 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
uint8 exitFlags = 0; uint8 exitFlags = 0;
quickJackedAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_CAR_QJACKED); quickJackedAssoc = RpAnimBlendClumpGetAssociation(ped->GetClump(), ANIM_CAR_QJACKED);
if (dragAssoc && dragAssoc->animId == ANIM_BIKE_HIT && ped->m_pMyVehicle) { if (dragAssoc && dragAssoc->animId == ANIM_BIKE_HIT && ped->m_pMyVehicle) {
if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_RF) { if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_RF) {
CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_BIKE_FALL_OFF, 100.0f); CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_BIKE_FALL_OFF, 100.0f);
ped->m_pMyVehicle->m_nGettingOutFlags &= ~(CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF); ped->m_pMyVehicle->m_nGettingOutFlags &= ~(CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF);
} else { } else {
@ -4196,9 +4196,9 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
vehicle = ped->m_pMyVehicle; vehicle = ped->m_pMyVehicle;
if (vehicle && vehicle->IsBike()) if (vehicle && vehicle->IsBike())
exitFlags = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehEnterType); exitFlags = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehDoor);
else else
exitFlags = GetCarDoorFlag(ped->m_vehEnterType); exitFlags = GetCarDoorFlag(ped->m_vehDoor);
if (vehicle) if (vehicle)
vehicle->m_nGettingOutFlags &= ~exitFlags; vehicle->m_nGettingOutFlags &= ~exitFlags;
@ -4419,7 +4419,7 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
} else if (veh->bIsBus) { } else if (veh->bIsBus) {
veh->AddPassenger(ped); veh->AddPassenger(ped);
} else { } else {
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
veh->AddPassenger(ped, 0); veh->AddPassenger(ped, 0);
break; break;
@ -4449,9 +4449,9 @@ CPed::PedSetInCarCB(CAnimBlendAssociation *animAssoc, void *arg)
int8 doorFlag; int8 doorFlag;
if (veh->IsBike()) { if (veh->IsBike()) {
doorFlag = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehEnterType); doorFlag = GetBikeDoorFlagInclJumpInFromFront(ped->m_vehDoor);
} else { } else {
doorFlag = GetEnterCarDoorFlag(ped->m_vehEnterType, veh->m_nNumMaxPassengers); doorFlag = GetEnterCarDoorFlag(ped->m_vehDoor, veh->m_nNumMaxPassengers);
} }
veh->m_nGettingInFlags &= ~doorFlag; veh->m_nGettingInFlags &= ~doorFlag;
@ -5133,13 +5133,13 @@ void
CPed::Idle(void) CPed::Idle(void)
{ {
CVehicle *veh = m_pMyVehicle; CVehicle *veh = m_pMyVehicle;
if (veh && veh->m_nGettingOutFlags && m_vehEnterType) { if (veh && veh->m_nGettingOutFlags && m_vehDoor) {
if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehEnterType)) { if (veh->m_nGettingOutFlags & GetCarDoorFlag(m_vehDoor)) {
if (m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) { if (m_objective != OBJECTIVE_KILL_CHAR_ON_FOOT) {
CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehEnterType); CVector doorPos = GetPositionToOpenCarDoor(veh, m_vehDoor);
CVector doorDist = GetPosition() - doorPos; CVector doorDist = GetPosition() - doorPos;
if (doorDist.MagnitudeSqr() < sq(0.5f)) { if (doorDist.MagnitudeSqr() < sq(0.5f)) {
@ -5886,7 +5886,7 @@ CPed::ClearFlee(void)
{ {
RestorePreviousState(); RestorePreviousState();
bUsePedNodeSeek = false; bUsePedNodeSeek = false;
m_standardTimer = 0; m_chatTimer = 0;
m_fleeTimer = 0; m_fleeTimer = 0;
} }
@ -5932,7 +5932,7 @@ CPed::Flee(void)
if (m_nPedStateTimer < CTimer::GetTimeInMilliseconds() if (m_nPedStateTimer < CTimer::GetTimeInMilliseconds()
&& m_collidingThingTimer < CTimer::GetTimeInMilliseconds()) { && m_collidingThingTimer < CTimer::GetTimeInMilliseconds()) {
if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (m_pNextPathNode && CTimer::GetTimeInMilliseconds() > m_chatTimer) {
curDirectionShouldBe = CGeneral::GetNodeHeadingFromVector(GetPosition().x - ms_vec2DFleePosition.x, GetPosition().y - ms_vec2DFleePosition.y); curDirectionShouldBe = CGeneral::GetNodeHeadingFromVector(GetPosition().x - ms_vec2DFleePosition.x, GetPosition().y - ms_vec2DFleePosition.y);
if (m_nPathDir < curDirectionShouldBe) if (m_nPathDir < curDirectionShouldBe)
@ -5975,7 +5975,7 @@ CPed::Flee(void)
if (m_pNextPathNode && m_pNextPathNode != realLastNode && m_pNextPathNode != m_pLastPathNode && curDirectionShouldBe - nextDirection != 4) { if (m_pNextPathNode && m_pNextPathNode != realLastNode && m_pNextPathNode != m_pLastPathNode && curDirectionShouldBe - nextDirection != 4) {
m_nPathDir = nextDirection; m_nPathDir = nextDirection;
m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000;
} else { } else {
bUsePedNodeSeek = false; bUsePedNodeSeek = false;
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
@ -7215,7 +7215,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
m_lookTimer = 0; m_lookTimer = 0;
SetLookFlag(chatWith, true); SetLookFlag(chatWith, true);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_chatTimer = CTimer::GetTimeInMilliseconds() + time;
m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000; m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000;
} }
@ -7236,7 +7236,7 @@ CPed::Chat(void)
if (partner->m_nPedState != PED_CHAT) { if (partner->m_nPedState != PED_CHAT) {
ClearChat(); ClearChat();
m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000;
if (partner->m_pedInObjective) { if (partner->m_pedInObjective) {
if (partner->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT || if (partner->m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT ||
partner->m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE) partner->m_objective == OBJECTIVE_FLEE_CHAR_ON_FOOT_TILL_SAFE)
@ -7269,9 +7269,9 @@ CPed::Chat(void)
Say(SOUND_PED_CHAT); Say(SOUND_PED_CHAT);
} }
} }
if (m_standardTimer && CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (m_chatTimer && CTimer::GetTimeInMilliseconds() > m_chatTimer) {
ClearChat(); ClearChat();
m_standardTimer = CTimer::GetTimeInMilliseconds() + 30000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 30000;
} }
} }
@ -7480,7 +7480,7 @@ CPed::SetSeekCar(CVehicle *car, uint32 doorNode)
m_pMyVehicle = car; m_pMyVehicle = car;
m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle); m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle);
// m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); // m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget);
m_vehEnterType = doorNode; m_vehDoor = doorNode;
m_distanceToCountSeekDone = 0.5f; m_distanceToCountSeekDone = 0.5f;
SetPedState(PED_SEEK_CAR); SetPedState(PED_SEEK_CAR);
@ -7498,9 +7498,9 @@ CPed::SeekCar(void)
} }
if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) { if (m_objective != OBJECTIVE_ENTER_CAR_AS_PASSENGER) {
if (!vehToSeek->IsBike() && m_vehEnterType && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (!vehToSeek->IsBike() && m_vehDoor && m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER) {
if (IsRoomToBeCarJacked()) { if (IsRoomToBeCarJacked()) {
dest = GetPositionToOpenCarDoor(vehToSeek, m_vehEnterType); dest = GetPositionToOpenCarDoor(vehToSeek, m_vehDoor);
} else if (m_nPedType == PEDTYPE_COP) { } else if (m_nPedType == PEDTYPE_COP) {
dest = GetPositionToOpenCarDoor(vehToSeek, CAR_DOOR_RF); dest = GetPositionToOpenCarDoor(vehToSeek, CAR_DOOR_RF);
} else { } else {
@ -7509,7 +7509,7 @@ CPed::SeekCar(void)
} else } else
GetNearestDoor(vehToSeek, dest); GetNearestDoor(vehToSeek, dest);
} else { } else {
if (m_hitRecoverTimer > CTimer::GetTimeInMilliseconds()) { if (m_carJackTimer > CTimer::GetTimeInMilliseconds()) {
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
return; return;
} }
@ -7553,7 +7553,7 @@ CPed::SeekCar(void)
if (IsPlayer()) { if (IsPlayer()) {
ClearObjective(); ClearObjective();
} else if (CharCreatedBy == RANDOM_CHAR) { } else if (CharCreatedBy == RANDOM_CHAR) {
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
} }
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
TheCamera.ClearPlayerWeaponMode(); TheCamera.ClearPlayerWeaponMode();
@ -7581,7 +7581,7 @@ CPed::SeekCar(void)
else if (2.0f * vehToSeek->GetColModel()->boundingBox.max.x > distToDestSqr) else if (2.0f * vehToSeek->GetColModel()->boundingBox.max.x > distToDestSqr)
bCanPedEnterSeekedCar = true; bCanPedEnterSeekedCar = true;
if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehEnterType)) if (vehToSeek->m_nGettingInFlags & GetCarDoorFlag(m_vehDoor))
bVehEnterDoorIsBlocked = true; bVehEnterDoorIsBlocked = true;
else else
bVehEnterDoorIsBlocked = false; bVehEnterDoorIsBlocked = false;
@ -7592,7 +7592,7 @@ CPed::SeekCar(void)
if (1.6f + GetPosition().z > dest.z && GetPosition().z - 0.5f < dest.z) { if (1.6f + GetPosition().z > dest.z && GetPosition().z - 0.5f < dest.z) {
#ifdef GTA_TRAIN #ifdef GTA_TRAIN
if (vehToSeek->IsTrain()) { if (vehToSeek->IsTrain()) {
SetEnterTrain(vehToSeek, m_vehEnterType); SetEnterTrain(vehToSeek, m_vehDoor);
} else } else
#endif #endif
{ {
@ -7613,42 +7613,42 @@ CPed::SeekCar(void)
case STATUS_PLAYER_DISABLED: case STATUS_PLAYER_DISABLED:
if (vehToSeek->IsBike()) { if (vehToSeek->IsBike()) {
if ((!m_leader || m_leader != vehToSeek->pDriver) && if ((!m_leader || m_leader != vehToSeek->pDriver) &&
((m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_WINDSCREEN) && vehToSeek->pDriver || ((m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_WINDSCREEN) && vehToSeek->pDriver ||
(m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) && vehToSeek->pPassengers[0])) { (m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) && vehToSeek->pPassengers[0])) {
SetCarJack(vehToSeek); SetCarJack(vehToSeek);
} else { } else {
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} }
} else if (!vehToSeek->bIsBus && (!m_leader || m_leader != vehToSeek->pDriver) && } else if (!vehToSeek->bIsBus && (!m_leader || m_leader != vehToSeek->pDriver) &&
(m_vehEnterType == CAR_DOOR_LF && vehToSeek->pDriver || m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehEnterType == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehEnterType == CAR_DOOR_RR && vehToSeek->pPassengers[2])) { (m_vehDoor == CAR_DOOR_LF && vehToSeek->pDriver || m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0] || m_vehDoor == CAR_DOOR_LR && vehToSeek->pPassengers[1] || m_vehDoor == CAR_DOOR_RR && vehToSeek->pPassengers[2])) {
SetCarJack(vehToSeek); SetCarJack(vehToSeek);
if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehEnterType != CAR_DOOR_LF) if (m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && m_vehDoor != CAR_DOOR_LF)
vehToSeek->pDriver->bFleeAfterExitingCar = true; vehToSeek->pDriver->bFleeAfterExitingCar = true;
} else { } else {
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} }
break; break;
case STATUS_ABANDONED: case STATUS_ABANDONED:
if (vehToSeek->IsBike()) { if (vehToSeek->IsBike()) {
if ((m_vehEnterType == CAR_DOOR_LR || m_vehEnterType == CAR_DOOR_RR) && vehToSeek->pPassengers[0]) { if ((m_vehDoor == CAR_DOOR_LR || m_vehDoor == CAR_DOOR_RR) && vehToSeek->pPassengers[0]) {
if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) {
if (IsPlayer()) if (IsPlayer())
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} else { } else {
SetCarJack(vehToSeek); SetCarJack(vehToSeek);
} }
} else { } else {
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} }
} else if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) { } else if (m_vehDoor == CAR_DOOR_RF && vehToSeek->pPassengers[0]) {
if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) { if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) {
if (IsPlayer()) if (IsPlayer())
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} else { } else {
SetCarJack(vehToSeek); SetCarJack(vehToSeek);
} }
} else { } else {
SetEnterCar(vehToSeek, m_vehEnterType); SetEnterCar(vehToSeek, m_vehDoor);
} }
break; break;
case STATUS_WRECKED: case STATUS_WRECKED:
@ -7966,7 +7966,7 @@ CPed::LookForInterestingNodes(void)
C2dEffect *effect; C2dEffect *effect;
CMatrix *objMat; CMatrix *objMat;
if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_standardTimer) { if ((CTimer::GetFrameCounter() + (m_randomSeed % 256)) & 7 || CTimer::GetTimeInMilliseconds() <= m_chatTimer) {
return false; return false;
} }
bool found = false; bool found = false;
@ -8076,7 +8076,7 @@ CPed::LookForInterestingNodes(void)
float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f); float angleToFace = CGeneral::GetRadianAngleBetweenPoints(effectFrontLocal.x, effectFrontLocal.y, 0.0f, 0.0f);
randVal = CGeneral::GetRandomNumber() % 256; randVal = CGeneral::GetRandomNumber() % 256;
if (randVal <= m_randomSeed % 256) { if (randVal <= m_randomSeed % 256) {
m_standardTimer = CTimer::GetTimeInMilliseconds() + 2000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 2000;
SetLookFlag(angleToFace, true); SetLookFlag(angleToFace, true);
SetLookTimer(1000); SetLookTimer(1000);
return false; return false;
@ -8299,7 +8299,7 @@ CPed::SetWaitState(eWaitState state, void *time)
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective(); ClearObjective();
RestorePreviousState(); RestorePreviousState();
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
} }
break; break;
case WAITSTATE_TURN180: case WAITSTATE_TURN180:
@ -8328,7 +8328,7 @@ CPed::SetWaitState(eWaitState state, void *time)
if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) { if (m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER && CharCreatedBy == RANDOM_CHAR && m_nPedState == PED_SEEK_CAR) {
ClearObjective(); ClearObjective();
RestorePreviousState(); RestorePreviousState();
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 30000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 30000;
} }
break; break;
case WAITSTATE_LOOK_ABOUT: case WAITSTATE_LOOK_ABOUT:
@ -8980,14 +8980,14 @@ CPed::SetSolicit(uint32 time)
if (CharCreatedBy != MISSION_CHAR && m_carInObjective->m_nNumGettingIn == 0 if (CharCreatedBy != MISSION_CHAR && m_carInObjective->m_nNumGettingIn == 0
&& CTimer::GetTimeInMilliseconds() < m_objectiveTimer) { && CTimer::GetTimeInMilliseconds() < m_objectiveTimer) {
if (m_vehEnterType == CAR_DOOR_LF) { if (m_vehDoor == CAR_DOOR_LF) {
m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI; m_fRotationDest = m_carInObjective->GetForward().Heading() - HALFPI;
} else { } else {
m_fRotationDest = m_carInObjective->GetForward().Heading() + HALFPI; m_fRotationDest = m_carInObjective->GetForward().Heading() + HALFPI;
} }
if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) { if (Abs(m_fRotationDest - m_fRotationCur) < HALFPI) {
m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_chatTimer = CTimer::GetTimeInMilliseconds() + time;
if(!m_carInObjective->bIsVan && !m_carInObjective->bIsBus) if(!m_carInObjective->bIsVan && !m_carInObjective->bIsBus)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_HOOKERTALK, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_HOOKERTALK, 4.0f);
@ -9001,8 +9001,8 @@ CPed::SetSolicit(uint32 time)
void void
CPed::Solicit(void) CPed::Solicit(void)
{ {
if (m_standardTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) { if (m_chatTimer >= CTimer::GetTimeInMilliseconds() && m_carInObjective) {
CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType, 0.0f); CVector doorPos = GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor, 0.0f);
Say(SOUND_PED_SOLICIT); Say(SOUND_PED_SOLICIT);
if (FindPlayerVehicle() == m_carInObjective) { if (FindPlayerVehicle() == m_carInObjective) {
FindPlayerPed()->Say(SOUND_PED_SOLICIT); FindPlayerPed()->Say(SOUND_PED_SOLICIT);
@ -9062,7 +9062,7 @@ CPed::BuyIceCream(void)
{ {
if (m_carInObjective) { if (m_carInObjective) {
CPed *driver = m_carInObjective->pDriver; CPed *driver = m_carInObjective->pDriver;
if (driver && CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (driver && CTimer::GetTimeInMilliseconds() > m_chatTimer) {
SetChat(driver, 8000); SetChat(driver, 8000);
driver->SetChat(this, 8000); driver->SetChat(this, 8000);
return; return;
@ -9138,7 +9138,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
bool canHeadToRf = NTVF_RF <= 0.0f || NTVF_RF >= HALFPI; bool canHeadToRf = NTVF_RF <= 0.0f || NTVF_RF >= HALFPI;
// Only order of conditions are different among enterTypes. // Only order of conditions are different among enterTypes.
if (m_vehEnterType == CAR_DOOR_RR) { if (m_vehDoor == CAR_DOOR_RR) {
if (canHeadToRr) { if (canHeadToRr) {
foundPos = rightRearPos; foundPos = rightRearPos;
foundIt = true; foundIt = true;
@ -9152,7 +9152,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = leftFrontPos; foundPos = leftFrontPos;
foundIt = true; foundIt = true;
} }
} else if(m_vehEnterType == CAR_DOOR_RF) { } else if(m_vehDoor == CAR_DOOR_RF) {
if (canHeadToRf) { if (canHeadToRf) {
foundPos = rightFrontPos; foundPos = rightFrontPos;
foundIt = true; foundIt = true;
@ -9166,7 +9166,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = leftRearPos; foundPos = leftRearPos;
foundIt = true; foundIt = true;
} }
} else if (m_vehEnterType == CAR_DOOR_LF) { } else if (m_vehDoor == CAR_DOOR_LF) {
if (canHeadToLf) { if (canHeadToLf) {
foundPos = leftFrontPos; foundPos = leftFrontPos;
foundIt = true; foundIt = true;
@ -9180,7 +9180,7 @@ CPed::PossiblyFindBetterPosToSeekCar(CVector *pos, CVehicle *veh)
foundPos = rightRearPos; foundPos = rightRearPos;
foundIt = true; foundIt = true;
} }
} else if (m_vehEnterType == CAR_DOOR_LR) { } else if (m_vehDoor == CAR_DOOR_LR) {
if (canHeadToLr) { if (canHeadToLr) {
foundPos = leftRearPos; foundPos = leftRearPos;
foundIt = true; foundIt = true;

View file

@ -596,7 +596,7 @@ public:
float m_fRotationCur; float m_fRotationCur;
float m_fRotationDest; float m_fRotationDest;
float m_headingRate; float m_headingRate;
uint16 m_vehEnterType; uint16 m_vehDoor;
int16 m_walkAroundType; int16 m_walkAroundType;
CPhysical *m_pCurrentPhysSurface; CPhysical *m_pCurrentPhysSurface;
CVector m_vecOffsetFromPhysSurface; CVector m_vecOffsetFromPhysSurface;
@ -650,10 +650,10 @@ public:
uint32 m_leaveCarTimer; uint32 m_leaveCarTimer;
uint32 m_getUpTimer; uint32 m_getUpTimer;
uint32 m_lookTimer; uint32 m_lookTimer;
uint32 m_standardTimer; uint32 m_chatTimer;
uint32 m_attackTimer; uint32 m_attackTimer;
uint32 m_shootTimer; // shooting is a part of attack uint32 m_shootTimer; // shooting is a part of attack
uint32 m_hitRecoverTimer; uint32 m_carJackTimer;
uint32 m_objectiveTimer; uint32 m_objectiveTimer;
uint32 m_duckTimer; uint32 m_duckTimer;
uint32 m_duckAndCoverTimer; uint32 m_duckAndCoverTimer;

View file

@ -1223,7 +1223,7 @@ CPed::ProcessObjective(void)
bool foundSeat = false; bool foundSeat = false;
if (m_carInObjective->IsBike()) { if (m_carInObjective->IsBike()) {
if (!m_carInObjective->pPassengers[0] && !(m_carInObjective->m_nGettingInFlags & (CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR))) { if (!m_carInObjective->pPassengers[0] && !(m_carInObjective->m_nGettingInFlags & (CAR_DOOR_FLAG_RR | CAR_DOOR_FLAG_LR))) {
m_vehEnterType = CAR_DOOR_RR; m_vehDoor = CAR_DOOR_RR;
foundSeat = true; foundSeat = true;
} }
} else { } else {
@ -1232,27 +1232,27 @@ CPed::ProcessObjective(void)
if (m_carInObjective->pPassengers[2] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RR) { if (m_carInObjective->pPassengers[2] || m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RR) {
foundSeat = false; foundSeat = false;
} else { } else {
m_vehEnterType = CAR_DOOR_RR; m_vehDoor = CAR_DOOR_RR;
foundSeat = true; foundSeat = true;
} }
} else { } else {
m_vehEnterType = CAR_DOOR_LR; m_vehDoor = CAR_DOOR_LR;
foundSeat = true; foundSeat = true;
} }
} else { } else {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
foundSeat = true; foundSeat = true;
} }
} }
for (int i = 2; i < m_carInObjective->m_nNumMaxPassengers; ++i) { for (int i = 2; i < m_carInObjective->m_nNumMaxPassengers; ++i) {
if (!m_carInObjective->pPassengers[i] && !(m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { if (!m_carInObjective->pPassengers[i] && !(m_carInObjective->m_nGettingInFlags & CAR_DOOR_FLAG_RF)) {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
foundSeat = true; foundSeat = true;
} }
} }
if (foundSeat) { if (foundSeat) {
SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehEnterType)); SetPosition(GetPositionToOpenCarDoor(m_carInObjective, m_vehDoor));
SetEnterCar(m_carInObjective, m_vehEnterType); SetEnterCar(m_carInObjective, m_vehDoor);
} }
} }
m_objectiveTimer = 0; m_objectiveTimer = 0;
@ -1565,7 +1565,7 @@ CPed::ProcessObjective(void)
if (bInVehicle) { if (bInVehicle) {
bScriptObjectiveCompleted = true; bScriptObjectiveCompleted = true;
RestorePreviousObjective(); RestorePreviousObjective();
} else if (m_hitRecoverTimer < CTimer::GetTimeInMilliseconds()) { } else if (m_carJackTimer < CTimer::GetTimeInMilliseconds()) {
CVehicle *carToSteal = nil; CVehicle *carToSteal = nil;
float closestCarDist = nEnterCarRangeMultiplier * ENTER_CAR_MAX_DIST; float closestCarDist = nEnterCarRangeMultiplier * ENTER_CAR_MAX_DIST;
CVector pos = GetPosition(); CVector pos = GetPosition();
@ -1590,7 +1590,7 @@ CPed::ProcessObjective(void)
} }
if (carToSteal) { if (carToSteal) {
SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carToSteal); SetObjective(OBJECTIVE_ENTER_CAR_AS_DRIVER, carToSteal);
m_hitRecoverTimer = CTimer::GetTimeInMilliseconds() + 5000; m_carJackTimer = CTimer::GetTimeInMilliseconds() + 5000;
} else { } else {
RestorePreviousObjective(); RestorePreviousObjective();
RestorePreviousState(); RestorePreviousState();
@ -2382,7 +2382,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
return; return;
} }
if (!ped->m_vehEnterType) { if (!ped->m_vehDoor) {
ped->QuitEnteringCar(); ped->QuitEnteringCar();
return; return;
} }
@ -2396,7 +2396,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
bool itsLow = !!veh->bLowVehicle; bool itsLow = !!veh->bLowVehicle;
eDoors enterDoor; eDoors enterDoor;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
itsVan = false; itsVan = false;
enterDoor = DOOR_FRONT_RIGHT; enterDoor = DOOR_FRONT_RIGHT;
@ -2418,7 +2418,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->IsBike()) { if (veh->IsBike()) {
CPed *pedToDragOut = nil; CPed *pedToDragOut = nil;
if (veh->GetStatus() == STATUS_ABANDONED) { if (veh->GetStatus() == STATUS_ABANDONED) {
if (ped->m_vehEnterType == CAR_WINDSCREEN) { if (ped->m_vehDoor == CAR_WINDSCREEN) {
ped->m_pVehicleAnim = CAnimManager::BlendAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_KICK, 6.0f); ped->m_pVehicleAnim = CAnimManager::BlendAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_KICK, 6.0f);
ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped);
((CBike*)veh)->bIsBeingPickedUp = true; ((CBike*)veh)->bIsBeingPickedUp = true;
@ -2444,7 +2444,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped);
((CBike*)veh)->bIsBeingPickedUp = true; ((CBike*)veh)->bIsBeingPickedUp = true;
} }
} else if (ped->m_vehEnterType == CAR_WINDSCREEN) { } else if (ped->m_vehDoor == CAR_WINDSCREEN) {
if (veh->pDriver->m_nPedState != PED_DRIVING || veh->pDriver->bDontDragMeOutCar) { if (veh->pDriver->m_nPedState != PED_DRIVING || veh->pDriver->bDontDragMeOutCar) {
ped->QuitEnteringCar(); ped->QuitEnteringCar();
} else { } else {
@ -2458,7 +2458,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->pDriver) { if (veh->pDriver) {
if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) { if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) {
ped->QuitEnteringCar(); ped->QuitEnteringCar();
ped->SetFall(1000, ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); ped->SetFall(1000, ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false);
return; return;
} }
if (veh->pDriver->m_nPedState != PED_DRIVING || veh->pDriver->bDontDragMeOutCar) { if (veh->pDriver->m_nPedState != PED_DRIVING || veh->pDriver->bDontDragMeOutCar) {
@ -2479,7 +2479,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
if (veh->pPassengers[0]) { if (veh->pPassengers[0]) {
if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) { if (veh->m_vecMoveSpeed.Magnitude() > 0.2f) {
ped->QuitEnteringCar(); ped->QuitEnteringCar();
ped->SetFall(1000, ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false); ped->SetFall(1000, ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR ? ANIM_KO_SPIN_L : ANIM_KO_SPIN_R, false);
return; return;
} }
if (veh->pPassengers[0]->m_nPedState != PED_DRIVING || veh->pPassengers[0]->bDontDragMeOutCar) { if (veh->pPassengers[0]->m_nPedState != PED_DRIVING || veh->pPassengers[0]->bDontDragMeOutCar) {
@ -2502,7 +2502,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
if (pedToDragOut) { if (pedToDragOut) {
pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, false); pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehDoor, false);
if (pedToDragOut->IsGangMember()) if (pedToDragOut->IsGangMember())
pedToDragOut->RegisterThreatWithGangPeds(ped); pedToDragOut->RegisterThreatWithGangPeds(ped);
@ -2580,7 +2580,7 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
if (player != veh->pDriver) { if (player != veh->pDriver) {
veh->pDriver->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, true); veh->pDriver->SetBeingDraggedFromCar(veh, ped->m_vehDoor, true);
if (veh->pDriver->IsGangMember()) if (veh->pDriver->IsGangMember())
veh->pDriver->RegisterThreatWithGangPeds(ped); veh->pDriver->RegisterThreatWithGangPeds(ped);
} }
@ -2630,7 +2630,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
eDoors door; eDoors door;
CPed *pedInSeat = nil; CPed *pedInSeat = nil;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
pedInSeat = veh->pPassengers[0]; pedInSeat = veh->pPassengers[0];
@ -2688,21 +2688,21 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
if (veh->m_vecMoveSpeed.Magnitude() > 0.2f || if (veh->m_vecMoveSpeed.Magnitude() > 0.2f ||
veh->IsCar() && veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI && ((CAutomobile*)veh)->m_nWheelsOnGround == 0) { veh->IsCar() && veh->GetVehicleAppearance() == VEHICLE_APPEARANCE_HELI && ((CAutomobile*)veh)->m_nWheelsOnGround == 0) {
ped->QuitEnteringCar(); ped->QuitEnteringCar();
if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR)
ped->SetFall(1000, ANIM_KO_SPIN_R, false); ped->SetFall(1000, ANIM_KO_SPIN_R, false);
else else
ped->SetFall(1000, ANIM_KO_SPIN_L, false); ped->SetFall(1000, ANIM_KO_SPIN_L, false);
return; return;
} }
veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_OPEN_LHS, 1.0f); veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_OPEN_LHS, 1.0f);
if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_RF) if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_RF)
isVan = false; isVan = false;
if (ped->m_nPedState != PED_CARJACK || isBus) { if (ped->m_nPedState != PED_CARJACK || isBus) {
if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR) { if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR) {
if (veh->IsBike()) { if (veh->IsBike()) {
ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_JUMPON_R); ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_JUMPON_R);
} else if (isVan) { } else if (isVan) {
@ -2727,14 +2727,14 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_GETIN_RHS); ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_CAR_GETIN_RHS);
} }
if (ped->m_vehEnterType == CAR_DOOR_RF && pedInSeat && veh->IsCar()) if (ped->m_vehDoor == CAR_DOOR_RF && pedInSeat && veh->IsCar())
pedInSeat->SetObjective(OBJECTIVE_LEAVE_CAR, veh); pedInSeat->SetObjective(OBJECTIVE_LEAVE_CAR, veh);
} }
ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped); ped->m_pVehicleAnim->SetFinishCallback(PedAnimGetInCB, ped);
} else { } else {
CPed *pedToDragOut = nil; CPed *pedToDragOut = nil;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: pedToDragOut = veh->pPassengers[0]; break; case CAR_DOOR_RF: pedToDragOut = veh->pPassengers[0]; break;
case CAR_DOOR_RR: pedToDragOut = veh->pPassengers[2]; break; case CAR_DOOR_RR: pedToDragOut = veh->pPassengers[2]; break;
case CAR_DOOR_LF: pedToDragOut = veh->pDriver; break; case CAR_DOOR_LF: pedToDragOut = veh->pDriver; break;
@ -2748,7 +2748,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective); ((CCopPed*)ped)->SetArrestPlayer(ped->m_pedInObjective);
} }
if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) { if (ped->m_vehDoor != CAR_DOOR_LF && ped->m_vehDoor != CAR_DOOR_LR) {
if (pedToDragOut && !pedToDragOut->bDontDragMeOutCar) { if (pedToDragOut && !pedToDragOut->bDontDragMeOutCar) {
if (pedToDragOut->m_nPedState != PED_DRIVING) { if (pedToDragOut->m_nPedState != PED_DRIVING) {
@ -2818,7 +2818,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
} }
if (player != pedToDragOut) { if (player != pedToDragOut) {
pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehEnterType, false); pedToDragOut->SetBeingDraggedFromCar(veh, ped->m_vehDoor, false);
if (pedToDragOut->IsGangMember()) if (pedToDragOut->IsGangMember())
pedToDragOut->RegisterThreatWithGangPeds(ped); pedToDragOut->RegisterThreatWithGangPeds(ped);
} }
@ -2889,7 +2889,7 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
} }
if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) { if (ped->m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER) {
if (ped->m_vehEnterType == CAR_DOOR_LF || ped->m_vehEnterType == CAR_DOOR_LR) { if (ped->m_vehDoor == CAR_DOOR_LF || ped->m_vehDoor == CAR_DOOR_LR) {
if (veh->IsBike()) if (veh->IsBike())
ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_JUMPON_R); ped->m_pVehicleAnim = CAnimManager::AddAnimation(ped->GetClump(), ((CBike*)veh)->m_bikeAnimType, ANIM_BIKE_JUMPON_R);
else if (isLow) else if (isLow)
@ -2946,7 +2946,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
} }
return; return;
} }
if (ped->IsPlayer() && ped->m_vehEnterType == CAR_DOOR_LF if (ped->IsPlayer() && ped->m_vehDoor == CAR_DOOR_LF
&& (Pads[0].GetAccelerate() >= 255.0f || Pads[0].GetBrake() >= 255.0f) && (Pads[0].GetAccelerate() >= 255.0f || Pads[0].GetBrake() >= 255.0f)
&& veh->IsCar() && !veh->pDriver) { && veh->IsCar() && !veh->pDriver) {
@ -2965,7 +2965,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
bool isBus = !!veh->bIsBus; bool isBus = !!veh->bIsBus;
bool isLow = !!veh->bLowVehicle; bool isLow = !!veh->bLowVehicle;
eDoors enterDoor; eDoors enterDoor;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
isVan = false; isVan = false;
enterDoor = DOOR_FRONT_RIGHT; enterDoor = DOOR_FRONT_RIGHT;
@ -3011,7 +3011,7 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
ped->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 400; ped->m_leaveCarTimer = CTimer::GetTimeInMilliseconds() + 400;
return; return;
} }
if (driver != ped && ped->m_vehEnterType != CAR_DOOR_LF) { if (driver != ped && ped->m_vehDoor != CAR_DOOR_LF) {
if (!driver->IsPlayer()) { if (!driver->IsPlayer()) {
driver->bUsePedNodeSeek = true; driver->bUsePedNodeSeek = true;
driver->m_pLastPathNode = nil; driver->m_pLastPathNode = nil;
@ -3094,10 +3094,10 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
bool isLow = !!veh->bLowVehicle; bool isLow = !!veh->bLowVehicle;
if (!veh->bIsBus) if (!veh->bIsBus)
veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_CLOSEDOOR_LHS, 1.0f); veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_CLOSEDOOR_LHS, 1.0f);
eDoors door; eDoors door;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break; case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break;
case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break; case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break;
case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break; case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break;
@ -3110,7 +3110,7 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
if (door == DOOR_FRONT_LEFT || ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || veh->bIsBus || veh->m_nNumMaxPassengers == 0) { if (door == DOOR_FRONT_LEFT || ped->m_objective == OBJECTIVE_ENTER_CAR_AS_PASSENGER || veh->bIsBus || veh->m_nNumMaxPassengers == 0) {
PedSetInCarCB(nil, ped); PedSetInCarCB(nil, ped);
} else if (ped->m_vehEnterType == CAR_DOOR_RF } else if (ped->m_vehDoor == CAR_DOOR_RF
&& (veh->m_nGettingInFlags & CAR_DOOR_FLAG_LF || && (veh->m_nGettingInFlags & CAR_DOOR_FLAG_LF ||
(veh->pDriver != nil && (veh->pDriver != nil &&
(veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR (veh->pDriver->m_objective != OBJECTIVE_LEAVE_CAR
@ -3263,7 +3263,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
veh->m_vecMoveSpeed += CVector(0.001f, 0.001f, 0.001f); veh->m_vecMoveSpeed += CVector(0.001f, 0.001f, 0.001f);
veh->m_vecTurnSpeed += CVector(0.001f, 0.001f, 0.001f); veh->m_vecTurnSpeed += CVector(0.001f, 0.001f, 0.001f);
if (!veh->bIsBus) if (!veh->bIsBus)
veh->ProcessOpenDoor(ped->m_vehEnterType, ANIM_CAR_GETOUT_LHS, 1.0f); veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_GETOUT_LHS, 1.0f);
/* /*
// Duplicate and only in PC for some reason // Duplicate and only in PC for some reason
@ -3273,7 +3273,7 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
} }
*/ */
eDoors door; eDoors door;
switch (ped->m_vehEnterType) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
break; break;
@ -3442,7 +3442,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
if (veh->GetUp().z <= -0.8f) if (veh->GetUp().z <= -0.8f)
vehIsUpsideDown = true; vehIsUpsideDown = true;
if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) {
if (vehIsUpsideDown) { if (vehIsUpsideDown) {
m_fRotationDest = -PI + veh->GetForward().Heading(); m_fRotationDest = -PI + veh->GetForward().Heading();
} else if (veh->bIsBus) { } else if (veh->bIsBus) {
@ -3450,7 +3450,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
} else { } else {
m_fRotationDest = veh->GetForward().Heading(); m_fRotationDest = veh->GetForward().Heading();
} }
} else if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { } else if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) {
if (vehIsUpsideDown) { if (vehIsUpsideDown) {
m_fRotationDest = veh->GetForward().Heading(); m_fRotationDest = veh->GetForward().Heading();
} else if (veh->bIsBus) { } else if (veh->bIsBus) {
@ -3465,7 +3465,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
m_fRotationDest = veh->GetForward().Heading(); m_fRotationDest = veh->GetForward().Heading();
} else if (veh->bIsBus) { } else if (veh->bIsBus) {
m_fRotationDest = 0.5f * PI + veh->GetForward().Heading(); m_fRotationDest = 0.5f * PI + veh->GetForward().Heading();
} else if (m_vehEnterType == CAR_WINDSCREEN) { } else if (m_vehDoor == CAR_WINDSCREEN) {
m_fRotationDest = veh->GetForward().Heading() + PI; m_fRotationDest = veh->GetForward().Heading() + PI;
} else { } else {
m_fRotationDest = veh->GetForward().Heading(); m_fRotationDest = veh->GetForward().Heading();
@ -3573,7 +3573,7 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
if (phase == LINE_UP_TO_CAR_2) { if (phase == LINE_UP_TO_CAR_2) {
neededPos = GetPosition(); neededPos = GetPosition();
} else { } else {
neededPos = GetPositionToOpenCarDoor(veh, m_vehEnterType, seatPosMult); neededPos = GetPositionToOpenCarDoor(veh, m_vehDoor, seatPosMult);
} }
autoZPos = neededPos; autoZPos = neededPos;
@ -3690,13 +3690,13 @@ CPed::LineUpPedWithCar(PedLineUpPhase phase)
SetHeading(m_fRotationCur); SetHeading(m_fRotationCur);
} else { } else {
CMatrix vehDoorMat(veh->GetMatrix()); CMatrix vehDoorMat(veh->GetMatrix());
vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehEnterType, 0.0f)); vehDoorMat.GetPosition() += Multiply3x3(vehDoorMat, GetLocalPositionToOpenCarDoor(veh, m_vehDoor, 0.0f));
if (m_vehEnterType == CAR_WINDSCREEN || veh->bIsBus) { if (m_vehDoor == CAR_WINDSCREEN || veh->bIsBus) {
CMatrix correctionMat; CMatrix correctionMat;
if (veh->bIsBus && (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR)) if (veh->bIsBus && (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR))
correctionMat.SetRotateZ(-HALFPI); correctionMat.SetRotateZ(-HALFPI);
else if (veh->bIsBus && (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR)) else if (veh->bIsBus && (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR))
correctionMat.SetRotateZ(HALFPI); correctionMat.SetRotateZ(HALFPI);
else else
correctionMat.SetRotateZ(PI); correctionMat.SetRotateZ(PI);
@ -3720,7 +3720,7 @@ CPed::SetCarJack(CVehicle* car)
return; return;
if (car->IsBike()) { if (car->IsBike()) {
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
doorFlag = CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_RF; doorFlag = CAR_DOOR_FLAG_LF | CAR_DOOR_FLAG_RF;
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
@ -3747,7 +3747,7 @@ CPed::SetCarJack(CVehicle* car)
break; break;
} }
} else { } else {
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
doorFlag = CAR_DOOR_FLAG_RF; doorFlag = CAR_DOOR_FLAG_RF;
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
@ -3788,7 +3788,7 @@ CPed::SetCarJack(CVehicle* car)
if (m_nPedState != PED_CARJACK && !m_pVehicleAnim) if (m_nPedState != PED_CARJACK && !m_pVehicleAnim)
if ((car->IsDoorReady(door) || car->IsDoorFullyOpen(door))) if ((car->IsDoorReady(door) || car->IsDoorFullyOpen(door)))
if (!car->bIsBeingCarJacked && !(doorFlag & car->m_nGettingInFlags) && !(doorFlag & car->m_nGettingOutFlags)) if (!car->bIsBeingCarJacked && !(doorFlag & car->m_nGettingInFlags) && !(doorFlag & car->m_nGettingOutFlags))
SetCarJack_AllClear(car, m_vehEnterType, doorFlag); SetCarJack_AllClear(car, m_vehDoor, doorFlag);
} }
// --MIAMI: Done // --MIAMI: Done
@ -3812,7 +3812,7 @@ CPed::SetCarJack_AllClear(CVehicle* car, uint32 doorNode, uint32 doorFlag)
Say(SOUND_PED_CAR_JACKING, 1000); Say(SOUND_PED_CAR_JACKING, 1000);
CVector carEnterPos; CVector carEnterPos;
carEnterPos = GetPositionToOpenCarDoor(car, m_vehEnterType); carEnterPos = GetPositionToOpenCarDoor(car, m_vehDoor);
car->m_nGettingInFlags |= doorFlag; car->m_nGettingInFlags |= doorFlag;
m_vecOffsetSeek = carEnterPos - GetPosition(); m_vecOffsetSeek = carEnterPos - GetPosition();
@ -3825,7 +3825,7 @@ CPed::SetCarJack_AllClear(CVehicle* car, uint32 doorNode, uint32 doorFlag)
float zDiff = Max(0.0f, carEnterPos.z - GetPosition().z); float zDiff = Max(0.0f, carEnterPos.z - GetPosition().z);
bUsesCollision = false; bUsesCollision = false;
if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f);
else else
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f);
@ -3851,14 +3851,14 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack)
if (veh->IsBike()) { if (veh->IsBike()) {
((CBike*)veh)->bIsBeingPickedUp = true; ((CBike*)veh)->bIsBeingPickedUp = true;
if (veh->pPassengers[0] != this && (vehEnterType != CAR_WINDSCREEN || veh->pPassengers[0])) if (veh->pPassengers[0] != this && (vehEnterType != CAR_WINDSCREEN || veh->pPassengers[0]))
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
else else
m_vehEnterType = CAR_DOOR_LR; m_vehDoor = CAR_DOOR_LR;
} else { } else {
m_vehEnterType = vehEnterType; m_vehDoor = vehEnterType;
} }
if (m_vehEnterType == CAR_DOOR_LF) { if (m_vehDoor == CAR_DOOR_LF) {
if (veh->pDriver && veh->pDriver->IsPlayer()) if (veh->pDriver && veh->pDriver->IsPlayer())
veh->SetStatus(STATUS_PLAYER_DISABLED); veh->SetStatus(STATUS_PLAYER_DISABLED);
else else
@ -3878,9 +3878,9 @@ CPed::SetBeingDraggedFromCar(CVehicle *veh, uint32 vehEnterType, bool quickJack)
SetRadioStation(); SetRadioStation();
if(veh->IsBike()) if(veh->IsBike())
veh->m_nGettingOutFlags |= GetBikeDoorFlagInclJumpInFromFront(m_vehEnterType); veh->m_nGettingOutFlags |= GetBikeDoorFlagInclJumpInFromFront(m_vehDoor);
else else
veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehEnterType); veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehDoor);
} }
// --MIAMI: Done // --MIAMI: Done
@ -3899,15 +3899,15 @@ CPed::BeingDraggedFromCar(void)
assocGroup = ((CBike*)m_pMyVehicle)->m_bikeAnimType; assocGroup = ((CBike*)m_pMyVehicle)->m_bikeAnimType;
} else { } else {
if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) {
if (bWillBeQuickJacked && m_vehEnterType == CAR_DOOR_LF) { if (bWillBeQuickJacked && m_vehDoor == CAR_DOOR_LF) {
enterAnim = ANIM_CAR_QJACKED; enterAnim = ANIM_CAR_QJACKED;
} else if (m_pMyVehicle->bLowVehicle) { } else if (m_pMyVehicle->bLowVehicle) {
enterAnim = ANIM_CAR_LJACKED_LHS; enterAnim = ANIM_CAR_LJACKED_LHS;
} else { } else {
enterAnim = ANIM_CAR_JACKED_LHS; enterAnim = ANIM_CAR_JACKED_LHS;
} }
} else if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { } else if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) {
if (m_pMyVehicle->bLowVehicle) if (m_pMyVehicle->bLowVehicle)
enterAnim = ANIM_CAR_LJACKED_RHS; enterAnim = ANIM_CAR_LJACKED_RHS;
else else
@ -3944,7 +3944,7 @@ CPed::BeingDraggedFromCar(void)
static float mult = 5.f; static float mult = 5.f;
if (m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) { if (m_objective == OBJECTIVE_LEAVE_CAR_AND_DIE) {
if (m_pMyVehicle) { if (m_pMyVehicle) {
m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, NUM_STD_ANIMS, m_pVehicleAnim->currentTime * mult); m_pMyVehicle->ProcessOpenDoor(m_vehDoor, NUM_STD_ANIMS, m_pVehicleAnim->currentTime * mult);
} }
} }
} }
@ -3960,7 +3960,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused)
uint8 doorFlag; uint8 doorFlag;
eDoors door; eDoors door;
if (car->IsBike()) { if (car->IsBike()) {
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
doorFlag = CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF; doorFlag = CAR_DOOR_FLAG_RF | CAR_DOOR_FLAG_LF;
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
@ -3986,7 +3986,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused)
break; break;
} }
} else { } else {
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
doorFlag = CAR_DOOR_FLAG_RF; doorFlag = CAR_DOOR_FLAG_RF;
door = DOOR_FRONT_RIGHT; door = DOOR_FRONT_RIGHT;
@ -4022,7 +4022,7 @@ CPed::SetEnterCar(CVehicle *car, uint32 unused)
|| doorFlag && !car->IsDoorReady(door) && !car->IsDoorFullyOpen(door)) || doorFlag && !car->IsDoorReady(door) && !car->IsDoorFullyOpen(door))
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
else else
SetEnterCar_AllClear(car, m_vehEnterType, doorFlag); SetEnterCar_AllClear(car, m_vehDoor, doorFlag);
} }
} }
@ -4038,9 +4038,9 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
m_pSeekTarget = car; m_pSeekTarget = car;
m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity **) &m_pSeekTarget);
m_vehEnterType = doorNode; m_vehDoor = doorNode;
SetPedState(PED_ENTER_CAR); SetPedState(PED_ENTER_CAR);
if (m_vehEnterType == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && !car->IsBike()) { if (m_vehDoor == CAR_DOOR_RF && m_objective == OBJECTIVE_ENTER_CAR_AS_DRIVER && !car->IsBike()) {
car->bIsBeingCarJacked = true; car->bIsBeingCarJacked = true;
} }
@ -4048,7 +4048,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle); m_pMyVehicle->RegisterReference((CEntity**) &m_pMyVehicle);
((CVehicle*)m_pSeekTarget)->m_nNumGettingIn++; ((CVehicle*)m_pSeekTarget)->m_nNumGettingIn++;
bUsesCollision = false; bUsesCollision = false;
CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehEnterType); CVector doorOpenPos = GetPositionToOpenCarDoor(car, m_vehDoor);
// Because buses have stairs // Because buses have stairs
if (!m_pMyVehicle->bIsBus) if (!m_pMyVehicle->bIsBus)
@ -4071,7 +4071,7 @@ CPed::SetEnterCar_AllClear(CVehicle *car, uint32 doorNode, uint32 doorFlag)
car->AutoPilot.m_nCruiseSpeed = 0; car->AutoPilot.m_nCruiseSpeed = 0;
} else { } else {
if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR)
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_RHS : ANIM_CAR_ALIGN_RHS, 4.0f);
else else
m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f); m_pVehicleAnim = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, zDiff > 4.4f ? ANIM_CAR_ALIGNHI_LHS : ANIM_CAR_ALIGN_LHS, 4.0f);
@ -4087,11 +4087,11 @@ CPed::EnterCar(void)
CVehicle *veh = m_pMyVehicle; CVehicle *veh = m_pMyVehicle;
// Not used. // Not used.
// CVector posForDoor = GetPositionToOpenCarDoor(veh, m_vehEnterType); // CVector posForDoor = GetPositionToOpenCarDoor(veh, m_vehDoor);
if (veh->CanPedOpenLocks(this)) { if (veh->CanPedOpenLocks(this)) {
if (m_vehEnterType && m_pVehicleAnim) { if (m_vehDoor && m_pVehicleAnim) {
veh->ProcessOpenDoor(m_vehEnterType, m_pVehicleAnim->animId, m_pVehicleAnim->currentTime); veh->ProcessOpenDoor(m_vehDoor, m_pVehicleAnim->animId, m_pVehicleAnim->currentTime);
} }
} }
bIsInTheAir = false; bIsInTheAir = false;
@ -4147,10 +4147,10 @@ CPed::QuitEnteringCar(void)
RestorePreviousObjective(); RestorePreviousObjective();
if (veh->IsBike()) { if (veh->IsBike()) {
veh->m_nGettingInFlags &= ~GetBikeDoorFlag(m_vehEnterType); veh->m_nGettingInFlags &= ~GetBikeDoorFlag(m_vehDoor);
((CBike*)veh)->bIsBeingPickedUp = false; ((CBike*)veh)->bIsBeingPickedUp = false;
} else } else
veh->m_nGettingInFlags &= ~GetEnterCarDoorFlag(m_vehEnterType, veh->m_nNumMaxPassengers); veh->m_nGettingInFlags &= ~GetEnterCarDoorFlag(m_vehDoor, veh->m_nNumMaxPassengers);
} }
bUsesCollision = true; bUsesCollision = true;
@ -4184,7 +4184,7 @@ CPed::SetExitBoat(CVehicle *boat)
newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z }; newPos = { 0.0f, 0.0f, boatCol->boundingBox.min.z };
newPos = boat->GetMatrix() * newPos; newPos = boat->GetMatrix() * newPos;
newPos.z += 1.0f; newPos.z += 1.0f;
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
bIsStanding = true; bIsStanding = true;
m_pCurSurface = boat; m_pCurSurface = boat;
@ -4193,7 +4193,7 @@ CPed::SetExitBoat(CVehicle *boat)
} else { } else {
if (boat->m_modelIndex == MI_SKIMMER) { if (boat->m_modelIndex == MI_SKIMMER) {
if (!boat->bIsInWater) { if (!boat->bIsInWater) {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
bIsStanding = true; bIsStanding = true;
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
@ -4214,7 +4214,7 @@ CPed::SetExitBoat(CVehicle *boat)
newPos.z += 2.0f; newPos.z += 2.0f;
} }
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
bIsStanding = true; bIsStanding = true;
m_pCurSurface = boat; m_pCurSurface = boat;
@ -4455,14 +4455,14 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
// needed for PositionPedOutOfCollision() // needed for PositionPedOutOfCollision()
optedDoorNode = firstOptedDoor; optedDoorNode = firstOptedDoor;
m_vehEnterType = firstOptedDoor; m_vehDoor = firstOptedDoor;
PositionPedOutOfCollision(); PositionPedOutOfCollision();
teleportNeeded = true; teleportNeeded = true;
} }
} }
if (!teleportNeeded && veh->IsOnItsSide()) { if (!teleportNeeded && veh->IsOnItsSide()) {
m_vehEnterType = optedDoorNode; m_vehDoor = optedDoorNode;
PositionPedOutOfCollision(); PositionPedOutOfCollision();
teleportNeeded = true; teleportNeeded = true;
} }
@ -4480,7 +4480,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
bUsesCollision = false; bUsesCollision = false;
m_pSeekTarget = veh; m_pSeekTarget = veh;
m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget); m_pSeekTarget->RegisterReference((CEntity**) &m_pSeekTarget);
m_vehEnterType = optedDoorNode; m_vehDoor = optedDoorNode;
SetPedState(PED_EXIT_CAR); SetPedState(PED_EXIT_CAR);
if (m_pVehicleAnim && m_pVehicleAnim->flags & ASSOC_PARTIAL) if (m_pVehicleAnim && m_pVehicleAnim->flags & ASSOC_PARTIAL)
m_pVehicleAnim->blendDelta = -1000.0f; m_pVehicleAnim->blendDelta = -1000.0f;
@ -4493,16 +4493,16 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
PedSetOutCarCB(nil, this); PedSetOutCarCB(nil, this);
} else { } else {
if (veh->GetUp().z <= -0.8f && !veh->IsBike()) { if (veh->GetUp().z <= -0.8f && !veh->IsBike()) {
if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) { if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR) {
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS2); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS2);
} else if (m_vehEnterType == CAR_DOOR_LF || m_vehEnterType == CAR_DOOR_LR) { } else if (m_vehDoor == CAR_DOOR_LF || m_vehDoor == CAR_DOOR_LR) {
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_CRAWLOUT_RHS);
} }
m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this); m_pVehicleAnim->SetFinishCallback(PedSetOutCarCB, this);
} else if (veh->IsBike()) { } else if (veh->IsBike()) {
CBike* bike = (CBike*)veh; CBike* bike = (CBike*)veh;
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_BUMP_REAR: case CAR_BUMP_REAR:
case CAR_BOOT: case CAR_BOOT:
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), bike->m_bikeAnimType, ANIM_BIKE_GETOFF_BACK); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), bike->m_bikeAnimType, ANIM_BIKE_GETOFF_BACK);
@ -4521,7 +4521,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
int8 exitFlags = 0; int8 exitFlags = 0;
// Bike door flags incl. passenger jump off // Bike door flags incl. passenger jump off
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_BUMP_REAR: case CAR_BUMP_REAR:
case CAR_DOOR_RR: case CAR_DOOR_RR:
case CAR_DOOR_LR: case CAR_DOOR_LR:
@ -4535,7 +4535,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
} }
// Passenger get off // Passenger get off
if (m_vehEnterType == CAR_BUMP_REAR || m_vehEnterType == CAR_BOOT) { if (m_vehDoor == CAR_BUMP_REAR || m_vehDoor == CAR_BOOT) {
m_pVehicleAnim->SetFinishCallback(RestoreHeadingRateCB, this); m_pVehicleAnim->SetFinishCallback(RestoreHeadingRateCB, this);
m_headingRate = 0.0f; m_headingRate = 0.0f;
@ -4545,7 +4545,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
} }
} else { } else {
switch (m_vehEnterType) { switch (m_vehDoor) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
if (canJumpOut) { if (canJumpOut) {
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ROLLOUT_RHS); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, ANIM_CAR_ROLLOUT_RHS);
@ -4596,7 +4596,7 @@ CPed::SetExitCar(CVehicle *veh, uint32 wantedDoorNode)
break; break;
} }
if (!bBusJacked && !canJumpOut) { if (!bBusJacked && !canJumpOut) {
veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehEnterType); veh->m_nGettingOutFlags |= GetCarDoorFlag(m_vehDoor);
} }
m_pVehicleAnim->SetFinishCallback(canJumpOut ? RestoreHeadingRateCB : PedAnimStepOutCarCB, this); m_pVehicleAnim->SetFinishCallback(canJumpOut ? RestoreHeadingRateCB : PedAnimStepOutCarCB, this);
} }
@ -4622,7 +4622,7 @@ CPed::ExitCar(void)
if (!m_pVehicleAnim) { if (!m_pVehicleAnim) {
if (InVehicle()) { if (InVehicle()) {
if (m_pMyVehicle->IsBike()) { if (m_pMyVehicle->IsBike()) {
if (m_vehEnterType == CAR_BOOT || m_vehEnterType == CAR_BUMP_REAR) { if (m_vehDoor == CAR_BOOT || m_vehDoor == CAR_BUMP_REAR) {
((CBike*)m_pMyVehicle)->KnockOffRider(WEAPONTYPE_UNARMED, 0, this, false); ((CBike*)m_pMyVehicle)->KnockOffRider(WEAPONTYPE_UNARMED, 0, this, false);
} }
} else if (m_pMyVehicle->IsCar()) { } else if (m_pMyVehicle->IsCar()) {
@ -4656,7 +4656,7 @@ CPed::ExitCar(void)
LineUpPedWithCar(LINE_UP_TO_CAR_FALL); LineUpPedWithCar(LINE_UP_TO_CAR_FALL);
} }
} else { } else {
m_pMyVehicle->ProcessOpenDoor(m_vehEnterType, exitAnim, animTime); m_pMyVehicle->ProcessOpenDoor(m_vehDoor, exitAnim, animTime);
if (m_pSeekTarget) { if (m_pSeekTarget) {
// Car is upside down // Car is upside down
@ -4718,17 +4718,17 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen)
angleDiff += TWOPI; angleDiff += TWOPI;
if (Abs(angleDiff) < DEGTORAD(30.f) if (Abs(angleDiff) < DEGTORAD(30.f)
&& (IsPlayer() && ((CPlayerPed*)this)->m_fMoveSpeed > 1.5f && !m_vehEnterType || && (IsPlayer() && ((CPlayerPed*)this)->m_fMoveSpeed > 1.5f && !m_vehDoor ||
!IsPlayer() && m_nPedType != PEDTYPE_COP && m_nMoveState == PEDMOVE_RUN !IsPlayer() && m_nPedType != PEDTYPE_COP && m_nMoveState == PEDMOVE_RUN
&& m_pedStats->m_temper > 65 && m_pedStats->m_temper > 65
&& !m_vehEnterType || m_vehEnterType == CAR_WINDSCREEN)) { && !m_vehDoor || m_vehDoor == CAR_WINDSCREEN)) {
m_vehEnterType = CAR_WINDSCREEN; m_vehDoor = CAR_WINDSCREEN;
posToOpen = GetPositionToOpenCarDoor(veh, CAR_WINDSCREEN); posToOpen = GetPositionToOpenCarDoor(veh, CAR_WINDSCREEN);
return; return;
} }
} }
} }
} else if (m_vehEnterType == CAR_DOOR_LF && veh->pDriver && !veh->bLowVehicle && !veh->bIsBus) { } else if (m_vehDoor == CAR_DOOR_LF && veh->pDriver && !veh->bLowVehicle && !veh->bIsBus) {
enterOffset = &vecPedQuickDraggedOutCarAnimOffset; enterOffset = &vecPedQuickDraggedOutCarAnimOffset;
} }
@ -4739,10 +4739,10 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen)
if ((lfPos - GetPosition()).MagnitudeSqr2D() < (rfPos - GetPosition()).MagnitudeSqr2D()) { if ((lfPos - GetPosition()).MagnitudeSqr2D() < (rfPos - GetPosition()).MagnitudeSqr2D()) {
if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
posToOpen = lfPos; posToOpen = lfPos;
} else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_RF, enterOffset)) { } else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_RF, enterOffset)) {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
posToOpen = rfPos; posToOpen = rfPos;
} }
} else { } else {
@ -4756,14 +4756,14 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen)
&& veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)
|| (veh->m_nGettingInFlags & CAR_DOOR_FLAG_RF) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { || (veh->m_nGettingInFlags & CAR_DOOR_FLAG_RF) && veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
posToOpen = lfPos; posToOpen = lfPos;
} else { } else {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
posToOpen = rfPos; posToOpen = rfPos;
} }
} else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) { } else if (veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset)) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
posToOpen = lfPos; posToOpen = lfPos;
} }
} }
@ -4780,7 +4780,7 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen)
switch (veh->GetModelIndex()) { switch (veh->GetModelIndex()) {
case MI_BUS: case MI_BUS:
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
posToOpen = GetPositionToOpenCarDoor(veh, CAR_DOOR_RF); posToOpen = GetPositionToOpenCarDoor(veh, CAR_DOOR_RF);
return true; return true;
case MI_RHINO: case MI_RHINO:
@ -4839,15 +4839,15 @@ CPed::GetNearestPassengerDoor(CVehicle *veh, CVector &posToOpen)
CVector2D nextToCompare = rfPosDist; CVector2D nextToCompare = rfPosDist;
posToOpen = rfPos; posToOpen = rfPos;
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
if (lrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) { if (lrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) {
m_vehEnterType = CAR_DOOR_LR; m_vehDoor = CAR_DOOR_LR;
posToOpen = lrPos; posToOpen = lrPos;
nextToCompare = lrPosDist; nextToCompare = lrPosDist;
} }
if (rrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) { if (rrPosDist.MagnitudeSqr() < nextToCompare.MagnitudeSqr()) {
m_vehEnterType = CAR_DOOR_RR; m_vehDoor = CAR_DOOR_RR;
posToOpen = rrPos; posToOpen = rrPos;
} }
return canEnter; return canEnter;
@ -4870,7 +4870,7 @@ void CPed::PedSetGetInCarPositionCB(CAnimBlendAssociation* assoc, void* arg)
CPed* pPed = (CPed*)arg; CPed* pPed = (CPed*)arg;
CMatrix mat(pPed->GetMatrix()); CMatrix mat(pPed->GetMatrix());
CVehicle* pVehicle = pPed->m_pMyVehicle; CVehicle* pVehicle = pPed->m_pMyVehicle;
const CVector& offset = (pVehicle->bIsVan && (pPed->m_vehEnterType == CAR_DOOR_RR || pPed->m_vehEnterType == CAR_DOOR_LR)) ? vecPedVanRearDoorAnimOffset : vecPedCarDoorAnimOffset; const CVector& offset = (pVehicle->bIsVan && (pPed->m_vehDoor == CAR_DOOR_RR || pPed->m_vehDoor == CAR_DOOR_LR)) ? vecPedVanRearDoorAnimOffset : vecPedCarDoorAnimOffset;
CVector position = Multiply3x3(mat, offset) + pPed->GetPosition(); CVector position = Multiply3x3(mat, offset) + pPed->GetPosition();
CPedPlacement::FindZCoorForPed(&position); CPedPlacement::FindZCoorForPed(&position);
pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f); pPed->SetMoveSpeed(0.0f, 0.0f, 0.0f);
@ -5054,7 +5054,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void
ped->bUsesCollision = true; ped->bUsesCollision = true;
ped->RestartNonPartialAnims(); ped->RestartNonPartialAnims();
draggedOutOffset = vecPedQuickDraggedOutCarAnimOffset; draggedOutOffset = vecPedQuickDraggedOutCarAnimOffset;
if (ped->m_vehEnterType == CAR_DOOR_RF || ped->m_vehEnterType == CAR_DOOR_RR) if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR)
draggedOutOffset.x = -draggedOutOffset.x; draggedOutOffset.x = -draggedOutOffset.x;
finalPos = Multiply3x3(pedMat, draggedOutOffset) + ped->GetPosition(); finalPos = Multiply3x3(pedMat, draggedOutOffset) + ped->GetPosition();
@ -5067,7 +5067,7 @@ CPed::PedSetQuickDraggedOutCarPositionCB(CAnimBlendAssociation *animAssoc, void
ped->m_fRotationCur = ped->m_fRotationDest; ped->m_fRotationCur = ped->m_fRotationDest;
ped->CalculateNewOrientation(); ped->CalculateNewOrientation();
if (!veh->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedQuickDraggedOutCarAnimOffset)) if (!veh->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedQuickDraggedOutCarAnimOffset))
ped->PositionPedOutOfCollision(); ped->PositionPedOutOfCollision();
} }
@ -5158,7 +5158,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
} else { } else {
draggedOutOffset = vecPedDraggedOutCarAnimOffset; draggedOutOffset = vecPedDraggedOutCarAnimOffset;
} }
if (ped->m_vehEnterType == CAR_DOOR_RF || ped->m_vehEnterType == CAR_DOOR_RR) if (ped->m_vehDoor == CAR_DOOR_RF || ped->m_vehDoor == CAR_DOOR_RR)
draggedOutOffset.x = -draggedOutOffset.x; draggedOutOffset.x = -draggedOutOffset.x;
CVector posAfterBeingDragged = Multiply3x3(pedMat, draggedOutOffset); CVector posAfterBeingDragged = Multiply3x3(pedMat, draggedOutOffset);
@ -5167,7 +5167,7 @@ CPed::PedSetDraggedOutCarPositionCB(CAnimBlendAssociation* animAssoc, void* arg)
ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); ped->m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
ped->SetPosition(posAfterBeingDragged); ped->SetPosition(posAfterBeingDragged);
if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehEnterType, &vecPedDraggedOutCarAnimOffset)) { if (ped->m_pMyVehicle && !ped->m_pMyVehicle->IsBike() && !ped->m_pMyVehicle->IsRoomForPedToLeaveCar(ped->m_vehDoor, &vecPedDraggedOutCarAnimOffset)) {
ped->PositionPedOutOfCollision(); ped->PositionPedOutOfCollision();
} }
@ -5235,7 +5235,7 @@ CPed::GetNearestTrainDoor(CVehicle *train, CVector &doorPos)
CVehicleModelInfo* trainModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(train->m_modelIndex); CVehicleModelInfo* trainModel = (CVehicleModelInfo*)CModelInfo::GetModelInfo(train->m_modelIndex);
CMatrix trainMat = CMatrix(train->GetMatrix()); CMatrix trainMat = CMatrix(train->GetMatrix());
doorPos = trainModel->m_positions[m_vehEnterType]; doorPos = trainModel->m_positions[m_vehDoor];
doorPos.x -= 1.5f; doorPos.x -= 1.5f;
doorPos = Multiply3x3(trainMat, doorPos); doorPos = Multiply3x3(trainMat, doorPos);
doorPos += train->GetPosition(); doorPos += train->GetPosition();
@ -5286,17 +5286,17 @@ CPed::GetNearestTrainPedPosition(CVehicle *train, CVector &enterPos)
if (distMidEntry < distLeftEntry) { if (distMidEntry < distLeftEntry) {
if (distMidEntry < distRightEntry) { if (distMidEntry < distRightEntry) {
enterPos = midEntryPos; enterPos = midEntryPos;
m_vehEnterType = TRAIN_POS_MID_ENTRY; m_vehDoor = TRAIN_POS_MID_ENTRY;
} else { } else {
enterPos = rightEntryPos; enterPos = rightEntryPos;
m_vehEnterType = TRAIN_POS_RIGHT_ENTRY; m_vehDoor = TRAIN_POS_RIGHT_ENTRY;
} }
} else if (distRightEntry < distLeftEntry) { } else if (distRightEntry < distLeftEntry) {
enterPos = rightEntryPos; enterPos = rightEntryPos;
m_vehEnterType = TRAIN_POS_RIGHT_ENTRY; m_vehDoor = TRAIN_POS_RIGHT_ENTRY;
} else { } else {
enterPos = leftEntryPos; enterPos = leftEntryPos;
m_vehEnterType = TRAIN_POS_LEFT_ENTRY; m_vehDoor = TRAIN_POS_LEFT_ENTRY;
} }
return 1; return 1;
@ -6075,7 +6075,7 @@ CPed::SeekBoatPosition(void)
m_vecSeekPos = boatMat * enterOffset; m_vecSeekPos = boatMat * enterOffset;
if (Seek()) { if (Seek()) {
// We arrived to the boat // We arrived to the boat
m_vehEnterType = 0; m_vehDoor = 0;
SetEnterCar(m_carInObjective, 0); SetEnterCar(m_carInObjective, 0);
} }
} else } else
@ -6212,9 +6212,9 @@ CPed::PositionPedOutOfCollision(void)
foundAPos = true; foundAPos = true;
} }
} else if (m_vehEnterType != 0) { } else if (m_vehDoor != 0) {
// Try the normal way // Try the normal way
CVector pos = GetPositionToOpenCarDoor(m_pMyVehicle, m_vehEnterType); CVector pos = GetPositionToOpenCarDoor(m_pMyVehicle, m_vehDoor);
newPos = pos; newPos = pos;
GetMatrix().SetTranslate(newPos); GetMatrix().SetTranslate(newPos);
if (!CheckCollision()) { if (!CheckCollision()) {
@ -6224,7 +6224,7 @@ CPed::PositionPedOutOfCollision(void)
} }
float vehRelativeExitX = vehCol->boundingBox.min.x - 0.355f; float vehRelativeExitX = vehCol->boundingBox.min.x - 0.355f;
if (m_vehEnterType == CAR_DOOR_RF || m_vehEnterType == CAR_DOOR_RR) if (m_vehDoor == CAR_DOOR_RF || m_vehDoor == CAR_DOOR_RR)
vehRelativeExitX = 0.355f + vehCol->boundingBox.max.x; vehRelativeExitX = 0.355f + vehCol->boundingBox.max.x;
if (!foundAPos) { if (!foundAPos) {
@ -6545,19 +6545,19 @@ CPed::KillCharOnFootArmed(CVector &ourPos, CVector &targetPos, CVector &distWith
if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) { if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) {
GoToNearestDoor(vehOfTarget); GoToNearestDoor(vehOfTarget);
} else { } else {
m_vehEnterType = 0; m_vehDoor = 0;
if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) { if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
} else if (m_pedInObjective == vehOfTarget->pPassengers[0]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[0]) {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
} else if (m_pedInObjective == vehOfTarget->pPassengers[1]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[1]) {
m_vehEnterType = CAR_DOOR_LR; m_vehDoor = CAR_DOOR_LR;
} else if (m_pedInObjective == vehOfTarget->pPassengers[2]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[2]) {
m_vehEnterType = CAR_DOOR_RR; m_vehDoor = CAR_DOOR_RR;
} }
// Unused // Unused
// GetPositionToOpenCarDoor(vehOfTarget, m_vehEnterType); // GetPositionToOpenCarDoor(vehOfTarget, m_vehDoor);
SetSeekCar(vehOfTarget, m_vehEnterType); SetSeekCar(vehOfTarget, m_vehDoor);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
} }
} }
@ -6835,19 +6835,19 @@ CPed::KillCharOnFootMelee(CVector &ourPos, CVector &targetPos, CVector &distWith
if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) { if (m_nPedType == PEDTYPE_COP || vehOfTarget->bIsBus) {
GoToNearestDoor(vehOfTarget); GoToNearestDoor(vehOfTarget);
} else { } else {
m_vehEnterType = 0; m_vehDoor = 0;
if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) { if (m_pedInObjective == vehOfTarget->pDriver || vehOfTarget->bIsBus) {
m_vehEnterType = CAR_DOOR_LF; m_vehDoor = CAR_DOOR_LF;
} else if (m_pedInObjective == vehOfTarget->pPassengers[0]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[0]) {
m_vehEnterType = CAR_DOOR_RF; m_vehDoor = CAR_DOOR_RF;
} else if (m_pedInObjective == vehOfTarget->pPassengers[1]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[1]) {
m_vehEnterType = CAR_DOOR_LR; m_vehDoor = CAR_DOOR_LR;
} else if (m_pedInObjective == vehOfTarget->pPassengers[2]) { } else if (m_pedInObjective == vehOfTarget->pPassengers[2]) {
m_vehEnterType = CAR_DOOR_RR; m_vehDoor = CAR_DOOR_RR;
} }
// Unused // Unused
// GetPositionToOpenCarDoor(vehOfTarget, m_vehEnterType); // GetPositionToOpenCarDoor(vehOfTarget, m_vehDoor);
SetSeekCar(vehOfTarget, m_vehEnterType); SetSeekCar(vehOfTarget, m_vehDoor);
SetMoveState(PEDMOVE_RUN); SetMoveState(PEDMOVE_RUN);
} }
} }

View file

@ -2418,7 +2418,7 @@ CPed::SetInvestigateEvent(eEventType event, CVector2D pos, float distanceToCount
SetStoredState(); SetStoredState();
bFindNewNodeAfterStateRestore = false; bFindNewNodeAfterStateRestore = false;
SetPedState(PED_INVESTIGATE); SetPedState(PED_INVESTIGATE);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_chatTimer = CTimer::GetTimeInMilliseconds() + time;
m_eventType = event; m_eventType = event;
m_eventOrThreat = pos; m_eventOrThreat = pos;
m_distanceToCountSeekDone = distanceToCountDone; m_distanceToCountSeekDone = distanceToCountDone;
@ -2442,13 +2442,13 @@ CPed::InvestigateEvent(void)
if (m_nWaitState == WAITSTATE_TURN180) if (m_nWaitState == WAITSTATE_TURN180)
return; return;
if (CTimer::GetTimeInMilliseconds() > m_standardTimer) { if (CTimer::GetTimeInMilliseconds() > m_chatTimer) {
if (m_standardTimer) { if (m_chatTimer) {
if (m_eventType < EVENT_UNK) if (m_eventType < EVENT_UNK)
SetWaitState(WAITSTATE_TURN180, nil); SetWaitState(WAITSTATE_TURN180, nil);
m_standardTimer = 0; m_chatTimer = 0;
} else { } else {
ClearInvestigateEvent(); ClearInvestigateEvent();
} }
@ -2509,7 +2509,7 @@ CPed::InvestigateEvent(void)
Say(SOUND_PED_CHAT_EVENT); Say(SOUND_PED_CHAT_EVENT);
} else { } else {
m_standardTimer = 0; m_chatTimer = 0;
} }
} else if (CTimer::GetTimeInMilliseconds() > m_lookTimer) { } else if (CTimer::GetTimeInMilliseconds() > m_lookTimer) {
@ -2653,7 +2653,7 @@ CPed::ClearInvestigateEvent(void)
animAssoc->flags |= ASSOC_DELETEFADEDOUT; animAssoc->flags |= ASSOC_DELETEFADEDOUT;
} }
if (m_eventType > EVENT_EXPLOSION) if (m_eventType > EVENT_EXPLOSION)
m_standardTimer = CTimer::GetTimeInMilliseconds() + 15000; m_chatTimer = CTimer::GetTimeInMilliseconds() + 15000;
bGonnaInvestigateEvent = false; bGonnaInvestigateEvent = false;
m_pEventEntity = nil; m_pEventEntity = nil;

View file

@ -442,7 +442,7 @@ CMBlur::OverlayRender(RwCamera *cam, RwRaster *raster, RwRGBA color, int32 type,
RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, 80); RwIm2DVertexSetIntRGBA(&Vertex2[3], r, g, b, 80);
RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA); RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA); RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
// TODO(MIAMI): pBufVertCount = 0; pBufVertCount = 0;
}else{ }else{
RwIm2DVertexSetIntRGBA(&Vertex2[0], r*2, g*2, b*2, 30); RwIm2DVertexSetIntRGBA(&Vertex2[0], r*2, g*2, b*2, 30);
RwIm2DVertexSetIntRGBA(&Vertex2[1], r*2, g*2, b*2, 30); RwIm2DVertexSetIntRGBA(&Vertex2[1], r*2, g*2, b*2, 30);

View file

@ -93,7 +93,7 @@ MemoryMgrFree(void *ptr)
void * void *
RwMallocAlign(RwUInt32 size, RwUInt32 align) RwMallocAlign(RwUInt32 size, RwUInt32 align)
{ {
#ifdef FIX_BUGS #if defined (FIX_BUGS) || defined(FIX_BUGS_64)
uintptr ptralign = align-1; uintptr ptralign = align-1;
void *mem = (void *)MemoryMgrMalloc(size + sizeof(uintptr) + ptralign); void *mem = (void *)MemoryMgrMalloc(size + sizeof(uintptr) + ptralign);

View file

@ -255,7 +255,8 @@ SkinGetBonePositionsToTable(RpClump *clump, RwV3d *boneTable)
parent = stack[sp--]; parent = stack[sp--];
else else
parent = i; parent = i;
assert(parent >= 0 && parent < numBones);
//assert(parent >= 0 && parent < numBones);
} }
} }
@ -263,7 +264,7 @@ RpHAnimAnimation*
HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier) HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier)
{ {
int i; int i;
#ifdef FIX_BUGS #if defined FIX_BUGS || defined LIBRW
int numNodes = hier->numNodes*2; // you're supposed to have at least two KFs per node int numNodes = hier->numNodes*2; // you're supposed to have at least two KFs per node
#else #else
int numNodes = hier->numNodes; int numNodes = hier->numNodes;
@ -277,7 +278,7 @@ HAnimAnimationCreateForHierarchy(RpHAnimHierarchy *hier)
frame->q.real = 1.0f; frame->q.real = 1.0f;
frame->q.imag.x = frame->q.imag.y = frame->q.imag.z = 0.0f; frame->q.imag.x = frame->q.imag.y = frame->q.imag.z = 0.0f;
frame->t.x = frame->t.y = frame->t.z = 0.0f; frame->t.x = frame->t.y = frame->t.z = 0.0f;
#ifdef FIX_BUGS #if defined FIX_BUGS || defined LIBRW
// times are subtracted and divided giving NaNs // times are subtracted and divided giving NaNs
// so they can't both be 0 // so they can't both be 0
frame->time = i/hier->numNodes; frame->time = i/hier->numNodes;
@ -483,7 +484,7 @@ CameraSize(RwCamera * camera, RwRect * rect,
RwRaster *zRaster; RwRaster *zRaster;
// BUG: game just changes camera raster's sizes, but this is a hack // BUG: game just changes camera raster's sizes, but this is a hack
#ifdef FIX_BUGS #if defined FIX_BUGS || defined LIBRW
/* /*
* Destroy rasters... * Destroy rasters...
*/ */

View file

@ -113,14 +113,14 @@ wchar*
CText::Get(const char *key) CText::Get(const char *key)
{ {
uint8 result = false; uint8 result = false;
#ifdef FIX_BUGS #if defined (FIX_BUGS) || defined(FIX_BUGS_64)
wchar *outstr = keyArray.Search(key, data.chars, &result); wchar *outstr = keyArray.Search(key, data.chars, &result);
#else #else
wchar *outstr = keyArray.Search(key, &result); wchar *outstr = keyArray.Search(key, &result);
#endif #endif
if (!result && bHasMissionTextOffsets && bIsMissionTextLoaded) if (!result && bHasMissionTextOffsets && bIsMissionTextLoaded)
#ifdef FIX_BUGS #if defined (FIX_BUGS) || defined(FIX_BUGS_64)
outstr = mission_keyArray.Search(key, mission_data.chars, &result); outstr = mission_keyArray.Search(key, mission_data.chars, &result);
#else #else
outstr = mission_keyArray.Search(key, &result); outstr = mission_keyArray.Search(key, &result);
@ -347,7 +347,7 @@ CKeyArray::Unload(void)
void void
CKeyArray::Update(wchar *chars) CKeyArray::Update(wchar *chars)
{ {
#ifndef FIX_BUGS #if !defined(FIX_BUGS) && !defined(FIX_BUGS_64)
int i; int i;
for(i = 0; i < numEntries; i++) for(i = 0; i < numEntries; i++)
entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value); entries[i].value = (wchar*)((uint8*)chars + (uintptr)entries[i].value);
@ -375,7 +375,7 @@ CKeyArray::BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 hi
} }
wchar* wchar*
#ifdef FIX_BUGS #if defined (FIX_BUGS) || defined(FIX_BUGS_64)
CKeyArray::Search(const char *key, wchar *data, uint8 *result) CKeyArray::Search(const char *key, wchar *data, uint8 *result)
#else #else
CKeyArray::Search(const char *key, uint8 *result) CKeyArray::Search(const char *key, uint8 *result)
@ -385,7 +385,7 @@ CKeyArray::Search(const char *key, uint8 *result)
char errstr[25]; char errstr[25];
int i; int i;
#ifdef FIX_BUGS #if defined (FIX_BUGS) || defined(FIX_BUGS_64)
found = BinarySearch(key, entries, 0, numEntries-1); found = BinarySearch(key, entries, 0, numEntries-1);
if (found) { if (found) {
*result = true; *result = true;

View file

@ -7,7 +7,7 @@ void TextCopy(wchar *dst, const wchar *src);
struct CKeyEntry struct CKeyEntry
{ {
#ifdef FIX_BUGS #if defined(FIX_BUGS) || defined(FIX_BUGS_64)
uint32 valueOffset; uint32 valueOffset;
#else #else
wchar *value; wchar *value;
@ -30,7 +30,7 @@ public:
void Unload(void); void Unload(void);
void Update(wchar *chars); void Update(wchar *chars);
CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high); CKeyEntry *BinarySearch(const char *key, CKeyEntry *entries, int16 low, int16 high);
#ifdef FIX_BUGS #if defined (FIX_BUGS) || defined(FIX_BUGS_64)
wchar *Search(const char *key, wchar *data, uint8 *result); wchar *Search(const char *key, wchar *data, uint8 *result);
#else #else
wchar *Search(const char *key, uint8* result); wchar *Search(const char *key, uint8* result);

View file

@ -5822,7 +5822,7 @@ CAutomobile::KnockPedOutCar(eWeaponType weapon, uint16 door, CPed *ped)
if(ped == nil) if(ped == nil)
return; return;
ped->m_vehEnterType = door; ped->m_vehDoor = door;
ped->SetPedState(PED_IDLE); ped->SetPedState(PED_IDLE);
CAnimManager::BlendAnimation(ped->GetClump(), ped->m_animGroup, ANIM_IDLE_STANCE, 100.0f); CAnimManager::BlendAnimation(ped->GetClump(), ped->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
CPed::PedSetOutCarCB(nil, ped); CPed::PedSetOutCarCB(nil, ped);

View file

@ -2609,7 +2609,7 @@ CBike::KnockOffRider(eWeaponType weapon, uint8 direction, CPed *ped, bool bGetBa
ped->SetPedState(PED_IDLE); ped->SetPedState(PED_IDLE);
CAnimManager::BlendAnimation(ped->GetClump(), ped->m_animGroup, ANIM_IDLE_STANCE, 100.0f); CAnimManager::BlendAnimation(ped->GetClump(), ped->m_animGroup, ANIM_IDLE_STANCE, 100.0f);
ped->m_vehEnterType = CAR_DOOR_LF; ped->m_vehDoor = CAR_DOOR_LF;
CPed::PedSetOutCarCB(nil, ped); CPed::PedSetOutCarCB(nil, ped);
ped->SetMoveState(PEDMOVE_STILL); ped->SetMoveState(PEDMOVE_STILL);
if(GetUp().z < 0.0f) if(GetUp().z < 0.0f)

View file

@ -388,7 +388,7 @@ void
CTrain::AddPassenger(CPed *ped) CTrain::AddPassenger(CPed *ped)
{ {
#ifdef GTA_TRAIN #ifdef GTA_TRAIN
int i = ped->m_vehEnterType; int i = ped->m_vehDoor;
if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){ if((i == TRAIN_POS_LEFT_ENTRY || i == TRAIN_POS_MID_ENTRY || i == TRAIN_POS_RIGHT_ENTRY) && pPassengers[i] == nil){
pPassengers[i] = ped; pPassengers[i] = ped;
m_nNumPassengers++; m_nNumPassengers++;

View file

@ -1430,13 +1430,13 @@ CVehicle::ShufflePassengersToMakeSpace(void)
if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) {
pPassengers[2] = pPassengers[1]; pPassengers[2] = pPassengers[1];
pPassengers[1] = nil; pPassengers[1] = nil;
pPassengers[2]->m_vehEnterType = CAR_DOOR_RR; pPassengers[2]->m_vehDoor = CAR_DOOR_RR;
return true; return true;
} }
if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) {
pPassengers[0] = pPassengers[1]; pPassengers[0] = pPassengers[1];
pPassengers[1] = nil; pPassengers[1] = nil;
pPassengers[0]->m_vehEnterType = CAR_DOOR_RF; pPassengers[0]->m_vehDoor = CAR_DOOR_RF;
return true; return true;
} }
return false; return false;
@ -1447,13 +1447,13 @@ CVehicle::ShufflePassengersToMakeSpace(void)
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[2]; pPassengers[1] = pPassengers[2];
pPassengers[2] = nil; pPassengers[2] = nil;
pPassengers[1]->m_vehEnterType = CAR_DOOR_LR; pPassengers[1]->m_vehDoor = CAR_DOOR_LR;
return true; return true;
} }
if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) { if (!pPassengers[0] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RF)) {
pPassengers[0] = pPassengers[2]; pPassengers[0] = pPassengers[2];
pPassengers[2] = nil; pPassengers[2] = nil;
pPassengers[0]->m_vehEnterType = CAR_DOOR_RF; pPassengers[0]->m_vehDoor = CAR_DOOR_RF;
return true; return true;
} }
return false; return false;
@ -1464,13 +1464,13 @@ CVehicle::ShufflePassengersToMakeSpace(void)
if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) { if (!pPassengers[1] && !(m_nGettingInFlags & CAR_DOOR_FLAG_LR)) {
pPassengers[1] = pPassengers[0]; pPassengers[1] = pPassengers[0];
pPassengers[0] = nil; pPassengers[0] = nil;
pPassengers[1]->m_vehEnterType = CAR_DOOR_LR; pPassengers[1]->m_vehDoor = CAR_DOOR_LR;
return true; return true;
} }
if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) { if (!pPassengers[2] && !(m_nGettingInFlags & CAR_DOOR_FLAG_RR)) {
pPassengers[2] = pPassengers[0]; pPassengers[2] = pPassengers[0];
pPassengers[0] = nil; pPassengers[0] = nil;
pPassengers[2]->m_vehEnterType = CAR_DOOR_RR; pPassengers[2]->m_vehDoor = CAR_DOOR_RR;
return true; return true;
} }
return false; return false;