From e917ee299a8a4a715fd5600128016346f79398c5 Mon Sep 17 00:00:00 2001 From: Not-A-Normal-Robot Date: Tue, 5 Sep 2023 16:57:42 +0700 Subject: [PATCH 1/2] Add toggleable infinite height in Infinite mode --- parts/eventsets/infinite.lua | 37 ++++++++++++++++++++++++++++++++++ parts/language/lang_en.lua | 3 +++ parts/language/lang_es.lua | 3 +++ parts/language/lang_fr.lua | 3 +++ parts/language/lang_id.lua | 3 +++ parts/language/lang_ja.lua | 3 +++ parts/language/lang_pt.lua | 3 +++ parts/language/lang_symbol.lua | 6 +++++- parts/modes/infinite.lua | 8 +------- 9 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 parts/eventsets/infinite.lua diff --git a/parts/eventsets/infinite.lua b/parts/eventsets/infinite.lua new file mode 100644 index 000000000..53ce75ffc --- /dev/null +++ b/parts/eventsets/infinite.lua @@ -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(26) + 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 +} \ No newline at end of file diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index ad074817c..b005d627c 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -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", diff --git a/parts/language/lang_es.lua b/parts/language/lang_es.lua index 18da43d9e..dba29ac88 100644 --- a/parts/language/lang_es.lua +++ b/parts/language/lang_es.lua @@ -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", diff --git a/parts/language/lang_fr.lua b/parts/language/lang_fr.lua index 354329ad0..482bfbe02 100644 --- a/parts/language/lang_fr.lua +++ b/parts/language/lang_fr.lua @@ -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é", diff --git a/parts/language/lang_id.lua b/parts/language/lang_id.lua index 95298783a..5706eb01f 100644 --- a/parts/language/lang_id.lua +++ b/parts/language/lang_id.lua @@ -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", diff --git a/parts/language/lang_ja.lua b/parts/language/lang_ja.lua index 153b01731..d4edae45f 100644 --- a/parts/language/lang_ja.lua +++ b/parts/language/lang_ja.lua @@ -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="効率", diff --git a/parts/language/lang_pt.lua b/parts/language/lang_pt.lua index c0614db64..a5d010ab2 100644 --- a/parts/language/lang_pt.lua +++ b/parts/language/lang_pt.lua @@ -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", diff --git a/parts/language/lang_symbol.lua b/parts/language/lang_symbol.lua index b9b33dcc0..e32406e66 100644 --- a/parts/language/lang_symbol.lua +++ b/parts/language/lang_symbol.lua @@ -1,3 +1,4 @@ +local x,v=CHAR.icon.crossMark,CHAR.icon.checkMark return { fallback='en', loadText={ @@ -38,6 +39,9 @@ return { maxspeed="!!!", speedup="~!~", missionFailed="-X_X-", + infHeightOn="∞↑ "..v, + infHeightOff="∞↑ "..x, + infHeightHint=v.."/"..x..": F₁", win=": )", lose=": (", @@ -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", diff --git a/parts/modes/infinite.lua b/parts/modes/infinite.lua index aabeca896..989850ad3 100644 --- a/parts/modes/infinite.lua +++ b/parts/modes/infinite.lua @@ -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' }, } From 8f7ce3b25785832c052d9e91eacaebcffec18009 Mon Sep 17 00:00:00 2001 From: NOT_A_ROBOT Date: Tue, 5 Sep 2023 17:59:21 +0700 Subject: [PATCH 2/2] Use font size 25 for infinite mode --- parts/eventsets/infinite.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parts/eventsets/infinite.lua b/parts/eventsets/infinite.lua index 53ce75ffc..7e73bfc75 100644 --- a/parts/eventsets/infinite.lua +++ b/parts/eventsets/infinite.lua @@ -8,7 +8,7 @@ return { 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(26) + setFont(25) GC.setColor(1,1,1,opacity) GC.mStr(P.modeData.infHeight and text.infHeightOn or text.infHeightOff,300,80) setFont(20) @@ -34,4 +34,4 @@ return { if env.fieldH==20 then return end env.fieldH=math.max(20,math.min(env.fieldH,heightTarget)) end -} \ No newline at end of file +}