Difference between revisions of "DEF Language"

From EDukeWiki
Jump to navigation Jump to search
Line 1: Line 1:
== include ==
== Preferred Commands ==
 
=== include ===




Line 8: Line 10:
Processes the script commands in '''''filename''''' at the point of the '''include''' call.
Processes the script commands in '''''filename''''' at the point of the '''include''' call.


== define ==
=== define ===


'''define ''label integer-value'''''
'''define ''label integer-value'''''
Line 18: Line 20:
'''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.
'''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.


== texture ==
=== texture ===


'''texture ''tilenum'' { ... }'''
'''texture ''tilenum'' { ... }'''
Line 26: Line 28:
The brace-enclosed block may contain these instructions:
The brace-enclosed block may contain these instructions:


=== pal ===
==== pal ====


'''pal ''palnum'' { ... }'''
'''pal ''palnum'' { ... }'''
Line 34: Line 36:
The brace-enclosed block may contain these instructions:
The brace-enclosed block may contain these instructions:


==== file ====
===== file =====


'''file ''filename'''''
'''file ''filename'''''
Line 42: Line 44:
Defines which texture file to use. File may be any PNG, JPG, TGA, BMP, GIF or PCX file. This instruction must be supplied.
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 =====


'''alphacut ''cutoff-value'''''
'''alphacut ''cutoff-value'''''
Line 48: Line 50:
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.
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 =====


'''nocompress'''
'''nocompress'''
Line 54: Line 56:
Prevents the texture from being compressed using S3TC if texture compression is enabled.
Prevents the texture from being compressed using S3TC if texture compression is enabled.


== model ==
=== model ===


'''model ''filename'' { ... }'''
'''model ''filename'' { ... }'''
Line 64: Line 66:
The brace-enclosed block may contain these instructions:
The brace-enclosed block may contain these instructions:


=== scale ===
==== scale ====


'''scale ''value'''''
'''scale ''value'''''
Line 70: Line 72:
'''''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.
'''''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 ''shade-offset'''''
'''shade ''shade-offset'''''
Line 76: Line 78:
'''''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.
'''''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 ====


'''zadd ''offset'''''
'''zadd ''offset'''''
Line 82: Line 84:
'''''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.
'''''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.


=== skin ===
==== skin ====


'''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:
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 =====


'''pal ''palnum'''''
'''pal ''palnum'''''
Line 93: Line 95:
Specifies which palette this skin maps to.
Specifies which palette this skin maps to.


==== surface ====
===== surface =====


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


==== file ====
===== file =====


'''file ''filename'''''
'''file ''filename'''''
Line 106: Line 108:
'''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.
'''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 ====


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


==== frame ====
===== frame =====


'''frame0 ''framename'''''
'''frame0 ''framename'''''
Line 119: Line 121:
Specifies the names of the start ('''''frame0''''') and end ('''''frame1''''') frames of the animation.
Specifies the names of the start ('''''frame0''''') and end ('''''frame1''''') frames of the animation.


==== fps ====
===== fps =====


'''fps ''fps'''''
'''fps ''fps'''''
Line 125: Line 127:
Specifies the frame rate at which the animation should play. This value may be fractional.
Specifies the frame rate at which the animation should play. This value may be fractional.


==== flags ====
===== flags =====


'''flags ''flags'''''
'''flags ''flags'''''
Line 135: Line 137:
* 1 = one-shot (plays beginning to end once and stops on the last frame).
* 1 = one-shot (plays beginning to end once and stops on the last frame).


=== frame ===
==== 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:
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 =====


'''name ''framename'''''
'''name ''framename'''''
Line 148: Line 150:
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.
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 =====


'''tile ''tilenum'''''
'''tile ''tilenum'''''
Line 158: Line 160:
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.
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.


=== hud ===
==== hud ====


'''hud { ... }'''
'''hud { ... }'''
Line 164: Line 166:
Defines a range of ART-file tiles to use with a heads-up-display. The brace-enclosed block may contain these instructions:
Defines a range of ART-file tiles to use with a heads-up-display. The brace-enclosed block may contain these instructions:


==== tile ====
===== tile =====


'''''tile ''tilenum'''''
'''''tile ''tilenum'''''
Line 174: Line 176:
'''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.
'''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 ====
===== offset =====


'''xadd ''offset'''''
'''xadd ''offset'''''
Line 186: Line 188:
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...).
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 =====


'''hide'''
'''hide'''
Line 192: Line 194:
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.
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 =====


'''nobob'''
'''nobob'''
Line 198: Line 200:
By default, the HUD model offset is affected by the player bobbing offset when the player is walking. Use this option to disable that.
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 =====


'''flipped'''
'''flipped'''
Line 204: Line 206:
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.
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 =====


'''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 :)
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 :)
== Un-Definitions ==
=== undeftexture ===
==== undeftexturerange ====
=== undefmodel ===
==== undefmodelrange ====
==== undefmodelof ====
== EDuke32-Native Commands ==
=== alphahack ===
==== alphahackrange ====
=== 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.
=== 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.
=== 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, and palettes 26, 27, 28 and 29 are pre-defined for you as white, red, green and blue respectively. Sector visibility controls fog density.
== Deprecated Commands ==
=== definetexture ===
=== definetint ===
=== defineskybox ===
=== definemodel ===
==== definemodelskin ====
==== definemodelanim ====
==== definemodelframe ====
=== definevoxel ===
==== definevoxeltiles ====

Revision as of 08:25, 18 February 2007

Preferred Commands

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.

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.

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.

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.

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

Un-Definitions

undeftexture

undeftexturerange

undefmodel

undefmodelrange

undefmodelof

EDuke32-Native Commands

alphahack

alphahackrange

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.

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.

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, and palettes 26, 27, 28 and 29 are pre-defined for you as white, red, green and blue respectively. Sector visibility controls fog density.

Deprecated Commands

definetexture

definetint

defineskybox

definemodel

definemodelskin

definemodelanim

definemodelframe

definevoxel

definevoxeltiles