更多全局变量改为全大写

This commit is contained in:
MrZ626
2021-10-18 15:05:35 +08:00
parent b7832c133a
commit 033a770759
65 changed files with 206 additions and 214 deletions

View File

@@ -16,7 +16,7 @@ local sList={
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},
fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
eventSet=eventSetList,
eventSet=EVENTSETS,
holdMode={'hold','swap'},
}

View File

@@ -342,7 +342,7 @@ function scene.draw()
gc.draw(cross,30*penPath[i][1]-30+math.random(-1,1),600-30*penPath[i][2]+math.random(-1,1))
end
else
local c=minoColor[pens[curPen]]
local c=BLOCK_COLORS[pens[curPen]]
gc.setColor(c[1],c[2],c[3],.7+.2*math.sin(TIME()*12.6))
for i=1,#penPath do
gc.rectangle('line',30*penPath[i][1]-30+2,600-30*penPath[i][2]+2,30-4,30-4,3)
@@ -375,7 +375,7 @@ function scene.draw()
--Left button
if pens[1]>0 then
gc.setColor(minoColor[pens[1]])
gc.setColor(BLOCK_COLORS[pens[1]])
gc.rectangle('fill',5,5,23,30,3)
elseif pens[1]==-1 then
gc.setColor(COLOR.Z)
@@ -396,7 +396,7 @@ function scene.draw()
--Right button
if pens[2]>0 then
gc.setColor(minoColor[pens[2]])
gc.setColor(BLOCK_COLORS[pens[2]])
gc.rectangle('fill',52,5,23,30,3)
elseif pens[2]==-1 then
gc.setColor(COLOR.Z)
@@ -418,7 +418,7 @@ function scene.draw()
--Middle button
if pens[3]>0 then
gc.setColor(minoColor[pens[3]])
gc.setColor(BLOCK_COLORS[pens[3]])
gc.rectangle('fill',35,2,10,21,3)
elseif pens[3]==-1 then
gc.setColor(COLOR.Z)

View File

@@ -19,7 +19,7 @@ function scene.sceneBack()
FILE.save(DATA.copyMission(),'conf/customMissions')
end
local missionEnum=missionEnum
local ENUM_MISSION=ENUM_MISSION
local legalInput={Z=true,S=true,J=true,L=true,T=true,O=true,I=true,A=true,_=true,P=true}
function scene.keyDown(key)
if key=="left"then
@@ -106,9 +106,9 @@ function scene.keyDown(key)
end
input=input..key
if missionEnum[input]then
if ENUM_MISSION[input]then
cur=cur+1
ins(MISSION,cur,missionEnum[input])
ins(MISSION,cur,ENUM_MISSION[input])
SFX.play('lock')
input=""
elseif #input>1 or not legalInput[input]then
@@ -135,7 +135,7 @@ function scene.draw()
gc.print(input,1200,275)
--Draw targets
local libColor=minoColor
local libColor=BLOCK_COLORS
local set=SETTING.skin
local L=MISSION
local x,y=100,136--Next block pos
@@ -171,7 +171,7 @@ function scene.draw()
else
gc.setColor(COLOR.H)
end
gc.print(missionEnum[L[i]],x,y-25)
gc.print(ENUM_MISSION[L[i]],x,y-25)
x=x+56
end
end

View File

@@ -125,7 +125,7 @@ function scene.update(dt)
end
end
local blockCharWidth={}for i=1,#BLOCKCHARS do blockCharWidth[i]=gc.newText(FONT.get(60),BLOCKCHARS[i]):getWidth()end
local blockCharWidth={}for i=1,#BLOCK_CHARS do blockCharWidth[i]=gc.newText(FONT.get(60),BLOCK_CHARS[i]):getWidth()end
function scene.draw()
--Draw frame
gc_setColor(COLOR.Z)
@@ -133,7 +133,7 @@ function scene.draw()
gc.rectangle('line',100,110,1080,260,5)
--Draw sequence
local minoColor=minoColor
local BLOCK_COLORS=BLOCK_COLORS
local skinSetting=SETTING.skin
local BAG=BAG
local x,y=120,136--Next block pos
@@ -160,8 +160,8 @@ function scene.draw()
end
if i<=j then
setFont(60)
gc_setColor(minoColor[skinSetting[BAG[i]]])
gc_print(BLOCKCHARS[BAG[i]],x,y-40)
gc_setColor(BLOCK_COLORS[skinSetting[BAG[i]]])
gc_print(BLOCK_CHARS[BAG[i]],x,y-40)
x=x+blockCharWidth[BAG[i]]
end
end

