SA-MP Forums

Go Back   SA-MP Forums > SA-MP > Bug Reports

Reply
 
Thread Tools Display Modes
Old 30/12/2015, 11:32 AM   #1
sprtik
Big Clucker
 
sprtik's Avatar
 
Join Date: Feb 2013
Posts: 192
Reputation: 66
Default GetPlayerCameraAspectRatio inaccurate

Using GetPlayerCameraAspectRatio on my game results in 1.333333, while my resolution is 1280x1024, clearly 1.25. Why is that?
sprtik is offline   Reply With Quote
Old 03/01/2016, 11:03 PM   #2
DRIFT_HUNTER
High-roller
 
Join Date: Oct 2009
Posts: 2,103
Reputation: 126
Default Re: GetPlayerCameraAspectRatio inaccurate

GetPlayerCameraAspectRatio is actually to detect if player has widescreen turned on. 1.333 i think means its not on. When i say widescreen i mean option for graphics (the one you setup in main menu of GTA)
__________________
Путин here,
Путин there,
Путин просто everywhere.


Any PM's that include question about any kind of help will be ignored.
Use appropriate boards for that
DRIFT_HUNTER is offline   Reply With Quote
Old 04/01/2016, 12:41 AM   #3
Crayder
High-roller
 
Crayder's Avatar
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,870
Reputation: 560
Default Re: GetPlayerCameraAspectRatio inaccurate

Quote:
Originally Posted by DRIFT_HUNTER View Post
GetPlayerCameraAspectRatio is actually to detect if player has widescreen turned on. 1.333 i think means its not on. When i say widescreen i mean option for graphics (the one you setup in main menu of GTA)
No. Not exactly. It CAN be used to detect widescreen, but that is NOT what is is made for.

@OP: My laptop is 1280x1024 too, and I'm pretty sure it returns 1.25 for me. It must be something to do with your settings and such.
__________________
Those who deserve reputation, do not need to beg for it.
Also, don't expect the help you need when offering reputation, you'll just be attracting Rep Hunters.
Join SA-MP Discord!
Crayder is offline   Reply With Quote
Old 04/01/2016, 03:04 AM   #4
RoboN1X
Huge Clucker
 
RoboN1X's Avatar
 
Join Date: Feb 2011
Location: Indonesia
Posts: 256
Reputation: 54
Default Re: GetPlayerCameraAspectRatio inaccurate

I tried this,
640x480 = 1.333333 (lowest)
720x480 = 1.333333 (incorrect)
720x576 = 1.333333 (incorrect)
800x600 = 1.333333
1024x768 = 1.333333
1152x864 = 1.333333
1280x720 = 1.333333
1280x800 = 1.333333 (incorrect)
1280x960 = 1.333333
1280x1024 = 1.333333 (max, incorrect)
The values are same, but when i enable widescreen it's changed to: 1.776470

I'm not sure, either it returns the lowest value available in option (640x480 = 1.333333 = 4:3), or the most ones (4:3),
instead of max/native resolution for my display (1280x1024 = 1.25 = 5:4)
__________________
Need Help? Use Search, WIKI, and FAQ
RoboN1X is offline   Reply With Quote
Old 04/01/2016, 04:15 AM   #5
Crayder
High-roller
 
Crayder's Avatar
 
Join Date: Sep 2013
Location: Flames of Hell
Posts: 3,870
Reputation: 560
Default Re: GetPlayerCameraAspectRatio inaccurate

That's definitely weird. Before I know it worked, I had used it on multiple monitors at every resolution I could when I was testing the ScreenToWorld include improvements.
__________________
Those who deserve reputation, do not need to beg for it.
Also, don't expect the help you need when offering reputation, you'll just be attracting Rep Hunters.
Join SA-MP Discord!
Crayder is offline   Reply With Quote
Old 18/12/2016, 09:57 AM   #6
sprtik
Big Clucker
 
sprtik's Avatar
 
Join Date: Feb 2013
Posts: 192
Reputation: 66
Default Re: GetPlayerCameraAspectRatio inaccurate

I've done some minor research, and I have found three possibilities for the return value:
  • 4:3 (1.3333334, Float:0x3FAAAAAB) - this is returned for the majority of players, when the "widescreen" option in the display settings is turned off, possibly incorrectly when they actually have a widescreen display.
  • 5:4 (1.2470589, Float:0x3F9F9FA0) - this value is returned when the letterbox mode is turned on, like via YSF's TogglePlayerWidescreen.
  • 16:9 (1.7764707, Float:0x3FE36364) - this value is returned in all cases when the "widescreen" option is turned on.
As you can see, it cannot be used to accurately detect the aspect ratio of the player's screen. However, it seems the value actually represents something close to the player's field of view, as shown by IDA:

Code:
v6 = (double)*(_BYTE *)(v4 + 30) * 0.0039215689 + 1.0;
Reversing the conversion, the actual values obtained from the player are 85, 63 and 198 respectively, for the above cases. It's not an actual field of view angle, but it does represent how large the player's field of view is.
__________________
Mostly known as IllidanS4.
•  i_lstr.inc  •
• i_colors.inc •
• i_quat.inc •
• i_errors.inc •
• i_pvars.inc •
• YSF •

kingsofsa.cz:8888

Last edited by sprtik; 31/01/2017 at 03:18 PM.
sprtik is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with floatstr (inaccurate value) gangsta15 Scripting Help 3 11/05/2012 05:18 PM
Player text draws inaccurate Hanger Scripting Help 0 10/04/2012 03:35 PM


All times are GMT. The time now is 02:02 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.