Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# deWorld_priv.hpp

Go to the documentation of this file.

    00001 ///////////////////////////////////////////////////////////////////////////////
    00002 /// @file deWorld_priv.hpp
    00003 ///
    00004 /// @brief Destiny "World" storage
    00005 ///
    00006 /// @author Assassin
    00007 ///
    00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
    00009 /// contents of this file is subject to the Destiny3D Member License which
    00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
    00011 ///
    00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
    00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
    00014 /// for any particular purpose.
    00015 ///
    00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
    00017 ///
    00018 /// <hr>
    00019 ///                                 Change History
    00020 /// <hr>
    00021 ///
    00022 /// @date Dec 2001
    00023 /// @author Assassin
    00024 /// @remarks Creation
    00025 ///
    00026 /// @date Feb 2002
    00027 /// @author Assassin
    00028 /// @remarks Rendering functionality moved to deRender
    00029 ///
    00030 /// @date Sep 2002
    00031 /// @author Assassin
    00032 /// @remarks Tear-down and re-write
    00033 ///
    00034 ///////////////////////////////////////////////////////////////////////////////
    00035
    00036 #ifndef DEWORLD_PRIV_HPP
    00037 #define DEWORLD_PRIV_HPP
    00038
    00039 #include "deWorld.hpp"
    00040 #include "deHash.hpp"
    00041 #include "deList.hpp"
    00042 #include "deString.hpp"
    00043 #include "deMath.hpp"
    00044 #include "deIDServer.hpp"
    00045 #include "deResource_Helper.hpp"
    00046
    00047 class deWorld;
    00048
    00049 class deWorldManager : public IdeWorldManager
    00050 {
    00051 private:
    00052     deWorldManager();
    00053
    00054 public:
    00055     ~deWorldManager();
    00056     friend IdeWorldManager* IdeWorld_GetManager();
    00057
    00058     deWorldID   CreateWorld();
    00059     IdeWorld*   GetWorld(deWorldID ID);
    00060     IdeWorldObject* GetWorldObject(deWorldID WID, deObjectID OID);
    00061     long        GetRscInterfaceID();
    00062     long        GetUniqueWOInterfaceID();
    00063     deBoolean   RegisterWOClass(const char* ClassName, IdeWorldObject_Creator creator);
    00064
    00065     deBoolean   Initialize();
    00066     deBoolean   ShutDown();
    00067     deBoolean   RemoveWorld(deWorldID WorldID);
    00068     deWorldID   AddWorld(deWorld* pWorld);
    00069     IdeWorldObject* CreateWorldObject(const char* ClassName);
    00070
    00071     static long     s_WorldRscInterfaceID;
    00072 private:
    00073     long            m_LatestWOID;
    00074     IdeIDServer*    m_WorldIDServer;
    00075     deTHashString <IdeWorldObject_Creator> m_TypeHash;
    00076 };
    00077
    00078
    00079 class deWorld : public deResourceBase, public IdeWorld
    00080 {
    00081 public:
    00082     deWorld();
    00083     deWorld(const char* filename);
    00084     ~deWorld();
    00085     IdeResourceBase * MakeCopy();
    00086     void * GetRscInterface(long interface_id);
    00087
    00088     deWorldID   GetWorldID();
    00089     deWorldID   GetWorldIDUsingLocalID(deWorldID LocalID, deBoolean ForceLoad);
    00090     deWorldID   GetLocalIDFromLoadedWorld(deWorldID WorldID);
    00091     IdeWorldObject* GetWorldObject(deObjectID ObjectID);
    00092     deObjectID  AddWorldObject(IdeWorldObject * Object);
    00093     deBoolean   AddWorldObjectWithID(IdeWorldObject * Object);
    00094     deBoolean   RemoveWorldObject(deObjectID ObjectID);
    00095
    00096     deBoolean   SetWorldID(deWorldID ID);
    00097
    00098     const char* GetNextObjectTypeName(void* &PrevEntry);
    00099     deObjectID  GetNextObjectOfType(const char* TypeName, void* &PrevEntry);
    00100
    00101     deBoolean   Serialize(IdeFile* File);
    00102     deBoolean   DeSerialize(IdeFile* File);
    00103
    00104     deBoolean   WriteHeader(IdeFile* File);
    00105     deBoolean   CheckHeader(IdeFile* File);
    00106
    00107     deBoolean   WriteObjectInfo(IdeFile* File, deObjectID ObjectID, char * TypeName);
    00108     deBoolean   WriteObjectDataLength(IdeFile* File, long ObjectStartPos);
    00109     deBoolean   ReadObjectInfo(IdeFile* File, deObjectID &ObjectID, char TypeNameBuffer[256], long &DataLength);
    00110
    00111 protected:
    00112     deBoolean   RecordObjectWithTypeName(deObjectID ObjectID, const char* TypeName);
    00113     deBoolean   LoadFromFile(IdeFile * file);
    00114     friend IdeResourceBase * LoadWorldFile(const char * filename, IdeFile * worldfile, deBoolean isThreaded);
    00115     friend __declspec(dllexport) deBoolean IdeWorld_Initialize();
    00116     friend __declspec(dllexport) long IdeWorld_GetRscInterfaceID();
    00117
    00118 private:
    00119     struct WorldRef_t
    00120     {
    00121         deWorldID       LocalID;
    00122         deWorldID       CurrentID;
    00123         deTransformInfo Transform;
    00124         char            FileName[256];
    00125     };
    00126     deWorldID   m_WorldID;
    00127     deObjectID  m_LatestItemID;
    00128     deBoolean   m_LockDown;
    00129     IdeIDServer*m_ObjectIDServer;
    00130     deTHashString < deTList<deObjectID> > m_ObjectListHash;
    00131     deTList <deString> m_ObjectTypesUsed;
    00132 #pragma note (perhaps use a multi-hash instead of an array)
    00133     deTArray <WorldRef_t> m_ReferencedWorlds;
    00134 };
    00135
    00136 #endif