-ATP- Posted May 3, 2010 Share Posted May 3, 2010 Hi, is it posible to create texts above actors like we know it from SA-MP in Single-Player? Like here for example: Greetings, ATP Link to comment Share on other sites More sharing options...
4elovek_paket Posted May 4, 2010 Share Posted May 4, 2010 Look at this script: http://hotmist.ddo.jp/cleomod/photo/index.html that's the source code of this script: http://hotmist.ddo.jp/cleo_cs/photo.txt try to understand how to create a 3D coordinate to 2D ) Link to comment Share on other sites More sharing options...
NTAuthority Posted May 4, 2010 Share Posted May 4, 2010 That script's world-to-screen-space code is only meant for cases where the camera is within the photo camera's viewfinding mode. Try calling the following function using the CLEO function calls (untested): :WorldToScreenconst TEMP_VAR_1 = [email protected] // inCoord location TEMP_VAR_2 = [email protected] // outCoord location TEMP_VAR_3 = [email protected] // outX location TEMP_VAR_4 = [email protected] // outY location IN_VAR = 4 // in => [email protected]@ ([email protected] * 4) OUT_VAR = 16 // out => [email protected]@ ([email protected] * 4) OUT_COORDS = 28 // coords => [email protected] x, [email protected] y ([email protected] * 4) PROC_COORDS = 0x70CE30 // ConvertGlobalXYToScreenXYendvar IN_VAR: Integer OUT_VAR: Integer TEMP_VAR_1: Integer TEMP_VAR_2: Integer TEMP_VAR_3: Integer TEMP_VAR_4: Integerend0A9F: TEMP_VAR_1 = current_thread_pointerTEMP_VAR_1 += 60TEMP_VAR_2 = TEMP_VAR_1TEMP_VAR_3 = TEMP_VAR_1TEMP_VAR_4 = TEMP_VAR_1TEMP_VAR_1 += IN_VARTEMP_VAR_2 += OUT_VARTEMP_VAR_3 += OUT_COORDSTEMP_VAR_4 = TEMP_VAR_3TEMP_VAR_4 += 40AA5: call PROC_COORDS num_params 6 pop 0 TEMP_VAR_1 TEMP_VAR_2 TEMP_VAR_3 TEMP_VAR_4 1 1// now, [email protected] and [email protected] should contain screen coords for location at ([email protected], [email protected], [email protected])return (also, I don't know it from SA-MP, I know it from the actual in-game use of that function ) Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
4elovek_paket Posted May 4, 2010 Share Posted May 4, 2010 I have not worked. Link to comment Share on other sites More sharing options...
Deji Posted May 4, 2010 Share Posted May 4, 2010 Wow... I thought 3D>2D coords was still just a distant dream. This is like, so useful for my mod(s) Any way to get a size, rotation etc? It probably doesn't matter for me but this info is always good written down. Link to comment Share on other sites More sharing options...
NTAuthority Posted May 4, 2010 Share Posted May 4, 2010 Any way to get a size, rotation etc? It probably doesn't matter for me but this info is always good written down. That code was a bit wrong; actually [email protected] and [email protected] will contain the screen coordinates, but the screen size adjustment is not yet applied to them. You'll have to perform calculations like done on this C# code: ([email protected] and [email protected] will get 'zoom' scale, usually used in text draw scale things) // translate screen size int sizeX = (int)(1 / Memory.ReadSingle(0x859520)); // can be 640.0f int sizeY = (int)(1 / Memory.ReadSingle(0x859524)); // can be 448.0f int fullX = Memory.ReadInt32(0xC17044); int fullY = Memory.ReadInt32(0xC17048); float factorX = sizeX / ((float)fullX); float factorY = sizeY / ((float)fullY); retval.pX *= factorX; retval.pY *= factorY; Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
4elovek_paket Posted May 5, 2010 Share Posted May 5, 2010 (edited) Could you write a small example? the car to withdraw any word. Edited May 5, 2010 by 4elovek_paket Link to comment Share on other sites More sharing options...
-ATP- Posted May 6, 2010 Author Share Posted May 6, 2010 (edited) That script's world-to-screen-space code is only meant for cases where the camera is within the photo camera's viewfinding mode. Try calling the following function using the CLEO function calls (untested): :WorldToScreenconst TEMP_VAR_1 = [email protected] // inCoord location TEMP_VAR_2 = [email protected] // outCoord location TEMP_VAR_3 = [email protected] // outX location TEMP_VAR_4 = [email protected] // outY location IN_VAR = 4 // in => [email protected]@ ([email protected] * 4) OUT_VAR = 16 // out => [email protected]@ ([email protected] * 4) OUT_COORDS = 28 // coords => [email protected] x, [email protected] y ([email protected] * 4) PROC_COORDS = 0x70CE30 // ConvertGlobalXYToScreenXYendvar IN_VAR: Integer OUT_VAR: Integer TEMP_VAR_1: Integer TEMP_VAR_2: Integer TEMP_VAR_3: Integer TEMP_VAR_4: Integerend0A9F: TEMP_VAR_1 = current_thread_pointerTEMP_VAR_1 += 60TEMP_VAR_2 = TEMP_VAR_1TEMP_VAR_3 = TEMP_VAR_1TEMP_VAR_4 = TEMP_VAR_1TEMP_VAR_1 += IN_VARTEMP_VAR_2 += OUT_VARTEMP_VAR_3 += OUT_COORDSTEMP_VAR_4 = TEMP_VAR_3TEMP_VAR_4 += 40AA5: call PROC_COORDS num_params 6 pop 0 TEMP_VAR_1 TEMP_VAR_2 TEMP_VAR_3 TEMP_VAR_4 1 1// now, [email protected] and [email protected] should contain screen coords for location at ([email protected], [email protected], [email protected])return (also, I don't know it from SA-MP, I know it from the actual in-game use of that function ) Hmm, I tried to use this function, but it crashes my game. Anybody know how I have to use it correct? Edited May 6, 2010 by -ATP- Link to comment Share on other sites More sharing options...
Wesser Posted August 3, 2010 Share Posted August 3, 2010 (edited) Another bump but it's needed to post the problem solution. NTAuthority, every call/function params are inverted and they need to be a pointer of some addresses which store the useful value (in this case we use scm variables as reference). Here is the script: { FUNCTIONS INCLUDED:- getScreenXYFrom3DCoords Type: GET Description: Get the screen 2D coords from 3D coords.- getLocalVarOffset Type: GET Description: Get local var offset from thread pointer.- getFullScreenXY Type: GET Description: Get screen XY from current resolution.}{$CLEO}0000: NOP03F0: enable_text_draw 1 while true wait 0 04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.0 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ [email protected] [email protected] [email protected] store_to [email protected] [email protected] 054C: use_GXT_table 'SWEET6' 0341: unknown_text_draw_flag 0 0342: enable_text_draw_centered 1 033E: set_draw_text_position [email protected] [email protected] GXT 'SWE6B34' end:getScreenXYFrom3DCoords{ Parameters: Passed: [email protected] - position X [email protected] - position Y [email protected] - position Z Result: [email protected] - screen X [email protected] - screen Y Example: 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ 2488.562 -1666.865 12.8757 store_to [email protected] [email protected] }[email protected] = 1 0A9F: [email protected] = current_thread_pointer0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected] // in => [email protected]@0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 3 store_to [email protected] // out => [email protected]@0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 6 store_to [email protected] // coords => [email protected]@0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 9 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 12 store_to [email protected] 0AA5: call 0x70CE30 num_params 6 pop 6 [email protected] [email protected] [email protected] [email protected] [email protected] [email protected] 0AB1: call_scm_func @getFullScreenXY 2 coords_XY [email protected] [email protected] store_to [email protected] [email protected] 0AB2: ret 2 [email protected] [email protected] :getLocalVarOffset{ Parameters: Passed: [email protected] - thread pointer [email protected] - var number Result: [email protected] - var value Example: 0AB1: call_scm_func @getLocalVarOffset 2 thread [email protected] var 0 store_to [email protected] }if [email protected] <> 0 then [email protected] *= 0x4 0A8E: [email protected] = [email protected] + 0xDC // mission flag if [email protected] == 1 then [email protected] += 0xA48960 else 005A: [email protected] += [email protected] [email protected] += 0x3C endelse [email protected] = 0 end0AB2: ret 1 [email protected] :getFullScreenXY{ Parameters: Passed: [email protected] - full screen X [email protected] - full screen Y Result: [email protected] - screen X [email protected] - screen Y Example: 0AB1: call_scm_func @getFullScreenXY 2 coords_XY 320.0 224.0 store_to [email protected] [email protected] }[email protected] = 640.0 // screen X0A8D: [email protected] = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X0093: [email protected] = integer [email protected] to_float0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] [email protected] = 448.0 // screen Y0A8D: [email protected] = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y0093: [email protected] = integer [email protected] to_float0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] 0AB2: ret 2 [email protected] [email protected] This script is deprecated. Find the updated version here. Edited April 6, 2013 by Wesser 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
Deji Posted August 3, 2010 Share Posted August 3, 2010 Ooh... nice... I'll check it out later. Me wonders if there's a way to do the opposite Link to comment Share on other sites More sharing options...
Wesser Posted April 1, 2011 Share Posted April 1, 2011 (edited) Sorry for bumping an old topic but I want to answer Deji's question: Me wonders if there's a way to do the opposite {FUNCTIONS INCLUDED:- getScreenXYFrom3DCoords Type: GET Description: Get screen 2D coords from world 3D coords.- get3DCoordsFromScreenXY Type: GET Description: Get world 3D coords from screen 2D coords with a fixed distance.- getFullScreenXY Type: GET Description: Get screen XY from current resolution.- getLocalVarOffset Type: GET Description: Get local var offset from thread pointer.}{$CLEO}const WIDTH = 640.0 HEIGHT = 448.0 HALF_WIDTH = 320.0 HALF_HEIGHT = 224.0 end0000: NOP03F0: enable_text_draw 1 while true wait 0 04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 0.0 1.0 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ [email protected] [email protected] [email protected] store_to [email protected] [email protected] 0AB1: call_scm_func @get3DCoordsFromScreenXY 3 coords_XY [email protected] [email protected] distance 1.0 store_to [email protected] [email protected] [email protected] 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ [email protected] [email protected] [email protected] store_to [email protected] [email protected] 054C: use_GXT_table 'SWEET6' 0341: unknown_text_draw_flag 0 0342: enable_text_draw_centered 1 033E: set_draw_text_position [email protected] [email protected] GXT 'SWE6B34' end:getScreenXYFrom3DCoords{ Parameters: Passed: [email protected] - position X [email protected] - position Y [email protected] - position Z Result: [email protected] - screen X [email protected] - screen Y Example: 0AB1: call_scm_func @getScreenXYFrom3DCoords 3 coords_XYZ 2488.562 -1666.865 12.8757 store_to [email protected] [email protected] }0AB1: call_scm_func @getLocalVarOffset 1 var 0 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 1 var 3 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 1 var 6 store_to [email protected] 0AB1: call_scm_func @getLocalVarOffset 1 var 9 store_to [email protected] 0AA5: call 0x70CE30 num_params 6 pop 6 bNearClip 0 bFarClip 0 pMultY [email protected] pMultX [email protected] pScreen [email protected] pCoords [email protected] 0AB1: call_scm_func @getFullScreenXY 2 coords_XY [email protected] [email protected] store_to [email protected] [email protected] 0AB2: ret 2 [email protected] [email protected] :get3DCoordsFromScreenXY{ Parameters: Passed: [email protected] - screen X [email protected] - screen Y [email protected] - distance Result: [email protected] - position X [email protected] - position Y [email protected] - position Z Example: 0AB1: call_scm_func @get3DCoordsFromScreenXY 3 coords_XY 320.0 224.0 distance 1.0 store_to [email protected] [email protected] [email protected] }0A8D: [email protected] = read_memory 0x8D5038 size 4 virtual_protect 0 // field of [email protected] *= 0.5 02F6: [email protected] = sine [email protected] 02F7: [email protected] = cosine [email protected] 0073: [email protected] /= [email protected] [email protected] = 1.0 [email protected] /= HALF_WIDTH // half screen X0063: [email protected] -= [email protected] 006B: [email protected] *= [email protected] [email protected] = 1.0 [email protected] /= HALF_HEIGHT // half screen Y0063: [email protected] -= [email protected] 006B: [email protected] *= [email protected] 0A8D: [email protected] = read_memory 0xC3EFA4 size 4 virtual_protect 0 // screen aspect ratio0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] 006B: [email protected] *= [email protected] 0087: [email protected] = [email protected] 0087: [email protected] = [email protected] 0087: [email protected] = [email protected] 0A8D: [email protected] = read_memory 0xB6F03C size 4 virtual_protect 0 // camera matrix0AB1: call_scm_func @getLocalVarOffset 1 var 9 store_to [email protected] 0AA5: call 0x59C790 num_params 3 pop 3 pOffsets [email protected] pMatrix [email protected] pResult [email protected] // [email protected] += 0x30 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // camera X [email protected] += 0x4 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // camera Y [email protected] += 0x4 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 // camera Z position005B: [email protected] += [email protected] 005B: [email protected] += [email protected] 005B: [email protected] += [email protected] 0AB2: ret 3 [email protected] [email protected] [email protected] :getFullScreenXY{ Parameters: Passed: [email protected] - full screen X [email protected] - full screen Y Result: [email protected] - screen X [email protected] - screen Y Example: 0AB1: call_scm_func @getFullScreenXY 2 coords_XY 320.0 224.0 store_to [email protected] [email protected] }[email protected] = WIDTH // screen X0A8D: [email protected] = read_memory 0xC17044 size 4 virtual_protect 0 // full screen X0093: [email protected] = integer [email protected] to_float0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] [email protected] = HEIGHT // screen Y0A8D: [email protected] = read_memory 0xC17048 size 4 virtual_protect 0 // full screen Y0093: [email protected] = integer [email protected] to_float0073: [email protected] /= [email protected] 006B: [email protected] *= [email protected] 0AB2: ret 2 [email protected] [email protected] :getLocalVarOffset{ Parameters: Passed: [email protected] - thread pointer (offset) Result: [email protected] - var pointer (offset) Example: 0AB1: call_scm_func @getLocalVarOffset 1 var 0 store_to [email protected] }0A9F: [email protected] = [email protected] *= 0x4 0A8E: [email protected] = [email protected] + 0xDC // mission flagif [email protected] == 1 then [email protected] += 0xA48960 else 005A: [email protected] += [email protected] [email protected] += 0x3C end0AB2: ret 1 [email protected] This script is deprecated. Find the updated version here. Edited April 6, 2013 by Wesser 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
TheSiggi Posted April 1, 2011 Share Posted April 1, 2011 Says enough Quite a nasty piece of work you managed over there. I'm impressed. I knew that guy was almighty, just didn't get he meant you. Thanks a lot, the script looks marvelous. Link to comment Share on other sites More sharing options...
Silent Posted April 1, 2011 Share Posted April 1, 2011 Pure awesoness, good work on function calls. Are you half-Russian or what? Link to comment Share on other sites More sharing options...
Wesser Posted April 1, 2011 Share Posted April 1, 2011 Thanks. I'm glad for your appreciations! Quite a nasty piece of work you managed over there. I'm impressed. I knew that guy was almighty, just didn't get he meant you. Thanks a lot! Great representation! Are you half-Russian or what? Maybe, but I'm just the only italian who makes such "difficult" (depending on the knowledges of who interprets the script) modifications. 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
Adler Posted April 1, 2011 Share Posted April 1, 2011 Script doesn't work for me. April Fools! Awesome work Wesser! You never cease to amaze me. Link to comment Share on other sites More sharing options...
Deji Posted April 2, 2011 Share Posted April 2, 2011 Ah, so now I can have the onscreen 3D interactivity I always dreamed of Thanks for all the work, Wesser. 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