+static void Handle_OP_CONTINUE_PLAYING()
+{
+ printf("OP_CONTINUE_PLAYING: %d\n", buf[0]);
+ sprintf(msgbuf, "client %d continues game", buf[0]);
+ sysmsg(msgbuf);
+
+ tape.pausing = FALSE;
+ DrawVideoDisplay(VIDEO_STATE_PAUSE_OFF,0);
+}
+
+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(unsigned int len)
+{
+ int frame_nr;
+ int i;
+
+ if (!network_playing)
+ return;
+
+ frame_nr =
+ (buf[2] << 24) | (buf[3] << 16) | (buf[4] << 8) | (buf[5]);
+
+ if (frame_nr != FrameCounter)
+ {
+ Error(ERR_RETURN, "client and servers frame counters out of sync");
+ Error(ERR_RETURN, "frame counter of client is %d", FrameCounter);
+ Error(ERR_RETURN, "frame counter of server is %d", frame_nr);
+ Error(ERR_EXIT, "this should not happen -- please debug");
+ }
+
+ /* copy valid player actions */
+ for (i=0; i<MAX_PLAYERS; i++)
+ stored_player[i].effective_action =
+ (i < len - 6 && stored_player[i].active ? buf[6 + i] : 0);
+
+ network_player_action_received = TRUE;
+
+ /*
+ sprintf(msgbuf, "frame %d: client %d moves player [0x%02x]",
+ FrameCounter, buf[0], buf[2]);
+ sysmsg(msgbuf);
+ */
+}
+
+static void HandleNetworkingMessages()
+{
+ unsigned int len;
+
+ while (nread >= 4 && nread >= 4 + readbuf[3])
+ {
+ len = readbuf[3];
+ if (readbuf[0] || readbuf[1] || readbuf[2])
+ Error(ERR_EXIT, "wrong network server line length");
+
+ memcpy(buf, &readbuf[4], len);
+ nread -= 4 + len;
+ memmove(readbuf, readbuf + 4 + len, nread);
+
+ switch(buf[1])
+ {
+ case OP_BAD_PROTOCOL_VERSION:
+ Handle_OP_BAD_PROTOCOL_VERSION();