ODWCat.c 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. /* OpenDoors Online Software Programming Toolkit
  2. * (C) Copyright 1991 - 1999 by Brian Pirie.
  3. *
  4. * This library is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU Lesser General Public
  6. * License as published by the Free Software Foundation; either
  7. * version 2 of the License, or (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public
  15. * License along with this library; if not, write to the Free Software
  16. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. *
  18. *
  19. * File: ODWCat.c
  20. *
  21. * Description: Implements the Wildcat personality.
  22. *
  23. * Revisions: Date Ver Who Change
  24. * ---------------------------------------------------------------
  25. * Oct 13, 1994 6.00 BP New file header format.
  26. * Dec 09, 1994 6.00 BP Standardized coding style.
  27. * Jul 18, 1995 6.00 BP Fix ODStatGetUserAge() bug.
  28. * Nov 13, 1995 6.00 BP 32-bit portability.
  29. * Nov 14, 1995 6.00 BP Added include of odscrn.h.
  30. * Nov 16, 1995 6.00 BP Removed oddoor.h, added odcore.h.
  31. * Dec 24, 1995 6.00 BP Fixed black square at pos 25x80.
  32. * Dec 30, 1995 6.00 BP Added ODCALL for calling convention.
  33. * Jan 03, 1996 6.00 BP Display connect speed with %lu.
  34. * Feb 19, 1996 6.00 BP Changed version number to 6.00.
  35. * Mar 03, 1996 6.10 BP Begin version 6.10.
  36. * Mar 19, 1996 6.10 BP MSVC15 source-level compatibility.
  37. * Aug 10, 2003 6.23 SH *nix support
  38. */
  39. #define BUILDING_OPENDOORS
  40. #include <string.h>
  41. #include <ctype.h>
  42. #include <stddef.h>
  43. #include <time.h>
  44. #include <stdio.h>
  45. #include "OpenDoor.h"
  46. #include "ODGen.h"
  47. #include "ODScrn.h"
  48. #include "ODCore.h"
  49. #include "ODStat.h"
  50. #include "ODKrnl.h"
  51. /* ----------------------------------------------------------------------------
  52. * pdef_wildcat()
  53. *
  54. * Personality function for the Wildcat BBS-like status line / function key
  55. * personality.
  56. *
  57. * Parameters: btOperation - Indicates personality operation to be performed.
  58. *
  59. * Return: void
  60. */
  61. ODAPIDEF void ODCALL pdef_wildcat(BYTE btOperation)
  62. {
  63. BYTE btInfoType = od_control.od_info_type;
  64. switch(btOperation)
  65. {
  66. case PEROP_DISPLAY1:
  67. ODScrnSetAttribute(0x70);
  68. ODScrnSetCursorPos(1,24);
  69. ODScrnDisplayString(" Baud: ");
  70. ODScrnSetCursorPos(1,25);
  71. ODScrnDisplayString("Phone: Sec: Time Left: ");
  72. ODScrnPutText(80, 25, 80, 25, abtGreyBlock);
  73. ODScrnSetAttribute(0x71);
  74. ODScrnSetCursorPos(1,24);
  75. sprintf(szStatusText, "(%s), ", od_control.user_name,
  76. od_control.user_location);
  77. ODScrnPrintf("%34.34s", szStatusText);
  78. ODScrnSetCursorPos(43, 24);
  79. ODScrnPrintf("%lu", od_control.od_connect_speed);
  80. ODScrnSetCursorPos(8,25);
  81. if(od_control.od_extended_info || btInfoType==SFDOORSDAT || btInfoType==DOORSYS_GAP || btInfoType==DOORSYS_WILDCAT)
  82. {
  83. ODScrnDisplayString(od_control.user_homephone);
  84. }
  85. if(btInfoType==RA1EXITINFO || btInfoType==RA2EXITINFO || btInfoType==DOORSYS_WILDCAT)
  86. {
  87. char szUserAge[7];
  88. ODScrnSetCursorPos(28,25);
  89. ODScrnSetAttribute(0x70);
  90. ODScrnDisplayString("Age: ");
  91. ODScrnSetAttribute(0x71);
  92. ODStatGetUserAge(szUserAge);
  93. ODScrnDisplayString(szUserAge);
  94. }
  95. ODScrnSetCursorPos(43,25);
  96. ODScrnPrintf("%u",od_control.user_security);
  97. if(btInfoType==RA1EXITINFO || btInfoType==RA2EXITINFO || btInfoType==DOORSYS_WILDCAT)
  98. {
  99. if(strlen(od_control.user_firstcall)==8)
  100. {
  101. ODScrnSetCursorPos(49,25);
  102. ODScrnSetAttribute(0x70);
  103. ODScrnDisplayString("Since: ");
  104. ODScrnSetAttribute(0x71);
  105. ODScrnDisplayChar(od_control.user_firstcall[0]);
  106. ODScrnDisplayChar(od_control.user_firstcall[1]);
  107. ODScrnDisplayChar('/');
  108. ODScrnDisplayChar(od_control.user_firstcall[6]);
  109. ODScrnDisplayChar(od_control.user_firstcall[7]);
  110. }
  111. }
  112. case PEROP_UPDATE1:
  113. ODScrnSetAttribute(0x71);
  114. ODScrnSetCursorPos(74,25);
  115. if(od_control.user_timelimit<=9)
  116. {
  117. ODScrnPrintf(" %d",od_control.user_timelimit);
  118. }
  119. else if(od_control.user_timelimit<=99)
  120. {
  121. ODScrnPrintf(" %d",od_control.user_timelimit);
  122. }
  123. else if(od_control.user_timelimit<=999)
  124. {
  125. ODScrnPrintf(" %d",od_control.user_timelimit);
  126. }
  127. else
  128. {
  129. ODScrnPrintf("%d",od_control.user_timelimit);
  130. }
  131. ODScrnSetAttribute(0x70);
  132. ODScrnSetCursorPos(56,24);
  133. if(od_control.od_okaytopage==TRUE)
  134. ODScrnDisplayString("Page Bell ");
  135. else
  136. ODScrnDisplayString(" ");
  137. if(od_control.od_user_keyboard_on)
  138. ODScrnDisplayString("Kybd ");
  139. else
  140. ODScrnDisplayString(" ");
  141. if(od_control.sysop_next)
  142. ODScrnDisplayString("Local-Next");
  143. else
  144. ODScrnDisplayString(" ");
  145. break;
  146. case PEROP_INITIALIZE:
  147. od_control.key_hangup=0x0000;
  148. od_control.key_drop2bbs=0x4400;
  149. od_control.key_dosshell=0x2000;
  150. od_control.key_chat=0x4100;
  151. od_control.key_sysopnext=0x3b00;
  152. od_control.key_lockout=0x8100;
  153. od_control.key_status[0]=0x0000;
  154. od_control.key_status[1]=0x0000;
  155. od_control.key_status[2]=0x0000;
  156. od_control.key_status[3]=0x0000;
  157. od_control.key_status[4]=0x0000;
  158. od_control.key_status[5]=0x0000;
  159. od_control.key_status[6]=0x0000;
  160. od_control.key_status[7]=0x0000;
  161. od_control.key_status[8]=0x0000;
  162. od_control.key_keyboardoff=0x2500;
  163. od_control.key_moretime=0x0000;
  164. od_control.key_lesstime=0x0000;
  165. od_control.od_page_statusline=-1;
  166. ODStatAddKey(0x4200); /* Key to end chat */
  167. ODStatAddKey(0x4800); /* Key to add five minutes */
  168. ODStatAddKey(0x5000); /* key to subtract five minutes */
  169. ODStatAddKey(0x7800); /* key to hangup */
  170. ODStatAddKey(0x7900); /* key to hangup */
  171. ODStatAddKey(0x7a00); /* key to hangup */
  172. ODStatAddKey(0x7b00); /* key to hangup */
  173. ODStatAddKey(0x7c00); /* key to hangup */
  174. ODStatAddKey(0x7d00); /* key to hangup */
  175. ODStatAddKey(0x7e00); /* key to hangup */
  176. ODStatAddKey(0x7f00); /* key to hangup */
  177. ODStatAddKey(0x8000); /* key to hangup */
  178. ODStatAddKey(0x3f00); /* key to toggle bell */
  179. ODStatAddKey(0x3e00); /* key to toggle bell */
  180. break;
  181. case PEROP_CUSTOMKEY:
  182. switch((WORD)od_control.od_last_hot)
  183. {
  184. case 0x4200:
  185. od_control.od_chat_active = FALSE;
  186. break;
  187. case 0x4800:
  188. if(od_control.user_timelimit <= 1435)
  189. {
  190. od_control.user_timelimit += 5;
  191. bForceStatusUpdate = TRUE;
  192. CALL_KERNEL_IF_NEEDED();
  193. }
  194. break;
  195. case 0x5000:
  196. od_control.user_timelimit -= 5;
  197. bForceStatusUpdate = TRUE;
  198. CALL_KERNEL_IF_NEEDED();
  199. break;
  200. case 0x7800:
  201. case 0x7900:
  202. case 0x7a00:
  203. case 0x7b00:
  204. case 0x7c00:
  205. case 0x7d00:
  206. case 0x7e00:
  207. case 0x7f00:
  208. case 0x8000:
  209. od_exit(2,TRUE);
  210. break;
  211. case 0x3f00:
  212. case 0x3e00:
  213. if(od_control.od_okaytopage!=TRUE)
  214. {
  215. od_control.od_okaytopage=TRUE;
  216. }
  217. else
  218. {
  219. od_control.od_okaytopage=FALSE;
  220. }
  221. bForceStatusUpdate = TRUE;
  222. CALL_KERNEL_IF_NEEDED();
  223. break;
  224. default:
  225. return;
  226. }
  227. od_control.od_last_hot=0;
  228. break;
  229. case PEROP_DEINITIALIZE:
  230. ODStatRemoveKey(0x4200);
  231. ODStatRemoveKey(0x4800);
  232. ODStatRemoveKey(0x5000);
  233. ODStatRemoveKey(0x7800);
  234. ODStatRemoveKey(0x7900);
  235. ODStatRemoveKey(0x7a00);
  236. ODStatRemoveKey(0x7b00);
  237. ODStatRemoveKey(0x7c00);
  238. ODStatRemoveKey(0x7d00);
  239. ODStatRemoveKey(0x7e00);
  240. ODStatRemoveKey(0x7f00);
  241. ODStatRemoveKey(0x8000);
  242. ODStatRemoveKey(0x3e00);
  243. ODStatRemoveKey(0x3f00);
  244. break;
  245. }
  246. }