Quantcast

Jump to content

» «
Photo

The Big Text_Draw Topic

7 replies to this topic
grovespaz
  • grovespaz

    Group: Morons

  • Members
  • Joined: 22 Feb 2004

#1

Posted 23 November 2006 - 01:10 PM Edited by grovespaz, 25 October 2007 - 06:17 PM.

Text_Draw Explanation


1. Introduction to Text_Draw
2. Get a working Text_Draw thread
3. Parameter Explanation
4. Drawing textures
5. Differences in games
6. Thankword

Introduction to Text_Draw
Hello all, I am grovespaz, and this post will be all about Text_Draw. Now you might ask, 'What is Text_Draw?'.
Text_Draw is a powerfull set of opcodes, that can be used to display text (and is SA, pictures(!)) everywhere on the screen. In any size, color, and sometimes even shape. The best example i can give you is Demarest's Thirst For Blood
This post is meant to be a guide to Text_Draw. But it is also meant to be created by everyone who wants to. That means, that if you find out a whole new parameter, or have a tiny update, just post, and this post will be edited wink.gif
This is not a guide to code 'newbies', you must be an intermeddiate coder of you want Text_Draw to work, and an advanced one if you want to create something usefull..

Now then, Text_Draw is a very strange set of opcodes. My best guess on why it behaves like it behaves, is that is is being forced almost directly into the frame buffer.

PLEASE NOTE: Do not expect a fully worked out post! this list will be updated as we experiment.

Get a working Text_Draw thread

In GTA III/VC, create a thread containing/insert in main this:
CODE
03F0: text_draw_toggle  1                    
:LabelTextDraw  
0001: wait 0 ms
;; Insert parameters here.
033E: text_draw  320.0  400.0 "M_FAIL"
0002: jump ££LabelTextDraw

If you run it, you will probably see this:
user posted image
(clickable)
Explanation of the code:
CODE
03F0: text_draw_toggle  1

One of the most important opcodes while using Text_Draw.
If you want to use Text_Draw, you will have to toggle it on first.
This only needs to be done once, then you can use it troughout the whole mission script.

CODE
;; Insert parameters here.

This is the place where you will be inserting the parameters which will affect the Text_Draw. Scroll down to see 'em.

CODE
033E: text_draw  320.0  400.0 "M_FAIL"

THE most important opcode. This is the opcode which actually displays the text on screen.

Further explanation: Once the Text_Draw_Toggle is toggled on, the mission script goes into a loop.
This is one of the most important things to remember while using Text_Draw, The Text_Draw needs to be called every frame. This means that you will have to set every parameter again every frame. Remember this!
The Wait 0 ms ensures that the game will keep running, and that the Text_Draw opcode will be strobed every frame.

Great! Now that you have a working Text_Draw thread, lets move on to different parameters!


Post history:
  • Initial Version

grovespaz
  • grovespaz

    Group: Morons

  • Members
  • Joined: 22 Feb 2004

#2

Posted 23 November 2006 - 01:10 PM Edited by grovespaz, 23 November 2006 - 06:15 PM.

Parameter Explanation
In this part I will be collecting the different parameters, allong with screenshots of their effects.
Please note that this list is very WIP at the moment. Not all information may be accurate at the moment.
I have also included a little list to store compatibility information.
If the list says 'Works on', it means that the opcodes have been tested on ALL GTA's, and work on the GTA's in the list.

If the list says 'Reported to work on', it means it has been tested on that GTA only yet. Contribute by testing yourself.

Text Draw
CODE
033E: text_draw  X  Y "GXT TEXT"
The Über text draw code, draws the text on the screen.

Works on:
  • GTA III
  • GTA VC
  • GTA SA
Set Letter Width And Height
CODE
033F: set_text_draw_letter_width_height  float (width) float (height)
Sets the width and height of the letters
Reported to work on:
  • GTA III
