tfv: keep track of steps/time

This commit is contained in:
Vince Weaver 2017-07-25 22:13:11 -04:00
parent b11e1fc9cd
commit 6f5361def8

View File

@ -27,6 +27,7 @@ static unsigned char limit=2;
static unsigned char money=0,experience=0;
static unsigned char time_hours=0,time_minutes=0;
static unsigned char items1=0xff,items2=0xff;
static unsigned char steps=0;
/* location */
static int map_x=5;
@ -605,9 +606,9 @@ static void print_info(void) {
basic_htab(23);
basic_vtab(13);
basic_print("TIME: ");
print_u8(time_minutes);
basic_print(":");
print_u8(time_hours);
basic_print(":");
print_u8(time_minutes);
grsim_update();
@ -900,10 +901,12 @@ static int world_map(void) {
if ((ch=='w') || (ch==APPLE_UP)) {
tfv_y-=2;
odd=!odd;
steps++;
}
if ((ch=='s') || (ch==APPLE_DOWN)) {
tfv_y+=2;
odd=!odd;
steps++;
}
if ((ch=='a') || (ch==APPLE_LEFT)) {
if (direction>0) {
@ -914,6 +917,7 @@ static int world_map(void) {
odd=!odd;
tfv_x--;
}
steps++;
}
if ((ch=='d') || (ch==APPLE_RIGHT)) {
if (direction<0) {
@ -924,6 +928,7 @@ static int world_map(void) {
odd=!odd;
tfv_x++;
}
steps++;
}
if (tfv_x>36) {
@ -987,6 +992,15 @@ static int world_map(void) {
grsim_update();
if (steps>=60) {
steps=0;
time_minutes++;
if (time_minutes>=60) {
time_hours++;
time_minutes=0;
}
}
usleep(10000);
}