update project

This commit is contained in:
yyc12345 2023-09-20 13:13:08 +08:00
parent d66716acd7
commit 0a85832d63
15 changed files with 72 additions and 84 deletions

View File

@ -135,12 +135,6 @@ typedef enum CK_OBJECT_SHOWOPTION {
CKHIERARCHICALHIDE =2
} CK_OBJECT_SHOWOPTION;
typedef enum CK_OBJECT_CANBEHIDE {
CKCANNOTHIDE =0, // the object cannot be hidden
CKCANHIDE =1, // the object can be hidden
CKCANHIERARCHICALHIDE =2 // the object can be hidden and hierarchically hidden
} CK_OBJECT_CANBEHIDE;
/***************************************************
{filename:CK_OBJECT_FLAGS}
Summary: CKObject Flags

View File

@ -144,11 +144,6 @@ namespace LibCmo::CK2 {
CKSHOW = 0x1,
CKHIERARCHICALHIDE = 0x2,
};
enum class CK_OBJECT_CANBEHIDE : CKDWORD {
CKCANNOTHIDE = 0, /**< the object cannot be hidden */
CKCANHIDE = 1, /**< the object can be hidden */
CKCANHIERARCHICALHIDE = 2, /**< the object can be hidden and hierarchically hidden */
};
/**
CKObject Flags
@remark

View File

@ -116,11 +116,13 @@ namespace LibCmo::CK2::ObjImpls {
// copy visible data
// process direct visible
// todo add if visible
// and set or unset VX_MOVEABLE_VISIBLE
if (EnumsHelper::Has(m_ObjectFlags, CK_OBJECT_FLAGS::CK_OBJECT_VISIBLE)) {
EnumsHelper::Add(m_MoveableFlags, VxMath::VX_MOVEABLE_FLAGS::VX_MOVEABLE_VISIBLE);
} else {
EnumsHelper::Rm(m_MoveableFlags, VxMath::VX_MOVEABLE_FLAGS::VX_MOVEABLE_VISIBLE);
}
// process indirect visible
if (EnumsHelper::Has(m_ObjectFlags, CK_OBJECT_FLAGS::CKBEHAVIORLINK_ACTIVATEDLASTFRAME)) {
if (EnumsHelper::Has(m_ObjectFlags, CK_OBJECT_FLAGS::CK_OBJECT_HIERACHICALHIDE)) {
EnumsHelper::Add(m_MoveableFlags, VxMath::VX_MOVEABLE_FLAGS::VX_MOVEABLE_HIERARCHICALHIDE);
} else {
EnumsHelper::Rm(m_MoveableFlags, VxMath::VX_MOVEABLE_FLAGS::VX_MOVEABLE_HIERARCHICALHIDE);
@ -157,4 +159,29 @@ namespace LibCmo::CK2::ObjImpls {
return true;
}
void CK3dEntity::Show(CK_OBJECT_SHOWOPTION show) {
CKObject::Show(show);
EnumsHelper::Rm(m_MoveableFlags, EnumsHelper::Merge({
VxMath::VX_MOVEABLE_FLAGS::VX_MOVEABLE_VISIBLE,
VxMath::VX_MOVEABLE_FLAGS::VX_MOVEABLE_HIERARCHICALHIDE,
}));
switch (show) {
case CK_OBJECT_SHOWOPTION::CKSHOW:
EnumsHelper::Add(m_MoveableFlags, VxMath::VX_MOVEABLE_FLAGS::VX_MOVEABLE_VISIBLE);
break;
case CK_OBJECT_SHOWOPTION::CKHIERARCHICALHIDE:
EnumsHelper::Add(m_MoveableFlags, VxMath::VX_MOVEABLE_FLAGS::VX_MOVEABLE_HIERARCHICALHIDE);
break;
case CK_OBJECT_SHOWOPTION::CKHIDE:
break;
}
}
bool CK3dEntity::IsVisible() const {
// MARK: originally there is a call to this->IsHiddenByParent.
// but we drop the support of parent, so we drop that condition.
return CKObject::IsVisible();
}
}

View File

@ -18,6 +18,10 @@ namespace LibCmo::CK2::ObjImpls {
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
//virtual void PostLoad() override;
// it have special Show and IsVisible method
virtual void Show(CK_OBJECT_SHOWOPTION show = CK_OBJECT_SHOWOPTION::CKSHOW) override;
virtual bool IsVisible() const override;
protected:
XContainer::XObjectPointerArray m_PotentialMeshes;

View File

@ -54,6 +54,16 @@ namespace LibCmo::CK2::ObjImpls {
return true;
}
void CKGroup::Show(CK_OBJECT_SHOWOPTION show) {
CKObject::Show(show);
// call Show for all sub object
for (auto& ptr : m_ObjectArray) {
if (ptr == nullptr) continue;
ptr->Show(show);
}
}
CKDWORD CKGroup::GetGroupIndex() {
return m_GroupIndex;
}

View File

@ -19,6 +19,9 @@ namespace LibCmo::CK2::ObjImpls {
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
//virtual void PostLoad() override;
// it only have special Show method
virtual void Show(CK_OBJECT_SHOWOPTION show = CK_OBJECT_SHOWOPTION::CKSHOW) override;
CKDWORD GetGroupIndex();
// ===== Insert =====

View File

@ -33,10 +33,7 @@ namespace LibCmo::CK2::ObjImpls {
// read flag
if (chunk->SeekIdentifier(CK_STATESAVEFLAGS_MESH::CK_STATESAVE_MESHFLAGS)) {
CKDWORD flags;
chunk->ReadStruct(flags);
m_Flags = static_cast<VxMath::VXMESH_FLAGS>(flags);
chunk->ReadStruct(m_Flags);
EnumsHelper::Mask(m_Flags, VxMath::VXMESH_FLAGS::VXMESH_ALLFLAGS);
// I don't know why, just interpter the IDA code.
@ -226,6 +223,16 @@ namespace LibCmo::CK2::ObjImpls {
return true;
}
void CKMesh::Show(CK_OBJECT_SHOWOPTION show) {
CKObject::Show(show);
if (show == CK_OBJECT_SHOWOPTION::CKSHOW) {
EnumsHelper::Add(m_Flags, VxMath::VXMESH_FLAGS::VXMESH_VISIBLE);
} else {
EnumsHelper::Rm(m_Flags, VxMath::VXMESH_FLAGS::VXMESH_VISIBLE);
}
}
#pragma region Misc Section
void CKMesh::CleanMesh() {

View File

@ -19,7 +19,10 @@ namespace LibCmo::CK2::ObjImpls {
virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
//virtual void PostLoad() override;
// it only have special Show method
virtual void Show(CK_OBJECT_SHOWOPTION show = CK_OBJECT_SHOWOPTION::CKSHOW) override;
// ===== Misc Section =====
public:
void CleanMesh();

View File

@ -28,9 +28,6 @@ namespace LibCmo::CK2::ObjImpls {
void CKObject::SetObjectFlags(CK_OBJECT_FLAGS flags) {
m_ObjectFlags = flags;
}
bool CKObject::IsHierarchicallyHide() const {
return EnumsHelper::Has(m_ObjectFlags, CK_OBJECT_FLAGS::CK_OBJECT_HIERACHICALHIDE);
}
CKContext* CKObject::GetCKContext() const {
return m_Context;
}
@ -92,14 +89,6 @@ namespace LibCmo::CK2::ObjImpls {
}
}
bool CKObject::IsHiddenByParent() const {
return false;
}
CK_OBJECT_CANBEHIDE CKObject::CanBeHide() const {
return CK_OBJECT_CANBEHIDE::CKCANNOTHIDE;
}
bool CKObject::IsVisible() const {
return EnumsHelper::Has(m_ObjectFlags, CK_OBJECT_FLAGS::CK_OBJECT_VISIBLE);
}

View File

@ -14,8 +14,6 @@ Implement as original meaning:
- GetClassID()
- Show()
- IsHiddenByParent()
- CanBeHide()
- IsVisible()
- CheckPreDeletion()
@ -27,6 +25,9 @@ No implement because don't care:
- PrepareDependencies()
- RemapDependencies()
- IsHiddenByParent()
- CanBeHide()
Implement moved into other location:
- Copy(): Use CKObject::CKObject(CK_ID newid, const CKObject* obj) ctor and CKClassDesc to implement.
- PreDelete(): Write in dtor.
@ -46,7 +47,6 @@ namespace LibCmo::CK2::ObjImpls {
void SetName(CKSTRING u8_name);
CK_OBJECT_FLAGS GetObjectFlags(void) const;
void SetObjectFlags(CK_OBJECT_FLAGS flags);
bool IsHierarchicallyHide() const;
CKContext* GetCKContext() const;
virtual CK_CLASSID GetClassID(void) {
@ -73,27 +73,12 @@ namespace LibCmo::CK2::ObjImpls {
*/
virtual void Show(CK_OBJECT_SHOWOPTION show = CK_OBJECT_SHOWOPTION::CKSHOW);
/**
* @brief Returns whether this object is hidden (and also hides its children).
* @return true if hierarchically hidden.
* @brief Returns whether this object is visible
* @return TRUE if the object is visible, FALSE otherwise
* @remark
* + This methods returns if this object is hidden and also hides all its sub-hierarchy.
* + See CKObject::Show¡ì for more details on hierarchically hidden objects.
* + Only CKRenderObject and derived classes(CK2dEntity,CK3dEntity),CKMesh and CKGroup return relevant information about their visibility state. Other classes may return any values.
* + An object can return CKSHOW and still be hidden if its parent (see CK3dEntity::GetParent and CK2dEntity::GetParent) is hierarchically hidden (see CKObject::Show)
*/
virtual bool IsHiddenByParent() const;
/**
* @brief Returns whether this object class allows it to be shown or hidden.
* @return 3 possible value according to its type.
* + CKCANNOTHIDE if the object cannot be hidden
* + CKCANHIDE if the object can be hidden
* + CKCANHIERARCHICALHIDE if the object can be hidden and hierarchically hidden
* @remark
* + This virtual function is mainly used by the Virtools interface to known if visibility flags have an impact on a specific object class.
* + CKRenderObject and derived classes,can be triggered as to be shown or hidden or hierarchically hidden and will return 2 to this function.
* + CKMesh and CKGroup can be triggered as to be shown or hidden and will return 1 to this function.
* + Other classes will return 0 which means CKObject::Show function will not have any impact on them.
*/
virtual CK_OBJECT_CANBEHIDE CanBeHide() const;
virtual bool IsVisible() const;
protected:

