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" {
#endif // __cplusplus
#ifndef OPENAL
#ifndef AUDIO_OAL
#include <dsound.h>
/*
@ -49,13 +49,9 @@ extern "C" {
typedef void (CDECL *LPGETCURRENTVERSION)(LPDWORD major, LPDWORD minor);
#else // OPENAL
#ifndef _WIN32
#else // AUDIO_OAL
#include <AL/al.h>
#include <string.h>
#else
#include <al.h>
#endif
#ifndef 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"
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"
language "C++"
configurations { "Debug", "Release" }
@ -35,11 +51,16 @@ workspace "re3"
"win-x86-RW33_d3d8-mss",
"win-x86-librw_d3d9-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" }
platforms {
"linux-x86-librw_gl3_glfw-oal",
"linux-amd64-librw_gl3_glfw-oal",
"linux-arm-librw_gl3_glfw-oal",
}
filter "configurations:Debug"
@ -58,6 +79,12 @@ workspace "re3"
filter { "platforms:*x86*" }
architecture "x86"
filter { "platforms:*amd64*" }
architecture "amd64"
filter { "platforms:*arm*" }
architecture "ARM"
filter { "platforms:*librw_d3d9*" }
defines { "RW_D3D9" }
if(not _OPTIONS["with-librw"]) then
@ -68,17 +95,12 @@ workspace "re3"
defines { "RW_GL3" }
includedirs { path.join(_OPTIONS["glfwdir"], "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*"
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 {}
@ -164,11 +186,15 @@ project "re3"
includedirs { "src/extras" }
includedirs { "eax" }
filter "platforms:*mss"
defines { "AUDIO_MSS" }
includedirs { "milessdk/include" }
includedirs { "eax" }
libdirs { "milessdk/lib" }
filter "platforms:*oal"
defines { "AUDIO_OAL" }
filter {}
if(os.getenv("GTA_III_RE_DIR")) then
setpaths("$(GTA_III_RE_DIR)/", "%(cfg.buildtarget.name)", "")
end
@ -180,9 +206,15 @@ project "re3"
characterset ("MBCS")
targetextension ".exe"
filter "platforms:linux*"
targetextension ".elf"
defines { "OPENAL" }
filter "platforms:win*oal"
includedirs { "openal-soft/include" }
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" }
filter "platforms:*RW33*"

View File

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

View File

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

View File

@ -70,36 +70,36 @@ cAudioManager::GetCollisionOneShotRatio(int32 a, float b) const
case SURFACE_DEFAULT:
case SURFACE_TARMAC:
case SURFACE_PAVEMENT:
case SURFACE_STONE:
case SURFACE_BOLLARD: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break;
case SURFACE_STEEP_CLIFF:
case SURFACE_TRANSPARENT_STONE: result = GetCollisionRatio(b, 10.f, 60.f, 50.f); break;
case SURFACE_GRASS:
case SURFACE_LOOSE30: 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_DIRTTRACK: 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_CARDBOARDBOX: 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_MUD_DRY: result = GetCollisionRatio(b, 0.f, 2.f, 2.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_SCAFFOLD:
case SURFACE_STEEL: 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_BILLBOARD: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break;
case SURFACE_METAL_POLE:
case SURFACE_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_METAL14: 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_METAL_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_TRANSPARENT_CLOTH:
case SURFACE_THICK_METAL_PLATE: result = GetCollisionRatio(b, 30.f, 130.f, 100.f); break;
case SURFACE_GARAGE_DOOR: result = GetCollisionRatio(b, 20.f, 100.f, 80.f); break;
case SURFACE_CAR_PANEL: result = GetCollisionRatio(b, 0.f, 4.f, 4.f); break;
case SURFACE_SCAFFOLD_POLE:
case SURFACE_METAL_GATE: 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_FIRE_HYDRANT: result = GetCollisionRatio(b, 1.f, 15.f, 14.f); break;
case SURFACE_GIRDER: result = GetCollisionRatio(b, 8.f, 50.f, 42.f); break;
case SURFACE_METAL_CHAIN_FENCE: result = GetCollisionRatio(b, 0.1f, 10.f, 9.9f); 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_PUDDLE: 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_BOX: 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_TIRE:
case SURFACE_RUBBER29: 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_WATER: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); break;
case SURFACE_WOOD_CRATES: result = GetCollisionRatio(b, 1.f, 4.f, 3.f); break;
case SURFACE_WOOD_BENCH: result = GetCollisionRatio(b, 0.1f, 5.f, 4.9f); break;
case SURFACE_WOOD_SOLID: result = GetCollisionRatio(b, 0.1f, 40.f, 39.9f); break;
case SURFACE_RUBBER:
case SURFACE_WHEELBASE: result = GetCollisionRatio(b, 0.f, 10.f, 10.f); 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_METAL27: 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_CONTAINER: result = GetCollisionRatio(b, 4.f, 40.f, 36.f); break;
case SURFACE_NEWS_VENDOR: result = GetCollisionRatio(b, 0.f, 5.f, 5.f); break;
default: result = 0.f; break;
}
@ -130,18 +130,18 @@ cAudioManager::SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollisio
m_sQueueSample.m_nSampleIndex = SFX_RAIN;
m_sQueueSample.m_nFrequency = 13000.f * ratio + 35000;
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);
m_sQueueSample.m_nSampleIndex = SFX_BOAT_WATER_LOOP;
m_sQueueSample.m_nFrequency = 6050.f * ratio + 16000;
vol = 30.f * ratio;
} else if(surface1 == SURFACE_DIRT || surface2 == SURFACE_DIRT || surface1 == SURFACE_DIRTTRACK ||
surface2 == SURFACE_DIRTTRACK || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
} else if(surface1 == SURFACE_GRAVEL || surface2 == SURFACE_GRAVEL || surface1 == SURFACE_MUD_DRY ||
surface2 == SURFACE_MUD_DRY || surface1 == SURFACE_SAND || surface2 == SURFACE_SAND) {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
m_sQueueSample.m_nSampleIndex = SFX_GRAVEL_SKID;
m_sQueueSample.m_nFrequency = 6000.f * ratio + 10000;
vol = 50.f * ratio;
} else if(surface1 == SURFACE_FLESH || surface2 == SURFACE_FLESH) {
} else if(surface1 == SURFACE_PED || surface2 == SURFACE_PED) {
return 0;
} else {
ratio = GetCollisionRatio(audioCollision.m_fIntensity2, 0.0001f, 0.09f, 0.0899f);
@ -240,9 +240,9 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
s2 = col.m_bSurface2;
}
ratio = GetCollisionOneShotRatio(s1, col.m_fIntensity1);
if(s1 == SURFACE_METAL6 && s2 == SURFACE_FLESH) ratio /= 4.0f;
if(s1 == SURFACE_METAL6 && ratio < 0.6f) {
s1 = SURFACE_BILLBOARD;
if(s1 == SURFACE_CAR && s2 == SURFACE_PED) ratio /= 4.0f;
if(s1 == SURFACE_CAR && ratio < 0.6f) {
s1 = SURFACE_CAR_PANEL;
ratio = Min(1.f, 2.f * ratio);
}
emittingVol = 40.f * ratio;
@ -290,13 +290,13 @@ cAudioManager::SetUpOneShotCollisionSound(const cAudioCollision &col)
}
switch(s1) {
case SURFACE_GLASS: m_sQueueSample.m_nFrequency = 13500; break;
case SURFACE_METAL15: m_sQueueSample.m_nFrequency = 8819; break;
case SURFACE_PUDDLE:
case SURFACE_GIRDER: m_sQueueSample.m_nFrequency = 8819; break;
case SURFACE_WATER:
m_sQueueSample.m_nFrequency =
2 * SampleManager.GetSampleBaseFrequency(m_sQueueSample.m_nSampleIndex);
break;
case SURFACE_TIRE: m_sQueueSample.m_nFrequency = 6000; break;
case SURFACE_HARD24: m_sQueueSample.m_nFrequency = 8000; break;
case SURFACE_RUBBER: m_sQueueSample.m_nFrequency = 6000; break;
case SURFACE_PLASTIC: m_sQueueSample.m_nFrequency = 8000; break;
default:
m_sQueueSample.m_nFrequency =
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_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 Process();
};
@ -202,11 +213,11 @@ public:
float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[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; }
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"
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);
void AddReflectionsToRequestedQueue();
void AddReleasingSounds();
@ -222,11 +233,10 @@ public:
float speedMultiplier) const;
int32 ComputePan(float, CVector *);
uint8 ComputeVolume(uint8 emittingVolume, float soundIntensity, float distance) const;
int32 CreateEntity(int32 type, void *entity);
int32 CreateEntity(eAudioType type, void *entity);
void DestroyAllGameCreatedEntities();
void DestroyEntity(int32 id);
void DoJumboVolOffset() const;
void DoPoliceRadioCrackle();
// functions returning talk sfx,
@ -318,7 +328,7 @@ public:
float GetCollisionRatio(float a, float b, float c, float d) const;
float GetDistanceSquared(const CVector &v) const;
int32 GetJumboTaxiFreq() const;
bool GetMissionAudioLoadingStatus() const;
uint8 GetMissionAudioLoadingStatus() const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const;
uint8 GetNum3DProvidersAvailable() const;
int32 GetPedCommentSfx(CPed *ped, int32 sound);
@ -348,7 +358,7 @@ public:
void PostInitialiseGameSpecificSetup();
void PostTerminateGameSpecificShutdown();
void PreInitialiseGameSpecificSetup() const;
void PreloadMissionAudio(const char *name);
void PreloadMissionAudio(Const char *name);
void PreTerminateGameSpecificShutdown();
/// processX - main logic of adding new sounds
void ProcessActiveQueues();
@ -410,7 +420,7 @@ public:
void ProcessVehicleOneShots(cVehicleParams *params);
bool ProcessVehicleReverseWarning(cVehicleParams *params);
bool ProcessVehicleRoadNoise(cVehicleParams *params);
void ProcessVehicleSirenOrAlarm(cVehicleParams *params);
bool ProcessVehicleSirenOrAlarm(cVehicleParams *params);
void ProcessVehicleSkidding(cVehicleParams *params);
void ProcessWaterCannon(int32);
void ProcessWeather(int32 id);
@ -464,11 +474,11 @@ public:
bool UsesSiren(int32 model) const;
bool UsesSirenSwitching(int32 model) const;
#ifdef GTA_PC
// only used in pc
void AdjustSamplesVolume();
uint8 ComputeEmittingVolume(uint8 emittingVolume, float intensity, float dist);
void DebugShit();
#endif
};
#ifdef AUDIO_MSS

View File

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

View File

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

View File

@ -1,135 +1,5 @@
#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
{
public:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -35,15 +35,13 @@
*/
ALDeviceList::ALDeviceList()
{
ALDEVICEINFO ALDeviceInfo;
char *devices;
int index;
const char *defaultDeviceName;
const char *actualDeviceName;
// DeviceInfo vector stores, for each enumerated device, it's device name, selection status, spec version #, and extension support
vDeviceInfo.empty();
vDeviceInfo.reserve(10);
nNumOfDevices = 0;
defaultDeviceIndex = 0;
@ -65,51 +63,49 @@ ALDeviceList::ALDeviceList()
// if new actual device name isn't already in the list, then add it...
actualDeviceName = alcGetString(device, ALC_DEVICE_SPECIFIER);
bool bNewName = true;
for (int i = 0; i < GetNumDevices(); i++) {
for (unsigned int i = 0; i < GetNumDevices(); i++) {
if (strcmp(GetDeviceName(i), actualDeviceName) == 0) {
bNewName = false;
}
}
if ((bNewName) && (actualDeviceName != NULL) && (strlen(actualDeviceName) > 0)) {
memset(&ALDeviceInfo, 0, sizeof(ALDEVICEINFO));
ALDEVICEINFO ALDeviceInfo;
ALDeviceInfo.bSelected = true;
ALDeviceInfo.strDeviceName.assign(actualDeviceName, strlen(actualDeviceName));
ALDeviceInfo.strDeviceName = actualDeviceName;
alcGetIntegerv(device, ALC_MAJOR_VERSION, sizeof(int), &ALDeviceInfo.iMajorVersion);
alcGetIntegerv(device, ALC_MINOR_VERSION, sizeof(int), &ALDeviceInfo.iMinorVersion);
ALDeviceInfo.pvstrExtensions = new std::vector<std::string>;
// Check for ALC Extensions
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)
ALDeviceInfo.pvstrExtensions->push_back("ALC_EXT_EFX");
ALDeviceInfo.Extensions |= ADEXT_EXT_EFX;
// Check for AL Extensions
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)
ALDeviceInfo.pvstrExtensions->push_back("AL_EXT_LINEAR_DISTANCE");
ALDeviceInfo.Extensions |= ADEXT_EXT_LINEAR_DISTANCE;
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)
ALDeviceInfo.pvstrExtensions->push_back("EAX2.0");
ALDeviceInfo.Extensions |= ADEXT_EAX2;
if (alIsExtensionPresent("EAX3.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX3.0");
ALDeviceInfo.Extensions |= ADEXT_EAX3;
if (alIsExtensionPresent("EAX4.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX4.0");
ALDeviceInfo.Extensions |= ADEXT_EAX4;
if (alIsExtensionPresent("EAX5.0") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX5.0");
ALDeviceInfo.Extensions |= ADEXT_EAX5;
if (alIsExtensionPresent("EAX-RAM") == AL_TRUE)
ALDeviceInfo.pvstrExtensions->push_back("EAX-RAM");
ALDeviceInfo.Extensions |= ADEXT_EAX_RAM;
// Get Source Count
ALDeviceInfo.uiSourceCount = GetMaxNumSources();
vDeviceInfo.push_back(ALDeviceInfo);
aDeviceInfo[nNumOfDevices++] = ALDeviceInfo;
}
alcMakeContextCurrent(NULL);
alcDestroyContext(context);
@ -129,31 +125,23 @@ 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
*/
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
*/
char * ALDeviceList::GetDeviceName(int index)
const char * ALDeviceList::GetDeviceName(unsigned int index)
{
if (index < GetNumDevices())
return (char *)vDeviceInfo[index].strDeviceName.c_str();
return aDeviceInfo[index].strDeviceName;
else
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
*/
void ALDeviceList::GetDeviceVersion(int index, int *major, int *minor)
void ALDeviceList::GetDeviceVersion(unsigned int index, int *major, int *minor)
{
if (index < GetNumDevices()) {
if (major)
*major = vDeviceInfo[index].iMajorVersion;
*major = aDeviceInfo[index].iMajorVersion;
if (minor)
*minor = vDeviceInfo[index].iMinorVersion;
*minor = aDeviceInfo[index].iMinorVersion;
}
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
*/
unsigned int ALDeviceList::GetMaxNumSources(int index)
unsigned int ALDeviceList::GetMaxNumSources(unsigned int index)
{
if (index < GetNumDevices())
return vDeviceInfo[index].uiSourceCount;
return aDeviceInfo[index].uiSourceCount;
else
return 0;
}
@ -186,20 +174,9 @@ unsigned int ALDeviceList::GetMaxNumSources(int index)
/*
* 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;
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;
return !!(aDeviceInfo[index].Extensions & ext);
}
/*
@ -216,10 +193,10 @@ int ALDeviceList::GetDefaultDevice()
void ALDeviceList::FilterDevicesMinVer(int major, int minor)
{
int dMajor, dMinor;
for (unsigned int i = 0; i < vDeviceInfo.size(); i++) {
for (unsigned int i = 0; i < nNumOfDevices; i++) {
GetDeviceVersion(i, &dMajor, &dMinor);
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)
{
int dMajor, dMinor;
for (unsigned int i = 0; i < vDeviceInfo.size(); i++) {
for (unsigned int i = 0; i < nNumOfDevices; i++) {
GetDeviceVersion(i, &dMajor, &dMinor);
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
*/
void ALDeviceList::FilterDevicesExtension(char *szExtName)
void
ALDeviceList::FilterDevicesExtension(unsigned short ext)
{
bool bFound;
for (unsigned int i = 0; i < vDeviceInfo.size(); i++) {
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;
for (unsigned int i = 0; i < nNumOfDevices; i++) {
if (!IsExtensionSupported(i, ext))
aDeviceInfo[i].bSelected = false;
}
}
@ -263,8 +232,8 @@ void ALDeviceList::FilterDevicesExtension(char *szExtName)
*/
void ALDeviceList::ResetFilters()
{
for (int i = 0; i < GetNumDevices(); i++) {
vDeviceInfo[i].bSelected = true;
for (unsigned int i = 0; i < GetNumDevices(); i++) {
aDeviceInfo[i].bSelected = true;
}
filterIndex = 0;
}
@ -274,10 +243,10 @@ void ALDeviceList::ResetFilters()
*/
int ALDeviceList::GetFirstFilteredDevice()
{
int i;
unsigned int i;
for (i = 0; i < GetNumDevices(); i++) {
if (vDeviceInfo[i].bSelected == true) {
if (aDeviceInfo[i].bSelected == true) {
break;
}
}
@ -290,10 +259,10 @@ int ALDeviceList::GetFirstFilteredDevice()
*/
int ALDeviceList::GetNextFilteredDevice()
{
int i;
unsigned int i;
for (i = filterIndex; i < GetNumDevices(); i++) {
if (vDeviceInfo[i].bSelected == true) {
if (aDeviceInfo[i].bSelected == true) {
break;
}
}

View File

@ -5,38 +5,58 @@
#ifdef AUDIO_OAL
#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 iMinorVersion;
unsigned int uiSourceCount;
std::vector<std::string> *pvstrExtensions;
unsigned short Extensions;
bool bSelected;
} ALDEVICEINFO, *LPALDEVICEINFO;
ALDEVICEINFO() : iMajorVersion(0), iMinorVersion(0), uiSourceCount(0), bSelected(false)
{
strDeviceName = NULL;
Extensions = 0;
}
};
typedef ALDEVICEINFO *LPALDEVICEINFO;
class ALDeviceList
{
private:
std::vector<ALDEVICEINFO> vDeviceInfo;
ALDEVICEINFO aDeviceInfo[64];
unsigned int nNumOfDevices;
int defaultDeviceIndex;
int filterIndex;
public:
ALDeviceList ();
~ALDeviceList ();
int GetNumDevices();
char *GetDeviceName(int index);
void GetDeviceVersion(int index, int *major, int *minor);
unsigned int GetMaxNumSources(int index);
bool IsExtensionSupported(int index, const char *szExtName);
unsigned int GetNumDevices();
const char *GetDeviceName(unsigned int index);
void GetDeviceVersion(unsigned int index, int *major, int *minor);
unsigned int GetMaxNumSources(unsigned int index);
bool IsExtensionSupported(int index, unsigned short ext);
int GetDefaultDevice();
void FilterDevicesMinVer(int major, int minor);
void FilterDevicesMaxVer(int major, int minor);
void FilterDevicesExtension(char *szExtName);
void FilterDevicesExtension(unsigned short ext);
void ResetFilters();
int GetFirstFilteredDevice();
int GetNextFilteredDevice();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#include "AudioSamples.h"
#define MAX_VOLUME 127
#define MAX_FREQ 22050
#define MAX_FREQ DIGITALRATE
struct tSample {
int32 nOffset;
@ -13,9 +13,83 @@ struct tSample {
int32 nLoopEnd;
};
#ifdef GTA_PS2
#define PS2BANK(e) e
#else
#define PS2BANK(e) e = SAMPLEBANK_MAIN
#endif // GTA_PS2
enum
{
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,
MAX_SAMPLEBANKS,
SAMPLEBANK_INVALID

View File

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

View File

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

View File

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

View File

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

View File

@ -1853,7 +1853,14 @@ CVehicle* CStoredCar::RestoreCar()
CStreaming::RequestModel(m_nModelIndex, STREAMFLAGS_DEPENDENCY);
if (!CStreaming::HasModelLoaded(m_nModelIndex))
return nil;
#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
CVehicle* pVehicle;
if (CModelInfo::IsBoatModel(m_nModelIndex))

View File

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

View File

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

View File

@ -132,7 +132,8 @@ CRoadBlocks::GenerateRoadBlocks(void)
CColModel *pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel();
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
int16 radius = (int16)(fMapObjectRadius / fModelRadius);
if (radius > 0 && radius < 6) {
if (radius >= 6)
continue;
CVector2D vecDistanceToCamera = TheCamera.GetPosition() - mapObject->GetPosition();
float fDotProduct = DotProduct2D(vecDistanceToCamera, mapObject->GetForward());
float fOffset = 0.5f * fModelRadius * (float)(radius - 1);
@ -146,9 +147,9 @@ CRoadBlocks::GenerateRoadBlocks(void)
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);
offsetMatrix.GetPosition() = CVector(0.0f, i * fModelRadius - fOffset, 0.6f);
else
offsetMatrix.GetPosition() = CVector(-fOffset, 0.0f, 0.6f);
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;
@ -174,7 +175,7 @@ CRoadBlocks::GenerateRoadBlocks(void)
pVehicle->bExtendedRange = true;
if (pVehicle->UsesSiren(pVehicle->GetModelIndex()) && CGeneral::GetRandomNumber() & 1)
pVehicle->m_bSirenOrAlarm = true;
if (pVehicle->GetForward().z > 0.94f) {
if (pVehicle->GetUp().z > 0.94f) {
CVisibilityPlugins::SetClumpAlpha(pVehicle->GetClump(), 0);
CWorld::Add(pVehicle);
pVehicle->bCreateRoadBlockPeds = true;
@ -188,7 +189,6 @@ CRoadBlocks::GenerateRoadBlocks(void)
}
}
}
}
} else {
InOrOut[nRoadblockNode] = false;
}

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -5,6 +5,7 @@
#include "World.h"
#include "Vehicle.h"
#include "Automobile.h"
#include "Boat.h"
#include "Ped.h"
#include "PlayerPed.h"
#include "CopPed.h"
@ -29,7 +30,7 @@ bool PrintDebugCode = false;
int16 DebugCamMode;
#ifdef FREE_CAM
bool CCamera::bFreeCam = true;
bool CCamera::bFreeCam;
int nPreviousMode = -1;
#endif
@ -39,11 +40,11 @@ CCam::Init(void)
Mode = MODE_FOLLOWPED;
Front = CVector(0.0f, 0.0f, -1.0f);
Up = CVector(0.0f, 0.0f, 1.0f);
Rotating = 0;
Rotating = false;
m_iDoCollisionChecksOnFrameNum = 1;
m_iDoCollisionCheckEveryNumOfFrames = 9;
m_iFrameNumWereAt = 0;
m_bCollisionChecksOn = 1;
m_bCollisionChecksOn = false;
m_fRealGroundDist = 0.0f;
BetaSpeed = 0.0f;
AlphaSpeed = 0.0f;
@ -51,21 +52,21 @@ CCam::Init(void)
f_max_role_angle = DEGTORAD(5.0f);
Distance = 30.0f;
DistanceSpeed = 0.0f;
m_pLastCarEntered = 0;
m_pLastPedLookedAt = 0;
ResetStatics = 1;
m_pLastCarEntered = nil;
m_pLastPedLookedAt = nil;
ResetStatics = true;
Beta = 0.0f;
m_bFixingBeta = 0;
m_bFixingBeta = false;
CA_MIN_DISTANCE = 0.0f;
CA_MAX_DISTANCE = 0.0f;
LookingBehind = 0;
LookingLeft = 0;
LookingRight = 0;
LookingBehind = false;
LookingLeft = false;
LookingRight = false;
m_fPlayerInFrontSyphonAngleOffSet = DEGTORAD(20.0f);
m_fSyphonModeTargetZOffSet = 0.5f;
m_fRadiusForDead = 1.5f;
DirectionWasLooking = LOOKING_FORWARD;
LookBehindCamWasInFront = 0;
LookBehindCamWasInFront = false;
f_Roll = 0.0f;
f_rollSpeed = 0.0f;
m_fCloseInPedHeightOffset = 0.0f;
@ -110,7 +111,11 @@ CCam::Process(void)
Fwd.x = CamTargetEntity->GetForward().x;
Fwd.y = CamTargetEntity->GetForward().y;
Fwd.Normalise();
// Game normalizes again here manually. useless, so skipped
float FwdLength = Fwd.Magnitude2D();
if(FwdLength != 0.0f){
Fwd.x /= FwdLength;
Fwd.y /= FwdLength;
}
float FwdSpeedX = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().x * Fwd.x;
float FwdSpeedY = ((CVehicle*)CamTargetEntity)->GetMoveSpeed().y * Fwd.y;
@ -162,7 +167,9 @@ CCam::Process(void)
case MODE_MODELVIEW:
Process_ModelView(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
// case MODE_BILL:
case MODE_BILL:
Process_Bill(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
case MODE_SYPHON:
Process_Syphon(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
@ -210,10 +217,18 @@ CCam::Process(void)
case MODE_PLAYER_FALLEN_WATER:
Process_Player_Fallen_Water(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
// case MODE_CAM_ON_TRAIN_ROOF:
// case MODE_CAM_RUNNING_SIDE_TRAIN:
// case MODE_BLOOD_ON_THE_TRACKS:
// case MODE_IM_THE_PASSENGER_WOOWOO:
case MODE_CAM_ON_TRAIN_ROOF:
Process_Cam_On_Train_Roof(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
case MODE_CAM_RUNNING_SIDE_TRAIN:
Process_Cam_Running_Side_Train(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
case MODE_BLOOD_ON_THE_TRACKS:
Process_Blood_On_The_Tracks(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
case MODE_IM_THE_PASSENGER_WOOWOO:
Process_Im_The_Passenger_Woo_Woo(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
case MODE_SYPHON_CRIM_IN_FRONT:
Process_Syphon_Crim_In_Front(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
break;
@ -263,7 +278,7 @@ CCam::Process(void)
CVector TargetToCam = Source - m_cvecTargetCoorsForFudgeInter;
float DistOnGround = TargetToCam.Magnitude2D();
m_fTrueBeta = CGeneral::GetATanOfXY(TargetToCam.x, TargetToCam.y);
m_fTrueAlpha = CGeneral::GetATanOfXY(TargetToCam.z, DistOnGround);
m_fTrueAlpha = CGeneral::GetATanOfXY(DistOnGround, TargetToCam.z);
if(TheCamera.m_uiTransitionState == 0)
KeepTrackOfTheSpeed(Source, m_cvecTargetCoorsForFudgeInter, Up, m_fTrueAlpha, m_fTrueBeta, FOV);
@ -419,11 +434,11 @@ CCam::ProcessSpecialHeightRoutines(void)
float DistScale = (2.1f - dist)/2.1f;
if(Mode == MODE_FOLLOWPED){
if(TheCamera.PedZoomIndicator == CAM_ZOOM_1)
Offset = 0.45*DistScale + PedZDist;
Offset = 0.45f*DistScale + PedZDist;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_2)
Offset = 0.35*DistScale + PedZDist;
Offset = 0.35f*DistScale + PedZDist;
if(TheCamera.PedZoomIndicator == CAM_ZOOM_3)
Offset = 0.25*DistScale + PedZDist;
Offset = 0.25f*DistScale + PedZDist;
if(Abs(CGeneral::GetRadianAngleBetweenPoints(CamToPed.x, CamToPed.y, CamToTarget.x, CamToTarget.y)) > HALFPI)
Offset += 0.3f;
m_fPedBetweenCameraHeightOffset = Offset + 1.3f;
@ -504,11 +519,11 @@ CCam::ProcessSpecialHeightRoutines(void)
switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched)
case SURFACE_GRASS:
case SURFACE_DIRT:
case SURFACE_DIRTTRACK:
case SURFACE_STEEL:
case SURFACE_TIRE:
case SURFACE_STONE:
case SURFACE_GRAVEL:
case SURFACE_MUD_DRY:
case SURFACE_THICK_METAL_PLATE:
case SURFACE_RUBBER:
case SURFACE_STEEP_CLIFF:
OnRoad = true;
if(CCullZones::PlayerNoRain())
@ -565,9 +580,9 @@ CCam::ProcessSpecialHeightRoutines(void)
if(PreviouslyFailedRoadHeightCheck && m_fCloseInPedHeightOffset < 0.0001f){
if(colPoint.surfaceB != SURFACE_TARMAC &&
colPoint.surfaceB != SURFACE_GRASS &&
colPoint.surfaceB != SURFACE_DIRT &&
colPoint.surfaceB != SURFACE_DIRTTRACK &&
colPoint.surfaceB != SURFACE_STONE){
colPoint.surfaceB != SURFACE_GRAVEL &&
colPoint.surfaceB != SURFACE_MUD_DRY &&
colPoint.surfaceB != SURFACE_STEEP_CLIFF){
if(m_fRoadOffSet > 1.4f)
m_fRoadOffSet = 1.4f;
}else{
@ -795,7 +810,7 @@ CCam::ClipIfPedInFrontOfPlayer(void)
while(DeltaAngle >= PI) DeltaAngle -= 2*PI;
while(DeltaAngle < -PI) DeltaAngle += 2*PI;
if(Abs(DeltaAngle) < HALFPI){
fDist = Sqrt(SQR(vDist.x) + SQR(vDist.y));
fDist = vDist.Magnitude2D();
if(fDist < 1.25f){
Near = DEFAULT_NEAR - (1.25f - fDist);
if(Near < 0.05f)
@ -822,9 +837,9 @@ CCam::KeepTrackOfTheSpeed(const CVector &source, const CVector &target, const CV
PreviousUp = up;
}
m_cvecSourceSpeedOverOneFrame = PreviousSource - source;
m_cvecTargetSpeedOverOneFrame = PreviousTarget - target;
m_cvecUpOverOneFrame = PreviousUp - up;
m_cvecSourceSpeedOverOneFrame = source - PreviousSource;
m_cvecTargetSpeedOverOneFrame = target - PreviousTarget;
m_cvecUpOverOneFrame = up - PreviousUp;
m_fFovSpeedOverOneFrame = fov - PreviousFov;
m_fBetaSpeedOverOneFrame = beta - PreviousBeta;
MakeAngleLessThan180(m_fBetaSpeedOverOneFrame);
@ -846,17 +861,13 @@ CCam::Using3rdPersonMouseCam(void)
(Mode == MODE_FOLLOWPED ||
TheCamera.m_bPlayerIsInGarage &&
FindPlayerPed() && FindPlayerPed()->m_nPedState != PED_DRIVING &&
Mode != MODE_TOPDOWN && this->CamTargetEntity == FindPlayerPed());
Mode != MODE_TOPDOWN && CamTargetEntity == FindPlayerPed());
}
bool
CCam::GetWeaponFirstPersonOn(void)
{
CEntity *target = this->CamTargetEntity;
if (target && target->IsPed())
return ((CPed*)target)->GetWeapon()->m_bAddRotOffset;
return false;
return CamTargetEntity && CamTargetEntity->IsPed() && ((CPed*)CamTargetEntity)->GetWeapon()->m_bAddRotOffset;
}
bool
@ -992,12 +1003,15 @@ CCam::GetPedBetaAngleForClearView(const CVector &Target, float Dist, float BetaO
return 0.0f;
}
static float DefaultAcceleration = 0.045f;
static float DefaultMaxStep = 0.15f;
float DefaultAcceleration = 0.045f;
float DefaultMaxStep = 0.15f;
void
CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, float, float)
{
if(!CamTargetEntity->IsPed())
return;
const float GroundDist = 1.85f;
CVector TargetCoors, Dist, IdealSource;
@ -1014,7 +1028,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bool GoingBehind = false;
bool Obscured = false;
bool BuildingCheckObscured = false;
bool HackPlayerOnStoppingTrain = false;
bool StandingInTrain = false;
static int TimeIndicatedWantedToGoDown = 0;
static bool StartedCountingForGoDown = false;
float DeltaBeta;
@ -1023,12 +1037,6 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bBelowMinDist = false;
bBehindPlayerDesired = false;
#ifdef FIX_BUGS
if(!CamTargetEntity->IsPed())
return;
#endif
assert(CamTargetEntity->IsPed());
// CenterDist should be > LateralDist because we don't have an angle for safety in this case
float CenterDist, LateralDist;
float AngleToGoToSpeed;
@ -1094,7 +1102,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
if(FindPlayerVehicle())
if(FindPlayerVehicle()->m_vehType == VEHICLE_TYPE_TRAIN)
HackPlayerOnStoppingTrain = true;
StandingInTrain = true;
if(TheCamera.m_bCamDirectlyInFront){
m_bCollisionChecksOn = true;
@ -1347,7 +1355,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
if(TheCamera.m_bCamDirectlyBehind || TheCamera.m_bCamDirectlyInFront ||
HackPlayerOnStoppingTrain || Rotating){
StandingInTrain || Rotating){
if(TheCamera.m_bCamDirectlyBehind){
Beta = TargetOrientation + PI;
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
@ -1358,7 +1366,7 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
}
if(HackPlayerOnStoppingTrain){
if(StandingInTrain){
Beta = TargetOrientation + PI;
Source.x = TargetCoors.x + RotDistance * Cos(Beta);
Source.y = TargetCoors.y + RotDistance * Sin(Beta);
@ -1408,11 +1416,11 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
bool foo = false;
switch(((CPhysical*)CamTargetEntity)->m_nSurfaceTouched)
case SURFACE_GRASS:
case SURFACE_DIRT:
case SURFACE_GRAVEL:
case SURFACE_PAVEMENT:
case SURFACE_STEEL:
case SURFACE_TIRE:
case SURFACE_STONE:
case SURFACE_THICK_METAL_PLATE:
case SURFACE_RUBBER:
case SURFACE_STEEP_CLIFF:
foo = true;
if(foo)
WellBufferMe(TargetHeight, &m_fCamBufferedHeight, &m_fCamBufferedHeightSpeed, 0.4f, 0.05f, false);
@ -1467,14 +1475,14 @@ CCam::Process_FollowPed(const CVector &CameraTarget, float TargetOrientation, fl
ResetStatics = false;
}
static float fBaseDist = 1.7f;
static float fAngleDist = 2.0f;
static float fFalloff = 3.0f;
static float fStickSens = 0.01f;
static float fTweakFOV = 1.05f;
static float fTranslateCamUp = 0.8f;
static int16 nFadeControlThreshhold = 45;
static float fDefaultAlphaOrient = -0.22f;
float fBaseDist = 1.7f;
float fAngleDist = 2.0f;
float fFalloff = 3.0f;
float fStickSens = 0.01f;
float fTweakFOV = 1.05f;
float fTranslateCamUp = 0.8f;
int16 nFadeControlThreshhold = 45;
float fDefaultAlphaOrient = -0.22f;
void
CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrientation, float, float)
@ -1516,8 +1524,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
BetaOffset = LookLeftRight * fStickSens * (0.5f/7.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.3f/7.0f) * FOV/80.0f * CTimer::GetTimeStep();
BetaOffset = LookLeftRight * fStickSens * (1.0f/14.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.6f/14.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
if(TheCamera.GetFading() && TheCamera.GetFadingDirection() == FADE_IN && nFadeControlThreshhold < CDraw::FadeValue ||
@ -1539,7 +1547,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors = CameraTarget;
TargetCoors.z += fTranslateCamUp;
@ -1577,7 +1585,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
if(entity->IsPed() && ColCamDist > 1.0f){
if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
@ -1615,9 +1623,12 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
if(dist == 0.1f)
Source += (TargetCoors - Source)*0.3f;
Near = RwCameraGetNearClipPlane(Scene.camera);
#ifndef FIX_BUGS
// this is totally wrong...
radius = Tan(FOV / 2.0f) * Near;
#else
radius = ViewPlaneWidth*Near;
#endif
// Keep testing
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
@ -1656,6 +1667,8 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
}
}
float fBillsBetaOffset; // made up name, actually in CCam
void
CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, float, float)
{
@ -1675,6 +1688,15 @@ CCam::Process_BehindCar(const CVector &CameraTarget, float TargetOrientation, fl
if(Length < 0.002f)
Length = 0.002f;
Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
#ifdef TOGGLEABLE_BETA_FEATURES
// This is completely made up but Bill's cam manipulates an angle before calling this
// and otherwise calculating Beta doesn't make much sense.
Beta += fBillsBetaOffset;
fBillsBetaOffset = 0.0f;
Dist.x = -Length*Cos(Beta);
Dist.y = -Length*Sin(Beta);
Source = TargetCoors + Dist;
#endif
if(Length > CA_MAX_DISTANCE){
Source.x = TargetCoors.x + Dist.x/Length * CA_MAX_DISTANCE;
Source.y = TargetCoors.y + Dist.y/Length * CA_MAX_DISTANCE;
@ -1764,8 +1786,13 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation)
else
WellBufferMe(TargetZOffSet, &RoadHeightFix, &RoadHeightFixSpeed, 0.27f, 0.1f, false);
if((colpoint.surfaceB == SURFACE_DEFAULT || colpoint.surfaceB >= SURFACE_METAL6) &&
colpoint.surfaceB != SURFACE_STEEL && colpoint.surfaceB != SURFACE_STONE &&
if(colpoint.surfaceB != SURFACE_TARMAC &&
colpoint.surfaceB != SURFACE_GRASS &&
colpoint.surfaceB != SURFACE_GRAVEL &&
colpoint.surfaceB != SURFACE_MUD_DRY &&
colpoint.surfaceB != SURFACE_PAVEMENT &&
colpoint.surfaceB != SURFACE_THICK_METAL_PLATE &&
colpoint.surfaceB != SURFACE_STEEP_CLIFF &&
RoadHeightFix > 1.4f)
RoadHeightFix = 1.4f;
@ -1775,14 +1802,14 @@ CCam::WorkOutCamHeightWeeCar(CVector &TargetCoors, float TargetOrientation)
void
CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, float TargetHeight)
{
float AlphaOffset = 0.0f;
bool CamClear = true;
static float LastTargetAlphaWithCollisionOn = 0.0f;
static float LastTopAlphaSpeed = 0.0f;
static float LastAlphaSpeedStep = 0.0f;
static bool PreviousNearCheckNearClipSmall = false;
bool CamClear = true;
float ModeAlpha = 0.0f;
if(ResetStatics){
LastTargetAlphaWithCollisionOn = 0.0f;
LastTopAlphaSpeed = 0.0f;
@ -1797,17 +1824,16 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
if(zoomvalue < 0.1f)
zoomvalue = 0.1f;
if(TheCamera.CarZoomIndicator == CAM_ZOOM_1)
ModeAlpha = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near
AlphaOffset = CGeneral::GetATanOfXY(23.0f, zoomvalue); // near
else if(TheCamera.CarZoomIndicator == CAM_ZOOM_2)
ModeAlpha = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid
AlphaOffset = CGeneral::GetATanOfXY(10.8f, zoomvalue); // mid
else if(TheCamera.CarZoomIndicator == CAM_ZOOM_3)
ModeAlpha = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far
AlphaOffset = CGeneral::GetATanOfXY(7.0f, zoomvalue); // far
float Length = (Source - TargetCoors).Magnitude2D();
if(m_bCollisionChecksOn){ // there's another variable (on PC) but it's uninitialised
CVector Forward = CamTargetEntity->GetForward();
float CarAlpha = CGeneral::GetATanOfXY(Forward.Magnitude2D(), Forward.z);
float CarAlpha = CGeneral::GetATanOfXY(CamTargetEntity->GetForward().Magnitude2D(), CamTargetEntity->GetForward().z);
// this shouldn't be necessary....
while(CarAlpha >= PI) CarAlpha -= 2*PI;
while(CarAlpha < -PI) CarAlpha += 2*PI;
@ -1815,11 +1841,11 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
float deltaBeta = Beta - TargetOrientation;
while(deltaBeta >= PI) deltaBeta -= 2*PI;
while(deltaBeta < -PI) deltaBeta += 2*PI;
float DeltaBeta = Beta - TargetOrientation;
while(DeltaBeta >= PI) DeltaBeta -= 2*PI;
while(DeltaBeta < -PI) DeltaBeta += 2*PI;
float BehindCarNess = Cos(deltaBeta); // 1 if behind car, 0 if side, -1 if in front
float BehindCarNess = Cos(DeltaBeta); // 1 if behind car, 0 if side, -1 if in front
CarAlpha = -CarAlpha * BehindCarNess;
if(CarAlpha < -0.01f)
CarAlpha = -0.01f;
@ -1829,10 +1855,10 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
while(DeltaAlpha < -PI) DeltaAlpha += 2*PI;
// What's this?? wouldn't it make more sense to clamp?
float AngleLimit = DEGTORAD(1.8f);
if(DeltaAlpha < -AngleLimit)
DeltaAlpha += AngleLimit;
else if(DeltaAlpha > AngleLimit)
if(DeltaAlpha > AngleLimit)
DeltaAlpha -= AngleLimit;
else if(DeltaAlpha < -AngleLimit)
DeltaAlpha += AngleLimit;
else
DeltaAlpha = 0.0f;
@ -1851,7 +1877,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
float CarRoof = CWorld::FindRoofZFor3DCoord(TargetCoors.x, TargetCoors.y, CarBottom, &FoundRoofCenter);
// Check sides of the car
Forward = CamTargetEntity->GetForward(); // we actually still have that...
CVector Forward = CamTargetEntity->GetForward();
Forward.Normalise(); // shouldn't be necessary
float CarSideAngle = CGeneral::GetATanOfXY(Forward.x, Forward.y) + PI/2.0f;
float SideX = 2.5f * Cos(CarSideAngle);
@ -1860,7 +1886,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
CWorld::FindRoofZFor3DCoord(TargetCoors.x - SideX, TargetCoors.y - SideY, CarBottom, &FoundRoofSide2);
// Now find out at what height we'd like to place the camera
float CamGround = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, TargetCoors.z + Length*Sin(Alpha + ModeAlpha) + m_fCloseInCarHeightOffset, &FoundCamGround);
float CamGround = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, TargetCoors.z + Length*Sin(Alpha + AlphaOffset) + m_fCloseInCarHeightOffset, &FoundCamGround);
float CamTargetZ = 0.0f;
if(FoundCamGround){
// This is the normal case
@ -1890,15 +1916,15 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
TargetAlpha = DEGTORAD(-7.0f);
// huh?
if(TargetAlpha > ModeAlpha)
if(TargetAlpha > AlphaOffset)
CamClear = true;
// Camera is contrained by collision in some way
// Camera is constrained by collision in some way
PreviousNearCheckNearClipSmall = false;
if(!CamClear){
PreviousNearCheckNearClipSmall = true;
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
DeltaAlpha = TargetAlpha - (Alpha + ModeAlpha);
DeltaAlpha = TargetAlpha - (Alpha + AlphaOffset);
while(DeltaAlpha >= PI) DeltaAlpha -= 2*PI;
while(DeltaAlpha < -PI) DeltaAlpha += 2*PI;
@ -1907,26 +1933,25 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
}
// Now do things if CamClear...but what is that anyway?
float CamZ = TargetCoors.z + Length*Sin(Alpha + DeltaAlpha + ModeAlpha) + m_fCloseInCarHeightOffset;
float CamZ = TargetCoors.z + Length*Sin(Alpha + DeltaAlpha + AlphaOffset) + m_fCloseInCarHeightOffset;
bool FoundGround, FoundRoof;
float CamGround2 = CWorld::FindGroundZFor3DCoord(Source.x, Source.y, CamZ, &FoundGround);
if(FoundGround){
if(CamClear)
if(FoundGround && CamClear){
if(CamZ - CamGround2 < 1.5f){
PreviousNearCheckNearClipSmall = true;
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
float dz = CamGround2 + 1.5f - TargetCoors.z;
float a;
if(Length == 0.0f || CamGround2 + 1.5f - TargetCoors.z == 0.0f)
if(Length == 0.0f || dz == 0.0f)
a = Alpha;
else
a = CGeneral::GetATanOfXY(Length, CamGround2 + 1.5f - TargetCoors.z);
a = CGeneral::GetATanOfXY(Length, dz);
while(a > PI) a -= 2*PI;
while(a < -PI) a += 2*PI;
DeltaAlpha = a - Alpha;
}
}else{
if(CamClear){
}else if(CamClear){
float CamRoof2 = CWorld::FindRoofZFor3DCoord(Source.x, Source.y, CamZ, &FoundRoof);
if(FoundRoof && CamZ - CamRoof2 < 1.5f){
PreviousNearCheckNearClipSmall = true;
@ -1935,17 +1960,17 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
if(CamRoof2 > TargetCoors.z + 3.5f)
CamRoof2 = TargetCoors.z + 3.5f;
float dz = CamRoof2 + 1.5f - TargetCoors.z;
float a;
if(Length == 0.0f || CamRoof2 + 1.5f - TargetCoors.z == 0.0f)
if(Length == 0.0f || dz == 0.0f)
a = Alpha;
else
a = CGeneral::GetATanOfXY(Length, CamRoof2 + 1.5f - TargetCoors.z);
a = CGeneral::GetATanOfXY(Length, dz);
while(a > PI) a -= 2*PI;
while(a < -PI) a += 2*PI;
DeltaAlpha = a - Alpha;
}
}
}
LastTargetAlphaWithCollisionOn = DeltaAlpha + Alpha;
LastTopAlphaSpeed = TopAlphaSpeed;
@ -1957,7 +1982,7 @@ CCam::WorkOutCamHeight(const CVector &TargetCoors, float TargetOrientation, floa
WellBufferMe(LastTargetAlphaWithCollisionOn, &Alpha, &AlphaSpeed, LastTopAlphaSpeed, LastAlphaSpeedStep, true);
Source.z = TargetCoors.z + Sin(Alpha + ModeAlpha)*Length + m_fCloseInCarHeightOffset;
Source.z = TargetCoors.z + Sin(Alpha + AlphaOffset)*Length + m_fCloseInCarHeightOffset;
}
// Rotate cam behind the car when the car is moving forward
@ -2107,9 +2132,9 @@ CCam::Process_Cam_On_A_String(const CVector &CameraTarget, float TargetOrientati
CBaseModelInfo *mi = CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex());
CVector Dimensions = mi->GetColModel()->boundingBox.max - mi->GetColModel()->boundingBox.min;
CVector TargetCoors = CameraTarget;
float BaseDist = Dimensions.Magnitude2D();
CVector TargetCoors = CameraTarget;
TargetCoors.z += Dimensions.z - 0.1f; // final
Beta = CGeneral::GetATanOfXY(TargetCoors.x - Source.x, TargetCoors.y - Source.y);
while(Alpha >= PI) Alpha -= 2*PI;
@ -2144,6 +2169,8 @@ CCam::Cam_On_A_String_Unobscured(const CVector &TargetCoors, float BaseDist)
if(ResetStatics)
Source = TargetCoors + Dist*(CA_MAX_DISTANCE + 1.0f);
Dist = Source - TargetCoors;
float Length = Dist.Magnitude2D();
if(Length < 0.001f){
// This probably shouldn't happen. reset view
@ -2171,7 +2198,7 @@ CCam::FixCamWhenObscuredByVehicle(const CVector &TargetCoors)
static float HeightFixerCarsObscuring = 0.0f;
static float HeightFixerCarsObscuringSpeed = 0.0f;
CColPoint colPoint;
CEntity *entity;
CEntity *entity = nil;
float HeightTarget = 0.0f;
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, false, true, false, false, false, false, false)){
@ -2468,8 +2495,8 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float)
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
@ -2570,13 +2597,13 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
#ifdef GTA3_1_1_PATCH
HeadPos.x = 0.0f;
@ -2682,12 +2709,12 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
LookUpDown = CPad::GetPad(0)->LookAroundUpDown();
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@ -2732,9 +2759,9 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
}else{
assert(CamTargetEntity->IsVehicle());
CVehicleModelInfo *mi = (CVehicleModelInfo*)CModelInfo::GetModelInfo(CamTargetEntity->GetModelIndex());
CVector CamPos = mi->m_vehicleType == VEHICLE_TYPE_BOAT ? mi->m_positions[BOAT_POS_FRONTSEAT] : mi->m_positions[CAR_POS_FRONTSEAT];
CVector CamPos = mi->GetFrontSeatPosn();
CamPos.x = 0.0f;
CamPos.y += -0.08f;
CamPos.y += 0.08f;
CamPos.z += 0.62f;
FOV = 60.0f;
Source = Multiply3x3(CamTargetEntity->GetMatrix(), CamPos);
@ -2833,7 +2860,7 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
CVector Fwd = CamTargetEntity->GetForward();
Fwd.z = 0.0f;
Fwd.Normalise();
HeadPos = (HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition());
HeadPos = HeadDelta*1.23f*Fwd + CamTargetEntity->GetPosition();
HeadPos.z += 0.59f;
}
Source = HeadPos;
@ -2861,13 +2888,13 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@ -2911,13 +2938,8 @@ CCam::Process_1rstPersonPedOnPC(const CVector&, float TargetOrientation, float,
void
CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float, float)
{
if(CamTargetEntity->m_rwObject == nil)
return;
#ifdef FIX_BUGS
if(!CamTargetEntity->IsPed())
return;
#endif
static bool FailedTestTwelveFramesAgo = false;
RwV3d HeadPos;
@ -2927,9 +2949,9 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
static float TargetFOV = 0.0f;
if(ResetStatics){
Beta = TargetOrientation;
Beta = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI;
Alpha = 0.0f;
m_fInitialPlayerOrientation = TargetOrientation;
m_fInitialPlayerOrientation = ((CPed*)CamTargetEntity)->m_fRotationCur + HALFPI;
FailedTestTwelveFramesAgo = false;
// static DPadVertical unused
// static DPadHorizontal unused
@ -2964,13 +2986,13 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
}else{
float xdir = LookLeftRight < 0.0f ? -1.0f : 1.0f;
float ydir = LookUpDown < 0.0f ? -1.0f : 1.0f;
Beta += SQR(LookLeftRight/100.0f)*xdir/17.5 * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Beta += SQR(LookLeftRight/100.0f)*xdir*0.8f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
Alpha += SQR(LookUpDown/150.0f)*ydir*1.0f/14.0f * FOV/80.0f * CTimer::GetTimeStep();
}
while(Beta >= PI) Beta -= 2*PI;
while(Beta < -PI) Beta += 2*PI;
if(Alpha > DEGTORAD(60.0f)) Alpha = DEGTORAD(60.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
TargetCoors.x = 3.0f * Cos(Alpha) * Cos(Beta) + Source.x;
TargetCoors.y = 3.0f * Cos(Alpha) * Sin(Beta) + Source.y;
@ -3175,6 +3197,12 @@ CCam::Process_Syphon_Crim_In_Front(const CVector &CameraTarget, float, float, fl
while(AimingAngle >= PI) AimingAngle -= 2*PI;
while(AimingAngle < -PI) AimingAngle += 2*PI;
if(ResetStatics){
if(AimingAngle > 0.0f)
m_fPlayerInFrontSyphonAngleOffSet = -m_fPlayerInFrontSyphonAngleOffSet;
ResetStatics = false;
}
if(TheCamera.PlayerWeaponMode.Mode == MODE_SYPHON)
Beta = AimingAngle + m_fPlayerInFrontSyphonAngleOffSet;
@ -3569,8 +3597,7 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
CVector Left = CrossProduct(Up, Front);
Up = CrossProduct(Front, Left);
Up.Normalise();
FOV = PsuedoFOV;
}else{
}else if(uiTime >= uiFinishTime){
// end
ArrayMarkerSource = (TheCamera.m_arrPathArray[2].m_arr_PathData[0] - 1)*10 + 1;
ArrayMarkerFront = (TheCamera.m_arrPathArray[3].m_arr_PathData[0] - 1)*10 + 1;
@ -3597,8 +3624,8 @@ CCam::Process_FlyBy(const CVector&, float, float, float)
CVector Left = CrossProduct(Up, Front);
Up = CrossProduct(Front, Left);
Up.Normalise();
FOV = PsuedoFOV;
}
FOV = PsuedoFOV;
}
void
@ -3618,12 +3645,13 @@ CCam::Process_WheelCam(const CVector&, float, float, float)
}
CVector NewUp(0.0f, 0.0f, 1.0f);
CVector Left = CrossProduct(Front, NewUp);
Left.Normalise();
NewUp = CrossProduct(Left, Front);
CVector Right = CrossProduct(Front, NewUp);
Right.Normalise();
NewUp = CrossProduct(Right, Front);
NewUp.Normalise();
float Roll = Cos((CTimer::GetTimeInMilliseconds()&0x1FFFF)/(float)0x1FFFF * TWOPI);
Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Left;
Up = Cos(Roll*0.4f)*NewUp + Sin(Roll*0.4f)*Right;
}
void
@ -3733,18 +3761,18 @@ CCam::Process_Debug(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
if(CPad::GetPad(0)->GetLeftMouse()){
Alpha += DEGTORAD(CPad::GetPad(0)->GetMouseY()/2.0f);
Beta -= DEGTORAD(CPad::GetPad(0)->GetMouseX()/2.0f);
Beta += DEGTORAD(CPad::GetPad(0)->GetMouseX()/2.0f);
}
TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 3.0f;
TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 3.0f;
TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 3.0f;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || KEYDOWN('W'))
Speed += 0.1f;
@ -3806,7 +3834,11 @@ CCam::Process_Debug(const CVector&, float, float, float)
Source.y += 1.0f;
GetVectorsReadyForRW();
CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_DISABLED_1;
#ifdef FIX_BUGS
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA);
#else
CPad::GetPad(0)->DisablePlayerControls = PLAYERCONTROL_CAMERA;
#endif
if(CPad::GetPad(1)->GetLeftShockJustDown() && gbBigWhiteDebugLightSwitchedOn)
CShadows::StoreShadowToBeRendered(SHADOWTYPE_ADDITIVE, gpShadowExplosionTex, &Source,
@ -3830,14 +3862,14 @@ CCam::Process_Debug(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 3.0f;
TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 3.0f;
TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 3.0f;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
Speed += 0.1f;
@ -3859,8 +3891,7 @@ CCam::Process_Debug(const CVector&, float, float, float)
if(FindPlayerVehicle())
FindPlayerVehicle()->Teleport(Source);
else
CWorld::Players[CWorld::PlayerInFocus].m_pPed->GetPosition() = Source;
CWorld::Players[CWorld::PlayerInFocus].m_pPed->SetPosition(Source);
}
// stay inside sectors
@ -3903,13 +3934,13 @@ CCam::Process_Editor(const CVector&, float, float, float)
RwCameraSetNearClipPlane(Scene.camera, DEFAULT_NEAR);
FOV = DefaultFOV;
Alpha += DEGTORAD(CPad::GetPad(1)->GetLeftStickY()) / 50.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX())*1.5f / 19.0f;
Beta += DEGTORAD(CPad::GetPad(1)->GetLeftStickX()*1.5f) / 19.0f;
if(CamTargetEntity && CSceneEdit::m_bCameraFollowActor){
TargetCoors = CamTargetEntity->GetPosition();
}else if(CSceneEdit::m_bRecording){
TargetCoors.x = Source.x + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.y = Source.y + Cos(Alpha) * Sin(Beta) * 7.0f;
TargetCoors.x = Source.x + Cos(Alpha) * Sin(Beta) * 7.0f;
TargetCoors.y = Source.y + Cos(Alpha) * Cos(Beta) * 7.0f;
TargetCoors.z = Source.z + Sin(Alpha) * 7.0f;
}else
TargetCoors = CSceneEdit::m_vecCamHeading + Source;
@ -3917,7 +3948,7 @@ CCam::Process_Editor(const CVector&, float, float, float)
CSceneEdit::m_vecCamHeading = TargetCoors - Source;
if(Alpha > DEGTORAD(89.5f)) Alpha = DEGTORAD(89.5f);
if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
else if(Alpha < DEGTORAD(-89.5f)) Alpha = DEGTORAD(-89.5f);
if(CPad::GetPad(1)->GetSquare() || CPad::GetPad(1)->GetLeftMouse())
Speed += 0.1f;
@ -4048,11 +4079,11 @@ bool
CCam::ProcessArrestCamOne(void)
{
FOV = 45.0f;
if(ResetStatics)
if(!ResetStatics)
return true;
#ifdef FIX_BUGS
if(!CamTargetEntity->IsPed())
if(!CamTargetEntity->IsPed() || ((CPlayerPed*)TheCamera.pTargetEntity)->m_pArrestingCop == nil)
return true;
#endif
@ -4107,18 +4138,18 @@ CCam::ProcessArrestCamTwo(void)
CVector TargetCoors, ToCamera;
float BetaOffset;
float SourceX, SourceY;
CCam *ActiveCam = &TheCamera.Cams[TheCamera.ActiveCam];
if(&ActiveCam[1] == this){
if(&TheCamera.Cams[TheCamera.ActiveCam] == this){
SourceX = TheCamera.Cams[(TheCamera.ActiveCam + 1) % 2].Source.x;
SourceY = TheCamera.Cams[(TheCamera.ActiveCam + 1) % 2].Source.y;
}else{
SourceX = ActiveCam[1].Source.x;
SourceY = ActiveCam[1].Source.y;
SourceX = TheCamera.Cams[TheCamera.ActiveCam].Source.x;
SourceY = TheCamera.Cams[TheCamera.ActiveCam].Source.y;
}
for(int i = 0; i <= 1; i++){
int Dir = i == 0 ? 1 : -1;
FOV = 60.0f;
TargetCoors = player->GetPosition();
Beta = CGeneral::GetATanOfXY(TargetCoors.x-SourceX, TargetCoors.y-SourceY);
BetaOffset = DEGTORAD(Dir*80);
@ -4412,6 +4443,106 @@ CCam::Process_FollowPed_WithBinding(const CVector &CameraTarget, float TargetOri
GetVectorsReadyForRW();
}
void
CCam::Process_Bill(const CVector &CameraTarget, float TargetOrientation, float SpeedVar, float TargetSpeedVar)
{
#ifdef FIX_BUGS
fBillsBetaOffset += CPad::GetPad(0)->GetRightStickX()/1000.0f;
#else
// just wtf is this? this code must be ancient
if(CPad::GetPad(0)->GetStart())
fBillsBetaOffset += CPad::GetPad(0)->GetLeftStickX()/1000.0f;
#endif
while(fBillsBetaOffset > TWOPI) fBillsBetaOffset -= TWOPI;
while(fBillsBetaOffset < 0.0f) fBillsBetaOffset += TWOPI;
TargetOrientation += fBillsBetaOffset;
while(TargetOrientation > TWOPI) TargetOrientation -= TWOPI;
while(TargetOrientation < 0.0f) TargetOrientation += TWOPI;
Process_BehindCar(CameraTarget, TargetOrientation, SpeedVar, TargetSpeedVar);
}
void
CCam::Process_Im_The_Passenger_Woo_Woo(const CVector &CameraTarget, float TargetOrientation, float, float)
{
FOV = 50.0f;
Source = CamTargetEntity->GetPosition();
Source.z += 2.5f;
Front = CamTargetEntity->GetForward();
Front.Normalise();
Source += 1.35f*Front;
float heading = CGeneral::GetATanOfXY(Front.x, Front.y) + DEGTORAD(45.0f);
Front.x = Cos(heading);
Front.y = Sin(heading);
Up = CamTargetEntity->GetUp();
GetVectorsReadyForRW();
}
void
CCam::Process_Blood_On_The_Tracks(const CVector &CameraTarget, float TargetOrientation, float, float)
{
FOV = 50.0f;
Source = CamTargetEntity->GetPosition();
Source.z += 5.45f;
static CVector Test = -CamTargetEntity->GetForward();
#ifdef FIX_BUGS
if(ResetStatics){
Test = -CamTargetEntity->GetForward();
ResetStatics = false;
}
#endif
Source.x += 19.45*Test.x;
Source.y += 19.45*Test.y;
Front = Test;
Front.Normalise();
Up = CamTargetEntity->GetUp();
GetVectorsReadyForRW();
}
void
CCam::Process_Cam_Running_Side_Train(const CVector &CameraTarget, float TargetOrientation, float, float)
{
FOV = 60.0f;
Source = CamTargetEntity->GetPosition();
Source.z += 4.0f;
CVector fwd = CamTargetEntity->GetForward();
float heading = CGeneral::GetATanOfXY(fwd.x, fwd.y) - DEGTORAD(15.0f);
Source.x -= Cos(heading)*10.0f;
Source.y -= Sin(heading)*10.0f;
heading -= DEGTORAD(5.0f);
Front = fwd;
Front.x += Cos(heading);
Front.y += Sin(heading);
Front.z -= 0.056f;
Front.Normalise();
Up = CamTargetEntity->GetUp();
GetVectorsReadyForRW();
}
void
CCam::Process_Cam_On_Train_Roof(const CVector &CameraTarget, float TargetOrientation, float, float)
{
static float RoofMultiplier = 1.5f;
Source = CamTargetEntity->GetPosition();
Source.z += 4.8f;
Front = CamTargetEntity->GetForward();
Front.Normalise();
Source += Front*RoofMultiplier;
Up = CamTargetEntity->GetUp();
Up.Normalise();
GetVectorsReadyForRW();
}
#ifdef FREE_CAM
void
CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrientation, float, float)
@ -4494,8 +4625,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
BetaOffset = LookLeftRight * TheCamera.m_fMouseAccelHorzntl * FOV/80.0f;
AlphaOffset = LookUpDown * TheCamera.m_fMouseAccelVertical * FOV/80.0f;
}else{
BetaOffset = LookLeftRight * fStickSens * (0.5f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.3f/10.0f) * FOV/80.0f * CTimer::GetTimeStep();
BetaOffset = LookLeftRight * fStickSens * (1.0f/20.0f) * FOV/80.0f * CTimer::GetTimeStep();
AlphaOffset = LookUpDown * fStickSens * (0.6f/20.0f) * FOV/80.0f * CTimer::GetTimeStep();
}
// Stop centering once stick has been touched
@ -4507,7 +4638,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
while(Beta >= PI) Beta -= 2.0f*PI;
while(Beta < -PI) Beta += 2.0f*PI;
if(Alpha > DEGTORAD(45.0f)) Alpha = DEGTORAD(45.0f);
if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
else if(Alpha < -DEGTORAD(89.5f)) Alpha = -DEGTORAD(89.5f);
float BetaDiff = TargetOrientation+PI - Beta;
@ -4567,7 +4698,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
if(CWorld::ProcessLineOfSight(TargetCoors, Source, colPoint, entity, true, true, true, true, false, false, true)){
float PedColDist = (TargetCoors - colPoint.point).Magnitude();
float ColCamDist = CamDist - PedColDist;
if(entity->IsPed() && ColCamDist > 1.0f){
if(entity->IsPed() && ColCamDist > DEFAULT_NEAR + 0.1f){
// Ped in the way but not clipping through
if(CWorld::ProcessLineOfSight(colPoint.point, Source, colPoint, entity, true, true, true, true, false, false, true)){
PedColDist = (TargetCoors - colPoint.point).Magnitude();
@ -4606,6 +4737,8 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
Source += (TargetCoors - Source)*0.3f;
// Keep testing
Near = RwCameraGetNearClipPlane(Scene.camera);
radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
i++;

View File

@ -123,7 +123,7 @@ CCamera::Init(void)
Cams[0].Mode = CCam::MODE_FOLLOWPED;
Cams[1].Mode = CCam::MODE_FOLLOWPED;
unknown = 0;
m_bJustJumpedOutOf1stPersonBecauseOfTarget = 0;
m_bJustJumpedOutOf1stPersonBecauseOfTarget = false;
ClearPlayerWeaponMode();
m_bInATunnelAndABigVehicle = false;
m_iModeObbeCamIsInForCar = OBBE_INVALID;
@ -141,8 +141,8 @@ CCamera::Init(void)
Cams[1].m_fPlayerVelocity = 0.0f;
Cams[2].m_fPlayerVelocity = 0.0f;
m_bHeadBob = false;
m_fFractionInterToStopMovingTarget = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f;
m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUp = 0.75f;
m_fGaitSwayBuffer = 0.85f;
m_bScriptParametersSetForInterPol = false;
m_uiCamShakeStart = 0;
@ -249,13 +249,14 @@ void
CCamera::Process(void)
{
// static bool InterpolatorNotInitialised = true; // unused
static CVector PreviousFudgedTargetCoors; // only 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 oldBeta, newBeta;
float deltaBeta = 0.0f;
bool lookLRBVehicle = false;
CVector CamFront, CamUp, CamSource, Target;
CVector CamFront, CamUp, CamRight, CamSource, Target;
m_bJust_Switched = false;
m_RealPreviousCameraPosition = GetPosition();
@ -308,19 +309,19 @@ CCamera::Process(void)
// Stop transition when it's done
if(m_uiTransitionState != 0){
/*
// PS2:
#ifdef PS2_CAM_TRANSITION
if(!m_bWaitForInterpolToFinish){
Cams[(ActiveCam+1)%2].Process();
Cams[(ActiveCam+1)%2].ProcessSpecialHeightRoutines();
}
*/
// not PS2 (done in CamControl there it seems)
#else
// done in CamControl on PS2 it seems
if(CTimer::GetTimeInMilliseconds() > m_uiTransitionDuration+m_uiTimeTransitionStart){
m_uiTransitionState = 0;
m_vecDoingSpecialInterPolation = false;
m_bWaitForInterpolToFinish = false;
}
#endif
}
if(m_bUseNearClipScript)
@ -343,19 +344,165 @@ CCamera::Process(void)
if(m_uiTransitionState != 0 && !lookLRBVehicle){
// 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;
if(currentTime >= m_uiTransitionDuration)
currentTime = m_uiTransitionDuration;
float fractionInter = (float) currentTime / m_uiTransitionDuration;
if(fractionInter <= m_fFractionInterToStopMovingTarget){
if(fractionInter <= m_fFractionInterToStopMoving){
float inter;
if(m_fFractionInterToStopMovingTarget == 0.0f)
if(m_fFractionInterToStopMoving == 0.0f)
inter = 0.0f;
else
inter = (m_fFractionInterToStopMovingTarget - fractionInter)/m_fFractionInterToStopMovingTarget;
inter = (m_fFractionInterToStopMoving - fractionInter)/m_fFractionInterToStopMoving;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
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){
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{
CamFront.Normalise();
CamUp.Normalise();
CVector right = CrossProduct(CamFront, CamUp);
right.Normalise();
CamUp = CrossProduct(right, CamFront);
}
CamRight = CrossProduct(CamFront, CamUp);
CamRight.Normalise();
CamUp = CrossProduct(CamRight, CamFront);
CamUp.Normalise();
}
FOV = m_fFOVWhenInterPol;
}else if(fractionInter > m_fFractionInterToStopMovingTarget && fractionInter <= 1.0f){
}else if(fractionInter > m_fFractionInterToStopMoving && fractionInter <= 1.0f){
float inter;
if(m_fFractionInterToStopCatchUpTarget == 0.0f)
if(m_fFractionInterToStopCatchUp == 0.0f)
inter = 0.0f;
else
inter = (fractionInter - m_fFractionInterToStopMovingTarget)/m_fFractionInterToStopCatchUpTarget;
inter = (fractionInter - m_fFractionInterToStopMoving)/m_fFractionInterToStopCatchUp;
inter = 0.5f - 0.5*Cos(inter*PI); // smooth it
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){
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{
CamFront.Normalise();
CamUp.Normalise();
CVector right = CrossProduct(CamFront, CamUp);
right.Normalise();
CamUp = CrossProduct(right, CamFront);
}
CamRight = CrossProduct(CamFront, CamUp);
CamRight.Normalise();
CamUp = CrossProduct(CamRight, CamFront);
CamUp.Normalise();
}
#ifndef FIX_BUGS
// BUG: FOV was already interpolated but m_fFOVWhenInterPol was not
FOV = m_fFOVWhenInterPol;
@ -474,6 +625,7 @@ CCamera::Process(void)
float Alpha = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
float Beta = CGeneral::GetATanOfXY(Dist.x, Dist.y);
Cams[ActiveCam].KeepTrackOfTheSpeed(CamSource, Target, CamUp, Alpha, Beta, FOV);
#endif
}else{
// No transition, take Cam values directly
if(WorldViewerBeingUsed){
@ -487,7 +639,7 @@ CCamera::Process(void)
CamUp = Cams[ActiveCam].Up;
FOV = Cams[ActiveCam].FOV;
}
WasPreviouslyInterSyhonFollowPed = false; // unused
WasPreviouslyInterSyhonFollowPed = false; // only used on PS2
}
if(m_uiTransitionState != 0)
@ -567,8 +719,10 @@ CCamera::Process(void)
LODDistMultiplier = 70.0f/CDraw::GetFOV() * CDraw::GetAspectRatio()/(4.0f/3.0f);
else
LODDistMultiplier = 1.0f;
// missing on PS2
GenerationDistMultiplier = LODDistMultiplier;
LODDistMultiplier *= CRenderer::ms_lodDistScale;
//
// Keep track of speed
if(m_bJustInitalised || m_bJust_Switched){
@ -584,7 +738,7 @@ CCamera::Process(void)
}
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){
Cams[ActiveCam].Source = Cams[ActiveCam].SourceBeforeLookBehind;
@ -630,6 +784,16 @@ CCamera::CamControl(void)
if(Cams[ActiveCam].CamTargetEntity == nil && pTargetEntity == nil)
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++;
if(m_iZoneCullFrameNumWereAt > m_iCheckCullZoneThisNumFrames)
m_iZoneCullFrameNumWereAt = 1;
@ -638,7 +802,7 @@ CCamera::CamControl(void)
m_bFailedCullZoneTestPreviously = CCullZones::CamCloseInForPlayer();
if(m_bLookingAtPlayer){
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_1;
CPad::GetPad(0)->SetEnablePlayerControls(PLAYERCONTROL_CAMERA);
FindPlayerPed()->bIsVisible = true;
}
@ -906,7 +1070,7 @@ CCamera::CamControl(void)
m_bFirstPersonBeingUsed = false;
if(m_bFirstPersonBeingUsed){
ReqMode = CCam::MODE_1STPERSON;
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_1;
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_CAMERA);
}
// Zoom value
@ -1015,7 +1179,7 @@ CCamera::CamControl(void)
garageCenter.y = (az->miny + az->maxy)/2.0f;
garageCenter.z = 0.0f;
}else
garageCenter = pTargetEntity->GetPosition();
garageCenter = CVector(pTargetEntity->GetPosition().x, pTargetEntity->GetPosition().y, 0.0f);
}
if(whichDoor == 1)
garageCenterToDoor = garageDoorPos1 - garageCenter;
@ -1223,6 +1387,7 @@ CCamera::CamControl(void)
// Restore with a jump cut
if(m_bRestoreByJumpCut){
// PS2 just sets m_bCamDirectlyBehind here
if(ReqMode != CCam::MODE_FOLLOWPED &&
ReqMode != CCam::MODE_M16_1STPERSON &&
ReqMode != CCam::MODE_SNIPER &&
@ -1238,6 +1403,7 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity = pTargetEntity;
Cams[ActiveCam].m_cvecCamFixedModeSource = m_vecFixedModeSource;
Cams[ActiveCam].m_cvecCamFixedModeUpOffSet = m_vecFixedModeUpOffSet;
// PS2 sets this to m_bLookingAtVector
Cams[ActiveCam].m_bCamLookingAtVector = false;
Cams[ActiveCam].m_vecLastAboveWaterCamPosition = Cams[(ActiveCam+1)%2].m_vecLastAboveWaterCamPosition;
m_bRestoreByJumpCut = false;
@ -1376,7 +1542,7 @@ CCamera::CamControl(void)
switchByJumpCut = true;
if(Cams[ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED){
CVector front = Cams[ActiveCam].Source - FindPlayerPed()->GetPosition();
front.z = 0.0f;
front.z = 0.0f; // missing on PS2
front.Normalise();
#ifdef FIX_BUGS
// 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(switchByJumpCut){
// PS2 just sets m_bCamDirectlyBehind here
if(!m_bPlayerIsInGarage || m_bJustCameOutOfGarage){
if(ReqMode != CCam::MODE_FOLLOWPED &&
ReqMode != CCam::MODE_M16_1STPERSON &&
@ -1451,6 +1618,8 @@ CCamera::CamControl(void)
if(ReqMode == CCam::MODE_FOLLOWPED && Cams[ActiveCam].Mode == CCam::MODE_FIGHT_CAM)
startTransition = false;
#ifndef PS2_CAM_TRANSITION
// done in Process on PS2
if(!m_bWaitForInterpolToFinish && m_bLookingAtPlayer && m_uiTransitionState != 0){
CVector playerDist;
playerDist.x = FindPlayerPed()->GetPosition().x - GetPosition().x;
@ -1463,6 +1632,7 @@ CCamera::CamControl(void)
m_bWaitForInterpolToFinish = true;
}
}
#endif
if(m_bWaitForInterpolToFinish)
startTransition = false;
@ -1472,10 +1642,14 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity);
}
}else if(ReqMode == CCam::MODE_FIXED && pTargetEntity != Cams[ActiveCam].CamTargetEntity && m_bPlayerIsInGarage){
#ifdef PS2_CAM_TRANSITION
StartTransitionWhenNotFinishedInter(ReqMode);
#else
if(m_uiTransitionState != 0)
StartTransitionWhenNotFinishedInter(ReqMode);
else
StartTransition(ReqMode);
#endif
pTargetEntity->RegisterReference(&pTargetEntity);
Cams[ActiveCam].CamTargetEntity->RegisterReference(&Cams[ActiveCam].CamTargetEntity);
}
@ -1599,7 +1773,7 @@ CCamera::UpdateTargetEntity(void)
pTargetEntity = FindPlayerPed();
if(PLAYER->GetPedState() == PED_DRAG_FROM_CAR)
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();
}
}
@ -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.
*/
void
CCamera::StartTransition(int16 newMode)
{
bool foo = false;
bool switchSyphonMode = false;
bool switchPedToCar = false;
bool switchPedMode = false;
bool switchFromFight = false;
bool switchFromFixed = false;
bool switch1stPersonToVehicle = false;
float betaOffset, targetBeta, camBeta, deltaBeta;
int door;
bool vehicleVertical;
// missing on PS2
#ifndef PS2_CAM_TRANSITION
m_bItsOkToLookJustAtThePlayer = false;
m_fFractionInterToStopMovingTarget = 0.25f;
m_fFractionInterToStopCatchUpTarget = 0.75f;
m_fFractionInterToStopMoving = 0.25f;
m_fFractionInterToStopCatchUp = 0.75f;
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED ||
@ -1894,14 +2067,16 @@ CCamera::StartTransition(int16 newMode)
if(newMode == CCam::MODE_CAM_ON_A_STRING)
switchPedToCar = true;
}
//
#endif
if(Cams[ActiveCam].Mode == CCam::MODE_SYPHON_CRIM_IN_FRONT && newMode == CCam::MODE_SYPHON)
switchSyphonMode = true;
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)
switchFromFixed = true;
#endif
m_bUseTransitionBeta = false;
@ -1920,11 +2095,11 @@ CCamera::StartTransition(int16 newMode)
((CPed*)pTargetEntity)->m_fRotationDest = angle;
}
/* // PS2
#ifdef PS2_CAM_TRANSITION
ActiveCam = (ActiveCam+1)%2;
Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode;
*/
#endif
Cams[ActiveCam].m_cvecCamFixedModeVector = m_vecFixedModeVector;
Cams[ActiveCam].CamTargetEntity = pTargetEntity;
@ -1955,12 +2130,27 @@ CCamera::StartTransition(int16 newMode)
switch(newMode){
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;
break;
case CCam::MODE_FOLLOWPED:
// Getting out of vehicle normally
betaOffset = DEGTORAD(55.0f);
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
#endif
if(m_bJustCameOutOfGarage){
m_bUseTransitionBeta = true;
/*
@ -1974,13 +2164,21 @@ CCamera::StartTransition(int16 newMode)
*/
// this is better:
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;
#endif
else
Cams[ActiveCam].m_fTransitionBeta = 0.0f;
}
if(m_bTargetJustCameOffTrain)
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)
#endif
break;
m_bUseTransitionBeta = true;
vehicleVertical = false;
@ -1992,7 +2190,11 @@ CCamera::StartTransition(int16 newMode)
Cams[ActiveCam].m_fTransitionBeta = 0.0f;
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);
#endif
if(((CPed*)pTargetEntity)->m_carInObjective)
targetBeta = CGeneral::GetATanOfXY(((CPed*)pTargetEntity)->m_carInObjective->GetForward().x, ((CPed*)pTargetEntity)->m_carInObjective->GetForward().y);
else
@ -2048,6 +2250,10 @@ CCamera::StartTransition(int16 newMode)
break;
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].AlphaSpeed = 0.0f;
break;
@ -2055,20 +2261,29 @@ CCamera::StartTransition(int16 newMode)
case CCam::MODE_CAM_ON_A_STRING:
// Get into vehicle
betaOffset = DEGTORAD(57.0f);
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
#endif
if(!m_bLookingAtPlayer || m_bJustCameOutOfGarage)
break;
m_bUseTransitionBeta = true;
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);
#endif
deltaBeta = targetBeta - camBeta;
while(deltaBeta >= PI) deltaBeta -= 2*PI;
while(deltaBeta < -PI) deltaBeta += 2*PI;
deltaBeta = Abs(deltaBeta);
// switchFromFixed logic again here, skipped
#ifndef PS2_CAM_TRANSITION
switchFromFixed = Cams[ActiveCam].Mode == CCam::MODE_FIXED;
if(switchFromFixed){
Cams[ActiveCam].m_fTransitionBeta = CGeneral::GetATanOfXY(Cams[ActiveCam].Front.x, Cams[ActiveCam].Front.y);
break;
}
#endif
door = FindPlayerPed()->m_vehEnterType;
if(deltaBeta > HALFPI){
@ -2096,15 +2311,23 @@ CCamera::StartTransition(int16 newMode)
}
break;
case CCam::MODE_BEHINDBOAT:
Cams[ActiveCam].BetaSpeed = 0.0f;
break;
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);
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:
#ifdef PS2_CAM_TRANSITION
Cams[ActiveCam].Source = Cams[(ActiveCam+1)%2].Source;
#endif
Cams[ActiveCam].Beta = 0.0f;
Cams[ActiveCam].BetaSpeed = 0.0f;
Cams[ActiveCam].Alpha = 0.0f;
@ -2112,33 +2335,40 @@ CCamera::StartTransition(int16 newMode)
break;
}
#ifndef PS2_CAM_TRANSITION
Cams[ActiveCam].Init();
Cams[ActiveCam].Mode = newMode;
m_uiTransitionDuration = 1350;
if(switchSyphonMode)
m_uiTransitionDuration = 1800;
else if(switchPedMode)
else if(switchFromFight)
m_uiTransitionDuration = 750;
// not on PS2
else if(switchPedToCar){
m_fFractionInterToStopMovingTarget = 0.2f;
m_fFractionInterToStopCatchUpTarget = 0.8f;
m_fFractionInterToStopMoving = 0.2f;
m_fFractionInterToStopCatchUp = 0.8f;
m_uiTransitionDuration = 950;
}else if(switchFromFixed){
m_fFractionInterToStopMovingTarget = 0.05f;
m_fFractionInterToStopCatchUpTarget = 0.95f;
m_fFractionInterToStopMoving = 0.05f;
m_fFractionInterToStopCatchUp = 0.95f;
}else if(switch1stPersonToVehicle){
m_fFractionInterToStopMovingTarget = 0.0f;
m_fFractionInterToStopCatchUpTarget = 1.0f;
m_fFractionInterToStopMoving = 0.0f;
m_fFractionInterToStopCatchUp = 1.0f;
m_uiTransitionDuration = 1;
}else
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_uiTimeTransitionStart = CTimer::GetTimeInMilliseconds();
m_uiTransitionJUSTStarted = 1;
// PS2 returns here
#ifndef PS2_CAM_TRANSITION
if(m_vecDoingSpecialInterPolation){
m_cvecStartingSourceForInterPol = SourceDuringInter;
m_cvecStartingTargetForInterPol = TargetDuringInter;
@ -2170,19 +2400,27 @@ CCamera::StartTransition(int16 newMode)
m_fFOVSpeedAtStartInter = Cams[ActiveCam].m_fFovSpeedOverOneFrame;
Cams[ActiveCam].ResetStatics = true;
if(!m_bLookingAtPlayer && m_bScriptParametersSetForInterPol){
m_fFractionInterToStopMovingTarget = m_fScriptPercentageInterToStopMoving;
m_fFractionInterToStopCatchUpTarget = m_fScriptPercentageInterToCatchUp;
m_fFractionInterToStopMoving = m_fScriptPercentageInterToStopMoving;
m_fFractionInterToStopCatchUp = m_fScriptPercentageInterToCatchUp;
m_uiTransitionDuration = m_fScriptTimeForInterPolation;
}
#endif
}
void
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;
StartTransition(mode);
}
#ifndef PS2_CAM_TRANSITION
void
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_fAlphaDuringInterPol = CGeneral::GetATanOfXY(DistOnGround, Dist.z);
}
#endif
void
@ -2265,25 +2503,22 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
switch(obbeMode){
case OBBE_WHEEL:
veh = FindPlayerVehicle();
if(veh == nil){
if(CTimer::GetTimeInMilliseconds() > t+5000)
return true;
SetNearClipScript(0.6f);
return false;
}
if(veh){
if(veh->IsBoat() || veh->GetModelIndex() == MI_RHINO)
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))
return true;
}
if(CTimer::GetTimeInMilliseconds() > t+5000)
return true;
SetNearClipScript(0.6f);
return false;
}
return true;
case OBBE_1:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
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))
return true;
fwd = FindPlayerCoors() - m_vecFixedModeSource;
fwd.z = 0.0f;
@ -2294,12 +2529,12 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
if(fwd.Magnitude() < 1.6f)
return true;
return false;
}
return true;
case OBBE_2:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
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))
return true;
fwd = FindPlayerCoors() - m_vecFixedModeSource;
fwd.z = 0.0f;
@ -2313,10 +2548,10 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
if(fwd.Magnitude() < 1.6f)
return true;
return false;
}
return true;
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))
return true;
fwd = FindPlayerCoors() - m_vecFixedModeSource;
fwd.z = 0.0f;
@ -2324,14 +2559,14 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true;
return false;
}
return true;
case OBBE_1STPERSON:
return CTimer::GetTimeInMilliseconds() > t+3000;
case OBBE_5:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
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))
return true;
fwd = FindPlayerCoors() - m_vecFixedModeSource;
fwd.z = 0.0f;
@ -2339,8 +2574,6 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
if(fwd.Magnitude() > 28.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true;
return false;
}
return true;
case OBBE_ONSTRING:
return CTimer::GetTimeInMilliseconds() > t+3000;
case OBBE_COPCAR:
@ -2348,17 +2581,18 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
case OBBE_COPCAR_WHEEL:
if(FindPlayerVehicle() && FindPlayerVehicle()->IsBoat())
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))
return true;
if(CTimer::GetTimeInMilliseconds() > t+1000)
return true;
SetNearClipScript(0.6f);
return false;
}
return true;
// Ped modes
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))
return true;
fwd = FindPlayerCoors() - m_vecFixedModeSource;
fwd.z = 0.0f;
@ -2366,10 +2600,10 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
if(fwd.Magnitude() > 20.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true;
return false;
}
return true;
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))
return true;
fwd = FindPlayerCoors() - m_vecFixedModeSource;
fwd.z = 0.0f;
@ -2377,10 +2611,10 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true;
return false;
}
return true;
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))
return true;
fwd = FindPlayerCoors() - m_vecFixedModeSource;
fwd.z = 0.0f;
@ -2388,10 +2622,10 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
if(fwd.Magnitude() > 25.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true;
return false;
}
return true;
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))
return true;
fwd = FindPlayerCoors() - m_vecFixedModeSource;
fwd.z = 0.0f;
@ -2399,8 +2633,6 @@ CCamera::IsItTimeForNewcam(int32 obbeMode, int32 time)
if(fwd.Magnitude() > 8.0f && DotProduct(FindPlayerSpeed(), fwd) > 0.0f)
return true;
return false;
}
return true;
case OBBE_13:
return CTimer::GetTimeInMilliseconds() > t+5000;
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_2, OBBE_3, OBBE_COPCAR_WHEEL, OBBE_COPCAR, OBBE_2, OBBE_3,
OBBE_5, OBBE_3,
@ -2711,7 +2943,7 @@ CCamera::ProcessObbeCinemaCameraCar(void)
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
CCamera::ProcessObbeCinemaCameraPed(void)
@ -2890,6 +3122,13 @@ CCamera::Process_Train_Camera_Control(void)
if(node >= m_uiNumberOfTrainCamNodes)
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){
SetWideScreenOn();
@ -3243,7 +3482,7 @@ CCamera::GetLookDirection(void)
Cams[ActiveCam].Mode == CCam::MODE_BEHINDBOAT ||
Cams[ActiveCam].Mode == CCam::MODE_FOLLOWPED)
return Cams[ActiveCam].DirectionWasLooking;
return LOOKING_FORWARD;;
return LOOKING_FORWARD;
}
bool
@ -3301,12 +3540,13 @@ CCamera::UpdateAimingCoors(CVector const &coors)
m_cvecAimingTargetCoors = coors;
}
void
bool
CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target)
{
if(CPad::GetPad(0)->GetLookBehindForPed()){
source = pos;
target = dist*Cams[ActiveCam].CamTargetEntity->GetForward() + source;
return false;
}else{
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);
@ -3315,9 +3555,9 @@ CCamera::Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source,
target += Cams[ActiveCam].Up * Tan(angleY);
target += CrossProduct(Cams[ActiveCam].Front, Cams[ActiveCam].Up) * Tan(angleX);
target.Normalise();
float dot = DotProduct(pos - source, target);
source += dot*target;
source += DotProduct(pos - source, target)*target;
target = dist*target + source;
return true;
}
}
@ -3346,7 +3586,7 @@ CCamera::CalculateDerivedValues(void)
{
m_cameraMatrix = Invert(m_matrix);
float hfov = DEGTORAD(CDraw::GetFOV()/2.0f);
float hfov = DEGTORAD(CDraw::GetScaledFOV()/2.0f);
float c = cos(hfov);
float s = sin(hfov);

View File

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

View File

@ -548,18 +548,18 @@ CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColMod
return false;
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]))
return true;
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]))
return true;
CalculateTrianglePlanes(&model);
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]))
return true;
@ -1179,16 +1179,16 @@ CCollision::ProcessLineOfSight(const CColLine &line,
float coldist = mindist;
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);
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);
CalculateTrianglePlanes(&model);
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);
if(coldist < mindist){
@ -1219,17 +1219,17 @@ CCollision::ProcessVerticalLine(const CColLine &line,
float coldist = mindist;
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);
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);
CalculateTrianglePlanes(&model);
TempStoredPoly.valid = false;
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);
if(coldist < mindist){
@ -1758,15 +1758,15 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
b *= f;
}
if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE ||
s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE)
if(CTimer::GetFrameCounter() & 1){
r = 0;
g = 0;
b = 0;
}
if(s > SURFACE_GATE){
if(s > SURFACE_METAL_GATE){
r = CGeneral::GetRandomNumber();
g = CGeneral::GetRandomNumber();
b = CGeneral::GetRandomNumber();
@ -1839,8 +1839,8 @@ CCollision::DrawColModel_Coloured(const CMatrix &mat, const CColModel &colModel,
b *= f;
}
if(s == SURFACE_SCAFFOLD || s == SURFACE_METAL_FENCE ||
s == SURFACE_BOLLARD || s == SURFACE_METAL_POLE)
if(s == SURFACE_TRANSPARENT_CLOTH || s == SURFACE_METAL_CHAIN_FENCE ||
s == SURFACE_TRANSPARENT_STONE || s == SURFACE_SCAFFOLD_POLE)
if(CTimer::GetFrameCounter() & 1){
r = 0;
g = 0;

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -86,8 +86,7 @@
#include "ZoneCull.h"
#include "Zones.h"
#include "debugmenu.h"
#include "frontendoption.h"
eLevelName CGame::currLevel;
bool CGame::bDemoMode = true;
@ -272,6 +271,9 @@ bool CGame::InitialiseOnceAfterRW(void)
DMAudio.SetMusicFadeVol(127);
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
#ifdef CUSTOM_FRONTEND_OPTIONS
CustomFrontendOptionsPopulate();
#endif
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
{ "", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0, },
// 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,
#endif
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
@ -24,11 +21,7 @@ const CMenuScreen aScreens[] = {
},
// 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,
#endif
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_WIDESCREEN, "FED_WIS", 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_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_LANGUAGE_SETTINGS = 7
{ "FET_LAN", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 3, 3,
MENUACTION_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_NONE,
#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_LANG_ENG, "FEL_ENG", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_FRE, "FEL_FRE", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_GER, "FEL_GER", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_ITA, "FEL_ITA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_LANG_SPA, "FEL_SPA", SAVESLOT_NONE, MENUPAGE_LANGUAGE_SETTINGS,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
},
// MENUPAGE_CHOOSE_LOAD_SLOT = 8
{ "FET_LG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 1, 1,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL0", SAVESLOT_1, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_2, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_3, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_4, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_5, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_6, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_7, MENUPAGE_LOAD_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_8, MENUPAGE_LOAD_SLOT_CONFIRM,
},
// MENUPAGE_CHOOSE_DELETE_SLOT = 9
{ "FET_DG", 1, MENUPAGE_NEW_GAME, MENUPAGE_NEW_GAME, 2, 2,
MENUACTION_CHANGEMENU, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NEW_GAME,
MENUACTION_CHECKSAVE, "FEM_SL1", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL2", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL3", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL4", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL5", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL6", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL7", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHECKSAVE, "FEM_SL8", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL0", SAVESLOT_1, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL1", SAVESLOT_2, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL2", SAVESLOT_3, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL3", SAVESLOT_4, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL4", SAVESLOT_5, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL5", SAVESLOT_6, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL6", SAVESLOT_7, MENUPAGE_DELETE_SLOT_CONFIRM,
MENUACTION_CHANGEMENU, "FEM_SL7", SAVESLOT_8, MENUPAGE_DELETE_SLOT_CONFIRM,
},
// MENUPAGE_NEW_GAME_RELOAD = 10
@ -284,7 +269,7 @@ const CMenuScreen aScreens[] = {
// MENUPAGE_CONTROLLER_PC = 35
{ "FET_CTL", 1, MENUPAGE_OPTIONS, MENUPAGE_OPTIONS, 0, 0,
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_RESTOREDEF, "FET_DEF", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_CHANGEMENU, "FEDS_TB", SAVESLOT_NONE, MENUPAGE_NONE,
@ -333,11 +318,7 @@ const CMenuScreen aScreens[] = {
},
// 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,
#endif
MENUACTION_CHANGEMENU, "FET_CTL", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
MENUACTION_LOADRADIO, "FET_AUD", SAVESLOT_NONE, MENUPAGE_SOUND_SETTINGS,
MENUACTION_CHANGEMENU, "FET_DIS", SAVESLOT_NONE, MENUPAGE_GRAPHICS_SETTINGS,
@ -347,13 +328,9 @@ const CMenuScreen aScreens[] = {
},
// 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,
#endif
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,
},
@ -412,9 +389,6 @@ const CMenuScreen aScreens[] = {
{ "FET_PAU", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_RESUME, "FEM_RES", SAVESLOT_NONE, MENUPAGE_NONE,
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_BRI", SAVESLOT_NONE, MENUPAGE_BRIEFS,
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_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,
// mission failed, wanna restart page in mobile
},
#endif
// MENUPAGE_58 = 58
{ "", 0, MENUPAGE_NONE, MENUPAGE_NONE, 0, 0,

View File

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

View File

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

View File

@ -174,7 +174,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
CTheScripts::ResetCountdownToMakePlayerUnsafe();
m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
CWorld::StopAllLawEnforcersInTheirTracks();
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20;
CPad::GetPad(0)->SetDisablePlayerControls(PLAYERCONTROL_PLAYERINFO);
CPad::StopPadsShaking();
m_pPed->bBulletProof = true;
m_pPed->bFireProof = true;
@ -194,7 +194,7 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
} else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
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->bFireProof = false;
m_pPed->bCollisionProof = false;
@ -397,7 +397,7 @@ CPlayerInfo::Process(void)
else
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_pRemoteVehicle) {
CEntity *surfaceBelowVeh = m_pPed->m_pMyVehicle->m_pCurGroundEntity;

View File

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

View File

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

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

View File

@ -1,86 +1,44 @@
#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
{
SURFACE_DEFAULT,
SURFACE_TARMAC,
SURFACE_GRASS,
SURFACE_DIRT,
SURFACE_DIRTTRACK,
SURFACE_GRAVEL,
SURFACE_MUD_DRY,
SURFACE_PAVEMENT,
SURFACE_METAL6,
SURFACE_CAR,
SURFACE_GLASS,
SURFACE_SCAFFOLD,
SURFACE_METAL_DOOR, // garage door
SURFACE_BILLBOARD,
SURFACE_STEEL, //?
SURFACE_METAL_POLE, // ?
SURFACE_STREET_LIGHT,
SURFACE_METAL14,
SURFACE_METAL15,
SURFACE_METAL_FENCE,
SURFACE_FLESH,
SURFACE_TRANSPARENT_CLOTH,
SURFACE_GARAGE_DOOR,
SURFACE_CAR_PANEL,
SURFACE_THICK_METAL_PLATE,
SURFACE_SCAFFOLD_POLE,
SURFACE_LAMP_POST,
SURFACE_FIRE_HYDRANT,
SURFACE_GIRDER,
SURFACE_METAL_CHAIN_FENCE,
SURFACE_PED,
SURFACE_SAND,
SURFACE_PUDDLE,
SURFACE_WOOD,
SURFACE_WOOD_BOX,
SURFACE_WOOD_PLANK,
SURFACE_TIRE,
SURFACE_HARD24,
SURFACE_WATER,
SURFACE_WOOD_CRATES,
SURFACE_WOOD_BENCH,
SURFACE_WOOD_SOLID,
SURFACE_RUBBER,
SURFACE_PLASTIC,
SURFACE_HEDGE,
SURFACE_STONE,
SURFACE_METAL27,
SURFACE_METAL28,
SURFACE_RUBBER29,
SURFACE_LOOSE30,
SURFACE_BOLLARD,
SURFACE_GATE,
SURFACE_STEEP_CLIFF,
SURFACE_CONTAINER,
SURFACE_NEWS_VENDOR,
SURFACE_WHEELBASE,
SURFACE_CARDBOARDBOX,
SURFACE_TRANSPARENT_STONE,
SURFACE_METAL_GATE,
// These are illegal
SURFACE_SAND33,
SURFACE_ROAD34,
SURFACE_SAND_BEACH,
SURFACE_CONCRETE_BEACH,
};
enum

View File

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

View File

@ -18,7 +18,7 @@ public:
static const float &GetTimeStep(void) { return ms_fTimeStep; }
static void SetTimeStep(float ts) { ms_fTimeStep = ts; }
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 float GetTimeStepNonClippedInSeconds(void) { return ms_fTimeStepNonClipped / 50.0f; }
static float GetTimeStepNonClippedInMilliseconds(void) { return ms_fTimeStepNonClipped / 50.0f * 1000.0f; }
@ -59,7 +59,7 @@ public:
friend class CMemoryCard;
#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(); }
#endif
};

View File

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

View File

@ -29,14 +29,14 @@
#define STREAMFILE(str) (((rw::StreamFile*)(str))->file)
#define HIERNODEINFO(hier) ((hier)->nodeInfo)
#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
#define RWHALFPIXEL // always d3d
#define STREAMPOS(str) ((str)->Type.memory.position)
#define STREAMFILE(str) ((str)->Type.file.fpFile)
#define HIERNODEINFO(hier) ((hier)->pNodeInfo)
#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
#ifdef RWHALFPIXEL
@ -113,7 +113,7 @@ inline uint32 ldb(uint32 p, uint32 s, uint32 w)
#define SCREEN_WIDTH ((float)RsGlobal.width)
#define SCREEN_HEIGHT ((float)RsGlobal.height)
#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
#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, c);\
WriteSaveBuf(buf, d);\
WriteSaveBuf(buf, size);
WriteSaveBuf<uint32>(buf, size);
#define CheckSaveHeader(buf,a,b,c,d,size)\
assert(ReadSaveBuf<char>(buf) == a);\

View File

@ -65,8 +65,6 @@ enum Config {
NUMATTRIBZONES = 288,
NUMZONEINDICES = 55000,
NUMHANDLINGS = 57,
PATHNODESIZE = 4500,
NUMWEATHERS = 4,
@ -188,21 +186,20 @@ enum Config {
# define NO_CDCHECK
# define CHATTYSPLASH // print what the game is loading
# define DEBUGMENU
//# define TIMEBARS // print debug timers
# define TIMEBARS // print debug timers
#endif
#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 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 USE_TXD_CDIMAGE // generate and load textures from txd.img
#define IMPROVED_VIDEOMODE // save and load videomode parameters instead of a magic number
//#define USE_TEXTURE_POOL
#ifdef _WIN32
#define AUDIO_MSS
#else
#define AUDIO_OAL
#endif
// Particle
//#define PC_PARTICLE
@ -219,7 +216,6 @@ enum Config {
#define REGISTER_START_BUTTON
// 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 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.
@ -229,13 +225,20 @@ enum Config {
// #define CIRCLE_BACK_BUTTON
#define HUD_ENHANCEMENTS // Adjusts some aspects to make the HUD look/behave a little bit better.
#define BETA_SLIDING_TEXT
#define CUSTOM_FRONTEND_OPTIONS
// 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_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
//#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
// 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 FREE_CAM // Rotating cam

View File

@ -74,6 +74,9 @@ float FramesPerSecond = 30.0f;
bool gbPrintShite = false;
bool gbModelViewer;
#ifdef TIMEBARS
bool gbShowTimebars;
#endif
int32 frameCount;
@ -96,7 +99,6 @@ void TheGame(void);
void DebugMenuPopulate(void);
#endif
void
ValidateVersion()
{
@ -138,9 +140,13 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, 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);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
return false;
@ -156,7 +162,11 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
bool
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);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@ -342,7 +352,7 @@ PluginAttach(void)
static RwBool
Initialise3D(void *param)
{
if (RsRwInitialise(param))
if (RsRwInitialize(param))
{
#ifdef DEBUGMENU
DebugMenuInit();
@ -1118,7 +1128,9 @@ Idle(void *arg)
#endif
CCredits::Render();
#ifdef TIMEBARS
if (gbShowTimebars)
tbDisplay();
#endif
@ -1175,10 +1187,10 @@ AppEventHandler(RsEvent event, void *param)
{
switch( event )
{
case rsINITIALISE:
case rsINITIALIZE:
{
CGame::InitialiseOnceBeforeRW();
return RsInitialise() ? rsEVENTPROCESSED : rsEVENTERROR;
return RsInitialize() ? rsEVENTPROCESSED : rsEVENTERROR;
}
case rsCAMERASIZE:
@ -1190,7 +1202,7 @@ AppEventHandler(RsEvent event, void *param)
return rsEVENTPROCESSED;
}
case rsRWINITIALISE:
case rsRWINITIALIZE:
{
return Initialise3D(param) ? rsEVENTPROCESSED : rsEVENTERROR;
}

View File

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

View File

@ -27,6 +27,9 @@
#include "Radar.h"
#include "debugmenu.h"
#include "Frontend.h"
#include "Text.h"
#include "WaterLevel.h"
#include "main.h"
#ifndef _WIN32
#include "assert.h"
@ -66,6 +69,100 @@ mysrand(unsigned int 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
void WeaponCheat();
void HealthCheat();
@ -160,6 +257,13 @@ TeleportToWaypoint(void)
}
#endif
static void
SwitchCarCollision(void)
{
if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar())
FindPlayerVehicle()->bUsesCollision = !FindPlayerVehicle()->bUsesCollision;
}
static int engineStatus;
static void
SetEngineStatus(void)
@ -357,11 +461,14 @@ DebugMenuPopulate(void)
DebugMenuAddVarBool8("Render", "Don't render Peds", &gbDontRenderPeds, nil);
DebugMenuAddVarBool8("Render", "Don't render Vehicles", &gbDontRenderVehicles, 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);
#ifdef MENU_MAP
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
#endif
DebugMenuAddCmd("Debug", "Switch car collision", SwitchCarCollision);
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar);
@ -374,6 +481,9 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Catalina Fly Away", CHeli::MakeCatalinaHeliFlyAway);
DebugMenuAddVarBool8("Debug", "Script Heli On", &CHeli::ScriptHeliOn, nil);
#ifdef CUSTOM_FRONTEND_OPTIONS
DebugMenuAddCmd("Debug", "Reload custom frontend options", ReloadFrontendOptions);
#endif
#ifdef TOGGLEABLE_BETA_FEATURES
DebugMenuAddVarBool8("Debug", "Toggle popping heads on headshot", &CPed::bPopHeadsOnHeadshot, 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", "Stop Credits", CCredits::Stop);
DebugMenuAddVarBool8("Debug", "Show DebugStuffInRelease", &gbDebugStuffInRelease, nil);
#ifdef TIMEBARS
DebugMenuAddVarBool8("Debug", "Show Timebars", &gbShowTimebars, nil);
#endif
extern bool PrintDebugCode;
extern int16 DebugCamMode;
DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil);

View File

@ -683,7 +683,7 @@ CEntity::ProcessLightsForEntity(void)
lightOn = true;
break;
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)
lightOn = true;
else
@ -803,12 +803,12 @@ CEntity::ProcessLightsForEntity(void)
}
// Light shadow
if(effect->light.shadowRange != 0.0f){
if(effect->light.shadowSize != 0.0f){
if(lightOn){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f,
0.0f, -effect->light.shadowRange,
effect->light.shadowSize, 0.0f,
0.0f, -effect->light.shadowSize,
128,
effect->col.r*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){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f,
0.0f, -effect->light.shadowRange,
effect->light.shadowSize, 0.0f,
0.0f, -effect->light.shadowSize,
0, 0.0f, 0.0f, 0.0f,
15.0f, 1.0f, 40.0f, false, 0.0f);
}

View File

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

View File

@ -18,7 +18,7 @@ public:
// The not properly indented fields haven't been checked properly yet
int32 m_audioEntityId;
float unk1;
float m_phys_unused1;
CTreadable *m_treadable[2]; // car and ped
uint32 m_nLastTimeCollided;
CVector m_vecMoveSpeed; // velocity
@ -37,7 +37,7 @@ public:
CEntryInfoList m_entryInfoList;
CPtrNode *m_movingListNode;
char field_EC;
int8 m_phys_unused2;
uint8 m_nStaticFrames;
uint8 m_nCollisionRecords;
bool m_bIsVehicleBeingShifted;
@ -86,7 +86,6 @@ public:
void RemoveRefsToEntity(CEntity *ent);
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
CVector GetSpeed(const CVector &r);
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 +
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) +
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
DebugMenuRender(void)
{
@ -1048,7 +1042,7 @@ DebugMenuRender(void)
RwRenderStateSet(rwRENDERSTATEFOGENABLE, 0);
RwRenderStateSet(rwRENDERSTATECULLMODE, (void*)rwCULLMODECULLNONE);
RwCamera *cam = CURRENTCAM;
RwCamera *cam = RwCameraGetCurrentCamera();
screenWidth = RwRasterGetWidth(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 RwIm2DVertex arrowVerts[4];
RwCamera *cam = CURRENTCAM;
RwCamera *cam = RwCameraGetCurrentCamera();
float recipz = 1.0f/RwCameraGetNearClipPlane(cam);
int width = RwRasterGetWidth(arrow);
@ -1183,7 +1177,7 @@ drawMouse(void)
static RwIm2DVertex vertices[4];
RwIm2DVertex *vert;
RwCamera *cam;
cam = CURRENTCAM;
cam = RwCameraGetCurrentCamera();
float x = mouseX;
float y = mouseY;
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; }
RwCamera *RwCameraSetFogDistance(RwCamera *camera, RwReal fogDistance) { camera->fogPlane = fogDistance; return camera; }
RwReal RwCameraGetFogDistance(const RwCamera *camera) { return camera->fogPlane; }
RwCamera *RwCameraGetCurrentCamera(void);
RwCamera *RwCameraGetCurrentCamera(void) { return rw::engine->currentCamera; }
RwCameraProjection RwCameraGetProjection(const RwCamera *camera);
const RwV2d *RwCameraGetViewWindow(const RwCamera *camera) { return &camera->viewWindow; }
RwMatrix *RwCameraGetViewMatrix(RwCamera *camera) { return &camera->viewMatrix; }
@ -470,7 +470,7 @@ RwBool RwRenderStateSet(RwRenderState state, void *value)
uint32 uival = (uintptr)value;
uint32 fog;
switch(state){
case rwRENDERSTATETEXTURERASTER: SetRenderState(TEXTURERASTER, uival); return true;
case rwRENDERSTATETEXTURERASTER: SetRenderStatePtr(TEXTURERASTER, value); return true;
case rwRENDERSTATETEXTUREADDRESS: SetRenderState(TEXTUREADDRESS, uival); return true;
case rwRENDERSTATETEXTUREADDRESSU: SetRenderState(TEXTUREADDRESSU, 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; }
RwSphere *RpMorphTargetGetBoundingSphere(RpMorphTarget *morphTarget) { return &morphTarget->boundingSphere; }
const RpMorphTarget *RpMorphTargetCalcBoundingSphere(const RpMorphTarget *morphTarget, RwSphere *boundingSphere) { *boundingSphere = morphTarget->calculateBoundingSphere(); return morphTarget; }
RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount);
RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry);
RwInt32 RpGeometryAddMorphTargets(RpGeometry *geometry, RwInt32 mtcount) { RwInt32 n = geometry->numMorphTargets; geometry->addMorphTargets(mtcount); return n; }
RwInt32 RpGeometryAddMorphTarget(RpGeometry *geometry) { return RpGeometryAddMorphTargets(geometry, 1); }
RpGeometry *RpGeometryRemoveMorphTarget(RpGeometry *geometry, RwInt32 morphTarget);
RwInt32 RpGeometryGetNumMorphTargets(const RpGeometry *geometry);
RpMorphTarget *RpGeometryGetMorphTarget(const RpGeometry *geometry, RwInt32 morphTarget) { return &geometry->morphTargets[morphTarget]; }
@ -790,6 +790,12 @@ RpMaterial *RpMatFXMaterialSetEnvMapFrame( RpMaterial *material, RwFrame *frame
mfx->setEnvFrame(frame);
return material;
}
RpMaterial *RpMatFXMaterialSetEnvMapFrameBufferAlpha( RpMaterial *material, RwBool useFrameBufferAlpha )
{
MatFX *mfx = MatFX::get(material);
mfx->setEnvFBAlpha(useFrameBufferAlpha);
return material;
}
RpMaterial *RpMatFXMaterialSetEnvMapCoefficient( RpMaterial *material, RwReal coef )
{
MatFX *mfx = MatFX::get(material);

View File

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

View File

@ -59,6 +59,12 @@ CMatrix::RotateX(float x)
Rotate(x, 0.0f, 0.0f);
}
void
CMatrix::RotateY(float y)
{
Rotate(0.0f, y, 0.0f);
}
void
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
CQuaternion::Get(RwMatrix *matrix)
{

View File

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

View File

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

View File

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

View File

@ -36,7 +36,14 @@ public:
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; }
void DeleteRwObject(void);
void SetClump(RpClump *);

View File

@ -157,6 +157,13 @@ CSimpleModelInfo::SetupBigBuilding(void)
if(related)
m_lodDistances[2] = related->GetLargestLodDistance()/TheCamera.LODDistMultiplier;
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;
else
m_lodDistances[2] = 0.0f;
#else
m_lodDistances[2] = 100.0f;
#endif
}
}

View File

@ -16,6 +16,7 @@
#include "Train.h"
#include "Plane.h"
#include "Heli.h"
#include "Bike.h"
#include "ModelIndices.h"
#include "ModelInfo.h"
@ -120,16 +121,16 @@ RwObjectNameIdAssocation planeIds[] = {
};
RwObjectNameIdAssocation bikeIds[] = {
{ "chassis_dummy", 1, 0 },
{ "forks_front", 2, 0 },
{ "forks_rear", 3, 0 },
{ "wheel_front", 4, 0 },
{ "wheel_rear", 5, 0 },
{ "mudguard", 6, 0 },
{ "ped_frontseat", 2, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "headlights", 0, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "taillights", 1, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "exhaust", 9, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "chassis_dummy", BIKE_CHASSIS, 0 },
{ "forks_front", BIKE_FORKS_FRONT, 0 },
{ "forks_rear", BIKE_FORKS_REAR, 0 },
{ "wheel_front", BIKE_WHEEL_FRONT, 0 },
{ "wheel_rear", BIKE_WHEEL_REAR, 0 },
{ "mudguard", BIKE_MUDGUARD, 0 },
{ "ped_frontseat", CAR_POS_FRONTSEAT, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "headlights", CAR_POS_HEADLIGHTS, VEHICLE_FLAG_POS | CLUMP_FLAG_NO_HIERID },
{ "taillights", CAR_POS_TAILLIGHTS, 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 },
{ "extra2", 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
};
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 {
NUM_VEHICLE_POSITIONS = 10
};
@ -100,6 +137,7 @@ public:
void SetVehicleComponentFlags(RwFrame *frame, uint32 flags);
void PreprocessHierarchy(void);
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 ChooseSecondComponent(void);

View File

@ -11,6 +11,7 @@
#include "ObjectData.h"
#include "World.h"
#include "Floater.h"
#include "soundlist.h"
int16 CObject::nNoTempObjects;
int16 CObject::nBodyCastHealth = 1000;
@ -219,7 +220,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
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;
}
case DAMAGE_EFFECT_SMASH_WOODENBOX_COMPLETELY: {
@ -242,7 +243,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
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;
}
case DAMAGE_EFFECT_SMASH_TRAFFICCONE_COMPLETELY: {
@ -267,7 +268,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
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;
}
case DAMAGE_EFFECT_SMASH_BARPOST_COMPLETELY: {
@ -292,7 +293,7 @@ CObject::ObjectDamage(float amount)
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
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;
}
}

View File

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

View File

@ -57,56 +57,15 @@
#include "Timecycle.h"
#include "ParticleObject.h"
#include "Floater.h"
#include "Range2D.h"
#define CAN_SEE_ENTITY_ANGLE_THRESHOLD DEGTORAD(60.0f)
CPed *gapTempPedList[50];
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;
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, 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
bool CPed::bPopHeadsOnHeadshot = false;
bool CPed::bMakePedsRunToPhonesToReportCrimes = false;
#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)
{
CWorld::Remove(this);
@ -441,10 +183,13 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedType = pedType;
m_lastSoundStart = 0;
m_soundStart = 0;
m_lastQueuedSound = SOUND_TOTAL_PED_SOUNDS;
m_queuedSound = SOUND_TOTAL_PED_SOUNDS;
m_lastQueuedSound = SOUND_NO_SOUND;
m_queuedSound = SOUND_NO_SOUND;
m_objective = OBJECTIVE_NONE;
m_prevObjective = OBJECTIVE_NONE;
#ifdef FIX_BUGS
m_objectiveTimer = 0;
#endif
CharCreatedBy = RANDOM_CHAR;
m_leader = nil;
m_pedInObjective = nil;
@ -498,6 +243,9 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_nPedState = PED_IDLE;
m_nLastPedState = PED_NONE;
m_nMoveState = PEDMOVE_STILL;
#ifdef FIX_BUGS
m_nPrevMoveState = PEDMOVE_NONE;
#endif
m_nStoredMoveState = PEDMOVE_NONE;
m_pFire = nil;
m_pPointGunAt = nil;
@ -1087,6 +835,9 @@ CPed::ClearAimFlag(void)
bIsAimingGun = false;
bIsRestoringGun = true;
m_pedIK.m_flags &= ~CPedIK::AIMS_WITH_ARM;
#ifdef VC_PED_PORTS
m_lookTimer = 0;
#endif
}
if (IsPlayer())
@ -1682,11 +1433,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
switch (component) {
case CAR_DOOR_RF:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos.x += seatOffset;
vehDoorOffset.x = -vehDoorOffset.x;
break;
@ -1698,11 +1445,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
break;
case CAR_DOOR_LF:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorPos.x = -(vehDoorPos.x + seatOffset);
break;
@ -1712,11 +1455,7 @@ CPed::GetLocalPositionToOpenCarDoor(CVehicle *veh, uint32 component, float seatP
break;
default:
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
vehDoorPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
vehDoorPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
vehDoorPos = vehModel->GetFrontSeatPosn();
vehDoorOffset = CVector(0.0f, 0.0f, 0.0f);
}
return vehDoorPos - vehDoorOffset;
@ -2037,7 +1776,7 @@ particleProduceFootDust(CPed *ped, CVector const &pos, float size, int times)
switch (ped->m_nSurfaceTouched)
{
case SURFACE_TARMAC:
case SURFACE_DIRT:
case SURFACE_GRAVEL:
case SURFACE_PAVEMENT:
case SURFACE_SAND:
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();
if (pedSpeed > 0.03f && CTimer::GetFrameCounter() % 2 == 0 && pedSpeed > 0.13f) {
#ifdef PC_PARTICLE
@ -2380,7 +2119,7 @@ CPed::SetupLighting(void)
#ifndef MASTER
// Originally this was being called through iteration of Sectors, but putting it here is better.
if (nDisplayDebugInfo && !IsPlayer())
if (GetDebugDisplay() != 0 && !IsPlayer())
DebugRenderOnePedText();
#endif
@ -2514,37 +2253,37 @@ CPed::CalculateNewVelocity(void)
if ((!idleAssoc || idleAssoc->blendAmount < 0.5f) && !fightAssoc) {
#endif
LimbOrientation newUpperLegs;
newUpperLegs.phi = localWalkAngle;
newUpperLegs.yaw = localWalkAngle;
if (newUpperLegs.phi < -DEGTORAD(100.0f)) {
newUpperLegs.phi += PI;
} else if (newUpperLegs.phi > DEGTORAD(100.0f)) {
newUpperLegs.phi -= PI;
if (newUpperLegs.yaw < -DEGTORAD(100.0f)) {
newUpperLegs.yaw += PI;
} else if (newUpperLegs.yaw > DEGTORAD(100.0f)) {
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
if(IsClumpSkinned(GetClump())){
/*
// this looks shit
newUpperLegs.theta = 0.0f;
newUpperLegs.pitch = 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_UPPERLEGR]->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.yaw), rwCOMBINEPRECONCAT);
*/
newUpperLegs.theta = 0.1f;
newUpperLegs.pitch = 0.1f;
RwV3d Xaxis = { 1.0f, 0.0f, 0.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, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.theta), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.phi), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGL]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Zaxis, RADTODEG(newUpperLegs.pitch), rwCOMBINEPOSTCONCAT);
RtQuatRotate(&m_pFrames[PED_UPPERLEGR]->hanimFrame->q, &Xaxis, RADTODEG(newUpperLegs.yaw), rwCOMBINEPOSTCONCAT);
bDontAcceptIKLookAts = true;
}else
#endif
{
newUpperLegs.theta = 0.0f;
newUpperLegs.pitch = 0.0f;
m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGL], &newUpperLegs, false);
m_pedIK.RotateTorso(m_pFrames[PED_UPPERLEGR], &newUpperLegs, false);
}
@ -2588,7 +2327,7 @@ CPed::CanPedDriveOff(void)
bool
CPed::CanPedJumpThis(CEntity *unused, CVector *damageNormal = nil)
{
if (m_nSurfaceTouched == SURFACE_PUDDLE)
if (m_nSurfaceTouched == SURFACE_WATER)
return true;
CVector pos = GetPosition();
@ -3648,9 +3387,14 @@ CPed::SetStoredState(void)
if (m_nMoveState == PEDMOVE_NONE || m_nMoveState == PEDMOVE_STILL)
m_nMoveState = PEDMOVE_WALK;
}
#ifdef VC_PED_PORTS
if (m_nPedState != PED_IDLE)
#endif
{
m_nLastPedState = m_nPedState;
if (m_nMoveState >= m_nPrevMoveState)
m_nPrevMoveState = m_nMoveState;
}
}
void
@ -5419,7 +5163,10 @@ CPed::SetWaitState(eWaitState state, void *time)
case WAITSTATE_DOUBLEBACK:
m_headingRate = 0.0f;
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;
case WAITSTATE_HITWALL:
m_headingRate = 2.0f;
@ -5453,7 +5200,10 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
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) {
ClearObjective();
@ -5466,7 +5216,11 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
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;
case WAITSTATE_PLAYANIM_COWER:
waitAnim = ANIM_HANDSCOWER;
@ -5508,7 +5262,10 @@ CPed::SetWaitState(eWaitState state, void *time)
SetMoveAnim();
m_headingRate = 0.0f;
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;
default:
m_nWaitState = WAITSTATE_FALSE;
@ -5537,7 +5294,7 @@ CPed::PlayHitSound(CPed *hitTo)
S42 = SOUND_FIGHT_PUNCH_FROM_BEHIND_42,
S43 = SOUND_FIGHT_KNEE_OR_KICK_43,
S44 = SOUND_FIGHT_KICK_44,
NO_SND = SOUND_TOTAL_PED_SOUNDS
NO_SND = SOUND_NO_SOUND
};
uint16 hitSoundsByFightMoves[12][10] = {
{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);
}
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
CPed::CollideWithPed(CPed *collideWith)
{
@ -6072,6 +5757,9 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
m_nPedState = PED_CHAT;
SetMoveState(PEDMOVE_STILL);
#ifdef VC_PED_PORTS
m_lookTimer = 0;
#endif
SetLookFlag(chatWith, true);
m_standardTimer = CTimer::GetTimeInMilliseconds() + time;
m_lookTimer = CTimer::GetTimeInMilliseconds() + 3000;
@ -6080,9 +5768,6 @@ CPed::SetChat(CEntity *chatWith, uint32 time)
void
CPed::SetDead(void)
{
#ifdef VC_PED_PORTS
if (!RpAnimBlendClumpGetAssociation(GetClump(), ANIM_DROWN))
#endif
bUsesCollision = false;
m_fHealth = 0.0f;
@ -6187,6 +5872,9 @@ CPed::Die(void)
uint8
CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
{
#ifdef FIX_BUGS
return 1;
#else
uint8 retVal = 2;
float headZ = GetNodePosition(PED_HEAD).z;
@ -6202,6 +5890,7 @@ CPed::DoesLOSBulletHitPed(CColPoint &colPoint)
retVal = 0;
return retVal;
#endif
}
bool
@ -8955,11 +8644,11 @@ CPed::LookForInterestingNodes(void)
return false;
}
switch (effect->attractor.flags) {
case ATTRACTORFLAG_ICECREAM:
switch (effect->attractor.type) {
case ATTRACTORTYPE_ICECREAM:
SetInvestigateEvent(EVENT_ICECREAM, CVector2D(effectPos), 0.1f, 15000, angleToFace);
break;
case ATTRACTORFLAG_STARE:
case ATTRACTORTYPE_STARE:
SetInvestigateEvent(EVENT_SHOPSTALL, CVector2D(effectPos), 1.0f,
CGeneral::GetRandomNumberInRange(8000, 10 * effect->attractor.probability + 8500),
angleToFace);
@ -9578,17 +9267,6 @@ CPed::ProcessControl(void)
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 &&
(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_PURSUE:
case PED_SNIPER_MODE:
case PED_ROCKET_ODE:
case PED_ROCKET_MODE:
case PED_DUMMY:
case PED_FACE_PHONE:
case PED_MAKE_CALL:
@ -11055,7 +10733,7 @@ CPed::SetJump(void)
#ifdef VC_PED_PORTS
m_nPedState != PED_JUMP && !RpAnimBlendClumpGetAssociation(GetClump(), ANIM_JUMP_LAUNCH) &&
#endif
(m_nSurfaceTouched != SURFACE_STONE || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
(m_nSurfaceTouched != SURFACE_STEEP_CLIFF || DotProduct(GetForward(), m_vecDamageNormal) >= 0.0f)) {
SetStoredState();
m_nPedState = PED_JUMP;
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
CPed::RemoveInCarAnims(void)
{
@ -14781,7 +14453,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
GetMatrix().GetPosition().z = FEET_OFFSET + intersectionPoint.point.z;
#endif
m_nSurfaceTouched = intersectionPoint.surfaceB;
if (m_nSurfaceTouched == SURFACE_STONE) {
if (m_nSurfaceTouched == SURFACE_STEEP_CLIFF) {
bHitSteepSlope = true;
m_vecDamageNormal = intersectionPoint.normal;
}
@ -14889,7 +14561,7 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
#endif
sphereNormal.Normalise();
collidingPoints[sphere].normal = sphereNormal;
if (collidingPoints[sphere].surfaceB == SURFACE_STONE)
if (collidingPoints[sphere].surfaceB == SURFACE_STEEP_CLIFF)
bHitSteepSlope = true;
}
}
@ -14939,17 +14611,9 @@ CPed::WanderRange(void)
bool arrived = Seek();
if (arrived) {
Idle();
if (((m_randomSeed % 256) + 3 * CTimer::GetFrameCounter()) % 1000 > 997) {
int xDiff = Abs(m_wanderRangeBounds[1].x - m_wanderRangeBounds[0].x);
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);
if ((m_randomSeed + 3 * CTimer::GetFrameCounter()) % 1000 > 997) {
CVector2D newCoords2D = m_wanderRangeBounds->GetRandomPointInRange();
SetSeek(CVector(newCoords2D.x, newCoords2D.y, GetPosition().z), 2.5f);
}
}
}
@ -15031,11 +14695,7 @@ CPed::SeekBoatPosition(void)
CVehicleModelInfo *boatModel = m_carInObjective->GetModelInfo();
CVector enterOffset;
if (boatModel->m_vehicleType == VEHICLE_TYPE_BOAT)
enterOffset = boatModel->m_positions[BOAT_POS_FRONTSEAT];
else
enterOffset = boatModel->m_positions[CAR_POS_FRONTSEAT];
enterOffset = boatModel->GetFrontSeatPosn();
enterOffset.x = 0.0f;
CMatrix boatMat(m_carInObjective->GetMatrix());
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
CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
{
@ -16749,7 +16381,7 @@ CPed::UpdatePosition(void)
velocityChange = m_moved + velocityOfSurface - m_vecMoveSpeed;
m_fRotationCur += 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;
} else {
// Ped got damaged by steep slope
@ -16817,29 +16449,20 @@ CPed::SetPedPositionInCar(void)
CMatrix newMat(m_pMyVehicle->GetMatrix());
CVector seatPos;
if (m_pMyVehicle->pDriver == this) {
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
seatPos = vehModel->GetFrontSeatPosn();
if (!m_pMyVehicle->IsBoat() && m_pMyVehicle->m_vehType != VEHICLE_TYPE_BIKE)
seatPos.x = -seatPos.x;
} else if (m_pMyVehicle->pPassengers[0] == this) {
if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT)
seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
else
seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
seatPos = vehModel->GetFrontSeatPosn();
} else if (m_pMyVehicle->pPassengers[1] == this) {
seatPos = vehModel->m_positions[CAR_POS_BACKSEAT];
seatPos.x = -seatPos.x;
} else {
if (m_pMyVehicle->pPassengers[2] == this) {
seatPos = vehModel->m_positions[CAR_POS_BACKSEAT];
} else if (vehModel->m_vehicleType == VEHICLE_TYPE_BOAT) {
seatPos = vehModel->m_positions[BOAT_POS_FRONTSEAT];
} else {
seatPos = vehModel->m_positions[CAR_POS_FRONTSEAT];
seatPos = vehModel->GetFrontSeatPosn();
}
}
newMat.GetPosition() += Multiply3x3(newMat, seatPos);

View File

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

View File

@ -4,8 +4,8 @@
struct LimbOrientation
{
float phi;
float theta;
float yaw;
float pitch;
};
struct LimbMovementInfo {
@ -48,8 +48,8 @@ public:
static LimbMovementInfo ms_lowerArmInfo;
CPedIK(CPed *ped);
bool PointGunInDirection(float phi, float theta);
bool PointGunInDirectionUsingArm(float phi, float theta);
bool PointGunInDirection(float targetYaw, float targetPitch);
bool PointGunInDirectionUsingArm(float targetYaw, float targetPitch);
bool PointGunAtPosition(CVector const& position);
void GetComponentPosition(RwV3d *pos, uint32 node);
static RwMatrix *GetWorldMatrix(RwFrame *source, RwMatrix *destination);
@ -57,10 +57,10 @@ public:
void ExtractYawAndPitchLocal(RwMatrix *mat, float *yaw, float *pitch);
void ExtractYawAndPitchLocalSkinned(AnimBlendFrameData *node, 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);
void RotateHead(void);
bool LookInDirection(float phi, float theta);
bool LookInDirection(float targetYaw, float targetPitch);
bool LookAtPosition(CVector const& pos);
bool RestoreLookAt(void);
};

View File

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

View File

@ -966,18 +966,11 @@ CPopulation::ConvertToRealObject(CDummyObject *dummy)
if (!obj)
return;
bool makeInvisible;
CWorld::Remove(dummy);
delete dummy;
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;
} else if (obj->GetModelIndex() == MI_BUOY) {
obj->bIsStatic = false;
@ -996,17 +989,8 @@ CPopulation::ConvertToDummyObject(CObject *obj)
dummy->GetMatrix().UpdateRW();
dummy->UpdateRwFrame();
bool makeInvisible;
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()))
dummy->bIsVisible = false;
}
CWorld::Remove(obj);
delete obj;

View File

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

View File

@ -69,8 +69,13 @@ void
CClouds::Update(void)
{
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;
IndividualRotation += (CWeather::Wind*CTimer::GetTimeStep() + 0.3f) * 60.0f;
#endif
}
void

View File

@ -506,18 +506,18 @@ CCoronas::DoSunAndMoon(void)
{
// yeah, moon is done somewhere else....
CVector sunCoors = CTimeCycle::GetSunPosition();
CVector sunCoors = CTimeCycle::GetSunDirection();
sunCoors *= 150.0f;
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();
RegisterCorona(SUN_CORE,
CTimeCycle::GetSunCoreRed(), CTimeCycle::GetSunCoreGreen(), CTimeCycle::GetSunCoreBlue(),
255, sunCoors, size,
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,
CTimeCycle::GetSunCoronaRed(), CTimeCycle::GetSunCoronaGreen(), CTimeCycle::GetSunCoronaBlue(),
255, sunCoors, 25.0f * CTimeCycle::GetSunSize(),

View File

@ -6,6 +6,7 @@
#ifdef ASPECT_RATIO_SCALE
float CDraw::ms_fAspectRatio = DEFAULT_ASPECT_RATIO;
float CDraw::ms_fScaledFOV = 45.0f;
#endif
float CDraw::ms_fNearClipZ;
@ -61,8 +62,7 @@ void
CDraw::SetFOV(float fov)
{
#ifdef ASPECT_RATIO_SCALE
ms_fFOV = ConvertFOV(fov);
#else
ms_fFOV = fov;
ms_fScaledFOV = ConvertFOV(fov);
#endif
ms_fFOV = fov;
}

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