Quantcast

Jump to content

» «
Photo

[SA] Field of View related questions

5 replies to this topic
aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#1

Posted 19 May 2013 - 12:53 PM

So, I'm trying to make sniper have slightly better zoom options, and first thing I'd need is the normal Field of View that is used when player is on foot.

I know I could check it while player is on foot and using opcode 0801, but it just doesn't seem right to me for some reason, is it wise to use it like I described?

And, when setting new FoV while aiming sniper, opcode 0922 doesn't seem the best option to use as I'd need to use "restore_camera" after aiming, to skip the zoom-out.

Any tips on those two?

_DK
  • _DK

    Homie

  • Feroci Racing
  • Joined: 12 Apr 2009
  • Ukraine

#2

Posted 19 May 2013 - 03:32 PM

I have some code to control FOV (H - enable/disable, J,K - increase/decrease).
CODE
{$CLEO}

const
   VK_J = 74
   VK_K = 75
   VK_H = 72
   FOV = 0@
   TIMERA = 32@
   TIMEINFO = 2000
end

TIMERA = TIMEINFO
while true
   wait 0
   // check if player enabled FOV mode
   if
       0AB0: key_pressed VK_H
   then
       while 0AB0: key_pressed VK_H
           wait 0
       end
       // enable FOV mode
       0A8C: write_memory 0x6FF410 size 1 value 0xC3 virtual_protect 1
       0ACD: show_text_highpriority "FOV mode enabled" time TIMEINFO
       0A8D: FOV = read_memory 0x8D5038 size 4 virtual_protect 0
       while true
           wait 0
           // check if player disabled FOV mode
           if
               0AB0: key_pressed VK_H
           then
               while 0AB0: key_pressed VK_H
                   wait 0
               end
               // disable FOV mode
               0A8C: write_memory 0x6FF410 size 1 value 0x8B virtual_protect 1
               0ACD: show_text_highpriority "FOV mode disabled" time TIMEINFO
               break
           end
           if
               0AB0: key_pressed VK_J
           then
               FOV += 0.5
               TIMERA = 0
               0a8c: write_memory 0x8D5038 size 4 value FOV virtual_protect 0
           else
               if
                   0AB0: key_pressed VK_K
               then
                   FOV -= 0.5
                   TIMERA = 0
                   0a8c: write_memory 0x8D5038 size 4 value FOV virtual_protect 0
               end
           end
           if
               TIMERA < TIMEINFO
           then
               0AD1: show_formatted_text_highpriority "FOV: %.2f" time 100 FOV
           end
       end
   end
end

aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#3

Posted 19 May 2013 - 06:12 PM

Alright, thanks, but what does these two do?

CODE
0A8C: write_memory 0x6FF410 size 1 value 0xC3 virtual_protect 1

And
CODE
0A8C: write_memory 0x6FF410 size 1 value 0x8B virtual_protect 1

_DK
  • _DK

    Homie

  • Feroci Racing
  • Joined: 12 Apr 2009
  • Ukraine

#4

Posted 19 May 2013 - 06:40 PM

Blocking/unblocking CDraw::SetFOV function. Means game couldn't manipulate it (only you could).

aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#5

Posted 19 May 2013 - 08:23 PM

Okay, got it, thanks! smile.gif

But next question(s):

Using opcode 00E1 to check if player is pressing Zoom in/out key doesn't seem to work, ID's 5 and 7 should be for next weapon/zoom in and previous weapon/zoom out. None of those work. Changing ID's to 10 and 11, conversation yes/no, seems to work though. What's the problem, is SannyBuilder help wrong or is the problem with opcode itself?

And, when using low FoV in first person, like when aiming with sniper rifle, isn't smooth. What I mean, when using, let's say, field of view of 7.0, makes the aiming hard as the camera "jumps", for example when you set mouse sensitivity to lowest, and try to move the camera really slowly, it jumps over, like the aiming is made with a grid. Can't explain further, if you don't understand I'll just make a video.

EDIT: This old video of my shows the second problem quite well.

aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#6

Posted 27 May 2013 - 12:21 AM

Still searching for answers. smile.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users