Revert "First batch of fixes (CallAndMessage)"

This reverts commit 7a3b80a9b7.
This commit is contained in:
Filip Gawin 2021-01-31 21:06:38 +01:00
parent 7a3b80a9b7
commit 3d4791f291
15 changed files with 49 additions and 139 deletions

View File

@ -814,9 +814,6 @@ void
CPickups::RenderPickUpText() CPickups::RenderPickUpText()
{ {
wchar *strToPrint; wchar *strToPrint;
#ifdef FIX_BUGS
strToPrint = nil;
#endif
for (int32 i = 0; i < NumMessages; i++) { for (int32 i = 0; i < NumMessages; i++) {
if (aMessages[i].m_quantity <= 39) { if (aMessages[i].m_quantity <= 39) {
switch (aMessages[i].m_quantity) // could use some enum maybe switch (aMessages[i].m_quantity) // could use some enum maybe
@ -1288,11 +1285,7 @@ CPacManPickups::GeneratePMPickUpsForRace(int32 race)
int i = 0; int i = 0;
if (race == 0) pPos = aRacePoints1; // there's only one available if (race == 0) pPos = aRacePoints1; // there's only one available
assert(pPos != nil);
if(!pPos) {
debug("This shouldn't happen");
return;
}
while (!pPos->IsZero()) { while (!pPos->IsZero()) {
while (aPMPickUps[i].m_eType != PACMAN_NONE) while (aPMPickUps[i].m_eType != PACMAN_NONE)

View File

@ -3439,13 +3439,8 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
} }
else { else {
CVehicle* car; CVehicle* car;
if(!CModelInfo::IsBikeModel(ScriptParams[0])) car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE); if (!CModelInfo::IsBikeModel(ScriptParams[0]))
#ifdef FIX_BUGS car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE);
else {
debug("This shouldn't happen");
return 0;
}
#endif
CVector pos = *(CVector*)&ScriptParams[1]; CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT) if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y); pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);

View File

@ -1817,13 +1817,8 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
if (model == -1) if (model == -1)
return 0; return 0;
CVehicle* car; CVehicle* car;
if(!CModelInfo::IsBikeModel(model)) car = new CAutomobile(model, RANDOM_VEHICLE); if (!CModelInfo::IsBikeModel(model))
#ifdef FIX_BUGS car = new CAutomobile(model, RANDOM_VEHICLE);
else {
debug("This shouldn't happen");
return 0;
}
#endif
CVector pos = *(CVector*)&ScriptParams[0]; CVector pos = *(CVector*)&ScriptParams[0];
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->SetPosition(pos); car->SetPosition(pos);

View File

@ -971,10 +971,8 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
pClosestEntity = apEntities[i]; pClosestEntity = apEntities[i];
} }
} }
#ifdef FIX_BUGS if (pClosestEntity->IsDummy())
if(pClosestEntity) pClosestEntity = nil;
#endif
if(pClosestEntity->IsDummy()) pClosestEntity = nil;
} }
if (pClosestEntity) { if (pClosestEntity) {
script_assert(pClosestEntity->IsObject()); script_assert(pClosestEntity->IsObject());

View File

@ -1699,12 +1699,10 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity = pTargetEntity; Cams[ActiveCam].CamTargetEntity = pTargetEntity;
// Ped visibility // Ped visibility
if(((Cams[ActiveCam].Mode == CCam::MODE_1STPERSON || Cams[ActiveCam].Mode == CCam::MODE_SNIPER || Cams[ActiveCam].Mode == CCam::MODE_M16_1STPERSON || if((Cams[ActiveCam].Mode == CCam::MODE_1STPERSON ||
Cams[ActiveCam].Mode == CCam::MODE_ROCKETLAUNCHER) && Cams[ActiveCam].Mode == CCam::MODE_SNIPER ||
#ifdef FIX_BUGS Cams[ActiveCam].Mode == CCam::MODE_M16_1STPERSON ||
pTargetEntity && Cams[ActiveCam].Mode == CCam::MODE_ROCKETLAUNCHER) && pTargetEntity->IsPed() ||
#endif
pTargetEntity->IsPed()) ||
Cams[ActiveCam].Mode == CCam::MODE_FLYBY) Cams[ActiveCam].Mode == CCam::MODE_FLYBY)
FindPlayerPed()->bIsVisible = false; FindPlayerPed()->bIsVisible = false;
else else
@ -1756,15 +1754,14 @@ CCamera::UpdateTargetEntity(void)
PLAYER->m_pMyVehicle && PLAYER->m_pMyVehicle &&
PLAYER->m_pMyVehicle->CanPedOpenLocks(PLAYER)) PLAYER->m_pMyVehicle->CanPedOpenLocks(PLAYER))
cantOpen = false; cantOpen = false;
#ifdef FIX_BUGS
if(PLAYER) if(PLAYER->GetPedState() == PED_ENTER_CAR && !cantOpen){
#endif if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS){
if(PLAYER->GetPedState() == PED_ENTER_CAR && !cantOpen) { pTargetEntity = PLAYER->m_pMyVehicle;
if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS) { if(PLAYER->m_pMyVehicle == nil)
pTargetEntity = PLAYER->m_pMyVehicle; pTargetEntity = PLAYER;
if(PLAYER->m_pMyVehicle == nil) pTargetEntity = PLAYER;
}
} }
}
if((PLAYER->GetPedState() == PED_CARJACK || PLAYER->GetPedState() == PED_OPEN_DOOR) && !cantOpen){ if((PLAYER->GetPedState() == PED_CARJACK || PLAYER->GetPedState() == PED_OPEN_DOOR) && !cantOpen){
if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS) if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS)

