forked from RealDeuce/OpenDoors
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathODWCat.c
More file actions
269 lines (245 loc) · 9.23 KB
/
Copy pathODWCat.c
File metadata and controls
269 lines (245 loc) · 9.23 KB
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/* OpenDoors Online Software Programming Toolkit
* (C) Copyright 1991 - 1999 by Brian Pirie.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*
* File: ODWCat.c
*
* Description: Implements the Wildcat personality.
*
* Revisions: Date Ver Who Change
* ---------------------------------------------------------------
* Oct 13, 1994 6.00 BP New file header format.
* Dec 09, 1994 6.00 BP Standardized coding style.
* Jul 18, 1995 6.00 BP Fix ODStatGetUserAge() bug.
* Nov 13, 1995 6.00 BP 32-bit portability.
* Nov 14, 1995 6.00 BP Added include of odscrn.h.
* Nov 16, 1995 6.00 BP Removed oddoor.h, added odcore.h.
* Dec 24, 1995 6.00 BP Fixed black square at pos 25x80.
* Dec 30, 1995 6.00 BP Added ODCALL for calling convention.
* Jan 03, 1996 6.00 BP Display connect speed with %lu.
* Feb 19, 1996 6.00 BP Changed version number to 6.00.
* Mar 03, 1996 6.10 BP Begin version 6.10.
* Mar 19, 1996 6.10 BP MSVC15 source-level compatibility.
* Aug 10, 2003 6.23 SH *nix support
*/
#define BUILDING_OPENDOORS
#include <string.h>
#include <ctype.h>
#include <stddef.h>
#include <time.h>
#include <stdio.h>
#include "OpenDoor.h"
#include "ODGen.h"
#include "ODScrn.h"
#include "ODCore.h"
#include "ODStat.h"
#include "ODKrnl.h"
/* ----------------------------------------------------------------------------
* pdef_wildcat()
*
* Personality function for the Wildcat BBS-like status line / function key
* personality.
*
* Parameters: btOperation - Indicates personality operation to be performed.
*
* Return: void
*/
ODAPIDEF void ODCALL pdef_wildcat(BYTE btOperation)
{
BYTE btInfoType = od_control.od_info_type;
switch(btOperation)
{
case PEROP_DISPLAY1:
ODScrnSetAttribute(0x70);
ODScrnSetCursorPos(1,24);
ODScrnDisplayString(" Baud: ");
ODScrnSetCursorPos(1,25);
ODScrnDisplayString("Phone: Sec: Time Left: ");
ODScrnPutText(80, 25, 80, 25, abtGreyBlock);
ODScrnSetAttribute(0x71);
ODScrnSetCursorPos(1,24);
sprintf(szStatusText, "(%s), ", od_control.user_name);
ODScrnPrintf("%34.34s", szStatusText);
ODScrnSetCursorPos(43, 24);
ODScrnPrintf("%lu", od_control.od_connect_speed);
ODScrnSetCursorPos(8,25);
if(od_control.od_extended_info || btInfoType==SFDOORSDAT || btInfoType==DOORSYS_GAP || btInfoType==DOORSYS_WILDCAT)
{
ODScrnDisplayString(od_control.user_homephone);
}
if(btInfoType==RA1EXITINFO || btInfoType==RA2EXITINFO || btInfoType==DOORSYS_WILDCAT)
{
char szUserAge[7];
ODScrnSetCursorPos(28,25);
ODScrnSetAttribute(0x70);
ODScrnDisplayString("Age: ");
ODScrnSetAttribute(0x71);
ODStatGetUserAge(szUserAge);
ODScrnDisplayString(szUserAge);
}
ODScrnSetCursorPos(43,25);
ODScrnPrintf("%u",od_control.user_security);
if(btInfoType==RA1EXITINFO || btInfoType==RA2EXITINFO || btInfoType==DOORSYS_WILDCAT)
{
if(strlen(od_control.user_firstcall)==8)
{
ODScrnSetCursorPos(49,25);
ODScrnSetAttribute(0x70);
ODScrnDisplayString("Since: ");
ODScrnSetAttribute(0x71);
ODScrnDisplayChar(od_control.user_firstcall[0]);
ODScrnDisplayChar(od_control.user_firstcall[1]);
ODScrnDisplayChar('/');
ODScrnDisplayChar(od_control.user_firstcall[6]);
ODScrnDisplayChar(od_control.user_firstcall[7]);
}
}
case PEROP_UPDATE1:
ODScrnSetAttribute(0x71);
ODScrnSetCursorPos(74,25);
if(od_control.user_timelimit<=9)
{
ODScrnPrintf(" %d",od_control.user_timelimit);
}
else if(od_control.user_timelimit<=99)
{
ODScrnPrintf(" %d",od_control.user_timelimit);
}
else if(od_control.user_timelimit<=999)
{
ODScrnPrintf(" %d",od_control.user_timelimit);
}
else
{
ODScrnPrintf("%d",od_control.user_timelimit);
}
ODScrnSetAttribute(0x70);
ODScrnSetCursorPos(56,24);
if(od_control.od_okaytopage==TRUE)
ODScrnDisplayString("Page Bell ");
else
ODScrnDisplayString(" ");
if(od_control.od_user_keyboard_on)
ODScrnDisplayString("Kybd ");
else
ODScrnDisplayString(" ");
if(od_control.sysop_next)
ODScrnDisplayString("Local-Next");
else
ODScrnDisplayString(" ");
break;
case PEROP_INITIALIZE:
od_control.key_hangup=0x0000;
od_control.key_drop2bbs=0x4400;
od_control.key_dosshell=0x2000;
od_control.key_chat=0x4100;
od_control.key_sysopnext=0x3b00;
od_control.key_lockout=0x8100;
od_control.key_status[0]=0x0000;
od_control.key_status[1]=0x0000;
od_control.key_status[2]=0x0000;
od_control.key_status[3]=0x0000;
od_control.key_status[4]=0x0000;
od_control.key_status[5]=0x0000;
od_control.key_status[6]=0x0000;
od_control.key_status[7]=0x0000;
od_control.key_status[8]=0x0000;
od_control.key_keyboardoff=0x2500;
od_control.key_moretime=0x0000;
od_control.key_lesstime=0x0000;
od_control.od_page_statusline=-1;
ODStatAddKey(0x4200); /* Key to end chat */
ODStatAddKey(0x4800); /* Key to add five minutes */
ODStatAddKey(0x5000); /* key to subtract five minutes */
ODStatAddKey(0x7800); /* key to hangup */
ODStatAddKey(0x7900); /* key to hangup */
ODStatAddKey(0x7a00); /* key to hangup */
ODStatAddKey(0x7b00); /* key to hangup */
ODStatAddKey(0x7c00); /* key to hangup */
ODStatAddKey(0x7d00); /* key to hangup */
ODStatAddKey(0x7e00); /* key to hangup */
ODStatAddKey(0x7f00); /* key to hangup */
ODStatAddKey(0x8000); /* key to hangup */
ODStatAddKey(0x3f00); /* key to toggle bell */
ODStatAddKey(0x3e00); /* key to toggle bell */
break;
case PEROP_CUSTOMKEY:
switch((WORD)od_control.od_last_hot)
{
case 0x4200:
od_control.od_chat_active = FALSE;
break;
case 0x4800:
if(od_control.user_timelimit <= 1435)
{
od_control.user_timelimit += 5;
bForceStatusUpdate = TRUE;
CALL_KERNEL_IF_NEEDED();
}
break;
case 0x5000:
od_control.user_timelimit -= 5;
bForceStatusUpdate = TRUE;
CALL_KERNEL_IF_NEEDED();
break;
case 0x7800:
case 0x7900:
case 0x7a00:
case 0x7b00:
case 0x7c00:
case 0x7d00:
case 0x7e00:
case 0x7f00:
case 0x8000:
od_exit(2,TRUE);
break;
case 0x3f00:
case 0x3e00:
if(od_control.od_okaytopage!=TRUE)
{
od_control.od_okaytopage=TRUE;
}
else
{
od_control.od_okaytopage=FALSE;
}
bForceStatusUpdate = TRUE;
CALL_KERNEL_IF_NEEDED();
break;
default:
return;
}
od_control.od_last_hot=0;
break;
case PEROP_DEINITIALIZE:
ODStatRemoveKey(0x4200);
ODStatRemoveKey(0x4800);
ODStatRemoveKey(0x5000);
ODStatRemoveKey(0x7800);
ODStatRemoveKey(0x7900);
ODStatRemoveKey(0x7a00);
ODStatRemoveKey(0x7b00);
ODStatRemoveKey(0x7c00);
ODStatRemoveKey(0x7d00);
ODStatRemoveKey(0x7e00);
ODStatRemoveKey(0x7f00);
ODStatRemoveKey(0x8000);
ODStatRemoveKey(0x3e00);
ODStatRemoveKey(0x3f00);
break;
}
}