mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 04:51:19 +00:00
- merged polyobject branch into trunk and made some adjustments for savegame compatibility.
SVN r2448 (trunk)
This commit is contained in:
parent
3a48da2c56
commit
4ac64b6df7
22 changed files with 1757 additions and 1243 deletions
|
@ -58,6 +58,7 @@
|
|||
|
||||
#include "am_map.h"
|
||||
#include "a_artifacts.h"
|
||||
#include "po_man.h"
|
||||
|
||||
struct AMColor
|
||||
{
|
||||
|
@ -177,6 +178,10 @@ CVAR (Color, am_ovthingcolor_friend, 0xe88800, CVAR_ARCHIVE);
|
|||
CVAR (Color, am_ovthingcolor_monster, 0xe88800, CVAR_ARCHIVE);
|
||||
CVAR (Color, am_ovthingcolor_item, 0xe88800, CVAR_ARCHIVE);
|
||||
|
||||
|
||||
CVAR(Int, am_showsubsector, -1, 0);
|
||||
|
||||
|
||||
// Disable the ML_DONTDRAW line flag if x% of all lines in a map are flagged with it
|
||||
// (To counter annoying mappers who think they are smart by making the automap unusable)
|
||||
bool am_showallenabled;
|
||||
|
@ -1614,6 +1619,64 @@ static bool AM_CheckSecret(line_t *line)
|
|||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Polyobject debug stuff
|
||||
//
|
||||
//=============================================================================
|
||||
|
||||
void AM_drawSeg(seg_t *seg, const AMColor &color)
|
||||
{
|
||||
mline_t l;
|
||||
l.a.x = seg->v1->x >> FRACTOMAPBITS;
|
||||
l.a.y = seg->v1->y >> FRACTOMAPBITS;
|
||||
l.b.x = seg->v2->x >> FRACTOMAPBITS;
|
||||
l.b.y = seg->v2->y >> FRACTOMAPBITS;
|
||||
|
||||
if (am_rotate == 1 || (am_rotate == 2 && viewactive))
|
||||
{
|
||||
AM_rotatePoint (&l.a.x, &l.a.y);
|
||||
AM_rotatePoint (&l.b.x, &l.b.y);
|
||||
}
|
||||
AM_drawMline(&l, color);
|
||||
}
|
||||
|
||||
void AM_showSS()
|
||||
{
|
||||
if (am_showsubsector >= 0 && am_showsubsector < numsubsectors)
|
||||
{
|
||||
AMColor yellow;
|
||||
yellow.FromRGB(255,255,0);
|
||||
AMColor red;
|
||||
red.FromRGB(255,0,0);
|
||||
|
||||
subsector_t *sub = &subsectors[am_showsubsector];
|
||||
for(unsigned int i=0;i<sub->numlines;i++)
|
||||
{
|
||||
AM_drawSeg(&segs[sub->firstline+i], yellow);
|
||||
}
|
||||
PO_LinkToSubsectors();
|
||||
|
||||
for(int i=0;i<po_NumPolyobjs;i++)
|
||||
{
|
||||
FPolyObj *po = &polyobjs[i];
|
||||
FPolyNode *pnode = po->subsectorlinks;
|
||||
|
||||
while (pnode != NULL)
|
||||
{
|
||||
if (pnode->subsector == sub)
|
||||
{
|
||||
for(unsigned j=0;j<pnode->segs.Size();j++)
|
||||
{
|
||||
AM_drawSeg(&pnode->segs[j], red);
|
||||
}
|
||||
}
|
||||
pnode = pnode->snext;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//
|
||||
// Determines visible lines, draws them.
|
||||
|
@ -2166,6 +2229,8 @@ void AM_Drawer ()
|
|||
AM_drawCrosshair(XHairColor);
|
||||
|
||||
AM_drawMarks();
|
||||
|
||||
AM_showSS();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "r_interpolate.h"
|
||||
#include "doomstat.h"
|
||||
#include "m_argv.h"
|
||||
#include "po_man.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
|
|
@ -91,8 +91,3 @@ int FBoundingBox::BoxOnLineSide (const line_t *ld) const
|
|||
return (p1 == p2) ? p1 : -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "doomtype.h"
|
||||
|
||||
struct line_t;
|
||||
struct node_t;
|
||||
|
||||
class FBoundingBox
|
||||
{
|
||||
|
|
|
@ -173,11 +173,11 @@ void FNodeBuilder::CreateSubsectorsForReal ()
|
|||
subsector_t sub;
|
||||
unsigned int i;
|
||||
|
||||
sub.poly = NULL;
|
||||
sub.validcount = 0;
|
||||
sub.CenterX = 0; // Code in p_setup.cpp will set these for us later.
|
||||
sub.CenterY = 0;
|
||||
sub.sector = NULL;
|
||||
sub.polys = NULL;
|
||||
|
||||
for (i = 0; i < SubsectorSets.Size(); ++i)
|
||||
{
|
||||
|
|
|
@ -106,7 +106,6 @@ void FNodeBuilder::Extract (node_t *&outNodes, int &nodeCount,
|
|||
DWORD numsegs = CloseSubsector (segs, i, outVerts);
|
||||
outSubs[i].numlines = numsegs;
|
||||
outSubs[i].firstline = segs.Size() - numsegs;
|
||||
outSubs[i].poly = NULL;
|
||||
}
|
||||
|
||||
segCount = segs.Size ();
|
||||
|
|
|
@ -237,6 +237,7 @@ struct FLineOpening
|
|||
void P_LineOpening (FLineOpening &open, AActor *thing, const line_t *linedef, fixed_t x, fixed_t y, fixed_t refx=FIXED_MIN, fixed_t refy=0);
|
||||
|
||||
class FBoundingBox;
|
||||
struct polyblock_t;
|
||||
|
||||
class FBlockLinesIterator
|
||||
{
|
||||
|
@ -536,12 +537,9 @@ extern int po_NumPolyobjs;
|
|||
extern polyspawns_t *polyspawns; // [RH] list of polyobject things to spawn
|
||||
|
||||
|
||||
bool PO_MovePolyobj (int num, int x, int y, bool force=false);
|
||||
bool PO_RotatePolyobj (int num, angle_t angle);
|
||||
void PO_Init ();
|
||||
bool PO_Busy (int polyobj);
|
||||
void PO_ClosestPoint(const FPolyObj *poly, fixed_t ox, fixed_t oy, fixed_t &x, fixed_t &y, seg_t **seg);
|
||||
struct FPolyObj *PO_GetPolyobj(int polyNum);
|
||||
FPolyObj *PO_GetPolyobj(int polyNum);
|
||||
|
||||
//
|
||||
// P_SPEC
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
// State.
|
||||
#include "r_state.h"
|
||||
#include "templates.h"
|
||||
#include "po_man.h"
|
||||
|
||||
static AActor *RoughBlockCheck (AActor *mo, int index, void *);
|
||||
|
||||
|
@ -692,9 +693,9 @@ line_t *FBlockLinesIterator::Next()
|
|||
polyLink->polyobj->validcount = validcount;
|
||||
}
|
||||
|
||||
line_t *ld = polyLink->polyobj->lines[polyIndex];
|
||||
line_t *ld = polyLink->polyobj->Linedefs[polyIndex];
|
||||
|
||||
if (++polyIndex >= polyLink->polyobj->numlines)
|
||||
if (++polyIndex >= (int)polyLink->polyobj->Linedefs.Size())
|
||||
{
|
||||
polyLink = polyLink->next;
|
||||
polyIndex = 0;
|
||||
|
|
|
@ -46,12 +46,14 @@
|
|||
#include "a_sharedglobal.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "g_level.h"
|
||||
#include "po_man.h"
|
||||
|
||||
static void CopyPlayer (player_t *dst, player_t *src, const char *name);
|
||||
static void ReadOnePlayer (FArchive &arc, bool skipload);
|
||||
static void ReadMultiplePlayers (FArchive &arc, int numPlayers, int numPlayersNow, bool skipload);
|
||||
static void SpawnExtraPlayers ();
|
||||
|
||||
|
||||
//
|
||||
// P_ArchivePlayers
|
||||
//
|
||||
|
@ -496,8 +498,8 @@ void P_SerializePolyobjs (FArchive &arc)
|
|||
arc << seg << po_NumPolyobjs;
|
||||
for(i = 0, po = polyobjs; i < po_NumPolyobjs; i++, po++)
|
||||
{
|
||||
arc << po->tag << po->angle << po->startSpot[0] <<
|
||||
po->startSpot[1] << po->interpolation;
|
||||
arc << po->tag << po->angle << po->StartSpot.x <<
|
||||
po->StartSpot.y << po->interpolation;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -523,11 +525,11 @@ void P_SerializePolyobjs (FArchive &arc)
|
|||
I_Error ("UnarchivePolyobjs: Invalid polyobj tag");
|
||||
}
|
||||
arc << angle;
|
||||
PO_RotatePolyobj (po->tag, angle);
|
||||
po->RotatePolyobj (angle);
|
||||
arc << deltaX << deltaY << po->interpolation;
|
||||
deltaX -= po->startSpot[0];
|
||||
deltaY -= po->startSpot[1];
|
||||
PO_MovePolyobj (po->tag, deltaX, deltaY, true);
|
||||
deltaX -= po->StartSpot.x;
|
||||
deltaY -= po->StartSpot.y;
|
||||
po->MovePolyobj (deltaX, deltaY, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "g_level.h"
|
||||
#include "md5.h"
|
||||
#include "compatibility.h"
|
||||
#include "po_man.h"
|
||||
|
||||
void P_SpawnSlopeMakers (FMapThing *firstmt, FMapThing *lastmt);
|
||||
void P_SetSlopes ();
|
||||
|
@ -3341,6 +3342,7 @@ extern polyblock_t **PolyBlockMap;
|
|||
|
||||
void P_FreeLevelData ()
|
||||
{
|
||||
FPolyObj::ClearAllSubsectorLinks(); // can't be done as part of the polyobj deletion process.
|
||||
SN_StopAllSequences ();
|
||||
DThinker::DestroyAllThinkers ();
|
||||
level.total_monsters = level.total_items = level.total_secrets =
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "m_bbox.h"
|
||||
#include "p_lnspec.h"
|
||||
#include "g_level.h"
|
||||
#include "po_man.h"
|
||||
|
||||
// State.
|
||||
#include "r_state.h"
|
||||
|
@ -305,7 +306,7 @@ bool SightCheck::P_SightBlockLinesIterator (int x, int y)
|
|||
int *list;
|
||||
|
||||
polyblock_t *polyLink;
|
||||
int i;
|
||||
unsigned int i;
|
||||
extern polyblock_t **PolyBlockMap;
|
||||
|
||||
offset = y*bmapwidth+x;
|
||||
|
@ -318,9 +319,9 @@ bool SightCheck::P_SightBlockLinesIterator (int x, int y)
|
|||
if (polyLink->polyobj->validcount != validcount)
|
||||
{
|
||||
polyLink->polyobj->validcount = validcount;
|
||||
for (i = 0; i < polyLink->polyobj->numlines; i++)
|
||||
for (i = 0; i < polyLink->polyobj->Linedefs.Size(); i++)
|
||||
{
|
||||
if (!P_SightCheckLine (polyLink->polyobj->lines[i]))
|
||||
if (!P_SightCheckLine (polyLink->polyobj->Linedefs[i]))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
1738
src/po_man.cpp
1738
src/po_man.cpp
File diff suppressed because it is too large
Load diff
116
src/po_man.h
Normal file
116
src/po_man.h
Normal file
|
@ -0,0 +1,116 @@
|
|||
#ifndef __PO_MAN_H
|
||||
#define __PO_MAN_H
|
||||
|
||||
#include "tarray.h"
|
||||
#include "r_defs.h"
|
||||
#include "m_bbox.h"
|
||||
|
||||
//
|
||||
// Linked lists of polyobjects
|
||||
//
|
||||
struct FPolyObj;
|
||||
struct FPolyNode
|
||||
{
|
||||
int state;
|
||||
FPolyObj *poly; // owning polyobject
|
||||
FPolyNode *pnext; // next polyobj in list
|
||||
FPolyNode *pprev; // previous polyobj
|
||||
|
||||
subsector_t *subsector; // containimg subsector
|
||||
FPolyNode *snext; // next subsector
|
||||
|
||||
TArray<seg_t> segs; // segs for this node
|
||||
fixed_t dist; // distance for sorting
|
||||
};
|
||||
|
||||
struct FPolyVertex
|
||||
{
|
||||
fixed_t x, y;
|
||||
};
|
||||
|
||||
struct FPolyVertexBlock
|
||||
{
|
||||
int used;
|
||||
vertex_t vertices[10];
|
||||
|
||||
void clear()
|
||||
{
|
||||
used = 0;
|
||||
//memset(vertices, 0, sizeof(vertices));
|
||||
}
|
||||
};
|
||||
|
||||
// ===== 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
|
||||
TDeletingArray<FPolyVertexBlock *> SplitVertices;
|
||||
unsigned int SVIndex;
|
||||
|
||||
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;
|
||||
DThinker *specialdata; // pointer to a thinker, if the poly is moving
|
||||
TObjPtr<DInterpolation> interpolation;
|
||||
|
||||
FPolyObj();
|
||||
DInterpolation *SetInterpolation();
|
||||
void StopInterpolation();
|
||||
|
||||
int GetMirror();
|
||||
bool MovePolyobj (int x, int y, bool force = false);
|
||||
bool RotatePolyobj (angle_t angle);
|
||||
void ClosestPoint(fixed_t fx, fixed_t fy, fixed_t &ox, fixed_t &oy, side_t **side) const;
|
||||
void LinkPolyobj ();
|
||||
void CreateSubsectorLinks();
|
||||
void ClearSubsectorLinks();
|
||||
vertex_t *GetNewVertex();
|
||||
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
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, FPolyObj *&poly)
|
||||
{
|
||||
return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj));
|
||||
}
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, const FPolyObj *&poly)
|
||||
{
|
||||
return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj));
|
||||
}
|
||||
|
||||
struct polyblock_t
|
||||
{
|
||||
FPolyObj *polyobj;
|
||||
struct polyblock_t *prev;
|
||||
struct polyblock_t *next;
|
||||
};
|
||||
|
||||
|
||||
void PO_LinkToSubsectors();
|
||||
|
||||
|
||||
#endif
|
|
@ -50,6 +50,7 @@
|
|||
#include "r_bsp.h"
|
||||
#include "v_palette.h"
|
||||
#include "r_sky.h"
|
||||
#include "po_man.h"
|
||||
|
||||
int WallMost (short *mostbuf, const secplane_t &plane);
|
||||
|
||||
|
@ -1006,6 +1007,46 @@ void R_GetExtraLight (int *light, const secplane_t &plane, FExtraLight *el)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int STACK_ARGS polycmp(const void *a, const void *b)
|
||||
{
|
||||
const FPolyNode *A = *(FPolyNode **)a;
|
||||
const FPolyNode *B = *(FPolyNode **)b;
|
||||
|
||||
return A->dist - B->dist;
|
||||
}
|
||||
|
||||
|
||||
static void R_AddPolyobjs(subsector_t *sub)
|
||||
{
|
||||
static TArray<FPolyNode *> sortedpolys;
|
||||
|
||||
FPolyNode *pn = sub->polys;
|
||||
sortedpolys.Clear();
|
||||
while (pn != NULL)
|
||||
{
|
||||
sortedpolys.Push(pn);
|
||||
pn->dist = R_PointToDist2(pn->poly->CenterSpot.x - viewx, pn->poly->CenterSpot.y - viewy);
|
||||
pn = pn->pnext;
|
||||
}
|
||||
if (sortedpolys.Size() > 1)
|
||||
{
|
||||
qsort(&sortedpolys[0], sortedpolys.Size(), sizeof (sortedpolys[0]), polycmp);
|
||||
}
|
||||
|
||||
for(unsigned i=0; i<sortedpolys.Size(); i++)
|
||||
{
|
||||
pn = sortedpolys[i];
|
||||
for(unsigned j=0; j<pn->segs.Size(); j++)
|
||||
{
|
||||
R_AddLine(&pn->segs[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// R_Subsector
|
||||
// Determine floor/ceiling planes.
|
||||
|
@ -1098,14 +1139,9 @@ void R_Subsector (subsector_t *sub)
|
|||
R_ProjectParticle (Particles + i, subsectors[sub-subsectors].sector, shade, FakeSide);
|
||||
}
|
||||
|
||||
if (sub->poly)
|
||||
{ // Render the polyobj in the subsector first
|
||||
int polyCount = sub->poly->numsegs;
|
||||
seg_t **polySeg = sub->poly->segs;
|
||||
while (polyCount--)
|
||||
{
|
||||
R_AddLine (*polySeg++);
|
||||
}
|
||||
if (sub->polys)
|
||||
{ // Render the polyobjs in the subsector first
|
||||
R_AddPolyobjs(sub);
|
||||
}
|
||||
|
||||
while (count--)
|
||||
|
|
61
src/r_defs.h
61
src/r_defs.h
|
@ -75,6 +75,11 @@ struct vertex_t
|
|||
{
|
||||
return x == other.x && y == other.y;
|
||||
}
|
||||
|
||||
void clear()
|
||||
{
|
||||
x = y = 0;
|
||||
}
|
||||
};
|
||||
|
||||
// Forward of LineDefs, for Sectors.
|
||||
|
@ -854,6 +859,9 @@ struct side_t
|
|||
|
||||
DInterpolation *SetInterpolation(int position);
|
||||
void StopInterpolation(int position);
|
||||
|
||||
vertex_t *V1() const;
|
||||
vertex_t *V2() const;
|
||||
};
|
||||
|
||||
FArchive &operator<< (FArchive &arc, side_t::part &p);
|
||||
|
@ -916,19 +924,20 @@ struct msecnode_t
|
|||
bool visited; // killough 4/4/98, 4/7/98: used in search algorithms
|
||||
};
|
||||
|
||||
struct FPolyNode;
|
||||
|
||||
//
|
||||
// A SubSector.
|
||||
// References a Sector.
|
||||
// Basically, this is a list of LineSegs indicating the visible walls that
|
||||
// define (all or some) sides of a convex BSP leaf.
|
||||
//
|
||||
struct FPolyObj;
|
||||
struct subsector_t
|
||||
{
|
||||
sector_t *sector;
|
||||
DWORD numlines;
|
||||
DWORD firstline;
|
||||
FPolyObj *poly;
|
||||
FPolyNode *polys;
|
||||
int validcount;
|
||||
fixed_t CenterX, CenterY;
|
||||
};
|
||||
|
@ -954,44 +963,6 @@ struct seg_t
|
|||
BITFIELD bPolySeg:1;
|
||||
};
|
||||
|
||||
// ===== Polyobj data =====
|
||||
struct FPolyObj
|
||||
{
|
||||
int numsegs;
|
||||
seg_t **segs;
|
||||
int numlines;
|
||||
line_t **lines;
|
||||
int numvertices;
|
||||
vertex_t **vertices;
|
||||
fixed_t startSpot[2];
|
||||
vertex_t *originalPts; // used as the base for the rotations
|
||||
vertex_t *prevPts; // use to restore the old point values
|
||||
angle_t angle;
|
||||
int tag; // reference tag assigned in HereticEd
|
||||
int bbox[4];
|
||||
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)
|
||||
DThinker *specialdata; // pointer to a thinker, if the poly is moving
|
||||
TObjPtr<DInterpolation> interpolation;
|
||||
|
||||
~FPolyObj();
|
||||
DInterpolation *SetInterpolation();
|
||||
void StopInterpolation();
|
||||
};
|
||||
extern FPolyObj *polyobjs; // list of all poly-objects on the level
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, FPolyObj *&poly)
|
||||
{
|
||||
return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj));
|
||||
}
|
||||
|
||||
inline FArchive &operator<< (FArchive &arc, const FPolyObj *&poly)
|
||||
{
|
||||
return arc.SerializePointer (polyobjs, (BYTE **)&poly, sizeof(FPolyObj));
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
@ -1005,6 +976,7 @@ struct node_t
|
|||
fixed_t dx;
|
||||
fixed_t dy;
|
||||
fixed_t bbox[2][4]; // Bounding box for each child.
|
||||
float len;
|
||||
union
|
||||
{
|
||||
void *children[2]; // If bit 0 is set, it's a subsector.
|
||||
|
@ -1013,15 +985,6 @@ struct node_t
|
|||
};
|
||||
|
||||
|
||||
struct polyblock_t
|
||||
{
|
||||
FPolyObj *polyobj;
|
||||
struct polyblock_t *prev;
|
||||
struct polyblock_t *next;
|
||||
};
|
||||
|
||||
|
||||
|
||||
// posts are runs of non masked source pixels
|
||||
struct column_t
|
||||
{
|
||||
|
|
|
@ -38,6 +38,8 @@
|
|||
#include "stats.h"
|
||||
#include "r_interpolate.h"
|
||||
#include "p_local.h"
|
||||
#include "i_system.h"
|
||||
#include "po_man.h"
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
|
@ -134,6 +136,8 @@ class DPolyobjInterpolation : public DInterpolation
|
|||
|
||||
FPolyObj *poly;
|
||||
TArray<fixed_t> oldverts, bakverts;
|
||||
fixed_t oldcx, oldcy;
|
||||
fixed_t bakcx, bakcy;
|
||||
|
||||
public:
|
||||
|
||||
|
@ -728,8 +732,8 @@ void DWallScrollInterpolation::Serialize(FArchive &arc)
|
|||
DPolyobjInterpolation::DPolyobjInterpolation(FPolyObj *po)
|
||||
{
|
||||
poly = po;
|
||||
oldverts.Resize(po->numvertices<<1);
|
||||
bakverts.Resize(po->numvertices<<1);
|
||||
oldverts.Resize(po->Vertices.Size() << 1);
|
||||
bakverts.Resize(po->Vertices.Size() << 1);
|
||||
UpdateInterpolation ();
|
||||
interpolator.AddInterpolation(this);
|
||||
}
|
||||
|
@ -755,11 +759,13 @@ void DPolyobjInterpolation::Destroy()
|
|||
|
||||
void DPolyobjInterpolation::UpdateInterpolation()
|
||||
{
|
||||
for(int i = 0; i < poly->numvertices; i++)
|
||||
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
||||
{
|
||||
oldverts[i*2 ] = poly->vertices[i]->x;
|
||||
oldverts[i*2+1] = poly->vertices[i]->y;
|
||||
oldverts[i*2 ] = poly->Vertices[i]->x;
|
||||
oldverts[i*2+1] = poly->Vertices[i]->y;
|
||||
}
|
||||
oldcx = poly->CenterSpot.x;
|
||||
oldcy = poly->CenterSpot.y;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -770,12 +776,14 @@ void DPolyobjInterpolation::UpdateInterpolation()
|
|||
|
||||
void DPolyobjInterpolation::Restore()
|
||||
{
|
||||
for(int i = 0; i < poly->numvertices; i++)
|
||||
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
||||
{
|
||||
poly->vertices[i]->x = bakverts[i*2 ];
|
||||
poly->vertices[i]->y = bakverts[i*2+1];
|
||||
poly->Vertices[i]->x = bakverts[i*2 ];
|
||||
poly->Vertices[i]->y = bakverts[i*2+1];
|
||||
}
|
||||
//poly->Moved();
|
||||
poly->CenterSpot.x = bakcx;
|
||||
poly->CenterSpot.y = bakcy;
|
||||
poly->ClearSubsectorLinks();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -786,10 +794,10 @@ void DPolyobjInterpolation::Restore()
|
|||
|
||||
void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
|
||||
{
|
||||
for(int i = 0; i < poly->numvertices; i++)
|
||||
for(unsigned int i = 0; i < poly->Vertices.Size(); i++)
|
||||
{
|
||||
fixed_t *px = &poly->vertices[i]->x;
|
||||
fixed_t *py = &poly->vertices[i]->y;
|
||||
fixed_t *px = &poly->Vertices[i]->x;
|
||||
fixed_t *py = &poly->Vertices[i]->y;
|
||||
|
||||
bakverts[i*2 ] = *px;
|
||||
bakverts[i*2+1] = *py;
|
||||
|
@ -797,7 +805,12 @@ void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
|
|||
*px = oldverts[i*2 ] + FixedMul(bakverts[i*2 ] - oldverts[i*2 ], smoothratio);
|
||||
*py = oldverts[i*2+1] + FixedMul(bakverts[i*2+1] - oldverts[i*2+1], smoothratio);
|
||||
}
|
||||
//poly->Moved();
|
||||
bakcx = poly->CenterSpot.x;
|
||||
bakcy = poly->CenterSpot.y;
|
||||
poly->CenterSpot.x = bakcx + FixedMul(bakcx - oldcx, smoothratio);
|
||||
poly->CenterSpot.y = bakcy + FixedMul(bakcy - oldcy, smoothratio);
|
||||
|
||||
poly->ClearSubsectorLinks();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -808,11 +821,21 @@ void DPolyobjInterpolation::Interpolate(fixed_t smoothratio)
|
|||
|
||||
void DPolyobjInterpolation::Serialize(FArchive &arc)
|
||||
{
|
||||
|
||||
Super::Serialize(arc);
|
||||
int po = int(poly - polyobjs);
|
||||
arc << po << oldverts;
|
||||
poly = polyobjs + po;
|
||||
|
||||
if (SaveVersion >= 2448)
|
||||
{
|
||||
arc << oldcx << oldcy;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This will glitch if an old savegame is loaded but at least it'll allow loading it.
|
||||
oldcx = poly->CenterSpot.x;
|
||||
oldcy = poly->CenterSpot.y;
|
||||
}
|
||||
if (arc.IsLoading()) bakverts.Resize(oldverts.Size());
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "r_bsp.h"
|
||||
#include "r_plane.h"
|
||||
#include "v_palette.h"
|
||||
#include "po_man.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -1488,6 +1489,8 @@ void R_RenderActorView (AActor *actor, bool dontmaplines)
|
|||
{
|
||||
camera->renderflags |= RF_INVISIBLE;
|
||||
}
|
||||
// Link the polyobjects right before drawing the scene to reduce the amounts of calls to this function
|
||||
PO_LinkToSubsectors();
|
||||
if (r_polymost < 2)
|
||||
{
|
||||
R_RenderBSPNode (nodes + numnodes - 1); // The head node is the last node output.
|
||||
|
|
|
@ -1471,6 +1471,7 @@ void RP_Subsector (subsector_t *sub)
|
|||
// R_ProjectParticle (Particles + i, subsectors[sub-subsectors].sector, shade, FakeSide);
|
||||
// }
|
||||
|
||||
#if 0
|
||||
if (sub->poly)
|
||||
{ // Render the polyobj in the subsector first
|
||||
int polyCount = sub->poly->numsegs;
|
||||
|
@ -1480,6 +1481,7 @@ void RP_Subsector (subsector_t *sub)
|
|||
RP_AddLine (*polySeg++);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
while (count--)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "i_system.h"
|
||||
#include "cmdlib.h"
|
||||
#include "p_local.h"
|
||||
#include "po_man.h"
|
||||
#include "gi.h"
|
||||
#include "templates.h"
|
||||
#include "c_dispatch.h"
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "templates.h"
|
||||
#include "timidity/timidity.h"
|
||||
#include "g_level.h"
|
||||
#include "po_man.h"
|
||||
|
||||
// MACROS ------------------------------------------------------------------
|
||||
|
||||
|
@ -795,11 +796,11 @@ static void CalcSectorSoundOrg(const sector_t *sec, int channum, fixed_t *x, fix
|
|||
|
||||
static void CalcPolyobjSoundOrg(const FPolyObj *poly, fixed_t *x, fixed_t *y, fixed_t *z)
|
||||
{
|
||||
seg_t *seg;
|
||||
side_t *side;
|
||||
sector_t *sec;
|
||||
|
||||
PO_ClosestPoint(poly, *x, *y, *x, *y, &seg);
|
||||
sec = seg->frontsector;
|
||||
poly->ClosestPoint(*x, *y, *x, *y, &side);
|
||||
sec = side->sector;
|
||||
*z = clamp(*z, sec->floorplane.ZatPoint(*x, *y), sec->ceilingplane.ZatPoint(*x, *y));
|
||||
}
|
||||
|
||||
|
|
|
@ -129,6 +129,12 @@ public:
|
|||
{
|
||||
return Array[index];
|
||||
}
|
||||
// Returns a reference to the last element
|
||||
T &Last() const
|
||||
{
|
||||
return Array[Count-1];
|
||||
}
|
||||
|
||||
unsigned int Push (const T &item)
|
||||
{
|
||||
Grow (1);
|
||||
|
|
750
zdoom.vcproj
750
zdoom.vcproj
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue