From 217f4ff2cd6840b8eb7ae87a0db68a30265d07c3 Mon Sep 17 00:00:00 2001 From: girst Date: Mon, 3 Sep 2018 15:24:58 +0200 Subject: [PATCH] remove vt220 support too much hassle, not enough bandwidth --- README.md | 8 +++++--- schemes.h | 43 ++----------------------------------------- viiper.c | 5 +---- 3 files changed, 8 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 1bdabe8..a7c2e4a 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,8 @@ terminal + emoji = snek ## Requirements You'll need either a terminal emulator with good Unicode (Emoji) support and a -compatible fonts, or an actual DEC VT220 to fully enjoy the graphics of this -game. This is what I'd recommend: +compatible fonts to fully enjoy the graphics of this game. This is what I'd +recommend: - A VTE based terminal (like GNOME Terminal and a whole bunch of others) - Google Noto's Color Emoji Font (Fedora: `google-noto-emoji-color-fonts.noarch`) @@ -20,6 +20,7 @@ game. This is what I'd recommend: ## TODO + + - TODO more food items (to shape points distribution) - TODO decaying points? (more points the faster you get the food) - TODO predatory animals trying to eat the snake? (🐉, 🐊, 🐆, 🐅, 🦁, 🐗, 🦊, 🦅) - TODO fix all `grep -n 'TODO\|XXX\|\([^:]\|^\)//' *.[ch]` - - TODO VT220 charset based on soft downloadable character set (->minesviiper) - TODO: find a better name ## Notes diff --git a/schemes.h b/schemes.h index 976e1c7..adaf299 100644 --- a/schemes.h +++ b/schemes.h @@ -23,12 +23,8 @@ struct scheme { char* food[NUM_FOODS]; char* boni[NUM_BONI]; - /* for en-/disabling e.g. DEC charset: */ - char* init_seq; - char* reset_seq; - - int cell_width; /* number of characters per cell */ - int display_width; /* how wide a cell appears to be */ + int cell_width; /* logical cell width */ + int display_width; /* physical cell width */ }; struct scheme unic0de = { @@ -98,39 +94,4 @@ struct scheme unic0de = { .display_width = 2, }; -struct scheme vt220_charset = { - .border = { - {"\033#6\x6c","\x71","\x6b"}, - {"\033#6\x78"," ","\x78"}, - {"\033#6\x6d","\x71","\x6a"}, - { "=","","=" }, - }, - .permeable = {//TODO: ascii-colons? - {"\033#6\x6c","\x71","\x6b"}, - {"\033#6\x78"," ","\x78"}, - {"\033#6\x6d","\x71","\x6a"}, - { "=","","=" }, - }, - - .snake = { - {"@","A",">","V","<"}, //head - {"#","#","#","#","#"}, - {"#","#","#","#","#"}, - {"#","#","#","#","#"}, - {"#","#","#","#","#"}, - }, - .color = {"0", "0", "1"}, - - .food = { "$", "%", "&", }, - .boni = { "\033Nx", "\033N|", "\033Ns", "\033Nf", "\033Nw", }, - - .init_seq = "\033(0\033*B\x0f" /* G0=Graphics, G2=ASCII, invoke G0 */ - "\033[?3l", /* disable 132 column mode (DECCOLM) */ - .reset_seq = "\033(B" /* reset to DEC Multinational Character Set */ - "\033[?3h", /* reenable DECCOLM (WARN: unconditionally!)*/ - - .cell_width = 1, - .display_width = 2, -}; - #endif diff --git a/viiper.c b/viiper.c index 8b9a336..1735b2c 100644 --- a/viiper.c +++ b/viiper.c @@ -108,7 +108,6 @@ int main (int argc, char** argv) { return 1; } break; - case 'd': op.sch = &vt220_charset; break; case 'h': default: fprintf (stderr, SHORTHELP LONGHELP, argv[0]); @@ -176,7 +175,7 @@ int viiper(void) { g.b.n = time(NULL) + BONUS_INTERVAL; g.b.t = 0; - spawn_item(FOOD, rand() % NUM_FOODS, NULL); //TODO: shape distribution, so bigger values get selected less + spawn_item(FOOD, rand() % NUM_FOODS, NULL); for(;;) { switch (getctrlseq()) { @@ -666,9 +665,7 @@ void screen_setup (int enable) { printf ("\033[s\033[?47h"); /* save cursor, alternate screen */ printf ("\033[H\033[J"); /* reset cursor, clear screen */ printf ("\033[?25l"); /* hide cursor */ - print (op.sch->init_seq); /* swich charset, if necessary */ } else { - print (op.sch->reset_seq); /* reset charset, if necessary */ printf ("\033[?25h"); /* show cursor */ printf ("\033[?47l\033[u"); /* primary screen, restore cursor */ raw_mode(0); -- 2.39.3