low effort save support

This commit is contained in:
Nikolay Korolev 2021-07-25 21:44:21 +03:00
parent 1619d2395e
commit bf4b39781b
11 changed files with 451 additions and 403 deletions

View File

@ -2613,14 +2613,12 @@ void CGarages::SetAllDoorsBackToOriginalHeight()
}
}
#define GARAGE_SIZE 208
void CGarages::Save(uint8 * buf, uint32 * size)
{
//INITSAVEBUF
*size = 10692; // for some reason it's not actual size again
//*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage));
#if !defined THIS_IS_STUPID && defined COMPATIBLE_SAVES
memset(buf + 7340, 0, *size - 7340); // garbage data is written otherwise
#endif
INITSAVEBUF
*size = (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * GARAGE_SIZE);
CloseHideOutGaragesBeforeSave();
WriteSaveBuf(buf, NumGarages);
WriteSaveBuf(buf, (uint32)BombsAreFree);
@ -2661,12 +2659,16 @@ void CGarages::Save(uint8 * buf, uint32 * size)
WriteSaveBuf(buf, aGarages[i].m_vDir1);
WriteSaveBuf(buf, aGarages[i].m_vDir2);
WriteSaveBuf(buf, aGarages[i].m_fSupZ);
WriteSaveBuf(buf, aGarages[i].m_vecSSGaragePos);
WriteSaveBuf(buf, aGarages[i].m_fSSGarageAngle);
WriteSaveBuf(buf, aGarages[i].m_fDir1Len);
WriteSaveBuf(buf, aGarages[i].m_fDir2Len);
WriteSaveBuf(buf, aGarages[i].m_fInfX);
WriteSaveBuf(buf, aGarages[i].m_fSupX);
WriteSaveBuf(buf, aGarages[i].m_fInfY);
WriteSaveBuf(buf, aGarages[i].m_fSupY);
WriteSaveBuf(buf, aGarages[i].m_nTimeCrusherCraneActivated);
ZeroSaveBuf(buf, 4);
WriteSaveBuf(buf, aGarages[i].m_fDoorPos);
WriteSaveBuf(buf, aGarages[i].m_fDoorHeight);
WriteSaveBuf(buf, aGarages[i].m_fDoor1X);
@ -2679,18 +2681,26 @@ void CGarages::Save(uint8 * buf, uint32 * size)
WriteSaveBuf(buf, aGarages[i].m_bCollectedCarsState);
ZeroSaveBuf(buf, 3 + 4);
ZeroSaveBuf(buf, sizeof(aGarages[i].m_sStoredCar));
WriteSaveBuf(buf, aGarages[i].m_bInitialized);
ZeroSaveBuf(buf, 3);
#ifdef GTA_NETWORK
ZeroSaveBuf(buf, 4);
#endif
WriteSaveBuf(buf, aGarages[i].m_bSSGarageAcceptedVehicle);
WriteSaveBuf(buf, aGarages[i].m_bLocked);
WriteSaveBuf(buf, aGarages[i].m_nSSGarageState);
WriteSaveBuf(buf, aGarages[i].m_bSSGarageStateChanging);
#else
WriteSaveBuf(buf, aGarages[i]);
#endif
}
//VALIDATESAVEBUF(*size);
VALIDATESAVEBUF(*size);
}
void CGarages::Load(uint8* buf, uint32 size)
{
//INITSAVEBUF
assert(size == 10692);
//assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * sizeof(CGarage)));
INITSAVEBUF
assert(size == (6 * sizeof(uint32) + TOTAL_COLLECTCARS_GARAGES * sizeof(*CarTypesCollected) + sizeof(uint32) + TOTAL_HIDEOUT_GARAGES * NUM_GARAGE_STORED_CARS * sizeof(CStoredCar) + NUM_GARAGES * GARAGE_SIZE));
CloseHideOutGaragesBeforeSave();
ReadSaveBuf(&NumGarages, buf);
int32 tempInt;
@ -2734,12 +2744,16 @@ void CGarages::Load(uint8* buf, uint32 size)
ReadSaveBuf(&aGarages[i].m_vDir1, buf);
ReadSaveBuf(&aGarages[i].m_vDir2, buf);
ReadSaveBuf(&aGarages[i].m_fSupZ, buf);
ReadSaveBuf(&aGarages[i].m_vecSSGaragePos, buf);
ReadSaveBuf(&aGarages[i].m_fSSGarageAngle, buf);
ReadSaveBuf(&aGarages[i].m_fDir1Len, buf);
ReadSaveBuf(&aGarages[i].m_fDir2Len, buf);
ReadSaveBuf(&aGarages[i].m_fInfX, buf);
ReadSaveBuf(&aGarages[i].m_fSupX, buf);
ReadSaveBuf(&aGarages[i].m_fInfY, buf);
ReadSaveBuf(&aGarages[i].m_fSupY, buf);
ReadSaveBuf(&aGarages[i].m_nTimeCrusherCraneActivated, buf);
SkipSaveBuf(buf, 4);
ReadSaveBuf(&aGarages[i].m_fDoorPos, buf);
ReadSaveBuf(&aGarages[i].m_fDoorHeight, buf);
ReadSaveBuf(&aGarages[i].m_fDoor1X, buf);
@ -2752,6 +2766,15 @@ void CGarages::Load(uint8* buf, uint32 size)
ReadSaveBuf(&aGarages[i].m_bCollectedCarsState, buf);
SkipSaveBuf(buf, 3 + 4);
SkipSaveBuf(buf, sizeof(aGarages[i].m_sStoredCar));
ReadSaveBuf(&aGarages[i].m_bInitialized, buf);
SkipSaveBuf(buf, 3);
#ifdef GTA_NETWORK
SkipSaveBuf(buf, 4);
#endif
ReadSaveBuf(&aGarages[i].m_bSSGarageAcceptedVehicle, buf);
ReadSaveBuf(&aGarages[i].m_bLocked, buf);
ReadSaveBuf(&aGarages[i].m_nSSGarageState, buf);
ReadSaveBuf(&aGarages[i].m_bSSGarageStateChanging, buf);
#else
ReadSaveBuf(&aGarages[i], buf);
#endif
@ -2765,11 +2788,14 @@ void CGarages::Load(uint8* buf, uint32 size)
else
aGarages[i].UpdateDoorsHeight();
}
//VALIDATESAVEBUF(size);
VALIDATESAVEBUF(size);
MessageEndTime = 0;
bCamShouldBeOutisde = false;
MessageStartTime = 0;
hGarages = DMAudio.CreateEntity(AUDIOTYPE_GARAGE, (void*)1);
if (hGarages >= 0)
DMAudio.SetEntityStatus(hGarages, TRUE);
}
bool

