@@ -126,13 +126,45 @@ end
126
126
do -- spin
127
127
function chargeLimit .spin_event_playerInit (P )
128
128
P .modeData .spinClear = 0
129
+ P :addEvent (' afterDrop' ,chargeLimit .spin_event_afterDrop )
129
130
P :addEvent (' afterClear' ,{- 1e99 ,chargeLimit .spin_event_afterClear })
131
+ P :addEvent (' drawBelowMarks' ,chargeLimit .spin_event_drawBelowMarks )
132
+ end
133
+ function chargeLimit .spin_event_afterDrop (P )
134
+ local F = P .field
135
+ if P .lastMovement .immobile then
136
+ local CB = P .hand .matrix
137
+ for y = 1 ,# CB do for x = 1 ,# CB [1 ] do
138
+ local C = CB [y ][x ]
139
+ if C then
140
+ local cx ,cy = x + P .handX - 1 ,y + P .handY - 1
141
+ if
142
+ F :getCell (cx - 1 ,cy ) or
143
+ F :getCell (cx + 1 ,cy ) or
144
+ F :getCell (cx ,cy - 1 ) or
145
+ F :getCell (cx ,cy + 1 )
146
+ then
147
+ C .spin_charge = true
148
+ end
149
+ end
150
+ end end
151
+ end
130
152
end
131
153
function chargeLimit .spin_event_afterClear (P ,clear )
132
154
if P .lastMovement .immobile then
133
155
P .modeData .spinClear = P .modeData .spinClear + clear .line
134
156
end
135
157
end
158
+ function chargeLimit .spin_event_drawBelowMarks (P )
159
+ gc_setColor (1 ,1 ,1 ,.62 )
160
+ local mat = P .field ._matrix
161
+ for y = 1 ,# mat do for x = 1 ,# mat [1 ] do
162
+ local C = mat [y ][x ]
163
+ if C and C .spin_charge then
164
+ gc_rectangle (' fill' ,40 * (x - 1 )+ 10 ,- 40 * (y - 1 )- 10 ,20 ,- 20 )
165
+ end
166
+ end end
167
+ end
136
168
137
169
local styles = {
138
170
{name = ' I' ,id = 7 ,x =- 300 ,y =- 60 - 40 * 3 ,w = 160 ,h = 30 ,color = RGB9 [488 ], colorDanger = RGB9 [233 ]},
@@ -189,7 +221,6 @@ do -- spin
189
221
P :addEvent (' always' ,chargeLimit .spin_piece_event_always )
190
222
P :addEvent (' beforeClear' ,{- 1 ,chargeLimit .spin_piece_event_beforeClear })
191
223
P :addEvent (' drawOnPlayer' ,chargeLimit .spin_piece_event_drawOnPlayer )
192
- P :addEvent (' drawBelowMarks' ,chargeLimit .spin_piece_event_drawBelowMarks )
193
224
end
194
225
function chargeLimit .spin_piece_event_always (P )
195
226
--- @type Techmino.Mech.Brik.PieceDevice[]
@@ -209,15 +240,6 @@ do -- spin
209
240
end
210
241
end
211
242
function chargeLimit .spin_piece_event_beforeClear (P ,fullLines )
212
- if P .lastMovement .immobile then
213
- local CB = P .hand .matrix
214
- for y = 1 ,# CB do for x = 1 ,# CB [1 ] do
215
- local C = CB [y ][x ]
216
- if C then
217
- C .spin_charge = true
218
- end
219
- end end
220
- end
221
243
--- @type Techmino.Mech.Brik.PieceDevice[]
222
244
local devices = P .modeData .spin_powDevice
223
245
local mainDev = devices [Brik .getID (P .hand .name )]
@@ -258,16 +280,6 @@ do -- spin
258
280
mainDev .display = false
259
281
end
260
282
end
261
- function chargeLimit .spin_piece_event_drawBelowMarks (P )
262
- gc_setColor (1 ,1 ,1 ,.42 )
263
- local mat = P .field ._matrix
264
- for y = 1 ,# mat do for x = 1 ,# mat [1 ] do
265
- local C = mat [y ][x ]
266
- if C and C .spin_charge then
267
- gc_rectangle (' fill' ,40 * (x - 1 )+ 10 ,- 40 * (y - 1 )- 10 ,20 ,- 20 )
268
- end
269
- end end
270
- end
271
283
function chargeLimit .spin_piece_event_drawOnPlayer (P )
272
284
--- @type Techmino.Mech.Brik.PieceDevice[]
273
285
local devices = P .modeData .spin_powDevice
0 commit comments