- Added Gez's submission for Eternity-style skybox definitions.

SVN r2151 (trunk)
This commit is contained in:
Christoph Oelckers 2010-02-06 15:31:26 +00:00
parent ecb9d2f24b
commit 4310b239f4
8 changed files with 316 additions and 25 deletions

View file

@ -159,7 +159,7 @@ DEFINE_SPECIAL(Sector_SetCeilingPanning, 186, 5, 5, 5)
DEFINE_SPECIAL(Sector_SetFloorPanning, 187, 5, 5, 5) DEFINE_SPECIAL(Sector_SetFloorPanning, 187, 5, 5, 5)
DEFINE_SPECIAL(Sector_SetCeilingScale, 188, 5, 5, 5) DEFINE_SPECIAL(Sector_SetCeilingScale, 188, 5, 5, 5)
DEFINE_SPECIAL(Sector_SetFloorScale, 189, 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(SetPlayerProperty, 191, 3, 3, 3)
DEFINE_SPECIAL(Ceiling_LowerToHighestFloor, 192, 2, 2, 2) DEFINE_SPECIAL(Ceiling_LowerToHighestFloor, 192, 2, 2, 2)
DEFINE_SPECIAL(Ceiling_LowerInstant, 193, 3, 3, 3) DEFINE_SPECIAL(Ceiling_LowerInstant, 193, 3, 3, 3)

View file

@ -35,6 +35,7 @@
#include "actor.h" #include "actor.h"
#include "a_sharedglobal.h" #include "a_sharedglobal.h"
#include "p_local.h" #include "p_local.h"
#include "p_lnspec.h"
// arg0 = Visibility*4 for this skybox // arg0 = Visibility*4 for this skybox
@ -88,6 +89,64 @@ void ASkyViewpoint::Destroy ()
Super::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 // arg0 = tid of matching SkyViewpoint

View file

@ -354,12 +354,22 @@ void P_AddSectorLinksByID(sector_t *control, int id, INTBOOL ceiling)
{ {
int movetype = ld->args[3]; 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 // Make sure we have only valid combinations
movetype &= LINK_FLAGMASK; movetype &= LINK_FLAGMASK;
if ((movetype & LINK_FLOORMIRROR) == LINK_FLOORMIRRORFLAG) movetype &= ~LINK_FLOORMIRRORFLAG; if ((movetype & LINK_FLOORMIRROR) == LINK_FLOORMIRRORFLAG) movetype &= ~LINK_FLOORMIRRORFLAG;
if ((movetype & LINK_CEILINGMIRROR) == LINK_CEILINGMIRRORFLAG) movetype &= ~LINK_CEILINGMIRRORFLAG; 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); AddSingleSector(scrollplane, ld->frontsector, movetype);
} }

View file

@ -3418,8 +3418,24 @@ void P_SetupLevel (char *lumpname, int position)
else else
{ {
// We need translators only for Doom format maps. // We need translators only for Doom format maps.
// If none has been defined in a map use the game's default. const char *translator;
P_LoadTranslator(!level.info->Translator.IsEmpty()? level.info->Translator.GetChars() : gameinfo.translator.GetChars());
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); 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 else if (!map->isText) // regular nodes are not supported for text maps
{ {
times[7].Clock(); // If all 3 node related lumps are empty there's no need to output a message.
P_LoadSubsectors (map); // This just means that the map has no nodes and the engine is supposed to build them.
times[7].Unclock(); 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(); times[8].Clock();
if (!ForceNodeBuild) P_LoadNodes (map); if (!ForceNodeBuild) P_LoadNodes (map);
times[8].Unclock(); times[8].Unclock();
times[9].Clock(); times[9].Clock();
if (!ForceNodeBuild) P_LoadSegs (map); if (!ForceNodeBuild) P_LoadSegs (map);
times[9].Unclock(); times[9].Unclock();
}
else ForceNodeBuild = true;
} }
else ForceNodeBuild = true; else ForceNodeBuild = true;
} }

