Bypass the Protocol Selection Screen

Post tutorials on how to do certain tasks within game or engine code here.
Post Reply
mh
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Bypass the Protocol Selection Screen

Post by mh »

It's a small cosmetic change, but it's small changes like this that add a layer of polish to the end result, and end up giving a more professional impression.

By default when you use the Multiplayer menus you get a screen allowing you to select IPX, TCP/IP, etc. However, if only one protocol is available on your PC there's no reason why you can't just go directly to the next menu instead. Well now you can. Replace your M_Menu_Net_f with this lot:

Code: Select all

qboolean m_net_recursive = false;

void M_Menu_Net_f (void)
{
    qboolean m_net_direct = false;

    IN_Deactivate (vid.type == MODE_WINDOWED);

    // either go direct to the appropriate menu or use the protocol selection menu.
    // the protocol selection menu will only show if 2 or more protocols are available.
    // it also shows if none are available to inform the user of this fact.
    // note that serial counts as 2 protocols - modem and direct connect.
    if (!serialAvailable && !ipxAvailable && !tcpipAvailable) m_net_direct = false;
    if (serialAvailable && !ipxAvailable && !tcpipAvailable) m_net_direct = false;
    if (!serialAvailable && ipxAvailable && !tcpipAvailable) m_net_direct = true;
    if (!serialAvailable && !ipxAvailable && tcpipAvailable) m_net_direct = true;

    if (m_net_direct)
    {
        if (!m_net_recursive)
        {
            // automatically select the correct protocol and go to the appropriate menu
            m_net_recursive = true;
            m_net_cursor = ipxAvailable ? 2 : 3;
            M_Menu_LanConfig_f ();
            return;
        }
        else
        {
            m_net_recursive = false;
            M_Menu_MultiPlayer_f ();
            return;
        }
    }
    else m_net_recursive = false;

    key_dest = key_menu;
    m_state = m_net;
    m_entersound = true;
    m_net_items = 4;

    if (m_net_cursor >= m_net_items)
        m_net_cursor = 0;

    m_net_cursor--;
    M_Net_Key (K_DOWNARROW);
}
I don't suppose too many older hands use the Multiplayer menus, but this should add some user-friendliness for those who are new and/or are uncomfortable with the console.
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
dreadlorde
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am
Contact:

Post by dreadlorde »

Is IPX support even needed though? iirc I removed it from my engine, then again, my engine segfault's when trying to do multiplayer. :P
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.
Get off my lawn!
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Post by Spike »

needed or not (very unlikely) its very unlikely to actually be supported.
certain old games have buggy ip support (actually, of the ones that support both, most have buggy ip support... including quake - nats)... otherwise ipx would not normally be used.
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Post by frag.machine »

Spike wrote:needed or not (very unlikely) its very unlikely to actually be supported.
certain old games have buggy ip support (actually, of the ones that support both, most have buggy ip support... including quake - nats)... otherwise ipx would not normally be used.
Back in 1995/1996 IPX was a widely used protocol, more than TCP/IP in fact. The fault wasn't in the games or apps, but in the MS-DOS and its lack of any networking support at all. Netware IPX/SPX was in fact easier to set up (and more reliable) than the available third part TCP/IP stacks. So, it was kinda natural Quake to offer the option.

Nowadays supporting anything besides TCP/IP is just a waste of time and effort. I just chopped off everything but TCP/IP from Q2K4 a long, long time ago. No regrets. :)
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
Post Reply