Complete disaster-recovery snapshot: engine/game source, game data assets, VC6 toolchain + DX SDKs, build outputs, deployed game, and _UNUSED archive. Large binaries in Git LFS; text preserved byte-for-byte (core.autocrlf=false, no eol attributes). See RECOVERY.md for the one-clone rebuild procedure.
142 lines
2.8 KiB
C++
142 lines
2.8 KiB
C++
#ifndef __MAPHPP__
|
|
#define __MAPHPP__
|
|
|
|
#include "dib surface\dibsection.hpp"
|
|
|
|
class CPerson;
|
|
class CMapNode;
|
|
class CMapQuadNode;
|
|
|
|
struct MAPELEMENT
|
|
{
|
|
bool passable;
|
|
float weight;
|
|
};
|
|
|
|
int SquareInfo (int x,int y);
|
|
void RenderEdges (CDIBSurface& dest,int dx);
|
|
|
|
|
|
const double MAPX = 256.0;
|
|
const double MAPY = 256.0;
|
|
const int MAPSIZE = 256;
|
|
|
|
const int MAXDEPTH = 16;
|
|
const int MAXDEPTH2 = (MAXDEPTH/2);
|
|
const int MAXDEPTH4 = (MAXDEPTH/4);
|
|
|
|
extern MAPELEMENT g_Map[MAPSIZE][MAPSIZE];
|
|
extern CMapNode *g_MapTree;
|
|
|
|
inline bool Passable (int dx,int dy)
|
|
{
|
|
if (dx < 0)
|
|
return false;
|
|
if (dy < 0)
|
|
return false;
|
|
if (dx >= MAPSIZE)
|
|
return false;
|
|
if (dy >= MAPSIZE)
|
|
return false;
|
|
if (!g_Map[dx][dy].passable)
|
|
return false;
|
|
/*
|
|
for (i=0;i<MAXPERSON;i++)
|
|
{
|
|
if (who == &g_Person[i])
|
|
continue;
|
|
if ((dx == g_Person[i].Location().x) && (dy == g_Person[i].Location().y))
|
|
return false;
|
|
}
|
|
*/
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
enum PASSFLAG {PASS_TB,PASS_LR,PASS_TL,PASS_TR,PASS_BL,PASS_BR,PASS_NUM};
|
|
|
|
class CMapQuadNode
|
|
{
|
|
friend class CMapNode;
|
|
private:
|
|
// enum SPLITID {LEFT_CHILD=0,RIGHT_CHILD,TOP_CHILD=0,BOTTOM_CHILD};
|
|
enum SPLITID {TOPLEFT_CHILD,TOPRIGHT_CHILD,BOTTOMLEFT_CHILD,BOTTOMRIGHT_CHILD};
|
|
|
|
CMapQuadNode *m_Parent;
|
|
CMapNode *m_Root;
|
|
// CMapQuadNode *m_Child[2];
|
|
CMapQuadNode *m_Child[4];
|
|
int m_Left,m_Right,m_Bottom,m_Top;
|
|
// bool m_LeftSplit; // true is left to right split, which means child are top bottom
|
|
|
|
bool m_Passable[PASS_NUM];
|
|
float m_PassAverage;
|
|
float m_WeightAverage;
|
|
|
|
// int ChooseSplit (void);
|
|
// double CalcAverageCostSplit (int where,bool left);
|
|
// double AnalyzeSplit (int where,bool left);
|
|
|
|
bool SubDivide (void);
|
|
void RenderEdges (CDIBSurface& dest,int dx);
|
|
void RenderData (CDIBSurface& dest,int dx);
|
|
|
|
void Left (int value) { m_Left = value; }
|
|
void Right (int value) { m_Right = value; }
|
|
void Top (int value) { m_Top = value; }
|
|
void Bottom (int value) { m_Bottom = value; }
|
|
|
|
void SetSize (int left,int top,int right,int bottom)
|
|
{
|
|
m_Left = left;
|
|
m_Top = top;
|
|
m_Right = right;
|
|
m_Bottom = bottom;
|
|
}
|
|
|
|
public:
|
|
|
|
CMapQuadNode (CMapQuadNode *parent,CMapNode *root);
|
|
~CMapQuadNode (void);
|
|
|
|
|
|
int Left (void) const { return m_Left; }
|
|
int Right (void) const { return m_Right; }
|
|
int Top (void) const { return m_Top; }
|
|
int Bottom (void) const { return m_Bottom; }
|
|
|
|
};
|
|
|
|
class CMapNode
|
|
{
|
|
private:
|
|
|
|
CMapNode *m_Left,*m_Top,*m_Right,*m_Bottom;
|
|
CMapQuadNode *m_MapQuad;
|
|
|
|
bool m_Passable[PASS_NUM];
|
|
float m_PassAverage;
|
|
float m_WeightAverage;
|
|
|
|
public:
|
|
CMapNode (void);
|
|
~CMapNode (void);
|
|
|
|
|
|
void RenderEdges (CDIBSurface& dest,int dx);
|
|
void RenderData (CDIBSurface& dest,int dx);
|
|
float GetOneCost (int sx,int sy,int dx,int dy);
|
|
float PathCostGuess (int sx,int sy,int dx,int dy);
|
|
|
|
};
|
|
*/
|
|
|
|
#endif |