2016-02-15 01:14:34 +00:00
|
|
|
#ifndef __P_BLOCKMAP_H
|
|
|
|
#define __P_BLOCKMAP_H
|
|
|
|
|
|
|
|
#include "doomtype.h"
|
|
|
|
|
|
|
|
class AActor;
|
|
|
|
|
|
|
|
// [RH] Like msecnode_t, but for the blockmap
|
|
|
|
struct FBlockNode
|
|
|
|
{
|
|
|
|
AActor *Me; // actor this node references
|
|
|
|
int BlockIndex; // index into blocklinks for the block this node is in
|
2016-02-16 11:51:10 +00:00
|
|
|
int Group; // portal group this link belongs to (can be different than the actor's own group
|
2016-02-15 01:14:34 +00:00
|
|
|
FBlockNode **PrevActor; // previous actor in this block
|
|
|
|
FBlockNode *NextActor; // next actor in this block
|
|
|
|
FBlockNode **PrevBlock; // previous block this actor is in
|
|
|
|
FBlockNode *NextBlock; // next block this actor is in
|
|
|
|
|
2016-02-16 11:51:10 +00:00
|
|
|
static FBlockNode *Create (AActor *who, int x, int y, int group = -1);
|
2016-02-15 01:14:34 +00:00
|
|
|
void Release ();
|
|
|
|
|
|
|
|
static FBlockNode *FreeBlocks;
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int* blockmaplump; // offsets in blockmap are from here
|
|
|
|
|
|
|
|
extern int* blockmap;
|
|
|
|
extern int bmapwidth;
|
|
|
|
extern int bmapheight; // in mapblocks
|
2016-03-31 07:23:14 +00:00
|
|
|
extern double bmaporgx;
|
|
|
|
extern double bmaporgy; // origin of block map
|
2016-02-15 01:14:34 +00:00
|
|
|
extern FBlockNode** blocklinks; // for thing chains
|
|
|
|
|
2017-01-06 11:54:01 +00:00
|
|
|
// mapblocks are used to check movement
|
|
|
|
// against lines and things
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
MAPBLOCKUNITS = 128
|
|
|
|
};
|
|
|
|
|
2016-03-31 07:23:14 +00:00
|
|
|
inline int GetBlockX(double xpos)
|
|
|
|
{
|
|
|
|
return int((xpos - bmaporgx) / MAPBLOCKUNITS);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int GetBlockY(double ypos)
|
|
|
|
{
|
|
|
|
return int((ypos - bmaporgy) / MAPBLOCKUNITS);
|
|
|
|
}
|
|
|
|
|
2016-02-15 01:14:34 +00:00
|
|
|
#endif
|