1
0
Fork 0
mirror of https://github.com/halpz/re3.git synced 2024-12-28 18:35:29 +00:00

Merge pull request #1 from GTAmodding/miami

Miami
This commit is contained in:
Fire_Head 2020-05-26 22:16:56 +03:00 committed by GitHub
commit ae8a377f26
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
183 changed files with 20605 additions and 15659 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

Binary file not shown.

2
librw

@ -1 +1 @@
Subproject commit 661feeabf4a4f0a8b0bee23b53ba557a14352d00
Subproject commit 84c582c1d7a64a213523b8e4c8211f8b7a4fdcd1

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 "reVC"
language "C++"
configurations { "Debug", "Release" }
@ -35,11 +51,16 @@ workspace "reVC"
"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 "reVC"
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 "reVC"
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,12 +186,16 @@ project "reVC"
includedirs { "src/weapons" }
includedirs { "src/extras" }
includedirs { "eax" }
includedirs { "milessdk/include" }
includedirs { "eax" }
libdirs { "milessdk/lib" }
filter "platforms:*mss"
defines { "AUDIO_MSS" }
includedirs { "milessdk/include" }
libdirs { "milessdk/lib" }
filter "platforms:*oal"
defines { "AUDIO_OAL" }
filter {}
if(os.getenv("GTA_VC_RE_DIR")) then
setpaths("$(GTA_VC_RE_DIR)/", "%(cfg.buildtarget.name)", "")
end
@ -181,9 +207,15 @@ project "reVC"
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

@ -104,7 +104,7 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
c2 = toupper(c2);
#endif
if(c1 != c2)
if(c1 && c2 && c1 != c2)
return false;
}
}

View file

@ -84,7 +84,8 @@ public:
void SetRun(void) { flags |= ASSOC_RUNNING; }
inline float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
float GetTimeLeft() { return hierarchy->totalLength - currentTime; }
float GetProgress() { return currentTime / hierarchy->totalLength; }
static CAnimBlendAssociation *FromLink(CAnimBlendLink *l) {
return (CAnimBlendAssociation*)((uint8*)l - offsetof(CAnimBlendAssociation, link));

View file

@ -134,13 +134,13 @@ AnimAssocDesc aStdAnimDescs[] = {
{ ANIM_DRIVE_LOW_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVEBY_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVEBY_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVEBY_L_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVEBY_L_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVEBY_LOW_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVEBY_LOW_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_CAR_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVE_BOAT, ASSOC_DELETEFADEDOUT | ASSOC_DRIVING },
{ ANIM_DRIVE_BOAT_L, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVE_BOAT_R, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_DRIVE_BOAT_BACK, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_BOAT_LB, ASSOC_DELETEFADEDOUT | ASSOC_PARTIAL | ASSOC_DRIVING },
{ ANIM_BIKE_PICKUP_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_BIKE_PICKUP_L, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
{ ANIM_BIKE_PULLUP_R, ASSOC_FADEOUTWHENDONE | ASSOC_PARTIAL },
@ -899,70 +899,71 @@ char const* aChainsawStrafeRightAnimations[] = {
};
#define awc(a) ARRAY_SIZE(a), a
const AnimAssocDefinition CAnimManager::ms_aAnimAssocDefinitions[NUM_ANIM_ASSOC_GROUPS] = {
{ "man", "ped", MI_COP, 173, aStdAnimations, aStdAnimDescs },
{ "van", "van", MI_COP, 8, aVanAnimations, aVanAnimDescs },
{ "coach", "coach", MI_COP, 5, aCoachAnimations, aCoachAnimDescs },
{ "bikes", "bikes", MI_COP, 18, aBikesAnimations, aBikeAnimDescs },
{ "bikev", "bikev", MI_COP, 18, aBikevAnimations, aBikeAnimDescs },
{ "bikeh", "bikeh", MI_COP, 18, aBikehAnimations, aBikeAnimDescs },
{ "biked", "biked", MI_COP, 18, aBikedAnimations, aBikeAnimDescs },
{ "unarmed", "ped", MI_COP, 3, aUnarmedAnimations, aMeleeAnimDescs },
{ "screwdrv", "ped", MI_COP, 5, aScrewdriverAnimations, aMeleeAnimDescs },
{ "knife", "knife", MI_COP, 5, aKnifeAnimations, aMeleeAnimDescs },
{ "baseball", "baseball", MI_COP, 5, aBaseballbatAnimations, aSwingAnimDescs },
{ "golfclub", "baseball", MI_COP, 5, aGolfclubAnimations, aSwingAnimDescs },
{ "chainsaw", "chainsaw", MI_COP, 3, aChainsawAnimations, aMeleeAnimDescs },
{ "python", "python", MI_COP, 4, aPythonAnimations, aWeaponAnimDescs },
{ "colt45", "colt45", MI_COP, 5, aColtAnimations, aWeaponAnimDescs },
{ "shotgun", "shotgun", MI_COP, 2, aShotgunAnimations, aWeaponAnimDescs },
{ "buddy", "buddy", MI_COP, 2, aBuddyAnimations, aWeaponAnimDescs },
{ "tec", "tec", MI_COP, 4, aTecAnimations, aWeaponAnimDescs },
{ "uzi", "uzi", MI_COP, 4, aUziAnimations, aWeaponAnimDescs },
{ "rifle", "rifle", MI_COP, 4, aRifleAnimations, aWeaponAnimDescs },
{ "m60", "m60", MI_COP, 3, aM60Animations, aWeaponAnimDescs },
{ "sniper", "sniper", MI_COP, 1, aSniperAnimations, aWeaponAnimDescs },
{ "grenade", "grenade", MI_COP, 3, aThrowAnimations, aWeaponAnimDescs },
{ "flame", "flame", MI_COP, 1, aFlamethrowerAnimations, aWeaponAnimDescs },
{ "medic", "medic", MI_COP, 1, aMedicAnimations, aMedicAnimDescs },
{ "sunbathe", "sunbathe", MI_COP, 1, aSunbatheAnimations, aSunbatheAnimDescs },
{ "playidles", "playidles", MI_COP, 4, aPlayerIdleAnimations, aPlayerIdleAnimDescs },
{ "riot", "riot", MI_COP, 7, aRiotAnimations, aRiotAnimDescs },
{ "strip", "strip", MI_COP, 7, aStripAnimations, aStripAnimDescs },
{ "lance", "lance", MI_COP, 1, aLanceAnimations, aSunbatheAnimDescs },
{ "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 },
{ "playercsaw", "ped", MI_COP, 5, aPlayerChainsawAnimations, 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 },
{ "jogger", "ped", MI_COP, 4, aJoggerAnimations, 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 },
{ "fatwoman", "ped", MI_COP, 4, aFatWomanAnimations, aStdAnimDescs },
{ "oldwoman", "ped", MI_COP, 4, aOldWomanAnimations, aStdAnimDescs },
{ "jogwoman", "ped", MI_COP, 4, aJoggerWomanAnimations, aStdAnimDescs },
{ "panicchunky", "ped", MI_COP, 4, aPanicChunkyAnimations, aStdAnimDescs },
{ "skate", "skate", MI_COP, 4, aSkateAnimations, 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 },
{ "csawback", "ped", MI_COP, 5, aChainsawStrafeBackAnimations, aStdAnimDescs },
{ "csawleft", "ped", MI_COP, 5, aChainsawStrafeLeftAnimations, aStdAnimDescsSide },
{ "csawright", "ped", MI_COP, 5, aChainsawStrafeRightAnimations, aStdAnimDescsSide },
{ "man", "ped", MI_COP, awc(aStdAnimations), aStdAnimDescs },
{ "van", "van", MI_COP, awc(aVanAnimations), aVanAnimDescs },
{ "coach", "coach", MI_COP, awc(aCoachAnimations), aCoachAnimDescs },
{ "bikes", "bikes", MI_COP, awc(aBikesAnimations), aBikeAnimDescs },
{ "bikev", "bikev", MI_COP, awc(aBikevAnimations), aBikeAnimDescs },
{ "bikeh", "bikeh", MI_COP, awc(aBikehAnimations), aBikeAnimDescs },
{ "biked", "biked", MI_COP, awc(aBikedAnimations), aBikeAnimDescs },
{ "unarmed", "ped", MI_COP, awc(aUnarmedAnimations), aMeleeAnimDescs },
{ "screwdrv", "ped", MI_COP, awc(aScrewdriverAnimations), aMeleeAnimDescs },
{ "knife", "knife", MI_COP, awc(aKnifeAnimations), aMeleeAnimDescs },
{ "baseball", "baseball", MI_COP, awc(aBaseballbatAnimations), aSwingAnimDescs },
{ "golfclub", "baseball", MI_COP, awc(aGolfclubAnimations), aSwingAnimDescs },
{ "chainsaw", "chainsaw", MI_COP, awc(aChainsawAnimations), aMeleeAnimDescs },
{ "python", "python", MI_COP, awc(aPythonAnimations), aWeaponAnimDescs },
{ "colt45", "colt45", MI_COP, awc(aColtAnimations), aWeaponAnimDescs },
{ "shotgun", "shotgun", MI_COP, awc(aShotgunAnimations), aWeaponAnimDescs },
{ "buddy", "buddy", MI_COP, awc(aBuddyAnimations), aWeaponAnimDescs },
{ "tec", "tec", MI_COP, awc(aTecAnimations), aWeaponAnimDescs },
{ "uzi", "uzi", MI_COP, awc(aUziAnimations), aWeaponAnimDescs },
{ "rifle", "rifle", MI_COP, awc(aRifleAnimations), aWeaponAnimDescs },
{ "m60", "m60", MI_COP, awc(aM60Animations), aWeaponAnimDescs },
{ "sniper", "sniper", MI_COP, awc(aSniperAnimations), aWeaponAnimDescs },
{ "grenade", "grenade", MI_COP, awc(aThrowAnimations), aWeaponAnimDescs },
{ "flame", "flame", MI_COP, awc(aFlamethrowerAnimations), aWeaponAnimDescs },
{ "medic", "medic", MI_COP, awc(aMedicAnimations), aMedicAnimDescs },
{ "sunbathe", "sunbathe", MI_COP, 1, aSunbatheAnimations, aSunbatheAnimDescs }, // NB: not using awc here!
{ "playidles", "playidles", MI_COP, awc(aPlayerIdleAnimations), aPlayerIdleAnimDescs },
{ "riot", "riot", MI_COP, awc(aRiotAnimations), aRiotAnimDescs },
{ "strip", "strip", MI_COP, awc(aStripAnimations), aStripAnimDescs },
{ "lance", "lance", MI_COP, awc(aLanceAnimations), aSunbatheAnimDescs },
{ "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 },
{ "playercsaw", "ped", MI_COP, awc(aPlayerChainsawAnimations), 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 },
{ "jogger", "ped", MI_COP, awc(aJoggerAnimations), 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 },
{ "fatwoman", "ped", MI_COP, awc(aFatWomanAnimations), aStdAnimDescs },
{ "oldwoman", "ped", MI_COP, awc(aOldWomanAnimations), aStdAnimDescs },
{ "jogwoman", "ped", MI_COP, awc(aJoggerWomanAnimations), aStdAnimDescs },
{ "panicchunky", "ped", MI_COP, awc(aPanicChunkyAnimations), aStdAnimDescs },
{ "skate", "skate", MI_COP, awc(aSkateAnimations), 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 },
{ "csawback", "ped", MI_COP, awc(aChainsawStrafeBackAnimations), aStdAnimDescs },
{ "csawleft", "ped", MI_COP, awc(aChainsawStrafeLeftAnimations), aStdAnimDescsSide },
{ "csawright", "ped", MI_COP, awc(aChainsawStrafeRightAnimations), aStdAnimDescsSide },
};
#undef awc
void
CAnimManager::Initialise(void)

View file

@ -118,13 +118,13 @@ enum AnimationId
ANIM_DRIVE_LOW_R,
ANIM_DRIVEBY_L,
ANIM_DRIVEBY_R,
ANIM_DRIVEBY_L_L, // TODO: is this LOW?
ANIM_DRIVEBY_L_R,
ANIM_DRIVEBY_LOW_L,
ANIM_DRIVEBY_LOW_R,
ANIM_CAR_LB,
ANIM_DRIVE_BOAT,
ANIM_DRIVE_BOAT_L,
ANIM_DRIVE_BOAT_R,
ANIM_DRIVE_BOAT_BACK,
ANIM_BOAT_LB,
ANIM_BIKE_PICKUP_R,
ANIM_BIKE_PICKUP_L,

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);

6435
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();
};
@ -222,91 +233,15 @@ 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,
// order from GetPedCommentSfx
uint32 GetPlayerTalkSfx(int16 sound);
uint32 GetCopTalkSfx(int16 sound);
uint32 GetSwatTalkSfx(int16 sound);
uint32 GetFBITalkSfx(int16 sound);
uint32 GetArmyTalkSfx(int16 sound);
uint32 GetMedicTalkSfx(int16 sound);
uint32 GetFiremanTalkSfx(int16 sound);
uint32 GetNormalMaleTalkSfx(int16 sound);
uint32 GetTaxiDriverTalkSfx(int16 sound);
uint32 GetPimpTalkSfx(int16 sound);
uint32 GetMafiaTalkSfx(int16 sound);
uint32 GetTriadTalkSfx(int16 sound);
uint32 GetDiabloTalkSfx(int16 sound);
uint32 GetYakuzaTalkSfx(int16 sound);
uint32 GetYardieTalkSfx(int16 sound);
uint32 GetColumbianTalkSfx(int16 sound);
uint32 GetHoodTalkSfx(int16 sound);
uint32 GetBlackCriminalTalkSfx(int16 sound);
uint32 GetWhiteCriminalTalkSfx(int16 sound);
uint32 GetMaleNo2TalkSfx(int16 sound);
uint32 GetBlackProjectMaleTalkSfx(int16 sound, int32 model);
uint32 GetWhiteFatMaleTalkSfx(int16 sound);
uint32 GetBlackFatMaleTalkSfx(int16 sound);
uint32 GetBlackCasualFemaleTalkSfx(int16 sound);
uint32 GetWhiteCasualFemaleTalkSfx(int16 sound);
uint32 GetFemaleNo3TalkSfx(int16 sound);
uint32 GetBlackFatFemaleTalkSfx(int16 sound);
uint32 GetWhiteFatFemaleTalkSfx(int16 sound);
uint32 GetBlackFemaleProstituteTalkSfx(int16 sound);
uint32 GetWhiteFemaleProstituteTalkSfx(int16 sound);
uint32 GetBlackProjectFemaleOldTalkSfx(int16 sound);
uint32 GetBlackProjectFemaleYoungTalkSfx(int16 sound);
uint32 GetChinatownMaleOldTalkSfx(int16 sound);
uint32 GetChinatownMaleYoungTalkSfx(int16 sound);
uint32 GetChinatownFemaleOldTalkSfx(int16 sound);
uint32 GetChinatownFemaleYoungTalkSfx(int16 sound);
uint32 GetLittleItalyMaleTalkSfx(int16 sound);
uint32 GetLittleItalyFemaleOldTalkSfx(int16 sound);
uint32 GetLittleItalyFemaleYoungTalkSfx(int16 sound);
uint32 GetWhiteDockerMaleTalkSfx(int16 sound);
uint32 GetBlackDockerMaleTalkSfx(int16 sound);
uint32 GetScumMaleTalkSfx(int16 sound);
uint32 GetScumFemaleTalkSfx(int16 sound);
uint32 GetWhiteWorkerMaleTalkSfx(int16 sound);
uint32 GetBlackWorkerMaleTalkSfx(int16 sound);
uint32 GetBusinessMaleYoungTalkSfx(int16 sound, int32 model);
uint32 GetBusinessMaleOldTalkSfx(int16 sound);
uint32 GetWhiteBusinessFemaleTalkSfx(int16 sound, int32 model);
uint32 GetBlackBusinessFemaleTalkSfx(int16 sound);
uint32 GetSupermodelMaleTalkSfx(int16 sound);
uint32 GetSupermodelFemaleTalkSfx(int16 sound);
uint32 GetStewardMaleTalkSfx(int16 sound);
uint32 GetStewardFemaleTalkSfx(int16 sound);
uint32 GetFanMaleTalkSfx(int16 sound, int32 model);
uint32 GetFanFemaleTalkSfx(int16 sound);
uint32 GetHospitalMaleTalkSfx(int16 sound);
uint32 GetHospitalFemaleTalkSfx(int16 sound);
uint32 GetWhiteConstructionWorkerTalkSfx(int16 sound);
uint32 GetBlackConstructionWorkerTalkSfx(int16 sound);
uint32 GetShopperFemaleTalkSfx(int16 sound, int32 model);
uint32 GetStudentMaleTalkSfx(int16 sound);
uint32 GetStudentFemaleTalkSfx(int16 sound);
uint32 GetCasualMaleOldTalkSfx(int16 sound);
uint32 GetSpecialCharacterTalkSfx(int32 modelIndex, int32 sound);
uint32 GetEightTalkSfx(int16 sound);
uint32 GetFrankieTalkSfx(int16 sound);
uint32 GetMistyTalkSfx(int16 sound);
uint32 GetOJGTalkSfx(int16 sound);
uint32 GetCatatalinaTalkSfx(int16 sound);
uint32 GetBomberTalkSfx(int16 sound);
uint32 GetSecurityGuardTalkSfx(int16 sound);
uint32 GetChunkyTalkSfx(int16 sound);
uint32 GetGenericMaleTalkSfx(int16 sound);
uint32 GetGenericFemaleTalkSfx(int16 sound);
// TODO: miami
// end of functions returning talk sfx
void GenerateIntegerRandomNumberTable();
@ -318,7 +253,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);
@ -387,7 +322,6 @@ public:
void ProcessModelCarEngine(cVehicleParams *params);
void ProcessOneShotScriptObject(uint8 sound);
void ProcessPed(CPhysical *ped);
void ProcessPedHeadphones(cPedParams *params);
void ProcessPedOneShots(cPedParams *params);
void ProcessPhysical(int32 id);
void ProcessPlane(cVehicleParams *params);
@ -434,14 +368,14 @@ public:
void ServiceSoundEffects();
int8 SetCurrent3DProvider(uint8 which);
void SetDynamicAcousticModelingStatus(bool status);
void SetEffectsFadeVolume(uint8 volume) const;
void SetEffectsFadeVol(uint8 volume) const;
void SetEffectsMasterVolume(uint8 volume) const;
void SetEntityStatus(int32 id, uint8 status);
uint32 SetLoopingCollisionRequestedSfxFreqAndGetVol(const cAudioCollision &audioCollision);
void SetMissionAudioLocation(float x, float y, float z);
void SetMissionScriptPoliceAudio(int32 sfx) const;
void SetMonoMode(uint8); // todo (mobile)
void SetMusicFadeVolume(uint8 volume) const;
void SetMusicFadeVol(uint8 volume) const;
void SetMusicMasterVolume(uint8 volume) const;
void SetSpeakerConfig(int32 conf) const;
void SetUpLoopingCollisionSound(const cAudioCollision &col, uint8 counter);
@ -464,11 +398,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

@ -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);
}
@ -82,7 +82,7 @@ cDMAudio::SetEffectsFadeVol(uint8 volume)
uint8 vol = volume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
AudioManager.SetEffectsFadeVolume(vol);
AudioManager.SetEffectsFadeVol(vol);
}
void
@ -91,7 +91,7 @@ cDMAudio::SetMusicFadeVol(uint8 volume)
uint8 vol = volume;
if ( vol > MAX_VOLUME ) vol = MAX_VOLUME;
AudioManager.SetMusicFadeVolume(vol);
AudioManager.SetMusicFadeVol(vol);
}
uint8

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);

View file

@ -21,8 +21,6 @@ int32 gNumRetunePresses;
int32 gRetuneCounter;
bool bHasStarted;
const int maxVolume = 127;
cMusicManager::cMusicManager()
{
m_bIsInitialised = false;
@ -376,7 +374,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;
}
@ -677,7 +675,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;
}
}

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;
@ -227,7 +226,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

@ -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;

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;
}

368
src/audio/sampman_null.cpp Normal file
View file

