Maphack Language
Maphacks are used to edit the positioning of objects and other parts of a level in cases where the maps cannot be redistributed. This only affects the visual representation through the renderer and does not change the actual gameplay. Additional information may be found in MapHacks.txt.
sprite
sprite spriteid <token> [value]
angoff
sprite spriteid angoff value
sprite spriteid angleoff value
Rotates the model (md3 or kvx) away from the starting angle of the sprite. A value of 2048 represents a full turn of 360 degrees. Practical values should be chosen between -1023 and 1024 (+- 180 degrees).
notmd
sprite spriteid notmd
sprite spriteid notmd2
sprite spriteid notmd3
Renders a tile as a texture (original ART tile or highres image if available) instead of a model (md3 or kvx). This is achieved by altering the value of mdflags.
It is mostly used to "flatten" wall aligned or floor aligned decorative objects.
There is no actual implementation for notmd2 and notmd3. They are mapped to notmd.
nomdanim
sprite spriteid nomdanim
sprite spriteid nomd2anim
sprite spriteid nomd3anim
Freezes any model animation in place. This is achieved by altering the value of mdflags.
There is no actual implementation for nomd2anim and nomd3anim. They are mapped to nomdanim.
away1
sprite spriteid away1
Moves the sprite forwards by a small amount. This is achieved by altering the value of mdflags.
It is mostly used to resolve flickering ("z-fighting") of overlapping wall aligned sprites, which is especially prevalent when using the Polymer renderer.
away2
sprite spriteid away2
Moves the sprite backwards by a small amount. This is achieved by altering the value of mdflags.
It is mostly used to resolve flickering ("z-fighting") of overlapping wall aligned sprites, which is especially prevalent when using the Polymer renderer.
pitch
sprite spriteid pitch value
Adjusts the model's pitch, i.e. bowing or falling backwards. Does not work in conjunction with notmd. Not yet implemented for kvx models.
A hackish method can be used to move the model forwards/backwards from clipping into a wall, by setting the sprite's mdzoff to a grossly high (or low negative) number (try 100000 for starters), and setting a pitch of 1.
roll
sprite spriteid roll value
Adjusts the model's roll, i.e. tilting to the side. Does not work in conjunction with notmd. Not yet implemented for kvx models.
mdxoff
sprite spriteid mdxoff value
Offsets the x coordinate of the model's centerpoint,(upwards/downwards in 3D view) to be used in conjunction with pitch.
mdyoff
sprite spriteid mdyoff value
Offsets the y coordinate of the model's centerpoint (upwards/downwards in 3D view), to be used in conjunction with roll.
mdzoff
sprite spriteid mdzoff value
Offsets the z coordinate of the model's centerpoint, to be used in conjunction with pitch (forwards/backwards) and/or roll (right/left).
The pitch and roll value can be used as scaling factors. With pitch 1 and roll -2, for example, the model is moved twice as far to the left as it gets moved forwards. Depending on the object's size, pitch/roll values above 4-8 may result in undesired visible rotation.
Be aware that the same value will result in 1/16 the translation for mdzoff compared to mdxoff and mdyoff.
mdposxoff
sprite spriteid mdposxoff value
Ported from NBlood. In Mapster32's 2D view the x coordinate of the model's centerpoint is moved to the right/eastwards/angle 0. (The default placement lets sprites face northwards/angle 1536.)
This is quite different from the way (pitch/roll + md[x|y|z]off) works. Do not confuse.
mdposyoff
sprite spriteid mdposyoff value
Ported from NBlood. In Mapster32's 2D view the y coordinate of the model's centerpoint is moved to down/southwards/angle 512. (The default placement lets sprites face northwards/angle 1536.)
This is quite different from the way (pitch/roll + md[x|y|z]off) works. Do not confuse.
mdposzoff
sprite spriteid mdposzoff value
Ported from NBlood. In Mapster32's 2D view the z coordinate of the model's centerpoint is moved forwards to the viewer (upwards in 3D view).
This is roughly equivalent to the way (pitch + mdxoff) or (roll + mdyoff) work, respectively.
mhkreset
sprite spriteid mhkreset
This development helper resets all previous maphacks for a sprite.
light
light sector x y z range r g b radius faderadius angle horiz minshade maxshade priority tilenum
Displays a spotlight using the Polymer renderer.
Examples
This is a definition file (*.def) to declare available maphack (*.mhk) files:
// This is a comment line. mapinfo { maptitle "Hollywood Holocaust" //author "Allen H. Blum III" mapfile "E1L1.map" mapmd4 a1ce0037911b2625781a2623588c8b90 // 1996-12-11 (Atomic GRP) mhkfile "maphacks/3drealms/E1L1.mhk" } /* This is a multi-line comment. */
There is no author token yet, and no actual implementation of maptitle.
This is an example maphack file (*.mhk): header and a couple of actual maphack lines:
// Maphacks for the Duke Nukem 3D High Resolution Pack (HRP) // Title : Hollywood Holocaust // Author : Allen H. Blum III // Filename : E1L1.MAP // mapmd4 : a1ce0037911b2625781a2623588c8b90 // 1996-12-11 (Atomic GRP) // Curr. HRP: r5.4.726 sprite 79 angoff 1024 // tile0026 heavyhbomb (multiplayer)
Conventions
Over the years of maphacking a couple of conventions have been established which you should follow.
Order of tokens, if (as far as applicable) combined:
sprite 1 notmd sprite 1 away1 sprite 1 away2 sprite 1 nomdanim sprite 1 angoff 512 // rotate right //sprite 0 pitch -512 // tilt backwards //sprite 0 roll 512 // tilt right sprite 1 pitch -1 // small value when only moving (backwards) sprite 1 roll 2 // factor 2 for mdyoff (up), mdzoff (right) sprite 1 mdxoff -30000 // moves up, actually (pitch -1) sprite 1 mdyoff 30000 sprite 1 mdzoff 480000 // Do NOT mix (pitch,roll,md<x|y|z>off) with mdpos<x|y|z>off ! sprite 16383 mdposxoff 1024 // 32.0 // eastwards in 2D view sprite 16383 mdposyoff 1024 // 32.0 // southwards in 2D view sprite 16383 mdposzoff -16384 // 32.0 // downwards in 3D
More on this to come soon...