script 1000-1154

This commit is contained in:
Nikolay Korolev 2020-02-16 23:08:54 +03:00
parent a36da99798
commit 1337a9b603
24 changed files with 1225 additions and 35 deletions

View file

@ -5,6 +5,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 bool CCranes::IsThisCarPickedUp(float, float, CVehicle*) { EAXJMP(0x543940); }
WRAPPER bool CCranes::HaveAllCarsBeenCollectedByMilitaryCrane() { EAXJMP(0x544BE0); }
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

@ -9,6 +9,7 @@ public:
static bool IsThisCarBeingTargettedByAnyCrane(CVehicle*); static bool IsThisCarBeingTargettedByAnyCrane(CVehicle*);
static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*); static bool IsThisCarBeingCarriedByAnyCrane(CVehicle*);
static bool IsThisCarPickedUp(float, float, CVehicle*); static bool IsThisCarPickedUp(float, float, CVehicle*);
static bool HaveAllCarsBeenCollectedByMilitaryCrane();
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

@ -99,6 +99,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 mi) { 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); }
WRAPPER bool CGarages::IsThisCarWithinGarageArea(int16 garage, CEntity* pCar) { EAXJMP(0x427570); }
void CGarage::OpenThisGarage() void CGarage::OpenThisGarage()
{ {

View file

@ -162,6 +162,7 @@ public:
static void SetGarageDoorToRotate(int16); static void SetGarageDoorToRotate(int16);
static bool HasImportExportGarageCollectedThisCar(int16, int8); static bool HasImportExportGarageCollectedThisCar(int16, int8);
static void SetLeaveCameraForThisGarage(int16); static void SetLeaveCameraForThisGarage(int16);
static bool IsThisCarWithinGarageArea(int16, CEntity*);
static int GetCarsCollectedIndexForGarageType(eGarageType type) { return type - GARAGE_COLLECTCARS_1; } static int GetCarsCollectedIndexForGarageType(eGarageType type) { return type - GARAGE_COLLECTCARS_1; }
}; };

View file

@ -893,7 +893,7 @@ CPathFind::MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2,
} }
void void
CPathFind::MarkPedRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2) CPathFind::PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2)
{ {
int i; int i;
@ -1476,7 +1476,7 @@ STARTPATCHES
InjectHook(0x42DB50, &CPathFind::SwitchRoadsInAngledArea, PATCH_JUMP); InjectHook(0x42DB50, &CPathFind::SwitchRoadsInAngledArea, PATCH_JUMP);
InjectHook(0x42E140, &CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours, PATCH_JUMP); InjectHook(0x42E140, &CPathFind::MarkRoadsBetweenLevelsNodeAndNeighbours, PATCH_JUMP);
InjectHook(0x42DF50, &CPathFind::MarkRoadsBetweenLevelsInArea, PATCH_JUMP); InjectHook(0x42DF50, &CPathFind::MarkRoadsBetweenLevelsInArea, PATCH_JUMP);
InjectHook(0x42E040, &CPathFind::MarkPedRoadsBetweenLevelsInArea, PATCH_JUMP); InjectHook(0x42E040, &CPathFind::PedMarkRoadsBetweenLevelsInArea, PATCH_JUMP);
InjectHook(0x42CC30, &CPathFind::FindNodeClosestToCoors, PATCH_JUMP); InjectHook(0x42CC30, &CPathFind::FindNodeClosestToCoors, PATCH_JUMP);
InjectHook(0x42CDC0, &CPathFind::FindNodeClosestToCoorsFavourDirection, PATCH_JUMP); InjectHook(0x42CDC0, &CPathFind::FindNodeClosestToCoorsFavourDirection, PATCH_JUMP);
InjectHook(0x42CFC0, &CPathFind::FindNodeOrientationForCarPlacement, PATCH_JUMP); InjectHook(0x42CFC0, &CPathFind::FindNodeOrientationForCarPlacement, PATCH_JUMP);

View file

@ -186,7 +186,7 @@ public:
void SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float y2, float z2, float length, uint8 type, uint8 enable); void SwitchRoadsInAngledArea(float x1, float y1, float z1, float x2, float y2, float z2, float length, uint8 type, uint8 enable);
void MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId); void MarkRoadsBetweenLevelsNodeAndNeighbours(int32 nodeId);
void MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2); void MarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2);
void MarkPedRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2); void PedMarkRoadsBetweenLevelsInArea(float x1, float x2, float y1, float y2, float z1, float z2);
int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled = false, bool ignoreBetweenLevels = false); int32 FindNodeClosestToCoors(CVector coors, uint8 type, float distLimit, bool ignoreDisabled = false, bool ignoreBetweenLevels = false);
int32 FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY); int32 FindNodeClosestToCoorsFavourDirection(CVector coors, uint8 type, float dirX, float dirY);
float FindNodeOrientationForCarPlacement(int32 nodeId); float FindNodeOrientationForCarPlacement(int32 nodeId);

