Merge remote-tracking branch 'origin/master' into miami

# Conflicts:
#	src/audio/AudioLogic.cpp
#	src/control/Garages.cpp
#	src/core/SurfaceTable.cpp
#	src/core/SurfaceTable.h
#	src/core/World.cpp
#	src/core/main.cpp
#	src/modelinfo/PedModelInfo.cpp
#	src/peds/Ped.cpp
#	src/render/Timecycle.cpp
#	src/vehicles/Automobile.cpp
#	src/vehicles/Automobile.h
#	src/vehicles/Heli.cpp
#	src/vehicles/Vehicle.cpp
#	src/weapons/Weapon.cpp
#	src/weapons/WeaponInfo.h
This commit is contained in:
Sergeanur 2020-05-26 17:24:47 +03:00
commit 0ce2af7a0d
13 changed files with 715 additions and 774 deletions

View File

@ -187,8 +187,6 @@ project "reVC"
includedirs { "src/extras" } includedirs { "src/extras" }
includedirs { "eax" } includedirs { "eax" }
includedirs { "eax" }
filter "platforms:*mss" filter "platforms:*mss"
defines { "AUDIO_MSS" } defines { "AUDIO_MSS" }
includedirs { "milessdk/include" } includedirs { "milessdk/include" }

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,8 @@ cAudioManager::cAudioManager()
} }
m_nAudioEntitiesTotal = 0; m_nAudioEntitiesTotal = 0;
m_FrameCounter = 0; m_FrameCounter = 0;
m_bFifthFrameFlag = 0; m_bFifthFrameFlag = false;
m_bTimerJustReset = 0; m_bTimerJustReset = false;
m_nTimer = 0; m_nTimer = 0;
} }

View File

@ -253,7 +253,7 @@ public:
float GetCollisionRatio(float a, float b, float c, float d) const; float GetCollisionRatio(float a, float b, float c, float d) const;
float GetDistanceSquared(const CVector &v) const; float GetDistanceSquared(const CVector &v) const;
int32 GetJumboTaxiFreq() const; int32 GetJumboTaxiFreq() const;
bool GetMissionAudioLoadingStatus() const; uint8 GetMissionAudioLoadingStatus() const;
int8 GetMissionScriptPoliceAudioPlayingStatus() const; int8 GetMissionScriptPoliceAudioPlayingStatus() const;
uint8 GetNum3DProvidersAvailable() const; uint8 GetNum3DProvidersAvailable() const;
int32 GetPedCommentSfx(CPed *ped, int32 sound); int32 GetPedCommentSfx(CPed *ped, int32 sound);

View File

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

View File

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

View File

@ -3,7 +3,7 @@
#include "AudioSamples.h" #include "AudioSamples.h"
#define MAX_VOLUME 127 #define MAX_VOLUME 127
#define MAX_FREQ 22050 #define MAX_FREQ DIGITALRATE
struct tSample { struct tSample {
int32 nOffset; int32 nOffset;

View File

@ -174,10 +174,10 @@ add_providers()
} }
if ( alGetEnumValue("AL_EFFECT_EAXREVERB") != 0 if ( alGetEnumValue("AL_EFFECT_EAXREVERB") != 0
|| pDeviceList->IsExtensionSupported(i, "EAX2.0") || pDeviceList->IsExtensionSupported(i, ADEXT_EAX2)
|| pDeviceList->IsExtensionSupported(i, "EAX3.0") || pDeviceList->IsExtensionSupported(i, ADEXT_EAX3)
|| pDeviceList->IsExtensionSupported(i, "EAX4.0") || pDeviceList->IsExtensionSupported(i, ADEXT_EAX4)
|| pDeviceList->IsExtensionSupported(i, "EAX5.0") ) || pDeviceList->IsExtensionSupported(i, ADEXT_EAX5) )
{ {
if ( n < MAXPROVIDERS ) if ( n < MAXPROVIDERS )
{ {

View File

@ -502,10 +502,6 @@ CCarCtrl::GenerateOneRandomCar()
directionNextLinkY = pNextLink->GetDirY() * pVehicle->AutoPilot.m_nNextDirection; directionNextLinkY = pNextLink->GetDirY() * pVehicle->AutoPilot.m_nNextDirection;
} }
#else #else
float currentPathLinkForwardX = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirX();
float currentPathLinkForwardY = pVehicle->AutoPilot.m_nCurrentDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo].GetDirY();
float nextPathLinkForwardX = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirX();
float nextPathLinkForwardY = pVehicle->AutoPilot.m_nNextDirection * ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo].GetDirY();
CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo]; CCarPathLink* pCurrentLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nCurrentPathNodeInfo];
CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo]; CCarPathLink* pNextLink = &ThePaths.m_carPathLinks[pVehicle->AutoPilot.m_nNextPathNodeInfo];
@ -1900,12 +1896,18 @@ void CCarCtrl::PickNextNodeRandomly(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nNextLane = 0; pVehicle->AutoPilot.m_nNextLane = 0;
#ifdef FIX_BUGS #ifdef FIX_BUGS
CVector positionOnCurrentLinkIncludingLane( CVector positionOnCurrentLinkIncludingLane(
pCurLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardY, pCurLink->GetX() + ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH)
pCurLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX, #ifdef FIX_BUGS
* currentPathLinkForwardY
#endif
,pCurLink->GetY() - ((pVehicle->AutoPilot.m_nCurrentLane + pCurLink->OneWayLaneOffset()) * LANE_WIDTH) * currentPathLinkForwardX,
0.0f); 0.0f);
CVector positionOnNextLinkIncludingLane( CVector positionOnNextLinkIncludingLane(
pNextLink->GetX() + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardY, pNextLink->GetX() + ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH)
pNextLink->GetY() - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX, #ifdef FIX_BUGS
* nextPathLinkForwardY
#endif
,pNextLink->GetY() - ((pVehicle->AutoPilot.m_nNextLane + pNextLink->OneWayLaneOffset()) * LANE_WIDTH) * nextPathLinkForwardX,
0.0f); 0.0f);
#else #else
CVector positionOnCurrentLinkIncludingLane( CVector positionOnCurrentLinkIncludingLane(

View File

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

View File

@ -6320,7 +6320,7 @@ int8 CRunningScript::ProcessCommands700To799(int32 command)
} }
CCranes::ActivateCrane(infX, supX, infY, supY, CCranes::ActivateCrane(infX, supX, infY, supY,
*(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8], *(float*)&ScriptParams[6], *(float*)&ScriptParams[7], *(float*)&ScriptParams[8],
DEGTORAD(*(float*)&ScriptParams[8]), true, false, DEGTORAD(*(float*)&ScriptParams[9]), true, false,
*(float*)&ScriptParams[0], *(float*)&ScriptParams[1]); *(float*)&ScriptParams[0], *(float*)&ScriptParams[1]);
return 0; return 0;
} }

