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(); CPlayerPed *player = FindPlayerPed();
if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) { if (fixedWeapon < WEAPONTYPE_TOTALWEAPONS) {
InterruptedWeaponSelected = player->GetWeapon()->m_eWeaponType; InterruptedWeaponSelected = player->GetWeapon()->m_eWeaponType;
#if (defined FIX_BUGS || !defined GTA_PS2)
player->RemoveWeaponAnims(InterruptedWeaponSelected, -1000.0f); player->RemoveWeaponAnims(InterruptedWeaponSelected, -1000.0f);
#endif
InterruptedWeaponType = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_eWeaponType; InterruptedWeaponType = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_eWeaponType;
AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal; AmmoInterruptedWeapon = player->GetWeapon(player->GetWeaponSlot(fixedWeapon)).m_nAmmoTotal;
if (InterruptedWeaponType) if (InterruptedWeaponType)
CModelInfo::GetModelInfo(CWeaponInfo::GetWeaponInfo((eWeaponType)InterruptedWeaponType)->m_nModelId)->AddRef(); 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->GiveWeapon(fixedWeapon, 30000);
player->SetCurrentWeapon(fixedWeapon); player->SetCurrentWeapon(fixedWeapon);
player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot); player->MakeChangesForNewWeapon(player->m_nSelectedWepSlot);

View file

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

View file

@ -2332,6 +2332,7 @@ CRunningScript* CTheScripts::StartNewScript(uint32 ip)
pNew->Init(); pNew->Init();
pNew->SetIP(ip); pNew->SetIP(ip);
pNew->AddScriptToList(&pActiveScripts); pNew->AddScriptToList(&pActiveScripts);
pNew->m_bIsActive = true;
return pNew; return pNew;
} }
@ -2416,6 +2417,8 @@ void CTheScripts::Process()
script->UpdateTimers(timeStep); script->UpdateTimers(timeStep);
script->Process(); script->Process();
script = next; script = next;
if (script && !script->m_bIsActive)
script = nil;
} }
DbgFlag = false; DbgFlag = false;
#ifdef USE_ADVANCED_SCRIPT_DEBUG_OUTPUT #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: case COMMAND_SET_MAXIMUM_NUMBER_OF_CARS_IN_GARAGE:
CollectParameters(&m_nIp, 2); CollectParameters(&m_nIp, 2);
CGarages::SetMaxNumStoredCarsForGarage(ScriptParams[0], ScriptParams[1]); CGarages::SetMaxNumStoredCarsForGarage(ScriptParams[0], ScriptParams[1]);
break; return 0;
case COMMAND_WANTED_STARS_ARE_FLASHING: case COMMAND_WANTED_STARS_ARE_FLASHING:
{ {
CWanted *pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted; CWanted *pWanted = CWorld::Players[CWorld::PlayerInFocus].m_pPed->m_pWanted;