Difference between revisions of "Map translator"

From ECWolf Wiki
m (New include feature.)
m
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
The map translator specifies how the engine should handle translating binary format maps into internal structures (which map closely to [[UWMF]]). A map translator is sometimes referred to as '''xlat''', but besides being a similar concept has nothing to do with the map translators in ZDoom. There is no particular lump name that the translator must conform to, but it must be referenced in [[MAPINFO]].
 
The map translator specifies how the engine should handle translating binary format maps into internal structures (which map closely to [[UWMF]]). A map translator is sometimes referred to as '''xlat''', but besides being a similar concept has nothing to do with the map translators in ZDoom. There is no particular lump name that the translator must conform to, but it must be referenced in [[MAPINFO]].
  
A translator contains 3 sections which correspond to the three plans in a binary map: ''tiles'', ''things'', and ''flats''.  Each section or block is enclosed in braces and the specific contents varies. Each plane consists of series of 2-byte values for each "tile," so when an ''oldnum'' is asked for it should be assumed to be some value 0-65535 (although using 0 should probably be avoided in most cases).
+
A translator contains 3 sections which correspond to the three planes in a binary map: <tt>'''tiles'''</tt>, <tt>'''things'''</tt>, and <tt>'''flats'''</tt>.  Each section is similar to a [[UWMF]] block in that it is enclosed in braces. Each plane consists of series of 2-byte values for each "tile," so when an ''oldnum'' is asked for it should be assumed to be some value 0-65535 (although using 0 should probably be avoided in most cases).
  
Other translation files can be included using '''include''' ''lumpname'' {{Hg|a7ba693|1.2}}. If the lumpname is ''"$base"'' then the default translator will be loaded.
+
==Including other translators==
 +
Other translation files can be included:
 +
* <tt>'''include ''"lumpname"'''''</tt>
 +
:If the <tt>lumpname</tt> is <tt>"$base"</tt> then the default translator for the game will be loaded.
 +
:<tt>include</tt> statements can appear anywhere in the global scope (i.e. outside of the <tt>tiles</tt>, <tt>things</tt>, and <tt>flats</tt> blocks).
 +
:<tt>include</tt> statements are the equivalent of copying in the contents of the referenced file.
 +
 
 +
== Feature flags ==
 +
Special meaning to some tiles can be enabled through feature flags.  The following is to be placed outside of any block.
 +
* <tt>'''enable globalmeta;'''</tt> {{New}}
 +
:Enables ''Blake Stone'' meta data tiles. Currently incomplete and subject to change.
 +
* <tt>'''enable lightlevels;'''</tt>
 +
:Enables ''Rise of the Triad'' global light level. In the first map plane (2,0) can be set to a value 0xD8 through 0xDF (dark to light) and (3,0) can be set to values 0xFC through 0x10B (low visibility to high visibility). These translate to the following values in Doom lighting terms. (For reference a visibility of 8.0 is the default in ZDoom.)
 +
{{Note|These numbers were derived by eye-balling the output from Rise of the Triad. They may be subject to change in the future should more accurate numbers be provided. Visibilities above 0x104 are accepted per released map specs, but they appear to allow the player nearly see clearly across the entire map and thus map to the same value.}}
 +
:{| class="wikitable"
 +
|-
 +
! Value
 +
! Light
 +
! Visibility
 +
|-
 +
! 0
 +
| 130
 +
| 0.53
 +
|-
 +
! 1
 +
| 138
 +
| 0.86
 +
|-
 +
! 2
 +
| 146
 +
| 2.0
 +
|-
 +
! 3
 +
| 154
 +
| 8.0
 +
|-
 +
! 4
 +
| 162
 +
| 15.0
 +
|-
 +
! 5
 +
| 170
 +
| 29.0
 +
|-
 +
! 6
 +
| 178
 +
| 56.0
 +
|-
 +
! 7
 +
| 186
 +
| 108.0
 +
|-
 +
! 8-15
 +
| N/A
 +
| 200.0
 +
|}
 +
* <tt>'''enable planedepth;'''</tt> {{New}}
 +
:Enables the level height feature of ''Rise of the Triad''. The value of the thing plane at (0,0) will be used to determine the height of the level in 64 unit tiles. Values between 0x5A (90) and 0x61 (97) will translate to 1-8 tiles in height, values between 0x1C2 (450) and 0x1C9 (457) are use for 9-16 tiles in height. Any other value is undefined.
 +
* <tt>'''enable zheights;'''</tt> {{New}}
 +
