EURO_GEN.CPP 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011
  1. #include <iostream.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 "euro_cnt.h"
  18. #include "euro_usr.h"
  19. #include "euro_net.h"
  20. #include "euro_mod.h"
  21. #include "euro_sqd.h"
  22. #include "euro_rnd.h"
  23. #include "euro_mat.h"
  24. #include "euro_int.h"
  25. #include "defines.h"
  26. //********************************************************************************************************************************
  27. //
  28. //char *GetTEXT( short StringNumber )
  29. //{
  30. // return( (char *)Text[ StringNumber ] );
  31. //}
  32. //
  33. ////********************************************************************************************************************************
  34. char *ToUPPER( char *string )
  35. {
  36. char len = strlen(&string[0]);
  37. for ( char u=0; u < len; u++ )
  38. { StringBuffer[u] = ToUpper[ *(string+u) ]; }
  39. StringBuffer[u] = 0;
  40. return( &StringBuffer[0] );
  41. }
  42. //********************************************************************************************************************************
  43. //
  44. //char *GetTEAMname( char team, char maxlen )
  45. // {
  46. // char *Name = GetTEXT( TEAM_NMES+team );
  47. // char Searchlen = strlen(&Name[0]);
  48. // char NAMEoffset = 0;
  49. //
  50. // for ( char x=0; x<Searchlen ; x++ )
  51. // {StringBuffer[x] = * (Name+x);}
  52. // StringBuffer[x] = 0;
  53. //
  54. // if ( maxlen!=0 && Searchlen > maxlen )
  55. // {
  56. // StringBuffer[maxlen-1] = '.';
  57. // StringBuffer[maxlen] = 0;
  58. // }
  59. //
  60. // return ( &StringBuffer[0] );
  61. // }
  62. //
  63. //
  64. //
  65. //********************************************************************************************************************************
  66. //
  67. //char *GetPLAYERSname( char player, char team, char format )
  68. // {
  69. // short Prefix = (team*20)+player;
  70. // char *Search = GetTEXT( PLYR_NMES+Prefix );
  71. // char NAMEoffset = 0;
  72. // char Searchlen = strlen(&Search[0]);
  73. // unsigned char c;
  74. //
  75. // if ( format == FULL_NAME )
  76. // {
  77. // for ( char x=0; x < Searchlen ; x++ )
  78. // {StringBuffer[x] = *(Search+x);}
  79. // StringBuffer[x] = 0;
  80. // }
  81. //
  82. //
  83. // if ( format == INITIAL_SURNAME )
  84. // {
  85. // // *** Get players initials ***
  86. //
  87. // for ( char x=0; x < Searchlen ; x++ )
  88. // {
  89. // if ( IsUpper[ *(Search+x) ] == up &&
  90. // IsUpper[ *(Search+(x+1)) ] == lw &&
  91. // NAMEoffset < (NAME_BUFFER_LEN-3) )
  92. // {
  93. // StringBuffer[NAMEoffset] = *(Search+x);
  94. // NAMEoffset++;
  95. //
  96. // if ((*(Search+x))=='-')
  97. // StringBuffer[NAMEoffset] = '-';
  98. // else
  99. // StringBuffer[NAMEoffset] = '.';
  100. //
  101. // StringBuffer[NAMEoffset+1] = 32;
  102. // NAMEoffset+= 2;
  103. // }
  104. //
  105. // if ((*(Search+x))=='-' && NAMEoffset >1 )
  106. // {
  107. // StringBuffer[NAMEoffset-2] = '-';
  108. // NAMEoffset--;
  109. // }
  110. // }
  111. // }
  112. //
  113. // if ( format == INITIAL_SURNAME || format == SURNAME )
  114. // {
  115. //
  116. // // *** Get players surname ***
  117. //
  118. // for ( char y=0; y < Searchlen ; y++ )
  119. // {
  120. // if ( IsUpper[ *(Search+y) ] == up &&
  121. // IsUpper[ *(Search+(y+1)) ] == up &&
  122. // NAMEoffset < (NAME_BUFFER_LEN-3) )
  123. //
  124. // {
  125. // StringBuffer[NAMEoffset] = *(Search+y);
  126. //
  127. //// if ( (IsUpper[ *(Search+(y-1) ) ] == up && y>0) &&
  128. //// NamePREFIXtbl[Prefix] == 1 &&
  129. //// ( (StringBuffer[NAMEoffset-1]!='c' ||
  130. //// StringBuffer[NAMEoffset-2]!='M' && NAMEoffset>1 ) ) )
  131. //// {
  132. //// c = StringBuffer[NAMEoffset];
  133. //// StringBuffer[NAMEoffset] = ToLower[c];
  134. //// }
  135. //
  136. //
  137. //
  138. // if ( (IsUpper[ *(Search+(y-1) ) ] == up && y>0) )
  139. // {
  140. // c = StringBuffer[NAMEoffset];
  141. //
  142. // if ( ( StringBuffer[NAMEoffset-2]=='M' &&
  143. // StringBuffer[NAMEoffset-1]=='c' &&
  144. // NAMEoffset>1 && NamePREFIXtbl[Prefix] == 1 )
  145. // )
  146. //
  147. // c = StringBuffer[NAMEoffset];
  148. //
  149. // else
  150. //
  151. // {
  152. // c = StringBuffer[NAMEoffset];
  153. // StringBuffer[NAMEoffset] = ToLower[c];
  154. // }
  155. //
  156. // }
  157. //
  158. // NAMEoffset++;
  159. // }
  160. //
  161. // else
  162. //
  163. // if ( IsUpper[ *(Search+y) ] == up &&
  164. // IsUpper[ *(Search+(y-1)) ] == up &&
  165. // NAMEoffset < (NAME_BUFFER_LEN-3) && y>0 )
  166. // {
  167. // StringBuffer[NAMEoffset] = *(Search+y);
  168. //
  169. // if ( IsUpper[ *(Search+(y-1)) ] == up && y>0 )
  170. // {
  171. // c = StringBuffer[NAMEoffset];
  172. // StringBuffer[NAMEoffset] = ToLower[c];
  173. // }
  174. //
  175. // NAMEoffset++;
  176. //
  177. // if ( (*(Search+(y+1)))==' ')
  178. // {
  179. // StringBuffer[NAMEoffset] = 32;
  180. // NAMEoffset++;
  181. // }
  182. // }
  183. // }
  184. //
  185. // StringBuffer[NAMEoffset] = 0; // end of line.
  186. // }
  187. //
  188. // return ( &StringBuffer[0] );
  189. // }
  190. //
  191. //********************************************************************************************************************************
  192. void DisplayTextInputCursor( int xpos, short CursorPosn, int ypos, char *string, int font, int colour, pseudo_info *pseudo, texture_info *texture )
  193. {
  194. if ( CursorDisplaySpeed > f2L(.5) )
  195. {
  196. int c;
  197. if ( CursorPosn>0 )
  198. {
  199. for ( short x=0; x < CursorPosn; x++ )
  200. {
  201. c=*string;
  202. if ( c!=0 )
  203. {
  204. c = ASCtoImageTBL[c];
  205. c+= font;
  206. string++;
  207. xpos+= (Image_Widths[c])+1;
  208. }
  209. }
  210. }
  211. c = 63+font;
  212. DrawIMAGE( pseudo, texture, c, xpos, ypos, NO_BOX, spriteinccopy );
  213. }
  214. }
  215. //********************************************************************************************************************************
  216. void ResetAnimations()
  217. {
  218. for ( short a=0; a < MAX_ANIMATIONS; a++ )
  219. {
  220. Animation_table[a].StartFrame = -1;
  221. Animation_table[a].EndFrame = -1;
  222. Animation_table[a].Counter = 0;
  223. Animation_table[a].AnimationSpeed = 0;
  224. Animation_table[a].Bounding_box = NO_BOX;
  225. Animation_table[a].Flags = 0;
  226. Animation_table[a].xposn = 0;
  227. Animation_table[a].yposn = 0;
  228. }
  229. }
  230. //********************************************************************************************************************************
  231. short AddAnimation( int xposn, int yposn, float StartFrame, float EndFrame, float Speed, signed char Box, signed char Flags )
  232. {
  233. short handle = 0;
  234. for ( short a=0; a < MAX_ANIMATIONS; a++ )
  235. {
  236. if ( Animation_table[a].StartFrame==-1 )
  237. {
  238. Animation_table[a].StartFrame = StartFrame;
  239. Animation_table[a].EndFrame = EndFrame;
  240. Animation_table[a].AnimationSpeed = Speed;
  241. Animation_table[a].Bounding_box = Box;
  242. Animation_table[a].Flags = Flags;
  243. Animation_table[a].xposn = xposn;
  244. Animation_table[a].yposn = yposn;
  245. handle = a;
  246. break;
  247. }
  248. }
  249. return(handle);
  250. }
  251. //********************************************************************************************************************************
  252. void InitialiseMenuPage( char MENU )
  253. {
  254. switch ( MENU )
  255. {
  256. case( MAIN ):
  257. Euro96initialise(); // reinitialise game data.
  258. EUROuserSelection = 0;
  259. break;
  260. case( SQUAD_SELECT ):
  261. LoadTactics( ((int)FormationInfo[Team]), &EuroDATfile[0], &TeamTactics[0][0][0] );
  262. DisplaySquad();
  263. DisplayFormation( NULL );
  264. DisplayPositionLabels();
  265. MarkPlayer = -1;
  266. SquadBuffer1yposn = -1;
  267. QuestionHandle = AddAnimation( 488, 16,
  268. ( (float)QMRK_IMGS ), ( (float)QMRK_IMGS+19.1 ),
  269. 0.40, QUESTION_BOX, CONT_ANIM );
  270. FormationHandle = AddAnimation( NameBarXposn-16, 426,
  271. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  272. 0.0, FORMATION_BOX, RUN_ONCE );
  273. ReturnSqdHandle = AddAnimation( 308, 426,
  274. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  275. 0.0, RETURN_SQUAD_BOX, RUN_ONCE );
  276. ViewTeamHandle = AddAnimation( NameBarXposn-16, 106,
  277. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  278. 0.0, OPPONENT_TEAM_BOX, RUN_ONCE );
  279. break;
  280. case( GROUP_FIXTURES ):
  281. DisplayRedrawButton( MatchNumber );
  282. NextMatchHandle = AddAnimation( 507, 226,
  283. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  284. 0.0, NXT_MTCH_BOX, CONT_ANIM );
  285. NextMatchHighlight = ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX,
  286. -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  287. break;
  288. case( TEAM_SELECT ):
  289. GetFirstLegalEuro96Team();
  290. ClickBOX = NO_BOX;
  291. SetupTeamSelectButtons( EUROgameType );
  292. SelectionSpeed = 0;
  293. SelectionFlag = -1;
  294. SelectionAim = AimTBL[EUROteamA];
  295. SelectionCounter = ((float)SelectionAim)*4;
  296. DisplayGameType( EUROgameType );
  297. DisplayCountrySelectImages();
  298. DisplaySelectedTeam();
  299. break;
  300. case( EURO_REDRAW ):
  301. DisplayGroupHeadings();
  302. EuroDrawHandle = AddAnimation( 179, 234,
  303. ( (float)EURO_RDRW ), ( (float)EURO_RDRW+55.0 ),
  304. 0.40, QUESTION_BOX, CONT_ANIM );
  305. DefaultHandle = AddAnimation( 446, 380,
  306. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  307. 0.0, DEFAULT_BOX, CONT_ANIM );
  308. DefaultdrawHighlight = ControlOptionHighlight( -1, DEFAULT_BOX,
  309. DEFAULTdisp_BOX, -1,
  310. DefaultHandle, BUTN_LBLS+Default );
  311. EuroReDrawCounter = 30.0;
  312. EuroReDrawFlag = -1;
  313. break;
  314. case( PLAYER_STATS ):
  315. DisplaySquad();
  316. DisplayPositionLabels();
  317. QuestionHandle = AddAnimation( 488, 16,
  318. ( (float)QMRK_IMGS ), ( (float)QMRK_IMGS+19.1 ),
  319. 0.40, QUESTION_BOX, CONT_ANIM );
  320. ReturnStatHandle = AddAnimation( 308, 416,
  321. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  322. 0.0, RETURN_PSTATS_BOX, CONT_ANIM );
  323. DisplayPlayerStats();
  324. break;
  325. case( PLAYER_SETUP ):
  326. DisplayUserSetupButtons( 0 );
  327. ClearNetUserList();
  328. InitNetUserSelection();
  329. EUROchampTeam = UserList[EUROplyrSetup].team;
  330. if ( EUROgameType != EURO_championship )
  331. {
  332. DisplayMatchTeam( EUROteamA, 87, 0, 16, EUROmaxPlayers );
  333. DisplayUserTags( EUROteamA, 87, 0 );
  334. DisplayMatchTeam( EUROteamB, 352, 12, 32, EUROmaxPlayers );
  335. DisplayUserTags( EUROteamB, 352, 12 );
  336. }
  337. else
  338. {
  339. DisplayMatchTeam( EUROchampTeam, 87, 0, 16, EUROnoOfMatchPlyrs );
  340. DisplayUserTags( EUROchampTeam, 87, 0 );
  341. LoadPalette( BIN_BUL_PAL+( 8*EUROchampTeam),
  342. &EuroDATfile[0], 16 );
  343. }
  344. DisplayUserInfo(EUROplyrSetup);
  345. DisplayUserHeadings(EUROplyrSetup);
  346. DisplayNETinfo();
  347. break;
  348. case( TEAM_STATS ):
  349. ReturnTeamHandle = AddAnimation( 512, 426,
  350. ( (float)BUTN_BLUE ), ( (float)BUTN_WHBL+11.9 ),
  351. 0.0, RETN_TSTATS_BOX, CONT_ANIM );
  352. RetnTstatHighlight = ControlOptionHighlight( -1, RETN_TSTATS_BOX,
  353. RETN_TSTATSdisp_BOX, -1,
  354. ReturnTeamHandle, BUTN_LBLS+Done );
  355. ViewTeamHandle = AddAnimation( NameBarXposn-16, 106,
  356. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  357. 0.0, OPPONENT_TEAM_BOX, RUN_ONCE );
  358. break;
  359. case( MODEM_SETUP ):
  360. DisplayModemType();
  361. DisplayDialSetting();
  362. DisplayCommSetting();
  363. InitialiseInitString( EUROmodemType );
  364. DisplayInitString();
  365. DisplayModemList( ModemYpage );
  366. DisplayTelephoneNumber();
  367. ModemYpage = ControlSlider( &ModemSelectDEFN, 0, 0, 0 );
  368. break;
  369. case( NEXT_MATCH ):
  370. DisplayNextMatchType( EUROgameType );
  371. DisplayNextMatchUsers( EUROgameType );
  372. DisplayExtMatchTeams();
  373. NextMatchSelectButtons( EUROgameType );
  374. SetupChampionshipCntrls( EUROgameType );
  375. break;
  376. case( QUALIFIERS ):
  377. NextMatchHandle = AddAnimation( 446, 426,
  378. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  379. 0.0, NXT_MTCH_BOX, CONT_ANIM );
  380. NextMatchHighlight = ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX,
  381. -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  382. break;
  383. case( QUARTER_FINALS ):
  384. NextMatchHandle = AddAnimation( 446, 426,
  385. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  386. 0.0, NXT_MTCH_BOX, CONT_ANIM );
  387. NextMatchHighlight = ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX,
  388. -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  389. break;
  390. case( SEMI_FINALS ):
  391. NextMatchHandle = AddAnimation( 446, 426,
  392. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  393. 0.0, NXT_MTCH_BOX, CONT_ANIM );
  394. NextMatchHighlight = ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX,
  395. -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  396. break;
  397. case( FINAL_MATCH ):
  398. DisplayString( 12, 98,
  399. GetTEXT ( FNAL_HEAD ),
  400. MEDIUM_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  401. SpinningCupHandle = AddAnimation( 167, 129,
  402. ( (float)EUCP_IMGS ), ( (float)EUCP_IMGS+29.9 ),
  403. 0.40, EUROCUP_BOX, CONT_ANIM );
  404. NextMatchHandle = AddAnimation( 446, 426,
  405. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  406. 0.0, NXT_MTCH_BOX, CONT_ANIM );
  407. NextMatchHighlight = ControlOptionHighlight( -1, NXT_MTCH_BOX, NXT_MTCHdisp_BOX,
  408. -1, NextMatchHandle, BUTN_LBLS+NextMatch );
  409. break;
  410. }
  411. SetupMouseLimits( 0, 626, 1, 452 );
  412. }
  413. //********************************************************************************************************************************
  414. void OverlayStaticBackgroundImages( char MENU )
  415. {
  416. int width;
  417. switch ( MENU )
  418. {
  419. case( SQUAD_SELECT ):
  420. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  421. SMLL_GOTH+Team, 550, 2, NO_BOX, spritecopy );
  422. width = PixelLengthOfString( GetTEAMname( Team, 0 ),
  423. LARGE_FONT);
  424. Image_Widths[INFO_NBAR+Lft] = Image_Widths[INFO_NBAR+Rgt]+width;
  425. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  426. INFO_NBAR+Lft, NameBarXposn,
  427. 106, NO_BOX, spritecopy );
  428. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  429. INFO_NBAR+Rgt, NameBarXposn+Image_Widths[INFO_NBAR+Lft],
  430. 106, NO_BOX, spritecopy );
  431. Image_Widths[INFO_NBAR+Lft] = FORMATION_BAR_WIDTH;
  432. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  433. INFO_NBAR+Lft, NameBarXposn,
  434. 426, NO_BOX, spritecopy );
  435. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  436. INFO_NBAR+Rgt, NameBarXposn+Image_Widths[INFO_NBAR+Lft],
  437. 426, NO_BOX, spritecopy );
  438. DisplayString( NameBarXposn+Image_Widths[INFO_NBAR+Rgt], 110,
  439. GetTEXT(Team+TEAM_NMES),
  440. LARGE_FONT, 24, TEAM_BOX, &FrontendBackgroundDEFN, &FrontendTextureDEFN );
  441. break;
  442. case( GROUP_FIXTURES ):
  443. CalculateLeagueTables();
  444. DisplayLeagueTables();
  445. DisplayLeagueFixtures( MatchNumber );
  446. break;
  447. case( TEAM_SELECT ):
  448. DisplayLowerSelectionPanel( EUROgameType );
  449. DisplayCountrySelectImages();
  450. ReadData( BIN_DRAWPAL, &EuroDATfile[0], &SparePaletteBuffer[0] );
  451. memcpy( &PaletteBuffer[44*3], &SparePaletteBuffer[ (LeagueColourOffsets[EUROteamA]*3)+3 ], 7*3 );
  452. memcpy( &PaletteBuffer[51*3], &SparePaletteBuffer[ (LeagueColourOffsets[EUROteamB]*3)+3 ], 7*3 );
  453. break;
  454. case( PLAYER_STATS ):
  455. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  456. SMLL_GOTH+Team, 550, 2, NO_BOX, spritecopy );
  457. break;
  458. case( PLAYER_SETUP ):
  459. DisplayUserPanels( EUROgameType );
  460. DisplayUserLabels(EUROplyrSetup);
  461. break;
  462. case( TEAM_STATS ):
  463. width = PixelLengthOfString( GetTEAMname( EUROstatTeam, 0 ),
  464. LARGE_FONT);
  465. Image_Widths[TBAR_STAT+Lft] = Image_Widths[TBAR_STAT+Rgt]+width;
  466. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  467. TBAR_STAT+Lft, NameBarXposn,
  468. 106, NO_BOX, spritecopy );
  469. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  470. TBAR_STAT+Rgt, NameBarXposn+Image_Widths[TBAR_STAT+Lft],
  471. 106, NO_BOX, spritecopy );
  472. DisplayString( NameBarXposn+Image_Widths[TBAR_STAT+Rgt], 110,
  473. GetTEXT(EUROstatTeam+TEAM_NMES),
  474. LARGE_FONT, 36, NO_BOX, &FrontendBackgroundDEFN, &FrontendTextureDEFN );
  475. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  476. BCNT_IMGS+EUROstatTeam,
  477. TSTATCountryPosnDEFN[EUROstatTeam].xposn,
  478. TSTATCountryPosnDEFN[EUROstatTeam].yposn,
  479. NO_BOX, spritecopy );
  480. DisplayTeamStats();
  481. break;
  482. case( MODEM_SETUP ):
  483. ModemXposn = DisplayModemSetupPanel();
  484. break;
  485. case( NEXT_MATCH ):
  486. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  487. LRGE_GOTH+EUROteamA,
  488. 24, 146,
  489. NO_BOX, flipsprcopy );
  490. DrawIMAGE( &FrontendBackgroundDEFN, &FrontendTextureDEFN,
  491. LRGE_GOTH+EUROteamB,
  492. 252, 146,
  493. NO_BOX, spritecopy );
  494. DisplayString( 237 - (PixelLengthOfString(GetTEXT( VRUS_LBLE ), LARGE_FONT))/2,
  495. 414, GetTEXT( VRUS_LBLE ),
  496. LARGE_FONT, 22, NO_BOX,
  497. &FrontendBackgroundDEFN, &FrontendTextureDEFN );
  498. break;
  499. case( QUALIFIERS ):
  500. DisplayQualifierGroupHeadings();
  501. DisplayQualifyingTeams();
  502. break;
  503. case( QUARTER_FINALS ):
  504. DisplayFinalRoundFixtures( MatchNumber, Menu );
  505. break;
  506. case( SEMI_FINALS ):
  507. DisplayFinalRoundFixtures( MatchNumber, Menu );
  508. break;
  509. case( FINAL_MATCH ):
  510. DisplayFinalRoundFixtures( MatchNumber, Menu );
  511. break;
  512. }
  513. }
  514. //********************************************************************************************************************************
  515. void SetupExtraTexturePages( int MENU )
  516. {
  517. switch ( MENU )
  518. {
  519. case( SQUAD_SELECT ):
  520. LoadTexturePage( BIN_PAGE2,
  521. &EuroDATfile[0],
  522. 2, &FrontendTextureDEFN );
  523. LoadTexturePage( BIN_PAGE3,
  524. &EuroDATfile[0],
  525. 3, &FrontendTextureDEFN );
  526. break;
  527. case( TEAM_SELECT ):
  528. LoadTexturePage( BIN_PAGE4,
  529. &EuroDATfile[0],
  530. 2, &FrontendTextureDEFN );
  531. LoadTexturePage( BIN_PAGE5,
  532. &EuroDATfile[0],
  533. 3, &FrontendTextureDEFN );
  534. LoadTexturePage( BIN_PAGE6,
  535. &EuroDATfile[0],
  536. 4, &FrontendTextureDEFN );
  537. LoadTexturePage( BIN_PAGE7,
  538. &EuroDATfile[0],
  539. 5, &FrontendTextureDEFN );
  540. LoadTexturePage( BIN_PAGE8,
  541. &EuroDATfile[0],
  542. 6, &FrontendTextureDEFN );
  543. LoadTexturePage( BIN_PAGE9,
  544. &EuroDATfile[0],
  545. 7, &FrontendTextureDEFN );
  546. break;
  547. case( EURO_REDRAW ):
  548. LoadTexturePage( BIN_PAGE10,
  549. &EuroDATfile[0],
  550. 2, &FrontendTextureDEFN );
  551. LoadTexturePage( BIN_PAGE11,
  552. &EuroDATfile[0],
  553. 3, &FrontendTextureDEFN );
  554. LoadTexturePage( BIN_PAGE12,
  555. &EuroDATfile[0],
  556. 4, &FrontendTextureDEFN );
  557. break;
  558. case( PLAYER_STATS ):
  559. LoadTexturePage( BIN_PAGE2,
  560. &EuroDATfile[0],
  561. 2, &FrontendTextureDEFN );
  562. LoadTexturePage( BIN_PAGE13,
  563. &EuroDATfile[0],
  564. 3, &FrontendTextureDEFN );
  565. break;
  566. case( PLAYER_SETUP ):
  567. LoadTexturePage( BIN_PAGE13,
  568. &EuroDATfile[0],
  569. 3, &FrontendTextureDEFN );
  570. LoadTexturePage( BIN_PAGE16,
  571. &EuroDATfile[0],
  572. 4, &FrontendTextureDEFN );
  573. LoadTexturePage( BIN_PAGE20,
  574. &EuroDATfile[0],
  575. 5, &FrontendTextureDEFN );
  576. LoadTexturePage( BIN_PAGE21,
  577. &EuroDATfile[0],
  578. 6, &FrontendTextureDEFN );
  579. LoadTexturePage( BIN_PAGE22,
  580. &EuroDATfile[0],
  581. 7, &FrontendTextureDEFN );
  582. break;
  583. case( TEAM_STATS ):
  584. LoadTexturePage( BIN_PAGE14,
  585. &EuroDATfile[0],
  586. 4, &FrontendTextureDEFN );
  587. LoadTexturePage( BIN_PAGE15,
  588. &EuroDATfile[0],
  589. 5, &FrontendTextureDEFN );
  590. LoadTexturePage( BIN_PAGE16,
  591. &EuroDATfile[0],
  592. 6, &FrontendTextureDEFN );
  593. break;
  594. case( NEXT_MATCH ):
  595. LoadTexturePage( BIN_PAGE17,
  596. &EuroDATfile[0],
  597. 2, &FrontendTextureDEFN );
  598. LoadTexturePage( BIN_PAGE18,
  599. &EuroDATfile[0],
  600. 3, &FrontendTextureDEFN );
  601. LoadTexturePage( BIN_PAGE19,
  602. &EuroDATfile[0],
  603. 4, &FrontendTextureDEFN );
  604. break;
  605. case( FINAL_MATCH ):
  606. LoadTexturePage( BIN_PAGE23,
  607. &EuroDATfile[0],
  608. 2, &FrontendTextureDEFN );
  609. LoadTexturePage( BIN_PAGE24,
  610. &EuroDATfile[0],
  611. 3, &FrontendTextureDEFN );
  612. LoadTexturePage( BIN_PAGE25,
  613. &EuroDATfile[0],
  614. 4, &FrontendTextureDEFN );
  615. LoadTexturePage( BIN_PAGE26,
  616. &EuroDATfile[0],
  617. 5, &FrontendTextureDEFN );
  618. break;
  619. }
  620. }
  621. //********************************************************************************************************************************
  622. void __far EUROinterupt(void)
  623. {
  624. fixed red, green, blue;
  625. if ( LogicState == PALETTE_FADEUP )
  626. {
  627. if ( FadeCounter < 1 || FadeCounter > FADE_COUNTER )
  628. {
  629. fixed *a;
  630. BYTE *Palette;
  631. a = &DivisionTable[0];
  632. Palette = &PaletteBuffer[0];
  633. FadeCounter = FADE_COUNTER;
  634. for ( int c=0; c < 256; c++ )
  635. {
  636. red = (*(Palette++));
  637. green = (*(Palette++));
  638. blue = (*(Palette++));
  639. (*(a++)) = red / FADE_COUNTER;
  640. (*(a++)) = green / FADE_COUNTER;
  641. (*(a++)) = blue / FADE_COUNTER;
  642. }
  643. memset( CurrentPalette, 0, 768 );
  644. }
  645. fixed *a;
  646. fixed *b;
  647. BYTE *Palette;
  648. a = &CurrentPalette[0];
  649. b = &DivisionTable[0];
  650. for ( int c=0; c < 256; c++ )
  651. {
  652. red = (fixed) (*(a)) + (*(b++));
  653. (*(a++)) = red;
  654. green = (fixed) (*(a)) + (*(b++));
  655. (*(a++)) = green;
  656. blue = (fixed) (*(a)) + (*(b++));
  657. (*(a++)) = blue;
  658. outp ( 0x3c8, c );
  659. outp ( 0x3c9, (BYTE) red );
  660. outp ( 0x3c9, (BYTE) green );
  661. outp ( 0x3c9, (BYTE) blue );
  662. }
  663. FadeCounter = FadeCounter -1;
  664. if ( FadeCounter < 1 )
  665. {
  666. Palette = &PaletteBuffer[0];
  667. for ( int c=0; c < 256; c++ )
  668. {
  669. outp ( 0x3c8, c );
  670. outp ( 0x3c9, (*( Palette++ ) ) );
  671. outp ( 0x3c9, (*( Palette++ ) ) );
  672. outp ( 0x3c9, (*( Palette++ ) ) );
  673. }
  674. fixed *a;
  675. BYTE *Palette;
  676. a = &CurrentPalette[0];
  677. Palette = &PaletteBuffer[0];
  678. for ( int d=0; d < 256; d++ )
  679. {
  680. red = (*(Palette++));
  681. green = (*(Palette++));
  682. blue = (*(Palette++));
  683. (*(a++)) = red;
  684. (*(a++)) = green;
  685. (*(a++)) = blue;
  686. }
  687. LogicState = RUN_FRONTEND;
  688. FadeCounter = 0;
  689. }
  690. }
  691. else
  692. if ( LogicState == PALETTE_FADEDOWN )
  693. {
  694. if ( FadeCounter < 1 || FadeCounter > FADE_COUNTER )
  695. {
  696. fixed *a;
  697. fixed *Palette;
  698. a = &DivisionTable[0];
  699. Palette = &CurrentPalette[0];
  700. FadeCounter = FADE_COUNTER;
  701. for ( int c=0; c < 256; c++ )
  702. {
  703. red = (*(Palette++));
  704. green = (*(Palette++));
  705. blue = (*(Palette++));
  706. (*(a++)) = red / FADE_COUNTER;
  707. (*(a++)) = green / FADE_COUNTER;
  708. (*(a++)) = blue / FADE_COUNTER;
  709. }
  710. }
  711. fixed *a;
  712. fixed *b;
  713. BYTE *Palette;
  714. a = &CurrentPalette[0];
  715. b = &DivisionTable[0];
  716. for ( int c=0; c < 256; c++ )
  717. {
  718. red = (fixed) (*(a)) - (*(b++));
  719. (*(a++)) = red;
  720. green = (fixed) (*(a)) - (*(b++));
  721. (*(a++)) = green;
  722. blue = (fixed) (*(a)) - (*(b++));
  723. (*(a++)) = blue;
  724. outp ( 0x3c8, c );
  725. outp ( 0x3c9, (BYTE) red );
  726. outp ( 0x3c9, (BYTE) green );
  727. outp ( 0x3c9, (BYTE) blue );
  728. }
  729. FadeCounter = FadeCounter -1;
  730. if ( FadeCounter < 1 )
  731. {
  732. for ( int c=0; c < 256; c++ )
  733. {
  734. outp ( 0x3c8, c );
  735. outp ( 0x3c9, 0 );
  736. outp ( 0x3c9, 0 );
  737. outp ( 0x3c9, 0 );
  738. }
  739. memset( CurrentPalette, 0, 768 );
  740. FadeCounter = 0;
  741. LogicState = BLANK_SCREEN;
  742. Finish++;
  743. }
  744. }
  745. if ( LogicState == RUN_FRONTEND )
  746. SelectFrame+= f2L(.55);
  747. else
  748. SelectFrame = 0;
  749. CursorDisplaySpeed+= f2L(.05);
  750. if ( CursorDisplaySpeed > 1 )
  751. CursorDisplaySpeed-= f2L(1.0);
  752. }
  753. //********************************************************************************************************************************
  754. void DisplayBoundingBoxes()
  755. {
  756. for ( int b=0; b < MAX_BOUNDING_BOXES; b++ )
  757. {
  758. if ( Bounding_table[b].BoundingBoxLeft != -1 )
  759. printf("%d used \n",b);
  760. fflush(stdout);
  761. }
  762. }
  763. //********************************************************************************************************************************
  764. void ResetBoundingBoxes()
  765. {
  766. for ( short b=0; b < MAX_BOUNDING_BOXES; b++ )
  767. {
  768. Bounding_table[b].BoundingBoxLeft = -1;
  769. Bounding_table[b].BoundingBoxRight = -1;
  770. Bounding_table[b].BoundingBoxTop = -1;
  771. Bounding_table[b].BoundingBoxBottom = -1;
  772. }
  773. }
  774. //********************************************************************************************************************************
  775. signed char GetBoundingBox( short xposn, short yposn )
  776. {
  777. signed char box = -1;
  778. for ( int b=0; b < MAX_BOUNDING_BOXES; b++ )
  779. {
  780. if ( xposn > Bounding_table[b].BoundingBoxLeft
  781. && xposn < Bounding_table[b].BoundingBoxRight
  782. && yposn > Bounding_table[b].BoundingBoxTop
  783. && yposn < Bounding_table[b].BoundingBoxBottom
  784. && Bounding_table[b].BoundingBoxLeft>=0
  785. )
  786. box = b;
  787. }
  788. return(box);
  789. }
  790. //********************************************************************************************************************************
  791. void StartingEURO_96( char gametype )
  792. {
  793. if ( gametype == EURO_network_game )
  794. EUROcommTYPE = 0;
  795. if ( gametype == EURO_serial_game )
  796. EUROcommTYPE = 1;
  797. if ( gametype == EURO_modem_game )
  798. EUROcommTYPE = 2;
  799. if ( gametype == EURO_wireplay )
  800. EUROcommTYPE = 3;
  801. if ( EUROcommOVERIDE <128 )
  802. EUROcommTYPE = EUROcommOVERIDE;
  803. if ( EUROverbose != 0 )
  804. {
  805. printf("þ Calling Set_Comm_Type with comm type: %d\n", EUROcommTYPE );
  806. fflush(stdout);
  807. }
  808. Set_Comm_Type( EUROcommTYPE ); // 0 network 1 serial 2 modem 3 wireplay
  809. if ( EUROverbose != 0 )
  810. {
  811. printf("þ Calling Start_Network_Game.\n");
  812. fflush(stdout);
  813. }
  814. if ( Start_Network_Game() != 0 )
  815. {
  816. if ( gametype == EURO_wireplay )
  817. {
  818. printf ("þ ERROR, cannot initialise WIREPLAY game.\n");
  819. fflush(stdout);
  820. }
  821. if ( gametype == EURO_network_game )
  822. {
  823. printf ("þ ERROR, cannot initialise NETWORK game.\n");
  824. fflush(stdout);
  825. }
  826. if ( gametype == EURO_serial_game )
  827. {
  828. printf ("þ ERROR, cannot initialise SERIAL game.\n");
  829. fflush(stdout);
  830. }
  831. if ( gametype == EURO_modem_game )
  832. {
  833. printf ("þ ERROR, cannot initialise MODEM game.\n");
  834. fflush(stdout);
  835. }
  836. EUROgameType = EURO_friendly;
  837. }
  838. else
  839. {
  840. EURO_NetSelectionMade = No;
  841. for (char t=0; t<20; t++)
  842. {TickPause();}
  843. }
  844. }
  845. //********************************************************************************************************************************
  846. void DoMainScreen( char MENU )
  847. {
  848. if ( MENU == MAIN && LogicState == RUN_FRONTEND )
  849. {
  850. if ( ButtonState != 0 )
  851. {
  852. ChangeMenu = TEAM_SELECT;
  853. DeBounce = TRUE;
  854. EUROoveride = 0;
  855. if ( EUROgameType == EURO_network_game ||
  856. EUROgameType == EURO_modem_game ||
  857. EUROgameType == EURO_serial_game )
  858. StartingEURO_96( EUROgameType );
  859. }
  860. }
  861. }
  862. //********************************************************************************************************************************
  863. char ConfigureTeamView()
  864. {
  865. if ( EUROteamView&=1 )
  866. return(EUROteamB);
  867. else
  868. return(EUROteamA);
  869. }
  870. //********************************************************************************************************************************