View File

@ -1853,7 +1853,7 @@ void FlushLog()
const uint32 CRunningScript::nSaveStructSize =
#ifdef COMPATIBLE_SAVES
136;
536;
#else
sizeof(CRunningScript);
#endif
@ -2691,7 +2691,7 @@ bool CTheScripts::Init(bool loaddata)
InvisibilitySettingArray[i] = nil;
if (loaddata) {
printf("loaddata = true\n");
//retval = GenericLoad(); // TODO
retval = GenericLoad();
}
for (int i = 0; i < MAX_ALLOWED_COLLISIONS; i++)
AllowedCollision[i] = 0;

View File

@ -2262,8 +2262,10 @@ void CTheScripts::SwapNearestBuildingModel(float x, float y, float z, float radi
}
}
CBuilding* pReplacedBuilding = ((CBuilding*)pClosestEntity);
pReplacedBuilding->ReplaceWithNewModel(mi2);
AddToBuildingSwapArray(pReplacedBuilding, mi1, mi2);
if (pReplacedBuilding) {
pReplacedBuilding->ReplaceWithNewModel(mi2);
AddToBuildingSwapArray(pReplacedBuilding, mi1, mi2);
}
}
void CTheScripts::AddToBuildingSwapArray(CBuilding* pBuilding, int32 old_model, int32 new_model)

View File

@ -2114,8 +2114,8 @@ void CTheScripts::RenderTheScriptDebugLines()
}
*/
#define SCRIPT_DATA_SIZE sizeof(CTheScripts::OnAMissionFlag) +\
4 * sizeof(uint32) * MAX_NUM_BUILDING_SWAPS + 2 * sizeof(uint32) * MAX_NUM_INVISIBILITY_SETTINGS + 5 * sizeof(uint32)
#define SCRIPT_DATA_SIZE sizeof(CTheScripts::OnAMissionFlag) + sizeof(tCollectiveData) * MAX_NUM_COLLECTIVES +\
4 * sizeof(uint32) * MAX_NUM_BUILDING_SWAPS + 2 * sizeof(uint32) * MAX_NUM_INVISIBILITY_SETTINGS + 4 * sizeof(uint32)
void CTheScripts::SaveAllScripts(uint8* buf, uint32* size)
{
@ -2124,7 +2124,7 @@ INITSAVEBUF
uint32 runningScripts = 0;
for (CRunningScript* pScript = pActiveScripts; pScript; pScript = pScript->GetNext())
runningScripts++;
*size = CRunningScript::nSaveStructSize * runningScripts + varSpace + SCRIPT_DATA_SIZE + SAVE_HEADER_SIZE + 3 * sizeof(uint32);
*size = CRunningScript::nSaveStructSize * runningScripts + varSpace + SCRIPT_DATA_SIZE + SAVE_HEADER_SIZE + 5 * sizeof(uint32);
WriteSaveHeader(buf, 'S', 'C', 'R', '\0', *size - SAVE_HEADER_SIZE);
WriteSaveBuf(buf, varSpace);
for (uint32 i = 0; i < varSpace; i++)
@ -2200,10 +2200,8 @@ INITSAVEBUF
VALIDATESAVEBUF(*size)
}
// TODO: I don't really understand how script loading works, so I leave it the VC way for now.
bool CTheScripts::LoadAllScripts(uint8* buf, uint32 size)
{
Init(); // TODO: in LCS CTheScripts::Init call GenericLoad, which then calls LoadAllScripts
INITSAVEBUF
CheckSaveHeader(buf, 'S', 'C', 'R', '\0', size - SAVE_HEADER_SIZE);
uint32 varSpace, type, handle;
@ -2222,7 +2220,6 @@ INITSAVEBUF
else
SkipSaveBuf(buf, 1);
}
// everything else is... gone? TODO
ReadSaveBuf(&tmp, buf);
script_assert(tmp == SCRIPT_DATA_SIZE);
ReadSaveBuf(&OnAMissionFlag, buf);
@ -2304,7 +2301,6 @@ INITSAVEBUF
ReadSaveBuf(&runningScripts, buf);
for (uint32 i = 0; i < runningScripts; i++)
CRunningScript().Load(buf);
StartTestScript(); // <- tmp hack
return true;
VALIDATESAVEBUF(size)
}

