Merge pull request #327 from Nick007J/master

script 900-999
This commit is contained in:
aap 2020-02-17 10:12:38 +01:00 committed by GitHub
commit 3fa200dc3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1195 additions and 56 deletions

View File

@ -265,9 +265,16 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
break; break;
case MISSION_RAMCAR_CLOSE: case MISSION_RAMCAR_CLOSE:
if (pVehicle->AutoPilot.m_pTargetCar){ if (pVehicle->AutoPilot.m_pTargetCar){
/* PlayerPed? */ if
if (FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer && #ifdef FIX_BUGS
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice())){ (FindPlayerVehicle() == pVehicle->AutoPilot.m_pTargetCar &&
#endif
(FindPlayerPed()->m_pWanted->m_bIgnoredByEveryone || pVehicle->bIsLawEnforcer &&
(FindPlayerPed()->m_pWanted->m_nWantedLevel == 0 || FindPlayerPed()->m_pWanted->m_bIgnoredByCops || CCullZones::NoPolice()))
#ifdef FIX_BUGS
)
#endif
{
CCarCtrl::JoinCarWithRoadSystem(pVehicle); CCarCtrl::JoinCarWithRoadSystem(pVehicle);
pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE; pVehicle->AutoPilot.m_nCarMission = MISSION_CRUISE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS; pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_STOP_FOR_CARS;

View File

@ -4,6 +4,7 @@
WRAPPER bool CCranes::IsThisCarBeingTargettedByAnyCrane(CVehicle*) { EAXJMP(0x5451E0); } WRAPPER bool CCranes::IsThisCarBeingTargettedByAnyCrane(CVehicle*) { EAXJMP(0x5451E0); }
WRAPPER bool CCranes::IsThisCarBeingCarriedByAnyCrane(CVehicle*) { EAXJMP(0x545190); } WRAPPER bool CCranes::IsThisCarBeingCarriedByAnyCrane(CVehicle*) { EAXJMP(0x545190); }
WRAPPER bool CCranes::IsThisCarPickedUp(float, float, CVehicle*) { EAXJMP(0x543940); }
WRAPPER void CCranes::ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float) { EAXJMP(0x543650); } WRAPPER void CCranes::ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float) { EAXJMP(0x543650); }
WRAPPER void CCranes::DeActivateCrane(float, float) { EAXJMP(0x543890); } WRAPPER void CCranes::DeActivateCrane(float, float) { EAXJMP(0x543890); }
WRAPPER void CCranes::InitCranes(void) { EAXJMP(0x543360); } WRAPPER void CCranes::InitCranes(void) { EAXJMP(0x543360); }

View File

@ -8,6 +8,7 @@ class CCranes
public: public:
static bool IsThisCarBeingTargettedByAnyCrane(CVehicle*); static bool IsThisCarBeingTargettedByAnyCrane(CVehicle*);
static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*); static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*);
static bool IsThisCarPickedUp(float, float, CVehicle*);
static void ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float); static void ActivateCrane(float, float, float, float, float, float, float, float, bool, bool, float, float);
static void DeActivateCrane(float, float); static void DeActivateCrane(float, float);
static void InitCranes(void); static void InitCranes(void);

View File