@ -0,0 +1,368 @@
#include "common.h"
#if !defined(AUDIO_OAL) && !defined(AUDIO_MSS)
#include "sampman.h"
#include "AudioManager.h"
cSampleManager SampleManager;
bool _bSampmanInitialised = false;
uint32 BankStartOffset[MAX_SAMPLEBANKS];
uint32 nNumMP3s;
cSampleManager::cSampleManager(void)
{
;
}
cSampleManager::~cSampleManager(void)
{
}
void cSampleManager::SetSpeakerConfig(int32 nConfig)
{
}
uint32 cSampleManager::GetMaximumSupportedChannels(void)
{
return MAXCHANNELS;
}
uint32 cSampleManager::GetNum3DProvidersAvailable()
{
return 1;
}
void cSampleManager::SetNum3DProvidersAvailable(uint32 num)
{
}
char *cSampleManager::Get3DProviderName(uint8 id)
{
static char name[64] = "NULL";
return name;
}
void cSampleManager::Set3DProviderName(uint8 id, char *name)
{
}
int8 cSampleManager::GetCurrent3DProviderIndex(void)
{
return 0;
}
int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
{
return 0;
}
bool
cSampleManager::IsMP3RadioChannelAvailable(void)
{
return nNumMP3s != 0;
}
void cSampleManager::ReleaseDigitalHandle(void)
{
}
void cSampleManager::ReacquireDigitalHandle(void)
{
}
bool
cSampleManager::Initialise(void)
{
return true;
}
void
cSampleManager::Terminate(void)
{
}
bool cSampleManager::CheckForAnAudioFileOnCD(void)
{
return true;
}
char cSampleManager::GetCDAudioDriveLetter(void)
{
return '\0';
}
void
cSampleManager::UpdateEffectsVolume(void)
{
}
void
cSampleManager::SetEffectsMasterVolume(uint8 nVolume)
{
}
void
cSampleManager::SetMusicMasterVolume(uint8 nVolume)
{
}
void
cSampleManager::SetEffectsFadeVolume(uint8 nVolume)
{
}
void
cSampleManager::SetMusicFadeVolume(uint8 nVolume)
{
}
void
cSampleManager::SetMonoMode(uint8 nMode)
{
}
bool
cSampleManager::LoadSampleBank(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
return false;
}
void
cSampleManager::UnloadSampleBank(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
}
bool
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
ASSERT( nBank < MAX_SAMPLEBANKS );
return false;
}
bool
cSampleManager::IsPedCommentLoaded(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
return false;
}
int32
cSampleManager::_GetPedCommentSlot(uint32 nComment)
{
return -1;
}
bool
cSampleManager::LoadPedComment(uint32 nComment)
{
ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
return false;
}
int32
cSampleManager::GetBankContainingSound(uint32 offset)
{
return SAMPLEBANK_INVALID;
}
int32
cSampleManager::GetSampleBaseFrequency(uint32 nSample)
{
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
return 0;
}
int32
cSampleManager::GetSampleLoopStartOffset(uint32 nSample)
{
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
return 0;
}
int32
cSampleManager::GetSampleLoopEndOffset(uint32 nSample)
{
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
return 0;
}
uint32
cSampleManager::GetSampleLength(uint32 nSample)
{
ASSERT( nSample < TOTAL_AUDIO_SAMPLES );
return 0;
}
bool cSampleManager::UpdateReverb(void)
{
return false;
}
void
cSampleManager::SetChannelReverbFlag(uint32 nChannel, uint8 nReverbFlag)
{
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
bool
cSampleManager::InitialiseChannel(uint32 nChannel, uint32 nSfx, uint8 nBank)
{
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
return false;
}
void
cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
{
ASSERT( nChannel != CHANNEL2D );
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::SetChannel3DPosition(uint32 nChannel, float fX, float fY, float fZ)
{
ASSERT( nChannel != CHANNEL2D );
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::SetChannel3DDistances(uint32 nChannel, float fMax, float fMin)
{
ASSERT( nChannel != CHANNEL2D );
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
{
ASSERT( nChannel == CHANNEL2D );
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::SetChannelPan(uint32 nChannel, uint32 nPan)
{
ASSERT(nChannel == CHANNEL2D);
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::SetChannelFrequency(uint32 nChannel, uint32 nFreq)
{
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::SetChannelLoopPoints(uint32 nChannel, uint32 nLoopStart, int32 nLoopEnd)
{
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::SetChannelLoopCount(uint32 nChannel, uint32 nLoopCount)
{
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
bool
cSampleManager::GetChannelUsedFlag(uint32 nChannel)
{
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
return false;
}
void
cSampleManager::StartChannel(uint32 nChannel)
{
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::StopChannel(uint32 nChannel)
{
ASSERT( nChannel < MAXCHANNELS+MAX2DCHANNELS );
}
void
cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
{
ASSERT( nStream < MAX_STREAMS );
}
void
cSampleManager::PauseStream(uint8 nPauseFlag, uint8 nStream)
{
ASSERT( nStream < MAX_STREAMS );
}
void
cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
{
ASSERT( nStream < MAX_STREAMS );
}
bool
cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
{
ASSERT( nStream < MAX_STREAMS );
return false;
}
void
cSampleManager::StopStreamedFile(uint8 nStream)
{
ASSERT( nStream < MAX_STREAMS );
}
int32
cSampleManager::GetStreamedFilePosition(uint8 nStream)
{
ASSERT( nStream < MAX_STREAMS );
return 0;
}
void
cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream)
{
ASSERT( nStream < MAX_STREAMS );
}
int32
cSampleManager::GetStreamedFileLength(uint8 nStream)
{
ASSERT( nStream < TOTAL_STREAMED_SOUNDS );
return 1;
}
bool
cSampleManager::IsStreamPlaying(uint8 nStream)
{
ASSERT( nStream < MAX_STREAMS );
return false;
}
bool
cSampleManager::InitialiseSampleBanks(void)
{
return true;
}
#endif

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_9A = 154,
SOUND_9B = 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_17,
SOUND_18,
SOUND_19,
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_4A,
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, // 103 in VC
SOUND_PED_DAMAGE, // 104 in VC
SOUND_PED_HIT, // 105 in VC
SOUND_PED_LAND, // hopefully 106 in VC
SOUND_PED_BULLET_HIT,
SOUND_PED_BOMBER,
SOUND_PED_BURNING, // 108 in VC
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, // 120 in VC
SOUND_PED_CAR_JACKING,
SOUND_PED_MUGGING,
SOUND_PED_CAR_JACKED,
SOUND_PED_ROBBED,
SOUND_PED_TAXI_WAIT, // 137 in VC
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, // 142 in VC
SOUND_PED_FLEE_RUN,
SOUND_PED_CAR_COLLISION, // 144-145-146 in VC
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_COMPLETED,
SOUND_FRONTEND_MENU_DENIED,
SOUND_FRONTEND_MENU_SUCCESS,
SOUND_FRONTEND_EXIT,
SOUND_9A,
SOUND_9B,
SOUND_FRONTEND_AUDIO_TEST,
SOUND_FRONTEND_FAIL,
SOUND_FRONTEND_NO_RADIO,
SOUND_FRONTEND_RADIO_CHANGE,
SOUND_A0,
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_110,
SCRIPT_SOUND_111,
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

@ -22,19 +22,18 @@
#define DISTANCE_TO_SWITCH_DISTANCE_GOTO 20.0f
//--MIAMI: done
//--MIAMI: file done
float CCarAI::FindSwitchDistanceClose(CVehicle* pVehicle)
{
return pVehicle->AutoPilot.m_nSwitchDistance;
}
//--MIAMI: done
float CCarAI::FindSwitchDistanceFarNormalVehicle(CVehicle* pVehicle)
{
return FindSwitchDistanceClose(pVehicle) + 5.0f;
}
//--MIAMI: done
float CCarAI::FindSwitchDistanceFar(CVehicle* pVehicle)
{
if (pVehicle->bIsLawEnforcer)
@ -42,7 +41,6 @@ float CCarAI::FindSwitchDistanceFar(CVehicle* pVehicle)
return FindSwitchDistanceFarNormalVehicle(pVehicle);
}
//--MIAMI: done
void CCarAI::BackToCruisingIfNoWantedLevel(CVehicle* pVehicle)
{
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
@ -56,7 +54,6 @@ void CCarAI::BackToCruisingIfNoWantedLevel(CVehicle* pVehicle)
}
}
//--MIAMI: done
void CCarAI::UpdateCarAI(CVehicle* pVehicle)
{
if (pVehicle->bIsLawEnforcer){
@ -350,6 +347,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
if (!FindPlayerVehicle() || DotProduct2D(CVector2D(diff.x / distance, diff.y / distance), FindPlayerSpeed()) > 0.05f)
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_CLOSE;
BackToCruisingIfNoWantedLevel(pVehicle);
break;
}
default:
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0 && !CCullZones::NoPolice()){
@ -358,7 +356,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->AutoPilot.m_nCarMission =
pVehicle->GetVehicleAppearance() == VEHICLE_BOAT ? FindPoliceBoatMissionForWantedLevel() : FindPoliceCarMissionForWantedLevel();
pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT ? FindPoliceBoatMissionForWantedLevel() : FindPoliceCarMissionForWantedLevel();
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
}else if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE){
@ -432,7 +430,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
if (pVehicle->bIsLawEnforcer) {
if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY ||
pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE) {
if (FindPlayerVehicle() && FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_BIKE)
if (FindPlayerVehicle() && FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE)
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_FARAWAY;
}
}
@ -489,16 +487,16 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0) {
if (!FindPlayerVehicle() ||
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_CAR ||
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_BIKE) {
if (pVehicle->GetVehicleAppearance() == VEHICLE_BOAT) {
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR ||
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) {
if (pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT) {
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000;
}
}
else if (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_BOAT) {
if (pVehicle->GetVehicleAppearance() == VEHICLE_CAR ||
pVehicle->GetVehicleAppearance() == VEHICLE_BIKE) {
else if (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT) {
if (pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR ||
pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) {
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000;
}
@ -506,13 +504,11 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
}
}
//--MIAMI: done
void CCarAI::CarHasReasonToStop(CVehicle* pVehicle)
{
pVehicle->AutoPilot.m_nAntiReverseTimer = CTimer::GetTimeInMilliseconds();
}
//--MIAMI: done
float CCarAI::GetCarToGoToCoors(CVehicle* pVehicle, CVector* pTarget)
{
if (pVehicle->AutoPilot.m_nCarMission != MISSION_GOTOCOORDS && pVehicle->AutoPilot.m_nCarMission != MISSION_GOTOCOORDS_STRAIGHT){
@ -530,7 +526,6 @@ float CCarAI::GetCarToGoToCoors(CVehicle* pVehicle, CVector* pTarget)
return (pVehicle->GetPosition() - *pTarget).Magnitude2D();
}
//--MIAMI: done
float CCarAI::GetCarToParkAtCoors(CVehicle* pVehicle, CVector* pTarget)
{
GetCarToGoToCoors(pVehicle, pTarget);
@ -539,7 +534,6 @@ float CCarAI::GetCarToParkAtCoors(CVehicle* pVehicle, CVector* pTarget)
return (pVehicle->GetPosition() - *pTarget).Magnitude2D();
}
//--MIAMI: TODO: MI_VICECHEE
void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
{
if (pVehicle->bOccupantsHaveBeenGenerated)
@ -576,21 +570,18 @@ void CCarAI::AddPoliceCarOccupants(CVehicle* pVehicle)
}
}
//--MIAMI: done
void CCarAI::AddAmbulanceOccupants(CVehicle* pVehicle)
{
pVehicle->SetUpDriver();
pVehicle->SetupPassenger(1);
}
//--MIAMI: done
void CCarAI::AddFiretruckOccupants(CVehicle* pVehicle)
{
pVehicle->SetUpDriver();
pVehicle->SetupPassenger(0);
}
//--MIAMI: done
void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle)
{
if (pVehicle->pDriver){
@ -608,7 +599,6 @@ void CCarAI::TellOccupantsToLeaveCar(CVehicle* pVehicle)
}
}
//--MIAMI: done
void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle)
{
if (pVehicle->pDriver && !pVehicle->pDriver->IsPlayer()) {
@ -626,7 +616,6 @@ void CCarAI::TellOccupantsToFleeCar(CVehicle* pVehicle)
}
}
//--MIAMI: done
void CCarAI::TellCarToRamOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
{
pVehicle->AutoPilot.m_pTargetCar = pTarget;
@ -636,7 +625,6 @@ void CCarAI::TellCarToRamOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
}
//--MIAMI: done
void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
{
pVehicle->AutoPilot.m_pTargetCar = pTarget;
@ -646,7 +634,6 @@ void CCarAI::TellCarToBlockOtherCar(CVehicle* pVehicle, CVehicle* pTarget)
pVehicle->AutoPilot.m_nCruiseSpeed = Max(6, pVehicle->AutoPilot.m_nCruiseSpeed);
}
//--MIAMI: done
eCarMission CCarAI::FindPoliceCarMissionForWantedLevel()
{
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel){
@ -661,7 +648,6 @@ eCarMission CCarAI::FindPoliceCarMissionForWantedLevel()
}
}
//--MIAMI: done
eCarMission CCarAI::FindPoliceBoatMissionForWantedLevel()
{
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) {
@ -676,7 +662,6 @@ eCarMission CCarAI::FindPoliceBoatMissionForWantedLevel()
}
}
//--MIAMI: done
int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
{
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) {
@ -691,7 +676,6 @@ int32 CCarAI::FindPoliceCarSpeedForWantedLevel(CVehicle* pVehicle)
}
}
//--MIAMI: done
void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
{
if (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel == 1){
@ -736,7 +720,6 @@ void CCarAI::MellowOutChaseSpeed(CVehicle* pVehicle)
}
}
//--MIAMI: done
void CCarAI::MellowOutChaseSpeedBoat(CVehicle* pVehicle)
{
switch (CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted->m_nWantedLevel) {
@ -750,7 +733,6 @@ void CCarAI::MellowOutChaseSpeedBoat(CVehicle* pVehicle)
}
}
//--MIAMI: done
void CCarAI::MakeWayForCarWithSiren(CVehicle *pVehicle)
{
float flatSpeed = pVehicle->GetMoveSpeed().Magnitude2D();

View file

@ -105,6 +105,8 @@ int32 CCarCtrl::LoadedCarsArray[TOTAL_CUSTOM_CLASSES][MAX_CAR_MODELS_IN_ARRAY];
CVehicle* apCarsToKeep[MAX_CARS_TO_KEEP];
uint32 aCarsToKeepTime[MAX_CARS_TO_KEEP];
//--MIAMI: done except heli/plane functions
void
CCarCtrl::GenerateRandomCars()
{
@ -500,10 +502,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];
@ -655,10 +653,10 @@ CCarCtrl::GenerateOneRandomCar()
}
int nMadDrivers;
switch (pVehicle->GetVehicleAppearance()) {
case VEHICLE_BIKE:
case VEHICLE_APPEARANCE_BIKE:
nMadDrivers = 30;
break;
case VEHICLE_BOAT:
case VEHICLE_APPEARANCE_BOAT:
nMadDrivers = 40;
break;
default:
@ -889,8 +887,7 @@ CCarCtrl::ChoosePoliceCarModel(void)
int32
CCarCtrl::ChooseGangCarModel(int32 gang)
{
if (CStreaming::HasModelLoaded(MI_GANG01 + 2 * gang) &&
CStreaming::HasModelLoaded(MI_GANG01+1 + 2 * gang))
if (CGangs::HaveGangModelsLoaded(gang))
return CGangs::GetGangVehicleModel(gang);
return -1;
}
@ -912,7 +909,7 @@ CCarCtrl::RemoveDistantCars()
PossiblyRemoveVehicle(pVehicle);
if (pVehicle->bCreateRoadBlockPeds){
if ((pVehicle->GetPosition() - FindPlayerCentreOfWorld(CWorld::PlayerInFocus)).Magnitude2D() < DISTANCE_TO_SPAWN_ROADBLOCK_PEDS) {
CRoadBlocks::GenerateRoadBlockCopsForCar(pVehicle, pVehicle->m_nRoadblockType, pVehicle->m_nRoadblockNode);
CRoadBlocks::GenerateRoadBlockCopsForCar(pVehicle, pVehicle->m_nRoadblockType);
pVehicle->bCreateRoadBlockPeds = false;
}
}
@ -972,7 +969,8 @@ CCarCtrl::PossiblyRemoveVehicle(CVehicle* pVehicle)
pVehicle->GetModelIndex() == MI_AMBULAN ||
pVehicle->GetModelIndex() == MI_FIRETRUCK ||
pVehicle->bIsLawEnforcer ||
pVehicle->bIsCarParkVehicle
pVehicle->bIsCarParkVehicle ||
CTimer::GetTimeInMilliseconds() < pVehicle->m_nSetPieceExtendedRangeTime
){
threshold = ONSCREEN_DESPAWN_RANGE * TheCamera.GenerationDistMultiplier;
}
@ -1898,12 +1896,18 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nNextLane = 0;
#ifdef FIX_BUGS
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);
#else
CVector positionOnCurrentLinkIncludingLane(
@ -2516,7 +2520,7 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
pSwerve, pAccel, pBrake, pHandbrake);
return;
case MISSION_BLOCKPLAYER_FORWARDANDBACK:
//SteerAICarBlockingPlayerForwardAndBack(pVehicle, pSwerve, pAccel, pBrake, pHandbrake);
SteerAICarBlockingPlayerForwardAndBack(pVehicle, pSwerve, pAccel, pBrake, pHandbrake);
return;
default:
assert(0);
@ -2524,6 +2528,45 @@ void CCarCtrl::SteerAICarWithPhysics_OnlyMission(CVehicle* pVehicle, float* pSwe
}
}
void CCarCtrl::SteerAICarBlockingPlayerForwardAndBack(CVehicle* pVehicle, float* pSwerve, float* pAccel, float* pBrake, bool* pHandbrake)
{
*pSwerve = 0.0f;
*pHandbrake = false;
CVector player = FindPlayerSpeed() + 0.1f * FindPlayerEntity()->GetForward();
player.z = 0.0f;
CVector right(pVehicle->GetRight().x, pVehicle->GetRight().y, 0.0f);
right.Normalise();
CVector forward(pVehicle->GetForward().x, pVehicle->GetForward().y, 0.0f);
forward.Normalise();
float dpPlayerAndRight = DotProduct(player, right);
if (dpPlayerAndRight == 0.0f)
dpPlayerAndRight = 0.01f;
float dpDiffAndRight = -DotProduct((FindPlayerCoors() - pVehicle->GetPosition()), right) / dpPlayerAndRight;
if (dpDiffAndRight < 0.0f) {
*pAccel = 0.0f;
*pBrake = 0.0f;
return;
}
float dpSpeedAndForward = DotProduct(pVehicle->GetMoveSpeed(), forward);
float dpPlayerAndForward = DotProduct(player, forward);
float dpDiffAndForward = DotProduct((FindPlayerCoors() - pVehicle->GetPosition()), forward);
float multiplier = dpPlayerAndForward * dpDiffAndRight + dpDiffAndForward - dpSpeedAndForward * dpDiffAndRight;
if (multiplier > 0) {
*pAccel = Min(1.0f, 0.1f * multiplier);
*pBrake = 0.0f;
}
else if (dpSpeedAndForward > 0) {
*pAccel = 0.0f;
*pBrake = Min(1.0f, -0.1f * multiplier);
if (*pBrake > 0.95f)
*pHandbrake = true;
}
else {
*pAccel = Max(-1.0f, 0.1f * multiplier);
*pBrake = 0.0f;
}
}
void CCarCtrl::SteerAIBoatWithPhysicsHeadingForTarget(CVehicle* pVehicle, float targetX, float targetY, float* pSwerve, float* pAccel, float* pBrake)
{
CVector2D forward = pVehicle->GetForward();
@ -2996,7 +3039,9 @@ void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
CPathNode* pNode = &ThePaths.m_pathNodes[node];
if (node == pVehicle->AutoPilot.m_nNextRouteNode)
continue;
float dist = CCollision::DistToLine(&pCurNode->GetPosition(), &pNode->GetPosition(), &pVehicle->GetPosition());
CVector vCurPos = pCurNode->GetPosition();
CVector vNextPos = pNode->GetPosition();
float dist = CCollision::DistToLine(&vCurPos, &vNextPos, &pVehicle->GetPosition());
if (dist < md) {
md = dist;
closestLink = curLink;

View file

@ -9,6 +9,7 @@
#define TIME_COPS_WAIT_TO_EXIT_AFTER_STOPPING 2500
class CZoneInfo;
class CAutomobile;
enum{
MAX_CARS_TO_KEEP = 2,
@ -39,19 +40,19 @@ public:
WORKERBOAT,
COPS,
MAFIA,
TRIAD,
DIABLO,
YAKUZA,
YARDIE,
COLOMB,
NINES,
GANG8,
CUBAN,
HAITIAN,
STREET,
DIAZ,
BIKER,
SECURITY,
PLAYER,
GOLFERS,
GANG9,
COPS_BOAT,
FIRST_CAR_RATING = NORMAL,
FIRST_BOAT_RATING = LEISUREBOAT,
FIRST_GANG_CAR_RATING = MAFIA,
FIRST_GANG_CAR_RATING = CUBAN,
NUM_CAR_CLASSES = MOTORBIKE - FIRST_CAR_RATING + 1,
NUM_BOAT_CLASSES = WORKERBOAT - FIRST_BOAT_RATING + 1,
NUM_GANG_CAR_CLASSES = GANG9 - FIRST_GANG_CAR_RATING + 1,

View file

@ -2,6 +2,8 @@
#include "Curves.h"
//--MIAMI: file done
float CCurves::CalcSpeedScaleFactor(CVector* pPoint1, CVector* pPoint2, float dir1X, float dir1Y, float dir2X, float dir2Y)
{
CVector2D dir1(dir1X, dir1Y);

View file

@ -960,7 +960,7 @@ void CGarage::Update()
if (m_pDoor1) {
if (((CVector2D)FindPlayerVehicle()->GetPosition() - (CVector2D)m_pDoor1->GetPosition()).MagnitudeSqr() < SQR(DISTANCE_TO_SHOW_HIDEOUT_MESSAGE) &&
CTimer::GetTimeInMilliseconds() - CGarages::LastTimeHelpMessage > TIME_BETWEEN_HIDEOUT_MESSAGES) {
if (FindPlayerVehicle()->GetVehicleAppearance() != VEHICLE_HELI && FindPlayerVehicle()->GetVehicleAppearance() != VEHICLE_PLANE) {
if (FindPlayerVehicle()->GetVehicleAppearance() != VEHICLE_APPEARANCE_HELI && FindPlayerVehicle()->GetVehicleAppearance() != VEHICLE_APPEARANCE_PLANE) {
CHud::SetHelpMessage(TheText.Get("GA_21"), false); // You cannot store any more cars in this garage.
CGarages::LastTimeHelpMessage = CTimer::GetTimeInMilliseconds();
}
@ -1781,7 +1781,14 @@ CVehicle* CStoredCar::RestoreCar()
CStreaming::RequestModel(m_nModelIndex, STREAMFLAGS_DEPENDENCY);
if (!CStreaming::HasModelLoaded(m_nModelIndex))
return nil;
CVehicleModelInfo::SetComponentsToUse(m_nVariationA, m_nVariationB);
#ifdef FIX_BUGS
CVehicleModelInfo* pModelInfo = (CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex);
assert(pModelInfo);
if (pModelInfo->m_numComps != 0)
#endif
{
CVehicleModelInfo::SetComponentsToUse(m_nVariationA, m_nVariationB);
}
CVehicle* pVehicle;
if (CModelInfo::IsBoatModel(m_nModelIndex))
pVehicle = new CBoat(m_nModelIndex, RANDOM_VEHICLE);
@ -2119,12 +2126,8 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
// TODO(MIAMI)
void CGarages::Save(uint8 * buf, uint32 * size)
{
#ifdef FIX_GARAGE_SIZE
INITSAVEBUF
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
#else
* size = 5484;
#endif
INITSAVEBUF
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
CloseHideOutGaragesBeforeSave();
WriteSaveBuf(buf, NumGarages);
WriteSaveBuf(buf, (uint32)BombsAreFree);
@ -2142,9 +2145,7 @@ void CGarages::Save(uint8 * buf, uint32 * size)
}
for (int i = 0; i < NUM_GARAGES; i++)
WriteSaveBuf(buf, aGarages[i]);
#ifdef FIX_GARAGE_SIZE
VALIDATESAVEBUF(*size);
#endif
VALIDATESAVEBUF(*size);
}
const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
@ -2169,12 +2170,8 @@ const CStoredCar &CStoredCar::operator=(const CStoredCar & other)
//TODO(MIAMI)
void CGarages::Load(uint8* buf, uint32 size)
{
#ifdef FIX_GARAGE_SIZE
INITSAVEBUF
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + 3 * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
#else
assert(size == 5484);
#endif
INITSAVEBUF
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
CloseHideOutGaragesBeforeSave();
NumGarages = ReadSaveBuf<uint32>(buf);
BombsAreFree = ReadSaveBuf<uint32>(buf);
@ -2203,9 +2200,7 @@ void CGarages::Load(uint8* buf, uint32 size)
else
aGarages[i].UpdateDoorsHeight();
}
#ifdef FIX_GARAGE_SIZE
VALIDATESAVEBUF(size);
#endif
VALIDATESAVEBUF(size);
MessageEndTime = 0;
bCamShouldBeOutisde = false;

View file

@ -294,7 +294,6 @@ private:
case GARAGE_HIDEOUT_TEN: return 9;
case GARAGE_HIDEOUT_ELEVEN: return 10;
case GARAGE_HIDEOUT_TWELVE: return 11;
default: assert(0);
}
return -1;
}

View file

@ -20,8 +20,9 @@ void COnscreenTimer::Init() {
}
m_sEntries[i].m_nType = COUNTER_DISPLAY_NUMBER;
m_sEntries[i].m_bTimerProcessed = 0;
m_sEntries[i].m_bCounterProcessed = 0;
m_sEntries[i].m_bTimerProcessed = false;
m_sEntries[i].m_bCounterProcessed = false;
m_sEntries[i].m_bTimerGoingDown = true;
}
}
@ -65,26 +66,21 @@ void COnscreenTimer::ClearClock(uint32 offset) {
}
}
void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text) {
uint32 i = 0;
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
if(m_sEntries[i].m_nCounterOffset == 0) {
break;
}
void COnscreenTimer::AddCounter(uint32 offset, uint16 type, char* text, uint16 pos) {
m_sEntries[pos].m_nCounterOffset = offset;
if (m_sEntries[pos].m_aCounterText[0] != '\0')
return;
}
m_sEntries[i].m_nCounterOffset = offset;
if(text) {
strncpy(m_sEntries[i].m_aCounterText, text, 10);
strncpy(m_sEntries[pos].m_aCounterText, text, 10);
} else {
m_sEntries[i].m_aCounterText[0] = 0;
m_sEntries[pos].m_aCounterText[0] = 0;
}
m_sEntries[i].m_nType = type;
m_sEntries[pos].m_nType = type;
}
void COnscreenTimer::AddClock(uint32 offset, char* text) {
void COnscreenTimer::AddClock(uint32 offset, char* text, bool bGoingDown) {
uint32 i = 0;
for(uint32 i = 0; i < NUMONSCREENTIMERENTRIES; i++) {
if(m_sEntries[i].m_nTimerOffset == 0) {
@ -94,6 +90,7 @@ void COnscreenTimer::AddClock(uint32 offset, char* text) {
}
m_sEntries[i].m_nTimerOffset = offset;
m_sEntries[i].m_bTimerGoingDown = bGoingDown;
if(text) {
strncpy(m_sEntries[i].m_aTimerText, text, 10);
} else {
@ -108,19 +105,24 @@ void COnscreenTimerEntry::Process() {
int32* timerPtr = CTheScripts::GetPointerToScriptVariable(m_nTimerOffset);
int32 oldTime = *timerPtr;
int32 newTime = oldTime - int32(CTimer::GetTimeStepInSeconds() * 1000);
if(newTime < 0) {
*timerPtr = 0;
m_bTimerProcessed = 0;
m_nTimerOffset = 0;
m_aTimerText[0] = 0;
} else {
*timerPtr = newTime;
int32 oldTimeSeconds = oldTime / 1000;
if(oldTimeSeconds < 12 && newTime / 1000 != oldTimeSeconds) {
DMAudio.PlayFrontEndSound(SOUND_CLOCK_TICK, newTime / 1000);
if (m_bTimerGoingDown) {
int32 newTime = oldTime - int32(CTimer::GetTimeStepInMilliseconds());
if (newTime < 0) {
*timerPtr = 0;
m_bTimerProcessed = 0;
m_nTimerOffset = 0;
m_aTimerText[0] = 0;
}
else {
*timerPtr = newTime;
int32 oldTimeSeconds = oldTime / 1000;
if (oldTimeSeconds < 12 && newTime / 1000 != oldTimeSeconds) {
DMAudio.PlayFrontEndSound(SOUND_CLOCK_TICK, newTime / 1000);
}
}
}
else
*timerPtr = oldTime + int32(CTimer::GetTimeStepInMilliseconds());
}
bool COnscreenTimerEntry::ProcessForDisplay() {

View file

@ -17,6 +17,7 @@ public:
char m_bCounterBuffer[42];
char m_bTimerBuffer[42];
bool m_bTimerProcessed;
bool m_bTimerGoingDown;
bool m_bCounterProcessed;
void Process();
@ -42,8 +43,8 @@ public:
void ClearCounter(uint32 offset);
void ClearClock(uint32 offset);
void AddCounter(uint32 offset, uint16 type, char* text);
void AddClock(uint32 offset, char* text);
void AddCounter(uint32 offset, uint16 type, char* text, uint16 pos);
void AddClock(uint32 offset, char* text, bool bGoingDown);
};
VALIDATE_SIZE(COnscreenTimer, 0x78);

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
@ -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;
}
@ -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;
}

View file

@ -44,15 +44,35 @@ uint32 CPickups::StaticCamStartTime;
tPickupMessage CPickups::aMessages[NUMPICKUPMESSAGES];
// 20 ?! Some Miami leftover? (Originally at 0x5ED8D4)
// TODO(Miami)
uint16 AmmoForWeapon[20] = { 0, 1, 45, 125, 25, 150, 300, 25, 5, 250, 5, 5, 0, 500, 0, 100, 0, 0, 0, 0 };
uint16 AmmoForWeapon_OnStreet[20] = { 0, 1, 9, 25, 5, 30, 60, 5, 1, 50, 1, 1, 0, 200, 0, 100, 0, 0, 0, 0 };
// --MIAMI: Done
uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS] = {
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 34,
12, 16, 14, 10, 100, 60, 60, 60, 60, 60, 20, 14,
4, 150, 100, 500, 1, 400, 36, 0,
};
uint16 CostOfWeapon[20] = { 0, 10, 250, 800, 1500, 3000, 5000, 10000, 25000, 25000, 2000, 2000, 0, 50000, 0, 3000, 0, 0, 0, 0 };
uint8 aWeaponReds[] = { 255, 0, 128, 255, 255, 0, 255, 0, 128, 128, 255, 255, 128, 0, 255, 0 };
uint8 aWeaponGreens[] = { 0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255, 0, 255, 0, 255, 0 };
uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 };
float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
// TODO(Miami): Those are all placeholders!!
uint8 aWeaponReds[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 0, 128, 255, 255, 0, 255, 0, 128, 128, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 128, 0, 255, 0 };
uint8 aWeaponGreens[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 255, 0, 255, 0 };
uint8 aWeaponBlues[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
0, 128, 255, 0, 0 };
float aWeaponScale[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
1.0f, 1.0f, 1.0f, 1.0f };
void
CPickup::RemoveKeepType()
@ -93,6 +113,7 @@ CPickup::GiveUsAPickUpObject(int32 handle)
object->bExplosionProof = true;
object->bUsesCollision = false;
object->bIsPickup = true;
object->bHasPreRenderEffects = true;
object->m_nBonusValue = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0;
@ -129,12 +150,12 @@ CPickup::GiveUsAPickUpObject(int32 handle)
}
bool
CPickup::CanBePickedUp(CPlayerPed *player)
CPickup::CanBePickedUp(CPlayerPed *player, int playerId)
{
assert(m_pObject != nil);
bool cannotBePickedUp =
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > 99.5f)
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->m_nWantedLevel == 0)
|| (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
return !cannotBePickedUp;
@ -190,7 +211,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
}
// if we didn't then we've got nothing to do
if (isPickupTouched && CanBePickedUp(player)) {
if (isPickupTouched && CanBePickedUp(player, playerId)) {
CPad::GetPad(0)->StartShake(120, 100);
switch (m_eType)
{
@ -380,6 +401,30 @@ CPickups::Init(void)
CollectedPickUpIndex = 0;
}
// --MIAMI: Done
bool
CPickups::TestForPickupsInBubble(CVector pos, float range)
{
for (int i = 0; i < NUMPICKUPS; i++) {
if ((aPickUps[i].m_vecPos - pos).Magnitude() < range)
return true;
}
return false;
}
// --MIAMI: Done
bool
CPickups::TryToMerge_WeaponType(CVector pos, eWeaponType weapon, uint8 type, uint32 quantity, bool unused) {
for (int i = 0; i < NUMPICKUPS; i++) {
if (aPickUps[i].m_eType == type && aPickUps[i].m_eModelIndex == ModelForWeapon(weapon))
if ((aPickUps[i].m_vecPos - pos).Magnitude() < 7.5f) {
aPickUps[i].m_nQuantity += quantity;
return true;
}
}
return false;
}
bool
CPickups::IsPickUpPickedUp(int32 pickupId)
{
@ -430,14 +475,14 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
DMAudio.PlayFrontEndSound(SOUND_PICKUP_ADRENALINE, 0);
return true;
} else if (modelIndex == MI_PICKUP_BODYARMOUR) {
player->m_fArmour = 100.0f;
player->m_fArmour = CWorld::Players[playerIndex].m_nMaxArmour;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_ARMOUR, 0);
return true;
} else if (modelIndex == MI_PICKUP_INFO) {
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
return true;
} else if (modelIndex == MI_PICKUP_HEALTH) {
player->m_fHealth = 100.0f;
player->m_fHealth = CWorld::Players[playerIndex].m_nMaxHealth;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_HEALTH, 0);
return true;
} else if (modelIndex == MI_PICKUP_BONUS) {
@ -561,53 +606,22 @@ CPickups::GetNewUniquePickupIndex(int32 slot)
return slot | (aPickUps[slot].m_nIndex << 16);
}
// --MIAMI: Done
int32
CPickups::ModelForWeapon(eWeaponType weaponType)
{
switch (weaponType)
{
case WEAPONTYPE_BASEBALLBAT: return MI_BASEBALL_BAT;
case WEAPONTYPE_COLT45: return MI_COLT;
case WEAPONTYPE_UZI: return MI_UZI;
case WEAPONTYPE_SHOTGUN: return MI_SHOTGUN;
case WEAPONTYPE_AK47: return MI_AK47;
case WEAPONTYPE_M16: return MI_M16;
case WEAPONTYPE_SNIPERRIFLE: return MI_SNIPER;
case WEAPONTYPE_ROCKETLAUNCHER: return MI_ROCKETLAUNCHER;
case WEAPONTYPE_FLAMETHROWER: return MI_FLAMETHROWER;
case WEAPONTYPE_MOLOTOV: return MI_MOLOTOV;
case WEAPONTYPE_GRENADE: return MI_GRENADE;
default: break;
}
return 0;
return CWeaponInfo::GetWeaponInfo(weaponType)->m_nModelId;
}
// --MIAMI: Done
eWeaponType
CPickups::WeaponForModel(int32 model)
{
if (model == MI_PICKUP_BODYARMOUR) return WEAPONTYPE_ARMOUR;
switch (model)
{
case MI_GRENADE: return WEAPONTYPE_GRENADE;
case MI_AK47: return WEAPONTYPE_AK47;
case MI_BASEBALL_BAT: return WEAPONTYPE_BASEBALLBAT;
case MI_COLT: return WEAPONTYPE_COLT45;
case MI_MOLOTOV: return WEAPONTYPE_MOLOTOV;
case MI_ROCKETLAUNCHER: return WEAPONTYPE_ROCKETLAUNCHER;
case MI_SHOTGUN: return WEAPONTYPE_SHOTGUN;
case MI_SNIPER: return WEAPONTYPE_SNIPERRIFLE;
case MI_UZI: return WEAPONTYPE_UZI;
case MI_MISSILE: return WEAPONTYPE_UNARMED;
case MI_M16: return WEAPONTYPE_M16;
case MI_FLAMETHROWER: return WEAPONTYPE_FLAMETHROWER;
}
return WEAPONTYPE_UNARMED;
}
int32
CPickups::FindColourIndexForWeaponMI(int32 model)
{
return WeaponForModel(model) - 1;
if (model == MI_PICKUP_HEALTH) return WEAPONTYPE_HEALTH;
if (model == MI_PICKUP_ADRENALINE) return WEAPONTYPE_ARMOUR;
if (model == -1) return WEAPONTYPE_UNARMED;
return (eWeaponType)((CWeaponModelInfo*)CModelInfo::GetModelInfo(model))->GetWeaponInfo();
}
void
@ -685,15 +699,15 @@ CPickups::DoPickUpEffects(CEntity *entity)
int16 colorId;
if (entity->GetModelIndex() == MI_PICKUP_ADRENALINE || entity->GetModelIndex() == MI_PICKUP_CAMERA)
colorId = 11;
colorId = WEAPONTYPE_TOTALWEAPONS;
else if (entity->GetModelIndex() == MI_PICKUP_BODYARMOUR || entity->GetModelIndex() == MI_PICKUP_BRIBE)
colorId = 12;
colorId = WEAPONTYPE_TOTALWEAPONS + 1;
else if (entity->GetModelIndex() == MI_PICKUP_INFO || entity->GetModelIndex() == MI_PICKUP_KILLFRENZY)
colorId = 13;
colorId = WEAPONTYPE_TOTALWEAPONS + 2;
else if (entity->GetModelIndex() == MI_PICKUP_HEALTH || entity->GetModelIndex() == MI_PICKUP_BONUS)
colorId = 14;
colorId = WEAPONTYPE_TOTALWEAPONS + 3;
else
colorId = FindColourIndexForWeaponMI(entity->GetModelIndex());
colorId = WeaponForModel(entity->GetModelIndex());
assert(colorId >= 0);
@ -981,6 +995,25 @@ CPickups::RenderPickUpText()
NumMessages = 0;
}
void
CPickups::CreateSomeMoney(CVector pos, int money)
{
bool found;
int pickupCount = Min(money / 20 + 1, 7);
int moneyPerPickup = money / pickupCount;
for (int i = 0; i < pickupCount; i++) {
// (CGeneral::GetRandomNumber() % 256) * PI / 128 gives a float up to something TWOPI-ish.
pos.x += 1.5f * Sin((CGeneral::GetRandomNumber() % 256) * PI / 128);
pos.y += 1.5f * Cos((CGeneral::GetRandomNumber() % 256) * PI / 128);
pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &found) + 0.5f;
if (found) {
CPickups::GenerateNewOne(CVector(pos.x, pos.y, pos.z), MI_MONEY, PICKUP_MONEY, moneyPerPickup + (CGeneral::GetRandomNumber() & 3));
}
}
}
void
CPickups::Load(uint8 *buf, uint32 size)
{
@ -1126,45 +1159,6 @@ CPacManPickups::Update()
void
CPacManPickups::GeneratePMPickUps(CVector pos, float scrambleMult, int16 count, uint8 type)
{
int i = 0;
while (count > 0) {
while (aPMPickUps[i].m_eType != PACMAN_NONE)
i++;
bool bPickupCreated = false;
while (!bPickupCreated) {
CVector newPos = pos;
CColPoint colPoint;
CEntity *pRoad;
uint16 nRand = CGeneral::GetRandomNumber();
newPos.x += ((nRand & 0xFF) - 128) * scrambleMult / 128.0f;
newPos.y += (((nRand >> 8) & 0xFF) - 128) * scrambleMult / 128.0f;
newPos.z = 1000.0f;
if (CWorld::ProcessVerticalLine(newPos, -1000.0f, colPoint, pRoad, true, false, false, false, true, false, nil) && pRoad->IsBuilding() && ((CBuilding*)pRoad)->GetIsATreadable()) {
newPos.z = 0.7f + colPoint.point.z;
aPMPickUps[i].m_eType = type;
aPMPickUps[i].m_vecPosn = newPos;
CObject *obj = new CObject(MI_BULLION, true);
if (obj != nil) {
obj->ObjectCreatedBy = MISSION_OBJECT;
obj->SetPosition(aPMPickUps[i].m_vecPosn);
obj->SetOrientation(0.0f, 0.0f, -HALFPI);
obj->GetMatrix().UpdateRW();
obj->UpdateRwFrame();
obj->bAffectedByGravity = false;
obj->bExplosionProof = true;
obj->bUsesCollision = false;
obj->bIsPickup = false;
CWorld::Add(obj);
}
aPMPickUps[i].m_pObject = obj;
bPickupCreated = true;
}
}
count--;
}
bPMActive = true;
}
// diablo porn mission pickups
@ -1281,40 +1275,6 @@ static const CVector aRacePoints1[] = {
void
CPacManPickups::GeneratePMPickUpsForRace(int32 race)
{
const CVector *pPos = nil;
int i = 0;
if (race == 0) pPos = aRacePoints1; // there's only one available
assert(pPos != nil);
while (!pPos->IsZero()) {
while (aPMPickUps[i].m_eType != PACMAN_NONE)
i++;
aPMPickUps[i].m_eType = PACMAN_RACE;
aPMPickUps[i].m_vecPosn = *(pPos++);
if (race == 0) {
CObject* obj = new CObject(MI_DONKEYMAG, true);
if (obj != nil) {
obj->ObjectCreatedBy = MISSION_OBJECT;
obj->SetPosition(aPMPickUps[i].m_vecPosn);
obj->SetOrientation(0.0f, 0.0f, -HALFPI);
obj->GetMatrix().UpdateRW();
obj->UpdateRwFrame();
obj->bAffectedByGravity = false;
obj->bExplosionProof = true;
obj->bUsesCollision = false;
obj->bIsPickup = false;
CWorld::Add(obj);
}
aPMPickUps[i].m_pObject = obj;
} else
aPMPickUps[i].m_pObject = nil;
}
bPMActive = true;
}
void

View file

@ -46,7 +46,7 @@ public:
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
private:
bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
inline bool CanBePickedUp(CPlayerPed *player);
inline bool CanBePickedUp(CPlayerPed *player, int playerId);
void RemoveKeepType();
void Remove();
};
@ -85,11 +85,13 @@ public:
static bool IsPickUpPickedUp(int32 pickupId);
static int32 ModelForWeapon(eWeaponType weaponType);
static enum eWeaponType WeaponForModel(int32 model);
static int32 FindColourIndexForWeaponMI(int32 model);
static int32 GetActualPickupIndex(int32 index);
static int32 GetNewUniquePickupIndex(int32 slot);
static void PassTime(uint32 time);
static bool GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex);
static bool TestForPickupsInBubble(CVector pos, float range);
static bool TryToMerge_WeaponType(CVector pos, eWeaponType weapon, uint8 type, uint32 quantity, bool unused);
static void CreateSomeMoney(CVector, int);
static void Load(uint8 *buf, uint32 size);
static void Save(uint8 *buf, uint32 *size);
@ -103,7 +105,7 @@ public:
};
extern uint16 AmmoForWeapon[20];
extern uint16 AmmoForWeapon_OnStreet[20];
extern uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS];
extern uint16 CostOfWeapon[20];
enum ePacmanPickupType

View file

@ -17,6 +17,7 @@
#include "ModelInfo.h"
#include "Object.h"
#include "Pad.h"
#include "PedAttractor.h"
#include "Phones.h"
#include "Pickups.h"
#include "Plane.h"
@ -510,8 +511,12 @@ void CReplay::ProcessPedUpdate(CPed *ped, float interpolation, CAddressInReplayB
}
RetrievePedAnimation(ped, &pp->anim_state);
ped->RemoveWeaponModel(-1);
if (pp->weapon_model != (uint8)-1)
ped->AddWeaponModel(pp->weapon_model);
if (pp->weapon_model != (uint16)-1) {
if (CStreaming::HasModelLoaded(pp->weapon_model))
ped->AddWeaponModel(pp->weapon_model);
else
CStreaming::RequestModel(pp->weapon_model, 0);
}
CWorld::Remove(ped);
CWorld::Add(ped);
buffer->m_nOffset += sizeof(tPedUpdatePacket);
@ -1116,6 +1121,14 @@ void CReplay::StoreStuffInMem(void)
for (int i = 0; i < NUMPLAYERS; i++)
nHandleOfPlayerPed[i] = CPools::GetPedPool()->GetIndex(CWorld::Players[i].m_pPed);
#endif
int i = CPools::GetPedPool()->GetSize();
while (--i >= 0) {
CPed* ped = CPools::GetPedPool()->GetSlot(i);
if (!ped)
continue;
if (ped->m_attractor)
GetPedAttractorManager()->DeRegisterPed(ped, ped->m_attractor);
}
CPools::GetVehiclePool()->Store(pBuf0, pBuf1);
CPools::GetPedPool()->Store(pBuf2, pBuf3);
CPools::GetObjectPool()->Store(pBuf4, pBuf5);
@ -1211,6 +1224,16 @@ void CReplay::RestoreStuffFromMem(void)
ped->m_audioEntityId = DMAudio.CreateEntity(AUDIOTYPE_PHYSICAL, ped);
DMAudio.SetEntityStatus(ped->m_audioEntityId, true);
CPopulation::UpdatePedCount((ePedType)ped->m_nPedType, false);
for (int j = 0; j < TOTAL_WEAPON_SLOTS; j++) {
int mi1 = CWeaponInfo::GetWeaponInfo(ped->m_weapons[j].m_eWeaponType)->m_nModelId;
if (mi1 != -1)
CStreaming::RequestModel(mi1, STREAMFLAGS_DEPENDENCY);
int mi2 = CWeaponInfo::GetWeaponInfo(ped->m_weapons[j].m_eWeaponType)->m_nModel2Id;
if (mi2 != -1)
CStreaming::RequestModel(mi2, STREAMFLAGS_DEPENDENCY);
CStreaming::LoadAllRequestedModels(false);
ped->m_weapons[j].Initialise(ped->m_weapons[j].m_eWeaponType, ped->m_weapons[j].m_nAmmoTotal);
}
if (ped->m_wepModelID >= 0)
ped->AddWeaponModel(ped->m_wepModelID);
}

