fixed garages + minor fixes

This commit is contained in:
Nikolay Korolev 2020-12-12 12:24:55 +03:00
parent ccbbde549e
commit 4197498e2d
4 changed files with 44 additions and 4 deletions

View file

@ -295,11 +295,16 @@ CDarkel::StartFrenzy(eWeaponType weaponType, int32 time, uint16 kill, int32 mode
CPlayerPed *player = FindPlayerPed();
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
InterruptedWeaponSelected = player->GetWeapon()->m_eWeaponType;
#if (defined FIX_BUGS || !defined GTA_PS2)
player->RemoveWeaponAnims(InterruptedWeaponSelected, -1000.0f);
#endif
InterruptedWeaponType = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_eWeaponType;
AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal;
if (InterruptedWeaponType)
CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponType)->m_nModelId)->AddRef();
#if (!defined FIX_BUGS && defined GTA_PS2)
player->RemoveWeaponAnims(InterruptedWeaponSelected, -1000.0f);
#endif
player->GiveWeapon(fixedWeapon, 30000);
player->SetCurrentWeapon(fixedWeapon);
player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot);

View file

@ -166,7 +166,7 @@ void CGarages::Shutdown(void)
void CGarages::Update(void)
{
static int GarageToBeTidied = 0;
static uint32 GarageToBeTidied = 0;
#ifndef PS2
if (CReplay::IsPlayingBack())
return;
@ -174,13 +174,21 @@ void CGarages::Update(void)
bCamShouldBeOutisde = false;
TheCamera.pToGarageWeAreIn = nil;
TheCamera.pToGarageWeAreInForHackAvoidFirstPerson = nil;
#ifdef FIX_BUGS
for (uint32 i = 0; i < NumGarages; i++) {
#else
for (int i = 0; i < NUM_GARAGES; i++) {
#endif
if (aGarages[i].IsUsed())
aGarages[i].Update();
}
if ((CTimer::GetFrameCounter() & 0xF) != 0xC)
return;
#ifdef FIX_BUGS
if (++GarageToBeTidied >= NumGarages)
#else
if (++GarageToBeTidied >= NUM_GARAGES)
#endif
GarageToBeTidied = 0;
if (!aGarages[GarageToBeTidied].IsUsed())
return;
@ -1930,7 +1938,11 @@ bool CGarage::RestoreCarsForThisHideout(CStoredCar* aCars)
bool CGarages::IsPointInAGarageCameraZone(CVector point)
{
#ifdef FIX_BUGS
for (uint32 i = 0; i < NumGarages; i++) {
#else
for (int i = 0; i < NUM_GARAGES; i++) {
#endif
switch (aGarages[i].m_eGarageType) {
case GARAGE_NONE:
break;
@ -2019,7 +2031,11 @@ void CGarage::TidyUpGarageClose()
void CGarages::PlayerArrestedOrDied()
{
static int GarageToBeTidied = 0; // lol
#ifdef FIX_BUGS
for (uint32 i = 0; i < NumGarages; i++) {
#else
for (int i = 0; i < NUM_GARAGES; i++) {
#endif
if (aGarages[i].m_eGarageType != GARAGE_NONE)
aGarages[i].PlayerArrestedOrDied();
}
@ -2114,18 +2130,22 @@ void CGarage::CenterCarInGarage(CVehicle* pVehicle)
void CGarages::CloseHideOutGaragesBeforeSave()
{
#ifdef FIX_BUGS
for (uint32 i = 0; i < NumGarages; i++) {
#else
for (int i = 0; i < NUM_GARAGES; i++) {
#endif
if (!IsThisGarageTypeSafehouse(aGarages[i].m_eGarageType))
continue;
if (aGarages[i].m_eGarageState != GS_FULLYCLOSED) {
aGarages[i].m_eGarageState = GS_FULLYCLOSED;
aGarages[i].StoreAndRemoveCarsForThisHideout(aCarsInSafeHouses[FindSafeHouseIndexForGarageType(aGarages[i].m_eGarageType)], NUM_GARAGE_STORED_CARS);
aGarages[i].RemoveCarsBlockingDoorNotInside();
}
aGarages[i].m_fDoorPos = 0.0f;
aGarages[i].UpdateDoorsHeight();
}
}
}
int32 CGarages::CountCarsInHideoutGarage(uint8 type)
{
@ -2138,7 +2158,11 @@ int32 CGarages::CountCarsInHideoutGarage(uint8 type)
bool CGarages::IsPointWithinHideOutGarage(Const CVector& point)
{
#ifdef FIX_BUGS
for (uint32 i = 0; i < NumGarages; i++) {
#else
for (int i = 0; i < NUM_GARAGES; i++) {
#endif
switch (aGarages[i].m_eGarageType) {
case GARAGE_HIDEOUT_ONE:
case GARAGE_HIDEOUT_TWO:
@ -2162,7 +2186,11 @@ bool CGarages::IsPointWithinHideOutGarage(Const CVector& point)
bool CGarages::IsPointWithinAnyGarage(Const CVector& point)
{
#ifdef FIX_BUGS
for (uint32 i = 0; i < NumGarages; i++) {
#else
for (int i = 0; i < NUM_GARAGES; i++) {
#endif
switch (aGarages[i].m_eGarageType) {
case GARAGE_NONE:
continue;
@ -2176,7 +2204,11 @@ bool CGarages::IsPointWithinAnyGarage(Const CVector& point)
void CGarages::SetAllDoorsBackToOriginalHeight()
{
#ifdef FIX_BUGS
for (uint32 i = 0; i < NumGarages; i++) {
#else
for (int i = 0; i < NUM_GARAGES; i++) {
#endif
switch (aGarages[i].m_eGarageType) {
case GARAGE_NONE:
continue;

View file

@ -2332,6 +2332,7 @@ CRunningScript* CTheScripts::StartNewScript(uint32 ip)
pNew->Init();
pNew->SetIP(ip);
pNew->AddScriptToList(&pActiveScripts);
pNew->m_bIsActive = true;
return pNew;
}
@ -2416,6 +2417,8 @@ void CTheScripts::Process()
script->UpdateTimers(timeStep);
script->Process();
script = next;
if (script && !script->m_bIsActive)
script = nil;
}
DbgFlag = false;
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT

View file

@ -63,7 +63,7 @@ int8 CRunningScript::ProcessCommands1400To1499(int32 command)
case COMMAND_SET_MAXIMUM_NUMBER_OF_CARS_IN_GARAGE:
CollectParameters(&m_nIp, 2);
CGarages::SetMaxNumStoredCarsForGarage(ScriptParams[0], ScriptParams[1]);
break;
return 0;
case COMMAND_WANTED_STARS_ARE_FLASHING:
{
CWanted *pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted;