-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTD1GAME.HPP
179 lines (160 loc) · 5.12 KB
/
TD1GAME.HPP
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
//GMON TD1Game
//Copyright 1996 Aaron Brinton
#define cListItems 4
//#define cScreenNameColor WHITE
//#define cHeadingColor LIGHTGREEN
//#define cDataColor YELLOW
class TD1Game
{
void RefreshData(void);
void RefreshList(void);
void RefreshGame(void);
public:
TD1Game(void);
~TD1Game(void);
void Startup(void);
void Run(void);
void SetSocket(int iSocket);
void DrawList(void);
void DrawGame(void);
private:
Tdpack *DPack;
int iCurrentView;
int iCurrentSocket;
netgame_info GameInfo[8];
};
TD1Game::TD1Game(void)
{
}
TD1Game::~TD1Game(void)
{
delete (DPack);
}
void TD1Game::Startup(void)
{
DPack = new Tdpack;
iCurrentSocket = 0;
DPack->Start(0);
for (int i = 0; i < cListItems; i++)
strcpy(GameInfo[i].game_name, "");
}
void TD1Game::Run(void)
{
DPack->EnterIdle();
RefreshData();
}
void TD1Game::SetSocket(int iSocket)
{
iCurrentSocket = iSocket;
DPack->Close();
DPack->Start(iCurrentSocket);
}
void TD1Game::DrawList(void)
{
/* int wx = wherex();
int wy = wherey();
NewScreen();
iCurrentView = 1;
PutString(50, 2, "* D1 Game List *", cScreenNameColor);
PutChar(67, 1, cDblHorzSglBottom, cLineColor);
PutChar(67, 2, cSglVert, cLineColor);
PutChar(67, 3, cDblHorzSglTop, cLineColor);
PutString(68, 2, "Socket:", cScreenNameColor);
PutString(2, 4, "# Title Type Diff Status P CLS MAP Mission Lvl", cHeadingColor);
PutChar(1, 5, cDblVertSglRight, cLineColor);
HorzSglLine(2, 79, 5);
PutChar(80, 5, cDblVertSglLeft, cLineColor);
PutChar(2, 6, 0x31, cHeadingColor);
PutChar(2, 7, 0x32, cHeadingColor);
PutChar(2, 8, 0x33, cHeadingColor);
PutChar(2, 9, 0x34, cHeadingColor);
PutChar(2, 10, 0x35, cHeadingColor);
PutChar(2, 11, 0x36, cHeadingColor);
PutChar(2, 12, 0x37, cHeadingColor);
PutChar(2, 13, 0x38, cHeadingColor);
PutChar(1, 14, cDblVertDblRight, cLineColor);
HorzDblLine(2, 79, 14);
PutChar(80, 14, cDblVertDblLeft, cLineColor);
gotoxy(wx, wy);
*/ }
void TD1Game::RefreshList(void)
{
/* PutString(76, 2, " ", cDataColor);
window(4, 6, 79, 9);
clrscr();
window(1, 1, 80, 50);
char sTemp[6];
if(iCurrentSocket > 0) sprintf(sTemp, "+%d", iCurrentSocket);
if(iCurrentSocket <= 0) sprintf(sTemp, "%d", iCurrentSocket);
RightJustify(sTemp, 4);
PutString(76, 2, sTemp, cDataColor);
for(int i = 0; i < cListItems; i++) {
if(GameInfo[i].type > 0) {
PutString( 4, i + 6, GameInfo[i].game_name, cDataColor);
switch(GameInfo[i].gamemode) {
case NETGAME_ANARCHY: {PutString(21, i + 6, "Arch", cDataColor); break;};
case NETGAME_TEAM_ANARCHY: {PutString(21, i + 6, "Team", cDataColor); break;};
case NETGAME_ROBOT_ANARCHY: {PutString(21, i + 6, "Robo", cDataColor); break;};
case NETGAME_COOPERATIVE: {PutString(21, i + 6, "Coop", cDataColor); break;};
}
switch(GameInfo[i].difficulty) {
case 0: {PutString(27, i + 6, "Novc", cDataColor); break;};
case 1: {PutString(27, i + 6, "Rook", cDataColor); break;};
case 2: {PutString(27, i + 6, "Htsh", cDataColor); break;};
case 3: {PutString(27, i + 6, "Ace ", cDataColor); break;};
case 4: {PutString(27, i + 6, "Insn", cDataColor); break;};
}
switch(GameInfo[i].game_status) {
case NETSTAT_MENU: {PutString(33, i + 6, "Menu ", cDataColor); break;};
case NETSTAT_PLAYING: {PutString(33, i + 6, "Playing ", cDataColor); break;};
case NETSTAT_BROWSING: {PutString(33, i + 6, "Browsing", cDataColor); break;};
case NETSTAT_WAITING: {PutString(33, i + 6, "Waiting", cDataColor); break;};
case NETSTAT_STARTING: {PutString(33, i + 6, "Starting", cDataColor); break;};
case NETSTAT_ENDLEVEL: {PutString(33, i + 6, "EndLevel", cDataColor); break;};
}
unsigned char ply = GameInfo[i].numplayers + 0x30;
PutChar(43, i + 6, ply, cDataColor);
if(GameInfo[i].game_flags && NETGAME_FLAG_CLOSED != 0) PutString(46, i + 6, "Yes", cDataColor);
else PutString(46, i + 6, " No", cDataColor);
//this doesn't seem to be working correctly
if(GameInfo[i].game_flags && NETGAME_FLAG_SHOW_MAP != 0) PutString(50, i + 6, "Yes", cDataColor);
else PutString(50, i + 6, " No", cDataColor);
PutString(55, i + 6, GameInfo[i].mission_title, cDataColor);
int iTemp = (int)GameInfo[i].levelnum;
if(iTemp > 0) sprintf(sTemp, "%d", iTemp);
else sprintf(sTemp, "S%d", abs(iTemp));
RightJustify(sTemp, 3);
PutString(77, i + 6, sTemp, cDataColor);
}
}
*/ }
void TD1Game::DrawGame(void)
{
iCurrentView = 2;
}
void TD1Game::RefreshGame(void)
{
}
void TD1Game::RefreshData(void)
{
int wx = wherex();
int wy = wherey();
netgame_info *lpGameInfo[cListItems];
for (int i = 0; i < cListItems; i++)
{
GameInfo[i].type = 0;
if (DPack->GetCompletionStatus(i))
{
lpGameInfo[i] = DPack->GetGameInfo(i);
memcpy(&GameInfo[i], lpGameInfo[i], sizeof(netgame_info));
}
else
lpGameInfo[i] = NULL;
}
if (iCurrentView == 1)
RefreshList();
if (iCurrentView == 2)
RefreshGame();
gotoxy(wx, wy);
DPack->Refresh();
}