2010-07-23 05:56:25 +00:00
|
|
|
#ifndef __PO_MAN_H
|
|
|
|
#define __PO_MAN_H
|
|
|
|
|
|
|
|
#include "tarray.h"
|
|
|
|
#include "r_defs.h"
|
|
|
|
#include "m_bbox.h"
|
|
|
|
|
2010-08-01 02:41:56 +00:00
|
|
|
|
|
|
|
struct FPolyVertex
|
|
|
|
{
|
|
|
|
fixed_t x, y;
|
|
|
|
|
|
|
|
FPolyVertex &operator=(vertex_t *v)
|
|
|
|
{
|
|
|
|
x = v->x;
|
|
|
|
y = v->y;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct FPolySeg
|
|
|
|
{
|
|
|
|
FPolyVertex v1;
|
|
|
|
FPolyVertex v2;
|
|
|
|
side_t *wall;
|
|
|
|
};
|
|
|
|
|
2010-07-23 05:56:25 +00:00
|
|
|
//
|
|
|
|
// Linked lists of polyobjects
|
|
|
|
//
|
|
|
|
struct FPolyObj;
|
|
|
|
struct FPolyNode
|
|
|
|
{
|
|
|
|
FPolyObj *poly; // owning polyobject
|
|
|
|
FPolyNode *pnext; // next polyobj in list
|
|
|
|
FPolyNode *pprev; // previous polyobj
|
|
|
|
|
|
|
|
subsector_t *subsector; // containimg subsector
|
|
|
|
FPolyNode *snext; // next subsector
|
|
|
|
|
2010-08-01 02:41:56 +00:00
|
|
|
TArray<FPolySeg> segs; // segs for this node
|
|
|
|
int state;
|
2010-07-23 05:56:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// ===== Polyobj data =====
|
|
|
|
struct FPolyObj
|
|
|
|
{
|
|
|
|
TArray<side_t *> Sidedefs;
|
|
|
|
TArray<line_t *> Linedefs;
|
|
|
|
TArray<vertex_t *> Vertices;
|
|
|
|
TArray<FPolyVertex> OriginalPts;
|
|
|
|
TArray<FPolyVertex> PrevPts;
|
|
|
|
FPolyVertex StartSpot;
|
|
|
|
FPolyVertex CenterSpot;
|
|
|
|
FBoundingBox Bounds; // Bounds in map coordinates
|
2010-08-15 10:02:10 +00:00
|
|
|
subsector_t *CenterSubsector;
|
2013-06-23 03:35:03 +00:00
|
|
|
int MirrorNum;
|
2010-07-23 05:56:25 +00:00
|
|
|
|
|
|
|
angle_t angle;
|
|
|
|
int tag; // reference tag assigned in HereticEd
|
|
|
|
int bbox[4]; // bounds in blockmap coordinates
|
|
|
|
int validcount;
|
|
|
|
int crush; // should the polyobj attempt to crush mobjs?
|
|
|
|
bool bHurtOnTouch; // should the polyobj hurt anything it touches?
|
|
|
|
int seqType;
|
|
|
|
fixed_t size; // polyobj size (area of POLY_AREAUNIT == size of FRACUNIT)
|
|
|
|
FPolyNode *subsectorlinks;
|
2010-08-01 19:14:10 +00:00
|
|
|
DPolyAction *specialdata; // pointer to a thinker, if the poly is moving
|
2010-07-23 05:56:25 +00:00
|
|
|
TObjPtr<DInterpolation> interpolation;
|
|
|
|
|
|
|
|
FPolyObj();
|
|
|
|
DInterpolation *SetInterpolation();
|
|
|
|
void StopInterpolation();
|
|
|
|
|
|
|
|
int GetMirror();
|
|
|
|
bool MovePolyobj (int x, int y, bool force = false);
|
2014-12-25 17:46:50 +00:00
|
|
|
bool RotatePolyobj (angle_t angle, bool fromsave = false);
|
2010-07-23 05:56:25 +00:00
|
|
|
void ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy, side_t **side) const;
|
|
|
|
void LinkPolyobj ();
|
2013-03-21 02:07:42 +00:00
|
|
|
void RecalcActorFloorCeil(FBoundingBox bounds) const;
|
2010-07-23 05:56:25 +00:00
|
|
|
void CreateSubsectorLinks();
|
|
|
|
void ClearSubsectorLinks();
|
|
|
|
void CalcCenter();
|
|
|
|
static void ClearAllSubsectorLinks();
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
void ThrustMobj (AActor *actor, side_t *side);
|
|
|
|
void UpdateBBox ();
|
|
|
|
void DoMovePolyobj (int x, int y);
|
|
|
|
void UnLinkPolyobj ();
|
|
|
|
bool CheckMobjBlocking (side_t *sd);
|
|
|
|
|
|
|
|
};
|
|
|
|
extern FPolyObj *polyobjs; // list of all poly-objects on the level
|
|
|
|
|
|
|
|
struct polyblock_t
|
|
|
|
{
|
|
|
|
FPolyObj *polyobj;
|
|
|
|
struct polyblock_t *prev;
|
|
|
|
struct polyblock_t *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void PO_LinkToSubsectors();
|
2011-07-06 14:20:54 +00:00
|
|
|
FArchive &operator<< (FArchive &arc, FPolyObj *&poly);
|
|
|
|
FArchive &operator<< (FArchive &arc, const FPolyObj *&poly);
|
2010-07-23 05:56:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|