Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 147 lines (136 sloc) 2.488 kb
b126e26 @tbradshaw The source of the setup program included with DOOM, Final DOOM, Strife, ...
tbradshaw authored
1 //
2 // Choose which type of netplay
3 //
4 #include <dos.h>
5 #include <conio.h>
6 #include <string.h>
7
8 #include "main.h"
9
10 //
11 // Line input routine -- totally crude!
12 //
13 int EditLine(item_t *item,char *string,int maxlen)
14 {
15 char c;
16 int len;
17
18 textbackground(0);
19 textcolor(15);
20 Clear(item);
21 Pos(item);
22 cprintf("%s",string);
23 while(1)
24 {
25 c = getch();
26 switch(c)
27 {
28 case 8: // BACKSPACE
29 case 0x4b: // LEFT ARROW
30 len = strlen(string);
31 if (!len)
32 {
33 sound(2500);
34 delay(3);
35 nosound();
36 continue;
37 }
38 string[len-1] = 0;
39 Clear(item);
40 Pos(item);
41 cprintf("%s",string);
42 case 77: // RIGHT ARROW
43 case 0x48: // UP
44 case 0x50: // DOWN
45 sound(2500);
46 delay(3);
47 nosound();
48 break;
49 case KEY_ENTER:
50 case KEY_ESC:
51 return c;
52 default:
53 if (c < 0x20 || c > 0x7a)
54 {
55 sound(2500);
56 delay(3);
57 nosound();
58 continue;
59 }
60 len = strlen(string);
61 if (len+1 == maxlen)
62 {
63 sound(2500);
64 delay(3);
65 nosound();
66 continue;
67 }
68 string[len] = c;
69 string[len+1] = 0;
70 Pos(item);
71 cprintf("%s",string);
72 break;
73 }
74 }
75 }
76
77 enum {MAC_MACRO0,MAC_MACRO1,MAC_MACRO2,MAC_MACRO3,MAC_MACRO4,MAC_MACRO5,
78 MAC_MACRO6,MAC_MACRO7,MAC_MACRO8,MAC_MACRO9,MAC_MAX};
79 item_t macrositems[]=
80 {
81 {MAC_MACRO0, 22,7,40, -1,-1},
82 {MAC_MACRO1, 22,8,40, -1,-1},
83 {MAC_MACRO2, 22,9,40, -1,-1},
84 {MAC_MACRO3, 22,10,40, -1,-1},
85 {MAC_MACRO4, 22,11,40, -1,-1},
86 {MAC_MACRO5, 22,12,40, -1,-1},
87 {MAC_MACRO6, 22,13,40, -1,-1},
88 {MAC_MACRO7, 22,14,40, -1,-1},
89 {MAC_MACRO8, 22,15,40, -1,-1},
90 {MAC_MACRO9, 22,16,40, -1,-1}
91 };
92 menu_t macrosmenu=
93 {
94 &macrositems[0],
95 MAC_MACRO0,
96 MAC_MAX,
97 0x7f
98 };
99
100 void MacroConfig(void)
101 {
102 short key;
103 short field;
104 int i;
105 char string[40];
106
107 SaveScreen();
108 DrawPup(&macros);
109
110 textcolor(15);
111 textbackground(1);
112 for (i = 0;i < MAC_MAX; i++)
113 {
114 Clear(&macrositems[i]);
115 Pos(&macrositems[i]);
116 cprintf("%s",&chatmacros[i][0]);
117 }
118 gotoxy(1,25);
119
120 while(1)
121 {
122 SetupMenu(&macrosmenu);
123 field = GetMenuInput();
124 key = menukey;
125
126 switch(key)
127 {
128 case KEY_ENTER:
129 strcpy(string,chatmacros[field]);
130 key = EditLine(&macrositems[field],string,40);
131 if (key == KEY_ENTER)
132 strcpy(chatmacros[field],string);
133 textbackground(1);
134 textcolor(15);
135 Clear(&macrositems[field]);
136 Pos(&macrositems[field]);
137 cprintf("%s",chatmacros[field]);
138 gotoxy(1,25);
139 continue;
140
141 case KEY_ESC:
142 RestoreScreen();
143 return;
144 }
145 }
146 };
Something went wrong with that request. Please try again.