Last active
April 24, 2021 15:42
-
-
Save vinevi/46ede82296096e1c6b09a2b8b099e1b2 to your computer and use it in GitHub Desktop.
MM6 - MMExtension - Camera Zoom (outdoor only)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local fovManager = { | |
FOV = 170, | |
increment = 4, | |
timer = nil | |
} | |
fovManager.update = function(self) | |
local hexFOV = '0x' .. bit.tohex(self.FOV); | |
mem.asmpatch(0x004789f5, 'AND EAX, ' .. hexFOV); | |
mem.call(0x004582cd) | |
Game.ShowStatusText('FOV updated: ' .. self.FOV) | |
end | |
fovManager.add = function(self) | |
self:to( self.FOV - self.increment ) | |
end | |
fovManager.substract = function(self) | |
self:to( self.FOV + self.increment ) | |
end | |
fovManager.set = function(self, value) | |
self.FOV = math.min(math.max(value, 10), 300) | |
self:update() | |
end | |
fovManager.to = function(self, value) | |
RemoveTimer(self.timer) | |
local increment = self.increment | |
local forward = value > self.FOV | |
self.timer = function() | |
local newFOV = self.FOV | |
if(forward == true) then | |
newFOV = newFOV + self.increment | |
if(newFOV > value) then | |
newFOV = value | |
end | |
else | |
newFOV = newFOV - self.increment | |
if(newFOV < value) then | |
newFOV = value | |
end | |
end | |
self:set( newFOV ) | |
if(newFOV == value) then | |
RemoveTimer(self.timer) | |
end | |
end | |
Timer(self.timer, const.Second) | |
end | |
fovManager.raiseTextureQualityDistance = function(self) | |
-- low distance | |
mem.asmpatch( 0x004581f1, [[ | |
MOV ESI,0x2000 | |
]] ) | |
-- medium distance | |
mem.asmpatch( 0x004581dd, [[ | |
MOV EDX,0x3000 | |
]] ) | |
-- high distance | |
mem.asmpatch( 0x004581e2, [[ | |
MOV ECX,0x4000 | |
]] ) | |
end | |
fovManager.init = function(self) | |
function Keys.P(t) | |
self:add() | |
end | |
function Keys.O(t) | |
self:substract() | |
end | |
function Keys.L(t) | |
self:to(60) | |
end | |
function Keys.K(t) | |
self:to(170) | |
end | |
function Keys.J(t) | |
self:to(220) | |
end | |
self:raiseTextureQualityDistance() | |
end | |
fovManager:init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment