Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added score counter for Classic modes that reflects the NES game's score system #644

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions parts/eventsets/classic_e.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local gc_setColor=love.graphics.setColor
local gc=love.graphics
local gc_setColor=gc.setColor
return{
das=16,arr=6,
sddas=6,sdarr=6,
Expand All @@ -14,6 +15,25 @@ return{
noTele=true,
keyCancel={5,6},
mesDisp=function(P)
gc.setLineWidth(2)
gc_setColor(.98,.98,.98,.8)
gc.rectangle('line',-100,0,200,100,4)
gc_setColor(.98,.98,.98,.4)
gc.rectangle('fill',-100+2,0+2,200-4,100-4,2)
gc_setColor(1,1,1,1)
setFont(40)
mStr("Score",0,0)
gc_setColor(.6,.6,.6,1)
local score_str=""
local score_length=math.floor(math.log10(P.modeData.gameScore))
for i=7,0,-1 do
score_str=score_str..(math.floor(P.modeData.gameScore/(math.pow(10,i)))%10)
end
for i=1,8 do
if score_length==-i+8 then gc_setColor(1,1,1,1) end
mStr(string.sub(score_str,i,i),25*i-113,50)
end
gc_setColor(1,1,1,1)
setFont(75)
local r=P.modeData.target/10
mStr(r<10 and 9 or r<30 and r or("%02x"):format(r*10-300),63,210)
Expand All @@ -33,6 +53,7 @@ return{
end,
task=function(P)
P.modeData.target=10
P.modeData.gameScore=0
end,
hook_drop=function(P)
local D=P.modeData
Expand All @@ -52,11 +73,17 @@ return{
SFX.play('warn_2',.7)
elseif D.target==200 then
P:win('finish')
return
else
SFX.play('reach')
end
D.target=D.target+10
D.target=D.target>=200 and 200 or D.target+10
local r=D.target/10
local l=#P.clearedRow
P.modeData.gameScore=P.modeData.gameScore+((l==1 and 40 or l==2 and 100 or l==3 and 300 or 1200)*((r<10 and 9 or r<30 and r)+1))
elseif #P.clearedRow>0 then
local r=D.target/10
local l=#P.clearedRow
P.modeData.gameScore=P.modeData.gameScore+((l==1 and 40 or l==2 and 100 or l==3 and 300 or 1200)*((r<10 and 9 or r<30 and r)+1))
end
end,
}
33 changes: 30 additions & 3 deletions parts/eventsets/classic_h.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local gc_setColor=love.graphics.setColor
local gc=love.graphics
local gc_setColor=gc.setColor
return{
das=16,arr=6,
sddas=3,sdarr=3,
Expand All @@ -14,6 +15,25 @@ return{
noTele=true,
keyCancel={5,6},
mesDisp=function(P)
gc.setLineWidth(2)
gc_setColor(.98,.98,.98,.8)
gc.rectangle('line',-100,0,200,100,4)
gc_setColor(.98,.98,.98,.4)
gc.rectangle('fill',-100+2,0+2,200-4,100-4,2)
gc_setColor(1,1,1,1)
setFont(40)
mStr("Score",0,0)
gc_setColor(.6,.6,.6,1)
local score_str=""
local score_length=math.floor(math.log10(P.modeData.gameScore))
for i=7,0,-1 do
score_str=score_str..(math.floor(P.modeData.gameScore/(math.pow(10,i)))%10)
end
for i=1,8 do
if score_length==-i+8 then gc_setColor(1,1,1,1) end
mStr(string.sub(score_str,i,i),25*i-113,50)
end
gc_setColor(1,1,1,1)
setFont(75)
local r=P.modeData.target/10
mStr(r<11 and 18 or r<22 and r+8 or("%02x"):format(r*10-220),63,210)
Expand All @@ -33,6 +53,7 @@ return{
end,
task=function(P)
P.modeData.target=10
P.modeData.gameScore=0
end,
hook_drop=function(P)
local D=P.modeData
Expand All @@ -44,11 +65,17 @@ return{
SFX.play('warn_1')
elseif D.target==200 then
P:win('finish')
return
else
SFX.play('reach')
end
D.target=D.target+10
D.target=D.target>=200 and 200 or D.target+10
local r=D.target/10
local l=#P.clearedRow
P.modeData.gameScore=P.modeData.gameScore+((l==1 and 40 or l==2 and 100 or l==3 and 300 or 1200)*((r<11 and 18 or r<22 and r+8)+1))
elseif #P.clearedRow>0 then
local r=D.target/10
local l=#P.clearedRow
P.modeData.gameScore=P.modeData.gameScore+((l==1 and 40 or l==2 and 100 or l==3 and 300 or 1200)*((r<11 and 18 or r<22 and r+8)+1))
end
end,
}
42 changes: 36 additions & 6 deletions parts/eventsets/classic_l.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
local gc_setColor=love.graphics.setColor
local gc=love.graphics
local gc_setColor=gc.setColor
return{
das=16,arr=6,
sddas=2,sdarr=2,
irs=false,ims=false,
drop=2,
lock=2,
wait=10,
fall=25,
drop=2,lock=2,
wait=10,fall=25,
freshLimit=0,
fieldH=19,
nextCount=1,holdCount=0,
nextCount=1,
holdCount=0,
RS='Classic',
sequence='rnd',
noTele=true,
keyCancel={5,6},
mesDisp=function(P)
gc.setLineWidth(2)
gc_setColor(.98,.98,.98,.8)
gc.rectangle('line',-100,0,200,100,4)
gc_setColor(.98,.98,.98,.4)
gc.rectangle('fill',-100+2,0+2,200-4,100-4,2)
gc_setColor(1,1,1,1)
setFont(40)
mStr("Score",0,0)
gc_setColor(.6,.6,.6,1)
local score_str=""
local score_length=math.floor(math.log10(P.modeData.gameScore))
for i=7,0,-1 do
score_str=score_str..(math.floor(P.modeData.gameScore/(math.pow(10,i)))%10)
end
for i=1,8 do
if score_length==-i+8 then gc_setColor(1,1,1,1) end
mStr(string.sub(score_str,i,i),25*i-113,50)
end
gc_setColor(1,1,1,1)
setFont(75)
local r=P.modeData.target/10
mStr(r<11 and 19 or r<22 and r+9 or("%02x"):format(r*10-220),63,210)
Expand All @@ -34,6 +53,7 @@ return{
end,
task=function(P)
P.modeData.target=10
P.modeData.gameScore=0
end,
hook_drop=function(P)
local D=P.modeData
Expand All @@ -43,9 +63,19 @@ return{
if D.target==200 then
P.gameEnv.drop,P.gameEnv.lock=1,1
SFX.play('blip_1')
elseif D.target==300 then
P:win('finish')
else
SFX.play('reach')
end
D.target=D.target>=300 and 300 or D.target+10
local r=D.target/10
local l=#P.clearedRow
P.modeData.gameScore=P.modeData.gameScore+((l==1 and 40 or l==2 and 100 or l==3 and 300 or 1200)*((r<11 and 19 or r<22 and r+9)+1))
elseif #P.clearedRow>0 then
local r=D.target/10
local l=#P.clearedRow
P.modeData.gameScore=P.modeData.gameScore+((l==1 and 40 or l==2 and 100 or l==3 and 300 or 1200)*((r<11 and 19 or r<22 and r+9)+1))
end
end,
}
32 changes: 30 additions & 2 deletions parts/eventsets/classic_u.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
local gc_setColor=love.graphics.setColor
local gc=love.graphics
local gc_setColor=gc.setColor
return{
das=16,arr=6,
sddas=1,sdarr=1,
Expand All @@ -14,6 +15,25 @@ return{
noTele=true,
keyCancel={5,6},
mesDisp=function(P)
gc.setLineWidth(2)
gc_setColor(.98,.98,.98,.8)
gc.rectangle('line',-100,0,200,100,4)
gc_setColor(.98,.98,.98,.4)
gc.rectangle('fill',-100+2,0+2,200-4,100-4,2)
gc_setColor(1,1,1,1)
setFont(40)
mStr("Score",0,0)
gc_setColor(.6,.6,.6,1)
local score_str=""
local score_length=math.floor(math.log10(P.modeData.gameScore))
for i=7,0,-1 do
score_str=score_str..(math.floor(P.modeData.gameScore/(math.pow(10,i)))%10)
end
for i=1,8 do
if score_length==-i+8 then gc_setColor(1,1,1,1) end
mStr(string.sub(score_str,i,i),25*i-113,50)
end
gc_setColor(1,1,1,1)
setFont(75)
local r=P.modeData.target/10
mStr(r==1 and 29 or("%02x"):format(r*10-20),63,210)
Expand All @@ -33,17 +53,25 @@ return{
end,
task=function(P)
P.modeData.target=10
P.modeData.gameScore=0
end,
hook_drop=function(P)
local D=P.modeData
D.drought=P.lastPiece.id==7 and 0 or D.drought+1
if P.stat.row>=D.target then
if D.target==100 then
P:win('finish')
return
end
D.target=D.target+10
SFX.play('reach')
D.target=D.target>=100 and 100 or D.target+10
local r=D.target/10
local l=#P.clearedRow
P.modeData.gameScore=P.modeData.gameScore+((l==1 and 40 or l==2 and 100 or l==3 and 300 or 1200)*(r+30))
elseif #P.clearedRow>0 then
local r=D.target/10
local l=#P.clearedRow
P.modeData.gameScore=P.modeData.gameScore+((l==1 and 40 or l==2 and 100 or l==3 and 300 or 1200)*(r+30))
end
end,
}
2 changes: 1 addition & 1 deletion parts/modes/classic_e.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ return{
bg='rgb',bgm='1980s',
},
slowMark=true,
score=function(P)return{P.stat.score,P.stat.row}end,
score=function(P)return{P.modeData.gameScore,P.stat.row}end,
scoreDisp=function(D)return D[1].." "..D[2].." Lines"end,
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
getRank=function(P)
Expand Down
2 changes: 1 addition & 1 deletion parts/modes/classic_h.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ return{
bg='rgb',bgm='1980s',
},
slowMark=true,
score=function(P)return{P.stat.score,P.stat.row}end,
score=function(P)return{P.modeData.gameScore,P.stat.row}end,
scoreDisp=function(D)return D[1].." "..D[2].." Lines"end,
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
getRank=function(P)
Expand Down
2 changes: 1 addition & 1 deletion parts/modes/classic_l.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ return{
bg='rgb',bgm='1980s',
},
slowMark=true,
score=function(P)return{P.stat.score,P.stat.row}end,
score=function(P)return{P.modeData.gameScore,P.stat.row}end,
scoreDisp=function(D)return D[1].." "..D[2].." Lines"end,
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
getRank=function(P)
Expand Down
2 changes: 1 addition & 1 deletion parts/modes/classic_u.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ return{
bg='rgb',bgm='1980s',
},
slowMark=true,
score=function(P)return{P.stat.score,P.stat.row}end,
score=function(P)return{P.modeData.gameScore,P.stat.row}end,
scoreDisp=function(D)return D[1].." "..D[2].." Lines"end,
comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]<b[2]end,
getRank=function(P)
Expand Down