From 659a50300d9d02ae2365c1f018b9f52969887db3 Mon Sep 17 00:00:00 2001 From: MrZ_26 Date: Tue, 4 Feb 2020 19:38:48 +0800 Subject: [PATCH] =?UTF-8?q?0.8.0=CE=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf.lua | 2 +- dataList.lua | 120 ++-- font.ttf | Bin 110336 -> 110484 bytes language/chi.lua | 5 +- language/chi_full.lua | 5 +- language/eng.lua | 5 +- list.lua | 292 ++++----- main.lua | 39 +- paint.lua | 125 +--- player.lua | 1310 +++++++++++++++++++++-------------------- scene.lua | 1 - sound.lua | 85 +++ text.lua | 82 +++ texture.lua | 5 +- timer.lua | 4 +- toolfunc.lua | 112 +--- updateLog.lua | 14 +- 17 files changed, 1145 insertions(+), 1061 deletions(-) create mode 100644 sound.lua create mode 100644 text.lua diff --git a/conf.lua b/conf.lua index 5c0c7a2b..29391acc 100644 --- a/conf.lua +++ b/conf.lua @@ -1,5 +1,5 @@ math.randomseed(os.time()) -gameVersion="Alpha V0.7.35" +gameVersion="Alpha V0.8.0" function love.conf(t) t.identity="Techmino"--Save directory name t.version="11.1" diff --git a/dataList.lua b/dataList.lua index 04a1224c..6bd1e856 100644 --- a/dataList.lua +++ b/dataList.lua @@ -34,6 +34,7 @@ local pc_drop={50,45,40,35,30,26,22,18,15,12} local pc_lock={55,50,45,40,36,32,30} local pc_fall={18,16,14,12,10,9,8,7,6} local sectionName={"M7","M8","M9","M","MK","MV","MO","MM","GM"} +local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local Fkey_func={ royale=function(P) @@ -75,10 +76,10 @@ end Event={null=NULL} function Event.reach_winCheck(P) if P.stat.row>=P.gameEnv.target then - Event.win(P) + Event.win(P,"finish") end end -function Event.win(P) +function Event.win(P,result) P.alive=false P.control=false P.timing=false @@ -100,7 +101,7 @@ function Event.win(P) end end if P.human then - gamefinished=true + gameResult=result or"win" SFX("win") VOICE("win") if modeEnv.royaleMode then @@ -108,7 +109,11 @@ function Event.win(P) end end newTask(Event_task.finish,P) - P:showText(text.win,"beat",90,nil,.4,curMode.id~="custom") + if curMode.id=="custom"then + P:showText(text.win,0,0,90,"beat",.4) + else + P:showText(text.win,0,0,90,"beat",.5,.2) + end end function Event.lose(P) if P.invincible then @@ -139,7 +144,7 @@ function Event.lose(P) P:changeAtk() P.result="K.O." P.rank=#players.alive+1 - P:showText(P.rank,"appear",60,120,nil,true) + P:showText(P.rank,0,-120,60,"appear",1,12) P.strength=0 if P.lastRecv then local A,i=P,0 @@ -185,9 +190,9 @@ function Event.lose(P) end end P.gameEnv.keepVisible=P.gameEnv.visible~="show" - P:showText(text.lose,"appear",90,nil,nil,true) + P:showText(text.lose,0,0,90,"appear",.5,.2) if P.human then - gamefinished=true + gameResult="lose" SFX("fail") VOICE("lose") if modeEnv.royaleMode then BGM("end")end @@ -249,7 +254,7 @@ function Event.master_score(P) P.modeData.point,P.modeData.event=500,4 Event.win(P) else - P:showText(text.stage(s),"fly",80,-120) + P:showText(text.stage(s),0,-120,80,"fly") end SFX("reach") end @@ -270,7 +275,7 @@ function Event.master_score_hard(P) if P.modeData.point%100==99 then SFX("blip_1")end if int(P.modeData.point*.01)>P.modeData.event then local s=P.modeData.event+1;P.modeData.event=s--level up! - P:showText(text.stage(s),"fly",80,-120) + P:showText(text.stage(s),0,-120,80,"fly") if s<4 then--first 300 if s~=1 then P.gameEnv.lock=P.gameEnv.lock-1 end if s~=2 then P.gameEnv.wait=P.gameEnv.wait-1 end @@ -414,9 +419,9 @@ function Event.newPC(P) P.gameEnv.lock=pc_lock[s]or 20 P.gameEnv.fall=pc_fall[s]or 5 if s==10 then - P:showText(text.maxspeed,"appear",100,-140,.6) + P:showText(text.maxspeed,0,-140,100,"appear",.6) else - P:showText(text.speedup,"appear",40,-140) + P:showText(text.speedup,0,-140,40,"appear",.8) end end end @@ -462,7 +467,7 @@ function Event_task.lose(P) end end end - if P.endCounter==100 then + if P.endCounter==120 then while P.field[1]do removeRow(P.field) removeRow(P.visTime) @@ -523,7 +528,7 @@ function Event_task.survivor_easy(P) P.atkBuffer[#P.atkBuffer+1]={pos=rnd(10),amount=1,countdown=30,cd0=30,time=0,sent=false,lv=1} P.atkBuffer.sum=P.atkBuffer.sum+1 P.stat.recv=P.stat.recv+1 - if P.modeData.event==45 then P:showText(text.maxspeed,"appear",100,-140,.6)end + if P.modeData.event==45 then P:showText(text.maxspeed,0,-140,100,"appear",.6)end P.counter=0 P.modeData.event=P.modeData.event+1 end @@ -540,7 +545,7 @@ function Event_task.survivor_normal(P) d%4==3 and{pos=rnd(10),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3} P.atkBuffer.sum=P.atkBuffer.sum+d%4+1 P.stat.recv=P.stat.recv+d%4+1 - if P.modeData.event==45 then P:showText(text.maxspeed,"appear",100,-140,.6)end + if P.modeData.event==45 then P:showText(text.maxspeed,0,-140,100,"appear",.6)end P.counter=0 P.modeData.event=d end @@ -557,7 +562,7 @@ function Event_task.survivor_hard(P) local R=(P.modeData.event%3<2 and 1 or 3) P.atkBuffer.sum=P.atkBuffer.sum+R P.stat.recv=P.stat.recv+R - if P.modeData.event==60 then P:showText(text.maxspeed,"appear",100,-140,.6)end + if P.modeData.event==60 then P:showText(text.maxspeed,0,-140,100,"appear",.6)end P.counter=0 P.modeData.event=P.modeData.event+1 end @@ -570,7 +575,7 @@ function Event_task.survivor_lunatic(P) P.atkBuffer[#P.atkBuffer+1]={pos=rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3} P.atkBuffer.sum=P.atkBuffer.sum+4 P.stat.recv=P.stat.recv+4 - if P.modeData.event==60 then P:showText(text.maxspeed,"appear",100,-140,.6)end + if P.modeData.event==60 then P:showText(text.maxspeed,0,-140,100,"appear",.6)end P.counter=0 P.modeData.event=P.modeData.event+1 end @@ -588,7 +593,7 @@ function Event_task.survivor_ultimate(P) P.atkBuffer.sum=P.atkBuffer.sum+20 P.stat.recv=P.stat.recv+20 P.counter=0 - if P.modeData.event==31 then P:showText(text.maxspeed,"appear",100,-140,.6)end + if P.modeData.event==31 then P:showText(text.maxspeed,0,-140,100,"appear",.6)end P.modeData.event=P.modeData.event+1 end end @@ -608,16 +613,16 @@ function Event_task.defender_normal(P) D.event=D.event+1 D.point=int(108e3/(360-D.event*2))*.1 if D.event==25 then - P:showText(text.great,"appear",100,-140,.6) + P:showText(text.great,0,-140,100,"appear",.6) pushSpeed=2 P.dropDelay,P.gameEnv.drop=20,20 elseif D.event==50 then - P:showText(text.awesome,"appear",100,-140,.6) + P:showText(text.awesome,0,-140,100,"appear",.6) pushSpeed=3 P.dropDelay,P.gameEnv.drop=10,10 elseif D.event==90 then P.dropDelay,P.gameEnv.drop=5,5 - P:showText(text.maxspeed,"appear",100,-140,.6) + P:showText(text.maxspeed,0,-140,100,"appear",.6) end end end @@ -638,15 +643,15 @@ function Event_task.defender_lunatic(P) D.event=D.event+1 D.point=int(144e3/(240-2*D.event))*.1 if D.event==25 then - P:showText(text.great,"appear",100,-140,.6) + P:showText(text.great,0,-140,100,"appear",.6) pushSpeed=3 P.dropDelay,P.gameEnv.drop=4,4 elseif D.event==50 then - P:showText(text.awesome,"appear",100,-140,.6) + P:showText(text.awesome,0,-140,100,"appear",.6) pushSpeed=4 P.dropDelay,P.gameEnv.drop=3,3 elseif D.event==75 then - P:showText(text.maxspeed,"appear",100,-140,.6) + P:showText(text.maxspeed,0,-140,100,"appear",.6) P.dropDelay,P.gameEnv.drop=2,2 end end @@ -673,10 +678,10 @@ function Event_task.attacker_hard(P) D.event=D.event+1 D.point=int(72e4/t)*.1 if D.event==20 then - P:showText(text.great,"appear",100,-140,.6) + P:showText(text.great,0,-140,100,"appear",.6) pushSpeed=3 elseif D.event==50 then - P:showText(text.maxspeed,"appear",100,-140,.6) + P:showText(text.maxspeed,0,-140,100,"appear",.6) end end end @@ -709,13 +714,13 @@ function Event_task.attacker_ultimate(P) D.event=D.event+1 D.point=int(s*36e3/t)*.1 if D.event==10 then - P:showText(text.great,"appear",100,-140,.6) + P:showText(text.great,0,-140,100,"appear",.6) pushSpeed=4 elseif D.event==20 then - P:showText(text.awesome,"appear",100,-140,.6) + P:showText(text.awesome,0,-140,100,"appear",.6) pushSpeed=5 elseif D.event==30 then - P:showText(text.maxspeed,"appear",100,-140,.6) + P:showText(text.maxspeed,0,-140,100,"appear",.6) end end end @@ -792,7 +797,7 @@ modes.sprint={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(60) + setFont(55) local r=max(P.gameEnv.target-P.stat.row,0) mStr(r,-82,265) if r<21 and r>0 then @@ -825,7 +830,7 @@ modes.marathon={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(50) + setFont(45) mStr(P.stat.row,-82,320) mStr(P.gameEnv.target,-82,370) gc.rectangle("fill",-125,375,90,4) @@ -866,7 +871,7 @@ modes.master={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(50) + setFont(45) mStr(P.modeData.point,-82,320) mStr((P.modeData.event+1)*100,-82,370) gc.rectangle("fill",-125,375,90,4) @@ -890,11 +895,11 @@ modes.classic={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(80) + setFont(75) local r=P.gameEnv.target*.1 mStr(r<11 and 18 or r<22 and r+8 or r==22 and"00"or r==23 and"0a"or format("%x",r*10-220),-82,210) mDraw(drawableText.speedLV,-82,290) - setFont(50) + setFont(45) mStr(P.stat.row,-82,320) mStr(P.gameEnv.target,-82,370) gc.rectangle("fill",-125,375,90,4) @@ -914,7 +919,7 @@ modes.zen={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(75) + setFont(70) mStr(max(200-P.stat.row,0),-82,280) end, } @@ -943,7 +948,7 @@ modes.infinite={ end end, mesDisp=function(P) - setFont(50) + setFont(45) mStr(P.stat.atk,-82,310) mStr(format("%.2f",P.stat.atk/P.stat.row),-82,420) mDraw(drawableText.atk,-82,363) @@ -1038,7 +1043,7 @@ modes.tsd={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(80) + setFont(75) mStr(P.modeData.event,-82,330) mDraw(drawableText.tsd,-82,407) end, @@ -1106,10 +1111,10 @@ modes.blind={ mDraw(drawableText.techrash,-82,420) if curMode.lv==6 then mDraw(drawableText.grade,-82,170) - setFont(60) + setFont(55) mStr(P.modeData.event,-82,110) end - setFont(80) + setFont(75) mStr(P.stat.row,-82,220) mStr(P.stat.clear_4,-82,340) end, @@ -1136,7 +1141,7 @@ modes.dig={ pushSpeed=1 end, mesDisp=function(P) - setFont(70) + setFont(65) mStr(P.modeData.event,-82,310) mDraw(drawableText.wave,-82,375) end, @@ -1185,7 +1190,7 @@ modes.survivor={ pushSpeed=curMode.lv>2 and 2 or 1 end, mesDisp=function(P) - setFont(70) + setFont(65) mStr(P.modeData.event,-82,310) mDraw(drawableText.wave,-82,375) end, @@ -1217,7 +1222,7 @@ modes.defender={ end end, mesDisp=function(P) - setFont(60) + setFont(55) mStr(P.modeData.event,-82,200) mStr(P.modeData.point,-82,320) mDraw(drawableText.wave,-82,260) @@ -1249,7 +1254,7 @@ modes.attacker={ end end, mesDisp=function(P) - setFont(60) + setFont(55) mStr(P.modeData.event,-82,200) mStr( curMode.lv==1 and 24 @@ -1318,7 +1323,7 @@ modes.tech={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(50) + setFont(45) mStr(P.stat.atk,-82,310) mStr(format("%.2f",P.stat.atk/P.stat.row),-82,420) mDraw(drawableText.atk,-82,363) @@ -1363,7 +1368,7 @@ modes.c4wtrain={ end end, mesDisp=function(P) - setFont(50) + setFont(45) mStr(max(100-P.stat.row,0),-82,220) mStr(P.combo,-82,310) mStr(P.modeData.point,-82,400) @@ -1401,7 +1406,7 @@ modes.pctrain={ Event.newPC(players[1]) end, mesDisp=function(P) - setFont(80) + setFont(75) mStr(P.stat.pc,-82,330) mDraw(drawableText.pc,-82,412) end, @@ -1437,10 +1442,10 @@ modes.pcchallenge={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(50) + setFont(45) mStr(max(100-P.stat.row,0),-82,250) - setFont(80) + setFont(75) mStr(P.stat.pc,-82,350) mDraw(drawableText.pc,-82,432) @@ -1500,16 +1505,16 @@ modes.techmino49={ end end end, mesDisp=function(P) - setFont(40) + setFont(35) mStr(#players.alive.."/49",-82,175) mStr(P.ko,-70,215) gc.draw(drawableText.ko,-127,225) - setFont(25) + setFont(20) gc.setColor(1,.5,0,.6) gc.print(P.badge,-47,227) gc.setColor(1,1,1) - setFont(30) - gc.print(up0to4[P.strength],-132,290) + setFont(25) + gc.print(powerUp[P.strength],-132,290) for i=1,P.strength do gc.draw(badgeIcon,16*i-138,260) end @@ -1564,16 +1569,16 @@ modes.techmino99={ end end end, mesDisp=function(P) - setFont(40) + setFont(35) mStr(#players.alive.."/99",-82,175) mStr(P.ko,-70,215) gc.draw(drawableText.ko,-127,225) - setFont(25) + setFont(20) gc.setColor(1,.5,0,.6) gc.print(P.badge,-47,227) gc.setColor(1,1,1) - setFont(30) - gc.print(up0to4[P.strength],-132,290) + setFont(25) + gc.print(powerUp[P.strength],-132,290) for i=1,P.strength do gc.draw(badgeIcon,16*i-138,260) end @@ -1603,7 +1608,7 @@ modes.drought={ newPlayer(1,340,15) end, mesDisp=function(P) - setFont(75) + setFont(70) mStr(max(100-P.stat.row,0),-82,280) end, } @@ -1690,12 +1695,11 @@ modes.custom={ modeEnv.bgm=customRange.bgm[customSel[13]] end, mesDisp=function(P) + setFont(55) if P.gameEnv.puzzle or P.gameEnv.target>1e10 then - setFont(60) mStr(P.stat.row,-82,225) mDraw(drawableText.line,-82,290) else - setFont(60) mStr(max(P.gameEnv.target-P.stat.row,0),-82,240) end if P.gameEnv.puzzle and P.modeData.event==0 then diff --git a/font.ttf b/font.ttf index f6d0a27926d8612ec2324abac7db4de28f3532ed..7e66aa390b560ed46df261bcceeaf413b0fbd36d 100644 GIT binary patch delta 1310 zcmW+!drVVT96sk3TLe}Si`9V@gotjFF<&Td9V5b+I;SkY2)b1YExiT$gqBy^E8YvG zJfyACTdY#$Aqv!1+Nu?FVxk7!1T?HV<{mMyFlHPqhHbFx{`m5J`F`K;oRfS`Ig00e~P^HdUK3FxBc%cy)* z0WbfP9JaN;4nUH+nC6xg$`vz_f7k%DtpQ+hHh@%&!oIkmXJ0M)a0Ud^#wiDk{<0|T z4f}Tv51n|P$OwEBLIPbJC|v+ox(xJfG&T-s|F1`afDjRNI18bk1X-@Jg+>Somn1lx z1_>iYE(>!G(YUR3R@|zz@~nrg8P?s_rPe@e0O=?1k_X6Lz-* ztsky`x9;!SsoDp%Qo|v`UPG!O*^p2(sh`#8AL-rt9(||YtT*UO^n&WA)r#sBReP#} zsu;u|af9#>W&$T7iRJh`+=IJu6#oKWete?x2W$rW6MKq1!X9Gxu{&5Fb`{%?C1DX5 zUFXoX>q>N)x?t_E+Q-^ntzC1!e6CzwdRQ%1?^SIro-KY|>@OZI;uL8ji}HtM1hP!oV%b6&T}G23G9aCh{v;if zK9deg?@IHe+axO_k@YVrtS ziQtq#C0NJIjt7v&dQ&RZ71I^Hgh5+QNrVA%K{nun96*QfQAQLvfiPU$r8b&|H+K|2 zI+|UO?a!X($MPlofgDy&L(X{ap4>sfYQcHIE1^Q@70%}I^PY${ii$)dXeK%$=7{U^ zLB63Nv;Z#zg`&c$!cNI5$rWjm)Gga3>y)$Pq+*rgp|VUlTjVH?FP>EGRwt{yB}t`7 zX<6w=SzuX4SzFmyxhAP1v_eraqDj!;+Cc3)TAB8tZjJ6P_BLk1o*yeX_Fd(U%4^3Z zcnB`WrwA@lLX1}>R1H+`sUFoI(NEUc4e7PaT7BK>I!C>#f!Q#5;!>lk@wIW6(QXPg z&6?BAdh_(jgD3r`lA4%J4NYE4hGmx2lh3Sa*6!voO|$*x%E{>(1yN=}GBvIx-yo%UPGlom^*=bIO(Gn!56JFRS-puh$LSD)*Qt&GU^n!#i|U ze2sN2V&MAv>jOT-x5a1hP2Iq54D{vpIr>%oDga!P2;FTB0#?o&XqTxXBS8!R3*uoM z6EfnsFp*L*o1)_q+0o%Kl*NH;NP!yA$~6O@@4Q*|Y4MfRm68}7$BhmupB zvVU9I=^HnsvgHYakGaARG;0rRNOu&L%IWG-iSx4!dt;EWeZ ypWxYIg#t)h4-!1~W*7lspr`LN3<*GxHqZSQI6+6YBzn3!;0`(i0ysYpg8l=Q7awx~ delta 1169 zcmW+#drVVz6#m^_DCIHGT7d|tCAm#F^aperok9!gczPur=UMdJ^UQj# zd&WGJXOAbv^Kwhmp)B`S*K^mb>m)TtU8W`}6O~G>C4VL-NG&NP-)e4au5S!BOgC(( zf9CwddBv%6>~rKfb~xU1yjk~vcuGu}i4np_^b!UABd6 z0UKqju_f6O@e6nWAHn5#E}mGkP<;zq#2#aF*cA31b`hJz&S0b17uY-48Z6w}Z|$}k zt^2J}mOGYfmSIb$`C`@cs4O{B5{tnANYHa#|Hn=hGvw`{RAT7I(<)?3(Ktn1*$gU!`3)s;1yYp&vH_<#-A zvTR=4<67L#x6_1>@YRVOQI08Rj&q?NZOCkxYVRviD)v~9h+#~RW=p4G8;V~-aTC3RHCTtsT4{JZr?mf&oT;9R!INll7S=c$#mECp! zNdA$zqw=Hk$95kZ>Q3(t^l*E&_gp#tb+53O@+NxwP9&e8`l9+QeGgAsd;*`lKdfIn zAQ)&JTsP<)0z+R84fuKff#Hsetting.das then setting.arr=setting.das @@ -406,7 +416,7 @@ Widget={ SFX("blip_1",.4) end end,nil,"dasU"), - dasU= newButton(400,230,50,50,C.white,40,function() + dasU= newButton(400,230,50,50,C.white,35,function() setting.das=(setting.das+1)%31 if setting.arr>setting.das then setting.das=setting.arr @@ -414,7 +424,7 @@ Widget={ SFX("blip_1",.4) end end,nil,"arrD"), - arrD= newButton(500,230,50,50,C.white,40,function() + arrD= newButton(500,230,50,50,C.white,35,function() setting.arr=(setting.arr-1)%16 if setting.arr>setting.das then setting.das=setting.arr @@ -422,7 +432,7 @@ Widget={ SFX("blip_1",.4) end end,nil,"arrU"), - arrU= newButton(720,230,50,50,C.white,40,function() + arrU= newButton(720,230,50,50,C.white,35,function() setting.arr=(setting.arr+1)%16 if setting.arr>setting.das then setting.das=setting.arr @@ -430,28 +440,28 @@ Widget={ SFX("blip_1",.4) end end,nil,"sddasD"), - sddasD= newButton(180,340,50,50,C.white,40, function()setting.sddas=(setting.sddas-1)%11 end, nil,"sddasU"), - sddasU= newButton(400,340,50,50,C.white,40, function()setting.sddas=(setting.sddas+1)%11 end, nil,"sdarrD"), - sdarrD= newButton(500,340,50,50,C.white,40, function()setting.sdarr=(setting.sdarr-1)%4 end, nil,"sdarrU"), - sdarrU= newButton(720,340,50,50,C.white,40, function()setting.sdarr=(setting.sdarr+1)%4 end, nil,"quickR"), - quickR= newSwitch(560,430,40,SETdisp("quickR"), SETrev("quickR"), nil,"swap"), - swap= newSwitch(560,510,25,SETdisp("swap"), SETrev("swap"), nil,"fine"), - fine= newSwitch(560,590,25,SETdisp("fine"), SETrev("fine"), nil,"ctrl"), - ctrl= newButton(1020,230,320,80,C.white,40,function()scene.push()scene.swapTo("setting_key")end, nil,"touch"), - touch= newButton(1020,340,320,80,C.white,40,function()scene.push()scene.swapTo("setting_touch")end,nil,"back"), - back= newButton(1160,600,160,160,C.white,55,scene.back,nil,"graphic"), + sddasD= newButton(180,340,50,50,C.white,35, function()setting.sddas=(setting.sddas-1)%11 end, nil,"sddasU"), + sddasU= newButton(400,340,50,50,C.white,35, function()setting.sddas=(setting.sddas+1)%11 end, nil,"sdarrD"), + sdarrD= newButton(500,340,50,50,C.white,35, function()setting.sdarr=(setting.sdarr-1)%4 end, nil,"sdarrU"), + sdarrU= newButton(720,340,50,50,C.white,35, function()setting.sdarr=(setting.sdarr+1)%4 end, nil,"quickR"), + quickR= newSwitch(560,430,35,SETdisp("quickR"), SETrev("quickR"), nil,"swap"), + swap= newSwitch(560,510,20,SETdisp("swap"), SETrev("swap"), nil,"fine"), + fine= newSwitch(560,590,20,SETdisp("fine"), SETrev("fine"), nil,"ctrl"), + ctrl= newButton(1020,230,320,80,C.white,35,function()scene.push()scene.swapTo("setting_key")end, nil,"touch"), + touch= newButton(1020,340,320,80,C.white,35,function()scene.push()scene.swapTo("setting_touch")end,nil,"back"), + back= newButton(1160,600,160,160,C.white,50,scene.back,nil,"graphic"), }, setting_graphic={ - sound= newButton(200,80,240,80,C.lightGreen,40,function()scene.swapTo("setting_sound")end, nil,"game"), - game= newButton(1080,80,240,80,C.lightGreen,40,function()scene.swapTo("setting_game")end, nil,"ghost"), - ghost= newSwitch(310,180,40,SETdisp("ghost"), SETdisp("ghost"), nil,"center"), - center= newSwitch(580,180,40,SETdisp("center"), SETdisp("center"), nil,"smo"), + sound= newButton(200,80,240,80,C.lightGreen,35,function()scene.swapTo("setting_sound")end, nil,"game"), + game= newButton(1080,80,240,80,C.lightGreen,35,function()scene.swapTo("setting_game")end, nil,"ghost"), + ghost= newSwitch(310,180,35,SETdisp("ghost"), SETdisp("ghost"), nil,"center"), + center= newSwitch(580,180,35,SETdisp("center"), SETdisp("center"), nil,"smo"), smo= newSwitch(310,260,25,SETdisp("smo"), SETdisp("smo"), nil,"grid"), - grid= newSwitch(580,260,40,SETdisp("grid"), SETdisp("grid"), nil,"dropFX"), - dropFX= newSlider(310,350,373,3,40,nil,SETdisp("dropFX"), SETsto("dropFX"), nil,"shakeFX"), - shakeFX=newSlider(310,430,373,3,40,nil,SETdisp("shakeFX"), SETsto("shakeFX"), nil,"atkFX"), - atkFX= newSlider(310,510,373,3,40,nil,SETdisp("atkFX"), SETsto("atkFX"), nil,"frame"), - frame= newSlider(310,590,373,10,40,nil,function()return setting.frameMul>35 and setting.frameMul/10 or setting.frameMul/5-4 end,function(i)setting.frameMul=i<5 and 5*i+20 or 10*i end,nil,"fullscreen"), + grid= newSwitch(580,260,30,SETdisp("grid"), SETdisp("grid"), nil,"dropFX"), + dropFX= newSlider(310,350,373,3,35,nil,SETdisp("dropFX"), SETsto("dropFX"), nil,"shakeFX"), + shakeFX=newSlider(310,430,373,3,35,nil,SETdisp("shakeFX"), SETsto("shakeFX"), nil,"atkFX"), + atkFX= newSlider(310,510,373,3,35,nil,SETdisp("atkFX"), SETsto("atkFX"), nil,"frame"), + frame= newSlider(310,590,373,10,35,nil,function()return setting.frameMul>35 and setting.frameMul/10 or setting.frameMul/5-4 end,function(i)setting.frameMul=i<5 and 5*i+20 or 10*i end,nil,"fullscreen"), fullscreen=newSwitch(990,180,40,SETdisp("fullscreen"),function() setting.fullscreen=not setting.fullscreen love.window.setFullscreen(setting.fullscreen) @@ -459,35 +469,37 @@ Widget={ love.resize(love.graphics.getWidth(),love.graphics.getHeight()) end end,nil,"bg"), - bg= newSwitch(990,250,40,SETdisp("bg"),SETrev("bg"),nil,"bgblock"), - bgblock=newSwitch(990,330,40,SETdisp("bgblock"),SETrev("bgblock"),nil,"skin"),--if not setting.bgblock then for i=1,16 do FX_BGblock.list[i].v=3*FX_BGblock.list[i].v end end - skin= newButton(860,470,120,60,C.white,40,function() - setting.skin=setting.skin%8+1 - changeBlockSkin(setting.skin) + bg= newSwitch(990,250,35,SETdisp("bg"),SETrev("bg"),nil,"bgblock"), + bgblock=newSwitch(990,330,35,SETdisp("bgblock"),SETrev("bgblock"),nil,"skin"),--if not setting.bgblock then for i=1,16 do FX_BGblock.list[i].v=3*FX_BGblock.list[i].v end end + skin= newButton(810,420,120,60,C.white,35,function() + local _=setting.skin%8+1 + setting.skin=_ + changeBlockSkin(_) + TEXT(skinName[_],850,475,28,"appear") end,nil,"back"), - back= newButton(1160,600,160,160,C.white,55,scene.back,nil,"sound"), + back= newButton(1160,600,160,160,C.white,50,scene.back,nil,"sound"), }, setting_sound={ - game= newButton(200,80,240,80,C.lightGreen,40,function()scene.swapTo("setting_game")end, nil,"graphic"), - graphic=newButton(1080,80,240,80,C.lightGreen,40,function()scene.swapTo("setting_graphic")end, nil,"sfx"), - sfx= newSlider(180,250,400,10,40,function()SFX("blip_1")end, SETdisp("sfx"), SETsto("sfx"), nil,"bgm"), - bgm= newSlider(750,250,400,10,40,function()BGM(bgmPlaying or"blank")end, SETdisp("bgm"), SETsto("bgm"), nil,"vib"), - vib= newSlider(180,440,400,5,40, function()VIB(1)end, SETdisp("vib"), SETsto("vib"), nil,"voc"), - voc= newSlider(750,440,400,10,40,function()VOICE("nya")end, SETdisp("voc"), SETsto("voc"), nil,"stereo"), - stereo= newSlider(180,630,400,10,40,function()SFX("move",1,-1)SFX("lock",1,1)end, SETdisp("stereo"), SETsto("stereo"),nil,"back"), - back=newButton(1160,600,160,160,C.white,55,scene.back,nil,"game"), + game= newButton(200,80,240,80,C.lightGreen,35,function()scene.swapTo("setting_game")end, nil,"graphic"), + graphic=newButton(1080,80,240,80,C.lightGreen,35,function()scene.swapTo("setting_graphic")end, nil,"sfx"), + sfx= newSlider(180,250,400,10,35,function()SFX("blip_1")end, SETdisp("sfx"), SETsto("sfx"), nil,"bgm"), + bgm= newSlider(750,250,400,10,35,function()BGM(bgmPlaying or"blank")end, SETdisp("bgm"), SETsto("bgm"), nil,"vib"), + vib= newSlider(180,440,400,5 ,35,function()VIB(1)end, SETdisp("vib"), SETsto("vib"), nil,"voc"), + voc= newSlider(750,440,400,10,35,function()VOICE("nya")end, SETdisp("voc"), SETsto("voc"), nil,"stereo"), + stereo= newSlider(180,630,400,10,35,function()SFX("move",1,-1)SFX("lock",1,1)end, SETdisp("stereo"), SETsto("stereo"),nil,"back"), + back=newButton(1160,600,160,160,C.white,50,scene.back,nil,"game"), }, setting_key={ - back=newButton(1140,650,200,80,C.white,50,scene.back), + back=newButton(1140,650,200,80,C.white,45,scene.back), }, setting_touch={ - hide= newSwitch(810,140,45,SETdisp("VKSwitch"),SETrev("VKSwitch")), - track= newSwitch(810,220,45,SETdisp("VKTrack"),SETrev("VKTrack")), - tkset= newButton(450,220,170,80,C.white,30,function() + hide= newSwitch(810,140,40,SETdisp("VKSwitch"),SETrev("VKSwitch")), + track= newSwitch(810,220,40,SETdisp("VKTrack"),SETrev("VKTrack")), + tkset= newButton(450,220,170,80,C.white,25,function() scene.push() scene.swapTo("setting_trackSetting") end,function()return not setting.VKTrack end), - default=newButton(450,320,170,80,C.white,40,function() + default=newButton(450,320,170,80,C.white,35,function() local D=virtualkeySet[defaultSel] for i=1,#VK_org do VK_org[i].ava=false @@ -502,73 +514,73 @@ Widget={ end--Replace keys defaultSel=defaultSel%5+1 end), - snap= newButton(640,320,170,80,C.white,40,function() + snap= newButton(640,320,170,80,C.white,35,function() snapLevel=snapLevel%6+1 end), --VK=T,70,50,27/T,130,50,27/T,190,50,27/T,250,50,27/T,310,50,27/T,370,50,27/T,430,50,27/T,490,50,27/T,550,50,27/T,610,50,27/T,670,50,27/T,730,50,27/T,790,50,27/T,850,50,27/T,910,50,27/T,970,50,27/T,739,789,897/T,1090,50,27/T,1150,50,27/T,1210,50,27 - alpha= newButton(830,320,170,80,C.white,45,function() + alpha= newButton(830,320,170,80,C.white,40,function() setting.VKAlpha=(setting.VKAlpha+1)%11 --Adjust virtualkey alpha end), - icon= newButton(495,420,260,80,C.white,45,SETrev("VKIcon")), + icon= newButton(495,420,260,80,C.white,40,SETrev("VKIcon")), --Switch virtualkey icon - size= newButton(785,420,260,80,C.white,45,function() + size= newButton(785,420,260,80,C.white,40,function() if sel then local B=VK_org[sel] B.r=B.r+10 if B.r>=150 then B.r=B.r-110 end end end), - toggle= newButton(495,520,260,80,C.white,45,function() + toggle= newButton(495,520,260,80,C.white,40,function() scene.push() scene.swapTo("setting_touchSwitch") end), - back= newButton(785,520,260,80,C.white,45,scene.back), + back= newButton(785,520,260,80,C.white,40,scene.back), }, setting_touchSwitch={ - b1= newSwitch(300,80, 40,VKAdisp(1),VKAcode(1)), - b2= newSwitch(300,140, 40,VKAdisp(2),VKAcode(2)), - b3= newSwitch(300,200, 40,VKAdisp(3),VKAcode(3)), - b4= newSwitch(300,260, 40,VKAdisp(4),VKAcode(4)), - b5= newSwitch(300,320, 40,VKAdisp(5),VKAcode(5)), - b6= newSwitch(300,380, 40,VKAdisp(6),VKAcode(6)), - b7= newSwitch(300,440, 40,VKAdisp(7),VKAcode(7)), - b8= newSwitch(300,500, 40,VKAdisp(8),VKAcode(8)), - b9= newSwitch(300,560, 40,VKAdisp(9),VKAcode(9)), - b10= newSwitch(300,620, 40,VKAdisp(10),VKAcode(10)), - b11= newSwitch(760,80, 40,VKAdisp(11),VKAcode(11)), - b12= newSwitch(760,140, 40,VKAdisp(12),VKAcode(12)), - b13= newSwitch(760,200, 40,VKAdisp(13),VKAcode(13)), - b14= newSwitch(760,260, 40,VKAdisp(14),VKAcode(14)), - b15= newSwitch(760,320, 40,VKAdisp(15),VKAcode(15)), - b16= newSwitch(760,380, 40,VKAdisp(16),VKAcode(16)), - b17= newSwitch(760,440, 40,VKAdisp(17),VKAcode(17)), - b18= newSwitch(760,500, 40,VKAdisp(18),VKAcode(18)), - b19= newSwitch(760,560, 40,VKAdisp(19),VKAcode(19)), - b20= newSwitch(760,620, 40,VKAdisp(20),VKAcode(20)), - norm= newButton(1080,150,240,80,C.white,50,function()for i=1,20 do VK_org[i].ava=i<11 end end), - pro= newButton(1080,300,240,80,C.white,40,function()for i=1,20 do VK_org[i].ava=true end end), - back= newButton(1080,600,240,80,C.white,50,scene.back), + b1= newSwitch(300,80, 35,VKAdisp(1),VKAcode(1)), + b2= newSwitch(300,140, 35,VKAdisp(2),VKAcode(2)), + b3= newSwitch(300,200, 35,VKAdisp(3),VKAcode(3)), + b4= newSwitch(300,260, 35,VKAdisp(4),VKAcode(4)), + b5= newSwitch(300,320, 35,VKAdisp(5),VKAcode(5)), + b6= newSwitch(300,380, 35,VKAdisp(6),VKAcode(6)), + b7= newSwitch(300,440, 35,VKAdisp(7),VKAcode(7)), + b8= newSwitch(300,500, 35,VKAdisp(8),VKAcode(8)), + b9= newSwitch(300,560, 35,VKAdisp(9),VKAcode(9)), + b10= newSwitch(300,620, 35,VKAdisp(10),VKAcode(10)), + b11= newSwitch(760,80, 35,VKAdisp(11),VKAcode(11)), + b12= newSwitch(760,140, 35,VKAdisp(12),VKAcode(12)), + b13= newSwitch(760,200, 35,VKAdisp(13),VKAcode(13)), + b14= newSwitch(760,260, 35,VKAdisp(14),VKAcode(14)), + b15= newSwitch(760,320, 35,VKAdisp(15),VKAcode(15)), + b16= newSwitch(760,380, 35,VKAdisp(16),VKAcode(16)), + b17= newSwitch(760,440, 35,VKAdisp(17),VKAcode(17)), + b18= newSwitch(760,500, 35,VKAdisp(18),VKAcode(18)), + b19= newSwitch(760,560, 35,VKAdisp(19),VKAcode(19)), + b20= newSwitch(760,620, 35,VKAdisp(20),VKAcode(20)), + norm= newButton(1080,150,240,80,C.white,45,function()for i=1,20 do VK_org[i].ava=i<11 end end), + pro= newButton(1080,300,240,80,C.white,35,function()for i=1,20 do VK_org[i].ava=true end end), + back= newButton(1080,600,240,80,C.white,45,scene.back), }, setting_trackSetting={ - VKDodge= newSwitch(400,200, 40,SETdisp("VKDodge"),SETrev("VKDodge")), - VKTchW= newSlider(140,310,1000,10,40,nil,SETdisp("VKTchW"),function(i)setting.VKTchW=i;setting.VKCurW=math.max(setting.VKCurW,i)end), - VKCurW= newSlider(140,370,1000,10,40,nil,SETdisp("VKCurW"),function(i)setting.VKCurW=i;setting.VKTchW=math.min(setting.VKTchW,i)end), - back= newButton(1080,600,240,80,C.white,50,scene.back), + VKDodge=newSwitch(400,200, 35,SETdisp("VKDodge"),SETrev("VKDodge")), + VKTchW= newSlider(140,310,1000,10,35,nil,SETdisp("VKTchW"),function(i)setting.VKTchW=i;setting.VKCurW=math.max(setting.VKCurW,i)end), + VKCurW= newSlider(140,370,1000,10,35,nil,SETdisp("VKCurW"),function(i)setting.VKCurW=i;setting.VKTchW=math.min(setting.VKTchW,i)end), + back= newButton(1080,600,240,80,C.white,45,scene.back), }, help={ - his= newButton(1050,520,230,60,C.white,40,function()scene.push()scene.swapTo("history")end,nil,"back"), - qq= newButton(1050,600,230,60,C.white,40,function()love.system.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end, function()return mobile end,"his"), - back= newButton(640, 600,180,60,C.white,40,scene.back,nil,"qq"), + his= newButton(1050,520,230,60,C.white,35,function()scene.push()scene.swapTo("history")end,nil,"back"), + qq= newButton(1050,600,230,60,C.white,35,function()love.system.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end, function()return mobile end,"his"), + back= newButton(640, 600,180,60,C.white,35,scene.back,nil,"qq"), }, history={ - prev= newButton(1155,170,180,180,C.white,70,pressKey("up"),function()return sel==1 end), - next= newButton(1155,400,180,180,C.white,70,pressKey("down"),function()return sel==#updateLog-22 end), - back= newButton(1155,600,180,90,C.white,40,scene.back), + prev= newButton(1155,170,180,180,C.white,65,pressKey("up"),function()return sel==1 end), + next= newButton(1155,400,180,180,C.white,65,pressKey("down"),function()return sel==#updateLog-22 end), + back= newButton(1155,600,180,90,C.white,35,scene.back), }, stat={ - path= newButton(980,620,250,60,C.white,30,function()love.system.openURL(love.filesystem.getSaveDirectory())end,function()return mobile end,"back"), - back= newButton(640,620,180,60,C.white,40,scene.back,nil,"path"), + path= newButton(980,620,250,60,C.white,25,function()love.system.openURL(love.filesystem.getSaveDirectory())end,function()return mobile end,"back"), + back= newButton(640,620,180,60,C.white,35,scene.back,nil,"path"), }, } for _,L in next,Widget do diff --git a/main.lua b/main.lua index 08a343df..efa99e71 100644 --- a/main.lua +++ b/main.lua @@ -24,6 +24,7 @@ local scr=scr curBG="none" bgmPlaying=nil voiceQueue={free=0} +texts={} virtualkeyDown,virtualkeyPressTime={},{} for i=1,20 do virtualkeyDown[i]=X @@ -41,7 +42,7 @@ function setFont(s) if Fonts[s]then gc.setFont(Fonts[s]) else - local t=gc.setNewFont("font.ttf",s-5) + local t=gc.setNewFont("font.ttf",s) Fonts[s]=t gc.setFont(t) end @@ -61,6 +62,8 @@ require("default_data") require("class") require("ai") require("toolfunc") +require("sound") +require("text") require("list") require("dataList") require("texture") @@ -79,7 +82,7 @@ if sys.getPowerInfo()~="unknown"then gc.setCanvas(powerInfoCanvas)gc.push("transform")gc.origin() gc.clear(0,0,0,.3) gc.setLineWidth(4) - setFont(25) + setFont(20) local charging if state~="battery"then gc.setColor(1,1,1) @@ -893,6 +896,18 @@ function love.update(dt) FX_BGblock.tm=rnd(20,30) end end + for i=#texts,1,-1 do + local t=texts[i] + t.c=t.c+t.spd + if t.stop then + if t.c>t.stop then + t.c=t.stop + end + end + if t.c>60 then + rem(texts,i) + end + end if scene.swapping then local S=scene.swap S.time=S.time-1 @@ -900,6 +915,8 @@ function love.update(dt) scene.cur=S.tar scene.init(S.tar) widget_sel=nil + texts={} + collectgarbage() --此时场景切换 end if S.time==0 then @@ -923,7 +940,7 @@ function love.update(dt) for i=1,#Q do Q[i]=Q[i+1] end - end--放完后放下一个 + end--放完了,pop出下一个 else local n=1 local L=voiceBank[Q[1]] @@ -991,7 +1008,14 @@ function love.draw() gc.rectangle("fill",S[7],S[8],S[9],S[10],2) --开关/滑条残影 end - end--sysFXs + end--guiFXs + for i=1,#texts do + local t=texts[i] + local p=t.c + gc.setColor(1,1,1,p<.2 and p*5 or p<.8 and 1 or 5-p*5) + setFont(t.font) + t:draw() + end--Floating Texts if scene.swapping then scene.swap.draw(scene.swap.time) end--Swapping animation @@ -1007,7 +1031,7 @@ function love.draw() gc.rectangle("fill",1280,0,d,720) end--扁窗口 end--Black side - setFont(20) + setFont(15) gc.setColor(1,1,1) gc.print(FPS(),5,700) if devMode>0 then @@ -1027,14 +1051,14 @@ function love.run() local PUMP,POLL=love.event.pump,love.event.poll love.resize(gc.getWidth(),gc.getHeight()) scene.init("load")--Scene Launch - return function() + while true do PUMP() for N,a,b,c,d,e in POLL()do if N=="quit"then destroyPlayers() saveData() saveSetting() - return 0 + goto END elseif love[N]then love[N](a,b,c,d,e) end @@ -1058,6 +1082,7 @@ function love.run() lastFreshPow=Timer() end end + ::END:: end local fs=love.filesystem diff --git a/paint.lua b/paint.lua index 3a0a785d..b371c6ae 100644 --- a/paint.lua +++ b/paint.lua @@ -102,75 +102,6 @@ FX_BGblock={tm=150,next=7,ct=0,list={{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{ FX_attack={}--Attack beam FX_badge={}--Badge thrown sysFX={} -FX_ripple={}--Ripple&SqrShade -textFX={ - appear=function(t,a) - setFont(t.font) - gc.setColor(1,1,1,a) - mStr(t.text,150,250-t.font*.5+t.dy) - end, - fly=function(t,a) - setFont(t.font) - gc.setColor(1,1,1,a) - mStr(t.text,150+(t.t-15)^3*.005,250-t.font*.5+t.dy) - end, - stretch=function(t,a) - gc.push("transform") - setFont(t.font) - gc.translate(150,250+t.dy) - if t.t<20 then gc.scale((20-t.t)*.015+1,1)end - gc.setColor(1,1,1,a) - mStr(t.text,0,-t.font*.5) - gc.pop() - end, - drive=function(t,a) - gc.push("transform") - setFont(t.font) - gc.translate(150,290+t.dy) - if t.t<20 then gc.shear((20-t.t)*.05,0)end - gc.setColor(1,1,1,a) - mStr(t.text,0,-t.font*.5-15) - gc.pop() - end, - spin=function(t,a) - gc.push("transform") - setFont(t.font) - gc.translate(150,250+t.dy) - if t.t<20 then - gc.rotate((20-t.t)^2*.0015) - end - gc.setColor(1,1,1,a) - mStr(t.text,0,-t.font*.5-8) - gc.pop() - end, - flicker=function(t,a) - setFont(t.font) - gc.setColor(1,1,1,a*(rnd()+.5)) - mStr(t.text,150,225-t.font*.5+t.dy) - end, - zoomout=function(t,a) - gc.push("transform") - setFont(t.font) - local k=t.t^.5*.1+1 - gc.translate(150,290+t.dy) - gc.scale(k,k) - gc.setColor(1,1,1,a) - mStr(t.text,0,-t.font*.5-5) - gc.pop() - end, - beat=function(t,a) - gc.push("transform") - setFont(t.font) - gc.translate(150,290+t.dy) - if t.t<20 then - local k=.2*(5+(25-t.t)^.5)-.45 - gc.scale(k,k) - end - gc.setColor(1,1,1,a) - mStr(t.text,0,-t.font*.5-5) - gc.pop() - end, -} local function drawAtkPointer(x,y) local t=sin(Timer()*20) gc.setColor(.2,.7+t*.2,1,.6+t*.4) @@ -302,9 +233,9 @@ function Pnt.load() gc.rectangle("fill",300,330,loadprogress*680,60,5) gc.setColor(1,1,1) gc.rectangle("line",300,330,680,60,5) - setFont(40) + setFont(35) mStr(text.load[loading],640,335) - setFont(30) + setFont(25) mStr(loadTip,640,400) end function Pnt.intro() @@ -327,30 +258,30 @@ function Pnt.main() gc.setColor(1,1,1) gc.draw(coloredTitleImage,60,30,nil,1.3) gc.draw(drawableText.warning,595-drawableText.warning:getWidth(),128) - setFont(35) + setFont(30) gc.print(gameVersion,70,125) gc.print(system,610,100) gc.print(modes[modeID[modeSel]].level[levelSel],600,373) - setFont(30) + setFont(25) gc.print(text.modeName[modeSel],600,414) - players[1]:demoDraw() + players[1]:draw() end function Pnt.mode() gc.setColor(1,1,1) gc.draw(titleImage,830,30) - setFont(40) + setFont(35) local lv=modes[modeID[modeSel]].level[levelSel] gc.setColor(modeLevelColor[lv]or color.white) mStr(lv,270,215) - setFont(30) + setFont(25) gc.setColor(color.white) mStr(text.modeInfo[modeID[modeSel]],270,255) - setFont(80) + setFont(75) gc.setColor(color.grey) mStr(text.modeName[modeSel],643,273) for i=modeSel-2,modeSel+2 do if i>=1 and i<=#modeID then - local f=80-abs(i-modeSel)*20 + local f=75-abs(i-modeSel)*20 gc.setColor(i==modeSel and color.white or abs(i-modeSel)==1 and color.grey or color.darkGrey) setFont(f) mStr(text.modeName[i],640,310+70*(i-modeSel)-f*.5) @@ -365,13 +296,13 @@ function Pnt.music() gc.setColor(1,1,1) gc.draw(drawableText.musicRoom,22,23) gc.draw(drawableText.nowPlaying,490,390) - setFont(35) + setFont(30) for i=1,#musicID do gc.print(musicID[i],50,90+30*i) end gc.draw(titleImage,640,310,nil,1.5,nil,206,35) if bgmPlaying then - setFont(50) + setFont(45) gc.setColor(sin(Timer()*.5)*.2+.8,sin(Timer()*.7)*.2+.8,sin(Timer())*.2+.8) mStr(bgmPlaying or"",630,460) local t=-Timer()%2.3/2 @@ -386,7 +317,7 @@ function Pnt.custom() gc.rectangle("fill",25,95+40*sel,480,40) gc.setColor(.8,.8,.8)gc.draw(drawableText.custom,20,20) gc.setColor(1,1,1)gc.draw(drawableText.custom,22,23) - setFont(40) + setFont(35) for i=1,#customID do local k=customID[i] local y=90+40*i @@ -483,7 +414,7 @@ function Pnt.play() gc.setColor(.8,1,0,.2) for i=1,#P.atker do local p=P.atker[i] - gc.line(p.centerX,p.centerY,P.centerX,P.centerY) + gc.line(p.centerX,p.centerY,P.x+300*P.size,P.y+670*P.size) end if P.atkMode~=4 then if P.atking then drawAtkPointer(P.atking.centerX,P.atking.centerY)end @@ -495,7 +426,7 @@ function Pnt.play() end end if restartCount>0 then - gc.setColor(0,0,0,restartCount/20) + gc.setColor(0,0,0,restartCount*.05) gc.rectangle("fill",0,0,1280,720) end end @@ -504,7 +435,7 @@ function Pnt.pause() gc.setColor(0,0,0,pauseTimer*.015) gc.rectangle("fill",0,0,1280,720) gc.setColor(1,1,1,pauseTimer*.02) - setFont(30) + setFont(25) if pauseCount>0 then gc.print(text.pauseCount..":["..pauseCount.."] "..format("%0.2f",pauseTime).."s",110,150) end @@ -516,28 +447,28 @@ function Pnt.pause() gc.print(text.stat[i+3],860,30*i+30) gc.print(dataOpt(i),1050,30*i+30) end - setFont(40) + setFont(35) if system~="Android"then mStr(text.space.."/"..text.enter,640,190) mStr("Ctrl+R",640,351) gc.print("ESC",610,506) end - mDraw(gamefinished and drawableText.finish or drawableText.pause,640,60-10*(5-pauseTimer*.1)^1.5) + mDraw(gameResult and drawableText[gameResult]or drawableText.pause,640,60-10*(5-pauseTimer*.1)^1.5) end function Pnt.setting_game() gc.setColor(1,1,1) mDraw(drawableText.setting_game,640,15) - setFont(40) + setFont(35) mStr("DAS:"..setting.das,290,205) mStr("ARR:"..setting.arr,610,205) - setFont(28) + setFont(23) mStr(text.softdropdas..setting.sddas,290,323) mStr(text.softdroparr..setting.sdarr,610,323) end function Pnt.setting_graphic() gc.setColor(1,1,1) mDraw(drawableText.setting_graphic,640,15) - gc.draw(blockSkin[7-int(Timer()*2)%7],940,440,nil,2) + gc.draw(blockSkin[7-int(Timer()*2)%7],890,390,nil,2) end function Pnt.setting_sound() gc.setColor(1,1,1) @@ -567,7 +498,7 @@ function Pnt.setting_key() mDraw(drawableText.joystick,1140,35) gc.setColor(1,1,1) - setFont(31) + setFont(26) for N=1,20 do if N<11 then gc.printf(text.actName[N],47,45*N+22,180,"right") @@ -586,7 +517,7 @@ function Pnt.setting_key() for y=65,515,45 do gc.line(40,y,1240,y) end - setFont(40) + setFont(35) gc.print("Player:",170,590) gc.print(int(curBoard*.5+.5),300,590) gc.print(curBoard.."/8",580,590) @@ -613,12 +544,12 @@ function Pnt.setting_trackSetting() mDraw(drawableText.VKCurW,640+50*setting.VKCurW,380) end function Pnt.help() - setFont(30) + setFont(25) gc.setColor(1,1,1) for i=1,#text.help do gc.printf(text.help[i],140,10+40*i,1000,"center") end - setFont(24) + setFont(19) gc.print(text.used,30,330) gc.draw(titleImage,280,620,.1,1+.05*sin(Timer()*2),nil,206,35) gc.setLineWidth(5) @@ -627,13 +558,13 @@ function Pnt.help() gc.draw(payCode,20,20) gc.draw(groupCode,1080,20) gc.setColor(1,1,1,sin(Timer()*10)*.5+.5) - setFont(35) + setFont(30) mStr(text.support,150,283) - setFont(25) + setFont(20) mStr(text.group,1170,210) end function Pnt.stat() - setFont(28) + setFont(23) gc.setColor(1,1,1) for i=1,18 do gc.print(text.stat[i],400,30*i-5) @@ -647,7 +578,7 @@ function Pnt.history() gc.setColor(1,1,1) gc.setLineWidth(4) gc.rectangle("line",30,45,1000,632) - setFont(25) + setFont(20) for i=0,min(22,#updateLog-sel)do gc.print(updateLog[sel+i],40,50+27*(i)) end diff --git a/player.lua b/player.lua index 5ef1b441..91d63edb 100644 --- a/player.lua +++ b/player.lua @@ -52,7 +52,7 @@ local spin_n={[0]="spin_0","spin_1","spin_2","spin_3"} local clear_n={"clear_1","clear_2","clear_3","clear_4"} local ren_n={}for i=1,11 do ren_n[i]="ren_"..i end local blockPos={4,4,4,4,4,5,4} -local TMP1,TMP2,TMP3,TMP4={1,2},{2,1},{2,2},{1.5,1.5}----------save cache +local TMP1,TMP2,TMP3,TMP4={1,2},{2,1},{2,2},{1.5,1.5}----------"for save cache" local scs={ {[0]=TMP1,TMP2,TMP3,TMP3}, {[0]=TMP1,TMP2,TMP3,TMP3}, @@ -194,7 +194,7 @@ TMP1[2]=TMP1[1] TMP1[4]=TMP1[3] TMP1[5]=TMP1[3] local finesseCtrlPar=TMP1 -TMP1,TMP2,TMP3,TMP4=nil----------release +TMP1,TMP2,TMP3,TMP4=nil----------"release cache" local CCblockID={4,3,5,6,1,2,0} local freshMethod={ none=NULL, @@ -217,7 +217,7 @@ local freshMethod={ end, rnd=function(P) ::L::local i=rnd(7) - if i==P.next[5]then goto L end + if i==P.next[5].id then goto L end P:newNext(i) end,--random drought1=function(P) @@ -271,8 +271,9 @@ function newDemoPlayer(id,x,y,size) P.x,P.y,P.size=x,y,size P.fieldOff={x=0,y=0,vx=0,vy=0} P.small,P.keyRec=false,false + P.draw=P.draw_demo - P.centerX,P.centerY=P.x+300*P.size,P.y+670*P.size + P.centerX,P.centerY=P.x+300*P.size,P.y+600*P.size P.absFieldX=P.x+150*P.size P.absFieldY=P.y+60*P.size @@ -387,10 +388,12 @@ function newPlayer(id,x,y,size,AIdata) P.centerX,P.centerY=P.x+300*P.size,P.y+600*P.size P.canvas=love.graphics.newCanvas(60,120) P.frameWait=rnd(30,120) + P.draw=P.draw_small else - P.centerX,P.centerY=P.x+300*P.size,P.y+670*P.size + P.centerX,P.centerY=P.x+300*P.size,P.y+370*P.size P.absFieldX=P.x+150*P.size P.absFieldY=P.y+60*P.size + P.draw=P.draw_norm end P.alive=true @@ -717,14 +720,15 @@ function player.update(P,dt) end--field shaking for i=#P.bonus,1,-1 do - local b=P.bonus[i] - if b.inf then - if b.t<30 then - b.t=b.t+.5 + local t=P.bonus[i] + t.c=t.c+t.spd + if t.stop then + if t.c>t.stop then + t.c=t.stop end - else - b.t=b.t+b.speed - if b.t>=60 then rem(P.bonus,i)end + end + if t.c>60 then + rem(P.bonus,i) end end @@ -746,280 +750,283 @@ function player.update(P,dt) PTC.dust[P.id]:update(dt) end end -function player.draw(P) - if P.small then - P.frameWait=P.frameWait-1 - if P.frameWait==0 then - P.frameWait=8 - gc.setCanvas(P.canvas) - gc.clear(0,0,0,.4) - gc.push("transform") - gc.origin() - gc.setColor(1,1,1,P.result and max(20-P.endCounter,0)*.05 or 1) - local F=P.field - for j=1,#F do - for i=1,10 do if F[j][i]>0 then - gc.draw(blockSkinmini[F[j][i]],6*i-6,120-6*j) +function player.draw_norm(P) + gc.push("transform") + gc.translate(P.x,P.y)gc.scale(P.size) + --Camera + gc.setColor(0,0,0,.6)gc.rectangle("fill",0,0,600,690) + gc.setLineWidth(7)gc.setColor(frameColor[P.strength])gc.rectangle("line",0,0,600,690,3) + --Frame + gc.translate(150+P.fieldOff.x,70+P.fieldOff.y) + if P.gameEnv.grid then + gc.setLineWidth(1) + gc.setColor(1,1,1,.2) + for x=1,9 do gc.line(30*x,-10,30*x,600)end + for y=0,19 do + y=30*(y-int(P.fieldBeneath/30))+P.fieldBeneath + gc.line(0,y,300,y) + end + end--Grid + gc.translate(0,P.fieldBeneath) + gc.setScissor(scr.x+(P.absFieldX+P.fieldOff.x)*scr.k,scr.y+(P.absFieldY+P.fieldOff.y)*scr.k,300*P.size*scr.k,610*P.size*scr.k) + if P.falling==-1 then + for j=int(P.fieldBeneath/30+1),#P.field do + for i=1,10 do + if P.field[j][i]>0 then + gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1)) + drawPixel(j,i,P.field[j][i]) + end + end + end + else--field block only + local dy,stepY=0,setting.smo and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30 + local A=P.falling/P.gameEnv.fall + local h,H=1,#P.field + for j=int(P.fieldBeneath/30+1),H do + while j==P.clearing[h]do + h=h+1 + dy=dy+stepY + gc.translate(0,-stepY) + gc.setColor(1,1,1,A) + gc.rectangle("fill",0,630-30*j,300,stepY) + end + for i=1,10 do + if P.field[j][i]>0 then + gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1)) + drawPixel(j,i,P.field[j][i]) + end + end + end + gc.translate(0,dy) + end--Field with falling animation + for i=1,#P.shade do + local S=P.shade[i] + gc.setColor(1,1,1,S[1]*.12) + for x=S[3],S[5]do + for y=S[6],S[4]do + drawPixel(y,x,S[2]) + end + end + end--shade FX + if P.waiting==-1 then + if P.gameEnv.ghost then + gc.setColor(1,1,1,.3) + for i=1,P.r do for j=1,P.c do + if P.cur.bk[i][j]then + drawPixel(i+P.y_img-1,j+P.curX-1,P.cur.color) + end end end - end--Field - if P.alive then - gc.setLineWidth(2) - gc.setColor(frameColor[P.strength])gc.rectangle("line",1,1,58,118) - end--Draw boarder - if modeEnv.royaleMode then - gc.setColor(1,1,1) - for i=1,P.strength do - gc.draw(badgeIcon,12*i-7,4,nil,.5) - end - end - if P.result then - gc.setColor(1,1,1,min(P.endCounter,60)*.01) - setFont(22)mStr(P.result,32,47) - setFont(20)mStr(P.rank,30,82) - end - gc.pop() - gc.setCanvas() - --draw content - end - gc.setColor(1,1,1) - gc.draw(P.canvas,P.x,P.y,nil,P.size*10) - if P.killMark then - gc.setLineWidth(3) - gc.setColor(1,0,0,min(P.endCounter,25)*.04) - gc.circle("line",P.centerX,P.centerY,(840-20*min(P.endCounter,30))*P.size) - end - --draw Canvas - else - gc.push("transform") - gc.translate(P.x,P.y)gc.scale(P.size) - --Camera - gc.setColor(0,0,0,.6)gc.rectangle("fill",0,0,600,690) - gc.setLineWidth(7)gc.setColor(frameColor[P.strength])gc.rectangle("line",0,0,600,690,3) - --Frame - gc.translate(150+P.fieldOff.x,70+P.fieldOff.y) - if P.gameEnv.grid then - gc.setLineWidth(1) - gc.setColor(1,1,1,.2) - for x=1,9 do gc.line(30*x,-10,30*x,600)end - for y=0,19 do - y=30*(y-int(P.fieldBeneath/30))+P.fieldBeneath - gc.line(0,y,300,y) - end - end--Grid - gc.translate(0,P.fieldBeneath) - gc.setScissor(scr.x+(P.absFieldX+P.fieldOff.x)*scr.k,scr.y+(P.absFieldY+P.fieldOff.y)*scr.k,300*P.size*scr.k,610*P.size*scr.k) - if P.falling==-1 then - for j=int(P.fieldBeneath/30+1),#P.field do - for i=1,10 do - if P.field[j][i]>0 then - gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1)) - drawPixel(j,i,P.field[j][i]) - end - end - end - else--field block only - local dy,stepY=0,setting.smo and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30 - local A=P.falling/P.gameEnv.fall - local h,H=1,#P.field - for j=int(P.fieldBeneath/30+1),H do - while j==P.clearing[h]do - h=h+1 - dy=dy+stepY - gc.translate(0,-stepY) - gc.setColor(1,1,1,A) - gc.rectangle("fill",0,630-30*j,300,stepY) - end - for i=1,10 do - if P.field[j][i]>0 then - gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1)) - drawPixel(j,i,P.field[j][i]) - end - end - end - gc.translate(0,dy) - end--Field with falling animation - for i=1,#P.shade do - local S=P.shade[i] - gc.setColor(1,1,1,S[1]*.12) - for x=S[3],S[5]do - for y=S[6],S[4]do - drawPixel(y,x,S[2]) - end - end - end--shade FX - if P.waiting==-1 then - if P.gameEnv.ghost then - gc.setColor(1,1,1,.3) - for i=1,P.r do for j=1,P.c do - if P.cur.bk[i][j]then - drawPixel(i+P.y_img-1,j+P.curX-1,P.cur.color) - end - end end - end--Ghost - -- local dy=setting.smo and(P.y_img~=P.curY and or 1)^4*30 or 0 - local dy - if setting.smo then - if P.y_img~=P.curY then - dy=(min(P.dropDelay,1e99)/P.gameEnv.drop-1)*30 - else - dy=0 - end - --[[ - if P.y_img~=P.curY then - dy=(min(P.dropDelay,8e98)/P.gameEnv.drop)^4*30 - else - dy=(min(P.lockDelay,8e98)/P.gameEnv.lock)^(P.gameEnv._20G and 3 or 7)*30 - end - ]] + end--Ghost + -- local dy=setting.smo and(P.y_img~=P.curY and or 1)^4*30 or 0 + local dy + if setting.smo then + if P.y_img~=P.curY then + dy=(min(P.dropDelay,1e99)/P.gameEnv.drop-1)*30 else dy=0 end - gc.translate(0,-dy) - local trans=P.lockDelay/P.gameEnv.lock - if P.gameEnv.block then - gc.setColor(1,1,1,trans) - for i=1,P.r do for j=1,P.c do - if P.cur.bk[i][j]then - gc.rectangle("fill",30*(j+P.curX-1)-33,597-30*(i+P.curY-1),36,36) - end - end end--BlockShade(lockdelay indicator) - gc.setColor(1,1,1) - for i=1,P.r do for j=1,P.c do - if P.cur.bk[i][j]then - drawPixel(i+P.curY-1,j+P.curX-1,P.cur.color) - end - end end--Block - end - if P.gameEnv.center then - gc.setColor(1,1,1,trans) - local x=30*(P.curX+P.sc[2]-1)-15 - gc.draw(spinCenter,x,600-30*(P.curY+P.sc[1]-1)+15,nil,nil,nil,4,4) - gc.translate(0,dy) - gc.setColor(1,1,1,.5) - gc.draw(spinCenter,x,600-30*(P.y_img+P.sc[1]-1)+15,nil,nil,nil,4,4) - goto E - end--Rotate center - gc.translate(0,dy) - end - ::E:: - gc.setScissor()--In-playField things - gc.setColor(1,1,1) - gc.draw(PTC.dust[P.id]) - gc.translate(0,-P.fieldBeneath) - gc.setBlendMode("replace","alphamultiply")--SPEED UPUP(?) - gc.setLineWidth(2) - gc.rectangle("line",-1,-11,302,612)--Draw boarder - gc.rectangle("line",301,0,15,601)--Draw atkBuffer boarder - local h=0 - for i=1,#P.atkBuffer do - local A=P.atkBuffer[i] - local bar=A.amount*30 - if h+bar>600 then bar=600-h end - if not A.sent then - if A.time<20 then - bar=bar*(20*A.time)^.5*.05 - --Appear - end - if A.countdown>0 then - gc.setColor(attackColor[A.lv][1]) - gc.rectangle("fill",303,599-h,11,-bar+3) - gc.setColor(attackColor[A.lv][2]) - gc.rectangle("fill",303,599-h+(-bar+3),11,-(-bar+3)*(1-A.countdown/A.cd0)) - --Timing - else - local t=math.sin((Timer()-i)*30)*.5+.5 - local c1,c2=attackColor[A.lv][1],attackColor[A.lv][2] - gc.setColor(c1[1]*t+c2[1]*(1-t),c1[2]*t+c2[2]*(1-t),c1[3]*t+c2[3]*(1-t)) - gc.rectangle("fill",303,599-h,11,-bar+3) - --Warning - end + --[[ + if P.y_img~=P.curY then + dy=(min(P.dropDelay,8e98)/P.gameEnv.drop)^4*30 else - gc.setColor(attackColor[A.lv][1]) - bar=bar*(20-A.time)*.05 - gc.rectangle("fill",303,599-h,11,-bar+2) - --Disappear + dy=(min(P.lockDelay,8e98)/P.gameEnv.lock)^(P.gameEnv._20G and 3 or 7)*30 end - h=h+bar - end--Buffer line - local a,b=P.b2b,P.b2b1 if a>b then a,b=b,a end - gc.setColor(.8,1,.2) - gc.rectangle("fill",-14,599,11,-b*.5) - gc.setColor(P.b2b<40 and color.white or P.b2b<=1e3 and color.lightRed or color.lightBlue) - gc.rectangle("fill",-14,599,11,-a*.5) - gc.setColor(1,1,1) - if Timer()%.5<.3 then - gc.rectangle("fill",-15,b<40 and 578.5 or 98.5,13,3) + ]] + else + dy=0 end - gc.rectangle("line",-16,-3,15,604)--Draw b2b bar boarder - --B2B indictator - gc.translate(-P.fieldOff.x,-P.fieldOff.y) - gc.setBlendMode("alpha") - - if P.gameEnv.hold then - mDraw(drawableText.hold,-82,-10) - if P.holded then gc.setColor(.6,.5,.5)end - local B=P.hd.bk - for i=1,#B do for j=1,#B[1]do - if B[i][j]then - drawPixel(i+17.5-#B*.5,j-2.7-#B[1]*.5,P.hd.color) - end - end end - end--Hold - gc.setColor(1,1,1) - mDraw(drawableText.next,381,-10) - local N=1 - ::L:: - if N<=P.gameEnv.next and P.next[N]then - local b,c=P.next[N].bk,P.next[N].color - for i=1,#b do for j=1,#b[1] do - if b[i][j]then - drawPixel(i+20-2.4*N-#b*.5,j+12.7-#b[1]*.5,c) - end - end end - N=N+1 - goto L + gc.translate(0,-dy) + local trans=P.lockDelay/P.gameEnv.lock + if P.gameEnv.block then + gc.setColor(1,1,1,trans) + for i=1,P.r do for j=1,P.c do + if P.cur.bk[i][j]then + gc.rectangle("fill",30*(j+P.curX-1)-33,597-30*(i+P.curY-1),36,36) + end + end end--BlockShade(lockdelay indicator) + gc.setColor(1,1,1) + for i=1,P.r do for j=1,P.c do + if P.cur.bk[i][j]then + drawPixel(i+P.curY-1,j+P.curX-1,P.cur.color) + end + end end--Block + end + if P.gameEnv.center then + gc.setColor(1,1,1,trans) + local x=30*(P.curX+P.sc[2]-1)-15 + gc.draw(spinCenter,x,600-30*(P.curY+P.sc[1]-1)+15,nil,nil,nil,4,4) + gc.translate(0,dy) + gc.setColor(1,1,1,.5) + gc.draw(spinCenter,x,600-30*(P.y_img+P.sc[1]-1)+15,nil,nil,nil,4,4) + goto E + end--Rotate center + gc.translate(0,dy) end - --Next - gc.setColor(.8,.8,.8) - gc.draw(drawableText.modeName,-135,-65) - gc.draw(drawableText.levelName,437-drawableText.levelName:getWidth(),-65) - gc.setColor(1,1,1) - if frame<180 then - local count=179-frame - gc.push("transform") - gc.translate(155,220) - setFont(100) - if count%60>45 then gc.scale(1+(count%60-45)^2*.01,1)end - mStr(int(count/60+1),0,0) - gc.pop() - end--Draw starting counter - for i=1,#P.bonus do - P.bonus[i]:draw(min((30-abs(P.bonus[i].t-30))*.05,1)*(not P.bonus[i].inf and #P.field>(9-P.bonus[i].dy*.0333)and .7 or 1)) - end--Effects - setFont(30) - gc.setColor(1,1,1) - mStr(format("%.2f",P.stat.time),-82,518)--Time - mStr(P.score1,-82,560)--Score - gc.draw(drawableText.bpm,390,490) - gc.draw(drawableText.kpm,350,583) - setFont(30) - drawDial(360,520,P.dropSpeed) - drawDial(405,575,P.keySpeed) - --Speed dials - gc.setColor(1,1,1) - modes[curMode.id].mesDisp(P)--Other messages - if modeEnv.royaleMode then - if P.atkMode then - gc.setColor(1,.8,0,P.swappingAtkMode*.02) - gc.rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4) + ::E:: + gc.setScissor()--In-playField things + gc.setColor(1,1,1) + gc.draw(PTC.dust[P.id]) + gc.translate(0,-P.fieldBeneath) + gc.setBlendMode("replace","alphamultiply")--SPEED UPUP(?) + gc.setLineWidth(2) + gc.rectangle("line",-1,-11,302,612)--Draw boarder + gc.rectangle("line",301,0,15,601)--Draw atkBuffer boarder + local h=0 + for i=1,#P.atkBuffer do + local A=P.atkBuffer[i] + local bar=A.amount*30 + if h+bar>600 then bar=600-h end + if not A.sent then + if A.time<20 then + bar=bar*(20*A.time)^.5*.05 + --Appear + end + if A.countdown>0 then + gc.setColor(attackColor[A.lv][1]) + gc.rectangle("fill",303,599-h,11,-bar+3) + gc.setColor(attackColor[A.lv][2]) + gc.rectangle("fill",303,599-h+(-bar+3),11,-(-bar+3)*(1-A.countdown/A.cd0)) + --Timing + else + local t=math.sin((Timer()-i)*30)*.5+.5 + local c1,c2=attackColor[A.lv][1],attackColor[A.lv][2] + gc.setColor(c1[1]*t+c2[1]*(1-t),c1[2]*t+c2[2]*(1-t),c1[3]*t+c2[3]*(1-t)) + gc.rectangle("fill",303,599-h,11,-bar+3) + --Warning + end + else + gc.setColor(attackColor[A.lv][1]) + bar=bar*(20-A.time)*.05 + gc.rectangle("fill",303,599-h,11,-bar+2) + --Disappear end - gc.setColor(1,1,1,P.swappingAtkMode*.025) - gc.draw(royaleCtrlPad) + h=h+bar + end--Buffer line + local a,b=P.b2b,P.b2b1 if a>b then a,b=b,a end + gc.setColor(.8,1,.2) + gc.rectangle("fill",-14,599,11,-b*.5) + gc.setColor(P.b2b<40 and color.white or P.b2b<=1e3 and color.lightRed or color.lightBlue) + gc.rectangle("fill",-14,599,11,-a*.5) + gc.setColor(1,1,1) + if Timer()%.5<.3 then + gc.rectangle("fill",-15,b<40 and 578.5 or 98.5,13,3) + end + gc.rectangle("line",-16,-3,15,604)--Draw b2b bar boarder + --B2B indictator + gc.translate(-P.fieldOff.x,-P.fieldOff.y) + gc.setBlendMode("alpha") + + if P.gameEnv.hold then + mDraw(drawableText.hold,-82,-10) + if P.holded then gc.setColor(.6,.5,.5)end + local B=P.hd.bk + for i=1,#B do for j=1,#B[1]do + if B[i][j]then + drawPixel(i+17.5-#B*.5,j-2.7-#B[1]*.5,P.hd.color) + end + end end + end--Hold + gc.setColor(1,1,1) + mDraw(drawableText.next,381,-10) + local N=1 + ::L:: + if N<=P.gameEnv.next and P.next[N]then + local b,c=P.next[N].bk,P.next[N].color + for i=1,#b do for j=1,#b[1] do + if b[i][j]then + drawPixel(i+20-2.4*N-#b*.5,j+12.7-#b[1]*.5,c) + end + end end + N=N+1 + goto L + end + --Next + gc.setColor(.8,.8,.8) + gc.draw(drawableText.modeName,-135,-65) + gc.draw(drawableText.levelName,437-drawableText.levelName:getWidth(),-65) + gc.setColor(1,1,1) + if frame<180 then + local count=179-frame + gc.push("transform") + gc.translate(155,220) + setFont(95) + if count%60>45 then gc.scale(1+(count%60-45)^2*.01,1)end + mStr(int(count/60+1),0,0) + gc.pop() + end--Draw starting counter + for i=1,#P.bonus do + local t=P.bonus[i] + local p=t.c + gc.setColor(1,1,1,p<.2 and p*5 or p<.8 and 1 or 5-p*5) + setFont(t.font) + t:draw() + end--Bonus texts + setFont(25) + gc.setColor(1,1,1) + mStr(format("%.2f",P.stat.time),-82,518)--Time + mStr(P.score1,-82,560)--Score + gc.draw(drawableText.bpm,390,490) + gc.draw(drawableText.kpm,350,583) + setFont(25) + drawDial(360,520,P.dropSpeed) + drawDial(405,575,P.keySpeed) + --Speed dials + gc.setColor(1,1,1) + modes[curMode.id].mesDisp(P)--Other messages + if modeEnv.royaleMode then + if P.atkMode then + gc.setColor(1,.8,0,P.swappingAtkMode*.02) + gc.rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4) + end + gc.setColor(1,1,1,P.swappingAtkMode*.025) + gc.draw(royaleCtrlPad) + end + gc.pop() +end +function player.draw_small(P) + P.frameWait=P.frameWait-1 + if P.frameWait==0 then + P.frameWait=8 + gc.setCanvas(P.canvas) + gc.clear(0,0,0,.4) + gc.push("transform") + gc.origin() + gc.setColor(1,1,1,P.result and max(20-P.endCounter,0)*.05 or 1) + local F=P.field + for j=1,#F do + for i=1,10 do if F[j][i]>0 then + gc.draw(blockSkinmini[F[j][i]],6*i-6,120-6*j) + end end + end--Field + if P.alive then + gc.setLineWidth(2) + gc.setColor(frameColor[P.strength])gc.rectangle("line",1,1,58,118) + end--Draw boarder + if modeEnv.royaleMode then + gc.setColor(1,1,1) + for i=1,P.strength do + gc.draw(badgeIcon,12*i-7,4,nil,.5) + end + end + if P.result then + gc.setColor(1,1,1,min(P.endCounter,60)*.01) + setFont(17)mStr(P.result,32,47) + setFont(15)mStr(P.rank,30,82) end gc.pop() + gc.setCanvas() + --draw content + end + gc.setColor(1,1,1) + gc.draw(P.canvas,P.x,P.y,nil,P.size*10) + --draw Canvas + if P.killMark then + gc.setLineWidth(3) + gc.setColor(1,0,0,min(P.endCounter,25)*.04) + gc.circle("line",P.centerX,P.centerY,(840-20*min(P.endCounter,30))*P.size) end end -function player.demoDraw(P) +function player.draw_demo(P) gc.push("transform") gc.translate(P.x,P.y)gc.scale(P.size)gc.translate(P.fieldOff.x,P.fieldOff.y) --Camera @@ -1098,25 +1105,30 @@ function player.demoDraw(P) gc.draw(PTC.dust[P.id]) gc.translate(-P.fieldOff.x,-P.fieldOff.y) for i=1,#P.bonus do - P.bonus[i]:draw(min((30-abs(P.bonus[i].t-30))*.05,1)*(not P.bonus[i].inf and #P.field>(9-P.bonus[i].dy*.0333)and .7 or 1)) - end--Effects + local t=P.bonus[i] + local p=t.c + gc.setColor(1,1,1,p<.2 and p*5 or p<.8 and 1 or 5-p*5) + setFont(t.font) + t:draw() + end gc.pop() end -------------------------------------------------- -function player:showText(text,type,font,dy,spd,inf) - if not self.small then - self.bonus[#self.bonus+1]={t=0,text=text,draw=textFX[type],font=font,dy=dy or 0,speed=spd or 1,inf=inf} +local textFX=textFX +function player.showText(P,text,dx,dy,font,style,spd,stop) + if not P.small then + P.bonus[#P.bonus+1]=getTEXT(text,150+dx,300+dy,font*P.size,style,spd,stop) end end -function player:createShade(x1,y1,x2,y2)--x1y2 - if self.gameEnv.block and y1>=y2 then - self.shade[#self.shade+1]={5,self.cur.color,x1,y1,x2,y2} +function player.createShade(P,x1,y1,x2,y2)--x1y2! + if P.gameEnv.block and y1>=y2 then + P.shade[#P.shade+1]={5,P.cur.color,x1,y1,x2,y2} end end -function player:createBeam(R,send,time,target,color,clear,spin,mini,combo) +function player.createBeam(P,R,send,time,target,color,clear,spin,mini,combo) local x1,y1,x2,y2 - if self.small then x1,y1=self.centerX,self.centerY - else x1,y1=self.x+(30*(self.curX+self.sc[2]-1)-30+15+150)*self.size,self.y+(600-30*(self.curY+self.sc[1]-1)+15+70)*self.size + if P.small then x1,y1=P.centerX,P.centerY + else x1,y1=P.x+(30*(P.curX+P.sc[2]-1)-30+15+150)*P.size,P.y+(600-30*(P.curY+P.sc[1]-1)+15+70)*P.size end if R.small then x2,y2=R.centerX,R.centerY else x2,y2=R.x+308*R.size,R.y+450*R.size @@ -1160,7 +1172,7 @@ function player:createBeam(R,send,time,target,color,clear,spin,mini,combo) g=1-g*.3 b=1-b*.3 end - if modeEnv.royaleMode and not(self.human or R.human)then + if modeEnv.royaleMode and not(P.human or R.human)then radius=radius*.4 a=.35 end @@ -1233,25 +1245,25 @@ local function getBlockDirection(P) return(P.curX+P.sc[2]-6.5)*.15 end -function player:fineError(rate) - self.stat.extraPiece=self.stat.extraPiece+1 - self.stat.extraRate=self.stat.extraRate+rate - if self.human then - if self.gameEnv.fineKill then +function player.fineError(P,rate) + P.stat.extraPiece=P.stat.extraPiece+1 + P.stat.extraRate=P.stat.extraRate+rate + if P.human then + if P.gameEnv.fineKill then SFX("error_long") - Event.lose(self) + Event.lose(P) elseif setting.fine then SFX("error") end - elseif self.gameEnv.fineKill then - Event.lose(self) + elseif P.gameEnv.fineKill then + Event.lose(P) end end -function player:garbageSend(R,send,time,...) +function player.garbageSend(P,R,send,time,...) if setting.atkFX>0 then - self:createBeam(R,send,time,...) + P:createBeam(R,send,time,...) end - R.lastRecv=self + R.lastRecv=P if R.atkBuffer.sum<20 then local B=R.atkBuffer if B.sum+send>20 then send=20-B.sum end--no more then 20 @@ -1276,15 +1288,15 @@ function player:garbageSend(R,send,time,...) end end end -function player:garbageRelease() +function player.garbageRelease(P) local n,flag=1 ::L:: - local A=self.atkBuffer[n] + local A=P.atkBuffer[n] if A and A.countdown<=0 and not A.sent then - self:garbageRise(8+A.lv,A.amount,A.pos) - self.atkBuffer.sum=self.atkBuffer.sum-A.amount + P:garbageRise(8+A.lv,A.amount,A.pos) + P.atkBuffer.sum=P.atkBuffer.sum-A.amount A.sent,A.time=true,0 - self.stat.pend=self.stat.pend+A.amount + P.stat.pend=P.stat.pend+A.amount n=n+1 flag=true else @@ -1292,65 +1304,65 @@ function player:garbageRelease() end goto L ::E:: - if flag and self.AI_mode=="CC"then CC_updateField(self)end + if flag and P.AI_mode=="CC"then CC_updateField(P)end end -function player:garbageRise(color,amount,pos) - local t=self.showTime*2 +function player.garbageRise(P,color,amount,pos) + local t=P.showTime*2 for _=1,amount do - ins(self.field,1,getNewRow(color)) - ins(self.visTime,1,getNewRow(t)) - self.field[1][pos]=0 + ins(P.field,1,getNewRow(color)) + ins(P.visTime,1,getNewRow(t)) + P.field[1][pos]=0 end - self.fieldBeneath=self.fieldBeneath+amount*30 - self.curY=self.curY+amount - self:freshgho() - for i=1,#self.clearing do - self.clearing[i]=self.clearing[i]+amount + P.fieldBeneath=P.fieldBeneath+amount*30 + P.curY=P.curY+amount + P:freshgho() + for i=1,#P.clearing do + P.clearing[i]=P.clearing[i]+amount end - for i=1,#self.shade do - local S=self.shade[i] + for i=1,#P.shade do + local S=P.shade[i] S[4],S[6]=S[4]+amount,S[6]+amount end - if #self.field>40 then Event.lose(self)end + if #P.field>40 then Event.lose(P)end end -function player:freshTarget() - if self.atkMode==1 then - if not self.atking or not self.atking.alive or rnd()<.1 then - self:changeAtk(randomTarget(self)) +function player.freshTarget(P) + if P.atkMode==1 then + if not P.atking or not P.atking.alive or rnd()<.1 then + P:changeAtk(randomTarget(P)) end - elseif self.atkMode==2 then - self:changeAtk(self~=mostBadge and mostBadge or secBadge or randomTarget(self)) - elseif self.atkMode==3 then - self:changeAtk(self~=mostDangerous and mostDangerous or secDangerous or randomTarget(self)) - elseif self.atkMode==4 then - for i=1,#self.atker do - if not self.atker[i].alive then - rem(self.atker,i) + elseif P.atkMode==2 then + P:changeAtk(P~=mostBadge and mostBadge or secBadge or randomTarget(P)) + elseif P.atkMode==3 then + P:changeAtk(P~=mostDangerous and mostDangerous or secDangerous or randomTarget(P)) + elseif P.atkMode==4 then + for i=1,#P.atker do + if not P.atker[i].alive then + rem(P.atker,i) return end end end end -function player:changeAtkMode(m) - if self.atkMode==m then return end - self.atkMode=m +function player.changeAtkMode(P,m) + if P.atkMode==m then return end + P.atkMode=m if m==1 then - self:changeAtk(randomTarget(self)) + P:changeAtk(randomTarget(P)) elseif m==2 then - self:freshTarget() + P:freshTarget() elseif m==3 then - self:freshTarget() + P:freshTarget() elseif m==4 then - self:changeAtk() + P:changeAtk() end ::L:: end -function player:changeAtk(R) - -- if not self.human then R=players[1]end--Delete first "--" to enable 1vALL mode - if self.atking then - local K=self.atking.atker +function player.changeAtk(P,R) + -- if not P.human then R=players[1]end--Delete first "--" to enable 1vALL mode + if P.atking then + local K=P.atking.atker for i=1,#K do - if K[i]==self then + if K[i]==P then rem(K,i) goto L end @@ -1358,186 +1370,186 @@ function player:changeAtk(R) end ::L:: if R then - self.atking=R - R.atker[#R.atker+1]=self + P.atking=R + R.atker[#R.atker+1]=P else - self.atking=nil + P.atking=nil end end -function player:freshgho() - self.y_img=min(#self.field+1,self.curY) - if self.gameEnv._20G or self.keyPressing[7]and self.gameEnv.sdarr==0 then - while not ifoverlap(self,self.cur.bk,self.curX,self.y_img-1)do - self.y_img=self.y_img-1 - self.spinLast=false +function player.freshgho(P) + P.y_img=min(#P.field+1,P.curY) + if P.gameEnv._20G or P.keyPressing[7]and P.gameEnv.sdarr==0 then + while not ifoverlap(P,P.cur.bk,P.curX,P.y_img-1)do + P.y_img=P.y_img-1 + P.spinLast=false end - if self.curY>self.y_img then - if not self.small then + if P.curY>P.y_img then + if not P.small then if setting.dropFX>0 then - self:createShade(self.curX,self.curY+1,self.curX+self.c-1,self.y_img+self.r-1) + P:createShade(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1) end - self.fieldOff.vy=setting.shakeFX*.8 + P.fieldOff.vy=setting.shakeFX*.8 end - self.curY=self.y_img + P.curY=P.y_img end else - while not ifoverlap(self,self.cur.bk,self.curX,self.y_img-1)do - self.y_img=self.y_img-1 + while not ifoverlap(P,P.cur.bk,P.curX,P.y_img-1)do + P.y_img=P.y_img-1 end end end -function player:freshLockDelay() - if self.lockDelay - if self.cur.id==6 then - if self.gameEnv.easyFresh then - self:freshLockDelay() + if P.cur.id==6 then + if P.gameEnv.easyFresh then + P:freshLockDelay() end - if self.gameEnv.ospin then - if self.curY==self.y_img then - self.spinSeq=self.spinSeq%100*10+d - local x,y=self.curX,self.curY + if P.gameEnv.ospin then + if P.curY==P.y_img then + P.spinSeq=P.spinSeq%100*10+d + local x,y=P.curX,P.curY local id - if self.spinSeq==313 then--Z - if solid(self,x-1,y)and solid(self,x+2,y)then - if solid(self,x-1,y+2)and not solid(self,x-1,y+1)then--嵌 - self.curX=x-1 - self.dir=2 + if P.spinSeq==313 then--Z + if solid(P,x-1,y)and solid(P,x+2,y)then + if solid(P,x-1,y+2)and not solid(P,x-1,y+1)then--嵌 + P.curX=x-1 + P.dir=2 id=1 - elseif not solid(self,x+1,y-1)and not solid(self,x+2,y-1)then--压 - self.curY=y-1 - self.dir=2 + elseif not solid(P,x+1,y-1)and not solid(P,x+2,y-1)then--压 + P.curY=y-1 + P.dir=2 id=1 end end - elseif self.spinSeq==131 then--S - if solid(self,x-1,y)and solid(self,x+2,y)then - if solid(self,x+2,y+2)and not solid(self,x+2,y+1)then--嵌 - self.dir=2 + elseif P.spinSeq==131 then--S + if solid(P,x-1,y)and solid(P,x+2,y)then + if solid(P,x+2,y+2)and not solid(P,x+2,y+1)then--嵌 + P.dir=2 id=2 - elseif not solid(self,x,y-1)and not solid(self,x-1,y-1)then--压 - self.curY=y-1 - self.curX=x-1 - self.dir=2 + elseif not solid(P,x,y-1)and not solid(P,x-1,y-1)then--压 + P.curY=y-1 + P.curX=x-1 + P.dir=2 id=2 end end - elseif self.spinSeq==331 then--L - if solid(self,x-1,y+1)and solid(self,x+2,y+1)then - if solid(self,x+2,y)and not solid(self,x-1,y)then--钩 - self.curX=x-1 - self.dir=0 + elseif P.spinSeq==331 then--L + if solid(P,x-1,y+1)and solid(P,x+2,y+1)then + if solid(P,x+2,y)and not solid(P,x-1,y)then--钩 + P.curX=x-1 + P.dir=0 id=3 - elseif not solid(self,x,y-1)and not solid(self,x+2,y)then--扣 - self.curY=y-1 - self.dir=2 + elseif not solid(P,x,y-1)and not solid(P,x+2,y)then--扣 + P.curY=y-1 + P.dir=2 id=3 end end - elseif self.spinSeq==113 then--J - if solid(self,x+2,y+1)and solid(self,x-2,y+1)then - if solid(self,x-2,y)and not solid(self,x+2,y)then--钩 - self.dir=0 + elseif P.spinSeq==113 then--J + if solid(P,x+2,y+1)and solid(P,x-2,y+1)then + if solid(P,x-2,y)and not solid(P,x+2,y)then--钩 + P.dir=0 id=4 - elseif not solid(self,x+1,y-1)and not solid(self,x-1,y)then--扣 - self.curX=x-1 - self.curY=y-1 - self.dir=2 + elseif not solid(P,x+1,y-1)and not solid(P,x-1,y)then--扣 + P.curX=x-1 + P.curY=y-1 + P.dir=2 id=4 end end - elseif self.spinSeq==111 then--T-R - if solid(self,x+2,y+1)and solid(self,x-1,y+1)and solid(self,x+2,y)and not solid(self,x-1,y)then - if solid(self,x,y-1)then--钩 - self.curX=x-1 - self.dir=0 + elseif P.spinSeq==111 then--T-R + if solid(P,x+2,y+1)and solid(P,x-1,y+1)and solid(P,x+2,y)and not solid(P,x-1,y)then + if solid(P,x,y-1)then--钩 + P.curX=x-1 + P.dir=0 id=5 else--转 - self.curY=y-1 - self.dir=1 + P.curY=y-1 + P.dir=1 id=5 end end - elseif self.spinSeq==333 then--T-L - if solid(self,x-1,y+1)and solid(self,x-1,y)and solid(self,x+2,y+1)and not solid(self,x+2,y)then - if solid(self,x+1,y-1)then--钩 - self.dir=0 + elseif P.spinSeq==333 then--T-L + if solid(P,x-1,y+1)and solid(P,x-1,y)and solid(P,x+2,y+1)and not solid(P,x+2,y)then + if solid(P,x+1,y-1)then--钩 + P.dir=0 id=5 else--转 - self.curY=y-1 - self.dir=3 + P.curY=y-1 + P.dir=3 id=5 end end - elseif self.spinSeq==222 then--I - if solid(self,x+2,y+1)and solid(self,x-1,y+1)then - if not solid(self,x-1,y)then - if not solid(self,x+2,y)then - self.curX=x-1 - self.dir=2 + elseif P.spinSeq==222 then--I + if solid(P,x+2,y+1)and solid(P,x-1,y+1)then + if not solid(P,x-1,y)then + if not solid(P,x+2,y)then + P.curX=x-1 + P.dir=2 id=7 - elseif not solid(self,x-2,y)then - self.curX=x-2 - self.dir=2 + elseif not solid(P,x-2,y)then + P.curX=x-2 + P.dir=2 id=7 end - elseif not solid(self,x+2,y)and not solid(self,x+3,y)then - self.dir=2 + elseif not solid(P,x+2,y)and not solid(P,x+3,y)then + P.dir=2 id=7 end end end if id then--Transform successed - local C=self.cur + local C=P.cur C.id=id - C.bk=blocks[id][self.dir] - self.r,self.c=#C.bk,#C.bk[1] - self.sc=scs[id][self.dir] - self.spinLast=2 - self.stat.rotate=self.stat.rotate+1 - self:freshgho() - SFX("rotatekick",nil,getBlockDirection(self)) + C.bk=blocks[id][P.dir] + P.r,P.c=#C.bk,#C.bk[1] + P.sc=scs[id][P.dir] + P.spinLast=2 + P.stat.rotate=P.stat.rotate+1 + P:freshgho() + SFX("rotatekick",nil,getBlockDirection(P)) return end else - self.spinSeq=0 + P.spinSeq=0 end end - if self.human then - SFX(ifpre and"prerotate"or"rotate",nil,getBlockDirection(self)) + if P.human then + SFX(ifpre and"prerotate"or"rotate",nil,getBlockDirection(P)) end return end -- - local icb=blocks[self.cur.id][idir] - local isc=scs[self.cur.id][idir] + local icb=blocks[P.cur.id][idir] + local isc=scs[P.cur.id][idir] local ir,ic=#icb,#icb[1] - local ix,iy=self.curX+self.sc[2]-isc[2],self.curY+self.sc[1]-isc[1] + local ix,iy=P.curX+P.sc[2]-isc[2],P.curY+P.sc[1]-isc[1] local t--succssful test - local iki=self.RS[self.cur.id][self.dir*10+idir] - for i=1,self.freshTime<=1.2*self.gameEnv.freshLimit and #iki or 1 do - if not ifoverlap(self,icb,ix+iki[i][1],iy+iki[i][2])then + local iki=P.RS[P.cur.id][P.dir*10+idir] + for i=1,P.freshTime<=1.2*P.gameEnv.freshLimit and #iki or 1 do + if not ifoverlap(P,icb,ix+iki[i][1],iy+iki[i][2])then ix,iy=ix+iki[i][1],iy+iki[i][2] t=i goto spin @@ -1545,120 +1557,120 @@ function player:spin(d,ifpre) end do return end ::spin:: - if not self.small and setting.dropFX>0 then - self:createShade(self.curX,self.curY+self.r-1,self.curX+self.c-1,self.curY) + if not P.small and setting.dropFX>0 then + P:createShade(P.curX,P.curY+P.r-1,P.curX+P.c-1,P.curY) end - local y0=self.curY - self.curX,self.curY,self.dir=ix,iy,idir - self.sc,self.cur.bk=scs[self.cur.id][idir],icb - self.r,self.c=ir,ic - self.spinLast=t==2 and 0 or 1 - if not ifpre then self:freshgho()end - if self.gameEnv.easyFresh or y0>self.curY then self:freshLockDelay()end - if self.human then - SFX(ifpre and"prerotate"or ifoverlap(self,self.cur.bk,self.curX,self.curY+1)and ifoverlap(self,self.cur.bk,self.curX-1,self.curY)and ifoverlap(self,self.cur.bk,self.curX+1,self.curY)and"rotatekick"or"rotate",nil,getBlockDirection(self)) + local y0=P.curY + P.curX,P.curY,P.dir=ix,iy,idir + P.sc,P.cur.bk=scs[P.cur.id][idir],icb + P.r,P.c=ir,ic + P.spinLast=t==2 and 0 or 1 + if not ifpre then P:freshgho()end + if P.gameEnv.easyFresh or y0>P.curY then P:freshLockDelay()end + if P.human then + SFX(ifpre and"prerotate"or ifoverlap(P,P.cur.bk,P.curX,P.curY+1)and ifoverlap(P,P.cur.bk,P.curX-1,P.curY)and ifoverlap(P,P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate",nil,getBlockDirection(P)) end - self.stat.rotate=self.stat.rotate+1 + P.stat.rotate=P.stat.rotate+1 end -function player:hold(ifpre) - if not self.holded and self.waiting==-1 and self.gameEnv.hold then +function player.hold(P,ifpre) + if not P.holded and P.waiting==-1 and P.gameEnv.hold then --Finesse check - local H,B=self.hd,self.cur + local H,B=P.hd,P.cur if H and H.id==B.id and H.name==B.name then - self:fineError(1.5) - elseif self.ctrlCount>1 then - self:fineError(2) + P:fineError(1.5) + elseif P.ctrlCount>1 then + P:fineError(2) end - self.holded=self.gameEnv.oncehold - self.spinLast=false - self.ctrlCount=0 - self.spinSeq=0 - self.cur,self.hd=self.hd,self.cur - self.hd.bk=blocks[self.hd.id][0] - if self.cur.id==0 then - self.cur=rem(self.next,1) - self:freshNext() - if self.AI_mode=="CC"then BOT.addNext(self.AI_bot,CCblockID[self.next[self.AIdata.next].id])end + P.holded=P.gameEnv.oncehold + P.spinLast=false + P.ctrlCount=0 + P.spinSeq=0 + P.cur,P.hd=P.hd,P.cur + P.hd.bk=blocks[P.hd.id][0] + if P.cur.id==0 then + P.cur=rem(P.next,1) + P:freshNext() + if P.AI_mode=="CC"then BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id])end end - self.sc,self.dir=scs[self.cur.id][0],0 - self.r,self.c=#self.cur.bk,#self.cur.bk[1] - self.curX,self.curY=blockPos[self.cur.id],21+ceil(self.fieldBeneath/30)-self.r+min(int(#self.field*.2),2) + P.sc,P.dir=scs[P.cur.id][0],0 + P.r,P.c=#P.cur.bk,#P.cur.bk[1] + P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2) - if abs(self.moving)>self.gameEnv.das and not ifoverlap(self,self.cur.bk,self.curX+(self.moving>0 and 1 or -1),self.curY)then - self.curX=self.curX+(self.moving>0 and 1 or -1) + if abs(P.moving)>P.gameEnv.das and not ifoverlap(P,P.cur.bk,P.curX+(P.moving>0 and 1 or -1),P.curY)then + P.curX=P.curX+(P.moving>0 and 1 or -1) end --IMS - self:freshgho() - self.dropDelay,self.lockDelay,self.freshTime=self.gameEnv.drop,self.gameEnv.lock,max(self.freshTime-5,0) - if ifoverlap(self,self.cur.bk,self.curX,self.curY)then self:lock()Event.lose(self)end + P:freshgho() + P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,max(P.freshTime-5,0) + if ifoverlap(P,P.cur.bk,P.curX,P.curY)then P:lock()Event.lose(P)end - if self.human then + if P.human then SFX(ifpre and"prehold"or"hold") end - self.stat.hold=self.stat.hold+1 + P.stat.hold=P.stat.hold+1 end end -function player:newNext(n) - self.next[#self.next+1]={bk=blocks[n][0],id=n,color=self.gameEnv.bone and 8 or n,name=n} +function player.newNext(P,n) + P.next[#P.next+1]={bk=blocks[n][0],id=n,color=P.gameEnv.bone and 8 or n,name=n} end -function player:resetblock() - self.holded=false - self.spinLast=false - self.spinSeq=0 - self.ctrlCount=0 +function player.resetblock(P) + P.holded=false + P.spinLast=false + P.spinSeq=0 + P.ctrlCount=0 - self.cur=rem(self.next,1) - self:freshNext() - if self.AI_mode=="CC"then BOT.addNext(self.AI_bot,CCblockID[self.next[self.AIdata.next].id])end - self.sc,self.dir=scs[self.cur.id][0],0--spin center/direction - self.r,self.c=#self.cur.bk,#self.cur.bk[1]--row/column - self.curX,self.curY=blockPos[self.cur.id],21+ceil(self.fieldBeneath/30)+min(int(#self.field*.15)-self.r,0)--初始高度:7格+1,14格+2(非I) - self.dropDelay,self.lockDelay,self.freshTime=self.gameEnv.drop,self.gameEnv.lock,0 + P.cur=rem(P.next,1) + P:freshNext() + if P.AI_mode=="CC"then BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id])end + P.sc,P.dir=scs[P.cur.id][0],0--spin center/direction + P.r,P.c=#P.cur.bk,#P.cur.bk[1]--row/column + P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)+min(int(#P.field*.15)-P.r,0)--初始高度:7格+1,14格+2(非I) + P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,0 - if self.keyPressing[8]then self:hold(true)end - if self.keyPressing[3]then self:spin(1,true)end - if self.keyPressing[4]then self:spin(3,true)end - if self.keyPressing[5]then self:spin(2,true)end - if abs(self.moving)>self.gameEnv.das and not ifoverlap(self,self.cur.bk,self.curX+(self.moving>0 and 1 or -1),self.curY)then - self.curX=self.curX+(self.moving>0 and 1 or -1) + if P.keyPressing[8]then P:hold(true)end + if P.keyPressing[3]then P:spin(1,true)end + if P.keyPressing[4]then P:spin(3,true)end + if P.keyPressing[5]then P:spin(2,true)end + if abs(P.moving)>P.gameEnv.das and not ifoverlap(P,P.cur.bk,P.curX+(P.moving>0 and 1 or -1),P.curY)then + P.curX=P.curX+(P.moving>0 and 1 or -1) end --Initial SYSs - if ifoverlap(self,self.cur.bk,self.curX,self.curY)then self:lock()Event.lose(self)end - self:freshgho() - if self.keyPressing[6]then self.act.hardDrop(self)self.keyPressing[6]=false end + if ifoverlap(P,P.cur.bk,P.curX,P.curY)then P:lock()Event.lose(P)end + P:freshgho() + if P.keyPressing[6]then P.act.hardDrop(P)P.keyPressing[6]=false end end -function player:drop()--Place piece - self.dropTime[11]=ins(self.dropTime,1,frame)--update speed dial - self.waiting=self.gameEnv.wait +function player.drop(P)--Place piece + P.dropTime[11]=ins(P.dropTime,1,frame)--update speed dial + P.waiting=P.gameEnv.wait local dospin=0 - if self.spinLast then - if self.cur.id<6 then - local x,y=self.curX+self.sc[2]-1,self.curY+self.sc[1]-1 + if P.spinLast then + if P.cur.id<6 then + local x,y=P.curX+P.sc[2]-1,P.curY+P.sc[1]-1 local c=0 - if solid(self,x-1,y+1)then c=c+1 end - if solid(self,x+1,y+1)then c=c+1 end + if solid(P,x-1,y+1)then c=c+1 end + if solid(P,x+1,y+1)then c=c+1 end if c==0 then goto NTC end - if solid(self,x-1,y-1)then c=c+1 end - if solid(self,x+1,y-1)then c=c+1 end + if solid(P,x-1,y-1)then c=c+1 end + if solid(P,x+1,y-1)then c=c+1 end if c>2 then dospin=dospin+1 end end--Three point ::NTC:: - if self.cur.id~=6 and ifoverlap(self,self.cur.bk,self.curX-1,self.curY)and ifoverlap(self,self.cur.bk,self.curX+1,self.curY)and ifoverlap(self,self.cur.bk,self.curX,self.curY+1)then + if P.cur.id~=6 and ifoverlap(P,P.cur.bk,P.curX-1,P.curY)and ifoverlap(P,P.cur.bk,P.curX+1,P.curY)and ifoverlap(P,P.cur.bk,P.curX,P.curY+1)then dospin=dospin+2 end--Immobile end --极简检测(遮挡) local finesse - if self.curY>18 then + if P.curY>18 then finesse=true--高处防误判直接最简 else - local y0=self.curY - local x,c=self.curX,self.c + local y0=P.curY + local x,c=P.curX,P.c - local B=self.cur.bk + local B=P.cur.bk for x=1,c do local y for i=#B,1,-1 do @@ -1667,27 +1679,27 @@ function player:drop()--Place piece goto L1 ::L2:: if y then - x=self.curX+x-1 - for y=y0+y,#self.field do - if solid(self,x,y)then finesse=true;goto L1 end--有遮挡视为最简 + x=P.curX+x-1 + for y=y0+y,#P.field do + if solid(P,x,y)then finesse=true;goto L1 end--有遮挡视为最简 end end end ::L1:: end - self:lock() + P:lock() local CHN=getFreeVoiceChannel() - local cc,send,exblock=checkrow(self,self.curY,self.r),0,0--Currect clear&send&sendTime - if self.clearing[1]then self.falling=self.gameEnv.fall end + local cc,send,exblock=checkrow(P,P.curY,P.r),0,0--Currect clear&send&sendTime + if P.clearing[1]then P.falling=P.gameEnv.fall end local cscore,sendTime=0,0 local mini - if self.spinLast then + if P.spinLast then if cc>0 then if dospin>0 then - dospin=dospin+self.spinLast + dospin=dospin+P.spinLast if dospin<2 then - mini=self.cur.id<6 and cc<3 and cc2 then dir=dir-2 end end--SZI的逆态视为顺态 - local R,I=self.ctrlCount,finesseCtrlPar[id][dir][self.curX]--Real key/Ideal key + local R,I=P.ctrlCount,finesseCtrlPar[id][dir][P.curX]--Real key/Ideal key local d=R-I if d>0 then if I==0 then I=1 end local rate=R/I if rate>2.5 then rate=2.5 end - self:fineError(rate) + P:fineError(rate) --非最简 end end if cc>0 then - self.combo=self.combo+1 + P.combo=P.combo+1 if cc==4 then cscore=1000 - if self.b2b>1000 then - self:showText(text.techrashB3B,"fly",80,-30) + if P.b2b>1000 then + P:showText(text.techrashB3B,0,-30,70,"fly") send=6 sendTime=100 exblock=exblock+1 cscore=cscore*1.8 - self.stat.b3b=self.stat.b3b+1 - if self.human then + P.stat.b3b=P.stat.b3b+1 + if P.human then VOICE("b3b",CHN) end - elseif self.b2b>=50 then - self:showText(text.techrashB2B,"drive",80,-30) + elseif P.b2b>=50 then + P:showText(text.techrashB2B,0,-30,70,"drive") sendTime=80 send=5 cscore=cscore*1.3 - self.stat.b2b=self.stat.b2b+1 - if self.human then + P.stat.b2b=P.stat.b2b+1 + if P.human then VOICE("b2b",CHN) end else - self:showText(text.techrash,"stretch",80,-30) + P:showText(text.techrash,0,-30,70,"stretch") sendTime=60 send=4 end - self.b2b=self.b2b+120 - self.lastClear=74 - self.stat.clear_4=self.stat.clear_4+1 - if self.human then + P.b2b=P.b2b+120 + P.lastClear=74 + P.stat.clear_4=P.stat.clear_4+1 + if P.human then VOICE("techrash",CHN) end elseif cc>0 then local clearKey=clear_n if dospin then - cscore=spinSCR[self.cur.name][cc] - if self.b2b>1000 then - self:showText(text.b3b..text.spin[self.cur.name]..text.clear[cc],"spin",40,-30) + cscore=spinSCR[P.cur.name][cc] + if P.b2b>1000 then + P:showText(text.b3b..text.spin[P.cur.name]..text.clear[cc],0,-30,35,"spin") send=b2bATK[cc]+1 exblock=exblock+1 cscore=cscore*2 - self.stat.b3b=self.stat.b3b+1 - if self.human then + P.stat.b3b=P.stat.b3b+1 + if P.human then VOICE("b3b",CHN) end - elseif self.b2b>=50 then - self:showText(text.b2b..text.spin[self.cur.name]..text.clear[cc],"spin",40,-30) + elseif P.b2b>=50 then + P:showText(text.b2b..text.spin[P.cur.name]..text.clear[cc],0,-30,35,"spin") send=b2bATK[cc] cscore=cscore*1.2 - self.stat.b2b=self.stat.b2b+1 - if self.human then + P.stat.b2b=P.stat.b2b+1 + if P.human then VOICE("b2b",CHN) end else - self:showText(text.spin[self.cur.name]..text.clear[cc],"spin",50,-30) + P:showText(text.spin[P.cur.name]..text.clear[cc],0,-30,45,"spin") send=2*cc end sendTime=20+send*20 if mini then - self:showText(text.mini,"appear",40,-80) + P:showText(text.mini,0,-80,35,"appear") send=ceil(send*.5) sendTime=sendTime+60 cscore=cscore*.5 - self.b2b=self.b2b+b2bPoint[cc]*.5 - if self.human then + P.b2b=P.b2b+b2bPoint[cc]*.5 + if P.human then VOICE("mini",CHN) end else - self.b2b=self.b2b+b2bPoint[cc] + P.b2b=P.b2b+b2bPoint[cc] end - self.lastClear=self.cur.id*10+cc + P.lastClear=P.cur.id*10+cc clearKey=spin_n - if self.human then + if P.human then SFX(spin_n[cc]) - VOICE(spinName[self.cur.name],CHN) + VOICE(spinName[P.cur.name],CHN) end - elseif #self.field>0 then - self.b2b=max(self.b2b-250,0) - self:showText(text.clear[cc],"appear",32+cc*3,-30,(8-cc)*.3) + elseif #P.field>0 then + P.b2b=max(P.b2b-250,0) + P:showText(text.clear[cc],0,-30,27+cc*3,"appear",(8-cc)*.3) send=cc-1 sendTime=20+send*20 cscore=cscore+clearSCR[cc] - self.lastClear=cc + P.lastClear=cc end - self.stat[clearKey[cc]]=self.stat[clearKey[cc]]+1 - if self.human then + P.stat[clearKey[cc]]=P.stat[clearKey[cc]]+1 + if P.human then VOICE(clearName[cc],CHN) end end - send=send+(renATK[self.combo]or 3) - if #self.field==0 then - self:showText(text.PC,"flicker",70,-80) - send=min(send,3)+min(6+self.stat.pc,10) + send=send+(renATK[P.combo]or 3) + if #P.field==0 then + P:showText(text.PC,0,-80,60,"flicker") + send=min(send,3)+min(6+P.stat.pc,10) exblock=exblock+2 sendTime=sendTime+60 - if self.stat.row>4 then - self.b2b=1200 - cscore=cscore+500*min(6+self.stat.pc,10) + if P.stat.row>4 then + P.b2b=1200 + cscore=cscore+500*min(6+P.stat.pc,10) else cscore=cscore+500 end - self.stat.pc=self.stat.pc+1 - self.lastClear=self.cur.id*10+5 - if self.human then + P.stat.pc=P.stat.pc+1 + P.lastClear=P.cur.id*10+5 + if P.human then SFX("perfectclear") VOICE("pc",CHN) end end - if self.combo>2 then - self:showText(text.cmb[min(self.combo,20)],self.combo<10 and"appear"or"flicker",20+min(self.combo,25)*3,60) - cscore=cscore+min(20*self.combo,300)*cc + if P.combo>2 then + P:showText(text.cmb[min(P.combo,20)],0,25,15+min(P.combo,25)*3,P.combo<10 and"appear"or"flicker") + cscore=cscore+min(20*P.combo,300)*cc end - sendTime=sendTime+25*self.combo - if self.human then + sendTime=sendTime+25*P.combo + if P.human then SFX(clear_n[cc]) - SFX(ren_n[min(self.combo,11)]) - if self.combo>14 then SFX("ren_mega",(self.combo-10)*.1)end + SFX(ren_n[min(P.combo,11)]) + if P.combo>14 then SFX("ren_mega",(P.combo-10)*.1)end VIB(cc+1) end - if self.b2b>1200 then self.b2b=1200 end + if P.b2b>1200 then P.b2b=1200 end if modeEnv.royaleMode then - local i=min(#self.atker,9) + local i=min(#P.atker,9) if i>1 then send=send+reAtk[i] exblock=exblock+reDef[i] @@ -1854,35 +1866,35 @@ function player:drop()--Place piece end--Counter attack if send>0 then - self.stat.atk=self.stat.atk+send + P.stat.atk=P.stat.atk+send --ATK statistics - if exblock then exblock=int(exblock*(1+self.strength*.25))end - send=send*(1+self.strength*.25) + if exblock then exblock=int(exblock*(1+P.strength*.25))end + send=send*(1+P.strength*.25) if mini then send=send*.8 end send=int(send) --Badge Buff if send==0 then goto L end - self:showText(send,"zoomout",40,70) + P:showText(send,0,80,35,"zoomout") if exblock==0 then goto L end - self:showText(exblock,"zoomout",20,115) + P:showText(exblock,0,120,20,"zoomout") ::L:: send=send+exblock local k=0 ::R:: - if self.atkBuffer.sum>0 and send>0 then + if P.atkBuffer.sum>0 and send>0 then ::F:: k=k+1 - local A=self.atkBuffer[k] + local A=P.atkBuffer[k] if not A then goto E end if A.sent then goto F end if send>=A.amount then send=send-A.amount - self.atkBuffer.sum=self.atkBuffer.sum-A.amount + P.atkBuffer.sum=P.atkBuffer.sum-A.amount A.sent,A.time=true,0 if send>0 then goto R end else A.amount=A.amount-send - self.atkBuffer.sum=self.atkBuffer.sum-send + P.atkBuffer.sum=P.atkBuffer.sum-send send=0 end end @@ -1891,85 +1903,87 @@ function player:drop()--Place piece if send>0 then local T if modeEnv.royaleMode then - if self.atkMode==4 then - local M=#self.atker + if P.atkMode==4 then + local M=#P.atker if M>0 then for i=1,M do - self:garbageSend(self.atker[i],send,sendTime,M,self.cur.color,self.lastClear,dospin,mini,self.combo) + P:garbageSend(P.atker[i],send,sendTime,M,P.cur.color,P.lastClear,dospin,mini,P.combo) end else - T=randomTarget(self) + T=randomTarget(P) end else - self:freshTarget() - T=self.atking + P:freshTarget() + T=P.atking end elseif #players.alive>1 then - T=randomTarget(self) + T=randomTarget(P) end if T then - self:garbageSend(T,send,sendTime,1,self.cur.color,self.lastClear,dospin,mini,self.combo) + P:garbageSend(T,send,sendTime,1,P.cur.color,P.lastClear,dospin,mini,P.combo) end - self.stat.send=self.stat.send+send - if self.human and send>3 then SFX("emit",min(send,8)*.1)end + P.stat.send=P.stat.send+send + if P.human and send>3 then SFX("emit",min(send,8)*.1)end end end else - self.combo=0 + P.combo=0 local dropScore=10 if dospin then - self:showText(text.spin[self.cur.name],"appear",50,-30) - self.b2b=self.b2b+20 - self.stat.spin_0=self.stat.spin_0+1 - if self.human then + P:showText(text.spin[P.cur.name],0,-30,45,"appear") + P.b2b=P.b2b+20 + P.stat.spin_0=P.stat.spin_0+1 + if P.human then SFX("spin_0") - VOICE(spinName[self.cur.name],CHN) + VOICE(spinName[P.cur.name],CHN) end dropScore=25--spin bonus end - if self.gameEnv._20G then + if P.gameEnv._20G then dropScore=dropScore*2 - elseif self.gameEnv.drop<3 then + elseif P.gameEnv.drop<3 then dropScore=dropScore*1.5 end--dropSpeed bonus - if self.dropSpeed>60 then - dropScore=dropScore*self.dropSpeed/60 - elseif self.dropSpeed>120 then - dropScore=dropScore*1,2*self.dropSpeed/120 - elseif self.dropSpeed>180 then - dropScore=dropScore*1.5*self.dropSpeed/180 + if P.dropSpeed>60 then + dropScore=dropScore*P.dropSpeed/60 + elseif P.dropSpeed>120 then + dropScore=dropScore*1,2*P.dropSpeed/120 + elseif P.dropSpeed>180 then + dropScore=dropScore*1.5*P.dropSpeed/180 end--speed bonus cscore=cscore+int(dropScore) - if self.b2b>1000 then - self.b2b=max(self.b2b-40,1000) + if P.b2b>1000 then + P.b2b=max(P.b2b-40,1000) end - self:garbageRelease() + P:garbageRelease() end - self.stat.score=self.stat.score+cscore - self.stat.piece,self.stat.row=self.stat.piece+1,self.stat.row+cc - Event[self.gameEnv.dropPiece](self) - if self.human then SFX("lock",nil,getBlockDirection(self))end + P.stat.score=P.stat.score+cscore + P.stat.piece,P.stat.row=P.stat.piece+1,P.stat.row+cc + Event[P.gameEnv.dropPiece](P) + if P.human then SFX("lock",nil,getBlockDirection(P))end end -function player:pressKey(i) - self.keyPressing[i]=true - if self.id==1 then +function player.pressKey(P,i) + P.keyPressing[i]=true + if P.id==1 then virtualkeyDown[i]=true virtualkeyPressTime[i]=10 end - if self.alive then - self.act[actName[i]](self) - self.keyTime[11]=ins(self.keyTime,1,frame) - self.stat.key=self.stat.key+1 + if P.alive then + P.act[actName[i]](P) + P.keyTime[11]=ins(P.keyTime,1,frame) + P.stat.key=P.stat.key+1 end --ins(rec,{i,frame}) end -function player:releaseKey(i) - self.keyPressing[i]=false - if self.id==1 then virtualkeyDown[i]=false end - -- if recording then ins(rec,{-i,frame})end +function player.releaseKey(P,i) + if P.keyPressing[i]then + P.keyPressing[i]=false + if P.id==1 then virtualkeyDown[i]=false end + -- if recording then ins(rec,{-i,frame})end + end end -------------------------------------------------- diff --git a/scene.lua b/scene.lua index 3db2f125..1a5da8db 100644 --- a/scene.lua +++ b/scene.lua @@ -30,7 +30,6 @@ local sceneInit={ if not players[1]then newDemoPlayer(1,900,35,1.1) end--create demo player - collectgarbage() end, music=function() if bgmPlaying then diff --git a/sound.lua b/sound.lua new file mode 100644 index 00000000..972b3d50 --- /dev/null +++ b/sound.lua @@ -0,0 +1,85 @@ +local rnd=math.random +local vibrateLevel={0,.015,.02,.03,.04,.05,.06,.07,.08,.09} +function VIB(t) + if setting.vib>0 then + love.system.vibrate(vibrateLevel[setting.vib+t]) + end +end +function SFX(s,v,pos) + if setting.sfx>0 then + local S=sfx[s]--AU_Queue + local n=1 + while S[n]:isPlaying()do + n=n+1 + if not S[n]then + S[n]=S[n-1]:clone() + S[n]:seek(0) + break + end + end + S=S[n]--AU_SRC + if S:getChannelCount()==1 then + if pos then + pos=pos*setting.stereo*.1 + S:setPosition(pos,1-pos^2,0) + else + S:setPosition(0,0,0) + end + end + S:setVolume((v or 1)*setting.sfx*.1) + print((v or 1)*setting.sfx*.1) + S:play() + end +end +function getFreeVoiceChannel() + local i=#voiceQueue + for i=1,i do + if #voiceQueue[i]==0 then return i end + end + voiceQueue[i+1]={} + return i+1 +end +function VOICE(s,chn) + if setting.voc>0 then + if chn then + voiceQueue[chn][#voiceQueue[chn]+1]=voiceList[s][rnd(#voiceList[s])] + --添加到[chn] + else + voiceQueue[getFreeVoiceChannel()]={voiceList[s][rnd(#voiceList[s])]} + --自动查找/创建空轨 + end + end +end +function BGM(s) + if setting.bgm>0 then + if bgmPlaying~=s then + if bgmPlaying then newTask(Event_task.bgmFadeOut,nil,bgmPlaying)end + for i=#Task,1,-1 do + local T=Task[i] + if T.code==Event_task.bgmFadeIn then + T.code=Event_task.bgmFadeOut + elseif T.code==Event_task.bgmFadeOut and T.data==s then + rem(Task,i) + end + end + if s then + newTask(Event_task.bgmFadeIn,nil,s) + bgm[s]:play() + end + bgmPlaying=s + else + if bgmPlaying then + local v=setting.bgm*.1 + bgm[bgmPlaying]:setVolume(v) + if v>0 then + bgm[bgmPlaying]:play() + else + bgm[bgmPlaying]:pause() + end + end + end + elseif bgmPlaying then + bgm[bgmPlaying]:pause() + bgmPlaying=nil + end +end \ No newline at end of file diff --git a/text.lua b/text.lua new file mode 100644 index 00000000..eb4a67be --- /dev/null +++ b/text.lua @@ -0,0 +1,82 @@ +local gc=love.graphics +local rnd=math.random +local mStr=mStr +local textFX={} +function textFX.appear(t) + mStr(t.text,t.x,t.y-t.font*.7) +end +function textFX.fly(t) + mStr(t.text,t.x+(t.c-.5)^3*300,t.y-t.font*.7) +end +function textFX.stretch(t) + gc.push("transform") + gc.translate(t.x,t.y) + if t.c<.3 then gc.scale((.3-t.c)*1.6+1,1)end + mStr(t.text,0,-t.font*.7) + gc.pop() +end +function textFX.drive(t) + gc.push("transform") + gc.translate(t.x,t.y) + if t.c<.3 then gc.shear((.3-t.c)*2,0)end + mStr(t.text,0,-t.font*.7) + gc.pop() +end +function textFX.spin(t) + gc.push("transform") + gc.translate(t.x,t.y) + if t.c<.3 then + gc.rotate((.3-t.c)^2*4) + end + mStr(t.text,0,-t.font*.7) + gc.pop() +end +function textFX.flicker(t) + local _,τ,T,Τ=gc.getColor() + gc.setColor(_,τ,T,Τ*(rnd()+.5)) + mStr(t.text,t.x,t.y-t.font*.7) +end +function textFX.zoomout(t) + gc.push("transform") + local k=t.c^.5*.1+1 + gc.translate(t.x,t.y) + gc.scale(k,k) + mStr(t.text,0,-t.font*.7) + gc.pop() +end +function textFX.beat(t) + gc.push("transform") + gc.translate(t.x,t.y) + if t.c<.3 then + local k=1.3-t.c^2/.3 + gc.scale(k,k) + end + mStr(t.text,0,-t.font*.7) + gc.pop() +end +function getTEXT(text,x,y,font,style,spd,stop) + return{ + c=0, --counter + + text=text, --string + x=x or 0, --x + y=y or 0, --y + font=font or 40, --font + spd=(spd or 1)/60, --timing speed + stop=stop, --timing stop + + draw=textFX[style]or error("unavailable type:"..style), --draw method + } +end +function TEXT(text,x,y,font,style,spd,stop) + texts[#texts+1]={ + c=0, --timer + text=text or"NaN", --string + x=x or 0, --x + y=y or 0, --y + font=font or 40, --font + spd=(spd or 1)/60, --timing speed(1=last 1 sec) + stop=stop, --stop time(sustained text) + draw=textFX[style]or error("unavailable type:"..style), --draw method + } +end \ No newline at end of file diff --git a/texture.lua b/texture.lua index 934448e5..5340f00a 100644 --- a/texture.lua +++ b/texture.lua @@ -81,7 +81,10 @@ drawableText={ modeName=T(30),levelName=T(30), next=T(40),hold=T(40), - pause=T(120),finish=T(120), + + win=T(120),finish=T(120), + lose=T(120),pause=T(120), + custom=T(80), setting_game=T(80),setting_graphic=T(80),setting_sound=T(80), keyboard=T(25),joystick=T(25), diff --git a/timer.lua b/timer.lua index 48967181..a66ddd8e 100644 --- a/timer.lua +++ b/timer.lua @@ -129,7 +129,7 @@ function Tmr.play(dt) return end elseif restartCount>0 then - restartCount=max(restartCount-2,0) + restartCount=restartCount>2 and restartCount-2 or 0 end--Counting,include pre-das,directy RETURN,or restart counting for p=1,#players do local P=players[p] @@ -138,7 +138,7 @@ function Tmr.play(dt) if modeEnv.royaleMode and frame%120==0 then freshMostDangerous()end end function Tmr.pause(dt) - if not gamefinished then + if not gameResult then pauseTime=pauseTime+dt end if pauseTimer<50 and not wd.isMinimized()then diff --git a/toolfunc.lua b/toolfunc.lua index 6a8ced15..43275962 100644 --- a/toolfunc.lua +++ b/toolfunc.lua @@ -1,7 +1,6 @@ local tm=love.timer local gc=love.graphics local kb=love.keyboard -local setFont=setFont local int,abs,rnd,max,min=math.floor,math.abs,math.random,math.max,math.min local sub,find=string.sub,string.find local ins,rem=table.insert,table.remove @@ -71,7 +70,7 @@ langName={"中文","全中文","English"} local langID={"chi","chi_full","eng"} local drawableTextLoad={ "next","hold", - "pause","finish", + "win","finish","lose","pause", "custom", "setting_game", "setting_graphic", @@ -95,7 +94,7 @@ function swapLanguage(l) royaleCtrlPad=gc.newCanvas(300,100) gc.setCanvas(royaleCtrlPad) gc.setColor(1,1,1) - setFont(25) + setFont(20) gc.setLineWidth(2) for i=1,4 do gc.rectangle("line",RCPB[2*i-1],RCPB[2*i],90,35,8,4) @@ -133,91 +132,6 @@ function restoreVirtualKey() end -local vibrateLevel={0,.015,.02,.03,.04,.05,.06,.07,.08,.09} -function VIB(t) - if setting.vib>0 then - love.system.vibrate(vibrateLevel[setting.vib+t]) - end -end -function SFX(s,v,pos) - if setting.sfx>0 then - local S=sfx[s]--AU_Queue - local n=1 - while S[n]:isPlaying()do - n=n+1 - if not S[n]then - S[n]=S[n-1]:clone() - S[n]:seek(0) - break - end - end - S=S[n]--AU_SRC - if S:getChannelCount()==1 then - if pos then - pos=pos*setting.stereo*.1 - S:setPosition(pos,1-pos^2,0) - else - S:setPosition(0,0,0) - end - end - S:setVolume((v or 1)*setting.sfx*.1) - print((v or 1)*setting.sfx*.1) - S:play() - end -end -function getFreeVoiceChannel() - local i=#voiceQueue - for i=1,i do - if #voiceQueue[i]==0 then return i end - end - voiceQueue[i+1]={} - return i+1 -end -function VOICE(s,chn) - if setting.voc>0 then - if chn then - voiceQueue[chn][#voiceQueue[chn]+1]=voiceList[s][rnd(#voiceList[s])] - --添加到[chn] - else - voiceQueue[getFreeVoiceChannel()]={voiceList[s][rnd(#voiceList[s])]} - --自动查找/创建空轨 - end - end -end -function BGM(s) - if setting.bgm>0 then - if bgmPlaying~=s then - if bgmPlaying then newTask(Event_task.bgmFadeOut,nil,bgmPlaying)end - for i=#Task,1,-1 do - local T=Task[i] - if T.code==Event_task.bgmFadeIn then - T.code=Event_task.bgmFadeOut - elseif T.code==Event_task.bgmFadeOut and T.data==s then - rem(Task,i) - end - end - if s then - newTask(Event_task.bgmFadeIn,nil,s) - bgm[s]:play() - end - bgmPlaying=s - else - if bgmPlaying then - local v=setting.bgm*.1 - bgm[bgmPlaying]:setVolume(v) - if v>0 then - bgm[bgmPlaying]:play() - else - bgm[bgmPlaying]:pause() - end - end - end - elseif bgmPlaying then - bgm[bgmPlaying]:pause() - bgmPlaying=nil - end -end - function updateStat() local S=players[1].stat for k,v in next,S do @@ -265,9 +179,7 @@ end function royaleLevelup() gameStage=gameStage+1 local spd - if(gameStage==3 or gameStage>4)and players[1].alive then - players[1]:showText(text.royale_remain(#players.alive),"beat",50,-100,.3) - end + TEXT(text.royale_remain(#players.alive),640,200,40,"beat",.3) if gameStage==2 then spd=30 elseif gameStage==3 then @@ -301,15 +213,16 @@ function royaleLevelup() end function pauseGame() + restartCount=0--Avoid strange darkness pauseTimer=0--Pause timer for animation - if not gamefinished then + if not gameResult then pauseCount=pauseCount+1 end - for i=1,#players.alive do - local l=players.alive[i].keyPressing + for i=1,#players do + local l=players[i].keyPressing for j=1,#l do if l[j]then - players.alive[i]:releaseKey(j) + players[i]:releaseKey(j) end end end @@ -325,14 +238,16 @@ function loadGame(mode,level) lv=level, } drawableText.modeName:set(text.modeName[mode]) - drawableText.levelName:set(modes[modeID[modeSel]].level[levelSel]) + drawableText.levelName:set(modes[modeID[mode]].level[level]) needResetGameData=true scene.swapTo("play","deck") end function resetPartGameData() + gameResult=false frame=30 destroyPlayers() modes[curMode.id].load() + texts={} if modeEnv.task then for i=1,#players do newTask(Event_task[modeEnv.task],players[i]) @@ -347,7 +262,7 @@ function resetPartGameData() collectgarbage() end function resetGameData() - gamefinished=false + gameResult=false frame=0 garbageSpeed=1 pushSpeed=3 @@ -365,6 +280,7 @@ function resetGameData() curBG=modeEnv.bg BGM(modeEnv.bgm) + texts={} FX_badge={} FX_attack={} for _,v in next,PTC.dust do @@ -448,6 +364,7 @@ function saveData() t=concat(t,"\r\n") userData:open("w") userData:write(t) + userData:flush() userData:close() end @@ -574,5 +491,6 @@ function saveSetting() t=concat(t,"\r\n") userSetting:open("w") userSetting:write(t) + userSetting:flush(t) userSetting:close() end \ No newline at end of file diff --git a/updateLog.lua b/updateLog.lua index 8aca81fe..38ff531d 100644 --- a/updateLog.lua +++ b/updateLog.lua @@ -1,8 +1,12 @@ local S=[=[ Patron(rmb10+): - gggf/T080/Ykzl/zxc - [D*a]? - + Fireboos + gggf + Sasoric + T080 + Ykzl + zxc + ?[D*a] Future outlook: Normal: powerinfo switch @@ -23,6 +27,10 @@ Future outlook: infinite 1v1 square mode more FXs & 3d features & animations +0.8.0: + remake text system + more details + bug fixed 0.7.35: bug fixed 0.7.34: