EURO_INT.CPP 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include "eurodefs.h"
  5. #include "euro_sym.h"
  6. #include "euro_def.h"
  7. #include "euro_int.h"
  8. #include "euro_mem.h"
  9. #include "euro_dsk.h"
  10. #include "euro_spt.h"
  11. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  12. //º º
  13. //º EURO 96 LINK DATA º
  14. //º º
  15. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  16. interface_data EUROmatch_info;
  17. extern char EUROsymbol;
  18. extern BYTE *TextStringMemHandle;
  19. extern void Euro96initialise();
  20. extern char EUROteamA, EUROteamB;
  21. extern void TransferDataToMatchInfo();
  22. void TempFrontend()
  23. {
  24. EUROsymbol = 1;
  25. TextStringMemHandle = 0;
  26. TextStringMemHandle = // Set up memory handle.
  27. AllocateTextStringMemory(); // Allocate memory for text strings..
  28. printf ("þ %d Bytes allocated for script file text.\n", TEXT_STRING_BUFFER_LEN);
  29. fflush(stdout);
  30. if ( EUROsymbol == 1 )
  31. {
  32. printf ("þ Symbol creation flag set.\n");
  33. fp2=fopen( "euro_sym.h", "wb" );
  34. if(fp2==NULL)
  35. {
  36. EUROsymbol = 0;
  37. printf ("þ Error trying to create symbol table.\n");
  38. fflush(stdout);
  39. }
  40. }
  41. process_script_file("..\\script\\script.96"); // Reads script file and compiles relevent data for game.
  42. if ( EUROsymbol == 1 )
  43. {
  44. fclose(fp2);
  45. printf ("þ Symbol table created.\n");
  46. fflush(stdout);
  47. }
  48. Euro96initialise();
  49. // additions for laurent.
  50. strcpy( &EUROmatch_info.TeamAname[0], GetTEAMname( 0, 11) );
  51. strcpy( &EUROmatch_info.TeamBname[0], GetTEAMname( 1, 11) );
  52. for ( char t=0; t < 16; t++ ) // Reset all squads, making team
  53. {for ( char p=0; p < 20; p++ ){SquadInfo[ (t*20)+p ] = p;}} // lists run from plyr 1 to 20.
  54. TransferDataToMatchInfo();
  55. // ------------------------------------
  56. }
  57. void ExitFrontend()
  58. {
  59. DeAllocateMemory(TextStringMemHandle);
  60. }
  61. //********************************************************************************************************************************
  62. void TransferDataToMatchInfo()
  63. {
  64. short PlyrIndex1, PlyrIndex2;
  65. for (char p=0; p<20; p++)
  66. {
  67. PlyrIndex1 = NormalisePlayer( p, EUROteamA );
  68. PlyrIndex2 = NormalisePlayer( p, EUROteamB );
  69. EUROmatch_info.TeamA[p].pace = Pace[ PlyrIndex1 ];
  70. EUROmatch_info.TeamA[p].power = Power[ PlyrIndex1 ];
  71. EUROmatch_info.TeamA[p].control = Control[ PlyrIndex1 ];
  72. EUROmatch_info.TeamA[p].flair = Flair[ PlyrIndex1 ];
  73. EUROmatch_info.TeamA[p].vision = Vision[ PlyrIndex1 ];
  74. EUROmatch_info.TeamA[p].accuracy = Accuracy[ PlyrIndex1 ];
  75. EUROmatch_info.TeamA[p].stamina = Stamina[ PlyrIndex1 ];
  76. EUROmatch_info.TeamA[p].discipline = Discipline[ PlyrIndex1 ];
  77. EUROmatch_info.TeamA[p].fitness = Fitness[ PlyrIndex1 ];
  78. EUROmatch_info.TeamB[p].pace = Pace[ PlyrIndex2 ];
  79. EUROmatch_info.TeamB[p].power = Power[ PlyrIndex2 ];
  80. EUROmatch_info.TeamB[p].control = Control[ PlyrIndex2 ];
  81. EUROmatch_info.TeamB[p].flair = Flair[ PlyrIndex2 ];
  82. EUROmatch_info.TeamB[p].vision = Vision[ PlyrIndex2 ];
  83. EUROmatch_info.TeamB[p].accuracy = Accuracy[ PlyrIndex2 ];
  84. EUROmatch_info.TeamB[p].stamina = Stamina[ PlyrIndex2 ];
  85. EUROmatch_info.TeamB[p].discipline = Discipline[ PlyrIndex2 ];
  86. EUROmatch_info.TeamB[p].fitness = Fitness[ PlyrIndex2 ];
  87. }
  88. }
  89. //********************************************************************************************************************************
  90. short NormalisePlayer( char plyr, char team )
  91. {
  92. short PlyrIndex, P;
  93. P = (team*20)+plyr;
  94. PlyrIndex = (team*20)+SquadInfo[ P ];
  95. return(PlyrIndex);
  96. }
  97. //********************************************************************************************************************************
  98. char *GetTEXT( short StringNumber )
  99. {
  100. return( (char *)Text[ StringNumber ] );
  101. }
  102. //********************************************************************************************************************************
  103. char *GetPLAYERSname( char player, char team, char format )
  104. {
  105. short Prefix = (team*20)+player;
  106. char *Search = GetTEXT( PLYR_NMES+Prefix );
  107. char NAMEoffset = 0;
  108. char Searchlen = strlen(&Search[0]);
  109. unsigned char c;
  110. if ( format == FULL_NAME )
  111. {
  112. for ( char x=0; x < Searchlen ; x++ )
  113. {StringBuffer[x] = *(Search+x);}
  114. StringBuffer[x] = 0;
  115. }
  116. if ( format == INITIAL_SURNAME )
  117. {
  118. // *** Get players initials ***
  119. for ( char x=0; x < Searchlen ; x++ )
  120. {
  121. if ( IsUpper[ *(Search+x) ] == up &&
  122. IsUpper[ *(Search+(x+1)) ] == lw &&
  123. NAMEoffset < (NAME_BUFFER_LEN-3) )
  124. {
  125. StringBuffer[NAMEoffset] = *(Search+x);
  126. NAMEoffset++;
  127. if ((*(Search+x))=='-')
  128. StringBuffer[NAMEoffset] = '-';
  129. else
  130. StringBuffer[NAMEoffset] = '.';
  131. StringBuffer[NAMEoffset+1] = 32;
  132. NAMEoffset+= 2;
  133. }
  134. if ((*(Search+x))=='-' && NAMEoffset >1 )
  135. {
  136. StringBuffer[NAMEoffset-2] = '-';
  137. NAMEoffset--;
  138. }
  139. }
  140. }
  141. if ( format == INITIAL_SURNAME || format == SURNAME )
  142. {
  143. // *** Get players surname ***
  144. for ( char y=0; y < Searchlen ; y++ )
  145. {
  146. if ( IsUpper[ *(Search+y) ] == up &&
  147. IsUpper[ *(Search+(y+1)) ] == up &&
  148. NAMEoffset < (NAME_BUFFER_LEN-3) )
  149. {
  150. StringBuffer[NAMEoffset] = *(Search+y);
  151. // if ( (IsUpper[ *(Search+(y-1) ) ] == up && y>0) &&
  152. // NamePREFIXtbl[Prefix] == 1 &&
  153. // ( (StringBuffer[NAMEoffset-1]!='c' ||
  154. // StringBuffer[NAMEoffset-2]!='M' && NAMEoffset>1 ) ) )
  155. // {
  156. // c = StringBuffer[NAMEoffset];
  157. // StringBuffer[NAMEoffset] = ToLower[c];
  158. // }
  159. if ( (IsUpper[ *(Search+(y-1) ) ] == up && y>0) )
  160. {
  161. c = StringBuffer[NAMEoffset];
  162. if ( ( StringBuffer[NAMEoffset-2]=='M' &&
  163. StringBuffer[NAMEoffset-1]=='c' &&
  164. NAMEoffset>1 && NamePREFIXtbl[Prefix] == 1 )
  165. )
  166. c = StringBuffer[NAMEoffset];
  167. else
  168. {
  169. c = StringBuffer[NAMEoffset];
  170. StringBuffer[NAMEoffset] = ToLower[c];
  171. }
  172. }
  173. NAMEoffset++;
  174. }
  175. else
  176. if ( IsUpper[ *(Search+y) ] == up &&
  177. IsUpper[ *(Search+(y-1)) ] == up &&
  178. NAMEoffset < (NAME_BUFFER_LEN-3) && y>0 )
  179. {
  180. StringBuffer[NAMEoffset] = *(Search+y);
  181. if ( IsUpper[ *(Search+(y-1)) ] == up && y>0 )
  182. {
  183. c = StringBuffer[NAMEoffset];
  184. StringBuffer[NAMEoffset] = ToLower[c];
  185. }
  186. NAMEoffset++;
  187. if ( (*(Search+(y+1)))==' ')
  188. {
  189. StringBuffer[NAMEoffset] = 32;
  190. NAMEoffset++;
  191. }
  192. }
  193. }
  194. StringBuffer[NAMEoffset] = 0; // end of line.
  195. }
  196. return ( &StringBuffer[0] );
  197. }
  198. //********************************************************************************************************************************