Rotatesprite: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
mNo edit summary
Fox (talk | contribs)
No edit summary
 
(19 intermediate revisions by 8 users not shown)
Line 1: Line 1:
rotatesprite <x> <y> <z> <a> <tilenum> <shade> <pal> <orientation> <x1> <x2> <y1> <y2>
'''rotatesprite''' <[[x]]> <[[y]]> <[[zoom]]> <[[ang]]> <[[picnum|tilenum]]> <[[shade]]> <[[pal]]> <[[orientation]]> <x1> <y1> <x2> <y2><br>
'''rotatespritea''' <[[x]]> <[[y]]> <[[zoom]]> <[[ang]]> <[[picnum|tilenum]]> <[[shade]]> <[[pal]]> <[[orientation]]> <[[alpha]]> <x1> <y1> <x2> <y2>


Displays tiles onscreen.
'''rotatesprite''' displays tiles onscreen.


<x> and <y> are on-screen coordinates.
Note: This command is similar to the deprecated [[myospal]] and [[myospalx]] commands, but with much more control.


<z> is the zoom.  Normal zoom is 65536. Ex: 131072 is zoomed in 2X and 32768 is zoomed out 2X.
== Parameters ==


<a> is the angle (0 is straight up).
{| {{prettytable}}
| <[[x]]> || X coordinate, normally ranged 0-320
|-
| <[[y]]> || Y coordinate, normally ranged 0-200
|-
| <[[zoom]]> || is normally 65536. (ex: 131072 is zoomed in 2X and 32768 is half-sized)
|-
| <[[ang]]> || is the angle, normally 0, where 360 degrees corresponds to 2048 [[Build units]]
|-
| <[[tilenum]]> || is the tile number.
|-
| <[[shade]]> || is 0 normally but can be any standard shade up to 31 or 63.
|-
| <[[pal]]> || can be from 0-255.
|-
| <[[orientation]]> || a [[bitfield]] describing translucency, masking, etc...
|-
| <[[alpha]]> || translucence, 0-255
|-
| <x1><br /><y1><br /><x2><br /><y2> || are boundaries on the screen that define where the tile may be drawn. If you want to draw a menu, use orientation bit 8, and the boundaries <code>0 0 [[xdim]]-1 [[ydim]]-1</code> as shown in example #2. If you want to draw a weapon, do not use bit 8 and use boundaries <code>[[windowx1]] [[windowy1]] [[windowx2]] [[windowy2]]</code>, as shown in example #1.  The difference is that xdim and ydim stay constant, while the other four shrink depending on the player's [[screen_size|screen size]].
|-
|}


<tilenum> is the tile number.
== Orientation ==


<shade> is 0 normally but can be any standard shade up to 31 or 63.
{{Orientation}}


<pal> can be from 0-255.
== Examples ==


<orientation> translucency, masking, etc...
setvar x 164
setvar y 176
setvar z 65536
setvar ang 0
setvar tilenum RPGGUN
setvar shade 0
setvar pal 0
setvar orientation 0
'''rotatesprite''' x y z ang tilenum shade pal orientation windowx1 windowy1 windowx2 windowy2


<x1>, <y1>, <x2> and <y2> are boundaries on the screen that define where the tile may be drawn.
This example displays the loading screen with 90% translucence as a kind of "Please Wait" sign:


Example code:
setvarvar xdimminus xdim
subvar xdimminus 1
setvarvar ydimminus ydim
subvar ydimminus 1
'''rotatespritea''' 160 100 65536 0 LOADSCREEN 0 0 8 230 0 0 xdimminus ydimminus


<pre>
[[Category:EDuke32 specific commands]]
setvar x 30
[[Category:Screen drawing commands]]
setvar y 30
setvar z 32768
setvar TEMP 0
setvar tilenum 3350
setvar shade 0
setvar pal 0
setvar orientation 1 // transparency
rotatesprite x y z TEMP tilenum shade orientation pal [[windowx1]] [[windowy1]] [[windowx2]] [[windowy2]]
</pre>
 
Note: This command is similar to the [[myospal]] and [[myospalx]] commands, but with much more control.

Latest revision as of 11:47, 21 February 2020

rotatesprite <x> <y> <zoom> <ang> <tilenum> <shade> <pal> <orientation> <x1> <y1> <x2> <y2>
rotatespritea <x> <y> <zoom> <ang> <tilenum> <shade> <pal> <orientation> <alpha> <x1> <y1> <x2> <y2>

rotatesprite displays tiles onscreen.

Note: This command is similar to the deprecated myospal and myospalx commands, but with much more control.

Parameters

<x> X coordinate, normally ranged 0-320
<y> Y coordinate, normally ranged 0-200
<zoom> is normally 65536. (ex: 131072 is zoomed in 2X and 32768 is half-sized)
<ang> is the angle, normally 0, where 360 degrees corresponds to 2048 Build units
<tilenum> is the tile number.
<shade> is 0 normally but can be any standard shade up to 31 or 63.
<pal> can be from 0-255.
<orientation> a bitfield describing translucency, masking, etc...
<alpha> translucence, 0-255
<x1>
<y1>
<x2>
<y2>
are boundaries on the screen that define where the tile may be drawn. If you want to draw a menu, use orientation bit 8, and the boundaries 0 0 xdim-1 ydim-1 as shown in example #2. If you want to draw a weapon, do not use bit 8 and use boundaries windowx1 windowy1 windowx2 windowy2, as shown in example #1. The difference is that xdim and ydim stay constant, while the other four shrink depending on the player's screen size.

Orientation

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.

Examples

setvar x 164
setvar y 176
setvar z 65536
setvar ang 0
setvar tilenum RPGGUN
setvar shade 0
setvar pal 0
setvar orientation 0
rotatesprite x y z ang tilenum shade pal orientation windowx1 windowy1 windowx2 windowy2

This example displays the loading screen with 90% translucence as a kind of "Please Wait" sign:

setvarvar xdimminus xdim
subvar xdimminus 1
setvarvar ydimminus ydim
subvar ydimminus 1
rotatespritea 160 100 65536 0 LOADSCREEN 0 0 8 230 0 0 xdimminus ydimminus