1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-24 02:20:01 +00:00

garages + script

This commit is contained in:
Nikolay Korolev 2020-05-11 21:04:35 +03:00
parent 2f085ea5f5
commit 8fae2dcc26
15 changed files with 537 additions and 552 deletions

View file

@ -2628,14 +2628,10 @@ void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
float changeMultiplier = 0.002f * CTimer::GetTimeStep(); float changeMultiplier = 0.002f * CTimer::GetTimeStep();
if (distanceToTarget < 5.0f) if (distanceToTarget < 5.0f)
changeMultiplier /= 5.0f; changeMultiplier /= 5.0f;
if (vecSpeedChangeLength < changeMultiplier) { if (vecSpeedChangeLength < changeMultiplier)
pHeli->m_vecMoveSpeed.x = vecAdvanceThisFrame.x; pHeli->AddToMoveSpeed(vecAdvanceThisFrame);
pHeli->m_vecMoveSpeed.y = vecAdvanceThisFrame.y; else
} pHeli->AddToMoveSpeed(vecSpeedChange * changeMultiplier);
else {
pHeli->m_vecMoveSpeed.x += vecSpeedChange.x * changeMultiplier;
pHeli->m_vecMoveSpeed.y += vecSpeedChange.y * changeMultiplier;
}
pHeli->SetPosition(pHeli->GetPosition() + CVector(CTimer::GetTimeStep() * pHeli->m_vecMoveSpeed.x, CTimer::GetTimeStep() * pHeli->m_vecMoveSpeed.y, 0.0f)); pHeli->SetPosition(pHeli->GetPosition() + CVector(CTimer::GetTimeStep() * pHeli->m_vecMoveSpeed.x, CTimer::GetTimeStep() * pHeli->m_vecMoveSpeed.y, 0.0f));
assert(0); assert(0);
// This is not finished yet. Heli fields in CAutomobile required // This is not finished yet. Heli fields in CAutomobile required

File diff suppressed because it is too large Load diff

View file

