-
Notifications
You must be signed in to change notification settings - Fork 0
/
launch
242 lines (216 loc) · 3.77 KB
/
launch
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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
package.cpath=package.cpath..';.\\?.dll'
require("lfs")
require("zip")
dofile("version")
for k,v in pairs(lstg) do _G[k]=v end
UnitList=ObjList
GetnUnit=GetnObj
function Serialize(o)
if type(o)=='number' then
return tostring(o)
elseif type(o)=='string' then
return string.format('%q',o)
elseif type(o)=='boolean' then
return tostring(o)
elseif type(o)=='nil' then
return 'nil'
elseif type(o)=='table' then
if getmetatable(o) and getmetatable(o).data then o=getmetatable(o).data end
local r='{'
for k,v in pairs(o) do
if type(k)=='number' then k='['..k..']'
elseif type(k)=='string' then k=string.format('[%q]',k)
else error('cannot serialize a ' .. type(k)..' key')
end
r=r..k..'='..Serialize(v)..','
end
return r..'}'
else
error('cannot serialize a ' .. type(o))
end
end
function DeSerialize(s)
return assert(loadstring('return '..s))()
end
KEY={NULL=0x00}
KEY.LBUTTON=0x01
KEY.RBUTTON=0x02
KEY.MBUTTON=0x04
KEY.ESCAPE=0x1B
KEY.BACKSPACE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x69
KEY.MULTIPLY=0x6A
KEY.DIVIDE=0x6F
KEY.ADD=0x6B
KEY.SUBTRACT=0x6D
KEY.DECIMAL=0x6E
KEY.F1=0x70
KEY.F2=0x71
KEY.F3=0x72
KEY.F4=0x73
KEY.F5=0x74
KEY.F6=0x75
KEY.F7=0x76
KEY.F8=0x77
KEY.F9=0x78
KEY.F10=0x79
KEY.F11=0x7A
KEY.F12=0x7B
CHARSET_ANSI=0
CHARSET_DEFAULT=1
CHARSET_SYMBOL=2
CHARSET_BALTIC=186
CHARSET_CHINESEBIG5=136
CHARSET_EASTEUROPE=238
CHARSET_GB2312=134
CHARSET_GREEK=161
CHARSET_HANGUL=129
CHARSET_MAC=77
CHARSET_OEM=255
CHARSET_RUSSIAN=204
CHARSET_SHIFTJIS=128
CHARSET_TURKISH=162
CHARSET_VIETNAMESE=163
default_setting=
{
allowsnapshot=true,
username='User',
charset=CHARSET_DEFAULT,
font='',
timezone=8,
resx=1024,
resy=768,
windowed=false,
vsync=true,
sevolume=100,
bgmvolume=100,
keys={
up=KEY.UP,
down=KEY.DOWN,
left=KEY.LEFT,
right=KEY.RIGHT,
slow=KEY.SHIFT,
shoot=KEY.Z,
spell=KEY.X,
special=KEY.SPACE,
},
keysys={
repfast=KEY.CTRL,
repslow=KEY.SHIFT,
menu=KEY.ESCAPE,
snapshot=KEY.HOME,
},
}
do
local f,msg
f,msg=io.open('setting','r')
if f==nil then
setting=DeSerialize(Serialize(default_setting))
else
setting=DeSerialize(f:read('*a'))
f:close()
end
end
if #arg>=2 then loadstring(arg[2])() end
if not start_game then
setting.mod='launcher'
setting.resx=480
setting.resy=640
setting.windowed=true
setting.nosplash=true
setting.allowsnapshot=false
end
if updatelib then
lfs.chdir('data')
os.execute('..\\zip -r -u ..\\data.zip .\\*')
lfs.chdir('..\\')
end
LoadPack('data.zip')
LoadPack('mod\\'..setting.mod..'.zip')
SetSplash(false)
SetTitle(setting.mod)
SetWindowed(setting.windowed)
SetResolution(setting.resx,setting.resy)
SetFPS(60)
SetVsync((not setting.windowed) and setting.vsync)
SetSEVolume(setting.sevolume)
SetBGMVolume(setting.bgmvolume)