EURO_SQD.CPP 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include <conio.h>
  5. #include "eurodefs.h"
  6. #include "euro_fxd.h"
  7. #include "euro.equ"
  8. #include "euro_sym.h"
  9. #include "euro_def.h"
  10. #include "euro_var.h"
  11. #include "euro_grf.h"
  12. #include "euro_dsk.h"
  13. #include "euro_gen.h"
  14. #include "euro_cnt.h"
  15. #include "euro_int.h"
  16. #include "defines.h"
  17. void RedrawSquadPanel();
  18. void ReplaceSquadBuffers( char );
  19. //********************************************************************************************************************************
  20. void DisplayFormation( char AddToList )
  21. {
  22. int ball, shadow, player, width, height;
  23. float x,y, snapx, shadx, shady;
  24. float yscale, xscale, ysize, xdiff, wthscale;
  25. int bscale;
  26. // ***** DISPLAY FORMATION TYPE AT FOOT OF SCREEN ******
  27. char *temp = GetTEXT( ((int)FormationInfo[Team] + FORM_LIST ));
  28. Image_Widths[INFO_NBAR+Lft] = Image_Widths[INFO_NBAR+Rgt]+FORMATION_BAR_WIDTH;
  29. // DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN,
  30. // INFO_NBAR+Lft, NameBarXposn, 426, FORMATION_infoBOX, spritecopy );
  31. // DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  32. // INFO_NBAR+Lft, NameBarXposn, 426, FORMATION_infoBOX, spritecopy );
  33. // DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN,
  34. // INFO_NBAR+Rgt, NameBarXposn+Image_Widths[INFO_NBAR+Lft],
  35. // 426, FORMATION_infoBOX, spritecopy );
  36. // if (Bounding_table[FORMATION_stringBOX].BoundingBoxLeft != -1 )
  37. //
  38. // CopyFromBACKtoPSEUDObuffer(
  39. // &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  40. // Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  41. // Bounding_table[FORMATION_stringBOX].BoundingBoxTop,
  42. // Bounding_table[FORMATION_stringBOX].BoundingBoxRight -
  43. // Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  44. // Bounding_table[FORMATION_stringBOX].BoundingBoxBottom -
  45. // Bounding_table[FORMATION_stringBOX].BoundingBoxTop);
  46. //
  47. DisplayString( NameBarXposn+38, //Image_Widths[INFO_NBAR+Lft]-48,
  48. 430, &temp[0],
  49. LARGE_FONT, 62,
  50. FORMATION_stringBOX,
  51. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  52. AddToDumpList( Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  53. Bounding_table[FORMATION_stringBOX].BoundingBoxTop,
  54. Bounding_table[FORMATION_stringBOX].BoundingBoxRight -
  55. Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  56. Bounding_table[FORMATION_stringBOX].BoundingBoxBottom -
  57. Bounding_table[FORMATION_stringBOX].BoundingBoxTop);
  58. // ****** DISPLAY FORMATION LOTTO BALLS ONTO FORMATION PITCH *****
  59. for ( signed int s=9; s>-1; s -- )
  60. {
  61. player = (SquadInfo[(Team*20)+(s+1) ]);
  62. ball = player+FORM_IMGS;
  63. // get y-coord of ball.
  64. ysize = ((float) PITCH_YPOS_BL-PITCH_YPOS_TL); // size of formation pitch in y.
  65. yscale = (1280/2) / ysize; // scale down tactic y pos.
  66. y = (float) (TeamTactics[ (32*2)+5 ][s][0] / yscale ); // get actual formation y pos.
  67. // get x difference for each y pixel up formation pitch. (0.829114).
  68. xdiff = ( (float) (((PITCH_XPOS_BR-PITCH_XPOS_BL) - (PITCH_XPOS_TR-PITCH_XPOS_TL)) / ysize));
  69. wthscale= ( (float) ( (PITCH_XPOS_BR-PITCH_XPOS_BL) - ((int)y) * xdiff) );
  70. // calculate x scale for each pixel.
  71. xscale = ( (float) ( (PITCH_XPOS_BR-PITCH_XPOS_BL) / wthscale) );
  72. // calculate converted formation x-coord.
  73. if ( (TeamTactics[ (32*2)+5 ][s][1] & 31) > 15 )
  74. snapx = ( (TeamTactics[ (32*2)+5 ][s][1] & 0xffe0) +32 );
  75. else
  76. snapx = (TeamTactics[ (32*2)+5 ][s][1] & 0xffe0);
  77. x = (float) ( (snapx / ( 800.0 / (PITCH_XPOS_BR-PITCH_XPOS_BL) ) )
  78. / xscale );
  79. bscale = ( (ysize-y) / ( ( PITCH_YPOS_BL - PITCH_YPOS_TL ) /6) );
  80. ball+= (bscale*20);
  81. shadow = FBAL_SHDS+bscale;
  82. shady = ( (ysize-y)+PITCH_YPOS_TL );
  83. y = shady - Image_Heights[ball];
  84. x = ( x+PITCH_XPOS_BL) - (Image_Widths[ball] /2 );
  85. x = ( x+ ((PITCH_XPOS_BR-PITCH_XPOS_BL) - (wthscale)) /2 );
  86. shady+= (Image_Heights[shadow]/2);
  87. DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN,
  88. shadow,
  89. (int)x, (int)shady, s+21,
  90. spritefilter); // shadow filter for formation lotto balls.
  91. DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN,
  92. ball,
  93. (int)x, (int)y, s+21,
  94. spritecopy ); // formation lotto balls.
  95. if ( AddToList != NULL )
  96. {
  97. width = Bounding_table[s+21].BoundingBoxRight -
  98. Bounding_table[s+21].BoundingBoxLeft;
  99. height = Bounding_table[s+21].BoundingBoxBottom -
  100. Bounding_table[s+21].BoundingBoxTop;
  101. AddToDumpList(
  102. Bounding_table[s+21].BoundingBoxLeft,
  103. Bounding_table[s+21].BoundingBoxTop,
  104. width, height );
  105. }
  106. }
  107. player = (SquadInfo[(Team*20)]);
  108. ball = player+FORM_IMGS+(5*20);
  109. DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN,
  110. FBAL_SHDS+5,
  111. (int) ((PITCH_XPOS_BR-PITCH_XPOS_BL)/2) - (Image_Widths[ball] /2) + PITCH_XPOS_BL,
  112. (int) PITCH_YPOS_BR-8+(Image_Heights[FBAL_SHDS+5]/2),
  113. 32,
  114. spritefilter);
  115. DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN,
  116. ball,
  117. (int) ((PITCH_XPOS_BR-PITCH_XPOS_BL)/2) - (Image_Widths[ball] /2) + PITCH_XPOS_BL,
  118. (int) PITCH_YPOS_BR-8-Image_Heights[ball],
  119. 32,
  120. spritecopy );
  121. }
  122. //********************************************************************************************************************************
  123. void ClearFormationMarkers()
  124. {
  125. short width;
  126. short height;
  127. for ( int b=21; b < 33; b++ )
  128. {
  129. width = Bounding_table[b].BoundingBoxRight -
  130. Bounding_table[b].BoundingBoxLeft;
  131. height = Bounding_table[b].BoundingBoxBottom -
  132. Bounding_table[b].BoundingBoxTop;
  133. CopyFromBACKtoPSEUDObuffer(
  134. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  135. Bounding_table[b].BoundingBoxLeft,
  136. Bounding_table[b].BoundingBoxTop,
  137. width, height );
  138. AddToDumpList(
  139. Bounding_table[b].BoundingBoxLeft,
  140. Bounding_table[b].BoundingBoxTop,
  141. width, height );
  142. Bounding_table[b].BoundingBoxLeft = -1;
  143. Bounding_table[b].BoundingBoxRight = -1;
  144. Bounding_table[b].BoundingBoxTop = -1;
  145. Bounding_table[b].BoundingBoxBottom = -1;
  146. }
  147. width = Bounding_table[FORMATION_stringBOX].BoundingBoxRight -
  148. Bounding_table[FORMATION_stringBOX].BoundingBoxLeft;
  149. height = Bounding_table[FORMATION_stringBOX].BoundingBoxBottom -
  150. Bounding_table[FORMATION_stringBOX].BoundingBoxTop;
  151. CopyFromBACKtoPSEUDObuffer(
  152. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  153. Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  154. Bounding_table[FORMATION_stringBOX].BoundingBoxTop,
  155. width, height );
  156. AddToDumpList(
  157. Bounding_table[FORMATION_stringBOX].BoundingBoxLeft,
  158. Bounding_table[FORMATION_stringBOX].BoundingBoxTop,
  159. width, height );
  160. }
  161. //********************************************************************************************************************************
  162. int FormationLabels[]={
  163. // 3-1-6
  164. FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw,
  165. FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb,
  166. // 4-0-6
  167. FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw, FRPS_LBLE+Fw,
  168. FRPS_LBLE+Fw, FRPS_LBLE+Sb, FR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_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb,
  190. // 6-3-1
  191. FRPS_LBLE+Gk, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Df, FRPS_LBLE+Md, FRPS_LBLE+Md, FRPS_LBLE+Md,
  192. FRPS_LBLE+Fw, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb, FRPS_LBLE+Sb,
  193. };
  194. void DisplayPositionLabels()
  195. {
  196. char *string;
  197. short PlyrIndex, Plyr;
  198. for ( char s=0; s < 20; s ++ )
  199. {
  200. PlyrIndex = NormalisePlayer( s, Team );
  201. // get field position label if nessesary.
  202. string = GetTEXT ( FRPS_LBLE+Dr );
  203. // get substitute label if nessesary.
  204. if ( s < (11+NoOfSubs) )
  205. string = GetTEXT ( FormationLabels[ (s+(20*FormationInfo[Team])) ] );
  206. // get injured label if nessesary.
  207. if ( Fitness[PlyrIndex] < Injured )
  208. string = GetTEXT ( FRPS_LBLE+In );
  209. // get banned label if nessesary.
  210. if ( DiscPts[PlyrIndex] > 1 )
  211. string = GetTEXT ( FRPS_LBLE+Bn );
  212. DisplayString( 497-(PixelLengthOfString( string , SMALL_FONT) ) /2,
  213. (103+(s*18)), string,
  214. SMALL_FONT, SELECT_COLOUR, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  215. }
  216. }
  217. //********************************************************************************************************************************
  218. void DisplaySquad()
  219. {
  220. int PAL;
  221. short PlyrIndex;
  222. DisplayPositionLabels();
  223. for ( char s=0; s < 20; s ++ )
  224. {
  225. PlyrIndex = NormalisePlayer( s, Team );
  226. if ( DiscPts[PlyrIndex] > 1 || Fitness[PlyrIndex] < Injured )
  227. PAL = SELECT_COLOUR;
  228. else
  229. PAL = 48;
  230. DisplayString( (500+21)-(PixelLengthOfString( GetTEXT( SQUD_NMBS+SquadInfo[ (Team*20)+s ]) ,SMALL_FONT) ) /2,
  231. (103+(s*18)), ( GetTEXT (SQUD_NMBS+SquadInfo[ (Team*20)+s ])) ,
  232. SMALL_FONT, 24, s, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  233. DisplayString( (515+21),(103+(s*18)),
  234. ( GetPLAYERSname( SquadInfo[ (Team*20)+s ], Team, INITIAL_SURNAME )) ,
  235. SMALL_FONT, PAL, s, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  236. Bounding_table[s].BoundingBoxRight = 639;
  237. MarkPlayer = -1;
  238. SquadBuffer1yposn = -1;
  239. }
  240. }
  241. //********************************************************************************************************************************
  242. void DoSquadSelection( char MENU, signed char BOX, short xposn, short yposn )
  243. {
  244. if ( (MENU == SQUAD_SELECT || MENU == PLAYER_STATS) && LogicState == RUN_FRONTEND)
  245. {
  246. // display name of player being dragged into new position
  247. if (MarkPlayer!=-1)
  248. {
  249. SetupMouseLimits( 472, 626, 16, 452 );
  250. if ( ButtonState!=0 && ( BOX==MarkPlayer || BOX==-1 ) )
  251. {
  252. RedrawSquadPanel();
  253. MarkPlayer = -1;
  254. DeBounce = TRUE;
  255. }
  256. }
  257. else
  258. SetupMouseLimits( 0, 626, 1, 452 );
  259. if ( MarkPlayer != -1 )
  260. {
  261. SquadBuffer1yposn = yposn-6;
  262. StorePSEUDObuffer( &FrontendPseudoDEFN, &FrontendTextureDEFN, DRAG_STOREbuff, 515, SquadBuffer1yposn );
  263. DisplayString( 515+21, SquadBuffer1yposn,
  264. ( GetPLAYERSname( SquadInfo[ (Team*20)+MarkPlayer ], Team, INITIAL_SURNAME )) ,
  265. SMALL_FONT, MOVE_COLOUR, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  266. AddToDumpList( 515, SquadBuffer1yposn,
  267. Image_Widths[DRAG_STOREbuff], Image_Heights[DRAG_STOREbuff]
  268. );
  269. }
  270. // *** choose a player from squad list. ***
  271. if ( (MarkPlayer == -1) && (BOX != NO_BOX) && (BOX < 20) && (ButtonState==LEFT_BUTTON) )
  272. {
  273. MarkPlayer = BOX;
  274. DisplayString( 515+21, (103+(MarkPlayer*18)),
  275. ( GetPLAYERSname( SquadInfo[ (Team*20)+MarkPlayer ], Team, INITIAL_SURNAME )) ,
  276. SMALL_FONT, SELECT_COLOUR, MarkPlayer, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  277. AddToDumpList( 515+21, (103+(MarkPlayer*18)), 149, 18 );
  278. DeBounce = TRUE;
  279. }
  280. else
  281. if (MarkPlayer != -1 && ButtonState == RIGHT_BUTTON && BOX < 20 )
  282. {
  283. RedrawSquadPanel();
  284. MarkPlayer = -1;
  285. SquadBuffer1yposn = -1;
  286. ButtonState = 0;
  287. DeBounce = TRUE;
  288. }
  289. // Stop User From Viewing Stats Of Player Already Displayed
  290. if ( MarkPlayer != -1 && (NormalisePlayer(MarkPlayer, Team)) == ViewPlyrStats
  291. && yposn<100 && MENU == PLAYER_STATS)
  292. {
  293. ReplaceSquadBuffers(Menu);
  294. RedrawSquadPanel();
  295. MarkPlayer = -1;
  296. }
  297. if ( MarkPlayer != -1 &&
  298. BOX != NO_BOX &&
  299. BOX < 20 &&
  300. BOX != MarkPlayer &&
  301. ButtonState==LEFT_BUTTON )
  302. {
  303. short PlyrIndex1 = NormalisePlayer( BOX, Team );
  304. short PlyrIndex2 = NormalisePlayer( MarkPlayer, Team );
  305. if ( DiscPts[ PlyrIndex1 ] < 2 &&
  306. DiscPts[ PlyrIndex2 ] < 2 &&
  307. Fitness[ PlyrIndex1 ] > Injured &&
  308. Fitness[ PlyrIndex2 ] > Injured )
  309. {
  310. char p;
  311. p = SquadInfo[ (Team*20)+MarkPlayer ];
  312. SquadInfo[ (Team*20)+MarkPlayer ] = SquadInfo[ (Team*20)+BOX ];
  313. SquadInfo[ (Team*20)+BOX ] = p;
  314. RedrawSquadPanel();
  315. MarkPlayer = -1;
  316. SquadBuffer1yposn = -1;
  317. DeBounce = TRUE;
  318. if ( MENU == SQUAD_SELECT )
  319. {
  320. ClearFormationMarkers();
  321. DisplayFormation( NULL );
  322. }
  323. }
  324. }
  325. if ( BOX == OPPONENT_TEAM_BOX && ButtonState!=0 && MENU == SQUAD_SELECT )
  326. {
  327. EUROteamView++;
  328. Team = ConfigureTeamView();
  329. if ( ButtonState != 0 )
  330. Animation_table[ViewTeamHandle].AnimationSpeed =
  331. WhichButton( ButtonState, 1.25);
  332. ChangeMenu = SQUAD_SELECT;
  333. DeBounce = TRUE;
  334. }
  335. if ( (BOX == QUESTION_BOX && MarkPlayer != -1 && ButtonState!=0 && MENU == SQUAD_SELECT) ||
  336. (BOX == QUESTION_BOX && MarkPlayer != -1 &&
  337. (NormalisePlayer(MarkPlayer, Team)) != ViewPlyrStats && ButtonState!=0
  338. && MENU == PLAYER_STATS) )
  339. {
  340. ViewPlyrStats = NormalisePlayer( MarkPlayer, Team );
  341. ChangeMenu = PLAYER_STATS;
  342. DeBounce = TRUE;
  343. }
  344. if ( (BOX == QUESTION_BOX && MarkPlayer == -1 && ButtonState!=0 && MENU == SQUAD_SELECT) ||
  345. (BOX == QUESTION_BOX && MarkPlayer == -1 && ButtonState!=0 && MENU == PLAYER_STATS) )
  346. {
  347. EUROstatTeam = Team;
  348. ChangeMenu = TEAM_STATS;
  349. DeBounce = TRUE;
  350. }
  351. if ( BOX == FORMATION_BOX && ButtonState != 0 && MENU == SQUAD_SELECT )
  352. {
  353. ClearFormationMarkers();
  354. if ( ButtonState == LEFT_BUTTON )
  355. FormationInfo[Team]--;
  356. else
  357. FormationInfo[Team]++;
  358. if ( FormationInfo[Team] < 0 )
  359. FormationInfo[Team] = 9;
  360. if ( FormationInfo[Team] > 9 )
  361. FormationInfo[Team] = 0;
  362. LoadTactics( ((int)FormationInfo[Team]), "..\\data\\euro.dat", &TeamTactics[0][0][0] );
  363. DisplayFormation( 1 );
  364. CopyFromBACKtoPSEUDObuffer(
  365. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  366. 484, 102, 25, 361 );
  367. AddToDumpList( 488, 102, 25, 361 );
  368. DisplayPositionLabels();
  369. if ( ButtonState == LEFT_BUTTON )
  370. Animation_table[FormationHandle].AnimationSpeed = -1.25;
  371. else
  372. Animation_table[FormationHandle].AnimationSpeed = 1.25;
  373. MarkPlayer = -1;
  374. DeBounce = TRUE;
  375. }
  376. if ( BOX == RETURN_SQUAD_BOX && ButtonState != 0 && MENU == SQUAD_SELECT )
  377. {
  378. Animation_table[ReturnSqdHandle].AnimationSpeed =
  379. WhichButton( ButtonState, 1.25);
  380. DeBounce = TRUE;
  381. if ( EUROgameType != EURO_championship )
  382. ChangeMenu = TEAM_SELECT;
  383. else
  384. ChangeMenu = NEXT_MATCH;
  385. }
  386. }
  387. }
  388. //********************************************************************************************************************************
  389. void RedrawSquadPanel()
  390. {
  391. CopyFromBACKtoPSEUDObuffer(
  392. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  393. 488+21, 100, 131, 364 );
  394. DisplaySquad();
  395. AddToDumpList( 488+21, 100, 131, 364 );
  396. }
  397. //********************************************************************************************************************************
  398. void ReplaceSquadBuffers( char MENU )
  399. {
  400. if ( MENU == SQUAD_SELECT || MENU == PLAYER_STATS )
  401. {
  402. if ( SquadBuffer1yposn!=-1 )
  403. {
  404. DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN, DRAG_STOREbuff, 515,
  405. SquadBuffer1yposn, NO_BOX, straightcopy );
  406. AddToDumpList(
  407. 515,
  408. SquadBuffer1yposn,
  409. Image_Widths[DRAG_STOREbuff],
  410. Image_Heights[DRAG_STOREbuff]
  411. );
  412. SquadBuffer1yposn = -1;
  413. }
  414. }
  415. }
  416. //********************************************************************************************************************************
  417. void DoInjuriesAndMatchBans( char GAMEtype, char Team )
  418. {
  419. char LastPlyr, Swapped;
  420. short PlyrIndex, Plyr;
  421. // if ( GAMEtype == EURO_championship )
  422. {
  423. LastPlyr = 19;
  424. Swapped = 1;
  425. while ( Swapped !=0 )
  426. {
  427. // **** Find A Spot At The End Of The Squad List For Player To Be Swapped Into ****
  428. PlyrIndex = NormalisePlayer( LastPlyr, Team );
  429. if ( DiscPts[PlyrIndex] > 1 || Fitness[PlyrIndex] < Injured )
  430. {
  431. LastPlyr--;
  432. if ( LastPlyr < 1 ) // **** checked all available players so bomb out and leave player
  433. Swapped = 0; // were he is ****
  434. }
  435. else
  436. {
  437. for ( char s=0; s < 11; s ++ )
  438. {
  439. Swapped = 0;
  440. PlyrIndex = NormalisePlayer( s, Team );
  441. if ( DiscPts[PlyrIndex] > 1 || Fitness[PlyrIndex] < Injured )
  442. {
  443. char p = SquadInfo[ (Team*20)+s ];
  444. SquadInfo[ (Team*20)+s ] = SquadInfo[ (Team*20)+LastPlyr ];
  445. SquadInfo[ (Team*20)+LastPlyr ] = p;
  446. Swapped = 1;
  447. // **** Was This An Ideal Swap ****
  448. // if ( PlayerPosns[ (Team*20)+s ] != PlayerPosns[ (Team*20)+LastPlyr ] )
  449. // {
  450. // }
  451. }
  452. }
  453. }
  454. }
  455. }
  456. }
  457. //********************************************************************************************************************************