grovespaz Posted November 23, 2006 Share Posted November 23, 2006 (edited) 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 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: 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: (clickable) Explanation of the 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. ;; 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. 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 Edited October 25, 2007 by grovespaz Link to comment Share on other sites More sharing options...
grovespaz Posted November 23, 2006 Author Share Posted November 23, 2006 (edited) 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 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 033F: set_text_draw_letter_width_height float (width) float (height) Sets the width and height of the letters Reported to work on: GTA IIISet Text Color 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 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: If toggled off: Parameters used in screenshot not related to parameter: 0344: (unknown)_text_draw_width 580.00340: set_text_draw_color 190 190 190 255033F: set_text_draw_letter_width_height .75 1.00348: set_text_draw_proportional 1 Reported to work on GTA IIIDraw Text In Box 0345: set_text_draw_in_box Toggle(1=on/0=off) Draw the text in a box GTAIII: If used with style 0 (Default): If used with style 1: Parameters used: 0346: set_text_draw_background_color 0 0 0 1000345: set_text_draw_in_box 1 Reported to work on: GTA IIISet Box Background Color 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 IIIProportional Font 0348: set_text_draw_proportional 1 Use Proportional Font (1=fixed width, 0=proportional) GTAIII: Toggle on: Toggle off: Parameters used in screenshot not related to parameter: 0344: (unknown)_text_draw_width 580.00342: set_text_draw_centered 1 0340: set_text_draw_color 190 190 190 255033F: set_text_draw_letter_width_height .75 1.0 Reported to work on: GTA IIISet Text Style 0349: text_draw_style = 0 Sets the font in which to Text_Draw. GTAIII: Style 0 (Default): Style 1: 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: 0344: (unknown)_text_draw_width 580.00342: set_text_draw_centered 1 0340: set_text_draw_color 190 190 190 255033F: set_text_draw_letter_width_height .75 1.00348: set_text_draw_proportional 1 0346: set_text_draw_background_color 0 0 0 1000345: set_text_draw_in_box 1 Reported to work on: GTA IIIUnknown/Not Tested Yet opcodes: UNKNOWN: Width 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 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 VCNot Tested Yet: Text with two numbers 045B: text_draw_1number 320.0 400.0 "TEXT" Int1 Int2 Supposed to draw text including 2 numbers Reported to work on: GTA VCNot Tested Yet: Align Right 03e4: set_text_draw_align_right 1 Supposed to allign the text right, instead of left. Not Tested Yet: Draw Textures Dunno If anyone is willing to investigate this before i do, be my guest Reported to work on: GTA SAPost history:Initial Version Edited November 23, 2006 by grovespaz Link to comment Share on other sites More sharing options...
grovespaz Posted November 23, 2006 Author Share Posted November 23, 2006 (edited) 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 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 Edited November 23, 2006 by grovespaz Link to comment Share on other sites More sharing options...
grovespaz Posted November 23, 2006 Author Share Posted November 23, 2006 (Post reserved for future updates...) Link to comment Share on other sites More sharing options...
Bigun Posted November 23, 2006 Share Posted November 23, 2006 Hey, good job , 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? ). Link to comment Share on other sites More sharing options...
grovespaz Posted November 23, 2006 Author Share Posted November 23, 2006 (edited) 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.. 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 ), 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. Edited November 23, 2006 by grovespaz Link to comment Share on other sites More sharing options...
Bigun Posted November 23, 2006 Share Posted November 23, 2006 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. (hope Dem sees and assimlates that sentence). Link to comment Share on other sites More sharing options...
grovespaz Posted November 23, 2006 Author Share Posted November 23, 2006 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. (hope Dem sees and assimlates that sentence). 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now