Line SetTextureOffset: Difference between revisions

From ZDoom Wiki
Jump to navigation Jump to search
Content deleted Content added
m Yay it works
Tsrow (talk | contribs)
m Usage: added texflag constants from zdefs.acs
Line 6: Line 6:
Changes the offset of a texture at run-time. This can be used during runtime for special effects, and it is possible to set the offsets of upper, mid, and lower textures seperately. This special cannot be used directly on a line in the map, but must be called from an ACS script instead.
Changes the offset of a texture at run-time. This can be used during runtime for special effects, and it is possible to set the offsets of upper, mid, and lower textures seperately. This special cannot be used directly on a line in the map, but must be called from an ACS script instead.


''side'' can be '''LINE_FRONT''' or '''LINE_BACK'''.
''side'' can be '''SIDE_FRONT''' or '''SIDE_BACK'''.


''x'' and ''y'' are fixed point values; using '''NO_CHANGE''' leaves it alone.
''x'' and ''y'' are fixed point values; using '''NO_CHANGE''' leaves it alone.


''flags'' can be a combination of the following flags:
''flags'' can be a combination of the following flags:
*1: upper texture
* '''TEXFLAG_TOP''' (1): upper texture
*2: mid texture
* '''TEXFLAG_MIDDLE''' (2): mid texture
*4: lower texture
* '''TEXFLAG_BOTTOM''' (4): lower texture
*8: add to offset (as opposed to directly setting it)
* (8): add to offset (as opposed to directly setting it)


== Examples ==
== Examples ==

Revision as of 20:10, 14 April 2011

53:Line_SetTextureOffset (lineid, x, y, side, flags)


Usage

Changes the offset of a texture at run-time. This can be used during runtime for special effects, and it is possible to set the offsets of upper, mid, and lower textures seperately. This special cannot be used directly on a line in the map, but must be called from an ACS script instead.

side can be SIDE_FRONT or SIDE_BACK.

x and y are fixed point values; using NO_CHANGE leaves it alone.

flags can be a combination of the following flags:

  • TEXFLAG_TOP (1): upper texture
  • TEXFLAG_MIDDLE (2): mid texture
  • TEXFLAG_BOTTOM (4): lower texture
  • (8): add to offset (as opposed to directly setting it)

Examples

This script will move the middle texture on a line with an id of 1 in a clockwise circular pattern.

script 1 open
{
    int a, x, y;
    while(TRUE)
    {
        for(a=0; a<1.0; a+=512)
        {
            x = FixedMul(cos(a), 128.0);
            y = FixedMul(sin(a), 128.0);
            Line_SetTextureOffset(1, x, y, LINE_FRONT, 2);
            delay(1);
        }
    }
}