@ -14,7 +14,7 @@ int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34;
bool &CGarages::BombsAreFree = *(bool *)0x95CD7A; bool &CGarages::BombsAreFree = *(bool *)0x95CD7A;
bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D; bool &CGarages::RespraysAreFree = *(bool *)0x95CD1D;
int32 &CGarages::CarsCollected = *(int32 *)0x880E18; int32 &CGarages::CarsCollected = *(int32 *)0x880E18;
int32 &CGarages::CarTypesCollected = *(int32 *)0x8E286C; int32 (&CGarages::CarTypesCollected)[TOTAL_COLLECTCARS_GARAGES] = *(int32 (*)[TOTAL_COLLECTCARS_GARAGES])(uintptr*)0x8E286C;
int32 &CGarages::CrushedCarId = *(int32 *)0x943060; int32 &CGarages::CrushedCarId = *(int32 *)0x943060;
uint32 &CGarages::LastTimeHelpMessage = *(uint32 *)0x8F1B58; uint32 &CGarages::LastTimeHelpMessage = *(uint32 *)0x8F1B58;
int32 &CGarages::MessageNumberInString = *(int32 *)0x885BA8; int32 &CGarages::MessageNumberInString = *(int32 *)0x885BA8;
@ -97,7 +97,7 @@ void CGarages::GivePlayerDetonator()
} }
WRAPPER bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id) { EAXJMP(0x426D50); } WRAPPER bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id) { EAXJMP(0x426D50); }
WRAPPER void CGarages::ChangeGarageType(int16 garage, eGarageType type, int32 unk) { EAXJMP(0x4222A0); } WRAPPER void CGarages::ChangeGarageType(int16 garage, eGarageType type, int32 mi) { EAXJMP(0x4222A0); }
WRAPPER bool CGarages::HasResprayHappened(int16 garage) { EAXJMP(0x4274F0); } WRAPPER bool CGarages::HasResprayHappened(int16 garage) { EAXJMP(0x4274F0); }
void CGarage::OpenThisGarage() void CGarage::OpenThisGarage()
@ -106,12 +106,41 @@ void CGarage::OpenThisGarage()
m_eGarageState = GS_OPENING; m_eGarageState = GS_OPENING;
} }
bool CGarages::IsGarageOpen(int16 garage)
{
return Garages[garage].IsOpen();
}
bool CGarages::IsGarageClosed(int16 garage)
{
return Garages[garage].IsClosed();
}
void CGarage::CloseThisGarage() void CGarage::CloseThisGarage()
{ {
if (m_eGarageState == GS_OPENED || m_eGarageState == GS_OPENING) if (m_eGarageState == GS_OPENED || m_eGarageState == GS_OPENING)
m_eGarageState = GS_CLOSING; m_eGarageState = GS_CLOSING;
} }
void CGarages::SetGarageDoorToRotate(int16 garage)
{
if (Garages[garage].m_bRotatedDoor)
return;
Garages[garage].m_bRotatedDoor = true;
Garages[garage].m_fDoorHeight /= 2.0f;
Garages[garage].m_fDoorHeight -= 0.1f;
}
bool CGarages::HasImportExportGarageCollectedThisCar(int16 garage, int8 car)
{
return CarTypesCollected[GetCarsCollectedIndexForGarageType(Garages[garage].m_eGarageType)] & (1 << car);
}
void CGarages::SetLeaveCameraForThisGarage(int16 garage)
{
Garages[garage].m_bCameraFollowsPlayer = true;
}
#if 0 #if 0
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); } WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }
#else #else

View File

@ -42,6 +42,11 @@ enum eGarageType : int8
GARAGE_MISSION_KEEPCAR_REMAINCLOSED, GARAGE_MISSION_KEEPCAR_REMAINCLOSED,
}; };
enum
{
TOTAL_COLLECTCARS_GARAGES = GARAGE_COLLECTCARS_3 - GARAGE_COLLECTCARS_1 + 1
};
class CStoredCar class CStoredCar
{ {
int32 m_nModelIndex; int32 m_nModelIndex;
@ -64,6 +69,7 @@ static_assert(sizeof(CStoredCar) == 0x28, "CStoredCar");
class CGarage class CGarage
{ {
public:
eGarageType m_eGarageType; eGarageType m_eGarageType;
eGarageState m_eGarageState; eGarageState m_eGarageState;
char field_2; char field_2;
@ -101,9 +107,11 @@ class CGarage
CVehicle *m_pTarget; CVehicle *m_pTarget;
int field_96; int field_96;
CStoredCar m_sStoredCar; CStoredCar m_sStoredCar;
public:
void OpenThisGarage(); void OpenThisGarage();
void CloseThisGarage(); void CloseThisGarage();
bool IsOpen() { return m_eGarageState == GS_OPENED || m_eGarageState == GS_OPENEDCONTAINSCAR; }
bool IsClosed() { return m_eGarageState == GS_FULLYCLOSED; }
}; };
static_assert(sizeof(CGarage) == 140, "CGarage"); static_assert(sizeof(CGarage) == 140, "CGarage");
@ -115,7 +123,7 @@ public:
static bool &BombsAreFree; static bool &BombsAreFree;
static bool &RespraysAreFree; static bool &RespraysAreFree;
static int32 &CarsCollected; static int32 &CarsCollected;
static int32 &CarTypesCollected; static int32 (&CarTypesCollected)[TOTAL_COLLECTCARS_GARAGES];
static int32 &CrushedCarId; static int32 &CrushedCarId;
static uint32 &LastTimeHelpMessage; static uint32 &LastTimeHelpMessage;
static int32 &MessageNumberInString; static int32 &MessageNumberInString;
@ -149,4 +157,11 @@ public:
static void ChangeGarageType(int16, eGarageType, int32); static void ChangeGarageType(int16, eGarageType, int32);
static bool HasResprayHappened(int16); static bool HasResprayHappened(int16);
static void GivePlayerDetonator(); static void GivePlayerDetonator();
static bool IsGarageOpen(int16);
static bool IsGarageClosed(int16);
static void SetGarageDoorToRotate(int16);
static bool HasImportExportGarageCollectedThisCar(int16, int8);
static void SetLeaveCameraForThisGarage(int16);
static int GetCarsCollectedIndexForGarageType(eGarageType type) { return type - GARAGE_COLLECTCARS_1; }
}; };

