summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/collision/Collision.cpp2
-rw-r--r--src/control/CarCtrl.cpp2
-rw-r--r--src/control/Garages.cpp2
-rw-r--r--src/control/RoadBlocks.cpp6
-rw-r--r--src/control/Script.cpp2
-rw-r--r--src/core/Radar.cpp8
-rw-r--r--src/core/World.cpp8
-rw-r--r--src/fakerw/fake.cpp4
-rw-r--r--src/fakerw/rwcore.h8
-rw-r--r--src/peds/Ped.cpp12
-rw-r--r--src/peds/Population.cpp8
-rw-r--r--src/renderer/Fluff.cpp2
-rw-r--r--src/renderer/Renderer.cpp4
-rw-r--r--src/save/GenericGameStorage.cpp50
-rw-r--r--src/vehicles/CarGen.cpp2
15 files changed, 86 insertions, 34 deletions
diff --git a/src/collision/Collision.cpp b/src/collision/Collision.cpp
index bb2c2e71..946513d3 100644
--- a/src/collision/Collision.cpp
+++ b/src/collision/Collision.cpp
@@ -105,7 +105,7 @@ GetCollisionInSectorList(CPtrList &list)
for(node = list.first; node; node = node->next){
e = (CEntity*)node->item;
- level = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel()->level;
+ level = CModelInfo::GetColModel(e->GetModelIndex())->level;
if(level != LEVEL_GENERIC)
return (eLevelName)level;
}
diff --git a/src/control/CarCtrl.cpp b/src/control/CarCtrl.cpp
index 0221a5eb..026a2057 100644
--- a/src/control/CarCtrl.cpp
+++ b/src/control/CarCtrl.cpp
@@ -427,7 +427,7 @@ CCarCtrl::GenerateOneRandomCar()
pVehicle->m_bSirenOrAlarm = true;
pVehicle->AutoPilot.m_nNextPathNodeInfo = connectionId;
pVehicle->AutoPilot.m_nNextLane = pVehicle->AutoPilot.m_nCurrentLane = CGeneral::GetRandomNumber() % lanesOnCurrentRoad;
- CBox* boundingBox = &CModelInfo::GetModelInfo(pVehicle->GetModelIndex())->GetColModel()->boundingBox;
+ CBox* boundingBox = &CModelInfo::GetColModel(pVehicle->GetModelIndex())->boundingBox;
float carLength = 1.0f + (boundingBox->max.y - boundingBox->min.y) / 2;
float distanceBetweenNodes = (pCurNode->GetPosition() - pNextNode->GetPosition()).Magnitude2D();
/* If car is so long that it doesn't fit between two car nodes, place it directly in the middle. */
diff --git a/src/control/Garages.cpp b/src/control/Garages.cpp
index 43bf6cea..c4916878 100644
--- a/src/control/Garages.cpp
+++ b/src/control/Garages.cpp
@@ -2347,7 +2347,7 @@ void CGarages::GivePlayerDetonator()
float CGarages::FindDoorHeightForMI(int32 mi)
{
- return CModelInfo::GetModelInfo(mi)->GetColModel()->boundingBox.max.z - CModelInfo::GetModelInfo(mi)->GetColModel()->boundingBox.min.z - 0.1f;
+ return CModelInfo::GetColModel(mi)->boundingBox.max.z - CModelInfo::GetColModel(mi)->boundingBox.min.z - 0.1f;
}
void CGarage::TidyUpGarage()
diff --git a/src/control/RoadBlocks.cpp b/src/control/RoadBlocks.cpp
index 46eee71f..e30313bf 100644
--- a/src/control/RoadBlocks.cpp
+++ b/src/control/RoadBlocks.cpp
@@ -60,7 +60,7 @@ CRoadBlocks::GenerateRoadBlockCopsForCar(CVehicle* pVehicle, int32 roadBlockType
CEntity* pEntityToAttack = (CEntity*)FindPlayerVehicle();
if (!pEntityToAttack)
pEntityToAttack = (CEntity*)FindPlayerPed();
- CColModel* pPoliceColModel = CModelInfo::GetModelInfo(MI_POLICE)->GetColModel();
+ CColModel* pPoliceColModel = CModelInfo::GetColModel(MI_POLICE);
float fRadius = pVehicle->GetBoundRadius() / pPoliceColModel->boundingSphere.radius;
for (int32 i = 0; i < 2; i++) {
const int32 roadBlockIndex = i + 2 * roadBlockType;
@@ -217,7 +217,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
vehicleId = MI_ENFORCER;
if (!CStreaming::HasModelLoaded(vehicleId))
vehicleId = MI_POLICE;
- CColModel* pVehicleColModel = CModelInfo::GetModelInfo(vehicleId)->GetColModel();
+ CColModel *pVehicleColModel = CModelInfo::GetColModel(vehicleId);
float fModelRadius = 2.0f * pVehicleColModel->boundingSphere.radius + 0.25f;
int16 numRoadblockVehicles = Min(6, (int16)(distBetween / fModelRadius));
for (int16 i = 0; i < numRoadblockVehicles; i++) {
@@ -231,7 +231,7 @@ CRoadBlocks::CreateRoadBlockBetween2Points(CVector point1, CVector point2)
tmp.RotateZ(((CGeneral::GetRandomNumber() & 0xFF) - 128.0f) * 0.003f + 3.1416f);
tmp.SetTranslateOnly(offset * forward + pos);
tmp.GetPosition().z += 0.6f;
- float fModelRadius = CModelInfo::GetModelInfo(vehicleId)->GetColModel()->boundingSphere.radius - 0.25f;
+ float fModelRadius = CModelInfo::GetColModel(vehicleId)->boundingSphere.radius - 0.25f;
int16 colliding = 0;
CWorld::FindObjectsKindaColliding(tmp.GetPosition(), fModelRadius, 0, &colliding, 2, nil, false, true, true, false, false);
if (!colliding) {
diff --git a/src/control/Script.cpp b/src/control/Script.cpp
index 6760f77f..5a61c2f7 100644
--- a/src/control/Script.cpp
+++ b/src/control/Script.cpp
@@ -3253,7 +3253,7 @@ int8 CRunningScript::ProcessCommands200To299(int32 command)
CTheScripts::ReadTextLabelFromScript(&m_nIp, label);
int zoneToCheck = CTheZones::FindZoneByLabelAndReturnIndex(label, ZONE_DEFAULT);
if (zoneToCheck != -1)
- m_nIp += KEY_LENGTH_IN_SCRIPT; /* why only if zone != 1? */
+ m_nIp += KEY_LENGTH_IN_SCRIPT; /* why only if zone != -1? */
CVector pos = pPlayer->GetPos();
CZone* pZone = CTheZones::GetNavigationZone(zoneToCheck);
UpdateCompareFlag(CTheZones::PointLiesWithinZone(&pos, pZone));
diff --git a/src/core/Radar.cpp b/src/core/Radar.cpp
index 2a56598a..6fb28184 100644
--- a/src/core/Radar.cpp
+++ b/src/core/Radar.cpp
@@ -534,7 +534,7 @@ void CRadar::Draw3dMarkers()
CEntity *entity = CPools::GetVehiclePool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
CVector pos = entity->GetPosition();
- pos.z += 1.2f * CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 2.5f;
+ pos.z += 1.2f * CModelInfo::GetColModel(entity->GetModelIndex())->boundingBox.max.z + 2.5f;
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 2.5f, CARBLIP_MARKER_COLOR_R, CARBLIP_MARKER_COLOR_G, CARBLIP_MARKER_COLOR_B, CARBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
}
break;
@@ -558,7 +558,7 @@ void CRadar::Draw3dMarkers()
CEntity *entity = CPools::GetObjectPool()->GetAt(ms_RadarTrace[i].m_nEntityHandle);
if (ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_BOTH || ms_RadarTrace[i].m_eBlipDisplay == BLIP_DISPLAY_MARKER_ONLY) {
CVector pos = entity->GetPosition();
- pos.z += CModelInfo::GetModelInfo(entity->GetModelIndex())->GetColModel()->boundingBox.max.z + 1.0f + 1.0f;
+ pos.z += CModelInfo::GetColModel(entity->GetModelIndex())->boundingBox.max.z + 1.0f + 1.0f;
C3dMarkers::PlaceMarker(i | (ms_RadarTrace[i].m_BlipIndex << 16), MARKERTYPE_ARROW, pos, 1.0f, OBJECTBLIP_MARKER_COLOR_R, OBJECTBLIP_MARKER_COLOR_G, OBJECTBLIP_MARKER_COLOR_B, OBJECTBLIP_MARKER_COLOR_A, 1024, 0.2f, 5);
}
break;
@@ -1560,12 +1560,12 @@ CRadar::ToggleTargetMarker(float x, float y)
{
if (TargetMarkerId == -1) {
int nextBlip;
- for (nextBlip = 0; nextBlip < NUMRADARBLIPS; nextBlip++) {
+ for (nextBlip = NUMRADARBLIPS-1; nextBlip >= 0; nextBlip--) {
if (!ms_RadarTrace[nextBlip].m_bInUse)
break;
}
- if (nextBlip == NUMRADARBLIPS)
+ if (nextBlip == 0)
return;
ms_RadarTrace[nextBlip].m_eBlipType = BLIP_COORD;
diff --git a/src/core/World.cpp b/src/core/World.cpp
index fb0323ae..2de36383 100644
--- a/src/core/World.cpp
+++ b/src/core/World.cpp
@@ -365,7 +365,7 @@ CWorld::ProcessLineOfSightSectorList(CPtrList &list, const CColLine &line, CColP
colmodel = nil;
} else if(e->bUsesCollision)
- colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
+ colmodel = CModelInfo::GetColModel(e->GetModelIndex());
if(colmodel && CCollision::ProcessLineOfSight(line, e->GetMatrix(), *colmodel, point, mindist,
ignoreSeeThrough, ignoreShootThrough))
@@ -465,7 +465,7 @@ CWorld::ProcessVerticalLineSectorList(CPtrList &list, const CColLine &line, CCol
if(e->m_scanCode != GetCurrentScanCode() && e->bUsesCollision) {
e->m_scanCode = GetCurrentScanCode();
- colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
+ colmodel = CModelInfo::GetColModel(e->GetModelIndex());
if(CCollision::ProcessVerticalLine(line, e->GetMatrix(), *colmodel, point, mindist,
ignoreSeeThrough, false, poly))
entity = e;
@@ -666,7 +666,7 @@ CWorld::GetIsLineOfSightSectorListClear(CPtrList &list, const CColLine &line, bo
if(e != pIgnoreEntity && !(ignoreSomeObjects && CameraToIgnoreThisObject(e))) {
- colmodel = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
+ colmodel = CModelInfo::GetColModel(e->GetModelIndex());
if(CCollision::TestLineOfSight(line, e->GetMatrix(), *colmodel, ignoreSeeThrough, false))
return false;
@@ -971,7 +971,7 @@ CWorld::TestSphereAgainstSectorList(CPtrList &list, CVector spherePos, float rad
float distance = diff.Magnitude();
if(e->GetBoundRadius() + radius > distance) {
- CColModel *eCol = CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel();
+ CColModel *eCol = CModelInfo::GetColModel(e->GetModelIndex());
int collidedSpheres =
CCollision::ProcessColModels(sphereMat, OurColModel, e->GetMatrix(), *eCol,
gaTempSphereColPoints, nil, nil);
diff --git a/src/fakerw/fake.cpp b/src/fakerw/fake.cpp
index c6f6b3d1..f2232e99 100644
--- a/src/fakerw/fake.cpp
+++ b/src/fakerw/fake.cpp
@@ -235,8 +235,8 @@ RwRaster *RwRasterGetCurrentContext(void) { return Raster::getCurrentContext(
RwBool RwRasterClear(RwInt32 pixelValue);
RwBool RwRasterClearRect(RwRect * rpRect, RwInt32 pixelValue);
RwRaster *RwRasterShowRaster(RwRaster * raster, void *dev, RwUInt32 flags);
-RwUInt8 *RwRasterLock(RwRaster * raster, RwUInt8 level, RwInt32 lockMode);
-RwRaster *RwRasterUnlock(RwRaster * raster);
+RwUInt8 *RwRasterLock(RwRaster * raster, RwUInt8 level, RwInt32 lockMode) { return raster->lock(level, lockMode); }
+RwRaster *RwRasterUnlock(RwRaster * raster) { raster->unlock(0); return raster; }
RwUInt8 *RwRasterLockPalette(RwRaster * raster, RwInt32 lockMode);
RwRaster *RwRasterUnlockPalette(RwRaster * raster);
RwInt32 RwRasterRegisterPlugin(RwInt32 size, RwUInt32 pluginID, RwPluginObjectConstructor constructCB, RwPluginObjectDestructor destructCB, RwPluginObjectCopy copyCB);
diff --git a/src/fakerw/rwcore.h b/src/fakerw/rwcore.h
index 7a142abd..4f690fd3 100644
--- a/src/fakerw/rwcore.h
+++ b/src/fakerw/rwcore.h
@@ -107,6 +107,14 @@ enum RwRasterFormat
rwRASTERFORMATMASK = 0xff00
};
+enum RwRasterLockMode
+{
+ rwRASTERLOCKWRITE = rw::Raster::LOCKWRITE,
+ rwRASTERLOCKREAD = rw::Raster::LOCKREAD,
+ rwRASTERLOCKNOFETCH = rw::Raster::LOCKNOFETCH,
+ rwRASTERLOCKRAW = rw::Raster::LOCKRAW,
+};
+
enum RwRasterFlipMode
{
rwRASTERFLIPDONTWAIT = 0,
diff --git a/src/peds/Ped.cpp b/src/peds/Ped.cpp
index f0c1c4fb..5bfa0602 100644
--- a/src/peds/Ped.cpp
+++ b/src/peds/Ped.cpp
@@ -2204,7 +2204,7 @@ CPed::ProcessControl(void)
Say(SOUND_PED_DAMAGE);
}
- CColModel* collidingCol = CModelInfo::GetModelInfo(collidingVeh->m_modelIndex)->GetColModel();
+ CColModel *collidingCol = CModelInfo::GetColModel(collidingVeh->m_modelIndex);
CVector colMinVec = collidingCol->boundingBox.min;
CVector colMaxVec = collidingCol->boundingBox.max;
@@ -2896,8 +2896,8 @@ CPed::ProcessEntityCollision(CEntity *collidingEnt, CColPoint *collidingPoints)
CColPoint intersectionPoint;
CColLine ourLine;
- CColModel *ourCol = CModelInfo::GetModelInfo(GetModelIndex())->GetColModel();
- CColModel *hisCol = CModelInfo::GetModelInfo(collidingEnt->GetModelIndex())->GetColModel();
+ CColModel *ourCol = CModelInfo::GetColModel(GetModelIndex());
+ CColModel *hisCol = CModelInfo::GetColModel(collidingEnt->GetModelIndex());
if (!bUsesCollision && !bJustCheckCollision)
return 0;
@@ -3414,7 +3414,7 @@ void
CPed::SetDirectionToWalkAroundObject(CEntity *obj)
{
float distLimitForTimer = 8.0f;
- CColModel *objCol = CModelInfo::GetModelInfo(obj->GetModelIndex())->GetColModel();
+ CColModel *objCol = CModelInfo::GetColModel(obj->GetModelIndex());
CVector objColMin = objCol->boundingBox.min;
CVector objColMax = objCol->boundingBox.max;
CVector objColCenter = (objColMin + objColMax) / 2.0f;
@@ -4963,7 +4963,7 @@ CPed::PreRender(void)
if (CWeather::Rain > 0.3f && TheCamera.SoundDistUp > 15.0f) {
if ((TheCamera.GetPosition() - GetPosition()).Magnitude() < 25.0f) {
bool doSplashUp = true;
- CColModel *ourCol = CModelInfo::GetModelInfo(GetModelIndex())->GetColModel();
+ CColModel *ourCol = CModelInfo::GetColModel(GetModelIndex());
CVector speed = FindPlayerSpeed();
if (Abs(speed.x) <= 0.05f && Abs(speed.y) <= 0.05f) {
@@ -9420,7 +9420,7 @@ CPed::FinishLaunchCB(CAnimBlendAssociation *animAssoc, void *arg)
return;
CVector forward(0.09f * ped->GetForward() + ped->GetPosition());
- forward.z += CModelInfo::GetModelInfo(ped->GetModelIndex())->GetColModel()->spheres[2].center.z + 0.35f;
+ forward.z += CModelInfo::GetColModel(ped->GetModelIndex())->spheres[2].center.z + 0.35f;
CEntity *obstacle = CWorld::TestSphereAgainstWorld(forward, 0.25f, nil, true, true, false, true, false, false);
if (!obstacle) {
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index cf3a195c..6a2e5a8f 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -1516,7 +1516,7 @@ CPopulation::PlaceGangMembersInCircle(ePedType pedType, int pedAmount, CVector c
int gangModel = ChooseGangOccupation(pedType - PEDTYPE_GANG1);
if (((CPedModelInfo*)CModelInfo::GetModelInfo(gangModel))->GetRwObject()) {
CEntity* obstacles[6] = { nil, nil, nil, nil, nil, nil };
- CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetModelInfo(gangModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles);
+ CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetColModel(gangModel)->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles);
bool foundObstacle = false;
for (int m = 0; m < ARRAY_SIZE(obstacles); m++) {
CEntity* obstacle = obstacles[m];
@@ -1600,7 +1600,7 @@ CPopulation::PlaceCouple(ePedType manType, int32 manModel, ePedType womanType, i
return;
if (!TheCamera.IsSphereVisible(coors, 1.5f) || MIN_CREATION_DIST * PedCreationDistMultiplier() <= (coors - FindPlayerPed()->GetPosition()).Magnitude2D()) {
- if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetModelInfo(manModel)->GetColModel()->boundingSphere.radius, -1, nil)) {
+ if (CPedPlacement::IsPositionClearForPed(coors, CModelInfo::GetColModel(manModel)->boundingSphere.radius, -1, nil)) {
bool manFoundGround;
float manGroundZ = CWorld::FindGroundZFor3DCoord(coors.x, coors.y, coors.z, &manFoundGround) + 1.0f;
if (manFoundGround) {
@@ -1634,7 +1634,7 @@ CPopulation::PlaceCouple(ePedType manType, int32 manModel, ePedType womanType, i
CEntity* obstacles[3];
memcpy(obstacles, gCoupleObstacles, sizeof(gCoupleObstacles));
- CPedPlacement::IsPositionClearForPed(womanPos, CModelInfo::GetModelInfo(womanModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles);
+ CPedPlacement::IsPositionClearForPed(womanPos, CModelInfo::GetColModel(womanModel)->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles);
for (int i = 0; i < ARRAY_SIZE(obstacles); i++) {
CEntity *obstacle = obstacles[i];
if (obstacle) {
@@ -1710,7 +1710,7 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
if (pedModelInfo->GetRwObject()) {
CEntity* obstacles[6] = { nil, nil, nil, nil, nil, nil };
- CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetModelInfo(pedModel)->GetColModel()->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles);
+ CPedPlacement::IsPositionClearForPed(finalPos, CModelInfo::GetColModel(pedModel)->boundingSphere.radius, ARRAY_SIZE(obstacles), obstacles);
bool foundObstacle = false;
for (int m = 0; m < ARRAY_SIZE(obstacles); m++) {
CEntity* obstacle = obstacles[m];
diff --git a/src/renderer/Fluff.cpp b/src/renderer/Fluff.cpp
index 404f1a4a..b914d1bc 100644
--- a/src/renderer/Fluff.cpp
+++ b/src/renderer/Fluff.cpp
@@ -929,7 +929,7 @@ CEscalator::AddThisOne(CVector pos0, CVector pos1, CVector pos2, CVector pos3, b
m_pos2 = pos2;
m_pos3 = pos3;
- float escalatorStepHeight = CModelInfo::GetModelInfo(MI_ESCALATORSTEP)->GetColModel()->boundingBox.max.z;
+ float escalatorStepHeight = CModelInfo::GetColModel(MI_ESCALATORSTEP)->boundingBox.max.z;
m_pos0.z -= escalatorStepHeight;
m_pos1.z -= escalatorStepHeight;
m_pos2.z -= escalatorStepHeight;
diff --git a/src/renderer/Renderer.cpp b/src/renderer/Renderer.cpp
index 8e460208..28177cca 100644
--- a/src/renderer/Renderer.cpp
+++ b/src/renderer/Renderer.cpp
@@ -141,7 +141,7 @@ CRenderer::RenderOneRoad(CEntity *e)
if(gbDontRenderBuildings)
return;
if(gbShowCollisionPolys || gbShowCollisionPolysReflections || gbShowCollisionPolysNoShadows)
- CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(), e->GetModelIndex());
+ CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetColModel(e->GetModelIndex()), e->GetModelIndex());
else
#endif
{
@@ -164,7 +164,7 @@ CRenderer::RenderOneNonRoad(CEntity *e)
#ifndef MASTER
if(gbShowCollisionPolys || gbShowCollisionPolysReflections || gbShowCollisionPolysNoShadows){
if(!e->IsVehicle()){
- CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetModelInfo(e->GetModelIndex())->GetColModel(), e->GetModelIndex());
+ CCollision::DrawColModel_Coloured(e->GetMatrix(), *CModelInfo::GetColModel(e->GetModelIndex()), e->GetModelIndex());
return;
}
}else
diff --git a/src/save/GenericGameStorage.cpp b/src/save/GenericGameStorage.cpp
index 3db2de59..ccf1bec8 100644
--- a/src/save/GenericGameStorage.cpp
+++ b/src/save/GenericGameStorage.cpp
@@ -693,6 +693,7 @@ enum
SAVE_TYPE_64_BIT = 2,
SAVE_TYPE_MSVC = 4,
SAVE_TYPE_GCC = 8,
+ SAVE_TYPE_STEAM = 16,
};
uint8
@@ -707,6 +708,14 @@ GetSaveType(char *savename)
uint8 *buf = work_buff;
CFileMgr::Read(file, (const char *)work_buff, size); // simple vars + scripts
+ buf += 0x40 + sizeof(int32) + sizeof(int32) + sizeof(float) * 3;
+
+ int8 steam_byte;
+ ReadDataFromBufferPointer(buf, steam_byte);
+
+ if (steam_byte == -3)
+ save_type |= SAVE_TYPE_STEAM;
+
LoadSaveDataBlockNoCheck(buf, file, size); // ped pool
LoadSaveDataBlockNoCheck(buf, file, size); // garages
@@ -758,6 +767,29 @@ GetSaveType(char *savename)
}
static void
+FixSimpleVarsAndScripts(uint8 save_type, uint8 *buf, uint8 *buf2, uint32 *size)
+{
+ uint8 *buf_start = buf;
+ uint8 *buf2_start = buf2;
+ uint32 read = *size;
+ uint32 written = *size - (sizeof(int8) + 3);
+
+ uint32 pre_steam = 0x40 + sizeof(int32) + sizeof(int32) + sizeof(float) * 3;
+ uint32 post_steam = *size - (sizeof(int8) + 3) - pre_steam;
+
+ CopyBuf(buf, buf2, pre_steam);
+ SkipBuf(buf, sizeof(int8) + 3);
+ CopyBuf(buf, buf2, post_steam);
+
+ *size = 0;
+
+ assert(buf - buf_start == read);
+ assert(buf2 - buf2_start == written);
+
+ *size = written;
+}
+
+static void
FixGarages(uint8 save_type, uint8 *buf, uint8 *buf2, uint32 *size)
{
// hardcoded: 7876
@@ -1018,7 +1050,7 @@ FixScriptPaths(uint8 save_type, uint8 *buf, uint8 *buf2, uint32 *size)
bool
FixSave(int32 slot, uint8 save_type)
{
- if (save_type & SAVE_TYPE_32_BIT && save_type & SAVE_TYPE_MSVC)
+ if (save_type & SAVE_TYPE_32_BIT && save_type & SAVE_TYPE_MSVC && !(save_type & SAVE_TYPE_STEAM))
return true;
bool success = false;
@@ -1044,17 +1076,29 @@ FixSave(int32 slot, uint8 save_type)
totalSize = 0;
CFileMgr::Read(file_in, (const char *)&size, sizeof(size));
+ size = align4bytes(size);
buf = work_buff;
CFileMgr::Read(file_in, (const char *)work_buff, size); // simple vars + scripts
- WriteSavaDataBlockNoFunc(buf, file_out, size);
+ if (save_type & SAVE_TYPE_STEAM && save_type & SAVE_TYPE_MSVC && save_type & SAVE_TYPE_32_BIT) {
+ memset(work_buff2, 0, sizeof(work_buff2));
+ buf2 = work_buff2;
+ FixSimpleVarsAndScripts(save_type, buf, buf2, &size);
+ if (!PcSaveHelper.PcClassSaveRoutine(file_out, work_buff2, size))
+ goto fail;
+ totalSize += size;
+ } else
+ WriteSavaDataBlockNoFunc(buf, file_out, size);
LoadSaveDataBlockNoCheck(buf, file_in, size); // ped pool
WriteSavaDataBlockNoFunc(buf, file_out, size);
LoadSaveDataBlockNoCheck(buf, file_in, size); // garages
- FixSaveDataBlock(FixGarages, file_out, size); // garages need to be fixed in either case
+ if (!(save_type & SAVE_TYPE_STEAM && save_type & SAVE_TYPE_MSVC && save_type & SAVE_TYPE_32_BIT))
+ FixSaveDataBlock(FixGarages, file_out, size);
+ else
+ WriteSavaDataBlockNoFunc(buf, file_out, size);
LoadSaveDataBlockNoCheck(buf, file_in, size); // game logic
WriteSavaDataBlockNoFunc(buf, file_out, size);
diff --git a/src/vehicles/CarGen.cpp b/src/vehicles/CarGen.cpp
index 29d0c5c7..bce8cdab 100644
--- a/src/vehicles/CarGen.cpp
+++ b/src/vehicles/CarGen.cpp
@@ -202,7 +202,7 @@ bool CCarGenerator::CheckForBlockage(int32 mi)
{
int16 entities;
CEntity* pEntities[8];
- CColModel* pColModel = CModelInfo::GetModelInfo(mi)->GetColModel();
+ CColModel* pColModel = CModelInfo::GetColModel(mi);
CWorld::FindObjectsKindaColliding(CVector(m_vecPos), pColModel->boundingSphere.radius, 1, &entities, 8, pEntities, false, true, true, false, false);
for (int i = 0; i < entities; i++) {
if (m_vecPos.z + pColModel->boundingBox.min.z < pEntities[i]->GetPosition().z + pEntities[i]->GetColModel()->boundingBox.max.z + 1.0f &&