From 4310b239f491396cd0193e51689e5f7037c347ee Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 6 Feb 2010 15:31:26 +0000 Subject: [PATCH] - Added Gez's submission for Eternity-style skybox definitions. SVN r2151 (trunk) --- src/actionspecials.h | 2 +- src/g_shared/a_skies.cpp | 59 ++++++++ src/p_linkedsectors.cpp | 12 +- src/p_setup.cpp | 44 ++++-- src/p_spec.cpp | 27 ++-- src/p_switch.cpp | 2 +- wadsrc/static/actors/shared/skies.txt | 3 + wadsrc/static/xlat/eternity.txt | 192 ++++++++++++++++++++++++++ 8 files changed, 316 insertions(+), 25 deletions(-) create mode 100644 wadsrc/static/xlat/eternity.txt diff --git a/src/actionspecials.h b/src/actionspecials.h index 5405b25420..5d9471fecc 100644 --- a/src/actionspecials.h +++ b/src/actionspecials.h @@ -159,7 +159,7 @@ DEFINE_SPECIAL(Sector_SetCeilingPanning, 186, 5, 5, 5) DEFINE_SPECIAL(Sector_SetFloorPanning, 187, 5, 5, 5) DEFINE_SPECIAL(Sector_SetCeilingScale, 188, 5, 5, 5) DEFINE_SPECIAL(Sector_SetFloorScale, 189, 5, 5, 5) -DEFINE_SPECIAL(Static_Init, 190, -1, -1, 3) +DEFINE_SPECIAL(Static_Init, 190, -1, -1, 4) DEFINE_SPECIAL(SetPlayerProperty, 191, 3, 3, 3) DEFINE_SPECIAL(Ceiling_LowerToHighestFloor, 192, 2, 2, 2) DEFINE_SPECIAL(Ceiling_LowerInstant, 193, 3, 3, 3) diff --git a/src/g_shared/a_skies.cpp b/src/g_shared/a_skies.cpp index 8ca0937c21..0454498e29 100644 --- a/src/g_shared/a_skies.cpp +++ b/src/g_shared/a_skies.cpp @@ -35,6 +35,7 @@ #include "actor.h" #include "a_sharedglobal.h" #include "p_local.h" +#include "p_lnspec.h" // arg0 = Visibility*4 for this skybox @@ -88,6 +89,64 @@ void ASkyViewpoint::Destroy () Super::Destroy(); } +// For an RR compatible linedef based definition. This searches the viewpoint's sector +// for a skybox line special, gets its tag and transfers the skybox to all tagged sectors. +class ASkyCamCompat : public ASkyViewpoint +{ + DECLARE_CLASS (ASkyCamCompat, ASkyViewpoint) +public: + void BeginPlay (); +}; + +IMPLEMENT_CLASS (ASkyCamCompat) + +extern FTextureID skyflatnum; + +void ASkyCamCompat::BeginPlay () +{ + if (Sector == NULL) + { + Printf("Sector not initialized for SkyCamCompat\n"); + Sector = P_PointInSector(x, y); + } + if (Sector) + { + line_t * refline = NULL; + for (short i = 0; i < Sector->linecount; i++) + { + refline = Sector->lines[i]; + if (refline->special == Sector_SetPortal && refline->args[1] == 2) + { + // We found the setup linedef for this skybox, so let's use it for our init. + int skybox_id = refline->args[0]; + + // Then, change the alpha + alpha = refline->args[4]; + + // Finally, skyboxify all tagged sectors + // This involves changing their texture to the sky flat, because while + // EE works with any texture for its skybox portals, ZDoom doesn't. + for (int secnum =-1; (secnum = P_FindSectorFromTag (skybox_id, secnum)) != -1; ) + { + // plane: 0=floor, 1=ceiling, 2=both + if (refline->args[2] == 1 || refline->args[2] == 2) + { + sectors[secnum].CeilingSkyBox = this; + sectors[secnum].SetTexture(sector_t::ceiling, skyflatnum, false); + } + if (refline->args[2] == 0 || refline->args[2] == 2) + { + sectors[secnum].FloorSkyBox = this; + sectors[secnum].SetTexture(sector_t::floor, skyflatnum, false); + } + } + } + } + } + // Do not call the SkyViewpoint's super method because it would trash our setup + AActor::BeginPlay(); +} + //--------------------------------------------------------------------------- // arg0 = tid of matching SkyViewpoint diff --git a/src/p_linkedsectors.cpp b/src/p_linkedsectors.cpp index b932eb0aaf..2d06bc0431 100644 --- a/src/p_linkedsectors.cpp +++ b/src/p_linkedsectors.cpp @@ -354,12 +354,22 @@ void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling) { int movetype = ld->args[3]; + // [GZ] Eternity does allow the attached sector to be the control sector, + // this permits elevator effects (ceiling attached to floors), so instead + // of checking whether the two sectors are the same, we prevent a plane + // from being attached to itself. This should be enough to do the trick. + if (ld->frontsector == control) + { + if (ceiling) movetype &= ~LINK_CEILING; + else movetype &= ~LINK_FLOOR; + } + // Make sure we have only valid combinations movetype &= LINK_FLAGMASK; if ((movetype & LINK_FLOORMIRROR) == LINK_FLOORMIRRORFLAG) movetype &= ~LINK_FLOORMIRRORFLAG; if ((movetype & LINK_CEILINGMIRROR) == LINK_CEILINGMIRRORFLAG) movetype &= ~LINK_CEILINGMIRRORFLAG; - if (movetype != 0 && ld->frontsector != NULL && ld->frontsector != control) + if (movetype != 0 && ld->frontsector != NULL)//&& ld->frontsector != control) Needs to be allowed! { AddSingleSector(scrollplane, ld->frontsector, movetype); } diff --git a/src/p_setup.cpp b/src/p_setup.cpp index 202cca4093..0afb49be4c 100644 --- a/src/p_setup.cpp +++ b/src/p_setup.cpp @@ -3418,8 +3418,24 @@ void P_SetupLevel (char *lumpname, int position) else { // We need translators only for Doom format maps. - // If none has been defined in a map use the game's default. - P_LoadTranslator(!level.info->Translator.IsEmpty()? level.info->Translator.GetChars() : gameinfo.translator.GetChars()); + const char *translator; + + if (!level.info->Translator.IsEmpty()) + { + // The map defines its own translator. + translator = level.info->Translator.GetChars(); + } + else + { + // Has the user overridden the game's default translator with a commandline parameter? + translator = Args->CheckValue("-xlat"); + if (translator == NULL) + { + // Use the game's default. + translator = gameinfo.translator.GetChars(); + } + } + P_LoadTranslator(translator); } CheckCompatibility(map); @@ -3561,17 +3577,23 @@ void P_SetupLevel (char *lumpname, int position) } else if (!map->isText) // regular nodes are not supported for text maps { - times[7].Clock(); - P_LoadSubsectors (map); - times[7].Unclock(); + // If all 3 node related lumps are empty there's no need to output a message. + // This just means that the map has no nodes and the engine is supposed to build them. + if (map->Size(ML_SEGS) != 0 || map->Size(ML_SSECTORS) != 0 || map->Size(ML_NODES) != 0) + { + times[7].Clock(); + P_LoadSubsectors (map); + times[7].Unclock(); - times[8].Clock(); - if (!ForceNodeBuild) P_LoadNodes (map); - times[8].Unclock(); + times[8].Clock(); + if (!ForceNodeBuild) P_LoadNodes (map); + times[8].Unclock(); - times[9].Clock(); - if (!ForceNodeBuild) P_LoadSegs (map); - times[9].Unclock(); + times[9].Clock(); + if (!ForceNodeBuild) P_LoadSegs (map); + times[9].Unclock(); + } + else ForceNodeBuild = true; } else ForceNodeBuild = true; } diff --git a/src/p_spec.cpp b/src/p_spec.cpp index 6ac57bb4a2..95bee9eb36 100644 --- a/src/p_spec.cpp +++ b/src/p_spec.cpp @@ -912,19 +912,20 @@ void P_SetupPortals() } } -inline void SetPortal(sector_t *sector, INTBOOL ceiling, AStackPoint *portal) +inline void SetPortal(sector_t *sector, int plane, AStackPoint *portal) { - if (ceiling) + // plane: 0=floor, 1=ceiling, 2=both + if (plane > 0) { if (sector->CeilingSkyBox == NULL) sector->CeilingSkyBox = portal; } - else + if (plane == 2 || plane == 0) { if (sector->FloorSkyBox == NULL) sector->FloorSkyBox = portal; } } -void P_SpawnPortal(line_t *line, int sectortag, INTBOOL ceiling, int alpha) +void P_SpawnPortal(line_t *line, int sectortag, int plane, int alpha) { for (int i=0;iv1->x + line->v2->x) >> 1; @@ -954,7 +955,7 @@ void P_SpawnPortal(line_t *line, int sectortag, INTBOOL ceiling, int alpha) for (int s=-1; (s = P_FindSectorFromTag(sectortag,s)) >= 0;) { - SetPortal(§ors[s], ceiling, reference); + SetPortal(§ors[s], plane, reference); } for (int j=0;j= 0;) { - SetPortal(§ors[s], ceiling, reference); + SetPortal(§ors[s], plane, reference); } } } @@ -1211,8 +1212,12 @@ void P_SpawnSpecials (void) 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 1 = type + // - 0: normal (handled here) + // - 1: copy (handled by the portal they copy) + // - 2: EE-style skybox (handled by the camera object) + // other values reserved for later use + // arg 2 = 0:floor, 1:ceiling, 2:both // 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) diff --git a/src/p_switch.cpp b/src/p_switch.cpp index f3b642b058..b7eeb784d3 100644 --- a/src/p_switch.cpp +++ b/src/p_switch.cpp @@ -535,7 +535,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno) // to keep compatibility with Eternity's implementation. if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot)) return false; - return user->z < checktop || user->z + user->height > checkbot; + return user->z < checktop && user->z + user->height > checkbot; } else { diff --git a/wadsrc/static/actors/shared/skies.txt b/wadsrc/static/actors/shared/skies.txt index d652f55054..3b531d527f 100644 --- a/wadsrc/static/actors/shared/skies.txt +++ b/wadsrc/static/actors/shared/skies.txt @@ -14,6 +14,9 @@ ACTOR SkyPicker 9081 native +DONTSPLASH } +Actor SkyCamCompat : SkyViewpoint 9083 native +{ +} ACTOR StackPoint : SkyViewpoint native { diff --git a/wadsrc/static/xlat/eternity.txt b/wadsrc/static/xlat/eternity.txt new file mode 100644 index 0000000000..ad270beb45 --- /dev/null +++ b/wadsrc/static/xlat/eternity.txt @@ -0,0 +1,192 @@ +#include "xlat/doom.txt" + +// xlat file for Eternity levels. +// Many specials are unsupported, especially portal stuff. +// Some unsupported linedefs wouldn't be hard to add to ZDoom, +// or are already there but implemented differently. Others are +// practically impossible, or aren't worth the effort. + +define Unsupported (0) + +// The tag for such a line is actually a key to find, in an ExtraData lump +// indicated for the current level by the EMAPINFO lump, what line special +// to actually use. This is how parameterized linedefs are used by Eternity +// in the Doom format. "xlating" this would thus be quite complicated... +270 = 0, Unsupported() // "ExtraDataSpecial" + +// These two are standard MBF specials, no need to redefine them, they're in xlat/doom.txt +// 271 = 0, Static_Init (tag, Init_TransferSky, 0) +// 272 = 0, Static_Init (tag, Init_TransferSky, 1) + +// Small script starters. Small is considered deprecated now anyway. +273 = 0, Unsupported() // "WR_StartScript_1S" +274 = 0, Unsupported() // "W1_StartScript" +275 = 0, Unsupported() // "W1_StartScript_1S" +276 = 0, Unsupported() // "SR_StartScript" +277 = 0, Unsupported() // "S1_StartScript" +278 = 0, Unsupported() // "GR_StartScript" +279 = 0, Unsupported() // "G1_StartScript" +280 = 0, Unsupported() // "WR_StartScript" + +// 3D mid-textures +281 = 0, Sector_Attach3DMidtex(tag, 0, 0) // "3DMidTex_MoveWithFloor" +282 = 0, Sector_Attach3DMidtex(tag, 0, 1) // "3DMidTex_MoveWithCeiling" + +// Plane portals are not supported in ZDoom, though they probably wouldn't be too hard to implement. +283 = 0, Unsupported() // "Portal_PlaneCeiling" +284 = 0, Unsupported() // "Portal_PlaneFloor" +285 = 0, Unsupported() // "Portal_PlaneFloorCeiling" +286 = 0, Unsupported() // "Portal_HorizonCeiling" +287 = 0, Unsupported() // "Portal_HorizonFloor" +288 = 0, Unsupported() // "Portal_HorizonFloorCeiling" +289 = 0, Unsupported() // "Portal_LineTransfer" + +// Skybox portals +290 = 0, Sector_SetPortal(tag, 2, 1, 1, 0) // "Portal_SkyboxCeiling" +291 = 0, Sector_SetPortal(tag, 2, 0, 1, 0) // "Portal_SkyboxFloor" +292 = 0, Sector_SetPortal(tag, 2, 2, 1, 0) // "Portal_SkyboxFloorCeiling" + +// Sector specials +293 = 0, Sector_SetWind(tag, 0, 0, 1) // "TransferHereticWind" +294 = 0, Sector_SetCurrent(tag, 0, 0, 1) // "TransferHereticCurrent" + +// Anchored portals -- Sector_SetPortal needs to allow to set both floor and ceiling, though. +295 = 0, Sector_SetPortal(tag, 0, 1, 1, 0) // "Portal_AnchoredCeiling" +296 = 0, Sector_SetPortal(tag, 0, 0, 1, 0) // "Portal_AnchoredFloor" +297 = 0, Sector_SetPortal(tag, 0, 2, 1, 0) // "Portal_AnchoredFloorCeiling" +298 = 0, Sector_SetPortal(tag, 0, 1, 0, 0) // "Portal_AnchorLine" +299 = 0, Sector_SetPortal(tag, 0, 0, 0, 0) // "Portal_AnchorLineFloor" + +// Parameterized linedefs +// They are never used directly in Doom-format maps. Instead, it passes through ExtraData and 270. +// Hexen format is incomplete; and Quasar wants to use ZDoom-compatible special values for UDMF. +// So there is no need to bother with them and they are listed only for completeness' sake. +/* + 300: "Door_Raise" + 301: "Door_Open" + 302: "Door_Close" + 303: "Door_CloseWaitOpen" + 304: "Door_WaitRaise" + 305: "Door_WaitClose" + 306: "Floor_RaiseToHighest" + 307: "Floor_LowerToHighest" + 308: "Floor_RaiseToLowest" + 309: "Floor_LowerToLowest" + 310: "Floor_RaiseToNearest" + 311: "Floor_LowerToNearest" + 312: "Floor_RaiseToLowestCeiling" + 313: "Floor_LowerToLowestCeiling" + 314: "Floor_RaiseToCeiling" + 315: "Floor_RaiseByTexture" + 316: "Floor_LowerByTexture" + 317: "Floor_RaiseByValue" + 318: "Floor_LowerByValue" + 319: "Floor_MoveToValue" + 320: "Floor_RaiseInstant" + 321: "Floor_LowerInstant" + 322: "Floor_ToCeilingInstant" + 323: "Ceiling_RaiseToHighest" + 324: "Ceiling_ToHighestInstant" + 325: "Ceiling_RaiseToNearest" + 326: "Ceiling_LowerToNearest" + 327: "Ceiling_RaiseToLowest" + 328: "Ceiling_LowerToLowest" + 329: "Ceiling_RaiseToHighestFloor" + 330: "Ceiling_LowerToHighestFloor" + 331: "Ceiling_ToFloorInstant" + 332: "Ceiling_LowerToFloor" + 333: "Ceiling_RaiseByTexture" + 334: "Ceiling_LowerByTexture" + 335: "Ceiling_RaiseByValue" + 336: "Ceiling_LowerByValue" + 337: "Ceiling_MoveToValue" + 338: "Ceiling_RaiseInstant" + 339: "Ceiling_LowerInstant" + 340: "Stairs_BuildUpDoom" + 341: "Stairs_BuildDownDoom" + 342: "Stairs_BuildUpDoomSync" + 343: "Stairs_BuildDownDoomSync" +*/ + +// Two-way portals are not supported yet either +344 = 0, Unsupported() // "Portal_TwowayCeiling" +345 = 0, Unsupported() // "Portal_TwowayFloor" +346 = 0, Unsupported() // "Portal_TwowayAnchorLine" +347 = 0, Unsupported() // "Portal_TwowayAnchorLineFloor" + +// More parameterized linedefs +/* + 348: "Polyobj_StartLine" + 349: "Polyobj_ExplicitLine" + 350: "Polyobj_DoorSlide" + 351: "Polyobj_DoorSwing" + 352: "Polyobj_Move" + 353: "Polyobj_OR_Move" + 354: "Polyobj_RotateRight" + 355: "Polyobj_OR_RotateRight" + 356: "Polyobj_RotateLeft" + 357: "Polyobj_OR_RotateLeft" +*/ + +// Eternity's linked portals, vertical link version (floor-to-ceiling) +358 = 0, Unsupported() // "Portal_LinkedCeiling" +359 = 0, Unsupported() // "Portal_LinkedFloor" +360 = 0, Unsupported() // "Portal_LinkedAnchorLine" +361 = 0, Unsupported() // "Portal_LinkedAnchorLineFloor" + +// Even more parameterized linedefs +/* + 362: "Pillar_Build" + 363: "Pillar_BuildAndCrush" + 364: "Pillar_Open" + 365: "ACS_Execute" + 366: "ACS_Suspend" + 367: "ACS_Terminate" + 368: "Light_RaiseByValue" + 369: "Light_LowerByValue" + 370: "Light_ChangeToValue" + 371: "Light_Fade" + 372: "Light_Glow" + 373: "Light_Flicker" + 374: "Light_Strobe" + 375: "Radius_Quake" +*/ + +// Eternity's linked portals, horizontal link version (wall-to-wall) +376 = 0, Unsupported() // "Portal_LinkedLineToLine" +377 = 0, Unsupported() // "Portal_LinkedLineToLineAnchor" + +// The famous Hexen linedef +// 378 = Line_SetIdentification + +// Attached sectors == linked sectors; However, the implementation in Eternity +// is based on front sectors of tagged lines, not on sector tags. So instead +// of Sector_SetLink, we pass through Static_Init to translate those. +379 = 0, Static_Init(tag, 3, 1) // "Attach_SetCeilingControl" +380 = 0, Static_Init(tag, 3, 0) // "Attach_SetFloorControl" +381 = 0, Static_Init(0, 3, 0, 1) // "Attach_FloorToControl" +382 = 0, Static_Init(0, 3, 1, 2) // "Attach_CeilingToControl" +383 = 0, Static_Init(0, 3, 0, 5) // "Attach_MirrorFloorToControl" +384 = 0, Static_Init(0, 3, 0, 10) // "Attach_MirrorCeilingToControl" + +// Attach tagged portal to front sector +385 = 0, Sector_SetPortal(0, 1, 2, tag) // "Apply_PortalToFrontsector" + +// Slopes! +386 = 0, Plane_Align (1, 0) // "Slope_FrontsectorFloor" +387 = 0, Plane_Align (0, 1) // "Slope_FrontsectorCeiling" +388 = 0, Plane_Align (1, 1) // "Slope_FrontsectorFloorAndCeiling" +389 = 0, Plane_Align (2, 0) // "Slope_BacksectorFloor" +390 = 0, Plane_Align (0, 2) // "Slope_BacksectorCeiling" +391 = 0, Plane_Align (2, 2) // "Slope_BacksectorFloorAndCeiling" +392 = 0, Plane_Align (2, 1) // "Slope_BackFloorAndFrontCeiling" +393 = 0, Plane_Align (1, 2) // "Slope_BackCeilingAndFrontFloor" +394 = 0, Plane_Copy (tag, 0) // "Slope_FrontFloorToTaggedSlope" +395 = 0, Plane_Copy (0, tag) // "Slope_FrontCeilingToTaggedSlope" +396 = 0, Plane_Copy(tag, tag)// "Slope_FrontFloorAndCeilingToTaggedSlope" + +// Last parameterized linedefs +// 397 = Floor_Waggle +// 398 = Thing_Spawn +// 399 = Thing_SpawnNoFog +// 400 = Teleport_EndGame