arm小程序删除答错自动清空
整理代码 框架跟进
This commit is contained in:
@@ -7,7 +7,7 @@ local gc_print,gc_printf=gc.print,gc.printf
|
||||
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
|
||||
local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest
|
||||
|
||||
local int,ceil,rnd=math.floor,math.ceil,math.random
|
||||
local floor,ceil,rnd=math.floor,math.ceil,math.random
|
||||
local max,min,sin,modf=math.max,math.min,math.sin,math.modf
|
||||
local setFont=FONT.set
|
||||
local SKIN,TEXTURE,IMG=SKIN,TEXTURE,IMG
|
||||
@@ -124,8 +124,8 @@ local function _applyField(P)
|
||||
|
||||
-- Apply shaking
|
||||
if P.shakeTimer>0 then
|
||||
local dx=int(P.shakeTimer/2)
|
||||
local dy=int(P.shakeTimer/3)
|
||||
local dx=floor(P.shakeTimer/2)
|
||||
local dy=floor(P.shakeTimer/3)
|
||||
gc_translate(dx^1.6*(dx%2*2-1)*(P.gameEnv.shakeFX+1)/30,dy^1.4*(dy%2*2-1)*(P.gameEnv.shakeFX+1)/30)
|
||||
end
|
||||
|
||||
@@ -172,7 +172,7 @@ end
|
||||
local function _drawField(P,showInvis)
|
||||
local ENV=P.gameEnv
|
||||
local V,F=P.visTime,P.field
|
||||
local start=int((P.fieldBeneath+P.fieldUp)/30+1)
|
||||
local start=floor((P.fieldBeneath+P.fieldUp)/30+1)
|
||||
local texture=P.skinLib
|
||||
if P.falling==0 then-- Blocks only
|
||||
if ENV.upEdge then
|
||||
@@ -358,9 +358,9 @@ local function _drawBlock(CB,curX,curY,texture)
|
||||
end
|
||||
local function _drawNextPreview(B,fieldH,fieldBeneath)
|
||||
gc_setColor(1,1,1,.8)
|
||||
local y=int(fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(fieldBeneath/30)
|
||||
local y=floor(fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(fieldBeneath/30)
|
||||
B=B.bk
|
||||
local x=int(6-#B[1]*.5)
|
||||
local x=floor(6-#B[1]*.5)
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
for i=1,#B do for j=1,#B[1] do
|
||||
if B[i][j] then
|
||||
@@ -370,9 +370,9 @@ local function _drawNextPreview(B,fieldH,fieldBeneath)
|
||||
end
|
||||
local function _drawHoldPreview(B,fieldH,fieldBeneath)
|
||||
gc_setColor(1,1,1,.3)
|
||||
local y=int(fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(fieldBeneath/30)+.14
|
||||
local y=floor(fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(fieldBeneath/30)+.14
|
||||
B=B.bk
|
||||
local x=int(6-#B[1]*.5)
|
||||
local x=floor(6-#B[1]*.5)
|
||||
local cross=TEXTURE.puzzleMark[-1]
|
||||
for i=1,#B do for j=1,#B[1] do
|
||||
if B[i][j] then
|
||||
@@ -431,7 +431,7 @@ local function _drawBuffer(atkBuffer,bufferWarn,atkBufferSum1,atkBufferSum)
|
||||
gc_translate(d^.5*(rnd()-.5)*15,d^.5*(rnd()-.5)*15)
|
||||
end
|
||||
end
|
||||
gc_printf(int(sum),-300,-20,292,'right')
|
||||
gc_printf(floor(sum),-300,-20,292,'right')
|
||||
gc_pop()
|
||||
end
|
||||
end
|
||||
@@ -614,7 +614,7 @@ local _drawDial do
|
||||
else
|
||||
gc.circle('line',x+40,y+40,37)
|
||||
end
|
||||
setFont(30)GC.mStr(int(speed),x+40,y+19)
|
||||
setFont(30)GC.mStr(floor(speed),x+40,y+19)
|
||||
end
|
||||
end
|
||||
local function _drawFinesseCombo_norm(P)
|
||||
@@ -709,7 +709,7 @@ local function _drawStartCounter(time)
|
||||
gc_push('transform')
|
||||
gc_translate(300,300)
|
||||
local r,g,b
|
||||
local num=int(time/60)+1
|
||||
local num=floor(time/60)+1
|
||||
local d=time%60
|
||||
if num==3 then
|
||||
r,g,b=.7,.8,.98
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
local Player={}-- Player class
|
||||
|
||||
local int,ceil,rnd=math.floor,math.ceil,math.random
|
||||
local floor,ceil,rnd=math.floor,math.ceil,math.random
|
||||
local max,min,abs,modf=math.max,math.min,math.abs,math.modf
|
||||
local assert,ins,rem=assert,table.insert,table.remove
|
||||
local resume,yield,status=coroutine.resume,coroutine.yield,coroutine.status
|
||||
@@ -42,7 +42,7 @@ function Player:_rotateField(dir)
|
||||
end
|
||||
function Player:shakeField(strength)-- Range: 1~10
|
||||
if self.gameEnv.shakeFX then
|
||||
self.shakeTimer=max(self.shakeTimer,3*self.gameEnv.shakeFX+int(4*min(max(strength,1),10)))
|
||||
self.shakeTimer=max(self.shakeTimer,3*self.gameEnv.shakeFX+floor(4*min(max(strength,1),10)))
|
||||
end
|
||||
end
|
||||
function Player:checkTouchSound()
|
||||
@@ -198,7 +198,7 @@ function Player:createBeam(R,send)
|
||||
local r,g,b=c[1]*2,c[2]*2,c[3]*2
|
||||
local a=(power+2)*.0626
|
||||
if self.type~='human' and R.type~='human' then a=a*.2 end
|
||||
SYSFX.newAttack(1-power*.1,x1,y1,x2,y2,int(send^.7*(4+power)),r,g,b,a)
|
||||
SYSFX.newAttack(1-power*.1,x1,y1,x2,y2,floor(send^.7*(4+power)),r,g,b,a)
|
||||
end
|
||||
end
|
||||
--------------------------</FX>--------------------------
|
||||
@@ -874,7 +874,7 @@ function Player:receive(A,send,time,line)
|
||||
cd0=time,
|
||||
time=0,
|
||||
sent=false,
|
||||
lv=min(int(send^.69),5),
|
||||
lv=min(floor(send^.69),5),
|
||||
})-- Sorted insert(by time)
|
||||
self.atkBufferSum=self.atkBufferSum+send
|
||||
self.stat.recv=self.stat.recv+send
|
||||
@@ -1127,7 +1127,7 @@ function Player:_checkMission(piece,mission)
|
||||
elseif mission==9 then
|
||||
return piece.pc
|
||||
elseif mission<90 then
|
||||
return piece.row==mission%10 and piece.name==int(mission/10) and piece.spin
|
||||
return piece.row==mission%10 and piece.name==floor(mission/10) and piece.spin
|
||||
end
|
||||
return false
|
||||
end
|
||||
@@ -1148,8 +1148,8 @@ function Player:resetBlock()-- Reset Block's position and execute I*S
|
||||
local C=self.cur
|
||||
local sc=C.RS.centerPos[C.id][C.dir]
|
||||
|
||||
self.curX=int(6-#C.bk[1]*.5)
|
||||
local y=int(self.gameEnv.fieldH+1-modf(sc[1]))+ceil(self.fieldBeneath/30)
|
||||
self.curX=floor(6-#C.bk[1]*.5)
|
||||
local y=floor(self.gameEnv.fieldH+1-modf(sc[1]))+ceil(self.fieldBeneath/30)
|
||||
self.curY=y
|
||||
self.minY=y+sc[1]
|
||||
|
||||
@@ -1191,7 +1191,7 @@ end
|
||||
|
||||
function Player:getNextSpawn()
|
||||
local cur = self.nextQueue[1]
|
||||
return int(self.gameEnv.fieldH+1-modf(cur.RS.centerPos[cur.id][cur.dir][1]))+ceil(self.fieldBeneath/30)
|
||||
return floor(self.gameEnv.fieldH+1-modf(cur.RS.centerPos[cur.id][cur.dir][1]))+ceil(self.fieldBeneath/30)
|
||||
end
|
||||
|
||||
function Player:spin(d,ifpre)
|
||||
@@ -1275,9 +1275,9 @@ function Player:hold_norm(ifpre)
|
||||
x=x+(#C.bk[1]-#H.bk[1])*.5
|
||||
y=y+(#C.bk-#H.bk)*.5
|
||||
|
||||
local iki=phyHoldKickX[x==int(x)]
|
||||
local iki=phyHoldKickX[x==floor(x)]
|
||||
local success
|
||||
for Y=int(y),ceil(y+.5) do
|
||||
for Y=floor(y),ceil(y+.5) do
|
||||
for i=1,#iki do
|
||||
local X=x+iki[i]
|
||||
if not self:ifoverlap(H.bk,X,Y) then
|
||||
@@ -1321,7 +1321,7 @@ function Player:hold_norm(ifpre)
|
||||
self:_checkSuffocate()
|
||||
end
|
||||
|
||||
self.freshTime=int(min(self.freshTime+ENV.freshLimit*.25,ENV.freshLimit*((self.holdTime+1)/ENV.holdCount),ENV.freshLimit))
|
||||
self.freshTime=floor(min(self.freshTime+ENV.freshLimit*.25,ENV.freshLimit*((self.holdTime+1)/ENV.holdCount),ENV.freshLimit))
|
||||
if not ENV.infHold then
|
||||
self.holdTime=self.holdTime-1
|
||||
end
|
||||
@@ -1344,9 +1344,9 @@ function Player:hold_swap(ifpre)
|
||||
x=x+(#C.bk[1]-#H.bk[1])*.5
|
||||
y=y+(#C.bk-#H.bk)*.5
|
||||
|
||||
local iki=phyHoldKickX[x==int(x)]
|
||||
local iki=phyHoldKickX[x==floor(x)]
|
||||
local success
|
||||
for Y=int(y),ceil(y+.5) do
|
||||
for Y=floor(y),ceil(y+.5) do
|
||||
for i=1,#iki do
|
||||
local X=x+iki[i]
|
||||
if not self:ifoverlap(H.bk,X,Y) then
|
||||
@@ -1386,7 +1386,7 @@ function Player:hold_swap(ifpre)
|
||||
self:_checkSuffocate()
|
||||
end
|
||||
|
||||
self.freshTime=int(min(self.freshTime+ENV.freshLimit*.25,ENV.freshLimit*((self.holdTime+1)/ENV.holdCount),ENV.freshLimit))
|
||||
self.freshTime=floor(min(self.freshTime+ENV.freshLimit*.25,ENV.freshLimit*((self.holdTime+1)/ENV.holdCount),ENV.freshLimit))
|
||||
if not ENV.infHold then
|
||||
self.holdTime=self.holdTime-1
|
||||
end
|
||||
@@ -1847,7 +1847,7 @@ do
|
||||
self:showText(text.clear[cc],0,-30,35,'appear',(8-cc)*.3)
|
||||
yomi = text.clear[cc]..yomi
|
||||
atk=cc-.5
|
||||
sendTime=20+int(atk*20)
|
||||
sendTime=20+floor(atk*20)
|
||||
cscore=cscore+clearSCR[cc]
|
||||
piece.special=false
|
||||
end
|
||||
@@ -1925,10 +1925,10 @@ do
|
||||
end
|
||||
|
||||
-- Send Lines
|
||||
atk=int(atk*(1+self.strength*.25))-- Badge Buff
|
||||
atk=floor(atk*(1+self.strength*.25))-- Badge Buff
|
||||
send=atk
|
||||
if exblock>0 then
|
||||
exblock=int(exblock*(1+self.strength*.25))-- Badge Buff
|
||||
exblock=floor(exblock*(1+self.strength*.25))-- Badge Buff
|
||||
self:showText("+"..exblock,0,53,20,'fly')
|
||||
off=off+self:cancel(exblock)
|
||||
end
|
||||
@@ -2017,7 +2017,7 @@ do
|
||||
cscore=cscore*(.9+self.dropSpeed/600)
|
||||
end
|
||||
|
||||
cscore=int(cscore)
|
||||
cscore=floor(cscore)
|
||||
self:popScore(cscore)
|
||||
|
||||
piece.row,piece.dig=cc,gbcc
|
||||
@@ -2049,7 +2049,7 @@ do
|
||||
-- Prevent sudden death if hang>0
|
||||
if ENV.hang>ENV.wait and self.nextQueue[1] then
|
||||
local B=self.nextQueue[1]
|
||||
if self:ifoverlap(B.bk,int(6-#B.bk[1]*.5),int(ENV.fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(self.fieldBeneath/30)) then
|
||||
if self:ifoverlap(B.bk,floor(6-#B.bk[1]*.5),floor(ENV.fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(self.fieldBeneath/30)) then
|
||||
self.waiting=self.waiting+ENV.hang
|
||||
end
|
||||
end
|
||||
@@ -2075,7 +2075,7 @@ do
|
||||
if atk>0 then
|
||||
Stat.atk=Stat.atk+atk
|
||||
if send>0 then
|
||||
Stat.send=Stat.send+int(send)
|
||||
Stat.send=Stat.send+floor(send)
|
||||
end
|
||||
if off>0 then
|
||||
Stat.off=Stat.off+off
|
||||
@@ -2642,9 +2642,9 @@ local function update_streaming(P)
|
||||
P:releaseKey(event-32)
|
||||
elseif event>0x2000000000000 then-- Sending lines
|
||||
local sid=event%0x100
|
||||
local amount=int(event/0x100)%0x100
|
||||
local time=int(event/0x10000)%0x10000
|
||||
local line=int(event/0x100000000)%0x10000
|
||||
local amount=floor(event/0x100)%0x100
|
||||
local time=floor(event/0x10000)%0x10000
|
||||
local line=floor(event/0x100000000)%0x10000
|
||||
for _,p in next,PLY_ALIVE do
|
||||
if p.sid==sid then
|
||||
P.netAtk=P.netAtk+amount
|
||||
@@ -2665,9 +2665,9 @@ local function update_streaming(P)
|
||||
if p.sid==sid then
|
||||
P:receive(
|
||||
p,
|
||||
int(event/0x100)%0x100,-- amount
|
||||
int(event/0x10000)%0x10000,-- time
|
||||
int(event/0x100000000)%0x10000-- line
|
||||
floor(event/0x100)%0x100,-- amount
|
||||
floor(event/0x10000)%0x10000,-- time
|
||||
floor(event/0x100000000)%0x10000-- line
|
||||
)
|
||||
break
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user