View file

@ -176,7 +176,7 @@ class CReplay
CStoredAnimationState anim_state;
CCompressedMatrixNotAligned matrix;
int8 assoc_group_id;
uint8 weapon_model;
uint16 weapon_model;
};
VALIDATE_SIZE(tPedUpdatePacket, 40);

View file

@ -47,7 +47,7 @@ CRoadBlocks::Init(void)
}
void
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode)
CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType)
{
static const CVector vecRoadBlockOffets[6] = { {-1.5, 1.8f, 0.0f}, {-1.5f, -1.8f, 0.0f}, {1.5f, 1.8f, 0.0f},
{1.5f, -1.8f, 0.0f}, {-1.5f, 0.0f, 0.0f}, {1.5, 0.0, 0.0} };
@ -90,7 +90,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
pCopPed->SetIdle();
pCopPed->bKindaStayInSamePlace = true;
pCopPed->bNotAllowedToDuck = false;
pCopPed->m_nRoadblockNode = roadBlockNode;
// pCopPed->m_nRoadblockNode = roadBlockNode;
pCopPed->bCrouchWhenShooting = roadBlockType != 2;
if (pEntityToAttack) {
pCopPed->m_pPointGunAt = pEntityToAttack;

View file

@ -15,6 +15,6 @@ public:
static bool InOrOut[NUMROADBLOCKS];
static void Init(void);
static void GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType, int16 roadBlockNode);
static void GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType);
static void GenerateRoadBlocks(void);
};

File diff suppressed because it is too large Load diff

View file

@ -15,6 +15,12 @@ class CPlayerInfo;
class CRunningScript;
#define KEY_LENGTH_IN_SCRIPT 8
#define SPHERE_MARKER_R 252
#define SPHERE_MARKER_G 138
#define SPHERE_MARKER_B 242
#define SPHERE_MARKER_A 228
#define SPHERE_MARKER_PULSE_PERIOD 2048
#define SPHERE_MARKER_PULSE_FRACTION 0.1f
struct intro_script_rectangle
{
@ -221,20 +227,18 @@ enum {
};
enum {
SIZE_MAIN_SCRIPT = 128 * 1024,
SIZE_MISSION_SCRIPT = 32 * 1024,
SIZE_MAIN_SCRIPT = 225512,
SIZE_MISSION_SCRIPT = 35000,
SIZE_SCRIPT_SPACE = SIZE_MAIN_SCRIPT + SIZE_MISSION_SCRIPT
};
enum {
MAX_NUM_SCRIPTS = 128,
MAX_NUM_CONTACTS = 16,
MAX_NUM_INTRO_TEXT_LINES = 2,
MAX_NUM_INTRO_RECTANGLES = 16,
MAX_NUM_SCRIPT_SRPITES = 16,
MAX_NUM_SCRIPT_SPHERES = 16,
MAX_NUM_COLLECTIVES = 32,
MAX_NUM_USED_OBJECTS = 200,
MAX_NUM_USED_OBJECTS = 220,
MAX_NUM_MISSION_SCRIPTS = 120,
MAX_NUM_BUILDING_SWAPS = 25,
MAX_NUM_INVISIBILITY_SETTINGS = 20,
@ -245,13 +249,10 @@ class CTheScripts
{
static uint8 ScriptSpace[SIZE_SCRIPT_SPACE];
static CRunningScript ScriptsArray[MAX_NUM_SCRIPTS];
static int32 BaseBriefIdForContact[MAX_NUM_CONTACTS];
static int32 OnAMissionForContactFlag[MAX_NUM_CONTACTS];
static intro_text_line IntroTextLines[MAX_NUM_INTRO_TEXT_LINES];
static intro_script_rectangle IntroRectangles[MAX_NUM_INTRO_RECTANGLES];
static CSprite2d ScriptSprites[MAX_NUM_SCRIPT_SRPITES];
static script_sphere_struct ScriptSphereArray[MAX_NUM_SCRIPT_SPHERES];
static tCollectiveData CollectiveArray[MAX_NUM_COLLECTIVES];
static tUsedObject UsedObjectArray[MAX_NUM_USED_OBJECTS];
static int32 MultiScriptArray[MAX_NUM_MISSION_SCRIPTS];
static tBuildingSwap BuildingSwapArray[MAX_NUM_BUILDING_SWAPS];
@ -275,14 +276,17 @@ class CTheScripts
static uint32 LargestMissionScriptSize;
static uint32 MainScriptSize;
static uint8 FailCurrentMission;
static uint8 CountdownToMakePlayerUnsafe;
static uint8 DelayMakingPlayerUnsafeThisTime;
static uint16 NumScriptDebugLines;
static uint16 NumberOfIntroRectanglesThisFrame;
static uint16 NumberOfIntroTextLinesThisFrame;
static uint8 UseTextCommands;
static uint16 CommandsExecuted;
static uint16 ScriptsUpdated;
static uint8 RiotIntensity;
static uint32 LastMissionPassedTime;
static uint16 NumberOfExclusiveMissionScripts;
static bool bPlayerIsInTheStatium;
static bool bPlayerHasMetDebbieHarry;
public:
static void Init();
@ -306,9 +310,6 @@ public:
static int32* GetPointerToScriptVariable(int32 offset) { assert(offset >= 8 && offset < CTheScripts::GetSizeOfVariableSpace()); return (int32*)&ScriptSpace[offset]; }
static void ResetCountdownToMakePlayerUnsafe() { CountdownToMakePlayerUnsafe = 0; }
static bool IsCountdownToMakePlayerUnsafeOn() { return CountdownToMakePlayerUnsafe != 0; }
static int32 Read4BytesFromScript(uint32* pIp) {
int32 retval = ScriptSpace[*pIp + 3] << 24 | ScriptSpace[*pIp + 2] << 16 | ScriptSpace[*pIp + 1] << 8 | ScriptSpace[*pIp];
*pIp += 4;
@ -371,6 +372,8 @@ private:
static int32 AddScriptSphere(int32 id, CVector pos, float radius);
static int32 GetNewUniqueScriptSphereIndex(int32 index);
static void RemoveScriptSphere(int32 index);
static void RemoveScriptTextureDictionary();
static void RemoveThisPed(CPed* pPed);
friend class CRunningScript;
friend class CHud;
@ -414,6 +417,7 @@ class CRunningScript
uint32 m_anStack[MAX_STACK_DEPTH];
uint16 m_nStackPointer;
int32 m_anLocalVariables[NUM_LOCAL_VARS + NUM_TIMERS];
bool m_bIsActive;
bool m_bCondResult;
bool m_bIsMissionScript;
bool m_bSkipWakeTime;
@ -484,13 +488,16 @@ private:
void PlayerInAngledAreaCheckCommand(int32, uint32*);
void CharInAreaCheckCommand(int32, uint32*);
void CarInAreaCheckCommand(int32, uint32*);
void LocateObjectCommand(int32, uint32*);
void ObjectInAreaCheckCommand(int32, uint32*);
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
bool ThisIsAValidRandomPed(uint32 pedtype) {
bool ThisIsAValidRandomPed(uint32 pedtype, int civ, int gang, int criminal) {
switch (pedtype) {
case PEDTYPE_CIVMALE:
case PEDTYPE_CIVFEMALE:
return civ;
case PEDTYPE_GANG1:
case PEDTYPE_GANG2:
case PEDTYPE_GANG3:
@ -500,11 +507,16 @@ private:
case PEDTYPE_GANG7:
case PEDTYPE_GANG8:
case PEDTYPE_GANG9:
return gang;
case PEDTYPE_CRIMINAL:
case PEDTYPE_PROSTITUTE:
return true;
return criminal;
default:
return false;
}
}
bool CheckDamagedWeaponType(int32 actual, int32 type);
static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
};

319
src/control/SetPieces.cpp Normal file
View file

@ -0,0 +1,319 @@
#include "common.h"
#include "SetPieces.h"
#include "Automobile.h"
#include "CarAI.h"
#include "CopPed.h"
#include "GenericGameStorage.h"
#include "PlayerPed.h"
#include "Timer.h"
#include "Vehicle.h"
#include "Wanted.h"
#include "World.h"
#define TIME_BETWEEN_SETPIECE_SPAWNS 20000
//--MIAMI: file done
bool CSetPieces::bDebug;
uint32 CSetPieces::NumSetPieces;
CSetPiece CSetPieces::aSetPieces[NUM_SETPIECES];
void CSetPieces::Init(void)
{
bDebug = false;
NumSetPieces = 0;
}
void CSetPieces::AddOne(uint8 type, CVector2D vTriggerInf, CVector2D vTriggerSup, CVector2D vSpawn1, CVector2D vTarget1, CVector2D vSpawn2, CVector2D vTarget2)
{
if (NumSetPieces >= NUM_SETPIECES)
return;
aSetPieces[NumSetPieces].m_nType = (eSetPieceType)type;
aSetPieces[NumSetPieces].m_vTriggerInf.x = Min(vTriggerInf.x, vTriggerSup.x);
aSetPieces[NumSetPieces].m_vTriggerInf.y = Min(vTriggerInf.y, vTriggerSup.y);
aSetPieces[NumSetPieces].m_vTriggerSup.x = Max(vTriggerInf.x, vTriggerSup.x);
aSetPieces[NumSetPieces].m_vTriggerSup.y = Max(vTriggerInf.y, vTriggerSup.y);
aSetPieces[NumSetPieces].m_vSpawn1 = vSpawn1;
aSetPieces[NumSetPieces].m_vSpawn2 = vSpawn2;
aSetPieces[NumSetPieces].m_vTarget1 = vTarget1;
aSetPieces[NumSetPieces].m_vTarget2 = vTarget2;
++NumSetPieces;
}
void CSetPieces::Update(void)
{
int nFirst = NumSetPieces * (CTimer::GetFrameCounter() % 8) / 8;
int nLast = NumSetPieces * (CTimer::GetFrameCounter() % 8 + 1) / 8;
for (int i = nFirst; i < nLast; i++)
aSetPieces[i].Update();
}
void CSetPieces::Save(uint8* buf, uint32* size)
{
INITSAVEBUF
WriteSaveBuf(buf, NumSetPieces);
for (int i = 0; i < NUM_SETPIECES; i++)
WriteSaveBuf(buf, aSetPieces[i]);
*size = sizeof(NumSetPieces) + NUM_SETPIECES * sizeof(CSetPiece);
VALIDATESAVEBUF(*size)
}
void CSetPieces::Load(uint8* buf, uint32 size)
{
INITSAVEBUF
NumSetPieces = ReadSaveBuf<uint32>(buf);
for (int i = 0; i < NUM_SETPIECES; i++)
aSetPieces[i] = ReadSaveBuf<CSetPiece>(buf);
VALIDATESAVEBUF(size)
}
void CSetPiece::Update(void)
{
if (m_nLastTimeCreated != 0 && CTimer::GetTimeInMilliseconds() <= m_nLastTimeCreated + TIME_BETWEEN_SETPIECE_SPAWNS)
return;
CVector pos = FindPlayerCoors();
if (pos.x < m_vTriggerInf.x || pos.x > m_vTriggerSup.x ||
pos.y < m_vTriggerInf.y || pos.y > m_vTriggerSup.y)
return;
switch (m_nType) {
case SETPIECE_TWOCOPCARSINALLEY:
{
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 1 || FindPlayerVehicle())
return;
CVehicle* pVehicle1 = TryToGenerateCopCar(m_vSpawn1, m_vTarget1);
if (!pVehicle1)
return;
CVehicle* pVehicle2 = TryToGenerateCopCar(m_vSpawn2, m_vTarget2);
if (!pVehicle2) {
CWorld::Remove(pVehicle1);
delete pVehicle1;
return;
}
pVehicle1->SetStatus(STATUS_PHYSICS);
pVehicle1->AutoPilot.m_fMaxTrafficSpeed = pVehicle1->AutoPilot.m_nCruiseSpeed = 4;
pVehicle1->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_SLOW_DOWN_FOR_CARS;
pVehicle1->AutoPilot.m_nCarMission = MISSION_SLOWLY_DRIVE_TOWARDS_PLAYER_1;
pVehicle1->AutoPilot.m_vecDestinationCoors.x = m_vTarget1.x;
pVehicle1->AutoPilot.m_vecDestinationCoors.y = m_vTarget1.y;
pVehicle1->AutoPilot.m_vecDestinationCoors.z = 0.0f;
pVehicle1->m_nSetPieceExtendedRangeTime = CTimer::GetTimeInMilliseconds() + 25000;
CCarAI::AddPoliceCarOccupants(pVehicle1);
pVehicle2->SetStatus(STATUS_PHYSICS);
pVehicle2->AutoPilot.m_fMaxTrafficSpeed = pVehicle2->AutoPilot.m_nCruiseSpeed = 4;
pVehicle2->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_SLOW_DOWN_FOR_CARS;
pVehicle2->AutoPilot.m_nCarMission = MISSION_SLOWLY_DRIVE_TOWARDS_PLAYER_1;
pVehicle2->AutoPilot.m_vecDestinationCoors.x = m_vTarget2.x;
pVehicle2->AutoPilot.m_vecDestinationCoors.y = m_vTarget2.y;
pVehicle2->AutoPilot.m_vecDestinationCoors.z = 0.0f;
pVehicle2->m_nSetPieceExtendedRangeTime = CTimer::GetTimeInMilliseconds() + 25000;
CCarAI::AddPoliceCarOccupants(pVehicle2);
m_nLastTimeCreated = CTimer::GetTimeInMilliseconds();
break;
}
case SETPIECE_CARBLOCKINGPLAYERFROMSIDE:
{
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 2)
return;
if (!FindPlayerVehicle())
return;
if (DotProduct2D(FindPlayerSpeed(), (CVector2D)FindPlayerCoors() - m_vSpawn1) >= 0.0f)
return;
CVehicle* pVehicle1 = TryToGenerateCopCar(m_vSpawn1, m_vTarget1);
if (!pVehicle1)
return;
pVehicle1->SetStatus(STATUS_PHYSICS);
pVehicle1->AutoPilot.m_fMaxTrafficSpeed = pVehicle1->AutoPilot.m_nCruiseSpeed = 16;
pVehicle1->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_PLOUGH_THROUGH;
pVehicle1->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_FORWARDANDBACK;
pVehicle1->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD;
pVehicle1->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 100;
pVehicle1->m_nSetPieceExtendedRangeTime = CTimer::GetTimeInMilliseconds() + 10000;
pVehicle1->SetMoveSpeed(2.0f * pVehicle1->GetForward() / 3.0f);
CCarAI::AddPoliceCarOccupants(pVehicle1);
m_nLastTimeCreated = CTimer::GetTimeInMilliseconds();
return;
}
case SETPIECE_CARRAMMINGPLAYERFROMSIDE:
{
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 2)
return;
if (!FindPlayerVehicle())
return;
if (DotProduct2D(FindPlayerSpeed(), (CVector2D)FindPlayerCoors() - m_vSpawn1) >= 0.0f)
return;
CVehicle* pVehicle1 = TryToGenerateCopCar(m_vSpawn1, m_vTarget1);
if (!pVehicle1)
return;
pVehicle1->SetStatus(STATUS_PHYSICS);
pVehicle1->AutoPilot.m_fMaxTrafficSpeed = pVehicle1->AutoPilot.m_nCruiseSpeed = 16;
pVehicle1->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
pVehicle1->AutoPilot.m_nCarMission = MISSION_RAMCAR_CLOSE;
pVehicle1->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD;
pVehicle1->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 100;
pVehicle1->m_nSetPieceExtendedRangeTime = CTimer::GetTimeInMilliseconds() + 10000;
pVehicle1->SetMoveSpeed(2.0f * pVehicle1->GetForward() / 3.0f);
CCarAI::AddPoliceCarOccupants(pVehicle1);
m_nLastTimeCreated = CTimer::GetTimeInMilliseconds();
return;
}
case SETPIECE_CREATECOPPERONFOOT:
{
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 1 || FindPlayerVehicle())
return;
CCopPed* pCop = TryToGenerateCopPed(m_vSpawn1);
if (!pCop)
return;
float z = CWorld::FindGroundZForCoord(m_vTarget1.x, m_vTarget1.y);
pCop->bScriptObjectiveCompleted = false;
pCop->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector(m_vTarget1.x, m_vTarget1.y, z));
pCop->m_nExtendedRangeTimer = CTimer::GetTimeInMilliseconds() + 10000;
m_nLastTimeCreated = CTimer::GetTimeInMilliseconds();
return;
}
case SETPIECE_CREATETWOCOPPERSONFOOT:
{
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 1 || FindPlayerVehicle())
return;
CCopPed* pCop = TryToGenerateCopPed(m_vSpawn1);
if (!pCop)
return;
float z = CWorld::FindGroundZForCoord(m_vTarget1.x, m_vTarget1.y);
pCop->bScriptObjectiveCompleted = false;
pCop->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector(m_vTarget1.x, m_vTarget1.y, z));
pCop->m_nExtendedRangeTimer = CTimer::GetTimeInMilliseconds() + 10000;
CCopPed* pCop2 = TryToGenerateCopPed(m_vSpawn2);
if (!pCop2) {
CWorld::Remove(pCop);
delete pCop;
return;
}
z = CWorld::FindGroundZForCoord(m_vTarget2.x, m_vTarget2.y);
pCop2->bScriptObjectiveCompleted = false;
pCop2->SetObjective(OBJECTIVE_GOTO_AREA_ON_FOOT, CVector(m_vTarget2.x, m_vTarget2.y, z));
pCop2->m_nExtendedRangeTimer = CTimer::GetTimeInMilliseconds() + 10000;
m_nLastTimeCreated = CTimer::GetTimeInMilliseconds();
return;
}
case SETPIECE_TWOCARSBLOCKINGPLAYERFROMSIDE:
{
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 2)
return;
if (!FindPlayerVehicle())
return;
if (DotProduct2D(FindPlayerSpeed(), (CVector2D)FindPlayerCoors() - m_vSpawn1) >= 0.0f)
return;
CVehicle* pVehicle1 = TryToGenerateCopCar(m_vSpawn1, m_vTarget1);
if (!pVehicle1)
return;
pVehicle1->SetStatus(STATUS_PHYSICS);
pVehicle1->AutoPilot.m_fMaxTrafficSpeed = pVehicle1->AutoPilot.m_nCruiseSpeed = 16;
pVehicle1->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_PLOUGH_THROUGH;
pVehicle1->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_FORWARDANDBACK;
pVehicle1->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD;
pVehicle1->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 100;
pVehicle1->m_nSetPieceExtendedRangeTime = CTimer::GetTimeInMilliseconds() + 10000;
pVehicle1->SetMoveSpeed(2.0f * pVehicle1->GetForward() / 3.0f);
CCarAI::AddPoliceCarOccupants(pVehicle1);
CVehicle* pVehicle2 = TryToGenerateCopCar(m_vSpawn2, m_vTarget2);
if (!pVehicle2) {
CWorld::Remove(pVehicle1);
delete pVehicle1;
return;
}
pVehicle2->SetStatus(STATUS_PHYSICS);
pVehicle2->AutoPilot.m_fMaxTrafficSpeed = pVehicle1->AutoPilot.m_nCruiseSpeed = 16;
pVehicle2->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_PLOUGH_THROUGH;
pVehicle2->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_FORWARDANDBACK;
pVehicle2->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD;
pVehicle2->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 100;
pVehicle2->m_nSetPieceExtendedRangeTime = CTimer::GetTimeInMilliseconds() + 10000;
pVehicle2->SetMoveSpeed(2.0f * pVehicle2->GetForward() / 3.0f);
CCarAI::AddPoliceCarOccupants(pVehicle2);
m_nLastTimeCreated = CTimer::GetTimeInMilliseconds();
return;
}
case SETPIECE_TWOCARSRAMMINGPLAYERFROMSIDE:
{
if (FindPlayerPed()->m_pWanted->m_nWantedLevel < 2)
return;
if (!FindPlayerVehicle())
return;
if (DotProduct2D(FindPlayerSpeed(), (CVector2D)FindPlayerCoors() - m_vSpawn1) >= 0.0f)
return;
CVehicle* pVehicle1 = TryToGenerateCopCar(m_vSpawn1, m_vTarget1);
if (!pVehicle1)
return;
pVehicle1->SetStatus(STATUS_PHYSICS);
pVehicle1->AutoPilot.m_fMaxTrafficSpeed = pVehicle1->AutoPilot.m_nCruiseSpeed = 16;
pVehicle1->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
pVehicle1->AutoPilot.m_nCarMission = MISSION_RAMCAR_CLOSE;
pVehicle1->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD;
pVehicle1->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 100;
pVehicle1->m_nSetPieceExtendedRangeTime = CTimer::GetTimeInMilliseconds() + 10000;
pVehicle1->SetMoveSpeed(2.0f * pVehicle1->GetForward() / 3.0f);
CCarAI::AddPoliceCarOccupants(pVehicle1);
CVehicle* pVehicle2 = TryToGenerateCopCar(m_vSpawn2, m_vTarget2);
if (!pVehicle2) {
CWorld::Remove(pVehicle2);
delete pVehicle2;
return;
}
pVehicle2->SetStatus(STATUS_PHYSICS);
pVehicle2->AutoPilot.m_fMaxTrafficSpeed = pVehicle2->AutoPilot.m_nCruiseSpeed = 16;
pVehicle2->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
pVehicle2->AutoPilot.m_nCarMission = MISSION_RAMCAR_CLOSE;
pVehicle2->AutoPilot.m_nTempAction = TEMPACT_GOFORWARD;
pVehicle2->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 100;
pVehicle2->m_nSetPieceExtendedRangeTime = CTimer::GetTimeInMilliseconds() + 10000;
pVehicle2->SetMoveSpeed(2.0f * pVehicle2->GetForward() / 3.0f);
CCarAI::AddPoliceCarOccupants(pVehicle2);
m_nLastTimeCreated = CTimer::GetTimeInMilliseconds();
return;
}
}
}
CVehicle* CSetPiece::TryToGenerateCopCar(CVector2D vSpawn, CVector2D vTarget)
{
CVehicle* pVehicle = new CAutomobile(MI_POLICE, RANDOM_VEHICLE);
CVector pos(vSpawn.x, vSpawn.y, 1000.0f);
CColPoint point;
CEntity* pEntity;
if (CWorld::ProcessVerticalLine(pos, -1000.0f, point, pEntity, true, false, false, false, true, false, nil))
pos.z = point.point.z + pVehicle->GetHeightAboveRoad();
CVector vDirection(vTarget.x - vSpawn.x, vTarget.y - vSpawn.y, 0.0f);
vDirection.Normalise();
pVehicle->GetForward() = CVector(vDirection.x, vDirection.y, 0.0f);
pVehicle->GetRight() = CVector(vDirection.y, -vDirection.x, 0.0f);
pVehicle->GetUp() = CVector(0.0f, 0.0f, 1.0f);
pVehicle->SetPosition(pos);
int16 total;
CWorld::FindObjectsKindaColliding(pos, pVehicle->GetColModel()->spheres->radius, false, &total, 16, nil, false, true, true, false, false);
if (total != 0) {
delete pVehicle;
return nil;
}
pVehicle->ChangeLawEnforcerState(true);
CWorld::Add(pVehicle);
return pVehicle;
}
CCopPed* CSetPiece::TryToGenerateCopPed(CVector2D vSpawn)
{
CCopPed* pCop = new CCopPed(COP_STREET);
CVector pos(vSpawn.x, vSpawn.y, 1000.0f);
CColPoint point;
CEntity* pEntity;
if (CWorld::ProcessVerticalLine(pos, -1000.0f, point, pEntity, true, false, false, false, true, false, nil))
pos.z = point.point.z + 0.9f;
pCop->SetPosition(pos);
int16 total;
CWorld::FindObjectsKindaColliding(pos, pCop->GetColModel()->spheres->radius, false, &total, 16, nil, false, true, true, false, false);
if (total != 0) {
delete pCop;
return nil;
}
CWorld::Add(pCop);
return pCop;
}

48
src/control/SetPieces.h Normal file
View file

@ -0,0 +1,48 @@
#pragma once
#include "config.h"
class CVehicle;
class CCopPed;
enum eSetPieceType : uint8
{
SETPIECE_NONE = 0,
SETPIECE_TWOCOPCARSINALLEY,
SETPIECE_CARBLOCKINGPLAYERFROMSIDE,
SETPIECE_CARRAMMINGPLAYERFROMSIDE,
SETPIECE_CREATECOPPERONFOOT,
SETPIECE_CREATETWOCOPPERSONFOOT,
SETPIECE_TWOCARSBLOCKINGPLAYERFROMSIDE,
SETPIECE_TWOCARSRAMMINGPLAYERFROMSIDE
};
class CSetPiece
{
public:
eSetPieceType m_nType;
uint32 m_nLastTimeCreated;
CVector2D m_vTriggerInf;
CVector2D m_vTriggerSup;
CVector2D m_vSpawn1;
CVector2D m_vSpawn2;
CVector2D m_vTarget1;
CVector2D m_vTarget2;
CVehicle* TryToGenerateCopCar(CVector2D, CVector2D);
CCopPed* TryToGenerateCopPed(CVector2D);
void Update(void);
};
class CSetPieces
{
static bool bDebug;
static uint32 NumSetPieces;
static CSetPiece aSetPieces[NUM_SETPIECES];
public:
static void Init(void);
static void AddOne(uint8 type, CVector2D, CVector2D, CVector2D, CVector2D, CVector2D, CVector2D);
static void Save(uint8*, uint32*);
static void Load(uint8*, uint32);
static void Update(void);
};

View file

