From 8e8331d44c3f51ce4a1e1ce3f7478f005fa81ef5 Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Tue, 6 Dec 2011 02:51:32 +0000 Subject: [PATCH] - Fixed: Pressing a key to advance an intermission screen only worked on the local computer. SVN r3328 (trunk) --- src/d_net.cpp | 6 ++++++ src/d_protocol.h | 1 + src/intermission/intermission.cpp | 26 +++++++++++++++++++++++++- src/intermission/intermission.h | 5 ++++- src/version.h | 2 +- 5 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 1532c0a35..3ee20b8b6 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -59,6 +59,7 @@ #include "m_argv.h" #include "p_lnspec.h" #include "v_video.h" +#include "intermission/intermission.h" int P_StartScript (AActor *who, line_t *where, int script, char *map, bool backSide, int arg0, int arg1, int arg2, int always, bool wantResultCode, bool net); @@ -748,6 +749,7 @@ void GetPackets (void) } if (netbuffer[0] & NCMD_QUITTERS) + { numplayers = netbuffer[k++]; for (int i = 0; i < numplayers; ++i) @@ -2455,6 +2457,10 @@ void Net_DoCommand (int type, BYTE **stream, int player) players[player].MaxPitch = ReadByte(stream) * ANGLE_1; // down break; + case DEM_ADVANCEINTER: + F_AdvanceIntermission(); + break; + default: I_Error ("Unknown net command: %d", type); break; diff --git a/src/d_protocol.h b/src/d_protocol.h index f00526555..79de464b1 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -160,6 +160,7 @@ enum EDemoCommand DEM_CONVNULL, // 61 DEM_RUNSPECIAL, // 62 Byte: Special number, Byte: Arg count, Ints: Args DEM_SETPITCHLIMIT, // 63 Byte: Up limit, Byte: Down limit (in degrees) + DEM_ADVANCEINTER, // 64 Advance intermission screen state }; // The following are implemented by cht_DoCheat in m_cheat.cpp diff --git a/src/intermission/intermission.cpp b/src/intermission/intermission.cpp index 023dff655..cb533bda8 100644 --- a/src/intermission/intermission.cpp +++ b/src/intermission/intermission.cpp @@ -50,6 +50,7 @@ #include "g_level.h" #include "p_conversation.h" #include "menu/menu.h" +#include "d_net.h" FIntermissionDescriptorList IntermissionDescriptors; @@ -769,7 +770,11 @@ bool DIntermissionController::Responder (event_t *ev) if (mScreen->mTicker < 2) return false; // prevent some leftover events from auto-advancing int res = mScreen->Responder(ev); - mAdvance = (res == -1); + if (res == -1 && !mSentAdvance) + { + Net_WriteByte(DEM_ADVANCEINTER); + mSentAdvance = true; + } return !!res; } return false; @@ -777,6 +782,10 @@ bool DIntermissionController::Responder (event_t *ev) void DIntermissionController::Ticker () { + if (mAdvance) + { + mSentAdvance = false; + } if (mScreen != NULL) { mAdvance |= (mScreen->Ticker() == -1); @@ -926,3 +935,18 @@ void F_EndFinale () DIntermissionController::CurrentIntermission = NULL; } } + +//========================================================================== +// +// Called by net loop. +// +//========================================================================== + +void F_AdvanceIntermission() +{ + if (DIntermissionController::CurrentIntermission != NULL) + { + DIntermissionController::CurrentIntermission->mAdvance = true; + } +} + diff --git a/src/intermission/intermission.h b/src/intermission/intermission.h index ee316c349..dc562c4c5 100644 --- a/src/intermission/intermission.h +++ b/src/intermission/intermission.h @@ -288,7 +288,7 @@ class DIntermissionController : public DObject TObjPtr mScreen; bool mDeleteDesc; bool mFirst; - bool mAdvance; + bool mAdvance, mSentAdvance; BYTE mGameState; int mIndex; @@ -302,6 +302,8 @@ public: void Ticker (); void Drawer (); void Destroy(); + + friend void F_AdvanceIntermission(); }; @@ -312,6 +314,7 @@ void F_Drawer (); void F_StartIntermission(FIntermissionDescriptor *desc, bool deleteme, BYTE state); void F_StartIntermission(FName desc, BYTE state); void F_EndFinale (); +void F_AdvanceIntermission(); // Create an intermission from old cluster data void F_StartFinale (const char *music, int musicorder, int cdtrack, unsigned int cdid, const char *flat, diff --git a/src/version.h b/src/version.h index 4c35f5a95..d4ee01b13 100644 --- a/src/version.h +++ b/src/version.h @@ -64,7 +64,7 @@ // Protocol version used in demos. // Bump it if you change existing DEM_ commands or add new ones. // Otherwise, it should be safe to leave it alone. -#define DEMOGAMEVERSION 0x215 +#define DEMOGAMEVERSION 0x216 // Minimum demo version we can play. // Bump it whenever you change or remove existing DEM_ commands.