Template:Orientation: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
No edit summary
 
Added information about RS_LERP and RS_FORCELERP
 
(22 intermediate revisions by 8 users not shown)
Line 1: Line 1:
orientation is a parameter used in several of the screen drawing commands, including [[digitalnumber]] and [[rotatesprite]]
<noinclude>{{Template}}</noinclude>


orientation is a bitfield, the flags of which determine how a sprite is drawn.  Here are the known bits and what they do. There may be others:
The following values are used by [[rotatesprite]], [[rotatesprite16]], [[rotatespritea]], [[screentext]], [[gametext]], [[minitext]], [[digitalnumber]], [[digitalnumberz]], [[myos]] and [[myospalx]].


Bit 1 (1) is translucency level one (66% opacity).
{| {{prettytable}}
Bit 2 (2) is scaling on 320x200 coordinates. It's considered internal in the case of CON commands because the CON interface automatically sets it when you use functions calling rotatesprite (rotatesprite as well as various text functions).
!Exposed!!Value!!Label!!Description!!
Bit 3 (4) is used to invert Y coordinates.
|-
Bit 4 (8) ?
| No || 1 || RS_TRANS1 || Translucency level one (66% opacity).
Bit 5 (16) forces the center of the sprite you're drawing to its top-left if set. If not, its center as set in editart will be drawn at the specified coordinates.
|-
Bit 6 (32) is translucency level two (33% opacity). It won't work unless bit 1 is also set.
| No || 2 || RS_AUTO || Scaling on 320-200 coordinates. This is implicitly applied to all CON screen drawing commands, but including it in your bitfields is recommended for clarity and portability of your code.
Bit 7 (64) forces masking off if set. It discards translucency too.
|-
| No || 4 || RS_YFLIP || Used to invert Y coordinates. Combine this bit with an angle of 1024 (using rotatesprite) and the tile will appear to have inverted X coordinates. If you want inversion for both the X and Y coordinates, simply set the angle (again, with rotatesprite) to 1024 and do not use this bit.
|-
| No || 8 || RS_NOCLIP || Causes the sprite to be not affected by the screen size (using the + or - commands). This is usefull, for example, when displaying a status bar.
|-
| No || 16 || RS_TOPLEFT || Forces the center of the sprite you're drawing to its top-left if set. It also ignores the x-y offset of the tile.
|-
| No || 32 || RS_TRANS2 || Translucency level two (33% opacity). It won't work if '''1'''  is not set.
|-
| No || 64 || RS_NOMASK || Forces masking off if set. It discards translucency too.
|-
| No || 128 || RS_PERM || "Permanent" tile (deprecated).
|-
| No || 256 || RS_ALIGN_L || Align to the left (widescreen support)
|-
| No || 512 || RS_ALIGN_R || Align to the right (widescreen support)
|-
| No || 1024 || RS_STRETCH || Stretch to screen resolution (distorts aspect ratio; this is the behavior of rotatesprite prior to widescreen awareness)
|-
| No || 2048 || ROTATESPRITE_FULL16 || Always interpret coordinate values as having "full" precision, [[shiftvarl|bit-shifted left by 16]], so that 20971520x13107200 corresponds to 320x200. See [[rotatesprite16]].
|-
| No || 4096 || RS_LERP || Enables interpolation of coordinates between rotatesprite calls per [[guniqhudid]]. Changes of tilenum reset interpolation.
|-
| No || 8192 || RS_FORCELERP || Forces interpolation, even if the tilenum changes between calls.
|-
|}


As with [[cstat]], the bit values can be added together and used in combination.  For example, orientation 33 (32+1) is transparency level two, and orientation 5 (4+1) is transparency level one with inverted Y coordinates.
{| {{Collapse}}
| <strong>Defines</strong>
|-
|
define RS_TRANS1                        0x00000001
define RS_AUTO                          0x00000002
define RS_YFLIP                        0x00000004
define RS_NOCLIP                        0x00000008
define RS_TOPLEFT                      0x00000010
define RS_TRANS2                        0x00000020
define RS_NOMASK                        0x00000040
define RS_PERM                          0x00000080
define RS_ALIGN_L                      0x00000100
define RS_ALIGN_R                      0x00000200
define RS_STRETCH                      0x00000400
define ROTATESPRITE_FULL16              0x00000800
|}
 
As with [[cstat (sprite)|cstat]], the bit values can be added together and used in combination.  For example, orientation 33 (32+1) is transparency level two, and orientation 5 (4+1) is transparency level one with inverted Y coordinates.
 
<noinclude>[[Category:Templates]]</noinclude>
<includeonly>[[Category:Pages with templates]]</includeonly>

Latest revision as of 20:52, 9 September 2022

This page is a template.
This page was created to be included in other pages.


The following values are used by rotatesprite, rotatesprite16, rotatespritea, screentext, gametext, minitext, digitalnumber, digitalnumberz, myos and myospalx.

Exposed Value Label Description
No 1 RS_TRANS1 Translucency level one (66% opacity).
No 2 RS_AUTO Scaling on 320-200 coordinates. This is implicitly applied to all CON screen drawing commands, but including it in your bitfields is recommended for clarity and portability of your code.
No 4 RS_YFLIP Used to invert Y coordinates. Combine this bit with an angle of 1024 (using rotatesprite) and the tile will appear to have inverted X coordinates. If you want inversion for both the X and Y coordinates, simply set the angle (again, with rotatesprite) to 1024 and do not use this bit.
No 8 RS_NOCLIP Causes the sprite to be not affected by the screen size (using the + or - commands). This is usefull, for example, when displaying a status bar.
No 16 RS_TOPLEFT Forces the center of the sprite you're drawing to its top-left if set. It also ignores the x-y offset of the tile.
No 32 RS_TRANS2 Translucency level two (33% opacity). It won't work if 1 is not set.
No 64 RS_NOMASK Forces masking off if set. It discards translucency too.
No 128 RS_PERM "Permanent" tile (deprecated).
No 256 RS_ALIGN_L Align to the left (widescreen support)
No 512 RS_ALIGN_R Align to the right (widescreen support)
No 1024 RS_STRETCH Stretch to screen resolution (distorts aspect ratio; this is the behavior of rotatesprite prior to widescreen awareness)
No 2048 ROTATESPRITE_FULL16 Always interpret coordinate values as having "full" precision, bit-shifted left by 16, so that 20971520x13107200 corresponds to 320x200. See rotatesprite16.
No 4096 RS_LERP Enables interpolation of coordinates between rotatesprite calls per guniqhudid. Changes of tilenum reset interpolation.
No 8192 RS_FORCELERP Forces interpolation, even if the tilenum changes between calls.
Defines
define RS_TRANS1                        0x00000001
define RS_AUTO                          0x00000002
define RS_YFLIP                         0x00000004
define RS_NOCLIP                        0x00000008
define RS_TOPLEFT                       0x00000010
define RS_TRANS2                        0x00000020
define RS_NOMASK                        0x00000040
define RS_PERM                          0x00000080
define RS_ALIGN_L                       0x00000100
define RS_ALIGN_R                       0x00000200
define RS_STRETCH                       0x00000400
define ROTATESPRITE_FULL16              0x00000800

As with cstat, the bit values can be added together and used in combination. For example, orientation 33 (32+1) is transparency level two, and orientation 5 (4+1) is transparency level one with inverted Y coordinates.