Quantcast

Jump to content

» «
Photo

[GTA Vice City]How to draw textures onscreen from .TXD file?

27 replies to this topic
CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#1

Posted 25 January 2014 - 01:21 PM Edited by TommyCJFaann, 14 March 2014 - 02:00 PM.

Hello guys!

 

I have one question.

 

I am having problems with drawing textures.

 

I have written code but it crashed,dunno why.

 

Read recent posts for code[wip].


CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#2

Posted 26 January 2014 - 12:54 PM

Guys please I need it a lot.


Danikov
  • Danikov

    The Fake Russian

  • Members
  • Joined: 27 Aug 2009
  • Israel

#3

Posted 26 January 2014 - 01:36 PM

First of all,it had just been a day,no need to bump this,you'll get help,eventually.

I think you should load the 'texture dictionary' first with Opcode 0390,then use Opcode 038F to load the texture you want to use from the texture dictionary you specified in Opcode 0390 and then you you draw the texture with Opcode 038D.

CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#4

Posted 26 January 2014 - 01:58 PM

Thanks but please,give an example.


Danikov
  • Danikov

    The Fake Russian

  • Members
  • Joined: 27 Aug 2009
  • Israel

#5

Posted 26 January 2014 - 02:06 PM

Thanks but please,give an example.


I mainly used Google to answer your question,so why don't you do the same and take a look by yourself.

CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#6

Posted 26 January 2014 - 02:27 PM

It shows codes for SA only.I need for VC.


CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#7

Posted 27 January 2014 - 04:03 PM

Hello guys!Please!

 

Is there no CLEO coders around,I don't know how I could arrange the opcodes Danikov provided.Please,I need a solution as soon as possible.


Silent
  • Silent

    Altering R* Vision™ since 2008

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#8

Posted 27 January 2014 - 04:27 PM

But these opcodes are for VC too.

CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#9

Posted 28 January 2014 - 04:05 PM Edited by TommyCJFaann, 28 January 2014 - 04:10 PM.

But these opcodes are for VC too.

Man,i meant i don't know how to put them in a right order.I wanted it to make it appear with a key press.

 

Should I use the txdAdd,txdLoad....*something*... commands?(actually memory addresses.)


goodidea82
  • goodidea82

    SA Modder

  • Members
  • Joined: 13 Jun 2013
  • Germany

#10

Posted 28 January 2014 - 09:20 PM

The good thing about cleo scripts is that they can be easily decompiled by drag and drop into the sannybuilder. Just search for a mod that does something similar (perhaps a speedometer mod) and decompile it to see how to use the commands. You can also decompile main.scm etc.


CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#11

Posted 29 January 2014 - 03:37 PM

The good thing about cleo scripts is that they can be easily decompiled by drag and drop into the sannybuilder. Just search for a mod that does something similar (perhaps a speedometer mod) and decompile it to see how to use the commands. You can also decompile main.scm etc.

VC doesn't have CLEO Speedo mods.BTW guys,nobody seems to reply the perfect solution.Thank you!


ThirteenAG
  • ThirteenAG

    Gangsta

  • Feroci
  • Joined: 29 Dec 2008
  • None
  • Contribution Award [Mods]

#12

Posted 29 January 2014 - 05:51 PM Edited by ThirteenAG, 29 January 2014 - 05:53 PM.

135279439217.jpg

http://bit.ly/1a1JKqk
  • Danikov likes this

CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#13

Posted 31 January 2014 - 04:00 PM

So you don't know that,man?


Silent
  • Silent

    Altering R* Vision™ since 2008

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#14

Posted 31 January 2014 - 04:34 PM

Why not look up how any of DOZENS of SA mods do it?

CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#15

Posted 08 March 2014 - 08:52 AM

Sorry for bumping,but I tried ThirteenAG's SA texture draw method,and got a grey box on screen.

 

I actually added the TXD dictionary and the texture in the code,still it didn't work.

 

P.S:If you need the code,PM me.


CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#16

Posted 09 March 2014 - 04:06 PM

Still,I have got no help.This doesn't need a Google Search,it needs some coder's help.


Silent
  • Silent

    Altering R* Vision™ since 2008

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#17

Posted 09 March 2014 - 04:08 PM

You ask people to PM you to help you and you're wondering why you get no replies? Really?

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None
  • Contribution Award [Mods]

#18

Posted 09 March 2014 - 04:14 PM

Post your code and we'll tell you exactly what's wrong with it.