View file

@ -38,6 +38,7 @@ WRAPPER void CPopulation::UpdatePedCount(uint32, bool) { EAXJMP(0x4F5A60); }
WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); } WRAPPER void CPopulation::DealWithZoneChange(eLevelName oldLevel, eLevelName newLevel, bool) { EAXJMP(0x4F6200); }
WRAPPER CPed *CPopulation::AddPedInCar(CVehicle *vehicle) { EAXJMP(0x4F5800); } WRAPPER CPed *CPopulation::AddPedInCar(CVehicle *vehicle) { EAXJMP(0x4F5800); }
WRAPPER bool CPopulation::IsPointInSafeZone(CVector *coors) { EAXJMP(0x4F60C0); } WRAPPER bool CPopulation::IsPointInSafeZone(CVector *coors) { EAXJMP(0x4F60C0); }
WRAPPER void CPopulation::ConvertToRealObject(CDummyObject* obj) { EAXJMP(0x4F45A0); }
void void
CPopulation::Initialise() CPopulation::Initialise()

View file

@ -4,6 +4,7 @@
class CPed; class CPed;
class CVehicle; class CVehicle;
class CDummyObject;
struct PedGroup struct PedGroup
{ {
@ -48,4 +49,5 @@ public:
static bool IsPointInSafeZone(CVector *coors); static bool IsPointInSafeZone(CVector *coors);
static void RemovePed(CEntity* ent); static void RemovePed(CEntity* ent);
static int32 ChooseCivilianOccupation(int32); static int32 ChooseCivilianOccupation(int32);
static void ConvertToRealObject(CDummyObject*);
}; };

View file

@ -13,3 +13,5 @@ WRAPPER void CRecordDataForChase::ProcessControlCars(void) { EAXJMP(0x435540); }
WRAPPER void CRecordDataForChase::SaveOrRetrieveCarPositions(void) { EAXJMP(0x434B20); } WRAPPER void CRecordDataForChase::SaveOrRetrieveCarPositions(void) { EAXJMP(0x434B20); }
WRAPPER void CRecordDataForChase::StartChaseScene(float) { EAXJMP(0x435690); } WRAPPER void CRecordDataForChase::StartChaseScene(float) { EAXJMP(0x435690); }
WRAPPER void CRecordDataForChase::CleanUpChaseScene() { EAXJMP(0x4357C0); } WRAPPER void CRecordDataForChase::CleanUpChaseScene() { EAXJMP(0x4357C0); }
WRAPPER void CRecordDataForChase::RemoveCarFromChase(int32) { EAXJMP(0x435BC0); }
WRAPPER CVehicle* CRecordDataForChase::TurnChaseCarIntoScriptCar(int32) { EAXJMP(0x435C00); }

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
class CVehicle;
enum { enum {
RECORDSTATE_0, RECORDSTATE_0,
RECORDSTATE_1, RECORDSTATE_1,
@ -16,6 +18,8 @@ public:
static void SaveOrRetrieveCarPositions(void); static void SaveOrRetrieveCarPositions(void);
static void StartChaseScene(float); static void StartChaseScene(float);
static void CleanUpChaseScene(); static void CleanUpChaseScene();
static void RemoveCarFromChase(int32);
static CVehicle* TurnChaseCarIntoScriptCar(int32);
}; };

File diff suppressed because it is too large Load diff

View file