@ -57,8 +57,9 @@ enum eGarageType : int8
enum enum
{ {
TOTAL_COLLECTCARS_GARAGES = GARAGE_COLLECTCARS_3 - GARAGE_COLLECTCARS_1 + 1, TOTAL_COLLECTCARS_GARAGES = 4,
TOTAL_COLLECTCARS_CARS = 16 TOTAL_HIDEOUT_GARAGES = 12,
TOTAL_COLLECTCARS_CARS = 6
}; };
class CStoredCar class CStoredCar
@ -109,7 +110,8 @@ class CGarage
bool m_bRecreateDoorOnNextRefresh; bool m_bRecreateDoorOnNextRefresh;
bool m_bRotatedDoor; bool m_bRotatedDoor;
bool m_bCameraFollowsPlayer; bool m_bCameraFollowsPlayer;
CVector m_vecCorner1; CVector2D m_vecCorner1;
float m_fInfZ;
CVector2D m_vDir1; CVector2D m_vDir1;
CVector2D m_vDir2; CVector2D m_vDir2;
float m_fSupZ; float m_fSupZ;
@ -139,8 +141,8 @@ class CGarage
bool IsClosed() { return m_eGarageState == GS_FULLYCLOSED; } bool IsClosed() { return m_eGarageState == GS_FULLYCLOSED; }
bool IsUsed() { return m_eGarageType != GARAGE_NONE; } bool IsUsed() { return m_eGarageType != GARAGE_NONE; }
void Update(); void Update();
float GetGarageCenterX() { return (m_fX1 + m_fX2) / 2; } float GetGarageCenterX() { return (m_fInfX + m_fSupX) / 2; }
float GetGarageCenterY() { return (m_fY1 + m_fY2) / 2; } float GetGarageCenterY() { return (m_fInfY + m_fSupY) / 2; }
bool IsFar() bool IsFar()
{ {
#ifdef FIX_BUGS #ifdef FIX_BUGS
@ -158,7 +160,6 @@ class CGarage
void UpdateDoorsHeight(); void UpdateDoorsHeight();
bool IsEntityEntirelyInside3D(CEntity*, float); bool IsEntityEntirelyInside3D(CEntity*, float);
bool IsEntityEntirelyOutside(CEntity*, float); bool IsEntityEntirelyOutside(CEntity*, float);
bool IsEntityEntirelyInside(CEntity*);
float CalcDistToGarageRectangleSquared(float, float); float CalcDistToGarageRectangleSquared(float, float);
float CalcSmallestDistToGarageDoorSquared(float, float); float CalcSmallestDistToGarageDoorSquared(float, float);
bool IsAnyOtherCarTouchingGarage(CVehicle* pException); bool IsAnyOtherCarTouchingGarage(CVehicle* pException);
@ -183,6 +184,12 @@ class CGarage
void FindDoorsEntitiesSectorList(CPtrList&, bool); void FindDoorsEntitiesSectorList(CPtrList&, bool);
void PlayerArrestedOrDied(); void PlayerArrestedOrDied();
bool IsPointInsideGarage(CVector);
bool IsPointInsideGarage(CVector, float);
void ThrowCarsNearDoorOutOfGarage(CVehicle*);
int32 FindMaxNumStoredCarsForGarage() { return Max(NUM_GARAGE_STORED_CARS, m_nMaxStoredCars); }
friend class CGarages; friend class CGarages;
friend class cAudioManager; friend class cAudioManager;
friend class CCamera; friend class CCamera;
@ -191,7 +198,8 @@ class CGarage
class CGarages class CGarages
{ {
enum { enum {
MESSAGE_LENGTH = 8 MESSAGE_LENGTH = 8,
MAX_NUM_CARS_IN_HIDEOUT_GARAGE = 4
}; };
static int32 BankVansCollected; static int32 BankVansCollected;
static bool BombsAreFree; static bool BombsAreFree;
@ -209,9 +217,7 @@ class CGarages
static bool PlayerInGarage; static bool PlayerInGarage;
static int32 PoliceCarsCollected; static int32 PoliceCarsCollected;
static CGarage aGarages[NUM_GARAGES]; static CGarage aGarages[NUM_GARAGES];
static CStoredCar aCarsInSafeHouse1[NUM_GARAGE_STORED_CARS]; static CStoredCar aCarsInSafeHouses[TOTAL_HIDEOUT_GARAGES][MAX_NUM_CARS_IN_HIDEOUT_GARAGE];
static CStoredCar aCarsInSafeHouse2[NUM_GARAGE_STORED_CARS];
static CStoredCar aCarsInSafeHouse3[NUM_GARAGE_STORED_CARS];
static int32 AudioEntity; static int32 AudioEntity;
static bool bCamShouldBeOutisde; static bool bCamShouldBeOutisde;
@ -254,15 +260,45 @@ public:
static bool IsModelIndexADoor(uint32 id); static bool IsModelIndexADoor(uint32 id);
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; } static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; } static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
static void SetMaxNumStoredCarsForGarage(int16 garage, uint8 num) { aGarages[garage].m_nMaxStoredCars = num; }
private: private:
static bool IsCarSprayable(CVehicle*); static bool IsCarSprayable(CVehicle*);
static float FindDoorHeightForMI(int32); static float FindDoorHeightForMI(int32);
static void CloseHideOutGaragesBeforeSave(void); static void CloseHideOutGaragesBeforeSave(void);
static int32 CountCarsInHideoutGarage(eGarageType); static int32 CountCarsInHideoutGarage(eGarageType);
static int32 FindMaxNumStoredCarsForGarage(eGarageType);
static int32 GetBombTypeForGarageType(eGarageType type) { return type - GARAGE_BOMBSHOP1 + 1; } static int32 GetBombTypeForGarageType(eGarageType type) { return type - GARAGE_BOMBSHOP1 + 1; }
static int32 GetCarsCollectedIndexForGarageType(eGarageType type) { return type - GARAGE_COLLECTCARS_1; } static int32 GetCarsCollectedIndexForGarageType(eGarageType type)
{
switch (type) {
case GARAGE_COLLECTCARS_1: return 0;
case GARAGE_COLLECTCARS_2: return 1;
case GARAGE_COLLECTCARS_3: return 2;
case GARAGE_COLLECTCARS_4: return 3;
default: assert(0);
}
return 0;
}
static int32 FindSafeHouseIndexForGarageType(eGarageType type)
{
switch (type) {
case GARAGE_HIDEOUT_ONE: return 0;
case GARAGE_HIDEOUT_TWO: return 1;
case GARAGE_HIDEOUT_THREE: return 2;
case GARAGE_HIDEOUT_FOUR: return 3;
case GARAGE_HIDEOUT_FIVE: return 4;
case GARAGE_HIDEOUT_SIX: return 5;
case GARAGE_HIDEOUT_SEVEN: return 6;
case GARAGE_HIDEOUT_EIGHT: return 7;
case GARAGE_HIDEOUT_NINE: return 8;
case GARAGE_HIDEOUT_TEN: return 9;
case GARAGE_HIDEOUT_ELEVEN: return 10;
case GARAGE_HIDEOUT_TWELVE: return 11;
default: assert(0);
}
return -1;
}
static bool IsThisGarageTypeSafehouse(eGarageType type) { return FindSafeHouseIndexForGarageType(type) >= 0; }
friend class cAudioManager; friend class cAudioManager;
friend class CGarage; friend class CGarage;

View file

@ -9746,8 +9746,21 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
case COMMAND_IS_CHAR_IN_ANY_PLANE: case COMMAND_IS_CHAR_IN_ANY_PLANE:
case COMMAND_IS_PLAYER_IN_ANY_PLANE: case COMMAND_IS_PLAYER_IN_ANY_PLANE:
case COMMAND_IS_CHAR_IN_WATER: case COMMAND_IS_CHAR_IN_WATER:
assert(0);
case COMMAND_SET_VAR_INT_TO_CONSTANT: case COMMAND_SET_VAR_INT_TO_CONSTANT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_GLOBAL);
CollectParameters(&m_nIp, 1);
*ptr = ScriptParams[0];
return 0;
}
case COMMAND_SET_LVAR_INT_TO_CONSTANT: case COMMAND_SET_LVAR_INT_TO_CONSTANT:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
*ptr = ScriptParams[0];
return 0;
}
default: default:
assert(0); assert(0);
} }
@ -9802,7 +9815,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
case COMMAND_GET_NUMBER_OF_SONY_CDS_READ: case COMMAND_GET_NUMBER_OF_SONY_CDS_READ:
case COMMAND_ADD_SHORT_RANGE_BLIP_FOR_COORD_OLD: case COMMAND_ADD_SHORT_RANGE_BLIP_FOR_COORD_OLD:
case COMMAND_ADD_SHORT_RANGE_BLIP_FOR_COORD: case COMMAND_ADD_SHORT_RANGE_BLIP_FOR_COORD:
assert(0);
case COMMAND_ADD_SHORT_RANGE_SPRITE_BLIP_FOR_COORD: case COMMAND_ADD_SHORT_RANGE_SPRITE_BLIP_FOR_COORD:
{
CollectParameters(&m_nIp, 4);
CVector pos = *(CVector*)&ScriptParams[0];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
CRadar::GetActualBlipArrayIndex(CollectNextParameterWithoutIncreasingPC(m_nIp));
int id = CRadar::SetShortRangeCoordBlip(BLIP_COORD, pos, 5, BLIP_DISPLAY_BOTH);
CRadar::SetBlipSprite(id, ScriptParams[3]);
ScriptParams[0] = id;
StoreParameters(&m_nIp, 1);
return 0;
}
case COMMAND_ADD_MONEY_SPENT_ON_CLOTHES: case COMMAND_ADD_MONEY_SPENT_ON_CLOTHES:
case COMMAND_SET_HELI_ORIENTATION: case COMMAND_SET_HELI_ORIENTATION:
case COMMAND_CLEAR_HELI_ORIENTATION: case COMMAND_CLEAR_HELI_ORIENTATION:
@ -10026,7 +10052,11 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
switch (command) { switch (command) {
case COMMAND_REGISTER_VIGILANTE_LEVEL: case COMMAND_REGISTER_VIGILANTE_LEVEL:
case COMMAND_CLEAR_ALL_CHAR_ANIMS: case COMMAND_CLEAR_ALL_CHAR_ANIMS:
assert(0);
case COMMAND_SET_MAXIMUM_NUMBER_OF_CARS_IN_GARAGE: case COMMAND_SET_MAXIMUM_NUMBER_OF_CARS_IN_GARAGE:
CollectParameters(&m_nIp, 2);
CGarages::SetMaxNumStoredCarsForGarage(ScriptParams[0], ScriptParams[1]);
break;
case COMMAND_WANTED_STARS_ARE_FLASHING: case COMMAND_WANTED_STARS_ARE_FLASHING:
case COMMAND_SET_ALLOW_HURRICANES: case COMMAND_SET_ALLOW_HURRICANES:
case COMMAND_PLAY_ANNOUNCEMENT: case COMMAND_PLAY_ANNOUNCEMENT:

View file

@ -696,8 +696,8 @@ CCamera::CamControl(void)
garageDoorPos2.z = 0.0f; garageDoorPos2.z = 0.0f;
#endif #endif
} }
garageCenter.x = (pToGarageWeAreIn->m_fX1 + pToGarageWeAreIn->m_fX2)/2.0f; garageCenter.x = pToGarageWeAreIn->GetGarageCenterX();
garageCenter.y = (pToGarageWeAreIn->m_fY1 + pToGarageWeAreIn->m_fY2)/2.0f; garageCenter.y = pToGarageWeAreIn->GetGarageCenterY();
garageCenter.z = 0.0f; garageCenter.z = 0.0f;
if(whichDoor == 1) if(whichDoor == 1)
garageCenterToDoor = garageDoorPos1 - garageCenter; garageCenterToDoor = garageDoorPos1 - garageCenter;
@ -979,8 +979,8 @@ CCamera::CamControl(void)
} }
if(pToGarageWeAreIn){ if(pToGarageWeAreIn){
garageCenter.x = (pToGarageWeAreIn->m_fX1 + pToGarageWeAreIn->m_fX2)/2.0f; garageCenter.x = pToGarageWeAreIn->GetGarageCenterX();
garageCenter.y = (pToGarageWeAreIn->m_fY1 + pToGarageWeAreIn->m_fY2)/2.0f; garageCenter.y = pToGarageWeAreIn->GetGarageCenterY();
garageCenter.z = 0.0f; garageCenter.z = 0.0f;
}else{ }else{
garageDoorPos1.z = 0.0f; garageDoorPos1.z = 0.0f;
@ -1013,8 +1013,8 @@ CCamera::CamControl(void)
if(PedZoomIndicator == CAM_ZOOM_TOPDOWN && !stairs){ if(PedZoomIndicator == CAM_ZOOM_TOPDOWN && !stairs){
garageCamPos = garageCenter; garageCamPos = garageCenter;
garageCamPos.z += FindPlayerPed()->GetPosition().z + 2.1f; garageCamPos.z += FindPlayerPed()->GetPosition().z + 2.1f;
if(pToGarageWeAreIn && garageCamPos.z > pToGarageWeAreIn->m_fX2) // What? if(pToGarageWeAreIn && garageCamPos.z > pToGarageWeAreIn->m_fSupX) // What?
garageCamPos.z = pToGarageWeAreIn->m_fX2; garageCamPos.z = pToGarageWeAreIn->m_fSupX;
}else }else
garageCamPos.z = ground + 3.1f; garageCamPos.z = ground + 3.1f;
SetCamPositionForFixedMode(garageCamPos, CVector(0.0f, 0.0f, 0.0f)); SetCamPositionForFixedMode(garageCamPos, CVector(0.0f, 0.0f, 0.0f));

View file

@ -527,12 +527,14 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition()); TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in); float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) { if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else { }
else {
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = blipEntity->GetPosition(); const CVector& blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP; uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) { if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN; if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
@ -546,6 +548,7 @@ void CRadar::DrawBlips()
} }
} }
} }
}
break; break;
case BLIP_COORD: case BLIP_COORD:
case BLIP_CONTACT_POINT: case BLIP_CONTACT_POINT:
@ -566,12 +569,14 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos); TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in); float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) { if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else { }
else {
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos; const CVector& blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP; uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) { if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN; if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
@ -584,6 +589,7 @@ void CRadar::DrawBlips()
} }
} }
} }
}
break; break;
default: default:
break; break;
@ -632,13 +638,14 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition()); TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in); float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else else
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
{ {
const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = blipEntity->GetPosition(); const CVector& blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP; uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) { if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN; if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
@ -652,6 +659,7 @@ void CRadar::DrawBlips()
} }
} }
} }
}
break; break;
default: default:
break; break;
@ -681,13 +689,14 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos); TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in); float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in); TransformRadarPointToScreenSpace(out, in);
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist)); DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else else
#ifdef TRIANGULAR_BLIPS #ifdef TRIANGULAR_BLIPS
{ {
const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift(); const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos; const CVector& blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP; uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) { if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN; if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
@ -700,6 +709,7 @@ void CRadar::DrawBlips()
#endif #endif
} }
} }
}
break; break;
default: default:
break; break;
@ -992,6 +1002,7 @@ CRadar::Initialise()
ms_RadarTrace[i].m_BlipIndex = 1; ms_RadarTrace[i].m_BlipIndex = 1;
SetRadarMarkerState(i, false); SetRadarMarkerState(i, false);
ms_RadarTrace[i].m_bInUse = false; ms_RadarTrace[i].m_bInUse = false;
ms_RadarTrace[i].m_bShortRange = false;
ms_RadarTrace[i].m_eBlipType = BLIP_NONE; ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER; ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE; ms_RadarTrace[i].m_eRadarSprite = RADAR_SPRITE_NONE;
@ -1102,8 +1113,9 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
} }
ms_RadarTrace[nextBlip].m_eBlipType = type; ms_RadarTrace[nextBlip].m_eBlipType = type;
ms_RadarTrace[nextBlip].m_nColor = color; ms_RadarTrace[nextBlip].m_nColor = color;
ms_RadarTrace[nextBlip].m_bDim = 1; ms_RadarTrace[nextBlip].m_bDim = true;
ms_RadarTrace[nextBlip].m_bInUse = 1; ms_RadarTrace[nextBlip].m_bInUse = true;
ms_RadarTrace[nextBlip].m_bShortRange = false;
ms_RadarTrace[nextBlip].m_Radius = 1.0f; ms_RadarTrace[nextBlip].m_Radius = 1.0f;
ms_RadarTrace[nextBlip].m_vec2DPos = pos; ms_RadarTrace[nextBlip].m_vec2DPos = pos;
ms_RadarTrace[nextBlip].m_vecPos = pos; ms_RadarTrace[nextBlip].m_vecPos = pos;
@ -1114,6 +1126,15 @@ int CRadar::SetCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay
return CRadar::GetNewUniqueBlipIndex(nextBlip); return CRadar::GetNewUniqueBlipIndex(nextBlip);
} }
int CRadar::SetShortRangeCoordBlip(eBlipType type, CVector pos, int32 color, eBlipDisplay display)
{
int index = SetCoordBlip(type, pos, color, display);
if (index == -1)
return -1;
ms_RadarTrace[GetActualBlipArrayIndex(index)].m_bShortRange = true;
return index;
}
int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDisplay display) int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDisplay display)
{ {
int nextBlip; int nextBlip;
@ -1123,8 +1144,9 @@ int CRadar::SetEntityBlip(eBlipType type, int32 handle, int32 color, eBlipDispla
} }
ms_RadarTrace[nextBlip].m_eBlipType = type; ms_RadarTrace[nextBlip].m_eBlipType = type;
ms_RadarTrace[nextBlip].m_nColor = color; ms_RadarTrace[nextBlip].m_nColor = color;
ms_RadarTrace[nextBlip].m_bDim = 1; ms_RadarTrace[nextBlip].m_bDim = true;
ms_RadarTrace[nextBlip].m_bInUse = 1; ms_RadarTrace[nextBlip].m_bInUse = true;
ms_RadarTrace[nextBlip].m_bShortRange = false;
ms_RadarTrace[nextBlip].m_Radius = 1.0f; ms_RadarTrace[nextBlip].m_Radius = 1.0f;
ms_RadarTrace[nextBlip].m_nEntityHandle = handle; ms_RadarTrace[nextBlip].m_nEntityHandle = handle;
ms_RadarTrace[nextBlip].m_wScale = 1; ms_RadarTrace[nextBlip].m_wScale = 1;

View file

@ -66,12 +66,12 @@ struct sRadarTrace
uint16 m_BlipIndex; uint16 m_BlipIndex;
bool m_bDim; bool m_bDim;
bool m_bInUse; bool m_bInUse;
bool m_bShortRange;
float m_Radius; float m_Radius;
int16 m_wScale; int16 m_wScale;
uint16 m_eBlipDisplay; // eBlipDisplay uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite uint16 m_eRadarSprite; // eRadarSprite
}; };
static_assert(sizeof(sRadarTrace) == 0x30, "sRadarTrace: error");
// Values for screen space // Values for screen space
#define RADAR_LEFT (40.0f) #define RADAR_LEFT (40.0f)
@ -149,6 +149,7 @@ public:
static void SetBlipSprite(int32 i, int32 icon); static void SetBlipSprite(int32 i, int32 icon);
static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay); static int32 SetCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
static int32 SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay); static int32 SetEntityBlip(eBlipType type, int32, int32, eBlipDisplay);
static int32 SetShortRangeCoordBlip(eBlipType type, CVector pos, int32, eBlipDisplay);
static void SetRadarMarkerState(int32 i, bool flag); static void SetRadarMarkerState(int32 i, bool flag);
static void ShowRadarMarker(CVector pos, uint32 color, float radius); static void ShowRadarMarker(CVector pos, uint32 color, float radius);
static void ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha); static void ShowRadarTrace(float x, float y, uint32 size, uint8 red, uint8 green, uint8 blue, uint8 alpha);

