summaryrefslogtreecommitdiff
path: root/setup/multiplayer.c
blob: 8e9a2e6b990f832ebb6140956b7c30bb8856a2d3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#include <stdio.h>
#include <stdlib.h>

#include "textscreen.h"

#define NUM_WADS 10

static char *skills[] = 
{
    "I'm too young to die!",
    "Hey, not too rough.",
    "Hurt me plenty.",
    "Ultra-violence",
    "NIGHTMARE!",
};

static char *gamemodes[] = 
{
    "Co-operative",
    "Deathmatch",
    "Deathmatch 2.0",
};

char *wads[NUM_WADS] = {};
int skill = 0;
int nomonsters = 0;
int deathmatch = 0;
int fast = 0;
int respawn = 0;
int udpport = 4815;

static void StartGame(void)
{
    printf("Now we start the game.\n");
    exit(0);
}

static txt_window_action_t *StartGameAction(void)
{
    txt_window_action_t *action;

    action = TXT_NewWindowAction(KEY_F10, "Start");
    TXT_SignalConnect(action, "pressed", StartGame, NULL);

    return action;
}

static void OpenWadsWindow(void)
{
    txt_window_t *window;
    int i;

    window = TXT_NewWindow("Add WADs");

    for (i=0; i<NUM_WADS; ++i)
    {
        TXT_AddWidget(window, TXT_NewInputBox(&wads[i], 40));
    }
}

static txt_window_action_t *WadWindowAction(void)
{
    txt_window_action_t *action;

    action = TXT_NewWindowAction('w', "Add WADs");
    TXT_SignalConnect(action, "pressed", OpenWadsWindow, NULL);

    return action;
}

void StartMultiGame(void)
{
    txt_window_t *window;
    txt_table_t *table;

    window = TXT_NewWindow("Start multiplayer game");

    TXT_SetWindowAction(window, TXT_HORIZ_CENTER, WadWindowAction());
    TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, StartGameAction());
    
    table = TXT_NewTable(2);
    TXT_AddWidget(table, TXT_NewStrut(12, 0));
    TXT_AddWidget(table, TXT_NewStrut(12, 0));
    TXT_AddWidget(table, TXT_NewLabel("Skill"));
    TXT_AddWidget(table, TXT_NewDropdownList(&skill, skills, 5));
    TXT_AddWidget(table, TXT_NewLabel("Game type"));
    TXT_AddWidget(table, TXT_NewDropdownList(&deathmatch, gamemodes, 3));
    TXT_AddWidget(table, TXT_NewLabel("UDP port"));
    TXT_AddWidget(table, TXT_NewIntInputBox(&udpport, 5));

    TXT_AddWidget(window, table);

    TXT_AddWidget(window, TXT_NewSeparator("Level warp"));

    table = TXT_NewTable(2);
    TXT_AddWidget(table, TXT_NewStrut(12, 0));
    TXT_AddWidget(table, TXT_NewStrut(12, 0));
    TXT_AddWidget(table, TXT_NewLabel("Doom 1"));
    TXT_AddWidget(table, TXT_NewButton("E1M1"));
    TXT_AddWidget(table, TXT_NewLabel("Doom 2"));
    TXT_AddWidget(table, TXT_NewButton("MAP01"));
    TXT_AddWidget(window, table);

    TXT_AddWidget(window, TXT_NewSeparator("Monsters"));
    TXT_AddWidget(window, TXT_NewInvertedCheckBox("Monsters", &nomonsters));
    TXT_AddWidget(window, TXT_NewCheckBox("Fast monsters", &fast));
    TXT_AddWidget(window, TXT_NewCheckBox("Respawning monsters", &respawn));

}