View File

@ -1090,9 +1090,6 @@ CFileLoader::LoadObject(const char *line)
char model[24], txd[24]; char model[24], txd[24];
float dist[3]; float dist[3];
uint32 flags; uint32 flags;
#ifdef FIX_BUGS
flags = 0;
#endif
int damaged; int damaged;
CSimpleModelInfo *mi; CSimpleModelInfo *mi;
@ -1189,9 +1186,6 @@ CFileLoader::LoadTimeObject(const char *line)
char model[24], txd[24]; char model[24], txd[24];
float dist[3]; float dist[3];
uint32 flags; uint32 flags;
#ifdef FIX_BUGS
flags = 0;
#endif
int timeOn, timeOff; int timeOn, timeOff;
int damaged; int damaged;
CTimeModelInfo *mi, *other; CTimeModelInfo *mi, *other;
@ -1796,9 +1790,6 @@ CFileLoader::ReloadObject(const char *line)
char model[24], txd[24]; char model[24], txd[24];
float dist[3]; float dist[3];
uint32 flags; uint32 flags;
#ifdef FIX_BUGS
flags = 0;
#endif
CSimpleModelInfo *mi; CSimpleModelInfo *mi;
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4) if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)

View File

@ -144,11 +144,8 @@ INITSAVEBUF
pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE); pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE);
else if (type == VEHICLE_TYPE_CAR) else if (type == VEHICLE_TYPE_CAR)
pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE); pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE);
else { else
assert(0); assert(0);
debug("This shouldn't happen");
return;
}
--CCarCtrl::NumRandomCars; --CCarCtrl::NumRandomCars;
pVehicle->Load(buf); pVehicle->Load(buf);
CWorld::Add(pVehicle); CWorld::Add(pVehicle);
@ -521,11 +518,8 @@ INITSAVEBUF
if (pedtype == PEDTYPE_PLAYER1) if (pedtype == PEDTYPE_PLAYER1)
pPed = new(ref) CPlayerPed(); pPed = new(ref) CPlayerPed();
else { else
assert(0); assert(0);
debug("This shouldn't happen");
return;
}
pPed->Load(buf); pPed->Load(buf);
if (pedtype == PEDTYPE_PLAYER1) { if (pedtype == PEDTYPE_PLAYER1) {

View File

@ -404,9 +404,6 @@ void CRadar::Draw3dMarkers()
case BLIP_CHAR: case BLIP_CHAR:
{ {
CEntity *entity = CPools::GetPedPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle); CEntity *entity = CPools::GetPedPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
#ifdef FIX_BUGS
if(!entity) break;
#endif
if (entity != nil) { if (entity != nil) {
if (((CPed*)entity)->InVehicle()) if (((CPed*)entity)->InVehicle())
entity = ((CPed * )entity)->m_pMyVehicle; entity = ((CPed * )entity)->m_pMyVehicle;

View File

@ -504,9 +504,6 @@ CEntity::Add(void)
case ENTITY_TYPE_DUMMY: case ENTITY_TYPE_DUMMY:
list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP]; list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP];
break; break;
#ifdef FIX_BUGS
default: debug("This shouldn't happen"); return;
#endif
} }
list->InsertItem(this); list->InsertItem(this);
} }
@ -567,9 +564,6 @@ CEntity::Remove(void)
case ENTITY_TYPE_DUMMY: case ENTITY_TYPE_DUMMY:
list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP]; list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP];
break; break;
#ifdef FIX_BUGS
default: debug("This shouldn't happen"); return;
#endif
} }
list->RemoveItem(this); list->RemoveItem(this);
} }