@ -108,6 +108,7 @@ CTrafficLights::DisplayActualLight(CEntity *ent)
CBrightLights::RegisterOne(pos1, ent->GetUp(), ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
CBrightLights::RegisterOne(pos2, ent->GetUp(), -ent->GetRight(), CVector(0.0f, 0.0f, 0.0f), id + BRIGHTLIGHT_TRAFFIC_GREEN);
/*
static const float top = -0.127f;
static const float bot = -0.539f;
static const float mid = bot + (top-bot)/3.0f;
@ -131,6 +132,7 @@ CTrafficLights::DisplayActualLight(CEntity *ent)
1.0f, 0.5f, 0.0f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f,
SHINYTEXT_WALK, 255, 255, 255, 60.0f);
}
*/
}
void
@ -145,7 +147,7 @@ CTrafficLights::ScanForLightsOnMap(void)
CPtrList &list = CWorld::GetSector(x, y)->m_lists[ENTITYLIST_DUMMIES];
for(node = list.first; node; node = node->next){
CEntity *light = (CEntity*)node->item;
if(light->GetModelIndex() != MI_TRAFFICLIGHTS)
if (!IsTrafficLight(light->GetModelIndex()))
continue;
// Check cars

View file

@ -29,7 +29,7 @@ bool PrintDebugCode = false;
int16 DebugCamMode;
#ifdef FREE_CAM
bool CCamera::bFreeCam = true;
bool CCamera::bFreeCam;
int nPreviousMode = -1;
#endif
@ -504,11 +504,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 +565,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{
@ -1408,11 +1408,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);
@ -1596,7 +1596,7 @@ CCam::Process_FollowPedWithMouse(const CVector &CameraTarget, float TargetOrient
CWorld::pIgnoreEntity = nil;
float ViewPlaneHeight = Tan(DEGTORAD(FOV) / 2.0f);
float ViewPlaneWidth = ViewPlaneHeight * CDraw::FindAspectRatio() * fTweakFOV;
float ViewPlaneWidth = ViewPlaneHeight * CDraw::CalculateAspectRatio() * fTweakFOV;
float Near = RwCameraGetNearClipPlane(Scene.camera);
float radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);
@ -1750,8 +1750,8 @@ 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_DEFAULT || colpoint.surfaceB >= SURFACE_CAR) &&
colpoint.surfaceB != SURFACE_THICK_METAL_PLATE && colpoint.surfaceB != SURFACE_STEEP_CLIFF &&
RoadHeightFix > 1.4f)
RoadHeightFix = 1.4f;
@ -2429,7 +2429,7 @@ CCam::Process_Rocket(const CVector &CameraTarget, float, float, float)
ResetStatics = false;
}
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@ -2568,7 +2568,7 @@ CCam::Process_M16_1stPerson(const CVector &CameraTarget, float, float, float)
HeadPos.x = 0.0f;
HeadPos.y = 0.0f;
HeadPos.z = 0.0f;
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f * Cos(m_fInitialPlayerOrientation);
@ -2657,7 +2657,7 @@ CCam::Process_1stPerson(const CVector &CameraTarget, float TargetOrientation, fl
ResetStatics = false;
}
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@ -2925,7 +2925,7 @@ CCam::Process_Sniper(const CVector &CameraTarget, float TargetOrientation, float
ResetStatics = false;
}
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(&HeadPos, PED_HEAD);
((CPed*)CamTargetEntity)->m_pedIK.GetComponentPosition(HeadPos, PED_HEAD);
Source = HeadPos;
Source.z += 0.1f;
Source.x -= 0.19f*Cos(m_fInitialPlayerOrientation);
@ -3630,7 +3630,7 @@ CCam::Process_Fixed(const CVector &CameraTarget, float, float, float)
if(TheCamera.m_bUseSpecialFovTrain)
FOV = TheCamera.m_fFovForTrain;
if(CMenuManager::m_ControlMethod == 0 && Using3rdPersonMouseCam()){
if(FrontEndMenuManager.m_ControlMethod == 0 && Using3rdPersonMouseCam()){
CPed *player = FindPlayerPed();
if(player && player->CanStrafeOrMouseControl()){
float Heading = Front.Heading();
@ -4574,7 +4574,7 @@ CCam::Process_FollowPed_Rotation(const CVector &CameraTarget, float TargetOrient
CWorld::pIgnoreEntity = nil;
float ViewPlaneHeight = Tan(DEGTORAD(FOV) / 2.0f);
float ViewPlaneWidth = ViewPlaneHeight * CDraw::FindAspectRatio() * fTweakFOV;
float ViewPlaneWidth = ViewPlaneHeight * CDraw::CalculateAspectRatio() * fTweakFOV;
float Near = RwCameraGetNearClipPlane(Scene.camera);
float radius = ViewPlaneWidth*Near;
entity = CWorld::TestSphereAgainstWorld(Source + Front*Near, radius, nil, true, true, false, true, false, false);

View file

@ -61,6 +61,8 @@ enum
CCamera TheCamera;
bool CCamera::m_bUseMouse3rdPerson = true;
bool bDidWeProcessAnyCinemaCam;
float CCamera::m_f3rdPersonCHairMultX;
float CCamera::m_f3rdPersonCHairMultY;
#ifdef IMPROVED_CAMERA
#define KEYJUSTDOWN(k) ControlsManager.GetIsKeyboardKeyJustDown((RsKeyCodes)k)
@ -80,10 +82,6 @@ CCamera::CCamera(void)
Init();
}
CCamera::CCamera(float)
{
}
void
CCamera::Init(void)
{
@ -91,12 +89,7 @@ CCamera::Init(void)
float fMouseAccelHorzntl = m_fMouseAccelHorzntl;
float fMouseAccelVertical = m_fMouseAccelVertical;
#endif
#ifdef FIX_BUGS
static const CCamera DummyCamera = CCamera(0.f);
*this = DummyCamera;
#else
memset(this, 0, sizeof(CCamera)); // getting rid of vtable, eh?
#endif
memset(this, 0, sizeof(CCamera)); // this is fine, no vtable
#ifdef GTA3_1_1_PATCH
m_fMouseAccelHorzntl = fMouseAccelHorzntl;
m_fMouseAccelVertical = fMouseAccelVertical;
@ -3044,33 +3037,25 @@ CCamera::SetNearClipScript(float clip)
void
CCamera::ProcessFade(void)
{
float fade = (CTimer::GetTimeInMilliseconds() - m_uiFadeTimeStarted)/1000.0f;
// Why even set CDraw::FadeValue if m_fFLOATingFade sets it anyway?
if(m_bFading){
if(m_iFadingDirection == FADE_IN){
if(m_fTimeToFadeOut != 0.0f){
m_fFLOATingFade = 255.0f - 255.0f*fade/m_fTimeToFadeOut;
if(m_fFLOATingFade <= 0.0f){
m_bFading = false;
CDraw::FadeValue = 0;
m_fFLOATingFade = 0.0f;
}
m_fFLOATingFade -= CTimer::GetTimeStepInSeconds() * 255.0f / m_fTimeToFadeOut;
}else{
m_fFLOATingFade = 0.0f;
}
if (m_fFLOATingFade <= 0.0f) {
m_bFading = false;
CDraw::FadeValue = 0;
m_fFLOATingFade = 0.0f;
}
}else if(m_iFadingDirection == FADE_OUT){
if(m_fTimeToFadeOut != 0.0f){
m_fFLOATingFade = 255.0f*fade/m_fTimeToFadeOut;
if(m_fFLOATingFade >= 255.0f){
m_bFading = false;
CDraw::FadeValue = 255;
m_fFLOATingFade = 255.0f;
}
m_fFLOATingFade += CTimer::GetTimeStepInSeconds() * 255.0f / m_fTimeToFadeOut;
}else{
m_fFLOATingFade = 255.0f;
}
if (m_fFLOATingFade >= 255.0f) {
m_bFading = false;
CDraw::FadeValue = 255;
m_fFLOATingFade = 255.0f;
}
}
@ -3132,15 +3117,6 @@ CCamera::Fade(float timeout, int16 direction)
m_iMusicFadingDirection = direction;
m_fTimeToFadeMusic = timeout;
m_uiFadeTimeStartedMusic = CTimer::GetTimeInMilliseconds();
// Not on PS2
if(!m_bJustJumpedOutOf1stPersonBecauseOfTarget && m_iMusicFadingDirection == FADE_OUT){
unknown++;
if(unknown >= 2){
m_bJustJumpedOutOf1stPersonBecauseOfTarget = true;
unknown = 0;
}else
m_bMoveCamToAvoidGeom = true;
}
}
}
@ -3217,7 +3193,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
@ -3305,6 +3281,18 @@ CCamera::Find3rdPersonQuickAimPitch(void)
return -(DEGTORAD(((0.5f - m_f3rdPersonCHairMultY) * 1.8f * 0.5f * Cams[ActiveCam].FOV)) + rot);
}
bool
CCamera::Using1stPersonWeaponMode(void)
{
switch(PlayerWeaponMode.Mode)
case CCam::MODE_SNIPER:
case CCam::MODE_M16_1STPERSON:
case CCam::MODE_ROCKETLAUNCHER:
case CCam::MODE_HELICANNON_1STPERSON:
case CCam::MODE_CAMERA:
return true;
return false;
}
void
@ -3329,8 +3317,9 @@ CCamera::CalculateDerivedValues(void)
// left plane
m_vecFrustumNormals[1] = CVector(-c, -s, 0.0f);
c /= CDraw::FindAspectRatio();
s /= CDraw::FindAspectRatio();
CDraw::CalculateAspectRatio();
c /= SCREEN_ASPECT_RATIO;
s /= SCREEN_ASPECT_RATIO;
// bottom plane
m_vecFrustumNormals[2] = CVector(0.0f, -s, -c);
// top plane

View file

@ -91,7 +91,9 @@ public:
MODE_M16_1STPERSON_RUNABOUT,
MODE_FIGHT_CAM_RUNABOUT,
MODE_EDITOR,
MODE_HELICANNON_1STPERSON, // vice city leftover
MODE_HELICANNON_1STPERSON,
MODE_45,
MODE_CAMERA,
};
bool bBelowMinDist; //used for follow ped mode
@ -472,8 +474,8 @@ public:
// not static yet
float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
float m_fMouseAccelVertical;// acceleration multiplier for 1st person controls
float m_f3rdPersonCHairMultX;
float m_f3rdPersonCHairMultY;
static float m_f3rdPersonCHairMultX;
static float m_f3rdPersonCHairMultY;
CCam Cams[3];
@ -549,7 +551,6 @@ public:
// High level and misc
CCamera(void);
CCamera(float);
void Init(void);
void Process(void);
void CamControl(void);
@ -626,6 +627,7 @@ public:
void UpdateAimingCoors(CVector const &coors);
void Find3rdPersonCamTargetVector(float dist, CVector pos, CVector &source, CVector &target);
float Find3rdPersonQuickAimPitch(void);
bool Using1stPersonWeaponMode(void);
// Physical camera
void SetRwCamera(RwCamera *cam);

View file

@ -178,7 +178,7 @@ CColStore::LoadCollision(const CVector2D &pos)
}else{
for (int j = 0; j < MAX_CLEANUP; j++) {
CPhysical* pEntity = CTheScripts::MissionCleanup.DoesThisEntityWaitForCollision(j);
if (pEntity /* !pEntity->bDontLoadCollision && !pEntity->bIsFrozen */) {
if (pEntity && !pEntity->bDontLoadCollision && !pEntity->bIsFrozen) {
if (GetBoundingBox(i).IsPointInside(pEntity->GetPosition(), -80.0f))
wantThisOne = true;
}

View file

@ -414,8 +414,9 @@ CCollision::TestSphereTriangle(const CColSphere &sphere,
return dist < sphere.radius;
}
//--MIAMI: TODO
bool
CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, bool ignoreSeeThrough)
CCollision::TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, bool ignoreSeeThrough, bool ignoreShootThrough)
{
static CMatrix matTransform;
int i;
@ -429,18 +430,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;
@ -1042,10 +1043,11 @@ CCollision::ProcessSphereTriangle(const CColSphere &sphere,
return true;
}
//--MIAMI: TODO
bool
CCollision::ProcessLineOfSight(const CColLine &line,
const CMatrix &matrix, CColModel &model,
CColPoint &point, float &mindist, bool ignoreSeeThrough)
CColPoint &point, float &mindist, bool ignoreSeeThrough, bool ignoreShootThrough)
{
static CMatrix matTransform;
int i;
@ -1060,16 +1062,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){
@ -1081,10 +1083,11 @@ CCollision::ProcessLineOfSight(const CColLine &line,
return false;
}
//--MIAMI: TODO
bool
CCollision::ProcessVerticalLine(const CColLine &line,
const CMatrix &matrix, CColModel &model,
CColPoint &point, float &mindist, bool ignoreSeeThrough, CStoredCollPoly *poly)
CColPoint &point, float &mindist, bool ignoreSeeThrough, bool ignoreShootThrough, CStoredCollPoly *poly)
{
static CStoredCollPoly TempStoredPoly;
int i;
@ -1100,17 +1103,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){
@ -1639,15 +1642,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();
@ -1720,8 +1723,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

@ -151,7 +151,7 @@ public:
static bool TestLineTriangle(const CColLine &line, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane);
static bool TestLineSphere(const CColLine &line, const CColSphere &sph);
static bool TestSphereTriangle(const CColSphere &sphere, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane);
static bool TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, bool ignoreSeeThrough);
static bool TestLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, bool ignoreSeeThrough, bool ignoreShootThrough);
static bool ProcessSphereSphere(const CColSphere &s1, const CColSphere &s2, CColPoint &point, float &mindistsq);
static bool ProcessSphereBox(const CColSphere &sph, const CColBox &box, CColPoint &point, float &mindistsq);
@ -160,8 +160,8 @@ public:
static bool ProcessLineTriangle(const CColLine &line , const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindist);
static bool ProcessLineSphere(const CColLine &line, const CColSphere &sphere, CColPoint &point, float &mindist);
static bool ProcessSphereTriangle(const CColSphere &sph, const CVector *verts, const CColTriangle &tri, const CColTrianglePlane &plane, CColPoint &point, float &mindistsq);
static bool ProcessLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough);
static bool ProcessVerticalLine(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough, CStoredCollPoly *poly);
static bool ProcessLineOfSight(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough, bool ignoreShootThrough);
static bool ProcessVerticalLine(const CColLine &line, const CMatrix &matrix, CColModel &model, CColPoint &point, float &mindist, bool ignoreSeeThrough, bool ignoreShootThrough, CStoredCollPoly *poly);
static int32 ProcessColModels(const CMatrix &matrixA, CColModel &modelA, const CMatrix &matrixB, CColModel &modelB, CColPoint *spherepoints, CColPoint *linepoints, float *linedists);
static bool IsStoredPolyStillValidVerticalLine(const CVector &pos, float z, CColPoint &point, CStoredCollPoly *poly);

View file

@ -205,6 +205,8 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
SetControllerKeyAssociatedWithAction (PED_LOOKBEHIND, rsPADEND, KEYBOARD);
SetControllerKeyAssociatedWithAction (PED_LOOKBEHIND, rsCAPSLK, OPTIONAL_EXTRA);
SetControllerKeyAssociatedWithAction (PED_DUCK, 'C', KEYBOARD);
SetControllerKeyAssociatedWithAction (PED_FIREWEAPON, rsPADINS, KEYBOARD);
SetControllerKeyAssociatedWithAction (PED_FIREWEAPON, rsLCTRL, OPTIONAL_EXTRA);
@ -217,6 +219,8 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
SetControllerKeyAssociatedWithAction (PED_JUMPING, rsRCTRL, KEYBOARD);
SetControllerKeyAssociatedWithAction (PED_JUMPING, ' ', OPTIONAL_EXTRA);
SetControllerKeyAssociatedWithAction (PED_ANSWER_PHONE, rsTAB, KEYBOARD);
if ( _dwOperatingSystemVersion == OS_WIN98 )
SetControllerKeyAssociatedWithAction(PED_SPRINT, rsSHIFT, OPTIONAL_EXTRA); // BUG: must be KEYBOARD ?
@ -259,7 +263,7 @@ void CControllerConfigManager::InitDefaultControlConfiguration()
SetControllerKeyAssociatedWithAction (VEHICLE_TURRETDOWN, rsPADRIGHT, KEYBOARD);
SetControllerKeyAssociatedWithAction (CAMERA_CHANGE_VIEW_ALL_SITUATIONS, rsHOME, KEYBOARD);
SetControllerKeyAssociatedWithAction (CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 'C', OPTIONAL_EXTRA);
SetControllerKeyAssociatedWithAction (CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 'V', OPTIONAL_EXTRA);
for (int32 i = 0; i < MAX_SIMS; i++)
{
@ -336,13 +340,14 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
case 10:
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK);
case 9:
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
case 8:
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
case 7:
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
case 6:
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
@ -384,13 +389,14 @@ void CControllerConfigManager::InitDefaultControlConfigJoyPad(uint32 buttons)
SetControllerKeyAssociatedWithAction(TOGGLE_SUBMISSIONS, 11, JOYSTICK);
case 10:
SetControllerKeyAssociatedWithAction(VEHICLE_HORN, 10, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_DUCK, 10, JOYSTICK);
case 9:
SetControllerKeyAssociatedWithAction(CAMERA_CHANGE_VIEW_ALL_SITUATIONS, 9, JOYSTICK);
case 8:
SetControllerKeyAssociatedWithAction(VEHICLE_HANDBRAKE, 8, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_LOCK_TARGET, 8, JOYSTICK);
case 7:
SetControllerKeyAssociatedWithAction(PED_CENTER_CAMERA_BEHIND_PLAYER, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, 7, JOYSTICK);
SetControllerKeyAssociatedWithAction(VEHICLE_CHANGE_RADIO_STATION, 7, JOYSTICK);
case 6:
SetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, 6, JOYSTICK);
@ -431,6 +437,8 @@ void CControllerConfigManager::InitialiseControllerActionNameArray()
SETACTIONNAME(PED_CYCLE_TARGET_LEFT);
SETACTIONNAME(PED_CYCLE_TARGET_RIGHT);
SETACTIONNAME(PED_CENTER_CAMERA_BEHIND_PLAYER);
SETACTIONNAME(PED_DUCK);
SETACTIONNAME(PED_ANSWER_PHONE);
SETACTIONNAME(VEHICLE_LOOKBEHIND);
SETACTIONNAME(VEHICLE_LOOKLEFT);
SETACTIONNAME(VEHICLE_LOOKRIGHT);
@ -754,6 +762,8 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown_FirstPersonOnl
state.Square = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_SNIPER_ZOOM_OUT, type))
state.Cross = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_DUCK, type))
state.RightShock = 255;
}
void CControllerConfigManager::AffectControllerStateOn_ButtonDown_ThirdPersonOnly(int32 button, eControllerType type, CControllerState &state)
@ -762,14 +772,18 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown_ThirdPersonOnl
state.RightShock = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_JUMPING, type))
state.Square = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, type))
state.LeftShoulder1 = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_LEFT, type))
state.LeftShoulder2 = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_CYCLE_WEAPON_RIGHT, type))
state.RightShoulder2 = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_SPRINT, type))
state.Cross = 255;
if (button == GetControllerKeyAssociatedWithAction(PED_DUCK, type))
state.RightShock = 255;
if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC)
if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC)
{
if (button == GetControllerKeyAssociatedWithAction(PED_CYCLE_TARGET_LEFT, type))
state.LeftShoulder2 = 255;
@ -835,7 +849,7 @@ void CControllerConfigManager::AffectControllerStateOn_ButtonDown_FirstAndThirdP
state.RightStickX = 128;
}
if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC)
if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC)
{
if (button == GetControllerKeyAssociatedWithAction(PED_1RST_PERSON_LOOK_UP, type))
{
@ -1616,8 +1630,12 @@ void CControllerConfigManager::DeleteMatching3rdPersonControls(e_ControllerActio
ClearSettingsAssociatedWithAction(PED_JUMPING, type);
if (key == GetControllerKeyAssociatedWithAction(PED_SPRINT, type))
ClearSettingsAssociatedWithAction(PED_SPRINT, type);
if (key == GetControllerKeyAssociatedWithAction(PED_DUCK, type))
ClearSettingsAssociatedWithAction(PED_DUCK, type);
if (key == GetControllerKeyAssociatedWithAction(PED_ANSWER_PHONE, type))
ClearSettingsAssociatedWithAction(PED_ANSWER_PHONE, type);
if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC)
if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC)
{
if (key == GetControllerKeyAssociatedWithAction(PED_CYCLE_TARGET_LEFT, type))
ClearSettingsAssociatedWithAction(PED_CYCLE_TARGET_LEFT, type);
@ -1640,7 +1658,7 @@ void CControllerConfigManager::DeleteMatching1rst3rdPersonControls(e_ControllerA
if (key == GetControllerKeyAssociatedWithAction(GO_BACK, type))
ClearSettingsAssociatedWithAction(GO_BACK, type);
if (CMenuManager::m_ControlMethod == CONTROL_CLASSIC)
if (FrontEndMenuManager.m_ControlMethod == CONTROL_CLASSIC)
{
if (key == GetControllerKeyAssociatedWithAction(PED_1RST_PERSON_LOOK_LEFT, type))
ClearSettingsAssociatedWithAction(PED_1RST_PERSON_LOOK_LEFT, type);
@ -1803,6 +1821,8 @@ e_ControllerActionType CControllerConfigManager::GetActionType(e_ControllerActio
case PED_CYCLE_WEAPON_RIGHT:
case PED_JUMPING:
case PED_SPRINT:
case PED_DUCK:
case PED_ANSWER_PHONE:
case PED_CYCLE_TARGET_LEFT:
case PED_CYCLE_TARGET_RIGHT:
case PED_CENTER_CAMERA_BEHIND_PLAYER:

View file

@ -32,6 +32,8 @@ enum e_ControllerAction
PED_JUMPING,
PED_SPRINT,
PED_LOOKBEHIND,
PED_DUCK,
PED_ANSWER_PHONE,
VEHICLE_ACCELERATE,
VEHICLE_BRAKE,
VEHICLE_CHANGE_RADIO_STATION,

View file

@ -22,10 +22,12 @@ enum eEventType
EVENT_PED_SET_ON_FIRE,
EVENT_COP_SET_ON_FIRE,
EVENT_CAR_SET_ON_FIRE,
EVENT_ASSAULT_NASTYWEAPON, // not sure
EVENT_ASSAULT_NASTYWEAPON,
EVENT_ASSAULT_NASTYWEAPON_POLICE,
EVENT_ICECREAM,
EVENT_ATM,
EVENT_SHOPSTALL, // used on graffitis
EVENT_SHOPSTALL,
EVENT_SHOPWINDOW,
EVENT_LAST_EVENT
};

View file

@ -1,4 +1,5 @@
#include "common.h"
#include <ctype.h>
#include "main.h"
#include "Quaternion.h"
@ -26,6 +27,9 @@
#include "FileLoader.h"
#include "Streaming.h"
#include "ColStore.h"
#include "Occlusion.h"
//--MIAMI: file done
char CFileLoader::ms_line[256];
@ -159,7 +163,6 @@ struct ColHeader
uint32 size;
};
//--MIAMI: done
void
CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
{
@ -196,7 +199,6 @@ CFileLoader::LoadCollisionFile(const char *filename, uint8 colSlot)
}
//--MIAMI: done
bool
CFileLoader::LoadCollisionFileFirstTime(uint8 *buffer, uint32 size, uint8 colSlot)
{
@ -298,13 +300,15 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
model.numLines = *(int16*)buf;
buf += 4;
if(model.numLines > 0){
model.lines = (CColLine*)RwMalloc(model.numLines*sizeof(CColLine));
//model.lines = (CColLine*)RwMalloc(model.numLines*sizeof(CColLine));
for(i = 0; i < model.numLines; i++){
model.lines[i].Set(*(CVector*)buf, *(CVector*)(buf+12));
//model.lines[i].Set(*(CVector*)buf, *(CVector*)(buf+12));
buf += 24;
}
}else
model.lines = nil;
model.numLines = 0;
model.lines = nil;
model.numBoxes = *(int16*)buf;
buf += 4;
@ -323,10 +327,12 @@ CFileLoader::LoadCollisionModel(uint8 *buf, CColModel &model, char *modelname)
model.vertices = (CVector*)RwMalloc(numVertices*sizeof(CVector));
for(i = 0; i < numVertices; i++){
model.vertices[i] = *(CVector*)buf;
#if 0
if(Abs(model.vertices[i].x) >= 256.0f ||
Abs(model.vertices[i].y) >= 256.0f ||
Abs(model.vertices[i].z) >= 256.0f)
printf("%s:Collision volume too big\n", modelname);
#endif
buf += 12;
}
}else
@ -349,7 +355,7 @@ GetNameAndLOD(char *nodename, char *name, int *n)
{
char *underscore = nil;
for(char *s = nodename; *s != '\0'; s++){
if(s[0] == '_' && (s[1] == 'l' || s[1] == 'L'))
if(s[0] == '_' && (s[1] == 'l' || s[1] == 'L') && isdigit(s[2]))
underscore = s;
}
if(underscore){
@ -956,7 +962,7 @@ CFileLoader::LoadCarPathNode(const char *line, int id, int node, bool waterPath)
void
CFileLoader::Load2dEffect(const char *line)
{
int id, r, g, b, a, type;
int id, r, g, b, a, type, ptype;
float x, y, z;
char corona[32], shadow[32];
int shadowIntens, lightType, roadReflection, flare, flags, probability;
@ -1029,6 +1035,18 @@ CFileLoader::Load2dEffect(const char *line)
effect->attractor.flags = flags;
effect->attractor.probability = probability;
break;
case EFFECT_PED_ATTRACTOR:
sscanf(line, "%d %f %f %f %d %d %d %d %d %d %f %f %f %f %f %f",
&id, &x, &y, &z, &r, &g, &b, &a, &type,
&ptype,
&effect->pedattr.queueDir.x,
&effect->pedattr.queueDir.y,
&effect->pedattr.queueDir.z,
&effect->pedattr.useDir.x,
&effect->pedattr.useDir.y,
&effect->pedattr.useDir.z);
effect->pedattr.type = ptype;
break;
}
CTxdStore::PopCurrentTxd();
@ -1081,7 +1099,7 @@ CFileLoader::LoadScene(const char *filename)
LoadCullZone(line);
break;
case OCCL:
// TODO(MIAMI): occlusion
LoadOcclusionVolume(line);
break;
case PICK:
// unused
@ -1175,7 +1193,9 @@ CFileLoader::LoadObjectInstance(const char *line)
CColStore::GetBoundingBox(col->level).ContainRect(entity->GetBoundRect());
}else
entity->bUsesCollision = false;
// TODO(MIAMI): set some flag here if col min is below 6
if(entity->GetPosition().z + col->boundingBox.min.z < 6.0f)
entity->bUnderwater = true;
}else{
entity = new CDummyObject;
entity->SetModelIndexNoCreate(id);
@ -1229,6 +1249,21 @@ CFileLoader::LoadPickup(const char *line)
sscanf(line, "%d %f %f %f", &id, &x, &y, &z);
}
void
CFileLoader::LoadOcclusionVolume(const char *line)
{
float x, y, z;
float width, length, height;
float angle;
sscanf(line, "%f %f %f %f %f %f %f",
&x, &y, &z,
&width, &length, &height,
&angle);
COcclusion::AddOne(x, y, z, width, length, z + height/2.0f, angle);
}
//--MIAMI: unused
void
CFileLoader::ReloadPaths(const char *filename)

View file

@ -39,6 +39,7 @@ public:
static void LoadZone(const char *line);
static void LoadCullZone(const char *line);
static void LoadPickup(const char *line);
static void LoadOcclusionVolume(const char *line);
static void ReloadPaths(const char *filename);
static void ReloadObjectTypes(const char *filename);

File diff suppressed because it is too large Load diff

View file

@ -7,8 +7,8 @@
#define MENUHEADER_POS_Y 75.0f
#define MENUHEADER_HEIGHT 1.3f
#else
#define MENUHEADER_POS_X 35.0f
#define MENUHEADER_POS_Y 93.0f
#define MENUHEADER_POS_X 10.0f
#define MENUHEADER_POS_Y 10.0f
#define MENUHEADER_HEIGHT 1.6f
#endif
#define MENUHEADER_WIDTH 0.84f
@ -20,7 +20,7 @@
#define MENURADIO_ICON_SCALE 60.0f
#define MENUSLIDER_X 256.0f
#define MENUSLIDER_X 128.0f
#define MENUSLIDER_UNK 256.0f
#define BIGTEXT_X_SCALE 0.75f
@ -95,62 +95,34 @@ enum eLanguages
#endif
};
enum eFrontendSprites
{
FE2_MAINPANEL_UL,
FE2_MAINPANEL_UR,
FE2_MAINPANEL_DL,
FE2_MAINPANEL_DR,
FE2_MAINPANEL_DR2,
FE2_TABACTIVE,
FE_ICONBRIEF,
FE_ICONSTATS,
FE_ICONCONTROLS,
FE_ICONSAVE,
FE_ICONAUDIO,
FE_ICONDISPLAY,
FE_ICONLANGUAGE,
FE_CONTROLLER,
FE_CONTROLLERSH,
FE_ARROWS1,
FE_ARROWS2,
FE_ARROWS3,
FE_ARROWS4,
FE_RADIO1,
FE_RADIO2,
FE_RADIO3,
FE_RADIO4,
FE_RADIO5,
FE_RADIO6,
FE_RADIO7,
FE_RADIO8,
FE_RADIO9,
NUM_FE_SPRITES
};
enum eMenuSprites
{
MENUSPRITE_CONNECTION,
MENUSPRITE_FINDGAME,
MENUSPRITE_HOSTGAME,
MENUSPRITE_MAINMENU,
MENUSPRITE_PLAYERSET,
MENUSPRITE_SINGLEPLAYER,
MENUSPRITE_MULTIPLAYER,
MENUSPRITE_DMALOGO,
MENUSPRITE_GTALOGO,
MENUSPRITE_RSTARLOGO,
MENUSPRITE_GAMESPY,
MENUSPRITE_BACKGROUND,
MENUSPRITE_VCLOGO,
MENUSPRITE_MOUSE,
MENUSPRITE_MOUSET,
MENUSPRITE_MP3LOGO,
MENUSPRITE_MAPTOP01,
MENUSPRITE_MAPTOP02,
MENUSPRITE_MAPTOP03,
MENUSPRITE_MAPMID01,
MENUSPRITE_MAPMID02,
MENUSPRITE_MAPMID03,
MENUSPRITE_MAPBOT01,
MENUSPRITE_MAPBOT02,
MENUSPRITE_MAPBOT03,
MENUSPRITE_WILDSTYLE,
MENUSPRITE_FLASH,
MENUSPRITE_KCHAT,
MENUSPRITE_FEVER,
MENUSPRITE_VROCK,
MENUSPRITE_VCPR,
MENUSPRITE_ESPANTOSO,
MENUSPRITE_EMOTION,
MENUSPRITE_WAVE,
MENUSPRITE_MP3,
MENUSPRITE_DOWNOFF,
MENUSPRITE_DOWNON,
MENUSPRITE_UPOFF,
MENUSPRITE_UPON,
MENUSPRITE_GTA3LOGO,
MENUSPRITE_UNUSED,
NUM_MENU_SPRITES
};
@ -169,22 +141,6 @@ enum eSaveSlot
SAVESLOT_LABEL = 36
};
#ifdef MENU_MAP
enum MapSprites
{
MAPMID1,
MAPMID2,
MAPMID3,
MAPBOT1,
MAPBOT2,
MAPBOT3,
MAPTOP1,
MAPTOP2,
MAPTOP3,
NUM_MAP_SPRITES
};
#endif
enum eMenuScreen
{
MENUPAGE_DISABLED = -1,
@ -372,7 +328,10 @@ enum eMenuAction
MENUACTION_LANG_JAP,
#endif
#ifdef IMPROVED_VIDEOMODE
MENUACTION_SCREENMODE
MENUACTION_SCREENMODE,
#endif
#ifdef FREE_CAM
MENUACTION_FREECAM
#endif
};
@ -472,69 +431,195 @@ struct CMenuScreen
} m_aEntries[NUM_MENUROWS];
};
struct MenuTrapezoid
{
float topLeft_x;
float topLeft_y;
float topRight_x;
float topRight_y;
float bottomLeft_x;
float bottomLeft_y;
float bottomRight_x;
float bottomRight_y;
float old_topRight_x;
float old_topRight_y;
float old_topLeft_x;
float old_topLeft_y;
float old_bottomLeft_x;
float old_bottomLeft_y;
float old_bottomRight_x;
float old_bottomRight_y;
float mult_topRight_x;
float mult_topRight_y;
float mult_topLeft_x;
float mult_topLeft_y;
float mult_bottomLeft_x;
float mult_bottomLeft_y;
float mult_bottomRight_x;
float mult_bottomRight_y;
MenuTrapezoid(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) {
topLeft_x = x1;
topLeft_y = y1;
topRight_x = x2;
topRight_y = y2;
bottomLeft_x = x3;
bottomLeft_y = y3;
bottomRight_x = x4;
bottomRight_y = y4;
};
void SaveCurrentCoors() {
old_topLeft_x = topLeft_x;
old_topLeft_y = topLeft_y;
old_topRight_x = topRight_x;
old_topRight_y = topRight_y;
old_bottomLeft_x = bottomLeft_x;
old_bottomLeft_y = bottomLeft_y;
old_bottomRight_x = bottomRight_x;
old_bottomRight_y = bottomRight_y;
}
void Translate(int delta) {
bottomRight_x = delta * mult_bottomRight_x + old_bottomRight_x;
bottomRight_y = delta * mult_bottomRight_y + old_bottomRight_y;
bottomLeft_x = delta * mult_bottomLeft_x + old_bottomLeft_x;
bottomLeft_y = delta * mult_bottomLeft_y + old_bottomLeft_y;
topRight_x = delta * mult_topRight_x + old_topRight_x;
topRight_y = delta * mult_topRight_y + old_topRight_y;
topLeft_x = delta * mult_topLeft_x + old_topLeft_x;
topLeft_y = delta * mult_topLeft_y + old_topLeft_y;
}
void UpdateMultipliers() {
mult_bottomRight_x = (bottomRight_x - old_bottomRight_x) / 255.0f;
mult_bottomRight_y = (bottomRight_y - old_bottomRight_y) / 255.0f;
mult_bottomLeft_x = (bottomLeft_x - old_bottomLeft_x) / 255.0f;
mult_bottomLeft_y = (bottomLeft_y - old_bottomLeft_y) / 255.0f;
mult_topRight_x = (topRight_x - old_topRight_x) / 255.0f;
mult_topRight_y = (topRight_y - old_topRight_y) / 255.0f;
mult_topLeft_x = (topLeft_x - old_topLeft_x) / 255.0f;
mult_topLeft_y = (topLeft_y - old_topLeft_y) / 255.0f;
}
};
class CMenuManager
{
public:
int32 m_nPrefsVideoMode;
int32 m_nDisplayVideoMode;
int8 m_StatsScrollDirection;
float m_StatsScrollSpeed;
uint8 field_8;
bool m_PrefsUseVibration;
bool m_PrefsShowHud;
int32 m_PrefsRadarMode;
uint8 field_10;
bool m_bShutDownFrontEndRequested;
bool m_bStartUpFrontEndRequested;
int32 m_KeyPressedCode;
int32 m_PrefsBrightness;
float m_PrefsLOD;
int8 m_PrefsShowSubtitles;
int8 m_PrefsShowLegends;
int8 m_PrefsUseWideScreen;
int8 m_PrefsVsync; // TODO(Miami): Are we sure?
int8 m_PrefsVsyncDisp;
int8 m_PrefsFrameLimiter;
int8 m_nPrefsAudio3DProviderIndex;
bool m_bKeyChangeNotProcessed;
char m_aSkinName[256];
int32 m_nHelperTextMsgId;
bool m_bLanguageLoaded;
int8 m_PrefsSpeakers;
int8 m_PrefsDMA;
uint8 m_PrefsSfxVolume;
uint8 m_PrefsMusicVolume;
uint8 m_PrefsRadioStation;
uint8 field_2C;
int32 m_nCurrOption;
bool m_bQuitGameNoCD;
bool m_bMenuMapActive;
bool m_AllowNavigation;
uint8 field_37;
bool m_bMenuActive;
bool m_bMenuStateChanged;
bool m_bWaitingForNewKeyBind;
bool m_bWantToRestart;
bool m_bFirstTime;
bool m_bGameNotLoaded;
int32 m_nMousePosX;
int32 m_nMousePosY;
bool m_bActivateSaveMenu;
bool m_bWantToLoad;
float m_fMapSize;
float m_fMapCenterX;
float m_fMapCenterY;
uint32 OS_Language;
int32 m_PrefsLanguage;
int32 field_54;
int8 m_bLanguageLoaded;
uint8 m_PrefsAllowNastyGame;
uint8 m_PrefsMP3BoostVolume;
uint8 m_ControlMethod;
int32 m_nPrefsVideoMode;
int32 m_nDisplayVideoMode;
int32 m_nMouseTempPosX;
int32 m_nMouseTempPosY;
bool m_bGameNotLoaded;
int8 m_lastWorking3DAudioProvider;
bool m_bFrontEnd_ReloadObrTxtGxt;
int32 *pEditString;
uint8 field_74[4];
int32 *pControlEdit;
bool m_OnlySaveMenu;
int32 m_menuTransitionProgress;
CSprite2d m_aFrontEndSprites[NUM_MENU_SPRITES];
bool m_bSpritesLoaded;
int32 field_F0;
int32 m_LastRadioScrollDir;
int32 m_nCurrScreen;
int32 m_nPrevScreen;
int32 m_nCurrSaveSlot;
int32 m_LastScreenSwitch;
int32 m_nMenuFadeAlpha;
int32 bOptionHighlightTransitionBlend;
bool bMenuChangeOngoing;
int32 MouseButtonJustClicked;
int32 JoyButtonJustClicked;
bool DisplayComboButtonErrMsg;
bool m_NoEmptyBinding;
bool m_ShowEmptyBindingError;
int32 m_nHelperTextAlpha;
bool m_bPressedPgUpOnList;
bool m_bPressedPgDnOnList;
bool m_bPressedUpOnList;
bool m_bPressedDownOnList;
bool m_bPressedScrollButton;
uint8 field_129;
uint8 field_12A;
uint8 field_12B;
int32 m_nMousePosX;
int32 m_nMousePosY;
int32 m_nMouseOldPosX;
int32 m_nMouseOldPosY;
int32 m_nHoverOption;
bool m_bShowMouse;
int32 m_nPrevOption;
bool m_bStartWaitingForKeyBind;
bool m_bWaitingForNewKeyBind;
bool m_bKeyChangeNotProcessed;
int32 m_CurrCntrlAction;
uint8 field_150;
uint8 field_151;
uint8 field_152;
uint8 field_153;
int32 m_nSelectedContSetupColumn;
bool m_bKeyIsOK;
bool field_159;
uint8 m_nCurrExLayer;
char m_PrefsSkinFile[256];
char m_aSkinName[256];
uint8 field_35B;
int32 m_nHelperTextMsgId;
tSkinInfo m_pSkinListHead;
tSkinInfo *m_pSelectedSkin;
int32 m_nFirstVisibleRowOnList;
float m_nScrollbarTopMargin;
int32 m_nTotalListRow;
int32 m_nSkinsTotal;
char _unk0[4];
uint8 field_67C[4];
int32 m_nSelectedListRow;
bool m_bSkinsEnumerated;
bool m_bQuitGameNoCD;
bool m_bRenderGameInMenu;
bool m_bSaveMenuActive;
bool m_bWantToLoad;
char field_455;
bool m_bStartWaitingForKeyBind;
bool m_bSpritesLoaded;
CSprite2d m_aFrontEndSprites[NUM_FE_SPRITES];
CSprite2d m_aMenuSprites[NUM_MENU_SPRITES];
int32 field_518;
int32 m_nMenuFadeAlpha;
bool m_bPressedPgUpOnList;
bool m_bPressedPgDnOnList;
bool m_bPressedUpOnList;
bool m_bPressedDownOnList;
bool m_bPressedScrollButton;
int32 m_CurrCntrlAction;
char _unk1[4];
int32 m_nSelectedContSetupColumn;
bool m_bKeyIsOK;
bool field_535;
int8 m_nCurrExLayer;
int32 m_nHelperTextAlpha;
int32 m_nMouseOldPosX;
int32 m_nMouseOldPosY;
int32 m_nHoverOption;
int32 m_nCurrScreen;
int32 m_nCurrOption;
int32 m_nPrevOption;
int32 m_nPrevScreen;
uint32 field_558;
int32 m_nCurrSaveSlot;
int32 m_nScreenChangeDelayTimer;
#ifdef IMPROVED_VIDEOMODE
int32 m_nPrefsWidth;
@ -545,109 +630,66 @@ public:
int32 m_nSelectedScreenMode;
#endif
public:
bool GetIsMenuActive() {return !!m_bMenuActive;}
public:
static int32 OS_Language;
static int8 m_PrefsUseVibration;
static int8 m_DisplayControllerOnFoot;
static int8 m_PrefsUseWideScreen;
static int8 m_PrefsRadioStation;
static int8 m_PrefsVsync;
static int8 m_PrefsVsyncDisp;
static int8 m_PrefsFrameLimiter;
static int8 m_PrefsShowSubtitles;
static int8 m_PrefsSpeakers;
static int32 m_ControlMethod;
static int8 m_PrefsDMA;
static int32 m_PrefsLanguage;
static int32 m_PrefsBrightness;
static float m_PrefsLOD;
static int8 m_bFrontEnd_ReloadObrTxtGxt;
static int32 m_PrefsMusicVolume;
static int32 m_PrefsSfxVolume;
static char m_PrefsSkinFile[256];
static int32 m_KeyPressedCode;
static bool m_bStartUpFrontEndRequested;
static bool m_bShutDownFrontEndRequested;
static bool m_PrefsAllowNastyGame;
static uint8 m_PrefsStereoMono;
static int32 m_SelectedMap;
static int32 m_SelectedGameType;
static uint8 m_PrefsPlayerRed;
static uint8 m_PrefsPlayerGreen;
static uint8 m_PrefsPlayerBlue;
#ifndef MASTER
static bool m_PrefsMarketing;
static bool m_PrefsDisableTutorials;
#endif // !MASTER
#ifdef MENU_MAP
static bool bMenuMapActive;
static bool bMapMouseShownOnce;
static bool bMapLoaded;
static float fMapSize;
static float fMapCenterY;
static float fMapCenterX;
static CSprite2d m_aMapSprites[NUM_MAP_SPRITES];
CMenuManager(void);
~CMenuManager(void) { UnloadTextures(); }
void Initialise();
void PrintMap();
#endif
public:
void SetFrontEndRenderStates();
static void BuildStatLine(Const char *text, void *stat, bool itsFloat, void *stat2);
static void CentreMousePointer();
void CheckCodesForControls(int);
bool CheckHover(int x1, int x2, int y1, int y2);
void CheckSliderMovement(int);
int CostructStatLine(int);
void DisplayHelperText();
int DisplaySlider(float, float, float, float, float, float);
void DoSettingsBeforeStartingAGame();
void Draw();
void DrawStandardMenus();
void DrawControllerBound(int32, int32, int32, int8);
void DrawControllerScreenExtraText(int, int, int);
void DrawControllerSetupScreen();
void DrawFrontEnd();
void DrawFrontEndNormal();
#ifdef PS2_SAVE_DIALOG
void DrawFrontEndSaveZone();
#endif
void DrawBackground(bool transitionCall);
void DrawPlayerSetupScreen();
int FadeIn(int alpha);
void FilterOutColorMarkersFromString(wchar*, CRGBA &);
int GetStartOptionsCntrlConfigScreens();
static void InitialiseChangedLanguageSettings();
void InitialiseChangedLanguageSettings();
void LoadAllTextures();
void LoadSettings();
void MessageScreen(const char *);
// TODO(MIAMI): implement the second argument
void MessageScreen(const char *str, bool) { MessageScreen(str); }
void PickNewPlayerColour();
void PrintBriefs();
static void PrintErrorMessage();
void PrintStats();
void Process();
void ProcessButtonPresses();
void ProcessFileActions();
void ProcessOnOffMenuOptions();
static void RequestFrontEndShutDown();
static void RequestFrontEndStartUp();
void RequestFrontEndShutDown();
void RequestFrontEndStartUp();
void ResetHelperText();
void SaveLoadFileError_SetUpErrorScreen();
void SaveSettings();
void SetHelperText(int text);
void ShutdownJustMenu();
float StretchX(float);
float StretchY(float);
void SwitchMenuOnAndOff();
void UnloadTextures();
void WaitForUserCD();
void PrintController();
int GetNumOptionsCntrlConfigScreens();
int ConstructStatLine(int);
void SwitchToNewScreen(int8);
// New (not in function or inlined in the game)
void ThingsToDoBeforeLeavingPage();
@ -660,7 +702,7 @@ public:
};
#ifndef IMPROVED_VIDEOMODE
VALIDATE_SIZE(CMenuManager, 0x564);
VALIDATE_SIZE(CMenuManager, 0x688);
#endif
extern CMenuManager FrontEndMenuManager;

