DEF Language

From EDukeWiki
Jump to navigation Jump to search

New to JFDuke3D\EDuke32 are DEF files. These parsed scripts allow redefinition of flat, Hightile textures, 3D models, miscellaneous settings, and, possibly, in the future, higher-quality sounds and music, and enhanced cutscenes.

Comments can be used by prefixing the text with a double forward-slash (C++ style), //, or surrounding the text with /* (comment here) */ (C style).

Definitions

texture

texture <tilenum> { ... }

Defines a Hightile texture to replace an ART-file tile. <tilenum> may be a number, or a defined label.

The brace-enclosed block may contain these instructions:

pal

pal <palnum> { ... }

Replaces the palette <palnum>. If a palette has no pal definition palette 0 definition will be used. Tint will not be used on palettes defined with this instruction.

The brace-enclosed block may contain these instructions:

file

file <filename>
name <filename>

Defines which texture file to use. File may be any PNG, JPG, TGA, BMP, GIF or PCX file. This instruction must be supplied.

alphacut

alphacut <cutoff-value>

Sets the level of transparency at which a pixel in the texture is considered opaque. Pixels with more transparency than the cut-off are not drawn to the screen when rendered. The default setting is 0.32, which is just below the 33% transparency level of Build. If your texture has areas that are more transparent than the default, you can lower the cut-off level to preserve that detail.

nocompress

nocompress

Prevents the texture from being compressed using S3TC if texture compression is enabled.

nodownsize

nodownsize

Prevents the texture from being downsized.

scale

xscale <value>
yscale <value>

Sets the scale of the hightile texture in relation to the original texture. A <value> of 1.0 makes it the same size, higher makes it cover more then the original tile and smaller makes it cover a smaller area. xscale(aka scale, detailscale, intensity) sets the horizontal scale and yscale sets the vertical scale.

detail

detail { ... }

Defines a detail texture for the texture. The brace-enclosed block may contain these instructions:

file

file <filename>

Specifies which detail texture file to use. File may be any PNG, JPG, TGA, BMP, GIF or PCX file. This instruction must be supplied.

scale

scale <value>

<value> is a positive floating-point value that'll determine how much your detail map should repeat on your diffuse map (if you want your detail map to repeat five times, use a 1/5 scale : 0.2).

glow

glow { ... }

Defines a glow map for the texture. The brace-enclosed block may contain these instructions:

file

file <filename>

Specifies which glow map file to use. This instruction must be supplied.

tint

tint { ... }

Defines a Hightile texture tint to simulate palette effects normally used on ART-file tiles. The brace-enclosed block may contain these instructions:

pal

pal <palnum>

The palette number the tint applies to.

color

red <value>
green <value>
blue <value>
r <value>
g <value>
b <value>

Specifies a color component value, in the range of 0 to 255. Unspecified components are assumed to be 255 and any out of range values are clamped to the maximum or minimum as appropriate.

flags

flags <flags>

Specifies any special processing effects to use for the tint. The value of flags may be the sum of any of these values:

  • 0 = no effects
  • 1 = convert to greyscale
  • 2 = invert colors

skybox

skybox { ... }

Defines a skybox that overrides a parallaxing floor or ceiling in OpenGL Polymost rendering mode. The brace-enclosed block may contain these instructions:

tile

tile <tilenum>

Specifies the ART file tile to override.

pal

pal <palnum>

Specifies the palette number the skybox should happen for.

facename

facename <filename>

Defines a single face of the skybox where facename may be any of these keywords appropriate for the face in question:

Front	Right 	Back	Left 	Top	Bottom
ft	rt	bk	lf	up	dn
front	right	back	left	top 	bottom
forward			lt	ceiling floor
				ceil	down

NOTE: All six faces are required to be specified.

model

model <filename> { ... }

Defines a model to replace certain sprites in the game when running in OpenGL Polymost mode. <filename> is the model file in md2 or md3 format.

Note: md2 is considered deprecated.

