-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathglobals.lua
278 lines (238 loc) · 7.64 KB
/
globals.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
-----------------------------------
--- Globals module
--- Declaration of globals variables
-- @module globals
require("queue")
-- declaration of variables related to the keyboard
keyboard = {
{up="up", down="down", left="left", right="right",
swap1="z", swap2="x", raise_faster1="c", raise_faster2="v"},
{},{},{}
}
key_names = {"up", "down", "left", "right", "swap1",
"swap2", "raise_faster1", "raise_faster2"} -- Alterado p raise_faster
keys = {}
this_frame_keys = {}
this_frame_unicodes = {}
this_frame_messages = {}
bounce_table = {
1, 1, 1, 1,
2, 2, 2,
3, 3, 3,
4, 4, 4
}
garbage_bounce_table = {
2, 2, 2,
3, 3, 3,
4, 4, 4,
1, 1
}
danger_bounce_table = {
1, 1, 1,
2, 2, 2,
3, 3, 3,
2, 2, 2,
1, 1, 1,
4, 4, 4
}
SCOREMODE_TA = 1
SCOREMODE_PDP64 = 2
score_mode = SCOREMODE_TA
-- score lookup tables
score_combo_PdP64 = {} --size 40
score_combo_TA = {
0, 0, 0, 20, 30,
50, 60, 70, 80, 100,
140, 170, 210, 250, 290,
340, 390, 440, 490, 550,
610, 680, 750, 820, 900,
980, 1060, 1150, 1240, 1330, [0]=0
}
score_chain_TA = {
0, 50, 80, 150, 300,
400, 500, 700, 900, 1100,
1300, 1500, 1800, [0]=0
}
-- game graphics scale related to the panel
GFX_SCALE = 3
card_animation = {
false,
-1, 0, 1, 2, 3, 4, 4, 5, 5, 6,
6, 7, 7, 8, 8, 8, 9, 9, 9, 9,
9, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 11, 11, 11, 11,
11
}
gfx_q = Queue()
FC_HOVER = {12, 9, 6}
-- TODO: delete FC_MATCH?
--FC_MATCH = {61, 49, 37}
FC_FLASH = {44, 36, 22}
FC_FACE = {17, 13, 15} -- idk this is just MATCH-FLASH
FC_POP = { 9, 8, 7}
stop_time_combo = {120, 120, 120}
stop_time_chain = {300, 180, 120}
stop_time_danger = {600, 420, 240}
difficulty_to_ncolors_endless = {5,6,6}
difficulty_to_ncolors_1Ptime = {6,6,6}
-- value of the speed in each level
speed_to_rise_time = map(
function(x)
return x/16
end, {
942, 983, 838, 790, 755, 695, 649, 604, 570, 515,
474, 444, 394, 370, 347, 325, 306, 289, 271, 256,
240, 227, 213, 201, 189, 178, 169, 158, 148, 138,
129, 120, 112, 105, 99, 92, 86, 82, 77, 73,
69, 66, 62, 59, 56, 54, 52, 50, 48, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
47, 47, 47, 47, 47, 47, 47, 47, 47
}
)
-- number of panels you need to clear to increase speed in each level
panels_to_next_speed = {
9, 12, 12, 12, 12, 12, 15, 15, 18, 18,
24, 24, 24, 24, 24, 24, 21, 18, 18, 18,
36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
45, 45, 45, 45, 45, 45, 45, 45, math.huge
}
-- vs mode and 2P time attack use a speed system in which
-- speed increases every 15 seconds. However, instead of
-- exposing speed and difficulty directly, they expose levels.
-- A level is a speed, a difficulty, and an amount of time
-- that can be spent at the top of the screen without dying.
-- level also determines the number of COLORS
level_to_starting_speed = { 1, 5, 9, 13, 17, 21, 25, 29, 27, 32}
--level_to_difficulty = { 1, 1, 2, 2, 2, 2, 2, 3, 3, 3}
level_to_hang_time = {121,100, 80, 65, 50, 40, 30, 20, 10, 1}
level_to_ncolors_vs = { 5, 5, 5, 5, 5, 5, 5, 5, 6, 6}
level_to_ncolors_time = { 5, 5, 6, 6, 6, 6, 6, 6, 6, 6}
level_to_hover = { 12, 12, 11, 10, 9, 6, 5, 4, 3, 6}
level_to_pop = { 9, 9, 8, 8, 8, 8, 8, 7, 7, 7}
level_to_flash = { 44, 44, 42, 42, 38, 36, 34, 32, 30, 28}
level_to_face = { 15, 14, 14, 13, 12, 11, 10, 10, 9, 8}
level_to_combo_constant = {-20,-16,-12, -8, -3, 2, 7, 12, 17, 22}
level_to_combo_coefficient = { 20, 18, 16, 14, 12, 10, 8, 6, 4, 2}
level_to_chain_constant = { 80, 77, 74, 71, 68, 65, 62, 60, 58, 56}
level_to_chain_coefficient = { 20, 18, 16, 14, 12, 10, 8, 6, 4, 2}
-- Stage clear seems to use a variant of vs mode's speed system,
-- except that the amount of time between increases is not constant.
-- on stage 1, the increases occur at increments of:
-- 20, 15, 15, 15, 10, 10, 10
-- The following are level settings for vs cpu:
-- vs easy cpu -> vs level 2 for all levels
-- vs normal cpu -> vs level 4 for all levels
-- vs hard cpu -> vs level 6 for all levels
-- vs vhard cpu -> vs level 6 for all levels
combo_garbage = {
{}, {}, {}, {3}, {4},
{5}, {6}, {3,4}, {4,4}, {5,5},
{5,6}, {6,6}, {6,6,6}, {6,6,6,6},
[20]={6,6,6,6,6,6},
[27]={6,6,6,6,6,6,6,6}
}
for i=1,72 do
combo_garbage[i] = combo_garbage[i] or combo_garbage[i-1]
end
-- characters availables to players
characters = {
"lip", "windy", "sherbet", "thiana", "ruby",
"elias", "flare", "neris", "seren", "phoenix", "dragon", "thanatos", "cordelia",
"lakitu", "bumpty", "poochy", "wiggler", "froggy", "blargg",
"lungefish", "raphael", "yoshi", "hookbill",
"navalpiranha", "kamek", "bowser"
}
--- stages related to each character
--- ... it changes the backgroud image and the sound for each choice
stages = {
lip = 'flower',
windy = 'wind',
sherbet = 'ice',
thiana = 'forest',
ruby = 'jewel',
elias = 'water',
flare = 'fire',
neris = 'sea',
seren = 'moon',
phoenix = 'cave',
dragon = 'cave',
thanatos = 'king',
cordelia = 'cordelia',
lakitu = 'wind',
bumpty = 'ice',
poochy = 'forest',
wiggler = 'jewel',
froggy = 'water',
blargg = 'fire',
lungefish = 'sea',
raphael = 'moon',
yoshi = 'yoshi',
hookbill = 'cave',
navalpiranha = 'cave',
kamek = 'cave',
bowser = 'king'
}
shake_arr = {}
local shake_idx = -6
for i=14,6,-1 do
local x = -math.pi
local step = math.pi * 2 / i
for j=1,i do
shake_arr[shake_idx] = (1 + math.cos(x))/2
x = x + step
shake_idx = shake_idx + 1
end
end
print("#shake arr "..#shake_arr)
-- 1 -> 1
-- #shake -> 0
local shake_step = 1/(#shake_arr - 1)
local shake_mult = 1
for i=1,#shake_arr do
shake_arr[i] = shake_arr[i] * shake_mult
print(shake_arr[i])
shake_mult = shake_mult - shake_step
end
garbage_to_shake_time = {
[0] = 0,
18, 18, 18, 18, 24, 42, 42, 42, 42, 42,
42, 66, 66, 66, 66, 66, 66, 66, 66, 66,
66, 66, 66, 76
}
for i=25,1000 do
garbage_to_shake_time[i] = garbage_to_shake_time[i-1]
end
colors = {
red = {220, 50, 47 },
orange = {255, 140, 0 },
green = {80, 169, 0 },
purple = {168, 128, 192},
blue = {38, 139, 210},
pink = {211, 68, 134},
white = {234, 234, 234},
black = {20, 20, 20 },
dgray = {28, 28, 28 }
}
panel_color_number_to_upper = {"A", "B", "C", "D", "E", "F", "G", "H",[0]="0"}
panel_color_number_to_lower = {"a", "b", "c", "d", "e", "f", "g", "h",[0]="0"}
panel_color_to_number = {
["A"]=1, ["B"]=2, ["C"]=3, ["D"]=4, ["E"]=5, ["F"]=6, ["G"]=7, ["H"]=8,
["a"]=1, ["b"]=2, ["c"]=3, ["d"]=4, ["e"]=5, ["f"]=6, ["g"]=7, ["h"]=8,
["1"]=1, ["2"]=2, ["3"]=3, ["4"]=4, ["5"]=5, ["6"]=6, ["7"]=7, ["8"]=8,
["0"]=0
}
-- how many panels you have to pop to earn a metal panel in your next row.
level_to_metal_panel_frequency = {12, 14, 16, 19, 23, 26, 29, 33, 37, 41}
-- win counters
my_win_count = 0
op_win_count = 0
default_assets_dir = "Stock PdP_TA"