View File

@ -1,8 +0,0 @@
#include "CKRenderObject.hpp"
#include "../CKStateChunk.hpp"
namespace LibCmo::CK2::ObjImpls {
// nothing to compile now
}

View File

@ -16,11 +16,13 @@ namespace LibCmo::CK2::ObjImpls {
virtual CK_CLASSID GetClassID(void) override {
return CK_CLASSID::CKCID_RENDEROBJECT;
}
// CKRenderObject do not implement any load/save functions
//virtual void PreSave(CKFileVisitor* file, CKDWORD flags) override;
//virtual bool Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) override;
//virtual bool Load(CKStateChunk* chunk, CKFileVisitor* file) override;
//virtual void PostLoad() override;
protected:
};

View File

@ -1,15 +0,0 @@
#include "CKSceneObject.hpp"
#include "../CKStateChunk.hpp"
namespace LibCmo::CK2::ObjImpls {
//bool CKSceneObject::Save(CKStateChunk* chunk, CKFileVisitor* file, CKDWORD flags) {
// return false;
//}
//bool CKSceneObject::Load(CKStateChunk* chunk, CKFileVisitor* file) {
// return false;
//}
}

View File

@ -192,8 +192,6 @@
<ClCompile Include="CK2\ObjImpls\CKMaterial.cpp" />
<ClCompile Include="CK2\ObjImpls\CKMesh.cpp" />
<ClCompile Include="CK2\ObjImpls\CKObject.cpp" />
<ClCompile Include="CK2\ObjImpls\CKRenderObject.cpp" />
<ClCompile Include="CK2\ObjImpls\CKSceneObject.cpp" />
<ClCompile Include="CK2\ObjImpls\CKTexture.cpp" />
<ClCompile Include="VTEncoding.cpp" />
<ClCompile Include="CK2\CKFileReader.cpp" />

View File

@ -84,18 +84,12 @@
<ClCompile Include="CK2\CKStateChunkOthers.cpp">
<Filter>Sources\CK2</Filter>
</ClCompile>
<ClCompile Include="CK2\ObjImpls\CKSceneObject.cpp">
<Filter>Sources\CK2\ObjImpls</Filter>
</ClCompile>
<ClCompile Include="CK2\ObjImpls\CKBeObject.cpp">
<Filter>Sources\CK2\ObjImpls</Filter>
</ClCompile>
<ClCompile Include="CK2\ObjImpls\CKGroup.cpp">
<Filter>Sources\CK2\ObjImpls</Filter>
</ClCompile>
<ClCompile Include="CK2\ObjImpls\CKRenderObject.cpp">
<Filter>Sources\CK2\ObjImpls</Filter>
</ClCompile>
<ClCompile Include="CK2\ObjImpls\CK3dEntity.cpp">
<Filter>Sources\CK2\ObjImpls</Filter>
</ClCompile>