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 txt_dropdown_list_t *GameTypeDropdown(void)
{
    switch (gamemission)
    {
        case doom:
        default:
            return TXT_NewDropdownList(&deathmatch, gamemodes, 3);

        // Heretic and Hexen don't support Deathmatch II:

        case heretic:
        case hexen:
            return TXT_NewDropdownList(&deathmatch, gamemodes, 2);

        // Strife supports both deathmatch modes, but doesn't support
        // multiplayer co-op. Use a different variable to indicate whether
        // to use altdeath or not.

        case strife:
            return TXT_NewDropdownList(&strife_altdeath, strife_gamemodes, 2);
    }
}
Exemple #3
0
void JoinMultiGame(void)
{
    txt_window_t *window;
    txt_table_t *gameopt_table;
    txt_table_t *serveropt_table;
    txt_inputbox_t *address_box;

    window = TXT_NewWindow("Join multiplayer game");
    TXT_SetWindowHelpURL(window, MULTI_JOIN_HELP_URL);

    TXT_AddWidgets(window, 
        gameopt_table = TXT_NewTable(2),
        TXT_NewSeparator("Server"),
        serveropt_table = TXT_NewTable(1),
        TXT_NewStrut(0, 1),
        TXT_NewButton2("Add extra parameters...", OpenExtraParamsWindow, NULL),
        NULL);

    TXT_SetColumnWidths(gameopt_table, 12, 12);

    TXT_AddWidgets(gameopt_table,
                   TXT_NewLabel("Game"),
                   IWADSelector(),
                   NULL);

    if (gamemission == hexen)
    {
        TXT_AddWidgets(gameopt_table,
                       TXT_NewLabel("Character class "),
                       TXT_NewDropdownList(&character_class,
                                           character_classes, 3),
                       NULL);
    }

    TXT_AddWidgets(serveropt_table,
                   TXT_NewHorizBox(
                           TXT_NewLabel("Connect to address: "),
                           address_box = TXT_NewInputBox(&connect_address, 30),
                           NULL),
                   TXT_NewButton2("Find server on Internet...",
                                  FindInternetServer, NULL),
                   TXT_NewButton2("Find server on local network...",
                                  FindLANServer, NULL),
                   NULL);

    TXT_SelectWidget(window, address_box);

    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction());
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, JoinGameAction());
}
Exemple #4
0
static txt_dropdown_list_t *OPLTypeSelector(void)
{
    txt_dropdown_list_t *result;

    if (snd_dmxoption != NULL && strstr(snd_dmxoption, "-opl3") != NULL)
    {
        snd_oplmode = OPLMODE_OPL3;
    }
    else
    {
        snd_oplmode = OPLMODE_OPL2;
    }

    result = TXT_NewDropdownList(&snd_oplmode, opltype_strings, 2);

    TXT_SignalConnect(result, "changed", UpdateSndDevices, NULL);

    return result;
}
static txt_widget_t *IWADSelector(void)
{
    txt_dropdown_list_t *dropdown;
    txt_widget_t *result;
    int installed_iwads;
    int num_iwads;
    unsigned int i;

    // Find out what WADs are installed
    
    installed_iwads = FindInstalledIWADs();

    // Build a list of the descriptions for all installed IWADs

    num_iwads = 0;

    for (i=0; i<arrlen(iwads); ++i)
    {
        if (installed_iwads & iwads[i].mask)
        {
            found_iwads[num_iwads] = iwads[i].description;
            ++num_iwads;
        }
    }

    // If no IWADs are found, provide Doom 2 as an option, but
    // we're probably screwed.

    if (num_iwads == 0)
    {
        found_iwads[0] = "Doom 2";
        num_iwads = 1;
    }

    // Build a dropdown list of IWADs

    if (num_iwads < 2)
    {
        // We have only one IWAD.  Show as a label.

        result = (txt_widget_t *) TXT_NewLabel(found_iwads[0]);
    }
    else
    {
        // Dropdown list allowing IWAD to be selected.

        dropdown = TXT_NewDropdownList(&found_iwad_selected, 
                                       found_iwads, num_iwads);

        TXT_SignalConnect(dropdown, "changed", IWADSelected, NULL);

        result = (txt_widget_t *) dropdown;
    }

    // Select first in the list.

    found_iwad_selected = 0;
    IWADSelected(NULL, NULL);

    return result;
}
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();
}
static txt_widget_t *IWADSelector(void)
{
    txt_dropdown_list_t *dropdown;
    txt_widget_t *result;
    int num_iwads;
    unsigned int i;

    // Find out what WADs are installed

    found_iwads = GetIwads();

    // Build a list of the descriptions for all installed IWADs

    num_iwads = 0;

    for (i=0; found_iwads[i] != NULL; ++i)
    {
         ++num_iwads;
    }

    iwad_labels = malloc(sizeof(*iwad_labels) * num_iwads);

    for (i=0; i < num_iwads; ++i)
    {
        iwad_labels[i] = found_iwads[i]->description;
    }

    // If no IWADs are found, provide Doom 2 as an option, but
    // we're probably screwed.

    if (num_iwads == 0)
    {
        found_iwads = GetFallbackIwadList();
        num_iwads = 1;
    }

    // Build a dropdown list of IWADs

    if (num_iwads < 2)
    {
        // We have only one IWAD.  Show as a label.

        result = (txt_widget_t *) TXT_NewLabel(found_iwads[0]->description);
    }
    else
    {
        // Dropdown list allowing IWAD to be selected.

        dropdown = TXT_NewDropdownList(&found_iwad_selected, 
                                       iwad_labels, num_iwads);

        TXT_SignalConnect(dropdown, "changed", IWADSelected, NULL);

        result = (txt_widget_t *) dropdown;
    }

    // The first time the dialog is opened, found_iwad_selected=-1,
    // so select the first IWAD in the list. Don't lose the setting
    // if we close and reopen the dialog.

    if (found_iwad_selected < 0 || found_iwad_selected >= num_iwads)
    {
        found_iwad_selected = 0;
    }

    IWADSelected(NULL, NULL);

    return result;
}
void ConfigSound(void)
{
    txt_window_t *window;
    txt_table_t *extra_table;
    txt_dropdown_list_t *sfx_mode_control;
    txt_dropdown_list_t *music_mode_control;
    int num_sfx_modes, num_music_modes;

    // Work out what sfx mode we are currently using:

    if (snd_sfxdevice == SNDDEVICE_PCSPEAKER)
    {
        snd_sfxmode = SFXMODE_PCSPEAKER;
    }
    else if (snd_sfxdevice >= SNDDEVICE_SB)
    {
        snd_sfxmode = SFXMODE_DIGITAL;
    }
    else
    {
        snd_sfxmode = SFXMODE_DISABLED;
    }

    // Is music enabled?

    switch (snd_musicdevice)
    {
        case SNDDEVICE_GENMIDI:
            snd_musicmode = MUSICMODE_NATIVE;
            break;
        case SNDDEVICE_CD:
            snd_musicmode = MUSICMODE_CD;
            break;
        case SNDDEVICE_SB:
        case SNDDEVICE_ADLIB:
        case SNDDEVICE_AWE32:
            snd_musicmode = MUSICMODE_OPL;
            break;
        case SNDDEVICE_GUS:
            snd_musicmode = MUSICMODE_GUS;
            break;
        default:
            snd_musicmode = MUSICMODE_DISABLED;
            break;
    }

    // Doom has PC speaker sound effects, but others do not:

    if (gamemission == doom)
    {
        num_sfx_modes = NUM_SFXMODES;
    }
    else
    {
        num_sfx_modes = NUM_SFXMODES - 1;
    }

    // Hexen has CD audio; others do not.

    if (gamemission == hexen)
    {
        num_music_modes = NUM_MUSICMODES;
    }
    else
    {
        num_music_modes = NUM_MUSICMODES - 1;
    }

    // Build the window

    window = TXT_NewWindow("Sound configuration");
    TXT_SetWindowHelpURL(window, WINDOW_HELP_URL);
    TXT_SetTableColumns(window, 2);
    TXT_SetColumnWidths(window, 19, 15);

    TXT_SetWindowPosition(window, TXT_HORIZ_CENTER, TXT_VERT_TOP,
                                  TXT_SCREEN_W / 2, 5);

    TXT_AddWidgets(window,
                   TXT_NewSeparator("Sound effects"),
                   TXT_NewLabel("Sound effects"),
                   sfx_mode_control = TXT_NewDropdownList(&snd_sfxmode,
                                                          sfxmode_strings,
                                                          num_sfx_modes),
                   TXT_NewLabel("Sound channels"),
                   TXT_NewSpinControl(&numChannels, 1, 8),
                   TXT_NewLabel("SFX volume"),
                   TXT_NewSpinControl(&sfxVolume, 0, 15),
                   NULL);

    // Only show for games that implemented pitch shifting:
    if (gamemission == doom || gamemission == heretic || gamemission == hexen)
    {
        TXT_AddWidgets(window,
                       TXT_NewCheckBox("Pitch-shifted sounds",
                                       &snd_pitchshift),
                       TXT_TABLE_OVERFLOW_RIGHT,
                       NULL);
    }

    if (gamemission == strife)
    {
        TXT_AddWidgets(window,
                       TXT_NewLabel("Voice volume"),
                       TXT_NewSpinControl(&voiceVolume, 0, 15),
                       TXT_NewCheckBox("Show text with voices", &show_talk),
                       TXT_TABLE_OVERFLOW_RIGHT,
                       NULL);
    }

    TXT_AddWidgets(window,
                   TXT_NewSeparator("Music"),
                   TXT_NewLabel("Music"),
                   music_mode_control = TXT_NewDropdownList(&snd_musicmode,
                                                            musicmode_strings,
                                                            num_music_modes),
                   TXT_NewLabel("Music volume"),
                   TXT_NewSpinControl(&musicVolume, 0, 15),
                   extra_table = TXT_NewTable(2),
                   TXT_TABLE_OVERFLOW_RIGHT,
                   NULL);

    TXT_SetColumnWidths(extra_table, 19, 15);

    TXT_SignalConnect(sfx_mode_control, "changed", UpdateSndDevices, NULL);
    TXT_SignalConnect(music_mode_control, "changed", UpdateSndDevices, NULL);

    // Update extra_table when the music mode is changed, and build it now.
    TXT_SignalConnect(music_mode_control, "changed",
                      UpdateExtraTable, extra_table);
    UpdateExtraTable(music_mode_control, extra_table);
}