View file

@ -64,6 +64,7 @@
#include "Script.h"
#include "Shadows.h"
#include "Skidmarks.h"
#include "SetPieces.h"
#include "SpecialFX.h"
#include "Sprite2d.h"
#include "Stats.h"
@ -84,6 +85,7 @@
#include "World.h"
#include "ZoneCull.h"
#include "Zones.h"
#include "Occlusion.h"
#include "debugmenu.h"
@ -220,20 +222,20 @@ bool CGame::InitialiseOnceAfterRW(void)
if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 )
{
CMenuManager::m_PrefsSpeakers = 0;
FrontEndMenuManager.m_PrefsSpeakers = 0;
int8 provider = DMAudio.AutoDetect3DProviders();
if ( provider != -1 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = provider;
}
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);
DMAudio.SetSpeakerConfig(CMenuManager::m_PrefsSpeakers);
DMAudio.SetDynamicAcousticModelingStatus(CMenuManager::m_PrefsDMA);
DMAudio.SetMusicMasterVolume(CMenuManager::m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(CMenuManager::m_PrefsSfxVolume);
DMAudio.SetSpeakerConfig(FrontEndMenuManager.m_PrefsSpeakers);
DMAudio.SetDynamicAcousticModelingStatus(FrontEndMenuManager.m_PrefsDMA);
DMAudio.SetMusicMasterVolume(FrontEndMenuManager.m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(FrontEndMenuManager.m_PrefsSfxVolume);
DMAudio.SetEffectsFadeVol(127);
DMAudio.SetMusicFadeVol(127);
CWorld::Players[0].SetPlayerSkin(CMenuManager::m_PrefsSkinFile);
CWorld::Players[0].SetPlayerSkin(FrontEndMenuManager.m_PrefsSkinFile);
return true;
}
@ -272,7 +274,9 @@ bool CGame::Initialise(const char* datFile)
ThePaths.AllocatePathFindInfoMem(4500);
CWeather::Init();
CCullZones::Init();
COcclusion::Init();
CCollision::Init();
CSetPieces::Init();
CTheZones::Init();
CUserDisplay::Init();
CMessages::Init();
@ -527,6 +531,7 @@ void CGame::ShutDownForRestart(void)
CRadar::RemoveRadarSections();
FrontEndMenuManager.UnloadTextures();
CParticleObject::RemoveAllParticleObjects();
CSetPieces::Init();
CPedType::Shutdown();
CSpecialFX::Shutdown();
TidyUpMemory(true, false);
@ -539,7 +544,14 @@ void CGame::InitialiseWhenRestarting(void)
CTimer::Initialise();
CSprite2d::SetRecipNearClip();
if (b_FoundRecentSavedGameWantToLoad || FrontEndMenuManager.m_bWantToLoad)
{
LoadSplash("splash1");
if (FrontEndMenuManager.m_bWantToLoad)
FrontEndMenuManager.MessageScreen("FELD_WR", true);
}
b_FoundRecentSavedGameWantToLoad = false;
TheCamera.Init();
@ -620,6 +632,7 @@ void CGame::Process(void)
CAntennas::Update();
CGlass::Update();
CSceneEdit::Update();
CSetPieces::Update();
CEventList::Update();
CParticle::Update();
gFireManager.Update();
@ -662,6 +675,16 @@ void CGame::Process(void)
}
}
void
CGame::InitAfterFocusLoss()
{
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = FrontEndMenuManager.m_lastWorking3DAudioProvider;
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_lastWorking3DAudioProvider);
if (!FrontEndMenuManager.m_bGameNotLoaded && !FrontEndMenuManager.m_bMenuActive)
FrontEndMenuManager.m_bStartUpFrontEndRequested = true;
}
bool
CGame::CanSeeOutSideFromCurrArea(void)
{

View file

@ -59,6 +59,8 @@ public:
static void InitialiseWhenRestarting(void);
static void Process(void);
static void InitAfterFocusLoss(void);
static bool IsInInterior(void) { return currArea != AREA_MAIN_MAP; }
static bool CanSeeOutSideFromCurrArea(void);

View file

@ -206,20 +206,12 @@ const CMenuScreen aScreens[] = {
MENUACTION_MEMCARDSAVECONFIRM, "JAILB_U", SAVESLOT_NONE, MENUPAGE_NONE,
},
// Unused in PC but anyway
// MENUPAGE_SAVE = 24
#ifdef PS2_SAVE_DIALOG
{ "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_CHANGEMENU, "FESZ_SA", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
#else
{ "FET_SG", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
MENUACTION_LABEL, "FES_SCG", SAVESLOT_NONE, MENUPAGE_NONE,
MENUACTION_POPULATESLOTS_CHANGEMENU, "GMSAVE", SAVESLOT_NONE, MENUPAGE_CHOOSE_SAVE_SLOT,
MENUACTION_RESUME_FROM_SAVEZONE, "FESZ_CA", SAVESLOT_NONE, MENUPAGE_NONE,
},
#endif
// MENUPAGE_NO_MEMORY_CARD_2 = 25
{ "FES_NOC", 1, MENUPAGE_DISABLED, MENUPAGE_DISABLED, 0, 0,
@ -284,6 +276,9 @@ 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,
#ifdef FREE_CAM
MENUACTION_FREECAM, "FREECAM", SAVESLOT_NONE, MENUPAGE_CONTROLLER_PC,
#endif
MENUACTION_CHANGEMENU, "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,

View file

@ -49,7 +49,7 @@ CKeyboardState CPad::OldKeyState;
CKeyboardState CPad::NewKeyState;
CKeyboardState CPad::TempKeyState;
char CPad::KeyBoardCheatString[20];
char CPad::KeyBoardCheatString[30];
CMouseControllerState CPad::OldMouseControllerState;
CMouseControllerState CPad::NewMouseControllerState;
@ -68,39 +68,39 @@ void WeaponCheat()
CStreaming::RequestModel(MI_GRENADE, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_BOMB, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_AK47, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_RUGER, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_BASEBALL_BAT, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_COLT, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_COLT45, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_ROCKETLAUNCHER, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_SHOTGUN, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_SNIPER, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_SPAS12_SHOTGUN, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_SNIPERRIFLE, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_MP5, STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_BASEBALLBAT, 0);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_COLT45, 100);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_MP5, 100);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SHOTGUN, 20);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_AK47, 200);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SPAS12_SHOTGUN, 20);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_RUGER, 200);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_SNIPERRIFLE, 5);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_ROCKETLAUNCHER, 5);
FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR_GRENADE, 5);
CStreaming::SetModelIsDeletable(MI_GRENADE);
CStreaming::SetModelIsDeletable(MI_BOMB);
CStreaming::SetModelIsDeletable(MI_AK47);
CStreaming::SetModelIsDeletable(MI_RUGER);
CStreaming::SetModelIsDeletable(MI_BASEBALL_BAT);
CStreaming::SetModelIsDeletable(MI_COLT);
CStreaming::SetModelIsDeletable(MI_COLT45);
CStreaming::SetModelIsDeletable(MI_ROCKETLAUNCHER);
CStreaming::SetModelIsDeletable(MI_SHOTGUN);
CStreaming::SetModelIsDeletable(MI_SNIPER);
CStreaming::SetModelIsDeletable(MI_SPAS12_SHOTGUN);
CStreaming::SetModelIsDeletable(MI_SNIPERRIFLE);
CStreaming::SetModelIsDeletable(MI_MP5);
}
void HealthCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT3"), true);
FindPlayerPed()->m_fHealth = 100.0f;
FindPlayerPed()->m_fHealth = CWorld::Players[0].m_nMaxHealth;
if (FindPlayerVehicle()) {
FindPlayerVehicle()->m_fHealth = 1000.0f;
if (FindPlayerVehicle()->m_vehType == VEHICLE_TYPE_CAR)
@ -108,31 +108,31 @@ void HealthCheat()
}
}
void TankCheat()
void VehicleCheat(bool something, int model)
{
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
CStreaming::RequestModel(MI_RHINO, 0);
CStreaming::LoadAllRequestedModels(false);
if (CStreaming::ms_aInfoForModel[MI_RHINO].m_loadState == STREAMSTATE_LOADED) {
CStreaming::RequestModel(model, 0);
CStreaming::LoadAllRequestedModels(something);
if (CStreaming::ms_aInfoForModel[model].m_loadState == STREAMSTATE_LOADED) {
CHud::SetHelpMessage(TheText.Get("CHEAT1"), true);
int32 node = ThePaths.FindNodeClosestToCoors(FindPlayerCoors(), PATH_CAR, 100.0f);
if (node < 0) return;
#ifdef FIX_BUGS
CAutomobile* tank = new CAutomobile(MI_RHINO, RANDOM_VEHICLE);
CAutomobile* vehicle = new CAutomobile(model, RANDOM_VEHICLE);
#else
CAutomobile *tank = new CAutomobile(MI_RHINO, MISSION_VEHICLE);
CAutomobile* vehicle = new CAutomobile(MI_RHINO, MISSION_VEHICLE);
#endif
if (tank != nil) {
if (vehicle != nil) {
CVector pos = ThePaths.m_pathNodes[node].GetPosition();
pos.z += 4.0f;
tank->SetPosition(pos);
tank->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f));
vehicle->SetPosition(pos);
vehicle->SetOrientation(0.0f, 0.0f, DEGTORAD(200.0f));
tank->SetStatus(STATUS_ABANDONED);
tank->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(tank);
vehicle->SetStatus(STATUS_ABANDONED);
vehicle->m_nDoorLock = CARLOCK_UNLOCKED;
CWorld::Add(vehicle);
}
}
}
@ -224,7 +224,7 @@ void MoneyCheat()
void ArmourCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT4"), true);
FindPlayerPed()->m_fArmour = 100.0f;
FindPlayerPed()->m_fArmour = CWorld::Players[0].m_nMaxArmour;
}
void WantedLevelUpCheat()
@ -701,7 +701,7 @@ CControllerState CPad::ReconcileTwoControllersInput(CControllerState const &Stat
void CPad::StartShake(int16 nDur, uint8 nFreq)
{
if ( !CMenuManager::m_PrefsUseVibration )
if ( !FrontEndMenuManager.m_PrefsUseVibration )
return;
if ( CCutsceneMgr::IsRunning() || CGame::playingIntro )
@ -723,7 +723,7 @@ void CPad::StartShake(int16 nDur, uint8 nFreq)
void CPad::StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, float fZ)
{
if ( !CMenuManager::m_PrefsUseVibration )
if ( !FrontEndMenuManager.m_PrefsUseVibration )
return;
if ( CCutsceneMgr::IsRunning() || CGame::playingIntro )
@ -750,7 +750,7 @@ void CPad::StartShake_Distance(int16 nDur, uint8 nFreq, float fX, float fY, floa
void CPad::StartShake_Train(float fX, float fY)
{
if ( !CMenuManager::m_PrefsUseVibration )
if ( !FrontEndMenuManager.m_PrefsUseVibration )
return;
if ( CCutsceneMgr::IsRunning() || CGame::playingIntro )
@ -824,7 +824,7 @@ void CPad::AddToCheatString(char c)
// "CCCCCC321TCT" - CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE CIRCLE R1 L2 L1 TRIANGLE CIRCLE TRIANGLE
else if ( !_CHEATCMP("TCT123CCCCCC") )
TankCheat();
VehicleCheat(true, MI_RHINO);
// "CCCSSSSS1TCT" - CIRCLE CIRCLE CIRCLE SQUARE SQUARE SQUARE SQUARE SQUARE L1 TRIANGLE CIRCLE TRIANGLE
else if ( !_CHEATCMP("TCT1SSSSSCCC") )
@ -905,10 +905,46 @@ void CPad::AddToPCCheatString(char c)
// "NOPOLICEPLEASE"
if ( !_CHEATCMP("ESAELPECILOPON") )
WantedLevelDownCheat();
// "GIVEUSATANK"
if ( !_CHEATCMP("KNATASUEVIG") )
TankCheat();
// "PANZER"
if ( !_CHEATCMP("REZNAP") )
VehicleCheat(true, MI_RHINO);
// "TRAVELINSTYLE"
if ( !_CHEATCMP("ELYTSNILEVART") )
VehicleCheat(true, MI_BLOODRA);
// "GETTHEREQUICKLY"
if ( !_CHEATCMP("YLKCIUQEREHTTEG") )
VehicleCheat(true, MI_BLOODRB);
// "GETTHEREFAST"
if ( !_CHEATCMP("TSAFEREHTTEG") )
VehicleCheat(true, MI_SABRETUR);
// "GETTHEREVERYFASTINDEED"
if ( !_CHEATCMP("DEEDNITSAFYREVEREHTTEG") )
VehicleCheat(true, MI_HOTRINA);
// "GETTHEREAMAZINGLYFAST"
if ( !_CHEATCMP("TSAFYLGNIZAMAEREHTTEG") )
VehicleCheat(true, MI_HOTRINB);
// "THELASTRIDE"
if ( !_CHEATCMP("EDIRTSALEHT") )
VehicleCheat(true, MI_ROMERO);
// "ROCKANDROLLCAR"
if ( !_CHEATCMP("RACLLORDNAKCOR") )
VehicleCheat(true, MI_LOVEFIST);
// "RUBBISHCAR"
if ( !_CHEATCMP("RACHSIBBUR") )
VehicleCheat(true, MI_TRASH);
// "BETTERTHANWALKING"
if ( !_CHEATCMP("GNIKLAWNAHTRETTEB") )
VehicleCheat(true, MI_CADDY);
// "BANGBANGBANG"
if ( !_CHEATCMP("GNABGNABGNAB") )

View file

@ -176,7 +176,7 @@ public:
static CKeyboardState OldKeyState;
static CKeyboardState NewKeyState;
static CKeyboardState TempKeyState;
static char KeyBoardCheatString[20];
static char KeyBoardCheatString[30];
static CMouseControllerState OldMouseControllerState;
static CMouseControllerState NewMouseControllerState;
static CMouseControllerState PCTempMouseControllerState;

View file

@ -7,8 +7,6 @@ CPlaceable::CPlaceable(void)
m_matrix.SetScale(1.0f);
}
CPlaceable::~CPlaceable(void) = default;
void
CPlaceable::SetHeading(float angle)
{

View file

@ -9,7 +9,6 @@ public:
CMatrix m_matrix;
CPlaceable(void);
virtual ~CPlaceable(void);
const CVector &GetPosition(void) { return m_matrix.GetPosition(); }
void SetPosition(float x, float y, float z) {
m_matrix.GetPosition().x = x;

View file

@ -140,20 +140,23 @@ CPlayerInfo::Clear(void)
m_nUpsideDownCounter = 0;
m_bInfiniteSprint = false;
m_bFastReload = false;
m_nMaxHealth = m_nMaxArmour = 100;
m_bGetOutOfJailFree = false;
m_bGetOutOfHospitalFree = false;
m_bDriveByAllowed = true;
m_nPreviousTimeRewardedForExplosion = 0;
m_nExplosionsSinceLastReward = 0;
}
void
CPlayerInfo::BlowUpRCBuggy(void)
CPlayerInfo::BlowUpRCBuggy(bool actually)
{
if (!m_pRemoteVehicle || m_pRemoteVehicle->bRemoveFromWorld)
return;
CRemote::TakeRemoteControlledCarFromPlayer();
m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
if (actually)
m_pRemoteVehicle->BlowUpCar(FindPlayerPed());
}
void
@ -171,7 +174,6 @@ void
CPlayerInfo::MakePlayerSafe(bool toggle)
{
if (toggle) {
CTheScripts::ResetCountdownToMakePlayerUnsafe();
m_pPed->m_pWanted->m_bIgnoredByEveryone = true;
CWorld::StopAllLawEnforcersInTheirTracks();
CPad::GetPad(0)->DisablePlayerControls |= PLAYERCONTROL_DISABLED_20;
@ -192,7 +194,8 @@ CPlayerInfo::MakePlayerSafe(bool toggle)
CWorld::ExtinguishAllCarFiresInArea(GetPos(), 4000.0f);
CReplay::DisableReplays();
} else if (!CGame::playingIntro && !CTheScripts::IsCountdownToMakePlayerUnsafeOn()) {
}
else {
m_pPed->m_pWanted->m_bIgnoredByEveryone = false;
CPad::GetPad(0)->DisablePlayerControls &= ~PLAYERCONTROL_DISABLED_20;
m_pPed->bBulletProof = false;

View file

@ -50,10 +50,16 @@ public:
int32 m_nExplosionsSinceLastReward;
int32 field_268;
int32 field_272;
uint32 m_nHavocLevel;
float m_fMediaAttention;
bool m_bInfiniteSprint;
bool m_bFastReload;
bool m_bFireproof;
uint8 m_nMaxHealth;
uint8 m_nMaxArmour;
bool m_bGetOutOfJailFree;
bool m_bGetOutOfHospitalFree;
bool m_bDriveByAllowed;
char m_aSkinName[32];
RwTexture *m_pSkinTexture;
@ -69,7 +75,7 @@ public:
bool IsPlayerInRemoteMode(void);
void PlayerFailedCriticalMission(void);
void Clear(void);
void BlowUpRCBuggy(void);
void BlowUpRCBuggy(bool);
void CancelPlayerEnteringCars(CVehicle*);
bool IsRestartingAfterDeath(void);
bool IsRestartingAfterArrest(void);

View file

@ -21,49 +21,87 @@ sRadarTrace CRadar::ms_RadarTrace[NUMRADARBLIPS];
CVector2D vec2DRadarOrigin;
int32 gRadarTxdIds[64];
CSprite2d CRadar::AsukaSprite;
CSprite2d CRadar::BombSprite;
CSprite2d CRadar::CatSprite;
CSprite2d CRadar::CentreSprite;
CSprite2d CRadar::CopcarSprite;
CSprite2d CRadar::DonSprite;
CSprite2d CRadar::EightSprite;
CSprite2d CRadar::ElSprite;
CSprite2d CRadar::IceSprite;
CSprite2d CRadar::JoeySprite;
CSprite2d CRadar::KenjiSprite;
CSprite2d CRadar::LizSprite;
CSprite2d CRadar::LuigiSprite;
CSprite2d CRadar::MapHereSprite;
CSprite2d CRadar::NorthSprite;
CSprite2d CRadar::RaySprite;
CSprite2d CRadar::SalSprite;
CSprite2d CRadar::SaveSprite;
CSprite2d CRadar::AverySprite;
CSprite2d CRadar::BikerSprite;
CSprite2d CRadar::CortezSprite;
CSprite2d CRadar::DiazSprite;
CSprite2d CRadar::KentSprite;
CSprite2d CRadar::LawyerSprite;
CSprite2d CRadar::PhilSprite;
CSprite2d CRadar::BikersSprite;
CSprite2d CRadar::BoatyardSprite;
CSprite2d CRadar::MalibuClubSprite;
CSprite2d CRadar::CubansSprite;
CSprite2d CRadar::FilmSprite;
CSprite2d CRadar::GunSprite;
CSprite2d CRadar::HaitiansSprite;
CSprite2d CRadar::HardwareSprite;
CSprite2d CRadar::SaveHouseSprite;
CSprite2d CRadar::StripSprite;
CSprite2d CRadar::IceSprite;
CSprite2d CRadar::KCabsSprite;
CSprite2d CRadar::LovefistSprite;
CSprite2d CRadar::PrintworksSprite;
CSprite2d CRadar::PropertySprite;
CSprite2d CRadar::SunYardSprite;
CSprite2d CRadar::SpraySprite;
CSprite2d CRadar::TonySprite;
CSprite2d CRadar::WeaponSprite;
CSprite2d CRadar::TShirtSprite;
CSprite2d CRadar::TommySprite;
CSprite2d CRadar::PhoneSprite;
CSprite2d CRadar::RadioWildstyleSprite;
CSprite2d CRadar::RadioFlashSprite;
CSprite2d CRadar::RadioKChatSprite;
CSprite2d CRadar::RadioFeverSprite;
CSprite2d CRadar::RadioVRockSprite;
CSprite2d CRadar::RadioVCPRSprite;
CSprite2d CRadar::RadioEspantosoSprite;
CSprite2d CRadar::RadioEmotionSprite;
CSprite2d CRadar::RadioWaveSprite;
CSprite2d *CRadar::RadarSprites[RADAR_SPRITE_COUNT] = {
nil,
&AsukaSprite,
&BombSprite,
&CatSprite,
&CentreSprite,
&CopcarSprite,
&DonSprite,
&EightSprite,
&ElSprite,
&IceSprite,
&JoeySprite,
&KenjiSprite,
&LizSprite,
&LuigiSprite,
&MapHereSprite,
&NorthSprite,
&RaySprite,
&SalSprite,
&SaveSprite,
&AverySprite,
&BikerSprite,
&CortezSprite,
&DiazSprite,
&KentSprite,
&LawyerSprite,
&PhilSprite,
&BikersSprite,
&BoatyardSprite,
&MalibuClubSprite,
&CubansSprite,
&FilmSprite,
&GunSprite,
&HaitiansSprite,
&HardwareSprite,
&SaveHouseSprite,
&StripSprite,
&IceSprite,
&KCabsSprite,
&LovefistSprite,
&PrintworksSprite,
&PropertySprite,
&SunYardSprite,
&SpraySprite,
&TonySprite,
&WeaponSprite
&TShirtSprite,
&TommySprite,
&PhoneSprite,
&RadioWildstyleSprite,
&RadioFlashSprite,
&RadioKChatSprite,
&RadioFeverSprite,
&RadioVRockSprite,
&RadioVCPRSprite,
&RadioEspantosoSprite,
&RadioEmotionSprite,
&RadioWaveSprite
};
// Why this doesn't coincide with world coordinates i don't know
@ -87,12 +125,11 @@ static_assert(RADAR_TILE_SIZE == (RADAR_SIZE_Y / RADAR_NUM_TILES), "CRadar: not
CRGBA CRadar::ArrowBlipColour1;
CRGBA CRadar::ArrowBlipColour2;
uint16 CRadar::MapLegendCounter;
uint16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
int16 CRadar::MapLegendList[NUM_MAP_LEGENDS];
int CRadar::TargetMarkerId = -1;
CVector CRadar::TargetMarkerPos;
#endif
// taken from VC
float CRadar::cachedCos;
float CRadar::cachedSin;
@ -227,7 +264,7 @@ int LineRadarBoxCollision(CVector2D &out, const CVector2D &p1, const CVector2D &
uint8 CRadar::CalculateBlipAlpha(float dist)
{
#ifdef MENU_MAP
if (CMenuManager::bMenuMapActive)
if (FrontEndMenuManager.m_bMenuMapActive)
return 255;
#endif
if (dist <= 1.0f)
@ -273,12 +310,9 @@ void CRadar::ClearBlip(int32 i)
if (index != -1) {
SetRadarMarkerState(index, false);
ms_RadarTrace[index].m_bInUse = false;
#ifndef MENU_MAP
// Ssshhh
ms_RadarTrace[index].m_eBlipType = BLIP_NONE;
ms_RadarTrace[index].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
ms_RadarTrace[index].m_eRadarSprite = RADAR_SPRITE_NONE;
#endif
}
}
@ -378,9 +412,8 @@ int CRadar::ClipRadarPoly(CVector2D *poly, const CVector2D *rect)
bool CRadar::DisplayThisBlip(int32 counter)
{
switch (ms_RadarTrace[counter].m_eRadarSprite) {
case RADAR_SPRITE_BOMB:
case RADAR_SPRITE_SPRAY:
case RADAR_SPRITE_WEAPON:
case RADAR_SPRITE_GUN:
return true;
default:
return false;
@ -398,7 +431,7 @@ void CRadar::Draw3dMarkers()
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
CVector pos = entity->GetPosition();
pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f;
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 2.5f, 0, 128, 255, 255, 1024, 0.2f, 5);
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 2.5f, CARBLIP_MARKER_COLOR_R, CARBLIP_MARKER_COLOR_G, CARBLIP_MARKER_COLOR_B, CARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
}
break;
}
@ -412,7 +445,7 @@ void CRadar::Draw3dMarkers()
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
CVector pos = entity->GetPosition();
pos.z += 3.0f;
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.5f, 0, 128, 255, 255, 1024, 0.2f, 5);
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.5f, CHARBLIP_MARKER_COLOR_R, CHARBLIP_MARKER_COLOR_G, CHARBLIP_MARKER_COLOR_B, CHARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
}
break;
}
@ -422,7 +455,7 @@ void CRadar::Draw3dMarkers()
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
CVector pos = entity->GetPosition();
pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f;
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.0f, 0, 128, 255, 255, 1024, 0.2f, 5);
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), 1, pos, 1.0f, OBJECTBLIP_MARKER_COLOR_R, OBJECTBLIP_MARKER_COLOR_G, OBJECTBLIP_MARKER_COLOR_B, OBJECTBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
}
break;
}
@ -431,7 +464,7 @@ void CRadar::Draw3dMarkers()
case BLIP_CONTACT_POINT:
if (!CTheScripts::IsPlayerOnAMission()) {
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY)
C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), 4, ms_RadarTrace[i].m_vecPos, 2.0f, 0, 128, 255, 128, 2048, 0.2f, 0);
C3dMarkers::PlaceMarkerSet(i | (ms_RadarTrace[i].m_BlipIndex << 16), 4, ms_RadarTrace[i].m_vecPos, 2.0f, COORDBLIP_MARKER_COLOR_R, COORDBLIP_MARKER_COLOR_G, COORDBLIP_MARKER_COLOR_B, COORDBLIP_MARKER_COLOR_A, 2048, 0.2f, 0);
}
break;
}
@ -454,7 +487,7 @@ void CRadar::DrawBlips()
TransformRadarPointToScreenSpace(out, in);
#ifdef MENU_MAP
if (!CMenuManager::bMenuMapActive) {
if (!FrontEndMenuManager.m_bMenuMapActive) {
#endif
float angle;
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN)
@ -481,11 +514,6 @@ void CRadar::DrawBlips()
CEntity *blipEntity = nil;
for(int blipId = 0; blipId < NUMRADARBLIPS; blipId++) {
#ifdef MENU_MAP
// A little hack to reuse cleared blips in menu map. hehe
if (!CMenuManager::bMenuMapActive || ms_RadarTrace[blipId].m_eBlipType == BLIP_CAR ||
ms_RadarTrace[blipId].m_eBlipType == BLIP_CHAR || ms_RadarTrace[blipId].m_eBlipType == BLIP_OBJECT)
#endif
if (!ms_RadarTrace[blipId].m_bInUse)
continue;
@ -493,8 +521,8 @@ void CRadar::DrawBlips()
case BLIP_CAR:
case BLIP_CHAR:
case BLIP_OBJECT:
if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
|| ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON) {
if (ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
|| ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_GUN) {
switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_CAR:
@ -527,7 +555,7 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
}
@ -552,8 +580,8 @@ void CRadar::DrawBlips()
break;
case BLIP_COORD:
case BLIP_CONTACT_POINT:
if ((ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_BOMB || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
|| ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_WEAPON)
if ((ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SAVE
|| ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_SPRAY || ms_RadarTrace[blipId].m_eRadarSprite == RADAR_SPRITE_GUN)
&& (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
@ -569,7 +597,7 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
}
@ -603,8 +631,8 @@ void CRadar::DrawBlips()
case BLIP_CAR:
case BLIP_CHAR:
case BLIP_OBJECT:
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
&& ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
&& ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_GUN) {
switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_CAR:
@ -638,7 +666,7 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else
@ -672,8 +700,8 @@ void CRadar::DrawBlips()
switch (ms_RadarTrace[blipId].m_eBlipType) {
case BLIP_COORD:
case BLIP_CONTACT_POINT:
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_BOMB && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
&& ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_WEAPON
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SAVE
&& ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_SPRAY && ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_GUN
&& (ms_RadarTrace[blipId].m_eBlipType != BLIP_CONTACT_POINT || !CTheScripts::IsPlayerOnAMission())) {
uint32 color = GetRadarTraceColour(ms_RadarTrace[blipId].m_nColor, ms_RadarTrace[blipId].m_bDim);
@ -689,7 +717,7 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || FrontEndMenuManager.m_bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else
@ -716,7 +744,7 @@ void CRadar::DrawBlips()
}
}
#ifdef MENU_MAP
if (CMenuManager::bMenuMapActive) {
if (FrontEndMenuManager.m_bMenuMapActive) {
CVector2D in, out;
TransformRealWorldPointToRadarSpace(in, FindPlayerCentreOfWorld_NoSniperShift());
TransformRadarPointToScreenSpace(out, in);
@ -871,7 +899,7 @@ void CRadar::DrawRadarSprite(uint16 sprite, float x, float y, uint8 alpha)
{
RadarSprites[sprite]->Draw(CRect(x - SCREEN_SCALE_X(8.0f), y - SCREEN_SCALE_Y(8.0f), x + SCREEN_SCALE_X(8.0f), y + SCREEN_SCALE_Y(8.0f)), CRGBA(255, 255, 255, alpha));
#ifdef MENU_MAP
if (CMenuManager::bMenuMapActive) {
if (FrontEndMenuManager.m_bMenuMapActive) {
bool alreadyThere = false;
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
if (MapLegendList[i] == sprite)
@ -1019,7 +1047,7 @@ float CRadar::LimitRadarPoint(CVector2D &point)
dist = point.Magnitude();
#ifdef MENU_MAP
if (CMenuManager::bMenuMapActive)
if (FrontEndMenuManager.m_bMenuMapActive)
return dist;
#endif
if (dist > 1.0f) {
@ -1047,26 +1075,45 @@ CRadar::LoadTextures()
{
CTxdStore::PushCurrentTxd();
CTxdStore::SetCurrentTxd(CTxdStore::FindTxdSlot("hud"));
AsukaSprite.SetTexture("radar_asuka");
BombSprite.SetTexture("radar_bomb");
CatSprite.SetTexture("radar_cat");
CentreSprite.SetTexture("radar_centre");
CopcarSprite.SetTexture("radar_copcar");
DonSprite.SetTexture("radar_don");
EightSprite.SetTexture("radar_eight");
ElSprite.SetTexture("radar_el");
IceSprite.SetTexture("radar_ice");
JoeySprite.SetTexture("radar_joey");
KenjiSprite.SetTexture("radar_kenji");
LizSprite.SetTexture("radar_liz");
LuigiSprite.SetTexture("radar_luigi");
MapHereSprite.SetTexture("arrow");
NorthSprite.SetTexture("radar_north");
RaySprite.SetTexture("radar_ray");
SalSprite.SetTexture("radar_sal");
SaveSprite.SetTexture("radar_save");
SpraySprite.SetTexture("radar_spray");
TonySprite.SetTexture("radar_tony");
WeaponSprite.SetTexture("radar_weapon");
AverySprite.SetTexture("radar_avery");
BikerSprite.SetTexture("radar_biker");
CortezSprite.SetTexture("radar_cortez");
DiazSprite.SetTexture("radar_diaz");
KentSprite.SetTexture("radar_kent");
LawyerSprite.SetTexture("radar_lawyer");
PhilSprite.SetTexture("radar_phil");
BikersSprite.SetTexture("bikers");
BoatyardSprite.SetTexture("boatyard");
MalibuClubSprite.SetTexture("club");
CubansSprite.SetTexture("cubans");
FilmSprite.SetTexture("filmstudio");
GunSprite.SetTexture("gun");
HaitiansSprite.SetTexture("haitians");
HardwareSprite.SetTexture("hardware");
SaveHouseSprite.SetTexture("radar_save");
StripSprite.SetTexture("radar_strip");
IceSprite.SetTexture("icecream");
KCabsSprite.SetTexture("kcabs");
LovefistSprite.SetTexture("lovefist");
PrintworksSprite.SetTexture("printworks");
PropertySprite.SetTexture("property");
SunYardSprite.SetTexture("SunYard");
SpraySprite.SetTexture("spray");
TShirtSprite.SetTexture("tshirt");
TommySprite.SetTexture("tommy");
PhoneSprite.SetTexture("phone");
RadioWildstyleSprite.SetTexture("RWildstyle");
RadioFlashSprite.SetTexture("RFlash");
RadioKChatSprite.SetTexture("RKchat");
RadioFeverSprite.SetTexture("RFever");
RadioVRockSprite.SetTexture("RVRock");
RadioVCPRSprite.SetTexture("RVCPR");
RadioEspantosoSprite.SetTexture("REspantoso");
RadioEmotionSprite.SetTexture("REmotion");
RadioWaveSprite.SetTexture("RWave");
CTxdStore::PopCurrentTxd();
}
@ -1231,7 +1278,7 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
}
#ifdef MENU_MAP
// VC uses -1 for coords and -2 for entities but meh, I don't want to edit DrawBlips
if (CMenuManager::bMenuMapActive) {
if (FrontEndMenuManager.m_bMenuMapActive) {
bool alreadyThere = false;
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
if (MapLegendList[i] == -1)
@ -1248,26 +1295,45 @@ void CRadar::ShowRadarTraceWithHeight(float x, float y, uint32 size, uint8 red,
void CRadar::Shutdown()
{
AsukaSprite.Delete();
BombSprite.Delete();
CatSprite.Delete();
CentreSprite.Delete();
CopcarSprite.Delete();
DonSprite.Delete();
EightSprite.Delete();
ElSprite.Delete();
IceSprite.Delete();
JoeySprite.Delete();
KenjiSprite.Delete();
LizSprite.Delete();
LuigiSprite.Delete();
MapHereSprite.Delete();
NorthSprite.Delete();
RaySprite.Delete();
SalSprite.Delete();
SaveSprite.Delete();
AverySprite.Delete();
BikerSprite.Delete();
CortezSprite.Delete();
DiazSprite.Delete();
KentSprite.Delete();
LawyerSprite.Delete();
PhilSprite.Delete();
BikersSprite.Delete();
BoatyardSprite.Delete();
MalibuClubSprite.Delete();
CubansSprite.Delete();
FilmSprite.Delete();
GunSprite.Delete();
HaitiansSprite.Delete();
HardwareSprite.Delete();
SaveHouseSprite.Delete();
StripSprite.Delete();
IceSprite.Delete();
KCabsSprite.Delete();
LovefistSprite.Delete();
PrintworksSprite.Delete();
PropertySprite.Delete();
SunYardSprite.Delete();
SpraySprite.Delete();
TonySprite.Delete();
WeaponSprite.Delete();
TShirtSprite.Delete();
TommySprite.Delete();
PhoneSprite.Delete();
RadioWildstyleSprite.Delete();
RadioFlashSprite.Delete();
RadioKChatSprite.Delete();
RadioFeverSprite.Delete();
RadioVRockSprite.Delete();
RadioVCPRSprite.Delete();
RadioEspantosoSprite.Delete();
RadioEmotionSprite.Delete();
RadioWaveSprite.Delete();
RemoveRadarSections();
}
@ -1337,10 +1403,9 @@ void CRadar::TransformRadarPointToRealWorldSpace(CVector2D &out, const CVector2D
void CRadar::TransformRadarPointToScreenSpace(CVector2D &out, const CVector2D &in)
{
#ifdef MENU_MAP
if (CMenuManager::bMenuMapActive) {
// fMapSize is actually half map size. Radar range is 1000, so if x is -2000, in.x + 2.0f is 0.
out.x = (CMenuManager::fMapCenterX - CMenuManager::fMapSize) + (in.x + 2.0f) * CMenuManager::fMapSize * 2.0f / 4.0f;
out.y = (CMenuManager::fMapCenterY - CMenuManager::fMapSize) + (2.0f - in.y) * CMenuManager::fMapSize * 2.0f / 4.0f;
if (FrontEndMenuManager.m_bMenuMapActive) {
out.x = (FrontEndMenuManager.m_fMapCenterX - FrontEndMenuManager.m_fMapSize) + (MENU_MAP_LENGTH / 2 + MENU_MAP_LEFT_OFFSET + in.x) * FrontEndMenuManager.m_fMapSize * MENU_MAP_WIDTH_SCALE * 2.0f / MENU_MAP_LENGTH;
out.y = (FrontEndMenuManager.m_fMapCenterY - FrontEndMenuManager.m_fMapSize) + (MENU_MAP_LENGTH / 2 - MENU_MAP_TOP_OFFSET - in.y) * FrontEndMenuManager.m_fMapSize * MENU_MAP_HEIGHT_SCALE * 2.0f / MENU_MAP_LENGTH;
} else
#endif
{
@ -1398,7 +1463,7 @@ CRadar::CalculateCachedSinCos()
{
if (TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOPDOWN || TheCamera.Cams[TheCamera.ActiveCam].Mode == CCam::MODE_TOP_DOWN_PED
#ifdef MENU_MAP
|| CMenuManager::bMenuMapActive
|| FrontEndMenuManager.m_bMenuMapActive
#endif
) {
cachedSin = 0.0f;
@ -1428,7 +1493,7 @@ CRadar::InitFrontEndMap()
CalculateCachedSinCos();
vec2DRadarOrigin.x = 0.0f;
vec2DRadarOrigin.y = 0.0f;
m_radarRange = 1000.0f; // doesn't mean anything, just affects the calculation in TransformRadarPointToScreenSpace
m_radarRange = MENU_MAP_LENGTH_UNIT; // just affects the multiplier in TransformRadarPointToScreenSpace
for (int i = 0; i < NUM_MAP_LEGENDS; i++) {
MapLegendList[i] = RADAR_SPRITE_NONE;
}

View file

@ -1,6 +1,33 @@
#pragma once
#include "Sprite2d.h"
#define CARBLIP_MARKER_COLOR_R 252
#define CARBLIP_MARKER_COLOR_G 138
#define CARBLIP_MARKER_COLOR_B 242
#define CARBLIP_MARKER_COLOR_A 255
#define CHARBLIP_MARKER_COLOR_R 252
#define CHARBLIP_MARKER_COLOR_G 138
#define CHARBLIP_MARKER_COLOR_B 242
#define CHARBLIP_MARKER_COLOR_A 255
#define OBJECTBLIP_MARKER_COLOR_R 252
#define OBJECTBLIP_MARKER_COLOR_G 138
#define OBJECTBLIP_MARKER_COLOR_B 242
#define OBJECTBLIP_MARKER_COLOR_A 255
#define COORDBLIP_MARKER_COLOR_R 252
#define COORDBLIP_MARKER_COLOR_G 138
#define COORDBLIP_MARKER_COLOR_B 242
#define COORDBLIP_MARKER_COLOR_A 255
#define MENU_MAP_LENGTH_UNIT 1190.0f // in game unit
#define MENU_MAP_WIDTH_SCALE 1.112f // in game unit (originally 1.112494151260504f)
#define MENU_MAP_HEIGHT_SCALE 1.119f // in game unit (originally 1.118714268907563f)
#define MENU_MAP_TOP_OFFSET 0.28f // in length unit defined above - ~333 game unit
#define MENU_MAP_LEFT_OFFSET 0.185f // in length unit defined above - ~220 game unit
#define MENU_MAP_LENGTH (4000.f / MENU_MAP_LENGTH_UNIT)
enum eBlipType
{
BLIP_NONE,
@ -26,27 +53,47 @@ 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_CENTRE,
RADAR_SPRITE_MAP_HERE,
RADAR_SPRITE_NORTH,
RADAR_SPRITE_AVERY,
RADAR_SPRITE_BIKER,
RADAR_SPRITE_CORTEZ,
RADAR_SPRITE_DIAZ,
RADAR_SPRITE_KENT,
RADAR_SPRITE_LAWYER,
RADAR_SPRITE_PHIL,
RADAR_SPRITE_BIKERS,
RADAR_SPRITE_BOATYARD,
RADAR_SPRITE_MALIBU_CLUB,
RADAR_SPRITE_CUBANS,
RADAR_SPRITE_FILM,
RADAR_SPRITE_GUN,
RADAR_SPRITE_HAITIANS,
RADAR_SPRITE_HARDWARE,
RADAR_SPRITE_SAVE,
RADAR_SPRITE_STRIP,
RADAR_SPRITE_ICE,
RADAR_SPRITE_KCABS,
RADAR_SPRITE_LOVEFIST,
RADAR_SPRITE_PRINTWORKS,
RADAR_SPRITE_PROPERTY,
RADAR_SPRITE_SUNYARD,
RADAR_SPRITE_SPRAY,
RADAR_SPRITE_TSHIRT,
RADAR_SPRITE_TOMMY,
RADAR_SPRITE_PHONE,
RADAR_SPRITE_RADIO_WILDSTYLE,
RADAR_SPRITE_RADIO_FLASH,
RADAR_SPRITE_RADIO_KCHAT,
RADAR_SPRITE_RADIO_FEVER,
RADAR_SPRITE_RADIO_VROCK,
RADAR_SPRITE_RADIO_VCPR,
RADAR_SPRITE_RADIO_ESPANTOSO,
RADAR_SPRITE_RADIO_EMOTION,
RADAR_SPRITE_RADIO_WAVE,
RADAR_SPRITE_COUNT
};
enum
@ -84,34 +131,53 @@ class CRadar
public:
static float m_radarRange;
static sRadarTrace ms_RadarTrace[NUMRADARBLIPS];
static CSprite2d AsukaSprite;
static CSprite2d BombSprite;
static CSprite2d CatSprite;
static CSprite2d CentreSprite;
static CSprite2d CopcarSprite;
static CSprite2d DonSprite;
static CSprite2d EightSprite;
static CSprite2d ElSprite;
static CSprite2d IceSprite;
static CSprite2d JoeySprite;
static CSprite2d KenjiSprite;
static CSprite2d LizSprite;
static CSprite2d LuigiSprite;
static CSprite2d MapHereSprite;
static CSprite2d NorthSprite;
static CSprite2d RaySprite;
static CSprite2d SalSprite;
static CSprite2d SaveSprite;
static CSprite2d AverySprite;
static CSprite2d BikerSprite;
static CSprite2d CortezSprite;
static CSprite2d DiazSprite;
static CSprite2d KentSprite;
static CSprite2d LawyerSprite;
static CSprite2d PhilSprite;
static CSprite2d BikersSprite;
static CSprite2d BoatyardSprite;
static CSprite2d MalibuClubSprite;
static CSprite2d CubansSprite;
static CSprite2d FilmSprite;
static CSprite2d GunSprite;
static CSprite2d HaitiansSprite;
static CSprite2d HardwareSprite;
static CSprite2d SaveHouseSprite;
static CSprite2d StripSprite;
static CSprite2d IceSprite;
static CSprite2d KCabsSprite;
static CSprite2d LovefistSprite;
static CSprite2d PrintworksSprite;
static CSprite2d PropertySprite;
static CSprite2d SunYardSprite;
static CSprite2d SpraySprite;
static CSprite2d TonySprite;
static CSprite2d WeaponSprite;
static CSprite2d *RadarSprites[21];
static CSprite2d TShirtSprite;
static CSprite2d TommySprite;
static CSprite2d PhoneSprite;
static CSprite2d RadioWildstyleSprite;
static CSprite2d RadioFlashSprite;
static CSprite2d RadioKChatSprite;
static CSprite2d RadioFeverSprite;
static CSprite2d RadioVRockSprite;
static CSprite2d RadioVCPRSprite;
static CSprite2d RadioEspantosoSprite;
static CSprite2d RadioEmotionSprite;
static CSprite2d RadioWaveSprite;
static CSprite2d *RadarSprites[RADAR_SPRITE_COUNT];
static float cachedCos;
static float cachedSin;
#ifdef MENU_MAP
#define NUM_MAP_LEGENDS 75
static CRGBA ArrowBlipColour1;
static CRGBA ArrowBlipColour2;
static uint16 MapLegendList[NUM_MAP_LEGENDS];
static int16 MapLegendList[NUM_MAP_LEGENDS];
static uint16 MapLegendCounter;
static int TargetMarkerId;
static CVector TargetMarkerPos;

View file

@ -57,9 +57,13 @@ int32 CStats::mmRain;
int32 CStats::CarsCrushed;
int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES];
int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
int32 CStats::PropertyDestroyed;
int32 CStats::Sprayings;
float CStats::AutoPaintingBudget;
int32 CStats::NoMoreHurricanes;
float CStats::FashionBudget;
int32 CStats::SafeHouseVisits;
void CStats::Init()
{
@ -119,6 +123,8 @@ void CStats::Init()
Sprayings = 0;
AutoPaintingBudget = 0.0f;
NoMoreHurricanes = 0;
SafeHouseVisits = 0;
}
void CStats::RegisterFastestTime(int32 index, int32 time)
@ -247,6 +253,19 @@ int32 CStats::FindCriminalRatingNumber()
return rating;
}
float CStats::GetPercentageProgress()
{
float percentCompleted = (CStats::TotalProgressInGame == 0 ? 0 :
CStats::ProgressMade * 100.0f / (CGame::nastyGame ? CStats::TotalProgressInGame : CStats::TotalProgressInGame - 1.0f));
return Min(percentCompleted, 100.0f);
}
void CStats::MoneySpentOnFashion(int32 money)
{
FashionBudget += money;
}
void CStats::SaveStats(uint8 *buf, uint32 *size)
{
CheckPointReachedSuccessfully();

View file

@ -10,7 +10,7 @@ public:
TOTAL_HIGHEST_SCORES = 16
};
static int32 DaysPassed;
static int32 HeadsPopped;
static int32 HeadsPopped;
static int32 CommercialPassed;
static int32 IndustrialPassed;
static int32 SuburbanPassed;
@ -52,18 +52,22 @@ public:
static int32 LongestFlightInDodo;
static int32 TimeTakenDefuseMission;
static int32 TotalNumberKillFrenzies;
static int32 TotalNumberMissions;
static int32 RoundsFiredByPlayer;
static int32 KgsOfExplosivesUsed;
static int32 InstantHitsFiredByPlayer;
static int32 InstantHitsHitByPlayer;
static int32 BestTimeBombDefusal;
static int32 mmRain;
static int32 CarsCrushed;
static int32 TotalNumberMissions;
static int32 RoundsFiredByPlayer;
static int32 KgsOfExplosivesUsed;
static int32 InstantHitsFiredByPlayer;
static int32 InstantHitsHitByPlayer;
static int32 BestTimeBombDefusal;
static int32 mmRain;
static int32 CarsCrushed;
static int32 FastestTimes[TOTAL_FASTEST_TIMES];
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
static int32 PropertyDestroyed;
static int32 Sprayings;
static float AutoPaintingBudget;
static int32 NoMoreHurricanes;
static float FashionBudget;
static int32 SafeHouseVisits;
public:
static void Init(void);
@ -89,4 +93,7 @@ public:
static int32 FindCriminalRatingNumber();
static void SaveStats(uint8 *buf, uint32 *size);
static void LoadStats(uint8 *buf, uint32 size);
static float GetPercentageProgress();
static void MoneySpentOnFashion(int32);
};

View file

@ -1337,8 +1337,7 @@ CStreaming::LoadInitialPeds(void)
void
CStreaming::LoadInitialWeapons(void)
{
// TODO(Miami): Enable when weapons have been ported
//CStreaming::RequestModel(MI_NIGHTSTICK, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_NIGHTSTICK, STREAMFLAGS_DONT_REMOVE);
CStreaming::RequestModel(MI_MISSILE, STREAMFLAGS_DONT_REMOVE);
}
@ -1450,7 +1449,8 @@ CStreaming::StreamVehiclesAndPeds(void)
timeBeforeNextLoad--;
else if(ms_numVehiclesLoaded <= desiredNumVehiclesLoaded){
CZoneInfo zone;
CTheZones::GetZoneInfoForTimeOfDay(&FindPlayerCoors(), &zone);
CVector coors = FindPlayerCoors();
CTheZones::GetZoneInfoForTimeOfDay(&coors, &zone);
int32 maxReq = -1;
int32 mostRequestedRating = 0;
for(i = 0; i < CCarCtrl::TOTAL_CUSTOM_CLASSES; i++){
@ -1524,26 +1524,26 @@ CStreaming::StreamZoneModels(const CVector &pos)
bit = 1<<i;
if(gangsToLoad & bit && (ms_loadedGangs & bit) == 0){
RequestModel(MI_GANG01 + i*2, STREAMFLAGS_DEPENDENCY);
RequestModel(MI_GANG01 + i*2 + 1, STREAMFLAGS_DEPENDENCY);
RequestModel(CGangs::GetGangPedModel1(i), STREAMFLAGS_DEPENDENCY);
RequestModel(CGangs::GetGangPedModel2(i), STREAMFLAGS_DEPENDENCY);
ms_loadedGangs |= bit;
}else if((gangsToLoad & bit) == 0 && ms_loadedGangs & bit){
SetModelIsDeletable(MI_GANG01 + i*2);
SetModelIsDeletable(MI_GANG01 + i*2 + 1);
SetModelTxdIsDeletable(MI_GANG01 + i*2);
SetModelTxdIsDeletable(MI_GANG01 + i*2 + 1);
SetModelIsDeletable(CGangs::GetGangPedModel1(i));
SetModelIsDeletable(CGangs::GetGangPedModel2(i));
SetModelTxdIsDeletable(CGangs::GetGangPedModel1(i));
SetModelTxdIsDeletable(CGangs::GetGangPedModel2(i));
ms_loadedGangs &= ~bit;
}
// TODO(MIAMI): check this
if(CGangs::GetGangInfo(i)->m_nVehicleMI < 0)
if(CGangs::GetGangVehicleModel(i) < 0)
continue;
if((gangCarsToLoad & bit) && (ms_loadedGangCars & bit) == 0){
RequestModel(CGangs::GetGangInfo(i)->m_nVehicleMI, STREAMFLAGS_DEPENDENCY);
RequestModel(CGangs::GetGangVehicleModel(i), STREAMFLAGS_DEPENDENCY);
}else if((gangCarsToLoad & bit) == 0 && ms_loadedGangCars & bit){
SetModelIsDeletable(CGangs::GetGangInfo(i)->m_nVehicleMI);
SetModelTxdIsDeletable(CGangs::GetGangInfo(i)->m_nVehicleMI);
SetModelIsDeletable(CGangs::GetGangVehicleModel(i));
SetModelTxdIsDeletable(CGangs::GetGangVehicleModel(i));
}
}
ms_loadedGangCars = gangCarsToLoad;
@ -1563,10 +1563,10 @@ CStreaming::RemoveCurrentZonesModels(void)
}
for(i = 0; i < NUM_GANGS; i++){
SetModelIsDeletable(MI_GANG01 + i*2);
SetModelIsDeletable(MI_GANG01 + i*2 + 1);
if(CGangs::GetGangInfo(i)->m_nVehicleMI != -1)
SetModelIsDeletable(CGangs::GetGangInfo(i)->m_nVehicleMI);
SetModelIsDeletable(CGangs::GetGangPedModel1(i));
SetModelIsDeletable(CGangs::GetGangPedModel2(i));
if(CGangs::GetGangVehicleModel(i) != -1)
SetModelIsDeletable(CGangs::GetGangVehicleModel(i));
}
ms_currentPedGrp = -1;

View file

@ -56,40 +56,42 @@ 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;
default: return ADHESIVE_ROAD;
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_SAND;
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;
case SURFACE_SAND_BEACH: return ADHESIVE_SAND;
case SURFACE_CONCRETE_BEACH: return ADHESIVE_ROAD;
default: return ADHESIVE_ROAD;
}
}
@ -97,40 +99,45 @@ 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:
case SURFACE_CONCRETE_BEACH:
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;
case SURFACE_SAND:
case SURFACE_SAND_BEACH:
return 1.0f - CWeather::WetRoads*0.5f;
default:
return 1.0f;
}

View file

@ -1,86 +1,42 @@
#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,
// These are illegal
SURFACE_SAND33,
SURFACE_ROAD34,
SURFACE_STEEP_CLIFF,
SURFACE_CONTAINER,
SURFACE_NEWS_VENDOR,
SURFACE_WHEELBASE,
SURFACE_CARDBOARDBOX,
SURFACE_TRANSPARENT_STONE,
SURFACE_METAL_GATE,
SURFACE_SAND_BEACH,
SURFACE_CONCRETE_BEACH,
};
enum
@ -89,6 +45,7 @@ enum
ADHESIVE_HARD,
ADHESIVE_ROAD,
ADHESIVE_LOOSE,
ADHESIVE_SAND,
ADHESIVE_WET,
NUMADHESIVEGROUPS

View file

@ -66,7 +66,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;
}
@ -85,7 +85,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;
}
@ -106,10 +106,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;
@ -131,7 +131,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;
}
@ -151,7 +151,7 @@ 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;
}
@ -171,7 +171,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;
}
@ -191,7 +191,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;
}
@ -211,7 +211,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;
}
@ -233,7 +233,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;
}
@ -255,7 +255,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;
}
@ -277,7 +277,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

@ -58,7 +58,7 @@ public:
friend bool GenericSave(int file);
#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,24 @@
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;
CColPoint CWorld::m_aTempColPts[MAX_COLLISION_POINTS];
void
CWorld::Initialise()
@ -165,7 +167,7 @@ CWorld::CameraToIgnoreThisObject(CEntity *ent)
bool
CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoint &point, CEntity *&entity,
bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects,
bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects, bool ignoreShootThrough)
{
int x, xstart, xend;
int y, ystart, yend;
@ -184,7 +186,7 @@ CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoi
#define LOSARGS \
CColLine(point1, point2), point, dist, entity, checkBuildings, checkVehicles, checkPeds, checkObjects, \
checkDummies, ignoreSeeThrough, ignoreSomeObjects
checkDummies, ignoreSeeThrough, ignoreSomeObjects, ignoreShootThrough
if(xstart == xend && ystart == yend) {
// Only one sector
@ -266,7 +268,7 @@ CWorld::ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoi
bool
CWorld::ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity,
bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects,
bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects)
bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects, bool ignoreShootThrough)
{
float mindist = dist;
bool deadPeds = !!bIncludeDeadPeds;
@ -274,39 +276,39 @@ CWorld::ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoin
if(checkBuildings) {
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS], line, point, mindist, entity,
ignoreSeeThrough);
ignoreSeeThrough, false, ignoreShootThrough);
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_BUILDINGS_OVERLAP], line, point, mindist, entity,
ignoreSeeThrough);
ignoreSeeThrough, false, ignoreShootThrough);
}
if(checkVehicles) {
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES], line, point, mindist, entity,
ignoreSeeThrough);
ignoreSeeThrough, false, ignoreShootThrough);
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_VEHICLES_OVERLAP], line, point, mindist, entity,
ignoreSeeThrough);
ignoreSeeThrough, false, ignoreShootThrough);
}
if(checkPeds) {
if(deadPeds) bIncludeDeadPeds = true;
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS], line, point, mindist, entity,
ignoreSeeThrough);
ignoreSeeThrough, false, ignoreShootThrough);
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_PEDS_OVERLAP], line, point, mindist, entity,
ignoreSeeThrough);
ignoreSeeThrough, false, ignoreShootThrough);
bIncludeDeadPeds = false;
}
if(checkObjects) {
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS], line, point, mindist, entity,
ignoreSeeThrough, ignoreSomeObjects);
ignoreSeeThrough, ignoreSomeObjects, ignoreShootThrough);
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_OBJECTS_OVERLAP], line, point, mindist, entity,
ignoreSeeThrough, ignoreSomeObjects);
ignoreSeeThrough, ignoreSomeObjects, ignoreShootThrough);
}
if(checkDummies) {
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES], line, point, mindist, entity,
ignoreSeeThrough);
ignoreSeeThrough, false, ignoreShootThrough);
ProcessLineOfSightSectorList(sector.m_lists[ENTITYLIST_DUMMIES_OVERLAP], line, point, mindist, entity,
ignoreSeeThrough);
ignoreSeeThrough, false, ignoreShootThrough);
}
bIncludeDeadPeds = deadPeds;
@ -320,7 +322,7 @@ CWorld::ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoin
bool
CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist,
CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects)
CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects, bool ignoreShootThrough)
{
bool deadPeds = false;
float mindist = dist;
@ -340,21 +342,6 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
if(e->IsPed()) {
if(e->bUsesCollision || deadPeds && ((CPed *)e)->m_nPedState == PED_DEAD) {
colmodel = ((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()))->AnimatePedColModelSkinned(e->GetClump());
/* this should all be gone, right?
if(((CPed *)e)->UseGroundColModel())
colmodel = &CTempColModels::ms_colModelPedGroundHit;
else
#ifdef ANIMATE_PED_COL_MODEL
colmodel = CPedModelInfo::AnimatePedColModel(
((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()))
->GetHitColModel(),
RpClumpGetFrame(e->GetClump()));
#else
colmodel =
((CPedModelInfo *)CModelInfo::GetModelInfo(e->GetModelIndex()))
->GetHitColModel();
#endif
*/
} else
colmodel = nil;
@ -362,7 +349,7 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, dist,
ignoreSeeThrough))
ignoreSeeThrough, ignoreShootThrough))
entity = e;
}
}
@ -451,7 +438,7 @@ CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CCol
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, dist,
ignoreSeeThrough, poly))
ignoreSeeThrough, false, poly))
entity = e;
}
}
@ -652,7 +639,7 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
if(CCollision::TestLineOfSight(line, e->GetMatrix(), *colmodel, ignoreSeeThrough))
if(CCollision::TestLineOfSight(line, e->GetMatrix(), *colmodel, ignoreSeeThrough, false))
return false;
}
}
@ -1828,18 +1815,21 @@ void
CWorld::RepositionOneObject(CEntity *pEntity)
{
int16 modelId = pEntity->GetModelIndex();
if (IsTrafficLight(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 ||
modelId == MI_PHONESIGN || modelId == MI_TAXISIGN || modelId == MI_FISHSTALL01 ||
modelId == MI_FISHSTALL02 || modelId == MI_FISHSTALL03 || modelId == MI_FISHSTALL04 ||
modelId == MI_BAGELSTAND2 || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
modelId == MI_PARKTABLE) {
if (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 ||
modelId == MI_PHONESIGN || modelId == MI_FIRE_HYDRANT || modelId == MI_BOLLARDLIGHT ||
modelId == MI_PARKTABLE || modelId == MI_PARKINGMETER2 || modelId == MI_TELPOLE02 ||
modelId == MI_PARKBENCH || modelId == MI_BARRIER1 || IsTreeModel(modelId) ||
IsLightThatNeedsRepositioning(modelId)
) {
CVector &position = pEntity->GetMatrix().GetPosition();
float fBoundingBoxMinZ = pEntity->GetColModel()->boundingBox.min.z;
CColModel *pColModel = pEntity->GetColModel();
float fBoundingBoxMinZ = pColModel->boundingBox.min.z;
float fHeight = pColModel->boundingBox.max.z - pColModel->boundingBox.min.z;
if(fHeight < OBJECT_REPOSITION_OFFSET_Z) fHeight = OBJECT_REPOSITION_OFFSET_Z;
position.z = CWorld::FindGroundZFor3DCoord(position.x, position.y,
position.z + OBJECT_REPOSITION_OFFSET_Z, nil) -
position.z + fHeight, nil) -
fBoundingBoxMinZ;
pEntity->m_matrix.UpdateRW();
pEntity->UpdateRwFrame();
@ -2240,3 +2230,58 @@ CWorld::UseDetonator(CEntity *pEntity)
}
CProjectileInfo::RemoveDetonatorProjectiles();
}
bool
CWorld::IsWanderPathClear(CVector const& point1, CVector const& point2, float distance, int maxSteps)
{
if (Abs(point1.z - point2.z) > distance)
return false;
if (!GetIsLineOfSightClear(point1, point2, true, false, false, false, false, false, false))
return false;
CVector vecBetween = point2 - point1;
uint32 nSteps = Max(vecBetween.Magnitude(), maxSteps);
if (nSteps == 0)
return true;
vecBetween.Normalise();
uint32 step = 1;
for (step = 1; step < nSteps; step++) {
CVector posThisStep = point1 + vecBetween * step;
float level;
if (!CWaterLevel::GetWaterLevel(posThisStep, &level, false))
continue;
posThisStep.z = level;
AdvanceCurrentScanCode();
CVector vecCheckedPos(posThisStep.x, posThisStep.y, Max(point1.z, point2.z));
CColPoint colpoint;
CEntity* entity;
if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
return false;
}
CVector posThisStep = point1;
AdvanceCurrentScanCode();
CVector vecCheckedPos(posThisStep.x, posThisStep.y, point1.z - 5.0f);
CColPoint colpoint;
CEntity* entity;
if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
return false;
float heightNextStep = colpoint.point.z + 0.5f;
for (step = 1; step < nSteps; step++) {
CVector posThisStep = point1 + vecBetween * step;
posThisStep.z = heightNextStep;
AdvanceCurrentScanCode();
CVector vecCheckedPos(posThisStep.x, posThisStep.y, heightNextStep - 2.0f);
if (!ProcessVerticalLineSector(*GetSector(GetSectorIndexX(posThisStep.x), GetSectorIndexY(posThisStep.y)),
CColLine(posThisStep, vecCheckedPos), colpoint, entity, true, false, false, false, false, false, nil))
return false;
if (Abs(colpoint.point.z - heightNextStep) > 1.0f)
return false;
heightNextStep = colpoint.point.z + 0.5f;
}
return true;
}

View file

@ -71,6 +71,7 @@ public:
static bool bProcessCutsceneOnly;
static bool bDoingCarCollisions;
static bool bIncludeCarTyres;
static CColPoint m_aTempColPts[MAX_COLLISION_POINTS];
static void Remove(CEntity *entity);
static void Add(CEntity *entity);
@ -90,9 +91,9 @@ public:
static bool CameraToIgnoreThisObject(CEntity *ent);
static bool ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
static bool ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
static bool ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects = false);
static bool ProcessLineOfSight(const CVector &point1, const CVector &point2, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects = false, bool ignoreShootThrough = false);
static bool ProcessLineOfSightSector(CSector &sector, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, bool ignoreSomeObjects, bool ignoreShootThrough);
static bool ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool ignoreSeeThrough, bool ignoreSomeObjects, bool ignoreShootThrough);
static bool ProcessVerticalLine(const CVector &point1, float z2, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, CStoredCollPoly *poly);
static bool ProcessVerticalLineSector(CSector &sector, const CColLine &line, CColPoint &point, CEntity *&entity, bool checkBuildings, bool checkVehicles, bool checkPeds, bool checkObjects, bool checkDummies, bool ignoreSeeThrough, CStoredCollPoly *poly);
static bool ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CColPoint &point, float &dist, CEntity *&entity, bool ignoreSeeThrough, CStoredCollPoly *poly);
@ -125,6 +126,8 @@ public:
static void CallOffChaseForAreaSectorListVehicles(CPtrList& list, float x1, float y1, float x2, float y2, float fStartX, float fStartY, float fEndX, float fEndY);
static void CallOffChaseForAreaSectorListPeds(CPtrList& list, float x1, float y1, float x2, float y2);
static bool IsWanderPathClear(CVector const&, CVector const&, float, int);
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); }
static float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }
static int GetSectorIndexX(float f) { return (int)GetSectorX(f); }