The brace-enclosed block may contain these instructions:

scale

scale <value>

<value> is a (possibly fractional) value specifying a scaling factor for the model when it is rendered, eg. 1.5 for one-and-a-half times as big.

shade

shade <shade-offset>

<shade-offset> is an integer value specifying how much to bias the sprite's shade value by. A negative value for this makes the model brighter. Conversely, a positive value makes it darker.

zadd

zadd <offset>

<offset> is a (possibly fractional) value specifying a height offset for the model. Quake models are aligned in the center while Build models are aligned at the floor. Using this command will allow Build to use Quake models without modification to the MD2/3 file itself.


flags

flags <flags>

Specifies any special properties the model should have, the values of which should be added together to combine multiple options.

  • 0: default value
  • 1: Prevents the the model from being affected by the tints.

skin

skin { ... } Defines a skin to be used on the model for all frames declared after this command. The brace-enclosed block may contain these instructions:

pal

pal <palnum>

Specifies which palette this skin maps to.

surface

surface <surfnum>

Specifies which MD3 surface this skin should be applied to. This has no significance for MD2 models.

file

file <filename>

Specifies the texture file to use for the skin. File may be any PNG, JPG, TGA, BMP, GIF or PCX file

IMPORTANT: If your model exists in a subdirectory (ie. the model filename includes a path to the .md2/3) you will need to give the same path to filename if the skin is in the same directory.

anim

anim { ... }

Defines an animation from a group of frames in the model. The brace-enclosed block may contain these instructions:

frame

frame0 <framename>
frame1 <framename>

Specifies the names of the start (frame0) and end (frame1) frames of the animation.

fps

fps <fps>

Specifies the frame rate at which the animation should play. This value may be fractional.

flags

flags <flags>

Specifies any special properties the animation should have, the values of which should be added together to combine multiple options.

Valid options are:

  • 0 = none (looping animation)
  • 1 = one-shot (plays beginning to end once and stops on the last frame).

frame

frame { ... }

Defines a range of ART-file tiles to correspond with the given frame/animation of the model. The brace-enclosed block may contain these instructions:

name

name <framename>
frame <framename>

If <framename> is identical to the starting frame of an animation, the engine will play that animation, otherwise the replacement will be static. You can choose to use the frame or name versions of this instruction as both are identical.

tile

tile <tilenum>
tile0 <tilenum>
tile1 <tilenum>

Use the tile instruction to specify an ART-file tile which this model should replace. Use the tile0 and tile1 instructions together to specify a range of ART-file tiles. If you use tile0, you must also have a tile1. You may not use the same instruction twice to specify multiple ranges.

smoothduration

smoothduration <value>

If smoothduration is non-zero switching from another animation to the one defined by that frame block will trigger an intermediary animation smoothing state of duration <value> seconds.

pal

pal <value>

Makes the model definition exclusive for the this pal. This allow to assign different models for different pal.

hud

hud { ... }

Defines a range of ART-file tiles to use with a heads-up-display. The brace-enclosed block may contain these instructions:

tile

tile <tilenum>
tile0 <tilenum>
tile1 <tilenum>

tile0 and tile1 together specify a range of ART-file tiles which this model frame should replace when rendered as part of the HUD. You can specify individual tiles using a single tile command.

offset

xadd <offset>
yadd <offset>
zadd <offset>
angadd <offset>

Use these offsets to fine-tune the location of the model placement. xadd, yadd, and zadd are position offsets relative to the viewer's orienation. You can use floating point values with them. angadd is a Build angle offset. (512 = 90 degrees, 1024 = 180 degrees, etc...).

hide

hide

Some weapons use multiple ART tiles for constructing the gun or animation. Use this option to hide parts that you don't need in your replacement.

nobob

nobob

By default, the HUD model offset is affected by the player bobbing offset when the player is walking. Use this option to disable that.

flipped

flipped

