1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-11-05 06:45:56 +00:00

Merge pull request #535 from Nick007J/miami

garages, carctrl, script
This commit is contained in:
aap 2020-05-11 23:28:52 +02:00 committed by GitHub
commit ce2071e1e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 625 additions and 568 deletions

View file

@ -2593,6 +2593,50 @@ float CCarCtrl::FindMaxSteerAngle(CVehicle* pVehicle)
return pVehicle->GetModelIndex() == MI_ENFORCER ? 0.7f : DEFAULT_MAX_STEER_ANGLE;
}
void CCarCtrl::SteerAIHeliTowardsTargetCoors(CAutomobile* pHeli)
{
if (pHeli->m_aWheelSpeed[1] < 0.22f)
pHeli->m_aWheelSpeed[1] += 0.001f;
if (pHeli->m_aWheelSpeed[1] < 0.22f)
return;
CVector2D vecToTarget = pHeli->AutoPilot.m_vecDestinationCoors - pHeli->GetPosition();
float distanceToTarget = vecToTarget.Magnitude();
#ifdef FIX_BUGS
float speed = pHeli->AutoPilot.GetCruiseSpeed() * 0.01f;
#else
float speed = pHeli->AutoPilot.m_nCruiseSpeed * 0.01f;
#endif
if (distanceToTarget >= 100.0f)
{
if (distanceToTarget > 75.0f)
speed *= 0.7f;
else if (distanceToTarget > 10.0f)
speed *= 0.4f;
else
speed *= 0.2f;
}
CVector2D vecAdvanceThisFrame = vecToTarget;
vecAdvanceThisFrame.Normalise();
vecAdvanceThisFrame *= speed;
float resistance = Pow(0.997f, CTimer::GetTimeStep());
pHeli->m_vecMoveSpeed.x *= resistance;
pHeli->m_vecMoveSpeed.y *= resistance;
vecAdvanceThisFrame -= pHeli->m_vecMoveSpeed;
CVector2D vecSpeedChange = vecAdvanceThisFrame - pHeli->m_vecMoveSpeed;
float vecSpeedChangeLength = vecSpeedChange.Magnitude();
vecSpeedChange.Normalise();
float changeMultiplier = 0.002f * CTimer::GetTimeStep();
if (distanceToTarget < 5.0f)
changeMultiplier /= 5.0f;
if (vecSpeedChangeLength < changeMultiplier)
pHeli->AddToMoveSpeed(vecAdvanceThisFrame);
else
pHeli->AddToMoveSpeed(vecSpeedChange * changeMultiplier);
pHeli->SetPosition(pHeli->GetPosition() + CVector(CTimer::GetTimeStep() * pHeli->m_vecMoveSpeed.x, CTimer::GetTimeStep() * pHeli->m_vecMoveSpeed.y, 0.0f));
assert(0);
// This is not finished yet. Heli fields in CAutomobile required
}
void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerve, float* pAccel, float* pBrake, bool* pHandbrake)
{
CVector2D forward = pVehicle->GetForward();
@ -2620,18 +2664,12 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
if (PickNextNodeAccordingStrategy(pVehicle)) {
switch (pVehicle->AutoPilot.m_nCarMission){
case MISSION_GOTOCOORDS:
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTOCOORDS_STRAIGHT;
*pSwerve = 0.0f;
*pAccel = 0.0f;
*pBrake = 0.0f;
*pHandbrake = false;
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, pVehicle->AutoPilot.m_vecDestinationCoors.x,
pVehicle->AutoPilot.m_vecDestinationCoors.y, pSwerve, pAccel, pBrake, pHandbrake);
return;
case MISSION_GOTOCOORDS_ACCURATE:
pVehicle->AutoPilot.m_nCarMission = MISSION_GOTO_COORDS_STRAIGHT_ACCURATE;
*pSwerve = 0.0f;
*pAccel = 0.0f;
*pBrake = 0.0f;
*pHandbrake = false;
SteerAICarWithPhysicsHeadingForTarget(pVehicle, nil, pVehicle->AutoPilot.m_vecDestinationCoors.x,
pVehicle->AutoPilot.m_vecDestinationCoors.y, pSwerve, pAccel, pBrake, pHandbrake);
return;
}
}
@ -2667,6 +2705,7 @@ void CCarCtrl::SteerAICarWithPhysicsFollowPath(CVehicle* pVehicle, float* pSwerv
switch (pVehicle->AutoPilot.m_nDrivingStyle) {
case DRIVINGSTYLE_STOP_FOR_CARS:
case DRIVINGSTYLE_SLOW_DOWN_FOR_CARS:
case DRIVINGSTYLE_STOP_FOR_CARS_IGNORE_LIGHTS:
speedStyleMultiplier = FindMaximumSpeedForThisCarInTraffic(pVehicle) / pVehicle->AutoPilot.m_nCruiseSpeed;
break;
default:
@ -2933,8 +2972,6 @@ bool CCarCtrl::JoinCarWithRoadSystemGotoCoors(CVehicle* pVehicle, CVector vecTar
return false;
}
//TODO
void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
{
if (pVehicle->m_nRouteSeed)
@ -2952,11 +2989,21 @@ void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
curLink = 0;
curConnection = ThePaths.m_carPathConnections[pCurNode->firstLink];
}else{
curConnection = pVehicle->AutoPilot.m_nNextPathNodeInfo;
while (curConnection == pVehicle->AutoPilot.m_nNextPathNodeInfo){
curLink = CGeneral::GetRandomNumber() % pCurNode->numLinks;
curConnection = ThePaths.m_carPathConnections[curLink + pCurNode->firstLink];
int closestLink = -1;
float md = 999999.9f;
for (curLink = 0; curLink < pCurNode->numLinks; curLink++) {
int node = ThePaths.ConnectedNode(curLink + pCurNode->firstLink);
CPathNode* pNode = &ThePaths.m_pathNodes[node];
if (node == pVehicle->AutoPilot.m_nNextRouteNode)
continue;
float dist = CCollision::DistToLine(&pCurNode->GetPosition(), &pNode->GetPosition(), &pVehicle->GetPosition());
if (dist < md) {
md = dist;
closestLink = curLink;
}
}
curConnection = ThePaths.m_carPathConnections[closestLink + pCurNode->firstLink];
}
pVehicle->AutoPilot.m_nCurrentPathNodeInfo = curConnection;
pVehicle->AutoPilot.m_nCurrentDirection = (ThePaths.ConnectedNode(curLink + pCurNode->firstLink) >= pVehicle->AutoPilot.m_nCurrentRouteNode) ? 1 : -1;

File diff suppressed because it is too large Load diff

View file

@ -57,8 +57,9 @@ enum eGarageType : int8
enum
{
TOTAL_COLLECTCARS_GARAGES = GARAGE_COLLECTCARS_3 - GARAGE_COLLECTCARS_1 + 1,
TOTAL_COLLECTCARS_CARS = 16
TOTAL_COLLECTCARS_GARAGES = 4,
TOTAL_HIDEOUT_GARAGES = 12,
TOTAL_COLLECTCARS_CARS = 6
};
class CStoredCar
@ -94,6 +95,7 @@ class CGarage
{
eGarageType m_eGarageType;
eGarageState m_eGarageState;
uint8 m_nMaxStoredCars;
bool field_2; // unused
bool m_bClosingWithoutTargetCar;
bool m_bDeactivated;
@ -108,12 +110,17 @@ class CGarage
bool m_bRecreateDoorOnNextRefresh;
bool m_bRotatedDoor;
bool m_bCameraFollowsPlayer;
float m_fX1;
float m_fX2;
float m_fY1;
float m_fY2;
float m_fZ1;
float m_fZ2;
CVector2D m_vecCorner1;
float m_fInfZ;
CVector2D m_vDir1;
CVector2D m_vDir2;
float m_fSupZ;
float m_fDir1Len;
float m_fDir2Len;
float m_fInfX;
float m_fSupX;
float m_fInfY;
float m_fSupY;
float m_fDoorPos;
float m_fDoorHeight;
float m_fDoor1X;
@ -134,8 +141,8 @@ class CGarage
bool IsClosed() { return m_eGarageState == GS_FULLYCLOSED; }
bool IsUsed() { return m_eGarageType != GARAGE_NONE; }
void Update();
float GetGarageCenterX() { return (m_fX1 + m_fX2) / 2; }
float GetGarageCenterY() { return (m_fY1 + m_fY2) / 2; }
float GetGarageCenterX() { return (m_fInfX + m_fSupX) / 2; }
float GetGarageCenterY() { return (m_fInfY + m_fSupY) / 2; }
bool IsFar()
{
#ifdef FIX_BUGS
@ -153,7 +160,6 @@ class CGarage
void UpdateDoorsHeight();
bool IsEntityEntirelyInside3D(CEntity*, float);
bool IsEntityEntirelyOutside(CEntity*, float);
bool IsEntityEntirelyInside(CEntity*);
float CalcDistToGarageRectangleSquared(float, float);
float CalcSmallestDistToGarageDoorSquared(float, float);
bool IsAnyOtherCarTouchingGarage(CVehicle* pException);
@ -178,17 +184,22 @@ class CGarage
void FindDoorsEntitiesSectorList(CPtrList&, bool);
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 cAudioManager;
friend class CCamera;
};
VALIDATE_SIZE(CGarage, 140);
class CGarages
{
enum {
MESSAGE_LENGTH = 8
MESSAGE_LENGTH = 8,
MAX_NUM_CARS_IN_HIDEOUT_GARAGE = 4
};
static int32 BankVansCollected;
static bool BombsAreFree;
@ -206,9 +217,7 @@ class CGarages
static bool PlayerInGarage;
static int32 PoliceCarsCollected;
static CGarage aGarages[NUM_GARAGES];
static CStoredCar aCarsInSafeHouse1[NUM_GARAGE_STORED_CARS];
static CStoredCar aCarsInSafeHouse2[NUM_GARAGE_STORED_CARS];
static CStoredCar aCarsInSafeHouse3[NUM_GARAGE_STORED_CARS];
static CStoredCar aCarsInSafeHouses[TOTAL_HIDEOUT_GARAGES][MAX_NUM_CARS_IN_HIDEOUT_GARAGE];
static int32 AudioEntity;
static bool bCamShouldBeOutisde;
@ -251,15 +260,45 @@ public:
static bool IsModelIndexADoor(uint32 id);
static void SetFreeBombs(bool bValue) { BombsAreFree = bValue; }
static void SetFreeResprays(bool bValue) { RespraysAreFree = bValue; }
static void SetMaxNumStoredCarsForGarage(int16 garage, uint8 num) { aGarages[garage].m_nMaxStoredCars = num; }
private:
static bool IsCarSprayable(CVehicle*);
static float FindDoorHeightForMI(int32);
static void CloseHideOutGaragesBeforeSave(void);
static int32 CountCarsInHideoutGarage(eGarageType);
static int32 FindMaxNumStoredCarsForGarage(eGarageType);
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 CGarage;

View file

@ -9746,8 +9746,21 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
case COMMAND_IS_CHAR_IN_ANY_PLANE:
case COMMAND_IS_PLAYER_IN_ANY_PLANE:
case COMMAND_IS_CHAR_IN_WATER:
assert(0);
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:
{
int32* ptr = GetPointerToScriptVariable(&m_nIp, VAR_LOCAL);
CollectParameters(&m_nIp, 1);
*ptr = ScriptParams[0];
return 0;
}
default:
assert(0);
}
@ -9802,7 +9815,20 @@ int8 CRunningScript::ProcessCommands1200To1299(int32 command)
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:
assert(0);
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_SET_HELI_ORIENTATION:
case COMMAND_CLEAR_HELI_ORIENTATION:
@ -10026,7 +10052,11 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
switch (command) {
case COMMAND_REGISTER_VIGILANTE_LEVEL:
case COMMAND_CLEAR_ALL_CHAR_ANIMS:
assert(0);
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_SET_ALLOW_HURRICANES:
case COMMAND_PLAY_ANNOUNCEMENT:

View file

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

View file

@ -527,21 +527,24 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else {
#ifdef TRIANGULAR_BLIPS
const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
else mode = BLIP_MODE_SQUARE;
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
}
ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
else {
#ifdef TRIANGULAR_BLIPS
const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector& blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
else mode = BLIP_MODE_SQUARE;
}
ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
#else
ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
#endif
}
}
}
}
@ -566,21 +569,24 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
} else {
#ifdef TRIANGULAR_BLIPS
const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
else mode = BLIP_MODE_SQUARE;
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE) {
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
}
ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
else {
#ifdef TRIANGULAR_BLIPS
const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector& blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
else mode = BLIP_MODE_SQUARE;
}
ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
#else
ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
#endif
}
}
}
}
@ -632,23 +638,25 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, blipEntity->GetPosition());
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else
#ifdef TRIANGULAR_BLIPS
{
const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
else mode = BLIP_MODE_SQUARE;
{
const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector& blipPos = blipEntity->GetPosition();
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
else mode = BLIP_MODE_SQUARE;
}
ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
}
ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
}
#else
ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
#endif
}
}
}
}
@ -681,23 +689,25 @@ void CRadar::DrawBlips()
TransformRealWorldPointToRadarSpace(in, ms_RadarTrace[blipId].m_vec2DPos);
float dist = LimitRadarPoint(in);
TransformRadarPointToScreenSpace(out, in);
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else
if (!ms_RadarTrace[blipId].m_bShortRange || dist <= 1.0f || CMenuManager::bMenuMapActive) {
if (ms_RadarTrace[blipId].m_eRadarSprite != RADAR_SPRITE_NONE)
DrawRadarSprite(ms_RadarTrace[blipId].m_eRadarSprite, out.x, out.y, CalculateBlipAlpha(dist));
else
#ifdef TRIANGULAR_BLIPS
{
const CVector &pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector &blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
else mode = BLIP_MODE_SQUARE;
{
const CVector& pos = FindPlayerCentreOfWorld_NoSniperShift();
const CVector& blipPos = ms_RadarTrace[blipId].m_vecPos;
uint8 mode = BLIP_MODE_TRIANGULAR_UP;
if (blipPos.z - pos.z <= 2.0f) {
if (blipPos.z - pos.z < -4.0f) mode = BLIP_MODE_TRIANGULAR_DOWN;
else mode = BLIP_MODE_SQUARE;
}
ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
}
ShowRadarTraceWithHeight(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255, mode);
}
#else
ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
ShowRadarTrace(out.x, out.y, ms_RadarTrace[blipId].m_wScale, (uint8)(color >> 24), (uint8)(color >> 16), (uint8)(color >> 8), 255);
#endif
}
}
}
break;
@ -992,6 +1002,7 @@ CRadar::Initialise()
ms_RadarTrace[i].m_BlipIndex = 1;
SetRadarMarkerState(i, false);
ms_RadarTrace[i].m_bInUse = false;
ms_RadarTrace[i].m_bShortRange = false;
ms_RadarTrace[i].m_eBlipType = BLIP_NONE;
ms_RadarTrace[i].m_eBlipDisplay = BLIP_DISPLAY_NEITHER;
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_nColor = color;
ms_RadarTrace[nextBlip].m_bDim = 1;
ms_RadarTrace[nextBlip].m_bInUse = 1;
ms_RadarTrace[nextBlip].m_bDim = true;
ms_RadarTrace[nextBlip].m_bInUse = true;
ms_RadarTrace[nextBlip].m_bShortRange = false;
ms_RadarTrace[nextBlip].m_Radius = 1.0f;
ms_RadarTrace[nextBlip].m_vec2DPos = 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);
}
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 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_nColor = color;
ms_RadarTrace[nextBlip].m_bDim = 1;
ms_RadarTrace[nextBlip].m_bInUse = 1;
ms_RadarTrace[nextBlip].m_bDim = true;
ms_RadarTrace[nextBlip].m_bInUse = true;
ms_RadarTrace[nextBlip].m_bShortRange = false;
ms_RadarTrace[nextBlip].m_Radius = 1.0f;
ms_RadarTrace[nextBlip].m_nEntityHandle = handle;
ms_RadarTrace[nextBlip].m_wScale = 1;

