obsd: tetris, songs, MC puff icon

This commit is contained in:
dongdigua 2023-02-18 20:58:53 +08:00
parent fd7bbba5ae
commit 982919bbd6
10 changed files with 109 additions and 7 deletions

View File

@ -36,7 +36,7 @@ jobs:
make clean
make
cd ..
./patches/gmi.sh
./patches/txt.sh
- name: Setup Pages
uses: actions/configure-pages@v2

View File

@ -0,0 +1,81 @@
diff --git a/tetris.c b/tetris.c
index 59b6173..84352f5 100644
--- a/tetris.c
+++ b/tetris.c
@@ -53,7 +53,7 @@
#include "screen.h"
#include "tetris.h"
-#define NUMKEYS 6
+#define NUMKEYS 7
cell board[B_SIZE];
int Rows, Cols;
@@ -170,7 +170,7 @@ main(int argc, char *argv[])
if (pledge("stdio rpath wpath cpath tty unveil", NULL) == -1)
err(1, "pledge");
- keys = "jkl pq";
+ keys = "hjkl pq";
classic = showpreview = 0;
while ((ch = getopt(argc, argv, "ck:l:ps")) != -1)
@@ -226,9 +226,9 @@ main(int argc, char *argv[])
}
snprintf(key_msg, sizeof key_msg,
-"%s - left %s - rotate %s - right %s - drop %s - pause %s - quit",
+"%s - left %s - ccw %s - cw %s - right %s - drop %s - pause %s - quit",
key_write[0], key_write[1], key_write[2], key_write[3],
- key_write[4], key_write[5]);
+ key_write[4], key_write[5], key_write[6]);
(void)signal(SIGINT, onintr);
scr_init();
@@ -286,11 +286,11 @@ main(int argc, char *argv[])
/*
* Handle command keys.
*/
- if (c == keys[5]) {
+ if (c == keys[6]) {
/* quit */
break;
}
- if (c == keys[4]) {
+ if (c == keys[5]) {
static char msg[] =
"paused - press RETURN to continue";
@@ -313,21 +313,28 @@ main(int argc, char *argv[])
continue;
}
if (c == keys[1]) {
- /* turn */
- const struct shape *new = &shapes[
- classic? curshape->rotc : curshape->rot];
+ /* turn ccw */
+ const struct shape *new = &shapes[curshape->rot];
if (fits_in(new, pos))
curshape = new;
continue;
}
if (c == keys[2]) {
+ /* turn cw */
+ const struct shape *new = &shapes[curshape->rotc];
+
+ if (fits_in(new, pos))
+ curshape = new;
+ continue;
+ }
+ if (c == keys[3]) {
/* move right */
if (fits_in(curshape, pos + 1))
pos++;
continue;
}
- if (c == keys[3]) {
+ if (c == keys[4]) {
/* move to bottom */
while (fits_in(curshape, pos + B_COLS)) {
pos += B_COLS;

BIN
images/pufferfish.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 422 B

View File

@ -37,6 +37,7 @@ var data = [
"你说得对,但是《长安汽车》是由艺画开天自主研发的一款全新开放世界冒险游戏。",
"Emacs has Evil, but Vim doesn't have Magit",
"免费服务的代价就是你自己",
"<a id=quote href=https://www.openbsd.org/lyrics.html#62> The only change that was required was a three-line diff</a>",
];
var index = Math.floor((Math.random() * data.length));

View File

@ -285,6 +285,22 @@ iwx0 at pci0 dev 20 function 3 "Intel Wi-Fi 6 AX201" rev 0x20, msix
** [[./bbs_gbk_utf8.org][支线任务: 中文 BBS GBK 转 UTF8]]
** @@html:<a href=https://dongdigua.github.io/code/bsd_tetris_add_reverse_rotate.patch type=text/plain>add reverse rotation to BSD Tetris</a>@@
:PROPERTIES:
:CUSTOM_ID: tetris
:END:
** songs I like
#+MACRO: song [[https://www.openbsd.org/lyrics.html#$1][song$1]]
- {{{song(57)}}}: Source Fish
- {{{song(62)}}}: A 3 line diff (低沉的小调)
- {{{song(49)}}}: The Answer
- {{{song(58d)}}}: A Year in the Life
- {{{song(54)}}}: Our favorite hacks (女声)
- {{{song(69)}}}: Vetera Novis (中国古典音乐)
- {{{song(46)}}}: Planet of the Users (Cyberpunk)
- {{{song(45)}}}: Games
* Footnotes
:PROPERTIES:
@ -313,5 +329,6 @@ iwx0 at pci0 dev 20 function 3 "Intel Wi-Fi 6 AX201" rev 0x20, msix
- [[https://youtu.be/1GYq8eD90nE][OpenBSD and DWM: True Minimalism]]
- [[https://kevinthomas.dev/posts/openbsd-thinkpadt480.html][Installing and setting up OpenBSD on Thinkpad T480 + improving slowness]]
- [[https://youtu.be/zXaHM7114Uk][Puffy vs. Tux! The difference between OpenBSD and GNU/Linux]]
- [[https://videos.lukesmith.xyz/w/ion4TuavEAqKRWeavWTCBe][LukeSmith: Email on the terminal with mutt]]
- [[https://videos.lukesmith.xyz/w/ion4TuavEAqKRWeavWTCBe][LukeSmith video: Email on the terminal with mutt]]
- [[https://youtu.be/o8aiSJ2nXcc][OpenBSD Guy: ffmpeg screencast]]
- [[https://videos.pair2jeux.tube/a/solene][solene's video]]

View File

@ -1,4 +0,0 @@
#! /bin/sh
ls gmi | xargs -I {} ln -s gmi/{} {}.txt
ln -s lol.diff lol.diff.txt

View File

@ -5,3 +5,6 @@ sed -i '6a <link rel="shortcut icon" href=https://www.bilibili.com/favicon.ico>'
# magical index
sed -i '6a <link rel="shortcut icon" href=https://static.wikia.nocookie.net/minecraft_gamepedia/images/5/55/Enchanted_Book.gif>' internet_collections.html
# openbsd
sed -i '6a <link rel="shortcut icon" href=/images/pufferfish.png>' whatif_openbsd.html

4
patches/txt.sh Executable file
View File

@ -0,0 +1,4 @@
#! /bin/sh
ls gmi | xargs -I {} ln -s gmi/{} {}.txt
ln -s code/lol.diff lol.diff.txt