File diff suppressed because it is too large Load Diff

View File

@ -11,6 +11,8 @@ class CPed;
class CObject; class CObject;
class CPlayerInfo; class CPlayerInfo;
#define KEY_LENGTH_IN_SCRIPT 8
struct CScriptRectangle struct CScriptRectangle
{ {
int8 m_bIsUsed; int8 m_bIsUsed;
@ -377,6 +379,12 @@ public:
static void DrawDebugSquare(float, float, float, float); static void DrawDebugSquare(float, float, float, float);
static void DrawDebugCube(float, float, float, float, float, float); static void DrawDebugCube(float, float, float, float, float, float);
static void AddToInvisibilitySwapArray(CEntity*, bool); static void AddToInvisibilitySwapArray(CEntity*, bool);
static void AddToBuildingSwapArray(CBuilding*, int32, int32);
static int32 GetActualScriptSphereIndex(int32 index);
static int32 AddScriptSphere(int32 id, CVector pos, float radius);
static int32 GetNewUniqueScriptSphereIndex(int32 index);
static void RemoveScriptSphere(int32 index);
static int32 Read4BytesFromScript(uint32* pIp){ static int32 Read4BytesFromScript(uint32* pIp){
int32 retval = 0; int32 retval = 0;
@ -403,11 +411,11 @@ public:
return Read2BytesFromScript(pIp) / 16.0f; return Read2BytesFromScript(pIp) / 16.0f;
} }
static void ReadTextLabelFromScript(uint32* pIp, char* buf){ static void ReadTextLabelFromScript(uint32* pIp, char* buf){
strncpy(buf, (const char*)&ScriptSpace[*pIp], 8); strncpy(buf, (const char*)&ScriptSpace[*pIp], KEY_LENGTH_IN_SCRIPT);
} }
static wchar* GetTextByKeyFromScript(uint32* pIp) { static wchar* GetTextByKeyFromScript(uint32* pIp) {
wchar* text = TheText.Get((const char*)&ScriptSpace[*pIp]); wchar* text = TheText.Get((const char*)&ScriptSpace[*pIp]);
*pIp += 8; *pIp += KEY_LENGTH_IN_SCRIPT;
return text; return text;
} }
}; };

View File

@ -32,8 +32,14 @@ int32 &CStats::MissionsGiven = *(int32*)0x9430E8;
int32 &CStats::MissionsPassed = *(int32*)0x940768; int32 &CStats::MissionsPassed = *(int32*)0x940768;
char(&CStats::LastMissionPassedName)[8] = *(char(*)[8])*(uintptr*)0x70D828; char(&CStats::LastMissionPassedName)[8] = *(char(*)[8])*(uintptr*)0x70D828;
int32 &CStats::TotalLegitimateKills = *(int32*)0x8F6004; int32 &CStats::TotalLegitimateKills = *(int32*)0x8F6004;
int32 &CStats::ElBurroTime = *(int32*)0x8E2A6C;
void CStats::AnotherKillFrenzyPassed() void CStats::AnotherKillFrenzyPassed()
{ {
++NumberKillFrenziesPassed; ++NumberKillFrenziesPassed;
} }
void CStats::RegisterElBurroTime(int32 time)
{
ElBurroTime = (ElBurroTime && ElBurroTime < time) ? ElBurroTime : time;
}

View File

@ -34,9 +34,11 @@ public:
static int32 &MissionsPassed; static int32 &MissionsPassed;
static char (&LastMissionPassedName)[8]; static char (&LastMissionPassedName)[8];
static int32 &TotalLegitimateKills; static int32 &TotalLegitimateKills;
static int32 &ElBurroTime;
public: public:
static void AnotherKillFrenzyPassed(); static void AnotherKillFrenzyPassed();
static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; }; static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; };
static void CheckPointReachedSuccessfully() { TotalLegitimateKills += KillsSinceLastCheckpoint; KillsSinceLastCheckpoint = 0; }; static void CheckPointReachedSuccessfully() { TotalLegitimateKills += KillsSinceLastCheckpoint; KillsSinceLastCheckpoint = 0; };
static void RegisterElBurroTime(int32);
}; };

View File

