diff --git a/Zframework b/Zframework index 90bc2600..f8059337 160000 --- a/Zframework +++ b/Zframework @@ -1 +1 @@ -Subproject commit 90bc2600cf7d990fa5d07eded1042905c6dda9c4 +Subproject commit f8059337db30faeb6f16a830457c93d1a30f5d79 diff --git a/parts/backgrounds/lanterns.lua b/parts/backgrounds/lanterns.lua index 2a507f1d..cef3ccd6 100644 --- a/parts/backgrounds/lanterns.lua +++ b/parts/backgrounds/lanterns.lua @@ -1,5 +1,5 @@ -- 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 mDraw=mDraw local back={} @@ -41,7 +41,7 @@ function back.draw() local img=IMG.lanterns for i=1,#lanterns do 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 return back diff --git a/parts/backgrounds/lightning2.lua b/parts/backgrounds/lightning2.lua index 1d8fd08b..75dbc864 100644 --- a/parts/backgrounds/lightning2.lua +++ b/parts/backgrounds/lightning2.lua @@ -1,5 +1,5 @@ -- Fast lightning + spining tetromino -local int,rnd=math.floor,math.random +local floor,rnd=math.floor,math.random local back={} local t @@ -12,7 +12,7 @@ function back.update(dt) t=t+dt end 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 if T<.26 then GC.clear(T,T,T) else GC.clear(0,0,0) diff --git a/parts/data.lua b/parts/data.lua index bd8ff4ce..d2dd36ec 100644 --- a/parts/data.lua +++ b/parts/data.lua @@ -1,4 +1,4 @@ -local int=math.floor +local floor=math.floor local char,byte=string.char,string.byte 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 if id>26 then return end-- Illegal blockid - b=int(b/32)-- Mode id + b=floor(b/32)-- Mode id F[fY][fX]=id if fX<10 then @@ -265,10 +265,10 @@ function DATA.dumpRecording(list,ptr) prevFrm=list[ptr] if t>=128 then buffer2=char(t%128) - t=int(t/128) + t=floor(t/128) while t>=128 do buffer2=char(128+t%128)..buffer2 - t=int(t/128) + t=floor(t/128) end buffer=buffer..char(128+t)..buffer2 else @@ -279,10 +279,10 @@ function DATA.dumpRecording(list,ptr) t=list[ptr+1] if t>=128 then buffer2=char(t%128) - t=int(t/128) + t=floor(t/128) while t>=128 do buffer2=char(128+t%128)..buffer2 - t=int(t/128) + t=floor(t/128) end buffer=buffer..char(128+t)..buffer2 else diff --git a/parts/gameFuncs.lua b/parts/gameFuncs.lua index aefff5f6..aec6b607 100644 --- a/parts/gameFuncs.lua +++ b/parts/gameFuncs.lua @@ -5,7 +5,7 @@ local gc_setShader=GC.setShader local gc_draw,gc_rectangle,gc_printf=GC.draw,GC.rectangle,GC.printf 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 SETTING,GAME,SCR=SETTING,GAME,SCR @@ -283,7 +283,7 @@ function royaleLevelup() if GAME.curMode.name:find("_u") then for i=1,#PLY_ALIVE do 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 P.curY=P.ghoY P:set20G(true) diff --git a/parts/player/draw.lua b/parts/player/draw.lua index 0b6347ba..66bc39d1 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -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 diff --git a/parts/player/player.lua b/parts/player/player.lua index 2c166a3b..f97ec855 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -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 ---------------------------------------------------- @@ -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 diff --git a/parts/scenes/app_15p.lua b/parts/scenes/app_15p.lua index 8e057cd4..2152211d 100644 --- a/parts/scenes/app_15p.lua +++ b/parts/scenes/app_15p.lua @@ -1,6 +1,6 @@ local gc=love.graphics -local int,rnd=math.floor,math.random +local floor,rnd=math.floor,math.random local scene={} @@ -81,7 +81,7 @@ local function tapBoard(x,y,key) if pathVis then SYSFX.newShade(6,x-5,y-5,11,11,1,1,1) 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 local b=board local moves=0 diff --git a/parts/scenes/app_2048.lua b/parts/scenes/app_2048.lua index 76ea3bb9..c610e7b1 100644 --- a/parts/scenes/app_2048.lua +++ b/parts/scenes/app_2048.lua @@ -1,7 +1,7 @@ local gc,kb=love.graphics,love.keyboard 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 ins=table.insert local setFont=FONT.set @@ -400,7 +400,7 @@ function scene.draw() -- Board for i=1,16 do 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] if i~=prevPos or prevSpawnTime==1 then if not invis or i==prevPos then @@ -460,7 +460,7 @@ function scene.draw() end -- 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) setColor(.2,.8,0,prevSpawnTime) local d=25-prevSpawnTime*25 diff --git a/parts/scenes/app_UTTT.lua b/parts/scenes/app_UTTT.lua index a38a4379..8c18067a 100644 --- a/parts/scenes/app_UTTT.lua +++ b/parts/scenes/app_UTTT.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local int=math.floor +local floor=math.floor local lines={ {1,2,3}, @@ -103,8 +103,8 @@ function scene.enter() end function scene.mouseMove(x,y) - x,y=int((x-280)/80),int(y/80) - curX,curx=int(x/3)+int(y/3)*3+1,x%3+y%3*3+1 + x,y=floor((x-280)/80),floor(y/80) + curX,curx=floor(x/3)+floor(y/3)*3+1,x%3+y%3*3+1 if x<0 or x>8 or y<0 or y>8 or @@ -143,7 +143,7 @@ function scene.draw() -- Draw target area gc.setColor(1,1,1,math.sin((TIME()-placeTime)*5)*.1+.15) 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 gc.rectangle('fill',0,0,90,90) end @@ -151,7 +151,7 @@ function scene.draw() -- Draw cursor if curX then 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 gc.setLineWidth(.8) @@ -164,13 +164,13 @@ function scene.draw() else gc.setColor(COLOR.D) 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 for x=1,9 do local c=board[X][x] if c then 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 gc.setColor(1,.2,.2) gc.rectangle('line',_x+2.25,_y+2.25,5.5,5.5) @@ -195,7 +195,7 @@ function scene.draw() if lastX then gc.setColor(.5,1,.4,.8) 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 gc.pop() diff --git a/parts/scenes/app_arithmetic.lua b/parts/scenes/app_arithmetic.lua index 651d39c2..f0db0811 100644 --- a/parts/scenes/app_arithmetic.lua +++ b/parts/scenes/app_arithmetic.lua @@ -1,6 +1,6 @@ local gc=love.graphics 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 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 charData={ -["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}, -["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}, -["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}, -["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}, -["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}, - 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}, - 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}, - 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} + ["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}, + ["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}, + ["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}, + ["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}, + ["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}, + ["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}, + ["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}, + ["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} } local drawing local drawLines,drawVel,indexes @@ -66,7 +66,7 @@ local levels={ end,nil,nil, function()-- 4~6 <+> [,20] 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() drawChar(a,600,200) drawChar(s-a,600,350) @@ -77,7 +77,7 @@ local levels={ end,nil,nil, function()-- 7~9 <+> [,100] 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() drawChar(a,600,200) drawChar(s-a,600,350) @@ -98,7 +98,7 @@ local levels={ end,nil,nil, function()-- 13~15 <-> [,100] 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() drawChar(s,600,200) drawChar(a,600,350) @@ -122,7 +122,7 @@ local levels={ function()-- 21~25 <*> [,100] local b=rnd(21,89) local a=rnd(ceil(b/10),9) - b=int(b/a) + b=floor(b/a) return a.."*"..b,a*b,function() drawChar(a>b and a or b,600,200) drawChar(a>b and b or a,600,350) @@ -144,7 +144,7 @@ local levels={ function()-- 29~33 [,100] local b=rnd(21,89) local a=rnd(ceil(b/10),9) - b=int(b/a) + b=floor(b/a) return a*b.."/"..a,b,function() drawChar(a*b,560,300,1,true) drawChar(a,400,300) @@ -172,7 +172,7 @@ local levels={ local a=rnd(2,9) return {COLOR.N,b2(a)},a,function() 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 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)}) @@ -191,7 +191,7 @@ local levels={ local a=rnd(9,63) return {COLOR.lR,b8(a)},a,function() 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 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)}) @@ -210,7 +210,7 @@ local levels={ local a=rnd(17,255) return {COLOR.J,b16(a)},a,function() 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 local c=string.sub(b,i,i) if ("0123456789"):find(c,nil,true) then @@ -233,14 +233,14 @@ local levels={ end,nil,nil, function()-- 54~58 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() drawChar(tonumber(STRING.toBin(a)),220,200,.6) drawChar(tonumber(STRING.toBin(s-a)),220,335,.6) ins(drawLines,{0,470,300,470}) ins(drawLines,{320,470,400,470}) 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 ins(drawLines,{620,580-100*(l-i),660,540-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, function()-- 59~62 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() drawChar(tonumber(STRING.toOct(a)),220,200,.6) drawChar(tonumber(STRING.toOct(s-a)),220,335,.6) ins(drawLines,{0,470,300,470}) ins(drawLines,{320,470,400,470}) 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 ins(drawLines,{620,580-100*(l-i),660,540-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, function()-- 63~65 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() drawChar(tonumber(STRING.toHex(a)),220,200,.6) drawChar(tonumber(STRING.toHex(s-a)),220,335,.6) ins(drawLines,{0,470,300,470}) ins(drawLines,{320,470,400,470}) 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 ins(drawLines,{620,580-100*(l-i),660,540-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 question=newQ SFX.play('reach') - else - if #tostring(val)==#tostring(answer) then - SFX.play('finesseError_long') - input="" - inputTime=0 - end end end local function isDrawing() return drawing end -- for hiding widgets 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={} @@ -493,7 +477,15 @@ function scene.update(dt) end function scene.draw() 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) if not drawing then FONT.set(45) diff --git a/parts/scenes/app_cannon.lua b/parts/scenes/app_cannon.lua index cb064540..3f3cd9e0 100644 --- a/parts/scenes/app_cannon.lua +++ b/parts/scenes/app_cannon.lua @@ -1,5 +1,5 @@ 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 state,timer,score,combo @@ -61,7 +61,7 @@ function scene.update() end if x>1280 or y>720 then if score>0 then - score=score-int(score/10) + score=score-floor(score/10) end SFX.play('finesseError') combo=0 @@ -110,7 +110,7 @@ function scene.draw() gc.setColor(1,1,.6) gc.print("x"..combo,300,80) 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) -- Cannon ball diff --git a/parts/scenes/app_cubefield.lua b/parts/scenes/app_cubefield.lua index 0d059b49..a6a6a711 100644 --- a/parts/scenes/app_cubefield.lua +++ b/parts/scenes/app_cubefield.lua @@ -1,5 +1,5 @@ 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 setFont,mStr=FONT.set,GC.mStr @@ -36,7 +36,7 @@ local function hurt(i) menu,play=1,false speed=speed*.5 moveDir=0 - score=int(score) + score=floor(score) SFX.play('clear_4') else SFX.play('clear_2') @@ -206,7 +206,7 @@ function scene.update(dt) local t=love.system.getClipboardText() if type(t)=='string' then 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 score=type(t)=='number' and t or 0 life=1000 @@ -276,8 +276,8 @@ function scene.draw() -- Draw menu if play then setFont(60) - mStr(int(score),-300,-640) - mStr(int(score),300,-640) + mStr(floor(score),-300,-640) + mStr(floor(score),300,-640) if score%1000>920 then gc.setColor(1,1,1,abs(score%1000-970)*8) setFont(70) diff --git a/parts/scenes/app_dropper.lua b/parts/scenes/app_dropper.lua index 21a99149..00c8aa4e 100644 --- a/parts/scenes/app_dropper.lua +++ b/parts/scenes/app_dropper.lua @@ -1,5 +1,5 @@ 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 -- This mini-game is written for TI-nSpire CX CAS many years ago. @@ -176,7 +176,7 @@ end setmetatable(backColor,backColor) function scene.draw() -- 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.rectangle('fill',0,720,1280,height-700) gc.setColor(backColor[lv+2] or COLOR.D) diff --git a/parts/scenes/app_dtw.lua b/parts/scenes/app_dtw.lua index 652a87b7..b4b64c60 100644 --- a/parts/scenes/app_dtw.lua +++ b/parts/scenes/app_dtw.lua @@ -1,7 +1,7 @@ local gc=love.graphics 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 targets={ @@ -274,7 +274,7 @@ function scene.mouseDown(x) end function scene.touchDown(x) 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 touch(x) end diff --git a/parts/scenes/app_link.lua b/parts/scenes/app_link.lua index 0e8a989a..3615daec 100644 --- a/parts/scenes/app_link.lua +++ b/parts/scenes/app_link.lua @@ -4,7 +4,7 @@ local gc=love.graphics local gc_setColor,gc_rectangle,gc_draw=gc.setColor,gc.rectangle,gc.draw 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 ins,rem=table.insert,table.remove @@ -73,7 +73,7 @@ local function resetBoard() field.c,field.r=levels[level].c,levels[level].r 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,#pool do pool[i]=pool[i]*2 end field.remain=total @@ -186,7 +186,7 @@ local function tap(x,y) field.full=false -- Score - local s=1000+int(combo^.9) + local s=1000+floor(combo^.9) score=score+s TEXT.show("+"..s,1205,600,20,'score') @@ -206,7 +206,7 @@ local function tap(x,y) SFX.play('clear_4') TEXT.show("FULL COMBO",640,360,100,'beat',.626) comboTime=comboTime+3 - score=int(score*1.1) + score=floor(score*1.1) end ins(progress, noComboBreak and @@ -270,8 +270,8 @@ function scene.keyDown(key,isRep) end end local function touch(x,y) - x=int((x-field.x)/field.w*field.c+1) - y=int((y-field.y)/field.h*field.r+1) + x=floor((x-field.x)/field.w*field.c+1) + y=floor((y-field.y)/field.h*field.r+1) tap(x,y) 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 time=TIME()-startTime 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 for i=#lines,1,-1 do diff --git a/parts/scenes/app_schulteG.lua b/parts/scenes/app_schulteG.lua index b8a0336c..7b673503 100644 --- a/parts/scenes/app_schulteG.lua +++ b/parts/scenes/app_schulteG.lua @@ -1,5 +1,5 @@ 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 setFont,mStr=FONT.set,GC.mStr @@ -45,8 +45,8 @@ local function tapBoard(x,y) startTime=TIME() progress=0 elseif state==1 then - local X=int((x-320)/640*R) - local Y=int((y-40)/640*R) + local X=floor((x-320)/640*R) + local Y=floor((y-40)/640*R) x=R*Y+X+1 if board[x]==progress+1 then progress=progress+1 diff --git a/parts/scenes/app_ten.lua b/parts/scenes/app_ten.lua index cf6a46f9..7388d671 100644 --- a/parts/scenes/app_ten.lua +++ b/parts/scenes/app_ten.lua @@ -2,7 +2,7 @@ local gc=love.graphics local msIsDown,kbIsDown,tcTouches=love.mouse.isDown,love.keyboard.isDown,love.touch.getTouches 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 setFont,mStr=FONT.set,GC.mStr @@ -90,7 +90,7 @@ local function merge() until not connected[1] if count>1 then 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 TEXT.show(getScore,cx*128+256,cy*128-40,40,'score') SYSFX.newRectRipple(2,320+cx*128-128,40+cy*128-128,128,128) @@ -163,7 +163,7 @@ function scene.keyDown(key,isRep) end end 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 cx,cy=false end diff --git a/parts/scenes/app_triple.lua b/parts/scenes/app_triple.lua index 6e3a1c4d..0dc7a977 100644 --- a/parts/scenes/app_triple.lua +++ b/parts/scenes/app_triple.lua @@ -1,7 +1,7 @@ local gc=love.graphics 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 setFont,mStr=FONT.set,GC.mStr @@ -270,7 +270,7 @@ function scene.enter() end 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 player:click(y,x) end diff --git a/parts/scenes/customGame.lua b/parts/scenes/customGame.lua index b134259f..e9b0ce8a 100644 --- a/parts/scenes/customGame.lua +++ b/parts/scenes/customGame.lua @@ -1,5 +1,5 @@ local gc,kb,sys=love.graphics,love.keyboard,love.system -local int=math.floor +local floor=math.floor local CUSTOMENV=CUSTOMENV local sList={ @@ -132,7 +132,7 @@ function scene.draw() -- Sequence 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) end @@ -157,14 +157,14 @@ function scene.draw() end end gc.pop() 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) end end -- Sequence 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) end diff --git a/parts/scenes/custom_field.lua b/parts/scenes/custom_field.lua index 5c43db49..ecfad3c9 100644 --- a/parts/scenes/custom_field.lua +++ b/parts/scenes/custom_field.lua @@ -1,7 +1,7 @@ local gc,sys=love.graphics,love.system 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 FIELD=FIELD @@ -129,7 +129,7 @@ function scene.leave() end 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 penX,penY=sx,sy if curPen then @@ -434,7 +434,7 @@ function scene.draw() gc.setColor(1,1,1) for i=1,7 do 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 diff --git a/parts/scenes/custom_mission.lua b/parts/scenes/custom_mission.lua index 9dbfbc56..d432da72 100644 --- a/parts/scenes/custom_mission.lua +++ b/parts/scenes/custom_mission.lua @@ -1,7 +1,7 @@ local gc,sys=love.graphics,love.system 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 scene={} @@ -151,7 +151,7 @@ function scene.draw() end if i<=j then setFont(35) - local N=int(L[i]*.1) + local N=floor(L[i]*.1) if N>0 then gc.setColor(libColor[set[N]]) elseif L[i]>4 then diff --git a/parts/scenes/dict.lua b/parts/scenes/dict.lua index 4e284e75..2fd3b3d8 100644 --- a/parts/scenes/dict.lua +++ b/parts/scenes/dict.lua @@ -1,6 +1,6 @@ local gc=love.graphics -local int,abs=math.floor,math.abs +local floor,abs=math.floor,math.abs local ins=table.insert local find=string.find @@ -287,7 +287,7 @@ function scene.draw() if searchWait>0 then 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.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 diff --git a/parts/scenes/launchpad.lua b/parts/scenes/launchpad.lua index c3510351..195cc944 100644 --- a/parts/scenes/launchpad.lua +++ b/parts/scenes/launchpad.lua @@ -5,7 +5,7 @@ local gc_rectangle,gc_circle=GC.rectangle,GC.circle 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 @@ -169,7 +169,7 @@ local function press(x,y) end 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 press(x,y+1) end diff --git a/parts/scenes/mode.lua b/parts/scenes/mode.lua index 12a7e38f..850cc31b 100644 --- a/parts/scenes/mode.lua +++ b/parts/scenes/mode.lua @@ -8,7 +8,7 @@ local gc_print,gc_printf=GC.print,GC.printf local ms,kb,tc=love.mouse,love.keyboard,love.touch local max,min=math.max,math.min -local int,abs=math.floor,math.abs +local floor,abs=math.floor,math.abs local mapCam={ sel=false,-- Selected mode ID @@ -319,7 +319,7 @@ function scene.draw() elseif L[1] then for i=1,#L do local t=M.scoreDisp(L[i]) - local f=int((30-#t*.5)/5)*5 + local f=floor((30-#t*.5)/5)*5 setFont(f) gc_print(t,955,275+25*i+17-f*.7) _=L[i].date diff --git a/parts/scenes/setting_skin.lua b/parts/scenes/setting_skin.lua index 00fa3b6a..f88649e2 100644 --- a/parts/scenes/setting_skin.lua +++ b/parts/scenes/setting_skin.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local int=math.floor +local floor=math.floor local sin=math.sin local selRS @@ -119,7 +119,7 @@ scene.widgetList={ SETTING.face[i]=0 end 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 SFX.play('hold') end}, diff --git a/parts/scenes/setting_touch.lua b/parts/scenes/setting_touch.lua index 0fdd0e6e..03388216 100644 --- a/parts/scenes/setting_touch.lua +++ b/parts/scenes/setting_touch.lua @@ -1,5 +1,5 @@ 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 scene={} @@ -74,7 +74,7 @@ end function scene.touchUp() if selected then 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 function scene.touchMove(_,_,dx,dy)