aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2020-02-14 13:40:57 -0500
committerJeffrey Armstrong <jeff@approximatrix.com>2020-02-14 13:40:57 -0500
commitc985a721b719ee97850498e9edd838ae3de52098 (patch)
tree598626dbc81db7012e16a60ac5b154a5dc024262
parent1ece8dde054d3c7a54a661c5e75aa3ef2f8ec281 (diff)
downloadgemworm-c985a721b719ee97850498e9edd838ae3de52098.zip
gemworm-c985a721b719ee97850498e9edd838ae3de52098.tar.gz
Fixed in-game resizing and all event loop handling in general. Fixed menu reset after completing work.
-rw-r--r--player.h28
-rw-r--r--worm.c11
2 files changed, 21 insertions, 18 deletions
diff --git a/player.h b/player.h
index ea04edf..acf8030 100644
--- a/player.h
+++ b/player.h
@@ -21,27 +21,27 @@
#define __PLHEADERS
typedef struct {
- char c_x;
- char c_y;
- void *next;
+ char c_x;
+ char c_y;
+ void *next;
} WUNIT;
typedef struct {
- int length;
- WUNIT *head;
- char dir;
- int grow;
+ int length;
+ WUNIT *head;
+ char dir;
+ int grow;
} WPLAYER;
-#define WUP 0
-#define WDOWN 1
-#define WLEFT 2
-#define WRIGHT 3
+#define WUP 0
+#define WDOWN 1
+#define WLEFT 2
+#define WRIGHT 3
-#define ALIVE 1
-#define DEAD 0
+#define ALIVE 1
+#define DEAD 0
-#define STARTLENGTH 6
+#define STARTLENGTH 6
void move_player(WPLAYER *player, char dir);
diff --git a/worm.c b/worm.c
index c291a41..9db6062 100644
--- a/worm.c
+++ b/worm.c
@@ -359,9 +359,10 @@ EVMULT_OUT evout;
/* Key presses */
if((ret & MU_KEYBD) && playing > 0) {
hndl_keys(key, player);
+ }
/* Timer - update game */
- } else if((ret & MU_TIMER) && playing > 0) {
+ if((ret & MU_TIMER) && playing > 0) {
wind_update(BEG_UPDATE);
palive = update_player(player, &tailx, &taily);
falive = update_field(player);
@@ -380,9 +381,10 @@ EVMULT_OUT evout;
reset_player(player);
playing = 0;
}
+ }
/* Messages (menu, resizes, etc.) */
- } else if(ret & MU_MESAG) {
+ if(ret & MU_MESAG) {
#ifdef DEBUG
printf("MSG: %d\n",msg[0]);
#endif
@@ -436,14 +438,15 @@ EVMULT_OUT evout;
appl_write(app_accid,sizeof(msg),msg);
break;
case MNEW:
- update_field(player);
- draw_field(app_vh, &app_wdw);
+ update_field(player);
+ draw_field(app_vh, &app_wdw);
playing = 1;
break;
case MABOUT:
hndl_about();
break;
}
+ menu_tnormal(app_menu, msg[3], 1);
break;
} /* switch */