arm小程序删除答错自动清空

整理代码 框架跟进
This commit is contained in:
MrZ_26
2023-08-11 18:29:30 +08:00
parent 540099a944
commit 3fbff37095
27 changed files with 149 additions and 157 deletions

View File

@@ -1,5 +1,5 @@
-- A lantern background which is full of festive atmosphere. Lantern image by ScF -- A lantern background which is full of festive atmosphere. Lantern image by ScF
local int,rnd=math.floor,math.random local floor,rnd=math.floor,math.random
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local mDraw=mDraw local mDraw=mDraw
local back={} local back={}
@@ -41,7 +41,7 @@ function back.draw()
local img=IMG.lanterns local img=IMG.lanterns
for i=1,#lanterns do for i=1,#lanterns do
local L=lanterns[i] local L=lanterns[i]
mDraw(img[int(L.phase*6)+1],L.x,L.y,nil,L.size) mDraw(img[floor(L.phase*6)+1],L.x,L.y,nil,L.size)
end end
end end
return back return back

View File

@@ -1,5 +1,5 @@
-- Fast lightning + spining tetromino -- Fast lightning + spining tetromino
local int,rnd=math.floor,math.random local floor,rnd=math.floor,math.random
local back={} local back={}
local t local t
@@ -12,7 +12,7 @@ function back.update(dt)
t=t+dt t=t+dt
end end
function back.draw() function back.draw()
local R=7-int(t*.5%7) local R=7-floor(t*.5%7)
local T=1.2-t%15%6%1.8 local T=1.2-t%15%6%1.8
if T<.26 then GC.clear(T,T,T) if T<.26 then GC.clear(T,T,T)
else GC.clear(0,0,0) else GC.clear(0,0,0)

View File

@@ -1,4 +1,4 @@
local int=math.floor local floor=math.floor
local char,byte=string.char,string.byte local char,byte=string.char,string.byte
local ins=table.insert local ins=table.insert
@@ -120,7 +120,7 @@ function DATA.pasteBoard(str,page)-- Paste [str] data to [page] board
local id=b%32-1-- Block id local id=b%32-1-- Block id
if id>26 then return end-- Illegal blockid if id>26 then return end-- Illegal blockid
b=int(b/32)-- Mode id b=floor(b/32)-- Mode id
F[fY][fX]=id F[fY][fX]=id
if fX<10 then if fX<10 then
@@ -265,10 +265,10 @@ function DATA.dumpRecording(list,ptr)
prevFrm=list[ptr] prevFrm=list[ptr]
if t>=128 then if t>=128 then
buffer2=char(t%128) buffer2=char(t%128)
t=int(t/128) t=floor(t/128)
while t>=128 do while t>=128 do
buffer2=char(128+t%128)..buffer2 buffer2=char(128+t%128)..buffer2
t=int(t/128) t=floor(t/128)
end end
buffer=buffer..char(128+t)..buffer2 buffer=buffer..char(128+t)..buffer2
else else
@@ -279,10 +279,10 @@ function DATA.dumpRecording(list,ptr)
t=list[ptr+1] t=list[ptr+1]
if t>=128 then if t>=128 then
buffer2=char(t%128) buffer2=char(t%128)
t=int(t/128) t=floor(t/128)
while t>=128 do while t>=128 do
buffer2=char(128+t%128)..buffer2 buffer2=char(128+t%128)..buffer2
t=int(t/128) t=floor(t/128)
end end
buffer=buffer..char(128+t)..buffer2 buffer=buffer..char(128+t)..buffer2
else else

View File

@@ -5,7 +5,7 @@ local gc_setShader=GC.setShader
local gc_draw,gc_rectangle,gc_printf=GC.draw,GC.rectangle,GC.printf local gc_draw,gc_rectangle,gc_printf=GC.draw,GC.rectangle,GC.printf
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local int,rnd=math.floor,math.random local floor,rnd=math.floor,math.random
local approach=MATH.expApproach local approach=MATH.expApproach
local SETTING,GAME,SCR=SETTING,GAME,SCR local SETTING,GAME,SCR=SETTING,GAME,SCR
@@ -283,7 +283,7 @@ function royaleLevelup()
if GAME.curMode.name:find("_u") then if GAME.curMode.name:find("_u") then
for i=1,#PLY_ALIVE do for i=1,#PLY_ALIVE do
local P=PLY_ALIVE[i] local P=PLY_ALIVE[i]
P.gameEnv.drop=int(P.gameEnv.drop*.4) P.gameEnv.drop=floor(P.gameEnv.drop*.4)
if P.gameEnv.drop==0 then if P.gameEnv.drop==0 then
P.curY=P.ghoY P.curY=P.ghoY
P:set20G(true) P:set20G(true)

View File

