Compare commits

...

2 Commits

Author SHA1 Message Date
MrZ_26
e8f0f4cf38 0.7.24α 2020-02-04 19:36:20 +08:00
MrZ_26
a29fa973a6 Alpha V0.7.23test5 2020-02-04 19:35:50 +08:00
62 changed files with 2433 additions and 1402 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
BGM/shining terminal.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

235
ai.lua
View File

@@ -8,8 +8,76 @@
4deepShape 4deepShape
BlockedWells; BlockedWells;
]] ]]
local abs=math.abs local int,ceil,min,abs,rnd=math.floor,math.ceil,math.min,math.abs,math.random
local ins,rem=table.insert,table.remove
local Timer=love.timer.getTime
-- controlname:
-- 1~5:mL,mR,rR,rL,rF,
-- 6~10:hD,sD,H,A,R,
-- 11~13:LL,RR,DD
local blockPos={4,4,4,4,4,5,4}
local scs={{1,2},{1,2},{1,2},{1,2},{1,2},{1.5,1.5},{0.5,2.5}}
-------------------------------------------------Cold clear
local CCblockID={4,3,5,6,1,2,0}
if system~="Windows"then goto SKIP end
require("CCloader")
BOT={
getConf= cc.get_default_config ,--()options,weights
--setConf= cc.set_options ,--(options,hold,20g,bag7)
new= cc.launch_async ,--(options,weights)bot
addNext= cc.add_next_piece_async ,--(bot,piece)
update= cc.reset_async ,--(bot,field,b2b,combo)
think= cc.request_next_move ,--(bot)
getMove= cc.poll_next_move ,--(bot)success,hold,move
ifDead= cc.is_dead_async ,--(bot)dead
destroy= cc.destroy_async ,--(bot)
setHold= cc.set_hold ,--(opt,bool)
set20G= cc.set_20g ,--(opt,bool)
setBag= cc.set_bag7 ,--(opt,bool)
setNode= cc.set_max_nodes ,--(opt,bool)
free= cc.free ,--(opt/wei)
}
function CC_updateField(P)
local F,i={},1
for y=1,#P.field do
for x=1,10 do
F[i],i=P.field[y][x]>0,i+1
end
end
while i<400 do
F[i],i=false,i+1
end
BOT.update(P.AI_bot,F,P.b2b>=100,P.combo)
end
function CC_switch20G(P)
P.AIdata._20G=true
P.AI_keys={}
BOT.destroy(P.AI_bot)
local opt,wei=BOT.getConf()
BOT.setHold(opt,P.AIdata.hold)
BOT.set20G(opt,P.AIdata._20G)
BOT.setBag(opt,P.AIdata.bag7)
BOT.setNode(opt,P.AIdata.node)
P.AI_bot=BOT.new(opt,wei)
BOT.free(opt)BOT.free(wei)
for i=1,P.AIdata.next do
BOT.addNext(P.AI_bot,CCblockID[P.next[i].id])
end
CC_updateField(P)
P.hold={bk={{}},id=0,color=0,name=0}P.holded=false
P.cur=rem(P.next,1)
P.sc,P.dir=scs[P.cur.id],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)
P.freshNext()
BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id])
collectgarbage()
end
::SKIP::
-------------------------------------------------⑨Stack setup
local dirCount={1,1,3,3,3,0,1} local dirCount={1,1,3,3,3,0,1}
local spinOffset={ local spinOffset={
{1,0,0},--S {1,0,0},--S
@@ -20,12 +88,6 @@ local spinOffset={
{0,0,0},--O {0,0,0},--O
{2,0,1},--I {2,0,1},--I
}for i=1,7 do spinOffset[i][0]=0 end }for i=1,7 do spinOffset[i][0]=0 end
--[[
controlname:
1~5:mL,mR,rR,rL,rF,
6~10:hD,sD,H,A,R,
11~13:LL,RR,DD
]]
local FCL={ local FCL={
[1]={ [1]={
{{11},{11,2},{1},{},{2},{2,2},{12,1},{12}}, {{11},{11,2},{1},{},{2},{2,2},{12,1},{12}},
@@ -68,7 +130,7 @@ local function resetField(f0,f,start)
end end
end end
end end
local function getScore(field,bn,cb,cx,cy) local function getScore(field,cb,cy)
local score=0 local score=0
local highest=0 local highest=0
local height=getNewRow(0) local height=getNewRow(0)
@@ -123,58 +185,111 @@ local function getScore(field,bn,cb,cx,cy)
if mh1>3 then score=score-40-mh1*30 end if mh1>3 then score=score-40-mh1*30 end
return score return score
end end
function AI_getControls(ctrl) -------------------------------------------------
local Tfield={}--test field AI_think={
local field_org=P.field ["9S"]={
for i=1,#field_org do function(ctrl)
Tfield[i]=getNewRow(0) local Tfield={}--test field
for j=1,10 do local field_org=P.field
Tfield[i][j]=field_org[i][j] for i=1,#field_org do
end Tfield[i]=getNewRow(0)
end for j=1,10 do
local best={x=1,dir=0,hold=false,score=-9e99} Tfield[i][j]=field_org[i][j]
for ifhold=0,P.gameEnv.hold and 1 or 0 do end
local bn=ifhold==0 and P.cur.id or P.hold.id>0 and P.hold.id or P.next[1].id end
for dir=0,dirCount[bn] do--each dir local best={x=1,dir=0,hold=false,score=-9e99}
local cb=blocks[bn][dir] for ifhold=0,P.gameEnv.hold and 1 or 0 do
for cx=1,11-#cb[1]do--each pos local bn=ifhold==0 and P.cur.id or P.hold.id>0 and P.hold.id or P.next[1].id
local cy=#Tfield+1 for dir=0,dirCount[bn] do--each dir
::L::if not ifoverlapAI(Tfield,cb,cx,cy-1)then local cb=blocks[bn][dir]
cy=cy-1 for cx=1,11-#cb[1]do--each pos
goto L local cy=#Tfield+1
end--move to bottom ::L::if not ifoverlapAI(Tfield,cb,cx,cy-1)then
for i=1,#cb do cy=cy-1
local y=cy+i-1 goto L
if not Tfield[y]then Tfield[y]=getNewRow(0)end end--move to bottom
for j=1,#cb[1]do for i=1,#cb do
if cb[i][j]then local y=cy+i-1
Tfield[y][cx+j-1]=1 if not Tfield[y]then Tfield[y]=getNewRow(0)end
end for j=1,#cb[1]do
end if cb[i][j]then
end--simulate lock Tfield[y][cx+j-1]=1
local score=getScore(Tfield,bn,cb,cx,cy) end
if score>best.score then end
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score} end--simulate lock
local score=getScore(Tfield,cb,cy)
if score>best.score then
best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score}
end
resetField(field_org,Tfield,cy)
end
end end
resetField(field_org,Tfield,cy)
end end
end
end
::L:: ::L::
if #Tfield>0 then if #Tfield>0 then
removeRow(Tfield,1) removeRow(Tfield,1)
goto L goto L
end--Release cache end--Release cache
local p=#ctrl+1 local p=#ctrl+1
if best.hold then if best.hold then
ctrl[p]=8 ctrl[p]=8
p=p+1 p=p+1
end end
local l=FCL[best.bn][best.dir+1][best.x] local l=FCL[best.bn][best.dir+1][best.x]
for i=1,#l do for i=1,#l do
ctrl[p]=l[i] ctrl[p]=l[i]
p=p+1 p=p+1
end end
ctrl[p]=6 ctrl[p]=6
end return 2
end,
function()
P.AI_delay=P.AI_delay0
if Timer()-P.modeData.point>P.modeData.event then
P.modeData.point=Timer()
P.modeData.event=P.AI_delay0+rnd(2,10)
changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
end
return 1
end,
},
["CC"]={
function()
if P.AI_needFresh then
CC_updateField(P)
P.AI_needFresh=false
end
BOT.think(P.AI_bot)
return 2
end,
function(ctrl)
if BOT.ifDead(P.AI_bot)then ins(ctrl,6)return 3 end
local success,hold,move=BOT.getMove(P.AI_bot)
if success then
if hold then ctrl[1]=8 end--Hold
while move[1]do
local m=rem(move,1)
if m<4 then
ins(ctrl,m+1)
elseif not P.AIdata._20G then
ins(ctrl,13)
end
end
ins(ctrl,6)
return 3
else
return 2--stay this stage
end
end,
function()
P.AI_delay=P.AI_delay0
if Timer()-P.modeData.point>P.modeData.event then
P.modeData.point=Timer()
P.modeData.event=P.AI_delay0+rnd(2,10)
changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
end
return 1
end,
},
}--AI think stage

169
class.lua
View File

@@ -1,17 +1,26 @@
Task={} local gc=love.graphics
local rem=table.remove local rem=table.remove
local format=string.format
metatable_task={__index=Task} Task={}
function Task:update()
if(not self.P or self.P and scene=="play")and self:code(self.P,self.data)then
local e=#Task
for i=1,e do
if Task[i]==self then
Task[e],Task[i]=nil,Task[e]
return
end
end
end
end
function newTask(code,P,data) function newTask(code,P,data)
local id=#Task+1 Task[#Task+1]={
local obj={ update=Task.update,
code=code, code=code,
P=P, P=P,
data=data, data=data,
id=id,
} }
setmetatable(obj,metatable_task)
Task[id]=obj
end end
function clearTask(opt) function clearTask(opt)
if opt=="all"then if opt=="all"then
@@ -34,14 +43,140 @@ function clearTask(opt)
end end
end end
end end
function Task:update()
if(not self.P or self.P and scene=="play")and self:code(self.P,self.data)then local a={a=1,b=2}
local e=#Task local x,y=pairs(a)
for i=1,e do assert(x==next)
if Task[i]==self then assert(y==a)
Task[e],Task[i]=nil,Task[e] --java王宇翔
return local button,switch,slider={type="button"},{type="switch"},{type="slider"}--WIDGET OBJECT LIB
end function newButton(x,y,w,h,color,font,code,hide,N)
end local _={
x=x-w*.5,y=y-h*.5,
w=w,h=h,
color=color,
font=font,
code=code,
hide=hide,
next=N,
}for k,v in next,button do _[k]=v end return _
end
function button:ifAbove(x,y)
return x>self.x and x<self.x+self.w and y>self.y and y<self.y+self.h
end
function button:FX()
sysFX[#sysFX+1]={0,0,10,self.x,self.y,self.w,self.h}
--[0=ripple],timer,duration,x,y,w,h
end
function button:draw()
local C=self.color
gc.setColor(C)
gc.setLineWidth(3)gc.rectangle("line",self.x,self.y,self.w,self.h,4)
gc.setColor(C[1],C[2],C[3],.4)
gc.setLineWidth(5)gc.rectangle("line",self.x,self.y,self.w,self.h,4)
if self==widget_sel then
gc.rectangle("fill",self.x,self.y,self.w,self.h,4)
end--Highlight when Selected
local t=self.text
if t then
if type(t)=="function"then t=t()end
setFont(self.font)
local y0=self.y+self.h*.5-self.font*.7
gc.printf(t,self.x-2,y0-1,self.w,"center")
gc.setColor(C)
gc.printf(t,self.x,y0,self.w,"center")
end end
end
function button:getInfo()
print(format("x=%d,y=%d,w=%d,h=%d,font=%d",self.x,self.y,self.w,self.h,self.font))
end
function newSwitch(x,y,font,disp,code,hide,N)
local _={
x=x,y=y,font=font,
disp=disp,
code=code,
hide=hide,
next=N,
}for k,v in next,switch do _[k]=v end return _
end
function switch:ifAbove(x,y)
return x>self.x and x<self.x+100 and y>self.y-20 and y<self.y+20
end
function switch:FX()
sysFX[#sysFX+1]=self.disp()and
{1,0,15,1,.4,.4,self.x,self.y-20,50,40,0}--Switched on
or{1,0,15,.4,1,.4,self.x+50,self.y-20,50,40,0}--Switched off
--[1=square fade],timer,duration,r,g,b,x,y,w,h
end
function switch:draw()
local x,y=self.x,self.y-20
if self.disp()then
gc.setColor(.6,1,.6)
gc.rectangle("fill",x+50,y,50,40,3)
--ON
else
gc.setColor(1,.6,.6)
gc.rectangle("fill",x,y,50,40,3)
--OFF
end--switch
gc.setColor(1,1,1,self==widget_sel and 1 or .6)
gc.setLineWidth(3)gc.rectangle("line",x-3,y-3,106,46,5)
--frame
local t=self.text
if t then
if type(t)=="function"then t=t()end
gc.setColor(1,1,1)
setFont(self.font)
gc.printf(t,x-412,y+20-self.font*.7,400,"right")
end
end
function switch:getInfo()
print(format("x=%d,y=%d,font=%d",self.x,self.y,self.font))
end
function newSlider(x,y,w,unit,font,change,disp,code,hide,N)
local _={
x=x,y=y,
w=w,unit=unit,
font=font,
change=change,
disp=disp,
code=code,
hide=hide,
next=N,
}for k,v in next,slider do _[k]=v end return _
end
function slider:ifAbove(x,y)
return x>self.x-10 and x<self.x+self.w+10 and y>self.y-20 and y<self.y+20
end
function slider:FX(pos)
sysFX[#sysFX+1]={1,0,10,1,1,1,self.x+self.w*pos/self.unit-8,self.y-15,17,30}
--[1=square fade],timer,duration,r,g,b,x,y,w,h
end
function slider:draw()
local S=self==widget_sel
gc.setColor(1,1,1,S and 1 or .5)
gc.setLineWidth(2)
local x1,x2=self.x,self.x+self.w
for p=0,self.unit do
local x=x1+(x2-x1)*p/self.unit
gc.line(x,self.y+7,x,self.y-7)
end
--units
gc.setLineWidth(5)
gc.line(x1,self.y,x2,self.y)
--axis
gc.setColor(1,1,1)
gc.rectangle("fill",x1+(x2-x1)*self.disp()/self.unit-8,self.y-15,17,30)
--block
local t=self.text
if t then
gc.setColor(1,1,1)
setFont(self.font)
gc.printf(t,self.x-312,self.y-self.font*.7,300,"right")
end
end
function slider:getInfo()
print(format("x=%d,y=%d,w=%d",self.x,self.y,self.w))
end end

View File

@@ -1,4 +1,4 @@
gameVersion="Alpha V0.7.22" gameVersion="Alpha V0.7.24"
function love.conf(t) function love.conf(t)
t.identity="Techmino"--Save directory name t.identity="Techmino"--Save directory name
t.version="11.1" t.version="11.1"

File diff suppressed because it is too large Load Diff

BIN
font.ttf

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 972 B

After

Width:  |  Height:  |  Size: 961 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -1,4 +1,3 @@
local SWC={[true]="",[false]=""}
local BK="返回" local BK="返回"
return{ return{
atkModeName={"随机","徽章","击杀","反击"}, atkModeName={"随机","徽章","击杀","反击"},
@@ -15,9 +14,10 @@ return{
PC="Perfect Clear", PC="Perfect Clear",
hold="暂存",next="下一个", hold="暂存",next="下一个",
stage={"关卡 1","关卡 2","关卡 3","关卡 4","关卡 5",}, stage=function(n)return"关卡 "..n end,
awesome="精彩。", great="Great!",
continue="继续。", awesome="Awesome.",
continue="Continue.",
maxspeed="最高速度", maxspeed="最高速度",
speedup="速度加快", speedup="速度加快",
@@ -25,7 +25,7 @@ return{
lose="失败", lose="失败",
pause="暂停", pause="暂停",
finish="结束", finish="结束",
pauseTime="暂停时间", pauseCount="暂停统计",
custom="自定义游戏", custom="自定义游戏",
customOption={ customOption={
@@ -44,7 +44,7 @@ return{
bgm="背景音乐:", bgm="背景音乐:",
}, },
customVal={ customVal={
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"","[20G]"}, drop={"[20G]",1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""},
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""}, lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""},
wait=nil, wait=nil,
fall=nil, fall=nil,
@@ -54,7 +54,7 @@ return{
visible={"可见","半隐","全隐","瞬隐"}, visible={"可见","半隐","全隐","瞬隐"},
target={10,20,40,100,200,500,1000,""}, target={10,20,40,100,200,500,1000,""},
freshLimit={0,8,15,""}, freshLimit={0,8,15,""},
opponent={"无电脑",1,2,3,4,5,6,7,8,9,10,11}, opponent={"无电脑","9S Lv1","9S Lv2","9S Lv3","9S Lv4","9S Lv5","CC Lv1","CC Lv2","CC Lv3","CC Lv4","CC Lv5","CC Lv6"},
}, },
softdropdas="软降DAS:", softdropdas="软降DAS:",
softdroparr="软降ARR:", softdroparr="软降ARR:",
@@ -68,7 +68,8 @@ return{
actName={"左移:","右移:","顺时针旋转:","逆时针旋转:","180°旋转","硬降:","软降:","暂存:","功能键:","重新开始:","左瞬移:","右瞬移:","软降到底:"}, actName={"左移:","右移:","顺时针旋转:","逆时针旋转:","180°旋转","硬降:","软降:","暂存:","功能键:","重新开始:","左瞬移:","右瞬移:","软降到底:"},
modeName={ modeName={
[0]="自定义", [0]="自定义",
"竞速","马拉松","大师","经典","","无尽","单挑","仅TSD","隐形","挖掘","生存","科研", "竞速","马拉松","大师","经典","","无尽","单挑","回合制","仅TSD","隐形",
"挖掘","生存","防守","进攻","科研",
"C4W练习","全清训练","全清挑战","49人混战","99人混战","干旱","多人", "C4W练习","全清训练","全清挑战","49人混战","99人混战","干旱","多人",
}, },
modeInfo={ modeInfo={
@@ -79,10 +80,13 @@ return{
zen="无重力消除200行", zen="无重力消除200行",
infinite="科研沙盒", infinite="科研沙盒",
solo="打败AI", solo="打败AI",
round="下棋",
tsd="尽可能做TSD", tsd="尽可能做TSD",
blind="最强大脑", blind="最强大脑",
dig="核能挖掘机", dig="核能挖掘机",
survivor="防守练习", survivor="你能存活多久?",
defender="防守练习",
attacker="进攻练习",
tech="尽可能不要普通消除", tech="尽可能不要普通消除",
c4wtrain="无 限 连 击", c4wtrain="无 限 连 击",
pctrain="熟悉全清定式的组合", pctrain="熟悉全清定式的组合",
@@ -110,14 +114,20 @@ return{
"适度游戏益脑,沉迷游戏伤身,合理安排时间,享受健康生活", "适度游戏益脑,沉迷游戏伤身,合理安排时间,享受健康生活",
"合群了就会消失,但是消失不代表没有意义", "合群了就会消失,但是消失不代表没有意义",
"学会使用两个旋转键,三个更好", "学会使用两个旋转键,三个更好",
"更小的DAS和ARR拥有更高的操作上限", "更小的DAS和ARR拥有更高的操作上限(如果你还能控制得了的话)",
"注意到\"旋转\"到底对方块做了些什么吗?", "注意到\"旋转\"到底对方块做了些什么吗?",
"20G是一套全新的游戏规则", "20G本质是一套全新的游戏规则",
"不要在上课时玩游戏!", "不要在上课时玩游戏!",
"本游戏难度上限很高,做好心理准备", "本游戏难度上限很高,做好心理准备",
"方块可以不是个休闲游戏", "方块可以不是个休闲游戏",
"调到特殊的日期也不会发生什么的", "调到特殊的日期也不会发生什么的",
"3.1415926535897932384", "3.1415926535897932384",
"2.7182818284590452353",
"Let-The-Bass-Kick!",
"使用love2d引擎制作",
"哪里不舒服的话先看看设置有没有你想要改的",
"有建议的话可以把信息反馈给作者~",
"本游戏不叫铁壳米诺",
}, },
stat={ stat={
"游戏运行次数:", "游戏运行次数:",
@@ -147,13 +157,14 @@ return{
"使用LOVE2D引擎", "使用LOVE2D引擎",
"作者:MrZ 邮箱:1046101471@qq.com", "作者:MrZ 邮箱:1046101471@qq.com",
"程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:Miya", "程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:Miya",
"使用工具:VScode,GFIE,Beepbox,Goldwave", "使用工具:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
"特别感谢:Farter,196,Teatube,Flyz,T830,[所有测试人员]和 你!", "特别感谢:Farter,Flyz,196,Teatube,T830,[所有测试人员]和 你!",
"错误或者建议请附带相关信息发送到作者邮箱~", "错误或者建议请附带相关信息发送到作者邮箱~",
}, },
support="支持作者", support="支持作者",
group="官方QQ群", group="官方QQ群",
ButtonText={ warning="禁 止 私 自 传 播",
WidgetText={
main={ main={
qplay="快速开始", qplay="快速开始",
play="开始", play="开始",
@@ -173,7 +184,7 @@ return{
back=BK, back=BK,
}, },
music={ music={
bgm=function()return"音乐:"..SWC[setting.bgm]end, bgm="BGM",
up="", up="",
play="播放", play="播放",
down="", down="",
@@ -216,45 +227,61 @@ return{
pause="暂停", pause="暂停",
}, },
pause={ pause={
resume="继续", resume= "继续",
quit="退出", restart="重新开始",
quit= "退出",
}, },
setting={ setting={
ghost=function()return"阴影:"..SWC[setting.ghost]end, game= "游戏设置",
center=function()return"旋转中心:"..SWC[setting.center]end, graphic="画面设置",
grid=function()return"网格:"..SWC[setting.grid]end, sound= "声音设置",
swap=function()return setting.swap and"目标选择:组合键"or"目标选择:循环"end, ctrl= "控制设置",
fxs=function()return setting.fxs>0 and"特效等级:"..setting.fxs or"特效 关"end, touch= "触屏设置",
bg=function()return"背景:"..SWC[setting.bg]end, lang= function()return langName[setting.lang]end,
back= "保存&返回",
},
setting_game={
dasD="-",dasU="+", dasD="-",dasU="+",
arrD="-",arrU="+", arrD="-",arrU="+",
sddasD="-",sddasU="+", sddasD="-",sddasU="+",
sdarrD="-",sdarrU="+", sdarrD="-",sdarrU="+",
ctrl="控制设置", holdR="长按重新开始",
touch="触摸设置", swap="组合键切换攻击模式",
lang=function()return langName[setting.lang]end, back=BK,
sfx=function()return"音效:"..SWC[setting.sfx]end, },
bgm=function()return"音乐:"..SWC[setting.bgm]end, setting_graphic={
vib=function()return "震动:"..setting.vib end, ghost="阴影",
voc=function()return"语音:"..SWC[setting.voc]end, grid="网格",
fullscreen=function()return"全屏:"..SWC[setting.fullscreen]end, center="旋转中心",
bgblock=function()return"背景动画:"..SWC[setting.bgblock]end,
frame=function()return"绘制帧:"..setting.frameMul.."%"end,
skin="皮肤", skin="皮肤",
smo=function()return"平滑下落:"..SWC[setting.smo]end, bg="背景",
back="保存&返回", bgblock="背景动画",
}, smo="平滑下落",
setting2={ dropFX="下落特效等级",
shakeFX="晃动特效等级",
atkFX="攻击特效等级",
fullscreen="全屏",
frame="绘制帧率",
back=BK, back=BK,
}, },
setting3={ setting_sound={
sfx="音效",
bgm="音乐",
vib="震动",
voc="语音",
back=BK, back=BK,
},
setting_control={
back=BK,
},
setting_touch={
hide=function()return setting.virtualkeySwitch and"隐藏虚拟按键"or"显示虚拟按键"end, hide=function()return setting.virtualkeySwitch and"隐藏虚拟按键"or"显示虚拟按键"end,
default="默认组合", default="默认组合",
snap=function()return text.snapLevelName[snapLevel]end, snap=function()return text.snapLevelName[snapLevel]end,
alpha=function()return setting.virtualkeyAlpha.."0%"end, alpha=function()return setting.virtualkeyAlpha.."0%"end,
icon="图标", icon="图标",
size="大小", size="大小",
back=BK,
}, },
help={ help={
his="历史", his="历史",
@@ -262,8 +289,8 @@ return{
back=BK, back=BK,
}, },
history={ history={
prev="", prev="",
next="", next="",
back=BK, back=BK,
}, },
stat={ stat={

View File

@@ -1,4 +1,3 @@
local SWC={[true]="",[false]=""}
local BK="返回" local BK="返回"
return{ return{
atkModeName={"随机","徽章","击杀","反击"}, atkModeName={"随机","徽章","击杀","反击"},
@@ -15,7 +14,8 @@ return{
PC="场地全清", PC="场地全清",
hold="暂存",next="下一个", hold="暂存",next="下一个",
stage={"关卡 1","关卡 2","关卡 3","关卡 4","关卡 5",}, stage=function(n)return"关卡 "..n end,
great="不错!",
awesome="精彩。", awesome="精彩。",
continue="继续。", continue="继续。",
maxspeed="最高速度", maxspeed="最高速度",
@@ -25,7 +25,7 @@ return{
lose="失败", lose="失败",
pause="暂停", pause="暂停",
finish="结束", finish="结束",
pauseTime="暂停时间", pauseCount="暂停统计",
custom="自定义游戏", custom="自定义游戏",
customOption={ customOption={
@@ -44,7 +44,7 @@ return{
bgm="背景音乐:", bgm="背景音乐:",
}, },
customVal={ customVal={
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"","[20G]"}, drop={"[20G]",1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""},
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""}, lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""},
wait=nil, wait=nil,
fall=nil, fall=nil,
@@ -54,7 +54,7 @@ return{
visible={"可见","半隐","全隐","瞬隐"}, visible={"可见","半隐","全隐","瞬隐"},
target={10,20,40,100,200,500,1000,""}, target={10,20,40,100,200,500,1000,""},
freshLimit={0,8,15,""}, freshLimit={0,8,15,""},
opponent={"无电脑",1,2,3,4,5,6,7,8,9,10,11}, opponent={"无电脑","9S Lv1","9S Lv2","9S Lv3","9S Lv4","9S Lv5","CC Lv1","CC Lv2","CC Lv3","CC Lv4","CC Lv5","CC Lv6"},
}, },
softdropdas="软降DAS:", softdropdas="软降DAS:",
softdroparr="软降ARR:", softdroparr="软降ARR:",
@@ -68,7 +68,8 @@ return{
actName={"左移:","右移:","顺时针旋转:","逆时针旋转:","180°旋转","硬降:","软降:","暂存:","功能键:","重新开始:","左瞬移:","右瞬移:","软降到底:"}, actName={"左移:","右移:","顺时针旋转:","逆时针旋转:","180°旋转","硬降:","软降:","暂存:","功能键:","重新开始:","左瞬移:","右瞬移:","软降到底:"},
modeName={ modeName={
[0]="自定义", [0]="自定义",
"竞速","马拉松","大师","经典","","无尽","单挑","仅TSD","隐形","挖掘","生存","科研", "竞速","马拉松","大师","经典","","无尽","单挑","回合制","仅TSD","隐形",
"挖掘","生存","防守","进攻","科研",
"C4W练习","全清训练","全清挑战","49人混战","99人混战","干旱","多人", "C4W练习","全清训练","全清挑战","49人混战","99人混战","干旱","多人",
}, },
modeInfo={ modeInfo={
@@ -79,10 +80,13 @@ return{
zen="无重力消除200行", zen="无重力消除200行",
infinite="科研沙盒", infinite="科研沙盒",
solo="打败AI", solo="打败AI",
round="下棋",
tsd="尽可能做T旋双清", tsd="尽可能做T旋双清",
blind="最强大脑", blind="最强大脑",
dig="核能挖掘机", dig="核能挖掘机",
survivor="防守练习", survivor="你能存活多久?",
defender="防守练习",
attacker="进攻练习",
tech="尽可能不要普通消除!", tech="尽可能不要普通消除!",
c4wtrain="无 限 连 击", c4wtrain="无 限 连 击",
pctrain="熟悉全清定式的组合", pctrain="熟悉全清定式的组合",
@@ -110,14 +114,20 @@ return{
"适度游戏益脑,沉迷游戏伤身,合理安排时间,享受健康生活", "适度游戏益脑,沉迷游戏伤身,合理安排时间,享受健康生活",
"合群了就会消失,但是消失不代表没有意义", "合群了就会消失,但是消失不代表没有意义",
"学会使用两个旋转键,三个更好", "学会使用两个旋转键,三个更好",
"更小的DAS和ARR拥有更高的操作上限", "更小的DAS和ARR拥有更高的操作上限(如果你还能控制得了的话)",
"注意到\"旋转\"到底对方块做了些什么吗?", "注意到\"旋转\"到底对方块做了些什么吗?",
"20G是一套全新的游戏规则", "20G本质是一套全新的游戏规则",
"不要在上课时玩游戏!", "不要在上课时玩游戏!",
"本游戏难度上限很高,做好心理准备", "本游戏难度上限很高,做好心理准备",
"方块可以不是个休闲游戏", "方块可以不是个休闲游戏",
"调到特殊的日期也不会发生什么的", "调到特殊的日期也不会发生什么的",
"3.1415926535897932384", "3.1415926535897932384",
"2.7182818284590452353",
"Let-The-Bass-Kick!",
"使用love2d引擎制作",
"哪里不舒服的话先看看设置有没有你想要改的",
"有建议的话可以把信息反馈给作者~",
"郑重声明本游戏不叫[铁壳米诺]",
}, },
stat={ stat={
"游戏运行次数:", "游戏运行次数:",
@@ -147,13 +157,14 @@ return{
"使用LOVE2D引擎", "使用LOVE2D引擎",
"作者:MrZ 邮箱:1046101471@qq.com", "作者:MrZ 邮箱:1046101471@qq.com",
"程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:Miya", "程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:Miya",
"使用工具:VScode,GFIE,Beepbox,Goldwave", "使用工具:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
"特别感谢:Farter,Teatube,196,Flyz,T830,[所有测试人员]和 你!", "特别感谢:Farter,Flyz,196,Teatube,T830,[所有测试人员]和 你!",
"错误或者建议请附带相关信息发送到作者邮箱~", "错误或者建议请附带相关信息发送到作者邮箱~",
}, },
support="支持作者", support="支持作者",
group="官方QQ群", group="官方QQ群",
ButtonText={ warning="禁 止 私 自 传 播",
WidgetText={
main={ main={
qplay="快速开始", qplay="快速开始",
play="开始", play="开始",
@@ -173,7 +184,7 @@ return{
back=BK, back=BK,
}, },
music={ music={
bgm=function()return"音乐:"..SWC[setting.bgm]end, bgm="BGM",
up="", up="",
play="播放", play="播放",
down="", down="",
@@ -216,45 +227,61 @@ return{
pause="暂停", pause="暂停",
}, },
pause={ pause={
resume="继续", resume= "继续",
quit="退出", restart="重新开始",
quit= "退出",
}, },
setting={ setting={
ghost=function()return"阴影:"..SWC[setting.ghost]end, game= "游戏设置",
center=function()return"旋转中心:"..SWC[setting.center]end, graphic="画面设置",
grid=function()return"网格:"..SWC[setting.grid]end, sound= "声音设置",
swap=function()return setting.swap and"目标选择:组合键"or"目标选择:循环"end, ctrl= "控制设置",
fxs=function()return setting.fxs>0 and"特效等级:"..setting.fxs or"特效 关"end, touch= "触屏设置",
bg=function()return"背景:"..SWC[setting.bg]end, lang= function()return langName[setting.lang]end,
back= "保存&返回",
},
setting_game={
dasD="-",dasU="+", dasD="-",dasU="+",
arrD="-",arrU="+", arrD="-",arrU="+",
sddasD="-",sddasU="+", sddasD="-",sddasU="+",
sdarrD="-",sdarrU="+", sdarrD="-",sdarrU="+",
ctrl="控制设置", holdR="长按重新开始",
touch="触摸设置", swap="组合键切换攻击模式",
lang=function()return langName[setting.lang]end, back=BK,
sfx=function()return"音效:"..SWC[setting.sfx]end, },
bgm=function()return"音乐:"..SWC[setting.bgm]end, setting_graphic={
vib=function()return "震动:"..setting.vib end, ghost="阴影",
voc=function()return"语音:"..SWC[setting.voc]end, grid="网格",
fullscreen=function()return"全屏:"..SWC[setting.fullscreen]end, center="旋转中心",
bgblock=function()return"背景动画:"..SWC[setting.bgblock]end,
frame=function()return"绘制帧:"..setting.frameMul.."%"end,
skin="皮肤", skin="皮肤",
smo=function()return"平滑下落:"..SWC[setting.smo]end, bg="背景",
back="保存&返回", bgblock="背景动画",
}, smo="平滑下落",
setting2={ dropFX="下落特效等级",
shakeFX="晃动特效等级",
atkFX="攻击特效等级",
fullscreen="全屏",
frame="绘制帧率",
back=BK, back=BK,
}, },
setting3={ setting_sound={
sfx="音效",
bgm="音乐",
vib="震动",
voc="语音",
back=BK, back=BK,
},
setting_control={
back=BK,
},
setting_touch={
hide=function()return setting.virtualkeySwitch and"隐藏虚拟按键"or"显示虚拟按键"end, hide=function()return setting.virtualkeySwitch and"隐藏虚拟按键"or"显示虚拟按键"end,
default="默认组合", default="默认组合",
snap=function()return text.snapLevelName[snapLevel]end, snap=function()return text.snapLevelName[snapLevel]end,
alpha=function()return setting.virtualkeyAlpha.."0%"end, alpha=function()return setting.virtualkeyAlpha.."0%"end,
icon="图标", icon="图标",
size="大小", size="大小",
back=BK,
}, },
help={ help={
his="历史", his="历史",
@@ -262,8 +289,8 @@ return{
back=BK, back=BK,
}, },
history={ history={
prev="", prev="",
next="", next="",
back=BK, back=BK,
}, },
stat={ stat={

View File

@@ -1,4 +1,3 @@
local SWC={[true]="ON",[false]="OFF"}
local BK="Back" local BK="Back"
return{ return{
atkModeName={"Random","Badges","K.O.s","Counters"}, atkModeName={"Random","Badges","K.O.s","Counters"},
@@ -15,7 +14,8 @@ return{
PC="Perfect Clear", PC="Perfect Clear",
hold="Hold",next="Next", hold="Hold",next="Next",
stage={"STAGE 1","STAGE 2","STAGE 3","STAGE 4","STAGE 5",}, stage=function(n)return"STAGE "..n end,
great="Great!",
awesome="Awesome.", awesome="Awesome.",
continue="Continue.", continue="Continue.",
maxspeed="Max speed", maxspeed="Max speed",
@@ -25,8 +25,8 @@ return{
lose="LOSE", lose="LOSE",
pause="PAUSE", pause="PAUSE",
finish="FINISH", finish="FINISH",
pauseTime="Pause time", pauseCount="Pause Count",
custom="Custom Game", custom="Custom Game",
customOption={ customOption={
drop="Drop delay:", drop="Drop delay:",
@@ -44,7 +44,7 @@ return{
bgm="BGM:", bgm="BGM:",
}, },
customVal={ customVal={
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,"","[20G]"}, drop={"[20G]",1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""},
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""}, lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,""},
wait=nil, wait=nil,
fall=nil, fall=nil,
@@ -54,7 +54,7 @@ return{
visible={"normal","time","invisible","sudden"}, visible={"normal","time","invisible","sudden"},
target={10,20,40,100,200,500,1000,""}, target={10,20,40,100,200,500,1000,""},
freshLimit={0,8,15,""}, freshLimit={0,8,15,""},
opponent={"No CPU",1,2,3,4,5,6,7,8,9,10,11}, opponent={"No CPU","9S Lv1","9S Lv2","9S Lv3","9S Lv4","9S Lv5","CC Lv1","CC Lv2","CC Lv3","CC Lv4","CC Lv5","CC Lv6"},
}, },
softdropdas="Down DAS:", softdropdas="Down DAS:",
softdroparr="Down ARR:", softdroparr="Down ARR:",
@@ -68,7 +68,8 @@ return{
actName={"Move Left:","Move Right:","Rotate Right:","Rotate Left:","Rotate Flip:","Hard Drop:","Soft Drop:","Hold:","Function:","Restart:","Instant Left:","Instant Right:","Ins Down:"}, actName={"Move Left:","Move Right:","Rotate Right:","Rotate Left:","Rotate Flip:","Hard Drop:","Soft Drop:","Hold:","Function:","Restart:","Instant Left:","Instant Right:","Ins Down:"},
modeName={ modeName={
[0]="Custom", [0]="Custom",
"Sprint","Marathon","Master","Classic","Zen","Infinite","1v1","TSD-only","Blind","Dig","Survivor","Tech", "Sprint","Marathon","Master","Classic","Zen","Infinite","1v1","Round","TSD-only","Blind",
"Dig","Survivor","Defender","Attacker","Tech",
"C4W Train","PC Train","PC Challenge","Techmino49","Techmino99","Drought","Hotseat", "C4W Train","PC Train","PC Challenge","Techmino49","Techmino99","Drought","Hotseat",
}, },
modeInfo={ modeInfo={
@@ -79,10 +80,13 @@ return{
zen="Clear 200 Lines without gravity", zen="Clear 200 Lines without gravity",
infinite="Infinite game,infinite happiness", infinite="Infinite game,infinite happiness",
solo="Beat AI", solo="Beat AI",
round="Chess?",
tsd="Make more T-spin-doubles", tsd="Make more T-spin-doubles",
blind="Invisible board", blind="Invisible board",
dig="Downstack!", dig="Downstack!",
survivor="Hand them!", survivor="Survive Longer!",
defender="Hand them!",
attacker="Attacking better then defending",
tech="Don't do normal clear", tech="Don't do normal clear",
c4wtrain="Infinite combo", c4wtrain="Infinite combo",
pctrain="Let's learn some PCs", pctrain="Let's learn some PCs",
@@ -110,14 +114,20 @@ return{
"Playing too much = taking drugs", "Playing too much = taking drugs",
"Disappearing doesn't mean useless", "Disappearing doesn't mean useless",
"Try to use two rotate button,three better", "Try to use two rotate button,three better",
"Small DAS&ARR can make you faster,if you can adapt to it", "Small DAS&ARR can make you faster,if you can control block correctly",
"Have you noticed what does \"rotating\" do to block?", "Have you noticed what does \"rotating\" do to block?",
"20G is a brand new game rule", "20G actually is a brand new game rule",
"Do not play game in class!", "Do not play game in class!",
"This game can be very hard,be mentally perpared", "This game can be very hard,be mentally perpared",
"This in not a casual game", "This in not a casual game",
"Nothing will happen when some special day come", "Nothing will happen when some special day come",
"3.1415926535897932384", "3.1415926535897932384",
"2.7182818284590452353",
"Let-The-Bass-Kick!",
"Powered by love2d",
"Find out what's in the setting!",
"Any suggestions to author!~",
"Techmino=Technique+tetromino",
}, },
stat={ stat={
"Games run:", "Games run:",
@@ -147,13 +157,14 @@ return{
"Powered by LOVE2D", "Powered by LOVE2D",
"Author:MrZ E-mail:1046101471@qq.com", "Author:MrZ E-mail:1046101471@qq.com",
"Programe:MrZ Art:MrZ Music:MrZ SFX:MrZ VOICE:Miya", "Programe:MrZ Art:MrZ Music:MrZ SFX:MrZ VOICE:Miya",
"Tool used:VScode,GFIE,Beepbox,Goldwave", "Tool used:VScode,GFIE,Beepbox,Goldwave,Cold_Clear",
"Special thanks:Farter,Teatube,196,Flyz,T830,[all test staff] and YOU!", "Special thanks:Farter,Flyz,196,Teatube,T830,[all test staff] and YOU!",
"Any bugs/suggestions to my E-mail.", "Any bugs/suggestions to my E-mail.",
}, },
support="Support Author", support="Support Author",
group="Official QQ Group", group="Official QQ Group",
ButtonText={ warning="DO NOT DISTRIBUTE",
WidgetText={
main={ main={
qplay="Qplay", qplay="Qplay",
play="Play", play="Play",
@@ -173,7 +184,7 @@ return{
back=BK, back=BK,
}, },
music={ music={
bgm=function()return"BGM:"..SWC[setting.bgm]end, bgm="BGM",
up="", up="",
play="Play", play="Play",
down="", down="",
@@ -217,44 +228,60 @@ return{
}, },
pause={ pause={
resume="Resume", resume="Resume",
restart="Restart",
quit="Quit", quit="Quit",
}, },
setting={ setting={
ghost=function()return"Ghost:"..SWC[setting.ghost]end, game= "Game Settings",
center=function()return"Center:"..SWC[setting.center]end, graphic="Graphic Settings",
grid=function()return"Grid:"..SWC[setting.grid]end, sound= "Sound Settings",
swap=function()return setting.swap and"Swap:comboKey"or"Swap:loop"end, ctrl= "Control Settings",
fxs=function()return setting.fxs>0 and"FX level:"..setting.fxs or"NO FX"end, touch= "Touch Settings",
bg=function()return"BG:"..SWC[setting.bg]end, lang= function()return langName[setting.lang]end,
back= "Save&Back",
},
setting_game={
dasD="-",dasU="+", dasD="-",dasU="+",
arrD="-",arrU="+", arrD="-",arrU="+",
sddasD="-",sddasU="+", sddasD="-",sddasU="+",
sdarrD="-",sdarrU="+", sdarrD="-",sdarrU="+",
ctrl="Control settings", holdR="Hold R to restart",
touch="Touch settings", swap="Combo key to change ATK mode",
lang=function()return langName[setting.lang]end, back=BK,
sfx=function()return"SFX:"..SWC[setting.sfx]end, },
bgm=function()return"BGM:"..SWC[setting.bgm]end, setting_graphic={
voc=function()return"VOC:"..SWC[setting.voc]end, ghost="Ghost",
vib=function()return "VIB:"..setting.vib end, grid="Grid",
fullscreen=function()return"Fullscreen:"..SWC[setting.fullscreen]end, center="Center",
bgblock=function()return"BG animation:"..SWC[setting.bgblock]end,
frame=function()return"FrameDraw:"..setting.frameMul.."%"end,
skin="Skin", skin="Skin",
smo=function()return"SmoothDrop:"..SWC[setting.smo]end, bg="Background",
back="Save&Back", bgblock="BG animation",
}, smo="Smoooth drop",
setting2={ dropFX="Drop FX level",
shakeFX="Shake FX level",
atkFX="ATK FX level",
fullscreen="Fullscreen",
frame="drawFPS",
back=BK, back=BK,
}, },
setting3={ setting_sound={
sfx="SFX",
bgm="BGM",
vib="VIB",
voc="VOC",
back=BK, back=BK,
},
setting_control={
back=BK,
},
setting_touch={
hide=function()return setting.virtualkeySwitch and"Hide Virtual Key"or"Show Virtual Key"end, hide=function()return setting.virtualkeySwitch and"Hide Virtual Key"or"Show Virtual Key"end,
default="Defaults", default="Defaults",
snap=function()return text.snapLevelName[snapLevel]end, snap=function()return text.snapLevelName[snapLevel]end,
alpha=function()return setting.virtualkeyAlpha.."0%"end, alpha=function()return setting.virtualkeyAlpha.."0%"end,
icon="Icon", icon="Icon",
size="Size", size="Size",
back=BK,
}, },
help={ help={
his="History", his="History",
@@ -262,8 +289,8 @@ return{
back=BK, back=BK,
}, },
history={ history={
prev="", prev="",
next="", next="",
back=BK, back=BK,
}, },
stat={ stat={

329
list.lua
View File

@@ -2,7 +2,7 @@ local gc=love.graphics
local tc,kb=love.touch,love.keyboard local tc,kb=love.touch,love.keyboard
local sys=love.system local sys=love.system
local fs=love.filesystem local fs=love.filesystem
local mobile=mobile local mobile=system=="Android"or system=="iOS"
actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","func","restart","insLeft","insRight","insDown"} actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","func","restart","insLeft","insRight","insDown"}
color={ color={
@@ -79,16 +79,17 @@ bgm={
"secret8th", "secret8th",
"rockblock", "rockblock",
"8-bit happiness", "8-bit happiness",
"shining terminal",
"end", "end",
} }
voiceList={ voiceBank={}
voiceName={
"Z","S","L","J","T","O","I", "Z","S","L","J","T","O","I",
"single","double","triple","tts", "single","double","triple","tts",
"spin","spin_","mini","b2b","b3b","pc", "spin","spin_","mini","b2b","b3b","pc",
"win","lose","voc_nya","nya", "win","lose","voc_nya","nya",
} }
voiceBank={} voiceList={
voice={
Z={"Z_1","Z_2"}, Z={"Z_1","Z_2"},
S={"S_1","S_2"}, S={"S_1","S_2"},
J={"J_1","J_2"}, J={"J_1","J_2"},
@@ -120,12 +121,13 @@ musicID={
"push", "push",
"reason", "reason",
"infinite", "infinite",
"cruelty",
"final",
"secret7th", "secret7th",
"secret8th", "secret8th",
"shining terminal",
"rockblock", "rockblock",
"8-bit happiness", "8-bit happiness",
"cruelty",
"final",
"end", "end",
} }
customID={ customID={
@@ -139,7 +141,7 @@ customID={
"bg","bgm", "bg","bgm",
} }
customRange={ customRange={
drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99,-1}, drop={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99}, lock={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99},
wait={0,1,2,3,4,5,6,7,8,10,15,20,30,60}, wait={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60}, fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
@@ -149,7 +151,7 @@ customRange={
visible={"show","time","fast","none"}, visible={"show","time","fast","none"},
target={10,20,40,100,200,500,1000,1e99}, target={10,20,40,100,200,500,1000,1e99},
freshLimit={0,8,15,1e99}, freshLimit={0,8,15,1e99},
opponent={0,60,30,20,15,10,7,5,4,3,2,1}, opponent={0,1,2,3,4,5,11,12,13,14,15,16},
bg={"none","game1","game2","game3","strap","rgb","glow","matrix"}, bg={"none","game1","game2","game3","strap","rgb","glow","matrix"},
bgm={"blank","way","race","newera","push","reason","infinite","secret7th","secret8th","rockblock"}, bgm={"blank","way","race","newera","push","reason","infinite","secret7th","secret8th","rockblock"},
} }
@@ -160,27 +162,31 @@ up0to4={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",}
modeID={ modeID={
[0]="custom", [0]="custom",
"sprint","marathon","master","classic","zen","infinite","solo","tsd","blind","dig","survivor","tech", "sprint","marathon","master","classic","zen","infinite","solo","round","tsd","blind",
"dig","survivor","defender","attacker","tech",
"c4wtrain","pctrain","pcchallenge","techmino49","techmino99","drought","hotseat", "c4wtrain","pctrain","pcchallenge","techmino49","techmino99","drought","hotseat",
} }
modeLevel={ modeLevel={
sprint={"10L","20L","40L","100L","400L","1000L"}, sprint={"10L","20L","40L","100L","400L","1000L"},
marathon={"EASY","NORMAL","HARD"}, marathon={"EASY","NORMAL","HARD"},
master={"LUNATIC","ULTIMATE"}, master={"LUNATIC","ULTIMATE","FINAL"},
classic={"CTWC"}, classic={"CTWC"},
zen={"NORMAL"}, zen={"NORMAL"},
infinite={"NORMAL","EXTRA"}, infinite={"NORMAL","EXTRA"},
solo={"EASY","NORMAL","HARD","LUNATIC"}, solo={"EASY","EASY+","NORMAL","NORMAL+","HARD","HARD+","LUNATIC","LUNATIC+","ULTIMATE"},
round={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"},
tsd={"NORMAL","HARD"}, tsd={"NORMAL","HARD"},
blind={"EASY","HARD","HARD+","LUNATIC","ULTIMATE","GM"}, blind={"EASY","HARD","HARD+","LUNATIC","ULTIMATE","GM"},
dig={"NORMAL","LUNATIC"}, dig={"NORMAL","LUNATIC"},
survivor={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE","EXTRA"}, survivor={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE","EXTRA"},
defender={"NORMAL","LUNATIC"},
attacker={"HARD","ULTIMATE"},
tech={"NORMAL","NORMAL+","HARD","HARD+","LUNATIC","LUNATIC+",}, tech={"NORMAL","NORMAL+","HARD","HARD+","LUNATIC","LUNATIC+",},
c4wtrain={"NORMAL","LUNATIC"}, c4wtrain={"NORMAL","LUNATIC"},
pctrain={"NORMAL","EXTRA"}, pctrain={"NORMAL","EXTRA"},
pcchallenge={"NORMAL","HARD","LUNATIC"}, pcchallenge={"NORMAL","HARD","LUNATIC"},
techmino49={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"}, techmino49={"EASY","HARD","ULTIMATE"},
techmino99={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"}, techmino99={"EASY","HARD","ULTIMATE"},
drought={"NORMAL","MESS"}, drought={"NORMAL","MESS"},
hotseat={"2P","3P","4P",}, hotseat={"2P","3P","4P",},
custom={"Normal","Puzzle"}, custom={"Normal","Puzzle"},
@@ -265,7 +271,7 @@ local customSet={
{18,20,1,1,7,1,1,1,8,3,8,3,3}, {18,20,1,1,7,1,1,1,8,3,8,3,3},
{22,22,1,1,7,3,1,1,8,4,1,7,7}, {22,22,1,1,7,3,1,1,8,4,1,7,7},
{20,20,1,1,7,1,1,3,8,3,1,7,8}, {20,20,1,1,7,1,1,3,8,3,1,7,8},
{23,11,8,11,4,1,2,1,8,3,1,4,9}, {1,11,8,11,4,1,2,1,8,3,1,4,9},
} }
local function useDefaultSet(n) local function useDefaultSet(n)
for i=1,#customSet[n]do for i=1,#customSet[n]do
@@ -274,194 +280,207 @@ local function useDefaultSet(n)
curBG=customRange.bg[customSel[12]] curBG=customRange.bg[customSel[12]]
BGM(customRange.bgm[customSel[13]]) BGM(customRange.bgm[customSel[13]])
end end
Buttons={ Widget={
load={}, load={},
intro={}, intro={},
main={ main={
qplay= {x=160,y=300,w=150, h=150, rgb=color.lightRed, f=40,code=function()loadGame(modeSel,levelSel)end,down="stat",right="play"}, qplay= newButton(160, 300,150,150,color.lightRed, 40,function()loadGame(modeSel,levelSel)end, nil,"play"),
play= {x=380,y=300,w=240, h=240, rgb=color.red, f=70,code=function()gotoScene("mode")end,down="stat",left="qplay",right="setting"}, play= newButton(380, 300,240,240,color.red, 70,function()gotoScene("mode")end, nil,"setting"),
setting={x=640,y=300,w=240, h=240, rgb=color.lightBlue,f=55,code=function()gotoScene("setting")end,down="stat",left="play",right="music"}, setting=newButton(640, 300,240,240,color.lightBlue,55,function()gotoScene("setting")end, nil,"music"),
music= {x=900,y=300,w=240, h=240, rgb=color.lightCyan,f=42,code=function()gotoScene("music")end,down="help",left="setting",right="quit"}, music= newButton(900, 300,240,240,color.lightCyan,42,function()gotoScene("music")end, nil,"stat"),
stat= {x=640,y=560,w=240, h=240, rgb=color.cyan, f=55,code=function()gotoScene("stat")end,up="setting",left="play",right="help"}, stat= newButton(640, 560,240,240,color.cyan, 55,function()gotoScene("stat")end, nil,"help"),
help= {x=900,y=560,w=240, h=240, rgb=color.yellow, f=55,code=function()gotoScene("help")end,up="music",left="stat",right="quit"}, help= newButton(900, 560,240,240,color.yellow, 55,function()gotoScene("help")end, nil,"quit"),
quit= {x=1180,y=620,w=120,h=120, rgb=color.lightGrey,f=50,code=function()gotoScene("quit")end,up="setting",left="help"}, quit= newButton(1180,620,120,120,color.lightGrey,50,function()gotoScene("quit")end, nil,"qplay"),
}, },
mode={ mode={
up= {x=1000,y=210,w=200,h=140, rgb=color.white, f=80, code=function()love.keypressed("up")end, hide=function()return modeSel==1 end,}, up= newButton(1000,210,200,140,color.white, 80,function()love.keypressed("up")end,function()return modeSel==1 end),
down= {x=1000,y=430,w=200,h=140, rgb=color.white, f=80, code=function()love.keypressed("down")end, hide=function()return modeSel==#modeID end,}, down= newButton(1000,430,200,140,color.white, 80,function()love.keypressed("down")end,function()return modeSel==#modeID end),
left= {x=190, y=160,w=100,h=80, rgb=color.white, code=function()love.keypressed("left")end, hide=function()return levelSel==1 end,}, left= newButton(190, 160,100,80, color.white, 40,function()love.keypressed("left")end,function()return levelSel==1 end),
right= {x=350, y=160,w=100,h=80, rgb=color.white, code=function()love.keypressed("right")end, hide=function()return levelSel==#modeLevel[modeID[modeSel]]end,}, right= newButton(350, 160,100,80, color.white, 40,function()love.keypressed("right")end,function()return levelSel==#modeLevel[modeID[modeSel]]end),
start= {x=1000,y=600,w=250,h=100, rgb=color.green, f=50, code=function()loadGame(modeSel,levelSel)end}, start= newButton(1000,600,250,100,color.green, 50,function()loadGame(modeSel,levelSel)end),
custom= {x=275, y=420,w=200,h=90, rgb=color.yellow, code=function()gotoScene("custom")end}, custom= newButton(275, 420,200,90, color.yellow, 40,function()gotoScene("custom")end),
back= {x=640, y=630,w=230,h=90, rgb=color.white, f=45, code=back}, back= newButton(640, 630,230,90, color.white, 45,back),
}, },
music={ music={
bgm= {x=1100,y=80, w=160, h=80, rgb=color.white,code=function()BGM()setting.bgm=not setting.bgm end}, bgm= newSlider(760,80,400,8,40,nil,function()return setting.bgm end,function(i)setting.bgm=i;BGM(bgmPlaying)end),
up= {x=1100,y=200, w=120, h=120, rgb=color.white,f=40,hide=function()return not setting.bgm end,code=function()sel=(sel-2)%#musicID+1 end}, up= newButton(1100,200,120,120,color.white,60,function()love.keypressed("up")end),
play= {x=1100,y=340, w=120, h=120, rgb=color.white,f=40,hide=function()return not setting.bgm end,code=function()BGM(musicID[sel])end}, play= newButton(1100,340,120,120,color.white,40,function()love.keypressed("space")end,function()return setting.bgm==0 end),
down= {x=1100,y=480, w=120, h=120, rgb=color.white,f=50,hide=function()return not setting.bgm end,code=function()sel=sel%#musicID+1 end}, down= newButton(1100,480,120,120,color.white,60,function()love.keypressed("down")end),
back= {x=640, y=630, w=230, h=90, rgb=color.white,f=45,code=back}, back= newButton(640, 630,230,90, color.white,45,back),
}, },
custom={ custom={
up= {x=1000,y=220, w=100,h=100, rgb=color.white,f=50, code=function()sel=(sel-2)%#customID+1 end}, up= newButton(1000,220,100,100,color.white, 50,function()sel=(sel-2)%#customID+1 end),
down= {x=1000,y=460, w=100,h=100, rgb=color.white,f=50, code=function()sel=sel%#customID+1 end}, down= newButton(1000,460,100,100,color.white, 50,function()sel=sel%#customID+1 end),
left= {x=880, y=340, w=100,h=100, rgb=color.white,f=50, code=function() left= newButton(880, 340,100,100,color.white, 50,function()love.keypressed("left")end),
customSel[sel]=(customSel[sel]-2)%#customRange[customID[sel]]+1 right= newButton(1120,340,100,100,color.white, 50,function()love.keypressed("right")end),
if sel==12 then start1= newButton(880, 580,220,70, color.green, 40,function()loadGame(0,1)end),
curBG=customRange.bg[customSel[12]] start2= newButton(1120,580,220,70, color.lightPurple, 40,function()loadGame(0,2)end),
elseif sel==13 then draw= newButton(1000,90, 190,85, color.cyan, 40,function()gotoScene("draw")end),
BGM(customRange.bgm[customSel[13]]) set1= newButton(640, 160,240,75, color.lightRed, 40,function()useDefaultSet(1)end),
end set2= newButton(640, 250,240,75, color.lightRed, 40,function()useDefaultSet(2)end),
end}, set3= newButton(640, 340,240,75, color.lightRed, 40,function()useDefaultSet(3)end),
right= {x=1120,y=340, w=100,h=100, rgb=color.white,f=50, code=function() set4= newButton(640, 430,240,75, color.lightRed, 40,function()useDefaultSet(4)end),
customSel[sel]=customSel[sel]%#customRange[customID[sel]]+1 set5= newButton(640, 520,240,75, color.lightRed, 40,function()useDefaultSet(5)end),
if sel==12 then back= newButton(640, 630,180,60, color.white, 40,back),
curBG=customRange.bg[customSel[12]]
elseif sel==13 then
BGM(customRange.bgm[customSel[13]])
end
end},
start1= {x=880, y=580, w=220,h=70, rgb=color.green, code=function()loadGame(0,1)end},
start2= {x=1120,y=580, w=220,h=70, rgb=color.lightPurple, code=function()loadGame(0,2)end},
draw= {x=1000,y=90, w=190,h=85, rgb=color.cyan, code=function()gotoScene("draw")end},
set1= {x=640, y=160, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(1)end},
set2= {x=640, y=250, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(2)end},
set3= {x=640, y=340, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(3)end},
set4= {x=640, y=430, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(4)end},
set5= {x=640, y=520, w=240,h=75, rgb=color.lightRed, code=function()useDefaultSet(5)end},
back= {x=640, y=630, w=180,h=60, rgb=color.white, code=back},
}, },
draw={ draw={
any= {x=700, y=80,w=120,h=120, f=45, rgb=color.lightGrey,code=function()pen=-1 end}, any= newButton(700, 80, 120,120,color.lightGrey, 45,function()pen=0 end),
block1= {x=840, y=80,w=120,h=120, f=65, rgb=color.red, code=function()pen=1 end}, block1= newButton(840, 80, 120,120,color.red, 65,function()pen=1 end),
block2= {x=980, y=80,w=120,h=120, f=65, rgb=color.green, code=function()pen=2 end}, block2= newButton(980, 80, 120,120,color.green, 65,function()pen=2 end),
block3= {x=1120,y=80,w=120,h=120, f=65, rgb=color.orange, code=function()pen=3 end}, block3= newButton(1120,80, 120,120,color.orange, 65,function()pen=3 end),
block4= {x=840, y=220,w=120,h=120, f=65, rgb=color.blue, code=function()pen=4 end}, block4= newButton(840, 220,120,120,color.blue, 65,function()pen=4 end),
block5= {x=980, y=220,w=120,h=120, f=65, rgb=color.magenta, code=function()pen=5 end}, block5= newButton(980, 220,120,120,color.magenta, 65,function()pen=5 end),
block6= {x=1120,y=220,w=120,h=120, f=65, rgb=color.yellow, code=function()pen=6 end}, block6= newButton(1120,220,120,120,color.yellow, 65,function()pen=6 end),
block7= {x=840, y=360,w=120,h=120, f=65, rgb=color.cyan, code=function()pen=7 end}, block7= newButton(840, 360,120,120,color.cyan, 65,function()pen=7 end),
gb1= {x=980, y=360,w=120,h=120, f=65, rgb=color.darkGrey, code=function()pen=9 end}, gb1= newButton(980, 360,120,120,color.darkGrey, 65,function()pen=9 end),
gb2= {x=1120,y=360,w=120,h=120, f=65, rgb=color.grey, code=function()pen=10 end}, gb2= newButton(1120,360,120,120,color.grey, 65,function()pen=10 end),
gb3= {x=840, y=500,w=120,h=120, f=65, rgb=color.darkPurple,code=function()pen=11 end}, gb3= newButton(840, 500,120,120,color.darkPurple, 65,function()pen=11 end),
gb4= {x=980, y=500,w=120,h=120, f=65, rgb=color.darkRed, code=function()pen=12 end}, gb4= newButton(980, 500,120,120,color.darkRed, 65,function()pen=12 end),
gb5= {x=1120,y=500,w=120,h=120, f=65, rgb=color.darkGreen,code=function()pen=13 end}, gb5= newButton(1120,500,120,120,color.darkGreen, 65,function()pen=13 end),
space= {x=840, y=640,w=120,h=120, f=70, rgb=color.grey, code=function()pen=0 end}, space= newButton(840, 640,120,120,color.grey, 70,function()pen=-1 end),
clear= {x=1120,y=640,w=120,h=120, f=45, rgb=color.white, code=function() clear= newButton(1120,640,120,120,color.white, 45,function()love.keypressed("delete")end),
if clearSureTime>15 then back= newButton(1235,45, 80, 80, color.white, 35,back),
for y=1,20 do for x=1,10 do preField[y][x]=-1 end end
clearSureTime=0
else
clearSureTime=50
end
end},
back= {x=1235,y=45,w=80,h=80, f=35, rgb=color.white, code=back},
}, },
play={ play={
pause={x=1235,y=45,w=80,h=80,rgb=color.white,f=30,code=pauseGame}, pause= newButton(1235,45,80,80,color.white,30,pauseGame),
}, },
pause={ pause={
resume= {x=640,y=400,w=240,h=100, rgb=color.white,f=50,code=resumeGame}, resume= newButton(640,290,240,100,color.white,50,resumeGame),
quit= {x=640,y=550,w=240,h=100, rgb=color.white,f=50,code=back}, restart=newButton(640,445,240,100,color.white,50,function()
clearTask("play")
updateStat()
resetGameData()
gotoScene("play","none")
end),
quit= newButton(640,600,240,100,color.white,50,back),
}, },
setting={--Normal setting setting={
ghost= {x=290, y=90, w=210, h=60, rgb=color.white,code=function()setting.ghost=not setting.ghost end,down="grid",right="center"}, game= newButton(640,100,320,70,color.white,40,function()gotoScene("setting_game") end,nil,"graphic"),
center= {x=505, y=90, w=210, h=60, rgb=color.white,code=function()setting.center=not setting.center end,down="swap",left="ghost",right="sfx"}, graphic=newButton(640,180,320,70,color.white,40,function()gotoScene("setting_graphic") end,nil,"sound"),
grid= {x=290, y=160, w=210, h=60, rgb=color.white,code=function()setting.grid=not setting.grid end,up="ghost",down="fxs",right="swap"}, sound= newButton(640,260,320,70,color.white,40,function()gotoScene("setting_sound") end,nil,"ctrl"),
swap= {x=505, y=160, w=210, h=60,f=28, rgb=color.white,code=function()setting.swap=not setting.swap end,up="center",down="bg",left="grid",right="vib"}, ctrl= newButton(640,340,320,70,color.white,40,function()gotoScene("setting_control") end,nil,"touch"),
fxs= {x=290, y=230, w=210, h=60, rgb=color.white,code=function()setting.fxs=(setting.fxs+1)%4 end,up="grid",down="dasU",right="bg"}, touch= newButton(640,420,320,70,color.white,40,function()gotoScene("setting_touch") end,nil,"lang"),
bg= {x=505, y=230, w=210, h=60, rgb=color.white,code=function()setting.bg=not setting.bg end,up="swap",down="arrD",left="fxs",right="fullscreen"}, lang= newButton(640,500,320,70,color.red,40,function()
dasD= {x=210, y=300, w=50, h=50, rgb=color.white,code=function()setting.das=(setting.das-1)%31 end,up="fxs",down="sddasD",right="dasU"},
dasU= {x=370, y=300, w=50, h=50, rgb=color.white,code=function()setting.das=(setting.das+1)%31 end,up="fxs",down="sddasU",left="dasD",right="arrD"},
arrD= {x=425, y=300, w=50, h=50, rgb=color.white,code=function()setting.arr=(setting.arr-1)%16 end,up="bg",down="sdarrD",left="dasU",right="arrU"},
arrU= {x=585, y=300, w=50, h=50, rgb=color.white,code=function()setting.arr=(setting.arr+1)%16 end,up="bg",down="sdarrU",left="arrD",right="bgblock"},--3~6
sddasD= {x=210, y=370, w=50, h=50, rgb=color.white,code=function()setting.sddas=(setting.sddas-1)%11 end,up="dasD",down="ctrl",right="sddasU"},
sddasU= {x=370, y=370, w=50, h=50, rgb=color.white,code=function()setting.sddas=(setting.sddas+1)%11 end,up="dasU",down="ctrl",left="sddasD",right="sdarrD"},
sdarrD= {x=425, y=370, w=50, h=50, rgb=color.white,code=function()setting.sdarr=(setting.sdarr-1)%4 end,up="arrD",down="ctrl",left="sddasU",right="sdarrU"},
sdarrU= {x=585, y=370, w=50, h=50, rgb=color.white,code=function()setting.sdarr=(setting.sdarr+1)%4 end,up="arrU",down="ctrl",left="sdarrD",right="frame"},
ctrl= {x=340,y=440, w=310, h=60,rgb=color.green, code=function()gotoScene("setting2")end,up="sddasU",down="touch",left="lang",right="skin"},
touch= {x=340,y=510, w=310, h=60,rgb=color.yellow,code=function()gotoScene("setting3")end,up="ctrl",down="back",right="lang"},
lang= {x=580,y=510, w=150, h=60,rgb=color.red, code=function()
setting.lang=setting.lang%#langName+1 setting.lang=setting.lang%#langName+1
swapLanguage(setting.lang) swapLanguage(setting.lang)
end,up="sdarrU",down="back",left="touch",right="skin"}, end,nil,"back"),
back= newButton(640,620,300,70,color.white,40,back, nil,"game"),
sfx= {x=760,y=90, w=160, h=60, rgb=color.white,code=function()setting.sfx=not setting.sfx end,down="vib",left="center",right="bgm"}, },
bgm= {x=940,y=90, w=160, h=60, rgb=color.white,code=function()BGM()setting.bgm=not setting.bgm BGM("blank")end,down="voc",left="sfx"}, setting_game={
vib= {x=760,y=160, w=160, h=60,rgb=color.white, code=function()setting.vib=(setting.vib+1)%6 VIB(1)end,up="sfx",down="fullscreen",left="swap",right="voc"}, dasD= newButton(150,120,50,50,color.white,40,function()setting.das=(setting.das-1)%31 end, nil,"dasU"),
voc= {x=940,y=160, w=160, h=60,rgb=color.white,code=function()setting.voc=not setting.voc end,up="sfx",down="fullscreen",left="vib"}, dasU= newButton(370,120,50,50,color.white,40,function()setting.das=(setting.das+1)%31 end, nil,"arrD"),
fullscreen= {x=850,y=230,w=340, h=60,rgb=color.white, code=function() arrD= newButton(450,120,50,50,color.white,40,function()
setting.arr=(setting.arr-1)%16
if setting.arr>setting.das then
setting.das=setting.arr
Widget.setting_game.dasU:FX()
SFX("blip_1",.4)
end
end,nil,"arrU"),
arrU= newButton(670,120,50,50,color.white,40,function()
setting.arr=(setting.arr+1)%16
if setting.arr>setting.das then
setting.das=setting.arr
Widget.setting_game.dasU:FX()
SFX("blip_1",.4)
end
end,nil,"sddasD"),
sddasD= newButton(150,230,50,50,color.white,40,function()setting.sddas=(setting.sddas-1)%11 end, nil,"sddasU"),
sddasU= newButton(370,230,50,50,color.white,40,function()setting.sddas=(setting.sddas+1)%11 end, nil,"sdarrD"),
sdarrD= newButton(450,230,50,50,color.white,40,function()setting.sdarr=(setting.sdarr-1)%4 end, nil,"sdarrU"),
sdarrU= newButton(670,230,50,50,color.white,40,function()setting.sdarr=(setting.sdarr+1)%4 end, nil,"holdR"),
holdR= newSwitch(510,330,40,function()return setting.holdR end,function()setting.holdR=not setting.holdR end, nil,"swap"),
swap= newSwitch(510,420,25,function()return setting.swap end,function()setting.swap=not setting.swap end, nil,"back"),
back= newButton(640,620,300,70,color.white,40,back,nil,"dasD"),
},
setting_graphic={
ghost= newSwitch(310,90,40, function()return setting.ghost end, function()setting.ghost= not setting.ghost end, nil,"center"),
center= newSwitch(580,90,40, function()return setting.center end, function()setting.center= not setting.center end, nil,"smo"),
smo= newSwitch(310,170,25, function()return setting.smo end, function()setting.smo= not setting.smo end, nil,"grid"),
grid= newSwitch(580,170,40, function()return setting.grid end, function()setting.grid= not setting.grid end, nil,"dropFX"),
dropFX= newSlider(310,260,373,3,40,nil,function()return setting.dropFX end, function(i)setting.dropFX=i end, nil,"shakeFX"),
shakeFX=newSlider(310,340,373,3,40,nil,function()return setting.shakeFX end, function(i)setting.shakeFX=i end, nil,"atkFX"),
atkFX= newSlider(310,420,373,3,40,nil,function()return setting.atkFX end, function(i)setting.atkFX=i end, nil,"frame"),
frame= newSlider(310,500,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"),
fullscreen=newSwitch(990,90,40,function()return setting.fullscreen end,function()
setting.fullscreen=not setting.fullscreen setting.fullscreen=not setting.fullscreen
love.window.setFullscreen(setting.fullscreen) love.window.setFullscreen(setting.fullscreen)
if not setting.fullscreen then if not setting.fullscreen then
love.resize(gc.getWidth(),gc.getHeight()) love.resize(gc.getWidth(),gc.getHeight())
end end
end,up="vib",down="bgblock",left="bg"}, end,nil,"bg"),
bgblock={x=850,y=300, w=340, h=60,rgb=color.white, code=function() bg= newSwitch(990,170,40,function()return setting.bg end,function()setting.bg=not setting.bg end, nil,"bgblock"),
setting.bgblock=not setting.bgblock bgblock=newSwitch(990,250,40,function()return setting.bgblock end,function()
--if not setting.bgblock then for i=1,16 do BGblockList[i].v=3*BGblockList[i].v end end setting.bgblock=not setting.bgblock--if not setting.bgblock then for i=1,16 do FX_BGblock.list[i].v=3*FX_BGblock.list[i].v end end
end,up="fullscreen",down="frame",left="arrU"}, end,nil,"skin"),
frame= {x=850,y=370, w=340, h=60,rgb=color.white, code=function() skin= newButton(950,450,120,60,color.white,40,function()
setting.frameMul=setting.frameMul+(setting.frameMul<50 and 5 or 10)
if setting.frameMul>100 then setting.frameMul=25 end
end,up="bgblock",down="skin",left="sdarrU"},
skin= {x=740,y=440, w=120, h=60,rgb=color.white, code=function()
setting.skin=setting.skin%6+1 setting.skin=setting.skin%6+1
changeBlockSkin(setting.skin) changeBlockSkin(setting.skin)
end,up="frame",down="back",left="ctrl",right="smo"}, end,nil,"back"),
smo= {x=920,y=440, w=200, h=60,f=27,rgb=color.white, code=function() back= newButton(600,620,300,70,color.white,40,back,nil,"ghost"),
setting.smo=not setting.smo
end,up="frame",down="back",left="skin"},
back= {x=640,y=620, w=300,h=70,rgb=color.white, code=back,up="lang"},
}, },
setting2={--Control setting setting_sound={
back={x=840,y=630,w=180,h=60,rgb=color.white,code=back}, sfx=newSlider(180,150,400,8,40,function()SFX("blip_1")end, function()return setting.sfx end,function(i)setting.sfx=i end,nil,"bgm"),
bgm=newSlider(750,150,400,8,40,function()BGM(bgmPlaying or"blank")end, function()return setting.bgm end,function(i)setting.bgm=i end,nil,"vib"),
vib=newSlider(180,340,400,5,40,function()VIB(1)end, function()return setting.vib end,function(i)setting.vib=i end,nil,"voc"),
voc=newSlider(750,340,400,8,40,function()VOICE("nya")end, function()return setting.voc end,function(i)setting.voc=i end,nil,"back"),
back=newButton(640,620,300,70,color.white,40,back,nil,"sfx"),
}, },
setting3={--Touch setting setting_control={
back={x=640,y=410,w=170,h=80,f=45,code=back}, back=newButton(840,630,180,60,color.white,40,back),
hide={x=640,y=210,w=500,h=80,f=45,code=function() },
setting_touch={
hide= newButton(640,210,500,80,color.white,45,function()
setting.virtualkeySwitch=not setting.virtualkeySwitch setting.virtualkeySwitch=not setting.virtualkeySwitch
end}, end),
default={x=450,y=310,w=170,h=80,code=function() default=newButton(450,310,170,80,color.white,40,function()
for K=1,#virtualkey do for K=1,#virtualkey do
local b,b0=virtualkey[K],virtualkeySet[defaultSel][K] local b,b0=virtualkey[K],virtualkeySet[defaultSel][K]
b[1],b[2],b[3],b[4]=b0[1],b0[2],b0[3],b0[4] b[1],b[2],b[3],b[4]=b0[1],b0[2],b0[3],b0[4]
end--Default virtualkey end--Default virtualkey
defaultSel=defaultSel%5+1 defaultSel=defaultSel%5+1
end}, end),
snap={x=640,y=310,w=170,h=80,code=function() snap= newButton(640,310,170,80,color.white,40,function()
snapLevel=snapLevel%6+1 snapLevel=snapLevel%6+1
end}, end),
alpha={x=830,y=310,w=170,h=80,f=45,code=function() alpha= newButton(830,310,170,80,color.white,45,function()
setting.virtualkeyAlpha=(setting.virtualkeyAlpha+1)%11 setting.virtualkeyAlpha=(setting.virtualkeyAlpha+1)%11
--Adjust virtualkey alpha --Adjust virtualkey alpha
end}, end),
icon={x=450,y=410,w=170,h=80,f=45,code=function() icon= newButton(450,410,170,80,color.white,45,function()
setting.virtualkeyIcon=not setting.virtualkeyIcon setting.virtualkeyIcon=not setting.virtualkeyIcon
--Switch virtualkey icon --Switch virtualkey icon
end}, end),
size={x=830,y=410,w=170,h=80,f=45,code=function() size= newButton(830,410,170,80,color.white,45,function()
if sel then if sel then
local b=virtualkey[sel] local b=virtualkey[sel]
b[4]=b[4]+10 b[4]=b[4]+10
if b[4]==150 then b[4]=40 end if b[4]==150 then b[4]=40 end
b[3]=b[4]^2 b[3]=b[4]^2
end end
end}, end),
back= newButton(640,410,170,80,color.white,45,back),
}, },
help={ help={
his={x=1050,y=520,w=230,h=60,rgb=color.white,code=function()gotoScene("history")end,down="qq",left="back"}, his= newButton(1050,520,230,60,color.white,40,function()gotoScene("history")end,nil,"back"),
qq={x=1050,y=600,w=230,h=60,hide=function()return mobile end,rgb=color.white,code=function()sys.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,up="his",left="back"}, qq= newButton(1050,600,230,60,color.white,40,function()sys.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end, function()return mobile end,"his"),
back={x=640,y=600,w=180,h=60,rgb=color.white,code=back,up="his",right="qq"}, back= newButton(640, 600,180,60,color.white,40,back,nil,"qq"),
}, },
history={ history={
prev= {x=75, y=320,w=100, h=300, rgb=color.white,hide=function()return sel==1 end,code=function()sel=sel-1 end}, prev= newButton(1155,170,180,180,color.white,70,function()love.keypressed("up")end,function()return sel==1 end),
next= {x=1205,y=320,w=100, h=300, rgb=color.white,hide=function()return sel==#updateLog end,code=function()sel=sel+1 end}, next= newButton(1155,400,180,180,color.white,70,function()love.keypressed("down")end,function()return sel==#updateLog-22 end),
back= {x=640, y=640,w=200,h=70, rgb=color.white,code=back}, back= newButton(1155,600,180,90,color.white,40,back),
}, },
stat={ stat={
path={x=980,y=590,w=250,h=60,f=30,rgb=color.white,hide=function()return mobile end,code=function()sys.openURL(fs.getSaveDirectory())end,left="back"}, path= newButton(980,590,250,60,color.white,30,function()sys.openURL(fs.getSaveDirectory())end,function()return mobile end,"back"),
back={x=640,y=590,w=180,h=60,rgb=color.white,code=back,right="path"}, back= newButton(640,590,180,60,color.white,40,back,nil,"path"),
}, },
sel=nil,--selected button id(integer) }
} for S,L in next,Widget do
for N,W in next,L do
if W.next then
W.next,L[W.next].prev=L[W.next],W
end
end
end
widget_sel=nil--selected widget object

575
main.lua
View File

@@ -1,3 +1,8 @@
--[[
第一次搞这么大的工程~参考价值不是很大
如果你有时间并且也热爱俄罗斯方块的话,来看代码或者帮助优化的话当然欢迎!
(顺便,不经允许直接盗用代码的先死个妈)
]]
local love=love local love=love
local gc,tm=love.graphics,love.timer local gc,tm=love.graphics,love.timer
local ms,kb,tc=love.mouse,love.keyboard,love.touch local ms,kb,tc=love.mouse,love.keyboard,love.touch
@@ -6,26 +11,26 @@ local int,abs,rnd,max,min=math.floor,math.abs,math.random,math.max,math.min
local find,format=string.find,string.format local find,format=string.find,string.format
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local Timer=tm.getTime local Timer=tm.getTime
-- sort=table.sort local F=false
-------------------------------------------------------------
null=function()end null=function()end
-------------------------------------------------------------
system=sys.getOS() system=sys.getOS()
local mobile=system=="Android"or system=="iOS" local mobile=system=="Android"or system=="iOS"
local xOy=love.math.newTransform() local xOy=love.math.newTransform()
local mx,my,mouseShow=-20,-20,false local mx,my,mouseShow=-20,-20,false
local touching--1st touching ID local touching--1st touching ID
scr={x=0,y=0,w=gc.getWidth(),h=gc.getHeight(),k=1}local scr=scr scr={x=0,y=0,w=gc.getWidth(),h=gc.getHeight(),k=1}
local scr=scr
scene="" scene=""
bgmPlaying=nil
curBG="none" curBG="none"
voicePlaying={} bgmPlaying=nil
voiceQueue={free=0}
local devMode=0 local devMode=0
local F=false kb.setKeyRepeat(true)
kb.setKeyRepeat(F) kb.setTextInput(false)
kb.setTextInput(F) ms.setVisible(false)
ms.setVisible(F)
------------------------------------------------------------- -------------------------------------------------------------
local Fonts={} local Fonts={}
function setFont(s) function setFont(s)
@@ -43,23 +48,32 @@ function setFont(s)
end end
customSel={22,22,1,1,7,3,1,1,8,4,1,1,1} customSel={22,22,1,1,7,3,1,1,8,4,1,1,1}
preField={h=20} preField={h=20}
for i=1,18 do preField[i]={0,0,0,0,0,0,0,0,0,0}end for i=1,10 do preField[i]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}end
for i=19,20 do preField[i]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}end for i=11,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end
freeRow={L=40}for i=1,40 do freeRow[i]={0,0,0,0,0,0,0,0,0,0}end freeRow={L=40}for i=1,40 do freeRow[i]={0,0,0,0,0,0,0,0,0,0}end
--Game system Vars --Game system Vars
setting={ setting={
ghost=true,center=true,
grid=F,swap=true,
fxs=3,bg=true,
das=10,arr=2, das=10,arr=2,
sddas=0,sdarr=2, sddas=0,sdarr=2,
lang=1, holdR=true,
swap=true,
sfx=true,bgm=true, --game
vib=3,voc=F, ghost=true,center=true,
fullscreen=F, smo=true,grid=false,
dropFX=3,
shakeFX=3,
atkFX=3,
frameMul=100,
fullscreen=false,
bg=true,
bgblock=true, bgblock=true,
skin=1,smo=true, lang=1,
skin=1,
--graphic
sfx=8,bgm=6,
vib=3,voc=0,
--sound
keyMap={ keyMap={
{"left","right","x","z","c","up","down","space","tab","r","","",""}, {"left","right","x","z","c","up","down","space","tab","r","","",""},
{"","","","","","","","","","","","",""}, {"","","","","","","","","","","","",""},
@@ -91,8 +105,8 @@ setting={
}, },
virtualkeyAlpha=3, virtualkeyAlpha=3,
virtualkeyIcon=true, virtualkeyIcon=true,
virtualkeySwitch=F, virtualkeySwitch=false,
frameMul=100, --control
} }
stat={ stat={
run=0,game=0,time=0, run=0,game=0,time=0,
@@ -126,17 +140,15 @@ virtualkeyPressTime={0,0,0,0,0,0,0,0,0,0,0,0,0}
------------------------------------------------------------- -------------------------------------------------------------
require("class") require("class")
require("toolfunc") require("toolfunc")
require("ai")
require("gamefunc") require("gamefunc")
require("list") require("list")
require("ai")
require("dataList") require("dataList")
require("texture") require("texture")
local Tmr=require("timer") local Tmr=require("timer")
local Pnt=require("paint") local Pnt=require("paint")
--Requires --Modules
------------------------------------------------------------- -------------------------------------------------------------
local BGblockList={}for i=1,16 do BGblockList[i]={v=0}end
local BGblock={tm=150,next=7,ct=0}
local powerInfoCanvas,updatePowerInfo local powerInfoCanvas,updatePowerInfo
if sys.getPowerInfo()~="unknown"then if sys.getPowerInfo()~="unknown"then
powerInfoCanvas=gc.newCanvas(147,22) powerInfoCanvas=gc.newCanvas(147,22)
@@ -147,18 +159,7 @@ if sys.getPowerInfo()~="unknown"then
gc.clear(0,0,0,.3) gc.clear(0,0,0,.3)
gc.setLineWidth(4) gc.setLineWidth(4)
setFont(25) setFont(25)
if pow then local charging
gc.setColor(1,1,1)
gc.draw(batteryImage,58,3)
if pow>90 then gc.setColor(color.lightGreen)
elseif pow<60 then gc.setColor(color.lightRed)
elseif pow<20 then gc.setColor(color.red)
elseif pow==26 then gc.setColor(color.purple)
end
gc.rectangle("fill",61,6,pow*.15,10)
gc.setColor(1,1,1)
gc.print(pow.."%",94,-3)
end
if state~="battery"then if state~="battery"then
gc.setColor(1,1,1) gc.setColor(1,1,1)
if state=="nobattery"then if state=="nobattery"then
@@ -166,23 +167,37 @@ if sys.getPowerInfo()~="unknown"then
gc.line(61.5,.5,83.5,22.5) gc.line(61.5,.5,83.5,22.5)
elseif state=="charging"or state=="charged"then elseif state=="charging"or state=="charged"then
gc.draw(chargeImage,84,3) gc.draw(chargeImage,84,3)
F=true
end end
end end
if pow then
if charging then gc.setColor(0,1,0)
elseif pow>50 then gc.setColor(1,1,1)
elseif pow>26 then gc.setColor(1,1,0)
elseif pow<26 then gc.setColor(1,0,0)
else gc.setColor(.5,0,1)--special~
end
::L::
gc.rectangle("fill",61,6,pow*.15,10)
gc.setColor(1,1,1)
gc.draw(batteryImage,58,3)
gc.print(pow.."%",94,-3)
end
gc.print(os.date("%H:%M",os.time()),2,-3) gc.print(os.date("%H:%M",os.time()),2,-3)
gc.pop()gc.setCanvas() gc.pop()gc.setCanvas()
end end
end end
end end
local function getNewBlock() local function getNewBlock()
BGblock.ct=BGblock.ct+1 FX_BGblock.ct=FX_BGblock.ct+1
if BGblock.ct==17 then BGblock.ct=1 end if FX_BGblock.ct==17 then FX_BGblock.ct=1 end
local t=BGblockList[BGblock.ct] local t=FX_BGblock.list[FX_BGblock.ct]
t.bn,t.size=BGblock.next,2+3*rnd() t.bn,t.size=FX_BGblock.next,2+3*rnd()
t.b=blocks[t.bn][rnd(0,3)] t.b=blocks[t.bn][rnd(0,3)]
t.x=rnd(-#t.b[1]*t.size*30+100,1180) t.x=rnd(-#t.b[1]*t.size*30+100,1180)
t.y=-#t.b*30*t.size t.y=-#t.b*30*t.size
t.v=t.size*(1+rnd()) t.v=t.size*(1+rnd())
BGblock.next=BGblock.next%7+1 FX_BGblock.next=FX_BGblock.next%7+1
return t return t
end end
local sceneInit={ local sceneInit={
@@ -199,30 +214,39 @@ local sceneInit={
end, end,
main=function() main=function()
modeSel,levelSel=modeSel or 1,levelSel or 3 modeSel,levelSel=modeSel or 1,levelSel or 3
BGM("blank")
collectgarbage() collectgarbage()
end, end,
music=function() music=function()
sel=1 if bgmPlaying then
BGM() for i=1,#musicID do
if musicID[i]==bgmPlaying then
sel=i
return
end
end
else
sel=1
end
end, end,
mode=function() mode=function()
curBG="none" curBG="none"
saveData() saveData()
destroyPlayers()
BGM("blank") BGM("blank")
end, end,
custom=function() custom=function()
sel=sel or 1 sel=sel or 1
destroyPlayers()
curBG=customRange.bg[customSel[12]] curBG=customRange.bg[customSel[12]]
BGM(customRange.bgm[customSel[13]]) BGM(customRange.bgm[customSel[13]])
end, end,
draw=function() draw=function()
curBG="none" curBG="none"
kb.setKeyRepeat(true)
clearSureTime=0 clearSureTime=0
pen,sx,sy=1,1,1 pen,sx,sy=1,1,1
end, end,
play=function() play=function()
kb.setKeyRepeat(false)
restartCount=0 restartCount=0
if needResetGameData then if needResetGameData then
resetGameData() resetGameData()
@@ -234,14 +258,17 @@ local sceneInit={
setting=function() setting=function()
curBG="none" curBG="none"
end, end,
setting2=function() setting_game=null,
setting_graphic=null,
setting_sound=null,
setting_control=function()
curBoard=1 curBoard=1
keyboardSet=1 keyboardSet=1
joystickSet=1 joystickSet=1
keyboardSetting=false keyboardSetting=false
joystickSetting=false joystickSetting=false
end,--Control settings end,--Control settings
setting3=function() setting_touch=function()
curBG="game1" curBG="game1"
defaultSel=1 defaultSel=1
sel=nil sel=nil
@@ -255,7 +282,7 @@ local sceneInit={
history=function() history=function()
updateLog=require"updateLog" updateLog=require"updateLog"
curBG="lightGrey" curBG="lightGrey"
sel=2 sel=1
end, end,
quit=function() quit=function()
love.event.quit() love.event.quit()
@@ -274,43 +301,25 @@ local function onVirtualkey(x,y)
end end
return nearest return nearest
end end
local function buttonControl_key(i)
if i=="up"or i=="down"or i=="left"or i=="right"then
if Buttons.sel then
Buttons.sel=Buttons[scene][Buttons.sel[i]]or Buttons.sel
else
Buttons.sel=select(2,next(Buttons[scene]))
end
elseif i=="space"or i=="return"then
if not sceneSwaping and Buttons.sel then
local B=Buttons.sel
B.alpha=1
B.code()
if B.hide and B.hide()then Buttons.sel=nil end
SFX("button")
VOICE("nya")
end
end
end
local function buttonControl_gamepad(i)
if i=="dpup"or i=="dpdown"or i=="dpleft"or i=="dpright"then
if Buttons.sel then
Buttons.sel=Buttons[scene][Buttons.sel[i=="dpup"and"up"or i=="dpdown"and"down"or i=="dpleft"and"left"or"right"]]or Buttons.sel
else
Buttons.sel=select(2,next(Buttons[scene]))
end
elseif i=="start"then
if not sceneSwaping and Buttons.sel then
local B=Buttons.sel
B.alpha=1
B.code()
if B.hide and B.hide()then Buttons.sel=nil end
SFX("button")
VOICE("nya")
end
end
end
------------------------------------------------------------- -------------------------------------------------------------
local floatWheel=0
local function wheelScroll(y)
if y>0 then
if floatWheel<0 then floatWheel=0 end
floatWheel=floatWheel+y^1.2
elseif y<0 then
if floatWheel>0 then floatWheel=0 end
floatWheel=floatWheel-(-y)^1.2
end
while floatWheel>=1 do
love.keypressed("up")
floatWheel=floatWheel-1
end
while floatWheel<=-1 do
love.keypressed("down")
floatWheel=floatWheel+1
end
end
local mouseDown,mouseMove,mouseUp,wheelmoved={},{},{},{} local mouseDown,mouseMove,mouseUp,wheelmoved={},{},{},{}
local touchDown,touchUp,touchMove={},{},{} local touchDown,touchUp,touchMove={},{},{}
local keyDown,keyUp={},{} local keyDown,keyUp={},{}
@@ -334,9 +343,8 @@ function keyDown.intro(key)
end end
function wheelmoved.mode(x,y) function wheelmoved.mode(x,y)
if y>0 then keyDown.mode("up") wheelScroll(y)
elseif y<0 then keyDown.mode("down")
end
end end
function keyDown.mode(key) function keyDown.mode(key)
if key=="down"then if key=="down"then
@@ -381,7 +389,11 @@ function keyDown.music(key)
elseif key=="up"then elseif key=="up"then
sel=(sel-2)%#musicID+1 sel=(sel-2)%#musicID+1
elseif key=="return"or key=="space"then elseif key=="return"or key=="space"then
BGM(musicID[sel]) if bgmPlaying~=musicID[sel]then
BGM(musicID[sel])
else
BGM()
end
elseif key=="escape"then elseif key=="escape"then
back() back()
end end
@@ -450,7 +462,12 @@ function touchMove.draw(id,x,y,dx,dy)
end end
function keyDown.draw(key) function keyDown.draw(key)
if key=="delete"then if key=="delete"then
Buttons.draw.clear.code() if clearSureTime>15 then
for y=1,20 do for x=1,10 do preField[y][x]=0 end end
clearSureTime=0
else
clearSureTime=50
end
elseif key=="up"or key=="down"or key=="left"or key=="right"then elseif key=="up"or key=="down"or key=="left"or key=="right"then
if not sx then sx=1 end if not sx then sx=1 end
if not sy then sy=1 end if not sy then sy=1 end
@@ -477,7 +494,7 @@ function keyDown.draw(key)
end end
end end
function keyDown.setting2(key) function keyDown.setting_control(key)
if key=="escape"then if key=="escape"then
if keyboardSetting then if keyboardSetting then
keyboardSetting=false keyboardSetting=false
@@ -506,7 +523,7 @@ function keyDown.setting2(key)
curBoard=min(curBoard+1,8) curBoard=min(curBoard+1,8)
end end
end end
function gamepadDown.setting2(key) function gamepadDown.setting_control(key)
if key=="back"then if key=="back"then
if joystickSetting then if joystickSetting then
joystickSetting=false joystickSetting=false
@@ -536,7 +553,7 @@ function gamepadDown.setting2(key)
end end
end end
function mouseDown.setting3(x,y,k) function mouseDown.setting_touch(x,y,k)
if k==2 then back()end if k==2 then back()end
for K=1,#virtualkey do for K=1,#virtualkey do
local b=virtualkey[K] local b=virtualkey[K]
@@ -545,20 +562,20 @@ function mouseDown.setting3(x,y,k)
end end
end end
end end
function mouseMove.setting3(x,y,dx,dy) function mouseMove.setting_touch(x,y,dx,dy)
if sel and ms.isDown(1)then if sel and ms.isDown(1)then
local b=virtualkey[sel] local b=virtualkey[sel]
b[1],b[2]=b[1]+dx,b[2]+dy b[1],b[2]=b[1]+dx,b[2]+dy
end end
end end
function mouseUp.setting3(x,y,k) function mouseUp.setting_touch(x,y,k)
if sel then if sel then
local b=virtualkey[sel] local b=virtualkey[sel]
local k=snapLevelValue[snapLevel] local k=snapLevelValue[snapLevel]
b[1],b[2]=int(b[1]/k+.5)*k,int(b[2]/k+.5)*k b[1],b[2]=int(b[1]/k+.5)*k,int(b[2]/k+.5)*k
end end
end end
function touchDown.setting3(id,x,y) function touchDown.setting_touch(id,x,y)
for K=1,#virtualkey do for K=1,#virtualkey do
local b=virtualkey[K] local b=virtualkey[K]
if (x-b[1])^2+(y-b[2])^2<b[3]then if (x-b[1])^2+(y-b[2])^2<b[3]then
@@ -566,7 +583,7 @@ function touchDown.setting3(id,x,y)
end end
end end
end end
function touchUp.setting3(id,x,y) function touchUp.setting_touch(id,x,y)
if sel then if sel then
x,y=xOy:inverseTransformPoint(x,y) x,y=xOy:inverseTransformPoint(x,y)
if sel then if sel then
@@ -576,7 +593,7 @@ function touchUp.setting3(id,x,y)
end end
end end
end end
function touchMove.setting3(id,x,y,dx,dy) function touchMove.setting_touch(id,x,y,dx,dy)
if sel then if sel then
local b=virtualkey[sel] local b=virtualkey[sel]
b[1],b[2]=b[1]+dx,b[2]+dy b[1],b[2]=b[1]+dx,b[2]+dy
@@ -606,6 +623,7 @@ function touchDown.play(id,x,y)
local t=onVirtualkey(x,y) local t=onVirtualkey(x,y)
if t then if t then
pressKey(t,players[1]) pressKey(t,players[1])
VIB(0)
end end
end end
end end
@@ -680,18 +698,99 @@ function gamepadUp.play(key)
end end
end end
function wheelmoved.history(x,y)
wheelScroll(y)
end
function keyDown.history(key) function keyDown.history(key)
if key=="left"then if key=="up"then
if sel>1 then sel=sel-1 end sel=max(sel-5,1)
elseif key=="right"then elseif key=="down"then
if sel<#updateLog then sel=sel+1 end sel=min(sel+5,#updateLog-22)
elseif key=="escape"then elseif key=="escape"then
back() back()
end end
end end
------------------------------------------------------------- -------------------------------------------------------------
local function widgetPress(W,x,y)
if W.hide and W.hide()then widget_sel=nil end
if W.type=="button"then
W.code()
W:FX()
SFX("button")
VOICE("nya")
elseif W.type=="switch"then
W.code()
W:FX()
SFX("move",.6)
elseif W.type=="slider"then
if not x then return end
local p=W.disp()
W.code(x<W.x and 0 or x>W.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5))
if p==W.disp()then return end
W:FX(p)
if W.change then W.change()end
end
end
local function widgetDrag(W,x,y,dx,dy)
if W.type=="slider"then
local p=W.disp()
W.code(x<W.x and 0 or x>W.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5))
if p==W.disp()then return end
W:FX(p)
if W.change then W.change()end
elseif not W:ifAbove(x,y)then
widget_sel=nil
end
end
local function widgetControl_key(i)
if i=="tab"then
if widget_sel then
widget_sel=kb.isDown("lshift")and widget_sel.prev or widget_sel.next or widget_sel
else
widget_sel=select(2,next(Widget[scene]))
end
elseif i=="space"or i=="return"then
if not sceneSwaping and widget_sel then
widgetPress(widget_sel)
end
else
if widget_sel then
local W=widget_sel
if W.type=="slider"then
if i=="left"then
if W.disp()>0 then W.code(W.disp()-1)end
elseif i=="right"then
if W.disp()<W.unit then W.code(W.disp()+1)end
end
end
end
end
end
local function widgetControl_gamepad(i)
if i=="dpup"or i=="dpdown"then
if widget_sel then
widget_sel=i=="dpup"and widget_sel.prev or widget_sel.next or widget_sel
else
widget_sel=select(2,next(Widget[scene]))
end
elseif i=="start"then
if not sceneSwaping and widget_sel then
local W=widget_sel
if W.hide and W.hide()then widget_sel=nil end
if W.type=="button"then
W.code()
W:FX()
SFX("button")
VOICE("nya")
elseif W.type=="switch"then
W.code()
W:FX()
SFX("move",.6)
-- elseif W.type=="slider"then
end
end
end
end
function love.mousepressed(x,y,k,t,num) function love.mousepressed(x,y,k,t,num)
if t then return end if t then return end
mouseShow=true mouseShow=true
@@ -702,15 +801,8 @@ function love.mousepressed(x,y,k,t,num)
back() back()
end end
if k==1 then if k==1 then
if not sceneSwaping and Buttons.sel then if widget_sel and not sceneSwaping then
local B=Buttons.sel widgetPress(widget_sel,mx,my)
B.code()
B.alpha=1
Buttons.sel=nil
love.mousemoved(x,y,0,0)
SFX("button")
VOICE("nya")
VIB(1)
end end
end end
end end
@@ -718,14 +810,17 @@ function love.mousemoved(x,y,dx,dy,t)
if t then return end if t then return end
mouseShow=true mouseShow=true
mx,my=xOy:inverseTransformPoint(x,y) mx,my=xOy:inverseTransformPoint(x,y)
Buttons.sel=nil dx,dy=dx/scr.k,dy/scr.k
if mouseMove[scene]then if mouseMove[scene]then
mouseMove[scene](mx,my,dx/scr.k,dy/scr.k) mouseMove[scene](mx,my,dx,dy)
end end
for _,B in next,Buttons[scene]do if ms.isDown(1)and widget_sel then
if not(B.hide and B.hide())then widgetDrag(widget_sel,mx,my,dx,dy)
if abs(mx-B.x)<B.w*.5 and abs(my-B.y)<B.h*.5 then else
Buttons.sel=B widget_sel=nil
for _,W in next,Widget[scene]do
if not(W.hide and W.hide())and W:ifAbove(mx,my)then
widget_sel=W
return return
end end
end end
@@ -752,77 +847,71 @@ function love.touchpressed(id,x,y)
touchDown[scene](id,xOy:inverseTransformPoint(x,y)) touchDown[scene](id,xOy:inverseTransformPoint(x,y))
end end
end end
function love.touchreleased(id,x,y)
if id==touching then
touching=nil
if Buttons.sel then
local B=Buttons.sel
B.code()
B.alpha=1
Buttons.sel=nil
SFX("button")
VOICE("nya")
VIB(1)
end
Buttons.sel=nil
end
if touchUp[scene]then
touchUp[scene](id,xOy:inverseTransformPoint(x,y))
end
end
function love.touchmoved(id,x,y,dx,dy) function love.touchmoved(id,x,y,dx,dy)
x,y=xOy:inverseTransformPoint(x,y) x,y=xOy:inverseTransformPoint(x,y)
if touchMove[scene]then if touchMove[scene]then
touchMove[scene](id,x,y,dx/scr.k,dy/scr.k) touchMove[scene](id,x,y,dx/scr.k,dy/scr.k)
end end
Buttons.sel=nil if widget_sel then
for _,B in next,Buttons[scene]do widgetDrag(widget_sel,x,y,dx,dy)
if not(B.hide and B.hide())then else
if abs(x-B.x)<B.w*.5 and abs(y-B.y)<B.h*.5 then widget_sel=nil
Buttons.sel=B for _,W in next,Widget[scene]do
if not(W.hide and W.hide())and W:ifAbove(x,y)then
widget_sel=W
return return
end end
end end
end end
if not Buttons.sel then if not widget_sel then
touching=nil touching=nil
end end
end end
function love.touchreleased(id,x,y)
x,y=xOy:inverseTransformPoint(x,y)
if id==touching then
touching=nil
if widget_sel and not sceneSwaping then
widgetPress(widget_sel,x,y)
end
widget_sel=nil
end
if touchUp[scene]then
touchUp[scene](id,x,y)
end
end
function love.keypressed(i) function love.keypressed(i)
mouseShow=false mouseShow=false
if i=="f8"then devMode=(devMode+1)%3 end if i=="f8"then devMode=(devMode+1)%3 end
if devMode==2 then if devMode==2 then
if i=="k"then if i=="k"then
P=players.alive[rnd(#players.alive)] --Test code here
if P.id~=1 then
P.lastRecv=players[1]
Event.lose()
end
--Test code here
elseif i=="q"then elseif i=="q"then
local B=Buttons.sel if B then print(format("x=%d,y=%d,w=%d,h=%d",B.x,B.y,B.w,B.h))end local W=widget_sel
elseif Buttons.sel then if W then W:getInfo()end
local B=Buttons.sel elseif widget_sel then
if i=="left"then B.x=B.x-10 local W=widget_sel
elseif i=="right"then B.x=B.x+10 if i=="left"then W.x=W.x-10
elseif i=="up"then B.y=B.y-10 elseif i=="right"then W.x=W.x+10
elseif i=="down"then B.y=B.y+10 elseif i=="up"then W.y=W.y-10
elseif i==","then B.w=B.w-10 elseif i=="down"then W.y=W.y+10
elseif i=="."then B.w=B.w+10 elseif i==","then W.w=W.w-10
elseif i=="/"then B.h=B.h-10 elseif i=="."then W.w=W.w+10
elseif i=="'"then B.h=B.h+10 elseif i=="/"then W.h=W.h-10
elseif i=="'"then W.h=W.h+10
elseif i=="["then W.font=W.font-1
elseif i=="]"then W.font=W.font+1
end end
end end
else else
if keyDown[scene]then keyDown[scene](i) if keyDown[scene]then keyDown[scene](i)
elseif i=="escape"or i=="back"then back() elseif i=="escape"or i=="back"then back()
else buttonControl_key(i) else widgetControl_key(i)
end end
end end
end end
function love.keyreleased(i) function love.keyreleased(i)
if keyUp[scene]then keyUp[scene](i) if keyUp[scene]then keyUp[scene](i)end
end
end end
local keyMirror={ local keyMirror={
@@ -838,7 +927,7 @@ function love.gamepadpressed(joystick,i)
if gamepadDown[scene]then gamepadDown[scene](i) if gamepadDown[scene]then gamepadDown[scene](i)
elseif keyDown[scene]then keyDown[scene](keyMirror[i]or i) elseif keyDown[scene]then keyDown[scene](keyMirror[i]or i)
elseif i=="back"then back() elseif i=="back"then back()
else buttonControl_gamepad(i) else widgetControl_gamepad(i)
end end
end end
function love.gamepadreleased(joystick,i) function love.gamepadreleased(joystick,i)
@@ -875,27 +964,39 @@ end
function love.update(dt) function love.update(dt)
-- if players then for k,v in pairs(players[1])do -- if players then for k,v in pairs(players[1])do
-- if rawget(_G,k)and k~="next"and k~="hold"and k~="stat"then print(k,_G[v])end -- if rawget(_G,k)and k~="next"and k~="hold"and k~="stat"then print(k,_G[v])end
-- end end--check player data flew(debugging) -- end end--check player data flew
for i=#BGblock,1,-1 do for i=#sysFX,1,-1 do
BGblock[i].y=BGblock[i].y+BGblock[i].v local S=sysFX[i]
if BGblock[i].y>720 then rem(BGblock,i)end S[2]=S[2]+1
if S[2]==S[3]then
for i=i,#sysFX do
sysFX[i]=sysFX[i+1]
end
end
end
for i=#FX_BGblock,1,-1 do
FX_BGblock[i].y=FX_BGblock[i].y+FX_BGblock[i].v
if FX_BGblock[i].y>720 then rem(FX_BGblock,i)end
end end
if setting.bgblock then if setting.bgblock then
BGblock.tm=BGblock.tm-1 FX_BGblock.tm=FX_BGblock.tm-1
if BGblock.tm==0 then if FX_BGblock.tm==0 then
BGblock[#BGblock+1]=getNewBlock() FX_BGblock[#FX_BGblock+1]=getNewBlock()
BGblock.tm=rnd(20,30) FX_BGblock.tm=rnd(20,30)
end end
end end
if sceneSwaping then if sceneSwaping then
sceneSwaping.time=sceneSwaping.time-1 sceneSwaping.time=sceneSwaping.time-1
if sceneSwaping.time==sceneSwaping.mid then if sceneSwaping.time==sceneSwaping.mid then
for k,B in next,Buttons[scene]do for k,W in next,Widget[scene]do
B.alpha=0 if W.type=="button"then
end--Reset buttons' alpha W.alpha=0
Buttons.sel=nil end--Reset widgets' alpha
end
widget_sel=nil
scene=sceneSwaping.tar scene=sceneSwaping.tar
sceneInit[scene]() sceneInit[scene]()
--scene swapped!
elseif sceneSwaping.time==0 then elseif sceneSwaping.time==0 then
sceneSwaping=nil sceneSwaping=nil
end end
@@ -906,57 +1007,57 @@ function love.update(dt)
for i=#Task,1,-1 do for i=#Task,1,-1 do
Task[i]:update() Task[i]:update()
end end
if voicePlaying[1]then for i=1,#voiceQueue do
if not voicePlaying[1]:isPlaying()then local Q=voiceQueue[i]
rem(voicePlaying,1) if #Q>0 then
if type(Q[1])=="userdata"then
if not Q[1]:isPlaying()then
for i=1,#Q do
Q[i]=Q[i+1]
end
end--play next when stop
else
local n=1
local L=voiceBank[Q[1]]
::L::if L[n]:isPlaying()then
n=n+1
if not L[n]then
L[n]=L[n-1]:clone()
L[n]:seek(0)
goto quit
end
goto L
end::quit::
Q[1]=L[n]
Q[1]:setVolume(setting.voc*.125)
Q[1]:play()
--load voice with string
end
end end
if voicePlaying[1] and not voicePlaying[1]:isPlaying()then voicePlaying[1]:play()end
end end
for k,B in next,Buttons[scene]do -- for k,W in next,Widget[scene]do
local t=B==Buttons.sel and .4 or 0 -- end--update Widgets
B.alpha=abs(B.alpha-t)>.02 and(B.alpha+(B.alpha<t and .02 or -.02))or t
if B.alpha>t then B.alpha=B.alpha-.02 elseif B.alpha<t then B.alpha=B.alpha+.02 end
end--update Buttons
end end
local scs={1,2,1,2,1,2,1,2,1,2,1.5,1.5,.5,2.5} local scs={1,2,1,2,1,2,1,2,1,2,1.5,1.5,.5,2.5}
function love.draw() function love.draw()
gc.discard()--SPEED UPUPUP! gc.discard()--SPEED UPUPUP!
Pnt.BG[setting.bg and curBG or"grey"]() Pnt.BG[setting.bg and curBG or"grey"]()
gc.setColor(1,1,1,.2) gc.setColor(1,1,1,.2)
for n=1,#BGblock do for n=1,#FX_BGblock do
local b,img=BGblock[n].b,blockSkin[BGblock[n].bn] local b,img=FX_BGblock[n].b,blockSkin[FX_BGblock[n].bn]
local size=BGblock[n].size local size=FX_BGblock[n].size
for i=1,#b do for j=1,#b[1]do for i=1,#b do for j=1,#b[1]do
if b[i][j]then if b[i][j]then
gc.draw(img,BGblock[n].x+(j-1)*30*size,BGblock[n].y+(i-1)*30*size,nil,size) gc.draw(img,FX_BGblock[n].x+(j-1)*30*size,FX_BGblock[n].y+(i-1)*30*size,nil,size)
end end
end end end end
end end
if Pnt[scene]then Pnt[scene]()end if Pnt[scene]then Pnt[scene]()end
for k,B in next,Buttons[scene]do for k,W in next,Widget[scene]do
if not(B.hide and B.hide())then if not(W.hide and W.hide())then
local C=B.rgb or color.white W:draw()
gc.setColor(C[1],C[2],C[3],B.alpha)
gc.rectangle("fill",B.x-B.w*.5,B.y-B.h*.5,B.w,B.h)
gc.setColor(C)
gc.setLineWidth(3)gc.rectangle("line",B.x-B.w*.5,B.y-B.h*.5,B.w,B.h,4)
gc.setColor(C[1],C[2],C[3],.3)
gc.setLineWidth(5)gc.rectangle("line",B.x-B.w*.5,B.y-B.h*.5,B.w,B.h,4)
local t=B.t
local y0
if t then
if type(t)=="function"then t=t()end
setFont(B.f or 40)
y0=B.y-currentFont*.64
gc.printf(t,B.x-201,y0+2,400,"center")
gc.printf(t,B.x-199,y0+2,400,"center")
gc.printf(t,B.x-201,y0,400,"center")
gc.printf(t,B.x-199,y0,400,"center")
gc.setColor(C)
mStr(t,B.x,y0+1)
end
end end
end--Draw buttons end--Draw widgets
if mouseShow and not touching then if mouseShow and not touching then
local r=Timer()*.5 local r=Timer()*.5
gc.setColor(1,1,1,min(1-abs(1-r%1*2),.3)) gc.setColor(1,1,1,min(1-abs(1-r%1*2),.3))
@@ -965,7 +1066,27 @@ function love.draw()
gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5) gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5)
gc.setColor(1,1,1)gc.circle("fill",mx,my,3) gc.setColor(1,1,1)gc.circle("fill",mx,my,3)
end--Awesome mouse! end--Awesome mouse!
if sceneSwaping then sceneSwaping.draw()end--Swaping animation gc.setColor(1,1,1)
if powerInfoCanvas and scene~="draw"then
gc.draw(powerInfoCanvas)
end--Power Info
gc.setLineWidth(6)
for i=1,#sysFX do
local S=sysFX[i]
if S[1]==0 then
gc.setColor(1,1,1,1-S[2]/S[3])
local r=(10*S[2]/S[3])^1.2
gc.rectangle("line",S[4]-r,S[5]-r,S[6]+2*r,S[7]+2*r)
--Ripple
elseif S[1]==1 then
gc.setColor(S[4],S[5],S[6],1-S[2]/S[3])
gc.rectangle("fill",S[7],S[8],S[9],S[10],2)
--Shade
end
end--sysFXs
if sceneSwaping then
sceneSwaping.draw()
end--Swaping animation
if scr.r~=.5625 then if scr.r~=.5625 then
gc.setColor(0,0,0) gc.setColor(0,0,0)
if scr.r>.5625 then if scr.r>.5625 then
@@ -978,32 +1099,32 @@ function love.draw()
gc.rectangle("fill",1280,0,d,720) gc.rectangle("fill",1280,0,d,720)
end--wide end--wide
end--Black side end--Black side
gc.setColor(1,1,1)
if powerInfoCanvas and scene~="draw"then
gc.draw(powerInfoCanvas)
end
setFont(20) setFont(20)
gc.print(tm.getFPS(),5,700) gc.print(tm.getFPS(),5,700)
if devMode>0 then if devMode>0 then
gc.print(mx.." "..my,5,640) gc.setColor(1,1,devMode==2 and 0 or 1)
gc.print(#freeRow.."/"..freeRow.L,5,660) gc.print("Tasks:"..#Task,5,600)
gc.print(gcinfo(),5,680) gc.print("Voices:"..#voiceQueue,5,620)
gc.print("Mouse:"..mx.." "..my,5,640)
gc.print("Free Row:"..#freeRow.."/"..freeRow.L,5,660)
gc.print("Cache used:"..gcinfo(),5,680)
end end
end end
function love.run() function love.run()
local lastFrame,lastUpdatePowerInfo=Timer(),Timer() local lastFrame,lastUpdatePowerInfo=Timer(),Timer()
local readyDrawFrame=0 local readyDrawFrame=0
local T=love.timer
local PUMP,POLL=love.event.pump,love.event.poll local PUMP,POLL=love.event.pump,love.event.poll
love.resize(gc.getWidth(),gc.getHeight()) love.resize(gc.getWidth(),gc.getHeight())
scene="load"sceneInit.load()--System Launch scene="load"sceneInit.load()--System Launch
return function() return function()
PUMP() PUMP()
for N,a,b,c,d,e in POLL()do for N,a,b,c,d,e in POLL()do
if N=="quit"then return 0 if N=="quit"then destroyPlayers()return 0
elseif love[N]then love[N](a,b,c,d,e)end elseif love[N]then love[N](a,b,c,d,e)end
end end
tm.step() T.step()
love.update(tm.getDelta()) love.update(T.getDelta())
if not wd.isMinimized()then if not wd.isMinimized()then
readyDrawFrame=readyDrawFrame+setting.frameMul readyDrawFrame=readyDrawFrame+setting.frameMul
if readyDrawFrame>=100 then if readyDrawFrame>=100 then
@@ -1018,7 +1139,7 @@ function love.run()
lastUpdatePowerInfo=Timer() lastUpdatePowerInfo=Timer()
end end
until Timer()-lastFrame>.0133 until Timer()-lastFrame>.0133
tm.sleep(.003) T.sleep(.003)
lastFrame=Timer() lastFrame=Timer()
end end
end end
@@ -1029,9 +1150,9 @@ if fs.getInfo("userdata")then
end end
if fs.getInfo("usersetting")then if fs.getInfo("usersetting")then
loadSetting() loadSetting()
elseif system=="Android" or system=="iOS"then elseif mobile then
setting.virtualkeySwitch=true setting.virtualkeySwitch=true
setting.swap=F setting.swap=false
end end
math.randomseed(os.time()*626) math.randomseed(os.time()*626)
swapLanguage(setting.lang) swapLanguage(setting.lang)

214
paint.lua
View File

@@ -26,11 +26,13 @@ local modeLevelColor={
NORMAL=color.green, NORMAL=color.green,
HARD=color.magenta, HARD=color.magenta,
LUNATIC=color.red, LUNATIC=color.red,
EXTRA=color.lightMagenta,
ULTIMATE=color.lightYellow,
FINAL=color.lightGrey,
["EASY+"]=color.darkCyan,
["NORMAL+"]=color.darkGreen, ["NORMAL+"]=color.darkGreen,
["HARD+"]=color.darkMagenta, ["HARD+"]=color.darkMagenta,
["LUNATIC+"]=color.darkRed, ["LUNATIC+"]=color.darkRed,
EXTRA=color.lightMagenta,
ULTIMATE=color.lightYellow,
MESS=color.lightGrey, MESS=color.lightGrey,
GM=color.blue, GM=color.blue,
@@ -104,12 +106,12 @@ local function stencil_miniTitle()
end end
end end
FX={ FX_BGblock={tm=150,next=7,ct=0,list={{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},{v=0},}}--Falling tetrominos on background
flash=0,--Black screen(frame) FX_attack={}--Attack beam
shake=0,--Screen shake(frame) FX_badge={}--Badge thrown
attack={},--Attack beam sysFX={}
badge={},--badge thrown FX_ripple={}--Ripple&SqrShade
textFX={
appear=function(t,a) appear=function(t,a)
setFont(t.font) setFont(t.font)
gc.setColor(1,1,1,a) gc.setColor(1,1,1,a)
@@ -246,27 +248,27 @@ end,
game1=function() game1=function()
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.draw(background1,640,360,Timer()*.15,12,nil,64,64) gc.draw(background1,640,360,Timer()*.15,12,nil,64,64)
end, end,--Rainbow
game2=function() game2=function()
gc.setColor(1,.5,.5) gc.setColor(1,.5,.5)
gc.draw(background1,640,360,Timer()*.2,12,nil,64,64) gc.draw(background1,640,360,Timer()*.2,12,nil,64,64)
end, end,--Red rainbow
game3=function() game3=function()
gc.setColor(.6,.6,1) gc.setColor(.6,.6,1)
gc.draw(background1,640,360,Timer()*.25,12,nil,64,64) gc.draw(background1,640,360,Timer()*.25,12,nil,64,64)
end, end,--Blue rainbow
game4=function() game4=function()
gc.setColor(.1,.5,.5) gc.setColor(.1,.5,.5)
local x=Timer()%4*320 local x=Timer()%4*320
gc.draw(background2,x,0,nil,10) gc.draw(background2,x,0,nil,10)
gc.draw(background2,x-1280,0,nil,10) gc.draw(background2,x-1280,0,nil,10)
end, end,--Fast strap
game5=function() game5=function()
local t=2.5-Timer()%20%6%2.5 local t=2.5-Timer()%20%6%2.5
if t<.5 then gc.clear(t,t,t) if t<.5 then gc.clear(t,t,t)
else gc.clear(0,0,0) else gc.clear(0,0,0)
end end
end, end,--Lightning
game6=function() game6=function()
local t=1.2-Timer()%10%3%1.2 local t=1.2-Timer()%10%3%1.2
if t<.5 then gc.clear(t,t,t) if t<.5 then gc.clear(t,t,t)
@@ -275,7 +277,7 @@ game6=function()
gc.setColor(.3,.3,.3) gc.setColor(.3,.3,.3)
local r=7-int(Timer()*.5)%7 local r=7-int(Timer()*.5)%7
gc.draw(mouseBlock[r],640,360,Timer()%3.1416*6,400,400,scs[r][2]-.5,#blocks[r][0]-scs[r][1]+.5) gc.draw(mouseBlock[r],640,360,Timer()%3.1416*6,400,400,scs[r][2]-.5,#blocks[r][0]-scs[r][1]+.5)
end, end,--Fast lightning&spining tetromino
rgb=function() rgb=function()
gc.clear( gc.clear(
sin(Timer()*1.2)*.15+.5, sin(Timer()*1.2)*.15+.5,
@@ -330,17 +332,17 @@ function Pnt.intro()
end end
function Pnt.main() function Pnt.main()
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.draw(titleImage,280,30,nil,1.3) gc.draw(coloredTitleImage,280,30,nil,1.3)
setFont(30) gc.draw(drawableText.warning,570,128)
gc.print(gameVersion,290,125)
gc.print(system,845,95)
setFont(35) setFont(35)
gc.print(gameVersion,290,125)
gc.print(system,840,95)
mStr(modeLevel[modeID[modeSel]][levelSel],160,180) mStr(modeLevel[modeID[modeSel]][levelSel],160,180)
mStr(text.modeName[modeSel],160,380) mStr(text.modeName[modeSel],160,380)
end end
function Pnt.mode() function Pnt.mode()
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.draw(titleImage,810,30) gc.draw(titleImage,830,30)
setFont(40) setFont(40)
gc.setColor(modeLevelColor[modeLevel[modeID[modeSel]][levelSel]]or color.white) gc.setColor(modeLevelColor[modeLevel[modeID[modeSel]][levelSel]]or color.white)
mStr(modeLevel[modeID[modeSel]][levelSel],270,215) mStr(modeLevel[modeID[modeSel]][levelSel],270,215)
@@ -361,34 +363,42 @@ function Pnt.mode()
end end
function Pnt.music() function Pnt.music()
gc.setColor(1,1,1,.3+sin(Timer()*5)*.2) gc.setColor(1,1,1,.3+sin(Timer()*5)*.2)
gc.rectangle("fill",45,98+30*sel,237,30) gc.rectangle("fill",45,98+30*sel,250,30)
gc.setColor(.8,.8,.8) gc.setColor(.8,.8,.8)
gc.draw(drawableText.musicRoom,20,20) gc.draw(drawableText.musicRoom,20,20)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.draw(drawableText.musicRoom,22,23) gc.draw(drawableText.musicRoom,22,23)
gc.draw(drawableText.nowPlaying,520,83) gc.draw(drawableText.nowPlaying,490,390)
setFont(35) setFont(35)
for i=1,#musicID do for i=1,#musicID do
gc.print(musicID[i],50,90+30*i) gc.print(musicID[i],50,90+30*i)
end end
setFont(50) gc.draw(titleImage,640,310,nil,1.5,nil,206,35)
gc.setColor(sin(Timer()*.5)*.2+.8,sin(Timer()*.7)*.2+.8,sin(Timer())*.2+.8) if bgmPlaying then
gc.print(bgmPlaying or"",600,140) setFont(50)
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
if t<1 then
gc.setColor(1,1,1,t)
gc.draw(coloredTitleImage,640,310,nil,1.5+.1-.1*t,1.5+.3-.3*t,206,35)
end
end
end end
function Pnt.custom() function Pnt.custom()
gc.setColor(1,1,1,.3+sin(Timer()*8)*.2) gc.setColor(1,1,1,.3+sin(Timer()*8)*.2)
gc.rectangle("fill",25,95+40*sel,465,40) gc.rectangle("fill",25,95+40*sel,480,40)
gc.setColor(.8,.8,.8)gc.draw(drawableText.custom,20,20) gc.setColor(.8,.8,.8)gc.draw(drawableText.custom,20,20)
gc.setColor(1,1,1)gc.draw(drawableText.custom,22,23) gc.setColor(1,1,1)gc.draw(drawableText.custom,22,23)
setFont(40) setFont(40)
for i=1,#customID do for i=1,#customID do
local k=customID[i] local k=customID[i]
local y=90+40*i local y=90+40*i
gc.printf(text.customOption[k],30,y,320,"right") gc.printf(text.customOption[k],15,y,320,"right")
if text.customVal[k]then if text.customVal[k]then
gc.print(text.customVal[k][customSel[i]],350,y) gc.print(text.customVal[k][customSel[i]],335,y)
else else
gc.print(customRange[k][customSel[i]],350,y) gc.print(customRange[k][customSel[i]],335,y)
end end
end end
end end
@@ -406,7 +416,7 @@ function Pnt.draw()
local B=preField[y][x] local B=preField[y][x]
if B>0 then if B>0 then
drawPixel(y,x,B) drawPixel(y,x,B)
elseif B==0 then elseif B==-1 then
gc.line(30*x-25,605-30*y,30*x-5,625-30*y) gc.line(30*x-25,605-30*y,30*x-5,625-30*y)
gc.line(30*x-25,625-30*y,30*x-5,605-30*y) gc.line(30*x-25,625-30*y,30*x-5,605-30*y)
end end
@@ -424,7 +434,7 @@ function Pnt.draw()
gc.setLineWidth(13) gc.setLineWidth(13)
gc.setColor(blockColor[pen]) gc.setColor(blockColor[pen])
gc.rectangle("line",945,605,70,70) gc.rectangle("line",945,605,70,70)
elseif pen==0 then elseif pen==-1 then
gc.setLineWidth(5) gc.setLineWidth(5)
gc.setColor(.9,.9,.9) gc.setColor(.9,.9,.9)
gc.line(960,620,1000,660) gc.line(960,620,1000,660)
@@ -443,16 +453,11 @@ function Pnt.play()
gc.push("transform") gc.push("transform")
gc.origin() gc.origin()
gc.setColor(1,1,1,P.result and max(20-P.endCounter,0)*.05 or 1) gc.setColor(1,1,1,P.result and max(20-P.endCounter,0)*.05 or 1)
local h=#P.clearing
local F=P.field local F=P.field
for j=1,#F do for j=1,#F do
if j==P.clearing[h]and P.falling>-1 then for i=1,10 do if F[j][i]>0 then
h=h-1 gc.draw(blockSkinmini[F[j][i]],6*i-6,120-6*j)
else end end
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
end--Field end--Field
if P.alive then if P.alive then
gc.setLineWidth(2) gc.setLineWidth(2)
@@ -471,6 +476,7 @@ function Pnt.play()
end end
gc.pop() gc.pop()
gc.setCanvas() gc.setCanvas()
--draw content
end end
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.draw(P.canvas,P.x,P.y,nil,P.size*10) gc.draw(P.canvas,P.x,P.y,nil,P.size*10)
@@ -479,6 +485,7 @@ function Pnt.play()
gc.setColor(1,0,0,min(P.endCounter,25)*.04) 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) gc.circle("line",P.centerX,P.centerY,(840-20*min(P.endCounter,30))*P.size)
end end
--draw Canvas
else else
gc.push("transform") gc.push("transform")
gc.translate(P.x,P.y)gc.scale(P.size)--Position gc.translate(P.x,P.y)gc.scale(P.size)--Position
@@ -497,26 +504,24 @@ function Pnt.play()
end--Grid lines end--Grid lines
gc.translate(0,P.fieldBeneath) gc.translate(0,P.fieldBeneath)
gc.setScissor(scr.x+P.absFieldX*scr.k,scr.y+P.absFieldY*scr.k,300*P.size*scr.k,610*P.size*scr.k) gc.setScissor(scr.x+P.absFieldX*scr.k,scr.y+P.absFieldY*scr.k,300*P.size*scr.k,610*P.size*scr.k)
-- local dy=setting.smo and(P.y_img~=P.curY and min(P.dropDelay,8e98)/P.gameEnv.drop or min(P.lockDelay,8e98)/P.gameEnv.lock)^4*30 or 0 local dy,stepY=0,setting.smo and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30
local dy,stepY=0,setting.smo and (1-(P.falling/P.gameEnv.fall)^3)*30 or 0 local h=1
local h=#P.clearing
for j=int(P.fieldBeneath/30+1),#P.field do for j=int(P.fieldBeneath/30+1),#P.field do
if j==P.clearing[h]and P.falling>-1 then while j==P.clearing[h]and P.falling>-1 do
h=h-1 h=h+1
dy=dy+stepY dy=dy+stepY
gc.translate(0,stepY) gc.translate(0,-stepY)
gc.setColor(1,1,1,P.falling/P.gameEnv.fall) gc.setColor(1,1,1,P.falling/P.gameEnv.fall)
gc.rectangle("fill",0,600-30*j,320,30-stepY) gc.rectangle("fill",0,630-30*j,320,stepY)
else end
for i=1,10 do for i=1,10 do
if P.field[j][i]>0 then if P.field[j][i]>0 then
gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1)) gc.setColor(1,1,1,min(P.visTime[j][i]*.05,1))
drawPixel(j,i,P.field[j][i]) drawPixel(j,i,P.field[j][i])
end
end end
end end
end--Field end--Field
gc.translate(0,-dy) gc.translate(0,dy)
for i=1,#P.shade do for i=1,#P.shade do
local S=P.shade[i] local S=P.shade[i]
gc.setColor(1,1,1,S[1]*.12) gc.setColor(1,1,1,S[1]*.12)
@@ -535,10 +540,28 @@ function Pnt.play()
end end
end end end end
end--Ghost end--Ghost
local dy=setting.smo and(P.y_img~=P.curY and min(P.dropDelay,8e98)/P.gameEnv.drop or min(P.lockDelay,8e98)/P.gameEnv.lock)^4*30 or 0 -- 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
]]
else
dy=0
end
gc.translate(0,-dy) gc.translate(0,-dy)
local trans=P.lockDelay/P.gameEnv.lock
if P.gameEnv.block then if P.gameEnv.block then
gc.setColor(1,1,1,P.lockDelay/P.gameEnv.lock) gc.setColor(1,1,1,trans)
for i=1,P.r do for j=1,P.c do for i=1,P.r do for j=1,P.c do
if P.cur.bk[i][j]then if P.cur.bk[i][j]then
gc.rectangle("fill",30*(j+P.curX-1)-33,597-30*(i+P.curY-1),36,36) gc.rectangle("fill",30*(j+P.curX-1)-33,597-30*(i+P.curY-1),36,36)
@@ -552,7 +575,7 @@ function Pnt.play()
end end--Block end end--Block
end end
if P.gameEnv.center then if P.gameEnv.center then
gc.setColor(1,1,1) gc.setColor(1,1,1,trans)
local x=30*(P.curX+P.sc[2]-1)-30+15 local x=30*(P.curX+P.sc[2]-1)-30+15
gc.draw(spinCenter,x,600-30*(P.curY+P.sc[1]-1)+15,nil,nil,nil,4,4) gc.draw(spinCenter,x,600-30*(P.curY+P.sc[1]-1)+15,nil,nil,nil,4,4)
gc.translate(0,dy) gc.translate(0,dy)
@@ -683,32 +706,32 @@ function Pnt.play()
end end
end--Draw players end--Draw players
gc.setLineWidth(5) gc.setLineWidth(5)
for i=1,#FX.attack do for i=1,#FX_attack do
local A=FX.attack[i] local A=FX_attack[i]
gc.push("transform") gc.push("transform")
local a=A.a local a=A.t<10 and A.a*A.t*.05 or A.t>50 and A.a*(6-A.t*.1)or A.a
if A.t<20 then
gc.translate(A.x1,A.y1)
a=a*A.t*.05
elseif A.t<80 then
local t=((A.t-20)*.016667)t=(3-2*t)*t*t
gc.translate(A.x1*(1-t)+A.x2*t,A.y1*(1-t)+A.y2*t)
else
gc.translate(A.x2,A.y2)
a=a*(5-A.t*.05)
end
gc.rotate(A.t*.1)
gc.setColor(A.r,A.g,A.b,a*.5) gc.setColor(A.r,A.g,A.b,a*.5)
gc.circle("line",0,0,A.rad,A.corner) gc.circle("line",0,0,A.rad,A.corner)
local L=A.drag
for i=1,#L,2 do
gc.setColor(A.r,A.g,A.b,a*i*.05)
gc.translate(L[i],L[i+1])
gc.rotate(A.t*.1)
gc.circle("fill",0,0,A.rad,A.corner)
gc.rotate(-A.t*.1)
gc.translate(-L[i],-L[i+1])
end
gc.setColor(A.r,A.g,A.b,a) gc.setColor(A.r,A.g,A.b,a)
gc.translate(A.x,A.y)
gc.rotate(A.t*.1)
gc.circle("fill",0,0,A.rad,A.corner) gc.circle("fill",0,0,A.rad,A.corner)
gc.pop() gc.pop()
end end
gc.setColor(1,1,1) gc.setColor(1,1,1)
if setting.virtualkeySwitch then drawVirtualkey()end if setting.virtualkeySwitch then drawVirtualkey()end
if modeEnv.royaleMode then if modeEnv.royaleMode then
for i=1,#FX.badge do for i=1,#FX_badge do
local b=FX.badge[i] local b=FX_badge[i]
gc.setColor(1,1,1,b.t<10 and b.t*.1 or b.t<50 and 1 or(60-b.t)*.1) gc.setColor(1,1,1,b.t<10 and b.t*.1 or b.t<50 and 1 or(60-b.t)*.1)
if b.t<10 then if b.t<10 then
gc.draw(badgeIcon,b[1]-14,b[2]-14) gc.draw(badgeIcon,b[1]-14,b[2]-14)
@@ -736,9 +759,9 @@ function Pnt.play()
end end
end end
if restartCount>0 then if restartCount>0 then
gc.setColor(1,.7,.7,.5+restartCount*.02) -- gc.setColor(1,.7,.7,.5+restartCount*.02)
gc.arc("fill",640,360,735,-1.5708,restartCount*0.3696-1.5708) -- gc.arc("fill",640,360,735,-1.5708,restartCount*0.3696-1.5708)
gc.setColor(0,0,0,restartCount/17) gc.setColor(0,0,0,restartCount/20)
gc.rectangle("fill",0,0,1280,720) gc.rectangle("fill",0,0,1280,720)
end end
end end
@@ -749,7 +772,7 @@ function Pnt.pause()
gc.setColor(1,1,1,pauseTimer*.02) gc.setColor(1,1,1,pauseTimer*.02)
setFont(30) setFont(30)
if pauseCount>0 then if pauseCount>0 then
gc.print(text.pauseTime..":["..pauseCount.."] "..format("%0.2f",pauseTime).."s",110,150) gc.print(text.pauseCount..":["..pauseCount.."] "..format("%0.2f",pauseTime).."s",110,150)
end end
for i=1,7 do for i=1,7 do
gc.print(text.stat[i+3],110,30*i+270) gc.print(text.stat[i+3],110,30*i+270)
@@ -761,22 +784,25 @@ function Pnt.pause()
end end
setFont(40) setFont(40)
if system~="Android"then if system~="Android"then
mStr(text.space.."/"..text.enter,640,300) mStr(text.space.."/"..text.enter,640,335)
gc.print("ESC",610,598) gc.print("ESC",610,506)
end end
mDraw(gamefinished and drawableText.finish or drawableText.pause,640,140-12*(5-pauseTimer*.1)^2) mDraw(gamefinished and drawableText.finish or drawableText.pause,640,60-10*(5-pauseTimer*.1)^1.5)
end end
function Pnt.setting() function Pnt.setting_game()
gc.setColor(1,1,1) gc.setColor(1,1,1)
setFont(35) setFont(40)
mStr("DAS:"..setting.das,290,278) mStr("DAS:"..setting.das,260,95)
mStr("ARR:"..setting.arr,506,278) mStr("ARR:"..setting.arr,560,95)
setFont(21) setFont(28)
mStr(text.softdropdas..setting.sddas,290,357) mStr(text.softdropdas..setting.sddas,260,213)
mStr(text.softdroparr..setting.sdarr,506,357) mStr(text.softdroparr..setting.sdarr,560,213)
gc.draw(blockSkin[7-int(Timer()*2)%7],820,480,nil,2)
end end
function Pnt.setting2() function Pnt.setting_graphic()
gc.setColor(1,1,1)
gc.draw(blockSkin[7-int(Timer()*2)%7],1020,420,nil,2)
end
function Pnt.setting_control()
local a=.3+sin(Timer()*15)*.1 local a=.3+sin(Timer()*15)*.1
if keyboardSetting then if keyboardSetting then
gc.setColor(1,.5,.5,a) gc.setColor(1,.5,.5,a)
@@ -811,7 +837,7 @@ function Pnt.setting2()
gc.print("P"..int(curBoard*.5+.5).."/P4",420,560) gc.print("P"..int(curBoard*.5+.5).."/P4",420,560)
gc.print(curBoard.."/8",580,560) gc.print(curBoard.."/8",580,560)
end end
function Pnt.setting3() function Pnt.setting_touch()
VirtualkeyPreview() VirtualkeyPreview()
local d=snapLevelValue[snapLevel] local d=snapLevelValue[snapLevel]
if d>=10 then if d>=10 then
@@ -831,7 +857,7 @@ function Pnt.help()
for i=1,11 do for i=1,11 do
gc.printf(text.help[i],140,15+43*i,1000,"center") gc.printf(text.help[i],140,15+43*i,1000,"center")
end end
gc.draw(titleImage,250,600,.2,1+.05*sin(Timer()*2),nil,212,35) gc.draw(titleImage,250,600,.2,1+.05*sin(Timer()*2),nil,206,35)
gc.setLineWidth(5) gc.setLineWidth(5)
gc.rectangle("line",17,17,260,260) gc.rectangle("line",17,17,260,260)
gc.rectangle("line",1077,17,186,186) gc.rectangle("line",1077,17,186,186)
@@ -850,15 +876,17 @@ function Pnt.stat()
gc.print(text.stat[i],400,30*i-5) gc.print(text.stat[i],400,30*i-5)
gc.print(statOpt(i),720,30*i-5) gc.print(statOpt(i),720,30*i-5)
end end
gc.draw(titleImage,260,600,.2+.07*sin(Timer()*3),nil,nil,212,35) gc.draw(titleImage,260,600,.2+.07*sin(Timer()*3),nil,nil,206,35)
end end
function Pnt.history() function Pnt.history()
gc.setColor(.2,.2,.2,.7) gc.setColor(.2,.2,.2,.7)
gc.rectangle("fill",150,35,980,530) gc.rectangle("fill",30,45,1000,632)
gc.setColor(1,1,1) gc.setColor(1,1,1)
gc.setLineWidth(4) gc.setLineWidth(4)
gc.rectangle("line",150,35,980,530) gc.rectangle("line",30,45,1000,632)
setFont(25) setFont(25)
gc.print(updateLog[sel],160,40) for i=0,min(22,#updateLog-sel)do
gc.print(updateLog[sel+i],40,50+27*(i))
end
end end
return Pnt return Pnt

View File

@@ -46,6 +46,7 @@ c:release()
gc.setDefaultFilter("linear","linear") gc.setDefaultFilter("linear","linear")
titleImage=N("/image/mess/title.png") titleImage=N("/image/mess/title.png")
coloredTitleImage=N("/image/mess/title_colored.png")
dialCircle=N("/image/mess/dialCircle.png") dialCircle=N("/image/mess/dialCircle.png")
dialNeedle=N("/image/mess/dialNeedle.png") dialNeedle=N("/image/mess/dialNeedle.png")
badgeIcon=N("/image/mess/badge.png") badgeIcon=N("/image/mess/badge.png")
@@ -69,5 +70,6 @@ drawableText={
setting2Help=T(25), setting2Help=T(25),
musicRoom=T(80), musicRoom=T(80),
nowPlaying=T(50), nowPlaying=T(50),
warning=T(30),
} }
c=gc.setCanvas() c=gc.setCanvas()

192
timer.lua
View File

@@ -8,12 +8,12 @@ load=function()
local t=Timer() local t=Timer()
::R:: ::R::
if loading==1 then if loading==1 then
if loadnum<=#voiceList then if loadnum<=#voiceName then
local N=voiceList[loadnum] local N=voiceName[loadnum]
for i=1,#voice[N]do for i=1,#voiceList[N]do
voice[N][i]=love.audio.newSource("VOICE/"..voice[N][i]..".ogg","static") voiceBank[voiceList[N][i]]={love.audio.newSource("VOICE/"..voiceList[N][i]..".ogg","static")}
end end
loadprogress=loadnum/#voiceList loadprogress=loadnum/#voiceName
loadnum=loadnum+1 loadnum=loadnum+1
else else
loading=2 loading=2
@@ -60,20 +60,34 @@ end,
play=function(dt) play=function(dt)
frame=frame+1 frame=frame+1
stat.time=stat.time+dt stat.time=stat.time+dt
for i=#FX.attack,1,-1 do for i=#FX_attack,1,-1 do
local b=FX.attack[i] local b=FX_attack[i]
b.t=b.t+1 b.t=b.t+1
local t0=b.t*.025--t in [0,1] if b.t>50 then
local t=(sin(1.5*(2*t0-1))+1)*.5 b.rad=b.rad*1.08+.2
if t0==1 then b.x,b.y=b.x2,b.y2
rem(FX.attack,i) elseif b.t>10 then
local t=((b.t-10)*.025)t=(3-2*t)*t*t
b.x,b.y=b.x1*(1-t)+b.x2*t,b.y1*(1-t)+b.y2*t
end
if b.t<60 then
local L=FX_attack[i].drag
if #L==10 then
rem(L,1)rem(L,1)
end
ins(L,b.x)ins(L,b.y)
else
for i=1,#FX_attack do
FX_attack[i]=FX_attack[i+1]
end
end end
end end
for i=#FX.badge,1,-1 do
local b=FX.badge[i] for i=#FX_badge,1,-1 do
local b=FX_badge[i]
b.t=b.t+1 b.t=b.t+1
if b.t==60 then if b.t==60 then
rem(FX.badge,i) rem(FX_badge,i)
end end
end end
for i=1,#virtualkey do for i=1,#virtualkey do
@@ -81,18 +95,6 @@ play=function(dt)
virtualkeyPressTime[i]=virtualkeyPressTime[i]-1 virtualkeyPressTime[i]=virtualkeyPressTime[i]-1
end end
end end
local E=#FX.attack
for i=E,1,-1 do
local A=FX.attack[i]
A.t=A.t+1
if A.t>=100 then
for j=i,E do
FX.attack[j]=FX.attack[j+1]
end--remove [i]
elseif A.t>80 then
A.rad=A.rad*1.08+.2
end
end
if frame<180 then if frame<180 then
if frame==179 then if frame==179 then
@@ -102,8 +104,12 @@ play=function(dt)
end end
for p=1,#players do for p=1,#players do
P=players[p] P=players[p]
if P.keyPressing[1]or P.keyPressing[2]then if P.keyPressing[1]then
P.moving=P.moving+(P.moving>0 and 1 or -1) if P.moving>0 then P.moving=0 end
P.moving=P.moving-1
elseif P.keyPressing[2]then
if P.moving<0 then P.moving=0 end
P.moving=P.moving+1
else else
P.moving=0 P.moving=0
end end
@@ -112,7 +118,7 @@ play=function(dt)
return return
elseif players[1].keyPressing[10]then elseif players[1].keyPressing[10]then
restartCount=restartCount+1 restartCount=restartCount+1
if restartCount>17 then if restartCount>20 then
clearTask("play") clearTask("play")
updateStat() updateStat()
resetGameData() resetGameData()
@@ -140,23 +146,15 @@ play=function(dt)
end end
end end
if P.ai and P.waiting==-1 then if not P.human and P.control and P.waiting==-1 then
P.ai.controlDelay=P.ai.controlDelay-1 local C=P.AI_keys
if P.ai.controlDelay==0 then P.AI_delay=P.AI_delay-1
if #P.ai.controls>0 then if not C[1]then
local C=P.ai.controls P.AI_stage=AI_think[P.AI_mode][P.AI_stage](C)
pressKey(C[1],P)releaseKey(C[1],P) elseif P.AI_delay<=0 then
local k=#C for i=1,k do C[i]=C[i+1]end--table.remove(C,1) pressKey(C[1],P)releaseKey(C[1],P)
P.ai.controlDelay=P.ai.controlDelay0+1 local k=#C for i=1,k do C[i]=C[i+1]end--table.remove(C,1)
else P.AI_delay=P.AI_delay0*2
AI_getControls(P.ai.controls)
P.ai.controlDelay=P.ai.controlDelay0+2
if Timer()-P.modeData.point>P.modeData.event then
P.modeData.point=Timer()
P.modeData.event=P.ai.controlDelay0+rnd(2,10)
changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3)
end
end
end end
end end
if not P.keepVisible then if not P.keepVisible then
@@ -164,21 +162,38 @@ play=function(dt)
if P.visTime[j][i]>0 then P.visTime[j][i]=P.visTime[j][i]-1 end if P.visTime[j][i]>0 then P.visTime[j][i]=P.visTime[j][i]-1 end
end end end end
end--Fresh visible time end--Fresh visible time
if P.moving<0 then
if P.keyPressing[1]or P.keyPressing[2]then if P.keyPressing[1]then
P.moving=P.moving+(P.moving>0 and 1 or -1) if -P.moving<=P.gameEnv.das then
local d=abs(P.moving)-P.gameEnv.das P.moving=P.moving-1
if d>1 then elseif P.waiting==-1 then
if P.gameEnv.arr>0 then local x=P.curX
if d%P.gameEnv.arr==0 then if P.gameEnv.arr>0 then
act[P.moving>0 and"moveRight"or"moveLeft"](true) act.moveLeft(true)
else
act.insLeft()
end end
else if x~=P.curX then P.moving=P.moving+P.gameEnv.arr-1 end
act[P.moving>0 and"insRight"or"insLeft"]()
end end
else
P.moving=0
end
elseif P.moving>0 then
if P.keyPressing[2]then
if P.moving<=P.gameEnv.das then
P.moving=P.moving+1
elseif P.waiting==-1 then
local x=P.curX
if P.gameEnv.arr>0 then
act.moveRight(true)
else
act.insRight()
end
if x~=P.curX then P.moving=P.moving-P.gameEnv.arr+1 end
end
else
P.moving=0
end end
else
P.moving=0
end end
if P.keyPressing[7]and not P.keyPressing[9]then if P.keyPressing[7]and not P.keyPressing[9]then
local d=abs(P.downing)-P.gameEnv.sddas local d=abs(P.downing)-P.gameEnv.sddas
@@ -197,16 +212,17 @@ play=function(dt)
end end
if P.falling>=0 then if P.falling>=0 then
P.falling=P.falling-1 P.falling=P.falling-1
if P.falling>=0 then goto stop end if P.falling>=0 then
if P.human and P.gameEnv.fall>0 and #P.field>P.clearing[1]then SFX("fall")end goto stop
for i=1,#P.clearing do else
removeRow(P.field,P.clearing[i]) local L=#P.clearing
removeRow(P.visTime,P.clearing[i]) if P.human and P.gameEnv.fall>0 and #P.field+L>P.clearing[L]then SFX("fall")end
end for i=1,L do
for i=1,#P.clearing do P.clearing[i]=nil
P.clearing[i]=nil end
end end
end end
if not P.control then goto stop end
if P.waiting>=0 then if P.waiting>=0 then
P.waiting=P.waiting-1 P.waiting=P.waiting-1
if P.waiting==-1 then resetblock()end if P.waiting==-1 then resetblock()end
@@ -215,11 +231,17 @@ play=function(dt)
if P.curY~=P.y_img then if P.curY~=P.y_img then
if P.dropDelay>=0 then if P.dropDelay>=0 then
P.dropDelay=P.dropDelay-1 P.dropDelay=P.dropDelay-1
if P.dropDelay>=0 then goto stop end if P.dropDelay>0 then goto stop end
end end
drop() P.curY=P.curY-1
P.spinLast=false
if P.y_img~=P.curY then if P.y_img~=P.curY then
P.dropDelay=P.gameEnv.drop P.dropDelay=P.gameEnv.drop
elseif P.AI_mode=="CC"then
P.AI_needFresh=true
if not P.AIdata._20G and P.gameEnv.drop<P.AI_delay0*.5 then
CC_switch20G(P)
end
end end
if P.freshTime<=P.gameEnv.freshLimit then if P.freshTime<=P.gameEnv.freshLimit then
P.lockDelay=P.gameEnv.lock P.lockDelay=P.gameEnv.lock
@@ -228,6 +250,9 @@ play=function(dt)
P.lockDelay=P.lockDelay-1 P.lockDelay=P.lockDelay-1
if P.lockDelay>=0 then goto stop end if P.lockDelay>=0 then goto stop end
drop() drop()
if P.AI_mode=="CC"then
P.AI_needFresh=true
end
end end
::stop:: ::stop::
if P.b2b1==P.b2b then if P.b2b1==P.b2b then
@@ -248,14 +273,14 @@ play=function(dt)
end end
if P.falling>=0 then if P.falling>=0 then
P.falling=P.falling-1 P.falling=P.falling-1
if P.falling>=0 then goto stop end if P.falling>=0 then
if P.human and P.gameEnv.fall>0 and #P.field>P.clearing[1]then SFX("fall")end goto stop
for i=1,#P.clearing do else
removeRow(P.field,P.clearing[i]) local L=#P.clearing
removeRow(P.visTime,P.clearing[i]) if P.human and P.gameEnv.fall>0 and #P.field+L>P.clearing[L]then SFX("fall")end
end for i=1,L do
for i=1,#P.clearing do P.clearing[i]=nil
P.clearing[i]=nil end
end end
end::stop:: end::stop::
if P.endCounter<40 then if P.endCounter<40 then
@@ -275,7 +300,7 @@ play=function(dt)
end end
for i=#P.shade,1,-1 do for i=#P.shade,1,-1 do
local S=P.shade[i] local S=P.shade[i]
S[1]=S[1]-1+setting.fxs*.25 S[1]=S[1]-1+setting.dropFX*.25
if S[1]<=0 then if S[1]<=0 then
rem(P.shade,i) rem(P.shade,i)
end end
@@ -297,15 +322,16 @@ play=function(dt)
if b.t>=60 then rem(P.bonus,i)end if b.t>=60 then rem(P.bonus,i)end
end end
end end
for i=#P.atkBuffer,1,-1 do for i=#P.atkBuffer,1,-1 do
local atk=P.atkBuffer[i] local A=P.atkBuffer[i]
atk.time=atk.time+1 A.time=A.time+1
if not atk.sent then if not A.sent then
if atk.countdown>0 then if A.countdown>0 then
atk.countdown=atk.countdown-garbageSpeed A.countdown=max(A.countdown-garbageSpeed,0)
end end
else else
if atk.time>20 then if A.time>20 then
rem(P.atkBuffer,i) rem(P.atkBuffer,i)
end end
end end

View File

@@ -24,7 +24,22 @@ end
function mDraw(s,x,y) function mDraw(s,x,y)
gc.draw(s,x-s:getWidth()*.5,y) gc.draw(s,x-s:getWidth()*.5,y)
end end
function destroyPlayers()
if players then
for _,P in next,players do if P.id then
while P.field[1]do
removeRow(P.field)
removeRow(P.visTime)
end
if P.AI_mode=="CC"then
BOT.free(P.bot_opt)
BOT.free(P.bot_wei)
BOT.destroy(P.AI_bot)
P.AI_mode=nil
end
end end
end
end
function getNewRow(val) function getNewRow(val)
local t=rem(freeRow) local t=rem(freeRow)
for i=1,10 do for i=1,10 do
@@ -59,14 +74,13 @@ local drawableTextLoad={
"setting2Help", "setting2Help",
"musicRoom", "musicRoom",
"nowPlaying", "nowPlaying",
"warning",
} }
function swapLanguage(l) function swapLanguage(l)
text=require("language/"..langID[l]) text=require("language/"..langID[l])
Buttons.sel=nil for S,L in next,Widget do
for S,L in next,Buttons do for N,W in next,L do
for N,B in next,L do W.text=text.WidgetText[S][N]
B.alpha=0
B.t=text.ButtonText[S][N]
end end
end end
gc.push("transform") gc.push("transform")
@@ -91,6 +105,7 @@ function changeBlockSkin(n)
n=n-1 n=n-1
gc.push("transform") gc.push("transform")
gc.origin() gc.origin()
gc.setColor(1,1,1)
for i=1,13 do for i=1,13 do
gc.setCanvas(blockSkin[i]) gc.setCanvas(blockSkin[i])
gc.draw(blockImg,30-30*i,-30*n) gc.draw(blockImg,30-30*i,-30*n)
@@ -101,14 +116,14 @@ function changeBlockSkin(n)
gc.setCanvas() gc.setCanvas()
end end
local vibrateLevel={0,.02,.03,.04,.05,.06,.07,.08} local vibrateLevel={0,.015,.02,.03,.04,.05,.06,.07,.08,.09}
function VIB(t) function VIB(t)
if setting.vib>0 then if setting.vib>0 then
love.system.vibrate(vibrateLevel[setting.vib+t]) love.system.vibrate(vibrateLevel[setting.vib+t])
end end
end end
function SFX(s,v) function SFX(s,v)
if setting.sfx then if setting.sfx>0 then
local n=1 local n=1
::L::if sfx[s][n]:isPlaying()then ::L::if sfx[s][n]:isPlaying()then
n=n+1 n=n+1
@@ -119,34 +134,61 @@ function SFX(s,v)
end end
goto L goto L
end::quit:: end::quit::
sfx[s][n]:setVolume(v or 1) sfx[s][n]:setVolume((v or 1)*setting.sfx*.125)
sfx[s][n]:play() sfx[s][n]:play()
end end
end end
function VOICE(s,n) function getFreeVoiceChannel()
if setting.voc then local i=#voiceQueue
voicePlaying[#voicePlaying+1]=voice[s][n or rnd(#voice[s])] for i=1,i do
if #voicePlaying==1 then if #voiceQueue[i]==0 then return i end
voicePlaying[1]:play() 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
local P=#voiceQueue
voiceQueue[P+1]={voiceList[s][rnd(#voiceList[s])]}
--新建[chn]
end end
end end
end end
function BGM(s) function BGM(s)
if setting.bgm and bgmPlaying~=s then if setting.bgm>0 then
if bgmPlaying then newTask(Event_task.bgmFadeOut,nil,bgmPlaying)end if bgmPlaying~=s then
for i=#Task,1,-1 do if bgmPlaying then newTask(Event_task.bgmFadeOut,nil,bgmPlaying)end
local T=Task[i] for i=#Task,1,-1 do
if T.code==Event_task.bgmFadeIn then local T=Task[i]
T.code=Event_task.bgmFadeOut if T.code==Event_task.bgmFadeIn then
elseif T.code==Event_task.bgmFadeOut and T.data==s then T.code=Event_task.bgmFadeOut
rem(Task,i) 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*.125
bgm[bgmPlaying]:setVolume(v)
if v>0 then
bgm[bgmPlaying]:play()
else
bgm[bgmPlaying]:pause()
end
end end
end end
if s then elseif bgmPlaying then
newTask(Event_task.bgmFadeIn,nil,s) bgm[bgmPlaying]:pause()
bgm[s]:play() bgmPlaying=nil
end
bgmPlaying=s
end end
end end
@@ -199,7 +241,7 @@ function gotoScene(s,style)
time=swap[style][1],mid=swap[style][2], time=swap[style][1],mid=swap[style][2],
draw=swap[style].d draw=swap[style].d
} }
Buttons.sel=nil widget_sel=nil
if style~="none"then if style~="none"then
SFX("swipe") SFX("swipe")
end end
@@ -218,10 +260,10 @@ local prevMenu={
mode="main", mode="main",
custom="mode", custom="mode",
draw=function() draw=function()
kb.setKeyRepeat(false)
gotoScene("custom") gotoScene("custom")
end, end,
play=function() play=function()
kb.setKeyRepeat(true)
updateStat() updateStat()
clearTask("play") clearTask("play")
gotoScene(curMode.id~="custom"and"mode"or"custom","deck") gotoScene(curMode.id~="custom"and"mode"or"custom","deck")
@@ -231,8 +273,11 @@ local prevMenu={
saveSetting() saveSetting()
gotoScene("main") gotoScene("main")
end, end,
setting2="setting", setting_game= "setting",
setting3="setting", setting_graphic="setting",
setting_sound= "setting",
setting_control="setting",
setting_touch= "setting",
help="main", help="main",
history="help", history="help",
stat="main", stat="main",
@@ -249,7 +294,6 @@ function pauseGame()
pauseTimer=0--Pause timer for animation pauseTimer=0--Pause timer for animation
if not gamefinished then if not gamefinished then
pauseCount=pauseCount+1 pauseCount=pauseCount+1
if bgmPlaying then bgm[bgmPlaying]:pause()end
end end
for i=1,#players.alive do for i=1,#players.alive do
local l=players.alive[i].keyPressing local l=players.alive[i].keyPressing
@@ -262,7 +306,6 @@ function pauseGame()
gotoScene("pause","none") gotoScene("pause","none")
end end
function resumeGame() function resumeGame()
if bgmPlaying then bgm[bgmPlaying]:play()end
gotoScene("play","fade") gotoScene("play","fade")
end end
local dataOpt={ local dataOpt={
@@ -319,8 +362,8 @@ function loadSetting()
local p=find(t[i],"=") local p=find(t[i],"=")
if p then if p then
local t,v=sub(t[i],1,p-1),sub(t[i],p+1) local t,v=sub(t[i],1,p-1),sub(t[i],p+1)
if t=="sfx"or t=="bgm"or t=="bgblock"or t=="voc"then if t=="sfx"or t=="bgm"or t=="voc"then
setting[t]=v=="true" setting[t]=toN(v:match("[012345678]"))or setting[t]
elseif t=="vib"then elseif t=="vib"then
setting.vib=toN(v:match("[012345]"))or 0 setting.vib=toN(v:match("[012345]"))or 0
elseif t=="fullscreen"then elseif t=="fullscreen"then
@@ -346,6 +389,8 @@ function loadSetting()
end end
elseif t=="virtualkeyAlpha"then elseif t=="virtualkeyAlpha"then
setting.virtualkeyAlpha=min(int(abs(toN(v))),10) setting.virtualkeyAlpha=min(int(abs(toN(v))),10)
elseif t=="ghost"or t=="center"or t=="grid"or t=="swap"or t=="bg"or t=="bgblock"or t=="smo"then
setting[t]=v=="true"
elseif t=="virtualkeyIcon"or t=="virtualkeySwitch"then elseif t=="virtualkeyIcon"or t=="virtualkeySwitch"then
setting[t]=v=="true" setting[t]=v=="true"
elseif t=="frameMul"then elseif t=="frameMul"then
@@ -353,9 +398,7 @@ function loadSetting()
elseif t=="das"or t=="arr"or t=="sddas"or t=="sdarr"then elseif t=="das"or t=="arr"or t=="sddas"or t=="sdarr"then
v=toN(v)if not v or v<0 then v=0 end v=toN(v)if not v or v<0 then v=0 end
setting[t]=int(v) setting[t]=int(v)
elseif t=="ghost"or t=="center"or t=="grid"or t=="swap"or t=="bg"or t=="smo"then elseif t=="dropFX"or t=="shakeFX"or t=="atkFX"then
setting[t]=v=="true"
elseif t=="fxs"then
setting[t]=toN(v:match("[0123]"))or 0 setting[t]=toN(v:match("[0123]"))or 0
elseif t=="lang"then elseif t=="lang"then
setting[t]=toN(v:match("[123]"))or 1 setting[t]=toN(v:match("[123]"))or 1
@@ -366,22 +409,30 @@ function loadSetting()
end end
end end
local saveOpt={ local saveOpt={
"ghost","center",
"grid","swap",
"fxs","bg",
"das","arr", "das","arr",
"sddas","sdarr", "sddas","sdarr",
"holdR",
"swap",
"ghost","center",
"smo","grid",
"dropFX",
"shakeFX",
"atkFX",
"frameMul",
"fullscreen",
"bg",
"bgblock",
"lang", "lang",
"skin",
"sfx","bgm", "sfx","bgm",
"vib","voc", "vib","voc",
"fullscreen",
"bgblock",
"skin","smo",
"virtualkeyAlpha", "virtualkeyAlpha",
"virtualkeyIcon", "virtualkeyIcon",
"virtualkeySwitch", "virtualkeySwitch",
"frameMul",
} }
function saveSetting() function saveSetting()
local vk={} local vk={}

View File

@@ -1,27 +1,44 @@
return{ local S=[=[
[=[Future outlook: Future outlook:
"classic" rule GUI:
backfire mode highscore of most modes
Encrypt source code(JIT to byte code) custom block color/direction
game recording custom sequence
virtual key switch(all keys) virtual key switch(all keys)
easier CTWC Normal Things:
fineese/bigbang mode new cooler attack FX
more FXs combo mode
TTT mode demo play at main menu
smarter AI any screen size
CC smarter(think of gaebage buffer)
fineese/bigbang mode & easier CTWC
new AI:task-Z
game recording
TTT mode
Hard Things:
Encrypt source code(JIT to byte code)
infinite 1v1 infinite 1v1
square mode square mode
3d features more FXs & 3d features & animations
layer-feeling 0.7.24(0.7.23):
more animation]=],[=[ REMAKE ALL BGM!
more settings with brand new GUI!
new mode:Master-Final
new modes:attacker & defender(not survivor!)
add restart button when pause
Code Clear added,face it bravely!(Windows only)
change falling animation
new GUI details
louder sound
code optimized
many bugs fixed
0.7.22: 0.7.22:
scoring system scoring system
smooth dropping smooth dropping
can change FX level can change FX level
new attaking FX new attaking FX
new bone skin new bone skin
baattery info/time display battery info/time display
in-game update log(this page) in-game update log(this page)
fast game fast game
much many more better GUI details much many more better GUI details
@@ -33,7 +50,7 @@ return{
0.7.21: 0.7.21:
new title image new title image
more GUI details more GUI details
many bugs fixed]=],[=[ many bugs fixed
0.7.20: 0.7.20:
add music room add music room
change block/space apperance in draw mode change block/space apperance in draw mode
@@ -50,7 +67,7 @@ return{
add 2 new block skins add 2 new block skins
new difficulty in infinite mode new difficulty in infinite mode
new background/sound effect in master mode new background/sound effect in master mode
bug fixed]=],[=[ bug fixed
0.7.18: 0.7.18:
3 new block skins!(one skin origional by Miya(nya~)) 3 new block skins!(one skin origional by Miya(nya~))
better restarting(to prevent mistakenly touching) better restarting(to prevent mistakenly touching)
@@ -66,7 +83,7 @@ return{
adjust difficulty of PC train mode adjust difficulty of PC train mode
adjust vibrate level for mobile devices adjust vibrate level for mobile devices
little optimized little optimized
bugs fixed]=],[=[ bugs fixed
0.7.16: 0.7.16:
bugs fixed bugs fixed
change rules of custom puzzle mode change rules of custom puzzle mode
@@ -79,7 +96,7 @@ return{
can pause game with animation can pause game with animation
change icon of "Functional key" change icon of "Functional key"
speed optimized speed optimized
bugs fixed]=],[=[ bugs fixed
0.7.14: 0.7.14:
drawing mode in custom game drawing mode in custom game
can adjust virtual keys with mouse can adjust virtual keys with mouse
@@ -90,7 +107,7 @@ return{
little game rule change little game rule change
bugs fixed(AI control error) bugs fixed(AI control error)
0.7.13: 0.7.13:
Chniese game name:方块研究所 Chinese game name:方块研究所
SUPER COOL instant moving effect SUPER COOL instant moving effect
new b2b bar style & animation new b2b bar style & animation
new transition animation new transition animation
@@ -98,7 +115,7 @@ return{
adjust delay algorithm(probably cause controlfeel changing,please reset your DAS setting) adjust delay algorithm(probably cause controlfeel changing,please reset your DAS setting)
code reconstructed code reconstructed
bugs fixed(error when seq=his,size of custom oppo) bugs fixed(error when seq=his,size of custom oppo)
debug key change to F8]=],[=[ debug key change to F8
0.7.12: 0.7.12:
AI learned to switch attack mode AI learned to switch attack mode
seperate master mode from marathon mode seperate master mode from marathon mode
@@ -111,7 +128,7 @@ return{
grid switch grid switch
swap target by combo key/press swap target by combo key/press
some Chinese translaton editted some Chinese translaton editted
[reconstruct event system]]=],[=[ [reconstruct event system]
0.7.11: 0.7.11:
some Chinese translaton editted some Chinese translaton editted
add bone block in 2 hardest marathon(new block-fresh system) add bone block in 2 hardest marathon(new block-fresh system)
@@ -122,7 +139,7 @@ return{
clearer attacking pointer clearer attacking pointer
fix 6 next in classic mode fix 6 next in classic mode
add QR code in help page add QR code in help page
change some detials]=],[=[ change some detials
0.7.10: 0.7.10:
更完全的中文翻译 更完全的中文翻译
add Classic mode add Classic mode
@@ -135,7 +152,7 @@ return{
change rotate system change rotate system
change BGM&BG set change BGM&BG set
code optimized code optimized
fix bugs]=],[=[ fix bugs
0.7.8: 0.7.8:
GPU usage decreased much more than before GPU usage decreased much more than before
add virtual key animation add virtual key animation
@@ -150,7 +167,7 @@ return{
combine some modes combine some modes
change some GUI change some GUI
more SFXs more SFXs
fix bugs]=],[=[ fix bugs
0.7.6: 0.7.6:
new font new font
add DIFFICULTY selection add DIFFICULTY selection
@@ -162,7 +179,7 @@ return{
better GUI&change speed&BGM in royale mode better GUI&change speed&BGM in royale mode
more FXs in royale mode more FXs in royale mode
fix all attacking bug of royale mode fix all attacking bug of royale mode
change sequence of TSD-only mode to bag7]=],[=[ change sequence of TSD-only mode to bag7
0.7.5: 0.7.5:
reduce difficuly of PC training mode,and add more patterns reduce difficuly of PC training mode,and add more patterns
reduce difficuly of death mode reduce difficuly of death mode
@@ -176,7 +193,7 @@ return{
change game icon change game icon
adjust GUI of royale mode adjust GUI of royale mode
change sequence of TSD-only mode change sequence of TSD-only mode
royale mode use LESS GPU]=],[=[ royale mode use LESS GPU
0.7.4: 0.7.4:
add a lot of bugs add a lot of bugs
0.7.3: 0.7.3:
@@ -192,5 +209,15 @@ return{
remove non-sense s/z spin double remove non-sense s/z spin double
GUI position editted GUI position editted
grid BG changed grid BG changed
smarter AI]=] smarter AI
} ]=]
local find,sub=string.find,string.sub
local L,n,p={},1,1
local eof=#S
repeat
p1=find(S,"\n",p)
L[n]=sub(S,p,p1-1)
n=n+1
p=p1+1
until p1==eof
return L