-
Notifications
You must be signed in to change notification settings - Fork 0
/
Temporarily Disable Anti-Alias.lua
116 lines (93 loc) · 3.87 KB
/
Temporarily Disable Anti-Alias.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
--[[
Script to temporarily disable anti-aliasing for a specific song.
Compatible with:
* 0.6.x
* 0.7.x
* VS FNAF 3's modified 0.6.2 variant.
Script by AutisticLulu.
]]
-- #####################################################################
-- [[ Variables ]]
-- #####################################################################
-- Enables the script
local scriptEnabled = false
local debugEnabled = false
-- Variables to save the user's original settings [DO NOT MODIFY THIS]
local originalGlobalAA = nil
local originalHudAA = nil
-- #####################################################################
-- [[ Custom Functions ]]
-- #####################################################################
-- Function to restore the user's original anti-alias settings
local function revertAntialiasing()
if not scriptEnabled then return end
if not originalGlobalAA then return end
-- VS FNaF 3 Specific
if stringStartsWith(version, '0.6.2 (Modified)') then
setPropertyFromClass('ClientPrefs', 'globalAntialiasing', originalGlobalAA)
setPropertyFromClass('ClientPrefs', 'hudAntialiasing', originalHudAA)
-- Any Psych Engine 0.6 version
elseif stringStartsWith(version, '0.6') then
setPropertyFromClass('ClientPrefs', 'globalAntialiasing', originalGlobalAA)
-- Any Psych Engine 0.7 version
elseif stringStartsWith(version, '0.7') then
setPropertyFromClass('backend.ClientPrefs', 'data.antialiasing', originalGlobalAA)
end
if debugEnabled then
debugPrint('!! Reverting to saved user settings !!')
end
end
-- Function to disable anti-aliasing temporarily
local function disableAntialiasing()
if not scriptEnabled then return end
-- VS FNaF 3 Specific
if stringStartsWith(version, '0.6.2 (Modified)') then
setPropertyFromClass('ClientPrefs', 'globalAntialiasing', false)
setPropertyFromClass('ClientPrefs', 'hudAntialiasing', false)
-- Any Psych Engine 0.6 version
elseif stringStartsWith(version, '0.6') then
setPropertyFromClass('ClientPrefs', 'globalAntialiasing', false)
-- Any Psych Engine 0.7 version
elseif stringStartsWith(version, '0.7') then
setPropertyFromClass('backend.ClientPrefs', 'data.antialiasing', false)
end
if debugEnabled then
debugPrint('!! Turning off anti-alias temporarily !!')
end
end
-- Function to retrieve and save user's current settings
local function getAntialiasSettings()
if not scriptEnabled then return end
if stringStartsWith(version, '0.6.2 (Modified)') then
originalGlobalAA = getPropertyFromClass('ClientPrefs', 'globalAntialiasing')
originalHudAA = getPropertyFromClass('ClientPrefs', 'hudAntialiasing')
if debugEnabled then
debugPrint('!! Saved user settings !!', 'Sprite Anti-Aliasing: ' .. originalGlobalAA, 'HUD Anti-Aliasing: ' .. originalHudAA)
end
elseif stringStartsWith(version, '0.6') then
originalGlobalAA = getPropertyFromClass('ClientPrefs', 'globalAntialiasing')
if debugEnabled then
debugPrint('!! Saved user settings !!', 'Anti-Aliasing: ' .. originalGlobalAA)
end
elseif stringStartsWith(version, '0.7') then
originalGlobalAA = getPropertyFromClass('backend.ClientPrefs', 'data.antialiasing')
if debugEnabled then
debugPrint('!! Saved user settings !!', 'Anti-Aliasing: ' .. originalGlobalAA)
end
end
end
-- #####################################################################
-- [[ Bind our local functions to Psych Engine events ]]
-- #####################################################################
function onCreate()
getAntialiasSettings()
end
-- Might be able to change this to onCreatePost() instead.
-- onSongStart is however guaranteed to work.
function onSongStart()
disableAntialiasing()
end
-- Change this to onDestroy() if the settings doesnt revert as intended. (Usually if cutscenes are used after song)
function onSongEnd()
revertAntialiasing()
end