Use this option to apply the settings inside the hud block only if the object is normally rendered x-flipped (mirror image). Some weapons, such as the devastator, are rendered in 2 pieces, the left devastator is actually a mirror image of the right.

nodepth

nodepth

Use this to render a HUD model without the use of the depth buffer. Normally, you should avoid this. The one exception where this is useful is for the spinning nuke menu pointer because it should always be in front - and it just happens to be convex ... which is the one case that is safe with the depth buffer disabled … a rather fortunate coincidence.


detail

detail { ... }

Defines a detail texture for the model. The brace-enclosed block may contain these instructions:

file

file <filename>

Specifies which detail texture file to use. File may be any PNG, JPG, TGA, BMP, GIF or PCX file. This instruction must be supplied.

scale

scale <value>

<value> is a positive floating-point value that'll determine how much your detail map should repeat on your diffuse map (if you want your detail map to repeat five times, use a 1/5 scale : 0.2).

surface

surface <surfnum>

Specifies which MD3 surface this detail texture should be applied to. This has no significance for MD2 models.

glow

glow { ... }

Defines a glow map for the model. The brace-enclosed block may contain these instructions:

file

file <filename>

Specifies which glow map file to use. This instruction must be supplied.

surface

surface <surfnum>

Specifies which MD3 surface this glow map should be applied to. This has no significance for MD2 models.

voxel

voxel <filename> { ... }

Defines a voxel to replace sprites. filename is the name of the .KVX file containing the voxel. The brace-enclosed block may contain these instructions:

tile

tile <tilenum>
tile0 <tilenum>
tile1 <tilenum>

Use these instructions to map tiles that should be rendered as a voxels. Use tile to map a single tile to be rendered as voxels and tile0, tile1 together define a range of tiles to be rendered as voxels. The tile0 instruction should appear before the tile1 instruction to define a correct range.

scale

scale <value>

<value> is a (possibly fractional) value specifying a scaling factor for the voxelmodel when it is rendered, eg. 1.5 for one-and-a-half times as big.

music

id

id <value>

<value> is "Intro", "Briefing", "Loading" or "ExLy"(where x-episode, y-level).

file

file <filename>

Specifies which music file to use. File may be any MID or OGG(OpenAL is required) file.

sound

id

id <value>

Specifies the ID of sound. The ID can be found in DEFS.CON.

file

file <filename>

Specifies which music file to use. File may be any WAV,VOC,OGG(OpenAL is not required) file.

Un-Definitions

The main use for these is for cases in which the .ART files are somewhat different, and you want to ensure compatibility for the new art without new textures or models. A good example of this is the Duke: Nuclear Winter HRP by Hendricks266. (see undef.def)

undeftexture

undeftexture <tile>

This is for undefining Hightile textures.

undeftexturerange

undeftexturerange <tile0> <tile1>

Same as undeftexture, but with a range of tiles.

undefmodel

undefmodel <tile>

This is for undefining 3D models.

undefmodelrange

undefmodelrange <tile0> <tile1>

Same as undefmodel, but with a range of tiles.

undefmodelof

undefmodelof <tile>

Same as undefmodel, but all the tiles grouped together within the same .DEF code block are un-defined.

Support of undefmodelof seems to be broken at this time. Using it in your .DEF files will result in crashing upon compiling.

Misc

alphahack

alphahack <tilenum> <value>

alphahack is a deprecated command to improve alpha filtering of highres art of <tilenum>. <value> is always -1.

alphahackrange

alphahackrange <tilenum1> <tilenum2> <value>

Same as alphahack, but with a range of tiles.

animtilerange

animtilerange <tilenum1> <tilenum2> <speed value> <animation value>

Animates hightile textures the same way as 8 bit art does. Hightile art needs to be defined first.

dummytile

dummytile <tilenum> <x-dimension> <y-dimension>

Used in DEF files to create a blank tile at location <tilenum> of the dimensions <x-dimension> and <y-dimension>. This allows the creation of placeholder tiles for use with definetexture\texture without having to edit .ART files.

