From 37a123d6768322e7d3fb14514dbb30127cbc384f Mon Sep 17 00:00:00 2001 From: flo Date: Wed, 19 Apr 2017 08:27:56 +0200 Subject: [PATCH] push --- src/wings.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/src/wings.c b/src/wings.c index 8a7b009..7dd7327 100644 --- a/src/wings.c +++ b/src/wings.c @@ -1,9 +1,7 @@ #include "wings.h" #include "display.h" // bopti.h => images // tales.h => fonts -#include "bopti.h" #include "keyboard.h" - #include "timer.h" #include "stdio.h" @@ -12,7 +10,6 @@ #define SIZE_MAP_X 256 #define SIZE_MAP_Y 128 - extern image_t plane; extern image_t img_menu; @@ -63,17 +60,19 @@ void menu() void update_frame(int *dir) { dclear(); - dimage_part(60, 24, &plane, 16*(*dir), 0, 16, 16); + dimage_part(56, 24, &plane, 16*(*dir), 0, 16, 16); dupdate(); } int game() { + int dir = 0; unsigned char fire = 0; // fire disable + unsigned int sum = 0; int *keys = NULL; - unsigned int key; + unsigned char i; timer_t *timer = NULL; @@ -94,11 +93,11 @@ int game() { case KEY_UP : case KEY_DOWN : case KEY_LEFT : case KEY_RIGHT : { - sum += keys[i]; + sum += keys[i]; // to know which replay keys pressed } break; - case KEY_SHIFT : fire = 1; break; // fire available - case KEY_EXIT : timer_stop(timer); return 1; + case KEY_SHIFT : fire = 1; break; // fire enable + case KEY_EXIT : timer_stop(timer); return 1; // good bye, see you soon } } @@ -106,16 +105,14 @@ int game() switch(sum) { - case KEY_LEFT : dir = 6; break; - case KEY_RIGHT : dir = 2; break; case KEY_UP : dir = 0; break; - case KEY_DOWN : dir = 4; break; - case 0x2F : dir = 1; break; + case KEY_RIGHT : dir = 2; break; case 0x3E : dir = 3; break; + case KEY_DOWN : dir = 4; break; case 0x4F : dir = 5; break; + case KEY_LEFT : dir = 6; break; case 0x40 : dir = 7; break; } } - }