#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)

enum
{
	Init_EDSector = 253,
	Init_EDLine = 254
}

// 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.

270 = 0,	Static_Init(tag, Init_EDLine) // "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)

273 = WALK|REP|FIRSTSIDE,	ACS_Execute(tag)
274 = WALK,					ACS_Execute(tag)
275 = WALK|FIRSTSIDE,		ACS_Execute(tag)
276 = USE|REP,				ACS_Execute(tag)
277 = USE,					ACS_Execute(tag)
278 = SHOOT|REP,			ACS_Execute(tag)
279 = SHOOT,				ACS_Execute(tag)
280 = WALK|REP,				ACS_Execute(tag)

// 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.
// The translation here is for the odd Extradata that specifies them as numbers.
300 = 0, Door_Raise(0)
301 = 0, Door_Open(0)
302 = 0, Door_Close(0)
303 = 0, Door_CloseWaitOpen(0)
304 = 0, Door_WaitRaise(0)
305 = 0, Door_WaitClose(0)
306 = 0, Floor_RaiseToHighest(0)
307 = 0, Floor_LowerToHighestEE(0)
308 = 0, Floor_RaiseToLowest(0)
309 = 0, Floor_LowerToLowest(0)
310 = 0, Floor_RaiseToNearest(0)
311 = 0, Floor_LowerToNearest(0)
312 = 0, Floor_RaiseToLowestCeiling(0)
313 = 0, Floor_LowerToLowestCeiling(0)
314 = 0, Floor_RaiseToCeiling(0)
315 = 0, Floor_RaiseByTexture(0)
316 = 0, Floor_LowerByTexture(0)
317 = 0, Floor_RaiseByValue(0)
318 = 0, Floor_LowerByValue(0)
319 = 0, Floor_MoveToValue(0)
320 = 0, Floor_RaiseInstant(0)
321 = 0, Floor_LowerInstant(0)
322 = 0, Floor_ToCeilingInstant(0)
323 = 0, Ceiling_RaiseToHighest(0)
324 = 0, Ceiling_ToHighestInstant(0)
325 = 0, Ceiling_RaiseToNearest(0)
326 = 0, Ceiling_LowerToNearest(0)
327 = 0, Ceiling_RaiseToLowest(0)
328 = 0, Ceiling_LowerToLowest(0)
329 = 0, Ceiling_RaiseToHighestFloor(0)
330 = 0, Ceiling_LowerToHighestFloor(0)
331 = 0, Ceiling_ToFloorInstant(0)
332 = 0, Ceiling_LowerToFloor(0)
333 = 0, Ceiling_RaiseByTexture(0)
334 = 0, Ceiling_LowerByTexture(0)
335 = 0, Ceiling_RaiseByValue(0)
336 = 0, Ceiling_LowerByValue(0)
337 = 0, Ceiling_MoveToValue(0)
338 = 0, Ceiling_RaiseInstant(0)
339 = 0, Ceiling_LowerInstant(0)
340 = 0, Stairs_BuildUpDoom(0)
341 = 0, Stairs_BuildDownDoom(0)
342 = 0, Stairs_BuildUpDoomSync(0)
343 = 0, Stairs_BuildDownDoomSync(0)

// 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 = 0, Polyobj_StartLine(0)
349 = 0, Polyobj_ExplicitLine(0)
350 = 0, Polyobj_DoorSlide(0)
351 = 0, Polyobj_DoorSwing(0)
352 = 0, Polyobj_Move(0)
353 = 0, Polyobj_OR_Move(0)
354 = 0, Polyobj_RotateRight(0)
355 = 0, Polyobj_OR_RotateRight(0)
356 = 0, Polyobj_RotateLeft(0)
357 = 0, Polyobj_OR_RotateLeft(0)

// Eternity's linked portals, vertical link version (floor-to-ceiling)
358 = 0,	Sector_SetPortal(tag, 6, 1, 1, 0) // "Portal_AnchoredCeiling"
359 = 0,	Sector_SetPortal(tag, 6, 0, 1, 0) // "Portal_AnchoredFloor"
360 = 0,	Sector_SetPortal(tag, 6, 1, 0, 0) // "Portal_AnchorLine"
361 = 0,	Sector_SetPortal(tag, 6, 0, 0, 0) // "Portal_AnchorLineFloor"

// Even more parameterized linedefs
362 = 0, Pillar_Build(0)
363 = 0, Pillar_BuildAndCrush(0)
364 = 0, Pillar_Open(0)
365 = 0, ACS_Execute(0)
366 = 0, ACS_Suspend(0)
367 = 0, ACS_Terminate(0)
368 = 0, Light_RaiseByValue(0)
369 = 0, Light_LowerByValue(0)
370 = 0, Light_ChangeToValue(0)
371 = 0, Light_Fade(0)
372 = 0, Light_Glow(0)
373 = 0, Light_Flicker(0)
374 = 0, Light_Strobe(0)
375 = 0, Radius_Quake(0)

// Eternity's linked portals, horizontal link version (wall-to-wall)
376 = 0,	Line_SetPortal(0, tag, 4) // "Portal_LinkedLineToLine"
377 = 0,	Line_SetPortal(1, tag, 4) // "Portal_LinkedLineToLineAnchor"

// The famous Hexen linedef
378 = 0, Line_SetIdentification(0)

// 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, 3, 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 = 0, Floor_Waggle(0) 
398 = 0, Thing_Spawn(0) 
399 = 0, Thing_SpawnNoFog(0) 
400 = 0, Teleport_EndGame(0) 

401 = 0, Static_Init(tag, Init_EDSector)

402 = 0, Thing_Projectile(0)
403 = 0, Thing_ProjectileGravity(0)
404 = 0, Thing_Activate(0)
405 = 0, Thing_Deactivate(0)
410 = 0, Plat_PerpetualRaise(0)
411 = 0, Plat_Stop(0)
412 = 0, Plat_DownWaitUpStay(0)
413 = 0, Plat_DownByValue(0)
414 = 0, Plat_UpWaitDownStay(0)
415 = 0, Plat_UpByValue(0)
416 = 0, Floor_LowerToHighest(0)
420 = 0, ACS_ExecuteWithResult(0)
421 = 0, Thing_ChangeTID(0) 
422 = 0, Thing_Raise(0)
423 = 0, Thing_Stop(0)
424 = 0, ThrustThing(0)
425 = 0, ThrustThingZ(0)
426 = 0, DamageThing(0)
427 = 0, Thing_Damage(0)
428 = 0, Thing_Destroy(0)
429 = 0, Door_LockedRaise(0)
430 = 0, ACS_LockedExecute(0)