View file

@ -66,12 +66,12 @@ struct sRadarTrace
uint16 m_BlipIndex;
bool m_bDim;
bool m_bInUse;
bool m_bShortRange;
float m_Radius;
int16 m_wScale;
uint16 m_eBlipDisplay; // eBlipDisplay
uint16 m_eRadarSprite; // eRadarSprite
};
VALIDATE_SIZE(sRadarTrace, 0x30);
// Values for screen space
#define RADAR_LEFT (40.0f)
@ -149,6 +149,7 @@ public:
static void SetBlipSprite(int32 i, int32 icon);
static int32 SetCoordBlip(eBlipType type, CVector pos, 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 ShowRadarMarker(CVector pos, uint32 color, float radius);
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::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
int32 CStats::Sprayings;
float CStats::AutoPaintingBudget;
void CStats::Init()
{
PeopleKilledByOthers = 0;
@ -113,6 +116,9 @@ void CStats::Init()
IndustrialPassed = 0;
CommercialPassed = 0;
SuburbanPassed = 0;
Sprayings = 0;
AutoPaintingBudget = 0.0f;
}
void CStats::RegisterFastestTime(int32 index, int32 time)

View file

@ -62,6 +62,8 @@ public:
static int32 CarsCrushed;
static int32 FastestTimes[TOTAL_FASTEST_TIMES];
static int32 HighestScores[TOTAL_HIGHEST_SCORES];
static int32 Sprayings;
static float AutoPaintingBudget;
public:
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 Update();
void Suspend();
bool IsIgnored(void) { return m_bIgnoredByCops || m_bIgnoredByEveryone; }
static int32 WorkOutPolicePresence(CVector posn, float radius);

View file

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

View file

@ -117,6 +117,17 @@ public:
void SetMoveSpeed(const CVector& 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; }
void SetTurnSpeed(float x, float y, float z) {
m_vecTurnSpeed.x = x;

View file

@ -84,7 +84,6 @@ public:
float m_aWheelPosition[4];
float m_aWheelSpeed[4];
uint8 field_4D8;
uint8 m_bombType : 3;
uint8 bTaxiLight : 1;
uint8 bHadDriver : 1; // for bombs
uint8 bFixedColour : 1;
@ -92,7 +91,6 @@ public:
uint8 bWaterTight : 1; // no damage for non-player peds
uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1;
CEntity *m_pBombRigger;
int16 field_4E0;
uint16 m_hydraulicState;
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 bParking : 1;
uint8 m_bombType : 3;
int8 m_numPedsUseItAsCover;
uint8 m_nAmmoInClip; // Used to make the guns on boat do a reload (20 by default)
int8 m_nPacManPickupsCarried;
@ -195,6 +197,7 @@ public:
float m_fHealth; // 1000.0f = full health. 250.0f = fire. 0 -> explode
uint8 m_nCurrentGear;
float m_fChangeGearTime;
CEntity* m_pBombRigger;
uint32 m_nGunFiringTime; // last time when gun on vehicle was fired (used on boats)
uint32 m_nTimeOfDeath;
uint16 m_nTimeBlocked;