Go で書き直した Ikemen
Revision | 0132d66580f9c76ac8af6ab41fef17c962f3f4ed (tree) |
---|---|
Zeit | 2020-01-15 01:44:06 |
Autor | neatunsou <sisiy4excite@gmai...> |
Commiter | neatunsou |
K4thos氏の更新に合流
変更点が多いので注意
@@ -10,4 +10,6 @@ go get -u github.com/faiface/beep | ||
10 | 10 | go get -u github.com/hajimehoshi/oto |
11 | 11 | go get -u github.com/hajimehoshi/go-mp3 |
12 | 12 | go get -u github.com/pkg/errors |
13 | -go get -u github.com/jfreymuth/oggvorbis | |
\ No newline at end of file | ||
13 | +go get -u github.com/jfreymuth/oggvorbis | |
14 | +go get -u github.com/kbinani/screenshot | |
15 | +go get -u github.com/sqweek/dialog | |
\ No newline at end of file |
@@ -1,29 +1,30 @@ | ||
1 | -------------------------------------------------------------- | |
2 | --- Disable GC during the initial load so it does not crash. | |
1 | +--;=========================================================== | |
2 | +--; INITIALIZE DATA | |
3 | +--;=========================================================== | |
4 | +--Disable GC during the initial load so it does not crash | |
3 | 5 | SetGCPercent(-1) |
4 | -------------------------------------------------------------- | |
6 | + | |
7 | +--nClock = os.clock() | |
8 | +--print("Elapsed time: " .. os.clock() - nClock) | |
9 | + | |
5 | 10 | main = {} |
6 | 11 | |
7 | 12 | refresh() |
8 | 13 | math.randomseed(os.time()) |
9 | 14 | |
10 | ---;=========================================================== | |
11 | ---; COMMON SECTION | |
12 | ---;=========================================================== | |
13 | - | |
14 | 15 | --One-time load of the json routines |
15 | 16 | json = (loadfile 'script/dkjson.lua')() |
16 | 17 | |
17 | --- Data loading from config.json | |
18 | +--Data loading from config.json | |
18 | 19 | local file = io.open("save/config.json","r") |
19 | 20 | config = json.decode(file:read("*all")) |
20 | 21 | file:close() |
21 | 22 | |
23 | +--Input stuff | |
22 | 24 | main.p1In = 1 |
23 | 25 | main.p2In = 2 |
24 | 26 | --main.inputDialog = inputDialogNew() |
25 | 27 | |
26 | -------------------------------------------------------------- | |
27 | 28 | function main.f_setCommand(c) |
28 | 29 | commandAdd(c, 'u', '$U') |
29 | 30 | commandAdd(c, 'd', '$D') |
@@ -49,6 +50,15 @@ main.f_setCommand(main.p1Cmd) | ||
49 | 50 | main.p2Cmd = commandNew() |
50 | 51 | main.f_setCommand(main.p2Cmd) |
51 | 52 | |
53 | +main.p3Cmd = commandNew() | |
54 | +main.f_setCommand(main.p3Cmd) | |
55 | + | |
56 | +main.p4Cmd = commandNew() | |
57 | +main.f_setCommand(main.p4Cmd) | |
58 | + | |
59 | +--;=========================================================== | |
60 | +--; COMMON FUNCTIONS | |
61 | +--;=========================================================== | |
52 | 62 | function main.f_cmdInput() |
53 | 63 | commandInput(main.p1Cmd, main.p1In) |
54 | 64 | commandInput(main.p2Cmd, main.p2In) |
@@ -69,96 +79,6 @@ function main.f_btnPalNo(cmd) | ||
69 | 79 | return 0 |
70 | 80 | end |
71 | 81 | |
72 | --- Check if files exists. | |
73 | -function main.file_exists(name) | |
74 | - local f=io.open(name,"r") | |
75 | - if f~=nil then io.close(f) return true else return false end | |
76 | -end | |
77 | - | |
78 | ---prints "t" table content into "toFile" file | |
79 | -function main.f_printTable(t, toFile) | |
80 | - local toFile = toFile or 'debug/table_print.txt' | |
81 | - local txt = '' | |
82 | - local print_t_cache = {} | |
83 | - local function sub_print_t(t, indent) | |
84 | - if print_t_cache[tostring(t)] then | |
85 | - txt = txt .. indent .. '*' .. tostring(t) .. '\n' | |
86 | - else | |
87 | - print_t_cache[tostring(t)] = true | |
88 | - if type(t) == 'table' then | |
89 | - for pos, val in pairs(t) do | |
90 | - if type(val) == 'table' then | |
91 | - txt = txt .. indent .. '[' .. pos .. '] => ' .. tostring(t) .. ' {' .. '\n' | |
92 | - sub_print_t(val, indent .. string.rep(' ', string.len(tostring(pos)) + 8)) | |
93 | - txt = txt .. indent .. string.rep(' ', string.len(tostring(pos)) + 6) .. '}' .. '\n' | |
94 | - elseif type(val) == 'string' then | |
95 | - txt = txt .. indent .. '[' .. pos .. '] => "' .. val .. '"' .. '\n' | |
96 | - else | |
97 | - txt = txt .. indent .. '[' .. pos .. '] => ' .. tostring(val) ..'\n' | |
98 | - end | |
99 | - end | |
100 | - else | |
101 | - txt = txt .. indent .. tostring(t) .. '\n' | |
102 | - end | |
103 | - end | |
104 | - end | |
105 | - if type(t) == 'table' then | |
106 | - txt = txt .. tostring(t) .. ' {' .. '\n' | |
107 | - sub_print_t(t, ' ') | |
108 | - txt = txt .. '}' .. '\n' | |
109 | - else | |
110 | - sub_print_t(t, ' ') | |
111 | - end | |
112 | - local file = io.open(toFile,"w+") | |
113 | - if file == nil then return end | |
114 | - file:write(txt) | |
115 | - file:close() | |
116 | -end | |
117 | - | |
118 | --- Prints "v" variable into "toFile" file | |
119 | -function main.f_printVar(v, toFile) | |
120 | - local toFile = toFile or 'debug/var_print.txt' | |
121 | - local file = io.open(toFile,"w+") | |
122 | - file:write(v) | |
123 | - file:close() | |
124 | -end | |
125 | - | |
126 | --- Split strings. | |
127 | -function main.f_strsplit(delimiter, text) | |
128 | - local list = {} | |
129 | - local pos = 1 | |
130 | - if string.find('', delimiter, 1) then | |
131 | - if string.len(text) == 0 then | |
132 | - table.insert(list, text) | |
133 | - else | |
134 | - for i = 1, string.len(text) do | |
135 | - table.insert(list, string.sub(text, i, i)) | |
136 | - end | |
137 | - end | |
138 | - else | |
139 | - while true do | |
140 | - local first, last = string.find(text, delimiter, pos) | |
141 | - if first then | |
142 | - table.insert(list, string.sub(text, pos, first - 1)) | |
143 | - pos = last + 1 | |
144 | - else | |
145 | - table.insert(list, string.sub(text, pos)) | |
146 | - break | |
147 | - end | |
148 | - end | |
149 | - end | |
150 | - return list | |
151 | -end | |
152 | - | |
153 | -------------------------------------------------------------- | |
154 | --- Int localcoord | |
155 | -require "script/screenpack" | |
156 | -main.IntLocalcoordValues() | |
157 | -main.CalculateLocalcoordValues() | |
158 | -main.IntLifebarScale() | |
159 | -main.SetScaleValues() | |
160 | -------------------------------------------------------------- | |
161 | - | |
162 | 82 | --animDraw at specified coordinates |
163 | 83 | function main.f_animPosDraw(a, x, y) |
164 | 84 | animSetPos(a, x, y) |
@@ -176,16 +96,14 @@ function main.f_textImgPosDraw(ti, x, y, align) | ||
176 | 96 | end |
177 | 97 | |
178 | 98 | --shortcut for creating new text with several parameters |
179 | -function main.f_createTextImg(font, bank, align, text, x, y, scaleX, scaleY, colorR, colorG, colorB) | |
99 | +function main.f_createTextImg(font, bank, align, text, x, y, scaleX, scaleY, r, g, b, src, dst) | |
180 | 100 | local ti = textImgNew() |
181 | 101 | if font ~= nil then |
182 | 102 | textImgSetFont(ti, font) |
183 | 103 | textImgSetBank(ti, bank) |
184 | 104 | textImgSetAlign(ti, align) |
185 | 105 | textImgSetText(ti, text) |
186 | - if colorR ~= nil and colorG ~= nil and colorB ~= nil then | |
187 | - textImgSetColor(ti, colorR, colorG, colorB) | |
188 | - end | |
106 | + textImgSetColor(ti, r, g, b, src, dst) | |
189 | 107 | if align == -1 then x = x + 1 end --fix for wrong offset after flipping text |
190 | 108 | textImgSetPos(ti, x, y) |
191 | 109 | textImgSetScale(ti, scaleX, scaleY) |
@@ -194,20 +112,18 @@ function main.f_createTextImg(font, bank, align, text, x, y, scaleX, scaleY, col | ||
194 | 112 | end |
195 | 113 | |
196 | 114 | --shortcut for updating text with several parameters |
197 | -function main.f_updateTextImg(animName, font, bank, align, text, x, y, scaleX, scaleY, colorR, colorG, colorB) | |
115 | +function main.f_updateTextImg(ti, font, bank, align, text, x, y, scaleX, scaleY, r, g, b, src, dst) | |
198 | 116 | if font ~= nil then |
199 | - textImgSetFont(animName, font) | |
200 | - textImgSetBank(animName, bank) | |
201 | - textImgSetAlign(animName, align) | |
202 | - textImgSetText(animName, text) | |
203 | - if colorR ~= nil and colorG ~= nil and colorB ~= nil then | |
204 | - textImgSetColor(animName, colorR, colorG, colorB) | |
205 | - end | |
117 | + textImgSetFont(ti, font) | |
118 | + textImgSetBank(ti, bank) | |
119 | + textImgSetAlign(ti, align) | |
120 | + textImgSetText(ti, text) | |
121 | + textImgSetColor(ti, r, g, b, src, dst) | |
206 | 122 | if align == -1 then x = x + 1 end --fix for wrong offset after flipping text |
207 | - textImgSetPos(animName, x, y) | |
208 | - textImgSetScale(animName, scaleX, scaleY) | |
123 | + textImgSetPos(ti, x, y) | |
124 | + textImgSetScale(ti, scaleX, scaleY) | |
209 | 125 | end |
210 | - return animName | |
126 | + return ti | |
211 | 127 | end |
212 | 128 | |
213 | 129 | --dynamically adjusts alpha blending each time called based on specified values |
@@ -215,7 +131,7 @@ local alpha1cur = 0 | ||
215 | 131 | local alpha2cur = 0 |
216 | 132 | local alpha1add = true |
217 | 133 | local alpha2add = true |
218 | -function main.f_dynamicAlpha(animName, r1min, r1max, r1step, r2min, r2max, r2step) | |
134 | +function main.f_boxcursorAlpha(r1min, r1max, r1step, r2min, r2max, r2step) | |
219 | 135 | if r1step == 0 then alpha1cur = r1max end |
220 | 136 | if alpha1cur < r1max and alpha1add then |
221 | 137 | alpha1cur = alpha1cur + r1step |
@@ -240,55 +156,7 @@ function main.f_dynamicAlpha(animName, r1min, r1max, r1step, r2min, r2max, r2ste | ||
240 | 156 | alpha2add = true |
241 | 157 | end |
242 | 158 | end |
243 | - animSetAlpha(animName, alpha1cur, alpha2cur) | |
244 | -end | |
245 | - | |
246 | ---generate fading animation | |
247 | ---currently only black when average of RGB <= 128 and white if >128 colors supported | |
248 | -function main.f_fadeAnim(fadeType, ticks, r, g, b) | |
249 | - local anim = '' | |
250 | - if (r + g + b)/3 > 128 then --white | |
251 | - if fadeType == 0 then --fadeout | |
252 | - for i = 1, ticks do | |
253 | - anim = anim .. '0,1, 0,0, 1, 0, AS' .. math.floor(256 / ticks * i) .. 'D256\n' | |
254 | - end | |
255 | - anim = anim .. '0,1, 0,0, -1, 0, AS256D256' | |
256 | - elseif fadeType == 1 then --fadein | |
257 | - for i = ticks, 1, -1 do | |
258 | - anim = anim .. '0,1, 0,0, 1, 0, AS' .. math.floor(256 / ticks * i) .. 'D256\n' | |
259 | - end | |
260 | - anim = anim .. '0,1, 0,0, -1, 0, AS0D256' | |
261 | - end | |
262 | - else --black | |
263 | - if fadeType == 0 then --fadeout | |
264 | - for i = ticks, 1, -1 do | |
265 | - anim = anim .. '0,0, 0,0, 1, 0, AS256D' .. math.floor(256 / ticks * i) .. '\n' | |
266 | - end | |
267 | - anim = anim .. '0,0, 0,0, -1, 0, AS256D0' | |
268 | - elseif fadeType == 1 then --fadein | |
269 | - for i = 1, ticks do | |
270 | - anim = anim .. '0,0, 0,0, 1, 0, AS256D' .. math.floor(256 / ticks * i) .. '\n' | |
271 | - end | |
272 | - anim = anim .. '0,0, 0,0, -1, 0, AS256D256' | |
273 | - end | |
274 | - end | |
275 | - anim = animNew(main.fadeSff, anim) | |
276 | - animUpdate(anim) | |
277 | - return anim, ticks | |
278 | -end | |
279 | - | |
280 | ---generate clearcolor animation | |
281 | ---currently only black when average of RGB <= 128 and white if >128 colors supported | |
282 | -function main.f_clearColor(r, g, b) | |
283 | - local anim = '' | |
284 | - if (r + g + b)/3 > 128 then | |
285 | - anim = '0,1, 0,0, -1' --white | |
286 | - else | |
287 | - anim = '0,0, 0,0, -1' --black | |
288 | - end | |
289 | - anim = animNew(main.fadeSff, anim) | |
290 | - animUpdate(anim) | |
291 | - return anim | |
159 | + return alpha1cur, alpha2cur | |
292 | 160 | end |
293 | 161 | |
294 | 162 | --generate anim from table |
@@ -305,7 +173,7 @@ function main.f_animFromTable(t, sff, x, y, scaleX, scaleY, facing, infFrame) | ||
305 | 173 | for i = 1, #t do |
306 | 174 | local t_anim = {} |
307 | 175 | for j, c in ipairs(main.f_strsplit(',', t[i])) do --split using "," delimiter |
308 | - t_anim[#t_anim + 1] = c | |
176 | + table.insert(t_anim, c) | |
309 | 177 | end |
310 | 178 | if #t_anim > 1 then |
311 | 179 | --required parameters |
@@ -341,15 +209,28 @@ end | ||
341 | 209 | --Convert number to name and get rid of the "" |
342 | 210 | function main.f_getName(cell) |
343 | 211 | local tmp = getCharName(cell) |
344 | - tmp = tmp:gsub('^["%s]*(.-)["%s]*$', '%1') --needed for s-size ikemen | |
345 | 212 | if main.t_selChars[cell + 1].hidden == 3 then |
346 | 213 | tmp = 'Random' |
347 | - elseif main.t_selChars[cell + 1].hidden == 2 or main.t_selChars[cell + 1].hidden == 1 then | |
214 | + elseif main.t_selChars[cell + 1].hidden == 2 then | |
348 | 215 | tmp = '' |
349 | 216 | end |
350 | 217 | return tmp |
351 | 218 | end |
352 | 219 | |
220 | +--copy table content into new table | |
221 | +function main.f_copyTable(t) | |
222 | + t = t or {} | |
223 | + local t2 = {} | |
224 | + for k, v in pairs(t) do | |
225 | + if type(v) == "table" then | |
226 | + t2[k] = main.f_copyTable(v) | |
227 | + else | |
228 | + t2[k] = v | |
229 | + end | |
230 | + end | |
231 | + return t2 | |
232 | +end | |
233 | + | |
353 | 234 | --randomizes table content |
354 | 235 | function main.f_shuffleTable(t) |
355 | 236 | local rand = math.random |
@@ -374,7 +255,7 @@ end | ||
374 | 255 | function main.f_sortKeys(t, order) |
375 | 256 | -- collect the keys |
376 | 257 | local keys = {} |
377 | - for k in pairs(t) do keys[#keys + 1] = k end | |
258 | + for k in pairs(t) do table.insert(keys, k) end | |
378 | 259 | -- if order function given, sort it by passing the table and keys a, b, |
379 | 260 | -- otherwise just sort the keys |
380 | 261 | if order then |
@@ -392,12 +273,60 @@ function main.f_sortKeys(t, order) | ||
392 | 273 | end |
393 | 274 | end |
394 | 275 | |
276 | +--prints "t" table content into "toFile" file | |
277 | +function main.f_printTable(t, toFile) | |
278 | + local toFile = toFile or 'debug/table_print.txt' | |
279 | + local txt = '' | |
280 | + local print_t_cache = {} | |
281 | + local function sub_print_t(t, indent) | |
282 | + if print_t_cache[tostring(t)] then | |
283 | + txt = txt .. indent .. '*' .. tostring(t) .. '\n' | |
284 | + else | |
285 | + print_t_cache[tostring(t)] = true | |
286 | + if type(t) == 'table' then | |
287 | + for pos, val in pairs(t) do | |
288 | + if type(val) == 'table' then | |
289 | + txt = txt .. indent .. '[' .. pos .. '] => ' .. tostring(t) .. ' {' .. '\n' | |
290 | + sub_print_t(val, indent .. string.rep(' ', string.len(tostring(pos)) + 8)) | |
291 | + txt = txt .. indent .. string.rep(' ', string.len(tostring(pos)) + 6) .. '}' .. '\n' | |
292 | + elseif type(val) == 'string' then | |
293 | + txt = txt .. indent .. '[' .. pos .. '] => "' .. val .. '"' .. '\n' | |
294 | + else | |
295 | + txt = txt .. indent .. '[' .. pos .. '] => ' .. tostring(val) ..'\n' | |
296 | + end | |
297 | + end | |
298 | + else | |
299 | + txt = txt .. indent .. tostring(t) .. '\n' | |
300 | + end | |
301 | + end | |
302 | + end | |
303 | + if type(t) == 'table' then | |
304 | + txt = txt .. tostring(t) .. ' {' .. '\n' | |
305 | + sub_print_t(t, ' ') | |
306 | + txt = txt .. '}' .. '\n' | |
307 | + else | |
308 | + sub_print_t(t, ' ') | |
309 | + end | |
310 | + local file = io.open(toFile,"w+") | |
311 | + if file == nil then return end | |
312 | + file:write(txt) | |
313 | + file:close() | |
314 | +end | |
315 | + | |
316 | +--prints "v" variable into "toFile" file | |
317 | +function main.f_printVar(v, toFile) | |
318 | + local toFile = toFile or 'debug/var_print.txt' | |
319 | + local file = io.open(toFile,"w+") | |
320 | + file:write(v) | |
321 | + file:close() | |
322 | +end | |
323 | + | |
395 | 324 | --remove duplicated string pattern |
396 | 325 | function main.f_uniq(str, pattern, subpattern) |
397 | 326 | local out = {} |
398 | 327 | for s in str:gmatch(pattern) do |
399 | 328 | local s2 = s:match(subpattern) |
400 | - if not main.f_contains(out, s2) then out[#out + 1] = s end | |
329 | + if not main.f_contains(out, s2) then table.insert(out, s) end | |
401 | 330 | end |
402 | 331 | return table.concat(out) |
403 | 332 | end |
@@ -436,7 +365,7 @@ function main.f_textRender(data, str, counter, x, y, spacing, delay, limit) | ||
436 | 365 | local subEnd = math.floor(#str - (#str - counter / delay)) |
437 | 366 | local t = {} |
438 | 367 | for line in str:gmatch('([^\r\n]*)[\r\n]?') do |
439 | - t[#t + 1] = line | |
368 | + table.insert(t, line) | |
440 | 369 | end |
441 | 370 | local lengthCnt = 0 |
442 | 371 | for i = 1, #t do |
@@ -569,165 +498,6 @@ function main.f_strsplit(delimiter, text) | ||
569 | 498 | return list |
570 | 499 | end |
571 | 500 | |
572 | ---expand background table with background controllers data | |
573 | -function main.f_ctrlBG(t_bg, t_ctrl) | |
574 | - local t = {} | |
575 | - for k, v in pairs(t_ctrl) do | |
576 | - local t1 = t_ctrl[k].ctrl | |
577 | - for i = 1, #t1 do | |
578 | - for k2, v2 in pairs(t1[i].ctrlid) do | |
579 | - local t2 = t1[i].type | |
580 | - if t1[i].ctrlid[k2] == t_bg.id and t2 ~= 'null' then | |
581 | - if t[t2] == nil then | |
582 | - t[t2] = {} | |
583 | - end | |
584 | - t[t2][#t[t2] + 1] = {} | |
585 | - local t3 = t[t2][#t[t2]] | |
586 | - t3.time = {t1[i].time[1], t1[i].time[2], t1[i].time[3]} | |
587 | - t3.timer = {t1[i].time[1], t1[i].time[2], t1[i].time[3]} | |
588 | - if t2 == 'visible' or t2 == 'enable' or t2 == 'anim' or t2 == 'gamemode' then | |
589 | - t3.value = t1[i].value | |
590 | - elseif t2 == 'sinx' or t2 == 'siny' then | |
591 | - t3.value = {t1[i].value[1], t1[i].value[2], t1[i].value[3]} | |
592 | - elseif t2 == 'velset' or t2 == 'veladd' or t2 == 'posset' or t2 == 'posadd' then | |
593 | - if t1[i].x ~= nil then | |
594 | - t3.x = t1[i].x | |
595 | - end | |
596 | - if t1[i].y ~= nil then | |
597 | - t3.y = t1[i].y | |
598 | - end | |
599 | - end | |
600 | - end | |
601 | - end | |
602 | - end | |
603 | - end | |
604 | - return t | |
605 | -end | |
606 | - | |
607 | ---draw background layers | |
608 | -function main.f_drawBG(data, info, layerno, timer, localcoord) | |
609 | - timer = timer or 0 | |
610 | - --loop through all backgrounds | |
611 | - for i = 1, #data do | |
612 | - --skip if layerno is not matched | |
613 | - if info[i].layerno == layerno then | |
614 | - local x = 0 | |
615 | - local y = 0 | |
616 | - --loop through controllers | |
617 | - for k, v in pairs(info[i].ctrl) do | |
618 | - for j = 1, #info[i].ctrl[k] do | |
619 | - local t = info[i].ctrl[k][j] | |
620 | - --reset internal timer | |
621 | - if t.time[3] ~= -1 and timer >= t.timer[3] then | |
622 | - t.timer[1] = timer + t.time[1] | |
623 | - t.timer[2] = timer + t.time[2] | |
624 | - t.timer[3] = timer + t.time[3] | |
625 | - end | |
626 | - --check if time condition allows controller to run | |
627 | - if timer >= t.timer[1] and timer <= t.timer[2] then | |
628 | - x = 0 | |
629 | - y = 0 | |
630 | - if k == 'gamemode' then --Ikemen feature | |
631 | - for m = 1, #t.enabled do | |
632 | - info[i].ctrl_flags.enabled = 0 | |
633 | - if t.enabled[m] == main.gameMode then | |
634 | - info[i].ctrl_flags.enabled = 1 | |
635 | - m = #t.enabled | |
636 | - end | |
637 | - end | |
638 | - elseif k == 'visible' then | |
639 | - info[i].ctrl_flags.visible = t.value | |
640 | - elseif k == 'enable' then | |
641 | - info[i].ctrl_flags.enabled = t.value | |
642 | - elseif k == 'velset' or k == 'posset' then | |
643 | - if t.x ~= nil then | |
644 | - info[i].ctrl_flags.velx = 0 - info[i].velocity[1] + t.x * 320/localcoord[1] | |
645 | - end | |
646 | - if t.y ~= nil then | |
647 | - info[i].ctrl_flags.vely = 0 - info[i].velocity[2] + t.y * 240/localcoord[2] | |
648 | - end | |
649 | - elseif k == 'veladd' then --or k == 'posadd' then | |
650 | - if t.x ~= nil then | |
651 | - info[i].ctrl_flags.velx = info[i].ctrl_flags.velx + t.x * 320/localcoord[1] | |
652 | - end | |
653 | - if t.y ~= nil then | |
654 | - info[i].ctrl_flags.vely = info[i].ctrl_flags.vely + t.y * 240/localcoord[2] | |
655 | - end | |
656 | - elseif k == 'posadd' then | |
657 | - if t.x ~= nil then x = t.x * 320/localcoord[1] end | |
658 | - if t.y ~= nil then y = t.y * 240/localcoord[2] end | |
659 | - animAddPos(data[i], x, y) | |
660 | - --[[elseif k == 'posset' then | |
661 | - if t.x ~= nil then | |
662 | - x = t.x * 320/localcoord[1] | |
663 | - else | |
664 | - x = info[i].start[1] | |
665 | - end | |
666 | - if t.y ~= nil then | |
667 | - y = t.y * 240/localcoord[2] | |
668 | - else | |
669 | - y = info[i].start[2] | |
670 | - end | |
671 | - animSetPos(data[i], x, y) | |
672 | - animAddPos(data[i], 160, 0) --for some reason needed in ikemen | |
673 | - elseif k == 'posadd' then | |
674 | - if t.x ~= nil then x = t.x * 320/localcoord[1] end | |
675 | - if t.y ~= nil then y = t.y * 240/localcoord[2] end | |
676 | - animAddPos(data[i], x, y)]] | |
677 | - --elseif k == 'anim' then --not supported yet | |
678 | - --elseif k == 'sinx' then --not supported yet | |
679 | - --elseif k == 'siny' then --not supported yet | |
680 | - end | |
681 | - end | |
682 | - end | |
683 | - end | |
684 | - --animation | |
685 | - if info[i].ctrl_flags.enabled == 1 then | |
686 | - x = (info[i].ctrl_flags.velx + info[i].velocity[1]) * info[i].delta[1] | |
687 | - y = (info[i].ctrl_flags.vely + info[i].velocity[2]) * info[i].delta[2] | |
688 | - info[i].ctrl_flags.x = info[i].ctrl_flags.x + x | |
689 | - info[i].ctrl_flags.y = info[i].ctrl_flags.y + y | |
690 | - animAddPos(data[i], x, y) | |
691 | - animUpdate(data[i]) | |
692 | - if info[i].ctrl_flags.visible == 1 then | |
693 | - animDraw(data[i]) | |
694 | - end | |
695 | - end | |
696 | - end | |
697 | - end | |
698 | -end | |
699 | - | |
700 | ---reset screenpack data | |
701 | -function main.f_resetBG(info, bgdef, bgm, bgmLoop, bgmVolume, bgmloopstart, bgmloopend) | |
702 | - bgm = bgm or nil | |
703 | - animReset(info.fadein_data) | |
704 | - animUpdate(info.fadein_data) | |
705 | - animReset(info.fadeout_data) | |
706 | - animUpdate(info.fadeout_data) | |
707 | - bgdef.timer = 0 | |
708 | - for i = 1, #bgdef.bg do | |
709 | - bgdef.bg[i].ctrl_flags.visible = 1 | |
710 | - bgdef.bg[i].ctrl_flags.enabled = 1 | |
711 | - bgdef.bg[i].ctrl_flags.velx = 0 | |
712 | - bgdef.bg[i].ctrl_flags.vely = 0 | |
713 | - animReset(bgdef.bg_data[i]) | |
714 | - animAddPos(bgdef.bg_data[i], 0 - bgdef.bg[i].ctrl_flags.x, 0 - bgdef.bg[i].ctrl_flags.y) | |
715 | - animUpdate(bgdef.bg_data[i]) | |
716 | - bgdef.bg[i].ctrl_flags.x = 0 | |
717 | - bgdef.bg[i].ctrl_flags.y = 0 | |
718 | - for k, v in pairs(bgdef.bg[i].ctrl) do | |
719 | - for j = 1, #bgdef.bg[i].ctrl[k] do | |
720 | - bgdef.bg[i].ctrl[k][j].timer[1] = bgdef.bg[i].ctrl[k][j].time[1] | |
721 | - bgdef.bg[i].ctrl[k][j].timer[2] = bgdef.bg[i].ctrl[k][j].time[2] | |
722 | - bgdef.bg[i].ctrl[k][j].timer[3] = bgdef.bg[i].ctrl[k][j].time[3] | |
723 | - end | |
724 | - end | |
725 | - end | |
726 | - if bgm ~= nil then | |
727 | - playBGM(bgm, true, bgmLoop, bgmVolume, bgmloopstart or "0", bgmloopend or "0") | |
728 | - end | |
729 | -end | |
730 | - | |
731 | 501 | --return table with reversed keys |
732 | 502 | function main.f_reversedTable(t) |
733 | 503 | local reversedTable = {} |
@@ -738,38 +508,60 @@ function main.f_reversedTable(t) | ||
738 | 508 | return reversedTable |
739 | 509 | end |
740 | 510 | |
741 | ---return table without rows disabled in screenpack | |
742 | -function main.f_cleanTable(t) | |
511 | +--return table with proper order and without rows disabled in screenpack | |
512 | +function main.f_cleanTable(t, t_sort) | |
743 | 513 | local t_clean = {} |
514 | + local t_added = {} | |
515 | + --first we add all entries existing in screenpack file in correct order | |
516 | + for i = 1, #t_sort do | |
517 | + for j = 1, #t do | |
518 | + if t_sort[i] == t[j].itemname and t[j].displayname ~= '' then | |
519 | + table.insert(t_clean, t[j]) | |
520 | + t_added[t[j].itemname] = 1 | |
521 | + break | |
522 | + end | |
523 | + end | |
524 | + end | |
525 | + --then we add remaining default entries if not existing yet and not disabled (by default or via screenpack) | |
744 | 526 | for i = 1, #t do |
745 | - if t[i].displayname ~= '' then | |
746 | - t_clean[#t_clean + 1] = t[i] | |
527 | + if t_added[t[i].itemname] == nil and t[i].displayname ~= '' then | |
528 | + table.insert(t_clean, t[i]) | |
747 | 529 | end |
748 | 530 | end |
749 | 531 | return t_clean |
750 | 532 | end |
751 | 533 | |
534 | +--odd value rounding | |
535 | +function main.f_oddRounding(v) | |
536 | + if v % 2 ~= 0 then | |
537 | + return 1 | |
538 | + else | |
539 | + return 0 | |
540 | + end | |
541 | +end | |
542 | + | |
752 | 543 | --warning display |
753 | 544 | local txt_warning = textImgNew() |
754 | -function main.f_warning(t, info, background, font_info, title, box) | |
545 | +function main.f_warning(t, info, background, font_info, title, coords, col, alpha) | |
755 | 546 | font_info = font_info or motif.warning_info |
756 | 547 | title = title or main.txt_warningTitle |
757 | - box = box or main.warningBox | |
548 | + coords = coords or motif.warning_info.boxbg_coords | |
549 | + col = col or motif.warning_info.boxbg_col | |
550 | + alpha = alpha or motif.warning_info.boxbg_alpha | |
758 | 551 | main.f_cmdInput() |
759 | - box = box or false | |
760 | 552 | while true do |
761 | 553 | if main.f_btnPalNo(main.p1Cmd) > 0 or esc() then |
762 | 554 | sndPlay(motif.files.snd_data, info.cursor_move_snd[1], info.cursor_move_snd[2]) |
763 | 555 | break |
764 | 556 | end |
765 | 557 | --draw clearcolor |
766 | - animDraw(background.bgclearcolor_data) | |
558 | + clearColor(background.bgclearcolor[1], background.bgclearcolor[2], background.bgclearcolor[3]) | |
767 | 559 | --draw layerno = 0 backgrounds |
768 | - main.f_drawBG(background.bg_data, background.bg, 0, background.timer, {320,240}) | |
560 | + bgDraw(background.bg, false) | |
769 | 561 | --draw layerno = 1 backgrounds |
770 | - main.f_drawBG(background.bg_data, background.bg, 1, background.timer, {320,240}) | |
562 | + bgDraw(background.bg, true) | |
771 | 563 | --draw menu box |
772 | - animDraw(box) | |
564 | + fillRect(coords[1], coords[2], coords[3] - coords[1] + 1, coords[4] - coords[2] + 1, col[1], col[2], col[3], alpha[1], alpha[2]) | |
773 | 565 | --draw title |
774 | 566 | textImgDraw(title) |
775 | 567 | --draw text |
@@ -786,12 +578,12 @@ function main.f_warning(t, info, background, font_info, title, box) | ||
786 | 578 | font_info.text_font_scale[2], |
787 | 579 | font_info.text_font[4], |
788 | 580 | font_info.text_font[5], |
789 | - font_info.text_font[6] | |
581 | + font_info.text_font[6], | |
582 | + font_info.text_font[7], | |
583 | + font_info.text_font[8] | |
790 | 584 | ) |
791 | 585 | textImgDraw(txt_warning) |
792 | 586 | end |
793 | - --update timer | |
794 | - background.timer = background.timer + 1 | |
795 | 587 | --end loop |
796 | 588 | main.f_cmdInput() |
797 | 589 | refresh() |
@@ -800,25 +592,47 @@ end | ||
800 | 592 | |
801 | 593 | --input display |
802 | 594 | local txt_input = textImgNew() |
803 | -function main.f_input(t, info, background, type) | |
595 | +function main.f_input(t, info, background, category, controllerNo, keyBreak) | |
804 | 596 | main.f_cmdInput() |
805 | - type = type or 'string' | |
806 | - if type == 'string' then | |
807 | - t[#t + 1] = '' | |
597 | + category = category or 'string' | |
598 | + controllerNo = controllerNo or 0 | |
599 | + keyBreak = keyBreak or '' | |
600 | + if category == 'string' then | |
601 | + table.insert(t, '') | |
808 | 602 | end |
809 | 603 | local input = '' |
604 | + local btnReleased = 0 | |
810 | 605 | resetKey() |
811 | 606 | while true do |
812 | 607 | if esc() then |
813 | 608 | input = '' |
814 | 609 | break |
815 | 610 | end |
816 | - if type == 'key' then | |
611 | + if category == 'keyboard' then | |
817 | 612 | input = getKey() |
818 | 613 | if input ~= '' then |
819 | 614 | main.f_cmdInput() |
820 | 615 | break |
821 | 616 | end |
617 | + elseif category == 'gamepad' then | |
618 | + if getJoystickPresent(controllerNo) == false then | |
619 | + break | |
620 | + end | |
621 | + if getKey() == keyBreak then | |
622 | + input = keyBreak | |
623 | + break | |
624 | + end | |
625 | + local tmp = getKey() | |
626 | + if tonumber(tmp) == nil then --button released | |
627 | + if btnReleased == 0 then | |
628 | + btnReleased = 1 | |
629 | + elseif btnReleased == 2 then | |
630 | + break | |
631 | + end | |
632 | + elseif btnReleased == 1 then --button pressed after releasing button once | |
633 | + input = tmp | |
634 | + btnReleased = 2 | |
635 | + end | |
822 | 636 | else --string |
823 | 637 | if getKey() == 'RETURN' then |
824 | 638 | main.f_cmdInput() |
@@ -832,33 +646,43 @@ function main.f_input(t, info, background, type) | ||
832 | 646 | resetKey() |
833 | 647 | end |
834 | 648 | --draw clearcolor |
835 | - animDraw(background.bgclearcolor_data) | |
649 | + clearColor(background.bgclearcolor[1], background.bgclearcolor[2], background.bgclearcolor[3]) | |
836 | 650 | --draw layerno = 0 backgrounds |
837 | - main.f_drawBG(background.bg_data, background.bg, 0, background.timer, {320,240}) | |
651 | + bgDraw(background.bg, false) | |
838 | 652 | --draw layerno = 1 backgrounds |
839 | - main.f_drawBG(background.bg_data, background.bg, 1, background.timer, {320,240}) | |
653 | + bgDraw(background.bg, true) | |
840 | 654 | --draw menu box |
841 | - animDraw(main.warningBox) | |
655 | + fillRect( | |
656 | + motif.infobox.boxbg_coords[1], | |
657 | + motif.infobox.boxbg_coords[2], | |
658 | + motif.infobox.boxbg_coords[3] - motif.infobox.boxbg_coords[1] + 1, | |
659 | + motif.infobox.boxbg_coords[4] - motif.infobox.boxbg_coords[2] + 1, | |
660 | + motif.infobox.boxbg_col[1], | |
661 | + motif.infobox.boxbg_col[2], | |
662 | + motif.infobox.boxbg_col[3], | |
663 | + motif.infobox.boxbg_alpha[1], | |
664 | + motif.infobox.boxbg_alpha[2] | |
665 | + ) | |
842 | 666 | --draw text |
843 | 667 | for i = 1, #t do |
844 | 668 | main.f_updateTextImg( |
845 | 669 | txt_input, |
846 | - motif.font_data[motif.warning_info.text_font[1]], | |
847 | - motif.warning_info.text_font[2], | |
848 | - motif.warning_info.text_font[3], | |
670 | + motif.font_data[motif.infobox.text_font[1]], | |
671 | + motif.infobox.text_font[2], | |
672 | + motif.infobox.text_font[3], | |
849 | 673 | t[i], |
850 | - motif.warning_info.text_pos[1], | |
851 | - motif.warning_info.text_pos[2] - motif.warning_info.text_spacing[2] + i * motif.warning_info.text_spacing[2], | |
852 | - motif.warning_info.text_font_scale[1], | |
853 | - motif.warning_info.text_font_scale[2], | |
854 | - motif.warning_info.text_font[4], | |
855 | - motif.warning_info.text_font[5], | |
856 | - motif.warning_info.text_font[6] | |
674 | + motif.infobox.text_pos[1], | |
675 | + motif.infobox.text_pos[2] - motif.infobox.text_spacing[2] + i * motif.infobox.text_spacing[2], | |
676 | + motif.infobox.text_font_scale[1], | |
677 | + motif.infobox.text_font_scale[2], | |
678 | + motif.infobox.text_font[4], | |
679 | + motif.infobox.text_font[5], | |
680 | + motif.infobox.text_font[6], | |
681 | + motif.infobox.text_font[7], | |
682 | + motif.infobox.text_font[8] | |
857 | 683 | ) |
858 | 684 | textImgDraw(txt_input) |
859 | 685 | end |
860 | - --update timer | |
861 | - background.timer = background.timer + 1 | |
862 | 686 | --end loop |
863 | 687 | main.f_cmdInput() |
864 | 688 | refresh() |
@@ -866,6 +690,7 @@ function main.f_input(t, info, background, type) | ||
866 | 690 | return input |
867 | 691 | end |
868 | 692 | |
693 | +--refresh screen every 0.02 during initial loading | |
869 | 694 | main.nextRefresh = os.clock() + 0.02 |
870 | 695 | function main.loadingRefresh(txt) |
871 | 696 | if os.clock() >= main.nextRefresh then |
@@ -878,21 +703,33 @@ function main.loadingRefresh(txt) | ||
878 | 703 | end |
879 | 704 | |
880 | 705 | --;=========================================================== |
706 | +--; LOCALCOORD | |
707 | +--;=========================================================== | |
708 | +require('script.screenpack') | |
709 | +main.IntLocalcoordValues() | |
710 | +main.CalculateLocalcoordValues() | |
711 | +main.IntLifebarScale() | |
712 | +main.SetScaleValues() | |
713 | + | |
714 | +--;=========================================================== | |
881 | 715 | --; COMMAND LINE QUICK VS |
882 | 716 | --;=========================================================== |
883 | 717 | main.flags = getCommandLineFlags() |
884 | 718 | if main.flags['-p1'] ~= nil and main.flags['-p2'] ~= nil then |
885 | 719 | --load lifebar |
886 | - local sp = config.Motif | |
720 | + local def = config.Motif | |
887 | 721 | if main.flags['-r'] ~= nil then |
888 | - if main.f_fileExists(main.flags['-r']) then | |
889 | - sp = main.flags['-r'] | |
722 | + local case = main.flags['-r']:lower() | |
723 | + if case:match('^data[/\\]') and main.f_fileExists(main.flags['-r']) then | |
724 | + def = main.flags['-r'] | |
725 | + elseif case:match('%.def$') and main.f_fileExists('data/' .. main.flags['-r']) then | |
726 | + def = 'data/' .. main.flags['-r'] | |
890 | 727 | elseif main.f_fileExists('data/' .. main.flags['-r'] .. '/system.def') then |
891 | - sp = 'data/' .. main.flags['-r'] .. '/system.def' | |
728 | + def = 'data/' .. main.flags['-r'] .. '/system.def' | |
892 | 729 | end |
893 | 730 | end |
894 | - local fileDir = sp:match('^(.-)[^/\\]+$') | |
895 | - local file = io.open(sp,"r") | |
731 | + local fileDir = def:match('^(.-)[^/\\]+$') | |
732 | + local file = io.open(def,"r") | |
896 | 733 | local s = file:read("*all") |
897 | 734 | file:close() |
898 | 735 | local lifebar = s:match('fight%s*=%s*(.-%.def)%s*') |
@@ -906,6 +743,16 @@ if main.flags['-p1'] ~= nil and main.flags['-p2'] ~= nil then | ||
906 | 743 | loadLifebar('data/fight.def') |
907 | 744 | end |
908 | 745 | refresh() |
746 | + --set settings | |
747 | + setAutoguard(1, config.AutoGuard) | |
748 | + setAutoguard(2, config.AutoGuard) | |
749 | + setPowerShare(1, config.TeamPowerShare) | |
750 | + setPowerShare(2, config.TeamPowerShare) | |
751 | + setLifeShare(config.TeamLifeShare) | |
752 | + setRoundTime(math.max(-1, config.RoundTime * getFramesPerCount())) | |
753 | + setLifeMul(config.LifeMul / 100) | |
754 | + setTeam1VS2Life(config.Team1VS2Life / 100) | |
755 | + setTurnsRecoveryRate(config.TurnsRecoveryBase / 100, config.TurnsRecoveryBonus / 100) | |
909 | 756 | --add chars |
910 | 757 | local p1NumChars = 0 |
911 | 758 | local p2NumChars = 0 |
@@ -923,14 +770,36 @@ if main.flags['-p1'] ~= nil and main.flags['-p2'] ~= nil then | ||
923 | 770 | end |
924 | 771 | local pal = 1 |
925 | 772 | if main.flags['-p' .. num .. '.pal'] ~= nil then |
926 | - pal = main.flags['-p' .. num .. '.pal'] | |
773 | + pal = tonumber(main.flags['-p' .. num .. '.pal']) | |
927 | 774 | end |
928 | 775 | local ai = 0 |
929 | 776 | if main.flags['-p' .. num .. '.ai'] ~= nil then |
930 | - ai = main.flags['-p' .. num .. '.ai'] | |
777 | + ai = tonumber(main.flags['-p' .. num .. '.ai']) | |
778 | + end | |
779 | + table.insert(t, {character = v, player = player, num = num, pal = pal, ai = ai, overwrite = {}}) | |
780 | + if main.flags['-p' .. num .. '.power'] ~= nil then | |
781 | + t[#t].overwrite['power'] = tonumber(main.flags['-p' .. num .. '.power']) | |
782 | + end | |
783 | + if main.flags['-p' .. num .. '.life'] ~= nil then | |
784 | + t[#t].overwrite['life'] = tonumber(main.flags['-p' .. num .. '.life']) | |
785 | + end | |
786 | + if main.flags['-p' .. num .. '.lifeMax'] ~= nil then | |
787 | + t[#t].overwrite['lifeMax'] = tonumber(main.flags['-p' .. num .. '.lifeMax']) | |
788 | + end | |
789 | + if main.flags['-p' .. num .. '.lifeRatio'] ~= nil then | |
790 | + t[#t].overwrite['lifeRatio'] = tonumber(main.flags['-p' .. num .. '.lifeRatio']) | |
791 | + end | |
792 | + if main.flags['-p' .. num .. '.attackRatio'] ~= nil then | |
793 | + t[#t].overwrite['attackRatio'] = tonumber(main.flags['-p' .. num .. '.attackRatio']) | |
794 | + end | |
795 | + if main.flags['-p' .. num .. '.defenceRatio'] ~= nil then | |
796 | + t[#t].overwrite['defenceRatio'] = tonumber(main.flags['-p' .. num .. '.defenceRatio']) | |
931 | 797 | end |
932 | - t[#t + 1] = {player = player, num = num - 1, pal = tonumber(pal), ai = tonumber(ai)} | |
933 | 798 | refresh() |
799 | + elseif k:match('^-rounds$') then | |
800 | + setMatchWins(tonumber(v)) | |
801 | + elseif k:match('^-draws$') then | |
802 | + setMatchMaxDrawGames(tonumber(v)) | |
934 | 803 | end |
935 | 804 | end |
936 | 805 | local p1TeamMode = 0 |
@@ -952,17 +821,20 @@ if main.flags['-p1'] ~= nil and main.flags['-p2'] ~= nil then | ||
952 | 821 | end |
953 | 822 | addStage(stage) |
954 | 823 | --load data |
955 | - loadDebugFont('font/f-6x9.fnt') | |
824 | + loadDebugFont('f-6x9.fnt') | |
956 | 825 | setDebugScript('script/debug.lua') |
957 | - setMatchNo(1) | |
958 | 826 | selectStart() |
827 | + setMatchNo(1) | |
959 | 828 | setStage(0) |
960 | 829 | selectStage(0) |
961 | 830 | setTeamMode(1, p1TeamMode, p1NumChars) |
962 | 831 | setTeamMode(2, p2TeamMode, p2NumChars) |
963 | - for i = 1, #t do | |
964 | - selectChar(t[i].player, t[i].num, t[i].pal) | |
965 | - setCom(t[i].player, t[i].ai) | |
832 | + main.f_printTable(t, 'debug/t_quickvs.txt') | |
833 | + --iterate over the table in -p order ascending | |
834 | + for k, v in main.f_sortKeys(t, function(t, a, b) return t[b].num > t[a].num end) do | |
835 | + selectChar(v.player, k - 1, v.pal) | |
836 | + setCom(v.num, v.ai) | |
837 | + overwriteCharData(v.num, v.overwrite) | |
966 | 838 | end |
967 | 839 | local winner, t_gameStats = game() |
968 | 840 | if main.flags['-log'] ~= nil then |
@@ -975,31 +847,14 @@ end | ||
975 | 847 | --;=========================================================== |
976 | 848 | --; LOAD DATA |
977 | 849 | --;=========================================================== |
978 | -main.fadeSff = sffNew('data/fade.sff') | |
979 | - | |
980 | 850 | motif = require('script.motif') |
981 | 851 | |
852 | +setMotifDir(motif.fileDir) | |
982 | 853 | setPortrait(motif.select_info.p1_face_spr[1], motif.select_info.p1_face_spr[2], 1) --Big portrait |
983 | 854 | setPortrait(motif.select_info.portrait_spr[1], motif.select_info.portrait_spr[2], 2) --Small portrait |
984 | 855 | setPortrait(motif.vs_screen.p1_spr[1], motif.vs_screen.p1_spr[2], 3) --Versus portrait |
985 | 856 | setPortrait(motif.victory_screen.p1_spr[1], motif.victory_screen.p1_spr[2], 4) --Victory portrait |
986 | - | |
987 | -main.cursorBox = animNew(main.fadeSff, '0,1, 0,0, -1') | |
988 | -animSetTile(main.cursorBox, 1, 1) | |
989 | -animUpdate(main.cursorBox) | |
990 | - | |
991 | -main.warningBox = animNew(main.fadeSff, '0,0, 0,0, -1') | |
992 | -animSetTile(main.warningBox, 1, 1) | |
993 | -animSetAlpha(main.warningBox, motif.warning_info.background_alpha[1], motif.warning_info.background_alpha[2]) | |
994 | -animSetWindow(main.warningBox, 0, 0, motif.info.localcoord[1], motif.info.localcoord[2]) | |
995 | -animUpdate(main.warningBox) | |
996 | - | |
997 | -main.infoBox = animNew(main.fadeSff, '0,0, 0,0, -1') | |
998 | -animSetTile(main.infoBox, 1, 1) | |
999 | -animSetAlpha(main.infoBox, motif.infobox.background_alpha[1], motif.infobox.background_alpha[2]) | |
1000 | -animSetWindow(main.infoBox, 0, 0, motif.info.localcoord[1], motif.info.localcoord[2]) | |
1001 | -animUpdate(main.infoBox) | |
1002 | - | |
857 | +setPortrait(motif.select_info.stage_portrait_spr[1], motif.select_info.stage_portrait_spr[2], 5) --Stage portrait | |
1003 | 858 | |
1004 | 859 | main.txt_warningTitle = main.f_createTextImg( |
1005 | 860 | motif.font_data[motif.warning_info.title_font[1]], |
@@ -1012,25 +867,11 @@ main.txt_warningTitle = main.f_createTextImg( | ||
1012 | 867 | motif.warning_info.title_font_scale[2], |
1013 | 868 | motif.warning_info.title_font[4], |
1014 | 869 | motif.warning_info.title_font[5], |
1015 | - motif.warning_info.title_font[6] | |
870 | + motif.warning_info.title_font[6], | |
871 | + motif.warning_info.title_font[7], | |
872 | + motif.warning_info.title_font[8] | |
1016 | 873 | ) |
1017 | 874 | |
1018 | -main.SetDefaultScale() | |
1019 | - | |
1020 | -local footerBox = animNew(main.fadeSff, '0,2, 0,0, -1') | |
1021 | -animSetTile(footerBox, 1, 1) | |
1022 | -animSetWindow( | |
1023 | - footerBox, | |
1024 | - motif.title_info.footer_boxbackground_coords[1], | |
1025 | - motif.title_info.footer_boxbackground_coords[2], | |
1026 | - motif.title_info.footer_boxbackground_coords[3] - motif.title_info.footer_boxbackground_coords[1] + 1, | |
1027 | - motif.title_info.footer_boxbackground_coords[4] - motif.title_info.footer_boxbackground_coords[2] + 1 | |
1028 | -) | |
1029 | -animSetAlpha(footerBox, motif.title_info.footer_boxbackground_alpha[1], motif.title_info.footer_boxbackground_alpha[2]) | |
1030 | -animUpdate(footerBox) | |
1031 | - | |
1032 | -main.SetScaleValues() | |
1033 | - | |
1034 | 875 | --add characters and stages using select.def instead of select.lua |
1035 | 876 | local txt_loading = main.f_createTextImg( |
1036 | 877 | motif.font_data[motif.title_info.loading_font[1]], |
@@ -1043,101 +884,175 @@ local txt_loading = main.f_createTextImg( | ||
1043 | 884 | motif.title_info.loading_font_scale[2], |
1044 | 885 | motif.title_info.loading_font[4], |
1045 | 886 | motif.title_info.loading_font[5], |
1046 | - motif.title_info.loading_font[6] | |
887 | + motif.title_info.loading_font[6], | |
888 | + motif.title_info.loading_font[7], | |
889 | + motif.title_info.loading_font[8] | |
1047 | 890 | ) |
1048 | 891 | textImgDraw(txt_loading) |
1049 | 892 | refresh() |
1050 | 893 | |
1051 | -function main.f_addChar(line, row) | |
894 | +function main.f_charParam(t, c) | |
895 | + if c:match('music[al]?[li]?[tf]?[e]?%s*=') then --music / musicalt / musiclife | |
896 | + local bgmvolume, bgmloopstart, bgmloopend = 100, 0, 0 | |
897 | + c = c:gsub('%s+([0-9%s]+)$', function(m1) | |
898 | + for i, c in ipairs(main.f_strsplit('%s+', m1)) do --split using whitespace delimiter | |
899 | + if i == 1 then | |
900 | + bgmvolume = tonumber(c) | |
901 | + elseif i == 2 then | |
902 | + bgmloopstart = tonumber(c) | |
903 | + elseif i == 3 then | |
904 | + bgmloopend = tonumber(c) | |
905 | + else | |
906 | + break | |
907 | + end | |
908 | + end | |
909 | + return '' | |
910 | + end) | |
911 | + c = c:gsub('\\', '/') | |
912 | + local bgtype, bgmusic = c:match('^(music[al]?[li]?[tf]?[e]?)%s*=%s*(.-)%s*$') | |
913 | + if t[bgtype] == nil then t[bgtype] = {} end | |
914 | + table.insert(t[bgtype], {bgmusic = bgmusic, bgmvolume = bgmvolume, bgmloopstart = bgmloopstart, bgmloopend = bgmloopend}) | |
915 | + elseif c:match('lifebar%s*=') then --lifebar | |
916 | + if t.lifebar == nil then | |
917 | + t.lifebar = c:match('=%s*(.-)%s*$') | |
918 | + end | |
919 | + elseif c:match('[0-9]+%s*=%s*[^%s]') then --num = string (unused) | |
920 | + local var1, var2 = c:match('([0-9]+)%s*=%s*(.+)%s*$') | |
921 | + t[tonumber(var1)] = var2 | |
922 | + elseif c:match('%.[Dd][Ee][Ff]') or c:match('^random$') then --stage | |
923 | + c = c:gsub('\\', '/') | |
924 | + if t.stage == nil then | |
925 | + t.stage = {} | |
926 | + end | |
927 | + table.insert(t.stage, c) | |
928 | + else --param = value | |
929 | + local param, value = c:match('^(.-)%s*=%s*(.-)$') | |
930 | + if param ~= nil and value ~= nil and param ~= '' and value ~= '' then | |
931 | + t[param] = tonumber(value) | |
932 | + if t[param] == nil then | |
933 | + t[param] = value | |
934 | + end | |
935 | + end | |
936 | + end | |
937 | +end | |
938 | + | |
939 | +function main.f_addChar(line, row, playable) | |
1052 | 940 | local tmp = '' |
1053 | - local order = false | |
1054 | - local hidden = 0 | |
1055 | - for i, c in ipairs(main.f_strsplit(',', line)) do | |
941 | + main.t_selChars[row] = {} | |
942 | + --parse 'rivals' param and get rid of it if exists | |
943 | + for num, str in line:gmatch('([0-9]+)%s*=%s*{([^%}]-)}') do | |
944 | + num = tonumber(num) | |
945 | + if main.t_selChars[row].rivals == nil then | |
946 | + main.t_selChars[row].rivals = {} | |
947 | + end | |
948 | + for i, c in ipairs(main.f_strsplit(',', str)) do --split using "," delimiter | |
949 | + c = c:match('^%s*(.-)%s*$') | |
950 | + if i == 1 then | |
951 | + c = c:gsub('\\', '/') | |
952 | + c = tostring(c) | |
953 | + main.t_selChars[row].rivals[num] = {char = c} | |
954 | + else | |
955 | + main.f_charParam(main.t_selChars[row].rivals[num], c) | |
956 | + end | |
957 | + end | |
958 | + line = line:gsub(',%s*' .. num .. '%s*=%s*{([^%}]-)}', '') | |
959 | + end | |
960 | + --parse rest of the line | |
961 | + for i, c in ipairs(main.f_strsplit(',', line)) do --split using "," delimiter | |
1056 | 962 | c = c:match('^%s*(.-)%s*$') |
1057 | 963 | if i == 1 then |
1058 | 964 | c = c:gsub('\\', '/') |
1059 | 965 | c = tostring(c) |
1060 | - main.t_selChars[row] = {} | |
1061 | 966 | addChar(c) |
1062 | - tmp = getCharName(row - 1):match('^["%s]*(.-)["%s]*$') --needed for s-size ikemen | |
967 | + tmp = getCharName(row - 1) | |
1063 | 968 | if tmp == '' then |
969 | + playable = false | |
1064 | 970 | break |
1065 | 971 | end |
1066 | - main.t_charDef[c] = row - 1 | |
972 | + main.t_charDef[c:lower()] = row - 1 | |
1067 | 973 | main.t_selChars[row].char = c |
1068 | - if tmp ~= 'Random' then | |
1069 | - main.t_selChars[row].displayname = tmp | |
1070 | - main.t_selChars[row].def = getCharFileName(row - 1) | |
1071 | - main.t_selChars[row].dir = main.t_selChars[row].def:gsub('[^/]+%.def$', '') | |
1072 | - main.t_selChars[row].pal = getCharPalettes(row - 1) | |
1073 | - if tmp ~= 'Training' then | |
1074 | - tmp = getCharIntro(row - 1) | |
1075 | - if tmp ~= '' then | |
1076 | - main.t_selChars[row].intro = main.t_selChars[row].dir .. tmp:gsub('\\', '/') | |
1077 | - end | |
1078 | - tmp = getCharEnding(row - 1) | |
1079 | - if tmp ~= '' then | |
1080 | - main.t_selChars[row].ending = main.t_selChars[row].dir .. tmp:gsub('\\', '/') | |
1081 | - end | |
1082 | - main.t_selChars[row].order = 1 | |
1083 | - order = true | |
1084 | - end | |
1085 | - else | |
974 | + if tmp == 'Random' then | |
975 | + playable = false | |
1086 | 976 | break |
1087 | 977 | end |
1088 | - elseif c:match('music%s*=%s*') then | |
1089 | - c = c:gsub('\\', '/') | |
1090 | - local bgmvolume = c:match('%s([0-9]+)$') | |
1091 | - if bgmvolume == nil then | |
1092 | - bgmvolume = 100 | |
1093 | - else | |
1094 | - bgmvolume = tonumber(bgmvolume) | |
1095 | - c = c:gsub('%s*[0-9]+$','') | |
1096 | - end | |
1097 | - local bgmusic = c:match('^music%s*=%s*(.-)%s*$') | |
1098 | - if main.t_selChars[row].music == nil then | |
1099 | - main.t_selChars[row].music = {} | |
1100 | - end | |
1101 | - main.t_selChars[row].music[#main.t_selChars[row].music + 1] = {} | |
1102 | - main.t_selChars[row].music[#main.t_selChars[row].music].bgmusic = bgmusic | |
1103 | - main.t_selChars[row].music[#main.t_selChars[row].music].bgmvolume = bgmvolume | |
1104 | - elseif c:match('[0-9]+%s*=%s*[^%s]') then | |
1105 | - local var1, var2 = c:match('([0-9]+)%s*=%s*(.+)%s*$') | |
1106 | - main.t_selChars[row][tonumber(var1)] = var2:lower() | |
1107 | - elseif c:match('%.def') or c:match('^random$') then | |
1108 | - c = c:gsub('\\', '/') | |
1109 | - if main.t_selChars[row].stage == nil then | |
1110 | - main.t_selChars[row].stage = {} | |
978 | + main.t_selChars[row].playable = playable | |
979 | + main.t_selChars[row].displayname = tmp | |
980 | + main.t_selChars[row].def = getCharFileName(row - 1) | |
981 | + main.t_selChars[row].dir = main.t_selChars[row].def:gsub('[^/]+%.def$', '') | |
982 | + main.t_selChars[row].pal, main.t_selChars[row].pal_defaults, main.t_selChars[row].pal_keymap = getCharPalettes(row - 1) | |
983 | + if playable then | |
984 | + tmp = getCharIntro(row - 1) | |
985 | + if tmp ~= '' then | |
986 | + main.t_selChars[row].intro = main.t_selChars[row].dir .. tmp:gsub('\\', '/') | |
987 | + end | |
988 | + tmp = getCharEnding(row - 1) | |
989 | + if tmp ~= '' then | |
990 | + main.t_selChars[row].ending = main.t_selChars[row].dir .. tmp:gsub('\\', '/') | |
991 | + end | |
992 | + main.t_selChars[row].order = 1 | |
1111 | 993 | end |
1112 | - main.t_selChars[row].stage[#main.t_selChars[row].stage + 1] = c | |
1113 | 994 | else |
1114 | - local param, value = c:match('^(.-)%s*=%s*(.-)$') | |
1115 | - if param ~= '' and value ~= '' and param ~= nil and value ~= nil then | |
1116 | - main.t_selChars[row][param] = tonumber(value) | |
1117 | - end | |
995 | + main.f_charParam(main.t_selChars[row], c) | |
1118 | 996 | end |
1119 | 997 | end |
1120 | 998 | if main.t_selChars[row].hidden == nil then |
1121 | - main.t_selChars[row].hidden = hidden | |
1122 | - end | |
1123 | - if main.t_selChars[row].exclude == nil then | |
1124 | - main.t_selChars[row].exclude = 0 | |
999 | + main.t_selChars[row].hidden = 0 | |
1125 | 1000 | end |
1126 | - if order then | |
1001 | + if playable then | |
1002 | + --order param | |
1127 | 1003 | if main.t_orderChars[main.t_selChars[row].order] == nil then |
1128 | 1004 | main.t_orderChars[main.t_selChars[row].order] = {} |
1129 | 1005 | end |
1130 | - main.t_orderChars[main.t_selChars[row].order][#main.t_orderChars[main.t_selChars[row].order] + 1] = row - 1 | |
1006 | + table.insert(main.t_orderChars[main.t_selChars[row].order], row - 1) | |
1007 | + --ordersurvival param | |
1008 | + local num = 1 | |
1009 | + if main.t_selChars[row].ordersurvival ~= nil then | |
1010 | + num = main.t_selChars[row].ordersurvival | |
1011 | + end | |
1012 | + if main.t_orderSurvival[num] == nil then | |
1013 | + main.t_orderSurvival[num] = {} | |
1014 | + end | |
1015 | + table.insert(main.t_orderSurvival[num], row - 1) | |
1131 | 1016 | end |
1132 | 1017 | main.loadingRefresh(txt_loading) |
1133 | 1018 | end |
1134 | 1019 | |
1135 | ---start_time = os.time() | |
1136 | -main.t_includeStage = {} | |
1020 | +function main.f_addStage(file) | |
1021 | + file = file:gsub('\\', '/') | |
1022 | + --if not main.f_fileExists(file) or file:match('^stages/$') then | |
1023 | + -- return #main.t_selStages | |
1024 | + --end | |
1025 | + addStage(file) | |
1026 | + local stageNo = #main.t_selStages + 1 | |
1027 | + local tmp = getStageName(stageNo) | |
1028 | + --if tmp == '' then | |
1029 | + -- return stageNo | |
1030 | + --end | |
1031 | + main.t_stageDef[file:lower()] = stageNo | |
1032 | + main.t_selStages[stageNo] = {name = tmp, stage = file} | |
1033 | + local _, _, t_bgmusic = getStageInfo(stageNo) | |
1034 | + for k = 1, #t_bgmusic do | |
1035 | + if t_bgmusic[k].bgmusic ~= '' then | |
1036 | + if k == 1 then | |
1037 | + tmp = 'music' | |
1038 | + elseif k == 2 then | |
1039 | + tmp = 'musicalt' | |
1040 | + else | |
1041 | + tmp = 'musiclife' | |
1042 | + end | |
1043 | + main.t_selStages[stageNo][tmp] = {[1] = {bgmusic = t_bgmusic[k].bgmusic:gsub('\\', '/'), bgmvolume = t_bgmusic[k].bgmvolume, bgmloopstart = t_bgmusic[k].bgmloopstart, bgmloopend = t_bgmusic[k].bgmloopend}} | |
1044 | + end | |
1045 | + end | |
1046 | + return stageNo | |
1047 | +end | |
1048 | + | |
1049 | +main.t_includeStage = {{}, {}} --includestage = 1, includestage = -1 | |
1137 | 1050 | main.t_orderChars = {} |
1051 | +main.t_orderStages = {} | |
1052 | +main.t_orderSurvival = {} | |
1138 | 1053 | main.t_stageDef = {['random'] = 0} |
1139 | 1054 | main.t_charDef = {} |
1140 | -local t_exlude = {} | |
1055 | +local t_addExluded = {} | |
1141 | 1056 | local chars = 0 |
1142 | 1057 | local stages = 0 |
1143 | 1058 | local tmp = '' |
@@ -1149,20 +1064,20 @@ file:close() | ||
1149 | 1064 | content = content:gsub('([^\r\n;]*)%s*;[^\r\n]*', '%1') |
1150 | 1065 | content = content:gsub('\n%s*\n', '\n') |
1151 | 1066 | for line in content:gmatch('[^\r\n]+') do |
1067 | +--for line in io.lines("data/select.def") do | |
1152 | 1068 | if chars + stages == 100 then |
1153 | 1069 | SetGCPercent(100) |
1154 | 1070 | end |
1155 | ---for line in io.lines("data/select.def") do | |
1156 | - line = line:lower() | |
1157 | - if line:match('^%s*%[%s*characters%s*%]') then | |
1071 | + local lineCase = line:lower() | |
1072 | + if lineCase:match('^%s*%[%s*characters%s*%]') then | |
1158 | 1073 | main.t_selChars = {} |
1159 | 1074 | row = 0 |
1160 | 1075 | section = 1 |
1161 | - elseif line:match('^%s*%[%s*extrastages%s*%]') then | |
1076 | + elseif lineCase:match('^%s*%[%s*extrastages%s*%]') then | |
1162 | 1077 | main.t_selStages = {} |
1163 | 1078 | row = 0 |
1164 | 1079 | section = 2 |
1165 | - elseif line:match('^%s*%[%s*options%s*%]') then | |
1080 | + elseif lineCase:match('^%s*%[%s*options%s*%]') then | |
1166 | 1081 | main.t_selOptions = { |
1167 | 1082 | arcadestart = {wins = 0, offset = 0}, |
1168 | 1083 | arcadeend = {wins = 0, offset = 0}, |
@@ -1174,73 +1089,71 @@ for line in content:gmatch('[^\r\n]+') do | ||
1174 | 1089 | row = 0 |
1175 | 1090 | section = 3 |
1176 | 1091 | elseif section == 1 then --[Characters] |
1177 | - if line:match(',%s*exclude%s*=%s*1') then --character should be added after all slots are filled | |
1178 | - t_exlude[#t_exlude + 1] = line | |
1092 | + if lineCase:match(',%s*exclude%s*=%s*1') then --character should be added after all slots are filled | |
1093 | + table.insert(t_addExluded, line) | |
1179 | 1094 | else |
1180 | 1095 | chars = chars + 1 |
1181 | - main.f_addChar(line, chars) | |
1096 | + main.f_addChar(line, chars, true) | |
1182 | 1097 | end |
1183 | 1098 | elseif section == 2 then --[ExtraStages] |
1184 | - row = #main.t_selStages + 1 | |
1185 | - for i, c in ipairs(main.f_strsplit(',', line)) do | |
1099 | + for i, c in ipairs(main.f_strsplit(',', line)) do --split using "," delimiter | |
1186 | 1100 | c = c:gsub('^%s*(.-)%s*$', '%1') |
1187 | 1101 | if i == 1 then |
1102 | + row = main.f_addStage(c) | |
1103 | + table.insert(main.t_includeStage[1], row) | |
1104 | + table.insert(main.t_includeStage[2], row) | |
1105 | + elseif c:match('music[al]?[li]?[tf]?[e]?%s*=') then | |
1106 | + local bgmvolume, bgmloopstart, bgmloopend = 100, 0, 0 | |
1107 | + c = c:gsub('%s+([0-9%s]+)$', function(m1) | |
1108 | + for i, c in ipairs(main.f_strsplit('%s+', m1)) do --split using whitespace delimiter | |
1109 | + if i == 1 then | |
1110 | + bgmvolume = tonumber(c) | |
1111 | + elseif i == 2 then | |
1112 | + bgmloopstart = tonumber(c) | |
1113 | + elseif i == 3 then | |
1114 | + bgmloopend = tonumber(c) | |
1115 | + else | |
1116 | + break | |
1117 | + end | |
1118 | + end | |
1119 | + return '' | |
1120 | + end) | |
1188 | 1121 | c = c:gsub('\\', '/') |
1189 | - if not main.f_fileExists(c) or c:match('^stages/$') then | |
1190 | - break | |
1191 | - end | |
1192 | - addStage(c) | |
1193 | - tmp = getStageName(row):match('^["%s]*(.-)["%s]*$') --needed for s-size ikemen | |
1194 | - if tmp == '' then | |
1195 | - break | |
1196 | - end | |
1197 | - main.t_selStages[row] = {name = tmp, stage = c} | |
1198 | - local zoomout, zoomin, bgmusic, bgmvolume, bgmloopstart, bgmloopend = getStageInfo(row) | |
1199 | - if zoomout ~= '' then | |
1200 | - main.t_selStages[row].zoommin = tonumber(zoomout) | |
1201 | - end | |
1202 | - if zoomin ~= '' then | |
1203 | - main.t_selStages[row].zoommax = tonumber(zoomin) | |
1204 | - end | |
1205 | - if bgmusic ~= '' then | |
1206 | - bgmusic = bgmusic:gsub('\\', '/') | |
1207 | - main.t_selStages[row].music = {[1] = {bgmusic = bgmusic, bgmvolume = tonumber(bgmvolume), bgmloopstart = bgmloopstart, bgmloopend = bgmloopend}} | |
1208 | - end | |
1209 | - main.t_includeStage[#main.t_includeStage + 1] = row | |
1210 | - main.t_stageDef[c] = row | |
1211 | - elseif c:match('music%s*=%s*') then | |
1212 | - c = c:gsub('\\', '/') | |
1213 | - local bgmvolume = c:match('%s([0-9]+)$') | |
1214 | - if bgmvolume == nil then | |
1215 | - bgmvolume = 100 | |
1216 | - else | |
1217 | - bgmvolume = tonumber(bgmvolume) | |
1218 | - c = c:gsub('%s*[0-9]+$','') | |
1219 | - end | |
1220 | - local bgmusic = c:match('^music%s*=%s*(.-)%s*$') | |
1221 | - if main.t_selStages[row].music == nil then | |
1222 | - main.t_selStages[row].music = {} | |
1223 | - end | |
1224 | - main.t_selStages[row].music[#main.t_selStages[row].music+1] = {bgmusic = bgmusic, bgmvolume = bgmvolume} | |
1122 | + local bgtype, bgmusic = c:match('^(music[al]?[li]?[tf]?[e]?)%s*=%s*(.-)%s*$') | |
1123 | + if main.t_selStages[row][bgtype] == nil then main.t_selStages[row][bgtype] = {} end | |
1124 | + table.insert(main.t_selStages[row][bgtype], {bgmusic = bgmusic, bgmvolume = bgmvolume, bgmloopstart = bgmloopstart, bgmloopend = bgmloopend}) | |
1225 | 1125 | else |
1226 | 1126 | local param, value = c:match('^(.-)%s*=%s*(.-)$') |
1227 | - main.t_selStages[row][param] = tonumber(value) | |
1127 | + if param ~= nil and value ~= nil and param ~= '' and value ~= '' then | |
1128 | + main.t_selStages[row][param] = tonumber(value) | |
1129 | + if param:match('order') then | |
1130 | + if main.t_orderStages[main.t_selStages[row].order] == nil then | |
1131 | + main.t_orderStages[main.t_selStages[row].order] = {} | |
1132 | + end | |
1133 | + table.insert(main.t_orderStages[main.t_selStages[row].order], row) | |
1134 | + end | |
1135 | + end | |
1228 | 1136 | end |
1229 | 1137 | end |
1230 | 1138 | elseif section == 3 then --[Options] |
1231 | - if line:match('^%s*.-%.maxmatches%s*=%s*') then | |
1232 | - local rowName, line = line:match('^%s*(.-)%.maxmatches%s*=%s*(.+)') | |
1139 | + if lineCase:match('%.maxmatches%s*=') then | |
1140 | + local rowName, line = lineCase:match('^%s*(.-)%.maxmatches%s*=%s*(.+)') | |
1141 | + rowName = rowName:gsub('%.', '_') | |
1233 | 1142 | main.t_selOptions[rowName .. 'maxmatches'] = {} |
1234 | - for i, c in ipairs(main.f_strsplit(',', line:gsub('%s*(.-)%s*', '%1'))) do | |
1143 | + for i, c in ipairs(main.f_strsplit(',', line:gsub('%s*(.-)%s*', '%1'))) do --split using "," delimiter | |
1235 | 1144 | main.t_selOptions[rowName .. 'maxmatches'][i] = tonumber(c) |
1236 | 1145 | end |
1237 | - elseif line:match('^%s*.-%.airamp%..-%s*=%s*') then | |
1238 | - local rowName, rowName2, wins, offset = line:match('^%s*(.-)%.airamp%.(.-)%s*=%s*([0-9]+)%s*,%s*([0-9-]+)') | |
1146 | + elseif lineCase:match('%.airamp%.') then | |
1147 | + local rowName, rowName2, wins, offset = lineCase:match('^%s*(.-)%.airamp%.(.-)%s*=%s*([0-9]+)%s*,%s*([0-9-]+)') | |
1239 | 1148 | main.t_selOptions[rowName .. rowName2] = {wins = tonumber(wins), offset = tonumber(offset)} |
1240 | 1149 | end |
1241 | 1150 | end |
1242 | 1151 | end |
1243 | ---main.f_printVar(os.difftime(os.time(), start_time)) | |
1152 | + | |
1153 | +--add default maxmatches values if config is missing in select.def | |
1154 | +if main.t_selOptions.arcademaxmatches == nil then main.t_selOptions.arcademaxmatches = {6, 1, 1, 0, 0, 0, 0, 0, 0, 0} end | |
1155 | +if main.t_selOptions.teammaxmatches == nil then main.t_selOptions.teammaxmatches = {4, 1, 1, 0, 0, 0, 0, 0, 0, 0} end | |
1156 | +if main.t_selOptions.survivalmaxmatches == nil then main.t_selOptions.survivalmaxmatches = {-1, 0, 0, 0, 0, 0, 0, 0, 0, 0} end | |
1244 | 1157 | |
1245 | 1158 | --add excluded characters once all slots are filled |
1246 | 1159 | for i = chars, (motif.select_info.rows + motif.select_info.rows_scrolling) * motif.select_info.columns - 1 do |
@@ -1248,14 +1161,15 @@ for i = chars, (motif.select_info.rows + motif.select_info.rows_scrolling) * mot | ||
1248 | 1161 | main.t_selChars[chars] = {} |
1249 | 1162 | addChar('dummyChar') |
1250 | 1163 | end |
1251 | -for i = 1, #t_exlude do | |
1164 | +for i = 1, #t_addExluded do | |
1252 | 1165 | chars = chars + 1 |
1253 | - main.f_addChar(t_exlude[i], chars) | |
1166 | + main.f_addChar(t_addExluded[i], chars, true) | |
1254 | 1167 | end |
1168 | + | |
1255 | 1169 | --add Training by stupa if not included in select.def |
1256 | 1170 | if main.t_charDef.training == nil and main.f_fileExists('chars/training/training.def') then |
1257 | 1171 | chars = chars + 1 |
1258 | - main.f_addChar('training, exclude = 1, order = 0', chars) | |
1172 | + main.f_addChar('training, exclude = 1', chars, false) | |
1259 | 1173 | end |
1260 | 1174 | |
1261 | 1175 | --add remaining character parameters |
@@ -1264,35 +1178,48 @@ main.t_bonusChars = {} | ||
1264 | 1178 | main.t_randomChars = {} |
1265 | 1179 | --for each character loaded |
1266 | 1180 | for i = 1, #main.t_selChars do |
1267 | - if main.t_selChars[i].stage ~= nil then | |
1268 | - for j = 1, #main.t_selChars[i].stage do | |
1269 | - if main.t_stageDef[main.t_selChars[i].stage[j]] == nil and main.file_exists(main.t_selChars[i].stage[j]) then | |
1270 | - row = #main.t_selStages + 1 | |
1271 | - addStage(main.t_selChars[i].stage[j]) | |
1272 | - tmp = getStageName(row):match('^["%s]*(.-)["%s]*$') --needed for s-size ikemen | |
1273 | - if tmp == '' then | |
1274 | - break | |
1275 | - end | |
1276 | - main.t_selStages[row] = {name = tmp, stage = main.t_selChars[i].stage[j]} | |
1277 | - local zoomout, zoomin, bgmusic, bgmvolume, bgmloopstart, bgmloopend = getStageInfo(row) | |
1278 | - if zoomout ~= '' then | |
1279 | - main.t_selStages[row].zoommin = tonumber(zoomout) | |
1280 | - end | |
1281 | - if zoomin ~= '' then | |
1282 | - main.t_selStages[row].zoommax = tonumber(zoomin) | |
1181 | + --add char_ref entry | |
1182 | + if main.t_selChars[i].char ~= nil then | |
1183 | + main.t_selChars[i].char_ref = main.t_charDef[main.t_selChars[i].char:lower()] | |
1184 | + end | |
1185 | + --change character 'rivals' param char and stage string file paths to reference values | |
1186 | + if main.t_selChars[i].rivals ~= nil then | |
1187 | + for j = 1, #main.t_selChars[i].rivals do | |
1188 | + --add 'rivals' param character if needed or reference existing one | |
1189 | + if main.t_selChars[i].rivals[j].char ~= nil then | |
1190 | + if main.t_charDef[main.t_selChars[i].rivals[j].char:lower()] == nil then --new char | |
1191 | + chars = chars + 1 | |
1192 | + main.f_addChar(main.t_selChars[i].rivals[j].char .. ', exclude = 1', chars, false) | |
1193 | + main.t_selChars[i].rivals[j].char_ref = chars | |
1194 | + else --already added | |
1195 | + main.t_selChars[i].rivals[j].char_ref = main.t_charDef[main.t_selChars[i].rivals[j].char:lower()] | |
1283 | 1196 | end |
1284 | - if bgmusic ~= '' then | |
1285 | - bgmusic = bgmusic:gsub('\\', '/') | |
1286 | - main.t_selStages[row].music = {} | |
1287 | - main.t_selStages[row].music[1] = {bgmusic = bgmusic, bgmvolume = tonumber(bgmvolume), bgmloopstart = bgmloopstart, bgmloopend = bgmloopend} | |
1197 | + end | |
1198 | + --add 'rivals' param stages if needed or reference existing ones | |
1199 | + if main.t_selChars[i].rivals[j].stage ~= nil then | |
1200 | + for k = 1, #main.t_selChars[i].rivals[j].stage do | |
1201 | + if main.t_stageDef[main.t_selChars[i].rivals[j].stage[k]:lower()] == nil then | |
1202 | + main.t_selChars[i].rivals[j].stage[k] = main.f_addStage(main.t_selChars[i].rivals[j].stage[k]) | |
1203 | + else --already added | |
1204 | + main.t_selChars[i].rivals[j].stage[k] = main.t_stageDef[main.t_selChars[i].rivals[j].stage[k]:lower()] | |
1205 | + end | |
1288 | 1206 | end |
1289 | - if main.t_selChars[i].includestage == nil or main.t_selChars[i].includestage == 1 then | |
1290 | - main.t_includeStage[#main.t_includeStage + 1] = row | |
1207 | + end | |
1208 | + end | |
1209 | + end | |
1210 | + --character stage param | |
1211 | + if main.t_selChars[i].stage ~= nil then | |
1212 | + for j = 1, #main.t_selChars[i].stage do | |
1213 | + --add 'stage' param stages if needed or reference existing ones | |
1214 | + if main.t_stageDef[main.t_selChars[i].stage[j]:lower()] == nil then | |
1215 | + main.t_selChars[i].stage[j] = main.f_addStage(main.t_selChars[i].stage[j]) | |
1216 | + if main.t_selChars[i].includestage == nil or main.t_selChars[i].includestage == 1 then --stage available all the time | |
1217 | + table.insert(main.t_includeStage[1], main.t_selChars[i].stage[j]) | |
1218 | + elseif main.t_selChars[i].includestage == -1 then --excluded stage that can be still manually selected | |
1219 | + table.insert(main.t_includeStage[2], main.t_selChars[i].stage[j]) | |
1291 | 1220 | end |
1292 | - main.t_selChars[i].stage[j] = row | |
1293 | - --main.t_stageDef[main.t_selChars[i].stage[j]] = row | |
1294 | - else | |
1295 | - main.t_selChars[i].stage[j] = main.t_stageDef[main.t_selChars[i].stage[j]] | |
1221 | + else --already added | |
1222 | + main.t_selChars[i].stage[j] = main.t_stageDef[main.t_selChars[i].stage[j]:lower()] | |
1296 | 1223 | end |
1297 | 1224 | end |
1298 | 1225 | end |
@@ -1300,15 +1227,15 @@ for i = 1, #main.t_selChars do | ||
1300 | 1227 | if main.t_selChars[i].displayname ~= nil then |
1301 | 1228 | --generate table for boss rush mode |
1302 | 1229 | if main.t_selChars[i].boss ~= nil and main.t_selChars[i].boss == 1 then |
1303 | - main.t_bossChars[#main.t_bossChars + 1] = i - 1 | |
1230 | + table.insert(main.t_bossChars, i - 1) | |
1304 | 1231 | end |
1305 | 1232 | --generate table for bonus games mode |
1306 | 1233 | if main.t_selChars[i].bonus ~= nil and main.t_selChars[i].bonus == 1 then |
1307 | - main.t_bonusChars[#main.t_bonusChars + 1] = i - 1 | |
1234 | + table.insert(main.t_bonusChars, i - 1) | |
1308 | 1235 | end |
1309 | 1236 | --generate table with characters allowed to be random selected |
1310 | - if main.t_selChars[i].hidden ~= nil and main.t_selChars[i].hidden <= 1 then | |
1311 | - main.t_randomChars[#main.t_randomChars + 1] = i - 1 | |
1237 | + if main.t_selChars[i].playable and (main.t_selChars[i].hidden == nil or main.t_selChars[i].hidden <= 1) and (main.t_selChars[i].exclude == nil or main.t_selChars[i].exclude == 0) then | |
1238 | + table.insert(main.t_randomChars, i - 1) | |
1312 | 1239 | end |
1313 | 1240 | end |
1314 | 1241 | end |
@@ -1318,12 +1245,15 @@ main.f_printTable(main.t_selChars, "debug/t_selChars.txt") | ||
1318 | 1245 | main.f_printTable(main.t_selStages, "debug/t_selStages.txt") |
1319 | 1246 | main.f_printTable(main.t_selOptions, "debug/t_selOptions.txt") |
1320 | 1247 | main.f_printTable(main.t_orderChars, "debug/t_orderChars.txt") |
1248 | +main.f_printTable(main.t_orderStages, "debug/t_orderStages.txt") | |
1249 | +main.f_printTable(main.t_orderSurvival, "debug/t_orderSurvival.txt") | |
1321 | 1250 | main.f_printTable(main.t_randomChars, "debug/t_randomChars.txt") |
1322 | 1251 | main.f_printTable(main.t_bossChars, "debug/t_bossChars.txt") |
1323 | 1252 | main.f_printTable(main.t_bonusChars, "debug/t_bonusChars.txt") |
1324 | 1253 | main.f_printTable(main.t_stageDef, "debug/t_stageDef.txt") |
1325 | 1254 | main.f_printTable(main.t_charDef, "debug/t_charDef.txt") |
1326 | 1255 | main.f_printTable(main.t_includeStage, "debug/t_includeStage.txt") |
1256 | +main.f_printTable(config, "debug/config.txt") | |
1327 | 1257 | |
1328 | 1258 | --Debug stuff |
1329 | 1259 | loadDebugFont(motif.files.debug_font) |
@@ -1333,31 +1263,39 @@ setDebugScript(motif.files.debug_script) | ||
1333 | 1263 | textImgDraw(txt_loading) |
1334 | 1264 | refresh() |
1335 | 1265 | loadLifebar(motif.files.fight) |
1266 | +main.currentLifebar = motif.files.fight | |
1336 | 1267 | main.loadingRefresh(txt_loading) |
1337 | 1268 | |
1338 | ---warnings | |
1269 | +--print warning if training character is missing | |
1339 | 1270 | if main.t_charDef.training == nil then |
1340 | 1271 | main.f_warning(main.f_extractText(motif.warning_info.text_training), motif.title_info, motif.titlebgdef) |
1341 | 1272 | os.exit() |
1342 | 1273 | end |
1343 | 1274 | |
1344 | -if #main.t_includeStage == 0 then | |
1275 | +--print warning if no stages have been added | |
1276 | +if #main.t_includeStage[1] == 0 then | |
1345 | 1277 | main.f_warning(main.f_extractText(motif.warning_info.text_stages), motif.title_info, motif.titlebgdef) |
1346 | 1278 | os.exit() |
1347 | 1279 | end |
1348 | 1280 | |
1349 | -local t = {'arcademaxmatches', 'teammaxmatches'} | |
1350 | -for i = 1, #t do | |
1351 | - local orderOK = false | |
1352 | - for j = 1, #main.t_selOptions[t[i]] do | |
1353 | - if main.t_selOptions[t[i]][j] > 0 and main.t_orderChars[j] ~= nil and #main.t_orderChars[j] > 0 then | |
1354 | - orderOK = true | |
1355 | - break | |
1281 | +--print warning if at least 1 match is not possible with the current maxmatches settings | |
1282 | +for k, v in pairs(main.t_selOptions) do | |
1283 | + local mode = k:match('^(.+)maxmatches$') | |
1284 | + if mode ~= nil then | |
1285 | + local orderOK = false | |
1286 | + for i = 1, #main.t_selOptions[k] do | |
1287 | + if mode == 'survival' and (main.t_selOptions[k][i] > 0 or main.t_selOptions[k][i] == -1) and main.t_orderSurvival[i] ~= nil and #main.t_orderSurvival[i] > 0 then | |
1288 | + orderOK = true | |
1289 | + break | |
1290 | + elseif main.t_selOptions[k][i] > 0 and main.t_orderChars[i] ~= nil and #main.t_orderChars[i] > 0 then | |
1291 | + orderOK = true | |
1292 | + break | |
1293 | + end | |
1294 | + end | |
1295 | + if not orderOK then | |
1296 | + main.f_warning(main.f_extractText(motif.warning_info.text_order), motif.title_info, motif.titlebgdef) | |
1297 | + os.exit() | |
1356 | 1298 | end |
1357 | - end | |
1358 | - if not orderOK then | |
1359 | - main.f_warning(main.f_extractText(motif.warning_info.text_order), motif.title_info, motif.titlebgdef) | |
1360 | - os.exit() | |
1361 | 1299 | end |
1362 | 1300 | end |
1363 | 1301 |
@@ -1385,7 +1323,9 @@ local txt_titleFooter1 = main.f_createTextImg( | ||
1385 | 1323 | motif.title_info.footer1_font_scale[2], |
1386 | 1324 | motif.title_info.footer1_font[4], |
1387 | 1325 | motif.title_info.footer1_font[5], |
1388 | - motif.title_info.footer1_font[6] | |
1326 | + motif.title_info.footer1_font[6], | |
1327 | + motif.title_info.footer1_font[7], | |
1328 | + motif.title_info.footer1_font[8] | |
1389 | 1329 | ) |
1390 | 1330 | local txt_titleFooter2 = main.f_createTextImg( |
1391 | 1331 | motif.font_data[motif.title_info.footer2_font[1]], |
@@ -1398,7 +1338,9 @@ local txt_titleFooter2 = main.f_createTextImg( | ||
1398 | 1338 | motif.title_info.footer2_font_scale[2], |
1399 | 1339 | motif.title_info.footer2_font[4], |
1400 | 1340 | motif.title_info.footer2_font[5], |
1401 | - motif.title_info.footer2_font[6] | |
1341 | + motif.title_info.footer2_font[6], | |
1342 | + motif.title_info.footer2_font[7], | |
1343 | + motif.title_info.footer2_font[8] | |
1402 | 1344 | ) |
1403 | 1345 | local txt_titleFooter3 = main.f_createTextImg( |
1404 | 1346 | motif.font_data[motif.title_info.footer3_font[1]], |
@@ -1411,7 +1353,9 @@ local txt_titleFooter3 = main.f_createTextImg( | ||
1411 | 1353 | motif.title_info.footer3_font_scale[2], |
1412 | 1354 | motif.title_info.footer3_font[4], |
1413 | 1355 | motif.title_info.footer3_font[5], |
1414 | - motif.title_info.footer3_font[6] | |
1356 | + motif.title_info.footer3_font[6], | |
1357 | + motif.title_info.footer3_font[7], | |
1358 | + motif.title_info.footer3_font[8] | |
1415 | 1359 | ) |
1416 | 1360 | local txt_infoboxTitle = main.f_createTextImg( |
1417 | 1361 | motif.font_data[motif.infobox.title_font[1]], |
@@ -1424,7 +1368,9 @@ local txt_infoboxTitle = main.f_createTextImg( | ||
1424 | 1368 | motif.infobox.title_font_scale[2], |
1425 | 1369 | motif.infobox.title_font[4], |
1426 | 1370 | motif.infobox.title_font[5], |
1427 | - motif.infobox.title_font[6] | |
1371 | + motif.infobox.title_font[6], | |
1372 | + motif.infobox.title_font[7], | |
1373 | + motif.infobox.title_font[8] | |
1428 | 1374 | ) |
1429 | 1375 | |
1430 | 1376 | --Enable screenpack scale again. |
@@ -1441,7 +1387,9 @@ main.txt_mainSelect = main.f_createTextImg( | ||
1441 | 1387 | motif.select_info.title_font_scale[2], |
1442 | 1388 | motif.select_info.title_font[4], |
1443 | 1389 | motif.select_info.title_font[5], |
1444 | - motif.select_info.title_font[6] | |
1390 | + motif.select_info.title_font[6], | |
1391 | + motif.select_info.title_font[7], | |
1392 | + motif.select_info.title_font[8] | |
1445 | 1393 | ) |
1446 | 1394 | |
1447 | 1395 | --itemname: names used to distinguish modes in lua code (keep it as it is) |
@@ -1450,6 +1398,8 @@ main.txt_mainSelect = main.f_createTextImg( | ||
1450 | 1398 | local t_mainMenu = { |
1451 | 1399 | {data = textImgNew(), itemname = 'arcade', displayname = motif.title_info.menu_itemname_arcade, selectname = motif.select_info.title_text_arcade}, |
1452 | 1400 | {data = textImgNew(), itemname = 'versus', displayname = motif.title_info.menu_itemname_versus, selectname = motif.select_info.title_text_versus}, |
1401 | + {data = textImgNew(), itemname = 'teamarcade', displayname = motif.title_info.menu_itemname_teamarcade, selectname = motif.select_info.title_text_teamarcade}, | |
1402 | + {data = textImgNew(), itemname = 'teamversus', displayname = motif.title_info.menu_itemname_teamversus, selectname = motif.select_info.title_text_teamversus}, | |
1453 | 1403 | {data = textImgNew(), itemname = 'online', displayname = motif.title_info.menu_itemname_online}, |
1454 | 1404 | {data = textImgNew(), itemname = 'teamcoop', displayname = motif.title_info.menu_itemname_teamcoop, selectname = motif.select_info.title_text_teamcoop}, |
1455 | 1405 | {data = textImgNew(), itemname = 'survival', displayname = motif.title_info.menu_itemname_survival, selectname = motif.select_info.title_text_survival}, |
@@ -1463,22 +1413,26 @@ local t_mainMenu = { | ||
1463 | 1413 | {data = textImgNew(), itemname = 'options', displayname = motif.title_info.menu_itemname_options}, |
1464 | 1414 | {data = textImgNew(), itemname = 'exit', displayname = motif.title_info.menu_itemname_exit}, |
1465 | 1415 | } |
1466 | -t_mainMenu = main.f_cleanTable(t_mainMenu) | |
1416 | +t_mainMenu = main.f_cleanTable(t_mainMenu, main.t_sort.title_info) | |
1467 | 1417 | |
1418 | +local demoFrameCounter = 0 | |
1419 | +local introWaitCycles = 0 | |
1468 | 1420 | function main.f_default() |
1421 | + demoFrameCounter = 0 | |
1469 | 1422 | setAutoLevel(false) --generate autolevel.txt in game dir |
1470 | 1423 | setHomeTeam(2) --P2 side considered the home team: http://mugenguild.com/forum/topics/ishometeam-triggers-169132.0.html |
1471 | - resetRemapInput() | |
1472 | 1424 | --settings adjustable via options |
1473 | 1425 | setAutoguard(1, config.AutoGuard) |
1474 | 1426 | setAutoguard(2, config.AutoGuard) |
1475 | 1427 | setPowerShare(1, config.TeamPowerShare) |
1476 | 1428 | setPowerShare(2, config.TeamPowerShare) |
1477 | 1429 | setLifeShare(config.TeamLifeShare) |
1478 | - setRoundTime(config.RoundTime * options.framespercount) | |
1430 | + setRoundTime(math.max(-1, config.RoundTime * getFramesPerCount())) | |
1431 | + setDemoTime(motif.demo_mode.fight_endtime / 60 * getFramesPerCount()) | |
1479 | 1432 | setLifeMul(config.LifeMul / 100) |
1480 | 1433 | setTeam1VS2Life(config.Team1VS2Life / 100) |
1481 | - setTurnsRecoveryRate(1.0 / config.TurnsRecoveryRate) | |
1434 | + setTurnsRecoveryRate(config.TurnsRecoveryBase / 100, config.TurnsRecoveryBonus / 100) | |
1435 | + setGameMode('') | |
1482 | 1436 | --default values for all modes |
1483 | 1437 | main.p1Char = nil --no predefined P1 character (assigned via table: {X, Y, (...)}) |
1484 | 1438 | main.p2Char = nil --no predefined P2 character (assigned via table: {X, Y, (...)}) |
@@ -1490,18 +1444,86 @@ function main.f_default() | ||
1490 | 1444 | main.coop = false --P2 fighting on P1 side disabled |
1491 | 1445 | main.p2SelectMenu = true --P2 character selection enabled |
1492 | 1446 | main.versusScreen = true --versus screen enabled |
1447 | + main.f_resetCharparam() | |
1493 | 1448 | main.p1In = 1 --P1 controls P1 side of the select screen |
1494 | 1449 | main.p2In = 2 --P2 controls P2 side of the select screen |
1495 | - main.gameMode = '' --additional variable used to distinguish modes in select screen | |
1450 | + resetRemapInput() | |
1451 | +end | |
1452 | + | |
1453 | +function main.f_resetCharparam() | |
1454 | + main.t_charparam = { --default character parameters support | |
1455 | + stage = false, | |
1456 | + music = false, | |
1457 | + zoom = false, | |
1458 | + ai = false, | |
1459 | + winscreen = true, | |
1460 | + rounds = false, | |
1461 | + time = false, | |
1462 | + lifebar = true, | |
1463 | + onlyme = false, | |
1464 | + rivals = false, | |
1465 | + } | |
1466 | +end | |
1467 | + | |
1468 | +function main.f_demo(cursorPosY, moveTxt, item, t, fadeType) | |
1469 | + if motif.demo_mode.enabled == 0 then | |
1470 | + return | |
1471 | + end | |
1472 | + demoFrameCounter = demoFrameCounter + 1 | |
1473 | + if demoFrameCounter < motif.demo_mode.title_waittime then | |
1474 | + return | |
1475 | + end | |
1476 | + main.f_default() | |
1477 | + main.f_menuFade('demo_mode', 'fadeout', cursorPosY, moveTxt, item, t) | |
1478 | + clearColor(motif.titlebgdef.bgclearcolor[1], motif.titlebgdef.bgclearcolor[2], motif.titlebgdef.bgclearcolor[3]) | |
1479 | + if motif.demo_mode.fight_playbgm == 1 or motif.demo_mode.fight_stopbgm == 1 then | |
1480 | + setStopTitleBGM(true) | |
1481 | + else | |
1482 | + setStopTitleBGM(false) | |
1483 | + end | |
1484 | + if motif.demo_mode.fight_bars_display == 1 then | |
1485 | + setBarsDisplay(true) | |
1486 | + else | |
1487 | + setBarsDisplay(false) | |
1488 | + end | |
1489 | + if motif.demo_mode.debuginfo == 0 and config.AllowDebugKeys then | |
1490 | + setAllowDebugKeys(false) | |
1491 | + end | |
1492 | + setGameMode('demo') | |
1493 | + randomtest.run() | |
1494 | + setBarsDisplay(true) | |
1495 | + setStopTitleBGM(true) | |
1496 | + setAllowDebugKeys(config.AllowDebugKeys) | |
1497 | + refresh() | |
1498 | + --intro | |
1499 | + if introWaitCycles >= motif.demo_mode.intro_waitcycles then | |
1500 | + if motif.files.intro_storyboard ~= '' then | |
1501 | + storyboard.f_storyboard(motif.files.intro_storyboard) | |
1502 | + end | |
1503 | + introWaitCycles = 0 | |
1504 | + else | |
1505 | + introWaitCycles = introWaitCycles + 1 | |
1506 | + end | |
1507 | + --start title BGM only if it has been interrupted | |
1508 | + if motif.demo_mode.fight_stopbgm == 1 or motif.demo_mode.fight_playbgm == 1 or (introWaitCycles == 0 and motif.files.intro_storyboard ~= '') then | |
1509 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1510 | + else | |
1511 | + main.f_menuReset(motif.titlebgdef.bg) | |
1512 | + end | |
1513 | + main.f_menuFade('demo_mode', 'fadein', cursorPosY, moveTxt, item, t) | |
1496 | 1514 | end |
1497 | 1515 | |
1498 | -function main.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1516 | +function main.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
1499 | 1517 | if commandGetState(main.p1Cmd, 'u') or commandGetState(main.p2Cmd, 'u') then |
1500 | 1518 | sndPlay(motif.files.snd_data, motif.title_info.cursor_move_snd[1], motif.title_info.cursor_move_snd[2]) |
1501 | 1519 | item = item - 1 |
1520 | + demoFrameCounter = 0 | |
1521 | + introWaitCycles = 0 | |
1502 | 1522 | elseif commandGetState(main.p1Cmd, 'd') or commandGetState(main.p2Cmd, 'd') then |
1503 | 1523 | sndPlay(motif.files.snd_data, motif.title_info.cursor_move_snd[1], motif.title_info.cursor_move_snd[2]) |
1504 | 1524 | item = item + 1 |
1525 | + demoFrameCounter = 0 | |
1526 | + introWaitCycles = 0 | |
1505 | 1527 | end |
1506 | 1528 | --cursor position calculation |
1507 | 1529 | if item < 1 then |
@@ -1514,9 +1536,9 @@ function main.f_menuCommon1(cursorPosY, moveTxt, item, t) | ||
1514 | 1536 | elseif item > #t then |
1515 | 1537 | item = 1 |
1516 | 1538 | cursorPosY = 1 |
1517 | - elseif (commandGetState(main.p1Cmd, 'u') or commandGetState(main.p2Cmd, 'u') ) and cursorPosY > 1 then | |
1539 | + elseif (commandGetState(main.p1Cmd, 'u') or commandGetState(main.p2Cmd, 'u')) and cursorPosY > 1 then | |
1518 | 1540 | cursorPosY = cursorPosY - 1 |
1519 | - elseif (commandGetState(main.p1Cmd, 'd') or commandGetState(main.p2Cmd, 'd') ) and cursorPosY < motif.title_info.menu_window_visibleitems then | |
1541 | + elseif (commandGetState(main.p1Cmd, 'd') or commandGetState(main.p2Cmd, 'd')) and cursorPosY < motif.title_info.menu_window_visibleitems then | |
1520 | 1542 | cursorPosY = cursorPosY + 1 |
1521 | 1543 | end |
1522 | 1544 | if cursorPosY == motif.title_info.menu_window_visibleitems then |
@@ -1527,14 +1549,16 @@ function main.f_menuCommon1(cursorPosY, moveTxt, item, t) | ||
1527 | 1549 | return cursorPosY, moveTxt, item |
1528 | 1550 | end |
1529 | 1551 | |
1530 | -function main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1552 | +function main.f_menuCommonDraw(cursorPosY, moveTxt, item, t, fadeType, fadeData) | |
1553 | + fadeType = fadeType or 'fadein' | |
1554 | + fadeData = fadeData or 'title_info' | |
1531 | 1555 | --draw clearcolor |
1532 | - animDraw(motif.titlebgdef.bgclearcolor_data) | |
1556 | + clearColor(motif.titlebgdef.bgclearcolor[1], motif.titlebgdef.bgclearcolor[2], motif.titlebgdef.bgclearcolor[3]) | |
1533 | 1557 | --draw layerno = 0 backgrounds |
1534 | - main.f_drawBG(motif.titlebgdef.bg_data, motif.titlebgdef.bg, 0, motif.titlebgdef.timer, {320,240}) | |
1558 | + bgDraw(motif.titlebgdef.bg, false) | |
1535 | 1559 | --draw menu items |
1536 | 1560 | local items_shown = item + motif.title_info.menu_window_visibleitems - cursorPosY |
1537 | - if motif.title_info.menu_window_margins_y[2] ~= 0 and items_shown < #t then | |
1561 | + if motif.title_info.menu_window_visibleitems > 1 and motif.title_info.menu_window_margins_y[2] ~= 0 and items_shown < #t then | |
1538 | 1562 | items_shown = items_shown + 1 |
1539 | 1563 | end |
1540 | 1564 | if items_shown > #t then |
@@ -1555,7 +1579,9 @@ function main.f_menuCommon2(cursorPosY, moveTxt, item, t) | ||
1555 | 1579 | motif.title_info.menu_item_active_font_scale[2], |
1556 | 1580 | motif.title_info.menu_item_active_font[4], |
1557 | 1581 | motif.title_info.menu_item_active_font[5], |
1558 | - motif.title_info.menu_item_active_font[6] | |
1582 | + motif.title_info.menu_item_active_font[6], | |
1583 | + motif.title_info.menu_item_active_font[7], | |
1584 | + motif.title_info.menu_item_active_font[8] | |
1559 | 1585 | )) |
1560 | 1586 | else |
1561 | 1587 | textImgDraw(main.f_updateTextImg( |
@@ -1570,48 +1596,103 @@ function main.f_menuCommon2(cursorPosY, moveTxt, item, t) | ||
1570 | 1596 | motif.title_info.menu_item_font_scale[2], |
1571 | 1597 | motif.title_info.menu_item_font[4], |
1572 | 1598 | motif.title_info.menu_item_font[5], |
1573 | - motif.title_info.menu_item_font[6] | |
1599 | + motif.title_info.menu_item_font[6], | |
1600 | + motif.title_info.menu_item_font[7], | |
1601 | + motif.title_info.menu_item_font[8] | |
1574 | 1602 | )) |
1575 | 1603 | end |
1576 | 1604 | end |
1577 | 1605 | end |
1578 | 1606 | --draw menu cursor |
1579 | - if motif.title_info.menu_boxcursor_visible == 1 then | |
1580 | - animSetWindow( | |
1581 | - main.cursorBox, | |
1607 | + if motif.title_info.menu_boxcursor_visible == 1 and not main.fadeActive then | |
1608 | + local src, dst = main.f_boxcursorAlpha( | |
1609 | + motif.title_info.menu_boxcursor_alpharange[1], | |
1610 | + motif.title_info.menu_boxcursor_alpharange[2], | |
1611 | + motif.title_info.menu_boxcursor_alpharange[3], | |
1612 | + motif.title_info.menu_boxcursor_alpharange[4], | |
1613 | + motif.title_info.menu_boxcursor_alpharange[5], | |
1614 | + motif.title_info.menu_boxcursor_alpharange[6] | |
1615 | + ) | |
1616 | + fillRect( | |
1582 | 1617 | motif.title_info.menu_pos[1] + motif.title_info.menu_boxcursor_coords[1], |
1583 | 1618 | motif.title_info.menu_pos[2] + motif.title_info.menu_boxcursor_coords[2] + (cursorPosY - 1) * motif.title_info.menu_item_spacing[2], |
1584 | 1619 | motif.title_info.menu_boxcursor_coords[3] - motif.title_info.menu_boxcursor_coords[1] + 1, |
1585 | - motif.title_info.menu_boxcursor_coords[4] - motif.title_info.menu_boxcursor_coords[2] + 1 | |
1620 | + motif.title_info.menu_boxcursor_coords[4] - motif.title_info.menu_boxcursor_coords[2] + 1 + main.f_oddRounding(motif.title_info.menu_boxcursor_coords[2]), | |
1621 | + motif.title_info.menu_boxcursor_col[1], | |
1622 | + motif.title_info.menu_boxcursor_col[2], | |
1623 | + motif.title_info.menu_boxcursor_col[3], | |
1624 | + src, | |
1625 | + dst | |
1586 | 1626 | ) |
1587 | - main.f_dynamicAlpha(main.cursorBox, 10,40,2, 255,255,0) | |
1588 | - animDraw(main.cursorBox) | |
1589 | 1627 | end |
1590 | 1628 | --draw layerno = 1 backgrounds |
1591 | - main.f_drawBG(motif.titlebgdef.bg_data, motif.titlebgdef.bg, 1, motif.titlebgdef.timer, {320,240}) | |
1629 | + bgDraw(motif.titlebgdef.bg, true) | |
1592 | 1630 | --footer draw |
1593 | - if motif.title_info.footer_boxbackground_visible == 1 then | |
1594 | - animDraw(footerBox) | |
1631 | + if motif.title_info.footer_boxbg_visible == 1 then | |
1632 | + fillRect( | |
1633 | + motif.title_info.footer_boxbg_coords[1], | |
1634 | + motif.title_info.footer_boxbg_coords[2], | |
1635 | + motif.title_info.footer_boxbg_coords[3] - motif.title_info.footer_boxbg_coords[1] + 1, | |
1636 | + motif.title_info.footer_boxbg_coords[4] - motif.title_info.footer_boxbg_coords[2] + 1, | |
1637 | + motif.title_info.footer_boxbg_col[1], | |
1638 | + motif.title_info.footer_boxbg_col[2], | |
1639 | + motif.title_info.footer_boxbg_col[3], | |
1640 | + motif.title_info.footer_boxbg_alpha[1], | |
1641 | + motif.title_info.footer_boxbg_alpha[2] | |
1642 | + ) | |
1595 | 1643 | end |
1596 | 1644 | textImgDraw(txt_titleFooter1) |
1597 | 1645 | textImgDraw(txt_titleFooter2) |
1598 | 1646 | textImgDraw(txt_titleFooter3) |
1599 | - --draw fadein | |
1600 | - animDraw(motif.title_info.fadein_data) | |
1601 | - animUpdate(motif.title_info.fadein_data) | |
1602 | - --update timer | |
1603 | - motif.titlebgdef.timer = motif.titlebgdef.timer + 1 | |
1604 | - --end loop | |
1605 | - main.f_cmdInput() | |
1647 | + --draw fadein / fadeout | |
1648 | + main.fadeActive = fadeScreen( | |
1649 | + fadeType, | |
1650 | + main.fadeStart, | |
1651 | + motif[fadeData][fadeType .. '_time'], | |
1652 | + motif[fadeData][fadeType .. '_col'][1], | |
1653 | + motif[fadeData][fadeType .. '_col'][2], | |
1654 | + motif[fadeData][fadeType .. '_col'][3] | |
1655 | + ) | |
1656 | + --frame transition | |
1657 | + if main.fadeActive then | |
1658 | + commandBufReset(main.p1Cmd) | |
1659 | + elseif fadeType == 'fadeout' then | |
1660 | + commandBufReset(main.p1Cmd) | |
1661 | + return --skip last frame rendering | |
1662 | + else | |
1663 | + main.f_cmdInput() | |
1664 | + end | |
1606 | 1665 | refresh() |
1607 | 1666 | end |
1608 | 1667 | |
1609 | -function main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1610 | - --[[for i = 1, motif.title_info.fadeout_time do | |
1611 | - main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1612 | - animDraw(motif.title_info.fadeout_data) | |
1613 | - animUpdate(motif.title_info.fadeout_data) | |
1614 | - end]] | |
1668 | +main.fadeActive = false | |
1669 | +function main.f_menuFade(screen, fadeType, cursorPosY, moveTxt, item, t) | |
1670 | + main.fadeStart = getFrameCount() | |
1671 | + while true do | |
1672 | + if screen == 'title_info' then | |
1673 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t, fadeType) | |
1674 | + elseif screen == 'option_info' then | |
1675 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t, fadeType) | |
1676 | + elseif screen == 'demo_mode' then | |
1677 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t, fadeType, 'demo_mode') | |
1678 | + end | |
1679 | + if not main.fadeActive then | |
1680 | + break | |
1681 | + end | |
1682 | + end | |
1683 | +end | |
1684 | + | |
1685 | +function main.f_menuReset(bgNum, bgm, bgmLoop, bgmVolume, bgmLoopstart, bgmLoopend) | |
1686 | + alpha1cur = 0 | |
1687 | + alpha2cur = 0 | |
1688 | + alpha1add = true | |
1689 | + alpha2add = true | |
1690 | + bgm = bgm or nil | |
1691 | + bgReset(bgNum) | |
1692 | + if bgm ~= nil then | |
1693 | + playBGM(bgm, true, bgmLoop, bgmVolume, bgmLoopstart, bgmLoopend) | |
1694 | + end | |
1695 | + main.fadeStart = getFrameCount() | |
1615 | 1696 | end |
1616 | 1697 | |
1617 | 1698 | function main.f_mainMenu() |
@@ -1626,37 +1707,64 @@ function main.f_mainMenu() | ||
1626 | 1707 | if motif.files.intro_storyboard ~= '' then |
1627 | 1708 | storyboard.f_storyboard(motif.files.intro_storyboard) |
1628 | 1709 | end |
1629 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1710 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1630 | 1711 | while true do |
1631 | - cursorPosY, moveTxt, item = main.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1712 | + cursorPosY, moveTxt, item = main.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
1632 | 1713 | if esc() then |
1633 | 1714 | break |
1634 | 1715 | elseif getKey() == 'F1' then |
1635 | 1716 | main.SetDefaultScale() |
1636 | - main.f_warning(main.f_extractText(motif.infobox.text), motif.title_info, motif.titlebgdef, motif.infobox, txt_infoboxTitle, main.infoBox) | |
1717 | + main.f_warning( | |
1718 | + main.f_extractText(motif.infobox.text), | |
1719 | + motif.title_info, | |
1720 | + motif.titlebgdef, | |
1721 | + motif.infobox, | |
1722 | + txt_infoboxTitle, | |
1723 | + motif.infobox.boxbg_coords, | |
1724 | + motif.infobox.boxbg_col, | |
1725 | + motif.infobox.boxbg_alpha | |
1726 | + ) | |
1637 | 1727 | main.SetScaleValues() |
1638 | 1728 | elseif main.f_btnPalNo(main.p1Cmd) > 0 then |
1639 | 1729 | main.f_default() |
1640 | 1730 | --ARCADE |
1641 | - if t[item].itemname == 'arcade' then | |
1731 | + if t[item].itemname == 'arcade' or t[item].itemname == 'teamarcade' then | |
1642 | 1732 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
1643 | 1733 | main.p2In = 1 --P1 controls P2 side of the select screen |
1644 | 1734 | main.p2SelectMenu = false --P2 character selection disabled |
1735 | + main.t_charparam.stage = true | |
1736 | + main.t_charparam.music = true | |
1737 | + main.t_charparam.zoom = true | |
1738 | + main.t_charparam.ai = true | |
1739 | + main.t_charparam.rounds = true | |
1740 | + main.t_charparam.time = true | |
1741 | + main.t_charparam.onlyme = true | |
1742 | + main.t_charparam.rivals = true | |
1645 | 1743 | main.credits = config.Credits - 1 --amount of continues |
1646 | - main.gameMode = t[item].itemname --mode recognized in select screen as 'arcade' | |
1647 | 1744 | textImgSetText(main.txt_mainSelect, t[item].selectname) --message displayed on top of select screen |
1648 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1649 | - select.f_selectAdvance() --start f_selectAdvance() function from script/select.lua | |
1745 | + if t[item].itemname == 'arcade' then | |
1746 | + main.p1TeamMenu = {mode = 0, chars = 1} --predefined P1 team mode as Single, 1 Character | |
1747 | + main.p2TeamMenu = {mode = 0, chars = 1} --predefined P2 team mode as Single, 1 Character | |
1748 | + end | |
1749 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
1750 | + setGameMode('arcade') | |
1751 | + select.f_selectArcade() --start f_selectArcade() function from script/select.lua | |
1650 | 1752 | end |
1651 | 1753 | --VS MODE |
1652 | - if t[item].itemname == 'versus' then | |
1754 | + if t[item].itemname == 'versus' or t[item].itemname == 'teamversus' then | |
1653 | 1755 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
1654 | 1756 | setHomeTeam(1) --P1 side considered the home team |
1655 | 1757 | main.p2In = 2 --P2 controls P2 side of the select screen |
1656 | 1758 | main.stageMenu = true --stage selection enabled |
1657 | 1759 | main.p2Faces = true --additional window with P2 select screen small portraits (faces) enabled |
1760 | + --uses default main.t_charparam assignment | |
1658 | 1761 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
1659 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1762 | + if t[item].itemname == 'versus' then | |
1763 | + main.p1TeamMenu = {mode = 0, chars = 1} --predefined P1 team mode as Single, 1 Character | |
1764 | + main.p2TeamMenu = {mode = 0, chars = 1} --predefined P2 team mode as Single, 1 Character | |
1765 | + end | |
1766 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
1767 | + setGameMode('versus') | |
1660 | 1768 | select.f_selectSimple() --start f_selectSimple() function from script/select.lua |
1661 | 1769 | end |
1662 | 1770 | --ONLINE |
@@ -1670,22 +1778,35 @@ function main.f_mainMenu() | ||
1670 | 1778 | main.p2In = 2 |
1671 | 1779 | main.p2Faces = true |
1672 | 1780 | main.coop = true --P2 fighting on P1 side enabled |
1781 | + main.t_charparam.stage = true | |
1782 | + main.t_charparam.music = true | |
1783 | + main.t_charparam.zoom = true | |
1784 | + main.t_charparam.ai = true | |
1785 | + main.t_charparam.rounds = true | |
1786 | + main.t_charparam.time = true | |
1787 | + main.t_charparam.onlyme = true | |
1788 | + main.t_charparam.rivals = true | |
1673 | 1789 | main.credits = config.Credits - 1 |
1674 | - main.gameMode = t[item].itemname | |
1675 | 1790 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
1676 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1677 | - select.f_selectAdvance() | |
1791 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
1792 | + setGameMode('teamcoop') | |
1793 | + select.f_selectArcade() | |
1678 | 1794 | end |
1679 | 1795 | --SURVIVAL |
1680 | 1796 | if t[item].itemname == 'survival' then |
1681 | 1797 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
1682 | 1798 | main.p2In = 1 |
1683 | 1799 | main.p2SelectMenu = false |
1684 | - main.credits = 0 | |
1685 | - main.gameMode = t[item].itemname | |
1800 | + main.t_charparam.stage = true | |
1801 | + main.t_charparam.music = true | |
1802 | + main.t_charparam.zoom = true | |
1803 | + main.t_charparam.ai = true | |
1804 | + main.t_charparam.time = true | |
1805 | + main.t_charparam.onlyme = true | |
1686 | 1806 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
1687 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1688 | - select.f_selectAdvance() | |
1807 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
1808 | + setGameMode('survival') | |
1809 | + select.f_selectArranged() | |
1689 | 1810 | end |
1690 | 1811 | --SURVIVAL CO-OP |
1691 | 1812 | if t[item].itemname == 'survivalcoop' then |
@@ -1693,11 +1814,16 @@ function main.f_mainMenu() | ||
1693 | 1814 | main.p2In = 2 |
1694 | 1815 | main.p2Faces = true |
1695 | 1816 | main.coop = true |
1696 | - main.credits = 0 | |
1697 | - main.gameMode = t[item].itemname | |
1817 | + main.t_charparam.stage = true | |
1818 | + main.t_charparam.music = true | |
1819 | + main.t_charparam.zoom = true | |
1820 | + main.t_charparam.ai = true | |
1821 | + main.t_charparam.time = true | |
1822 | + main.t_charparam.onlyme = true | |
1698 | 1823 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
1699 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1700 | - select.f_selectAdvance() | |
1824 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
1825 | + setGameMode('survivalcoop') | |
1826 | + select.f_selectArranged() | |
1701 | 1827 | end |
1702 | 1828 | --TOURNAMENT |
1703 | 1829 | if t[item].itemname == 'tournament' then |
@@ -1707,15 +1833,15 @@ function main.f_mainMenu() | ||
1707 | 1833 | --TRAINING |
1708 | 1834 | if t[item].itemname == 'training' then |
1709 | 1835 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
1710 | - setRoundTime(-1) --round time disabled | |
1711 | 1836 | main.p2In = 2 |
1712 | 1837 | main.stageMenu = true |
1713 | 1838 | main.versusScreen = false --versus screen disabled |
1839 | + --uses default main.t_charparam assignment | |
1714 | 1840 | main.p2TeamMenu = {mode = 0, chars = 1} --predefined P2 team mode as Single, 1 Character |
1715 | 1841 | main.p2Char = {main.t_charDef.training} --predefined P2 character as Training by stupa |
1716 | - main.gameMode = t[item].itemname | |
1717 | 1842 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
1718 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1843 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
1844 | + setGameMode('training') | |
1719 | 1845 | select.f_selectSimple() |
1720 | 1846 | end |
1721 | 1847 | --WATCH |
@@ -1725,8 +1851,10 @@ function main.f_mainMenu() | ||
1725 | 1851 | main.aiFight = true --AI = config.Difficulty for all characters enabled |
1726 | 1852 | main.stageMenu = true |
1727 | 1853 | main.p2Faces = true |
1854 | + --uses default main.t_charparam assignment | |
1728 | 1855 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
1729 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1856 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
1857 | + setGameMode('watch') | |
1730 | 1858 | select.f_selectSimple() |
1731 | 1859 | end |
1732 | 1860 | --EXTRAS |
@@ -1737,7 +1865,7 @@ function main.f_mainMenu() | ||
1737 | 1865 | --OPTIONS |
1738 | 1866 | if t[item].itemname == 'options' then |
1739 | 1867 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
1740 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
1868 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
1741 | 1869 | --Disable screenpack scale on the menu text for showing the menu corectly. |
1742 | 1870 | main.SetDefaultScale() |
1743 | 1871 | options.f_mainCfg() --start f_mainCfg() function from script/options.lua |
@@ -1749,7 +1877,8 @@ function main.f_mainMenu() | ||
1749 | 1877 | break |
1750 | 1878 | end |
1751 | 1879 | end |
1752 | - main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1880 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
1881 | + main.f_demo(cursorPosY, moveTxt, item, t) | |
1753 | 1882 | end |
1754 | 1883 | end |
1755 | 1884 |
@@ -1767,7 +1896,9 @@ local txt_connection = main.f_createTextImg( | ||
1767 | 1896 | motif.title_info.connecting_font_scale[2], |
1768 | 1897 | motif.title_info.connecting_font[4], |
1769 | 1898 | motif.title_info.connecting_font[5], |
1770 | - motif.title_info.connecting_font[6] | |
1899 | + motif.title_info.connecting_font[6], | |
1900 | + motif.title_info.connecting_font[7], | |
1901 | + motif.title_info.connecting_font[8] | |
1771 | 1902 | ) |
1772 | 1903 | function main.f_connect(server, t) |
1773 | 1904 | local cancel = false |
@@ -1779,20 +1910,28 @@ function main.f_connect(server, t) | ||
1779 | 1910 | break |
1780 | 1911 | end |
1781 | 1912 | --draw clearcolor |
1782 | - animDraw(motif.titlebgdef.bgclearcolor_data) | |
1913 | + clearColor(motif.titlebgdef.bgclearcolor[1], motif.titlebgdef.bgclearcolor[2], motif.titlebgdef.bgclearcolor[3]) | |
1783 | 1914 | --draw layerno = 0 backgrounds |
1784 | - main.f_drawBG(motif.titlebgdef.bg_data, motif.titlebgdef.bg, 0, motif.titlebgdef.timer, {320,240}) | |
1915 | + bgDraw(motif.titlebgdef.bg, false) | |
1785 | 1916 | --draw layerno = 1 backgrounds |
1786 | - main.f_drawBG(motif.titlebgdef.bg_data, motif.titlebgdef.bg, 1, motif.titlebgdef.timer, {320,240}) | |
1917 | + bgDraw(motif.titlebgdef.bg, true) | |
1787 | 1918 | --draw menu box |
1788 | - animDraw(main.warningBox) | |
1919 | + fillRect( | |
1920 | + motif.title_info.connecting_boxbg_coords[1], | |
1921 | + motif.title_info.connecting_boxbg_coords[2], | |
1922 | + motif.title_info.connecting_boxbg_coords[3] - motif.title_info.connecting_boxbg_coords[1] + 1, | |
1923 | + motif.title_info.connecting_boxbg_coords[4] - motif.title_info.connecting_boxbg_coords[2] + 1, | |
1924 | + motif.title_info.connecting_boxbg_col[1], | |
1925 | + motif.title_info.connecting_boxbg_col[2], | |
1926 | + motif.title_info.connecting_boxbg_col[3], | |
1927 | + motif.title_info.connecting_boxbg_alpha[1], | |
1928 | + motif.title_info.connecting_boxbg_alpha[2] | |
1929 | + ) | |
1789 | 1930 | --draw text |
1790 | 1931 | for i = 1, #t do |
1791 | 1932 | textImgSetText(txt_connection, t[i]) |
1792 | 1933 | textImgDraw(txt_connection) |
1793 | 1934 | end |
1794 | - --update timer | |
1795 | - motif.titlebgdef.timer = motif.titlebgdef.timer + 1 | |
1796 | 1935 | --end loop |
1797 | 1936 | refresh() |
1798 | 1937 | end |
@@ -1809,7 +1948,7 @@ local t_mainNetplay = { | ||
1809 | 1948 | {data = textImgNew(), itemname = 'serverjoin', displayname = motif.title_info.menu_itemname_serverjoin}, |
1810 | 1949 | {data = textImgNew(), itemname = 'serverback', displayname = motif.title_info.menu_itemname_serverback}, |
1811 | 1950 | } |
1812 | -t_mainNetplay = main.f_cleanTable(t_mainNetplay) | |
1951 | +t_mainNetplay = main.f_cleanTable(t_mainNetplay, main.t_sort.title_info) | |
1813 | 1952 | |
1814 | 1953 | function main.f_mainNetplay() |
1815 | 1954 | main.f_cmdInput() |
@@ -1818,7 +1957,7 @@ function main.f_mainNetplay() | ||
1818 | 1957 | local item = 1 |
1819 | 1958 | local t = t_mainNetplay |
1820 | 1959 | while true do |
1821 | - cursorPosY, moveTxt, item = main.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1960 | + cursorPosY, moveTxt, item = main.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
1822 | 1961 | if esc() then |
1823 | 1962 | sndPlay(motif.files.snd_data, motif.title_info.cancel_snd[1], motif.title_info.cancel_snd[2]) |
1824 | 1963 | break |
@@ -1827,19 +1966,16 @@ function main.f_mainNetplay() | ||
1827 | 1966 | --HOST |
1828 | 1967 | if t[item].itemname == 'serverhost' then |
1829 | 1968 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
1830 | - main.f_connect("", main.f_extractText(motif.title_info.connecting_host, getListenPort())) | |
1969 | + main.f_connect("", main.f_extractText(motif.title_info.connecting_host_text, getListenPort())) | |
1831 | 1970 | exitNetPlay() |
1832 | 1971 | exitReplay() |
1833 | - | |
1834 | - -- Save replay with a new name | |
1835 | - tpmFileRpl1 = io.open("save/replays/netplay.replay","r") | |
1836 | - tpmFileRpl1C = tpmFileRpl1:read("*all") | |
1837 | - io.close(tpmFileRpl1) | |
1838 | - | |
1839 | - tpmFileRpl2name = os.date("%Y-%m(%b)-%d %I-%M%p-%Ss") | |
1840 | - tpmFileRpl2 = io.open("save/replays/" .. tpmFileRpl2name .. ".replay","w+") | |
1841 | - tpmFileRpl2:write(tpmFileRpl1C) | |
1842 | - io.close(tpmFileRpl2) | |
1972 | + --save replay with a new name | |
1973 | + local file = io.open("save/replays/netplay.replay", "r") | |
1974 | + local tpmFile = file:read("*all") | |
1975 | + io.close(file) | |
1976 | + file = io.open("save/replays/" .. os.date("%Y-%m(%b)-%d %I-%M%p-%Ss") .. ".replay", "w+") | |
1977 | + file:write(tpmFile) | |
1978 | + io.close(file) | |
1843 | 1979 | end |
1844 | 1980 | --JOIN |
1845 | 1981 | if t[item].itemname == 'serverjoin' then |
@@ -1852,7 +1988,7 @@ function main.f_mainNetplay() | ||
1852 | 1988 | break |
1853 | 1989 | end |
1854 | 1990 | end |
1855 | - main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1991 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
1856 | 1992 | end |
1857 | 1993 | end |
1858 | 1994 |
@@ -1860,16 +1996,11 @@ end | ||
1860 | 1996 | --; NETPLAY JOIN |
1861 | 1997 | --;=========================================================== |
1862 | 1998 | local t_netplayJoin = {} |
1863 | -t_netplayJoin[#t_netplayJoin + 1] = {data = textImgNew(), itemname = 'joinadd', displayname = motif.title_info.menu_itemname_joinadd} | |
1999 | +table.insert(t_netplayJoin, {data = textImgNew(), itemname = 'joinadd', displayname = motif.title_info.menu_itemname_joinadd}) | |
1864 | 2000 | for k, v in pairs(config.IP) do |
1865 | - t_netplayJoin[#t_netplayJoin + 1] = { | |
1866 | - data = textImgNew(), | |
1867 | - itemname = k, | |
1868 | - displayname = k, | |
1869 | - address = v | |
1870 | - } | |
2001 | + table.insert(t_netplayJoin, {data = textImgNew(), itemname = k, displayname = k, address = v}) | |
1871 | 2002 | end |
1872 | -t_netplayJoin[#t_netplayJoin + 1] = {data = textImgNew(), itemname = 'joinback', displayname = motif.title_info.menu_itemname_joinback} | |
2003 | +table.insert(t_netplayJoin, {data = textImgNew(), itemname = 'joinback', displayname = motif.title_info.menu_itemname_joinback}) | |
1873 | 2004 | |
1874 | 2005 | function main.f_netplayJoin() |
1875 | 2006 | main.f_cmdInput() |
@@ -1879,7 +2010,7 @@ function main.f_netplayJoin() | ||
1879 | 2010 | local t = t_netplayJoin |
1880 | 2011 | local t_tmp = {} |
1881 | 2012 | while true do |
1882 | - cursorPosY, moveTxt, item = main.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
2013 | + cursorPosY, moveTxt, item = main.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
1883 | 2014 | if esc() then |
1884 | 2015 | sndPlay(motif.files.snd_data, motif.title_info.cancel_snd[1], motif.title_info.cancel_snd[2]) |
1885 | 2016 | break |
@@ -1891,7 +2022,7 @@ function main.f_netplayJoin() | ||
1891 | 2022 | t_tmp = {} |
1892 | 2023 | for i = 1, #t do |
1893 | 2024 | if i ~= item then |
1894 | - t_tmp[#t_tmp + 1] = t[i] | |
2025 | + table.insert(t_tmp, t[i]) | |
1895 | 2026 | end |
1896 | 2027 | end |
1897 | 2028 | t_netplayJoin = t_tmp |
@@ -1904,10 +2035,10 @@ function main.f_netplayJoin() | ||
1904 | 2035 | --NEW ADDRESS |
1905 | 2036 | if t[item].itemname == 'joinadd' then |
1906 | 2037 | sndPlay(motif.files.snd_data, motif.title_info.cursor_move_snd[1], motif.title_info.cursor_move_snd[2]) |
1907 | - local name = main.f_input(main.f_extractText(motif.title_info.input_ip_name), motif.title_info, motif.titlebgdef, 'string') | |
2038 | + local name = main.f_input(main.f_extractText(motif.title_info.input_ip_name_text), motif.title_info, motif.titlebgdef, 'string') | |
1908 | 2039 | if name ~= '' then |
1909 | 2040 | sndPlay(motif.files.snd_data, motif.title_info.cursor_move_snd[1], motif.title_info.cursor_move_snd[2]) |
1910 | - local address = main.f_input(main.f_extractText(motif.title_info.input_ip_address), motif.title_info, motif.titlebgdef, 'string') | |
2041 | + local address = main.f_input(main.f_extractText(motif.title_info.input_ip_address_text), motif.title_info, motif.titlebgdef, 'string') | |
1911 | 2042 | if address:match('^[0-9%.]+$') then |
1912 | 2043 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
1913 | 2044 | config.IP[name] = address |
@@ -1938,12 +2069,12 @@ function main.f_netplayJoin() | ||
1938 | 2069 | --CONNECTION |
1939 | 2070 | else |
1940 | 2071 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
1941 | - main.f_connect(t[item].address, main.f_extractText(motif.title_info.connecting_join, t[item].name, t[item].address)) | |
2072 | + main.f_connect(t[item].address, main.f_extractText(motif.title_info.connecting_join_text, t[item].name, t[item].address)) | |
1942 | 2073 | exitNetPlay() |
1943 | 2074 | exitReplay() |
1944 | 2075 | end |
1945 | 2076 | end |
1946 | - main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
2077 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
1947 | 2078 | end |
1948 | 2079 | end |
1949 | 2080 |
@@ -1956,7 +2087,7 @@ local t_netplayMode = { | ||
1956 | 2087 | {data = textImgNew(), itemname = 'netplaysurvivalcoop', displayname = motif.title_info.menu_itemname_netplaysurvivalcoop, selectname = motif.select_info.title_text_netplaysurvivalcoop}, |
1957 | 2088 | {data = textImgNew(), itemname = 'netplayback', displayname = motif.title_info.menu_itemname_netplayback}, |
1958 | 2089 | } |
1959 | -t_netplayMode = main.f_cleanTable(t_netplayMode) | |
2090 | +t_netplayMode = main.f_cleanTable(t_netplayMode, main.t_sort.title_info) | |
1960 | 2091 | |
1961 | 2092 | function main.f_netplayMode() |
1962 | 2093 | main.f_cmdInput() |
@@ -1965,7 +2096,7 @@ function main.f_netplayMode() | ||
1965 | 2096 | local item = 1 |
1966 | 2097 | local t = t_netplayMode |
1967 | 2098 | while true do |
1968 | - cursorPosY, moveTxt, item = main.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
2099 | + cursorPosY, moveTxt, item = main.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
1969 | 2100 | if esc() then |
1970 | 2101 | sndPlay(motif.files.snd_data, motif.title_info.cancel_snd[1], motif.title_info.cancel_snd[2]) |
1971 | 2102 | break |
@@ -1978,7 +2109,9 @@ function main.f_netplayMode() | ||
1978 | 2109 | main.p2In = 2 |
1979 | 2110 | main.stageMenu = true |
1980 | 2111 | main.p2Faces = true |
2112 | + --uses default main.t_charparam assignment | |
1981 | 2113 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2114 | + setGameMode('netplayversus') | |
1982 | 2115 | select.f_selectSimple() |
1983 | 2116 | end |
1984 | 2117 | --TEAM CO-OP |
@@ -1987,10 +2120,18 @@ function main.f_netplayMode() | ||
1987 | 2120 | main.p2In = 2 |
1988 | 2121 | main.p2Faces = true |
1989 | 2122 | main.coop = true |
2123 | + main.t_charparam.stage = true | |
2124 | + main.t_charparam.music = true | |
2125 | + main.t_charparam.zoom = true | |
2126 | + main.t_charparam.ai = true | |
2127 | + main.t_charparam.rounds = true | |
2128 | + main.t_charparam.time = true | |
2129 | + main.t_charparam.onlyme = true | |
2130 | + main.t_charparam.rivals = true | |
1990 | 2131 | main.credits = config.Credits - 1 |
1991 | - main.gameMode = t[item].itemname | |
1992 | 2132 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
1993 | - select.f_selectAdvance() | |
2133 | + setGameMode('netplayteamcoop') | |
2134 | + select.f_selectArcade() | |
1994 | 2135 | end |
1995 | 2136 | --SURVIVAL CO-OP |
1996 | 2137 | if t[item].itemname == 'netplaysurvivalcoop' then |
@@ -1998,10 +2139,15 @@ function main.f_netplayMode() | ||
1998 | 2139 | main.p2In = 2 |
1999 | 2140 | main.p2Faces = true |
2000 | 2141 | main.coop = true |
2001 | - main.credits = 0 | |
2002 | - main.gameMode = t[item].itemname | |
2142 | + main.t_charparam.stage = true | |
2143 | + main.t_charparam.music = true | |
2144 | + main.t_charparam.zoom = true | |
2145 | + main.t_charparam.ai = true | |
2146 | + main.t_charparam.time = true | |
2147 | + main.t_charparam.onlyme = true | |
2003 | 2148 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2004 | - select.f_selectAdvance() | |
2149 | + setGameMode('netplaysurvivalcoop') | |
2150 | + select.f_selectArranged() | |
2005 | 2151 | end |
2006 | 2152 | --BACK |
2007 | 2153 | if t[item].itemname == 'netplayback' then |
@@ -2009,7 +2155,7 @@ function main.f_netplayMode() | ||
2009 | 2155 | break |
2010 | 2156 | end |
2011 | 2157 | end |
2012 | - main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
2158 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
2013 | 2159 | end |
2014 | 2160 | end |
2015 | 2161 |
@@ -2025,7 +2171,7 @@ local t_mainExtras = { | ||
2025 | 2171 | {data = textImgNew(), itemname = 'bonusgames', displayname = motif.title_info.menu_itemname_bonusgames}, |
2026 | 2172 | --{data = textImgNew(), itemname = 'scoreranking', displayname = motif.title_info.menu_itemname_scoreranking}, |
2027 | 2173 | {data = textImgNew(), itemname = 'replay', displayname = motif.title_info.menu_itemname_replay, selectname = motif.select_info.title_text_replay}, |
2028 | - {data = textImgNew(), itemname = 'demo', displayname = motif.title_info.menu_itemname_demo}, | |
2174 | + {data = textImgNew(), itemname = 'randomtest', displayname = motif.title_info.menu_itemname_randomtest}, | |
2029 | 2175 | {data = textImgNew(), itemname = 'extrasback', displayname = motif.title_info.menu_itemname_extrasback}, |
2030 | 2176 | } |
2031 | 2177 | for i = 1, #t_mainExtras do |
@@ -2033,11 +2179,11 @@ for i = 1, #t_mainExtras do | ||
2033 | 2179 | t_mainExtras[i].displayname = '' |
2034 | 2180 | elseif t_mainExtras[i].itemname == 'bonusgames' and #main.t_bonusChars == 0 then |
2035 | 2181 | t_mainExtras[i].displayname = '' |
2036 | - elseif t_mainExtras[i].itemname == 'demo' and #main.t_randomChars < 2 then | |
2182 | + elseif t_mainExtras[i].itemname == 'randomtest' and #main.t_randomChars < 2 then | |
2037 | 2183 | t_mainExtras[i].displayname = '' |
2038 | 2184 | end |
2039 | 2185 | end |
2040 | -t_mainExtras = main.f_cleanTable(t_mainExtras) | |
2186 | +t_mainExtras = main.f_cleanTable(t_mainExtras, main.t_sort.title_info) | |
2041 | 2187 | |
2042 | 2188 | function main.f_mainExtras() |
2043 | 2189 | main.f_cmdInput() |
@@ -2046,7 +2192,7 @@ function main.f_mainExtras() | ||
2046 | 2192 | local item = 1 |
2047 | 2193 | local t = t_mainExtras |
2048 | 2194 | while true do |
2049 | - cursorPosY, moveTxt, item = main.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
2195 | + cursorPosY, moveTxt, item = main.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
2050 | 2196 | if esc() then |
2051 | 2197 | sndPlay(motif.files.snd_data, motif.title_info.cancel_snd[1], motif.title_info.cancel_snd[2]) |
2052 | 2198 | break |
@@ -2058,8 +2204,10 @@ function main.f_mainExtras() | ||
2058 | 2204 | main.p2In = 1 |
2059 | 2205 | main.stageMenu = true |
2060 | 2206 | main.p2Faces = true |
2207 | + --uses default main.t_charparam assignment | |
2061 | 2208 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2062 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2209 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2210 | + setGameMode('freebattle') | |
2063 | 2211 | select.f_selectSimple() |
2064 | 2212 | end |
2065 | 2213 | --VS 100 KUMITE |
@@ -2067,21 +2215,32 @@ function main.f_mainExtras() | ||
2067 | 2215 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
2068 | 2216 | main.p2In = 1 |
2069 | 2217 | main.p2SelectMenu = false |
2070 | - main.gameMode = t[item].itemname | |
2218 | + main.t_charparam.stage = true | |
2219 | + main.t_charparam.music = true | |
2220 | + main.t_charparam.zoom = true | |
2221 | + main.t_charparam.ai = true | |
2222 | + main.t_charparam.time = true | |
2223 | + main.t_charparam.onlyme = true | |
2071 | 2224 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2072 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2073 | - select.f_selectAdvance() | |
2225 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2226 | + setGameMode('100kumite') | |
2227 | + select.f_selectArranged() | |
2074 | 2228 | end |
2075 | 2229 | --BOSS RUSH |
2076 | 2230 | if t[item].itemname == 'bossrush' then |
2077 | 2231 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
2078 | 2232 | main.p2In = 1 |
2079 | 2233 | main.p2SelectMenu = false |
2080 | - main.credits = 0 | |
2081 | - main.gameMode = t[item].itemname | |
2234 | + main.t_charparam.stage = true | |
2235 | + main.t_charparam.music = true | |
2236 | + main.t_charparam.zoom = true | |
2237 | + main.t_charparam.ai = true | |
2238 | + main.t_charparam.time = true | |
2239 | + main.t_charparam.onlyme = true | |
2082 | 2240 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2083 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2084 | - select.f_selectAdvance() | |
2241 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2242 | + setGameMode('bossrush') | |
2243 | + select.f_selectArranged() | |
2085 | 2244 | end |
2086 | 2245 | --BONUS GAMES |
2087 | 2246 | if t[item].itemname == 'bonusgames' then |
@@ -2101,10 +2260,13 @@ function main.f_mainExtras() | ||
2101 | 2260 | end |
2102 | 2261 | end |
2103 | 2262 | --DEMO |
2104 | - if t[item].itemname == 'demo' then | |
2263 | + if t[item].itemname == 'randomtest' then | |
2105 | 2264 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
2106 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2265 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2266 | + clearColor(motif.titlebgdef.bgclearcolor[1], motif.titlebgdef.bgclearcolor[2], motif.titlebgdef.bgclearcolor[3]) | |
2267 | + setGameMode('randomtest') | |
2107 | 2268 | randomtest.run() |
2269 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
2108 | 2270 | end |
2109 | 2271 | --BACK |
2110 | 2272 | if t[item].itemname == 'extrasback' then |
@@ -2112,7 +2274,7 @@ function main.f_mainExtras() | ||
2112 | 2274 | break |
2113 | 2275 | end |
2114 | 2276 | end |
2115 | - main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
2277 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
2116 | 2278 | end |
2117 | 2279 | end |
2118 | 2280 |
@@ -2130,7 +2292,7 @@ for i = 1, #main.t_bonusChars do | ||
2130 | 2292 | } |
2131 | 2293 | end |
2132 | 2294 | if motif.title_info.menu_itemname_bonusback ~= '' then |
2133 | - t_bonusExtras[#t_bonusExtras + 1] = {data = textImgNew(), itemname = 'bonusback', displayname = motif.title_info.menu_itemname_bonusback} | |
2295 | + table.insert(t_bonusExtras, {data = textImgNew(), itemname = 'bonusback', displayname = motif.title_info.menu_itemname_bonusback}) | |
2134 | 2296 | end |
2135 | 2297 | |
2136 | 2298 | function main.f_bonusExtras() |
@@ -2140,7 +2302,7 @@ function main.f_bonusExtras() | ||
2140 | 2302 | local item = 1 |
2141 | 2303 | local t = t_bonusExtras |
2142 | 2304 | while true do |
2143 | - cursorPosY, moveTxt, item = main.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
2305 | + cursorPosY, moveTxt, item = main.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
2144 | 2306 | if esc() then |
2145 | 2307 | sndPlay(motif.files.snd_data, motif.title_info.cancel_snd[1], motif.title_info.cancel_snd[2]) |
2146 | 2308 | break |
@@ -2153,17 +2315,25 @@ function main.f_bonusExtras() | ||
2153 | 2315 | --BONUS CHAR NAME |
2154 | 2316 | else |
2155 | 2317 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
2156 | - main.versusScreen = false | |
2157 | 2318 | main.p2In = 1 |
2319 | + main.versusScreen = false | |
2320 | + main.t_charparam.stage = true | |
2321 | + main.t_charparam.music = true | |
2322 | + main.t_charparam.zoom = true | |
2323 | + main.t_charparam.ai = true | |
2324 | + main.t_charparam.rounds = true | |
2325 | + main.t_charparam.time = true | |
2326 | + main.t_charparam.onlyme = true | |
2158 | 2327 | main.p1TeamMenu = {mode = 0, chars = 1} |
2159 | 2328 | main.p2TeamMenu = {mode = 0, chars = 1} |
2160 | 2329 | main.p2Char = {main.t_bonusChars[item]} |
2161 | 2330 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2162 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2331 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2332 | + setGameMode('bonus') | |
2163 | 2333 | select.f_selectSimple() |
2164 | 2334 | end |
2165 | 2335 | end |
2166 | - main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
2336 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
2167 | 2337 | end |
2168 | 2338 | end |
2169 | 2339 |
@@ -2177,7 +2347,7 @@ local t_mainTournament = { | ||
2177 | 2347 | {data = textImgNew(), itemname = 'tourney4', displayname = motif.title_info.menu_itemname_tourney4, selectname = motif.select_info.title_text_tourney4}, |
2178 | 2348 | {data = textImgNew(), itemname = 'tourneyback', displayname = motif.title_info.menu_itemname_tourneyback}, |
2179 | 2349 | } |
2180 | -t_mainTournament = main.f_cleanTable(t_mainTournament) | |
2350 | +t_mainTournament = main.f_cleanTable(t_mainTournament, main.t_sort.title_info) | |
2181 | 2351 | |
2182 | 2352 | function main.f_mainTournament() |
2183 | 2353 | main.f_cmdInput() |
@@ -2186,7 +2356,7 @@ function main.f_mainTournament() | ||
2186 | 2356 | local item = 1 |
2187 | 2357 | local t = t_mainTournament |
2188 | 2358 | while true do |
2189 | - cursorPosY, moveTxt, item = main.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
2359 | + cursorPosY, moveTxt, item = main.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
2190 | 2360 | if esc() then |
2191 | 2361 | sndPlay(motif.files.snd_data, motif.title_info.cancel_snd[1], motif.title_info.cancel_snd[2]) |
2192 | 2362 | break |
@@ -2195,34 +2365,62 @@ function main.f_mainTournament() | ||
2195 | 2365 | --ROUND OF 32 |
2196 | 2366 | if t[item].itemname == 'tourney32' then |
2197 | 2367 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
2198 | - main.gameMode = t[item].itemname | |
2368 | + main.t_charparam.stage = true | |
2369 | + main.t_charparam.music = true | |
2370 | + main.t_charparam.zoom = true | |
2371 | + main.t_charparam.ai = true | |
2372 | + main.t_charparam.rounds = true | |
2373 | + main.t_charparam.time = true | |
2374 | + main.t_charparam.onlyme = true | |
2199 | 2375 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2200 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2201 | - select.f_selectTournament() | |
2376 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2377 | + setGameMode('tournament') | |
2378 | + select.f_selectTournament(32) | |
2202 | 2379 | end |
2203 | 2380 | --ROUND OF 16 |
2204 | 2381 | if t[item].itemname == 'tourney16' then |
2205 | 2382 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
2206 | - main.gameMode = t[item].itemname | |
2383 | + main.t_charparam.stage = true | |
2384 | + main.t_charparam.music = true | |
2385 | + main.t_charparam.zoom = true | |
2386 | + main.t_charparam.ai = true | |
2387 | + main.t_charparam.rounds = true | |
2388 | + main.t_charparam.time = true | |
2389 | + main.t_charparam.onlyme = true | |
2207 | 2390 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2208 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2209 | - select.f_selectTournament() | |
2391 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2392 | + setGameMode('tournament') | |
2393 | + select.f_selectTournament(16) | |
2210 | 2394 | end |
2211 | 2395 | --QUARTERFINALS |
2212 | 2396 | if t[item].itemname == 'tourney8' then |
2213 | 2397 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
2214 | - main.gameMode = t[item].itemname | |
2398 | + main.t_charparam.stage = true | |
2399 | + main.t_charparam.music = true | |
2400 | + main.t_charparam.zoom = true | |
2401 | + main.t_charparam.ai = true | |
2402 | + main.t_charparam.rounds = true | |
2403 | + main.t_charparam.time = true | |
2404 | + main.t_charparam.onlyme = true | |
2215 | 2405 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2216 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2217 | - select.f_selectTournament() | |
2406 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2407 | + setGameMode('tournament') | |
2408 | + select.f_selectTournament(8) | |
2218 | 2409 | end |
2219 | 2410 | --SEMIFINALS |
2220 | 2411 | if t[item].itemname == 'tourney4' then |
2221 | 2412 | sndPlay(motif.files.snd_data, motif.title_info.cursor_done_snd[1], motif.title_info.cursor_done_snd[2]) |
2222 | - main.gameMode = t[item].itemname | |
2413 | + main.t_charparam.stage = true | |
2414 | + main.t_charparam.music = true | |
2415 | + main.t_charparam.zoom = true | |
2416 | + main.t_charparam.ai = true | |
2417 | + main.t_charparam.rounds = true | |
2418 | + main.t_charparam.time = true | |
2419 | + main.t_charparam.onlyme = true | |
2223 | 2420 | textImgSetText(main.txt_mainSelect, t[item].selectname) |
2224 | - main.f_menuFadeOut(cursorPosY, moveTxt, item, t) | |
2225 | - select.f_selectTournament() | |
2421 | + main.f_menuFade('title_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
2422 | + setGameMode('tournament') | |
2423 | + select.f_selectTournament(4) | |
2226 | 2424 | end |
2227 | 2425 | --BACK |
2228 | 2426 | if t[item].itemname == 'tourneyback' then |
@@ -2230,20 +2428,17 @@ function main.f_mainTournament() | ||
2230 | 2428 | break |
2231 | 2429 | end |
2232 | 2430 | end |
2233 | - main.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
2431 | + main.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
2234 | 2432 | end |
2235 | 2433 | end |
2236 | 2434 | |
2237 | 2435 | --;=========================================================== |
2238 | 2436 | --; INITIALIZE LOOPS |
2239 | 2437 | --;=========================================================== |
2240 | - | |
2241 | 2438 | -- Now that everithig is loaded we can enable GC back. |
2242 | 2439 | SetGCPercent(100) |
2243 | -------------------------------------------------------------- | |
2244 | 2440 | |
2245 | 2441 | main.f_mainMenu() |
2246 | 2442 | |
2247 | - | |
2248 | 2443 | -- Debug Info |
2249 | -main.f_printTable(main, "debug/t_main.txt") | |
2444 | +--main.f_printTable(main, "debug/t_main.txt") |
@@ -1,10 +1,50 @@ | ||
1 | 1 | --;=========================================================== |
2 | +--; LOCALCOORD VALUES | |
3 | +--;=========================================================== | |
4 | + | |
5 | +local def = config.Motif | |
6 | +if main.flags['-r'] ~= nil then | |
7 | + local case = main.flags['-r']:lower() | |
8 | + if case:match('^data[/\\]') and main.f_fileExists(main.flags['-r']) then | |
9 | + def = main.flags['-r'] | |
10 | + elseif case:match('%.def$') and main.f_fileExists('data/' .. main.flags['-r']) then | |
11 | + def = 'data/' .. main.flags['-r'] | |
12 | + elseif main.f_fileExists('data/' .. main.flags['-r'] .. '/system.def') then | |
13 | + def = 'data/' .. main.flags['-r'] .. '/system.def' | |
14 | + end | |
15 | +end | |
16 | + | |
17 | +local file = io.open(def, 'r') | |
18 | +local s_file = file:read("*all") | |
19 | +file:close() | |
20 | +local localX, localY = s_file:match('localcoord%s*=%s*(%d+)%s*,%s*(%d+)') | |
21 | +--local scaleX = 1 | |
22 | +--local scaleY = 1 | |
23 | +if localX ~= nil then | |
24 | + localX = tonumber(localX) | |
25 | + --scaleX = localX / 320 | |
26 | +else | |
27 | + localX = 320 | |
28 | +end | |
29 | +if localY ~= nil then | |
30 | + localY = tonumber(localY) | |
31 | + --scaleY = localY / 240 | |
32 | +else | |
33 | + localY = 240 | |
34 | +end | |
35 | +--local coords_fix = 0 | |
36 | +--if scaleY > 1 then | |
37 | +-- coords_fix = math.floor(scaleY - 1) | |
38 | +--end | |
39 | + | |
40 | +--;=========================================================== | |
2 | 41 | --; DEFAULT VALUES |
3 | 42 | --;=========================================================== |
4 | 43 | --This pre-made table (3/4 of the whole file) contains all default values used in screenpack. New table from parsed DEF file is merged on top of this one. |
5 | 44 | --This is important because there are more params available in Ikemen. Whole screenpack code refers to these values. |
6 | 45 | local motif = |
7 | 46 | { |
47 | + def = def, | |
8 | 48 | info = |
9 | 49 | { |
10 | 50 | name = 'Default', |
@@ -22,20 +62,15 @@ local motif = | ||
22 | 62 | intro_storyboard = '', |
23 | 63 | select = 'data/select.def', |
24 | 64 | fight = 'data/fight.def', |
25 | - debug_font = 'font/f-6x9.fnt', --Ikemen feature | |
65 | + debug_font = 'f-6x9.def', --Ikemen feature | |
26 | 66 | debug_script = 'script/debug.lua', --Ikemen feature |
27 | - font = --FNT v2 fonts not supported yet | |
67 | + font = | |
28 | 68 | { |
29 | - [1] = 'font/f-4x6.fnt', | |
30 | - [2] = 'font/f-6x9.fnt', | |
31 | - [3] = 'font/jg.fnt', | |
32 | - }, | |
33 | - font_height = --Truetype fonts not supported yet | |
34 | - { | |
35 | - [1] = nil, | |
36 | - [2] = nil, | |
37 | - [3] = nil, | |
69 | + [1] = 'f-4x6.def', | |
70 | + [2] = 'f-6x9.def', | |
71 | + [3] = 'jg.fnt', | |
38 | 72 | }, |
73 | + font_height = {} | |
39 | 74 | }, |
40 | 75 | ja_files = {}, --not used in Ikemen |
41 | 76 | music = |
@@ -43,43 +78,48 @@ local motif = | ||
43 | 78 | title_bgm = '', |
44 | 79 | title_bgm_volume = 100, |
45 | 80 | title_bgm_loop = 1, |
46 | - title_bgm_loopstart = nil, | |
47 | - title_bgm_loopend = nil, | |
81 | + title_bgm_loopstart = 0, | |
82 | + title_bgm_loopend = 0, | |
48 | 83 | select_bgm = '', |
49 | 84 | select_bgm_volume = 100, |
50 | 85 | select_bgm_loop = 1, |
51 | - select_bgm_loopstart = nil, | |
52 | - select_bgm_loopend = nil, | |
86 | + select_bgm_loopstart = 0, | |
87 | + select_bgm_loopend = 0, | |
53 | 88 | vs_bgm = '', |
54 | 89 | vs_bgm_volume = 100, |
55 | 90 | vs_bgm_loop = 1, |
56 | - vs_bgm_loopstart = nil, | |
57 | - vs_bgm_loopend = nil, | |
91 | + vs_bgm_loopstart = 0, | |
92 | + vs_bgm_loopend = 0, | |
58 | 93 | victory_bgm = '', |
59 | 94 | victory_bgm_volume = 100, |
60 | 95 | victory_bgm_loop = 1, |
61 | - victory_bgm_loopstart = nil, | |
62 | - victory_bgm_loopend = nil, | |
96 | + victory_bgm_loopstart = 0, | |
97 | + victory_bgm_loopend = 0, | |
98 | + option_bgm = '', --Ikemen feature | |
99 | + option_bgm_volume = 100, --Ikemen feature | |
100 | + option_bgm_loop = 1, --Ikemen feature | |
101 | + option_bgm_loopstart = 0, --Ikemen feature | |
102 | + option_bgm_loopend = 0, --Ikemen feature | |
63 | 103 | continue_bgm = 'sound/CONTINUE.ogg', --Ikemen feature |
64 | 104 | continue_bgm_volume = 100, --Ikemen feature |
65 | 105 | continue_bgm_loop = 1, --Ikemen feature |
66 | - continue_bgm_loopstart = nil, --Ikemen feature | |
67 | - continue_bgm_loopend = nil, --Ikemen feature | |
106 | + continue_bgm_loopstart = 0, --Ikemen feature | |
107 | + continue_bgm_loopend = 0, --Ikemen feature | |
68 | 108 | continue_end_bgm = 'sound/GAME_OVER.ogg', --Ikemen feature |
69 | 109 | continue_end_bgm_volume = 100, --Ikemen feature |
70 | 110 | continue_end_bgm_loop = 0, --Ikemen feature |
71 | - continue_end_bgm_loopstart = nil, --Ikemen feature | |
72 | - continue_end_bgm_loopend = nil, --Ikemen feature | |
111 | + continue_end_bgm_loopstart = 0, --Ikemen feature | |
112 | + continue_end_bgm_loopend = 0, --Ikemen feature | |
73 | 113 | results_bgm = '', --Ikemen feature |
74 | 114 | results_bgm_volume = 100, --Ikemen feature |
75 | 115 | results_bgm_loop = 1, --Ikemen feature |
76 | - results_bgm_loopstart = nil, --Ikemen feature | |
77 | - results_bgm_loopend = nil, --Ikemen feature | |
116 | + results_bgm_loopstart = 0, --Ikemen feature | |
117 | + results_bgm_loopend = 0, --Ikemen feature | |
78 | 118 | tournament_bgm = '', --Ikemen feature |
79 | 119 | tournament_bgm_volume = 100, --Ikemen feature |
80 | 120 | tournament_bgm_loop = 1, --Ikemen feature |
81 | - tournament_bgm_loopstart = nil, --Ikemen feature | |
82 | - tournament_bgm_loopend = nil, --Ikemen feature | |
121 | + tournament_bgm_loopstart = 0, --Ikemen feature | |
122 | + tournament_bgm_loopend = 0, --Ikemen feature | |
83 | 123 | }, |
84 | 124 | title_info = |
85 | 125 | { |
@@ -87,52 +127,56 @@ local motif = | ||
87 | 127 | fadein_col = {0, 0, 0}, --Ikemen feature |
88 | 128 | fadeout_time = 10, |
89 | 129 | fadeout_col = {0, 0, 0}, --Ikemen feature |
90 | - loading_offset = {310, 230}, --Ikemen feature | |
91 | - loading_font = {'font/f-4x6.fnt', 7, -1, nil, nil, nil}, --Ikemen feature | |
130 | + loading_offset = {localX - 10, localY - 10}, --Ikemen feature (310, 230) | |
131 | + loading_font = {'f-4x6.def', 7, -1, 255, 255, 255, 255, 0}, --Ikemen feature | |
92 | 132 | loading_font_scale = {1.0, 1.0}, --Ikemen feature |
93 | 133 | loading_text = 'LOADING...', --Ikemen feature |
94 | - footer1_offset = {2, 240}, --Ikemen feature | |
95 | - footer1_font = {'font/f-4x6.fnt', 7, 1, nil, nil, nil}, --Ikemen feature | |
134 | + footer1_offset = {2, localY}, --Ikemen feature (2, 240) | |
135 | + footer1_font = {'f-4x6.def', 7, 1, 255, 255, 255, 255, 0}, --Ikemen feature | |
96 | 136 | footer1_font_scale = {1.0, 1.0}, --Ikemen feature |
97 | - footer1_text = 'I.K.E.M.E.N. by SUEHIRO', --Ikemen feature | |
98 | - footer2_offset = {160, 240}, --Ikemen feature | |
99 | - footer2_font = {'font/f-4x6.fnt', 7, 0, nil, nil, nil}, --Ikemen feature | |
137 | + footer1_text = 'I.K.E.M.E.N. GO', --Ikemen feature | |
138 | + footer2_offset = {localX / 2, localY}, --Ikemen feature (160, 240) | |
139 | + footer2_font = {'f-4x6.def', 7, 0, 255, 255, 255, 255, 0}, --Ikemen feature | |
100 | 140 | footer2_font_scale = {1.0, 1.0}, --Ikemen feature |
101 | - footer2_text = '', --Ikemen feature | |
102 | - footer3_offset = {319, 240}, --Ikemen feature | |
103 | - footer3_font = {'font/f-4x6.fnt', 7, -1, nil, nil, nil}, --Ikemen feature | |
141 | + footer2_text = 'Press F1 for info', --Ikemen feature | |
142 | + footer3_offset = {localX - 1, localY}, --Ikemen feature (319, 240) | |
143 | + footer3_font = {'f-4x6.def', 7, -1, 255, 255, 255, 255, 0}, --Ikemen feature | |
104 | 144 | footer3_font_scale = {1.0, 1.0}, --Ikemen feature |
105 | - footer3_text = 'https://osdn.net/users/supersuehiro/', --Ikemen feature | |
106 | - footer_boxbackground_visible = 1, --Ikemen feature | |
107 | - footer_boxbackground_coords = {0, 233, 319, 239}, --Ikemen feature | |
108 | - footer_boxbackground_alpha = {255, 100}, --Ikemen feature | |
145 | + footer3_text = 'Plus v0.9', --Ikemen feature | |
146 | + footer_boxbg_visible = 1, --Ikemen feature | |
147 | + footer_boxbg_coords = {0, localY - 7, localX - 1, localY - 1}, --Ikemen feature (0, 233, 319, 239) | |
148 | + footer_boxbg_col = {0, 0, 64}, --Ikemen feature | |
149 | + footer_boxbg_alpha = {255, 100}, --Ikemen feature | |
109 | 150 | connecting_offset = {10, 40}, --Ikemen feature |
110 | - connecting_font = {'font/f-6x9.fnt', 0, 1, nil, nil, nil}, --Ikemen feature | |
151 | + connecting_font = {'f-6x9.def', 0, 1, 255, 255, 255, 255, 0}, --Ikemen feature | |
111 | 152 | connecting_font_scale = {1.0, 1.0}, --Ikemen feature |
112 | - connecting_host = 'Waiting for player 2... (%s)', --Ikemen feature | |
113 | - connecting_join = 'Now connecting... (%s)', --Ikemen feature | |
114 | - input_ip_name = 'Enter Host display name, e.g. John.\nExisting entries can be removed with DELETE button.', --Ikemen feature | |
115 | - input_ip_address = 'Enter Host IP address, e.g. 127.0.0.1\nCopied text can be pasted with INSERT button.', --Ikemen feature | |
153 | + connecting_host_text = 'Waiting for player 2... (%s)', --Ikemen feature | |
154 | + connecting_join_text = 'Now connecting... (%s)', --Ikemen feature | |
155 | + connecting_boxbg_coords = {0, 0, localX, localY}, --Ikemen feature (0, 0, 320, 240) | |
156 | + connecting_boxbg_col = {0, 0, 0}, --Ikemen feature | |
157 | + connecting_boxbg_alpha = {20, 100}, --Ikemen feature | |
158 | + input_ip_name_text = 'Enter Host display name, e.g. John.\nExisting entries can be removed with DELETE button.', --Ikemen feature | |
159 | + input_ip_address_text = 'Enter Host IP address, e.g. 127.0.0.1\nCopied text can be pasted with INSERT button.', --Ikemen feature | |
116 | 160 | menu_pos = {159, 158}, |
117 | - menu_item_font = {'font/f-6x9.fnt', 7, 0, nil, nil, nil}, | |
118 | - menu_item_font_scale = {1.0, 1.0}, | |
119 | - menu_item_active_font = {'font/f-6x9.fnt', 0, 0, nil, nil, nil}, | |
120 | - menu_item_active_font_scale = {1.0, 1.0}, | |
161 | + menu_item_font = {'f-6x9.def', 7, 0, 255, 255, 255, 255, 0}, | |
162 | + menu_item_font_scale = {1.0, 1.0}, --broken parameter in mugen 1.1: http://mugenguild.com/forum/msg.1905756 | |
163 | + menu_item_active_font = {'f-6x9.def', 0, 0, 255, 255, 255, 255, 0}, | |
164 | + menu_item_active_font_scale = {1.0, 1.0}, --broken parameter in mugen 1.1: http://mugenguild.com/forum/msg.1905756 | |
121 | 165 | menu_item_spacing = {0, 13}, |
122 | 166 | menu_itemname_arcade = 'ARCADE', |
123 | 167 | menu_itemname_versus = 'VS MODE', |
124 | - menu_itemname_online = 'NETWORK', --Ikemen feature | |
125 | - menu_itemname_teamarcade = 'TEAM ARCADE', --not used in Ikemen (same as ARCADE) | |
126 | - menu_itemname_teamversus = 'TEAM VS', --not used in Ikemen (same as VS MODE) | |
168 | + menu_itemname_teamarcade = 'TEAM ARCADE', | |
169 | + menu_itemname_teamversus = 'TEAM VERSUS', | |
170 | + menu_itemname_online = '', --Ikemen feature (NETWORK) | |
127 | 171 | menu_itemname_teamcoop = 'TEAM CO-OP', |
128 | 172 | menu_itemname_survival = 'SURVIVAL', |
129 | 173 | menu_itemname_survivalcoop = 'SURVIVAL CO-OP', |
130 | - menu_itemname_storymode = 'STORY MODE', --Ikemen feature (not implemented yet) | |
131 | - menu_itemname_timeattack = 'TIME ATTACK', --Ikemen feature (not implemented yet) | |
132 | - menu_itemname_tournament = 'TOURNAMENT', --Ikemen feature | |
174 | + menu_itemname_storymode = '', --Ikemen feature (STORY MODE, not implemented yet) | |
175 | + menu_itemname_timeattack = '', --Ikemen feature (TIME ATTACK, not implemented yet) | |
176 | + menu_itemname_tournament = '', --Ikemen feature (TOURNAMENT, not implemented yet) | |
133 | 177 | menu_itemname_training = 'TRAINING', |
134 | 178 | menu_itemname_watch = 'WATCH', |
135 | - menu_itemname_extras = 'EXTRAS', --Ikemen feature | |
179 | + menu_itemname_extras = '', --Ikemen feature (EXTRAS) | |
136 | 180 | menu_itemname_options = 'OPTIONS', |
137 | 181 | menu_itemname_exit = 'EXIT', |
138 | 182 | menu_itemname_netplayversus = 'VS MODE', --Ikemen feature |
@@ -147,7 +191,7 @@ local motif = | ||
147 | 191 | menu_itemname_bonusgames = 'BONUS GAMES', --Ikemen feature |
148 | 192 | menu_itemname_scoreranking = 'SCORE RANKING', --Ikemen feature (not implemented yet) |
149 | 193 | menu_itemname_replay = 'REPLAY', --Ikemen feature |
150 | - menu_itemname_demo = 'DEMO', --Ikemen feature | |
194 | + menu_itemname_randomtest = 'DEMO', --Ikemen feature | |
151 | 195 | menu_itemname_extrasback = 'BACK', --Ikemen feature |
152 | 196 | menu_itemname_bonusback = 'BACK', --Ikemen feature |
153 | 197 | menu_itemname_tourney32 = 'ROUND OF 32', --Ikemen feature |
@@ -164,6 +208,8 @@ local motif = | ||
164 | 208 | menu_window_visibleitems = 5, |
165 | 209 | menu_boxcursor_visible = 1, |
166 | 210 | menu_boxcursor_coords = {-40, -10, 39, 2}, |
211 | + menu_boxcursor_col = {255, 255, 255}, --Ikemen feature | |
212 | + menu_boxcursor_alpharange = {10, 40, 2, 255, 255, 0}, --Ikemen feature | |
167 | 213 | cursor_move_snd = {100, 0}, |
168 | 214 | cursor_done_snd = {100, 1}, |
169 | 215 | cancel_snd = {100, 2}, |
@@ -172,21 +218,21 @@ local motif = | ||
172 | 218 | { |
173 | 219 | spr = '', |
174 | 220 | bgclearcolor = {0, 0, 0}, |
175 | - bg = {}, | |
176 | - timer = 0, --Ikemen feature | |
177 | 221 | }, |
178 | 222 | infobox = |
179 | 223 | { |
180 | - title = 'I.K.E.M.E.N', --Ikemen feature | |
224 | + title = '', --Ikemen feature | |
181 | 225 | title_pos = {159, 13}, --Ikemen feature |
182 | - title_font = {'font/f-6x9.fnt', 0, 0, nil, nil, nil}, --Ikemen feature | |
226 | + title_font = {'f-6x9.def', 0, 0, 255, 255, 255, 255, 0}, --Ikemen feature | |
183 | 227 | title_font_scale = {1.0, 1.0}, --Ikemen feature |
184 | - text = "Welcome to I.K.E.M.E.N beta!\n* This is a public development release, for testing purposes.\n* This build isn't stable and may contain bugs and incomplete features.\n* Your help and cooperation are appreciated!\n* Source code: https://osdn.net/users/supersuehiro/\n* Ikemen Plus feedback:\n http://mugenguild.com/forum/topics/ikemen-plus-181972.200.html", --Ikemen feature (requires new 'text = ' entry under [Infobox] section) | |
228 | + text = "Welcome to SUEHIRO's I.K.E.M.E.N GO engine!\n\n* This is a public development release, for testing purposes.\n* This build may contain bugs and incomplete features.\n* Your help and cooperation are appreciated!\n* I.K.E.M.E.N GO source code: https://osdn.net/users/supersuehiro/\n* Ikemen GO Plus source code: https://github.com/K4thos/Ikemen-GO-Plus", --Ikemen feature (requires new 'text = ' entry under [Infobox] section) | |
185 | 229 | text_pos = {25, 30}, --Ikemen feature |
186 | - text_font = {'font/f-4x6.fnt', 7, 1, nil, nil, nil}, --Ikemen feature | |
230 | + text_font = {'f-4x6.def', 7, 1, 255, 255, 255, 255, 0}, --Ikemen feature | |
187 | 231 | text_font_scale = {1.0, 1.0}, --Ikemen feature |
188 | 232 | text_spacing = {0, 10}, --Ikemen feature |
189 | - background_alpha = {20, 100}, --Ikemen feature | |
233 | + boxbg_coords = {0, 0, localX, localY}, --Ikemen feature (0, 0, 320, 240) | |
234 | + boxbg_col = {0, 0, 0}, --Ikemen feature | |
235 | + boxbg_alpha = {20, 100}, --Ikemen feature | |
190 | 236 | }, |
191 | 237 | infobox_text = '', --not used in Ikemen |
192 | 238 | ja_infobox_text = '', --not used in Ikemen |
@@ -211,19 +257,17 @@ local motif = | ||
211 | 257 | searchemptyboxesup = 0, --Ikemen feature |
212 | 258 | searchemptyboxesdown = 0, --Ikemen feature |
213 | 259 | cell_size = {27, 27}, |
214 | - cell_spacing = 2, | |
260 | + cell_spacing = {2, 2}, --Ikemen feature (optionally accepts x, y values instead of a single one for both coordinates) | |
215 | 261 | --cell_bg_anim = nil, |
216 | 262 | cell_bg_spr = {}, |
217 | 263 | cell_bg_offset = {0, 0}, |
218 | 264 | cell_bg_facing = 1, |
219 | 265 | cell_bg_scale = {1.0, 1.0}, |
220 | - --cell_bg_alpha = {}, --Ikemen feature (not implemented yet) | |
221 | 266 | --cell_random_anim = nil, |
222 | 267 | cell_random_spr = {}, |
223 | 268 | cell_random_offset = {0, 0}, |
224 | 269 | cell_random_facing = 1, |
225 | 270 | cell_random_scale = {1.0, 1.0}, |
226 | - --cell_random_alpha = {}, --Ikemen feature (not implemented yet) | |
227 | 271 | cell_random_switchtime = 4, |
228 | 272 | p1_cursor_startcell = {0, 0}, |
229 | 273 | --p1_cursor_active_anim = nil, |
@@ -262,10 +306,12 @@ local motif = | ||
262 | 306 | portrait_offset = {0, 0}, --not supported yet |
263 | 307 | portrait_scale = {1.0, 1.0}, |
264 | 308 | title_offset = {0, 0}, |
265 | - title_font = {'font/jg.fnt', 0, 0, nil, nil, nil}, | |
309 | + title_font = {'jg.fnt', 0, 0, 255, 255, 255, 255, 0}, | |
266 | 310 | title_font_scale = {1.0, 1.0}, |
267 | 311 | title_text_arcade = 'Arcade', --Ikemen feature |
268 | 312 | title_text_versus = 'Versus Mode', --Ikemen feature |
313 | + title_text_teamarcade = 'Team Arcade', --Ikemen feature | |
314 | + title_text_teamversus = 'Team Versus', --Ikemen feature | |
269 | 315 | title_text_teamcoop = 'Team Cooperative', --Ikemen feature |
270 | 316 | title_text_survival = 'Survival', --Ikemen feature |
271 | 317 | title_text_survivalcoop = 'Survival Cooperative', --Ikemen feature |
@@ -291,37 +337,61 @@ local motif = | ||
291 | 337 | p1_face_facing = 1, |
292 | 338 | p1_face_scale = {1.0, 1.0}, |
293 | 339 | p1_face_window = {0, 0, 0, 0}, |
294 | - p1_face_spacing = {0, 0}, --Ikemen feature | |
295 | 340 | p1_face_num = 1, --Ikemen feature |
341 | + p1_face_spacing = {0, 0}, --Ikemen feature | |
342 | + p1_c1_face_offset = {0, 0}, --Ikemen feature | |
343 | + p1_c1_face_scale = {1.0, 1.0}, --Ikemen feature | |
344 | + p1_c2_face_offset = {0, 0}, --Ikemen feature | |
345 | + p1_c2_face_scale = {1.0, 1.0}, --Ikemen feature | |
346 | + p1_c3_face_offset = {0, 0}, --Ikemen feature | |
347 | + p1_c3_face_scale = {1.0, 1.0}, --Ikemen feature | |
348 | + p1_c4_face_offset = {0, 0}, --Ikemen feature | |
349 | + p1_c4_face_scale = {1.0, 1.0}, --Ikemen feature | |
296 | 350 | p2_face_spr = {9000, 1}, |
297 | 351 | p2_face_offset = {0, 0}, |
298 | 352 | p2_face_facing = -1, |
299 | 353 | p2_face_scale = {1.0, 1.0}, |
300 | 354 | p2_face_window = {0, 0, 0, 0}, |
301 | - p2_face_spacing = {0, 0}, --Ikemen feature | |
302 | 355 | p2_face_num = 1, --Ikemen feature |
356 | + p2_face_spacing = {0, 0}, --Ikemen feature | |
357 | + p2_c1_face_offset = {0, 0}, --Ikemen feature | |
358 | + p2_c1_face_scale = {1.0, 1.0}, --Ikemen feature | |
359 | + p2_c2_face_offset = {0, 0}, --Ikemen feature | |
360 | + p1_c2_face_scale = {1.0, 1.0}, --Ikemen feature | |
361 | + p2_c3_face_offset = {0, 0}, --Ikemen feature | |
362 | + p2_c3_face_scale = {1.0, 1.0}, --Ikemen feature | |
363 | + p2_c4_face_offset = {0, 0}, --Ikemen feature | |
364 | + p2_c4_face_scale = {1.0, 1.0}, --Ikemen feature | |
303 | 365 | p1_name_offset = {0, 0}, |
304 | - p1_name_font = {'font/jg.fnt', 4, 1, nil, nil, nil}, | |
366 | + p1_name_font = {'jg.fnt', 4, 1, 255, 255, 255, 255, 0}, | |
305 | 367 | p1_name_font_scale = {1.0, 1.0}, |
306 | 368 | p1_name_spacing = {0, 14}, |
307 | 369 | p2_name_offset = {0, 0}, |
308 | - p2_name_font = {'font/jg.fnt', 1, -1, nil, nil, nil}, | |
370 | + p2_name_font = {'jg.fnt', 1, -1, 255, 255, 255, 255, 0}, | |
309 | 371 | p2_name_font_scale = {1.0, 1.0}, |
310 | 372 | p2_name_spacing = {0, 14}, |
311 | 373 | stage_pos = {0, 0}, |
312 | - stage_active_font = {'font/f-4x6.fnt', 0, 0, nil, nil, nil}, | |
374 | + stage_active_font = {'f-4x6.def', 0, 0, 255, 255, 255, 255, 0}, | |
313 | 375 | stage_active_font_scale = {1.0, 1.0}, |
314 | - stage_active2_font = {'font/f-4x6.fnt', 0, 0, nil, nil, nil}, | |
376 | + stage_active2_font = {'f-4x6.def', 0, 0, 255, 255, 255, 255, 0}, | |
315 | 377 | stage_active2_font_scale = {1.0, 1.0}, |
316 | - stage_done_font = {'font/f-4x6.fnt', 0, 0, nil, nil, nil}, | |
378 | + stage_done_font = {'f-4x6.def', 0, 0, 255, 255, 255, 255, 0}, | |
317 | 379 | stage_done_font_scale = {1.0, 1.0}, |
318 | 380 | stage_text = 'Stage %i: %s', --Ikemen feature |
381 | + stage_random_text = 'Stage: Random', --Ikemen feature | |
319 | 382 | stage_text_spacing = {0, 14}, --Ikemen feature |
383 | + stage_portrait_spr = {9000, 0}, --Ikemen feature | |
384 | + stage_portrait_offset = {0, 0}, --Ikemen feature | |
385 | + stage_portrait_scale = {1.0, 1.0}, --Ikemen feature | |
386 | + stage_portrait_random_spr = {}, --Ikemen feature | |
387 | + --stage_portrait_random_anim = nil, --Ikemen feature | |
388 | + stage_portrait_random_offset = {0, 0}, --Ikemen feature | |
389 | + stage_portrait_random_scale = {1.0, 1.0}, --Ikemen feature | |
320 | 390 | teammenu_move_wrapping = 1, |
321 | 391 | teammenu_itemname_single = 'Single', --Ikemen feature |
322 | 392 | teammenu_itemname_simul = 'Simul', --Ikemen feature |
323 | 393 | teammenu_itemname_turns = 'Turns', --Ikemen feature |
324 | - teammenu_itemname_tag = 'Tag', --Ikemen feature | |
394 | + teammenu_itemname_tag = '', --Ikemen feature (Tag) | |
325 | 395 | p1_teammenu_pos = {0, 0}, |
326 | 396 | --p1_teammenu_bg_anim = nil, |
327 | 397 | p1_teammenu_bg_spr = {}, |
@@ -333,7 +403,7 @@ local motif = | ||
333 | 403 | p1_teammenu_selftitle_offset = {0, 0}, |
334 | 404 | p1_teammenu_selftitle_facing = 1, |
335 | 405 | p1_teammenu_selftitle_scale = {1.0, 1.0}, |
336 | - p1_teammenu_selftitle_font = {'font/jg.fnt', 0, 1, nil, nil, nil}, | |
406 | + p1_teammenu_selftitle_font = {'jg.fnt', 0, 1, 255, 255, 255, 255, 0}, | |
337 | 407 | p1_teammenu_selftitle_font_scale = {1.0, 1.0}, |
338 | 408 | p1_teammenu_selftitle_text = '', |
339 | 409 | --p1_teammenu_enemytitle_anim = nil, |
@@ -341,7 +411,7 @@ local motif = | ||
341 | 411 | p1_teammenu_enemytitle_offset = {0, 0}, |
342 | 412 | p1_teammenu_enemytitle_facing = 1, |
343 | 413 | p1_teammenu_enemytitle_scale = {1.0, 1.0}, |
344 | - p1_teammenu_enemytitle_font = {'font/jg.fnt', 0, 1, nil, nil, nil}, | |
414 | + p1_teammenu_enemytitle_font = {'jg.fnt', 0, 1, 255, 255, 255, 255, 0}, | |
345 | 415 | p1_teammenu_enemytitle_font_scale = {1.0, 1.0}, |
346 | 416 | p1_teammenu_enemytitle_text = '', |
347 | 417 | p1_teammenu_move_snd = {100, 0}, |
@@ -350,11 +420,11 @@ local motif = | ||
350 | 420 | p1_teammenu_item_offset = {0, 0}, |
351 | 421 | p1_teammenu_item_spacing = {0, 15}, |
352 | 422 | p1_teammenu_item_font_offset = {0, 0}, --Ikemen feature |
353 | - p1_teammenu_item_font = {'font/jg.fnt', 0, 1, nil, nil, nil}, | |
423 | + p1_teammenu_item_font = {'jg.fnt', 0, 1, 255, 255, 255, 255, 0}, | |
354 | 424 | p1_teammenu_item_font_scale = {1.0, 1.0}, |
355 | - p1_teammenu_item_active_font = {'font/jg.fnt', 3, 1, nil, nil, nil}, | |
425 | + p1_teammenu_item_active_font = {'jg.fnt', 3, 1, 255, 255, 255, 255, 0}, | |
356 | 426 | p1_teammenu_item_active_font_scale = {1.0, 1.0}, |
357 | - p1_teammenu_item_active2_font = {'font/jg.fnt', 0, 1, nil, nil, nil}, | |
427 | + p1_teammenu_item_active2_font = {'jg.fnt', 0, 1, 255, 255, 255, 255, 0}, | |
358 | 428 | p1_teammenu_item_active2_font_scale = {1.0, 1.0}, |
359 | 429 | --p1_teammenu_item_cursor_anim = nil, |
360 | 430 | p1_teammenu_item_cursor_spr = {}, |
@@ -383,7 +453,7 @@ local motif = | ||
383 | 453 | p2_teammenu_selftitle_offset = {0, 0}, |
384 | 454 | p2_teammenu_selftitle_facing = 1, |
385 | 455 | p2_teammenu_selftitle_scale = {1.0, 1.0}, |
386 | - p2_teammenu_selftitle_font = {'font/jg.fnt', 0, -1, nil, nil, nil}, | |
456 | + p2_teammenu_selftitle_font = {'jg.fnt', 0, -1, 255, 255, 255, 255, 0}, | |
387 | 457 | p2_teammenu_selftitle_font_scale = {1.0, 1.0}, |
388 | 458 | p2_teammenu_selftitle_text = '', |
389 | 459 | --p2_teammenu_enemytitle_anim = nil, |
@@ -391,7 +461,7 @@ local motif = | ||
391 | 461 | p2_teammenu_enemytitle_offset = {0, 0}, |
392 | 462 | p2_teammenu_enemytitle_facing = 1, |
393 | 463 | p2_teammenu_enemytitle_scale = {1.0, 1.0}, |
394 | - p2_teammenu_enemytitle_font = {'font/jg.fnt', 0, -1, nil, nil, nil}, | |
464 | + p2_teammenu_enemytitle_font = {'jg.fnt', 0, -1, 255, 255, 255, 255, 0}, | |
395 | 465 | p2_teammenu_enemytitle_font_scale = {1.0, 1.0}, |
396 | 466 | p2_teammenu_enemytitle_text = '', |
397 | 467 | p2_teammenu_move_snd = {100, 0}, |
@@ -400,11 +470,11 @@ local motif = | ||
400 | 470 | p2_teammenu_item_offset = {0, 0}, |
401 | 471 | p2_teammenu_item_spacing = {0, 15}, |
402 | 472 | p2_teammenu_item_font_offset = {0, 0}, --Ikemen feature |
403 | - p2_teammenu_item_font = {'font/jg.fnt', 0, -1, nil, nil, nil}, | |
473 | + p2_teammenu_item_font = {'jg.fnt', 0, -1, 255, 255, 255, 255, 0}, | |
404 | 474 | p2_teammenu_item_font_scale = {1.0, 1.0}, |
405 | - p2_teammenu_item_active_font = {'font/jg.fnt', 1, -1, nil, nil, nil}, | |
475 | + p2_teammenu_item_active_font = {'jg.fnt', 1, -1, 255, 255, 255, 255, 0}, | |
406 | 476 | p2_teammenu_item_active_font_scale = {1.0, 1.0}, |
407 | - p2_teammenu_item_active2_font = {'font/jg.fnt', 0, -1, nil, nil, nil}, | |
477 | + p2_teammenu_item_active2_font = {'jg.fnt', 0, -1, 255, 255, 255, 255, 0}, | |
408 | 478 | p2_teammenu_item_active2_font_scale = {1.0, 1.0}, |
409 | 479 | --p2_teammenu_item_cursor_anim = nil, |
410 | 480 | p2_teammenu_item_cursor_spr = {}, |
@@ -427,8 +497,6 @@ local motif = | ||
427 | 497 | { |
428 | 498 | spr = '', |
429 | 499 | bgclearcolor = {0, 0, 0}, |
430 | - bg = {}, | |
431 | - timer = 0, --Ikemen feature | |
432 | 500 | }, |
433 | 501 | vs_screen = |
434 | 502 | { |
@@ -440,37 +508,53 @@ local motif = | ||
440 | 508 | time_order = 60, --Ikemen feature |
441 | 509 | match_text = 'Match %i', |
442 | 510 | match_offset = {159, 12}, |
443 | - match_font = {'font/jg.fnt', 0, 0, nil, nil, nil}, | |
511 | + match_font = {'jg.fnt', 0, 0, 255, 255, 255, 255, 0}, | |
444 | 512 | match_font_scale = {1.0, 1.0}, |
445 | 513 | p1_pos = {0, 0}, |
446 | 514 | p1_spr = {9000, 1}, |
447 | 515 | p1_offset = {0, 0}, |
448 | 516 | p1_facing = 1, |
449 | 517 | p1_scale = {1.0, 1.0}, |
450 | - p1_window = {0, 0, 0, 0}, | |
451 | - p1_spacing = {0, 0}, --Ikemen feature | |
518 | + --p1_window = {0, 0, 0, 0}, --not implemented yet | |
452 | 519 | p1_num = 1, --Ikemen feature |
520 | + p1_spacing = {0, 0}, --Ikemen feature | |
521 | + p1_c1_offset = {0, 0}, --Ikemen feature | |
522 | + p1_c1_scale = {1.0, 1.0}, --Ikemen feature | |
523 | + p1_c2_offset = {0, 0}, --Ikemen feature | |
524 | + p1_c2_scale = {1.0, 1.0}, --Ikemen feature | |
525 | + p1_c3_offset = {0, 0}, --Ikemen feature | |
526 | + p1_c3_scale = {1.0, 1.0}, --Ikemen feature | |
527 | + p1_c4_offset = {0, 0}, --Ikemen feature | |
528 | + p1_c4_scale = {1.0, 1.0}, --Ikemen feature | |
453 | 529 | p2_pos = {0, 0}, |
454 | - p2_spr = {9000, 1}, | |
530 | + p2_spr = {9000, 1}, --not used in Ikemen (same as p1_spr) | |
455 | 531 | p2_offset = {0, 0}, |
456 | 532 | p2_facing = -1, |
457 | 533 | p2_scale = {1.0, 1.0}, |
458 | - p2_window = {0, 0, 0, 0}, | |
459 | - p2_spacing = {0, 0}, --Ikemen feature | |
534 | + --p2_window = {0, 0, 0, 0}, --not implemented yet | |
460 | 535 | p2_num = 1, --Ikemen feature |
536 | + p2_spacing = {0, 0}, --Ikemen feature | |
537 | + p2_c1_offset = {0, 0}, --Ikemen feature | |
538 | + p2_c1_scale = {1.0, 1.0}, --Ikemen feature | |
539 | + p2_c2_offset = {0, 0}, --Ikemen feature | |
540 | + p2_c2_scale = {1.0, 1.0}, --Ikemen feature | |
541 | + p2_c3_offset = {0, 0}, --Ikemen feature | |
542 | + p2_c3_scale = {1.0, 1.0}, --Ikemen feature | |
543 | + p2_c4_offset = {0, 0}, --Ikemen feature | |
544 | + p2_c4_scale = {1.0, 1.0}, --Ikemen feature | |
461 | 545 | p1_name_pos = {0, 0}, |
462 | 546 | p1_name_offset = {0, 0}, |
463 | - p1_name_font = {'font/jg.fnt', 0, 0, nil, nil, nil}, | |
547 | + p1_name_font = {'jg.fnt', 0, 0, 255, 255, 255, 255, 0}, | |
464 | 548 | p1_name_font_scale = {1.0, 1.0}, |
465 | 549 | p1_name_spacing = {0, 14}, |
466 | 550 | p2_name_pos = {0, 0}, |
467 | 551 | p2_name_offset = {0, 0}, |
468 | - p2_name_font = {'font/jg.fnt', 0, 0, nil, nil, nil}, | |
552 | + p2_name_font = {'jg.fnt', 0, 0, 255, 255, 255, 255, 0}, | |
469 | 553 | p2_name_font_scale = {1.0, 1.0}, |
470 | 554 | p2_name_spacing = {0, 14}, |
471 | - --p1_name_active_font = {'font/jg.fnt', 0, 0, nil, nil, nil}, --Ikemen feature | |
555 | + --p1_name_active_font = {'jg.fnt', 0, 0, 255, 255, 255, 255, 0}, --Ikemen feature | |
472 | 556 | --p1_name_active_font_scale = {1.0, 1.0}, --Ikemen feature |
473 | - --p2_name_active_font = {'font/jg.fnt', 0, 0, nil, nil, nil}, --Ikemen feature | |
557 | + --p2_name_active_font = {'jg.fnt', 0, 0, 255, 255, 255, 255, 0}, --Ikemen feature | |
474 | 558 | --p2_name_active_font_scale = {1.0, 1.0}, --Ikemen feature |
475 | 559 | p1_cursor_move_snd = {100, 0}, --Ikemen feature |
476 | 560 | p1_cursor_done_snd = {100, 1}, --Ikemen feature |
@@ -481,21 +565,23 @@ local motif = | ||
481 | 565 | { |
482 | 566 | spr = '', |
483 | 567 | bgclearcolor = {0, 0, 0}, |
484 | - bg = {}, | |
485 | - timer = 0, --Ikemen feature | |
486 | 568 | }, |
487 | 569 | demo_mode = |
488 | 570 | { |
489 | - enabled = 1, --not supported yet | |
571 | + enabled = 1, | |
490 | 572 | select_enabled = 0, --not supported yet |
491 | 573 | vsscreen_enabled = 0, --not supported yet |
492 | - title_waittime = 600, --not supported yet | |
493 | - fight_endtime = 1500, --not supported yet | |
494 | - fight_playbgm = 0, --not supported yet | |
495 | - fight_stopbgm = 1, --not supported yet | |
496 | - fight_bars_display = 0, --not supported yet | |
497 | - intro_waitcycles = 1, --not supported yet | |
498 | - debuginfo = 0, --not supported yet | |
574 | + title_waittime = 600, | |
575 | + fight_endtime = 1500, | |
576 | + fight_playbgm = 0, | |
577 | + fight_stopbgm = 0, | |
578 | + fight_bars_display = 0, | |
579 | + intro_waitcycles = 1, | |
580 | + debuginfo = 0, | |
581 | + fadein_time = 50, --Ikemen feature | |
582 | + fadein_col = {0, 0, 0}, --Ikemen feature | |
583 | + fadeout_time = 50, --Ikemen feature | |
584 | + fadeout_col = {0, 0, 0}, --Ikemen feature | |
499 | 585 | }, |
500 | 586 | continue_screen = |
501 | 587 | { |
@@ -534,28 +620,28 @@ local motif = | ||
534 | 620 | continue_end_snd = {1, 0}, --Ikemen feature |
535 | 621 | credits_text = 'Credits: %i', --Ikemen feature |
536 | 622 | credits_offset = {20, 30}, --Ikemen feature |
537 | - credits_font = {'font/jg.fnt', 0, 1, nil, nil, nil}, --Ikemen feature | |
623 | + credits_font = {'jg.fnt', 0, 1, 255, 255, 255, 255, 0}, --Ikemen feature | |
538 | 624 | credits_font_scale = {1.0, 1.0}, --Ikemen feature |
539 | 625 | --enabled = 1, --not used in Ikemen |
540 | 626 | --pos = {160, 240}, --not used in Ikemen |
541 | 627 | --continue_text = 'CONTINUE?', --not used in Ikemen |
542 | - --continue_font = {'font/f-4x6.fnt', 0, 0, nil, nil, nil}, --not used in Ikemen | |
628 | + --continue_font = {'f-4x6.def', 0, 0, 255, 255, 255, 255, 0}, --not used in Ikemen | |
543 | 629 | --continue_font_scale = {1.0, 1.0}, --not used in Ikemen |
544 | 630 | --continue_offset = {0, 0}, --not used in Ikemen |
545 | 631 | --yes_text = 'YES', --not used in Ikemen |
546 | - --yes_font = {'font/f-4x6.fnt', 0, 0, 128, 128, 128}, --not used in Ikemen | |
632 | + --yes_font = {'f-4x6.def', 0, 0, 128, 128, 128}, --not used in Ikemen | |
547 | 633 | --yes_font_scale = {1.0, 1.0}, --not used in Ikemen |
548 | 634 | --yes_offset = {-80, 60}, --not used in Ikemen |
549 | 635 | --yes_active_text = 'YES', --not used in Ikemen |
550 | - --yes_active_font = {'font/f-4x6.fnt', 3, 0, nil, nil, nil}, --not used in Ikemen | |
636 | + --yes_active_font = {'f-4x6.def', 3, 0, 255, 255, 255, 255, 0}, --not used in Ikemen | |
551 | 637 | --yes_active_font_scale = {1.0, 1.0}, --not used in Ikemen |
552 | 638 | --yes_active_offset = {-80, 60}, --not used in Ikemen |
553 | 639 | --no_text = 'NO', --not used in Ikemen |
554 | - --no_font = {'font/f-4x6.fnt', 0, 0, 128, 128, 128}, --not used in Ikemen | |
640 | + --no_font = {'f-4x6.def', 0, 0, 128, 128, 128}, --not used in Ikemen | |
555 | 641 | --no_font_scale = {1.0, 1.0}, --not used in Ikemen |
556 | 642 | --no_offset = {80, 60}, --not used in Ikemen |
557 | 643 | --no_active_text = 'NO', --not used in Ikemen |
558 | - --no_active_font = {'font/f-4x6.fnt', 3, 0, nil, nil, nil}, --not used in Ikemen | |
644 | + --no_active_font = {'f-4x6.def', 3, 0, 255, 255, 255, 255, 0}, --not used in Ikemen | |
559 | 645 | --no_active_font_scale = {1.0, 1.0}, --not used in Ikemen |
560 | 646 | --no_active_offset = {80, 60}, --not used in Ikemen |
561 | 647 | }, |
@@ -563,8 +649,6 @@ local motif = | ||
563 | 649 | { |
564 | 650 | spr = 'data/continue.sff', --Ikemen feature |
565 | 651 | bgclearcolor = {0, 0, 0}, --Ikemen feature |
566 | - bg = {}, | |
567 | - timer = 0, --Ikemen feature | |
568 | 652 | }, |
569 | 653 | game_over_screen = |
570 | 654 | { |
@@ -573,32 +657,54 @@ local motif = | ||
573 | 657 | }, |
574 | 658 | victory_screen = |
575 | 659 | { |
576 | - enabled = 1, | |
660 | + enabled = 0, | |
661 | + cpu_enabled = 1, --Ikemen feature | |
662 | + vs_enabled = 1, --Ikemen feature | |
663 | + looser_name_enabled = 0, --Ikemen feature | |
664 | + winner_teamko_enabled = 0, --Ikemen feature | |
577 | 665 | time = 300, |
578 | 666 | fadein_time = 8, |
579 | 667 | fadein_col = {0, 0, 0}, --Ikemen feature |
580 | 668 | fadeout_time = 15, |
581 | 669 | fadeout_col = {0, 0, 0}, --Ikemen feature |
670 | + p1_pos = {0, 0}, | |
582 | 671 | p1_spr = {9000, 2}, |
583 | 672 | p1_offset = {100, 20}, |
584 | 673 | p1_facing = 1, |
585 | 674 | p1_scale = {1.0, 1.0}, |
586 | - p1_window = {0, 0, 319, 160}, | |
675 | + --p1_window = {0, 0, 319, 160}, --not implemented yet | |
676 | + p1_num = 1, --Ikemen feature | |
677 | + p1_c1_offset = {0, 0}, --Ikemen feature | |
678 | + p1_c1_scale = {1.0, 1.0}, --Ikemen feature | |
679 | + p1_c2_offset = {0, 0}, --Ikemen feature | |
680 | + p1_c2_scale = {1.0, 1.0}, --Ikemen feature | |
681 | + p1_c3_offset = {0, 0}, --Ikemen feature | |
682 | + p1_c3_scale = {1.0, 1.0}, --Ikemen feature | |
683 | + p1_c4_offset = {0, 0}, --Ikemen feature | |
684 | + p1_c4_scale = {1.0, 1.0}, --Ikemen feature | |
587 | 685 | p1_name_offset = {20, 180}, |
588 | - p1_name_font = {'font/jg.fnt', 0, 1, nil, nil, nil}, | |
686 | + p1_name_font = {'jg.fnt', 0, 1, 255, 255, 255, 255, 0}, | |
589 | 687 | p1_name_font_scale = {1.0, 1.0}, |
590 | - p2_display = 0, --Ikemen feature | |
591 | - p2_spr = {9000, 2}, --Ikemen feature | |
688 | + p2_pos = {0, 0}, --Ikemen feature | |
592 | 689 | p2_offset = {100, 20}, --Ikemen feature |
593 | - p2_facing = -1, --Ikemen feature | |
690 | + p2_facing = 1, --Ikemen feature | |
594 | 691 | p2_scale = {1.0, 1.0}, --Ikemen feature |
595 | - p2_window = {0, 0, 319, 160}, --Ikemen feature | |
692 | + --p2_window = {0, 0, 319, 160}, --Ikemen feature (not implemented yet) | |
693 | + p2_num = 0, --Ikemen feature | |
694 | + p2_c1_offset = {0, 0}, --Ikemen feature | |
695 | + p2_c1_scale = {1.0, 1.0}, --Ikemen feature | |
696 | + p2_c2_offset = {0, 0}, --Ikemen feature | |
697 | + p2_c2_scale = {1.0, 1.0}, --Ikemen feature | |
698 | + p2_c3_offset = {0, 0}, --Ikemen feature | |
699 | + p2_c3_scale = {1.0, 1.0}, --Ikemen feature | |
700 | + p2_c4_offset = {0, 0}, --Ikemen feature | |
701 | + p2_c4_scale = {1.0, 1.0}, --Ikemen feature | |
596 | 702 | p2_name_offset = {20, 180}, --Ikemen feature |
597 | - p2_name_font = {'font/jg.fnt', 0, 1, nil, nil, nil}, --Ikemen feature | |
598 | - p2_name_font_scale = {1.0, 1.0}, | |
703 | + p2_name_font = {'jg.fnt', 0, 1, 255, 255, 255, 255, 0}, --Ikemen feature | |
704 | + p2_name_font_scale = {1.0, 1.0}, --Ikemen feature | |
599 | 705 | winquote_text = 'Winner!', |
600 | 706 | winquote_offset = {20, 192}, |
601 | - winquote_font = {'font/f-6x9.fnt', 0, 1, nil, nil, nil}, | |
707 | + winquote_font = {'f-6x9.def', 0, 1, 255, 255, 255, 255, 0}, | |
602 | 708 | winquote_font_scale = {1.0, 1.0}, |
603 | 709 | winquote_spacing = {0, 15}, --Ikemen feature |
604 | 710 | winquote_delay = 2, --Ikemen feature |
@@ -610,8 +716,6 @@ local motif = | ||
610 | 716 | { |
611 | 717 | spr = '', |
612 | 718 | bgclearcolor = {0, 0, 0}, |
613 | - bg = {}, | |
614 | - timer = 0, --Ikemen feature | |
615 | 719 | }, |
616 | 720 | win_screen = |
617 | 721 | { |
@@ -623,7 +727,7 @@ local motif = | ||
623 | 727 | pose_time = 300, |
624 | 728 | wintext_text = 'Congratulations!', |
625 | 729 | wintext_offset = {159, 70}, |
626 | - wintext_font = {'font/f-6x9.fnt', 0, 0, nil, nil, nil}, | |
730 | + wintext_font = {'f-6x9.def', 0, 0, 255, 255, 255, 255, 0}, | |
627 | 731 | wintext_font_scale = {1.0, 1.0}, |
628 | 732 | wintext_displaytime = -1, |
629 | 733 | wintext_layerno = 2, |
@@ -648,7 +752,7 @@ local motif = | ||
648 | 752 | show_time = 300, |
649 | 753 | winstext_text = 'Rounds survived: %i', |
650 | 754 | winstext_offset = {159, 70}, |
651 | - winstext_font = {'font/jg.fnt', 0, 0, nil, nil, nil}, | |
755 | + winstext_font = {'jg.fnt', 0, 0, 255, 255, 255, 255, 0}, | |
652 | 756 | winstext_font_scale = {1.0, 1.0}, |
653 | 757 | winstext_spacing = {0, 15}, --Ikemen feature |
654 | 758 | winstext_displaytime = -1, |
@@ -665,7 +769,7 @@ local motif = | ||
665 | 769 | show_time = 300, --Ikemen feature |
666 | 770 | winstext_text = 'Wins: %i\nLoses: %i', --Ikemen feature |
667 | 771 | winstext_offset = {159, 70}, --Ikemen feature |
668 | - winstext_font = {'font/jg.fnt', 0, 0, nil, nil, nil}, --Ikemen feature | |
772 | + winstext_font = {'jg.fnt', 0, 0, 255, 255, 255, 255, 0}, --Ikemen feature | |
669 | 773 | winstext_font_scale = {1.0, 1.0}, --Ikemen feature |
670 | 774 | winstext_spacing = {0, 15}, --Ikemen feature |
671 | 775 | winstext_displaytime = -1, --Ikemen feature |
@@ -676,8 +780,6 @@ local motif = | ||
676 | 780 | { |
677 | 781 | spr = '', --Ikemen feature |
678 | 782 | bgclearcolor = {0, 0, 0}, --Ikemen feature (disabled to not cover game screen) |
679 | - bg = {}, | |
680 | - timer = 0, --Ikemen feature | |
681 | 783 | }, |
682 | 784 | option_info = |
683 | 785 | { |
@@ -686,92 +788,77 @@ local motif = | ||
686 | 788 | fadeout_time = 10, --check winmugen values |
687 | 789 | fadeout_col = {0, 0, 0}, --Ikemen feature |
688 | 790 | title_offset = {159, 19}, |
689 | - title_font = {'font/f-6x9.fnt', 0, 0, nil, nil, nil}, | |
791 | + title_font = {'f-6x9.def', 0, 0, 255, 255, 255, 255, 0}, | |
690 | 792 | title_font_scale = {1.0, 1.0}, |
691 | 793 | title_text_main = 'OPTIONS', --Ikemen feature |
692 | 794 | title_text_arcade = 'ARCADE SETTINGS', --Ikemen feature |
693 | 795 | title_text_gameplay = 'GAMEPLAY SETTINGS', --Ikemen feature |
694 | - title_text_advgameplay = 'ADVANCED GAMEPLAY SETTINGS', --Ikemen feature | |
796 | + title_text_advgameplay = 'ADVANCED SETTINGS', --Ikemen feature | |
695 | 797 | title_text_video = 'VIDEO SETTINGS', --Ikemen feature |
798 | + title_text_res = 'RESOLUTION SETTINGS', --Ikemen feature | |
696 | 799 | title_text_audio = 'AUDIO SETTINGS', --Ikemen feature |
697 | 800 | title_text_engine = 'ENGINE SETTINGS', --Ikemen feature |
698 | - title_text_res = 'RESOLUTION SETTINGS', --Ikemen feature | |
699 | 801 | title_text_input = 'INPUT SETTINGS', --Ikemen feature |
700 | 802 | title_text_key = 'KEY SETTINGS', --Ikemen feature |
803 | + title_text_controller = 'CONTROLLER SETTINGS', --Ikemen feature | |
701 | 804 | menu_pos = {85, 33}, --Ikemen feature |
702 | - menu_item_font = {'font/f-6x9.fnt', 7, 1, nil, nil, nil}, --Ikemen feature | |
805 | + menu_item_font = {'f-6x9.def', 7, 1, 255, 255, 255, 255, 0}, --Ikemen feature | |
703 | 806 | menu_item_font_scale = {1.0, 1.0}, --Ikemen feature |
704 | - menu_item_active_font = {'font/f-6x9.fnt', 0, 1, nil, nil, nil}, --Ikemen feature | |
807 | + menu_item_active_font = {'f-6x9.def', 0, 1, 255, 255, 255, 255, 0}, --Ikemen feature | |
705 | 808 | menu_item_active_font_scale = {1.0, 1.0}, --Ikemen feature |
706 | - menu_item_value_font = {'font/f-6x9.fnt', 7, -1, nil, nil, nil}, --Ikemen feature | |
809 | + menu_item_value_font = {'f-6x9.def', 7, -1, 255, 255, 255, 255, 0}, --Ikemen feature | |
707 | 810 | menu_item_value_font_scale = {1.0, 1.0}, --Ikemen feature |
708 | - menu_item_value_active_font = {'font/f-6x9.fnt', 0, -1, nil, nil, nil}, --Ikemen feature | |
811 | + menu_item_value_active_font = {'f-6x9.def', 0, -1, 255, 255, 255, 255, 0}, --Ikemen feature | |
709 | 812 | menu_item_value_active_font_scale = {1.0, 1.0}, --Ikemen feature |
710 | - menu_item_value_conflict_font = {'font/f-6x9.fnt', 1, -1, nil, nil, nil}, --Ikemen feature | |
813 | + menu_item_value_conflict_font = {'f-6x9.def', 1, -1, 255, 255, 255, 255, 0}, --Ikemen feature | |
711 | 814 | menu_item_value_conflict_font_scale = {1.0, 1.0}, --Ikemen feature |
712 | 815 | menu_item_spacing = {150, 13}, --Ikemen feature |
713 | 816 | menu_window_visibleitems = 16, --Ikemen feature |
714 | 817 | menu_boxcursor_visible = 1, --Ikemen feature |
715 | - menu_boxcursor_coords = {-5, -9, 154, 3}, --Ikemen feature | |
716 | - menu_boxbackground_visible = 1, --Ikemen feature | |
717 | - menu_boxbackground_alpha = {20, 100}, --Ikemen feature | |
818 | + menu_boxcursor_coords = {-5, -10, 154, 2}, --Ikemen feature | |
819 | + menu_boxcursor_col = {255, 255, 255}, --Ikemen feature | |
820 | + menu_boxcursor_alpharange = {10, 40, 2, 255, 255, 0}, --Ikemen feature | |
821 | + menu_boxbg_visible = 1, --Ikemen feature | |
822 | + menu_boxbg_col = {0, 0, 0}, --Ikemen feature | |
823 | + menu_boxbg_alpha = {20, 100}, --Ikemen feature | |
718 | 824 | menu_itemname_main_arcade = 'Arcade Settings', --Ikemen feature |
719 | 825 | menu_itemname_main_gameplay = 'Gameplay Settings', --Ikemen feature |
720 | - menu_itemname_main_engine = "Engine Settings", --Ikemen feature | |
826 | + menu_itemname_main_engine = 'Engine Settings', --Ikemen feature | |
721 | 827 | menu_itemname_main_video = 'Video Settings', --Ikemen feature |
722 | 828 | menu_itemname_main_audio = 'Audio Settings', --Ikemen feature |
723 | 829 | menu_itemname_main_input = 'Input Settings', --Ikemen feature |
830 | + menu_itemname_main_quicklaunch = 'Quick Launch', --Ikemen feature | |
724 | 831 | menu_itemname_main_port = 'Port Change', --Ikemen feature |
725 | 832 | menu_itemname_main_default = 'Default Values', --Ikemen feature |
833 | + menu_itemname_main_save = 'Save and Return', --Ikemen feature | |
726 | 834 | menu_itemname_main_back = 'Return Without Saving', --Ikemen feature |
727 | - menu_itemname_arcade_roundstowin = 'Rounds to Win', --Ikemen feature | |
728 | - menu_itemname_arcade_roundtime = 'Round Time', --Ikemen feature | |
835 | + menu_itemname_arcade_roundtime = 'Time Limit', --Ikemen feature | |
836 | + menu_itemname_arcade_roundtime_none = 'None', --Ikemen feature | |
837 | + menu_itemname_arcade_roundsnumsingle = 'Rounds to Win Single', --Ikemen feature | |
838 | + menu_itemname_arcade_roundsnumteam = 'Rounds to Win Simul/Tag', --Ikemen feature | |
839 | + menu_itemname_arcade_maxdrawgames = 'Max Draw Games', --Ikemen feature | |
729 | 840 | menu_itemname_arcade_difficulty = 'Difficulty level', --Ikemen feature |
730 | 841 | menu_itemname_arcade_credits = 'Credits', --Ikemen feature |
731 | 842 | menu_itemname_arcade_charchange = 'Char change at Continue', --Ikemen feature |
732 | - menu_itemname_arcade_airamping = 'AI ramping', --Ikemen feature | |
843 | + menu_itemname_arcade_airamping = 'AI Ramping', --Ikemen feature | |
844 | + menu_itemname_arcade_aipalette = 'AI Palette', --Ikemen feature | |
845 | + menu_itemname_arcade_aipalette_random = 'Random', --Ikemen feature | |
846 | + menu_itemname_arcade_aipalette_default = 'Default', --Ikemen feature | |
733 | 847 | menu_itemname_arcade_back = 'Back', --Ikemen feature |
734 | - menu_itemname_gameplay_lifemul = 'Life', --Ikemen feature | |
735 | - menu_itemname_gameplay_autoguard = 'Auto-Guard', --Ikemen feature | |
736 | - menu_itemname_gameplay_attackpowermul = 'Attack.LifeToPowerMul', --Ikemen feature | |
737 | - menu_itemname_gameplay_gethitpowermul = 'GetHit.LifeToPowerMul', --Ikemen feature | |
738 | - menu_itemname_gameplay_superdefencemul = 'Super.TargetDefenceMul', --Ikemen feature | |
739 | - menu_itemname_gameplay_team1vs2life = '1P Vs Team Life', --Ikemen feature | |
740 | - menu_itemname_gameplay_turnsrecoveryrate = 'Turns HP Recovery', --Ikemen feature | |
741 | - menu_itemname_gameplay_teampowershare = 'Team Power Share', --Ikemen feature | |
742 | - menu_itemname_gameplay_teamlifeshare = 'Team Life Share', --Ikemen feature | |
743 | - menu_itemname_gameplay_singlemode = 'Single Mode', --Ikemen feature | |
744 | - menu_itemname_gameplay_numturns = 'Turns Limit', --Ikemen feature | |
745 | - menu_itemname_gameplay_numsimul = 'Simul Limit', --Ikemen feature | |
746 | - menu_itemname_gameplay_numtag = 'Tag Limit', --Ikemen features | |
747 | - menu_itemname_gameplay_simulmode = 'Legacy Tag Mode', --Ikemen feature | |
748 | - menu_itemname_gameplay_simulmode_simul = 'Disabled', --Ikemen feature | |
749 | - menu_itemname_gameplay_simulmode_tag = 'Enabled', --Ikemen feature | |
750 | - menu_itemname_gameplay_advanced = 'Advanced Settings', --Ikemen feature | |
751 | - menu_itemname_gameplay_back = 'Back', --Ikemen feature | |
752 | 848 | menu_itemname_video_resolution = 'Resolution', --Ikemen feature |
753 | 849 | menu_itemname_video_fullscreen = 'Fullscreen', --Ikemen feature |
754 | 850 | menu_itemname_video_msaa = 'MSAA', --Ikemen feature |
755 | - menu_itemname_video_helpermax = 'HelperMax', --Ikemen feature | |
756 | - menu_itemname_video_playerprojectilemax = 'PlayerProjectileMax', --Ikemen feature | |
757 | - menu_itemname_video_explodmax = 'ExplodMax', --Ikemen feature | |
758 | - menu_itemname_video_afterimagemax = 'AfterImageMax', --Ikemen feature | |
759 | - menu_itemname_video_zoomactive = 'Zoom Active', --Ikemen feature | |
760 | - menu_itemname_video_maxzoomout = 'Default Max Zoom Out', --Ikemen feature | |
761 | - menu_itemname_video_maxzoomin = 'Default Max Zoom In', --Ikemen feature | |
762 | - menu_itemname_video_zoomspeed = 'Default Zoom Speed', --Ikemen feature | |
763 | - menu_itemname_video_lifebarfontscale = 'Default Lifebar Font Scale', --Ikemen feature | |
764 | - menu_itemname_video_aipalette = 'AI Palette', --Ikemen feature | |
765 | - menu_itemname_video_aipalette_random = 'Random', --Ikemen feature | |
766 | - menu_itemname_video_aipalette_default = 'Default', --Ikemen feature | |
851 | + menu_itemname_video_shader = 'Shader', --Ikemen feature | |
852 | + menu_itemname_video_shader_none = 'None', --Ikemen feature | |
853 | + menu_itemname_video_shader_hqx2 = 'hq2x', --Ikemen feature | |
854 | + menu_itemname_video_shader_hqx4 = 'hqx4', --Ikemen feature | |
855 | + menu_itemname_video_shader_scanlines = 'scanlines', --Ikemen feature | |
767 | 856 | menu_itemname_video_back = 'Back', --Ikemen feature |
768 | 857 | menu_itemname_res_320x240 = '320x240 (4:3 QVGA)', --Ikemen feature |
769 | 858 | menu_itemname_res_640x480 = '640x480 (4:3 VGA)', --Ikemen feature |
770 | 859 | menu_itemname_res_1280x960 = '1280x960 (4:3 Quad-VGA)', --Ikemen feature |
771 | 860 | menu_itemname_res_1600x1200 = '1600x1200 (4:3 UXGA)', --Ikemen feature |
772 | 861 | menu_itemname_res_960x720 = '960x720 (4:3 HD)', --Ikemen feature |
773 | - menu_itemname_res_1200x900 = '1200x900 (4:3 HD+)', --Ikemen feature | |
774 | - menu_itemname_res_1440x1080 = '1440x1080 (4:3 FHD)', --Ikemen feature | |
775 | 862 | menu_itemname_res_1280x720 = '1280x720 (16:9 HD)', --Ikemen feature |
776 | 863 | menu_itemname_res_1600x900 = '1600x900 (16:9 HD+)', --Ikemen feature |
777 | 864 | menu_itemname_res_1920x1080 = '1920x1080 (16:9 FHD)', --Ikemen feature |
@@ -779,12 +866,46 @@ local motif = | ||
779 | 866 | menu_itemname_res_3840x2160 = '3840x2160 (16:9 4K)', --Ikemen feature |
780 | 867 | menu_itemname_res_custom = 'Custom', --Ikemen feature |
781 | 868 | menu_itemname_res_back = 'Back', --Ikemen feature |
782 | - menu_itemname_input_p1keyboard = 'P1 Keyboard', --Ikemen feature | |
783 | - menu_itemname_input_p1gamepad = 'P1 Gamepad', --Ikemen feature | |
784 | - menu_itemname_input_p2keyboard = 'P2 Keyboard', --Ikemen feature | |
785 | - menu_itemname_input_p2gamepad = 'P2 Gamepad', --Ikemen feature | |
869 | + menu_itemname_audio_mastervolume = 'Master Volume', --Ikemen feature | |
870 | + menu_itemname_audio_bgmvolume = 'BGM Volume', --Ikemen feature | |
871 | + menu_itemname_audio_sfxvolume = 'SFX Volume', --Ikemen feature | |
872 | + menu_itemname_audio_audioducking = 'Audio Ducking', --Ikemen feature | |
873 | + menu_itemname_audio_back = 'Back', --Ikemen feature | |
874 | + menu_itemname_gameplay_lifemul = 'Life', --Ikemen feature | |
875 | + menu_itemname_gameplay_autoguard = 'Auto-Guard', --Ikemen feature | |
876 | + menu_itemname_gameplay_attackpowermul = 'Attack.LifeToPowerMul', --Ikemen feature | |
877 | + menu_itemname_gameplay_gethitpowermul = 'GetHit.LifeToPowerMul', --Ikemen feature | |
878 | + menu_itemname_gameplay_superdefencemul = 'Super.TargetDefenceMul', --Ikemen feature | |
879 | + menu_itemname_gameplay_team1vs2life = '1P Vs Team Life', --Ikemen feature | |
880 | + menu_itemname_gameplay_turnsrecoverybase = 'Turns Recovery Base', --Ikemen feature | |
881 | + menu_itemname_gameplay_turnsrecoverybonus = 'Turns Recovery Bonus', --Ikemen feature | |
882 | + menu_itemname_gameplay_teampowershare = 'Team Power Share', --Ikemen feature | |
883 | + menu_itemname_gameplay_teamlifeshare = 'Team Life Share', --Ikemen feature | |
884 | + menu_itemname_gameplay_singlemode = 'Single Mode', --Ikemen feature | |
885 | + menu_itemname_gameplay_numturns = 'Turns Limit', --Ikemen feature | |
886 | + menu_itemname_gameplay_numsimul = 'Simul Limit', --Ikemen feature | |
887 | + menu_itemname_gameplay_numtag = 'Tag Limit', --Ikemen features | |
888 | + menu_itemname_gameplay_advanced = 'Advanced Settings', --Ikemen feature | |
889 | + menu_itemname_gameplay_back = 'Back', --Ikemen feature | |
890 | + menu_itemname_engine_allowdebugkeys = 'Debug Keys', --Ikemen feature | |
891 | + menu_itemname_engine_simulmode = 'Legacy Tag Mode', --Ikemen feature | |
892 | + menu_itemname_engine_helpermax = 'HelperMax', --Ikemen feature | |
893 | + menu_itemname_engine_playerprojectilemax = 'PlayerProjectileMax', --Ikemen feature | |
894 | + menu_itemname_engine_explodmax = 'ExplodMax', --Ikemen feature | |
895 | + menu_itemname_engine_afterimagemax = 'AfterImageMax', --Ikemen feature | |
896 | + menu_itemname_engine_zoomactive = 'Zoom Active', --Ikemen feature | |
897 | + menu_itemname_engine_maxzoomout = 'Default Max Zoom Out', --Ikemen feature | |
898 | + menu_itemname_engine_maxzoomin = 'Default Max Zoom In', --Ikemen feature | |
899 | + menu_itemname_engine_zoomspeed = 'Default Zoom Speed', --Ikemen feature | |
900 | + menu_itemname_engine_lifebarfontscale = 'Lifebar Font Scale', --Ikemen feature | |
901 | + menu_itemname_input_keyboard = 'Key Config', --Ikemen feature | |
902 | + menu_itemname_input_gamepad = 'Joystick Config', --Ikemen feature | |
903 | + menu_itemname_input_system = 'System Keys', --Ikemen feature (not used yet) | |
786 | 904 | menu_itemname_input_default = 'Default Values', --Ikemen feature |
787 | 905 | menu_itemname_input_back = 'Back', --Ikemen feature |
906 | + menu_itemname_key_p1 = 'PLAYER 1', --Ikemen feature | |
907 | + menu_itemname_key_p2 = 'PLAYER 2', --Ikemen feature | |
908 | + menu_itemname_key_all = 'Config all', --Ikemen feature | |
788 | 909 | menu_itemname_key_up = 'Up', --Ikemen feature |
789 | 910 | menu_itemname_key_down = 'Down', --Ikemen feature |
790 | 911 | menu_itemname_key_left = 'Left', --Ikemen feature |
@@ -796,24 +917,35 @@ local motif = | ||
796 | 917 | menu_itemname_key_y = 'Y', --Ikemen feature |
797 | 918 | menu_itemname_key_z = 'Z', --Ikemen feature |
798 | 919 | menu_itemname_key_start = 'Start', --Ikemen feature |
799 | - menu_itemname_key_v = 'D', --Ikemen feature | |
920 | + menu_itemname_key_d = 'D', --Ikemen feature | |
800 | 921 | menu_itemname_key_w = 'W', --Ikemen feature |
801 | 922 | menu_itemname_key_back = 'Back', --Ikemen feature |
923 | + menu_item_key_p1_font = {'f-6x9.def', 4, 0, 255, 255, 255, 255, 0}, --Ikemen feature | |
924 | + menu_item_key_p1_font_scale = {1.0, 1.0}, --Ikemen feature | |
925 | + menu_item_key_p2_font = {'f-6x9.def', 1, 0, 255, 255, 255, 255, 0}, --Ikemen feature | |
926 | + menu_item_key_p2_font_scale = {1.0, 1.0}, --Ikemen feature | |
927 | + menu_item_info_font = {'f-6x9.def', 5, -1, 255, 255, 255, 255, 0}, --Ikemen feature | |
928 | + menu_item_info_font_scale = {1.0, 1.0}, --Ikemen feature | |
929 | + menu_item_info_active_font = {'f-6x9.def', 5, -1, 255, 255, 255, 255, 0}, --Ikemen feature | |
930 | + menu_item_info_active_font_scale = {1.0, 1.0}, --Ikemen feature | |
931 | + menu_itemname_info_f1 = '(F1)', --Ikemen feature | |
932 | + menu_itemname_info_f2 = '(F2)', --Ikemen feature | |
933 | + menu_itemname_info_esc = '(Esc)', --Ikemen feature | |
934 | + menu_itemname_info_disable = 'Not used', --Ikemen feature | |
935 | + menu_item_p1_pos = {91, 33}, --Ikemen feature | |
936 | + menu_item_p2_pos = {230, 33}, --Ikemen feature | |
937 | + menu_key_p1_pos = {39, 33}, --Ikemen feature | |
938 | + menu_key_p2_pos = {178, 33}, --Ikemen feature | |
939 | + menu_key_item_spacing = {101, 13}, --Ikemen feature | |
940 | + menu_key_boxcursor_coords = {-5, -10, 106, 2}, --Ikemen feature | |
802 | 941 | menu_itemname_yes = 'Yes', --Ikemen feature |
803 | 942 | menu_itemname_no = 'No', --Ikemen feature |
804 | - menu_itemname_main_save = 'Save and Return', --Ikemen feature | |
805 | 943 | menu_itemname_enabled = 'Enabled', --Ikemen feature |
806 | 944 | menu_itemname_disabled = 'Disabled', --Ikemen feature |
807 | - menu_itemname_audio_mastervolume = 'Master Volume', --Ikemen feature | |
808 | - menu_itemname_audio_sfxvolume = 'SFX Volume', --Ikemen feature | |
809 | - menu_itemname_audio_bgmvolume = 'BGM Volume', --Ikemen feature | |
810 | - menu_itemname_audio_audioducking = 'Audio Ducking', --Ikemen feature | |
811 | - menu_itemname_engine_quicklaunch = 'Quick Launch', --Ikemen feature | |
812 | - menu_itemname_engine_allowdebugkeys = 'Debug Keys', --Ikemen feature | |
813 | 945 | input_text_port = 'Type in Host Port, e.g. 7500.\nPress ENTER to accept.\nPress ESC to cancel.', --Ikemen feature |
814 | 946 | input_text_reswidth = 'Type in screen width.\nPress ENTER to accept.\nPress ESC to cancel.', --Ikemen feature |
815 | 947 | input_text_resheight = 'Type in screen height.\nPress ENTER to accept.\nPress ESC to cancel.', --Ikemen feature |
816 | - input_text_key = 'Press a key to assign to entry.\nPress ESC to cancel.', --Ikemen feature | |
948 | + input_text_key = 'Press a key to assign to entry.\nPress SPACE to disable key.\nPress ESC to cancel.', --Ikemen feature | |
817 | 949 | cursor_move_snd = {100, 0}, |
818 | 950 | cursor_done_snd = {100, 1}, |
819 | 951 | cancel_snd = {100, 2}, |
@@ -822,8 +954,6 @@ local motif = | ||
822 | 954 | { |
823 | 955 | spr = '', |
824 | 956 | bgclearcolor = {0, 0, 0}, |
825 | - bg = {}, | |
826 | - timer = 0, --Ikemen feature | |
827 | 957 | }, |
828 | 958 | tournament_info = |
829 | 959 | { |
@@ -836,25 +966,28 @@ local motif = | ||
836 | 966 | { |
837 | 967 | spr = 'data/tournament.sff', --Ikemen feature |
838 | 968 | bgclearcolor = {0, 0, 0}, --Ikemen feature |
839 | - bg = {}, --Ikemen feature | |
840 | - timer = 0, --Ikemen feature | |
841 | 969 | }, |
842 | 970 | warning_info = |
843 | 971 | { |
844 | 972 | title = 'WARNING', --Ikemen feature |
845 | 973 | title_pos = {159, 19}, --Ikemen feature |
846 | - title_font = {'font/f-6x9.fnt', 0, 0, nil, nil, nil}, --Ikemen feature | |
974 | + title_font = {'f-6x9.def', 0, 0, 255, 255, 255, 255, 0}, --Ikemen feature | |
847 | 975 | title_font_scale = {1.0, 1.0}, --Ikemen feature |
848 | 976 | text_stages = 'No stages in select.def available for random selection.\nPress any key to exit the program.', --Ikemen feature |
849 | - text_order = "No characters in select.def correspond to 'maxmatches'\nsettings. Check [Characters] section and 'order' parameters.\nPress any key to exit the program.", --Ikemen feature | |
977 | + text_order = "Incorrect 'maxmatches' settings detected.\nCheck orders in [Characters] and [Options] sections\nto ensure that at least one battle is possible.\nPress any key to exit the program.", --Ikemen feature | |
850 | 978 | text_training = "Training character ('chars/Training/Training.def') not found.\nPress any key to exit the program.", --Ikemen feature |
851 | 979 | text_reload = 'Some selected options require Ikemen to be restarted.\nPress any key to exit the program.', --Ikemen feature |
852 | 980 | text_res = 'Non 4:3 resolutions require stages coded for different\naspect ratio. Change it back to 4:3 if stages look off.', --Ikemen feature |
981 | + text_keys = 'Conflict between button keys detected.\nAll keys should have unique assignment.\nFix the problem before exitting key settings.', --Ikemen feature | |
982 | + text_pad = 'Controller not detected.\nCheck if your controller is plugged in.', --Ikemen feature | |
983 | + text_simul = 'This is a legacy option that works only if screenpack \nhas not been updated to support both Tag and Simul \nmode selection in select screen.', --Ikemen feature | |
853 | 984 | text_pos = {25, 33}, --Ikemen feature |
854 | - text_font = {'font/f-6x9.fnt', 0, 1, nil, nil, nil}, --Ikemen feature | |
985 | + text_font = {'f-6x9.def', 0, 1, 255, 255, 255, 255, 0}, --Ikemen feature | |
855 | 986 | text_font_scale = {1.0, 1.0}, --Ikemen feature |
856 | 987 | text_spacing = {0, 13}, --Ikemen feature |
857 | - background_alpha = {20, 100}, --Ikemen feature | |
988 | + boxbg_coords = {0, 0, localX, localY}, --Ikemen feature (0, 0, 320, 240) | |
989 | + boxbg_col = {0, 0, 0}, --Ikemen feature | |
990 | + boxbg_alpha = {20, 100}, --Ikemen feature | |
858 | 991 | }, |
859 | 992 | anim = |
860 | 993 | { |
@@ -1288,120 +1421,39 @@ local motif = | ||
1288 | 1421 | '101,75, -32,8, -1', --1593+ |
1289 | 1422 | }, |
1290 | 1423 | }, |
1291 | - ctrldef = { | |
1292 | - titlebgdef = {}, | |
1293 | - selectbgdef = {}, | |
1294 | - versusbgdef = {}, | |
1295 | - optionbgdef = {}, | |
1296 | - continuebgdef = {}, | |
1297 | - victorybgdef = {}, | |
1298 | - resultsbgdef = {}, | |
1299 | - tournamentbgdef = {}, | |
1300 | - } | |
1301 | 1424 | } |
1302 | 1425 | |
1303 | 1426 | --;=========================================================== |
1304 | 1427 | --; PARSE SCREENPACK |
1305 | 1428 | --;=========================================================== |
1306 | 1429 | --here starts proper screenpack DEF file parsing |
1307 | -local sp = config.Motif | |
1308 | -if main.flags['-r'] ~= nil then | |
1309 | - if main.f_fileExists(main.flags['-r']) then | |
1310 | - sp = main.flags['-r'] | |
1311 | - elseif main.f_fileExists('data/' .. main.flags['-r'] .. '/system.def') then | |
1312 | - sp = 'data/' .. main.flags['-r'] .. '/system.def' | |
1313 | - end | |
1314 | -end | |
1315 | -local file = io.open(sp, 'r') | |
1316 | -local fileDir, fileName = sp:match('^(.-)([^/\\]+)$') | |
1430 | +main.t_sort = {} | |
1317 | 1431 | local t = {} |
1318 | 1432 | local pos = t |
1433 | +local pos_sort = main.t_sort | |
1319 | 1434 | local def_pos = motif |
1320 | 1435 | t.anim = {} |
1321 | -t.font_data = {['font/f-4x6.fnt'] = fontNew('font/f-4x6.fnt'), ['font/f-6x9.fnt'] = fontNew('font/f-6x9.fnt'), ['font/jg.fnt'] = fontNew('font/jg.fnt')} | |
1322 | -t.ctrldef = {} | |
1436 | +t.font_data = {['f-4x6.def'] = fontNew('f-4x6.def'), ['f-6x9.def'] = fontNew('f-6x9.def'), ['jg.fnt'] = fontNew('jg.fnt')} | |
1437 | +local fileDir, fileName = motif.def:match('^(.-)([^/\\]+)$') | |
1323 | 1438 | t.fileDir = fileDir |
1324 | 1439 | t.fileName = fileName |
1325 | -local bgdef = 'dummyUntilSet' | |
1326 | -local bgctrl = '' | |
1327 | -local bgctrl_match = 'dummyUntilSet' | |
1328 | 1440 | local tmp = '' |
1441 | +file = io.open(motif.def, 'r') | |
1329 | 1442 | for line in file:lines() do |
1330 | 1443 | line = line:gsub('%s*;.*$', '') |
1331 | 1444 | if line:match('^%s*%[.-%s*%]%s*$') then --matched [] group |
1332 | 1445 | line = line:match('^%s*%[(.-)%s*%]%s*$') --match text between [] |
1333 | 1446 | line = line:gsub('[%. ]', '_') --change . and space to _ |
1334 | - line = line:lower() --lowercase line | |
1335 | - local row = tostring(line:lower()) --just in case it's a number (not really needed) | |
1336 | - if row:match('.+ctrldef') then --matched ctrldef start | |
1337 | - bgctrl = row | |
1338 | - bgctrl_match = bgctrl:match('^(.-ctrl)def') | |
1339 | - t.ctrldef[bgdef .. 'def'][bgctrl] = {} | |
1340 | - t.ctrldef[bgdef .. 'def'][bgctrl].ctrl = {} | |
1341 | - pos = t.ctrldef[bgdef .. 'def'][bgctrl] | |
1342 | - motif.ctrldef[bgdef .. 'def'][bgctrl] = { | |
1343 | - looptime = -1, | |
1344 | - ctrlid = {0}, | |
1345 | - ctrl = {} | |
1346 | - } | |
1347 | - elseif row:match('^' .. bgctrl_match) then --matched ctrldef content | |
1348 | - tmp = t.ctrldef[bgdef .. 'def'][bgctrl].ctrl | |
1349 | - tmp[#tmp + 1] = {} | |
1350 | - pos = tmp[#tmp] | |
1351 | - motif.ctrldef[bgdef .. 'def'][bgctrl].ctrl[#tmp] = { | |
1352 | - type = 'null', | |
1353 | - time = {0, -1, -1}, | |
1354 | - ctrlid = {} | |
1355 | - } | |
1356 | - elseif row:match('.+bgdef$') then --matched bgdef start | |
1357 | - t[row] = {} | |
1358 | - pos = t[row] | |
1359 | - t[row].bg = {} | |
1360 | - bgdef = row:match('(.+)def$') | |
1361 | - t.ctrldef[bgdef .. 'def'] = {} | |
1362 | - elseif row:match('^' .. bgdef) then --matched bgdef content | |
1363 | - tmp = t[bgdef .. 'def'] | |
1364 | - tmp.bg[#tmp.bg + 1] = {} | |
1365 | - pos = tmp.bg[#tmp.bg] | |
1366 | - motif[bgdef .. 'def'].bg[#tmp.bg] = | |
1367 | - { | |
1368 | - type = 'normal', | |
1369 | - spriteno = {0, 0}, | |
1370 | - id = 0, | |
1371 | - layerno = 0, | |
1372 | - start = {0, 0}, | |
1373 | - delta = {1, 1}, | |
1374 | - trans = '', | |
1375 | - mask = 0, | |
1376 | - tile = {0, 0}, | |
1377 | - tilespacing = {0, nil}, | |
1378 | - --window = {0, 0, 0, 0}, | |
1379 | - --windowdelta = {0, 0}, --not supported yet | |
1380 | - --width = {0, 0}, --not supported yet (parallax) | |
1381 | - --xscale = {1.0, 1.0}, --not supported yet (parallax) | |
1382 | - --yscalestart = 100, --not supported yet (parallax) | |
1383 | - --yscaledelta = 1, --not supported yet (parallax) | |
1384 | - positionlink = 0, | |
1385 | - velocity = {0, 0}, | |
1386 | - --sin_x = {0, 0, 0}, --not supported yet | |
1387 | - --sin_y = {0, 0, 0}, --not supported yet | |
1388 | - ctrl = {}, | |
1389 | - ctrl_flags = { | |
1390 | - visible = 1, | |
1391 | - enabled = 1, | |
1392 | - velx = 0, | |
1393 | - vely = 0, | |
1394 | - x = 0, | |
1395 | - y = 0 | |
1396 | - } | |
1397 | - } | |
1398 | - elseif row:match('^begin_action_[0-9]+$') then --matched anim | |
1447 | + local row = tostring(line:lower()) | |
1448 | + if row:match('^begin_action_[0-9]+$') then --matched anim | |
1399 | 1449 | row = tonumber(row:match('^begin_action_([0-9]+)$')) |
1400 | 1450 | t.anim[row] = {} |
1401 | 1451 | pos = t.anim[row] |
1402 | 1452 | else --matched other [] |
1403 | 1453 | t[row] = {} |
1454 | + main.t_sort[row] = {} | |
1404 | 1455 | pos = t[row] |
1456 | + pos_sort = main.t_sort[row] | |
1405 | 1457 | def_pos = motif[row] |
1406 | 1458 | end |
1407 | 1459 | else --matched non [] line |
@@ -1409,7 +1461,7 @@ for line in file:lines() do | ||
1409 | 1461 | if param ~= nil then |
1410 | 1462 | param = param:gsub('[%. ]', '_') --change param . and space to _ |
1411 | 1463 | param = param:lower() --lowercase param |
1412 | - if value ~= nil and def_pos ~= nil then -- Let's chech if it's even a valid param | |
1464 | + if value ~= nil and def_pos ~= nil then --let's check if it's even a valid param | |
1413 | 1465 | if value == '' and (type(def_pos[param]) == 'number' or type(def_pos[param]) == 'table') then --text should remain empty |
1414 | 1466 | value = '0' |
1415 | 1467 | end |
@@ -1419,7 +1471,7 @@ for line in file:lines() do | ||
1419 | 1471 | value = value:gsub('"', '') --remove brackets from value |
1420 | 1472 | value = value:gsub('^(%.[0-9])', '0%1') --add 0 before dot if missing at the beginning of matched string |
1421 | 1473 | value = value:gsub('([^0-9])(%.[0-9])', '%10%2') --add 0 before dot if missing anywhere else |
1422 | - if param:match('^font[0-9]+$') then --font declaration param matched | |
1474 | + if param:match('^font[0-9]+') then --font declaration param matched | |
1423 | 1475 | local num = tonumber(param:match('font([0-9]+)')) |
1424 | 1476 | if param:match('_height$') then |
1425 | 1477 | if pos.font_height == nil then |
@@ -1427,21 +1479,7 @@ for line in file:lines() do | ||
1427 | 1479 | end |
1428 | 1480 | pos.font_height[num] = main.f_dataType(value) |
1429 | 1481 | else |
1430 | - value = value:lower() | |
1431 | 1482 | value = value:gsub('\\', '/') |
1432 | - if t.font_data[value] == nil then | |
1433 | - if not value:match('^data/') then | |
1434 | - if main.f_fileExists(fileDir .. value) then | |
1435 | - value = fileDir .. value | |
1436 | - elseif main.f_fileExists('font/' .. value) then | |
1437 | - value = 'font/' .. value | |
1438 | - elseif main.f_fileExists(t.files.fight:match('^(.-)[^/\\]+$') .. value) then | |
1439 | - value = t.files.fight:match('^(.-)[^/\\]+$') .. value | |
1440 | - end | |
1441 | - end | |
1442 | - t.font_data[value] = fontNew(value) | |
1443 | - wait = true | |
1444 | - end | |
1445 | 1483 | if pos.font == nil then |
1446 | 1484 | pos.font = {} |
1447 | 1485 | end |
@@ -1456,26 +1494,33 @@ for line in file:lines() do | ||
1456 | 1494 | elseif i == 1 then |
1457 | 1495 | pos[param] = {} |
1458 | 1496 | if param:match('_font$') then |
1459 | - c = t.files.font[tonumber(c)] | |
1497 | + if t.files ~= nil and t.files.font ~= nil and t.files.font[tonumber(c)] ~= nil then --in case font is used before it's declared in DEF file | |
1498 | + c = t.files.font[tonumber(c)] | |
1499 | + else | |
1500 | + break --use default font values | |
1501 | + end | |
1460 | 1502 | end |
1461 | 1503 | end |
1462 | 1504 | if c == nil or c == '' then |
1463 | - pos[param][#pos[param] + 1] = 0 | |
1505 | + table.insert(pos[param], 0) | |
1464 | 1506 | else |
1465 | - pos[param][#pos[param] + 1] = main.f_dataType(c) | |
1507 | + table.insert(pos[param], main.f_dataType(c)) | |
1466 | 1508 | end |
1467 | 1509 | end |
1468 | 1510 | else --single value |
1511 | + if param:match('_itemname_') then | |
1512 | + table.insert(pos_sort, param:match('_itemname_(.+)$')) | |
1513 | + end | |
1469 | 1514 | pos[param] = main.f_dataType(value) |
1470 | 1515 | end |
1471 | 1516 | end |
1472 | 1517 | else --only valid lines left are animations |
1473 | 1518 | line = line:lower() |
1474 | - local value = line:match('^%s*([0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+.-)[,%s]*$') or line:match('^%s*loopstart') or line:match('^%s*interpolate offset') or line:match('^%s*interpolate angle') or line:match('^%s*interpolate scale') or line:match('^%s*interpolate blend') | |
1519 | + local value = line:match('^%s*([0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+.-)[,%s]*$') or line:match('^%s*loopstart') or line:match('%s*interpolate [oasb][fncl][fgae][sln][ed]t?') | |
1475 | 1520 | if value ~= nil then |
1476 | 1521 | value = value:gsub(',%s*,', ',0,') --add missing values |
1477 | 1522 | value = value:gsub(',%s*$', '') |
1478 | - pos[#pos + 1] = value | |
1523 | + table.insert(pos, value) | |
1479 | 1524 | end |
1480 | 1525 | end |
1481 | 1526 | end |
@@ -1486,8 +1531,15 @@ file:close() | ||
1486 | 1531 | --;=========================================================== |
1487 | 1532 | --; FIX REFERENCES, LOAD DATA |
1488 | 1533 | --;=========================================================== |
1489 | -local anim = '' | |
1490 | -local facing = '' | |
1534 | +--adopt old DEF code to Ikemen features | |
1535 | +if type(motif.select_info.cell_spacing) ~= "table" then | |
1536 | + motif.select_info.cell_spacing = {motif.select_info.cell_spacing[1], motif.select_info.cell_spacing[1]} | |
1537 | +end | |
1538 | + | |
1539 | +if motif.victory_screen.enabled == 0 then | |
1540 | + motif.victory_screen.cpu_enabled = 0 | |
1541 | + motif.victory_screen.vs_enabled = 0 | |
1542 | +end | |
1491 | 1543 | |
1492 | 1544 | --merge tables |
1493 | 1545 | motif = main.f_tableMerge(motif, t) |
@@ -1534,40 +1586,11 @@ main.loadingRefresh() | ||
1534 | 1586 | motif.files.continue_snd_data = sndNew(motif.files.continue_snd) |
1535 | 1587 | main.loadingRefresh() |
1536 | 1588 | |
1537 | ---fadein / fadeout data | |
1538 | -t_dir = {'title_info', 'select_info', 'vs_screen', 'victory_screen', 'win_screen', 'survival_results_screen', 'vs100kumite_results_screen', 'option_info', 'tournament_info', 'continue_screen'} | |
1539 | -for i = 1, #t_dir do | |
1540 | - motif[t_dir[i]].fadein_data = main.f_fadeAnim(1, motif[t_dir[i]].fadein_time, motif[t_dir[i]].fadein_col[1], motif[t_dir[i]].fadein_col[2], motif[t_dir[i]].fadein_col[3]) | |
1541 | - animSetWindow(motif[t_dir[i]].fadein_data, main.screenOverscan, 0, motif.info.localcoord[1], motif.info.localcoord[2]) | |
1542 | - motif[t_dir[i]].fadeout_data = main.f_fadeAnim(0, motif[t_dir[i]].fadeout_time, motif[t_dir[i]].fadeout_col[1], motif[t_dir[i]].fadeout_col[2], motif[t_dir[i]].fadeout_col[3]) | |
1543 | - animSetWindow(motif[t_dir[i]].fadeout_data, main.screenOverscan, 0, motif.info.localcoord[1], motif.info.localcoord[2]) | |
1544 | -end | |
1545 | - | |
1546 | ---other entries | |
1589 | +--data | |
1590 | +local anim = '' | |
1591 | +local facing = '' | |
1547 | 1592 | t_dir = {'titlebgdef', 'selectbgdef', 'versusbgdef', 'optionbgdef', 'continuebgdef', 'victorybgdef', 'resultsbgdef', 'tournamentbgdef'} |
1548 | 1593 | for i = 1, #t_dir do |
1549 | - --ctrldef table adjustment | |
1550 | - for k, v in pairs(motif.ctrldef[t_dir[i]]) do | |
1551 | - tmp = motif.ctrldef[t_dir[i]][k].ctrl | |
1552 | - for j = 1, #tmp do | |
1553 | - --if END_TIME is omitted it should default to the same value as START_TIME | |
1554 | - if tmp[j].time[2] == -1 then | |
1555 | - tmp[j].time[2] = tmp[j].time[1] | |
1556 | - end | |
1557 | - --if LOOPTIME is omitted or set to -1, the background controller will not reset its own timer. In such case use GLOBAL_LOOPTIME | |
1558 | - if tmp[j].time[3] == -1 then | |
1559 | - tmp[j].time[3] = motif.ctrldef[t_dir[i]][k].looptime | |
1560 | - end | |
1561 | - --lowercase type name | |
1562 | - tmp[j].type = tmp[j].type:lower() | |
1563 | - --this list, if specified, overrides the default list specified in the BGCtrlDef | |
1564 | - if #tmp[j].ctrlid == 0 then | |
1565 | - for z = 1, #motif.ctrldef[t_dir[i]][k].ctrlid do | |
1566 | - tmp[j].ctrlid[#tmp[j].ctrlid + 1] = motif.ctrldef[t_dir[i]][k].ctrlid[z] | |
1567 | - end | |
1568 | - end | |
1569 | - end | |
1570 | - end | |
1571 | 1594 | --optional sff paths and data |
1572 | 1595 | if motif[t_dir[i]].spr ~= '' then |
1573 | 1596 | if not motif[t_dir[i]].spr:match('^data/') then |
@@ -1577,81 +1600,26 @@ for i = 1, #t_dir do | ||
1577 | 1600 | motif[t_dir[i]].spr = 'data/' .. motif[t_dir[i]].spr |
1578 | 1601 | end |
1579 | 1602 | end |
1580 | - motif[t_dir[i]].spr_data = sffNew(motif[t_dir[i]].spr) | |
1603 | + motif[t_dir[i]].spr_data = sffNew(motif[t_dir[i]].spr) --does sff work with all data or just backgrounds? If the latter then it's not needed | |
1581 | 1604 | main.loadingRefresh() |
1582 | 1605 | elseif motif[t_dir[i]].spr ~= 'continuebgdef' and motif[t_dir[i]].spr ~= 'tournamentbgdef' then |
1583 | 1606 | motif[t_dir[i]].spr = motif.files.spr |
1584 | 1607 | motif[t_dir[i]].spr_data = motif.files.spr_data |
1585 | 1608 | end |
1586 | - --clearcolor data | |
1587 | - motif[t_dir[i]].bgclearcolor_data = main.f_clearColor(motif[t_dir[i]].bgclearcolor[1], motif[t_dir[i]].bgclearcolor[2], motif[t_dir[i]].bgclearcolor[3]) | |
1588 | - animSetWindow(motif[t_dir[i]].bgclearcolor_data, main.screenOverscan, 0, motif.info.localcoord[1], motif.info.localcoord[2]) | |
1589 | - --background data | |
1590 | - motif[t_dir[i]].bg_data = {} | |
1591 | - local t_bgdef = motif[t_dir[i]].bg | |
1592 | - local prev_k = '' | |
1593 | - for k, v in pairs(t_bgdef) do --loop through table keys | |
1594 | - t_bgdef[k].type = t_bgdef[k].type:lower() | |
1595 | - --mugen ignores delta = 0 (defaults to 1) | |
1596 | - if t_bgdef[k].delta[1] == 0 then t_bgdef[k].delta[1] = 1 end | |
1597 | - if t_bgdef[k].delta[2] == 0 then t_bgdef[k].delta[2] = 1 end | |
1598 | - --add ctrl data | |
1599 | - motif[t_dir[i]].bg[k].ctrl = main.f_ctrlBG(t_bgdef[k], motif.ctrldef[t_dir[i]]) | |
1600 | - --positionlink adjustment | |
1601 | - if t_bgdef[k].positionlink == 1 and prev_k ~= '' then | |
1602 | - t_bgdef[k].start[1] = t_bgdef[prev_k].start[1] | |
1603 | - t_bgdef[k].start[2] = t_bgdef[prev_k].start[2] | |
1604 | - t_bgdef[k].delta[1] = t_bgdef[prev_k].delta[1] | |
1605 | - t_bgdef[k].delta[2] = t_bgdef[prev_k].delta[2] | |
1606 | - end | |
1607 | - prev_k = k | |
1608 | - --generate anim data | |
1609 | - local sizeX, sizeY, offsetX, offsetY = 0, 0, 0, 0 | |
1610 | - if t_bgdef[k].type == 'anim' then | |
1611 | - anim = main.f_animFromTable(motif.anim[t_bgdef[k].actionno], motif[t_dir[i]].spr_data, (t_bgdef[k].start[1] + main.normalSpriteCenter), t_bgdef[k].start[2]) | |
1612 | - else --normal, parallax | |
1613 | - anim = t_bgdef[k].spriteno[1] .. ', ' .. t_bgdef[k].spriteno[2] .. ', ' .. (t_bgdef[k].start[1] + main.normalSpriteCenter) .. ', ' .. t_bgdef[k].start[2] .. ', ' .. -1 | |
1614 | - anim = animNew(motif[t_dir[i]].spr_data, anim) | |
1615 | - sizeX, sizeY, offsetX, offsetY = getSpriteInfo(motif[t_dir[i]].spr, t_bgdef[k].spriteno[1], t_bgdef[k].spriteno[2]) | |
1616 | - end | |
1617 | - if t_bgdef[k].trans == 'add1' then | |
1618 | - animSetAlpha(anim, 255, 128) | |
1619 | - elseif t_bgdef[k].trans == 'add' then | |
1620 | - animSetAlpha(anim, 255, 255) | |
1621 | - elseif t_bgdef[k].trans == 'sub' then | |
1622 | - animSetAlpha(anim, 1, 255) | |
1623 | - end | |
1624 | - animAddPos(anim, 160, 0) --for some reason needed in ikemen | |
1625 | - if t_bgdef[k].window ~= nil and t_bgdef[k].window[1] ~= nil and t_bgdef[k].window[2] ~= nil and t_bgdef[k].window[3] ~= nil and t_bgdef[k].window[4] ~= nil then | |
1626 | - animSetWindow( | |
1627 | - anim, | |
1628 | - t_bgdef[k].window[1], | |
1629 | - t_bgdef[k].window[2], | |
1630 | - t_bgdef[k].window[3] - t_bgdef[k].window[1] + 1, | |
1631 | - t_bgdef[k].window[4] - t_bgdef[k].window[2] + 1 | |
1632 | - ) | |
1633 | - else | |
1634 | - animSetWindow(anim, main.screenOverscan, 0, motif.info.localcoord[1], motif.info.localcoord[2]) | |
1635 | - end | |
1636 | - if t_bgdef[k].tilespacing[2] == nil then t_bgdef[k].tilespacing[2] = t_bgdef[k].tilespacing[1] end | |
1637 | - if t_bgdef[k].type == 'parallax' then | |
1638 | - animSetTile(anim, t_bgdef[k].tile[1], 0, t_bgdef[k].tilespacing[1] + sizeX, t_bgdef[k].tilespacing[2] + sizeY) | |
1639 | - else | |
1640 | - animSetTile(anim, t_bgdef[k].tile[1], t_bgdef[k].tile[2], t_bgdef[k].tilespacing[1] + sizeX, t_bgdef[k].tilespacing[2] + sizeY) | |
1641 | - end | |
1642 | - if t_bgdef[k].mask == 1 or t_bgdef[k].type ~= 'normal' or (t_bgdef[k].trans ~= '' and t_bgdef[k].trans ~= 'none') then | |
1643 | - animSetColorKey(anim, 0) | |
1609 | + --backgrounds | |
1610 | + motif[t_dir[i]].bg = bgNew(motif.def, t_dir[i]:match('^(.+)def$'), motif[t_dir[i]].spr) | |
1611 | + main.loadingRefresh() | |
1612 | +end | |
1613 | + | |
1614 | +for k, v in pairs(motif.files.font) do --loop through table keys | |
1615 | + if v ~= '' and motif.font_data[v] == nil then | |
1616 | + if motif.files.font_height[k] ~= nil then | |
1617 | + motif.font_data[v] = fontNew(v, motif.files.font_height[k]) | |
1644 | 1618 | else |
1645 | - animSetColorKey(anim, -1) | |
1619 | + motif.font_data[v] = fontNew(v) | |
1646 | 1620 | end |
1647 | - | |
1648 | - -- Scale non animated sprites | |
1649 | - animUpdate(anim) | |
1650 | - animSetScale(anim, 1 ,1) | |
1651 | - | |
1652 | - motif[t_dir[i]].bg_data[k] = anim | |
1653 | - main.loadingRefresh() | |
1654 | 1621 | end |
1622 | + main.loadingRefresh() | |
1655 | 1623 | end |
1656 | 1624 | |
1657 | 1625 | local function f_facing(var) |
@@ -1662,27 +1630,6 @@ local function f_facing(var) | ||
1662 | 1630 | end |
1663 | 1631 | end |
1664 | 1632 | |
1665 | -local function f_alphaToTable(var) --not used yet | |
1666 | - var = var:match('^%s*(.-)%s*$') | |
1667 | - var = var:lower() | |
1668 | - if var:match('^a$') then | |
1669 | - return {255, 255} --AS256D256 | |
1670 | - elseif var:match('^a1$') then | |
1671 | - return {255, 128} --AS256D128 | |
1672 | - elseif var:match('^s$') then | |
1673 | - return {1, 255} --AS0D256 | |
1674 | - elseif var:match('^s1$') then | |
1675 | - return {1, 128} --are these values correct for S1? | |
1676 | - elseif var:match('^as[0-9]+d[0-9]+$') then | |
1677 | - local tabl = {} | |
1678 | - tabl[1] = tonumber(var:match('^as([0-9]+)')) | |
1679 | - tabl[2] = tonumber(var:match('d([0-9]+)$')) | |
1680 | - return tabl | |
1681 | - else | |
1682 | - return nil | |
1683 | - end | |
1684 | -end | |
1685 | - | |
1686 | 1633 | t = motif.select_info |
1687 | 1634 | t_dir = { |
1688 | 1635 | {s = 'cell_bg_', x = 0, y = 0}, |
@@ -1703,21 +1650,12 @@ t_dir = { | ||
1703 | 1650 | {s = 'p2_teammenu_item_cursor_', x = t.p2_teammenu_pos[1] + t.p2_teammenu_item_offset[1], y = t.p2_teammenu_pos[2] + t.p2_teammenu_item_offset[2]}, |
1704 | 1651 | {s = 'p2_teammenu_value_icon_', x = t.p2_teammenu_pos[1] + t.p2_teammenu_item_offset[1], y = t.p2_teammenu_pos[2] + t.p2_teammenu_item_offset[2]}, |
1705 | 1652 | {s = 'p2_teammenu_value_empty_icon_', x = t.p2_teammenu_pos[1] + t.p2_teammenu_item_offset[1], y = t.p2_teammenu_pos[2] + t.p2_teammenu_item_offset[2]}, |
1653 | + {s = 'stage_portrait_random_', x = t.stage_pos[1] + t.stage_portrait_offset[1], y = t.stage_pos[2] + t.stage_portrait_offset[2]}, | |
1654 | + | |
1706 | 1655 | } |
1707 | 1656 | for i = 1, #t_dir do |
1708 | - --if i <= 2 and #t[t_dir[i].s .. 'spr'] == 0 and t[t_dir[i].s .. 'anim'] ~= nil and motif.anim[t[t_dir[i].s .. 'anim']] ~= nil then --cell_bg_, cell_random_ | |
1709 | - -- for j = 1, #motif.anim[t[t_dir[i].s .. 'anim']] do | |
1710 | - -- for k, c in ipairs(main.f_strsplit(',', motif.anim[t[t_dir[i].s .. 'anim']][j])) do | |
1711 | - -- if c:match('loopstart') then | |
1712 | - -- break | |
1713 | - -- elseif k <= 2 then | |
1714 | - -- t[t_dir[i].s .. 'spr'][k] = tonumber(c) | |
1715 | - -- elseif k == 7 and type(c) == 'string' then | |
1716 | - -- t[t_dir[i].s .. 'alpha'] = f_alphaToTable(c) | |
1717 | - -- end | |
1718 | - -- end | |
1719 | - -- end | |
1720 | - --end | |
1657 | + --if t[t_dir[i].s .. 'offset'] == nil then t[t_dir[i].s .. 'offset'] = {0, 0} end | |
1658 | + --if t[t_dir[i].s .. 'scale'] == nil then t[t_dir[i].s .. 'scale'] = {1.0, 1.0} end | |
1721 | 1659 | if #t[t_dir[i].s .. 'spr'] > 0 then --create sprite data |
1722 | 1660 | if #t[t_dir[i].s .. 'spr'] == 1 then --fix values |
1723 | 1661 | if type(t[t_dir[i].s .. 'spr'][1]) == 'string' then |
@@ -1746,7 +1684,6 @@ for i = 1, #t_dir do | ||
1746 | 1684 | animUpdate(t[t_dir[i].s .. 'data']) |
1747 | 1685 | end |
1748 | 1686 | animSetWindow(t[t_dir[i].s .. 'data'], main.screenOverscan, 0, motif.info.localcoord[1], motif.info.localcoord[2]) |
1749 | - --animAddPos(t[t_dir[i].s .. 'data'], 160, 0) --for some reason needed in ikemen (but not in this case) | |
1750 | 1687 | main.loadingRefresh() |
1751 | 1688 | end |
1752 | 1689 |
@@ -1764,15 +1701,32 @@ if motif.anim[t.continue_anim] ~= nil then | ||
1764 | 1701 | end |
1765 | 1702 | |
1766 | 1703 | if motif.vs_screen.p1_name_active_font == nil then |
1767 | - motif.vs_screen.p1_name_active_font = {motif.vs_screen.p1_name_font[1], motif.vs_screen.p1_name_font[2], motif.vs_screen.p1_name_font[3]} | |
1704 | + motif.vs_screen.p1_name_active_font = { | |
1705 | + motif.vs_screen.p1_name_font[1], | |
1706 | + motif.vs_screen.p1_name_font[2], | |
1707 | + motif.vs_screen.p1_name_font[3], | |
1708 | + motif.vs_screen.p1_name_font[4], | |
1709 | + motif.vs_screen.p1_name_font[5], | |
1710 | + motif.vs_screen.p1_name_font[6], | |
1711 | + motif.vs_screen.p1_name_font[7], | |
1712 | + motif.vs_screen.p1_name_font[8] | |
1713 | + } | |
1768 | 1714 | motif.vs_screen.p1_name_active_font_scale = {motif.vs_screen.p1_name_font_scale[1], motif.vs_screen.p1_name_font_scale[2]} |
1769 | 1715 | end |
1770 | 1716 | if motif.vs_screen.p2_name_active_font == nil then |
1771 | - motif.vs_screen.p2_name_active_font = {motif.vs_screen.p2_name_font[1], motif.vs_screen.p2_name_font[2], motif.vs_screen.p2_name_font[3]} | |
1717 | + motif.vs_screen.p2_name_active_font = { | |
1718 | + motif.vs_screen.p2_name_font[1], | |
1719 | + motif.vs_screen.p2_name_font[2], | |
1720 | + motif.vs_screen.p2_name_font[3], | |
1721 | + motif.vs_screen.p2_name_font[4], | |
1722 | + motif.vs_screen.p2_name_font[5], | |
1723 | + motif.vs_screen.p2_name_font[6], | |
1724 | + motif.vs_screen.p2_name_font[7], | |
1725 | + motif.vs_screen.p2_name_font[8] | |
1726 | + } | |
1772 | 1727 | motif.vs_screen.p2_name_active_font_scale = {motif.vs_screen.p2_name_font_scale[1], motif.vs_screen.p2_name_font_scale[2]} |
1773 | 1728 | end |
1774 | 1729 | |
1775 | ---motif.ctrldef = nil | |
1776 | 1730 | main.f_printTable(motif, "debug/t_motif.txt") |
1777 | 1731 | |
1778 | 1732 | return motif |
@@ -2,29 +2,26 @@ | ||
2 | 2 | local options = {} |
3 | 3 | |
4 | 4 | --;=========================================================== |
5 | ---; LOAD DATA | |
6 | ---;=========================================================== | |
7 | - | |
8 | --- Data loading from lifebar | |
9 | -local file = io.open(motif.files.fight,"r") | |
10 | -local s_lifebar = file:read("*all") | |
11 | -file:close() | |
12 | -local roundsNum = tonumber(s_lifebar:match('match.wins%s*=%s*(%d+)')) | |
13 | -options.framespercount = tonumber(s_lifebar:match('framespercount%s*=%s*(%d+)')) | |
14 | - | |
15 | -main.f_printTable(config, "debug/config.txt") | |
16 | - | |
17 | ---;=========================================================== | |
18 | 5 | --; COMMON |
19 | 6 | --;=========================================================== |
20 | 7 | local modified = 0 |
21 | -local modifiedlifebar = 0 | |
22 | 8 | local needReload = 0 |
23 | 9 | |
24 | -local windowBox = animNew(main.fadeSff, '0,0, 0,0, -1') | |
25 | -animSetTile(windowBox, 1, 1) | |
26 | -animSetAlpha(windowBox, motif.option_info.menu_boxbackground_alpha[1], motif.option_info.menu_boxbackground_alpha[2]) | |
27 | -animUpdate(windowBox) | |
10 | +if config.RoundsNumSingle == -1 then | |
11 | + options.roundsNumSingle = getMatchWins() | |
12 | +else | |
13 | + options.roundsNumSingle = config.RoundsNumSingle | |
14 | +end | |
15 | +if config.RoundsNumTeam == -1 then | |
16 | + options.roundsNumTeam = getMatchWins() | |
17 | +else | |
18 | + options.roundsNumTeam = config.RoundsNumTeam | |
19 | +end | |
20 | +if config.MaxDrawGames == -2 then | |
21 | + options.maxDrawGames = getMatchMaxDrawGames() | |
22 | +else | |
23 | + options.maxDrawGames = config.MaxDrawGames | |
24 | +end | |
28 | 25 | |
29 | 26 | --return string depending on bool |
30 | 27 | function options.f_boolDisplay(bool, t, f) |
@@ -37,15 +34,12 @@ function options.f_boolDisplay(bool, t, f) | ||
37 | 34 | end |
38 | 35 | end |
39 | 36 | |
40 | ---return string depending on int | |
41 | -function options.f_intDisplay(bool, t, f) | |
42 | - t = t or motif.option_info.menu_itemname_yes | |
43 | - f = f or motif.option_info.menu_itemname_no | |
44 | - if bool == 1 then | |
45 | - return t | |
46 | - else | |
47 | - return f | |
37 | +--return table entry if provided key exists there, otherwise return default argument | |
38 | +function options.f_definedDisplay(key, t, default) | |
39 | + if t[key] ~= nil then | |
40 | + return t[key] | |
48 | 41 | end |
42 | + return default | |
49 | 43 | end |
50 | 44 | |
51 | 45 | --return correct precision |
@@ -53,20 +47,12 @@ function options.f_precision(v, decimal) | ||
53 | 47 | return tonumber(string.format(decimal, v)) |
54 | 48 | end |
55 | 49 | |
50 | +--save configuration | |
56 | 51 | function options.f_saveCfg() |
57 | 52 | --Data saving to config.json |
58 | 53 | local file = io.open("save/config.json","w+") |
59 | 54 | file:write(json.encode(config, {indent = true})) |
60 | 55 | file:close() |
61 | - --Data saving to lifebar | |
62 | - if modifiedlifebar == 1 then | |
63 | - s_lifebar = s_lifebar:gsub('match.wins%s*=%s*%d+', 'match.wins = ' .. roundsNum) | |
64 | - file = io.open(motif.files.fight,"w+") | |
65 | - file:write(s_lifebar) | |
66 | - file:close() | |
67 | - --Reload lifebar | |
68 | - loadLifebar(motif.files.fight) | |
69 | - end | |
70 | 56 | --Reload game if needed |
71 | 57 | if needReload == 1 then |
72 | 58 | main.f_warning(main.f_extractText(motif.warning_info.text_reload), motif.option_info, motif.optionbgdef) |
@@ -74,62 +60,134 @@ function options.f_saveCfg() | ||
74 | 60 | end |
75 | 61 | end |
76 | 62 | |
63 | +--reset key settings | |
77 | 64 | function options.f_keyDefault() |
78 | - config.KeyConfig[1].Buttons[1] = 'UP' | |
79 | - config.KeyConfig[1].Buttons[2] = 'DOWN' | |
80 | - config.KeyConfig[1].Buttons[3] = 'LEFT' | |
81 | - config.KeyConfig[1].Buttons[4] = 'RIGHT' | |
82 | - config.KeyConfig[1].Buttons[5] = 'z' | |
83 | - config.KeyConfig[1].Buttons[6] = 'x' | |
84 | - config.KeyConfig[1].Buttons[7] = 'c' | |
85 | - config.KeyConfig[1].Buttons[8] = 'a' | |
86 | - config.KeyConfig[1].Buttons[9] = 's' | |
87 | - config.KeyConfig[1].Buttons[10] = 'd' | |
88 | - config.KeyConfig[1].Buttons[11] = 'RETURN' | |
89 | - config.KeyConfig[1].Buttons[12] = 'q' | |
90 | - config.KeyConfig[1].Buttons[13] = 'w' | |
91 | - config.KeyConfig[2].Buttons[1] = 't' | |
92 | - config.KeyConfig[2].Buttons[2] = 'g' | |
93 | - config.KeyConfig[2].Buttons[3] = 'f' | |
94 | - config.KeyConfig[2].Buttons[4] = 'h' | |
95 | - config.KeyConfig[2].Buttons[5] = 'j' | |
96 | - config.KeyConfig[2].Buttons[6] = 'k' | |
97 | - config.KeyConfig[2].Buttons[7] = 'l' | |
98 | - config.KeyConfig[2].Buttons[8] = 'u' | |
99 | - config.KeyConfig[2].Buttons[9] = 'i' | |
100 | - config.KeyConfig[2].Buttons[10] = 'o' | |
101 | - config.KeyConfig[2].Buttons[11] = 'RSHIFT' | |
102 | - config.KeyConfig[2].Buttons[12] = 'LEFTBRACKET' | |
103 | - config.KeyConfig[2].Buttons[13] = 'RIGHTBRACKET' | |
104 | - config.JoystickConfig[1].Buttons[1] = '-7' | |
105 | - config.JoystickConfig[1].Buttons[2] = '-8' | |
106 | - config.JoystickConfig[1].Buttons[3] = '-5' | |
107 | - config.JoystickConfig[1].Buttons[4] = '-6' | |
108 | - config.JoystickConfig[1].Buttons[5] = '0' | |
109 | - config.JoystickConfig[1].Buttons[6] = '1' | |
110 | - config.JoystickConfig[1].Buttons[7] = '4' | |
111 | - config.JoystickConfig[1].Buttons[8] = '2' | |
112 | - config.JoystickConfig[1].Buttons[9] = '3' | |
113 | - config.JoystickConfig[1].Buttons[10] = '5' | |
114 | - config.JoystickConfig[1].Buttons[11] = '7' | |
115 | - config.JoystickConfig[1].Buttons[12] = '6' | |
116 | - config.JoystickConfig[1].Buttons[13] = '8' | |
117 | - config.JoystickConfig[2].Buttons[1] = '-7' | |
118 | - config.JoystickConfig[2].Buttons[2] = '-8' | |
119 | - config.JoystickConfig[2].Buttons[3] = '-5' | |
120 | - config.JoystickConfig[2].Buttons[4] = '-6' | |
121 | - config.JoystickConfig[2].Buttons[5] = '0' | |
122 | - config.JoystickConfig[2].Buttons[6] = '1' | |
123 | - config.JoystickConfig[2].Buttons[7] = '4' | |
124 | - config.JoystickConfig[2].Buttons[8] = '2' | |
125 | - config.JoystickConfig[2].Buttons[9] = '3' | |
126 | - config.JoystickConfig[2].Buttons[10] = '5' | |
127 | - config.JoystickConfig[2].Buttons[11] = '7' | |
128 | - config.JoystickConfig[2].Buttons[12] = '6' | |
129 | - config.JoystickConfig[2].Buttons[13] = '8' | |
65 | + for i = 1, #config.KeyConfig do | |
66 | + if i == 1 then | |
67 | + config.KeyConfig[i].Buttons[1] = 'UP' | |
68 | + config.KeyConfig[i].Buttons[2] = 'DOWN' | |
69 | + config.KeyConfig[i].Buttons[3] = 'LEFT' | |
70 | + config.KeyConfig[i].Buttons[4] = 'RIGHT' | |
71 | + config.KeyConfig[i].Buttons[5] = 'z' | |
72 | + config.KeyConfig[i].Buttons[6] = 'x' | |
73 | + config.KeyConfig[i].Buttons[7] = 'c' | |
74 | + config.KeyConfig[i].Buttons[8] = 'a' | |
75 | + config.KeyConfig[i].Buttons[9] = 's' | |
76 | + config.KeyConfig[i].Buttons[10] = 'd' | |
77 | + config.KeyConfig[i].Buttons[11] = 'RETURN' | |
78 | + config.KeyConfig[i].Buttons[12] = 'q' | |
79 | + config.KeyConfig[i].Buttons[13] = 'w' | |
80 | + elseif i == 2 then | |
81 | + config.KeyConfig[i].Buttons[1] = 't' | |
82 | + config.KeyConfig[i].Buttons[2] = 'g' | |
83 | + config.KeyConfig[i].Buttons[3] = 'f' | |
84 | + config.KeyConfig[i].Buttons[4] = 'h' | |
85 | + config.KeyConfig[i].Buttons[5] = 'j' | |
86 | + config.KeyConfig[i].Buttons[6] = 'k' | |
87 | + config.KeyConfig[i].Buttons[7] = 'l' | |
88 | + config.KeyConfig[i].Buttons[8] = 'u' | |
89 | + config.KeyConfig[i].Buttons[9] = 'i' | |
90 | + config.KeyConfig[i].Buttons[10] = 'o' | |
91 | + config.KeyConfig[i].Buttons[11] = 'RSHIFT' | |
92 | + config.KeyConfig[i].Buttons[12] = 'LEFTBRACKET' | |
93 | + config.KeyConfig[i].Buttons[13] = 'RIGHTBRACKET' | |
94 | + else | |
95 | + for j = 1, #config.KeyConfig[i].Buttons do | |
96 | + config.KeyConfig[i].Buttons[j] = tostring(motif.option_info.menu_itemname_info_disable) | |
97 | + end | |
98 | + end | |
99 | + end | |
100 | + for i = 1, #config.JoystickConfig do | |
101 | + config.JoystickConfig[i].Buttons[1] = '-3' | |
102 | + config.JoystickConfig[i].Buttons[2] = '-4' | |
103 | + config.JoystickConfig[i].Buttons[3] = '-1' | |
104 | + config.JoystickConfig[i].Buttons[4] = '-2' | |
105 | + config.JoystickConfig[i].Buttons[5] = '0' | |
106 | + config.JoystickConfig[i].Buttons[6] = '1' | |
107 | + config.JoystickConfig[i].Buttons[7] = '4' | |
108 | + config.JoystickConfig[i].Buttons[8] = '2' | |
109 | + config.JoystickConfig[i].Buttons[9] = '3' | |
110 | + config.JoystickConfig[i].Buttons[10] = '5' | |
111 | + config.JoystickConfig[i].Buttons[11] = '7' | |
112 | + config.JoystickConfig[i].Buttons[12] = '-10' | |
113 | + config.JoystickConfig[i].Buttons[13] = '-12' | |
114 | + end | |
115 | + resetRemapInput() | |
116 | +end | |
117 | + | |
118 | +--reset vardisplay in tables | |
119 | +function options.f_resetTables() | |
120 | + local t_displaynameReset = { | |
121 | + t_mainCfg = { | |
122 | + portchange = getListenPort(), | |
123 | + }, | |
124 | + t_arcadeCfg = { | |
125 | + roundtime = options.f_definedDisplay(config.RoundTime, {[-1] = motif.option_info.menu_itemname_arcade_roundtime_none}, config.RoundTime), | |
126 | + roundsnumsingle = options.roundsNumSingle, | |
127 | + roundsnumteam = options.roundsNumTeam, | |
128 | + maxdrawgames = options.maxDrawGames, | |
129 | + difficulty = config.Difficulty, | |
130 | + credits = config.Credits, | |
131 | + charchange = options.f_boolDisplay(config.ContSelection), | |
132 | + airamping = options.f_boolDisplay(config.AIRamping), | |
133 | + airandomcolor = options.f_boolDisplay(config.AIRandomColor, motif.option_info.menu_itemname_arcade_aipalette_random, motif.option_info.menu_itemname_arcade_aipalette_default), | |
134 | + }, | |
135 | + t_videoCfg = { | |
136 | + resolution = config.Width .. 'x' .. config.Height, | |
137 | + fullscreen = options.f_boolDisplay(config.Fullscreen), | |
138 | + msaa = options.f_boolDisplay(config.MSAA, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled), | |
139 | + postprocessingshader = options.t_shaderNames[config.PostProcessingShader], | |
140 | + }, | |
141 | + t_audioCfg = { | |
142 | + mastervolume = config.MasterVolume .. '%', | |
143 | + bgmvolume = config.BgmVolume .. '%', | |
144 | + sfxvolume = config.WavVolume .. '%', | |
145 | + audioducking = options.f_boolDisplay(config.AudioDucking, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled), | |
146 | + }, | |
147 | + t_gameplayCfg = { | |
148 | + lifemul = config.LifeMul .. '%', | |
149 | + autoguard = options.f_boolDisplay(config.AutoGuard), | |
150 | + team1vs2life = config.Team1VS2Life .. '%', | |
151 | + turnsrecoverybase = config.TurnsRecoveryBase .. '%', | |
152 | + turnsrecoverybonus = config.TurnsRecoveryBonus .. '%', | |
153 | + teampowershare = options.f_boolDisplay(config.TeamPowerShare), | |
154 | + teamlifeshare = options.f_boolDisplay(config.TeamLifeShare), | |
155 | + }, | |
156 | + t_advGameplayCfg = { | |
157 | + attackpowermul = config['Attack.LifeToPowerMul'], | |
158 | + gethitpowermul = config['GetHit.LifeToPowerMul'], | |
159 | + superdefencemul = config['Super.TargetDefenceMul'], | |
160 | + singlemode = options.f_boolDisplay(config.SingleTeamMode, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled), | |
161 | + numturns = options.f_checkTeamAmount(config.NumTurns, 1, motif.option_info.menu_itemname_disabled), | |
162 | + numsimul = options.f_checkTeamAmount(config.NumSimul, 1, motif.option_info.menu_itemname_disabled), | |
163 | + numtag = options.f_checkTeamAmount(config.NumTag, 1, motif.option_info.menu_itemname_disabled), | |
164 | + }, | |
165 | + t_engineCfg = { | |
166 | + allowdebugkeys = options.f_boolDisplay(config.AllowDebugKeys, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled), | |
167 | + simulmode = options.f_boolDisplay(config.SimulMode, motif.option_info.menu_itemname_disabled, motif.option_info.menu_itemname_enabled), | |
168 | + lifebarfontscale = config.LifebarFontScale, | |
169 | + helpermax = config.HelperMax, | |
170 | + playerprojectilemax = config.PlayerProjectileMax, | |
171 | + explodmax = config.ExplodMax, | |
172 | + afterimagemax = config.AfterImageMax, | |
173 | + zoomactive = options.f_boolDisplay(config.ZoomActive), | |
174 | + maxzoomout = config.ZoomMin, | |
175 | + maxzoomin = config.ZoomMax, | |
176 | + zoomspeed = config.ZoomSpeed, | |
177 | + }, | |
178 | + } | |
179 | + for k1, v1 in pairs(t_displaynameReset) do | |
180 | + for k2, v2 in pairs(t_displaynameReset[k1]) do | |
181 | + for i = 1, #options[k1] do | |
182 | + if options[k1][i].itemname == k2 then | |
183 | + options[k1][i].vardisplay = v2 | |
184 | + end | |
185 | + end | |
186 | + end | |
187 | + end | |
130 | 188 | end |
131 | 189 | |
132 | -function options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
190 | +function options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
133 | 191 | if commandGetState(main.p1Cmd, 'u') then |
134 | 192 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
135 | 193 | item = item - 1 |
@@ -184,33 +242,35 @@ local txt_title = main.f_createTextImg( | ||
184 | 242 | motif.option_info.title_font_scale[2], |
185 | 243 | motif.option_info.title_font[4], |
186 | 244 | motif.option_info.title_font[5], |
187 | - motif.option_info.title_font[6] | |
245 | + motif.option_info.title_font[6], | |
246 | + motif.option_info.title_font[7], | |
247 | + motif.option_info.title_font[8] | |
188 | 248 | ) |
189 | -function options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
249 | +function options.f_menuCommonDraw(cursorPosY, moveTxt, item, t, fadeType) | |
250 | + fadeType = fadeType or 'fadein' | |
190 | 251 | --draw clearcolor |
191 | - animDraw(motif.optionbgdef.bgclearcolor_data) | |
252 | + clearColor(motif.optionbgdef.bgclearcolor[1], motif.optionbgdef.bgclearcolor[2], motif.optionbgdef.bgclearcolor[3]) | |
192 | 253 | --draw layerno = 0 backgrounds |
193 | - main.f_drawBG(motif.optionbgdef.bg_data, motif.optionbgdef.bg, 0, motif.optionbgdef.timer, {320,240}) | |
254 | + bgDraw(motif.optionbgdef.bg, false) | |
194 | 255 | --draw menu box |
195 | - if motif.option_info.menu_boxbackground_visible == 1 then | |
256 | + if motif.option_info.menu_boxbg_visible == 1 then | |
257 | + local coord4 = 0 | |
196 | 258 | if #t > motif.option_info.menu_window_visibleitems and moveTxt == (#t - motif.option_info.menu_window_visibleitems) * motif.option_info.menu_item_spacing[2] then |
197 | - animSetWindow( | |
198 | - windowBox, | |
199 | - motif.option_info.menu_pos[1] + motif.option_info.menu_boxcursor_coords[1], | |
200 | - motif.option_info.menu_pos[2] + motif.option_info.menu_boxcursor_coords[2], | |
201 | - motif.option_info.menu_boxcursor_coords[3] - motif.option_info.menu_boxcursor_coords[1] + 1, | |
202 | - motif.option_info.menu_window_visibleitems * (motif.option_info.menu_boxcursor_coords[4] - motif.option_info.menu_boxcursor_coords[2] + 1) | |
203 | - ) | |
259 | + coord4 = motif.option_info.menu_window_visibleitems * (motif.option_info.menu_boxcursor_coords[4] - motif.option_info.menu_boxcursor_coords[2] + 1) + main.f_oddRounding(motif.option_info.menu_boxcursor_coords[2]) | |
204 | 260 | else |
205 | - animSetWindow( | |
206 | - windowBox, | |
207 | - motif.option_info.menu_pos[1] + motif.option_info.menu_boxcursor_coords[1], | |
208 | - motif.option_info.menu_pos[2] + motif.option_info.menu_boxcursor_coords[2], | |
209 | - motif.option_info.menu_boxcursor_coords[3] - motif.option_info.menu_boxcursor_coords[1] + 1, | |
210 | - #t * (motif.option_info.menu_boxcursor_coords[4] - motif.option_info.menu_boxcursor_coords[2] + 1) | |
211 | - ) | |
261 | + coord4 = #t * (motif.option_info.menu_boxcursor_coords[4] - motif.option_info.menu_boxcursor_coords[2] + 1) + main.f_oddRounding(motif.option_info.menu_boxcursor_coords[2]) | |
212 | 262 | end |
213 | - animDraw(windowBox) | |
263 | + fillRect( | |
264 | + motif.option_info.menu_pos[1] + motif.option_info.menu_boxcursor_coords[1], | |
265 | + motif.option_info.menu_pos[2] + motif.option_info.menu_boxcursor_coords[2], | |
266 | + motif.option_info.menu_boxcursor_coords[3] - motif.option_info.menu_boxcursor_coords[1] + 1, | |
267 | + coord4, | |
268 | + motif.option_info.menu_boxbg_col[1], | |
269 | + motif.option_info.menu_boxbg_col[2], | |
270 | + motif.option_info.menu_boxbg_col[3], | |
271 | + motif.option_info.menu_boxbg_alpha[1], | |
272 | + motif.option_info.menu_boxbg_alpha[2] | |
273 | + ) | |
214 | 274 | end |
215 | 275 | --draw title |
216 | 276 | textImgDraw(txt_title) |
@@ -230,7 +290,9 @@ function options.f_menuCommon2(cursorPosY, moveTxt, item, t) | ||
230 | 290 | motif.option_info.menu_item_active_font_scale[2], |
231 | 291 | motif.option_info.menu_item_active_font[4], |
232 | 292 | motif.option_info.menu_item_active_font[5], |
233 | - motif.option_info.menu_item_active_font[6] | |
293 | + motif.option_info.menu_item_active_font[6], | |
294 | + motif.option_info.menu_item_active_font[7], | |
295 | + motif.option_info.menu_item_active_font[8] | |
234 | 296 | )) |
235 | 297 | if t[i].vardata ~= nil then |
236 | 298 | textImgDraw(main.f_updateTextImg( |
@@ -245,7 +307,9 @@ function options.f_menuCommon2(cursorPosY, moveTxt, item, t) | ||
245 | 307 | motif.option_info.menu_item_value_active_font_scale[2], |
246 | 308 | motif.option_info.menu_item_value_active_font[4], |
247 | 309 | motif.option_info.menu_item_value_active_font[5], |
248 | - motif.option_info.menu_item_value_active_font[6] | |
310 | + motif.option_info.menu_item_value_active_font[6], | |
311 | + motif.option_info.menu_item_value_active_font[7], | |
312 | + motif.option_info.menu_item_value_active_font[8] | |
249 | 313 | )) |
250 | 314 | end |
251 | 315 | else |
@@ -261,7 +325,9 @@ function options.f_menuCommon2(cursorPosY, moveTxt, item, t) | ||
261 | 325 | motif.option_info.menu_item_font_scale[2], |
262 | 326 | motif.option_info.menu_item_font[4], |
263 | 327 | motif.option_info.menu_item_font[5], |
264 | - motif.option_info.menu_item_font[6] | |
328 | + motif.option_info.menu_item_font[6], | |
329 | + motif.option_info.menu_item_font[7], | |
330 | + motif.option_info.menu_item_font[8] | |
265 | 331 | )) |
266 | 332 | if t[i].vardata ~= nil then |
267 | 333 | textImgDraw(main.f_updateTextImg( |
@@ -276,45 +342,63 @@ function options.f_menuCommon2(cursorPosY, moveTxt, item, t) | ||
276 | 342 | motif.option_info.menu_item_value_font_scale[2], |
277 | 343 | motif.option_info.menu_item_value_font[4], |
278 | 344 | motif.option_info.menu_item_value_font[5], |
279 | - motif.option_info.menu_item_value_font[6] | |
345 | + motif.option_info.menu_item_value_font[6], | |
346 | + motif.option_info.menu_item_value_font[7], | |
347 | + motif.option_info.menu_item_value_font[8] | |
280 | 348 | )) |
281 | 349 | end |
282 | 350 | end |
283 | 351 | end |
284 | 352 | end |
285 | 353 | --draw menu cursor |
286 | - if motif.option_info.menu_boxcursor_visible == 1 then | |
287 | - animSetWindow( | |
288 | - main.cursorBox, | |
354 | + if motif.option_info.menu_boxcursor_visible == 1 and not main.fadeActive then | |
355 | + local src, dst = main.f_boxcursorAlpha( | |
356 | + motif.option_info.menu_boxcursor_alpharange[1], | |
357 | + motif.option_info.menu_boxcursor_alpharange[2], | |
358 | + motif.option_info.menu_boxcursor_alpharange[3], | |
359 | + motif.option_info.menu_boxcursor_alpharange[4], | |
360 | + motif.option_info.menu_boxcursor_alpharange[5], | |
361 | + motif.option_info.menu_boxcursor_alpharange[6] | |
362 | + ) | |
363 | + fillRect( | |
289 | 364 | motif.option_info.menu_pos[1] + motif.option_info.menu_boxcursor_coords[1], |
290 | 365 | motif.option_info.menu_pos[2] + motif.option_info.menu_boxcursor_coords[2] + (cursorPosY - 1) * motif.option_info.menu_item_spacing[2], |
291 | 366 | motif.option_info.menu_boxcursor_coords[3] - motif.option_info.menu_boxcursor_coords[1] + 1, |
292 | - motif.option_info.menu_boxcursor_coords[4] - motif.option_info.menu_boxcursor_coords[2] + 1 | |
367 | + motif.option_info.menu_boxcursor_coords[4] - motif.option_info.menu_boxcursor_coords[2] + 1 + main.f_oddRounding(motif.option_info.menu_boxcursor_coords[2]), | |
368 | + motif.option_info.menu_boxcursor_col[1], | |
369 | + motif.option_info.menu_boxcursor_col[2], | |
370 | + motif.option_info.menu_boxcursor_col[3], | |
371 | + src, | |
372 | + dst | |
293 | 373 | ) |
294 | - main.f_dynamicAlpha(main.cursorBox, 10,40,2, 255,255,0) | |
295 | - animDraw(main.cursorBox) | |
296 | 374 | end |
297 | 375 | --draw layerno = 1 backgrounds |
298 | - main.f_drawBG(motif.optionbgdef.bg_data, motif.optionbgdef.bg, 1, motif.optionbgdef.timer, {320,240}) | |
299 | - --draw fadein | |
300 | - animDraw(motif.option_info.fadein_data) | |
301 | - animUpdate(motif.option_info.fadein_data) | |
302 | - --update timer | |
303 | - motif.optionbgdef.timer = motif.optionbgdef.timer + 1 | |
304 | - --end loop | |
305 | - main.f_cmdInput() | |
376 | + bgDraw(motif.optionbgdef.bg, true) | |
377 | + --draw fadein / fadeout | |
378 | + main.fadeActive = fadeScreen( | |
379 | + fadeType, | |
380 | + main.fadeStart, | |
381 | + motif.option_info[fadeType .. '_time'], | |
382 | + motif.option_info[fadeType .. '_col'][1], | |
383 | + motif.option_info[fadeType .. '_col'][2], | |
384 | + motif.option_info[fadeType .. '_col'][3] | |
385 | + ) | |
386 | + --frame transition | |
387 | + if main.fadeActive then | |
388 | + commandBufReset(main.p1Cmd) | |
389 | + elseif fadeType == 'fadeout' then | |
390 | + commandBufReset(main.p1Cmd) | |
391 | + return --skip last frame rendering | |
392 | + else | |
393 | + main.f_cmdInput() | |
394 | + end | |
306 | 395 | refresh() |
307 | 396 | end |
308 | 397 | |
309 | 398 | --;=========================================================== |
310 | 399 | --; MAIN LOOP |
311 | 400 | --;=========================================================== |
312 | -local t_quicklaunchNames = {} | |
313 | -t_quicklaunchNames[0] = "Disabled" | |
314 | -t_quicklaunchNames[1] = "Level1" | |
315 | -t_quicklaunchNames[2] = "Level2" | |
316 | - | |
317 | -local t_mainCfg = { | |
401 | +options.t_mainCfg = { | |
318 | 402 | {data = textImgNew(), itemname = 'arcadesettings', displayname = motif.option_info.menu_itemname_main_arcade}, |
319 | 403 | {data = textImgNew(), itemname = 'videosettings', displayname = motif.option_info.menu_itemname_main_video}, |
320 | 404 | {data = textImgNew(), itemname = 'audiosettings', displayname = motif.option_info.menu_itemname_main_audio}, |
@@ -322,28 +406,39 @@ local t_mainCfg = { | ||
322 | 406 | {data = textImgNew(), itemname = 'gameplaysettings', displayname = motif.option_info.menu_itemname_main_gameplay}, |
323 | 407 | {data = textImgNew(), itemname = 'enginesettings', displayname = motif.option_info.menu_itemname_main_engine}, |
324 | 408 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
325 | - {data = textImgNew(), itemname = 'quicklaunch', displayname = motif.option_info.menu_itemname_engine_quicklaunch, vardata = textImgNew(), vardisplay = t_quicklaunchNames[config.QuickLaunch]}, | |
326 | 409 | {data = textImgNew(), itemname = 'portchange', displayname = motif.option_info.menu_itemname_main_port, vardata = textImgNew(), vardisplay = getListenPort()}, |
327 | 410 | {data = textImgNew(), itemname = 'defaultvalues', displayname = motif.option_info.menu_itemname_main_default}, |
328 | 411 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
329 | 412 | {data = textImgNew(), itemname = 'save', displayname = motif.option_info.menu_itemname_main_save}, |
330 | 413 | {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_main_back}, |
331 | 414 | } |
332 | -t_mainCfg = main.f_cleanTable(t_mainCfg) | |
415 | +options.t_mainCfg = main.f_cleanTable(options.t_mainCfg, main.t_sort.option_info) | |
333 | 416 | |
334 | 417 | function options.f_mainCfg() |
335 | 418 | main.f_cmdInput() |
336 | 419 | local cursorPosY = 1 |
337 | 420 | local moveTxt = 0 |
338 | 421 | local item = 1 |
339 | - local t = t_mainCfg | |
422 | + local t = options.t_mainCfg | |
340 | 423 | textImgSetText(txt_title, motif.option_info.title_text_main) |
341 | - main.f_resetBG(motif.option_info, motif.optionbgdef) | |
424 | + if motif.music.option_bgm == '' then | |
425 | + main.f_menuReset(motif.optionbgdef.bg) | |
426 | + else | |
427 | + main.f_menuReset(motif.optionbgdef.bg, motif.music.option_bgm, motif.music.option_bgm_loop, motif.music.option_bgm_volume, motif.music.option_bgm_loopstart, motif.music.option_bgm_loopend) | |
428 | + end | |
342 | 429 | while true do |
343 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
430 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
344 | 431 | if esc() then |
345 | 432 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
346 | - main.f_resetBG(motif.title_info, motif.titlebgdef) | |
433 | + if modified == 1 then | |
434 | + options.f_saveCfg() | |
435 | + end | |
436 | + main.f_menuFade('option_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
437 | + if motif.music.option_bgm == '' then | |
438 | + main.f_menuReset(motif.titlebgdef.bg) | |
439 | + else | |
440 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
441 | + end | |
347 | 442 | break |
348 | 443 | --Port Change |
349 | 444 | elseif t[item].itemname == 'portchange' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then |
@@ -357,42 +452,31 @@ function options.f_mainCfg() | ||
357 | 452 | end |
358 | 453 | t[item].vardisplay = getListenPort() |
359 | 454 | modified = 1 |
360 | - -- Quick Launch | |
361 | - elseif t[item].itemname == 'quicklaunch' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
362 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
363 | - if commandGetState(main.p1Cmd, 'r') and config.QuickLaunch < #t_quicklaunchNames then | |
364 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
365 | - config.QuickLaunch = config.QuickLaunch + 1 | |
366 | - elseif commandGetState(main.p1Cmd, 'l') and config.QuickLaunch > 0 then | |
367 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
368 | - config.QuickLaunch = config.QuickLaunch - 1 | |
369 | - end | |
370 | - t[item].vardisplay = t_quicklaunchNames[config.QuickLaunch] | |
371 | - modified = 1 | |
372 | 455 | elseif main.f_btnPalNo(main.p1Cmd) > 0 then |
373 | 456 | --Arcade Settings |
374 | 457 | if t[item].itemname == 'arcadesettings' then |
375 | 458 | sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) |
376 | 459 | options.f_arcadeCfg() |
377 | - --Gameplay Settings | |
378 | - elseif t[item].itemname == 'gameplaysettings' then | |
379 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
380 | - options.f_gameplayCfg() | |
381 | 460 | --Video Settings |
382 | 461 | elseif t[item].itemname == 'videosettings' then |
383 | 462 | sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) |
384 | 463 | options.f_videoCfg() |
464 | + --Audio Settings | |
385 | 465 | elseif t[item].itemname == 'audiosettings' then |
386 | 466 | sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) |
387 | 467 | options.f_audioCfg() |
388 | - --Engine Settings | |
389 | - elseif t[item].itemname == 'enginesettings' then | |
390 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
391 | - options.f_engineCfg() | |
392 | 468 | --Input Settings |
393 | 469 | elseif t[item].itemname == 'inputsettings' then |
394 | 470 | sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) |
395 | 471 | options.f_inputCfg() |
472 | + --Gameplay Settings | |
473 | + elseif t[item].itemname == 'gameplaysettings' then | |
474 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
475 | + options.f_gameplayCfg() | |
476 | + --Engine Settings | |
477 | + elseif t[item].itemname == 'enginesettings' then | |
478 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
479 | + options.f_engineCfg() | |
396 | 480 | --Default Values |
397 | 481 | elseif t[item].itemname == 'defaultvalues' then |
398 | 482 | sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) |
@@ -400,6 +484,9 @@ function options.f_mainCfg() | ||
400 | 484 | config.PlayerProjectileMax = 256 |
401 | 485 | config.ExplodMax = 512 |
402 | 486 | config.AfterImageMax = 128 |
487 | + config.MasterVolume = 80 | |
488 | + config.WavVolume = 80 | |
489 | + config.BgmVolume = 80 | |
403 | 490 | config['Attack.LifeToPowerMul'] = 0.7 |
404 | 491 | config['GetHit.LifeToPowerMul'] = 0.6 |
405 | 492 | config.Width = 640 |
@@ -408,17 +495,24 @@ function options.f_mainCfg() | ||
408 | 495 | config.LifebarFontScale = 1 |
409 | 496 | --config.System = 'script/main.lua' |
410 | 497 | options.f_keyDefault() |
498 | + --config.ControllerStickSensitivity = 0.4 | |
499 | + --config.XinputTriggerSensitivity = 0 | |
411 | 500 | --config.Motif = 'data/system.def' |
501 | + --config.CommonAir = 'data/common.air' | |
502 | + --config.CommonCmd = 'data/common.cmd' | |
412 | 503 | config.SimulMode = true |
413 | 504 | config.LifeMul = 100 |
414 | - config.Team1VS2Life = 120 | |
415 | - config.TurnsRecoveryRate = 300 | |
505 | + config.Team1VS2Life = 100 | |
506 | + config.TurnsRecoveryBase = 12.5 | |
507 | + config.TurnsRecoveryBonus = 27.5 | |
416 | 508 | config.ZoomActive = false |
417 | 509 | config.ZoomMin = 0.75 |
418 | 510 | config.ZoomMax = 1.1 |
419 | 511 | config.ZoomSpeed = 1.0 |
420 | - config.AIRandomColor = true | |
421 | 512 | config.RoundTime = 99 |
513 | + config.RoundsNumSingle = -1 | |
514 | + config.RoundsNumTeam = -1 | |
515 | + config.MaxDrawGames = -2 | |
422 | 516 | config.SingleTeamMode = true |
423 | 517 | config.NumTurns = 4 |
424 | 518 | config.NumSimul = 4 |
@@ -427,88 +521,142 @@ function options.f_mainCfg() | ||
427 | 521 | config.Credits = 10 |
428 | 522 | setListenPort(7500) |
429 | 523 | config.ContSelection = true |
524 | + config.AIRandomColor = true | |
430 | 525 | config.AIRamping = true |
431 | 526 | config.AutoGuard = false |
432 | 527 | config.TeamPowerShare = false |
433 | 528 | config.TeamLifeShare = false |
434 | 529 | config.Fullscreen = false |
435 | - --lifebar | |
436 | - roundsNum = 2 | |
530 | + config.AudioDucking = false | |
531 | + config.QuickLaunch = 0 | |
532 | + config.AllowDebugKeys = true | |
533 | + config.ComboExtraFrameWindow = 1 | |
534 | + config.PostProcessingShader = 0 | |
535 | + config.LocalcoordScalingType = 1 | |
536 | + config.MSAA = false | |
537 | + loadLifebar(motif.files.fight) | |
538 | + options.roundsNumSingle = getMatchWins() | |
539 | + options.roundsNumTeam = getMatchWins() | |
540 | + options.maxDrawGames = getMatchMaxDrawGames() | |
541 | + options.f_resetTables() | |
437 | 542 | modified = 1 |
438 | 543 | needReload = 1 |
439 | - -- Save | |
544 | + --Save | |
440 | 545 | elseif t[item].itemname == 'save' then |
441 | 546 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
442 | 547 | if modified == 1 then |
443 | 548 | options.f_saveCfg() |
444 | 549 | end |
445 | - main.f_resetBG(motif.title_info, motif.titlebgdef) | |
550 | + main.f_menuFade('option_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
551 | + if motif.music.option_bgm == '' then | |
552 | + main.f_menuReset(motif.titlebgdef.bg) | |
553 | + else | |
554 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
555 | + end | |
446 | 556 | break |
447 | - -- Back | |
557 | + --Back | |
448 | 558 | elseif t[item].itemname == 'back' then |
449 | 559 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
450 | - main.f_resetBG(motif.title_info, motif.titlebgdef) | |
560 | + main.f_menuFade('option_info', 'fadeout', cursorPosY, moveTxt, item, t) | |
561 | + if motif.music.option_bgm == '' then | |
562 | + main.f_menuReset(motif.titlebgdef.bg) | |
563 | + else | |
564 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
565 | + end | |
451 | 566 | break |
452 | 567 | end |
453 | 568 | end |
454 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
569 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
455 | 570 | end |
456 | 571 | end |
457 | 572 | |
458 | 573 | --;=========================================================== |
459 | 574 | --; ARCADE SETTINGS |
460 | 575 | --;=========================================================== |
461 | -local t_arcadeCfg = { | |
462 | - {data = textImgNew(), itemname = 'roundstowin', displayname = motif.option_info.menu_itemname_arcade_roundstowin, vardata = textImgNew(), vardisplay = roundsNum}, | |
463 | - {data = textImgNew(), itemname = 'roundtime', displayname = motif.option_info.menu_itemname_arcade_roundtime, vardata = textImgNew(), vardisplay = config.RoundTime}, | |
576 | +options.t_arcadeCfg = { | |
577 | + {data = textImgNew(), itemname = 'roundtime', displayname = motif.option_info.menu_itemname_arcade_roundtime, vardata = textImgNew(), vardisplay = options.f_definedDisplay(config.RoundTime, {[-1] = motif.option_info.menu_itemname_arcade_roundtime_none}, config.RoundTime)}, | |
578 | + {data = textImgNew(), itemname = 'roundsnumsingle', displayname = motif.option_info.menu_itemname_arcade_roundsnumsingle, vardata = textImgNew(), vardisplay = options.roundsNumSingle}, | |
579 | + {data = textImgNew(), itemname = 'roundsnumteam', displayname = motif.option_info.menu_itemname_arcade_roundsnumteam, vardata = textImgNew(), vardisplay = options.roundsNumTeam}, | |
580 | + {data = textImgNew(), itemname = 'maxdrawgames', displayname = motif.option_info.menu_itemname_arcade_maxdrawgames, vardata = textImgNew(), vardisplay = options.maxDrawGames}, | |
464 | 581 | {data = textImgNew(), itemname = 'difficulty', displayname = motif.option_info.menu_itemname_arcade_difficulty, vardata = textImgNew(), vardisplay = config.Difficulty}, |
465 | 582 | {data = textImgNew(), itemname = 'credits', displayname = motif.option_info.menu_itemname_arcade_credits, vardata = textImgNew(), vardisplay = config.Credits}, |
466 | 583 | {data = textImgNew(), itemname = 'charchange', displayname = motif.option_info.menu_itemname_arcade_charchange, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.ContSelection)}, |
467 | 584 | {data = textImgNew(), itemname = 'airamping', displayname = motif.option_info.menu_itemname_arcade_airamping, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.AIRamping)}, |
585 | + {data = textImgNew(), itemname = 'airandomcolor', displayname = motif.option_info.menu_itemname_arcade_aipalette, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.AIRandomColor, motif.option_info.menu_itemname_arcade_aipalette_random, motif.option_info.menu_itemname_arcade_aipalette_default)}, | |
468 | 586 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
469 | 587 | {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_arcade_back}, |
470 | 588 | } |
471 | -t_arcadeCfg = main.f_cleanTable(t_arcadeCfg) | |
589 | +options.t_arcadeCfg = main.f_cleanTable(options.t_arcadeCfg, main.t_sort.option_info) | |
472 | 590 | |
473 | 591 | function options.f_arcadeCfg() |
474 | 592 | main.f_cmdInput() |
475 | 593 | local cursorPosY = 1 |
476 | 594 | local moveTxt = 0 |
477 | 595 | local item = 1 |
478 | - local t = t_arcadeCfg | |
596 | + local t = options.t_arcadeCfg | |
479 | 597 | textImgSetText(txt_title, motif.option_info.title_text_arcade) |
480 | 598 | while true do |
481 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
599 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
482 | 600 | if esc() then |
483 | 601 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
484 | 602 | textImgSetText(txt_title, motif.option_info.title_text_main) |
485 | 603 | break |
486 | - --Rounds to Win | |
487 | - elseif t[item].itemname == 'roundstowin' then | |
488 | - if commandGetState(main.p1Cmd, 'r') and roundsNum < 10 then | |
489 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
490 | - roundsNum = roundsNum + 1 | |
491 | - t[item].vardisplay = roundsNum | |
492 | - modifiedlifebar = 1 | |
493 | - modified = 1 | |
494 | - elseif commandGetState(main.p1Cmd, 'l') and roundsNum > 1 then | |
495 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
496 | - roundsNum = roundsNum - 1 | |
497 | - t[item].vardisplay = roundsNum | |
498 | - modifiedlifebar = 1 | |
499 | - modified = 1 | |
500 | - end | |
501 | - --Round Time | |
604 | + --Time Limit | |
502 | 605 | elseif t[item].itemname == 'roundtime' then |
503 | 606 | if commandGetState(main.p1Cmd, 'r') and config.RoundTime < 1000 then |
504 | 607 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
505 | 608 | config.RoundTime = config.RoundTime + 1 |
506 | 609 | t[item].vardisplay = config.RoundTime |
507 | 610 | modified = 1 |
508 | - elseif commandGetState(main.p1Cmd, 'l') and config.RoundTime > -2 then | |
611 | + elseif commandGetState(main.p1Cmd, 'l') and config.RoundTime > -1 then | |
509 | 612 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
510 | 613 | config.RoundTime = config.RoundTime - 1 |
511 | - t[item].vardisplay = config.RoundTime | |
614 | + t[item].vardisplay = options.f_definedDisplay(config.RoundTime, {[-1] = motif.option_info.menu_itemname_arcade_roundtime_none}, config.RoundTime) | |
615 | + modified = 1 | |
616 | + end | |
617 | + --Rounds to Win Single | |
618 | + elseif t[item].itemname == 'roundsnumsingle' then | |
619 | + if commandGetState(main.p1Cmd, 'r') and options.roundsNumSingle < 10 then | |
620 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
621 | + options.roundsNumSingle = options.roundsNumSingle + 1 | |
622 | + t[item].vardisplay = options.roundsNumSingle | |
623 | + config.RoundsNumSingle = options.roundsNumSingle | |
624 | + modified = 1 | |
625 | + elseif commandGetState(main.p1Cmd, 'l') and options.roundsNumSingle > 1 then | |
626 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
627 | + options.roundsNumSingle = options.roundsNumSingle - 1 | |
628 | + t[item].vardisplay = options.roundsNumSingle | |
629 | + config.RoundsNumSingle = options.roundsNumSingle | |
630 | + modified = 1 | |
631 | + end | |
632 | + --Rounds to Win Simul/Tag | |
633 | + elseif t[item].itemname == 'roundsnumteam' then | |
634 | + if commandGetState(main.p1Cmd, 'r') and options.roundsNumTeam < 10 then | |
635 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
636 | + options.roundsNumTeam = options.roundsNumTeam + 1 | |
637 | + t[item].vardisplay = options.roundsNumTeam | |
638 | + config.RoundsNumTeam = options.roundsNumTeam | |
639 | + modified = 1 | |
640 | + elseif commandGetState(main.p1Cmd, 'l') and options.roundsNumTeam > 1 then | |
641 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
642 | + options.roundsNumTeam = options.roundsNumTeam - 1 | |
643 | + t[item].vardisplay = options.roundsNumTeam | |
644 | + config.RoundsNumTeam = options.roundsNumTeam | |
645 | + modified = 1 | |
646 | + end | |
647 | + --Max Draw Games | |
648 | + elseif t[item].itemname == 'maxdrawgames' then | |
649 | + if commandGetState(main.p1Cmd, 'r') and options.maxDrawGames < 10 then | |
650 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
651 | + options.maxDrawGames = options.maxDrawGames + 1 | |
652 | + t[item].vardisplay = options.maxDrawGames | |
653 | + config.MaxDrawGames = options.maxDrawGames | |
654 | + modified = 1 | |
655 | + elseif commandGetState(main.p1Cmd, 'l') and options.maxDrawGames > -1 then | |
656 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
657 | + options.maxDrawGames = options.maxDrawGames - 1 | |
658 | + t[item].vardisplay = options.maxDrawGames | |
659 | + config.MaxDrawGames = options.maxDrawGames | |
512 | 660 | modified = 1 |
513 | 661 | end |
514 | 662 | --Difficulty level |
@@ -547,7 +695,7 @@ function options.f_arcadeCfg() | ||
547 | 695 | end |
548 | 696 | t[item].vardisplay = options.f_boolDisplay(config.ContSelection) |
549 | 697 | modified = 1 |
550 | - --AI ramping | |
698 | + --AI Ramping | |
551 | 699 | elseif t[item].itemname == 'airamping' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then |
552 | 700 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
553 | 701 | if config.AIRamping then |
@@ -557,260 +705,373 @@ function options.f_arcadeCfg() | ||
557 | 705 | end |
558 | 706 | t[item].vardisplay = options.f_boolDisplay(config.AIRamping) |
559 | 707 | modified = 1 |
708 | + --AI Palette | |
709 | + elseif t[item].itemname == 'airandomcolor' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
710 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
711 | + if config.AIRandomColor then | |
712 | + config.AIRandomColor = false | |
713 | + else | |
714 | + config.AIRandomColor = true | |
715 | + end | |
716 | + t[item].vardisplay = options.f_boolDisplay(config.AIRandomColor, motif.option_info.menu_itemname_arcade_aipalette_random, motif.option_info.menu_itemname_arcade_aipalette_default) | |
717 | + modified = 1 | |
560 | 718 | --Back |
561 | 719 | elseif t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0 then |
562 | 720 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
563 | 721 | textImgSetText(txt_title, motif.option_info.title_text_main) |
564 | 722 | break |
565 | 723 | end |
566 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
724 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
567 | 725 | end |
568 | 726 | end |
569 | 727 | |
570 | 728 | --;=========================================================== |
571 | ---; GAMEPLAY SETTINGS | |
729 | +--; VIDEO SETTINGS | |
572 | 730 | --;=========================================================== |
573 | -local t_gameplayCfg = { | |
574 | - {data = textImgNew(), itemname = 'lifemul', displayname = motif.option_info.menu_itemname_gameplay_lifemul, vardata = textImgNew(), vardisplay = config.LifeMul .. '%'}, | |
575 | - {data = textImgNew(), itemname = 'autoguard', displayname = motif.option_info.menu_itemname_gameplay_autoguard, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.AutoGuard)}, | |
576 | - {data = textImgNew(), itemname = 'team1vs2life', displayname = motif.option_info.menu_itemname_gameplay_team1vs2life, vardata = textImgNew(), vardisplay = config.Team1VS2Life}, | |
577 | - {data = textImgNew(), itemname = 'turnsrecoveryrate', displayname = motif.option_info.menu_itemname_gameplay_turnsrecoveryrate, vardata = textImgNew(), vardisplay = config.TurnsRecoveryRate}, | |
578 | - {data = textImgNew(), itemname = 'teampowershare', displayname = motif.option_info.menu_itemname_gameplay_teampowershare, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.TeamPowerShare)}, | |
579 | - {data = textImgNew(), itemname = 'teamlifeshare', displayname = motif.option_info.menu_itemname_gameplay_teamlifeshare, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.TeamLifeShare)}, | |
731 | +options.t_shaderNames = { | |
732 | + [0] = motif.option_info.menu_itemname_video_shader_none, | |
733 | + [1] = motif.option_info.menu_itemname_video_shader_hqx2, | |
734 | + [2] = motif.option_info.menu_itemname_video_shader_hqx4, | |
735 | + [3] = motif.option_info.menu_itemname_video_shader_scanlines, | |
736 | +} | |
737 | + | |
738 | +options.t_videoCfg = { | |
739 | + {data = textImgNew(), itemname = 'resolution', displayname = motif.option_info.menu_itemname_video_resolution, vardata = textImgNew(), vardisplay = config.Width .. 'x' .. config.Height}, | |
740 | + {data = textImgNew(), itemname = 'fullscreen', displayname = motif.option_info.menu_itemname_video_fullscreen, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.Fullscreen)}, | |
741 | + {data = textImgNew(), itemname = 'msaa', displayname = motif.option_info.menu_itemname_video_msaa, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.MSAA, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled)}, | |
742 | + {data = textImgNew(), itemname = 'postprocessingshader', displayname = motif.option_info.menu_itemname_video_shader, vardata = textImgNew(), vardisplay = options.t_shaderNames[config.PostProcessingShader]}, | |
580 | 743 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
581 | - {data = textImgNew(), itemname = 'advancedGameplaySettings', displayname = motif.option_info.menu_itemname_gameplay_advanced}, | |
582 | - {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_gameplay_back}, | |
744 | + {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_video_back}, | |
583 | 745 | } |
584 | -t_gameplayCfg = main.f_cleanTable(t_gameplayCfg) | |
746 | +options.t_videoCfg = main.f_cleanTable(options.t_videoCfg, main.t_sort.option_info) | |
585 | 747 | |
586 | -function options.f_gameplayCfg() | |
748 | +function options.f_videoCfg() | |
587 | 749 | main.f_cmdInput() |
588 | 750 | local cursorPosY = 1 |
589 | 751 | local moveTxt = 0 |
590 | 752 | local item = 1 |
591 | - local t = t_gameplayCfg | |
592 | - textImgSetText(txt_title, motif.option_info.title_text_gameplay) | |
753 | + local t = options.t_videoCfg | |
754 | + textImgSetText(txt_title, motif.option_info.title_text_video) | |
593 | 755 | while true do |
594 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
756 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
595 | 757 | if esc() then |
596 | 758 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
597 | 759 | textImgSetText(txt_title, motif.option_info.title_text_main) |
598 | 760 | break |
599 | - --Life | |
600 | - elseif t[item].itemname == 'lifemul' then | |
601 | - if commandGetState(main.p1Cmd, 'r') and config.LifeMul < 300 then | |
602 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
603 | - config.LifeMul = config.LifeMul + 10 | |
604 | - t[item].vardisplay = config.LifeMul .. '%' | |
605 | - modified = 1 | |
606 | - elseif commandGetState(main.p1Cmd, 'l') and config.LifeMul > 10 then | |
607 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
608 | - config.LifeMul = config.LifeMul - 10 | |
609 | - t[item].vardisplay = config.LifeMul .. '%' | |
610 | - modified = 1 | |
611 | - end | |
612 | - --Auto-Guard | |
613 | - elseif t[item].itemname == 'autoguard' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
761 | + --Resolution | |
762 | + elseif t[item].itemname == 'resolution' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
614 | 763 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
615 | - if config.AutoGuard then | |
616 | - config.AutoGuard = false | |
764 | + options.f_resCfg() | |
765 | + t[item].vardisplay = config.Width .. 'x' .. config.Height | |
766 | + --Fullscreen | |
767 | + elseif t[item].itemname == 'fullscreen' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
768 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
769 | + if config.Fullscreen then | |
770 | + config.Fullscreen = false | |
617 | 771 | else |
618 | - config.AutoGuard = true | |
772 | + config.Fullscreen = true | |
619 | 773 | end |
620 | - t[item].vardisplay = options.f_boolDisplay(config.AutoGuard) | |
774 | + t[item].vardisplay = options.f_boolDisplay(config.Fullscreen) | |
621 | 775 | modified = 1 |
622 | - --1P Vs Team Life | |
623 | - elseif t[item].itemname == 'team1vs2life' then | |
624 | - if commandGetState(main.p1Cmd, 'r') and config.Team1VS2Life < 3000 then | |
625 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
626 | - config.Team1VS2Life = config.Team1VS2Life + 10 | |
627 | - t[item].vardisplay = config.Team1VS2Life | |
628 | - modified = 1 | |
629 | - elseif commandGetState(main.p1Cmd, 'l') and config.Team1VS2Life > 10 then | |
630 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
631 | - config.Team1VS2Life = config.Team1VS2Life - 10 | |
632 | - t[item].vardisplay = config.Team1VS2Life | |
633 | - modified = 1 | |
776 | + needReload = 1 | |
777 | + --MSAA | |
778 | + elseif t[item].itemname == 'msaa' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
779 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
780 | + if config.MSAA then | |
781 | + config.MSAA = false | |
782 | + else | |
783 | + config.MSAA = true | |
634 | 784 | end |
635 | - --Turns HP Recovery | |
636 | - elseif t[item].itemname == 'turnsrecoveryrate' then | |
637 | - if commandGetState(main.p1Cmd, 'r') and config.TurnsRecoveryRate < 3000 then | |
785 | + t[item].vardisplay = options.f_boolDisplay(config.MSAA, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled) | |
786 | + modified = 1 | |
787 | + needReload = 1 | |
788 | + --Shader | |
789 | + elseif t[item].itemname == 'postprocessingshader' then | |
790 | + if commandGetState(main.p1Cmd, 'r') and config.PostProcessingShader < #options.t_shaderNames then | |
638 | 791 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
639 | - config.TurnsRecoveryRate = config.TurnsRecoveryRate + 10 | |
640 | - t[item].vardisplay = config.TurnsRecoveryRate | |
792 | + config.PostProcessingShader = config.PostProcessingShader + 1 | |
641 | 793 | modified = 1 |
642 | - elseif commandGetState(main.p1Cmd, 'l') and config.TurnsRecoveryRate > 10 then | |
794 | + needReload = 1 | |
795 | + elseif commandGetState(main.p1Cmd, 'l') and config.PostProcessingShader > 0 then | |
643 | 796 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
644 | - config.TurnsRecoveryRate = config.TurnsRecoveryRate - 10 | |
645 | - t[item].vardisplay = config.TurnsRecoveryRate | |
797 | + config.PostProcessingShader = config.PostProcessingShader - 1 | |
646 | 798 | modified = 1 |
799 | + needReload = 1 | |
647 | 800 | end |
648 | - --Team Power Share | |
649 | - elseif t[item].itemname == 'teampowershare' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
650 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
651 | - if config.TeamPowerShare then | |
652 | - config.TeamPowerShare = false | |
653 | - else | |
654 | - config.TeamPowerShare = true | |
655 | - end | |
656 | - t[item].vardisplay = options.f_boolDisplay(config.TeamPowerShare) | |
657 | - modified = 1 | |
658 | - --Team Life Share | |
659 | - elseif t[item].itemname == 'teamlifeshare' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
660 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
661 | - if config.TeamLifeShare then | |
662 | - config.TeamLifeShare = false | |
663 | - else | |
664 | - config.TeamLifeShare = true | |
665 | - end | |
666 | - t[item].vardisplay = options.f_boolDisplay(config.TeamLifeShare) | |
667 | - modified = 1 | |
668 | - -- Advanced settings | |
669 | - elseif t[item].itemname == 'advancedGameplaySettings' and main.f_btnPalNo(main.p1Cmd) > 0 then | |
670 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
671 | - options.f_advGameplayCfg() | |
801 | + t[item].vardisplay = options.t_shaderNames[config.PostProcessingShader] | |
672 | 802 | --Back |
673 | 803 | elseif t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0 then |
674 | 804 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
675 | 805 | textImgSetText(txt_title, motif.option_info.title_text_main) |
676 | 806 | break |
677 | 807 | end |
678 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
808 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
679 | 809 | end |
680 | 810 | end |
681 | 811 | |
682 | - | |
683 | 812 | --;=========================================================== |
684 | ---; ADVANCED GAMEPLAY SETTINGS | |
813 | +--; RESOLUTION SETTINGS | |
685 | 814 | --;=========================================================== |
686 | -function options.f_checkTeamAmount(arg1, arg2, arg3) | |
687 | - ret = arg1 | |
688 | - if arg1 <= arg2 then | |
689 | - ret = arg3 | |
690 | - end | |
691 | - | |
692 | - return ret | |
693 | -end | |
694 | - | |
695 | -local t_advGameplayCfg = { | |
696 | - {data = textImgNew(), itemname = 'attackpowermul', displayname = motif.option_info.menu_itemname_gameplay_attackpowermul, vardata = textImgNew(), vardisplay = config['Attack.LifeToPowerMul']}, | |
697 | - {data = textImgNew(), itemname = 'gethitpowermul', displayname = motif.option_info.menu_itemname_gameplay_gethitpowermul, vardata = textImgNew(), vardisplay = config['GetHit.LifeToPowerMul']}, | |
698 | - {data = textImgNew(), itemname = 'superdefencemul', displayname = motif.option_info.menu_itemname_gameplay_superdefencemul, vardata = textImgNew(), vardisplay = config['Super.TargetDefenceMul']}, | |
699 | - {data = textImgNew(), itemname = 'empty', displayname = ' '}, | |
700 | - {data = textImgNew(), itemname = 'singlemode', displayname = motif.option_info.menu_itemname_gameplay_singlemode, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.SingleTeamMode, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled)}, | |
701 | - {data = textImgNew(), itemname = 'numturns', displayname = motif.option_info.menu_itemname_gameplay_numturns, vardata = textImgNew(), vardisplay = options.f_checkTeamAmount(config.NumTurns, 1, motif.option_info.menu_itemname_disabled)}, | |
702 | - {data = textImgNew(), itemname = 'numsimul', displayname = motif.option_info.menu_itemname_gameplay_numsimul, vardata = textImgNew(), vardisplay = options.f_checkTeamAmount(config.NumSimul, 1, motif.option_info.menu_itemname_disabled)}, | |
703 | - {data = textImgNew(), itemname = 'numtag', displayname = motif.option_info.menu_itemname_gameplay_numtag, vardata = textImgNew(), vardisplay = options.f_checkTeamAmount(config.NumTag, 1, motif.option_info.menu_itemname_disabled)}, | |
815 | +local t_resCfg = { | |
816 | + {data = textImgNew(), x = 320, y = 240, displayname = motif.option_info.menu_itemname_res_320x240}, | |
817 | + {data = textImgNew(), x = 640, y = 480, displayname = motif.option_info.menu_itemname_res_640x480}, | |
818 | + {data = textImgNew(), x = 1280, y = 960, displayname = motif.option_info.menu_itemname_res_1280x960}, | |
819 | + {data = textImgNew(), x = 1600, y = 1200, displayname = motif.option_info.menu_itemname_res_1600x1200}, | |
820 | + {data = textImgNew(), x = 960, y = 720, displayname = motif.option_info.menu_itemname_res_960x720}, | |
821 | + {data = textImgNew(), x = 1280, y = 720, displayname = motif.option_info.menu_itemname_res_1280x720}, | |
822 | + {data = textImgNew(), x = 1600, y = 900, displayname = motif.option_info.menu_itemname_res_1600x900}, | |
823 | + {data = textImgNew(), x = 1920, y = 1080, displayname = motif.option_info.menu_itemname_res_1920x1080}, | |
824 | + {data = textImgNew(), x = 2560, y = 1440, displayname = motif.option_info.menu_itemname_res_2560x1440}, | |
825 | + {data = textImgNew(), x = 3840, y = 2160, displayname = motif.option_info.menu_itemname_res_3840x2160}, | |
704 | 826 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
705 | - {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_gameplay_back}, | |
827 | + {data = textImgNew(), itemname = 'custom', displayname = motif.option_info.menu_itemname_res_custom}, | |
828 | + {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_res_back}, | |
706 | 829 | } |
707 | -t_advGameplayCfg = main.f_cleanTable(t_advGameplayCfg) | |
830 | +t_resCfg = main.f_cleanTable(t_resCfg, main.t_sort.option_info) | |
708 | 831 | |
709 | -function options.f_advGameplayCfg() | |
832 | +function options.f_resCfg() | |
710 | 833 | main.f_cmdInput() |
711 | 834 | local cursorPosY = 1 |
712 | 835 | local moveTxt = 0 |
713 | 836 | local item = 1 |
714 | - local t = t_advGameplayCfg | |
715 | - textImgSetText(txt_title, motif.option_info.title_text_advgameplay) | |
837 | + local t = t_resCfg | |
838 | + textImgSetText(txt_title, motif.option_info.title_text_res) | |
716 | 839 | while true do |
717 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
840 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
718 | 841 | if esc() then |
719 | 842 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
720 | - textImgSetText(txt_title, motif.option_info.title_text_gameplay) | |
843 | + textImgSetText(txt_title, motif.option_info.title_text_video) | |
721 | 844 | break |
722 | - --Life | |
723 | - elseif t[item].itemname == 'lifemul' then | |
724 | - if commandGetState(main.p1Cmd, 'r') and config.LifeMul < 300 then | |
725 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
726 | - config.LifeMul = config.LifeMul + 10 | |
727 | - t[item].vardisplay = config.LifeMul .. '%' | |
728 | - modified = 1 | |
729 | - elseif commandGetState(main.p1Cmd, 'l') and config.LifeMul > 10 then | |
845 | + elseif main.f_btnPalNo(main.p1Cmd) > 0 then | |
846 | + --Back | |
847 | + if t[item].itemname == 'back' then | |
848 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
849 | + textImgSetText(txt_title, motif.option_info.title_text_video) | |
850 | + break | |
851 | + --Custom | |
852 | + elseif t[item].itemname == 'custom' then | |
730 | 853 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
731 | - config.LifeMul = config.LifeMul - 10 | |
732 | - t[item].vardisplay = config.LifeMul .. '%' | |
733 | - modified = 1 | |
734 | - end | |
735 | - --Auto-Guard | |
736 | - elseif t[item].itemname == 'autoguard' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
737 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
738 | - if config.AutoGuard then | |
739 | - config.AutoGuard = false | |
854 | + local width = tonumber(main.f_input(main.f_extractText(motif.option_info.input_text_reswidth), motif.option_info, motif.optionbgdef, 'string')) | |
855 | + if width ~= nil then | |
856 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
857 | + local height = tonumber(main.f_input(main.f_extractText(motif.option_info.input_text_resheight), motif.option_info, motif.optionbgdef, 'string')) | |
858 | + if height ~= nil then | |
859 | + config.Width = width | |
860 | + config.Height = height | |
861 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
862 | + if (height / 3 * 4) ~= width then | |
863 | + main.f_warning(main.f_extractText(motif.warning_info.text_res), motif.option_info, motif.optionbgdef) | |
864 | + end | |
865 | + modified = 1 | |
866 | + needReload = 1 | |
867 | + else | |
868 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
869 | + end | |
870 | + else | |
871 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
872 | + end | |
873 | + textImgSetText(txt_title, motif.option_info.title_text_video) | |
874 | + break | |
875 | + --Resolution | |
740 | 876 | else |
741 | - config.AutoGuard = true | |
877 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
878 | + config.Width = t[item].x | |
879 | + config.Height = t[item].y | |
880 | + if (config.Height / 3 * 4) ~= config.Width then | |
881 | + main.f_warning(main.f_extractText(motif.warning_info.text_res), motif.option_info, motif.optionbgdef) | |
882 | + end | |
883 | + modified = 1 | |
884 | + needReload = 1 | |
885 | + textImgSetText(txt_title, motif.option_info.title_text_video) | |
886 | + break | |
742 | 887 | end |
743 | - t[item].vardisplay = options.f_boolDisplay(config.AutoGuard) | |
744 | - modified = 1 | |
745 | - --Attack.LifeToPowerMul | |
746 | - elseif t[item].itemname == 'attackpowermul' then | |
747 | - if commandGetState(main.p1Cmd, 'r') then | |
888 | + end | |
889 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
890 | + end | |
891 | +end | |
892 | + | |
893 | +--;=========================================================== | |
894 | +--; AUDIO SETTINGS | |
895 | +--;=========================================================== | |
896 | +options.t_audioCfg = { | |
897 | + {data = textImgNew(), itemname = 'mastervolume', displayname = motif.option_info.menu_itemname_audio_mastervolume, vardata = textImgNew(), vardisplay = config.MasterVolume .. '%'}, | |
898 | + {data = textImgNew(), itemname = 'bgmvolume', displayname = motif.option_info.menu_itemname_audio_bgmvolume, vardata = textImgNew(), vardisplay = config.BgmVolume .. '%'}, | |
899 | + {data = textImgNew(), itemname = 'sfxvolume', displayname = motif.option_info.menu_itemname_audio_sfxvolume, vardata = textImgNew(), vardisplay = config.WavVolume .. '%'}, | |
900 | + {data = textImgNew(), itemname = 'audioducking', displayname = motif.option_info.menu_itemname_audio_audioducking, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.AudioDucking, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled)}, | |
901 | + {data = textImgNew(), itemname = 'empty', displayname = ' '}, | |
902 | + {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_audio_back}, | |
903 | +} | |
904 | +options.t_audioCfg = main.f_cleanTable(options.t_audioCfg, main.t_sort.option_info) | |
905 | + | |
906 | +function options.f_audioCfg() | |
907 | + main.f_cmdInput() | |
908 | + local cursorPosY = 1 | |
909 | + local moveTxt = 0 | |
910 | + local item = 1 | |
911 | + local t = options.t_audioCfg | |
912 | + textImgSetText(txt_title, motif.option_info.title_text_audio) | |
913 | + while true do | |
914 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
915 | + if esc() then | |
916 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
917 | + textImgSetText(txt_title, motif.option_info.title_text_main) | |
918 | + break | |
919 | + --Master Volume | |
920 | + elseif t[item].itemname == 'mastervolume' then | |
921 | + if commandGetState(main.p1Cmd, 'r') and config.MasterVolume < 200 then | |
748 | 922 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
749 | - config['Attack.LifeToPowerMul'] = options.f_precision(config['Attack.LifeToPowerMul'] + 0.1, '%.01f') | |
750 | - t[item].vardisplay = config['Attack.LifeToPowerMul'] | |
923 | + config.MasterVolume = config.MasterVolume + 1 | |
924 | + t[item].vardisplay = config.MasterVolume | |
925 | + setMasterVolume(config.MasterVolume) | |
751 | 926 | modified = 1 |
752 | - needReload = 1 | |
753 | - elseif commandGetState(main.p1Cmd, 'l') and config['Attack.LifeToPowerMul'] > 0.1 then | |
927 | + elseif commandGetState(main.p1Cmd, 'l') and config.MasterVolume > 0 then | |
754 | 928 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
755 | - config['Attack.LifeToPowerMul'] = options.f_precision(config['Attack.LifeToPowerMul'] - 0.1, '%.01f') | |
756 | - t[item].vardisplay = config['Attack.LifeToPowerMul'] | |
929 | + config.MasterVolume = config.MasterVolume - 1 | |
930 | + t[item].vardisplay = config.MasterVolume | |
931 | + setMasterVolume(config.MasterVolume) | |
757 | 932 | modified = 1 |
758 | - needReload = 1 | |
759 | 933 | end |
760 | - --GetHit.LifeToPowerMul | |
761 | - elseif t[item].itemname == 'gethitpowermul' then | |
762 | - if commandGetState(main.p1Cmd, 'r') then | |
934 | + --BGM Volume | |
935 | + elseif t[item].itemname == 'bgmvolume' then | |
936 | + if commandGetState(main.p1Cmd, 'r') and config.BgmVolume < 100 then | |
763 | 937 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
764 | - config['GetHit.LifeToPowerMul'] = options.f_precision(config['GetHit.LifeToPowerMul'] + 0.1, '%.01f') | |
765 | - t[item].vardisplay = config['GetHit.LifeToPowerMul'] | |
938 | + config.BgmVolume = config.BgmVolume + 1 | |
939 | + t[item].vardisplay = config.BgmVolume | |
940 | + setBgmVolume(config.BgmVolume) | |
766 | 941 | modified = 1 |
767 | - needReload = 1 | |
768 | - elseif commandGetState(main.p1Cmd, 'l') and config['GetHit.LifeToPowerMul'] > 0.1 then | |
942 | + elseif commandGetState(main.p1Cmd, 'l') and config.BgmVolume > 0 then | |
769 | 943 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
770 | - config['GetHit.LifeToPowerMul'] = options.f_precision(config['GetHit.LifeToPowerMul'] - 0.1, '%.01f') | |
771 | - t[item].vardisplay = config['GetHit.LifeToPowerMul'] | |
944 | + config.BgmVolume = config.BgmVolume - 1 | |
945 | + t[item].vardisplay = config.BgmVolume | |
946 | + setBgmVolume(config.BgmVolume) | |
772 | 947 | modified = 1 |
773 | - needReload = 1 | |
774 | 948 | end |
775 | - --Super.TargetDefenceMul | |
776 | - elseif t[item].itemname == 'superdefencemul' then | |
777 | - if commandGetState(main.p1Cmd, 'r') then | |
949 | + --SFX Volume | |
950 | + elseif t[item].itemname == 'wavvolume' then | |
951 | + if commandGetState(main.p1Cmd, 'r') and config.WavVolume < 100 then | |
778 | 952 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
779 | - config['Super.TargetDefenceMul'] = options.f_precision(config['Super.TargetDefenceMul'] + 0.1, '%.01f') | |
780 | - t[item].vardisplay = config['Super.TargetDefenceMul'] | |
953 | + config.WavVolume = config.WavVolume + 1 | |
954 | + t[item].vardisplay = config.WavVolume | |
955 | + setWavVolume(config.WavVolume) | |
781 | 956 | modified = 1 |
782 | - needReload = 1 | |
783 | - elseif commandGetState(main.p1Cmd, 'l') and config['Super.TargetDefenceMul'] > 0.1 then | |
957 | + elseif commandGetState(main.p1Cmd, 'l') and config.WavVolume > 0 then | |
784 | 958 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
785 | - config['Super.TargetDefenceMul'] = options.f_precision(config['Super.TargetDefenceMul'] - 0.1, '%.01f') | |
786 | - t[item].vardisplay = config['Super.TargetDefenceMul'] | |
959 | + config.WavVolume = config.WavVolume - 1 | |
960 | + t[item].vardisplay = config.WavVolume | |
961 | + setWavVolume(config.WavVolume) | |
962 | + modified = 1 | |
963 | + end | |
964 | + --Audio Ducking | |
965 | + elseif t[item].itemname == 'audioducking' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
966 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
967 | + if config.AudioDucking then | |
968 | + config.AudioDucking = false | |
969 | + else | |
970 | + config.AudioDucking = true | |
971 | + end | |
972 | + t[item].vardisplay = options.f_boolDisplay(config.AudioDucking, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled) | |
973 | + setAudioDucking(config.AudioDucking) | |
974 | + modified = 1 | |
975 | + --Back | |
976 | + elseif t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0 then | |
977 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
978 | + textImgSetText(txt_title, motif.option_info.title_text_main) | |
979 | + break | |
980 | + end | |
981 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
982 | + end | |
983 | +end | |
984 | + | |
985 | +--;=========================================================== | |
986 | +--; GAMEPLAY SETTINGS | |
987 | +--;=========================================================== | |
988 | +options.t_gameplayCfg = { | |
989 | + {data = textImgNew(), itemname = 'lifemul', displayname = motif.option_info.menu_itemname_gameplay_lifemul, vardata = textImgNew(), vardisplay = config.LifeMul .. '%'}, | |
990 | + {data = textImgNew(), itemname = 'autoguard', displayname = motif.option_info.menu_itemname_gameplay_autoguard, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.AutoGuard)}, | |
991 | + {data = textImgNew(), itemname = 'team1vs2life', displayname = motif.option_info.menu_itemname_gameplay_team1vs2life, vardata = textImgNew(), vardisplay = config.Team1VS2Life .. '%'}, | |
992 | + {data = textImgNew(), itemname = 'turnsrecoverybase', displayname = motif.option_info.menu_itemname_gameplay_turnsrecoverybase, vardata = textImgNew(), vardisplay = config.TurnsRecoveryBase .. '%'}, | |
993 | + {data = textImgNew(), itemname = 'turnsrecoverybonus', displayname = motif.option_info.menu_itemname_gameplay_turnsrecoverybonus, vardata = textImgNew(), vardisplay = config.TurnsRecoveryBonus .. '%'}, | |
994 | + {data = textImgNew(), itemname = 'teampowershare', displayname = motif.option_info.menu_itemname_gameplay_teampowershare, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.TeamPowerShare)}, | |
995 | + {data = textImgNew(), itemname = 'teamlifeshare', displayname = motif.option_info.menu_itemname_gameplay_teamlifeshare, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.TeamLifeShare)}, | |
996 | + {data = textImgNew(), itemname = 'empty', displayname = ' '}, | |
997 | + {data = textImgNew(), itemname = 'advancedGameplaySettings', displayname = motif.option_info.menu_itemname_gameplay_advanced}, | |
998 | + {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_gameplay_back}, | |
999 | +} | |
1000 | +options.t_gameplayCfg = main.f_cleanTable(options.t_gameplayCfg, main.t_sort.option_info) | |
1001 | + | |
1002 | +function options.f_gameplayCfg() | |
1003 | + main.f_cmdInput() | |
1004 | + local cursorPosY = 1 | |
1005 | + local moveTxt = 0 | |
1006 | + local item = 1 | |
1007 | + local t = options.t_gameplayCfg | |
1008 | + textImgSetText(txt_title, motif.option_info.title_text_gameplay) | |
1009 | + while true do | |
1010 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
1011 | + if esc() then | |
1012 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1013 | + textImgSetText(txt_title, motif.option_info.title_text_main) | |
1014 | + break | |
1015 | + --Life | |
1016 | + elseif t[item].itemname == 'lifemul' then | |
1017 | + if commandGetState(main.p1Cmd, 'r') and config.LifeMul < 300 then | |
1018 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1019 | + config.LifeMul = config.LifeMul + 10 | |
1020 | + t[item].vardisplay = config.LifeMul .. '%' | |
1021 | + modified = 1 | |
1022 | + elseif commandGetState(main.p1Cmd, 'l') and config.LifeMul > 10 then | |
1023 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1024 | + config.LifeMul = config.LifeMul - 10 | |
1025 | + t[item].vardisplay = config.LifeMul .. '%' | |
787 | 1026 | modified = 1 |
788 | - needReload = 1 | |
789 | 1027 | end |
1028 | + --Auto-Guard | |
1029 | + elseif t[item].itemname == 'autoguard' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
1030 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1031 | + if config.AutoGuard then | |
1032 | + config.AutoGuard = false | |
1033 | + else | |
1034 | + config.AutoGuard = true | |
1035 | + end | |
1036 | + t[item].vardisplay = options.f_boolDisplay(config.AutoGuard) | |
1037 | + modified = 1 | |
790 | 1038 | --1P Vs Team Life |
791 | 1039 | elseif t[item].itemname == 'team1vs2life' then |
792 | - if commandGetState(main.p1Cmd, 'r') and config.Team1VS2Life < 3000 then | |
1040 | + if commandGetState(main.p1Cmd, 'r') and config.Team1VS2Life < 300 then | |
793 | 1041 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
794 | 1042 | config.Team1VS2Life = config.Team1VS2Life + 10 |
795 | - t[item].vardisplay = config.Team1VS2Life | |
1043 | + t[item].vardisplay = config.Team1VS2Life .. '%' | |
796 | 1044 | modified = 1 |
797 | 1045 | elseif commandGetState(main.p1Cmd, 'l') and config.Team1VS2Life > 10 then |
798 | 1046 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
799 | 1047 | config.Team1VS2Life = config.Team1VS2Life - 10 |
800 | - t[item].vardisplay = config.Team1VS2Life | |
1048 | + t[item].vardisplay = config.Team1VS2Life .. '%' | |
1049 | + modified = 1 | |
1050 | + end | |
1051 | + --Turns Recovery Base | |
1052 | + elseif t[item].itemname == 'turnsrecoverybase' then | |
1053 | + if commandGetState(main.p1Cmd, 'r') and config.TurnsRecoveryBase < 100 then | |
1054 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1055 | + config.TurnsRecoveryBase = config.TurnsRecoveryBase + 0.5 | |
1056 | + t[item].vardisplay = config.TurnsRecoveryBase .. '%' | |
1057 | + modified = 1 | |
1058 | + elseif commandGetState(main.p1Cmd, 'l') and config.TurnsRecoveryBase > 0 then | |
1059 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1060 | + config.TurnsRecoveryBase = config.TurnsRecoveryBase - 0.5 | |
1061 | + t[item].vardisplay = config.TurnsRecoveryBase .. '%' | |
801 | 1062 | modified = 1 |
802 | 1063 | end |
803 | - --Turns HP Recovery | |
804 | - elseif t[item].itemname == 'turnsrecoveryrate' then | |
805 | - if commandGetState(main.p1Cmd, 'r') and config.TurnsRecoveryRate < 3000 then | |
1064 | + --Turns Recovery Bonus | |
1065 | + elseif t[item].itemname == 'turnsrecoverybonus' then | |
1066 | + if commandGetState(main.p1Cmd, 'r') and config.TurnsRecoveryBonus < 100 then | |
806 | 1067 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
807 | - config.TurnsRecoveryRate = config.TurnsRecoveryRate + 10 | |
808 | - t[item].vardisplay = config.TurnsRecoveryRate | |
1068 | + config.TurnsRecoveryBonus = config.TurnsRecoveryBonus + 0.5 | |
1069 | + t[item].vardisplay = config.TurnsRecoveryBonus .. '%' | |
809 | 1070 | modified = 1 |
810 | - elseif commandGetState(main.p1Cmd, 'l') and config.TurnsRecoveryRate > 10 then | |
1071 | + elseif commandGetState(main.p1Cmd, 'l') and config.TurnsRecoveryBonus > 0 then | |
811 | 1072 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
812 | - config.TurnsRecoveryRate = config.TurnsRecoveryRate - 10 | |
813 | - t[item].vardisplay = config.TurnsRecoveryRate | |
1073 | + config.TurnsRecoveryBonus = config.TurnsRecoveryBonus - 0.5 | |
1074 | + t[item].vardisplay = config.TurnsRecoveryBonus .. '%' | |
814 | 1075 | modified = 1 |
815 | 1076 | end |
816 | 1077 | --Team Power Share |
@@ -833,286 +1094,252 @@ function options.f_advGameplayCfg() | ||
833 | 1094 | end |
834 | 1095 | t[item].vardisplay = options.f_boolDisplay(config.TeamLifeShare) |
835 | 1096 | modified = 1 |
836 | - -- Singke mode | |
837 | - elseif t[item].itemname == 'singlemode' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
838 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
839 | - if config.SingleTeamMode then | |
840 | - config.SingleTeamMode = false | |
841 | - else | |
842 | - config.SingleTeamMode = true | |
843 | - end | |
844 | - t[item].vardisplay = options.f_boolDisplay(config.SingleTeamMode, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled) | |
845 | - modified = 1 | |
846 | - needReload = 1 | |
847 | - --Turns Limit | |
848 | - elseif t[item].itemname == 'numturns' then | |
849 | - if commandGetState(main.p1Cmd, 'r') and config.NumTurns < 8 then | |
850 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
851 | - config.NumTurns = config.NumTurns + 1 | |
852 | - t[item].vardisplay = config.NumTurns | |
853 | - modified = 1 | |
854 | - elseif commandGetState(main.p1Cmd, 'l') and config.NumTurns > 1 then | |
855 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
856 | - config.NumTurns = config.NumTurns - 1 | |
857 | - t[item].vardisplay = options.f_checkTeamAmount(config.NumTurns, 1, motif.option_info.menu_itemname_disabled) | |
858 | - modified = 1 | |
859 | - end | |
860 | - -- Disable check | |
861 | - if config.NumTurns < 2 then | |
862 | - needReload = 1 | |
863 | - end | |
864 | - --Simul Limit | |
865 | - elseif t[item].itemname == 'numsimul' then | |
866 | - if commandGetState(main.p1Cmd, 'r') and config.NumSimul < 8 then | |
867 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
868 | - config.NumSimul = config.NumSimul + 1 | |
869 | - t[item].vardisplay = config.NumSimul | |
870 | - modified = 1 | |
871 | - elseif commandGetState(main.p1Cmd, 'l') and config.NumSimul > 1 then | |
872 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
873 | - config.NumSimul = config.NumSimul - 1 | |
874 | - t[item].vardisplay = options.f_checkTeamAmount(config.NumSimul, 1, motif.option_info.menu_itemname_disabled) | |
875 | - modified = 1 | |
876 | - end | |
877 | - -- Disable check | |
878 | - if config.NumSimul < 2 then | |
879 | - needReload = 1 | |
880 | - end | |
881 | - --Tag Limit | |
882 | - elseif t[item].itemname == 'numtag' then | |
883 | - if commandGetState(main.p1Cmd, 'r') and config.NumTag < 8 then | |
884 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
885 | - config.NumTag = config.NumTag + 1 | |
886 | - t[item].vardisplay = config.NumTag | |
887 | - modified = 1 | |
888 | - elseif commandGetState(main.p1Cmd, 'l') and config.NumTag > 1 then | |
889 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
890 | - config.NumTag = config.NumTag - 1 | |
891 | - t[item].vardisplay = options.f_checkTeamAmount(config.NumTag, 1, motif.option_info.menu_itemname_disabled) | |
892 | - modified = 1 | |
893 | - end | |
894 | - -- Disable check | |
895 | - if config.NumTag < 2 then | |
896 | - needReload = 1 | |
897 | - end | |
1097 | + --Advanced Settings | |
1098 | + elseif t[item].itemname == 'advancedGameplaySettings' and main.f_btnPalNo(main.p1Cmd) > 0 then | |
1099 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
1100 | + options.f_advGameplayCfg() | |
898 | 1101 | --Back |
899 | 1102 | elseif t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0 then |
900 | 1103 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
901 | - textImgSetText(txt_title, motif.option_info.title_text_gameplay) | |
1104 | + textImgSetText(txt_title, motif.option_info.title_text_main) | |
902 | 1105 | break |
903 | 1106 | end |
904 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1107 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
905 | 1108 | end |
906 | 1109 | end |
907 | 1110 | |
908 | 1111 | --;=========================================================== |
909 | ---; VIDEO SETTINGS | |
1112 | +--; ADVANCED GAMEPLAY SETTINGS | |
910 | 1113 | --;=========================================================== |
911 | -local t_shaderNames = {} | |
912 | -t_shaderNames[0] = "No shader" | |
913 | -t_shaderNames[1] = "hqx2" | |
914 | -t_shaderNames[2] = "hqx4" | |
915 | -t_shaderNames[3] = "scanline" | |
1114 | +function options.f_checkTeamAmount(arg1, arg2, arg3) | |
1115 | + ret = arg1 | |
1116 | + if arg1 <= arg2 then | |
1117 | + ret = arg3 | |
1118 | + end | |
1119 | + return ret | |
1120 | +end | |
916 | 1121 | |
917 | -local t_videoCfg = { | |
918 | - {data = textImgNew(), itemname = 'resolution', displayname = motif.option_info.menu_itemname_video_resolution, vardata = textImgNew(), vardisplay = config.Width .. 'x' .. config.Height}, | |
919 | - {data = textImgNew(), itemname = 'fullscreen', displayname = motif.option_info.menu_itemname_video_fullscreen, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.Fullscreen)}, | |
920 | - {data = textImgNew(), itemname = 'msaa', displayname = motif.option_info.menu_itemname_video_msaa, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.MSAA, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled)}, | |
921 | - {data = textImgNew(), itemname = 'airandomcolor', displayname = motif.option_info.menu_itemname_video_aipalette, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.AIRandomColor, motif.option_info.menu_itemname_video_aipalette_random, motif.option_info.menu_itemname_video_aipalette_default)}, | |
922 | - {data = textImgNew(), itemname = 'postprocessingshader', displayname = "Shader", vardata = textImgNew(), vardisplay = t_shaderNames[config.PostProcessingShader]}, | |
1122 | +options.t_advGameplayCfg = { | |
1123 | + {data = textImgNew(), itemname = 'attackpowermul', displayname = motif.option_info.menu_itemname_gameplay_attackpowermul, vardata = textImgNew(), vardisplay = config['Attack.LifeToPowerMul']}, | |
1124 | + {data = textImgNew(), itemname = 'gethitpowermul', displayname = motif.option_info.menu_itemname_gameplay_gethitpowermul, vardata = textImgNew(), vardisplay = config['GetHit.LifeToPowerMul']}, | |
1125 | + {data = textImgNew(), itemname = 'superdefencemul', displayname = motif.option_info.menu_itemname_gameplay_superdefencemul, vardata = textImgNew(), vardisplay = config['Super.TargetDefenceMul']}, | |
923 | 1126 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
924 | - {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_video_back}, | |
1127 | + {data = textImgNew(), itemname = 'singlemode', displayname = motif.option_info.menu_itemname_gameplay_singlemode, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.SingleTeamMode, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled)}, | |
1128 | + {data = textImgNew(), itemname = 'numturns', displayname = motif.option_info.menu_itemname_gameplay_numturns, vardata = textImgNew(), vardisplay = options.f_checkTeamAmount(config.NumTurns, 1, motif.option_info.menu_itemname_disabled)}, | |
1129 | + {data = textImgNew(), itemname = 'numsimul', displayname = motif.option_info.menu_itemname_gameplay_numsimul, vardata = textImgNew(), vardisplay = options.f_checkTeamAmount(config.NumSimul, 1, motif.option_info.menu_itemname_disabled)}, | |
1130 | + {data = textImgNew(), itemname = 'numtag', displayname = motif.option_info.menu_itemname_gameplay_numtag, vardata = textImgNew(), vardisplay = options.f_checkTeamAmount(config.NumTag, 1, motif.option_info.menu_itemname_disabled)}, | |
1131 | + {data = textImgNew(), itemname = 'empty', displayname = ' '}, | |
1132 | + {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_gameplay_back}, | |
925 | 1133 | } |
926 | -t_videoCfg = main.f_cleanTable(t_videoCfg) | |
1134 | +options.t_advGameplayCfg = main.f_cleanTable(options.t_advGameplayCfg, main.t_sort.option_info) | |
927 | 1135 | |
928 | -function options.f_videoCfg() | |
1136 | +function options.f_advGameplayCfg() | |
929 | 1137 | main.f_cmdInput() |
930 | 1138 | local cursorPosY = 1 |
931 | 1139 | local moveTxt = 0 |
932 | 1140 | local item = 1 |
933 | - local t = t_videoCfg | |
934 | - textImgSetText(txt_title, motif.option_info.title_text_video) | |
1141 | + local t = options.t_advGameplayCfg | |
1142 | + textImgSetText(txt_title, motif.option_info.title_text_advgameplay) | |
935 | 1143 | while true do |
936 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1144 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
937 | 1145 | if esc() then |
938 | 1146 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
939 | - textImgSetText(txt_title, motif.option_info.title_text_main) | |
1147 | + textImgSetText(txt_title, motif.option_info.title_text_gameplay) | |
940 | 1148 | break |
941 | - --Resolution | |
942 | - elseif t[item].itemname == 'resolution' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
943 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
944 | - options.f_resCfg() | |
945 | - t[item].vardisplay = config.Width .. 'x' .. config.Height | |
946 | - --Fullscreen | |
947 | - elseif t[item].itemname == 'fullscreen' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
948 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
949 | - if config.Fullscreen then | |
950 | - config.Fullscreen = false | |
951 | - else | |
952 | - config.Fullscreen = true | |
1149 | + --Attack.LifeToPowerMul | |
1150 | + elseif t[item].itemname == 'attackpowermul' then | |
1151 | + if commandGetState(main.p1Cmd, 'r') then | |
1152 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1153 | + config['Attack.LifeToPowerMul'] = options.f_precision(config['Attack.LifeToPowerMul'] + 0.1, '%.01f') | |
1154 | + t[item].vardisplay = config['Attack.LifeToPowerMul'] | |
1155 | + setAttackLifeToPowerMul(config['Attack.LifeToPowerMul']) | |
1156 | + modified = 1 | |
1157 | + elseif commandGetState(main.p1Cmd, 'l') and config['Attack.LifeToPowerMul'] > 0.1 then | |
1158 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1159 | + config['Attack.LifeToPowerMul'] = options.f_precision(config['Attack.LifeToPowerMul'] - 0.1, '%.01f') | |
1160 | + t[item].vardisplay = config['Attack.LifeToPowerMul'] | |
1161 | + setAttackLifeToPowerMul(config['Attack.LifeToPowerMul']) | |
1162 | + modified = 1 | |
953 | 1163 | end |
954 | - t[item].vardisplay = options.f_boolDisplay(config.Fullscreen) | |
955 | - modified = 1 | |
956 | - needReload = 1 | |
957 | - elseif t[item].itemname == 'msaa' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
958 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
959 | - if config.MSAA then | |
960 | - config.MSAA = false | |
961 | - else | |
962 | - config.MSAA = true | |
1164 | + --GetHit.LifeToPowerMul | |
1165 | + elseif t[item].itemname == 'gethitpowermul' then | |
1166 | + if commandGetState(main.p1Cmd, 'r') then | |
1167 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1168 | + config['GetHit.LifeToPowerMul'] = options.f_precision(config['GetHit.LifeToPowerMul'] + 0.1, '%.01f') | |
1169 | + t[item].vardisplay = config['GetHit.LifeToPowerMul'] | |
1170 | + setGetHitLifeToPowerMul(config['GetHit.LifeToPowerMul']) | |
1171 | + modified = 1 | |
1172 | + elseif commandGetState(main.p1Cmd, 'l') and config['GetHit.LifeToPowerMul'] > 0.1 then | |
1173 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1174 | + config['GetHit.LifeToPowerMul'] = options.f_precision(config['GetHit.LifeToPowerMul'] - 0.1, '%.01f') | |
1175 | + t[item].vardisplay = config['GetHit.LifeToPowerMul'] | |
1176 | + setGetHitLifeToPowerMul(config['GetHit.LifeToPowerMul']) | |
1177 | + modified = 1 | |
963 | 1178 | end |
964 | - t[item].vardisplay = options.f_boolDisplay(config.MSAA, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled) | |
965 | - modified = 1 | |
966 | - needReload = 1 | |
967 | - --AI Palette | |
968 | - elseif t[item].itemname == 'airandomcolor' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
1179 | + --Super.TargetDefenceMul | |
1180 | + elseif t[item].itemname == 'superdefencemul' then | |
1181 | + if commandGetState(main.p1Cmd, 'r') then | |
1182 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1183 | + config['Super.TargetDefenceMul'] = options.f_precision(config['Super.TargetDefenceMul'] + 0.1, '%.01f') | |
1184 | + t[item].vardisplay = config['Super.TargetDefenceMul'] | |
1185 | + setSuperTargetDefenceMul(config['Super.TargetDefenceMul']) | |
1186 | + modified = 1 | |
1187 | + elseif commandGetState(main.p1Cmd, 'l') and config['Super.TargetDefenceMul'] > 0.1 then | |
1188 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1189 | + config['Super.TargetDefenceMul'] = options.f_precision(config['Super.TargetDefenceMul'] - 0.1, '%.01f') | |
1190 | + t[item].vardisplay = config['Super.TargetDefenceMul'] | |
1191 | + setSuperTargetDefenceMul(config['Super.TargetDefenceMul']) | |
1192 | + modified = 1 | |
1193 | + end | |
1194 | + --Single Mode | |
1195 | + elseif t[item].itemname == 'singlemode' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
969 | 1196 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
970 | - if config.AIRandomColor then | |
971 | - config.AIRandomColor = false | |
1197 | + if config.SingleTeamMode then | |
1198 | + config.SingleTeamMode = false | |
972 | 1199 | else |
973 | - config.AIRandomColor = true | |
1200 | + config.SingleTeamMode = true | |
974 | 1201 | end |
975 | - t[item].vardisplay = options.f_boolDisplay(config.AIRandomColor, motif.option_info.menu_itemname_video_aipalette_random, motif.option_info.menu_itemname_video_aipalette_default) | |
1202 | + t[item].vardisplay = options.f_boolDisplay(config.SingleTeamMode, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled) | |
976 | 1203 | modified = 1 |
977 | - -- Postprocessing | |
978 | - elseif t[item].itemname == 'postprocessingshader' then | |
979 | - if commandGetState(main.p1Cmd, 'r') and config.PostProcessingShader < #t_shaderNames then | |
1204 | + --Turns Limit | |
1205 | + elseif t[item].itemname == 'numturns' then | |
1206 | + if commandGetState(main.p1Cmd, 'r') and config.NumTurns < 8 then | |
980 | 1207 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
981 | - config.PostProcessingShader = config.PostProcessingShader + 1 | |
1208 | + config.NumTurns = config.NumTurns + 1 | |
1209 | + t[item].vardisplay = config.NumTurns | |
982 | 1210 | modified = 1 |
983 | - needReload = 1 | |
984 | - elseif commandGetState(main.p1Cmd, 'l') and config.PostProcessingShader > 0 then | |
1211 | + elseif commandGetState(main.p1Cmd, 'l') and config.NumTurns > 1 then | |
985 | 1212 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
986 | - config.PostProcessingShader = config.PostProcessingShader - 1 | |
987 | - modified = 1 | |
988 | - needReload = 1 | |
989 | - end | |
990 | - t[item].vardisplay = t_shaderNames[config.PostProcessingShader] | |
991 | - -- Back | |
992 | - elseif t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0 then | |
993 | - sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
994 | - textImgSetText(txt_title, motif.option_info.title_text_main) | |
995 | - break | |
996 | - end | |
997 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
998 | - end | |
999 | -end | |
1000 | - | |
1001 | ---;=========================================================== | |
1002 | ---; RESOLUTION SETTINGS | |
1003 | ---;=========================================================== | |
1004 | -local t_resCfg = { | |
1005 | - {data = textImgNew(), x = 320, y = 240, displayname = motif.option_info.menu_itemname_res_320x240}, | |
1006 | - {data = textImgNew(), x = 640, y = 480, displayname = motif.option_info.menu_itemname_res_640x480}, | |
1007 | - {data = textImgNew(), x = 1280, y = 960, displayname = motif.option_info.menu_itemname_res_1280x960}, | |
1008 | - {data = textImgNew(), x = 1600, y = 1200, displayname = motif.option_info.menu_itemname_res_1600x1200}, | |
1009 | - {data = textImgNew(), x = 960, y = 720, displayname = motif.option_info.menu_itemname_res_960x720}, | |
1010 | - {data = textImgNew(), x = 1200, y = 900, displayname = motif.option_info.menu_itemname_res_1200x900}, | |
1011 | - {data = textImgNew(), x = 1440, y = 1080, displayname = motif.option_info.menu_itemname_res_1440x1080}, | |
1012 | - {data = textImgNew(), x = 1280, y = 720, displayname = motif.option_info.menu_itemname_res_1280x720}, | |
1013 | - {data = textImgNew(), x = 1600, y = 900, displayname = motif.option_info.menu_itemname_res_1600x900}, | |
1014 | - {data = textImgNew(), x = 1920, y = 1080, displayname = motif.option_info.menu_itemname_res_1920x1080}, | |
1015 | - {data = textImgNew(), x = 2560, y = 1440, displayname = motif.option_info.menu_itemname_res_2560x1440}, | |
1016 | - {data = textImgNew(), x = 3840, y = 2160, displayname = motif.option_info.menu_itemname_res_3840x2160}, | |
1017 | - {data = textImgNew(), itemname = 'empty', displayname = ' '}, | |
1018 | - {data = textImgNew(), itemname = 'custom', displayname = motif.option_info.menu_itemname_res_custom}, | |
1019 | - {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_res_back}, | |
1020 | -} | |
1021 | -t_resCfg = main.f_cleanTable(t_resCfg) | |
1022 | - | |
1023 | -function options.f_resCfg() | |
1024 | - main.f_cmdInput() | |
1025 | - local cursorPosY = 1 | |
1026 | - local moveTxt = 0 | |
1027 | - local item = 1 | |
1028 | - local t = t_resCfg | |
1029 | - textImgSetText(txt_title, motif.option_info.title_text_res) | |
1030 | - while true do | |
1031 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1032 | - if esc() then | |
1033 | - sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1034 | - textImgSetText(txt_title, motif.option_info.title_text_video) | |
1035 | - break | |
1036 | - elseif main.f_btnPalNo(main.p1Cmd) > 0 then | |
1037 | - --Back | |
1038 | - if t[item].itemname == 'back' then | |
1039 | - sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1040 | - textImgSetText(txt_title, motif.option_info.title_text_video) | |
1041 | - break | |
1042 | - --Custom | |
1043 | - elseif t[item].itemname == 'custom' then | |
1213 | + config.NumTurns = config.NumTurns - 1 | |
1214 | + t[item].vardisplay = options.f_checkTeamAmount(config.NumTurns, 1, motif.option_info.menu_itemname_disabled) | |
1215 | + if config.NumTurns < 2 then | |
1216 | + select.t_p1TeamMenu = select.f_getTeamMenu() | |
1217 | + select.t_p1TeamMenu = main.f_cleanTable(select.t_p1TeamMenu, main.t_sort.select_info) | |
1218 | + select.t_p2TeamMenu = select.f_getTeamMenu() | |
1219 | + select.t_p2TeamMenu = main.f_cleanTable(select.t_p2TeamMenu, main.t_sort.select_info) | |
1220 | + end | |
1221 | + modified = 1 | |
1222 | + end | |
1223 | + --Simul Limit | |
1224 | + elseif t[item].itemname == 'numsimul' then | |
1225 | + if commandGetState(main.p1Cmd, 'r') and config.NumSimul < 8 then | |
1044 | 1226 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
1045 | - local width = tonumber(main.f_input(main.f_extractText(motif.option_info.input_text_reswidth), motif.option_info, motif.optionbgdef, 'string')) | |
1046 | - if width ~= nil then | |
1047 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1048 | - local height = tonumber(main.f_input(main.f_extractText(motif.option_info.input_text_resheight), motif.option_info, motif.optionbgdef, 'string')) | |
1049 | - if height ~= nil then | |
1050 | - config.Width = width | |
1051 | - config.Height = height | |
1052 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
1053 | - if (height / 3 * 4) ~= width then | |
1054 | - main.f_warning(main.f_extractText(motif.warning_info.text_res), motif.option_info, motif.optionbgdef) | |
1055 | - end | |
1056 | - modified = 1 | |
1057 | - needReload = 1 | |
1058 | - else | |
1059 | - sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1060 | - end | |
1061 | - else | |
1062 | - sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1227 | + config.NumSimul = config.NumSimul + 1 | |
1228 | + t[item].vardisplay = config.NumSimul | |
1229 | + modified = 1 | |
1230 | + elseif commandGetState(main.p1Cmd, 'l') and config.NumSimul > 1 then | |
1231 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1232 | + config.NumSimul = config.NumSimul - 1 | |
1233 | + t[item].vardisplay = options.f_checkTeamAmount(config.NumSimul, 1, motif.option_info.menu_itemname_disabled) | |
1234 | + if config.NumSimul < 2 then | |
1235 | + select.t_p1TeamMenu = select.f_getTeamMenu() | |
1236 | + select.t_p1TeamMenu = main.f_cleanTable(select.t_p1TeamMenu, main.t_sort.select_info) | |
1237 | + select.t_p2TeamMenu = select.f_getTeamMenu() | |
1238 | + select.t_p2TeamMenu = main.f_cleanTable(select.t_p2TeamMenu, main.t_sort.select_info) | |
1063 | 1239 | end |
1064 | - break | |
1065 | - --Resolution | |
1066 | - else | |
1067 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
1068 | - config.Width = t[item].x | |
1069 | - config.Height = t[item].y | |
1070 | - if (config.Height / 3 * 4) ~= config.Width then | |
1071 | - main.f_warning(main.f_extractText(motif.warning_info.text_res), motif.option_info, motif.optionbgdef) | |
1240 | + modified = 1 | |
1241 | + end | |
1242 | + --Tag Limit | |
1243 | + elseif t[item].itemname == 'numtag' then | |
1244 | + if commandGetState(main.p1Cmd, 'r') and config.NumTag < 4 then | |
1245 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1246 | + config.NumTag = config.NumTag + 1 | |
1247 | + t[item].vardisplay = config.NumTag | |
1248 | + modified = 1 | |
1249 | + elseif commandGetState(main.p1Cmd, 'l') and config.NumTag > 1 then | |
1250 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1251 | + config.NumTag = config.NumTag - 1 | |
1252 | + t[item].vardisplay = options.f_checkTeamAmount(config.NumTag, 1, motif.option_info.menu_itemname_disabled) | |
1253 | + if config.NumTag < 2 then | |
1254 | + select.t_p1TeamMenu = select.f_getTeamMenu() | |
1255 | + select.t_p1TeamMenu = main.f_cleanTable(select.t_p1TeamMenu, main.t_sort.select_info) | |
1256 | + select.t_p2TeamMenu = select.f_getTeamMenu() | |
1257 | + select.t_p2TeamMenu = main.f_cleanTable(select.t_p2TeamMenu, main.t_sort.select_info) | |
1072 | 1258 | end |
1073 | 1259 | modified = 1 |
1074 | - needReload = 1 | |
1075 | - break | |
1076 | 1260 | end |
1261 | + --Back | |
1262 | + elseif t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0 then | |
1263 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1264 | + textImgSetText(txt_title, motif.option_info.title_text_gameplay) | |
1265 | + break | |
1077 | 1266 | end |
1078 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1267 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
1079 | 1268 | end |
1080 | 1269 | end |
1081 | 1270 | |
1082 | 1271 | --;=========================================================== |
1083 | 1272 | --; ENGINE SETTINGS |
1084 | 1273 | --;=========================================================== |
1085 | -local t_engineCfg = { | |
1274 | +options.t_engineCfg = { | |
1086 | 1275 | {data = textImgNew(), itemname = 'allowdebugkeys', displayname = motif.option_info.menu_itemname_engine_allowdebugkeys, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.AllowDebugKeys, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled)}, |
1087 | - {data = textImgNew(), itemname = 'simulmode', displayname = motif.option_info.menu_itemname_gameplay_simulmode, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.SimulMode, motif.option_info.menu_itemname_disabled, motif.option_info.menu_itemname_enabled)}, | |
1276 | + {data = textImgNew(), itemname = 'simulmode', displayname = motif.option_info.menu_itemname_engine_simulmode, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.SimulMode, motif.option_info.menu_itemname_disabled, motif.option_info.menu_itemname_enabled)}, | |
1277 | + {data = textImgNew(), itemname = 'lifebarfontscale', displayname = motif.option_info.menu_itemname_engine_lifebarfontscale, vardata = textImgNew(), vardisplay = config.LifebarFontScale}, | |
1088 | 1278 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
1089 | - {data = textImgNew(), itemname = 'helpermax', displayname = motif.option_info.menu_itemname_video_helpermax, vardata = textImgNew(), vardisplay = config.HelperMax}, | |
1090 | - {data = textImgNew(), itemname = 'playerprojectilemax', displayname = motif.option_info.menu_itemname_video_playerprojectilemax, vardata = textImgNew(), vardisplay = config.PlayerProjectileMax}, | |
1091 | - {data = textImgNew(), itemname = 'explodmax', displayname = motif.option_info.menu_itemname_video_explodmax, vardata = textImgNew(), vardisplay = config.ExplodMax}, | |
1092 | - {data = textImgNew(), itemname = 'afterimagemax', displayname = motif.option_info.menu_itemname_video_afterimagemax, vardata = textImgNew(), vardisplay = config.AfterImageMax}, | |
1279 | + {data = textImgNew(), itemname = 'helpermax', displayname = motif.option_info.menu_itemname_engine_helpermax, vardata = textImgNew(), vardisplay = config.HelperMax}, | |
1280 | + {data = textImgNew(), itemname = 'playerprojectilemax', displayname = motif.option_info.menu_itemname_engine_playerprojectilemax, vardata = textImgNew(), vardisplay = config.PlayerProjectileMax}, | |
1281 | + {data = textImgNew(), itemname = 'explodmax', displayname = motif.option_info.menu_itemname_engine_explodmax, vardata = textImgNew(), vardisplay = config.ExplodMax}, | |
1282 | + {data = textImgNew(), itemname = 'afterimagemax', displayname = motif.option_info.menu_itemname_engine_afterimagemax, vardata = textImgNew(), vardisplay = config.AfterImageMax}, | |
1093 | 1283 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
1094 | - {data = textImgNew(), itemname = 'zoomactive', displayname = motif.option_info.menu_itemname_video_zoomactive, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.ZoomActive)}, | |
1095 | - {data = textImgNew(), itemname = 'maxzoomout', displayname = motif.option_info.menu_itemname_video_maxzoomout, vardata = textImgNew(), vardisplay = config.ZoomMin}, | |
1096 | - {data = textImgNew(), itemname = 'maxzoomin', displayname = motif.option_info.menu_itemname_video_maxzoomin, vardata = textImgNew(), vardisplay = config.ZoomMax}, | |
1097 | - {data = textImgNew(), itemname = 'zoomspeed', displayname = motif.option_info.menu_itemname_video_zoomspeed, vardata = textImgNew(), vardisplay = config.ZoomSpeed}, | |
1284 | + {data = textImgNew(), itemname = 'zoomactive', displayname = motif.option_info.menu_itemname_engine_zoomactive, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.ZoomActive)}, | |
1285 | + {data = textImgNew(), itemname = 'maxzoomout', displayname = motif.option_info.menu_itemname_engine_maxzoomout, vardata = textImgNew(), vardisplay = config.ZoomMin}, | |
1286 | + {data = textImgNew(), itemname = 'maxzoomin', displayname = motif.option_info.menu_itemname_engine_maxzoomin, vardata = textImgNew(), vardisplay = config.ZoomMax}, | |
1287 | + {data = textImgNew(), itemname = 'zoomspeed', displayname = motif.option_info.menu_itemname_engine_zoomspeed, vardata = textImgNew(), vardisplay = config.ZoomSpeed}, | |
1098 | 1288 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
1099 | 1289 | {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_video_back}, |
1100 | 1290 | } |
1101 | -t_engineCfg = main.f_cleanTable(t_engineCfg) | |
1291 | +options.t_engineCfg = main.f_cleanTable(options.t_engineCfg, main.t_sort.option_info) | |
1102 | 1292 | |
1103 | 1293 | function options.f_engineCfg() |
1104 | 1294 | main.f_cmdInput() |
1105 | 1295 | local cursorPosY = 1 |
1106 | 1296 | local moveTxt = 0 |
1107 | 1297 | local item = 1 |
1108 | - local t = t_engineCfg | |
1298 | + local t = options.t_engineCfg | |
1109 | 1299 | textImgSetText(txt_title, motif.option_info.title_text_engine) |
1110 | 1300 | while true do |
1111 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1301 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
1112 | 1302 | if esc() then |
1113 | 1303 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
1114 | 1304 | textImgSetText(txt_title, motif.option_info.title_text_main) |
1115 | 1305 | break |
1306 | + --Allow Debug Keys | |
1307 | + elseif t[item].itemname == 'allowdebugkeys' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
1308 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1309 | + if config.AllowDebugKeys then | |
1310 | + config.AllowDebugKeys = false | |
1311 | + else | |
1312 | + config.AllowDebugKeys = true | |
1313 | + end | |
1314 | + t[item].vardisplay = options.f_boolDisplay(config.AllowDebugKeys, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled) | |
1315 | + setAllowDebugKeys(config.AllowDebugKeys) | |
1316 | + modified = 1 | |
1317 | + --Legacy Tag Mode | |
1318 | + elseif t[item].itemname == 'simulmode' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
1319 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1320 | + if config.SimulMode then | |
1321 | + config.SimulMode = false | |
1322 | + else | |
1323 | + config.SimulMode = true | |
1324 | + end | |
1325 | + t[item].vardisplay = options.f_boolDisplay(config.SimulMode, motif.option_info.menu_itemname_disabled, motif.option_info.menu_itemname_enabled) | |
1326 | + main.f_warning(main.f_extractText(motif.warning_info.text_simul), motif.option_info, motif.optionbgdef) | |
1327 | + modified = 1 | |
1328 | + --Lifebar Font Scale | |
1329 | + elseif t[item].itemname == 'lifebarfontscale' then | |
1330 | + if commandGetState(main.p1Cmd, 'r') then | |
1331 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1332 | + config.LifebarFontScale = options.f_precision(config.LifebarFontScale + 0.1, '%.01f') | |
1333 | + t[item].vardisplay = config.LifebarFontScale | |
1334 | + modified = 1 | |
1335 | + needReload = 1 | |
1336 | + elseif commandGetState(main.p1Cmd, 'l') and config.LifebarFontScale > 0.1 then | |
1337 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1338 | + config.LifebarFontScale = options.f_precision(config.LifebarFontScale - 0.1, '%.01f') | |
1339 | + t[item].vardisplay = config.LifebarFontScale | |
1340 | + modified = 1 | |
1341 | + needReload = 1 | |
1342 | + end | |
1116 | 1343 | --HelperMax |
1117 | 1344 | elseif t[item].itemname == 'helpermax' then |
1118 | 1345 | if commandGetState(main.p1Cmd, 'r') then |
@@ -1222,82 +1449,54 @@ function options.f_engineCfg() | ||
1222 | 1449 | t[item].vardisplay = config.ZoomSpeed |
1223 | 1450 | modified = 1 |
1224 | 1451 | end |
1225 | - -- Leagcy TAG Mode | |
1226 | - elseif t[item].itemname == 'simulmode' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
1227 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1228 | - if config.SimulMode then | |
1229 | - config.SimulMode = false | |
1230 | - else | |
1231 | - config.SimulMode = true | |
1232 | - end | |
1233 | - t[item].vardisplay = options.f_boolDisplay(config.SimulMode, motif.option_info.menu_itemname_disabled, motif.option_info.menu_itemname_enabled) | |
1234 | - modified = 1 | |
1235 | - needReload = 1 | |
1236 | - -- Allow Debug Keys | |
1237 | - elseif t[item].itemname == 'allowdebugkeys' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
1238 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1239 | - if config.AllowDebugKeys then | |
1240 | - config.AllowDebugKeys = false | |
1241 | - else | |
1242 | - config.AllowDebugKeys = true | |
1243 | - end | |
1244 | - t[item].vardisplay = options.f_boolDisplay(config.AllowDebugKeys, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled) | |
1245 | - modified = 1 | |
1246 | - needReload = 1 | |
1247 | 1452 | --Back |
1248 | 1453 | elseif t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0 then |
1249 | 1454 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
1250 | 1455 | textImgSetText(txt_title, motif.option_info.title_text_main) |
1251 | 1456 | break |
1252 | 1457 | end |
1253 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1458 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
1254 | 1459 | end |
1255 | 1460 | end |
1256 | 1461 | |
1257 | 1462 | --;=========================================================== |
1258 | 1463 | --; INPUT SETTINGS |
1259 | 1464 | --;=========================================================== |
1260 | -local t_inputCfg = { | |
1261 | - {data = textImgNew(), itemname = 'p1keyboard', displayname = motif.option_info.menu_itemname_input_p1keyboard}, | |
1262 | - {data = textImgNew(), itemname = 'p1gamepad', displayname = motif.option_info.menu_itemname_input_p1gamepad}, | |
1263 | - {data = textImgNew(), itemname = 'p2keyboard', displayname = motif.option_info.menu_itemname_input_p2keyboard}, | |
1264 | - {data = textImgNew(), itemname = 'p2gamepad', displayname = motif.option_info.menu_itemname_input_p2gamepad}, | |
1465 | +options.t_inputCfg = { | |
1466 | + {data = textImgNew(), itemname = 'keyboard', displayname = motif.option_info.menu_itemname_input_keyboard}, | |
1467 | + {data = textImgNew(), itemname = 'gamepad', displayname = motif.option_info.menu_itemname_input_gamepad}, | |
1468 | + --{data = textImgNew(), itemname = 'system', displayname = motif.option_info.menu_itemname_input_system}, | |
1265 | 1469 | {data = textImgNew(), itemname = 'empty', displayname = ' '}, |
1266 | 1470 | {data = textImgNew(), itemname = 'defaultvalues', displayname = motif.option_info.menu_itemname_input_default}, |
1267 | 1471 | {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_input_back}, |
1268 | 1472 | } |
1269 | -t_inputCfg = main.f_cleanTable(t_inputCfg) | |
1473 | +options.t_inputCfg = main.f_cleanTable(options.t_inputCfg, main.t_sort.option_info) | |
1270 | 1474 | |
1271 | 1475 | function options.f_inputCfg() |
1272 | 1476 | main.f_cmdInput() |
1273 | 1477 | local cursorPosY = 1 |
1274 | 1478 | local moveTxt = 0 |
1275 | 1479 | local item = 1 |
1276 | - local t = t_inputCfg | |
1480 | + local t = options.t_inputCfg | |
1277 | 1481 | textImgSetText(txt_title, motif.option_info.title_text_input) |
1278 | 1482 | while true do |
1279 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1483 | + cursorPosY, moveTxt, item = options.f_menuCommonCalc(cursorPosY, moveTxt, item, t) | |
1280 | 1484 | if esc() then |
1281 | 1485 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
1282 | 1486 | textImgSetText(txt_title, motif.option_info.title_text_main) |
1283 | 1487 | break |
1284 | 1488 | elseif main.f_btnPalNo(main.p1Cmd) > 0 then |
1285 | - --P1 Keyboard | |
1286 | - if t[item].itemname == 'p1keyboard' then | |
1489 | + --Key Config | |
1490 | + if t[item].itemname == 'keyboard' then | |
1287 | 1491 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
1288 | - options.f_keyCfg(1, -1) | |
1289 | - --P1 Gamepad | |
1290 | - elseif t[item].itemname == 'p1gamepad' then | |
1492 | + options.f_keyCfg('KeyConfig', t[item].itemname) | |
1493 | + --Joystick Config | |
1494 | + elseif t[item].itemname == 'gamepad' then | |
1291 | 1495 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
1292 | - options.f_keyCfg(1, 0) | |
1293 | - --P2 Keyboard | |
1294 | - elseif t[item].itemname == 'p2keyboard' then | |
1496 | + options.f_keyCfg('JoystickConfig', t[item].itemname) | |
1497 | + --System Keys (not implemented yet) | |
1498 | + elseif t[item].itemname == 'system' then | |
1295 | 1499 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
1296 | - options.f_keyCfg(2, -1) | |
1297 | - --P2 Gamepad | |
1298 | - elseif t[item].itemname == 'p2gamepad' then | |
1299 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1300 | - options.f_keyCfg(2, 1) | |
1301 | 1500 | --Default Values |
1302 | 1501 | elseif t[item].itemname == 'defaultvalues' then |
1303 | 1502 | sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) |
@@ -1311,7 +1510,7 @@ function options.f_inputCfg() | ||
1311 | 1510 | break |
1312 | 1511 | end |
1313 | 1512 | end |
1314 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1513 | + options.f_menuCommonDraw(cursorPosY, moveTxt, item, t) | |
1315 | 1514 | end |
1316 | 1515 | end |
1317 | 1516 |
@@ -1319,162 +1518,505 @@ end | ||
1319 | 1518 | --; KEY SETTINGS |
1320 | 1519 | --;=========================================================== |
1321 | 1520 | local t_keyCfg = { |
1322 | - {data = textImgNew(), itemname = 'up', displayname = motif.option_info.menu_itemname_key_up, vardata = textImgNew(), vardisplay = ''}, | |
1323 | - {data = textImgNew(), itemname = 'down', displayname = motif.option_info.menu_itemname_key_down, vardata = textImgNew(), vardisplay = ''}, | |
1324 | - {data = textImgNew(), itemname = 'left', displayname = motif.option_info.menu_itemname_key_left, vardata = textImgNew(), vardisplay = ''}, | |
1325 | - {data = textImgNew(), itemname = 'right', displayname = motif.option_info.menu_itemname_key_right, vardata = textImgNew(), vardisplay = ''}, | |
1326 | - {data = textImgNew(), itemname = 'a', displayname = motif.option_info.menu_itemname_key_a, vardata = textImgNew(), vardisplay = ''}, | |
1327 | - {data = textImgNew(), itemname = 'b', displayname = motif.option_info.menu_itemname_key_b, vardata = textImgNew(), vardisplay = ''}, | |
1328 | - {data = textImgNew(), itemname = 'c', displayname = motif.option_info.menu_itemname_key_c, vardata = textImgNew(), vardisplay = ''}, | |
1329 | - {data = textImgNew(), itemname = 'x', displayname = motif.option_info.menu_itemname_key_x, vardata = textImgNew(), vardisplay = ''}, | |
1330 | - {data = textImgNew(), itemname = 'y', displayname = motif.option_info.menu_itemname_key_y, vardata = textImgNew(), vardisplay = ''}, | |
1331 | - {data = textImgNew(), itemname = 'z', displayname = motif.option_info.menu_itemname_key_z, vardata = textImgNew(), vardisplay = ''}, | |
1332 | - {data = textImgNew(), itemname = 'start', displayname = motif.option_info.menu_itemname_key_start, vardata = textImgNew(), vardisplay = ''}, | |
1333 | - {data = textImgNew(), itemname = 'v', displayname = motif.option_info.menu_itemname_key_v, vardata = textImgNew(), vardisplay = ''}, | |
1334 | - {data = textImgNew(), itemname = 'w', displayname = motif.option_info.menu_itemname_key_w, vardata = textImgNew(), vardisplay = ''}, | |
1335 | - {data = textImgNew(), itemname = 'empty', displayname = ' '}, | |
1336 | - {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_key_back}, | |
1521 | + {data = textImgNew(), itemname = 'dummy', displayname = ''}, | |
1522 | + {data = textImgNew(), itemname = 'configall', displayname = motif.option_info.menu_itemname_key_all, infodata = textImgNew(), infodisplay = ''}, | |
1523 | + {data = textImgNew(), itemname = 'up', displayname = motif.option_info.menu_itemname_key_up, vardata = textImgNew()}, | |
1524 | + {data = textImgNew(), itemname = 'down', displayname = motif.option_info.menu_itemname_key_down, vardata = textImgNew()}, | |
1525 | + {data = textImgNew(), itemname = 'left', displayname = motif.option_info.menu_itemname_key_left, vardata = textImgNew()}, | |
1526 | + {data = textImgNew(), itemname = 'right', displayname = motif.option_info.menu_itemname_key_right, vardata = textImgNew()}, | |
1527 | + {data = textImgNew(), itemname = 'a', displayname = motif.option_info.menu_itemname_key_a, vardata = textImgNew()}, | |
1528 | + {data = textImgNew(), itemname = 'b', displayname = motif.option_info.menu_itemname_key_b, vardata = textImgNew()}, | |
1529 | + {data = textImgNew(), itemname = 'c', displayname = motif.option_info.menu_itemname_key_c, vardata = textImgNew()}, | |
1530 | + {data = textImgNew(), itemname = 'x', displayname = motif.option_info.menu_itemname_key_x, vardata = textImgNew()}, | |
1531 | + {data = textImgNew(), itemname = 'y', displayname = motif.option_info.menu_itemname_key_y, vardata = textImgNew()}, | |
1532 | + {data = textImgNew(), itemname = 'z', displayname = motif.option_info.menu_itemname_key_z, vardata = textImgNew()}, | |
1533 | + {data = textImgNew(), itemname = 'start', displayname = motif.option_info.menu_itemname_key_start, vardata = textImgNew()}, | |
1534 | + {data = textImgNew(), itemname = 'd', displayname = motif.option_info.menu_itemname_key_d, vardata = textImgNew()}, | |
1535 | + {data = textImgNew(), itemname = 'w', displayname = motif.option_info.menu_itemname_key_w, vardata = textImgNew()}, | |
1536 | + {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_key_back, infodata = textImgNew(), infodisplay = motif.option_info.menu_itemname_info_esc}, | |
1337 | 1537 | } |
1338 | -t_keyCfg = main.f_cleanTable(t_keyCfg) | |
1538 | +--t_keyCfg = main.f_cleanTable(t_keyCfg, main.t_sort.option_info) | |
1339 | 1539 | |
1340 | -function options.f_keyCfg(playerNo, controller) | |
1540 | +local txt_keyController = textImgNew() | |
1541 | +function options.f_keyCfg(cfgType, controller) | |
1341 | 1542 | main.f_cmdInput() |
1342 | - local cursorPosY = 1 | |
1543 | + local cursorPosY = 2 | |
1343 | 1544 | local moveTxt = 0 |
1344 | - local item = 1 | |
1545 | + local item = 2 | |
1546 | + local item_start = 2 | |
1345 | 1547 | local t = t_keyCfg |
1548 | + local t_pos = {motif.option_info.menu_key_p1_pos, motif.option_info.menu_key_p2_pos} | |
1549 | + local configall = false | |
1550 | + local key = '' | |
1551 | + local t_keyList = {} | |
1552 | + local t_conflict = {} | |
1553 | + local btnReleased = 0 | |
1554 | + local player = 1 | |
1555 | + local btn = tostring(config[cfgType][player].Buttons[item - item_start]) | |
1556 | + local joyNum = 0 | |
1346 | 1557 | textImgSetText(txt_title, motif.option_info.title_text_key) |
1347 | - for i = 1, #t_keyCfg do | |
1348 | - if controller == -1 then | |
1349 | - t_keyCfg[i].vardisplay = config.KeyConfig[playerNo].Buttons[i] | |
1350 | - else | |
1351 | - t_keyCfg[i].vardisplay = config.JoystickConfig[playerNo].Buttons[i] | |
1558 | + --count all button assignments on the same controller | |
1559 | + for i = 1, #config[cfgType] do | |
1560 | + joyNum = config[cfgType][i].Joystick | |
1561 | + if t_keyList[joyNum] == nil then | |
1562 | + t_keyList[joyNum] = {} --creates subtable for each controller (1 for keyboard or at least 2 for gamepads) | |
1563 | + t_conflict[joyNum] = false --set default conflict flag for each controller | |
1564 | + end | |
1565 | + for k, v in pairs(config[cfgType][i].Buttons) do | |
1566 | + v = tostring(v) | |
1567 | + t_keyCfg[k + item_start]['vardisplay' .. i] = v --assign vardisplay entry (assigned button name) in t_keyCfg table | |
1568 | + if v ~= tostring(motif.option_info.menu_itemname_info_disable) then --if button is not disabled | |
1569 | + if t_keyList[joyNum][v] == nil then | |
1570 | + t_keyList[joyNum][v] = 1 | |
1571 | + else | |
1572 | + t_keyList[joyNum][v] = t_keyList[joyNum][v] + 1 | |
1573 | + end | |
1574 | + end | |
1352 | 1575 | end |
1353 | 1576 | end |
1577 | + joyNum = config[cfgType][player].Joystick | |
1354 | 1578 | while true do |
1355 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1356 | - if esc() then | |
1357 | - sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1358 | - textImgSetText(txt_title, motif.option_info.title_text_input) | |
1359 | - break | |
1360 | - elseif main.f_btnPalNo(main.p1Cmd) > 0 then | |
1361 | - --Back | |
1362 | - if t[item].itemname == 'back' then | |
1579 | + --Config all | |
1580 | + if configall then | |
1581 | + if cfgType == 'KeyConfig' then --detect keyboard key | |
1582 | + key = getKey() | |
1583 | + elseif getJoystickPresent(joyNum) == false then --ensure that gamepad is connected | |
1584 | + main.f_warning(main.f_extractText(motif.warning_info.text_pad), motif.option_info, motif.optionbgdef) | |
1585 | + configall = false | |
1586 | + commandBufReset(main.p1Cmd) | |
1587 | + else --detect gamepad key | |
1588 | + local tmp = getKey() | |
1589 | + if tonumber(tmp) == nil then --button released | |
1590 | + btnReleased = 1 | |
1591 | + elseif btnReleased == 1 then --button pressed after releasing button once | |
1592 | + key = tmp | |
1593 | + btnReleased = 0 | |
1594 | + end | |
1595 | + end | |
1596 | + key = tostring(key) | |
1597 | + if esc() then | |
1363 | 1598 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
1364 | - textImgSetText(txt_title, motif.option_info.title_text_input) | |
1365 | - break | |
1366 | - --Buttons | |
1367 | - else | |
1368 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1369 | - local key = main.f_input(main.f_extractText(motif.option_info.input_text_key), motif.option_info, motif.optionbgdef, 'key') | |
1370 | - if (controller == -1 and key ~= '') or (controller ~= -1 and tonumber(key) ~= nil) then | |
1371 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
1372 | - t[item].vardisplay = key | |
1373 | - if controller == -1 then | |
1374 | - config.KeyConfig[playerNo].Buttons[item] = key | |
1599 | + configall = false | |
1600 | + commandBufReset(main.p1Cmd) | |
1601 | + --some key detected | |
1602 | + elseif key ~= '' then | |
1603 | + --spacebar (disable key) | |
1604 | + if key == 'SPACE' then | |
1605 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1606 | + --decrease old button count | |
1607 | + if t_keyList[joyNum][btn] ~= nil and t_keyList[joyNum][btn] > 1 then | |
1608 | + t_keyList[joyNum][btn] = t_keyList[joyNum][btn] - 1 | |
1609 | + else | |
1610 | + t_keyList[joyNum][btn] = nil | |
1611 | + end | |
1612 | + --update vardisplay / config data | |
1613 | + t[item]['vardisplay' .. player] = motif.option_info.menu_itemname_info_disable | |
1614 | + config[cfgType][player].Buttons[item - item_start] = tostring(motif.option_info.menu_itemname_info_disable) | |
1615 | + modified = 1 | |
1616 | + needReload = 1 | |
1617 | + --other keyboard or gamepad key | |
1618 | + elseif cfgType == 'KeyConfig' or (cfgType == 'JoystickConfig' and tonumber(key) ~= nil) then | |
1619 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1620 | + --decrease old button count | |
1621 | + if t_keyList[joyNum][btn] ~= nil and t_keyList[joyNum][btn] > 1 then | |
1622 | + t_keyList[joyNum][btn] = t_keyList[joyNum][btn] - 1 | |
1623 | + else | |
1624 | + t_keyList[joyNum][btn] = nil | |
1625 | + end | |
1626 | + --increase new button count | |
1627 | + if t_keyList[joyNum][key] == nil then | |
1628 | + t_keyList[joyNum][key] = 1 | |
1375 | 1629 | else |
1376 | - config.JoystickConfig[playerNo].Buttons[item] = key | |
1630 | + t_keyList[joyNum][key] = t_keyList[joyNum][key] + 1 | |
1377 | 1631 | end |
1632 | + --update vardisplay / config data | |
1633 | + t[item]['vardisplay' .. player] = key | |
1634 | + config[cfgType][player].Buttons[item - item_start] = tostring(key) | |
1635 | + modified = 1 | |
1636 | + needReload = 1 | |
1637 | + --non gamepad key on gamepad controller | |
1378 | 1638 | else |
1379 | 1639 | sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) |
1380 | 1640 | end |
1641 | + --move to the next position | |
1642 | + item = item + 1 | |
1643 | + if cursorPosY < motif.option_info.menu_window_visibleitems then | |
1644 | + cursorPosY = cursorPosY + 1 | |
1645 | + end | |
1646 | + if item > 15 then | |
1647 | + item = item_start | |
1648 | + cursorPosY = item_start | |
1649 | + configall = false | |
1650 | + commandBufReset(main.p1Cmd) | |
1651 | + end | |
1381 | 1652 | end |
1382 | - modified = 1 | |
1383 | - needReload = 1 | |
1653 | + resetKey() | |
1654 | + key = '' | |
1655 | + --move up / down / left / right | |
1656 | + elseif commandGetState(main.p1Cmd, 'u') then | |
1657 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1658 | + item = item - 1 | |
1659 | + elseif commandGetState(main.p1Cmd, 'd') then | |
1660 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1661 | + item = item + 1 | |
1662 | + elseif commandGetState(main.p1Cmd, 'l') or commandGetState(main.p1Cmd, 'r') then | |
1663 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1664 | + if player == 1 then | |
1665 | + player = 2 | |
1666 | + else | |
1667 | + player = 1 | |
1668 | + end | |
1669 | + joyNum = config[cfgType][player].Joystick | |
1384 | 1670 | end |
1385 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
1386 | - end | |
1387 | -end | |
1388 | - | |
1389 | ---;=========================================================== | |
1390 | ---; AUDIO SETTINGS | |
1391 | ---;=========================================================== | |
1392 | -local t_audioCfg = { | |
1393 | - {data = textImgNew(), itemname = 'mastervolume', displayname = motif.option_info.menu_itemname_audio_mastervolume, vardata = textImgNew(), vardisplay = config.MasterVolume .. '%'}, | |
1394 | - {data = textImgNew(), itemname = 'bgmvolume', displayname = motif.option_info.menu_itemname_audio_bgmvolume, vardata = textImgNew(), vardisplay = config.BgmVolume .. '%'}, | |
1395 | - {data = textImgNew(), itemname = 'sfxvolume', displayname = motif.option_info.menu_itemname_audio_sfxvolume, vardata = textImgNew(), vardisplay = config.WavVolume .. '%'}, | |
1396 | - {data = textImgNew(), itemname = 'audioducking', displayname = motif.option_info.menu_itemname_audio_audioducking, vardata = textImgNew(), vardisplay = options.f_boolDisplay(config.AudioDucking, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled)}, | |
1397 | - {data = textImgNew(), itemname = 'empty', displayname = ' '}, | |
1398 | - {data = textImgNew(), itemname = 'back', displayname = motif.option_info.menu_itemname_video_back}, | |
1399 | -} | |
1400 | -t_audioCfg = main.f_cleanTable(t_audioCfg) | |
1401 | - | |
1402 | -function options.f_audioCfg() | |
1403 | - main.f_cmdInput() | |
1404 | - local cursorPosY = 1 | |
1405 | - local moveTxt = 0 | |
1406 | - local item = 1 | |
1407 | - local t = t_audioCfg | |
1408 | - textImgSetText(txt_title, motif.option_info.title_text_audio) | |
1409 | - while true do | |
1410 | - cursorPosY, moveTxt, item = options.f_menuCommon1(cursorPosY, moveTxt, item, t) | |
1411 | - if esc() then | |
1412 | - sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1413 | - textImgSetText(txt_title, motif.option_info.title_text_main) | |
1414 | - break | |
1415 | - -- Master Volume | |
1416 | - elseif t[item].itemname == 'mastervolume' then | |
1417 | - if commandGetState(main.p1Cmd, 'r') and config.MasterVolume < 200 then | |
1418 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1419 | - config.MasterVolume = config.MasterVolume + 1 | |
1420 | - t[item].vardisplay = config.MasterVolume .. '%' | |
1421 | - modified = 1 | |
1422 | - needReload = 1 | |
1423 | - elseif commandGetState(main.p1Cmd, 'l') and config.MasterVolume > 0 then | |
1424 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1425 | - config.MasterVolume = config.MasterVolume - 1 | |
1426 | - t[item].vardisplay = config.MasterVolume .. '%' | |
1427 | - modified = 1 | |
1428 | - needReload = 1 | |
1671 | + --cursor position calculation | |
1672 | + if item < item_start then | |
1673 | + item = #t | |
1674 | + if #t > motif.option_info.menu_window_visibleitems then | |
1675 | + cursorPosY = motif.option_info.menu_window_visibleitems | |
1676 | + else | |
1677 | + cursorPosY = #t | |
1429 | 1678 | end |
1430 | - -- BGM Volume | |
1431 | - elseif t[item].itemname == 'bgmvolume' then | |
1432 | - if commandGetState(main.p1Cmd, 'r') and config.BgmVolume < 100 then | |
1433 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1434 | - config.BgmVolume = config.BgmVolume + 1 | |
1435 | - t[item].vardisplay = config.BgmVolume .. '%' | |
1436 | - modified = 1 | |
1437 | - needReload = 1 | |
1438 | - elseif commandGetState(main.p1Cmd, 'l') and config.BgmVolume > 0 then | |
1439 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1440 | - config.BgmVolume = config.BgmVolume - 1 | |
1441 | - t[item].vardisplay = config.BgmVolume .. '%' | |
1442 | - modified = 1 | |
1443 | - needReload = 1 | |
1679 | + elseif item > #t then | |
1680 | + item = item_start | |
1681 | + cursorPosY = item_start | |
1682 | + elseif configall == false then | |
1683 | + if commandGetState(main.p1Cmd, 'u') and cursorPosY > item_start then | |
1684 | + cursorPosY = cursorPosY - 1 | |
1685 | + elseif commandGetState(main.p1Cmd, 'd') and cursorPosY < motif.option_info.menu_window_visibleitems then | |
1686 | + cursorPosY = cursorPosY + 1 | |
1444 | 1687 | end |
1445 | - -- SFX Volume | |
1446 | - elseif t[item].itemname == 'sfxvolume' then | |
1447 | - if commandGetState(main.p1Cmd, 'r') and config.WavVolume < 100 then | |
1448 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1449 | - config.WavVolume = config.WavVolume + 1 | |
1450 | - t[item].vardisplay = config.WavVolume .. '%' | |
1451 | - modified = 1 | |
1452 | - needReload = 1 | |
1453 | - elseif commandGetState(main.p1Cmd, 'l') and config.WavVolume > 0 then | |
1688 | + end | |
1689 | + if cursorPosY == motif.option_info.menu_window_visibleitems then | |
1690 | + moveTxt = (item - motif.option_info.menu_window_visibleitems) * motif.option_info.menu_item_spacing[2] | |
1691 | + elseif cursorPosY == item_start then | |
1692 | + moveTxt = (item - item_start) * motif.option_info.menu_item_spacing[2] | |
1693 | + end | |
1694 | + btn = tostring(config[cfgType][player].Buttons[item - item_start]) | |
1695 | + if configall == false then | |
1696 | + if esc() and not t_conflict[joyNum] then | |
1697 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1698 | + textImgSetText(txt_title, motif.option_info.title_text_input) | |
1699 | + break | |
1700 | + --Config all | |
1701 | + elseif (t[item].itemname == 'configall' and main.f_btnPalNo(main.p1Cmd) > 0) or getKey() == 'F1' or getKey() == 'F2' then | |
1702 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
1703 | + if getKey() == 'F1' then | |
1704 | + player = 1 | |
1705 | + elseif getKey() == 'F2' then | |
1706 | + player = 2 | |
1707 | + end | |
1708 | + if cfgType == 'JoystickConfig' and getJoystickPresent(joyNum) == false then | |
1709 | + main.f_warning(main.f_extractText(motif.warning_info.text_pad), motif.option_info, motif.optionbgdef) | |
1710 | + item = item_start | |
1711 | + cursorPosY = item_start | |
1712 | + else | |
1713 | + resetKey() | |
1714 | + item = item_start + 1 | |
1715 | + cursorPosY = item_start + 1 | |
1716 | + btnReleased = 0 | |
1717 | + configall = true | |
1718 | + end | |
1719 | + --Back | |
1720 | + elseif (t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0) then | |
1721 | + if t_conflict[joyNum] then | |
1722 | + main.f_warning(main.f_extractText(motif.warning_info.text_keys), motif.option_info, motif.optionbgdef) | |
1723 | + else | |
1724 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1725 | + textImgSetText(txt_title, motif.option_info.title_text_input) | |
1726 | + break | |
1727 | + end | |
1728 | + --individual buttons | |
1729 | + elseif main.f_btnPalNo(main.p1Cmd) > 0 then | |
1454 | 1730 | sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) |
1455 | - config.WavVolume = config.WavVolume - 1 | |
1456 | - t[item].vardisplay = config.WavVolume .. '%' | |
1457 | - modified = 1 | |
1458 | - needReload = 1 | |
1731 | + if cfgType == 'JoystickConfig' and getJoystickPresent(joyNum) == false then | |
1732 | + main.f_warning(main.f_extractText(motif.warning_info.text_pad), motif.option_info, motif.optionbgdef) | |
1733 | + else | |
1734 | + key = main.f_input(main.f_extractText(motif.option_info.input_text_key), motif.option_info, motif.optionbgdef, controller, joyNum, 'SPACE') | |
1735 | + --spacebar (disable key) | |
1736 | + if key == 'SPACE' then | |
1737 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
1738 | + --decrease old button count | |
1739 | + if t_keyList[joyNum][btn] ~= nil and t_keyList[joyNum][btn] > 1 then | |
1740 | + t_keyList[joyNum][btn] = t_keyList[joyNum][btn] - 1 | |
1741 | + else | |
1742 | + t_keyList[joyNum][btn] = nil | |
1743 | + end | |
1744 | + --update vardisplay / config data | |
1745 | + t[item]['vardisplay' .. player] = motif.option_info.menu_itemname_info_disable | |
1746 | + config[cfgType][player].Buttons[item - item_start] = motif.option_info.menu_itemname_info_disable | |
1747 | + modified = 1 | |
1748 | + needReload = 1 | |
1749 | + --other keyboard or gamepad key | |
1750 | + elseif (cfgType == 'KeyConfig' and key ~= '') or (cfgType == 'JoystickConfig' and tonumber(key) ~= nil) then | |
1751 | + sndPlay(motif.files.snd_data, motif.option_info.cursor_done_snd[1], motif.option_info.cursor_done_snd[2]) | |
1752 | + --decrease old button count | |
1753 | + if t_keyList[joyNum][btn] ~= nil and t_keyList[joyNum][btn] > 1 then | |
1754 | + t_keyList[joyNum][btn] = t_keyList[joyNum][btn] - 1 | |
1755 | + else | |
1756 | + t_keyList[joyNum][btn] = nil | |
1757 | + end | |
1758 | + --increase new button count | |
1759 | + if t_keyList[joyNum][key] == nil then | |
1760 | + t_keyList[joyNum][key] = 1 | |
1761 | + else | |
1762 | + t_keyList[joyNum][key] = t_keyList[joyNum][key] + 1 | |
1763 | + end | |
1764 | + --update vardisplay / config data | |
1765 | + t[item]['vardisplay' .. player] = key | |
1766 | + config[cfgType][player].Buttons[item - item_start] = tostring(key) | |
1767 | + modified = 1 | |
1768 | + needReload = 1 | |
1769 | + else | |
1770 | + sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1771 | + end | |
1772 | + resetKey() | |
1773 | + key = '' | |
1774 | + end | |
1459 | 1775 | end |
1460 | - -- Audio Ducking | |
1461 | - elseif t[item].itemname == 'audioducking' and (commandGetState(main.p1Cmd, 'r') or commandGetState(main.p1Cmd, 'l') or main.f_btnPalNo(main.p1Cmd) > 0) then | |
1462 | - sndPlay(motif.files.snd_data, motif.option_info.cursor_move_snd[1], motif.option_info.cursor_move_snd[2]) | |
1463 | - if config.AudioDucking then | |
1464 | - config.AudioDucking = false | |
1465 | - else | |
1466 | - config.AudioDucking = true | |
1776 | + end | |
1777 | + t_conflict[joyNum] = false | |
1778 | + --draw clearcolor | |
1779 | + clearColor(motif.optionbgdef.bgclearcolor[1], motif.optionbgdef.bgclearcolor[2], motif.optionbgdef.bgclearcolor[3]) | |
1780 | + --draw layerno = 0 backgrounds | |
1781 | + bgDraw(motif.optionbgdef.bg, false) | |
1782 | + --draw player num | |
1783 | + for i = 1, 2 do | |
1784 | + textImgDraw(main.f_updateTextImg( | |
1785 | + txt_keyController, | |
1786 | + motif.font_data[motif.option_info['menu_item_key_p' .. i .. '_font'][1]], | |
1787 | + motif.option_info['menu_item_key_p' .. i .. '_font'][2], | |
1788 | + motif.option_info['menu_item_key_p' .. i .. '_font'][3], | |
1789 | + motif.option_info['menu_itemname_key_p' .. i], | |
1790 | + motif.option_info['menu_item_p' .. i .. '_pos'][1], | |
1791 | + motif.option_info['menu_item_p' .. i .. '_pos'][2], | |
1792 | + motif.option_info['menu_item_key_p' .. i .. '_font_scale'][1], | |
1793 | + motif.option_info['menu_item_key_p' .. i .. '_font_scale'][2], | |
1794 | + motif.option_info['menu_item_key_p' .. i .. '_font'][4], | |
1795 | + motif.option_info['menu_item_key_p' .. i .. '_font'][5], | |
1796 | + motif.option_info['menu_item_key_p' .. i .. '_font'][6], | |
1797 | + motif.option_info['menu_item_key_p' .. i .. '_font'][7], | |
1798 | + motif.option_info['menu_item_key_p' .. i .. '_font'][8] | |
1799 | + )) | |
1800 | + end | |
1801 | + --draw menu box | |
1802 | + if motif.option_info.menu_boxbg_visible == 1 then | |
1803 | + local coord4 = 0 | |
1804 | + for i = 1, 2 do | |
1805 | + if #t > motif.option_info.menu_window_visibleitems and moveTxt == (#t - motif.option_info.menu_window_visibleitems) * motif.option_info.menu_key_item_spacing[2] then | |
1806 | + coord4 = motif.option_info.menu_window_visibleitems * (motif.option_info.menu_key_boxcursor_coords[4] - motif.option_info.menu_key_boxcursor_coords[2] + 1) + main.f_oddRounding(motif.option_info.menu_key_boxcursor_coords[2]) | |
1807 | + else | |
1808 | + coord4 = #t * (motif.option_info.menu_key_boxcursor_coords[4] - motif.option_info.menu_key_boxcursor_coords[2] + 1) + main.f_oddRounding(motif.option_info.menu_key_boxcursor_coords[2]) | |
1809 | + end | |
1810 | + fillRect( | |
1811 | + t_pos[i][1] + motif.option_info.menu_key_boxcursor_coords[1], | |
1812 | + t_pos[i][2] + motif.option_info.menu_key_boxcursor_coords[2], | |
1813 | + motif.option_info.menu_key_boxcursor_coords[3] - motif.option_info.menu_key_boxcursor_coords[1] + 1, | |
1814 | + coord4, | |
1815 | + motif.option_info.menu_boxbg_col[1], | |
1816 | + motif.option_info.menu_boxbg_col[2], | |
1817 | + motif.option_info.menu_boxbg_col[3], | |
1818 | + motif.option_info.menu_boxbg_alpha[1], | |
1819 | + motif.option_info.menu_boxbg_alpha[2] | |
1820 | + ) | |
1821 | + end | |
1822 | + end | |
1823 | + --draw title | |
1824 | + textImgDraw(txt_title) | |
1825 | + --draw menu items | |
1826 | + for i = 1, #t do | |
1827 | + for j = 1, 2 do | |
1828 | + if i > item - cursorPosY then | |
1829 | + if t[i].itemname == 'configall' then | |
1830 | + if j == 1 then --player1 side (left) | |
1831 | + t[i].infodisplay = motif.option_info.menu_itemname_info_f1 | |
1832 | + else --player2 side (right) | |
1833 | + t[i].infodisplay = motif.option_info.menu_itemname_info_f2 | |
1834 | + end | |
1835 | + end | |
1836 | + if i == item and j == player then --active item | |
1837 | + --draw displayname | |
1838 | + textImgDraw(main.f_updateTextImg( | |
1839 | + t[i].data, | |
1840 | + motif.font_data[motif.option_info.menu_item_active_font[1]], | |
1841 | + motif.option_info.menu_item_active_font[2], | |
1842 | + motif.option_info.menu_item_active_font[3], | |
1843 | + t[i].displayname, | |
1844 | + t_pos[j][1], | |
1845 | + t_pos[j][2] + (i - 1) * motif.option_info.menu_key_item_spacing[2] - moveTxt, | |
1846 | + motif.option_info.menu_item_active_font_scale[1], | |
1847 | + motif.option_info.menu_item_active_font_scale[2], | |
1848 | + motif.option_info.menu_item_active_font[4], | |
1849 | + motif.option_info.menu_item_active_font[5], | |
1850 | + motif.option_info.menu_item_active_font[6], | |
1851 | + motif.option_info.menu_item_active_font[7], | |
1852 | + motif.option_info.menu_item_active_font[8] | |
1853 | + )) | |
1854 | + --draw vardata | |
1855 | + if t[i].vardata ~= nil then | |
1856 | + if t_keyList[joyNum][tostring(t[i]['vardisplay' .. j])] ~= nil and t_keyList[joyNum][tostring(t[i]['vardisplay' .. j])] > 1 then | |
1857 | + textImgDraw(main.f_updateTextImg( | |
1858 | + t[i].vardata, | |
1859 | + motif.font_data[motif.option_info.menu_item_value_conflict_font[1]], | |
1860 | + motif.option_info.menu_item_value_conflict_font[2], | |
1861 | + motif.option_info.menu_item_value_conflict_font[3], | |
1862 | + t[i]['vardisplay' .. j], | |
1863 | + t_pos[j][1] + motif.option_info.menu_key_item_spacing[1], | |
1864 | + t_pos[j][2] + (i - 1) * motif.option_info.menu_key_item_spacing[2] - moveTxt, | |
1865 | + motif.option_info.menu_item_value_conflict_font_scale[1], | |
1866 | + motif.option_info.menu_item_value_conflict_font_scale[2], | |
1867 | + motif.option_info.menu_item_value_conflict_font[4], | |
1868 | + motif.option_info.menu_item_value_conflict_font[5], | |
1869 | + motif.option_info.menu_item_value_conflict_font[6], | |
1870 | + motif.option_info.menu_item_value_conflict_font[7], | |
1871 | + motif.option_info.menu_item_value_conflict_font[8] | |
1872 | + )) | |
1873 | + t_conflict[joyNum] = true | |
1874 | + else | |
1875 | + textImgDraw(main.f_updateTextImg( | |
1876 | + t[i].vardata, | |
1877 | + motif.font_data[motif.option_info.menu_item_value_active_font[1]], | |
1878 | + motif.option_info.menu_item_value_active_font[2], | |
1879 | + motif.option_info.menu_item_value_active_font[3], | |
1880 | + t[i]['vardisplay' .. j], | |
1881 | + t_pos[j][1] + motif.option_info.menu_key_item_spacing[1], | |
1882 | + t_pos[j][2] + (i - 1) * motif.option_info.menu_key_item_spacing[2] - moveTxt, | |
1883 | + motif.option_info.menu_item_value_active_font_scale[1], | |
1884 | + motif.option_info.menu_item_value_active_font_scale[2], | |
1885 | + motif.option_info.menu_item_value_active_font[4], | |
1886 | + motif.option_info.menu_item_value_active_font[5], | |
1887 | + motif.option_info.menu_item_value_active_font[6], | |
1888 | + motif.option_info.menu_item_value_active_font[7], | |
1889 | + motif.option_info.menu_item_value_active_font[8] | |
1890 | + )) | |
1891 | + end | |
1892 | + --draw infodata | |
1893 | + elseif t[i].infodata ~= nil then | |
1894 | + textImgDraw(main.f_updateTextImg( | |
1895 | + t[i].infodata, | |
1896 | + motif.font_data[motif.option_info.menu_item_info_active_font[1]], | |
1897 | + motif.option_info.menu_item_info_active_font[2], | |
1898 | + motif.option_info.menu_item_info_active_font[3], | |
1899 | + t[i].infodisplay, | |
1900 | + t_pos[j][1] + motif.option_info.menu_key_item_spacing[1], | |
1901 | + t_pos[j][2] + (i - 1) * motif.option_info.menu_key_item_spacing[2] - moveTxt, | |
1902 | + motif.option_info.menu_item_value_active_font_scale[1], | |
1903 | + motif.option_info.menu_item_value_active_font_scale[2], | |
1904 | + motif.option_info.menu_item_info_active_font[4], | |
1905 | + motif.option_info.menu_item_info_active_font[5], | |
1906 | + motif.option_info.menu_item_info_active_font[6], | |
1907 | + motif.option_info.menu_item_info_active_font[7], | |
1908 | + motif.option_info.menu_item_info_active_font[8] | |
1909 | + )) | |
1910 | + end | |
1911 | + else --inactive item | |
1912 | + --draw displayname | |
1913 | + textImgDraw(main.f_updateTextImg( | |
1914 | + t[i].data, | |
1915 | + motif.font_data[motif.option_info.menu_item_font[1]], | |
1916 | + motif.option_info.menu_item_font[2], | |
1917 | + motif.option_info.menu_item_font[3], | |
1918 | + t[i].displayname, | |
1919 | + t_pos[j][1], | |
1920 | + t_pos[j][2] + (i - 1) * motif.option_info.menu_key_item_spacing[2] - moveTxt, | |
1921 | + motif.option_info.menu_item_font_scale[1], | |
1922 | + motif.option_info.menu_item_font_scale[2], | |
1923 | + motif.option_info.menu_item_font[4], | |
1924 | + motif.option_info.menu_item_font[5], | |
1925 | + motif.option_info.menu_item_font[6], | |
1926 | + motif.option_info.menu_item_font[7], | |
1927 | + motif.option_info.menu_item_font[8] | |
1928 | + )) | |
1929 | + --draw vardata | |
1930 | + if t[i].vardata ~= nil then | |
1931 | + if t_keyList[joyNum][tostring(t[i]['vardisplay' .. j])] ~= nil and t_keyList[joyNum][tostring(t[i]['vardisplay' .. j])] > 1 then | |
1932 | + textImgDraw(main.f_updateTextImg( | |
1933 | + t[i].vardata, | |
1934 | + motif.font_data[motif.option_info.menu_item_value_conflict_font[1]], | |
1935 | + motif.option_info.menu_item_value_conflict_font[2], | |
1936 | + motif.option_info.menu_item_value_conflict_font[3], | |
1937 | + t[i]['vardisplay' .. j], | |
1938 | + t_pos[j][1] + motif.option_info.menu_key_item_spacing[1], | |
1939 | + t_pos[j][2] + (i - 1) * motif.option_info.menu_key_item_spacing[2] - moveTxt, | |
1940 | + motif.option_info.menu_item_value_conflict_font_scale[1], | |
1941 | + motif.option_info.menu_item_value_conflict_font_scale[2], | |
1942 | + motif.option_info.menu_item_value_conflict_font[4], | |
1943 | + motif.option_info.menu_item_value_conflict_font[5], | |
1944 | + motif.option_info.menu_item_value_conflict_font[6], | |
1945 | + motif.option_info.menu_item_value_conflict_font[7], | |
1946 | + motif.option_info.menu_item_value_conflict_font[8] | |
1947 | + )) | |
1948 | + t_conflict[joyNum] = true | |
1949 | + else | |
1950 | + textImgDraw(main.f_updateTextImg( | |
1951 | + t[i].vardata, | |
1952 | + motif.font_data[motif.option_info.menu_item_value_font[1]], | |
1953 | + motif.option_info.menu_item_value_font[2], | |
1954 | + motif.option_info.menu_item_value_font[3], | |
1955 | + t[i]['vardisplay' .. j], | |
1956 | + t_pos[j][1] + motif.option_info.menu_key_item_spacing[1], | |
1957 | + t_pos[j][2] + (i - 1) * motif.option_info.menu_key_item_spacing[2] - moveTxt, | |
1958 | + motif.option_info.menu_item_value_font_scale[1], | |
1959 | + motif.option_info.menu_item_value_font_scale[2], | |
1960 | + motif.option_info.menu_item_value_font[4], | |
1961 | + motif.option_info.menu_item_value_font[5], | |
1962 | + motif.option_info.menu_item_value_font[6], | |
1963 | + motif.option_info.menu_item_value_font[7], | |
1964 | + motif.option_info.menu_item_value_font[8] | |
1965 | + )) | |
1966 | + end | |
1967 | + --draw infodata | |
1968 | + elseif t[i].infodata ~= nil then | |
1969 | + textImgDraw(main.f_updateTextImg( | |
1970 | + t[i].infodata, | |
1971 | + motif.font_data[motif.option_info.menu_item_info_font[1]], | |
1972 | + motif.option_info.menu_item_info_font[2], | |
1973 | + motif.option_info.menu_item_info_font[3], | |
1974 | + t[i].infodisplay, | |
1975 | + t_pos[j][1] + motif.option_info.menu_key_item_spacing[1], | |
1976 | + t_pos[j][2] + (i - 1) * motif.option_info.menu_key_item_spacing[2] - moveTxt, | |
1977 | + motif.option_info.menu_item_value_active_font_scale[1], | |
1978 | + motif.option_info.menu_item_value_active_font_scale[2], | |
1979 | + motif.option_info.menu_item_info_font[4], | |
1980 | + motif.option_info.menu_item_info_font[5], | |
1981 | + motif.option_info.menu_item_info_font[6], | |
1982 | + motif.option_info.menu_item_info_font[7], | |
1983 | + motif.option_info.menu_item_info_font[8] | |
1984 | + )) | |
1985 | + end | |
1986 | + end | |
1987 | + end | |
1988 | + end | |
1989 | + end | |
1990 | + --draw menu cursor | |
1991 | + if motif.option_info.menu_boxcursor_visible == 1 then | |
1992 | + local src, dst = main.f_boxcursorAlpha( | |
1993 | + motif.option_info.menu_boxcursor_alpharange[1], | |
1994 | + motif.option_info.menu_boxcursor_alpharange[2], | |
1995 | + motif.option_info.menu_boxcursor_alpharange[3], | |
1996 | + motif.option_info.menu_boxcursor_alpharange[4], | |
1997 | + motif.option_info.menu_boxcursor_alpharange[5], | |
1998 | + motif.option_info.menu_boxcursor_alpharange[6] | |
1999 | + ) | |
2000 | + for i = 1, 2 do | |
2001 | + if i == player then | |
2002 | + fillRect( | |
2003 | + t_pos[i][1] + motif.option_info.menu_key_boxcursor_coords[1], | |
2004 | + t_pos[i][2] + motif.option_info.menu_key_boxcursor_coords[2] + (cursorPosY - 1) * motif.option_info.menu_key_item_spacing[2], | |
2005 | + motif.option_info.menu_key_boxcursor_coords[3] - motif.option_info.menu_key_boxcursor_coords[1] + 1, | |
2006 | + motif.option_info.menu_key_boxcursor_coords[4] - motif.option_info.menu_key_boxcursor_coords[2] + 1 + main.f_oddRounding(motif.option_info.menu_key_boxcursor_coords[2]), | |
2007 | + motif.option_info.menu_boxcursor_col[1], | |
2008 | + motif.option_info.menu_boxcursor_col[2], | |
2009 | + motif.option_info.menu_boxcursor_col[3], | |
2010 | + src, | |
2011 | + dst | |
2012 | + ) | |
2013 | + end | |
1467 | 2014 | end |
1468 | - t[item].vardisplay = options.f_boolDisplay(config.AudioDucking, motif.option_info.menu_itemname_enabled, motif.option_info.menu_itemname_disabled) | |
1469 | - modified = 1 | |
1470 | - needReload = 1 | |
1471 | - --Back | |
1472 | - elseif t[item].itemname == 'back' and main.f_btnPalNo(main.p1Cmd) > 0 then | |
1473 | - sndPlay(motif.files.snd_data, motif.option_info.cancel_snd[1], motif.option_info.cancel_snd[2]) | |
1474 | - textImgSetText(txt_title, motif.option_info.title_text_main) | |
1475 | - break | |
1476 | 2015 | end |
1477 | - options.f_menuCommon2(cursorPosY, moveTxt, item, t) | |
2016 | + --draw layerno = 1 backgrounds | |
2017 | + bgDraw(motif.optionbgdef.bg, true) | |
2018 | + main.f_cmdInput() | |
2019 | + refresh() | |
1478 | 2020 | end |
1479 | 2021 | end |
1480 | 2022 |
@@ -1,6 +1,6 @@ | ||
1 | 1 | -- Used for demo mode and generates AI rank data |
2 | 2 | -- Demo mode uses AutoLevel a GO function that ranks characters based on his number of loses vs wins |
3 | --- AutoLevel is pallete dependent so if a char has a 12th pallete OP mode that mode can have more rank than his normal one | |
3 | +-- AutoLevel is palette dependent so if a char has a 12th palette OP mode that mode can have more rank than his normal one | |
4 | 4 | |
5 | 5 | local randomtest = {} |
6 | 6 |
@@ -236,7 +236,6 @@ function randomtest.init() | ||
236 | 236 | end |
237 | 237 | setAutoLevel(true) |
238 | 238 | setMatchNo(1) |
239 | - selectStage(0) | |
240 | 239 | randomtest.rakuBenry() |
241 | 240 | winner = 0 |
242 | 241 | wins = 0 |
@@ -252,6 +251,7 @@ function randomtest.run() | ||
252 | 251 | while not esc() do |
253 | 252 | randomtest.randSel(1, winner) |
254 | 253 | randomtest.randSel(2, winner) |
254 | + select.f_setStage() | |
255 | 255 | loadStart() |
256 | 256 | local oldwinner = winner |
257 | 257 | winner = game() |
@@ -26,7 +26,16 @@ end | ||
26 | 26 | function main.CalculateLocalcoordValues() |
27 | 27 | -- We load the libar localcoord from the motif file |
28 | 28 | main.SP_Localcoord = main.ParseDefFileValue(config.Motif, "info", "localcoord", true) |
29 | - | |
29 | + local spOriginTemp = main.ParseDefFileValue(config.Motif, "info", "localcoord_origin", true) | |
30 | + local spCenterTemp = main.ParseDefFileValue(config.Motif, "info", "localcoord_center", false) | |
31 | + | |
32 | + -- We check if we got a valid value | |
33 | + if spCenterTemp == nil then | |
34 | + spCenterTemp = "default" | |
35 | + else | |
36 | + spCenterTemp = spCenterTemp:lower() | |
37 | + end | |
38 | + | |
30 | 39 | -- We check if what we got is valid |
31 | 40 | if main.SP_Localcoord == nil then |
32 | 41 | main.SP_Localcoord = {320, 240} |
@@ -46,11 +55,11 @@ function main.CalculateLocalcoordValues() | ||
46 | 55 | tempMFF = nil |
47 | 56 | |
48 | 57 | -- We seach for the file |
49 | - if main.file_exists(motifFileFolder .. lbFileName) then | |
58 | + if main.f_fileExists(motifFileFolder .. lbFileName) then | |
50 | 59 | main.LB_Localcoord = main.ParseDefFileValue(motifFileFolder .. lbFileName, "info", "localcoord", true) |
51 | - elseif main.file_exists("data/" .. lbFileName) then | |
60 | + elseif main.f_fileExists("data/" .. lbFileName) then | |
52 | 61 | main.LB_Localcoord = main.ParseDefFileValue("data/" .. lbFileName, "info", "localcoord", true) |
53 | - elseif main.file_exists(lbFileName) then | |
62 | + elseif main.f_fileExists(lbFileName) then | |
54 | 63 | main.LB_Localcoord = main.ParseDefFileValue(lbFileName, "info", "localcoord", true) |
55 | 64 | else |
56 | 65 | main.LB_Localcoord = main.SP_Localcoord |
@@ -80,8 +89,20 @@ function main.CalculateLocalcoordValues() | ||
80 | 89 | main.LB_ScreenDiference = (main.LB_ScreenWidth - 320) / (main.LB_ScreenWidth / 320) |
81 | 90 | --setLifebarPortaitScale(main.SP_Localcoord[1] / main.SP_Localcoord43[1]) |
82 | 91 | |
83 | - -- TODO: Check if this calculation of 'main.SP_Center' is rigth. | |
84 | - main.SP_Center = main.SP_Localcoord[1] - main.SP_Localcoord43[1] | |
92 | + -- Now we load posible values of main.SP_Center | |
93 | + if spOriginTemp == nil then | |
94 | + if spCenterTemp == "center" then | |
95 | + main.SP_Center = main.SP_Localcoord[1] / 2 | |
96 | + elseif spCenterTemp == "left" then | |
97 | + main.SP_Center = 0 | |
98 | + elseif spCenterTemp == "right" then | |
99 | + main.SP_Center = main.SP_Localcoord[1] | |
100 | + else | |
101 | + main.SP_Center = main.SP_Localcoord[1] - main.SP_Localcoord43[1] | |
102 | + end | |
103 | + else | |
104 | + main.SP_Center = spOriginTemp | |
105 | + end | |
85 | 106 | end |
86 | 107 | |
87 | 108 | function main.IntLifebarScale() |
@@ -142,7 +163,7 @@ function main.ParseDefFileValue(argFile, searchBlock, searchParam, isNumber) | ||
142 | 163 | param = param:gsub('[%. ]', '_') -- change param . and space to _ |
143 | 164 | param = param:lower() -- lowercase param |
144 | 165 | end |
145 | - if param ~= nil and value ~= nil and param:match(searchParam) then -- param = value pattern matched | |
166 | + if param ~= nil and value ~= nil and param == searchParam then -- param = value pattern matched | |
146 | 167 | value = value:gsub('"', '') -- remove brackets from value |
147 | 168 | if value:match('.+,.+') then -- multiple values |
148 | 169 | for i, c in ipairs(main.f_strsplit(',', value)) do -- split value using "," delimiter |
@@ -8,13 +8,7 @@ setSelColRow(motif.select_info.columns, motif.select_info.rows) | ||
8 | 8 | --setRandomSpr(motif.selectbgdef.spr_data, motif.select_info.cell_random_spr[1], motif.select_info.cell_random_spr[2], motif.select_info.cell_random_scale[1], motif.select_info.cell_random_scale[2]) |
9 | 9 | --setCellSpr(motif.selectbgdef.spr_data, motif.select_info.cell_bg_spr[1], motif.select_info.cell_bg_spr[2], motif.select_info.cell_bg_scale[1], motif.select_info.cell_bg_scale[2]) |
10 | 10 | |
11 | --- cell.size type check | |
12 | -if type(motif.select_info.cell_spacing) == "table" then | |
13 | - setSelCellSize(motif.select_info.cell_size[1] + motif.select_info.cell_spacing[1], motif.select_info.cell_size[2] + motif.select_info.cell_spacing[2]) | |
14 | -else | |
15 | - setSelCellSize(motif.select_info.cell_size[1] + motif.select_info.cell_spacing, motif.select_info.cell_size[2] + motif.select_info.cell_spacing) | |
16 | -end | |
17 | - | |
11 | +setSelCellSize(motif.select_info.cell_size[1] + motif.select_info.cell_spacing[1], motif.select_info.cell_size[2] + motif.select_info.cell_spacing[2]) | |
18 | 12 | setSelCellScale(motif.select_info.portrait_scale[1], motif.select_info.portrait_scale[2]) |
19 | 13 | |
20 | 14 | --default team count after starting the game |
@@ -43,7 +37,6 @@ local t_p1Selected = {} | ||
43 | 37 | local t_p2Selected = {} |
44 | 38 | local t_roster = {} |
45 | 39 | local t_aiRamp = {} |
46 | -local continue = false | |
47 | 40 | local p1Cell = false |
48 | 41 | local p2Cell = false |
49 | 42 | local p1TeamEnd = false |
@@ -55,6 +48,7 @@ local stageEnd = false | ||
55 | 48 | local coopEnd = false |
56 | 49 | local restoreTeam = false |
57 | 50 | local resetgrid = false |
51 | +local continueStage = false | |
58 | 52 | local teamMode = 0 |
59 | 53 | local numChars = 0 |
60 | 54 | local p1NumChars = 0 |
@@ -79,9 +73,13 @@ local p2FaceY = 0 | ||
79 | 73 | local p1TeamMode = 0 |
80 | 74 | local p2TeamMode = 0 |
81 | 75 | local lastMatch = 0 |
76 | +local currentOrder = 0 | |
77 | +local currentRosterIndex = 0 | |
82 | 78 | local stageNo = 0 |
83 | 79 | local stageList = 0 |
84 | - | |
80 | +local fadeType = 'fadein' | |
81 | +local continue = false | |
82 | +local challenger = false | |
85 | 83 | local cnt = motif.select_info.columns + 1 |
86 | 84 | local row = 1 |
87 | 85 | local col = 0 |
@@ -94,14 +92,7 @@ for i = 1, (motif.select_info.rows + motif.select_info.rows_scrolling) * motif.s | ||
94 | 92 | t_grid[row] = {} |
95 | 93 | end |
96 | 94 | col = #t_grid[row] + 1 |
97 | - | |
98 | - -- cell.spacing type check | |
99 | - if type(motif.select_info.cell_spacing) == "table" then | |
100 | - t_grid[row][col] = {num = i - 1, x = (col - 1) * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing[1]), y = (row - 1) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing[2])} | |
101 | - else | |
102 | - t_grid[row][col] = {num = i - 1, x = (col - 1) * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing), y = (row - 1) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing)} | |
103 | - end | |
104 | - | |
95 | + t_grid[row][col] = {num = i - 1, x = (col - 1) * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing[1]), y = (row - 1) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing[2])} | |
105 | 96 | if main.t_selChars[i].char ~= nil then |
106 | 97 | t_grid[row][col].char = main.t_selChars[i].char |
107 | 98 | t_grid[row][col].hidden = main.t_selChars[i].hidden |
@@ -113,76 +104,81 @@ end | ||
113 | 104 | --;=========================================================== |
114 | 105 | --; COMMON FUNCTIONS |
115 | 106 | --;=========================================================== |
116 | -function select.f_setZoom() | |
117 | - local zoom = config.ZoomActive | |
118 | - if main.t_selChars[t_p2Selected[1].cel + 1].zoom ~= nil then | |
119 | - if main.t_selChars[t_p2Selected[1].cel + 1].zoom == 1 then | |
120 | - zoom = true | |
121 | - else | |
122 | - zoom = false | |
123 | - end | |
124 | - elseif main.t_selStages[stageNo] ~= nil and main.t_selStages[stageNo].zoom ~= nil then | |
125 | - if main.t_selChars[stageNo].zoom == 1 then | |
126 | - zoom = true | |
127 | - else | |
128 | - zoom = false | |
129 | - end | |
130 | - end | |
131 | - setZoom(zoom) | |
132 | - local zoomMin = config.ZoomMin | |
133 | - if main.t_selStages[stageNo].zoommin ~= nil then | |
134 | - zoomMin = main.t_selStages[stageNo].zoommin | |
135 | - end | |
136 | - setZoomMin(zoomMin) | |
137 | - local zoomMax = config.ZoomMax | |
138 | - if main.t_selStages[stageNo].zoommax ~= nil then | |
139 | - zoomMax = main.t_selStages[stageNo].zoommax | |
140 | - end | |
141 | - setZoomMax(zoomMax) | |
142 | - local zoomSpeed = config.ZoomSpeed | |
143 | - if main.t_selStages[stageNo].zoomspeed ~= nil then | |
144 | - zoomSpeed = main.t_selStages[stageNo].zoomspeed | |
145 | - end | |
146 | - setZoomSpeed(zoomSpeed) | |
147 | -end | |
148 | - | |
149 | 107 | function select.f_makeRoster() |
150 | 108 | t_roster = {} |
151 | 109 | local t = {} |
152 | 110 | local cnt = 0 |
111 | + local orderCnt = 0 | |
153 | 112 | --Arcade |
154 | - if main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' then | |
155 | - if p2TeamMode == 0 then --Single | |
113 | + if gameMode('arcade') or gameMode('teamcoop') or gameMode('netplayteamcoop') then | |
114 | + if main.t_selChars[t_p1Selected[1].cel + 1].maxmatches ~= nil then | |
115 | + if p2TeamMode == 0 then --Single | |
116 | + t = main.t_selOptions[main.t_selChars[t_p1Selected[1].cel + 1].maxmatches .. "_arcademaxmatches"] | |
117 | + else --Team | |
118 | + t = main.t_selOptions[main.t_selChars[t_p1Selected[1].cel + 1].maxmatches .. "_teammaxmatches"] | |
119 | + end | |
120 | + elseif p2TeamMode == 0 then | |
156 | 121 | t = main.t_selOptions.arcademaxmatches |
157 | - else --Team | |
122 | + else | |
158 | 123 | t = main.t_selOptions.teammaxmatches |
159 | 124 | end |
160 | 125 | for i = 1, #t do --for each order number |
126 | + table.insert(t_roster, {}) | |
161 | 127 | cnt = t[i] * p2NumChars --set amount of matches to get from the table |
162 | - if cnt > 0 and main.t_orderChars[i] ~= nil then --if it's more than 0 and there are characters with such order | |
163 | - while cnt > 0 do --do the following until amount of matches for particular order is reached | |
128 | + if cnt > 0 and main.t_orderChars[i] ~= nil then --if matches > 0 and there are characters with such order | |
129 | + if t[i] > #main.t_orderChars[i] then --if there is not enough chars with particular order reduce amount of matches | |
130 | + orderCnt = #main.t_orderChars[i] * p2NumChars | |
131 | + else | |
132 | + orderCnt = cnt | |
133 | + end | |
134 | + while orderCnt > 0 do --do the following until amount of matches for particular order is reached | |
164 | 135 | main.f_shuffleTable(main.t_orderChars[i]) --randomize characters table |
165 | - for j = 1, #main.t_orderChars[i] do --loop through chars associated with that particular order | |
166 | - t_roster[#t_roster + 1] = main.t_orderChars[i][j] --and add such character into new table | |
167 | - cnt = cnt - 1 | |
168 | - if cnt == 0 then --but only if amount of matches for particular order has not been reached yet | |
136 | + for j = 1, #main.t_orderChars[i] do --loop through chars associated with this particular order | |
137 | + table.insert(t_roster[i], main.t_orderChars[i][j]) --and add such character into new table | |
138 | + orderCnt = orderCnt - 1 | |
139 | + if orderCnt == 0 then --but only if amount of matches for particular order has not been reached yet | |
169 | 140 | break |
170 | 141 | end |
171 | 142 | end |
172 | 143 | end |
173 | 144 | end |
174 | 145 | end |
175 | - --Survival / Boss Rush / VS 100 Kumite | |
176 | - else | |
177 | - if main.gameMode == 'survival' or main.gameMode == 'survivalcoop' or main.gameMode == 'netplaysurvivalcoop' then | |
178 | - t = main.t_randomChars | |
179 | - cnt = #t | |
180 | - local i = 0 | |
181 | - while cnt / p2NumChars ~= math.ceil(cnt / p2NumChars) do --not integer | |
182 | - i = i + 1 | |
183 | - cnt = #t + i | |
146 | + --Survival | |
147 | + elseif gameMode('survival') or gameMode('survivalcoop') or gameMode('netplaysurvivalcoop') then | |
148 | + t = main.t_selOptions.survivalmaxmatches | |
149 | + for i = 1, #t do --for each order number | |
150 | + table.insert(t_roster, {}) | |
151 | + --set amount of matches to get from the table | |
152 | + if t[i] == -1 and main.t_orderSurvival[i] ~= nil then --infinite matches | |
153 | + cnt = #main.t_orderSurvival[i] * p2NumChars --get value equal all characters with this order | |
154 | + else --finite matches | |
155 | + cnt = t[i] * p2NumChars --amount of matches as specified in survival.maxmatches column | |
156 | + end | |
157 | + if cnt > 0 and main.t_orderSurvival[i] ~= nil then --if matches > 0 and there are characters with such order | |
158 | + if t[i] > #main.t_orderSurvival[i] or t[i] < 0 then --if there is not enough chars with particular order reduce amount of matches | |
159 | + orderCnt = #main.t_orderSurvival[i] * p2NumChars | |
160 | + else | |
161 | + orderCnt = cnt | |
162 | + end | |
163 | + while orderCnt > 0 do --do the following until amount of matches for particular order is reached | |
164 | + main.f_shuffleTable(main.t_orderSurvival[i]) --randomize characters table | |
165 | + for j = 1, #main.t_orderSurvival[i] do --loop through chars associated with this particular order | |
166 | + table.insert(t_roster[i], main.t_orderSurvival[i][j]) --and add such character into new table | |
167 | + orderCnt = orderCnt - 1 | |
168 | + if orderCnt == 0 then --but only if amount of matches for particular order has not been reached yet | |
169 | + break | |
170 | + end | |
171 | + end | |
172 | + end | |
173 | + if t[i] == -1 then --infinity matches against characters with order i, skip the rest | |
174 | + break | |
175 | + end | |
184 | 176 | end |
185 | - elseif main.gameMode == 'bossrush' then | |
177 | + end | |
178 | + --Boss Rush / VS 100 Kumite | |
179 | + else | |
180 | + table.insert(t_roster, {}) | |
181 | + if gameMode('bossrush') then | |
186 | 182 | t = main.t_bossChars |
187 | 183 | cnt = #t |
188 | 184 | local i = 0 |
@@ -190,14 +186,14 @@ function select.f_makeRoster() | ||
190 | 186 | i = i + 1 |
191 | 187 | cnt = #t + i |
192 | 188 | end |
193 | - elseif main.gameMode == '100kumite' then | |
189 | + elseif gameMode('100kumite') then | |
194 | 190 | t = main.t_randomChars |
195 | 191 | cnt = 100 * p2NumChars |
196 | 192 | end |
197 | 193 | while cnt > 0 do |
198 | 194 | main.f_shuffleTable(t) |
199 | 195 | for i = 1, #t do |
200 | - t_roster[#t_roster + 1] = t[i] | |
196 | + table.insert(t_roster[1], t[i]) | |
201 | 197 | cnt = cnt - 1 |
202 | 198 | if cnt == 0 then |
203 | 199 | break |
@@ -208,14 +204,16 @@ function select.f_makeRoster() | ||
208 | 204 | main.f_printTable(t_roster, 'debug/t_roster.txt') |
209 | 205 | end |
210 | 206 | |
211 | -function select.f_aiRamp() | |
207 | +function select.f_aiRamp(currentMatch) | |
212 | 208 | local start_match = 0 |
213 | 209 | local start_diff = 0 |
214 | 210 | local end_match = 0 |
215 | 211 | local end_diff = 0 |
216 | - t_aiRamp = {} | |
212 | + if currentMatch == 1 then | |
213 | + t_aiRamp = {} | |
214 | + end | |
217 | 215 | --Arcade |
218 | - if main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' then | |
216 | + if gameMode('arcade') or gameMode('teamcoop') or gameMode('netplayteamcoop') then | |
219 | 217 | if p2TeamMode == 0 then --Single |
220 | 218 | start_match = main.t_selOptions.arcadestart.wins |
221 | 219 | start_diff = main.t_selOptions.arcadestart.offset |
@@ -227,7 +225,7 @@ function select.f_aiRamp() | ||
227 | 225 | end_match = main.t_selOptions.teamend.wins |
228 | 226 | end_diff = main.t_selOptions.teamend.offset |
229 | 227 | end |
230 | - elseif main.gameMode == 'survival' or main.gameMode == 'survivalcoop' or main.gameMode == 'netplaysurvivalcoop' then | |
228 | + elseif gameMode('survival') or gameMode('survivalcoop') or gameMode('netplaysurvivalcoop') then | |
231 | 229 | start_match = main.t_selOptions.survivalstart.wins |
232 | 230 | start_diff = main.t_selOptions.survivalstart.offset |
233 | 231 | end_match = main.t_selOptions.survivalend.wins |
@@ -245,27 +243,42 @@ function select.f_aiRamp() | ||
245 | 243 | elseif endAI < 1 then |
246 | 244 | endAI = 1 |
247 | 245 | end |
248 | - for i = 1, lastMatch do | |
246 | + for i = currentMatch, lastMatch do | |
249 | 247 | if i - 1 <= start_match then |
250 | - t_aiRamp[#t_aiRamp + 1] = startAI | |
248 | + table.insert(t_aiRamp, startAI) | |
251 | 249 | elseif i - 1 <= end_match then |
252 | 250 | local curMatch = i - (start_match + 1) |
253 | - t_aiRamp[#t_aiRamp + 1] = math.floor(curMatch * (endAI - startAI) / (end_match - start_match) + startAI) | |
251 | + table.insert(t_aiRamp, math.floor(curMatch * (endAI - startAI) / (end_match - start_match) + startAI)) | |
254 | 252 | else |
255 | - t_aiRamp[#t_aiRamp + 1] = endAI | |
253 | + table.insert(t_aiRamp, endAI) | |
256 | 254 | end |
257 | 255 | end |
258 | 256 | main.f_printTable(t_aiRamp, 'debug/t_aiRamp.txt') |
259 | 257 | end |
260 | 258 | |
259 | +function select.f_rivalsMatch(param) | |
260 | + if main.t_selChars[t_p1Selected[1].cel + 1].rivals ~= nil and main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo] ~= nil then | |
261 | + if param == nil then | |
262 | + return true | |
263 | + else | |
264 | + return main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo][param] ~= nil | |
265 | + end | |
266 | + end | |
267 | + return false | |
268 | +end | |
269 | + | |
261 | 270 | function select.f_difficulty(player, offset) |
262 | 271 | local t = {} |
263 | - if player % 2 ~= 0 then --odd value | |
272 | + if player % 2 ~= 0 then --odd value (Player1 side) | |
264 | 273 | local pos = math.floor(player / 2 + 0.5) |
265 | 274 | t = main.t_selChars[t_p1Selected[pos].cel + 1] |
266 | - else --even value | |
275 | + else --even value (Player2 side) | |
267 | 276 | local pos = math.floor(player / 2) |
268 | - t = main.t_selChars[t_p2Selected[pos].cel + 1] | |
277 | + if pos == 1 and select.f_rivalsMatch('ai') then --player2 team leader and arcade mode and ai rivals param exists | |
278 | + t = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo] | |
279 | + else | |
280 | + t = main.t_selChars[t_p2Selected[pos].cel + 1] | |
281 | + end | |
269 | 282 | end |
270 | 283 | if t.ai ~= nil then |
271 | 284 | return t.ai |
@@ -274,14 +287,15 @@ function select.f_difficulty(player, offset) | ||
274 | 287 | end |
275 | 288 | end |
276 | 289 | |
277 | -function select.f_aiLevel() | |
290 | +function select.f_remapAI() | |
278 | 291 | --Offset |
279 | 292 | local offset = 0 |
280 | - if config.AIRamping and main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' or main.gameMode == 'survival' or main.gameMode == 'survivalcoop' or main.gameMode == 'netplaysurvivalcoop' then | |
293 | + if config.AIRamping and (gameMode('arcade') or gameMode('teamcoop') or gameMode('netplayteamcoop') or gameMode('survival') or gameMode('survivalcoop') or gameMode('netplaysurvivalcoop')) then | |
281 | 294 | offset = t_aiRamp[matchNo] - config.Difficulty |
282 | 295 | end |
283 | 296 | --Player 1 |
284 | 297 | if main.coop then |
298 | + remapInput(3, 2) --P3 character uses P2 controls | |
285 | 299 | setCom(1, 0) |
286 | 300 | setCom(3, 0) |
287 | 301 | elseif p1TeamMode == 0 then --Single |
@@ -298,34 +312,26 @@ function select.f_aiLevel() | ||
298 | 312 | end |
299 | 313 | for i = 3, p1NumChars * 2 do |
300 | 314 | if i % 2 ~= 0 then --odd value |
315 | + remapInput(i, 1) --P3/5/7 character uses P1 controls | |
301 | 316 | setCom(i, select.f_difficulty(i, offset)) |
302 | 317 | end |
303 | 318 | end |
304 | - -- Legcy TAG | |
305 | - elseif p1TeamMode == 1 and config.SimulMode == false then | |
306 | - for i = 1, p1NumChars * 2 do | |
307 | - if i % 2 ~= 0 then --odd value | |
308 | - if main.p1In == 1 and not main.aiFight then | |
309 | - setCom(i, 0) | |
310 | - else | |
311 | - setCom(i, select.f_difficulty(i, offset)) | |
312 | - end | |
313 | - end | |
314 | - end | |
315 | 319 | elseif p1TeamMode == 2 then --Turns |
316 | 320 | for i = 1, p1NumChars * 2 do |
317 | - if i % 2 ~= 0 then | |
321 | + if i % 2 ~= 0 then --odd value | |
318 | 322 | if main.p1In == 1 and not main.aiFight then |
323 | + remapInput(i, 1) --P1/3/5/7 character uses P1 controls | |
319 | 324 | setCom(i, 0) |
320 | 325 | else |
321 | 326 | setCom(i, select.f_difficulty(i, offset)) |
322 | 327 | end |
323 | 328 | end |
324 | 329 | end |
325 | - else --Tag | |
330 | + else --p1TeamMode == 3 or (p1TeamMode == 1 and not config.SimulMode) --Tag | |
326 | 331 | for i = 1, p1NumChars * 2 do |
327 | 332 | if i % 2 ~= 0 then --odd value |
328 | 333 | if main.p1In == 1 and not main.aiFight then |
334 | + remapInput(i, 1) --P1/3/5/7 character uses P1 controls | |
329 | 335 | setCom(i, 0) |
330 | 336 | else |
331 | 337 | setCom(i, select.f_difficulty(i, offset)) |
@@ -348,34 +354,26 @@ function select.f_aiLevel() | ||
348 | 354 | end |
349 | 355 | for i = 4, p2NumChars * 2 do |
350 | 356 | if i % 2 == 0 then --even value |
357 | + remapInput(i, 2) --P4/6/8 character uses P2 controls | |
351 | 358 | setCom(i, select.f_difficulty(i, offset)) |
352 | 359 | end |
353 | 360 | end |
354 | - -- Legcy TAG | |
355 | - elseif p2TeamMode == 1 and config.SimulMode == false then --Tag | |
356 | - for i = 2, p2NumChars * 2 do | |
357 | - if i % 2 == 0 then --even value | |
358 | - if main.p2In == 2 and not main.aiFight and not main.coop then | |
359 | - setCom(i, 0) | |
360 | - else | |
361 | - setCom(i, select.f_difficulty(i, offset)) | |
362 | - end | |
363 | - end | |
364 | - end | |
365 | 361 | elseif p2TeamMode == 2 then --Turns |
366 | 362 | for i = 2, p2NumChars * 2 do |
367 | - if i % 2 == 0 then | |
363 | + if i % 2 == 0 then --even value | |
368 | 364 | if main.p2In == 2 and not main.aiFight and not main.coop then |
365 | + remapInput(i, 2) --P2/4/6/8 character uses P2 controls | |
369 | 366 | setCom(i, 0) |
370 | 367 | else |
371 | 368 | setCom(i, select.f_difficulty(i, offset)) |
372 | 369 | end |
373 | 370 | end |
374 | 371 | end |
375 | - else --Tag | |
372 | + else --p2TeamMode == 3 or (p2TeamMode == 1 and not config.SimulMode) --Tag | |
376 | 373 | for i = 2, p2NumChars * 2 do |
377 | 374 | if i % 2 == 0 then --even value |
378 | 375 | if main.p2In == 2 and not main.aiFight and not main.coop then |
376 | + remapInput(i, 2) --P2/4/6/8 character uses P2 controls | |
379 | 377 | setCom(i, 0) |
380 | 378 | else |
381 | 379 | setCom(i, select.f_difficulty(i, offset)) |
@@ -385,75 +383,277 @@ function select.f_aiLevel() | ||
385 | 383 | end |
386 | 384 | end |
387 | 385 | |
388 | -function select.f_assignMusic() | |
389 | - local track = '' | |
390 | - local trackVolume = 100 | |
391 | - local tracloopstart,tracloopend = nil | |
392 | - if main.stageMenu then | |
393 | - if main.t_selStages[stageNo].music ~= nil then | |
394 | - track = math.random(1, #main.t_selStages[stageNo].music) | |
395 | - trackVolume = main.t_selStages[stageNo].music[track].bgmvolume | |
396 | - trackloopstart = main.t_selStages[stageNo].music[track].bgmloopstart | |
397 | - trackloopend = main.t_selStages[stageNo].music[track].bgmloopend | |
398 | - track = main.t_selStages[stageNo].music[track].bgmusic | |
399 | - end | |
386 | +local lifebar = motif.files.fight | |
387 | +function select.f_setRounds() | |
388 | + --lifebar | |
389 | + if main.t_charparam.lifebar and main.t_charparam.rivals and select.f_rivalsMatch('lifebar') then --lifebar assigned as rivals param | |
390 | + lifebar = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].lifebar:gsub('\\', '/') | |
391 | + elseif main.t_charparam.lifebar and main.t_selChars[t_p2Selected[1].cel + 1].lifebar ~= nil then --lifebar assigned as character param | |
392 | + lifebar = main.t_selChars[t_p2Selected[1].cel + 1].lifebar:gsub('\\', '/') | |
393 | + else --default lifebar | |
394 | + lifebar = motif.files.fight | |
395 | + end | |
396 | + if lifebar:lower() ~= main.currentLifebar:lower() then | |
397 | + main.currentLifebar = lifebar | |
398 | + loadLifebar(lifebar) | |
399 | + end | |
400 | + --round time | |
401 | + if gameMode('training') then | |
402 | + setRoundTime(-1) | |
403 | + elseif main.t_charparam.time and main.t_charparam.rivals and select.f_rivalsMatch('time') then --round time assigned as rivals param | |
404 | + setRoundTime(math.max(-1, main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].time * getFramesPerCount())) | |
405 | + elseif main.t_charparam.time and main.t_selChars[t_p2Selected[1].cel + 1].time ~= nil then --round time assigned as character param | |
406 | + setRoundTime(math.max(-1, main.t_selChars[t_p2Selected[1].cel + 1].time * getFramesPerCount())) | |
407 | + else --default round time | |
408 | + setRoundTime(math.max(-1, config.RoundTime * getFramesPerCount())) | |
409 | + end | |
410 | + --rounds to win | |
411 | + if gameMode('survival') or gameMode('survivalcoop') or gameMode('netplaysurvivalcoop') or gameMode('100kumite') then --always 1 round to win in these modes | |
412 | + setMatchWins(1) | |
413 | + setMatchMaxDrawGames(0) | |
400 | 414 | else |
401 | - if main.t_selChars[t_p2Selected[1].cel + 1].music ~= nil then | |
402 | - track = math.random(1, #main.t_selChars[t_p2Selected[1].cel + 1].music) | |
403 | - trackVolume = main.t_selChars[t_p2Selected[1].cel + 1].music[track].bgmvolume | |
404 | - trackloopstart = main.t_selChars[t_p2Selected[1].cel + 1].music[track].bgmloopstart | |
405 | - trackloopend = main.t_selChars[t_p2Selected[1].cel + 1].music[track].bgmloopend | |
406 | - track = main.t_selChars[t_p2Selected[1].cel + 1].music[track].bgmusic | |
407 | - elseif main.t_selStages[stageNo].music ~= nil then | |
408 | - track = math.random(1, #main.t_selStages[stageNo].music) | |
409 | - trackVolume = main.t_selStages[stageNo].music[track].bgmvolume | |
410 | - trackloopstart = main.t_selStages[stageNo].music[track].bgmloopstart | |
411 | - trackloopend = main.t_selStages[stageNo].music[track].bgmloopend | |
412 | - track = main.t_selStages[stageNo].music[track].bgmusic | |
415 | + if main.t_charparam.rounds and main.t_charparam.rivals and select.f_rivalsMatch('rounds') then --round num assigned as rivals param | |
416 | + setMatchWins(main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].rounds) | |
417 | + elseif main.t_charparam.rounds and main.t_selChars[t_p2Selected[1].cel + 1].rounds ~= nil then --round num assigned as character param | |
418 | + setMatchWins(main.t_selChars[t_p2Selected[1].cel + 1].rounds) | |
419 | + elseif p2TeamMode == 0 then --default rounds num (Single mode) | |
420 | + setMatchWins(options.roundsNumSingle) | |
421 | + else --default rounds num (Team mode) | |
422 | + setMatchWins(options.roundsNumTeam) | |
413 | 423 | end |
414 | - stageEnd = true | |
424 | + setMatchMaxDrawGames(options.maxDrawGames) | |
415 | 425 | end |
416 | - playBGM(track, true, 1, trackVolume, trackloopstart or "0", trackloopend or "0") | |
417 | 426 | end |
418 | 427 | |
419 | -function select.f_selectStage() | |
420 | - if t_p2Selected[1].stageno ~= nil then | |
421 | - stageNo = t_p2Selected[1].stageno | |
422 | - elseif main.t_selChars[t_p2Selected[1].cel + 1].stage ~= nil then | |
423 | - stageNo = math.random(1, #main.t_selChars[t_p2Selected[1].cel + 1].stage) | |
424 | - stageNo = main.t_selChars[t_p2Selected[1].cel + 1].stage[stageNo] | |
425 | - else | |
426 | - stageNo = main.t_includeStage[math.random(1, #main.t_includeStage)] | |
428 | +function select.f_setStage(num) | |
429 | + num = num or 0 | |
430 | + --stage | |
431 | + if not main.stageMenu and not continueStage then | |
432 | + if main.t_charparam.stage and main.t_charparam.rivals and select.f_rivalsMatch('stage') then --stage assigned as rivals param | |
433 | + num = math.random(1, #main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].stage) | |
434 | + num = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].stage[num] | |
435 | + elseif main.t_charparam.stage and main.t_selChars[t_p2Selected[1].cel + 1].stage ~= nil then --stage assigned as character param | |
436 | + num = math.random(1, #main.t_selChars[t_p2Selected[1].cel + 1].stage) | |
437 | + num = main.t_selChars[t_p2Selected[1].cel + 1].stage[num] | |
438 | + elseif (gameMode('arcade') or gameMode('teamcoop') or gameMode('netplayteamcoop')) and main.t_orderStages[main.t_selChars[t_p2Selected[1].cel + 1].order] ~= nil then --stage assigned as stage order param | |
439 | + num = math.random(1, #main.t_orderStages[main.t_selChars[t_p2Selected[1].cel + 1].order]) | |
440 | + num = main.t_orderStages[main.t_selChars[t_p2Selected[1].cel + 1].order][num] | |
441 | + else --stage randomly selected | |
442 | + num = main.t_includeStage[1][math.random(1, #main.t_includeStage[1])] | |
443 | + end | |
444 | + end | |
445 | + setStage(num) | |
446 | + selectStage(num) | |
447 | + --zoom | |
448 | + local zoom = config.ZoomActive | |
449 | + local zoomMin = config.ZoomMin | |
450 | + local zoomMax = config.ZoomMax | |
451 | + local zoomSpeed = config.ZoomSpeed | |
452 | + if main.t_charparam.zoom and main.t_charparam.rivals and select.f_rivalsMatch('zoom') then --zoom assigned as rivals param | |
453 | + if main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].zoom == 1 then | |
454 | + zoom = true | |
455 | + else | |
456 | + zoom = false | |
457 | + end | |
458 | + elseif main.t_charparam.zoom and main.t_selChars[t_p2Selected[1].cel + 1].zoom ~= nil then --zoom assigned as character param | |
459 | + if main.t_selChars[t_p2Selected[1].cel + 1].zoom == 1 then | |
460 | + zoom = true | |
461 | + else | |
462 | + zoom = false | |
463 | + end | |
464 | + elseif main.t_selStages[num] ~= nil and main.t_selStages[num].zoom ~= nil then --zoom assigned as stage param | |
465 | + if main.t_selStages[num].zoom == 1 then | |
466 | + zoom = true | |
467 | + else | |
468 | + zoom = false | |
469 | + end | |
470 | + end | |
471 | + if main.t_selStages[num] ~= nil then | |
472 | + if main.t_selStages[num].zoommin ~= nil then | |
473 | + zoomMin = main.t_selStages[num].zoommin | |
474 | + end | |
475 | + if main.t_selStages[num].zoommax ~= nil then | |
476 | + zoomMax = main.t_selStages[num].zoommax | |
477 | + end | |
478 | + if main.t_selStages[num].zoomspeed ~= nil then | |
479 | + zoomSpeed = main.t_selStages[num].zoomspeed | |
480 | + end | |
427 | 481 | end |
428 | - if stageNo == 0 then | |
429 | - stageNo = main.t_includeStage[math.random(1, #main.t_includeStage)] | |
482 | + setZoom(zoom) | |
483 | + setZoomMin(zoomMin) | |
484 | + setZoomMax(zoomMax) | |
485 | + setZoomSpeed(zoomSpeed) | |
486 | + --music | |
487 | + local t = {'music', 'musicalt', 'musiclife'} | |
488 | + for i = 1, #t do | |
489 | + local track = 0 | |
490 | + local music = '' | |
491 | + local volume = 100 | |
492 | + local loopstart = 0 | |
493 | + local loopend = 0 | |
494 | + if main.stageMenu then --game modes with stage selection screen | |
495 | + if main.t_selStages[num] ~= nil and main.t_selStages[num][t[i]] ~= nil then --music assigned as stage param | |
496 | + track = math.random(1, #main.t_selStages[num][t[i]]) | |
497 | + music = main.t_selStages[num][t[i]][track].bgmusic | |
498 | + volume = main.t_selStages[num][t[i]][track].bgmvolume | |
499 | + loopstart = main.t_selStages[num][t[i]][track].bgmloopstart | |
500 | + loopend = main.t_selStages[num][t[i]][track].bgmloopend | |
501 | + end | |
502 | + elseif not gameMode('demo') or motif.demo_mode.fight_playbgm == 1 then --game modes other than demo (or demo with stage BGM param enabled) | |
503 | + if main.t_charparam.music and main.t_charparam.rivals and select.f_rivalsMatch(t[i]) then --music assigned as rivals param | |
504 | + track = math.random(1, #main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo][t[i]]) | |
505 | + music = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo][t[i]][track].bgmusic | |
506 | + volume = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo][t[i]][track].bgmvolume | |
507 | + loopstart = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo][t[i]][track].bgmloopstart | |
508 | + loopend = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo][t[i]][track].bgmloopend | |
509 | + elseif main.t_charparam.music and main.t_selChars[t_p2Selected[1].cel + 1][t[i]] ~= nil then --music assigned as character param | |
510 | + track = math.random(1, #main.t_selChars[t_p2Selected[1].cel + 1][t[i]]) | |
511 | + music = main.t_selChars[t_p2Selected[1].cel + 1][t[i]][track].bgmusic | |
512 | + volume = main.t_selChars[t_p2Selected[1].cel + 1][t[i]][track].bgmvolume | |
513 | + loopstart = main.t_selChars[t_p2Selected[1].cel + 1][t[i]][track].bgmloopstart | |
514 | + loopend = main.t_selChars[t_p2Selected[1].cel + 1][t[i]][track].bgmloopend | |
515 | + elseif main.t_selStages[num] ~= nil and main.t_selStages[num][t[i]] ~= nil then --music assigned as stage param | |
516 | + track = math.random(1, #main.t_selStages[num][t[i]]) | |
517 | + music = main.t_selStages[num][t[i]][track].bgmusic | |
518 | + volume = main.t_selStages[num][t[i]][track].bgmvolume | |
519 | + loopstart = main.t_selStages[num][t[i]][track].bgmloopstart | |
520 | + loopend = main.t_selStages[num][t[i]][track].bgmloopend | |
521 | + end | |
522 | + end | |
523 | + if music ~= '' then | |
524 | + setStageBGM(i - 1, music, volume, loopstart, loopend) | |
525 | + end | |
526 | + end | |
527 | + return num | |
528 | +end | |
529 | + | |
530 | +function select.f_reampPal(cell, num) | |
531 | + if main.t_selChars[cell + 1].pal_keymap[num] ~= nil then | |
532 | + return main.t_selChars[cell + 1].pal_keymap[num] | |
430 | 533 | end |
431 | - t_p2Selected[1].stageno = stageNo | |
432 | - setStage(stageNo) | |
433 | - selectStage(stageNo) | |
534 | + return num | |
434 | 535 | end |
435 | 536 | |
436 | -function select.f_randomPal(cell) | |
437 | - --table with pal numbers already assigned | |
438 | - local t = {} | |
537 | +function select.f_selectPal(cell) | |
538 | + --prepare palette tables | |
539 | + local t_assignedVals = {} --values = pal numbers already assigned | |
540 | + local t_assignedKeys = {} --keys = pal numbers already assigned | |
439 | 541 | for i = 1, #t_p1Selected do |
440 | 542 | if t_p1Selected[i].cel == cell then |
441 | - t[#t + 1] = t_p1Selected[i].pal | |
543 | + table.insert(t_assignedVals, select.f_reampPal(cell, t_p1Selected[i].pal)) | |
544 | + t_assignedKeys[t_assignedVals[#t_assignedVals]] = '' | |
442 | 545 | end |
443 | 546 | end |
444 | 547 | for i = 1, #t_p2Selected do |
445 | 548 | if t_p2Selected[i].cel == cell then |
446 | - t[#t + 1] = t_p2Selected[i].pal | |
549 | + table.insert(t_assignedVals, select.f_reampPal(cell, t_p2Selected[i].pal)) | |
550 | + t_assignedKeys[t_assignedVals[#t_assignedVals]] = '' | |
447 | 551 | end |
448 | 552 | end |
449 | - --table with pal numbers not assigned yet (or all if there are not enough pals for unique appearance of all characters) | |
450 | - local t2 = {} | |
451 | - for i = 1, #main.t_selChars[cell + 1].pal do | |
452 | - if t[main.t_selChars[cell + 1].pal[i]] == nil or #t >= #main.t_selChars[cell + 1].pal then | |
453 | - t2[#t2 + 1] = main.t_selChars[cell + 1].pal[i] | |
553 | + --return random palette | |
554 | + if config.AIRandomColor then | |
555 | + local t_uniqueVals = {} --values = pal numbers not assigned yet (or all if there are not enough pals for unique appearance of all characters) | |
556 | + for i = 1, #main.t_selChars[cell + 1].pal do | |
557 | + if t_assignedKeys[main.t_selChars[cell + 1].pal[i]] == nil or #t_assignedVals >= #main.t_selChars[cell + 1].pal then | |
558 | + table.insert(t_uniqueVals, main.t_selChars[cell + 1].pal[i]) | |
559 | + end | |
560 | + end | |
561 | + return t_uniqueVals[math.random(1, #t_uniqueVals)] | |
562 | + end | |
563 | + --return first available default palette | |
564 | + for i = 1, #main.t_selChars[cell + 1].pal_defaults do | |
565 | + local d = main.t_selChars[cell + 1].pal_defaults[i] | |
566 | + if t_assignedKeys[d] == nil then | |
567 | + return select.f_reampPal(cell, d) | |
568 | + end | |
569 | + end | |
570 | + --no free default palettes available, force first default palette | |
571 | + return select.f_reampPal(cell, main.t_selChars[cell + 1].pal_defaults[1]) | |
572 | +end | |
573 | + | |
574 | +--Team modes enabling (also called from withing options screen) | |
575 | +function select.f_getTeamMenu() | |
576 | + local t = {} | |
577 | + --Single mode check | |
578 | + if config.SingleTeamMode == true then | |
579 | + table.insert(t, {data = textImgNew(), itemname = 'single', displayname = motif.select_info.teammenu_itemname_single}) | |
580 | + end | |
581 | + if config.SimulMode then --Simul mode enabled | |
582 | + --Simul mode check | |
583 | + if config.NumSimul > 1 then | |
584 | + table.insert(t, {data = textImgNew(), itemname = 'simul', displayname = motif.select_info.teammenu_itemname_simul}) | |
585 | + end | |
586 | + --Tag mode check | |
587 | + if config.NumTag > 1 then | |
588 | + table.insert(t, {data = textImgNew(), itemname = 'tag', displayname = motif.select_info.teammenu_itemname_tag}) | |
589 | + end | |
590 | + elseif config.NumTag > 1 then --Legacy Tag mode enabled | |
591 | + table.insert(t, {data = textImgNew(), itemname = 'simul', displayname = motif.select_info.teammenu_itemname_tag}) | |
592 | + end | |
593 | + --Turns mode check | |
594 | + if config.NumTurns > 1 then | |
595 | + table.insert(t, {data = textImgNew(), itemname = 'turns', displayname = motif.select_info.teammenu_itemname_turns}) | |
596 | + end | |
597 | + return t | |
598 | +end | |
599 | + | |
600 | +function select.f_overwriteCharData() | |
601 | + --for now only survival mode uses this function | |
602 | + if not gameMode('survival') and not gameMode('survivalcoop') and not gameMode('netplaysurvivalcoop') then | |
603 | + return | |
604 | + end | |
605 | + --and it's skipped at first match | |
606 | + if matchNo <= 1 then | |
607 | + return | |
608 | + end | |
609 | + local lastRound = #t_gameStats.chars | |
610 | + local removedNum = 0 | |
611 | + local p1Count = 0 | |
612 | + --Turns | |
613 | + if p1TeamMode == 2 then | |
614 | + local t_p1Keys = {} | |
615 | + --for each round in the last match | |
616 | + for round = 1, #t_gameStats.chars do | |
617 | + --remove character from team if he/she has been defeated | |
618 | + if not t_gameStats.chars[round][1].win or t_gameStats.chars[round][1].ko then | |
619 | + table.remove(t_p1Selected, t_gameStats.chars[round][1].memberNo + 1 - removedNum) | |
620 | + removedNum = removedNum + 1 | |
621 | + p1NumChars = p1NumChars - 1 | |
622 | + --otherwise overwrite character's next match life (done after all rounds have been checked) | |
623 | + else | |
624 | + t_p1Keys[t_gameStats.chars[round][1].memberNo] = t_gameStats.chars[round][1].life | |
625 | + end | |
626 | + end | |
627 | + for k, v in pairs(t_p1Keys) do | |
628 | + p1Count = p1Count + 1 | |
629 | + overwriteCharData(p1Count, {['life'] = v}) | |
454 | 630 | end |
631 | + --Single / Simul / Tag | |
632 | + else | |
633 | + --for each player data in the last round | |
634 | + for player = 1, #t_gameStats.chars[lastRound] do | |
635 | + --only check P1 side characters | |
636 | + if player % 2 ~= 0 and player <= (p1NumChars + removedNum) * 2 then --odd value, team size check just in case | |
637 | + --remove character from team if he/she has been defeated | |
638 | + if not t_gameStats.chars[lastRound][player].win or t_gameStats.chars[lastRound][player].ko then | |
639 | + table.remove(t_p1Selected, t_gameStats.chars[lastRound][player].memberNo + 1 - removedNum) | |
640 | + removedNum = removedNum + 1 | |
641 | + p1NumChars = p1NumChars - 1 | |
642 | + --otherwise overwrite character's next match life | |
643 | + else | |
644 | + if p1Count == 0 then | |
645 | + p1Count = 1 | |
646 | + else | |
647 | + p1Count = p1Count + 2 | |
648 | + end | |
649 | + overwriteCharData(p1Count, {['life'] = t_gameStats.chars[lastRound][player].life}) | |
650 | + end | |
651 | + end | |
652 | + end | |
653 | + end | |
654 | + if removedNum > 0 then | |
655 | + setTeamMode(1, p1TeamMode, p1NumChars) | |
455 | 656 | end |
456 | - return t2[math.random(1, #t2)] | |
457 | 657 | end |
458 | 658 | |
459 | 659 | function select.f_drawName(t, data, font, offsetX, offsetY, scaleX, scaleY, spacingX, spacingY, active_font, active_row) |
@@ -480,28 +680,15 @@ function select.f_drawName(t, data, font, offsetX, offsetY, scaleX, scaleY, spac | ||
480 | 680 | scaleY, |
481 | 681 | f[4], |
482 | 682 | f[5], |
483 | - f[6] | |
683 | + f[6], | |
684 | + f[7], | |
685 | + f[8] | |
484 | 686 | ) |
485 | 687 | textImgDraw(data) |
486 | 688 | end |
487 | 689 | end |
488 | 690 | end |
489 | 691 | |
490 | -function select.f_drawPortrait(t, offsetX, offsetY, facing, scaleX, scaleY, spacingX, spacingY, limit, func) | |
491 | - if facing == -1 then offsetX = offsetX + 1 end --fix for wrong offset after flipping sprites | |
492 | - for i = #t, 1, -1 do | |
493 | - if i <= limit then | |
494 | - if func == 'select' then | |
495 | - drawPortrait(t[i].cel, offsetX + (i - 1) * spacingX, offsetY + (i - 1) * spacingY, facing * scaleX, scaleY) | |
496 | - elseif func == 'versus' then | |
497 | - drawVersusPortrait(t[i].cel, offsetX + (i - 1) * spacingX, offsetY + (i - 1) * spacingY, facing * scaleX, scaleY) | |
498 | - elseif func == 'victory' then | |
499 | - drawVictoryPortrait(t[i].cel, offsetX + (i - 1) * spacingX, offsetY + (i - 1) * spacingY, facing * scaleX, scaleY) | |
500 | - end | |
501 | - end | |
502 | - end | |
503 | -end | |
504 | - | |
505 | 692 | function select.f_cellMovement(selX, selY, cmd, faceOffset, rowOffset, snd) |
506 | 693 | local tmpX = selX |
507 | 694 | local tmpY = selY |
@@ -525,8 +712,7 @@ function select.f_cellMovement(selX, selY, cmd, faceOffset, rowOffset, snd) | ||
525 | 712 | faceOffset = faceOffset - motif.select_info.columns |
526 | 713 | rowOffset = rowOffset - 1 |
527 | 714 | end |
528 | - if (t_grid[selY + 1][selX + 1].char ~= nil and t_grid[selY + 1][selX + 1].hidden ~= 2) | |
529 | - or motif.select_info.moveoveremptyboxes == 1 then | |
715 | + if (t_grid[selY + 1][selX + 1].char ~= nil and t_grid[selY + 1][selX + 1].hidden ~= 2) or motif.select_info.moveoveremptyboxes == 1 then | |
530 | 716 | break |
531 | 717 | elseif motif.select_info.searchemptyboxesup ~= 0 then |
532 | 718 | found, selX = select.f_searchEmptyBoxes(motif.select_info.searchemptyboxesup, selX, selY) |
@@ -552,8 +738,7 @@ function select.f_cellMovement(selX, selY, cmd, faceOffset, rowOffset, snd) | ||
552 | 738 | faceOffset = faceOffset + motif.select_info.columns |
553 | 739 | rowOffset = rowOffset + 1 |
554 | 740 | end |
555 | - if (t_grid[selY + 1][selX + 1].char ~= nil and t_grid[selY + 1][selX + 1].hidden ~= 2) | |
556 | - or motif.select_info.moveoveremptyboxes == 1 then | |
741 | + if (t_grid[selY + 1][selX + 1].char ~= nil and t_grid[selY + 1][selX + 1].hidden ~= 2) or motif.select_info.moveoveremptyboxes == 1 then | |
557 | 742 | break |
558 | 743 | elseif motif.select_info.searchemptyboxesdown ~= 0 then |
559 | 744 | found, selX = select.f_searchEmptyBoxes(motif.select_info.searchemptyboxesdown, selX, selY) |
@@ -572,8 +757,7 @@ function select.f_cellMovement(selX, selY, cmd, faceOffset, rowOffset, snd) | ||
572 | 757 | selX = tmpX |
573 | 758 | end |
574 | 759 | end |
575 | - if (t_grid[selY + 1][selX + 1].char ~= nil and t_grid[selY + 1][selX + 1].hidden ~= 2) | |
576 | - or motif.select_info.moveoveremptyboxes == 1 then | |
760 | + if (t_grid[selY + 1][selX + 1].char ~= nil and t_grid[selY + 1][selX + 1].hidden ~= 2) or motif.select_info.moveoveremptyboxes == 1 then | |
577 | 761 | break |
578 | 762 | end |
579 | 763 | end |
@@ -587,8 +771,7 @@ function select.f_cellMovement(selX, selY, cmd, faceOffset, rowOffset, snd) | ||
587 | 771 | selX = tmpX |
588 | 772 | end |
589 | 773 | end |
590 | - if (t_grid[selY + 1][selX + 1].char ~= nil and t_grid[selY + 1][selX + 1].hidden ~= 2) | |
591 | - or motif.select_info.moveoveremptyboxes == 1 then | |
774 | + if (t_grid[selY + 1][selX + 1].char ~= nil and t_grid[selY + 1][selX + 1].hidden ~= 2) or motif.select_info.moveoveremptyboxes == 1 then | |
592 | 775 | break |
593 | 776 | end |
594 | 777 | end |
@@ -650,27 +833,28 @@ function select.f_resetGrid() | ||
650 | 833 | |
651 | 834 | --1Pのランダムセル表示位置 / 1P random cell display position |
652 | 835 | if t_grid[row + p1RowOffset][col].char == 'randomselect' or t_grid[row + p1RowOffset][col].hidden == 3 then |
653 | - select.t_drawFace[#select.t_drawFace + 1] = {d = 1, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y} | |
836 | + table.insert(select.t_drawFace, {d = 1, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y}) | |
654 | 837 | --1Pのキャラ表示位置 / 1P character display position |
655 | 838 | elseif t_grid[row + p1RowOffset][col].char ~= nil and t_grid[row + p1RowOffset][col].hidden == 0 then |
656 | - select.t_drawFace[#select.t_drawFace + 1] = {d = 2, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y} | |
839 | + table.insert(select.t_drawFace, {d = 2, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y}) | |
840 | + --Empty boxes display position | |
657 | 841 | elseif motif.select_info.showemptyboxes == 1 then |
658 | - select.t_drawFace[#select.t_drawFace + 1] = {d = 0, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y} | |
842 | + table.insert(select.t_drawFace, {d = 0, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y}) | |
659 | 843 | end |
660 | 844 | |
661 | 845 | --2Pのランダムセル表示位置 / 2P random cell display position |
662 | 846 | if t_grid[row + p2RowOffset][col].char == 'randomselect' or t_grid[row + p2RowOffset][col].hidden == 3 then |
663 | - select.t_drawFace[#select.t_drawFace + 1] = {d = 11, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y} | |
847 | + table.insert(select.t_drawFace, {d = 11, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y} ) | |
664 | 848 | --2Pのキャラ表示位置 / 2P character display position |
665 | 849 | elseif t_grid[row + p2RowOffset][col].char ~= nil and t_grid[row + p2RowOffset][col].hidden == 0 then |
666 | - select.t_drawFace[#select.t_drawFace + 1] = {d = 12, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y} | |
667 | - -- Empty boxes display position | |
850 | + table.insert(select.t_drawFace, {d = 12, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y}) | |
851 | + --Empty boxes display position | |
668 | 852 | elseif motif.select_info.showemptyboxes == 1 then |
669 | - select.t_drawFace[#select.t_drawFace + 1] = {d = 10, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y} | |
853 | + table.insert(select.t_drawFace, {d = 10, p1 = t_grid[row + p1RowOffset][col].num, p2 = t_grid[row + p2RowOffset][col].num, x1 = p1FaceX + t_grid[row][col].x, x2 = p2FaceX + t_grid[row][col].x, y1 = p1FaceY + t_grid[row][col].y, y2 = p2FaceY + t_grid[row][col].y}) | |
670 | 854 | end |
671 | 855 | end |
672 | 856 | end |
673 | - main.f_printTable(select.t_drawFace, "debug/t_drawFace.txt") | |
857 | + main.f_printTable(select.t_drawFace, 'debug/t_drawFace.txt') | |
674 | 858 | end |
675 | 859 | |
676 | 860 | function select.f_selectReset() |
@@ -686,7 +870,7 @@ function select.f_selectReset() | ||
686 | 870 | p2FaceY = motif.select_info.pos[2] |
687 | 871 | end |
688 | 872 | select.f_resetGrid() |
689 | - if main.gameMode == 'netplayversus' or main.gameMode == 'netplayteamcoop' or main.gameMode == 'netplaysurvivalcoop' then | |
873 | + if gameMode('netplayversus') or gameMode('netplayteamcoop') or gameMode('netplaysurvivalcoop') then | |
690 | 874 | p1TeamMode = 0 |
691 | 875 | p2TeamMode = 0 |
692 | 876 | stageNo = 0 |
@@ -714,14 +898,17 @@ function select.f_selectReset() | ||
714 | 898 | stageEnd = false |
715 | 899 | coopEnd = false |
716 | 900 | restoreTeam = false |
901 | + continueStage = false | |
717 | 902 | p1NumChars = 1 |
718 | 903 | p2NumChars = 1 |
904 | + winner = 0 | |
719 | 905 | matchNo = 0 |
720 | 906 | setMatchNo(matchNo) |
907 | + resetRemapInput() | |
721 | 908 | end |
722 | 909 | |
723 | 910 | --;=========================================================== |
724 | ---; SIMPLE LOOP (VS MODE, TRAINING, WATCH, BONUS GAMES) | |
911 | +--; SIMPLE LOOP (VS MODE, TEAM VERSUS, TRAINING, WATCH, BONUS GAMES) | |
725 | 912 | --;=========================================================== |
726 | 913 | function select.f_selectSimple() |
727 | 914 | p1SelX = motif.select_info.p1_cursor_startcell[2] |
@@ -735,37 +922,44 @@ function select.f_selectSimple() | ||
735 | 922 | stageList = 0 |
736 | 923 | main.f_cmdInput() |
737 | 924 | while true do |
738 | - main.f_resetBG(motif.select_info, motif.selectbgdef, motif.music.select_bgm, motif.music.select_bgm_loop, motif.music.select_bgm_volume, motif.music.select_bgm_loopstart, motif.music.select_bgm_loopend) | |
925 | + main.f_menuReset(motif.selectbgdef.bg, motif.music.select_bgm, motif.music.select_bgm_loop, motif.music.select_bgm_volume, motif.music.select_bgm_loopstart, motif.music.select_bgm_loopend) | |
926 | + fadeType = 'fadein' | |
739 | 927 | select.f_selectReset() |
740 | 928 | selectStart() |
741 | 929 | while not selScreenEnd do |
742 | 930 | if esc() then |
743 | 931 | sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) |
744 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
932 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
933 | + resetRemapInput() | |
745 | 934 | return |
746 | 935 | end |
747 | 936 | select.f_selectScreen() |
748 | 937 | end |
749 | - select.f_aiLevel() | |
750 | - if not main.stageMenu then | |
751 | - select.f_selectStage() | |
752 | - end | |
938 | + --fight initialization | |
939 | + select.f_remapAI() | |
940 | + select.f_setRounds() | |
941 | + stageNo = select.f_setStage(stageNo) | |
753 | 942 | select.f_selectVersus() |
754 | 943 | if esc() then break end |
755 | - select.f_setZoom() | |
756 | - select.f_assignMusic() | |
757 | 944 | loadStart() |
758 | 945 | winner, t_gameStats = game() |
946 | + main.f_printTable(t_gameStats, 'debug/t_gameStats.txt') | |
947 | + --victory screen | |
948 | + if motif.victory_screen.vs_enabled == 1 and winner >= 1 and (gameMode('versus') or gameMode('netplayversus')) then | |
949 | + select.f_selectVictory() | |
950 | + end | |
951 | + if challenger then | |
952 | + break | |
953 | + end | |
759 | 954 | main.f_cmdInput() |
760 | 955 | refresh() |
761 | 956 | end |
762 | 957 | end |
763 | 958 | |
764 | 959 | --;=========================================================== |
765 | ---; ADVANCE LOOP (ARCADE, TEAM CO-OP, SURVIVAL, SURVIVAL CO-OP, VS 100 KUMITE, BOSS RUSH) | |
960 | +--; ARRANGED LOOP (SURVIVAL, SURVIVAL CO-OP, VS 100 KUMITE, BOSS RUSH) | |
766 | 961 | --;=========================================================== |
767 | -function select.f_selectAdvance() | |
768 | -getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | |
962 | +function select.f_selectArranged() | |
769 | 963 | p1SelX = motif.select_info.p1_cursor_startcell[2] |
770 | 964 | p1SelY = motif.select_info.p1_cursor_startcell[1] |
771 | 965 | p2SelX = motif.select_info.p2_cursor_startcell[2] |
@@ -774,21 +968,21 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
774 | 968 | p2FaceOffset = 0 |
775 | 969 | p1RowOffset = 0 |
776 | 970 | p2RowOffset = 0 |
777 | - winner = 0 | |
778 | 971 | winCnt = 0 |
779 | 972 | looseCnt = 0 |
973 | + stageList = 0 | |
780 | 974 | main.f_cmdInput() |
781 | 975 | select.f_selectReset() |
782 | - t_p2Selected = {} | |
783 | - stageEnd = true | |
784 | 976 | local t_enemySelected = {} |
785 | 977 | while true do |
786 | - main.f_resetBG(motif.select_info, motif.selectbgdef, motif.music.select_bgm, motif.music.select_bgm_loop, motif.music.select_bgm_volume, motif.music.select_bgm_loopstart, motif.music.select_bgm_loopend) | |
978 | + main.f_menuReset(motif.selectbgdef.bg, motif.music.select_bgm, motif.music.select_bgm_loop, motif.music.select_bgm_volume, motif.music.select_bgm_loopstart, motif.music.select_bgm_loopend) | |
979 | + fadeType = 'fadein' | |
787 | 980 | selectStart() |
788 | 981 | while not selScreenEnd do |
789 | 982 | if esc() then |
790 | 983 | sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) |
791 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
984 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
985 | + resetRemapInput() | |
792 | 986 | return |
793 | 987 | end |
794 | 988 | select.f_selectScreen() |
@@ -805,23 +999,27 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
805 | 999 | end |
806 | 1000 | --generate roster |
807 | 1001 | select.f_makeRoster() |
808 | - lastMatch = #t_roster / p2NumChars | |
809 | - matchNo = 1 | |
810 | - --generate AI ramping table | |
811 | - select.f_aiRamp() | |
812 | - --intro | |
813 | - if main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' then | |
814 | - local tPos = main.t_selChars[t_p1Selected[1].cel + 1] | |
815 | - if tPos.intro ~= nil and main.f_fileExists(tPos.intro) then | |
816 | - storyboard.f_storyboard(tPos.intro) | |
1002 | + --sum all upcoming matches and set starting order group | |
1003 | + currentOrder = 0 | |
1004 | + currentRosterIndex = 1 | |
1005 | + lastMatch = 0 | |
1006 | + for i = 1, #t_roster do | |
1007 | + if #t_roster[i] > 0 then | |
1008 | + if currentOrder == 0 then | |
1009 | + currentOrder = i | |
1010 | + end | |
1011 | + lastMatch = lastMatch + #t_roster[i] / p2NumChars | |
817 | 1012 | end |
818 | 1013 | end |
1014 | + matchNo = 1 | |
1015 | + --generate AI ramping table | |
1016 | + select.f_aiRamp(1) | |
819 | 1017 | --player exit the match via ESC in VS 100 Kumite mode |
820 | - elseif winner == -1 and main.gameMode == '100kumite' then | |
1018 | + elseif winner == -1 and gameMode('100kumite') then | |
821 | 1019 | --counter |
822 | 1020 | looseCnt = looseCnt + 1 |
823 | 1021 | --result |
824 | - select.f_result('lost') | |
1022 | + select.f_result() | |
825 | 1023 | --game over |
826 | 1024 | if motif.game_over_screen.enabled == 1 and motif.game_over_screen.storyboard ~= '' then |
827 | 1025 | storyboard.f_storyboard(motif.game_over_screen.storyboard) |
@@ -830,36 +1028,48 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
830 | 1028 | if motif.files.intro_storyboard ~= '' then |
831 | 1029 | storyboard.f_storyboard(motif.files.intro_storyboard) |
832 | 1030 | end |
833 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1031 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1032 | + resetRemapInput() | |
834 | 1033 | return |
835 | - --player won (also if lost in VS 100 Kumite) | |
836 | - elseif winner == 1 or main.gameMode == '100kumite' then | |
1034 | + --player won | |
1035 | + elseif winner == 1 then | |
837 | 1036 | --counter |
838 | - if winner == 1 then | |
839 | - winCnt = winCnt + 1 | |
840 | - else --only true in VS 100 Kumite mode | |
841 | - looseCnt = looseCnt + 1 | |
842 | - end | |
843 | - --victory screen | |
844 | - if main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' then | |
845 | - if motif.victory_screen.enabled == 1 and (main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1) then | |
846 | - select.f_selectVictory() | |
1037 | + winCnt = winCnt + 1 | |
1038 | + --last match in the current order group | |
1039 | + if currentRosterIndex == #t_roster[currentOrder] / p2NumChars then | |
1040 | + if (gameMode('survival') or gameMode('survivalcoop') or gameMode('netplaysurvivalcoop')) and main.t_selOptions.survivalmaxmatches[currentOrder] == -1 then --survival mode infinite fights | |
1041 | + --randomly rearrange array entries positions of the current order group | |
1042 | + main.f_shuffleTable(t_roster[currentOrder]) | |
1043 | + --ensure that the next fight won't be against team members we've just fought | |
1044 | + local t_lastRefs = {} | |
1045 | + for i = 1, #t_p2Selected do | |
1046 | + t_lastRefs[t_p2Selected[i].cel] = '' --store last enemy team refs as keys | |
1047 | + end | |
1048 | + for i = 1, #t_p2Selected do | |
1049 | + if t_lastRefs[t_roster[currentOrder][i]] ~= nil then | |
1050 | + table.remove(t_roster[currentOrder], i) --remove char ref from the given position of an array | |
1051 | + table.insert(t_roster[currentOrder], t_p2Selected[i].cel) --and inserts it in the last position of the array | |
1052 | + end | |
1053 | + end | |
1054 | + --update variables | |
1055 | + local lastMatchRamp = lastMatch + 1 | |
1056 | + lastMatch = lastMatch + #t_roster[currentOrder] / p2NumChars --with this value the mode should go infinitely | |
1057 | + --append new entries to existing AI ramping table | |
1058 | + select.f_aiRamp(lastMatchRamp) | |
1059 | + else --survival mode finite fights or other modes | |
1060 | + for i = currentOrder + 1, #t_roster do --find next order group with assigned characters | |
1061 | + if #t_roster[i] > 0 then | |
1062 | + currentOrder = i | |
1063 | + break | |
1064 | + end | |
1065 | + end | |
847 | 1066 | end |
1067 | + currentRosterIndex = 0 | |
848 | 1068 | end |
849 | - t_p2Selected = {} | |
850 | 1069 | --no more matches left |
851 | 1070 | if matchNo == lastMatch then |
852 | - --ending | |
853 | - if main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' then | |
854 | - local tPos = main.t_selChars[t_p1Selected[1].cel + 1] | |
855 | - if tPos.ending ~= nil and main.f_fileExists(tPos.ending) then | |
856 | - storyboard.f_storyboard(tPos.ending) | |
857 | - elseif motif.default_ending.enabled == 1 and motif.default_ending.storyboard ~= '' then | |
858 | - storyboard.f_storyboard(motif.default_ending.storyboard) | |
859 | - end | |
860 | - end | |
861 | 1071 | --result |
862 | - select.f_result(true) | |
1072 | + select.f_result() | |
863 | 1073 | --credits |
864 | 1074 | if motif.end_credits.enabled == 1 and motif.end_credits.storyboard ~= '' then |
865 | 1075 | storyboard.f_storyboard(motif.end_credits.storyboard) |
@@ -872,24 +1082,21 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
872 | 1082 | if motif.files.intro_storyboard ~= '' then |
873 | 1083 | storyboard.f_storyboard(motif.files.intro_storyboard) |
874 | 1084 | end |
875 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1085 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1086 | + resetRemapInput() | |
876 | 1087 | return |
877 | 1088 | --next match available |
878 | 1089 | else |
879 | 1090 | matchNo = matchNo + 1 |
1091 | + currentRosterIndex = currentRosterIndex + 1 | |
1092 | + t_p2Selected = {} | |
880 | 1093 | end |
881 | - --player lost and doesn't have any credits left | |
882 | - elseif main.credits == 0 then | |
1094 | + --player lost | |
1095 | + else | |
883 | 1096 | --counter |
884 | 1097 | looseCnt = looseCnt + 1 |
885 | - --victory screen | |
886 | - if main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop' then | |
887 | - if motif.victory_screen.enabled == 1 and winner >= 1 and (main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1) then | |
888 | - select.f_selectVictory() | |
889 | - end | |
890 | - end | |
891 | 1098 | --result |
892 | - select.f_result(false) | |
1099 | + select.f_result() | |
893 | 1100 | --game over |
894 | 1101 | if motif.game_over_screen.enabled == 1 and motif.game_over_screen.storyboard ~= '' then |
895 | 1102 | storyboard.f_storyboard(motif.game_over_screen.storyboard) |
@@ -898,58 +1105,12 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
898 | 1105 | if motif.files.intro_storyboard ~= '' then |
899 | 1106 | storyboard.f_storyboard(motif.files.intro_storyboard) |
900 | 1107 | end |
901 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1108 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1109 | + resetRemapInput() | |
902 | 1110 | return |
903 | - --player lost but can continue | |
904 | - else | |
905 | - --counter | |
906 | - looseCnt = looseCnt + 1 | |
907 | - --victory screen | |
908 | - if motif.victory_screen.enabled == 1 and winner >= 1 and (main.t_selChars[t_p2Selected[1].cel + 1].winscreen == nil or main.t_selChars[t_p2Selected[1].cel + 1].winscreen == 1) then | |
909 | - select.f_selectVictory() | |
910 | - end | |
911 | - --continue screen | |
912 | - select.f_continue() | |
913 | - if not continue then | |
914 | - --game over | |
915 | - if motif.continue_screen.external_gameover == 1 and motif.game_over_screen.storyboard ~= '' then | |
916 | - storyboard.f_storyboard(motif.game_over_screen.storyboard) | |
917 | - end | |
918 | - --intro | |
919 | - if motif.files.intro_storyboard ~= '' then | |
920 | - storyboard.f_storyboard(motif.files.intro_storyboard) | |
921 | - end | |
922 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
923 | - return | |
924 | - end | |
925 | - if config.ContSelection then --true if 'Char change at Continue' option is enabled | |
926 | - t_p1Selected = {} | |
927 | - p1SelEnd = false | |
928 | - if main.coop then | |
929 | - p1NumChars = 1 | |
930 | - numChars = p2NumChars | |
931 | - p2NumChars = 1 | |
932 | - t_p2Selected = {} | |
933 | - p2SelEnd = false | |
934 | - end | |
935 | - selScreenEnd = false | |
936 | - while not selScreenEnd do | |
937 | - if esc() then | |
938 | - sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) | |
939 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
940 | - return | |
941 | - end | |
942 | - select.f_selectScreen() | |
943 | - end | |
944 | - elseif esc() then | |
945 | - sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) | |
946 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
947 | - return | |
948 | - end | |
949 | 1111 | end |
950 | 1112 | --coop swap |
951 | 1113 | if main.coop then |
952 | - remapInput(3,2) --P2 controls assigned to P3 character | |
953 | 1114 | if winner == -1 or winner == 2 then |
954 | 1115 | p1NumChars = 2 |
955 | 1116 | p2NumChars = numChars |
@@ -962,53 +1123,333 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
962 | 1123 | if #t_p2Selected == 0 then |
963 | 1124 | local shuffle = true |
964 | 1125 | for i = 1, p2NumChars do |
965 | - if i == 1 and (main.gameMode == 'arcade' or main.gameMode == 'teamcoop' or main.gameMode == 'netplayteamcoop') and main.t_selChars[t_p1Selected[1].cel + 1][matchNo] ~= nil then | |
966 | - p2Cell = main.t_charDef[main.t_selChars[t_p1Selected[1].cel + 1][matchNo]] | |
967 | - shuffle = false | |
968 | - else | |
969 | - p2Cell = t_roster[matchNo * p2NumChars - i + 1] | |
970 | - end | |
971 | - local updateAnim = true | |
972 | - for j = 1, #t_p2Selected do | |
973 | - if t_p2Selected[j].cel == p2Cell then | |
974 | - updateAnim = false | |
975 | - end | |
976 | - end | |
977 | - t_p2Selected[#t_p2Selected + 1] = {cel = p2Cell, pal = select.f_randomPal(p2Cell), up = updateAnim} | |
1126 | + p2Cell = t_roster[currentOrder][currentRosterIndex * p2NumChars - i + 1] | |
1127 | + table.insert(t_p2Selected, {cel = p2Cell, pal = select.f_selectPal(p2Cell)}) | |
978 | 1128 | if shuffle then |
979 | 1129 | main.f_shuffleTable(t_p2Selected) |
980 | 1130 | end |
981 | 1131 | end |
982 | 1132 | t_enemySelected = t_p2Selected |
983 | 1133 | end |
984 | - --Team conversion to Single match if bonus paramvalue on any opponents is detected | |
985 | - if p2NumChars > 1 then | |
986 | - for i = 1, #t_p2Selected do | |
987 | - if main.t_selChars[t_p2Selected[i].cel + 1].bonus ~= nil and main.t_selChars[t_p2Selected[i].cel + 1].bonus == 1 then | |
988 | - teamMode = p2TeamMode | |
989 | - numChars = p2NumChars | |
990 | - p2TeamMode = 0 | |
991 | - p2NumChars = 1 | |
992 | - setTeamMode(2, 0, 1) | |
993 | - p2Cell = main.t_charDef[main.t_selChars[t_p2Selected[i].cel + 1].char] | |
1134 | + --fight initialization | |
1135 | + setMatchNo(matchNo) | |
1136 | + select.f_overwriteCharData() | |
1137 | + select.f_remapAI() | |
1138 | + select.f_setRounds() | |
1139 | + stageNo = select.f_setStage(stageNo) | |
1140 | + select.f_selectVersus() | |
1141 | + --if esc() then break end | |
1142 | + loadStart() | |
1143 | + winner, t_gameStats = game() | |
1144 | + main.f_printTable(t_gameStats, 'debug/t_gameStats.txt') | |
1145 | + resetRemapInput() | |
1146 | + main.f_cmdInput() | |
1147 | + refresh() | |
1148 | + end | |
1149 | +end | |
1150 | + | |
1151 | +--;=========================================================== | |
1152 | +--; ARCADE LOOP (ARCADE, TEAM ARCADE, TEAM CO-OP) | |
1153 | +--;=========================================================== | |
1154 | +function select.f_selectArcade() | |
1155 | + p1SelX = motif.select_info.p1_cursor_startcell[2] | |
1156 | + p1SelY = motif.select_info.p1_cursor_startcell[1] | |
1157 | + p2SelX = motif.select_info.p2_cursor_startcell[2] | |
1158 | + p2SelY = motif.select_info.p2_cursor_startcell[1] | |
1159 | + p1FaceOffset = 0 | |
1160 | + p2FaceOffset = 0 | |
1161 | + p1RowOffset = 0 | |
1162 | + p2RowOffset = 0 | |
1163 | + winCnt = 0 | |
1164 | + looseCnt = 0 | |
1165 | + main.f_cmdInput() | |
1166 | + select.f_selectReset() | |
1167 | + stageEnd = true | |
1168 | + local t_enemySelected = {} | |
1169 | + while true do | |
1170 | + main.f_menuReset(motif.selectbgdef.bg, motif.music.select_bgm, motif.music.select_bgm_loop, motif.music.select_bgm_volume, motif.music.select_bgm_loopstart, motif.music.select_bgm_loopend) | |
1171 | + fadeType = 'fadein' | |
1172 | + selectStart() | |
1173 | + while not selScreenEnd do | |
1174 | + if esc() then | |
1175 | + sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) | |
1176 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1177 | + resetRemapInput() | |
1178 | + return | |
1179 | + end | |
1180 | + select.f_selectScreen() | |
1181 | + end | |
1182 | + --if last match was not against a challenger | |
1183 | + if not challenger then | |
1184 | + --first match | |
1185 | + if matchNo == 0 then | |
1186 | + --coop swap | |
1187 | + if main.coop then | |
1188 | + p1TeamMode = 1 | |
1189 | + p1NumChars = 2 | |
1190 | + setTeamMode(1, p1TeamMode, p1NumChars) | |
1191 | + t_p1Selected[2] = {cel = t_p2Selected[1].cel, pal = t_p2Selected[1].pal} | |
1192 | + t_p2Selected = t_enemySelected | |
1193 | + end | |
1194 | + --generate roster | |
1195 | + select.f_makeRoster() | |
1196 | + --sum all upcoming matches and set starting order group | |
1197 | + currentOrder = 0 | |
1198 | + currentRosterIndex = 1 | |
1199 | + lastMatch = 0 | |
1200 | + for i = 1, #t_roster do | |
1201 | + if #t_roster[i] > 0 then | |
1202 | + if currentOrder == 0 then | |
1203 | + currentOrder = i | |
1204 | + end | |
1205 | + lastMatch = lastMatch + #t_roster[i] / p2NumChars | |
1206 | + end | |
1207 | + end | |
1208 | + matchNo = 1 | |
1209 | + --generate AI ramping table | |
1210 | + select.f_aiRamp(1) | |
1211 | + --intro | |
1212 | + local tPos = main.t_selChars[t_p1Selected[1].cel + 1] | |
1213 | + if tPos.intro ~= nil and main.f_fileExists(tPos.intro) then | |
1214 | + storyboard.f_storyboard(tPos.intro) | |
1215 | + end | |
1216 | + --player won | |
1217 | + elseif winner == 1 then | |
1218 | + --counter | |
1219 | + winCnt = winCnt + 1 | |
1220 | + --last match in the current order group | |
1221 | + if currentRosterIndex == #t_roster[currentOrder] / p2NumChars then | |
1222 | + for i = currentOrder + 1, #t_roster do --find next order group with assigned characters | |
1223 | + if #t_roster[i] > 0 then | |
1224 | + currentOrder = i | |
1225 | + break | |
1226 | + end | |
1227 | + end | |
1228 | + currentRosterIndex = 0 | |
1229 | + end | |
1230 | + --victory screen | |
1231 | + if motif.victory_screen.enabled == 1 then | |
1232 | + select.f_selectVictory() | |
1233 | + end | |
1234 | + --no more matches left | |
1235 | + if matchNo == lastMatch then | |
1236 | + --ending | |
1237 | + local tPos = main.t_selChars[t_p1Selected[1].cel + 1] | |
1238 | + if tPos.ending ~= nil and main.f_fileExists(tPos.ending) then | |
1239 | + storyboard.f_storyboard(tPos.ending) | |
1240 | + elseif motif.default_ending.enabled == 1 and motif.default_ending.storyboard ~= '' then | |
1241 | + storyboard.f_storyboard(motif.default_ending.storyboard) | |
1242 | + end | |
1243 | + --credits | |
1244 | + if motif.end_credits.enabled == 1 and motif.end_credits.storyboard ~= '' then | |
1245 | + storyboard.f_storyboard(motif.end_credits.storyboard) | |
1246 | + end | |
1247 | + --game over | |
1248 | + if motif.game_over_screen.enabled == 1 and motif.game_over_screen.storyboard ~= '' then | |
1249 | + storyboard.f_storyboard(motif.game_over_screen.storyboard) | |
1250 | + end | |
1251 | + --intro | |
1252 | + if motif.files.intro_storyboard ~= '' then | |
1253 | + storyboard.f_storyboard(motif.files.intro_storyboard) | |
1254 | + end | |
1255 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1256 | + resetRemapInput() | |
1257 | + return | |
1258 | + --next match available | |
1259 | + else | |
1260 | + matchNo = matchNo + 1 | |
1261 | + currentRosterIndex = currentRosterIndex + 1 | |
1262 | + continueStage = false | |
994 | 1263 | t_p2Selected = {} |
995 | - t_p2Selected[1] = {cel = p2Cell, pal = select.f_randomPal(p2Cell), up = true} | |
996 | - restoreTeam = true | |
997 | - break | |
1264 | + end | |
1265 | + --player lost and doesn't have any credits left | |
1266 | + elseif main.credits == 0 then | |
1267 | + --counter | |
1268 | + looseCnt = looseCnt + 1 | |
1269 | + --victory screen | |
1270 | + if motif.victory_screen.cpu_enabled == 1 and winner >= 2 then | |
1271 | + select.f_selectVictory() | |
1272 | + end | |
1273 | + --game over | |
1274 | + if motif.game_over_screen.enabled == 1 and motif.game_over_screen.storyboard ~= '' then | |
1275 | + storyboard.f_storyboard(motif.game_over_screen.storyboard) | |
1276 | + end | |
1277 | + --intro | |
1278 | + if motif.files.intro_storyboard ~= '' then | |
1279 | + storyboard.f_storyboard(motif.files.intro_storyboard) | |
1280 | + end | |
1281 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1282 | + resetRemapInput() | |
1283 | + return | |
1284 | + --player lost but can continue | |
1285 | + else | |
1286 | + --counter | |
1287 | + looseCnt = looseCnt + 1 | |
1288 | + --victory screen | |
1289 | + if motif.victory_screen.cpu_enabled == 1 and winner >= 2 then | |
1290 | + select.f_selectVictory() | |
1291 | + end | |
1292 | + --continue screen | |
1293 | + select.f_continue() | |
1294 | + if not continue then | |
1295 | + --game over | |
1296 | + if motif.continue_screen.external_gameover == 1 and motif.game_over_screen.storyboard ~= '' then | |
1297 | + storyboard.f_storyboard(motif.game_over_screen.storyboard) | |
1298 | + end | |
1299 | + --intro | |
1300 | + if motif.files.intro_storyboard ~= '' then | |
1301 | + storyboard.f_storyboard(motif.files.intro_storyboard) | |
1302 | + end | |
1303 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1304 | + resetRemapInput() | |
1305 | + return | |
1306 | + end | |
1307 | + if config.ContSelection then --true if 'Char change at Continue' option is enabled | |
1308 | + t_p1Selected = {} | |
1309 | + p1SelEnd = false | |
1310 | + if main.coop then | |
1311 | + p1NumChars = 1 | |
1312 | + numChars = p2NumChars | |
1313 | + p2NumChars = 1 | |
1314 | + t_p2Selected = {} | |
1315 | + p2SelEnd = false | |
1316 | + end | |
1317 | + fadeType = 'fadein' | |
1318 | + --selectStart() | |
1319 | + selScreenEnd = false | |
1320 | + while not selScreenEnd do | |
1321 | + if esc() then | |
1322 | + sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) | |
1323 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1324 | + resetRemapInput() | |
1325 | + return | |
1326 | + end | |
1327 | + select.f_selectScreen() | |
1328 | + end | |
1329 | + elseif esc() then | |
1330 | + sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) | |
1331 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1332 | + resetRemapInput() | |
1333 | + return | |
1334 | + end | |
1335 | + continueStage = true | |
1336 | + end | |
1337 | + --coop swap | |
1338 | + if main.coop then | |
1339 | + if winner == -1 or winner == 2 then | |
1340 | + p1NumChars = 2 | |
1341 | + p2NumChars = numChars | |
1342 | + t_p1Selected[2] = {cel = t_p2Selected[1].cel, pal = t_p2Selected[1].pal} | |
1343 | + t_p2Selected = t_enemySelected | |
1344 | + end | |
1345 | + end | |
1346 | + --assign enemy team | |
1347 | + --t_p2Selected = {} | |
1348 | + if #t_p2Selected == 0 then | |
1349 | + local shuffle = true | |
1350 | + for i = 1, p2NumChars do | |
1351 | + if i == 1 and select.f_rivalsMatch('char_ref') then --enemy assigned as rivals param | |
1352 | + p2Cell = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].char_ref | |
1353 | + shuffle = false | |
1354 | + else | |
1355 | + p2Cell = t_roster[currentOrder][currentRosterIndex * p2NumChars - i + 1] | |
1356 | + end | |
1357 | + table.insert(t_p2Selected, {cel = p2Cell, pal = select.f_selectPal(p2Cell)}) | |
1358 | + if shuffle then | |
1359 | + main.f_shuffleTable(t_p2Selected) | |
1360 | + end | |
1361 | + end | |
1362 | + t_enemySelected = t_p2Selected | |
1363 | + end | |
1364 | + --Team conversion to Single match if onlyme paramvalue on any opponents is detected | |
1365 | + if p2NumChars > 1 then | |
1366 | + for i = 1, #t_p2Selected do | |
1367 | + local onlyme = false | |
1368 | + if select.f_rivalsMatch('char_ref') and main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].onlyme == 1 then --team conversion assigned as rivals param | |
1369 | + p2Cell = main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].char_ref | |
1370 | + onlyme = true | |
1371 | + elseif main.t_selChars[t_p2Selected[i].cel + 1].onlyme == 1 then --team conversion assigned as character param | |
1372 | + p2Cell = main.t_selChars[t_p2Selected[i].cel + 1].char_ref | |
1373 | + onlyme = true | |
1374 | + end | |
1375 | + if onlyme then | |
1376 | + teamMode = p2TeamMode | |
1377 | + numChars = p2NumChars | |
1378 | + p2TeamMode = 0 | |
1379 | + p2NumChars = 1 | |
1380 | + setTeamMode(2, p2TeamMode, p2NumChars) | |
1381 | + t_p2Selected = {} | |
1382 | + t_p2Selected[1] = {cel = p2Cell, pal = select.f_selectPal(p2Cell), up = true} | |
1383 | + restoreTeam = true | |
1384 | + break | |
1385 | + end | |
998 | 1386 | end |
999 | 1387 | end |
1000 | 1388 | end |
1389 | + --fight initialization | |
1001 | 1390 | setMatchNo(matchNo) |
1002 | - select.f_aiLevel() | |
1003 | - if not main.stageMenu then | |
1004 | - select.f_selectStage() | |
1005 | - end | |
1391 | + select.f_remapAI() | |
1392 | + select.f_setRounds() | |
1393 | + stageNo = select.f_setStage(stageNo) | |
1006 | 1394 | select.f_selectVersus() |
1007 | 1395 | if esc() then break end |
1008 | - select.f_setZoom() | |
1009 | - select.f_assignMusic() | |
1010 | 1396 | loadStart() |
1011 | 1397 | winner, t_gameStats = game() |
1398 | + main.f_printTable(t_gameStats, 'debug/t_gameStats.txt') | |
1399 | + --here comes a new challenger | |
1400 | + challenger = false | |
1401 | + if t_gameStats.challenger > 0 then | |
1402 | + refresh() --needed to clean inputs | |
1403 | + challenger = true | |
1404 | + --save values | |
1405 | + local p2TeamMenu_sav = main.f_copyTable(main.p2TeamMenu) | |
1406 | + local t_p2Selected_sav = main.f_copyTable(t_p2Selected) | |
1407 | + local t_charparam_sav = main.f_copyTable(main.t_charparam) | |
1408 | + local p1Cell_sav = p1Cell | |
1409 | + local p2Cell_sav = p2Cell | |
1410 | + local matchNo_sav = matchNo | |
1411 | + local stageNo_sav = stageNo | |
1412 | + local p2TeamMode_sav = p2TeamMode | |
1413 | + local p2NumChars_sav = p2NumChars | |
1414 | + local gameMode = gameMode() | |
1415 | + main.f_resetCharparam() | |
1416 | + --temp values | |
1417 | + textImgSetText(main.txt_mainSelect, motif.select_info.title_text_teamversus) | |
1418 | + setHomeTeam(1) | |
1419 | + main.p2In = 2 | |
1420 | + main.p2SelectMenu = true | |
1421 | + main.stageMenu = true | |
1422 | + main.p2Faces = true | |
1423 | + main.p1TeamMenu = nil | |
1424 | + main.p2TeamMenu = nil | |
1425 | + setGameMode('teamversus') | |
1426 | + --start challenger match | |
1427 | + select.f_selectSimple() | |
1428 | + --reload values | |
1429 | + textImgSetText(main.txt_mainSelect, motif.select_info.title_text_arcade) | |
1430 | + setHomeTeam(2) | |
1431 | + main.p2In = 1 | |
1432 | + main.p2SelectMenu = false | |
1433 | + main.stageMenu = false | |
1434 | + main.p2Faces = false | |
1435 | + --move player2 characters into player1 side and remap buttons if needed | |
1436 | + if winner == 2 then | |
1437 | + --TODO: when player1 team loose continue playing the arcade mode as player2 team | |
1438 | + end | |
1439 | + --restore values | |
1440 | + main.p2TeamMenu = main.f_copyTable(p2TeamMenu_sav) | |
1441 | + t_p2Selected = main.f_copyTable(t_p2Selected_sav) | |
1442 | + main.t_charparam = main.f_copyTable(t_charparam_sav) | |
1443 | + p1Cell = p1Cell_sav | |
1444 | + p2Cell = p2Cell_sav | |
1445 | + matchNo = matchNo_sav | |
1446 | + stageNo = stageNo_sav | |
1447 | + p2TeamMode = p2TeamMode_sav | |
1448 | + p2NumChars = p2NumChars_sav | |
1449 | + setTeamMode(2, p2TeamMode, p2NumChars) | |
1450 | + setGameMode(gameMode) | |
1451 | + continueStage = true | |
1452 | + end | |
1012 | 1453 | --restore P2 Team settings if needed |
1013 | 1454 | if restoreTeam then |
1014 | 1455 | p2TeamMode = teamMode |
@@ -1018,7 +1459,6 @@ getSpriteInfo('chars/kfm/kfm.sff', 0, 1) | ||
1018 | 1459 | end |
1019 | 1460 | resetRemapInput() |
1020 | 1461 | main.f_cmdInput() |
1021 | - --main.f_printTable(_G) | |
1022 | 1462 | refresh() |
1023 | 1463 | end |
1024 | 1464 | end |
@@ -1026,7 +1466,7 @@ end | ||
1026 | 1466 | --;=========================================================== |
1027 | 1467 | --; TOURNAMENT LOOP |
1028 | 1468 | --;=========================================================== |
1029 | -function select.f_selectTournament() | |
1469 | +function select.f_selectTournament(size) | |
1030 | 1470 | p1SelX = motif.select_info.p1_cursor_startcell[2] |
1031 | 1471 | p1SelY = motif.select_info.p1_cursor_startcell[1] |
1032 | 1472 | p2SelX = motif.select_info.p2_cursor_startcell[2] |
@@ -1038,20 +1478,23 @@ function select.f_selectTournament() | ||
1038 | 1478 | stageList = 0 |
1039 | 1479 | main.f_cmdInput() |
1040 | 1480 | while true do |
1041 | - main.f_resetBG(motif.tournament_info, motif.tournamentbgdef, motif.music.tournament_bgm, motif.music.tournament_bgm_loop, motif.music.tournament_bgm_volume, motif.music.tournament_bgm_loopstart, motif.music.tournament_bgm_loopend) | |
1481 | + main.f_menuReset(motif.tournamentbgdef.bg, motif.music.tournament_bgm, motif.music.tournament_bgm_loop, motif.music.tournament_bgm_volume, motif.music.tournament_bgm_loopstart, motif.music.tournament_bgm_loopend) | |
1482 | + fadeType = 'fadein' | |
1042 | 1483 | select.f_selectReset() |
1043 | 1484 | while not selScreenEnd do |
1044 | 1485 | if esc() then |
1045 | 1486 | sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) |
1046 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1487 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
1488 | + resetRemapInput() | |
1047 | 1489 | return |
1048 | 1490 | end |
1049 | - select.f_selectTournamentScreen() | |
1491 | + select.f_selectTournamentScreen(size) | |
1050 | 1492 | end |
1051 | - select.f_aiLevel() | |
1493 | + --fight initialization | |
1494 | + select.f_remapAI() | |
1495 | + select.f_setRounds() | |
1496 | + stageNo = select.f_setStage(stageNo) | |
1052 | 1497 | select.f_selectVersus() |
1053 | - select.f_setZoom() | |
1054 | - select.f_assignMusic() | |
1055 | 1498 | loadStart() |
1056 | 1499 | winner, t_gameStats = game() |
1057 | 1500 | main.f_cmdInput() |
@@ -1062,21 +1505,32 @@ end | ||
1062 | 1505 | --;=========================================================== |
1063 | 1506 | --; TOURNAMENT SCREEN |
1064 | 1507 | --;=========================================================== |
1065 | -function select.f_selectTournamentScreen() | |
1508 | +function select.f_selectTournamentScreen(size) | |
1066 | 1509 | --draw clearcolor |
1067 | - animDraw(motif.tournamentbgdef.bgclearcolor_data) | |
1510 | + clearColor(motif.tournamentbgdef.bgclearcolor[1], motif.tournamentbgdef.bgclearcolor[2], motif.tournamentbgdef.bgclearcolor[3]) | |
1068 | 1511 | --draw layerno = 0 backgrounds |
1069 | - main.f_drawBG(motif.tournamentbgdef.bg_data, motif.tournamentbgdef.bg, 0, motif.tournamentbgdef.timer, {320,240}) | |
1512 | + bgDraw(motif.tournamentbgdef.bg, false) | |
1070 | 1513 | |
1071 | 1514 | --draw layerno = 1 backgrounds |
1072 | - main.f_drawBG(motif.tournamentbgdef.bg_data, motif.tournamentbgdef.bg, 1, motif.tournamentbgdef.timer, {320,240}) | |
1073 | - --draw fadein | |
1074 | - animDraw(motif.tournament_info.fadein_data) | |
1075 | - animUpdate(motif.tournament_info.fadein_data) | |
1076 | - --update timer | |
1077 | - motif.tournamentbgdef.timer = motif.tournamentbgdef.timer + 1 | |
1078 | - --end loop | |
1079 | - main.f_cmdInput() | |
1515 | + bgDraw(motif.tournamentbgdef.bg, true) | |
1516 | + --draw fadein / fadeout | |
1517 | + main.fadeActive = fadeScreen( | |
1518 | + fadeType, | |
1519 | + main.fadeStart, | |
1520 | + motif.vs_screen[fadeType .. '_time'], | |
1521 | + motif.vs_screen[fadeType .. '_col'][1], | |
1522 | + motif.vs_screen[fadeType .. '_col'][2], | |
1523 | + motif.vs_screen[fadeType .. '_col'][3] | |
1524 | + ) | |
1525 | + --frame transition | |
1526 | + if main.fadeActive then | |
1527 | + commandBufReset(main.p1Cmd) | |
1528 | + elseif fadeType == 'fadeout' then | |
1529 | + commandBufReset(main.p1Cmd) | |
1530 | + return --skip last frame rendering | |
1531 | + else | |
1532 | + main.f_cmdInput() | |
1533 | + end | |
1080 | 1534 | refresh() |
1081 | 1535 | end |
1082 | 1536 |
@@ -1094,34 +1548,44 @@ local txt_p1Name = main.f_createTextImg( | ||
1094 | 1548 | motif.select_info.p1_name_font_scale[2], |
1095 | 1549 | motif.select_info.p1_name_font[4], |
1096 | 1550 | motif.select_info.p1_name_font[5], |
1097 | - motif.select_info.p1_name_font[6] | |
1551 | + motif.select_info.p1_name_font[6], | |
1552 | + motif.select_info.p1_name_font[7], | |
1553 | + motif.select_info.p1_name_font[8] | |
1098 | 1554 | ) |
1099 | - | |
1100 | 1555 | local p1RandomCount = 0 |
1101 | 1556 | local p1RandomPortrait = 0 |
1102 | 1557 | if #main.t_randomChars > 0 then p1RandomPortrait = main.t_randomChars[math.random(1, #main.t_randomChars)] end |
1103 | 1558 | local txt_p2Name = main.f_createTextImg( |
1104 | - motif.font_data[motif.select_info.p2_name_font[1]], | |
1105 | - motif.select_info.p2_name_font[2], | |
1106 | - motif.select_info.p2_name_font[3], | |
1107 | - '', | |
1108 | - 0, | |
1109 | - 0, | |
1559 | + motif.font_data[motif.select_info.p2_name_font[1]], | |
1560 | + motif.select_info.p2_name_font[2], | |
1561 | + motif.select_info.p2_name_font[3], | |
1562 | + '', | |
1563 | + 0, | |
1564 | + 0, | |
1110 | 1565 | motif.select_info.p2_name_font_scale[1], |
1111 | 1566 | motif.select_info.p2_name_font_scale[2], |
1112 | 1567 | motif.select_info.p2_name_font[4], |
1113 | 1568 | motif.select_info.p2_name_font[5], |
1114 | - motif.select_info.p2_name_font[6] | |
1569 | + motif.select_info.p2_name_font[6], | |
1570 | + motif.select_info.p2_name_font[7], | |
1571 | + motif.select_info.p2_name_font[8] | |
1115 | 1572 | ) |
1116 | 1573 | local p2RandomCount = 0 |
1117 | 1574 | local p2RandomPortrait = 0 |
1118 | 1575 | if #main.t_randomChars > 0 then p2RandomPortrait = main.t_randomChars[math.random(1, #main.t_randomChars)] end |
1119 | 1576 | |
1577 | +function select.f_alignOffset(align) | |
1578 | + if align == -1 then | |
1579 | + return 1 --fix for wrong offset after flipping sprites | |
1580 | + end | |
1581 | + return 0 | |
1582 | +end | |
1583 | + | |
1120 | 1584 | function select.f_selectScreen() |
1121 | 1585 | --draw clearcolor |
1122 | - animDraw(motif.selectbgdef.bgclearcolor_data) | |
1586 | + clearColor(motif.selectbgdef.bgclearcolor[1], motif.selectbgdef.bgclearcolor[2], motif.selectbgdef.bgclearcolor[3]) | |
1123 | 1587 | --draw layerno = 0 backgrounds |
1124 | - main.f_drawBG(motif.selectbgdef.bg_data, motif.selectbgdef.bg, 0, motif.selectbgdef.timer, {320,240}) | |
1588 | + bgDraw(motif.selectbgdef.bg, false) | |
1125 | 1589 | --draw title |
1126 | 1590 | textImgDraw(main.txt_mainSelect) |
1127 | 1591 | if p1Cell then |
@@ -1136,28 +1600,26 @@ function select.f_selectScreen() | ||
1136 | 1600 | p1RandomCount = 0 |
1137 | 1601 | end |
1138 | 1602 | sndPlay(motif.files.snd_data, motif.select_info.p1_random_move_snd[1], motif.select_info.p1_random_move_snd[2]) |
1139 | - t_portrait[1] = {cel = p1RandomPortrait} | |
1603 | + t_portrait[1] = p1RandomPortrait | |
1140 | 1604 | elseif main.t_selChars[p1Cell + 1].hidden ~= 2 then |
1141 | - t_portrait[1] = {cel = p1Cell} | |
1605 | + t_portrait[1] = p1Cell | |
1142 | 1606 | end |
1143 | 1607 | end |
1144 | 1608 | for i = #t_p1Selected, 1, -1 do |
1145 | - if motif.select_info.p1_face_num > #t_portrait then | |
1146 | - t_portrait[#t_portrait + 1] = {cel = t_p1Selected[i].cel} | |
1147 | - end | |
1148 | - end | |
1149 | - select.f_drawPortrait( | |
1150 | - main.f_reversedTable(t_portrait), | |
1151 | - motif.select_info.p1_face_offset[1], | |
1152 | - motif.select_info.p1_face_offset[2], | |
1153 | - motif.select_info.p1_face_facing, | |
1154 | - motif.select_info.p1_face_scale[1], | |
1155 | - motif.select_info.p1_face_scale[2], | |
1156 | - motif.select_info.p1_face_spacing[1], | |
1157 | - motif.select_info.p1_face_spacing[2], | |
1158 | - #t_portrait, | |
1159 | - 'select' | |
1160 | - ) | |
1609 | + if #t_portrait < motif.select_info.p1_face_num then | |
1610 | + table.insert(t_portrait, t_p1Selected[i].cel) | |
1611 | + end | |
1612 | + end | |
1613 | + t_portrait = main.f_reversedTable(t_portrait) | |
1614 | + for n = #t_portrait, 1, -1 do | |
1615 | + drawPortrait( | |
1616 | + t_portrait[n], | |
1617 | + motif.select_info.p1_face_offset[1] + motif.select_info['p1_c' .. n .. '_face_offset'][1] + (n - 1) * motif.select_info.p1_face_spacing[1] + select.f_alignOffset(motif.select_info.p1_face_facing), | |
1618 | + motif.select_info.p1_face_offset[2] + motif.select_info['p1_c' .. n .. '_face_offset'][2] + (n - 1) * motif.select_info.p1_face_spacing[2], | |
1619 | + motif.select_info.p1_face_facing * motif.select_info.p1_face_scale[1] * motif.select_info['p1_c' .. n .. '_face_scale'][1], | |
1620 | + motif.select_info.p1_face_scale[2] * motif.select_info['p1_c' .. n .. '_face_scale'][2] | |
1621 | + ) | |
1622 | + end | |
1161 | 1623 | end |
1162 | 1624 | if p2Cell then |
1163 | 1625 | --draw p2 portrait |
@@ -1171,28 +1633,26 @@ function select.f_selectScreen() | ||
1171 | 1633 | p2RandomCount = 0 |
1172 | 1634 | end |
1173 | 1635 | sndPlay(motif.files.snd_data, motif.select_info.p2_random_move_snd[1], motif.select_info.p2_random_move_snd[2]) |
1174 | - t_portrait[1] = {cel = p2RandomPortrait} | |
1636 | + t_portrait[1] = p2RandomPortrait | |
1175 | 1637 | elseif main.t_selChars[p2Cell + 1].hidden ~= 2 then |
1176 | - t_portrait[1] = {cel = p2Cell} | |
1638 | + t_portrait[1] = p2Cell | |
1177 | 1639 | end |
1178 | 1640 | end |
1179 | 1641 | for i = #t_p2Selected, 1, -1 do |
1180 | - if motif.select_info.p2_face_num > #t_portrait then | |
1181 | - t_portrait[#t_portrait + 1] = {cel = t_p2Selected[i].cel} | |
1182 | - end | |
1183 | - end | |
1184 | - select.f_drawPortrait( | |
1185 | - main.f_reversedTable(t_portrait), | |
1186 | - motif.select_info.p2_face_offset[1], | |
1187 | - motif.select_info.p2_face_offset[2], | |
1188 | - motif.select_info.p2_face_facing, | |
1189 | - motif.select_info.p2_face_scale[1], | |
1190 | - motif.select_info.p2_face_scale[2], | |
1191 | - motif.select_info.p2_face_spacing[1], | |
1192 | - motif.select_info.p2_face_spacing[2], | |
1193 | - #t_portrait, | |
1194 | - 'select' | |
1195 | - ) | |
1642 | + if #t_portrait < motif.select_info.p2_face_num then | |
1643 | + table.insert(t_portrait, t_p2Selected[i].cel) | |
1644 | + end | |
1645 | + end | |
1646 | + t_portrait = main.f_reversedTable(t_portrait) | |
1647 | + for n = #t_portrait, 1, -1 do | |
1648 | + drawPortrait( | |
1649 | + t_portrait[n], | |
1650 | + motif.select_info.p2_face_offset[1] + motif.select_info['p2_c' .. n .. '_face_offset'][1] + (n - 1) * motif.select_info.p2_face_spacing[1] + select.f_alignOffset(motif.select_info.p2_face_facing), | |
1651 | + motif.select_info.p2_face_offset[2] + motif.select_info['p2_c' .. n .. '_face_offset'][2] + (n - 1) * motif.select_info.p2_face_spacing[2], | |
1652 | + motif.select_info.p2_face_facing * motif.select_info.p2_face_scale[1] * motif.select_info['p2_c' .. n .. '_face_scale'][1], | |
1653 | + motif.select_info.p2_face_scale[2] * motif.select_info['p2_c' .. n .. '_face_scale'][2] | |
1654 | + ) | |
1655 | + end | |
1196 | 1656 | end |
1197 | 1657 | --draw cell art (slow for large rosters, this will be likely moved to 'drawFace' function in future) |
1198 | 1658 | for i = 1, #select.t_drawFace do |
@@ -1302,19 +1762,33 @@ function select.f_selectScreen() | ||
1302 | 1762 | elseif main.coop and not coopEnd then |
1303 | 1763 | coopEnd = true |
1304 | 1764 | p2TeamEnd = false |
1305 | - else | |
1765 | + elseif fadeType == 'fadein' then | |
1766 | + main.fadeStart = getFrameCount() | |
1767 | + fadeType = 'fadeout' | |
1768 | + elseif not main.fadeActive then | |
1306 | 1769 | selScreenEnd = true |
1307 | 1770 | end |
1308 | 1771 | end |
1309 | 1772 | --draw layerno = 1 backgrounds |
1310 | - main.f_drawBG(motif.selectbgdef.bg_data, motif.selectbgdef.bg, 1, motif.selectbgdef.timer, {320,240}) | |
1311 | - --draw fadein | |
1312 | - animDraw(motif.select_info.fadein_data) | |
1313 | - animUpdate(motif.select_info.fadein_data) | |
1314 | - --update timer | |
1315 | - motif.selectbgdef.timer = motif.selectbgdef.timer + 1 | |
1316 | - --end loop | |
1317 | - main.f_cmdInput() | |
1773 | + bgDraw(motif.selectbgdef.bg, true) | |
1774 | + --draw fadein / fadeout | |
1775 | + main.fadeActive = fadeScreen( | |
1776 | + fadeType, | |
1777 | + main.fadeStart, | |
1778 | + motif.select_info[fadeType .. '_time'], | |
1779 | + motif.select_info[fadeType .. '_col'][1], | |
1780 | + motif.select_info[fadeType .. '_col'][2], | |
1781 | + motif.select_info[fadeType .. '_col'][3] | |
1782 | + ) | |
1783 | + --frame transition | |
1784 | + if main.fadeActive then | |
1785 | + commandBufReset(main.p1Cmd) | |
1786 | + elseif fadeType == 'fadeout' then | |
1787 | + commandBufReset(main.p1Cmd) | |
1788 | + return --skip last frame rendering | |
1789 | + else | |
1790 | + main.f_cmdInput() | |
1791 | + end | |
1318 | 1792 | refresh() |
1319 | 1793 | end |
1320 | 1794 |
@@ -1332,7 +1806,9 @@ local txt_p1TeamSelfTitle = main.f_createTextImg( | ||
1332 | 1806 | motif.select_info.p1_teammenu_selftitle_font_scale[2], |
1333 | 1807 | motif.select_info.p1_teammenu_selftitle_font[4], |
1334 | 1808 | motif.select_info.p1_teammenu_selftitle_font[5], |
1335 | - motif.select_info.p1_teammenu_selftitle_font[6] | |
1809 | + motif.select_info.p1_teammenu_selftitle_font[6], | |
1810 | + motif.select_info.p1_teammenu_selftitle_font[7], | |
1811 | + motif.select_info.p1_teammenu_selftitle_font[8] | |
1336 | 1812 | ) |
1337 | 1813 | local txt_p1TeamEnemyTitle = main.f_createTextImg( |
1338 | 1814 | motif.font_data[motif.select_info.p1_teammenu_enemytitle_font[1]], |
@@ -1345,56 +1821,21 @@ local txt_p1TeamEnemyTitle = main.f_createTextImg( | ||
1345 | 1821 | motif.select_info.p1_teammenu_enemytitle_font_scale[2], |
1346 | 1822 | motif.select_info.p1_teammenu_enemytitle_font[4], |
1347 | 1823 | motif.select_info.p1_teammenu_enemytitle_font[5], |
1348 | - motif.select_info.p1_teammenu_enemytitle_font[6] | |
1824 | + motif.select_info.p1_teammenu_enemytitle_font[6], | |
1825 | + motif.select_info.p1_teammenu_enemytitle_font[7], | |
1826 | + motif.select_info.p1_teammenu_enemytitle_font[8] | |
1349 | 1827 | ) |
1350 | 1828 | |
1351 | --- Legacy TAG check and mode enabing | |
1352 | -function main.GetTeamMenu() | |
1353 | - local temptag789TeamMenu = {} | |
1354 | - local tempPos = 1 | |
1355 | - | |
1356 | - -- Single mode check | |
1357 | - if config.SingleTeamMode == true then | |
1358 | - temptag789TeamMenu[1] = {data = textImgNew(), itemname = 'single', displayname = motif.select_info.teammenu_itemname_single} | |
1359 | - tempPos = tempPos + 1 | |
1360 | - end | |
1361 | - | |
1362 | - if config.SimulMode then | |
1363 | - -- Simul mode check | |
1364 | - if config.NumSimul > 1 then | |
1365 | - temptag789TeamMenu[tempPos] = {data = textImgNew(), itemname = 'simul', displayname = motif.select_info.teammenu_itemname_simul} | |
1366 | - tempPos = tempPos + 1 | |
1367 | - end | |
1368 | - -- Tag mode check | |
1369 | - if config.NumTag > 1 then | |
1370 | - temptag789TeamMenu[tempPos] = {data = textImgNew(), itemname = 'tag', displayname = motif.select_info.teammenu_itemname_tag} | |
1371 | - tempPos = tempPos + 1 | |
1372 | - end | |
1373 | - else | |
1374 | - -- Legacy Tag mode enable | |
1375 | - temptag789TeamMenu[tempPos] = {data = textImgNew(), itemname = 'simul', displayname = motif.select_info.teammenu_itemname_tag} | |
1376 | - tempPos = tempPos + 1 | |
1377 | - end | |
1378 | - | |
1379 | - -- Turns mode check | |
1380 | - if config.NumTurns > 1 then | |
1381 | - temptag789TeamMenu[tempPos] = {data = textImgNew(), itemname = 'turns', displayname = motif.select_info.teammenu_itemname_turns} | |
1382 | - end | |
1383 | - | |
1384 | - return temptag789TeamMenu | |
1385 | -end | |
1386 | - | |
1387 | --- Set tag mode | |
1388 | -local t_p1TeamMenu = main.GetTeamMenu() | |
1389 | -t_p1TeamMenu = main.f_cleanTable(t_p1TeamMenu) | |
1829 | +select.t_p1TeamMenu = select.f_getTeamMenu() | |
1830 | +select.t_p1TeamMenu = main.f_cleanTable(select.t_p1TeamMenu, main.t_sort.select_info) | |
1390 | 1831 | |
1391 | 1832 | local p1TeamActiveCount = 0 |
1392 | 1833 | local p1TeamActiveFont = 'p1_teammenu_item_active_font' |
1393 | 1834 | |
1394 | 1835 | function select.f_p1TeamMenu() |
1395 | 1836 | if main.p1TeamMenu ~= nil then --Predefined team |
1396 | - p1NumChars = main.p1TeamMenu.chars | |
1397 | 1837 | p1TeamMode = main.p1TeamMenu.mode |
1838 | + p1NumChars = main.p1TeamMenu.chars | |
1398 | 1839 | setTeamMode(1, p1TeamMode, p1NumChars) |
1399 | 1840 | p1TeamEnd = true |
1400 | 1841 | else |
@@ -1405,17 +1846,17 @@ function select.f_p1TeamMenu() | ||
1405 | 1846 | p1TeamMenu = p1TeamMenu - 1 |
1406 | 1847 | elseif motif.select_info.teammenu_move_wrapping == 1 then |
1407 | 1848 | sndPlay(motif.files.snd_data, motif.select_info.p1_teammenu_move_snd[1], motif.select_info.p1_teammenu_move_snd[2]) |
1408 | - p1TeamMenu = #t_p1TeamMenu | |
1849 | + p1TeamMenu = #select.t_p1TeamMenu | |
1409 | 1850 | end |
1410 | 1851 | elseif commandGetState(main.p1Cmd, 'd') then |
1411 | - if p1TeamMenu + 1 <= #t_p1TeamMenu then | |
1852 | + if p1TeamMenu + 1 <= #select.t_p1TeamMenu then | |
1412 | 1853 | sndPlay(motif.files.snd_data, motif.select_info.p1_teammenu_move_snd[1], motif.select_info.p1_teammenu_move_snd[2]) |
1413 | 1854 | p1TeamMenu = p1TeamMenu + 1 |
1414 | 1855 | elseif motif.select_info.teammenu_move_wrapping == 1 then |
1415 | 1856 | sndPlay(motif.files.snd_data, motif.select_info.p1_teammenu_move_snd[1], motif.select_info.p1_teammenu_move_snd[2]) |
1416 | 1857 | p1TeamMenu = 1 |
1417 | 1858 | end |
1418 | - elseif t_p1TeamMenu[p1TeamMenu].itemname == 'simul' then | |
1859 | + elseif select.t_p1TeamMenu[p1TeamMenu].itemname == 'simul' then | |
1419 | 1860 | if commandGetState(main.p1Cmd, 'l') then |
1420 | 1861 | if p1NumSimul - 1 >= 2 then |
1421 | 1862 | sndPlay(motif.files.snd_data, motif.select_info.p1_teammenu_value_snd[1], motif.select_info.p1_teammenu_value_snd[2]) |
@@ -1427,9 +1868,9 @@ function select.f_p1TeamMenu() | ||
1427 | 1868 | p1NumSimul = p1NumSimul + 1 |
1428 | 1869 | end |
1429 | 1870 | end |
1430 | - elseif t_p1TeamMenu[p1TeamMenu].itemname == 'turns' then | |
1871 | + elseif select.t_p1TeamMenu[p1TeamMenu].itemname == 'turns' then | |
1431 | 1872 | if commandGetState(main.p1Cmd, 'l') then |
1432 | - if p1NumTurns - 1 >= 2 then | |
1873 | + if p1NumTurns - 1 >= 1 then | |
1433 | 1874 | sndPlay(motif.files.snd_data, motif.select_info.p1_teammenu_value_snd[1], motif.select_info.p1_teammenu_value_snd[2]) |
1434 | 1875 | p1NumTurns = p1NumTurns - 1 |
1435 | 1876 | end |
@@ -1439,7 +1880,7 @@ function select.f_p1TeamMenu() | ||
1439 | 1880 | p1NumTurns = p1NumTurns + 1 |
1440 | 1881 | end |
1441 | 1882 | end |
1442 | - elseif t_p1TeamMenu[p1TeamMenu].itemname == 'tag' then | |
1883 | + elseif select.t_p1TeamMenu[p1TeamMenu].itemname == 'tag' then | |
1443 | 1884 | if commandGetState(main.p1Cmd, 'l') then |
1444 | 1885 | if p1NumTag - 1 >= 2 then |
1445 | 1886 | sndPlay(motif.files.snd_data, motif.select_info.p1_teammenu_value_snd[1], motif.select_info.p1_teammenu_value_snd[2]) |
@@ -1465,7 +1906,7 @@ function select.f_p1TeamMenu() | ||
1465 | 1906 | animUpdate(motif.select_info.p1_teammenu_selftitle_data) |
1466 | 1907 | animDraw(motif.select_info.p1_teammenu_selftitle_data) |
1467 | 1908 | textImgDraw(txt_p1TeamSelfTitle) |
1468 | - for i = 1, #t_p1TeamMenu do | |
1909 | + for i = 1, #select.t_p1TeamMenu do | |
1469 | 1910 | if i == p1TeamMenu then |
1470 | 1911 | if p1TeamActiveCount < 2 then --delay change |
1471 | 1912 | p1TeamActiveCount = p1TeamActiveCount + 1 |
@@ -1478,38 +1919,42 @@ function select.f_p1TeamMenu() | ||
1478 | 1919 | end |
1479 | 1920 | --Draw team active font |
1480 | 1921 | textImgDraw(main.f_updateTextImg( |
1481 | - t_p1TeamMenu[i].data, | |
1922 | + select.t_p1TeamMenu[i].data, | |
1482 | 1923 | motif.font_data[motif.select_info[p1TeamActiveFont][1]], |
1483 | 1924 | motif.select_info[p1TeamActiveFont][2], |
1484 | - motif.select_info.p1_teammenu_item_font[3], --mugen ignores active font facing | |
1485 | - t_p1TeamMenu[i].displayname, | |
1925 | + motif.select_info[p1TeamActiveFont][3], --p1_teammenu_item_font (winmugen ignores active font facing? Fixed in mugen 1.0) | |
1926 | + select.t_p1TeamMenu[i].displayname, | |
1486 | 1927 | motif.select_info.p1_teammenu_pos[1] + motif.select_info.p1_teammenu_item_offset[1] + motif.select_info.p1_teammenu_item_font_offset[1] + (i - 1) * motif.select_info.p1_teammenu_item_spacing[1], |
1487 | 1928 | motif.select_info.p1_teammenu_pos[2] + motif.select_info.p1_teammenu_item_offset[2] + motif.select_info.p1_teammenu_item_font_offset[2] + (i - 1) * motif.select_info.p1_teammenu_item_spacing[2], |
1488 | 1929 | motif.select_info[p1TeamActiveFont .. '_scale'][1], |
1489 | 1930 | motif.select_info[p1TeamActiveFont .. '_scale'][2], |
1490 | 1931 | motif.select_info[p1TeamActiveFont][4], |
1491 | 1932 | motif.select_info[p1TeamActiveFont][5], |
1492 | - motif.select_info[p1TeamActiveFont][6] | |
1933 | + motif.select_info[p1TeamActiveFont][6], | |
1934 | + motif.select_info[p1TeamActiveFont][7], | |
1935 | + motif.select_info[p1TeamActiveFont][8] | |
1493 | 1936 | )) |
1494 | 1937 | else |
1495 | 1938 | --Draw team not active font |
1496 | 1939 | textImgDraw(main.f_updateTextImg( |
1497 | - t_p1TeamMenu[i].data, | |
1940 | + select.t_p1TeamMenu[i].data, | |
1498 | 1941 | motif.font_data[motif.select_info.p1_teammenu_item_font[1]], |
1499 | 1942 | motif.select_info.p1_teammenu_item_font[2], |
1500 | 1943 | motif.select_info.p1_teammenu_item_font[3], |
1501 | - t_p1TeamMenu[i].displayname, | |
1944 | + select.t_p1TeamMenu[i].displayname, | |
1502 | 1945 | motif.select_info.p1_teammenu_pos[1] + motif.select_info.p1_teammenu_item_offset[1] + motif.select_info.p1_teammenu_item_font_offset[1] + (i - 1) * motif.select_info.p1_teammenu_item_spacing[1], |
1503 | 1946 | motif.select_info.p1_teammenu_pos[2] + motif.select_info.p1_teammenu_item_offset[2] + motif.select_info.p1_teammenu_item_font_offset[2] + (i - 1) * motif.select_info.p1_teammenu_item_spacing[2], |
1504 | 1947 | motif.select_info.p1_teammenu_item_font_scale[1], |
1505 | 1948 | motif.select_info.p1_teammenu_item_font_scale[2], |
1506 | 1949 | motif.select_info.p1_teammenu_item_font[4], |
1507 | 1950 | motif.select_info.p1_teammenu_item_font[5], |
1508 | - motif.select_info.p1_teammenu_item_font[6] | |
1951 | + motif.select_info.p1_teammenu_item_font[6], | |
1952 | + motif.select_info.p1_teammenu_item_font[7], | |
1953 | + motif.select_info.p1_teammenu_item_font[8] | |
1509 | 1954 | )) |
1510 | 1955 | end |
1511 | 1956 | --Draw team icons |
1512 | - if t_p1TeamMenu[i].itemname == 'simul' then | |
1957 | + if select.t_p1TeamMenu[i].itemname == 'simul' then | |
1513 | 1958 | for j = 1, config.NumSimul do |
1514 | 1959 | if j <= p1NumSimul then |
1515 | 1960 | main.f_animPosDraw( |
@@ -1525,7 +1970,7 @@ function select.f_p1TeamMenu() | ||
1525 | 1970 | ) |
1526 | 1971 | end |
1527 | 1972 | end |
1528 | - elseif t_p1TeamMenu[i].itemname == 'turns' then | |
1973 | + elseif select.t_p1TeamMenu[i].itemname == 'turns' then | |
1529 | 1974 | for j = 1, config.NumTurns do |
1530 | 1975 | if j <= p1NumTurns then |
1531 | 1976 | main.f_animPosDraw( |
@@ -1541,7 +1986,7 @@ function select.f_p1TeamMenu() | ||
1541 | 1986 | ) |
1542 | 1987 | end |
1543 | 1988 | end |
1544 | - elseif t_p1TeamMenu[i].itemname == 'tag' then | |
1989 | + elseif select.t_p1TeamMenu[i].itemname == 'tag' then | |
1545 | 1990 | for j = 1, config.NumTag do |
1546 | 1991 | if j <= p1NumTag then |
1547 | 1992 | main.f_animPosDraw( |
@@ -1562,16 +2007,16 @@ function select.f_p1TeamMenu() | ||
1562 | 2007 | --Confirmed team selection |
1563 | 2008 | if main.f_btnPalNo(main.p1Cmd) > 0 then |
1564 | 2009 | sndPlay(motif.files.snd_data, motif.select_info.p1_teammenu_done_snd[1], motif.select_info.p1_teammenu_done_snd[2]) |
1565 | - if t_p1TeamMenu[p1TeamMenu].itemname == 'single' then | |
2010 | + if select.t_p1TeamMenu[p1TeamMenu].itemname == 'single' then | |
1566 | 2011 | p1TeamMode = 0 |
1567 | 2012 | p1NumChars = 1 |
1568 | - elseif t_p1TeamMenu[p1TeamMenu].itemname == 'simul' then | |
2013 | + elseif select.t_p1TeamMenu[p1TeamMenu].itemname == 'simul' then | |
1569 | 2014 | p1TeamMode = 1 |
1570 | 2015 | p1NumChars = p1NumSimul |
1571 | - elseif t_p1TeamMenu[p1TeamMenu].itemname == 'turns' then | |
2016 | + elseif select.t_p1TeamMenu[p1TeamMenu].itemname == 'turns' then | |
1572 | 2017 | p1TeamMode = 2 |
1573 | 2018 | p1NumChars = p1NumTurns |
1574 | - elseif t_p1TeamMenu[p1TeamMenu].itemname == 'tag' then | |
2019 | + elseif select.t_p1TeamMenu[p1TeamMenu].itemname == 'tag' then | |
1575 | 2020 | p1TeamMode = 3 |
1576 | 2021 | p1NumChars = p1NumTag |
1577 | 2022 | end |
@@ -1596,7 +2041,9 @@ local txt_p2TeamSelfTitle = main.f_createTextImg( | ||
1596 | 2041 | motif.select_info.p2_teammenu_selftitle_font_scale[2], |
1597 | 2042 | motif.select_info.p2_teammenu_selftitle_font[4], |
1598 | 2043 | motif.select_info.p2_teammenu_selftitle_font[5], |
1599 | - motif.select_info.p2_teammenu_selftitle_font[6] | |
2044 | + motif.select_info.p2_teammenu_selftitle_font[6], | |
2045 | + motif.select_info.p2_teammenu_selftitle_font[7], | |
2046 | + motif.select_info.p2_teammenu_selftitle_font[8] | |
1600 | 2047 | ) |
1601 | 2048 | local txt_p2TeamEnemyTitle = main.f_createTextImg( |
1602 | 2049 | motif.font_data[motif.select_info.p2_teammenu_enemytitle_font[1]], |
@@ -1609,20 +2056,21 @@ local txt_p2TeamEnemyTitle = main.f_createTextImg( | ||
1609 | 2056 | motif.select_info.p2_teammenu_enemytitle_font_scale[2], |
1610 | 2057 | motif.select_info.p2_teammenu_enemytitle_font[4], |
1611 | 2058 | motif.select_info.p2_teammenu_enemytitle_font[5], |
1612 | - motif.select_info.p2_teammenu_enemytitle_font[6] | |
2059 | + motif.select_info.p2_teammenu_enemytitle_font[6], | |
2060 | + motif.select_info.p2_teammenu_enemytitle_font[7], | |
2061 | + motif.select_info.p2_teammenu_enemytitle_font[8] | |
1613 | 2062 | ) |
1614 | 2063 | |
1615 | --- Set tag mode | |
1616 | -local t_p2TeamMenu = main.GetTeamMenu() | |
1617 | -t_p2TeamMenu = main.f_cleanTable(t_p2TeamMenu) | |
2064 | +select.t_p2TeamMenu = select.f_getTeamMenu() | |
2065 | +select.t_p2TeamMenu = main.f_cleanTable(select.t_p2TeamMenu, main.t_sort.select_info) | |
1618 | 2066 | |
1619 | 2067 | local p2TeamActiveCount = 0 |
1620 | 2068 | local p2TeamActiveFont = 'p2_teammenu_item_active_font' |
1621 | 2069 | |
1622 | 2070 | function select.f_p2TeamMenu() |
1623 | 2071 | if main.p2TeamMenu ~= nil then --Predefined team |
1624 | - p2NumChars = main.p2TeamMenu.chars | |
1625 | 2072 | p2TeamMode = main.p2TeamMenu.mode |
2073 | + p2NumChars = main.p2TeamMenu.chars | |
1626 | 2074 | setTeamMode(2, p2TeamMode, p2NumChars) |
1627 | 2075 | p2TeamEnd = true |
1628 | 2076 | else |
@@ -1638,17 +2086,17 @@ function select.f_p2TeamMenu() | ||
1638 | 2086 | p2TeamMenu = p2TeamMenu - 1 |
1639 | 2087 | elseif motif.select_info.teammenu_move_wrapping == 1 then |
1640 | 2088 | sndPlay(motif.files.snd_data, motif.select_info.p2_teammenu_move_snd[1], motif.select_info.p2_teammenu_move_snd[2]) |
1641 | - p2TeamMenu = #t_p2TeamMenu | |
2089 | + p2TeamMenu = #select.t_p2TeamMenu | |
1642 | 2090 | end |
1643 | 2091 | elseif commandGetState(cmd, 'd') then |
1644 | - if p2TeamMenu + 1 <= #t_p2TeamMenu then | |
2092 | + if p2TeamMenu + 1 <= #select.t_p2TeamMenu then | |
1645 | 2093 | sndPlay(motif.files.snd_data, motif.select_info.p2_teammenu_move_snd[1], motif.select_info.p2_teammenu_move_snd[2]) |
1646 | 2094 | p2TeamMenu = p2TeamMenu + 1 |
1647 | 2095 | elseif motif.select_info.teammenu_move_wrapping == 1 then |
1648 | 2096 | sndPlay(motif.files.snd_data, motif.select_info.p2_teammenu_move_snd[1], motif.select_info.p2_teammenu_move_snd[2]) |
1649 | 2097 | p2TeamMenu = 1 |
1650 | 2098 | end |
1651 | - elseif t_p2TeamMenu[p2TeamMenu].itemname == 'simul' then | |
2099 | + elseif select.t_p2TeamMenu[p2TeamMenu].itemname == 'simul' then | |
1652 | 2100 | if commandGetState(cmd, 'r') then |
1653 | 2101 | if p2NumSimul - 1 >= 2 then |
1654 | 2102 | sndPlay(motif.files.snd_data, motif.select_info.p2_teammenu_value_snd[1], motif.select_info.p2_teammenu_value_snd[2]) |
@@ -1660,9 +2108,9 @@ function select.f_p2TeamMenu() | ||
1660 | 2108 | p2NumSimul = p2NumSimul + 1 |
1661 | 2109 | end |
1662 | 2110 | end |
1663 | - elseif t_p2TeamMenu[p2TeamMenu].itemname == 'turns' then | |
2111 | + elseif select.t_p2TeamMenu[p2TeamMenu].itemname == 'turns' then | |
1664 | 2112 | if commandGetState(cmd, 'r') then |
1665 | - if p2NumTurns - 1 >= 2 then | |
2113 | + if p2NumTurns - 1 >= 1 then | |
1666 | 2114 | sndPlay(motif.files.snd_data, motif.select_info.p2_teammenu_value_snd[1], motif.select_info.p2_teammenu_value_snd[2]) |
1667 | 2115 | p2NumTurns = p2NumTurns - 1 |
1668 | 2116 | end |
@@ -1672,7 +2120,7 @@ function select.f_p2TeamMenu() | ||
1672 | 2120 | p2NumTurns = p2NumTurns + 1 |
1673 | 2121 | end |
1674 | 2122 | end |
1675 | - elseif t_p2TeamMenu[p2TeamMenu].itemname == 'tag' then | |
2123 | + elseif select.t_p2TeamMenu[p2TeamMenu].itemname == 'tag' then | |
1676 | 2124 | if commandGetState(cmd, 'r') then |
1677 | 2125 | if p2NumTag - 1 >= 2 then |
1678 | 2126 | sndPlay(motif.files.snd_data, motif.select_info.p2_teammenu_value_snd[1], motif.select_info.p2_teammenu_value_snd[2]) |
@@ -1704,7 +2152,7 @@ function select.f_p2TeamMenu() | ||
1704 | 2152 | animDraw(motif.select_info.p2_teammenu_selftitle_data) |
1705 | 2153 | textImgDraw(txt_p2TeamSelfTitle) |
1706 | 2154 | end |
1707 | - for i = 1, #t_p2TeamMenu do | |
2155 | + for i = 1, #select.t_p2TeamMenu do | |
1708 | 2156 | if i == p2TeamMenu then |
1709 | 2157 | if p2TeamActiveCount < 2 then --delay change |
1710 | 2158 | p2TeamActiveCount = p2TeamActiveCount + 1 |
@@ -1717,38 +2165,42 @@ function select.f_p2TeamMenu() | ||
1717 | 2165 | end |
1718 | 2166 | --Draw team active font |
1719 | 2167 | textImgDraw(main.f_updateTextImg( |
1720 | - t_p2TeamMenu[i].data, | |
2168 | + select.t_p2TeamMenu[i].data, | |
1721 | 2169 | motif.font_data[motif.select_info[p2TeamActiveFont][1]], |
1722 | 2170 | motif.select_info[p2TeamActiveFont][2], |
1723 | - motif.select_info.p2_teammenu_item_font[3], --mugen ignores active font facing | |
1724 | - t_p2TeamMenu[i].displayname, | |
2171 | + motif.select_info[p2TeamActiveFont][3], --p2_teammenu_item_font (winmugen ignores active font facing? Fixed in mugen 1.0) | |
2172 | + select.t_p2TeamMenu[i].displayname, | |
1725 | 2173 | motif.select_info.p2_teammenu_pos[1] + motif.select_info.p2_teammenu_item_offset[1] + motif.select_info.p2_teammenu_item_font_offset[1] + (i - 1) * motif.select_info.p2_teammenu_item_spacing[1], |
1726 | 2174 | motif.select_info.p2_teammenu_pos[2] + motif.select_info.p2_teammenu_item_offset[2] + motif.select_info.p2_teammenu_item_font_offset[2] + (i - 1) * motif.select_info.p2_teammenu_item_spacing[2], |
1727 | 2175 | motif.select_info[p2TeamActiveFont .. '_scale'][1], |
1728 | 2176 | motif.select_info[p2TeamActiveFont .. '_scale'][2], |
1729 | 2177 | motif.select_info[p2TeamActiveFont][4], |
1730 | 2178 | motif.select_info[p2TeamActiveFont][5], |
1731 | - motif.select_info[p2TeamActiveFont][6] | |
2179 | + motif.select_info[p2TeamActiveFont][6], | |
2180 | + motif.select_info[p2TeamActiveFont][7], | |
2181 | + motif.select_info[p2TeamActiveFont][8] | |
1732 | 2182 | )) |
1733 | 2183 | else |
1734 | 2184 | --Draw team not active font |
1735 | 2185 | textImgDraw(main.f_updateTextImg( |
1736 | - t_p2TeamMenu[i].data, | |
2186 | + select.t_p2TeamMenu[i].data, | |
1737 | 2187 | motif.font_data[motif.select_info.p2_teammenu_item_font[1]], |
1738 | 2188 | motif.select_info.p2_teammenu_item_font[2], |
1739 | 2189 | motif.select_info.p2_teammenu_item_font[3], |
1740 | - t_p2TeamMenu[i].displayname, | |
2190 | + select.t_p2TeamMenu[i].displayname, | |
1741 | 2191 | motif.select_info.p2_teammenu_pos[1] + motif.select_info.p2_teammenu_item_offset[1] + motif.select_info.p2_teammenu_item_font_offset[1] + (i - 1) * motif.select_info.p2_teammenu_item_spacing[1], |
1742 | 2192 | motif.select_info.p2_teammenu_pos[2] + motif.select_info.p2_teammenu_item_offset[2] + motif.select_info.p2_teammenu_item_font_offset[2] + (i - 1) * motif.select_info.p2_teammenu_item_spacing[2], |
1743 | 2193 | motif.select_info.p2_teammenu_item_font_scale[1], |
1744 | 2194 | motif.select_info.p2_teammenu_item_font_scale[2], |
1745 | 2195 | motif.select_info.p2_teammenu_item_font[4], |
1746 | 2196 | motif.select_info.p2_teammenu_item_font[5], |
1747 | - motif.select_info.p2_teammenu_item_font[6] | |
2197 | + motif.select_info.p2_teammenu_item_font[6], | |
2198 | + motif.select_info.p2_teammenu_item_font[7], | |
2199 | + motif.select_info.p2_teammenu_item_font[8] | |
1748 | 2200 | )) |
1749 | 2201 | end |
1750 | 2202 | --Draw team icons |
1751 | - if t_p2TeamMenu[i].itemname == 'simul' then | |
2203 | + if select.t_p2TeamMenu[i].itemname == 'simul' then | |
1752 | 2204 | for j = 1, config.NumSimul do |
1753 | 2205 | if j <= p2NumSimul then |
1754 | 2206 | main.f_animPosDraw( |
@@ -1764,7 +2216,7 @@ function select.f_p2TeamMenu() | ||
1764 | 2216 | ) |
1765 | 2217 | end |
1766 | 2218 | end |
1767 | - elseif t_p2TeamMenu[i].itemname == 'turns' then | |
2219 | + elseif select.t_p2TeamMenu[i].itemname == 'turns' then | |
1768 | 2220 | for j = 1, config.NumTurns do |
1769 | 2221 | if j <= p2NumTurns then |
1770 | 2222 | main.f_animPosDraw( |
@@ -1780,7 +2232,7 @@ function select.f_p2TeamMenu() | ||
1780 | 2232 | ) |
1781 | 2233 | end |
1782 | 2234 | end |
1783 | - elseif t_p2TeamMenu[i].itemname == 'tag' then | |
2235 | + elseif select.t_p2TeamMenu[i].itemname == 'tag' then | |
1784 | 2236 | for j = 1, config.NumTag do |
1785 | 2237 | if j <= p2NumTag then |
1786 | 2238 | main.f_animPosDraw( |
@@ -1801,16 +2253,16 @@ function select.f_p2TeamMenu() | ||
1801 | 2253 | --Confirmed team selection |
1802 | 2254 | if main.f_btnPalNo(cmd) > 0 then |
1803 | 2255 | sndPlay(motif.files.snd_data, motif.select_info.p2_teammenu_done_snd[1], motif.select_info.p2_teammenu_done_snd[2]) |
1804 | - if t_p2TeamMenu[p2TeamMenu].itemname == 'single' then | |
2256 | + if select.t_p2TeamMenu[p2TeamMenu].itemname == 'single' then | |
1805 | 2257 | p2TeamMode = 0 |
1806 | 2258 | p2NumChars = 1 |
1807 | - elseif t_p2TeamMenu[p2TeamMenu].itemname == 'simul' then | |
2259 | + elseif select.t_p2TeamMenu[p2TeamMenu].itemname == 'simul' then | |
1808 | 2260 | p2TeamMode = 1 |
1809 | 2261 | p2NumChars = p2NumSimul |
1810 | - elseif t_p2TeamMenu[p2TeamMenu].itemname == 'turns' then | |
2262 | + elseif select.t_p2TeamMenu[p2TeamMenu].itemname == 'turns' then | |
1811 | 2263 | p2TeamMode = 2 |
1812 | 2264 | p2NumChars = p2NumTurns |
1813 | - elseif t_p2TeamMenu[p2TeamMenu].itemname == 'tag' then | |
2265 | + elseif select.t_p2TeamMenu[p2TeamMenu].itemname == 'tag' then | |
1814 | 2266 | p2TeamMode = 3 |
1815 | 2267 | p2NumChars = p2NumTag |
1816 | 2268 | end |
@@ -1832,7 +2284,7 @@ function select.f_p1SelectMenu() | ||
1832 | 2284 | if t[main.p1Char[i]] == nil then |
1833 | 2285 | t[main.p1Char[i]] = '' |
1834 | 2286 | end |
1835 | - t_p1Selected[i] = {cel = main.p1Char[i], pal = select.f_randomPal(main.p1Char[i])} | |
2287 | + t_p1Selected[i] = {cel = main.p1Char[i], pal = select.f_selectPal(main.p1Char[i])} | |
1836 | 2288 | end |
1837 | 2289 | p1SelEnd = true |
1838 | 2290 | return |
@@ -1843,17 +2295,8 @@ function select.f_p1SelectMenu() | ||
1843 | 2295 | p1SelX, p1SelY, p1FaceOffset, p1RowOffset = select.f_cellMovement(p1SelX, p1SelY, main.p1Cmd, p1FaceOffset, p1RowOffset, motif.select_info.p1_cursor_move_snd) |
1844 | 2296 | p1Cell = p1SelX + motif.select_info.columns * p1SelY |
1845 | 2297 | --draw active cursor |
1846 | - -- cell.spacing type check | |
1847 | - local cursorX = 0 | |
1848 | - local cursorY = 0 | |
1849 | - if type(motif.select_info.cell_spacing) == "table" then | |
1850 | - cursorX = p1FaceX + p1SelX * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing[1]) | |
1851 | - cursorY = p1FaceY + (p1SelY - p1RowOffset) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing[2]) | |
1852 | - else | |
1853 | - cursorX = p1FaceX + p1SelX * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing) | |
1854 | - cursorY = p1FaceY + (p1SelY - p1RowOffset) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing) | |
1855 | - end | |
1856 | - | |
2298 | + local cursorX = p1FaceX + p1SelX * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing[1]) | |
2299 | + local cursorY = p1FaceY + (p1SelY - p1RowOffset) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing[2]) | |
1857 | 2300 | if resetgrid == true then |
1858 | 2301 | select.f_resetGrid() |
1859 | 2302 | end |
@@ -1867,7 +2310,7 @@ function select.f_p1SelectMenu() | ||
1867 | 2310 | if main.t_selChars[selected + 1].char == 'randomselect' or main.t_selChars[selected + 1].hidden == 3 then |
1868 | 2311 | selected = main.t_randomChars[math.random(1, #main.t_randomChars)] |
1869 | 2312 | end |
1870 | - t_p1Selected[#t_p1Selected + 1] = {cel = selected, pal = main.f_btnPalNo(main.p1Cmd), cursor = {cursorX, cursorY, p1RowOffset}} | |
2313 | + table.insert(t_p1Selected, {cel = selected, pal = main.f_btnPalNo(main.p1Cmd), cursor = {cursorX, cursorY, p1RowOffset}}) | |
1871 | 2314 | if #t_p1Selected == p1NumChars then |
1872 | 2315 | if main.p2In == 1 and matchNo == 0 then |
1873 | 2316 | p2TeamEnd = false |
@@ -1892,7 +2335,7 @@ function select.f_p2SelectMenu() | ||
1892 | 2335 | if t[main.p2Char[i]] == nil then |
1893 | 2336 | t[main.p2Char[i]] = '' |
1894 | 2337 | end |
1895 | - t_p2Selected[i] = {cel = main.p2Char[i], pal = select.f_randomPal(main.p2Char[i])} | |
2338 | + t_p2Selected[i] = {cel = main.p2Char[i], pal = select.f_selectPal(main.p2Char[i])} | |
1896 | 2339 | end |
1897 | 2340 | p2SelEnd = true |
1898 | 2341 | return |
@@ -1907,16 +2350,8 @@ function select.f_p2SelectMenu() | ||
1907 | 2350 | p2SelX, p2SelY, p2FaceOffset, p2RowOffset = select.f_cellMovement(p2SelX, p2SelY, main.p2Cmd, p2FaceOffset, p2RowOffset, motif.select_info.p2_cursor_move_snd) |
1908 | 2351 | p2Cell = p2SelX + motif.select_info.columns * p2SelY |
1909 | 2352 | --draw active cursor |
1910 | - -- cell.spacing type check | |
1911 | - local cursorX = 0 | |
1912 | - local cursorY = 0 | |
1913 | - if type(motif.select_info.cell_spacing) == "table" then | |
1914 | - cursorX = p2FaceX + p2SelX * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing[1]) | |
1915 | - cursorY = p2FaceY + (p2SelY - p2RowOffset) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing[2]) | |
1916 | - else | |
1917 | - cursorX = p2FaceX + p2SelX * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing) | |
1918 | - cursorY = p2FaceY + (p2SelY - p2RowOffset) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing) | |
1919 | - end | |
2353 | + local cursorX = p2FaceX + p2SelX * (motif.select_info.cell_size[1] + motif.select_info.cell_spacing[1]) | |
2354 | + local cursorY = p2FaceY + (p2SelY - p2RowOffset) * (motif.select_info.cell_size[2] + motif.select_info.cell_spacing[2]) | |
1920 | 2355 | if resetgrid == true then |
1921 | 2356 | select.f_resetGrid() |
1922 | 2357 | end |
@@ -1928,7 +2363,7 @@ function select.f_p2SelectMenu() | ||
1928 | 2363 | if main.t_selChars[selected + 1].char == 'randomselect' or main.t_selChars[selected + 1].hidden == 3 then |
1929 | 2364 | selected = main.t_randomChars[math.random(1, #main.t_randomChars)] |
1930 | 2365 | end |
1931 | - t_p2Selected[#t_p2Selected + 1] = {cel = selected, pal = main.f_btnPalNo(main.p2Cmd), cursor = {cursorX, cursorY, p2RowOffset}} | |
2366 | + table.insert(t_p2Selected, {cel = selected, pal = main.f_btnPalNo(main.p2Cmd), cursor = {cursorX, cursorY, p2RowOffset}}) | |
1932 | 2367 | if #t_p2Selected == p2NumChars then |
1933 | 2368 | p2SelEnd = true |
1934 | 2369 | end |
@@ -1949,34 +2384,42 @@ function select.f_stageMenu() | ||
1949 | 2384 | if commandGetState(main.p1Cmd, 'l') then |
1950 | 2385 | sndPlay(motif.files.snd_data, motif.select_info.stage_move_snd[1], motif.select_info.stage_move_snd[2]) |
1951 | 2386 | stageList = stageList - 1 |
1952 | - if stageList < 0 then stageList = #main.t_includeStage end | |
2387 | + if stageList < 0 then stageList = #main.t_includeStage[2] end | |
1953 | 2388 | elseif commandGetState(main.p1Cmd, 'r') then |
1954 | 2389 | sndPlay(motif.files.snd_data, motif.select_info.stage_move_snd[1], motif.select_info.stage_move_snd[2]) |
1955 | 2390 | stageList = stageList + 1 |
1956 | - if stageList > #main.t_includeStage then stageList = 0 end | |
2391 | + if stageList > #main.t_includeStage[2] then stageList = 0 end | |
1957 | 2392 | elseif commandGetState(main.p1Cmd, 'u') then |
1958 | 2393 | sndPlay(motif.files.snd_data, motif.select_info.stage_move_snd[1], motif.select_info.stage_move_snd[2]) |
1959 | 2394 | for i = 1, 10 do |
1960 | 2395 | stageList = stageList - 1 |
1961 | - if stageList < 0 then stageList = #main.t_includeStage end | |
2396 | + if stageList < 0 then stageList = #main.t_includeStage[2] end | |
1962 | 2397 | end |
1963 | 2398 | elseif commandGetState(main.p1Cmd, 'd') then |
1964 | 2399 | sndPlay(motif.files.snd_data, motif.select_info.stage_move_snd[1], motif.select_info.stage_move_snd[2]) |
1965 | 2400 | for i = 1, 10 do |
1966 | 2401 | stageList = stageList + 1 |
1967 | - if stageList > #main.t_includeStage then stageList = 0 end | |
1968 | - end | |
2402 | + if stageList > #main.t_includeStage[2] then stageList = 0 end | |
2403 | + end | |
2404 | + end | |
2405 | + if stageList == 0 then --draw random stage portrait loaded from screenpack SFF | |
2406 | + animUpdate(motif.select_info.stage_portrait_random_data) | |
2407 | + animDraw(motif.select_info.stage_portrait_random_data) | |
2408 | + else --draw stage portrait loaded from stage SFF | |
2409 | + drawStagePortrait( | |
2410 | + stageList, | |
2411 | + motif.select_info.stage_pos[1] + motif.select_info.stage_portrait_offset[1], | |
2412 | + motif.select_info.stage_pos[2] + motif.select_info.stage_portrait_offset[2], | |
2413 | + --[[motif.select_info.stage_portrait_facing * ]]motif.select_info.stage_portrait_scale[1], | |
2414 | + motif.select_info.stage_portrait_scale[2] | |
2415 | + ) | |
1969 | 2416 | end |
1970 | 2417 | if main.f_btnPalNo(main.p1Cmd) > 0 then |
1971 | 2418 | sndPlay(motif.files.snd_data, motif.select_info.stage_done_snd[1], motif.select_info.stage_done_snd[2]) |
1972 | 2419 | if stageList == 0 then |
1973 | - stageNo = main.t_includeStage[math.random(1, #main.t_includeStage)] | |
1974 | - setStage(stageNo) | |
1975 | - selectStage(stageNo) | |
2420 | + stageNo = main.t_includeStage[2][math.random(1, #main.t_includeStage[2])] | |
1976 | 2421 | else |
1977 | - stageNo = main.t_includeStage[stageList] | |
1978 | - setStage(stageNo) | |
1979 | - selectStage(stageNo) | |
2422 | + stageNo = main.t_includeStage[2][stageList] | |
1980 | 2423 | end |
1981 | 2424 | stageActiveFont = 'stage_done_font' |
1982 | 2425 | stageEnd = true |
@@ -1994,9 +2437,9 @@ function select.f_stageMenu() | ||
1994 | 2437 | end |
1995 | 2438 | local t_txt = {} |
1996 | 2439 | if stageList == 0 then |
1997 | - t_txt = main.f_extractText(motif.select_info.stage_text, '', 'Random') | |
2440 | + t_txt[1] = motif.select_info.stage_random_text | |
1998 | 2441 | else |
1999 | - t_txt = main.f_extractText(motif.select_info.stage_text, stageList, getStageName(main.t_includeStage[stageList]):match('^["%s]*(.-)["%s]*$')) | |
2442 | + t_txt = main.f_extractText(motif.select_info.stage_text, stageList, getStageName(main.t_includeStage[2][stageList])) | |
2000 | 2443 | end |
2001 | 2444 | for i = 1, #t_txt do |
2002 | 2445 | textImgDraw(main.f_updateTextImg( |
@@ -2011,7 +2454,9 @@ function select.f_stageMenu() | ||
2011 | 2454 | motif.select_info[stageActiveFont .. '_scale'][2], |
2012 | 2455 | motif.select_info[stageActiveFont][4], |
2013 | 2456 | motif.select_info[stageActiveFont][5], |
2014 | - motif.select_info[stageActiveFont][6] | |
2457 | + motif.select_info[stageActiveFont][6], | |
2458 | + motif.select_info[stageActiveFont][7], | |
2459 | + motif.select_info[stageActiveFont][8] | |
2015 | 2460 | )) |
2016 | 2461 | end |
2017 | 2462 | end |
@@ -2020,74 +2465,75 @@ end | ||
2020 | 2465 | --; VERSUS SCREEN |
2021 | 2466 | --;=========================================================== |
2022 | 2467 | local txt_p1NameVS = main.f_createTextImg( |
2023 | - motif.font_data[motif.vs_screen.p1_name_font[1]], | |
2024 | - motif.vs_screen.p1_name_font[2], | |
2025 | - motif.vs_screen.p1_name_font[3], | |
2026 | - '', | |
2027 | - 0, | |
2028 | - 0, | |
2029 | - motif.vs_screen.p1_name_font_scale[1], | |
2468 | + motif.font_data[motif.vs_screen.p1_name_font[1]], | |
2469 | + motif.vs_screen.p1_name_font[2], | |
2470 | + motif.vs_screen.p1_name_font[3], | |
2471 | + '', | |
2472 | + 0, | |
2473 | + 0, | |
2474 | + motif.vs_screen.p1_name_font_scale[1], | |
2030 | 2475 | motif.vs_screen.p1_name_font_scale[2], |
2031 | - motif.vs_screen.p1_name_font[4], | |
2032 | - motif.vs_screen.p1_name_font[5], | |
2033 | - motif.vs_screen.p1_name_font[6] | |
2476 | + motif.vs_screen.p1_name_font[4], | |
2477 | + motif.vs_screen.p1_name_font[5], | |
2478 | + motif.vs_screen.p1_name_font[6], | |
2479 | + motif.vs_screen.p1_name_font[7], | |
2480 | + motif.vs_screen.p1_name_font[8] | |
2481 | + | |
2034 | 2482 | ) |
2035 | 2483 | local txt_p2NameVS = main.f_createTextImg( |
2036 | - motif.font_data[motif.vs_screen.p2_name_font[1]], | |
2037 | - motif.vs_screen.p2_name_font[2], | |
2038 | - motif.vs_screen.p2_name_font[3], | |
2039 | - '', | |
2040 | - 0, | |
2041 | - 0, | |
2042 | - motif.vs_screen.p2_name_font_scale[1], | |
2484 | + motif.font_data[motif.vs_screen.p2_name_font[1]], | |
2485 | + motif.vs_screen.p2_name_font[2], | |
2486 | + motif.vs_screen.p2_name_font[3], | |
2487 | + '', | |
2488 | + 0, | |
2489 | + 0, | |
2490 | + motif.vs_screen.p2_name_font_scale[1], | |
2043 | 2491 | motif.vs_screen.p2_name_font_scale[2], |
2044 | - motif.vs_screen.p2_name_font[4], | |
2045 | - motif.vs_screen.p2_name_font[5], | |
2046 | - motif.vs_screen.p2_name_font[6] | |
2492 | + motif.vs_screen.p2_name_font[4], | |
2493 | + motif.vs_screen.p2_name_font[5], | |
2494 | + motif.vs_screen.p2_name_font[6], | |
2495 | + motif.vs_screen.p2_name_font[7], | |
2496 | + motif.vs_screen.p2_name_font[8] | |
2047 | 2497 | ) |
2048 | 2498 | local txt_matchNo = main.f_createTextImg( |
2049 | - motif.font_data[motif.vs_screen.match_font[1]], | |
2050 | - motif.vs_screen.match_font[2], | |
2051 | - motif.vs_screen.match_font[3], | |
2052 | - '', | |
2053 | - motif.vs_screen.match_offset[1], | |
2054 | - motif.vs_screen.match_offset[2], | |
2055 | - motif.vs_screen.match_font_scale[1], | |
2499 | + motif.font_data[motif.vs_screen.match_font[1]], | |
2500 | + motif.vs_screen.match_font[2], | |
2501 | + motif.vs_screen.match_font[3], | |
2502 | + '', | |
2503 | + motif.vs_screen.match_offset[1], | |
2504 | + motif.vs_screen.match_offset[2], | |
2505 | + motif.vs_screen.match_font_scale[1], | |
2056 | 2506 | motif.vs_screen.match_font_scale[2], |
2057 | - motif.vs_screen.match_font[4], | |
2058 | - motif.vs_screen.match_font[5], | |
2059 | - motif.vs_screen.match_font[6] | |
2507 | + motif.vs_screen.match_font[4], | |
2508 | + motif.vs_screen.match_font[5], | |
2509 | + motif.vs_screen.match_font[6], | |
2510 | + motif.vs_screen.match_font[7], | |
2511 | + motif.vs_screen.match_font[8] | |
2060 | 2512 | ) |
2061 | 2513 | |
2514 | +function select.f_selectChar(player, t) | |
2515 | + for i = 1, #t do | |
2516 | + selectChar(player, t[i].cel, t[i].pal) | |
2517 | + end | |
2518 | +end | |
2519 | + | |
2062 | 2520 | function select.f_selectVersus() |
2063 | - local text = main.f_extractText(motif.vs_screen.match_text, matchNo) | |
2064 | - textImgSetText(txt_matchNo, text[1]) | |
2065 | - local delay = 0 | |
2066 | - local minTime = 15 --let's reserve few extra ticks in case selectChar function needs time to load data, also prevents sound from being interrupted | |
2067 | - main.f_resetBG(motif.vs_screen, motif.versusbgdef, motif.music.vs_bgm, motif.music.vs_bgm_loop, motif.music.vs_bgm_volume, motif.music.vs_bgm_loopstart, motif.music.vs_bgm_loopend) | |
2068 | 2521 | if not main.versusScreen then |
2069 | - delay = minTime | |
2070 | 2522 | select.f_selectChar(1, t_p1Selected) |
2071 | 2523 | select.f_selectChar(2, t_p2Selected) |
2072 | - while true do | |
2073 | - if delay > 0 then | |
2074 | - delay = delay - 1 | |
2075 | - else | |
2076 | - main.f_cmdInput() | |
2077 | - break | |
2078 | - end | |
2079 | - main.f_cmdInput() | |
2080 | - refresh() | |
2081 | - end | |
2524 | + return | |
2082 | 2525 | else |
2526 | + local text = main.f_extractText(motif.vs_screen.match_text, matchNo) | |
2527 | + textImgSetText(txt_matchNo, text[1]) | |
2528 | + main.f_menuReset(motif.versusbgdef.bg, motif.music.vs_bgm, motif.music.vs_bgm_loop, motif.music.vs_bgm_volume, motif.music.vs_bgm_loopstart, motif.music.vs_bgm_loopend) | |
2083 | 2529 | local p1Confirmed = false |
2084 | 2530 | local p2Confirmed = false |
2085 | 2531 | local p1Row = 1 |
2086 | 2532 | local p2Row = 1 |
2087 | 2533 | local t_tmp = {} |
2088 | - local orderTime = motif.vs_screen.time | |
2534 | + local orderTime = 0 | |
2089 | 2535 | if main.p1In == 1 and main.p2In == 2 and (#t_p1Selected > 1 or #t_p2Selected > 1) and not main.coop then |
2090 | - orderTime = orderTime + (math.max(#t_p1Selected, #t_p2Selected) - 1) * motif.vs_screen.time_order | |
2536 | + orderTime = math.max(#t_p1Selected, #t_p2Selected) - 1 * motif.vs_screen.time_order | |
2091 | 2537 | if #t_p1Selected == 1 then |
2092 | 2538 | select.f_selectChar(1, t_p1Selected) |
2093 | 2539 | p1Confirmed = true |
@@ -2097,45 +2543,43 @@ function select.f_selectVersus() | ||
2097 | 2543 | p2Confirmed = true |
2098 | 2544 | end |
2099 | 2545 | elseif #t_p1Selected > 1 and not main.coop then |
2100 | - orderTime = orderTime + (#t_p1Selected - 1) * motif.vs_screen.time_order | |
2546 | + orderTime = #t_p1Selected - 1 * motif.vs_screen.time_order | |
2101 | 2547 | else |
2102 | 2548 | select.f_selectChar(1, t_p1Selected) |
2103 | 2549 | p1Confirmed = true |
2104 | 2550 | select.f_selectChar(2, t_p2Selected) |
2105 | 2551 | p2Confirmed = true |
2106 | - delay = motif.vs_screen.time | |
2107 | - orderTime = -1 | |
2108 | 2552 | end |
2109 | 2553 | main.f_cmdInput() |
2554 | + main.fadeStart = getFrameCount() | |
2555 | + local counter = 0 - motif.vs_screen.fadein_time | |
2556 | + fadeType = 'fadein' | |
2110 | 2557 | while true do |
2111 | 2558 | if esc() then |
2112 | 2559 | sndPlay(motif.files.snd_data, motif.select_info.cancel_snd[1], motif.select_info.cancel_snd[2]) |
2113 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
2560 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
2561 | + resetRemapInput() | |
2114 | 2562 | break |
2115 | 2563 | elseif p1Confirmed and p2Confirmed then |
2116 | - if orderTime == -1 and main.f_btnPalNo(main.p1Cmd) > 0 and delay > motif.versusbgdef.timer + minTime then | |
2117 | - delay = motif.versusbgdef.timer + minTime | |
2118 | - elseif delay < motif.versusbgdef.timer then | |
2119 | - break | |
2564 | + if fadeType == 'fadein' and (counter >= motif.vs_screen.time or main.f_btnPalNo(main.p1Cmd) > 0) then | |
2565 | + main.fadeStart = getFrameCount() | |
2566 | + fadeType = 'fadeout' | |
2120 | 2567 | end |
2121 | - elseif orderTime <= motif.versusbgdef.timer then | |
2568 | + elseif counter >= motif.vs_screen.time + orderTime then | |
2122 | 2569 | if not p1Confirmed then |
2123 | 2570 | select.f_selectChar(1, t_p1Selected) |
2124 | 2571 | p1Confirmed = true |
2125 | - delay = motif.versusbgdef.timer + minTime | |
2126 | 2572 | end |
2127 | 2573 | if not p2Confirmed then |
2128 | 2574 | select.f_selectChar(2, t_p2Selected) |
2129 | 2575 | p2Confirmed = true |
2130 | - delay = motif.versusbgdef.timer + minTime | |
2131 | 2576 | end |
2132 | 2577 | else |
2133 | - local sndRef = '' | |
2134 | 2578 | --if Player1 has not confirmed the order yet |
2135 | 2579 | if not p1Confirmed then |
2136 | 2580 | if main.f_btnPalNo(main.p1Cmd) > 0 then |
2137 | 2581 | if not p1Confirmed then |
2138 | - sndRef = 'p1_cursor_done_snd' | |
2582 | + sndPlay(motif.files.snd_data, motif.vs_screen.p1_cursor_done_snd[1], motif.vs_screen.p1_cursor_done_snd[2]) | |
2139 | 2583 | select.f_selectChar(1, t_p1Selected) |
2140 | 2584 | p1Confirmed = true |
2141 | 2585 | end |
@@ -2147,19 +2591,19 @@ function select.f_selectVersus() | ||
2147 | 2591 | end |
2148 | 2592 | elseif commandGetState(main.p1Cmd, 'u') then |
2149 | 2593 | if #t_p1Selected > 1 then |
2150 | - sndRef = 'p1_cursor_move_snd' | |
2594 | + sndPlay(motif.files.snd_data, motif.vs_screen.p1_cursor_move_snd[1], motif.vs_screen.p1_cursor_move_snd[2]) | |
2151 | 2595 | p1Row = p1Row - 1 |
2152 | 2596 | if p1Row == 0 then p1Row = #t_p1Selected end |
2153 | 2597 | end |
2154 | 2598 | elseif commandGetState(main.p1Cmd, 'd') then |
2155 | 2599 | if #t_p1Selected > 1 then |
2156 | - sndRef = 'p1_cursor_move_snd' | |
2600 | + sndPlay(motif.files.snd_data, motif.vs_screen.p1_cursor_move_snd[1], motif.vs_screen.p1_cursor_move_snd[2]) | |
2157 | 2601 | p1Row = p1Row + 1 |
2158 | 2602 | if p1Row > #t_p1Selected then p1Row = 1 end |
2159 | 2603 | end |
2160 | 2604 | elseif commandGetState(main.p1Cmd, 'l') then |
2161 | 2605 | if p1Row - 1 > 0 then |
2162 | - sndRef = 'p1_cursor_move_snd' | |
2606 | + sndPlay(motif.files.snd_data, motif.vs_screen.p1_cursor_move_snd[1], motif.vs_screen.p1_cursor_move_snd[2]) | |
2163 | 2607 | p1Row = p1Row - 1 |
2164 | 2608 | t_tmp = {} |
2165 | 2609 | t_tmp[p1Row] = t_p1Selected[p1Row + 1] |
@@ -2175,7 +2619,7 @@ function select.f_selectVersus() | ||
2175 | 2619 | end |
2176 | 2620 | elseif commandGetState(main.p1Cmd, 'r') then |
2177 | 2621 | if p1Row + 1 <= #t_p1Selected then |
2178 | - sndRef = 'p1_cursor_move_snd' | |
2622 | + sndPlay(motif.files.snd_data, motif.vs_screen.p1_cursor_move_snd[1], motif.vs_screen.p1_cursor_move_snd[2]) | |
2179 | 2623 | p1Row = p1Row + 1 |
2180 | 2624 | t_tmp = {} |
2181 | 2625 | t_tmp[p1Row] = t_p1Selected[p1Row - 1] |
@@ -2195,25 +2639,25 @@ function select.f_selectVersus() | ||
2195 | 2639 | if not p2Confirmed and main.p2In ~= 1 then |
2196 | 2640 | if main.f_btnPalNo(main.p2Cmd) > 0 then |
2197 | 2641 | if not p2Confirmed then |
2198 | - sndRef = 'p2_cursor_done_snd' | |
2642 | + sndPlay(motif.files.snd_data, motif.vs_screen.p2_cursor_done_snd[1], motif.vs_screen.p2_cursor_done_snd[2]) | |
2199 | 2643 | select.f_selectChar(2, t_p2Selected) |
2200 | 2644 | p2Confirmed = true |
2201 | 2645 | end |
2202 | 2646 | elseif commandGetState(main.p2Cmd, 'u') then |
2203 | 2647 | if #t_p2Selected > 1 then |
2204 | - sndRef = 'p2_cursor_move_snd' | |
2648 | + sndPlay(motif.files.snd_data, motif.vs_screen.p2_cursor_move_snd[1], motif.vs_screen.p2_cursor_move_snd[2]) | |
2205 | 2649 | p2Row = p2Row - 1 |
2206 | 2650 | if p2Row == 0 then p2Row = #t_p2Selected end |
2207 | 2651 | end |
2208 | 2652 | elseif commandGetState(main.p2Cmd, 'd') then |
2209 | 2653 | if #t_p2Selected > 1 then |
2210 | - sndRef = 'p2_cursor_move_snd' | |
2654 | + sndPlay(motif.files.snd_data, motif.vs_screen.p2_cursor_move_snd[1], motif.vs_screen.p2_cursor_move_snd[2]) | |
2211 | 2655 | p2Row = p2Row + 1 |
2212 | 2656 | if p2Row > #t_p2Selected then p2Row = 1 end |
2213 | 2657 | end |
2214 | 2658 | elseif commandGetState(main.p2Cmd, 'l') then |
2215 | 2659 | if p2Row + 1 <= #t_p2Selected then |
2216 | - sndRef = 'p2_cursor_move_snd' | |
2660 | + sndPlay(motif.files.snd_data, motif.vs_screen.p2_cursor_move_snd[1], motif.vs_screen.p2_cursor_move_snd[2]) | |
2217 | 2661 | p2Row = p2Row + 1 |
2218 | 2662 | t_tmp = {} |
2219 | 2663 | t_tmp[p2Row] = t_p2Selected[p2Row - 1] |
@@ -2229,7 +2673,7 @@ function select.f_selectVersus() | ||
2229 | 2673 | end |
2230 | 2674 | elseif commandGetState(main.p2Cmd, 'r') then |
2231 | 2675 | if p2Row - 1 > 0 then |
2232 | - sndRef = 'p2_cursor_move_snd' | |
2676 | + sndPlay(motif.files.snd_data, motif.vs_screen.p2_cursor_move_snd[1], motif.vs_screen.p2_cursor_move_snd[2]) | |
2233 | 2677 | p2Row = p2Row - 1 |
2234 | 2678 | t_tmp = {} |
2235 | 2679 | t_tmp[p2Row] = t_p2Selected[p2Row + 1] |
@@ -2245,43 +2689,46 @@ function select.f_selectVersus() | ||
2245 | 2689 | end |
2246 | 2690 | end |
2247 | 2691 | end |
2248 | - --sndPlay separated to not play more than 1 sound at once | |
2249 | - if sndRef ~= '' then | |
2250 | - sndPlay(motif.files.snd_data, motif.vs_screen[sndRef][1], motif.vs_screen[sndRef][2]) | |
2251 | - delay = motif.versusbgdef.timer + minTime | |
2252 | - end | |
2253 | 2692 | end |
2693 | + counter = counter + 1 | |
2254 | 2694 | --draw clearcolor |
2255 | - animDraw(motif.versusbgdef.bgclearcolor_data) | |
2256 | - --draw clearcolor | |
2257 | - animDraw(motif.versusbgdef.bgclearcolor_data) | |
2695 | + clearColor(motif.versusbgdef.bgclearcolor[1], motif.versusbgdef.bgclearcolor[2], motif.versusbgdef.bgclearcolor[3]) | |
2258 | 2696 | --draw layerno = 0 backgrounds |
2259 | - main.f_drawBG(motif.versusbgdef.bg_data, motif.versusbgdef.bg, 0, motif.versusbgdef.timer, {320,240}) | |
2260 | - --draw portraits | |
2261 | - select.f_drawPortrait( | |
2262 | - t_p1Selected, | |
2263 | - motif.vs_screen.p1_pos[1] + motif.vs_screen.p1_offset[1], | |
2264 | - motif.vs_screen.p1_pos[2] + motif.vs_screen.p1_offset[2], | |
2265 | - motif.vs_screen.p1_facing, | |
2266 | - motif.vs_screen.p1_scale[1], | |
2267 | - motif.vs_screen.p1_scale[2], | |
2268 | - motif.vs_screen.p1_spacing[1], | |
2269 | - motif.vs_screen.p1_spacing[2], | |
2270 | - motif.vs_screen.p1_num, | |
2271 | - 'versus' | |
2272 | - ) | |
2273 | - select.f_drawPortrait( | |
2274 | - t_p2Selected, | |
2275 | - motif.vs_screen.p2_pos[1] + motif.vs_screen.p2_offset[1], | |
2276 | - motif.vs_screen.p2_pos[2] + motif.vs_screen.p2_offset[2], | |
2277 | - motif.vs_screen.p2_facing, | |
2278 | - motif.vs_screen.p2_scale[1], | |
2279 | - motif.vs_screen.p2_scale[2], | |
2280 | - motif.vs_screen.p2_spacing[1], | |
2281 | - motif.vs_screen.p2_spacing[2], | |
2282 | - motif.vs_screen.p2_num, | |
2283 | - 'versus' | |
2284 | - ) | |
2697 | + bgDraw(motif.versusbgdef.bg, false) | |
2698 | + --draw p1 portraits | |
2699 | + local t_portrait = {} | |
2700 | + for i = #t_p1Selected, 1, -1 do | |
2701 | + if #t_portrait < motif.vs_screen.p1_num then | |
2702 | + table.insert(t_portrait, t_p1Selected[i].cel) | |
2703 | + end | |
2704 | + end | |
2705 | + t_portrait = main.f_reversedTable(t_portrait) | |
2706 | + for n = #t_portrait, 1, -1 do | |
2707 | + drawPortrait( | |
2708 | + t_portrait[n], | |
2709 | + motif.vs_screen.p1_pos[1] + motif.vs_screen.p1_offset[1] + motif.vs_screen['p1_c' .. n .. '_offset'][1] + (n - 1) * motif.vs_screen.p1_spacing[1] + select.f_alignOffset(motif.vs_screen.p1_facing), | |
2710 | + motif.vs_screen.p1_pos[2] + motif.vs_screen.p1_offset[2] + motif.vs_screen['p1_c' .. n .. '_offset'][2] + (n - 1) * motif.vs_screen.p1_spacing[2], | |
2711 | + motif.vs_screen.p1_facing * motif.vs_screen.p1_scale[1] * motif.vs_screen['p1_c' .. n .. '_scale'][1], | |
2712 | + motif.vs_screen.p1_scale[2] * motif.vs_screen['p1_c' .. n .. '_scale'][2] | |
2713 | + ) | |
2714 | + end | |
2715 | + --draw p2 portraits | |
2716 | + t_portrait = {} | |
2717 | + for i = #t_p2Selected, 1, -1 do | |
2718 | + if #t_portrait < motif.vs_screen.p2_num then | |
2719 | + table.insert(t_portrait, t_p2Selected[i].cel) | |
2720 | + end | |
2721 | + end | |
2722 | + t_portrait = main.f_reversedTable(t_portrait) | |
2723 | + for n = #t_portrait, 1, -1 do | |
2724 | + drawPortrait( | |
2725 | + t_portrait[n], | |
2726 | + motif.vs_screen.p2_pos[1] + motif.vs_screen.p2_offset[1] + motif.vs_screen['p2_c' .. n .. '_offset'][1] + (n - 1) * motif.vs_screen.p2_spacing[1] + select.f_alignOffset(motif.vs_screen.p2_facing), | |
2727 | + motif.vs_screen.p2_pos[2] + motif.vs_screen.p2_offset[2] + motif.vs_screen['p2_c' .. n .. '_offset'][2] + (n - 1) * motif.vs_screen.p2_spacing[2], | |
2728 | + motif.vs_screen.p2_facing * motif.vs_screen.p2_scale[1] * motif.vs_screen['p2_c' .. n .. '_scale'][1], | |
2729 | + motif.vs_screen.p2_scale[2] * motif.vs_screen['p2_c' .. n .. '_scale'][2] | |
2730 | + ) | |
2731 | + end | |
2285 | 2732 | --draw names |
2286 | 2733 | select.f_drawName( |
2287 | 2734 | t_p1Selected, |
@@ -2314,25 +2761,33 @@ function select.f_selectVersus() | ||
2314 | 2761 | textImgDraw(txt_matchNo) |
2315 | 2762 | end |
2316 | 2763 | --draw layerno = 1 backgrounds |
2317 | - main.f_drawBG(motif.versusbgdef.bg_data, motif.versusbgdef.bg, 1, motif.versusbgdef.timer, {320,240}) | |
2318 | - --draw fadein | |
2319 | - animDraw(motif.vs_screen.fadein_data) | |
2320 | - animUpdate(motif.vs_screen.fadein_data) | |
2321 | - --update timer | |
2322 | - motif.versusbgdef.timer = motif.versusbgdef.timer + 1 | |
2323 | - --end loop | |
2324 | - main.f_cmdInput() | |
2764 | + bgDraw(motif.versusbgdef.bg, true) | |
2765 | + --draw fadein / fadeout | |
2766 | + main.fadeActive = fadeScreen( | |
2767 | + fadeType, | |
2768 | + main.fadeStart, | |
2769 | + motif.vs_screen[fadeType .. '_time'], | |
2770 | + motif.vs_screen[fadeType .. '_col'][1], | |
2771 | + motif.vs_screen[fadeType .. '_col'][2], | |
2772 | + motif.vs_screen[fadeType .. '_col'][3] | |
2773 | + ) | |
2774 | + --frame transition | |
2775 | + if main.fadeActive then | |
2776 | + commandBufReset(main.p1Cmd) | |
2777 | + commandBufReset(main.p2Cmd) | |
2778 | + elseif fadeType == 'fadeout' then | |
2779 | + commandBufReset(main.p1Cmd) | |
2780 | + commandBufReset(main.p2Cmd) | |
2781 | + clearColor(motif.versusbgdef.bgclearcolor[1], motif.versusbgdef.bgclearcolor[2], motif.versusbgdef.bgclearcolor[3]) --skip last frame rendering | |
2782 | + break | |
2783 | + else | |
2784 | + main.f_cmdInput() | |
2785 | + end | |
2325 | 2786 | refresh() |
2326 | 2787 | end |
2327 | 2788 | end |
2328 | 2789 | end |
2329 | 2790 | |
2330 | -function select.f_selectChar(player, t) | |
2331 | - for i = 1, #t do | |
2332 | - selectChar(player, t[i].cel, t[i].pal) | |
2333 | - end | |
2334 | -end | |
2335 | - | |
2336 | 2791 | --;=========================================================== |
2337 | 2792 | --; RESULT SCREEN |
2338 | 2793 | --;=========================================================== |
@@ -2347,7 +2802,9 @@ local txt_resultSurvival = main.f_createTextImg( | ||
2347 | 2802 | motif.survival_results_screen.winstext_font_scale[2], |
2348 | 2803 | motif.survival_results_screen.winstext_font[4], |
2349 | 2804 | motif.survival_results_screen.winstext_font[5], |
2350 | - motif.survival_results_screen.winstext_font[6] | |
2805 | + motif.survival_results_screen.winstext_font[6], | |
2806 | + motif.survival_results_screen.winstext_font[7], | |
2807 | + motif.survival_results_screen.winstext_font[8] | |
2351 | 2808 | ) |
2352 | 2809 | local txt_resultVS100 = main.f_createTextImg( |
2353 | 2810 | motif.font_data[motif.vs100kumite_results_screen.winstext_font[1]], |
@@ -2358,44 +2815,47 @@ local txt_resultVS100 = main.f_createTextImg( | ||
2358 | 2815 | motif.vs100kumite_results_screen.winstext_offset[2], |
2359 | 2816 | motif.vs100kumite_results_screen.winstext_font_scale[1], |
2360 | 2817 | motif.vs100kumite_results_screen.winstext_font_scale[2], |
2361 | - motif.survival_results_screen.winstext_font[4], | |
2362 | - motif.survival_results_screen.winstext_font[5], | |
2363 | - motif.survival_results_screen.winstext_font[6] | |
2818 | + motif.vs100kumite_results_screen.winstext_font[4], | |
2819 | + motif.vs100kumite_results_screen.winstext_font[5], | |
2820 | + motif.vs100kumite_results_screen.winstext_font[6], | |
2821 | + motif.vs100kumite_results_screen.winstext_font[7], | |
2822 | + motif.vs100kumite_results_screen.winstext_font[8] | |
2364 | 2823 | ) |
2365 | 2824 | |
2366 | -function select.f_result(state) | |
2367 | - --if state == true then --win | |
2368 | - --elseif state == false then --loose | |
2369 | - --end | |
2825 | +function select.f_result() | |
2370 | 2826 | local t = {} |
2371 | 2827 | local t_resultText = {} |
2372 | 2828 | local txt = '' |
2373 | - if main.gameMode == 'survival' or main.gameMode == 'survivalcoop' or main.gameMode == 'netplaysurvivalcoop' then | |
2829 | + if gameMode('bossrush') then | |
2830 | + return | |
2831 | + elseif gameMode('survival') or gameMode('survivalcoop') or gameMode('netplaysurvivalcoop') then | |
2374 | 2832 | t = motif.survival_results_screen |
2375 | 2833 | t_resultText = main.f_extractText(t.winstext_text, winCnt) |
2376 | 2834 | txt = txt_resultSurvival |
2377 | - elseif main.gameMode == '100kumite' then | |
2835 | + elseif gameMode('100kumite') then | |
2378 | 2836 | t = motif.vs100kumite_results_screen |
2379 | 2837 | t_resultText = main.f_extractText(t.winstext_text, winCnt, looseCnt) |
2380 | 2838 | txt = txt_resultVS100 |
2381 | - else | |
2382 | - return | |
2383 | 2839 | end |
2384 | - main.f_resetBG(t, motif.resultsbgdef, motif.music.results_bgm, motif.music.results_bgm_loop, motif.music.results_bgm_volume, motif.music.results_bgm_loopstart, motif.music.results_bgm_loopend) | |
2840 | + main.f_menuReset(motif.resultsbgdef.bg, motif.music.results_bgm, motif.music.results_bgm_loop, motif.music.results_bgm_volume, motif.music.results_bgm_loopstart, motif.music.results_bgm_loopend) | |
2385 | 2841 | main.f_cmdInput() |
2842 | + main.fadeStart = getFrameCount() | |
2843 | + local counter = 0 - t.fadein_time | |
2844 | + fadeType = 'fadein' | |
2386 | 2845 | while true do |
2387 | - if esc() or main.f_btnPalNo(main.p1Cmd) > 0 then | |
2388 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
2389 | - break | |
2390 | - elseif motif.resultsbgdef.timer >= t.show_time then | |
2391 | - --add fadeout code here | |
2392 | - main.f_resetBG(motif.title_info, motif.titlebgdef, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
2846 | + if esc() then | |
2847 | + main.f_menuReset(motif.titlebgdef.bg, motif.music.title_bgm, motif.music.title_bgm_loop, motif.music.title_bgm_volume, motif.music.title_bgm_loopstart, motif.music.title_bgm_loopend) | |
2848 | + resetRemapInput() | |
2393 | 2849 | break |
2850 | + elseif fadeType == 'fadein' and (counter >= t.show_time or main.f_btnPalNo(main.p1Cmd) > 0) then | |
2851 | + main.fadeStart = getFrameCount() | |
2852 | + fadeType = 'fadeout' | |
2394 | 2853 | end |
2395 | - --draw clearcolor | |
2396 | - --animDraw(motif.resultsbgdef.bgclearcolor_data) --disabled to not cover game screen | |
2854 | + counter = counter + 1 | |
2855 | + --draw clearcolor (disabled to not cover game screen) | |
2856 | + --clearColor(motif.resultsbgdef.bgclearcolor[1], motif.resultsbgdef.bgclearcolor[2], motif.resultsbgdef.bgclearcolor[3]) | |
2397 | 2857 | --draw layerno = 0 backgrounds |
2398 | - main.f_drawBG(motif.resultsbgdef.bg_data, motif.resultsbgdef.bg, 0, motif.resultsbgdef.timer, {320,240}) | |
2858 | + bgDraw(motif.resultsbgdef.bg, false) | |
2399 | 2859 | --draw text |
2400 | 2860 | for i = 1, #t_resultText do |
2401 | 2861 | textImgSetText(txt, t_resultText[i]) |
@@ -2407,14 +2867,26 @@ function select.f_result(state) | ||
2407 | 2867 | textImgDraw(txt) |
2408 | 2868 | end |
2409 | 2869 | --draw layerno = 1 backgrounds |
2410 | - main.f_drawBG(motif.resultsbgdef.bg_data, motif.resultsbgdef.bg, 1, motif.resultsbgdef.timer, {320,240}) | |
2411 | - --draw fadein | |
2412 | - animDraw(t.fadein_data) | |
2413 | - animUpdate(t.fadein_data) | |
2414 | - --update timer | |
2415 | - motif.resultsbgdef.timer = motif.resultsbgdef.timer + 1 | |
2416 | - --end loop | |
2417 | - main.f_cmdInput() | |
2870 | + bgDraw(motif.resultsbgdef.bg, true) | |
2871 | + --draw fadein / fadeout | |
2872 | + main.fadeActive = fadeScreen( | |
2873 | + fadeType, | |
2874 | + main.fadeStart, | |
2875 | + t[fadeType .. '_time'], | |
2876 | + t[fadeType .. '_col'][1], | |
2877 | + t[fadeType .. '_col'][2], | |
2878 | + t[fadeType .. '_col'][3] | |
2879 | + ) | |
2880 | + --frame transition | |
2881 | + if main.fadeActive then | |
2882 | + commandBufReset(main.p1Cmd) | |
2883 | + elseif fadeType == 'fadeout' then | |
2884 | + commandBufReset(main.p1Cmd) | |
2885 | + clearColor(motif.resultsbgdef.bgclearcolor[1], motif.resultsbgdef.bgclearcolor[2], motif.resultsbgdef.bgclearcolor[3]) --skip last frame rendering | |
2886 | + break | |
2887 | + else | |
2888 | + main.f_cmdInput() | |
2889 | + end | |
2418 | 2890 | refresh() |
2419 | 2891 | end |
2420 | 2892 | end |
@@ -2423,17 +2895,19 @@ end | ||
2423 | 2895 | --; VICTORY SCREEN |
2424 | 2896 | --;=========================================================== |
2425 | 2897 | local txt_winquote = main.f_createTextImg( |
2426 | - motif.font_data[motif.victory_screen.winquote_font[1]], | |
2427 | - motif.victory_screen.winquote_font[2], | |
2428 | - motif.victory_screen.winquote_font[3], | |
2429 | - '', | |
2430 | - 0, | |
2431 | - 0, | |
2432 | - motif.victory_screen.winquote_font_scale[1], | |
2898 | + motif.font_data[motif.victory_screen.winquote_font[1]], | |
2899 | + motif.victory_screen.winquote_font[2], | |
2900 | + motif.victory_screen.winquote_font[3], | |
2901 | + '', | |
2902 | + 0, | |
2903 | + 0, | |
2904 | + motif.victory_screen.winquote_font_scale[1], | |
2433 | 2905 | motif.victory_screen.winquote_font_scale[2], |
2434 | 2906 | motif.victory_screen.winquote_font[4], |
2435 | 2907 | motif.victory_screen.winquote_font[5], |
2436 | - motif.victory_screen.winquote_font[6] | |
2908 | + motif.victory_screen.winquote_font[6], | |
2909 | + motif.victory_screen.winquote_font[7], | |
2910 | + motif.victory_screen.winquote_font[8] | |
2437 | 2911 | ) |
2438 | 2912 | local txt_p1_winquoteName = main.f_createTextImg( |
2439 | 2913 | motif.font_data[motif.victory_screen.p1_name_font[1]], |
@@ -2446,7 +2920,9 @@ local txt_p1_winquoteName = main.f_createTextImg( | ||
2446 | 2920 | motif.victory_screen.p1_name_font_scale[2], |
2447 | 2921 | motif.victory_screen.p1_name_font[4], |
2448 | 2922 | motif.victory_screen.p1_name_font[5], |
2449 | - motif.victory_screen.p1_name_font[6] | |
2923 | + motif.victory_screen.p1_name_font[6], | |
2924 | + motif.victory_screen.p1_name_font[7], | |
2925 | + motif.victory_screen.p1_name_font[8] | |
2450 | 2926 | ) |
2451 | 2927 | local txt_p2_winquoteName = main.f_createTextImg( |
2452 | 2928 | motif.font_data[motif.victory_screen.p2_name_font[1]], |
@@ -2459,76 +2935,144 @@ local txt_p2_winquoteName = main.f_createTextImg( | ||
2459 | 2935 | motif.victory_screen.p2_name_font_scale[2], |
2460 | 2936 | motif.victory_screen.p2_name_font[4], |
2461 | 2937 | motif.victory_screen.p2_name_font[5], |
2462 | - motif.victory_screen.p2_name_font[6] | |
2938 | + motif.victory_screen.p2_name_font[6], | |
2939 | + motif.victory_screen.p2_name_font[7], | |
2940 | + motif.victory_screen.p2_name_font[8] | |
2463 | 2941 | ) |
2464 | 2942 | |
2943 | +function select.f_teamOrder(teamNo, allow_ko) | |
2944 | + local allow_ko = allow_ko or 0 | |
2945 | + local playerNo = -1 | |
2946 | + local selectNo = -1 | |
2947 | + local t = {} | |
2948 | + local done = false | |
2949 | + for k, v in pairs(t_gameStats.chars[t_gameStats.lastRound]) do --loop through all last round participants | |
2950 | + if k % 2 ~= teamNo then --only if character belongs to selected team | |
2951 | + if v.win then --win team | |
2952 | + if not v.ko and not done then --first not KOed win team member | |
2953 | + playerNo = k | |
2954 | + selectNo = v.selectNo | |
2955 | + done = true | |
2956 | + elseif not v.ko or allow_ko == 1 then --other win team members | |
2957 | + table.insert(t, v.selectNo) | |
2958 | + end | |
2959 | + elseif not done then --first loose team member | |
2960 | + playerNo = k | |
2961 | + selectNo = v.selectNo | |
2962 | + done = true | |
2963 | + else --other loose team members | |
2964 | + table.insert(t, v.selectNo) | |
2965 | + end | |
2966 | + end | |
2967 | + end | |
2968 | + return playerNo, selectNo, t | |
2969 | +end | |
2970 | + | |
2465 | 2971 | function select.f_selectVictory() |
2972 | + local wpn = -1 | |
2973 | + local wsn = -1 | |
2974 | + local lpn = -1 | |
2975 | + local lsn = -1 | |
2976 | + local t = {} | |
2977 | + local t2 = {} | |
2978 | + for i = 0, 1 do | |
2979 | + if i == t_gameStats.winTeam then | |
2980 | + wpn, wsn, t = select.f_teamOrder(i, motif.victory_screen.winner_teamko_enabled) | |
2981 | + else | |
2982 | + lpn, lsn, t2 = select.f_teamOrder(i, true) | |
2983 | + end | |
2984 | + end | |
2985 | + if wpn == -1 or wsn == -1 then | |
2986 | + return | |
2987 | + elseif not main.t_charparam.winscreen then | |
2988 | + return | |
2989 | + elseif main.t_charparam.rivals and select.f_rivalsMatch('winscreen') then --winscreen assigned as rivals param | |
2990 | + if main.t_selChars[t_p1Selected[1].cel + 1].rivals[matchNo].winscreen == 0 then | |
2991 | + return | |
2992 | + end | |
2993 | + elseif main.t_selChars[wsn + 1].winscreen == 0 then --winscreen assigned as character param | |
2994 | + return | |
2995 | + end | |
2466 | 2996 | if motif.music.victory_bgm == '' then |
2467 | - main.f_resetBG(motif.victory_screen, motif.victorybgdef) | |
2997 | + main.f_menuReset(motif.victorybgdef.bg) | |
2468 | 2998 | else |
2469 | - main.f_resetBG(motif.victory_screen, motif.victorybgdef, motif.music.victory_bgm, motif.music.victory_bgm_loop, motif.music.victory_bgm_volume, motif.music.victory_bgm_loopstart, motif.music.victory_bgm_loopend) | |
2470 | - end | |
2471 | - local winquote = '' | |
2472 | - local winnerNum = 0 | |
2473 | - local p1Num = t_gameStats.chars[t_gameStats.lastRound][1].selectNo | |
2474 | - local p2Num = t_gameStats.chars[t_gameStats.lastRound][2].selectNo | |
2475 | - local txt_winquoteName = '' | |
2476 | - if winner == 1 then | |
2477 | - winquote = getCharVictoryQuote(1) | |
2478 | - txt_winquoteName = txt_p1_winquoteName | |
2479 | - winnerNum = p1Num | |
2480 | - else | |
2481 | - winquote = getCharVictoryQuote(2) | |
2482 | - txt_winquoteName = txt_p2_winquoteName | |
2483 | - winnerNum = p2Num | |
2999 | + main.f_menuReset(motif.victorybgdef.bg, motif.music.victory_bgm, motif.music.victory_bgm_loop, motif.music.victory_bgm_volume, motif.music.victory_bgm_loopstart, motif.music.victory_bgm_loopend) | |
2484 | 3000 | end |
2485 | - if winquote == nil or winquote == '' then | |
3001 | + local winquote = getCharVictoryQuote(wpn) | |
3002 | + if winquote == '' then | |
2486 | 3003 | winquote = motif.victory_screen.winquote_text |
2487 | 3004 | end |
2488 | - textImgSetText(txt_p1_winquoteName, main.f_getName(p1Num)) | |
2489 | - textImgSetText(txt_p2_winquoteName, main.f_getName(p2Num)) | |
3005 | + textImgSetText(txt_p1_winquoteName, main.f_getName(wsn)) | |
3006 | + textImgSetText(txt_p2_winquoteName, main.f_getName(lsn)) | |
2490 | 3007 | local i = 0 |
2491 | 3008 | main.f_cmdInput() |
3009 | + main.fadeStart = getFrameCount() | |
3010 | + local counter = 0 - motif.victory_screen.fadein_time | |
3011 | + fadeType = 'fadein' | |
2492 | 3012 | while true do |
2493 | - if esc() or main.f_btnPalNo(main.p1Cmd) > 0 then | |
2494 | - main.f_cmdInput() | |
2495 | - break | |
2496 | - elseif motif.victorybgdef.timer >= motif.victory_screen.time then | |
2497 | - --add fadeout code here | |
3013 | + if esc() then | |
2498 | 3014 | main.f_cmdInput() |
2499 | 3015 | break |
3016 | + elseif fadeType == 'fadein' and (counter >= motif.victory_screen.time or main.f_btnPalNo(main.p1Cmd) > 0) then | |
3017 | + main.fadeStart = getFrameCount() | |
3018 | + fadeType = 'fadeout' | |
2500 | 3019 | end |
3020 | + counter = counter + 1 | |
2501 | 3021 | --draw clearcolor |
2502 | - animDraw(motif.victorybgdef.bgclearcolor_data) | |
3022 | + clearColor(motif.victorybgdef.bgclearcolor[1], motif.victorybgdef.bgclearcolor[2], motif.victorybgdef.bgclearcolor[3]) | |
2503 | 3023 | --draw layerno = 0 backgrounds |
2504 | - main.f_drawBG(motif.victorybgdef.bg_data, motif.victorybgdef.bg, 0, motif.victorybgdef.timer, {320,240}) | |
3024 | + bgDraw(motif.victorybgdef.bg, false) | |
2505 | 3025 | --draw portraits |
2506 | - if motif.victory_screen.p2_display == 0 then | |
3026 | + -- looser team portraits | |
3027 | + for n = 1, #t2 do | |
3028 | + if n > motif.victory_screen.p2_num then | |
3029 | + break | |
3030 | + end | |
2507 | 3031 | drawVictoryPortrait( |
2508 | - winnerNum, | |
2509 | - motif.victory_screen.p1_offset[1], | |
2510 | - motif.victory_screen.p1_offset[2], | |
2511 | - motif.victory_screen.p1_facing * motif.victory_screen.p1_scale[1], | |
2512 | - motif.victory_screen.p1_scale[2] | |
3032 | + t[n], | |
3033 | + motif.victory_screen.p2_pos[1] + motif.victory_screen.p2_offset[1] + motif.victory_screen['p2_c' .. n + 1 .. '_offset'][1] + select.f_alignOffset(motif.victory_screen.p2_facing), | |
3034 | + motif.victory_screen.p2_pos[2] + motif.victory_screen.p2_offset[2] + motif.victory_screen['p2_c' .. n + 1 .. '_offset'][2], | |
3035 | + motif.victory_screen.p2_facing * motif.victory_screen.p2_scale[1] * motif.victory_screen['p2_c' .. n + 1 .. '_scale'][1], | |
3036 | + motif.victory_screen.p2_scale[2] * motif.victory_screen['p2_c' .. n + 1 .. '_scale'][2] | |
2513 | 3037 | ) |
2514 | - else | |
3038 | + end | |
3039 | + -- looser portrait | |
3040 | + if motif.victory_screen.p2_num > 0 then | |
2515 | 3041 | drawVictoryPortrait( |
2516 | - p1Num, | |
2517 | - motif.victory_screen.p1_offset[1], | |
2518 | - motif.victory_screen.p1_offset[2], | |
2519 | - motif.victory_screen.p1_facing * motif.victory_screen.p1_scale[1], | |
2520 | - motif.victory_screen.p1_scale[2] | |
3042 | + lsn, | |
3043 | + motif.victory_screen.p2_pos[1] + motif.victory_screen.p2_offset[1] + motif.victory_screen.p2_c1_offset[1] + select.f_alignOffset(motif.victory_screen.p2_facing), | |
3044 | + motif.victory_screen.p2_pos[2] + motif.victory_screen.p2_offset[2] + motif.victory_screen.p2_c1_offset[2], | |
3045 | + motif.victory_screen.p2_facing * motif.victory_screen.p2_scale[1] * motif.victory_screen.p2_c1_scale[1], | |
3046 | + motif.victory_screen.p2_scale[2] * motif.victory_screen.p2_c1_scale[2] | |
2521 | 3047 | ) |
3048 | + end | |
3049 | + -- winner team portraits | |
3050 | + for n = 1, #t do | |
3051 | + if n > motif.victory_screen.p1_num then | |
3052 | + break | |
3053 | + end | |
2522 | 3054 | drawVictoryPortrait( |
2523 | - p2Num, | |
2524 | - motif.victory_screen.p2_offset[1], | |
2525 | - motif.victory_screen.p2_offset[2], | |
2526 | - motif.victory_screen.p2_facing * motif.victory_screen.p2_scale[1], | |
2527 | - motif.victory_screen.p2_scale[2] | |
3055 | + t[n], | |
3056 | + motif.victory_screen.p1_pos[1] + motif.victory_screen.p1_offset[1] + motif.victory_screen['p1_c' .. n + 1 .. '_offset'][1] + select.f_alignOffset(motif.victory_screen.p1_facing), | |
3057 | + motif.victory_screen.p1_pos[2] + motif.victory_screen.p1_offset[2] + motif.victory_screen['p1_c' .. n + 1 .. '_offset'][2], | |
3058 | + motif.victory_screen.p1_facing * motif.victory_screen.p1_scale[1] * motif.victory_screen['p1_c' .. n + 1 .. '_scale'][1], | |
3059 | + motif.victory_screen.p1_scale[2] * motif.victory_screen['p1_c' .. n + 1 .. '_scale'][2] | |
2528 | 3060 | ) |
2529 | 3061 | end |
2530 | - --draw winner's name | |
2531 | - textImgDraw(txt_winquoteName) | |
3062 | + -- winner portrait | |
3063 | + drawVictoryPortrait( | |
3064 | + wsn, | |
3065 | + motif.victory_screen.p1_pos[1] + motif.victory_screen.p1_offset[1] + motif.victory_screen.p1_c1_offset[1] + select.f_alignOffset(motif.victory_screen.p1_facing), | |
3066 | + motif.victory_screen.p1_pos[2] + motif.victory_screen.p1_offset[2] + motif.victory_screen.p1_c1_offset[2], | |
3067 | + motif.victory_screen.p1_facing * motif.victory_screen.p1_scale[1] * motif.victory_screen.p1_c1_scale[1], | |
3068 | + motif.victory_screen.p1_scale[2] * motif.victory_screen.p1_c1_scale[2] | |
3069 | + ) | |
3070 | + --draw winner name | |
3071 | + textImgDraw(txt_p1_winquoteName) | |
3072 | + --draw looser name | |
3073 | + if motif.victory_screen.looser_name_enabled == 1 then | |
3074 | + textImgDraw(txt_p2_winquoteName) | |
3075 | + end | |
2532 | 3076 | --draw winquote |
2533 | 3077 | i = i + 1 |
2534 | 3078 | main.f_textRender( |
@@ -2542,14 +3086,26 @@ function select.f_selectVictory() | ||
2542 | 3086 | motif.victory_screen.winquote_length |
2543 | 3087 | ) |
2544 | 3088 | --draw layerno = 1 backgrounds |
2545 | - main.f_drawBG(motif.victorybgdef.bg_data, motif.victorybgdef.bg, 1, motif.victorybgdef.timer, {320,240}) | |
2546 | - --draw fadein | |
2547 | - animDraw(motif.victory_screen.fadein_data) | |
2548 | - animUpdate(motif.victory_screen.fadein_data) | |
2549 | - --update timer | |
2550 | - motif.victorybgdef.timer = motif.victorybgdef.timer + 1 | |
2551 | - --end loop | |
2552 | - main.f_cmdInput() | |
3089 | + bgDraw(motif.victorybgdef.bg, true) | |
3090 | + --draw fadein / fadeout | |
3091 | + main.fadeActive = fadeScreen( | |
3092 | + fadeType, | |
3093 | + main.fadeStart, | |
3094 | + motif.victory_screen[fadeType .. '_time'], | |
3095 | + motif.victory_screen[fadeType .. '_col'][1], | |
3096 | + motif.victory_screen[fadeType .. '_col'][2], | |
3097 | + motif.victory_screen[fadeType .. '_col'][3] | |
3098 | + ) | |
3099 | + --frame transition | |
3100 | + if main.fadeActive then | |
3101 | + commandBufReset(main.p1Cmd) | |
3102 | + elseif fadeType == 'fadeout' then | |
3103 | + commandBufReset(main.p1Cmd) | |
3104 | + clearColor(motif.victorybgdef.bgclearcolor[1], motif.victorybgdef.bgclearcolor[2], motif.victorybgdef.bgclearcolor[3]) --skip last frame rendering | |
3105 | + break | |
3106 | + else | |
3107 | + main.f_cmdInput() | |
3108 | + end | |
2553 | 3109 | refresh() |
2554 | 3110 | end |
2555 | 3111 | end |
@@ -2567,102 +3123,126 @@ local txt_credits = main.f_createTextImg( | ||
2567 | 3123 | motif.continue_screen.credits_font_scale[1], |
2568 | 3124 | motif.continue_screen.credits_font_scale[2], |
2569 | 3125 | motif.continue_screen.credits_font[4], |
2570 | - motif.continue_screen.credits_font[5], | |
2571 | - motif.continue_screen.credits_font[6] | |
3126 | + motif.continue_screen.credits_font[5], | |
3127 | + motif.continue_screen.credits_font[6], | |
3128 | + motif.continue_screen.credits_font[7], | |
3129 | + motif.continue_screen.credits_font[8] | |
2572 | 3130 | ) |
2573 | 3131 | |
2574 | 3132 | function select.f_continue() |
3133 | + main.f_menuReset(motif.continuebgdef.bg, motif.music.continue_bgm, motif.music.continue_bgm_loop, motif.music.continue_bgm_volume, motif.music.continue_bgm_loopstart, motif.music.continue_bgm_loopend) | |
3134 | + animReset(motif.continue_screen.continue_anim_data) | |
3135 | + animUpdate(motif.continue_screen.continue_anim_data) | |
2575 | 3136 | continue = false |
2576 | - playBGM(motif.music.continue_bgm, true, motif.music.continue_bgm_loop, motif.music.continue_bgm_volume, motif.music.continue_bgm_loopstart or "0", motif.music.continue_bgm_loopend or "0") | |
2577 | - --textImgSetText(txt_credits, text[1]) | |
3137 | + local text = main.f_extractText(motif.continue_screen.credits_text, main.credits) | |
3138 | + textImgSetText(txt_credits, text[1]) | |
2578 | 3139 | main.f_cmdInput() |
3140 | + main.fadeStart = getFrameCount() | |
3141 | + local counter = 0-- - motif.victory_screen.fadein_time | |
3142 | + fadeType = 'fadein' | |
2579 | 3143 | while true do |
2580 | 3144 | --draw clearcolor (disabled to not cover area) |
2581 | - --animDraw(motif.continuebgdef.bgclearcolor_data) | |
3145 | + --clearColor(motif.continuebgdef.bgclearcolor[1], motif.continuebgdef.bgclearcolor[2], motif.continuebgdef.bgclearcolor[3]) | |
2582 | 3146 | --draw layerno = 0 backgrounds |
2583 | - main.f_drawBG(motif.continuebgdef.bg_data, motif.continuebgdef.bg, 0, motif.continuebgdef.timer, {320,240}) | |
3147 | + bgDraw(motif.continuebgdef.bg, false) | |
2584 | 3148 | --continue screen state |
2585 | - if esc() or motif.continuebgdef.timer > motif.continue_screen.endtime then | |
3149 | + if esc() then | |
2586 | 3150 | main.f_cmdInput() |
2587 | 3151 | break |
2588 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_end_skiptime then | |
3152 | + elseif fadeType == 'fadein' and (counter > motif.continue_screen.endtime or continue) then | |
3153 | + main.fadeStart = getFrameCount() | |
3154 | + fadeType = 'fadeout' | |
3155 | + elseif counter < motif.continue_screen.continue_end_skiptime then | |
2589 | 3156 | if commandGetState(main.p1Cmd, 'holds') then |
2590 | 3157 | continue = true |
2591 | 3158 | main.credits = main.credits - 1 |
2592 | 3159 | text = main.f_extractText(motif.continue_screen.credits_text, main.credits) |
2593 | 3160 | textImgSetText(txt_credits, text[1]) |
2594 | - main.f_cmdInput() | |
2595 | - main.f_resetBG(motif.select_info, motif.selectbgdef, motif.music.select_bgm, motif.music.select_bgm_loop, motif.music.select_bgm_volume, motif.music.select_bgm_loopstart, motif.music.select_bgm_loopend) | |
2596 | - break | |
2597 | - elseif main.f_btnPalNo(main.p1Cmd) > 0 and motif.continuebgdef.timer >= motif.continue_screen.continue_starttime + motif.continue_screen.continue_skipstart then | |
3161 | + elseif main.f_btnPalNo(main.p1Cmd) > 0 and counter >= motif.continue_screen.continue_starttime + motif.continue_screen.continue_skipstart then | |
2598 | 3162 | local cnt = 0 |
2599 | - if motif.continuebgdef.timer < motif.continue_screen.continue_9_skiptime then | |
3163 | + if counter < motif.continue_screen.continue_9_skiptime then | |
2600 | 3164 | cnt = motif.continue_screen.continue_9_skiptime |
2601 | - elseif motif.continuebgdef.timer <= motif.continue_screen.continue_8_skiptime then | |
3165 | + elseif counter <= motif.continue_screen.continue_8_skiptime then | |
2602 | 3166 | cnt = motif.continue_screen.continue_8_skiptime |
2603 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_7_skiptime then | |
3167 | + elseif counter < motif.continue_screen.continue_7_skiptime then | |
2604 | 3168 | cnt = motif.continue_screen.continue_7_skiptime |
2605 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_6_skiptime then | |
3169 | + elseif counter < motif.continue_screen.continue_6_skiptime then | |
2606 | 3170 | cnt = motif.continue_screen.continue_6_skiptime |
2607 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_5_skiptime then | |
3171 | + elseif counter < motif.continue_screen.continue_5_skiptime then | |
2608 | 3172 | cnt = motif.continue_screen.continue_5_skiptime |
2609 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_4_skiptime then | |
3173 | + elseif counter < motif.continue_screen.continue_4_skiptime then | |
2610 | 3174 | cnt = motif.continue_screen.continue_4_skiptime |
2611 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_3_skiptime then | |
3175 | + elseif counter < motif.continue_screen.continue_3_skiptime then | |
2612 | 3176 | cnt = motif.continue_screen.continue_3_skiptime |
2613 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_2_skiptime then | |
3177 | + elseif counter < motif.continue_screen.continue_2_skiptime then | |
2614 | 3178 | cnt = motif.continue_screen.continue_2_skiptime |
2615 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_1_skiptime then | |
3179 | + elseif counter < motif.continue_screen.continue_1_skiptime then | |
2616 | 3180 | cnt = motif.continue_screen.continue_1_skiptime |
2617 | - elseif motif.continuebgdef.timer < motif.continue_screen.continue_0_skiptime then | |
3181 | + elseif counter < motif.continue_screen.continue_0_skiptime then | |
2618 | 3182 | cnt = motif.continue_screen.continue_0_skiptime |
2619 | 3183 | end |
2620 | - while motif.continuebgdef.timer < cnt do | |
2621 | - motif.continuebgdef.timer = motif.continuebgdef.timer + 1 | |
3184 | + while counter < cnt do | |
3185 | + counter = counter + 1 | |
2622 | 3186 | animUpdate(motif.continue_screen.continue_anim_data) |
2623 | 3187 | end |
2624 | 3188 | end |
2625 | - if motif.continuebgdef.timer == motif.continue_screen.continue_9_skiptime then | |
3189 | + if counter == motif.continue_screen.continue_9_skiptime then | |
2626 | 3190 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_9_snd[1], motif.continue_screen.continue_9_snd[2]) |
2627 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_8_skiptime then | |
3191 | + elseif counter == motif.continue_screen.continue_8_skiptime then | |
2628 | 3192 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_8_snd[1], motif.continue_screen.continue_8_snd[2]) |
2629 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_7_skiptime then | |
3193 | + elseif counter == motif.continue_screen.continue_7_skiptime then | |
2630 | 3194 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_7_snd[1], motif.continue_screen.continue_7_snd[2]) |
2631 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_6_skiptime then | |
3195 | + elseif counter == motif.continue_screen.continue_6_skiptime then | |
2632 | 3196 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_6_snd[1], motif.continue_screen.continue_6_snd[2]) |
2633 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_5_skiptime then | |
3197 | + elseif counter == motif.continue_screen.continue_5_skiptime then | |
2634 | 3198 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_5_snd[1], motif.continue_screen.continue_5_snd[2]) |
2635 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_4_skiptime then | |
3199 | + elseif counter == motif.continue_screen.continue_4_skiptime then | |
2636 | 3200 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_4_snd[1], motif.continue_screen.continue_4_snd[2]) |
2637 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_3_skiptime then | |
3201 | + elseif counter == motif.continue_screen.continue_3_skiptime then | |
2638 | 3202 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_3_snd[1], motif.continue_screen.continue_3_snd[2]) |
2639 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_2_skiptime then | |
3203 | + elseif counter == motif.continue_screen.continue_2_skiptime then | |
2640 | 3204 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_2_snd[1], motif.continue_screen.continue_2_snd[2]) |
2641 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_1_skiptime then | |
3205 | + elseif counter == motif.continue_screen.continue_1_skiptime then | |
2642 | 3206 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_1_snd[1], motif.continue_screen.continue_1_snd[2]) |
2643 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_0_skiptime then | |
3207 | + elseif counter == motif.continue_screen.continue_0_skiptime then | |
2644 | 3208 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_0_snd[1], motif.continue_screen.continue_0_snd[2]) |
2645 | 3209 | end |
2646 | - elseif motif.continuebgdef.timer == motif.continue_screen.continue_end_skiptime then | |
2647 | - playBGM(motif.music.continue_end_bgm, true, motif.music.continue_end_bgm_loop, motif.music.continue_end_bgm_volume, motif.music.continue_end_bgm_loopstart or "0", motif.music.continue_end_bgm_loopend or "0") | |
3210 | + elseif counter == motif.continue_screen.continue_end_skiptime then | |
3211 | + playBGM(motif.music.continue_end_bgm, true, motif.music.continue_end_bgm_loop, motif.music.continue_end_bgm_volume, motif.music.continue_end_bgm_loopstart, motif.music.continue_end_bgm_loopend) | |
2648 | 3212 | sndPlay(motif.files.continue_snd_data, motif.continue_screen.continue_end_snd[1], motif.continue_screen.continue_end_snd[2]) |
2649 | 3213 | end |
2650 | 3214 | --draw credits text |
2651 | - if motif.continuebgdef.timer >= motif.continue_screen.continue_skipstart then --show when counter starts counting down | |
3215 | + if counter >= motif.continue_screen.continue_skipstart then --show when counter starts counting down | |
2652 | 3216 | textImgDraw(txt_credits) |
2653 | 3217 | end |
3218 | + counter = counter + 1 | |
2654 | 3219 | --draw counter |
2655 | 3220 | animUpdate(motif.continue_screen.continue_anim_data) |
2656 | 3221 | animDraw(motif.continue_screen.continue_anim_data) |
2657 | 3222 | --draw layerno = 1 backgrounds |
2658 | - main.f_drawBG(motif.continuebgdef.bg_data, motif.continuebgdef.bg, 1, motif.continuebgdef.timer, {320,240}) | |
2659 | - --draw fadein | |
2660 | - animDraw(motif.continue_screen.fadein_data) | |
2661 | - animUpdate(motif.continue_screen.fadein_data) | |
2662 | - --update timer | |
2663 | - motif.continuebgdef.timer = motif.continuebgdef.timer + 1 | |
2664 | - --end loop | |
2665 | - main.f_cmdInput() | |
3223 | + bgDraw(motif.continuebgdef.bg, true) | |
3224 | + --draw fadein / fadeout | |
3225 | + main.fadeActive = fadeScreen( | |
3226 | + fadeType, | |
3227 | + main.fadeStart, | |
3228 | + motif.continue_screen[fadeType .. '_time'], | |
3229 | + motif.continue_screen[fadeType .. '_col'][1], | |
3230 | + motif.continue_screen[fadeType .. '_col'][2], | |
3231 | + motif.continue_screen[fadeType .. '_col'][3] | |
3232 | + ) | |
3233 | + --frame transition | |
3234 | + if main.fadeActive then | |
3235 | + commandBufReset(main.p1Cmd) | |
3236 | + elseif fadeType == 'fadeout' then | |
3237 | + commandBufReset(main.p1Cmd) | |
3238 | + clearColor(motif.continuebgdef.bgclearcolor[1], motif.continuebgdef.bgclearcolor[2], motif.continuebgdef.bgclearcolor[3]) --skip last frame rendering | |
3239 | + if continue then | |
3240 | + main.f_menuReset(motif.selectbgdef.bg, motif.music.select_bgm, motif.music.select_bgm_loop, motif.music.select_bgm_volume, motif.music.select_bgm_loopstart, motif.music.select_bgm_loopend) | |
3241 | + end | |
3242 | + break | |
3243 | + else | |
3244 | + main.f_cmdInput() | |
3245 | + end | |
2666 | 3246 | refresh() |
2667 | 3247 | end |
2668 | 3248 | end |
@@ -7,35 +7,10 @@ storyboard.t_storyboard = {} --stores all parsed storyboards (we parse each of t | ||
7 | 7 | |
8 | 8 | local function f_reset(t) |
9 | 9 | for k, v in pairs(t.scene) do |
10 | - if t.scene[k].fadein_data ~= nil then | |
11 | - animReset(t.scene[k].fadein_data) | |
12 | - animUpdate(t.scene[k].fadein_data) | |
13 | - end | |
14 | - if t.scene[k].fadeout_data ~= nil then | |
15 | - animReset(t.scene[k].fadeout_data) | |
16 | - animUpdate(t.scene[k].fadeout_data) | |
17 | - end | |
18 | 10 | if t.scene[k].bg_name ~= '' then |
19 | - local t_bgdef = t[t.scene[k].bg_name .. 'def'] | |
20 | - for i = 1, #t_bgdef do | |
21 | - t_bgdef[i].ctrl_flags.visible = 1 | |
22 | - t_bgdef[i].ctrl_flags.enabled = 1 | |
23 | - t_bgdef[i].ctrl_flags.velx = 0 | |
24 | - t_bgdef[i].ctrl_flags.vely = 0 | |
25 | - animReset(t.scene[k].bg_data[i]) | |
26 | - animAddPos(t.scene[k].bg_data[i], 0 - t_bgdef[i].ctrl_flags.x, 0 - t_bgdef[i].ctrl_flags.y) | |
27 | - animUpdate(t.scene[k].bg_data[i]) | |
28 | - t_bgdef[i].ctrl_flags.x = 0 | |
29 | - t_bgdef[i].ctrl_flags.y = 0 | |
30 | - for k2, v2 in pairs(t_bgdef[i].ctrl) do | |
31 | - for j = 1, #t_bgdef[i].ctrl[k2] do | |
32 | - t_bgdef[i].ctrl[k2][j].timer[1] = t_bgdef[i].ctrl[k2][j].time[1] | |
33 | - t_bgdef[i].ctrl[k2][j].timer[2] = t_bgdef[i].ctrl[k2][j].time[2] | |
34 | - t_bgdef[i].ctrl[k2][j].timer[3] = t_bgdef[i].ctrl[k2][j].time[3] | |
35 | - end | |
36 | - end | |
37 | - end | |
11 | + bgReset(t.scene[k].bg) | |
38 | 12 | end |
13 | + | |
39 | 14 | for k2, v2 in pairs(t.scene[k].layer) do |
40 | 15 | if t.scene[k].layer[k2].anim_data ~= nil then |
41 | 16 | animReset(t.scene[k].layer[k2].anim_data) |
@@ -47,21 +22,24 @@ local function f_reset(t) | ||
47 | 22 | end |
48 | 23 | |
49 | 24 | local function f_play(t) |
25 | + playBGM('') | |
50 | 26 | main.f_printTable(t, 'debug/t_storyboard.txt') |
51 | 27 | --loop through scenes in order |
52 | 28 | for k, v in main.f_sortKeys(t.scene) do |
53 | 29 | --scene >= startscene |
54 | 30 | if k >= t.scenedef.startscene then |
31 | + local fadeType = 'fadein' | |
32 | + local fadeStart = getFrameCount() | |
55 | 33 | for i = 0, t.scene[k].end_time do |
56 | 34 | --end storyboard |
57 | - if esc() or main.f_btnPalNo(main.p1Cmd) > 0 and t.scenedef.skipbutton > 0 then | |
35 | + if (esc() or main.f_btnPalNo(main.p1Cmd) > 0) and t.scenedef.skipbutton > 0 then | |
58 | 36 | main.f_cmdInput() |
59 | 37 | refresh() |
60 | 38 | return |
61 | 39 | end |
62 | 40 | --play bgm |
63 | 41 | if i == 0 and t.scene[k].bgm ~= nil then |
64 | - playBGM(t.scene[k].bgm, true, t.scene[k].bgm_loop, t.scene[k].bgm_volume, t.scene[k].bgm_loopstart or "0", t.scene[k].bgm_loopend or "0") | |
42 | + playBGM(t.scene[k].bgm, true, t.scene[k].bgm_loop, t.scene[k].bgm_volume, t.scene[k].bgm_loopstart, t.scene[k].bgm_loopend) | |
65 | 43 | end |
66 | 44 | --play snd |
67 | 45 | if t.scenedef.snd_data ~= nil then |
@@ -71,11 +49,11 @@ local function f_play(t) | ||
71 | 49 | end |
72 | 50 | end |
73 | 51 | end |
74 | - --clearcolor | |
75 | - animDraw(t.scene[k].clearcolor_data) | |
52 | + --draw clearcolor | |
53 | + clearColor(t.scene[k].clearcolor[1], t.scene[k].clearcolor[2], t.scene[k].clearcolor[3]) | |
76 | 54 | --draw layerno = 0 backgrounds |
77 | 55 | if t.scene[k].bg_name ~= '' then |
78 | - main.f_drawBG(t.scene[k].bg_data, t[t.scene[k].bg_name .. 'def'], 0, i, t.info.localcoord) | |
56 | + bgDraw(t.scene[k].bg, false) | |
79 | 57 | end |
80 | 58 | --loop through layers in order |
81 | 59 | for k2, v2 in main.f_sortKeys(t.scene[k].layer) do |
@@ -95,7 +73,7 @@ local function f_play(t) | ||
95 | 73 | t.scene[k].layerall_pos[1] + t.scene[k].layer[k2].offset[1], |
96 | 74 | t.scene[k].layerall_pos[2] + t.scene[k].layer[k2].offset[2], |
97 | 75 | t.scene[k].layer[k2].text_spacing[2], |
98 | - t.scene[k].layer[k2].textdelay, | |
76 | + t.scene[k].layer[k2].text_delay, | |
99 | 77 | t.scene[k].layer[k2].text_length |
100 | 78 | ) |
101 | 79 | end |
@@ -103,38 +81,38 @@ local function f_play(t) | ||
103 | 81 | end |
104 | 82 | --draw layerno = 1 backgrounds |
105 | 83 | if t.scene[k].bg_name ~= '' then |
106 | - main.f_drawBG(t.scene[k].bg_data, t[t.scene[k].bg_name .. 'def'], 1, i, t.info.localcoord) | |
84 | + bgDraw(t.scene[k].bg, true) | |
107 | 85 | end |
108 | - --fadein | |
109 | - if i <= t.scene[k].fadein_time then | |
110 | - animDraw(t.scene[k].fadein_data) | |
111 | - animUpdate(t.scene[k].fadein_data) | |
112 | - end | |
113 | - --fadeout | |
114 | - if i >= t.scene[k].end_time - t.scene[k].fadeout_time then | |
115 | - animDraw(t.scene[k].fadeout_data) | |
116 | - animUpdate(t.scene[k].fadeout_data) | |
117 | - end | |
118 | - if main.f_btnPalNo(main.p1Cmd) > 0 and t.scenedef.skipbutton <= 0 then | |
119 | - main.f_cmdInput() | |
120 | - refresh() | |
121 | - do | |
122 | - break | |
123 | - end | |
86 | + --draw fadein / fadeout | |
87 | + if i == t.scene[k].end_time - t.scene[k].fadeout_time then | |
88 | + fadeType = 'fadeout' | |
89 | + fadeStart = getFrameCount() | |
124 | 90 | end |
91 | + main.fadeActive = fadeScreen( | |
92 | + fadeType, | |
93 | + fadeStart, | |
94 | + t.scene[k][fadeType .. '_time'], | |
95 | + t.scene[k][fadeType .. '_col'][1], | |
96 | + t.scene[k][fadeType .. '_col'][2], | |
97 | + t.scene[k][fadeType .. '_col'][3] | |
98 | + ) | |
99 | + --if main.f_btnPalNo(main.p1Cmd) > 0 and t.scenedef.skipbutton <= 0 then | |
100 | + -- main.f_cmdInput() | |
101 | + -- refresh() | |
102 | + -- do | |
103 | + -- break | |
104 | + -- end | |
105 | + --end | |
125 | 106 | main.f_cmdInput() |
126 | 107 | refresh() |
127 | 108 | end |
128 | 109 | end |
129 | 110 | end |
130 | - playBGM('', true, 1, 100, "0", "0") | |
131 | 111 | end |
132 | 112 | |
133 | 113 | local function f_parse(path) |
134 | - -- Intro haves his own localcoord function | |
135 | - -- So we disable it | |
114 | + --storyboards use their own localcoord function, so we disable it | |
136 | 115 | main.SetDefaultScale() |
137 | - | |
138 | 116 | local file = io.open(path, 'r') |
139 | 117 | local fileDir, fileName = path:match('^(.-)([^/\\]+)$') |
140 | 118 | local t = {} |
@@ -142,95 +120,32 @@ local function f_parse(path) | ||
142 | 120 | local pos_default = {} |
143 | 121 | local pos_val = {} |
144 | 122 | t.anim = {} |
145 | - t.ctrldef = {} | |
146 | 123 | t.scene = {} |
124 | + t.def = fileDir .. fileName | |
147 | 125 | t.fileDir = fileDir |
148 | 126 | t.fileName = fileName |
149 | - local bgdef = 'dummyUntilSet' | |
150 | - local bgctrl = '' | |
151 | - local bgctrl_match = 'dummyUntilSet' | |
152 | 127 | local tmp = '' |
153 | 128 | local t_default = |
154 | 129 | { |
155 | 130 | info = {localcoord = {320, 240}}, |
156 | - scenedef = {spr = '', snd = '', font = {[1] = 'font/f-6x9.fnt'}, font_height = {}, startscene = 0, skipbutton = 1, font_data = {}}, | |
131 | + scenedef = { | |
132 | + spr = '', | |
133 | + snd = '', | |
134 | + font = {[1] = 'f-6x9.fnt'}, | |
135 | + font_height = {}, | |
136 | + startscene = 0, | |
137 | + skipbutton = 1, --Ikemen feature | |
138 | + font_data = {} | |
139 | + }, | |
157 | 140 | scene = {}, |
158 | - ctrldef = {} | |
159 | 141 | } |
160 | 142 | for line in file:lines() do |
161 | 143 | line = line:gsub('%s*;.*$', '') |
162 | 144 | if line:match('^%s*%[.-%s*%]%s*$') then --matched [] group |
163 | 145 | line = line:match('^%s*%[(.-)%s*%]%s*$') --match text between [] |
164 | 146 | line = line:gsub('[%. ]', '_') --change . and space to _ |
165 | - line = line:lower() --lowercase line | |
166 | - local row = tostring(line:lower()) --just in case it's a number (not really needed) | |
167 | - if row:match('.+ctrldef') then --matched ctrldef start | |
168 | - bgctrl = row | |
169 | - bgctrl_match = bgctrl:match('^(.-ctrl)def') | |
170 | - if t.ctrldef[bgdef .. 'def'][bgctrl] ~= nil then --Ctrldef名の重複を避ける | |
171 | - bgctrl = bgctrl..tostring(os.clock()) | |
172 | - end | |
173 | - t.ctrldef[bgdef .. 'def'][bgctrl] = {} | |
174 | - t.ctrldef[bgdef .. 'def'][bgctrl].ctrl = {} | |
175 | - pos = t.ctrldef[bgdef .. 'def'][bgctrl] | |
176 | - t_default.ctrldef[bgdef .. 'def'][bgctrl] = { | |
177 | - looptime = -1, | |
178 | - ctrlid = {0}, | |
179 | - ctrl = {} | |
180 | - } | |
181 | - elseif row:match('^' .. bgctrl_match) then --matched ctrldef content | |
182 | - tmp = t.ctrldef[bgdef .. 'def'][bgctrl].ctrl | |
183 | - tmp[#tmp + 1] = {} | |
184 | - pos = tmp[#tmp] | |
185 | - t_default.ctrldef[bgdef .. 'def'][bgctrl].ctrl[#tmp] = { | |
186 | - type = 'null', | |
187 | - time = {0, -1, -1}, | |
188 | - ctrlid = {} | |
189 | - } | |
190 | - elseif row:match('.+def$') and not row:match('^scenedef$') --[[and not row:match('^' .. bgdef .. '.*$')]] then --matched bgdef start | |
191 | - t[row] = {} | |
192 | - pos = t[row] | |
193 | - bgdef = row:match('(.+)def$') | |
194 | - t_default[row] = {} | |
195 | - t.ctrldef[bgdef .. 'def'] = {} | |
196 | - t_default.ctrldef[bgdef .. 'def'] = {} | |
197 | - elseif row:match('^' .. bgdef) then --matched bgdef content | |
198 | - tmp = t[bgdef .. 'def'] | |
199 | - tmp[#tmp + 1] = {} | |
200 | - pos = tmp[#tmp] | |
201 | - t_default[bgdef .. 'def'][#tmp] = | |
202 | - { | |
203 | - type = 'normal', | |
204 | - spriteno = {0, 0}, | |
205 | - id = 0, | |
206 | - layerno = 0, | |
207 | - start = {0, 0}, | |
208 | - delta = {1, 1}, | |
209 | - trans = '', | |
210 | - mask = 0, | |
211 | - tile = {0, 0}, | |
212 | - tilespacing = {0, nil}, | |
213 | - --window = {0, 0, 0, 0}, | |
214 | - --windowdelta = {0, 0}, --not supported yet | |
215 | - --width = {0, 0}, --not supported yet (parallax) | |
216 | - --xscale = {1.0, 1.0}, --not supported yet (parallax) | |
217 | - --yscalestart = 100, --not supported yet (parallax) | |
218 | - --yscaledelta = 1, --not supported yet (parallax) | |
219 | - positionlink = 0, | |
220 | - velocity = {0, 0}, | |
221 | - --sin_x = {0, 0, 0}, --not supported yet | |
222 | - --sin_y = {0, 0, 0}, --not supported yet | |
223 | - ctrl = {}, | |
224 | - ctrl_flags = { | |
225 | - visible = 1, | |
226 | - enabled = 1, | |
227 | - velx = 0, | |
228 | - vely = 0, | |
229 | - x = 0, | |
230 | - y = 0 | |
231 | - } | |
232 | - } | |
233 | - elseif row:match('^scene_[0-9]+$') then --matched scene | |
147 | + local row = tostring(line:lower()) | |
148 | + if row:match('^scene_[0-9]+$') then --matched scene | |
234 | 149 | row = tonumber(row:match('^scene_([0-9]+)$')) |
235 | 150 | t.scene[row] = {} |
236 | 151 | pos = t.scene[row] |
@@ -249,9 +164,9 @@ local function f_parse(path) | ||
249 | 164 | sound = {}, |
250 | 165 | --bgm = '', |
251 | 166 | bgm_loop = 0, |
252 | - bgm_volume = 100, | |
253 | - bgm_loopstart = nil, | |
254 | - bgm_loopend = nil, | |
167 | + bgm_volume = 100, --Ikemen feature | |
168 | + bgm_loopstart = 0, --Ikemen feature | |
169 | + bgm_loopend = 0, --Ikemen feature | |
255 | 170 | --window = {0, 0, 0, 0}, |
256 | 171 | bg_name = '' |
257 | 172 | } |
@@ -272,7 +187,7 @@ local function f_parse(path) | ||
272 | 187 | value = value:gsub('"', '') --remove brackets from value |
273 | 188 | value = value:gsub('^(%.[0-9])', '0%1') --add 0 before dot if missing at the beginning of matched string |
274 | 189 | value = value:gsub('([^0-9])(%.[0-9])', '%10%2') --add 0 before dot if missing anywhere else |
275 | - if param:match('^font[0-9]+$') then --font param matched | |
190 | + if param:match('^font[0-9]+') then --font param matched | |
276 | 191 | local num = tonumber(param:match('font([0-9]+)')) |
277 | 192 | if param:match('_height$') then |
278 | 193 | if pos.font_height == nil then |
@@ -280,6 +195,7 @@ local function f_parse(path) | ||
280 | 195 | end |
281 | 196 | pos.font_height[num] = main.f_dataType(value) |
282 | 197 | else |
198 | + value = value:gsub('\\', '/') | |
283 | 199 | if pos.font == nil then |
284 | 200 | pos.font = {} |
285 | 201 | end |
@@ -295,9 +211,9 @@ local function f_parse(path) | ||
295 | 211 | { |
296 | 212 | anim = -1, |
297 | 213 | text = '', |
298 | - font = {1, 0, 0, nil, nil, nil}, | |
214 | + font = {1, 0, 0, 255, 255, 255, 255, 0}, | |
299 | 215 | text_spacing = {0, 15}, --Ikemen feature |
300 | - textdelay = 2, | |
216 | + text_delay = 2, --Ikemen feature | |
301 | 217 | text_length = 50, --Ikemen feature |
302 | 218 | text_timer = 0, --Ikemen feature |
303 | 219 | offset = {0, 0}, |
@@ -330,9 +246,9 @@ local function f_parse(path) | ||
330 | 246 | pos_val[param] = {} |
331 | 247 | end |
332 | 248 | if c == '' then |
333 | - pos_val[param][#pos_val[param] + 1] = 0 | |
249 | + table.insert(pos_val[param], 0) | |
334 | 250 | else |
335 | - pos_val[param][#pos_val[param] + 1] = main.f_dataType(c) | |
251 | + table.insert(pos_val[param], main.f_dataType(c)) | |
336 | 252 | end |
337 | 253 | end |
338 | 254 | else --single value |
@@ -342,11 +258,11 @@ local function f_parse(path) | ||
342 | 258 | end |
343 | 259 | else --only valid lines left are animations |
344 | 260 | line = line:lower() |
345 | - local value = line:match('^%s*([0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+.-)[,%s]*$') or line:match('^%s*loopstart') or line:match('^%s*interpolate offset') or line:match('^%s*interpolate angle') or line:match('^%s*interpolate scale') or line:match('^%s*interpolate blend') | |
261 | + local value = line:match('^%s*([0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+%s*,%s*[0-9%-]+.-)[,%s]*$') or line:match('^%s*loopstart') or line:match('^%s*interpolate [oasb][fncl][fgae][sln][ed]t?') | |
346 | 262 | if value ~= nil then |
347 | 263 | value = value:gsub(',%s*,', ',0,') --add missing values |
348 | 264 | value = value:gsub(',%s*$', '') |
349 | - pos[#pos + 1] = value | |
265 | + table.insert(pos, value) | |
350 | 266 | end |
351 | 267 | end |
352 | 268 | end |
@@ -357,30 +273,6 @@ local function f_parse(path) | ||
357 | 273 | --;=========================================================== |
358 | 274 | --merge tables |
359 | 275 | t = main.f_tableMerge(t_default, t) |
360 | - --ctrldef table adjustment | |
361 | - for k, v in pairs(t.ctrldef) do | |
362 | - for k2, v2 in pairs(t.ctrldef[k]) do | |
363 | - tmp = t.ctrldef[k][k2].ctrl | |
364 | - for i = 1, #tmp do | |
365 | - --if END_TIME is omitted it should default to the same value as START_TIME | |
366 | - if tmp[i].time[2] == -1 then | |
367 | - tmp[i].time[2] = tmp[i].time[1] | |
368 | - end | |
369 | - --if LOOPTIME is omitted or set to -1, the background controller will not reset its own timer. In such case use GLOBAL_LOOPTIME | |
370 | - if tmp[i].time[3] == -1 then | |
371 | - tmp[i].time[3] = t.ctrldef[k][k2].looptime | |
372 | - end | |
373 | - --lowercase type name | |
374 | - tmp[i].type = tmp[i].type:lower() | |
375 | - --this list, if specified, overrides the default list specified in the BGCtrlDef | |
376 | - if #tmp[i].ctrlid == 0 then | |
377 | - for j = 1, #t.ctrldef[k][k2].ctrlid do | |
378 | - tmp[i].ctrlid[#tmp[i].ctrlid + 1] = t.ctrldef[k][k2].ctrlid[j] | |
379 | - end | |
380 | - end | |
381 | - end | |
382 | - end | |
383 | - end | |
384 | 276 | --scenedef spr |
385 | 277 | if not t.scenedef.spr:match('^data/') then |
386 | 278 | if main.f_fileExists(t.fileDir .. t.scenedef.spr) then |
@@ -403,18 +295,11 @@ local function f_parse(path) | ||
403 | 295 | end |
404 | 296 | --scenedef fonts |
405 | 297 | for k, v in pairs(t.scenedef.font) do --loop through table keys |
406 | - if t.scenedef.font[k] ~= '' then | |
407 | - if not t.scenedef.font[k]:match('^data/') then | |
408 | - if main.f_fileExists(t.fileDir .. t.scenedef.font[k]) then | |
409 | - t.scenedef.font[k] = t.fileDir .. t.scenedef.font[k] | |
410 | - elseif main.f_fileExists('font/' .. t.scenedef.font[k]) then | |
411 | - t.scenedef.font[k] = 'font/' .. t.scenedef.font[k] | |
412 | - end | |
413 | - t.scenedef.font_data[k] = fontNew(t.scenedef.font[k]) | |
414 | - t.scenedef.font[k] = {} | |
415 | - t.scenedef.font[k][1] = k | |
416 | - t.scenedef.font[k][2] = 0 | |
417 | - t.scenedef.font[k][3] = 0 | |
298 | + if v ~= '' and t.scenedef.font_data[v] == nil then | |
299 | + if t.scenedef.font_height[k] ~= nil then | |
300 | + t.scenedef.font_data[v] = fontNew(v, t.scenedef.font_height[k]) | |
301 | + else | |
302 | + t.scenedef.font_data[v] = fontNew(v) | |
418 | 303 | end |
419 | 304 | end |
420 | 305 | end |
@@ -422,8 +307,9 @@ local function f_parse(path) | ||
422 | 307 | local prev_k = '' |
423 | 308 | for k, v in main.f_sortKeys(t.scene) do |
424 | 309 | --bgm |
425 | - if t.scene[k].bgm ~= nil and not t.scene[k].bgm:match('^data/') then | |
426 | - if main.f_fileExists(t.fileDir .. t.scene[k].bgm) then | |
310 | + if t.scene[k].bgm ~= nil then | |
311 | + if t.scene[k].bgm:match('^data/') then | |
312 | + elseif main.f_fileExists(t.fileDir .. t.scene[k].bgm) then | |
427 | 313 | t.scene[k].bgm = t.fileDir .. t.scene[k].bgm |
428 | 314 | elseif main.f_fileExists('music/' .. t.scene[k].bgm) then |
429 | 315 | t.scene[k].bgm = 'music/' .. t.scene[k].bgm |
@@ -445,83 +331,11 @@ local function f_parse(path) | ||
445 | 331 | end |
446 | 332 | end |
447 | 333 | prev_k = k |
448 | - --backgrounds data | |
449 | - local anim = '' | |
334 | + --backgrounds | |
450 | 335 | if t.scene[k].bg_name ~= '' then |
451 | - t.scene[k].bg_data = {} | |
452 | - t.scene[k].bg_name = t.scene[k].bg_name:lower() | |
453 | - local t_bgdef = t[t.scene[k].bg_name .. 'def'] | |
454 | - local prev_k2 = '' | |
455 | - for k2, v2 in pairs(t_bgdef) do --loop through table keys | |
456 | - if type(k2) == "number" and t_bgdef[k2].type ~= nil then | |
457 | - t_bgdef[k2].type = t_bgdef[k2].type:lower() | |
458 | - --mugen ignores delta = 0 (defaults to 1) | |
459 | - if t_bgdef[k2].delta[1] == 0 then t_bgdef[k2].delta[1] = 1 end | |
460 | - if t_bgdef[k2].delta[2] == 0 then t_bgdef[k2].delta[2] = 1 end | |
461 | - --add ctrl data | |
462 | - t[t.scene[k].bg_name .. 'def'][k2].ctrl = main.f_ctrlBG(t_bgdef[k2], t.ctrldef[t.scene[k].bg_name .. 'def']) | |
463 | - --positionlink adjustment | |
464 | - if t_bgdef[k2].positionlink == 1 and prev_k2 ~= '' then | |
465 | - t_bgdef[k2].start[1] = t_bgdef[prev_k2].start[1] | |
466 | - t_bgdef[k2].start[2] = t_bgdef[prev_k2].start[2] | |
467 | - t_bgdef[k2].delta[1] = t_bgdef[prev_k2].delta[1] | |
468 | - t_bgdef[k2].delta[2] = t_bgdef[prev_k2].delta[2] | |
469 | - end | |
470 | - prev_k2 = k2 | |
471 | - --generate anim data | |
472 | - local sizeX, sizeY, offsetX, offsetY = 0, 0, 0, 0 | |
473 | - if t_bgdef[k2].type == 'anim' then | |
474 | - anim = main.f_animFromTable(t.anim[t_bgdef[k2].actionno], t.scenedef.spr_data, t_bgdef[k2].start[1], t_bgdef[k2].start[2]) | |
475 | - else --normal, parallax | |
476 | - anim = t_bgdef[k2].spriteno[1] .. ', ' .. t_bgdef[k2].spriteno[2] .. ', ' .. t_bgdef[k2].start[1] .. ', ' .. t_bgdef[k2].start[2] .. ', ' .. -1 | |
477 | - anim = animNew(t.scenedef.spr_data, anim) | |
478 | - sizeX, sizeY, offsetX, offsetY = getSpriteInfo(t.scenedef.spr, t_bgdef[k2].spriteno[1], t_bgdef[k2].spriteno[2]) | |
479 | - end | |
480 | - if t_bgdef[k2].trans == 'add1' then | |
481 | - animSetAlpha(anim, 255, 128) | |
482 | - elseif t_bgdef[k2].trans == 'add' then | |
483 | - animSetAlpha(anim, 255, 255) | |
484 | - elseif t_bgdef[k2].trans == 'sub' then | |
485 | - animSetAlpha(anim, 1, 255) | |
486 | - end | |
487 | - animAddPos(anim, 160, 0) --for some reason needed in ikemen | |
488 | - if t_bgdef[k2].window ~= nil then | |
489 | - animSetWindow( | |
490 | - anim, | |
491 | - t_bgdef[k2].window[1] * 320/t.info.localcoord[1], | |
492 | - t_bgdef[k2].window[2] * 240/t.info.localcoord[2], | |
493 | - (t_bgdef[k2].window[3] - t_bgdef[k2].window[1] + 1)* 320/t.info.localcoord[1], | |
494 | - (t_bgdef[k2].window[4] - t_bgdef[k2].window[2] + 1) * 240/t.info.localcoord[2] | |
495 | - ) | |
496 | - else | |
497 | - animSetWindow(anim, 0, 0, t.info.localcoord[1], t.info.localcoord[2]) | |
498 | - end | |
499 | - if t_bgdef[k2].tilespacing[2] == nil then t_bgdef[k2].tilespacing[2] = t_bgdef[k2].tilespacing[1] end | |
500 | - if t_bgdef[k2].type == 'parallax' then | |
501 | - animSetTile(anim, t_bgdef[k2].tile[1], 0, t_bgdef[k2].tilespacing[1] + sizeX, t_bgdef[k2].tilespacing[2] + sizeY) | |
502 | - else | |
503 | - animSetTile(anim, t_bgdef[k2].tile[1], t_bgdef[k2].tile[2], t_bgdef[k2].tilespacing[1] + sizeX, t_bgdef[k2].tilespacing[2] + sizeY) | |
504 | - end | |
505 | - animSetScale(anim, 320/t.info.localcoord[1], 240/t.info.localcoord[2]) | |
506 | - if t_bgdef[k2].mask == 1 or t_bgdef[k2].type ~= 'normal' or (t_bgdef[k2].trans ~= '' and t_bgdef[k2].trans ~= 'none') then | |
507 | - animSetColorKey(anim, 0) | |
508 | - else | |
509 | - animSetColorKey(anim, -1) | |
510 | - end | |
511 | - --animUpdate(anim) | |
512 | - t.scene[k].bg_data[k2] = anim | |
513 | - end | |
514 | - end | |
336 | + t.scene[k].bg = bgNew(t.def, t.scene[k].bg_name:lower(), t.scenedef.spr) | |
337 | + bgReset(t.scene[k].bg) | |
515 | 338 | end |
516 | - --clearcolor data | |
517 | - t.scene[k].clearcolor_data = main.f_clearColor(t.scene[k].clearcolor[1], t.scene[k].clearcolor[2], t.scene[k].clearcolor[3]) | |
518 | - animSetWindow(t.scene[k].clearcolor_data, 0, 0, t.info.localcoord[1], t.info.localcoord[2]) | |
519 | - --fadein data | |
520 | - t.scene[k].fadein_data = main.f_fadeAnim(1, t.scene[k].fadein_time, t.scene[k].fadein_col[1], t.scene[k].fadein_col[2], t.scene[k].fadein_col[3]) | |
521 | - animSetWindow(t.scene[k].fadein_data, 0, 0, t.info.localcoord[1], t.info.localcoord[2]) | |
522 | - --fadeout data | |
523 | - t.scene[k].fadeout_data = main.f_fadeAnim(0, t.scene[k].fadeout_time, t.scene[k].fadeout_col[1], t.scene[k].fadeout_col[2], t.scene[k].fadeout_col[3]) | |
524 | - animSetWindow(t.scene[k].fadeout_data, 0, 0, t.info.localcoord[1], t.info.localcoord[2]) | |
525 | 339 | --loop through scene layers |
526 | 340 | local t_layer = t.scene[k].layer |
527 | 341 | for k2, v2 in pairs(t_layer) do |
@@ -533,12 +347,12 @@ local function f_parse(path) | ||
533 | 347 | t.scene[k].layerall_pos[1] + t_layer[k2].offset[1], |
534 | 348 | t.scene[k].layerall_pos[2] + t_layer[k2].offset[2] |
535 | 349 | ) |
536 | - animSetScale(t.scene[k].layer[k2].anim_data, 320/t.info.localcoord[1], 240/t.info.localcoord[2]) | |
350 | + --animSetScale(t.scene[k].layer[k2].anim_data, 320/t.info.localcoord[1], 240/t.info.localcoord[2]) | |
537 | 351 | end |
538 | 352 | --text |
539 | 353 | if t_layer[k2].text ~= '' then |
540 | 354 | t.scene[k].layer[k2].text_data = main.f_createTextImg( |
541 | - t.scenedef.font_data[t.scenedef.font[t_layer[k2].font[1]][1]], | |
355 | + t.scenedef.font_data[t_layer[k2].font[1]], | |
542 | 356 | t_layer[k2].font[2], |
543 | 357 | t_layer[k2].font[3], |
544 | 358 | t_layer[k2].text, |
@@ -548,7 +362,9 @@ local function f_parse(path) | ||
548 | 362 | 240/t.info.localcoord[2], |
549 | 363 | t_layer[k2].font[4], |
550 | 364 | t_layer[k2].font[5], |
551 | - t_layer[k2].font[6] | |
365 | + t_layer[k2].font[6], | |
366 | + t_layer[k2].font[7], | |
367 | + t_layer[k2].font[8] | |
552 | 368 | ) |
553 | 369 | end |
554 | 370 | --endtime |
@@ -557,12 +373,8 @@ local function f_parse(path) | ||
557 | 373 | end |
558 | 374 | end |
559 | 375 | end |
560 | - --t.ctrldef = nil | |
561 | - | |
562 | - -- Finished loading intro | |
563 | - -- Re-enabled custom scaling | |
376 | + --finished loading storyboard, re-enable custom scaling | |
564 | 377 | main.SetScaleValues() |
565 | - | |
566 | 378 | return t |
567 | 379 | end |
568 | 380 |
@@ -0,0 +1,342 @@ | ||
1 | +package main | |
2 | + | |
3 | +import ( | |
4 | + "strings" | |
5 | +) | |
6 | + | |
7 | +func (bgct *bgcTimeLine) stepBGDef(s *BGDef) { | |
8 | + if len(bgct.line) > 0 && bgct.line[0].waitTime <= 0 { | |
9 | + for _, b := range bgct.line[0].bgc { | |
10 | + for i, a := range bgct.al { | |
11 | + if b.idx < a.idx { | |
12 | + bgct.al = append(bgct.al, nil) | |
13 | + copy(bgct.al[i+1:], bgct.al[i:]) | |
14 | + bgct.al[i] = b | |
15 | + b = nil | |
16 | + break | |
17 | + } | |
18 | + } | |
19 | + if b != nil { | |
20 | + bgct.al = append(bgct.al, b) | |
21 | + } | |
22 | + } | |
23 | + bgct.line = bgct.line[1:] | |
24 | + } | |
25 | + if len(bgct.line) > 0 { | |
26 | + bgct.line[0].waitTime-- | |
27 | + } | |
28 | + var el []*bgCtrl | |
29 | + for i := 0; i < len(bgct.al); { | |
30 | + s.runBgCtrl(bgct.al[i]) | |
31 | + if bgct.al[i].currenttime > bgct.al[i].endtime { | |
32 | + el = append(el, bgct.al[i]) | |
33 | + bgct.al = append(bgct.al[:i], bgct.al[i+1:]...) | |
34 | + continue | |
35 | + } | |
36 | + i++ | |
37 | + } | |
38 | + for _, b := range el { | |
39 | + bgct.add(b) | |
40 | + } | |
41 | +} | |
42 | + | |
43 | +type BGDef struct { | |
44 | + def string | |
45 | + localcoord [2]float32 | |
46 | + sffloc string | |
47 | + sff *Sff | |
48 | + at AnimationTable | |
49 | + bg []*backGround | |
50 | + bgc []bgCtrl | |
51 | + bgct bgcTimeLine | |
52 | + bga bgAction | |
53 | + resetbg bool | |
54 | + localscl float32 | |
55 | + scale [2]float32 | |
56 | +} | |
57 | + | |
58 | +func newBGDef(def string) *BGDef { | |
59 | + s := &BGDef{def: def, localcoord: [...]float32{320, 240}, resetbg: true, localscl: 1, scale: [...]float32{1, 1}} | |
60 | + return s | |
61 | +} | |
62 | + | |
63 | +func loadBGDef(def string, bgname string, sffloc string) (int, error) { | |
64 | + s := newBGDef(def) | |
65 | + str, err := LoadText(def) | |
66 | + if err != nil { | |
67 | + return -1, err | |
68 | + } | |
69 | + s.sff = &Sff{} | |
70 | + lines, i := SplitAndTrim(str, "\n"), 0 | |
71 | + defmap := make(map[string][]IniSection) | |
72 | + for i < len(lines) { | |
73 | + is, name, _ := ReadIniSection(lines, &i) | |
74 | + if i := strings.IndexAny(name, " \t"); i >= 0 { | |
75 | + if name[:i] == bgname { | |
76 | + defmap[bgname] = append(defmap[bgname], is) | |
77 | + } | |
78 | + } else { | |
79 | + defmap[name] = append(defmap[name], is) | |
80 | + } | |
81 | + } | |
82 | + i = 0 | |
83 | + if sec := defmap["info"]; len(sec) > 0 { | |
84 | + sec[0].readF32ForStage("localcoord", &s.localcoord[0], &s.localcoord[1]) | |
85 | + } | |
86 | + var ok, skipat bool | |
87 | + var filename string | |
88 | + bgnum := -1 | |
89 | + if sffloc != "" { | |
90 | + filename = sffloc | |
91 | + } else if sec := defmap["files"]; len(sec) > 0 { | |
92 | + if sec[0].LoadFile("spr", def, func(filename string) error { | |
93 | + filename = strings.Replace(filename, "\\", "/", -1) | |
94 | + return nil | |
95 | + }); err != nil { | |
96 | + return -1, err | |
97 | + } | |
98 | + } | |
99 | + for j := 0; j < len(sys.bgdef); j++ { | |
100 | + if !ok && sys.bgdef[j].sffloc == filename { | |
101 | + *s.sff = *sys.bgdef[j].sff | |
102 | + bgnum = j | |
103 | + ok = true | |
104 | + } | |
105 | + if sys.bgdef[j].def == def && ok { | |
106 | + skipat = true | |
107 | + break | |
108 | + } | |
109 | + } | |
110 | + if !ok { //skip loadSFF if already loaded | |
111 | + sff, err := loadSff(filename, false) | |
112 | + if err != nil { | |
113 | + return -1, err | |
114 | + } | |
115 | + *s.sff = *sff | |
116 | + } | |
117 | + s.sffloc = filename | |
118 | + if skipat { //skip ReadAnimationTable if already parsed | |
119 | + s.at = sys.bgdef[bgnum].at | |
120 | + } else { | |
121 | + s.at = ReadAnimationTable(s.sff, lines, &i) | |
122 | + } | |
123 | + var bglink *backGround | |
124 | + for _, bgsec := range defmap[bgname] { | |
125 | + if len(s.bg) > 0 && s.bg[len(s.bg)-1].positionlink { | |
126 | + bglink = s.bg[len(s.bg)-1] | |
127 | + } | |
128 | + s.bg = append(s.bg, readBackGround(bgsec, bglink, | |
129 | + s.sff, s.at, 0)) | |
130 | + } | |
131 | + bgcdef := *newBgCtrl() | |
132 | + i = 0 | |
133 | + for i < len(lines) { | |
134 | + is, name, _ := ReadIniSection(lines, &i) | |
135 | + if len(name) > 0 && name[len(name)-1] == ' ' { | |
136 | + name = name[:len(name)-1] | |
137 | + } | |
138 | + switch name { | |
139 | + case bgname + "ctrldef": | |
140 | + bgcdef.bg, bgcdef.looptime = nil, -1 | |
141 | + if ids := is.readI32CsvForStage("ctrlid"); len(ids) > 0 && | |
142 | + (len(ids) > 1 || ids[0] != -1) { | |
143 | + kishutu := make(map[int32]bool) | |
144 | + for _, id := range ids { | |
145 | + if kishutu[id] { | |
146 | + continue | |
147 | + } | |
148 | + bgcdef.bg = append(bgcdef.bg, s.getBg(id)...) | |
149 | + kishutu[id] = true | |
150 | + } | |
151 | + } else { | |
152 | + bgcdef.bg = append(bgcdef.bg, s.bg...) | |
153 | + } | |
154 | + is.ReadI32("looptime", &bgcdef.looptime) | |
155 | + case bgname + "ctrl": | |
156 | + bgc := newBgCtrl() | |
157 | + *bgc = bgcdef | |
158 | + if ids := is.readI32CsvForStage("ctrlid"); len(ids) > 0 { | |
159 | + bgc.bg = nil | |
160 | + if len(ids) > 1 || ids[0] != -1 { | |
161 | + kishutu := make(map[int32]bool) | |
162 | + for _, id := range ids { | |
163 | + if kishutu[id] { | |
164 | + continue | |
165 | + } | |
166 | + bgc.bg = append(bgc.bg, s.getBg(id)...) | |
167 | + kishutu[id] = true | |
168 | + } | |
169 | + } else { | |
170 | + bgc.bg = append(bgc.bg, s.bg...) | |
171 | + } | |
172 | + } | |
173 | + bgc.read(is, len(s.bgc)) | |
174 | + s.bgc = append(s.bgc, *bgc) | |
175 | + } | |
176 | + } | |
177 | + //s.localscl = float32(sys.gameWidth) / float32(sys.cam.localcoord[0]) | |
178 | + sys.bgdef = append(sys.bgdef, s) | |
179 | + return len(sys.bgdef)-1, nil | |
180 | +} | |
181 | +func (s *BGDef) getBg(id int32) (bg []*backGround) { | |
182 | + if id >= 0 { | |
183 | + for _, b := range s.bg { | |
184 | + if b.id == id { | |
185 | + bg = append(bg, b) | |
186 | + } | |
187 | + } | |
188 | + } | |
189 | + return | |
190 | +} | |
191 | +func (s *BGDef) runBgCtrl(bgc *bgCtrl) { | |
192 | + bgc.currenttime++ | |
193 | + switch bgc._type { | |
194 | + case BT_Anim: | |
195 | + a := s.at.get(bgc.v[0]) | |
196 | + if a != nil { | |
197 | + for i := range bgc.bg { | |
198 | + bgc.bg[i].actionno = bgc.v[0] | |
199 | + bgc.bg[i].anim = *a | |
200 | + } | |
201 | + } | |
202 | + case BT_Visible: | |
203 | + for i := range bgc.bg { | |
204 | + bgc.bg[i].visible = bgc.v[0] != 0 | |
205 | + } | |
206 | + case BT_Enable: | |
207 | + for i := range bgc.bg { | |
208 | + bgc.bg[i].visible, bgc.bg[i].active = bgc.v[0] != 0, bgc.v[0] != 0 | |
209 | + } | |
210 | + case BT_PosSet: | |
211 | + for i := range bgc.bg { | |
212 | + if bgc.xEnable() { | |
213 | + bgc.bg[i].bga.pos[0] = bgc.x | |
214 | + } | |
215 | + if bgc.yEnable() { | |
216 | + bgc.bg[i].bga.pos[1] = bgc.y | |
217 | + } | |
218 | + } | |
219 | + if bgc.positionlink { | |
220 | + if bgc.xEnable() { | |
221 | + s.bga.pos[0] = bgc.x | |
222 | + } | |
223 | + if bgc.yEnable() { | |
224 | + s.bga.pos[1] = bgc.y | |
225 | + } | |
226 | + } | |
227 | + case BT_PosAdd: | |
228 | + for i := range bgc.bg { | |
229 | + if bgc.xEnable() { | |
230 | + bgc.bg[i].bga.pos[0] += bgc.x | |
231 | + } | |
232 | + if bgc.yEnable() { | |
233 | + bgc.bg[i].bga.pos[1] += bgc.y | |
234 | + } | |
235 | + } | |
236 | + if bgc.positionlink { | |
237 | + if bgc.xEnable() { | |
238 | + s.bga.pos[0] += bgc.x | |
239 | + } | |
240 | + if bgc.yEnable() { | |
241 | + s.bga.pos[1] += bgc.y | |
242 | + } | |
243 | + } | |
244 | + case BT_SinX, BT_SinY: | |
245 | + ii := Btoi(bgc._type == BT_SinY) | |
246 | + if bgc.v[0] == 0 { | |
247 | + bgc.v[1] = 0 | |
248 | + } | |
249 | + a := float32(bgc.v[2]) / 360 | |
250 | + st := int32((a - float32(int32(a))) * float32(bgc.v[1])) | |
251 | + if st < 0 { | |
252 | + st += Abs(bgc.v[1]) | |
253 | + } | |
254 | + for i := range bgc.bg { | |
255 | + bgc.bg[i].bga.radius[ii] = bgc.x | |
256 | + bgc.bg[i].bga.sinlooptime[ii] = bgc.v[1] | |
257 | + bgc.bg[i].bga.sintime[ii] = st | |
258 | + } | |
259 | + if bgc.positionlink { | |
260 | + s.bga.radius[ii] = bgc.x | |
261 | + s.bga.sinlooptime[ii] = bgc.v[1] | |
262 | + s.bga.sintime[ii] = st | |
263 | + } | |
264 | + case BT_VelSet: | |
265 | + for i := range bgc.bg { | |
266 | + if bgc.xEnable() { | |
267 | + bgc.bg[i].bga.vel[0] = bgc.x | |
268 | + } | |
269 | + if bgc.yEnable() { | |
270 | + bgc.bg[i].bga.vel[1] = bgc.y | |
271 | + } | |
272 | + } | |
273 | + if bgc.positionlink { | |
274 | + if bgc.xEnable() { | |
275 | + s.bga.vel[0] = bgc.x | |
276 | + } | |
277 | + if bgc.yEnable() { | |
278 | + s.bga.vel[1] = bgc.y | |
279 | + } | |
280 | + } | |
281 | + case BT_VelAdd: | |
282 | + for i := range bgc.bg { | |
283 | + if bgc.xEnable() { | |
284 | + bgc.bg[i].bga.vel[0] += bgc.x | |
285 | + } | |
286 | + if bgc.yEnable() { | |
287 | + bgc.bg[i].bga.vel[1] += bgc.y | |
288 | + } | |
289 | + } | |
290 | + if bgc.positionlink { | |
291 | + if bgc.xEnable() { | |
292 | + s.bga.vel[0] += bgc.x | |
293 | + } | |
294 | + if bgc.yEnable() { | |
295 | + s.bga.vel[1] += bgc.y | |
296 | + } | |
297 | + } | |
298 | + } | |
299 | +} | |
300 | +func (s *BGDef) action() { | |
301 | + s.bgct.stepBGDef(s) | |
302 | + s.bga.action() | |
303 | + link := 0 | |
304 | + for i, b := range s.bg { | |
305 | + s.bg[i].bga.action() | |
306 | + if i > 0 && b.positionlink { | |
307 | + s.bg[i].bga.offset[0] += s.bg[link].bga.sinoffset[0] | |
308 | + s.bg[i].bga.offset[1] += s.bg[link].bga.sinoffset[1] | |
309 | + } else { | |
310 | + link = i | |
311 | + } | |
312 | + if b.active { | |
313 | + s.bg[i].anim.Action() | |
314 | + } | |
315 | + } | |
316 | +} | |
317 | +func (s *BGDef) draw(top bool, x, y, scl float32) { | |
318 | + if !top { | |
319 | + s.action() | |
320 | + } | |
321 | + x, y = x/s.localscl, y/s.localscl | |
322 | + bgscl := float32(1) | |
323 | + pos := [...]float32{x, y} | |
324 | + for _, b := range s.bg { | |
325 | + if b.visible && b.toplayer == top && b.anim.spr != nil { | |
326 | + b.draw(pos, scl, bgscl, s.localscl, s.scale, 0) | |
327 | + } | |
328 | + } | |
329 | +} | |
330 | +func (s *BGDef) reset() { | |
331 | + s.bga.clear() | |
332 | + for i := range s.bg { | |
333 | + s.bg[i].reset() | |
334 | + } | |
335 | + for i := range s.bgc { | |
336 | + s.bgc[i].currenttime = 0 | |
337 | + } | |
338 | + s.bgct.clear() | |
339 | + for i := len(s.bgc) - 1; i >= 0; i-- { | |
340 | + s.bgct.add(&s.bgc[i]) | |
341 | + } | |
342 | +} |
@@ -319,6 +319,7 @@ const ( | ||
319 | 319 | OC_const_stagevar_info_author |
320 | 320 | OC_const_stagevar_info_displayname |
321 | 321 | OC_const_stagevar_info_name |
322 | + OC_const_gamemode | |
322 | 323 | ) |
323 | 324 | const ( |
324 | 325 | OC_st_var OpCode = iota + OC_var*2 |
@@ -1455,6 +1456,11 @@ func (be BytecodeExp) run_const(c *Char, i *int, oc *Char) { | ||
1455 | 1456 | sys.stringPool[sys.workingState.playerNo].List[*(*int32)( |
1456 | 1457 | unsafe.Pointer(&be[*i]))]) |
1457 | 1458 | *i += 4 |
1459 | + case OC_const_gamemode: | |
1460 | + sys.bcStack.PushB(sys.gameMode == | |
1461 | + sys.stringPool[sys.workingState.playerNo].List[*(*int32)( | |
1462 | + unsafe.Pointer(&be[*i]))]) | |
1463 | + *i += 4 | |
1458 | 1464 | default: |
1459 | 1465 | sys.errLog.Printf("%v\n", be[*i-1]) |
1460 | 1466 | c.panic() |
@@ -5141,7 +5147,7 @@ func (sc attackMulSet) Run(c *Char, _ []int32) bool { | ||
5141 | 5147 | StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool { |
5142 | 5148 | switch id { |
5143 | 5149 | case attackMulSet_value: |
5144 | - crun.attackMul = float32(crun.gi().data.attack) / 100 * exp[0].evalF(c) | |
5150 | + crun.attackMul = float32(crun.gi().data.attack) * crun.ocd().attackRatio / 100 * exp[0].evalF(c) | |
5145 | 5151 | case attackMulSet_redirectid: |
5146 | 5152 | if rid := sys.playerID(exp[0].evalI(c)); rid != nil { |
5147 | 5153 | crun = rid |
@@ -5166,7 +5172,7 @@ func (sc defenceMulSet) Run(c *Char, _ []int32) bool { | ||
5166 | 5172 | StateControllerBase(sc).run(c, func(id byte, exp []BytecodeExp) bool { |
5167 | 5173 | switch id { |
5168 | 5174 | case defenceMulSet_value: |
5169 | - crun.defenceMul = float32(crun.gi().data.defence) / (exp[0].evalF(c) * 100) | |
5175 | + crun.defenceMul = float32(crun.gi().data.defence) * crun.ocd().defenceRatio / (exp[0].evalF(c) * 100) | |
5170 | 5176 | case defenceMulSet_redirectid: |
5171 | 5177 | if rid := sys.playerID(exp[0].evalI(c)); rid != nil { |
5172 | 5178 | crun = rid |
@@ -1366,6 +1366,7 @@ const ( | ||
1366 | 1366 | type CharGlobalInfo struct { |
1367 | 1367 | def string |
1368 | 1368 | displayname string |
1369 | + lifebarname string | |
1369 | 1370 | author string |
1370 | 1371 | nameLow string |
1371 | 1372 | authorLow string |
@@ -1633,8 +1634,8 @@ func (c *Char) clear2() { | ||
1633 | 1634 | c.CharSystemVar = CharSystemVar{bindToId: -1, |
1634 | 1635 | angleScalse: [...]float32{1, 1}, alpha: [...]int32{255, 0}, |
1635 | 1636 | width: [...]float32{c.defFW(), c.defBW()}, |
1636 | - attackMul: float32(c.gi().data.attack) / 100, | |
1637 | - defenceMul: float32(c.gi().data.defence) / 100} | |
1637 | + attackMul: float32(c.gi().data.attack) * c.ocd().attackRatio / 100, | |
1638 | + defenceMul: float32(c.gi().data.defence) * c.ocd().defenceRatio / 100} | |
1638 | 1639 | c.oldPos, c.drawPos = c.pos, c.pos |
1639 | 1640 | if c.helperIndex == 0 { |
1640 | 1641 | if sys.roundsExisted[c.playerNo&1] > 0 { |
@@ -1656,9 +1657,18 @@ func (c *Char) gi() *CharGlobalInfo { | ||
1656 | 1657 | func (c *Char) stCgi() *CharGlobalInfo { |
1657 | 1658 | return &sys.cgi[c.ss.sb.playerNo] |
1658 | 1659 | } |
1660 | +func (c *Char) ocd() *OverwriteCharData { | |
1661 | + if sys.tmode[c.playerNo&1] == TM_Turns { | |
1662 | + if c.playerNo&1 == 0 { | |
1663 | + return &sys.ocd[c.memberNo * 2] | |
1664 | + } | |
1665 | + return &sys.ocd[c.memberNo * 2 + 1] | |
1666 | + } | |
1667 | + return &sys.ocd[c.playerNo] | |
1668 | +} | |
1659 | 1669 | func (c *Char) load(def string) error { |
1660 | 1670 | gi := &sys.cgi[c.playerNo] |
1661 | - gi.def, gi.displayname, gi.author, gi.sff, gi.snd, gi.quotes = def, "", "", nil, nil, [MaxQuotes]string{} | |
1671 | + gi.def, gi.displayname, gi.lifebarname, gi.author, gi.sff, gi.snd, gi.quotes = def, "", "", "", nil, nil, [MaxQuotes]string{} | |
1662 | 1672 | gi.anim = NewAnimationTable() |
1663 | 1673 | for i := range gi.palkeymap { |
1664 | 1674 | gi.palkeymap[i] = int32(i) |
@@ -1686,6 +1696,10 @@ func (c *Char) load(def string) error { | ||
1686 | 1696 | if !ok { |
1687 | 1697 | gi.displayname = c.name |
1688 | 1698 | } |
1699 | + gi.lifebarname, ok, _ = is.getText("lifebarname") | |
1700 | + if !ok { | |
1701 | + gi.lifebarname = gi.displayname | |
1702 | + } | |
1689 | 1703 | gi.author, _, _ = is.getText("author") |
1690 | 1704 | gi.authorLow = strings.ToLower(gi.author) |
1691 | 1705 | gi.nameLow = strings.ToLower(c.name) |
@@ -1805,20 +1819,9 @@ func (c *Char) load(def string) error { | ||
1805 | 1819 | case "data": |
1806 | 1820 | if data { |
1807 | 1821 | data = false |
1808 | - var tmp int32 | |
1809 | - tmp = Atoi(sys.cmdFlags[fmt.Sprintf("-p%v.life", c.playerNo+1)]) | |
1810 | - if tmp != 0 { | |
1811 | - gi.data.life = tmp | |
1812 | - } else { | |
1813 | - is.ReadI32("life", &gi.data.life) | |
1814 | - } | |
1822 | + is.ReadI32("life", &gi.data.life) | |
1815 | 1823 | c.lifeMax = gi.data.life |
1816 | - tmp = Atoi(sys.cmdFlags[fmt.Sprintf("-p%v.power", c.playerNo+1)]) | |
1817 | - if tmp != 0 { | |
1818 | - gi.data.power = tmp | |
1819 | - } else { | |
1820 | - is.ReadI32("power", &gi.data.power) | |
1821 | - } | |
1824 | + is.ReadI32("power", &gi.data.power) | |
1822 | 1825 | c.powerMax = gi.data.power |
1823 | 1826 | is.ReadI32("attack", &gi.data.attack) |
1824 | 1827 | is.ReadI32("defence", &gi.data.defence) |
@@ -4528,7 +4531,7 @@ func (c *Char) update(cvmin, cvmax, | ||
4528 | 4531 | if c.hittmp > 0 { |
4529 | 4532 | c.hittmp = 0 |
4530 | 4533 | } |
4531 | - c.defenceMul = float32(c.gi().data.defence) / 100 | |
4534 | + c.defenceMul = float32(c.gi().data.defence) * c.ocd().defenceRatio / 100 | |
4532 | 4535 | c.ghv.hittime = -1 |
4533 | 4536 | c.ghv.hitshaketime = 0 |
4534 | 4537 | c.ghv.fallf = false |
@@ -265,7 +265,10 @@ func SearchFile(file string, deffile string) string { | ||
265 | 265 | if defdir != "data" { |
266 | 266 | fp = "data/" + file |
267 | 267 | if fp = FileExist(fp); len(fp) == 0 { |
268 | - _else = true | |
268 | + fp = sys.motifDir + file | |
269 | + if fp = FileExist(fp); len(fp) == 0 { | |
270 | + _else = true | |
271 | + } | |
269 | 272 | } |
270 | 273 | } else { |
271 | 274 | _else = true |
@@ -1421,6 +1421,10 @@ func (c *Compiler) expValue(out *BytecodeExp, in *string, | ||
1421 | 1421 | out.append(OC_frontedgedist) |
1422 | 1422 | case "gameheight": |
1423 | 1423 | out.append(OC_gameheight) |
1424 | + case "gamemode": | |
1425 | + if err := nameSub(OC_const_gamemode); err != nil { | |
1426 | + return bvNone(), err | |
1427 | + } | |
1424 | 1428 | case "gametime": |
1425 | 1429 | out.append(OC_gametime) |
1426 | 1430 | case "gamewidth": |
@@ -51,17 +51,13 @@ func loadFnt(filename string) (*Fnt, error) { | ||
51 | 51 | |
52 | 52 | func loadFntV1(filename string) (*Fnt, error) { |
53 | 53 | f := newFnt() |
54 | - fp, err := os.Open("font/" + filename) | |
55 | 54 | |
56 | - f.PalName = filename | |
55 | + filename = SearchFile(filename, "font/") | |
57 | 56 | |
58 | - //Check file in "font/"" directory | |
59 | - if err != nil { | |
60 | - err = nil | |
61 | - fp, err = os.Open(filename) | |
62 | - } | |
57 | + fp, err := os.Open(filename) | |
58 | + | |
59 | + f.PalName = filename | |
63 | 60 | |
64 | - //Error opening file | |
65 | 61 | if err != nil { |
66 | 62 | return nil, err |
67 | 63 | } |
@@ -256,15 +252,11 @@ func loadFntV1(filename string) (*Fnt, error) { | ||
256 | 252 | func loadFntV2(filename string) (*Fnt, error) { |
257 | 253 | f := newFnt() |
258 | 254 | |
259 | - content, err := LoadText("font/" + filename) | |
255 | + filename = SearchFile(filename, "font/") | |
260 | 256 | |
261 | - f.PalName = filename | |
257 | + content, err := LoadText(filename) | |
262 | 258 | |
263 | - //Check file in "font/"" directory | |
264 | - if err != nil { | |
265 | - err = nil | |
266 | - content, err = LoadText(filename) | |
267 | - } | |
259 | + f.PalName = filename | |
268 | 260 | |
269 | 261 | if err != nil { |
270 | 262 | return nil, err |
@@ -361,7 +353,7 @@ func loadFntTtf(f *Fnt, fontfile string, filename string) { | ||
361 | 353 | |
362 | 354 | func loadFntSff(f *Fnt, fontfile string, filename string) { |
363 | 355 | fileDir := SearchFile(filename, fontfile) |
364 | - sff, err := loadSff("font/"+fileDir, false) | |
356 | + sff, err := loadSff(fileDir, false) | |
365 | 357 | |
366 | 358 | if err != nil { |
367 | 359 | err = nil |
@@ -13,6 +13,7 @@ import ( | ||
13 | 13 | "unsafe" |
14 | 14 | |
15 | 15 | "github.com/go-gl/gl/v2.1/gl" |
16 | + "github.com/kbinani/screenshot" | |
16 | 17 | ) |
17 | 18 | |
18 | 19 | type TransType int32 |
@@ -1216,3 +1217,35 @@ func (s *Sff) getOwnPalSprite(g, n int16) *Sprite { | ||
1216 | 1217 | copy(osp.Pal, pal) |
1217 | 1218 | return &osp |
1218 | 1219 | } |
1220 | +func captureScreen() { | |
1221 | + var err error | |
1222 | + var img *image.RGBA | |
1223 | + if sys.fullscreen { | |
1224 | + img, err = screenshot.CaptureDisplay(0) | |
1225 | + } else { | |
1226 | + xpos, ypos := sys.window.GetPos() | |
1227 | + width, height := sys.window.GetSize() | |
1228 | + bounds := image.Rect(xpos, ypos, xpos + width, ypos + height) | |
1229 | + img, err = screenshot.CaptureRect(bounds) | |
1230 | + } | |
1231 | + if err != nil { | |
1232 | + panic(err) | |
1233 | + } | |
1234 | + var filename string | |
1235 | + for i := sys.captureNum; i < 999; i++ { | |
1236 | + if i < 10 { | |
1237 | + filename = fmt.Sprintf("ikemen00%d.png", i) | |
1238 | + } else if i < 100 { | |
1239 | + filename = fmt.Sprintf("ikemen0%d.png", i) | |
1240 | + } else { | |
1241 | + filename = fmt.Sprintf("ikemen%d.png", i) | |
1242 | + } | |
1243 | + if _, err := os.Stat(filename); os.IsNotExist(err) { | |
1244 | + file, _ := os.Create(filename) | |
1245 | + defer file.Close() | |
1246 | + png.Encode(file, img) | |
1247 | + sys.captureNum = i | |
1248 | + break | |
1249 | + } | |
1250 | + } | |
1251 | +} |
@@ -599,6 +599,9 @@ func keyCallback(_ *glfw.Window, key glfw.Key, _ int, | ||
599 | 599 | for k, v := range sys.shortcutScripts { |
600 | 600 | v.Activate = v.Activate || k.Test(key, mk) |
601 | 601 | } |
602 | + if key == glfw.KeyF12 { | |
603 | + captureScreen() | |
604 | + } | |
602 | 605 | } |
603 | 606 | } |
604 | 607 | func charCallback(_ *glfw.Window, char rune, mk glfw.ModifierKey) { |
@@ -628,12 +631,12 @@ func JoystickState(joy, button int) bool { | ||
628 | 631 | } |
629 | 632 | |
630 | 633 | //Xbox360コントローラーのLRトリガー判定 |
631 | - if (button == 9 || button == 11) && (joystick[joy].GetGamepadName() == "Xbox 360 Controller" || strings.Contains(joystick[joy].GetGamepadName(), "XInput")) { | |
634 | + if (button == 9 || button == 11) && strings.Contains(joystick[joy].GetGamepadName(), "XInput") { | |
632 | 635 | return axes[button/2] > sys.xinputTriggerSensitivity |
633 | 636 | } |
634 | 637 | |
635 | 638 | // Ignore trigger axis on PS4 (We already have buttons) |
636 | - if (button >= 6 && button <= 9) && joystick[joy].GetGamepadName() == "Wireless Controller" { | |
639 | + if (button >= 6 && button <= 9) && joystick[joy].GetGamepadName() == "PS4 Controller" { | |
637 | 640 | return false |
638 | 641 | } |
639 | 642 |
@@ -39,6 +39,14 @@ const ( | ||
39 | 39 | WT_PTeammate |
40 | 40 | ) |
41 | 41 | |
42 | +type RoundType int32 | |
43 | + | |
44 | +const ( | |
45 | + RT_Normal RoundType = iota | |
46 | + RT_Deciding | |
47 | + RT_Final | |
48 | +) | |
49 | + | |
42 | 50 | func (wt *WinType) SetPerfect() { |
43 | 51 | if *wt >= WT_N && *wt <= WT_Teammate { |
44 | 52 | *wt += WT_PN - WT_N |
@@ -183,8 +191,11 @@ func readPowerBar(pre string, is IniSection, | ||
183 | 191 | &pb.counter_font[2]) |
184 | 192 | pb.counter_lay = *ReadLayout(pre+"counter.", is, 0) |
185 | 193 | for i := range pb.level_snd { |
186 | - is.ReadI32(fmt.Sprintf("%vlevel%v.snd", pre, i+1), &pb.level_snd[i][0], | |
187 | - &pb.level_snd[i][1]) | |
194 | + if !is.ReadI32(fmt.Sprintf("%vlevel%v.snd", pre, i+1), &pb.level_snd[i][0], | |
195 | + &pb.level_snd[i][1]) { | |
196 | + is.ReadI32(fmt.Sprintf("level%v.snd", i+1), &pb.level_snd[i][0], | |
197 | + &pb.level_snd[i][1]) | |
198 | + } | |
188 | 199 | } |
189 | 200 | return pb |
190 | 201 | } |
@@ -721,6 +732,9 @@ type LifeBarRound struct { | ||
721 | 732 | ko_time int32 |
722 | 733 | ko_sndtime int32 |
723 | 734 | ko, dko, to AnimTextSnd |
735 | + n, s, h, throw, c AnimTextSnd | |
736 | + t, suicide AnimTextSnd | |
737 | + teammate, perfect AnimTextSnd | |
724 | 738 | slow_time int32 |
725 | 739 | over_waittime int32 |
726 | 740 | over_hittime int32 |
@@ -746,12 +760,7 @@ func readLifeBarRound(is IniSection, | ||
746 | 760 | r := newLifeBarRound(snd, fnt) |
747 | 761 | var tmp int32 |
748 | 762 | is.ReadI32("pos", &r.pos[0], &r.pos[1]) |
749 | - tmp = Atoi(sys.cmdFlags["-rounds"]) | |
750 | - if tmp > 0 { | |
751 | - r.match_wins = tmp | |
752 | - } else { | |
753 | - is.ReadI32("match.wins", &r.match_wins) | |
754 | - } | |
763 | + is.ReadI32("match.wins", &r.match_wins) | |
755 | 764 | is.ReadI32("match.maxdrawgames", &r.match_maxdrawgames) |
756 | 765 | if is.ReadI32("start.waittime", &tmp) { |
757 | 766 | r.start_waittime = Max(1, tmp) |
@@ -774,6 +783,15 @@ func readLifeBarRound(is IniSection, | ||
774 | 783 | r.ko = *ReadAnimTextSnd("ko.", is, sff, at, 1) |
775 | 784 | r.dko = *ReadAnimTextSnd("dko.", is, sff, at, 1) |
776 | 785 | r.to = *ReadAnimTextSnd("to.", is, sff, at, 1) |
786 | + r.n = *ReadAnimTextSnd("n.", is, sff, at, 1) | |
787 | + r.s = *ReadAnimTextSnd("s.", is, sff, at, 1) | |
788 | + r.h = *ReadAnimTextSnd("h.", is, sff, at, 1) | |
789 | + r.throw = *ReadAnimTextSnd("throw.", is, sff, at, 1) | |
790 | + r.c = *ReadAnimTextSnd("c.", is, sff, at, 1) | |
791 | + r.t = *ReadAnimTextSnd("t.", is, sff, at, 1) | |
792 | + r.suicide = *ReadAnimTextSnd("suicide.", is, sff, at, 1) | |
793 | + r.teammate = *ReadAnimTextSnd("teammate.", is, sff, at, 1) | |
794 | + r.perfect = *ReadAnimTextSnd("perfect.", is, sff, at, 1) | |
777 | 795 | is.ReadI32("slow.time", &r.slow_time) |
778 | 796 | if is.ReadI32("over.hittime", &tmp) { |
779 | 797 | r.over_hittime = Max(0, tmp) |
@@ -884,6 +902,29 @@ func (r *LifeBarRound) act() bool { | ||
884 | 902 | default: |
885 | 903 | f(&r.to, 0) |
886 | 904 | } |
905 | + if sys.winTeam >= 0 { | |
906 | + switch sys.winType[sys.winTeam] { | |
907 | + case WT_N, WT_PN: | |
908 | + f(&r.n, 0) | |
909 | + case WT_S, WT_PS: | |
910 | + f(&r.s, 0) | |
911 | + case WT_H, WT_PH: | |
912 | + f(&r.h, 0) | |
913 | + case WT_C, WT_PC: | |
914 | + f(&r.c, 0) | |
915 | + case WT_T, WT_PT: | |
916 | + f(&r.t, 0) | |
917 | + case WT_Throw, WT_PThrow: | |
918 | + f(&r.throw, 0) | |
919 | + case WT_Suicide, WT_PSuicide: | |
920 | + f(&r.suicide, 0) | |
921 | + case WT_Teammate, WT_PTeammate: | |
922 | + f(&r.teammate, 0) | |
923 | + } | |
924 | + if sys.winType[sys.winTeam] >= WT_Perfect { | |
925 | + f(&r.perfect, 0) | |
926 | + } | |
927 | + } | |
887 | 928 | if sys.intro < -(r.over_hittime + r.over_waittime + r.over_wintime) { |
888 | 929 | if sys.finish == FT_DKO || sys.finish == FT_TODraw { |
889 | 930 | f(&r.drawn, 1) |
@@ -905,6 +946,15 @@ func (r *LifeBarRound) reset() { | ||
905 | 946 | r.ko.Reset() |
906 | 947 | r.dko.Reset() |
907 | 948 | r.to.Reset() |
949 | + r.n.Reset() | |
950 | + r.s.Reset() | |
951 | + r.h.Reset() | |
952 | + r.throw.Reset() | |
953 | + r.c.Reset() | |
954 | + r.t.Reset() | |
955 | + r.suicide.Reset() | |
956 | + r.teammate.Reset() | |
957 | + r.perfect.Reset() | |
908 | 958 | r.win.Reset() |
909 | 959 | r.win2.Reset() |
910 | 960 | r.drawn.Reset() |
@@ -965,23 +1015,111 @@ func (r *LifeBarRound) draw(layerno int16) { | ||
965 | 1015 | r.win.text = tmp |
966 | 1016 | } |
967 | 1017 | } |
1018 | + | |
1019 | + | |
1020 | + if (sys.finish != FT_NotYet || sys.time == 0) && sys.winTeam >= 0 { | |
1021 | + switch sys.winType[sys.winTeam] { | |
1022 | + case WT_N, WT_PN: | |
1023 | + r.n.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1024 | + case WT_S, WT_PS: | |
1025 | + r.s.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1026 | + case WT_H, WT_PH: | |
1027 | + r.h.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1028 | + case WT_C, WT_PC: | |
1029 | + r.c.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1030 | + case WT_T, WT_PT: | |
1031 | + r.t.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1032 | + case WT_Throw, WT_PThrow: | |
1033 | + r.throw.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1034 | + case WT_Suicide, WT_PSuicide: | |
1035 | + r.suicide.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1036 | + case WT_Teammate, WT_PTeammate: | |
1037 | + r.teammate.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1038 | + } | |
1039 | + if sys.winType[sys.winTeam] >= WT_Perfect { | |
1040 | + r.perfect.DrawScaled(float32(r.pos[0])+sys.lifebarOffsetX, float32(r.pos[1]), layerno, r.fnt, sys.lifebarScale) | |
1041 | + } | |
1042 | + } | |
1043 | + | |
1044 | + | |
968 | 1045 | } |
969 | 1046 | sys.brightness = ob |
970 | 1047 | } |
971 | 1048 | |
1049 | +type LifeBarChallenger struct { | |
1050 | + cnt int32 | |
1051 | + snd *Snd | |
1052 | + pos [2]int32 | |
1053 | + challenger AnimTextSnd | |
1054 | + sndtime int32 | |
1055 | + over_pause int32 | |
1056 | + over_time int32 | |
1057 | + bg AnimLayout | |
1058 | + fnt []*Fnt | |
1059 | +} | |
1060 | + | |
1061 | +func newLifeBarChallenger(snd *Snd, fnt []*Fnt) *LifeBarChallenger { | |
1062 | + return &LifeBarChallenger{snd: snd, fnt: fnt} | |
1063 | +} | |
1064 | +func readLifeBarChallenger(is IniSection, | |
1065 | + sff *Sff, at AnimationTable, snd *Snd, fnt []*Fnt) *LifeBarChallenger { | |
1066 | + ch := newLifeBarChallenger(snd, fnt) | |
1067 | + is.ReadI32("pos", &ch.pos[0], &ch.pos[1]) | |
1068 | + ch.challenger = *ReadAnimTextSnd("", is, sff, at, 1) | |
1069 | + is.ReadI32("sndtime", &ch.sndtime) | |
1070 | + var tmp int32 | |
1071 | + if is.ReadI32("over.pause", &tmp) { | |
1072 | + ch.over_pause = Max(1, tmp) | |
1073 | + } | |
1074 | + if is.ReadI32("over.time", &tmp) { | |
1075 | + ch.over_time = Max(ch.over_pause+1, tmp) | |
1076 | + } | |
1077 | + ch.bg = *ReadAnimLayout("bg.", is, sff, at, 0) | |
1078 | + return ch | |
1079 | +} | |
1080 | +func (ch *LifeBarChallenger) step() { | |
1081 | + if sys.challenger > 0 { | |
1082 | + if ch.cnt == ch.sndtime { | |
1083 | + ch.snd.play(ch.challenger.snd) | |
1084 | + } | |
1085 | + if ch.cnt == ch.over_pause { | |
1086 | + sys.paused = true | |
1087 | + } | |
1088 | + if ch.challenger.displaytime > ch.cnt { | |
1089 | + ch.challenger.Action() | |
1090 | + ch.bg.Action() | |
1091 | + } | |
1092 | + ch.cnt += 1 | |
1093 | + } | |
1094 | +} | |
1095 | +func (ch *LifeBarChallenger) reset() { | |
1096 | + ch.cnt = 0 | |
1097 | + ch.challenger.Reset() | |
1098 | + ch.bg.Reset() | |
1099 | +} | |
1100 | +func (ch *LifeBarChallenger) bgDraw(layerno int16) { | |
1101 | + ch.bg.Draw(float32(ch.pos[0]), float32(ch.pos[1]), layerno) | |
1102 | +} | |
1103 | +func (ch *LifeBarChallenger) draw(layerno int16, f []*Fnt) { | |
1104 | + ch.challenger.Draw(float32(ch.pos[0]), float32(ch.pos[1]), layerno, ch.fnt) | |
1105 | +} | |
1106 | + | |
972 | 1107 | type Lifebar struct { |
973 | 1108 | fat AnimationTable |
974 | 1109 | fsff *Sff |
975 | 1110 | snd, fsnd *Snd |
976 | 1111 | fnt [10]*Fnt |
977 | - hb [4][]*HealthBar | |
978 | - pb [2]*PowerBar | |
1112 | + ref [4][2]int | |
1113 | + num [4][2]int | |
1114 | + hb [8][]*HealthBar | |
1115 | + pb [6][]*PowerBar | |
979 | 1116 | fa [4][]*LifeBarFace |
980 | 1117 | nm [4][]*LifeBarName |
981 | 1118 | wi [2]*LifeBarWinIcon |
982 | 1119 | ti *LifeBarTime |
983 | 1120 | co *LifeBarCombo |
984 | 1121 | ro *LifeBarRound |
1122 | + ch *LifeBarChallenger | |
985 | 1123 | } |
986 | 1124 | |
987 | 1125 | func loadLifebar(deffile string) (*Lifebar, error) { |
@@ -991,11 +1129,29 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
991 | 1129 | } |
992 | 1130 | l := &Lifebar{fsff: &Sff{}, snd: &Snd{}, |
993 | 1131 | hb: [...][]*HealthBar{make([]*HealthBar, 2), make([]*HealthBar, 4), |
994 | - make([]*HealthBar, 2), make([]*HealthBar, 4)}, | |
995 | - fa: [...][]*LifeBarFace{make([]*LifeBarFace, 2), make([]*LifeBarFace, 4), | |
996 | - make([]*LifeBarFace, 2), make([]*LifeBarFace, 4)}, | |
997 | - nm: [...][]*LifeBarName{make([]*LifeBarName, 2), make([]*LifeBarName, 4), | |
998 | - make([]*LifeBarName, 2), make([]*LifeBarName, 4)}} | |
1132 | + make([]*HealthBar, 2), make([]*HealthBar, 4), make([]*HealthBar, 6), | |
1133 | + make([]*HealthBar, 8), make([]*HealthBar, 6), make([]*HealthBar, 8)}, | |
1134 | + pb: [...][]*PowerBar{make([]*PowerBar, 2), make([]*PowerBar, 4), | |
1135 | + make([]*PowerBar, 2), make([]*PowerBar, 2), make([]*PowerBar, 6), | |
1136 | + make([]*PowerBar, 8)}, | |
1137 | + fa: [...][]*LifeBarFace{make([]*LifeBarFace, 2), make([]*LifeBarFace, 8), | |
1138 | + make([]*LifeBarFace, 2), make([]*LifeBarFace, 8)}, | |
1139 | + nm: [...][]*LifeBarName{make([]*LifeBarName, 2), make([]*LifeBarName, 8), | |
1140 | + make([]*LifeBarName, 2), make([]*LifeBarName, 8)}} | |
1141 | + missing := map[string]int{"[simul_3p lifebar]": 3, "[simul_4p lifebar]": 4, | |
1142 | + "[tag lifebar]": 5, "[tag_3p lifebar]": 6, "[tag_4p lifebar]": 7, | |
1143 | + "[simul powerbar]": 1, "[turns powerbar]": 2, "[simul_3p powerbar]": 3, | |
1144 | + "[simul_4p powerbar]": 4, "[tag powerbar]": 5, "[tag face]": -1, | |
1145 | + "[tag name]": -1, "[challenger]": -1} | |
1146 | + strc := strings.ToLower(strings.TrimSpace(str)) | |
1147 | + for k, _ := range missing { | |
1148 | + strc = strings.Replace(strc, ";" + k, "", -1) | |
1149 | + if strings.Contains(strc, k) { | |
1150 | + delete(missing, k) | |
1151 | + } else { | |
1152 | + str += "\n" + k | |
1153 | + } | |
1154 | + } | |
999 | 1155 | sff, lines, i := &Sff{}, SplitAndTrim(str, "\n"), 0 |
1000 | 1156 | at := ReadAnimationTable(sff, lines, &i) |
1001 | 1157 | i = 0 |
@@ -1056,6 +1212,11 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1056 | 1212 | for i := range l.fnt { |
1057 | 1213 | if is.LoadFile(fmt.Sprintf("font%v", i), deffile, |
1058 | 1214 | func(filename string) error { |
1215 | + //h := int32(0) | |
1216 | + //if len(is[fmt.Sprintf("font%v.height", i)]) > 0 { | |
1217 | + // h = Atoi(is[fmt.Sprintf("font%v.height", i)]) | |
1218 | + //} | |
1219 | + //l.fnt[i], err = loadFnt(filename, h) | |
1059 | 1220 | l.fnt[i], err = loadFnt(filename) |
1060 | 1221 | return err |
1061 | 1222 | }); err != nil { |
@@ -1073,11 +1234,11 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1073 | 1234 | l.hb[0][1] = readHealthBar("p2.", is, sff, at) |
1074 | 1235 | } |
1075 | 1236 | case "powerbar": |
1076 | - if l.pb[0] == nil { | |
1077 | - l.pb[0] = readPowerBar("p1.", is, sff, at, l.snd) | |
1237 | + if l.pb[0][0] == nil { | |
1238 | + l.pb[0][0] = readPowerBar("p1.", is, sff, at, l.snd) | |
1078 | 1239 | } |
1079 | - if l.pb[1] == nil { | |
1080 | - l.pb[1] = readPowerBar("p2.", is, sff, at, l.snd) | |
1240 | + if l.pb[0][1] == nil { | |
1241 | + l.pb[0][1] = readPowerBar("p2.", is, sff, at, l.snd) | |
1081 | 1242 | } |
1082 | 1243 | case "face": |
1083 | 1244 | if l.fa[0][0] == nil { |
@@ -1093,49 +1254,6 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1093 | 1254 | if l.nm[0][1] == nil { |
1094 | 1255 | l.nm[0][1] = readLifeBarName("p2.", is, sff, at) |
1095 | 1256 | } |
1096 | - case "tag ": | |
1097 | - subname = strings.ToLower(subname) | |
1098 | - switch { | |
1099 | - case len(subname) >= 7 && subname[:7] == "lifebar": | |
1100 | - if l.hb[3][0] == nil { | |
1101 | - l.hb[3][0] = readHealthBar("p1.", is, sff, at) | |
1102 | - } | |
1103 | - if l.hb[3][1] == nil { | |
1104 | - l.hb[3][1] = readHealthBar("p2.", is, sff, at) | |
1105 | - } | |
1106 | - if l.hb[3][2] == nil { | |
1107 | - l.hb[3][2] = readHealthBar("p3.", is, sff, at) | |
1108 | - } | |
1109 | - if l.hb[3][3] == nil { | |
1110 | - l.hb[3][3] = readHealthBar("p4.", is, sff, at) | |
1111 | - } | |
1112 | - case len(subname) >= 4 && subname[:4] == "face": | |
1113 | - if l.fa[3][0] == nil { | |
1114 | - l.fa[3][0] = readLifeBarFace("p1.", is, sff, at) | |
1115 | - } | |
1116 | - if l.fa[3][1] == nil { | |
1117 | - l.fa[3][1] = readLifeBarFace("p2.", is, sff, at) | |
1118 | - } | |
1119 | - if l.fa[3][2] == nil { | |
1120 | - l.fa[3][2] = readLifeBarFace("p3.", is, sff, at) | |
1121 | - } | |
1122 | - if l.fa[3][3] == nil { | |
1123 | - l.fa[3][3] = readLifeBarFace("p4.", is, sff, at) | |
1124 | - } | |
1125 | - case len(subname) >= 4 && subname[:4] == "name": | |
1126 | - if l.nm[3][0] == nil { | |
1127 | - l.nm[3][0] = readLifeBarName("p1.", is, sff, at) | |
1128 | - } | |
1129 | - if l.nm[3][1] == nil { | |
1130 | - l.nm[3][1] = readLifeBarName("p2.", is, sff, at) | |
1131 | - } | |
1132 | - if l.nm[3][2] == nil { | |
1133 | - l.nm[3][2] = readLifeBarName("p3.", is, sff, at) | |
1134 | - } | |
1135 | - if l.nm[3][3] == nil { | |
1136 | - l.nm[3][3] = readLifeBarName("p4.", is, sff, at) | |
1137 | - } | |
1138 | - } | |
1139 | 1257 | case "simul ": |
1140 | 1258 | subname = strings.ToLower(subname) |
1141 | 1259 | switch { |
@@ -1152,6 +1270,19 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1152 | 1270 | if l.hb[1][3] == nil { |
1153 | 1271 | l.hb[1][3] = readHealthBar("p4.", is, sff, at) |
1154 | 1272 | } |
1273 | + case len(subname) >= 8 && subname[:8] == "powerbar": | |
1274 | + if l.pb[1][0] == nil { | |
1275 | + l.pb[1][0] = readPowerBar("p1.", is, sff, at, l.snd) | |
1276 | + } | |
1277 | + if l.pb[1][1] == nil { | |
1278 | + l.pb[1][1] = readPowerBar("p2.", is, sff, at, l.snd) | |
1279 | + } | |
1280 | + if l.pb[1][2] == nil { | |
1281 | + l.pb[1][2] = readPowerBar("p3.", is, sff, at, l.snd) | |
1282 | + } | |
1283 | + if l.pb[1][3] == nil { | |
1284 | + l.pb[1][3] = readPowerBar("p4.", is, sff, at, l.snd) | |
1285 | + } | |
1155 | 1286 | case len(subname) >= 4 && subname[:4] == "face": |
1156 | 1287 | if l.fa[1][0] == nil { |
1157 | 1288 | l.fa[1][0] = readLifeBarFace("p1.", is, sff, at) |
@@ -1165,6 +1296,18 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1165 | 1296 | if l.fa[1][3] == nil { |
1166 | 1297 | l.fa[1][3] = readLifeBarFace("p4.", is, sff, at) |
1167 | 1298 | } |
1299 | + if l.fa[1][4] == nil { | |
1300 | + l.fa[1][4] = readLifeBarFace("p5.", is, sff, at) | |
1301 | + } | |
1302 | + if l.fa[1][5] == nil { | |
1303 | + l.fa[1][5] = readLifeBarFace("p6.", is, sff, at) | |
1304 | + } | |
1305 | + if l.fa[1][6] == nil { | |
1306 | + l.fa[1][6] = readLifeBarFace("p7.", is, sff, at) | |
1307 | + } | |
1308 | + if l.fa[1][7] == nil { | |
1309 | + l.fa[1][7] = readLifeBarFace("p8.", is, sff, at) | |
1310 | + } | |
1168 | 1311 | case len(subname) >= 4 && subname[:4] == "name": |
1169 | 1312 | if l.nm[1][0] == nil { |
1170 | 1313 | l.nm[1][0] = readLifeBarName("p1.", is, sff, at) |
@@ -1178,6 +1321,18 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1178 | 1321 | if l.nm[1][3] == nil { |
1179 | 1322 | l.nm[1][3] = readLifeBarName("p4.", is, sff, at) |
1180 | 1323 | } |
1324 | + if l.nm[1][4] == nil { | |
1325 | + l.nm[1][4] = readLifeBarName("p5.", is, sff, at) | |
1326 | + } | |
1327 | + if l.nm[1][5] == nil { | |
1328 | + l.nm[1][5] = readLifeBarName("p6.", is, sff, at) | |
1329 | + } | |
1330 | + if l.nm[1][6] == nil { | |
1331 | + l.nm[1][6] = readLifeBarName("p7.", is, sff, at) | |
1332 | + } | |
1333 | + if l.nm[1][7] == nil { | |
1334 | + l.nm[1][7] = readLifeBarName("p8.", is, sff, at) | |
1335 | + } | |
1181 | 1336 | } |
1182 | 1337 | case "turns ": |
1183 | 1338 | subname = strings.ToLower(subname) |
@@ -1189,6 +1344,13 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1189 | 1344 | if l.hb[2][1] == nil { |
1190 | 1345 | l.hb[2][1] = readHealthBar("p2.", is, sff, at) |
1191 | 1346 | } |
1347 | + case len(subname) >= 8 && subname[:8] == "powerbar": | |
1348 | + if l.pb[2][0] == nil { | |
1349 | + l.pb[2][0] = readPowerBar("p1.", is, sff, at, l.snd) | |
1350 | + } | |
1351 | + if l.pb[2][1] == nil { | |
1352 | + l.pb[2][1] = readPowerBar("p2.", is, sff, at, l.snd) | |
1353 | + } | |
1192 | 1354 | case len(subname) >= 4 && subname[:4] == "face": |
1193 | 1355 | if l.fa[2][0] == nil { |
1194 | 1356 | l.fa[2][0] = readLifeBarFace("p1.", is, sff, at) |
@@ -1204,33 +1366,7 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1204 | 1366 | l.nm[2][1] = readLifeBarName("p2.", is, sff, at) |
1205 | 1367 | } |
1206 | 1368 | } |
1207 | - case "winicon": | |
1208 | - if l.wi[0] == nil { | |
1209 | - l.wi[0] = readLifeBarWinIcon("p1.", is, sff, at) | |
1210 | - } | |
1211 | - if l.wi[1] == nil { | |
1212 | - l.wi[1] = readLifeBarWinIcon("p2.", is, sff, at) | |
1213 | - } | |
1214 | - case "time": | |
1215 | - if l.ti == nil { | |
1216 | - l.ti = readLifeBarTime(is, sff, at) | |
1217 | - } | |
1218 | - case "combo": | |
1219 | - if l.co == nil { | |
1220 | - l.co = readLifeBarCombo(is) | |
1221 | - } | |
1222 | - case "round": | |
1223 | - if l.ro == nil { | |
1224 | - l.ro = readLifeBarRound(is, sff, at, l.snd, l.fnt[:]) | |
1225 | - } | |
1226 | - } | |
1227 | - } | |
1228 | - i = 0 | |
1229 | - //Load again to fill empty spaces of TAG (For retrocompatibility) | |
1230 | - for i < len(lines) { | |
1231 | - is, name, subname := ReadIniSection(lines, &i) | |
1232 | - switch name { | |
1233 | - case "simul ": | |
1369 | + case "tag ": | |
1234 | 1370 | subname = strings.ToLower(subname) |
1235 | 1371 | switch { |
1236 | 1372 | case len(subname) >= 7 && subname[:7] == "lifebar": |
@@ -1246,6 +1382,13 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1246 | 1382 | if l.hb[3][3] == nil { |
1247 | 1383 | l.hb[3][3] = readHealthBar("p4.", is, sff, at) |
1248 | 1384 | } |
1385 | + case len(subname) >= 8 && subname[:8] == "powerbar": | |
1386 | + if l.pb[3][0] == nil { | |
1387 | + l.pb[3][0] = readPowerBar("p1.", is, sff, at, l.snd) | |
1388 | + } | |
1389 | + if l.pb[3][1] == nil { | |
1390 | + l.pb[3][1] = readPowerBar("p2.", is, sff, at, l.snd) | |
1391 | + } | |
1249 | 1392 | case len(subname) >= 4 && subname[:4] == "face": |
1250 | 1393 | if l.fa[3][0] == nil { |
1251 | 1394 | l.fa[3][0] = readLifeBarFace("p1.", is, sff, at) |
@@ -1259,6 +1402,18 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1259 | 1402 | if l.fa[3][3] == nil { |
1260 | 1403 | l.fa[3][3] = readLifeBarFace("p4.", is, sff, at) |
1261 | 1404 | } |
1405 | + if l.fa[3][4] == nil { | |
1406 | + l.fa[3][4] = readLifeBarFace("p5.", is, sff, at) | |
1407 | + } | |
1408 | + if l.fa[3][5] == nil { | |
1409 | + l.fa[3][5] = readLifeBarFace("p6.", is, sff, at) | |
1410 | + } | |
1411 | + if l.fa[3][6] == nil { | |
1412 | + l.fa[3][6] = readLifeBarFace("p7.", is, sff, at) | |
1413 | + } | |
1414 | + if l.fa[3][7] == nil { | |
1415 | + l.fa[3][7] = readLifeBarFace("p8.", is, sff, at) | |
1416 | + } | |
1262 | 1417 | case len(subname) >= 4 && subname[:4] == "name": |
1263 | 1418 | if l.nm[3][0] == nil { |
1264 | 1419 | l.nm[3][0] = readLifeBarName("p1.", is, sff, at) |
@@ -1272,36 +1427,163 @@ func loadLifebar(deffile string) (*Lifebar, error) { | ||
1272 | 1427 | if l.nm[3][3] == nil { |
1273 | 1428 | l.nm[3][3] = readLifeBarName("p4.", is, sff, at) |
1274 | 1429 | } |
1430 | + if l.nm[3][4] == nil { | |
1431 | + l.nm[3][4] = readLifeBarName("p5.", is, sff, at) | |
1432 | + } | |
1433 | + if l.nm[3][5] == nil { | |
1434 | + l.nm[3][5] = readLifeBarName("p6.", is, sff, at) | |
1435 | + } | |
1436 | + if l.nm[3][6] == nil { | |
1437 | + l.nm[3][6] = readLifeBarName("p7.", is, sff, at) | |
1438 | + } | |
1439 | + if l.nm[3][7] == nil { | |
1440 | + l.nm[3][7] = readLifeBarName("p8.", is, sff, at) | |
1441 | + } | |
1442 | + } | |
1443 | + case "simul_3p ", "simul_4p ", "tag_3p ", "tag_4p ": | |
1444 | + i := 4 | |
1445 | + switch name { | |
1446 | + case "simul_4p ": | |
1447 | + i = 5 | |
1448 | + case "tag_3p ": | |
1449 | + i = 6 | |
1450 | + case "tag_4p ": | |
1451 | + i = 7 | |
1452 | + } | |
1453 | + subname = strings.ToLower(subname) | |
1454 | + switch { | |
1455 | + case len(subname) >= 7 && subname[:7] == "lifebar": | |
1456 | + if l.hb[i][0] == nil { | |
1457 | + l.hb[i][0] = readHealthBar("p1.", is, sff, at) | |
1458 | + } | |
1459 | + if l.hb[i][1] == nil { | |
1460 | + l.hb[i][1] = readHealthBar("p2.", is, sff, at) | |
1461 | + } | |
1462 | + if l.hb[i][2] == nil { | |
1463 | + l.hb[i][2] = readHealthBar("p3.", is, sff, at) | |
1464 | + } | |
1465 | + if l.hb[i][3] == nil { | |
1466 | + l.hb[i][3] = readHealthBar("p4.", is, sff, at) | |
1467 | + } | |
1468 | + if l.hb[i][4] == nil { | |
1469 | + l.hb[i][4] = readHealthBar("p5.", is, sff, at) | |
1470 | + } | |
1471 | + if l.hb[i][5] == nil { | |
1472 | + l.hb[i][5] = readHealthBar("p6.", is, sff, at) | |
1473 | + } | |
1474 | + if i == 5 || i == 7 { | |
1475 | + if l.hb[i][6] == nil { | |
1476 | + l.hb[i][6] = readHealthBar("p7.", is, sff, at) | |
1477 | + } | |
1478 | + if l.hb[i][7] == nil { | |
1479 | + l.hb[i][7] = readHealthBar("p8.", is, sff, at) | |
1480 | + } | |
1481 | + } | |
1482 | + case len(subname) >= 8 && subname[:8] == "powerbar": | |
1483 | + if l.pb[i][0] == nil { | |
1484 | + l.pb[i][0] = readPowerBar("p1.", is, sff, at, l.snd) | |
1485 | + } | |
1486 | + if l.pb[i][1] == nil { | |
1487 | + l.pb[i][1] = readPowerBar("p2.", is, sff, at, l.snd) | |
1488 | + } | |
1489 | + if l.pb[i][2] == nil { | |
1490 | + l.pb[i][2] = readPowerBar("p3.", is, sff, at, l.snd) | |
1491 | + } | |
1492 | + if l.pb[i][3] == nil { | |
1493 | + l.pb[i][3] = readPowerBar("p4.", is, sff, at, l.snd) | |
1494 | + } | |
1495 | + if l.pb[i][4] == nil { | |
1496 | + l.pb[i][4] = readPowerBar("p5.", is, sff, at, l.snd) | |
1497 | + } | |
1498 | + if l.pb[i][5] == nil { | |
1499 | + l.pb[i][5] = readPowerBar("p6.", is, sff, at, l.snd) | |
1500 | + } | |
1501 | + if i == 5 || i == 7 { | |
1502 | + if l.pb[i][6] == nil { | |
1503 | + l.pb[i][6] = readPowerBar("p7.", is, sff, at, l.snd) | |
1504 | + } | |
1505 | + if l.pb[i][7] == nil { | |
1506 | + l.pb[i][7] = readPowerBar("p8.", is, sff, at, l.snd) | |
1507 | + } | |
1508 | + } | |
1509 | + } | |
1510 | + case "winicon": | |
1511 | + if l.wi[0] == nil { | |
1512 | + l.wi[0] = readLifeBarWinIcon("p1.", is, sff, at) | |
1513 | + } | |
1514 | + if l.wi[1] == nil { | |
1515 | + l.wi[1] = readLifeBarWinIcon("p2.", is, sff, at) | |
1516 | + } | |
1517 | + case "time": | |
1518 | + if l.ti == nil { | |
1519 | + l.ti = readLifeBarTime(is, sff, at) | |
1520 | + } | |
1521 | + case "combo": | |
1522 | + if l.co == nil { | |
1523 | + l.co = readLifeBarCombo(is) | |
1524 | + } | |
1525 | + case "round": | |
1526 | + if l.ro == nil { | |
1527 | + l.ro = readLifeBarRound(is, sff, at, l.snd, l.fnt[:]) | |
1528 | + } | |
1529 | + case "challenger": | |
1530 | + if l.ch == nil { | |
1531 | + l.ch = readLifeBarChallenger(is, sff, at, l.snd, l.fnt[:]) | |
1532 | + } | |
1533 | + } | |
1534 | + } | |
1535 | + for k, v := range missing { | |
1536 | + if strings.Contains(k, "lifebar") { | |
1537 | + for i := 3; i < len(l.hb); i++ { | |
1538 | + if i == v { | |
1539 | + for j, d := range l.hb[1] { | |
1540 | + l.hb[i][j] = d | |
1541 | + } | |
1542 | + } | |
1543 | + } | |
1544 | + } else if strings.Contains(k, "powerbar") { | |
1545 | + for i := 1; i < len(l.pb); i++ { | |
1546 | + if i == v { | |
1547 | + for j, d := range l.pb[0] { | |
1548 | + l.pb[i][j] = d | |
1549 | + } | |
1550 | + } | |
1551 | + } | |
1552 | + } else if strings.Contains(k, "tag face") { | |
1553 | + for j, d := range l.fa[1] { | |
1554 | + l.fa[3][j] = d | |
1555 | + } | |
1556 | + } else if strings.Contains(k, "tag name") { | |
1557 | + for j, d := range l.nm[1] { | |
1558 | + l.nm[3][j] = d | |
1275 | 1559 | } |
1276 | 1560 | } |
1277 | 1561 | } |
1278 | 1562 | return l, nil |
1279 | 1563 | } |
1280 | 1564 | func (l *Lifebar) step() { |
1281 | - for ti, tm := range sys.tmode { | |
1282 | - for i := ti; i < len(l.hb[tm]); i += 2 { | |
1283 | - l.hb[tm][i].step(float32(sys.chars[i][0].life)/ | |
1565 | + for ti, _ := range sys.tmode { | |
1566 | + for i := ti; i < l.num[0][ti]; i += 2 { | |
1567 | + l.hb[l.ref[0][ti]][i].step(float32(sys.chars[i][0].life)/ | |
1284 | 1568 | float32(sys.chars[i][0].lifeMax), (sys.chars[i][0].getcombo != 0 || |
1285 | 1569 | sys.chars[i][0].ss.moveType == MT_H) && |
1286 | 1570 | !sys.chars[i][0].scf(SCF_over)) |
1287 | 1571 | } |
1288 | 1572 | } |
1289 | - for i := range l.pb { | |
1290 | - lvi := i | |
1291 | - if sys.tmode[i] == TM_Simul || sys.tmode[i] == TM_Tag { | |
1292 | - lvi += 2 | |
1573 | + for ti, _ := range sys.tmode { | |
1574 | + for i := ti; i < l.num[1][ti]; i += 2 { | |
1575 | + l.pb[l.ref[1][ti]][i].step(float32(sys.chars[i][0].power)/ | |
1576 | + float32(sys.chars[i][0].powerMax), sys.chars[i][0].power/1000) | |
1293 | 1577 | } |
1294 | - l.pb[i].step(float32(sys.chars[i][0].power)/ | |
1295 | - float32(sys.chars[i][0].powerMax), sys.chars[lvi][0].power/1000) | |
1296 | 1578 | } |
1297 | - for ti, tm := range sys.tmode { | |
1298 | - for i := ti; i < len(l.fa[tm]); i += 2 { | |
1299 | - l.fa[tm][i].step() | |
1579 | + for ti, _ := range sys.tmode { | |
1580 | + for i := ti; i < l.num[2][ti]; i += 2 { | |
1581 | + l.fa[l.ref[2][ti]][i].step() | |
1300 | 1582 | } |
1301 | 1583 | } |
1302 | - for ti, tm := range sys.tmode { | |
1303 | - for i := ti; i < len(l.nm[tm]); i += 2 { | |
1304 | - l.nm[tm][i].step() | |
1584 | + for ti, _ := range sys.tmode { | |
1585 | + for i := ti; i < l.num[3][ti]; i += 2 { | |
1586 | + l.nm[l.ref[3][ti]][i].step() | |
1305 | 1587 | } |
1306 | 1588 | } |
1307 | 1589 | for i := range l.wi { |
@@ -1315,15 +1597,54 @@ func (l *Lifebar) step() { | ||
1315 | 1597 | } |
1316 | 1598 | } |
1317 | 1599 | l.co.step(cb) |
1600 | + l.ch.step() | |
1318 | 1601 | } |
1319 | 1602 | func (l *Lifebar) reset() { |
1603 | + for ti, tm := range sys.tmode { | |
1604 | + l.ref[0][ti] = int(tm) | |
1605 | + l.ref[1][ti] = int(tm) | |
1606 | + l.ref[2][ti] = int(tm) | |
1607 | + l.ref[3][ti] = int(tm) | |
1608 | + if tm == TM_Tag { | |
1609 | + if sys.numSimul[ti] == 2 { //Tag 2P | |
1610 | + l.ref[0][ti] = 3 | |
1611 | + l.ref[1][ti] = 3 | |
1612 | + l.ref[2][ti] = 3 | |
1613 | + l.ref[3][ti] = 3 | |
1614 | + } else { //Tag 3P/4P | |
1615 | + l.ref[0][ti] = int(sys.numSimul[ti]) + 3 | |
1616 | + l.ref[1][ti] = 3 | |
1617 | + l.ref[2][ti] = 3 | |
1618 | + l.ref[3][ti] = 3 | |
1619 | + } | |
1620 | + } else if tm == TM_Simul && sys.numSimul[ti] > 2 { //Simul 3P/4P | |
1621 | + l.ref[0][ti] = int(sys.numSimul[ti]) + 1 | |
1622 | + l.ref[1][ti] = int(sys.numSimul[ti]) + 1 | |
1623 | + } | |
1624 | + l.num[0][ti] = len(l.hb[l.ref[0][ti]]) | |
1625 | + l.num[1][ti] = len(l.pb[l.ref[1][ti]]) | |
1626 | + l.num[2][ti] = len(l.fa[l.ref[2][ti]]) | |
1627 | + l.num[3][ti] = len(l.nm[l.ref[3][ti]]) | |
1628 | + if tm == TM_Simul || tm == TM_Tag { | |
1629 | + l.num[0][ti] = int(sys.numSimul[ti]) * 2 | |
1630 | + if sys.powerShare[ti] { | |
1631 | + l.num[1][ti] = 2 | |
1632 | + } else if tm == TM_Simul { | |
1633 | + l.num[1][ti] = int(sys.numSimul[ti]) * 2 | |
1634 | + } | |
1635 | + l.num[2][ti] = int(sys.numSimul[ti]) * 2 | |
1636 | + l.num[3][ti] = int(sys.numSimul[ti]) * 2 | |
1637 | + } | |
1638 | + } | |
1320 | 1639 | for _, hb := range l.hb { |
1321 | 1640 | for i := range hb { |
1322 | 1641 | hb[i].reset() |
1323 | 1642 | } |
1324 | 1643 | } |
1325 | - for i := range l.pb { | |
1326 | - l.pb[i].reset() | |
1644 | + for _, pb := range l.pb { | |
1645 | + for i := range pb { | |
1646 | + pb[i].reset() | |
1647 | + } | |
1327 | 1648 | } |
1328 | 1649 | for _, fa := range l.fa { |
1329 | 1650 | for i := range fa { |
@@ -1341,56 +1662,61 @@ func (l *Lifebar) reset() { | ||
1341 | 1662 | l.ti.reset() |
1342 | 1663 | l.co.reset() |
1343 | 1664 | l.ro.reset() |
1665 | + l.ch.reset() | |
1344 | 1666 | } |
1345 | 1667 | func (l *Lifebar) draw(layerno int16) { |
1346 | 1668 | if !sys.statusDraw { |
1347 | 1669 | return |
1348 | 1670 | } |
1349 | - if !sys.sf(GSF_nobardisplay) { | |
1350 | - for ti, tm := range sys.tmode { | |
1351 | - for i := ti; i < len(l.hb[tm]); i += 2 { | |
1352 | - l.hb[tm][i].bgDraw(layerno) | |
1671 | + if !sys.sf(GSF_nobardisplay) && sys.barsDisplay { | |
1672 | + for ti, _ := range sys.tmode { | |
1673 | + for i := ti; i < l.num[0][ti]; i += 2 { | |
1674 | + l.hb[l.ref[0][ti]][i].bgDraw(layerno) | |
1353 | 1675 | } |
1354 | 1676 | } |
1355 | - for ti, tm := range sys.tmode { | |
1356 | - for i := ti; i < len(l.hb[tm]); i += 2 { | |
1357 | - l.hb[tm][i].draw(layerno, float32(sys.chars[i][0].life)/ | |
1677 | + for ti, _ := range sys.tmode { | |
1678 | + for i := ti; i < l.num[0][ti]; i += 2 { | |
1679 | + l.hb[l.ref[0][ti]][i].draw(layerno, float32(sys.chars[i][0].life)/ | |
1358 | 1680 | float32(sys.chars[i][0].lifeMax)) |
1359 | 1681 | } |
1360 | 1682 | } |
1361 | - for i := range l.pb { | |
1362 | - l.pb[i].bgDraw(layerno) | |
1683 | + for ti, _ := range sys.tmode { | |
1684 | + for i := ti; i < l.num[1][ti]; i += 2 { | |
1685 | + l.pb[l.ref[1][ti]][i].bgDraw(layerno) | |
1686 | + } | |
1363 | 1687 | } |
1364 | - for i := range l.pb { | |
1365 | - l.pb[i].draw(layerno, float32(sys.chars[i][0].power)/ | |
1366 | - float32(sys.chars[i][0].powerMax), sys.chars[i][0].power/1000, | |
1367 | - l.fnt[:]) | |
1688 | + for ti, _ := range sys.tmode { | |
1689 | + for i := ti; i < l.num[1][ti]; i += 2 { | |
1690 | + l.pb[l.ref[1][ti]][i].draw(layerno, float32(sys.chars[i][0].power)/ | |
1691 | + float32(sys.chars[i][0].powerMax), sys.chars[i][0].power/1000, | |
1692 | + l.fnt[:]) | |
1693 | + } | |
1368 | 1694 | } |
1369 | - for ti, tm := range sys.tmode { | |
1370 | - for i := ti; i < len(l.fa[tm]); i += 2 { | |
1371 | - l.fa[tm][i].bgDraw(layerno) | |
1695 | + for ti, _ := range sys.tmode { | |
1696 | + for i := ti; i < l.num[2][ti]; i += 2 { | |
1697 | + l.fa[l.ref[2][ti]][i].bgDraw(layerno) | |
1372 | 1698 | } |
1373 | 1699 | } |
1374 | - for ti, tm := range sys.tmode { | |
1375 | - for i := ti; i < len(l.fa[tm]); i += 2 { | |
1376 | - if fspr := l.fa[tm][i].face; fspr != nil { | |
1700 | + for ti, _ := range sys.tmode { | |
1701 | + for i := ti; i < l.num[2][ti]; i += 2 { | |
1702 | + if fspr := l.fa[l.ref[2][ti]][i].face; fspr != nil { | |
1377 | 1703 | pfx := sys.chars[i][0].getPalfx() |
1378 | 1704 | sys.cgi[i].sff.palList.SwapPalMap(&pfx.remap) |
1379 | 1705 | fspr.Pal = nil |
1380 | 1706 | fspr.Pal = fspr.GetPal(&sys.cgi[i].sff.palList) |
1381 | 1707 | sys.cgi[i].sff.palList.SwapPalMap(&pfx.remap) |
1382 | - l.fa[tm][i].draw(layerno, pfx, i == sys.superplayer) | |
1708 | + l.fa[l.ref[2][ti]][i].draw(layerno, pfx, i == sys.superplayer) | |
1383 | 1709 | } |
1384 | 1710 | } |
1385 | 1711 | } |
1386 | - for ti, tm := range sys.tmode { | |
1387 | - for i := ti; i < len(l.nm[tm]); i += 2 { | |
1388 | - l.nm[tm][i].bgDraw(layerno) | |
1712 | + for ti, _ := range sys.tmode { | |
1713 | + for i := ti; i < l.num[3][ti]; i += 2 { | |
1714 | + l.nm[l.ref[3][ti]][i].bgDraw(layerno) | |
1389 | 1715 | } |
1390 | 1716 | } |
1391 | - for ti, tm := range sys.tmode { | |
1392 | - for i := ti; i < len(l.nm[tm]); i += 2 { | |
1393 | - l.nm[tm][i].draw(layerno, l.fnt[:], sys.cgi[i].displayname) | |
1717 | + for ti, _ := range sys.tmode { | |
1718 | + for i := ti; i < l.num[3][ti]; i += 2 { | |
1719 | + l.nm[l.ref[3][ti]][i].draw(layerno, l.fnt[:], sys.cgi[i].lifebarname) | |
1394 | 1720 | } |
1395 | 1721 | } |
1396 | 1722 | l.ti.bgDraw(layerno) |
@@ -1400,4 +1726,8 @@ func (l *Lifebar) draw(layerno int16) { | ||
1400 | 1726 | } |
1401 | 1727 | } |
1402 | 1728 | l.co.draw(layerno, l.fnt[:]) |
1729 | + if sys.challenger > 0 && l.ch.challenger.displaytime > l.ch.cnt { | |
1730 | + l.ch.bgDraw(layerno) | |
1731 | + l.ch.draw(layerno, l.fnt[:]) | |
1732 | + } | |
1403 | 1733 | } |
@@ -12,6 +12,7 @@ import ( | ||
12 | 12 | |
13 | 13 | "github.com/go-gl/glfw/v3.3/glfw" |
14 | 14 | lua "github.com/yuin/gopher-lua" |
15 | + "github.com/sqweek/dialog" | |
15 | 16 | ) |
16 | 17 | |
17 | 18 | func init() { |
@@ -47,17 +48,21 @@ func main() { | ||
47 | 48 | help, _ := regexp.MatchString("^-[h%?]", a) |
48 | 49 | if help { |
49 | 50 | fmt.Println("I.K.E.M.E.N\nOptions (case sensitive):") |
50 | - fmt.Println(" -h -? Help") | |
51 | - fmt.Println(" -log <logfile> Records match data to <logfile>") | |
52 | - fmt.Println(" -r <sysfile> Loads motif <sysfile>. eg. -r motifdir or -r motifdir/system.def") | |
51 | + fmt.Println(" -h -? Help") | |
52 | + fmt.Println(" -log <logfile> Records match data to <logfile>") | |
53 | + fmt.Println(" -r <sysfile> Loads motif <sysfile>. eg. -r motifdir or -r motifdir/system.def") | |
53 | 54 | fmt.Println("\nQuick VS Options:") |
54 | - fmt.Println(" -p<n> <playername> Loads player n, eg. -p3 kfm") | |
55 | - fmt.Println(" -p<n>.ai <level> Set player n's AI to <level>, eg. -p1.ai 8") | |
56 | - fmt.Println(" -p<n>.color <col> Set player n's color to <col>") | |
57 | - fmt.Println(" -p<n>.life <life> Sets player n's life to <life>") | |
58 | - fmt.Println(" -p<n>.power <power> Sets player n's power to <power>") | |
59 | - fmt.Println(" -rounds <num> Plays for <num> rounds, and then quits") | |
60 | - fmt.Println(" -s <stagename> Loads stage <stagename>") | |
55 | + fmt.Println(" -p<n> <playername> Loads player n, eg. -p3 kfm") | |
56 | + fmt.Println(" -p<n>.ai <level> Set player n's AI to <level>, eg. -p1.ai 8") | |
57 | + fmt.Println(" -p<n>.color <col> Set player n's color to <col>") | |
58 | + fmt.Println(" -p<n>.power <power> Sets player n's power to <power>") | |
59 | + fmt.Println(" -p<n>.life <life> Sets player n's life to <life>") | |
60 | + fmt.Println(" -p<n>.lifeMax <life> Sets player n's max life to <life>") | |
61 | + fmt.Println(" -p<n>.lifeRatio <ratio> Sets player n's life ratio to <ratio>") | |
62 | + fmt.Println(" -p<n>.attackRatio <ratio> Sets player n's attack ratio to <ratio>") | |
63 | + fmt.Println(" -p<n>.defenceRatio <ratio> Sets player n's defence ratio to <ratio>") | |
64 | + fmt.Println(" -rounds <num> Plays for <num> rounds, and then quits") | |
65 | + fmt.Println(" -s <stagename> Loads stage <stagename>") | |
61 | 66 | fmt.Println("\nPress ENTER to exit.") |
62 | 67 | var s string |
63 | 68 | fmt.Scanln(&s) |
@@ -120,13 +125,17 @@ func main() { | ||
120 | 125 | "CommonCmd": "data/common.cmd", |
121 | 126 | "SimulMode": true, |
122 | 127 | "LifeMul": 100, |
123 | - "Team1VS2Life": 120, | |
124 | - "TurnsRecoveryRate": 300, | |
128 | + "Team1VS2Life": 100, | |
129 | + "TurnsRecoveryBase": 12.5, | |
130 | + "TurnsRecoveryBonus": 27.5, | |
125 | 131 | "ZoomActive": false, |
126 | 132 | "ZoomMin": 0.75, |
127 | 133 | "ZoomMax": 1.1, |
128 | 134 | "ZoomSpeed": 1, |
129 | 135 | "RoundTime": 99, |
136 | + "RoundsNumSingle": -1, | |
137 | + "RoundsNumTeam": -1, | |
138 | + "MaxDrawGames": -2, | |
130 | 139 | "SingleTeamMode": true, |
131 | 140 | "NumTurns": 4, |
132 | 141 | "NumSimul": 4, |
@@ -175,10 +184,11 @@ func main() { | ||
175 | 184 | Joystick int |
176 | 185 | Buttons []interface{} |
177 | 186 | } |
178 | - JoystickConfig []struct { | |
187 | + JoystickConfig []struct { | |
179 | 188 | Joystick int |
180 | 189 | Buttons []interface{} |
181 | 190 | } |
191 | + NumSimul int | |
182 | 192 | NumTag int |
183 | 193 | TeamLifeShare bool |
184 | 194 | AIRandomColor bool |
@@ -239,7 +249,13 @@ func main() { | ||
239 | 249 | i, _ = strconv.Atoi(key) |
240 | 250 | return i |
241 | 251 | } |
242 | - for a := 0; a < tmp.NumTag; a++ { | |
252 | + Max := func(x, y int) int { | |
253 | + if x < y { | |
254 | + return y | |
255 | + } | |
256 | + return x | |
257 | + } | |
258 | + for a := 0; a < Max(tmp.NumSimul, tmp.NumTag); a++ { | |
243 | 259 | for _, kc := range tmp.KeyConfig { |
244 | 260 | b := kc.Buttons |
245 | 261 | if kc.Joystick < 0 { |
@@ -269,7 +285,6 @@ func main() { | ||
269 | 285 | sys.PostProcessingShader = tmp.PostProcessingShader |
270 | 286 | sys.MultisampleAntialiasing = tmp.MSAA |
271 | 287 | sys.LocalcoordScalingType = tmp.LocalcoordScalingType |
272 | - sys.aiRandomColor = tmp.AIRandomColor | |
273 | 288 | sys.allowDebugKeys = tmp.AllowDebugKeys |
274 | 289 | air, err := ioutil.ReadFile(tmp.CommonAir) |
275 | 290 | if err != nil { |
@@ -282,7 +297,7 @@ func main() { | ||
282 | 297 | } |
283 | 298 | sys.commonCmd = string("\n") + string(cmd) |
284 | 299 | //os.Mkdir("debug", os.ModeSticky|0755) |
285 | - log := createLog("Ikemen.txt") | |
300 | + log := createLog("Ikemen.log") | |
286 | 301 | defer closeLog(log) |
287 | 302 | l := sys.init(tmp.Width, tmp.Height) |
288 | 303 | if err := l.DoFile(tmp.System); err != nil { |
@@ -291,9 +306,11 @@ func main() { | ||
291 | 306 | case *lua.ApiError: |
292 | 307 | errstr := strings.Split(err.Error(), "\n")[0] |
293 | 308 | if len(errstr) < 10 || errstr[len(errstr)-10:] != "<game end>" { |
309 | + dialog.Message("%s\n\nError saved to Ikemen.log logfile.", err).Title("I.K.E.M.E.N Error").Error() | |
294 | 310 | panic(err) |
295 | 311 | } |
296 | 312 | default: |
313 | + dialog.Message("%s\n\nError saved to Ikemen.log logfile.", err).Title("I.K.E.M.E.N Error").Error() | |
297 | 314 | panic(err) |
298 | 315 | } |
299 | 316 | } |
@@ -697,25 +697,31 @@ func FillRect(rect [4]int32, color uint32, trans int32) { | ||
697 | 697 | gl.Translated(0, float64(sys.scrrect[3]), 0) |
698 | 698 | if trans == -1 { |
699 | 699 | gl.BlendFunc(gl.SRC_ALPHA, gl.ONE) |
700 | + gl.BlendEquation(gl.FUNC_ADD) | |
700 | 701 | fill(1) |
701 | 702 | } else if trans == -2 { |
702 | 703 | gl.BlendFunc(gl.ZERO, gl.ONE_MINUS_SRC_COLOR) |
704 | + gl.BlendEquation(gl.FUNC_REVERSE_SUBTRACT) | |
703 | 705 | fill(1) |
704 | 706 | } else if trans <= 0 { |
705 | 707 | } else if trans < 255 { |
706 | 708 | gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) |
709 | + gl.BlendEquation(gl.FUNC_ADD) | |
707 | 710 | fill(float32(trans) / 256) |
708 | 711 | } else if trans < 512 { |
709 | 712 | gl.BlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA) |
713 | + gl.BlendEquation(gl.FUNC_ADD) | |
710 | 714 | fill(1) |
711 | 715 | } else { |
712 | 716 | src, dst := trans&0xff, trans>>10&0xff |
713 | 717 | if dst < 255 { |
714 | 718 | gl.BlendFunc(gl.ZERO, gl.ONE_MINUS_SRC_ALPHA) |
719 | + gl.BlendEquation(gl.FUNC_ADD) | |
715 | 720 | fill(float32(dst) / 255) |
716 | 721 | } |
717 | 722 | if src > 0 { |
718 | 723 | gl.BlendFunc(gl.SRC_ALPHA, gl.ONE) |
724 | + gl.BlendEquation(gl.FUNC_ADD) | |
719 | 725 | fill(float32(src) / 255) |
720 | 726 | } |
721 | 727 | } |
@@ -2,6 +2,7 @@ package main | ||
2 | 2 | |
3 | 3 | import ( |
4 | 4 | "fmt" |
5 | + "math" | |
5 | 6 | "math/rand" |
6 | 7 | "runtime" |
7 | 8 | "runtime/debug" |
@@ -31,6 +32,9 @@ func numArg(l *lua.LState, argi int) float64 { | ||
31 | 32 | func boolArg(l *lua.LState, argi int) bool { |
32 | 33 | return l.ToBool(argi) |
33 | 34 | } |
35 | +func tableArg(l *lua.LState, argi int) *lua.LTable { | |
36 | + return l.ToTable(argi) | |
37 | +} | |
34 | 38 | func newUserData(l *lua.LState, value interface{}) *lua.LUserData { |
35 | 39 | ud := l.NewUserData() |
36 | 40 | ud.Value = value |
@@ -98,6 +102,61 @@ func scriptCommonInit(l *lua.LState) { | ||
98 | 102 | return 1 |
99 | 103 | }) |
100 | 104 | //---------------------------------------------------------------- |
105 | + luaRegister(l, "getFrameCount", func(l *lua.LState) int { | |
106 | + l.Push(lua.LNumber(sys.frameCounter)) | |
107 | + return 1 | |
108 | + }) | |
109 | + | |
110 | + luaRegister(l, "clearColor", func(l *lua.LState) int { | |
111 | + a := int32(255) | |
112 | + if l.GetTop() >= 4 { | |
113 | + a = int32(numArg(l, 4)) | |
114 | + } | |
115 | + col := uint32(int32(numArg(l, 3))&0xff | int32(numArg(l, 2))&0xff<<8 | | |
116 | + int32(numArg(l, 1))&0xff<<16) | |
117 | + FillRect(sys.scrrect, col, a) | |
118 | + return 0 | |
119 | + }) | |
120 | + luaRegister(l, "fillRect", func(l *lua.LState) int { | |
121 | + rect := [4]int32{ | |
122 | + int32(float32(numArg(l, 1)) * sys.widthScale), | |
123 | + int32(float32(numArg(l, 2)) * sys.heightScale), | |
124 | + int32(float32(numArg(l, 3)) * sys.widthScale), | |
125 | + int32(float32(numArg(l, 4)) * sys.heightScale), | |
126 | + } | |
127 | + col := uint32(int32(numArg(l, 7))&0xff | int32(numArg(l, 6))&0xff<<8 | int32(numArg(l, 5))&0xff<<16) | |
128 | + a := int32(int32(numArg(l, 8))&0xff | int32(numArg(l, 9))&0xff<<10) | |
129 | + FillRect(rect, col, a) | |
130 | + return 0 | |
131 | + }) | |
132 | + luaRegister(l, "fadeScreen", func(l *lua.LState) int { | |
133 | + frame := float64(sys.frameCounter - int32(numArg(l, 2))) | |
134 | + length := float64(numArg(l, 3)) | |
135 | + if frame > length || length <= 0 { | |
136 | + l.Push(lua.LBool(false)) | |
137 | + return 1 | |
138 | + } | |
139 | + r, g, b, a := int32(0), int32(0), int32(0), float64(0) | |
140 | + if strArg(l, 1) == "fadeout" { | |
141 | + a = math.Floor(float64(255) / length * frame) | |
142 | + } else if strArg(l, 1) == "fadein" { | |
143 | + a = math.Floor(255 - 255 * (frame - 1) / length) | |
144 | + } | |
145 | + if a < 0 { | |
146 | + a = 0 | |
147 | + } else if a > 255 { | |
148 | + a = 255 | |
149 | + } | |
150 | + if l.GetTop() >= 6 { | |
151 | + r = int32(numArg(l, 4)) | |
152 | + g = int32(numArg(l, 5)) | |
153 | + b = int32(numArg(l, 6)) | |
154 | + } | |
155 | + col := uint32(int32(b)&0xff | int32(g)&0xff<<8 | int32(r)&0xff<<16) | |
156 | + FillRect(sys.scrrect, col, int32(a)) | |
157 | + l.Push(lua.LBool(true)) | |
158 | + return 1 | |
159 | + }) | |
101 | 160 | luaRegister(l, "sffNew", func(l *lua.LState) int { |
102 | 161 | sff, err := loadSff(strArg(l, 1), false) |
103 | 162 | if err != nil { |
@@ -201,7 +260,24 @@ func scriptCommonInit(l *lua.LState) { | ||
201 | 260 | return 0 |
202 | 261 | }) |
203 | 262 | luaRegister(l, "playBGM", func(l *lua.LState) int { |
204 | - sys.bgm.Open(strArg(l, 1), boolArg(l, 2), int(numArg(l, 3)), int(numArg(l, 4)), int(Atoi(strArg(l, 5))), int(Atoi(strArg(l, 6)))) | |
263 | + isdefault := true | |
264 | + var loop, volume, loopstart, loopend int = 1, 100, 0, 0 | |
265 | + if l.GetTop() >= 2 { | |
266 | + isdefault = boolArg(l, 2) | |
267 | + } | |
268 | + if l.GetTop() >= 3 { | |
269 | + loop = int(numArg(l, 3)) | |
270 | + } | |
271 | + if l.GetTop() >= 4 { | |
272 | + volume = int(numArg(l, 4)) | |
273 | + } | |
274 | + if l.GetTop() >= 5 { | |
275 | + loopstart = int(numArg(l, 5)) | |
276 | + } | |
277 | + if l.GetTop() >= 6 { | |
278 | + loopend = int(numArg(l, 6)) | |
279 | + } | |
280 | + sys.bgm.Open(strArg(l, 1), isdefault, loop, volume, loopstart, loopend) | |
205 | 281 | return 0 |
206 | 282 | }) |
207 | 283 | luaRegister(l, "esc", func(l *lua.LState) int { |
@@ -252,6 +328,67 @@ func scriptCommonInit(l *lua.LState) { | ||
252 | 328 | sys.teamLifeShare = boolArg(l, 1) |
253 | 329 | return 0 |
254 | 330 | }) |
331 | + luaRegister(l, "setMatchWins", func(l *lua.LState) int { | |
332 | + sys.lifebar.ro.match_wins = int32(numArg(l, 1)) | |
333 | + return 0 | |
334 | + }) | |
335 | + luaRegister(l, "getMatchWins", func(l *lua.LState) int { | |
336 | + l.Push(lua.LNumber(sys.lifebar.ro.match_wins)) | |
337 | + return 1 | |
338 | + }) | |
339 | + luaRegister(l, "setMatchMaxDrawGames", func(l *lua.LState) int { | |
340 | + sys.lifebar.ro.match_maxdrawgames = int32(numArg(l, 1)) | |
341 | + return 0 | |
342 | + }) | |
343 | + luaRegister(l, "getMatchMaxDrawGames", func(l *lua.LState) int { | |
344 | + l.Push(lua.LNumber(sys.lifebar.ro.match_maxdrawgames)) | |
345 | + return 1 | |
346 | + }) | |
347 | + luaRegister(l, "getFramesPerCount", func(l *lua.LState) int { | |
348 | + l.Push(lua.LNumber(sys.lifebar.ti.framespercount)) | |
349 | + return 1 | |
350 | + }) | |
351 | + luaRegister(l, "setMasterVolume", func(l *lua.LState) int { | |
352 | + sys.masterVolume = int(numArg(l, 1)) | |
353 | + return 0 | |
354 | + }) | |
355 | + luaRegister(l, "setBgmVolume", func(l *lua.LState) int { | |
356 | + sys.bgmVolume = int(numArg(l, 1)) | |
357 | + return 0 | |
358 | + }) | |
359 | + luaRegister(l, "setWavVolume", func(l *lua.LState) int { | |
360 | + sys.wavVolume = int(numArg(l, 1)) | |
361 | + return 0 | |
362 | + }) | |
363 | + luaRegister(l, "setAudioDucking", func(l *lua.LState) int { | |
364 | + sys.AudioDucking = boolArg(l, 1) | |
365 | + return 0 | |
366 | + }) | |
367 | + luaRegister(l, "setAttackLifeToPowerMul", func(l *lua.LState) int { | |
368 | + sys.attack_LifeToPowerMul = float32(numArg(l, 1)) | |
369 | + return 0 | |
370 | + }) | |
371 | + luaRegister(l, "setGetHitLifeToPowerMul", func(l *lua.LState) int { | |
372 | + sys.getHit_LifeToPowerMul = float32(numArg(l, 1)) | |
373 | + return 0 | |
374 | + }) | |
375 | + luaRegister(l, "setSuperTargetDefenceMul", func(l *lua.LState) int { | |
376 | + sys.super_TargetDefenceMul = float32(numArg(l, 1)) | |
377 | + return 0 | |
378 | + }) | |
379 | + luaRegister(l, "setAllowDebugKeys", func(l *lua.LState) int { | |
380 | + d := boolArg(l, 1) | |
381 | + if !d { | |
382 | + if sys.clsnDraw { | |
383 | + sys.clsnDraw = false | |
384 | + } | |
385 | + if sys.debugDraw { | |
386 | + sys.debugDraw = false | |
387 | + } | |
388 | + } | |
389 | + sys.allowDebugKeys = d | |
390 | + return 0 | |
391 | + }) | |
255 | 392 | |
256 | 393 | // All the lua sprites will be caled by this value |
257 | 394 | luaRegister(l, "setLuaSpriteScale", func(l *lua.LState) int { |
@@ -297,6 +434,40 @@ func scriptCommonInit(l *lua.LState) { | ||
297 | 434 | |
298 | 435 | func systemScriptInit(l *lua.LState) { |
299 | 436 | scriptCommonInit(l) |
437 | + luaRegister(l, "bgNew", func(*lua.LState) int { | |
438 | + sff := "" | |
439 | + if l.GetTop() >= 3 { | |
440 | + sff = strArg(l, 3) | |
441 | + } | |
442 | + num, err := loadBGDef(strArg(l, 1), strArg(l, 2), sff) | |
443 | + if err != nil { | |
444 | + l.RaiseError(err.Error()) | |
445 | + } | |
446 | + l.Push(lua.LNumber(num)) | |
447 | + return 1 | |
448 | + }) | |
449 | + luaRegister(l, "bgDraw", func(*lua.LState) int { | |
450 | + top := false | |
451 | + var x, y, scl float32 = 0, 0, 1 | |
452 | + if l.GetTop() >= 2 { | |
453 | + top = boolArg(l, 2) | |
454 | + } | |
455 | + if l.GetTop() >= 3 { | |
456 | + x = float32(numArg(l, 3)) | |
457 | + } | |
458 | + if l.GetTop() >= 4 { | |
459 | + y = float32(numArg(l, 4)) | |
460 | + } | |
461 | + if l.GetTop() >= 5 { | |
462 | + scl = float32(numArg(l, 5)) | |
463 | + } | |
464 | + sys.bgdef[int(numArg(l, 1))].draw(top, x, y, scl) | |
465 | + return 0 | |
466 | + }) | |
467 | + luaRegister(l, "bgReset", func(*lua.LState) int { | |
468 | + sys.bgdef[int(numArg(l, 1))].reset() | |
469 | + return 0 | |
470 | + }) | |
300 | 471 | luaRegister(l, "textImgNew", func(*lua.LState) int { |
301 | 472 | l.Push(newUserData(l, NewTextSprite())) |
302 | 473 | return 1 |
@@ -772,7 +943,8 @@ func systemScriptInit(l *lua.LState) { | ||
772 | 943 | return 0 |
773 | 944 | }) |
774 | 945 | luaRegister(l, "setTurnsRecoveryRate", func(l *lua.LState) int { |
775 | - sys.turnsRecoveryRate = float32(numArg(l, 1)) | |
946 | + sys.turnsRecoveryBase = float32(numArg(l, 1)) | |
947 | + sys.turnsRecoveryBonus = float32(numArg(l, 2)) | |
776 | 948 | return 0 |
777 | 949 | }) |
778 | 950 | luaRegister(l, "setZoom", func(l *lua.LState) int { |
@@ -813,6 +985,37 @@ func systemScriptInit(l *lua.LState) { | ||
813 | 985 | sys.loadStart() |
814 | 986 | return 0 |
815 | 987 | }) |
988 | + luaRegister(l, "overwriteCharData", func(l *lua.LState) int { | |
989 | + pn := int(numArg(l, 1)) | |
990 | + if pn < 1 || pn > MaxSimul*2+MaxAttachedChar { | |
991 | + l.RaiseError("The player number (%v) is invalid.", pn) | |
992 | + } | |
993 | + tbl := tableArg(l, 2) | |
994 | + tbl.ForEach(func(key, value lua.LValue) { | |
995 | + switch k := key.(type) { | |
996 | + case lua.LString: | |
997 | + switch string(k) { | |
998 | + case "power": | |
999 | + sys.ocd[pn-1].power = int32(lua.LVAsNumber(value)) | |
1000 | + case "life": | |
1001 | + sys.ocd[pn-1].life = int32(lua.LVAsNumber(value)) | |
1002 | + case "lifeMax": | |
1003 | + sys.ocd[pn-1].lifeMax = int32(lua.LVAsNumber(value)) | |
1004 | + case "lifeRatio": | |
1005 | + sys.ocd[pn-1].lifeRatio = float32(lua.LVAsNumber(value)) | |
1006 | + case "attackRatio": | |
1007 | + sys.ocd[pn-1].attackRatio = float32(lua.LVAsNumber(value)) | |
1008 | + case "defenceRatio": | |
1009 | + sys.ocd[pn-1].defenceRatio = float32(lua.LVAsNumber(value)) | |
1010 | + default: | |
1011 | + l.RaiseError("The table key (%v) is invalid.", key) | |
1012 | + } | |
1013 | + default: | |
1014 | + l.RaiseError("The table key type (%v) is invalid.", fmt.Sprintf("%T\n", key)) | |
1015 | + } | |
1016 | + }) | |
1017 | + return 0 | |
1018 | + }) | |
816 | 1019 | luaRegister(l, "game", func(l *lua.LState) int { |
817 | 1020 | tbl := l.NewTable() |
818 | 1021 | tbl_chars := l.NewTable() |
@@ -827,14 +1030,17 @@ func systemScriptInit(l *lua.LState) { | ||
827 | 1030 | sys.await(FPS) |
828 | 1031 | } |
829 | 1032 | for i := range sys.cgi { |
830 | - if i < len(sys.lifebar.fa[sys.tmode[i&1]]) { | |
1033 | + num := len(sys.lifebar.fa[sys.tmode[i&1]]) | |
1034 | + if (sys.tmode[i&1] == TM_Simul || sys.tmode[i&1] == TM_Tag) { | |
1035 | + num = int(sys.numSimul[i&1]) * 2 | |
1036 | + } | |
1037 | + if i < num { | |
831 | 1038 | fa := sys.lifebar.fa[sys.tmode[i&1]][i] |
832 | 1039 | fa.face = sys.cgi[i].sff.getOwnPalSprite( |
833 | 1040 | int16(fa.face_spr[0]), int16(fa.face_spr[1])) |
834 | 1041 | |
835 | 1042 | fa.scale = sys.cgi[i].portraitscale |
836 | 1043 | } |
837 | - | |
838 | 1044 | } |
839 | 1045 | runtime.GC() |
840 | 1046 | return nil |
@@ -923,6 +1129,7 @@ func systemScriptInit(l *lua.LState) { | ||
923 | 1129 | if len(p) > 0 { |
924 | 1130 | tmp := l.NewTable() |
925 | 1131 | tmp.RawSetString("name", lua.LString(p[0].name)) |
1132 | + tmp.RawSetString("id", lua.LNumber(p[0].id)) | |
926 | 1133 | tmp.RawSetString("memberNo", lua.LNumber(p[0].memberNo)) |
927 | 1134 | tmp.RawSetString("selectNo", lua.LNumber(p[0].selectNo)) |
928 | 1135 | tmp.RawSetString("life", lua.LNumber(p[0].life)) |
@@ -984,60 +1191,58 @@ func systemScriptInit(l *lua.LState) { | ||
984 | 1191 | tbl.RawSetString("P2wins", lua.LNumber(sys.wins[1])) |
985 | 1192 | tbl.RawSetString("P1tmode", lua.LNumber(sys.tmode[0])) |
986 | 1193 | tbl.RawSetString("P2tmode", lua.LNumber(sys.tmode[1])) |
1194 | + tbl.RawSetString("challenger", lua.LNumber(sys.challenger)) | |
987 | 1195 | sys.timerCount = []int32{} |
988 | 1196 | sys.sel.cdefOverwrite = [len(sys.sel.cdefOverwrite)]string{} |
989 | 1197 | sys.sel.sdefOverwrite = "" |
990 | 1198 | l.Push(lua.LNumber(winp)) |
991 | 1199 | l.Push(tbl) |
1200 | + sys.resetOverwriteCharData() | |
992 | 1201 | return 2 |
993 | 1202 | } |
994 | 1203 | } |
995 | 1204 | }) |
996 | 1205 | luaRegister(l, "getCharVar", func(*lua.LState) int { |
997 | - for _, p := range sys.chars { | |
998 | - if len(p) > 0 && p[0].playerNo+1 == int(numArg(l, 1)) { | |
999 | - if strArg(l, 2) == "varGet" { | |
1000 | - l.Push(lua.LNumber(p[0].varGet(int32(numArg(l, 3))).ToI())) | |
1001 | - } else if strArg(l, 2) == "fvarGet" { | |
1002 | - l.Push(lua.LNumber(p[0].fvarGet(int32(numArg(l, 3))).ToI())) | |
1003 | - } else if strArg(l, 2) == "sysVarGet" { | |
1004 | - l.Push(lua.LNumber(p[0].sysVarGet(int32(numArg(l, 3))).ToI())) | |
1005 | - } else if strArg(l, 2) == "sysFvarGet" { | |
1006 | - l.Push(lua.LNumber(p[0].sysFvarGet(int32(numArg(l, 3))).ToI())) | |
1007 | - } | |
1008 | - break | |
1206 | + pn := int(numArg(l, 1)) | |
1207 | + if pn >= 1 && pn <= len(sys.chars) && len(sys.chars[pn-1]) > 0 { | |
1208 | + if strArg(l, 2) == "varGet" { | |
1209 | + l.Push(lua.LNumber(sys.chars[pn- |
Ein Teil der Diff wurde aufgrund der Größenbeschränkung abgeschnitten. Verwenden Sie Ihren lokalen Client, um die vollständige Diff.