ODPCB.c 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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: ODPCB.c
  20. *
  21. * Description: Implements the PC-Board 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. * Nov 11, 1995 6.00 BP Removed register keyword.
  28. * Nov 14, 1995 6.00 BP Added include of odscrn.h.
  29. * Nov 14, 1995 6.00 BP 32-bit portability.
  30. * Nov 16, 1995 6.00 BP Removed oddoor.h, added odcore.h.
  31. * Dec 22, 1995 6.00 BP Added od_connect_speed.
  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. * Aug 10, 2003 6.23 SH *nix support
  37. */
  38. #define BUILDING_OPENDOORS
  39. #include <string.h>
  40. #include <stdio.h>
  41. #include <time.h>
  42. #include "OpenDoor.h"
  43. #include "ODStr.h"
  44. #include "ODCore.h"
  45. #include "ODGen.h"
  46. #include "ODScrn.h"
  47. #include "ODKrnl.h"
  48. #include "ODUtil.h"
  49. #include "ODStat.h"
  50. /* ----------------------------------------------------------------------------
  51. * pdef_pcboard()
  52. *
  53. * Personality function for the PC-Board like status line / function key
  54. * personality.
  55. *
  56. * Parameters: btOperation - Indicates personality operation to be performed.
  57. *
  58. * Return: void
  59. */
  60. ODAPIDEF void ODCALL pdef_pcboard(BYTE btOperation)
  61. {
  62. static char szTemp[81];
  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(" ALT-H=Help ");
  70. ODScrnSetCursorPos(3, 24);
  71. if(od_control.baud != 0)
  72. {
  73. ODScrnPrintf("(%lu) ", od_control.od_connect_speed);
  74. }
  75. else
  76. {
  77. ODScrnDisplayString("(Local) ");
  78. }
  79. sprintf(szTemp, "%s - %s", od_control.user_name,
  80. od_control.user_location);
  81. szTemp[42] = '\0';
  82. strupr(szTemp);
  83. ODScrnDisplayString(szTemp);
  84. ODScrnSetCursorPos(1,25);
  85. if(od_control.user_ansi || od_control.user_avatar
  86. || od_control.user_rip)
  87. {
  88. ODScrnDisplayChar('G');
  89. }
  90. else
  91. {
  92. ODScrnDisplayChar('A');
  93. }
  94. if(btInfoType == RA1EXITINFO || btInfoType == RA2EXITINFO
  95. || btInfoType == DOORSYS_WILDCAT)
  96. {
  97. ODScrnPrintf(" (%s)",od_control.user_firstcall);
  98. }
  99. ODScrnSetCursorPos(15, 25);
  100. ODScrnPrintf("Sec(0)=%u ",od_control.user_security);
  101. if(od_control.od_extended_info || btInfoType == DOORSYS_GAP
  102. || btInfoType == CHAINTXT || btInfoType == DOORSYS_WILDCAT)
  103. {
  104. ODScrnPrintf("Times On=%u ", od_control.user_numcalls);
  105. }
  106. if(od_control.od_extended_info || btInfoType == SFDOORSDAT
  107. || btInfoType == DOORSYS_GAP || btInfoType == DOORSYS_WILDCAT)
  108. {
  109. ODScrnPrintf("Up:Dn=%lu:%lu", od_control.user_uploads,
  110. od_control.user_downloads);
  111. }
  112. ODScrnSetCursorPos(70, 25);
  113. ODScrnPrintf("%4d", od_control.user_timelimit);
  114. od_control.key_status[0] = 0x0000;
  115. od_control.key_status[1] = 0x2300;
  116. break;
  117. case PEROP_DISPLAY2:
  118. ODScrnSetAttribute(0x70);
  119. ODScrnSetCursorPos(1, 24);
  120. ODScrnDisplayString(" Alt-> N=Next X=DOS F1/F2=Time 2=LkOut 5=SHELL 8=HngUp 10=Chat ");
  121. od_control.key_status[0] = 0x2300;
  122. od_control.key_status[1] = 0x0000;
  123. break;
  124. case PEROP_UPDATE1:
  125. ODScrnSetAttribute(0x70);
  126. ODScrnSetCursorPos(70, 25);
  127. ODScrnPrintf("%4d", od_control.user_timelimit);
  128. break;
  129. case PEROP_INITIALIZE:
  130. od_control.key_hangup = 0x4200;
  131. od_control.key_drop2bbs = 0x2d00;
  132. od_control.key_dosshell = 0x3f00;
  133. od_control.key_chat = 0x4400;
  134. od_control.key_sysopnext = 0x3100;
  135. od_control.key_lockout = 0x3c00;
  136. od_control.key_status[0] = 0x0000;
  137. od_control.key_status[1] = 0x2300;
  138. od_control.key_status[2] = 0x0000;
  139. od_control.key_status[3] = 0x0000;
  140. od_control.key_status[4] = 0x0000;
  141. od_control.key_status[5] = 0x0000;
  142. od_control.key_status[6] = 0x0000;
  143. od_control.key_status[7] = 0x0000;
  144. od_control.key_status[8] = 0x0000;
  145. od_control.key_keyboardoff = 0x2500;
  146. od_control.key_moretime = 0x0000;
  147. od_control.key_lesstime = 0x0000;
  148. ODStatAddKey(0x6900);
  149. ODStatAddKey(0x6800);
  150. od_control.od_page_statusline = 0;
  151. break;
  152. case PEROP_CUSTOMKEY:
  153. switch(od_control.od_last_hot)
  154. {
  155. /* Key to add five minutes. */
  156. case 0x6900:
  157. if(od_control.user_timelimit <= 1435 &&
  158. od_control.user_timelimit >= 5)
  159. {
  160. od_control.user_timelimit += 5;
  161. bForceStatusUpdate = TRUE;
  162. CALL_KERNEL_IF_NEEDED();
  163. }
  164. else if(od_control.user_timelimit < 5)
  165. {
  166. od_control.user_timelimit++;
  167. bForceStatusUpdate = TRUE;
  168. CALL_KERNEL_IF_NEEDED();
  169. }
  170. break;
  171. /* Subtract five minutes from the user's remaining time. */
  172. case 0x6800:
  173. if(od_control.user_timelimit > 5)
  174. {
  175. od_control.user_timelimit -= 5;
  176. bForceStatusUpdate = TRUE;
  177. CALL_KERNEL_IF_NEEDED();
  178. }
  179. else if(od_control.user_timelimit > 1)
  180. {
  181. --od_control.user_timelimit;
  182. bForceStatusUpdate = TRUE;
  183. CALL_KERNEL_IF_NEEDED();
  184. }
  185. break;
  186. default:
  187. return;
  188. }
  189. od_control.od_last_hot = 0;
  190. break;
  191. }
  192. }