View File

@@ -26,7 +26,7 @@ local function _updateMenuButtons()
if GAME.replaying or pos=='right'then
WIDGET.active.restart.x=1125
WIDGET.active.pause.x=1195
modeTextPos=1100-drawableText.modeName:getWidth()
modeTextPos=1100-TEXTOBJ.modeName:getWidth()
elseif pos=='middle'then
WIDGET.active.restart.x=360
WIDGET.active.pause.x=860
@@ -34,7 +34,7 @@ local function _updateMenuButtons()
elseif pos=='left'then
WIDGET.active.restart.x=120
WIDGET.active.pause.x=190
modeTextPos=1200-drawableText.modeName:getWidth()
modeTextPos=1200-TEXTOBJ.modeName:getWidth()
end
end
local function _updateRepButtons()
@@ -116,7 +116,7 @@ local function _restart()
_updateRepButtons()
end
local function _checkGameKeyDown(key)
local k=keyMap.keyboard[key]
local k=KEY_MAP.keyboard[key]
if k then
if k>0 then
if noKey then return end
@@ -247,7 +247,7 @@ function scene.keyDown(key,isRep)
end
function scene.keyUp(key)
if noKey then return end
local k=keyMap.keyboard[key]
local k=KEY_MAP.keyboard[key]
if k then
if k>0 then
PLAYERS[1]:releaseKey(k)
@@ -257,7 +257,7 @@ function scene.keyUp(key)
end
function scene.gamepadDown(key)
if noKey then return end
local k=keyMap.joystick[key]
local k=KEY_MAP.joystick[key]
if k then
if k>0 then
PLAYERS[1]:pressKey(k)
@@ -271,7 +271,7 @@ function scene.gamepadDown(key)
end
function scene.gamepadUp(key)
if noKey then return end
local k=keyMap.joystick[key]
local k=KEY_MAP.joystick[key]
if k then
if k>0 then
PLAYERS[1]:releaseKey(k)
@@ -357,7 +357,7 @@ function scene.draw()
--Mode info
gc_setColor(1,1,1,.82)
gc_draw(drawableText.modeName,modeTextPos,10)
gc_draw(TEXTOBJ.modeName,modeTextPos,10)
local M=GAME.curMode
if M then
if M.score and M.records[1]then

View File

@@ -161,7 +161,7 @@ function scene.draw()
else
gc.setLineWidth(4)
end
local L=title
local L=SVG_TITLE
gc.push('transform')
gc.translate(126,100)
for i=1,8 do

View File

@@ -209,7 +209,6 @@ local baseRankColor={
{.85,.5,.4,.3},
{.85,.3,.8,.3},
}
local rankColor=rankColor
local function _drawModeShape(M,S,drawType)
if M.shape==1 then--Rectangle
gc_rectangle(drawType,M.x-S,M.y-S,2*S,2*S)
@@ -269,11 +268,11 @@ function scene.draw()
--Rank
if unlocked==1 then
name=RANKCHARS[rank]
name=RANK_CHARS[rank]
if name then
gc_setColor(0,0,0,.8)
mStr(name,M.x+M.size*.7,M.y-50-M.size*.7)
gc_setColor(rankColor[rank])
gc_setColor(RANK_COLORS[rank])
mStr(name,M.x+M.size*.7+4,M.y-50-M.size*.7-4)
end
end
@@ -295,13 +294,13 @@ function scene.draw()
gc_draw(IMG.ctrlSpeedLimit,1230,50,nil,.4)
end
if M.score then
mText(drawableText.highScore,1100,240)
mText(TEXTOBJ.highScore,1100,240)
gc_setColor(.3,.3,.3,.7)
gc_rectangle('fill',940,290,320,280,5)--Highscore board
local L=M.records
gc_setColor(1,1,1)
if visibleModes[sel]==2 then
mText(drawableText.modeLocked,1100,370)
mText(TEXTOBJ.modeLocked,1100,370)
elseif L[1]then
for i=1,#L do
local t=M.scoreDisp(L[i])
@@ -315,7 +314,7 @@ function scene.draw()
end
end
else
mText(drawableText.noScore,1100,370)
mText(TEXTOBJ.noScore,1100,370)
end
end
end

View File