View file

@ -58,6 +58,9 @@ int32 CStats::CarsCrushed;
int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES]; int32 CStats::FastestTimes[CStats::TOTAL_FASTEST_TIMES];
int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES]; int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
int32 CStats::Sprayings;
float CStats::AutoPaintingBudget;
void CStats::Init() void CStats::Init()
{ {
PeopleKilledByOthers = 0; PeopleKilledByOthers = 0;
@ -113,6 +116,9 @@ void CStats::Init()
IndustrialPassed = 0; IndustrialPassed = 0;
CommercialPassed = 0; CommercialPassed = 0;
SuburbanPassed = 0; SuburbanPassed = 0;
Sprayings = 0;
AutoPaintingBudget = 0.0f;
} }
void CStats::RegisterFastestTime(int32 index, int32 time) void CStats::RegisterFastestTime(int32 index, int32 time)

View file

@ -62,6 +62,8 @@ public:
static int32 CarsCrushed; static int32 CarsCrushed;
static int32 FastestTimes[TOTAL_FASTEST_TIMES]; static int32 FastestTimes[TOTAL_FASTEST_TIMES];
static int32 HighestScores[TOTAL_HIGHEST_SCORES]; static int32 HighestScores[TOTAL_HIGHEST_SCORES];
static int32 Sprayings;
static float AutoPaintingBudget;
public: public:
static void Init(void); static void Init(void);

