Merge branch 'master' into ps2menu

This commit is contained in:
Fire_Head 2020-06-29 09:37:53 +03:00 committed by GitHub
commit 860f75d66c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
145 changed files with 15893 additions and 12764 deletions

15
.travis.yml Normal file
View File

@ -0,0 +1,15 @@
language: cpp
os: linux
dist: focal
matrix:
include:
- env: TARGET=release_linux-amd64-librw_gl3_glfw-oal
- env: TARGET=debug_linux-amd64-librw_gl3_glfw-oal
script:
- sudo apt-get update
- sudo apt-get -y install linux-libc-dev libopenal-dev libglew-dev libglfw3-dev libsndfile1-dev libmpg123-dev gcc-8-multilib g++-8-multilib
- mkdir -p "$TRAVIS_BUILD_DIR/build"
- cd "$TRAVIS_BUILD_DIR"
- ./premake5Linux --with-librw gmake2
- cd build
- CC=gcc-8 CXX=g++-8 make config=$TARGET -j4 verbose=1

View File

@ -12,7 +12,7 @@
extern "C" { extern "C" {
#endif // __cplusplus #endif // __cplusplus
#ifndef OPENAL #ifndef AUDIO_OAL
#include <dsound.h> #include <dsound.h>
/* /*
@ -49,13 +49,9 @@ extern "C" {
typedef void (CDECL *LPGETCURRENTVERSION)(LPDWORD major, LPDWORD minor); typedef void (CDECL *LPGETCURRENTVERSION)(LPDWORD major, LPDWORD minor);
#else // OPENAL #else // AUDIO_OAL
#ifndef _WIN32
#include <AL/al.h> #include <AL/al.h>
#include <string.h> #include <string.h>
#else
#include <al.h>
#endif
#ifndef GUID_DEFINED #ifndef GUID_DEFINED
#define GUID_DEFINED #define GUID_DEFINED

2
librw

@ -1 +1 @@
Subproject commit 661feeabf4a4f0a8b0bee23b53ba557a14352d00 Subproject commit 6ff378bb16007ad003b1a71996944a20f2e76556

View File

@ -23,6 +23,22 @@ else
Librw = os.getenv("LIBRW") or "librw" Librw = os.getenv("LIBRW") or "librw"
end end
function getsys(a)
if a == 'windows' then
return 'win'
end
return a
end
function getarch(a)
if a == 'x86_64' then
return 'amd64'
elseif a == 'ARM' then
return 'arm'
end
return a
end
workspace "re3" workspace "re3"
language "C++" language "C++"
configurations { "Debug", "Release" } configurations { "Debug", "Release" }
@ -35,11 +51,16 @@ workspace "re3"
"win-x86-RW33_d3d8-mss", "win-x86-RW33_d3d8-mss",
"win-x86-librw_d3d9-mss", "win-x86-librw_d3d9-mss",
"win-x86-librw_gl3_glfw-mss", "win-x86-librw_gl3_glfw-mss",
"win-x86-RW33_d3d8-oal",
"win-x86-librw_d3d9-oal",
"win-x86-librw_gl3_glfw-oal",
} }
filter { "system:linux" } filter { "system:linux" }
platforms { platforms {
"linux-x86-librw_gl3_glfw-oal", "linux-x86-librw_gl3_glfw-oal",
"linux-amd64-librw_gl3_glfw-oal",
"linux-arm-librw_gl3_glfw-oal",
} }
filter "configurations:Debug" filter "configurations:Debug"
@ -58,6 +79,12 @@ workspace "re3"
filter { "platforms:*x86*" } filter { "platforms:*x86*" }
architecture "x86" architecture "x86"
filter { "platforms:*amd64*" }
architecture "amd64"
filter { "platforms:*arm*" }
architecture "ARM"
filter { "platforms:*librw_d3d9*" } filter { "platforms:*librw_d3d9*" }
defines { "RW_D3D9" } defines { "RW_D3D9" }
if(not _OPTIONS["with-librw"]) then if(not _OPTIONS["with-librw"]) then
@ -68,17 +95,12 @@ workspace "re3"
defines { "RW_GL3" } defines { "RW_GL3" }
includedirs { path.join(_OPTIONS["glfwdir"], "include") } includedirs { path.join(_OPTIONS["glfwdir"], "include") }
includedirs { path.join(_OPTIONS["glewdir"], "include") } includedirs { path.join(_OPTIONS["glewdir"], "include") }
if(not _OPTIONS["with-librw"]) then
libdirs { path.join(Librw, "lib/%{getsys(cfg.system)}-%{getarch(cfg.architecture)}-gl3/%{cfg.buildcfg}") }
end
filter "platforms:win*librw_gl3_glfw*" filter "platforms:win*librw_gl3_glfw*"
defines { "GLEW_STATIC" } defines { "GLEW_STATIC" }
if(not _OPTIONS["with-librw"]) then
libdirs { path.join(Librw, "lib/win-x86-gl3/%{cfg.buildcfg}") }
end
filter "platforms:linux*librw_gl3_glfw*"
if(not _OPTIONS["with-librw"]) then
libdirs { path.join(Librw, "lib/linux-x86-gl3/%{cfg.buildcfg}") }
end
filter {} filter {}
@ -163,12 +185,16 @@ project "re3"
includedirs { "src/weapons" } includedirs { "src/weapons" }
includedirs { "src/extras" } includedirs { "src/extras" }
includedirs { "eax" } includedirs { "eax" }
includedirs { "milessdk/include" }
includedirs { "eax" }
libdirs { "milessdk/lib" }
filter "platforms:*mss"
defines { "AUDIO_MSS" }
includedirs { "milessdk/include" }
libdirs { "milessdk/lib" }
filter "platforms:*oal"
defines { "AUDIO_OAL" }
filter {}
if(os.getenv("GTA_III_RE_DIR")) then if(os.getenv("GTA_III_RE_DIR")) then
setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "") setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "")
end end
@ -180,9 +206,15 @@ project "re3"
characterset ("MBCS") characterset ("MBCS")
targetextension ".exe" targetextension ".exe"
filter "platforms:linux*" filter "platforms:win*oal"
targetextension ".elf" includedirs { "openal-soft/include" }
defines { "OPENAL" } includedirs { "libsndfile/include" }
includedirs { "mpg123/include" }
libdirs { "openal-soft/libs/Win32" }
libdirs { "libsndfile/lib" }
libdirs { "mpg123/lib" }
filter "platforms:linux*oal"
links { "openal", "mpg123", "sndfile", "pthread" } links { "openal", "mpg123", "sndfile", "pthread" }
filter "platforms:*RW33*" filter "platforms:*RW33*"

View File

@ -530,33 +530,36 @@ char const *aRocketStrafeRightAnimations[] = {
"idle_rocket", "idle_rocket",
"walkst_rocket_right", "walkst_rocket_right",
}; };
#define awc(a) ARRAY_SIZE(a), a
const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS] = { const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS] = {
{ "man", "ped", MI_COP, 173, aStdAnimations, aStdAnimDescs }, { "man", "ped", MI_COP, awc(aStdAnimations), aStdAnimDescs },
{ "player", "ped", MI_COP, 5, aPlayerAnimations, aStdAnimDescs }, { "player", "ped", MI_COP, awc(aPlayerAnimations), aStdAnimDescs },
{ "playerrocket", "ped", MI_COP, 5, aPlayerWithRocketAnimations, aStdAnimDescs }, { "playerrocket", "ped", MI_COP, awc(aPlayerWithRocketAnimations), aStdAnimDescs },
{ "player1armed", "ped", MI_COP, 5, aPlayer1ArmedAnimations, aStdAnimDescs }, { "player1armed", "ped", MI_COP, awc(aPlayer1ArmedAnimations), aStdAnimDescs },
{ "player2armed", "ped", MI_COP, 5, aPlayer2ArmedAnimations, aStdAnimDescs }, { "player2armed", "ped", MI_COP, awc(aPlayer2ArmedAnimations), aStdAnimDescs },
{ "playerBBBat", "ped", MI_COP, 5, aPlayerBBBatAnimations, aStdAnimDescs }, { "playerBBBat", "ped", MI_COP, awc(aPlayerBBBatAnimations), aStdAnimDescs },
{ "shuffle", "ped", MI_COP, 4, aShuffleAnimations, aStdAnimDescs }, { "shuffle", "ped", MI_COP, awc(aShuffleAnimations), aStdAnimDescs },
{ "oldman", "ped", MI_COP, 4, aOldAnimations, aStdAnimDescs }, { "oldman", "ped", MI_COP, awc(aOldAnimations), aStdAnimDescs },
{ "gang1", "ped", MI_COP, 4, aGang1Animations, aStdAnimDescs }, { "gang1", "ped", MI_COP, awc(aGang1Animations), aStdAnimDescs },
{ "gang2", "ped", MI_COP, 4, aGang2Animations, aStdAnimDescs }, { "gang2", "ped", MI_COP, awc(aGang2Animations), aStdAnimDescs },
{ "fatman", "ped", MI_COP, 4, aFatAnimations, aStdAnimDescs }, { "fatman", "ped", MI_COP, awc(aFatAnimations), aStdAnimDescs },
{ "oldfatman", "ped", MI_COP, 4, aOldFatAnimations, aStdAnimDescs }, { "oldfatman", "ped", MI_COP, awc(aOldFatAnimations), aStdAnimDescs },
{ "woman", "ped", MI_COP, 4, aStdWomanAnimations, aStdAnimDescs }, { "woman", "ped", MI_COP, awc(aStdWomanAnimations), aStdAnimDescs },
{ "shopping", "ped", MI_COP, 4, aWomanShopAnimations, aStdAnimDescs }, { "shopping", "ped", MI_COP, awc(aWomanShopAnimations), aStdAnimDescs },
{ "busywoman", "ped", MI_COP, 4, aBusyWomanAnimations, aStdAnimDescs }, { "busywoman", "ped", MI_COP, awc(aBusyWomanAnimations), aStdAnimDescs },
{ "sexywoman", "ped", MI_COP, 4, aSexyWomanAnimations, aStdAnimDescs }, { "sexywoman", "ped", MI_COP, awc(aSexyWomanAnimations), aStdAnimDescs },
{ "oldwoman", "ped", MI_COP, 4, aOldWomanAnimations, aStdAnimDescs }, { "oldwoman", "ped", MI_COP, awc(aOldWomanAnimations), aStdAnimDescs },
{ "fatwoman", "ped", MI_COP, 4, aFatWomanAnimations, aStdAnimDescs }, { "fatwoman", "ped", MI_COP, awc(aFatWomanAnimations), aStdAnimDescs },
{ "panicchunky", "ped", MI_COP, 4, aPanicChunkyAnimations, aStdAnimDescs }, { "panicchunky", "ped", MI_COP, awc(aPanicChunkyAnimations), aStdAnimDescs },
{ "playerback", "ped", MI_COP, 5, aPlayerStrafeBackAnimations, aStdAnimDescs }, { "playerback", "ped", MI_COP, awc(aPlayerStrafeBackAnimations), aStdAnimDescs },
{ "playerleft", "ped", MI_COP, 5, aPlayerStrafeLeftAnimations, aStdAnimDescsSide }, { "playerleft", "ped", MI_COP, awc(aPlayerStrafeLeftAnimations), aStdAnimDescsSide },
{ "playerright", "ped", MI_COP, 5, aPlayerStrafeRightAnimations, aStdAnimDescsSide }, { "playerright", "ped", MI_COP, awc(aPlayerStrafeRightAnimations), aStdAnimDescsSide },
{ "rocketback", "ped", MI_COP, 5, aRocketStrafeBackAnimations, aStdAnimDescs }, { "rocketback", "ped", MI_COP, awc(aRocketStrafeBackAnimations), aStdAnimDescs },
{ "rocketleft", "ped", MI_COP, 5, aRocketStrafeLeftAnimations, aStdAnimDescsSide }, { "rocketleft", "ped", MI_COP, awc(aRocketStrafeLeftAnimations), aStdAnimDescsSide },
{ "rocketright", "ped", MI_COP, 5, aRocketStrafeRightAnimations, aStdAnimDescsSide }, { "rocketright", "ped", MI_COP, awc(aRocketStrafeRightAnimations), aStdAnimDescsSide },
}; };
#undef awc
void void
CAnimManager::Initialise(void) CAnimManager::Initialise(void)

View File

@ -230,7 +230,7 @@ CCutsceneMgr::LoadCutsceneData(const char *szCutsceneName)
pPlayerPed->m_pWanted->ClearQdCrimes(); pPlayerPed->m_pWanted->ClearQdCrimes();
pPlayerPed->bIsVisible = false; pPlayerPed->bIsVisible = false;
pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina; pPlayerPed->m_fCurrentStamina = pPlayerPed->m_fMaxStamina;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_80; CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true); CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(true);
} }
@ -365,7 +365,7 @@ CCutsceneMgr::DeleteCutsceneData(void)
ms_loaded = false; ms_loaded = false;
FindPlayerPed()->bIsVisible = true; FindPlayerPed()->bIsVisible = true;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_80; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CUTSCENE);
CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false); CWorld::Players[CWorld::PlayerInFocus].MakePlayerSafe(false);
if (CGeneral::faststricmp(ms_cutsceneName, "end")) { if (CGeneral::faststricmp(ms_cutsceneName, "end")) {

View File

@ -70,36 +70,36 @@ cAudioManager::GetCollisionOneShotRatio(int32 a, float b) const
case SURFACE_DEFAULT: case SURFACE_DEFAULT:
case SURFACE_TARMAC: case SURFACE_TARMAC:
case SURFACE_PAVEMENT: case SURFACE_PAVEMENT:
case SURFACE_STONE: case SURFACE_STEEP_CLIFF:
case SURFACE_BOLLARD: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break; case SURFACE_TRANSPARENT_STONE: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break;
case SURFACE_GRASS: case SURFACE_GRASS:
case SURFACE_LOOSE30: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; case SURFACE_CARDBOARDBOX: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
case SURFACE_DIRT: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; case SURFACE_GRAVEL: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
case SURFACE_DIRTTRACK: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break; case SURFACE_MUD_DRY: result = GetCollisionRatio(b, 0.f, 2.f, 2.f); break;
case SURFACE_METAL6: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break; case SURFACE_CAR: result = GetCollisionRatio(b, 6.f, 50.f, 44.f); break;
case SURFACE_GLASS: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break; case SURFACE_GLASS: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
case SURFACE_SCAFFOLD: case SURFACE_TRANSPARENT_CLOTH:
case SURFACE_STEEL: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break; case SURFACE_THICK_METAL_PLATE: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break;
case SURFACE_METAL_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break; case SURFACE_GARAGE_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break;
case SURFACE_BILLBOARD: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break; case SURFACE_CAR_PANEL: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break;
case SURFACE_METAL_POLE: case SURFACE_SCAFFOLD_POLE:
case SURFACE_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break; case SURFACE_METAL_GATE: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
case SURFACE_STREET_LIGHT: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break; case SURFACE_LAMP_POST: result = GetCollisionRatio(b, 1.f, 10.f, 9.f); break;
case SURFACE_METAL14: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break; case SURFACE_FIRE_HYDRANT: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break;
case SURFACE_METAL15: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break; case SURFACE_GIRDER: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break;
case SURFACE_METAL_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break; case SURFACE_METAL_CHAIN_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); break;
case SURFACE_FLESH: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break; case SURFACE_PED: result = GetCollisionRatio(b, 0.f, 20.f, 20.f); break;
case SURFACE_SAND: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; case SURFACE_SAND: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
case SURFACE_PUDDLE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; case SURFACE_WATER: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
case SURFACE_WOOD: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break; case SURFACE_WOOD_CRATES: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break;
case SURFACE_WOOD_BOX: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break; case SURFACE_WOOD_BENCH: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break;
case SURFACE_WOOD_PLANK: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break; case SURFACE_WOOD_SOLID: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break;
case SURFACE_TIRE: case SURFACE_RUBBER:
case SURFACE_RUBBER29: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break; case SURFACE_WHEELBASE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
case SURFACE_HARD24: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break; case SURFACE_PLASTIC: result = GetCollisionRatio(b, 0.1f, 4.f, 3.9f); break;
case SURFACE_HEDGE: result = GetCollisionRatio(b, 0.f, 0.5f, 0.5f); break; case SURFACE_HEDGE: result = GetCollisionRatio(b, 0.f, 0.5f, 0.5f); break;
case SURFACE_METAL27: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break; case SURFACE_CONTAINER: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break;
case SURFACE_METAL28: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break; case SURFACE_NEWS_VENDOR: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break;
default: result = 0.f; break; default: result = 0.f; break;
} }
@ -130,18 +130,18 @@ cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollisio
m_sQueueSample.m_nSampleIndex = SFX_RAIN; m_sQueueSample.m_nSampleIndex = SFX_RAIN;
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000; m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
vol = 50.f * ratio; vol = 50.f * ratio;
} else if(surface1 == SURFACE_PUDDLE || surface2 == SURFACE_PUDDLE) { } else if(surface1 == SURFACE_WATER || surface2 == SURFACE_WATER) {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f); ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP; m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000; m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
vol = 30.f * ratio; vol = 30.f * ratio;
} else if(surface1 == SURFACE_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK || } else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY ||
surface2 == SURFACE_DIRTTRACK || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) { surface2 == SURFACE_MUD_DRY || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f); ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID; m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000; m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
vol = 50.f * ratio; vol = 50.f * ratio;
} else if(surface1 == SURFACE_FLESH || surface2 == SURFACE_FLESH) { } else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
return 0; return 0;
} else { } else {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f); ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
@ -240,9 +240,9 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
s2 = col.m_bSurface2; s2 = col.m_bSurface2;
} }
ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1); ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1);
if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio /= 4.0f; if(s1 == SURFACE_CAR && s2 == SURFACE_PED) ratio /= 4.0f;
if(s1 == SURFACE_METAL6 && ratio < 0.6f) { if(s1 == SURFACE_CAR && ratio < 0.6f) {
s1 = SURFACE_BILLBOARD; s1 = SURFACE_CAR_PANEL;
ratio = Min(1.f, 2.f * ratio); ratio = Min(1.f, 2.f * ratio);
} }
emittingVol = 40.f * ratio; emittingVol = 40.f * ratio;
@ -290,13 +290,13 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
} }
switch(s1) { switch(s1) {
case SURFACE_GLASS: m_sQueueSample.m_nFrequency = 13500; break; case SURFACE_GLASS: m_sQueueSample.m_nFrequency = 13500; break;
case SURFACE_METAL15: m_sQueueSample.m_nFrequency = 8819; break; case SURFACE_GIRDER: m_sQueueSample.m_nFrequency = 8819; break;
case SURFACE_PUDDLE: case SURFACE_WATER:
m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency =
2 * SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); 2 * SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
break; break;
case SURFACE_TIRE: m_sQueueSample.m_nFrequency = 6000; break; case SURFACE_RUBBER: m_sQueueSample.m_nFrequency = 6000; break;
case SURFACE_HARD24: m_sQueueSample.m_nFrequency = 8000; break; case SURFACE_PLASTIC: m_sQueueSample.m_nFrequency = 8000; break;
default: default:
m_sQueueSample.m_nFrequency = m_sQueueSample.m_nFrequency =
SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex); SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);

8861
src/audio/AudioLogic.cpp Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -75,7 +75,18 @@ public:
uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS]; uint8 m_nCommentsInBank[NUM_PED_COMMENTS_BANKS];
uint8 m_nActiveBank; uint8 m_nActiveBank;
cPedComments(); cPedComments()
{
for (int i = 0; i < NUM_PED_COMMENTS_SLOTS; i++)
for (int j = 0; j < NUM_PED_COMMENTS_BANKS; j++) {
m_asPedComments[j][i].m_nProcess = -1;
m_nIndexMap[j][i] = NUM_PED_COMMENTS_SLOTS;
}
for (int i = 0; i < NUM_PED_COMMENTS_BANKS; i++)
m_nCommentsInBank[i] = 0;
m_nActiveBank = 0;
}
void Add(tPedComment *com); void Add(tPedComment *com);
void Process(); void Process();
}; };
@ -202,11 +213,11 @@ public:
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; } float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; }
int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; } int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; }
int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; } int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; }
bool IsMissionAudioPlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; } bool IsMissionAudioSamplePlaying() const { return m_sMissionAudio.m_nPlayStatus == 1; }
// "Should" be in alphabetic order, except "getXTalkSfx" // "Should" be in alphabetic order, except "getXTalkSfx"
void AddDetailsToRequestedOrderList(uint8 sample); void AddDetailsToRequestedOrderList(uint8 sample);
void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 unk1, void AddPlayerCarSample(uint8 emittingVolume, int32 freq, uint32 sample, uint8 bank,
uint8 counter, bool notLooping); uint8 counter, bool notLooping);
void AddReflectionsToRequestedQueue(); void AddReflectionsToRequestedQueue();
void AddReleasingSounds(); void AddReleasingSounds();
@ -222,11 +233,10 @@ public:
float speedMultiplier) const; float speedMultiplier) const;
int32 ComputePan(float, CVector *); int32 ComputePan(float, CVector *);
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const; uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
int32 CreateEntity(int32 type, void *entity); int32 CreateEntity(eAudioType type, void *entity);
void DestroyAllGameCreatedEntities(); void DestroyAllGameCreatedEntities();
void DestroyEntity(int32 id); void DestroyEntity(int32 id);
void DoJumboVolOffset() const;
void DoPoliceRadioCrackle(); void DoPoliceRadioCrackle();
// functions returning talk sfx, // functions returning talk sfx,
@ -318,7 +328,7 @@ public:
float GetCollisionRatio(float a, float b, float c, float d) const; float GetCollisionRatio(float a, float b, float c, float d) const;
float GetDistanceSquared(const CVector &v) const; float GetDistanceSquared(const CVector &v) const;
int32 GetJumboTaxiFreq() const; int32 GetJumboTaxiFreq() const;
bool GetMissionAudioLoadingStatus() const; uint8 GetMissionAudioLoadingStatus() const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const; int8 GetMissionScriptPoliceAudioPlayingStatus() const;
uint8 GetNum3DProvidersAvailable() const; uint8 GetNum3DProvidersAvailable() const;
int32 GetPedCommentSfx(CPed *ped, int32 sound); int32 GetPedCommentSfx(CPed *ped, int32 sound);
@ -348,7 +358,7 @@ public:
void PostInitialiseGameSpecificSetup(); void PostInitialiseGameSpecificSetup();
void PostTerminateGameSpecificShutdown(); void PostTerminateGameSpecificShutdown();
void PreInitialiseGameSpecificSetup() const; void PreInitialiseGameSpecificSetup() const;
void PreloadMissionAudio(const char *name); void PreloadMissionAudio(Const char *name);
void PreTerminateGameSpecificShutdown(); void PreTerminateGameSpecificShutdown();
/// processX - main logic of adding new sounds /// processX - main logic of adding new sounds
void ProcessActiveQueues(); void ProcessActiveQueues();
@ -410,7 +420,7 @@ public:
void ProcessVehicleOneShots(cVehicleParams *params); void ProcessVehicleOneShots(cVehicleParams *params);
bool ProcessVehicleReverseWarning(cVehicleParams *params); bool ProcessVehicleReverseWarning(cVehicleParams *params);
bool ProcessVehicleRoadNoise(cVehicleParams *params); bool ProcessVehicleRoadNoise(cVehicleParams *params);
void ProcessVehicleSirenOrAlarm(cVehicleParams *params); bool ProcessVehicleSirenOrAlarm(cVehicleParams *params);
void ProcessVehicleSkidding(cVehicleParams *params); void ProcessVehicleSkidding(cVehicleParams *params);
void ProcessWaterCannon(int32); void ProcessWaterCannon(int32);
void ProcessWeather(int32 id); void ProcessWeather(int32 id);
@ -464,11 +474,11 @@ public:
bool UsesSiren(int32 model) const; bool UsesSiren(int32 model) const;
bool UsesSirenSwitching(int32 model) const; bool UsesSirenSwitching(int32 model) const;
#ifdef GTA_PC
// only used in pc // only used in pc
void AdjustSamplesVolume(); void AdjustSamplesVolume();
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist); uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
#endif
void DebugShit();
}; };
#ifdef AUDIO_MSS #ifdef AUDIO_MSS

View File

@ -350,42 +350,52 @@ enum eSfxSample : uint32
SFX_RADIO_CLICK, SFX_RADIO_CLICK,
SFX_INFO, SFX_INFO,
// bank 1
SFX_CAR_ACCEL_1, SFX_CAR_ACCEL_1,
SFX_CAR_AFTER_ACCEL_1, SFX_CAR_AFTER_ACCEL_1,
SFX_CAR_FINGER_OFF_ACCEL_1, SFX_CAR_FINGER_OFF_ACCEL_1,
// bank 2
SFX_CAR_ACCEL_2, SFX_CAR_ACCEL_2,
SFX_CAR_AFTER_ACCEL_2, SFX_CAR_AFTER_ACCEL_2,
SFX_CAR_FINGER_OFF_ACCEL_2, SFX_CAR_FINGER_OFF_ACCEL_2,
// bank 3
SFX_CAR_ACCEL_3, SFX_CAR_ACCEL_3,
SFX_CAR_AFTER_ACCEL_3, SFX_CAR_AFTER_ACCEL_3,
SFX_CAR_FINGER_OFF_ACCEL_3, SFX_CAR_FINGER_OFF_ACCEL_3,
// bank 4
SFX_CAR_ACCEL_4, SFX_CAR_ACCEL_4,
SFX_CAR_AFTER_ACCEL_4, SFX_CAR_AFTER_ACCEL_4,
SFX_CAR_FINGER_OFF_ACCEL_4, SFX_CAR_FINGER_OFF_ACCEL_4,
// bank 5
SFX_CAR_ACCEL_5, SFX_CAR_ACCEL_5,
SFX_CAR_AFTER_ACCEL_5, SFX_CAR_AFTER_ACCEL_5,
SFX_CAR_FINGER_OFF_ACCEL_5, SFX_CAR_FINGER_OFF_ACCEL_5,
// bank 6
SFX_CAR_ACCEL_6, SFX_CAR_ACCEL_6,
SFX_CAR_AFTER_ACCEL_6, SFX_CAR_AFTER_ACCEL_6,
SFX_CAR_FINGER_OFF_ACCEL_6, SFX_CAR_FINGER_OFF_ACCEL_6,
// bank 7
SFX_CAR_ACCEL_7, SFX_CAR_ACCEL_7,
SFX_CAR_AFTER_ACCEL_7, SFX_CAR_AFTER_ACCEL_7,
SFX_CAR_FINGER_OFF_ACCEL_7, SFX_CAR_FINGER_OFF_ACCEL_7,
// bank 8
SFX_CAR_ACCEL_8, SFX_CAR_ACCEL_8,
SFX_CAR_AFTER_ACCEL_8, SFX_CAR_AFTER_ACCEL_8,
SFX_CAR_FINGER_OFF_ACCEL_8, SFX_CAR_FINGER_OFF_ACCEL_8,
// bank 9
SFX_CAR_ACCEL_9, SFX_CAR_ACCEL_9,
SFX_CAR_AFTER_ACCEL_9, SFX_CAR_AFTER_ACCEL_9,
SFX_CAR_FINGER_OFF_ACCEL_9, SFX_CAR_FINGER_OFF_ACCEL_9,
// bank 10
SFX_PAGE_CHANGE_AND_BACK_LEFT, SFX_PAGE_CHANGE_AND_BACK_LEFT,
SFX_PAGE_CHANGE_AND_BACK_RIGHT, SFX_PAGE_CHANGE_AND_BACK_RIGHT,
SFX_HIGHLIGHT_LEFT, SFX_HIGHLIGHT_LEFT,
@ -402,64 +412,142 @@ enum eSfxSample : uint32
SFX_NOISE_BURST_3, SFX_NOISE_BURST_3,
SFX_ERROR_LEFT, SFX_ERROR_LEFT,
SFX_ERROR_RIGHT, SFX_ERROR_RIGHT,
// bank 11
SFX_TRAIN_STATION_AMBIENCE_LOOP, SFX_TRAIN_STATION_AMBIENCE_LOOP,
SFX_TRAIN_STATION_ANNOUNCE, SFX_TRAIN_STATION_ANNOUNCE,
// bank 12
SFX_CLUB_1, SFX_CLUB_1,
// bank 13
SFX_CLUB_2, SFX_CLUB_2,
// bank 14
SFX_CLUB_3, SFX_CLUB_3,
// bank 15
SFX_CLUB_4, SFX_CLUB_4,
// bank 16
SFX_CLUB_5, SFX_CLUB_5,
// bank 17
SFX_CLUB_6, SFX_CLUB_6,
// bank 18
SFX_CLUB_7, SFX_CLUB_7,
// bank 19
SFX_CLUB_8, SFX_CLUB_8,
// bank 20
SFX_CLUB_9, SFX_CLUB_9,
// bank 21
SFX_CLUB_10, SFX_CLUB_10,
// bank 22
SFX_CLUB_11, SFX_CLUB_11,
// bank 23
SFX_CLUB_12, SFX_CLUB_12,
// bank 24
SFX_CLUB_RAGGA, SFX_CLUB_RAGGA,
// bank 25
SFX_STRIP_CLUB_1, SFX_STRIP_CLUB_1,
// bank 26
SFX_STRIP_CLUB_2, SFX_STRIP_CLUB_2,
// bank 27
SFX_WORKSHOP_1, SFX_WORKSHOP_1,
// bank 28
SFX_PIANO_BAR_1, SFX_PIANO_BAR_1,
// bank 29
SFX_SAWMILL_LOOP, SFX_SAWMILL_LOOP,
SFX_SAWMILL_CUT_WOOD, SFX_SAWMILL_CUT_WOOD,
// bank 30
SFX_DOG_FOOD_FACTORY, SFX_DOG_FOOD_FACTORY,
// bank 31
SFX_LAUNDERETTE_LOOP, SFX_LAUNDERETTE_LOOP,
SFX_LAUNDERETTE_SONG_LOOP, SFX_LAUNDERETTE_SONG_LOOP,
// bank 32
SFX_RESTAURANT_CHINATOWN, SFX_RESTAURANT_CHINATOWN,
// bank 33
SFX_RESTAURANT_ITALY, SFX_RESTAURANT_ITALY,
// bank 34
SFX_RESTAURANT_GENERIC_1, SFX_RESTAURANT_GENERIC_1,
// bank 35
SFX_RESTAURANT_GENERIC_2, SFX_RESTAURANT_GENERIC_2,
// bank 36
SFX_AIRPORT_ANNOUNCEMENT_1, SFX_AIRPORT_ANNOUNCEMENT_1,
SFX_AIRPORT_ANNOUNCEMENT_2, SFX_AIRPORT_ANNOUNCEMENT_2,
SFX_AIRPORT_ANNOUNCEMENT_3, SFX_AIRPORT_ANNOUNCEMENT_3,
SFX_AIRPORT_ANNOUNCEMENT_4, SFX_AIRPORT_ANNOUNCEMENT_4,
// bank 37
SFX_SHOP_LOOP, SFX_SHOP_LOOP,
SFX_SHOP_TILL_1, SFX_SHOP_TILL_1,
SFX_SHOP_TILL_2, SFX_SHOP_TILL_2,
// bank 38
SFX_CINEMA_BASS_1, SFX_CINEMA_BASS_1,
SFX_CINEMA_BASS_2, SFX_CINEMA_BASS_2,
SFX_CINEMA_BASS_3, SFX_CINEMA_BASS_3,
// bank 39
SFX_DOCKS_FOGHORN, SFX_DOCKS_FOGHORN,
// bank 40
SFX_HOME_1, SFX_HOME_1,
SFX_HOME_2, SFX_HOME_2,
SFX_HOME_3, SFX_HOME_3,
SFX_HOME_4, SFX_HOME_4,
SFX_HOME_5, SFX_HOME_5,
// bank 41
SFX_PORN_1_LOOP, SFX_PORN_1_LOOP,
SFX_PORN_1_GROAN_1, SFX_PORN_1_GROAN_1,
SFX_PORN_1_GROAN_2, SFX_PORN_1_GROAN_2,
// bank 42
SFX_PORN_2_LOOP, SFX_PORN_2_LOOP,
SFX_PORN_2_GROAN_1, SFX_PORN_2_GROAN_1,
SFX_PORN_2_GROAN_2, SFX_PORN_2_GROAN_2,
// bank 43
SFX_PORN_3_LOOP, SFX_PORN_3_LOOP,
SFX_PORN_3_GROAN_1, SFX_PORN_3_GROAN_1,
SFX_PORN_3_GROAN_2, SFX_PORN_3_GROAN_2,
// bank 44
SFX_POLICE_BALL_1, SFX_POLICE_BALL_1,
// bank 45
SFX_BANK_ALARM_1, SFX_BANK_ALARM_1,
// bank 46
SFX_RAVE_INDUSTRIAL, SFX_RAVE_INDUSTRIAL,
// bank 47
SFX_RAVE_COMMERCIAL, SFX_RAVE_COMMERCIAL,
// bank 48
SFX_RAVE_SUBURBAN, SFX_RAVE_SUBURBAN,
// bank 49
SFX_RAVE_COMMERCIAL_2, SFX_RAVE_COMMERCIAL_2,
// unused banks 50-58 // unused banks 50-58
@ -473,6 +561,7 @@ enum eSfxSample : uint32
SFX_CLUB_1_8, SFX_CLUB_1_8,
SFX_CLUB_1_9, SFX_CLUB_1_9,
// bank 59
SFX_EXPLOSION_1, SFX_EXPLOSION_1,
SFX_BRIDGE_OPEN_WARNING, SFX_BRIDGE_OPEN_WARNING,

View File

@ -7,7 +7,7 @@
void void
cAudioScriptObject::Reset() cAudioScriptObject::Reset()
{ {
AudioId = SCRSOUND_INVALID; AudioId = SCRIPT_SOUND_INVALID;
Posn = CVector(0.0f, 0.0f, 0.0f); Posn = CVector(0.0f, 0.0f, 0.0f);
AudioEntity = AEHANDLE_NONE; AudioEntity = AEHANDLE_NONE;
} }

View File

@ -1,135 +1,5 @@
#pragma once #pragma once
enum
{
SCRSOUND_TEST_1,
_SCRSOUND_UNK_1,
_SCRSOUND_UNK_2,
_SCRSOUND_UNK_3,
_SCRSOUND_CLUB_1_S,
_SCRSOUND_CLUB_1_L,
_SCRSOUND_CLUB_2_S,
_SCRSOUND_CLUB_2_L,
_SCRSOUND_CLUB_3_S,
_SCRSOUND_CLUB_3_L,
_SCRSOUND_CLUB_4_S,
_SCRSOUND_CLUB_4_L,
_SCRSOUND_CLUB_5_S,
_SCRSOUND_CLUB_5_L,
_SCRSOUND_CLUB_6_S,
_SCRSOUND_CLUB_6_L,
_SCRSOUND_CLUB_7_S,
_SCRSOUND_CLUB_7_L,
_SCRSOUND_CLUB_8_S,
_SCRSOUND_CLUB_8_L,
_SCRSOUND_CLUB_9_S,
_SCRSOUND_CLUB_9_L,
_SCRSOUND_CLUB_10_S,
_SCRSOUND_CLUB_10_L,
_SCRSOUND_CLUB_11_S,
_SCRSOUND_CLUB_11_L,
_SCRSOUND_CLUB_12_S,
_SCRSOUND_CLUB_12_L,
_SCRSOUND_CLUB_RAGGA_S,
_SCRSOUND_CLUB_RAGGA_L,
SCRSOUND_STRIP_CLUB_LOOP_1_S,
_SCRSOUND_STRIP_CLUB_LOOP_1_L,
SCRSOUND_STRIP_CLUB_LOOP_2_S,
_SCRSOUND_STRIP_CLUB_LOOP_2_L,
_SCRSOUND_SFX_WORKSHOP_1,
_SCRSOUND_SFX_WORKSHOP_2,
_SCRSOUND_SAWMILL_LOOP_S,
SCRSOUND_SAWMILL_LOOP_L,
_SCRSOUND_DOG_FOOD_FACTORY_S,
_SCRSOUND_DOG_FOOD_FACTORY_L,
_SCRSOUND_LAUNDERETTE_1,
_SCRSOUND_LAUNDERETTE_2,
_SCRSOUND_RESTAURANT_CHINATOWN_S,
_SCRSOUND_RESTAURANT_CHINATOWN_L,
_SCRSOUND_RESTAURANT_ITALY_S,
_SCRSOUND_RESTAURANT_ITALY_L,
_SCRSOUND_RESTAURANT_GENERIC_1_S,
_SCRSOUND_RESTAURANT_GENERIC_1_L,
_SCRSOUND_RESTAURANT_GENERIC_2_S,
_SCRSOUND_RESTAURANT_GENERIC_2_L,
_SCRSOUND_AIRPORT_ANNOUNCEMENT_S,
_SCRSOUND_AIRPORT_ANNOUNCEMENT_L,
_SCRSOUND_SHOP_LOOP_1,
_SCRSOUND_SHOP_LOOP_2,
_SCRSOUND_CINEMA_S,
_SCRSOUND_CINEMA_L,
_SCRSOUND_DOCKS_FOGHORN_S,
_SCRSOUND_DOCKS_FOGHORN_L,
_SCRSOUND_HOME_S,
_SCRSOUND_HOME_L,
_SCRSOUND_PIANO_BAR,
_SCRSOUND_CLUB,
SCRSOUND_PORN_CINEMA_1_S,
_SCRSOUND_PORN_CINEMA_1_L,
SCRSOUND_PORN_CINEMA_2_S,
_SCRSOUND_PORN_CINEMA_2_L,
SCRSOUND_PORN_CINEMA_3_S,
_SCRSOUND_PORN_CINEMA_3_L,
_SCRSOUND_BANK_ALARM_LOOP_S,
SCRSOUND_BANK_ALARM_LOOP_L,
_SCRSOUND_POLICE_BALL_LOOP_S,
SCRSOUND_POLICE_BALL_LOOP_L,
_SCRSOUND_RAVE_LOOP_INDUSTRIAL_S,
SCRSOUND_RAVE_LOOP_INDUSTRIAL_L,
_SCRSOUND_UNK_74,
_SCRSOUND_UNK_75,
_SCRSOUND_POLICE_CELL_BEATING_LOOP_S,
SCRSOUND_POLICE_CELL_BEATING_LOOP_L,
SCRSOUND_INJURED_PED_MALE_OUCH_S,
SCRSOUND_INJURED_PED_MALE_OUCH_L,
SCRSOUND_INJURED_PED_FEMALE_OUCH_S,
SCRSOUND_INJURED_PED_FEMALE_OUCH_L,
SCRSOUND_EVIDENCE_PICKUP,
SCRSOUND_UNLOAD_GOLD,
_SCRSOUND_RAVE_INDUSTRIAL_S,
_SCRSOUND_RAVE_INDUSTRIAL_L,
_SCRSOUND_RAVE_COMMERCIAL_S,
_SCRSOUND_RAVE_COMMERCIAL_L,
_SCRSOUND_RAVE_SUBURBAN_S,
_SCRSOUND_RAVE_SUBURBAN_L,
_SCRSOUND_GROAN_S,
_SCRSOUND_GROAN_L,
SCRSOUND_GATE_START_CLUNK,
SCRSOUND_GATE_STOP_CLUNK,
SCRSOUND_PART_MISSION_COMPLETE,
SCRSOUND_CHUNKY_RUN_SHOUT,
SCRSOUND_SECURITY_GUARD_RUN_AWAY_SHOUT,
SCRSOUND_RACE_START_1,
SCRSOUND_RACE_START_2,
SCRSOUND_RACE_START_3,
SCRSOUND_RACE_START_GO,
SCRSOUND_SWAT_PED_SHOUT,
SCRSOUND_PRETEND_FIRE_LOOP,
SCRSOUND_AMMUNATION_CHAT_1,
SCRSOUND_AMMUNATION_CHAT_2,
SCRSOUND_AMMUNATION_CHAT_3,
_SCRSOUND_BULLET_WALL_1,
_SCRSOUND_BULLET_WALL_2,
_SCRSOUND_BULLET_WALL_3,
_SCRSOUND_UNK_109,
_SCRSOUND_GLASSFX2_1,
_SCRSOUND_GLASSFX2_2,
_SCRSOUND_PHONE_RING,
_SCRSOUND_UNK_113,
_SCRSOUND_GLASS_SMASH_1,
_SCRSOUND_GLASS_SMASH_2,
_SCRSOUND_GLASS_CRACK,
_SCRSOUND_GLASS_SHARD,
_SCRSOUND_WOODEN_BOX_SMASH,
_SCRSOUND_CARDBOARD_BOX_SMASH,
_SCRSOUND_COL_CAR,
_SCRSOUND_TYRE_BUMP,
_SCRSOUND_BULLET_SHELL_HIT_GROUND_1,
_SCRSOUND_BULLET_SHELL_HIT_GROUND_2,
TOTAL_SCRSOUNDS,
SCRSOUND_INVALID
};
class cAudioScriptObject class cAudioScriptObject
{ {
public: public:

View File

@ -29,7 +29,7 @@ cDMAudio::Service(void)
} }
int32 int32
cDMAudio::CreateEntity(int32 type, void *UID) cDMAudio::CreateEntity(eAudioType type, void *UID)
{ {
return AudioManager.CreateEntity(type, (CPhysical *)UID); return AudioManager.CreateEntity(type, (CPhysical *)UID);
} }
@ -88,7 +88,7 @@ cDMAudio::SetEffectsFadeVol(uint8 volume)
uint8 vol = volume; uint8 vol = volume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
AudioManager.SetEffectsFadeVolume(vol); AudioManager.SetEffectsFadeVol(vol);
} }
void void
@ -97,7 +97,7 @@ cDMAudio::SetMusicFadeVol(uint8 volume)
uint8 vol = volume; uint8 vol = volume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME; if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
AudioManager.SetMusicFadeVolume(vol); AudioManager.SetMusicFadeVol(vol);
} }
uint8 uint8
@ -296,7 +296,7 @@ cDMAudio::StopCutSceneMusic(void)
} }
void void
cDMAudio::PreloadMissionAudio(char *missionAudio) cDMAudio::PreloadMissionAudio(Const char *missionAudio)
{ {
AudioManager.PreloadMissionAudio(missionAudio); AudioManager.PreloadMissionAudio(missionAudio);
} }

View File

@ -20,7 +20,7 @@ public:
void Terminate(void); void Terminate(void);
void Service(void); void Service(void);
int32 CreateEntity(int32 type, void *UID); int32 CreateEntity(eAudioType type, void *UID);
void DestroyEntity(int32 audioEntity); void DestroyEntity(int32 audioEntity);
void SetEntityStatus(int32 audioEntity, uint8 status); void SetEntityStatus(int32 audioEntity, uint8 status);
void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume); void PlayOneShot(int32 audioEntity, uint16 oneShot, float volume);
@ -77,7 +77,7 @@ public:
void PlayPreloadedCutSceneMusic(void); void PlayPreloadedCutSceneMusic(void);
void StopCutSceneMusic(void); void StopCutSceneMusic(void);
void PreloadMissionAudio(char *missionAudio); void PreloadMissionAudio(Const char *missionAudio);
uint8 GetMissionAudioLoadingStatus(void); uint8 GetMissionAudioLoadingStatus(void);
void SetMissionAudioLocation(float x, float y, float z); void SetMissionAudioLocation(float x, float y, float z);
void PlayLoadedMissionAudio(void); void PlayLoadedMissionAudio(void);

View File

@ -21,8 +21,6 @@ int32 gNumRetunePresses;
int32 gRetuneCounter; int32 gRetuneCounter;
bool bHasStarted; bool bHasStarted;
const int maxVolume = 127;
cMusicManager::cMusicManager() cMusicManager::cMusicManager()
{ {
m_bIsInitialised = false; m_bIsInitialised = false;
@ -303,14 +301,14 @@ cMusicManager::GetRadioInCar(void)
CVehicle *veh = FindPlayerVehicle(); CVehicle *veh = FindPlayerVehicle();
if (veh != nil){ if (veh != nil){
if (UsesPoliceRadio(veh)) { if (UsesPoliceRadio(veh)) {
if (m_nRadioInCar == NO_STREAMED_SOUND || CReplay::IsPlayingBack() && AudioManager.m_nUserPause) if (m_nRadioInCar == NO_STREAMED_SOUND || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
return POLICE_RADIO; return POLICE_RADIO;
return m_nRadioInCar; return m_nRadioInCar;
} else return veh->m_nRadioStation; } else return veh->m_nRadioStation;
} }
} }
if (m_nRadioInCar == NO_STREAMED_SOUND || CReplay::IsPlayingBack() && AudioManager.m_nUserPause) if (m_nRadioInCar == NO_STREAMED_SOUND || (CReplay::IsPlayingBack() && AudioManager.m_nUserPause == 0))
return RADIO_OFF; return RADIO_OFF;
return m_nRadioInCar; return m_nRadioInCar;
} }
@ -375,7 +373,7 @@ cMusicManager::Service()
if (!m_bIsInitialised || m_bDisabled) return; if (!m_bIsInitialised || m_bDisabled) return;
if (m_nMusicMode == MUSICMODE_CUTSCENE) { if (m_nMusicMode == MUSICMODE_CUTSCENE) {
SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0); SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0);
return; return;
} }
@ -528,7 +526,7 @@ cMusicManager::ServiceGameMode()
} else if (dist >= 100.0f) { } else if (dist >= 100.0f) {
int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f); int8 volume = ((45.0f - (Sqrt(dist) - 10.0f)) / 45.0f * 100.0f);
int8 pan; int8 pan;
if (AudioManager.IsMissionAudioPlaying()) if (AudioManager.IsMissionAudioSamplePlaying())
volume /= 4; volume /= 4;
if (volume != 0) { if (volume != 0) {
CVector trVec; CVector trVec;
@ -540,7 +538,7 @@ cMusicManager::ServiceGameMode()
if (gRetuneCounter) if (gRetuneCounter)
volume /= 4; volume /= 4;
SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0); SampleManager.SetStreamedVolumeAndPan(volume, pan, 0, 0);
} else if (AudioManager.IsMissionAudioPlaying()) { } else if (AudioManager.IsMissionAudioSamplePlaying()) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
} else if (gRetuneCounter) { } else if (gRetuneCounter) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
@ -548,7 +546,7 @@ cMusicManager::ServiceGameMode()
SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0); SampleManager.SetStreamedVolumeAndPan(100, 63, 0, 0);
} }
} }
} else if (AudioManager.IsMissionAudioPlaying()) { } else if (AudioManager.IsMissionAudioSamplePlaying()) {
SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0); SampleManager.SetStreamedVolumeAndPan(25, 63, 0, 0);
nFramesSinceCutsceneEnded = 0; nFramesSinceCutsceneEnded = 0;
} else { } else {
@ -676,7 +674,7 @@ cMusicManager::PreloadCutSceneMusic(uint8 track)
while (SampleManager.IsStreamPlaying(0)) while (SampleManager.IsStreamPlaying(0))
SampleManager.StopStreamedFile(0); SampleManager.StopStreamedFile(0);
SampleManager.PreloadStreamedFile(track, 0); SampleManager.PreloadStreamedFile(track, 0);
SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 0); SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 0);
m_nCurrentStreamedSound = track; m_nCurrentStreamedSound = track;
} }
} }
@ -834,7 +832,7 @@ cMusicManager::ServiceAnnouncement()
SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0); SampleManager.SetStreamedVolumeAndPan(0, 63, 0, 0);
if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) { if (SampleManager.StartStreamedFile(m_nAnnouncement, 0, 0)) {
SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0); SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0);
m_bAnnouncementInProgress = true; m_bAnnouncementInProgress = true;
m_nPreviousStreamedSound = m_nCurrentStreamedSound; m_nPreviousStreamedSound = m_nCurrentStreamedSound;
m_nCurrentStreamedSound = m_nAnnouncement; m_nCurrentStreamedSound = m_nAnnouncement;
@ -907,7 +905,7 @@ cMusicManager::ChangeRadioChannel()
return false; return false;
if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0)) if (!SampleManager.StartStreamedFile(m_nCurrentStreamedSound, GetTrackStartPos(m_nCurrentStreamedSound), 0))
return false; return false;
SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioPlaying() ? 25 : 100, 63, 0, 0); SampleManager.SetStreamedVolumeAndPan(AudioManager.IsMissionAudioSamplePlaying() ? 25 : 100, 63, 0, 0);
} }
return true; return true;
} }

View File

@ -14,7 +14,6 @@
#include "Zones.h" #include "Zones.h"
#include "sampman.h" #include "sampman.h"
const int maxVolume = 127;
const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples); const int channels = ARRAY_SIZE(cAudioManager::m_asActiveSamples);
const int policeChannel = channels + 1; const int policeChannel = channels + 1;
@ -225,7 +224,7 @@ cAudioManager::ServicePoliceRadioChannel(int32 wantedLevel)
} }
} else if (!SampleManager.GetChannelUsedFlag(policeChannel)) { } else if (!SampleManager.GetChannelUsedFlag(policeChannel)) {
SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1); SampleManager.PreloadStreamedFile(g_nMissionAudioSfx, 1);
SampleManager.SetStreamedVolumeAndPan(maxVolume, 63, 1, 1); SampleManager.SetStreamedVolumeAndPan(MAX_VOLUME, 63, 1, 1);
SampleManager.StartPreloadedStreamedFile(1); SampleManager.StartPreloadedStreamedFile(1);
g_nMissionAudioPlayingStatus = 1; g_nMissionAudioPlayingStatus = 1;
bMissionAudioPhysicalPlayingStatus = 0; bMissionAudioPhysicalPlayingStatus = 0;

View File

@ -238,18 +238,18 @@ enum AudioEntityHandle {
enum eAudioType : int32 enum eAudioType : int32
{ {
AUDIOTYPE_PHYSICAL = 0, AUDIOTYPE_PHYSICAL = 0,
AUDIOTYPE_EXPLOSION = 1, AUDIOTYPE_EXPLOSION,
AUDIOTYPE_FIRE = 2, AUDIOTYPE_FIRE,
AUDIOTYPE_WEATHER = 3, AUDIOTYPE_WEATHER,
AUDIOTYPE_CRANE = 4, AUDIOTYPE_CRANE,
AUDIOTYPE_SCRIPTOBJECT = 5, AUDIOTYPE_SCRIPTOBJECT,
AUDIOTYPE_BRIDGE = 6, AUDIOTYPE_BRIDGE,
AUDIOTYPE_COLLISION = 7, AUDIOTYPE_COLLISION,
AUDIOTYPE_FRONTEND = 8, AUDIOTYPE_FRONTEND,
AUDIOTYPE_PROJECTILE = 9, AUDIOTYPE_PROJECTILE,
AUDIOTYPE_GARAGE = 10, AUDIOTYPE_GARAGE,
AUDIOTYPE_FIREHYDRANT = 11, AUDIOTYPE_FIREHYDRANT,
AUDIOTYPE_WATERCANNON = 12, AUDIOTYPE_WATERCANNON,
AUDIOTYPE_POLICERADIO = 13, AUDIOTYPE_POLICERADIO,
TOTAL_AUDIO_TYPES = 14, TOTAL_AUDIO_TYPES,
}; };

View File

@ -35,15 +35,13 @@
*/ */
ALDeviceList::ALDeviceList() ALDeviceList::ALDeviceList()
{ {
ALDEVICEINFO ALDeviceInfo;
char *devices; char *devices;
int index; int index;
const char *defaultDeviceName; const char *defaultDeviceName;
const char *actualDeviceName; const char *actualDeviceName;
// DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support // DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support
vDeviceInfo.empty(); nNumOfDevices = 0;
vDeviceInfo.reserve(10);
defaultDeviceIndex = 0; defaultDeviceIndex = 0;
@ -65,51 +63,49 @@ ALDeviceList::ALDeviceList()
// if new actual device name isn't already in the list, then add it... // if new actual device name isn't already in the list, then add it...
actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER); actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
bool bNewName = true; bool bNewName = true;
for (int i = 0; i < GetNumDevices(); i++) { for (unsigned int i = 0; i < GetNumDevices(); i++) {
if (strcmp(GetDeviceName(i), actualDeviceName) == 0) { if (strcmp(GetDeviceName(i), actualDeviceName) == 0) {
bNewName = false; bNewName = false;
} }
} }
if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) { if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO)); ALDEVICEINFO ALDeviceInfo;
ALDeviceInfo.bSelected = true; ALDeviceInfo.bSelected = true;
ALDeviceInfo.strDeviceName.assign(actualDeviceName, strlen(actualDeviceName)); ALDeviceInfo.strDeviceName = actualDeviceName;
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion); alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion);
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion); alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion);
ALDeviceInfo.pvstrExtensions = new std::vector<std::string>;
// Check for ALC Extensions // Check for ALC Extensions
if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE) if (alcIsExtensionPresent(device, "ALC_EXT_CAPTURE") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_CAPTURE"); ALDeviceInfo.Extensions |= ADEXT_EXT_CAPTURE;
if (alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE) if (alcIsExtensionPresent(device, "ALC_EXT_EFX") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_EFX"); ALDeviceInfo.Extensions |= ADEXT_EXT_EFX;
// Check for AL Extensions // Check for AL Extensions
if (alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE) if (alIsExtensionPresent("AL_EXT_OFFSET") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_OFFSET"); ALDeviceInfo.Extensions |= ADEXT_EXT_OFFSET;
if (alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE) if (alIsExtensionPresent("AL_EXT_LINEAR_DISTANCE") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_LINEAR_DISTANCE"); ALDeviceInfo.Extensions |= ADEXT_EXT_LINEAR_DISTANCE;
if (alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE) if (alIsExtensionPresent("AL_EXT_EXPONENT_DISTANCE") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_EXPONENT_DISTANCE"); ALDeviceInfo.Extensions |= ADEXT_EXT_EXPONENT_DISTANCE;
if (alIsExtensionPresent("EAX2.0") == AL_TRUE) if (alIsExtensionPresent("EAX2.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX2.0"); ALDeviceInfo.Extensions |= ADEXT_EAX2;
if (alIsExtensionPresent("EAX3.0") == AL_TRUE) if (alIsExtensionPresent("EAX3.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX3.0"); ALDeviceInfo.Extensions |= ADEXT_EAX3;
if (alIsExtensionPresent("EAX4.0") == AL_TRUE) if (alIsExtensionPresent("EAX4.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX4.0"); ALDeviceInfo.Extensions |= ADEXT_EAX4;
if (alIsExtensionPresent("EAX5.0") == AL_TRUE) if (alIsExtensionPresent("EAX5.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX5.0"); ALDeviceInfo.Extensions |= ADEXT_EAX5;
if (alIsExtensionPresent("EAX-RAM") == AL_TRUE) if (alIsExtensionPresent("EAX-RAM") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX-RAM"); ALDeviceInfo.Extensions |= ADEXT_EAX_RAM;
// Get Source Count // Get Source Count
ALDeviceInfo.uiSourceCount = GetMaxNumSources(); ALDeviceInfo.uiSourceCount = GetMaxNumSources();
vDeviceInfo.push_back(ALDeviceInfo); aDeviceInfo[nNumOfDevices++] = ALDeviceInfo;
} }
alcMakeContextCurrent(NULL); alcMakeContextCurrent(NULL);
alcDestroyContext(context); alcDestroyContext(context);
@ -129,31 +125,23 @@ ALDeviceList::ALDeviceList()
*/ */
ALDeviceList::~ALDeviceList() ALDeviceList::~ALDeviceList()
{ {
for (unsigned int i = 0; i < vDeviceInfo.size(); i++) {
if (vDeviceInfo[i].pvstrExtensions) {
vDeviceInfo[i].pvstrExtensions->empty();
delete vDeviceInfo[i].pvstrExtensions;
}
}
vDeviceInfo.empty();
} }
/* /*
* Returns the number of devices in the complete device list * Returns the number of devices in the complete device list
*/ */
int ALDeviceList::GetNumDevices() unsigned int ALDeviceList::GetNumDevices()
{ {
return (int)vDeviceInfo.size(); return nNumOfDevices;
} }
/* /*
* Returns the device name at an index in the complete device list * Returns the device name at an index in the complete device list
*/ */
char * ALDeviceList::GetDeviceName(int index) const char * ALDeviceList::GetDeviceName(unsigned int index)
{ {
if (index < GetNumDevices()) if (index < GetNumDevices())
return (char *)vDeviceInfo[index].strDeviceName.c_str(); return aDeviceInfo[index].strDeviceName;
else else
return NULL; return NULL;
} }
@ -161,13 +149,13 @@ char * ALDeviceList::GetDeviceName(int index)
/* /*
* Returns the major and minor version numbers for a device at a specified index in the complete list * Returns the major and minor version numbers for a device at a specified index in the complete list
*/ */
void ALDeviceList::GetDeviceVersion(int index, int *major, int *minor) void ALDeviceList::GetDeviceVersion(unsigned int index, int *major, int *minor)
{ {
if (index < GetNumDevices()) { if (index < GetNumDevices()) {
if (major) if (major)
*major = vDeviceInfo[index].iMajorVersion; *major = aDeviceInfo[index].iMajorVersion;
if (minor) if (minor)
*minor = vDeviceInfo[index].iMinorVersion; *minor = aDeviceInfo[index].iMinorVersion;
} }
return; return;
} }
@ -175,10 +163,10 @@ void ALDeviceList::GetDeviceVersion(int index, int *major, int *minor)
/* /*
* Returns the maximum number of Sources that can be generate on the given device * Returns the maximum number of Sources that can be generate on the given device
*/ */
unsigned int ALDeviceList::GetMaxNumSources(int index) unsigned int ALDeviceList::GetMaxNumSources(unsigned int index)
{ {
if (index < GetNumDevices()) if (index < GetNumDevices())
return vDeviceInfo[index].uiSourceCount; return aDeviceInfo[index].uiSourceCount;
else else
return 0; return 0;
} }
@ -186,20 +174,9 @@ unsigned int ALDeviceList::GetMaxNumSources(int index)
/* /*
* Checks if the extension is supported on the given device * Checks if the extension is supported on the given device
*/ */
bool ALDeviceList::IsExtensionSupported(int index, const char *szExtName) bool ALDeviceList::IsExtensionSupported(int index, unsigned short ext)
{ {
bool bReturn = false; return !!(aDeviceInfo[index].Extensions & ext);
if (index < GetNumDevices()) {
for (unsigned int i = 0; i < vDeviceInfo[index].pvstrExtensions->size(); i++) {
if (!_stricmp(vDeviceInfo[index].pvstrExtensions->at(i).c_str(), szExtName)) {
bReturn = true;
break;
}
}
}
return bReturn;
} }
/* /*
@ -216,10 +193,10 @@ int ALDeviceList::GetDefaultDevice()
void ALDeviceList::FilterDevicesMinVer(int major, int minor) void ALDeviceList::FilterDevicesMinVer(int major, int minor)
{ {
int dMajor, dMinor; int dMajor, dMinor;
for (unsigned int i = 0; i < vDeviceInfo.size(); i++) { for (unsigned int i = 0; i < nNumOfDevices; i++) {
GetDeviceVersion(i, &dMajor, &dMinor); GetDeviceVersion(i, &dMajor, &dMinor);
if ((dMajor < major) || ((dMajor == major) && (dMinor < minor))) { if ((dMajor < major) || ((dMajor == major) && (dMinor < minor))) {
vDeviceInfo[i].bSelected = false; aDeviceInfo[i].bSelected = false;
} }
} }
} }
@ -230,10 +207,10 @@ void ALDeviceList::FilterDevicesMinVer(int major, int minor)
void ALDeviceList::FilterDevicesMaxVer(int major, int minor) void ALDeviceList::FilterDevicesMaxVer(int major, int minor)
{ {
int dMajor, dMinor; int dMajor, dMinor;
for (unsigned int i = 0; i < vDeviceInfo.size(); i++) { for (unsigned int i = 0; i < nNumOfDevices; i++) {
GetDeviceVersion(i, &dMajor, &dMinor); GetDeviceVersion(i, &dMajor, &dMinor);
if ((dMajor > major) || ((dMajor == major) && (dMinor > minor))) { if ((dMajor > major) || ((dMajor == major) && (dMinor > minor))) {
vDeviceInfo[i].bSelected = false; aDeviceInfo[i].bSelected = false;
} }
} }
} }
@ -241,20 +218,12 @@ void ALDeviceList::FilterDevicesMaxVer(int major, int minor)
/* /*
* Deselects device which don't support the given extension name * Deselects device which don't support the given extension name
*/ */
void ALDeviceList::FilterDevicesExtension(char *szExtName) void
ALDeviceList::FilterDevicesExtension(unsigned short ext)
{ {
bool bFound; for (unsigned int i = 0; i < nNumOfDevices; i++) {
if (!IsExtensionSupported(i, ext))
for (unsigned int i = 0; i < vDeviceInfo.size(); i++) { aDeviceInfo[i].bSelected = false;
bFound = false;
for (unsigned int j = 0; j < vDeviceInfo[i].pvstrExtensions->size(); j++) {
if (!_stricmp(vDeviceInfo[i].pvstrExtensions->at(j).c_str(), szExtName)) {
bFound = true;
break;
}
}
if (!bFound)
vDeviceInfo[i].bSelected = false;
} }
} }
@ -263,8 +232,8 @@ void ALDeviceList::FilterDevicesExtension(char *szExtName)
*/ */
void ALDeviceList::ResetFilters() void ALDeviceList::ResetFilters()
{ {
for (int i = 0; i < GetNumDevices(); i++) { for (unsigned int i = 0; i < GetNumDevices(); i++) {
vDeviceInfo[i].bSelected = true; aDeviceInfo[i].bSelected = true;
} }
filterIndex = 0; filterIndex = 0;
} }
@ -274,10 +243,10 @@ void ALDeviceList::ResetFilters()
*/ */
int ALDeviceList::GetFirstFilteredDevice() int ALDeviceList::GetFirstFilteredDevice()
{ {
int i; unsigned int i;
for (i = 0; i < GetNumDevices(); i++) { for (i = 0; i < GetNumDevices(); i++) {
if (vDeviceInfo[i].bSelected == true) { if (aDeviceInfo[i].bSelected == true) {
break; break;
} }
} }
@ -290,10 +259,10 @@ int ALDeviceList::GetFirstFilteredDevice()
*/ */
int ALDeviceList::GetNextFilteredDevice() int ALDeviceList::GetNextFilteredDevice()
{ {
int i; unsigned int i;
for (i = filterIndex; i < GetNumDevices(); i++) { for (i = filterIndex; i < GetNumDevices(); i++) {
if (vDeviceInfo[i].bSelected == true) { if (aDeviceInfo[i].bSelected == true) {
break; break;
} }
} }

View File

@ -5,38 +5,58 @@
#ifdef AUDIO_OAL #ifdef AUDIO_OAL
#pragma warning(disable: 4786) //disable warning "identifier was truncated to '255' characters in the browser information" #pragma warning(disable: 4786) //disable warning "identifier was truncated to '255' characters in the browser information"
#include <vector>
#include <string>
typedef struct enum
{ {
std::string strDeviceName; ADEXT_EXT_CAPTURE = (1 << 0),
ADEXT_EXT_EFX = (1 << 1),
ADEXT_EXT_OFFSET = (1 << 2),
ADEXT_EXT_LINEAR_DISTANCE = (1 << 3),
ADEXT_EXT_EXPONENT_DISTANCE = (1 << 4),
ADEXT_EAX2 = (1 << 5),
ADEXT_EAX3 = (1 << 6),
ADEXT_EAX4 = (1 << 7),
ADEXT_EAX5 = (1 << 8),
ADEXT_EAX_RAM = (1 << 9),
};
struct ALDEVICEINFO {
const char *strDeviceName;
int iMajorVersion; int iMajorVersion;
int iMinorVersion; int iMinorVersion;
unsigned int uiSourceCount; unsigned int uiSourceCount;
std::vector<std::string> *pvstrExtensions; unsigned short Extensions;
bool bSelected; bool bSelected;
} ALDEVICEINFO, *LPALDEVICEINFO;
ALDEVICEINFO() : iMajorVersion(0), iMinorVersion(0), uiSourceCount(0), bSelected(false)
{
strDeviceName = NULL;
Extensions = 0;
}
};
typedef ALDEVICEINFO *LPALDEVICEINFO;
class ALDeviceList class ALDeviceList
{ {
private: private:
std::vector<ALDEVICEINFO> vDeviceInfo; ALDEVICEINFO aDeviceInfo[64];
unsigned int nNumOfDevices;
int defaultDeviceIndex; int defaultDeviceIndex;
int filterIndex; int filterIndex;
public: public:
ALDeviceList (); ALDeviceList ();
~ALDeviceList (); ~ALDeviceList ();
int GetNumDevices(); unsigned int GetNumDevices();
char *GetDeviceName(int index); const char *GetDeviceName(unsigned int index);
void GetDeviceVersion(int index, int *major, int *minor); void GetDeviceVersion(unsigned int index, int *major, int *minor);
unsigned int GetMaxNumSources(int index); unsigned int GetMaxNumSources(unsigned int index);
bool IsExtensionSupported(int index, const char *szExtName); bool IsExtensionSupported(int index, unsigned short ext);
int GetDefaultDevice(); int GetDefaultDevice();
void FilterDevicesMinVer(int major, int minor); void FilterDevicesMinVer(int major, int minor);
void FilterDevicesMaxVer(int major, int minor); void FilterDevicesMaxVer(int major, int minor);
void FilterDevicesExtension(char *szExtName); void FilterDevicesExtension(unsigned short ext);
void ResetFilters(); void ResetFilters();
int GetFirstFilteredDevice(); int GetFirstFilteredDevice();
int GetNextFilteredDevice(); int GetNextFilteredDevice();

View File

@ -1,7 +1,7 @@
#include "channel.h" #include "common.h"
#ifdef AUDIO_OAL #ifdef AUDIO_OAL
#include "common.h" #include "channel.h"
#include "sampman.h" #include "sampman.h"
#ifndef _WIN32 #ifndef _WIN32

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include "common.h"
#ifdef AUDIO_OAL #ifdef AUDIO_OAL
#include "oal/oal_utils.h" #include "oal/oal_utils.h"

View File

@ -1,3 +1,4 @@
#include "common.h"
#include "oal_utils.h" #include "oal_utils.h"
#ifdef AUDIO_OAL #ifdef AUDIO_OAL

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include "common.h"
#ifdef AUDIO_OAL #ifdef AUDIO_OAL
#include "eax.h" #include "eax.h"

View File

@ -1,11 +1,9 @@
#include "stream.h" #include "common.h"
#ifdef AUDIO_OAL #ifdef AUDIO_OAL
#include "common.h" #include "stream.h"
#include "sampman.h" #include "sampman.h"
#include <sndfile.h>
#include <mpg123.h>
#ifdef _WIN32 #ifdef _WIN32
typedef long ssize_t; typedef long ssize_t;
#pragma comment( lib, "libsndfile-1.lib" ) #pragma comment( lib, "libsndfile-1.lib" )
@ -13,6 +11,8 @@ typedef long ssize_t;
#else #else
#include "crossplatform.h" #include "crossplatform.h"
#endif #endif
#include <sndfile.h>
#include <mpg123.h>
class CSndFile : public IDecoder class CSndFile : public IDecoder
{ {

View File

@ -1,5 +1,4 @@
#pragma once #pragma once
#include "common.h"
#ifdef AUDIO_OAL #ifdef AUDIO_OAL
#include <AL/al.h> #include <AL/al.h>

View File

@ -3,7 +3,7 @@
#include "AudioSamples.h" #include "AudioSamples.h"
#define MAX_VOLUME 127 #define MAX_VOLUME 127
#define MAX_FREQ 22050 #define MAX_FREQ DIGITALRATE
struct tSample { struct tSample {
int32 nOffset; int32 nOffset;
@ -13,9 +13,83 @@ struct tSample {
int32 nLoopEnd; int32 nLoopEnd;
}; };
#ifdef GTA_PS2
#define PS2BANK(e) e
#else
#define PS2BANK(e) e = SAMPLEBANK_MAIN
#endif // GTA_PS2
enum enum
{ {
SAMPLEBANK_MAIN, SAMPLEBANK_MAIN,
CAR_SAMPLEBANKS_OFFSET,
SAMPLEBANK_CAR_PACARD = CAR_SAMPLEBANKS_OFFSET,
SAMPLEBANK_CAR_PATHFINDER,
SAMPLEBANK_CAR_PORSCHE,
SAMPLEBANK_CAR_SPIDER,
SAMPLEBANK_CAR_MERC,
SAMPLEBANK_CAR_MACKTRUCK,
SAMPLEBANK_CAR_HOTROD,
SAMPLEBANK_CAR_COBRA,
SAMPLEBANK_CAR_NONE,
PS2BANK(SAMPLEBANK_FRONTEND),
PS2BANK(SAMPLEBANK_TRAIN),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_1),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_2),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_3),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_4),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_5),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_6),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_7),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_8),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_9),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_10),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_11),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_12),
PS2BANK(SAMPLEBANK_BUILDING_CLUB_RAGGA),
PS2BANK(SAMPLEBANK_BUILDING_STRIP_CLUB_1),
PS2BANK(SAMPLEBANK_BUILDING_STRIP_CLUB_2),
PS2BANK(SAMPLEBANK_BUILDING_WORKSHOP),
PS2BANK(SAMPLEBANK_BUILDING_PIANO_BAR),
PS2BANK(SAMPLEBANK_BUILDING_SAWMILL),
PS2BANK(SAMPLEBANK_BUILDING_DOG_FOOD_FACTORY),
PS2BANK(SAMPLEBANK_BUILDING_LAUNDERETTE),
PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_CHINATOWN),
PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_ITALY),
PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_1),
PS2BANK(SAMPLEBANK_BUILDING_RESTAURANT_GENERIC_2),
PS2BANK(SAMPLEBANK_BUILDING_AIRPORT),
PS2BANK(SAMPLEBANK_BUILDING_SHOP),
PS2BANK(SAMPLEBANK_BUILDING_CINEMA),
PS2BANK(SAMPLEBANK_BUILDING_DOCKS),
PS2BANK(SAMPLEBANK_BUILDING_HOME),
PS2BANK(SAMPLEBANK_BUILDING_PORN_1),
PS2BANK(SAMPLEBANK_BUILDING_PORN_2),
PS2BANK(SAMPLEBANK_BUILDING_PORN_3),
PS2BANK(SAMPLEBANK_BUILDING_POLICE_BALL),
PS2BANK(SAMPLEBANK_BUILDING_BANK_ALARM),
PS2BANK(SAMPLEBANK_BUILDING_RAVE_INDUSTRIAL),
PS2BANK(SAMPLEBANK_BUILDING_RAVE_COMMERCIAL),
PS2BANK(SAMPLEBANK_BUILDING_RAVE_SUBURBAN),
PS2BANK(SAMPLEBANK_BUILDING_RAVE_COMMERCIAL_2),
PS2BANK(SAMPLEBANK_BUILDING_39),
PS2BANK(SAMPLEBANK_BUILDING_40),
PS2BANK(SAMPLEBANK_BUILDING_41),
PS2BANK(SAMPLEBANK_BUILDING_42),
PS2BANK(SAMPLEBANK_BUILDING_43),
PS2BANK(SAMPLEBANK_BUILDING_44),
PS2BANK(SAMPLEBANK_BUILDING_45),
PS2BANK(SAMPLEBANK_BUILDING_46),
PS2BANK(SAMPLEBANK_BUILDING_47),
PS2BANK(SAMPLEBANK_EXTRAS),
SAMPLEBANK_PED, SAMPLEBANK_PED,
MAX_SAMPLEBANKS, MAX_SAMPLEBANKS,
SAMPLEBANK_INVALID SAMPLEBANK_INVALID

View File

@ -1445,7 +1445,7 @@ cSampleManager::IsSampleBankLoaded(uint8 nBank)
bool bool
cSampleManager::IsPedCommentLoaded(uint32 nComment) cSampleManager::IsPedCommentLoaded(uint32 nComment)
{ {
uint8 slot; int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ ) for ( int32 i = 0; i < _TODOCONST(3); i++ )
{ {
@ -1464,11 +1464,15 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
int32 int32
cSampleManager::_GetPedCommentSlot(uint32 nComment) cSampleManager::_GetPedCommentSlot(uint32 nComment)
{ {
uint8 slot; int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ ) for ( int32 i = 0; i < _TODOCONST(3); i++ )
{ {
slot = nCurrentPedSlot - i - 1; slot = nCurrentPedSlot - i - 1;
#ifdef FIX_BUGS
if (slot < 0)
slot += ARRAY_SIZE(nPedSlotSfx);
#endif
if ( nComment == nPedSlotSfx[slot] ) if ( nComment == nPedSlotSfx[slot] )
return slot; return slot;
} }

View File

@ -174,10 +174,10 @@ add_providers()
} }
if ( alGetEnumValue("AL_EFFECT_EAXREVERB") != 0 if ( alGetEnumValue("AL_EFFECT_EAXREVERB") != 0
|| pDeviceList->IsExtensionSupported(i, "EAX2.0") || pDeviceList->IsExtensionSupported(i, ADEXT_EAX2)
|| pDeviceList->IsExtensionSupported(i, "EAX3.0") || pDeviceList->IsExtensionSupported(i, ADEXT_EAX3)
|| pDeviceList->IsExtensionSupported(i, "EAX4.0") || pDeviceList->IsExtensionSupported(i, ADEXT_EAX4)
|| pDeviceList->IsExtensionSupported(i, "EAX5.0") ) || pDeviceList->IsExtensionSupported(i, ADEXT_EAX5) )
{ {
if ( n < MAXPROVIDERS ) if ( n < MAXPROVIDERS )
{ {
@ -775,7 +775,7 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
{ {
ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
uint8 slot; int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ ) for ( int32 i = 0; i < _TODOCONST(3); i++ )
{ {
@ -795,11 +795,15 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
int32 int32
cSampleManager::_GetPedCommentSlot(uint32 nComment) cSampleManager::_GetPedCommentSlot(uint32 nComment)
{ {
uint8 slot; int8 slot;
for (int32 i = 0; i < _TODOCONST(3); i++) for (int32 i = 0; i < _TODOCONST(3); i++)
{ {
slot = nCurrentPedSlot - i - 1; slot = nCurrentPedSlot - i - 1;
#ifdef FIX_BUGS
if (slot < 0)
slot += ARRAY_SIZE(nPedSlotSfx);
#endif
if (nComment == nPedSlotSfx[slot]) if (nComment == nPedSlotSfx[slot])
return slot; return slot;
} }

View File

@ -1,301 +1,303 @@
#pragma once #pragma once
enum eSound : int16 enum eSound : uint16
{ {
SOUND_CAR_DOOR_CLOSE_BONNET = 0, SOUND_CAR_DOOR_CLOSE_BONNET = 0,
SOUND_CAR_DOOR_CLOSE_BUMPER = 1, SOUND_CAR_DOOR_CLOSE_BUMPER,
SOUND_CAR_DOOR_CLOSE_FRONT_LEFT = 2, SOUND_CAR_DOOR_CLOSE_FRONT_LEFT,
SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT = 3, SOUND_CAR_DOOR_CLOSE_FRONT_RIGHT,
SOUND_CAR_DOOR_CLOSE_BACK_LEFT = 4, SOUND_CAR_DOOR_CLOSE_BACK_LEFT,
SOUND_CAR_DOOR_CLOSE_BACK_RIGHT = 5, SOUND_CAR_DOOR_CLOSE_BACK_RIGHT,
SOUND_CAR_DOOR_OPEN_BONNET = 6, SOUND_CAR_DOOR_OPEN_BONNET,
SOUND_CAR_DOOR_OPEN_BUMPER = 7, SOUND_CAR_DOOR_OPEN_BUMPER,
SOUND_CAR_DOOR_OPEN_FRONT_LEFT = 8, SOUND_CAR_DOOR_OPEN_FRONT_LEFT,
SOUND_CAR_DOOR_OPEN_FRONT_RIGHT = 9, SOUND_CAR_DOOR_OPEN_FRONT_RIGHT,
SOUND_CAR_DOOR_OPEN_BACK_LEFT = 10, SOUND_CAR_DOOR_OPEN_BACK_LEFT,
SOUND_CAR_DOOR_OPEN_BACK_RIGHT = 11, SOUND_CAR_DOOR_OPEN_BACK_RIGHT,
SOUND_CAR_WINDSHIELD_CRACK = 12, SOUND_CAR_WINDSHIELD_CRACK,
SOUND_CAR_JUMP = 13, SOUND_CAR_JUMP,
SOUND_E = 14, SOUND_E,
SOUND_F = 15, SOUND_F,
SOUND_CAR_ENGINE_START = 16, SOUND_CAR_ENGINE_START,
SOUND_CAR_LIGHT_BREAK = 17, SOUND_CAR_LIGHT_BREAK,
SOUND_CAR_HYDRAULIC_1 = 18, SOUND_CAR_HYDRAULIC_1,
SOUND_CAR_HYDRAULIC_2 = 19, SOUND_CAR_HYDRAULIC_2,
SOUND_CAR_HYDRAULIC_3 = 20, SOUND_CAR_HYDRAULIC_3,
SOUND_CAR_JERK = 21, SOUND_CAR_JERK,
SOUND_CAR_SPLASH = 22, SOUND_CAR_SPLASH,
SOUND_17 = 23, SOUND_BOAT_SLOWDOWN,
SOUND_18 = 24, SOUND_TRAIN_DOOR_CLOSE,
SOUND_19 = 25, SOUND_TRAIN_DOOR_OPEN,
SOUND_CAR_TANK_TURRET_ROTATE = 26, SOUND_CAR_TANK_TURRET_ROTATE,
SOUND_CAR_BOMB_TICK = 27, SOUND_CAR_BOMB_TICK,
SOUND_PLANE_ON_GROUND = 28, SOUND_PLANE_ON_GROUND,
SOUND_STEP_START = 29, SOUND_STEP_START,
SOUND_STEP_END = 30, SOUND_STEP_END,
SOUND_FALL_LAND = 31, SOUND_FALL_LAND,
SOUND_FALL_COLLAPSE = 32, SOUND_FALL_COLLAPSE,
SOUND_FIGHT_PUNCH_33 = 33, SOUND_FIGHT_PUNCH_33,
SOUND_FIGHT_KICK_34 = 34, SOUND_FIGHT_KICK_34,
SOUND_FIGHT_HEADBUTT_35 = 35, SOUND_FIGHT_HEADBUTT_35,
SOUND_FIGHT_PUNCH_36 = 36, SOUND_FIGHT_PUNCH_36,
SOUND_FIGHT_PUNCH_37 = 37, SOUND_FIGHT_PUNCH_37,
SOUND_FIGHT_CLOSE_PUNCH_38 = 38, SOUND_FIGHT_CLOSE_PUNCH_38,
SOUND_FIGHT_PUNCH_39 = 39, SOUND_FIGHT_PUNCH_39,
SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40 = 40, SOUND_FIGHT_PUNCH_OR_KICK_BELOW_40,
SOUND_FIGHT_PUNCH_41 = 41, SOUND_FIGHT_PUNCH_41,
SOUND_FIGHT_PUNCH_FROM_BEHIND_42 = 42, SOUND_FIGHT_PUNCH_FROM_BEHIND_42,
SOUND_FIGHT_KNEE_OR_KICK_43 = 43, SOUND_FIGHT_KNEE_OR_KICK_43,
SOUND_FIGHT_KICK_44 = 44, SOUND_FIGHT_KICK_44,
SOUND_2D = 45, SOUND_2D,
SOUND_WEAPON_BAT_ATTACK = 46, SOUND_WEAPON_BAT_ATTACK,
SOUND_WEAPON_SHOT_FIRED = 47, SOUND_WEAPON_SHOT_FIRED,
SOUND_WEAPON_RELOAD = 48, SOUND_WEAPON_RELOAD,
SOUND_WEAPON_AK47_BULLET_ECHO = 49, SOUND_WEAPON_AK47_BULLET_ECHO,
SOUND_WEAPON_UZI_BULLET_ECHO = 50, SOUND_WEAPON_UZI_BULLET_ECHO,
SOUND_WEAPON_M16_BULLET_ECHO = 51, SOUND_WEAPON_M16_BULLET_ECHO,
SOUND_WEAPON_FLAMETHROWER_FIRE = 52, SOUND_WEAPON_FLAMETHROWER_FIRE,
SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM = 53, SOUND_WEAPON_SNIPER_SHOT_NO_ZOOM,
SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM = 54, SOUND_WEAPON_ROCKET_SHOT_NO_ZOOM,
SOUND_WEAPON_HIT_PED = 55, SOUND_WEAPON_HIT_PED,
SOUND_WEAPON_HIT_VEHICLE = 56, SOUND_WEAPON_HIT_VEHICLE,
SOUND_GARAGE_NO_MONEY = 57, SOUND_GARAGE_NO_MONEY,
SOUND_GARAGE_BAD_VEHICLE = 58, SOUND_GARAGE_BAD_VEHICLE,
SOUND_GARAGE_OPENING = 59, SOUND_GARAGE_OPENING,
SOUND_GARAGE_BOMB_ALREADY_SET = 60, SOUND_GARAGE_BOMB_ALREADY_SET,
SOUND_GARAGE_BOMB1_SET = 61, SOUND_GARAGE_BOMB1_SET,
SOUND_GARAGE_BOMB2_SET = 62, SOUND_GARAGE_BOMB2_SET,
SOUND_GARAGE_BOMB3_SET = 63, SOUND_GARAGE_BOMB3_SET,
SOUND_40 = 64, SOUND_40,
SOUND_41 = 65, SOUND_41,
SOUND_GARAGE_VEHICLE_DECLINED = 66, SOUND_GARAGE_VEHICLE_DECLINED,
SOUND_GARAGE_VEHICLE_ACCEPTED = 67, SOUND_GARAGE_VEHICLE_ACCEPTED,
SOUND_GARAGE_DOOR_CLOSED = 68, SOUND_GARAGE_DOOR_CLOSED,
SOUND_GARAGE_DOOR_OPENED = 69, SOUND_GARAGE_DOOR_OPENED,
SOUND_CRANE_PICKUP = 70, SOUND_CRANE_PICKUP,
SOUND_PICKUP_WEAPON_BOUGHT = 71, SOUND_PICKUP_WEAPON_BOUGHT,
SOUND_PICKUP_WEAPON = 72, SOUND_PICKUP_WEAPON,
SOUND_PICKUP_HEALTH = 73, SOUND_PICKUP_HEALTH,
SOUND_4A = 74, SOUND_PICKUP_ERROR,
SOUND_4B = 75, SOUND_4B,
SOUND_PICKUP_ADRENALINE = 76, SOUND_PICKUP_ADRENALINE,
SOUND_PICKUP_ARMOUR = 77, SOUND_PICKUP_ARMOUR,
SOUND_PICKUP_BONUS = 78, SOUND_PICKUP_BONUS,
SOUND_PICKUP_MONEY = 79, SOUND_PICKUP_MONEY,
SOUND_PICKUP_HIDDEN_PACKAGE = 80, SOUND_PICKUP_HIDDEN_PACKAGE,
SOUND_PICKUP_PACMAN_PILL = 81, SOUND_PICKUP_PACMAN_PILL,
SOUND_PICKUP_PACMAN_PACKAGE = 82, SOUND_PICKUP_PACMAN_PACKAGE,
SOUND_PICKUP_FLOAT_PACKAGE = 83, SOUND_PICKUP_FLOAT_PACKAGE,
SOUND_BOMB_TIMED_ACTIVATED = 84, SOUND_BOMB_TIMED_ACTIVATED,
SOUND_55 = 85, SOUND_55,
SOUND_BOMB_ONIGNITION_ACTIVATED = 86, SOUND_BOMB_ONIGNITION_ACTIVATED,
SOUND_BOMB_TICK = 87, SOUND_BOMB_TICK,
SOUND_RAMPAGE_START = 88, SOUND_RAMPAGE_START,
SOUND_RAMPAGE_ONGOING = 89, SOUND_RAMPAGE_ONGOING,
SOUND_RAMPAGE_PASSED = 90, SOUND_RAMPAGE_PASSED,
SOUND_RAMPAGE_FAILED = 91, SOUND_RAMPAGE_FAILED,
SOUND_RAMPAGE_KILL = 92, SOUND_RAMPAGE_KILL,
SOUND_RAMPAGE_CAR_BLOWN = 93, SOUND_RAMPAGE_CAR_BLOWN,
SOUND_EVIDENCE_PICKUP = 94, SOUND_EVIDENCE_PICKUP,
SOUND_UNLOAD_GOLD = 95, SOUND_UNLOAD_GOLD,
SOUND_PAGER = 96, SOUND_PAGER,
SOUND_PED_DEATH = 97, // 103 in VC SOUND_PED_DEATH,
SOUND_PED_DAMAGE = 98, // 104 in VC SOUND_PED_DAMAGE,
SOUND_PED_HIT = 99, // 105 in VC SOUND_PED_HIT,
SOUND_PED_LAND = 100, // hopefully 106 in VC SOUND_PED_LAND,
SOUND_PED_BULLET_HIT = 101, SOUND_PED_BULLET_HIT,
SOUND_PED_BOMBER = 102, SOUND_PED_BOMBER,
SOUND_PED_BURNING = 103, // 108 in VC SOUND_PED_BURNING,
SOUND_PED_ARREST_FBI = 104, SOUND_PED_ARREST_FBI,
SOUND_PED_ARREST_SWAT = 105, SOUND_PED_ARREST_SWAT,
SOUND_PED_ARREST_COP = 106, SOUND_PED_ARREST_COP,
SOUND_PED_HELI_PLAYER_FOUND = 107, SOUND_PED_HELI_PLAYER_FOUND,
SOUND_PED_HANDS_UP = 108, SOUND_PED_HANDS_UP,
SOUND_PED_HANDS_COWER = 109, SOUND_PED_HANDS_COWER,
SOUND_PED_FLEE_SPRINT = 110, // 120 in VC SOUND_PED_FLEE_SPRINT,
SOUND_PED_CAR_JACKING = 111, SOUND_PED_CAR_JACKING,
SOUND_PED_MUGGING = 112, SOUND_PED_MUGGING,
SOUND_PED_CAR_JACKED = 113, SOUND_PED_CAR_JACKED,
SOUND_PED_ROBBED = 114, SOUND_PED_ROBBED,
SOUND_PED_TAXI_WAIT = 115, // 137 in VC SOUND_PED_TAXI_WAIT,
SOUND_PED_ATTACK = 116, SOUND_PED_ATTACK,
SOUND_PED_DEFEND = 117, SOUND_PED_DEFEND,
SOUND_PED_PURSUIT_ARMY = 118, SOUND_PED_PURSUIT_ARMY,
SOUND_PED_PURSUIT_FBI = 119, SOUND_PED_PURSUIT_FBI,
SOUND_PED_PURSUIT_SWAT = 120, SOUND_PED_PURSUIT_SWAT,
SOUND_PED_PURSUIT_COP = 121, SOUND_PED_PURSUIT_COP,
SOUND_PED_HEALING = 122, SOUND_PED_HEALING,
SOUND_PED_7B = 123, SOUND_PED_7B,
SOUND_PED_LEAVE_VEHICLE = 124, SOUND_PED_LEAVE_VEHICLE,
SOUND_PED_EVADE = 125, // 142 in VC SOUND_PED_EVADE,
SOUND_PED_FLEE_RUN = 126, SOUND_PED_FLEE_RUN,
SOUND_PED_CAR_COLLISION = 127, // 144-145-146 in VC SOUND_PED_CAR_COLLISION,
SOUND_PED_SOLICIT = 128, SOUND_PED_SOLICIT,
SOUND_PED_EXTINGUISHING_FIRE = 129, SOUND_PED_EXTINGUISHING_FIRE,
SOUND_PED_WAIT_DOUBLEBACK = 130, SOUND_PED_WAIT_DOUBLEBACK,
SOUND_PED_CHAT_SEXY = 131, SOUND_PED_CHAT_SEXY,
SOUND_PED_CHAT_EVENT = 132, SOUND_PED_CHAT_EVENT,
SOUND_PED_CHAT = 133, SOUND_PED_CHAT,
SOUND_PED_BODYCAST_HIT = 134, SOUND_PED_BODYCAST_HIT,
SOUND_PED_TAXI_CALL = 135, SOUND_PED_TAXI_CALL,
SOUND_INJURED_PED_MALE_OUCH = 136, SOUND_INJURED_PED_MALE_OUCH,
SOUND_INJURED_PED_FEMALE = 137, SOUND_INJURED_PED_FEMALE,
SOUND_INJURED_PED_MALE_PRISON = 138, SOUND_INJURED_PED_MALE_PRISON,
SOUND_RACE_START_3 = 139, SOUND_RACE_START_3,
SOUND_RACE_START_2 = 140, SOUND_RACE_START_2,
SOUND_RACE_START_1 = 141, SOUND_RACE_START_1,
SOUND_RACE_START_GO = 142, SOUND_RACE_START_GO,
SOUND_SPLASH = 143, SOUND_SPLASH,
SOUND_WATER_FALL = 144, SOUND_WATER_FALL,
SOUND_SPLATTER = 145, SOUND_SPLATTER,
SOUND_CAR_PED_COLLISION = 146, SOUND_CAR_PED_COLLISION,
SOUND_CLOCK_TICK = 147, SOUND_CLOCK_TICK,
SOUND_PART_MISSION_COMPLETE = 148, SOUND_PART_MISSION_COMPLETE,
SOUND_FRONTEND_MENU_STARTING = 149, SOUND_FRONTEND_MENU_STARTING,
SOUND_FRONTEND_MENU_COMPLETED = 150, SOUND_FRONTEND_MENU_NEW_PAGE,
SOUND_FRONTEND_MENU_DENIED = 151, SOUND_FRONTEND_MENU_NAVIGATION,
SOUND_FRONTEND_MENU_SUCCESS = 152, SOUND_FRONTEND_MENU_SETTING_CHANGE,
SOUND_FRONTEND_EXIT = 153, SOUND_FRONTEND_MENU_BACK,
SOUND_FRONTEND_STEREO = 154, SOUND_FRONTEND_STEREO,
SOUND_FRONTEND_MONO = 155, SOUND_FRONTEND_MONO,
SOUND_FRONTEND_AUDIO_TEST = 156, SOUND_FRONTEND_AUDIO_TEST,
SOUND_FRONTEND_FAIL = 157, SOUND_FRONTEND_FAIL,
SOUND_FRONTEND_NO_RADIO = 158, SOUND_FRONTEND_NO_RADIO,
SOUND_FRONTEND_RADIO_CHANGE = 159, SOUND_FRONTEND_RADIO_CHANGE,
SOUND_A0 = 160, SOUND_HUD,
SOUND_AMMUNATION_WELCOME_1 = 161, SOUND_AMMUNATION_WELCOME_1,
SOUND_AMMUNATION_WELCOME_2 = 162, SOUND_AMMUNATION_WELCOME_2,
SOUND_AMMUNATION_WELCOME_3 = 163, SOUND_AMMUNATION_WELCOME_3,
SOUND_LIGHTNING = 164, SOUND_LIGHTNING,
SOUND_A5 = 165, SOUND_A5,
SOUND_TOTAL_SOUNDS = 166, SOUND_TOTAL_SOUNDS,
SOUND_TOTAL_PED_SOUNDS = 167, SOUND_NO_SOUND,
}; };
enum eScriptSounds : int16 { enum eScriptSounds : uint16 {
SCRIPT_SOUND_0 = 0, SCRIPT_SOUND_0 = 0,
SCRIPT_SOUND_1 = 1, SCRIPT_SOUND_1,
SCRIPT_SOUND_2 = 2, SCRIPT_SOUND_2,
SCRIPT_SOUND_3 = 3, SCRIPT_SOUND_3,
SCRIPT_SOUND_PARTY_1_LOOP_S = 4, SCRIPT_SOUND_PARTY_1_LOOP_S,
SCRIPT_SOUND_PARTY_1_LOOP_L = 5, SCRIPT_SOUND_PARTY_1_LOOP_L,
SCRIPT_SOUND_PARTY_2_LOOP_S = 6, SCRIPT_SOUND_PARTY_2_LOOP_S,
SCRIPT_SOUND_PARTY_2_LOOP_L = 7, SCRIPT_SOUND_PARTY_2_LOOP_L,
SCRIPT_SOUND_PARTY_3_LOOP_S = 8, SCRIPT_SOUND_PARTY_3_LOOP_S,
SCRIPT_SOUND_PARTY_3_LOOP_L = 9, SCRIPT_SOUND_PARTY_3_LOOP_L,
SCRIPT_SOUND_PARTY_4_LOOP_S = 10, SCRIPT_SOUND_PARTY_4_LOOP_S,
SCRIPT_SOUND_PARTY_4_LOOP_L = 11, SCRIPT_SOUND_PARTY_4_LOOP_L,
SCRIPT_SOUND_PARTY_5_LOOP_S = 12, SCRIPT_SOUND_PARTY_5_LOOP_S,
SCRIPT_SOUND_PARTY_5_LOOP_L = 13, SCRIPT_SOUND_PARTY_5_LOOP_L,
SCRIPT_SOUND_PARTY_6_LOOP_S = 14, SCRIPT_SOUND_PARTY_6_LOOP_S,
SCRIPT_SOUND_PARTY_6_LOOP_L = 15, SCRIPT_SOUND_PARTY_6_LOOP_L,
SCRIPT_SOUND_PARTY_7_LOOP_S = 16, SCRIPT_SOUND_PARTY_7_LOOP_S,
SCRIPT_SOUND_PARTY_7_LOOP_L = 17, SCRIPT_SOUND_PARTY_7_LOOP_L,
SCRIPT_SOUND_PARTY_8_LOOP_S = 18, SCRIPT_SOUND_PARTY_8_LOOP_S,
SCRIPT_SOUND_PARTY_8_LOOP_L = 19, SCRIPT_SOUND_PARTY_8_LOOP_L,
SCRIPT_SOUND_PARTY_9_LOOP_S = 20, SCRIPT_SOUND_PARTY_9_LOOP_S,
SCRIPT_SOUND_PARTY_9_LOOP_L = 21, SCRIPT_SOUND_PARTY_9_LOOP_L,
SCRIPT_SOUND_PARTY_10_LOOP_S = 22, SCRIPT_SOUND_PARTY_10_LOOP_S,
SCRIPT_SOUND_PARTY_10_LOOP_L = 23, SCRIPT_SOUND_PARTY_10_LOOP_L,
SCRIPT_SOUND_PARTY_11_LOOP_S = 24, SCRIPT_SOUND_PARTY_11_LOOP_S,
SCRIPT_SOUND_PARTY_11_LOOP_L = 25, SCRIPT_SOUND_PARTY_11_LOOP_L,
SCRIPT_SOUND_PARTY_12_LOOP_S = 26, SCRIPT_SOUND_PARTY_12_LOOP_S,
SCRIPT_SOUND_PARTY_12_LOOP_L = 27, SCRIPT_SOUND_PARTY_12_LOOP_L,
SCRIPT_SOUND_PARTY_13_LOOP_S = 28, SCRIPT_SOUND_PARTY_13_LOOP_S,
SCRIPT_SOUND_PARTY_13_LOOP_L = 29, SCRIPT_SOUND_PARTY_13_LOOP_L,
SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S = 30, SCRIPT_SOUND_STRIP_CLUB_LOOP_1_S,
SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L = 31, SCRIPT_SOUND_STRIP_CLUB_LOOP_1_L,
SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S = 32, SCRIPT_SOUND_STRIP_CLUB_LOOP_2_S,
SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L = 33, SCRIPT_SOUND_STRIP_CLUB_LOOP_2_L,
SCRIPT_SOUND_WORK_SHOP_LOOP_S = 34, SCRIPT_SOUND_WORK_SHOP_LOOP_S,
SCRIPT_SOUND_WORK_SHOP_LOOP_L = 35, SCRIPT_SOUND_WORK_SHOP_LOOP_L,
SCRIPT_SOUND_SAWMILL_LOOP_S = 36, SCRIPT_SOUND_SAWMILL_LOOP_S,
SCRIPT_SOUND_SAWMILL_LOOP_L = 37, SCRIPT_SOUND_SAWMILL_LOOP_L,
SCRIPT_SOUND_38 = 38, SCRIPT_SOUND_38,
SCRIPT_SOUND_39 = 39, SCRIPT_SOUND_39,
SCRIPT_SOUND_LAUNDERETTE_LOOP_S = 40, SCRIPT_SOUND_LAUNDERETTE_LOOP_S,
SCRIPT_SOUND_LAUNDERETTE_LOOP_L = 41, SCRIPT_SOUND_LAUNDERETTE_LOOP_L,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_S = 42, SCRIPT_SOUND_CHINATOWN_RESTAURANT_S,
SCRIPT_SOUND_CHINATOWN_RESTAURANT_L = 43, SCRIPT_SOUND_CHINATOWN_RESTAURANT_L,
SCRIPT_SOUND_CIPRIANI_RESAURANT_S = 44, SCRIPT_SOUND_CIPRIANI_RESAURANT_S,
SCRIPT_SOUND_CIPRIANI_RESAURANT_L = 45, SCRIPT_SOUND_CIPRIANI_RESAURANT_L,
SCRIPT_SOUND_46_S = 46, SCRIPT_SOUND_46_S,
SCRIPT_SOUND_47_L = 47, SCRIPT_SOUND_47_L,
SCRIPT_SOUND_MARCO_BISTRO_S = 48, SCRIPT_SOUND_MARCO_BISTRO_S,
SCRIPT_SOUND_MARCO_BISTRO_L = 49, SCRIPT_SOUND_MARCO_BISTRO_L,
SCRIPT_SOUND_AIRPORT_LOOP_S = 50, SCRIPT_SOUND_AIRPORT_LOOP_S,
SCRIPT_SOUND_AIRPORT_LOOP_L = 51, SCRIPT_SOUND_AIRPORT_LOOP_L,
SCRIPT_SOUND_SHOP_LOOP_S = 52, SCRIPT_SOUND_SHOP_LOOP_S,
SCRIPT_SOUND_SHOP_LOOP_L = 53, SCRIPT_SOUND_SHOP_LOOP_L,
SCRIPT_SOUND_CINEMA_LOOP_S = 54, SCRIPT_SOUND_CINEMA_LOOP_S,
SCRIPT_SOUND_CINEMA_LOOP_L = 55, SCRIPT_SOUND_CINEMA_LOOP_L,
SCRIPT_SOUND_DOCKS_LOOP_S = 56, SCRIPT_SOUND_DOCKS_LOOP_S,
SCRIPT_SOUND_DOCKS_LOOP_L = 57, SCRIPT_SOUND_DOCKS_LOOP_L,
SCRIPT_SOUND_HOME_LOOP_S = 58, SCRIPT_SOUND_HOME_LOOP_S,
SCRIPT_SOUND_HOME_LOOP_L = 59, SCRIPT_SOUND_HOME_LOOP_L,
SCRIPT_SOUND_FRANKIE_PIANO = 60, SCRIPT_SOUND_FRANKIE_PIANO,
SCRIPT_SOUND_PARTY_1_LOOP = 61, SCRIPT_SOUND_PARTY_1_LOOP,
SCRIPT_SOUND_PORN_CINEMA_1_S = 62, SCRIPT_SOUND_PORN_CINEMA_1_S,
SCRIPT_SOUND_PORN_CINEMA_1_L = 63, SCRIPT_SOUND_PORN_CINEMA_1_L,
SCRIPT_SOUND_PORN_CINEMA_2_S = 64, SCRIPT_SOUND_PORN_CINEMA_2_S,
SCRIPT_SOUND_PORN_CINEMA_2_L = 65, SCRIPT_SOUND_PORN_CINEMA_2_L,
SCRIPT_SOUND_PORN_CINEMA_3_S = 66, SCRIPT_SOUND_PORN_CINEMA_3_S,
SCRIPT_SOUND_PORN_CINEMA_3_L = 67, SCRIPT_SOUND_PORN_CINEMA_3_L,
SCRIPT_SOUND_BANK_ALARM_LOOP_S = 68, SCRIPT_SOUND_BANK_ALARM_LOOP_S,
SCRIPT_SOUND_BANK_ALARM_LOOP_L = 69, SCRIPT_SOUND_BANK_ALARM_LOOP_L,
SCRIPT_SOUND_POLICE_BALL_LOOP_S = 70, SCRIPT_SOUND_POLICE_BALL_LOOP_S,
SCRIPT_SOUND_POLICE_BALL_LOOP_L = 71, SCRIPT_SOUND_POLICE_BALL_LOOP_L,
SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S = 72, SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_S,
SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L = 73, SCRIPT_SOUND_RAVE_LOOP_INDUSTRIAL_L,
SCRIPT_SOUND_74 = 74, SCRIPT_SOUND_74,
SCRIPT_SOUND_75 = 75, SCRIPT_SOUND_75,
SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S = 76, SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_S,
SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L = 77, SCRIPT_SOUND_POLICE_CELL_BEATING_LOOP_L,
SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S = 78, SCRIPT_SOUND_INJURED_PED_MALE_OUCH_S,
SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L = 79, SCRIPT_SOUND_INJURED_PED_MALE_OUCH_L,
SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S = 80, SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_S,
SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L = 81, SCRIPT_SOUND_INJURED_PED_FEMALE_OUCH_L,
SCRIPT_SOUND_EVIDENCE_PICKUP = 82, SCRIPT_SOUND_EVIDENCE_PICKUP,
SCRIPT_SOUND_UNLOAD_GOLD = 83, SCRIPT_SOUND_UNLOAD_GOLD,
SCRIPT_SOUND_RAVE_1_LOOP_S = 84, SCRIPT_SOUND_RAVE_1_LOOP_S,
SCRIPT_SOUND_RAVE_1_LOOP_L = 85, SCRIPT_SOUND_RAVE_1_LOOP_L,
SCRIPT_SOUND_RAVE_2_LOOP_S = 86, SCRIPT_SOUND_RAVE_2_LOOP_S,
SCRIPT_SOUND_RAVE_2_LOOP_L = 87, SCRIPT_SOUND_RAVE_2_LOOP_L,
SCRIPT_SOUND_RAVE_3_LOOP_S = 88, SCRIPT_SOUND_RAVE_3_LOOP_S,
SCRIPT_SOUND_RAVE_3_LOOP_L = 89, SCRIPT_SOUND_RAVE_3_LOOP_L,
SCRIPT_SOUND_MISTY_SEX_S = 90, SCRIPT_SOUND_MISTY_SEX_S,
SCRIPT_SOUND_MISTY_SEX_L = 91, SCRIPT_SOUND_MISTY_SEX_L,
SCRIPT_SOUND_GATE_START_CLUNK = 92, SCRIPT_SOUND_GATE_START_CLUNK,
SCRIPT_SOUND_GATE_STOP_CLUNK = 93, SCRIPT_SOUND_GATE_STOP_CLUNK,
SCRIPT_SOUND_PART_MISSION_COMPLETE = 94, SCRIPT_SOUND_PART_MISSION_COMPLETE,
SCRIPT_SOUND_CHUNKY_RUN_SHOUT = 95, SCRIPT_SOUND_CHUNKY_RUN_SHOUT,
SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT = 96, SCRIPT_SOUND_SECURITY_GUARD_AWAY_SHOUT,
SCRIPT_SOUND_RACE_START_3 = 97, SCRIPT_SOUND_RACE_START_3,
SCRIPT_SOUND_RACE_START_2 = 98, SCRIPT_SOUND_RACE_START_2,
SCRIPT_SOUND_RACE_START_1 = 99, SCRIPT_SOUND_RACE_START_1,
SCRIPT_SOUND_RACE_START_GO = 100, SCRIPT_SOUND_RACE_START_GO,
SCRIPT_SOUND_SWAT_PED_SHOUT = 101, SCRIPT_SOUND_SWAT_PED_SHOUT,
SCRIPT_SOUND_PRETEND_FIRE_LOOP = 102, SCRIPT_SOUND_PRETEND_FIRE_LOOP,
SCRIPT_SOUND_AMMUNATION_CHAT_1 = 103, SCRIPT_SOUND_AMMUNATION_CHAT_1,
SCRIPT_SOUND_AMMUNATION_CHAT_2 = 104, SCRIPT_SOUND_AMMUNATION_CHAT_2,
SCRIPT_SOUND_AMMUNATION_CHAT_3 = 105, SCRIPT_SOUND_AMMUNATION_CHAT_3,
SCRIPT_SOUND_BULLET_HIT_GROUND_1 = 106, SCRIPT_SOUND_BULLET_HIT_GROUND_1,
SCRIPT_SOUND_BULLET_HIT_GROUND_2 = 107, SCRIPT_SOUND_BULLET_HIT_GROUND_2,
SCRIPT_SOUND_BULLET_HIT_GROUND_3 = 108, SCRIPT_SOUND_BULLET_HIT_GROUND_3,
SCRIPT_SOUND_BULLET_HIT_WATER = 109, //no sound SCRIPT_SOUND_BULLET_HIT_WATER, // no sound
SCRIPT_SOUND_110 = 110, SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_1,
SCRIPT_SOUND_111 = 111, SCRIPT_SOUND_TRAIN_ANNOUNCEMENT_2,
SCRIPT_SOUND_PAYPHONE_RINGING = 112, SCRIPT_SOUND_PAYPHONE_RINGING,
SCRIPT_SOUND_113 = 113, SCRIPT_SOUND_113,
SCRIPT_SOUND_GLASS_BREAK_L = 114, SCRIPT_SOUND_GLASS_BREAK_L,
SCRIPT_SOUND_GLASS_BREAK_S = 115, SCRIPT_SOUND_GLASS_BREAK_S,
SCRIPT_SOUND_GLASS_CRACK = 116, SCRIPT_SOUND_GLASS_CRACK,
SCRIPT_SOUND_GLASS_LIGHT_BREAK = 117, SCRIPT_SOUND_GLASS_LIGHT_BREAK,
SCRIPT_SOUND_BOX_DESTROYED_1 = 118, SCRIPT_SOUND_BOX_DESTROYED_1,
SCRIPT_SOUND_BOX_DESTROYED_2 = 119, SCRIPT_SOUND_BOX_DESTROYED_2,
SCRIPT_SOUND_METAL_COLLISION = 120, SCRIPT_SOUND_METAL_COLLISION,
SCRIPT_SOUND_TIRE_COLLISION = 121, SCRIPT_SOUND_TIRE_COLLISION,
SCRIPT_SOUND_GUNSHELL_DROP = 122, SCRIPT_SOUND_GUNSHELL_DROP,
SCRIPT_SOUND_GUNSHELL_DROP_SOFT = 123, SCRIPT_SOUND_GUNSHELL_DROP_SOFT,
SCRIPT_SOUND_TOTAL,
SCRIPT_SOUND_INVALID,
}; };

View File

@ -463,10 +463,6 @@ CCarCtrl::GenerateOneRandomCar()
directionNextLinkY = pNextLink->GetDirY() * pVehicle->AutoPilot.m_nNextDirection; directionNextLinkY = pNextLink->GetDirY() * pVehicle->AutoPilot.m_nNextDirection;
} }
#else #else
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirX();
float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirY();
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirX();
float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirY();
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo]; CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo]; CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
@ -988,13 +984,15 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
if (pVehicle->GetModelIndex() == MI_RCBANDIT){ if (pVehicle->GetModelIndex() == MI_RCBANDIT){
if (dotVelocity * GAME_SPEED_TO_METERS_PER_SECOND / 2 > distanceUntilHit) if (dotVelocity * GAME_SPEED_TO_METERS_PER_SECOND / 2 > distanceUntilHit)
pPed->SetEvasiveStep(pVehicle, 0); pPed->SetEvasiveStep(pVehicle, 0);
}else if (dotVelocity > 0.3f){ }
if (sideLength - 0.5f < sidewaysDistance) else if (dotVelocity > 0.3f) {
if (sideLength + 0.1f < sidewaysDistance)
pPed->SetEvasiveStep(pVehicle, 0); pPed->SetEvasiveStep(pVehicle, 0);
else else
pPed->SetEvasiveDive(pVehicle, 0); pPed->SetEvasiveDive(pVehicle, 0);
}else{ }
if (sideLength + 0.1f < sidewaysDistance) else if (dotVelocity > 0.1f) {
if (sideLength - 0.5f < sidewaysDistance)
pPed->SetEvasiveStep(pVehicle, 0); pPed->SetEvasiveStep(pVehicle, 0);
else else
pPed->SetEvasiveDive(pVehicle, 0); pPed->SetEvasiveDive(pVehicle, 0);
@ -1023,7 +1021,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
CPlayerPed* pPlayerPed = (CPlayerPed*)pPed; CPlayerPed* pPlayerPed = (CPlayerPed*)pPed;
if (pPlayerPed->IsPlayer() && dotDirection < frontSafe && if (pPlayerPed->IsPlayer() && dotDirection < frontSafe &&
pPlayerPed->IsPedInControl() && pPlayerPed->IsPedInControl() &&
pPlayerPed->m_fMoveSpeed < 0.1f && pPlayerPed->bIsLooking && pPlayerPed->m_fMoveSpeed < 1.0f && !pPlayerPed->bIsLooking &&
CTimer::GetTimeInMilliseconds() > pPlayerPed->m_lookTimer) { CTimer::GetTimeInMilliseconds() > pPlayerPed->m_lookTimer) {
pPlayerPed->AnnoyPlayerPed(false); pPlayerPed->AnnoyPlayerPed(false);
pPlayerPed->SetLookFlag(pVehicle, true); pPlayerPed->SetLookFlag(pVehicle, true);
@ -1647,12 +1645,18 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
if (pVehicle->AutoPilot.m_bStayInFastLane) if (pVehicle->AutoPilot.m_bStayInFastLane)
pVehicle->AutoPilot.m_nNextLane = 0; pVehicle->AutoPilot.m_nNextLane = 0;
CVector positionOnCurrentLinkIncludingLane( CVector positionOnCurrentLinkIncludingLane(
pCurLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY, pCurLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH)
pCurLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX, #ifdef FIX_BUGS
* currentPathLinkForwardY
#endif
,pCurLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f); 0.0f);
CVector positionOnNextLinkIncludingLane( CVector positionOnNextLinkIncludingLane(
pNextLink->GetX() + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY, pNextLink->GetX() + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH)
pNextLink->GetY() - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX, #ifdef FIX_BUGS
* nextPathLinkForwardY
#endif
,pNextLink->GetY() - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f); 0.0f);
float directionCurrentLinkX = pCurLink->GetDirX() * pVehicle->AutoPilot.m_nCurrentDirection; float directionCurrentLinkX = pCurLink->GetDirX() * pVehicle->AutoPilot.m_nCurrentDirection;
float directionCurrentLinkY = pCurLink->GetDirY() * pVehicle->AutoPilot.m_nCurrentDirection; float directionCurrentLinkY = pCurLink->GetDirY() * pVehicle->AutoPilot.m_nCurrentDirection;

View File

@ -83,12 +83,20 @@ CGameLogic::Update()
} }
break; break;
case WBSTATE_WASTED: case WBSTATE_WASTED:
#ifdef MISSION_REPLAY
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) {
#else
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) { if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
#endif
TheCamera.SetFadeColour(200, 200, 200); TheCamera.SetFadeColour(200, 200, 200);
TheCamera.Fade(2.0f, FADE_OUT); TheCamera.Fade(2.0f, FADE_OUT);
} }
#ifdef MISSION_REPLAY
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) {
#else
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) { if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
#endif
pPlayerInfo.m_WBState = WBSTATE_PLAYING; pPlayerInfo.m_WBState = WBSTATE_PLAYING;
if (pPlayerInfo.m_bGetOutOfHospitalFree) { if (pPlayerInfo.m_bGetOutOfHospitalFree) {
pPlayerInfo.m_bGetOutOfHospitalFree = false; pPlayerInfo.m_bGetOutOfHospitalFree = false;
@ -131,11 +139,19 @@ CGameLogic::Update()
} }
break; break;
case WBSTATE_BUSTED: case WBSTATE_BUSTED:
#ifdef MISSION_REPLAY
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) {
#else
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) { if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
#endif
TheCamera.SetFadeColour(0, 0, 0); TheCamera.SetFadeColour(0, 0, 0);
TheCamera.Fade(2.0f, FADE_OUT); TheCamera.Fade(2.0f, FADE_OUT);
} }
#ifdef MISSION_REPLAY
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) {
#else
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) { if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
#endif
pPlayerInfo.m_WBState = WBSTATE_PLAYING; pPlayerInfo.m_WBState = WBSTATE_PLAYING;
int takeMoney; int takeMoney;
@ -203,11 +219,19 @@ CGameLogic::Update()
} }
break; break;
case WBSTATE_FAILED_CRITICAL_MISSION: case WBSTATE_FAILED_CRITICAL_MISSION:
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800 && CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800) { #ifdef MISSION_REPLAY
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > AddExtraDeathDelay() + 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= AddExtraDeathDelay() + 0x800)) {
#else
if ((CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime > 0x800) && (CTimer::GetPreviousTimeInMilliseconds() - pPlayerInfo.m_nWBTime <= 0x800)) {
#endif
TheCamera.SetFadeColour(0, 0, 0); TheCamera.SetFadeColour(0, 0, 0);
TheCamera.Fade(2.0f, FADE_OUT); TheCamera.Fade(2.0f, FADE_OUT);
} }
#ifdef MISSION_REPLAY
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= AddExtraDeathDelay() + 0x1000) {
#else
if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) { if (CTimer::GetTimeInMilliseconds() - pPlayerInfo.m_nWBTime >= 0x1000) {
#endif
pPlayerInfo.m_WBState = WBSTATE_PLAYING; pPlayerInfo.m_WBState = WBSTATE_PLAYING;
if (pPlayerInfo.m_pPed->bInVehicle) { if (pPlayerInfo.m_pPed->bInVehicle) {
CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle; CVehicle *pVehicle = pPlayerInfo.m_pPed->m_pMyVehicle;

View File

@ -1853,7 +1853,14 @@ CVehicle* CStoredCar::RestoreCar()
CStreaming::RequestModel(m_nModelIndex, STREAMFLAGS_DEPENDENCY); CStreaming::RequestModel(m_nModelIndex, STREAMFLAGS_DEPENDENCY);
if (!CStreaming::HasModelLoaded(m_nModelIndex)) if (!CStreaming::HasModelLoaded(m_nModelIndex))
return nil; return nil;
CVehicleModelInfo::SetComponentsToUse(m_nVariationA, m_nVariationB); #ifdef FIX_BUGS
CVehicleModelInfo* pModelInfo = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex);
assert(pModelInfo);
if (pModelInfo->m_numComps != 0)
#endif
{
CVehicleModelInfo::SetComponentsToUse(m_nVariationA, m_nVariationB);
}
#ifdef FIX_BUGS #ifdef FIX_BUGS
CVehicle* pVehicle; CVehicle* pVehicle;
if (CModelInfo::IsBoatModel(m_nModelIndex)) if (CModelInfo::IsBoatModel(m_nModelIndex))

View File

@ -404,11 +404,10 @@ CPathFind::PreparePathData(void)
maxX = 0.0f; maxX = 0.0f;
maxY = 0.0f; maxY = 0.0f;
for(j = 0; j < 12; j++){ for(j = 0; j < 12; j++){
k = i*12 + j; k = m_mapObjects[i]->GetModelIndex()*12 + j;
if(InfoForTileCars[k].type == NodeTypeExtern){ if(InfoForTileCars[k].type == NodeTypeExtern){
numExtern++; numExtern++;
if(InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes > numLanes) numLanes = Max(numLanes, InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes);
numLanes = InfoForTileCars[k].numLeftLanes + InfoForTileCars[k].numRightLanes;
maxX = Max(maxX, Abs(InfoForTileCars[k].x)); maxX = Max(maxX, Abs(InfoForTileCars[k].x));
maxY = Max(maxY, Abs(InfoForTileCars[k].y)); maxY = Max(maxY, Abs(InfoForTileCars[k].y));
}else if(InfoForTileCars[k].type == NodeTypeIntern) }else if(InfoForTileCars[k].type == NodeTypeIntern)
@ -417,7 +416,7 @@ CPathFind::PreparePathData(void)
if(numIntern == 1 && numExtern == 2){ if(numIntern == 1 && numExtern == 2){
if(numLanes < 4){ if(numLanes < 4){
if((i & 7) == 4){ // WHAT? if((i & 7) == 4){ // 1/8 probability
m_objectFlags[i] |= UseInRoadBlock; m_objectFlags[i] |= UseInRoadBlock;
if(maxX > maxY) if(maxX > maxY)
m_objectFlags[i] |= ObjectEastWest; m_objectFlags[i] |= ObjectEastWest;

View File

@ -12,6 +12,7 @@
#include "AudioScriptObject.h" #include "AudioScriptObject.h"
#include "RpAnimBlend.h" #include "RpAnimBlend.h"
#include "AnimBlendAssociation.h" #include "AnimBlendAssociation.h"
#include "soundlist.h"
#ifdef FIX_BUGS #ifdef FIX_BUGS
#include "Replay.h" #include "Replay.h"
#endif #endif
@ -65,7 +66,7 @@ CPhoneInfo::Update(void)
endAssoc->flags &= ~ASSOC_DELETEFADEDOUT; endAssoc->flags &= ~ASSOC_DELETEFADEDOUT;
endAssoc->SetFinishCallback(PhonePutDownCB, player); endAssoc->SetFinishCallback(PhonePutDownCB, player);
} else { } else {
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
if (player->m_nPedState == PED_MAKE_CALL) if (player->m_nPedState == PED_MAKE_CALL)
player->m_nPedState = PED_IDLE; player->m_nPedState = PED_IDLE;
} }
@ -97,7 +98,7 @@ CPhoneInfo::Update(void)
if (scratchTheCabinet) { if (scratchTheCabinet) {
m_aPhones[phoneId].m_pEntity->GetUp().z = (CGeneral::GetRandomNumber() % 1024) / 16000.0f + 1.0f; m_aPhones[phoneId].m_pEntity->GetUp().z = (CGeneral::GetRandomNumber() % 1024) / 16000.0f + 1.0f;
if (!phoneRings) if (!phoneRings)
PlayOneShotScriptObject(_SCRSOUND_PHONE_RING, m_aPhones[phoneId].m_pEntity->GetPosition()); PlayOneShotScriptObject(SCRIPT_SOUND_PAYPHONE_RINGING, m_aPhones[phoneId].m_pEntity->GetPosition());
} else { } else {
m_aPhones[phoneId].m_pEntity->GetUp().z = 1.0f; m_aPhones[phoneId].m_pEntity->GetUp().z = 1.0f;
} }
@ -115,7 +116,7 @@ CPhoneInfo::Update(void)
player->m_fRotationDest = angleToFace; player->m_fRotationDest = angleToFace;
player->SetHeading(angleToFace); player->SetHeading(angleToFace);
player->m_nPedState = PED_MAKE_CALL; player->m_nPedState = PED_MAKE_CALL;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_40; CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PHONE);
TheCamera.SetWideScreenOn(); TheCamera.SetWideScreenOn();
playerInfo->MakePlayerSafe(true); playerInfo->MakePlayerSafe(true);
CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f); CAnimBlendAssociation *phonePickAssoc = CAnimManager::BlendAnimation(player->GetClump(), ASSOCGRP_STD, ANIM_PHONE_IN, 4.0f);
@ -136,7 +137,7 @@ CPhoneInfo::Update(void)
if (scratchTheCabinet) { if (scratchTheCabinet) {
m_aPhones[phoneId].m_pEntity->GetUp().z = (CGeneral::GetRandomNumber() % 1024) / 16000.0f + 1.0f; m_aPhones[phoneId].m_pEntity->GetUp().z = (CGeneral::GetRandomNumber() % 1024) / 16000.0f + 1.0f;
if (!phoneRings) if (!phoneRings)
PlayOneShotScriptObject(_SCRSOUND_PHONE_RING, m_aPhones[phoneId].m_pEntity->GetPosition()); PlayOneShotScriptObject(SCRIPT_SOUND_PAYPHONE_RINGING, m_aPhones[phoneId].m_pEntity->GetPosition());
} else { } else {
m_aPhones[phoneId].m_pEntity->GetUp().z = 1.0f; m_aPhones[phoneId].m_pEntity->GetUp().z = 1.0f;
} }
@ -339,7 +340,7 @@ PhonePutDownCB(CAnimBlendAssociation *assoc, void *arg)
{ {
assoc->flags |= ASSOC_DELETEFADEDOUT; assoc->flags |= ASSOC_DELETEFADEDOUT;
assoc->blendDelta = -1000.0f; assoc->blendDelta = -1000.0f;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_40; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PHONE);
CPed *ped = (CPed*)arg; CPed *ped = (CPed*)arg;
if (assoc->blendAmount > 0.5f) if (assoc->blendAmount > 0.5f)

View File

@ -132,58 +132,58 @@ CRoadBlocks::GenerateRoadBlocks(void)
CColModel *pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel(); CColModel *pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel();
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f; float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
int16 radius = (int16)(fMapObjectRadius / fModelRadius); int16 radius = (int16)(fMapObjectRadius / fModelRadius);
if (radius > 0 && radius < 6) { if (radius >= 6)
CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition(); continue;
float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward()); CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition();
float fOffset = 0.5f * fModelRadius * (float)(radius - 1); float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward());
for (int16 i = 0; i < radius; i++) { float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
uint8 nRoadblockType = fDotProduct < 0.0f; for (int16 i = 0; i < radius; i++) {
if (CGeneral::GetRandomNumber() & 1) { uint8 nRoadblockType = fDotProduct < 0.0f;
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI); if (CGeneral::GetRandomNumber() & 1) {
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + HALFPI);
}
else {
nRoadblockType = !nRoadblockType;
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI);
}
if (ThePaths.m_objectFlags[RoadBlockObjects[nRoadblockNode]] & ObjectEastWest)
offsetMatrix.GetPosition() = CVector(0.0f, i * fModelRadius - fOffset, 0.6f);
else
offsetMatrix.GetPosition() = CVector(i * fModelRadius - fOffset, 0.0f, 0.6f);
CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix;
float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
int16 colliding = 0;
CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
if (!colliding) {
CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE);
pVehicle->SetStatus(STATUS_ABANDONED);
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
pVehicle->m_matrix = vehicleMatrix;
pVehicle->PlaceOnRoadProperly();
pVehicle->bIsStatic = false;
pVehicle->m_matrix.UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->bIsLocked = false;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
pVehicle->AutoPilot.m_nCurrentLane = 0;
pVehicle->AutoPilot.m_nNextLane = 0;
pVehicle->AutoPilot.m_fMaxTrafficSpeed = 0.0f;
pVehicle->AutoPilot.m_nCruiseSpeed = 0.0f;
pVehicle->bExtendedRange = true;
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
pVehicle->m_bSirenOrAlarm = true;
if (pVehicle->GetUp().z > 0.94f) {
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
CWorld::Add(pVehicle);
pVehicle->bCreateRoadBlockPeds = true;
pVehicle->m_nRoadblockType = nRoadblockType;
pVehicle->m_nRoadblockNode = nRoadblockNode;
} }
else { else {
nRoadblockType = !nRoadblockType; delete pVehicle;
offsetMatrix.SetRotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f - HALFPI);
}
if (ThePaths.m_objectFlags[RoadBlockObjects[nRoadblockNode]] & ObjectEastWest)
offsetMatrix.GetPosition() = CVector(0.0f, -fOffset, 0.6f);
else
offsetMatrix.GetPosition() = CVector(-fOffset, 0.0f, 0.6f);
CMatrix vehicleMatrix = mapObject->m_matrix * offsetMatrix;
float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
int16 colliding = 0;
CWorld::FindObjectsKindaColliding(vehicleMatrix.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
if (!colliding) {
CAutomobile *pVehicle = new CAutomobile(vehicleId, RANDOM_VEHICLE);
pVehicle->SetStatus(STATUS_ABANDONED);
// pVehicle->GetHeightAboveRoad(); // called but return value is ignored?
vehicleMatrix.GetPosition().z += fModelRadius - 0.6f;
pVehicle->m_matrix = vehicleMatrix;
pVehicle->PlaceOnRoadProperly();
pVehicle->bIsStatic = false;
pVehicle->m_matrix.UpdateRW();
pVehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->bIsLocked = false;
pVehicle->AutoPilot.m_nCarMission = MISSION_NONE;
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
pVehicle->AutoPilot.m_nCurrentLane = 0;
pVehicle->AutoPilot.m_nNextLane = 0;
pVehicle->AutoPilot.m_fMaxTrafficSpeed = 0.0f;
pVehicle->AutoPilot.m_nCruiseSpeed = 0.0f;
pVehicle->bExtendedRange = true;
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
pVehicle->m_bSirenOrAlarm = true;
if (pVehicle->GetForward().z > 0.94f) {
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
CWorld::Add(pVehicle);
pVehicle->bCreateRoadBlockPeds = true;
pVehicle->m_nRoadblockType = nRoadblockType;
pVehicle->m_nRoadblockNode = nRoadblockNode;
}
else {
delete pVehicle;
}
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -350,6 +350,7 @@ private:
static bool IsPlayerStopped(CPlayerInfo*); static bool IsPlayerStopped(CPlayerInfo*);
static bool IsVehicleStopped(CVehicle*); static bool IsVehicleStopped(CVehicle*);
static void PrintListSizes();
static void ReadObjectNamesFromScript(); static void ReadObjectNamesFromScript();
static void UpdateObjectIndices(); static void UpdateObjectIndices();
static void ReadMultiScriptFileOffsetsFromScript(); static void ReadMultiScriptFileOffsetsFromScript();
@ -372,6 +373,9 @@ private:
friend class CRunningScript; friend class CRunningScript;
friend class CHud; friend class CHud;
friend void CMissionCleanup::Process(); friend void CMissionCleanup::Process();
#ifdef FIX_BUGS
friend void RetryMission(int, int);
#endif
}; };
@ -479,6 +483,15 @@ private:
void CharInAreaCheckCommand(int32, uint32*); void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*); void CarInAreaCheckCommand(int32, uint32*);
#ifdef MISSION_REPLAY
bool CanAllowMissionReplay();
#endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
int CollectParameterForDebug(char* buf, bool& var);
void GetStoredParameterForDebug(char* buf);
#endif
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; } float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype) { bool ThisIsAValidRandomPed(uint32 pedtype) {
@ -502,3 +515,19 @@ private:
} }
} }
}; };
#ifdef MISSION_REPLAY
extern int AllowMissionReplay;
extern uint32 WaitForMissionActivate;
extern uint32 WaitForSave;
extern uint32 MissionStartTime;
extern int missionRetryScriptIndex;
extern bool doingMissionRetry;
uint32 AddExtraDeathDelay();
void RetryMission(int, int);
#endif
#ifdef USE_DEBUG_SCRIPT_LOADER
extern int scriptToLoad;
#endif

View File

@ -1157,7 +1157,38 @@ enum {
COMMAND_CAN_CHAR_SEE_DEAD_CHAR, COMMAND_CAN_CHAR_SEE_DEAD_CHAR,
COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER, COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER,
#ifndef GTA3_1_1_PATCH #ifndef GTA3_1_1_PATCH
COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER COMMAND_SET_THREAT_REACTION_RANGE_MULTIPLIER,
#endif
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
LAST_SCRIPT_COMMAND
#endif #endif
#endif #endif
}; };
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
enum eScriptArgument
{
ARGTYPE_NONE = 0,
ARGTYPE_INT,
ARGTYPE_FLOAT,
ARGTYPE_STRING,
ARGTYPE_LABEL,
ARGTYPE_BOOL,
ARGTYPE_PED_HANDLE,
ARGTYPE_VEHICLE_HANDLE,
ARGTYPE_OBJECT_HANDLE,
ARGTYPE_ANDOR
};
struct tScriptCommandData
{
int id;
const char name[64];
eScriptArgument input[18];
eScriptArgument output[18];
bool cond;
int position;
const char name_override[8];
};
#endif

View File

@ -47,6 +47,12 @@ CAnimViewer::Render(void) {
if (pTarget) { if (pTarget) {
// pTarget->GetPosition() = CVector(0.0f, 0.0f, 0.0f); // pTarget->GetPosition() = CVector(0.0f, 0.0f, 0.0f);
if (pTarget) { if (pTarget) {
#ifdef FIX_BUGS
#ifdef PED_SKIN
if(pTarget->IsPed())
((CPed*)pTarget)->UpdateRpHAnim();
#endif
#endif
pTarget->Render(); pTarget->Render();
CRenderer::RenderOneNonRoad(pTarget); CRenderer::RenderOneNonRoad(pTarget);
} }
@ -67,11 +73,7 @@ CAnimViewer::Initialise(void) {
CReferences::Init(); CReferences::Init();
TheCamera.Init(); TheCamera.Init();
TheCamera.SetRwCamera(Scene.camera); TheCamera.SetRwCamera(Scene.camera);
TheCamera.Cams[TheCamera.ActiveCam].Distance = 5.0f;
// I didn't get which camera og code selects.
for (int i = 0; i < 3; i++) {
TheCamera.Cams[i].Distance = 5.0f;
}
gbModelViewer = true; gbModelViewer = true;
CHud::m_Wants_To_Draw_Hud = false; CHud::m_Wants_To_Draw_Hud = false;
@ -146,30 +148,33 @@ int
LastPedModelId(int modelId) LastPedModelId(int modelId)
{ {
CBaseModelInfo *model; CBaseModelInfo *model;
for (int i = modelId; i >= 0; i--) { for(;;){
model = CModelInfo::GetModelInfo(i); assert(modelId < MODELINFOSIZE);
if (model->GetModelType() == MITYPE_PED) model = CModelInfo::GetModelInfo(modelId);
return i; if (model && model->GetModelType() == MITYPE_PED)
break;
modelId--;
} }
return modelId; return modelId;
} }
int int
LastVehicleModelId(int modelId) FirstCarModelId(int modelId)
{ {
CBaseModelInfo* model; CBaseModelInfo *model;
for (int i = modelId; i >= 0; i--) { for(;;){
model = CModelInfo::GetModelInfo(i); assert(modelId < MODELINFOSIZE);
if (model->GetModelType() == MITYPE_VEHICLE) model = CModelInfo::GetModelInfo(modelId);
return i; if (model && model->GetModelType() == MITYPE_VEHICLE)
break;
modelId++;
} }
return modelId; return modelId;
} }
// It's me that named this.
int int
FindMeAModelID(int modelId, int wantedChange) NextModelId(int modelId, int wantedChange)
{ {
// Max. 2 trials wasn't here, it's me that added it. // Max. 2 trials wasn't here, it's me that added it.
@ -220,7 +225,6 @@ CAnimViewer::Update(void)
AssocGroupId animGroup = ASSOCGRP_STD; AssocGroupId animGroup = ASSOCGRP_STD;
int nextModelId = modelId; int nextModelId = modelId;
CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId); CBaseModelInfo *modelInfo = CModelInfo::GetModelInfo(modelId);
CEntity *newEntity = nil;
if (modelInfo->GetModelType() == MITYPE_PED) { if (modelInfo->GetModelType() == MITYPE_PED) {
int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup; int animGroup = ((CPedModelInfo*)modelInfo)->m_animGroup;
@ -261,40 +265,30 @@ CAnimViewer::Update(void)
if (modelInfo->GetModelType() == MITYPE_VEHICLE) { if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo; CVehicleModelInfo* veh = (CVehicleModelInfo*)modelInfo;
if (veh->m_vehicleType != VEHICLE_TYPE_CAR) { if (veh->m_vehicleType == VEHICLE_TYPE_CAR) {
// Not ready yet pTarget = new CAutomobile(modelId, RANDOM_VEHICLE);
/* if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) } else if (veh->m_vehicleType == VEHICLE_TYPE_BOAT) {
{ pTarget = new CBoat(modelId, RANDOM_VEHICLE);
v33 = (CBoat*)CVehicle::operator new((CVehicle*)0x488, v6);
CBoat::CBoat(v33, modelId, 1u);
newEntity = (int)v33;
pTarget = (int)v33;
}
else
{
*/ newEntity = pTarget = new CObject(modelId, true);
if (!modelInfo->GetColModel()) {
modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
}
// }
} else { } else {
newEntity = pTarget = new CAutomobile(modelId, RANDOM_VEHICLE); pTarget = new CObject(modelId, true);
newEntity->SetStatus(STATUS_ABANDONED); if (!modelInfo->GetColModel()) {
modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
}
} }
newEntity->bIsStuck = true; pTarget->SetStatus(STATUS_ABANDONED);
} else if (modelInfo->GetModelType() == MITYPE_PED) { } else if (modelInfo->GetModelType() == MITYPE_PED) {
pTarget = newEntity = new CPed(PEDTYPE_CIVMALE); pTarget = new CPed(PEDTYPE_CIVMALE);
newEntity->SetModelIndex(modelId); pTarget->SetModelIndex(modelId);
} else { } else {
newEntity = pTarget = new CObject(modelId, true); pTarget = new CObject(modelId, true);
if (!modelInfo->GetColModel()) if (!modelInfo->GetColModel())
{ {
modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1); modelInfo->SetColModel(&CTempColModels::ms_colModelWheel1);
} }
newEntity->bIsStuck = true; pTarget->SetStatus(STATUS_ABANDONED);
} }
newEntity->SetPosition(0.0f, 0.0f, 0.0f); pTarget->SetPosition(0.0f, 0.0f, 0.0f);
CWorld::Add(newEntity); CWorld::Add(pTarget);
TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT); TheCamera.TakeControl(pTarget, CCam::MODE_MODELVIEW, JUMP_CUT, CAMCONTROL_SCRIPT);
} }
if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) { if (pTarget->IsVehicle() || pTarget->IsPed() || pTarget->IsObject()) {
@ -302,43 +296,26 @@ CAnimViewer::Update(void)
} }
pTarget->GetMatrix().GetPosition().z = 0.0f; pTarget->GetMatrix().GetPosition().z = 0.0f;
if (modelInfo->GetModelType() != MITYPE_PED) { if (modelInfo->GetModelType() == MITYPE_PED) {
if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) {
nextModelId = LastPedModelId(modelId);
AsciiToUnicode("Switched to peds", gUString);
CMessages::AddMessage(gUString, 1000, 0);
} else {
// Start in mobile
if (pad->NewState.Square && !pad->OldState.Square) {
CVehicleModelInfo::LoadVehicleColours();
AsciiToUnicode("Carcols.dat reloaded", gUString);
CMessages::AddMessage(gUString, 1000, 0);
}
}
}
} else {
((CPed*)pTarget)->bKindaStayInSamePlace = true; ((CPed*)pTarget)->bKindaStayInSamePlace = true;
// Triangle in mobile // Triangle in mobile
if (pad->NewState.Square && !pad->OldState.Square) { if (pad->GetSquareJustDown()) {
reloadIFP = 1; reloadIFP = 1;
AsciiToUnicode("IFP reloaded", gUString); AsciiToUnicode("IFP reloaded", gUString);
CMessages::AddMessage(gUString, 1000, 0); CMessages::AddMessage(gUString, 1000, 0);
} else if (pad->NewState.Cross && !pad->OldState.Cross) { } else if (pad->GetCrossJustDown()) {
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
AsciiToUnicode("Animation restarted", gUString); AsciiToUnicode("Animation restarted", gUString);
CMessages::AddMessage(gUString, 1000, 0); CMessages::AddMessage(gUString, 1000, 0);
} else if (pad->NewState.Circle && !pad->OldState.Circle) { } else if (pad->GetCircleJustDown()) {
PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE); PlayAnimation(pTarget->GetClump(), animGroup, ANIM_IDLE_STANCE);
AsciiToUnicode("Idle animation playing", gUString); AsciiToUnicode("Idle animation playing", gUString);
CMessages::AddMessage(gUString, 1000, 0); CMessages::AddMessage(gUString, 1000, 0);
} else if (pad->NewState.DPadUp && pad->OldState.DPadUp == 0) { } else if (pad->GetDPadUpJustDown()) {
animId--; animId--;
if (animId < 0) { if (animId < 0) {
animId = NUM_ANIMS - 1; animId = NUM_ANIMS - 1;
@ -349,7 +326,7 @@ CAnimViewer::Update(void)
AsciiToUnicode(gString, gUString); AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0); CMessages::AddMessage(gUString, 1000, 0);
} else if (pad->NewState.DPadDown && !pad->OldState.DPadDown) { } else if (pad->GetDPadDownJustDown()) {
animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1); animId = (animId == (NUM_ANIMS - 1) ? 0 : animId + 1);
PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId); PlayAnimation(pTarget->GetClump(), animGroup, (AnimationId)animId);
@ -357,42 +334,48 @@ CAnimViewer::Update(void)
AsciiToUnicode(gString, gUString); AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0); CMessages::AddMessage(gUString, 1000, 0);
} else { } else if (pad->GetStartJustDown()) {
if (pad->NewState.Start && !pad->OldState.Start) {
} else { } else if (pad->GetLeftShoulder1JustDown()) {
if (pad->NewState.LeftShoulder1 && !pad->OldState.LeftShoulder1) { nextModelId = FirstCarModelId(modelId);
nextModelId = LastVehicleModelId(modelId); AsciiToUnicode("Switched to vehicles", gUString);
AsciiToUnicode("Switched to vehicles", gUString); CMessages::AddMessage(gUString, 1000, 0);
CMessages::AddMessage(gUString, 1000, 0); // Originally it was GetPad(1)->LeftShoulder2
} else { } else if (pad->NewState.Triangle) {
// Originally it was GetPad(1)->LeftShoulder2
if (pad->NewState.Triangle) {
#ifdef PED_SKIN #ifdef PED_SKIN
if(IsClumpSkinned(pTarget->GetClump())) if(IsClumpSkinned(pTarget->GetClump()))
((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump()); ((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->AnimatePedColModelSkinned(pTarget->GetClump());
else else
#endif #endif
CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(), CPedModelInfo::AnimatePedColModel(((CPedModelInfo *)CModelInfo::GetModelInfo(pTarget->GetModelIndex()))->GetHitColModel(),
RpClumpGetFrame(pTarget->GetClump())); RpClumpGetFrame(pTarget->GetClump()));
AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString); AsciiToUnicode("Ped Col model will be animated as long as you hold the button", gUString);
CMessages::AddMessage(gUString, 100, 0); CMessages::AddMessage(gUString, 100, 0);
} }
} } else if (modelInfo->GetModelType() == MITYPE_VEHICLE) {
}
if (pad->GetLeftShoulder1JustDown()) {
nextModelId = LastPedModelId(modelId);
AsciiToUnicode("Switched to peds", gUString);
CMessages::AddMessage(gUString, 1000, 0);
// Start in mobile
} else if (pad->GetSquareJustDown()) {
CVehicleModelInfo::LoadVehicleColours();
AsciiToUnicode("Carcols.dat reloaded", gUString);
CMessages::AddMessage(gUString, 1000, 0);
} }
} }
} }
if (pad->NewState.DPadLeft && pad->OldState.DPadLeft == 0) { if (pad->GetDPadLeftJustDown()) {
nextModelId = FindMeAModelID(modelId, -1); nextModelId = NextModelId(modelId, -1);
sprintf(gString, "Current model ID: %d", nextModelId); sprintf(gString, "Current model ID: %d", nextModelId);
AsciiToUnicode(gString, gUString); AsciiToUnicode(gString, gUString);
CMessages::AddMessage(gUString, 1000, 0); CMessages::AddMessage(gUString, 1000, 0);
} else if (pad->NewState.DPadRight && pad->OldState.DPadRight == 0) { } else if (pad->GetDPadRightJustDown()) {
nextModelId = FindMeAModelID(modelId, 1); nextModelId = NextModelId(modelId, 1);
sprintf(gString, "Current model ID: %d", nextModelId); sprintf(gString, "Current model ID: %d", nextModelId);
AsciiToUnicode(gString, gUString); AsciiToUnicode(gString, gUString);

File diff suppressed because it is too large Load Diff

View File

@ -123,7 +123,7 @@ CCamera::Init(void)
Cams[0].Mode = CCam::MODE_FOLLOWPED; Cams[0].Mode = CCam::MODE_FOLLOWPED;
Cams[1].Mode = CCam::MODE_FOLLOWPED; Cams[1].Mode = CCam::MODE_FOLLOWPED;
unknown = 0; unknown = 0;
m_bJustJumpedOutOf1stPersonBecauseOfTarget = 0; m_bJustJumpedOutOf1stPersonBecauseOfTarget = false;
ClearPlayerWeaponMode(); ClearPlayerWeaponMode();
m_bInATunnelAndABigVehicle = false; m_bInATunnelAndABigVehicle = false;
m_iModeObbeCamIsInForCar = OBBE_INVALID; m_iModeObbeCamIsInForCar = OBBE_INVALID;
@ -141,8 +141,8 @@ CCamera::Init(void)
Cams[1].m_fPlayerVelocity = 0.0f; Cams[1].m_fPlayerVelocity = 0.0f;
Cams[2].m_fPlayerVelocity = 0.0f; Cams[2].m_fPlayerVelocity = 0.0f;
m_bHeadBob = false; m_bHeadBob = false;
m_fFractionInterToStopMovingTarget = 0.25f; m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f; m_fFractionInterToStopCatchUp = 0.75f;
m_fGaitSwayBuffer = 0.85f; m_fGaitSwayBuffer = 0.85f;
m_bScriptParametersSetForInterPol = false; m_bScriptParametersSetForInterPol = false;
m_uiCamShakeStart = 0; m_uiCamShakeStart = 0;
@ -249,13 +249,14 @@ void
CCamera::Process(void) CCamera::Process(void)
{ {
// static bool InterpolatorNotInitialised = true; // unused // static bool InterpolatorNotInitialised = true; // unused
static CVector PreviousFudgedTargetCoors; // only PS2
static float PlayerMinDist = 1.6f; // not on PS2 static float PlayerMinDist = 1.6f; // not on PS2
static bool WasPreviouslyInterSyhonFollowPed = false; // only written static bool WasPreviouslyInterSyhonFollowPed = false; // only used on PS2
float FOV = 0.0f; float FOV = 0.0f;
float oldBeta, newBeta; float oldBeta, newBeta;
float deltaBeta = 0.0f; float deltaBeta = 0.0f;
bool lookLRBVehicle = false; bool lookLRBVehicle = false;
CVector CamFront, CamUp, CamSource, Target; CVector CamFront, CamUp, CamRight, CamSource, Target;
m_bJust_Switched = false; m_bJust_Switched = false;
m_RealPreviousCameraPosition = GetPosition(); m_RealPreviousCameraPosition = GetPosition();
@ -308,19 +309,19 @@ CCamera::Process(void)
// Stop transition when it's done // Stop transition when it's done
if(m_uiTransitionState != 0){ if(m_uiTransitionState != 0){
/* #ifdef PS2_CAM_TRANSITION
// PS2:
if(!m_bWaitForInterpolToFinish){ if(!m_bWaitForInterpolToFinish){
Cams[(ActiveCam+1)%2].Process(); Cams[(ActiveCam+1)%2].Process();
Cams[(ActiveCam+1)%2].ProcessSpecialHeightRoutines(); Cams[(ActiveCam+1)%2].ProcessSpecialHeightRoutines();
} }
*/ #else
// not PS2 (done in CamControl there it seems) // done in CamControl on PS2 it seems
if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){ if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){
m_uiTransitionState = 0; m_uiTransitionState = 0;
m_vecDoingSpecialInterPolation = false; m_vecDoingSpecialInterPolation = false;
m_bWaitForInterpolToFinish = false; m_bWaitForInterpolToFinish = false;
} }
#endif
} }
if(m_bUseNearClipScript) if(m_bUseNearClipScript)
@ -343,19 +344,165 @@ CCamera::Process(void)
if(m_uiTransitionState != 0 && !lookLRBVehicle){ if(m_uiTransitionState != 0 && !lookLRBVehicle){
// Process transition // Process transition
// different on PS2 #ifdef PS2_CAM_TRANSITION
bool lookingAtPlayerNow = false;
bool wasLookingAtPlayer = false;
bool transitionPedMode = false;
bool setWait = false;
if(Cams[ActiveCam].CamTargetEntity == Cams[(ActiveCam+1)%2].CamTargetEntity){
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON ||
Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
Cams[ActiveCam].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON)
lookingAtPlayerNow = true;
if(Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SYPHON ||
Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FOLLOWPED ||
Cams[(ActiveCam+1)%2].Mode == CCam::MODE_SPECIAL_FIXED_FOR_SYPHON) // checked twice for some reason
wasLookingAtPlayer = true;
if(!m_vecDoingSpecialInterPolation &&
(Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED || Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM) &&
(Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FOLLOWPED || Cams[(ActiveCam+1)%2].Mode == CCam::MODE_FIGHT_CAM))
transitionPedMode = true;
}
if(lookingAtPlayerNow && wasLookingAtPlayer){
CVector playerDist;
playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x;
playerDist.y = FindPlayerPed()->GetPosition().y - GetPosition().y;
playerDist.z = FindPlayerPed()->GetPosition().z - GetPosition().z;
if(playerDist.Magnitude() > 17.5f &&
(Cams[ActiveCam].Mode == CCam::MODE_SYPHON || Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT))
setWait = true;
}
if(setWait)
m_bWaitForInterpolToFinish = true;
uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart;
if(currentTime >= m_uiTransitionDuration)
currentTime = m_uiTransitionDuration;
float inter = (float) currentTime / m_uiTransitionDuration;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
if(m_vecDoingSpecialInterPolation){
Cams[(ActiveCam+1)%2].Source = m_vecOldSourceForInter;
Cams[(ActiveCam+1)%2].Front = m_vecOldFrontForInter;
Cams[(ActiveCam+1)%2].Up = m_vecOldUpForInter;
Cams[(ActiveCam+1)%2].FOV = m_vecOldFOVForInter;
if(WasPreviouslyInterSyhonFollowPed)
Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter.z = PreviousFudgedTargetCoors.z;
}
CamSource = inter*Cams[ActiveCam].Source + (1.0f-inter)*Cams[(ActiveCam+1)%2].Source;
FOV = inter*Cams[ActiveCam].FOV + (1.0f-inter)*Cams[(ActiveCam+1)%2].FOV;
CVector tmpFront = Cams[(ActiveCam+1)%2].Front;
float Alpha_other = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z);
if(Alpha_other > PI) Alpha_other -= TWOPI;
float Beta_other = 0.0f;
if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
Beta_other = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x);
tmpFront = Cams[ActiveCam].Front;
float Alpha_active = CGeneral::GetATanOfXY(tmpFront.Magnitude2D(), tmpFront.z);
if(Alpha_active > PI) Alpha_active -= TWOPI;
float Beta_active = 0.0f;
if(tmpFront.x != 0.0f || tmpFront.y != 0.0f)
Beta_active = CGeneral::GetATanOfXY(-tmpFront.y, tmpFront.x);
float DeltaBeta = Beta_active - Beta_other;
float Alpha = inter*Alpha_active + (1.0f-inter)*Alpha_other;
if(m_uiTransitionJUSTStarted){
while(DeltaBeta > PI) DeltaBeta -= TWOPI;
while(DeltaBeta <= -PI) DeltaBeta += TWOPI;
m_uiTransitionJUSTStarted = false;
}else{
if(DeltaBeta < m_fOldBetaDiff)
while(Abs(DeltaBeta - m_fOldBetaDiff) > PI) DeltaBeta += TWOPI;
else
while(Abs(DeltaBeta - m_fOldBetaDiff) > PI) DeltaBeta -= TWOPI;
}
m_fOldBetaDiff = DeltaBeta;
float Beta = inter*DeltaBeta + Beta_other;
CVector FudgedTargetCoors;
if(lookingAtPlayerNow && wasLookingAtPlayer){
// BUG? how is this interpolation ever used when values are overwritten below?
float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D();
float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating);
if(PlayerDist < MinDist){
CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(Beta - HALFPI);
CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(Beta - HALFPI);
}else{
CamSource.x = pTargetEntity->GetPosition().x - PlayerDist*Cos(Beta - HALFPI);
CamSource.y = pTargetEntity->GetPosition().y - PlayerDist*Sin(Beta - HALFPI);
}
CColPoint colpoint;
CEntity *entity = nil;
if(CWorld::ProcessLineOfSight(pTargetEntity->GetPosition(), CamSource, colpoint, entity, true, false, false, true, false, true, true)){
CamSource = colpoint.point;
RwCameraSetNearClipPlane(Scene.camera, 0.05f);
}
CamFront = pTargetEntity->GetPosition() - CamSource;
FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter;
PreviousFudgedTargetCoors = FudgedTargetCoors;
CamFront.Normalise();
CamUp = CVector(0.0f, 0.0f, 1.0f);
CamRight = CrossProduct(CamFront, CamUp);
CamRight.Normalise();
CamUp = CrossProduct(CamRight, CamFront);
WasPreviouslyInterSyhonFollowPed = true;
}else
WasPreviouslyInterSyhonFollowPed = false;
if(transitionPedMode){
FudgedTargetCoors = inter*Cams[ActiveCam].m_cvecTargetCoorsForFudgeInter + (1.0f-inter)*Cams[(ActiveCam+1)%2].m_cvecTargetCoorsForFudgeInter;
PreviousFudgedTargetCoors = FudgedTargetCoors;
CVector CamToTarget = pTargetEntity->GetPosition() - CamSource;
float tmpBeta = CGeneral::GetATanOfXY(CamToTarget.x, CamToTarget.y);
float PlayerDist = (pTargetEntity->GetPosition() - CamSource).Magnitude2D();
float MinDist = Min(Cams[(ActiveCam+1)%2].m_fMinDistAwayFromCamWhenInterPolating, Cams[ActiveCam].m_fMinDistAwayFromCamWhenInterPolating);
if(PlayerDist < MinDist){
CamSource.x = pTargetEntity->GetPosition().x - MinDist*Cos(tmpBeta - HALFPI);
CamSource.y = pTargetEntity->GetPosition().y - MinDist*Sin(tmpBeta - HALFPI);
}
CamFront = FudgedTargetCoors - CamSource;
CamFront.Normalise();
CamUp = CVector(0.0f, 0.0f, 1.0f);
CamUp.Normalise();
CamRight = CrossProduct(CamFront, CamUp);
CamRight.Normalise();
CamUp = CrossProduct(CamRight, CamFront);
CamUp.Normalise();
}else{
CamFront.x = Cos(Alpha) * Sin(Beta);
CamFront.y = Cos(Alpha) * -Cos(Beta);
CamFront.z = Sin(Alpha);
CamFront.Normalise();
CamUp = inter*Cams[ActiveCam].Up + (1.0f-inter)*Cams[(ActiveCam+1)%2].Up;
CamUp.Normalise();
CamRight = CrossProduct(CamFront, CamUp);
CamRight.Normalise();
CamUp = CrossProduct(CamRight, CamFront);
CamUp.Normalise();
}
#else
uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart; uint32 currentTime = CTimer::GetTimeInMilliseconds() - m_uiTimeTransitionStart;
if(currentTime >= m_uiTransitionDuration) if(currentTime >= m_uiTransitionDuration)
currentTime = m_uiTransitionDuration; currentTime = m_uiTransitionDuration;
float fractionInter = (float) currentTime / m_uiTransitionDuration; float fractionInter = (float) currentTime / m_uiTransitionDuration;
if(fractionInter <= m_fFractionInterToStopMovingTarget){ if(fractionInter <= m_fFractionInterToStopMoving){
float inter; float inter;
if(m_fFractionInterToStopMovingTarget == 0.0f) if(m_fFractionInterToStopMoving == 0.0f)
inter = 0.0f; inter = 0.0f;
else else
inter = (m_fFractionInterToStopMovingTarget - fractionInter)/m_fFractionInterToStopMovingTarget; inter = (m_fFractionInterToStopMoving - fractionInter)/m_fFractionInterToStopMoving;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter; m_vecSourceWhenInterPol = m_cvecStartingSourceForInterPol + inter*m_cvecSourceSpeedAtStartInter;
@ -399,22 +546,24 @@ CCamera::Process(void)
if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){ if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CamFront.Normalise(); CamFront.Normalise();
CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f)); CamRight = CVector(-1.0f, 0.0f, 0.0f);
CamUp = CrossProduct(CamFront, CamRight);
CamUp.Normalise();
}else{ }else{
CamFront.Normalise(); CamFront.Normalise();
CamUp.Normalise(); CamUp.Normalise();
CVector right = CrossProduct(CamFront, CamUp); CamRight = CrossProduct(CamFront, CamUp);
right.Normalise(); CamRight.Normalise();
CamUp = CrossProduct(right, CamFront); CamUp = CrossProduct(CamRight, CamFront);
CamUp.Normalise();
} }
CamUp.Normalise();
FOV = m_fFOVWhenInterPol; FOV = m_fFOVWhenInterPol;
}else if(fractionInter > m_fFractionInterToStopMovingTarget && fractionInter <= 1.0f){ }else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){
float inter; float inter;
if(m_fFractionInterToStopCatchUpTarget == 0.0f) if(m_fFractionInterToStopCatchUp == 0.0f)
inter = 0.0f; inter = 0.0f;
else else
inter = (fractionInter - m_fFractionInterToStopMovingTarget)/m_fFractionInterToStopCatchUpTarget; inter = (fractionInter - m_fFractionInterToStopMoving)/m_fFractionInterToStopCatchUp;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol); CamSource = m_vecSourceWhenInterPol + inter*(Cams[ActiveCam].Source - m_vecSourceWhenInterPol);
@ -454,15 +603,17 @@ CCamera::Process(void)
if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){ if(Cams[ActiveCam].Mode == CCam::MODE_TOPDOWN || Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CamFront.Normalise(); CamFront.Normalise();
CamUp = CrossProduct(CamFront, CVector(-1.0f, 0.0f, 0.0f)); CamRight = CVector(-1.0f, 0.0f, 0.0f);
CamUp = CrossProduct(CamFront, CamRight);
CamUp.Normalise();
}else{ }else{
CamFront.Normalise(); CamFront.Normalise();
CamUp.Normalise(); CamUp.Normalise();
CVector right = CrossProduct(CamFront, CamUp); CamRight = CrossProduct(CamFront, CamUp);
right.Normalise(); CamRight.Normalise();
CamUp = CrossProduct(right, CamFront); CamUp = CrossProduct(CamRight, CamFront);
CamUp.Normalise();
} }
CamUp.Normalise();
#ifndef FIX_BUGS #ifndef FIX_BUGS
// BUG: FOV was already interpolated but m_fFOVWhenInterPol was not // BUG: FOV was already interpolated but m_fFOVWhenInterPol was not
FOV = m_fFOVWhenInterPol; FOV = m_fFOVWhenInterPol;
@ -474,6 +625,7 @@ CCamera::Process(void)
float Alpha = CGeneral::GetATanOfXY(DistOnGround, Dist.z); float Alpha = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
float Beta = CGeneral::GetATanOfXY(Dist.x, Dist.y); float Beta = CGeneral::GetATanOfXY(Dist.x, Dist.y);
Cams[ActiveCam].KeepTrackOfTheSpeed(CamSource, Target, CamUp, Alpha, Beta, FOV); Cams[ActiveCam].KeepTrackOfTheSpeed(CamSource, Target, CamUp, Alpha, Beta, FOV);
#endif
}else{ }else{
// No transition, take Cam values directly // No transition, take Cam values directly
if(WorldViewerBeingUsed){ if(WorldViewerBeingUsed){
@ -487,7 +639,7 @@ CCamera::Process(void)
CamUp = Cams[ActiveCam].Up; CamUp = Cams[ActiveCam].Up;
FOV = Cams[ActiveCam].FOV; FOV = Cams[ActiveCam].FOV;
} }
WasPreviouslyInterSyhonFollowPed = false; // unused WasPreviouslyInterSyhonFollowPed = false; // only used on PS2
} }
if(m_uiTransitionState != 0) if(m_uiTransitionState != 0)
@ -567,8 +719,10 @@ CCamera::Process(void)
LODDistMultiplier = 70.0f/CDraw::GetFOV() * CDraw::GetAspectRatio()/(4.0f/3.0f); LODDistMultiplier = 70.0f/CDraw::GetFOV() * CDraw::GetAspectRatio()/(4.0f/3.0f);
else else
LODDistMultiplier = 1.0f; LODDistMultiplier = 1.0f;
// missing on PS2
GenerationDistMultiplier = LODDistMultiplier; GenerationDistMultiplier = LODDistMultiplier;
LODDistMultiplier *= CRenderer::ms_lodDistScale; LODDistMultiplier *= CRenderer::ms_lodDistScale;
//
// Keep track of speed // Keep track of speed
if(m_bJustInitalised || m_bJust_Switched){ if(m_bJustInitalised || m_bJust_Switched){
@ -584,7 +738,7 @@ CCamera::Process(void)
} }
m_PreviousCameraPosition = GetPosition(); m_PreviousCameraPosition = GetPosition();
// PS2: something doing on with forward vector here // PS2 normalizes a CVector2D GetForward() here. is it used anywhere?
if(Cams[ActiveCam].DirectionWasLooking != LOOKING_FORWARD && Cams[ActiveCam].Mode != CCam::MODE_TOP_DOWN_PED){ if(Cams[ActiveCam].DirectionWasLooking != LOOKING_FORWARD && Cams[ActiveCam].Mode != CCam::MODE_TOP_DOWN_PED){
Cams[ActiveCam].Source = Cams[ActiveCam].SourceBeforeLookBehind; Cams[ActiveCam].Source = Cams[ActiveCam].SourceBeforeLookBehind;
@ -630,6 +784,16 @@ CCamera::CamControl(void)
if(Cams[ActiveCam].CamTargetEntity == nil && pTargetEntity == nil) if(Cams[ActiveCam].CamTargetEntity == nil && pTargetEntity == nil)
pTargetEntity = PLAYER; pTargetEntity = PLAYER;
#ifdef PS2_CAM_TRANSITION
// Stop transition when it's done
if(m_uiTransitionState != 0)
if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){
m_uiTransitionState = 0;
m_vecDoingSpecialInterPolation = false;
m_bWaitForInterpolToFinish = false;
}
#endif
m_iZoneCullFrameNumWereAt++; m_iZoneCullFrameNumWereAt++;
if(m_iZoneCullFrameNumWereAt > m_iCheckCullZoneThisNumFrames) if(m_iZoneCullFrameNumWereAt > m_iCheckCullZoneThisNumFrames)
m_iZoneCullFrameNumWereAt = 1; m_iZoneCullFrameNumWereAt = 1;
@ -638,7 +802,7 @@ CCamera::CamControl(void)
m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer(); m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer();
if(m_bLookingAtPlayer){ if(m_bLookingAtPlayer){
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_1; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
FindPlayerPed()->bIsVisible = true; FindPlayerPed()->bIsVisible = true;
} }
@ -906,7 +1070,7 @@ CCamera::CamControl(void)
m_bFirstPersonBeingUsed = false; m_bFirstPersonBeingUsed = false;
if(m_bFirstPersonBeingUsed){ if(m_bFirstPersonBeingUsed){
ReqMode = CCam::MODE_1STPERSON; ReqMode = CCam::MODE_1STPERSON;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_1; CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA);
} }
// Zoom value // Zoom value
@ -1015,7 +1179,7 @@ CCamera::CamControl(void)
garageCenter.y = (az->miny + az->maxy)/2.0f; garageCenter.y = (az->miny + az->maxy)/2.0f;
garageCenter.z = 0.0f; garageCenter.z = 0.0f;
}else }else
garageCenter = pTargetEntity->GetPosition(); garageCenter = CVector(pTargetEntity->GetPosition().x, pTargetEntity->GetPosition().y, 0.0f);
} }
if(whichDoor == 1) if(whichDoor == 1)
garageCenterToDoor = garageDoorPos1 - garageCenter; garageCenterToDoor = garageDoorPos1 - garageCenter;
@ -1223,6 +1387,7 @@ CCamera::CamControl(void)
// Restore with a jump cut // Restore with a jump cut
if(m_bRestoreByJumpCut){ if(m_bRestoreByJumpCut){
// PS2 just sets m_bCamDirectlyBehind here
if(ReqMode != CCam::MODE_FOLLOWPED && if(ReqMode != CCam::MODE_FOLLOWPED &&
ReqMode != CCam::MODE_M16_1STPERSON && ReqMode != CCam::MODE_M16_1STPERSON &&
ReqMode != CCam::MODE_SNIPER && ReqMode != CCam::MODE_SNIPER &&
@ -1238,6 +1403,7 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity = pTargetEntity; Cams[ActiveCam].CamTargetEntity = pTargetEntity;
Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource; Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource;
Cams[ActiveCam].m_cvecCamFixedModeUpOffSet = m_vecFixedModeUpOffSet; Cams[ActiveCam].m_cvecCamFixedModeUpOffSet = m_vecFixedModeUpOffSet;
// PS2 sets this to m_bLookingAtVector
Cams[ActiveCam].m_bCamLookingAtVector = false; Cams[ActiveCam].m_bCamLookingAtVector = false;
Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition; Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition;
m_bRestoreByJumpCut = false; m_bRestoreByJumpCut = false;
@ -1376,7 +1542,7 @@ CCamera::CamControl(void)
switchByJumpCut = true; switchByJumpCut = true;
if(Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){ if(Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CVector front = Cams[ActiveCam].Source - FindPlayerPed()->GetPosition(); CVector front = Cams[ActiveCam].Source - FindPlayerPed()->GetPosition();
front.z = 0.0f; front.z = 0.0f; // missing on PS2
front.Normalise(); front.Normalise();
#ifdef FIX_BUGS #ifdef FIX_BUGS
// this is almost as bad as the bugged code // this is almost as bad as the bugged code
@ -1413,6 +1579,7 @@ CCamera::CamControl(void)
if((m_uiTransitionState == 0 || switchByJumpCut) && ReqMode != Cams[ActiveCam].Mode){ if((m_uiTransitionState == 0 || switchByJumpCut) && ReqMode != Cams[ActiveCam].Mode){
if(switchByJumpCut){ if(switchByJumpCut){
// PS2 just sets m_bCamDirectlyBehind here
if(!m_bPlayerIsInGarage || m_bJustCameOutOfGarage){ if(!m_bPlayerIsInGarage || m_bJustCameOutOfGarage){
if(ReqMode != CCam::MODE_FOLLOWPED && if(ReqMode != CCam::MODE_FOLLOWPED &&
ReqMode != CCam::MODE_M16_1STPERSON && ReqMode != CCam::MODE_M16_1STPERSON &&
@ -1451,6 +1618,8 @@ CCamera::CamControl(void)
if(ReqMode == CCam::MODE_FOLLOWPED && Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM) if(ReqMode == CCam::MODE_FOLLOWPED && Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM)
startTransition = false; startTransition = false;
#ifndef PS2_CAM_TRANSITION
// done in Process on PS2
if(!m_bWaitForInterpolToFinish && m_bLookingAtPlayer && m_uiTransitionState != 0){ if(!m_bWaitForInterpolToFinish && m_bLookingAtPlayer && m_uiTransitionState != 0){
CVector playerDist; CVector playerDist;
playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x; playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x;
@ -1463,6 +1632,7 @@ CCamera::CamControl(void)
m_bWaitForInterpolToFinish = true; m_bWaitForInterpolToFinish = true;
} }
} }
#endif
if(m_bWaitForInterpolToFinish) if(m_bWaitForInterpolToFinish)
startTransition = false; startTransition = false;
@ -1472,10 +1642,14 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity); Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity);
} }
}else if(ReqMode == CCam::MODE_FIXED && pTargetEntity != Cams[ActiveCam].CamTargetEntity && m_bPlayerIsInGarage){ }else if(ReqMode == CCam::MODE_FIXED && pTargetEntity != Cams[ActiveCam].CamTargetEntity && m_bPlayerIsInGarage){
#ifdef PS2_CAM_TRANSITION
StartTransitionWhenNotFinishedInter(ReqMode);
#else
if(m_uiTransitionState != 0) if(m_uiTransitionState != 0)
StartTransitionWhenNotFinishedInter(ReqMode); StartTransitionWhenNotFinishedInter(ReqMode);
else else
StartTransition(ReqMode); StartTransition(ReqMode);
#endif
pTargetEntity->RegisterReference(&pTargetEntity); pTargetEntity->RegisterReference(&pTargetEntity);
Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity); Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity);
} }
@ -1599,7 +1773,7 @@ CCamera::UpdateTargetEntity(void)
pTargetEntity = FindPlayerPed(); pTargetEntity = FindPlayerPed();
if(PLAYER->GetPedState() == PED_DRAG_FROM_CAR) if(PLAYER->GetPedState() == PED_DRAG_FROM_CAR)
pTargetEntity = FindPlayerPed(); pTargetEntity = FindPlayerPed();
if(pTargetEntity->IsVehicle() && CarZoomIndicator != CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED) if(pTargetEntity->IsVehicle() && CarZoomIndicator == CAM_ZOOM_1STPRS && FindPlayerPed()->GetPedState() == PED_ARRESTED)
pTargetEntity = FindPlayerPed(); pTargetEntity = FindPlayerPed();
} }
} }
@ -1861,26 +2035,25 @@ CCamera::SetCamPositionForFixedMode(const CVector &Source, const CVector &UpOffS
/* /*
* On PS2 the transition happens between Cams[1] and Cams[2]. * On PS2 the transition happens between Cams[0] and Cams[1].
* On PC the whole system has been changed. * On PC the whole system has been changed.
*/ */
void void
CCamera::StartTransition(int16 newMode) CCamera::StartTransition(int16 newMode)
{ {
bool foo = false;
bool switchSyphonMode = false; bool switchSyphonMode = false;
bool switchPedToCar = false; bool switchPedToCar = false;
bool switchPedMode = false; bool switchFromFight = false;
bool switchFromFixed = false; bool switchFromFixed = false;
bool switch1stPersonToVehicle = false; bool switch1stPersonToVehicle = false;
float betaOffset, targetBeta, camBeta, deltaBeta; float betaOffset, targetBeta, camBeta, deltaBeta;
int door; int door;
bool vehicleVertical; bool vehicleVertical;
// missing on PS2 #ifndef PS2_CAM_TRANSITION
m_bItsOkToLookJustAtThePlayer = false; m_bItsOkToLookJustAtThePlayer = false;
m_fFractionInterToStopMovingTarget = 0.25f; m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f; m_fFractionInterToStopCatchUp = 0.75f;
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT || if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED || Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
@ -1894,14 +2067,16 @@ CCamera::StartTransition(int16 newMode)
if(newMode == CCam::MODE_CAM_ON_A_STRING) if(newMode == CCam::MODE_CAM_ON_A_STRING)
switchPedToCar = true; switchPedToCar = true;
} }
// #endif
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON) if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON)
switchSyphonMode = true; switchSyphonMode = true;
if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED) if(Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM && newMode == CCam::MODE_FOLLOWPED)
switchPedMode = true; switchFromFight = true;
#ifndef PS2_CAM_TRANSITION
if(Cams[ActiveCam].Mode == CCam::MODE_FIXED) if(Cams[ActiveCam].Mode == CCam::MODE_FIXED)
switchFromFixed = true; switchFromFixed = true;
#endif
m_bUseTransitionBeta = false; m_bUseTransitionBeta = false;
@ -1920,11 +2095,11 @@ CCamera::StartTransition(int16 newMode)
((CPed*)pTargetEntity)->m_fRotationDest = angle; ((CPed*)pTargetEntity)->m_fRotationDest = angle;
} }
/* // PS2 #ifdef PS2_CAM_TRANSITION
ActiveCam = (ActiveCam+1)%2; ActiveCam = (ActiveCam+1)%2;
Cams[ActiveCam].Init(); Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode; Cams[ActiveCam].Mode = newMode;
*/ #endif
Cams[ActiveCam].m_cvecCamFixedModeVector = m_vecFixedModeVector; Cams[ActiveCam].m_cvecCamFixedModeVector = m_vecFixedModeVector;
Cams[ActiveCam].CamTargetEntity = pTargetEntity; Cams[ActiveCam].CamTargetEntity = pTargetEntity;
@ -1955,12 +2130,27 @@ CCamera::StartTransition(int16 newMode)
switch(newMode){ switch(newMode){
case CCam::MODE_BEHINDCAR: case CCam::MODE_BEHINDCAR:
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
#endif
Cams[ActiveCam].BetaSpeed = 0.0f;
break;
case CCam::MODE_BEHINDBOAT:
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
#endif
Cams[ActiveCam].BetaSpeed = 0.0f; Cams[ActiveCam].BetaSpeed = 0.0f;
break; break;
case CCam::MODE_FOLLOWPED: case CCam::MODE_FOLLOWPED:
// Getting out of vehicle normally // Getting out of vehicle normally
betaOffset = DEGTORAD(55.0f); betaOffset = DEGTORAD(55.0f);
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
#endif
if(m_bJustCameOutOfGarage){ if(m_bJustCameOutOfGarage){
m_bUseTransitionBeta = true; m_bUseTransitionBeta = true;
/* /*
@ -1974,13 +2164,21 @@ CCamera::StartTransition(int16 newMode)
*/ */
// this is better: // this is better:
if(Cams[ActiveCam].Front.x != 0.0f || Cams[ActiveCam].Front.y != 0.0f) if(Cams[ActiveCam].Front.x != 0.0f || Cams[ActiveCam].Front.y != 0.0f)
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y) + PI;
#else
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI; Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y) + PI;
#endif
else else
Cams[ActiveCam].m_fTransitionBeta = 0.0f; Cams[ActiveCam].m_fTransitionBeta = 0.0f;
} }
if(m_bTargetJustCameOffTrain) if(m_bTargetJustCameOffTrain)
m_bCamDirectlyInFront = true; m_bCamDirectlyInFront = true;
#ifdef PS2_CAM_TRANSITION
if(Cams[(ActiveCam+1)%2].Mode != CCam::MODE_CAM_ON_A_STRING)
#else
if(Cams[ActiveCam].Mode != CCam::MODE_CAM_ON_A_STRING) if(Cams[ActiveCam].Mode != CCam::MODE_CAM_ON_A_STRING)
#endif
break; break;
m_bUseTransitionBeta = true; m_bUseTransitionBeta = true;
vehicleVertical = false; vehicleVertical = false;
@ -1992,7 +2190,11 @@ CCamera::StartTransition(int16 newMode)
Cams[ActiveCam].m_fTransitionBeta = 0.0f; Cams[ActiveCam].m_fTransitionBeta = 0.0f;
break; break;
} }
#ifdef PS2_CAM_TRANSITION
camBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y);
#else
camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y); camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
#endif
if(((CPed*)pTargetEntity)->m_carInObjective) if(((CPed*)pTargetEntity)->m_carInObjective)
targetBeta = CGeneral::GetATanOfXY(((CPed*)pTargetEntity)->m_carInObjective->GetForward().x, ((CPed*)pTargetEntity)->m_carInObjective->GetForward().y); targetBeta = CGeneral::GetATanOfXY(((CPed*)pTargetEntity)->m_carInObjective->GetForward().x, ((CPed*)pTargetEntity)->m_carInObjective->GetForward().y);
else else
@ -2048,6 +2250,10 @@ CCamera::StartTransition(int16 newMode)
break; break;
case CCam::MODE_SYPHON: case CCam::MODE_SYPHON:
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Beta = Cams[(ActiveCam+1)%2].Beta;
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
#endif
Cams[ActiveCam].Alpha = 0.0f; Cams[ActiveCam].Alpha = 0.0f;
Cams[ActiveCam].AlphaSpeed = 0.0f; Cams[ActiveCam].AlphaSpeed = 0.0f;
break; break;
@ -2055,20 +2261,29 @@ CCamera::StartTransition(int16 newMode)
case CCam::MODE_CAM_ON_A_STRING: case CCam::MODE_CAM_ON_A_STRING:
// Get into vehicle // Get into vehicle
betaOffset = DEGTORAD(57.0f); betaOffset = DEGTORAD(57.0f);
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
#endif
if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage) if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage)
break; break;
m_bUseTransitionBeta = true; m_bUseTransitionBeta = true;
targetBeta = CGeneral::GetATanOfXY(pTargetEntity->GetForward().x, pTargetEntity->GetForward().y); targetBeta = CGeneral::GetATanOfXY(pTargetEntity->GetForward().x, pTargetEntity->GetForward().y);
#ifdef PS2_CAM_TRANSITION
camBeta = CGeneral::GetATanOfXY(Cams[(ActiveCam+1)%2].Front.x, Cams[(ActiveCam+1)%2].Front.y);
#else
camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y); camBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
#endif
deltaBeta = targetBeta - camBeta; deltaBeta = targetBeta - camBeta;
while(deltaBeta >= PI) deltaBeta -= 2*PI; while(deltaBeta >= PI) deltaBeta -= 2*PI;
while(deltaBeta < -PI) deltaBeta += 2*PI; while(deltaBeta < -PI) deltaBeta += 2*PI;
deltaBeta = Abs(deltaBeta); deltaBeta = Abs(deltaBeta);
// switchFromFixed logic again here, skipped #ifndef PS2_CAM_TRANSITION
switchFromFixed = Cams[ActiveCam].Mode == CCam::MODE_FIXED;
if(switchFromFixed){ if(switchFromFixed){
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y); Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
break; break;
} }
#endif
door = FindPlayerPed()->m_vehEnterType; door = FindPlayerPed()->m_vehEnterType;
if(deltaBeta > HALFPI){ if(deltaBeta > HALFPI){
@ -2096,15 +2311,23 @@ CCamera::StartTransition(int16 newMode)
} }
break; break;
case CCam::MODE_BEHINDBOAT:
Cams[ActiveCam].BetaSpeed = 0.0f;
break;
case CCam::MODE_PED_DEAD_BABY: case CCam::MODE_PED_DEAD_BABY:
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
#endif
Cams[ActiveCam].Alpha = DEGTORAD(15.0f); Cams[ActiveCam].Alpha = DEGTORAD(15.0f);
break; break;
#ifdef PS2_CAM_TRANSITION
case CCam::MODE_PLAYER_FALLEN_WATER:
Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition;
break;
#endif
case CCam::MODE_FIGHT_CAM: case CCam::MODE_FIGHT_CAM:
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
#endif
Cams[ActiveCam].Beta = 0.0f; Cams[ActiveCam].Beta = 0.0f;
Cams[ActiveCam].BetaSpeed = 0.0f; Cams[ActiveCam].BetaSpeed = 0.0f;
Cams[ActiveCam].Alpha = 0.0f; Cams[ActiveCam].Alpha = 0.0f;
@ -2112,33 +2335,40 @@ CCamera::StartTransition(int16 newMode)
break; break;
} }
#ifndef PS2_CAM_TRANSITION
Cams[ActiveCam].Init(); Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode; Cams[ActiveCam].Mode = newMode;
m_uiTransitionDuration = 1350; m_uiTransitionDuration = 1350;
if(switchSyphonMode) if(switchSyphonMode)
m_uiTransitionDuration = 1800; m_uiTransitionDuration = 1800;
else if(switchPedMode) else if(switchFromFight)
m_uiTransitionDuration = 750; m_uiTransitionDuration = 750;
// not on PS2
else if(switchPedToCar){ else if(switchPedToCar){
m_fFractionInterToStopMovingTarget = 0.2f; m_fFractionInterToStopMoving = 0.2f;
m_fFractionInterToStopCatchUpTarget = 0.8f; m_fFractionInterToStopCatchUp = 0.8f;
m_uiTransitionDuration = 950; m_uiTransitionDuration = 950;
}else if(switchFromFixed){ }else if(switchFromFixed){
m_fFractionInterToStopMovingTarget = 0.05f; m_fFractionInterToStopMoving = 0.05f;
m_fFractionInterToStopCatchUpTarget = 0.95f; m_fFractionInterToStopCatchUp = 0.95f;
}else if(switch1stPersonToVehicle){ }else if(switch1stPersonToVehicle){
m_fFractionInterToStopMovingTarget = 0.0f; m_fFractionInterToStopMoving = 0.0f;
m_fFractionInterToStopCatchUpTarget = 1.0f; m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 1; m_uiTransitionDuration = 1;
}else }else
m_uiTransitionDuration = 1350; // already set above m_uiTransitionDuration = 1350; // already set above
// #else
if(switchSyphonMode)
m_uiTransitionDuration = 1800;
else if(switchFromFight)
m_uiTransitionDuration = 750;
else
m_uiTransitionDuration = 1350;
#endif
m_uiTransitionState = 1; m_uiTransitionState = 1;
m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds(); m_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds();
m_uiTransitionJUSTStarted = 1; m_uiTransitionJUSTStarted = 1;
// PS2 returns here #ifndef PS2_CAM_TRANSITION
if(m_vecDoingSpecialInterPolation){ if(m_vecDoingSpecialInterPolation){
m_cvecStartingSourceForInterPol = SourceDuringInter; m_cvecStartingSourceForInterPol = SourceDuringInter;
m_cvecStartingTargetForInterPol = TargetDuringInter; m_cvecStartingTargetForInterPol = TargetDuringInter;
@ -2170,19 +2400,27 @@ CCamera::StartTransition(int16 newMode)
m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame; m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame;
Cams[ActiveCam].ResetStatics = true; Cams[ActiveCam].ResetStatics = true;
if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){ if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){
m_fFractionInterToStopMovingTarget = m_fScriptPercentageInterToStopMoving; m_fFractionInterToStopMoving = m_fScriptPercentageInterToStopMoving;
m_fFractionInterToStopCatchUpTarget = m_fScriptPercentageInterToCatchUp; m_fFractionInterToStopCatchUp = m_fScriptPercentageInterToCatchUp;
m_uiTransitionDuration = m_fScriptTimeForInterPolation; m_uiTransitionDuration = m_fScriptTimeForInterPolation;
} }
#endif
} }
void void
CCamera::StartTransitionWhenNotFinishedInter(int16 mode) CCamera::StartTransitionWhenNotFinishedInter(int16 mode)
{ {
#ifdef PS2_CAM_TRANSITION
m_vecOldSourceForInter = GetPosition();
m_vecOldFrontForInter = GetForward();
m_vecOldUpForInter = GetUp();
m_vecOldFOVForInter = CDraw::GetFOV();
#endif
m_vecDoingSpecialInterPolation = true; m_vecDoingSpecialInterPolation = true;
StartTransition(mode); StartTransition(mode);
} }
#ifndef PS2_CAM_TRANSITION
void void
CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV) CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up, float &FOV)
{ {
@ -2195,7 +2433,7 @@ CCamera::StoreValuesDuringInterPol(CVector &source, CVector &target, CVector &up
m_fBetaDuringInterPol = CGeneral::GetATanOfXY(Dist.x, Dist.y); m_fBetaDuringInterPol = CGeneral::GetATanOfXY(Dist.x, Dist.y);
m_fAlphaDuringInterPol = CGeneral::GetATanOfXY(DistOnGround, Dist.z); m_fAlphaDuringInterPol = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
} }
#endif
void void
@ -2265,82 +2503,77 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
switch(obbeMode){ switch(obbeMode){
case OBBE_WHEEL: case OBBE_WHEEL:
veh = FindPlayerVehicle(); veh = FindPlayerVehicle();
if(veh == nil){ if(veh){
if(CTimer::GetTimeInMilliseconds() > t+5000) if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO)
return true;
if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false))
return true; return true;
SetNearClipScript(0.6f);
return false;
} }
if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO) if(CTimer::GetTimeInMilliseconds() > t+5000)
return true; return true;
if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){ SetNearClipScript(0.6f);
if(CTimer::GetTimeInMilliseconds() > t+5000) return false;
return true;
SetNearClipScript(0.6f);
return false;
}
return true;
case OBBE_1: case OBBE_1:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat()) if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true; return true;
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
fwd = FindPlayerCoors() - m_vecFixedModeSource; return true;
fwd.z = 0.0f;
// too far and driving away from cam fwd = FindPlayerCoors() - m_vecFixedModeSource;
if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) fwd.z = 0.0f;
return true;
// too close // too far and driving away from cam
if(fwd.Magnitude() < 1.6f) if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true; return true;
return false; // too close
} if(fwd.Magnitude() < 1.6f)
return true; return true;
return false;
case OBBE_2: case OBBE_2:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat()) if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true; return true;
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
fwd = FindPlayerCoors() - m_vecFixedModeSource; return true;
fwd.z = 0.0f;
if(fwd.Magnitude() < 2.0f) fwd = FindPlayerCoors() - m_vecFixedModeSource;
// very close, fix near clip fwd.z = 0.0f;
SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f));
// too far and driving away from cam if(fwd.Magnitude() < 2.0f)
if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) // very close, fix near clip
return true; SetNearClipScript(Max(fwd.Magnitude()*0.5f, 0.05f));
// too close // too far and driving away from cam
if(fwd.Magnitude() < 1.6f) if(fwd.Magnitude() > 19.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true; return true;
return false; // too close
} if(fwd.Magnitude() < 1.6f)
return true; return true;
return false;
case OBBE_3: case OBBE_3:
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
fwd = FindPlayerCoors() - m_vecFixedModeSource; return true;
fwd.z = 0.0f;
// too far and driving away from cam fwd = FindPlayerCoors() - m_vecFixedModeSource;
if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) fwd.z = 0.0f;
return true;
return false; // too far and driving away from cam
} if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true; return true;
return false;
case OBBE_1STPERSON: case OBBE_1STPERSON:
return CTimer::GetTimeInMilliseconds() > t+3000; return CTimer::GetTimeInMilliseconds() > t+3000;
case OBBE_5: case OBBE_5:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat()) if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true; return true;
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
fwd = FindPlayerCoors() - m_vecFixedModeSource; return true;
fwd.z = 0.0f;
// too far and driving away from cam fwd = FindPlayerCoors() - m_vecFixedModeSource;
if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) fwd.z = 0.0f;
return true;
return false; // too far and driving away from cam
} if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true; return true;
return false;
case OBBE_ONSTRING: case OBBE_ONSTRING:
return CTimer::GetTimeInMilliseconds() > t+3000; return CTimer::GetTimeInMilliseconds() > t+3000;
case OBBE_COPCAR: case OBBE_COPCAR:
@ -2348,59 +2581,58 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
case OBBE_COPCAR_WHEEL: case OBBE_COPCAR_WHEEL:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat()) if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
return true; return true;
if(CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(pTargetEntity->GetPosition(), Cams[ActiveCam].Source, true, false, false, false, false, false, false))
if(CTimer::GetTimeInMilliseconds() > t+1000) return true;
return true; if(CTimer::GetTimeInMilliseconds() > t+1000)
SetNearClipScript(0.6f); return true;
return false; SetNearClipScript(0.6f);
} return false;
return true;
// Ped modes // Ped modes
case OBBE_9: case OBBE_9:
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
fwd = FindPlayerCoors() - m_vecFixedModeSource; return true;
fwd.z = 0.0f;
// too far and driving away from cam fwd = FindPlayerCoors() - m_vecFixedModeSource;
if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) fwd.z = 0.0f;
return true;
return false; // too far and driving away from cam
} if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true; return true;
return false;
case OBBE_10: case OBBE_10:
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
fwd = FindPlayerCoors() - m_vecFixedModeSource; return true;
fwd.z = 0.0f;
// too far and driving away from cam fwd = FindPlayerCoors() - m_vecFixedModeSource;
if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) fwd.z = 0.0f;
return true;
return false; // too far and driving away from cam
} if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true; return true;
return false;
case OBBE_11: case OBBE_11:
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
fwd = FindPlayerCoors() - m_vecFixedModeSource; return true;
fwd.z = 0.0f;
// too far and driving away from cam fwd = FindPlayerCoors() - m_vecFixedModeSource;
if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) fwd.z = 0.0f;
return true;
return false; // too far and driving away from cam
} if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true; return true;
return false;
case OBBE_12: case OBBE_12:
if(CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false)){ if(!CWorld::GetIsLineOfSightClear(FindPlayerCoors(), m_vecFixedModeSource, true, false, false, false, false, false, false))
fwd = FindPlayerCoors() - m_vecFixedModeSource; return true;
fwd.z = 0.0f;
// too far and driving away from cam fwd = FindPlayerCoors() - m_vecFixedModeSource;
if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f) fwd.z = 0.0f;
return true;
return false; // too far and driving away from cam
} if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true; return true;
return false;
case OBBE_13: case OBBE_13:
return CTimer::GetTimeInMilliseconds() > t+5000; return CTimer::GetTimeInMilliseconds() > t+5000;
default: default:
@ -2675,7 +2907,7 @@ CCamera::TryToStartNewCamMode(int obbeMode)
} }
} }
static int32 SequenceOfCams[16] = { int32 SequenceOfCams[16] = {
OBBE_WHEEL, OBBE_COPCAR, OBBE_3, OBBE_1, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_WHEEL, OBBE_COPCAR, OBBE_3, OBBE_1, OBBE_3, OBBE_COPCAR_WHEEL,
OBBE_2, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_COPCAR, OBBE_2, OBBE_3, OBBE_2, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_COPCAR, OBBE_2, OBBE_3,
OBBE_5, OBBE_3, OBBE_5, OBBE_3,
@ -2711,7 +2943,7 @@ CCamera::ProcessObbeCinemaCameraCar(void)
bDidWeProcessAnyCinemaCam = true; bDidWeProcessAnyCinemaCam = true;
} }
static int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 }; int32 SequenceOfPedCams[5] = { OBBE_9, OBBE_10, OBBE_11, OBBE_12, OBBE_13 };
void void
CCamera::ProcessObbeCinemaCameraPed(void) CCamera::ProcessObbeCinemaCameraPed(void)
@ -2890,6 +3122,13 @@ CCamera::Process_Train_Camera_Control(void)
if(node >= m_uiNumberOfTrainCamNodes) if(node >= m_uiNumberOfTrainCamNodes)
node = 0; node = 0;
} }
#ifdef FIX_BUGS
// Not really a bug but be nice and respect the debug mode
if(DebugCamMode){
TakeControl(target, DebugCamMode, JUMP_CUT, CAMCONTROL_SCRIPT);
return;
}
#endif
if(found){ if(found){
SetWideScreenOn(); SetWideScreenOn();
@ -3243,7 +3482,7 @@ CCamera::GetLookDirection(void)
Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT || Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED) Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED)
return Cams[ActiveCam].DirectionWasLooking; return Cams[ActiveCam].DirectionWasLooking;
return LOOKING_FORWARD;; return LOOKING_FORWARD;
} }
bool bool
@ -3301,12 +3540,13 @@ CCamera::UpdateAimingCoors(CVector const &coors)
m_cvecAimingTargetCoors = coors; m_cvecAimingTargetCoors = coors;
} }
void bool
CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target) CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target)
{ {
if(CPad::GetPad(0)->GetLookBehindForPed()){ if(CPad::GetPad(0)->GetLookBehindForPed()){
source = pos; source = pos;
target = dist*Cams[ActiveCam].CamTargetEntity->GetForward() + source; target = dist*Cams[ActiveCam].CamTargetEntity->GetForward() + source;
return false;
}else{ }else{
float angleX = DEGTORAD((m_f3rdPersonCHairMultX-0.5f) * 1.8f * 0.5f * Cams[ActiveCam].FOV * CDraw::GetAspectRatio()); float angleX = DEGTORAD((m_f3rdPersonCHairMultX-0.5f) * 1.8f * 0.5f * Cams[ActiveCam].FOV * CDraw::GetAspectRatio());
float angleY = DEGTORAD((0.5f-m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV); float angleY = DEGTORAD((0.5f-m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV);
@ -3315,9 +3555,9 @@ CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source,
target += Cams[ActiveCam].Up * Tan(angleY); target += Cams[ActiveCam].Up * Tan(angleY);
target += CrossProduct(Cams[ActiveCam].Front, Cams[ActiveCam].Up) * Tan(angleX); target += CrossProduct(Cams[ActiveCam].Front, Cams[ActiveCam].Up) * Tan(angleX);
target.Normalise(); target.Normalise();
float dot = DotProduct(pos - source, target); source += DotProduct(pos - source, target)*target;
source += dot*target;
target = dist*target + source; target = dist*target + source;
return true;
} }
} }
@ -3346,7 +3586,7 @@ CCamera::CalculateDerivedValues(void)
{ {
m_cameraMatrix = Invert(m_matrix); m_cameraMatrix = Invert(m_matrix);
float hfov = DEGTORAD(CDraw::GetFOV()/2.0f); float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
float c = cos(hfov); float c = cos(hfov);
float s = sin(hfov); float s = sin(hfov);

View File

@ -188,7 +188,6 @@ public:
CPed *m_pLastPedLookedAt;// So interpolation works CPed *m_pLastPedLookedAt;// So interpolation works
bool m_bFirstPersonRunAboutActive; bool m_bFirstPersonRunAboutActive;
CCam(void) { Init(); } CCam(void) { Init(); }
void Init(void); void Init(void);
void Process(void); void Process(void);
@ -250,11 +249,11 @@ public:
// CCam::Process_Look_At_Cars // CCam::Process_Look_At_Cars
// CCam::Process_CheesyZoom // CCam::Process_CheesyZoom
// CCam::Process_Aiming // CCam::Process_Aiming
// CCam::Process_Bill // same as BehindCar due to unused variables void Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar);
// CCam::Process_Im_The_Passenger_Woo_Woo void Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float);
// CCam::Process_Blood_On_The_Tracks void Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float);
// CCam::Process_Cam_Running_Side_Train void Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float);
// CCam::Process_Cam_On_Train_Roof void Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float);
// custom stuff // custom stuff
void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float); void Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float);
@ -426,9 +425,12 @@ public:
float CarZoomValueSmooth; float CarZoomValueSmooth;
float DistanceToWater; float DistanceToWater;
#ifndef PS2_CAM_TRANSITION
float FOVDuringInter; float FOVDuringInter;
#endif
float LODDistMultiplier; float LODDistMultiplier;
float GenerationDistMultiplier; float GenerationDistMultiplier;
#ifndef PS2_CAM_TRANSITION
float m_fAlphaSpeedAtStartInter; float m_fAlphaSpeedAtStartInter;
float m_fAlphaWhenInterPol; float m_fAlphaWhenInterPol;
float m_fAlphaDuringInterPol; float m_fAlphaDuringInterPol;
@ -439,6 +441,7 @@ public:
float m_fFOVSpeedAtStartInter; float m_fFOVSpeedAtStartInter;
float m_fStartingBetaForInterPol; float m_fStartingBetaForInterPol;
float m_fStartingAlphaForInterPol; float m_fStartingAlphaForInterPol;
#endif
float m_PedOrientForBehindOrInFront; float m_PedOrientForBehindOrInFront;
float m_CameraAverageSpeed; float m_CameraAverageSpeed;
float m_CameraSpeedSoFar; float m_CameraSpeedSoFar;
@ -488,7 +491,7 @@ public:
CVector m_vecFixedModeSource; CVector m_vecFixedModeSource;
CVector m_vecFixedModeUpOffSet; CVector m_vecFixedModeUpOffSet;
CVector m_vecCutSceneOffset; CVector m_vecCutSceneOffset;
#ifndef PS2_CAM_TRANSITION
CVector m_cvecStartingSourceForInterPol; CVector m_cvecStartingSourceForInterPol;
CVector m_cvecStartingTargetForInterPol; CVector m_cvecStartingTargetForInterPol;
CVector m_cvecStartingUpForInterPol; CVector m_cvecStartingUpForInterPol;
@ -498,11 +501,13 @@ public:
CVector m_vecSourceWhenInterPol; CVector m_vecSourceWhenInterPol;
CVector m_vecTargetWhenInterPol; CVector m_vecTargetWhenInterPol;
CVector m_vecUpWhenInterPol; CVector m_vecUpWhenInterPol;
#endif
CVector m_vecGameCamPos; CVector m_vecGameCamPos;
#ifndef PS2_CAM_TRANSITION
CVector SourceDuringInter; CVector SourceDuringInter;
CVector TargetDuringInter; CVector TargetDuringInter;
CVector UpDuringInter; CVector UpDuringInter;
#endif
RwCamera *m_pRwCamera; RwCamera *m_pRwCamera;
CEntity *pTargetEntity; CEntity *pTargetEntity;
CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES]; CCamPathSplines m_arrPathArray[MAX_NUM_OF_SPLINETYPES];
@ -518,14 +523,13 @@ public:
CVector m_vecOldSourceForInter; CVector m_vecOldSourceForInter;
CVector m_vecOldFrontForInter; CVector m_vecOldFrontForInter;
CVector m_vecOldUpForInter; CVector m_vecOldUpForInter;
float m_vecOldFOVForInter; float m_vecOldFOVForInter;
float m_fFLOATingFade; float m_fFLOATingFade;
float m_fFLOATingFadeMusic; float m_fFLOATingFadeMusic;
float m_fTimeToFadeOut; float m_fTimeToFadeOut;
float m_fTimeToFadeMusic; float m_fTimeToFadeMusic;
float m_fFractionInterToStopMovingTarget; float m_fFractionInterToStopMoving;
float m_fFractionInterToStopCatchUpTarget; float m_fFractionInterToStopCatchUp;
float m_fGaitSwayBuffer; float m_fGaitSwayBuffer;
float m_fScriptPercentageInterToStopMoving; float m_fScriptPercentageInterToStopMoving;
float m_fScriptPercentageInterToCatchUp; float m_fScriptPercentageInterToCatchUp;
@ -624,7 +628,7 @@ public:
void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom); void SetNewPlayerWeaponMode(int16 mode, int16 minZoom, int16 maxZoom);
void ClearPlayerWeaponMode(void); void ClearPlayerWeaponMode(void);
void UpdateAimingCoors(CVector const &coors); void UpdateAimingCoors(CVector const &coors);
void Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target); bool Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
float Find3rdPersonQuickAimPitch(void); float Find3rdPersonQuickAimPitch(void);
// Physical camera // Physical camera

View File

@ -548,18 +548,18 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
return false; return false;
for(i = 0; i < model.numSpheres; i++) for(i = 0; i < model.numSpheres; i++)
if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH)
if(TestLineSphere(newline, model.spheres[i])) if(TestLineSphere(newline, model.spheres[i]))
return true; return true;
for(i = 0; i < model.numBoxes; i++) for(i = 0; i < model.numBoxes; i++)
if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH)
if(TestLineBox(newline, model.boxes[i])) if(TestLineBox(newline, model.boxes[i]))
return true; return true;
CalculateTrianglePlanes(&model); CalculateTrianglePlanes(&model);
for(i = 0; i < model.numTriangles; i++) for(i = 0; i < model.numTriangles; i++)
if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH)
if(TestLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i])) if(TestLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i]))
return true; return true;
@ -1179,16 +1179,16 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float coldist = mindist; float coldist = mindist;
for(i = 0; i < model.numSpheres; i++) for(i = 0; i < model.numSpheres; i++)
if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineSphere(newline, model.spheres[i], point, coldist); ProcessLineSphere(newline, model.spheres[i], point, coldist);
for(i = 0; i < model.numBoxes; i++) for(i = 0; i < model.numBoxes; i++)
if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineBox(newline, model.boxes[i], point, coldist); ProcessLineBox(newline, model.boxes[i], point, coldist);
CalculateTrianglePlanes(&model); CalculateTrianglePlanes(&model);
for(i = 0; i < model.numTriangles; i++) for(i = 0; i < model.numTriangles; i++)
if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist); ProcessLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist);
if(coldist < mindist){ if(coldist < mindist){
@ -1219,17 +1219,17 @@ CCollision::ProcessVerticalLine(const CColLine &line,
float coldist = mindist; float coldist = mindist;
for(i = 0; i < model.numSpheres; i++) for(i = 0; i < model.numSpheres; i++)
if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.spheres[i].surface != SURFACE_GLASS && model.spheres[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineSphere(newline, model.spheres[i], point, coldist); ProcessLineSphere(newline, model.spheres[i], point, coldist);
for(i = 0; i < model.numBoxes; i++) for(i = 0; i < model.numBoxes; i++)
if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.boxes[i].surface != SURFACE_GLASS && model.boxes[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessLineBox(newline, model.boxes[i], point, coldist); ProcessLineBox(newline, model.boxes[i], point, coldist);
CalculateTrianglePlanes(&model); CalculateTrianglePlanes(&model);
TempStoredPoly.valid = false; TempStoredPoly.valid = false;
for(i = 0; i < model.numTriangles; i++) for(i = 0; i < model.numTriangles; i++)
if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_SCAFFOLD) if(!ignoreSeeThrough || model.triangles[i].surface != SURFACE_GLASS && model.triangles[i].surface != SURFACE_TRANSPARENT_CLOTH)
ProcessVerticalLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist, &TempStoredPoly); ProcessVerticalLineTriangle(newline, model.vertices, model.triangles[i], model.trianglePlanes[i], point, coldist, &TempStoredPoly);
if(coldist < mindist){ if(coldist < mindist){
@ -1758,15 +1758,15 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
b *= f; b *= f;
} }
if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE || if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE ||
s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE) s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE)
if(CTimer::GetFrameCounter() & 1){ if(CTimer::GetFrameCounter() & 1){
r = 0; r = 0;
g = 0; g = 0;
b = 0; b = 0;
} }
if(s > SURFACE_GATE){ if(s > SURFACE_METAL_GATE){
r = CGeneral::GetRandomNumber(); r = CGeneral::GetRandomNumber();
g = CGeneral::GetRandomNumber(); g = CGeneral::GetRandomNumber();
b = CGeneral::GetRandomNumber(); b = CGeneral::GetRandomNumber();
@ -1839,8 +1839,8 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
b *= f; b *= f;
} }
if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE || if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE ||
s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE) s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE)
if(CTimer::GetFrameCounter() & 1){ if(CTimer::GetFrameCounter() & 1){
r = 0; r = 0;
g = 0; g = 0;

View File

@ -945,7 +945,7 @@ CFileLoader::Load2dEffect(const char *line)
&effect->light.dist, &effect->light.dist,
&effect->light.range, &effect->light.range,
&effect->light.size, &effect->light.size,
&effect->light.shadowRange, &effect->light.shadowSize,
&shadowIntens, &lightType, &roadReflection, &flare, &flags); &shadowIntens, &lightType, &roadReflection, &flare, &flags);
effect->light.corona = RwTextureRead(corona, nil); effect->light.corona = RwTextureRead(corona, nil);
effect->light.shadow = RwTextureRead(shadow, nil); effect->light.shadow = RwTextureRead(shadow, nil);
@ -977,7 +977,7 @@ CFileLoader::Load2dEffect(const char *line)
&effect->attractor.dir.y, &effect->attractor.dir.y,
&effect->attractor.dir.z, &effect->attractor.dir.z,
&probability); &probability);
effect->attractor.flags = flags; effect->attractor.type = flags;
effect->attractor.probability = probability; effect->attractor.probability = probability;
break; break;
} }

File diff suppressed because it is too large Load Diff

View File

@ -234,7 +234,7 @@ enum eMenuScreen
MENUPAGE_SKIN_SELECT = 54, MENUPAGE_SKIN_SELECT = 54,
MENUPAGE_KEYBOARD_CONTROLS = 55, MENUPAGE_KEYBOARD_CONTROLS = 55,
MENUPAGE_MOUSE_CONTROLS = 56, MENUPAGE_MOUSE_CONTROLS = 56,
MENUPAGE_57 = 57, // mission failed, wanna restart page in mobile MENUPAGE_MISSION_RETRY = 57,
MENUPAGE_58 = 58, MENUPAGE_58 = 58,
#ifdef MENU_MAP #ifdef MENU_MAP
MENUPAGE_MAP = 59, MENUPAGE_MAP = 59,
@ -316,7 +316,7 @@ enum eMenuAction
MENUACTION_UNK69, MENUACTION_UNK69,
MENUACTION_UNK70, MENUACTION_UNK70,
MENUACTION_FINDMP, MENUACTION_FINDMP,
MENUACTION_REDEFCTRL, MENUACTION_KEYBOARDCTRLS,
MENUACTION_UNK73, MENUACTION_UNK73,
MENUACTION_INITMP, MENUACTION_INITMP,
MENUACTION_MP_PLAYERCOLOR, MENUACTION_MP_PLAYERCOLOR,
@ -355,13 +355,12 @@ enum eMenuAction
MENUACTION_UNK108, MENUACTION_UNK108,
MENUACTION_UNK109, MENUACTION_UNK109,
MENUACTION_UNK110, MENUACTION_UNK110,
#ifdef MORE_LANGUAGES MENUACTION_UNK111,
MENUACTION_LANG_PL, MENUACTION_UNK112,
MENUACTION_LANG_RUS, MENUACTION_REJECT_RETRY,
MENUACTION_LANG_JAP, MENUACTION_UNK114,
#endif #ifdef CUSTOM_FRONTEND_OPTIONS
#ifdef IMPROVED_VIDEOMODE MENUACTION_TRIGGERFUNC
MENUACTION_SCREENMODE
#endif #endif
}; };
@ -457,7 +456,7 @@ struct CMenuScreen
int32 m_Action; // eMenuAction int32 m_Action; // eMenuAction
char m_EntryName[8]; char m_EntryName[8];
int32 m_SaveSlot; // eSaveSlot int32 m_SaveSlot; // eSaveSlot
int32 m_TargetMenu; // eMenuScreen int32 m_TargetMenu; // eMenuScreen // FrontendOption ID if it's a custom option
} m_aEntries[NUM_MENUROWS]; } m_aEntries[NUM_MENUROWS];
}; };
@ -649,12 +648,14 @@ public:
int GetNumOptionsCntrlConfigScreens(); int GetNumOptionsCntrlConfigScreens();
int ConstructStatLine(int); int ConstructStatLine(int);
// New (not in function or inlined in the game) // Those are either inlined in game, not in function yet, or I can't believe that they're not inlined.
void ThingsToDoBeforeLeavingPage(); // Names were made up by me.
void ThingsToDoBeforeGoingBack();
void ScrollUpListByOne(); void ScrollUpListByOne();
void ScrollDownListByOne(); void ScrollDownListByOne();
void PageUpList(bool); void PageUpList(bool);
void PageDownList(bool); void PageDownList(bool);
int8 GetPreviousPageOption();
// uint8 GetNumberOfMenuOptions(); // uint8 GetNumberOfMenuOptions();
}; };
@ -664,4 +665,6 @@ VALIDATE_SIZE(CMenuManager, 0x564);
#endif #endif
extern CMenuManager FrontEndMenuManager; extern CMenuManager FrontEndMenuManager;
extern CMenuScreen aScreens[];
#endif #endif

View File

@ -86,8 +86,7 @@
#include "ZoneCull.h" #include "ZoneCull.h"
#include "Zones.h" #include "Zones.h"
#include "debugmenu.h" #include "debugmenu.h"
#include "frontendoption.h"
eLevelName CGame::currLevel; eLevelName CGame::currLevel;
bool CGame::bDemoMode = true; bool CGame::bDemoMode = true;
@ -272,6 +271,9 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetMusicFadeVol(127); DMAudio.SetMusicFadeVol(127);
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile); CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
#ifdef CUSTOM_FRONTEND_OPTIONS
CustomFrontendOptionsPopulate();
#endif
return true; return true;
} }

View File

@ -1,17 +1,14 @@
#pragma once #include "common.h"
#include "Frontend.h"
// TODO: There are some missing/wrong entries in here. // If you want to add new options, please don't do that here and see CustomFrontendOptionsPopulate in re3.cpp.
const CMenuScreen aScreens[] = { CMenuScreen aScreens[] = {
// MENUPAGE_NONE = 0 // MENUPAGE_NONE = 0
{ "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, }, { "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// MENUPAGE_STATS = 1 // MENUPAGE_STATS = 1
#ifdef MENU_MAP
{ "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 3,
#else
{ "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2, { "FET_STA", 1, MENUPAGE_NONE, MENUPAGE_NONE, 5, 2,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
@ -24,11 +21,7 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_BRIEFS = 3 // MENUPAGE_BRIEFS = 3
#ifdef MENU_MAP
{ "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 4,
#else
{ "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3, { "FET_BRE", 1, MENUPAGE_NONE, MENUPAGE_NONE, 6, 3,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
@ -62,52 +55,44 @@ const CMenuScreen aScreens[] = {
MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_SUBTITLES, "FED_SUB", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_WIDESCREEN, "FED_WIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_SCREENRES, "FED_RES", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
#ifdef IMPROVED_VIDEOMODE
MENUACTION_SCREENMODE, "SCRFOR", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
#endif
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_LANGUAGE_SETTINGS = 7 // MENUPAGE_LANGUAGE_SETTINGS = 7
{ "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3, { "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
#ifdef MORE_LANGUAGES
MENUACTION_LANG_PL, "FEL_POL", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_RUS, "FEL_RUS", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_JAP, "FEL_JAP", SAVESLOT_NONE, MENUPAGE_NONE,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_CHOOSE_LOAD_SLOT = 8 // MENUPAGE_CHOOSE_LOAD_SLOT = 8
{ "FET_LG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1, { "FET_LG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL0", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM, MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM,
}, },
// MENUPAGE_CHOOSE_DELETE_SLOT = 9 // MENUPAGE_CHOOSE_DELETE_SLOT = 9
{ "FET_DG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2, { "FET_DG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL0", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL3", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL4", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL5", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL6", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM, MENUACTION_CHANGEMENU, "FEM_SL7", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
}, },
// MENUPAGE_NEW_GAME_RELOAD = 10 // MENUPAGE_NEW_GAME_RELOAD = 10
@ -284,7 +269,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_CONTROLLER_PC = 35 // MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0, { "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CTRLMETHOD, "FET_CME", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS, MENUACTION_KEYBOARDCTRLS,"FET_RDK", SAVESLOT_NONE, MENUPAGE_KEYBOARD_CONTROLS,
MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_CHANGEMENU, "FET_AMS", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
@ -333,11 +318,7 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_OPTIONS = 41 // MENUPAGE_OPTIONS = 41
#ifdef MENU_MAP
{ "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 5,
#else
{ "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4, { "FET_OPT", 1, MENUPAGE_NONE, MENUPAGE_NONE, 1, 4,
#endif
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC, MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS, MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS, MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@ -347,13 +328,9 @@ const CMenuScreen aScreens[] = {
}, },
// MENUPAGE_EXIT = 42 // MENUPAGE_EXIT = 42
#ifdef MENU_MAP
{ "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 6,
#else
{ "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5, { "FET_QG", 1, MENUPAGE_NONE, MENUPAGE_NONE, 2, 5,
#endif
MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_LABEL, "FEQ_SRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_DONTCANCEL, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CANCELGAME, "FEM_YES", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
@ -412,9 +389,6 @@ const CMenuScreen aScreens[] = {
{ "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, { "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME, MENUACTION_CHANGEMENU, "FEN_STA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
#ifdef MENU_MAP
MENUACTION_CHANGEMENU, "FEG_MAP", SAVESLOT_NONE, MENUPAGE_MAP,
#endif
MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS, MENUACTION_CHANGEMENU, "FEP_STA", SAVESLOT_NONE, MENUPAGE_STATS,
MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS, MENUACTION_CHANGEMENU, "FEP_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS, MENUACTION_CHANGEMENU, "FET_OPT", SAVESLOT_NONE, MENUPAGE_OPTIONS,
@ -445,11 +419,19 @@ const CMenuScreen aScreens[] = {
MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS, MENUACTION_MOUSESTEER, "FET_MST", SAVESLOT_NONE, MENUPAGE_MOUSE_CONTROLS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
// MENUPAGE_MISSION_RETRY = 57
#ifdef MISSION_REPLAY
// MENUPAGE_57 = 57 { "M_FAIL", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FESZ_RM", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_CHANGEMENU, "FEM_YES", SAVESLOT_NONE, MENUPAGE_LOADING_IN_PROGRESS,
MENUACTION_REJECT_RETRY, "FEM_NO", SAVESLOT_NONE, MENUPAGE_NONE
},
#else
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0, { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
// mission failed, wanna restart page in mobile // mission failed, wanna restart page in mobile
}, },
#endif
// MENUPAGE_58 = 58 // MENUPAGE_58 = 58
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0, { "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,
@ -463,4 +445,4 @@ const CMenuScreen aScreens[] = {
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE, MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
}, },
#endif #endif
}; };

View File

@ -1068,8 +1068,8 @@ void CPad::UpdatePads(void)
GetPad(0)->UpdateMouse(); GetPad(0)->UpdateMouse();
#ifdef XINPUT #ifdef XINPUT
GetPad(0)->AffectFromXinput(0); GetPad(0)->AffectFromXinput(m_bMapPadOneToPadTwo ? 1 : 0);
GetPad(1)->AffectFromXinput(1); GetPad(1)->AffectFromXinput(m_bMapPadOneToPadTwo ? 0 : 1);
#else #else
CapturePad(0); CapturePad(0);
#endif #endif

View File

@ -2,14 +2,14 @@
enum { enum {
PLAYERCONTROL_ENABLED = 0, PLAYERCONTROL_ENABLED = 0,
PLAYERCONTROL_DISABLED_1 = 1, // used by first person camera PLAYERCONTROL_CAMERA = 1,
PLAYERCONTROL_DISABLED_2 = 2, PLAYERCONTROL_UNK2 = 2,
PLAYERCONTROL_GARAGE = 4, PLAYERCONTROL_GARAGE = 4,
PLAYERCONTROL_DISABLED_8 = 8, PLAYERCONTROL_UNK8 = 8,
PLAYERCONTROL_DISABLED_10 = 16, PLAYERCONTROL_UNK10 = 16,
PLAYERCONTROL_DISABLED_20 = 32, // used on CPlayerInfo::MakePlayerSafe PLAYERCONTROL_PLAYERINFO = 32,
PLAYERCONTROL_DISABLED_40 = 64, // used on phone calls PLAYERCONTROL_PHONE = 64,
PLAYERCONTROL_DISABLED_80 = 128,// used on cutscenes PLAYERCONTROL_CUTSCENE = 128,
}; };
class CControllerState class CControllerState
@ -442,6 +442,7 @@ public:
bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; } bool GetLeftShoulder2(void) { return !!NewState.LeftShoulder2; }
bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; } bool GetRightShoulder1(void) { return !!NewState.RightShoulder1; }
bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; } bool GetRightShoulder2(void) { return !!NewState.RightShoulder2; }
bool GetStart() { return !!NewState.Start; }
int16 GetLeftStickX(void) { return NewState.LeftStickX; } int16 GetLeftStickX(void) { return NewState.LeftStickX; }
int16 GetLeftStickY(void) { return NewState.LeftStickY; } int16 GetLeftStickY(void) { return NewState.LeftStickY; }
int16 GetRightStickX(void) { return NewState.RightStickX; } int16 GetRightStickX(void) { return NewState.RightStickX; }

View File

@ -174,7 +174,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
CTheScripts::ResetCountdownToMakePlayerUnsafe(); CTheScripts::ResetCountdownToMakePlayerUnsafe();
m_pPed->m_pWanted->m_bIgnoredByEveryone = true; m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
CWorld::StopAllLawEnforcersInTheirTracks(); CWorld::StopAllLawEnforcersInTheirTracks();
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20; CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
CPad::StopPadsShaking(); CPad::StopPadsShaking();
m_pPed->bBulletProof = true; m_pPed->bBulletProof = true;
m_pPed->bFireProof = true; m_pPed->bFireProof = true;
@ -194,7 +194,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
} else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) { } else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
m_pPed->m_pWanted->m_bIgnoredByEveryone = false; m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20; CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_PLAYERINFO);
m_pPed->bBulletProof = false; m_pPed->bBulletProof = false;
m_pPed->bFireProof = false; m_pPed->bFireProof = false;
m_pPed->bCollisionProof = false; m_pPed->bCollisionProof = false;
@ -397,7 +397,7 @@ CPlayerInfo::Process(void)
else else
enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle(); enterOrExitVeh = CPad::GetPad(0)->GetExitVehicle();
if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_ODE) { if (enterOrExitVeh && m_pPed->m_nPedState != PED_SNIPER_MODE && m_pPed->m_nPedState != PED_ROCKET_MODE) {
if (m_pPed->bInVehicle) { if (m_pPed->bInVehicle) {
if (!m_pRemoteVehicle) { if (!m_pRemoteVehicle) {
CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity; CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;

View File

@ -4,6 +4,9 @@
#include "Boat.h" #include "Boat.h"
#include "CarCtrl.h" #include "CarCtrl.h"
#ifdef MISSION_REPLAY
#include "GenericGameStorage.h"
#endif
#include "Population.h" #include "Population.h"
#include "ProjectileInfo.h" #include "ProjectileInfo.h"
#include "Streaming.h" #include "Streaming.h"
@ -206,11 +209,24 @@ INITSAVEBUF
if (pVehicle->pPassengers[j]) if (pVehicle->pPassengers[j])
bHasPassenger = true; bHasPassenger = true;
} }
#ifdef MISSION_REPLAY
bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave;
#ifdef FIX_BUGS
if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) {
#else
if (!pVehicle->pDriver && !bHasPassenger) {
#endif
if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
++nNumCars;
if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving))
++nNumBoats;
#else
if (!pVehicle->pDriver && !bHasPassenger) { if (!pVehicle->pDriver && !bHasPassenger) {
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumCars; ++nNumCars;
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE)
++nNumBoats; ++nNumBoats;
#endif
} }
} }
*size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) + *size = nNumCars * (sizeof(uint32) + sizeof(int16) + sizeof(int32) + CAutomobile::nSaveStructSize) + sizeof(int) +
@ -226,23 +242,42 @@ INITSAVEBUF
if (pVehicle->pPassengers[j]) if (pVehicle->pPassengers[j])
bHasPassenger = true; bHasPassenger = true;
} }
#ifdef MISSION_REPLAY
bool bForceSaving = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pMyVehicle == pVehicle && IsQuickSave;
#endif
#if defined FIX_BUGS && defined MISSION_REPLAY
if ((!pVehicle->pDriver && !bHasPassenger) || bForceSaving) {
#else
if (!pVehicle->pDriver && !bHasPassenger) { if (!pVehicle->pDriver && !bHasPassenger) {
#endif
#ifdef COMPATIBLE_SAVES #ifdef COMPATIBLE_SAVES
#ifdef MISSION_REPLAY
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
#else
if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { if ((pVehicle->IsCar() || pVehicle->IsBoat()) && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
#endif
WriteSaveBuf<uint32>(buf, pVehicle->m_vehType); WriteSaveBuf<uint32>(buf, pVehicle->m_vehType);
WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex()); WriteSaveBuf<int16>(buf, pVehicle->GetModelIndex());
WriteSaveBuf<int32>(buf, GetVehicleRef(pVehicle)); WriteSaveBuf<int32>(buf, GetVehicleRef(pVehicle));
pVehicle->Save(buf); pVehicle->Save(buf);
} }
#else
#ifdef MISSION_REPLAY
if (pVehicle->IsCar() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
#else #else
if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { if (pVehicle->IsCar() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
#endif
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle)); WriteSaveBuf(buf, GetVehicleRef(pVehicle));
memcpy(buf, pVehicle, sizeof(CAutomobile)); memcpy(buf, pVehicle, sizeof(CAutomobile));
SkipSaveBuf(buf, sizeof(CAutomobile)); SkipSaveBuf(buf, sizeof(CAutomobile));
} }
#ifdef MISSION_REPLAY
if (pVehicle->IsBoat() && (pVehicle->VehicleCreatedBy == MISSION_VEHICLE || bForceSaving)) {
#else
if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) { if (pVehicle->IsBoat() && pVehicle->VehicleCreatedBy == MISSION_VEHICLE) {
#endif
WriteSaveBuf(buf, (uint32)pVehicle->m_vehType); WriteSaveBuf(buf, (uint32)pVehicle->m_vehType);
WriteSaveBuf(buf, pVehicle->GetModelIndex()); WriteSaveBuf(buf, pVehicle->GetModelIndex());
WriteSaveBuf(buf, GetVehicleRef(pVehicle)); WriteSaveBuf(buf, GetVehicleRef(pVehicle));
@ -400,7 +435,11 @@ INITSAVEBUF
CPed* pPed = GetPedPool()->GetSlot(i); CPed* pPed = GetPedPool()->GetSlot(i);
if (!pPed) if (!pPed)
continue; continue;
#ifdef MISSION_REPLAY
if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1)
#else
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1)
#endif
nNumPeds++; nNumPeds++;
} }
*size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + CPlayerPed::nSaveStructSize + *size = sizeof(int) + nNumPeds * (sizeof(uint32) + sizeof(int16) + sizeof(int) + CPlayerPed::nSaveStructSize +
@ -410,7 +449,11 @@ INITSAVEBUF
CPed* pPed = GetPedPool()->GetSlot(i); CPed* pPed = GetPedPool()->GetSlot(i);
if (!pPed) if (!pPed)
continue; continue;
#ifdef MISSION_REPLAY
if ((!pPed->bInVehicle || (pPed == CWorld::Players[CWorld::PlayerInFocus].m_pPed && IsQuickSave)) && pPed->m_nPedType == PEDTYPE_PLAYER1) {
#else
if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) { if (!pPed->bInVehicle && pPed->m_nPedType == PEDTYPE_PLAYER1) {
#endif
CopyToBuf(buf, pPed->m_nPedType); CopyToBuf(buf, pPed->m_nPedType);
CopyToBuf(buf, pPed->m_modelIndex); CopyToBuf(buf, pPed->m_modelIndex);
int32 ref = GetPedRef(pPed); int32 ref = GetPedRef(pPed);

View File

@ -26,27 +26,27 @@ enum eRadarSprite
RADAR_SPRITE_COORD_BLIP = -1, RADAR_SPRITE_COORD_BLIP = -1,
#endif #endif
RADAR_SPRITE_NONE = 0, RADAR_SPRITE_NONE = 0,
RADAR_SPRITE_ASUKA = 1, RADAR_SPRITE_ASUKA,
RADAR_SPRITE_BOMB = 2, RADAR_SPRITE_BOMB,
RADAR_SPRITE_CAT = 3, RADAR_SPRITE_CAT,
RADAR_SPRITE_CENTRE = 4, RADAR_SPRITE_CENTRE,
RADAR_SPRITE_COPCAR = 5, RADAR_SPRITE_COPCAR,
RADAR_SPRITE_DON = 6, RADAR_SPRITE_DON,
RADAR_SPRITE_EIGHT = 7, RADAR_SPRITE_EIGHT,
RADAR_SPRITE_EL = 8, RADAR_SPRITE_EL,
RADAR_SPRITE_ICE = 9, RADAR_SPRITE_ICE,
RADAR_SPRITE_JOEY = 10, RADAR_SPRITE_JOEY,
RADAR_SPRITE_KENJI = 11, RADAR_SPRITE_KENJI,
RADAR_SPRITE_LIZ = 12, RADAR_SPRITE_LIZ,
RADAR_SPRITE_LUIGI = 13, RADAR_SPRITE_LUIGI,
RADAR_SPRITE_NORTH = 14, RADAR_SPRITE_NORTH,
RADAR_SPRITE_RAY = 15, RADAR_SPRITE_RAY,
RADAR_SPRITE_SAL = 16, RADAR_SPRITE_SAL,
RADAR_SPRITE_SAVE = 17, RADAR_SPRITE_SAVE,
RADAR_SPRITE_SPRAY = 18, RADAR_SPRITE_SPRAY,
RADAR_SPRITE_TONY = 19, RADAR_SPRITE_TONY,
RADAR_SPRITE_WEAPON = 20, RADAR_SPRITE_WEAPON,
RADAR_SPRITE_COUNT = 21, RADAR_SPRITE_COUNT
}; };
enum enum
@ -104,7 +104,7 @@ public:
static CSprite2d SpraySprite; static CSprite2d SpraySprite;
static CSprite2d TonySprite; static CSprite2d TonySprite;
static CSprite2d WeaponSprite; static CSprite2d WeaponSprite;
static CSprite2d *RadarSprites[21]; static CSprite2d *RadarSprites[RADAR_SPRITE_COUNT];
static float cachedCos; static float cachedCos;
static float cachedSin; static float cachedSin;
#ifdef MENU_MAP #ifdef MENU_MAP

28
src/core/Range2D.cpp Normal file
View File

@ -0,0 +1,28 @@
#include "common.h"
#include "Range2D.h"
#include "General.h"
CRange2D::CRange2D(CVector2D _min, CVector2D _max) : min(_min), max(_max) {}
bool
CRange2D::IsInRange(CVector2D vec)
{
return min.x < vec.x && max.x > vec.x && min.y < vec.y && max.y > vec.y;
}
void
CRange2D::DebugShowRange(float, int)
{
}
CVector2D
CRange2D::GetRandomPointInRange()
{
int distX = Abs(max.x - min.x);
int distY = Abs(max.y - min.y);
float outX = CGeneral::GetRandomNumber() % distX + min.x;
float outY = CGeneral::GetRandomNumber() % distY + min.y;
return CVector2D(outX, outY);
}

11
src/core/Range2D.h Normal file
View File

@ -0,0 +1,11 @@
#pragma once
class CRange2D
{
CVector2D min, max;
public:
CRange2D(CVector2D _min, CVector2D _max);
bool IsInRange(CVector2D vec);
void DebugShowRange(float, int);
CVector2D GetRandomPointInRange();
};

30
src/core/Range3D.cpp Normal file
View File

@ -0,0 +1,30 @@
#include "common.h"
#include "Range3D.h"
#include "General.h"
CRange3D::CRange3D(CVector _min, CVector _max) : min(_min), max(_max) {}
bool
CRange3D::IsInRange(CVector vec)
{
return min.x < vec.x && max.x > vec.x && min.y < vec.y && max.y > vec.y && min.z < vec.z && max.z > vec.z;
}
void
CRange3D::DebugShowRange(float, int)
{
}
CVector
CRange3D::GetRandomPointInRange()
{
int distX = Abs(max.x - min.x);
int distY = Abs(max.y - min.y);
int distZ = Abs(max.z - min.z);
float outX = CGeneral::GetRandomNumber() % distX + min.x;
float outY = CGeneral::GetRandomNumber() % distY + min.y;
float outZ = CGeneral::GetRandomNumber() % distZ + min.z;
return CVector(outX, outY, outZ);
}

11
src/core/Range3D.h Normal file
View File

@ -0,0 +1,11 @@
#pragma once
class CRange3D
{
CVector min, max;
public:
CRange3D(CVector _min, CVector _max);
bool IsInRange(CVector vec);
void DebugShowRange(float, int);
CVector GetRandomPointInRange();
};

View File

@ -10,7 +10,7 @@ public:
TOTAL_HIGHEST_SCORES = 16 TOTAL_HIGHEST_SCORES = 16
}; };
static int32 DaysPassed; static int32 DaysPassed;
static int32 HeadsPopped; static int32 HeadsPopped;
static int32 CommercialPassed; static int32 CommercialPassed;
static int32 IndustrialPassed; static int32 IndustrialPassed;
static int32 SuburbanPassed; static int32 SuburbanPassed;
@ -52,14 +52,14 @@ public:
static int32 LongestFlightInDodo; static int32 LongestFlightInDodo;
static int32 TimeTakenDefuseMission; static int32 TimeTakenDefuseMission;
static int32 TotalNumberKillFrenzies; static int32 TotalNumberKillFrenzies;
static int32 TotalNumberMissions; static int32 TotalNumberMissions;
static int32 RoundsFiredByPlayer; static int32 RoundsFiredByPlayer;
static int32 KgsOfExplosivesUsed; static int32 KgsOfExplosivesUsed;
static int32 InstantHitsFiredByPlayer; static int32 InstantHitsFiredByPlayer;
static int32 InstantHitsHitByPlayer; static int32 InstantHitsHitByPlayer;
static int32 BestTimeBombDefusal; static int32 BestTimeBombDefusal;
static int32 mmRain; static int32 mmRain;
static int32 CarsCrushed; static int32 CarsCrushed;
static int32 FastestTimes[TOTAL_FASTEST_TIMES]; static int32 FastestTimes[TOTAL_FASTEST_TIMES];
static int32 HighestScores[TOTAL_HIGHEST_SCORES]; static int32 HighestScores[TOTAL_HIGHEST_SCORES];

View File

@ -56,40 +56,40 @@ int
CSurfaceTable::GetAdhesionGroup(uint8 surfaceType) CSurfaceTable::GetAdhesionGroup(uint8 surfaceType)
{ {
switch(surfaceType){ switch(surfaceType){
case SURFACE_0: return ADHESIVE_ROAD; case SURFACE_DEFAULT: return ADHESIVE_ROAD;
case SURFACE_1: return ADHESIVE_ROAD; case SURFACE_TARMAC: return ADHESIVE_ROAD;
case SURFACE_2: return ADHESIVE_LOOSE; case SURFACE_GRASS: return ADHESIVE_LOOSE;
case SURFACE_3: return ADHESIVE_LOOSE; case SURFACE_GRAVEL: return ADHESIVE_LOOSE;
case SURFACE_4: return ADHESIVE_HARD; case SURFACE_MUD_DRY: return ADHESIVE_HARD;
case SURFACE_5: return ADHESIVE_ROAD; case SURFACE_PAVEMENT: return ADHESIVE_ROAD;
case SURFACE_6: return ADHESIVE_HARD; case SURFACE_CAR: return ADHESIVE_HARD;
case SURFACE_7: return ADHESIVE_HARD; case SURFACE_GLASS: return ADHESIVE_HARD;
case SURFACE_8: return ADHESIVE_HARD; case SURFACE_TRANSPARENT_CLOTH: return ADHESIVE_HARD;
case SURFACE_9: return ADHESIVE_HARD; case SURFACE_GARAGE_DOOR: return ADHESIVE_HARD;
case SURFACE_10: return ADHESIVE_HARD; case SURFACE_CAR_PANEL: return ADHESIVE_HARD;
case SURFACE_11: return ADHESIVE_HARD; case SURFACE_THICK_METAL_PLATE: return ADHESIVE_HARD;
case SURFACE_12: return ADHESIVE_HARD; case SURFACE_SCAFFOLD_POLE: return ADHESIVE_HARD;
case SURFACE_13: return ADHESIVE_HARD; case SURFACE_LAMP_POST: return ADHESIVE_HARD;
case SURFACE_14: return ADHESIVE_HARD; case SURFACE_FIRE_HYDRANT: return ADHESIVE_HARD;
case SURFACE_15: return ADHESIVE_HARD; case SURFACE_GIRDER: return ADHESIVE_HARD;
case SURFACE_16: return ADHESIVE_HARD; case SURFACE_METAL_CHAIN_FENCE: return ADHESIVE_HARD;
case SURFACE_17: return ADHESIVE_RUBBER; case SURFACE_PED: return ADHESIVE_RUBBER;
case SURFACE_18: return ADHESIVE_LOOSE; case SURFACE_SAND: return ADHESIVE_LOOSE;
case SURFACE_19: return ADHESIVE_WET; case SURFACE_WATER: return ADHESIVE_WET;
case SURFACE_20: return ADHESIVE_ROAD; case SURFACE_WOOD_CRATES: return ADHESIVE_ROAD;
case SURFACE_21: return ADHESIVE_ROAD; case SURFACE_WOOD_BENCH: return ADHESIVE_ROAD;
case SURFACE_22: return ADHESIVE_ROAD; case SURFACE_WOOD_SOLID: return ADHESIVE_ROAD;
case SURFACE_23: return ADHESIVE_RUBBER; case SURFACE_RUBBER: return ADHESIVE_RUBBER;
case SURFACE_24: return ADHESIVE_HARD; case SURFACE_PLASTIC: return ADHESIVE_HARD;
case SURFACE_25: return ADHESIVE_LOOSE; case SURFACE_HEDGE: return ADHESIVE_LOOSE;
case SURFACE_26: return ADHESIVE_LOOSE; case SURFACE_STEEP_CLIFF: return ADHESIVE_LOOSE;
case SURFACE_27: return ADHESIVE_HARD; case SURFACE_CONTAINER: return ADHESIVE_HARD;
case SURFACE_28: return ADHESIVE_HARD; case SURFACE_NEWS_VENDOR: return ADHESIVE_HARD;
case SURFACE_29: return ADHESIVE_RUBBER; case SURFACE_WHEELBASE: return ADHESIVE_RUBBER;
case SURFACE_30: return ADHESIVE_LOOSE; case SURFACE_CARDBOARDBOX: return ADHESIVE_LOOSE;
case SURFACE_31: return ADHESIVE_HARD; case SURFACE_TRANSPARENT_STONE: return ADHESIVE_HARD;
case SURFACE_32: return ADHESIVE_HARD; case SURFACE_METAL_GATE: return ADHESIVE_HARD;
default: return ADHESIVE_ROAD; default: return ADHESIVE_ROAD;
} }
} }
@ -97,38 +97,38 @@ float
CSurfaceTable::GetWetMultiplier(uint8 surfaceType) CSurfaceTable::GetWetMultiplier(uint8 surfaceType)
{ {
switch(surfaceType){ switch(surfaceType){
case SURFACE_0: case SURFACE_DEFAULT:
case SURFACE_1: case SURFACE_TARMAC:
case SURFACE_4: case SURFACE_MUD_DRY:
case SURFACE_5: case SURFACE_PAVEMENT:
case SURFACE_8: case SURFACE_TRANSPARENT_CLOTH:
case SURFACE_20: case SURFACE_WOOD_CRATES:
case SURFACE_21: case SURFACE_WOOD_BENCH:
case SURFACE_22: case SURFACE_WOOD_SOLID:
case SURFACE_25: case SURFACE_HEDGE:
case SURFACE_30: case SURFACE_CARDBOARDBOX:
case SURFACE_31: case SURFACE_TRANSPARENT_STONE:
return 1.0f - CWeather::WetRoads*0.25f; return 1.0f - CWeather::WetRoads*0.25f;
case SURFACE_2: case SURFACE_GRASS:
case SURFACE_6: case SURFACE_CAR:
case SURFACE_7: case SURFACE_GLASS:
case SURFACE_9: case SURFACE_GARAGE_DOOR:
case SURFACE_10: case SURFACE_CAR_PANEL:
case SURFACE_11: case SURFACE_THICK_METAL_PLATE:
case SURFACE_12: case SURFACE_SCAFFOLD_POLE:
case SURFACE_13: case SURFACE_LAMP_POST:
case SURFACE_14: case SURFACE_FIRE_HYDRANT:
case SURFACE_15: case SURFACE_GIRDER:
case SURFACE_16: case SURFACE_METAL_CHAIN_FENCE:
case SURFACE_17: case SURFACE_PED:
case SURFACE_23: case SURFACE_RUBBER:
case SURFACE_24: case SURFACE_PLASTIC:
case SURFACE_26: case SURFACE_STEEP_CLIFF:
case SURFACE_27: case SURFACE_CONTAINER:
case SURFACE_28: case SURFACE_NEWS_VENDOR:
case SURFACE_29: case SURFACE_WHEELBASE:
case SURFACE_32: case SURFACE_METAL_GATE:
return 1.0f - CWeather::WetRoads*0.4f; return 1.0f - CWeather::WetRoads*0.4f;
default: default:

View File

@ -1,86 +1,44 @@
#pragma once #pragma once
enum
{
SURFACE_0,
SURFACE_1,
SURFACE_2,
SURFACE_3,
SURFACE_4,
SURFACE_5,
SURFACE_6,
SURFACE_7,
SURFACE_8,
SURFACE_9,
SURFACE_10,
SURFACE_11,
SURFACE_12,
SURFACE_13,
SURFACE_14,
SURFACE_15,
SURFACE_16,
SURFACE_17,
SURFACE_18,
SURFACE_19,
SURFACE_20,
SURFACE_21,
SURFACE_22,
SURFACE_23,
SURFACE_24,
SURFACE_25,
SURFACE_26,
SURFACE_27,
SURFACE_28,
SURFACE_29,
SURFACE_30,
SURFACE_31,
SURFACE_32,
NUMSURFACETYPES
};
// From nick
// TODO: check and use this
enum eSurfaceType enum eSurfaceType
{ {
SURFACE_DEFAULT, SURFACE_DEFAULT,
SURFACE_TARMAC, SURFACE_TARMAC,
SURFACE_GRASS, SURFACE_GRASS,
SURFACE_DIRT, SURFACE_GRAVEL,
SURFACE_DIRTTRACK, SURFACE_MUD_DRY,
SURFACE_PAVEMENT, SURFACE_PAVEMENT,
SURFACE_METAL6, SURFACE_CAR,
SURFACE_GLASS, SURFACE_GLASS,
SURFACE_SCAFFOLD, SURFACE_TRANSPARENT_CLOTH,
SURFACE_METAL_DOOR, // garage door SURFACE_GARAGE_DOOR,
SURFACE_BILLBOARD, SURFACE_CAR_PANEL,
SURFACE_STEEL, //? SURFACE_THICK_METAL_PLATE,
SURFACE_METAL_POLE, // ? SURFACE_SCAFFOLD_POLE,
SURFACE_STREET_LIGHT, SURFACE_LAMP_POST,
SURFACE_METAL14, SURFACE_FIRE_HYDRANT,
SURFACE_METAL15, SURFACE_GIRDER,
SURFACE_METAL_FENCE, SURFACE_METAL_CHAIN_FENCE,
SURFACE_FLESH, SURFACE_PED,
SURFACE_SAND, SURFACE_SAND,
SURFACE_PUDDLE, SURFACE_WATER,
SURFACE_WOOD, SURFACE_WOOD_CRATES,
SURFACE_WOOD_BOX, SURFACE_WOOD_BENCH,
SURFACE_WOOD_PLANK, SURFACE_WOOD_SOLID,
SURFACE_TIRE, SURFACE_RUBBER,
SURFACE_HARD24, SURFACE_PLASTIC,
SURFACE_HEDGE, SURFACE_HEDGE,
SURFACE_STONE, SURFACE_STEEP_CLIFF,
SURFACE_METAL27, SURFACE_CONTAINER,
SURFACE_METAL28, SURFACE_NEWS_VENDOR,
SURFACE_RUBBER29, SURFACE_WHEELBASE,
SURFACE_LOOSE30, SURFACE_CARDBOARDBOX,
SURFACE_BOLLARD, SURFACE_TRANSPARENT_STONE,
SURFACE_GATE, SURFACE_METAL_GATE,
// These are illegal // These are illegal
SURFACE_SAND33, SURFACE_SAND_BEACH,
SURFACE_ROAD34, SURFACE_CONCRETE_BEACH,
}; };
enum enum

View File

@ -65,7 +65,7 @@ CTempColModels::Initialise(void)
#else #else
for (i = 0; i < ARRAY_SIZE(s_aPedGSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aPedGSpheres); i++) {
#endif #endif
s_aPedSpheres[i].surface = SURFACE_FLESH; s_aPedSpheres[i].surface = SURFACE_PED;
s_aPedSpheres[i].piece = 0; s_aPedSpheres[i].piece = 0;
} }
@ -84,7 +84,7 @@ CTempColModels::Initialise(void)
s_aPed2Spheres[2].center = CVector(0.0f, -0.35f, -0.9f); s_aPed2Spheres[2].center = CVector(0.0f, -0.35f, -0.9f);
for (i = 0; i < ARRAY_SIZE(s_aPed2Spheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aPed2Spheres); i++) {
s_aPed2Spheres[i].surface = SURFACE_FLESH; s_aPed2Spheres[i].surface = SURFACE_PED;
s_aPed2Spheres[i].piece = 0; s_aPed2Spheres[i].piece = 0;
} }
@ -105,10 +105,10 @@ CTempColModels::Initialise(void)
s_aPedGSpheres[2].center = CVector(0.0f, 0.25f, -0.9f); s_aPedGSpheres[2].center = CVector(0.0f, 0.25f, -0.9f);
s_aPedGSpheres[3].center = CVector(0.0f, 0.65f, -0.9f); s_aPedGSpheres[3].center = CVector(0.0f, 0.65f, -0.9f);
s_aPedGSpheres[0].surface = SURFACE_FLESH; s_aPedGSpheres[0].surface = SURFACE_PED;
s_aPedGSpheres[1].surface = SURFACE_FLESH; s_aPedGSpheres[1].surface = SURFACE_PED;
s_aPedGSpheres[2].surface = SURFACE_FLESH; s_aPedGSpheres[2].surface = SURFACE_PED;
s_aPedGSpheres[3].surface = SURFACE_FLESH; s_aPedGSpheres[3].surface = SURFACE_PED;
s_aPedGSpheres[0].piece = 4; s_aPedGSpheres[0].piece = 4;
s_aPedGSpheres[1].piece = 1; s_aPedGSpheres[1].piece = 1;
s_aPedGSpheres[2].piece = 0; s_aPedGSpheres[2].piece = 0;
@ -130,7 +130,7 @@ CTempColModels::Initialise(void)
s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f); s_aDoorSpheres[2].center = CVector(0.0f, -0.6f, 0.25f);
for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aDoorSpheres); i++) {
s_aDoorSpheres[i].surface = SURFACE_BILLBOARD; s_aDoorSpheres[i].surface = SURFACE_CAR_PANEL;
s_aDoorSpheres[i].piece = 0; s_aDoorSpheres[i].piece = 0;
} }
@ -150,12 +150,12 @@ CTempColModels::Initialise(void)
s_aBumperSpheres[3].center = CVector(-0.85f, -0.05f, 0.0f); s_aBumperSpheres[3].center = CVector(-0.85f, -0.05f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBumperSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aBumperSpheres); i++) {
s_aBumperSpheres[i].surface = SURFACE_BILLBOARD; s_aBumperSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBumperSpheres[i].piece = 0; s_aBumperSpheres[i].piece = 0;
} }
ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0); ms_colModelBumper1.boundingSphere.Set(2.2f, CVector(0.0f, -0.6f, 0.0f), SURFACE_DEFAULT, 0);
ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, -0.2f), SURFACE_DEFAULT, 0); ms_colModelBumper1.boundingBox.Set(CVector(-1.2f, -0.3f, -0.2f), CVector(1.2f, 0.3f, 0.2f), SURFACE_DEFAULT, 0);
SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres); SET_COLMODEL_SPHERES(ms_colModelBumper1, s_aBumperSpheres);
@ -170,7 +170,7 @@ CTempColModels::Initialise(void)
s_aPanelSpheres[3].center = CVector(-0.15f, 0.45f, 0.0f); s_aPanelSpheres[3].center = CVector(-0.15f, 0.45f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aPanelSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aPanelSpheres); i++) {
s_aPanelSpheres[i].surface = SURFACE_BILLBOARD; s_aPanelSpheres[i].surface = SURFACE_CAR_PANEL;
s_aPanelSpheres[i].piece = 0; s_aPanelSpheres[i].piece = 0;
} }
@ -190,7 +190,7 @@ CTempColModels::Initialise(void)
s_aBonnetSpheres[3].center = CVector(0.4f, 0.9f, 0.0f); s_aBonnetSpheres[3].center = CVector(0.4f, 0.9f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBonnetSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aBonnetSpheres); i++) {
s_aBonnetSpheres[i].surface = SURFACE_BILLBOARD; s_aBonnetSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBonnetSpheres[i].piece = 0; s_aBonnetSpheres[i].piece = 0;
} }
@ -210,7 +210,7 @@ CTempColModels::Initialise(void)
s_aBootSpheres[3].center = CVector(0.4f, -0.6f, 0.0f); s_aBootSpheres[3].center = CVector(0.4f, -0.6f, 0.0f);
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
s_aBootSpheres[i].surface = SURFACE_BILLBOARD; s_aBootSpheres[i].surface = SURFACE_CAR_PANEL;
s_aBootSpheres[i].piece = 0; s_aBootSpheres[i].piece = 0;
} }
@ -232,7 +232,7 @@ CTempColModels::Initialise(void)
#else #else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif #endif
s_aWheelSpheres[i].surface = SURFACE_RUBBER29; s_aWheelSpheres[i].surface = SURFACE_WHEELBASE;
s_aWheelSpheres[i].piece = 0; s_aWheelSpheres[i].piece = 0;
} }
@ -254,7 +254,7 @@ CTempColModels::Initialise(void)
#else #else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif #endif
s_aBodyPartSpheres1[i].surface = SURFACE_FLESH; s_aBodyPartSpheres1[i].surface = SURFACE_PED;
s_aBodyPartSpheres1[i].piece = 0; s_aBodyPartSpheres1[i].piece = 0;
} }
@ -276,7 +276,7 @@ CTempColModels::Initialise(void)
#else #else
for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) { for (i = 0; i < ARRAY_SIZE(s_aBootSpheres); i++) {
#endif #endif
s_aBodyPartSpheres2[i].surface = SURFACE_FLESH; s_aBodyPartSpheres2[i].surface = SURFACE_PED;
s_aBodyPartSpheres2[i].piece = 0; s_aBodyPartSpheres2[i].piece = 0;
} }

View File

@ -18,7 +18,7 @@ public:
static const float &GetTimeStep(void) { return ms_fTimeStep; } static const float &GetTimeStep(void) { return ms_fTimeStep; }
static void SetTimeStep(float ts) { ms_fTimeStep = ts; } static void SetTimeStep(float ts) { ms_fTimeStep = ts; }
static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; } static float GetTimeStepInSeconds() { return ms_fTimeStep / 50.0f; }
static float GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; } static uint32 GetTimeStepInMilliseconds() { return ms_fTimeStep / 50.0f * 1000.0f; }
static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; } static const float &GetTimeStepNonClipped(void) { return ms_fTimeStepNonClipped; }
static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; } static float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; } static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; }
@ -59,7 +59,7 @@ public:
friend class CMemoryCard; friend class CMemoryCard;
#ifdef FIX_BUGS #ifdef FIX_BUGS
static float GetDefaultTimeStep(void) { return 5.0f / 3.0f; } static float GetDefaultTimeStep(void) { return 50.0f / 30.0f; }
static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); } static float GetTimeStepFix(void) { return GetTimeStep() / GetDefaultTimeStep(); }
#endif #endif
}; };

View File

@ -33,22 +33,22 @@
CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS]; CColPoint gaTempSphereColPoints[MAX_COLLISION_POINTS];
CPtrList CWorld::ms_bigBuildingsList[4];// = (CPtrList*)0x6FAB60; CPtrList CWorld::ms_bigBuildingsList[4];
CPtrList CWorld::ms_listMovingEntityPtrs;// = *(CPtrList*)0x8F433C; CPtrList CWorld::ms_listMovingEntityPtrs;
CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];// = (CSector (*)[NUMSECTORS_Y])0x665608; CSector CWorld::ms_aSectors[NUMSECTORS_Y][NUMSECTORS_X];
uint16 CWorld::ms_nCurrentScanCode;// = *(uint16*)0x95CC64; uint16 CWorld::ms_nCurrentScanCode;
uint8 CWorld::PlayerInFocus;// = *(uint8 *)0x95CD61; uint8 CWorld::PlayerInFocus;
CPlayerInfo CWorld::Players[NUMPLAYERS]; CPlayerInfo CWorld::Players[NUMPLAYERS];
bool CWorld::bNoMoreCollisionTorque;// = *(bool*)0x95CDCC; bool CWorld::bNoMoreCollisionTorque;
CEntity *CWorld::pIgnoreEntity;// = *(CEntity**)0x8F6494; CEntity *CWorld::pIgnoreEntity;
bool CWorld::bIncludeDeadPeds;// = *(bool*)0x95CD8F; bool CWorld::bIncludeDeadPeds;
bool CWorld::bSecondShift;// = *(bool*)0x95CD54; bool CWorld::bSecondShift;
bool CWorld::bForceProcessControl;// = *(bool*)0x95CD6C; bool CWorld::bForceProcessControl;
bool CWorld::bProcessCutsceneOnly;// = *(bool*)0x95CD8B; bool CWorld::bProcessCutsceneOnly;
bool CWorld::bDoingCarCollisions;// = *(bool*)0x95CD8C; bool CWorld::bDoingCarCollisions;
bool CWorld::bIncludeCarTyres;// = *(bool*)0x95CDAA; bool CWorld::bIncludeCarTyres;
void void
CWorld::Initialise() CWorld::Initialise()
@ -120,14 +120,14 @@ CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, bool bRemov
for(int32 i = 0; i < pedPool->GetSize(); i++) { for(int32 i = 0; i < pedPool->GetSize(); i++) {
CPed *pPed = pedPool->GetSlot(i); CPed *pPed = pedPool->GetSlot(i);
if(pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() && if(pPed && !pPed->IsPlayer() && pPed->CanBeDeleted() &&
CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < radius) { CVector2D(pPed->GetPosition() - pos).MagnitudeSqr() < SQR(radius)) {
CPopulation::RemovePed(pPed); CPopulation::RemovePed(pPed);
} }
} }
CVehiclePool *VehiclePool = CPools::GetVehiclePool(); CVehiclePool *VehiclePool = CPools::GetVehiclePool();
for(int32 i = 0; i < VehiclePool->GetSize(); i++) { for(int32 i = 0; i < VehiclePool->GetSize(); i++) {
CVehicle *pVehicle = VehiclePool->GetSlot(i); CVehicle *pVehicle = VehiclePool->GetSlot(i);
if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < radius && if(pVehicle && CVector2D(pVehicle->GetPosition() - pos).MagnitudeSqr() < SQR(radius) &&
!pVehicle->bIsLocked && pVehicle->CanBeDeleted()) { !pVehicle->bIsLocked && pVehicle->CanBeDeleted()) {
if(pVehicle->pDriver) { if(pVehicle->pDriver) {
CPopulation::RemovePed(pVehicle->pDriver); CPopulation::RemovePed(pVehicle->pDriver);
@ -659,8 +659,8 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
} }
void void
CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, short *nextObject, CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects,
short lastObject, CEntity **objects) int16 lastObject, CEntity **objects)
{ {
float radiusSqr = radius * radius; float radiusSqr = radius * radius;
float objDistSqr; float objDistSqr;
@ -676,16 +676,16 @@ CWorld::FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, floa
else else
objDistSqr = diff.MagnitudeSqr(); objDistSqr = diff.MagnitudeSqr();
if(objDistSqr < radiusSqr && *nextObject < lastObject) { if(objDistSqr < radiusSqr && *numObjects < lastObject) {
if(objects) { objects[*nextObject] = object; } if(objects) { objects[*numObjects] = object; }
(*nextObject)++; (*numObjects)++;
} }
} }
} }
} }
void void
CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, short *nextObject, short lastObject, CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject,
CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds,
bool checkObjects, bool checkDummies) bool checkObjects, bool checkDummies)
{ {
@ -711,39 +711,39 @@ CWorld::FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, sh
AdvanceCurrentScanCode(); AdvanceCurrentScanCode();
*nextObject = 0; *numObjects = 0;
for(int curY = minY; curY <= maxY; curY++) { for(int curY = minY; curY <= maxY; curY++) {
for(int curX = minX; curX <= maxX; curX++) { for(int curX = minX; curX <= maxX; curX++) {
CSector *sector = GetSector(curX, curY); CSector *sector = GetSector(curX, curY);
if(checkBuildings) { if(checkBuildings) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_BUILDINGS_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects); radius, ignoreZ, numObjects, lastObject, objects);
} }
if(checkVehicles) { if(checkVehicles) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_VEHICLES_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects); radius, ignoreZ, numObjects, lastObject, objects);
} }
if(checkPeds) { if(checkPeds) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS], centre, radius, ignoreZ,
nextObject, lastObject, objects); numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_PEDS_OVERLAP], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
} }
if(checkObjects) { if(checkObjects) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_OBJECTS_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects); radius, ignoreZ, numObjects, lastObject, objects);
} }
if(checkDummies) { if(checkDummies) {
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES], centre, radius,
ignoreZ, nextObject, lastObject, objects); ignoreZ, numObjects, lastObject, objects);
FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre, FindObjectsInRangeSectorList(sector->m_lists[ENTITYLIST_DUMMIES_OVERLAP], centre,
radius, ignoreZ, nextObject, lastObject, objects); radius, ignoreZ, numObjects, lastObject, objects);
} }
} }
} }
@ -949,7 +949,11 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
if(e != entityToIgnore && e->bUsesCollision && if(e != entityToIgnore && e->bUsesCollision &&
!(ignoreSomeObjects && CameraToIgnoreThisObject(e))) { !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
#ifdef FIX_BUGS
CVector diff = spherePos - e->GetBoundCentre();
#else
CVector diff = spherePos - e->GetPosition(); CVector diff = spherePos - e->GetPosition();
#endif
float distance = diff.Magnitude(); float distance = diff.Magnitude();
if(e->GetBoundRadius() + radius > distance) { if(e->GetBoundRadius() + radius > distance) {
@ -1823,7 +1827,7 @@ void
CWorld::RepositionOneObject(CEntity *pEntity) CWorld::RepositionOneObject(CEntity *pEntity)
{ {
int16 modelId = pEntity->GetModelIndex(); int16 modelId = pEntity->GetModelIndex();
if (IsTrafficLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER || if (IsStreetLight(modelId) || IsTreeModel(modelId) || modelId == MI_PARKINGMETER ||
modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 || modelId == MI_PHONEBOOTH1 || modelId == MI_WASTEBIN || modelId == MI_BIN || modelId == MI_POSTBOX1 ||
modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 || modelId == MI_NEWSSTAND || modelId == MI_TRAFFICCONE || modelId == MI_DUMP1 ||
modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 || modelId == MI_ROADWORKBARRIER1 || modelId == MI_BUSSIGN1 || modelId == MI_NOPARKINGSIGN1 ||

View File

@ -102,8 +102,8 @@ public:
static CEntity *TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects); static CEntity *TestSphereAgainstWorld(CVector centre, float radius, CEntity *entityToIgnore, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSomeObjects);
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool); static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, Const CVector&, float, bool, short*, short, CEntity**); static void FindObjectsInRangeSectorList(CPtrList &list, Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects);
static void FindObjectsInRange(Const CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool); static void FindObjectsInRange(Const CVector &centre, float radius, bool ignoreZ, int16 *numObjects, int16 lastObject, CEntity **objects, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies);
static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities); static void FindObjectsOfTypeInRangeSectorList(uint32 modelId, CPtrList& list, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities);
static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies); static void FindObjectsOfTypeInRange(uint32 modelId, const CVector& position, float radius, bool bCheck2DOnly, int16* nEntitiesFound, int16 maxEntitiesToFind, CEntity** aEntities, bool bBuildings, bool bVehicles, bool bPeds, bool bObjects, bool bDummies);
static float FindGroundZForCoord(float x, float y); static float FindGroundZForCoord(float x, float y);

View File

@ -29,14 +29,14 @@
#define STREAMFILE(str) (((rw::StreamFile*)(str))->file) #define STREAMFILE(str) (((rw::StreamFile*)(str))->file)
#define HIERNODEINFO(hier) ((hier)->nodeInfo) #define HIERNODEINFO(hier) ((hier)->nodeInfo)
#define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id) #define HIERNODEID(hier, i) ((hier)->nodeInfo[i].id)
#define HANIMFRAMES(anim) ((anim)->keyframes) #define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->keyframes + (i)*(anim)->interpInfo->animKeyFrameSize)
#else #else
#define RWHALFPIXEL // always d3d #define RWHALFPIXEL // always d3d
#define STREAMPOS(str) ((str)->Type.memory.position) #define STREAMPOS(str) ((str)->Type.memory.position)
#define STREAMFILE(str) ((str)->Type.file.fpFile) #define STREAMFILE(str) ((str)->Type.file.fpFile)
#define HIERNODEINFO(hier) ((hier)->pNodeInfo) #define HIERNODEINFO(hier) ((hier)->pNodeInfo)
#define HIERNODEID(hier, i) ((hier)->pNodeInfo[i].nodeID) #define HIERNODEID(hier, i) ((hier)->pNodeInfo[i].nodeID)
#define HANIMFRAMES(anim) ((anim)->pFrames) #define HANIMFRAME(anim, i) ((RwUInt8*)(anim)->pFrames + (i)*(anim)->interpInfo->keyFrameSize)
#endif #endif
#ifdef RWHALFPIXEL #ifdef RWHALFPIXEL
@ -113,7 +113,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define SCREEN_WIDTH ((float)RsGlobal.width) #define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height) #define SCREEN_HEIGHT ((float)RsGlobal.height)
#define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio()) #define SCREEN_ASPECT_RATIO (CDraw::GetAspectRatio())
#define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetFOV() * 0.5f))) #define SCREEN_VIEWWINDOW (Tan(DEGTORAD(CDraw::GetScaledFOV() * 0.5f)))
// This scales from PS2 pixel coordinates to the real resolution // This scales from PS2 pixel coordinates to the real resolution
#define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH) #define SCREEN_STRETCH_X(a) ((a) * (float) SCREEN_WIDTH / DEFAULT_SCREEN_WIDTH)
@ -416,7 +416,7 @@ inline T *WriteSaveBuf(uint8 *&buf, const T &value)
WriteSaveBuf(buf, b);\ WriteSaveBuf(buf, b);\
WriteSaveBuf(buf, c);\ WriteSaveBuf(buf, c);\
WriteSaveBuf(buf, d);\ WriteSaveBuf(buf, d);\
WriteSaveBuf(buf, size); WriteSaveBuf<uint32>(buf, size);
#define CheckSaveHeader(buf,a,b,c,d,size)\ #define CheckSaveHeader(buf,a,b,c,d,size)\
assert(ReadSaveBuf<char>(buf) == a);\ assert(ReadSaveBuf<char>(buf) == a);\

View File

@ -65,8 +65,6 @@ enum Config {
NUMATTRIBZONES = 288, NUMATTRIBZONES = 288,
NUMZONEINDICES = 55000, NUMZONEINDICES = 55000,
NUMHANDLINGS = 57,
PATHNODESIZE = 4500, PATHNODESIZE = 4500,
NUMWEATHERS = 4, NUMWEATHERS = 4,
@ -188,21 +186,20 @@ enum Config {
# define NO_CDCHECK # define NO_CDCHECK
# define CHATTYSPLASH // print what the game is loading # define CHATTYSPLASH // print what the game is loading
# define DEBUGMENU # define DEBUGMENU
//# 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, TODO: use this more
#define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things #define TOGGLEABLE_BETA_FEATURES // toggleable from debug menu. not too many things
#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
// Rendering/display
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch) #define DEFAULT_NATIVE_RESOLUTION // Set default video mode to your native resolution (fixes Windows 10 launch)
#define USE_TXD_CDIMAGE // generate and load textures from txd.img #define USE_TXD_CDIMAGE // generate and load textures from txd.img
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number #define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
//#define USE_TEXTURE_POOL //#define USE_TEXTURE_POOL
#ifdef _WIN32
#define AUDIO_MSS
#else
#define AUDIO_OAL
#endif
// Particle // Particle
//#define PC_PARTICLE //#define PC_PARTICLE
@ -219,7 +216,6 @@ enum Config {
#define REGISTER_START_BUTTON #define REGISTER_START_BUTTON
// Hud, frontend and radar // Hud, frontend and radar
#define ASPECT_RATIO_SCALE // Not just makes everything scale with aspect ratio, also adds support for all aspect ratios
#define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC #define TRIANGULAR_BLIPS // height indicating triangular radar blips, as in VC
#define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box #define PS2_SAVE_DIALOG // PS2 style save dialog with transparent black box
// #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc. // #define PS2_LIKE_MENU // An effort to recreate PS2 menu, cycling through tabs, different bg etc.
@ -229,13 +225,20 @@ enum Config {
// #define CIRCLE_BACK_BUTTON // #define CIRCLE_BACK_BUTTON
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better. #define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
#define BETA_SLIDING_TEXT #define BETA_SLIDING_TEXT
#define CUSTOM_FRONTEND_OPTIONS
// Script // Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default #define USE_DEBUG_SCRIPT_LOADER // Loads main.scm by default. Hold R for main_freeroam.scm and D for main_d.scm
#define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script #define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script
#define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely #define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
#define MISSION_REPLAY // mobile feature
//#define SIMPLIER_MISSIONS // apply simplifications from mobile
#define USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#define SCRIPT_LOG_FILE_LEVEL 1 // 0 == no log, 1 == overwrite every frame, 2 == full log
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible #ifndef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT
#define USE_BASIC_SCRIPT_DEBUG_OUTPUT
#endif
// Replay // Replay
//#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool! //#define DONT_FIX_REPLAY_BUGS // keeps various bugs in CReplay, some of which are fairly cool!
@ -257,5 +260,6 @@ enum Config {
#define CANCELLABLE_CAR_ENTER #define CANCELLABLE_CAR_ENTER
// Camera // Camera
//#define PS2_CAM_TRANSITION // old way of transitioning between cam modes
#define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future #define IMPROVED_CAMERA // Better Debug cam, and maybe more in the future
#define FREE_CAM // Rotating cam #define FREE_CAM // Rotating cam

View File

@ -74,6 +74,9 @@ float FramesPerSecond = 30.0f;
bool gbPrintShite = false; bool gbPrintShite = false;
bool gbModelViewer; bool gbModelViewer;
#ifdef TIMEBARS
bool gbShowTimebars;
#endif
int32 frameCount; int32 frameCount;
@ -96,7 +99,6 @@ void TheGame(void);
void DebugMenuPopulate(void); void DebugMenuPopulate(void);
#endif #endif
void void
ValidateVersion() ValidateVersion()
{ {
@ -138,9 +140,13 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha); CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha); CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
#ifndef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f / 9.f : 4.f / 3.f));
#else
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO); CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera); CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera)) if(!RsCameraBeginUpdate(Scene.camera))
return false; return false;
@ -156,7 +162,11 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool bool
DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha) DoRWStuffStartOfFrame_Horizon(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomRed, int16 BottomGreen, int16 BottomBlue, int16 Alpha)
{ {
#ifndef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, (CMenuManager::m_PrefsUseWideScreen ? 16.f/9.f : 4.f/3.f));
#else
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO); CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera); CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ); RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@ -342,7 +352,7 @@ PluginAttach(void)
static RwBool static RwBool
Initialise3D(void *param) Initialise3D(void *param)
{ {
if (RsRwInitialise(param)) if (RsRwInitialize(param))
{ {
#ifdef DEBUGMENU #ifdef DEBUGMENU
DebugMenuInit(); DebugMenuInit();
@ -1118,8 +1128,10 @@ Idle(void *arg)
#endif #endif
CCredits::Render(); CCredits::Render();
#ifdef TIMEBARS #ifdef TIMEBARS
tbDisplay(); if (gbShowTimebars)
tbDisplay();
#endif #endif
DoRWStuffEndOfFrame(); DoRWStuffEndOfFrame();
@ -1175,10 +1187,10 @@ AppEventHandler(RsEvent event, void *param)
{ {
switch( event ) switch( event )
{ {
case rsINITIALISE: case rsINITIALIZE:
{ {
CGame::InitialiseOnceBeforeRW(); CGame::InitialiseOnceBeforeRW();
return RsInitialise() ? rsEVENTPROCESSED : rsEVENTERROR; return RsInitialize() ? rsEVENTPROCESSED : rsEVENTERROR;
} }
case rsCAMERASIZE: case rsCAMERASIZE:
@ -1190,7 +1202,7 @@ AppEventHandler(RsEvent event, void *param)
return rsEVENTPROCESSED; return rsEVENTPROCESSED;
} }
case rsRWINITIALISE: case rsRWINITIALIZE:
{ {
return Initialise3D(param) ? rsEVENTPROCESSED : rsEVENTERROR; return Initialise3D(param) ? rsEVENTPROCESSED : rsEVENTERROR;
} }

View File

@ -14,6 +14,9 @@ extern wchar gUString[256];
extern wchar gUString2[256]; extern wchar gUString2[256];
extern bool gbPrintShite; extern bool gbPrintShite;
extern bool gbModelViewer; extern bool gbModelViewer;
#ifdef TIMEBARS
extern bool gbShowTimebars;
#endif
class CSprite2d; class CSprite2d;

View File

@ -27,6 +27,9 @@
#include "Radar.h" #include "Radar.h"
#include "debugmenu.h" #include "debugmenu.h"
#include "Frontend.h" #include "Frontend.h"
#include "Text.h"
#include "WaterLevel.h"
#include "main.h"
#ifndef _WIN32 #ifndef _WIN32
#include "assert.h" #include "assert.h"
@ -66,6 +69,100 @@ mysrand(unsigned int seed)
myrand_seed = seed; myrand_seed = seed;
} }
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "frontendoption.h"
#include "platform.h"
void ReloadFrontendOptions(void)
{
RemoveCustomFrontendOptions();
CustomFrontendOptionsPopulate();
}
#ifdef MORE_LANGUAGES
void LangPolSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_POLISH;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
void LangRusSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_RUSSIAN;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
void LangJapSelect(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_JAPANESE;
FrontEndMenuManager.m_bFrontEnd_ReloadObrTxtGxt = true;
FrontEndMenuManager.InitialiseChangedLanguageSettings();
FrontEndMenuManager.SaveSettings();
}
}
#endif
#ifdef IMPROVED_VIDEOMODE
void ScreenModeChange(int8 displayedValue)
{
if (displayedValue != FrontEndMenuManager.m_nPrefsWindowed) {
FrontEndMenuManager.m_nPrefsWindowed = displayedValue;
_psSelectScreenVM(FrontEndMenuManager.m_nPrefsVideoMode); // apply same resolution
FrontEndMenuManager.SetHelperText(0);
FrontEndMenuManager.SaveSettings();
}
}
#endif
#ifdef FREE_CAM
void ToggleFreeCam(int8 action)
{
if (action == FEOPTION_ACTION_SELECT) {
TheCamera.bFreeCam = !TheCamera.bFreeCam;
FrontEndMenuManager.SaveSettings();
}
}
#endif
// Reloaded on language change, so you can use hardcoded wchar* and TheText.Get with peace of mind
void
CustomFrontendOptionsPopulate(void)
{
#ifdef MORE_LANGUAGES
FrontendOptionSetPosition(MENUPAGE_LANGUAGE_SETTINGS);
FrontendOptionAddDynamic(TheText.Get("FEL_POL"), nil, LangPolSelect, nil);
FrontendOptionAddDynamic(TheText.Get("FEL_RUS"), nil, LangRusSelect, nil);
FrontendOptionAddDynamic(TheText.Get("FEL_JAP"), nil, LangJapSelect, nil);
#endif
#ifdef IMPROVED_VIDEOMODE
static const wchar *screenModes[] = { (wchar*)L"FULLSCREEN", (wchar*)L"WINDOWED" };
FrontendOptionSetPosition(MENUPAGE_GRAPHICS_SETTINGS, 8);
FrontendOptionAddSelect(TheText.Get("SCRFOR"), screenModes, 2, (int8*)&FrontEndMenuManager.m_nPrefsWindowed, true, ScreenModeChange, nil);
#endif
#ifdef MENU_MAP
FrontendOptionSetPosition(MENUPAGE_PAUSE_MENU, 2);
FrontendOptionAddRedirect(TheText.Get("FEG_MAP"), MENUPAGE_MAP);
#endif
#ifdef FREE_CAM
static const wchar *text = (wchar*)L"TOGGLE FREE CAM";
FrontendOptionSetPosition(MENUPAGE_CONTROLLER_PC, 1);
FrontendOptionAddDynamic(text, nil, ToggleFreeCam, nil);
#endif
}
#endif
#ifdef DEBUGMENU #ifdef DEBUGMENU
void WeaponCheat(); void WeaponCheat();
void HealthCheat(); void HealthCheat();
@ -160,6 +257,13 @@ TeleportToWaypoint(void)
} }
#endif #endif
static void
SwitchCarCollision(void)
{
if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar())
FindPlayerVehicle()->bUsesCollision = !FindPlayerVehicle()->bUsesCollision;
}
static int engineStatus; static int engineStatus;
static void static void
SetEngineStatus(void) SetEngineStatus(void)
@ -357,11 +461,14 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Don't render Peds", &gbDontRenderPeds, nil); DebugMenuAddVarBool8("Render", "Don't render Peds", &gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil); DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, nil);
DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil); DebugMenuAddVarBool8("Render", "Don't render Objects", &gbDontRenderObjects, nil);
DebugMenuAddVarBool8("Render", "Don't Render Water", &gbDontRenderWater, nil);
DebugMenuAddVarBool8("Debug", "pad 1 -> pad 2", &CPad::m_bMapPadOneToPadTwo, nil);
DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil); DebugMenuAddVarBool8("Debug", "Edit on", &CSceneEdit::m_bEditOn, nil);
#ifdef MENU_MAP #ifdef MENU_MAP
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint); DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
#endif #endif
DebugMenuAddCmd("Debug", "Switch car collision", SwitchCarCollision);
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil); DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus); DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar); DebugMenuAddCmd("Debug", "Fix Car", FixCar);
@ -374,6 +481,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway); DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil); DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
#ifdef CUSTOM_FRONTEND_OPTIONS
DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions);
#endif
#ifdef TOGGLEABLE_BETA_FEATURES #ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil); DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, nil);
DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", &CPed::bMakePedsRunToPhonesToReportCrimes, nil); DebugMenuAddVarBool8("Debug", "Toggle peds running to phones to report crimes", &CPed::bMakePedsRunToPhonesToReportCrimes, nil);
@ -382,6 +492,11 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start); DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop); DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
DebugMenuAddVarBool8("Debug", "Show DebugStuffInRelease", &gbDebugStuffInRelease, nil);
#ifdef TIMEBARS
DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil);
#endif
extern bool PrintDebugCode; extern bool PrintDebugCode;
extern int16 DebugCamMode; extern int16 DebugCamMode;
DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil); DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil);

View File

@ -683,7 +683,7 @@ CEntity::ProcessLightsForEntity(void)
lightOn = true; lightOn = true;
break; break;
case LIGHT_FLICKER_NIGHT: case LIGHT_FLICKER_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7){ if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60) if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60)
lightOn = true; lightOn = true;
else else
@ -803,12 +803,12 @@ CEntity::ProcessLightsForEntity(void)
} }
// Light shadow // Light shadow
if(effect->light.shadowRange != 0.0f){ if(effect->light.shadowSize != 0.0f){
if(lightOn){ if(lightOn){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos, effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f, effect->light.shadowSize, 0.0f,
0.0f, -effect->light.shadowRange, 0.0f, -effect->light.shadowSize,
128, 128,
effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f, effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
@ -817,8 +817,8 @@ CEntity::ProcessLightsForEntity(void)
}else if(lightFlickering){ }else if(lightFlickering){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE, CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos, effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f, effect->light.shadowSize, 0.0f,
0.0f, -effect->light.shadowRange, 0.0f, -effect->light.shadowSize,
0, 0.0f, 0.0f, 0.0f, 0, 0.0f, 0.0f, 0.0f,
15.0f, 1.0f, 40.0f, false, 0.0f); 15.0f, 1.0f, 40.0f, false, 0.0f);
} }

View File

@ -21,6 +21,10 @@ CPhysical::CPhysical(void)
{ {
int i; int i;
#ifdef FIX_BUGS
m_nLastTimeCollided = 0;
#endif
m_fForceMultiplier = 1.0f; m_fForceMultiplier = 1.0f;
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecTurnSpeed = CVector(0.0f, 0.0f, 0.0f);
@ -45,9 +49,9 @@ CPhysical::CPhysical(void)
bUsesCollision = true; bUsesCollision = true;
m_audioEntityId = -5; m_audioEntityId = -5;
unk1 = 100.0f; m_phys_unused1 = 100.0f;
m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f); m_vecCentreOfMass = CVector(0.0f, 0.0f, 0.0f);
field_EC = 0; m_phys_unused2 = 0;
bIsHeavy = false; bIsHeavy = false;
bAffectedByGravity = true; bAffectedByGravity = true;
@ -63,6 +67,9 @@ CPhysical::CPhysical(void)
m_phy_flagA10 = false; m_phy_flagA10 = false;
m_phy_flagA20 = false; m_phy_flagA20 = false;
#ifdef FIX_BUGS
m_nSurfaceTouched = SURFACE_DEFAULT;
#endif
m_nZoneLevel = LEVEL_NONE; m_nZoneLevel = LEVEL_NONE;
} }
@ -527,26 +534,26 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
bool ispedcontactA = false; bool ispedcontactA = false;
bool ispedcontactB = false; bool ispedcontactB = false;
float timestepA; float massFactorA;
if(B->bPedPhysics){ if(B->bPedPhysics){
timestepA = 10.0f; massFactorA = 10.0f;
if(B->IsPed() && ((CPed*)B)->m_pCurrentPhysSurface == A) if(B->IsPed() && ((CPed*)B)->m_pCurrentPhysSurface == A)
ispedcontactA = true; ispedcontactA = true;
}else }else
timestepA = A->bIsHeavy ? 2.0f : 1.0f; massFactorA = A->bIsHeavy ? 2.0f : 1.0f;
float timestepB; float massFactorB;
if(A->bPedPhysics){ if(A->bPedPhysics){
if(A->IsPed() && ((CPed*)A)->IsPlayer() && B->IsVehicle() && if(A->IsPed() && ((CPed*)A)->IsPlayer() && B->IsVehicle() &&
(B->GetStatus() == STATUS_ABANDONED || B->GetStatus() == STATUS_WRECKED || A->bHasHitWall)) (B->GetStatus() == STATUS_ABANDONED || B->GetStatus() == STATUS_WRECKED || A->bHasHitWall))
timestepB = 2200.0f / B->m_fMass; massFactorB = 2200.0f / B->m_fMass;
else else
timestepB = 10.0f; massFactorB = 10.0f;
if(A->IsPed() && ((CPed*)A)->m_pCurrentPhysSurface == B) if(A->IsPed() && ((CPed*)A)->m_pCurrentPhysSurface == B)
ispedcontactB = true; ispedcontactB = true;
}else }else
timestepB = B->bIsHeavy ? 2.0f : 1.0f; massFactorB = B->bIsHeavy ? 2.0f : 1.0f;
float speedA, speedB; float speedA, speedB;
if(B->IsStatic()){ if(B->IsStatic()){
@ -646,14 +653,17 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
// positive if B is moving towards A // positive if B is moving towards A
// not interested in how much B moves into A apparently? // not interested in how much B moves into A apparently?
// only interested in cases where A collided into B // only interested in cases where A collided into B
speedB = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal)); speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
float speedSum = Max(0.0f, DotProduct(B->m_vecMoveSpeed, colpoint.normal));
// A has moved into B // A has moved into B
if(speedA < speedB){ if(speedA < speedSum){
if(!A->bHasHitWall) if(A->bHasHitWall)
speedB -= (speedA - speedB) * (A->m_fElasticity+B->m_fElasticity)/2.0f; eA = speedSum;
impulseA = (speedB-speedA) * A->m_fMass * timestepA; else
eA = speedSum - (speedA - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
impulseA = (eA-speedA) * A->m_fMass * massFactorA;
if(!A->bInfiniteMass) if(!A->bInfiniteMass)
A->ApplyMoveForce(colpoint.normal*(impulseA/timestepA)); A->ApplyMoveForce(colpoint.normal*(impulseA/massFactorA));
return true; return true;
} }
}else if(A->bPedPhysics){ }else if(A->bPedPhysics){
@ -661,9 +671,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal); speedA = DotProduct(A->m_vecMoveSpeed, colpoint.normal);
speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal); speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal);
float a = A->m_fMass*timestepA; float mA = A->m_fMass*massFactorA;
float b = B->GetMassTime(pointposB, colpoint.normal, timestepB); float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB);
float speedSum = (b*speedB + a*speedA)/(a + b); float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){ if(speedA < speedSum){
if(A->bHasHitWall) if(A->bHasHitWall)
eA = speedSum; eA = speedSum;
@ -673,10 +683,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum; eB = speedSum;
else else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f; eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
impulseA = (eA - speedA) * a; impulseA = (eA - speedA) * mA;
impulseB = -(eB - speedB) * b; impulseB = -(eB - speedB) * mB;
CVector fA = colpoint.normal*(impulseA/timestepA); CVector fA = colpoint.normal*(impulseA/massFactorA);
CVector fB = colpoint.normal*(-impulseB/timestepB); CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(!A->bInfiniteMass){ if(!A->bInfiniteMass){
if(fA.z < 0.0f) fA.z = 0.0f; if(fA.z < 0.0f) fA.z = 0.0f;
if(ispedcontactB){ if(ispedcontactB){
@ -696,9 +706,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal); speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal);
speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal); speedB = DotProduct(B->m_vecMoveSpeed, colpoint.normal);
float a = A->GetMassTime(pointposA, colpoint.normal, timestepA); float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA);
float b = B->m_fMass*timestepB; float mB = B->m_fMass*massFactorB;
float speedSum = (b*speedB + a*speedA)/(a + b); float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){ if(speedA < speedSum){
if(A->bHasHitWall) if(A->bHasHitWall)
eA = speedSum; eA = speedSum;
@ -708,10 +718,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum; eB = speedSum;
else else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f; eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
impulseA = (eA - speedA) * a; impulseA = (eA - speedA) * mA;
impulseB = -(eB - speedB) * b; impulseB = -(eB - speedB) * mB;
CVector fA = colpoint.normal*(impulseA/timestepA); CVector fA = colpoint.normal*(impulseA/massFactorA);
CVector fB = colpoint.normal*(-impulseB/timestepB); CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(!A->bInfiniteMass && !ispedcontactA){ if(!A->bInfiniteMass && !ispedcontactA){
if(fA.z < 0.0f) fA.z = 0.0f; if(fA.z < 0.0f) fA.z = 0.0f;
A->ApplyMoveForce(fA); A->ApplyMoveForce(fA);
@ -736,9 +746,9 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
CVector pointposB = colpoint.point - B->GetPosition(); CVector pointposB = colpoint.point - B->GetPosition();
speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal); speedA = DotProduct(A->GetSpeed(pointposA), colpoint.normal);
speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal); speedB = DotProduct(B->GetSpeed(pointposB), colpoint.normal);
float a = A->GetMassTime(pointposA, colpoint.normal, timestepA); float mA = A->GetMassTweak(pointposA, colpoint.normal, massFactorA);
float b = B->GetMassTime(pointposB, colpoint.normal, timestepB); float mB = B->GetMassTweak(pointposB, colpoint.normal, massFactorB);
float speedSum = (b*speedB + a*speedA)/(a + b); float speedSum = (mB*speedB + mA*speedA)/(mA + mB);
if(speedA < speedSum){ if(speedA < speedSum){
if(A->bHasHitWall) if(A->bHasHitWall)
eA = speedSum; eA = speedSum;
@ -748,10 +758,10 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
eB = speedSum; eB = speedSum;
else else
eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f; eB = speedSum - (speedB - speedSum) * (A->m_fElasticity+B->m_fElasticity)/2.0f;
impulseA = (eA - speedA) * a; impulseA = (eA - speedA) * mA;
impulseB = -(eB - speedB) * b; impulseB = -(eB - speedB) * mB;
CVector fA = colpoint.normal*(impulseA/timestepA); CVector fA = colpoint.normal*(impulseA/massFactorA);
CVector fB = colpoint.normal*(-impulseB/timestepB); CVector fB = colpoint.normal*(-impulseB/massFactorB);
if(A->IsVehicle() && !A->bHasHitWall){ if(A->IsVehicle() && !A->bHasHitWall){
fA.x *= 1.4f; fA.x *= 1.4f;
fA.y *= 1.4f; fA.y *= 1.4f;
@ -767,7 +777,7 @@ CPhysical::ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, fl
if(B->IsVehicle() && !B->bHasHitWall){ if(B->IsVehicle() && !B->bHasHitWall){
fB.x *= 1.4f; fB.x *= 1.4f;
fB.y *= 1.4f; fB.y *= 1.4f;
if(colpoint.normal.z < 0.7f) if(-colpoint.normal.z < 0.7f)
fB.z *= 0.3f; fB.z *= 0.3f;
if(B->GetStatus() == STATUS_PLAYER) if(B->GetStatus() == STATUS_PLAYER)
pointposB *= 0.8f; pointposB *= 0.8f;
@ -813,7 +823,7 @@ CPhysical::ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CV
speed = GetSpeed(pointpos); speed = GetSpeed(pointpos);
normalSpeed = DotProduct(speed, colpoint.normal); normalSpeed = DotProduct(speed, colpoint.normal);
if(normalSpeed < 0.0f){ if(normalSpeed < 0.0f){
float minspeed = 0.0104f * CTimer::GetTimeStep(); float minspeed = 1.3f*GRAVITY * CTimer::GetTimeStep();
#ifdef GTA3_1_1_PATCH #ifdef GTA3_1_1_PATCH
if ((IsObject() || IsVehicle() && (GetUp().z < -0.3f || ((CVehicle*)this)->IsBike() && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED))) && if ((IsObject() || IsVehicle() && (GetUp().z < -0.3f || ((CVehicle*)this)->IsBike() && (GetStatus() == STATUS_ABANDONED || GetStatus() == STATUS_WRECKED))) &&
#else #else
@ -1015,7 +1025,7 @@ CPhysical::ApplyFriction(float adhesiveLimit, CColPoint &colpoint)
ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos); ApplyFrictionTurnForce(frictionDir*fImpulse, pointpos);
if(fOtherSpeed > 0.1f && if(fOtherSpeed > 0.1f &&
colpoint.surfaceB != SURFACE_2 && colpoint.surfaceB != SURFACE_4 && colpoint.surfaceB != SURFACE_GRASS && colpoint.surfaceB != SURFACE_MUD_DRY &&
CSurfaceTable::GetAdhesionGroup(colpoint.surfaceA) == ADHESIVE_HARD){ CSurfaceTable::GetAdhesionGroup(colpoint.surfaceA) == ADHESIVE_HARD){
CVector v = frictionDir * fOtherSpeed * 0.25f; CVector v = frictionDir * fOtherSpeed * 0.25f;
for(int i = 0; i < 4; i++) for(int i = 0; i < 4; i++)
@ -1064,7 +1074,7 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
canshift = true; canshift = true;
else else
canshift = A->IsPed() && canshift = A->IsPed() &&
B->IsObject() && B->bInfiniteMass && !Bobj->bHasBeenDamaged; B->IsObject() && B->bIsStatic && !Bobj->bHasBeenDamaged;
if(B == A || if(B == A ||
B->m_scanCode == CWorld::GetCurrentScanCode() || B->m_scanCode == CWorld::GetCurrentScanCode() ||
!B->bUsesCollision || !B->bUsesCollision ||
@ -1076,15 +1086,14 @@ CPhysical::ProcessShiftSectorList(CPtrList *lists)
if(B->IsBuilding()) if(B->IsBuilding())
skipShift = false; skipShift = false;
else if(IsTrafficLight(A->GetModelIndex()) && else if(IsStreetLight(A->GetModelIndex()) &&
(B->IsVehicle() || B->IsPed()) && (B->IsVehicle() || B->IsPed()) &&
A->GetUp().z < 0.66f) A->GetUp().z < 0.66f)
skipShift = true; skipShift = true;
else if((A->IsVehicle() || A->IsPed()) && else if((A->IsVehicle() || A->IsPed()) &&
B->GetUp().z < 0.66f && B->GetUp().z < 0.66f &&
IsTrafficLight(B->GetModelIndex())) IsStreetLight(B->GetModelIndex()))
skipShift = true; skipShift = true;
// TODO: maybe flip some ifs here
else if(A->IsObject() && B->IsVehicle()){ else if(A->IsObject() && B->IsVehicle()){
CObject *Aobj = (CObject*)A; CObject *Aobj = (CObject*)A;
if(Aobj->ObjectCreatedBy != TEMP_OBJECT && if(Aobj->ObjectCreatedBy != TEMP_OBJECT &&
@ -1407,7 +1416,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
if(B->IsBuilding()) if(B->IsBuilding())
skipCollision = false; skipCollision = false;
else if(IsTrafficLight(A->GetModelIndex()) && else if(IsStreetLight(A->GetModelIndex()) &&
(B->IsVehicle() || B->IsPed()) && (B->IsVehicle() || B->IsPed()) &&
A->GetUp().z < 0.66f){ A->GetUp().z < 0.66f){
skipCollision = true; skipCollision = true;
@ -1415,7 +1424,7 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
Aobj->m_pCollidingEntity = B; Aobj->m_pCollidingEntity = B;
}else if((A->IsVehicle() || A->IsPed()) && }else if((A->IsVehicle() || A->IsPed()) &&
B->GetUp().z < 0.66f && B->GetUp().z < 0.66f &&
IsTrafficLight(B->GetModelIndex())){ IsStreetLight(B->GetModelIndex())){
skipCollision = true; skipCollision = true;
A->bSkipLineCol = true; A->bSkipLineCol = true;
Bobj->m_pCollidingEntity = A; Bobj->m_pCollidingEntity = A;
@ -1699,16 +1708,16 @@ CPhysical::ProcessCollisionSectorList(CPtrList *lists)
} }
if(B->IsPed() && A->IsVehicle() && if(B->IsPed() && A->IsVehicle() &&
(!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > 0.0025f)) (!Bped->IsPlayer() || B->bHasHitWall && A->m_vecMoveSpeed.MagnitudeSqr() > SQR(0.05f)))
Bped->KillPedWithCar((CVehicle*)A, maxImpulseB); Bped->KillPedWithCar((CVehicle*)A, maxImpulseB);
else if(B->GetModelIndex() == MI_TRAIN && A->IsPed() && else if(B->GetModelIndex() == MI_TRAIN && A->IsPed() &&
(!Aped->IsPlayer() || A->bHasHitWall)) (!Aped->IsPlayer() || A->bHasHitWall))
Aped->KillPedWithCar((CVehicle*)B, maxImpulseA*2.0f); Aped->KillPedWithCar((CVehicle*)B, maxImpulseA*2.0f);
else if(B->IsObject() && B->bUsesCollision && A->IsVehicle()){ else if(B->IsObject() && B->bUsesCollision && A->IsVehicle()){
// BUG? not impulseA?
if(Bobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f) if(Bobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
Bobj->ObjectDamage(maxImpulseB); Bobj->ObjectDamage(maxImpulseB);
}else if(A->IsObject() && A->bUsesCollision && B->IsVehicle()){ }else if(A->IsObject() && A->bUsesCollision && B->IsVehicle()){
// BUG? not impulseA?
if(Aobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f) if(Aobj->m_nCollisionDamageEffect && maxImpulseB > 20.0f)
Aobj->ObjectDamage(maxImpulseB); Aobj->ObjectDamage(maxImpulseB);
} }
@ -1774,7 +1783,7 @@ CPhysical::ProcessShift(void)
m_bIsVehicleBeingShifted = true; m_bIsVehicleBeingShifted = true;
CEntryInfoNode *node; CEntryInfoNode *node;
bool hasshifted = false; // whatever that means... bool hasshifted = false;
for(node = m_entryInfoList.first; node; node = node->next) for(node = m_entryInfoList.first; node; node = node->next)
hasshifted |= ProcessShiftSectorList(node->sector->m_lists); hasshifted |= ProcessShiftSectorList(node->sector->m_lists);
m_bIsVehicleBeingShifted = false; m_bIsVehicleBeingShifted = false;
@ -1831,7 +1840,7 @@ CPhysical::ProcessCollision(void)
int8 n = 1; // The number of steps we divide the time step into int8 n = 1; // The number of steps we divide the time step into
float step = 0.0f; // divided time step float step = 0.0f; // divided time step
float distSq = GetDistanceSq(); float distSq = m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep());
if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){ if(IsPed() && (distSq >= sq(0.2f) || ped->IsPlayer())){
if(ped->IsPlayer()) if(ped->IsPlayer())
@ -1920,8 +1929,11 @@ CPhysical::ProcessCollision(void)
bSkipLineCol = false; bSkipLineCol = false;
if(!m_vecMoveSpeed.IsZero() || if(!m_vecMoveSpeed.IsZero() ||
!m_vecTurnSpeed.IsZero() || !m_vecTurnSpeed.IsZero() ||
#ifdef GTA_TRAIN
bHitByTrain || bHitByTrain ||
GetStatus() == STATUS_PLAYER || IsPed() && ped->IsPlayer()){ #endif
GetStatus() == STATUS_PLAYER ||
IsPed() && ped->IsPlayer()){
if(IsVehicle()) if(IsVehicle())
((CVehicle*)this)->bVehicleColProcessed = true; ((CVehicle*)this)->bVehicleColProcessed = true;
if(CheckCollision()){ if(CheckCollision()){

View File

@ -18,7 +18,7 @@ public:
// The not properly indented fields haven't been checked properly yet // The not properly indented fields haven't been checked properly yet
int32 m_audioEntityId; int32 m_audioEntityId;
float unk1; float m_phys_unused1;
CTreadable *m_treadable[2]; // car and ped CTreadable *m_treadable[2]; // car and ped
uint32 m_nLastTimeCollided; uint32 m_nLastTimeCollided;
CVector m_vecMoveSpeed; // velocity CVector m_vecMoveSpeed; // velocity
@ -37,7 +37,7 @@ public:
CEntryInfoList m_entryInfoList; CEntryInfoList m_entryInfoList;
CPtrNode *m_movingListNode; CPtrNode *m_movingListNode;
char field_EC; int8 m_phys_unused2;
uint8 m_nStaticFrames; uint8 m_nStaticFrames;
uint8 m_nCollisionRecords; uint8 m_nCollisionRecords;
bool m_bIsVehicleBeingShifted; bool m_bIsVehicleBeingShifted;
@ -86,7 +86,6 @@ public:
void RemoveRefsToEntity(CEntity *ent); void RemoveRefsToEntity(CEntity *ent);
static void PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos); static void PlacePhysicalRelativeToOtherPhysical(CPhysical *other, CPhysical *phys, CVector localPos);
float GetDistanceSq(void) { return m_vecMoveSpeed.MagnitudeSqr() * sq(CTimer::GetTimeStep()); }
// get speed of point p relative to entity center // get speed of point p relative to entity center
CVector GetSpeed(const CVector &r); CVector GetSpeed(const CVector &r);
CVector GetSpeed(void) { return GetSpeed(CVector(0.0f, 0.0f, 0.0f)); } CVector GetSpeed(void) { return GetSpeed(CVector(0.0f, 0.0f, 0.0f)); }
@ -94,7 +93,7 @@ public:
return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/m_fTurnMass + return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/m_fTurnMass +
1.0f/m_fMass); 1.0f/m_fMass);
} }
float GetMassTime(const CVector &pos, const CVector &dir, float t) { float GetMassTweak(const CVector &pos, const CVector &dir, float t) {
return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/(m_fTurnMass*t) + return 1.0f / (CrossProduct(pos, dir).MagnitudeSqr()/(m_fTurnMass*t) +
1.0f/(m_fMass*t)); 1.0f/(m_fMass*t));
} }

View File

@ -1028,12 +1028,6 @@ DebugMenuProcess(void)
} }
#ifdef LIBRW
#define CURRENTCAM (rw::engine->currentCamera)
#else
#define CURRENTCAM ((RwCamera*)RWSRCGLOBAL(curCamera))
#endif
void void
DebugMenuRender(void) DebugMenuRender(void)
{ {
@ -1048,7 +1042,7 @@ DebugMenuRender(void)
RwRenderStateSet(rwRENDERSTATEFOGENABLE, 0); RwRenderStateSet(rwRENDERSTATEFOGENABLE, 0);
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE); RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
RwCamera *cam = CURRENTCAM; RwCamera *cam = RwCameraGetCurrentCamera();
screenWidth = RwRasterGetWidth(RwCameraGetRaster(cam)); screenWidth = RwRasterGetWidth(RwCameraGetRaster(cam));
screenHeight = RwRasterGetHeight(RwCameraGetRaster(cam)); screenHeight = RwRasterGetHeight(RwCameraGetRaster(cam));
@ -1080,7 +1074,7 @@ drawArrow(RwRect r, int direction, int style)
static RwImVertexIndex indices[] = { 0, 1, 2, 2, 1, 3 }; static RwImVertexIndex indices[] = { 0, 1, 2, 2, 1, 3 };
static RwIm2DVertex arrowVerts[4]; static RwIm2DVertex arrowVerts[4];
RwCamera *cam = CURRENTCAM; RwCamera *cam = RwCameraGetCurrentCamera();
float recipz = 1.0f/RwCameraGetNearClipPlane(cam); float recipz = 1.0f/RwCameraGetNearClipPlane(cam);
int width = RwRasterGetWidth(arrow); int width = RwRasterGetWidth(arrow);
@ -1183,7 +1177,7 @@ drawMouse(void)
static RwIm2DVertex vertices[4]; static RwIm2DVertex vertices[4];
RwIm2DVertex *vert; RwIm2DVertex *vert;
RwCamera *cam; RwCamera *cam;
cam = CURRENTCAM; cam = RwCameraGetCurrentCamera();
float x = mouseX; float x = mouseX;
float y = mouseY; float y = mouseY;
float w = RwRasterGetWidth(cursor); float w = RwRasterGetWidth(cursor);

View File

@ -0,0 +1,168 @@
#include "common.h"
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "frontendoption.h"
int numCustomFrontendOptions = 0;
FrontendOption *customFrontendOptions;
int optionCursor = -1;
eMenuScreen currentMenu;
void ChangeScreen(eMenuScreen screen, int option, bool fadeIn)
{
FrontEndMenuManager.m_nPrevScreen = FrontEndMenuManager.m_nCurrScreen;
FrontEndMenuManager.m_nCurrScreen = screen;
FrontEndMenuManager.m_nCurrOption = option;
if (fadeIn)
FrontEndMenuManager.m_nMenuFadeAlpha = 0;
}
void GoBack(bool fadeIn)
{
int screen = !FrontEndMenuManager.m_bGameNotLoaded ?
aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_PreviousPage[0];
int option = !FrontEndMenuManager.m_bGameNotLoaded ?
aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[1] : aScreens[FrontEndMenuManager.m_nCurrScreen].m_ParentEntry[0];
FrontEndMenuManager.ThingsToDoBeforeGoingBack();
ChangeScreen((eMenuScreen)screen, option, fadeIn);
}
uint8
GetNumberOfMenuOptions(int screen)
{
uint8 Rows = 0;
for (int i = 0; i < NUM_MENUROWS; i++) {
if (aScreens[screen].m_aEntries[i].m_Action == MENUACTION_NOTHING)
break;
++Rows;
}
return Rows;
}
// Used before reloading in InitialiseChangedLanguageSettings and debugmenu
void
RemoveCustomFrontendOptions()
{
for (int i = 0; i < MENUPAGES; i++) {
for (int j = 0; j < NUM_MENUROWS; j++) {
if (aScreens[i].m_aEntries[j].m_Action == MENUACTION_TRIGGERFUNC) {
int k;
for (k = j; k < NUM_MENUROWS-1; k++) {
memcpy(&aScreens[i].m_aEntries[k], &aScreens[i].m_aEntries[k+1], sizeof(CMenuScreen::CMenuEntry));
}
aScreens[i].m_aEntries[k].m_Action = MENUACTION_NOTHING;
aScreens[i].m_aEntries[k].m_EntryName[0] = '\0';
j--;
}
}
}
free(customFrontendOptions);
numCustomFrontendOptions = 0;
}
int8 RegisterNewOption(int screen)
{
numCustomFrontendOptions++;
if (numCustomFrontendOptions == 1)
customFrontendOptions = (FrontendOption*)malloc(numCustomFrontendOptions * sizeof(FrontendOption));
else
customFrontendOptions = (FrontendOption*)realloc(customFrontendOptions, numCustomFrontendOptions * sizeof(FrontendOption));
uint8 nth = GetNumberOfMenuOptions(screen);
if (optionCursor < 0) {
if (optionCursor == -1) {
if (!strcmp(aScreens[screen].m_aEntries[nth - 1].m_EntryName, "FEDS_TB") || !strcmp(aScreens[screen].m_aEntries[nth - 1].m_EntryName, "FESZ_CA")) {
// Move back button one below
memcpy(&aScreens[screen].m_aEntries[nth], &aScreens[screen].m_aEntries[nth - 1], sizeof(CMenuScreen::CMenuEntry));
nth--;
}
}
} else {
if (aScreens[screen].m_aEntries[optionCursor].m_Action != MENUACTION_NOTHING) {
for (int i = nth - 1; i >= optionCursor; i--) {
memcpy(&aScreens[screen].m_aEntries[i + 1], &aScreens[screen].m_aEntries[i], sizeof(CMenuScreen::CMenuEntry));
}
}
nth = optionCursor;
optionCursor++;
}
aScreens[screen].m_aEntries[nth].m_Action = MENUACTION_TRIGGERFUNC;
aScreens[screen].m_aEntries[nth].m_TargetMenu = numCustomFrontendOptions - 1;
aScreens[screen].m_aEntries[nth].m_EntryName[0] = 1; // just something to fool it
return nth;
}
void FrontendOptionSetPosition(eMenuScreen screen, int8 option)
{
currentMenu = screen;
optionCursor = option;
}
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc)
{
int8 screenOptionOrder = RegisterNewOption(currentMenu);
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.screen = currentMenu;
option.type = FEOPTION_SELECT;
option.leftText = leftText;
option.rightTexts = rightTexts;
option.numRightTexts = numRightTexts;
option.value = var;
option.displayedValue = *var;
option.onlyApplyOnEnter = onlyApplyOnEnter;
option.changeFunc = changeFunc;
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = returnPrevPageFunc;
}
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc drawFunc, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc)
{
int8 screenOptionOrder = RegisterNewOption(currentMenu);
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.screen = currentMenu;
option.type = FEOPTION_DYNAMIC;
option.drawFunc = drawFunc;
option.buttonPressFunc = buttonPressFunc;
option.leftText = leftText;
option.onlyApplyOnEnter = false;
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = returnPrevPageFunc;
}
void FrontendOptionAddRedirect(const wchar* text, eMenuScreen to, int8 selectedOption, bool fadeIn)
{
int8 screenOptionOrder = RegisterNewOption(currentMenu);
FrontendOption &option = customFrontendOptions[numCustomFrontendOptions - 1];
option.screen = currentMenu;
option.type = FEOPTION_REDIRECT;
option.to = to;
option.option = selectedOption;
option.fadeIn = fadeIn;
option.leftText = text;
option.onlyApplyOnEnter = false;
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = nil;
}
void FrontendOptionAddBackButton(const wchar* text, bool fadeIn)
{
int8 screenOptionOrder = RegisterNewOption(currentMenu);
FrontendOption& option = customFrontendOptions[numCustomFrontendOptions - 1];
option.screen = currentMenu;
option.type = FEOPTION_GOBACK;
option.fadeIn = fadeIn;
option.leftText = text;
option.onlyApplyOnEnter = false;
option.screenOptionOrder = screenOptionOrder;
option.returnPrevPageFunc = nil;
}
#endif

View File

@ -0,0 +1,87 @@
#pragma once
#include "common.h"
#ifdef CUSTOM_FRONTEND_OPTIONS
#include "Frontend.h"
// Warning: All of the code relies on that you won't use more then NUM_MENUROWS(18) options on one page. Also congrats if you can make 18 options visible at once.
// Static/select: User allocates variable, passes it to function and it's set automatically from input among the strings given to function,
// then you can handle ChangeFunc and ReturnPrevPageFunc if needed.
//
// Dynamic: Function doesn't accept value pointer, user should do operations with handling ButtonPressFunc.
// Right-side text can be set via DrawFunc, which is called on every draw. ReturnPrevPageFunc is also here if needed.
#define FEOPTION_SELECT 0
#define FEOPTION_DYNAMIC 1
#define FEOPTION_REDIRECT 2
#define FEOPTION_GOBACK 3
#define FEOPTION_ACTION_LEFT 0
#define FEOPTION_ACTION_RIGHT 1
#define FEOPTION_ACTION_SELECT 2
#define FEOPTION_ACTION_FOCUSLOSS 3
void RemoveCustomFrontendOptions();
void CustomFrontendOptionsPopulate();
// for static and dynamic options
typedef void (*ReturnPrevPageFunc)();
// for static options
typedef void (*ChangeFunc)(int8 displayedValue); // called before updating the value
// for dynamic options
typedef wchar* (*DrawFunc)(bool* disabled); // should return pointer to right text. *disabled = true will make it dark yellow
typedef void (*ButtonPressFunc)(int8 action); // see FEOPTION_ACTIONs above
struct FrontendOption
{
int8 type;
int8 screenOptionOrder;
eMenuScreen screen;
const wchar* leftText;
ReturnPrevPageFunc returnPrevPageFunc;
union {
// Only for dynamic
struct {
DrawFunc drawFunc;
ButtonPressFunc buttonPressFunc;
};
// Only for static/select
struct {
const wchar** rightTexts;
int8 numRightTexts;
int8 *value;
int8 displayedValue; // if onlyApplyOnEnter enabled
bool onlyApplyOnEnter;
ChangeFunc changeFunc;
};
// Only for redirect
struct {
eMenuScreen to;
int8 option;
bool fadeIn;
};
};
};
extern int numCustomFrontendOptions;
extern FrontendOption* customFrontendOptions;
// To be used in ButtonPressFunc / ChangeFunc(but that would be weird):
void ChangeScreen(eMenuScreen screen, int option = 0, bool fadeIn = true);
void GoBack(bool fadeIn = true);
// If option is positive number, all calls will increase it before using it (you can think it as cursor). -1 means before the back button, -2 is end of page
void FrontendOptionSetPosition(eMenuScreen screen, int8 option = -1);
void FrontendOptionAddSelect(const wchar* leftText, const wchar** rightTexts, int8 numRightTexts, int8 *var, bool onlyApplyOnEnter, ChangeFunc changeFunc, ReturnPrevPageFunc returnPrevPageFunc);
void FrontendOptionAddDynamic(const wchar* leftText, DrawFunc rightTextDrawFunc, ButtonPressFunc buttonPressFunc, ReturnPrevPageFunc returnPrevPageFunc);
void FrontendOptionAddRedirect(const wchar* text, eMenuScreen to, int8 selectedOption = 0, bool fadeIn = true);
void FrontendOptionAddBackButton(const wchar* text, bool fadeIn = true);
#endif

View File

@ -152,7 +152,7 @@ RwReal RwCameraGetNearClipPlane(const RwCamera *camera) { return camera->n
RwReal RwCameraGetFarClipPlane(const RwCamera *camera) { return camera->farPlane; } RwReal RwCameraGetFarClipPlane(const RwCamera *camera) { return camera->farPlane; }
RwCamera *RwCameraSetFogDistance(RwCamera *camera, RwReal fogDistance) { camera->fogPlane = fogDistance; return camera; } RwCamera *RwCameraSetFogDistance(RwCamera *camera, RwReal fogDistance) { camera->fogPlane = fogDistance; return camera; }
RwReal RwCameraGetFogDistance(const RwCamera *camera) { return camera->fogPlane; } RwReal RwCameraGetFogDistance(const RwCamera *camera) { return camera->fogPlane; }
RwCamera *RwCameraGetCurrentCamera(void); RwCamera *RwCameraGetCurrentCamera(void) { return rw::engine->currentCamera; }
RwCameraProjection RwCameraGetProjection(const RwCamera *camera); RwCameraProjection RwCameraGetProjection(const RwCamera *camera);
const RwV2d *RwCameraGetViewWindow(const RwCamera *camera) { return &camera->viewWindow; } const RwV2d *RwCameraGetViewWindow(const RwCamera *camera) { return &camera->viewWindow; }
RwMatrix *RwCameraGetViewMatrix(RwCamera *camera) { return &camera->viewMatrix; } RwMatrix *RwCameraGetViewMatrix(RwCamera *camera) { return &camera->viewMatrix; }
@ -470,7 +470,7 @@ RwBool RwRenderStateSet(RwRenderState state, void *value)
uint32 uival = (uintptr)value; uint32 uival = (uintptr)value;
uint32 fog; uint32 fog;
switch(state){ switch(state){
case rwRENDERSTATETEXTURERASTER: SetRenderState(TEXTURERASTER, uival); return true; case rwRENDERSTATETEXTURERASTER: SetRenderStatePtr(TEXTURERASTER, value); return true;
case rwRENDERSTATETEXTUREADDRESS: SetRenderState(TEXTUREADDRESS, uival); return true; case rwRENDERSTATETEXTUREADDRESS: SetRenderState(TEXTUREADDRESS, uival); return true;
case rwRENDERSTATETEXTUREADDRESSU: SetRenderState(TEXTUREADDRESSU, uival); return true; case rwRENDERSTATETEXTUREADDRESSU: SetRenderState(TEXTUREADDRESSU, uival); return true;
case rwRENDERSTATETEXTUREADDRESSV: SetRenderState(TEXTUREADDRESSV, uival); return true; case rwRENDERSTATETEXTUREADDRESSV: SetRenderState(TEXTUREADDRESSV, uival); return true;
@ -615,8 +615,8 @@ RpGeometry *RpGeometryCreateSpace(RwReal radius);
RpMorphTarget *RpMorphTargetSetBoundingSphere(RpMorphTarget *morphTarget, const RwSphere *boundingSphere) { morphTarget->boundingSphere = *boundingSphere; return morphTarget; } RpMorphTarget *RpMorphTargetSetBoundingSphere(RpMorphTarget *morphTarget, const RwSphere *boundingSphere) { morphTarget->boundingSphere = *boundingSphere; return morphTarget; }
RwSphere *RpMorphTargetGetBoundingSphere(RpMorphTarget *morphTarget) { return &morphTarget->boundingSphere; } RwSphere *RpMorphTargetGetBoundingSphere(RpMorphTarget *morphTarget) { return &morphTarget->boundingSphere; }
const RpMorphTarget *RpMorphTargetCalcBoundingSphere(const RpMorphTarget *morphTarget, RwSphere *boundingSphere) { *boundingSphere = morphTarget->calculateBoundingSphere(); return morphTarget; } const RpMorphTarget *RpMorphTargetCalcBoundingSphere(const RpMorphTarget *morphTarget, RwSphere *boundingSphere) { *boundingSphere = morphTarget->calculateBoundingSphere(); return morphTarget; }
RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount); RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount) { RwInt32 n = geometry->numMorphTargets; geometry->addMorphTargets(mtcount); return n; }
RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry); RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry) { return RpGeometryAddMorphTargets(geometry, 1); }
RpGeometry *RpGeometryRemoveMorphTarget(RpGeometry *geometry, RwInt32 morphTarget); RpGeometry *RpGeometryRemoveMorphTarget(RpGeometry *geometry, RwInt32 morphTarget);
RwInt32 RpGeometryGetNumMorphTargets(const RpGeometry *geometry); RwInt32 RpGeometryGetNumMorphTargets(const RpGeometry *geometry);
RpMorphTarget *RpGeometryGetMorphTarget(const RpGeometry *geometry, RwInt32 morphTarget) { return &geometry->morphTargets[morphTarget]; } RpMorphTarget *RpGeometryGetMorphTarget(const RpGeometry *geometry, RwInt32 morphTarget) { return &geometry->morphTargets[morphTarget]; }
@ -790,6 +790,12 @@ RpMaterial *RpMatFXMaterialSetEnvMapFrame( RpMaterial *material, RwFrame *frame
mfx->setEnvFrame(frame); mfx->setEnvFrame(frame);
return material; return material;
} }
RpMaterial *RpMatFXMaterialSetEnvMapFrameBufferAlpha( RpMaterial *material, RwBool useFrameBufferAlpha )
{
MatFX *mfx = MatFX::get(material);
mfx->setEnvFBAlpha(useFrameBufferAlpha);
return material;
}
RpMaterial *RpMatFXMaterialSetEnvMapCoefficient( RpMaterial *material, RwReal coef ) RpMaterial *RpMatFXMaterialSetEnvMapCoefficient( RpMaterial *material, RwReal coef )
{ {
MatFX *mfx = MatFX::get(material); MatFX *mfx = MatFX::get(material);

View File

@ -30,7 +30,11 @@ public:
RwMatrixDestroy(m_attachment); RwMatrixDestroy(m_attachment);
} }
void Attach(RwMatrix *matrix, bool owner = false){ void Attach(RwMatrix *matrix, bool owner = false){
#ifdef FIX_BUGS
if(m_attachment && m_hasRwMatrix)
#else
if(m_hasRwMatrix && m_attachment) if(m_hasRwMatrix && m_attachment)
#endif
RwMatrixDestroy(m_attachment); RwMatrixDestroy(m_attachment);
m_attachment = matrix; m_attachment = matrix;
m_hasRwMatrix = owner; m_hasRwMatrix = owner;
@ -223,6 +227,7 @@ public:
void SetRotate(float xAngle, float yAngle, float zAngle); void SetRotate(float xAngle, float yAngle, float zAngle);
void Rotate(float x, float y, float z); void Rotate(float x, float y, float z);
void RotateX(float x); void RotateX(float x);
void RotateY(float y);
void RotateZ(float z); void RotateZ(float z);
void Reorthogonalise(void); void Reorthogonalise(void);

View File

@ -60,6 +60,7 @@ public:
} }
void Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, float invSin, float t); void Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, float invSin, float t);
void Set(RwV3d *axis, float angle);
void Get(RwMatrix *matrix); void Get(RwMatrix *matrix);
}; };

View File

@ -59,6 +59,12 @@ CMatrix::RotateX(float x)
Rotate(x, 0.0f, 0.0f); Rotate(x, 0.0f, 0.0f);
} }
void
CMatrix::RotateY(float y)
{
Rotate(0.0f, y, 0.0f);
}
void void
CMatrix::RotateZ(float z) CMatrix::RotateZ(float z)
{ {
@ -177,6 +183,17 @@ CQuaternion::Slerp(const CQuaternion &q1, const CQuaternion &q2, float theta, fl
} }
} }
void
CQuaternion::Set(RwV3d *axis, float angle)
{
float halfCos = Cos(angle*0.5f);
float halfSin = Sin(angle*0.5f);
x = axis->x*halfSin;
y = axis->y*halfSin;
z = axis->z*halfSin;
w = halfCos;
}
void void
CQuaternion::Get(RwMatrix *matrix) CQuaternion::Get(RwMatrix *matrix)
{ {

View File

@ -3,14 +3,14 @@
#include "General.h" #include "General.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#define X(name, var, addr) int16 var; #define X(name, var) int16 var;
MODELINDICES MODELINDICES
#undef X #undef X
void void
InitModelIndices(void) InitModelIndices(void)
{ {
#define X(name, var, addr) var = -1; #define X(name, var) var = -1;
MODELINDICES MODELINDICES
#undef X #undef X
} }
@ -18,7 +18,7 @@ InitModelIndices(void)
void void
MatchModelString(const char *modelname, int16 id) MatchModelString(const char *modelname, int16 id)
{ {
#define X(name, var, addr) \ #define X(name, var) \
if(!CGeneral::faststrcmp(name, modelname)){ \ if(!CGeneral::faststrcmp(name, modelname)){ \
var = id; \ var = id; \
return; \ return; \

View File

@ -1,164 +1,164 @@
#pragma once #pragma once
#define MODELINDICES \ #define MODELINDICES \
X("fire_hydrant", MI_FIRE_HYDRANT, 0x5F5A00) \ X("fire_hydrant", MI_FIRE_HYDRANT) \
X("bagelstnd02", MI_BAGELSTAND2, 0x5F59FC) \ X("bagelstnd02", MI_BAGELSTAND2) \
X("fish01", MI_FISHSTALL01, 0x5F59EC) \ X("fish01", MI_FISHSTALL01) \
X("fishstall02", MI_FISHSTALL02, 0x5F59F0) \ X("fishstall02", MI_FISHSTALL02) \
X("fishstall03", MI_FISHSTALL03, 0x5F59F4) \ X("fishstall03", MI_FISHSTALL03) \
X("fishstall04", MI_FISHSTALL04, 0x5F59F8) \ X("fishstall04", MI_FISHSTALL04) \
X("taxisign", MI_TAXISIGN, 0x5F59E8) \ X("taxisign", MI_TAXISIGN) \
X("phonesign", MI_PHONESIGN, 0x5F59E4) \ X("phonesign", MI_PHONESIGN) \
X("noparkingsign1", MI_NOPARKINGSIGN1, 0x5F59E0) \ X("noparkingsign1", MI_NOPARKINGSIGN1) \
X("bussign1", MI_BUSSIGN1, 0x5F59DC) \ X("bussign1", MI_BUSSIGN1) \
X("roadworkbarrier1", MI_ROADWORKBARRIER1, 0x5F59D8) \ X("roadworkbarrier1", MI_ROADWORKBARRIER1) \
X("dump1", MI_DUMP1, 0x5F59D4) \ X("dump1", MI_DUMP1) \
X("trafficcone", MI_TRAFFICCONE, 0x5F59D0) \ X("trafficcone", MI_TRAFFICCONE) \
X("newsstand1", MI_NEWSSTAND, 0x5F59CC) \ X("newsstand1", MI_NEWSSTAND) \
X("postbox1", MI_POSTBOX1, 0x5F59C8) \ X("postbox1", MI_POSTBOX1) \
X("bin1", MI_BIN, 0x5F59C4) \ X("bin1", MI_BIN) \
X("wastebin", MI_WASTEBIN, 0x5F59C0) \ X("wastebin", MI_WASTEBIN) \
X("phonebooth1", MI_PHONEBOOTH1, 0x5F59BC) \ X("phonebooth1", MI_PHONEBOOTH1) \
X("parkingmeter", MI_PARKINGMETER, 0x5F59B8) \ X("parkingmeter", MI_PARKINGMETER) \
X("trafficlight1", MI_TRAFFICLIGHTS, 0x5F5958) \ X("trafficlight1", MI_TRAFFICLIGHTS) \
X("lamppost1", MI_SINGLESTREETLIGHTS1, 0x5F595C) \ X("lamppost1", MI_SINGLESTREETLIGHTS1) \
X("lamppost2", MI_SINGLESTREETLIGHTS2, 0x5F5960) \ X("lamppost2", MI_SINGLESTREETLIGHTS2) \
X("lamppost3", MI_SINGLESTREETLIGHTS3, 0x5F5964) \ X("lamppost3", MI_SINGLESTREETLIGHTS3) \
X("doublestreetlght1", MI_DOUBLESTREETLIGHTS, 0x5F5968) \ X("doublestreetlght1", MI_DOUBLESTREETLIGHTS) \
X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART, 0x5F596C) \ X("rd_Road2A10", MI_ROADSFORROADBLOCKSSTART) \
X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND, 0x5F5970) \ X("rd_Road1A30", MI_ROADSFORROADBLOCKSEND) \
X("veg_tree1", MI_TREE1, 0x5F5974) \ X("veg_tree1", MI_TREE1) \
X("veg_tree3", MI_TREE2, 0x5F5978) \ X("veg_tree3", MI_TREE2) \
X("veg_treea1", MI_TREE3, 0x5F597C) \ X("veg_treea1", MI_TREE3) \
X("veg_treenew01", MI_TREE4, 0x5F5980) \ X("veg_treenew01", MI_TREE4) \
X("veg_treenew05", MI_TREE5, 0x5F5984) \ X("veg_treenew05", MI_TREE5) \
X("veg_treeb1", MI_TREE6, 0x5F5988) \ X("veg_treeb1", MI_TREE6) \
X("veg_treenew10", MI_TREE7, 0x5F598C) \ X("veg_treenew10", MI_TREE7) \
X("veg_treea3", MI_TREE8, 0x5F5990) \ X("veg_treea3", MI_TREE8) \
X("veg_treenew09", MI_TREE9, 0x5F5994) \ X("veg_treenew09", MI_TREE9) \
X("veg_treenew08", MI_TREE10, 0x5F5998) \ X("veg_treenew08", MI_TREE10) \
X("veg_treenew03", MI_TREE11, 0x5F599C) \ X("veg_treenew03", MI_TREE11) \
X("veg_treenew16", MI_TREE12, 0x5F59A0) \ X("veg_treenew16", MI_TREE12) \
X("veg_treenew17", MI_TREE13, 0x5F59A4) \ X("veg_treenew17", MI_TREE13) \
X("veg_treenew06", MI_TREE14, 0x5F59A8) \ X("veg_treenew06", MI_TREE14) \
X("doc_crane_cab", MODELID_CRANE_1, 0x5F59AC) \ X("doc_crane_cab", MODELID_CRANE_1) \
X("cranetopb", MODELID_CRANE_2, 0x5F59B0) \ X("cranetopb", MODELID_CRANE_2) \
X("cranetopa", MODELID_CRANE_3, 0x5F59B4) \ X("cranetopa", MODELID_CRANE_3) \
X("package1", MI_COLLECTABLE1, 0x5F5A04) \ X("package1", MI_COLLECTABLE1) \
X("Money", MI_MONEY, 0x5F5A08) \ X("Money", MI_MONEY) \
X("barrel1", MI_CARMINE, 0x5F5A0C) \ X("barrel1", MI_CARMINE) \
X("oddjgaragdoor", MI_GARAGEDOOR1, 0x5F5A10) \ X("oddjgaragdoor", MI_GARAGEDOOR1) \
X("bombdoor", MI_GARAGEDOOR2, 0x5F5A14) \ X("bombdoor", MI_GARAGEDOOR2) \
X("door_bombshop", MI_GARAGEDOOR3, 0x5F5A18) \ X("door_bombshop", MI_GARAGEDOOR3) \
X("vheistlocdoor", MI_GARAGEDOOR4, 0x5F5A1C) \ X("vheistlocdoor", MI_GARAGEDOOR4) \
X("door2_garage", MI_GARAGEDOOR5, 0x5F5A20) \ X("door2_garage", MI_GARAGEDOOR5) \
X("ind_slidedoor", MI_GARAGEDOOR6, 0x5F5A24) \ X("ind_slidedoor", MI_GARAGEDOOR6) \
X("bankjobdoor", MI_GARAGEDOOR7, 0x5F5A28) \ X("bankjobdoor", MI_GARAGEDOOR7) \
X("door_jmsgrage", MI_GARAGEDOOR9, 0x5F5A2C) \ X("door_jmsgrage", MI_GARAGEDOOR9) \
X("jamesgrge_kb", MI_GARAGEDOOR10, 0x5F5A30) \ X("jamesgrge_kb", MI_GARAGEDOOR10) \
X("door_sfehousegrge", MI_GARAGEDOOR11, 0x5F5A34) \ X("door_sfehousegrge", MI_GARAGEDOOR11) \
X("shedgaragedoor", MI_GARAGEDOOR12, 0x5F5A38) \ X("shedgaragedoor", MI_GARAGEDOOR12) \
X("door4_garage", MI_GARAGEDOOR13, 0x5F5A3C) \ X("door4_garage", MI_GARAGEDOOR13) \
X("door_col_compnd_01", MI_GARAGEDOOR14, 0x5F5A40) \ X("door_col_compnd_01", MI_GARAGEDOOR14) \
X("door_col_compnd_02", MI_GARAGEDOOR15, 0x5F5A44) \ X("door_col_compnd_02", MI_GARAGEDOOR15) \
X("door_col_compnd_03", MI_GARAGEDOOR16, 0x5F5A48) \ X("door_col_compnd_03", MI_GARAGEDOOR16) \
X("door_col_compnd_04", MI_GARAGEDOOR17, 0x5F5A4C) \ X("door_col_compnd_04", MI_GARAGEDOOR17) \
X("door_col_compnd_05", MI_GARAGEDOOR18, 0x5F5A50) \ X("door_col_compnd_05", MI_GARAGEDOOR18) \
X("impex_door", MI_GARAGEDOOR19, 0x5F5A54) \ X("impex_door", MI_GARAGEDOOR19) \
X("SalvGarage", MI_GARAGEDOOR20, 0x5F5A58) \ X("SalvGarage", MI_GARAGEDOOR20) \
X("door3_garage", MI_GARAGEDOOR21, 0x5F5A5C) \ X("door3_garage", MI_GARAGEDOOR21) \
X("leveldoor2", MI_GARAGEDOOR22, 0x5F5A60) \ X("leveldoor2", MI_GARAGEDOOR22) \
X("double_garage_dr", MI_GARAGEDOOR23, 0x5F5A64) \ X("double_garage_dr", MI_GARAGEDOOR23) \
X("amcogaragedoor", MI_GARAGEDOOR24, 0x5F5A68) \ X("amcogaragedoor", MI_GARAGEDOOR24) \
X("towergaragedoor1", MI_GARAGEDOOR25, 0x5F5A6C) \ X("towergaragedoor1", MI_GARAGEDOOR25) \
X("towergaragedoor2", MI_GARAGEDOOR26, 0x5F5A70) \ X("towergaragedoor2", MI_GARAGEDOOR26) \
X("towergaragedoor3", MI_GARAGEDOOR27, 0x5F5A74) \ X("towergaragedoor3", MI_GARAGEDOOR27) \
X("plysve_gragedoor", MI_GARAGEDOOR28, 0x5F5A78) \ X("plysve_gragedoor", MI_GARAGEDOOR28) \
X("impexpsubgrgdoor", MI_GARAGEDOOR29, 0x5F5A7C) \ X("impexpsubgrgdoor", MI_GARAGEDOOR29) \
X("Sub_sprayshopdoor", MI_GARAGEDOOR30, 0x5F5A80) \ X("Sub_sprayshopdoor", MI_GARAGEDOOR30) \
X("ind_plyrwoor", MI_GARAGEDOOR31, 0x5F5A84) \ X("ind_plyrwoor", MI_GARAGEDOOR31) \
X("8ballsuburbandoor", MI_GARAGEDOOR32, 0x5F5A88) \ X("8ballsuburbandoor", MI_GARAGEDOOR32) \
X("barrel2", MI_NAUTICALMINE, 0x5F5A8C) \ X("barrel2", MI_NAUTICALMINE) \
X("crushercrush", MI_CRUSHERBODY, 0x5F5A90) \ X("crushercrush", MI_CRUSHERBODY) \
X("crushertop", MI_CRUSHERLID, 0x5F5A94) \ X("crushertop", MI_CRUSHERLID) \
X("donkeymag", MI_DONKEYMAG, 0x5F5A98) \ X("donkeymag", MI_DONKEYMAG) \
X("bullion", MI_BULLION, 0x5F5A9C) \ X("bullion", MI_BULLION) \
X("floatpackge1", MI_FLOATPACKAGE1, 0x5F5AA0) \ X("floatpackge1", MI_FLOATPACKAGE1) \
X("briefcase", MI_BRIEFCASE, 0x5F5AA4) \ X("briefcase", MI_BRIEFCASE) \
X("chinabanner1", MI_CHINABANNER1, 0x5F5AA8) \ X("chinabanner1", MI_CHINABANNER1) \
X("chinabanner2", MI_CHINABANNER2, 0x5F5AAC) \ X("chinabanner2", MI_CHINABANNER2) \
X("chinabanner3", MI_CHINABANNER3, 0x5F5AB0) \ X("chinabanner3", MI_CHINABANNER3) \
X("chinabanner4", MI_CHINABANNER4, 0x5F5AB4) \ X("chinabanner4", MI_CHINABANNER4) \
X("iten_chinatown5", MI_CHINABANNER5, 0x5F5AB8) \ X("iten_chinatown5", MI_CHINABANNER5) \
X("iten_chinatown7", MI_CHINABANNER6, 0x5F5ABC) \ X("iten_chinatown7", MI_CHINABANNER6) \
X("iten_chinatown3", MI_CHINABANNER7, 0x5F5AC0) \ X("iten_chinatown3", MI_CHINABANNER7) \
X("iten_chinatown2", MI_CHINABANNER8, 0x5F5AC4) \ X("iten_chinatown2", MI_CHINABANNER8) \
X("iten_chinatown4", MI_CHINABANNER9, 0x5F5AC8) \ X("iten_chinatown4", MI_CHINABANNER9) \
X("iten_washline01", MI_CHINABANNER10, 0x5F5ACC) \ X("iten_washline01", MI_CHINABANNER10) \
X("iten_washline02", MI_CHINABANNER11, 0x5F5AD0) \ X("iten_washline02", MI_CHINABANNER11) \
X("iten_washline03", MI_CHINABANNER12, 0x5F5AD4) \ X("iten_washline03", MI_CHINABANNER12) \
X("chinalanterns", MI_CHINALANTERN, 0x5F5AD8) \ X("chinalanterns", MI_CHINALANTERN) \
X("glassfx1", MI_GLASS1, 0x5F5ADC) \ X("glassfx1", MI_GLASS1) \
X("glassfx2", MI_GLASS2, 0x5F5AE0) \ X("glassfx2", MI_GLASS2) \
X("glassfx3", MI_GLASS3, 0x5F5AE4) \ X("glassfx3", MI_GLASS3) \
X("glassfx4", MI_GLASS4, 0x5F5AE8) \ X("glassfx4", MI_GLASS4) \
X("glassfx55", MI_GLASS5, 0x5F5AEC) \ X("glassfx55", MI_GLASS5) \
X("glassfxsub1", MI_GLASS6, 0x5F5AF0) \ X("glassfxsub1", MI_GLASS6) \
X("glassfxsub2", MI_GLASS7, 0x5F5AF4) \ X("glassfxsub2", MI_GLASS7) \
X("glassfx_composh", MI_GLASS8, 0x5F5AF8) \ X("glassfx_composh", MI_GLASS8) \
X("bridge_liftsec", MI_BRIDGELIFT, 0x5F5AFC) \ X("bridge_liftsec", MI_BRIDGELIFT) \
X("bridge_liftweight", MI_BRIDGEWEIGHT, 0x5F5B00) \ X("bridge_liftweight", MI_BRIDGEWEIGHT) \
X("subbridge_lift", MI_BRIDGEROADSEGMENT, 0x5F5B04) \ X("subbridge_lift", MI_BRIDGEROADSEGMENT) \
X("barrel4", MI_EXPLODINGBARREL, 0x5F5B08) \ X("barrel4", MI_EXPLODINGBARREL) \
X("flagsitaly", MI_ITALYBANNER1, 0x5F5B0C) \ X("flagsitaly", MI_ITALYBANNER1) \
X("adrenaline", MI_PICKUP_ADRENALINE, 0x5F5B10) \ X("adrenaline", MI_PICKUP_ADRENALINE) \
X("bodyarmour", MI_PICKUP_BODYARMOUR, 0x5F5B14) \ X("bodyarmour", MI_PICKUP_BODYARMOUR) \
X("info", MI_PICKUP_INFO, 0x5F5B18) \ X("info", MI_PICKUP_INFO) \
X("health", MI_PICKUP_HEALTH, 0x5F5B1C) \ X("health", MI_PICKUP_HEALTH) \
X("bonus", MI_PICKUP_BONUS, 0x5F5B20) \ X("bonus", MI_PICKUP_BONUS) \
X("bribe", MI_PICKUP_BRIBE, 0x5F5B24) \ X("bribe", MI_PICKUP_BRIBE) \
X("killfrenzy", MI_PICKUP_KILLFRENZY, 0x5F5B28) \ X("killfrenzy", MI_PICKUP_KILLFRENZY) \
X("camerapickup", MI_PICKUP_CAMERA, 0x5F5B2C) \ X("camerapickup", MI_PICKUP_CAMERA) \
X("bollardlight", MI_BOLLARDLIGHT, 0x5F5B30) \ X("bollardlight", MI_BOLLARDLIGHT) \
X("magnet", MI_MAGNET, 0x5F5B34) \ X("magnet", MI_MAGNET) \
X("streetlamp1", MI_STREETLAMP1, 0x5F5B38) \ X("streetlamp1", MI_STREETLAMP1) \
X("streetlamp2", MI_STREETLAMP2, 0x5F5B3C) \ X("streetlamp2", MI_STREETLAMP2) \
X("railtrax_lo4b", MI_RAILTRACKS, 0x5F5B40) \ X("railtrax_lo4b", MI_RAILTRACKS) \
X("bar_barrier10", MI_FENCE, 0x5F5B44) \ X("bar_barrier10", MI_FENCE) \
X("bar_barrier12", MI_FENCE2, 0x5F5B48) \ X("bar_barrier12", MI_FENCE2) \
X("petrolpump", MI_PETROLPUMP, 0x5F5B4C) \ X("petrolpump", MI_PETROLPUMP) \
X("bodycast", MI_BODYCAST, 0x5F5B50) \ X("bodycast", MI_BODYCAST) \
X("backdoor", MI_BACKDOOR, 0x5F5B54) \ X("backdoor", MI_BACKDOOR) \
X("coffee", MI_COFFEE, 0x5F5B58) \ X("coffee", MI_COFFEE) \
X("bouy", MI_BUOY, 0x5F5B5C) \ X("bouy", MI_BUOY) \
X("parktable1", MI_PARKTABLE, 0x5F5B60) \ X("parktable1", MI_PARKTABLE) \
X("sbwy_tunl_start", MI_SUBWAY1, 0x5F5B64) \ X("sbwy_tunl_start", MI_SUBWAY1) \
X("sbwy_tunl_bit", MI_SUBWAY2, 0x5F5B68) \ X("sbwy_tunl_bit", MI_SUBWAY2) \
X("sbwy_tunl_bend", MI_SUBWAY3, 0x5F5B6C) \ X("sbwy_tunl_bend", MI_SUBWAY3) \
X("sbwy_tunl_cstm6", MI_SUBWAY4, 0x5F5B70) \ X("sbwy_tunl_cstm6", MI_SUBWAY4) \
X("sbwy_tunl_cstm7", MI_SUBWAY5, 0x5F5B74) \ X("sbwy_tunl_cstm7", MI_SUBWAY5) \
X("sbwy_tunl_cstm8", MI_SUBWAY6, 0x5F5B78) \ X("sbwy_tunl_cstm8", MI_SUBWAY6) \
X("sbwy_tunl_cstm10", MI_SUBWAY7, 0x5F5B7C) \ X("sbwy_tunl_cstm10", MI_SUBWAY7) \
X("sbwy_tunl_cstm9", MI_SUBWAY8, 0x5F5B80) \ X("sbwy_tunl_cstm9", MI_SUBWAY8) \
X("sbwy_tunl_cstm11", MI_SUBWAY9, 0x5F5B84) \ X("sbwy_tunl_cstm11", MI_SUBWAY9) \
X("sbwy_tunl_cstm1", MI_SUBWAY10, 0x5F5B88) \ X("sbwy_tunl_cstm1", MI_SUBWAY10) \
X("sbwy_tunl_cstm2", MI_SUBWAY11, 0x5F5B8C) \ X("sbwy_tunl_cstm2", MI_SUBWAY11) \
X("sbwy_tunl_cstm4", MI_SUBWAY12, 0x5F5B90) \ X("sbwy_tunl_cstm4", MI_SUBWAY12) \
X("sbwy_tunl_cstm3", MI_SUBWAY13, 0x5F5B94) \ X("sbwy_tunl_cstm3", MI_SUBWAY13) \
X("sbwy_tunl_cstm5", MI_SUBWAY14, 0x5F5B98) \ X("sbwy_tunl_cstm5", MI_SUBWAY14) \
X("subplatform_n2", MI_SUBWAY15, 0x5F5B9C) \ X("subplatform_n2", MI_SUBWAY15) \
X("suby_tunl_start", MI_SUBWAY16, 0x5F5BA0) \ X("suby_tunl_start", MI_SUBWAY16) \
X("sbwy_tunl_start2", MI_SUBWAY17, 0x5F5BA4) \ X("sbwy_tunl_start2", MI_SUBWAY17) \
X("indy_tunl_start", MI_SUBWAY18, 0x5F5BA8) \ X("indy_tunl_start", MI_SUBWAY18) \
X("indsubway03", MI_SUBPLATFORM_IND, 0x5F5BAC) \ X("indsubway03", MI_SUBPLATFORM_IND) \
X("comerside_subway", MI_SUBPLATFORM_COMS, 0x5F5BB0) \ X("comerside_subway", MI_SUBPLATFORM_COMS) \
X("subplatform", MI_SUBPLATFORM_COMS2, 0x5F5BB4) \ X("subplatform", MI_SUBPLATFORM_COMS2) \
X("subplatform_n", MI_SUBPLATFORM_COMN, 0x5F5BB8) \ X("subplatform_n", MI_SUBPLATFORM_COMN) \
X("Otherside_subway", MI_SUBPLATFORM_SUB, 0x5F5BBC) \ X("Otherside_subway", MI_SUBPLATFORM_SUB) \
X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \ X("subplatform_sub", MI_SUBPLATFORM_SUB2) \
X("files", MI_FILES, 0x5F5BC4) X("files", MI_FILES)
#define X(name, var, addr) extern int16 var; #define X(name, var) extern int16 var;
MODELINDICES MODELINDICES
#undef X #undef X
@ -255,7 +255,9 @@ enum
MI_BUSKER4, MI_BUSKER4,
// three more peds possible // three more peds possible
MI_FIRST_VEHICLE = 90, MI_LAST_PED = 89,
MI_FIRST_VEHICLE,
MI_LANDSTAL = MI_FIRST_VEHICLE, MI_LANDSTAL = MI_FIRST_VEHICLE,
MI_IDAHO, MI_IDAHO,
MI_STINGER, MI_STINGER,
@ -382,7 +384,7 @@ IsGlass(int16 id)
} }
inline bool inline bool
IsTrafficLight(int16 id) IsStreetLight(int16 id)
{ {
return id == MI_TRAFFICLIGHTS || return id == MI_TRAFFICLIGHTS ||
id == MI_SINGLESTREETLIGHTS1 || id == MI_SINGLESTREETLIGHTS1 ||
@ -410,7 +412,7 @@ IsBoatModel(int16 id)
inline bool inline bool
IsPedModel(int16 id) IsPedModel(int16 id)
{ {
return id >= 0 && id <= 89; return id >= MI_PLAYER && id <= MI_LAST_PED;
} }
inline bool inline bool

View File

@ -21,16 +21,19 @@ CPedModelInfo::DeleteRwObject(void)
frame = RpAtomicGetFrame(m_head); frame = RpAtomicGetFrame(m_head);
RpAtomicDestroy(m_head); RpAtomicDestroy(m_head);
RwFrameDestroy(frame); RwFrameDestroy(frame);
m_head = nil;
} }
if(m_lhand){ if(m_lhand){
frame = RpAtomicGetFrame(m_lhand); frame = RpAtomicGetFrame(m_lhand);
RpAtomicDestroy(m_lhand); RpAtomicDestroy(m_lhand);
RwFrameDestroy(frame); RwFrameDestroy(frame);
m_lhand = nil;
} }
if(m_rhand){ if(m_rhand){
frame = RpAtomicGetFrame(m_rhand); frame = RpAtomicGetFrame(m_rhand);
RpAtomicDestroy(m_rhand); RpAtomicDestroy(m_rhand);
RwFrameDestroy(frame); RwFrameDestroy(frame);
m_rhand = nil;
} }
#endif #endif
CClumpModelInfo::DeleteRwObject(); // PC calls this first CClumpModelInfo::DeleteRwObject(); // PC calls this first
@ -248,7 +251,7 @@ CPedModelInfo::CreateHitColModel(void)
center.x = mat->pos.x + m_pColNodeInfos[i].x; center.x = mat->pos.x + m_pColNodeInfos[i].x;
center.y = mat->pos.y + 0.0f; center.y = mat->pos.y + 0.0f;
center.z = mat->pos.z + m_pColNodeInfos[i].z; center.z = mat->pos.z + m_pColNodeInfos[i].z;
spheres[i].Set(radius, center, SURFACE_FLESH, m_pColNodeInfos[i].pieceType); spheres[i].Set(radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType);
} }
} }
RwMatrixDestroy(mat); RwMatrixDestroy(mat);
@ -332,7 +335,7 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump)
center.x = pos.x + m_pColNodeInfos[i].x; center.x = pos.x + m_pColNodeInfos[i].x;
center.y = pos.y + 0.0f; center.y = pos.y + 0.0f;
center.z = pos.z + m_pColNodeInfos[i].z; center.z = pos.z + m_pColNodeInfos[i].z;
spheres[i].Set(m_pColNodeInfos[i].radius, center, SURFACE_FLESH, m_pColNodeInfos[i].pieceType); spheres[i].Set(m_pColNodeInfos[i].radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType);
} }
RwMatrixDestroy(invmat); RwMatrixDestroy(invmat);
RwMatrixDestroy(mat); RwMatrixDestroy(mat);

View File

@ -36,7 +36,14 @@ public:
static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX]; static RwObjectNameIdAssocation m_pPedIds[PED_NODE_MAX];
CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) { m_hitColModel = nil; } CPedModelInfo(void) : CClumpModelInfo(MITYPE_PED) {
m_hitColModel = nil;
#ifdef PED_SKIN
m_head = nil;
m_lhand = nil;
m_rhand = nil;
#endif
}
~CPedModelInfo(void) { delete m_hitColModel; } ~CPedModelInfo(void) { delete m_hitColModel; }
void DeleteRwObject(void); void DeleteRwObject(void);
void SetClump(RpClump *); void SetClump(RpClump *);

View File

@ -157,6 +157,13 @@ CSimpleModelInfo::SetupBigBuilding(void)
if(related) if(related)
m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier; m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier;
else else
#ifdef FIX_BUGS
if(toupper(m_name[0]) == 'L' && toupper(m_name[1]) == 'O' && toupper(m_name[2]) == 'D')
m_lodDistances[2] = 100.0f; m_lodDistances[2] = 100.0f;
else
m_lodDistances[2] = 0.0f;
#else
m_lodDistances[2] = 100.0f;
#endif
} }
} }

View File

@ -16,6 +16,7 @@
#include "Train.h" #include "Train.h"
#include "Plane.h" #include "Plane.h"
#include "Heli.h" #include "Heli.h"
#include "Bike.h"
#include "ModelIndices.h" #include "ModelIndices.h"
#include "ModelInfo.h" #include "ModelInfo.h"
@ -120,16 +121,16 @@ RwObjectNameIdAssocation planeIds[] = {
}; };
RwObjectNameIdAssocation bikeIds[] = { RwObjectNameIdAssocation bikeIds[] = {
{ "chassis_dummy", 1, 0 }, { "chassis_dummy", BIKE_CHASSIS, 0 },
{ "forks_front", 2, 0 }, { "forks_front", BIKE_FORKS_FRONT, 0 },
{ "forks_rear", 3, 0 }, { "forks_rear", BIKE_FORKS_REAR, 0 },
{ "wheel_front", 4, 0 }, { "wheel_front", BIKE_WHEEL_FRONT, 0 },
{ "wheel_rear", 5, 0 }, { "wheel_rear", BIKE_WHEEL_REAR, 0 },
{ "mudguard", 6, 0 }, { "mudguard", BIKE_MUDGUARD, 0 },
{ "ped_frontseat", 2, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "ped_frontseat", CAR_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "headlights", 0, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "headlights", CAR_POS_HEADLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "taillights", 1, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "taillights", CAR_POS_TAILLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "exhaust", 9, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID }, { "exhaust", CAR_POS_EXHAUST, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "extra1", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, { "extra1", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },
{ "extra2", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, { "extra2", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },
{ "extra3", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID }, { "extra3", 0, VEHICLE_FLAG_DRAWLAST | VEHICLE_FLAG_COMP | CLUMP_FLAG_NO_HIERID },

View File

@ -35,6 +35,43 @@ enum eVehicleType {
NUM_VEHICLE_TYPES NUM_VEHICLE_TYPES
}; };
enum eCarPositions
{
CAR_POS_HEADLIGHTS,
CAR_POS_TAILLIGHTS,
CAR_POS_FRONTSEAT,
CAR_POS_BACKSEAT,
// these are unused so we don't know the actual values
CAR_POS_REVERSELIGHTS,
CAR_POS_BRAKELIGHTS,
CAR_POS_INDICATORS_FRONT,
CAR_POS_INDICATORS_BACK,
CAR_POS_STEERWHEEL,
//
CAR_POS_EXHAUST
};
enum eBoatPositions
{
BOAT_POS_FRONTSEAT
};
enum eTrainPositions
{
TRAIN_POS_LIGHT_FRONT,
TRAIN_POS_LIGHT_REAR,
TRAIN_POS_LEFT_ENTRY,
TRAIN_POS_MID_ENTRY,
TRAIN_POS_RIGHT_ENTRY
};
enum ePlanePositions
{
PLANE_POS_LIGHT_LEFT,
PLANE_POS_LIGHT_RIGHT,
PLANE_POS_LIGHT_TAIL,
};
enum { enum {
NUM_VEHICLE_POSITIONS = 10 NUM_VEHICLE_POSITIONS = 10
}; };
@ -100,6 +137,7 @@ public:
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags); void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
void PreprocessHierarchy(void); void PreprocessHierarchy(void);
void GetWheelPosn(int32 n, CVector &pos); void GetWheelPosn(int32 n, CVector &pos);
CVector &GetFrontSeatPosn(void) { return m_positions[m_vehicleType == VEHICLE_TYPE_BOAT ? BOAT_POS_FRONTSEAT : CAR_POS_FRONTSEAT]; };
int32 ChooseComponent(void); int32 ChooseComponent(void);
int32 ChooseSecondComponent(void); int32 ChooseSecondComponent(void);

View File

@ -11,6 +11,7 @@
#include "ObjectData.h" #include "ObjectData.h"
#include "World.h" #include "World.h"
#include "Floater.h" #include "Floater.h"
#include "soundlist.h"
int16 CObject::nNoTempObjects; int16 CObject::nNoTempObjects;
int16 CObject::nBodyCastHealth = 1000; int16 CObject::nBodyCastHealth = 1000;
@ -219,7 +220,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
} }
PlayOneShotScriptObject(_SCRSOUND_CARDBOARD_BOX_SMASH, vecPos); PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos);
break; break;
} }
case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: { case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
@ -242,7 +243,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
} }
PlayOneShotScriptObject(_SCRSOUND_WOODEN_BOX_SMASH, vecPos); PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_1, vecPos);
break; break;
} }
case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: { case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
@ -267,7 +268,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
} }
PlayOneShotScriptObject(_SCRSOUND_TYRE_BUMP, vecPos); PlayOneShotScriptObject(SCRIPT_SOUND_TIRE_COLLISION, vecPos);
break; break;
} }
case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: { case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
@ -292,7 +293,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80); int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0); CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
} }
PlayOneShotScriptObject(_SCRSOUND_COL_CAR, vecPos); PlayOneShotScriptObject(SCRIPT_SOUND_METAL_COLLISION, vecPos);
break; break;
} }
} }

View File

@ -55,14 +55,7 @@ public:
uint8 m_nCollisionDamageEffect; uint8 m_nCollisionDamageEffect;
uint8 m_nSpecialCollisionResponseCases; uint8 m_nSpecialCollisionResponseCases;
bool m_bCameraToAvoidThisObject; bool m_bCameraToAvoidThisObject;
uint32 m_obj_unused1;
// this batch is unused
int8 field_17B;
int8 field_17C;
int8 field_17D;
int8 field_17E;
int8 field_17F;
uint32 m_nEndOfLifeTime; uint32 m_nEndOfLifeTime;
int16 m_nRefModelIndex; int16 m_nRefModelIndex;
CEntity *m_pCurSurface; CEntity *m_pCurSurface;

View File

@ -57,56 +57,15 @@
#include "Timecycle.h" #include "Timecycle.h"
#include "ParticleObject.h" #include "ParticleObject.h"
#include "Floater.h" #include "Floater.h"
#include "Range2D.h"
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f) #define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
CPed *gapTempPedList[50]; CPed *gapTempPedList[50];
uint16 gnNumTempPedList; uint16 gnNumTempPedList;
CColPoint aTempPedColPts[MAX_COLLISION_POINTS]; static CColPoint aTempPedColPts[MAX_COLLISION_POINTS];
// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
PedAudioData CommentWaitTime[39] = {
{500, 800, 500, 2},
{500, 800, 500, 2},
{500, 800, 500, 2},
{500, 800, 500, 2},
{100, 2, 100, 2},
{700, 500, 1000, 500},
{700, 500, 1000, 500},
{5000, 2000, 15000, 3000},
{5000, 2000, 15000, 3000},
{5000, 2000, 15000, 3000},
{6000, 6000, 6000, 6000},
{1000, 1000, 2000, 2000},
{1000, 500, 2000, 1500},
{1000, 500, 2000, 1500},
{800, 200, 1000, 500},
{800, 200, 1000, 500},
{800, 400, 2000, 1000},
{800, 400, 2000, 1000},
{400, 300, 2000, 1000},
{2000, 1000, 2500, 1500},
{200, 200, 200, 200},
{6000, 3000, 5000, 6000},
{6000, 3000, 9000, 5000},
{6000, 3000, 9000, 5000},
{6000, 3000, 9000, 5000},
{400, 300, 4000, 1000},
{400, 300, 4000, 1000},
{400, 300, 4000, 1000},
{1000, 500, 3000, 1000},
{1000, 500, 1000, 1000},
{3000, 2000, 3000, 2000},
{1000, 500, 3000, 6000},
{1000, 500, 2000, 4000},
{1000, 500, 2000, 5000},
{1000, 500, 3000, 2000},
{1600, 1000, 2000, 2000},
{3000, 2000, 5000, 3000},
{1000, 1000, 1000, 1000},
{1000, 1000, 5000, 5000},
};
uint16 nPlayerInComboMove; uint16 nPlayerInComboMove;
RpClump *flyingClumpTemp; RpClump *flyingClumpTemp;
@ -159,228 +118,11 @@ void *CPed::operator new(size_t sz, int handle) { return CPools::GetPedPool()->N
void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); } void CPed::operator delete(void *p, size_t sz) { CPools::GetPedPool()->Delete((CPed*)p); }
void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); } void CPed::operator delete(void *p, int handle) { CPools::GetPedPool()->Delete((CPed*)p); }
static char ObjectiveText[][28] = {
"No Obj",
"Wait on Foot",
"Flee on Foot Till Safe",
"Guard Spot",
"Guard Area",
"Wait in Car",
"Wait in Car then Getout",
"Kill Char on Foot",
"Kill Char Any Means",
"Flee Char on Foot Till Safe",
"Flee Char on Foot Always",
"GoTo Char on Foot",
"Follow Char in Formation",
"Leave Car",
"Enter Car as Passenger",
"Enter Car as Driver",
"Follow Car in Car",
"Fire at Obj from Vehicle",
"Destroy Obj",
"Destroy Car",
"GoTo Area Any Means",
"GoTo Area on Foot",
"Run to Area",
"GoTo Area in Car",
"Follow Car on Foot Woffset",
"Guard Attack",
"Set Leader",
"Follow Route",
"Solicit",
"Take Taxi",
"Catch Train",
"Buy IceCream",
"Steal Any Car",
"Mug Char",
#ifdef VC_PED_PORTS
"Leave Car and Die"
#endif
};
static char StateText[][18] = {
"None",
"Idle",
"Look Entity",
"Look Heading",
"Wander Range",
"Wander Path",
"Seek Pos",
"Seek Entity",
"Flee Pos",
"Flee Entity",
"Pursue",
"Follow Path",
"Sniper Mode",
"Rocket Mode",
"Dummy",
"Pause",
"Attack",
"Fight",
"Face Phone",
"Make Call",
"Chat",
"Mug",
"AimGun",
"AI Control",
"Seek Car",
"Seek InBoat",
"Follow Route",
"C.P.R.",
"Solicit",
"Buy IceCream",
"Investigate",
"Step away",
"On Fire",
"Unknown",
"STATES_NO_AI",
"Jump",
"Fall",
"GetUp",
"Stagger",
"Dive away",
"STATES_NO_ST",
"Enter Train",
"Exit Train",
"Arrest Plyr",
"Driving",
"Passenger",
"Taxi Passngr",
"Open Door",
"Die",
"Dead",
"CarJack",
"Drag fm Car",
"Enter Car",
"Steal Car",
"Exit Car",
"Hands Up",
"Arrested",
};
static char PersonalityTypeText[][18] = {
"Player",
"Cop",
"Medic",
"Fireman",
"Gang 1",
"Gang 2",
"Gang 3",
"Gang 4",
"Gang 5",
"Gang 6",
"Gang 7",
"Street Guy",
"Suit Guy",
"Sensible Guy",
"Geek Guy",
"Old Guy",
"Tough Guy",
"Street Girl",
"Suit Girl",
"Sensible Girl",
"Geek Girl",
"Old Girl",
"Tough Girl",
"Tramp Male",
"Tramp Female",
"Tourist",
"Prostitute",
"Criminal",
"Busker",
"Taxi Driver",
"Psycho",
"Steward",
"Sports Fan",
"Shopper",
"Old Shopper"
};
static char WaitStateText[][16] = {
"No Wait",
"Traffic Lights",
"Pause CrossRoad",
"Look CrossRoad",
"Look Ped",
"Look Shop",
"Look Accident",
"FaceOff Gang",
"Double Back",
"Hit Wall",
"Turn 180deg",
"Surprised",
"Ped Stuck",
"Look About",
"Play Duck",
"Play Cower",
"Play Taxi",
"Play HandsUp",
"Play HandsCower",
"Play Chat",
"Finish Flee",
};
#ifdef TOGGLEABLE_BETA_FEATURES #ifdef TOGGLEABLE_BETA_FEATURES
bool CPed::bPopHeadsOnHeadshot = false; bool CPed::bPopHeadsOnHeadshot = false;
bool CPed::bMakePedsRunToPhonesToReportCrimes = false; bool CPed::bMakePedsRunToPhonesToReportCrimes = false;
#endif #endif
#ifndef MASTER
int nDisplayDebugInfo = 0;
void
CPed::SwitchDebugDisplay(void)
{
nDisplayDebugInfo = !nDisplayDebugInfo;
}
void
CPed::DebugRenderOnePedText(void)
{
if ((GetPosition() - TheCamera.GetPosition()).MagnitudeSqr() < sq(30.0f)) {
float width, height;
RwV3d screenCoords;
CVector bitAbove = GetPosition();
bitAbove.z += 2.0f;
if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) {
float lineHeight = SCREEN_SCALE_Y(Min(height/100.0f, 0.7f) * 22.0f);
DefinedState();
CFont::SetPropOn();
CFont::SetBackgroundOn();
// Originally both of them were being divided by 60.0f.
float xScale = Min(width / 240.0f, 0.7f);
float yScale = Min(height / 80.0f, 0.7f);
CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale));
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH);
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 0, 255));
CFont::SetBackGroundOnlyTextOn();
CFont::SetFontStyle(0);
AsciiToUnicode(StateText[m_nPedState], gUString);
CFont::PrintString(screenCoords.x, screenCoords.y, gUString);
AsciiToUnicode(ObjectiveText[m_objective], gUString);
CFont::PrintString(screenCoords.x, screenCoords.y + lineHeight, gUString);
AsciiToUnicode(PersonalityTypeText[m_pedStats->m_type], gUString);
CFont::PrintString(screenCoords.x, screenCoords.y + 2 * lineHeight, gUString);
AsciiToUnicode(WaitStateText[m_nWaitState], gUString);
CFont::PrintString(screenCoords.x, screenCoords.y + 3 * lineHeight, gUString);
if (m_nPedState == PED_SEEK_POS || m_nPedState == PED_SEEK_ENTITY) {
sprintf(gString, "Safe distance to target: %.2f", m_distanceToCountSeekDone);
AsciiToUnicode(gString, gUString);
CFont::PrintString(screenCoords.x, screenCoords.y + 4 * lineHeight, gUString);
}
DefinedState();
}
}
}
#endif
CPed::~CPed(void) CPed::~CPed(void)
{ {
CWorld::Remove(this); CWorld::Remove(this);
@ -441,10 +183,13 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedType = pedType; m_nPedType = pedType;
m_lastSoundStart = 0; m_lastSoundStart = 0;
m_soundStart = 0; m_soundStart = 0;
m_lastQueuedSound = SOUND_TOTAL_PED_SOUNDS; m_lastQueuedSound = SOUND_NO_SOUND;
m_queuedSound = SOUND_TOTAL_PED_SOUNDS; m_queuedSound = SOUND_NO_SOUND;
m_objective = OBJECTIVE_NONE; m_objective = OBJECTIVE_NONE;
m_prevObjective = OBJECTIVE_NONE; m_prevObjective = OBJECTIVE_NONE;
#ifdef FIX_BUGS
m_objectiveTimer = 0;
#endif
CharCreatedBy = RANDOM_CHAR; CharCreatedBy = RANDOM_CHAR;
m_leader = nil; m_leader = nil;
m_pedInObjective = nil; m_pedInObjective = nil;
@ -498,6 +243,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedState = PED_IDLE; m_nPedState = PED_IDLE;
m_nLastPedState = PED_NONE; m_nLastPedState = PED_NONE;
m_nMoveState = PEDMOVE_STILL; m_nMoveState = PEDMOVE_STILL;
#ifdef FIX_BUGS
m_nPrevMoveState = PEDMOVE_NONE;
#endif
m_nStoredMoveState = PEDMOVE_NONE; m_nStoredMoveState = PEDMOVE_NONE;
m_pFire = nil; m_pFire = nil;
m_pPointGunAt = nil; m_pPointGunAt = nil;
@ -1087,6 +835,9 @@ CPed::ClearAimFlag(void)
bIsAimingGun = false; bIsAimingGun = false;
bIsRestoringGun = true; bIsRestoringGun = true;
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM; m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
#ifdef VC_PED_PORTS
m_lookTimer = 0;
#endif
} }
if (IsPlayer()) if (IsPlayer())
@ -1682,11 +1433,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
switch (component) { switch (component) {
case CAR_DOOR_RF: case CAR_DOOR_RF:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
vehDoorPos.x += seatOffset; vehDoorPos.x += seatOffset;
vehDoorOffset.x = -vehDoorOffset.x; vehDoorOffset.x = -vehDoorOffset.x;
break; break;
@ -1698,11 +1445,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
break; break;
case CAR_DOOR_LF: case CAR_DOOR_LF:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
vehDoorPos.x = -(vehDoorPos.x + seatOffset); vehDoorPos.x = -(vehDoorPos.x + seatOffset);
break; break;
@ -1712,11 +1455,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
break; break;
default: default:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
vehDoorOffset = CVector(0.0f, 0.0f, 0.0f); vehDoorOffset = CVector(0.0f, 0.0f, 0.0f);
} }
return vehDoorPos - vehDoorOffset; return vehDoorPos - vehDoorOffset;
@ -2037,7 +1776,7 @@ particleProduceFootDust(CPed *ped, CVector const &pos, float size, int times)
switch (ped->m_nSurfaceTouched) switch (ped->m_nSurfaceTouched)
{ {
case SURFACE_TARMAC: case SURFACE_TARMAC:
case SURFACE_DIRT: case SURFACE_GRAVEL:
case SURFACE_PAVEMENT: case SURFACE_PAVEMENT:
case SURFACE_SAND: case SURFACE_SAND:
for (int i = 0; i < times; ++i) { for (int i = 0; i < times; ++i) {
@ -2190,7 +1929,7 @@ CPed::PlayFootSteps(void)
} }
} }
if (m_nSurfaceTouched == SURFACE_PUDDLE) { if (m_nSurfaceTouched == SURFACE_WATER) {
float pedSpeed = CVector2D(m_vecMoveSpeed).Magnitude(); float pedSpeed = CVector2D(m_vecMoveSpeed).Magnitude();
if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) { if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) {
#ifdef PC_PARTICLE #ifdef PC_PARTICLE
@ -2380,7 +2119,7 @@ CPed::SetupLighting(void)
#ifndef MASTER #ifndef MASTER
// Originally this was being called through iteration of Sectors, but putting it here is better. // Originally this was being called through iteration of Sectors, but putting it here is better.
if (nDisplayDebugInfo && !IsPlayer()) if (GetDebugDisplay() != 0 && !IsPlayer())
DebugRenderOnePedText(); DebugRenderOnePedText();
#endif #endif
@ -2514,37 +2253,37 @@ CPed::CalculateNewVelocity(void)
if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc) { if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc) {
#endif #endif
LimbOrientation newUpperLegs; LimbOrientation newUpperLegs;
newUpperLegs.phi = localWalkAngle; newUpperLegs.yaw = localWalkAngle;
if (newUpperLegs.phi < -DEGTORAD(100.0f)) { if (newUpperLegs.yaw < -DEGTORAD(100.0f)) {
newUpperLegs.phi += PI; newUpperLegs.yaw += PI;
} else if (newUpperLegs.phi > DEGTORAD(100.0f)) { } else if (newUpperLegs.yaw > DEGTORAD(100.0f)) {
newUpperLegs.phi -= PI; newUpperLegs.yaw -= PI;
} }
if (newUpperLegs.phi > -DEGTORAD(50.0f) && newUpperLegs.phi < DEGTORAD(50.0f)) { if (newUpperLegs.yaw > -DEGTORAD(50.0f) && newUpperLegs.yaw < DEGTORAD(50.0f)) {
#ifdef PED_SKIN #ifdef PED_SKIN
if(IsClumpSkinned(GetClump())){ if(IsClumpSkinned(GetClump())){
/* /*
// this looks shit // this looks shit
newUpperLegs.theta = 0.0f; newUpperLegs.pitch = 0.0f;
RwV3d axis = { -1.0f, 0.0f, 0.0f }; RwV3d axis = { -1.0f, 0.0f, 0.0f };
RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.phi), rwCOMBINEPRECONCAT); RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPRECONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.phi), rwCOMBINEPRECONCAT); RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &axis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPRECONCAT);
*/ */
newUpperLegs.theta = 0.1f; newUpperLegs.pitch = 0.1f;
RwV3d Xaxis = { 1.0f, 0.0f, 0.0f }; RwV3d Xaxis = { 1.0f, 0.0f, 0.0f };
RwV3d Zaxis = { 0.0f, 0.0f, 1.0f }; RwV3d Zaxis = { 0.0f, 0.0f, 1.0f };
RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT); RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT); RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT); RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT); RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT);
bDontAcceptIKLookAts = true; bDontAcceptIKLookAts = true;
}else }else
#endif #endif
{ {
newUpperLegs.theta = 0.0f; newUpperLegs.pitch = 0.0f;
m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGL], &newUpperLegs, false); m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGL], &newUpperLegs, false);
m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGR], &newUpperLegs, false); m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGR], &newUpperLegs, false);
} }
@ -2588,7 +2327,7 @@ CPed::CanPedDriveOff(void)
bool bool
CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil) CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil)
{ {
if (m_nSurfaceTouched == SURFACE_PUDDLE) if (m_nSurfaceTouched == SURFACE_WATER)
return true; return true;
CVector pos = GetPosition(); CVector pos = GetPosition();
@ -3648,9 +3387,14 @@ CPed::SetStoredState(void)
if (m_nMoveState == PEDMOVE_NONE || m_nMoveState == PEDMOVE_STILL) if (m_nMoveState == PEDMOVE_NONE || m_nMoveState == PEDMOVE_STILL)
m_nMoveState = PEDMOVE_WALK; m_nMoveState = PEDMOVE_WALK;
} }
m_nLastPedState = m_nPedState; #ifdef VC_PED_PORTS
if (m_nMoveState >= m_nPrevMoveState) if (m_nPedState != PED_IDLE)
m_nPrevMoveState = m_nMoveState; #endif
{
m_nLastPedState = m_nPedState;
if (m_nMoveState >= m_nPrevMoveState)
m_nPrevMoveState = m_nMoveState;
}
} }
void void
@ -5419,7 +5163,10 @@ CPed::SetWaitState(eWaitState state, void *time)
case WAITSTATE_DOUBLEBACK: case WAITSTATE_DOUBLEBACK:
m_headingRate = 0.0f; m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 3500; m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 3500;
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f); animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
#ifdef FIX_BUGS
animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
#endif
break; break;
case WAITSTATE_HITWALL: case WAITSTATE_HITWALL:
m_headingRate = 2.0f; m_headingRate = 2.0f;
@ -5453,7 +5200,10 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim(); SetMoveAnim();
m_headingRate = 0.0f; m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000; m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000;
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f); animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
#ifdef FIX_BUGS
animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
#endif
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();
@ -5466,7 +5216,11 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim(); SetMoveAnim();
m_headingRate = 0.0f; m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000; m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 5000;
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f); animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_HBHB, 4.0f);
#ifdef FIX_BUGS
animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
#endif
break; break;
case WAITSTATE_PLAYANIM_COWER: case WAITSTATE_PLAYANIM_COWER:
waitAnim = ANIM_HANDSCOWER; waitAnim = ANIM_HANDSCOWER;
@ -5508,7 +5262,10 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim(); SetMoveAnim();
m_headingRate = 0.0f; m_headingRate = 0.0f;
m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 2500; m_nWaitTimer = CTimer::GetTimeInMilliseconds() + 2500;
CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f); animAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_IDLE_TIRED, 4.0f);
#ifdef FIX_BUGS
animAssoc->SetFinishCallback(RestoreHeadingRateCB, this);
#endif
break; break;
default: default:
m_nWaitState = WAITSTATE_FALSE; m_nWaitState = WAITSTATE_FALSE;
@ -5537,7 +5294,7 @@ CPed::PlayHitSound(CPed *hitTo)
S42 = SOUND_FIGHT_PUNCH_FROM_BEHIND_42, S42 = SOUND_FIGHT_PUNCH_FROM_BEHIND_42,
S43 = SOUND_FIGHT_KNEE_OR_KICK_43, S43 = SOUND_FIGHT_KNEE_OR_KICK_43,
S44 = SOUND_FIGHT_KICK_44, S44 = SOUND_FIGHT_KICK_44,
NO_SND = SOUND_TOTAL_PED_SOUNDS NO_SND = SOUND_NO_SOUND
}; };
uint16 hitSoundsByFightMoves[12][10] = { uint16 hitSoundsByFightMoves[12][10] = {
{S39,S42,S43,S43,S39,S39,S39,S39,S39,S42}, {S39,S42,S43,S43,S39,S39,S39,S39,S39,S42},
@ -5576,78 +5333,6 @@ CPed::PlayHitSound(CPed *hitTo)
DMAudio.PlayOneShot(m_audioEntityId, soundId, 0.0f); DMAudio.PlayOneShot(m_audioEntityId, soundId, 0.0f);
} }
void
CPed::Say(uint16 audio)
{
uint16 audioToPlay = audio;
if (IsPlayer()) {
// Ofc this part isn't in VC.
switch (audio) {
case SOUND_PED_DEATH:
audioToPlay = SOUND_PED_DAMAGE;
break;
case SOUND_PED_DAMAGE:
case SOUND_PED_HIT:
case SOUND_PED_LAND:
break;
case SOUND_PED_BULLET_HIT:
case SOUND_PED_CAR_JACKED:
case SOUND_PED_DEFEND:
audioToPlay = SOUND_PED_HIT;
break;
default:
return;
}
} else {
if (3.0f + TheCamera.GetPosition().z < GetPosition().z)
return;
if (TheCamera.m_CameraAverageSpeed > 1.65f) {
#ifdef VC_PED_PORTS
if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND)
#endif
return;
} else if (TheCamera.m_CameraAverageSpeed > 1.25f) {
if (audio != SOUND_PED_DEATH &&
#ifdef VC_PED_PORTS
audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND &&
#endif
audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE)
return;
} else if (TheCamera.m_CameraAverageSpeed > 0.9f) {
switch (audio) {
case SOUND_PED_DEATH:
#ifdef VC_PED_PORTS
case SOUND_PED_DAMAGE:
case SOUND_PED_HIT:
case SOUND_PED_LAND:
#endif
case SOUND_PED_BURNING:
case SOUND_PED_FLEE_SPRINT:
case SOUND_PED_TAXI_WAIT:
case SOUND_PED_EVADE:
case SOUND_PED_CAR_COLLISION:
break;
default:
return;
}
}
}
if (audioToPlay < m_queuedSound) {
if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH
|| CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
+ m_lastSoundStart
+ (uint32) CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) <= CTimer::GetTimeInMilliseconds()) {
m_queuedSound = audioToPlay;
}
}
}
void void
CPed::CollideWithPed(CPed *collideWith) CPed::CollideWithPed(CPed *collideWith)
{ {
@ -6072,6 +5757,9 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
m_nPedState = PED_CHAT; m_nPedState = PED_CHAT;
SetMoveState(PEDMOVE_STILL); SetMoveState(PEDMOVE_STILL);
#ifdef VC_PED_PORTS
m_lookTimer = 0;
#endif
SetLookFlag(chatWith, true); SetLookFlag(chatWith, true);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time; m_standardTimer = CTimer::GetTimeInMilliseconds() + time;
m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000; m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000;
@ -6080,10 +5768,7 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
void void
CPed::SetDead(void) CPed::SetDead(void)
{ {
#ifdef VC_PED_PORTS bUsesCollision = false;
if (!RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DROWN))
#endif
bUsesCollision = false;
m_fHealth = 0.0f; m_fHealth = 0.0f;
if (m_nPedState == PED_DRIVING) if (m_nPedState == PED_DRIVING)
@ -6187,6 +5872,9 @@ CPed::Die(void)
uint8 uint8
CPed::DoesLOSBulletHitPed(CColPoint &colPoint) CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
{ {
#ifdef FIX_BUGS
return 1;
#else
uint8 retVal = 2; uint8 retVal = 2;
float headZ = GetNodePosition(PED_HEAD).z; float headZ = GetNodePosition(PED_HEAD).z;
@ -6202,6 +5890,7 @@ CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
retVal = 0; retVal = 0;
return retVal; return retVal;
#endif
} }
bool bool
@ -8955,11 +8644,11 @@ CPed::LookForInterestingNodes(void)
return false; return false;
} }
switch (effect->attractor.flags) { switch (effect->attractor.type) {
case ATTRACTORFLAG_ICECREAM: case ATTRACTORTYPE_ICECREAM:
SetInvestigateEvent(EVENT_ICECREAM, CVector2D(effectPos), 0.1f, 15000, angleToFace); SetInvestigateEvent(EVENT_ICECREAM, CVector2D(effectPos), 0.1f, 15000, angleToFace);
break; break;
case ATTRACTORFLAG_STARE: case ATTRACTORTYPE_STARE:
SetInvestigateEvent(EVENT_SHOPSTALL, CVector2D(effectPos), 1.0f, SetInvestigateEvent(EVENT_SHOPSTALL, CVector2D(effectPos), 1.0f,
CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500), CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500),
angleToFace); angleToFace);
@ -9578,17 +9267,6 @@ CPed::ProcessControl(void)
float oldDestRot = CGeneral::LimitRadianAngle(m_fRotationDest); float oldDestRot = CGeneral::LimitRadianAngle(m_fRotationDest);
#ifdef VC_PED_PORTS
if (m_nPedState == PED_FOLLOW_PATH) {
if (DotProduct(m_vecDamageNormal, GetForward()) < -0.866f && CanPedJumpThis(collidingEnt, &m_vecDamageNormal)) {
SetJump();
// Moved break into here, for compatibility with III
break;
}
// break;
}
#endif
if (m_pedInObjective && if (m_pedInObjective &&
(m_objective == OBJECTIVE_GOTO_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT)) { (m_objective == OBJECTIVE_GOTO_CHAR_ON_FOOT || m_objective == OBJECTIVE_KILL_CHAR_ON_FOOT)) {
@ -10414,7 +10092,7 @@ CPed::ProcessControl(void)
case PED_SEEK_ENTITY: case PED_SEEK_ENTITY:
case PED_PURSUE: case PED_PURSUE:
case PED_SNIPER_MODE: case PED_SNIPER_MODE:
case PED_ROCKET_ODE: case PED_ROCKET_MODE:
case PED_DUMMY: case PED_DUMMY:
case PED_FACE_PHONE: case PED_FACE_PHONE:
case PED_MAKE_CALL: case PED_MAKE_CALL:
@ -11055,7 +10733,7 @@ CPed::SetJump(void)
#ifdef VC_PED_PORTS #ifdef VC_PED_PORTS
m_nPedState != PED_JUMP && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_JUMP_LAUNCH) && m_nPedState != PED_JUMP && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_JUMP_LAUNCH) &&
#endif #endif
(m_nSurfaceTouched != SURFACE_STONE || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) { (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
SetStoredState(); SetStoredState();
m_nPedState = PED_JUMP; m_nPedState = PED_JUMP;
CAnimBlendAssociation *jumpAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_JUMP_LAUNCH, 8.0f); CAnimBlendAssociation *jumpAssoc = CAnimManager::BlendAnimation(GetClump(), ASSOCGRP_STD, ANIM_JUMP_LAUNCH, 8.0f);
@ -11064,12 +10742,6 @@ CPed::SetJump(void)
} }
} }
bool
CPed::ServiceTalkingWhenDead(void)
{
return m_queuedSound == SOUND_PED_DEATH;
}
void void
CPed::RemoveInCarAnims(void) CPed::RemoveInCarAnims(void)
{ {
@ -14781,7 +14453,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z; GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
#endif #endif
m_nSurfaceTouched = intersectionPoint.surfaceB; m_nSurfaceTouched = intersectionPoint.surfaceB;
if (m_nSurfaceTouched == SURFACE_STONE) { if (m_nSurfaceTouched == SURFACE_STEEP_CLIFF) {
bHitSteepSlope = true; bHitSteepSlope = true;
m_vecDamageNormal = intersectionPoint.normal; m_vecDamageNormal = intersectionPoint.normal;
} }
@ -14889,7 +14561,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
#endif #endif
sphereNormal.Normalise(); sphereNormal.Normalise();
collidingPoints[sphere].normal = sphereNormal; collidingPoints[sphere].normal = sphereNormal;
if (collidingPoints[sphere].surfaceB == SURFACE_STONE) if (collidingPoints[sphere].surfaceB == SURFACE_STEEP_CLIFF)
bHitSteepSlope = true; bHitSteepSlope = true;
} }
} }
@ -14939,17 +14611,9 @@ CPed::WanderRange(void)
bool arrived = Seek(); bool arrived = Seek();
if (arrived) { if (arrived) {
Idle(); Idle();
if (((m_randomSeed % 256) + 3 * CTimer::GetFrameCounter()) % 1000 > 997) { if ((m_randomSeed + 3 * CTimer::GetFrameCounter()) % 1000 > 997) {
CVector2D newCoords2D = m_wanderRangeBounds->GetRandomPointInRange();
int xDiff = Abs(m_wanderRangeBounds[1].x - m_wanderRangeBounds[0].x); SetSeek(CVector(newCoords2D.x, newCoords2D.y, GetPosition().z), 2.5f);
int yDiff = Abs(m_wanderRangeBounds[1].y - m_wanderRangeBounds[0].y);
CVector newCoords(
(CGeneral::GetRandomNumber() % xDiff) + m_wanderRangeBounds[0].x,
(CGeneral::GetRandomNumber() % yDiff) + m_wanderRangeBounds[0].y,
GetPosition().z);
SetSeek(newCoords, 2.5f);
} }
} }
} }
@ -15031,11 +14695,7 @@ CPed::SeekBoatPosition(void)
CVehicleModelInfo *boatModel = m_carInObjective->GetModelInfo(); CVehicleModelInfo *boatModel = m_carInObjective->GetModelInfo();
CVector enterOffset; CVector enterOffset;
if (boatModel->m_vehicleType == VEHICLE_TYPE_BOAT) enterOffset = boatModel->GetFrontSeatPosn();
enterOffset = boatModel->m_positions[BOAT_POS_FRONTSEAT];
else
enterOffset = boatModel->m_positions[CAR_POS_FRONTSEAT];
enterOffset.x = 0.0f; enterOffset.x = 0.0f;
CMatrix boatMat(m_carInObjective->GetMatrix()); CMatrix boatMat(m_carInObjective->GetMatrix());
SetMoveState(PEDMOVE_WALK); SetMoveState(PEDMOVE_WALK);
@ -16273,34 +15933,6 @@ CPed::SeekCar(void)
} }
} }
void
CPed::ServiceTalking(void)
{
if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) {
if (CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber")) {
if (m_nPedState == PED_ON_FIRE)
m_queuedSound = SOUND_PED_BURNING;
} else {
m_queuedSound = SOUND_PED_BOMBER;
}
if (m_queuedSound != SOUND_TOTAL_PED_SOUNDS) {
if (m_queuedSound == SOUND_PED_DEATH)
m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
if (CTimer::GetTimeInMilliseconds() > m_soundStart) {
DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f);
m_lastSoundStart = CTimer::GetTimeInMilliseconds();
m_soundStart =
CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime
+ CTimer::GetTimeInMilliseconds()
+ CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime);
m_lastQueuedSound = m_queuedSound;
m_queuedSound = SOUND_TOTAL_PED_SOUNDS;
}
}
}
}
void void
CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk) CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
{ {
@ -16749,7 +16381,7 @@ CPed::UpdatePosition(void)
velocityChange = m_moved + velocityOfSurface - m_vecMoveSpeed; velocityChange = m_moved + velocityOfSurface - m_vecMoveSpeed;
m_fRotationCur += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep(); m_fRotationCur += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep();
m_fRotationDest += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep(); m_fRotationDest += curSurface->m_vecTurnSpeed.z * CTimer::GetTimeStep();
} else if (m_nSurfaceTouched != SURFACE_STONE || m_vecDamageNormal.x == 0.0f && m_vecDamageNormal.y == 0.0f) { } else if (m_nSurfaceTouched != SURFACE_STEEP_CLIFF || m_vecDamageNormal.x == 0.0f && m_vecDamageNormal.y == 0.0f) {
velocityChange = m_moved - m_vecMoveSpeed; velocityChange = m_moved - m_vecMoveSpeed;
} else { } else {
// Ped got damaged by steep slope // Ped got damaged by steep slope
@ -16817,29 +16449,20 @@ CPed::SetPedPositionInCar(void)
CMatrix newMat(m_pMyVehicle->GetMatrix()); CMatrix newMat(m_pMyVehicle->GetMatrix());
CVector seatPos; CVector seatPos;
if (m_pMyVehicle->pDriver == this) { if (m_pMyVehicle->pDriver == this) {
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) seatPos = vehModel->GetFrontSeatPosn();
seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
if (!m_pMyVehicle->IsBoat() && m_pMyVehicle->m_vehType != VEHICLE_TYPE_BIKE) if (!m_pMyVehicle->IsBoat() && m_pMyVehicle->m_vehType != VEHICLE_TYPE_BIKE)
seatPos.x = -seatPos.x; seatPos.x = -seatPos.x;
} else if (m_pMyVehicle->pPassengers[0] == this) { } else if (m_pMyVehicle->pPassengers[0] == this) {
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) seatPos = vehModel->GetFrontSeatPosn();
seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
} else if (m_pMyVehicle->pPassengers[1] == this) { } else if (m_pMyVehicle->pPassengers[1] == this) {
seatPos = vehModel->m_positions[CAR_POS_BACKSEAT]; seatPos = vehModel->m_positions[CAR_POS_BACKSEAT];
seatPos.x = -seatPos.x; seatPos.x = -seatPos.x;
} else { } else {
if (m_pMyVehicle->pPassengers[2] == this) { if (m_pMyVehicle->pPassengers[2] == this) {
seatPos = vehModel->m_positions[CAR_POS_BACKSEAT]; seatPos = vehModel->m_positions[CAR_POS_BACKSEAT];
} else if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) {
seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
} else { } else {
seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT]; seatPos = vehModel->GetFrontSeatPosn();
} }
} }
newMat.GetPosition() += Multiply3x3(newMat, seatPos); newMat.GetPosition() += Multiply3x3(newMat, seatPos);

View File

@ -231,7 +231,7 @@ enum PedState
PED_PURSUE, PED_PURSUE,
PED_FOLLOW_PATH, PED_FOLLOW_PATH,
PED_SNIPER_MODE, PED_SNIPER_MODE,
PED_ROCKET_ODE, PED_ROCKET_MODE,
PED_DUMMY, PED_DUMMY,
PED_PAUSE, PED_PAUSE,
PED_ATTACK, PED_ATTACK,
@ -468,7 +468,7 @@ public:
CEntity *m_pCollidingEntity; CEntity *m_pCollidingEntity;
uint8 m_stateUnused; uint8 m_stateUnused;
uint32 m_timerUnused; uint32 m_timerUnused;
CVector2D *m_wanderRangeBounds; // array with 2 CVector2D (actually unused CRange2D class) - unused class CRange2D *m_wanderRangeBounds;
CWeapon m_weapons[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS]; CWeapon m_weapons[WEAPONTYPE_TOTAL_INVENTORY_WEAPONS];
eWeaponType m_storedWeapon; eWeaponType m_storedWeapon;
uint8 m_currentWeapon; // eWeaponType uint8 m_currentWeapon; // eWeaponType
@ -879,8 +879,21 @@ public:
#ifndef MASTER #ifndef MASTER
// Mobile things // Mobile things
void DebugDrawPedDestination(CPed *, int, int);
void DebugDrawPedDesiredHeading(CPed *, int, int);
void DebugDrawCollisionRadius(float, float, float, float, int);
void DebugDrawVisionRange(CVector, float);
void DebugDrawVisionSimple(CVector, float);
void DebugDrawLook();
void DebugDrawPedPsyche();
void DebugDrawDebugLines();
static void SwitchDebugDisplay(void); static void SwitchDebugDisplay(void);
static int GetDebugDisplay(void);
void DebugDrawLookAtPoints();
void DebugRenderOnePedText(void); void DebugRenderOnePedText(void);
void DebugRenderClosePedText();
#endif #endif
#ifdef PED_SKIN #ifdef PED_SKIN

153
src/peds/PedChat.cpp Normal file
View File

@ -0,0 +1,153 @@
#include "common.h"
#include "Camera.h"
#include "DMAudio.h"
#include "General.h"
#include "Ped.h"
// Corresponds to ped sounds (from SOUND_PED_DEATH to SOUND_PED_TAXI_CALL)
PedAudioData CommentWaitTime[39] = {
{500, 800, 500, 2},
{500, 800, 500, 2},
{500, 800, 500, 2},
{500, 800, 500, 2},
{100, 2, 100, 2},
{700, 500, 1000, 500},
{700, 500, 1000, 500},
{5000, 2000, 15000, 3000},
{5000, 2000, 15000, 3000},
{5000, 2000, 15000, 3000},
{6000, 6000, 6000, 6000},
{1000, 1000, 2000, 2000},
{1000, 500, 2000, 1500},
{1000, 500, 2000, 1500},
{800, 200, 1000, 500},
{800, 200, 1000, 500},
{800, 400, 2000, 1000},
{800, 400, 2000, 1000},
{400, 300, 2000, 1000},
{2000, 1000, 2500, 1500},
{200, 200, 200, 200},
{6000, 3000, 5000, 6000},
{6000, 3000, 9000, 5000},
{6000, 3000, 9000, 5000},
{6000, 3000, 9000, 5000},
{400, 300, 4000, 1000},
{400, 300, 4000, 1000},
{400, 300, 4000, 1000},
{1000, 500, 3000, 1000},
{1000, 500, 1000, 1000},
{3000, 2000, 3000, 2000},
{1000, 500, 3000, 6000},
{1000, 500, 2000, 4000},
{1000, 500, 2000, 5000},
{1000, 500, 3000, 2000},
{1600, 1000, 2000, 2000},
{3000, 2000, 5000, 3000},
{1000, 1000, 1000, 1000},
{1000, 1000, 5000, 5000},
};
bool
CPed::ServiceTalkingWhenDead(void)
{
return m_queuedSound == SOUND_PED_DEATH;
}
void
CPed::ServiceTalking(void)
{
if (!bBodyPartJustCameOff || m_bodyPartBleeding != PED_HEAD) {
if (!CGeneral::faststricmp(CModelInfo::GetModelInfo(GetModelIndex())->GetName(), "bomber"))
m_queuedSound = SOUND_PED_BOMBER;
else if (m_nPedState == PED_ON_FIRE)
m_queuedSound = SOUND_PED_BURNING;
if (m_queuedSound != SOUND_NO_SOUND) {
if (m_queuedSound == SOUND_PED_DEATH)
m_soundStart = CTimer::GetTimeInMilliseconds() - 1;
if (CTimer::GetTimeInMilliseconds() > m_soundStart) {
DMAudio.PlayOneShot(m_audioEntityId, m_queuedSound, 1.0f);
m_lastSoundStart = CTimer::GetTimeInMilliseconds();
m_soundStart =
CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nFixedDelayTime
+ CTimer::GetTimeInMilliseconds()
+ CGeneral::GetRandomNumberInRange(0, CommentWaitTime[m_queuedSound - SOUND_PED_DEATH].m_nOverrideFixedDelayTime);
m_lastQueuedSound = m_queuedSound;
m_queuedSound = SOUND_NO_SOUND;
}
}
}
}
void
CPed::Say(uint16 audio)
{
uint16 audioToPlay = audio;
if (IsPlayer()) {
// Ofc this part isn't in VC.
switch (audio) {
case SOUND_PED_DEATH:
audioToPlay = SOUND_PED_DAMAGE;
break;
case SOUND_PED_DAMAGE:
case SOUND_PED_HIT:
case SOUND_PED_LAND:
break;
case SOUND_PED_BULLET_HIT:
case SOUND_PED_CAR_JACKED:
case SOUND_PED_DEFEND:
audioToPlay = SOUND_PED_HIT;
break;
default:
return;
}
} else {
if (TheCamera.GetPosition().z + 3.0f < GetPosition().z)
return;
if (TheCamera.m_CameraAverageSpeed > 1.65f) {
#ifdef VC_PED_PORTS
if (audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND)
#endif
return;
} else if (TheCamera.m_CameraAverageSpeed > 1.25f) {
if (audio != SOUND_PED_DEATH &&
#ifdef VC_PED_PORTS
audio != SOUND_PED_DAMAGE && audio != SOUND_PED_HIT && audio != SOUND_PED_LAND &&
#endif
audio != SOUND_PED_TAXI_WAIT && audio != SOUND_PED_EVADE)
return;
} else if (TheCamera.m_CameraAverageSpeed > 0.9f) {
switch (audio) {
case SOUND_PED_DEATH:
#ifdef VC_PED_PORTS
case SOUND_PED_DAMAGE:
case SOUND_PED_HIT:
case SOUND_PED_LAND:
#endif
case SOUND_PED_BURNING:
case SOUND_PED_FLEE_SPRINT:
case SOUND_PED_TAXI_WAIT:
case SOUND_PED_EVADE:
case SOUND_PED_CAR_COLLISION:
break;
default:
return;
}
}
}
if (audioToPlay < m_queuedSound) {
if (audioToPlay != m_lastQueuedSound || audioToPlay == SOUND_PED_DEATH
|| CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nOverrideMaxRandomDelayTime
+ m_lastSoundStart
+ (uint32) CGeneral::GetRandomNumberInRange(0, CommentWaitTime[audioToPlay - SOUND_PED_DEATH].m_nMaxRandomDelayTime) <= CTimer::GetTimeInMilliseconds()) {
m_queuedSound = audioToPlay;
}
}
}

310
src/peds/PedDebug.cpp Normal file
View File

@ -0,0 +1,310 @@
#include "common.h"
#ifndef MASTER
#include "main.h"
#include "Camera.h"
#include "Font.h"
#include "Ped.h"
#include "Sprite.h"
#include "Text.h"
static char ObjectiveText[][28] = {
"No Obj",
"Wait on Foot",
"Flee on Foot Till Safe",
"Guard Spot",
"Guard Area",
"Wait in Car",
"Wait in Car then Getout",
"Kill Char on Foot",
"Kill Char Any Means",
"Flee Char on Foot Till Safe",
"Flee Char on Foot Always",
"GoTo Char on Foot",
"Follow Char in Formation",
"Leave Car",
"Enter Car as Passenger",
"Enter Car as Driver",
"Follow Car in Car",
"Fire at Obj from Vehicle",
"Destroy Obj",
"Destroy Car",
"GoTo Area Any Means",
"GoTo Area on Foot",
"Run to Area",
"GoTo Area in Car",
"Follow Car on Foot Woffset",
"Guard Attack",
"Set Leader",
"Follow Route",
"Solicit",
"Take Taxi",
"Catch Train",
"Buy IceCream",
"Steal Any Car",
"Mug Char",
#ifdef VC_PED_PORTS
"Leave Car and Die"
#endif
};
static char StateText[][18] = {
"None",
"Idle",
"Look Entity",
"Look Heading",
"Wander Range",
"Wander Path",
"Seek Pos",
"Seek Entity",
"Flee Pos",
"Flee Entity",
"Pursue",
"Follow Path",
"Sniper Mode",
"Rocket Mode",
"Dummy",
"Pause",
"Attack",
"Fight",
"Face Phone",
"Make Call",
"Chat",
"Mug",
"AimGun",
"AI Control",
"Seek Car",
"Seek InBoat",
"Follow Route",
"C.P.R.",
"Solicit",
"Buy IceCream",
"Investigate",
"Step away",
"On Fire",
"Unknown",
"STATES_NO_AI",
"Jump",
"Fall",
"GetUp",
"Stagger",
"Dive away",
"STATES_NO_ST",
"Enter Train",
"Exit Train",
"Arrest Plyr",
"Driving",
"Passenger",
"Taxi Passngr",
"Open Door",
"Die",
"Dead",
"CarJack",
"Drag fm Car",
"Enter Car",
"Steal Car",
"Exit Car",
"Hands Up",
"Arrested",
};
static char PersonalityTypeText[][18] = {
"Player",
"Cop",
"Medic",
"Fireman",
"Gang 1",
"Gang 2",
"Gang 3",
"Gang 4",
"Gang 5",
"Gang 6",
"Gang 7",
"Street Guy",
"Suit Guy",
"Sensible Guy",
"Geek Guy",
"Old Guy",
"Tough Guy",
"Street Girl",
"Suit Girl",
"Sensible Girl",
"Geek Girl",
"Old Girl",
"Tough Girl",
"Tramp Male",
"Tramp Female",
"Tourist",
"Prostitute",
"Criminal",
"Busker",
"Taxi Driver",
"Psycho",
"Steward",
"Sports Fan",
"Shopper",
"Old Shopper"
};
static char WaitStateText[][16] = {
"No Wait",
"Traffic Lights",
"Pause CrossRoad",
"Look CrossRoad",
"Look Ped",
"Look Shop",
"Look Accident",
"FaceOff Gang",
"Double Back",
"Hit Wall",
"Turn 180deg",
"Surprised",
"Ped Stuck",
"Look About",
"Play Duck",
"Play Cower",
"Play Taxi",
"Play HandsUp",
"Play HandsCower",
"Play Chat",
"Finish Flee",
};
void
CPed::DebugDrawPedDestination(CPed *, int, int)
{
#ifndef FINAL
// TODO: something was here
#endif // !FINAL
}
void
CPed::DebugDrawPedDesiredHeading(CPed *, int, int)
{
#ifndef FINAL
// TODO: something was here
#endif // !FINAL
}
void
CPed::DebugDrawCollisionRadius(float, float, float, float, int)
{
#ifndef FINAL
// TODO: something was here
#endif // !FINAL
}
void
CPed::DebugDrawVisionRange(CVector a1, float)
{
for (int i = a1.x - 90; i < a1.x + 89; i += 30) {
#ifndef FINAL
// TODO: something was here
#endif // !FINAL
}
}
void
CPed::DebugDrawVisionSimple(CVector, float)
{
#ifndef FINAL
// TODO: something was here
#endif // !FINAL
}
void
CPed::DebugDrawLook()
{
#ifndef FINAL
// TODO: something was here
#endif // !FINAL
}
void
CPed::DebugDrawPedPsyche()
{
#ifndef FINAL
// TODO: something was here
#endif // !FINAL
}
void
CPed::DebugDrawDebugLines()
{
#ifndef FINAL
// TODO: something was here
#endif // !FINAL
}
int nDisplayDebugInfo = 0;
void
CPed::SwitchDebugDisplay(void)
{
if (++nDisplayDebugInfo > 2)
nDisplayDebugInfo = 0;
}
int
CPed::GetDebugDisplay(void)
{
return nDisplayDebugInfo;
}
void
CPed::DebugDrawLookAtPoints()
{
// TODO: mobile code
}
void
CPed::DebugRenderOnePedText(void)
{
if ((GetPosition() - TheCamera.GetPosition()).MagnitudeSqr() < sq(30.0f)) {
float width, height;
RwV3d screenCoords;
CVector bitAbove = GetPosition();
bitAbove.z += 2.0f;
if (CSprite::CalcScreenCoors(bitAbove, &screenCoords, &width, &height, true)) {
float lineHeight = SCREEN_SCALE_Y(Min(height / 100.0f, 0.7f) * 22.0f);
DefinedState();
CFont::SetPropOn();
CFont::SetBackgroundOn();
// Originally both of them were being divided by 60.0f.
float xScale = Min(width / 240.0f, 0.7f);
float yScale = Min(height / 80.0f, 0.7f);
CFont::SetScale(SCREEN_SCALE_X(xScale), SCREEN_SCALE_Y(yScale));
CFont::SetCentreOn();
CFont::SetCentreSize(SCREEN_WIDTH);
CFont::SetJustifyOff();
CFont::SetColor(CRGBA(255, 255, 0, 255));
CFont::SetBackGroundOnlyTextOn();
CFont::SetFontStyle(0);
AsciiToUnicode(StateText[m_nPedState], gUString);
CFont::PrintString(screenCoords.x, screenCoords.y, gUString);
AsciiToUnicode(ObjectiveText[m_objective], gUString);
CFont::PrintString(screenCoords.x, screenCoords.y + lineHeight, gUString);
AsciiToUnicode(PersonalityTypeText[m_pedStats->m_type], gUString);
CFont::PrintString(screenCoords.x, screenCoords.y + 2 * lineHeight, gUString);
AsciiToUnicode(WaitStateText[m_nWaitState], gUString);
CFont::PrintString(screenCoords.x, screenCoords.y + 3 * lineHeight, gUString);
if (m_nPedState == PED_SEEK_POS || m_nPedState == PED_SEEK_ENTITY) {
sprintf(gString, "Safe distance to target: %.2f", m_distanceToCountSeekDone);
AsciiToUnicode(gString, gUString);
CFont::PrintString(screenCoords.x, screenCoords.y + 4 * lineHeight, gUString);
}
DefinedState();
}
}
}
void
CPed::DebugRenderClosePedText()
{
// TODO: mobile code
}
#endif

View File

@ -21,14 +21,14 @@ CPedIK::CPedIK(CPed *ped)
{ {
m_ped = ped; m_ped = ped;
m_flags = 0; m_flags = 0;
m_headOrient.phi = 0.0f; m_headOrient.yaw = 0.0f;
m_headOrient.theta = 0.0f; m_headOrient.pitch = 0.0f;
m_torsoOrient.phi = 0.0f; m_torsoOrient.yaw = 0.0f;
m_torsoOrient.theta = 0.0f; m_torsoOrient.pitch = 0.0f;
m_upperArmOrient.phi = 0.0f; m_upperArmOrient.yaw = 0.0f;
m_upperArmOrient.theta = 0.0f; m_upperArmOrient.pitch = 0.0f;
m_lowerArmOrient.phi = 0.0f; m_lowerArmOrient.yaw = 0.0f;
m_lowerArmOrient.theta = 0.0f; m_lowerArmOrient.pitch = 0.0f;
} }
#ifdef PED_SKIN #ifdef PED_SKIN
@ -55,8 +55,8 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
RtQuat *q = &node->hanimFrame->q; RtQuat *q = &node->hanimFrame->q;
#ifndef FIX_BUGS #ifndef FIX_BUGS
// this is what the game does (also VC), but it does not look great // this is what the game does (also VC), but it does not look great
RtQuatRotate(q, &XaxisIK, RADTODEG(limb->phi), rwCOMBINEPRECONCAT); RtQuatRotate(q, &XaxisIK, RADTODEG(limb->yaw), rwCOMBINEPRECONCAT);
RtQuatRotate(q, &ZaxisIK, RADTODEG(limb->theta), rwCOMBINEPRECONCAT); // pitch RtQuatRotate(q, &ZaxisIK, RADTODEG(limb->pitch), rwCOMBINEPRECONCAT); // pitch
#else #else
// copied the code from the non-skinned case // copied the code from the non-skinned case
// this seems to work ok // this seems to work ok
@ -78,8 +78,8 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
vec2.z = -(c*mat->at.x + s*mat->at.y); vec2.z = -(c*mat->at.x + s*mat->at.y);
// Not sure what exactly to do here // Not sure what exactly to do here
RtQuatRotate(q, &vec1, RADTODEG(limb->phi), rwCOMBINEPRECONCAT); RtQuatRotate(q, &vec1, RADTODEG(limb->yaw), rwCOMBINEPRECONCAT);
RtQuatRotate(q, &vec2, RADTODEG(limb->theta), rwCOMBINEPRECONCAT); RtQuatRotate(q, &vec2, RADTODEG(limb->pitch), rwCOMBINEPRECONCAT);
#endif #endif
m_ped->bDontAcceptIKLookAts = true; m_ped->bDontAcceptIKLookAts = true;
}else }else
@ -122,14 +122,14 @@ CPedIK::RotateTorso(AnimBlendFrameData *node, LimbOrientation *limb, bool change
float curYaw, curPitch; float curYaw, curPitch;
ExtractYawAndPitchWorld(mat, &curYaw, &curPitch); ExtractYawAndPitchWorld(mat, &curYaw, &curPitch);
RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->theta), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->pitch), rwCOMBINEPOSTCONCAT);
RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->phi - (curYaw - m_ped->m_fRotationCur)), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->yaw - (curYaw - m_ped->m_fRotationCur)), rwCOMBINEPOSTCONCAT);
RwMatrixRotate(RwFrameGetMatrix(f), &forwardVector, RADTODEG(alpha), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(f), &forwardVector, RADTODEG(alpha), rwCOMBINEPOSTCONCAT);
}else{ }else{
// pitch // pitch
RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->theta), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(f), &rightVector, RADTODEG(limb->pitch), rwCOMBINEPOSTCONCAT);
// yaw // yaw
RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->phi), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(f), &upVector, RADTODEG(limb->yaw), rwCOMBINEPOSTCONCAT);
} }
RwFrameGetMatrix(f)->pos = pos; RwFrameGetMatrix(f)->pos = pos;
RwMatrixDestroy(mat); RwMatrixDestroy(mat);
@ -176,43 +176,43 @@ CPedIK::GetWorldMatrix(RwFrame *source, RwMatrix *destination)
} }
LimbMoveStatus LimbMoveStatus
CPedIK::MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo) CPedIK::MoveLimb(LimbOrientation &limb, float targetYaw, float targetPitch, LimbMovementInfo &moveInfo)
{ {
LimbMoveStatus result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY; LimbMoveStatus result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY;
// phi // yaw
if (limb.phi > approxPhi) { if (limb.yaw > targetYaw) {
limb.phi -= moveInfo.yawD; limb.yaw -= moveInfo.yawD;
} else if (limb.phi < approxPhi) { } else if (limb.yaw < targetYaw) {
limb.phi += moveInfo.yawD; limb.yaw += moveInfo.yawD;
} }
if (Abs(limb.phi - approxPhi) < moveInfo.yawD) { if (Abs(limb.yaw - targetYaw) < moveInfo.yawD) {
limb.phi = approxPhi; limb.yaw = targetYaw;
result = ANGLES_SET_EXACTLY; result = ANGLES_SET_EXACTLY;
} }
if (limb.phi > moveInfo.maxYaw || limb.phi < moveInfo.minYaw) { if (limb.yaw > moveInfo.maxYaw || limb.yaw < moveInfo.minYaw) {
limb.phi = clamp(limb.phi, moveInfo.minYaw, moveInfo.maxYaw); limb.yaw = clamp(limb.yaw, moveInfo.minYaw, moveInfo.maxYaw);
result = ANGLES_SET_TO_MAX; result = ANGLES_SET_TO_MAX;
} }
// theta // pitch
if (limb.theta > approxTheta) { if (limb.pitch > targetPitch) {
limb.theta -= moveInfo.pitchD; limb.pitch -= moveInfo.pitchD;
} else if (limb.theta < approxTheta) { } else if (limb.pitch < targetPitch) {
limb.theta += moveInfo.pitchD; limb.pitch += moveInfo.pitchD;
} }
if (Abs(limb.theta - approxTheta) < moveInfo.pitchD) if (Abs(limb.pitch - targetPitch) < moveInfo.pitchD)
limb.theta = approxTheta; limb.pitch = targetPitch;
else else
result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY; result = ONE_ANGLE_COULDNT_BE_SET_EXACTLY;
if (limb.theta > moveInfo.maxPitch || limb.theta < moveInfo.minPitch) { if (limb.pitch > moveInfo.maxPitch || limb.pitch < moveInfo.minPitch) {
limb.theta = clamp(limb.theta, moveInfo.minPitch, moveInfo.maxPitch); limb.pitch = clamp(limb.pitch, moveInfo.minPitch, moveInfo.maxPitch);
result = ANGLES_SET_TO_MAX; result = ANGLES_SET_TO_MAX;
} }
return result; return result;
@ -231,14 +231,14 @@ void
CPedIK::RotateHead(void) CPedIK::RotateHead(void)
{ {
RtQuat *q = &m_ped->m_pFrames[PED_HEAD]->hanimFrame->q; RtQuat *q = &m_ped->m_pFrames[PED_HEAD]->hanimFrame->q;
RtQuatRotate(q, &XaxisIK, RADTODEG(m_headOrient.phi), rwCOMBINEREPLACE); RtQuatRotate(q, &XaxisIK, RADTODEG(m_headOrient.yaw), rwCOMBINEREPLACE);
RtQuatRotate(q, &ZaxisIK, RADTODEG(m_headOrient.theta), rwCOMBINEPOSTCONCAT); RtQuatRotate(q, &ZaxisIK, RADTODEG(m_headOrient.pitch), rwCOMBINEPOSTCONCAT);
m_ped->bDontAcceptIKLookAts = true; m_ped->bDontAcceptIKLookAts = true;
} }
#endif #endif
bool bool
CPedIK::LookInDirection(float phi, float theta) CPedIK::LookInDirection(float targetYaw, float targetPitch)
{ {
bool success = true; bool success = true;
float yaw, pitch; float yaw, pitch;
@ -246,21 +246,21 @@ CPedIK::LookInDirection(float phi, float theta)
if(IsClumpSkinned(m_ped->GetClump())){ if(IsClumpSkinned(m_ped->GetClump())){
if (!(m_ped->m_pFrames[PED_HEAD]->flag & AnimBlendFrameData::IGNORE_ROTATION)) { if (!(m_ped->m_pFrames[PED_HEAD]->flag & AnimBlendFrameData::IGNORE_ROTATION)) {
m_ped->m_pFrames[PED_HEAD]->flag |= AnimBlendFrameData::IGNORE_ROTATION; m_ped->m_pFrames[PED_HEAD]->flag |= AnimBlendFrameData::IGNORE_ROTATION;
ExtractYawAndPitchLocalSkinned(m_ped->m_pFrames[PED_HEAD], &m_headOrient.phi, &m_headOrient.theta); ExtractYawAndPitchLocalSkinned(m_ped->m_pFrames[PED_HEAD], &m_headOrient.yaw, &m_headOrient.pitch);
} }
// parent of head is torso // parent of head is torso
RwMatrix worldMat = *GetBoneMatrix(m_ped, BONE_torso); RwMatrix worldMat = *GetBoneMatrix(m_ped, BONE_torso);
ExtractYawAndPitchWorld(&worldMat, &yaw, &pitch); ExtractYawAndPitchWorld(&worldMat, &yaw, &pitch);
LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(phi - yaw), LimbMoveStatus headStatus = MoveLimb(m_headOrient, CGeneral::LimitRadianAngle(targetYaw - yaw),
CGeneral::LimitRadianAngle(DEGTORAD(10.0f)), ms_headInfo); CGeneral::LimitRadianAngle(DEGTORAD(10.0f)), ms_headInfo);
if (headStatus == ANGLES_SET_TO_MAX) if (headStatus == ANGLES_SET_TO_MAX)
success = false; success = false;
if (headStatus != ANGLES_SET_EXACTLY){ if (headStatus != ANGLES_SET_EXACTLY){
if (!(m_flags & LOOKAROUND_HEAD_ONLY)){ if (!(m_flags & LOOKAROUND_HEAD_ONLY)){
if (MoveLimb(m_torsoOrient, CGeneral::LimitRadianAngle(phi), theta, ms_torsoInfo)) if (MoveLimb(m_torsoOrient, CGeneral::LimitRadianAngle(targetYaw), targetPitch, ms_torsoInfo))
success = true; success = true;
}else{ }else{
RotateHead(); RotateHead();
@ -279,7 +279,7 @@ CPedIK::LookInDirection(float phi, float theta)
if (!(m_ped->m_pFrames[PED_HEAD]->flag & AnimBlendFrameData::IGNORE_ROTATION)) { if (!(m_ped->m_pFrames[PED_HEAD]->flag & AnimBlendFrameData::IGNORE_ROTATION)) {
m_ped->m_pFrames[PED_HEAD]->flag |= AnimBlendFrameData::IGNORE_ROTATION; m_ped->m_pFrames[PED_HEAD]->flag |= AnimBlendFrameData::IGNORE_ROTATION;
ExtractYawAndPitchLocal(frameMat, &m_headOrient.phi, &m_headOrient.theta); ExtractYawAndPitchLocal(frameMat, &m_headOrient.yaw, &m_headOrient.pitch);
} }
RwMatrix *worldMat = RwMatrixCreate(); RwMatrix *worldMat = RwMatrixCreate();
@ -288,25 +288,25 @@ CPedIK::LookInDirection(float phi, float theta)
ExtractYawAndPitchWorld(worldMat, &yaw, &pitch); ExtractYawAndPitchWorld(worldMat, &yaw, &pitch);
RwMatrixDestroy(worldMat); RwMatrixDestroy(worldMat);
yaw += m_torsoOrient.phi; yaw += m_torsoOrient.yaw;
float neededPhiTurn = CGeneral::LimitRadianAngle(phi - yaw); float neededYawTurn = CGeneral::LimitRadianAngle(targetYaw - yaw);
pitch *= Cos(neededPhiTurn); pitch *= Cos(neededYawTurn);
float neededThetaTurn = CGeneral::LimitRadianAngle(theta - pitch); float neededPitchTurn = CGeneral::LimitRadianAngle(targetPitch - pitch);
LimbMoveStatus headStatus = MoveLimb(m_headOrient, neededPhiTurn, neededThetaTurn, ms_headInfo); LimbMoveStatus headStatus = MoveLimb(m_headOrient, neededYawTurn, neededPitchTurn, ms_headInfo);
if (headStatus == ANGLES_SET_TO_MAX) if (headStatus == ANGLES_SET_TO_MAX)
success = false; success = false;
if (headStatus != ANGLES_SET_EXACTLY && !(m_flags & LOOKAROUND_HEAD_ONLY)) { if (headStatus != ANGLES_SET_EXACTLY && !(m_flags & LOOKAROUND_HEAD_ONLY)) {
float remainingTurn = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur); float remainingTurn = CGeneral::LimitRadianAngle(targetYaw - m_ped->m_fRotationCur);
if (MoveLimb(m_torsoOrient, remainingTurn, theta, ms_torsoInfo)) if (MoveLimb(m_torsoOrient, remainingTurn, targetPitch, ms_torsoInfo))
success = true; success = true;
} }
CMatrix nextFrame = CMatrix(frameMat); CMatrix nextFrame = CMatrix(frameMat);
CVector framePos = nextFrame.GetPosition(); CVector framePos = nextFrame.GetPosition();
nextFrame.SetRotateZ(m_headOrient.theta); nextFrame.SetRotateZ(m_headOrient.pitch);
nextFrame.RotateX(m_headOrient.phi); nextFrame.RotateX(m_headOrient.yaw);
nextFrame.GetPosition() += framePos; nextFrame.GetPosition() += framePos;
nextFrame.UpdateRW(); nextFrame.UpdateRW();
@ -320,32 +320,32 @@ CPedIK::LookInDirection(float phi, float theta)
bool bool
CPedIK::LookAtPosition(CVector const &pos) CPedIK::LookAtPosition(CVector const &pos)
{ {
float phiToFace = CGeneral::GetRadianAngleBetweenPoints( float yawToFace = CGeneral::GetRadianAngleBetweenPoints(
pos.x, pos.y, pos.x, pos.y,
m_ped->GetPosition().x, m_ped->GetPosition().y); m_ped->GetPosition().x, m_ped->GetPosition().y);
float thetaToFace = CGeneral::GetRadianAngleBetweenPoints( float pitchToFace = CGeneral::GetRadianAngleBetweenPoints(
pos.z, (m_ped->GetPosition() - pos).Magnitude2D(), pos.z, (m_ped->GetPosition() - pos).Magnitude2D(),
m_ped->GetPosition().z, 0.0f); m_ped->GetPosition().z, 0.0f);
return LookInDirection(phiToFace, thetaToFace); return LookInDirection(yawToFace, pitchToFace);
} }
bool bool
CPedIK::PointGunInDirection(float phi, float theta) CPedIK::PointGunInDirection(float targetYaw, float targetPitch)
{ {
bool result = true; bool result = true;
bool armPointedToGun = false; bool armPointedToGun = false;
float angle = CGeneral::LimitRadianAngle(phi - m_ped->m_fRotationCur); float angle = CGeneral::LimitRadianAngle(targetYaw - m_ped->m_fRotationCur);
m_flags &= (~GUN_POINTED_SUCCESSFULLY); m_flags &= (~GUN_POINTED_SUCCESSFULLY);
m_flags |= LOOKAROUND_HEAD_ONLY; m_flags |= LOOKAROUND_HEAD_ONLY;
if (m_flags & AIMS_WITH_ARM) { if (m_flags & AIMS_WITH_ARM) {
armPointedToGun = PointGunInDirectionUsingArm(angle, theta); armPointedToGun = PointGunInDirectionUsingArm(angle, targetPitch);
angle = CGeneral::LimitRadianAngle(angle - m_upperArmOrient.phi); angle = CGeneral::LimitRadianAngle(angle - m_upperArmOrient.yaw);
} }
if (armPointedToGun) { if (armPointedToGun) {
if (m_flags & AIMS_WITH_ARM && m_torsoOrient.phi * m_upperArmOrient.phi < 0.0f) if (m_flags & AIMS_WITH_ARM && m_torsoOrient.yaw * m_upperArmOrient.yaw < 0.0f)
MoveLimb(m_torsoOrient, 0.0f, m_torsoOrient.theta, ms_torsoInfo); MoveLimb(m_torsoOrient, 0.0f, m_torsoOrient.pitch, ms_torsoInfo);
} else { } else {
// Unused code // Unused code
RwMatrix *matrix; RwMatrix *matrix;
@ -365,7 +365,7 @@ CPedIK::PointGunInDirection(float phi, float theta)
} }
// //
LimbMoveStatus status = MoveLimb(m_torsoOrient, angle, theta, ms_torsoInfo); LimbMoveStatus status = MoveLimb(m_torsoOrient, angle, targetPitch, ms_torsoInfo);
if (status == ANGLES_SET_TO_MAX) if (status == ANGLES_SET_TO_MAX)
result = false; result = false;
else if (status == ANGLES_SET_EXACTLY) else if (status == ANGLES_SET_EXACTLY)
@ -379,7 +379,7 @@ CPedIK::PointGunInDirection(float phi, float theta)
} }
bool bool
CPedIK::PointGunInDirectionUsingArm(float phi, float theta) CPedIK::PointGunInDirectionUsingArm(float targetYaw, float targetPitch)
{ {
bool result = false; bool result = false;
@ -410,18 +410,18 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
RwV3d rightVector = { 0.0f, 0.0f, 1.0f }; RwV3d rightVector = { 0.0f, 0.0f, 1.0f };
RwV3d forwardVector = { 1.0f, 0.0f, 0.0f }; RwV3d forwardVector = { 1.0f, 0.0f, 0.0f };
float uaPhi, uaTheta; float uaYaw, uaPitch;
#ifdef PED_SKIN #ifdef PED_SKIN
if(IsClumpSkinned(m_ped->GetClump())){ if(IsClumpSkinned(m_ped->GetClump())){
uaPhi = phi; uaYaw = targetYaw;
uaTheta = theta + DEGTORAD(10.0f); uaPitch = targetPitch + DEGTORAD(10.0f);
}else }else
#endif #endif
{ {
uaPhi = phi - m_torsoOrient.phi - DEGTORAD(15.0f); uaYaw = targetYaw - m_torsoOrient.yaw - DEGTORAD(15.0f);
uaTheta = CGeneral::LimitRadianAngle(theta - pitch); uaPitch = CGeneral::LimitRadianAngle(targetPitch - pitch);
} }
LimbMoveStatus uaStatus = MoveLimb(m_upperArmOrient, uaPhi, uaTheta, ms_upperArmInfo); LimbMoveStatus uaStatus = MoveLimb(m_upperArmOrient, uaYaw, uaPitch, ms_upperArmInfo);
if (uaStatus == ANGLES_SET_EXACTLY) { if (uaStatus == ANGLES_SET_EXACTLY) {
m_flags |= GUN_POINTED_SUCCESSFULLY; m_flags |= GUN_POINTED_SUCCESSFULLY;
result = true; result = true;
@ -433,13 +433,13 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
if(!IsClumpSkinned(m_ped->GetClump())) if(!IsClumpSkinned(m_ped->GetClump()))
#endif #endif
if (uaStatus == ANGLES_SET_TO_MAX) { if (uaStatus == ANGLES_SET_TO_MAX) {
float laPhi = uaPhi - m_upperArmOrient.phi; float laYaw = uaYaw - m_upperArmOrient.yaw;
LimbMoveStatus laStatus; LimbMoveStatus laStatus;
if (laPhi > 0.0f) if (laYaw > 0.0f)
laStatus = MoveLimb(m_lowerArmOrient, laPhi, -DEGTORAD(45.0f), ms_lowerArmInfo); laStatus = MoveLimb(m_lowerArmOrient, laYaw, -DEGTORAD(45.0f), ms_lowerArmInfo);
else else
laStatus = MoveLimb(m_lowerArmOrient, laPhi, 0.0f, ms_lowerArmInfo); laStatus = MoveLimb(m_lowerArmOrient, laYaw, 0.0f, ms_lowerArmInfo);
if (laStatus == ANGLES_SET_EXACTLY) { if (laStatus == ANGLES_SET_EXACTLY) {
m_flags |= GUN_POINTED_SUCCESSFULLY; m_flags |= GUN_POINTED_SUCCESSFULLY;
@ -447,16 +447,16 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
} }
RwFrame *child = GetFirstChild(m_ped->m_pFrames[PED_UPPERARMR]->frame); RwFrame *child = GetFirstChild(m_ped->m_pFrames[PED_UPPERARMR]->frame);
RwV3d pos = RwFrameGetMatrix(child)->pos; RwV3d pos = RwFrameGetMatrix(child)->pos;
RwMatrixRotate(RwFrameGetMatrix(child), &forwardVector, RADTODEG(m_lowerArmOrient.theta), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(child), &forwardVector, RADTODEG(m_lowerArmOrient.pitch), rwCOMBINEPOSTCONCAT);
RwMatrixRotate(RwFrameGetMatrix(child), &rightVector, RADTODEG(-m_lowerArmOrient.phi), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(child), &rightVector, RADTODEG(-m_lowerArmOrient.yaw), rwCOMBINEPOSTCONCAT);
RwFrameGetMatrix(child)->pos = pos; RwFrameGetMatrix(child)->pos = pos;
} }
#ifdef PED_SKIN #ifdef PED_SKIN
if(IsClumpSkinned(m_ped->GetClump())){ if(IsClumpSkinned(m_ped->GetClump())){
RtQuat *q = &m_ped->m_pFrames[PED_UPPERARMR]->hanimFrame->q; RtQuat *q = &m_ped->m_pFrames[PED_UPPERARMR]->hanimFrame->q;
RtQuatRotate(q, &XaxisIK, RADTODEG(m_upperArmOrient.phi), rwCOMBINEPOSTCONCAT); RtQuatRotate(q, &XaxisIK, RADTODEG(m_upperArmOrient.yaw), rwCOMBINEPOSTCONCAT);
RtQuatRotate(q, &ZaxisIK, RADTODEG(m_upperArmOrient.theta), rwCOMBINEPOSTCONCAT); RtQuatRotate(q, &ZaxisIK, RADTODEG(m_upperArmOrient.pitch), rwCOMBINEPOSTCONCAT);
m_ped->bDontAcceptIKLookAts = true; m_ped->bDontAcceptIKLookAts = true;
}else }else
#endif #endif
@ -464,8 +464,8 @@ CPedIK::PointGunInDirectionUsingArm(float phi, float theta)
RwFrame *frame = m_ped->m_pFrames[PED_UPPERARMR]->frame; RwFrame *frame = m_ped->m_pFrames[PED_UPPERARMR]->frame;
// with PED_SKIN we're also getting upVector here // with PED_SKIN we're also getting upVector here
RwV3d pos = RwFrameGetMatrix(frame)->pos; RwV3d pos = RwFrameGetMatrix(frame)->pos;
RwMatrixRotate(RwFrameGetMatrix(frame), &rightVector, RADTODEG(m_upperArmOrient.theta), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(frame), &rightVector, RADTODEG(m_upperArmOrient.pitch), rwCOMBINEPOSTCONCAT);
RwMatrixRotate(RwFrameGetMatrix(frame), &upVector, RADTODEG(m_upperArmOrient.phi), rwCOMBINEPOSTCONCAT); RwMatrixRotate(RwFrameGetMatrix(frame), &upVector, RADTODEG(m_upperArmOrient.yaw), rwCOMBINEPOSTCONCAT);
RwFrameGetMatrix(frame)->pos = pos; RwFrameGetMatrix(frame)->pos = pos;
} }
return result; return result;
@ -511,8 +511,8 @@ CPedIK::RestoreLookAt(void)
CMatrix matrix(mat); CMatrix matrix(mat);
CVector pos = matrix.GetPosition(); CVector pos = matrix.GetPosition();
matrix.SetRotateZ(m_headOrient.theta); matrix.SetRotateZ(m_headOrient.pitch);
matrix.RotateX(m_headOrient.phi); matrix.RotateX(m_headOrient.yaw);
matrix.Translate(pos); matrix.Translate(pos);
matrix.UpdateRW(); matrix.UpdateRW();
} }

View File

@ -4,8 +4,8 @@
struct LimbOrientation struct LimbOrientation
{ {
float phi; float yaw;
float theta; float pitch;
}; };
struct LimbMovementInfo { struct LimbMovementInfo {
@ -48,8 +48,8 @@ public:
static LimbMovementInfo ms_lowerArmInfo; static LimbMovementInfo ms_lowerArmInfo;
CPedIK(CPed *ped); CPedIK(CPed *ped);
bool PointGunInDirection(float phi, float theta); bool PointGunInDirection(float targetYaw, float targetPitch);
bool PointGunInDirectionUsingArm(float phi, float theta); bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
bool PointGunAtPosition(CVector const& position); bool PointGunAtPosition(CVector const& position);
void GetComponentPosition(RwV3d *pos, uint32 node); void GetComponentPosition(RwV3d *pos, uint32 node);
static RwMatrix *GetWorldMatrix(RwFrame *source, RwMatrix *destination); static RwMatrix *GetWorldMatrix(RwFrame *source, RwMatrix *destination);
@ -57,10 +57,10 @@ public:
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch); void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch); void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, float *yaw, float *pitch);
void ExtractYawAndPitchWorld(RwMatrix *mat, float *yaw, float *pitch); void ExtractYawAndPitchWorld(RwMatrix *mat, float *yaw, float *pitch);
LimbMoveStatus MoveLimb(LimbOrientation &limb, float approxPhi, float approxTheta, LimbMovementInfo &moveInfo); LimbMoveStatus MoveLimb(LimbOrientation &limb, float targetYaw, float targetPitch, LimbMovementInfo &moveInfo);
bool RestoreGunPosn(void); bool RestoreGunPosn(void);
void RotateHead(void); void RotateHead(void);
bool LookInDirection(float phi, float theta); bool LookInDirection(float targetYaw, float targetPitch);
bool LookAtPosition(CVector const& pos); bool LookAtPosition(CVector const& pos);
bool RestoreLookAt(void); bool RestoreLookAt(void);
}; };

View File

@ -35,6 +35,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
{ {
m_fMoveSpeed = 0.0f; m_fMoveSpeed = 0.0f;
SetModelIndex(MI_PLAYER); SetModelIndex(MI_PLAYER);
#ifdef FIX_BUGS
m_fCurrentStamina = m_fMaxStamina = 150.0f;
#endif
SetInitialState(); SetInitialState();
m_pWanted = new CWanted(); m_pWanted = new CWanted();
@ -46,8 +49,9 @@ CPlayerPed::CPlayerPed(void) : CPed(PEDTYPE_PLAYER1)
m_bSpeedTimerFlag = false; m_bSpeedTimerFlag = false;
m_pPointGunAt = nil; m_pPointGunAt = nil;
m_nPedState = PED_IDLE; m_nPedState = PED_IDLE;
m_fMaxStamina = 150.0f; #ifndef FIX_BUGS
m_fCurrentStamina = m_fMaxStamina; m_fCurrentStamina = m_fMaxStamina = 150.0f;
#endif
m_fStaminaProgress = 0.0f; m_fStaminaProgress = 0.0f;
m_nEvadeAmount = 0; m_nEvadeAmount = 0;
field_1367 = 0; field_1367 = 0;
@ -227,7 +231,7 @@ CPlayerPed::SetInitialState(void)
{ {
m_bAdrenalineActive = false; m_bAdrenalineActive = false;
m_nAdrenalineTime = 0; m_nAdrenalineTime = 0;
CTimer::SetTimeStep(1.0f); CTimer::SetTimeScale(1.0f);
m_pSeekTarget = nil; m_pSeekTarget = nil;
m_vecSeekPos = { 0.0f, 0.0f, 0.0f }; m_vecSeekPos = { 0.0f, 0.0f, 0.0f };
m_fleeFromPosX = 0.0f; m_fleeFromPosX = 0.0f;
@ -1058,6 +1062,9 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
} }
#ifdef FREE_CAM #ifdef FREE_CAM
static int8 changedHeadingRate = 0;
if (changedHeadingRate == 2) changedHeadingRate = 1;
// Rotate player/arm when shooting. We don't have auto-rotation anymore // Rotate player/arm when shooting. We don't have auto-rotation anymore
if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam && if (CCamera::m_bUseMouse3rdPerson && CCamera::bFreeCam &&
m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) { m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
@ -1081,6 +1088,7 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
#endif #endif
} else { } else {
m_fRotationDest = limitedCam; m_fRotationDest = limitedCam;
changedHeadingRate = 2;
m_headingRate = 50.0f; m_headingRate = 50.0f;
// Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly) // Anim. fix for shotgun, ak47 and m16 (we must finish rot. it quickly)
@ -1099,10 +1107,12 @@ CPlayerPed::ProcessPlayerWeapon(CPad *padUsed)
} }
} else if (weaponInfo->m_bCanAimWithArm) } else if (weaponInfo->m_bCanAimWithArm)
ClearPointGunAt(); ClearPointGunAt();
else
RestoreHeadingRate();
} }
} }
if (changedHeadingRate == 1) {
changedHeadingRate = 0;
RestoreHeadingRate();
}
#endif #endif
if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) { if (padUsed->GetTarget() && m_nSelectedWepSlot == m_currentWeapon && m_nMoveState != PEDMOVE_SPRINT) {
@ -1347,7 +1357,7 @@ CPlayerPed::ProcessControl(void)
case PED_WANDER_PATH: case PED_WANDER_PATH:
case PED_PURSUE: case PED_PURSUE:
case PED_FOLLOW_PATH: case PED_FOLLOW_PATH:
case PED_ROCKET_ODE: case PED_ROCKET_MODE:
case PED_DUMMY: case PED_DUMMY:
case PED_PAUSE: case PED_PAUSE:
case PED_FACE_PHONE: case PED_FACE_PHONE:

View File

@ -966,18 +966,11 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (!obj) if (!obj)
return; return;
bool makeInvisible;
CWorld::Remove(dummy); CWorld::Remove(dummy);
delete dummy; delete dummy;
CWorld::Add(obj); CWorld::Add(obj);
int16 mi = obj->GetModelIndex();
if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 ||
mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8)
makeInvisible = true;
else
makeInvisible = false;
if (makeInvisible) { if (IsGlass(obj->GetModelIndex())) {
obj->bIsVisible = false; obj->bIsVisible = false;
} else if (obj->GetModelIndex() == MI_BUOY) { } else if (obj->GetModelIndex() == MI_BUOY) {
obj->bIsStatic = false; obj->bIsStatic = false;
@ -996,17 +989,8 @@ CPopulation::ConvertToDummyObject(CObject *obj)
dummy->GetMatrix().UpdateRW(); dummy->GetMatrix().UpdateRW();
dummy->UpdateRwFrame(); dummy->UpdateRwFrame();
bool makeInvisible; if (IsGlass(obj->GetModelIndex()))
int16 mi = obj->GetModelIndex();
if (mi == MI_GLASS1 || mi == MI_GLASS2 || mi == MI_GLASS3 || mi == MI_GLASS4 ||
mi == MI_GLASS5 || mi == MI_GLASS6 || mi == MI_GLASS7 || mi == MI_GLASS8)
makeInvisible = true;
else
makeInvisible = false;
if (makeInvisible) {
dummy->bIsVisible = false; dummy->bIsVisible = false;
}
CWorld::Remove(obj); CWorld::Remove(obj);
delete obj; delete obj;

View File

@ -25,8 +25,8 @@ enum {
}; };
enum { enum {
ATTRACTORFLAG_ICECREAM, ATTRACTORTYPE_ICECREAM,
ATTRACTORFLAG_STARE ATTRACTORTYPE_STARE
}; };
enum { enum {
@ -44,7 +44,7 @@ public:
float dist; float dist;
float range; // of pointlight float range; // of pointlight
float size; float size;
float shadowRange; float shadowSize;
uint8 lightType; // LIGHT_ uint8 lightType; // LIGHT_
uint8 roadReflection; uint8 roadReflection;
uint8 flareType; uint8 flareType;
@ -60,7 +60,7 @@ public:
}; };
struct Attractor { struct Attractor {
CVector dir; CVector dir;
uint8 flags; int8 type;
uint8 probability; uint8 probability;
}; };

View File

@ -69,8 +69,13 @@ void
CClouds::Update(void) CClouds::Update(void)
{ {
float s = Sin(TheCamera.Orientation - 0.85f); float s = Sin(TheCamera.Orientation - 0.85f);
#ifdef FIX_BUGS
CloudRotation += CWeather::Wind*s*0.0025f*CTimer::GetTimeStepFix();
IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f*CTimer::GetTimeStepFix()) * 60.0f;
#else
CloudRotation += CWeather::Wind*s*0.0025f; CloudRotation += CWeather::Wind*s*0.0025f;
IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f; IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f;
#endif
} }
void void

View File

@ -506,18 +506,18 @@ CCoronas::DoSunAndMoon(void)
{ {
// yeah, moon is done somewhere else.... // yeah, moon is done somewhere else....
CVector sunCoors = CTimeCycle::GetSunPosition(); CVector sunCoors = CTimeCycle::GetSunDirection();
sunCoors *= 150.0f; sunCoors *= 150.0f;
sunCoors += TheCamera.GetPosition(); sunCoors += TheCamera.GetPosition();
if(CTimeCycle::GetSunPosition().z > -0.2f){ if(CTimeCycle::GetSunDirection().z > -0.2f){
float size = ((CGeneral::GetRandomNumber()&0xFF) * 0.005f + 10.0f) * CTimeCycle::GetSunSize(); float size = ((CGeneral::GetRandomNumber()&0xFF) * 0.005f + 10.0f) * CTimeCycle::GetSunSize();
RegisterCorona(SUN_CORE, RegisterCorona(SUN_CORE,
CTimeCycle::GetSunCoreRed(), CTimeCycle::GetSunCoreGreen(), CTimeCycle::GetSunCoreBlue(), CTimeCycle::GetSunCoreRed(), CTimeCycle::GetSunCoreGreen(), CTimeCycle::GetSunCoreBlue(),
255, sunCoors, size, 255, sunCoors, size,
999999.88f, TYPE_STAR, FLARE_NONE, REFLECTION_OFF, LOSCHECK_OFF, STREAK_OFF, 0.0f); 999999.88f, TYPE_STAR, FLARE_NONE, REFLECTION_OFF, LOSCHECK_OFF, STREAK_OFF, 0.0f);
if(CTimeCycle::GetSunPosition().z > 0.0f) if(CTimeCycle::GetSunDirection().z > 0.0f)
RegisterCorona(SUN_CORONA, RegisterCorona(SUN_CORONA,
CTimeCycle::GetSunCoronaRed(), CTimeCycle::GetSunCoronaGreen(), CTimeCycle::GetSunCoronaBlue(), CTimeCycle::GetSunCoronaRed(), CTimeCycle::GetSunCoronaGreen(), CTimeCycle::GetSunCoronaBlue(),
255, sunCoors, 25.0f * CTimeCycle::GetSunSize(), 255, sunCoors, 25.0f * CTimeCycle::GetSunSize(),

Some files were not shown because too many files have changed in this diff Show More