@@ -151,7 +151,7 @@ function scene.keyDown(key,isRep)
inputBox:keypress(key)
elseif playing then
if noKey or isRep then return end
local k=keyMap.keyboard[key]
local k=KEY_MAP.keyboard[key]
if k and k>0 then
PLAYERS[1]:pressKey(k)
VK.press(k)
@@ -170,7 +170,7 @@ function scene.keyDown(key,isRep)
end
function scene.keyUp(key)
if not playing or noKey then return end
local k=keyMap.keyboard[key]
local k=KEY_MAP.keyboard[key]
if k and k>0 then
PLAYERS[1]:releaseKey(k)
VK.release(k)
@@ -181,7 +181,7 @@ function scene.gamepadDown(key)
scene.keyDown("escape")
else
if not playing then return end
local k=keyMap.joystick[key]
local k=KEY_MAP.joystick[key]
if k and k>0 then
PLAYERS[1]:pressKey(k)
VK.press(k)
@@ -190,7 +190,7 @@ function scene.gamepadDown(key)
end
function scene.gamepadUp(key)
if not playing then return end
local k=keyMap.joystick[key]
local k=KEY_MAP.joystick[key]
if k and k>0 then
PLAYERS[1]:releaseKey(k)
VK.release(k)

View File

@@ -20,7 +20,7 @@ local sList={
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},
fall={0,1,2,3,4,5,6,7,8,10,15,20,30,60},
eventSet=eventSetList,
eventSet=EVENTSETS,
}
local scene={}

View File

@@ -208,21 +208,21 @@ function scene.draw()
gc.setColor(.97,.97,.97,timer1)
--Result Text
mDraw(GAME.result and drawableText[GAME.result]or drawableText.pause,640,70-10*(5-timer1*5)^1.5)
mDraw(GAME.result and TEXTOBJ[GAME.result]or TEXTOBJ.pause,640,70-10*(5-timer1*5)^1.5)
--Mode Info (outside)
gc.draw(drawableText.modeName,745-drawableText.modeName:getWidth(),143)
gc.draw(TEXTOBJ.modeName,745-TEXTOBJ.modeName:getWidth(),143)
--Level rank
if RANKCHARS[GAME.rank]then
if RANK_CHARS[GAME.rank]then
gc.push('transform')
gc.translate(1050,5)
setFont(80)
gc.setColor(0,0,0,timer1*.7)
gc.print(RANKCHARS[GAME.rank],-5,-4,nil,1.5)
local L=rankColor[GAME.rank]
gc.print(RANK_CHARS[GAME.rank],-5,-4,nil,1.5)
local L=RANK_COLORS[GAME.rank]
gc.setColor(L[1],L[2],L[3],timer1)
gc.print(RANKCHARS[GAME.rank],0,0,nil,1.5)
gc.print(RANK_CHARS[GAME.rank],0,0,nil,1.5)
gc.pop()
end

View File