View file

@ -112,6 +112,7 @@ CTheZones::Init(void)
memset(&MapZoneArray[i], 0, sizeof(CZone));
MapZoneArray[i].type = ZONE_MAPZONE;
}
TotalNumberOfMapZones = 1;
strcpy(MapZoneArray[0].name, "THEMAP");
MapZoneArray[0].minx = -2400.0f;
MapZoneArray[0].miny = -2000.0f;
@ -724,17 +725,17 @@ CTheZones::LoadAllZones(uint8 *buffer, uint32 size)
for(i = 0; i < ARRAY_SIZE(NavigationZoneArray); i++){
NavigationZoneArray[i] = ReadSaveBuf<CZone>(buffer);
NavigationZoneArray[i].child = GetPointerForZoneIndex((int32)NavigationZoneArray[i].child);
NavigationZoneArray[i].parent = GetPointerForZoneIndex((int32)NavigationZoneArray[i].parent);
NavigationZoneArray[i].next = GetPointerForZoneIndex((int32)NavigationZoneArray[i].next);
NavigationZoneArray[i].child = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].child);
NavigationZoneArray[i].parent = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].parent);
NavigationZoneArray[i].next = GetPointerForZoneIndex((uintptr)NavigationZoneArray[i].next);
}
for(i = 0; i < ARRAY_SIZE(InfoZoneArray); i++){
InfoZoneArray[i] = ReadSaveBuf<CZone>(buffer);
InfoZoneArray[i].child = GetPointerForZoneIndex((int32)InfoZoneArray[i].child);
InfoZoneArray[i].parent = GetPointerForZoneIndex((int32)InfoZoneArray[i].parent);
InfoZoneArray[i].next = GetPointerForZoneIndex((int32)InfoZoneArray[i].next);
InfoZoneArray[i].child = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].child);
InfoZoneArray[i].parent = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].parent);
InfoZoneArray[i].next = GetPointerForZoneIndex((uintptr)InfoZoneArray[i].next);
}
for(i = 0; i < ARRAY_SIZE(ZoneInfoArray); i++)

