EURO_USR.CPP 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193
  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_cnt.h"
  12. #include "euro_grf.h"
  13. #include "euro_gen.h"
  14. #include "euro_net.h"
  15. #include "euro_int.h"
  16. #include "defines.h"
  17. char LegaliseUserCntrlSelection( char, signed char );
  18. char LegaliseUserPlyrSelection( char, char);
  19. void DisplayNETinfo();
  20. void BuildNETuserTable();
  21. void DisplayUserTags( char, short, char );
  22. //********************************************************************************************************************************
  23. char FindNumberOfMatchUsers()
  24. {
  25. char users = 0;
  26. for (char u=0; u<EUROnoOfMatchPlyrs; u++)
  27. {
  28. if ( UserList[u].team == EUROteamA || UserList[u].team == EUROteamB )
  29. users++;
  30. }
  31. return(users);
  32. }
  33. //********************************************************************************************************************************
  34. void DisplayUserPanels( char gametype )
  35. {
  36. if ( gametype != EURO_championship )
  37. {
  38. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  39. SMLL_GOTH+EUROteamA, 192, 240, NO_BOX, spritecopy );
  40. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  41. PSBX_PANL, 278, 232, NO_BOX, spritecopy );
  42. svalue = 16;
  43. pmin = 16;
  44. pmax = 32;
  45. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  46. SMLL_GOTH+EUROteamB, 456, 240, NO_BOX, spriteareainccopy );
  47. }
  48. else
  49. {
  50. EUROchampTeam = UserList[EUROplyrSetup].team;
  51. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  52. PLRG_GSHD, 337, 238, NO_BOX, spritecopy );
  53. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  54. PLRG_GOTH+EUROchampTeam, 333, 234, NO_BOX, spritecopy );
  55. }
  56. }
  57. //********************************************************************************************************************************
  58. void InitNetUserSelection()
  59. {
  60. if ( ( EUROgameType == EURO_network_game || EUROgameType == EURO_wireplay )
  61. && EUROoveride == 0 )
  62. UserList[0].player = PLYR_NOT_CHOSEN;
  63. }
  64. //********************************************************************************************************************************
  65. void ResetUsers()
  66. {
  67. for ( char u=0; u < 16; u ++ )
  68. {
  69. UserList[u].team = 0;
  70. UserList[u].player = AUTOPLAYER;
  71. UserList[u].control = -1;
  72. }
  73. }
  74. //********************************************************************************************************************************
  75. void ClearNetUserList()
  76. {
  77. for ( char u=0; u < 24; u ++ )
  78. { UserNetList[u] = 0; }
  79. UserNetList[0] = 1;
  80. UserNetList[12] = 1;
  81. }
  82. //********************************************************************************************************************************
  83. void DisplayUserSetupButtons( signed char n )
  84. {
  85. OVERRIDEpal1 = 48;
  86. OVERRIDEpal2 = 62;
  87. if ( EUROgameType == EURO_friendly || EUROgameType == EURO_championship )
  88. {
  89. TeamSelectHandle= AddAnimation( 516, 434,
  90. ( (float)BUTN_BLUE ), ( (float)BUTN_WHBL+11.9 ),
  91. 0.0, TEAM_SELECT_BOX, CONT_ANIM );
  92. TeamSelectHighlight = ControlOptionHighlight( -1, TEAM_SELECT_BOX,
  93. TEAM_SELECTdisp_BOX, -1,
  94. TeamSelectHandle, BUTN_LBLS+Done );
  95. }
  96. if ( EUROgameType == EURO_network_game || EUROgameType == EURO_wireplay )
  97. //&& n == PLYR_NOT_CHOSEN && UserList[0].player != PLYR_NOT_CHOSEN )
  98. {
  99. NetStartHandle = AddAnimation( 516, 300,
  100. ( (float)BUTN_BLUE ), ( (float)BUTN_WHBL+11.9 ),
  101. 0.0, NET_START_BOX, RUN_ONCE );
  102. NetStartHighlight = ControlOptionHighlight( -1, NET_START_BOX,
  103. NET_STARTdisp_BOX, -1, NetStartHandle, BUTN_LBLS+Done );
  104. }
  105. }
  106. //********************************************************************************************************************************
  107. void TranslateUserSelections()
  108. {
  109. char plyr;
  110. if ( EUROgameType != EURO_championship )
  111. {
  112. for ( char u=0; u < 16; u ++ )
  113. {
  114. if ( UserList[u].TeamHAflag == 0 )
  115. UserList[u].team = EUROteamA;
  116. else
  117. UserList[u].team = EUROteamB;
  118. }
  119. }
  120. for ( char p=0; p < EUROmaxPlayers; p ++ )
  121. {
  122. plyr = AUTOPLAYER;
  123. for ( char s=0; s < 11; s ++ )
  124. {
  125. if ( (SquadInfo[ (UserList[p].team*20)+s]) == UserList[p].player )
  126. plyr = UserList[p].player;
  127. }
  128. UserList[p].player = plyr;
  129. }
  130. }
  131. //********************************************************************************************************************************
  132. char GetAutoPlayers( char Team )
  133. {
  134. char autos = 0;
  135. for ( char p=0; p < EUROmaxPlayers; p ++ )
  136. {
  137. if ( UserList[p].team == Team &&
  138. UserList[p].player == AUTOPLAYER )
  139. autos++;
  140. }
  141. return(autos);
  142. }
  143. //********************************************************************************************************************************
  144. void DisplayMatchTeam( char Team, short Xposn, char box_offset, int pal, char NoPlyrs )
  145. {
  146. int PAL;
  147. char plyr;
  148. for ( char s=0; s < 11; s ++ )
  149. {
  150. plyr = SquadInfo[ (Team*20)+s ];
  151. PAL = 48;
  152. for ( char p=0; p < NoPlyrs; p ++ )
  153. {
  154. if ( UserList[p].team == Team &&
  155. UserList[p].player == plyr )
  156. {
  157. if ( UserList[ EUROplyrSetup ].team == Team &&
  158. UserList[EUROplyrSetup].player == plyr )
  159. PAL = 62;
  160. else
  161. {
  162. DisplayString( (Xposn-42)-(PixelLengthOfString( GetTEXT( UTAG_LBLS+p ), SMALL_FONT) ) /2,
  163. (242+( s * 18)), ( GetTEXT ( UTAG_LBLS+p )) ,
  164. SMALL_FONT, 55, NO_BOX, &FrontendBackgroundDEFN, &FrontendTextureDEFN );
  165. PAL = 55;
  166. }
  167. }
  168. }
  169. if ( UserNetList[s+box_offset]!=0 &&
  170. ( UserList[ 0 ].team != Team || UserList[0].player != plyr ))
  171. PAL = 55;
  172. DisplayString( (Xposn-17)-(PixelLengthOfString( GetTEXT( SQUD_NMBS+plyr ) ,SMALL_FONT) ) /2,
  173. (242+(s*18)), ( GetTEXT ( SQUD_NMBS + plyr )) ,
  174. SMALL_FONT, pal+8, s, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  175. DisplayString( Xposn,(242+(s*18)),
  176. ( GetPLAYERSname( plyr, Team, INITIAL_SURNAME )) ,
  177. SMALL_FONT, PAL, s+box_offset, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  178. }
  179. if ( UserList[ EUROplyrSetup ].team == Team &&
  180. UserList[EUROplyrSetup].player == AUTOPLAYER )
  181. PAL = 62;
  182. else
  183. PAL = 48;
  184. DisplayString( Xposn,(242+(s*18)),
  185. ( GetTEXT( AUTO_LBLE)), //AUTO_SYMB )) ,
  186. SMALL_FONT, PAL, box_offset+11, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  187. }
  188. //********************************************************************************************************************************
  189. void DisplayUserHeadings(char user)
  190. {
  191. if ( EUROgameType == EURO_friendly ||
  192. EUROgameType == EURO_championship)
  193. {
  194. DisplayString( 12, 98,
  195. GetTEXT ( PLYR_LBLS+user ),
  196. LARGE_FONT, 175, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  197. AddToDumpList( 12, 98,
  198. PixelLengthOfString( GetTEXT( PLYR_LBLS+user ), LARGE_FONT), 34 );
  199. }
  200. else
  201. {
  202. DisplayString( 12, 98,
  203. GetTEXT ( PSET_HEAD+(EUROgameType-2) ),
  204. LARGE_FONT, 175, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  205. AddToDumpList( 12, 98,
  206. PixelLengthOfString( GetTEXT ( PSET_HEAD+(EUROgameType-2)), LARGE_FONT), 34 );
  207. }
  208. }
  209. //********************************************************************************************************************************
  210. void DisplayUserLabels(char user)
  211. {
  212. DisplayString( 37, 173,
  213. GetTEXT ( USEL_LBLS+Country ),
  214. SMALL_FONT, 55, PLYR_COUNTRY_BOX, &FrontendBackgroundDEFN, &FrontendTextureDEFN );
  215. DisplayString( 37, 195,
  216. GetTEXT ( USEL_LBLS+Cntrl ),
  217. SMALL_FONT, 55, PLYR_CNTRL_BOX, &FrontendBackgroundDEFN, &FrontendTextureDEFN );
  218. // >>> Friendly match user option panel <<<
  219. if ( EUROgameType == EURO_friendly )
  220. {
  221. if ( EUROnoOfMatchPlyrs > 1 )
  222. {
  223. Image_Heights[UBAR_PANL+Top] = PlrSetupPanelHght[ EUROnoOfMatchPlyrs ];
  224. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  225. UBAR_PANL+Top, 277, 131, NO_BOX, spritecopy );
  226. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  227. UBAR_PANL+Btm, 277, 131+(Image_Heights[UBAR_PANL+Top]), NO_BOX, spritecopy );
  228. char c = 0;
  229. for ( char p=0; p < EUROnoOfMatchPlyrs; p ++ )
  230. {
  231. UserSetupList[p] = -1;
  232. if ( p!=user )
  233. {
  234. DisplayString( 406-(PixelLengthOfString( GetTEXT( PSET_LBLS+p ), SMALL_FONT) ) /2,
  235. (131+19)+(c*23),
  236. ( GetTEXT( PSET_LBLS+p )) ,
  237. SMALL_FONT, 62, USER_SETUP_BOX+c, &FrontendBackgroundDEFN, &FrontendTextureDEFN );
  238. UserSetupList[c] = p;
  239. c++;
  240. }
  241. }
  242. }
  243. }
  244. // >>> Championship match user option panel <<<
  245. if ( EUROgameType == EURO_championship )
  246. {
  247. printf("EUROmatchUsers = %d\n", EUROmatchUsers);
  248. if ( EUROmatchUsers > 1 )
  249. {
  250. Image_Heights[UBAR_PANL+Top] = PlrSetupPanelHght[ EUROmatchUsers ];
  251. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  252. UBAR_PANL+Top, 277, 131, NO_BOX, spritecopy );
  253. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  254. UBAR_PANL+Btm, 277, 131+(Image_Heights[UBAR_PANL+Top]), NO_BOX, spritecopy );
  255. char c = 0;
  256. for ( char p=0; p < EUROnoOfMatchPlyrs; p ++ )
  257. {
  258. UserSetupList[p] = -1;
  259. if ( p!=user &&
  260. ( UserList[ p ].team == EUROteamA ||
  261. UserList[ p ].team == EUROteamB) )
  262. {
  263. DisplayString( 406-(PixelLengthOfString( GetTEXT( PSET_LBLS+p ), SMALL_FONT) ) /2,
  264. (131+19)+(c*23),
  265. ( GetTEXT( PSET_LBLS+p )) ,
  266. SMALL_FONT, 62, USER_SETUP_BOX+c, &FrontendBackgroundDEFN, &FrontendTextureDEFN );
  267. UserSetupList[c] = p;
  268. c++;
  269. }
  270. }
  271. }
  272. }
  273. // >>> Network game match user option panel <<<
  274. if ( EUROgameType == EURO_network_game || EUROgameType == EURO_wireplay)
  275. {
  276. Image_Heights[UBAR_PANL+Top] = 56;
  277. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  278. UBAR_PANL+Top, 277, 131, NO_BOX, spritecopy );
  279. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  280. UBAR_PANL+Btm, 277, 131+(Image_Heights[ UBAR_PANL+Top ]), NO_BOX, spritecopy );
  281. }
  282. }
  283. //********************************************************************************************************************************
  284. void DisplayUserInfo(char user)
  285. {
  286. CopyFromBACKtoPSEUDObuffer(
  287. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  288. 12, 130, 240, 82 );
  289. // *** PLAYERS NAME ***
  290. if ( UserList[user].player == AUTOPLAYER )
  291. DisplayString( 40, 144,
  292. ( GetTEXT( AUTO_LBLE )),
  293. MEDIUM_FONT, 48, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  294. else
  295. if ( UserList[user].player == PLYR_NOT_CHOSEN )
  296. DisplayString( 40, 144,
  297. ( GetTEXT( SPCT_LBLS+Watch )),
  298. MEDIUM_FONT, 48, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  299. else
  300. DisplayString( 40, 144,
  301. ( GetPLAYERSname( UserList[user].player, UserList[user].team, FULL_NAME )) ,
  302. MEDIUM_FONT, 48, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  303. // *** PLAYERS COUNTRY ***
  304. int PAL;
  305. if ( UserList[user].team == EUROteamA )
  306. PAL = 16+8;
  307. else
  308. PAL = 32+8;
  309. if ( UserList[user].player == PLYR_NOT_CHOSEN )
  310. DisplayString( 104,173, ToUPPER(GetTEXT( SPCT_LBLS+Watch )), SMALL_FONT,
  311. 48, PLYR_COUNTRY_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  312. else
  313. DisplayString( 104,173, GetTEAMname( UserList[user].team, 11 ), SMALL_FONT,
  314. PAL, PLYR_COUNTRY_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  315. // *** PLAYERS CONTROL METHOD ***
  316. if ( UserList[user].player == PLYR_NOT_CHOSEN )
  317. DisplayString( 104,195, ToUPPER(GetTEXT( SPCT_LBLS+Nocntrl )), SMALL_FONT,
  318. 62, PLYR_CNTRL_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  319. else
  320. DisplayString( 104,195, GetTEXT( CNTL_LBLS+UserList[user].control), SMALL_FONT,
  321. 62, PLYR_CNTRL_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  322. AddToDumpList( 12, 130, 240, 82 );
  323. }
  324. //********************************************************************************************************************************
  325. void DoUserSetup( char MENU, signed char BOX )
  326. {
  327. if ( MENU == PLAYER_SETUP && LogicState == RUN_FRONTEND)
  328. {
  329. OVERRIDEpal1 = 48;
  330. OVERRIDEpal2 = 62;
  331. //------- EURO FRIENDLY GAME USER SELECTION -----------------------------------------------------
  332. if ( EUROgameType == EURO_friendly )
  333. {
  334. TeamSelectHighlight = ControlOptionHighlight( BOX, TEAM_SELECT_BOX,
  335. TEAM_SELECTdisp_BOX, TeamSelectHighlight,
  336. TeamSelectHandle, BUTN_LBLS+Done );
  337. ClearNetUserList();
  338. if ( BOX == TEAM_SELECT_BOX
  339. && ButtonState != 0 )
  340. {
  341. Animation_table[TeamSelectHandle].AnimationSpeed =
  342. WhichButton( ButtonState, 0.85);
  343. ChangeMenu = TEAM_SELECT;
  344. DeBounce = TRUE;
  345. }
  346. if ( BOX == PLYR_CNTRL_BOX && ButtonState != 0 )
  347. {
  348. if ( ButtonState == LEFT_BUTTON )
  349. UserList[EUROplyrSetup].control =
  350. LegaliseUserCntrlSelection( UserList[EUROplyrSetup].control, -1 );
  351. if ( ButtonState == RIGHT_BUTTON )
  352. UserList[EUROplyrSetup].control =
  353. LegaliseUserCntrlSelection( UserList[EUROplyrSetup].control, 1 );
  354. DisplayUserInfo(EUROplyrSetup);
  355. DeBounce = TRUE;
  356. }
  357. if ( BOX == PLYR_COUNTRY_BOX && ButtonState != 0 )
  358. {
  359. if ( UserList[EUROplyrSetup].team == EUROteamA )
  360. UserList[EUROplyrSetup].team = EUROteamB;
  361. else
  362. UserList[EUROplyrSetup].team = EUROteamA;
  363. UserList[EUROplyrSetup].player = AUTOPLAYER;
  364. DisplayUserInfo(EUROplyrSetup);
  365. DisplayMatchTeam( EUROteamA, 87, 0, 16, EUROmaxPlayers );
  366. DisplayMatchTeam( EUROteamB, 352, 12, 32, EUROmaxPlayers );
  367. AddToDumpList( 82, 241, 146, 216 );
  368. AddToDumpList( 347,241, 146, 216 );
  369. DisplayUserTags( EUROteamA, 87, 0 );
  370. DisplayUserTags( EUROteamB, 352, 12 );
  371. DeBounce = TRUE;
  372. }
  373. if ( BOX > 0 && BOX<24 && ButtonState != 0 )
  374. {
  375. if ( BOX < 11 && ( LegaliseUserPlyrSelection(SquadInfo[ (EUROteamA*20)+BOX ], EUROteamA) == Usable) )
  376. {
  377. UserList[EUROplyrSetup].team = EUROteamA;
  378. UserList[EUROplyrSetup].player = SquadInfo[ (EUROteamA*20)+BOX ]; //BOX;
  379. UserList[EUROplyrSetup].TeamHAflag = 0;
  380. DisplayUserTags( EUROteamA, 87, 0 );
  381. DisplayUserTags( EUROteamB, 352, 12 );
  382. }
  383. else
  384. if ( BOX == 11 )
  385. {
  386. UserList[EUROplyrSetup].team = EUROteamA;
  387. UserList[EUROplyrSetup].player = AUTOPLAYER;
  388. UserList[EUROplyrSetup].TeamHAflag = 0;
  389. DisplayUserTags( EUROteamA, 87, 0 );
  390. DisplayUserTags( EUROteamB, 352, 12 );
  391. }
  392. else
  393. if ( BOX > 12 && BOX < 23 && ( LegaliseUserPlyrSelection( SquadInfo[ (EUROteamB*20)+(BOX-12) ], EUROteamB) == Usable) )
  394. {
  395. UserList[EUROplyrSetup].team = EUROteamB;
  396. UserList[EUROplyrSetup].player = SquadInfo[ (EUROteamB*20)+(BOX-12) ]; //BOX-12;
  397. UserList[EUROplyrSetup].TeamHAflag = 1;
  398. DisplayUserTags( EUROteamA, 87, 0 );
  399. DisplayUserTags( EUROteamB, 352, 12 );
  400. }
  401. else
  402. if ( BOX == 23 )
  403. {
  404. UserList[EUROplyrSetup].team = EUROteamB;
  405. UserList[EUROplyrSetup].player = AUTOPLAYER;
  406. UserList[EUROplyrSetup].TeamHAflag = 1;
  407. DisplayUserTags( EUROteamA, 87, 0 );
  408. DisplayUserTags( EUROteamB, 352, 12 );
  409. }
  410. DisplayMatchTeam( EUROteamA, 87, 0, 16, EUROmaxPlayers );
  411. DisplayMatchTeam( EUROteamB, 352, 12, 32, EUROmaxPlayers );
  412. DisplayUserInfo(EUROplyrSetup);
  413. AddToDumpList( 82, 241, 146, 216 );
  414. AddToDumpList( 347,241, 146, 216 );
  415. DeBounce = TRUE;
  416. }
  417. CopyFromBACKtoPSEUDObuffer(
  418. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  419. 277, 150,
  420. Image_Widths[ UBAR_PANL+Top ]-32,
  421. Image_Heights[ UBAR_PANL+Top ]-18);
  422. AddToDumpList( 277, 150,
  423. Image_Widths[ UBAR_PANL+Top ]-32,
  424. Image_Heights[ UBAR_PANL+Top ]-18);
  425. if ( BOX >= USER_SETUP_BOX && BOX < (USER_SETUP_BOX+3))
  426. {
  427. char c = BOX-USER_SETUP_BOX;
  428. if ( UserSetupList[c] >= 0 )
  429. DisplayString( 406-(PixelLengthOfString(
  430. GetTEXT( PSET_LBLS+UserSetupList[c] ),
  431. SMALL_FONT) ) /2,
  432. (131+19)+(c*23),
  433. ( GetTEXT( PSET_LBLS+UserSetupList[c])) ,
  434. SMALL_FONT, 48, USER_SETUP_BOX+c,
  435. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  436. if ( ButtonState != 0 )
  437. {
  438. ChangeMenu = PLAYER_SETUP;
  439. EUROplyrSetup = UserSetupList[BOX-USER_SETUP_BOX];
  440. DeBounce = TRUE;
  441. }
  442. }
  443. }
  444. //------- NETWORK USER SELECTION --------------------------------------------------------------------
  445. if ( EUROgameType == EURO_network_game || EUROgameType == EURO_wireplay )
  446. {
  447. signed char n;
  448. n = UserList[0].player;
  449. if ( TeamOveride )
  450. {
  451. ChangeMenu = PLAYER_SETUP;
  452. EUROoveride = 1;
  453. TeamOveride = 0;
  454. EUROteamA = Team_A; // Setup other users choice of teams.
  455. EUROteamB = Team_B; // Setup other users choice of teams.
  456. }
  457. if ( BOX == NET_START_BOX
  458. && EURO_NetSelectionMade == No
  459. && UserList[0].player != PLYR_NOT_CHOSEN
  460. && ButtonState != 0 )
  461. {
  462. CopyFromBACKtoPSEUDObuffer(
  463. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  464. 12, 98,
  465. PixelLengthOfString( GetTEXT ( PSET_HEAD+(EUROgameType-2)), LARGE_FONT), 34 );
  466. if ( EUROgameType == EURO_network_game )
  467. {
  468. DisplayString( 12, 98, GetTEXT ( NWRK_LBLS+Netwait ),
  469. LARGE_FONT, 175, NO_BOX,
  470. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  471. AddToDumpList( 12, 98,
  472. PixelLengthOfString( GetTEXT( NWRK_LBLS+Netwait ), LARGE_FONT), 34 );
  473. }
  474. else
  475. if ( EUROgameType == EURO_wireplay )
  476. {
  477. DisplayString( 12, 98, GetTEXT ( WIRE_LBLS+Wirewait ),
  478. LARGE_FONT, 175, NO_BOX,
  479. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  480. AddToDumpList( 12, 98,
  481. PixelLengthOfString( GetTEXT( NWRK_LBLS+Netwait ), LARGE_FONT), 34 );
  482. }
  483. EURO_NetSelectionMade = Yes;
  484. Animation_table[NetStartHandle].AnimationSpeed = 0.85;
  485. DeBounce = TRUE;
  486. // run this section - ignores CD test and accepts your player choice...
  487. if (TeamChoice < 2)
  488. {
  489. TeamChoice+=2;
  490. SendPlayerInfo();
  491. TickPause();
  492. TickPause();
  493. TickPause();
  494. }
  495. // // the following line was run if a CD was not found instead of the above...
  496. // SendNETTeamInfo();
  497. }
  498. if ( BOX == PLYR_CNTRL_BOX &&
  499. UserList[0].player != PLYR_NOT_CHOSEN &&
  500. ButtonState != 0 )
  501. {
  502. if ( ButtonState == LEFT_BUTTON )
  503. UserList[0].control =
  504. LegaliseUserCntrlSelection( UserList[0].control, -1 );
  505. if ( ButtonState == RIGHT_BUTTON )
  506. UserList[0].control =
  507. LegaliseUserCntrlSelection( UserList[0].control, 1 );
  508. DisplayUserInfo(EUROplyrSetup);
  509. DeBounce = TRUE;
  510. }
  511. if ( BOX>0 && BOX<24 && ButtonState != 0 && EURO_NetSelectionMade == No )
  512. {
  513. if ( BOX > 0 && BOX < 11 ) //&& ( LegaliseUserPlyrSelection(SquadInfo[ (EUROteamA*20)+BOX ], EUROteamA) == Usable) )
  514. {
  515. UserList[0].team = EUROteamA;
  516. UserList[0].player = SquadInfo[ (EUROteamA*20)+BOX ]; //BOX;
  517. TeamChoice = 0;
  518. PlayerChoice = BOX+1; // because 0 is autoplayer in actua
  519. UserList[0].TeamHAflag = 0;
  520. SendPlayerInfo();
  521. TickPause();
  522. TickPause();
  523. TickPause();
  524. DisplayUserTags( EUROteamA, 87, 0 );
  525. DisplayUserTags( EUROteamB, 352, 12 );
  526. }
  527. else
  528. if ( BOX == 11 && TeamA_AUTOplayers < 2 )
  529. {
  530. UserList[0].team = EUROteamA;
  531. UserList[0].player = AUTOPLAYER;
  532. TeamChoice = 0;
  533. PlayerChoice = 1;
  534. UserList[0].TeamHAflag = 0;
  535. SendPlayerInfo();
  536. TickPause();
  537. TickPause();
  538. TickPause();
  539. DisplayUserTags( EUROteamA, 87, 0 );
  540. DisplayUserTags( EUROteamB, 352, 12 );
  541. }
  542. else
  543. if ( BOX > 12 && BOX < 23 ) //&& ( LegaliseUserPlyrSelection( SquadInfo[ (EUROteamB*20)+(BOX-12) ], EUROteamB) == Usable) )
  544. {
  545. UserList[0].team = EUROteamB;
  546. UserList[0].player = SquadInfo[ (EUROteamB*20)+(BOX-12) ];
  547. TeamChoice = 1;
  548. PlayerChoice = BOX-10;
  549. UserList[0].TeamHAflag = 1;
  550. SendPlayerInfo();
  551. TickPause();
  552. TickPause();
  553. TickPause();
  554. DisplayUserTags( EUROteamA, 87, 0 );
  555. DisplayUserTags( EUROteamB, 352, 12 );
  556. }
  557. else
  558. if ( BOX == 23 && TeamB_AUTOplayers < 2 )
  559. {
  560. UserList[0].team = EUROteamB;
  561. UserList[0].player = AUTOPLAYER;
  562. TeamChoice = 1;
  563. PlayerChoice = 1;
  564. UserList[0].TeamHAflag = 1;
  565. SendPlayerInfo();
  566. TickPause();
  567. TickPause();
  568. TickPause();
  569. DisplayUserTags( EUROteamA, 87, 0 );
  570. DisplayUserTags( EUROteamB, 352, 12 );
  571. }
  572. DisplayUserInfo(0);
  573. DeBounce = TRUE;
  574. }
  575. if ( EURO_NetSelectionMade == Yes )
  576. {
  577. char Starts = 0;
  578. for ( int i=0; i < network_on; i++ )
  579. {if (NetTeams[i] >= 2) Starts++;}
  580. if (Starts==network_on && network_on>1)
  581. {
  582. End_Net_Init();
  583. EuroNETseed = 12345;
  584. for ( i=0; i<network_on; i++ )
  585. NetTeams[i]-=2;
  586. RunMatch = Yes;
  587. //ChangeMenu = NEXT_MATCH; //GROUP_FIXTURES;
  588. ChangeMenu = MAIN;
  589. }
  590. }
  591. NetStartHighlight = ControlOptionHighlight( BOX, NET_START_BOX,
  592. NET_STARTdisp_BOX, NetStartHighlight,
  593. NetStartHandle, BUTN_LBLS+Done );
  594. BuildNETuserTable();
  595. DisplayMatchTeam( EUROteamA, 87, 0, 16, EUROmaxPlayers );
  596. DisplayMatchTeam( EUROteamB, 352, 12, 32, EUROmaxPlayers );
  597. AddToDumpList( 82, 241, 146, 216 );
  598. AddToDumpList( 347,241, 146, 216 );
  599. if ( EUROgameType== EURO_network_game || EUROgameType == EURO_wireplay)
  600. DisplayNETinfo();
  601. if ( keys[1] ) // escape key pressed during selection
  602. {
  603. Initial_Quit();
  604. ChangeMenu = MAIN;
  605. }
  606. }
  607. //------- EURO CHAMPIONSHIP USER SELECTION --------------------------------------------------------------------
  608. if ( EUROgameType == EURO_championship )
  609. {
  610. ClearNetUserList();
  611. TeamSelectHighlight = ControlOptionHighlight( BOX, TEAM_SELECT_BOX,
  612. TEAM_SELECTdisp_BOX, TeamSelectHighlight,
  613. TeamSelectHandle, BUTN_LBLS+Done );
  614. if ( BOX == PLYR_CNTRL_BOX && ButtonState != 0 )
  615. {
  616. if ( ButtonState == LEFT_BUTTON )
  617. UserList[EUROplyrSetup].control =
  618. LegaliseUserCntrlSelection( UserList[EUROplyrSetup].control, -1 );
  619. if ( ButtonState == RIGHT_BUTTON )
  620. UserList[EUROplyrSetup].control =
  621. LegaliseUserCntrlSelection( UserList[EUROplyrSetup].control, 1 );
  622. DisplayUserInfo(EUROplyrSetup);
  623. DeBounce = TRUE;
  624. }
  625. if ( BOX == TEAM_SELECT_BOX
  626. && ButtonState != 0 )
  627. {
  628. Animation_table[TeamSelectHandle].AnimationSpeed =
  629. WhichButton( ButtonState, 0.85);
  630. ChangeMenu = NEXT_MATCH;
  631. DeBounce = TRUE;
  632. }
  633. if ( BOX > 0 && BOX<12 && ButtonState != 0 )
  634. {
  635. if ( BOX < 11 && ( LegaliseUserPlyrSelection( SquadInfo[ (EUROchampTeam*20)+BOX ], EUROchampTeam) == Usable) )
  636. {
  637. UserList[EUROplyrSetup].team = EUROchampTeam;
  638. UserList[EUROplyrSetup].player = SquadInfo[ (EUROchampTeam*20)+BOX ];
  639. DisplayUserTags( EUROchampTeam, 87, 0 );
  640. }
  641. else
  642. if ( BOX == 11 )
  643. {
  644. UserList[EUROplyrSetup].team = EUROchampTeam;
  645. UserList[EUROplyrSetup].player = AUTOPLAYER;
  646. DisplayUserTags( EUROchampTeam, 87, 0 );
  647. }
  648. DisplayMatchTeam( EUROchampTeam, 87, 0, 16, EUROnoOfMatchPlyrs );
  649. DisplayUserInfo(EUROplyrSetup);
  650. AddToDumpList( 82, 241, 146, 216 );
  651. DeBounce = TRUE;
  652. }
  653. CopyFromBACKtoPSEUDObuffer(
  654. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  655. 277, 150,
  656. Image_Widths[ UBAR_PANL+Top ]-32,
  657. Image_Heights[ UBAR_PANL+Top ]-18);
  658. AddToDumpList( 277, 150,
  659. Image_Widths[ UBAR_PANL+Top ]-32,
  660. Image_Heights[ UBAR_PANL+Top ]-18);
  661. if ( BOX >= USER_SETUP_BOX && BOX < (USER_SETUP_BOX+3))
  662. {
  663. char c = BOX-USER_SETUP_BOX;
  664. if ( UserSetupList[c] >= 0 )
  665. DisplayString( 406-(PixelLengthOfString(
  666. GetTEXT( PSET_LBLS+UserSetupList[c] ),
  667. SMALL_FONT) ) /2,
  668. (131+19)+(c*23),
  669. ( GetTEXT( PSET_LBLS+UserSetupList[c])) ,
  670. SMALL_FONT, 48, USER_SETUP_BOX+c,
  671. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  672. if ( ButtonState != 0 )
  673. {
  674. ChangeMenu = PLAYER_SETUP;
  675. EUROplyrSetup = UserSetupList[BOX-USER_SETUP_BOX];
  676. DeBounce = TRUE;
  677. }
  678. }
  679. }
  680. //-----------------------------------------------------------------------------------------
  681. }
  682. }
  683. //********************************************************************************************************************************
  684. void BuildNETuserTable()
  685. {
  686. char p;
  687. TeamA_AUTOplayers = 0;
  688. TeamB_AUTOplayers = 0;
  689. ClearNetUserList();
  690. for (char i=0; i<network_on; i++)
  691. {
  692. if ( NetTeams[i] != -1 )
  693. {
  694. p = ( ( (NetTeams[i] & 1)*11)+Players[i])-1;
  695. if ( p == 0 )
  696. TeamA_AUTOplayers++;
  697. if ( p == 11 )
  698. TeamB_AUTOplayers++;
  699. if (p!=0 && p!=11)
  700. UserNetList[p] = 1;
  701. if ( TeamA_AUTOplayers > 1 )
  702. UserNetList[11] = 1;
  703. if ( TeamB_AUTOplayers > 1 )
  704. UserNetList[23] = 1;
  705. }
  706. }
  707. }
  708. //********************************************************************************************************************************
  709. void DisplayNETinfo()
  710. {
  711. char ammount[5];
  712. char *string1;
  713. if ( EUROgameType == EURO_network_game || EUROgameType == EURO_wireplay)
  714. {
  715. CopyFromBACKtoPSEUDObuffer(
  716. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  717. 277, 131, 258, 60);
  718. if ( EUROgameType == EURO_network_game )
  719. string1 = GetTEXT( NWRK_LBLS+Netusers );
  720. else
  721. string1 = GetTEXT( WIRE_LBLS+Netusers );
  722. char *number1 = itoa( network_on, ammount, 10 );
  723. DisplayString( 406-
  724. ( (PixelLengthOfString( string1, SMALL_FONT))+
  725. ( PixelLengthOfString( number1, SMALL_FONT)) ) /2, 150,
  726. string1, SMALL_FONT, 48, NO_BOX,
  727. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  728. DisplayString( NextXposn, 150,
  729. number1, SMALL_FONT, 48, NO_BOX,
  730. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  731. char *string2 = GetTEXT( NWRK_LBLS+Tochoose );
  732. char *number2 = itoa( CountNumberOfNETstarts(), ammount, 10 );
  733. DisplayString( 406-
  734. ( (PixelLengthOfString( string2, SMALL_FONT))+
  735. ( PixelLengthOfString( number2, SMALL_FONT)) ) /2, 173,
  736. string2, SMALL_FONT, 48, NO_BOX,
  737. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  738. DisplayString( NextXposn, 173,
  739. number2, SMALL_FONT, 48, NO_BOX,
  740. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  741. AddToDumpList( 277, 131, 258, 60);
  742. }
  743. }
  744. //********************************************************************************************************************************
  745. char LegaliseUserPlyrSelection( char player, char team )
  746. {
  747. char plyr = Usable;
  748. char p;
  749. if ( EUROgameType != EURO_championship )
  750. {
  751. for ( p=0; p < EUROmaxPlayers; p ++ )
  752. {
  753. if ( p != EUROplyrSetup &&
  754. ( UserList[p].team==team && UserList[p].player == player ) )
  755. plyr = Unusable;
  756. }
  757. }
  758. else
  759. {
  760. for ( p=0; p < EUROnoOfMatchPlyrs; p ++ )
  761. {
  762. if ( p != EUROplyrSetup &&
  763. ( UserList[p].team==team && UserList[p].player == player ) )
  764. plyr = Unusable;
  765. }
  766. }
  767. return(plyr);
  768. }
  769. //********************************************************************************************************************************
  770. void SetupChampionshipCntrls( char gametype)
  771. {
  772. if ( gametype == EURO_championship )
  773. {
  774. char CntrlList[16];
  775. char CntrlReset = 0;
  776. char FirstCntrl = 0;
  777. char ScndMatchUser = 0;
  778. memset( &CntrlList[0], 0, 16 );
  779. //--------------------------------------------------------------
  780. // we must first find out if any of the devises are being used by more than one player.
  781. for ( char p=0; p < EUROnoOfMatchPlyrs; p ++ )
  782. {
  783. if ( (UserList[p].team == EUROteamA ||
  784. UserList[p].team == EUROteamB ) &&
  785. (UserList[p].control>=0 &&
  786. UserList[p].control < 17) )
  787. {
  788. CntrlList[ UserList[p].control ]++;
  789. if ( CntrlList[ UserList[p].control ] > 1 )
  790. CntrlReset = 1;
  791. }
  792. else
  793. if ( (UserList[p].team == EUROteamA ||
  794. UserList[p].team == EUROteamB ) &&
  795. ( UserList[p].control == -1 ||
  796. CtrlFlags[ UserList[p].control ] != Usable) )
  797. CntrlReset = 1;
  798. }
  799. //--------------------------------------------------------------
  800. // an illegal control method (too many of the same control devise) was found so legalise other users
  801. // control methods.
  802. if ( CntrlReset != 0 )
  803. {
  804. if (EUROverbose)
  805. printf("illegal control devise.\n");
  806. FirstCntrl = 15;
  807. for ( char u = 0; u < EUROnoOfMatchPlyrs; u ++ )
  808. {
  809. if ( UserList[u].team == EUROteamA ||
  810. UserList[u].team == EUROteamB )
  811. {
  812. FirstCntrl = LegaliseUserCntrlSelection( FirstCntrl, 1 );
  813. UserList[u].control = FirstCntrl;
  814. }
  815. }
  816. }
  817. //--------------------------------------------------------------
  818. }
  819. }
  820. //********************************************************************************************************************************
  821. char LegaliseUserCntrlSelection( char cntl, signed char dir )
  822. {
  823. char control = Unusable;
  824. char current_cntr = cntl;
  825. while ( control == Unusable )
  826. {
  827. cntl+= dir;
  828. cntl&= 15;
  829. if ( ( CtrlFlags[ cntl ] == Usable) || cntl == current_cntr )
  830. control = Usable;
  831. if ( EUROgameType != EURO_championship )
  832. {
  833. for ( char p=0; p < EUROmaxPlayers; p ++ )
  834. {
  835. if ( p != EUROplyrSetup &&
  836. cntl!= current_cntr &&
  837. UserList[p].control == cntl )
  838. UserList[p].control = current_cntr;
  839. }
  840. }
  841. else
  842. {
  843. for ( char p=0; p < EUROnoOfMatchPlyrs; p ++ )
  844. {
  845. if ( p != EUROplyrSetup &&
  846. (UserList[p].team == EUROteamA ||
  847. UserList[p].team == EUROteamB ) &&
  848. cntl!= current_cntr &&
  849. UserList[p].control == cntl )
  850. UserList[p].control = current_cntr;
  851. }
  852. }
  853. }
  854. return(cntl);
  855. }
  856. //********************************************************************************************************************************
  857. void DisplayUserTags( char Team, short Xposn, char box_offset )
  858. {
  859. char plyr;
  860. short x = Xposn+PixelLengthOfString(GetTEXT( AUTO_LBLE ),SMALL_FONT)+32;
  861. short y;
  862. short autocnt = 0;
  863. CopyFromBACKtoPSEUDObuffer(
  864. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  865. Xposn-52, 243, 20, 195+34);
  866. CopyFromBACKtoPSEUDObuffer( &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  867. x, 440, 60, 34 );
  868. for ( char s=0; s < 11; s ++ )
  869. {
  870. plyr = SquadInfo[ (Team*20)+s ];
  871. if ( EUROgameType == EURO_friendly )
  872. {
  873. // for ( char p=0; p < EUROmaxPlayers; p ++ )
  874. for ( char p=0; p < EUROnoOfMatchPlyrs; p ++ )
  875. {
  876. if ( (UserList[p].team == Team &&
  877. UserList[p].player == plyr ) &&
  878. (UserList[ EUROplyrSetup ].team == Team &&
  879. UserList[EUROplyrSetup].player == plyr ) )
  880. DisplayString( (Xposn-42)-(PixelLengthOfString( GetTEXT( UTAG_LBLS+p ), SMALL_FONT) ) /2,
  881. (242+( s * 18)), ( GetTEXT ( UTAG_LBLS+p )) ,
  882. SMALL_FONT, 62, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  883. }
  884. }
  885. if ( ( EUROgameType == EURO_network_game || EUROgameType == EURO_wireplay ) &&
  886. (UserList[0].team == Team &&
  887. ( UserList[0].player == plyr || UserList[0].player==AUTOPLAYER) ))
  888. {
  889. if ( UserList[0].player == plyr )
  890. y = 241+(s*18);
  891. else
  892. y = 438;
  893. DisplayString( (Xposn-37)-(PixelLengthOfString( GetTEXT( UTAG_LBLS+4 ), LARGE_FONT) ) /2,
  894. y, ( GetTEXT ( UTAG_LBLS+Auto )),
  895. LARGE_FONT, 62, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  896. }
  897. }
  898. if ( EUROgameType == EURO_friendly )
  899. {
  900. // for ( char a=0; a < EUROmaxPlayers; a ++ )
  901. for ( char a=0; a < EUROnoOfMatchPlyrs; a ++ )
  902. {
  903. if ( UserList[a].team == Team &&
  904. UserList[a].player == AUTOPLAYER )
  905. {
  906. if ( EUROplyrSetup == a )
  907. DisplayString( (Xposn-42)-(PixelLengthOfString( GetTEXT( UTAG_LBLS+a ), SMALL_FONT) ) /2,
  908. 440, ( GetTEXT ( UTAG_LBLS+a )) ,
  909. SMALL_FONT, 62, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  910. else
  911. {
  912. x = Xposn+PixelLengthOfString(GetTEXT( AUTO_LBLE ),SMALL_FONT)+32;
  913. DrawIMAGE( &FrontendPseudoDEFN, &FrontendTextureDEFN,
  914. PLYR_TAGB, x-2+autocnt, 438, NO_BOX, straightcopy );
  915. DisplayString( x+10-((PixelLengthOfString( GetTEXT( UTAG_LBLS+a ), SMALL_FONT) ) /2)+autocnt,
  916. 440, ( GetTEXT ( UTAG_LBLS+a )) ,
  917. SMALL_FONT, 55, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  918. autocnt+=20;
  919. }
  920. }
  921. }
  922. }
  923. AddToDumpList( Xposn-52, 243, 20, 195+34 );
  924. AddToDumpList( x, 440, 60, 34 );
  925. }
  926. //********************************************************************************************************************************