mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-23 00:14:22 +00:00
Use sizeof(type) instead of sizeof(variableName) when (de)serializing data (#1505)
* Use sizeof(type) instead of sizeof(variableName) when (de)serializing data * Less usage of sizeof(variableName) while (de)serializing
This commit is contained in:

committed by
GitHub

parent
c9b41e2db8
commit
2915aa014f
@@ -658,7 +658,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
}
|
||||
|
||||
MxU32 version;
|
||||
if (storage.Read(&version, sizeof(version)) == FAILURE) {
|
||||
if (storage.Read(&version, sizeof(MxU32)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -667,7 +667,7 @@ MxResult LegoAnimationManager::LoadWorldInfo(LegoOmni::World p_worldId)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (storage.Read(&m_animCount, sizeof(m_animCount)) == FAILURE) {
|
||||
if (storage.Read(&m_animCount, sizeof(MxU16)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -760,7 +760,7 @@ MxResult LegoAnimationManager::ReadAnimInfo(LegoStorage* p_storage, AnimInfo* p_
|
||||
MxU8 length;
|
||||
MxS32 i, j;
|
||||
|
||||
if (p_storage->Read(&length, sizeof(length)) == FAILURE) {
|
||||
if (p_storage->Read(&length, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -770,33 +770,33 @@ MxResult LegoAnimationManager::ReadAnimInfo(LegoStorage* p_storage, AnimInfo* p_
|
||||
}
|
||||
|
||||
p_info->m_name[length] = 0;
|
||||
if (p_storage->Read(&p_info->m_objectId, sizeof(p_info->m_objectId)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_objectId, sizeof(MxU32)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (p_storage->Read(&p_info->m_location, sizeof(p_info->m_location)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_location, sizeof(MxS16)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&p_info->m_unk0x0a, sizeof(p_info->m_unk0x0a)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x0a, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&p_info->m_unk0x0b, sizeof(p_info->m_unk0x0b)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x0b, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&p_info->m_unk0x0c, sizeof(p_info->m_unk0x0c)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x0c, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&p_info->m_unk0x0d, sizeof(p_info->m_unk0x0d)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x0d, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; i < (MxS32) sizeOfArray(p_info->m_unk0x10); i++) {
|
||||
if (p_storage->Read(&p_info->m_unk0x10[i], sizeof(*p_info->m_unk0x10)) != SUCCESS) {
|
||||
if (p_storage->Read(&p_info->m_unk0x10[i], sizeof(float)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_storage->Read(&p_info->m_modelCount, sizeof(p_info->m_modelCount)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_modelCount, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -821,7 +821,7 @@ MxResult LegoAnimationManager::ReadModelInfo(LegoStorage* p_storage, ModelInfo*
|
||||
MxResult result = FAILURE;
|
||||
MxU8 length;
|
||||
|
||||
if (p_storage->Read(&length, 1) == FAILURE) {
|
||||
if (p_storage->Read(&length, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -831,20 +831,20 @@ MxResult LegoAnimationManager::ReadModelInfo(LegoStorage* p_storage, ModelInfo*
|
||||
}
|
||||
|
||||
p_info->m_name[length] = 0;
|
||||
if (p_storage->Read(&p_info->m_unk0x04, sizeof(p_info->m_unk0x04)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x04, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (p_storage->Read(p_info->m_location, sizeof(p_info->m_location)) != SUCCESS) {
|
||||
if (p_storage->Read(p_info->m_location, 3 * sizeof(float)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(p_info->m_direction, sizeof(p_info->m_direction)) != SUCCESS) {
|
||||
if (p_storage->Read(p_info->m_direction, 3 * sizeof(float)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(p_info->m_up, sizeof(p_info->m_up)) != SUCCESS) {
|
||||
if (p_storage->Read(p_info->m_up, 3 * sizeof(float)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&p_info->m_unk0x2c, sizeof(p_info->m_unk0x2c)) == FAILURE) {
|
||||
if (p_storage->Read(&p_info->m_unk0x2c, sizeof(MxU8)) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@@ -334,21 +334,21 @@ MxResult LegoBuildingManager::Write(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
|
||||
LegoBuildingInfo* info = &g_buildingInfo[i];
|
||||
|
||||
if (p_storage->Write(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
|
||||
if (p_storage->Write(&info->m_sound, sizeof(MxU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
|
||||
if (p_storage->Write(&info->m_move, sizeof(MxU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
|
||||
if (p_storage->Write(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&info->m_initialUnk0x11, sizeof(info->m_initialUnk0x11)) != SUCCESS) {
|
||||
if (p_storage->Write(&info->m_initialUnk0x11, sizeof(MxS8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
if (p_storage->Write(&m_nextVariant, sizeof(m_nextVariant)) != SUCCESS) {
|
||||
if (p_storage->Write(&m_nextVariant, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -367,16 +367,16 @@ MxResult LegoBuildingManager::Read(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_buildingInfo); i++) {
|
||||
LegoBuildingInfo* info = &g_buildingInfo[i];
|
||||
|
||||
if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_sound, sizeof(MxU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_move, sizeof(MxU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_unk0x11, sizeof(info->m_unk0x11)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_unk0x11, sizeof(MxS8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@@ -178,43 +178,34 @@ MxResult LegoCharacterManager::Read(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_actorInfo); i++) {
|
||||
LegoActorInfo* info = &g_actorInfo[i];
|
||||
|
||||
if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_sound, sizeof(MxS32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_move, sizeof(MxS32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(info->m_parts[c_infohatPart].m_unk0x08)) !=
|
||||
SUCCESS) {
|
||||
if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x08, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x14, sizeof(info->m_parts[c_infohatPart].m_unk0x14)) !=
|
||||
SUCCESS) {
|
||||
if (p_storage->Read(&info->m_parts[c_infohatPart].m_unk0x14, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(
|
||||
&info->m_parts[c_infogronPart].m_unk0x14,
|
||||
sizeof(info->m_parts[c_infogronPart].m_unk0x14)
|
||||
) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_parts[c_infogronPart].m_unk0x14, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_parts[c_armlftPart].m_unk0x14, sizeof(info->m_parts[c_armlftPart].m_unk0x14)) !=
|
||||
SUCCESS) {
|
||||
if (p_storage->Read(&info->m_parts[c_armlftPart].m_unk0x14, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_parts[c_armrtPart].m_unk0x14, sizeof(info->m_parts[c_armrtPart].m_unk0x14)) !=
|
||||
SUCCESS) {
|
||||
if (p_storage->Read(&info->m_parts[c_armrtPart].m_unk0x14, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_parts[c_leglftPart].m_unk0x14, sizeof(info->m_parts[c_leglftPart].m_unk0x14)) !=
|
||||
SUCCESS) {
|
||||
if (p_storage->Read(&info->m_parts[c_leglftPart].m_unk0x14, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_parts[c_legrtPart].m_unk0x14, sizeof(info->m_parts[c_legrtPart].m_unk0x14)) !=
|
||||
SUCCESS) {
|
||||
if (p_storage->Read(&info->m_parts[c_legrtPart].m_unk0x14, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@@ -513,7 +513,7 @@ MxS32 LegoGameState::ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to)
|
||||
MxS32 result = 1;
|
||||
MxU8 len;
|
||||
|
||||
if (p_storage->Read(&len, sizeof(len)) != SUCCESS) {
|
||||
if (p_storage->Read(&len, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ MxS32 LegoGameState::ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to)
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (p_storage->Read(&len, sizeof(len)) != SUCCESS) {
|
||||
if (p_storage->Read(&len, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@@ -305,22 +305,22 @@ MxResult LegoPlantManager::Read(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < sizeOfArray(g_plantInfo); i++) {
|
||||
LegoPlantInfo* info = &g_plantInfo[i];
|
||||
|
||||
if (p_storage->Read(&info->m_variant, sizeof(info->m_variant)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_variant, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_sound, sizeof(info->m_sound)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_sound, sizeof(MxU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_move, sizeof(info->m_move)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_move, sizeof(MxU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_mood, sizeof(info->m_mood)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_mood, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_color, sizeof(info->m_color)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_color, sizeof(MxU8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Read(&info->m_unk0x16, sizeof(info->m_unk0x16)) != SUCCESS) {
|
||||
if (p_storage->Read(&info->m_unk0x16, sizeof(MxS8)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@@ -209,7 +209,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
}
|
||||
|
||||
if (g_wdbOffset == 0) {
|
||||
if (fread(&size, sizeof(size), 1, wdbFile) != 1) {
|
||||
if (fread(&size, sizeof(MxU32), 1, wdbFile) != 1) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ MxResult LegoWorldPresenter::LoadWorld(char* p_worldName, LegoWorld* p_world)
|
||||
|
||||
delete[] buff;
|
||||
|
||||
if (fread(&size, sizeof(size), 1, wdbFile) != 1) {
|
||||
if (fread(&size, sizeof(MxU32), 1, wdbFile) != 1) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
|
@@ -461,28 +461,28 @@ MxResult LegoPathController::Reset()
|
||||
// FUNCTION: BETA10 0x100b781f
|
||||
MxResult LegoPathController::Read(LegoStorage* p_storage)
|
||||
{
|
||||
if (p_storage->Read(&m_numT, sizeof(m_numT)) != SUCCESS) {
|
||||
if (p_storage->Read(&m_numT, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (m_numT > 0) {
|
||||
m_structs = new LegoPathStruct[m_numT];
|
||||
}
|
||||
|
||||
if (p_storage->Read(&m_numN, sizeof(m_numN)) != SUCCESS) {
|
||||
if (p_storage->Read(&m_numN, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (m_numN > 0) {
|
||||
m_unk0x10 = new Mx3DPointFloat[m_numN];
|
||||
}
|
||||
|
||||
if (p_storage->Read(&m_numE, sizeof(m_numE)) != SUCCESS) {
|
||||
if (p_storage->Read(&m_numE, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (m_numE > 0) {
|
||||
m_edges = new LegoPathCtrlEdge[m_numE];
|
||||
}
|
||||
|
||||
if (p_storage->Read(&m_numL, sizeof(m_numL)) != SUCCESS) {
|
||||
if (p_storage->Read(&m_numL, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
if (m_numL > 0) {
|
||||
@@ -523,7 +523,7 @@ MxResult LegoPathController::ReadStructs(LegoStorage* p_storage)
|
||||
for (MxS32 i = 0; i < m_numT; i++) {
|
||||
MxU8 length = 0;
|
||||
|
||||
if (p_storage->Read(&length, sizeof(length)) != SUCCESS) {
|
||||
if (p_storage->Read(&length, sizeof(MxU8)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ MxResult LegoPathController::ReadStructs(LegoStorage* p_storage)
|
||||
m_structs[i].m_name[length] = '\0';
|
||||
}
|
||||
|
||||
if (p_storage->Read(&m_structs[i].m_flags, sizeof(m_structs[i].m_flags)) != SUCCESS) {
|
||||
if (p_storage->Read(&m_structs[i].m_flags, sizeof(MxU32)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
@@ -553,49 +553,49 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
|
||||
LegoPathCtrlEdge& edge = m_edges[i];
|
||||
MxU16 s;
|
||||
|
||||
if (p_storage->Read(&edge.m_flags, sizeof(edge.m_flags)) != SUCCESS) {
|
||||
if (p_storage->Read(&edge.m_flags, sizeof(LegoU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_pointA = &m_unk0x10[s];
|
||||
|
||||
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_pointB = &m_unk0x10[s];
|
||||
|
||||
if (edge.m_flags & LegoUnknown100db7f4::c_bit3) {
|
||||
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_faceA = &m_boundaries[s];
|
||||
|
||||
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_ccwA = &m_edges[s];
|
||||
|
||||
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_cwA = &m_edges[s];
|
||||
}
|
||||
|
||||
if (edge.m_flags & LegoUnknown100db7f4::c_bit4) {
|
||||
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_faceB = &m_boundaries[s];
|
||||
|
||||
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_ccwB = &m_edges[s];
|
||||
|
||||
if (p_storage->Read(&s, sizeof(s)) != SUCCESS) {
|
||||
if (p_storage->Read(&s, sizeof(MxU16)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
edge.m_cwB = &m_edges[s];
|
||||
@@ -605,7 +605,7 @@ MxResult LegoPathController::ReadEdges(LegoStorage* p_storage)
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (p_storage->Read(&edge.m_unk0x3c, sizeof(edge.m_unk0x3c)) != SUCCESS) {
|
||||
if (p_storage->Read(&edge.m_unk0x3c, sizeof(float)) != SUCCESS) {
|
||||
return FAILURE;
|
||||
}
|
||||
}
|
||||
|
@@ -142,25 +142,25 @@ MxResult LegoAnimPresenter::CreateAnim(MxStreamChunk* p_chunk)
|
||||
LegoS32 parseScene = 0;
|
||||
MxS32 val3;
|
||||
|
||||
if (storage.Read(&magicSig, sizeof(magicSig)) != SUCCESS || magicSig != 0x11) {
|
||||
if (storage.Read(&magicSig, sizeof(MxS32)) != SUCCESS || magicSig != 0x11) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&m_unk0xa4, sizeof(m_unk0xa4)) != SUCCESS) {
|
||||
if (storage.Read(&m_unk0xa4, sizeof(float)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&m_unk0xa8[0], sizeof(m_unk0xa8[0])) != SUCCESS) {
|
||||
if (storage.Read(&m_unk0xa8[0], sizeof(float)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&m_unk0xa8[1], sizeof(m_unk0xa8[1])) != SUCCESS) {
|
||||
if (storage.Read(&m_unk0xa8[1], sizeof(float)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&m_unk0xa8[2], sizeof(m_unk0xa8[2])) != SUCCESS) {
|
||||
if (storage.Read(&m_unk0xa8[2], sizeof(float)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&parseScene, sizeof(parseScene)) != SUCCESS) {
|
||||
if (storage.Read(&parseScene, sizeof(LegoS32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&val3, sizeof(val3)) != SUCCESS) {
|
||||
if (storage.Read(&val3, sizeof(MxS32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@@ -65,29 +65,29 @@ MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk)
|
||||
if (!(m_roi = new LegoROI(VideoManager()->GetRenderer()))) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&version, sizeof(version)) != SUCCESS) {
|
||||
if (storage.Read(&version, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (version != MODEL_VERSION) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&textureInfoOffset, sizeof(textureInfoOffset)) != SUCCESS) {
|
||||
if (storage.Read(&textureInfoOffset, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
storage.SetPosition(textureInfoOffset);
|
||||
|
||||
if (storage.Read(&numTextures, sizeof(numTextures)) != SUCCESS) {
|
||||
if (storage.Read(&numTextures, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&skipTextures, sizeof(skipTextures)) != SUCCESS) {
|
||||
if (storage.Read(&skipTextures, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; i < numTextures; i++) {
|
||||
LegoU32 textureNameLength;
|
||||
|
||||
storage.Read(&textureNameLength, sizeof(textureNameLength));
|
||||
storage.Read(&textureNameLength, sizeof(LegoU32));
|
||||
textureName = new LegoChar[textureNameLength + 1];
|
||||
storage.Read(textureName, textureNameLength);
|
||||
textureName[textureNameLength] = '\0';
|
||||
@@ -149,7 +149,7 @@ MxResult LegoModelPresenter::CreateROI(MxDSChunk* p_chunk)
|
||||
|
||||
storage.SetPosition(8);
|
||||
|
||||
if (storage.Read(&numROIs, sizeof(numROIs)) != SUCCESS) {
|
||||
if (storage.Read(&numROIs, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (anim.Read(&storage, FALSE) != SUCCESS) {
|
||||
|
@@ -56,8 +56,8 @@ MxResult LegoPalettePresenter::ParsePalette(MxStreamChunk* p_chunk)
|
||||
MxResult result = FAILURE;
|
||||
|
||||
LegoMemory stream((char*) p_chunk->GetData());
|
||||
if (stream.Read(buffer, sizeof(buffer)) == SUCCESS) {
|
||||
if (stream.Read(palette, sizeof(palette)) == SUCCESS) {
|
||||
if (stream.Read(buffer, 40 * sizeof(MxU8)) == SUCCESS) {
|
||||
if (stream.Read(palette, 256 * 4 * sizeof(MxU8)) == SUCCESS) {
|
||||
m_palette = new MxPalette(palette);
|
||||
if (m_palette) {
|
||||
result = SUCCESS;
|
||||
|
@@ -68,20 +68,20 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk)
|
||||
LegoTextureInfo* textureInfo = NULL;
|
||||
LegoS32 hardwareMode = VideoManager()->GetDirect3D()->AssignedDevice()->GetHardwareMode();
|
||||
|
||||
if (storage.Read(&textureInfoOffset, sizeof(textureInfoOffset)) != SUCCESS) {
|
||||
if (storage.Read(&textureInfoOffset, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.SetPosition(textureInfoOffset) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&numTextures, sizeof(numTextures)) != SUCCESS) {
|
||||
if (storage.Read(&numTextures, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; i < numTextures; i++) {
|
||||
LegoU32 textureNameLength;
|
||||
|
||||
storage.Read(&textureNameLength, sizeof(textureNameLength));
|
||||
storage.Read(&textureNameLength, sizeof(LegoU32));
|
||||
textureName = new LegoChar[textureNameLength + 1];
|
||||
storage.Read(textureName, textureNameLength);
|
||||
textureName[textureNameLength] = '\0';
|
||||
@@ -145,12 +145,12 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk)
|
||||
|
||||
m_parts = new LegoNamedPartList();
|
||||
|
||||
if (storage.Read(&numROIs, sizeof(numROIs)) != SUCCESS) {
|
||||
if (storage.Read(&numROIs, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
for (i = 0; i < numROIs; i++) {
|
||||
if (storage.Read(&roiNameLength, sizeof(roiNameLength)) != SUCCESS) {
|
||||
if (storage.Read(&roiNameLength, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -162,10 +162,10 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk)
|
||||
roiName[roiNameLength] = '\0';
|
||||
strlwr(roiName);
|
||||
|
||||
if (storage.Read(&numLODs, sizeof(numLODs)) != SUCCESS) {
|
||||
if (storage.Read(&numLODs, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (storage.Read(&roiInfoOffset, sizeof(roiInfoOffset)) != SUCCESS) {
|
||||
if (storage.Read(&roiInfoOffset, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,7 @@ MxResult LegoTexturePresenter::Read(MxDSChunk& p_chunk)
|
||||
m_textures = new LegoNamedTextureList();
|
||||
|
||||
LegoU32 numTextures, i;
|
||||
if (storage.Read(&numTextures, sizeof(numTextures)) != SUCCESS) {
|
||||
if (storage.Read(&numTextures, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ MxResult LegoTexturePresenter::Read(MxDSChunk& p_chunk)
|
||||
LegoTexture* texture;
|
||||
LegoNamedTexture* namedTexture;
|
||||
|
||||
if (storage.Read(&textureNameLength, sizeof(textureNameLength)) != SUCCESS) {
|
||||
if (storage.Read(&textureNameLength, sizeof(LegoU32)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user