@@ -23,7 +23,7 @@ scene.widgetList={
WIDGET.newButton{name="unlock", x=190,y=170,w=280,h=100,color='lY',code=function()_dumpCB(RANKS)end},
WIDGET.newButton{name="data", x=490,y=170,w=280,h=100,color='lY',code=function()_dumpCB(STAT)end},
WIDGET.newButton{name="setting", x=790,y=170,w=280,h=100,color='lY',code=function()_dumpCB(SETTING)end},
WIDGET.newButton{name="vk", x=1090,y=170,w=280,h=100,color='lY',code=function()_dumpCB(VK_org)end},
WIDGET.newButton{name="vk", x=1090,y=170,w=280,h=100,color='lY',code=function()_dumpCB(VK_ORG)end},
WIDGET.newText{name="import", x=55,y=265,color='lR',align='L',font=50},
WIDGET.newButton{name="unlock", x=190,y=390,w=280,h=100,color='lR',
@@ -31,7 +31,7 @@ scene.widgetList={
local D=_parseCB()
if D then
TABLE.cover(D,RANKS)
for k,v in next,oldModeNameTable do
for k,v in next,MODE_UPDATE_MAP do
if RANKS[k]then
RANKS[v]=RANKS[k]
RANKS[k]=nil
@@ -70,8 +70,8 @@ scene.widgetList={
code=function()
local D=_parseCB()
if D then
TABLE.update(D,VK_org)
FILE.save(VK_org,'conf/virtualkey')
TABLE.update(D,VK_ORG)
FILE.save(VK_ORG,'conf/virtualkey')
MES.new('check',text.importSuccess)
else
MES.new('error',text.dataCorrupted)

View File

@@ -9,10 +9,10 @@ local keyList
local function _freshKeyList()
keyList={}for i=0,20 do keyList[i]={}end
for k,v in next,keyMap.keyboard do
for k,v in next,KEY_MAP.keyboard do
ins(keyList[v],{COLOR.lB,k})
end
for k,v in next,keyMap.joystick do
for k,v in next,KEY_MAP.joystick do
ins(keyList[v],{COLOR.lR,k})
end
end
@@ -23,7 +23,7 @@ function scene.sceneInit()
BG.set('none')
end
function scene.sceneBack()
FILE.save(keyMap,'conf/key')
FILE.save(KEY_MAP,'conf/key')
end
local forbbidenKeys={
@@ -40,9 +40,9 @@ function scene.keyDown(key,isRep)
end
elseif key=="backspace"then
if selected then
for k,v in next,keyMap.keyboard do
for k,v in next,KEY_MAP.keyboard do
if v==selected then
keyMap.keyboard[k]=nil
KEY_MAP.keyboard[k]=nil
end
end
_freshKeyList()
@@ -51,7 +51,7 @@ function scene.keyDown(key,isRep)
end
elseif selected then
if not forbbidenKeys[key]then
keyMap.keyboard[key]=selected
KEY_MAP.keyboard[key]=selected
_freshKeyList()
selected=false
SFX.play('reach',.5)
@@ -63,9 +63,9 @@ end
function scene.gamepadDown(key)
if key=="back"then
if selected then
for k,v in next,keyMap.joystick do
for k,v in next,KEY_MAP.joystick do
if v==selected then
keyMap.joystick[k]=nil
KEY_MAP.joystick[k]=nil
end
end
_freshKeyList()
@@ -75,7 +75,7 @@ function scene.gamepadDown(key)
SCN.back()
end
elseif selected then
keyMap.joystick[key]=selected
KEY_MAP.joystick[key]=selected
_freshKeyList()
selected=false
SFX.play('reach',.5)

View File

@@ -91,9 +91,9 @@ scene.widgetList={
WIDGET.newSwitch{name="autoMute", x=1150,y=180,lim=380,disp=SETval('autoMute'),code=SETrev('autoMute')},
WIDGET.newSwitch{name="fine", x=1150,y=250,lim=380,disp=SETval('fine'),code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play('finesseError',.6)end end},
WIDGET.newSelector{name="sfxPack",x=1100,y=330,w=200,color='lV',list={'chiptune'},disp=function()return sfxPack end,code=function(i)sfxPack=i end},
WIDGET.newSelector{name="sfxPack",x=1100,y=330,w=200,color='lV',list=SFXPACKS,disp=function()return sfxPack end,code=function(i)sfxPack=i end},
WIDGET.newButton{name="apply", x=1100,y=400,w=180,h=60,code=function()SETTING.sfxPack=sfxPack SFX.load('media/effect/'..sfxPack..'/')end,hideF=function()return SETTING.sfxPack==sfxPack end},
WIDGET.newSelector{name="vocPack",x=1100,y=470,w=200,color='lV',list={'miya','mono','xiaoya','miku'},disp=function()return vocPack end,code=function(i)vocPack=i end},
WIDGET.newSelector{name="vocPack",x=1100,y=470,w=200,color='lV',list=VOCPACKS,disp=function()return vocPack end,code=function(i)vocPack=i end},
WIDGET.newButton{name="apply", x=1100,y=540,w=180,h=60,code=function()SETTING.vocPack=vocPack VOC.load('media/vocal/'..vocPack..'/')end,hideF=function()return SETTING.vocPack==vocPack end},
WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,font=60,fText=CHAR.icon.back,code=backScene},
}

View File

@@ -1,6 +1,6 @@
local gc,ms=love.graphics,love.mouse
local int,sin=math.floor,math.sin
local VK_org=VK_org
local VK_ORG=VK_ORG
local scene={}
@@ -9,23 +9,23 @@ local snapUnit=1
local selected--Button selected
local function _save1()
FILE.save(VK_org,'conf/vkSave1')
FILE.save(VK_ORG,'conf/vkSave1')
end
local function _load1()
local D=FILE.load('conf/vkSave1')
if D then
TABLE.update(D,VK_org)
TABLE.update(D,VK_ORG)
else
MES.new('error',text.noFile)
end
end
local function _save2()
FILE.save(VK_org,'conf/vkSave2')
FILE.save(VK_ORG,'conf/vkSave2')
end
local function _load2()
local D=FILE.load('conf/vkSave2')
if D then
TABLE.update(D,VK_org)
TABLE.update(D,VK_ORG)
else
MES.new('error',text.noFile)
end
@@ -37,13 +37,13 @@ function scene.sceneInit()
selected=false
end
function scene.sceneBack()
FILE.save(VK_org,'conf/virtualkey')
FILE.save(VK_ORG,'conf/virtualkey')
end
local function _onVK_org(x,y)
local dist,nearest=1e10
for K=1,#VK_org do
local B=VK_org[K]
for K=1,#VK_ORG do
local B=VK_ORG[K]
if B.ava then
local d1=(x-B.x)^2+(y-B.y)^2
if d1<B.r^2 then
@@ -73,13 +73,13 @@ function scene.touchDown(x,y)
end
function scene.touchUp()
if selected then
local B=VK_org[selected]
local B=VK_ORG[selected]
B.x,B.y=int(B.x/snapUnit+.5)*snapUnit,int(B.y/snapUnit+.5)*snapUnit
end
end
function scene.touchMove(_,_,dx,dy)
if selected and not WIDGET.isFocus()then
local B=VK_org[selected]
local B=VK_ORG[selected]
B.x,B.y=B.x+dx,B.y+dy
end
end
@@ -122,11 +122,11 @@ scene.widgetList={
WIDGET.newKey{name="load2", x=805,y=290,w=90,h=70,code=_load2,font=45,fText=CHAR.icon.loadTwo},
WIDGET.newSlider{name="size", x=440,y=370,w=460,unit=19,font=40,show="vkSize",
disp=function()
return VK_org[selected].r/10-1
return VK_ORG[selected].r/10-1
end,
code=function(v)
if selected then
VK_org[selected].r=(v+1)*10
VK_ORG[selected].r=(v+1)*10
end
end,
hideF=function()

View File

@@ -14,8 +14,8 @@ function scene.draw()
end
end
local function _VKAdisp(n)return function()return VK_org[n].ava end end
local function _VKAcode(n)return function()VK_org[n].ava=not VK_org[n].ava end end
local function _VKAdisp(n)return function()return VK_ORG[n].ava end end
local function _VKAcode(n)return function()VK_ORG[n].ava=not VK_ORG[n].ava end end
local function _notShow()return not SETTING.VKSwitch end
local function _notTrack()return not(SETTING.VKSwitch and SETTING.VKTrack)end
@@ -42,8 +42,8 @@ scene.widgetList={
WIDGET.newSwitch{name="b19", x=580, y=560, lim=230,disp=_VKAdisp(19),code=_VKAcode(19)},
WIDGET.newSwitch{name="b20", x=580, y=620, lim=230,disp=_VKAdisp(20),code=_VKAcode(20)},
WIDGET.newButton{name="norm", x=840, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=i<11 end end},
WIDGET.newButton{name="pro", x=1120, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=true end end},
WIDGET.newButton{name="norm", x=840, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_ORG[i].ava=i<11 end end},
WIDGET.newButton{name="pro", x=1120, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_ORG[i].ava=true end end},
WIDGET.newSwitch{name="hide", x=1150, y=200, lim=400, font=40,disp=SETval('VKSwitch'),code=SETrev('VKSwitch')},
WIDGET.newSwitch{name="icon", x=1150, y=300, lim=400, font=40,disp=SETval('VKIcon'),code=SETrev('VKIcon'),hideF=_notShow},
WIDGET.newSlider{name="sfx", x=830, y=380, lim=160,w=400, font=35,change=function()SFX.play('virtualKey',SETTING.VKSFX)end,disp=SETval('VKSFX'),code=SETsto('VKSFX'),hideF=_notShow},

View File

@@ -62,15 +62,6 @@ function scene.keyDown(key)
end
end
local minoChars={
CHAR.mino.Z,
CHAR.mino.S,
CHAR.mino.J,
CHAR.mino.L,
CHAR.mino.T,
CHAR.mino.O,
CHAR.mino.I,
}
local spinChars={
CHAR.icon.num0InSpin,
CHAR.icon.num1InSpin,
@@ -104,10 +95,10 @@ function scene.draw()
end
for x=1,7 do
gc_setColor(minoColor[SETTING.skin[x]])
gc_setColor(BLOCK_COLORS[SETTING.skin[x]])
setFont(70)
mStr(minoChars[x],80*x-40,-70)
mStr(minoChars[x],80*x-40,170)
mStr(BLOCK_CHARS[x],80*x-40,-70)
mStr(BLOCK_CHARS[x],80*x-40,170)
setFont(25)
for y=1,4 do
mStr(A[x][y],80*x-40,-37+40*y)