EURO_MAT.CPP 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897
  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include <graph.h>
  4. #include <i86.h>
  5. #include <dos.h>
  6. #include <conio.h>
  7. #include <float.h>
  8. #include <time.h>
  9. #include <math.h>
  10. #include <string.h>
  11. #include "defines.h"
  12. #include "data.equ"
  13. #include "3deng.h"
  14. #include "intronet.h"
  15. #include "sos.h"
  16. #include "audio.h"
  17. #include "digi.h"
  18. #include "midi.h"
  19. #include "config.h"
  20. #include "timer.h"
  21. #include "mallocx.h"
  22. #include "unmangle.h"
  23. #include "gamedata.h"
  24. #include "eurodefs.h"
  25. #include "euro_fxd.h"
  26. #include "euro.equ"
  27. #include "euro_sym.h"
  28. #include "euro_def.h"
  29. #include "euro_var.h"
  30. #include "euro_mem.h"
  31. #include "euro_spt.h"
  32. #include "euro_gen.h"
  33. #include "euro_grf.h"
  34. #include "euro_cnt.h"
  35. #include "euro_dsk.h"
  36. #include "euro_sqd.h"
  37. #include "euro_sel.h"
  38. #include "euro_fix.h"
  39. #include "euro_usr.h"
  40. #include "euro_inf.h"
  41. #include "euro_gdv.h"
  42. #include "euro_win.h"
  43. #include "euro_net.h"
  44. #include "euro_cmd.h"
  45. #include "euro_rnd.h"
  46. #include "euro_int.h"
  47. extern char suspend_audio;
  48. extern int music_state;
  49. extern void init_keyboard();
  50. extern void init_users();
  51. extern void init_team();
  52. extern "C" char old_mf;
  53. extern "C" int x1ok;
  54. extern "C" int y1ok;
  55. extern "C" int x2ok;
  56. extern "C" int y2ok;
  57. extern "C" int bitaccept;
  58. extern match(int argc, char **argv);
  59. struct passback_per{
  60. short per;
  61. short inj;
  62. char dpts;
  63. };
  64. extern passback_per performance[40];
  65. //********************************************************************************************************************************
  66. void setup_player_data(int team_no)
  67. {
  68. }
  69. //********************************************************************************************************************************
  70. void get_cup_venue()
  71. {
  72. }
  73. //********************************************************************************************************************************
  74. void PlayMatch(int argc, char **argv)
  75. {
  76. char CommsSetup;
  77. if ( EUROgameType == EURO_network_game ||
  78. EUROgameType == EURO_wireplay ||
  79. EUROgameType == EURO_serial_game ||
  80. EUROgameType == EURO_modem_game )
  81. CommsSetup = Yes;
  82. else
  83. CommsSetup = No;
  84. // old actua suspend_audio = 1;
  85. // old actua StopSong();
  86. // old actua music_state = NULL;
  87. if (EUROverbose)
  88. printf("\n DEALLOCATING MEMORY BEFORE RUNNING MATCH.\n\n");
  89. DeAllocateTexturePages();
  90. DeAllocateDisplayBuffers();
  91. init_keyboard();
  92. init_users();
  93. key_togs[0x2f] = match_info.vidi;
  94. // old actua setup.stadium = 1;
  95. if (!network_on)
  96. old_mf = TRUE;
  97. else
  98. old_mf = FALSE;
  99. x1ok = NULL;
  100. x2ok = NULL;
  101. y1ok = NULL;
  102. y1ok = NULL;
  103. bitaccept = NULL;
  104. // old actua if (cal0!=NULL)
  105. // old actua {
  106. // old actua x1ok = 1;
  107. // old actua y1ok = 2;
  108. // old actua bitaccept|= (x1ok+y1ok);
  109. // old actua }
  110. // old actua
  111. // old actua
  112. // old actua if (cal1!=NULL)
  113. // old actua {
  114. // old actua x2ok = 4;
  115. // old actua y2ok = 8;
  116. // old actua bitaccept|= (x2ok+y2ok);
  117. // old actua }
  118. setup.stadium = match_info.venue;
  119. // old actua key1[UP_KEY] = InsertKey(batch_info.keys_used[UP_RED]); //0x1e;
  120. // old actua key1[DN_KEY] = InsertKey(batch_info.keys_used[DN_RED]); //0x2c;
  121. // old actua key1[LF_KEY] = InsertKey(batch_info.keys_used[LF_RED]); //0x33;
  122. // old actua key1[RT_KEY] = InsertKey(batch_info.keys_used[RT_RED]); //0x34;
  123. // old actua key1[F1_KEY] = InsertKey(batch_info.keys_used[F1_RED]); //0x10;
  124. // old actua key1[F2_KEY] = InsertKey(batch_info.keys_used[F2_RED]); //0x35;
  125. // old actua
  126. // old actua key2[UP_KEY] = InsertKey(batch_info.keys_used[UP_RED+6]); //-0x48;
  127. // old actua key2[DN_KEY] = InsertKey(batch_info.keys_used[DN_RED+6]); //-0x50;
  128. // old actua key2[LF_KEY] = InsertKey(batch_info.keys_used[LF_RED+6]); //-0x4b;
  129. // old actua key2[RT_KEY] = InsertKey(batch_info.keys_used[RT_RED+6]); //-0x4d;
  130. // old actua key2[F1_KEY] = InsertKey(batch_info.keys_used[F1_RED+6]); //0x52;
  131. // old actua key2[F2_KEY] = InsertKey(batch_info.keys_used[F2_RED+6]); //0x53;
  132. // old actua
  133. // to add match_info.team_a_score = 0;
  134. // to add match_info.team_b_score = 0;
  135. // to add match_info.team_a_penalties = 0;
  136. // to add match_info.team_b_penalties = 0;
  137. // to add match_info.penalties = 0;
  138. // to add match_info.extra = 0;
  139. // old actua if (keyboard==0)
  140. // old actua InitialiseMOUSE();
  141. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  142. //º º
  143. //º MATCH SETUP MODULE-> PASSING FRONTEND DATA TO ANDY's SECTION º
  144. //º º
  145. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  146. EUROmatch_info.GameType = EUROgameType;
  147. if ( CommsSetup == Yes )
  148. {
  149. EUROmatch_info.rand = 1234;
  150. EUROmatch_info.offside = Off;
  151. EUROmatch_info.wind = Off;
  152. EUROmatch_info.substitutes = Off;
  153. EUROmatch_info.bookings = Off;
  154. EUROmatch_info.freekicks = Off;
  155. match_info.rand = 1234;
  156. match_info.offside = Off;
  157. match_info.wind = Off;
  158. match_info.substitutes = Off;
  159. match_info.bookings = Off;
  160. match_info.freekicks = Off;
  161. old_mf = FALSE;
  162. }
  163. else
  164. {
  165. EUROmatch_info.rand = GetRnd2();
  166. EUROmatch_info.offside = EUROoffside;
  167. EUROmatch_info.wind = EUROwind;
  168. EUROmatch_info.substitutes = EUROsubs;
  169. EUROmatch_info.bookings = EURObookings;
  170. EUROmatch_info.freekicks = EUROfouls;
  171. match_info.rand = GetRnd2();
  172. match_info.offside = EUROoffside;
  173. match_info.wind = EUROwind;
  174. match_info.substitutes = EUROsubs;
  175. match_info.bookings = EURObookings;
  176. match_info.freekicks = EUROfouls;
  177. old_mf = TRUE;
  178. }
  179. EUROmatch_info.camera = EUROcamera;
  180. EUROmatch_info.audio = EUROaudio;
  181. EUROmatch_info.crowd = EUROcrowd;
  182. EUROmatch_info.pitch = EUROpitch;
  183. EUROmatch_info.commentary = EUROcommentary;
  184. EUROmatch_info.music = EUROmusic;
  185. EUROmatch_info.master = EUROmaster;
  186. EUROmatch_info.timeit = EUROtimeit;
  187. EUROmatch_info.vidi = EUROvidi;
  188. EUROmatch_info.time = EUROtime;
  189. EUROmatch_info.tga_enable = EUROtga;
  190. match_info.camera = EUROcamera;
  191. match_info.audio = EUROaudio;
  192. match_info.crowd = EUROcrowd;
  193. match_info.pitch = EUROpitch;
  194. match_info.commentary = EUROcommentary;
  195. match_info.music = EUROmusic;
  196. match_info.master = EUROmaster;
  197. match_info.timeit = EUROtimeit;
  198. match_info.vidi = EUROvidi;
  199. match_info.time = EUROtime;
  200. match_info.tga_enable = EUROtga;
  201. EUROmatch_info.tac_1 = 0;
  202. EUROmatch_info.tac_2 = 0;
  203. match_info.tac_1 = 0;
  204. match_info.tac_2 = 0;
  205. EUROmatch_info.Team_A_goals = 0;
  206. EUROmatch_info.Team_B_goals = 0;
  207. EUROmatch_info.penalties = 0;
  208. EUROmatch_info.extra = 0;
  209. EUROmatch_info.Team_A_penalties = 0;
  210. EUROmatch_info.Team_B_penalties = 0;
  211. EUROmatch_info.return_mins = 0;
  212. EUROmatch_info.language = 0;
  213. match_info.team_a_score = 0;
  214. match_info.team_b_score = 0;
  215. match_info.penalties = 0;
  216. match_info.extra = 0;
  217. match_info.team_a_penalties = 0;
  218. match_info.team_b_penalties = 0;
  219. match_info.return_mins = 0;
  220. match_info.language = 0;
  221. setup.stadium = EUROvenue;
  222. setup.detail.sky = EUROsky;
  223. setup.detail.lines = EUROlineDetail;
  224. setup.vidi_type = EUROvidiType;
  225. setup.detail.players = EUROplyrDetail;
  226. setup.detail.pitch = EUROptchDetail;
  227. setup.start_res = EUROresoln;
  228. setup.screen_size = EUROscrSize;
  229. setup.team_a = EUROteamA;
  230. setup.team_b = EUROteamB;
  231. for (char c=0; c<4; c++)
  232. {EUROmatch_info.CntrlTypes[c] = -1;}
  233. EUROmatch_info.TeamA_users = 0;
  234. EUROmatch_info.TeamB_users = 0;
  235. char UserFlag = 1;
  236. char CntrlCnt = 0;
  237. // Euro Championship / Friendly / Practice games
  238. for (char u=0; u<EUROnoOfMatchPlyrs; u++)
  239. {
  240. if (EUROverbose)
  241. printf("  User %d %s\n", u,
  242. GetTEAMname( UserList[u].team, 11) );
  243. if ( UserList[u].team == setup.team_a )
  244. {
  245. EUROmatch_info.TeamA_users|= UserFlag;
  246. EUROmatch_info.CntrlTypes[CntrlCnt] = UserList[u].control;
  247. EUROmatch_info.PlyrTypes[CntrlCnt] = UserList[u].player;
  248. UserFlag+= UserFlag;
  249. CntrlCnt++;
  250. }
  251. if ( UserList[u].team == setup.team_b )
  252. {
  253. EUROmatch_info.TeamB_users|= UserFlag;
  254. EUROmatch_info.CntrlTypes[CntrlCnt] = UserList[u].control;
  255. EUROmatch_info.PlyrTypes[CntrlCnt] = UserList[u].player;
  256. UserFlag+= UserFlag;
  257. CntrlCnt++;
  258. }
  259. }
  260. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  261. //º º
  262. //º COPY BOTH TEAMS PLAYER DATA INTO MATCH INFO º
  263. //º º
  264. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  265. strcpy( &EUROmatch_info.TeamAname[0], GetTEAMname( EUROteamA, 11) );
  266. strcpy( &EUROmatch_info.TeamBname[0], GetTEAMname( EUROteamB, 11) );
  267. memcpy( &EUROmatch_info.TeamAsquad[0], &SquadInfo[ (EUROteamA*20) ], 20 );
  268. memcpy( &EUROmatch_info.TeamBsquad[0], &SquadInfo[ (EUROteamB*20) ], 20 );
  269. if (EUROverbose)
  270. {
  271. printf("\n MATCH INTERFACE DATA:\n\n");
  272. printf("  Home Team: %s\n", &EUROmatch_info.TeamAname[0] );
  273. printf("  Away Team: %s\n\n", &EUROmatch_info.TeamBname[0] );
  274. }
  275. short PlyrIndex1, PlyrIndex2;
  276. for (char p=0; p<20; p++)
  277. {
  278. PlyrIndex1 = NormalisePlayer( p, EUROteamA );
  279. PlyrIndex2 = NormalisePlayer( p, EUROteamB );
  280. EUROmatch_info.TeamA[p].pace = Pace[ PlyrIndex1 ];
  281. EUROmatch_info.TeamA[p].power = Power[ PlyrIndex1 ];
  282. EUROmatch_info.TeamA[p].control = Control[ PlyrIndex1 ];
  283. EUROmatch_info.TeamA[p].flair = Flair[ PlyrIndex1 ];
  284. EUROmatch_info.TeamA[p].vision = Vision[ PlyrIndex1 ];
  285. EUROmatch_info.TeamA[p].accuracy = Accuracy[ PlyrIndex1 ];
  286. EUROmatch_info.TeamA[p].stamina = Stamina[ PlyrIndex1 ];
  287. EUROmatch_info.TeamA[p].discipline = Discipline[ PlyrIndex1 ];
  288. EUROmatch_info.TeamA[p].fitness = Fitness[ PlyrIndex1 ];
  289. if (EUROverbose)
  290. {
  291. printf("plyr %d (%d) pace: %d power: %d cntrl: %d flair: %d vision: %d accry: %d stam: %d disc: %d fit: %d\n",
  292. p, PlyrIndex1,
  293. EUROmatch_info.TeamA[p].pace,
  294. EUROmatch_info.TeamA[p].power,
  295. EUROmatch_info.TeamA[p].control,
  296. EUROmatch_info.TeamA[p].flair,
  297. EUROmatch_info.TeamA[p].vision,
  298. EUROmatch_info.TeamA[p].accuracy,
  299. EUROmatch_info.TeamA[p].stamina,
  300. EUROmatch_info.TeamA[p].discipline,
  301. EUROmatch_info.TeamA[p].fitness);
  302. }
  303. EUROmatch_info.TeamB[p].pace = Pace[ PlyrIndex2 ];
  304. EUROmatch_info.TeamB[p].power = Power[ PlyrIndex2 ];
  305. EUROmatch_info.TeamB[p].control = Control[ PlyrIndex2 ];
  306. EUROmatch_info.TeamB[p].flair = Flair[ PlyrIndex2 ];
  307. EUROmatch_info.TeamB[p].vision = Vision[ PlyrIndex2 ];
  308. EUROmatch_info.TeamB[p].accuracy = Accuracy[ PlyrIndex2 ];
  309. EUROmatch_info.TeamB[p].stamina = Stamina[ PlyrIndex2 ];
  310. EUROmatch_info.TeamB[p].discipline = Discipline[ PlyrIndex2 ];
  311. EUROmatch_info.TeamB[p].fitness = Fitness[ PlyrIndex2 ];
  312. }
  313. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  314. //º º
  315. //º VERBOSE INFORMATION, DISPLAYS MATCH DATA IF REQUESTED º
  316. //º º
  317. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  318. if (EUROverbose)
  319. {
  320. printf("  Number Of Users Playing Next Match: %d\n",CntrlCnt);
  321. for (char u=0; u<CntrlCnt; u++)
  322. {printf("  User %d %s\n",
  323. u, GetTEXT( CNTL_LBLS+EUROmatch_info.CntrlTypes[u]) );}
  324. }
  325. // EUROmatch_info.EscKey = CntrlCnt;
  326. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  327. //º º
  328. //º EXECUTE MATCH º
  329. //º º
  330. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  331. init_team();
  332. // setup.team_a = 0;
  333. // setup.team_b = 1;
  334. EUROmatch_info.referee_vision = EUROref_vision;
  335. EUROmatch_info.referee_discipline = EUROref_discipline;
  336. match_info.bookings = EURObookings;
  337. strcpy( &EUROmatch_info.RefsName[0], "TOM JONES" );
  338. if (EUROverbose)
  339. {
  340. printf("\n MATCH AND ENVIRONMENT SETTINGS.\n\n");
  341. printf("  Bookings: %s\n", GetTEXT( SETG_TEXT+(EUROmatch_info.bookings & 1) ) );
  342. printf("  Freekicks: %s\n", GetTEXT( SETG_TEXT+(EUROmatch_info.freekicks & 1) ) );
  343. }
  344. EUROerror|= match(argc,argv);
  345. Results[MatchNumber].HomeScore = EUROmatch_info.Team_A_goals;
  346. Results[MatchNumber].AwayScore = EUROmatch_info.Team_B_goals;
  347. if ( MatchNumber > 23 )
  348. {
  349. Results[MatchNumber].AfterExtra = EUROmatch_info.extra;
  350. Results[MatchNumber].AfterPens = EUROmatch_info.penalties;
  351. Results[MatchNumber].HomePens = EUROmatch_info.Team_A_penalties;
  352. Results[MatchNumber].AwayPens = EUROmatch_info.Team_B_penalties;
  353. Results[MatchNumber].WinningTeam = EUROteamA;
  354. Results[MatchNumber].Message = ProceedToNextRnd;
  355. if ( EUROmatch_info.extra == 0 && EUROmatch_info.penalties == 0 )
  356. {
  357. Results[MatchNumber].Message = ProceedToNextRnd;
  358. if ( EUROmatch_info.Team_A_goals > EUROmatch_info.Team_B_goals )
  359. Results[MatchNumber].WinningTeam = EUROteamA;
  360. else
  361. Results[MatchNumber].WinningTeam = EUROteamB;
  362. }
  363. else
  364. if ( EUROmatch_info.extra != 0 && EUROmatch_info.penalties == 0 )
  365. {
  366. Results[MatchNumber].Message = ExtraTime;
  367. if ( EUROmatch_info.Team_A_goals > EUROmatch_info.Team_B_goals )
  368. Results[MatchNumber].WinningTeam = EUROteamA;
  369. else
  370. Results[MatchNumber].WinningTeam = EUROteamB;
  371. }
  372. else
  373. if ( EUROmatch_info.extra != 0 && EUROmatch_info.penalties == 0 )
  374. {
  375. Results[MatchNumber].Message = Penalties;
  376. if ( EUROmatch_info.Team_A_penalties > EUROmatch_info.Team_B_penalties )
  377. Results[MatchNumber].WinningTeam = EUROteamA;
  378. else
  379. Results[MatchNumber].WinningTeam = EUROteamB;
  380. }
  381. }
  382. // ProcessResultData(MatchNumber);
  383. for (p=0; p<20; p++)
  384. {
  385. PlyrIndex1 = NormalisePlayer( p, EUROteamA );
  386. PlyrIndex2 = NormalisePlayer( p, EUROteamB );
  387. // printf("home index %d = %d\n", p, PlyrIndex1);
  388. if ( performance[p].inj > Fitness[PlyrIndex1] )
  389. Fitness[PlyrIndex1] = 1;
  390. else
  391. Fitness[PlyrIndex1]-= performance[p].inj;
  392. DiscPts[PlyrIndex1]+= performance[p].dpts;
  393. if ( performance[p+20].inj > Fitness[PlyrIndex2] )
  394. Fitness[PlyrIndex2] = 1;
  395. else
  396. Fitness[PlyrIndex2]-= performance[p+20].inj;
  397. DiscPts[PlyrIndex2]+= performance[p+20].dpts;
  398. if ( Fitness[PlyrIndex1] < 10 )
  399. Fitness[PlyrIndex1] = 10;
  400. if ( Fitness[PlyrIndex2] < 10 )
  401. Fitness[PlyrIndex2] = 10;
  402. // printf(" A dpts %d\n", performance[p].dpts );
  403. // printf(" B dpts %d\n", performance[p+20].dpts );
  404. }
  405. printf ("\n\n");
  406. DoInjuriesAndMatchBans( EUROgameType, EUROteamA );
  407. DoInjuriesAndMatchBans( EUROgameType, EUROteamB );
  408. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  409. //º º
  410. //º RESET FRONTEND VARIABLES WHICH MAY HAVE BEEN ALTERED DURING MATCH º
  411. //º º
  412. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  413. EUROcamera = EUROmatch_info.camera;
  414. EUROvidi = EUROmatch_info.vidi;
  415. EUROscrSize = setup.screen_size;
  416. EUROsky = setup.detail.sky;
  417. EUROlineDetail = setup.detail.lines;
  418. EUROvidiType = setup.vidi_type;
  419. EUROplyrDetail = setup.detail.players;
  420. EUROptchDetail = setup.detail.pitch;
  421. EUROresoln = setup.start_res;
  422. EUROscrSize = setup.screen_size;
  423. if (EUROverbose)
  424. printf("\n ALLOCATING MEMORY AFTER RUNNING MATCH AND RETURNING TO FRONTEND.\n\n");
  425. AllocateDisplayBuffers(); // Allocates two 640x480 display buffers.
  426. TexturePageMemHandle = // Set up memory handle.
  427. AllocateTexturePageMemory( 8, // Specify number of texture pages to allocate.
  428. &FrontendTextureDEFN ); // Allocate memory for frontend texture pages.
  429. LoadTexturePage( BIN_PAGE1, // Load texture page 1 into texture memory.
  430. &EuroDATfile[0],
  431. 0, &FrontendTextureDEFN );
  432. Set_640x480_VideoMode();
  433. RunMatch = No;
  434. if ( EUROgameType == EURO_championship )
  435. {
  436. //ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»
  437. //º º
  438. //º GROUP MATCH º
  439. //º º
  440. //ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ
  441. if ( MatchNumber < 24 )
  442. {
  443. LeagueTable[EUROteamA].goalsFor = EUROmatch_info.Team_A_goals;
  444. LeagueTable[EUROteamA].goalsAgainst = EUROmatch_info.Team_B_goals;
  445. LeagueTable[EUROteamB].goalsFor = EUROmatch_info.Team_B_goals;
  446. LeagueTable[EUROteamB].goalsAgainst = EUROmatch_info.Team_A_goals;
  447. if ( EUROmatch_info.Team_A_goals > EUROmatch_info.Team_B_goals )
  448. {
  449. LeagueTable[EUROteamA].won++;
  450. LeagueTable[EUROteamB].lost++;
  451. }
  452. else
  453. if ( EUROmatch_info.Team_A_goals < EUROmatch_info.Team_B_goals )
  454. {
  455. LeagueTable[EUROteamA].lost++;
  456. LeagueTable[EUROteamB].won++;
  457. }
  458. else
  459. if ( EUROmatch_info.Team_A_goals == EUROmatch_info.Team_B_goals )
  460. {
  461. LeagueTable[EUROteamA].drew++;
  462. LeagueTable[EUROteamB].drew++;
  463. }
  464. }
  465. MatchNumber++;
  466. //-----------------------------------------------------------------------
  467. // Were to go after a match has been played....
  468. //======================================
  469. if ( MatchNumber<25 ) // N.B. this is 29 so final tables
  470. // are displayed before qualifiers.
  471. //======================================
  472. ChangeMenu = GROUP_FIXTURES;
  473. else
  474. if ( MatchNumber<29 )
  475. ChangeMenu = QUARTER_FINALS;
  476. else
  477. if ( MatchNumber<31 )
  478. ChangeMenu = SEMI_FINALS;
  479. else
  480. ChangeMenu = MAIN;
  481. //-----------------------------------------------------------------------
  482. }
  483. else
  484. if ( EUROgameType == EURO_wireplay )
  485. ChangeMenu = EXIT_FRONTEND;
  486. else
  487. ChangeMenu = MAIN;
  488. }
  489. //********************************************************************************************************************************
  490. void DisplayExtMatchTeams()
  491. {
  492. DisplayString(
  493. 132-(PixelLengthOfString(GetTEAMname( EUROteamA, 11 ), LARGE_FONT)/2),
  494. 414,
  495. GetTEAMname( EUROteamA, 11 ),
  496. LARGE_FONT,
  497. 43,
  498. EURO_TEAMa_BOX,
  499. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  500. DisplayString(
  501. 340-(PixelLengthOfString(GetTEAMname( EUROteamB, 11 ), LARGE_FONT)/2),
  502. 414,
  503. GetTEAMname( EUROteamB, 11 ),
  504. LARGE_FONT,
  505. 50,
  506. EURO_TEAMb_BOX,
  507. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  508. memcpy( &PaletteBuffer[44*3], &SparePaletteBuffer[ (LeagueColourOffsets[EUROteamA]*3)+3 ], 7*3 );
  509. memcpy( &PaletteBuffer[51*3], &SparePaletteBuffer[ (LeagueColourOffsets[EUROteamB]*3)+3 ], 7*3 );
  510. }
  511. //********************************************************************************************************************************
  512. void DisplayNextMatchUsers( char gametype )
  513. {
  514. if ( gametype == EURO_championship )
  515. {
  516. char UserText[128];
  517. strcpy(UserText, GetTEXT ( MUSR_LBLS+ComputerUser) );
  518. char Uflag = 0;
  519. for (char u=0; u<EUROnoOfMatchPlyrs; u++)
  520. {
  521. if ( UserList[u].team == EUROteamA )
  522. {
  523. if ( Uflag == 0 )
  524. strcpy(UserText, GetTEXT ( MUSR_LBLS+u) );
  525. else
  526. {
  527. strcat(UserText, " & ");
  528. strcat(UserText, GetTEXT ( MUSR_LBLS+u) );
  529. }
  530. Uflag++;
  531. }
  532. }
  533. DisplayString( 125-(PixelLengthOfString( UserText, SMALL_FONT) /2 ), 460,
  534. UserText,
  535. SMALL_FONT, 36, NO_BOX,
  536. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  537. strcpy(UserText, GetTEXT ( MUSR_LBLS+ComputerUser) );
  538. Uflag = 0;
  539. for (u=0; u<EUROnoOfMatchPlyrs; u++)
  540. {
  541. if ( UserList[u].team == EUROteamB )
  542. {
  543. if ( Uflag == 0 )
  544. strcpy(UserText, GetTEXT ( MUSR_LBLS+u) );
  545. else
  546. {
  547. strcat(UserText, " & ");
  548. strcat(UserText, GetTEXT ( MUSR_LBLS+u) );
  549. }
  550. Uflag++;
  551. }
  552. }
  553. DisplayString( 347-(PixelLengthOfString( UserText, SMALL_FONT) /2 ), 460,
  554. UserText,
  555. SMALL_FONT, 36, NO_BOX,
  556. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  557. }
  558. }
  559. //********************************************************************************************************************************
  560. void DisplayNextMatchType( char gametype )
  561. {
  562. if ( EUROgameType == EURO_championship )
  563. {
  564. char VenueText[32];
  565. if ( MatchNumber < 24 )
  566. DisplayString( 12, 98,
  567. GetTEXT ( GRUP_LBLS+( ( Fixtures[MatchNumber].HomeTeam & 12 )>>2 )),
  568. LARGE_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  569. else
  570. if ( MatchNumber < 28 )
  571. DisplayString( 12, 98,
  572. GetTEXT ( MTCH_TYPE+QuarterFinal ),
  573. LARGE_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  574. else
  575. if ( MatchNumber < 30 )
  576. DisplayString( 12, 98,
  577. GetTEXT ( MTCH_TYPE+SemiFinal ),
  578. LARGE_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  579. else
  580. DisplayString( 12, 98,
  581. GetTEXT ( MTCH_TYPE+Final ),
  582. LARGE_FONT, 36, NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  583. strcpy(VenueText, ToUPPER(GetTEXT( VNUE_NMES+MatchVenues[MatchNumber] )) );
  584. // venue of match
  585. DisplayString(
  586. 430-(PixelLengthOfString( VenueText, MEDIUM_FONT )),
  587. 98, VenueText, MEDIUM_FONT, 36, NO_BOX,
  588. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  589. // date of match
  590. DisplayString(
  591. 430-(PixelLengthOfString( GetTEXT( DATE_LBLS+MatchNumber ), SMALL_FONT)),
  592. 120, GetTEXT( DATE_LBLS+MatchNumber ), SMALL_FONT, 36, NO_BOX,
  593. &FrontendPseudoDEFN, &FrontendTextureDEFN );
  594. }
  595. }
  596. //********************************************************************************************************************************
  597. void NextMatchSelectButtons( char GAMEtype )
  598. {
  599. if ( GAMEtype == EURO_championship )
  600. {
  601. StartMatchHandle = AddAnimation( 446, 300,
  602. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  603. 0.0, START_MATCH_BOX, CONT_ANIM );
  604. StartMatchHighlight = ControlOptionHighlight( -1, START_MATCH_BOX,
  605. START_MATCHdisp_BOX, -1,
  606. StartMatchHandle, BUTN_LBLS+StartMatch );
  607. TeamSetupHandle = AddAnimation( 446, 228,
  608. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  609. 0.0, FORMATION_SETUP_BOX, CONT_ANIM );
  610. TeamSetupHighlight = ControlOptionHighlight( -1, FORMATION_SETUP_BOX,
  611. FORMATION_SETUPdisp_BOX, -1,
  612. TeamSetupHandle, BUTN_LBLS+TeamSetup );
  613. if ( ( EUROmatchUsers = FindNumberOfMatchUsers() ) > 0 )
  614. {
  615. PlayerSetupHandle = AddAnimation( 446, 180,
  616. ( (float)BUTN_WHBL ), ( (float)BUTN_WHBL+11.9 ),
  617. 0.0, PLAYER_SETUP_BOX, CONT_ANIM );
  618. PlyrSetupHighlight = ControlOptionHighlight( -1, PLAYER_SETUP_BOX,
  619. PLAYER_SETUPdisp_BOX, -1,
  620. PlayerSetupHandle, BUTN_LBLS+PlayerSetup );
  621. }
  622. }
  623. }
  624. //********************************************************************************************************************************
  625. void DoNextMatchSelection( char MENU, signed char BOX )
  626. {
  627. if ( MENU == NEXT_MATCH && LogicState == RUN_FRONTEND )
  628. {
  629. if ( EUROgameType == EURO_championship )
  630. {
  631. //-------- console routine -------------------------------------------------------------------------------------------------------
  632. if ( EUROconsole != 0 && keys[1]==1 && KeyToggle[1]==0 )
  633. {
  634. EUROmatch_info.EscKey^= 1;
  635. char console[50];
  636. strcpy( &console[0], "Match Esc Key: ");
  637. strcat(console, GetTEXT( SETG_TEXT+(EUROmatch_info.EscKey & 1)) );
  638. CopyFromBACKtoPSEUDObuffer(
  639. &FrontendPseudoDEFN, &FrontendBackgroundDEFN,
  640. 0, 0, 128, 24 );
  641. DisplayString( 0, 0,
  642. console, SMALL_FONT, 36,
  643. NO_BOX, &FrontendPseudoDEFN, &FrontendTextureDEFN );
  644. AddToDumpList( 0, 0, 128, 24 );
  645. }
  646. KeyToggle[1] = keys[1];
  647. //--------------------------------------------------------------------------------------------------------------------------------
  648. if ( BOX == START_MATCH_BOX && ButtonState != 0 )
  649. {
  650. Animation_table[StartMatchHandle].AnimationSpeed =
  651. WhichButton( ButtonState, 0.85);
  652. RunMatch = Yes;
  653. ChangeMenu = MAIN;
  654. DeBounce = TRUE;
  655. }
  656. if ( BOX == FORMATION_SETUP_BOX && ButtonState != 0 )
  657. {
  658. Team = ConfigureTeamView();
  659. Animation_table[TeamSetupHandle].AnimationSpeed =
  660. WhichButton( ButtonState, 0.85);
  661. ChangeMenu = SQUAD_SELECT;
  662. DeBounce = TRUE;
  663. }
  664. if ( EUROmatchUsers>0 && EUROgameType == EURO_championship )
  665. {
  666. PlyrSetupHighlight = ControlOptionHighlight( BOX, PLAYER_SETUP_BOX,
  667. PLAYER_SETUPdisp_BOX, PlyrSetupHighlight,
  668. PlayerSetupHandle, BUTN_LBLS+PlayerSetup );
  669. if ( BOX == PLAYER_SETUP_BOX && ButtonState != 0 )
  670. {
  671. signed char u = EUROnoOfMatchPlyrs;
  672. EUROplyrSetup = 0;
  673. while ( u>-1 )
  674. {
  675. if ( UserList[u].team == EUROteamA || UserList[u].team == EUROteamB )
  676. EUROplyrSetup = u;
  677. u--;
  678. }
  679. Animation_table[PlayerSetupHandle].AnimationSpeed =
  680. WhichButton( ButtonState, 0.85);
  681. ChangeMenu = PLAYER_SETUP;
  682. DeBounce = TRUE;
  683. }
  684. }
  685. StartMatchHighlight = ControlOptionHighlight( BOX, START_MATCH_BOX,
  686. START_MATCHdisp_BOX, StartMatchHighlight,
  687. StartMatchHandle, BUTN_LBLS+StartMatch );
  688. TeamSetupHighlight = ControlOptionHighlight( BOX, FORMATION_SETUP_BOX,
  689. FORMATION_SETUPdisp_BOX, TeamSetupHighlight,
  690. TeamSetupHandle, BUTN_LBLS+TeamSetup );
  691. }
  692. }
  693. }