- added a linedef based method to define portals. Portals defined this way

still have the same limitations as those defines with the portal things.


SVN r2052 (trunk)
This commit is contained in:
Christoph Oelckers 2009-12-27 15:50:35 +00:00
parent 69270937dd
commit 3f059898fd
5 changed files with 74 additions and 9 deletions

View file

@ -1,3 +1,7 @@
December 27, 2009 (Changes by Graf Zahl)
- added a linedef based method to define portals. Portals defined this way
still have the same limitations as those defines with the portal things.
December 25, 2009 (Changes by Graf Zahl)
- Fixed: Decals could spread to walls which had a decal-less texture or
were flagged not to have decals.

View file

@ -55,6 +55,7 @@ DEFINE_SPECIAL(Line_SetTextureOffset, 53, 5, 5, 5)
DEFINE_SPECIAL(Sector_ChangeFlags, 54, 3, 3, 3)
DEFINE_SPECIAL(Line_SetBlocking, 55, 3, 3, 3)
DEFINE_SPECIAL(Line_SetTextureScale, 56, 5, 5, 5)
DEFINE_SPECIAL(Sector_SetPortal, 57, -1, -1, 5)
DEFINE_SPECIAL(Plat_PerpetualRaise, 60, 3, 3, 3)
DEFINE_SPECIAL(Plat_Stop, 61, 1, 1, 1)

View file

@ -89,16 +89,24 @@ public:
class ASkyViewpoint : public AActor
{
DECLARE_CLASS (ASkyViewpoint, AActor)
HAS_OBJECT_POINTERS
public:
void Serialize (FArchive &arc);
void BeginPlay ();
void Destroy ();
bool bInSkybox;
bool bAlways;
ASkyViewpoint *Mate;
TObjPtr<ASkyViewpoint> Mate;
fixed_t PlaneAlpha;
};
class AStackPoint : public ASkyViewpoint
{
DECLARE_CLASS (AStackPoint, ASkyViewpoint)
public:
void BeginPlay ();
};
class DFlashFader : public DThinker
{
DECLARE_CLASS (DFlashFader, DThinker)

View file

@ -38,7 +38,9 @@
// arg0 = Visibility*4 for this skybox
IMPLEMENT_CLASS (ASkyViewpoint)
IMPLEMENT_POINTY_CLASS (ASkyViewpoint)
DECLARE_POINTER(Mate)
END_POINTERS
// If this actor has no TID, make it the default sky box
void ASkyViewpoint::BeginPlay ()
@ -144,13 +146,6 @@ void ASkyPicker::PostBeginPlay ()
// arg0 = opacity of plane; 0 = invisible, 255 = fully opaque
class AStackPoint : public ASkyViewpoint
{
DECLARE_CLASS (AStackPoint, ASkyViewpoint)
public:
void BeginPlay ();
};
IMPLEMENT_CLASS (AStackPoint)
void AStackPoint::BeginPlay ()

View file

@ -59,6 +59,7 @@
#include "statnums.h"
#include "g_level.h"
#include "v_font.h"
#include "a_sharedglobal.h"
// State.
#include "r_state.h"
@ -827,6 +828,50 @@ void DWallLightTransfer::DoTransfer (BYTE lightlevel, int target, BYTE flags)
}
}
void P_SpawnPortal(line_t *line, int sectortag, INTBOOL ceiling, int alpha)
{
for (int i=0;i<numlines;i++)
{
// We must look for the reference line with a linear search unless we want to waste the line ID for it
// which is not a good idea.
if (lines[i].special == Sector_SetPortal &&
lines[i].args[0] == sectortag &&
lines[i].args[1] == 0 &&
lines[i].args[2] == ceiling &&
lines[i].args[3] == 1)
{
fixed_t x1 = (line->v1->x + line->v2->x) >> 1;
fixed_t y1 = (line->v1->y + line->v2->y) >> 1;
fixed_t x2 = (lines[i].v1->x + lines[i].v2->x) >> 1;
fixed_t y2 = (lines[i].v1->y + lines[i].v2->y) >> 1;
AStackPoint *anchor = Spawn<AStackPoint>(x1, y1, 0, NO_REPLACE);
AStackPoint *reference = Spawn<AStackPoint>(x2, y2, 0, NO_REPLACE);
reference->Mate = anchor;
anchor->Mate = reference;
// This is so that the renderer can distinguish these portals from
// the ones spawned with the '*StackLookOnly' things.
reference->flags |= MF_JUSTATTACKED;
anchor->flags |= MF_JUSTATTACKED;
for (int s=-1; (s = P_FindSectorFromTag(sectortag,s)) >= 0;)
{
if (ceiling)
{
if (sectors[s].CeilingSkyBox == NULL) sectors[s].CeilingSkyBox = reference;
}
else
{
if (sectors[s].FloorSkyBox == NULL) sectors[s].FloorSkyBox = reference;
}
}
return;
}
}
}
//
// P_SpawnSpecials
@ -1049,6 +1094,18 @@ void P_SpawnSpecials (void)
}
break;
case Sector_SetPortal:
// arg 0 = sector tag
// arg 1 = type (must be 0, other values reserved for later use)
// arg 2 = 0:floor, 1:ceiling
// arg 3 = 0: anchor, 1: reference line
// arg 4 = for the anchor only: alpha
if (lines[i].args[1] == 0 && lines[i].args[3] == 0)
{
P_SpawnPortal(&lines[i], lines[i].args[0], lines[i].args[2], lines[i].args[4]);
}
break;
// [RH] ZDoom Static_Init settings
case Static_Init:
switch (lines[i].args[1])