dummytilerange

dummytilerange <tilenum1> <tilenum2> <x-dimension> <y-dimension>

Same as dummytile, but with a range of tiles.

setuptile

setuptile <tilenum> <x-dimension> <y-dimension> <x-offset> <y-offset>

Used in DEF files to setup the properties which are applied to the highres replacement of the tile. This allows the creation of placeholder tiles for use with definetexture\texture without having to edit .ART files. Unlike dummytile this command won't draw black squares and accepts the offsets.

setuptilerange

setuptilerange <tilenum1> <tilenum2> <x-dimension> <y-dimension> <x-offset> <y-offset>

Same as setuptile, but with a range of tiles.

dummytilefrompic

dummytilefrompic <tileID> <file>

tilefromtexture

tilefromtexture { ... }

Used to generate an 8-bit tile from an image file.

file

file <filename>
name <filename>

alphacut

alphacut <value>

xoffset

xoffset <value>
xoff <value>

yoffset

yoffset <value>
yoff <value>

include

include <filename>
#include <filename>

Processes the script commands in <filename> at the point of the include call.

define

define <label> <integer-value>
#define <label> <integer-value>

Declares <label> to represent the numeric value <integer-value>. <integer-value> can be a label, in which case the value of the label given is used.

NOTE: You may find it convenient to include DEFS.CON (for JFDuke3D) or NAMES.H to predefine many of the tile names in the art file.

loadgrp

loadgrp <.GRP\.ZIP file>

The DEF equivalent of the /g command line switch. loadgrp can only be used in the originating .DEF file; it is usually duke3d.def or the .DEF file specified by the /h command line switch.

noautoload

noautoload

Disables the autoload dir feature.

cachesize

cachesize <size>

Specifies the size of the cache in Kb.

fogpal

fogpal <palette number> <red intensity> <green intensity> <blue intensity>

fogpal defines a palette a sector-based fog effect. To use it, change the pal of your sector to the pal defined with fogpal.

Intensities range from 0-63. Palettes 26, 27, 28 and 29 are pre-defined for you as white, red, green and blue respectively. Sector visibility controls fog density.

Mapster32

2dcol

2dcol <colornum> <red> <green> <blue>

2dcol is a definition of a color to be used in the 2D mode of Mapster32, in conjunction with spritecol that works similarly to tint and definetint. <colornum> is a unique identifier, similar to defines and gamevars. <red>, <green>, and <blue> are the RGB color values that are mixed together to get your custom color.

Certain low values are already hard-coded, and redefining them will change colors of the default layout. If you know the correct value, you can replace the default colors used for all the sprites. You truly have the power to customize Mapster32. Lime green 2D mode background, anyone?

spritecol

spritecol <tilenum> <normalcolornum> <blockingcolornum>