Set Text Color
CODE
0340: set_text_draw_color  int (Red) int (Green) int (Blue) int (Opacity)
Sets the color in which to draw, last value controls the opacity/transperancy of the text (255=fully visible, 0= invisible).
Reported to work on:
  • GTA III
  • GTA VC
Center Text
CODE
0342: set_text_draw_centered  Toggle(1=on/0=off)
If set to zero, text will start from the position specified later, if set to one, it will be the centerpoint of the text
GTAIII:
If toggled on:
user posted image

If toggled off:
user posted image

Parameters used in screenshot not related to parameter:
CODE
0344: (unknown)_text_draw_width  580.0
0340: set_text_draw_color  190  190  190 255
033F: set_text_draw_letter_width_height  .75  1.0
0348: set_text_draw_proportional  1


Reported to work on
  • GTA III
Draw Text In Box
CODE
0345: set_text_draw_in_box  Toggle(1=on/0=off)
Draw the text in a box
GTAIII:
If used with style 0 (Default):
user posted image

If used with style 1:
user posted image

Parameters used:
CODE
0346: set_text_draw_background_color  0  0  0 100
0345: set_text_draw_in_box  1


Reported to work on:
  • GTA III
Set Box Background Color
CODE
0346: set_text_draw_background_color  int (Red) int (Green) int (Blue) int (Opacity)
Set the background color of the box surrounding the letters, used in conjunction with 0345. Last value sets opacity.
Reported to work on:
  • GTA III
Proportional Font
CODE
0348: set_text_draw_proportional  1

Use Proportional Font (1=fixed width, 0=proportional)
GTAIII:
Toggle on:
user posted image

Toggle off:
user posted image

Parameters used in screenshot not related to parameter:
CODE
0344: (unknown)_text_draw_width  580.0
0342: set_text_draw_centered  1
0340: set_text_draw_color  190  190  190 255
033F: set_text_draw_letter_width_height  .75  1.0

Reported to work on:
  • GTA III
Set Text Style
CODE
0349: text_draw_style =  0
Sets the font in which to Text_Draw.
GTAIII:
Style 0 (Default):
user posted image

Style 1:
user posted image
Note that this style seems to ignore any color, proportional and some other parameters..

I've included the box around the text to show you it changes too.
Style 2 seems to have no letters, and any higher crashes the game..
Parameters used in screenshots not related to this opcode:
CODE
0344: (unknown)_text_draw_width  580.0
0342: set_text_draw_centered  1
0340: set_text_draw_color  190  190  190 255
033F: set_text_draw_letter_width_height  .75  1.0
0348: set_text_draw_proportional  1
0346: set_text_draw_background_color  0  0  0 100
0345: set_text_draw_in_box  1

Reported to work on:
  • GTA III
Unknown/Not Tested Yet opcodes:

UNKNOWN: Width
CODE
0344: (unknown)_text_draw_width  580.0
It is unknown what this opcode does. It is assumed that it controls something about the width.
Update!: I think this is connected to the width of the box around the text.. Stay Tuned.

Not Tested Yet: Text with one number
CODE
045A: text_draw_1number  320.0  400.0 "TEXT" Int

Supposed to draw text including a number (IE. Mission Passed! $1000)

Reported to work on:
  • GTA VC
Not Tested Yet: Text with two numbers
CODE
045B: text_draw_1number  320.0  400.0 "TEXT" Int1 Int2

Supposed to draw text including 2 numbers

Reported to work on:
  • GTA VC
Not Tested Yet: Align Right
CODE
03e4: set_text_draw_align_right 1

Supposed to allign the text right, instead of left.

Not Tested Yet: Draw Textures
CODE
Dunno

If anyone is willing to investigate this before i do, be my guest wink.gif rah.gif
Reported to work on:
  • GTA SA
Post history:
  • Initial Version

grovespaz
  • grovespaz

    Group: Morons

  • Members
  • Joined: 22 Feb 2004

#3

Posted 23 November 2006 - 01:10 PM Edited by grovespaz, 23 November 2006 - 03:26 PM.

