038D

From GTAMods Wiki
Revision as of 15:25, 14 September 2017 by Spaceeinstein (talk | contribs) (Created page with "{{OpCode | games = {{Icon|t}} | command = DRAW_SPRITE | description = Draws the sprite | syntax1 = 038D: draw_texture [''int1''] position [''flt1''] [''...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

GTA III Vice City San Andreas DRAW_SPRITE


Description
Draws the sprite
Syntax
038D: draw_texture [int1] position [flt1] [flt2] size [flt3] [flt4] RGBA [int2] [int3] [int4] [int5]
Parameter
[int1]
Memory slot
[flt1]
X-position from the left side of the screen
[flt2]
Y-position from the top side of the screen
[flt3]
Width in pixels
[flt4]
Height in pixels
[int2]
Red
[int3]
Green
[int4]
Blue
[int5]
Alpha

This opcode draws the sprite loaded through opcode 038F. The games draw sprites in a similar manner to intro text so it requires opcode 03F0 to draw properly. Unlike intro text, the positions and dimensions are absolute and does not scale with resolution. Drawing an invalid sprite will result in a colored rectangle. This opcode was never called in the original scripts of GTA III or Vice City.

Example

The following example for Vice City using Sanny Builder moves a sprite named RKCHAT from HUD.txd across the screen and draws a counter displaying the current horizontal position of the sprite. Pressing button 13 (CAMERA key) removes the sprite and counter.

const
X_POSITION = 0@
COUNT_NUMBER = 1@
end

0390: load_txd_dictionary 'HUD'
038F: load_texture 'RKCHAT' as 1
X_POSITION = 100.0
COUNT_NUMBER = 100
03F0: enable_text_draw 1 
while true
    wait 0
    if
        00E1:   player 0 pressed_button 13  // camera key
    then
        03F0: enable_text_draw 0
        break
    end
    038D: draw_texture 1 position X_POSITION 100.0 size 64.0 64.0 RGBA 255 255 255 255
    X_POSITION += 1.0
    045A: text_draw_1number 100.0 100.0 'NUMBER' COUNT_NUMBER
    COUNT_NUMBER += 1
end
0391: release_textures

Keywords

draw, texture, sprite