:Things will have their Z height set according to the value in the info plane. To set a Z height set the high byte to 0xB0 and the low byte will indicate the signed height of the thing relative to the floor in increments of 4 units (1/16th of a tile).
 +
=== Music ===
 +
* <tt>'''music { tracks, ... }'''</tt> {{New}}
 +
: Enables selection of a music track by placing a tile somewhere in the top row of the info plane (upper leftmost corner preferred). High byte must be 0xBA and low byte selects the index in the provided table. Invalid values are ignored.
  
 
== Tiles ==
 
== Tiles ==
* '''modzone''' ''oldnum'' [fillzone] ambush;
+
* <tt>'''modzone ''oldnum'' [fillzone] ambush;'''</tt>
:Checks for a thing in the tile. If one exists then the thing has the AMBUSH flag set. If the fillzone keyword is used, one adjacent zone code is then filled into the spot.
+
:Checks for a thing in the tile. If one exists, the thing has the [[UWMF#Things|<tt>ambush</tt>]] flag set.  
* '''modzone''' ''oldnum'' [fillzone] changetrigger ''action'' { ''properties'' }
+
:If the optional <tt>fillzone</tt> keyword is specified, the tile's sound zone is taken from an adjacent tile.
:Searches all adjacent tiles for triggers with the specified ''action''. For each one found the trigger is disabled on the side facing the modzone and a new trigger for that side is added based on the properties specified.
+
* <tt>'''modzone ''oldnum'' [fillzone] changetrigger ''action'' { ''properties'' }'''</tt>
* '''tile''' ''oldnum'' { ''properties'' }
+
:Searches all adjacent tiles for triggers with the specified [[Action specials|<tt>''action''</tt>]]. For each one found, the trigger is disabled on the side facing the <tt>modzone</tt> and a new trigger for that side is added based on the properties specified.
:Assigns a wall [[UWMF#Tiles|tile]] to the ''oldnum''.
+
:All properties from a UWMF trigger definition (other than <tt>x</tt>, <tt>y</tt>, and <tt>z</tt>) are valid.
* '''trigger''' ''oldnum'' { ''properties'' }
+
:If the optional <tt>fillzone</tt> keyword is specified, the tile's sound zone will be set to the first valid zone found in the tiles adjacent on the east, north, west, and south sides (in that order).
:Assigns a [[UWMF#Triggers|trigger]] to the tile.
+
* <tt>'''tile ''oldnum'' { ''properties'' }'''</tt>
* '''zone''' ''oldnum'' {}
+
:Assigns a wall [[UWMF#Tiles|tile]] to the <tt>''oldnum''</tt>.
:Assigns a sound [[UWMF#Zones|zone]] to the ''oldnum''.
+
:All properties from a UWMF tile definition are valid.
 +
* <tt>'''trigger ''oldnum'' { ''properties'' }'''</tt>
 +
:Assigns a [[UWMF#Triggers|trigger]] to the tile
 +
:All properties from a UWMF trigger definition (other than <tt>x</tt>, <tt>y</tt>, and <tt>z</tt>) are valid.
 +
* <tt>'''zone ''oldnum'' {}'''</tt>
 +
:Assigns a sound [[UWMF#Zones|zone]] to the <tt>''oldnum''</tt>.
  
Note that there are no limits to how you allocate your 65536 oldnums. Doors are simply the combination of a tile and trigger with the same number.
+
'''Note:''' There are no limits to how you allocate your 65536 <tt>oldnum</tt>s. Doors are simply the combination of a tile and trigger with the same number.
  
 
== Things ==
 
== Things ==
* '''trigger''' ''oldnum'' { ''properties'' }
+
* <tt>'''elevator ''oldnum'';'''</tt>
:Assign a trigger to the tile it is contained in. This will be in addition to any triggers already on the tile. Typically a pushwall would use this.
+
:Creates a Rise of the Triad compatible elevator destination point. Place these between a door and switch (the door and switch must be in line with each other) and the elevator will round robin between the destination points. The elevator starts in the uppermost spot (or leftmost if in same y position).
* { ''oldnum'', ''ednum'', ''angles'', ''flags'', ''minskill'' }
+
* <tt>'''trigger ''oldnum'' { ''properties'' }'''</tt>
:Maps the ''oldnum'' to the ''ednum'' that is assigned in [[DECORATE]]. The ''angles'' parameter indicates how many sequential indexes should be assigned to rotations.  For example if angles is 4 and oldnum is 100 then 100-103 would be assigned to this mapping with each being at 90 degrees. ''Minskill'' indicates the minimum skill level required for this thing to spawn (starting at 0). ''Flags'' are:
+
:Assign a [[UWMF#Triggers|trigger]] to the tile it is contained in. This will be in addition to any triggers already on the tile. Typically a pushwall would use this.
:* '''HOLOWALL''' - When placed into a wall, this thing will make the wall non-solid. When combined with the PATHING flag then the wall immediate in front will be non-solid as well.
+
:All properties from a UWMF trigger definition (other than <tt>x</tt>, <tt>y</tt>, and <tt>z</tt>) are valid.
:* '''PATHING''' - This monster follows a patrol route instead of sitting in the Spawn state.
+
* <tt>'''{ ''oldnum'', ''actor'', ''angles'', ''flags'', ''minskill'' }'''</tt>
 +
:Maps the <tt>''oldnum''</tt> to the <tt>''actor''</tt> name that is assigned in [[DECORATE]].  
 +
:The <tt>''angles''</tt> parameter indicates how many sequential indexes should be assigned to rotations.  For example, if <tt>angles</tt> is 4 and <tt>oldnum</tt> is 100, then 100-103 would be assigned to this mapping with each being at 90 degrees.  
 +
:<tt>''minskill''</tt> indicates the minimum skill level required for this thing to spawn (starting at 0).  
 +
:<tt>''flags''</tt> are:
 +
:* <tt>'''HOLOWALL'''</tt> - When placed into a wall, this thing will make the wall non-solid. When combined with the <tt>PATHING</tt> flag then the wall immediate in front will be non-solid as well. Combine the flags using a pipe: <tt>PATHING|HOLOWALL</tt>
 +
:* <tt>'''PATHING'''</tt> - This monster follows a patrol route instead of sitting in the Spawn state.
 +
:* <tt>'''AMBUSH'''</tt> - This monster is deaf to sound.
  
 
== Flats ==
 
== Flats ==
* '''ceiling''' { ''flats'', ... }
+
* <tt>'''ceiling { ''flats'', ... }'''</tt>
* '''floor''' { ''flats'', ... }
+
* <tt>'''floor { ''flats'', ... }'''</tt>
 
:Assigns floor/ceiling textures to sequential codes starting with 0. Up to 256 textures can be defined in each.
 
:Assigns floor/ceiling textures to sequential codes starting with 0. Up to 256 textures can be defined in each.
 +
 +
== Info ==
 +
Currently the fourth map plane does not have any translator options.  It is enabled for all maps which contain a fourth plane and maps to the Rise of the Triad info plane.
 +
 +
This plane is used to assign functions to switches and touch plates (a touch plate is a tile which activates something when walked over). To use, simply create a trigger using any of the method above.  It doesn't matter what activation method is used in the trigger as it will be adjusted automatically based on if the activating tile is a wall or not.  On the tile where a trigger was placed, put 0xXXYY (coordinates in hexadecimal) as the fourth plane.  A tag will be created and assigned to the arg0 parameter and then all triggers will be moved to the given coordinates.

Latest revision as of 03:54, 21 January 2023

The map translator specifies how the engine should handle translating binary format maps into internal structures (which map closely to UWMF). A map translator is sometimes referred to as xlat, but besides being a similar concept has nothing to do with the map translators in ZDoom. There is no particular lump name that the translator must conform to, but it must be referenced in MAPINFO.

A translator contains 3 sections which correspond to the three planes in a binary map: tiles, things, and flats. Each section is similar to a UWMF block in that it is enclosed in braces. Each plane consists of series of 2-byte values for each "tile," so when an oldnum is asked for it should be assumed to be some value 0-65535 (although using 0 should probably be avoided in most cases).

Including other translators

Other translation files can be included:

  • include "lumpname"
If the lumpname is "$base" then the default translator for the game will be loaded.
include statements can appear anywhere in the global scope (i.e. outside of the tiles, things, and flats blocks).
include statements are the equivalent of copying in the contents of the referenced file.

Feature flags

Special meaning to some tiles can be enabled through feature flags. The following is to be placed outside of any block.

  • enable globalmeta; (New from 1.4)
Enables Blake Stone meta data tiles. Currently incomplete and subject to change.
  • enable lightlevels;
Enables Rise of the Triad global light level. In the first map plane (2,0) can be set to a value 0xD8 through 0xDF (dark to light) and (3,0) can be set to values 0xFC through 0x10B (low visibility to high visibility). These translate to the following values in Doom lighting terms. (For reference a visibility of 8.0 is the default in ZDoom.)
Note: These numbers were derived by eye-balling the output from Rise of the Triad. They may be subject to change in the future should more accurate numbers be provided. Visibilities above 0x104 are accepted per released map specs, but they appear to allow the player nearly see clearly across the entire map and thus map to the same value.
Value Light Visibility
0 130 0.53
1 138 0.86
2 146 2.0
3 154 8.0
4 162 15.0
5 170 29.0
6 178 56.0
7 186 108.0
8-15 N/A 200.0
  • enable planedepth; (New from 1.4)
Enables the level height feature of Rise of the Triad. The value of the thing plane at (0,0) will be used to determine the height of the level in 64 unit tiles. Values between 0x5A (90) and 0x61 (97) will translate to 1-8 tiles in height, values between 0x1C2 (450) and 0x1C9 (457) are use for 9-16 tiles in height. Any other value is undefined.
  • enable zheights; (New from 1.4)
Things will have their Z height set according to the value in the info plane. To set a Z height set the high byte to 0xB0 and the low byte will indicate the signed height of the thing relative to the floor in increments of 4 units (1/16th of a tile).

Music

  • music { tracks, ... } (New from 1.4)
Enables selection of a music track by placing a tile somewhere in the top row of the info plane (upper leftmost corner preferred). High byte must be 0xBA and low byte selects the index in the provided table. Invalid values are ignored.

Tiles

  • modzone oldnum [fillzone] ambush;
Checks for a thing in the tile. If one exists, the thing has the ambush flag set.
If the optional fillzone keyword is specified, the tile's sound zone is taken from an adjacent tile.
  • modzone oldnum [fillzone] changetrigger action { properties }
Searches all adjacent tiles for triggers with the specified action. For each one found, the trigger is disabled on the side facing the modzone and a new trigger for that side is added based on the properties specified.
All properties from a UWMF trigger definition (other than x, y, and z) are valid.
If the optional fillzone keyword is specified, the tile's sound zone will be set to the first valid zone found in the tiles adjacent on the east, north, west, and south sides (in that order).
  • tile oldnum { properties }
Assigns a wall tile to the oldnum.
All properties from a UWMF tile definition are valid.
  • trigger oldnum { properties }
Assigns a trigger to the tile.
All properties from a UWMF trigger definition (other than x, y, and z) are valid.
  • zone oldnum {}
Assigns a sound zone to the oldnum.

Note: There are no limits to how you allocate your 65536 oldnums. Doors are simply the combination of a tile and trigger with the same number.

Things

  • elevator oldnum;
Creates a Rise of the Triad compatible elevator destination point. Place these between a door and switch (the door and switch must be in line with each other) and the elevator will round robin between the destination points. The elevator starts in the uppermost spot (or leftmost if in same y position).
  • trigger oldnum { properties }
Assign a trigger to the tile it is contained in. This will be in addition to any triggers already on the tile. Typically a pushwall would use this.
All properties from a UWMF trigger definition (other than x, y, and z) are valid.
  • { oldnum, actor, angles, flags, minskill }
Maps the oldnum to the actor name that is assigned in DECORATE.
The angles parameter indicates how many sequential indexes should be assigned to rotations. For example, if angles is 4 and oldnum is 100, then 100-103 would be assigned to this mapping with each being at 90 degrees.
minskill indicates the minimum skill level required for this thing to spawn (starting at 0).
flags are:
  • HOLOWALL - When placed into a wall, this thing will make the wall non-solid. When combined with the PATHING flag then the wall immediate in front will be non-solid as well. Combine the flags using a pipe: PATHING|HOLOWALL
  • PATHING - This monster follows a patrol route instead of sitting in the Spawn state.
  • AMBUSH - This monster is deaf to sound.

Flats

  • ceiling { flats, ... }
  • floor { flats, ... }
Assigns floor/ceiling textures to sequential codes starting with 0. Up to 256 textures can be defined in each.

Info

Currently the fourth map plane does not have any translator options. It is enabled for all maps which contain a fourth plane and maps to the Rise of the Triad info plane.

This plane is used to assign functions to switches and touch plates (a touch plate is a tile which activates something when walked over). To use, simply create a trigger using any of the method above. It doesn't matter what activation method is used in the trigger as it will be adjusted automatically based on if the activating tile is a wall or not. On the tile where a trigger was placed, put 0xXXYY (coordinates in hexadecimal) as the fourth plane. A tag will be created and assigned to the arg0 parameter and then all triggers will be moved to the given coordinates.