mirror of
https://github.com/isledecomp/isle.git
synced 2025-10-22 16:04:17 +00:00
Clear unknowns in ViewLOD
(#1599)
This commit is contained in:
@@ -187,7 +187,7 @@ MxResult LegoPartPresenter::Read(MxDSChunk& p_chunk)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
if (surplusLODs != 0 && lod->GetUnknown0x08Test8()) {
|
if (surplusLODs != 0 && lod->IsExtraLOD()) {
|
||||||
numLODs++;
|
numLODs++;
|
||||||
surplusLODs--;
|
surplusLODs--;
|
||||||
}
|
}
|
||||||
|
@@ -69,11 +69,11 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
|
|||||||
LegoU32 i, indexBackwards, indexForwards, tempNumVertsAndNormals;
|
LegoU32 i, indexBackwards, indexForwards, tempNumVertsAndNormals;
|
||||||
unsigned char paletteEntries[256];
|
unsigned char paletteEntries[256];
|
||||||
|
|
||||||
if (p_storage->Read(&m_unk0x08, sizeof(undefined4)) != SUCCESS) {
|
if (p_storage->Read(&m_flags, sizeof(LegoU32)) != SUCCESS) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetUnknown0x08Test4()) {
|
if (SkipReadingData()) {
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,11 +84,11 @@ LegoResult LegoLOD::Read(Tgl::Renderer* p_renderer, LegoTextureContainer* p_text
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (m_numMeshes == 0) {
|
if (m_numMeshes == 0) {
|
||||||
ClearFlag(c_bit4);
|
ClearFlag(c_hasMesh);
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetFlag(c_bit4);
|
SetFlag(c_hasMesh);
|
||||||
|
|
||||||
m_melems = new Mesh[m_numMeshes];
|
m_melems = new Mesh[m_numMeshes];
|
||||||
memset(m_melems, 0, sizeof(*m_melems) * m_numMeshes);
|
memset(m_melems, 0, sizeof(*m_melems) * m_numMeshes);
|
||||||
@@ -315,7 +315,7 @@ LegoLOD* LegoLOD::Clone(Tgl::Renderer* p_renderer)
|
|||||||
dupLod->m_melems[i].m_textured = m_melems[i].m_textured;
|
dupLod->m_melems[i].m_textured = m_melems[i].m_textured;
|
||||||
}
|
}
|
||||||
|
|
||||||
dupLod->m_unk0x08 = m_unk0x08;
|
dupLod->m_flags = m_flags;
|
||||||
dupLod->m_numMeshes = m_numMeshes;
|
dupLod->m_numMeshes = m_numMeshes;
|
||||||
dupLod->m_numVertices = m_numVertices;
|
dupLod->m_numVertices = m_numVertices;
|
||||||
dupLod->m_numPolys = m_numPolys;
|
dupLod->m_numPolys = m_numPolys;
|
||||||
|
@@ -259,7 +259,7 @@ LegoResult LegoROI::Read(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
if (surplusLODs != 0 && lod->GetUnknown0x08Test8()) {
|
if (surplusLODs != 0 && lod->IsExtraLOD()) {
|
||||||
numLODs++;
|
numLODs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -276,7 +276,7 @@ LegoResult LegoROI::Read(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
if (surplusLODs != 0 && lod->GetUnknown0x08Test8()) {
|
if (surplusLODs != 0 && lod->IsExtraLOD()) {
|
||||||
numLODs++;
|
numLODs++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,10 +14,10 @@
|
|||||||
class ViewLOD : public LODObject {
|
class ViewLOD : public LODObject {
|
||||||
public:
|
public:
|
||||||
enum {
|
enum {
|
||||||
c_bit4 = 0x10
|
c_hasMesh = 0x10
|
||||||
};
|
};
|
||||||
|
|
||||||
ViewLOD(Tgl::Renderer* pRenderer) : m_meshBuilder(NULL), m_unk0x08(3) {}
|
ViewLOD(Tgl::Renderer* pRenderer) : m_meshBuilder(NULL), m_flags(3) {}
|
||||||
~ViewLOD() override;
|
~ViewLOD() override;
|
||||||
|
|
||||||
// FUNCTION: LEGO1 0x100a6f30
|
// FUNCTION: LEGO1 0x100a6f30
|
||||||
@@ -28,19 +28,19 @@ public:
|
|||||||
|
|
||||||
Tgl::MeshBuilder* GetMeshBuilder() { return m_meshBuilder; }
|
Tgl::MeshBuilder* GetMeshBuilder() { return m_meshBuilder; }
|
||||||
const Tgl::MeshBuilder* GetMeshBuilder() const { return m_meshBuilder; }
|
const Tgl::MeshBuilder* GetMeshBuilder() const { return m_meshBuilder; }
|
||||||
undefined4 GetUnknown0x08() { return m_unk0x08; }
|
unsigned int GetFlags() { return m_flags; }
|
||||||
unsigned char GetUnknown0x08Test4() { return m_unk0x08 & 0xffffff04; }
|
unsigned char SkipReadingData() { return m_flags & 0xffffff04; }
|
||||||
unsigned char GetUnknown0x08Test8() { return m_unk0x08 & 0xffffff08; }
|
unsigned char IsExtraLOD() { return m_flags & 0xffffff08; }
|
||||||
|
|
||||||
void SetFlag(unsigned char p_flag) { m_unk0x08 |= p_flag; }
|
void SetFlag(unsigned char p_flag) { m_flags |= p_flag; }
|
||||||
void ClearFlag(unsigned char p_flag) { m_unk0x08 &= ~p_flag; }
|
void ClearFlag(unsigned char p_flag) { m_flags &= ~p_flag; }
|
||||||
|
|
||||||
// SYNTHETIC: LEGO1 0x100a6f60
|
// SYNTHETIC: LEGO1 0x100a6f60
|
||||||
// ViewLOD::`scalar deleting destructor'
|
// ViewLOD::`scalar deleting destructor'
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Tgl::MeshBuilder* m_meshBuilder; // 0x04
|
Tgl::MeshBuilder* m_meshBuilder; // 0x04
|
||||||
undefined4 m_unk0x08; // 0x08
|
unsigned int m_flags; // 0x08
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VIEWLOD_H
|
#endif // VIEWLOD_H
|
||||||
|
@@ -165,7 +165,7 @@ void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_lodLevel)
|
|||||||
if (lodLevel < 0) {
|
if (lodLevel < 0) {
|
||||||
lod = (ViewLOD*) p_roi->GetLOD(p_lodLevel);
|
lod = (ViewLOD*) p_roi->GetLOD(p_lodLevel);
|
||||||
|
|
||||||
if (lod->GetUnknown0x08() & ViewLOD::c_bit4) {
|
if (lod->GetFlags() & ViewLOD::c_hasMesh) {
|
||||||
scene->Add((Tgl::MeshBuilder*) group);
|
scene->Add((Tgl::MeshBuilder*) group);
|
||||||
SetAppData(p_roi, reinterpret_cast<LPD3DRM_APPDATA>(p_roi));
|
SetAppData(p_roi, reinterpret_cast<LPD3DRM_APPDATA>(p_roi));
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,7 @@ void ViewManager::UpdateROIDetailBasedOnLOD(ViewROI* p_roi, int p_lodLevel)
|
|||||||
lod = (ViewLOD*) p_roi->GetLOD(p_lodLevel);
|
lod = (ViewLOD*) p_roi->GetLOD(p_lodLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lod->GetUnknown0x08() & ViewLOD::c_bit4) {
|
if (lod->GetFlags() & ViewLOD::c_hasMesh) {
|
||||||
meshBuilder = lod->GetMeshBuilder();
|
meshBuilder = lod->GetMeshBuilder();
|
||||||
|
|
||||||
if (meshBuilder != NULL) {
|
if (meshBuilder != NULL) {
|
||||||
@@ -389,7 +389,7 @@ inline int ViewManager::GetFirstLODIndex(ViewROI* p_roi)
|
|||||||
const LODListBase* lods = p_roi->GetLODs();
|
const LODListBase* lods = p_roi->GetLODs();
|
||||||
|
|
||||||
if (lods != NULL && lods->Size() > 0) {
|
if (lods != NULL && lods->Size() > 0) {
|
||||||
if (((ViewLOD*) p_roi->GetLOD(0))->GetUnknown0x08Test8()) {
|
if (((ViewLOD*) p_roi->GetLOD(0))->IsExtraLOD()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -404,7 +404,7 @@ inline int ViewManager::GetFirstLODIndex(ViewROI* p_roi)
|
|||||||
const LODListBase* lods = ((ViewROI*) *it)->GetLODs();
|
const LODListBase* lods = ((ViewROI*) *it)->GetLODs();
|
||||||
|
|
||||||
if (lods != NULL && lods->Size() > 0) {
|
if (lods != NULL && lods->Size() > 0) {
|
||||||
if (((ViewLOD*) ((ViewROI*) *it)->GetLOD(0))->GetUnknown0x08Test8()) {
|
if (((ViewLOD*) ((ViewROI*) *it)->GetLOD(0))->IsExtraLOD()) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Reference in New Issue
Block a user