static void UpdateWarpType(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
{
    warptype_t new_warptype;
    iwad_t *iwad;
    
    // Get the selected IWAD

    iwad = GetIWADForDescription(found_iwads[found_iwad_selected]);

    // Find the new warp type

    if (iwad->mask & (IWAD_DOOM | IWAD_DOOM1 | IWAD_CHEX))
    {
        new_warptype = WARP_DOOM1;
    }
    else
    {
        new_warptype = WARP_DOOM2;
    }

    // Reset to E1M1 / MAP01 when the warp type is changed.

    if (new_warptype != warptype)
    {
        warpepisode = 1;
        warpmap = 1;
    }

    warptype = new_warptype;

    UpdateWarpButton();
    UpdateSkillButton();
}
static void UpdateWarpType(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused))
{
    warptype_t new_warptype;
    const iwad_t *iwad;

    // Get the selected IWAD

    iwad = GetCurrentIWAD();

    // Find the new warp type

    if (D_IsEpisodeMap(iwad->mission))
    {
        new_warptype = WARP_ExMy;
    }
    else
    {
        new_warptype = WARP_MAPxy;
    }

    // Reset to E1M1 / MAP01 when the warp type is changed.

    if (new_warptype != warptype)
    {
        warpepisode = 1;
        warpmap = 1;
    }

    warptype = new_warptype;

    UpdateWarpButton();
    UpdateSkillButton();
}
static void SetDoom2Warp(TXT_UNCAST_ARG(widget), void *val)
{
    int l;

    l = (int) val;

    warpmap = l;

    UpdateWarpButton();
}
static void SetDoom1Warp(TXT_UNCAST_ARG(widget), void *val)
{
    int l;

    l = (int) val;

    warpepisode = l / 10;
    warpmap = l % 10;

    UpdateWarpButton();
}
void StartMultiGame(void)
{
    txt_window_t *window;
    txt_table_t *gameopt_table;
    txt_table_t *advanced_table;
    txt_widget_t *iwad_selector;

    window = TXT_NewWindow("Start multiplayer game");

    TXT_AddWidgets(window, 
                   gameopt_table = TXT_NewTable(2),
                   TXT_NewSeparator("Monster options"),
                   TXT_NewInvertedCheckBox("Monsters enabled", &nomonsters),
                   TXT_NewCheckBox("Fast monsters", &fast),
                   TXT_NewCheckBox("Respawning monsters", &respawn),
                   TXT_NewSeparator("Advanced"),
                   advanced_table = TXT_NewTable(2),
                   TXT_NewButton2("Add extra parameters...", 
                                  OpenExtraParamsWindow, NULL),
                   NULL);

    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction());
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction());
    
    TXT_SetColumnWidths(gameopt_table, 12, 12);

    TXT_AddWidgets(gameopt_table,
           TXT_NewLabel("Game"),
           iwad_selector = IWADSelector(),
           TXT_NewLabel("Skill"),
           skillbutton = TXT_NewDropdownList(&skill, skills, 5),
           TXT_NewLabel("Game type"),
           TXT_NewDropdownList(&deathmatch, gamemodes, 3),
           TXT_NewLabel("Level warp"),
           warpbutton = TXT_NewButton2("????", LevelSelectDialog, NULL),
           TXT_NewLabel("Time limit"),
           TXT_NewHorizBox(TXT_NewIntInputBox(&timer, 2),
                           TXT_NewLabel("minutes"),
                           NULL),
           NULL);

    TXT_SetColumnWidths(advanced_table, 12, 12);

    TXT_SignalConnect(iwad_selector, "changed", UpdateWarpType, NULL);

    TXT_AddWidgets(advanced_table, 
                   TXT_NewLabel("UDP port"),
                   TXT_NewIntInputBox(&udpport, 5),
                   NULL);

    UpdateWarpType(NULL, NULL);
    UpdateWarpButton();
}
static void StartGameMenu(const char *window_title, int multiplayer)
{
    txt_window_t *window;
    txt_widget_t *iwad_selector;

    window = TXT_NewWindow(window_title);
    TXT_SetTableColumns(window, 2);
    TXT_SetColumnWidths(window, 12, 6);

    if (multiplayer)
    {
        TXT_SetWindowHelpURL(window, MULTI_START_HELP_URL);
    }
    else
    {
        TXT_SetWindowHelpURL(window, LEVEL_WARP_HELP_URL);
    }

    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction());
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction(multiplayer));

    TXT_AddWidgets(window,
                   TXT_NewLabel("Game"),
                   iwad_selector = IWADSelector(),
                   NULL);

    if (gamemission == hexen)
    {
        txt_dropdown_list_t *cc_dropdown;
        TXT_AddWidgets(window,
                       TXT_NewLabel("Character class "),
                       cc_dropdown = TXT_NewDropdownList(&character_class,
                                                         character_classes, 3),
                       NULL);

        // Update skill level dropdown when the character class is changed:

        TXT_SignalConnect(cc_dropdown, "changed", UpdateWarpType, NULL);
    }

    TXT_AddWidgets(window,
                   TXT_NewLabel("Skill"),
                   skillbutton = TXT_NewDropdownList(&skill, doom_skills, 5),
                   TXT_NewLabel("Level warp"),
                   warpbutton = TXT_NewButton2("?", LevelSelectDialog, NULL),
                   NULL);

    if (multiplayer)
    {
        TXT_AddWidgets(window,
               TXT_NewLabel("Game type"),
               GameTypeDropdown(),
               TXT_NewLabel("Time limit"),
               TXT_NewHorizBox(TXT_NewIntInputBox(&timer, 2),
                               TXT_NewLabel("minutes"),
                               NULL),
               NULL);
    }

    TXT_AddWidgets(window,
                   TXT_NewSeparator("Monster options"),
                   TXT_NewInvertedCheckBox("Monsters enabled", &nomonsters),
                   TXT_TABLE_OVERFLOW_RIGHT,
                   TXT_NewCheckBox("Fast monsters", &fast),
                   TXT_TABLE_OVERFLOW_RIGHT,
                   TXT_NewCheckBox("Respawning monsters", &respawn),
                   TXT_TABLE_OVERFLOW_RIGHT,
                   NULL);

    if (multiplayer)
    {
        TXT_AddWidgets(window,
                       TXT_NewSeparator("Advanced"),
                       TXT_NewLabel("UDP port"),
                       TXT_NewIntInputBox(&udpport, 5),
                       TXT_NewInvertedCheckBox("Register with master server",
                                               &privateserver),
                       TXT_TABLE_OVERFLOW_RIGHT,
                       NULL);
    }

    TXT_AddWidgets(window,
                   TXT_NewButton2("Add extra parameters...",
                                  OpenExtraParamsWindow, NULL),
                   TXT_TABLE_OVERFLOW_RIGHT,
                   NULL);

    TXT_SignalConnect(iwad_selector, "changed", UpdateWarpType, NULL);

    UpdateWarpType(NULL, NULL);
    UpdateWarpButton();
}