- merged all portals with the same displacement together. While this provides

a mild performance increase it's not what I hoped it would do...
- Moved portal initialization for the portal things to P_SpawnSpecials
  instead of having the things self-initialize in PostBeginPlay. This was
  done to ensure that the portals are fully set up when the game begins.
  Otherwise there is no decent way to let the renderer post-process this
  information during setup.
- Changed: For 800x600 the default scaling handling of the options menu
  makes it become too small so for any resolution with a width between 
  800 and 959 it has been reverted to the regular clean scaling factor.


SVN r2055 (trunk)
This commit is contained in:
Christoph Oelckers 2009-12-28 17:13:30 +00:00
commit 3d40dbb659
6 changed files with 119 additions and 50 deletions

View file

@ -69,6 +69,8 @@
#include "r_interpolate.h"
static FRandom pr_playerinspecialsector ("PlayerInSpecialSector");
void P_SetupPortals();
// [GrafZahl] Make this message changable by the user! ;)
CVAR(String, secretmessage, "A Secret is revealed!", CVAR_ARCHIVE)
@ -828,6 +830,89 @@ void DWallLightTransfer::DoTransfer (BYTE lightlevel, int target, BYTE flags)
}
}
//-----------------------------------------------------------------------------
//
// Portals
//
//-----------------------------------------------------------------------------
//---------------------------------------------------------------------------
// Upper stacks go in the top sector. Lower stacks go in the bottom sector.
static void SetupFloorPortal (AStackPoint *point)
{
NActorIterator it (NAME_LowerStackLookOnly, point->tid);
sector_t *Sector = point->Sector;
Sector->FloorSkyBox = static_cast<ASkyViewpoint*>(it.Next());
if (Sector->FloorSkyBox != NULL)
{
Sector->FloorSkyBox->Mate = point;
Sector->FloorSkyBox->PlaneAlpha = Scale (point->args[0], OPAQUE, 255);
}
}
static void SetupCeilingPortal (AStackPoint *point)
{
NActorIterator it (NAME_UpperStackLookOnly, point->tid);
sector_t *Sector = point->Sector;
Sector->CeilingSkyBox = static_cast<ASkyViewpoint*>(it.Next());
if (Sector->CeilingSkyBox != NULL)
{
Sector->CeilingSkyBox->Mate = point;
Sector->CeilingSkyBox->PlaneAlpha = Scale (point->args[0], OPAQUE, 255);
}
}
void P_SetupPortals()
{
TThinkerIterator<AStackPoint> it;
AStackPoint *pt;
TArray<AStackPoint *> points;
while ((pt = it.Next()))
{
FName nm = pt->GetClass()->TypeName;
if (nm == NAME_UpperStackLookOnly)
{
SetupFloorPortal(pt);
}
else if (nm == NAME_LowerStackLookOnly)
{
SetupCeilingPortal(pt);
}
pt->special1 = 0;
points.Push(pt);
}
for(unsigned i=0;i<points.Size(); i++)
{
if (points[i]->special1 == 0 && points[i]->Mate != NULL)
{
for(unsigned j=1;j<points.Size(); j++)
{
if (points[j]->special1 == 0 && points[j]->Mate != NULL && points[i]->GetClass() == points[j]->GetClass())
{
fixed_t deltax1 = points[i]->Mate->x - points[i]->x;
fixed_t deltay1 = points[i]->Mate->y - points[i]->y;
fixed_t deltax2 = points[j]->Mate->x - points[j]->x;
fixed_t deltay2 = points[j]->Mate->y - points[j]->y;
if (deltax1 == deltax2 && deltay1 == deltay2)
{
if (points[j]->Sector->FloorSkyBox == points[j])
points[j]->Sector->FloorSkyBox == points[i];
if (points[j]->Sector->CeilingSkyBox == points[j])
points[j]->Sector->CeilingSkyBox == points[i];
points[j]->special1 = 1;
break;
}
}
}
}
}
}
inline void SetPortal(sector_t *sector, INTBOOL ceiling, AStackPoint *portal)
{
@ -914,6 +999,8 @@ void P_SpawnSpecials (void)
sector_t *sector;
int i;
P_SetupPortals();
// Init special SECTORs.
sector = sectors;
for (i = 0; i < numsectors; i++, sector++)