Merge pull request #285 from Nick007J/script_dev

600-799 script commands; bug fixes
This commit is contained in:
erorcun 2020-01-07 17:08:51 +03:00 committed by GitHub
commit 18de44e038
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 3101 additions and 133 deletions

View File

@ -953,7 +953,7 @@ void CCarCtrl::SlowCarDownForPedsSectorList(CPtrList& lst, CVehicle* pVehicle, f
if (visibilityAngle > PI)
visibilityAngle = TWOPI - visibilityAngle;
if (visibilityAngle < HALFPI || pVehicle->m_nCarHornTimer){
/* if ped sees the danger of if car horn is on */
/* if ped sees the danger or if car horn is on */
pPed->SetFlee(pVehicle, 2000);
pPed->bUsePedNodeSeek = false;
pPed->SetMoveState(PEDMOVE_RUN);

View File

@ -4,6 +4,7 @@
#include "Vehicle.h"
#define GAME_SPEED_TO_METERS_PER_SECOND 50.0f
#define METERS_PER_SECOND_TO_GAME_SPEED (1.0f / GAME_SPEED_TO_METERS_PER_SECOND)
#define GAME_SPEED_TO_CARAI_SPEED 60.0f
#define TIME_COPS_WAIT_TO_EXIT_AFTER_STOPPING 2500

View File

@ -6,7 +6,9 @@
#include "Timer.h"
#include "Font.h"
#include "Messages.h"
#include "PlayerPed.h"
#include "Text.h"
#include "World.h"
int32 &CGarages::BankVansCollected = *(int32 *)0x8F1B34;
bool &CGarages::BombsAreFree = *(bool *)0x95CD7A;
@ -25,6 +27,8 @@ bool &CGarages::PlayerInGarage = *(bool *)0x95CD83;
int32 &CGarages::PoliceCarsCollected = *(int32 *)0x941444;
uint32 &CGarages::GarageToBeTidied = *(uint32 *)0x623570;
CGarage(&CGarages::Garages)[NUM_GARAGES] = *(CGarage(*)[NUM_GARAGES])(uintptr*)0x72BCD0;
WRAPPER void CGarages::Init(void) { EAXJMP(0x421C60); }
WRAPPER void CGarages::Update(void) { EAXJMP(0x421E40); }
@ -78,6 +82,35 @@ WRAPPER void CGarages::PlayerArrestedOrDied() { EAXJMP(0x427F60); }
WRAPPER int16 CGarages::AddOne(float, float, float, float, float, float, uint8, uint32) { EAXJMP(0x421FA0); }
WRAPPER void CGarages::SetTargetCarForMissonGarage(int16, CVehicle*) { EAXJMP(0x426BD0); }
WRAPPER bool CGarages::HasCarBeenDroppedOffYet(int16) { EAXJMP(0x426C20); }
WRAPPER void CGarages::DeActivateGarage(int16) { EAXJMP(0x426C40); }
WRAPPER void CGarages::ActivateGarage(int16) { EAXJMP(0x426C60); }
int32 CGarages::QueryCarsCollected(int16 garage)
{
return 0;
}
void CGarages::GivePlayerDetonator()
{
FindPlayerPed()->GiveWeapon(WEAPONTYPE_DETONATOR, 1);
FindPlayerPed()->m_weapons[FindPlayerPed()->GetWeaponSlot(WEAPONTYPE_DETONATOR)].m_eWeaponState = WEAPONSTATE_READY;
}
WRAPPER bool CGarages::HasThisCarBeenCollected(int16 garage, uint8 id) { EAXJMP(0x426D50); }
WRAPPER void CGarages::ChangeGarageType(int16 garage, eGarageType type) { EAXJMP(0x4222A0); }
WRAPPER bool CGarages::HasResprayHappened(int16 garage) { EAXJMP(0x4274F0); }
void CGarage::OpenThisGarage()
{
if (m_eGarageState == GS_FULLYCLOSED || m_eGarageState == GS_CLOSING || m_eGarageState == GS_CLOSEDCONTAINSCAR)
m_eGarageState = GS_OPENING;
}
void CGarage::CloseThisGarage()
{
if (m_eGarageState == GS_OPENED || m_eGarageState == GS_OPENING)
m_eGarageState = GS_CLOSING;
}
#if 0
WRAPPER void CGarages::PrintMessages(void) { EAXJMP(0x426310); }

View File

@ -1,7 +1,113 @@
#pragma once
#include "Automobile.h"
#include "audio_enums.h"
#include "config.h"
class CVehicle;
enum eGarageState : int8
{
GS_FULLYCLOSED,
GS_OPENED,
GS_CLOSING,
GS_OPENING,
GS_OPENEDCONTAINSCAR,
GS_CLOSEDCONTAINSCAR,
GS_AFTERDROPOFF,
};
enum eGarageType : int8
{
GARAGE_NONE,
GARAGE_MISSION,
GARAGE_BOMBSHOP1,
GARAGE_BOMBSHOP2,
GARAGE_BOMBSHOP3,
GARAGE_RESPRAY,
GARAGE_COLLECTORSITEMS,
GARAGE_COLLECTSPECIFICCARS,
GARAGE_COLLECTCARS_1,
GARAGE_COLLECTCARS_2,
GARAGE_COLLECTCARS_3,
GARAGE_FORCARTOCOMEOUTOF,
GARAGE_60SECONDS,
GARAGE_CRUSHER,
GARAGE_MISSION_KEEPCAR,
GARAGE_FOR_SCRIPT_TO_OPEN,
GARAGE_HIDEOUT_ONE,
GARAGE_HIDEOUT_TWO,
GARAGE_HIDEOUT_THREE,
GARAGE_FOR_SCRIPT_TO_OPEN_AND_CLOSE,
GARAGE_KEEPS_OPENING_FOR_SPECIFIC_CAR,
GARAGE_MISSION_KEEPCAR_REMAINCLOSED,
};
class CStoredCar
{
int32 m_nModelIndex;
CVector m_vecPos;
CVector m_vecAngle;
int32 m_bBulletproof : 1;
int32 m_bFireproof : 1;
int32 m_bExplosionproof : 1;
int32 m_bCollisionproof : 1;
int32 m_bMeleeproof : 1;
int8 m_nPrimaryColor;
int8 m_nSecondaryColor;
int8 m_nRadioStation;
int8 m_nVariationA;
int8 m_nVariationB;
int8 m_nCarBombType;
};
static_assert(sizeof(CStoredCar) == 0x28, "CStoredCar");
class CGarage
{
eGarageType m_eGarageType;
eGarageState m_eGarageState;
char field_2;
char m_bClosingWithoutTargetCar;
char m_bDeactivated;
char m_bResprayHappened;
char field_6;
char field_7;
int m_nTargetModelIndex;
CEntity *m_pDoor1;
CEntity *m_pDoor2;
char m_bDoor1PoolIndex;
char m_bDoor2PoolIndex;
char m_bIsDoor1Object;
char m_bIsDoor2Object;
char field_24;
char m_bRotatedDoor;
char m_bCameraFollowsPlayer;
char field_27;
CVector m_vecInf;
CVector m_vecSup;
float m_fDoorPos;
float m_fDoorHeight;
float m_fDoor1X;
float m_fDoor1Y;
float m_fDoor2X;
float m_fDoor2Y;
float m_fDoor1Z;
float m_fDoor2Z;
int m_nDoorOpenTime;
char m_bCollectedCarsState;
char field_89;
char field_90;
char field_91;
CVehicle *m_pTarget;
int field_96;
CStoredCar m_sStoredCar;
public:
void OpenThisGarage();
void CloseThisGarage();
};
static_assert(sizeof(CGarage) == 140, "CGarage");
class CGarages
{
public:
@ -21,6 +127,7 @@ public:
static bool &PlayerInGarage;
static int32 &PoliceCarsCollected;
static uint32 &GarageToBeTidied;
static CGarage(&Garages)[NUM_GARAGES];
public:
static bool IsModelIndexADoor(uint32 id);
@ -35,4 +142,11 @@ public:
static int16 AddOne(float, float, float, float, float, float, uint8, uint32);
static void SetTargetCarForMissonGarage(int16, CVehicle*);
static bool HasCarBeenDroppedOffYet(int16);
static void ActivateGarage(int16);
static void DeActivateGarage(int16);
static int32 QueryCarsCollected(int16);
static bool HasThisCarBeenCollected(int16, uint8);
static void ChangeGarageType(int16, eGarageType);
static bool HasResprayHappened(int16);
static void GivePlayerDetonator();
};

View File

@ -46,8 +46,21 @@ uint8 aWeaponGreens[] = { 0, 255, 128, 255, 0, 255, 128, 255, 0, 255, 255, 0, 25
uint8 aWeaponBlues[] = { 0, 0, 255, 0, 255, 255, 0, 128, 255, 0, 255, 0, 128, 255, 0, 0 };
float aWeaponScale[] = { 1.0f, 2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, 1.0f, 1.0f, 1.0f };
WRAPPER void CPacManPickups::Render(void) { EAXJMP(0x432F60); }
WRAPPER void CPacManPickups::Init(void) { EAXJMP(0x432760); }
WRAPPER void CPacManPickups::Update(void) { EAXJMP(0x432800); }
WRAPPER void CPacManPickups::GeneratePMPickUps(CVector, float, int16, uint8) { EAXJMP(0x432AE0); }
WRAPPER void CPacManPickups::GeneratePMPickUpsForRace(int32) { EAXJMP(0x432D50); }
WRAPPER void CPacManPickups::GenerateOnePMPickUp(CVector) { EAXJMP(0x432F20); }
WRAPPER void CPacManPickups::Render(void) { EAXJMP(0x432F60); }
WRAPPER void CPacManPickups::DoCleanUpPacManStuff(void) { EAXJMP(0x433150); }
WRAPPER void CPacManPickups::StartPacManRace(int32) { EAXJMP(0x433340); }
WRAPPER void CPacManPickups::StartPacManRecord(void) { EAXJMP(0x433360); }
WRAPPER uint32 CPacManPickups::QueryPowerPillsEatenInRace(void) { EAXJMP(0x4333A0); }
WRAPPER void CPacManPickups::ResetPowerPillsEatenInRace(void) { EAXJMP(0x4333B0); }
WRAPPER void CPacManPickups::CleanUpPacManStuff(void) { EAXJMP(0x4333C0); }
WRAPPER void CPacManPickups::StartPacManScramble(CVector, float, int16) { EAXJMP(0x4333D0); }
WRAPPER uint32 CPacManPickups::QueryPowerPillsCarriedByPlayer(void) { EAXJMP(0x4333F0); }
WRAPPER void CPacManPickups::ResetPowerPillsCarriedByPlayer(void) { EAXJMP(0x433410); }
void

View File

@ -105,6 +105,20 @@ extern uint16 CostOfWeapon[20];
class CPacManPickups
{
public:
static void Render(void);
static void Init(void);
static void Update(void);
static void GeneratePMPickUps(CVector, float, int16, uint8);
static void GeneratePMPickUpsForRace(int32);
static void GenerateOnePMPickUp(CVector);
static void Render(void);
static void DoCleanUpPacManStuff(void);
static void StartPacManRace(int32);
static void StartPacManRecord(void);
static uint32 QueryPowerPillsEatenInRace(void);
static void ResetPowerPillsEatenInRace(void);
static void CleanUpPacManStuff(void);
static void StartPacManScramble(CVector, float, int16);
static uint32 QueryPowerPillsCarriedByPlayer(void);
static void ResetPowerPillsCarriedByPlayer(void);
};

View File

@ -1,6 +1,7 @@
#include "common.h"
#include "patcher.h"
#include "Game.h"
#include "General.h"
#include "World.h"
#include "Entity.h"
#include "Population.h"
@ -79,6 +80,12 @@ CPopulation::RemovePed(CEntity* ent)
delete ent;
}
int32
CPopulation::ChooseCivilianOccupation(int32 group)
{
return ms_pPedGroups[group].models[CGeneral::GetRandomNumberInRange(0, 8)];
}
STARTPATCHES
InjectHook(0x4F3770, CPopulation::Initialise, PATCH_JUMP);
ENDPATCHES

View File

@ -47,4 +47,5 @@ public:
static CPed *AddPedInCar(CVehicle *vehicle);
static bool IsPointInSafeZone(CVector *coors);
static void RemovePed(CEntity* ent);
static int32 ChooseCivilianOccupation(int32);
};

View File

@ -10,4 +10,6 @@ WRAPPER void CRecordDataForGame::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0
WRAPPER void CRecordDataForChase::SaveOrRetrieveDataForThisFrame(void) { EAXJMP(0x4347F0); }
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::CleanUpChaseScene() { EAXJMP(0x4357C0); }

View File

@ -14,6 +14,8 @@ public:
static void SaveOrRetrieveDataForThisFrame(void);
static void ProcessControlCars(void);
static void SaveOrRetrieveCarPositions(void);
static void StartChaseScene(float);
static void CleanUpChaseScene();
};

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
#pragma once
#include "common.h"
#include "PedType.h"
#include "Text.h"
#include "Sprite2d.h"
@ -8,6 +9,7 @@ class CBuilding;
class CVehicle;
class CPed;
class CObject;
class CPlayerInfo;
struct CScriptRectangle
{
@ -91,6 +93,29 @@ public:
m_anLocalVariables[NUM_LOCAL_VARS + 1] += timeStep;
}
bool ThisIsAValidRandomPed(uint32 pedtype){
switch (pedtype){
case PEDTYPE_CIVMALE:
case PEDTYPE_CIVFEMALE:
case PEDTYPE_GANG1:
case PEDTYPE_GANG2:
case PEDTYPE_GANG3:
case PEDTYPE_GANG4:
case PEDTYPE_GANG5:
case PEDTYPE_GANG6:
case PEDTYPE_GANG7:
case PEDTYPE_GANG8:
case PEDTYPE_GANG9:
case PEDTYPE_CRIMINAL:
case PEDTYPE_PROSTITUTE:
return true;
default:
return false;
}
}
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
void CollectParameters(uint32*, int16);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
@ -339,6 +364,9 @@ public:
static void Process();
static CRunningScript* StartTestScript();
static bool IsPlayerOnAMission();
static bool IsPedStopped(CPed*);
static bool IsPlayerStopped(CPlayerInfo*);
static bool IsVehicleStopped(CVehicle*);
static void ReadObjectNamesFromScript();
static void UpdateObjectIndices();
@ -348,7 +376,7 @@ public:
static void HighlightImportantArea(uint32, float, float, float, float, float);
static void DrawDebugSquare(float, float, float, float);
static void DrawDebugCube(float, float, float, float, float, float);
static bool IsVehicleStopped(CVehicle*);
static void AddToInvisibilitySwapArray(CEntity*, bool);
static int32 Read4BytesFromScript(uint32* pIp){
int32 retval = 0;

View File

@ -33,6 +33,8 @@ WRAPPER void CCamera::LoadPathSplines(int file) { EAXJMP(0x46D1D0); }
WRAPPER uint32 CCamera::GetCutSceneFinishTime(void) { EAXJMP(0x46B920); }
WRAPPER void CCamera::FinishCutscene(void) { EAXJMP(0x46B560); }
WRAPPER void CCamera::RestoreWithJumpCut(void) { EAXJMP(0x46FAE0); };
WRAPPER void CCamera::SetZoomValueFollowPedScript(int16) { EAXJMP(0x46FF30); }
WRAPPER void CCamera::SetZoomValueCamStringScript(int16) { EAXJMP(0x46FF90); }
bool
CCamera::GetFading()
@ -1357,6 +1359,14 @@ void CCamera::SetCameraDirectlyInFrontForFollowPed_CamOnAString()
m_PedOrientForBehindOrInFront = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y);
}
void CCamera::SetCameraDirectlyBehindForFollowPed_CamOnAString()
{
m_bCamDirectlyBehind = true;
CPlayerPed *player = FindPlayerPed();
if (player)
m_PedOrientForBehindOrInFront = CGeneral::GetATanOfXY(player->GetForward().x, player->GetForward().y);
}
void
CCamera::SetWideScreenOn(void)
{

View File

@ -491,6 +491,9 @@ int m_iModeObbeCamIsInForCar;
void TakeControlWithSpline(short);
void RestoreWithJumpCut(void);
void SetCameraDirectlyInFrontForFollowPed_CamOnAString(void);
void SetCameraDirectlyBehindForFollowPed_CamOnAString(void);
void SetZoomValueFollowPedScript(int16);
void SetZoomValueCamStringScript(int16);
void dtor(void) { this->CCamera::~CCamera(); }
};

