Merge pull request #573 from Nick007J/miami

script revision
This commit is contained in:
aap 2020-05-21 10:32:11 +02:00 committed by GitHub
commit bc4d628940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 680 additions and 289 deletions

View File

@ -2995,7 +2995,9 @@ void CCarCtrl::FindLinksToGoWithTheseNodes(CVehicle* pVehicle)
CPathNode* pNode = &ThePaths.m_pathNodes[node]; CPathNode* pNode = &ThePaths.m_pathNodes[node];
if (node == pVehicle->AutoPilot.m_nNextRouteNode) if (node == pVehicle->AutoPilot.m_nNextRouteNode)
continue; 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) { if (dist < md) {
md = dist; md = dist;
closestLink = curLink; closestLink = curLink;

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -15,6 +15,12 @@ class CPlayerInfo;
class CRunningScript; class CRunningScript;
#define KEY_LENGTH_IN_SCRIPT 8 #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 struct intro_script_rectangle
{ {
@ -485,10 +491,11 @@ private:
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; } 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) { switch (pedtype) {
case PEDTYPE_CIVMALE: case PEDTYPE_CIVMALE:
case PEDTYPE_CIVFEMALE: case PEDTYPE_CIVFEMALE:
return civ;
case PEDTYPE_GANG1: case PEDTYPE_GANG1:
case PEDTYPE_GANG2: case PEDTYPE_GANG2:
case PEDTYPE_GANG3: case PEDTYPE_GANG3:
@ -498,13 +505,16 @@ private:
case PEDTYPE_GANG7: case PEDTYPE_GANG7:
case PEDTYPE_GANG8: case PEDTYPE_GANG8:
case PEDTYPE_GANG9: case PEDTYPE_GANG9:
return gang;
case PEDTYPE_CRIMINAL: case PEDTYPE_CRIMINAL:
case PEDTYPE_PROSTITUTE: case PEDTYPE_PROSTITUTE:
return true; return criminal;
default: default:
return false; return false;
} }
} }
bool CheckDamagedWeaponType(int32 type, int32 actual);
static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami); static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
}; };

View File

@ -62,6 +62,7 @@ int32 CStats::Sprayings;
float CStats::AutoPaintingBudget; float CStats::AutoPaintingBudget;
int32 CStats::NoMoreHurricanes; int32 CStats::NoMoreHurricanes;
float CStats::FashionBudget; float CStats::FashionBudget;
int32 CStats::SafeHouseVisits;
void CStats::Init() void CStats::Init()
{ {
@ -122,6 +123,7 @@ void CStats::Init()
Sprayings = 0; Sprayings = 0;
AutoPaintingBudget = 0.0f; AutoPaintingBudget = 0.0f;
NoMoreHurricanes = 0; NoMoreHurricanes = 0;
SafeHouseVisits = 0;
} }
void CStats::RegisterFastestTime(int32 index, int32 time) void CStats::RegisterFastestTime(int32 index, int32 time)

View File

@ -66,6 +66,7 @@ public:
static float AutoPaintingBudget; static float AutoPaintingBudget;
static int32 NoMoreHurricanes; static int32 NoMoreHurricanes;
static float FashionBudget; static float FashionBudget;
static int32 SafeHouseVisits;
public: public:
static void Init(void); static void Init(void);

View File

@ -602,6 +602,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bTurnedAroundOnAttractor = false; bTurnedAroundOnAttractor = false;
bCarPassenger = false; bCarPassenger = false;
bMiamiViceCop = false; bMiamiViceCop = false;
bMoneyHasBeenGivenByScript = false;
bIsDrowning = false; bIsDrowning = false;
bCanDrownInWater = true; bCanDrownInWater = true;

View File

@ -441,7 +441,7 @@ public:
//uint32 b155_8 //uint32 b155_8
//uint32 b155_10 //uint32 b155_10
uint32 bMiamiViceCop : 1; uint32 bMiamiViceCop : 1;
//uint32 b155_40 uint32 bMoneyHasBeenGivenByScript : 1; //
//uint32 b155_80 //uint32 b155_80
uint32 bIsDrowning : 1; uint32 bIsDrowning : 1;

View File

@ -18,6 +18,7 @@
#endif #endif
#include "PointLights.h" #include "PointLights.h"
#include "SpecialFX.h" #include "SpecialFX.h"
#include "Script.h"
#include "Shadows.h" #include "Shadows.h"
#ifdef DEBUGMENU #ifdef DEBUGMENU
@ -1766,6 +1767,6 @@ CShadows::RenderIndicatorShadow(uint32 nID, uint8 ShadowType, RwTexture *pTextur
ASSERT(pPosn != NULL); ASSERT(pPosn != NULL);
C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, Max(fFrontX, -fSideY), C3dMarkers::PlaceMarkerSet(nID, _TODOCONST(4), *pPosn, Max(fFrontX, -fSideY),
0, 128, 255, 128, SPHERE_MARKER_R, SPHERE_MARKER_G, SPHERE_MARKER_B,
2048, 0.2f, 0); SPHERE_MARKER_A, SPHERE_MARKER_PULSE_PERIOD, 0.2f, 0);
} }

View File

@ -44,6 +44,8 @@ enum eWeaponType
WEAPONTYPE_UNIDENTIFIED, WEAPONTYPE_UNIDENTIFIED,
WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE, WEAPONTYPE_TOTALWEAPONS = WEAPONTYPE_LAST_WEAPONTYPE,
WEAPONTYPE_ANYMELEE = 46,
WEAPONTYPE_ANYWEAPON = 47
}; };
enum { enum {