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:
Anonymous Maarten
2025-05-18 22:56:28 +02:00
committed by GitHub
parent c9b41e2db8
commit 2915aa014f
27 changed files with 227 additions and 234 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;
}
}

View File

@@ -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;
}

View File

@@ -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) {

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -31,7 +31,7 @@ LegoResult LegoUnknownKey::Read(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) {
if ((result = p_storage->Read(&m_z, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
@@ -48,7 +48,7 @@ LegoResult LegoUnknownKey::Write(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) {
if ((result = p_storage->Write(&m_z, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
@@ -95,7 +95,7 @@ LegoResult LegoAnimScene::Write(LegoStorage* p_storage)
LegoResult result;
LegoS32 i;
if ((result = p_storage->Write(&m_unk0x00, sizeof(m_unk0x00))) != SUCCESS) {
if ((result = p_storage->Write(&m_unk0x00, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_unk0x00 != 0) {
@@ -106,7 +106,7 @@ LegoResult LegoAnimScene::Write(LegoStorage* p_storage)
}
}
if ((result = p_storage->Write(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
if ((result = p_storage->Write(&m_unk0x08, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_unk0x08 != 0) {
@@ -117,7 +117,7 @@ LegoResult LegoAnimScene::Write(LegoStorage* p_storage)
}
}
if ((result = p_storage->Write(&m_unk0x10, sizeof(m_unk0x10))) != SUCCESS) {
if ((result = p_storage->Write(&m_unk0x10, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_unk0x10 != 0) {
@@ -137,7 +137,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
LegoResult result;
LegoS32 i;
if ((result = p_storage->Read(&m_unk0x00, sizeof(m_unk0x00))) != SUCCESS) {
if ((result = p_storage->Read(&m_unk0x00, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_unk0x00 != 0) {
@@ -149,7 +149,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
}
}
if ((result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
if ((result = p_storage->Read(&m_unk0x08, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_unk0x08 != 0) {
@@ -161,7 +161,7 @@ LegoResult LegoAnimScene::Read(LegoStorage* p_storage)
}
}
if ((result = p_storage->Read(&m_unk0x10, sizeof(m_unk0x10))) != SUCCESS) {
if ((result = p_storage->Read(&m_unk0x10, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_unk0x10 != 0) {
@@ -295,7 +295,7 @@ LegoResult LegoAnimKey::Read(LegoStorage* p_storage)
LegoResult result;
LegoS32 timeAndFlags;
if ((result = p_storage->Read(&timeAndFlags, sizeof(timeAndFlags))) != SUCCESS) {
if ((result = p_storage->Read(&timeAndFlags, sizeof(LegoS32))) != SUCCESS) {
return result;
}
@@ -311,7 +311,7 @@ LegoResult LegoAnimKey::Write(LegoStorage* p_storage)
LegoResult result;
LegoS32 timeAndFlags = (LegoS32) m_time | (m_flags << 24);
if ((result = p_storage->Write(&timeAndFlags, sizeof(timeAndFlags))) != SUCCESS) {
if ((result = p_storage->Write(&timeAndFlags, sizeof(LegoS32))) != SUCCESS) {
return result;
}
@@ -335,15 +335,15 @@ LegoResult LegoTranslationKey::Read(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Read(&m_x, sizeof(m_x))) != SUCCESS) {
if ((result = p_storage->Read(&m_x, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_y, sizeof(m_y))) != SUCCESS) {
if ((result = p_storage->Read(&m_y, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) {
if ((result = p_storage->Read(&m_z, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
@@ -364,15 +364,15 @@ LegoResult LegoTranslationKey::Write(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) {
if ((result = p_storage->Write(&m_x, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) {
if ((result = p_storage->Write(&m_y, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) {
if ((result = p_storage->Write(&m_z, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
@@ -398,19 +398,19 @@ LegoResult LegoRotationKey::Read(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Read(&m_angle, sizeof(m_angle))) != SUCCESS) {
if ((result = p_storage->Read(&m_angle, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_x, sizeof(m_x))) != SUCCESS) {
if ((result = p_storage->Read(&m_x, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_y, sizeof(m_y))) != SUCCESS) {
if ((result = p_storage->Read(&m_y, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) {
if ((result = p_storage->Read(&m_z, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
@@ -435,15 +435,15 @@ LegoResult LegoRotationKey::Write(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) {
if ((result = p_storage->Write(&m_x, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) {
if ((result = p_storage->Write(&m_y, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) {
if ((result = p_storage->Write(&m_z, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
@@ -467,15 +467,15 @@ LegoResult LegoScaleKey::Read(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Read(&m_x, sizeof(m_x))) != SUCCESS) {
if ((result = p_storage->Read(&m_x, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_y, sizeof(m_y))) != SUCCESS) {
if ((result = p_storage->Read(&m_y, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_z, sizeof(m_z))) != SUCCESS) {
if ((result = p_storage->Read(&m_z, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
@@ -496,15 +496,15 @@ LegoResult LegoScaleKey::Write(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Write(&m_x, sizeof(m_x))) != SUCCESS) {
if ((result = p_storage->Write(&m_x, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_y, sizeof(m_y))) != SUCCESS) {
if ((result = p_storage->Write(&m_y, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_z, sizeof(m_z))) != SUCCESS) {
if ((result = p_storage->Write(&m_z, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
@@ -560,7 +560,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage)
LegoResult result;
LegoU32 length;
if ((result = p_storage->Read(&length, sizeof(length))) != SUCCESS) {
if ((result = p_storage->Read(&length, sizeof(LegoU32))) != SUCCESS) {
return result;
}
@@ -578,7 +578,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage)
LegoU32 i;
if ((result = p_storage->Read(&m_numTranslationKeys, sizeof(m_numTranslationKeys))) != SUCCESS) {
if ((result = p_storage->Read(&m_numTranslationKeys, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_translationKeys) {
@@ -594,7 +594,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage)
}
}
if ((result = p_storage->Read(&m_numRotationKeys, sizeof(m_numRotationKeys))) != SUCCESS) {
if ((result = p_storage->Read(&m_numRotationKeys, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_rotationKeys) {
@@ -610,7 +610,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage)
}
}
if ((result = p_storage->Read(&m_numScaleKeys, sizeof(m_numScaleKeys))) != SUCCESS) {
if ((result = p_storage->Read(&m_numScaleKeys, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_scaleKeys) {
@@ -626,7 +626,7 @@ LegoResult LegoAnimNodeData::Read(LegoStorage* p_storage)
}
}
if ((result = p_storage->Read(&m_numMorphKeys, sizeof(m_numMorphKeys))) != SUCCESS) {
if ((result = p_storage->Read(&m_numMorphKeys, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_morphKeys) {
@@ -665,7 +665,7 @@ LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Write(&m_numTranslationKeys, sizeof(m_numTranslationKeys))) != SUCCESS) {
if ((result = p_storage->Write(&m_numTranslationKeys, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_numTranslationKeys != 0) {
@@ -676,7 +676,7 @@ LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage)
}
}
if ((result = p_storage->Write(&m_numRotationKeys, sizeof(m_numRotationKeys))) != SUCCESS) {
if ((result = p_storage->Write(&m_numRotationKeys, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_numRotationKeys != 0) {
@@ -687,7 +687,7 @@ LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage)
}
}
if ((result = p_storage->Write(&m_numScaleKeys, sizeof(m_numScaleKeys))) != SUCCESS) {
if ((result = p_storage->Write(&m_numScaleKeys, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_numScaleKeys != 0) {
@@ -698,7 +698,7 @@ LegoResult LegoAnimNodeData::Write(LegoStorage* p_storage)
}
}
if ((result = p_storage->Write(&m_numMorphKeys, sizeof(m_numMorphKeys))) != SUCCESS) {
if ((result = p_storage->Write(&m_numMorphKeys, sizeof(LegoU16))) != SUCCESS) {
return result;
}
if (m_numMorphKeys != 0) {
@@ -1040,7 +1040,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene)
LegoResult result = FAILURE;
LegoU32 length, i;
if (p_storage->Read(&length, sizeof(length)) != SUCCESS) {
if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) {
goto done;
}
@@ -1049,7 +1049,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene)
for (i = 0; i < length; i++) {
LegoU32 length;
if (p_storage->Read(&length, sizeof(length)) != SUCCESS) {
if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) {
goto done;
}
@@ -1062,7 +1062,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene)
m_modelList[i].m_name[length] = '\0';
if (p_storage->Read(&m_modelList[i].m_unk0x04, sizeof(m_modelList[i].m_unk0x04)) != SUCCESS) {
if (p_storage->Read(&m_modelList[i].m_unk0x04, sizeof(undefined4)) != SUCCESS) {
goto done;
}
}
@@ -1070,7 +1070,7 @@ LegoResult LegoAnim::Read(LegoStorage* p_storage, LegoS32 p_parseScene)
m_numActors++;
}
if ((result = p_storage->Read(&m_duration, sizeof(m_duration))) != SUCCESS) {
if ((result = p_storage->Read(&m_duration, sizeof(LegoS32))) != SUCCESS) {
goto done;
}
@@ -1183,7 +1183,7 @@ LegoResult LegoMorphKey::Read(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Read(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
if ((result = p_storage->Read(&m_unk0x08, sizeof(LegoU8))) != SUCCESS) {
return result;
}
@@ -1200,7 +1200,7 @@ LegoResult LegoMorphKey::Write(LegoStorage* p_storage)
return result;
}
if ((result = p_storage->Write(&m_unk0x08, sizeof(m_unk0x08))) != SUCCESS) {
if ((result = p_storage->Write(&m_unk0x08, sizeof(LegoU8))) != SUCCESS) {
return result;
}

View File

@@ -19,13 +19,13 @@ LegoPaletteEntry::LegoPaletteEntry()
LegoResult LegoPaletteEntry::Read(LegoStorage* p_storage)
{
LegoResult result;
if ((result = p_storage->Read(&m_red, sizeof(m_red))) != SUCCESS) {
if ((result = p_storage->Read(&m_red, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_green, sizeof(m_green))) != SUCCESS) {
if ((result = p_storage->Read(&m_green, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_blue, sizeof(m_blue))) != SUCCESS) {
if ((result = p_storage->Read(&m_blue, sizeof(LegoU8))) != SUCCESS) {
return result;
}
return SUCCESS;
@@ -35,13 +35,13 @@ LegoResult LegoPaletteEntry::Read(LegoStorage* p_storage)
LegoResult LegoPaletteEntry::Write(LegoStorage* p_storage)
{
LegoResult result;
if ((result = p_storage->Write(&m_red, sizeof(m_red))) != SUCCESS) {
if ((result = p_storage->Write(&m_red, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_green, sizeof(m_green))) != SUCCESS) {
if ((result = p_storage->Write(&m_green, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_blue, sizeof(m_blue))) != SUCCESS) {
if ((result = p_storage->Write(&m_blue, sizeof(LegoU8))) != SUCCESS) {
return result;
}
return SUCCESS;
@@ -77,13 +77,13 @@ LegoImage::~LegoImage()
LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
{
LegoResult result;
if ((result = p_storage->Read(&m_width, sizeof(m_width))) != SUCCESS) {
if ((result = p_storage->Read(&m_width, sizeof(LegoU32))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_height, sizeof(m_height))) != SUCCESS) {
if ((result = p_storage->Read(&m_height, sizeof(LegoU32))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_count, sizeof(m_height))) != SUCCESS) {
if ((result = p_storage->Read(&m_count, sizeof(LegoU32))) != SUCCESS) {
return result;
}
for (LegoU32 i = 0; i < m_count; i++) {
@@ -153,13 +153,13 @@ LegoResult LegoImage::Read(LegoStorage* p_storage, LegoU32 p_square)
LegoResult LegoImage::Write(LegoStorage* p_storage)
{
LegoResult result;
if ((result = p_storage->Write(&m_width, sizeof(m_width))) != SUCCESS) {
if ((result = p_storage->Write(&m_width, sizeof(LegoU32))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_height, sizeof(m_height))) != SUCCESS) {
if ((result = p_storage->Write(&m_height, sizeof(LegoU32))) != SUCCESS) {
return result;
}
if ((result = p_storage->Write(&m_count, sizeof(m_height))) != SUCCESS) {
if ((result = p_storage->Write(&m_count, sizeof(LegoU32))) != SUCCESS) {
return result;
}
for (LegoU32 i = 0; i < m_count; i++) {

View File

@@ -45,21 +45,21 @@ public:
// FUNCTION: BETA10 0x1004b0d0
LegoStorage* WriteU8(LegoU8 p_data)
{
Write(&p_data, sizeof(p_data));
Write(&p_data, sizeof(LegoU8));
return this;
}
// FUNCTION: BETA10 0x10017ce0
LegoStorage* WriteS16(LegoS16 p_data)
{
Write(&p_data, sizeof(p_data));
Write(&p_data, sizeof(LegoS16));
return this;
}
// FUNCTION: BETA10 0x1004b110
LegoStorage* WriteU16(LegoU16 p_data)
{
Write(&p_data, sizeof(p_data));
Write(&p_data, sizeof(LegoU16));
return this;
}
@@ -67,7 +67,7 @@ public:
// FUNCTION: BETA10 0x10088540
LegoStorage* WriteS32(MxS32 p_data)
{
Write(&p_data, sizeof(p_data));
Write(&p_data, sizeof(MxS32));
return this;
}
@@ -75,14 +75,14 @@ public:
// FUNCTION: BETA10 0x1004b150
LegoStorage* WriteU32(MxU32 p_data)
{
Write(&p_data, sizeof(p_data));
Write(&p_data, sizeof(MxU32));
return this;
}
// FUNCTION: BETA10 0x10073610
LegoStorage* WriteFloat(LegoFloat p_data)
{
Write(&p_data, sizeof(p_data));
Write(&p_data, sizeof(LegoFloat));
return this;
}
@@ -116,21 +116,21 @@ public:
// FUNCTION: BETA10 0x1004b190
LegoStorage* ReadU8(LegoU8& p_data)
{
Read(&p_data, sizeof(p_data));
Read(&p_data, sizeof(LegoU8));
return this;
}
// FUNCTION: BETA10 0x10024680
LegoStorage* ReadS16(LegoS16& p_data)
{
Read(&p_data, sizeof(p_data));
Read(&p_data, sizeof(LegoS16));
return this;
}
// FUNCTION: BETA10 0x1004b1d0
LegoStorage* ReadU16(LegoU16& p_data)
{
Read(&p_data, sizeof(p_data));
Read(&p_data, sizeof(LegoU16));
return this;
}
@@ -138,7 +138,7 @@ public:
// FUNCTION: BETA10 0x10088580
LegoStorage* ReadS32(MxS32& p_data)
{
Read(&p_data, sizeof(p_data));
Read(&p_data, sizeof(MxS32));
return this;
}
@@ -146,14 +146,14 @@ public:
// FUNCTION: BETA10 0x1004b210
LegoStorage* ReadU32(MxU32& p_data)
{
Read(&p_data, sizeof(p_data));
Read(&p_data, sizeof(MxU32));
return this;
}
// FUNCTION: BETA10 0x10073650
LegoStorage* ReadFloat(LegoFloat& p_data)
{
Read(&p_data, sizeof(p_data));
Read(&p_data, sizeof(LegoFloat));
return this;
}

View File

@@ -64,7 +64,7 @@ LegoResult LegoTree::Read(LegoStorage* p_storage, LegoTreeNode*& p_node)
return result;
}
LegoU32 numChildren;
if ((result = p_storage->Read(&numChildren, sizeof(numChildren))) != SUCCESS) {
if ((result = p_storage->Read(&numChildren, sizeof(LegoU32))) != SUCCESS) {
return result;
}
if (numChildren) {
@@ -91,7 +91,7 @@ LegoResult LegoTree::Write(LegoStorage* p_storage, LegoTreeNode* p_node)
}
}
LegoU32 numChildren = p_node->GetNumChildren();
if ((result = p_storage->Write(&numChildren, sizeof(numChildren))) != SUCCESS) {
if ((result = p_storage->Write(&numChildren, sizeof(LegoU32))) != SUCCESS) {
return result;
}
for (LegoU32 i = 0; i < p_node->GetNumChildren(); i++) {

View File

@@ -69,7 +69,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
LegoU32 i, meshUnd1, meshUnd2, tempNumVertsAndNormals;
unsigned char paletteEntries[256];
if (p_storage->Read(&m_unk0x08, sizeof(m_unk0x08)) != SUCCESS) {
if (p_storage->Read(&m_unk0x08, sizeof(undefined4)) != SUCCESS) {
goto done;
}
@@ -79,7 +79,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
m_meshBuilder = p_renderer->CreateMeshBuilder();
if (p_storage->Read(&m_numMeshes, sizeof(m_numMeshes)) != SUCCESS) {
if (p_storage->Read(&m_numMeshes, sizeof(LegoU32)) != SUCCESS) {
goto done;
}
@@ -96,34 +96,34 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
meshUnd1 = m_numMeshes - 1;
meshUnd2 = 0;
if (p_storage->Read(&tempNumVertsAndNormals, sizeof(tempNumVertsAndNormals)) != SUCCESS) {
if (p_storage->Read(&tempNumVertsAndNormals, sizeof(LegoU32)) != SUCCESS) {
goto done;
}
numVerts = *((LegoU16*) &tempNumVertsAndNormals) & MAXSHORT;
numNormals = (*((LegoU16*) &tempNumVertsAndNormals + 1) >> 1) & MAXSHORT;
if (p_storage->Read(&numTextureVertices, sizeof(numTextureVertices)) != SUCCESS) {
if (p_storage->Read(&numTextureVertices, sizeof(LegoS32)) != SUCCESS) {
goto done;
}
if (numVerts > 0) {
vertices = new float[numVerts][sizeOfArray(*vertices)];
if (p_storage->Read(vertices, numVerts * sizeof(*vertices)) != SUCCESS) {
if (p_storage->Read(vertices, numVerts * 3 * sizeof(float)) != SUCCESS) {
goto done;
}
}
if (numNormals > 0) {
normals = new float[numNormals][sizeOfArray(*normals)];
if (p_storage->Read(normals, numNormals * sizeof(*normals)) != SUCCESS) {
if (p_storage->Read(normals, numNormals * 3 * sizeof(float)) != SUCCESS) {
goto done;
}
}
if (numTextureVertices > 0) {
textureVertices = new float[numTextureVertices][sizeOfArray(*textureVertices)];
if (p_storage->Read(textureVertices, numTextureVertices * sizeof(*textureVertices)) != SUCCESS) {
if (p_storage->Read(textureVertices, numTextureVertices * 2 * sizeof(float)) != SUCCESS) {
goto done;
}
}
@@ -144,7 +144,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
}
polyIndices = new LegoU32[numPolys & USHRT_MAX][sizeOfArray(*polyIndices)];
if (p_storage->Read(polyIndices, (numPolys & USHRT_MAX) * sizeof(*polyIndices)) != SUCCESS) {
if (p_storage->Read(polyIndices, (numPolys & USHRT_MAX) * 3 * sizeof(LegoU32)) != SUCCESS) {
goto done;
}
@@ -154,7 +154,7 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
if (numTextureIndices > 0) {
textureIndices = new LegoU32[numPolys & USHRT_MAX][sizeOfArray(*textureIndices)];
if (p_storage->Read(textureIndices, (numPolys & USHRT_MAX) * sizeof(*textureIndices)) != SUCCESS) {
if (p_storage->Read(textureIndices, (numPolys & USHRT_MAX) * 3 * sizeof(LegoU32)) != SUCCESS) {
goto done;
}
}

View File

@@ -128,7 +128,7 @@ LegoResult LegoROI::Read(
m_parentROI = p_unk0xd4;
if (p_storage->Read(&length, sizeof(length)) != SUCCESS) {
if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) {
goto done;
}
m_name = new LegoChar[length + 1];
@@ -153,7 +153,7 @@ LegoResult LegoROI::Read(
SET3(m_unk0x80.Min(), box.GetMin());
SET3(m_unk0x80.Max(), box.GetMax());
if (p_storage->Read(&length, sizeof(length)) != SUCCESS) {
if (p_storage->Read(&length, sizeof(LegoU32)) != SUCCESS) {
goto done;
}
@@ -169,7 +169,7 @@ LegoResult LegoROI::Read(
textureName = NULL;
}
if (p_storage->Read(&m_unk0x100, sizeof(m_unk0x100)) != SUCCESS) {
if (p_storage->Read(&m_unk0x100, sizeof(undefined)) != SUCCESS) {
goto done;
}
@@ -192,7 +192,7 @@ LegoResult LegoROI::Read(
}
}
else {
if (p_storage->Read(&numLODs, sizeof(numLODs)) != SUCCESS) {
if (p_storage->Read(&numLODs, sizeof(LegoU32)) != SUCCESS) {
goto done;
}
@@ -203,7 +203,7 @@ LegoResult LegoROI::Read(
const LegoChar* roiName = m_name;
LegoU32 offset;
if (p_storage->Read(&offset, sizeof(offset)) != SUCCESS) {
if (p_storage->Read(&offset, sizeof(LegoU32)) != SUCCESS) {
goto done;
}
@@ -312,7 +312,7 @@ LegoResult LegoROI::Read(
}
}
if (p_storage->Read(&numROIs, sizeof(numROIs)) != SUCCESS) {
if (p_storage->Read(&numROIs, sizeof(LegoU32)) != SUCCESS) {
goto done;
}

View File

@@ -9,13 +9,13 @@ DECOMP_SIZE_ASSERT(LegoColor, 0x03)
LegoResult LegoColor::Read(LegoStorage* p_storage)
{
LegoResult result;
if ((result = p_storage->Read(&m_red, sizeof(m_red))) != SUCCESS) {
if ((result = p_storage->Read(&m_red, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_green, sizeof(m_green))) != SUCCESS) {
if ((result = p_storage->Read(&m_green, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_blue, sizeof(m_blue))) != SUCCESS) {
if ((result = p_storage->Read(&m_blue, sizeof(LegoU8))) != SUCCESS) {
return result;
}
return SUCCESS;

View File

@@ -43,23 +43,23 @@ LegoResult LegoMesh::Read(LegoStorage* p_storage)
if ((result = m_color.Read(p_storage)) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_alpha, sizeof(m_alpha))) != SUCCESS) {
if ((result = p_storage->Read(&m_alpha, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_shading, sizeof(m_shading))) != SUCCESS) {
if ((result = p_storage->Read(&m_shading, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_unk0x0d, sizeof(m_unk0x0d))) != SUCCESS) {
if ((result = p_storage->Read(&m_unk0x0d, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_unk0x20, sizeof(m_unk0x20))) != SUCCESS) {
if ((result = p_storage->Read(&m_unk0x20, sizeof(undefined))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_unk0x21, sizeof(m_unk0x21))) != SUCCESS) {
if ((result = p_storage->Read(&m_unk0x21, sizeof(LegoU8))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&textureLength, sizeof(textureLength))) != SUCCESS) {
if ((result = p_storage->Read(&textureLength, sizeof(LegoU32))) != SUCCESS) {
return result;
}
if (textureLength) {
@@ -73,7 +73,7 @@ LegoResult LegoMesh::Read(LegoStorage* p_storage)
strlwr(m_textureName);
}
if ((result = p_storage->Read(&materialLength, sizeof(materialLength))) != SUCCESS) {
if ((result = p_storage->Read(&materialLength, sizeof(LegoU32))) != SUCCESS) {
return result;
}
if (materialLength) {

View File

@@ -12,7 +12,7 @@ LegoResult LegoSphere::Read(LegoStorage* p_storage)
if ((result = m_center.Read(p_storage)) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_radius, sizeof(m_radius))) != SUCCESS) {
if ((result = p_storage->Read(&m_radius, sizeof(LegoFloat))) != SUCCESS) {
return result;
}
return SUCCESS;

View File

@@ -17,13 +17,13 @@ LegoVertex::LegoVertex()
LegoResult LegoVertex::Read(LegoStorage* p_storage)
{
LegoResult result;
if ((result = p_storage->Read(&m_coordinates[0], sizeof(m_coordinates[0]))) != SUCCESS) {
if ((result = p_storage->Read(&m_coordinates[0], sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_coordinates[1], sizeof(m_coordinates[1]))) != SUCCESS) {
if ((result = p_storage->Read(&m_coordinates[1], sizeof(LegoFloat))) != SUCCESS) {
return result;
}
if ((result = p_storage->Read(&m_coordinates[2], sizeof(m_coordinates[2]))) != SUCCESS) {
if ((result = p_storage->Read(&m_coordinates[2], sizeof(LegoFloat))) != SUCCESS) {
return result;
}
return SUCCESS;