diff --git a/CodeGen/GeneralWriter.java b/CodeGen/GeneralWriter.java index 2e660e1..ba5df5e 100644 --- a/CodeGen/GeneralWriter.java +++ b/CodeGen/GeneralWriter.java @@ -31,6 +31,7 @@ public class GeneralWriter { // write enum tail indent.dec(); indent.puts("};"); + indent.printf("LIBCMO_BITFLAG_OPERATORS(%s);", enum_t.mEnumName); } } diff --git a/CodeGen/MainRunner.java b/CodeGen/MainRunner.java index 3d7f8fe..0275c73 100644 --- a/CodeGen/MainRunner.java +++ b/CodeGen/MainRunner.java @@ -108,7 +108,7 @@ public class MainRunner { fs = CommonHelper.openOutputFile("dest/Def2.hpp"); GeneralWriter.writeEnums(fs, def2); fs.close(); - + // print message. System.out.println("DONE!"); } diff --git a/LibCmo/CKManagers.hpp b/LibCmo/CK2/CKBaseManager.hpp similarity index 86% rename from LibCmo/CKManagers.hpp rename to LibCmo/CK2/CKBaseManager.hpp index cb7e61b..6371734 100644 --- a/LibCmo/CKManagers.hpp +++ b/LibCmo/CK2/CKBaseManager.hpp @@ -7,7 +7,7 @@ namespace LibCmo::CK2::CKManagerImplements { class CKBaseManager { public: - CKBaseManager(CKMinContext* ctx, CK_ID ckid); + CKBaseManager(CKContext* ctx, CK_ID ckid); CKBaseManager(const CKBaseManager&) = delete; CKBaseManager& operator=(const CKBaseManager&) = delete; virtual ~CKBaseManager(); @@ -21,7 +21,7 @@ namespace LibCmo::CK2::CKManagerImplements { class CKAttributeManager : public CKBaseManager { public: - CKAttributeManager(CKMinContext* ctx, CK_ID ckid); + CKAttributeManager(CKContext* ctx, CK_ID ckid); CKAttributeManager(const CKAttributeManager&) = delete; CKAttributeManager& operator=(const CKAttributeManager&) = delete; virtual ~CKAttributeManager(); diff --git a/LibCmo/CKMinContext.cpp b/LibCmo/CK2/CKContext.cpp similarity index 96% rename from LibCmo/CKMinContext.cpp rename to LibCmo/CK2/CKContext.cpp index e6d1f28..2839d15 100644 --- a/LibCmo/CKMinContext.cpp +++ b/LibCmo/CK2/CKContext.cpp @@ -1,7 +1,4 @@ -#include "VTUtils.hpp" -#include "CKMinContext.hpp" -#include "CKObjects.hpp" -#include "CKManagers.hpp" +#include "CKContext.hpp" #include namespace LibCmo::CK2 { @@ -42,7 +39,7 @@ namespace LibCmo::CK2 { }, // register CKBaseManagers m_ManagersCreationMap{ - {PredefinedGuids::ATTRIBUTE_MANAGER_GUID, ([](CKMinContext* ctx, CK_ID id) ->CKManagerImplements::CKBaseManager* { return new(std::nothrow) CKManagerImplements::CKAttributeManager(ctx, id); })}, + {ATTRIBUTE_MANAGER_GUID, ([](CKMinContext* ctx, CK_ID id) ->CKManagerImplements::CKBaseManager* { return new(std::nothrow) CKManagerImplements::CKAttributeManager(ctx, id); })}, } { // preset for temp folder diff --git a/LibCmo/CK2/CKContext.hpp b/LibCmo/CK2/CKContext.hpp new file mode 100644 index 0000000..ff54628 --- /dev/null +++ b/LibCmo/CK2/CKContext.hpp @@ -0,0 +1,72 @@ +#pragma once + +#include "../VTAll.hpp" +#include +#include +#include + +namespace LibCmo::CK2 { + + /** + @brief Main Interface Object + @details + + The CKContext object is the heart of all Virtools based applications, It is the first object that should be created in order to + use Virtools SDK. A CKContext can be simply created by calling its constructor. + + The CKContext object act as the central interface to create/destroy objects,to access managers, to load/save files. + + Several CKContext can be created inside a same process (in multiple threads for example) but objects created + by a specific CKContext must not be used in other contextes. + @see CKContext::CreateObject, CKContext::GetObject, CKContext::DestroyObject + */ + class CKContext { + public: + CKContext(); + CKContext(const CKContext&) = delete; + CKContext& operator=(const CKContext&) = delete; + ~CKContext(); + + using PrintCallback = std::function; + void Printf(CKSTRING fmt, ...); + void SetPrintCallback(PrintCallback cb); + + /** + * @brief Creates a CKObject or derived class instance. + * @param[in] cls Class Identifier (CK_CLASSID) of the object to create. + * @param[in] name The name of this object. + * @return A pointer to the newly created object. + * @remark CKObjects must be destroy with the DestroyObject method. + * @see CKObject, DestroyObject + */ + CKObject* CreateCKObject(CK_CLASSID cls, CKSTRING name); + CKObject* GetCKObject(CK_ID id); + void DestroyCKObject(CK_ID id); + + //CKManagerImplements::CKBaseManager* CreateCKManager(CKGUID guid); + //CKManagerImplements::CKBaseManager* GetCKManager(CK_ID guid); + //void DestroyCKManager(CKManagerImplements::CKBaseManager* mgr); + + CK_ID GetObjectMaxID(void); + void SetObjectMaxID(CK_ID id); + + void GetUtf8String(const std::string& native_name, std::string& u8_name); + void GetNativeString(const std::string& u8_name, std::string& native_name); + + void SetEncoding(const std::vector encoding_series); + void SetTempPath(CKSTRING u8_temp); + + FILE* OpenTempFile(CKSTRING u8_filename, bool is_read); + + public: + std::map m_ObjectsList; + std::map m_ManagersList; + + std::map> m_ObjectsCreationMap; + std::map> m_ManagersCreationMap; + + CK_ID m_CKObjectMaxID; + + std::vector m_NameEncoding; + std::filesystem::path m_TempFolder; + PrintCallback m_PrintCallback; + }; + +} diff --git a/LibCmo/CK2/CKDefines.hpp b/LibCmo/CK2/CKDefines.hpp new file mode 100644 index 0000000..5325704 --- /dev/null +++ b/LibCmo/CK2/CKDefines.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include +#include +#include +#include +#include "CKTypes.hpp" + +namespace LibCmo::CK2 { + /** + * @brief Current Version of CK Engine (Day/Month/Year) + */ + constexpr const CKDWORD CKVERSION = 0x05082002u; + /** + * @brief Current Version of Dev + */ + constexpr const CKDWORD DEVVERSION = 0x02050000u; + constexpr const CKGUID VIRTOOLS_GUID = CKGUID(0x56495254u, 0x4f4f4c53u); +} diff --git a/LibCmo/CK2/CKEnums.hpp b/LibCmo/CK2/CKEnums.hpp new file mode 100644 index 0000000..3db508c --- /dev/null +++ b/LibCmo/CK2/CKEnums.hpp @@ -0,0 +1,201 @@ +#pragma once + +#include "../VTUtils.hpp" +#include "CKTypes.hpp" +#include +#include + +namespace LibCmo::CK2 { + +#pragma region Preregistred Managers + + // Virtools Managers GUID second data is 0 + + constexpr const CKDWORD OBJECT_MANAGER_GUID1 = 0x7cbb3b91; + constexpr const CKDWORD ATTRIBUTE_MANAGER_GUID1 = 0x3d242466; + constexpr const CKDWORD MESSAGE_MANAGER_GUID1 = 0x466a0fac; + constexpr const CKDWORD FLOOR_MANAGER_GUID1 = 0x420936f9; + constexpr const CKDWORD COLLISION_MANAGER_GUID1 = 0x38244712; + constexpr const CKDWORD GRID_MANAGER_GUID1 = 0x7f004791; + constexpr const CKDWORD TIME_MANAGER_GUID1 = 0x89ce7b32; + constexpr const CKDWORD BEHAVIOR_MANAGER_GUID1 = 0x58d621ae; + constexpr const CKDWORD INPUT_MANAGER_GUID1 = 0xf787c904; + constexpr const CKDWORD SOUND_MANAGER_GUID1 = 0xdce135f6; + constexpr const CKDWORD MIDI_MANAGER_GUID1 = 0x594154a6; + constexpr const CKDWORD INTERFACE_MANAGER_GUID1 = 0x9a4b8e3d; + constexpr const CKDWORD RENDER_MANAGER_GUID1 = 0xa213c8d5; + constexpr const CKDWORD PARAMETER_MANAGER_GUID1 = 0x9ce57ab6; + constexpr const CKDWORD PATH_MANAGER_GUID1 = 0x15fd54b9; + constexpr const CKDWORD VARIABLE_MANAGER_GUID1 = 0x98cc3cc9; + + constexpr const CKGUID OBJECT_MANAGER_GUID{ OBJECT_MANAGER_GUID1 ,0 }; + constexpr const CKGUID ATTRIBUTE_MANAGER_GUID{ ATTRIBUTE_MANAGER_GUID1, 0 }; + constexpr const CKGUID MESSAGE_MANAGER_GUID{ MESSAGE_MANAGER_GUID1 ,0 }; + constexpr const CKGUID TIME_MANAGER_GUID{ TIME_MANAGER_GUID1 ,0 }; + constexpr const CKGUID SOUND_MANAGER_GUID{ SOUND_MANAGER_GUID1 ,0 }; + constexpr const CKGUID MIDI_MANAGER_GUID{ MIDI_MANAGER_GUID1 ,0 }; + constexpr const CKGUID INPUT_MANAGER_GUID{ INPUT_MANAGER_GUID1 ,0 }; + constexpr const CKGUID BEHAVIOR_MANAGER_GUID{ BEHAVIOR_MANAGER_GUID1 ,0 }; + constexpr const CKGUID FLOOR_MANAGER_GUID{ FLOOR_MANAGER_GUID1 ,0 }; + constexpr const CKGUID COLLISION_MANAGER_GUID{ COLLISION_MANAGER_GUID1 ,0 }; + constexpr const CKGUID GRID_MANAGER_GUID{ GRID_MANAGER_GUID1 ,0 }; + constexpr const CKGUID INTERFACE_MANAGER_GUID{ INTERFACE_MANAGER_GUID1 ,0 }; + constexpr const CKGUID RENDER_MANAGER_GUID{ RENDER_MANAGER_GUID1 ,0 }; + constexpr const CKGUID PARAMETER_MANAGER_GUID{ PARAMETER_MANAGER_GUID1 ,0 }; + constexpr const CKGUID PATH_MANAGER_GUID{ PATH_MANAGER_GUID1 ,0 }; + constexpr const CKGUID VARIABLE_MANAGER_GUID{ VARIABLE_MANAGER_GUID1 ,0 }; + +#pragma endregion + + /** + Specify the way files are saved to disk (compression) + @remark + + File write mode controls the format of a Virtools file when saved. More specifically it + controls whether compression is enabled and also if the Virtools Dev Interface specific data + should be stored in the file (if CKFILE_FORVIEWER flag is set , no interface data is saved) + + See also: CKContext::SetFileWriteMode, CKContext::GetFileWriteMode, CKContext::SetCompressionLevel, + CKContext::SetGlobalImagesSaveOptions, CKContext::SetGlobalSoundsSaveOptions + */ + enum class CK_FILE_WRITEMODE : uint32_t { + CKFILE_UNCOMPRESSED = 0, /**< Save data uncompressed */ + CKFILE_CHUNKCOMPRESSED_OLD = 1, /**< Obsolete */ + CKFILE_EXTERNALTEXTURES_OLD = 2, /**< Obsolete : use CKContext::SetGlobalImagesSaveOptions instead. */ + CKFILE_FORVIEWER = 4, /**< Don't save Interface Data within the file, the level won't be editable anymore in the interface */ + CKFILE_WHOLECOMPRESSED = 8, /**< Compress the whole file */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_FILE_WRITEMODE); + /** + Load Options. + @remark + + This options apply when loading a Virtools file + or a importing a 3D Model file. + + They defines whether object geometry,only animations + or only behaviors should be loaded. + + One can specify (using the CK_LOAD_AS_DYNAMIC_OBJECT) if + created CKObjects should be created as dynamic (See also Dynamic Objects) + See also : CKContext::Load, CKContext::CKSave + */ + enum class CK_LOAD_FLAGS : uint32_t { + CK_LOAD_ANIMATION = 1 << 0, /**< Load animations */ + CK_LOAD_GEOMETRY = 1 << 1, /**< Load geometry. */ + CK_LOAD_DEFAULT = CK_LOAD_GEOMETRY | CK_LOAD_ANIMATION, /**< Load animations & geometry */ + CK_LOAD_ASCHARACTER = 1 << 2, /**< Load all the objects and create a character that contains them all . */ + CK_LOAD_DODIALOG = 1 << 3, /**< Check object name unicity and warns the user with a dialog box when duplicate names are found. */ + CK_LOAD_AS_DYNAMIC_OBJECT = 1 << 4, /**< Objects loaded from this file may be deleted at run-time or are temporary */ + CK_LOAD_AUTOMATICMODE = 1 << 5, /**< Check object name unicity and automatically rename or replace according to the options specified in CKContext::SetAutomaticLoadMode */ + CK_LOAD_CHECKDUPLICATES = 1 << 6, /**< Check object name unicity (The list of duplicates is stored in the CKFile class after a OpenFile call */ + CK_LOAD_CHECKDEPENDENCIES = 1 << 7, /**< Check if every plugins needed are availables */ + CK_LOAD_ONLYBEHAVIORS = 1 << 8, /**< */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_LOAD_FLAGS); + /** + Options that will be used to create this object... + */ + enum class CK_FO_OPTIONS : uint32_t { + CK_FO_DEFAULT = 0, /**< Default behavior : a new object will be created with the name stored in CKFileObject */ + CK_FO_RENAMEOBJECT, /**< Renaming : a new object will be created with the name stored in CKFileObject + a integer value XXX to ensure its uniqueness */ + CK_FO_REPLACEOBJECT, /**< Do not create a new object, instead use an existing one which CK_ID is given by CreatedObject to load the chunk on */ + CK_FO_DONTLOADOBJECT, /**< Object chunk will not be read either because it is a reference or because the loaded object already exist in the current level and the user choose to keep the existing one. */ + }; + /** + Type identifier for a Virtools plugin. + @remark + + Each plugin must be given a type. + + This enumeration is used to identify a specific catagory + of plugin when using the CKPluginManager. + + @see CKPluginManager + */ + enum class CK_PLUGIN_TYPE : uint32_t { + CKPLUGIN_BITMAP_READER = 0, /**< The plugin is bitmap (textures,sprites) loader */ + CKPLUGIN_SOUND_READER = 1, /**< Sound Reader Plugin */ + CKPLUGIN_MODEL_READER = 2, /**< 3D Model Reader */ + CKPLUGIN_MANAGER_DLL = 3, /**< The plugin implements a Manager */ + CKPLUGIN_BEHAVIOR_DLL = 4, /**< The plugin implements one or more behaviors */ + CKPLUGIN_RENDERENGINE_DLL = 5, /**< Render Engine plugin */ + CKPLUGIN_MOVIE_READER = 6, /**< Movie (AVI,Mpeg) reader */ + CKPLUGIN_EXTENSION_DLL = 7, /**< Generic extension (definition of new parameter types or operations for ex.) */ + }; + /** + @remark CHUNK_OPTIONS in original Virtools header. + */ + enum class CK_STATECHUNK_CHUNKOPTIONS : uint32_t { + CHNK_OPTION_IDS = 0x01, /**< IDS are stored inside chunk */ + CHNK_OPTION_MAN = 0x02, /**< Managers ints are store inside chunk */ + CHNK_OPTION_CHN = 0x04, /**< Sub chunk are stored inside chunk */ + CHNK_OPTION_FILE = 0x08, /**< Chunk was written with indices relative to a file.... */ + CHNK_OPTION_ALLOWDYN = 0x10, /**< Dynamic object can be written in the chunk */ + CHNK_OPTION_LISTBIG = 0x20, /**< List are store in big Endian ? */ + CHNK_DONTDELETE_PTR = 0x40, /**< Data buffer stored in m_Buffer is not owned by CKStateChunk , it must not be deleted... */ + CHNK_DONTDELETE_PARSER = 0x80, /**< m_Parser Ptr is not owned by CKStateChunk , it must not be deleted... */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATECHUNK_CHUNKOPTIONS); + enum class CK_STATECHUNK_CHUNKVERSION : uint32_t { + CHUNK_VERSIONBASE = 0, + CHUNK_VERSION1 = 4, /**< equal to file version : WriteObjectID => table */ + CHUNK_VERSION2 = 5, /**< add Manager Data */ + CHUNK_VERSION3 = 6, /**< New ConvertToBuffer / ReadFromBuffer (file system changed to reflect this ) */ + CHUNK_VERSION4 = 7, /**< New WriteObjectID when saving to a file */ + }; + enum class CK_STATECHUNK_DATAVERSION : uint32_t { + CHUNKDATA_OLDVERSION = 0, /**< Before any version was saved */ + CHUNKDATA_BASEVERSION = 1, /**< First version */ + CHUNK_WAVESOUND_VERSION2 = 2, /**< Changes in wavesound format */ + CHUNK_WAVESOUND_VERSION3 = 3, /**< Changes in wavesound format */ + CHUNK_MATERIAL_VERSION_ZTEST = 4, /**< Change in material save format */ + CHUNK_MAJORCHANGE_VERSION = 5, /**< Optimisations on many save functions */ + CHUNK_MACCHANGE_VERSION = 6, /**< Misc new Statechunk functions for macintosh (Big-Endian <-> Little Endian conversion ) */ + CHUNK_WAVESOUND_VERSION4 = 7, /**< Changes in wavesound format (Added sound length) */ + CHUNK_SCENECHANGE_VERSION = 8, /**< Changes in sceneObjectDesc format (Remove lasttimevalue) */ + CHUNK_MESHCHANGE_VERSION = 9, /**< Changes in Mesh save format (primitives) */ + CHUNK_DEV_2_1 = 10, /**< Changes in wavesound reading of inside, outside angles */ + CHUNKDATA_CURRENTVERSION = CHUNK_DEV_2_1, + }; + /** + CKObject Flags + @remark + + Flags specifying special settings for basic objects. + + Some of this flags are shared with sub-classes such as CKParameterIn,CKParameterOut and CKBehaviorIO. + + You rarely need to modify directly this flags through CKObject::SetFlags or CKObject::ModifyObjectFlags instead + you should always use the specific acces function (given between ()) which may need to perform additionnal operations. + See also: CKObject, CKObject::GetObjectFlags, CKObject::ModifyObjectFlags + */ + enum class CK_OBJECT_FLAGS : uint32_t { + CK_OBJECT_INTERFACEOBJ = 0x00000001, /**< Reserved for Inteface Use */ + CK_OBJECT_PRIVATE = 0x00000002, /**< The object must not be displayed in interface (Lists,Level view,etc...),nor should it be saved. (CKObject::IsPrivate() */ + CK_OBJECT_INTERFACEMARK = 0x00000004, + CK_OBJECT_FREEID = 0x00000008, /**< ID of this object can be released safely and is free to be reused by future CKobjects. */ + CK_OBJECT_TOBEDELETED = 0x00000010, /**< This object is being deleted */ + CK_OBJECT_NOTTOBESAVED = 0x00000020, /**< This object must not be saved */ + CK_OBJECT_VISIBLE = 0x00000040, /**< This object is visible (CKObject::Show) */ + CK_OBJECT_NAMESHARED = 0x00000080, /**< This object has its name from another entity */ + CK_OBJECT_DYNAMIC = 0x00000108, /**< This object may be created or deleted at run-time, it also contails CK_OBJECT_FREEID. (CKObject::IsDynamic,CKContext::CreateObject) */ + CK_OBJECT_HIERACHICALHIDE = 0x00000200, /**< This object hides all its hierarchy (CKObject::Show) */ + CK_OBJECT_UPTODATE = 0x00000400, /**< (Camera,etc..) */ + CK_OBJECT_TEMPMARKER = 0x00000800, + CK_OBJECT_ONLYFORFILEREFERENCE = 0x00001000, + CK_OBJECT_NOTTOBEDELETED = 0x00002000, /**< This object must not be deleted in a clear all */ + CK_OBJECT_APPDATA = 0x00004000, /**< This object has app data */ + CK_OBJECT_SINGLEACTIVITY = 0x00008000, /**< this object has an information of single activity */ + CK_OBJECT_LOADSKIPBEOBJECT = 0x00010000, /**< When loading this object the CKBeObject part should be skipped */ + CK_OBJECT_NOTTOBELISTEDANDSAVED = 0x00000023, /**< Combination of Private and Not To Be Saved The following flags are specific to parameters (they are stored here for object's size purposes ) */ + CK_PARAMETEROUT_SETTINGS = 0x00400000, + CK_PARAMETEROUT_PARAMOP = 0x00800000, /**< This parameter is the output of a CKParameterOperation (Automatically set by Engine) */ + CK_PARAMETERIN_DISABLED = 0x01000000, /**< Parameter In or Out is disabled (CKBehavior::EnableInputParameter,CKBehavior::DisableInputParameter) */ + CK_PARAMETERIN_THIS = 0x02000000, /**< Special parameter type : its value and type are always equal to its owner (CKParameter::SetAsMyselfParameter) */ + CK_PARAMETERIN_SHARED = 0x04000000, + CK_PARAMETEROUT_DELETEAFTERUSE = 0x08000000, /**< When adding parameters to CKMessage, they can be automatically deleted when message is released (CKMessage::AddParameter) */ + CK_OBJECT_PARAMMASK = 0x0FC00000, /**< Mask for options specific to parameters The Following flags are specific for Behavior ios (CKBehaviorIO) */ + CK_BEHAVIORIO_IN = 0x10000000, /**< This BehaviorIO is a behavior input (CKBehaviorIO::SetType} */ + CK_BEHAVIORIO_OUT = 0x20000000, /**< This BehaviorIO is a behavior output (CKBehaviorIO::SetType) */ + CK_BEHAVIORIO_ACTIVE = 0x40000000, /**< This BehaviorIO is a currently active (CKBehaviorIO::Activate} */ + CK_OBJECT_IOTYPEMASK = 0x30000000, + CK_OBJECT_IOMASK = 0xF0000000, /**< The Following flags are specific for Behavior ios (CKBehaviorIO) */ + CKBEHAVIORLINK_RESERVED = 0x10000000, /**< This BehaviorIO is a behavior input (CKBehaviorIO::SetType} */ + CKBEHAVIORLINK_ACTIVATEDLASTFRAME = 0x20000000, /**< This link had been activated last frame */ + CK_OBJECT_BEHAVIORLINKMASK = 0x30000000, + }; + LIBCMO_BITFLAG_OPERATORS(CK_OBJECT_FLAGS); + +} diff --git a/LibCmo/CKFile.cpp b/LibCmo/CK2/CKFile.cpp similarity index 100% rename from LibCmo/CKFile.cpp rename to LibCmo/CK2/CKFile.cpp diff --git a/LibCmo/CKFile.hpp b/LibCmo/CK2/CKFile.hpp similarity index 100% rename from LibCmo/CKFile.hpp rename to LibCmo/CK2/CKFile.hpp diff --git a/LibCmo/CKFileReader.cpp b/LibCmo/CK2/CKFileReader.cpp similarity index 100% rename from LibCmo/CKFileReader.cpp rename to LibCmo/CK2/CKFileReader.cpp diff --git a/LibCmo/CKFileWriter.cpp b/LibCmo/CK2/CKFileWriter.cpp similarity index 100% rename from LibCmo/CKFileWriter.cpp rename to LibCmo/CK2/CKFileWriter.cpp diff --git a/LibCmo/CKGlobals.cpp b/LibCmo/CK2/CKGlobals.cpp similarity index 54% rename from LibCmo/CKGlobals.cpp rename to LibCmo/CK2/CKGlobals.cpp index 70bf288..10a34b6 100644 --- a/LibCmo/CKGlobals.cpp +++ b/LibCmo/CK2/CKGlobals.cpp @@ -4,15 +4,30 @@ #endif #include - #include "CKGlobals.hpp" #include namespace LibCmo::CK2 { + void* CKPackData(const void* Data, CKINT size, CKINT& NewSize, CKINT compressionlevel) { + uLong boundary = compressBound(static_cast(size)); + char* DestBuffer = new char[boundary]; + + uLongf _destLen = static_cast(boundary); + if (compress2( + reinterpret_cast(DestBuffer), &_destLen, + reinterpret_cast(Data), static_cast(size), + static_cast(compressionlevel)) != Z_OK) { + NewSize = 0; + delete[] DestBuffer; + return nullptr; + } + + NewSize = static_cast(_destLen); + return DestBuffer; + } void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize) { - char* DestBuffer = new(std::nothrow) char[DestSize]; - if (DestBuffer == nullptr) return nullptr; + char* DestBuffer = new char[DestSize]; uLongf cache = DestSize; if (uncompress( diff --git a/LibCmo/CK2/CKGlobals.hpp b/LibCmo/CK2/CKGlobals.hpp new file mode 100644 index 0000000..942dd75 --- /dev/null +++ b/LibCmo/CK2/CKGlobals.hpp @@ -0,0 +1,48 @@ +#pragma once + +#include "CKTypes.hpp" + +namespace LibCmo::CK2 { + + // ========== Compression utilities ========== + + /** + * @brief Compress a buffer + * @param[in] Data A pointer to the buffer to coompress + * @param[in] size Size of the source buffer. + * @param[out] NewSize A reference that will be filled with the size of the compressed buffer. 0 if failed. + * @param[in] compressionlevel 0-9 + * @return + * A pointer to the compressed buffer. nullptr if failed. + * The return pointer should be freed by `delete[]` manually. + * @remark + * The size of allocated return value may greater than the passed value of NewSize. + * NewSize only indicate the size of the part storing useful data in return value. + * @see CKUnPackData, CKComputeDataCRC + */ + void* CKPackData(const void* Data, CKINT size, CKINT& NewSize, CKINT compressionlevel); + /** + * @brief Decompress a buffer + * @param[in] DestSize Expected size of the decompressed buffer. + * @param[in] SrcBuffer Compressed buffer. + * @param[in] SrcSize Size of the compressed buffer. + * @return + * A pointer to the decompressed buffer or nullptr if there was a error. + * The return pointer should be freed by `delete[]` manually. + * @see CKPackData, CKComputeDataCRC + */ + void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize); + /** + * @brief Computes a CRC for a buffer. + * @param[in] data A pointer to the buffer to create a CRC for. + * @param[in] size Size of the source buffer. + * @param[in] PreviousCRC + * The first time a CRC is computed this value should be 0, + * but it can be use to compute a single CRC for a several buffers + * by using the currently computed CRC for previous buffers in this value. + * @return CRC of the buffer. + * @see CKPackData, CKUnPackData + */ + CKDWORD CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC = 0); + +} diff --git a/LibCmo/CK2/CKIdentifiers.hpp b/LibCmo/CK2/CKIdentifiers.hpp new file mode 100644 index 0000000..8fc245d --- /dev/null +++ b/LibCmo/CK2/CKIdentifiers.hpp @@ -0,0 +1,699 @@ +#pragma once + +// This file original name is Ckdefines2.hpp +// Change its name accoding to it use to + +#include "../VTUtils.hpp" +#include "CKTypes.hpp" +#include +#include + +namespace LibCmo::CK2 { + + constexpr const CKDWORD CK_STATESAVE_ALL = 0xFFFFFFFF; + + /** + Object + */ + enum class CK_STATESAVEFLAGS_OBJECT : uint32_t { + CK_STATESAVE_NAME = 0x00000001, /**< Obsolete */ + CK_STATESAVE_ID = 0x00000002, /**< Obsolete */ + CK_STATESAVE_OBJECTHIDDEN = 0x00000004, /**< The object is hidden */ + CK_STATESAVE_OBJECTHIERAHIDDEN = 0x00000018, /**< The object is hidden hierarchically */ + CK_STATESAVE_OBJECTALL = 0x0000000F, + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_OBJECT); + /** + Be Object + */ + enum class CK_STATESAVEFLAGS_BEOBJECT : uint32_t { + CK_STATESAVE_ATTRIBUTES = 0x00000010, /**< Obsolete */ + CK_STATESAVE_NEWATTRIBUTES = 0x00000011, /**< Save Attributes */ + CK_STATESAVE_GROUPS = 0x00000020, /**< Obsolete */ + CK_STATESAVE_DATAS = 0x00000040, /**< Save Flags and (Waiting for message) status */ + CK_STATESAVE_SOUNDS = 0x00000080, /**< Obsolete */ + CK_STATESAVE_BEHAVIORS = 0x00000100, /**< Obsolete */ + CK_STATESAVE_PARAMETERS = 0x00000200, /**< Obsolete */ + CK_STATESAVE_SINGLEACTIVITY = 0x00000400, /**< SINGLE ACTIVITY */ + CK_STATESAVE_SCRIPTS = 0x00000800, /**< Obsolete */ + CK_STATESAVE_BEOBJECTONLY = 0x00000FF0, /**< Save only BeObject specific datas */ + CK_STATESAVE_BEOBJECTALL = 0x00000FFF, /**< Save All datas */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_BEOBJECT); + /** + 3dEntity + */ + enum class CK_STATESAVEFLAGS_3DENTITY : uint32_t { + CK_STATESAVE_3DENTITYSKINDATANORMALS = 0x00001000, /**< Save Skin normals */ + CK_STATESAVE_ANIMATION = 0x00002000, /**< Obsolete */ + CK_STATESAVE_MESHS = 0x00004000, /**< Save List of mesh */ + CK_STATESAVE_PARENT = 0x00008000, /**< Save Parent */ + CK_STATESAVE_3DENTITYFLAGS = 0x00010000, /**< Save Flags */ + CK_STATESAVE_3DENTITYMATRIX = 0x00020000, /**< Save Position/orientation/Scale */ + CK_STATESAVE_3DENTITYHIERARCHY = 0x00040000, /**< obsolete */ + CK_STATESAVE_3DENTITYPLACE = 0x00080000, /**< Save Place in which the Entity is referenced */ + CK_STATESAVE_3DENTITYNDATA = 0x00100000, /**< Reserved for future use */ + CK_STATESAVE_3DENTITYSKINDATA = 0x00200000, /**< Save Skin data */ + CK_STATESAVE_3DENTITYONLY = 0x003FF000, /**< Save only 3dEntity specific datas */ + CK_STATESAVE_3DENTITYALL = 0x003FFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_3DENTITY); + /** + Light + */ + enum class CK_STATESAVEFLAGS_LIGHT : uint32_t { + CK_STATESAVE_LIGHTDATA = 0x00400000, /**< Save Color,Type,Attenuation,Range and cone */ + CK_STATESAVE_LIGHTDATA2 = 0x00800000, /**< Reserved for future use */ + CK_STATESAVE_LIGHTRESERVED1 = 0x01000000, /**< Reserved for future use */ + CK_STATESAVE_LIGHTRESERVED2 = 0x02000000, /**< Reserved for future use */ + CK_STATESAVE_LIGHTRESERVED3 = 0x04000000, /**< Reserved for future use */ + CK_STATESAVE_LIGHTRESERVED4 = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_LIGHTONLY = 0x0FC00000, /**< Save only Light specific datas */ + CK_STATESAVE_LIGHTALL = 0x0FFFFFFF, /**< Save All datas for sub-classes Target Light */ + CK_STATESAVE_TLIGHTTARGET = 0x80000000, /**< Save Light Target */ + CK_STATESAVE_TLIGHTRESERVED0 = 0x10000000, /**< Reserved for future use */ + CK_STATESAVE_TLIGHTRESERVED1 = 0x20000000, /**< Reserved for future use */ + CK_STATESAVE_TLIGHTRESERVED2 = 0x40000000, /**< Reserved for future use */ + CK_STATESAVE_TLIGHTONLY = 0xF0000000, /**< Save only Target Light specific datas */ + CK_STATESAVE_TLIGHTALL = 0xFFFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_LIGHT); + /** + Camera + */ + enum class CK_STATESAVEFLAGS_CAMERA : uint32_t { + CK_STATESAVE_CAMERAFOV = 0x00400000, /**< Save Camera Field of View */ + CK_STATESAVE_CAMERAPROJTYPE = 0x00800000, /**< Save Camera projection type */ + CK_STATESAVE_CAMERAOTHOZOOM = 0x01000000, /**< Save Camera orhographic zoom */ + CK_STATESAVE_CAMERAASPECT = 0x02000000, /**< Save Camera aspect ration */ + CK_STATESAVE_CAMERAPLANES = 0x04000000, /**< Save Camera near and far clip planes */ + CK_STATESAVE_CAMERARESERVED2 = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_CAMERAONLY = 0x0FC00000, /**< Save only camera specific datas */ + CK_STATESAVE_CAMERAALL = 0x0FFFFFFF, /**< Save All datas for sub-classes Target Camera */ + CK_STATESAVE_TCAMERATARGET = 0x10000000, /**< Save camera Target */ + CK_STATESAVE_TCAMERARESERVED1 = 0x20000000, /**< Reserved for future use */ + CK_STATESAVE_TCAMERARESERVED2 = 0x40000000, /**< Reserved for future use */ + CK_STATESAVE_TCAMERAONLY = 0x70000000, /**< Save only Target camera specific datas */ + CK_STATESAVE_TCAMERAALL = 0x7FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_CAMERA); + /** + Sprite3D + */ + enum class CK_STATESAVEFLAGS_SPRITE3D : uint32_t { + CK_STATESAVE_SPRITE3DDATA = 0x00400000, /**< Save offset,mapping,size and material */ + CK_STATESAVE_SPRITE3DRESERVED0 = 0x00800000, /**< Reserved for future use */ + CK_STATESAVE_SPRITE3DRESERVED1 = 0x01000000, /**< Reserved for future use */ + CK_STATESAVE_SPRITE3DRESERVED2 = 0x02000000, /**< Reserved for future use */ + CK_STATESAVE_SPRITE3DRESERVED3 = 0x04000000, /**< Reserved for future use */ + CK_STATESAVE_SPRITE3DRESERVED4 = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_SPRITE3DONLY = 0x0FC00000, /**< Save only Sprite3D specific datas */ + CK_STATESAVE_SPRITE3DALL = 0x0FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_SPRITE3D); + /** + Object 3D + */ + enum class CK_STATESAVEFLAGS_3DOBJECT : uint32_t { + CK_STATESAVE_3DOBJECTATTRIBUTES = 0x00400000, /**< Obsolete */ + CK_STATESAVE_3DOBJECTRESERVED = 0x00800000, /**< Reserved for future use */ + CK_STATESAVE_3DOBJECTRONLY = 0x00C00000, /**< Save only 3dObject specific datas */ + CK_STATESAVE_3DOBJECTALL = 0x03FFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_3DOBJECT); + /** + BodyPart + */ + enum class CK_STATESAVEFLAGS_BODYPART : uint32_t { + CK_STATESAVE_BODYPARTROTJOINT = 0x01000000, /**< Save rotation joint data */ + CK_STATESAVE_BODYPARTPOSJOINT = 0x02000000, /**< Save position joint data */ + CK_STATESAVE_BODYPARTCHARACTER = 0x04000000, /**< Save character owning this bodypart */ + CK_STATESAVE_BODYPARTRESERVED1 = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_BODYPARTRESERVED2 = 0x10000000, /**< Reserved for future use */ + CK_STATESAVE_BODYPARTRESERVED3 = 0x20000000, /**< Reserved for future use */ + CK_STATESAVE_BODYPARTRESERVED4 = 0x40000000, /**< Reserved for future use */ + CK_STATESAVE_BODYPARTONLY = 0x7F000000, /**< Save only bodypart specific datas */ + CK_STATESAVE_BODYPARTALL = 0x7FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_BODYPART); + /** + Character + */ + enum class CK_STATESAVEFLAGS_CHARACTER : uint32_t { + CK_STATESAVE_CHARACTERBODYPARTS = 0x00400000, /**< Obsolete */ + CK_STATESAVE_CHARACTERKINECHAINS = 0x00800000, /**< Obsolete */ + CK_STATESAVE_CHARACTERANIMATIONS = 0x01000000, /**< Obsolete */ + CK_STATESAVE_CHARACTERROOT = 0x02000000, /**< Obsolete */ + CK_STATESAVE_CHARACTERSAVEANIMS = 0x04000000, /**< Save current and next active animations */ + CK_STATESAVE_CHARACTERSAVECHAINS = 0x08000000, /**< Obsolete */ + CK_STATESAVE_CHARACTERSAVEPARTS = 0x10000000, /**< Save sub bodyparts and sub-bodyparts data (saved with flag :CK_STATESAVE_BODYPARTALL) */ + CK_STATESAVE_CHARACTERFLOORREF = 0x20000000, /**< Save Character floor reference object */ + CK_STATESAVE_CHARACTERRESERVED2 = 0x40000000, /**< Reserved for future use */ + CK_STATESAVE_CHARACTERRESERVED3 = 0x80000000, /**< Reserved for future use */ + CK_STATESAVE_CHARACTERONLY = 0xFFC00000, /**< Save only character specific datas */ + CK_STATESAVE_CHARACTERALL = 0xFFFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_CHARACTER); + /** + CURVE && Curve Point + */ + enum class CK_STATESAVEFLAGS_CURVE : uint32_t { + CK_STATESAVE_CURVEFITCOEFF = 0x00400000, /**< Save fitting coef */ + CK_STATESAVE_CURVECONTROLPOINT = 0x00800000, /**< Save list of control points */ + CK_STATESAVE_CURVESTEPS = 0x01000000, /**< Save number of step setting */ + CK_STATESAVE_CURVEOPEN = 0x02000000, /**< Save Open/Close flag */ + CK_STATESAVE_CURVERESERVED1 = 0x04000000, /**< Reserved for future use */ + CK_STATESAVE_CURVERESERVED2 = 0x08000000, /**< Reserved for future use Control points */ + CK_STATESAVE_CURVEPOINTDEFAULTDATA = 0x10000000, /**< Save Control point setting and position */ + CK_STATESAVE_CURVEPOINTTCB = 0x20000000, /**< Save Control point tcb settings */ + CK_STATESAVE_CURVEPOINTTANGENTS = 0x40000000, /**< Save Control point tangents */ + CK_STATESAVE_CURVEPOINTCURVEPOS = 0x80000000, /**< Save Control point position in curve */ + CK_STATESAVE_CURVESAVEPOINTS = 0xFF000000, /**< Save control points data */ + CK_STATESAVE_CURVEONLY = 0xFFC00000, /**< Save only curve specific data */ + CK_STATESAVE_CURVEALL = 0xFFFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_CURVE); + /** + 2dEntity + */ + enum class CK_STATESAVEFLAGS_2DENTITY : uint32_t { + CK_STATESAVE_2DENTITYSRCSIZE = 0x00001000, /**< Save source size */ + CK_STATESAVE_2DENTITYSIZE = 0x00002000, /**< Save size */ + CK_STATESAVE_2DENTITYFLAGS = 0x00004000, /**< Save Flags */ + CK_STATESAVE_2DENTITYPOS = 0x00008000, /**< Save position */ + CK_STATESAVE_2DENTITYZORDER = 0x00100000, /**< Save Z order */ + CK_STATESAVE_2DENTITYONLY = 0x0010F000, /**< Save only 2dEntity specific data */ + CK_STATESAVE_2DENTITYMATERIAL = 0x00200000, /**< Save Material */ + CK_STATESAVE_2DENTITYHIERARCHY = 0x00400000, /**< Save Material */ + CK_STATESAVE_2DENTITYALL = 0x0070FFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_2DENTITY); + /** + Sprite + */ + enum class CK_STATESAVEFLAGS_SPRITE : uint32_t { + CK_STATESAVE_SPRITECURRENTIMAGE = 0x00010000, /**< Save current image */ + CK_STATESAVE_SPRITETRANSPARENT = 0x00020000, /**< Save transparency settings */ + CK_STATESAVE_SPRITEBITMAPS = 0x00040000, /**< Obsolete */ + CK_STATESAVE_SPRITESHARED = 0x00080000, /**< Save shared sprite */ + CK_STATESAVE_SPRITEDONOTUSE = 0x00100000, /**< Reseved by CK_STATESAVEFLAGS_2DENTITY */ + CK_STATESAVE_SPRITEAVIFILENAME = 0x00200000, /**< Obsolete */ + CK_STATESAVE_SPRITEFILENAMES = 0x00400000, /**< Obsolete */ + CK_STATESAVE_SPRITECOMPRESSED = 0x00800000, /**< Obsolete */ + CK_STATESAVE_SPRITEREADER = 0x10000000, /**< Reserved for future use */ + CK_STATESAVE_SPRITEFORMAT = 0x20000000, /**< Reserved for future use */ + CK_STATESAVE_SPRITEVIDEOFORMAT = 0x40000000, /**< Video Format */ + CK_STATESAVE_SPRITESYSTEMCACHING = 0x80000000, /**< System Memory Caching */ + CK_STATESAVE_SPRITERENDEROPTIONS = 0x80800000, /**< Render options if any... */ + CK_STATESAVE_SPRITEONLY = 0xF0EF0000, /**< Save only sprite specific data */ + CK_STATESAVE_SPRITEALL = 0x70FFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_SPRITE); + /** + Sprite Text + */ + enum class CK_STATESAVEFLAGS_SPRITETEXT : uint32_t { + CK_STATESAVE_SPRITETEXT = 0x01000000, /**< Save text */ + CK_STATESAVE_SPRITEFONT = 0x02000000, /**< Save font settings */ + CK_STATESAVE_SPRITETEXTCOLOR = 0x04000000, /**< Save text color */ + CK_STATESAVE_SPRITETEXTRESERVED = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_SPRITETEXTDOTNOTUSE = 0x10000000, /**< Reserved by CK_STATESAVE_SPRITEREADER */ + CK_STATESAVE_SPRITETEXTDONOTUSED2 = 0x20000000, /**< Reserved by CK_STATESAVE_SPRITEFORMAT */ + CK_STATESAVE_SPRITETEXTONLY = 0x0F000000, /**< Save only SpriteText specific data */ + CK_STATESAVE_SPRITETEXTALL = 0x3FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_SPRITETEXT); + /** + Sound + */ + enum class CK_STATESAVEFLAGS_SOUND : uint32_t { + CK_STATESAVE_SOUNDFILENAME = 0x00001000, /**< Reserved for future use */ + CK_STATESAVE_SOUNDRESERVED1 = 0x00002000, /**< Reserved for future use */ + CK_STATESAVE_SOUNDRESERVED2 = 0x00004000, /**< Reserved for future use */ + CK_STATESAVE_SOUNDRESERVED3 = 0x00008000, /**< Reserved for future use */ + CK_STATESAVE_SOUNDRESERVED4 = 0x00010000, /**< Reserved for future use */ + CK_STATESAVE_SOUNDRESERVED5 = 0x00020000, /**< Reserved for future use */ + CK_STATESAVE_SOUNDRESERVED6 = 0x00040000, /**< Reserved for future use */ + CK_STATESAVE_SOUNDRESERVED7 = 0x00080000, /**< Reserved for future use */ + CK_STATESAVE_SOUNDONLY = 0x000FF000, /**< Save only Sound specific data */ + CK_STATESAVE_SOUNDALL = 0x000FFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_SOUND); + /** + Wave Sound + */ + enum class CK_STATESAVEFLAGS_WAVSOUND : uint32_t { + CK_STATESAVE_WAVSOUNDFILE = 0x00100000, /**< Save sound filename */ + CK_STATESAVE_WAVSOUNDDATA = 0x00200000, /**< Obsolete */ + CK_STATESAVE_WAVSOUNDDATA2 = 0x00400000, /**< Save sound properties (3D/2D,pitch,gain,streaming,loop,etc..) */ + CK_STATESAVE_WAVSOUNDDURATION = 0x00800000, /**< Sound Length (in case it cannot be calculated latter) */ + CK_STATESAVE_WAVSOUNDRESERVED4 = 0x01000000, /**< Reserved for future use */ + CK_STATESAVE_WAVSOUNDRESERVED5 = 0x02000000, /**< Reserved for future use */ + CK_STATESAVE_WAVSOUNDRESERVED6 = 0x04000000, /**< Reserved for future use */ + CK_STATESAVE_WAVSOUNDRESERVED7 = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_WAVSOUNDONLY = 0x0FF00000, /**< Save All datas for sub-classes */ + CK_STATESAVE_WAVSOUNDALL = 0x0FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_WAVSOUND); + /** + Wave Sound + */ + enum class CK_STATESAVEFLAGS_MIDISOUND : uint32_t { + CK_STATESAVE_MIDISOUNDFILE = 0x00100000, /**< Save sound filename */ + CK_STATESAVE_MIDISOUNDDATA = 0x00200000, /**< Save midi data */ + CK_STATESAVE_MIDISOUNDRESERVED2 = 0x00400000, /**< Reserved for future use */ + CK_STATESAVE_MIDISOUNDRESERVED3 = 0x00800000, /**< Reserved for future use */ + CK_STATESAVE_MIDISOUNDRESERVED4 = 0x01000000, /**< Reserved for future use */ + CK_STATESAVE_MIDISOUNDRESERVED5 = 0x02000000, /**< Reserved for future use */ + CK_STATESAVE_MIDISOUNDRESERVED6 = 0x04000000, /**< Reserved for future use */ + CK_STATESAVE_MIDISOUNDRESERVED7 = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_MIDISOUNDONLY = 0x0FF00000, + CK_STATESAVE_MIDISOUNDALL = 0x0FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_MIDISOUND); + /** + Place + */ + enum class CK_STATESAVEFLAGS_PLACE : uint32_t { + CK_STATESAVE_PLACEPORTALS = 0x00001000, /**< Save level using the place */ + CK_STATESAVE_PLACECAMERA = 0x00002000, /**< Save attached camera */ + CK_STATESAVE_PLACEREFERENCES = 0x00004000, /**< Save list of objects in the place */ + CK_STATESAVE_PLACELEVEL = 0x00008000, /**< Save level using the place */ + CK_STATESAVE_PLACEALL = 0x0000FFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_PLACE); + /** + Level CKSaveObjectState will not save any data + */ + enum class CK_STATESAVEFLAGS_LEVEL : uint32_t { + CK_STATESAVE_LEVELRESERVED0 = 0x00001000, /**< Reserved for future use */ + CK_STATESAVE_LEVELINACTIVEMAN = 0x00002000, /**< Reserved for future use */ + CK_STATESAVE_LEVELDUPLICATEMAN = 0x00004000, /**< Reserved for future use */ + CK_STATESAVE_LEVELDEFAULTDATA = 0x20000000, /**< Save Places,Scenes and Objects */ + CK_STATESAVE_LEVELSCENE = 0x80000000, /**< Default and active scene */ + CK_STATESAVE_LEVELALL = 0xFFFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_LEVEL); + /** + GROUP + */ + enum class CK_STATESAVEFLAGS_GROUP : uint32_t { + CK_STATESAVE_GROUPDATA = 0x00001000, /**< Save list of objects in the group */ + CK_STATESAVE_GROUPRESERVED1 = 0x00002000, /**< Reserved for future use */ + CK_STATESAVE_GROUPRESERVED2 = 0x00004000, /**< Reserved for future use */ + CK_STATESAVE_GROUPRESERVED3 = 0x00008000, /**< Reserved for future use */ + CK_STATESAVE_GROUPRESERVED4 = 0x00010000, /**< Reserved for future use */ + CK_STATESAVE_GROUPRESERVED5 = 0x00020000, /**< Reserved for future use */ + CK_STATESAVE_GROUPRESERVED6 = 0x00040000, /**< Reserved for future use */ + CK_STATESAVE_GROUPRESERVED7 = 0x00080000, /**< Reserved for future use */ + CK_STATESAVE_GROUPALL = 0x000FFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_GROUP); + /** + MESH CKSaveOjectSave will save all data and does not take flags into account + */ + enum class CK_STATESAVEFLAGS_MESH : uint32_t { + CK_STATESAVE_MESHRESERVED0 = 0x00001000, /**< Reserved for future use */ + CK_STATESAVE_MESHFLAGS = 0x00002000, /**< Save flags */ + CK_STATESAVE_MESHCHANNELS = 0x00004000, /**< Save Channels */ + CK_STATESAVE_MESHFACECHANMASK = 0x00008000, /**< Save face channel Mask */ + CK_STATESAVE_MESHFACES = 0x00010000, /**< Save face data */ + CK_STATESAVE_MESHVERTICES = 0x00020000, /**< Save geometry */ + CK_STATESAVE_MESHLINES = 0x00040000, /**< Save line data */ + CK_STATESAVE_MESHWEIGHTS = 0x00080000, /**< Save Vertex Weight info */ + CK_STATESAVE_MESHMATERIALS = 0x00100000, /**< Reserved for future use */ + CK_STATESAVE_MESHRESERVED1 = 0x00200000, /**< Reserved for future use */ + CK_STATESAVE_MESHRESERVED2 = 0x00400000, /**< Reserved for future use */ + CK_STATESAVE_PROGRESSIVEMESH = 0x00800000, /**< Save All datas for sub-classes */ + CK_STATESAVE_MESHONLY = 0x00FFF000, /**< Save All datas for sub-classes */ + CK_STATESAVE_MESHALL = 0x00FFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_MESH); + /** + PATCH MESH CKSaveOjectSave will save all data and does not take flags into account + */ + enum class CK_STATESAVEFLAGS_PATCHMESH : uint32_t { + CK_STATESAVE_PATCHMESHDATA = 0x00800000, /**< Obsolete */ + CK_STATESAVE_PATCHMESHDATA2 = 0x01000000, /**< Obsolete */ + CK_STATESAVE_PATCHMESHSMOOTH = 0x02000000, /**< Obsolete */ + CK_STATESAVE_PATCHMESHMATERIALS = 0x04000000, /**< Obsolete */ + CK_STATESAVE_PATCHMESHDATA3 = 0x08000000, /**< Save Patch Data */ + CK_STATESAVE_PATCHMESHONLY = 0x0FF00000, /**< Save All datas for sub-classes */ + CK_STATESAVE_PATCHMESHALL = 0x0FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_PATCHMESH); + /** + Material + */ + enum class CK_STATESAVEFLAGS_MATERIAL : uint32_t { + CK_STATESAVE_MATDATA = 0x00001000, /**< Save colors,blending modes,shade modes,fill modes etc... */ + CK_STATESAVE_MATDATA2 = 0x00002000, /**< Additional texture objects... */ + CK_STATESAVE_MATDATA3 = 0x00004000, /**< Effect Alone */ + CK_STATESAVE_MATDATA4 = 0x00008000, /**< none */ + CK_STATESAVE_MATDATA5 = 0x00010000, /**< Effect + parameter */ + CK_STATESAVE_MATRESERVED5 = 0x00020000, /**< Reserved for future use */ + CK_STATESAVE_MATRESERVED6 = 0x00040000, /**< Reserved for future use */ + CK_STATESAVE_MATRESERVED7 = 0x00080000, /**< Reserved for future use */ + CK_STATESAVE_MATERIALONLY = 0x000FF000, /**< Save All datas for sub-classes */ + CK_STATESAVE_MATERIALALL = 0x0FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_MATERIAL); + /** + Texture CKSaveOjectSave will save all relevant data and does not take flags into account + */ + enum class CK_STATESAVEFLAGS_TEXTURE : uint32_t { + CK_STATESAVE_TEXAVIFILENAME = 0x00001000, /**< Save movie file name */ + CK_STATESAVE_TEXCURRENTIMAGE = 0x00002000, /**< Save current slot */ + CK_STATESAVE_TEXBITMAPS = 0x00004000, /**< Obsolete */ + CK_STATESAVE_TEXTRANSPARENT = 0x00008000, /**< Save transparency data */ + CK_STATESAVE_TEXFILENAMES = 0x00010000, /**< Save texture slot filenames */ + CK_STATESAVE_TEXCOMPRESSED = 0x00020000, /**< Save raw texture data */ + CK_STATESAVE_TEXVIDEOFORMAT = 0x00040000, /**< Save chosen video format */ + CK_STATESAVE_TEXSAVEFORMAT = 0x00080000, /**< Save chosen save format */ + CK_STATESAVE_TEXREADER = 0x00100000, /**< Save texture data using a specific BitmapReader */ + CK_STATESAVE_PICKTHRESHOLD = 0x00200000, /**< Save pick threshold */ + CK_STATESAVE_USERMIPMAP = 0x00400000, /**< User mipmap levels */ + CK_STATESAVE_TEXSYSTEMCACHING = 0x00800000, /**< System Memory Caching */ + CK_STATESAVE_OLDTEXONLY = 0x002FF000, /**< Kept for compatibility */ + CK_STATESAVE_TEXONLY = 0x00FFF000, /**< Save Only Texture Data (Dot NOT MODIFY ! Texture loading/saving relies on this value) */ + CK_STATESAVE_TEXALL = 0x002FFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_TEXTURE); + /** + 2d CURVE && 2d Curve Point + */ + enum class CK_STATESAVEFLAGS_2DCURVE : uint32_t { + CK_STATESAVE_2DCURVERESERVED0 = 0x00000010, /**< Reserved for future use */ + CK_STATESAVE_2DCURVERESERVED4 = 0x00000020, /**< Reserved for future use */ + CK_STATESAVE_2DCURVEFITCOEFF = 0x00000040, /**< Obsolete */ + CK_STATESAVE_2DCURVECONTROLPOINT = 0x00000080, /**< Obsolete */ + CK_STATESAVE_2DCURVENEWDATA = 0x00000100, /**< Save All relevant data */ + CK_STATESAVE_2DCURVERESERVED2 = 0x00000200, /**< Obsolete */ + CK_STATESAVE_2DCURVERESERVED3 = 0x00000400, /**< Obsolete */ + CK_STATESAVE_2DCURVEPOINTTCB = 0x00000800, /**< Obsolete */ + CK_STATESAVE_2DCURVEPOINTTANGENTS = 0x00001000, /**< Obsolete */ + CK_STATESAVE_2DCURVEPOINT2DCURVEPOS = 0x00002000, /**< Obsolete */ + CK_STATESAVE_2DCURVEPOINTDEFAULTDATA = 0x00004000, /**< Obsolete */ + CK_STATESAVE_2DCURVEPOINTNEWDATA = 0x00008000, /**< Save All relevant data */ + CK_STATESAVE_2DCURVEPOINTRESERVED1 = 0x00010000, /**< Reserved for future use */ + CK_STATESAVE_2DCURVEPOINTRESERVED2 = 0x00020000, /**< Reserved for future use */ + CK_STATESAVE_2DCURVESAVEPOINTS = 0x0003F800, /**< Obsolete */ + CK_STATESAVE_2DCURVEALL = 0x0007FFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_2DCURVE); + /** + Kinematic Chain + */ + enum class CK_STATESAVEFLAGS_KINEMATICCHAIN : uint32_t { + CK_STATESAVE_KINEMATICCHAINDATA = 0x00000010, /**< Save chain data */ + CK_STATESAVE_KINEMATICCHAINRESERVED1 = 0x00000020, /**< Reserved for future use */ + CK_STATESAVE_KINEMATICCHAINRESERVED2 = 0x00000040, /**< Reserved for future use */ + CK_STATESAVE_KINEMATICCHAINRESERVED3 = 0x00000080, /**< Reserved for future use */ + CK_STATESAVE_KINEMATICCHAINALL = 0x000000FF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_KINEMATICCHAIN); + /** + Animation + */ + enum class CK_STATESAVEFLAGS_ANIMATION : uint32_t { + CK_STATESAVE_ANIMATIONDATA = 0x00000010, /**< Save Flags & Framerate data */ + CK_STATESAVE_ANIMATIONRESERVED1 = 0x00000020, /**< Reserved for future use */ + CK_STATESAVE_ANIMATIONLENGTH = 0x00000040, /**< Save animation Length */ + CK_STATESAVE_ANIMATIONBODYPARTS = 0x00000080, /**< Save root & list of bodypart */ + CK_STATESAVE_ANIMATIONCHARACTER = 0x00000100, /**< Save character */ + CK_STATESAVE_ANIMATIONCURRENTSTEP = 0x00000200, /**< Save current step */ + CK_STATESAVE_ANIMATIONRESERVED5 = 0x00000400, /**< Reserved for future use */ + CK_STATESAVE_ANIMATIONRESERVED6 = 0x00000800, /**< Reserved for future use */ + CK_STATESAVE_ANIMATIONALL = 0x0FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_ANIMATION); + /** + Keyed Anim + */ + enum class CK_STATESAVEFLAGS_KEYEDANIMATION : uint32_t { + CK_STATESAVE_KEYEDANIMANIMLIST = 0x00001000, /**< Save list of object animations */ + CK_STATESAVE_KEYEDANIMLENGTH = 0x00002000, /**< Obsolete */ + CK_STATESAVE_KEYEDANIMPOSKEYS = 0x00004000, /**< Obsolete */ + CK_STATESAVE_KEYEDANIMROTKEYS = 0x00008000, /**< Obsolete */ + CK_STATESAVE_KEYEDANIMMORPHKEYS = 0x00010000, /**< Obsolete */ + CK_STATESAVE_KEYEDANIMSCLKEYS = 0x00020000, /**< Obsolete */ + CK_STATESAVE_KEYEDANIMFLAGS = 0x00040000, /**< Obsolete */ + CK_STATESAVE_KEYEDANIMENTITY = 0x00080000, /**< Obsolete */ + CK_STATESAVE_KEYEDANIMMERGE = 0x00100000, /**< Save merged animations */ + CK_STATESAVE_KEYEDANIMSUBANIMS = 0x00200000, /**< Save object animations data (using same flags than CKSaveObjectState) */ + CK_STATESAVE_KEYEDANIMRESERVED0 = 0x00400000, /**< Reserved for future use */ + CK_STATESAVE_KEYEDANIMRESERVED1 = 0x00800000, /**< Reserved for future use */ + CK_STATESAVE_KEYEDANIMRESERVED2 = 0x01000000, /**< Reserved for future use */ + CK_STATESAVE_KEYEDANIMRESERVED3 = 0x02000000, /**< Reserved for future use */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_KEYEDANIMATION); + /** + Object Animation CKSaveOjectSave will save all relevant data and does not take flags into account + */ + enum class CK_STATESAVEFLAGS_OBJECTANIMATION : uint32_t { + CK_STATESAVE_OBJANIMNEWDATA = 0x00001000, /**< Save all relevant data */ + CK_STATESAVE_OBJANIMLENGTH = 0x00002000, /**< Not used */ + CK_STATESAVE_OBJANIMPOSKEYS = 0x00004000, /**< Not used */ + CK_STATESAVE_OBJANIMROTKEYS = 0x00008000, /**< Not used */ + CK_STATESAVE_OBJANIMMORPHKEYS = 0x00010000, /**< Not used */ + CK_STATESAVE_OBJANIMSCLKEYS = 0x00020000, /**< Not used */ + CK_STATESAVE_OBJANIMFLAGS = 0x00040000, /**< Not used */ + CK_STATESAVE_OBJANIMENTITY = 0x00080000, /**< Not used */ + CK_STATESAVE_OBJANIMMERGE = 0x00100000, /**< Not used */ + CK_STATESAVE_OBJANIMMORPHKEYS2 = 0x00200000, /**< Not used */ + CK_STATESAVE_OBJANIMNEWSAVE1 = 0x00400000, /**< Not used */ + CK_STATESAVE_OBJANIMMORPHNORMALS = 0x00800000, /**< Not used (Virtools 1.1) */ + CK_STATESAVE_OBJANIMMORPHCOMP = 0x01000000, /**< Not used (Virtools 1.1) */ + CK_STATESAVE_OBJANIMSHARED = 0x02000000, /**< Save Data for a shared animation */ + CK_STATESAVE_OBJANIMCONTROLLERS = 0x04000000, /**< (Virtools 1.5) Save All Controller information */ + CK_STATESAVE_OBJANIMONLY = 0x07FFF000, + CK_STATESAVE_OBJANIMALL = 0x07FFFFFF, + CK_STATESAVE_KEYEDANIMONLY = 0x03FFF000, /**< Save All datas for sub-classes */ + CK_STATESAVE_KEYEDANIMALL = 0x03FFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_OBJECTANIMATION); + /** + IK Animation + */ + enum class CK_STATESAVEFLAGS_IKANIMATION : uint32_t { + CK_STATESAVE_IKANIMATIONDATA = 0x00001000, /**< Save IK data */ + CK_STATESAVE_IKANIMATIONRESERVED2 = 0x00002000, /**< Reserved for future use */ + CK_STATESAVE_IKANIMATIONRESERVED3 = 0x00004000, /**< Reserved for future use */ + CK_STATESAVE_IKANIMATIONRESERVED4 = 0x00008000, /**< Reserved for future use */ + CK_STATESAVE_IKANIMATIONRESERVED5 = 0x00010000, /**< Reserved for future use */ + CK_STATESAVE_IKANIMATIONRESERVED6 = 0x00020000, /**< Reserved for future use */ + CK_STATESAVE_IKANIMATIONRESERVED7 = 0x00040000, /**< Reserved for future use */ + CK_STATESAVE_IKANIMATIONRESERVED8 = 0x00100000, /**< Reserved for future use */ + CK_STATESAVE_IKANIMATIONRESERVED9 = 0x00200000, /**< Reserved for future use */ + CK_STATESAVE_IKANIMATIONALL = 0x003FFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_IKANIMATION); + /** + BehaviorLink + */ + enum class CK_STATESAVEFLAGS_BEHAV_LINK : uint32_t { + CK_STATESAVE_BEHAV_LINK_CURDELAY = 0x00000004, /**< Obsolete */ + CK_STATESAVE_BEHAV_LINK_IOS = 0x00000008, /**< Obsolete */ + CK_STATESAVE_BEHAV_LINK_DELAY = 0x00000010, /**< Obsolete */ + CK_STATESAVE_BEHAV_LINK_NEWDATA = 0x00000020, /**< Save all relevant data (In,Out,Activation delay) */ + CK_STATESAVE_BEHAV_LINKRESERVED5 = 0x00000040, /**< Reserved for future use */ + CK_STATESAVE_BEHAV_LINKRESERVED6 = 0x00000080, /**< Reserved for future use */ + CK_STATESAVE_BEHAV_LINKONLY = 0x000000F0, /**< */ + CK_STATESAVE_BEHAV_LINKALL = 0x000000FF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_BEHAV_LINK); + /** + BehaviorIO + */ + enum class CK_STATESAVEFLAGS_BEHAV_IO : uint32_t { + CK_STATESAVE_BEHAV_IOFLAGS = 0x00000008, /**< Save IO flags */ + CK_STATESAVE_BEHAV_IORESERVED3 = 0x00000010, /**< Reserved for future use */ + CK_STATESAVE_BEHAV_IORESERVED4 = 0x00000020, /**< Reserved for future use */ + CK_STATESAVE_BEHAV_IORESERVED5 = 0x00000040, /**< Reserved for future use */ + CK_STATESAVE_BEHAV_IORESERVED6 = 0x00000080, /**< Reserved for future use */ + CK_STATESAVE_BEHAVIOONLY = 0x000000F0, /**< */ + CK_STATESAVE_BEHAVIOALL = 0x000000FF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_BEHAV_IO); + /** + BehaviorPrototype + */ + enum class CK_STATESAVEFLAGS_PROTOTYPE : uint32_t { + CK_STATESAVE_PROTORESERVED0 = 0x00000010, /**< Reserved for future use */ + CK_STATESAVE_PROTORESERVED1 = 0x00000020, /**< Reserved for future use */ + CK_STATESAVE_PROTOFLAGS = 0x00000040, /**< Save Flags */ + CK_STATESAVE_PROTOSUBPROTOS = 0x00000080, /**< Save sub prototypes */ + CK_STATESAVE_PROTOLINKS = 0x00000100, /**< Save links */ + CK_STATESAVE_PROTOBEHAVFLAG = 0x00000200, /**< Save behavior flags */ + CK_STATESAVE_PROTOGUID = 0x00000400, /**< Save GUID */ + CK_STATESAVE_PROTOINPUTS = 0x00000800, /**< Save inputs */ + CK_STATESAVE_PROTOOUTPUTS = 0x00001000, /**< Save outputs */ + CK_STATESAVE_PROTOINPARAMS = 0x00002000, /**< Save input parameters */ + CK_STATESAVE_PROTOOUTPARAMS = 0x00004000, /**< Save output parameters */ + CK_STATESAVE_PROTOLOCALPARAMS = 0x00008000, /**< Save local parameters */ + CK_STATESAVE_PROTOOPERATIONS = 0x00010000, /**< Save parameter operations */ + CK_STATESAVE_PROTOPARAMETERLINKS = 0x00020000, /**< Save parameter links */ + CK_STATESAVE_PROTOAPPLYTO = 0x00040000, /**< Save ClassID of object to which it applies */ + CK_STATESAVE_PROTORESERVED14 = 0x00080000, /**< Reserved for future use */ + CK_STATESAVE_PROTOALL = 0x000FFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_PROTOTYPE); + /** + Behavior + */ + enum class CK_STATESAVEFLAGS_BEHAVIOR : uint32_t { + CK_STATESAVE_BEHAVIORRESERVED0 = 0x00000010, /**< Reserved for internal use */ + CK_STATESAVE_BEHAVIORNEWDATA = 0x00000020, /**< not used */ + CK_STATESAVE_BEHAVIORFLAGS = 0x00000040, /**< not used */ + CK_STATESAVE_BEHAVIORCOMPATIBLECID = 0x00000080, /**< not used */ + CK_STATESAVE_BEHAVIORSUBBEHAV = 0x00000100, /**< Save Sub-Behaviors */ + CK_STATESAVE_BEHAVIORINPARAMS = 0x00000200, /**< not used */ + CK_STATESAVE_BEHAVIOROUTPARAMS = 0x00000400, /**< not used */ + CK_STATESAVE_BEHAVIORINPUTS = 0x00000800, /**< not used */ + CK_STATESAVE_BEHAVIOROUTPUTS = 0x00001000, /**< not used */ + CK_STATESAVE_BEHAVIORINFO = 0x00002000, /**< not used */ + CK_STATESAVE_BEHAVIOROPERATIONS = 0x00004000, /**< not used */ + CK_STATESAVE_BEHAVIORTYPE = 0x00008000, /**< not used */ + CK_STATESAVE_BEHAVIOROWNER = 0x00010000, /**< not used */ + CK_STATESAVE_BEHAVIORLOCALPARAMS = 0x00020000, /**< Save local parameters */ + CK_STATESAVE_BEHAVIORPROTOGUID = 0x00040000, /**< not used */ + CK_STATESAVE_BEHAVIORSUBLINKS = 0x00080000, /**< not used */ + CK_STATESAVE_BEHAVIORACTIVESUBLINKS = 0x00100000, /**< not used */ + CK_STATESAVE_BEHAVIORSINGLEACTIVITY = 0x00200000, /**< SINGLE ACTIVITY */ + CK_STATESAVE_BEHAVIORSCRIPTDATA = 0x00400000, /**< not used */ + CK_STATESAVE_BEHAVIORPRIORITY = 0x00800000, /**< not used */ + CK_STATESAVE_BEHAVIORTARGET = 0x01000000, /**< not used */ + CK_STATESAVE_BEHAVIORONLY = 0x01FFFFF0, + CK_STATESAVE_BEHAVIORALL = 0x01FFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_BEHAVIOR); + /** + SCENE CKSaveOjectSave will save all relevant data and does not take flags into account + */ + enum class CK_STATESAVEFLAGS_SCENE : uint32_t { + CK_STATESAVE_SCENERESERVED0 = 0x00001000, /**< Reserved for future use */ + CK_STATESAVE_SCENERESERVED8 = 0x00002000, /**< Reserved for future use */ + CK_STATESAVE_SCENEFLAGS = 0x00004000, + CK_STATESAVE_SCENELEVEL = 0x00008000, + CK_STATESAVE_SCENEOBJECTS = 0x00010000, + CK_STATESAVE_SCENENEWDATA = 0x00020000, /**< every object description and initial conditions */ + CK_STATESAVE_SCENELAUNCHED = 0x00040000, /**< Scene was already launched once */ + CK_STATESAVE_SCENERENDERSETTINGS = 0x00080000, /**< Background Color, Fog Color etc.. */ + CK_STATESAVE_SCENERESERVED1 = 0x00100000, /**< Reserved for future use */ + CK_STATESAVE_SCENERESERVED2 = 0x00200000, /**< Reserved for future use */ + CK_STATESAVE_SCENERESERVED3 = 0x00400000, /**< Reserved for future use */ + CK_STATESAVE_SCENERESERVED4 = 0x00800000, /**< Reserved for future use */ + CK_STATESAVE_SCENERESERVED5 = 0x01000000, /**< Reserved for future use */ + CK_STATESAVE_SCENERESERVED12 = 0x02000000, /**< Reserved for future use */ + CK_STATESAVE_SCENERESERVED13 = 0x04000000, /**< Reserved for future use */ + CK_STATESAVE_SCENERESERVED14 = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_SCENEALL = 0x0FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_SCENE); + /** + ParameterIn + */ + enum class CK_STATESAVEFLAGS_PARAMETERIN : uint32_t { + CK_STATESAVE_PARAMETERIN_RESERVED4 = 0x00000010, /**< Reserved for future use */ + CK_STATESAVE_PARAMETERIN_RESERVED0 = 0x00000020, /**< Reserved for future use */ + CK_STATESAVE_PARAMETERIN_RESERVED1 = 0x00000040, /**< Reserved for future use */ + CK_STATESAVE_PARAMETERIN_OWNER = 0x00000080, /**< Obsolete */ + CK_STATESAVE_PARAMETERIN_INSHARED = 0x00000100, /**< Obsolete */ + CK_STATESAVE_PARAMETERIN_OUTSOURCE = 0x00000200, /**< Obsolete */ + CK_STATESAVE_PARAMETERIN_DEFAULTDATA = 0x00000400, /**< Obsolete */ + CK_STATESAVE_PARAMETERIN_DATASHARED = 0x00000800, /**< Save reference to shared inparameter */ + CK_STATESAVE_PARAMETERIN_DATASOURCE = 0x00001000, /**< Save reference to source outparameter */ + CK_STATESAVE_PARAMETERIN_DISABLED = 0x00002000, /**< The parameter was disabled */ + CK_STATESAVE_PARAMETERIN_ALL = 0x0000FFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_PARAMETERIN); + /** + ParameterLocal et ParameterOut + */ + enum class CK_STATESAVEFLAGS_PARAMETEROUT : uint32_t { + CK_STATESAVE_PARAMETEROUT_RESERVED0 = 0x00000010, /**< Reserved for future use */ + CK_STATESAVE_PARAMETEROUT_DESTINATIONS = 0x00000020, /**< Save destinations */ + CK_STATESAVE_PARAMETEROUT_VAL = 0x00000040, /**< Save value */ + CK_STATESAVE_PARAMETEROUT_OWNER = 0x00000080, /**< Save Owner */ + CK_STATESAVE_PARAMETEROUT_MYSELF = 0x00000200, /**< */ + CK_STATESAVE_PARAMETEROUT_ISSETTING = 0x00000400, /**< Reserved for future use */ + CK_STATESAVE_PARAMETEROUT_ALL = 0x0000FFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_PARAMETEROUT); + /** + Parameter Operation + */ + enum class CK_STATESAVEFLAGS_OPERATION : uint32_t { + CK_STATESAVE_OPERATIONRESERVED0 = 0x00000010, /**< Reserved for future use */ + CK_STATESAVE_OPERATIONRESERVED1 = 0x00000020, /**< Reserved for future use */ + CK_STATESAVE_OPERATIONINPUTS = 0x00000040, + CK_STATESAVE_OPERATIONOUTPUT = 0x00000080, + CK_STATESAVE_OPERATIONOP = 0x00000100, + CK_STATESAVE_OPERATIONDEFAULTDATA = 0x00000200, + CK_STATESAVE_OPERATIONNEWDATA = 0x00000400, + CK_STATESAVE_OPERATIONALL = 0x000007FF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_OPERATION); + /** + Synchro Object CKSaveOjectSave will save all relevant data and does not take flags into account + */ + enum class CK_STATESAVEFLAGS_SYNCHRO : uint32_t { + CK_STATESAVE_SYNCHRODATA = 0x00000010, /**< Save data */ + CK_STATESAVE_SYNCHRORESERVED0 = 0x00000040, /**< Reserved for future use */ + CK_STATESAVE_SYNCHRORESERVED1 = 0x00000080, /**< Reserved for future use */ + CK_STATESAVE_SYNCHRORESERVED2 = 0x00000100, /**< Reserved for future use */ + CK_STATESAVE_SYNCHRORESERVED3 = 0x00000200, /**< Reserved for future use */ + CK_STATESAVE_SYNCHRONALL = 0x000003FF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_SYNCHRO); + /** + Grid + */ + enum class CK_STATESAVEFLAGS_GRID : uint32_t { + CK_STATESAVE_GRIDDATA = 0x00400000, /**< Save Grid Data */ + CK_STATESAVE_GRIDRESERVED0 = 0x00800000, /**< Reserved for future use */ + CK_STATESAVE_GRIDRESERVED1 = 0x01000000, /**< Reserved for future use */ + CK_STATESAVE_GRIDRESERVED2 = 0x02000000, /**< Reserved for future use */ + CK_STATESAVE_GRIDRESERVED3 = 0x04000000, /**< Reserved for future use */ + CK_STATESAVE_GRIDRESERVED4 = 0x08000000, /**< Reserved for future use */ + CK_STATESAVE_GRIDONLY = 0x0FC00000, /**< */ + CK_STATESAVE_GRIDALL = 0x0FFFFFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_GRID); + /** + Layer (For Grids) + */ + enum class CK_STATESAVEFLAGS_LAYER : uint32_t { + CK_STATESAVE_LAYERDATA = 0x00000010, /**< Save Layer Data */ + CK_STATESAVE_LAYERRESERVED0 = 0x00800020, /**< Reserved for future use */ + CK_STATESAVE_LAYERRESERVED1 = 0x00000040, /**< Reserved for future use */ + CK_STATESAVE_LAYERRESERVED2 = 0x00000080, /**< Reserved for future use */ + CK_STATESAVE_LAYERRESERVED3 = 0x00000100, /**< Reserved for future use */ + CK_STATESAVE_LAYERRESERVED4 = 0x00000200, /**< Reserved for future use */ + CK_STATESAVE_LAYERONLY = 0x000003F0, /**< */ + CK_STATESAVE_LAYERALL = 0x000003FF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_LAYER); + /** + DataArray CKSaveOjectSave will save all relevant data and does not take flags into account + */ + enum class CK_STATESAVEFLAGS_DATAARRAY : uint32_t { + CK_STATESAVE_DATAARRAYFORMAT = 0x00001000, /**< Save format */ + CK_STATESAVE_DATAARRAYDATA = 0x00002000, /**< Save array data */ + CK_STATESAVE_DATAARRAYMEMBERS = 0x00004000, /**< Save members */ + CK_STATESAVE_DATAARRAYALL = 0x0000FFFF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_DATAARRAY); + /** + SceneObjectDesc + */ + enum class CK_STATESAVEFLAGS_SCENEOBJECTDESC : uint32_t { + CK_STATESAVE_SCENEOBJECTDESC = 0x00000010, + CK_STATESAVE_SCENEOBJECTRES1 = 0x00000020, /**< Reserved for future use */ + CK_STATESAVE_SCENEOBJECTRES2 = 0x00000040, /**< Reserved for future use */ + CK_STATESAVE_SCENEOBJECTRES3 = 0x00000080, /**< Reserved for future use */ + CK_STATESAVE_SCENEOBJECTDESCALL = 0x000000FF, /**< Save All datas for sub-classes */ + }; + LIBCMO_BITFLAG_OPERATORS(CK_STATESAVEFLAGS_SCENEOBJECTDESC); + +} \ No newline at end of file diff --git a/LibCmo/CKManagerImplements/CKBaseManager.cpp b/LibCmo/CK2/CKManagerImplements/CKBaseManager.cpp similarity index 100% rename from LibCmo/CKManagerImplements/CKBaseManager.cpp rename to LibCmo/CK2/CKManagerImplements/CKBaseManager.cpp diff --git a/LibCmo/CKObjects.hpp b/LibCmo/CK2/CKObject.hpp similarity index 100% rename from LibCmo/CKObjects.hpp rename to LibCmo/CK2/CKObject.hpp diff --git a/LibCmo/CKObjectImplements/CKObject.cpp b/LibCmo/CK2/CKObjectImplements/CKObject.cpp similarity index 100% rename from LibCmo/CKObjectImplements/CKObject.cpp rename to LibCmo/CK2/CKObjectImplements/CKObject.cpp diff --git a/LibCmo/CKStateChunk.cpp b/LibCmo/CK2/CKStateChunk.cpp similarity index 100% rename from LibCmo/CKStateChunk.cpp rename to LibCmo/CK2/CKStateChunk.cpp diff --git a/LibCmo/CKStateChunk.hpp b/LibCmo/CK2/CKStateChunk.hpp similarity index 100% rename from LibCmo/CKStateChunk.hpp rename to LibCmo/CK2/CKStateChunk.hpp diff --git a/LibCmo/CK2/CKTypes.hpp b/LibCmo/CK2/CKTypes.hpp new file mode 100644 index 0000000..3094a2e --- /dev/null +++ b/LibCmo/CK2/CKTypes.hpp @@ -0,0 +1,340 @@ +#pragma once + +#include +#include +#include +#include + +/** + * @brief The CK2 part of LibCmo. + * These classes are prefixed with CK in original Virtools SDK. +*/ +namespace LibCmo::CK2 { + + /** + @brief Unique Identifier for all Objects instanciated in a given CKContext + @remarks + + Each instance of CKObject and derived classes are automatically given a global unique + ID at creation time. This ID can be accessed through the CKObject::GetID method. + It is safer, though a bit slower, to reference object through their global ID than through + a direct pointer reference. In any case the referenced object may be deleted even though + the client object has a ID for it. The client object should verify that the referenced object + still exists when used with the CKGetObject function. + + The global ID for an instance remains unique and unchanged through a application session, but there + is no garanty that this ID will be the same when a level is saved and loaded back again. + @see CKObject::GetID, CKContext::GetObject + */ + using CK_ID = uint32_t; + + enum class CKERROR : int32_t { + CKERR_OK = 0, /**< Operation successful */ + CKERR_INVALIDPARAMETER = -1, /**< One of the parameter passed to the function was invalid */ + CKERR_INVALIDPARAMETERTYPE = -2, /**< One of the parameter passed to the function was invalid */ + CKERR_INVALIDSIZE = -3, /**< The parameter size was invalid */ + CKERR_INVALIDOPERATION = -4, /**< The operation type didn't exist */ + CKERR_OPERATIONNOTIMPLEMENTED = -5, /**< The function used to execute the operation is not yet implemented */ + CKERR_OUTOFMEMORY = -6, /**< There was not enough memory to perform the action */ + CKERR_NOTIMPLEMENTED = -7, /**< The function is not yet implemented */ + CKERR_NOTFOUND = -11, /**< There was an attempt to remove something not present */ + CKERR_NOLEVEL = -13, /**< There is no level currently created */ + CKERR_CANCREATERENDERCONTEXT = -14, /**< */ + CKERR_NOTIFICATIONNOTHANDLED = -16, /**< The notification message was not used */ + CKERR_ALREADYPRESENT = -17, /**< Attempt to add an item that was already present */ + CKERR_INVALIDRENDERCONTEXT = -18, /**< the render context is not valid */ + CKERR_RENDERCONTEXTINACTIVE = -19, /**< the render context is not activated for rendering */ + CKERR_NOLOADPLUGINS = -20, /**< there was no plugins to load this kind of file */ + CKERR_NOSAVEPLUGINS = -21, /**< there was no plugins to save this kind of file */ + CKERR_INVALIDFILE = -22, /**< attempt to load an invalid file */ + CKERR_INVALIDPLUGIN = -23, /**< attempt to load with an invalid plugin */ + CKERR_NOTINITIALIZED = -24, /**< attempt use an object that wasnt initialized */ + CKERR_INVALIDMESSAGE = -25, /**< attempt use a message type that wasn't registred */ + CKERR_INVALIDPROTOTYPE = -28, /**< attempt use an invalid prototype */ + CKERR_NODLLFOUND = -29, /**< No dll file found in the parse directory */ + CKERR_ALREADYREGISTREDDLL = -30, /**< this dll has already been registred */ + CKERR_INVALIDDLL = -31, /**< this dll does not contain information to create the prototype */ + CKERR_INVALIDOBJECT = -34, /**< Invalid Object (attempt to Get an object from an invalid ID) */ + CKERR_INVALIDCONDSOLEWINDOW = -35, /**< Invalid window was provided as console window */ + CKERR_INVALIDKINEMATICCHAIN = -36, /**< Invalid kinematic chain ( end and start effector may not be part of the same hierarchy ) */ + CKERR_NOKEYBOARD = -37, /**< Keyboard not attached or not working properly */ + CKERR_NOMOUSE = -38, /**< Mouse not attached or not working properly */ + CKERR_NOJOYSTICK = -39, /**< Joystick not attached or not working properly */ + CKERR_INCOMPATIBLEPARAMETERS = -40, /**< Try to link imcompatible Parameters */ + CKERR_NORENDERENGINE = -44, /**< There is no render engine dll */ + CKERR_NOCURRENTLEVEL = -45, /**< There is no current level (use CKSetCurrentLevel ) */ + CKERR_SOUNDDISABLED = -46, /**< Sound Management has been disabled */ + CKERR_DINPUTDISABLED = -47, /**< DirectInput Management has been disabled */ + CKERR_INVALIDGUID = -48, /**< Guid is already in use or invalid */ + CKERR_NOTENOUGHDISKPLACE = -49, /**< There was no more free space on disk when trying to save a file */ + CKERR_CANTWRITETOFILE = -50, /**< Impossible to write to file (write-protection ?) */ + CKERR_BEHAVIORADDDENIEDBYCB = -51, /**< The behavior cannnot be added to this entity */ + CKERR_INCOMPATIBLECLASSID = -52, /**< The behavior cannnot be added to this entity */ + CKERR_MANAGERALREADYEXISTS = -53, /**< A manager was registered more than once */ + CKERR_PAUSED = -54, /**< CKprocess or TimeManager process while CK is paused will fail */ + CKERR_PLUGINSMISSING = -55, /**< Some plugins were missing whileloading a file */ + CKERR_OBSOLETEVIRTOOLS = -56, /**< Virtools version too old to load this file */ + CKERR_FILECRCERROR = -57, /**< CRC Error while loading file */ + CKERR_ALREADYFULLSCREEN = -58, /**< A Render context is already in Fullscreen Mode */ + CKERR_CANCELLED = -59, /**< Operation was cancelled by user */ + CKERR_NOANIMATIONKEY = -121, /**< there were no animation key at the given index */ + CKERR_INVALIDINDEX = -122, /**< attemp to acces an animation key with an invalid index */ + CKERR_INVALIDANIMATION = -123, /**< the animation is invalid (no entity associated or zero length) */ + }; + + /** + @brief Per Class Unique Identifier. + @remark + + Each class derived from the CKObject class has a unique class ID. + + This ID can be accessed through each instance of these classes, with the + CKObject::GetClassID method. + + This class ID is used internally for various matching operations, like matching behaviors on + objects, etc.. + @see CKObject::GetClassID, CKIsChildClassOf, Class Identifiers + */ + enum class CK_CLASSID : int32_t { + CKCID_OBJECT = 1, + CKCID_PARAMETERIN = 2, + CKCID_PARAMETEROPERATION = 4, + CKCID_STATE = 5, + CKCID_BEHAVIORLINK = 6, + CKCID_BEHAVIOR = 8, + CKCID_BEHAVIORIO = 9, + CKCID_RENDERCONTEXT = 12, + CKCID_KINEMATICCHAIN = 13, + CKCID_SCENEOBJECT = 11, + CKCID_OBJECTANIMATION = 15, + CKCID_ANIMATION = 16, + CKCID_KEYEDANIMATION = 18, + CKCID_BEOBJECT = 19, + CKCID_DATAARRAY = 52, + CKCID_SCENE = 10, + CKCID_LEVEL = 21, + CKCID_PLACE = 22, + CKCID_GROUP = 23, + CKCID_SOUND = 24, + CKCID_WAVESOUND = 25, + CKCID_MIDISOUND = 26, + CKCID_MATERIAL = 30, + CKCID_TEXTURE = 31, + CKCID_MESH = 32, + CKCID_PATCHMESH = 53, + CKCID_RENDEROBJECT = 47, + CKCID_2DENTITY = 27, + CKCID_SPRITE = 28, + CKCID_SPRITETEXT = 29, + CKCID_3DENTITY = 33, + CKCID_GRID = 50, + CKCID_CURVEPOINT = 36, + CKCID_SPRITE3D = 37, + CKCID_CURVE = 43, + CKCID_CAMERA = 34, + CKCID_TARGETCAMERA = 35, + CKCID_LIGHT = 38, + CKCID_TARGETLIGHT = 39, + CKCID_CHARACTER = 40, + CKCID_3DOBJECT = 41, + CKCID_BODYPART = 42, + CKCID_PARAMETER = 46, + CKCID_PARAMETERLOCAL = 45, + CKCID_PARAMETEROUT = 3, + CKCID_INTERFACEOBJECTMANAGER = 48, + CKCID_CRITICALSECTION = 49, + CKCID_LAYER = 51, + CKCID_PROGRESSIVEMESH = 54, + CKCID_SYNCHRO = 20, + CKCID_OBJECTARRAY = 80, + CKCID_SCENEOBJECTDESC = 81, + CKCID_ATTRIBUTEMANAGER = 82, + CKCID_MESSAGEMANAGER = 83, + CKCID_COLLISIONMANAGER = 84, + CKCID_OBJECTMANAGER = 85, + CKCID_FLOORMANAGER = 86, + CKCID_RENDERMANAGER = 87, + CKCID_BEHAVIORMANAGER = 88, + CKCID_INPUTMANAGER = 89, + CKCID_PARAMETERMANAGER = 90, + CKCID_GRIDMANAGER = 91, + CKCID_SOUNDMANAGER = 92, + CKCID_TIMEMANAGER = 93, + CKCID_CUIKBEHDATA = -1, + CKCID_MAXCLASSID = 55, + CKCID_MAXMAXCLASSID = 128, + }; + + // ========== Type Definition ========== + + using CKMUTSTRING = char*; + using CKSTRING = const char*; + + using CKCHAR = char; + using CKBOOL = int32_t; + using CKBYTE = uint8_t; + using CKDWORD = uint32_t; + using CKWORD = uint16_t; + + using CKINT = int32_t; + + using CKParameterType = int32_t; + using CKOperationType = int32_t; + using CKMessageType = int32_t; + using CKAttributeType = int32_t; + using CKAttributeCategory = int32_t; + + // ========== Class List ========== + // Objects and derivated classes + + class CKObject; + class CKInterfaceObjectManager; + class CKRenderContext; + class CKParameterIn; + class CKParameter; + class CKParameterOut; + class CKParameterLocal; + class CKParameterOperation; + class CKBehaviorLink; + class CKBehaviorIO; + class CKRenderContext; + class CKSynchroObject; + class CKStateObject; + class CKCriticalSectionObject; + class CKKinematicChain; + class CKObjectAnimation; + class CKLayer; + class CKSceneObject; + class CKBehavior; + class CKAnimation; + class CKKeyedAnimation; + class CKBeObject; + class CKScene; + class CKLevel; + class CKPlace; + class CKGroup; + class CKMaterial; + class CKTexture; + class CKMesh; + class CKPatchMesh; + class CKProgressiveMesh; + class CKDataArray; + class CKSound; + class CKMidiSound; + class CKWaveSound; + class CKRenderObject; + class CK2dEntity; + class CKSprite; + class CKSpriteText; + class CK3dEntity; + class CKCamera; + class CKTargetCamera; + class CKCurvePoint; + class CKSprite3D; + class CKLight; + class CKTargetLight; + class CKCharacter; + class CK3dObject; + class CKBodyPart; + class CKCurve; + class CKGrid; + + //---- Misc + class CKBehaviorPrototype; + class CKMessage; + class CK2dCurvePoint; + class CK2dCurve; + class CKStateChunk; + class CKFile; + class CKDependencies; + class CKDependenciesContext; + class CKPluginManager; + class CKDebugContext; + class CKObjectArray; + class CKObjectDeclaration; + class CKContext; + struct CKBitmapProperties; + class CKVertexBuffer; + + //--- Managers + class CKBaseManager; + class CKSoundManager; + class CKTimeManager; + class CKRenderManager; + class CKBehaviorManager; + class CKMessageManager; + class CKParameterManager; + class CKAttributeManager; + class CKPathManager; + class CKVariableManager; + class CKSceneObjectDesc; + + //--- Important classes + class CKContext; + class CKStateChunk; + class CKFile; + + + /** + @brief Global Unique Identifier Struture. + @remark + + Guids are used to uniquely identify plugins,operation types, parameter types and behavior prototypes. + + Its defined as + ``` + typedef struct CKGUID { + union { + struct { CKDWORD d1,d2; }; + CKDWORD d[2]; + }; + }; + ``` + + Comparison operators are defined so CKGUIDS can be compared with + ==, != , <, > operators. + + @see Pre-Registred Parameter Types, ParameterOperation Types + */ + struct CKGUID { + CKDWORD d1, d2; + + constexpr CKGUID(CKDWORD gd1 = 0, CKDWORD gd2 = 0) : d1(gd1), d2(gd2) {} + CKGUID(const CKGUID& rhs) : d1(rhs.d1), d2(rhs.d2) {} + CKGUID& operator=(const CKGUID& rhs) { + this->d1 = rhs.d1; + this->d2 = rhs.d2; + + return *this; + } + + bool operator ==(const CKGUID& rhs) const { + return ((this->d1 == rhs.d1) && (this->d2 == rhs.d2)); + } + bool operator !=(const CKGUID& rhs) const { + return ((this->d1 != rhs.d1) || (this->d2 != rhs.d2)); + } + bool operator <(const CKGUID& rhs) const { + if (this->d1 < rhs.d1) { + return true; + } + + if (this->d1 == rhs.d1) { + return (this->d2 < rhs.d2); + } + + return false; + } + bool operator <=(const CKGUID& rhs) const { + return (this->d1 <= rhs.d1); + } + bool operator >(const CKGUID& rhs) const { + if (this->d1 > rhs.d1) { + return true; + } + + if (this->d1 == rhs.d1) { + return (this->d2 > rhs.d2); + } + + return false; + } + bool operator >=(const CKGUID& rhs) const { + return (this->d1 >= rhs.d1); + } + }; + + +} diff --git a/LibCmo/CKDefines.hpp b/LibCmo/CKDefines.hpp deleted file mode 100644 index b301a6e..0000000 --- a/LibCmo/CKDefines.hpp +++ /dev/null @@ -1,197 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace LibCmo { - namespace CK2 { - - // some important type define - - using CK_ID = uint32_t; - - using CKDWORD = uint32_t; - using CKWORD = uint16_t; - using CKBYTE = uint8_t; - using CKBOOL = int32_t; - using CKINT = int32_t; - - using CKMUTSTRING = char*; - using CKSTRING = const char*; - - using XString = std::string; - using XBitArray = std::vector; - template - using XArray = std::vector; - using XIntArray = std::vector; - template - using XClassArray = std::vector; - using XObjectArray = std::vector; - //using CKObjectArray = std::vector; - - // some print macro define -#define PRICKdword PRIu32 -#define PRICKword PRIu16 -#define PRICKbyte PRIu8 -#define PRICKint PRIi32 - - // forward decl for some CKObjects - namespace CKObjectImplements { - class CKObject; - class CKParameterIn; - class CKParameter; - class CKParameterOut; - class CKParameterLocal; - class CKParameterOperation; - class CKBehaviorLink; - class CKBehaviorIO; - - class CKSceneObject; - class CKBehavior; - - class CKBeObject; - class CKScene; - class CKLevel; - class CKPlace; - class CKGroup; - class CKMaterial; - class CKTexture; - class CKMesh; - class CKDataArray; - class CKRenderObject; - class CK3dEntity; - class CK3dObject; - } - // forward decl for some CKManagers - namespace CKManagerImplements { - class CKBaseManager; - class CKAttributeManager; - } - - // forward decl for some important CK2 classes - class CKMinContext; - class CKStateChunk; - class CKFile; - class CKFileDocument; - - // useful struct define - struct CKGUID { - CKDWORD d1, d2; - - constexpr CKGUID(CKDWORD gd1 = 0, CKDWORD gd2 = 0) : d1(gd1), d2(gd2) {} - CKGUID(const CKGUID& rhs) : d1(rhs.d1), d2(rhs.d2) {} - CKGUID& operator=(const CKGUID& rhs) { - this->d1 = rhs.d1; - this->d2 = rhs.d2; - - return *this; - } - - bool operator ==(const CKGUID& rhs) const { - return ((this->d1 == rhs.d1) && (this->d2 == rhs.d2)); - } - bool operator !=(const CKGUID& rhs) const { - return ((this->d1 != rhs.d1) || (this->d2 != rhs.d2)); - } - bool operator <(const CKGUID& rhs) const { - if (this->d1 < rhs.d1) { - return true; - } - - if (this->d1 == rhs.d1) { - return (this->d2 < rhs.d2); - } - - return false; - } - bool operator <=(const CKGUID& rhs) const { - return (this->d1 <= rhs.d1); - } - bool operator >(const CKGUID& rhs) const { - if (this->d1 > rhs.d1) { - return true; - } - - if (this->d1 == rhs.d1) { - return (this->d2 > rhs.d2); - } - - return false; - } - bool operator >=(const CKGUID& rhs) const { - return (this->d1 >= rhs.d1); - } - }; - - - } - - namespace VxMath { - - // forward decl for some important VxMath classes - class VxMemoryMappedFile; - - struct VxVector { - float x, y, z; - - VxVector() : x(0.0f), y(0.0f), z(0.0f) { ; } - VxVector(float f) : x(f), y(f), z(f) { ; } - VxVector(float _x, float _y, float _z) : x(_x), y(_y), z(_z) { ; } - VxVector(const float f[3]) : x(f[0]), y(f[1]), z(f[2]) { ; } - }; - - struct VxQuaternion { - float x, y, z, w; - - VxQuaternion() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) { ; } - VxQuaternion(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) { ; } - }; - - struct VxMatrix { - float m_Data[4][4]; - - VxMatrix() : m_Data() { - std::memset(m_Data, 0, sizeof(m_Data)); - m_Data[0][0] = m_Data[1][1] = m_Data[2][2] = m_Data[3][3] = 1.0f; - } - VxMatrix(float m[4][4]) : m_Data() { std::memcpy(m_Data, m, sizeof(m_Data)); } - }; - - struct VxImageDescEx { - CK2::CKINT Size; - CK2::CKDWORD Flags; - - CK2::CKINT Width; - CK2::CKINT Height; - union { - CK2::CKINT BytesPerLine; - CK2::CKINT TotalImageSize; - }; - CK2::CKINT BitsPerPixel; - union { - CK2::CKDWORD RedMask; - CK2::CKDWORD BumpDuMask; - }; - union { - CK2::CKDWORD GreenMask; - CK2::CKDWORD BumpDvMask; - }; - union { - CK2::CKDWORD BlueMask; - CK2::CKDWORD BumpLumMask; - - }; - CK2::CKDWORD AlphaMask; - - CK2::CKWORD BytesPerColorEntry; - CK2::CKWORD ColorMapEntries; - - CK2::CKBYTE* ColorMap; - CK2::CKBYTE* Image; - }; - - } - -} diff --git a/LibCmo/CKEnums.hpp b/LibCmo/CKEnums.hpp deleted file mode 100644 index a84e18b..0000000 --- a/LibCmo/CKEnums.hpp +++ /dev/null @@ -1,277 +0,0 @@ -#pragma once - -#include "CKDefines.hpp" -#include -#include - -namespace LibCmo::CK2 { - - constexpr const CKDWORD CKVERSION = 0x05082002; - - namespace PredefinedGuids { - - constexpr const CKDWORD OBJECT_MANAGER_GUID1 = 0x7cbb3b91; - constexpr const CKDWORD ATTRIBUTE_MANAGER_GUID1 = 0x3d242466; - constexpr const CKDWORD MESSAGE_MANAGER_GUID1 = 0x466a0fac; - constexpr const CKDWORD FLOOR_MANAGER_GUID1 = 0x420936f9; - constexpr const CKDWORD COLLISION_MANAGER_GUID1 = 0x38244712; - constexpr const CKDWORD GRID_MANAGER_GUID1 = 0x7f004791; - constexpr const CKDWORD TIME_MANAGER_GUID1 = 0x89ce7b32; - constexpr const CKDWORD BEHAVIOR_MANAGER_GUID1 = 0x58d621ae; - constexpr const CKDWORD INPUT_MANAGER_GUID1 = 0xf787c904; - constexpr const CKDWORD SOUND_MANAGER_GUID1 = 0xdce135f6; - constexpr const CKDWORD MIDI_MANAGER_GUID1 = 0x594154a6; - constexpr const CKDWORD INTERFACE_MANAGER_GUID1 = 0x9a4b8e3d; - constexpr const CKDWORD RENDER_MANAGER_GUID1 = 0xa213c8d5; - constexpr const CKDWORD PARAMETER_MANAGER_GUID1 = 0x9ce57ab6; - constexpr const CKDWORD PATH_MANAGER_GUID1 = 0x15fd54b9; - constexpr const CKDWORD VARIABLE_MANAGER_GUID1 = 0x98cc3cc9; - - constexpr const CKGUID OBJECT_MANAGER_GUID{ OBJECT_MANAGER_GUID1 ,0 }; - constexpr const CKGUID ATTRIBUTE_MANAGER_GUID{ ATTRIBUTE_MANAGER_GUID1, 0 }; - constexpr const CKGUID MESSAGE_MANAGER_GUID{ MESSAGE_MANAGER_GUID1 ,0 }; - constexpr const CKGUID TIME_MANAGER_GUID{ TIME_MANAGER_GUID1 ,0 }; - constexpr const CKGUID SOUND_MANAGER_GUID{ SOUND_MANAGER_GUID1 ,0 }; - constexpr const CKGUID MIDI_MANAGER_GUID{ MIDI_MANAGER_GUID1 ,0 }; - constexpr const CKGUID INPUT_MANAGER_GUID{ INPUT_MANAGER_GUID1 ,0 }; - constexpr const CKGUID BEHAVIOR_MANAGER_GUID{ BEHAVIOR_MANAGER_GUID1 ,0 }; - constexpr const CKGUID FLOOR_MANAGER_GUID{ FLOOR_MANAGER_GUID1 ,0 }; - constexpr const CKGUID COLLISION_MANAGER_GUID{ COLLISION_MANAGER_GUID1 ,0 }; - constexpr const CKGUID GRID_MANAGER_GUID{ GRID_MANAGER_GUID1 ,0 }; - constexpr const CKGUID INTERFACE_MANAGER_GUID{ INTERFACE_MANAGER_GUID1 ,0 }; - constexpr const CKGUID RENDER_MANAGER_GUID{ RENDER_MANAGER_GUID1 ,0 }; - constexpr const CKGUID PARAMETER_MANAGER_GUID{ PARAMETER_MANAGER_GUID1 ,0 }; - constexpr const CKGUID PATH_MANAGER_GUID{ PATH_MANAGER_GUID1 ,0 }; - constexpr const CKGUID VARIABLE_MANAGER_GUID{ VARIABLE_MANAGER_GUID1 ,0 }; - - } - - enum class CK_CLASSID : uint32_t { - CKCID_OBJECT = 1, - CKCID_PARAMETERIN = 2, - CKCID_PARAMETEROPERATION = 4, - CKCID_STATE = 5, - CKCID_BEHAVIORLINK = 6, - CKCID_BEHAVIOR = 8, - CKCID_BEHAVIORIO = 9, - CKCID_RENDERCONTEXT = 12, - CKCID_KINEMATICCHAIN = 13, - CKCID_SCENEOBJECT = 11, - CKCID_OBJECTANIMATION = 15, - CKCID_ANIMATION = 16, - CKCID_KEYEDANIMATION = 18, - CKCID_BEOBJECT = 19, - CKCID_DATAARRAY = 52, - CKCID_SCENE = 10, - CKCID_LEVEL = 21, - CKCID_PLACE = 22, - CKCID_GROUP = 23, - CKCID_SOUND = 24, - CKCID_WAVESOUND = 25, - CKCID_MIDISOUND = 26, - CKCID_MATERIAL = 30, - CKCID_TEXTURE = 31, - CKCID_MESH = 32, - CKCID_PATCHMESH = 53, - CKCID_RENDEROBJECT = 47, - CKCID_2DENTITY = 27, - CKCID_SPRITE = 28, - CKCID_SPRITETEXT = 29, - CKCID_3DENTITY = 33, - CKCID_GRID = 50, - CKCID_CURVEPOINT = 36, - CKCID_SPRITE3D = 37, - CKCID_CURVE = 43, - CKCID_CAMERA = 34, - CKCID_TARGETCAMERA = 35, - CKCID_LIGHT = 38, - CKCID_TARGETLIGHT = 39, - CKCID_CHARACTER = 40, - CKCID_3DOBJECT = 41, - CKCID_BODYPART = 42, - CKCID_PARAMETER = 46, - CKCID_PARAMETERLOCAL = 45, - CKCID_PARAMETEROUT = 3, - CKCID_INTERFACEOBJECTMANAGER = 48, - CKCID_CRITICALSECTION = 49, - CKCID_LAYER = 51, - CKCID_PROGRESSIVEMESH = 54, - CKCID_SYNCHRO = 20, - - CKCID_OBJECTARRAY = 80, - CKCID_SCENEOBJECTDESC = 81, - CKCID_ATTRIBUTEMANAGER = 82, - CKCID_MESSAGEMANAGER = 83, - CKCID_COLLISIONMANAGER = 84, - CKCID_OBJECTMANAGER = 85, - CKCID_FLOORMANAGER = 86, - CKCID_RENDERMANAGER = 87, - CKCID_BEHAVIORMANAGER = 88, - CKCID_INPUTMANAGER = 89, - CKCID_PARAMETERMANAGER = 90, - CKCID_GRIDMANAGER = 91, - CKCID_SOUNDMANAGER = 92, - CKCID_TIMEMANAGER = 93, - CKCID_CUIKBEHDATA = static_cast(-1), - - CKCID_MAXCLASSID = 55, - CKCID_MAXMAXCLASSID = 128 - }; - - enum class CKERROR : int32_t { - CKERR_OK = 0, - CKERR_INVALIDPARAMETER = -1, - CKERR_INVALIDPARAMETERTYPE = -2, - CKERR_INVALIDSIZE = -3, - CKERR_INVALIDOPERATION = -4, - CKERR_OPERATIONNOTIMPLEMENTED = -5, - CKERR_OUTOFMEMORY = -6, - CKERR_NOTIMPLEMENTED = -7, - CKERR_NOTFOUND = -11, - CKERR_NOLEVEL = -13, - CKERR_CANCREATERENDERCONTEXT = -14, - CKERR_NOTIFICATIONNOTHANDLED = -16, - CKERR_ALREADYPRESENT = -17, - CKERR_INVALIDRENDERCONTEXT = -18, - CKERR_RENDERCONTEXTINACTIVE = -19, - CKERR_NOLOADPLUGINS = -20, - CKERR_NOSAVEPLUGINS = -21, - CKERR_INVALIDFILE = -22, - CKERR_INVALIDPLUGIN = -23, - CKERR_NOTINITIALIZED = -24, - CKERR_INVALIDMESSAGE = -25, - CKERR_INVALIDPROTOTYPE = -28, - CKERR_NODLLFOUND = -29, - CKERR_ALREADYREGISTREDDLL = -30, - CKERR_INVALIDDLL = -31, - CKERR_INVALIDOBJECT = -34, - CKERR_INVALIDCONDSOLEWINDOW = -35, - CKERR_INVALIDKINEMATICCHAIN = -36, - CKERR_NOKEYBOARD = -37, - CKERR_NOMOUSE = -38, - CKERR_NOJOYSTICK = -39, - CKERR_INCOMPATIBLEPARAMETERS = -40, - CKERR_NORENDERENGINE = -44, - CKERR_NOCURRENTLEVEL = -45, - CKERR_SOUNDDISABLED = -46, - CKERR_DINPUTDISABLED = -47, - CKERR_INVALIDGUID = -48, - CKERR_NOTENOUGHDISKPLACE = -49, - CKERR_CANTWRITETOFILE = -50, - CKERR_BEHAVIORADDDENIEDBYCB = -51, - CKERR_INCOMPATIBLECLASSID = -52, - CKERR_MANAGERALREADYEXISTS = -53, - CKERR_PAUSED = -54, - CKERR_PLUGINSMISSING = -55, - CKERR_OBSOLETEVIRTOOLS = -56, - CKERR_FILECRCERROR = -57, - CKERR_ALREADYFULLSCREEN = -58, - CKERR_CANCELLED = -59, - CKERR_NOANIMATIONKEY = -121, - CKERR_INVALIDINDEX = -122, - CKERR_INVALIDANIMATION = -123 - }; - - enum class CK_FILE_WRITEMODE : uint32_t { - CKFILE_UNCOMPRESSED = 0, - CKFILE_CHUNKCOMPRESSED_OLD = 1, - CKFILE_EXTERNALTEXTURES_OLD = 2, - CKFILE_FORVIEWER = 4, - CKFILE_WHOLECOMPRESSED = 8 - }; - enum class CK_LOAD_FLAGS : uint32_t { - CK_LOAD_ANIMATION = 1 << 0, - CK_LOAD_GEOMETRY = 1 << 1, - CK_LOAD_DEFAULT = CK_LOAD_GEOMETRY | CK_LOAD_ANIMATION, - CK_LOAD_ASCHARACTER = 1 << 2, - CK_LOAD_DODIALOG = 1 << 3, - CK_LOAD_AS_DYNAMIC_OBJECT = 1 << 4, - CK_LOAD_AUTOMATICMODE = 1 << 5, - CK_LOAD_CHECKDUPLICATES = 1 << 6, - CK_LOAD_CHECKDEPENDENCIES = 1 << 7, - CK_LOAD_ONLYBEHAVIORS = 1 << 8 - }; - enum class CK_FO_OPTIONS : uint32_t { - CK_FO_DEFAULT = 0, - CK_FO_RENAMEOBJECT, - CK_FO_REPLACEOBJECT, - CK_FO_DONTLOADOBJECT - }; - enum class CK_PLUGIN_TYPE : uint32_t { - CKPLUGIN_BITMAP_READER = 0, - CKPLUGIN_SOUND_READER = 1, - CKPLUGIN_MODEL_READER = 2, - CKPLUGIN_MANAGER_DLL = 3, - CKPLUGIN_BEHAVIOR_DLL = 4, - CKPLUGIN_RENDERENGINE_DLL = 5, - CKPLUGIN_MOVIE_READER = 6, - CKPLUGIN_EXTENSION_DLL = 7 - }; - enum class CK_STATECHUNK_DATAVERSION : uint32_t { - CHUNKDATA_OLDVERSION = 0, - CHUNKDATA_BASEVERSION = 1, - CHUNK_WAVESOUND_VERSION2 = 2, - CHUNK_WAVESOUND_VERSION3 = 3, - CHUNK_MATERIAL_VERSION_ZTEST = 4, - CHUNK_MAJORCHANGE_VERSION = 5, - CHUNK_MACCHANGE_VERSION = 6, - CHUNK_WAVESOUND_VERSION4 = 7, - CHUNK_SCENECHANGE_VERSION = 8, - CHUNK_MESHCHANGE_VERSION = 9, - CHUNK_DEV_2_1 = 10, - CHUNKDATA_CURRENTVERSION = CHUNK_DEV_2_1 - }; - enum class CK_STATECHUNK_CHUNKVERSION : uint32_t { - CHUNK_VERSIONBASE = 0, - CHUNK_VERSION1 = 4, - CHUNK_VERSION2 = 5, - CHUNK_VERSION3 = 6, - CHUNK_VERSION4 = 7 - }; - enum class CK_STATECHUNK_CHUNKOPTIONS : uint32_t { - CHNK_OPTION_IDS = 0x01, - CHNK_OPTION_MAN = 0x02, - CHNK_OPTION_CHN = 0x04, - CHNK_OPTION_FILE = 0x08, - CHNK_OPTION_ALLOWDYN = 0x10, - CHNK_OPTION_LISTBIG = 0x20, - CHNK_DONTDELETE_PTR = 0x40, - CHNK_DONTDELETE_PARSER = 0x80 - }; - enum class CK_OBJECT_FLAGS : uint32_t { - CK_OBJECT_INTERFACEOBJ = 0x00000001, - CK_OBJECT_PRIVATE = 0x00000002, - CK_OBJECT_INTERFACEMARK = 0x00000004, - CK_OBJECT_FREEID = 0x00000008, - CK_OBJECT_TOBEDELETED = 0x00000010, - CK_OBJECT_NOTTOBESAVED = 0x00000020, - CK_OBJECT_VISIBLE = 0x00000040, - CK_OBJECT_NAMESHARED = 0x00000080, - CK_OBJECT_DYNAMIC = 0x00000108, - CK_OBJECT_HIERACHICALHIDE = 0x00000200, - CK_OBJECT_UPTODATE = 0x00000400, - CK_OBJECT_TEMPMARKER = 0x00000800, - CK_OBJECT_ONLYFORFILEREFERENCE = 0x00001000, - CK_OBJECT_NOTTOBEDELETED = 0x00002000, - CK_OBJECT_APPDATA = 0x00004000, - CK_OBJECT_SINGLEACTIVITY = 0x00008000, - CK_OBJECT_LOADSKIPBEOBJECT = 0x00010000, - CK_OBJECT_NOTTOBELISTEDANDSAVED = 0x00000023, - CK_PARAMETEROUT_SETTINGS = 0x00400000, - CK_PARAMETEROUT_PARAMOP = 0x00800000, - CK_PARAMETERIN_DISABLED = 0x01000000, - CK_PARAMETERIN_THIS = 0x02000000, - CK_PARAMETERIN_SHARED = 0x04000000, - CK_PARAMETEROUT_DELETEAFTERUSE = 0x08000000, - CK_OBJECT_PARAMMASK = 0x0FC00000, - CK_BEHAVIORIO_IN = 0x10000000, - CK_BEHAVIORIO_OUT = 0x20000000, - CK_BEHAVIORIO_ACTIVE = 0x40000000, - CK_OBJECT_IOTYPEMASK = 0x30000000, - CK_OBJECT_IOMASK = 0xF0000000, - CKBEHAVIORLINK_RESERVED = 0x10000000, - CKBEHAVIORLINK_ACTIVATEDLASTFRAME = 0x20000000, - CK_OBJECT_BEHAVIORLINKMASK = 0x30000000 - }; - -} diff --git a/LibCmo/CKGlobals.hpp b/LibCmo/CKGlobals.hpp deleted file mode 100644 index 4c991e6..0000000 --- a/LibCmo/CKGlobals.hpp +++ /dev/null @@ -1,10 +0,0 @@ -#pragma once - -#include "CKDefines.hpp" - -namespace LibCmo::CK2 { - - void* CKUnPackData(CKINT DestSize, const void* SrcBuffer, CKINT SrcSize); - CKDWORD CKComputeDataCRC(const void* data, size_t size, CKDWORD PreviousCRC = 0); - -} diff --git a/LibCmo/CKIdentifiers.hpp b/LibCmo/CKIdentifiers.hpp deleted file mode 100644 index e259858..0000000 --- a/LibCmo/CKIdentifiers.hpp +++ /dev/null @@ -1,736 +0,0 @@ -#pragma once - -#include "CKDefines.hpp" -#include -#include - -namespace LibCmo::CK2::Identifiers { - - constexpr const CKDWORD CK_STATESAVE_ALL = 0xFFFFFFFF; - - //------------------------------------------------ - // Object - enum class CK_STATESAVEFLAGS_OBJECT : uint32_t { - - CK_STATESAVE_NAME = 0x00000001, // Obsolete - CK_STATESAVE_ID = 0x00000002, // Obsolete - CK_STATESAVE_OBJECTHIDDEN = 0x00000004, // The object is hidden - CK_STATESAVE_OBJECTHIERAHIDDEN = 0x00000018, // The object is hidden hierarchically - CK_STATESAVE_OBJECTALL = 0x0000000F - }; - - - //------------------------------------------------ - // Be Object - enum class CK_STATESAVEFLAGS_BEOBJECT : uint32_t { - - CK_STATESAVE_ATTRIBUTES = 0x00000010, // Obsolete - CK_STATESAVE_NEWATTRIBUTES = 0x00000011, // Save Attributes - CK_STATESAVE_GROUPS = 0x00000020, // Obsolete - CK_STATESAVE_DATAS = 0x00000040, // Save Flags and (Waiting for message) status - CK_STATESAVE_SOUNDS = 0x00000080, // Obsolete - CK_STATESAVE_BEHAVIORS = 0x00000100, // Obsolete - CK_STATESAVE_PARAMETERS = 0x00000200, // Obsolete - CK_STATESAVE_SINGLEACTIVITY = 0x00000400, // SINGLE ACTIVITY - CK_STATESAVE_SCRIPTS = 0x00000800, // Obsolete - CK_STATESAVE_BEOBJECTONLY = 0x00000FF0, // Save only BeObject specific datas - CK_STATESAVE_BEOBJECTALL = 0x00000FFF // Save All datas - }; - - - //------------------------------------------------ - // 3dEntity - enum class CK_STATESAVEFLAGS_3DENTITY : uint32_t { - - CK_STATESAVE_3DENTITYSKINDATANORMALS = 0x00001000, // Save Skin normals - CK_STATESAVE_ANIMATION = 0x00002000, // Obsolete - CK_STATESAVE_MESHS = 0x00004000, // Save List of mesh - CK_STATESAVE_PARENT = 0x00008000, // Save Parent - CK_STATESAVE_3DENTITYFLAGS = 0x00010000, // Save Flags - CK_STATESAVE_3DENTITYMATRIX = 0x00020000, // Save Position/orientation/Scale - CK_STATESAVE_3DENTITYHIERARCHY = 0x00040000, // obsolete - CK_STATESAVE_3DENTITYPLACE = 0x00080000, // Save Place in which the Entity is referenced - CK_STATESAVE_3DENTITYNDATA = 0x00100000, // Reserved for future use - CK_STATESAVE_3DENTITYSKINDATA = 0x00200000, // Save Skin data - CK_STATESAVE_3DENTITYONLY = 0x003FF000, // Save only 3dEntity specific datas - CK_STATESAVE_3DENTITYALL = 0x003FFFFF // Save All datas for sub-classes - }; - - //------------------------------------------------ - // Light - enum class CK_STATESAVEFLAGS_LIGHT : uint32_t { - - CK_STATESAVE_LIGHTDATA = 0x00400000, // Save Color,Type,Attenuation,Range and cone - CK_STATESAVE_LIGHTDATA2 = 0x00800000, // Reserved for future use - CK_STATESAVE_LIGHTRESERVED1 = 0x01000000, // Reserved for future use - CK_STATESAVE_LIGHTRESERVED2 = 0x02000000, // Reserved for future use - CK_STATESAVE_LIGHTRESERVED3 = 0x04000000, // Reserved for future use - CK_STATESAVE_LIGHTRESERVED4 = 0x08000000, // Reserved for future use - CK_STATESAVE_LIGHTONLY = 0x0FC00000, // Save only Light specific datas - CK_STATESAVE_LIGHTALL = 0x0FFFFFFF, // Save All datas for sub-classes -// Target Light -CK_STATESAVE_TLIGHTTARGET = 0x80000000, // Save Light Target -CK_STATESAVE_TLIGHTRESERVED0 = 0x10000000, // Reserved for future use -CK_STATESAVE_TLIGHTRESERVED1 = 0x20000000, // Reserved for future use -CK_STATESAVE_TLIGHTRESERVED2 = 0x40000000, // Reserved for future use -CK_STATESAVE_TLIGHTONLY = 0xF0000000, // Save only Target Light specific datas -CK_STATESAVE_TLIGHTALL = 0xFFFFFFFF // Save All datas for sub-classes - }; - - //-------------------------------------------------- - // Camera - enum class CK_STATESAVEFLAGS_CAMERA : uint32_t { - - CK_STATESAVE_CAMERAFOV = 0x00400000, // Save Camera Field of View - CK_STATESAVE_CAMERAPROJTYPE = 0x00800000, // Save Camera projection type - CK_STATESAVE_CAMERAOTHOZOOM = 0x01000000, // Save Camera orhographic zoom - CK_STATESAVE_CAMERAASPECT = 0x02000000, // Save Camera aspect ration - CK_STATESAVE_CAMERAPLANES = 0x04000000, // Save Camera near and far clip planes - CK_STATESAVE_CAMERARESERVED2 = 0x08000000, // Reserved for future use - CK_STATESAVE_CAMERAONLY = 0x0FC00000, // Save only camera specific datas - CK_STATESAVE_CAMERAALL = 0x0FFFFFFF, // Save All datas for sub-classes -// Target Camera -CK_STATESAVE_TCAMERATARGET = 0x10000000, // Save camera Target -CK_STATESAVE_TCAMERARESERVED1 = 0x20000000, // Reserved for future use -CK_STATESAVE_TCAMERARESERVED2 = 0x40000000, // Reserved for future use -CK_STATESAVE_TCAMERAONLY = 0x70000000, // Save only Target camera specific datas -CK_STATESAVE_TCAMERAALL = 0x7FFFFFFF // Save All datas for sub-classes - }; - - - //-------------------------------------------------- - // Sprite3D - enum class CK_STATESAVEFLAGS_SPRITE3D : uint32_t { - - CK_STATESAVE_SPRITE3DDATA = 0x00400000, // Save offset,mapping,size and material - CK_STATESAVE_SPRITE3DRESERVED0 = 0x00800000, // Reserved for future use - CK_STATESAVE_SPRITE3DRESERVED1 = 0x01000000, // Reserved for future use - CK_STATESAVE_SPRITE3DRESERVED2 = 0x02000000, // Reserved for future use - CK_STATESAVE_SPRITE3DRESERVED3 = 0x04000000, // Reserved for future use - CK_STATESAVE_SPRITE3DRESERVED4 = 0x08000000, // Reserved for future use - CK_STATESAVE_SPRITE3DONLY = 0x0FC00000, // Save only Sprite3D specific datas - CK_STATESAVE_SPRITE3DALL = 0x0FFFFFFF // Save All datas for sub-classes - }; - - //-------------------------------------------------- - // Object 3D - enum class CK_STATESAVEFLAGS_3DOBJECT : uint32_t { - - CK_STATESAVE_3DOBJECTATTRIBUTES = 0x00400000, // Obsolete - CK_STATESAVE_3DOBJECTRESERVED = 0x00800000, // Reserved for future use - CK_STATESAVE_3DOBJECTRONLY = 0x00C00000, // Save only 3dObject specific datas - CK_STATESAVE_3DOBJECTALL = 0x03FFFFFF // Save All datas for sub-classes - }; - - //-------------------------------------------------- - // BodyPart - enum class CK_STATESAVEFLAGS_BODYPART : uint32_t { - - CK_STATESAVE_BODYPARTROTJOINT = 0x01000000, // Save rotation joint data - CK_STATESAVE_BODYPARTPOSJOINT = 0x02000000, // Save position joint data - CK_STATESAVE_BODYPARTCHARACTER = 0x04000000, // Save character owning this bodypart - CK_STATESAVE_BODYPARTRESERVED1 = 0x08000000, // Reserved for future use - CK_STATESAVE_BODYPARTRESERVED2 = 0x10000000, // Reserved for future use - CK_STATESAVE_BODYPARTRESERVED3 = 0x20000000, // Reserved for future use - CK_STATESAVE_BODYPARTRESERVED4 = 0x40000000, // Reserved for future use - CK_STATESAVE_BODYPARTONLY = 0x7F000000, // Save only bodypart specific datas - CK_STATESAVE_BODYPARTALL = 0x7FFFFFFF // Save All datas for sub-classes - }; - - //-------------------------------------------------- - // Character - enum class CK_STATESAVEFLAGS_CHARACTER : uint32_t { - - CK_STATESAVE_CHARACTERBODYPARTS = 0x00400000, // Obsolete - CK_STATESAVE_CHARACTERKINECHAINS = 0x00800000, // Obsolete - CK_STATESAVE_CHARACTERANIMATIONS = 0x01000000, // Obsolete - CK_STATESAVE_CHARACTERROOT = 0x02000000, // Obsolete - CK_STATESAVE_CHARACTERSAVEANIMS = 0x04000000, // Save current and next active animations - CK_STATESAVE_CHARACTERSAVECHAINS = 0x08000000, // Obsolete - CK_STATESAVE_CHARACTERSAVEPARTS = 0x10000000, // Save sub bodyparts and sub-bodyparts data (saved with flag :CK_STATESAVE_BODYPARTALL) - CK_STATESAVE_CHARACTERFLOORREF = 0x20000000, // Save Character floor reference object - CK_STATESAVE_CHARACTERRESERVED2 = 0x40000000, // Reserved for future use - CK_STATESAVE_CHARACTERRESERVED3 = 0x80000000, // Reserved for future use - CK_STATESAVE_CHARACTERONLY = 0xFFC00000, // Save only character specific datas - CK_STATESAVE_CHARACTERALL = 0xFFFFFFFF // Save All datas for sub-classes - }; - - //-------------------------------------------------- - // CURVE - // && Curve Point - enum class CK_STATESAVEFLAGS_CURVE : uint32_t { - - CK_STATESAVE_CURVEFITCOEFF = 0x00400000, // Save fitting coef - CK_STATESAVE_CURVECONTROLPOINT = 0x00800000, // Save list of control points - CK_STATESAVE_CURVESTEPS = 0x01000000, // Save number of step setting - CK_STATESAVE_CURVEOPEN = 0x02000000, // Save Open/Close flag - CK_STATESAVE_CURVERESERVED1 = 0x04000000, // Reserved for future use - CK_STATESAVE_CURVERESERVED2 = 0x08000000, // Reserved for future use -// Control points -CK_STATESAVE_CURVEPOINTDEFAULTDATA = 0x10000000, // Save Control point setting and position -CK_STATESAVE_CURVEPOINTTCB = 0x20000000, // Save Control point tcb settings -CK_STATESAVE_CURVEPOINTTANGENTS = 0x40000000, // Save Control point tangents -CK_STATESAVE_CURVEPOINTCURVEPOS = 0x80000000, // Save Control point position in curve -CK_STATESAVE_CURVESAVEPOINTS = 0xFF000000, // Save control points data - -CK_STATESAVE_CURVEONLY = 0xFFC00000, // Save only curve specific data -CK_STATESAVE_CURVEALL = 0xFFFFFFFF // Save All datas for sub-classes - }; - - //------------------------------------------------ - // 2dEntity - enum class CK_STATESAVEFLAGS_2DENTITY : uint32_t { - - CK_STATESAVE_2DENTITYSRCSIZE = 0x00001000, // Save source size - CK_STATESAVE_2DENTITYSIZE = 0x00002000, // Save size - CK_STATESAVE_2DENTITYFLAGS = 0x00004000, // Save Flags - CK_STATESAVE_2DENTITYPOS = 0x00008000, // Save position - CK_STATESAVE_2DENTITYZORDER = 0x00100000, // Save Z order - CK_STATESAVE_2DENTITYONLY = 0x0010F000, // Save only 2dEntity specific data - CK_STATESAVE_2DENTITYMATERIAL = 0x00200000, // Save Material - CK_STATESAVE_2DENTITYHIERARCHY = 0x00400000, // Save Material - CK_STATESAVE_2DENTITYALL = 0x0070FFFF // Save All datas for sub-classes - }; - - //------------------------------------------------ - // Sprite - enum class CK_STATESAVEFLAGS_SPRITE : uint32_t { - - CK_STATESAVE_SPRITECURRENTIMAGE = 0x00010000, // Save current image - CK_STATESAVE_SPRITETRANSPARENT = 0x00020000, // Save transparency settings - CK_STATESAVE_SPRITEBITMAPS = 0x00040000, // Obsolete - CK_STATESAVE_SPRITESHARED = 0x00080000, // Save shared sprite - CK_STATESAVE_SPRITEDONOTUSE = 0x00100000, // Reseved by CK_STATESAVEFLAGS_2DENTITY - CK_STATESAVE_SPRITEAVIFILENAME = 0x00200000, // Obsolete - CK_STATESAVE_SPRITEFILENAMES = 0x00400000, // Obsolete - CK_STATESAVE_SPRITECOMPRESSED = 0x00800000, // Obsolete - CK_STATESAVE_SPRITEREADER = 0x10000000, // Reserved for future use - CK_STATESAVE_SPRITEFORMAT = 0x20000000, // Reserved for future use - CK_STATESAVE_SPRITEVIDEOFORMAT = 0x40000000, // Video Format - CK_STATESAVE_SPRITESYSTEMCACHING = 0x80000000, // System Memory Caching - CK_STATESAVE_SPRITERENDEROPTIONS = 0x80800000, // Render options if any... - CK_STATESAVE_SPRITEONLY = 0xF0EF0000, // Save only sprite specific data - CK_STATESAVE_SPRITEALL = 0x70FFFFFF // Save All datas for sub-classes - }; - - - //------------------------------------------------ - // Sprite Text - enum class CK_STATESAVEFLAGS_SPRITETEXT : uint32_t { - - CK_STATESAVE_SPRITETEXT = 0x01000000, // Save text - CK_STATESAVE_SPRITEFONT = 0x02000000, // Save font settings - CK_STATESAVE_SPRITETEXTCOLOR = 0x04000000, // Save text color - CK_STATESAVE_SPRITETEXTRESERVED = 0x08000000, // Reserved for future use - CK_STATESAVE_SPRITETEXTDOTNOTUSE = 0x10000000, // Reserved by CK_STATESAVE_SPRITEREADER - CK_STATESAVE_SPRITETEXTDONOTUSED2 = 0x20000000, // Reserved by CK_STATESAVE_SPRITEFORMAT - CK_STATESAVE_SPRITETEXTONLY = 0x0F000000, // Save only SpriteText specific data - CK_STATESAVE_SPRITETEXTALL = 0x3FFFFFFF // Save All datas for sub-classes - }; - - //------------------------------------------------ - // Sound - enum class CK_STATESAVEFLAGS_SOUND : uint32_t { - - CK_STATESAVE_SOUNDFILENAME = 0x00001000, // Reserved for future use - CK_STATESAVE_SOUNDRESERVED1 = 0x00002000, // Reserved for future use - CK_STATESAVE_SOUNDRESERVED2 = 0x00004000, // Reserved for future use - CK_STATESAVE_SOUNDRESERVED3 = 0x00008000, // Reserved for future use - CK_STATESAVE_SOUNDRESERVED4 = 0x00010000, // Reserved for future use - CK_STATESAVE_SOUNDRESERVED5 = 0x00020000, // Reserved for future use - CK_STATESAVE_SOUNDRESERVED6 = 0x00040000, // Reserved for future use - CK_STATESAVE_SOUNDRESERVED7 = 0x00080000, // Reserved for future use - CK_STATESAVE_SOUNDONLY = 0x000FF000, // Save only Sound specific data - CK_STATESAVE_SOUNDALL = 0x000FFFFF // Save All datas for sub-classes - }; - - //------------------------------------------------ - // Wave Sound - enum class CK_STATESAVEFLAGS_WAVSOUND : uint32_t { - - CK_STATESAVE_WAVSOUNDFILE = 0x00100000, // Save sound filename - CK_STATESAVE_WAVSOUNDDATA = 0x00200000, // Obsolete - CK_STATESAVE_WAVSOUNDDATA2 = 0x00400000, // Save sound properties (3D/2D,pitch,gain,streaming,loop,etc..) - CK_STATESAVE_WAVSOUNDDURATION = 0x00800000, // Sound Length (in case it cannot be calculated latter) - CK_STATESAVE_WAVSOUNDRESERVED4 = 0x01000000, // Reserved for future use - CK_STATESAVE_WAVSOUNDRESERVED5 = 0x02000000, // Reserved for future use - CK_STATESAVE_WAVSOUNDRESERVED6 = 0x04000000, // Reserved for future use - CK_STATESAVE_WAVSOUNDRESERVED7 = 0x08000000, // Reserved for future use - CK_STATESAVE_WAVSOUNDONLY = 0x0FF00000, // Save All datas for sub-classes - CK_STATESAVE_WAVSOUNDALL = 0x0FFFFFFF // Save All datas for sub-classes - }; - - - //------------------------------------------------ - // Wave Sound - enum class CK_STATESAVEFLAGS_MIDISOUND : uint32_t { - - CK_STATESAVE_MIDISOUNDFILE = 0x00100000, // Save sound filename - CK_STATESAVE_MIDISOUNDDATA = 0x00200000, // Save midi data - CK_STATESAVE_MIDISOUNDRESERVED2 = 0x00400000, // Reserved for future use - CK_STATESAVE_MIDISOUNDRESERVED3 = 0x00800000, // Reserved for future use - CK_STATESAVE_MIDISOUNDRESERVED4 = 0x01000000, // Reserved for future use - CK_STATESAVE_MIDISOUNDRESERVED5 = 0x02000000, // Reserved for future use - CK_STATESAVE_MIDISOUNDRESERVED6 = 0x04000000, // Reserved for future use - CK_STATESAVE_MIDISOUNDRESERVED7 = 0x08000000, // Reserved for future use - CK_STATESAVE_MIDISOUNDONLY = 0x0FF00000, - CK_STATESAVE_MIDISOUNDALL = 0x0FFFFFFF // Save All datas for sub-classes - }; - - - //------------------------------------------------ - // Place - enum class CK_STATESAVEFLAGS_PLACE : uint32_t { - - CK_STATESAVE_PLACEPORTALS = 0x00001000, // Save level using the place - CK_STATESAVE_PLACECAMERA = 0x00002000, // Save attached camera - CK_STATESAVE_PLACEREFERENCES = 0x00004000, // Save list of objects in the place - CK_STATESAVE_PLACELEVEL = 0x00008000, // Save level using the place - CK_STATESAVE_PLACEALL = 0x0000FFFF // Save All datas for sub-classes - }; - - //------------------------------------------------ - // Level - // CKSaveObjectState will not save any data - enum class CK_STATESAVEFLAGS_LEVEL : uint32_t { - - CK_STATESAVE_LEVELRESERVED0 = 0x00001000, // Reserved for future use - CK_STATESAVE_LEVELINACTIVEMAN = 0x00002000, // Reserved for future use - CK_STATESAVE_LEVELDUPLICATEMAN = 0x00004000, // Reserved for future use - CK_STATESAVE_LEVELDEFAULTDATA = 0x20000000, // Save Places,Scenes and Objects - CK_STATESAVE_LEVELSCENE = 0x80000000, // Default and active scene - CK_STATESAVE_LEVELALL = 0xFFFFFFFF // Save All datas for sub-classes - }; - - - - - //------------------------------------------------ - // GROUP - enum class CK_STATESAVEFLAGS_GROUP : uint32_t { - - CK_STATESAVE_GROUPDATA = 0x00001000, // Save list of objects in the group - CK_STATESAVE_GROUPRESERVED1 = 0x00002000, // Reserved for future use - CK_STATESAVE_GROUPRESERVED2 = 0x00004000, // Reserved for future use - CK_STATESAVE_GROUPRESERVED3 = 0x00008000, // Reserved for future use - CK_STATESAVE_GROUPRESERVED4 = 0x00010000, // Reserved for future use - CK_STATESAVE_GROUPRESERVED5 = 0x00020000, // Reserved for future use - CK_STATESAVE_GROUPRESERVED6 = 0x00040000, // Reserved for future use - CK_STATESAVE_GROUPRESERVED7 = 0x00080000, // Reserved for future use - CK_STATESAVE_GROUPALL = 0x000FFFFF // Save All datas for sub-classes - }; - - - //------------------------------------------------ - // MESH - // CKSaveOjectSave will save all data and does not take flags into account - enum class CK_STATESAVEFLAGS_MESH : uint32_t { - - CK_STATESAVE_MESHRESERVED0 = 0x00001000, // Reserved for future use - CK_STATESAVE_MESHFLAGS = 0x00002000, // Save flags - CK_STATESAVE_MESHCHANNELS = 0x00004000, // Save Channels - CK_STATESAVE_MESHFACECHANMASK = 0x00008000, // Save face channel Mask - CK_STATESAVE_MESHFACES = 0x00010000, // Save face data - CK_STATESAVE_MESHVERTICES = 0x00020000, // Save geometry - CK_STATESAVE_MESHLINES = 0x00040000, // Save line data - CK_STATESAVE_MESHWEIGHTS = 0x00080000, // Save Vertex Weight info - CK_STATESAVE_MESHMATERIALS = 0x00100000, // Reserved for future use - CK_STATESAVE_MESHRESERVED1 = 0x00200000, // Reserved for future use - CK_STATESAVE_MESHRESERVED2 = 0x00400000, // Reserved for future use - CK_STATESAVE_PROGRESSIVEMESH = 0x00800000, // Save All datas for sub-classes - CK_STATESAVE_MESHONLY = 0x00FFF000, // Save All datas for sub-classes - CK_STATESAVE_MESHALL = 0x00FFFFFF // Save All datas for sub-classes - }; - - - //------------------------------------------------ - // PATCH MESH - // CKSaveOjectSave will save all data and does not take flags into account - enum class CK_STATESAVEFLAGS_PATCHMESH : uint32_t { - - CK_STATESAVE_PATCHMESHDATA = 0x00800000, // Obsolete - CK_STATESAVE_PATCHMESHDATA2 = 0x01000000, // Obsolete - CK_STATESAVE_PATCHMESHSMOOTH = 0x02000000, // Obsolete - CK_STATESAVE_PATCHMESHMATERIALS = 0x04000000, // Obsolete - CK_STATESAVE_PATCHMESHDATA3 = 0x08000000, // Save Patch Data - CK_STATESAVE_PATCHMESHONLY = 0x0FF00000, // Save All datas for sub-classes - CK_STATESAVE_PATCHMESHALL = 0x0FFFFFFF // Save All datas for sub-classes - }; - - //------------------------------------------------- - // Material - enum class CK_STATESAVEFLAGS_MATERIAL : uint32_t { - - CK_STATESAVE_MATDATA = 0x00001000, // Save colors,blending modes,shade modes,fill modes etc... - CK_STATESAVE_MATDATA2 = 0x00002000, // Additional texture objects... - CK_STATESAVE_MATDATA3 = 0x00004000, // Effect Alone - CK_STATESAVE_MATDATA4 = 0x00008000, // none - CK_STATESAVE_MATDATA5 = 0x00010000, // Effect + parameter - CK_STATESAVE_MATRESERVED5 = 0x00020000, // Reserved for future use - CK_STATESAVE_MATRESERVED6 = 0x00040000, // Reserved for future use - CK_STATESAVE_MATRESERVED7 = 0x00080000, // Reserved for future use - CK_STATESAVE_MATERIALONLY = 0x000FF000, // Save All datas for sub-classes - CK_STATESAVE_MATERIALALL = 0x0FFFFFFF // Save All datas for sub-classes - }; - - //--------------------------------------------------- - // Texture - // CKSaveOjectSave will save all relevant data and does not take flags into account - enum class CK_STATESAVEFLAGS_TEXTURE : uint32_t { - - CK_STATESAVE_TEXAVIFILENAME = 0x00001000, // Save movie file name - CK_STATESAVE_TEXCURRENTIMAGE = 0x00002000, // Save current slot - CK_STATESAVE_TEXBITMAPS = 0x00004000, // Obsolete - CK_STATESAVE_TEXTRANSPARENT = 0x00008000, // Save transparency data - CK_STATESAVE_TEXFILENAMES = 0x00010000, // Save texture slot filenames - CK_STATESAVE_TEXCOMPRESSED = 0x00020000, // Save raw texture data - CK_STATESAVE_TEXVIDEOFORMAT = 0x00040000, // Save chosen video format - CK_STATESAVE_TEXSAVEFORMAT = 0x00080000, // Save chosen save format - CK_STATESAVE_TEXREADER = 0x00100000, // Save texture data using a specific BitmapReader - CK_STATESAVE_PICKTHRESHOLD = 0x00200000, // Save pick threshold - CK_STATESAVE_USERMIPMAP = 0x00400000, // User mipmap levels - CK_STATESAVE_TEXSYSTEMCACHING = 0x00800000, // System Memory Caching - CK_STATESAVE_OLDTEXONLY = 0x002FF000, // Kept for compatibility - CK_STATESAVE_TEXONLY = 0x00FFF000, // Save Only Texture Data (Dot NOT MODIFY ! Texture loading/saving relies on this value) - CK_STATESAVE_TEXALL = 0x002FFFFF // Save All datas for sub-classes - }; - - - //--------------------------------------------------- - // 2d CURVE - // && 2d Curve Point - enum class CK_STATESAVEFLAGS_2DCURVE : uint32_t { - - CK_STATESAVE_2DCURVERESERVED0 = 0x00000010, // Reserved for future use - CK_STATESAVE_2DCURVERESERVED4 = 0x00000020, // Reserved for future use - CK_STATESAVE_2DCURVEFITCOEFF = 0x00000040, // Obsolete - CK_STATESAVE_2DCURVECONTROLPOINT = 0x00000080, // Obsolete - CK_STATESAVE_2DCURVENEWDATA = 0x00000100, // Save All relevant data - CK_STATESAVE_2DCURVERESERVED2 = 0x00000200, // Obsolete - CK_STATESAVE_2DCURVERESERVED3 = 0x00000400, // Obsolete - CK_STATESAVE_2DCURVEPOINTTCB = 0x00000800, // Obsolete - CK_STATESAVE_2DCURVEPOINTTANGENTS = 0x00001000, // Obsolete - CK_STATESAVE_2DCURVEPOINT2DCURVEPOS = 0x00002000, // Obsolete - CK_STATESAVE_2DCURVEPOINTDEFAULTDATA = 0x00004000, // Obsolete - CK_STATESAVE_2DCURVEPOINTNEWDATA = 0x00008000, // Save All relevant data - CK_STATESAVE_2DCURVEPOINTRESERVED1 = 0x00010000, // Reserved for future use - CK_STATESAVE_2DCURVEPOINTRESERVED2 = 0x00020000, // Reserved for future use - CK_STATESAVE_2DCURVESAVEPOINTS = 0x0003F800, // Obsolete - CK_STATESAVE_2DCURVEALL = 0x0007FFFF // Save All datas for sub-classes - }; - - //--------------------------------------------------- - // Kinematic Chain - - enum class CK_STATESAVEFLAGS_KINEMATICCHAIN : uint32_t { - - CK_STATESAVE_KINEMATICCHAINDATA = 0x00000010, // Save chain data - CK_STATESAVE_KINEMATICCHAINRESERVED1 = 0x00000020, // Reserved for future use - CK_STATESAVE_KINEMATICCHAINRESERVED2 = 0x00000040, // Reserved for future use - CK_STATESAVE_KINEMATICCHAINRESERVED3 = 0x00000080, // Reserved for future use - CK_STATESAVE_KINEMATICCHAINALL = 0x000000FF // Save All datas for sub-classes - }; - - //--------------------------------------------------- - // Animation - enum class CK_STATESAVEFLAGS_ANIMATION : uint32_t { - - CK_STATESAVE_ANIMATIONDATA = 0x00000010, // Save Flags & Framerate data - CK_STATESAVE_ANIMATIONRESERVED1 = 0x00000020, // Reserved for future use - CK_STATESAVE_ANIMATIONLENGTH = 0x00000040, // Save animation Length - CK_STATESAVE_ANIMATIONBODYPARTS = 0x00000080, // Save root & list of bodypart - CK_STATESAVE_ANIMATIONCHARACTER = 0x00000100, // Save character - CK_STATESAVE_ANIMATIONCURRENTSTEP = 0x00000200, // Save current step - CK_STATESAVE_ANIMATIONRESERVED5 = 0x00000400, // Reserved for future use - CK_STATESAVE_ANIMATIONRESERVED6 = 0x00000800, // Reserved for future use - CK_STATESAVE_ANIMATIONALL = 0x0FFFFFFF // Save All datas for sub-classes - }; - - //--------------------------------------------------- - // Keyed Anim - enum class CK_STATESAVEFLAGS_KEYEDANIMATION : uint32_t { - - CK_STATESAVE_KEYEDANIMANIMLIST = 0x00001000, // Save list of object animations - CK_STATESAVE_KEYEDANIMLENGTH = 0x00002000, // Obsolete - CK_STATESAVE_KEYEDANIMPOSKEYS = 0x00004000, // Obsolete - CK_STATESAVE_KEYEDANIMROTKEYS = 0x00008000, // Obsolete - CK_STATESAVE_KEYEDANIMMORPHKEYS = 0x00010000, // Obsolete - CK_STATESAVE_KEYEDANIMSCLKEYS = 0x00020000, // Obsolete - CK_STATESAVE_KEYEDANIMFLAGS = 0x00040000, // Obsolete - CK_STATESAVE_KEYEDANIMENTITY = 0x00080000, // Obsolete - CK_STATESAVE_KEYEDANIMMERGE = 0x00100000, // Save merged animations - CK_STATESAVE_KEYEDANIMSUBANIMS = 0x00200000, // Save object animations data (using same flags than CKSaveObjectState) - CK_STATESAVE_KEYEDANIMRESERVED0 = 0x00400000, // Reserved for future use - CK_STATESAVE_KEYEDANIMRESERVED1 = 0x00800000, // Reserved for future use - CK_STATESAVE_KEYEDANIMRESERVED2 = 0x01000000, // Reserved for future use - CK_STATESAVE_KEYEDANIMRESERVED3 = 0x02000000 // Reserved for future use - }; - - - //--------------------------------------------------- - // Object Animation - // CKSaveOjectSave will save all relevant data and does not take flags into account - enum class CK_STATESAVEFLAGS_OBJECTANIMATION : uint32_t { - - CK_STATESAVE_OBJANIMNEWDATA = 0x00001000, // Save all relevant data - CK_STATESAVE_OBJANIMLENGTH = 0x00002000, // Not used - CK_STATESAVE_OBJANIMPOSKEYS = 0x00004000, // Not used - CK_STATESAVE_OBJANIMROTKEYS = 0x00008000, // Not used - CK_STATESAVE_OBJANIMMORPHKEYS = 0x00010000, // Not used - CK_STATESAVE_OBJANIMSCLKEYS = 0x00020000, // Not used - CK_STATESAVE_OBJANIMFLAGS = 0x00040000, // Not used - CK_STATESAVE_OBJANIMENTITY = 0x00080000, // Not used - CK_STATESAVE_OBJANIMMERGE = 0x00100000, // Not used - CK_STATESAVE_OBJANIMMORPHKEYS2 = 0x00200000, // Not used - CK_STATESAVE_OBJANIMNEWSAVE1 = 0x00400000, // Not used - CK_STATESAVE_OBJANIMMORPHNORMALS = 0x00800000, // Not used (Virtools 1.1) - CK_STATESAVE_OBJANIMMORPHCOMP = 0x01000000, // Not used (Virtools 1.1) - CK_STATESAVE_OBJANIMSHARED = 0x02000000, // Save Data for a shared animation - CK_STATESAVE_OBJANIMCONTROLLERS = 0x04000000, // (Virtools 1.5) Save All Controller information - CK_STATESAVE_OBJANIMONLY = 0x07FFF000, - CK_STATESAVE_OBJANIMALL = 0x07FFFFFF, - CK_STATESAVE_KEYEDANIMONLY = 0x03FFF000, // Save All datas for sub-classes - CK_STATESAVE_KEYEDANIMALL = 0x03FFFFFF // Save All datas for sub-classes - }; - - - //--------------------------------------------------- - // IK Animation - enum class CK_STATESAVEFLAGS_IKANIMATION : uint32_t { - - CK_STATESAVE_IKANIMATIONDATA = 0x00001000, // Save IK data - CK_STATESAVE_IKANIMATIONRESERVED2 = 0x00002000, // Reserved for future use - CK_STATESAVE_IKANIMATIONRESERVED3 = 0x00004000, // Reserved for future use - CK_STATESAVE_IKANIMATIONRESERVED4 = 0x00008000, // Reserved for future use - CK_STATESAVE_IKANIMATIONRESERVED5 = 0x00010000, // Reserved for future use - CK_STATESAVE_IKANIMATIONRESERVED6 = 0x00020000, // Reserved for future use - CK_STATESAVE_IKANIMATIONRESERVED7 = 0x00040000, // Reserved for future use - CK_STATESAVE_IKANIMATIONRESERVED8 = 0x00100000, // Reserved for future use - CK_STATESAVE_IKANIMATIONRESERVED9 = 0x00200000, // Reserved for future use - CK_STATESAVE_IKANIMATIONALL = 0x003FFFFF // Save All datas for sub-classes - }; - - //--------------------------------------------------- - // BehaviorLink - enum class CK_STATESAVEFLAGS_BEHAV_LINK : uint32_t { - - CK_STATESAVE_BEHAV_LINK_CURDELAY = 0x00000004, // Obsolete - CK_STATESAVE_BEHAV_LINK_IOS = 0x00000008, // Obsolete - CK_STATESAVE_BEHAV_LINK_DELAY = 0x00000010, // Obsolete - CK_STATESAVE_BEHAV_LINK_NEWDATA = 0x00000020, // Save all relevant data (In,Out,Activation delay) - CK_STATESAVE_BEHAV_LINKRESERVED5 = 0x00000040, // Reserved for future use - CK_STATESAVE_BEHAV_LINKRESERVED6 = 0x00000080, // Reserved for future use - CK_STATESAVE_BEHAV_LINKONLY = 0x000000F0, // - CK_STATESAVE_BEHAV_LINKALL = 0x000000FF // Save All datas for sub-classes - }; - - //--------------------------------------------------- - // BehaviorIO - enum class CK_STATESAVEFLAGS_BEHAV_IO : uint32_t { - - CK_STATESAVE_BEHAV_IOFLAGS = 0x00000008, // Save IO flags - CK_STATESAVE_BEHAV_IORESERVED3 = 0x00000010, // Reserved for future use - CK_STATESAVE_BEHAV_IORESERVED4 = 0x00000020, // Reserved for future use - CK_STATESAVE_BEHAV_IORESERVED5 = 0x00000040, // Reserved for future use - CK_STATESAVE_BEHAV_IORESERVED6 = 0x00000080, // Reserved for future use - CK_STATESAVE_BEHAVIOONLY = 0x000000F0, // - CK_STATESAVE_BEHAVIOALL = 0x000000FF // Save All datas for sub-classes - }; - - //--------------------------------------------------- - // BehaviorPrototype - enum class CK_STATESAVEFLAGS_PROTOTYPE : uint32_t { - - CK_STATESAVE_PROTORESERVED0 = 0x00000010, // Reserved for future use - CK_STATESAVE_PROTORESERVED1 = 0x00000020, // Reserved for future use - CK_STATESAVE_PROTOFLAGS = 0x00000040, // Save Flags - CK_STATESAVE_PROTOSUBPROTOS = 0x00000080, // Save sub prototypes - CK_STATESAVE_PROTOLINKS = 0x00000100, // Save links - CK_STATESAVE_PROTOBEHAVFLAG = 0x00000200, // Save behavior flags - CK_STATESAVE_PROTOGUID = 0x00000400, // Save GUID - CK_STATESAVE_PROTOINPUTS = 0x00000800, // Save inputs - CK_STATESAVE_PROTOOUTPUTS = 0x00001000, // Save outputs - CK_STATESAVE_PROTOINPARAMS = 0x00002000, // Save input parameters - CK_STATESAVE_PROTOOUTPARAMS = 0x00004000, // Save output parameters - CK_STATESAVE_PROTOLOCALPARAMS = 0x00008000, // Save local parameters - CK_STATESAVE_PROTOOPERATIONS = 0x00010000, // Save parameter operations - CK_STATESAVE_PROTOPARAMETERLINKS = 0x00020000, // Save parameter links - CK_STATESAVE_PROTOAPPLYTO = 0x00040000, // Save ClassID of object to which it applies - CK_STATESAVE_PROTORESERVED14 = 0x00080000, // Reserved for future use - CK_STATESAVE_PROTOALL = 0x000FFFFF // Save All datas for sub-classes - }; - - - //--------------------------------------------------- - // Behavior - enum class CK_STATESAVEFLAGS_BEHAVIOR : uint32_t { - - CK_STATESAVE_BEHAVIORRESERVED0 = 0x00000010, // Reserved for internal use - CK_STATESAVE_BEHAVIORNEWDATA = 0x00000020, // not used - CK_STATESAVE_BEHAVIORFLAGS = 0x00000040, // not used - CK_STATESAVE_BEHAVIORCOMPATIBLECID = 0x00000080, // not used - CK_STATESAVE_BEHAVIORSUBBEHAV = 0x00000100, // Save Sub-Behaviors - CK_STATESAVE_BEHAVIORINPARAMS = 0x00000200, // not used - CK_STATESAVE_BEHAVIOROUTPARAMS = 0x00000400, // not used - CK_STATESAVE_BEHAVIORINPUTS = 0x00000800, // not used - CK_STATESAVE_BEHAVIOROUTPUTS = 0x00001000, // not used - CK_STATESAVE_BEHAVIORINFO = 0x00002000, // not used - CK_STATESAVE_BEHAVIOROPERATIONS = 0x00004000, // not used - CK_STATESAVE_BEHAVIORTYPE = 0x00008000, // not used - CK_STATESAVE_BEHAVIOROWNER = 0x00010000, // not used - CK_STATESAVE_BEHAVIORLOCALPARAMS = 0x00020000, // Save local parameters - CK_STATESAVE_BEHAVIORPROTOGUID = 0x00040000, // not used - CK_STATESAVE_BEHAVIORSUBLINKS = 0x00080000, // not used - CK_STATESAVE_BEHAVIORACTIVESUBLINKS = 0x00100000, // not used - CK_STATESAVE_BEHAVIORSINGLEACTIVITY = 0x00200000, // SINGLE ACTIVITY - CK_STATESAVE_BEHAVIORSCRIPTDATA = 0x00400000, // not used - CK_STATESAVE_BEHAVIORPRIORITY = 0x00800000, // not used - CK_STATESAVE_BEHAVIORTARGET = 0x01000000, // not used - CK_STATESAVE_BEHAVIORONLY = 0x01FFFFF0, - CK_STATESAVE_BEHAVIORALL = 0x01FFFFFF // Save All datas for sub-classes - }; - - - - - //--------------------------------------------------- - // SCENE - // CKSaveOjectSave will save all relevant data and does not take flags into account - enum class CK_STATESAVEFLAGS_SCENE : uint32_t { - - CK_STATESAVE_SCENERESERVED0 = 0x00001000, // Reserved for future use - CK_STATESAVE_SCENERESERVED8 = 0x00002000, // Reserved for future use - CK_STATESAVE_SCENEFLAGS = 0x00004000, - CK_STATESAVE_SCENELEVEL = 0x00008000, - CK_STATESAVE_SCENEOBJECTS = 0x00010000, - CK_STATESAVE_SCENENEWDATA = 0x00020000, // every object description and initial conditions - CK_STATESAVE_SCENELAUNCHED = 0x00040000, // Scene was already launched once - CK_STATESAVE_SCENERENDERSETTINGS = 0x00080000, // Background Color, Fog Color etc.. - CK_STATESAVE_SCENERESERVED1 = 0x00100000, // Reserved for future use - CK_STATESAVE_SCENERESERVED2 = 0x00200000, // Reserved for future use - CK_STATESAVE_SCENERESERVED3 = 0x00400000, // Reserved for future use - CK_STATESAVE_SCENERESERVED4 = 0x00800000, // Reserved for future use - CK_STATESAVE_SCENERESERVED5 = 0x01000000, // Reserved for future use - CK_STATESAVE_SCENERESERVED12 = 0x02000000, // Reserved for future use - CK_STATESAVE_SCENERESERVED13 = 0x04000000, // Reserved for future use - CK_STATESAVE_SCENERESERVED14 = 0x08000000, // Reserved for future use - CK_STATESAVE_SCENEALL = 0x0FFFFFFF // Save All datas for sub-classes - }; - - - //--------------------------------------------------- - // ParameterIn - enum class CK_STATESAVEFLAGS_PARAMETERIN : uint32_t { - - CK_STATESAVE_PARAMETERIN_RESERVED4 = 0x00000010, // Reserved for future use - CK_STATESAVE_PARAMETERIN_RESERVED0 = 0x00000020, // Reserved for future use - CK_STATESAVE_PARAMETERIN_RESERVED1 = 0x00000040, // Reserved for future use - CK_STATESAVE_PARAMETERIN_OWNER = 0x00000080, // Obsolete - CK_STATESAVE_PARAMETERIN_INSHARED = 0x00000100, // Obsolete - CK_STATESAVE_PARAMETERIN_OUTSOURCE = 0x00000200, // Obsolete - CK_STATESAVE_PARAMETERIN_DEFAULTDATA = 0x00000400, // Obsolete - CK_STATESAVE_PARAMETERIN_DATASHARED = 0x00000800, // Save reference to shared inparameter - CK_STATESAVE_PARAMETERIN_DATASOURCE = 0x00001000, // Save reference to source outparameter - CK_STATESAVE_PARAMETERIN_DISABLED = 0x00002000, // The parameter was disabled - CK_STATESAVE_PARAMETERIN_ALL = 0x0000FFFF // Save All datas for sub-classes - }; - - //--------------------------------------------------- - // ParameterLocal et ParameterOut - enum class CK_STATESAVEFLAGS_PARAMETEROUT : uint32_t { - - CK_STATESAVE_PARAMETEROUT_RESERVED0 = 0x00000010, // Reserved for future use - CK_STATESAVE_PARAMETEROUT_DESTINATIONS = 0x00000020, // Save destinations - CK_STATESAVE_PARAMETEROUT_VAL = 0x00000040, // Save value - CK_STATESAVE_PARAMETEROUT_OWNER = 0x00000080, // Save Owner - CK_STATESAVE_PARAMETEROUT_MYSELF = 0x00000200, // - CK_STATESAVE_PARAMETEROUT_ISSETTING = 0x00000400, // Reserved for future use - CK_STATESAVE_PARAMETEROUT_ALL = 0x0000FFFF // Save All datas for sub-classes - }; - - - //--------------------------------------------------- - // Parameter Operation - - enum class CK_STATESAVEFLAGS_OPERATION : uint32_t { - - CK_STATESAVE_OPERATIONRESERVED0 = 0x00000010, // Reserved for future use - CK_STATESAVE_OPERATIONRESERVED1 = 0x00000020, // Reserved for future use - CK_STATESAVE_OPERATIONINPUTS = 0x00000040, - CK_STATESAVE_OPERATIONOUTPUT = 0x00000080, - CK_STATESAVE_OPERATIONOP = 0x00000100, - CK_STATESAVE_OPERATIONDEFAULTDATA = 0x00000200, - CK_STATESAVE_OPERATIONNEWDATA = 0x00000400, - CK_STATESAVE_OPERATIONALL = 0x000007FF // Save All datas for sub-classes - }; - - - //--------------------------------------------------- - // Synchro Object - // CKSaveOjectSave will save all relevant data and does not take flags into account - enum class CK_STATESAVEFLAGS_SYNCHRO : uint32_t { - - CK_STATESAVE_SYNCHRODATA = 0x00000010, // Save data - CK_STATESAVE_SYNCHRORESERVED0 = 0x00000040, // Reserved for future use - CK_STATESAVE_SYNCHRORESERVED1 = 0x00000080, // Reserved for future use - CK_STATESAVE_SYNCHRORESERVED2 = 0x00000100, // Reserved for future use - CK_STATESAVE_SYNCHRORESERVED3 = 0x00000200, // Reserved for future use - CK_STATESAVE_SYNCHRONALL = 0x000003FF // Save All datas for sub-classes - }; - - //------------------------------------------------ - // Grid - enum class CK_STATESAVEFLAGS_GRID : uint32_t { - - CK_STATESAVE_GRIDDATA = 0x00400000, // Save Grid Data - CK_STATESAVE_GRIDRESERVED0 = 0x00800000, // Reserved for future use - CK_STATESAVE_GRIDRESERVED1 = 0x01000000, // Reserved for future use - CK_STATESAVE_GRIDRESERVED2 = 0x02000000, // Reserved for future use - CK_STATESAVE_GRIDRESERVED3 = 0x04000000, // Reserved for future use - CK_STATESAVE_GRIDRESERVED4 = 0x08000000, // Reserved for future use - CK_STATESAVE_GRIDONLY = 0x0FC00000, // - CK_STATESAVE_GRIDALL = 0x0FFFFFFF // Save All datas for sub-classes - }; - - - //------------------------------------------------ - // Layer (For Grids) - enum class CK_STATESAVEFLAGS_LAYER : uint32_t { - - CK_STATESAVE_LAYERDATA = 0x00000010, // Save Layer Data - CK_STATESAVE_LAYERRESERVED0 = 0x00800020, // Reserved for future use - CK_STATESAVE_LAYERRESERVED1 = 0x00000040, // Reserved for future use - CK_STATESAVE_LAYERRESERVED2 = 0x00000080, // Reserved for future use - CK_STATESAVE_LAYERRESERVED3 = 0x00000100, // Reserved for future use - CK_STATESAVE_LAYERRESERVED4 = 0x00000200, // Reserved for future use - CK_STATESAVE_LAYERONLY = 0x000003F0, // - CK_STATESAVE_LAYERALL = 0x000003FF // Save All datas for sub-classes - }; - - //------------------------------------------------ - // DataArray - // CKSaveOjectSave will save all relevant data and does not take flags into account - enum class CK_STATESAVEFLAGS_DATAARRAY : uint32_t { - - CK_STATESAVE_DATAARRAYFORMAT = 0x00001000, // Save format - CK_STATESAVE_DATAARRAYDATA = 0x00002000, // Save array data - CK_STATESAVE_DATAARRAYMEMBERS = 0x00004000, // Save members - CK_STATESAVE_DATAARRAYALL = 0x0000FFFF // Save All datas for sub-classes - }; - - - //------------------------------------------------ - // SceneObjectDesc - enum class CK_STATESAVEFLAGS_SCENEOBJECTDESC : uint32_t { - - - CK_STATESAVE_SCENEOBJECTDESC = 0x00000010, - CK_STATESAVE_SCENEOBJECTRES1 = 0x00000020, // Reserved for future use - CK_STATESAVE_SCENEOBJECTRES2 = 0x00000040, // Reserved for future use - CK_STATESAVE_SCENEOBJECTRES3 = 0x00000080, // Reserved for future use - CK_STATESAVE_SCENEOBJECTDESCALL = 0x000000FF // Save All datas for sub-classes - - }; - - -} \ No newline at end of file diff --git a/LibCmo/CKMinContext.hpp b/LibCmo/CKMinContext.hpp deleted file mode 100644 index 508e571..0000000 --- a/LibCmo/CKMinContext.hpp +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include "CKDefines.hpp" -#include "CKEnums.hpp" -#include "VTEncoding.hpp" -#include -#include -#include - -namespace LibCmo::CK2 { - - class CKMinContext { - public: - CKMinContext(); - CKMinContext(const CKMinContext&) = delete; - CKMinContext& operator=(const CKMinContext&) = delete; - ~CKMinContext(); - - using PrintCallback = std::function; - void Printf(CKSTRING fmt, ...); - void SetPrintCallback(PrintCallback cb); - - CKObjectImplements::CKObject* CreateCKObject(CK_ID id, CK_CLASSID cls, CKSTRING name); - CKObjectImplements::CKObject* GetCKObject(CK_ID id); - void DestroyCKObject(CK_ID id); - void ClearCKObject(void); - - //CKManagerImplements::CKBaseManager* CreateCKManager(CKGUID guid); - //CKManagerImplements::CKBaseManager* GetCKManager(CK_ID guid); - //void DestroyCKManager(CKManagerImplements::CKBaseManager* mgr); - - CK_ID GetObjectMaxID(void); - void SetObjectMaxID(CK_ID id); - - void GetUtf8String(const std::string& native_name, std::string& u8_name); - void GetNativeString(const std::string& u8_name, std::string& native_name); - - void SetEncoding(const std::vector encoding_series); - void SetTempPath(CKSTRING u8_temp); - - FILE* OpenTempFile(CKSTRING u8_filename, bool is_read); - - private: - std::map m_ObjectsList; - std::map m_ManagersList; - - std::map> m_ObjectsCreationMap; - std::map> m_ManagersCreationMap; - - CK_ID m_CKObjectMaxID; - - std::vector m_NameEncoding; - std::filesystem::path m_TempFolder; - PrintCallback m_PrintCallback; - }; - -} diff --git a/LibCmo/CKObjects.cpp b/LibCmo/CKObjects.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/LibCmo/LibCmo.vcxproj b/LibCmo/LibCmo.vcxproj index dc462ba..fe9d84d 100644 --- a/LibCmo/LibCmo.vcxproj +++ b/LibCmo/LibCmo.vcxproj @@ -104,6 +104,8 @@ stdcpp20 /utf-8 %(AdditionalOptions) true + Create + VTAll.hpp Console @@ -123,6 +125,8 @@ stdcpp20 /utf-8 %(AdditionalOptions) true + Create + VTAll.hpp Console @@ -142,6 +146,8 @@ stdcpp20 /utf-8 %(AdditionalOptions) true + Create + VTAll.hpp Console @@ -163,6 +169,8 @@ stdcpp20 /utf-8 %(AdditionalOptions) true + Create + VTAll.hpp Console @@ -175,32 +183,35 @@ - - - - - - - + + + + + + - - + + - + - - - - - - - - + + + + + + + + + + - + - + + + diff --git a/LibCmo/LibCmo.vcxproj.filters b/LibCmo/LibCmo.vcxproj.filters index 03034f3..16a997b 100644 --- a/LibCmo/LibCmo.vcxproj.filters +++ b/LibCmo/LibCmo.vcxproj.filters @@ -13,49 +13,70 @@ {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - {a8cd2188-b552-478c-9801-a6286b3d48a0} + + {bef3546d-1182-4641-a95f-59edb8326e2a} - + + {fe29ae7b-12c4-43b9-b7ae-c09c473e9ee9} + + + {d8192b09-d1fa-438f-a4ae-a4019b05cef3} + + + {7724b40c-b489-4639-a5d8-0cefc7b5a951} + + + {26f55ef2-f788-474f-a908-6488986ad03a} + + + {3dee80b5-d27a-4071-9194-3c817ba38c4c} + + + {bc2c80b7-8622-41f4-9bef-480a71430eb8} + + + {9bec41df-78db-4753-ab80-86345545227d} + + {784282d9-4adb-40ca-bbac-902c74e9a2e5} + + {a8cd2188-b552-478c-9801-a6286b3d48a0} + - - Sources - Sources - - Sources - - - Sources - - - Sources - - - Sources\CKObjectImplements - - - Sources - - - Sources - - - Sources + + Sources\CK2\CKObjectImplements Sources - - Sources\CKManagerImplements + + Sources\CK2\CKManagerImplements - - Sources + + Sources\VxMath + + + Sources\CK2 + + + Sources\CK2 + + + Sources\CK2 + + + Sources\CK2 + + + Sources\CK2 + + + Sources\CK2 @@ -65,35 +86,47 @@ Headers - + + Headers\CK2 + + + Headers\CK2 + + + Headers\CK2 + + + Headers\CK2 + + + Headers\CK2 + + + Headers\CK2 + + + Headers\CK2 + + + Headers\CK2 + + + Headers\VxMath + + + Headers\VxMath + + + Headers\XContainer + + Headers - - Headers + + Headers\CK2\CKObjectImplements - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers - - - Headers + + Headers\CK2\CKManagerImplements \ No newline at end of file diff --git a/LibCmo/VTAll.hpp b/LibCmo/VTAll.hpp new file mode 100644 index 0000000..0885559 --- /dev/null +++ b/LibCmo/VTAll.hpp @@ -0,0 +1,26 @@ +#pragma once + +/* +The general including header for LibCom self developer. +Every hpp or cpp file should include this first except +the headers including this file. + +This header only fulfill type requirements. If you want +some implement based operations, such as calling +CKStateChunk or CKContext function. You should include them manually. + +This file is used as Pre-compiled header in Visual Studio. + +*/ +#include "VTUtils.hpp" +#include "VTEncoding.hpp" + +#include "CK2/CKTypes.hpp" // the basic type of Virtools. +#include "CK2/CKDefines.hpp" // some useful define or constexpr for Virtools. +#include "CK2/CKEnums.hpp" // All CK used enums except CKStateChunk identifiers. +#include "CK2/CKIdentifiers.hpp" // CKStateChunk identifiers. +#include "CK2/CKGlobals.hpp" // CK global functions, such as CKUnPack and etc. + +#include "VxMath/VxTypes.hpp" + +#include "XContainer/XTypes.hpp" diff --git a/LibCmo/VTUtils.hpp b/LibCmo/VTUtils.hpp index c5c1667..1a354a2 100644 --- a/LibCmo/VTUtils.hpp +++ b/LibCmo/VTUtils.hpp @@ -47,41 +47,46 @@ #include #include -namespace LibCmo { +#pragma region Enum Helper - namespace EnumsHelper { - template - inline TEnum FlagEnumMerge(std::initializer_list il) { - std::underlying_type_t result = 0u; - for (auto it = il.begin(); it != il.end(); ++it) { - result |= static_cast>(*it); - } - return static_cast(result); - } - - template - inline TEnum FlagEnumInv(TEnum e) { - return static_cast(~(static_cast>(e))); - } - - template - inline void FlagEnumRm(TEnum& e, std::initializer_list il) { - auto mask = FlagEnumInv(FlagEnumMerge(il)); - e = static_cast(static_cast>(e) & static_cast>(mask)); - } - - template - inline void FlagEnumAdd(TEnum& e, std::initializer_list il) { - auto mask = FlagEnumMerge(il); - e = static_cast(static_cast>(e) | static_cast>(mask)); - } - - template - inline bool FlagEnumHas(TEnum e, TEnum probe) { - return static_cast(static_cast>(e) & static_cast>(probe)); - } +#define LIBCMO_BITFLAG_OPERATORS_BITWISE(OP, ENUM_TYPE) \ + constexpr ENUM_TYPE operator OP(ENUM_TYPE lhs, ENUM_TYPE rhs) noexcept { \ + typedef std::underlying_type_t underlying; \ + return static_cast(static_cast(lhs) OP static_cast(rhs)); \ + } \ + constexpr ENUM_TYPE& operator OP ## = (ENUM_TYPE& lhs, ENUM_TYPE rhs) noexcept { \ + return (lhs = lhs OP rhs); \ } +#define LIBCMO_BITFLAG_OPERATORS_BOOLEAN(OP, ENUM_TYPE) \ + constexpr bool operator OP(ENUM_TYPE lhs, std::underlying_type_t rhs) noexcept { \ + return static_cast>(lhs) OP rhs; \ + } \ + constexpr bool operator OP(std::underlying_type_t lhs, ENUM_TYPE rhs) noexcept { \ + return lhs OP static_cast>(rhs); \ + } + +#define LIBCMO_BITFLAG_OPERATORS(ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BITWISE(|, ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BITWISE(&, ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BITWISE(^, ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BOOLEAN(==, ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BOOLEAN(!=, ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BOOLEAN(<, ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BOOLEAN(>, ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BOOLEAN(>=, ENUM_TYPE) \ + LIBCMO_BITFLAG_OPERATORS_BOOLEAN(<=, ENUM_TYPE) \ + constexpr ENUM_TYPE operator~(ENUM_TYPE e) noexcept { \ + return static_cast(~static_cast>(e)); \ + } \ + constexpr bool operator!(ENUM_TYPE e) noexcept { \ + return static_cast(static_cast>(e)); \ + } + +#pragma endregion + +namespace LibCmo { + namespace StreamHelper { void CopyStream(const void* src, FILE* dest, size_t len); diff --git a/LibCmo/VxMemoryMappedFile.cpp b/LibCmo/VxMath/VxMemoryMappedFile.cpp similarity index 100% rename from LibCmo/VxMemoryMappedFile.cpp rename to LibCmo/VxMath/VxMemoryMappedFile.cpp diff --git a/LibCmo/VxMemoryMappedFile.hpp b/LibCmo/VxMath/VxMemoryMappedFile.hpp similarity index 100% rename from LibCmo/VxMemoryMappedFile.hpp rename to LibCmo/VxMath/VxMemoryMappedFile.hpp diff --git a/LibCmo/VxMath/VxTypes.hpp b/LibCmo/VxMath/VxTypes.hpp new file mode 100644 index 0000000..f85906b --- /dev/null +++ b/LibCmo/VxMath/VxTypes.hpp @@ -0,0 +1,108 @@ +#pragma once + +#include +#include +#include +#include +#include "../CK2/CKTypes.hpp" + +/** + * @brief The VxMath part of LibCmo. + * These classes are prefixed with Vx in original Virtools SDK. +*/ +namespace LibCmo::VxMath { + + // ========== Type Definition ========== + + + // ========== Class List ========== + //--- Important classes + + class VxMemoryMappedFile; + + //---- Misc + + /** + * @brief Class representation of a Vector in 3 dimensions + */ + struct VxVector { + float x, y, z; + + VxVector() : x(0.0f), y(0.0f), z(0.0f) {} + VxVector(float f) : x(f), y(f), z(f) {} + VxVector(float _x, float _y, float _z) : x(_x), y(_y), z(_z) {} + VxVector(const float f[3]) : x(f[0]), y(f[1]), z(f[2]) {} + }; + + /** + * @brief Class representation of a Vector in 2 dimensions + */ + struct Vx2DVector { + float x, y; + + Vx2DVector() : x(0.0f), y(0.0f) {} + Vx2DVector(float f) : x(f), y(f) {} + Vx2DVector(float _x, float _y, float _z) : x(_x), y(_y) {} + Vx2DVector(CK2::CKINT iX, CK2::CKINT iY) : x((float)iX), y((float)iY) {} + Vx2DVector(const float f[2]) : x(f[0]), y(f[1]) {} + }; + + /** + * @brief Class representation of a Quaternion + */ + struct VxQuaternion { + float x, y, z, w; + + VxQuaternion() : x(0.0f), y(0.0f), z(0.0f), w(1.0f) {} + VxQuaternion(float X, float Y, float Z, float W) : x(X), y(Y), z(Z), w(W) {} + }; + + struct VxMatrix { + float m_Data[4][4]; + + VxMatrix() : m_Data() { + std::memset(m_Data, 0, sizeof(m_Data)); + m_Data[0][0] = m_Data[1][1] = m_Data[2][2] = m_Data[3][3] = 1.0f; + } + VxMatrix(float m[4][4]) : m_Data() { std::memcpy(m_Data, m, sizeof(m_Data)); } + }; + + /** + * @brief Enhanced Image description + * @remark The VxImageDescEx holds basically an VxImageDesc with additionnal support for + * Colormap, Image pointer and is ready for future enhancements. + */ + struct VxImageDescEx { + CK2::CKINT Size; ///< Size of the structure + CK2::CKDWORD Flags; ///< Reserved for special formats (such as compressed ) 0 otherwise + + CK2::CKINT Width; ///< Width in pixel of the image + CK2::CKINT Height; ///< Height in pixel of the image + union { + CK2::CKINT BytesPerLine; ///< Pitch (width in bytes) of the image + CK2::CKINT TotalImageSize; ///< For compressed image (DXT1...) the total size of the image + }; + CK2::CKINT BitsPerPixel; ///< Number of bits per pixel + union { + CK2::CKDWORD RedMask; ///< Mask for Red component + CK2::CKDWORD BumpDuMask; ///< Mask for Bump Du component + }; + union { + CK2::CKDWORD GreenMask; ///< Mask for Green component + CK2::CKDWORD BumpDvMask; ///< Mask for Bump Dv component + }; + union { + CK2::CKDWORD BlueMask; ///< Mask for Blue component + CK2::CKDWORD BumpLumMask; ///< Mask for Luminance component + + }; + CK2::CKDWORD AlphaMask; ///< Mask for Alpha component + + CK2::CKWORD BytesPerColorEntry; ///< ColorMap Stride + CK2::CKWORD ColorMapEntries; ///< If other than 0 image is palletized + + CK2::CKBYTE* ColorMap; ///< Palette colors + CK2::CKBYTE* Image; ///< Image + }; + +} diff --git a/LibCmo/XContainer/XTypes.hpp b/LibCmo/XContainer/XTypes.hpp new file mode 100644 index 0000000..3eff615 --- /dev/null +++ b/LibCmo/XContainer/XTypes.hpp @@ -0,0 +1,111 @@ +#pragma once + +#include +#include +#include +#include +#include +#include "../CK2/CKTypes.hpp" + +/** + * @brief The X container part of LibCmo. + * These classes are prefixed with X in original Virtools SDK. +*/ +namespace LibCmo::XContainer { + + /** + @brief Class representation of a string (an array of character ended by NULL). + @remark This class now use std::string. + */ + using XString = std::string; + + /** + @brief Set of bit flags. + @remark This class now use specialized std::vector. + */ + using XBitArray = std::vector; + + /** + @brief Class representation of an array. + @tparam T Element Type. + @remark This class now use std::vector. + @see XClassArray, XSArray + */ + template + using XArray = std::vector; + /** + @brief Class representation of an array. + @tparam T Element Type. + @details Equivalent to XArray becasue memory reducing is useless. + @see XArray + */ + template + using XSArray = XArray; + /** + @brief Class representation of an array. + @tparam T Element Type. + @details Equivalent to XArray because std::vector can fufill the requirements. + @see XArray + */ + template + using XClassArray = XArray; + + /** + @brief Container class for CKObject Id's. + @remark + + This class use the template container XArray to contain object CK_ID's. + + Supports for Check, Load, Save, Add, Remove, Find functions in the Object CK_ID array. + @todo May independ this class to implement the functions introduced in remarks. + @see XObjectPointerArray, CKObjectArray + */ + using XObjectArray = XArray; + /** + @brief Container class for CKObject Id's + @details Equivalent to XObjectArray becasue memory reducing is useless. + @see XObjectArray + */ + using XSObjectArray = XObjectArray; + + /** + @brief Container class for CKObject pointers. + @remark + + Exactly same as XObjectArray class, but uses XArray (Pre-allocated items) + for storing pointers, and not IDs (more efficient to retrieve the objects). + + Supports for Check, Load, Save, Add, Remove, Find functions in the CKObject Pointer array. + @todo May independ this class to implement the functions introduced in remarks. + @see XObjectArray, CKObjectArray + */ + using XObjectPointerArray = XArray; + /** + @brief Container class for CKObject pointers. + @details Equivalent to XObjectPointerArray becasue memory reducing is useless.s + */ + using XSObjectPointerArray = XObjectPointerArray; + + /** + @brief Class representation of an Hash Table container. + @tparam K The type of the key + @tparam T The type of element to insert + @tparam H The hash function to hash the key + @tparam Eq The equal function to the key + @remark This class now use std::unordered_map. + */ + template, class Eq = std::equal_to> + using XHashTable = std::unordered_map; + /** + @copydoc XHashTable + @details Equivalent to XHashTable + @see XHashTable + */ + template, class Eq = std::equal_to> + using XNHashTable = XHashTable; + /** + @copydoc XHashTable + @details Equivalent to XHashTable because static allocation is useless. + @see XHashTable + */ + template, class Eq = std::equal_to> + using XSHashTable = XHashTable; + + +}