#ifndef GAMEWORLD_H
#define GAMEWORLD_H

enum nodeType : __int32
{
    NODE_BADNODE = 0x0,
    NODE_PATHNODE = 0x1,
    NODE_COVER_STAND = 0x2,
    NODE_COVER_CROUCH = 0x3,
    NODE_COVER_CROUCH_WINDOW = 0x4,
    NODE_COVER_PRONE = 0x5,
    NODE_COVER_RIGHT = 0x6,
    NODE_COVER_LEFT = 0x7,
    NODE_COVER_WIDE_RIGHT = 0x8,
    NODE_COVER_WIDE_LEFT = 0x9,
    NODE_CONCEALMENT_STAND = 0xA,
    NODE_CONCEALMENT_CROUCH = 0xB,
    NODE_CONCEALMENT_PRONE = 0xC,
    NODE_REACQUIRE = 0xD,
    NODE_BALCONY = 0xE,
    NODE_SCRIPTED = 0xF,
    NODE_NEGOTIATION_BEGIN = 0x10,
    NODE_NEGOTIATION_END = 0x11,
    NODE_TURRET = 0x12,
    NODE_GUARD = 0x13,
    NODE_NUMTYPES = 0x14,
    NODE_DONTLINK = 0x14,
};

struct PathLink
{
    float fDist;
    unsigned __int16 nodeNum;
    unsigned __int8 disconnectCount;
    unsigned __int8 negotiationLink;
    unsigned __int8 ubBadPlaceCount[4];
};

struct PathNodeConstant
{
    nodeType type;
    unsigned __int16 spawnflags;
    unsigned __int16 targetname;
    unsigned __int16 script_linkName;
    unsigned __int16 script_noteworthy;
    unsigned __int16 target;
    unsigned __int16 animscript;
    int animscriptfunc;
    float vOrigin[3];
    float fAngle;
    float forward[2];
    float fRadius;
    float minUseDistSq;
    __int16 wOverlapNode[2];
    __int16 wChainId;
    __int16 wChainDepth;
    __int16 wChainParent;
    unsigned __int16 totalLinkCount;
    PathLink *Links;
};

struct pathnode_dynamic_t
{
    void *pOwner;
    int iFreeTime;
    int iValidTime[3];
    int inPlayerLOSTime;
    __int16 wLinkCount;
    __int16 wOverlapCount;
    __int16 turretEntNumber;
    __int16 userCount;
};

struct pathnode_t;
struct pathnode_transient_t
{
    int iSearchFrame;
    pathnode_t *pNextOpen;
    pathnode_t *pPrevOpen;
    pathnode_t *pParent;
    float fCost;
    float fHeuristic;
    float costFactor;
};

struct pathnode_t
{
    PathNodeConstant constant;
    pathnode_dynamic_t dynamic;
    pathnode_transient_t transient;
};

struct PathBaseNode
{
    float vOrigin[3];
    unsigned int type;
};

struct PathNodeTreeNodes
{
    int nodeCount;
    unsigned __int16 *nodes;
};

struct PathNodeTree;
union PathNodeTreeInfo
{
    PathNodeTree *child[2];
    PathNodeTreeNodes s;
};

struct PathNodeTree
{
    int axis;
    float dist;
    PathNodeTreeInfo u;
};

struct PathData
{
    unsigned int nodeCount;
    pathnode_t *nodes;
    PathBaseNode *basenodes;
    unsigned int chainNodeCount;
    unsigned __int16 *chainNodeForNode;
    unsigned __int16 *nodeForChainNode;
    int visBytes;
    unsigned __int8 *pathVis;
    int nodeTreeCount;
    PathNodeTree *nodeTree;
};

struct GameWorldSp
{
    const char *name;
    PathData path;
};

struct GameWorldMp
{
    const char *name;
};

#endif // GAMEWORLD_H