View file

@ -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; if (sector->CeilingSkyBox == NULL) sector->CeilingSkyBox = portal;
} }
else if (plane == 2 || plane == 0)
{ {
if (sector->FloorSkyBox == NULL) sector->FloorSkyBox = portal; 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;i<numlines;i++) for (int i=0;i<numlines;i++)
{ {
@ -933,7 +934,7 @@ void P_SpawnPortal(line_t *line, int sectortag, INTBOOL ceiling, int alpha)
if (lines[i].special == Sector_SetPortal && if (lines[i].special == Sector_SetPortal &&
lines[i].args[0] == sectortag && lines[i].args[0] == sectortag &&
lines[i].args[1] == 0 && lines[i].args[1] == 0 &&
lines[i].args[2] == ceiling && lines[i].args[2] == plane &&
lines[i].args[3] == 1) lines[i].args[3] == 1)
{ {
fixed_t x1 = (line->v1->x + line->v2->x) >> 1; fixed_t x1 = (line->v1->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;) for (int s=-1; (s = P_FindSectorFromTag(sectortag,s)) >= 0;)
{ {
SetPortal(&sectors[s], ceiling, reference); SetPortal(&sectors[s], plane, reference);
} }
for (int j=0;j<numlines;j++) for (int j=0;j<numlines;j++)
@ -963,18 +964,18 @@ void P_SpawnPortal(line_t *line, int sectortag, INTBOOL ceiling, int alpha)
// This must be done here to ensure that it gets done only after the portal is set up // This must be done here to ensure that it gets done only after the portal is set up
if (lines[i].special == Sector_SetPortal && if (lines[i].special == Sector_SetPortal &&
lines[i].args[1] == 1 && lines[i].args[1] == 1 &&
lines[i].args[2] == ceiling && lines[i].args[2] == plane &&
lines[i].args[3] == sectortag) lines[i].args[3] == sectortag)
{ {
if (lines[i].args[0] == 0) if (lines[i].args[0] == 0)
{ {
SetPortal(lines[i].frontsector, ceiling, reference); SetPortal(lines[i].frontsector, plane, reference);
} }
else else
{ {
for (int s=-1; (s = P_FindSectorFromTag(lines[i].args[0],s)) >= 0;) for (int s=-1; (s = P_FindSectorFromTag(lines[i].args[0],s)) >= 0;)
{ {
SetPortal(&sectors[s], ceiling, reference); SetPortal(&sectors[s], plane, reference);
} }
} }
} }
@ -1211,8 +1212,12 @@ void P_SpawnSpecials (void)
case Sector_SetPortal: case Sector_SetPortal:
// arg 0 = sector tag // arg 0 = sector tag
// arg 1 = type (must be 0, other values reserved for later use) // arg 1 = type
// arg 2 = 0:floor, 1:ceiling // - 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 3 = 0: anchor, 1: reference line
// arg 4 = for the anchor only: alpha // arg 4 = for the anchor only: alpha
if (lines[i].args[1] == 0 && lines[i].args[3] == 0) if (lines[i].args[1] == 0 && lines[i].args[3] == 0)

View file

@ -535,7 +535,7 @@ bool P_CheckSwitchRange(AActor *user, line_t *line, int sideno)
// to keep compatibility with Eternity's implementation. // to keep compatibility with Eternity's implementation.
if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot)) if (!P_GetMidTexturePosition(line, sideno, &checktop, &checkbot))
return false; return false;
return user->z < checktop || user->z + user->height > checkbot; return user->z < checktop && user->z + user->height > checkbot;
} }
else else
{ {

View file

@ -14,6 +14,9 @@ ACTOR SkyPicker 9081 native
+DONTSPLASH +DONTSPLASH
} }
Actor SkyCamCompat : SkyViewpoint 9083 native
{
}
ACTOR StackPoint : SkyViewpoint native ACTOR StackPoint : SkyViewpoint native
{ {

View file

@ -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