mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-10 14:51:51 +00:00
- Added a few 'activator == NULL' checks to some ACS functions.
- Added line and vertex lists to polyobjects so that I can do some changes that won't work with only a seg list being maintained. SVN r1016 (trunk)
This commit is contained in:
parent
165875c7df
commit
8a3edf9716
9 changed files with 123 additions and 53 deletions
|
@ -1,4 +1,9 @@
|
|||
June 2, 2008 (SBarInfo update #23)
|
||||
June 3, 2008 (Changes by Graf Zahl)
|
||||
- Added a few 'activator == NULL' checks to some ACS functions.
|
||||
- Added line and vertex lists to polyobjects so that I can do some
|
||||
changes that won't work with only a seg list being maintained.
|
||||
|
||||
June 3, 2008 (SBarInfo update #23)
|
||||
- Fixed: Drawing the amount of an inventory item in the player's inventory did
|
||||
not work
|
||||
- Added: PowerupTime to drawnumber and drawbar. You must specify a
|
||||
|
|
|
@ -4827,6 +4827,8 @@ int DLevelScript::RunScript ()
|
|||
break;
|
||||
|
||||
case PCD_CHECKWEAPON:
|
||||
if (script == 4)
|
||||
__asm nop
|
||||
if (activator == NULL || activator->player == NULL || // Non-players do not have weapons
|
||||
activator->player->ReadyWeapon == NULL)
|
||||
{
|
||||
|
@ -5110,7 +5112,8 @@ int DLevelScript::RunScript ()
|
|||
case PCD_SETACTORANGLE: // [GRB]
|
||||
if (STACK(2) == 0)
|
||||
{
|
||||
activator->angle = STACK(1) << 16;
|
||||
if (activator != NULL)
|
||||
activator->angle = STACK(1) << 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5128,7 +5131,8 @@ int DLevelScript::RunScript ()
|
|||
case PCD_SETACTORPITCH:
|
||||
if (STACK(2) == 0)
|
||||
{
|
||||
activator->pitch = STACK(1) << 16;
|
||||
if (activator != NULL)
|
||||
activator->pitch = STACK(1) << 16;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5153,15 +5157,18 @@ int DLevelScript::RunScript ()
|
|||
|
||||
if (STACK(3) == 0)
|
||||
{
|
||||
state = activator->GetClass()->ActorInfo->FindState (statelist.Size(), &statelist[0], !!STACK(1));
|
||||
if (state != NULL)
|
||||
if (activator != NULL)
|
||||
{
|
||||
activator->SetState (state);
|
||||
STACK(3) = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
STACK(3) = 0;
|
||||
state = activator->GetClass()->ActorInfo->FindState (statelist.Size(), &statelist[0], !!STACK(1));
|
||||
if (state != NULL)
|
||||
{
|
||||
activator->SetState (state);
|
||||
STACK(3) = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
STACK(3) = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -681,15 +681,14 @@ line_t *FBlockLinesIterator::Next()
|
|||
polyLink->polyobj->validcount = validcount;
|
||||
}
|
||||
|
||||
seg_t *seg = polyLink->polyobj->segs[polyIndex];
|
||||
line_t *ld = polyLink->polyobj->lines[polyIndex];
|
||||
|
||||
if (++polyIndex >= polyLink->polyobj->numsegs)
|
||||
if (++polyIndex >= polyLink->polyobj->numlines)
|
||||
{
|
||||
polyLink = polyLink->next;
|
||||
polyIndex = 0;
|
||||
}
|
||||
|
||||
line_t *ld = seg->linedef;
|
||||
if (ld->validcount == validcount)
|
||||
{
|
||||
continue;
|
||||
|
|
|
@ -3093,21 +3093,6 @@ void P_FreeLevelData ()
|
|||
}
|
||||
if (polyobjs != NULL)
|
||||
{
|
||||
for (int i = 0; i < po_NumPolyobjs; ++i)
|
||||
{
|
||||
if (polyobjs[i].segs != NULL)
|
||||
{
|
||||
delete[] polyobjs[i].segs;
|
||||
}
|
||||
if (polyobjs[i].originalPts != NULL)
|
||||
{
|
||||
delete[] polyobjs[i].originalPts;
|
||||
}
|
||||
if (polyobjs[i].prevPts != NULL)
|
||||
{
|
||||
delete[] polyobjs[i].prevPts;
|
||||
}
|
||||
}
|
||||
delete[] polyobjs;
|
||||
polyobjs = NULL;
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ static bool P_SightBlockLinesIterator (int x, int y)
|
|||
int *list;
|
||||
|
||||
polyblock_t *polyLink;
|
||||
seg_t **segList;
|
||||
int i;
|
||||
extern polyblock_t **PolyBlockMap;
|
||||
|
||||
|
@ -184,10 +183,9 @@ static bool P_SightBlockLinesIterator (int x, int y)
|
|||
if (polyLink->polyobj->validcount != validcount)
|
||||
{
|
||||
polyLink->polyobj->validcount = validcount;
|
||||
segList = polyLink->polyobj->segs;
|
||||
for (i = 0; i < polyLink->polyobj->numsegs; i++, segList++)
|
||||
for (i = 0; i < polyLink->polyobj->numlines; i++)
|
||||
{
|
||||
if (!P_SightCheckLine ((*segList)->linedef))
|
||||
if (!P_SightCheckLine (polyLink->polyobj->lines[i]))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -189,20 +189,18 @@ DPolyAction::~DPolyAction ()
|
|||
void DPolyAction::SetInterpolation ()
|
||||
{
|
||||
FPolyObj *poly = GetPolyobj (m_PolyObj);
|
||||
for (int i = 0; i < poly->numsegs; ++i)
|
||||
for (int i = 0; i < poly->numvertices; ++i)
|
||||
{
|
||||
setinterpolation (INTERP_Vertex, poly->segs[i]->v1);
|
||||
setinterpolation (INTERP_Vertex, poly->segs[i]->v2);
|
||||
setinterpolation (INTERP_Vertex, poly->vertices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
void DPolyAction::StopInterpolation ()
|
||||
{
|
||||
FPolyObj *poly = GetPolyobj (m_PolyObj);
|
||||
for (int i = 0; i < poly->numsegs; ++i)
|
||||
for (int i = 0; i < poly->numvertices; ++i)
|
||||
{
|
||||
stopinterpolation (INTERP_Vertex, poly->segs[i]->v1);
|
||||
stopinterpolation (INTERP_Vertex, poly->segs[i]->v2);
|
||||
stopinterpolation (INTERP_Vertex, poly->vertices[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -711,7 +709,7 @@ static int GetPolyobjMirror(int poly)
|
|||
{
|
||||
if (polyobjs[i].tag == poly)
|
||||
{
|
||||
return (*polyobjs[i].segs)->linedef->args[1];
|
||||
return polyobjs[i].lines[0]->args[1];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -1452,6 +1450,44 @@ static void SpawnPolyobj (int index, int tag, int type)
|
|||
else
|
||||
I_Error ("SpawnPolyobj: Poly %d does not exist\n", tag);
|
||||
}
|
||||
|
||||
TArray<line_t *> lines;
|
||||
TArray<vertex_t *> vertices;
|
||||
|
||||
for(int i=0; i<polyobjs[index].numsegs; i++)
|
||||
{
|
||||
line_t *l = polyobjs[index].segs[i]->linedef;
|
||||
int j;
|
||||
|
||||
for(j = lines.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
if (lines[j] == l) break;
|
||||
}
|
||||
if (j < 0) lines.Push(l);
|
||||
|
||||
vertex_t *v = polyobjs[index].segs[i]->v1;
|
||||
|
||||
for(j = vertices.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
if (vertices[j] == v) break;
|
||||
}
|
||||
if (j < 0) vertices.Push(v);
|
||||
|
||||
v = polyobjs[index].segs[i]->v2;
|
||||
|
||||
for(j = vertices.Size() - 1; j >= 0; j--)
|
||||
{
|
||||
if (vertices[j] == v) break;
|
||||
}
|
||||
if (j < 0) vertices.Push(v);
|
||||
}
|
||||
polyobjs[index].numlines = lines.Size();
|
||||
polyobjs[index].lines = new line_t*[lines.Size()];
|
||||
memcpy(polyobjs[index].lines, &lines[0], sizeof(lines[0]) * lines.Size());
|
||||
|
||||
polyobjs[index].numvertices = vertices.Size();
|
||||
polyobjs[index].vertices = new vertex_t*[vertices.Size()];
|
||||
memcpy(polyobjs[index].vertices, &vertices[0], sizeof(vertices[0]) * vertices.Size());
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
@ -1629,3 +1665,33 @@ bool PO_Busy (int polyobj)
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FPolyObj::~FPolyObj()
|
||||
{
|
||||
if (segs != NULL)
|
||||
{
|
||||
delete[] segs;
|
||||
segs = NULL;
|
||||
}
|
||||
if (lines != NULL)
|
||||
{
|
||||
delete[] lines;
|
||||
lines = NULL;
|
||||
}
|
||||
if (vertices != NULL)
|
||||
{
|
||||
delete[] vertices;
|
||||
vertices = NULL;
|
||||
}
|
||||
if (originalPts != NULL)
|
||||
{
|
||||
delete[] originalPts;
|
||||
originalPts = NULL;
|
||||
}
|
||||
if (prevPts != NULL)
|
||||
{
|
||||
delete[] prevPts;
|
||||
prevPts = NULL;
|
||||
}
|
||||
}
|
|
@ -654,6 +654,10 @@ struct FPolyObj
|
|||
{
|
||||
int numsegs;
|
||||
seg_t **segs;
|
||||
int numlines;
|
||||
line_t **lines;
|
||||
int numvertices;
|
||||
vertex_t **vertices;
|
||||
fixed_t startSpot[3];
|
||||
vertex_t *originalPts; // used as the base for the rotations
|
||||
vertex_t *prevPts; // use to restore the old point values
|
||||
|
@ -666,6 +670,8 @@ struct FPolyObj
|
|||
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
|
||||
|
||||
~FPolyObj();
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
@ -2,12 +2,13 @@
|
|||
#define R_INTERPOLATE_H
|
||||
|
||||
#include "doomtype.h"
|
||||
#include "dobject.h"
|
||||
#include "r_defs.h"
|
||||
|
||||
// BUILD stuff for interpolating between frames, but modified (rather a lot)
|
||||
#define INTERPOLATION_BUCKETS 107
|
||||
|
||||
|
||||
#if 0
|
||||
#if 0
|
||||
|
||||
class DInterpolation : public DObject
|
||||
{
|
||||
|
@ -21,11 +22,11 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
void Destroy();
|
||||
void CopyInterpToOld() = 0;
|
||||
void CopyBakToInterp() = 0;
|
||||
void DoAnInterpolation(fixed_t smoothratio) = 0;
|
||||
void Serialize(FArchive &arc);
|
||||
virtual void Destroy();
|
||||
virtual void CopyInterpToOld() = 0;
|
||||
virtual void CopyBakToInterp() = 0;
|
||||
virtual void DoAnInterpolation(fixed_t smoothratio) = 0;
|
||||
virtual void Serialize(FArchive &arc);
|
||||
};
|
||||
|
||||
class DSectorPlaneInterpolation : public DInterpolation
|
||||
|
@ -53,7 +54,7 @@ public:
|
|||
|
||||
class DSectorScrollInterpolation : public DInterpolation
|
||||
{
|
||||
DECLARE_CLASS(DFloorScrollInterpolation, DInterpolation)
|
||||
DECLARE_CLASS(DSectorScrollInterpolation, DInterpolation)
|
||||
|
||||
sector_t *sector;
|
||||
fixed_t oldx, oldy;
|
||||
|
@ -98,7 +99,7 @@ class DPolyobjInterpolation : public DInterpolation
|
|||
|
||||
public:
|
||||
|
||||
DPolyobjInterpolation(FPolyobj *poly);
|
||||
DPolyobjInterpolation(FPolyObj *poly);
|
||||
void Destroy();
|
||||
void CopyInterpToOld();
|
||||
void CopyBakToInterp();
|
||||
|
@ -115,11 +116,11 @@ struct FInterpolator
|
|||
|
||||
private:
|
||||
|
||||
size_t HashKey(FName type, void *interptr);
|
||||
DInterpolation *FindInterpolation(const PClass *, void *interptr, DInterpolation **&interp_p);
|
||||
size_t HashKey(FName type, void *interptr, int param);
|
||||
DInterpolation *FindInterpolation(const PClass *, void *interptr, int param, DInterpolation **&interp_p);
|
||||
|
||||
public:
|
||||
DInterpolation *FindInterpolation(const PClass *, void *interptr);
|
||||
DInterpolation *FindInterpolation(const PClass *, void *interptr, int param);
|
||||
void UpdateInterpolations();
|
||||
void AddInterpolation(DInterpolation *);
|
||||
void RemoveInterpolation(DInterpolation *);
|
||||
|
@ -127,7 +128,6 @@ public:
|
|||
void RestoreInterpolations();
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
class FArchive;
|
||||
|
|
|
@ -2612,6 +2612,10 @@
|
|||
RelativePath=".\src\r_draw.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\r_interpolate.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\src\r_jpeg.h"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue