mirror of
https://gitlab.com/GaryOderNichts/re3-wiiu.git
synced 2024-12-25 17:21:49 +01:00
finished save/load
This commit is contained in:
parent
cae3990eac
commit
720abca826
@ -345,8 +345,9 @@ INITSAVEBUF
|
|||||||
++nObjects;
|
++nObjects;
|
||||||
}
|
}
|
||||||
*size = nObjects * (sizeof(int16) + sizeof(int) + sizeof(CCompressedMatrix) +
|
*size = nObjects * (sizeof(int16) + sizeof(int) + sizeof(CCompressedMatrix) +
|
||||||
sizeof(float) + sizeof(CCompressedMatrix) + sizeof(int8) + 7 * sizeof(bool) + sizeof(float) +
|
sizeof(float) + sizeof(CCompressedMatrix) + sizeof(int8) + 7 * sizeof(bool) + sizeof(int16) +
|
||||||
sizeof(int8) + sizeof(int8) + sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
|
+ sizeof(int8) * 2 + sizeof(float) + sizeof(int8) + sizeof(int8) +
|
||||||
|
sizeof(uint32) + 2 * sizeof(uint32)) + sizeof(int);
|
||||||
CopyToBuf(buf, nObjects);
|
CopyToBuf(buf, nObjects);
|
||||||
for (int i = 0; i < nPoolSize; i++) {
|
for (int i = 0; i < nPoolSize; i++) {
|
||||||
CObject* pObject = GetObjectPool()->GetSlot(i);
|
CObject* pObject = GetObjectPool()->GetSlot(i);
|
||||||
@ -370,7 +371,6 @@ INITSAVEBUF
|
|||||||
tmp.CompressFromFullMatrix(pObject->m_objectMatrix);
|
tmp.CompressFromFullMatrix(pObject->m_objectMatrix);
|
||||||
CopyToBuf(buf, tmp);
|
CopyToBuf(buf, tmp);
|
||||||
CopyToBuf(buf, pObject->ObjectCreatedBy);
|
CopyToBuf(buf, pObject->ObjectCreatedBy);
|
||||||
SkipSaveBuf(buf, 1);
|
|
||||||
CopyToBuf(buf, bIsPickup);
|
CopyToBuf(buf, bIsPickup);
|
||||||
CopyToBuf(buf, bPickupObjWithMessage);
|
CopyToBuf(buf, bPickupObjWithMessage);
|
||||||
CopyToBuf(buf, bOutOfStock);
|
CopyToBuf(buf, bOutOfStock);
|
||||||
@ -380,6 +380,7 @@ INITSAVEBUF
|
|||||||
CopyToBuf(buf, bUseVehicleColours);
|
CopyToBuf(buf, bUseVehicleColours);
|
||||||
CopyToBuf(buf, pObject->m_unk);
|
CopyToBuf(buf, pObject->m_unk);
|
||||||
CopyToBuf(buf, pObject->m_nBonusValue);
|
CopyToBuf(buf, pObject->m_nBonusValue);
|
||||||
|
SkipSaveBuf(buf, 1);
|
||||||
CopyToBuf(buf, pObject->m_fCollisionDamageMultiplier);
|
CopyToBuf(buf, pObject->m_fCollisionDamageMultiplier);
|
||||||
CopyToBuf(buf, pObject->m_nCollisionDamageEffect);
|
CopyToBuf(buf, pObject->m_nCollisionDamageEffect);
|
||||||
CopyToBuf(buf, pObject->m_nSpecialCollisionResponseCases);
|
CopyToBuf(buf, pObject->m_nSpecialCollisionResponseCases);
|
||||||
|
@ -924,6 +924,7 @@ INITSAVEBUF
|
|||||||
|
|
||||||
for (int i = 0; i < NUMRADARBLIPS; i++) {
|
for (int i = 0; i < NUMRADARBLIPS; i++) {
|
||||||
ms_RadarTrace[i].m_nColor = ReadSaveBuf<uint32>(buf);
|
ms_RadarTrace[i].m_nColor = ReadSaveBuf<uint32>(buf);
|
||||||
|
ms_RadarTrace[i].m_Radius = ReadSaveBuf<float>(buf);
|
||||||
ms_RadarTrace[i].m_eBlipType = ReadSaveBuf<uint32>(buf);
|
ms_RadarTrace[i].m_eBlipType = ReadSaveBuf<uint32>(buf);
|
||||||
ms_RadarTrace[i].m_nEntityHandle = ReadSaveBuf<int32>(buf);
|
ms_RadarTrace[i].m_nEntityHandle = ReadSaveBuf<int32>(buf);
|
||||||
ms_RadarTrace[i].m_vec2DPos.x = ReadSaveBuf<float>(buf); // CVector2D
|
ms_RadarTrace[i].m_vec2DPos.x = ReadSaveBuf<float>(buf); // CVector2D
|
||||||
@ -934,7 +935,6 @@ INITSAVEBUF
|
|||||||
ms_RadarTrace[i].m_bInUse = ReadSaveBuf<bool>(buf);
|
ms_RadarTrace[i].m_bInUse = ReadSaveBuf<bool>(buf);
|
||||||
ms_RadarTrace[i].m_bShortRange = ReadSaveBuf<bool>(buf);
|
ms_RadarTrace[i].m_bShortRange = ReadSaveBuf<bool>(buf);
|
||||||
ms_RadarTrace[i].m_unused = ReadSaveBuf<bool>(buf);
|
ms_RadarTrace[i].m_unused = ReadSaveBuf<bool>(buf);
|
||||||
ms_RadarTrace[i].m_Radius = ReadSaveBuf<float>(buf);
|
|
||||||
ms_RadarTrace[i].m_wScale = ReadSaveBuf<int16>(buf);
|
ms_RadarTrace[i].m_wScale = ReadSaveBuf<int16>(buf);
|
||||||
ms_RadarTrace[i].m_eBlipDisplay = ReadSaveBuf<uint16>(buf);
|
ms_RadarTrace[i].m_eBlipDisplay = ReadSaveBuf<uint16>(buf);
|
||||||
ms_RadarTrace[i].m_eRadarSprite = ReadSaveBuf<uint16>(buf);
|
ms_RadarTrace[i].m_eRadarSprite = ReadSaveBuf<uint16>(buf);
|
||||||
@ -961,6 +961,7 @@ INITSAVEBUF
|
|||||||
sRadarTraceSave *saveStruct = (sRadarTraceSave*) buf;
|
sRadarTraceSave *saveStruct = (sRadarTraceSave*) buf;
|
||||||
|
|
||||||
saveStruct->m_nColor = ms_RadarTrace[i].m_nColor;
|
saveStruct->m_nColor = ms_RadarTrace[i].m_nColor;
|
||||||
|
saveStruct->m_Radius = ms_RadarTrace[i].m_Radius;
|
||||||
saveStruct->m_eBlipType = ms_RadarTrace[i].m_eBlipType;
|
saveStruct->m_eBlipType = ms_RadarTrace[i].m_eBlipType;
|
||||||
saveStruct->m_nEntityHandle = ms_RadarTrace[i].m_nEntityHandle;
|
saveStruct->m_nEntityHandle = ms_RadarTrace[i].m_nEntityHandle;
|
||||||
saveStruct->m_vec2DPos = ms_RadarTrace[i].m_vec2DPos;
|
saveStruct->m_vec2DPos = ms_RadarTrace[i].m_vec2DPos;
|
||||||
@ -970,7 +971,6 @@ INITSAVEBUF
|
|||||||
saveStruct->m_bInUse = ms_RadarTrace[i].m_bInUse;
|
saveStruct->m_bInUse = ms_RadarTrace[i].m_bInUse;
|
||||||
saveStruct->m_bShortRange = ms_RadarTrace[i].m_bShortRange;
|
saveStruct->m_bShortRange = ms_RadarTrace[i].m_bShortRange;
|
||||||
saveStruct->m_unused = ms_RadarTrace[i].m_unused;
|
saveStruct->m_unused = ms_RadarTrace[i].m_unused;
|
||||||
saveStruct->m_Radius = ms_RadarTrace[i].m_Radius;
|
|
||||||
saveStruct->m_wScale = ms_RadarTrace[i].m_wScale;
|
saveStruct->m_wScale = ms_RadarTrace[i].m_wScale;
|
||||||
saveStruct->m_eBlipDisplay = ms_RadarTrace[i].m_eBlipDisplay;
|
saveStruct->m_eBlipDisplay = ms_RadarTrace[i].m_eBlipDisplay;
|
||||||
saveStruct->m_eRadarSprite = ms_RadarTrace[i].m_eRadarSprite;
|
saveStruct->m_eRadarSprite = ms_RadarTrace[i].m_eRadarSprite;
|
||||||
|
@ -137,6 +137,7 @@ struct sRadarTrace
|
|||||||
struct sRadarTraceSave
|
struct sRadarTraceSave
|
||||||
{
|
{
|
||||||
uint32 m_nColor;
|
uint32 m_nColor;
|
||||||
|
float m_Radius;
|
||||||
uint32 m_eBlipType; // eBlipType
|
uint32 m_eBlipType; // eBlipType
|
||||||
int32 m_nEntityHandle;
|
int32 m_nEntityHandle;
|
||||||
CVector2D m_vec2DPos;
|
CVector2D m_vec2DPos;
|
||||||
@ -146,7 +147,6 @@ struct sRadarTraceSave
|
|||||||
bool m_bInUse;
|
bool m_bInUse;
|
||||||
bool m_bShortRange;
|
bool m_bShortRange;
|
||||||
bool m_unused;
|
bool m_unused;
|
||||||
float m_Radius;
|
|
||||||
int16 m_wScale;
|
int16 m_wScale;
|
||||||
uint16 m_eBlipDisplay; // eBlipDisplay
|
uint16 m_eBlipDisplay; // eBlipDisplay
|
||||||
uint16 m_eRadarSprite; // eRadarSprite
|
uint16 m_eRadarSprite; // eRadarSprite
|
||||||
|
@ -1935,7 +1935,7 @@ CPlayerPed::Save(uint8*& buf)
|
|||||||
CopyToBuf(buf, m_nTargettableObjects[1]);
|
CopyToBuf(buf, m_nTargettableObjects[1]);
|
||||||
CopyToBuf(buf, m_nTargettableObjects[2]);
|
CopyToBuf(buf, m_nTargettableObjects[2]);
|
||||||
CopyToBuf(buf, m_nTargettableObjects[3]);
|
CopyToBuf(buf, m_nTargettableObjects[3]);
|
||||||
SkipSaveBuf(buf, 116);
|
SkipSaveBuf(buf, 164);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -583,7 +583,7 @@ void CHud::Draw()
|
|||||||
|
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f), SCREEN_SCALE_Y(65.0f), sPrint);
|
||||||
|
|
||||||
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 1) {
|
if (!CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss || CTimer::GetTimeInMilliseconds() > CWorld::Players[CWorld::PlayerInFocus].m_nTimeLastArmourLoss + 2000 || CTimer::GetFrameCounter() & 4) {
|
||||||
// CFont::SetColor(ARMOUR_COLOR);
|
// CFont::SetColor(ARMOUR_COLOR);
|
||||||
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f + 52.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
|
CFont::PrintString(SCREEN_SCALE_FROM_RIGHT(182.0f + 52.0f), SCREEN_SCALE_Y(65.0f), sPrintIcon);
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,9 @@
|
|||||||
#include "Timecycle.h"
|
#include "Timecycle.h"
|
||||||
#include "Fluff.h"
|
#include "Fluff.h"
|
||||||
|
|
||||||
#define BLOCK_COUNT 20
|
// --MIAMI: file done
|
||||||
|
|
||||||
|
#define BLOCK_COUNT 22
|
||||||
#define SIZE_OF_SIMPLEVARS 0xE4
|
#define SIZE_OF_SIMPLEVARS 0xE4
|
||||||
|
|
||||||
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
|
const uint32 SIZE_OF_ONE_GAME_IN_BYTES = 201729;
|
||||||
@ -60,7 +62,6 @@ int CheckSum;
|
|||||||
eLevelName m_LevelToLoad;
|
eLevelName m_LevelToLoad;
|
||||||
char SaveFileNameJustSaved[260];
|
char SaveFileNameJustSaved[260];
|
||||||
int Slots[SLOT_COUNT];
|
int Slots[SLOT_COUNT];
|
||||||
CDate CompileDateAndTime;
|
|
||||||
|
|
||||||
bool b_FoundRecentSavedGameWantToLoad;
|
bool b_FoundRecentSavedGameWantToLoad;
|
||||||
bool JustLoadedDontFadeInYet;
|
bool JustLoadedDontFadeInYet;
|
||||||
@ -112,13 +113,14 @@ do {\
|
|||||||
buf += size;\
|
buf += size;\
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define WriteSaveDataBlock(save_func)\
|
#define WriteSaveDataBlock(save_func, msg)\
|
||||||
do {\
|
do {\
|
||||||
size = 0;\
|
size = 0;\
|
||||||
buf = work_buff;\
|
buf = work_buff;\
|
||||||
reserved = 0;\
|
reserved = 0;\
|
||||||
MakeSpaceForSizeInBufferPointer(presize, buf, postsize);\
|
MakeSpaceForSizeInBufferPointer(presize, buf, postsize);\
|
||||||
save_func(buf, &size);\
|
save_func(buf, &size);\
|
||||||
|
debug(msg"== %i \n", size);\
|
||||||
CopySizeAndPreparePointer(presize, buf, postsize, reserved, size);\
|
CopySizeAndPreparePointer(presize, buf, postsize, reserved, size);\
|
||||||
if (!PcSaveHelper.PcClassSaveRoutine(file, work_buff, buf - work_buff))\
|
if (!PcSaveHelper.PcClassSaveRoutine(file, work_buff, buf - work_buff))\
|
||||||
return false;\
|
return false;\
|
||||||
@ -145,9 +147,10 @@ GenericSave(int file)
|
|||||||
reserved = 0;
|
reserved = 0;
|
||||||
|
|
||||||
// Save simple vars
|
// Save simple vars
|
||||||
lastMissionPassed = TheText.Get(CStats::LastMissionPassedName);
|
lastMissionPassed = TheText.Get(CStats::LastMissionPassedName[0] ? CStats::LastMissionPassedName : "ITBEG");
|
||||||
if (lastMissionPassed[0] != '\0') {
|
if (lastMissionPassed[0] != '\0') {
|
||||||
AsciiToUnicode("...'", suffix);
|
AsciiToUnicode("...'", suffix);
|
||||||
|
suffix[3] = L'\0';
|
||||||
#ifdef FIX_BUGS
|
#ifdef FIX_BUGS
|
||||||
// fix buffer overflow
|
// fix buffer overflow
|
||||||
int len = UnicodeStrlen(lastMissionPassed);
|
int len = UnicodeStrlen(lastMissionPassed);
|
||||||
@ -221,6 +224,7 @@ GenericSave(int file)
|
|||||||
buf += 4;
|
buf += 4;
|
||||||
postsize = buf;
|
postsize = buf;
|
||||||
CTheScripts::SaveAllScripts(buf, &size);
|
CTheScripts::SaveAllScripts(buf, &size);
|
||||||
|
debug("ScriptSize== %i \n", size);
|
||||||
CopySizeAndPreparePointer(presize, buf, postsize, reserved, size);
|
CopySizeAndPreparePointer(presize, buf, postsize, reserved, size);
|
||||||
if (!PcSaveHelper.PcClassSaveRoutine(file, work_buff, buf - work_buff))
|
if (!PcSaveHelper.PcClassSaveRoutine(file, work_buff, buf - work_buff))
|
||||||
return false;
|
return false;
|
||||||
@ -228,28 +232,28 @@ GenericSave(int file)
|
|||||||
totalSize = buf - work_buff;
|
totalSize = buf - work_buff;
|
||||||
|
|
||||||
// Save the rest
|
// Save the rest
|
||||||
WriteSaveDataBlock(CPools::SavePedPool);
|
WriteSaveDataBlock(CPools::SavePedPool, "PedPoolSize");
|
||||||
WriteSaveDataBlock(CGarages::Save);
|
WriteSaveDataBlock(CGarages::Save, "GaragesSize");
|
||||||
WriteSaveDataBlock(CGameLogic::Save);
|
WriteSaveDataBlock(CGameLogic::Save, "GameLogicSize");
|
||||||
WriteSaveDataBlock(CPools::SaveVehiclePool);
|
WriteSaveDataBlock(CPools::SaveVehiclePool, "VehPoolSize");
|
||||||
WriteSaveDataBlock(CPools::SaveObjectPool);
|
WriteSaveDataBlock(CPools::SaveObjectPool, "ObjectPoolSize");
|
||||||
WriteSaveDataBlock(ThePaths.Save);
|
WriteSaveDataBlock(ThePaths.Save, "ThePathsSize");
|
||||||
WriteSaveDataBlock(CCranes::Save);
|
WriteSaveDataBlock(CCranes::Save, "CranesSize");
|
||||||
WriteSaveDataBlock(CPickups::Save);
|
WriteSaveDataBlock(CPickups::Save, "PickUpsSize");
|
||||||
WriteSaveDataBlock(gPhoneInfo.Save);
|
WriteSaveDataBlock(gPhoneInfo.Save, "PhoneInfoSize");
|
||||||
WriteSaveDataBlock(CRestart::SaveAllRestartPoints);
|
WriteSaveDataBlock(CRestart::SaveAllRestartPoints, "RestartPointsBufferSize");
|
||||||
WriteSaveDataBlock(CRadar::SaveAllRadarBlips);
|
WriteSaveDataBlock(CRadar::SaveAllRadarBlips, "RadarBlipsBufferSize");
|
||||||
WriteSaveDataBlock(CTheZones::SaveAllZones);
|
WriteSaveDataBlock(CTheZones::SaveAllZones, "AllZonesBufferSize");
|
||||||
WriteSaveDataBlock(CGangs::SaveAllGangData);
|
WriteSaveDataBlock(CGangs::SaveAllGangData, "AllGangDataSize");
|
||||||
WriteSaveDataBlock(CTheCarGenerators::SaveAllCarGenerators);
|
WriteSaveDataBlock(CTheCarGenerators::SaveAllCarGenerators, "AllCarGeneratorsSize");
|
||||||
WriteSaveDataBlock(CParticleObject::SaveParticle);
|
WriteSaveDataBlock(CParticleObject::SaveParticle, "ParticlesSize");
|
||||||
WriteSaveDataBlock(cAudioScriptObject::SaveAllAudioScriptObjects);
|
WriteSaveDataBlock(cAudioScriptObject::SaveAllAudioScriptObjects, "AllAudioScriptObjectsSize");
|
||||||
WriteSaveDataBlock(CScriptPaths::Save);
|
WriteSaveDataBlock(CScriptPaths::Save, "ScriptPathsSize");
|
||||||
WriteSaveDataBlock(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo);
|
WriteSaveDataBlock(CWorld::Players[CWorld::PlayerInFocus].SavePlayerInfo, "PlayerInfoSize");
|
||||||
WriteSaveDataBlock(CStats::SaveStats);
|
WriteSaveDataBlock(CStats::SaveStats, "StatsSize");
|
||||||
WriteSaveDataBlock(CSetPieces::Save);
|
WriteSaveDataBlock(CSetPieces::Save, "SetPiecesSize");
|
||||||
WriteSaveDataBlock(CStreaming::MemoryCardSave);
|
WriteSaveDataBlock(CStreaming::MemoryCardSave, "StreamingSize");
|
||||||
WriteSaveDataBlock(CPedType::Save);
|
WriteSaveDataBlock(CPedType::Save, "PedTypeSize");
|
||||||
|
|
||||||
// Write padding
|
// Write padding
|
||||||
for (int i = 0; i < 4; i++) {
|
for (int i = 0; i < 4; i++) {
|
||||||
@ -458,8 +462,13 @@ CloseFile(int32 file)
|
|||||||
void
|
void
|
||||||
DoGameSpecificStuffAfterSucessLoad()
|
DoGameSpecificStuffAfterSucessLoad()
|
||||||
{
|
{
|
||||||
|
CCollision::SortOutCollisionAfterLoad();
|
||||||
|
CStreaming::LoadSceneCollision(TheCamera.GetPosition());
|
||||||
|
CStreaming::LoadScene(TheCamera.GetPosition());
|
||||||
|
CGame::TidyUpMemory(true, false);
|
||||||
StillToFadeOut = true;
|
StillToFadeOut = true;
|
||||||
JustLoadedDontFadeInYet = true;
|
JustLoadedDontFadeInYet = true;
|
||||||
|
TheCamera.Fade(0.0f, 0);
|
||||||
CTheScripts::Process();
|
CTheScripts::Process();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@ bool CheckDataNotCorrupt(int32 slot, char *name);
|
|||||||
bool RestoreForStartLoad();
|
bool RestoreForStartLoad();
|
||||||
int align4bytes(int32 size);
|
int align4bytes(int32 size);
|
||||||
|
|
||||||
extern class CDate CompileDateAndTime;
|
|
||||||
|
|
||||||
extern char DefaultPCSaveFileName[260];
|
extern char DefaultPCSaveFileName[260];
|
||||||
extern char ValidSaveName[260];
|
extern char ValidSaveName[260];
|
||||||
extern char LoadFileName[256];
|
extern char LoadFileName[256];
|
||||||
|
@ -91,7 +91,7 @@ void CCarGenerator::DoInternalProcessing()
|
|||||||
pVehicle = pBoat;
|
pVehicle = pBoat;
|
||||||
if (pos.z <= -100.0f)
|
if (pos.z <= -100.0f)
|
||||||
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
pos.z = CWorld::FindGroundZForCoord(pos.x, pos.y);
|
||||||
pBoat->bExtendedRange = false;
|
pBoat->bExtendedRange = true;
|
||||||
}else{
|
}else{
|
||||||
bool groundFound;
|
bool groundFound;
|
||||||
pos = m_vecPos;
|
pos = m_vecPos;
|
||||||
|
Loading…
Reference in New Issue
Block a user