View File

@ -4,6 +4,7 @@
WRAPPER void CExplosion::AddExplosion(CEntity *explodingEntity, CEntity *culprit, eExplosionType type, const CVector &pos, uint32) { EAXJMP(0x5591C0); }
WRAPPER void CExplosion::RemoveAllExplosionsInArea(CVector, float) { EAXJMP(0x55AD40); }
WRAPPER bool CExplosion::TestForExplosionInArea(eExplosionType, float, float, float, float, float, float) { EAXJMP(0x55AC80); }
WRAPPER
int8 CExplosion::GetExplosionActiveCounter(uint8 id)

View File

@ -28,4 +28,5 @@ public:
static uint8 GetExplosionType(uint8 id);
static void ResetExplosionActiveCounter(uint8 id);
static void RemoveAllExplosionsInArea(CVector, float);
static bool TestForExplosionInArea(eExplosionType, float, float, float, float, float, float);
};

View File

@ -5,10 +5,14 @@
CFireManager &gFireManager = *(CFireManager*)0x8F31D0;
WRAPPER void CFire::Extinguish(void) { EAXJMP(0x479D40); }
WRAPPER void CFireManager::StartFire(CEntity* entityOnFire, CEntity* culprit, float, uint32) { EAXJMP(0x479590); }
WRAPPER void CFireManager::Update(void) { EAXJMP(0x479310); }
WRAPPER CFire* CFireManager::FindFurthestFire_NeverMindFireMen(CVector coors, float, float) { EAXJMP(0x479430); }
uint32 CFireManager::GetTotalActiveFires() const
{
return m_nTotalFires;
}
CFire* CFireManager::FindNearestFire(CVector vecPos, float* pDistance)
{
for (int i = 0; i < MAX_FIREMEN_ATTENDING; i++) {
@ -45,7 +49,16 @@ CFireManager::ExtinguishPoint(CVector point, float range)
}
}
WRAPPER void CFireManager::StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32) { EAXJMP(0x479590); }
WRAPPER void CFireManager::StartFire(CVector, float, uint8) { EAXJMP(0x479500); }
WRAPPER int32 CFireManager::StartScriptFire(const CVector& pos, CEntity* culprit, float, uint8) { EAXJMP(0x479E60); }
WRAPPER bool CFireManager::IsScriptFireExtinguish(int16) { EAXJMP(0x479FC0); }
WRAPPER void CFireManager::RemoveScriptFire(int16) { EAXJMP(0x479FE0); }
WRAPPER void CFireManager::RemoveAllScriptFires(void) { EAXJMP(0x47A000); }
WRAPPER void CFireManager::SetScriptFireAudio(int16, bool) { EAXJMP(0x47A040); }
STARTPATCHES
InjectHook(0x479DB0, &CFireManager::ExtinguishPoint, PATCH_JUMP);
InjectHook(0x479340, &CFireManager::FindNearestFire, PATCH_JUMP);
ENDPATCHES
ENDPATCHES