View File

@ -126,8 +126,6 @@ CPhysical::Add(void)
break; break;
default: default:
assert(0); assert(0);
debug("This shouldn't happen");
return;
} }
CPtrNode *node = list->InsertItem(this); CPtrNode *node = list->InsertItem(this);
assert(node); assert(node);
@ -193,20 +191,17 @@ CPhysical::RemoveAndAdd(void)
list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP]; list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP];
break; break;
} }
#ifdef FIX_BUGS if(next){
if(list) // If we still have old nodes, use them
#endif next->list->RemoveNode(next->listnode);
if(next) { list->InsertNode(next->listnode);
// If we still have old nodes, use them next->list = list;
next->list->RemoveNode(next->listnode); next->sector = s;
list->InsertNode(next->listnode); next = next->next;
next->list = list; }else{
next->sector = s; CPtrNode *node = list->InsertItem(this);
next = next->next; m_entryInfoList.InsertItem(list, node, s);
} else { }
CPtrNode *node = list->InsertItem(this);
m_entryInfoList.InsertItem(list, node, s);
}
} }
// Remove old nodes we no longer need // Remove old nodes we no longer need

View File

@ -4348,15 +4348,13 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
} }
#endif #endif
#ifdef FIX_BUGS if (quickJackedAssoc) {
if(dragAssoc) dragAssoc->SetDeleteCallback(PedSetQuickDraggedOutCarPositionCB, ped);
#endif } else {
if(quickJackedAssoc) { dragAssoc->SetDeleteCallback(PedSetDraggedOutCarPositionCB, ped);
dragAssoc->SetDeleteCallback(PedSetQuickDraggedOutCarPositionCB, ped); if (ped->CanSetPedState())
} else { CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_GETUP1, 1000.0f);
dragAssoc->SetDeleteCallback(PedSetDraggedOutCarPositionCB, ped); }
if(ped->CanSetPedState()) CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_GETUP1, 1000.0f);
}
ped->ReplaceWeaponWhenExitingVehicle(); ped->ReplaceWeaponWhenExitingVehicle();

View File

