script 800-899

This commit is contained in:
Nikolay Korolev
2020-01-03 19:48:13 +03:00
parent 42ff0f7c58
commit 0723dade76
24 changed files with 1329 additions and 132 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); }
@ -86,8 +90,27 @@ 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, int8 type) { EAXJMP(0x4222A0); }
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);
@ -39,5 +146,7 @@ public:
static void DeActivateGarage(int16);
static int32 QueryCarsCollected(int16);
static bool HasThisCarBeenCollected(int16, uint8);
static void ChangeGarageType(int16, int8); //TODO: eGarageType
static void ChangeGarageType(int16, eGarageType);
static bool HasResprayHappened(int16);
static void GivePlayerDetonator();
};

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

@ -114,6 +114,8 @@ public:
}
}
float LimitAngleOnCircle(float angle) { return angle < 0.0f ? angle + 360.0f : angle; }
void CollectParameters(uint32*, int16);
int32 CollectNextParameterWithoutIncreasingPC(uint32);
int32* GetPointerToScriptVariable(uint32*, int16);
@ -374,6 +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 void AddToInvisibilitySwapArray(CEntity*, bool);
static int32 Read4BytesFromScript(uint32* pIp){
int32 retval = 0;