@ -139,7 +139,9 @@ public:
int8 ProcessCommands800To899(int32); int8 ProcessCommands800To899(int32);
int8 ProcessCommands900To999(int32); int8 ProcessCommands900To999(int32);
int8 ProcessCommands1000To1099(int32); int8 ProcessCommands1000To1099(int32);
#ifndef GTA_PS2
int8 ProcessCommands1100To1199(int32); int8 ProcessCommands1100To1199(int32);
#endif
void UpdateCompareFlag(bool); void UpdateCompareFlag(bool);
int16 GetPadState(uint16, uint16); int16 GetPadState(uint16, uint16);
void LocatePlayerCommand(int32, uint32*); void LocatePlayerCommand(int32, uint32*);

View file

@ -1108,6 +1108,7 @@ enum {
COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER, COMMAND_SET_JAMES_CAR_ON_PATH_TO_PLAYER,
COMMAND_LOAD_END_OF_GAME_TUNE, COMMAND_LOAD_END_OF_GAME_TUNE,
COMMAND_ENABLE_PLAYER_CONTROL_CAMERA, COMMAND_ENABLE_PLAYER_CONTROL_CAMERA,
#ifndef GTA_PS2
COMMAND_SET_OBJECT_ROTATION, COMMAND_SET_OBJECT_ROTATION,
COMMAND_GET_DEBUG_CAMERA_COORDINATES, COMMAND_GET_DEBUG_CAMERA_COORDINATES,
COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR, COMMAND_GET_DEBUG_CAMERA_FRONT_VECTOR,
@ -1127,7 +1128,7 @@ enum {
COMMAND_GET_DEBUG_CAMERA_POINT_AT, COMMAND_GET_DEBUG_CAMERA_POINT_AT,
COMMAND_ATTACH_CHAR_TO_CAR, COMMAND_ATTACH_CHAR_TO_CAR,
COMMAND_DETACH_CHAR_FROM_CAR, COMMAND_DETACH_CHAR_FROM_CAR,
COMMAND_SET_CAR_STAY_IN_FAST_LANE, COMMAND_SET_CAR_CHANGE_LANE,
COMMAND_CLEAR_CHAR_LAST_WEAPON_DAMAGE, COMMAND_CLEAR_CHAR_LAST_WEAPON_DAMAGE,
COMMAND_CLEAR_CAR_LAST_WEAPON_DAMAGE, COMMAND_CLEAR_CAR_LAST_WEAPON_DAMAGE,
COMMAND_GET_RANDOM_COP_IN_AREA, COMMAND_GET_RANDOM_COP_IN_AREA,
@ -1144,7 +1145,7 @@ enum {
COMMAND_LOCATE_CHAR_ANY_MEANS_OBJECT_3D, COMMAND_LOCATE_CHAR_ANY_MEANS_OBJECT_3D,
COMMAND_LOCATE_CHAR_ON_FOOT_OBJECT_3D, COMMAND_LOCATE_CHAR_ON_FOOT_OBJECT_3D,
COMMAND_LOCATE_CHAR_IN_CAR_OBJECT_3D, COMMAND_LOCATE_CHAR_IN_CAR_OBJECT_3D,
COMMAND_SET_CAR_TEMP_ACTION, COMMAND_SET_CAR_HANDBRAKE_TURN_LEFT,
COMMAND_SET_CAR_HANDBRAKE_TURN_RIGHT, COMMAND_SET_CAR_HANDBRAKE_TURN_RIGHT,
COMMAND_SET_CAR_HANDBRAKE_STOP, COMMAND_SET_CAR_HANDBRAKE_STOP,
COMMAND_IS_CHAR_ON_ANY_BIKE, COMMAND_IS_CHAR_ON_ANY_BIKE,
@ -1155,4 +1156,5 @@ enum {
COMMAND_IS_CHAR_LYING_DOWN, COMMAND_IS_CHAR_LYING_DOWN,
COMMAND_CAN_CHAR_SEE_DEAD_CHAR, COMMAND_CAN_CHAR_SEE_DEAD_CHAR,
COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER, COMMAND_SET_ENTER_CAR_RANGE_MULTIPLIER,
#endif
}; };

View file

@ -30,6 +30,7 @@ WRAPPER void CCamera::Process(void) { EAXJMP(0x46D3F0); }
WRAPPER void CCamera::LoadPathSplines(int file) { EAXJMP(0x46D1D0); } WRAPPER void CCamera::LoadPathSplines(int file) { EAXJMP(0x46D1D0); }
WRAPPER void CCamera::RestoreWithJumpCut(void) { EAXJMP(0x46FAE0); }; WRAPPER void CCamera::RestoreWithJumpCut(void) { EAXJMP(0x46FAE0); };
WRAPPER void CCamera::SetPercentAlongCutScene(float) { EAXJMP(0x46FE20); }; WRAPPER void CCamera::SetPercentAlongCutScene(float) { EAXJMP(0x46FE20); };
WRAPPER void CCamera::SetParametersForScriptInterpolation(float, float, int32) { EAXJMP(0x46FDE0); }
bool bool
CCamera::GetFading() CCamera::GetFading()
@ -154,6 +155,13 @@ CCamera::SetMotionBlurAlpha(int a)
m_imotionBlurAddAlpha = a; m_imotionBlurAddAlpha = a;
} }
void
CCamera::SetNearClipScript(float clip)
{
m_fNearClipScript = clip;
m_bUseNearClipScript = true;
}
void void
CCamera::RenderMotionBlur(void) CCamera::RenderMotionBlur(void)
{ {

View file

@ -485,6 +485,7 @@ int m_iModeObbeCamIsInForCar;
void Restore(void); void Restore(void);
void SetWideScreenOn(void); void SetWideScreenOn(void);
void SetWideScreenOff(void); void SetWideScreenOff(void);
void SetNearClipScript(float);
float Find3rdPersonQuickAimPitch(void); float Find3rdPersonQuickAimPitch(void);
@ -512,6 +513,7 @@ int m_iModeObbeCamIsInForCar;
void UpdateAimingCoors(CVector const &); void UpdateAimingCoors(CVector const &);
void SetPercentAlongCutScene(float); void SetPercentAlongCutScene(float);
void SetParametersForScriptInterpolation(float, float, int32);
void dtor(void) { this->CCamera::~CCamera(); } void dtor(void) { this->CCamera::~CCamera(); }
}; };