@ -2244,9 +2244,6 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
enterDoor = DOOR_REAR_LEFT; enterDoor = DOOR_REAR_LEFT;
break; break;
default: default:
#ifdef FIX_BUGS
enterDoor = DOOR_BONNET;
#endif
break; break;
} }
@ -2359,7 +2356,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; pedInSeat = veh->pPassengers[2]; break; case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; pedInSeat = veh->pPassengers[2]; break;
case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; pedInSeat = veh->pDriver; break; case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; pedInSeat = veh->pDriver; break;
case CAR_DOOR_LR: door = DOOR_REAR_LEFT; pedInSeat = veh->pPassengers[1]; break; case CAR_DOOR_LR: door = DOOR_REAR_LEFT; pedInSeat = veh->pPassengers[1]; break;
default: assert(0); debug("This shouldn't happen"); return; default: assert(0);
} }
if (ped->m_fHealth == 0.0f || CPad::GetPad(0)->ArePlayerControlsDisabled() && pedInSeat && pedInSeat->IsPlayer()) { if (ped->m_fHealth == 0.0f || CPad::GetPad(0)->ArePlayerControlsDisabled() && pedInSeat && pedInSeat->IsPlayer()) {
@ -2557,9 +2554,6 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
case PEDTYPE_PLAYER4: case PEDTYPE_PLAYER4:
padNo = 3; padNo = 3;
break; break;
default:
padNo = 0;
break;
} }
CPad *pad = CPad::GetPad(padNo); CPad *pad = CPad::GetPad(padNo);
@ -2663,9 +2657,6 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
enterDoor = DOOR_REAR_LEFT; enterDoor = DOOR_REAR_LEFT;
break; break;
default: default:
#ifdef FIX_BUGS
enterDoor = DOOR_BONNET;
#endif
break; break;
} }
if (!veh->IsDoorMissing(enterDoor)) { if (!veh->IsDoorMissing(enterDoor)) {
@ -2761,15 +2752,12 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_CLOSEDOOR_LHS, 1.0f); veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_CLOSEDOOR_LHS, 1.0f);
eDoors door; eDoors door;
switch(ped->m_vehDoor) { switch (ped->m_vehDoor) {
case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break; case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break;
case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break; case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break;
case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break; case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break;
case CAR_DOOR_LR: door = DOOR_REAR_LEFT; break; case CAR_DOOR_LR: door = DOOR_REAR_LEFT; break;
default: default: assert(0);
assert(0);
debug("This shouldn't happen");
return;
} }
if (veh->Damage.GetDoorStatus(door) == DOOR_STATUS_SWINGING) if (veh->Damage.GetDoorStatus(door) == DOOR_STATUS_SWINGING)
@ -2938,9 +2926,6 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
door = DOOR_REAR_LEFT; door = DOOR_REAR_LEFT;
break; break;
default: default:
#ifdef FIX_BUGS
door = DOOR_BONNET;
#endif
break; break;
} }
bool closeDoor = !veh->IsDoorMissing(door); bool closeDoor = !veh->IsDoorMissing(door);
@ -2962,12 +2947,6 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
case PEDTYPE_PLAYER4: case PEDTYPE_PLAYER4:
padNo = 3; padNo = 3;
break; break;
default:
#ifdef FIX_BUGS
padNo = 0;
debug("This shouldn't happen");
#endif
break;
} }
CPad* pad = CPad::GetPad(padNo); CPad* pad = CPad::GetPad(padNo);
bool engineIsIntact = veh->IsCar() && ((CAutomobile*)veh)->Damage.GetEngineStatus() >= 225; bool engineIsIntact = veh->IsCar() && ((CAutomobile*)veh)->Damage.GetEngineStatus() >= 225;
@ -3306,9 +3285,6 @@ CPed::SetCarJack(CVehicle* car)
{ {
uint8 doorFlag; uint8 doorFlag;
eDoors door; eDoors door;
#ifdef FIX_BUGS
door = DOOR_BONNET;
#endif
CPed *pedInSeat = nil; CPed *pedInSeat = nil;
if (car->IsBoat()) if (car->IsBoat())
@ -3464,10 +3440,8 @@ CPed::BeingDraggedFromCar(void)
if (!dontRunAnim) if (!dontRunAnim)
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, enterAnim); m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, enterAnim);
#ifdef FIX_BUGS
if(m_pVehicleAnim) m_pVehicleAnim->SetFinishCallback(PedSetDraggedOutCarCB, this);
#endif
m_pVehicleAnim->SetFinishCallback(PedSetDraggedOutCarCB, this);
lineUpType = LINE_UP_TO_CAR_START; lineUpType = LINE_UP_TO_CAR_START;
} else if (m_pVehicleAnim->currentTime <= 1.4f) { } else if (m_pVehicleAnim->currentTime <= 1.4f) {
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f); m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);

View File

@ -745,9 +745,6 @@ CWaterLevel::RenderWater()
if ( fHugeSectorDistToCamSqr >= SQR(500.0f) /*fHugeSectorNearDist*/ ) if ( fHugeSectorDistToCamSqr >= SQR(500.0f) /*fHugeSectorNearDist*/ )
{ {
float fZ; float fZ;
#ifdef FIX_BUGS
fZ = 0.f;
#endif
if ( aWaterBlockList[2*x+0][2*y+0] >= 0 ) if ( aWaterBlockList[2*x+0][2*y+0] >= 0 )
fZ = ms_aWaterZs[ aWaterBlockList[2*x+0][2*y+0] ]; fZ = ms_aWaterZs[ aWaterBlockList[2*x+0][2*y+0] ];

View File

@ -251,9 +251,6 @@ GenericLoad()
uint8 *buf; uint8 *buf;
int32 file; int32 file;
uint32 size; uint32 size;
#ifdef FIX_BUGS
size = 0;
#endif
#ifdef MISSION_REPLAY #ifdef MISSION_REPLAY
int8 qs; int8 qs;
#endif #endif

View File

@ -100,12 +100,7 @@ void CCarGenerator::DoInternalProcessing()
// So game crashes if it's bike :D // So game crashes if it's bike :D
if (((CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex))->m_vehicleType != VEHICLE_TYPE_BIKE) if (((CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex))->m_vehicleType != VEHICLE_TYPE_BIKE)
pCar = new CAutomobile(m_nModelIndex, PARKED_VEHICLE); pCar = new CAutomobile(m_nModelIndex, PARKED_VEHICLE);
#ifdef FIX_BUGS
else {
debug("This shouldn't happen");
return;
}
#endif
pCar->SetIsStatic(false); pCar->SetIsStatic(false);
pCar->bEngineOn = false; pCar->bEngineOn = false;
pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel(); pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel();