EURO_CNT.CPP 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #include <i86.h>
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <conio.h>
  6. #include "eurodefs.h"
  7. #include "euro_fxd.h"
  8. #include "euro.equ"
  9. #include "euro_sym.h"
  10. #include "euro_def.h"
  11. #include "euro_var.h"
  12. #include "euro_grf.h"
  13. #include "euro_dsk.h"
  14. #include "euro_fix.h"
  15. #include "euro_sel.h"
  16. #include "euro_inf.h"
  17. #include "defines.h"
  18. //********************************************************************************************************************************
  19. char InitialiseUser( char user, char cntrl )
  20. {
  21. if ( EUROgameType == EURO_friendly )
  22. {
  23. UserList[user].control = cntrl;
  24. user++;
  25. }
  26. if ( EUROgameType == EURO_championship )
  27. {
  28. UserList[user].control = cntrl;
  29. user++;
  30. }
  31. if ( (EUROgameType == EURO_network_game || EUROgameType == EURO_wireplay )
  32. && user==0 )
  33. {
  34. UserList[user].control = cntrl;
  35. user = 1;
  36. }
  37. return(user);
  38. }
  39. //********************************************************************************************************************************
  40. char CalculateMaxPlayers()
  41. {
  42. char players = 0;
  43. for ( char p=0; p<16 ; p++ )
  44. {
  45. if (CtrlFlags[p] == Usable)
  46. players++;
  47. }
  48. return(players);
  49. }
  50. //********************************************************************************************************************************
  51. void SetupMouseLimits( int Xmin, int Xmax, int Ymin, int Ymax )
  52. {
  53. if ( MouseDriverInstalled != 0 )
  54. {
  55. union REGS rg;
  56. rg.x.ecx = Xmin;
  57. rg.x.edx = Xmax;
  58. rg.x.eax = 7;
  59. int386(0x33,&rg,&rg);
  60. rg.x.ecx = Ymin;
  61. rg.x.edx = Ymax;
  62. rg.x.eax = 8;
  63. int386(0x33,&rg,&rg);
  64. }
  65. }
  66. //********************************************************************************************************************************
  67. char SetupControlMethods()
  68. {
  69. for ( char m=0; m<16 ; m++ )
  70. {CtrlFlags[m] = Unusable;}
  71. char user = 0;
  72. // ***> Configure KEYBOARD 1
  73. CtrlFlags[EuroKeyboard1] = Usable;
  74. user = InitialiseUser( user, EuroKeyboard1 );
  75. if (EUROverbose)
  76. printf ("þ Keyboard 1 initialised.\n");
  77. // ***> Configure KEYBOARD 2
  78. CtrlFlags[EuroKeyboard2] = Usable;
  79. user = InitialiseUser( user, EuroKeyboard2 );
  80. if (EUROverbose)
  81. printf ("þ Keyboard 2 initialised.\n");
  82. // ***> Configure JOYSTICK 1
  83. // CtrlFlags[EuroJoystick1] = Usable;
  84. // user = InitialiseUser( user, EuroJoystick1 );
  85. //
  86. // if (EUROverbose)
  87. // printf ("þ Joystick 1 initialised.\n");
  88. //
  89. // ***> Configure JOYSTICK 2
  90. // ***> Configure MOUSE
  91. union REGS rg;
  92. rg.x.eax = 0;
  93. int386(0x33,&rg,&rg);
  94. if ( (MouseDriverInstalled = rg.h.al) != 0 )
  95. {
  96. CtrlFlags[EuroMouse] = Usable;
  97. SetupMouseLimits( 0, 626, 1, 452 );
  98. user = InitialiseUser( user, EuroMouse);
  99. }
  100. if ( MouseDriverInstalled == 0 )
  101. {
  102. if (EUROverbose)
  103. printf ("þ Mouse Driver not found.\n");
  104. }
  105. else
  106. {
  107. if (EUROverbose)
  108. printf ("þ Mouse Driver found and initialised.\n");
  109. }
  110. // ***> Configure LOGITECH PAD
  111. return ( CalculateMaxPlayers() );
  112. }
  113. //********************************************************************************************************************************
  114. float WhichButton(short button, float var )
  115. {
  116. if ( button == LEFT_BUTTON )
  117. return(-var);
  118. else
  119. return(var);
  120. }
  121. //********************************************************************************************************************************
  122. void GetConsoleInput()
  123. {
  124. if ( MouseDriverInstalled != 0 )
  125. {
  126. short buttons;
  127. union REGS inregs, outregs;
  128. inregs.w.ax = 3;
  129. int386(0x33, &inregs, &outregs);
  130. SelectorXcoord = outregs.w.cx;
  131. SelectorYcoord = outregs.w.dx;
  132. buttons = outregs.w.bx;
  133. if ( DeBounce == 0 )
  134. ButtonState = buttons;
  135. else
  136. {
  137. ButtonState = 0;
  138. if ( buttons == 0 )
  139. DeBounce = 0;
  140. }
  141. }
  142. }
  143. //********************************************************************************************************************************