spritecol is a definition of the color a sprite will appear in 2D mode, instead of the standard sky blue and hot pink, or another special color (like yellow for hard-coded enemies or white for the special sprites). <normalcolornum> is the <colornum> of the 2dcol definition of your color for the standard sprite color as defined by <tilenum>. The same goes for <blockingcolornum>, except that this value is for when the sprite has the first bit of cstat set (1) ([']+[B] keys in Mapster32), which is the blocking flag.

spritehotkey

spritehotkey <key> <spriteID>

Pressing a key from 1 to 0 on the upper row before pressing S will make the inserted sprite's picnum change according to this definition.

tilegroup

tilegroup <groupname> { ... }

Defines group for tile tile selector(Press T in the tile seletor). Mapster32 loads TILES.CFG on startup.

tile

tile <tilenum>
tilerange <tilenum1> <tilenum2>
tiles { <tile1> <tile2> ... <tileN> }

Adds tiles to the group. Names can be found in DEFS.CON.

hotkey

hotkey <value>

Specifies the hotkey for the group.

colors

colors <value1> <value2>

Colors are the colors for Blocking OFF and Blocking ON.

alphabet

alphabet { ... }

Defines alphabet for the input text feature(Ctrl+T). Mapster32 loads TILES.CFG on startup.

map

map <value> <tile>

mapa

mapa <string> <tile>

maprange

maprange <value1> <value2> <tile>

maprangea

maprangea <char1> <char2> <tile>

offset

offset <value> <offset>

offseta

offseta <string> <offset>

Deprecated Commands

definetexture

definetexture <tile-number> <palette-number> <x-center> <y-center> <x-size> <y-size> <filename>

Defines a Hightile texture to replace an ART-file picture. <tile-number> may be an number, or a defined label. Use a value of 0 for <x-center> and <y-center> and a value of -1 for <x-size> and <y-size> for now until these values are actually used. <filename> may be any PNG, JPG, TGA, BMP, GIF or PCX file.

definetint

definetint <palette-number> <red> <green> <blue> <flags

Defines a Hightile texture tint to simulate palette effects normally used on ART-file tiles. <red>, <green>, and <blue> are numbers in the range 0 to 255 which specify the color the tint should look like. <flags> specifies any processing effects to use. Valid values are:

  • 0 = no effects
  • 1 = convert to greyscale
  • 2 = invert colours

These values can be added together to produce a combination of effects.

defineskybox

defineskybox <tile-number> <palette-number> <reserved> <front-face-filename> <right-face-filename> <back-face-filename> <left-face-filename> <top-face-filename> <bottom-face-filename>

Defines a sky-box composed of six images mapped onto the faces of a cube to be used when <tile-number> is set as parallaxing in GL Polymost mode. <reserved> should be 0 for now until its meaning is fully conceived.

definemodel

definemodel <filename> <scale> <shade-offset>

Defines an MD2/3-format model file to replace certain sprites in the game. See definemodelframe and definemodelanim for details on how to specify the ART-file tiles to replace. <filename> is the name of the MD2/3 model. <scale> is a (possibly fractional) value specifying a scaling factor for the model when it is rendered, eg. 1.5 for one-and-a-half times as big. <shade-offset> is an integer value specifying how much to bias the sprite's shade value by. A negative value for this makes the model brighter. Conversely, a positive value makes it darker.

definemodelskin

definemodelskin <palette-number> <filename>

Defines a skin to be used on the model for all frames declared after this command, when the sprite palette is equal to <palette-number>. (This makes more sense when given a demonstration.) IMPORTANT: If your model exists in a subdirectory (ie. definemodel includes a path to the .md2/3) you will need to give the same path to filename if the skin is in the same directory.

selectmodelskin

selectmodelskin <skin ID>

Selects a model skin.

definemodelanim

definemodelanim <start-frame> <end-frame> <frame-rate> <flags>

Defines an animation from a group of frames in the model given by the last preceding definemodel instruction. <start-frame> and <end-frame> specify the names of the starting and ending frames of the animation. <frame-rate> is the frame rate at which the animation should play. This value can be fractional. <flags> specifies any special properties the animation should have. Valid options are:

  • 0 = none (looping animation)
  • 1 = one-shot (plays beginning to end once and stops on the last frame)

definemodelframe

definemodelframe <frame-name> <first-tile> <last-tile>

Defines a range of ART-file tiles to correspond with the given frame of the model specified in the last preceding definemodel instruction. <frame-name> is the name of the frame, which if identical to the starting frame of a definemodelanim animation will play that animation. If <frame-name> is not corresponding with an animation, the replacement will be static. <first-tile> and <last-tile> specify a range of ART-file tiles which this model frame should replace.

definevoxel

definevoxel <filename>

Defines a voxel to replace sprites in the game. See definevoxeltiles for details on how to specify the ART-file tiles to replace. <filename> is the name of the .KVX file containing the voxel.

definevoxeltiles

definevoxeltiles <first-tile> <last-tile>

Defines the range of ART-file tiles to replace with the voxel given in the last preceding definevoxel instruction.