View File

@ -648,7 +648,7 @@ bool CGame::ShutDown(void)
return true;
}
void CGame::ReInitGameObjectVariables(void)
bool CGame::ReInitGameObjectVariables(bool load)
{
CGameLogic::InitAtStartOfGame();
#ifdef PS2_MENU
@ -693,7 +693,7 @@ void CGame::ReInitGameObjectVariables(void)
gPhoneInfo.Initialise();
PUSH_MEMID(MEMID_SCRIPT);
CTheScripts::Init();
bool res = CTheScripts::Init(load);
CGangs::Initialise();
POP_MEMID();
@ -706,12 +706,14 @@ void CGame::ReInitGameObjectVariables(void)
CStats::Init();
CPickups::Init();
CPacManPickups::Init();
CGarages::Init();
if (!load)
CGarages::Init();
CSpecialFX::Init();
CRopes::Init();
CWaterCannons::Init();
CScriptPaths::Init();
CParticle::ReloadConfig();
CParticle::SetPixelData();
#ifdef PS2_MENU
if ( !TheMemoryCard.m_bWantToLoad )
@ -730,6 +732,8 @@ void CGame::ReInitGameObjectVariables(void)
for (int32 i = 0; i < MAX_PADS; i++)
CPad::GetPad(i)->Clear(true);
return res;
}
void CGame::ReloadIPLs(void)
@ -800,13 +804,12 @@ void CGame::InitialiseWhenRestarting(void)
RestoreForStartLoad();
}
ReInitGameObjectVariables();
bool bLoadSuccessful = ReInitGameObjectVariables(FrontEndMenuManager.m_bWantToLoad);
if ( FrontEndMenuManager.m_bWantToLoad == true )
{
FrontEndMenuManager.m_bWantToLoad = false;
InitRadioStationPositionList();
if ( GenericLoad() == true )
if ( bLoadSuccessful == true )
{
DMAudio.ResetTimers(CTimer::GetTimeInMilliseconds());
CFerry::InitFerrys();
@ -825,8 +828,8 @@ void CGame::InitialiseWhenRestarting(void)
ShutDownForRestart();
CTimer::Stop();
CTimer::Initialise();
FrontEndMenuManager.m_bWantToLoad = false;
ReInitGameObjectVariables();
//FrontEndMenuManager.m_bWantToLoad = false;
ReInitGameObjectVariables(false);
currLevel = LEVEL_GENERIC;
CCollision::SortOutCollisionAfterLoad();
}
@ -835,6 +838,7 @@ void CGame::InitialiseWhenRestarting(void)
#endif
}
FrontEndMenuManager.m_bWantToLoad = true;
CTimer::Update();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
@ -845,6 +849,20 @@ void CGame::InitialiseWhenRestarting(void)
void CGame::Process(void)
{
if (FrontEndMenuManager.m_bWantToLoad) {
CTheScripts::StartTestScript();
CTheScripts::Process();
TheCamera.Process();
CStreaming::LoadScene(TheCamera.GetPosition());
//CGame::GenerateTempPedAtStartOfNetworkGame();
if (/* ?*/true){
CStreaming::RequestSpecialModel(MI_PLAYER, "player", STREAMFLAGS_DEPENDENCY | STREAMFLAGS_DONT_REMOVE);
CStreaming::LoadAllRequestedModels(false);
}
TheCamera.Process();
CStreaming::LoadScene(TheCamera.GetPosition());
FrontEndMenuManager.m_bWantToLoad = false;
}
CPad::UpdatePads();
#ifdef USE_CUSTOM_ALLOCATOR
ProcessTidyUpMemory();

View File

@ -62,7 +62,7 @@ public:
static void FinalShutdown(void);
static bool Initialise(const char *datFile);
static bool ShutDown(void);
static void ReInitGameObjectVariables(void);
static bool ReInitGameObjectVariables(bool);
static void ReloadIPLs(void);
static void ShutDownForRestart(void);
static void InitialiseWhenRestarting(void);

View File

@ -274,7 +274,7 @@ enum Config {
#define FIX_BUGS // fixes bugs that we've came across during reversing. You can undefine this only on release builds.
//#define MORE_LANGUAGES // Add more translations to the game
#define COMPATIBLE_SAVES // this allows changing structs while keeping saves compatible, and keeps saves compatible between platforms
#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES
//#define FIX_INCOMPATIBLE_SAVES // try to fix incompatible saves, requires COMPATIBLE_SAVES
#define LOAD_INI_SETTINGS // as the name suggests. fundamental for CUSTOM_FRONTEND_OPTIONS
#define NO_MOVIES // add option to disable intro videos

View File

@ -512,319 +512,323 @@ void CParticle::Initialise()
gpFireHoseRaster = RwTextureGetRaster(gpFireHoseTex);
CTxdStore::PopCurrentTxd();
for ( int32 i = 0; i < MAX_PARTICLES; i++ )
{
tParticleSystemData *entry = &mod_ParticleSystemManager.m_aParticles[i];
switch( i )
{
case PARTICLE_SPARK:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
case PARTICLE_SPARK_SMALL:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
case PARTICLE_WATER_SPARK:
entry->m_ppRaster = &gpSparkRaster;
break;
case PARTICLE_WHEEL_DIRT:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_SAND:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_WHEEL_WATER:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_BLOOD:
entry->m_ppRaster = &gpBloodRaster;
break;
case PARTICLE_BLOOD_SMALL:
entry->m_ppRaster = &gpBloodSmallRaster;
break;
case PARTICLE_BLOOD_SPURT:
entry->m_ppRaster = &gpBloodSmallRaster;
break;
case PARTICLE_DEBRIS:
entry->m_ppRaster = gpLeafRaster;
break;
case PARTICLE_DEBRIS2:
entry->m_ppRaster = &gpGungeRaster;
break;
case PARTICLE_FLYERS:
entry->m_ppRaster = &gpNewspaperRaster;
break;
case PARTICLE_WATER:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_FLAME:
entry->m_ppRaster = &gpFlame1Raster;
break;
case PARTICLE_FIREBALL:
entry->m_ppRaster = &gpFlame5Raster;
break;
case PARTICLE_GUNFLASH:
entry->m_ppRaster = gpGunFlashRaster;
break;
case PARTICLE_GUNFLASH_NOANIM:
entry->m_ppRaster = gpGunFlashRaster;
break;
case PARTICLE_GUNSMOKE:
entry->m_ppRaster = nil;
break;
case PARTICLE_GUNSMOKE2:
entry->m_ppRaster = gpRubberRaster;
break;
case PARTICLE_CIGARETTE_SMOKE:
entry->m_ppRaster = &gpGunSmokeRaster;
break;
case PARTICLE_TEARGAS:
entry->m_ppRaster = &gpHeatHazeRaster;
break;
case PARTICLE_SMOKE:
case PARTICLE_SMOKE_SLOWMOTION:
case PARTICLE_DRY_ICE:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_GARAGEPAINT_SPRAY:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_SHARD:
entry->m_ppRaster = &gpRainDropRaster;
break;
case PARTICLE_SPLASH:
entry->m_ppRaster = gpCarSplashRaster;
break;
case PARTICLE_CARFLAME:
entry->m_ppRaster = &gpFlame1Raster;
break;
case PARTICLE_STEAM:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_STEAM2:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_STEAM_NY:
case PARTICLE_STEAM_NY_SLOWMOTION:
case PARTICLE_GROUND_STEAM:
case PARTICLE_HYDRANT_STEAM:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_ENGINE_STEAM:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_RAINDROP:
entry->m_ppRaster = &gpRainDropRaster;
break;
case PARTICLE_RAINDROP_SMALL:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
case PARTICLE_RAIN_SPLASH:
case PARTICLE_RAIN_SPLASH_BIGGROW:
entry->m_ppRaster = gpRainSplashRaster;
break;
case PARTICLE_RAIN_SPLASHUP:
entry->m_ppRaster = gpRainSplashupRaster;
break;
case PARTICLE_WATERSPRAY:
entry->m_ppRaster = gpWatersprayRaster;
break;
case PARTICLE_RAINDROP_2D:
entry->m_ppRaster = &gpRainDropRaster;
break;
case PARTICLE_EXPLOSION_MEDIUM:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
case PARTICLE_EXPLOSION_LARGE:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
case PARTICLE_EXPLOSION_MFAST:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
case PARTICLE_EXPLOSION_LFAST:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
case PARTICLE_CAR_SPLASH:
entry->m_ppRaster = gpCarSplashRaster;
break;
case PARTICLE_BOAT_SPLASH:
entry->m_ppRaster = &gpBoatWakeRaster;
break;
case PARTICLE_BOAT_THRUSTJET:
entry->m_ppRaster = gpRubberRaster;
break;
case PARTICLE_WATER_HYDRANT:
entry->m_ppRaster = gpCarSplashRaster;
break;
case PARTICLE_WATER_CANNON:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_EXTINGUISH_STEAM:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_PED_SPLASH:
entry->m_ppRaster = gpCarSplashRaster;
break;
case PARTICLE_PEDFOOT_DUST:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_CAR_DUST:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_HELI_DUST:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_HELI_ATTACK:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
case PARTICLE_ENGINE_SMOKE:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_ENGINE_SMOKE2:
case PARTICLE_ROCKET_SMOKE:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_CARFLAME_SMOKE:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_FIREBALL_SMOKE:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_PAINT_SMOKE:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_TREE_LEAVES:
entry->m_ppRaster = gpLeafRaster;
break;
case PARTICLE_CARCOLLISION_DUST:
entry->m_ppRaster = &gpCollisionSmokeRaster;
break;
case PARTICLE_CAR_DEBRIS:
case PARTICLE_BIRD_DEBRIS:
case PARTICLE_HELI_DEBRIS:
entry->m_ppRaster = gpCarDebrisRaster;
break;
case PARTICLE_EXHAUST_FUMES:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_RUBBER_SMOKE:
entry->m_ppRaster = gpRubberRaster;
break;
case PARTICLE_BURNINGRUBBER_SMOKE:
entry->m_ppRaster = &gpCollisionSmokeRaster;
break;
case PARTICLE_BULLETHIT_SMOKE:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_GUNSHELL_FIRST:
entry->m_ppRaster = &gpGunShellRaster;
break;
case PARTICLE_GUNSHELL:
entry->m_ppRaster = &gpGunShellRaster;
break;
case PARTICLE_GUNSHELL_BUMP1:
entry->m_ppRaster = &gpGunShellRaster;
break;
case PARTICLE_GUNSHELL_BUMP2:
entry->m_ppRaster = &gpGunShellRaster;
break;
case PARTICLE_TEST:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_BIRD_FRONT:
entry->m_ppRaster = gpBirdfrontRaster;
break;
case PARTICLE_SHIP_SIDE:
entry->m_ppRaster = gpBoatRaster;
break;
case PARTICLE_BEASTIE:
entry->m_ppRaster = &gpBeastieRaster;
break;
case PARTICLE_FERRY_CHIM_SMOKE:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_MULTIPLAYER_HIT:
entry->m_ppRaster = &gpMultiPlayerHitRaster;
break;
}
}
SetPixelData();
debug("CParticle ready");
}
void CParticle::SetPixelData()
{
for (int32 i = 0; i < MAX_PARTICLES; i++)
{
tParticleSystemData* entry = &mod_ParticleSystemManager.m_aParticles[i];
switch (i)
{
case PARTICLE_SPARK:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
case PARTICLE_SPARK_SMALL:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
case PARTICLE_WATER_SPARK:
entry->m_ppRaster = &gpSparkRaster;
break;
case PARTICLE_WHEEL_DIRT:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_SAND:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_WHEEL_WATER:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_BLOOD:
entry->m_ppRaster = &gpBloodRaster;
break;
case PARTICLE_BLOOD_SMALL:
entry->m_ppRaster = &gpBloodSmallRaster;
break;
case PARTICLE_BLOOD_SPURT:
entry->m_ppRaster = &gpBloodSmallRaster;
break;
case PARTICLE_DEBRIS:
entry->m_ppRaster = gpLeafRaster;
break;
case PARTICLE_DEBRIS2:
entry->m_ppRaster = &gpGungeRaster;
break;
case PARTICLE_FLYERS:
entry->m_ppRaster = &gpNewspaperRaster;
break;
case PARTICLE_WATER:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_FLAME:
entry->m_ppRaster = &gpFlame1Raster;
break;
case PARTICLE_FIREBALL:
entry->m_ppRaster = &gpFlame5Raster;
break;
case PARTICLE_GUNFLASH:
entry->m_ppRaster = gpGunFlashRaster;
break;
case PARTICLE_GUNFLASH_NOANIM:
entry->m_ppRaster = gpGunFlashRaster;
break;
case PARTICLE_GUNSMOKE:
entry->m_ppRaster = nil;
break;
case PARTICLE_GUNSMOKE2:
entry->m_ppRaster = gpRubberRaster;
break;
case PARTICLE_CIGARETTE_SMOKE:
entry->m_ppRaster = &gpGunSmokeRaster;
break;
case PARTICLE_TEARGAS:
entry->m_ppRaster = &gpHeatHazeRaster;
break;
case PARTICLE_SMOKE:
case PARTICLE_SMOKE_SLOWMOTION:
case PARTICLE_DRY_ICE:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_GARAGEPAINT_SPRAY:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_SHARD:
entry->m_ppRaster = &gpRainDropRaster;
break;
case PARTICLE_SPLASH:
entry->m_ppRaster = gpCarSplashRaster;
break;
case PARTICLE_CARFLAME:
entry->m_ppRaster = &gpFlame1Raster;
break;
case PARTICLE_STEAM:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_STEAM2:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_STEAM_NY:
case PARTICLE_STEAM_NY_SLOWMOTION:
case PARTICLE_GROUND_STEAM:
case PARTICLE_HYDRANT_STEAM:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_ENGINE_STEAM:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_RAINDROP:
entry->m_ppRaster = &gpRainDropRaster;
break;
case PARTICLE_RAINDROP_SMALL:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
case PARTICLE_RAIN_SPLASH:
case PARTICLE_RAIN_SPLASH_BIGGROW:
entry->m_ppRaster = gpRainSplashRaster;
break;
case PARTICLE_RAIN_SPLASHUP:
entry->m_ppRaster = gpRainSplashupRaster;
break;
case PARTICLE_WATERSPRAY:
entry->m_ppRaster = gpWatersprayRaster;
break;
case PARTICLE_RAINDROP_2D:
entry->m_ppRaster = &gpRainDropRaster;
break;
case PARTICLE_EXPLOSION_MEDIUM:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
case PARTICLE_EXPLOSION_LARGE:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
case PARTICLE_EXPLOSION_MFAST:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
case PARTICLE_EXPLOSION_LFAST:
entry->m_ppRaster = gpExplosionMediumRaster;
break;
case PARTICLE_CAR_SPLASH:
entry->m_ppRaster = gpCarSplashRaster;
break;
case PARTICLE_BOAT_SPLASH:
entry->m_ppRaster = &gpBoatWakeRaster;
break;
case PARTICLE_BOAT_THRUSTJET:
entry->m_ppRaster = gpRubberRaster;
break;
case PARTICLE_WATER_HYDRANT:
entry->m_ppRaster = gpCarSplashRaster;
break;
case PARTICLE_WATER_CANNON:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_EXTINGUISH_STEAM:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_PED_SPLASH:
entry->m_ppRaster = gpCarSplashRaster;
break;
case PARTICLE_PEDFOOT_DUST:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_CAR_DUST:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_HELI_DUST:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_HELI_ATTACK:
entry->m_ppRaster = &gpRainDropSmallRaster;
break;
case PARTICLE_ENGINE_SMOKE:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_ENGINE_SMOKE2:
case PARTICLE_ROCKET_SMOKE:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_CARFLAME_SMOKE:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_FIREBALL_SMOKE:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_PAINT_SMOKE:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_TREE_LEAVES:
entry->m_ppRaster = gpLeafRaster;
break;
case PARTICLE_CARCOLLISION_DUST:
entry->m_ppRaster = &gpCollisionSmokeRaster;
break;
case PARTICLE_CAR_DEBRIS:
case PARTICLE_BIRD_DEBRIS:
case PARTICLE_HELI_DEBRIS:
entry->m_ppRaster = gpCarDebrisRaster;
break;
case PARTICLE_EXHAUST_FUMES:
entry->m_ppRaster = &gpSmoke2Raster;
break;
case PARTICLE_RUBBER_SMOKE:
entry->m_ppRaster = gpRubberRaster;
break;
case PARTICLE_BURNINGRUBBER_SMOKE:
entry->m_ppRaster = &gpCollisionSmokeRaster;
break;
case PARTICLE_BULLETHIT_SMOKE:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_GUNSHELL_FIRST:
entry->m_ppRaster = &gpGunShellRaster;
break;
case PARTICLE_GUNSHELL:
entry->m_ppRaster = &gpGunShellRaster;
break;
case PARTICLE_GUNSHELL_BUMP1:
entry->m_ppRaster = &gpGunShellRaster;
break;
case PARTICLE_GUNSHELL_BUMP2:
entry->m_ppRaster = &gpGunShellRaster;
break;
case PARTICLE_TEST:
entry->m_ppRaster = &gpCloudRaster4;
break;
case PARTICLE_BIRD_FRONT:
entry->m_ppRaster = gpBirdfrontRaster;
break;
case PARTICLE_SHIP_SIDE:
entry->m_ppRaster = gpBoatRaster;
break;
case PARTICLE_BEASTIE:
entry->m_ppRaster = &gpBeastieRaster;
break;
case PARTICLE_FERRY_CHIM_SMOKE:
entry->m_ppRaster = gpSmokeRaster;
break;
case PARTICLE_MULTIPLAYER_HIT:
entry->m_ppRaster = &gpMultiPlayerHitRaster;
break;
}
}
}
void CParticle::Shutdown()
{
debug("Shutting down CParticle...");

View File

@ -91,6 +91,8 @@ public:
static void HandleShipsAtHorizonStuff();
static void HandleShootableBirdsStuff(CEntity *entity, CVector const&camPos);
static void SetPixelData();
};
extern RwRaster *gpCarSplashRaster[];

View File

@ -181,7 +181,7 @@ GenericSave(int file)
WriteDataToBufferPointer(buf, CClock::ms_nGameClockMinutes);
currPad = CPad::GetPad(0);
WriteDataToBufferPointer(buf, currPad->Mode);
WriteDataToBufferPointer(buf, CTimer::m_snTimeInMilliseconds);
//WriteDataToBufferPointer(buf, CTimer::m_snTimeInMilliseconds);
WriteDataToBufferPointer(buf, CTimer::ms_fTimeScale);
WriteDataToBufferPointer(buf, CTimer::ms_fTimeStep);
WriteDataToBufferPointer(buf, CTimer::ms_fTimeStepNonClipped);
@ -213,7 +213,7 @@ GenericSave(int file)
WriteDataToBufferPointer(buf, CTimeCycle::m_ExtraColourInter);
PopulateRadioStationPositionList();
WriteDataToBufferPointer(buf, RadioStationPosition);
assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
//assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
// Save scripts, block is nested within the same block as simple vars for some reason
presize = buf;
@ -230,26 +230,26 @@ GenericSave(int file)
// Save the rest
//WriteSaveDataBlock(CPools::SavePedPool, "PedPoolSize");
WriteSaveDataBlock(CGarages::Save, "GaragesSize");
WriteSaveDataBlock(CGameLogic::Save, "GameLogicSize");
WriteSaveDataBlock(CPools::SaveVehiclePool, "VehPoolSize");
WriteSaveDataBlock(CPools::SaveObjectPool, "ObjectPoolSize");
WriteSaveDataBlock(ThePaths.Save, "ThePathsSize");
WriteSaveDataBlock(CCranes::Save, "CranesSize");
WriteSaveDataBlock(CPickups::Save, "PickUpsSize");
WriteSaveDataBlock(gPhoneInfo.Save, "PhoneInfoSize");
WriteSaveDataBlock(CRestart::SaveAllRestartPoints, "RestartPointsBufferSize");
WriteSaveDataBlock(CRadar::SaveAllRadarBlips, "RadarBlipsBufferSize");
WriteSaveDataBlock(CTheZones::SaveAllZones, "AllZonesBufferSize");
WriteSaveDataBlock(CGangs::SaveAllGangData, "AllGangDataSize");
WriteSaveDataBlock(CTheCarGenerators::SaveAllCarGenerators, "AllCarGeneratorsSize");
WriteSaveDataBlock(CParticleObject::SaveParticle, "ParticlesSize");
WriteSaveDataBlock(cAudioScriptObject::SaveAllAudioScriptObjects, "AllAudioScriptObjectsSize");
WriteSaveDataBlock(CScriptPaths::Save, "ScriptPathsSize");
//WriteSaveDataBlock(CGameLogic::Save, "GameLogicSize");
//WriteSaveDataBlock(CPools::SaveVehiclePool, "VehPoolSize");
//WriteSaveDataBlock(CPools::SaveObjectPool, "ObjectPoolSize");
//WriteSaveDataBlock(ThePaths.Save, "ThePathsSize");
//WriteSaveDataBlock(CCranes::Save, "CranesSize");
//WriteSaveDataBlock(CPickups::Save, "PickUpsSize");
//WriteSaveDataBlock(gPhoneInfo.Save, "PhoneInfoSize");
//WriteSaveDataBlock(CRestart::SaveAllRestartPoints, "RestartPointsBufferSize");
//WriteSaveDataBlock(CRadar::SaveAllRadarBlips, "RadarBlipsBufferSize");
//WriteSaveDataBlock(CTheZones::SaveAllZones, "AllZonesBufferSize");
//WriteSaveDataBlock(CGangs::SaveAllGangData, "AllGangDataSize");
//WriteSaveDataBlock(CTheCarGenerators::SaveAllCarGenerators, "AllCarGeneratorsSize");
//WriteSaveDataBlock(CParticleObject::SaveParticle, "ParticlesSize");
//WriteSaveDataBlock(cAudioScriptObject::SaveAllAudioScriptObjects, "AllAudioScriptObjectsSize");
//WriteSaveDataBlock(CScriptPaths::Save, "ScriptPathsSize");
WriteSaveDataBlock(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo, "PlayerInfoSize");
WriteSaveDataBlock(CStats::SaveStats, "StatsSize");
WriteSaveDataBlock(CSetPieces::Save, "SetPiecesSize");
WriteSaveDataBlock(CStreaming::MemoryCardSave, "StreamingSize");
WriteSaveDataBlock(CPedType::Save, "PedTypeSize");
//WriteSaveDataBlock(CSetPieces::Save, "SetPiecesSize");
//WriteSaveDataBlock(CStreaming::MemoryCardSave, "StreamingSize");
//WriteSaveDataBlock(CPedType::Save, "PedTypeSize");
// sure just write garbage data repeatedly ...
#ifndef THIS_IS_STUPID
@ -318,7 +318,7 @@ GenericLoad()
ReadDataFromBufferPointer(buf, CClock::ms_nGameClockMinutes);
currPad = CPad::GetPad(0);
ReadDataFromBufferPointer(buf, currPad->Mode);
ReadDataFromBufferPointer(buf, CTimer::m_snTimeInMilliseconds);
//ReadDataFromBufferPointer(buf, CTimer::m_snTimeInMilliseconds);
ReadDataFromBufferPointer(buf, CTimer::ms_fTimeScale);
ReadDataFromBufferPointer(buf, CTimer::ms_fTimeStep);
ReadDataFromBufferPointer(buf, CTimer::ms_fTimeStepNonClipped);
@ -359,7 +359,7 @@ GenericLoad()
ReadDataFromBufferPointer(buf, CTimeCycle::m_bExtraColourOn);
ReadDataFromBufferPointer(buf, CTimeCycle::m_ExtraColourInter);
ReadDataFromBufferPointer(buf, RadioStationPosition);
assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
//assert(buf - work_buff == SIZE_OF_SIMPLEVARS);
#ifdef MISSION_REPLAY
WaitForSave = 0;
if (FrontEndMenuManager.m_nCurrSaveSlot == PAUSE_SAVE_SLOT && qs == 3)
@ -372,50 +372,50 @@ GenericLoad()
//ReadDataFromBlock("Loading PedPool \n", CPools::LoadPedPool);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Garages \n", CGarages::Load);
LoadSaveDataBlock();
ReadDataFromBlock("Loading GameLogic \n", CGameLogic::Load);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Vehicles \n", CPools::LoadVehiclePool);
LoadSaveDataBlock();
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading GameLogic \n", CGameLogic::Load);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Vehicles \n", CPools::LoadVehiclePool);
//LoadSaveDataBlock();
CProjectileInfo::RemoveAllProjectiles();
CObject::DeleteAllTempObjects();
ReadDataFromBlock("Loading Objects \n", CPools::LoadObjectPool);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Paths \n", ThePaths.Load);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Cranes \n", CCranes::Load);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Pickups \n", CPickups::Load);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Phoneinfo \n", gPhoneInfo.Load);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Restart \n", CRestart::LoadAllRestartPoints);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Radar Blips \n", CRadar::LoadAllRadarBlips);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Zones \n", CTheZones::LoadAllZones);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Gang Data \n", CGangs::LoadAllGangData);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Car Generators \n", CTheCarGenerators::LoadAllCarGenerators);
CParticle::ReloadConfig();
LoadSaveDataBlock();
ReadDataFromBlock("Loading Particles \n", CParticleObject::LoadParticle);
LoadSaveDataBlock();
ReadDataFromBlock("Loading AudioScript Objects \n", cAudioScriptObject::LoadAllAudioScriptObjects);
LoadSaveDataBlock();
ReadDataFromBlock("Loading ScriptPaths \n", CScriptPaths::Load);
//ReadDataFromBlock("Loading Objects \n", CPools::LoadObjectPool);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Paths \n", ThePaths.Load);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Cranes \n", CCranes::Load);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Pickups \n", CPickups::Load);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Phoneinfo \n", gPhoneInfo.Load);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Restart \n", CRestart::LoadAllRestartPoints);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Radar Blips \n", CRadar::LoadAllRadarBlips);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Zones \n", CTheZones::LoadAllZones);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Gang Data \n", CGangs::LoadAllGangData);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Car Generators \n", CTheCarGenerators::LoadAllCarGenerators);
//CParticle::ReloadConfig();
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Particles \n", CParticleObject::LoadParticle);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading AudioScript Objects \n", cAudioScriptObject::LoadAllAudioScriptObjects);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading ScriptPaths \n", CScriptPaths::Load);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Player Info \n", CWorld::Players[CWorld::PlayerInFocus].LoadPlayerInfo);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Stats \n", CStats::LoadStats);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Set Pieces \n", CSetPieces::Load);
LoadSaveDataBlock();
ReadDataFromBlock("Loading Streaming Stuff \n", CStreaming::MemoryCardLoad);
LoadSaveDataBlock();
ReadDataFromBlock("Loading PedType Stuff \n", CPedType::Load);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Set Pieces \n", CSetPieces::Load);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading Streaming Stuff \n", CStreaming::MemoryCardLoad);
//LoadSaveDataBlock();
//ReadDataFromBlock("Loading PedType Stuff \n", CPedType::Load);
CStreaming::ReInit();
DMAudio.SetMusicMasterVolume(FrontEndMenuManager.m_PrefsMusicVolume);
DMAudio.SetEffectsMasterVolume(FrontEndMenuManager.m_PrefsSfxVolume);
if (!CloseFile(file)) {
@ -423,7 +423,7 @@ GenericLoad()
return false;
}
DoGameSpecificStuffAfterSucessLoad();
//DoGameSpecificStuffAfterSucessLoad();
debug("Game successfully loaded \n");
return true;
}

View File

@ -2558,7 +2558,7 @@ WinMain(HINSTANCE instance,
CGame::InitialiseWhenRestarting();
DMAudio.ChangeMusicMode(MUSICMODE_GAME);
LoadSplash(GetLevelSplashScreen(CGame::currLevel));
FrontEndMenuManager.m_bWantToLoad = false;
//FrontEndMenuManager.m_bWantToLoad = false;
}
else
{