View File

@ -31,11 +31,16 @@ class CFireManager
CFire m_aFires[NUM_FIRES];
public:
void StartFire(CEntity *entityOnFire, CEntity *culprit, float, uint32);
void StartFire(CVector, float, uint8);
void Update(void);
CFire *FindFurthestFire_NeverMindFireMen(CVector coors, float, float);
CFire *FindNearestFire(CVector, float*);
uint32 GetTotalActiveFires() const;
void ExtinguishPoint(CVector, float);
uint32 GetTotalActiveFires() const { return m_nTotalFires; }
int32 StartScriptFire(const CVector& pos, CEntity* culprit, float, uint8);
bool IsScriptFireExtinguish(int16);
void RemoveScriptFire(int16);
void RemoveAllScriptFires(void);
void SetScriptFireAudio(int16, bool);
};
extern CFireManager &gFireManager;

View File

@ -5,6 +5,7 @@ int32 &CStats::DaysPassed = *(int32*)0x8F2BB8;
int32 &CStats::HeadsPopped = *(int32*)0x8F647C;
bool& CStats::CommercialPassed = *(bool*)0x8F4334;
bool& CStats::IndustrialPassed = *(bool*)0x8E2A68;
bool& CStats::SuburbanPassed = *(bool*)0x8F2740;
int32 &CStats::NumberKillFrenziesPassed = *(int32*)0x8E287C;
int32 &CStats::PeopleKilledByOthers = *(int32*)0x8E2C50;
int32 &CStats::HelisDestroyed = *(int32*)0x8E2A64;
@ -14,6 +15,21 @@ int32 &CStats::TimesArrested = *(int32*)0x8E2BEC;
int32 &CStats::KillsSinceLastCheckpoint = *(int32*)0x8F2C8C;
int32& CStats::DistanceTravelledInVehicle = *(int32*)0x940574;
int32& CStats::DistanceTravelledOnFoot = *(int32*)0x941518;
int32 &CStats::ProgressMade = *(int32*)0x8F6224;
int32 &CStats::TotalProgressInGame = *(int32*)0x885B2C;
float &CStats::MaximumJumpDistance = *(float*)0x8F2BDC;
float &CStats::MaximumJumpHeight = *(float*)0x940564;
int32 &CStats::MaximumJumpFlips = *(int32*)0x8F2524;
int32 &CStats::MaximumJumpSpins = *(int32*)0x8F29B0;
int32 &CStats::BestStuntJump = *(int32*)0x885B50;
int32 &CStats::NumberOfUniqueJumpsFound = *(int32*)0x885B74;
int32 &CStats::TotalNumberOfUniqueJumps = *(int32*)0x8E2DC0;
int32 &CStats::PassengersDroppedOffWithTaxi = *(int32*)0x940724;
int32 &CStats::MoneyMadeWithTaxi = *(int32*)0x941544;
int32 &CStats::MissionsGiven = *(int32*)0x9430E8;
int32 &CStats::MissionsPassed = *(int32*)0x940768;
char(&CStats::LastMissionPassedName)[8] = *(char(*)[8])*(uintptr*)0x70D828;
int32 &CStats::TotalLegitimateKills = *(int32*)0x8F6004;
void CStats::AnotherKillFrenzyPassed()
{

View File

@ -7,6 +7,7 @@ public:
static int32 &HeadsPopped;
static bool& CommercialPassed;
static bool& IndustrialPassed;
static bool& SuburbanPassed;
static int32 &NumberKillFrenziesPassed;
static int32 &PeopleKilledByOthers;
static int32 &HelisDestroyed;
@ -16,8 +17,24 @@ public:
static int32 &KillsSinceLastCheckpoint;
static int32 &DistanceTravelledInVehicle;
static int32 &DistanceTravelledOnFoot;
static int32 &ProgressMade;
static int32 &TotalProgressInGame;
static float &MaximumJumpDistance;
static float &MaximumJumpHeight;
static int32 &MaximumJumpFlips;
static int32 &MaximumJumpSpins;
static int32 &BestStuntJump;
static int32 &NumberOfUniqueJumpsFound;
static int32 &TotalNumberOfUniqueJumps;
static int32 &PassengersDroppedOffWithTaxi;
static int32 &MoneyMadeWithTaxi;
static int32 &MissionsGiven;
static int32 &MissionsPassed;
static char (&LastMissionPassedName)[8];
static int32 &TotalLegitimateKills;
public:
static void AnotherKillFrenzyPassed();
static void CheckPointReachedUnsuccessfully() { KillsSinceLastCheckpoint = 0; };
static void CheckPointReachedSuccessfully() { TotalLegitimateKills += KillsSinceLastCheckpoint; KillsSinceLastCheckpoint = 0; };
};

