Skip to content

Commit

Permalink
Add toggleable infinite height in Infinite mode (#961)
Browse files Browse the repository at this point in the history
* Add toggleable infinite height in Infinite mode

* Use font size 25 for infinite mode
  • Loading branch information
Not-A-Normal-Robot authored Sep 7, 2023
1 parent e152e14 commit 3aa60d3
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 8 deletions.
37 changes: 37 additions & 0 deletions parts/eventsets/infinite.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
return {
mesDisp=function(P)
setFont(45)
GC.mStr(("%d"):format(P.stat.atk),63,190)
GC.mStr(("%.2f"):format(P.stat.atk/P.stat.row),63,310)
mText(TEXTOBJ.atk,63,243)
mText(TEXTOBJ.eff,63,363)

local opacity=math.max(.4,MATH.expApproach(1,.36,2*(P.stat.time-P.modeData.lastChange)))
if #P.field>15 then opacity=opacity*.7 end
setFont(25)
GC.setColor(1,1,1,opacity)
GC.mStr(P.modeData.infHeight and text.infHeightOn or text.infHeightOff,300,80)
setFont(20)
GC.mStr(text.infHeightHint,300,120)
end,
task=function(P)
P.modeData.infHeight=false
P.modeData.lastChange=0
end,
fkey1=function(P)
P.modeData.infHeight=not P.modeData.infHeight
P.modeData.lastChange=P.stat.time
end,
hook_drop=function(P)
local heightTarget=P.field and #P.field+8 or 20
local env=P.gameEnv
if P.modeData.infHeight then
env.fieldH=math.max(env.fieldH,heightTarget)
return
end

-- if not infHeight, then only decrease height
if env.fieldH==20 then return end
env.fieldH=math.max(20,math.min(env.fieldH,heightTarget))
end
}
3 changes: 3 additions & 0 deletions parts/language/lang_en.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ return {
maxspeed="MAX SPEED!",
speedup="Speed Up!",
missionFailed="Wrong Clear",
infHeightOn="Infinite Height ON",
infHeightOff="Infinite Height OFF",
infHeightHint="Toggle with Function 1 key",

speedLV="Speed Level",
piece="Piece",line="Lines",atk="Attack",eff="Efficiency",
Expand Down
3 changes: 3 additions & 0 deletions parts/language/lang_es.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ return {
maxspeed="¡Máx. Velocidad!",
speedup="¡Más rápido!",
missionFailed="Misión Fallida",
-- infHeightOn="Infinite Height ON",
-- infHeightOff="Infinite Height OFF",
-- infHeightHint="Toggle with Function 1 key",

speedLV="Veloc. de juego",
piece="Piezas",line="Líneas",atk="Ataque",eff="Eficiencia",
Expand Down
3 changes: 3 additions & 0 deletions parts/language/lang_fr.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ return {
maxspeed="Vitesse maximale !",
speedup="Accélérez !",
missionFailed="Mission échouée",
-- infHeightOn="Infinite Height ON",
-- infHeightOff="Infinite Height OFF",
-- infHeightHint="Toggle with Function 1 key",

speedLV="niveau de vitesse",
piece="Pièce",line="Lignes",atk="Attaque",eff="Efficacité",
Expand Down
3 changes: 3 additions & 0 deletions parts/language/lang_id.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ return {
maxspeed="KECEPATAN MAXIMUM!",
speedup="Percepatkan!",
missionFailed="Salah",
infHeightOn="Ketinggian Tak Terhingga ON",
infHeightOff="Ketinggian Tak Terhingga OFF",
infHeightHint="Ubah dengan tombol Fungsi 1",

speedLV="Kecptn lvl",
piece="Blok",line="Baris",atk="Baris Terkirim",eff="Efisiensi",
Expand Down
3 changes: 3 additions & 0 deletions parts/language/lang_ja.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ return {
maxspeed="最高速度!",
speedup="スピードアップ!",
missionFailed="ミッション失敗",
-- infHeightOn="Infinite Height ON",
-- infHeightOff="Infinite Height OFF",
-- infHeightHint="Toggle with Function 1 key",

speedLV="レベル",
piece="ミノ数",line="line数",atk="火力",eff="効率",
Expand Down
3 changes: 3 additions & 0 deletions parts/language/lang_pt.lua
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ return {
maxspeed="Velocidade máxima!",
speedup="Mais rápido!",
missionFailed="Missão falha",
-- infHeightOn="Infinite Height ON",
-- infHeightOff="Infinite Height OFF",
-- infHeightHint="Toggle with Function 1 key",

speedLV="Nível de velocidade",
piece="Peça",line="Linhas",atk="Ataque",eff="Eficiência",
Expand Down
6 changes: 5 additions & 1 deletion parts/language/lang_symbol.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
local x,v=CHAR.icon.crossMark,CHAR.icon.checkMark
return {
fallback='en',
loadText={
Expand Down Expand Up @@ -38,6 +39,9 @@ return {
maxspeed="!!!",
speedup="~!~",
missionFailed="-X_X-",
infHeightOn="∞↑ "..v,
infHeightOff="∞↑ "..x,
infHeightHint=v.."/"..x..": F₁",

win=": )",
lose=": (",
Expand All @@ -61,7 +65,7 @@ return {

loadError_errorMode="'$1' ↑x!: no load mode '$2'",
loadError_read="'$1' ↑x!: read failed",
loadError_noFile="'$1' ↑oading failed no file:",
loadError_noFile="'$1' loading failed no file:",
loadError_other="'$1' ↑x!: $2",
loadError_unknown="'$1' ↑x!: unknown reason",

Expand Down
8 changes: 1 addition & 7 deletions parts/modes/infinite.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,7 @@ return {
env={
drop=1e99,lock=1e99,
infHold=true,
mesDisp=function(P)
setFont(45)
GC.mStr(("%d"):format(P.stat.atk),63,190)
GC.mStr(("%.2f"):format(P.stat.atk/P.stat.row),63,310)
mText(TEXTOBJ.atk,63,243)
mText(TEXTOBJ.eff,63,363)
end,
bg='blockfall',bgm='infinite',
eventSet='infinite'
},
}

0 comments on commit 3aa60d3

Please sign in to comment.