From 3ed06353b825515a47292aeabc7e6efd8a10d58b Mon Sep 17 00:00:00 2001 From: Bela Mezo Date: Mon, 27 Apr 2026 18:22:41 +0200 Subject: [PATCH 1/2] Drawing both sides of the home screen. --- inc/meta/meta.assets.lua | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/inc/meta/meta.assets.lua b/inc/meta/meta.assets.lua index 51b17a7..4441204 100644 --- a/inc/meta/meta.assets.lua +++ b/inc/meta/meta.assets.lua @@ -509,23 +509,23 @@ -- 255:cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc -- -- --- 000:ffffffffff0010201020102010201020102010201020102000ffffffffff40404040404087f3f3f3f397a7b7c7d7a7e7f70818a7b7c7d7a7b7c7d7a70b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 001:ffffffffff0040404040404040404040404040404040404000ffffffffff40404040404087f3f3f3f328a7384858a76878f388a7384858a7384858a70b40403b4b4040404040404040404040404040404040404040404040400b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 002:ffffffffff00406070408090a040b0c0d0e0f001f001112100ffffffffff984098409840a8f3f3f3f3b8a7a7a7a7a7c8d8e8f8a7a7a7a7a7a7a7a7a70b405b6b7b4040404040404040404040404040d0e0f001f001f00111210b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 003:ffffffffff004031414051617140814091a1b1b1b1b1c1d100ffffffffff984098409840a8f3f3f3f3091919191919293949591919191919191919190b8b9babbb4040cbdbebfb0c401c2c2c2c3c4091a14c5c6c6c6c6cc1d10b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 004:ffffffffffe140f1024012223240814042a15262728292a2e1ffffffffff984098409840a8f3f3f3f369f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f37c8c9cacbc7282ccdcecfc0d401d3030302d4042a13d4d7282728292a27c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 005:ffffffffffb240c2d240e2f203132333435363738393a3b3b2ffffffffff984098409840a8f3f3f3f369f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f35d406d7d40e3958d9dadbdcd40ddedfded0e404353839383938393a3b35d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 006:ffffffffffe1c3d3c3d3e3f30414c3d32434445410201020e1ffffffffff404040404040798989898999a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a97c1e1e1e1e44542e1e1e1e3e1e444e4e4e541e243444544454445444547c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 007:ffffffffffb264748494a4b4c4d46494649464940040e4f4b2ffffffffff4040404040404040404040404040404040404040404040404040404040405d1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 008:ffffffffffe1c30515d325d33545c3d355d3c3d365b17585e1ffffffffff4040404040404098989898404040404040404040404040404040404040407c1e7e8e1e1e1e9eae1ebe1e1e1e1e1e1e1e1e72821ebe1e72821ebe1e7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 009:ffffffffffb264e395a5b594e39564c5d5946494e5b1b1f5b2ffffffffff4040404040404040404040404040404040404040404040404040404040405d1e05151ebe1ecedeeefe1e1e1e1e1e1e1e1ee395eefe1ee395eefe1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 010:ffffffffffe1c306162636d34656c3e3d5d3c3d376b1b1b1e1ffffffffff404040404040409898989840b9c9c9d9e9f90a0a0a0a4040400a0a0a0a407c1ee395eefe1e0f1f2f3f1e1e1e1e1e1e1e1ee3952f3f1ee3952f3f1e7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 011:ffffffffffb264946494649464948696a694649410201020b2ffffffffff4040404040404040404040401a2a3a4a5a6a7a40404040404040404040405d1ee3952f3f1e4f5f1ebe1e1e1e1e1e1e1e1ee3951ebe1ee3951ebe1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 012:ffffffffffe1c37282d3c3d3c3d3b6c6d6d3c3d300e6f607e1ffffffffff4040404040404098989898408a9aaabaca9ada40404040404040404040407c1e4f5f1ebe1e0515eefe1e1e1e1e1e1e1e1ee395eefe1ee395eefe1e7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 013:ffffffffffb264e395946494649464946494649465172737b2ffffffffffeaeaeaeaeaeaeafafafafaeaeaeaeaeaeaeaeaeaeaeaeaeaeaeaeaeaeaea5d1e0515eefe1e6f7f2f3f1e1e1e1e1e1e1e1e6f7f2f3f1e6f7f2f3f1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 014:ffffffffffe1c34454d3c3d3c3d3c3d3c3d3c3d3e5b14757e1fffffffffff3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f37c1e6f7f2f3f1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 015:ffffffffffb2649464946494649464946494649476b1b1b1b2fffffffffff3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f35d1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 --- 016:ffffffffff0010201020766777001020102010201020102000fffffffffff3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f30b1b2b1b2b7667776777761b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 000:20102010200010201020102010201020102010201020102000102010201040404040404087f3f3f3f397a7b7c7d7a7e7f70818a7b7c7d7a7b7c7d7a70b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 001:40404040400040404040404040404040404040404040404000404040404040404040404087f3f3f3f328a7384858a76878f388a7384858a7384858a70b40403b4b4040404040404040404040404040404040404040404040400b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 002:408090a04000406070408090a040b0c0d0e0f001f001112100408090a040984098409840a8f3f3f3f3b8a7a7a7a7a7c8d8e8f8a7a7a7a7a7a7a7a7a70b405b6b7b4040404040404040404040404040d0e0f001f001f00111210b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 003:4051617140004031414051617140814091a1b1b1b1b1c1d1004051617140984098409840a8f3f3f3f3091919191919293949591919191919191919190b8b9babbb4040cbdbebfb0c401c2c2c2c3c4091a14c5c6c6c6c6cc1d10b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 004:4012223240e140f1024012223240814042a15262728292a2e14012223240984098409840a8f3f3f3f369f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f37c8c9cacbc7282ccdcecfc0d401d3030302d4042a13d4d7282728292a27c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 005:4040404040b240c2d240e2f203132333435363738393a3b3b24040404040984098409840a8f3f3f3f369f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f35d406d7d40e3958d9dadbdcd40ddedfded0e404353839383938393a3b35d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 006:d3c3d3c3d3e1c3d3c3d3e3f30414c3d32434445410201020e1c3d3c3d3c3404040404040798989898999a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a9a97c1e1e1e1e44542e1e1e1e3e1e444e4e4e541e243444544454445444547c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 007:9464354594b264748494a4b4c4d46494649464940040e4f4b264354594644040404040404040404040404040404040404040404040404040404040405d1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 008:d3c3e395d3e1c30515d325d33545c3d355d3c3d365b17585e1c3e395d3254040404040404098989898404040404040404040404040404040404040407c1e7e8e1e1e1e9eae1ebe1e1e1e1e1e1e1e1e72821ebe1e72821ebe1e7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 009:9464465694b264e395a5b594e39564c5d5946494e5b1b1f5b264e395a5b54040404040404040404040404040404040404040404040404040404040405d1e05151ebe1ecedeeefe1e1e1e1e1e1e1e1ee395eefe1ee395eefe1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 010:d3c3d3c3d3e1c306162636d34656c3e3d5d3c3d376b1b1b1e1c3e3952636404040404040409898989840b9c9c9d9e9f90a0a0a0a4040400a0a0a0a407c1ee395eefe1e0f1f2f3f1e1e1e1e1e1e1e1ee3952f3f1ee3952f3f1e7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 011:9464946494b264946494649464948696a694649410201020b264e395d3254040404040404040404040401a2a3a4a5a6a7a40404040404040404040405d1ee3952f3f1e4f5f1ebe1e1e1e1e1e1e1e1ee3951ebe1ee3951ebe1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 012:d3c37282d3e1c37282d3c3d3c3d3b6c6d6d3c3d300e6f607e1c3e395a5b54040404040404098989898408a9aaabaca9ada40404040404040404040407c1e4f5f1ebe1e0515eefe1e1e1e1e1e1e1e1ee395eefe1ee395eefe1e7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 013:9464e39594b264e395946494649464946494649465172737b26406162636eaeaeaeaeaeaeafafafafaeaeaeaeaeaeaeaeaeaeaeaeaeaeaeaeaeaeaea5d1e0515eefe1e6f7f2f3f1e1e1e1e1e1e1e1e6f7f2f3f1e6f7f2f3f1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 014:d3c34454d3e1c34454d3c3d3c3d3c3d3c3d3c3d3e5b14757e1c3d3c3d3c3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f37c1e6f7f2f3f1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e7c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 015:9464946494b2649464946494649464946494649476b1b1b1b26494649464f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f35d1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e1e5d000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 +-- 016:201020102000102010207667770010201020102010201020001020102010f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f3f30b1b2b1b2b7667776777761b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b1b2b0b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -- -- -- 016:00000000000000400040004000700070007000400040004000700070007000c000c000c000c000c000c000c000c000c000c000c000c000c000c000c0470000000000 From 4ba02c894c9bfdc8d1a3475a9745cb0241c3ac7b Mon Sep 17 00:00:00 2001 From: Zsolt Tasnadi Date: Mon, 27 Apr 2026 21:22:38 +0200 Subject: [PATCH 2/2] credit window --- .luacheckrc | 1 + impostor.inc | 1 + inc/window/window.credits.lua | 197 +++++++++++++++++++++++++++++++++ inc/window/window.menu.lua | 8 ++ inc/window/window.register.lua | 3 + 5 files changed, 210 insertions(+) create mode 100644 inc/window/window.credits.lua diff --git a/.luacheckrc b/.luacheckrc index c8dfabd..4dd86b6 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -24,6 +24,7 @@ globals = { "Minigame", "Window", "ContinuedWindow", + "CreditsWindow", "TTGIntroWindow", "BriefIntroWindow", "TitleIntroWindow", diff --git a/impostor.inc b/impostor.inc index 4f7d075..d7c4457 100644 --- a/impostor.inc +++ b/impostor.inc @@ -79,6 +79,7 @@ window/window.minigame.rhythm.lua window/window.minigame.ddr.lua window/window.discussion.lua window/window.continued.lua +window/window.credits.lua window/window.game.lua system/system.main.lua meta/meta.assets.lua diff --git a/inc/window/window.credits.lua b/inc/window/window.credits.lua new file mode 100644 index 0000000..174dbd8 --- /dev/null +++ b/inc/window/window.credits.lua @@ -0,0 +1,197 @@ +--- @section CreditsWindow + +local _time = 0.0 +local _scroll_x = 0.0 +local _scroll_total_w = 0 +local _scroll_chars = {} +local _title_chars = {} +local _title_total_w = 0 +local _stars = {} + +local TITLE = "TELETYPE GAMES" + +local SCROLL_PARTS = { + "WEB: GAMES.TELETYPE.HU", + "BBS: GAMES.TELETYPE.HU:2323", + "IRC: LIBERA.CHAT #TELETYPEGAMES", + "YOUTUBE.COM/@TELETYPEGAMES", +} + +local SCROLL_SEP = " * " + +local SCROLL_SPEED = 55.0 +local SCROLL_Y = 129 +local SCROLL_ZONE_COLS = { 7, 4, 9 } + +local TITLE_Y = 4 +local TITLE_FALL_DUR = 0.45 +local TITLE_DELAY_STEP = 0.18 + +local RASTER_COLS = { 1, 3, 9, 10, 11, 4, 11, 10, 9, 3, 1 } +local RASTER_Y_TOP = 26 +local RASTER_Y_BOT = 110 + +local AUTHORS = { + "Mr. Zero - Zsolt Tasnadi", + "Mr. One - Balazs Tari", + "Mr. Two - Zoltan Timar", + "Mr. Three - Bela Mezo", +} +local AUTHORS_BASE_Y = 56 +local AUTHORS_LINE_H = 12 +local AUTHORS_ENTRY_DT = 0.65 +local AUTHORS_ENTRY_V = 2.5 + +local RAINBOW = { 4, 9, 3, 7, 13, 2, 9, 4 } +local NUM_STARS = 40 + +--- Initialises credits state and pre-computes character metrics. +--- @within CreditsWindow +function CreditsWindow.init() + _time = 0.0 + _scroll_x = Config.screen.width + 4.0 + + _title_chars = {} + _title_total_w = 0 + for i = 1, #TITLE do + local ch = TITLE:sub(i, i) + local w = print(ch, 0, -100, 0, false, 2) + _title_chars[i] = { ch = ch, ox = _title_total_w, w = w } + _title_total_w = _title_total_w + w + end + + _scroll_chars = {} + _scroll_total_w = 0 + local function append_str(str, col) + for i = 1, #str do + local ch = str:sub(i, i) + local w = print(ch, 0, -100, 0, false, 1) + _scroll_chars[#_scroll_chars + 1] = { ch = ch, ox = _scroll_total_w, w = w, col = col } + _scroll_total_w = _scroll_total_w + w + end + end + for _, part in ipairs(SCROLL_PARTS) do + append_str(part, RAINBOW[math.random(#RAINBOW)]) + append_str(SCROLL_SEP, Config.colors.white) + end + + _stars = {} + for i = 1, NUM_STARS do + _stars[i] = { + x = math.random(0, Config.screen.width - 1) + 0.0, + y = math.random(0, Config.screen.height - 1), + spd = (i % 3 + 1) * 10.0, + col = ({ 1, 2, 4, 4 })[(i % 4) + 1], + } + end +end + +local function draw_stars() + for _, s in ipairs(_stars) do + pix(math.floor(s.x), s.y, s.col) + end +end + +local function draw_rasters() + local cy = RASTER_Y_TOP + math.floor(math.sin(_time * 1.3) * 6) + for i, col in ipairs(RASTER_COLS) do + local y = cy + i - 1 + if y >= 0 and y < Config.screen.height then + line(0, y, Config.screen.width - 1, y, col) + end + end + local cy2 = RASTER_Y_BOT + math.floor(math.sin(_time * 1.7 + 1.5) * 5) + for i, col in ipairs(RASTER_COLS) do + local y = cy2 + i - 1 + if y >= 0 and y < Config.screen.height then + line(0, y, Config.screen.width - 1, y, col) + end + end +end + +local function bounce_out(p) + local n1, d1 = 7.5625, 2.75 + if p < 1 / d1 then + return n1 * p * p + elseif p < 2 / d1 then + p = p - 1.5 / d1; return n1 * p * p + 0.75 + elseif p < 2.5 / d1 then + p = p - 2.25 / d1; return n1 * p * p + 0.9375 + else + p = p - 2.625 / d1; return n1 * p * p + 0.984375 + end +end + +local function draw_title() + local sx = math.floor((Config.screen.width - _title_total_w) / 2) + local n = #_title_chars + local max_dist = (n - 1) / 2.0 + for i, tc in ipairs(_title_chars) do + local dist = math.abs(i - (n + 1) / 2.0) + local delay = (max_dist - dist) * TITLE_DELAY_STEP + local t = math.max(0, _time - delay) + local p = math.min(1, t / TITLE_FALL_DUR) + local y = math.floor(-14 + bounce_out(p) * (TITLE_Y + 14)) + print(tc.ch, sx + tc.ox + 1, y + 1, 0, false, 2) + print(tc.ch, sx + tc.ox, y, Config.colors.light_blue, false, 2) + end +end + +local function draw_authors() + local col = Config.colors.light_blue + for i, lbl in ipairs(AUTHORS) do + local enter_t = math.max(0, _time - (i - 1) * AUTHORS_ENTRY_DT) + local slide = math.max(0, 1 - enter_t * AUTHORS_ENTRY_V) + local x_off = math.floor(slide * (Config.screen.width + 40)) + local yo = (slide < 0.01) and math.floor(math.sin(_time * 2.0 + i * 1.1) * 2) or 0 + Print.text(lbl, 12 + x_off, AUTHORS_BASE_Y + (i - 1) * AUTHORS_LINE_H + yo, col) + end +end + +local function draw_scroller() + local third = Config.screen.width / 3 + for pass = 0, 1 do + local base = _scroll_x + pass * _scroll_total_w + for _, sc in ipairs(_scroll_chars) do + local x = math.floor(base + sc.ox) + if x >= Config.screen.width then break end + if x + sc.w > 0 then + local zone = math.max(1, math.min(3, math.floor(x / third) + 1)) + print(sc.ch, x, SCROLL_Y, SCROLL_ZONE_COLS[zone], false, 1) + end + end + end +end + +--- Draws the credits window. +--- @within CreditsWindow +function CreditsWindow.draw() + cls(Config.colors.black) + draw_stars() + draw_rasters() + draw_title() + Print.text_center("Authors", Config.screen.width / 2, 47, Config.colors.light_grey) + draw_authors() + draw_scroller() + +end + +--- Updates credits window logic. +--- @within CreditsWindow +function CreditsWindow.update() + _time = _time + Context.delta_time + + for _, s in ipairs(_stars) do + s.x = s.x + s.spd * Context.delta_time + if s.x >= Config.screen.width then s.x = s.x - Config.screen.width end + end + + _scroll_x = _scroll_x - SCROLL_SPEED * Context.delta_time + if _scroll_x <= -_scroll_total_w then + _scroll_x = _scroll_x + _scroll_total_w + end + + if Input.back() or Input.select() then + Window.set_current("menu") + end +end diff --git a/inc/window/window.menu.lua b/inc/window/window.menu.lua index ad33971..ce45395 100644 --- a/inc/window/window.menu.lua +++ b/inc/window/window.menu.lua @@ -139,6 +139,13 @@ function MenuWindow.controls() Window.set_current("controls") end +--- Opens the credits screen. +--- @within MenuWindow +function MenuWindow.credits() + CreditsWindow.init() + Window.set_current("credits") +end + --- Opens the audio test menu. --- @within MenuWindow function MenuWindow.audio_test() @@ -173,6 +180,7 @@ function MenuWindow.refresh_menu_items() table.insert(_menu_items, {label = "New Game", decision = MenuWindow.new_game}) table.insert(_menu_items, {label = "Load Game", decision = MenuWindow.load_game}) table.insert(_menu_items, {label = "Controls", decision = MenuWindow.controls}) + table.insert(_menu_items, {label = "Credits", decision = MenuWindow.credits}) if Context.test_mode then table.insert(_menu_items, {label = "Audio Test", decision = MenuWindow.audio_test}) diff --git a/inc/window/window.register.lua b/inc/window/window.register.lua index a3388ac..a65b691 100644 --- a/inc/window/window.register.lua +++ b/inc/window/window.register.lua @@ -39,3 +39,6 @@ Window.register("discussion", DiscussionWindow) ContinuedWindow = {} Window.register("continued", ContinuedWindow) + +CreditsWindow = {} +Window.register("credits", CreditsWindow)