FAQ  •  Register  •  Login

Bugfix: Involving playdemo and connection state

Moderator: Inside3D Admins

<<

Baker

User avatar

Posts: 3176

Joined: Tue Mar 14, 2006 5:15 am

Post Sat Jul 14, 2012 8:40 pm

Bugfix: Involving playdemo and connection state

In cl_main.c, add to end of function:

cl.intermission = 0;

SCR_UpdateScreen renders depending on cl.intermission and ignores con_forcedup.

Background: con_forcedup is set to true when !cl.worldmodel || cls.signon != SIGNONS (no world model for client or not fully signed on to a server ... even if the server in question is single player or yourself). SCR_UpdateScreen doesn't check con_forcedup to determine whether or not to draw the intermission screen ... likely because the entire cl state gets wiped when a new map is loaded. But a new map isn't always loaded.

Situations this can occur:
1. Demo record is stopped during intermission. No new map is going to load.
2. Player doesn't have the next map. In particular, for being connected to a non-local server.

Trying to fix by changing how SCR_UpdateScreen works might result in undesirable results like the console flashing on-screen between maps.

Might also be beneficial put this at the end of CL_Disconnect, but I haven't tested it to verify proper behavior in all circumstances:
..
SCR_EndLoadingPlaque (); // Which also gets rid of the "Loading" plaque.

// Resulting function:
  Code:
/*
=====================
CL_Disconnect

Sends a disconnect message to the server
This is also called on Host_Error, so it shouldn't cause any errors
=====================
*/
void CL_Disconnect (void)
{
// stop sounds (especially looping!)
   S_StopAllSounds (true);

// if running a local server, shut it down
   if (cls.demoplayback)
      CL_StopPlayback ();
   else if (cls.state == ca_connected)
   {
      if (cls.demorecording)
         CL_Stop_f ();

      Con_DPrintf ("Sending clc_disconnect\n");
      SZ_Clear (&cls.message);
      MSG_WriteByte (&cls.message, clc_disconnect);
      NET_SendUnreliableMessage (cls.netcon, &cls.message);
      SZ_Clear (&cls.message);
      NET_Close (cls.netcon);

      cls.state = ca_disconnected;
      if (sv.active)
         Host_ShutdownServer(false);
   }

   cls.demoplayback = cls.timedemo = false;
   cls.signon = 0;
   cl.intermission = 0; // Baker: So critical.  SCR_UpdateScreen uses this.
}
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
<<

mh

User avatar

Posts: 2172

Joined: Sat Jan 12, 2008 1:38 am

Post Sat Jul 14, 2012 9:19 pm

Re: Bugfix: Involving playdemo and connection state

Oddly enough, I've had this for years but for a completely different reason - I print the map name in the intermission screen, and without it I was crashing. So there's another thing fixed.

I also remove all centerprints at the same time so that's probably not a bad idea too - helps make the slate even cleaner when going to a new map.
Like the fifth day of playing 24-hour Scrabble when you don't want to use any letters because each one means a world to you because you're so deranged.
<<

szo

Posts: 106

Joined: Mon Dec 06, 2010 4:42 pm

Post Mon Jul 16, 2012 7:09 pm

Re: Bugfix: Involving playdemo and connection state

Good catch. Applied this to both quakespasm and to uhexen2. (uhexen2 was actually not 'affected' by the issue the way you documented it, but it actually used to draw the console background over the intermission pic, i.e. drawing doubly. ugh..)
<<

Baker

User avatar

Posts: 3176

Joined: Tue Mar 14, 2006 5:15 am

Post Tue Jul 17, 2012 6:40 pm

Re: Bugfix: Involving playdemo and connection state

Baker wrote:Might also be beneficial put this at the end of CL_Disconnect, but I haven't tested it to verify proper behavior in all circumstances:
..
SCR_EndLoadingPlaque (); // Which also gets rid of the "Loading" plaque.


By the way, don't add SCR_EndLoadingPlaque () to the end of CL_Disconnect. SCR_EndLoadingPlaque shouldn't go in CL_Disconnect, if you do that then the console will display in between the starting demos (which isn't intended behavior and is very annoying).
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
<<

r00k

Posts: 906

Joined: Sat Nov 13, 2004 10:39 pm

Post Tue Jul 17, 2012 8:14 pm

Re: Bugfix: Involving playdemo and connection state

Hadnt noticed this, been a long time since i recorded a demo all the way to the intermission, though I've noticed a bug when replaying to the end, my intermission angles are pointing to '0 0 0' :O happens in proQuake too!
<<

taniwha

Posts: 399

Joined: Thu Jan 14, 2010 7:11 am

Post Sat Jul 21, 2012 8:51 am

Re: Bugfix: Involving playdemo and connection state

I don't know if this particular fix is truly relevant to QF (I'll apply it anyway just in case), but investigating it did cause me to notice and fix two problems I'd introduced recently: intermission position was broken and the console was being drawn between levels.

I had a lot of "fun" with the loading plaque because for a long time, QF didn't draw the thing, but I has a few bugs in my implementation when I got it going again.
Leave others their otherness.
http://quakeforge.net/

Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.
Icons provided by Aha Soft