summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/control/Pickups.cpp9
-rw-r--r--src/control/Script.cpp9
-rw-r--r--src/control/Script4.cpp9
-rw-r--r--src/control/Script6.cpp6
-rw-r--r--src/core/Camera.cpp25
-rw-r--r--src/core/FileLoader.cpp9
-rw-r--r--src/core/Pools.cpp10
-rw-r--r--src/core/Radar.cpp3
-rw-r--r--src/entities/Entity.cpp6
-rw-r--r--src/entities/Physical.cpp27
-rw-r--r--src/peds/Ped.cpp16
-rw-r--r--src/peds/PedAI.cpp44
-rw-r--r--src/render/WaterLevel.cpp5
-rw-r--r--src/save/GenericGameStorage.cpp3
-rw-r--r--src/vehicles/CarGen.cpp7
15 files changed, 139 insertions, 49 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index 96a8a670..8318bc1a 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -814,6 +814,9 @@ void
CPickups::RenderPickUpText()
{
wchar *strToPrint;
+#ifdef FIX_BUGS
+ strToPrint = nil;
+#endif
for (int32 i = 0; i < NumMessages; i++) {
if (aMessages[i].m_quantity <= 39) {
switch (aMessages[i].m_quantity) // could use some enum maybe
@@ -1285,7 +1288,11 @@ CPacManPickups::GeneratePMPickUpsForRace(int32 race)
int i = 0;
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 (aPMPickUps[i].m_eType != PACMAN_NONE)
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index e70bd508..83f43276 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -3439,8 +3439,13 @@ int8 CRunningScript::ProcessCommands100To199(int32 command)
}
else {
CVehicle* car;
- if (!CModelInfo::IsBikeModel(ScriptParams[0]))
- car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE);
+ if(!CModelInfo::IsBikeModel(ScriptParams[0])) car = new CAutomobile(ScriptParams[0], MISSION_VEHICLE);
+#ifdef FIX_BUGS
+ else {
+ debug("This shouldn't happen");
+ return 0;
+ }
+#endif
CVector pos = *(CVector*)&ScriptParams[1];
if (pos.z <= MAP_Z_LOW_LIMIT)
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
diff --git a/src/control/Script4.cpp b/src/control/Script4.cpp
index 40f9f2f1..740a8e2e 100644
--- a/src/control/Script4.cpp
+++ b/src/control/Script4.cpp
@@ -1817,8 +1817,13 @@ int8 CRunningScript::ProcessCommands900To999(int32 command)
if (model == -1)
return 0;
CVehicle* car;
- if (!CModelInfo::IsBikeModel(model))
- car = new CAutomobile(model, RANDOM_VEHICLE);
+ if(!CModelInfo::IsBikeModel(model)) car = new CAutomobile(model, RANDOM_VEHICLE);
+#ifdef FIX_BUGS
+ else {
+ debug("This shouldn't happen");
+ return 0;
+ }
+#endif
CVector pos = *(CVector*)&ScriptParams[0];
pos.z += car->GetDistanceFromCentreOfMassToBaseOfModel();
car->SetPosition(pos);
diff --git a/src/control/Script6.cpp b/src/control/Script6.cpp
index 31be6987..f8e2d8f1 100644
--- a/src/control/Script6.cpp
+++ b/src/control/Script6.cpp
@@ -971,8 +971,10 @@ int8 CRunningScript::ProcessCommands1100To1199(int32 command)
pClosestEntity = apEntities[i];
}
}
- if (pClosestEntity->IsDummy())
- pClosestEntity = nil;
+#ifdef FIX_BUGS
+ if(pClosestEntity)
+#endif
+ if(pClosestEntity->IsDummy()) pClosestEntity = nil;
}
if (pClosestEntity) {
script_assert(pClosestEntity->IsObject());
diff --git a/src/core/Camera.cpp b/src/core/Camera.cpp
index 2ce4e754..712e9d09 100644
--- a/src/core/Camera.cpp
+++ b/src/core/Camera.cpp
@@ -1699,10 +1699,12 @@ CCamera::CamControl(void)
Cams[ActiveCam].CamTargetEntity = pTargetEntity;
// Ped visibility
- if((Cams[ActiveCam].Mode == CCam::MODE_1STPERSON ||
- Cams[ActiveCam].Mode == CCam::MODE_SNIPER ||
- Cams[ActiveCam].Mode == CCam::MODE_M16_1STPERSON ||
- Cams[ActiveCam].Mode == CCam::MODE_ROCKETLAUNCHER) && pTargetEntity->IsPed() ||
+ if(((Cams[ActiveCam].Mode == CCam::MODE_1STPERSON || Cams[ActiveCam].Mode == CCam::MODE_SNIPER || Cams[ActiveCam].Mode == CCam::MODE_M16_1STPERSON ||
+ Cams[ActiveCam].Mode == CCam::MODE_ROCKETLAUNCHER) &&
+#ifdef FIX_BUGS
+ pTargetEntity &&
+#endif
+ pTargetEntity->IsPed()) ||
Cams[ActiveCam].Mode == CCam::MODE_FLYBY)
FindPlayerPed()->bIsVisible = false;
else
@@ -1754,14 +1756,15 @@ CCamera::UpdateTargetEntity(void)
PLAYER->m_pMyVehicle &&
PLAYER->m_pMyVehicle->CanPedOpenLocks(PLAYER))
cantOpen = false;
-
- if(PLAYER->GetPedState() == PED_ENTER_CAR && !cantOpen){
- if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS){
- pTargetEntity = PLAYER->m_pMyVehicle;
- if(PLAYER->m_pMyVehicle == nil)
- pTargetEntity = PLAYER;
+#ifdef FIX_BUGS
+ if(PLAYER)
+#endif
+ if(PLAYER->GetPedState() == PED_ENTER_CAR && !cantOpen) {
+ if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS) {
+ pTargetEntity = PLAYER->m_pMyVehicle;
+ if(PLAYER->m_pMyVehicle == nil) pTargetEntity = PLAYER;
+ }
}
- }
if((PLAYER->GetPedState() == PED_CARJACK || PLAYER->GetPedState() == PED_OPEN_DOOR) && !cantOpen){
if(!enteringCar && CarZoomIndicator != CAM_ZOOM_1STPRS)
diff --git a/src/core/FileLoader.cpp b/src/core/FileLoader.cpp
index 22e0159c..7724d919 100644
--- a/src/core/FileLoader.cpp
+++ b/src/core/FileLoader.cpp
@@ -1090,6 +1090,9 @@ CFileLoader::LoadObject(const char *line)
char model[24], txd[24];
float dist[3];
uint32 flags;
+#ifdef FIX_BUGS
+ flags = 0;
+#endif
int damaged;
CSimpleModelInfo *mi;
@@ -1186,6 +1189,9 @@ CFileLoader::LoadTimeObject(const char *line)
char model[24], txd[24];
float dist[3];
uint32 flags;
+#ifdef FIX_BUGS
+ flags = 0;
+#endif
int timeOn, timeOff;
int damaged;
CTimeModelInfo *mi, *other;
@@ -1790,6 +1796,9 @@ CFileLoader::ReloadObject(const char *line)
char model[24], txd[24];
float dist[3];
uint32 flags;
+#ifdef FIX_BUGS
+ flags = 0;
+#endif
CSimpleModelInfo *mi;
if(sscanf(line, "%d %s %s %d", &id, model, txd, &numObjs) != 4)
diff --git a/src/core/Pools.cpp b/src/core/Pools.cpp
index 39cfb1d4..54055243 100644
--- a/src/core/Pools.cpp
+++ b/src/core/Pools.cpp
@@ -144,8 +144,11 @@ INITSAVEBUF
pVehicle = new(slot) CBoat(model, RANDOM_VEHICLE);
else if (type == VEHICLE_TYPE_CAR)
pVehicle = new(slot) CAutomobile(model, RANDOM_VEHICLE);
- else
+ else {
assert(0);
+ debug("This shouldn't happen");
+ return;
+ }
--CCarCtrl::NumRandomCars;
pVehicle->Load(buf);
CWorld::Add(pVehicle);
@@ -518,8 +521,11 @@ INITSAVEBUF
if (pedtype == PEDTYPE_PLAYER1)
pPed = new(ref) CPlayerPed();
- else
+ else {
assert(0);
+ debug("This shouldn't happen");
+ return;
+ }
pPed->Load(buf);
if (pedtype == PEDTYPE_PLAYER1) {
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 4fd7f1a5..7f778498 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -404,6 +404,9 @@ void CRadar::Draw3dMarkers()
case BLIP_CHAR:
{
CEntity *entity = CPools::GetPedPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
+#ifdef FIX_BUGS
+ if(!entity) break;
+#endif
if (entity != nil) {
if (((CPed*)entity)->InVehicle())
entity = ((CPed * )entity)->m_pMyVehicle;
diff --git a/src/entities/Entity.cpp b/src/entities/Entity.cpp
index 4885d631..dc70a31a 100644
--- a/src/entities/Entity.cpp
+++ b/src/entities/Entity.cpp
@@ -504,6 +504,9 @@ CEntity::Add(void)
case ENTITY_TYPE_DUMMY:
list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP];
break;
+#ifdef FIX_BUGS
+ default: debug("This shouldn't happen"); return;
+#endif
}
list->InsertItem(this);
}
@@ -564,6 +567,9 @@ CEntity::Remove(void)
case ENTITY_TYPE_DUMMY:
list = &s->m_lists[ENTITYLIST_DUMMIES_OVERLAP];
break;
+#ifdef FIX_BUGS
+ default: debug("This shouldn't happen"); return;
+#endif
}
list->RemoveItem(this);
}
diff --git a/src/entities/Physical.cpp b/src/entities/Physical.cpp
index ed01297e..4088f1d1 100644
--- a/src/entities/Physical.cpp
+++ b/src/entities/Physical.cpp
@@ -126,6 +126,8 @@ CPhysical::Add(void)
break;
default:
assert(0);
+ debug("This shouldn't happen");
+ return;
}
CPtrNode *node = list->InsertItem(this);
assert(node);
@@ -191,17 +193,20 @@ CPhysical::RemoveAndAdd(void)
list = &s->m_lists[ENTITYLIST_OBJECTS_OVERLAP];
break;
}
- if(next){
- // If we still have old nodes, use them
- next->list->RemoveNode(next->listnode);
- list->InsertNode(next->listnode);
- next->list = list;
- next->sector = s;
- next = next->next;
- }else{
- CPtrNode *node = list->InsertItem(this);
- m_entryInfoList.InsertItem(list, node, s);
- }
+#ifdef FIX_BUGS
+ if(list)
+#endif
+ if(next) {
+ // If we still have old nodes, use them
+ next->list->RemoveNode(next->listnode);
+ list->InsertNode(next->listnode);
+ next->list = list;
+ next->sector = s;
+ next = next->next;
+ } else {
+ CPtrNode *node = list->InsertItem(this);
+ m_entryInfoList.InsertItem(list, node, s);
+ }
}
// Remove old nodes we no longer need
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index 87e77ef3..a498e251 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -4348,13 +4348,15 @@ CPed::PedSetDraggedOutCarCB(CAnimBlendAssociation *dragAssoc, void *arg)
}
#endif
- if (quickJackedAssoc) {
- dragAssoc->SetDeleteCallback(PedSetQuickDraggedOutCarPositionCB, ped);
- } else {
- dragAssoc->SetDeleteCallback(PedSetDraggedOutCarPositionCB, ped);
- if (ped->CanSetPedState())
- CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_GETUP1, 1000.0f);
- }
+#ifdef FIX_BUGS
+ if(dragAssoc)
+#endif
+ if(quickJackedAssoc) {
+ dragAssoc->SetDeleteCallback(PedSetQuickDraggedOutCarPositionCB, ped);
+ } else {
+ dragAssoc->SetDeleteCallback(PedSetDraggedOutCarPositionCB, ped);
+ if(ped->CanSetPedState()) CAnimManager::BlendAnimation(ped->GetClump(), ASSOCGRP_STD, ANIM_GETUP1, 1000.0f);
+ }
ped->ReplaceWeaponWhenExitingVehicle();
diff --git a/src/peds/PedAI.cpp b/src/peds/PedAI.cpp
index 089c8d9d..73958a43 100644
--- a/src/peds/PedAI.cpp
+++ b/src/peds/PedAI.cpp
@@ -2244,6 +2244,9 @@ CPed::PedAnimAlignCB(CAnimBlendAssociation *animAssoc, void *arg)
enterDoor = DOOR_REAR_LEFT;
break;
default:
+#ifdef FIX_BUGS
+ enterDoor = DOOR_BONNET;
+#endif
break;
}
@@ -2356,7 +2359,7 @@ CPed::PedAnimDoorOpenCB(CAnimBlendAssociation* animAssoc, void* arg)
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_LR: door = DOOR_REAR_LEFT; pedInSeat = veh->pPassengers[1]; break;
- default: assert(0);
+ default: assert(0); debug("This shouldn't happen"); return;
}
if (ped->m_fHealth == 0.0f || CPad::GetPad(0)->ArePlayerControlsDisabled() && pedInSeat && pedInSeat->IsPlayer()) {
@@ -2554,6 +2557,9 @@ CPed::PedAnimPullPedOutCB(CAnimBlendAssociation* animAssoc, void* arg)
case PEDTYPE_PLAYER4:
padNo = 3;
break;
+ default:
+ padNo = 0;
+ break;
}
CPad *pad = CPad::GetPad(padNo);
@@ -2657,6 +2663,9 @@ CPed::PedAnimGetInCB(CAnimBlendAssociation *animAssoc, void *arg)
enterDoor = DOOR_REAR_LEFT;
break;
default:
+#ifdef FIX_BUGS
+ enterDoor = DOOR_BONNET;
+#endif
break;
}
if (!veh->IsDoorMissing(enterDoor)) {
@@ -2752,12 +2761,15 @@ CPed::PedAnimDoorCloseCB(CAnimBlendAssociation *animAssoc, void *arg)
veh->ProcessOpenDoor(ped->m_vehDoor, ANIM_CAR_CLOSEDOOR_LHS, 1.0f);
eDoors door;
- switch (ped->m_vehDoor) {
- case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break;
- case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break;
- case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break;
- case CAR_DOOR_LR: door = DOOR_REAR_LEFT; break;
- default: assert(0);
+ switch(ped->m_vehDoor) {
+ case CAR_DOOR_RF: door = DOOR_FRONT_RIGHT; break;
+ case CAR_DOOR_RR: door = DOOR_REAR_RIGHT; break;
+ case CAR_DOOR_LF: door = DOOR_FRONT_LEFT; break;
+ case CAR_DOOR_LR: door = DOOR_REAR_LEFT; break;
+ default:
+ assert(0);
+ debug("This shouldn't happen");
+ return;
}
if (veh->Damage.GetDoorStatus(door) == DOOR_STATUS_SWINGING)
@@ -2926,6 +2938,9 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
door = DOOR_REAR_LEFT;
break;
default:
+#ifdef FIX_BUGS
+ door = DOOR_BONNET;
+#endif
break;
}
bool closeDoor = !veh->IsDoorMissing(door);
@@ -2947,6 +2962,12 @@ CPed::PedAnimStepOutCarCB(CAnimBlendAssociation* animAssoc, void* arg)
case PEDTYPE_PLAYER4:
padNo = 3;
break;
+ default:
+#ifdef FIX_BUGS
+ padNo = 0;
+ debug("This shouldn't happen");
+#endif
+ break;
}
CPad* pad = CPad::GetPad(padNo);
bool engineIsIntact = veh->IsCar() && ((CAutomobile*)veh)->Damage.GetEngineStatus() >= 225;
@@ -3285,6 +3306,9 @@ CPed::SetCarJack(CVehicle* car)
{
uint8 doorFlag;
eDoors door;
+#ifdef FIX_BUGS
+ door = DOOR_BONNET;
+#endif
CPed *pedInSeat = nil;
if (car->IsBoat())
@@ -3440,8 +3464,10 @@ CPed::BeingDraggedFromCar(void)
if (!dontRunAnim)
m_pVehicleAnim = CAnimManager::AddAnimation(GetClump(), ASSOCGRP_STD, enterAnim);
-
- m_pVehicleAnim->SetFinishCallback(PedSetDraggedOutCarCB, this);
+#ifdef FIX_BUGS
+ if(m_pVehicleAnim)
+#endif
+ m_pVehicleAnim->SetFinishCallback(PedSetDraggedOutCarCB, this);
lineUpType = LINE_UP_TO_CAR_START;
} else if (m_pVehicleAnim->currentTime <= 1.4f) {
m_vecMoveSpeed = CVector(0.0f, 0.0f, 0.0f);
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index 7aa01f5a..231ae14f 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -745,7 +745,10 @@ CWaterLevel::RenderWater()
if ( fHugeSectorDistToCamSqr >= SQR(500.0f) /*fHugeSectorNearDist*/ )
{
float fZ;
-
+#ifdef FIX_BUGS
+ fZ = 0.f;
+#endif
+
if ( aWaterBlockList[2*x+0][2*y+0] >= 0 )
fZ = ms_aWaterZs[ aWaterBlockList[2*x+0][2*y+0] ];
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index a7cafec8..d0f9e7ba 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -251,6 +251,9 @@ GenericLoad()
uint8 *buf;
int32 file;
uint32 size;
+#ifdef FIX_BUGS
+ size = 0;
+#endif
#ifdef MISSION_REPLAY
int8 qs;
#endif
diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp
index 7524444b..9a0e5847 100644
--- a/src/vehicles/CarGen.cpp
+++ b/src/vehicles/CarGen.cpp
@@ -100,7 +100,12 @@ void CCarGenerator::DoInternalProcessing()
// So game crashes if it's bike :D
if (((CVehicleModelInfo*)CModelInfo::GetModelInfo(m_nModelIndex))->m_vehicleType != VEHICLE_TYPE_BIKE)
pCar = new CAutomobile(m_nModelIndex, PARKED_VEHICLE);
-
+#ifdef FIX_BUGS
+ else {
+ debug("This shouldn't happen");
+ return;
+ }
+#endif
pCar->SetIsStatic(false);
pCar->bEngineOn = false;
pos.z += pCar->GetDistanceFromCentreOfMassToBaseOfModel();