View file

@ -462,3 +462,10 @@ CWanted::UpdateCrimesQ(void)
} }
} }
} }
void
CWanted::Suspend(void)
{
// TODO(MIAMI)!
Reset(); // <- temporary
}

View file

@ -49,6 +49,8 @@ public:
void UpdateCrimesQ(); void UpdateCrimesQ();
void Update(); void Update();
void Suspend();
bool IsIgnored(void) { return m_bIgnoredByCops || m_bIgnoredByEveryone; } bool IsIgnored(void) { return m_bIgnoredByCops || m_bIgnoredByEveryone; }
static int32 WorkOutPolicePresence(CVector posn, float radius); static int32 WorkOutPolicePresence(CVector posn, float radius);

View file

@ -128,7 +128,7 @@ enum Config {
NUM_AUDIO_REFLECTIONS = 5, NUM_AUDIO_REFLECTIONS = 5,
NUM_SCRIPT_MAX_ENTITIES = 40, NUM_SCRIPT_MAX_ENTITIES = 40,
NUM_GARAGE_STORED_CARS = 6, NUM_GARAGE_STORED_CARS = 4,
NUM_CRANES = 8, NUM_CRANES = 8,

View file

@ -117,6 +117,17 @@ public:
void SetMoveSpeed(const CVector& speed) { void SetMoveSpeed(const CVector& speed) {
m_vecMoveSpeed = speed; m_vecMoveSpeed = speed;
} }
void AddToMoveSpeed(float x, float y, float z) {
m_vecMoveSpeed.x += x;
m_vecMoveSpeed.y += y;
m_vecMoveSpeed.z += z;
}
void AddToMoveSpeed(const CVector& addition) {
m_vecMoveSpeed += addition;
}
void AddToMoveSpeed(const CVector2D& addition) {
m_vecMoveSpeed += CVector(addition.x, addition.y, 0.0f);
}
const CVector &GetTurnSpeed() { return m_vecTurnSpeed; } const CVector &GetTurnSpeed() { return m_vecTurnSpeed; }
void SetTurnSpeed(float x, float y, float z) { void SetTurnSpeed(float x, float y, float z) {
m_vecTurnSpeed.x = x; m_vecTurnSpeed.x = x;

View file

@ -84,7 +84,6 @@ public:
float m_aWheelPosition[4]; float m_aWheelPosition[4];
float m_aWheelSpeed[4]; float m_aWheelSpeed[4];
uint8 field_4D8; uint8 field_4D8;
uint8 m_bombType : 3;
uint8 bTaxiLight : 1; uint8 bTaxiLight : 1;
uint8 bHadDriver : 1; // for bombs uint8 bHadDriver : 1; // for bombs
uint8 bFixedColour : 1; uint8 bFixedColour : 1;
@ -92,7 +91,6 @@ public:
uint8 bWaterTight : 1; // no damage for non-player peds uint8 bWaterTight : 1; // no damage for non-player peds
uint8 bNotDamagedUpsideDown : 1; uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1; uint8 bMoreResistantToDamage : 1;
CEntity *m_pBombRigger;
int16 field_4E0; int16 field_4E0;
uint16 m_hydraulicState; uint16 m_hydraulicState;
uint32 m_nBusDoorTimerEnd; uint32 m_nBusDoorTimerEnd;

View file

@ -187,6 +187,8 @@ public:
uint8 bCreatedAsPoliceVehicle : 1;// True if this guy was created as a police vehicle (enforcer, policecar, miamivice car etc) uint8 bCreatedAsPoliceVehicle : 1;// True if this guy was created as a police vehicle (enforcer, policecar, miamivice car etc)
uint8 bParking : 1; uint8 bParking : 1;
uint8 m_bombType : 3;
int8 m_numPedsUseItAsCover; int8 m_numPedsUseItAsCover;
uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default) uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default)
int8 m_nPacManPickupsCarried; int8 m_nPacManPickupsCarried;
@ -195,6 +197,7 @@ public:
float m_fHealth; // 1000.0f = full health. 250.0f = fire. 0 -> explode float m_fHealth; // 1000.0f = full health. 250.0f = fire. 0 -> explode
uint8 m_nCurrentGear; uint8 m_nCurrentGear;
float m_fChangeGearTime; float m_fChangeGearTime;
CEntity* m_pBombRigger;
uint32 m_nGunFiringTime; // last time when gun on vehicle was fired (used on boats) uint32 m_nGunFiringTime; // last time when gun on vehicle was fired (used on boats)
uint32 m_nTimeOfDeath; uint32 m_nTimeOfDeath;
uint16 m_nTimeBlocked; uint16 m_nTimeBlocked;