Merge pull request #557 from Nick007J/miami

script and script stubs
This commit is contained in:
aap 2020-05-18 13:08:24 +02:00 committed by GitHub
commit 2d4861454c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 731 additions and 110 deletions

View File

@ -104,7 +104,7 @@ strcmpIgnoringDigits(const char *s1, const char *s2)
c2 = toupper(c2);
#endif
if(c1 != c2)
if(c1 && c2 && c1 != c2)
return false;
}
}

View File

@ -358,7 +358,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
pVehicle->AutoPilot.m_nCruiseSpeed = FindPoliceCarSpeedForWantedLevel(pVehicle);
pVehicle->SetStatus(STATUS_PHYSICS);
pVehicle->AutoPilot.m_nCarMission =
pVehicle->GetVehicleAppearance() == VEHICLE_BOAT ? FindPoliceBoatMissionForWantedLevel() : FindPoliceCarMissionForWantedLevel();
pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT ? FindPoliceBoatMissionForWantedLevel() : FindPoliceCarMissionForWantedLevel();
pVehicle->AutoPilot.m_nTempAction = TEMPACT_NONE;
pVehicle->AutoPilot.m_nDrivingStyle = DRIVINGSTYLE_AVOID_CARS;
}else if (pVehicle->AutoPilot.m_nCarMission == MISSION_CRUISE){
@ -432,7 +432,7 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
if (pVehicle->bIsLawEnforcer) {
if (pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_FARAWAY ||
pVehicle->AutoPilot.m_nCarMission == MISSION_RAMPLAYER_CLOSE) {
if (FindPlayerVehicle() && FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_BIKE)
if (FindPlayerVehicle() && FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE)
pVehicle->AutoPilot.m_nCarMission = MISSION_BLOCKPLAYER_FARAWAY;
}
}
@ -489,16 +489,16 @@ void CCarAI::UpdateCarAI(CVehicle* pVehicle)
if (pVehicle->bIsLawEnforcer && FindPlayerPed()->m_pWanted->m_nWantedLevel > 0) {
if (!FindPlayerVehicle() ||
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_CAR ||
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_BIKE) {
if (pVehicle->GetVehicleAppearance() == VEHICLE_BOAT) {
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR ||
FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) {
if (pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT) {
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000;
}
}
else if (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_BOAT) {
if (pVehicle->GetVehicleAppearance() == VEHICLE_CAR ||
pVehicle->GetVehicleAppearance() == VEHICLE_BIKE) {
else if (FindPlayerVehicle()->GetVehicleAppearance() == VEHICLE_APPEARANCE_BOAT) {
if (pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_CAR ||
pVehicle->GetVehicleAppearance() == VEHICLE_APPEARANCE_BIKE) {
pVehicle->AutoPilot.m_nTempAction = TEMPACT_WAIT;
pVehicle->AutoPilot.m_nTimeTempAction = CTimer::GetTimeInMilliseconds() + 1000;
}

View File

@ -655,10 +655,10 @@ CCarCtrl::GenerateOneRandomCar()
}
int nMadDrivers;
switch (pVehicle->GetVehicleAppearance()) {
case VEHICLE_BIKE:
case VEHICLE_APPEARANCE_BIKE:
nMadDrivers = 30;
break;
case VEHICLE_BOAT:
case VEHICLE_APPEARANCE_BOAT:
nMadDrivers = 40;
break;
default:

View File

@ -960,7 +960,7 @@ void CGarage::Update()
if (m_pDoor1) {
if (((CVector2D)FindPlayerVehicle()->GetPosition() - (CVector2D)m_pDoor1->GetPosition()).MagnitudeSqr() < SQR(DISTANCE_TO_SHOW_HIDEOUT_MESSAGE) &&
CTimer::GetTimeInMilliseconds() - CGarages::LastTimeHelpMessage > TIME_BETWEEN_HIDEOUT_MESSAGES) {
if (FindPlayerVehicle()->GetVehicleAppearance() != VEHICLE_HELI && FindPlayerVehicle()->GetVehicleAppearance() != VEHICLE_PLANE) {
if (FindPlayerVehicle()->GetVehicleAppearance() != VEHICLE_APPEARANCE_HELI && FindPlayerVehicle()->GetVehicleAppearance() != VEHICLE_APPEARANCE_PLANE) {
CHud::SetHelpMessage(TheText.Get("GA_21"), false); // You cannot store any more cars in this garage.
CGarages::LastTimeHelpMessage = CTimer::GetTimeInMilliseconds();
}

View File

@ -158,12 +158,12 @@ CPickup::GiveUsAPickUpObject(int32 handle)
}
bool
CPickup::CanBePickedUp(CPlayerPed *player)
CPickup::CanBePickedUp(CPlayerPed *player, int playerId)
{
assert(m_pObject != nil);
bool cannotBePickedUp =
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > 99.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > 99.5f)
(m_pObject->GetModelIndex() == MI_PICKUP_BODYARMOUR && player->m_fArmour > CWorld::Players[playerId].m_nMaxArmour - 0.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_HEALTH && player->m_fHealth > CWorld::Players[playerId].m_nMaxHealth - 0.5f)
|| (m_pObject->GetModelIndex() == MI_PICKUP_BRIBE && player->m_pWanted->m_nWantedLevel == 0)
|| (m_pObject->GetModelIndex() == MI_PICKUP_KILLFRENZY && (CTheScripts::IsPlayerOnAMission() || CDarkel::FrenzyOnGoing() || !CGame::nastyGame));
return !cannotBePickedUp;
@ -219,7 +219,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
}
// if we didn't then we've got nothing to do
if (isPickupTouched && CanBePickedUp(player)) {
if (isPickupTouched && CanBePickedUp(player, playerId)) {
CPad::GetPad(0)->StartShake(120, 100);
switch (m_eType)
{
@ -483,14 +483,14 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
DMAudio.PlayFrontEndSound(SOUND_PICKUP_ADRENALINE, 0);
return true;
} else if (modelIndex == MI_PICKUP_BODYARMOUR) {
player->m_fArmour = 100.0f;
player->m_fArmour = CWorld::Players[playerIndex].m_nMaxArmour;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_ARMOUR, 0);
return true;
} else if (modelIndex == MI_PICKUP_INFO) {
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
return true;
} else if (modelIndex == MI_PICKUP_HEALTH) {
player->m_fHealth = 100.0f;
player->m_fHealth = CWorld::Players[playerIndex].m_nMaxHealth;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_HEALTH, 0);
return true;
} else if (modelIndex == MI_PICKUP_BONUS) {

View File

@ -46,7 +46,7 @@ public:
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
private:
bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
inline bool CanBePickedUp(CPlayerPed *player);
inline bool CanBePickedUp(CPlayerPed *player, int playerId);
void RemoveKeepType();
void Remove();
};

File diff suppressed because it is too large Load Diff

View File

@ -221,8 +221,8 @@ enum {
};
enum {
SIZE_MAIN_SCRIPT = 128 * 1024,
SIZE_MISSION_SCRIPT = 32 * 1024,
SIZE_MAIN_SCRIPT = 225512,
SIZE_MISSION_SCRIPT = 35000,
SIZE_SCRIPT_SPACE = SIZE_MAIN_SCRIPT + SIZE_MISSION_SCRIPT
};
@ -507,4 +507,6 @@ private:
return false;
}
}
static bool ThisIsAValidRandomCop(int32 mi, bool cop, bool swat, bool fbi, bool army, bool miami);
};

View File

@ -61,6 +61,8 @@ enum
CCamera TheCamera;
bool CCamera::m_bUseMouse3rdPerson = true;
bool bDidWeProcessAnyCinemaCam;
float CCamera::m_f3rdPersonCHairMultX;
float CCamera::m_f3rdPersonCHairMultY;
#ifdef IMPROVED_CAMERA
#define KEYJUSTDOWN(k) ControlsManager.GetIsKeyboardKeyJustDown((RsKeyCodes)k)

View File

@ -472,8 +472,8 @@ public:
// not static yet
float m_fMouseAccelHorzntl;// acceleration multiplier for 1st person controls
float m_fMouseAccelVertical;// acceleration multiplier for 1st person controls
float m_f3rdPersonCHairMultX;
float m_f3rdPersonCHairMultY;
static float m_f3rdPersonCHairMultX;
static float m_f3rdPersonCHairMultY;
CCam Cams[3];

View File

@ -100,7 +100,7 @@ void WeaponCheat()
void HealthCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT3"), true);
FindPlayerPed()->m_fHealth = 100.0f;
FindPlayerPed()->m_fHealth = CWorld::Players[0].m_nMaxHealth;
if (FindPlayerVehicle()) {
FindPlayerVehicle()->m_fHealth = 1000.0f;
if (FindPlayerVehicle()->m_vehType == VEHICLE_TYPE_CAR)
@ -224,7 +224,7 @@ void MoneyCheat()
void ArmourCheat()
{
CHud::SetHelpMessage(TheText.Get("CHEAT4"), true);
FindPlayerPed()->m_fArmour = 100.0f;
FindPlayerPed()->m_fArmour = CWorld::Players[0].m_nMaxArmour;
}
void WantedLevelUpCheat()

View File

@ -140,6 +140,7 @@ CPlayerInfo::Clear(void)
m_nUpsideDownCounter = 0;
m_bInfiniteSprint = false;
m_bFastReload = false;
m_nMaxHealth = m_nMaxArmour = 100;
m_bGetOutOfJailFree = false;
m_bGetOutOfHospitalFree = false;
m_bDriveByAllowed = true;

View File

@ -52,6 +52,9 @@ public:
int32 field_272;
bool m_bInfiniteSprint;
bool m_bFastReload;
bool m_bFireproof;
uint8 m_nMaxHealth;
uint8 m_nMaxArmour;
bool m_bGetOutOfJailFree;
bool m_bGetOutOfHospitalFree;
bool m_bDriveByAllowed;

View File

@ -61,6 +61,7 @@ int32 CStats::HighestScores[CStats::TOTAL_HIGHEST_SCORES];
int32 CStats::Sprayings;
float CStats::AutoPaintingBudget;
int32 CStats::NoMoreHurricanes;
float CStats::FashionBudget;
void CStats::Init()
{
@ -257,6 +258,11 @@ float CStats::GetPercentageProgress()
return Min(percentCompleted, 100.0f);
}
void CStats::MoneySpentOnFashion(int32 money)
{
FashionBudget += money;
}
void CStats::SaveStats(uint8 *buf, uint32 *size)
{
CheckPointReachedSuccessfully();

View File

@ -65,6 +65,7 @@ public:
static int32 Sprayings;
static float AutoPaintingBudget;
static int32 NoMoreHurricanes;
static float FashionBudget;
public:
static void Init(void);
@ -91,4 +92,6 @@ public:
static void SaveStats(uint8 *buf, uint32 *size);
static void LoadStats(uint8 *buf, uint32 size);
static float GetPercentageProgress();
static void MoneySpentOnFashion(int32);
};

View File

@ -160,7 +160,9 @@
X("subplatform_sub", MI_SUBPLATFORM_SUB2, 0x5F5BC0) \
X("files", MI_FILES, 0x5F5BC4) \
X("property_locked", MI_PICKUP_PROPERTY, 0x0) \
X("property_fsale", MI_PICKUP_PROPERTY_FORSALE, 0x0)
X("property_fsale", MI_PICKUP_PROPERTY_FORSALE, 0x0) \
X("clothesp", MI_PICKUP_CLOTHES, 0x0) \
X("bigdollar", MI_PICKUP_REVENUE, 0x0)
#define X(name, var, addr) extern int16 var;
MODELINDICES

View File

@ -325,7 +325,7 @@ CCivilianPed::ProcessControl(void)
CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency = Max(250, playerSexFrequency - 10);
}
m_pMyVehicle->pDriver->m_fHealth = Min(125.0f, 1.0f + m_pMyVehicle->pDriver->m_fHealth);
m_pMyVehicle->pDriver->m_fHealth = Min(CWorld::Players[0].m_nMaxHealth + 25.0f, 1.0f + m_pMyVehicle->pDriver->m_fHealth);
if (CWorld::Players[CWorld::PlayerInFocus].m_nSexFrequency == 250)
CWorld::Players[CWorld::PlayerInFocus].m_nNextSexFrequencyUpdateTime = CTimer::GetTimeInMilliseconds() + 3000;
} else {
@ -336,7 +336,7 @@ CCivilianPed::ProcessControl(void)
} else {
bWanderPathAfterExitingCar = true;
CWorld::Players[CWorld::PlayerInFocus].m_pHooker = nil;
m_pMyVehicle->pDriver->m_fHealth = 125.0f;
m_pMyVehicle->pDriver->m_fHealth = CWorld::Players[0].m_nMaxHealth + 25.0f;
SetObjective(OBJECTIVE_LEAVE_VEHICLE, m_pMyVehicle);
}
} else {

View File

@ -537,6 +537,8 @@ CPed::CPed(uint32 pedType) : m_pedIK(this)
m_fAirResistance = 0.4f / m_fMass;
m_fElasticity = 0.05f;
m_ceaseAttackTimer = 0;
bIsStanding = false;
bWasStanding = false;
bIsAttacking = false;

View File

@ -209,7 +209,7 @@ enum eObjective : uint32 {
OBJECTIVE_LEAVE_CAR_AND_DIE,
OBJECTIVE_USE_SEAT_ATTRACTOR,
OBJECTIVE_USE_ATM_ATTRACTOR,
OBJECTIVE_FLEE_CAR, // is it 41?
OBJECTIVE_FLEE_CAR,
OBJ_42,
OBJECTIVE_USE_STOP_ATTRACTOR,
OBJECTIVE_USE_PIZZA_ATTRACTOR,
@ -551,7 +551,7 @@ public:
uint32 m_duckAndCoverTimer;
uint32 m_bloodyFootprintCountOrDeathTime; // Death time when bDoBloodyFootprints is false. Weird decision
uint32 m_shotTime;
uint32 m_shotTimeAdd;
uint32 m_ceaseAttackTimer;
uint8 m_panicCounter;
bool m_deadBleeding;
int8 m_bodyPartBleeding; // PedNode, but -1 if there isn't

View File

@ -72,6 +72,7 @@ CAutomobile::CAutomobile(int32 id, uint8 CreatedBy)
bFixedColour = false;
bBigWheels = false;
bWaterTight = false;
bTankDetonateCars = true;
SetModelIndex(id);
@ -332,7 +333,7 @@ CAutomobile::ProcessControl(void)
bool playerRemote = false;
switch(GetStatus()){
case STATUS_PLAYER_REMOTE:
if(CPad::GetPad(0)->WeaponJustDown()){
if(CPad::GetPad(0)->WeaponJustDown() && !bDisableRemoteDetonation){
BlowUpCar(FindPlayerPed());
CRemote::TakeRemoteControlledCarFromPlayer();
}
@ -4148,7 +4149,7 @@ CAutomobile::BlowUpCarsInPath(void)
{
int i;
if(m_vecMoveSpeed.Magnitude() > 0.1f)
if(m_vecMoveSpeed.Magnitude() > 0.1f && bTankDetonateCars)
for(i = 0; i < m_nCollisionRecords; i++)
if(m_aCollisionRecords[i] &&
m_aCollisionRecords[i]->IsVehicle() &&
@ -4610,6 +4611,18 @@ CAutomobile::SetAllTaxiLights(bool set)
m_sAllTaxiLights = set;
}
void
CAutomobile::TellHeliToGoToCoors(float x, float y, float z, uint8 speed)
{
AutoPilot.m_nCarMission = MISSION_HELI_FLYTOCOORS;
AutoPilot.m_vecDestinationCoors.x = x;
AutoPilot.m_vecDestinationCoors.y = y;
AutoPilot.m_vecDestinationCoors.z = z;
AutoPilot.m_nCruiseSpeed = speed;
SetStatus(STATUS_PHYSICS);
//TODO(MIAMI)
}
#ifdef COMPATIBLE_SAVES
void
CAutomobile::Save(uint8*& buf)

View File

@ -91,6 +91,7 @@ public:
uint8 bWaterTight : 1; // no damage for non-player peds
uint8 bNotDamagedUpsideDown : 1;
uint8 bMoreResistantToDamage : 1;
uint8 bTankDetonateCars : 1;
int16 field_4E0;
uint16 m_hydraulicState;
uint32 m_nBusDoorTimerEnd;
@ -178,6 +179,8 @@ public:
void SetBumperDamage(int32 component, ePanels panel, bool noFlyingComponents = false);
void SetDoorDamage(int32 component, eDoors door, bool noFlyingComponents = false);
void TellHeliToGoToCoors(float x, float y, float z, uint8 speed);
void Fix(void);
void SetComponentVisibility(RwFrame *frame, uint32 flags);
void SetupModelNodes(void);

View File

@ -29,6 +29,7 @@ bool CVehicle::bCheat5;
bool CVehicle::bAltDodoCheat;
#endif
bool CVehicle::m_bDisableMouseSteering = true;
bool CVehicle::bDisableRemoteDetonation;
void *CVehicle::operator new(size_t sz) { return CPools::GetVehiclePool()->New(); }
void *CVehicle::operator new(size_t sz, int handle) { return CPools::GetVehiclePool()->New(handle); }
@ -1080,14 +1081,14 @@ CVehicle::SetDriver(CPed *driver)
if(bFreebies && driver == FindPlayerPed()){
if(GetModelIndex() == MI_AMBULAN)
FindPlayerPed()->m_fHealth = Min(FindPlayerPed()->m_fHealth + 20.0f, 100.0f);
FindPlayerPed()->m_fHealth = Min(FindPlayerPed()->m_fHealth + 20.0f, CWorld::Players[0].m_nMaxHealth);
else if(GetModelIndex() == MI_TAXI)
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
else if (GetModelIndex() == MI_POLICE) {
CStreaming::RequestModel(WEAPONTYPE_SHOTGUN, STREAMFLAGS_DONT_REMOVE);
driver->GiveWeapon(WEAPONTYPE_SHOTGUN, 5);
} else if (GetModelIndex() == MI_ENFORCER)
driver->m_fArmour = Max(driver->m_fArmour, 100.0f);
driver->m_fArmour = Max(driver->m_fArmour, CWorld::Players[0].m_nMaxArmour);
else if(GetModelIndex() == MI_CABBIE || GetModelIndex() == MI_ZEBRA) // TODO(MIAMI): check zebra
CWorld::Players[CWorld::PlayerInFocus].m_nMoney += 25;
bFreebies = false;
@ -1353,14 +1354,14 @@ eVehicleAppearance
CVehicle::GetVehicleAppearance(void)
{
if (IsCar())
return VEHICLE_CAR;
return VEHICLE_APPEARANCE_CAR;
if (IsBoat())
return VEHICLE_BOAT;
return VEHICLE_APPEARANCE_BOAT;
if (IsBike())
return VEHICLE_BIKE;
return VEHICLE_APPEARANCE_BIKE;
if (IsPlane())
return VEHICLE_PLANE;
return VEHICLE_APPEARANCE_PLANE;
if (IsHeli())
return VEHICLE_HELI;
return VEHICLE_NONE;
return VEHICLE_APPEARANCE_HELI;
return VEHICLE_APPEARANCE_NONE;
}

View File

@ -112,12 +112,12 @@ enum eFlightModel
enum eVehicleAppearance
{
VEHICLE_NONE,
VEHICLE_CAR,
VEHICLE_BIKE,
VEHICLE_HELI,
VEHICLE_BOAT,
VEHICLE_PLANE,
VEHICLE_APPEARANCE_NONE,
VEHICLE_APPEARANCE_CAR,
VEHICLE_APPEARANCE_BIKE,
VEHICLE_APPEARANCE_HELI,
VEHICLE_APPEARANCE_BOAT,
VEHICLE_APPEARANCE_PLANE,
};
// Or Weapon.h?
@ -310,6 +310,7 @@ public:
static bool bAltDodoCheat;
#endif
static bool m_bDisableMouseSteering;
static bool bDisableRemoteDetonation;
};
void DestroyVehicleAndDriverAndPassengers(CVehicle* pVehicle);