View file

@ -26,6 +26,7 @@ public:
static CDirectory *&ms_pCutsceneDir; static CDirectory *&ms_pCutsceneDir;
static uint32 &ms_cutsceneLoadStatus; static uint32 &ms_cutsceneLoadStatus;
static void SetRunning(bool running) { ms_running = running; }
static bool IsRunning(void) { return ms_running; } static bool IsRunning(void) { return ms_running; }
static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; } static bool IsCutsceneProcessing(void) { return ms_cutsceneProcessing; }
static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; } static CCutsceneObject* GetCutsceneObject(int id) { return ms_pCutsceneObjects[id]; }

View file

@ -33,13 +33,102 @@ 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; int32 &CStats::ElBurroTime = *(int32*)0x8E2A6C;
int32& CStats::Record4x4One = *(int32*)0x940570;
int32& CStats::Record4x4Two = *(int32*)0x94058C;
int32& CStats::Record4x4Three = *(int32*)0x880FA8;
int32& CStats::Record4x4Mayhem = *(int32*)0x885B70;
int32& CStats::LivesSavedWithAmbulance = *(int32*)0x8F57E0;
int32& CStats::CriminalsCaught = *(int32*)0x8F2518;
int32& CStats::HighestLevelAmbulanceMission = *(int32*)0x8F2A04;
int32& CStats::FiresExtinguished = *(int32*)0x8F5FEC;
int32& CStats::LongestFlightInDodo = *(int32*)0x8F5FE4;
int32& CStats::TimeTakenDefuseMission = *(int32*)0x880E24;
int32& CStats::TotalNumberKillFrenzies = *(int32*)0x8E2884;
int32& CStats::TotalNumberMissions = *(int32*)0x8E2820;
int32(&CStats::FastestTimes)[CStats::TOTAL_FASTEST_TIMES] = *(int32(*)[CStats::TOTAL_FASTEST_TIMES])*(uintptr*)0x6E9128;
int32(&CStats::HighestScores)[CStats::TOTAL_HIGHEST_SCORES] = *(int32(*)[CStats::TOTAL_HIGHEST_SCORES]) * (uintptr*)0x8622B0;
void CStats::AnotherKillFrenzyPassed() void CStats::RegisterFastestTime(int32 index, int32 time)
{ {
++NumberKillFrenziesPassed; assert(index >= 0 && index < TOTAL_FASTEST_TIMES);
if (FastestTimes[index] == 0)
FastestTimes[index] = time;
else
FastestTimes[index] = min(FastestTimes[index], time);
}
void CStats::RegisterHighestScore(int32 index, int32 score)
{
assert(index >= 0 && index < TOTAL_HIGHEST_SCORES);
HighestScores[index] = max(HighestScores[index], score);
} }
void CStats::RegisterElBurroTime(int32 time) void CStats::RegisterElBurroTime(int32 time)
{ {
ElBurroTime = (ElBurroTime && ElBurroTime < time) ? ElBurroTime : time; ElBurroTime = (ElBurroTime && ElBurroTime < time) ? ElBurroTime : time;
} }
void CStats::Register4x4OneTime(int32 time)
{
Record4x4One = (Record4x4One && Record4x4One < time) ? Record4x4One : time;
}
void CStats::Register4x4TwoTime(int32 time)
{
Record4x4Two = (Record4x4Two && Record4x4Two < time) ? Record4x4Two : time;
}
void CStats::Register4x4ThreeTime(int32 time)
{
Record4x4Three = (Record4x4Three && Record4x4Three < time) ? Record4x4Three : time;
}
void CStats::Register4x4MayhemTime(int32 time)
{
Record4x4Mayhem = (Record4x4Mayhem && Record4x4Mayhem < time) ? Record4x4Mayhem : time;
}
void CStats::AnotherLifeSavedWithAmbulance()
{
++LivesSavedWithAmbulance;
}
void CStats::AnotherCriminalCaught()
{
++CriminalsCaught;
}
void CStats::RegisterLevelAmbulanceMission(int32 level)
{
HighestLevelAmbulanceMission = max(HighestLevelAmbulanceMission, level);
}
void CStats::AnotherFireExtinguished()
{
++FiresExtinguished;
}
void CStats::RegisterLongestFlightInDodo(int32 time)
{
LongestFlightInDodo = max(LongestFlightInDodo, time);
}
void CStats::RegisterTimeTakenDefuseMission(int32 time)
{
TimeTakenDefuseMission = (TimeTakenDefuseMission && TimeTakenDefuseMission < time) ? TimeTakenDefuseMission : time;
}
void CStats::AnotherKillFrenzyPassed()
{
++NumberKillFrenziesPassed;
}
void CStats::SetTotalNumberKillFrenzies(int32 total)
{
TotalNumberKillFrenzies = total;
}
void CStats::SetTotalNumberMissions(int32 total)
{
TotalNumberMissions = total;
}