View File

@ -160,6 +160,13 @@ TeleportToWaypoint(void)
} }
#endif #endif
static void
SwitchCarCollision(void)
{
if (FindPlayerVehicle() && FindPlayerVehicle()->IsCar())
FindPlayerVehicle()->bUsesCollision = !FindPlayerVehicle()->bUsesCollision;
}
static int engineStatus; static int engineStatus;
static void static void
SetEngineStatus(void) SetEngineStatus(void)
@ -369,6 +376,7 @@ DebugMenuPopulate(void)
#ifdef MENU_MAP #ifdef MENU_MAP
DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint); DebugMenuAddCmd("Debug", "Teleport to map waypoint", TeleportToWaypoint);
#endif #endif
DebugMenuAddCmd("Debug", "Switch car collision", SwitchCarCollision);
DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil); DebugMenuAddVar("Debug", "Engine Status", &engineStatus, nil, 1, 0, 226, nil);
DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus); DebugMenuAddCmd("Debug", "Set Engine Status", SetEngineStatus);
DebugMenuAddCmd("Debug", "Fix Car", FixCar); DebugMenuAddCmd("Debug", "Fix Car", FixCar);

View File

@ -246,8 +246,11 @@ void CCrane::Update(void)
Abs(m_pVehiclePickedUp->GetMoveSpeed().x) > CAR_MOVING_SPEED_THRESHOLD || Abs(m_pVehiclePickedUp->GetMoveSpeed().x) > CAR_MOVING_SPEED_THRESHOLD ||
Abs(m_pVehiclePickedUp->GetMoveSpeed().y) > CAR_MOVING_SPEED_THRESHOLD || Abs(m_pVehiclePickedUp->GetMoveSpeed().y) > CAR_MOVING_SPEED_THRESHOLD ||
Abs(m_pVehiclePickedUp->GetMoveSpeed().z) > CAR_MOVING_SPEED_THRESHOLD || Abs(m_pVehiclePickedUp->GetMoveSpeed().z) > CAR_MOVING_SPEED_THRESHOLD ||
FindPlayerPed()->GetPedState() == PED_ENTER_CAR && // TODO: fix carjack bug (FindPlayerPed()->GetPedState() == PED_ENTER_CAR
FindPlayerPed()->m_pSeekTarget == m_pVehiclePickedUp) { #ifdef FIX_BUGS
|| FindPlayerPed()->GetPedState() == PED_CARJACK
#endif
) && FindPlayerPed()->m_pSeekTarget == m_pVehiclePickedUp) {
m_pVehiclePickedUp = nil; m_pVehiclePickedUp = nil;
m_nCraneState = IDLE; m_nCraneState = IDLE;
} }
@ -398,7 +401,7 @@ bool CCrane::RotateCarriedCarProperly()
float fDeltaThisFrame = CAR_ROTATION_SPEED * CTimer::GetTimeStep(); float fDeltaThisFrame = CAR_ROTATION_SPEED * CTimer::GetTimeStep();
if (Abs(fAngleDelta) <= fDeltaThisFrame) // no rotation is actually applied? if (Abs(fAngleDelta) <= fDeltaThisFrame) // no rotation is actually applied?
return true; return true;
m_pVehiclePickedUp->GetMatrix().RotateZ(Abs(fDeltaThisFrame)); m_pVehiclePickedUp->GetMatrix().RotateZ(fAngleDelta < 0 ? -fDeltaThisFrame : fDeltaThisFrame);
return false; return false;
} }