View file

@ -66,7 +66,7 @@ enum Config {
// Cull zones
NUMATTRIBZONES = 704,
NUMHANDLINGS = 106,
NUMOCCLUSIONVOLUMES = 350,
PATHNODESIZE = 4500,
@ -95,7 +95,7 @@ enum Config {
NUMPACMANPICKUPS = 256,
NUMEVENTS = 64,
NUM_CARGENS = 160,
NUM_CARGENS = 185,
NUM_PATH_NODES_IN_AUTOPILOT = 8,
@ -135,6 +135,8 @@ enum Config {
NUM_CRANES = 8,
NUM_EXPLOSIONS = 48,
NUM_SETPIECES = 96
};
// We'll use this once we're ready to become independent of the game
@ -194,15 +196,13 @@ enum Config {
#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 MORE_LANGUAGES // Add more translations to the game
#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
#ifdef DEBUGMENU
#define RELOADABLES // some debug menu options to reload TXD files
#endif
// Particle
@ -222,7 +222,6 @@ enum Config {
// 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.
#define MENU_MAP // VC-like menu map. Make sure you have new menu.txd
#define SCROLLABLE_STATS_PAGE // only draggable by mouse atm

View file

@ -81,7 +81,7 @@ RwRGBA gColourTop;
bool gameAlreadyInitialised;
float NumberOfChunksLoaded;
#define TOTALNUMCHUNKS 73.0f
#define TOTALNUMCHUNKS 95.0f
bool g_SlowMode = false;
char version_name[64];
@ -137,9 +137,10 @@ DoRWStuffStartOfFrame(int16 TopRed, int16 TopGreen, int16 TopBlue, int16 BottomR
CRGBA TopColor(TopRed, TopGreen, TopBlue, Alpha);
CRGBA BottomColor(BottomRed, BottomGreen, BottomBlue, Alpha);
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
RwCameraClear(Scene.camera, &TopColor.rwRGBA, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
return false;
@ -155,6 +156,7 @@ 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)
{
CDraw::CalculateAspectRatio();
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
@ -199,13 +201,13 @@ DoFade(void)
}
}
if(CDraw::FadeValue != 0 || CMenuManager::m_PrefsBrightness < 256){
if(CDraw::FadeValue != 0 || FrontEndMenuManager.m_PrefsBrightness < 256){
CSprite2d *splash = LoadSplash(nil);
CRGBA fadeColor;
CRect rect;
int fadeValue = CDraw::FadeValue;
float brightness = Min(CMenuManager::m_PrefsBrightness, 256);
float brightness = Min(FrontEndMenuManager.m_PrefsBrightness, 256);
if(brightness <= 50)
brightness = 50;
if(FrontEndMenuManager.m_bMenuActive)
@ -328,7 +330,7 @@ PluginAttach(void)
static RwBool
Initialise3D(void *param)
{
if (RsRwInitialise(param))
if (RsRwInitialize(param))
{
#ifdef DEBUGMENU
DebugMenuInit();
@ -356,6 +358,7 @@ Terminate3D(void)
CSprite2d splash;
int splashTxdId = -1;
//--MIAMI: done
CSprite2d*
LoadSplash(const char *name)
{
@ -401,22 +404,23 @@ DestroySplashScreen(void)
splashTxdId = -1;
}
//--MIAMI: done
Const char*
GetRandomSplashScreen(void)
{
int index;
static int index2 = 0;
static char splashName[128];
static int splashIndex[24] = {
25, 22, 4, 13,
1, 21, 14, 16,
10, 12, 5, 9,
11, 18, 3, 2,
19, 23, 7, 17,
15, 6, 8, 20
static int splashIndex[12] = {
1, 2,
3, 4,
5, 11,
6, 8,
9, 10,
7, 12
};
index = splashIndex[4*index2 + CGeneral::GetRandomNumberInRange(0, 3)];
index = splashIndex[2*index2 + CGeneral::GetRandomNumberInRange(0, 2)];
index2++;
if(index2 == 6)
index2 = 0;
@ -443,17 +447,14 @@ ResetLoadingScreenBar()
NumberOfChunksLoaded = 0.0f;
}
// TODO: compare with PS2
//--MIAMI: done
void
LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
{
CSprite2d *splash;
#ifndef RANDOMSPLASH
if(CGame::frenchGame || CGame::germanGame || !CGame::nastyGame)
splashscreen = "mainsc2";
else
splashscreen = "mainsc1";
splashscreen = "LOADSC0";
#endif
splash = LoadSplash(splashscreen);
@ -474,36 +475,50 @@ LoadingScreen(const char *str1, const char *str2, const char *splashscreen)
if(str1){
NumberOfChunksLoaded += 1;
#ifndef RANDOMSPLASH
float hpos = SCREEN_SCALE_X(40);
float length = SCREEN_WIDTH - SCREEN_SCALE_X(100);
float vpos = SCREEN_HEIGHT - SCREEN_SCALE_Y(13);
float height = SCREEN_SCALE_Y(7);
CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(40, 53, 68, 255));
float length = SCREEN_WIDTH - SCREEN_SCALE_X(80);
float top = SCREEN_HEIGHT - SCREEN_SCALE_Y(14);
float bottom = top + SCREEN_SCALE_Y(5);
#else
float hpos = SCREEN_STRETCH_X(40);
float length = SCREEN_STRETCH_X(440);
// this is rather weird
float top = SCREEN_STRETCH_Y(407.4f - 7.0f/3.0f);
float bottom = SCREEN_STRETCH_Y(407.4f + 7.0f/3.0f);
#endif
CSprite2d::DrawRect(CRect(hpos-1.0f, top-1.0f, hpos+length+1.0f, bottom+1.0f), CRGBA(40, 53, 68, 255));
CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(155, 50, 125, 255));
length *= NumberOfChunksLoaded/TOTALNUMCHUNKS;
CSprite2d::DrawRect(CRect(hpos, vpos, hpos + length, vpos + height), CRGBA(81, 106, 137, 255));
CSprite2d::DrawRect(CRect(hpos, top, hpos+length, bottom), CRGBA(255, 150, 225, 255));
// this is done by the game but is unused
CFont::SetBackgroundOff();
CFont::SetScale(SCREEN_SCALE_X(2), SCREEN_SCALE_Y(2));
CFont::SetPropOn();
CFont::SetRightJustifyOn();
CFont::SetDropShadowPosition(1);
CFont::SetDropColor(CRGBA(0, 0, 0, 255));
CFont::SetFontStyle(FONT_HEADING);
#ifdef CHATTYSPLASH
// my attempt
static wchar tmpstr[80];
float yscale = SCREEN_SCALE_Y(0.9f);
vpos -= 45*yscale;
top -= 45*yscale;
CFont::SetScale(SCREEN_SCALE_X(0.75f), yscale);
CFont::SetPropOn();
CFont::SetRightJustifyOff();
CFont::SetFontStyle(FONT_BANK);
CFont::SetColor(CRGBA(255, 255, 255, 255));
AsciiToUnicode(str1, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr);
vpos += 22*yscale;
CFont::PrintString(hpos, top, tmpstr);
top += 22*yscale;
AsciiToUnicode(str2, tmpstr);
CFont::PrintString(hpos, vpos, tmpstr);
CFont::PrintString(hpos, top, tmpstr);
#endif
}
@ -676,11 +691,13 @@ DisplayGameDebugText()
{
static bool bDisplayPosn = false;
static bool bDisplayRate = false;
static bool bDisplayCheatStr = false;
{
SETTWEAKPATH("GameDebugText");
TWEAKBOOL(bDisplayPosn);
TWEAKBOOL(bDisplayRate);
TWEAKBOOL(bDisplayCheatStr);
}
@ -768,6 +785,26 @@ DisplayGameDebugText()
CFont::SetColor(CRGBA(255, 108, 0, 255));
CFont::PrintString(40.0f, 40.0f, ustr);
}
if (bDisplayCheatStr)
{
sprintf(str, "%s", CPad::KeyBoardCheatString);
AsciiToUnicode(str, ustr);
CFont::SetPropOff();
CFont::SetBackgroundOff();
CFont::SetScale(0.7f, 1.5f);
CFont::SetCentreOn();
CFont::SetBackGroundOnlyTextOff();
CFont::SetWrapx(640.0f);
CFont::SetFontStyle(FONT_HEADING);
CFont::SetColor(CRGBA(0, 0, 0, 255));
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH * 0.5f)+2.f, SCREEN_SCALE_FROM_BOTTOM(20.0f)+2.f, ustr);
CFont::SetColor(CRGBA(255, 150, 225, 255));
CFont::PrintString(SCREEN_SCALE_X(DEFAULT_SCREEN_WIDTH * 0.5f), SCREEN_SCALE_FROM_BOTTOM(20.0f), ustr);
}
}
#endif
@ -913,15 +950,12 @@ Render2dStuffAfterFade(void)
CHud::DrawAfterFade();
CFont::DrawFonts();
CCredits::Render();
}
void
Idle(void *arg)
{
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
#endif
CTimer::Update();
#ifdef TIMEBARS
@ -931,35 +965,6 @@ Idle(void *arg)
CSprite2d::InitPerFrame();
CFont::InitPerFrame();
// We're basically merging FrontendIdle and Idle (just like TheGame on PS2)
#ifdef PS2_SAVE_DIALOG
// Only exists on PC FrontendIdle, probably some PS2 bug fix
if (FrontEndMenuManager.m_bMenuActive)
CSprite2d::SetRecipNearClip();
if (FrontEndMenuManager.m_bGameNotLoaded) {
CPad::UpdatePads();
FrontEndMenuManager.Process();
} else {
CPointLights::InitPerFrame();
#ifdef TIMEBARS
tbStartTimer(0, "CGame::Process");
#endif
CGame::Process();
#ifdef TIMEBARS
tbEndTimer("CGame::Process");
tbStartTimer(0, "DMAudio.Service");
#endif
DMAudio.Service();
#ifdef TIMEBARS
tbEndTimer("DMAudio.Service");
#endif
}
if (RsGlobal.quit)
return;
#else
CPointLights::InitPerFrame();
#ifdef TIMEBARS
tbStartTimer(0, "CGame::Process");
@ -974,7 +979,6 @@ Idle(void *arg)
#ifdef TIMEBARS
tbEndTimer("DMAudio.Service");
#endif
#endif
if(CGame::bDemoMode && CTimer::GetTimeInMilliseconds() > (3*60 + 30)*1000 && !CCutsceneMgr::IsCutsceneProcessing()){
@ -991,17 +995,16 @@ Idle(void *arg)
if(arg == nil)
return;
if((!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu) &&
// m_bRenderGameInMenu is there in III PS2 but I don't know about VC PS2.
if((!FrontEndMenuManager.m_bMenuActive/* || FrontEndMenuManager.m_bRenderGameInMenu*/) &&
TheCamera.GetScreenFadeStatus() != FADE_2)
{
#ifdef GTA_PC
if (!FrontEndMenuManager.m_bRenderGameInMenu) {
// This is from SA, but it's nice for windowed mode
RwV2d pos;
pos.x = SCREEN_WIDTH / 2.0f;
pos.y = SCREEN_HEIGHT / 2.0f;
RsMouseSetPos(&pos);
}
#endif
#ifdef TIMEBARS
tbStartTimer(0, "CnstrRenderList");
@ -1058,6 +1061,7 @@ Idle(void *arg)
tbEndTimer("Render2dStuff");
#endif
}else{
CDraw::CalculateAspectRatio();
#ifdef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
#else
@ -1069,10 +1073,6 @@ Idle(void *arg)
return;
}
#ifdef PS2_SAVE_DIALOG
if (FrontEndMenuManager.m_bMenuActive)
DefinedState();
#endif
#ifdef TIMEBARS
tbStartTimer(0, "RenderMenus");
#endif
@ -1090,7 +1090,7 @@ Idle(void *arg)
#ifdef TIMEBARS
tbEndTimer("Render2dStuff-Fade");
#endif
CCredits::Render();
// CCredits::Render(); // They added it to function above and also forgot it here
#ifdef TIMEBARS
tbDisplay();
@ -1105,10 +1105,7 @@ Idle(void *arg)
void
FrontendIdle(void)
{
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
#endif
CDraw::CalculateAspectRatio();
CTimer::Update();
CSprite2d::SetRecipNearClip(); // this should be on InitialiseRenderWare according to PS2 asm. seems like a bug fix
CSprite2d::InitPerFrame();
@ -1119,11 +1116,7 @@ FrontendIdle(void)
if(RsGlobal.quit)
return;
#ifdef ASPECT_RATIO_SCALE
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, SCREEN_ASPECT_RATIO);
#else
CameraSize(Scene.camera, nil, SCREEN_VIEWWINDOW, DEFAULT_ASPECT_RATIO);
#endif
CVisibilityPlugins::SetRenderWareCamera(Scene.camera);
RwCameraClear(Scene.camera, &gColourTop, rwCAMERACLEARZ);
if(!RsCameraBeginUpdate(Scene.camera))
@ -1133,7 +1126,7 @@ FrontendIdle(void)
RenderMenus();
DoFade();
Render2dStuffAfterFade();
// CFont::DrawFonts(); // redundant
CFont::DrawFonts();
DoRWStuffEndOfFrame();
}
@ -1149,10 +1142,10 @@ AppEventHandler(RsEvent event, void *param)
{
switch( event )
{
case rsINITIALISE:
case rsINITIALIZE:
{
CGame::InitialiseOnceBeforeRW();
return RsInitialise() ? rsEVENTPROCESSED : rsEVENTERROR;
return RsInitialize() ? rsEVENTPROCESSED : rsEVENTERROR;
}
case rsCAMERASIZE:
@ -1164,7 +1157,7 @@ AppEventHandler(RsEvent event, void *param)
return rsEVENTPROCESSED;
}
case rsRWINITIALISE:
case rsRWINITIALIZE:
{
return Initialise3D(param) ? rsEVENTPROCESSED : rsEVENTERROR;
}
@ -1204,11 +1197,7 @@ AppEventHandler(RsEvent event, void *param)
case rsFRONTENDIDLE:
{
#ifdef PS2_SAVE_DIALOG
Idle((void*)1);
#else
FrontendIdle();
#endif
return rsEVENTPROCESSED;
}
@ -1243,9 +1232,8 @@ TheModelViewer(void)
#if (defined(GTA_PS2) || defined(GTA_XBOX))
//TODO
#else
#ifdef ASPECT_RATIO_SCALE
CDraw::SetAspectRatio(CDraw::FindAspectRatio());
#endif
CDraw::CalculateAspectRatio();
CAnimViewer::Update();
CTimer::Update();
SetLightsWithTimeOfDayColour(Scene.world);
@ -1294,9 +1282,9 @@ void TheGame(void)
strcpy(TheMemoryCard.LoadFileName, TheMemoryCard.field37);
TheMemoryCard.b_FoundRecentSavedGameWantToLoad = true;
if (CMenuManager::m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
if (FrontEndMenuManager.m_PrefsLanguage != TheMemoryCard.GetLanguageToLoad())
{
CMenuManager::m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
FrontEndMenuManager.m_PrefsLanguage = TheMemoryCard.GetLanguageToLoad();
TheText.Unload();
TheText.Load();
}
@ -1370,7 +1358,8 @@ void TheGame(void)
gMainHeap.PushMemId(_TODOCONST(15));
#endif
if (!FrontEndMenuManager.m_bMenuActive || FrontEndMenuManager.m_bRenderGameInMenu == true && TheCamera.GetScreenFadeStatus() != FADE_2 )
// m_bRenderGameInMenu is there in III PS2 but I don't know about VC PS2.
if (!FrontEndMenuManager.m_bMenuActive || /*FrontEndMenuManager.m_bRenderGameInMenu == true && */TheCamera.GetScreenFadeStatus() != FADE_2 )
{
#ifdef GTA_PS2
gMainHeap.PushMemId(_TODOCONST(11));
@ -1577,30 +1566,30 @@ void SystemInit()
CGame::frenchGame = false;
CGame::germanGame = false;
CGame::nastyGame = true;
CMenuManager::m_PrefsAllowNastyGame = true;
FrontEndMenuManager.m_PrefsAllowNastyGame = true;
#ifdef GTA_PS2
int32 lang = sceScfGetLanguage();
if ( lang == SCE_ITALIAN_LANGUAGE )
CMenuManager::m_PrefsLanguage = LANGUAGE_ITALIAN;
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_ITALIAN;
else if ( lang == SCE_SPANISH_LANGUAGE )
CMenuManager::m_PrefsLanguage = LANGUAGE_SPANISH;
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_SPANISH;
else if ( lang == SCE_GERMAN_LANGUAGE )
{
CGame::germanGame = true;
CGame::nastyGame = false;
CMenuManager::m_PrefsAllowNastyGame = false;
CMenuManager::m_PrefsLanguage = LANGUAGE_GERMAN;
FrontEndMenuManager.m_PrefsAllowNastyGame = false;
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_GERMAN;
}
else if ( lang == SCE_FRENCH_LANGUAGE )
{
CGame::frenchGame = true;
CGame::nastyGame = false;
CMenuManager::m_PrefsAllowNastyGame = false;
CMenuManager::m_PrefsLanguage = LANGUAGE_FRENCH;
FrontEndMenuManager.m_PrefsAllowNastyGame = false;
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_FRENCH;
}
else
CMenuManager::m_PrefsLanguage = LANGUAGE_AMERICAN;
FrontEndMenuManager.m_PrefsLanguage = LANGUAGE_AMERICAN;
FrontEndMenuManager.InitialiseMenuContentsAfterLoadingGame();
#else

View file

@ -69,7 +69,7 @@ mysrand(unsigned int seed)
#ifdef DEBUGMENU
void WeaponCheat();
void HealthCheat();
void TankCheat();
void VehicleCheat(bool something, int model);
void BlowUpCarsCheat();
void ChangePlayerCheat();
void MayhemCheat();
@ -160,6 +160,13 @@ TeleportToWaypoint(void)
}
#endif
static void
SwitchCarCollision(void)
{
if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar())
FindPlayerVehicle()->bUsesCollision = !FindPlayerVehicle()->bUsesCollision;
}
static int engineStatus;
static void
SetEngineStatus(void)
@ -273,7 +280,7 @@ DebugMenuPopulate(void)
{
if(1){
static const char *weathers[] = {
"Sunny", "Cloudy", "Rainy", "Foggy"
"Sunny", "Cloudy", "Rainy", "Foggy", "Extrasunny", "Stormy"
};
DebugMenuEntry *e;
e = DebugMenuAddVar("Time & Weather", "Current Hour", &CClock::GetHoursRef(), nil, 1, 0, 23, nil);
@ -281,9 +288,9 @@ DebugMenuPopulate(void)
e = DebugMenuAddVar("Time & Weather", "Current Minute", &CClock::GetMinutesRef(),
[](){ CWeather::InterpolationValue = CClock::GetMinutes()/60.0f; }, 1, 0, 59, nil);
DebugMenuEntrySetWrap(e, true);
e = DebugMenuAddVar("Time & Weather", "Old Weather", (int16*)&CWeather::OldWeatherType, nil, 1, 0, 3, weathers);
e = DebugMenuAddVar("Time & Weather", "Old Weather", (int16*)&CWeather::OldWeatherType, nil, 1, 0, 5, weathers);
DebugMenuEntrySetWrap(e, true);
e = DebugMenuAddVar("Time & Weather", "New Weather", (int16*)&CWeather::NewWeatherType, nil, 1, 0, 3, weathers);
e = DebugMenuAddVar("Time & Weather", "New Weather", (int16*)&CWeather::NewWeatherType, nil, 1, 0, 5, weathers);
DebugMenuEntrySetWrap(e, true);
DebugMenuAddVar("Time & Weather", "Wind", (float*)&CWeather::Wind, nil, 0.1f, 0.0f, 1.0f);
DebugMenuAddVar("Time & Weather", "Time scale", (float*)&CTimer::GetTimeScale(), nil, 0.1f, 0.0f, 10.0f);
@ -293,7 +300,7 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Cheats", "Health", HealthCheat);
DebugMenuAddCmd("Cheats", "Wanted level up", WantedLevelUpCheat);
DebugMenuAddCmd("Cheats", "Wanted level down", WantedLevelDownCheat);
DebugMenuAddCmd("Cheats", "Tank", TankCheat);
DebugMenuAddCmd("Cheats", "Tank", []() { VehicleCheat(true, MI_TAXI); });
DebugMenuAddCmd("Cheats", "Blow up cars", BlowUpCarsCheat);
DebugMenuAddCmd("Cheats", "Change player", ChangePlayerCheat);
DebugMenuAddCmd("Cheats", "Mayhem", MayhemCheat);
@ -337,7 +344,11 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Spawn", "Spawn Banshee", [](){ SpawnCar(MI_BANSHEE); });
DebugMenuAddCmd("Spawn", "Spawn Cuban", [](){ SpawnCar(MI_CUBAN); });
DebugMenuAddCmd("Spawn", "Spawn Voodoo", [](){ SpawnCar(MI_VOODOO); });
DebugMenuAddCmd("Spawn", "Spawn Maverick", [](){ SpawnCar(MI_MAVERICK); });
DebugMenuAddCmd("Spawn", "Spawn VCN Maverick", [](){ SpawnCar(MI_VCNMAV); });
DebugMenuAddCmd("Spawn", "Spawn Sparrow", [](){ SpawnCar(MI_SPARROW); });
DebugMenuAddCmd("Spawn", "Spawn Sea Sparrow", [](){ SpawnCar(MI_SEASPAR); });
DebugMenuAddCmd("Spawn", "Spawn Hunter", [](){ SpawnCar(MI_HUNTER); });
DebugMenuAddCmd("Spawn", "Spawn Rhino", [](){ SpawnCar(MI_RHINO); });
DebugMenuAddCmd("Spawn", "Spawn Firetruck", [](){ SpawnCar(MI_FIRETRUCK); });
DebugMenuAddCmd("Spawn", "Spawn Predator", [](){ SpawnCar(MI_PREDATOR); });
@ -365,6 +376,7 @@ DebugMenuPopulate(void)
#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);
@ -385,6 +397,13 @@ DebugMenuPopulate(void)
DebugMenuAddCmd("Debug", "Start Credits", CCredits::Start);
DebugMenuAddCmd("Debug", "Stop Credits", CCredits::Stop);
#ifdef RELOADABLES
DebugMenuAddCmd("Reload", "HUD.TXD", CHud::ReloadTXD);
DebugMenuAddCmd("Reload", "FONTS.TXD", NULL);
DebugMenuAddCmd("Reload", "FRONTEN1.TXD", NULL);
DebugMenuAddCmd("Reload", "FRONTEN2.TXD", NULL);
#endif
extern bool PrintDebugCode;
extern int16 DebugCamMode;
DebugMenuAddVarBool8("Cam", "Use mouse Cam", &CCamera::m_bUseMouse3rdPerson, nil);

View file

@ -20,3 +20,25 @@ CBuilding::ReplaceWithNewModel(int32 id)
if(m_level == LEVEL_NONE || m_level == CGame::currLevel)
CStreaming::RequestModel(id, STREAMFLAGS_DONT_REMOVE);
}
bool
IsBuildingPointerValid(CBuilding* pBuilding)
{
if (!pBuilding)
return false;
if (pBuilding->GetIsATreadable()) {
int index = CPools::GetTreadablePool()->GetJustIndex((CTreadable*)pBuilding);
#ifdef FIX_BUGS
return index >= 0 && index < CPools::GetTreadablePool()->GetSize();
#else
return index >= 0 && index <= CPools::GetTreadablePool()->GetSize();
#endif
} else {
int index = CPools::GetBuildingPool()->GetJustIndex(pBuilding);
#ifdef FIX_BUGS
return index >= 0 && index < CPools::GetBuildingPool()->GetSize();
#else
return index >= 0 && index <= CPools::GetBuildingPool()->GetSize();
#endif
}
}

View file

@ -16,3 +16,5 @@ public:
virtual bool GetIsATreadable(void) { return false; }
};
bool IsBuildingPointerValid(CBuilding*);

View file

@ -50,3 +50,18 @@ CDummy::Remove(void)
m_entryInfoList.DeleteNode(node);
}
}
bool
IsDummyPointerValid(CDummy* pDummy)
{
if (!pDummy)
return false;
int index = CPools::GetDummyPool()->GetJustIndex(pDummy);
#ifdef FIX_BUGS
if (index < 0 || index >= CPools::GetDummyPool()->GetSize())
#else
if (index < 0 || index > CPools::GetDummyPool()->GetSize())
#endif
return false;
return pDummy->m_entryInfoList.first;
}

View file

@ -15,3 +15,5 @@ public:
static void *operator new(size_t);
static void operator delete(void*, size_t);
};
bool IsDummyPointerValid(CDummy* pDummy);

View file

@ -28,6 +28,11 @@
#include "Bones.h"
#include "Debug.h"
#include "Renderer.h"
#include "Ped.h"
#include "Dummy.h"
#include "WindModifiers.h"
//--MIAMI: file almost done (see TODO)
int gBuildings;
@ -78,7 +83,7 @@ CEntity::CEntity(void)
bIsStaticWaitingForCollision = false;
m_flagE10 = false;
bUnderwater = false;
m_flagE40 = false;
bHasPreRenderEffects = false;
m_scanCode = 0;
m_modelIndex = -1;
@ -274,6 +279,21 @@ CEntity::Remove(void)
}
}
void
CEntity::SetModelIndex(uint32 id)
{
m_modelIndex = id;
bHasPreRenderEffects = HasPreRenderEffects();
CreateRwObject();
}
void
CEntity::SetModelIndexNoCreate(uint32 id)
{
m_modelIndex = id;
bHasPreRenderEffects = HasPreRenderEffects();
}
void
CEntity::CreateRwObject(void)
{
@ -304,10 +324,8 @@ CEntity::DeleteRwObject(void)
RpAtomicDestroy((RpAtomic*)m_rwObject);
RwFrameDestroy(f);
}else if(RwObjectGetType(m_rwObject) == rpCLUMP){
#ifdef PED_SKIN
if(IsClumpSkinned((RpClump*)m_rwObject))
RpClumpForAllAtomics((RpClump*)m_rwObject, AtomicRemoveAnimFromSkinCB, nil);
#endif
RpClumpDestroy((RpClump*)m_rwObject);
}
m_rwObject = nil;
@ -328,7 +346,6 @@ CEntity::UpdateRwFrame(void)
}
}
//--MIAMI: done
void
CEntity::SetupBigBuilding(void)
{
@ -368,19 +385,39 @@ CEntity::GetBoundRect(void)
return rect;
}
bool
CEntity::HasPreRenderEffects(void)
{
return IsTreeModel(GetModelIndex()) ||
GetModelIndex() == MI_COLLECTABLE1 ||
GetModelIndex() == MI_MONEY ||
GetModelIndex() == MI_CARMINE ||
GetModelIndex() == MI_NAUTICALMINE ||
GetModelIndex() == MI_BRIEFCASE ||
GetModelIndex() == MI_GRENADE ||
GetModelIndex() == MI_MOLOTOV ||
GetModelIndex() == MI_MISSILE ||
GetModelIndex() == MI_BEACHBALL ||
IsGlass(GetModelIndex()) ||
IsObject() && ((CObject*)this)->bIsPickup ||
IsLightWithPreRenderEffects(GetModelIndex());
}
void
CEntity::PreRender(void)
{
if (CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects() != 0)
ProcessLightsForEntity();
if(!bHasPreRenderEffects)
return;
switch(m_type){
case ENTITY_TYPE_BUILDING:
if(GetModelIndex() == MI_RAILTRACKS){
CShadows::StoreShadowForPole(this, 0.0f, -10.949f, 5.0f, 8.0f, 1.0f, 0);
CShadows::StoreShadowForPole(this, 0.0f, 10.949f, 5.0f, 8.0f, 1.0f, 1);
}else if(IsTreeModel(GetModelIndex())){
CShadows::StoreShadowForTree(this);
if(IsTreeModel(GetModelIndex())){
float dist = (TheCamera.GetPosition() - GetPosition()).Magnitude2D();
CObject::fDistToNearestTree = Min(CObject::fDistToNearestTree, dist);
ModifyMatrixForTreeInWind();
}else if(IsBannerModel(GetModelIndex())){
ModifyMatrixForBannerInWind();
}
break;
case ENTITY_TYPE_OBJECT:
@ -400,22 +437,6 @@ CEntity::PreRender(void)
GetMatrix().UpdateRW();
UpdateRwFrame();
}
}else if(IsPickupModel(GetModelIndex())){
if(((CObject*)this)->bIsPickup){
CPickups::DoPickUpEffects(this);
GetMatrix().UpdateRW();
UpdateRwFrame();
}else if(GetModelIndex() == MI_GRENADE){
CMotionBlurStreaks::RegisterStreak((uintptr)this,
100, 100, 100,
GetPosition() - 0.07f*TheCamera.GetRight(),
GetPosition() + 0.07f*TheCamera.GetRight());
}else if(GetModelIndex() == MI_MOLOTOV){
CMotionBlurStreaks::RegisterStreak((uintptr)this,
0, 100, 0,
GetPosition() - 0.07f*TheCamera.GetRight(),
GetPosition() + 0.07f*TheCamera.GetRight());
}
}else if(GetModelIndex() == MI_MISSILE){
CVector pos = GetPosition();
float flicker = (CGeneral::GetRandomNumber() & 0xF)/(float)0x10;
@ -438,12 +459,44 @@ CEntity::PreRender(void)
CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f);
}else if(IsGlass(GetModelIndex())){
PreRenderForGlassWindow();
}else if (((CObject*)this)->bIsPickup) {
CPickups::DoPickUpEffects(this);
GetMatrix().UpdateRW();
UpdateRwFrame();
} else if (GetModelIndex() == MI_GRENADE) {
CMotionBlurStreaks::RegisterStreak((uintptr)this,
100, 100, 100,
GetPosition() - 0.07f * TheCamera.GetRight(),
GetPosition() + 0.07f * TheCamera.GetRight());
} else if (GetModelIndex() == MI_MOLOTOV) {
CMotionBlurStreaks::RegisterStreak((uintptr)this,
0, 100, 0,
GetPosition() - 0.07f * TheCamera.GetRight(),
GetPosition() + 0.07f * TheCamera.GetRight());
}else if(GetModelIndex() == MI_BEACHBALL){
CVector pos = GetPosition();
CShadows::StoreShadowToBeRendered(SHADOWTYPE_DARK,
gpShadowPedTex, &pos,
0.4f, 0.0f, 0.0f, -0.4f,
CTimeCycle::GetShadowStrength(),
CTimeCycle::GetShadowStrength(),
CTimeCycle::GetShadowStrength(),
CTimeCycle::GetShadowStrength(),
20.0f, false, 1.0f);
}
// fall through
case ENTITY_TYPE_DUMMY:
if(GetModelIndex() == MI_TRAFFICLIGHTS){
CTrafficLights::DisplayActualLight(this);
CShadows::StoreShadowForPole(this, 2.957f, 0.147f, 0.0f, 16.0f, 0.4f, 0);
}else if(GetModelIndex() == MI_TRAFFICLIGHTS_VERTICAL){
CTrafficLights::DisplayActualLight(this);
}else if(GetModelIndex() == MI_TRAFFICLIGHTS_MIAMI){
CTrafficLights::DisplayActualLight(this);
CShadows::StoreShadowForPole(this, 4.819f, 1.315f, 0.0f, 16.0f, 0.4f, 0);
}else if(GetModelIndex() == MI_TRAFFICLIGHTS_TWOVERTICAL){
CTrafficLights::DisplayActualLight(this);
CShadows::StoreShadowForPole(this, 7.503f, 0.0f, 0.0f, 16.0f, 0.4f, 0);
}else if(GetModelIndex() == MI_SINGLESTREETLIGHTS1)
CShadows::StoreShadowForPole(this, 0.744f, 0.0f, 0.0f, 16.0f, 0.4f, 0);
else if(GetModelIndex() == MI_SINGLESTREETLIGHTS2)
@ -452,19 +505,15 @@ CEntity::PreRender(void)
CShadows::StoreShadowForPole(this, 1.143f, 0.145f, 0.0f, 16.0f, 0.4f, 0);
else if(GetModelIndex() == MI_DOUBLESTREETLIGHTS)
CShadows::StoreShadowForPole(this, 0.0f, -0.048f, 0.0f, 16.0f, 0.4f, 0);
else if(GetModelIndex() == MI_STREETLAMP1 ||
GetModelIndex() == MI_STREETLAMP2)
CShadows::StoreShadowForPole(this, 0.0f, 0.0f, 0.0f, 16.0f, 0.4f, 0);
break;
}
if (CModelInfo::GetModelInfo(GetModelIndex())->GetNum2dEffects() != 0)
ProcessLightsForEntity();
}
void
CEntity::PreRenderForGlassWindow(void)
{
if(((CSimpleModelInfo*)CModelInfo::GetModelInfo(m_modelIndex))->m_isArtistGlass)
return;
CGlass::AskForObjectToBeRenderedInGlass(this);
bIsVisible = false;
}
@ -485,8 +534,6 @@ CEntity::Render(void)
bool
CEntity::SetupLighting(void)
{
DeActivateDirectional();
SetAmbientColours();
return false;
}
@ -572,13 +619,12 @@ CEntity::PruneReferences(void)
}
}
#ifdef PED_SKIN
void
CEntity::UpdateRpHAnim(void)
{
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
RpHAnimHierarchyUpdateMatrices(hier);
if(IsClumpSkinned(GetClump())){
RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(GetClump());
RpHAnimHierarchyUpdateMatrices(hier);
#if 0
int i;
char buf[256];
@ -607,8 +653,8 @@ CEntity::UpdateRpHAnim(void)
void RenderSkeleton(RpHAnimHierarchy *hier);
RenderSkeleton(hier);
#endif
}
}
#endif
void
CEntity::AddSteamsFromGround(CVector *unused)
@ -640,6 +686,15 @@ CEntity::AddSteamsFromGround(CVector *unused)
case 4:
CParticleObject::AddObject(POBJECT_DARK_SMOKE, pos, effect->particle.dir, effect->particle.scale, false);
break;
// TODO(MIAMI): enable this once we have the particle objects
/*
case 5:
CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_VERT, pos, effect->particle.dir, effect->particle.scale, false);
break;
case 6:
CParticleObject::AddObject(POBJECT_WATER_FOUNTAIN_HORIZ, pos, effect->particle.dir, effect->particle.scale, false);
break;
*/
}
}
}
@ -664,80 +719,66 @@ CEntity::ProcessLightsForEntity(void)
for(i = 0; i < n; i++, flashTimer1 += 0x80, flashTimer2 += 0x100, flashTimer3 += 0x200){
effect = CModelInfo::GetModelInfo(GetModelIndex())->Get2dEffect(i);
if(effect->type != EFFECT_LIGHT)
continue;
switch(effect->type){
case EFFECT_LIGHT:
pos = GetMatrix() * effect->pos;
pos = GetMatrix() * effect->pos;
lightOn = false;
lightFlickering = false;
switch(effect->light.lightType){
case LIGHT_ON:
lightOn = true;
break;
case LIGHT_ON_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
lightOn = false;
lightFlickering = false;
switch(effect->light.lightType){
case LIGHT_ON:
lightOn = true;
break;
case LIGHT_FLICKER:
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60)
lightOn = true;
else
lightFlickering = true;
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3)
lightOn = true;
break;
case LIGHT_FLICKER_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7){
break;
case LIGHT_ON_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
lightOn = true;
break;
case LIGHT_FLICKER:
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60)
lightOn = true;
else
lightFlickering = true;
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3)
lightOn = true;
}
break;
case LIGHT_FLASH1:
if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200)
lightOn = true;
break;
case LIGHT_FLASH1_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
break;
case LIGHT_FLICKER_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7 || CWeather::WetRoads > 0.5f){
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed) & 0x60)
lightOn = true;
else
lightFlickering = true;
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed) & 3)
lightOn = true;
}
break;
case LIGHT_FLASH1:
if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200)
lightOn = true;
break;
case LIGHT_FLASH2:
if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400)
lightOn = true;
break;
case LIGHT_FLASH2_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
break;
case LIGHT_FLASH1_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
if((CTimer::GetTimeInMilliseconds() + flashTimer1) & 0x200)
lightOn = true;
break;
case LIGHT_FLASH2:
if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400)
lightOn = true;
break;
case LIGHT_FLASH3:
if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800)
lightOn = true;
break;
case LIGHT_FLASH3_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
break;
case LIGHT_FLASH2_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
if((CTimer::GetTimeInMilliseconds() + flashTimer2) & 0x400)
lightOn = true;
break;
case LIGHT_FLASH3:
if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800)
lightOn = true;
break;
case LIGHT_RANDOM_FLICKER:
if(m_randomSeed > 16)
lightOn = true;
else{
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60)
lightOn = true;
else
lightFlickering = true;
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3)
lightOn = true;
}
break;
case LIGHT_RANDOM_FLICKER_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7){
break;
case LIGHT_FLASH3_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7)
if((CTimer::GetTimeInMilliseconds() + flashTimer3) & 0x800)
lightOn = true;
break;
case LIGHT_RANDOM_FLICKER:
if(m_randomSeed > 16)
lightOn = true;
else{
@ -748,85 +789,143 @@ CEntity::ProcessLightsForEntity(void)
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3)
lightOn = true;
}
break;
case LIGHT_RANDOM_FLICKER_NIGHT:
if(CClock::GetHours() > 18 || CClock::GetHours() < 7){
if(m_randomSeed > 16)
lightOn = true;
else{
if((CTimer::GetTimeInMilliseconds() ^ m_randomSeed*8) & 0x60)
lightOn = true;
else
lightFlickering = true;
if((CTimer::GetTimeInMilliseconds()>>11 ^ m_randomSeed*8) & 3)
lightOn = true;
}
}
break;
case LIGHT_BRIDGE_FLASH1:
if(CBridge::ShouldLightsBeFlashing() && CTimer::GetTimeInMilliseconds() & 0x200)
lightOn = true;
break;
case LIGHT_BRIDGE_FLASH2:
if(CBridge::ShouldLightsBeFlashing() && (CTimer::GetTimeInMilliseconds() & 0x1FF) < 60)
lightOn = true;
break;
}
if(effect->light.flags & LIGHTFLAG_HIDE_OBJECT){
if(lightOn)
bDoNotRender = false;
else
bDoNotRender = true;
return;
}
// Corona
if(lightOn)
CCoronas::RegisterCorona((uintptr)this + i,
effect->col.r, effect->col.g, effect->col.b, 255,
pos, effect->light.size, effect->light.dist,
effect->light.corona, effect->light.flareType, effect->light.roadReflection,
effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f,
!!(effect->light.flags&LIGHTFLAG_LONG_DIST));
else if(lightFlickering)
CCoronas::RegisterCorona((uintptr)this + i,
0, 0, 0, 255,
pos, effect->light.size, effect->light.dist,
effect->light.corona, effect->light.flareType, effect->light.roadReflection,
effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f,
!!(effect->light.flags&LIGHTFLAG_LONG_DIST));
// Pointlight
bool alreadyProcessedFog;
alreadyProcessedFog = false;
if(effect->light.range != 0.0f && lightOn){
if(effect->col.r == 0 && effect->col.g == 0 && effect->col.b == 0){
CPointLights::AddLight(CPointLights::LIGHT_POINT,
pos, CVector(0.0f, 0.0f, 0.0f),
effect->light.range,
0.0f, 0.0f, 0.0f,
CPointLights::FOG_NONE, true);
}else{
CPointLights::AddLight(CPointLights::LIGHT_POINT,
pos, CVector(0.0f, 0.0f, 0.0f),
effect->light.range,
effect->col.r*CTimeCycle::GetSpriteBrightness()/255.0f,
effect->col.g*CTimeCycle::GetSpriteBrightness()/255.0f,
effect->col.b*CTimeCycle::GetSpriteBrightness()/255.0f,
(effect->light.flags & LIGHTFLAG_FOG) >> 1,
true);
alreadyProcessedFog = true;
}
}
if(!alreadyProcessedFog){
if(effect->light.flags & LIGHTFLAG_FOG_ALWAYS){
CPointLights::AddLight(CPointLights::LIGHT_FOGONLY_ALWAYS,
pos, CVector(0.0f, 0.0f, 0.0f),
0.0f,
effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f,
CPointLights::FOG_ALWAYS, true);
}else if(effect->light.flags & LIGHTFLAG_FOG_NORMAL && lightOn && effect->light.range == 0.0f){
CPointLights::AddLight(CPointLights::LIGHT_FOGONLY,
pos, CVector(0.0f, 0.0f, 0.0f),
0.0f,
effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f,
CPointLights::FOG_NORMAL, true);
}
}
// Light shadow
if(effect->light.shadowRange != 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,
128,
effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
15.0f, 1.0f, 40.0f, false, 0.0f);
}else if(lightFlickering){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f,
0.0f, -effect->light.shadowRange,
0, 0.0f, 0.0f, 0.0f,
15.0f, 1.0f, 40.0f, false, 0.0f);
}
}
break;
case LIGHT_BRIDGE_FLASH1:
if(CBridge::ShouldLightsBeFlashing() && CTimer::GetTimeInMilliseconds() & 0x200)
lightOn = true;
break;
case LIGHT_BRIDGE_FLASH2:
if(CBridge::ShouldLightsBeFlashing() && (CTimer::GetTimeInMilliseconds() & 0x1FF) < 60)
lightOn = true;
break;
}
// Corona
if(lightOn)
CCoronas::RegisterCorona((uintptr)this + i,
effect->col.r, effect->col.g, effect->col.b, 255,
pos, effect->light.size, effect->light.dist,
effect->light.corona, effect->light.flareType, effect->light.roadReflection,
effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f);
else if(lightFlickering)
CCoronas::RegisterCorona((uintptr)this + i,
0, 0, 0, 255,
pos, effect->light.size, effect->light.dist,
effect->light.corona, effect->light.flareType, effect->light.roadReflection,
effect->light.flags&LIGHTFLAG_LOSCHECK, CCoronas::STREAK_OFF, 0.0f);
// Pointlight
if(effect->light.flags & LIGHTFLAG_FOG_ALWAYS){
CPointLights::AddLight(CPointLights::LIGHT_FOGONLY_ALWAYS,
pos, CVector(0.0f, 0.0f, 0.0f),
effect->light.range,
effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f,
CPointLights::FOG_ALWAYS, true);
}else if(effect->light.flags & LIGHTFLAG_FOG_NORMAL && lightOn && effect->light.range == 0.0f){
CPointLights::AddLight(CPointLights::LIGHT_FOGONLY,
pos, CVector(0.0f, 0.0f, 0.0f),
effect->light.range,
effect->col.r/255.0f, effect->col.g/255.0f, effect->col.b/255.0f,
CPointLights::FOG_NORMAL, true);
}else if(lightOn && effect->light.range != 0.0f){
if(effect->col.r == 0 && effect->col.g == 0 && effect->col.b == 0){
CPointLights::AddLight(CPointLights::LIGHT_POINT,
pos, CVector(0.0f, 0.0f, 0.0f),
effect->light.range,
0.0f, 0.0f, 0.0f,
CPointLights::FOG_NONE, true);
}else{
CPointLights::AddLight(CPointLights::LIGHT_POINT,
pos, CVector(0.0f, 0.0f, 0.0f),
effect->light.range,
effect->col.r*CTimeCycle::GetSpriteBrightness()/255.0f,
effect->col.g*CTimeCycle::GetSpriteBrightness()/255.0f,
effect->col.b*CTimeCycle::GetSpriteBrightness()/255.0f,
// half-useless because LIGHTFLAG_FOG_ALWAYS can't be on
(effect->light.flags & LIGHTFLAG_FOG) >> 1,
true);
}
}
// Light shadow
if(effect->light.shadowRange != 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,
128,
effect->col.r*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
effect->col.g*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
effect->col.b*CTimeCycle::GetSpriteBrightness()*effect->light.shadowIntensity/255.0f,
15.0f, 1.0f, 40.0f, false, 0.0f);
}else if(lightFlickering){
CShadows::StoreStaticShadow((uintptr)this + i, SHADOWTYPE_ADDITIVE,
effect->light.shadow, &pos,
effect->light.shadowRange, 0.0f,
0.0f, -effect->light.shadowRange,
0, 0.0f, 0.0f, 0.0f,
15.0f, 1.0f, 40.0f, false, 0.0f);
case EFFECT_SUNGLARE:
if(CWeather::SunGlare >= 0.0f){
CVector pos = GetMatrix() * effect->pos;
CVector glareDir = pos - GetPosition();
glareDir.Normalise();
CVector camDir = TheCamera.GetPosition() - pos;
float dist = camDir.Magnitude();
camDir *= 2.0f/dist;
glareDir += camDir;
glareDir.Normalise();
float camAngle = -DotProduct(glareDir, CTimeCycle::GetSunDirection());
if(camAngle > 0.0f){
float intens = Sqrt(camAngle) * CWeather::SunGlare;
pos += camDir;
CCoronas::RegisterCorona((uintptr)this + 33 + i,
intens * (CTimeCycle::GetSunCoreRed() + 2*255)/3.0f,
intens * (CTimeCycle::GetSunCoreGreen() + 2*255)/3.0f,
intens * (CTimeCycle::GetSunCoreBlue() + 2*255)/3.0f,
255,
pos, 0.5f*CWeather::SunGlare*Sqrt(dist), 120.0f,
CCoronas::TYPE_STAR, CCoronas::FLARE_NONE,
CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF,
CCoronas::STREAK_OFF, 0.0f);
}
}
break;
}
}
}
@ -849,27 +948,31 @@ CEntity::ModifyMatrixForTreeInWind(void)
CMatrix mat(GetMatrix().m_attachment);
if(CWeather::Wind >= 0.5){
t = m_randomSeed + 16*CTimer::GetTimeInMilliseconds();
t = m_randomSeed + 8*CTimer::GetTimeInMilliseconds();
f = (t & 0xFFF)/(float)0x1000;
flutter = f * WindTabel[(t>>12)+1 & 0xF] +
(1.0f - f) * WindTabel[(t>>12) & 0xF] +
1.0f;
strength = CWeather::Wind < 0.8f ? 0.008f : 0.014f;
strength = -0.015f*CWeather::Wind;
}else if(CWeather::Wind >= 0.2){
t = (uintptr)this + CTimer::GetTimeInMilliseconds();
f = (t & 0xFFF)/(float)0x1000;
flutter = Sin(f * 6.28f);
strength = 0.008f;
strength = -0.008f;
}else{
t = (uintptr)this + CTimer::GetTimeInMilliseconds();
f = (t & 0xFFF)/(float)0x1000;
flutter = Sin(f * 6.28f);
strength = 0.005f;
strength = -0.005f;
}
mat.GetUp().x = strength * flutter;
if(IsPalmTreeModel(GetModelIndex()))
mat.GetUp().x += -0.07f*CWeather::Wind;
mat.GetUp().y = mat.GetUp().x;
CWindModifiers::FindWindModifier(GetPosition(), &mat.GetUp().x, &mat.GetUp().y);
mat.UpdateRW();
UpdateRwFrame();
}
@ -881,6 +984,7 @@ float BannerWindTabel[] = {
0.28f, 0.28f, 0.22f, 0.1f, 0.0f, -0.1f, -0.17f, -0.12f
};
//--MIAMI: unused
void
CEntity::ModifyMatrixForBannerInWind(void)
{
@ -928,7 +1032,6 @@ CEntity::AddSteamsFromGround(CPtrList& list)
}
#ifdef COMPATIBLE_SAVES
// TODO(MIAMI)
void
CEntity::SaveEntityFlags(uint8*& buf)
{
@ -952,35 +1055,41 @@ CEntity::SaveEntityFlags(uint8*& buf)
if (bRenderScorched) tmp |= BIT(20);
if (bHasBlip) tmp |= BIT(21);
if (bIsBIGBuilding) tmp |= BIT(22);
if (bRenderDamaged) tmp |= BIT(23);
if (bStreamBIGBuilding) tmp |= BIT(23);
if (bBulletProof) tmp |= BIT(24);
if (bFireProof) tmp |= BIT(25);
if (bCollisionProof) tmp |= BIT(26);
if (bMeleeProof) tmp |= BIT(27);
if (bOnlyDamagedByPlayer) tmp |= BIT(28);
if (bStreamingDontDelete) tmp |= BIT(29);
if (bRemoveFromWorld) tmp |= BIT(0);
if (bHasHitWall) tmp |= BIT(1);
if (bRenderDamaged) tmp |= BIT(24);
if (bBulletProof) tmp |= BIT(25);
if (bFireProof) tmp |= BIT(26);
if (bCollisionProof) tmp |= BIT(27);
if (bMeleeProof) tmp |= BIT(28);
if (bOnlyDamagedByPlayer) tmp |= BIT(29);
if (bStreamingDontDelete) tmp |= BIT(30);
if (bRemoveFromWorld) tmp |= BIT(31);
WriteSaveBuf<uint32>(buf, tmp);
tmp = 0;
if (bImBeingRendered) tmp |= BIT(2);
if (bTouchingWater) tmp |= BIT(3);
if (bIsSubway) tmp |= BIT(4);
if (bDrawLast) tmp |= BIT(5);
if (bNoBrightHeadLights) tmp |= BIT(6);
if (bDoNotRender) tmp |= BIT(7);
if (bDistanceFade) tmp |= BIT(8);
if (bHasHitWall) tmp |= BIT(0);
if (bImBeingRendered) tmp |= BIT(1);
if (bTouchingWater) tmp |= BIT(2);
if (bIsSubway) tmp |= BIT(3);
if (bDrawLast) tmp |= BIT(4);
if (bNoBrightHeadLights) tmp |= BIT(5);
if (bDoNotRender) tmp |= BIT(6);
if (bDistanceFade) tmp |= BIT(7);
if (m_flagE1) tmp |= BIT(8);
if (m_flagE2) tmp |= BIT(9);
if (bOffscreen) tmp |= BIT(10);
if (bIsStaticWaitingForCollision) tmp |= BIT(11);
if (m_flagE10) tmp |= BIT(12);
if (bUnderwater) tmp |= BIT(13);
if (bHasPreRenderEffects) tmp |= BIT(14);
WriteSaveBuf<uint32>(buf, tmp);
}
// TODO(MIAMI)
void
CEntity::LoadEntityFlags(uint8*& buf)
{
@ -1004,28 +1113,50 @@ CEntity::LoadEntityFlags(uint8*& buf)
bRenderScorched = !!(tmp & BIT(20));
bHasBlip = !!(tmp & BIT(21));
bIsBIGBuilding = !!(tmp & BIT(22));
bRenderDamaged = !!(tmp & BIT(23));
bStreamBIGBuilding = !!(tmp & BIT(23));
bBulletProof = !!(tmp & BIT(24));
bFireProof = !!(tmp & BIT(25));
bCollisionProof = !!(tmp & BIT(26));
bMeleeProof = !!(tmp & BIT(27));
bOnlyDamagedByPlayer = !!(tmp & BIT(28));
bStreamingDontDelete = !!(tmp & BIT(29));
bRemoveFromWorld = !!(tmp & BIT(0));
bHasHitWall = !!(tmp & BIT(1));
bRenderDamaged = !!(tmp & BIT(24));
bBulletProof = !!(tmp & BIT(25));
bFireProof = !!(tmp & BIT(26));
bCollisionProof = !!(tmp & BIT(27));
bMeleeProof = !!(tmp & BIT(28));
bOnlyDamagedByPlayer = !!(tmp & BIT(29));
bStreamingDontDelete = !!(tmp & BIT(30));
bRemoveFromWorld = !!(tmp & BIT(31));
tmp = ReadSaveBuf<uint32>(buf);
bImBeingRendered = !!(tmp & BIT(2));
bTouchingWater = !!(tmp & BIT(3));
bIsSubway = !!(tmp & BIT(4));
bDrawLast = !!(tmp & BIT(5));
bNoBrightHeadLights = !!(tmp & BIT(6));
bDoNotRender = !!(tmp & BIT(7));
bDistanceFade = !!(tmp & BIT(8));
bHasHitWall = !!(tmp & BIT(0));
bImBeingRendered = !!(tmp & BIT(1));
bTouchingWater = !!(tmp & BIT(2));
bIsSubway = !!(tmp & BIT(3));
bDrawLast = !!(tmp & BIT(4));
bNoBrightHeadLights = !!(tmp & BIT(5));
bDoNotRender = !!(tmp & BIT(6));
bDistanceFade = !!(tmp & BIT(7));
m_flagE1 = !!(tmp & BIT(8));
m_flagE2 = !!(tmp & BIT(9));
bOffscreen = !!(tmp & BIT(10));
bIsStaticWaitingForCollision = !!(tmp & BIT(11));
m_flagE10 = !!(tmp & BIT(12));
bUnderwater = !!(tmp & BIT(13));
bHasPreRenderEffects = !!(tmp & BIT(14));
}
#endif
bool IsEntityPointerValid(CEntity* pEntity)
{
if (!pEntity)
return false;
switch (pEntity->GetType()) {
case ENTITY_TYPE_NOTHING: return false;
case ENTITY_TYPE_BUILDING: return IsBuildingPointerValid((CBuilding*)pEntity);
case ENTITY_TYPE_VEHICLE: return IsVehiclePointerValid((CVehicle*)pEntity);
case ENTITY_TYPE_PED: return IsPedPointerValid((CPed*)pEntity);
case ENTITY_TYPE_OBJECT: return IsObjectPointerValid((CObject*)pEntity);
case ENTITY_TYPE_DUMMY: return IsDummyPointerValid((CDummy*)pEntity);
}
return false;
}