DK22Pac
  • DK22Pac

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine
  • Best WIP Mod 2014 [Grand Theft Auto 3D Contribution]
    Contribution Award [Mods]

#19

Posted 09 March 2014 - 05:51 PM Edited by _DK, 09 March 2014 - 05:53 PM.

You can look for drawing examples in GTA SA's main.scm. III and VC use same opcodes for this.
And also here


fastman92
  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • None
  • Contribution Award [Mods]

#20

Posted 09 March 2014 - 07:49 PM

One problem that may occur:

http://gtag.gtagamin...se/opcode/074B/

A command that's used in every speedometer that has a rotated texture of needle drawn on screen, exists only in GTA SA
It's a command with ID of 0x074B

CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#21

Posted 14 March 2014 - 02:11 PM

Luckily I corrected the code myself,but it crashed again!

Here is the code. 

{$CLEO .cs}

//-------------MAIN---------------
0000: NOP
wait 200
0391: release_textures
0390: load_txd_dictionary 'texture' // never used in VC or GTA 3
038F: load_texture 'texture' as 1 // Load dictionary with 0390 first      

:SHOW_TEXTURE
wait 0 
if 
05EE:   key_pressed 80 //VK_... 
jf @HIDE_TEXTURE 
05F5: call_scm_func @draw_texture params 9 _and it is - position 560.0 320.0 size 80.0 180.0 RGBA 128 128 128 192 texture_id 1 
05DF: write_memory 6913008 size 4 value 290.0 virtual_protect 0 
05DF: write_memory 6913012 size 4 value 56.0 virtual_protect 0 

:HIDE_TEXTURE
if 
85EE:   not key_pressed 80 //VK_... 
jf @END
05F5: call_scm_func @draw_texture params 9 _and it is - position 920.0 724.0 size 240.0 248.0 RGBA 255 255 255 255 texture_id 1
05DF: write_memory 6913008 size 4 value 1000.0 virtual_protect 0 
05DF: write_memory 6913012 size 4 value 40.0 virtual_protect 0 

:END
jump @SHOW_TEXTURE
 
:draw_texture
05E0: 9@ = read_memory 0xA0FD04 size 4 virtual_protect 1  //X 1920
05E0: 10@ = read_memory 0xA0FD08 size 4 virtual_protect 1  //Y 1080
0093: 9@ = integer 9@ to_float
0093: 10@ = integer 10@ to_float 
//coordX = sa_coordX*(currentResX/640.0) 
0015: 9@ /= 640.0 //  currentResX/640.0
0069: 0@ *= 9@ // floating-point values 
0015: 10@ /= 448.0 //  currentResY/448.0
0069: 1@ *= 10@ // floating-point values
0069: 2@ *= 9@ // floating-point values
0069: 3@ *= 10@ // floating-point values
03F0: enable_text_draw 1 
038D: draw_texture 8@ position 0@ 1@ size 2@ 3@ RGBA 4@ 5@ 6@ 7@
05F6: ret 0

I was testing with the texture positions for almost five times,and suddenly it crashed.

This time,I used 05F5 opcode.


ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union
  • Contribution Award [Mods]
    Helpfulness Awards [Mods]

#22

Posted 14 March 2014 - 02:32 PM

do you have a file in models folder with name texture.txd ?

and does this file contain the image "texture" ?


CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#23

Posted 14 March 2014 - 02:50 PM

Yes,man. I am not that bad.  :D


ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union
  • Contribution Award [Mods]
    Helpfulness Awards [Mods]

#24

Posted 14 March 2014 - 03:50 PM

well, your script works for me


CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#25

Posted 14 March 2014 - 03:53 PM

well, your script works for me

Is it?Well,that's not a problem actually.

 

After several times of restarting game and recompiling again and again,it crashed.

(could you send me the compiled file?)


ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union
  • Contribution Award [Mods]
    Helpfulness Awards [Mods]

#26

Posted 14 March 2014 - 04:40 PM

https://www.mediafir...kcm3f53p5wj5c6o


CharlesVercetti
  • CharlesVercetti

    a.k.a TommyCJFaann

  • Members
  • Joined: 08 Dec 2013
  • India

#27

Posted 15 March 2014 - 03:06 PM

Your compiled script worked!

 

Hmmm...It seems I can't open the script,says errors

Unknown opcode 6574 at offset 11.


ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union
  • Contribution Award [Mods]
    Helpfulness Awards [Mods]

#28

Posted 15 March 2014 - 04:07 PM

did you use newest sannybuilder version for decompiling?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users