View file

@ -3,6 +3,10 @@
class CStats class CStats
{ {
public: public:
enum {
TOTAL_FASTEST_TIMES = 16,
TOTAL_HIGHEST_SCORES = 16
};
static int32 &DaysPassed; static int32 &DaysPassed;
static int32 &HeadsPopped; static int32 &HeadsPopped;
static bool& CommercialPassed; static bool& CommercialPassed;
@ -35,9 +39,37 @@ public:
static char (&LastMissionPassedName)[8]; static char (&LastMissionPassedName)[8];
static int32 &TotalLegitimateKills; static int32 &TotalLegitimateKills;
static int32 &ElBurroTime; static int32 &ElBurroTime;
static int32 &Record4x4One;
static int32 &Record4x4Two;
static int32 &Record4x4Three;
static int32 &Record4x4Mayhem;
static int32 &LivesSavedWithAmbulance;
static int32 &CriminalsCaught;
static int32 &HighestLevelAmbulanceMission;
static int32 &FiresExtinguished;
static int32 &LongestFlightInDodo;
static int32 &TimeTakenDefuseMission;
static int32 &TotalNumberKillFrenzies;
static int32 &TotalNumberMissions;
static int32(&FastestTimes)[TOTAL_FASTEST_TIMES];
static int32(&HighestScores)[TOTAL_HIGHEST_SCORES];
public: public:
static void RegisterFastestTime(int32, int32);
static void RegisterHighestScore(int32, int32);
static void AnotherKillFrenzyPassed(); static void AnotherKillFrenzyPassed();
static void AnotherLifeSavedWithAmbulance();
static void AnotherCriminalCaught();
static void RegisterLevelAmbulanceMission(int32);
static void AnotherFireExtinguished();
static void Register4x4OneTime(int32);
static void Register4x4TwoTime(int32);
static void Register4x4ThreeTime(int32);
static void Register4x4MayhemTime(int32);
static void RegisterLongestFlightInDodo(int32);
static void RegisterTimeTakenDefuseMission(int32);
static void SetTotalNumberKillFrenzies(int32);
static void SetTotalNumberMissions(int32);
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); static void RegisterElBurroTime(int32);

View file

@ -50,6 +50,7 @@ WRAPPER void CWorld::FindObjectsOfTypeInRange(uint32, CVector&, float, bool, sho
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::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); } WRAPPER void CWorld::ClearCarsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B50E0); }
WRAPPER void CWorld::ClearPedsFromArea(float, float, float, float, float, float) { EAXJMP(0x4B52B0); }
void void
CWorld::Initialise() CWorld::Initialise()