@@ -7,7 +7,7 @@ local gc_print,gc_printf=gc.print,gc.printf
local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth
local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest 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 max,min,sin,modf=math.max,math.min,math.sin,math.modf
local setFont=FONT.set local setFont=FONT.set
local SKIN,TEXTURE,IMG=SKIN,TEXTURE,IMG local SKIN,TEXTURE,IMG=SKIN,TEXTURE,IMG
@@ -124,8 +124,8 @@ local function _applyField(P)
-- Apply shaking -- Apply shaking
if P.shakeTimer>0 then if P.shakeTimer>0 then
local dx=int(P.shakeTimer/2) local dx=floor(P.shakeTimer/2)
local dy=int(P.shakeTimer/3) 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) 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 end
@@ -172,7 +172,7 @@ end
local function _drawField(P,showInvis) local function _drawField(P,showInvis)
local ENV=P.gameEnv local ENV=P.gameEnv
local V,F=P.visTime,P.field 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 local texture=P.skinLib
if P.falling==0 then-- Blocks only if P.falling==0 then-- Blocks only
if ENV.upEdge then if ENV.upEdge then
@@ -358,9 +358,9 @@ local function _drawBlock(CB,curX,curY,texture)
end end
local function _drawNextPreview(B,fieldH,fieldBeneath) local function _drawNextPreview(B,fieldH,fieldBeneath)
gc_setColor(1,1,1,.8) 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 B=B.bk
local x=int(6-#B[1]*.5) local x=floor(6-#B[1]*.5)
local cross=TEXTURE.puzzleMark[-1] local cross=TEXTURE.puzzleMark[-1]
for i=1,#B do for j=1,#B[1] do for i=1,#B do for j=1,#B[1] do
if B[i][j] then if B[i][j] then
@@ -370,9 +370,9 @@ local function _drawNextPreview(B,fieldH,fieldBeneath)
end end
local function _drawHoldPreview(B,fieldH,fieldBeneath) local function _drawHoldPreview(B,fieldH,fieldBeneath)
gc_setColor(1,1,1,.3) 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 B=B.bk
local x=int(6-#B[1]*.5) local x=floor(6-#B[1]*.5)
local cross=TEXTURE.puzzleMark[-1] local cross=TEXTURE.puzzleMark[-1]
for i=1,#B do for j=1,#B[1] do for i=1,#B do for j=1,#B[1] do
if B[i][j] then 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) gc_translate(d^.5*(rnd()-.5)*15,d^.5*(rnd()-.5)*15)
end end
end end
gc_printf(int(sum),-300,-20,292,'right') gc_printf(floor(sum),-300,-20,292,'right')
gc_pop() gc_pop()
end end
end end
@@ -614,7 +614,7 @@ local _drawDial do
else else
gc.circle('line',x+40,y+40,37) gc.circle('line',x+40,y+40,37)
end end
setFont(30)GC.mStr(int(speed),x+40,y+19) setFont(30)GC.mStr(floor(speed),x+40,y+19)
end end
end end
local function _drawFinesseCombo_norm(P) local function _drawFinesseCombo_norm(P)
@@ -709,7 +709,7 @@ local function _drawStartCounter(time)
gc_push('transform') gc_push('transform')
gc_translate(300,300) gc_translate(300,300)
local r,g,b local r,g,b
local num=int(time/60)+1 local num=floor(time/60)+1
local d=time%60 local d=time%60
if num==3 then if num==3 then
r,g,b=.7,.8,.98 r,g,b=.7,.8,.98

View File

@@ -4,7 +4,7 @@
local Player={}-- Player class 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 max,min,abs,modf=math.max,math.min,math.abs,math.modf
local assert,ins,rem=assert,table.insert,table.remove local assert,ins,rem=assert,table.insert,table.remove
local resume,yield,status=coroutine.resume,coroutine.yield,coroutine.status local resume,yield,status=coroutine.resume,coroutine.yield,coroutine.status
@@ -42,7 +42,7 @@ function Player:_rotateField(dir)
end end
function Player:shakeField(strength)-- Range: 1~10 function Player:shakeField(strength)-- Range: 1~10
if self.gameEnv.shakeFX then 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
end end
function Player:checkTouchSound() 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 r,g,b=c[1]*2,c[2]*2,c[3]*2
local a=(power+2)*.0626 local a=(power+2)*.0626
if self.type~='human' and R.type~='human' then a=a*.2 end 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
end end
--------------------------</FX>-------------------------- --------------------------</FX>--------------------------
@@ -874,7 +874,7 @@ function Player:receive(A,send,time,line)
cd0=time, cd0=time,
time=0, time=0,
sent=false, sent=false,
lv=min(int(send^.69),5), lv=min(floor(send^.69),5),
})-- Sorted insert(by time) })-- Sorted insert(by time)
self.atkBufferSum=self.atkBufferSum+send self.atkBufferSum=self.atkBufferSum+send
self.stat.recv=self.stat.recv+send self.stat.recv=self.stat.recv+send
@@ -1127,7 +1127,7 @@ function Player:_checkMission(piece,mission)
elseif mission==9 then elseif mission==9 then
return piece.pc return piece.pc
elseif mission<90 then 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 end
return false return false
end end
@@ -1148,8 +1148,8 @@ function Player:resetBlock()-- Reset Block's position and execute I*S
local C=self.cur local C=self.cur
local sc=C.RS.centerPos[C.id][C.dir] local sc=C.RS.centerPos[C.id][C.dir]
self.curX=int(6-#C.bk[1]*.5) self.curX=floor(6-#C.bk[1]*.5)
local y=int(self.gameEnv.fieldH+1-modf(sc[1]))+ceil(self.fieldBeneath/30) local y=floor(self.gameEnv.fieldH+1-modf(sc[1]))+ceil(self.fieldBeneath/30)
self.curY=y self.curY=y
self.minY=y+sc[1] self.minY=y+sc[1]
@@ -1191,7 +1191,7 @@ end
function Player:getNextSpawn() function Player:getNextSpawn()
local cur = self.nextQueue[1] 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 end
function Player:spin(d,ifpre) function Player:spin(d,ifpre)
@@ -1275,9 +1275,9 @@ function Player:hold_norm(ifpre)
x=x+(#C.bk[1]-#H.bk[1])*.5 x=x+(#C.bk[1]-#H.bk[1])*.5
y=y+(#C.bk-#H.bk)*.5 y=y+(#C.bk-#H.bk)*.5
local iki=phyHoldKickX[x==int(x)] local iki=phyHoldKickX[x==floor(x)]
local success local success
for Y=int(y),ceil(y+.5) do for Y=floor(y),ceil(y+.5) do
for i=1,#iki do for i=1,#iki do
local X=x+iki[i] local X=x+iki[i]
if not self:ifoverlap(H.bk,X,Y) then if not self:ifoverlap(H.bk,X,Y) then
@@ -1321,7 +1321,7 @@ function Player:hold_norm(ifpre)
self:_checkSuffocate() self:_checkSuffocate()
end 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 if not ENV.infHold then
self.holdTime=self.holdTime-1 self.holdTime=self.holdTime-1
end end
@@ -1344,9 +1344,9 @@ function Player:hold_swap(ifpre)
x=x+(#C.bk[1]-#H.bk[1])*.5 x=x+(#C.bk[1]-#H.bk[1])*.5
y=y+(#C.bk-#H.bk)*.5 y=y+(#C.bk-#H.bk)*.5
local iki=phyHoldKickX[x==int(x)] local iki=phyHoldKickX[x==floor(x)]
local success local success
for Y=int(y),ceil(y+.5) do for Y=floor(y),ceil(y+.5) do
for i=1,#iki do for i=1,#iki do
local X=x+iki[i] local X=x+iki[i]
if not self:ifoverlap(H.bk,X,Y) then if not self:ifoverlap(H.bk,X,Y) then
@@ -1386,7 +1386,7 @@ function Player:hold_swap(ifpre)
self:_checkSuffocate() self:_checkSuffocate()
end 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 if not ENV.infHold then
self.holdTime=self.holdTime-1 self.holdTime=self.holdTime-1
end end
@@ -1847,7 +1847,7 @@ do
self:showText(text.clear[cc],0,-30,35,'appear',(8-cc)*.3) self:showText(text.clear[cc],0,-30,35,'appear',(8-cc)*.3)
yomi = text.clear[cc]..yomi yomi = text.clear[cc]..yomi
atk=cc-.5 atk=cc-.5
sendTime=20+int(atk*20) sendTime=20+floor(atk*20)
cscore=cscore+clearSCR[cc] cscore=cscore+clearSCR[cc]
piece.special=false piece.special=false
end end
@@ -1925,10 +1925,10 @@ do
end end
-- Send Lines -- Send Lines
atk=int(atk*(1+self.strength*.25))-- Badge Buff atk=floor(atk*(1+self.strength*.25))-- Badge Buff
send=atk send=atk
if exblock>0 then 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') self:showText("+"..exblock,0,53,20,'fly')
off=off+self:cancel(exblock) off=off+self:cancel(exblock)
end end
@@ -2017,7 +2017,7 @@ do
cscore=cscore*(.9+self.dropSpeed/600) cscore=cscore*(.9+self.dropSpeed/600)
end end
cscore=int(cscore) cscore=floor(cscore)
self:popScore(cscore) self:popScore(cscore)
piece.row,piece.dig=cc,gbcc piece.row,piece.dig=cc,gbcc
@@ -2049,7 +2049,7 @@ do
-- Prevent sudden death if hang>0 -- Prevent sudden death if hang>0
if ENV.hang>ENV.wait and self.nextQueue[1] then if ENV.hang>ENV.wait and self.nextQueue[1] then
local B=self.nextQueue[1] 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 self.waiting=self.waiting+ENV.hang
end end
end end
@@ -2075,7 +2075,7 @@ do
if atk>0 then if atk>0 then
Stat.atk=Stat.atk+atk Stat.atk=Stat.atk+atk
if send>0 then if send>0 then
Stat.send=Stat.send+int(send) Stat.send=Stat.send+floor(send)
end end
if off>0 then if off>0 then
Stat.off=Stat.off+off Stat.off=Stat.off+off
@@ -2642,9 +2642,9 @@ local function update_streaming(P)
P:releaseKey(event-32) P:releaseKey(event-32)
elseif event>0x2000000000000 then-- Sending lines elseif event>0x2000000000000 then-- Sending lines
local sid=event%0x100 local sid=event%0x100
local amount=int(event/0x100)%0x100 local amount=floor(event/0x100)%0x100
local time=int(event/0x10000)%0x10000 local time=floor(event/0x10000)%0x10000
local line=int(event/0x100000000)%0x10000 local line=floor(event/0x100000000)%0x10000
for _,p in next,PLY_ALIVE do for _,p in next,PLY_ALIVE do
if p.sid==sid then if p.sid==sid then
P.netAtk=P.netAtk+amount P.netAtk=P.netAtk+amount
@@ -2665,9 +2665,9 @@ local function update_streaming(P)
if p.sid==sid then if p.sid==sid then
P:receive( P:receive(
p, p,
int(event/0x100)%0x100,-- amount floor(event/0x100)%0x100,-- amount
int(event/0x10000)%0x10000,-- time floor(event/0x10000)%0x10000,-- time
int(event/0x100000000)%0x10000-- line floor(event/0x100000000)%0x10000-- line
) )
break break
end end

View File

@@ -1,6 +1,6 @@
local gc=love.graphics local gc=love.graphics
local int,rnd=math.floor,math.random local floor,rnd=math.floor,math.random
local scene={} local scene={}
@@ -81,7 +81,7 @@ local function tapBoard(x,y,key)
if pathVis then if pathVis then
SYSFX.newShade(6,x-5,y-5,11,11,1,1,1) SYSFX.newShade(6,x-5,y-5,11,11,1,1,1)
end end
x,y=int((x-320)/160)+1,int((y-40)/160)+1 x,y=floor((x-320)/160)+1,floor((y-40)/160)+1
end end
local b=board local b=board
local moves=0 local moves=0

View File

@@ -1,7 +1,7 @@
local gc,kb=love.graphics,love.keyboard local gc,kb=love.graphics,love.keyboard
local setColor,rectangle=gc.setColor,gc.rectangle local setColor,rectangle=gc.setColor,gc.rectangle
local int,abs=math.floor,math.abs local floor,abs=math.floor,math.abs
local rnd,min=math.random,math.min local rnd,min=math.random,math.min
local ins=table.insert local ins=table.insert
local setFont=FONT.set local setFont=FONT.set
@@ -400,7 +400,7 @@ function scene.draw()
-- Board -- Board
for i=1,16 do for i=1,16 do
if board[i] then if board[i] then
local x,y=1+(i-1)%4,int((i+3)/4) local x,y=1+(i-1)%4,floor((i+3)/4)
local N=board[i] local N=board[i]
if i~=prevPos or prevSpawnTime==1 then if i~=prevPos or prevSpawnTime==1 then
if not invis or i==prevPos then if not invis or i==prevPos then
@@ -460,7 +460,7 @@ function scene.draw()
end end
-- New tile position -- New tile position
local x,y=1+(prevPos-1)%4,int((prevPos+3)/4) local x,y=1+(prevPos-1)%4,floor((prevPos+3)/4)
gc.setLineWidth(8) gc.setLineWidth(8)
setColor(.2,.8,0,prevSpawnTime) setColor(.2,.8,0,prevSpawnTime)
local d=25-prevSpawnTime*25 local d=25-prevSpawnTime*25

View File

@@ -1,5 +1,5 @@
local gc=love.graphics local gc=love.graphics
local int=math.floor local floor=math.floor
local lines={ local lines={
{1,2,3}, {1,2,3},
@@ -103,8 +103,8 @@ function scene.enter()
end end
function scene.mouseMove(x,y) function scene.mouseMove(x,y)
x,y=int((x-280)/80),int(y/80) x,y=floor((x-280)/80),floor(y/80)
curX,curx=int(x/3)+int(y/3)*3+1,x%3+y%3*3+1 curX,curx=floor(x/3)+floor(y/3)*3+1,x%3+y%3*3+1
if if
x<0 or x>8 or x<0 or x>8 or
y<0 or y>8 or y<0 or y>8 or
@@ -143,7 +143,7 @@ function scene.draw()
-- Draw target area -- Draw target area
gc.setColor(1,1,1,math.sin((TIME()-placeTime)*5)*.1+.15) gc.setColor(1,1,1,math.sin((TIME()-placeTime)*5)*.1+.15)
if target then if target then
gc.rectangle('fill',(target-1)%3*30,int((target-1)/3)*30,30,30) gc.rectangle('fill',(target-1)%3*30,floor((target-1)/3)*30,30,30)
elseif not gameover then elseif not gameover then
gc.rectangle('fill',0,0,90,90) gc.rectangle('fill',0,0,90,90)
end end
@@ -151,7 +151,7 @@ function scene.draw()
-- Draw cursor -- Draw cursor
if curX then if curX then
gc.setColor(1,1,1,.3) gc.setColor(1,1,1,.3)
gc.rectangle('fill',(curX-1)%3*30+(curx-1)%3*10-.5,int((curX-1)/3)*30+int((curx-1)/3)*10-.5,11,11) gc.rectangle('fill',(curX-1)%3*30+(curx-1)%3*10-.5,floor((curX-1)/3)*30+floor((curx-1)/3)*10-.5,11,11)
end end
gc.setLineWidth(.8) gc.setLineWidth(.8)
@@ -164,13 +164,13 @@ function scene.draw()
else else
gc.setColor(COLOR.D) gc.setColor(COLOR.D)
end end
gc.rectangle('fill',(X-1)%3*30,int((X-1)/3)*30,30,30) gc.rectangle('fill',(X-1)%3*30,floor((X-1)/3)*30,30,30)
end end
for x=1,9 do for x=1,9 do
local c=board[X][x] local c=board[X][x]
if c then if c then
local _x=(X-1)%3*30+(x-1)%3*10 local _x=(X-1)%3*30+(x-1)%3*10
local _y=int((X-1)/3)*30+int((x-1)/3)*10 local _y=floor((X-1)/3)*30+floor((x-1)/3)*10
if c==0 then if c==0 then
gc.setColor(1,.2,.2) gc.setColor(1,.2,.2)
gc.rectangle('line',_x+2.25,_y+2.25,5.5,5.5) gc.rectangle('line',_x+2.25,_y+2.25,5.5,5.5)
@@ -195,7 +195,7 @@ function scene.draw()
if lastX then if lastX then
gc.setColor(.5,1,.4,.8) gc.setColor(.5,1,.4,.8)
local r=.5+.5*math.sin(TIME()*6.26) local r=.5+.5*math.sin(TIME()*6.26)
gc.rectangle('line',(lastX-1)%3*30+(lastx-1)%3*10-r,int((lastX-1)/3)*30+int((lastx-1)/3)*10-r,10+2*r,10+2*r) gc.rectangle('line',(lastX-1)%3*30+(lastx-1)%3*10-r,floor((lastX-1)/3)*30+floor((lastx-1)/3)*10-r,10+2*r,10+2*r)
end end
gc.pop() gc.pop()

View File

@@ -1,6 +1,6 @@
local gc=love.graphics local gc=love.graphics
local rnd=math.random local rnd=math.random
local int,ceil=math.floor,math.ceil local floor,ceil=math.floor,math.ceil
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local timing,time local timing,time
@@ -10,22 +10,22 @@ local function b8(i) return STRING.toOct(i).."₈" end
local function b16(i) return STRING.toHex(i).."₁₆" end local function b16(i) return STRING.toHex(i).."₁₆" end
local charData={ local charData={
["0"]={5,40, 15,40,20,35,20,5, 15,0, 5,0, 0,5, 0,35, 5,40}, ["0"]={5,40,15,40,20,35,20,5,15,0,5,0,0,5,0,35,5,40},
["1"]={2,8, 10,0, 10,40, 2,40, 1,40, 2,40, 18,40}, ["1"]={2,8,10,0,10,40,2,40,1,40,2,40,18,40},
["2"]={0,5, 5,0, 15,0, 20,5, 20,20,0,39, 0,40, 25,40}, ["2"]={0,5,5,0,15,0,20,5,20,20,0,39,0,40,25,40},
["3"]={0,5, 5,0, 15,0, 20,5, 20,15,15,20,5,20, 4,20, 5,20, 15,20,20,25,20,35,15,40,5,40,0,35}, ["3"]={0,5,5,0,15,0,20,5,20,15,15,20,5,20,4,20,5,20,15,20,20,25,20,35,15,40,5,40,0,35},
["4"]={20,20,0,20, 13,0, 13,40}, ["4"]={20,20,0,20,13,0,13,40},
["5"]={20,0, 0,0, 0,20, 5,15, 15,15,20,20,20,35,15,40,5,40, 0,35}, ["5"]={20,0,0,0,0,20,5,15,15,15,20,20,20,35,15,40,5,40,0,35},
["6"]={20,5, 15,0, 5,0, 0,5, 0,35, 5,40, 15,40,20,35,20,20,15,15,5,15, 0,20}, ["6"]={20,5,15,0,5,0,0,5,0,35,5,40,15,40,20,35,20,20,15,15,5,15,0,20},
["7"]={0,0, 20,0, 5,40}, ["7"]={0,0,20,0,5,40},
["8"]={5,0, 15,0, 20,5, 20,15,15,20,5,20, 0,25, 0,35, 5,40, 15,40,20,35,20,25,15,20,5,20,0,15,0,5,5,0}, ["8"]={5,0,15,0,20,5,20,15,15,20,5,20,0,25,0,35,5,40,15,40,20,35,20,25,15,20,5,20,0,15,0,5,5,0},
["9"]={20,15,15,20,5,20, 0,15, 0,5, 5,0, 15,0, 20,5, 20,35,15,40,5,40, 0,35}, ["9"]={20,15,15,20,5,20,0,15,0,5,5,0,15,0,20,5,20,35,15,40,5,40,0,35},
A={0,40, 10,0, 20,40,0,0, 20,40,15,20,5,20}, ["A"]={0,40,10,0,20,40,0,0,20,40,15,20,5,20},
B={0,40, 0,0, 15,0, 20,5, 20,15,15,20,0,20, -1,20,0,20, 15,20,20,25,20,35,15,40,0,40}, ["B"]={0,40,0,0,15,0,20,5,20,15,15,20,0,20,-1,20,0,20,15,20,20,25,20,35,15,40,0,40},
C={20,35,15,40,5,40, 0,35, 0,5, 5,0, 15,0, 20,5}, ["C"]={20,35,15,40,5,40,0,35,0,5,5,0,15,0,20,5},
D={0,40, 0,0, 10,0, 20,10,20,30,10,40,0,40}, ["D"]={0,40,0,0,10,0,20,10,20,30,10,40,0,40},
E={20,0, 0,0, 0,20, 15,20,20,20,0,20, 0,40,20,40}, ["E"]={20,0,0,0,0,20,15,20,20,20,0,20,0,40,20,40},
F={20,0, 0,0, 0,20, 15,20,20,20,0,20, 0,40} ["F"]={20,0,0,0,0,20,15,20,20,20,0,20,0,40}
} }
local drawing local drawing
local drawLines,drawVel,indexes local drawLines,drawVel,indexes
@@ -66,7 +66,7 @@ local levels={
end,nil,nil, end,nil,nil,
function()-- 4~6 <+> [,20] function()-- 4~6 <+> [,20]
local s=rnd(10,18) local s=rnd(10,18)
local a=rnd(s-9,int(s/2)) local a=rnd(s-9,floor(s/2))
return a.."+"..s-a,s,function() return a.."+"..s-a,s,function()
drawChar(a,600,200) drawChar(a,600,200)
drawChar(s-a,600,350) drawChar(s-a,600,350)
@@ -77,7 +77,7 @@ local levels={
end,nil,nil, end,nil,nil,
function()-- 7~9 <+> [,100] function()-- 7~9 <+> [,100]
local s=rnd(22,99) local s=rnd(22,99)
local a=rnd(11,int(s/2)) local a=rnd(11,floor(s/2))
return a.."+"..s-a,s,function() return a.."+"..s-a,s,function()
drawChar(a,600,200) drawChar(a,600,200)
drawChar(s-a,600,350) drawChar(s-a,600,350)
@@ -98,7 +98,7 @@ local levels={
end,nil,nil, end,nil,nil,
function()-- 13~15 <-> [,100] function()-- 13~15 <-> [,100]
local s=rnd(22,99) local s=rnd(22,99)
local a=rnd(11,int(s/2)) local a=rnd(11,floor(s/2))
return s.."-"..a,s-a,function() return s.."-"..a,s-a,function()
drawChar(s,600,200) drawChar(s,600,200)
drawChar(a,600,350) drawChar(a,600,350)
@@ -122,7 +122,7 @@ local levels={
function()-- 21~25 <*> [,100] function()-- 21~25 <*> [,100]
local b=rnd(21,89) local b=rnd(21,89)
local a=rnd(ceil(b/10),9) local a=rnd(ceil(b/10),9)
b=int(b/a) b=floor(b/a)
return a.."*"..b,a*b,function() return a.."*"..b,a*b,function()
drawChar(a>b and a or b,600,200) drawChar(a>b and a or b,600,200)
drawChar(a>b and b or a,600,350) drawChar(a>b and b or a,600,350)
@@ -144,7 +144,7 @@ local levels={
function()-- 29~33 </> [,100] function()-- 29~33 </> [,100]
local b=rnd(21,89) local b=rnd(21,89)
local a=rnd(ceil(b/10),9) local a=rnd(ceil(b/10),9)
b=int(b/a) b=floor(b/a)
return a*b.."/"..a,b,function() return a*b.."/"..a,b,function()
drawChar(a*b,560,300,1,true) drawChar(a*b,560,300,1,true)
drawChar(a,400,300) drawChar(a,400,300)
@@ -172,7 +172,7 @@ local levels={
local a=rnd(2,9) local a=rnd(2,9)
return {COLOR.N,b2(a)},a,function() return {COLOR.N,b2(a)},a,function()
local b=STRING.toBin(a) local b=STRING.toBin(a)
local l=math.floor(math.log(a,2)+1) local l=floor(math.log(a,2)+1)
for i=1,l do for i=1,l do
drawChar(tonumber(string.sub(b,i,i)),320,420-100*(l-i),.5) drawChar(tonumber(string.sub(b,i,i)),320,420-100*(l-i),.5)
ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)}) ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)})
@@ -191,7 +191,7 @@ local levels={
local a=rnd(9,63) local a=rnd(9,63)
return {COLOR.lR,b8(a)},a,function() return {COLOR.lR,b8(a)},a,function()
local b=STRING.toOct(a) local b=STRING.toOct(a)
local l=math.floor(math.log(a,8)+1) local l=floor(math.log(a,8)+1)
for i=1,l do for i=1,l do
drawChar(tonumber(string.sub(b,i,i)),320,420-100*(l-i),.5) drawChar(tonumber(string.sub(b,i,i)),320,420-100*(l-i),.5)
ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)}) ins(drawLines,{370,480-100*(l-i),410,440-100*(l-i)})
@@ -210,7 +210,7 @@ local levels={
local a=rnd(17,255) local a=rnd(17,255)
return {COLOR.J,b16(a)},a,function() return {COLOR.J,b16(a)},a,function()
local b=STRING.toHex(a) local b=STRING.toHex(a)
local l=math.floor(math.log(a,16)+1) local l=floor(math.log(a,16)+1)
for i=1,l do for i=1,l do
local c=string.sub(b,i,i) local c=string.sub(b,i,i)
if ("0123456789"):find(c,nil,true) then if ("0123456789"):find(c,nil,true) then
@@ -233,14 +233,14 @@ local levels={
end,nil,nil, end,nil,nil,
function()-- 54~58 <b+> function()-- 54~58 <b+>
local s=rnd(9,31) local s=rnd(9,31)
local a=rnd(5,int(s/2)) local a=rnd(5,floor(s/2))
return {COLOR.N,b2(a),COLOR.Z,"+",COLOR.N,b2(s-a)},s,function() return {COLOR.N,b2(a),COLOR.Z,"+",COLOR.N,b2(s-a)},s,function()
drawChar(tonumber(STRING.toBin(a)),220,200,.6) drawChar(tonumber(STRING.toBin(a)),220,200,.6)
drawChar(tonumber(STRING.toBin(s-a)),220,335,.6) drawChar(tonumber(STRING.toBin(s-a)),220,335,.6)
ins(drawLines,{0,470,300,470}) ins(drawLines,{0,470,300,470})
ins(drawLines,{320,470,400,470}) ins(drawLines,{320,470,400,470})
ins(drawLines,{360,430,360,510}) ins(drawLines,{360,430,360,510})
local l=math.floor(math.log(s,2)+1) local l=floor(math.log(s,2)+1)
for i=1,l do for i=1,l do
ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)}) ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)})
ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)}) ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)})
@@ -256,14 +256,14 @@ local levels={
end,nil,nil,nil,nil, end,nil,nil,nil,nil,
function()-- 59~62 <o+> function()-- 59~62 <o+>
local s=rnd(18,63) local s=rnd(18,63)
local a=rnd(9,int(s/2)) local a=rnd(9,floor(s/2))
return {COLOR.lR,b8(a),COLOR.Z,"+",COLOR.lR,b8(s-a)},s,function() return {COLOR.lR,b8(a),COLOR.Z,"+",COLOR.lR,b8(s-a)},s,function()
drawChar(tonumber(STRING.toOct(a)),220,200,.6) drawChar(tonumber(STRING.toOct(a)),220,200,.6)
drawChar(tonumber(STRING.toOct(s-a)),220,335,.6) drawChar(tonumber(STRING.toOct(s-a)),220,335,.6)
ins(drawLines,{0,470,300,470}) ins(drawLines,{0,470,300,470})
ins(drawLines,{320,470,400,470}) ins(drawLines,{320,470,400,470})
ins(drawLines,{360,430,360,510}) ins(drawLines,{360,430,360,510})
local l=math.floor(math.log(s,8)+1) local l=floor(math.log(s,8)+1)
for i=1,l do for i=1,l do
ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)}) ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)})
ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)}) ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)})
@@ -279,14 +279,14 @@ local levels={
end,nil,nil,nil, end,nil,nil,nil,
function()-- 63~65 <h+> function()-- 63~65 <h+>
local s=rnd(34,255) local s=rnd(34,255)
local a=rnd(17,int(s/2)) local a=rnd(17,floor(s/2))
return {COLOR.J,b16(a),COLOR.Z,"+",COLOR.J,b16(s-a)},s,function() return {COLOR.J,b16(a),COLOR.Z,"+",COLOR.J,b16(s-a)},s,function()
drawChar(tonumber(STRING.toHex(a)),220,200,.6) drawChar(tonumber(STRING.toHex(a)),220,200,.6)
drawChar(tonumber(STRING.toHex(s-a)),220,335,.6) drawChar(tonumber(STRING.toHex(s-a)),220,335,.6)
ins(drawLines,{0,470,300,470}) ins(drawLines,{0,470,300,470})
ins(drawLines,{320,470,400,470}) ins(drawLines,{320,470,400,470})
ins(drawLines,{360,430,360,510}) ins(drawLines,{360,430,360,510})
local l=math.floor(math.log(s,16)+1) local l=floor(math.log(s,16)+1)
for i=1,l do for i=1,l do
ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)}) ins(drawLines,{620,580-100*(l-i),660,540-100*(l-i)})
ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)}) ins(drawLines,{620,540-100*(l-i),660,580-100*(l-i)})
@@ -346,27 +346,11 @@ local function check(val)
until newQ~=question until newQ~=question
question=newQ question=newQ
SFX.play('reach') SFX.play('reach')
else
if #tostring(val)==#tostring(answer) then
SFX.play('finesseError_long')
input=""
inputTime=0
end
end end
end end
local function isDrawing() return drawing end -- for hiding widgets local function isDrawing() return drawing end -- for hiding widgets
local function isntDrawing() return not drawing end local function isntDrawing() return not drawing end
local function drawDrawing()
gc.setLineWidth(10)
-- gc.setLineWidth(drawVel[i][(j+1)/2]) (couldn't implement without weird looking disjointed lines)
gc.setLineJoin('bevel')
for i=1,#drawLines do
if #drawLines[i]>=4 then
gc.line(drawLines[i])
end
end
end
local scene={} local scene={}
@@ -493,7 +477,15 @@ function scene.update(dt)
end end
function scene.draw() function scene.draw()
gc.setColor(drawing and COLOR.Z or COLOR.H) gc.setColor(drawing and COLOR.Z or COLOR.H)
drawDrawing() gc.setLineWidth(10)
-- gc.setLineWidth(drawVel[i][(j+1)/2]) (couldn't implement without weird looking disjointed lines)
gc.setLineJoin('bevel')
for i=1,#drawLines do
if #drawLines[i]>=4 then
gc.line(drawLines[i])
end
end
gc.setColor(COLOR.Z) gc.setColor(COLOR.Z)
if not drawing then if not drawing then
FONT.set(45) FONT.set(45)

View File

@@ -1,5 +1,5 @@
local gc=love.graphics local gc=love.graphics
local int,rnd,abs,sin,cos=math.floor,math.random,math.abs,math.sin,math.cos local floor,rnd,abs,sin,cos=math.floor,math.random,math.abs,math.sin,math.cos
local pow,ang local pow,ang
local state,timer,score,combo local state,timer,score,combo
@@ -61,7 +61,7 @@ function scene.update()
end end
if x>1280 or y>720 then if x>1280 or y>720 then
if score>0 then if score>0 then
score=score-int(score/10) score=score-floor(score/10)
end end
SFX.play('finesseError') SFX.play('finesseError')
combo=0 combo=0
@@ -110,7 +110,7 @@ function scene.draw()
gc.setColor(1,1,.6) gc.setColor(1,1,.6)
gc.print("x"..combo,300,80) gc.print("x"..combo,300,80)
end end
gc.setColor(COLOR[scoreColor[int(score/20)+1] or 'D']) gc.setColor(COLOR[scoreColor[floor(score/20)+1] or 'D'])
gc.print(score,300,30) gc.print(score,300,30)
-- Cannon ball -- Cannon ball

View File

@@ -1,5 +1,5 @@
local gc,kb,tc=love.graphics,love.keyboard,love.touch local gc,kb,tc=love.graphics,love.keyboard,love.touch
local rnd,int,abs=math.random,math.floor,math.abs local rnd,floor,abs=math.random,math.floor,math.abs
local max,min=math.max,math.min local max,min=math.max,math.min
local setFont,mStr=FONT.set,GC.mStr local setFont,mStr=FONT.set,GC.mStr
@@ -36,7 +36,7 @@ local function hurt(i)
menu,play=1,false menu,play=1,false
speed=speed*.5 speed=speed*.5
moveDir=0 moveDir=0
score=int(score) score=floor(score)
SFX.play('clear_4') SFX.play('clear_4')
else else
SFX.play('clear_2') SFX.play('clear_2')
@@ -206,7 +206,7 @@ function scene.update(dt)
local t=love.system.getClipboardText() local t=love.system.getClipboardText()
if type(t)=='string' then if type(t)=='string' then
t=t:lower():match("^s=(%d+)$") t=t:lower():match("^s=(%d+)$")
t=t and tonumber(t) and tonumber(t)>0 and tonumber(t)<=8000 and int(tonumber(t)) t=t and tonumber(t) and tonumber(t)>0 and tonumber(t)<=8000 and floor(tonumber(t))
end end
score=type(t)=='number' and t or 0 score=type(t)=='number' and t or 0
life=1000 life=1000
@@ -276,8 +276,8 @@ function scene.draw()
-- Draw menu -- Draw menu
if play then if play then
setFont(60) setFont(60)
mStr(int(score),-300,-640) mStr(floor(score),-300,-640)
mStr(int(score),300,-640) mStr(floor(score),300,-640)
if score%1000>920 then if score%1000>920 then
gc.setColor(1,1,1,abs(score%1000-970)*8) gc.setColor(1,1,1,abs(score%1000-970)*8)
setFont(70) setFont(70)

View File

@@ -1,5 +1,5 @@
local gc=love.graphics local gc=love.graphics
local rnd,int,max=math.random,math.floor,math.max local rnd,floor,max=math.random,math.floor,math.max
local setFont,mStr=FONT.set,GC.mStr local setFont,mStr=FONT.set,GC.mStr
-- This mini-game is written for TI-nSpire CX CAS many years ago. -- This mini-game is written for TI-nSpire CX CAS many years ago.
@@ -176,7 +176,7 @@ end
setmetatable(backColor,backColor) setmetatable(backColor,backColor)
function scene.draw() function scene.draw()
-- Background -- Background
local lv,height=int(camY/700),camY%700 local lv,height=floor(camY/700),camY%700
gc.setColor(backColor[lv+1] or COLOR.D) gc.setColor(backColor[lv+1] or COLOR.D)
gc.rectangle('fill',0,720,1280,height-700) gc.rectangle('fill',0,720,1280,height-700)
gc.setColor(backColor[lv+2] or COLOR.D) gc.setColor(backColor[lv+2] or COLOR.D)

View File

@@ -1,7 +1,7 @@
local gc=love.graphics local gc=love.graphics
local setFont,mStr=FONT.set,GC.mStr local setFont,mStr=FONT.set,GC.mStr
local int,rnd=math.floor,math.random local floor,rnd=math.floor,math.random
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local targets={ local targets={
@@ -274,7 +274,7 @@ function scene.mouseDown(x)
end end
function scene.touchDown(x) function scene.touchDown(x)
if state==2 then return end if state==2 then return end
x=int((x-300)/170+1) x=floor((x-300)/170+1)
if x>=1 and x<=4 then if x>=1 and x<=4 then
touch(x) touch(x)
end end

View File

@@ -4,7 +4,7 @@ local gc=love.graphics
local gc_setColor,gc_rectangle,gc_draw=gc.setColor,gc.rectangle,gc.draw local gc_setColor,gc_rectangle,gc_draw=gc.setColor,gc.rectangle,gc.draw
local setFont,mStr=FONT.set,GC.mStr local setFont,mStr=FONT.set,GC.mStr
local int,rnd,abs=math.floor,math.random,math.abs local floor,rnd,abs=math.floor,math.random,math.abs
local max,min=math.max,math.min local max,min=math.max,math.min
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
@@ -73,7 +73,7 @@ local function resetBoard()
field.c,field.r=levels[level].c,levels[level].r field.c,field.r=levels[level].c,levels[level].r
local total=field.r*field.c/2-- Total cell count local total=field.r*field.c/2-- Total cell count
local pool=TABLE.new(int(total/colors),colors) local pool=TABLE.new(floor(total/colors),colors)
for i=1,total%colors do pool[i]=pool[i]+1 end for i=1,total%colors do pool[i]=pool[i]+1 end
for i=1,#pool do pool[i]=pool[i]*2 end for i=1,#pool do pool[i]=pool[i]*2 end
field.remain=total field.remain=total
@@ -186,7 +186,7 @@ local function tap(x,y)
field.full=false field.full=false
-- Score -- Score
local s=1000+int(combo^.9) local s=1000+floor(combo^.9)
score=score+s score=score+s
TEXT.show("+"..s,1205,600,20,'score') TEXT.show("+"..s,1205,600,20,'score')
@@ -206,7 +206,7 @@ local function tap(x,y)
SFX.play('clear_4') SFX.play('clear_4')
TEXT.show("FULL COMBO",640,360,100,'beat',.626) TEXT.show("FULL COMBO",640,360,100,'beat',.626)
comboTime=comboTime+3 comboTime=comboTime+3
score=int(score*1.1) score=floor(score*1.1)
end end
ins(progress, ins(progress,
noComboBreak and noComboBreak and
@@ -270,8 +270,8 @@ function scene.keyDown(key,isRep)
end end
end end
local function touch(x,y) local function touch(x,y)
x=int((x-field.x)/field.w*field.c+1) x=floor((x-field.x)/field.w*field.c+1)
y=int((y-field.y)/field.h*field.r+1) y=floor((y-field.y)/field.h*field.r+1)
tap(x,y) tap(x,y)
end end
function scene.mouseDown(x,y,k) if k==1 or k==2 or not k then touch(x,y) end end function scene.mouseDown(x,y,k) if k==1 or k==2 or not k then touch(x,y) end end
@@ -283,7 +283,7 @@ function scene.update(dt)
if state==1 then if state==1 then
time=TIME()-startTime time=TIME()-startTime
comboTime=max(comboTime-dt,0) comboTime=max(comboTime-dt,0)
score1=score1+MATH.sign(score-score1)+int((score-score1)*.1+.5) score1=score1+MATH.sign(score-score1)+floor((score-score1)*.1+.5)
end end
for i=#lines,1,-1 do for i=#lines,1,-1 do

View File

@@ -1,5 +1,5 @@
local gc,ms=love.graphics,love.mouse local gc,ms=love.graphics,love.mouse
local int,rnd=math.floor,math.random local floor,rnd=math.floor,math.random
local rem=table.remove local rem=table.remove
local setFont,mStr=FONT.set,GC.mStr local setFont,mStr=FONT.set,GC.mStr
@@ -45,8 +45,8 @@ local function tapBoard(x,y)
startTime=TIME() startTime=TIME()
progress=0 progress=0
elseif state==1 then elseif state==1 then
local X=int((x-320)/640*R) local X=floor((x-320)/640*R)
local Y=int((y-40)/640*R) local Y=floor((y-40)/640*R)
x=R*Y+X+1 x=R*Y+X+1
if board[x]==progress+1 then if board[x]==progress+1 then
progress=progress+1 progress=progress+1

View File

@@ -2,7 +2,7 @@ local gc=love.graphics
local msIsDown,kbIsDown,tcTouches=love.mouse.isDown,love.keyboard.isDown,love.touch.getTouches local msIsDown,kbIsDown,tcTouches=love.mouse.isDown,love.keyboard.isDown,love.touch.getTouches
local setColor,rectangle=gc.setColor,gc.rectangle local setColor,rectangle=gc.setColor,gc.rectangle
local int,rnd=math.floor,math.random local floor,rnd=math.floor,math.random
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local setFont,mStr=FONT.set,GC.mStr local setFont,mStr=FONT.set,GC.mStr
@@ -90,7 +90,7 @@ local function merge()
until not connected[1] until not connected[1]
if count>1 then if count>1 then
board[cy][cx]=chosen+1 board[cy][cx]=chosen+1
local getScore=3^(chosen-1)*math.min(int(.5+count/2),4) local getScore=3^(chosen-1)*math.min(floor(.5+count/2),4)
score=score+getScore score=score+getScore
TEXT.show(getScore,cx*128+256,cy*128-40,40,'score') TEXT.show(getScore,cx*128+256,cy*128-40,40,'score')
SYSFX.newRectRipple(2,320+cx*128-128,40+cy*128-128,128,128) SYSFX.newRectRipple(2,320+cx*128-128,40+cy*128-128,128,128)
@@ -163,7 +163,7 @@ function scene.keyDown(key,isRep)
end end
end end
function scene.mouseMove(x,y) function scene.mouseMove(x,y)
cx,cy=int((x-192)/128),int((y+88)/128) cx,cy=floor((x-192)/128),floor((y+88)/128)
if cx<1 or cx>5 or cy<1 or cy>5 then if cx<1 or cx>5 or cy<1 or cy>5 then
cx,cy=false cx,cy=false
end end

View File

@@ -1,7 +1,7 @@
local gc=love.graphics local gc=love.graphics
local setColor,rectangle=gc.setColor,gc.rectangle local setColor,rectangle=gc.setColor,gc.rectangle
local int,rnd=math.floor,math.random local floor,rnd=math.floor,math.random
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local setFont,mStr=FONT.set,GC.mStr local setFont,mStr=FONT.set,GC.mStr
@@ -270,7 +270,7 @@ function scene.enter()
end end
function scene.mouseClick(x,y) function scene.mouseClick(x,y)
x,y=int((x-player.x)/100)+1,int((y-player.y)/100)+1 x,y=floor((x-player.x)/100)+1,floor((y-player.y)/100)+1
if x>=1 and x<=6 and y>=1 and y<=6 then if x>=1 and x<=6 and y>=1 and y<=6 then
player:click(y,x) player:click(y,x)
end end

View File

@@ -1,5 +1,5 @@
local gc,kb,sys=love.graphics,love.keyboard,love.system local gc,kb,sys=love.graphics,love.keyboard,love.system
local int=math.floor local floor=math.floor
local CUSTOMENV=CUSTOMENV local CUSTOMENV=CUSTOMENV
local sList={ local sList={
@@ -132,7 +132,7 @@ function scene.draw()
-- Sequence -- Sequence
if #MISSION>0 then if #MISSION>0 then
gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,int(TIME()*6.26)%2) gc.setColor(1,CUSTOMENV.missionKill and 0 or 1,floor(TIME()*6.26)%2)
gc.print("#"..#MISSION,70,220) gc.print("#"..#MISSION,70,220)
end end
@@ -157,14 +157,14 @@ function scene.draw()
end end end end
gc.pop() gc.pop()
if #FIELD>1 then if #FIELD>1 then
gc.setColor(1,1,int(TIME()*6.26)%2) gc.setColor(1,1,floor(TIME()*6.26)%2)
gc.print("+"..#FIELD-1,490,220) gc.print("+"..#FIELD-1,490,220)
end end
end end
-- Sequence -- Sequence
if #BAG>0 then if #BAG>0 then
gc.setColor(1,1,int(TIME()*6.26)%2) gc.setColor(1,1,floor(TIME()*6.26)%2)
gc.print("#"..#BAG,615,220) gc.print("#"..#BAG,615,220)
end end

View File

@@ -1,7 +1,7 @@
local gc,sys=love.graphics,love.system local gc,sys=love.graphics,love.system
local kb=love.keyboard local kb=love.keyboard
local max,min,int=math.max,math.min,math.floor local max,min,floor=math.max,math.min,math.floor
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local FIELD=FIELD local FIELD=FIELD
@@ -129,7 +129,7 @@ function scene.leave()
end end
function scene.mouseMove(x,y) function scene.mouseMove(x,y)
local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) local sx,sy=floor((x-200)/30)+1,20-floor((y-60)/30)
if sx>=1 and sx<=10 and sy>=1 and sy<=20 then if sx>=1 and sx<=10 and sy>=1 and sy<=20 then
penX,penY=sx,sy penX,penY=sx,sy
if curPen then if curPen then
@@ -434,7 +434,7 @@ function scene.draw()
gc.setColor(1,1,1) gc.setColor(1,1,1)
for i=1,7 do for i=1,7 do
local skin=SETTING.skin[i]-1 local skin=SETTING.skin[i]-1
GC.mStr(text.block[i],580+(skin%8)*80,90+80*int(skin/8)) GC.mStr(text.block[i],580+(skin%8)*80,90+80*floor(skin/8))
end end
end end

View File

@@ -1,7 +1,7 @@
local gc,sys=love.graphics,love.system local gc,sys=love.graphics,love.system
local kb=love.keyboard local kb=love.keyboard
local int,sin=math.floor,math.sin local floor,sin=math.floor,math.sin
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local scene={} local scene={}
@@ -151,7 +151,7 @@ function scene.draw()
end end
if i<=j then if i<=j then
setFont(35) setFont(35)
local N=int(L[i]*.1) local N=floor(L[i]*.1)
if N>0 then if N>0 then
gc.setColor(libColor[set[N]]) gc.setColor(libColor[set[N]])
elseif L[i]>4 then elseif L[i]>4 then

View File

@@ -1,6 +1,6 @@
local gc=love.graphics local gc=love.graphics
local int,abs=math.floor,math.abs local floor,abs=math.floor,math.abs
local ins=table.insert local ins=table.insert
local find=string.find local find=string.find
@@ -287,7 +287,7 @@ function scene.draw()
if searchWait>0 then if searchWait>0 then
local r=TIME()*2 local r=TIME()*2
local R=int(r)%7+1 local R=floor(r)%7+1
gc.setColor(1,1,1,1-abs(r%1*2-1)) gc.setColor(1,1,1,1-abs(r%1*2-1))
gc.draw(TEXTURE.miniBlock[R],821,140,TIME()*10%6.2832,7,7,2*DSCP[R][0][2]+1,2*(#BLOCKS[R][0]-DSCP[R][0][1])-1) gc.draw(TEXTURE.miniBlock[R],821,140,TIME()*10%6.2832,7,7,2*DSCP[R][0][2]+1,2*(#BLOCKS[R][0]-DSCP[R][0][1])-1)
end end

View File

@@ -5,7 +5,7 @@ local gc_rectangle,gc_circle=GC.rectangle,GC.circle
local isDown=love.keyboard.isDown local isDown=love.keyboard.isDown
local int,max,min=math.floor,math.max,math.min local floor,max,min=math.floor,math.max,math.min
local mStr=GC.mStr local mStr=GC.mStr
@@ -169,7 +169,7 @@ local function press(x,y)
end end
function scene.touchDown(x,y) function scene.touchDown(x,y)
x,y=int((x-pad.x)/80),int((y-pad.y)/80) x,y=floor((x-pad.x)/80),floor((y-pad.y)/80)
if x>=0 and x<=8 and y>=0 and y<=7 then if x>=0 and x<=8 and y>=0 and y<=7 then
press(x,y+1) press(x,y+1)
end end

View File

@@ -8,7 +8,7 @@ local gc_print,gc_printf=GC.print,GC.printf
local ms,kb,tc=love.mouse,love.keyboard,love.touch local ms,kb,tc=love.mouse,love.keyboard,love.touch
local max,min=math.max,math.min local max,min=math.max,math.min
local int,abs=math.floor,math.abs local floor,abs=math.floor,math.abs
local mapCam={ local mapCam={
sel=false,-- Selected mode ID sel=false,-- Selected mode ID
@@ -319,7 +319,7 @@ function scene.draw()
elseif L[1] then elseif L[1] then
for i=1,#L do for i=1,#L do
local t=M.scoreDisp(L[i]) local t=M.scoreDisp(L[i])
local f=int((30-#t*.5)/5)*5 local f=floor((30-#t*.5)/5)*5
setFont(f) setFont(f)
gc_print(t,955,275+25*i+17-f*.7) gc_print(t,955,275+25*i+17-f*.7)
_=L[i].date _=L[i].date

View File

@@ -1,5 +1,5 @@
local gc=love.graphics local gc=love.graphics
local int=math.floor local floor=math.floor
local sin=math.sin local sin=math.sin
local selRS local selRS
@@ -119,7 +119,7 @@ scene.widgetList={
SETTING.face[i]=0 SETTING.face[i]=0
end end
for i=1,7 do for i=1,7 do
minoRot0[i]=(int(minoRot0[i]/6.2831853)+(minoRot0[i]%6.2831853>4 and 1 or 0))*6.2831853 minoRot0[i]=(floor(minoRot0[i]/6.2831853)+(minoRot0[i]%6.2831853>4 and 1 or 0))*6.2831853
end end
SFX.play('hold') SFX.play('hold')
end}, end},

View File

@@ -1,5 +1,5 @@
local gc,ms=love.graphics,love.mouse local gc,ms=love.graphics,love.mouse
local int,sin=math.floor,math.sin local floor,sin=math.floor,math.sin
local VK_ORG=VK_ORG local VK_ORG=VK_ORG
local scene={} local scene={}
@@ -74,7 +74,7 @@ end
function scene.touchUp() function scene.touchUp()
if selected then if selected then
local B=VK_ORG[selected] local B=VK_ORG[selected]
B.x,B.y=int(B.x/snapUnit+.5)*snapUnit,int(B.y/snapUnit+.5)*snapUnit B.x,B.y=floor(B.x/snapUnit+.5)*snapUnit,floor(B.y/snapUnit+.5)*snapUnit
end end
end end
function scene.touchMove(_,_,dx,dy) function scene.touchMove(_,_,dx,dy)