@ -48,6 +48,8 @@ WRAPPER void CWorld::FindObjectsIntersectingCube(const CVector &, const CVector
WRAPPER void CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B3280); } WRAPPER void CWorld::FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B3280); }
WRAPPER void CWorld::FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool) { EAXJMP(0x4B2600); } WRAPPER void CWorld::FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool) { EAXJMP(0x4B2600); }
WRAPPER void CWorld::FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**) { EAXJMP(0x4B2960); } WRAPPER void CWorld::FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**) { EAXJMP(0x4B2960); }
WRAPPER void CWorld::FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool) { EAXJMP(0x4B3680); }
WRAPPER void CWorld::ClearCarsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B50E0); }
void void
CWorld::Initialise() CWorld::Initialise()

View File

@ -114,6 +114,8 @@ public:
static void FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool); static void FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
static void FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool); static void FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
static void FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool); static void FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
static void FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool);
static void ClearCarsFromArea(float, float, float, float, float, float);
static float GetSectorX(float f) { return ((f - WORLD_MIN_X)/SECTOR_SIZE_X); } 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 float GetSectorY(float f) { return ((f - WORLD_MIN_Y)/SECTOR_SIZE_Y); }

View File

@ -40,7 +40,7 @@ enum eParticleObjectState
enum tParticleType; enum tParticleType;
class CParticle; class CParticle;
class CParticleObject : CPlaceable class CParticleObject : public CPlaceable
{ {
public: public:
CParticleObject *m_pNext; CParticleObject *m_pNext;

View File

@ -43,3 +43,28 @@ CRouteNode::AddRoutePoint(int16 route, CVector pos)
gaRoutes[point].m_route = route; gaRoutes[point].m_route = route;
gaRoutes[point].m_pos = pos; gaRoutes[point].m_pos = pos;
} }
void
CRouteNode::RemoveRoute(int16 route)
{
uint16 first_point, last_point, i;
for (first_point = 0; first_point < NUMPEDROUTES; first_point++) {
if (gaRoutes[first_point].m_route == route)
break;
}
if (first_point == NUMPEDROUTES)
return;
for (last_point = first_point; last_point < NUMPEDROUTES; last_point++)
if (gaRoutes[last_point].m_route != route)
break;
uint16 diff = last_point - first_point;
#ifdef FIX_BUGS
for (i = first_point; i < NUMPEDROUTES - diff; i++)
gaRoutes[i] = gaRoutes[i + diff];
#else
for (i = 0; i < diff; i++)
gaRoutes[first_point + i] = gaRoutes[last_point + i];
#endif
for (i = NUMPEDROUTES - diff; i < NUMPEDROUTES; i++)
gaRoutes[i].m_route = -1;
}

View File

@ -10,4 +10,5 @@ public:
static CVector GetPointPosition(int16); static CVector GetPointPosition(int16);
static int16 GetRouteStart(int16); static int16 GetRouteStart(int16);
static void AddRoutePoint(int16, CVector); static void AddRoutePoint(int16, CVector);
static void RemoveRoute(int16);
}; };

View File

@ -1285,7 +1285,7 @@ CPlayerPed::ProcessControl(void)
// fall through // fall through
case PED_SEEK_POS: case PED_SEEK_POS:
switch (m_nMoveState) { switch (m_nMoveState) {
case PEDMOVE_STILL: case PEDMOVE_WALK:
m_fMoveSpeed = 1.0f; m_fMoveSpeed = 1.0f;
break; break;
case PEDMOVE_RUN: case PEDMOVE_RUN:

View File

@ -5,3 +5,4 @@
WRAPPER void CRubbish::Render(void) { EAXJMP(0x512190); } WRAPPER void CRubbish::Render(void) { EAXJMP(0x512190); }
WRAPPER void CRubbish::StirUp(CVehicle *veh) { EAXJMP(0x512690); } WRAPPER void CRubbish::StirUp(CVehicle *veh) { EAXJMP(0x512690); }
WRAPPER void CRubbish::Update(void) { EAXJMP(0x511B90); } WRAPPER void CRubbish::Update(void) { EAXJMP(0x511B90); }
WRAPPER void CRubbish::SetVisibility(bool) { EAXJMP(0x512AA0); }

View File

@ -8,4 +8,5 @@ public:
static void Render(void); static void Render(void);
static void StirUp(CVehicle *veh); // CAutomobile on PS2 static void StirUp(CVehicle *veh); // CAutomobile on PS2
static void Update(void); static void Update(void);
static void SetVisibility(bool);
}; };

View File

@ -627,6 +627,7 @@ CVehicle::SetupPassenger(int n)
pPassengers[n]->SetPedState(PED_DRIVING); pPassengers[n]->SetPedState(PED_DRIVING);
if(bIsBus) if(bIsBus)
pPassengers[n]->bRenderPedInCar = false; pPassengers[n]->bRenderPedInCar = false;
++m_nNumPassengers;
return pPassengers[n]; return pPassengers[n];
} }