From edd02980f70019b1d01508467c671282561ed778 Mon Sep 17 00:00:00 2001 From: girst Date: Sat, 2 Feb 2019 17:49:43 +0100 Subject: [PATCH] rename to 'viper', new makefile --- Makefile | 11 +++++++---- README.md | 7 +++---- schemes.h | 2 +- viiper.c => viper.c | 17 +++++++++-------- viiper.h => viper.h | 6 +++--- 5 files changed, 23 insertions(+), 20 deletions(-) rename viiper.c => viper.c (98%) rename viiper.h => viper.h (97%) diff --git a/Makefile b/Makefile index c4cb5b5..03389b5 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,11 @@ .PHONY: all clean -all: viiper -viiper: viiper.c viiper.h schemes.h - gcc viiper.c -o viiper -g +CFLAGS := -Wall -Wextra -pedantic -std=c99 + +all: viper + +viper: viper.c viper.h schemes.h + $(CC) $(CFLAGS) $< -o $@ clean: - rm -f viiper + rm -f viper diff --git a/README.md b/README.md index 8aa0aaa..1015a2d 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,12 @@ -# VIIper - a Snake Clone for Unicode-compatible Terminals +# VIper - a Snake Clone for Unicode-compatible Terminals terminal + emoji = snek 🖳 + 💩 = 🐍 ## Requirements -You'll need either a terminal emulator with good Unicode (Emoji) support and a -compatible fonts to fully enjoy the graphics of this game. This is what I'd -recommend: +You'll need a terminal emulator with good Unicode (Emoji) support and 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`) diff --git a/schemes.h b/schemes.h index f3ba53c..3de34c0 100644 --- a/schemes.h +++ b/schemes.h @@ -1,7 +1,7 @@ #ifndef __SCHEMES_H__ #define __SCHEMES_H__ -#include "viiper.h" /* for enum items */ +#include "viper.h" /* for enum items */ #define BORDER_T 0 #define BORDER_C 1 diff --git a/viiper.c b/viper.c similarity index 98% rename from viiper.c rename to viper.c index 0cc1424..f8c8e01 100644 --- a/viiper.c +++ b/viper.c @@ -1,15 +1,15 @@ /******************************************************************************* - viiper 0.1 - By Tobias Girstmair, 2018 + viper 0.2 + By Tobias Girstmair, 2018 - 2019 - ./viiper 40x25 - (see ./viiper -h for full list of options) + ./viper 40x25 + (see ./viper -h for full list of options) KEYBINDINGS: - hjkl to move - p to pause and resume - r to restart - q to quit - - (see `./minesviiper -h' for all keybindings) + - (see `./viper -h' for all keybindings) GNU GPL v3, see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt *******************************************************************************/ @@ -27,7 +27,7 @@ #include #include -#include "viiper.h" +#include "viper.h" #include "schemes.h" #define MIN(a,b) (a>b?b:a) @@ -139,7 +139,7 @@ restart: switch (sigsetjmp(game_over, 1)) { case GAME_INIT: case GAME_START: - viiper(); + viper(); break; /* function doesn't return, but `-Wextra' complains */ case GAME_OVER: end_screen_msg = " GAME OVER "; @@ -167,7 +167,7 @@ quit: return 0; } -int viiper(void) { +int viper(void) { init_snake(); show_playfield (); g.d = EAST; @@ -192,6 +192,7 @@ int viiper(void) { case 'p': pause_game(); break; case 'r': siglongjmp(game_over, GAME_START); case 'q': siglongjmp(game_over, GAME_EXIT); + case'\\': {static int _;spawn_item(BONUS,_++%NUM_BONI,NULL);}break; case CTRL_'L': screen_setup(1); show_playfield(); diff --git a/viiper.h b/viper.h similarity index 97% rename from viiper.h rename to viper.h index 5c83fd1..5e4f4aa 100644 --- a/viiper.h +++ b/viper.h @@ -1,5 +1,5 @@ -#ifndef __VIIPER_H__ -#define __VIIPER_H__ +#ifndef __VIPER_H__ +#define __VIPER_H__ #define SHORTHELP "%s [OPTIONS] [FIELDSIZE]\n" #define LONGHELP \ @@ -72,7 +72,7 @@ enum game_state { GAME_EXIT, }; -int viiper(void); +int viper(void); void snake_advance (void); void spawn_item (int type, int value, struct item* p_item); void consume_item (struct item* i); -- 2.39.3