X-Git-Url: http://git.shiar.net/netris.git/blobdiff_plain/ddbae5789635a63fcf36a84056f9df4bc8b6adaa..eb820d60637feceb84f559675344cf24a2c2f1cd:/client.c diff --git a/client.c b/client.c index 6110445..788684c 100644 --- a/client.c +++ b/client.c @@ -52,12 +52,12 @@ static struct option options[] = { }; enum { - KT_left, KT_right, KT_rotright, KT_rotleft, KT_drop, KT_down, + KT_left, KT_right, KT_rotright, KT_rotleft, KT_drop, KT_dropsoft, KT_down, KT_faster, KT_pause, KT_redraw, KT_say, KT_quit, KT_numKeys }; static char *keyNames[KT_numKeys+1] = { - "Left", "Right", "RotRight", "RotLeft", "Drop", "Down", + "Left", "Right", "RotRight", "RotLeft", "Drop", "DropSoft", "Down", "Faster", "Pause", "Redraw", "Say", "Quit", NULL }; @@ -333,7 +333,6 @@ void OneGame(void) { int changed = 0; short gameStatus = 2; //2=loop; 1=new piece; 0=quit - int dropMode = 0; int chatMode = 0; char chatText[MSG_WIDTH] = "\0"; @@ -346,6 +345,7 @@ void OneGame(void) gameStatus = 0; return; case CT_pause: + if (Players[me].alive <= 0) return; Players[me].flags ^= SCF_paused; if (Game.started > 1) Message(Players[me].flags & SCF_paused @@ -442,6 +442,9 @@ void OneGame(void) case KT_quit: handle_cmd(CT_quit, NULL); return 1; + case KT_pause: + handle_cmd(CT_pause, NULL); + return 1; default: return 0; } @@ -449,14 +452,7 @@ void OneGame(void) // global actions (always possible, even if not playing) if (handle_key(key)) return; - if (Players[me].alive <= 0) return; - // actions available while in game - switch (key) { - case KT_pause: - return handle_cmd(CT_pause, NULL); - } - - if (paused) return; + if (Players[me].alive <= 0 || paused) return; // actions only available while actually playing switch (key) { case KT_left: @@ -479,14 +475,19 @@ void OneGame(void) else gameStatus = 1; //completely dropped break; - case KT_drop: + case KT_dropsoft: SetITimer(Game.speed, Game.speed); if (DropPiece(me)) { if (spied) SendPacket(me, NP_drop, 0, NULL); - if (!Sets.dropmode) gameStatus = 1; //instadrop } else gameStatus = 1; //dropped - dropMode = Sets.dropmode > 1; + break; + case KT_drop: + SetITimer(Game.speed, Game.speed); + if (DropPiece(me)) { + if (spied) SendPacket(me, NP_drop, 0, NULL); + } + gameStatus = 1; // drop break; case KT_faster: if (game != GT_onePlayer) break; @@ -498,11 +499,6 @@ void OneGame(void) changed = 1; break; } - - if (dropMode && DropPiece(me) > 0) { - SetITimer(Game.speed, Game.speed); - if (spied) SendPacket(me, NP_drop, 0, NULL); - } return; } //GameKey @@ -773,7 +769,6 @@ GameLoop: oldPaused = paused; } //(un)pause } //game loop - dropMode = 0; Players[me].score.score++; CheckClears(me); } //new piece loop