View file

@ -116,6 +116,7 @@ public:
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 FindMissionEntitiesIntersectingCube(const CVector&, const CVector&, int16*, int16, CEntity**, bool, bool, bool);
static void ClearCarsFromArea(float, float, float, float, float, float); static void ClearCarsFromArea(float, float, float, float, float, float);
static void ClearPedsFromArea(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

@ -163,6 +163,8 @@ enum Config {
// Script // Script
#define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default #define USE_DEBUG_SCRIPT_LOADER // makes game load main_freeroam.scm by default
#define USE_MEASUREMENTS_IN_METERS // makes game use meters instead of feet in script
#define USE_PRECISE_MEASUREMENT_CONVERTION // makes game convert feet to meeters more precisely
// Vehicles // Vehicles
#define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher #define EXPLODING_AIRTRAIN // can blow up jumbo jet with rocket launcher

View file

@ -85,6 +85,9 @@ public:
static uint32 GetFlag(int type) { return ms_apPedType[type]->m_flag; } static uint32 GetFlag(int type) { return ms_apPedType[type]->m_flag; }
static uint32 GetAvoid(int type) { return ms_apPedType[type]->m_avoid; } static uint32 GetAvoid(int type) { return ms_apPedType[type]->m_avoid; }
static uint32 GetThreats(int type) { return ms_apPedType[type]->m_threats; } static uint32 GetThreats(int type) { return ms_apPedType[type]->m_threats; }
static void AddThreat(int type, int threat) { ms_apPedType[type]->m_threats |= threat; }
static void RemoveThreat(int type, int threat) { ms_apPedType[type]->m_threats &= ~threat; }
static bool IsThreat(int type, int threat) { return ms_apPedType[type]->m_threats & threat; }
}; };
static_assert(sizeof(CPedType) == 0x20, "CPedType: error"); static_assert(sizeof(CPedType) == 0x20, "CPedType: error");

View file