View file

@ -30,6 +30,7 @@ enum eEntityStatus : uint8
STATUS_PLANE,
STATUS_PLAYER_REMOTE,
STATUS_PLAYER_DISABLED,
STATUS_12, // TODO: what is this? used in CPhysical::ApplyAirResistance
};
class CEntity : public CPlaceable
@ -78,7 +79,7 @@ public:
uint32 bIsSubway : 1; // set when subway, but maybe different meaning?
uint32 bDrawLast : 1; // draw object last
uint32 bNoBrightHeadLights : 1;
uint32 bDoNotRender : 1;
uint32 bDoNotRender : 1; //-- only applies to CObjects apparently
uint32 bDistanceFade : 1; // Fade entity because it is far away
// flagsE
@ -88,7 +89,7 @@ public:
uint32 bIsStaticWaitingForCollision : 1; // this is used by script created entities - they are static until the collision is loaded below them
uint32 m_flagE10 : 1; // probably bDontStream
uint32 bUnderwater : 1; // this object is underwater change drawing order
uint32 m_flagE40 : 1;
uint32 bHasPreRenderEffects : 1; // Object has a prerender effects attached to it
uint16 m_scanCode;
uint16 m_randomSeed;
@ -112,12 +113,12 @@ public:
#endif
CEntity(void);
~CEntity(void);
virtual ~CEntity(void);
virtual void Add(void);
virtual void Remove(void);
virtual void SetModelIndex(uint32 id) { m_modelIndex = id; CreateRwObject(); }
virtual void SetModelIndexNoCreate(uint32 id) { m_modelIndex = id; }
virtual void SetModelIndex(uint32 id);
virtual void SetModelIndexNoCreate(uint32 id);
virtual void CreateRwObject(void);
virtual void DeleteRwObject(void);
virtual CRect GetBoundRect(void);
@ -160,6 +161,7 @@ public:
int16 GetModelIndex(void) const { return m_modelIndex; }
void UpdateRwFrame(void);
void SetupBigBuilding(void);
bool HasPreRenderEffects(void);
void AttachToRwObject(RwObject *obj);
void DetachFromRwObject(void);
@ -180,3 +182,5 @@ public:
static void AddSteamsFromGround(CPtrList& list);
};
bool IsEntityPointerValid(CEntity*);

File diff suppressed because it is too large Load diff

View file

@ -18,8 +18,7 @@ public:
// The not properly indented fields haven't been checked properly yet
int32 m_audioEntityId;
float unk1;
CTreadable *m_treadable[2]; // car and ped
float m_phys_unused1;
uint32 m_nLastTimeCollided;
CVector m_vecMoveSpeed; // velocity
CVector m_vecTurnSpeed; // angular velocity
@ -37,10 +36,9 @@ public:
CEntryInfoList m_entryInfoList;
CPtrNode *m_movingListNode;
char field_EC;
int8 m_phys_unused2;
uint8 m_nStaticFrames;
uint8 m_nCollisionRecords;
bool m_bIsVehicleBeingShifted;
CEntity *m_aCollisionRecords[PHYSICAL_MAX_COLLISIONRECORDS];
float m_fDistanceTravelled;
@ -54,12 +52,17 @@ public:
uint8 bIsHeavy : 1;
uint8 bAffectedByGravity : 1;
uint8 bInfiniteMass : 1;
uint8 m_phy_flagA08 : 1;
uint8 bIsInWater : 1;
uint8 m_phy_flagA10 : 1; // unused
uint8 m_phy_flagA20 : 1; // unused
uint8 bHitByTrain : 1;
uint8 bSkipLineCol : 1;
uint8 bIsFrozen : 1;
uint8 bDontLoadCollision : 1;
uint8 m_bIsVehicleBeingShifted : 1; // wrong name - also used on but never set for peds
uint8 bJustCheckCollision : 1; // just see if there is a collision
uint8 m_nSurfaceTouched;
int8 m_nZoneLevel;
@ -86,7 +89,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 +96,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));
}
@ -156,11 +158,13 @@ public:
void ApplyFrictionTurnForce(const CVector &j, const CVector &p) { ApplyFrictionTurnForce(j.x, j.y, j.z, p.x, p.y, p.z); }
// springRatio: 1.0 fully extended, 0.0 fully compressed
bool ApplySpringCollision(float springConst, CVector &springDir, CVector &point, float springRatio, float bias);
bool ApplySpringCollisionAlt(float springConst, CVector &springDir, CVector &point, float springRatio, float bias, CVector &forceDir);
bool ApplySpringDampening(float damping, CVector &springDir, CVector &point, CVector &speed);
void ApplyGravity(void);
void ApplyFriction(void);
void ApplyAirResistance(void);
bool ApplyCollision(CPhysical *B, CColPoint &colpoint, float &impulseA, float &impulseB);
bool ApplyCollision(CColPoint &colpoint, float &impulse);
bool ApplyCollisionAlt(CEntity *B, CColPoint &colpoint, float &impulse, CVector &moveSpeed, CVector &turnSpeed);
bool ApplyFriction(CPhysical *B, float adhesiveLimit, CColPoint &colpoint);
bool ApplyFriction(float adhesiveLimit, CColPoint &colpoint);

View file

@ -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;

View file

@ -78,7 +78,8 @@ public:
return *this;
}
CVector &GetPosition(void){ return *(CVector*)&m_matrix.pos; }
const CVector &GetPosition(void) const { return *(CVector*)&m_matrix.pos; }
CVector& GetPosition(void) { return *(CVector*)&m_matrix.pos; }
CVector &GetRight(void) { return *(CVector*)&m_matrix.right; }
CVector &GetForward(void) { return *(CVector*)&m_matrix.up; }
CVector &GetUp(void) { return *(CVector*)&m_matrix.at; }

View file

@ -11,9 +11,7 @@ public:
float Magnitude(void) const { return Sqrt(x*x + y*y); }
float MagnitudeSqr(void) const { return x*x + y*y; }
void Normalise(void);
void NormaliseSafe(void) {
void Normalise(void) {
float sq = MagnitudeSqr();
if(sq > 0.0f){
float invsqrt = RecipSqrt(sq);

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