From: Holger Schemel Date: Mon, 12 Oct 1998 07:44:48 +0000 (+0200) Subject: rnd-19981012-1 X-Git-Tag: 1.2.0^2~60 X-Git-Url: https://git.artsoft.org/?p=rocksndiamonds.git;a=commitdiff_plain;h=b454c38f3381978b6813eb06c736adaa38c55b89 rnd-19981012-1 --- diff --git a/src/files.c b/src/files.c index d34fe40d..5a290699 100644 --- a/src/files.c +++ b/src/files.c @@ -459,7 +459,9 @@ void LoadPlayerInfo(int mode) } level_nr = local_player->level_nr; - fclose(file); + + if (file) + fclose(file); } void SaveLevel(int level_nr) diff --git a/src/network.c b/src/network.c index 2d4e0e64..db7fc95f 100644 --- a/src/network.c +++ b/src/network.c @@ -506,6 +506,9 @@ static void Handle_OP_STOP_PLAYING() printf("OP_STOP_PLAYING: %d\n", buf[0]); sprintf(msgbuf, "client %d stops game", buf[0]); sysmsg(msgbuf); + + game_status = MAINMENU; + DrawMainMenu(); } static void Handle_OP_MOVE_FIGURE() diff --git a/src/screens.c b/src/screens.c index a4489ab3..dbed745e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -234,7 +234,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) else if (y==10) { SavePlayerInfo(PLAYER_LEVEL); - if (Request("Do you really want to quit ?",REQ_ASK|REQ_STAY_CLOSED)) + if (Request("Do you really want to quit ?", REQ_ASK | REQ_STAY_CLOSED)) game_status = EXITGAME; } @@ -1507,8 +1507,13 @@ void HandleGameButtons(int mx, int my, int button) if (Request("Do you really want to quit the game ?", REQ_ASK | REQ_STAY_CLOSED)) { - game_status = MAINMENU; - DrawMainMenu(); + if (standalone) + { + game_status = MAINMENU; + DrawMainMenu(); + } + else + SendToServer_StopPlaying(); } else OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK); diff --git a/src/screens.h b/src/screens.h index 4095a0a0..1e29566a 100644 --- a/src/screens.h +++ b/src/screens.h @@ -16,6 +16,7 @@ #include "main.h" +/* for DrawSetupScreen(), HandleSetupScreen() */ #define SETUP_SCREEN_POS_START 2 #define SETUP_SCREEN_POS_END 16 #define SETUP_SCREEN_POS_EMPTY (SETUP_SCREEN_POS_END - 2) diff --git a/src/tools.c b/src/tools.c index 1327e4e5..aefd540a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -23,6 +23,7 @@ #include "buttons.h" #include "joystick.h" #include "cartoons.h" +#include "network.h" #include @@ -1307,6 +1308,10 @@ BOOL Request(char *text, unsigned int req_state) int mx,my, ty, result = -1; unsigned int old_door_state; + /* pause network game while waiting for request to answer */ + if (!standalone && game_status == PLAYING && req_state & REQUEST_WAIT_FOR) + SendToServer_PausePlaying(); + old_door_state = GetDoorState(); CloseDoor(DOOR_CLOSE_1); @@ -1390,9 +1395,7 @@ BOOL Request(char *text, unsigned int req_state) OpenDoor(DOOR_OPEN_1); ClearEventQueue(); - if (!(req_state & REQ_ASK) && - !(req_state & REQ_CONFIRM) && - !(req_state & REQ_PLAYER)) + if (!(req_state & REQUEST_WAIT_FOR)) return(FALSE); if (game_status != MAINMENU) @@ -1531,6 +1534,10 @@ BOOL Request(char *text, unsigned int req_state) } } + /* continue network game after request */ + if (!standalone && game_status == PLAYING && req_state & REQUEST_WAIT_FOR) + SendToServer_ContinuePlaying(); + return(result); } diff --git a/src/tools.h b/src/tools.h index 4c7544df..40430781 100644 --- a/src/tools.h +++ b/src/tools.h @@ -18,43 +18,45 @@ #include "main.h" /* for SetDrawtoField */ -#define DRAW_DIRECT 0 -#define DRAW_BUFFERED 1 -#define DRAW_BACKBUFFER 2 +#define DRAW_DIRECT 0 +#define DRAW_BUFFERED 1 +#define DRAW_BACKBUFFER 2 /* for DrawElementShifted */ -#define NO_CUTTING 0 -#define CUT_ABOVE 1 -#define CUT_BELOW 2 -#define CUT_LEFT 4 -#define CUT_RIGHT 8 +#define NO_CUTTING 0 +#define CUT_ABOVE (1 << 0) +#define CUT_BELOW (1 << 1) +#define CUT_LEFT (1 << 2) +#define CUT_RIGHT (1 << 3) /* for masking functions */ -#define NO_MASKING 0 -#define USE_MASKING 1 +#define NO_MASKING 0 +#define USE_MASKING 1 /* for MoveDoor */ -#define DOOR_OPEN_1 (1 << 0) -#define DOOR_OPEN_2 (1 << 1) -#define DOOR_CLOSE_1 (1 << 2) -#define DOOR_CLOSE_2 (1 << 3) -#define DOOR_OPEN_BOTH (DOOR_OPEN_1 | DOOR_OPEN_2) -#define DOOR_CLOSE_BOTH (DOOR_CLOSE_1 | DOOR_CLOSE_2) -#define DOOR_ACTION_1 (DOOR_OPEN_1 | DOOR_CLOSE_1) -#define DOOR_ACTION_2 (DOOR_OPEN_2 | DOOR_CLOSE_2) -#define DOOR_ACTION (DOOR_ACTION_1 | DOOR_ACTION_2) -#define DOOR_COPY_BACK (1 << 4) -#define DOOR_NO_DELAY (1 << 5) -#define DOOR_GET_STATE (1 << 6) +#define DOOR_OPEN_1 (1 << 0) +#define DOOR_OPEN_2 (1 << 1) +#define DOOR_CLOSE_1 (1 << 2) +#define DOOR_CLOSE_2 (1 << 3) +#define DOOR_OPEN_BOTH (DOOR_OPEN_1 | DOOR_OPEN_2) +#define DOOR_CLOSE_BOTH (DOOR_CLOSE_1 | DOOR_CLOSE_2) +#define DOOR_ACTION_1 (DOOR_OPEN_1 | DOOR_CLOSE_1) +#define DOOR_ACTION_2 (DOOR_OPEN_2 | DOOR_CLOSE_2) +#define DOOR_ACTION (DOOR_ACTION_1 | DOOR_ACTION_2) +#define DOOR_COPY_BACK (1 << 4) +#define DOOR_NO_DELAY (1 << 5) +#define DOOR_GET_STATE (1 << 6) /* for Request */ -#define REQ_ASK (1 << 0) -#define REQ_OPEN (1 << 1) -#define REQ_CLOSE (1 << 2) -#define REQ_CONFIRM (1 << 3) -#define REQ_STAY_CLOSED (1 << 4) -#define REQ_STAY_OPEN (1 << 5) -#define REQ_PLAYER (1 << 6) +#define REQ_ASK (1 << 0) +#define REQ_OPEN (1 << 1) +#define REQ_CLOSE (1 << 2) +#define REQ_CONFIRM (1 << 3) +#define REQ_STAY_CLOSED (1 << 4) +#define REQ_STAY_OPEN (1 << 5) +#define REQ_PLAYER (1 << 6) + +#define REQUEST_WAIT_FOR (REQ_ASK | REQ_CONFIRM | REQ_PLAYER) void SetDrawtoField(int); void BackToFront();