.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
-# 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`)
/*******************************************************************************
- 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
*******************************************************************************/
#include <time.h>
#include <unistd.h>
-#include "viiper.h"
+#include "viper.h"
#include "schemes.h"
#define MIN(a,b) (a>b?b:a)
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 ";
return 0;
}
-int viiper(void) {
+int viper(void) {
init_snake();
show_playfield ();
g.d = EAST;
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();
-#ifndef __VIIPER_H__
-#define __VIIPER_H__
+#ifndef __VIPER_H__
+#define __VIPER_H__
#define SHORTHELP "%s [OPTIONS] [FIELDSIZE]\n"
#define LONGHELP \
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);