@ -11,6 +11,9 @@
#include "Lights.h" #include "Lights.h"
#include "VisibilityPlugins.h" #include "VisibilityPlugins.h"
#include "World.h" #include "World.h"
#include "Particle.h"
#include "General.h"
#include "Camera.h"
WRAPPER void CSpecialFX::Render(void) { EAXJMP(0x518DC0); } WRAPPER void CSpecialFX::Render(void) { EAXJMP(0x518DC0); }
WRAPPER void CSpecialFX::Update(void) { EAXJMP(0x518D40); } WRAPPER void CSpecialFX::Update(void) { EAXJMP(0x518D40); }
@ -383,6 +386,77 @@ CMoneyMessages::RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8
aMoneyMessages[nIndex].m_fOpacity = fOpacity; aMoneyMessages[nIndex].m_fOpacity = fOpacity;
} }
void CSpecialParticleStuff::CreateFoamAroundObject(CMatrix* pMatrix, float innerFw, float innerRg, float innerUp, int32 particles)
{
int attempts = 0;
float outerFw = innerFw + 5.0f;
float outerRg = innerRg + 5.0f;
float outerUp = innerUp + 5.0f;
while (particles > 0 && attempts < 1000) {
CVector pos;
int rnd = CGeneral::GetRandomNumber();
pos.x = (int8)(rnd - 128) / 110.0f;
pos.y = (int8)((rnd >> 8) - 128) / 110.0f;
pos.z = 0.0f;
if (DotProduct2D(pos, TheCamera.GetForward()) >= 0)
continue;
pos += pMatrix->GetPosition();
pos.z = 2.0f;
// was there any point in adding it here?
float fw = DotProduct(pMatrix->GetForward(), pos - pMatrix->GetPosition());
if (fw >= outerFw)
continue;
float rg = DotProduct(pMatrix->GetRight(), pos - pMatrix->GetPosition());
if (rg >= outerRg)
continue;
float up = DotProduct(pMatrix->GetUp(), pos - pMatrix->GetPosition());
if (up >= outerUp)
continue;
if (fw > innerFw || rg > innerRg || up > innerUp) {
CParticle::AddParticle(PARTICLE_STEAM2, pos, CVector(0.0f, 0.0f, 0.0f), nil, 4.0f, 1, 0, 0, 0);
particles--;
}
}
}
void CSpecialParticleStuff::StartBoatFoamAnimation()
{
BoatFromStart = CTimer::GetTimeInMilliseconds();
}
CRGBA FoamColour(255, 255, 255, 255);
unsigned int CSpecialParticleStuff::BoatFromStart;
void CSpecialParticleStuff::UpdateBoatFoamAnimation(CMatrix* pMatrix)
{
static int32 FrameInAnimation = 0;
static float X, Y, Z, dX, dY, dZ;
CreateFoamAroundObject(pMatrix, 107.0f, 24.1f, 30.5f, 2);
uint32 prev = CTimer::GetPreviousTimeInMilliseconds();
uint32 cur = CTimer::GetTimeInMilliseconds();
if (FrameInAnimation != 0) {
X += dX;
Y += dY;
Z += dZ;
CVector pos = *pMatrix * CVector(X, Y, Z);
CParticle::AddParticle(PARTICLE_STEAM_NY, pos, CVector(0.0f, 0.0f, 0.0f),
nil, FrameInAnimation * 0.5f + 2.0f, FoamColour, 1, 0, 0, 0);
if (++FrameInAnimation)
FrameInAnimation = 0;
}
if ((cur & 0x3FF) < (prev & 0x3FF)) {
FrameInAnimation = 1;
int rnd = CGeneral::GetRandomNumber();
X = (int8)(rnd - 128) * 0.2f;
Y = (int8)((rnd >> 8) - 128) * 0.2f;
Z = 10.0f;
rnd = CGeneral::GetRandomNumber();
dX = (int8)(rnd - 128) * 0.02f;
dY = (int8)((rnd >> 8) - 128) * 0.02f;
dZ = 2.0f;
}
}
STARTPATCHES STARTPATCHES
InjectHook(0x51B070, &C3dMarker::AddMarker, PATCH_JUMP); InjectHook(0x51B070, &C3dMarker::AddMarker, PATCH_JUMP);
InjectHook(0x51B170, &C3dMarker::DeleteMarkerObject, PATCH_JUMP); InjectHook(0x51B170, &C3dMarker::DeleteMarkerObject, PATCH_JUMP);

View file

@ -1,5 +1,7 @@
#pragma once #pragma once
#include "rwplcore.h"
class CSpecialFX class CSpecialFX
{ {
public: public:
@ -109,4 +111,13 @@ public:
static void Init(); static void Init();
static void Render(); static void Render();
static void RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8 bGreen, uint8 bBlue, float fSize, float fOpacity); static void RegisterOne(CVector vecPos, const char *pText, uint8 bRed, uint8 bGreen, uint8 bBlue, float fSize, float fOpacity);
}; };
class CSpecialParticleStuff
{
static uint32 BoatFromStart;
public:
static void CreateFoamAroundObject(CMatrix*, float, float, float, int32);
static void StartBoatFoamAnimation();
static void UpdateBoatFoamAnimation(CMatrix*);
};