-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.lua2p
218 lines (188 loc) · 4.72 KB
/
main.lua2p
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
--[[
Project: Going Home: Revisited
(2017 - 2030)
By: flamendless studio @flam8studio
Author: Brandon Blanker Lim-it @flamendless
Artist: Conrad Reyes @Shizzy619
Room Designer: Piolo Maurice Laudencia @piotato
Start Date: Tue Mar 17 18:42:00 PST 2020
--]]
!if _DEV then
love.filesystem.setRequirePath(love.filesystem.getRequirePath() .. ";modules/?.lua")
require("jit.p").start("lz")
!end
require("modules.batteries"):export()
!if _PROF then
PROF_CAPTURE = true
JPROF = require("modules.jprof.jprof")
!end
local Flux = require("modules.flux.flux")
local Lily = require("modules.lily.lily")
local Log = require("modules.log.log")
Log.lovesave = true
require("modules.sdf").mount()
local Timer = require("modules.hump.timer")
local TLE = require("modules.tle.timeline")
local Audio = require("audio")
local Config = require("config")
local ErrorHandler = require("error_handler")
love.errhand = ErrorHandler.callback
local GameStates = require("gamestates")
local Info = require("info")
local Inputs = require("inputs")
local LoadingScreen = require("loading_screen")
local Save = require("save")
local Settings = require("settings")
local Shaders = require("shaders")
Shaders.load_shaders()
local WindowMode = require("window_mode")
!if _DEV then
require("modules.strict")
local DevTools = require("devtools")
local font = love.graphics.newFont("res/fonts/Jamboree.ttf", 32)
font:setFilter($_FONT_FILTER, $_FONT_FILTER)
!end
function love.load()
@@profb("frame")
@@profb("love.load")
Log.info("Starting... Game Version:", Config.this_version)
Log.info(!("Commit: " .. _COMMIT_VERSION))
love.math.setRandomSeed(love.timer.getTime())
love.graphics.setDefaultFilter($_DEFAULT_FILTER, $_DEFAULT_FILTER)
local modules = {
WindowMode,
Shaders,
LoadingScreen,
Info,
Save,
Settings,
Audio,
Inputs,
}
for _, module in ipairs(modules) do
module.init()
end
TLE.Attach()
!if _DEV then
-- GameStates.switch("Splash")
-- GameStates.switch("Menu")
-- GameStates.switch("Intro")
-- GameStates.switch("Outside")
-- GameStates.switch("StorageRoom")
-- GameStates.switch("UtilityRoom")
-- GameStates.switch("Kitchen")
GameStates.switch("LivingRoom")
DevTools.init()
Shaders.NGrading.dev_init()
!else
GameStates.switch("Splash")
!end
@@profe("love.load")
@@profe("frame")
end
function love.update(dt)
@@profb("love.update")
!if _DEV then
if DevTools.pause then return end
!end
Timer.update(dt)
Flux.update(dt)
GameStates.update(dt)
Inputs.update()
if not GameStates.is_ready then
LoadingScreen.update(dt)
end
!if _DEV then
DevTools.update(dt)
!end
@@profe("love.update")
end
function love.draw()
@@profb("love.draw")
love.graphics.setColor(1, 1, 1, 1)
GameStates.draw()
if not GameStates.is_ready then
LoadingScreen.draw()
end
!if _DEV then
DevTools.draw()
love.graphics.setColor(1, 0, 0, 1)
if DevTools.show_fps then
love.graphics.setFont(font)
love.graphics.print(love.timer.getFPS())
love.graphics.print($_MODE, love.graphics.getWidth() - font:getWidth($_MODE))
end
if DevTools.pause then
local ww, wh = love.graphics.getDimensions()
love.graphics.setFont(font)
love.graphics.printf("PAUSED", 0, wh * 0.5, ww, "center")
end
DevTools.end_draw()
!end
@@profe("love.draw")
end
function love.quit()
Lily.quit()
Log.info("Quitting...")
!if not _DEV and _LOG_SAVE then
Log.quit($_LOG_OUTPUT)
!end
!if _PROF then
JPROF.popAll()
JPROF.write("prof.mpack")
!end
end
function love.run()
if love.load then love.load(love.arg.parseGameArguments(arg), arg) end
if love.timer then love.timer.step() end
local dt = 0
-- Main loop time.
return function()
-- Process events.
@@profb("frame")
@@profb("love.run")
if love.event then
@@profb("love.event")
love.event.pump()
for name, a,b,c,d,e,f in love.event.poll() do
@@profb(name)
if name == "quit" then
if not love.quit or not love.quit() then
return a or 0
end
end
love.handlers[name](a, b, c, d, e, f)
--EVENTS/CALLBACKS
!if _DEV then
if DevTools[name] then
DevTools[name](a, b, c, d, e, f)
end
!end
if Inputs[name] then
Inputs[name](a, b, c, d, e, f)
end
if GameStates[name] then
GameStates[name](a, b, c, d, e, f)
end
--END EVENTS/CALLBACKS
@@profe(name)
end
@@profe("love.event")
end
if love.timer then dt = love.timer.step() end
if love.update then love.update(dt) end
if love.graphics and love.graphics.isActive() then
love.graphics.origin()
love.graphics.clear(love.graphics.getBackgroundColor())
if love.draw then love.draw() end
@@profb("present")
love.graphics.present()
@@profe("present")
end
@@profb("sleep")
if love.timer then love.timer.sleep(0.001) end
@@profe("sleep")
@@profe("love.run")
@@profe("frame")
end
end