Drawing Textures
I haven't looked into drawing textures yet. Expect me to do so soon..

Differences in games
This is the info i got off Demarest wink.gif
QUOTE (Demarest)
The 3 games behave a bit differently. And to be honest, I don't fully remember them. IIRC, the following are true, but you shouldn't experiment to make certain.

In GTA3 and VC, the size of your "canvas" is actual screen resolution of the game. In SA, it's a constant 640 x 480. However, when text drawing textures, all 3 games consider the canvas to be something like 640 x 448.

When text drawing textures, GTA3's version of the command specifies upper left corner coord and XY span. Whereas VC and SA specify center coord and XY span.


Thankword, etcetera..
Well, thats it, if you have any questions, just post!

List of thanks:
  • I'd like to thank Demarest , for getting me into Text_Draw, and guiding me through the first hard steps. Our conversations have been the seed of this post.


Post history:
  • Initial Version

grovespaz
  • grovespaz

    Group: Morons

  • Members
  • Joined: 22 Feb 2004

#4

Posted 23 November 2006 - 01:11 PM

(Post reserved for future updates...)

Bigun
  • Bigun

    wandering about

  • Members
  • Joined: 10 Jul 2004

#5

Posted 23 November 2006 - 04:13 PM

Hey, good job icon14.gif , but isn't creating some tutorial specifically for a few opcodes a bit too much? Should've really just replied in the Opcodes thread. Otherwise, this belongs to the Tutorials forum (what's with posting threads like this here? tounge.gif ).

grovespaz
  • grovespaz

    Group: Morons

  • Members
  • Joined: 22 Feb 2004

#6

Posted 23 November 2006 - 04:20 PM Edited by grovespaz, 23 November 2006 - 04:24 PM.

Well, the first post is indeed a small tutorial about how to get a working Text_Draw.

The posts after that are meant more as a collection of text_draw opcodes. Anyone can contribute. That kinda stuff.. tounge.gif
Since this is new to most people, and since this could be such a great influence on mods (Displaying your own graphics/huds/whatever through mission script is something wink.gif ), and since this is still very WIP.
I thought this would get more attention it deserves, seeing how advanced coders rarely look in the tutorial forum IMHO.

Bigun
  • Bigun

    wandering about

  • Members
  • Joined: 10 Jul 2004

#7

Posted 23 November 2006 - 05:41 PM

QUOTE (grovespaz)
I thought this would get more attention it deserves, seeing how advanced coders rarely look in the tutorial forum IMHO.


Unfortunately, I agree. Though it doesn't really change where it should be, if every tutorial just goes in it's respective section, there shouldn't be a Tutorials forum. Same thing for Recruits & Requests. I think maybe people should post in the tutorials forum, then post a new thread linking to it in the respective section (and ask for discussion only in the original topic, possibly requesting the linking one to be locked). I'm not a mod though, and maybe the mods don't think the same as me though, so this can stay here. smile.gif (hope Dem sees and assimlates that sentence).

grovespaz
  • grovespaz

    Group: Morons

  • Members
  • Joined: 22 Feb 2004

#8

Posted 23 November 2006 - 06:08 PM

QUOTE (Bigun @ Nov 23 2006, 17:41)
QUOTE (grovespaz)
I thought this would get more attention it deserves, seeing how advanced coders rarely look in the tutorial forum IMHO.


Unfortunately, I agree. Though it doesn't really change where it should be, if every tutorial just goes in it's respective section, there shouldn't be a Tutorials forum. Same thing for Recruits & Requests. I think maybe people should post in the tutorials forum, then post a new thread linking to it in the respective section (and ask for discussion only in the original topic, possibly requesting the linking one to be locked). I'm not a mod though, and maybe the mods don't think the same as me though, so this can stay here. smile.gif (hope Dem sees and assimlates that sentence).

smile.gif Ontop of that, this isn't supposed to be a tutorial.
Alright, so the first post contains a mini-tutorial, the Paramater section is much more important. In the weekends, i'll try to figure out the SA texture loading.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users