View File

@ -44,6 +44,10 @@ WRAPPER void CWorld::RemoveStaticObjects() { EAXJMP(0x4B4D50); }
WRAPPER void CWorld::RemoveReferencesToDeletedObject(CEntity*) { EAXJMP(0x4B3BF0); }
WRAPPER void CWorld::FindObjectsKindaColliding(const CVector &, float, bool, int16*, int16, CEntity **, bool, bool, bool, bool, bool){ EAXJMP(0x4B2A30); }
WRAPPER void CWorld::ClearExcitingStuffFromArea(const CVector &pos, float radius, uint8) { EAXJMP(0x4B4E70) };
WRAPPER void CWorld::FindObjectsIntersectingCube(const CVector &, const CVector &, int16*, int16, CEntity **, bool, bool, bool, bool, bool) { EAXJMP(0x4B2E70); }
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::FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**) { EAXJMP(0x4B2960); }
void
CWorld::Initialise()
@ -960,7 +964,7 @@ CWorld::RemoveFallenPeds(void)
for(int poolIndex = poolSize-1; poolIndex >= 0; poolIndex--) {
CPed *ped = CPools::GetPedPool()->GetSlot(poolIndex);
if (ped) {
if (ped->GetPosition().z < -100.0f) {
if (ped->GetPosition().z < MAP_Z_LOW_LIMIT) {
if (ped->CharCreatedBy != RANDOM_CHAR || ped->IsPlayer()) {
int closestNode = ThePaths.FindNodeClosestToCoors(ped->GetPosition(), PATH_PED, 999999.9f, false, false);
CVector newPos = ThePaths.m_pathNodes[closestNode].pos;
@ -982,7 +986,7 @@ CWorld::RemoveFallenCars(void)
for (int poolIndex = poolSize - 1; poolIndex >= 0; poolIndex--) {
CVehicle* veh = CPools::GetVehiclePool()->GetSlot(poolIndex);
if (veh) {
if (veh->GetPosition().z < -100.0f) {
if (veh->GetPosition().z < MAP_Z_LOW_LIMIT) {
if (veh->VehicleCreatedBy == MISSION_VEHICLE || veh == FindPlayerVehicle() || (veh->pDriver && veh->pDriver->IsPlayer())) {
int closestNode = ThePaths.FindNodeClosestToCoors(veh->GetPosition(), PATH_CAR, 999999.9f, false, false);
CVector newPos = ThePaths.m_pathNodes[closestNode].pos;

View File

@ -22,6 +22,8 @@
#define WORLD_MAX_X (WORLD_MIN_X + WORLD_SIZE_X)
#define WORLD_MAX_Y (WORLD_MIN_Y + WORLD_SIZE_Y)
#define MAP_Z_LOW_LIMIT -100.0f
enum
{
ENTITYLIST_BUILDINGS,
@ -103,11 +105,15 @@ public:
static CEntity *TestSphereAgainstSectorList(CPtrList&, CVector, float, CEntity*, bool);
static void FindObjectsInRangeSectorList(CPtrList&, CVector&, float, bool, short*, short, CEntity**);
static void FindObjectsInRange(CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
static void FindObjectsOfTypeInRangeSectorList(uint32, CPtrList&, CVector&, float, bool, short*, short, CEntity**);
static void FindObjectsOfTypeInRange(uint32, CVector&, float, bool, short*, short, CEntity**, bool, bool, bool, bool, bool);
static float FindGroundZForCoord(float x, float y);
static float FindGroundZFor3DCoord(float x, float y, float z, bool *found);
static float FindRoofZFor3DCoord(float x, float y, float z, bool *found);
static void RemoveReferencesToDeletedObject(CEntity*);
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 FindObjectsIntersectingAngledCollisionBox(const CColBox &, const CMatrix &, const CVector &, float, float, float, float, int16*, int16, CEntity **, bool, bool, bool, bool, bool);
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); }

View File

@ -134,14 +134,16 @@ CCullZones::FindAttributesForCoors(CVector coors, int32 *wantedLevel)
int i;
int32 attribs;
if (wantedLevel)
*wantedLevel = 0;
attribs = 0;
for(i = 0; i < NumAttributeZones; i++)
if(coors.x >= aAttributeZones[i].minx && coors.x <= aAttributeZones[i].maxx &&
coors.y >= aAttributeZones[i].miny && coors.y <= aAttributeZones[i].maxy &&
coors.z >= aAttributeZones[i].minz && coors.z <= aAttributeZones[i].maxz){
attribs |= aAttributeZones[i].attributes;
if(wantedLevel && *wantedLevel <= aAttributeZones[i].wantedLevel)
*wantedLevel = aAttributeZones[i].wantedLevel;
if(wantedLevel)
*wantedLevel = max(*wantedLevel, aAttributeZones[i].wantedLevel);
}
return attribs;
}

View File

@ -85,6 +85,7 @@ enum Config {
NUM_ACCIDENTS = 20,
NUM_FIRES = 40,
NUM_GARAGES = 32,
NUMPEDROUTES = 200,
NUMPHONES = 50,

View File

@ -9,6 +9,8 @@
WRAPPER void CObject::ObjectDamage(float amount) { EAXJMP(0x4BB240); }
WRAPPER void CObject::DeleteAllTempObjectInArea(CVector, float) { EAXJMP(0x4BBED0); }
WRAPPER void CObject::Init(void) { EAXJMP(0x4BAEC0); }
WRAPPER void CObject::ProcessControl(void) { EAXJMP(0x4BB040); }
WRAPPER void CObject::Teleport(CVector) { EAXJMP(0x4BBDA0); }
int16 &CObject::nNoTempObjects = *(int16*)0x95CCA2;
int16 &CObject::nBodyCastHealth = *(int16*)0x5F7D4C; // 1000

View File

@ -71,6 +71,8 @@ public:
CObject(int32, bool);
~CObject(void);
void ProcessControl(void);
void Teleport(CVector);
void Render(void);
bool SetupLighting(void);
void RemoveLighting(bool reset);

View File

@ -497,7 +497,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bChangedSeat = false;
bUpdateAnimHeading = false;
bBodyPartJustCameOff = false;
m_ped_flagC40 = false;
bIsShooting = false;
bFindNewNodeAfterStateRestore = false;
bHasACamera = false;
@ -519,8 +519,8 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bFleeAfterExitingCar = false;
bWanderPathAfterExitingCar = false;
m_ped_flagF2 = false;
m_ped_flagF4 = false;
bIsLeader = false;
bDontDragMeOutCar = false;
m_ped_flagF8 = false;
bWillBeQuickJacked = false;
bCancelEnteringCar = false;
@ -528,7 +528,7 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
bDuckAndCover = false;
bStillOnValidPoly = false;
m_ped_flagG2 = true;
bAllowMedicsToReviveMe = true;
bResetWalkAnims = false;
bStartWanderPathOnFoot = false;
bOnBoat = false;
@ -538,12 +538,12 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_ped_flagH1 = false;
bHitSteepSlope = false;
m_ped_flagH4 = false;
bCullExtraFarAway = false;
bClearObjective = false;
bTryingToReachDryLand = false;
bCollidedWithMyVehicle = false;
bRichFromMugging = false;
m_ped_flagH80 = false;
bChrisCriminal = false;
bShakeFist = false;
bNoCriticalHits = false;
@ -7731,7 +7731,7 @@ CPed::GetNearestDoor(CVehicle *veh, CVector &posToOpen)
CPed *rfPassenger = veh->pPassengers[0];
if (!rfPassenger
|| rfPassenger->m_leader != this && !rfPassenger->m_ped_flagF4 && (veh->VehicleCreatedBy != MISSION_VEHICLE || m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER)
|| rfPassenger->m_leader != this && !rfPassenger->bDontDragMeOutCar && (veh->VehicleCreatedBy != MISSION_VEHICLE || m_objective != OBJECTIVE_ENTER_CAR_AS_DRIVER)
|| veh->IsRoomForPedToLeaveCar(CAR_DOOR_LF, enterOffset) == 0) {
if ((veh->m_nGettingInFlags & CAR_DOOR_FLAG_RF) == 0
@ -9223,7 +9223,7 @@ CPed::ProcessControl(void)
}
CVisibilityPlugins::SetClumpAlpha(GetClump(), alpha);
m_ped_flagC40 = false;
bIsShooting = false;
BuildPedLists();
bIsInWater = false;
ProcessBuoyancy();
@ -10776,7 +10776,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
}
if (ped->m_vehEnterType != CAR_DOOR_LF && ped->m_vehEnterType != CAR_DOOR_LR) {
if (pedToDragOut && !pedToDragOut->m_ped_flagF4) {
if (pedToDragOut && !pedToDragOut->bDontDragMeOutCar) {
if (pedToDragOut->m_nPedState != PED_DRIVING) {
ped->QuitEnteringCar();
pedToDragOut = nil;
@ -10807,9 +10807,9 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
}
} else {
if (pedToDragOut) {
if (pedToDragOut->m_nPedState != PED_DRIVING || pedToDragOut->m_ped_flagF4) {
if (pedToDragOut->m_nPedState != PED_DRIVING || pedToDragOut->bDontDragMeOutCar) {
// BUG: Player freezes in that condition due to it's objective isn't restored. It's an unfinished feature, used in VC.
// BUG: Player freezes in that condition due to its objective isn't restored. It's an unfinished feature, used in VC.
ped->QuitEnteringCar();
pedToDragOut = nil;
} else {
@ -15860,7 +15860,7 @@ CPed::SeekCar(void)
break;
case STATUS_ABANDONED:
if (m_vehEnterType == CAR_DOOR_RF && vehToSeek->pPassengers[0]) {
if (vehToSeek->pPassengers[0]->m_ped_flagF4) {
if (vehToSeek->pPassengers[0]->bDontDragMeOutCar) {
if (IsPlayer())
CPed::SetEnterCar(vehToSeek, m_vehEnterType);
} else {

View File

@ -317,7 +317,7 @@ public:
uint8 bChangedSeat : 1;
uint8 bUpdateAnimHeading : 1;
uint8 bBodyPartJustCameOff : 1;
uint8 m_ped_flagC40 : 1;
uint8 bIsShooting : 1;
uint8 bFindNewNodeAfterStateRestore : 1;
uint8 bHasACamera : 1; // does ped possess a camera to document accidents involves fire/explosion
@ -339,16 +339,16 @@ public:
uint8 bFleeAfterExitingCar : 1;
uint8 bWanderPathAfterExitingCar : 1;
uint8 m_ped_flagF2 : 1;
uint8 m_ped_flagF4 : 1; // Unfinished feature from VC, probably bDontDragMeOutCar
uint8 bIsLeader : 1;
uint8 bDontDragMeOutCar : 1; // unfinished feature
uint8 m_ped_flagF8 : 1;
uint8 bWillBeQuickJacked : 1;
uint8 bCancelEnteringCar : 1; // after door is opened or couldn't be opened due to it's locked
uint8 bObstacleShowedUpDuringKillObjective : 1;
uint8 bDuckAndCover : 1;
uint8 bStillOnValidPoly : 1;
uint8 m_ped_flagG2 : 1;
uint8 bStillOnValidPoly : 1; // set if the polygon the ped is on is still valid for collision
uint8 bAllowMedicsToReviveMe : 1;
uint8 bResetWalkAnims : 1;
uint8 bStartWanderPathOnFoot : 1; // exits the car if he's in it, reset after path found
uint8 bOnBoat : 1; // not just driver, may be just standing
@ -358,12 +358,12 @@ public:
uint8 m_ped_flagH1 : 1;
uint8 bHitSteepSlope : 1; // has ped collided/is standing on a steep slope (surface type)
uint8 m_ped_flagH4 : 1;
uint8 bCullExtraFarAway : 1; // special ped only gets culled if it's extra far away (for roadblocks)
uint8 bClearObjective : 1;
uint8 bTryingToReachDryLand : 1;
uint8 bTryingToReachDryLand : 1; // has ped just exited boat and trying to get to dry land
uint8 bCollidedWithMyVehicle : 1;
uint8 bRichFromMugging : 1; // ped has lots of cash from mugging people - will drop money if someone points gun to him
uint8 m_ped_flagH80 : 1;
uint8 bRichFromMugging : 1; // ped has lots of cash cause they've been mugging people
uint8 bChrisCriminal : 1; // Is a criminal as killed during Chris' police mission (should be counted as such)
uint8 bShakeFist : 1; // test shake hand at look entity
uint8 bNoCriticalHits : 1; // if set, limbs won't came off

View File

@ -7,6 +7,7 @@
#include "World.h"
#include "RpAnimBlend.h"
#include "General.h"
#include "Pools.h"
CPlayerPed::~CPlayerPed()
{
@ -73,6 +74,17 @@ CPlayerPed::SetWantedLevelNoDrop(int32 level)
m_pWanted->SetWantedLevelNoDrop(level);
}
void
CPlayerPed::MakeObjectTargettable(int32 handle)
{
for (int i = 0; i < ARRAY_SIZE(m_nTargettableObjects); i++) {
if (CPools::GetObjectPool()->GetAt(m_nTargettableObjects[i]) == nil) {
m_nTargettableObjects[i] = handle;
return;
}
}
}
// I don't know the actual purpose of parameter
void
CPlayerPed::AnnoyPlayerPed(bool annoyedByPassingEntity)

View File

@ -56,6 +56,7 @@ public:
void UseSprintEnergy(void);
class CPlayerInfo *GetPlayerInfoForThisPlayerPed();
void SetRealMoveAnim(void);
void MakeObjectTargettable(int32);
static void SetupPlayerPed(int32);
static void DeactivatePlayerPed(int32);

View File

@ -61,8 +61,8 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
m_fFireBlowUpTimer = 0.0f;
field_4E0 = 0;
bTaxiLight = m_sAllTaxiLights;
m_auto_flagA20 = false;
m_auto_flagA40 = false;
bFixedColour = false;
bBigWheels = false;
bWaterTight = false;
SetModelIndex(id);
@ -1090,7 +1090,7 @@ CAutomobile::ProcessControl(void)
if(m_bSirenOrAlarm && (CTimer::GetFrameCounter()&7) == 5 &&
UsesSiren(GetModelIndex()) && GetModelIndex() != MI_RCBANDIT)
UsesSiren(GetModelIndex()) && GetModelIndex() != MI_MRWHOOP)
CCarAI::MakeWayForCarWithSiren(this);

View File

@ -87,8 +87,8 @@ public:
uint8 m_bombType : 3;
uint8 bTaxiLight : 1;
uint8 bHadDriver : 1; // for bombs
uint8 m_auto_flagA20 : 1;
uint8 m_auto_flagA40 : 1;
uint8 bFixedColour : 1;
uint8 bBigWheels : 1;
uint8 bWaterTight : 1; // no damage for non-player peds
uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1;

View File

@ -2,6 +2,7 @@
#include "Physical.h"
#include "AutoPilot.h"
#include "ModelIndices.h"
class CPed;
class CFire;
@ -267,6 +268,7 @@ public:
bool IsAlarmOn(void) { return m_nAlarmState != 0 && m_nAlarmState != -1; }
CVehicleModelInfo* GetModelInfo() { return (CVehicleModelInfo*)CModelInfo::GetModelInfo(GetModelIndex()); }
bool IsTaxi(void) { return GetModelIndex() == MI_TAXI || GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_BORGNINE; }
static bool &bWheelsOnlyCheat;
static bool &bAllDodosCheat;

View File

@ -0,0 +1,5 @@
#include "common.h"
#include "patcher.h"
#include "BulletInfo.h"
WRAPPER bool CBulletInfo::TestForSniperBullet(float x1, float x2, float y1, float y2, float z1, float z2) { EAXJMP(0x558D40); }

7
src/weapons/BulletInfo.h Normal file
View File

@ -0,0 +1,7 @@
#pragma once
class CBulletInfo
{
public:
static bool TestForSniperBullet(float x1, float x2, float y1, float y2, float z1, float z2);
};

View File

@ -4,4 +4,5 @@
#include "Projectile.h"
WRAPPER void CProjectileInfo::RemoveAllProjectiles(void) { EAXJMP(0x55BB80); }
WRAPPER bool CProjectileInfo::RemoveIfThisIsAProjectile(CObject *pObject) { EAXJMP(0x55BBD0); }
WRAPPER bool CProjectileInfo::RemoveIfThisIsAProjectile(CObject *pObject) { EAXJMP(0x55BBD0); }
WRAPPER bool CProjectileInfo::IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove) { EAXJMP(0x55BA50); }

View File

@ -7,4 +7,5 @@ class CProjectileInfo
public:
static bool RemoveIfThisIsAProjectile(CObject *pObject);
static void RemoveAllProjectiles(void);
static bool IsProjectileInRange(float x1, float x2, float y1, float y2, float z1, float z2, bool remove);
};