D:/Zythum/DinoKod/Landscape/Landscape.h

00001 //---------------------------------------------------------------------------------------------
00002 //      This file is a part of "DinoKod".
00003 //      Copyright © 2003 Dino Productions. All Rights Reserved.
00004 //      
00005 //      File                    : Landscape.h
00006 //      Author                  : Sebastien LEIX        sebastien.leix@wanadoo.fr
00007 //      Date                    : 27/01/2003
00008 //      Modification    :
00009 //
00010 //---------------------------------------------------------------------------------------------
00011 #ifndef __LANDSCAPE_H__
00012 #define __LANDSCAPE_H__
00013 
00014 #include "Landscape/LandscapeDll.h"
00015 #include "Common/Types.h"
00016 #include "Common/Assert.h"
00017 #include "Common/Table.h"
00018 #include "Common/List.h"
00019 #include "Landscape/Tile.h"
00020 
00021 #define MAPCHUNCK_TILE          1       // Tile
00022 #define MAPCHUNCK_SUBTILE       2       // SubTile
00023 
00024 class KLandObject;
00025 class KLandEntity;
00026 class KCollisionData;
00027 
00028 //---------------------------------------------------------------------------------------------
00029 class LANDSCAPE_API KMapChunck
00030 {
00031 public:
00032         u8              m_Type;
00033         u32             m_Size;
00034 };
00035 
00036 //---------------------------------------------------------------------------------------------
00037 class LANDSCAPE_API KLandscape
00038 {
00039 private:
00040         KTable<KTile*>                  m_Tiles;
00041         KList<KLandObject*>             m_LandObjects;
00042         KList<KLandEntity*>             m_LandEntities;
00043 
00044 protected:
00045         KPt                                             m_Size;
00046         static u32                              m_MAPVersion;
00047         bool                                    m_bLoaded;
00048 
00049         virtual KTile*                  AllocTile( KLandscape* pLandscape )             { return new KTile( pLandscape );       }
00050 
00051 public:
00052                                                         KLandscape();
00053         virtual                                 ~KLandscape();
00054 
00055         virtual bool                    NewLandscape( s32 Width, s32 Height );
00056         virtual bool                    LoadLandscape( char* pFileName );
00057         virtual bool                    SaveLandscape( char* pFileName );
00058         virtual void                    Flush();
00059 
00060         KPt&                                    GetSize()                                       { return m_Size;        }
00061         KTile*                                  GetpTile( s32 x, s32 y )        { KASSERT( x < m_Size.x && y < m_Size.y ); return m_Tiles[m_Size.x * y + x];}
00062 
00063         bool                                    GetCellHeight( s32 CellX, s32 CellY, KTILEHEIGHT* pHeight );
00064         bool                                    SetCellHeight( s32 CellX, s32 CellY, KTILEHEIGHT Height );
00065 
00066         void                                    AddLandObject( KLandObject* pLandObject )               { m_LandObjects.Add( pLandObject );                             }
00067         void                                    RemoveLandObject( KLandObject* pLandObject )    { m_LandObjects.Remove( pLandObject );                  }
00068         KLandObject*                    GetFirstLandObject()                                                    { return m_LandObjects.GetFirst();                              }
00069         KLandObject*                    GetNextLandObject( KLandObject* pLandObject )   { return m_LandObjects.GetNext( pLandObject );  }
00070 
00071         void                                    AddLandEntity( KLandEntity* pLandEntity )               { m_LandEntities.Add( pLandEntity );                    }
00072         void                                    RemoveLandEntity( KLandEntity* pLandEntity )    { m_LandEntities.Remove( pLandEntity );                 }
00073         KLandEntity*                    GetFirstLandEntity()                                                    { return m_LandEntities.GetFirst();                             }
00074         KLandEntity*                    GetNextLandEntity( KLandEntity* pLandEntity )   { return m_LandEntities.GetNext( pLandEntity ); }
00075 
00076         bool                                    ImportHeightMap( s32 TileX, s32 TileY, KStr& sFileName );
00077         bool                                    ExportHeightMap( s32 TileX, s32 TileY, KStr& sFileName );
00078 
00079         bool                                    IsLoaded()              { return m_bLoaded;     }
00080         bool                                    TestSphereCollision( KVector& Center, float Radius, KVector& Velocity, KVector* pPoint, KVector* pNormal );
00081         bool                                    CheckSphereCollision( KCollisionData* pData );
00082 };
00083 
00084 #endif  __LANDSCAPE_H__

Generated on Sun Mar 25 20:02:12 2007 for Zythum Project by  doxygen 1.5.1-p1