diff options
author | Guido MartÃnez <mtzguido@gmail.com> | 2014-10-15 03:48:24 (GMT) |
---|---|---|
committer | Guido MartÃnez <mtzguido@gmail.com> | 2014-10-15 03:48:24 (GMT) |
commit | b2cff432d7c9b06adf657982970a80c523b3926e (patch) | |
tree | a519ddf2a7b1b505513109c122f96dc72f29113b | |
parent | 2f831fda767f9d26aee8d3c17a60bf3f05df747b (diff) | |
download | snake86-master.zip snake86-master.tar.gz snake86-master.tar.bz2 |
-rw-r--r-- | game.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -9,6 +9,7 @@ int applex = 0; appley = 0; int bonusx = 0, bonusy = 0, bonust = -1; int cantbonus = 2; int wait = 1; +int playing; /* * st = 0, normal @@ -78,7 +79,7 @@ int idle; int i; int col_hi; - if(score > hiscore) + if(playing && score > hiscore) hiscore = score; if (!idle) { @@ -92,7 +93,7 @@ int idle; xy(0,0), COL_WHITE); } - if (score >= hiscore) + if (score >= hiscore && playing) col_hi = COL_WHITE; else col_hi = COL_GREY; @@ -188,6 +189,14 @@ int idle; dy = (snakearr[(i+snakeoffset+1)%100].y - snakearr[(i+snakeoffset+99)%100].y); if(i>0 && i< snakelen-1) { + /* + * We only care about the first position + * after the head, all others are already + * drawn. Fix this to remove this crappy loop + */ + if (i != 1) + continue; + if(dx&1) { /* giro */ cw = (dx1 > 0 && dy > 0) || (dy1 > 0 && dx < 0) || (dx1 < 0 && dy < 0) || (dy1 < 0 && dx > 0); rot = 2*(dx<0) + (dx == dy); @@ -456,10 +465,12 @@ void mainloop() while (1) { startup(); resetvideo(); + playing = 1; play_loop(); lost(); + playing = 0; while (1) { startup(); resetvideo(); |