mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-24 17:04:17 +00:00
Move Read/Write functions to LegoStorage base class, match Act1State::Serialize (#1335)
* Move Read/Write function to LegoStorage base class * Proper const use for vector / BETA match * Match `Act1State::Serialize`
This commit is contained in:
committed by
GitHub
parent
77a3dc0795
commit
70b0f76fa1
@@ -109,7 +109,7 @@ MxResult Act3Ammo::Create(Act3* p_world, MxU32 p_isPizza, MxS32 p_index)
|
||||
|
||||
// FUNCTION: LEGO1 0x10053b40
|
||||
// FUNCTION: BETA10 0x1001db2a
|
||||
MxResult Act3Ammo::FUN_10053b40(Vector3& p_srcLoc, Vector3& p_srcDir, Vector3& p_srcUp)
|
||||
MxResult Act3Ammo::FUN_10053b40(const Vector3& p_srcLoc, const Vector3& p_srcDir, const Vector3& p_srcUp)
|
||||
{
|
||||
assert(p_srcDir[1] != 0);
|
||||
|
||||
|
||||
@@ -647,33 +647,33 @@ AmbulanceMissionState::AmbulanceMissionState()
|
||||
|
||||
// FUNCTION: LEGO1 0x10037440
|
||||
// FUNCTION: BETA10 0x10024480
|
||||
MxResult AmbulanceMissionState::Serialize(LegoFile* p_file)
|
||||
MxResult AmbulanceMissionState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
p_file->Read(m_peScore);
|
||||
p_file->Read(m_maScore);
|
||||
p_file->Read(m_paScore);
|
||||
p_file->Read(m_niScore);
|
||||
p_file->Read(m_laScore);
|
||||
p_file->Read(m_peHighScore);
|
||||
p_file->Read(m_maHighScore);
|
||||
p_file->Read(m_paHighScore);
|
||||
p_file->Read(m_niHighScore);
|
||||
p_file->Read(m_laHighScore);
|
||||
if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadS16(m_peScore);
|
||||
p_storage->ReadS16(m_maScore);
|
||||
p_storage->ReadS16(m_paScore);
|
||||
p_storage->ReadS16(m_niScore);
|
||||
p_storage->ReadS16(m_laScore);
|
||||
p_storage->ReadS16(m_peHighScore);
|
||||
p_storage->ReadS16(m_maHighScore);
|
||||
p_storage->ReadS16(m_paHighScore);
|
||||
p_storage->ReadS16(m_niHighScore);
|
||||
p_storage->ReadS16(m_laHighScore);
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
p_file->Write(m_peScore);
|
||||
p_file->Write(m_maScore);
|
||||
p_file->Write(m_paScore);
|
||||
p_file->Write(m_niScore);
|
||||
p_file->Write(m_laScore);
|
||||
p_file->Write(m_peHighScore);
|
||||
p_file->Write(m_maHighScore);
|
||||
p_file->Write(m_paHighScore);
|
||||
p_file->Write(m_niHighScore);
|
||||
p_file->Write(m_laHighScore);
|
||||
else if (p_storage->IsWriteMode()) {
|
||||
p_storage->WriteS16(m_peScore);
|
||||
p_storage->WriteS16(m_maScore);
|
||||
p_storage->WriteS16(m_paScore);
|
||||
p_storage->WriteS16(m_niScore);
|
||||
p_storage->WriteS16(m_laScore);
|
||||
p_storage->WriteS16(m_peHighScore);
|
||||
p_storage->WriteS16(m_maHighScore);
|
||||
p_storage->WriteS16(m_paHighScore);
|
||||
p_storage->WriteS16(m_niHighScore);
|
||||
p_storage->WriteS16(m_laHighScore);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -606,24 +606,24 @@ PizzaMissionState::PizzaMissionState()
|
||||
|
||||
// FUNCTION: LEGO1 0x100393c0
|
||||
// FUNCTION: BETA10 0x100eebf2
|
||||
MxResult PizzaMissionState::Serialize(LegoFile* p_file)
|
||||
MxResult PizzaMissionState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
if (p_storage->IsReadMode()) {
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
p_file->Read(m_missions[i].m_unk0x06);
|
||||
p_file->Read(m_missions[i].m_unk0x14);
|
||||
p_file->Read(m_missions[i].m_score);
|
||||
p_file->Read(m_missions[i].m_hiScore);
|
||||
p_storage->ReadS16(m_missions[i].m_unk0x06);
|
||||
p_storage->ReadS16(m_missions[i].m_unk0x14);
|
||||
p_storage->ReadS16(m_missions[i].m_score);
|
||||
p_storage->ReadS16(m_missions[i].m_hiScore);
|
||||
}
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
else if (p_storage->IsWriteMode()) {
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
p_file->Write(m_missions[i].m_unk0x06);
|
||||
p_file->Write(m_missions[i].m_unk0x14);
|
||||
p_file->Write(m_missions[i].m_score);
|
||||
p_file->Write(m_missions[i].m_hiScore);
|
||||
p_storage->WriteS16(m_missions[i].m_unk0x06);
|
||||
p_storage->WriteS16(m_missions[i].m_unk0x14);
|
||||
p_storage->WriteS16(m_missions[i].m_score);
|
||||
p_storage->WriteS16(m_missions[i].m_hiScore);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,18 +118,18 @@ MxU32 PizzeriaState::NextAction()
|
||||
|
||||
// FUNCTION: LEGO1 0x10017da0
|
||||
// FUNCTION: BETA10 0x100efe33
|
||||
MxResult PizzeriaState::Serialize(LegoFile* p_file)
|
||||
MxResult PizzeriaState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
MxResult res = LegoState::Serialize(p_file);
|
||||
MxResult res = LegoState::Serialize(p_storage);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
if (p_storage->IsReadMode()) {
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
p_file->Read(m_unk0x08[i].m_nextIndex);
|
||||
p_storage->ReadS16(m_unk0x08[i].m_nextIndex);
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
p_file->Write(m_unk0x08[i].m_nextIndex);
|
||||
p_storage->WriteS16(m_unk0x08[i].m_nextIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -610,33 +610,33 @@ TowTrackMissionState::TowTrackMissionState()
|
||||
|
||||
// FUNCTION: LEGO1 0x1004dde0
|
||||
// FUNCTION: BETA10 0x100f8720
|
||||
MxResult TowTrackMissionState::Serialize(LegoFile* p_file)
|
||||
MxResult TowTrackMissionState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
p_file->Read(m_peScore);
|
||||
p_file->Read(m_maScore);
|
||||
p_file->Read(m_paScore);
|
||||
p_file->Read(m_niScore);
|
||||
p_file->Read(m_laScore);
|
||||
p_file->Read(m_peHighScore);
|
||||
p_file->Read(m_maHighScore);
|
||||
p_file->Read(m_paHighScore);
|
||||
p_file->Read(m_niHighScore);
|
||||
p_file->Read(m_laHighScore);
|
||||
if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadS16(m_peScore);
|
||||
p_storage->ReadS16(m_maScore);
|
||||
p_storage->ReadS16(m_paScore);
|
||||
p_storage->ReadS16(m_niScore);
|
||||
p_storage->ReadS16(m_laScore);
|
||||
p_storage->ReadS16(m_peHighScore);
|
||||
p_storage->ReadS16(m_maHighScore);
|
||||
p_storage->ReadS16(m_paHighScore);
|
||||
p_storage->ReadS16(m_niHighScore);
|
||||
p_storage->ReadS16(m_laHighScore);
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
p_file->Write(m_peScore);
|
||||
p_file->Write(m_maScore);
|
||||
p_file->Write(m_paScore);
|
||||
p_file->Write(m_niScore);
|
||||
p_file->Write(m_laScore);
|
||||
p_file->Write(m_peHighScore);
|
||||
p_file->Write(m_maHighScore);
|
||||
p_file->Write(m_paHighScore);
|
||||
p_file->Write(m_niHighScore);
|
||||
p_file->Write(m_laHighScore);
|
||||
else if (p_storage->IsWriteMode()) {
|
||||
p_storage->WriteS16(m_peScore);
|
||||
p_storage->WriteS16(m_maScore);
|
||||
p_storage->WriteS16(m_paScore);
|
||||
p_storage->WriteS16(m_niScore);
|
||||
p_storage->WriteS16(m_laScore);
|
||||
p_storage->WriteS16(m_peHighScore);
|
||||
p_storage->WriteS16(m_maHighScore);
|
||||
p_storage->WriteS16(m_paHighScore);
|
||||
p_storage->WriteS16(m_niHighScore);
|
||||
p_storage->WriteS16(m_laHighScore);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -1705,24 +1705,24 @@ LegoVehicleBuildState::LegoVehicleBuildState(const char* p_classType)
|
||||
|
||||
// FUNCTION: LEGO1 0x10026120
|
||||
// FUNCTION: BETA10 0x1006eef0
|
||||
MxResult LegoVehicleBuildState::Serialize(LegoFile* p_file)
|
||||
MxResult LegoVehicleBuildState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
p_file->Read(m_unk0x4c);
|
||||
p_file->Read(m_unk0x4d);
|
||||
p_file->Read(m_unk0x4e);
|
||||
if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadU8(m_unk0x4c);
|
||||
p_storage->ReadU8(m_unk0x4d);
|
||||
p_storage->ReadU8(m_unk0x4e);
|
||||
#ifndef BETA10
|
||||
p_file->Read(m_placedPartCount);
|
||||
p_storage->ReadU8(m_placedPartCount);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
p_file->Write(m_unk0x4c);
|
||||
p_file->Write(m_unk0x4d);
|
||||
p_file->Write(m_unk0x4e);
|
||||
p_storage->WriteU8(m_unk0x4c);
|
||||
p_storage->WriteU8(m_unk0x4d);
|
||||
p_storage->WriteU8(m_unk0x4e);
|
||||
#ifndef BETA10
|
||||
p_file->Write(m_placedPartCount);
|
||||
p_storage->WriteU8(m_placedPartCount);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -260,9 +260,9 @@ void LegoCarBuildAnimPresenter::StreamingTickle()
|
||||
|
||||
Mx3DPointFloat dirVec;
|
||||
|
||||
Vector3 cameraPosition(camera->GetWorldPosition());
|
||||
Vector3 upVec(camera->GetWorldUp());
|
||||
Vector3 targetPosition(targetROI->GetWorldPosition());
|
||||
const Vector3 cameraPosition(camera->GetWorldPosition());
|
||||
const Vector3 upVec(camera->GetWorldUp());
|
||||
const Vector3 targetPosition(targetROI->GetWorldPosition());
|
||||
|
||||
MxMatrix localTransform;
|
||||
|
||||
|
||||
@@ -621,7 +621,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
|
||||
DeleteAnimations();
|
||||
|
||||
LegoFile file;
|
||||
LegoFile storage;
|
||||
|
||||
if (p_worldId == LegoOmni::e_undefined) {
|
||||
result = SUCCESS;
|
||||
@@ -653,12 +653,12 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
}
|
||||
}
|
||||
|
||||
if (file.Open(path, LegoFile::c_read) == FAILURE) {
|
||||
if (storage.Open(path, LegoFile::c_read) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
MxU32 version;
|
||||
if (file.Read(&version, sizeof(version)) == FAILURE) {
|
||||
if (storage.Read(&version, sizeof(version)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -667,7 +667,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (file.Read(&m_animCount, sizeof(m_animCount)) == FAILURE) {
|
||||
if (storage.Read(&m_animCount, sizeof(m_animCount)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -675,7 +675,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
memset(m_anims, 0, m_animCount * sizeof(*m_anims));
|
||||
|
||||
for (j = 0; j < m_animCount; j++) {
|
||||
if (ReadAnimInfo(&file, &m_anims[j]) == FAILURE) {
|
||||
if (ReadAnimInfo(&storage, &m_anims[j]) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -754,49 +754,49 @@ MxBool LegoAnimationManager::FindVehicle(const char* p_name, MxU32& p_index)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10060180
|
||||
MxResult LegoAnimationManager::ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info)
|
||||
MxResult LegoAnimationManager::ReadAnimInfo(LegoStorage* p_storage, AnimInfo* p_info)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
MxU8 length;
|
||||
MxS32 i, j;
|
||||
|
||||
if (p_file->Read(&length, sizeof(length)) == FAILURE) {
|
||||
if (p_storage->Read(&length, sizeof(length)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
p_info->m_name = new char[length + 1];
|
||||
if (p_file->Read(p_info->m_name, length) == FAILURE) {
|
||||
if (p_storage->Read(p_info->m_name, length) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
p_info->m_name[length] = 0;
|
||||
if (p_file->Read(&p_info->m_objectId, sizeof(p_info->m_objectId)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_objectId, sizeof(p_info->m_objectId)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (p_file->Read(&p_info->m_location, sizeof(p_info->m_location)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_location, sizeof(p_info->m_location)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (p_file->Read(&p_info->m_unk0x0a, sizeof(p_info->m_unk0x0a)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x0a, sizeof(p_info->m_unk0x0a)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (p_file->Read(&p_info->m_unk0x0b, sizeof(p_info->m_unk0x0b)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x0b, sizeof(p_info->m_unk0x0b)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (p_file->Read(&p_info->m_unk0x0c, sizeof(p_info->m_unk0x0c)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x0c, sizeof(p_info->m_unk0x0c)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (p_file->Read(&p_info->m_unk0x0d, sizeof(p_info->m_unk0x0d)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x0d, sizeof(p_info->m_unk0x0d)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; i < (MxS32) sizeOfArray(p_info->m_unk0x10); i++) {
|
||||
if (p_file->Read(&p_info->m_unk0x10[i], sizeof(*p_info->m_unk0x10)) != SUCCESS) {
|
||||
if (p_storage->Read(&p_info->m_unk0x10[i], sizeof(*p_info->m_unk0x10)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_file->Read(&p_info->m_modelCount, sizeof(p_info->m_modelCount)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_modelCount, sizeof(p_info->m_modelCount)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -804,7 +804,7 @@ MxResult LegoAnimationManager::ReadAnimInfo(LegoFile* p_file, AnimInfo* p_info)
|
||||
memset(p_info->m_models, 0, p_info->m_modelCount * sizeof(*p_info->m_models));
|
||||
|
||||
for (j = 0; j < p_info->m_modelCount; j++) {
|
||||
if (ReadModelInfo(p_file, &p_info->m_models[j]) == FAILURE) {
|
||||
if (ReadModelInfo(p_storage, &p_info->m_models[j]) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
@@ -816,35 +816,35 @@ done:
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10060310
|
||||
MxResult LegoAnimationManager::ReadModelInfo(LegoFile* p_file, ModelInfo* p_info)
|
||||
MxResult LegoAnimationManager::ReadModelInfo(LegoStorage* p_storage, ModelInfo* p_info)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
MxU8 length;
|
||||
|
||||
if (p_file->Read(&length, 1) == FAILURE) {
|
||||
if (p_storage->Read(&length, 1) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
p_info->m_name = new char[length + 1];
|
||||
if (p_file->Read(p_info->m_name, length) == FAILURE) {
|
||||
if (p_storage->Read(p_info->m_name, length) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
p_info->m_name[length] = 0;
|
||||
if (p_file->Read(&p_info->m_unk0x04, sizeof(p_info->m_unk0x04)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x04, sizeof(p_info->m_unk0x04)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (p_file->Read(p_info->m_location, sizeof(p_info->m_location)) != SUCCESS) {
|
||||
if (p_storage->Read(p_info->m_location, sizeof(p_info->m_location)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_file->Read(p_info->m_direction, sizeof(p_info->m_direction)) != SUCCESS) {
|
||||
if (p_storage->Read(p_info->m_direction, sizeof(p_info->m_direction)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_file->Read(p_info->m_up, sizeof(p_info->m_up)) != SUCCESS) {
|
||||
if (p_storage->Read(p_info->m_up, sizeof(p_info->m_up)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_file->Read(&p_info->m_unk0x2c, sizeof(p_info->m_unk0x2c)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x2c, sizeof(p_info->m_unk0x2c)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -2935,21 +2935,21 @@ void AnimState::InitFromAnims(MxU32 p_animsLength, AnimInfo* p_anims, MxU32 p_ex
|
||||
|
||||
// FUNCTION: LEGO1 0x100652d0
|
||||
// FUNCTION: BETA10 0x10046621
|
||||
MxResult AnimState::Serialize(LegoFile* p_file)
|
||||
MxResult AnimState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
MxResult result = LegoState::Serialize(p_file);
|
||||
MxResult result = LegoState::Serialize(p_storage);
|
||||
|
||||
if (result == SUCCESS) {
|
||||
if (p_file->IsReadMode()) {
|
||||
if (p_storage->IsReadMode()) {
|
||||
MxS32 i;
|
||||
|
||||
p_file->Read(m_extraCharacterId);
|
||||
p_storage->ReadU32(m_extraCharacterId);
|
||||
|
||||
if (m_unk0x10) {
|
||||
delete[] m_unk0x10;
|
||||
}
|
||||
|
||||
p_file->Read(m_unk0x0c);
|
||||
p_storage->ReadU32(m_unk0x0c);
|
||||
|
||||
#ifndef BETA10
|
||||
if (m_unk0x0c != 0) {
|
||||
@@ -2963,11 +2963,11 @@ MxResult AnimState::Serialize(LegoFile* p_file)
|
||||
#endif
|
||||
|
||||
for (i = 0; i < m_unk0x0c; i++) {
|
||||
p_file->Read(m_unk0x10[i]);
|
||||
p_storage->ReadU16(m_unk0x10[i]);
|
||||
}
|
||||
|
||||
// Note that here we read first and then free memory in contrast to above
|
||||
p_file->Read(m_locationsFlagsLength);
|
||||
p_storage->ReadU32(m_locationsFlagsLength);
|
||||
|
||||
#ifndef BETA10
|
||||
if (m_locationsFlags) {
|
||||
@@ -2985,22 +2985,22 @@ MxResult AnimState::Serialize(LegoFile* p_file)
|
||||
#endif
|
||||
|
||||
for (i = 0; i < m_locationsFlagsLength; i++) {
|
||||
p_file->Read(m_locationsFlags[i]);
|
||||
p_storage->ReadU8(m_locationsFlags[i]);
|
||||
}
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
else if (p_storage->IsWriteMode()) {
|
||||
MxS32 i;
|
||||
|
||||
p_file->Write(m_extraCharacterId);
|
||||
p_file->Write(m_unk0x0c);
|
||||
p_storage->WriteU32(m_extraCharacterId);
|
||||
p_storage->WriteU32(m_unk0x0c);
|
||||
|
||||
for (i = 0; i < m_unk0x0c; i++) {
|
||||
p_file->Write(m_unk0x10[i]);
|
||||
p_storage->WriteU16(m_unk0x10[i]);
|
||||
}
|
||||
|
||||
p_file->Write(m_locationsFlagsLength);
|
||||
p_storage->WriteU32(m_locationsFlagsLength);
|
||||
for (i = 0; i < m_locationsFlagsLength; i++) {
|
||||
p_file->Write(m_locationsFlags[i]);
|
||||
p_storage->WriteU8(m_locationsFlags[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,10 +253,10 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
goto done;
|
||||
}
|
||||
|
||||
storage.Write(0x1000c);
|
||||
storage.Write(m_unk0x24);
|
||||
storage.Write((MxU16) m_currentAct);
|
||||
storage.Write(m_actorId);
|
||||
storage.WriteS32(0x1000c);
|
||||
storage.WriteS16(m_unk0x24);
|
||||
storage.WriteU16(m_currentAct);
|
||||
storage.WriteU8(m_actorId);
|
||||
|
||||
for (i = 0; i < sizeOfArray(g_colorSaveData); i++) {
|
||||
if (WriteVariable(&storage, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) {
|
||||
@@ -282,7 +282,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
}
|
||||
}
|
||||
|
||||
storage.Write(count);
|
||||
storage.WriteS16(count);
|
||||
|
||||
for (j = 0; j < m_stateCount; j++) {
|
||||
if (m_stateArray[j]->IsSerializable()) {
|
||||
@@ -291,7 +291,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
}
|
||||
|
||||
area = m_unk0x42c;
|
||||
storage.Write((MxU16) area);
|
||||
storage.WriteU16(area);
|
||||
SerializeScoreHistory(2);
|
||||
m_isDirty = FALSE;
|
||||
|
||||
@@ -342,18 +342,18 @@ MxResult LegoGameState::Load(MxULong p_slot)
|
||||
MxS16 count, actArea;
|
||||
const char* lightPosition;
|
||||
|
||||
storage.Read(version);
|
||||
storage.ReadS32(version);
|
||||
|
||||
if (version != 0x1000c) {
|
||||
OmniError("Saved game version mismatch", 0);
|
||||
goto done;
|
||||
}
|
||||
|
||||
storage.Read(m_unk0x24);
|
||||
storage.Read(actArea);
|
||||
storage.ReadS16(m_unk0x24);
|
||||
storage.ReadS16(actArea);
|
||||
|
||||
SetCurrentAct((Act) actArea);
|
||||
storage.Read(m_actorId);
|
||||
storage.ReadU8(m_actorId);
|
||||
if (m_actorId) {
|
||||
SetActor(m_actorId);
|
||||
}
|
||||
@@ -386,11 +386,11 @@ MxResult LegoGameState::Load(MxULong p_slot)
|
||||
}
|
||||
|
||||
char stateName[80];
|
||||
storage.Read(count);
|
||||
storage.ReadS16(count);
|
||||
|
||||
if (count) {
|
||||
for (MxS16 i = 0; i < count; i++) {
|
||||
storage.Read(stateName);
|
||||
storage.ReadString(stateName);
|
||||
|
||||
LegoState* state = GetState(stateName);
|
||||
if (!state) {
|
||||
@@ -405,7 +405,7 @@ MxResult LegoGameState::Load(MxULong p_slot)
|
||||
}
|
||||
}
|
||||
|
||||
storage.Read(actArea);
|
||||
storage.ReadS16(actArea);
|
||||
|
||||
if (m_currentAct == e_act1) {
|
||||
m_unk0x42c = e_undefined;
|
||||
@@ -528,22 +528,22 @@ void LegoGameState::GetFileSavePath(MxString* p_outPath, MxU8 p_slotn)
|
||||
// FUNCTION: LEGO1 0x1003a2e0
|
||||
void LegoGameState::SerializePlayersInfo(MxS16 p_flags)
|
||||
{
|
||||
LegoFile fileStorage;
|
||||
LegoFile storage;
|
||||
MxString playersGSI = MxString(m_savePath);
|
||||
|
||||
playersGSI += "\\";
|
||||
playersGSI += g_playersGSI;
|
||||
|
||||
if (fileStorage.Open(playersGSI.GetData(), p_flags) == SUCCESS) {
|
||||
if (fileStorage.IsReadMode()) {
|
||||
fileStorage.Read(m_playerCount);
|
||||
if (storage.Open(playersGSI.GetData(), p_flags) == SUCCESS) {
|
||||
if (storage.IsReadMode()) {
|
||||
storage.ReadS16(m_playerCount);
|
||||
}
|
||||
else if (fileStorage.IsWriteMode()) {
|
||||
fileStorage.Write(m_playerCount);
|
||||
else if (storage.IsWriteMode()) {
|
||||
storage.WriteS16(m_playerCount);
|
||||
}
|
||||
|
||||
for (MxS16 i = 0; i < m_playerCount; i++) {
|
||||
m_players[i].Serialize(&fileStorage);
|
||||
m_players[i].Serialize(&storage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1152,16 +1152,16 @@ LegoGameState::Username::Username()
|
||||
|
||||
// FUNCTION: LEGO1 0x1003c690
|
||||
// FUNCTION: BETA10 0x10086c57
|
||||
MxResult LegoGameState::Username::Serialize(LegoFile* p_file)
|
||||
MxResult LegoGameState::Username::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
if (p_file->IsReadMode()) {
|
||||
if (p_storage->IsReadMode()) {
|
||||
for (MxS16 i = 0; i < (MxS16) sizeOfArray(m_letters); i++) {
|
||||
p_file->Read(m_letters[i]);
|
||||
p_storage->ReadS16(m_letters[i]);
|
||||
}
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
else if (p_storage->IsWriteMode()) {
|
||||
for (MxS16 i = 0; i < (MxS16) sizeOfArray(m_letters); i++) {
|
||||
p_file->Write(m_letters[i]);
|
||||
p_storage->WriteS16(m_letters[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1178,31 +1178,31 @@ LegoGameState::Username& LegoGameState::Username::operator=(const Username& p_ot
|
||||
|
||||
// FUNCTION: LEGO1 0x1003c740
|
||||
// FUNCTION: BETA10 0x10086d39
|
||||
MxResult LegoGameState::ScoreItem::Serialize(LegoFile* p_file)
|
||||
MxResult LegoGameState::ScoreItem::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
if (p_file->IsReadMode()) {
|
||||
p_file->Read(m_totalScore);
|
||||
if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadS16(m_totalScore);
|
||||
|
||||
for (MxS32 i = 0; i < 5; i++) {
|
||||
for (MxS32 j = 0; j < 5; j++) {
|
||||
p_file->Read(m_scores[i][j]);
|
||||
p_storage->ReadU8(m_scores[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
m_name.Serialize(p_file);
|
||||
p_file->Read(m_unk0x2a);
|
||||
m_name.Serialize(p_storage);
|
||||
p_storage->ReadS16(m_unk0x2a);
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
p_file->Write(m_totalScore);
|
||||
else if (p_storage->IsWriteMode()) {
|
||||
p_storage->WriteS16(m_totalScore);
|
||||
|
||||
for (MxS32 i = 0; i < 5; i++) {
|
||||
for (MxS32 j = 0; j < 5; j++) {
|
||||
p_file->Write(m_scores[i][j]);
|
||||
p_storage->WriteU8(m_scores[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
m_name.Serialize(p_file);
|
||||
p_file->Write(m_unk0x2a);
|
||||
m_name.Serialize(p_storage);
|
||||
p_storage->WriteS16(m_unk0x2a);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
@@ -1324,25 +1324,25 @@ LegoGameState::ScoreItem* LegoGameState::History::FUN_1003cc90(
|
||||
|
||||
// FUNCTION: LEGO1 0x1003ccf0
|
||||
// FUNCTION: BETA10 0x100873e7
|
||||
MxResult LegoGameState::History::Serialize(LegoFile* p_file)
|
||||
MxResult LegoGameState::History::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
if (p_file->IsReadMode()) {
|
||||
p_file->Read(m_unk0x372);
|
||||
p_file->Read(m_count);
|
||||
if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadS16(m_unk0x372);
|
||||
p_storage->ReadS16(m_count);
|
||||
|
||||
for (MxS16 i = 0; i < m_count; i++) {
|
||||
MxS16 j;
|
||||
p_file->Read(j);
|
||||
m_scores[i].Serialize(p_file);
|
||||
p_storage->ReadS16(j);
|
||||
m_scores[i].Serialize(p_storage);
|
||||
}
|
||||
}
|
||||
else if (p_file->IsWriteMode()) {
|
||||
p_file->Write(m_unk0x372);
|
||||
p_file->Write(m_count);
|
||||
else if (p_storage->IsWriteMode()) {
|
||||
p_storage->WriteS16(m_unk0x372);
|
||||
p_storage->WriteS16(m_count);
|
||||
|
||||
for (MxS16 i = 0; i < m_count; i++) {
|
||||
p_file->Write(i);
|
||||
m_scores[i].Serialize(p_file);
|
||||
p_storage->WriteS16(i);
|
||||
m_scores[i].Serialize(p_storage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1352,7 +1352,7 @@ MxResult LegoGameState::History::Serialize(LegoFile* p_file)
|
||||
// FUNCTION: LEGO1 0x1003cdd0
|
||||
void LegoGameState::SerializeScoreHistory(MxS16 p_flags)
|
||||
{
|
||||
LegoFile stream;
|
||||
LegoFile storage;
|
||||
MxString savePath(m_savePath);
|
||||
savePath += "\\";
|
||||
savePath += g_historyGSI;
|
||||
@@ -1361,8 +1361,8 @@ void LegoGameState::SerializeScoreHistory(MxS16 p_flags)
|
||||
m_history.WriteScoreHistory();
|
||||
}
|
||||
|
||||
if (stream.Open(savePath.GetData(), p_flags) == SUCCESS) {
|
||||
m_history.Serialize(&stream);
|
||||
if (storage.Open(savePath.GetData(), p_flags) == SUCCESS) {
|
||||
m_history.Serialize(&storage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -662,17 +662,17 @@ void SetLightPosition(MxS32 p_index)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003f3b0
|
||||
LegoNamedTexture* ReadNamedTexture(LegoFile* p_file)
|
||||
LegoNamedTexture* ReadNamedTexture(LegoStorage* p_storage)
|
||||
{
|
||||
LegoTexture* texture = NULL;
|
||||
LegoNamedTexture* namedTexture = NULL;
|
||||
MxString string;
|
||||
|
||||
p_file->Read(string);
|
||||
p_storage->ReadMxString(string);
|
||||
|
||||
texture = new LegoTexture();
|
||||
if (texture != NULL) {
|
||||
if (texture->Read(p_file, 0) != SUCCESS) {
|
||||
if (texture->Read(p_storage, 0) != SUCCESS) {
|
||||
delete texture;
|
||||
return namedTexture;
|
||||
}
|
||||
@@ -687,7 +687,7 @@ LegoNamedTexture* ReadNamedTexture(LegoFile* p_file)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003f540
|
||||
void WriteDefaultTexture(LegoFile* p_file, const char* p_name)
|
||||
void WriteDefaultTexture(LegoStorage* p_storage, const char* p_name)
|
||||
{
|
||||
MxString name(p_name);
|
||||
LegoTextureInfo* textureInfo = TextureContainer()->Get(p_name);
|
||||
@@ -743,8 +743,8 @@ void WriteDefaultTexture(LegoFile* p_file, const char* p_name)
|
||||
LegoTexture texture;
|
||||
texture.SetImage(image);
|
||||
|
||||
p_file->Write(MxString(name));
|
||||
texture.Write(p_file);
|
||||
p_storage->WriteMxString(name);
|
||||
texture.Write(p_storage);
|
||||
}
|
||||
else {
|
||||
delete image;
|
||||
@@ -758,10 +758,10 @@ void WriteDefaultTexture(LegoFile* p_file, const char* p_name)
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003f8a0
|
||||
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_namedTexture)
|
||||
void WriteNamedTexture(LegoStorage* p_storage, LegoNamedTexture* p_namedTexture)
|
||||
{
|
||||
p_file->Write(MxString(*p_namedTexture->GetName()));
|
||||
p_namedTexture->GetTexture()->Write(p_file);
|
||||
p_storage->WriteMxString(*p_namedTexture->GetName());
|
||||
p_namedTexture->GetTexture()->Write(p_storage);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1003f930
|
||||
|
||||
@@ -316,6 +316,7 @@ float LegoNavController::CalculateNewVel(float p_targetVel, float p_currentVel,
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10055080
|
||||
// FUNCTION: BETA10 0x1009b26b
|
||||
MxBool LegoNavController::CalculateNewPosDir(
|
||||
const Vector3& p_curPos,
|
||||
const Vector3& p_curDir,
|
||||
|
||||
@@ -135,12 +135,12 @@ RaceState::RaceState()
|
||||
|
||||
// FUNCTION: LEGO1 0x10016140
|
||||
// FUNCTION: BETA10 0x100c7d9f
|
||||
MxResult RaceState::Serialize(LegoFile* p_file)
|
||||
MxResult RaceState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
for (MxS16 i = 0; i < 5; i++) {
|
||||
m_state[i].Serialize(p_file);
|
||||
m_state[i].Serialize(p_storage);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -508,23 +508,23 @@ GasStationState::GasStationState()
|
||||
|
||||
// FUNCTION: LEGO1 0x10006300
|
||||
// FUNCTION: BETA10 0x10029754
|
||||
MxResult GasStationState::Serialize(LegoFile* p_file)
|
||||
MxResult GasStationState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
if (p_file->IsWriteMode()) {
|
||||
p_file->Write(m_pepperAction);
|
||||
p_file->Write(m_mamaAction);
|
||||
p_file->Write(m_papaAction);
|
||||
p_file->Write(m_nickAction);
|
||||
p_file->Write(m_lauraAction);
|
||||
if (p_storage->IsWriteMode()) {
|
||||
p_storage->WriteS16(m_pepperAction);
|
||||
p_storage->WriteS16(m_mamaAction);
|
||||
p_storage->WriteS16(m_papaAction);
|
||||
p_storage->WriteS16(m_nickAction);
|
||||
p_storage->WriteS16(m_lauraAction);
|
||||
}
|
||||
else if (p_file->IsReadMode()) {
|
||||
p_file->Read(m_pepperAction);
|
||||
p_file->Read(m_mamaAction);
|
||||
p_file->Read(m_papaAction);
|
||||
p_file->Read(m_nickAction);
|
||||
p_file->Read(m_lauraAction);
|
||||
else if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadS16(m_pepperAction);
|
||||
p_storage->ReadS16(m_mamaAction);
|
||||
p_storage->ReadS16(m_papaAction);
|
||||
p_storage->ReadS16(m_nickAction);
|
||||
p_storage->ReadS16(m_lauraAction);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -695,25 +695,25 @@ HospitalState::HospitalState()
|
||||
|
||||
// FUNCTION: LEGO1 0x10076530
|
||||
// FUNCTION: BETA10 0x1002db26
|
||||
MxResult HospitalState::Serialize(LegoFile* p_file)
|
||||
MxResult HospitalState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
if (p_file->IsWriteMode()) {
|
||||
p_file->Write(m_unk0x0c);
|
||||
p_file->Write(m_unk0x0e);
|
||||
p_file->Write(m_unk0x10);
|
||||
p_file->Write(m_unk0x12);
|
||||
p_file->Write(m_unk0x14);
|
||||
p_file->Write(m_unk0x16);
|
||||
if (p_storage->IsWriteMode()) {
|
||||
p_storage->WriteS16(m_unk0x0c);
|
||||
p_storage->WriteS16(m_unk0x0e);
|
||||
p_storage->WriteS16(m_unk0x10);
|
||||
p_storage->WriteS16(m_unk0x12);
|
||||
p_storage->WriteS16(m_unk0x14);
|
||||
p_storage->WriteS16(m_unk0x16);
|
||||
}
|
||||
else if (p_file->IsReadMode()) {
|
||||
p_file->Read(m_unk0x0c);
|
||||
p_file->Read(m_unk0x0e);
|
||||
p_file->Read(m_unk0x10);
|
||||
p_file->Read(m_unk0x12);
|
||||
p_file->Read(m_unk0x14);
|
||||
p_file->Read(m_unk0x16);
|
||||
else if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadS16(m_unk0x0c);
|
||||
p_storage->ReadS16(m_unk0x0e);
|
||||
p_storage->ReadS16(m_unk0x10);
|
||||
p_storage->ReadS16(m_unk0x12);
|
||||
p_storage->ReadS16(m_unk0x14);
|
||||
p_storage->ReadS16(m_unk0x16);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -1324,150 +1324,140 @@ Act1State::Act1State()
|
||||
|
||||
// FUNCTION: LEGO1 0x10033ac0
|
||||
// FUNCTION: BETA10 0x1003524f
|
||||
MxResult Act1State::Serialize(LegoFile* p_file)
|
||||
MxResult Act1State::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
m_motocyclePlane.Serialize(p_file);
|
||||
m_bikePlane.Serialize(p_file);
|
||||
m_skateboardPlane.Serialize(p_file);
|
||||
m_helicopterPlane.Serialize(p_file);
|
||||
m_jetskiPlane.Serialize(p_file);
|
||||
m_dunebuggyPlane.Serialize(p_file);
|
||||
m_racecarPlane.Serialize(p_file);
|
||||
m_motocyclePlane.Serialize(p_storage);
|
||||
m_bikePlane.Serialize(p_storage);
|
||||
m_skateboardPlane.Serialize(p_storage);
|
||||
m_helicopterPlane.Serialize(p_storage);
|
||||
m_jetskiPlane.Serialize(p_storage);
|
||||
m_dunebuggyPlane.Serialize(p_storage);
|
||||
m_racecarPlane.Serialize(p_storage);
|
||||
|
||||
if (p_file->IsWriteMode()) {
|
||||
// TODO: Seems to match better when using strcmp directly instead of IsPresent
|
||||
if (p_storage->IsWriteMode()) {
|
||||
if (strcmp(m_helicopterPlane.m_name.GetData(), "")) {
|
||||
if (!m_helicopterWindshield) {
|
||||
WriteDefaultTexture(p_file, "chwind.gif");
|
||||
WriteDefaultTexture(p_storage, "chwind.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_helicopterWindshield);
|
||||
WriteNamedTexture(p_storage, m_helicopterWindshield);
|
||||
}
|
||||
|
||||
if (!m_helicopterJetLeft) {
|
||||
WriteDefaultTexture(p_file, "chjetl.gif");
|
||||
WriteDefaultTexture(p_storage, "chjetl.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_helicopterJetLeft);
|
||||
WriteNamedTexture(p_storage, m_helicopterJetLeft);
|
||||
}
|
||||
|
||||
if (!m_helicopterJetRight) {
|
||||
WriteDefaultTexture(p_file, "chjetr.gif");
|
||||
WriteDefaultTexture(p_storage, "chjetr.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_helicopterJetRight);
|
||||
WriteNamedTexture(p_storage, m_helicopterJetRight);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_jetskiPlane.m_name.GetData(), "")) {
|
||||
if (!m_jetskiFront) {
|
||||
WriteDefaultTexture(p_file, "jsfrnt.gif");
|
||||
WriteDefaultTexture(p_storage, "jsfrnt.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_jetskiFront);
|
||||
WriteNamedTexture(p_storage, m_jetskiFront);
|
||||
}
|
||||
|
||||
if (!m_jetskiWindshield) {
|
||||
WriteDefaultTexture(p_file, "jswnsh.gif");
|
||||
WriteDefaultTexture(p_storage, "jswnsh.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_jetskiWindshield);
|
||||
WriteNamedTexture(p_storage, m_jetskiWindshield);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_dunebuggyPlane.m_name.GetData(), "")) {
|
||||
if (!m_dunebuggyFront) {
|
||||
WriteDefaultTexture(p_file, "dbfrfn.gif");
|
||||
WriteDefaultTexture(p_storage, "dbfrfn.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_dunebuggyFront);
|
||||
WriteNamedTexture(p_storage, m_dunebuggyFront);
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_racecarPlane.m_name.GetData(), "")) {
|
||||
if (!m_racecarFront) {
|
||||
WriteDefaultTexture(p_file, "rcfrnt.gif");
|
||||
WriteDefaultTexture(p_storage, "rcfrnt.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_racecarFront);
|
||||
WriteNamedTexture(p_storage, m_racecarFront);
|
||||
}
|
||||
|
||||
if (!m_racecarBack) {
|
||||
WriteDefaultTexture(p_file, "rcback.gif");
|
||||
WriteDefaultTexture(p_storage, "rcback.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_racecarBack);
|
||||
WriteNamedTexture(p_storage, m_racecarBack);
|
||||
}
|
||||
|
||||
if (!m_racecarTail) {
|
||||
WriteDefaultTexture(p_file, "rctail.gif");
|
||||
WriteDefaultTexture(p_storage, "rctail.gif");
|
||||
}
|
||||
else {
|
||||
WriteNamedTexture(p_file, m_racecarTail);
|
||||
WriteNamedTexture(p_storage, m_racecarTail);
|
||||
}
|
||||
}
|
||||
|
||||
p_file->Write(m_cptClickDialogue.m_nextIndex);
|
||||
p_file->Write(m_unk0x022);
|
||||
p_storage->WriteS16(m_cptClickDialogue.m_nextIndex);
|
||||
p_storage->WriteU8(m_unk0x022);
|
||||
}
|
||||
else if (p_file->IsReadMode()) {
|
||||
else if (p_storage->IsReadMode()) {
|
||||
if (strcmp(m_helicopterPlane.m_name.GetData(), "")) {
|
||||
m_helicopterWindshield = ReadNamedTexture(p_file);
|
||||
if (m_helicopterWindshield == NULL) {
|
||||
if ((m_helicopterWindshield = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_helicopterJetLeft = ReadNamedTexture(p_file);
|
||||
if (m_helicopterJetLeft == NULL) {
|
||||
if ((m_helicopterJetLeft = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_helicopterJetRight = ReadNamedTexture(p_file);
|
||||
if (m_helicopterJetRight == NULL) {
|
||||
if ((m_helicopterJetRight = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_jetskiPlane.m_name.GetData(), "")) {
|
||||
m_jetskiFront = ReadNamedTexture(p_file);
|
||||
if (m_jetskiFront == NULL) {
|
||||
if ((m_jetskiFront = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_jetskiWindshield = ReadNamedTexture(p_file);
|
||||
if (m_jetskiWindshield == NULL) {
|
||||
if ((m_jetskiWindshield = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_dunebuggyPlane.m_name.GetData(), "")) {
|
||||
m_dunebuggyFront = ReadNamedTexture(p_file);
|
||||
if (m_dunebuggyFront == NULL) {
|
||||
if ((m_dunebuggyFront = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if (strcmp(m_racecarPlane.m_name.GetData(), "")) {
|
||||
m_racecarFront = ReadNamedTexture(p_file);
|
||||
if (m_racecarFront == NULL) {
|
||||
if ((m_racecarFront = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_racecarBack = ReadNamedTexture(p_file);
|
||||
if (m_racecarBack == NULL) {
|
||||
if ((m_racecarBack = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_racecarTail = ReadNamedTexture(p_file);
|
||||
if (m_racecarTail == NULL) {
|
||||
if ((m_racecarTail = ReadNamedTexture(p_storage)) == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
p_file->Read(m_cptClickDialogue.m_nextIndex);
|
||||
p_file->Read(m_unk0x022);
|
||||
p_storage->ReadS16(m_cptClickDialogue.m_nextIndex);
|
||||
p_storage->ReadU8(m_unk0x022);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
@@ -209,15 +209,15 @@ PoliceState::PoliceState()
|
||||
|
||||
// FUNCTION: LEGO1 0x1005e990
|
||||
// FUNCTION: BETA10 0x100f08b0
|
||||
MxResult PoliceState::Serialize(LegoFile* p_file)
|
||||
MxResult PoliceState::Serialize(LegoStorage* p_storage)
|
||||
{
|
||||
LegoState::Serialize(p_file);
|
||||
LegoState::Serialize(p_storage);
|
||||
|
||||
if (p_file->IsReadMode()) {
|
||||
p_file->Read((MxS32&) m_policeScript);
|
||||
if (p_storage->IsReadMode()) {
|
||||
p_storage->ReadS32((MxS32&) m_policeScript);
|
||||
}
|
||||
else {
|
||||
p_file->Write((MxS32) m_policeScript);
|
||||
p_storage->WriteS32(m_policeScript);
|
||||
}
|
||||
|
||||
return SUCCESS;
|
||||
|
||||
Reference in New Issue
Block a user