ODStand.c 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  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: ODStand.c
  20. *
  21. * Description: Implements the OpenDoors standard (default) 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 13, 1995 6.00 BP 32-bit portability.
  28. * Nov 14, 1995 6.00 BP Added include of odscrn.h.
  29. * Nov 16, 1995 6.00 BP Removed oddoor.h, added odcore.h.
  30. * Dec 22, 1995 6.00 BP Added od_connect_speed.
  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. * Feb 19, 1996 6.00 BP Changed version number to 6.00.
  34. * Mar 03, 1996 6.10 BP Begin version 6.10.
  35. * Aug 10, 2003 6.23 SH *nix support
  36. */
  37. #define BUILDING_OPENDOORS
  38. #include <stdio.h>
  39. #include "OpenDoor.h"
  40. #include "ODCore.h"
  41. #include "ODGen.h"
  42. #include "ODScrn.h"
  43. #include "ODInEx.h"
  44. /* ----------------------------------------------------------------------------
  45. * pdef_opendoors()
  46. *
  47. * Personality function for the OpenDoors standard status line / function key
  48. * personality.
  49. *
  50. * Parameters: btOperation - Indicates personality operation to be performed.
  51. *
  52. * Return: void
  53. */
  54. ODAPIDEF void ODCALL pdef_opendoors(BYTE btOperation)
  55. {
  56. switch(btOperation)
  57. {
  58. case PEROP_DISPLAY1:
  59. /* Display standard status line. */
  60. ODScrnSetAttribute(0x70);
  61. ODScrnSetCursorPos(1, 24);
  62. ODScrnDisplayString(od_control.od_status_line[0]);
  63. ODScrnSetCursorPos(1, 24);
  64. ODScrnPrintf(od_control.od_status_line[1], od_control.user_name,
  65. od_control.user_location, od_control.od_connect_speed);
  66. ODScrnSetCursorPos(77, 24);
  67. if(od_control.od_node < 1000)
  68. {
  69. ODScrnPrintf("%d]", od_control.od_node);
  70. }
  71. else
  72. {
  73. ODScrnDisplayString("?]");
  74. }
  75. ODScrnSetCursorPos(1,25);
  76. ODScrnDisplayString(od_control.od_status_line[2]);
  77. ODScrnPutText(80, 25, 80, 25, abtGreyBlock);
  78. ODScrnSetCursorPos(11,25);
  79. ODScrnPrintf("%u",od_control.user_security);
  80. ODScrnSetCursorPos(24,25);
  81. ODScrnPrintf(od_control.od_time_left,od_control.user_timelimit);
  82. if(od_control.user_ansi)
  83. {
  84. ODScrnSetCursorPos(40,25);
  85. ODScrnDisplayString("[ANSI]");
  86. }
  87. if(od_control.user_avatar)
  88. {
  89. ODScrnSetCursorPos(47,25);
  90. ODScrnDisplayString("[AVT]");
  91. }
  92. if(od_control.sysop_next)
  93. {
  94. ODScrnSetCursorPos(35,25);
  95. ODScrnDisplayString(od_control.od_sysop_next);
  96. }
  97. if(od_control.user_wantchat)
  98. {
  99. ODScrnSetCursorPos(57,25);
  100. ODScrnSetAttribute(0xf0);
  101. ODScrnDisplayString(od_control.od_want_chat);
  102. }
  103. if(!od_control.od_user_keyboard_on)
  104. {
  105. ODScrnSetCursorPos(58,24);
  106. ODScrnSetAttribute(0xf0);
  107. ODScrnDisplayString(od_control.od_no_keyboard);
  108. }
  109. break;
  110. case PEROP_DISPLAY8:
  111. /* Display help status line. */
  112. ODScrnSetAttribute(0x70);
  113. ODScrnPutText(80, 25, 80, 25, abtGreyBlock);
  114. ODScrnSetCursorPos(1,24);
  115. ODScrnDisplayString(od_control.od_help_text);
  116. ODScrnSetCursorPos(1,25);
  117. /* Display copyright inforomation. */
  118. if(bUserFull)/**/
  119. {
  120. ODScrnDisplayString(od_control.od_help_text2);
  121. }
  122. else
  123. {
  124. ODScrnDisplayString(OD_VER_UNREG_STAT);
  125. }
  126. break;
  127. case PEROP_UPDATE1:
  128. /* Update primary status line. */
  129. ODScrnSetAttribute(0x70);
  130. /* Update user's time limit. */
  131. ODScrnSetCursorPos(24,25);
  132. ODScrnPrintf(od_control.od_time_left,od_control.user_timelimit);
  133. /* Update "sysop next" setting. */
  134. ODScrnSetCursorPos(35,25);
  135. if(od_control.sysop_next)
  136. {
  137. ODScrnDisplayString(od_control.od_sysop_next);
  138. }
  139. else
  140. {
  141. ODScrnDisplayString(" ");
  142. }
  143. /* Update ANSI mode indicator. */
  144. if(od_control.user_ansi)
  145. {
  146. ODScrnDisplayString("[ANSI] ");
  147. }
  148. else
  149. {
  150. ODScrnDisplayString(" ");
  151. }
  152. /* Update AVATAR mode indicator. */
  153. if(od_control.user_avatar)
  154. {
  155. ODScrnDisplayString("[AVT] ");
  156. }
  157. else
  158. {
  159. ODScrnDisplayString(" ");
  160. }
  161. /* Update keyboard-off indicator. */
  162. ODScrnSetCursorPos(58,24);
  163. if(od_control.od_user_keyboard_on)
  164. {
  165. ODScrnDisplayString(" ");
  166. }
  167. else
  168. {
  169. ODScrnSetAttribute(0xf0);
  170. ODScrnDisplayString(od_control.od_no_keyboard);
  171. }
  172. /* Update want-chat indicator. */
  173. ODScrnSetCursorPos(57,25);
  174. if(od_control.user_wantchat)
  175. {
  176. ODScrnSetAttribute(0xf0);
  177. ODScrnDisplayString(od_control.od_want_chat);
  178. }
  179. else
  180. {
  181. ODScrnDisplayString(" ");
  182. }
  183. break;
  184. case PEROP_INITIALIZE:
  185. od_control.key_hangup=0x2300;
  186. od_control.key_drop2bbs=0x2000;
  187. od_control.key_dosshell=0x2400;
  188. od_control.key_chat=0x2e00;
  189. od_control.key_sysopnext=0x3100;
  190. od_control.key_lockout=0x2600;
  191. od_control.key_status[0]=0x3b00;
  192. od_control.key_status[1]=0x0000;
  193. od_control.key_status[2]=0x0000;
  194. od_control.key_status[3]=0x0000;
  195. od_control.key_status[4]=0x0000;
  196. od_control.key_status[5]=0x0000;
  197. od_control.key_status[6]=0x0000;
  198. od_control.key_status[7]=0x4300;
  199. od_control.key_status[8]=0x4400;
  200. od_control.key_keyboardoff=0x2500;
  201. od_control.key_moretime=0x4800;
  202. od_control.key_lesstime=0x5000;
  203. od_control.od_page_statusline=-1;
  204. break;
  205. }
  206. }