X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=e2ae24362e543e5ad437c404ff88d99ddbb6e32d;hb=69e8efac8d856859c55237e085ff8b514ae1aa3c;hp=0c369f03ae7363a53b4b83d59ae75d2449e7a08b;hpb=8c6f354ceb0f49857489ef2df0303e155e7f6846;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 0c369f03..e2ae2436 100644 --- a/src/game.c +++ b/src/game.c @@ -432,6 +432,18 @@ static void InitField(int x, int y, boolean init_game) } } +void DrawGameDoorValues() +{ + DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS, + int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE, + int2str(local_player->dynamite, 3), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_SCORE, DY + YY_SCORE, + int2str(local_player->score, 5), FS_SMALL, FC_YELLOW); + DrawText(DX + XX_TIME, DY + YY_TIME, + int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); +} + void InitGame() { int i, j, x, y; @@ -792,6 +804,9 @@ void InitGame() DX + XX_LEVEL - 1, DY + YY_LEVEL + 1); } +#if 1 + DrawGameDoorValues(); +#else DrawText(DX + XX_EMERALDS, DY + YY_EMERALDS, int2str(local_player->gems_still_needed, 3), FS_SMALL, FC_YELLOW); DrawText(DX + XX_DYNAMITE, DY + YY_DYNAMITE, @@ -800,6 +815,7 @@ void InitGame() int2str(local_player->score, 5), FS_SMALL, FC_YELLOW); DrawText(DX + XX_TIME, DY + YY_TIME, int2str(TimeLeft, 3), FS_SMALL, FC_YELLOW); +#endif UnmapGameButtons(); UnmapTapeButtons(); @@ -6305,6 +6321,31 @@ void RaiseScoreElement(int element) } } +void RequestQuitGame(boolean ask_if_really_quit) +{ + if (AllPlayersGone || + !ask_if_really_quit || + level_editor_test_game || + Request("Do you really want to quit the game ?", + REQ_ASK | REQ_STAY_CLOSED)) + { +#if defined(PLATFORM_UNIX) + if (options.network) + SendToServer_StopPlaying(); + else +#endif + { + game_status = MAINMENU; + DrawMainMenu(); + } + } + else + { + OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); + } +} + + /* ---------- new game button stuff ---------------------------------------- */ /* graphic position values for game buttons */ @@ -6453,30 +6494,7 @@ static void HandleGameButtons(struct GadgetInfo *gi) switch (id) { case GAME_CTRL_ID_STOP: - if (AllPlayersGone) - { - CloseDoor(DOOR_CLOSE_1); - game_status = MAINMENU; - DrawMainMenu(); - break; - } - - if (level_editor_test_game || - Request("Do you really want to quit the game ?", - REQ_ASK | REQ_STAY_CLOSED)) - { -#if defined(PLATFORM_UNIX) - if (options.network) - SendToServer_StopPlaying(); - else -#endif - { - game_status = MAINMENU; - DrawMainMenu(); - } - } - else - OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); + RequestQuitGame(TRUE); break; case GAME_CTRL_ID_PAUSE: