From 3d40dbb659a41553f2357d99d714a995c2d73cf9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 28 Dec 2009 17:13:30 +0000 Subject: [PATCH] - 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) --- docs/rh-log.txt | 12 ++++ src/g_shared/a_skies.cpp | 44 -------------- src/namedef.h | 3 + src/p_spec.cpp | 87 +++++++++++++++++++++++++++ src/v_video.cpp | 19 ++++-- wadsrc/static/actors/shared/skies.txt | 4 +- 6 files changed, 119 insertions(+), 50 deletions(-) diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 089076e0a6..436836e971 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,15 @@ +December 28, 2009 (Changes by Graf Zahl) +- 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. + December 27, 2009 (Changes by Graf Zahl) - added Hirogen2's Backpack fix for sv_unlimited_pickup. - added a linedef based method to define portals. Portals defined this way diff --git a/src/g_shared/a_skies.cpp b/src/g_shared/a_skies.cpp index cfe024b48e..8ca0937c21 100644 --- a/src/g_shared/a_skies.cpp +++ b/src/g_shared/a_skies.cpp @@ -156,50 +156,6 @@ void AStackPoint::BeginPlay () bAlways = true; } -//--------------------------------------------------------------------------- -// Upper stacks go in the top sector. Lower stacks go in the bottom sector. - -class AUpperStackLookOnly : public AStackPoint -{ - DECLARE_CLASS (AUpperStackLookOnly, AStackPoint) -public: - void PostBeginPlay (); -}; - -class ALowerStackLookOnly : public AStackPoint -{ - DECLARE_CLASS (ALowerStackLookOnly, AStackPoint) -public: - void PostBeginPlay (); -}; - -IMPLEMENT_CLASS (AUpperStackLookOnly) -IMPLEMENT_CLASS (ALowerStackLookOnly) - -void AUpperStackLookOnly::PostBeginPlay () -{ - Super::PostBeginPlay (); - TActorIterator it (tid); - Sector->FloorSkyBox = it.Next(); - if (Sector->FloorSkyBox != NULL) - { - Sector->FloorSkyBox->Mate = this; - Sector->FloorSkyBox->PlaneAlpha = Scale (args[0], OPAQUE, 255); - } -} - -void ALowerStackLookOnly::PostBeginPlay () -{ - Super::PostBeginPlay (); - TActorIterator it (tid); - Sector->CeilingSkyBox = it.Next(); - if (Sector->CeilingSkyBox != NULL) - { - Sector->CeilingSkyBox->Mate = this; - Sector->CeilingSkyBox->PlaneAlpha = Scale (args[0], OPAQUE, 255); - } -} - //--------------------------------------------------------------------------- class ASectorSilencer : public AActor diff --git a/src/namedef.h b/src/namedef.h index ebddcc213d..0eb9ce1083 100644 --- a/src/namedef.h +++ b/src/namedef.h @@ -64,6 +64,9 @@ xx(Wind) xx(PointPusher) xx(PointPuller) +xx(UpperStackLookOnly) +xx(LowerStackLookOnly) + xx(BulletPuff) xx(StrifePuff) xx(MaulerPuff) diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 525a601fa0..487fff482c 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -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(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(it.Next()); + if (Sector->CeilingSkyBox != NULL) + { + Sector->CeilingSkyBox->Mate = point; + Sector->CeilingSkyBox->PlaneAlpha = Scale (point->args[0], OPAQUE, 255); + } +} + +void P_SetupPortals() +{ + TThinkerIterator it; + AStackPoint *pt; + TArray 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;ispecial1 == 0 && points[i]->Mate != NULL) + { + for(unsigned j=1;jspecial1 == 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++) diff --git a/src/v_video.cpp b/src/v_video.cpp index fa1f090d04..e9be862089 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -1398,10 +1398,21 @@ bool V_DoModeSetup (int width, int height, int bits) assert(CleanWidth >= 320); assert(CleanHeight >= 200); - CleanXfac_1 = MAX(CleanXfac - 1, 1); - CleanYfac_1 = MAX(CleanYfac - 1, 1); - CleanWidth_1 = width / CleanXfac_1; - CleanHeight_1 = height / CleanYfac_1; + if (width < 800 || width >= 960) + { + CleanXfac_1 = MAX(CleanXfac - 1, 1); + CleanYfac_1 = MAX(CleanYfac - 1, 1); + CleanWidth_1 = width / CleanXfac_1; + CleanHeight_1 = height / CleanYfac_1; + } + else // if the width is between 800 and 960 the ratio between the screensize and CleanXFac-1 becomes too large. + { + CleanXfac_1 = CleanXfac; + CleanYfac_1 = CleanYfac; + CleanWidth_1 = CleanWidth; + CleanHeight_1 = CleanHeight; + } + DisplayWidth = width; DisplayHeight = height; diff --git a/wadsrc/static/actors/shared/skies.txt b/wadsrc/static/actors/shared/skies.txt index a4dce7db4f..d652f55054 100644 --- a/wadsrc/static/actors/shared/skies.txt +++ b/wadsrc/static/actors/shared/skies.txt @@ -19,11 +19,11 @@ ACTOR StackPoint : SkyViewpoint native { } -ACTOR UpperStackLookOnly : StackPoint 9077 native +ACTOR UpperStackLookOnly : StackPoint 9077 { } -ACTOR LowerStackLookOnly : StackPoint 9078 native +ACTOR LowerStackLookOnly : StackPoint 9078 { }