3D_UPD2.CPP 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301
  1. // 3D pitch test 30/9/94
  2. extern "C" int icth,isth;
  3. #include <conio.h>
  4. #include <i86.h>
  5. #include <stdlib.h>
  6. #include <bios.h>
  7. #include <stdio.h>
  8. #include <math.h>
  9. #include <string.h>
  10. #include "defines.h"
  11. #include "externs.h"
  12. #include "mouse.h"
  13. #include "3deng.h"
  14. #include "data.h"
  15. #include "front.h"
  16. #include "eurofrnt\euro_int.h"
  17. #include "audio.h"
  18. int norm_font_col=157;
  19. extern team_info game_data[];
  20. extern setup_info setup;
  21. extern "C" volatile int ux1,ux2,wptr,rptr;
  22. extern int vidi_anim;
  23. extern word scrmode;
  24. extern int draw_string(buff_info *buff,int font_no,int x,int y,char *string,unsigned char col,short just);
  25. extern "C" short wConsoleNode;
  26. extern float log_factor;
  27. int counter=0;
  28. struct joy_struct {
  29. unsigned short x1;
  30. unsigned short y1;
  31. unsigned short x2;
  32. unsigned short y2;
  33. unsigned short sw;
  34. };
  35. extern joy_struct joy_pos;
  36. float wayne_cam[2];
  37. float set_camera_dist=260;
  38. float set_camera_height=100;
  39. char camera_fixed=0;
  40. extern void init_off_int(match_player *player);
  41. ////////////////////////////////////////////////////////////
  42. ////////////////////////////////////////////////////////////
  43. extern void get_face_xy(int d,float &x,float &y);
  44. ////////////////////////////////////////////////////////////
  45. //// SCREEN PRIMITIVES
  46. //
  47. void
  48. grmode(int md)
  49. {
  50. union REGS r;
  51. r.h.al=md;
  52. r.h.ah=0;
  53. int386(0x10,&r,&r);
  54. }
  55. void
  56. vbl()
  57. {
  58. while(((inp(0x3da))&8)!=0);
  59. while(((inp(0x3da))&8)==0);
  60. }
  61. ////////////////////////////////////////////////////////////
  62. ////////////////////////////////////////////////////////////
  63. extern stad_info stadlist[];
  64. float st_hm=360;
  65. plyrdat *poswr,pos[ncb];
  66. plyrdat *rep;
  67. filter filters[32];
  68. float spr_coord_tab[MAX_3D_SPRS*3+1];
  69. short spr_ref_tab[MAX_3D_SPRS];
  70. float null_tab[1]={0};
  71. short null2[1]={0};
  72. plyrdat coords_tab1[ncb];
  73. plyrdat coords_tab2[ncb];
  74. plyrdat *replay_tab;
  75. plyrdat *new_coords=coords_tab1;
  76. plyrdat *old_coords=coords_tab2;
  77. datapt tx,ty,tz,camera_x,camera_y,camera_z;
  78. int play_cam=1;
  79. datapt old_tx=pitch_len/2;
  80. datapt old_ty=pitch_wid/2;
  81. datapt old_tz=0;
  82. datapt old_camx=0;
  83. datapt old_camy=0;
  84. datapt old_camz=0;
  85. datapt cxs=0;
  86. datapt cys=0;
  87. datapt czs=0;
  88. datapt txs=0;
  89. datapt tys=0;
  90. datapt tzs=0;
  91. datapt prev_camx=0;
  92. datapt prev_camy=0;
  93. datapt prev_camz=0;
  94. float old_scale=INIT_SCALE;
  95. float css=0;
  96. float scale=INIT_SCALE;
  97. char prev_camera;
  98. short mode_change=0;
  99. const float camera_inertia=0.05;
  100. const float target_inertia=0.125;
  101. extern setup_info setup;
  102. extern match_data match_info;
  103. extern buff_info main_buff;
  104. extern buff_info vidi_buff;
  105. extern void options(buff_info *buffer,datapt viewx,datapt viewy,datapt viewz,datapt targx,datapt targy,
  106. datapt targz,datapt vdist,plyrdat *plyrtb,datapt *xyz_ptr,word *ref_ptr,int,int);
  107. extern void substitution(buff_info *buffer,datapt viewx,datapt viewy,datapt viewz,datapt targx,datapt targy,
  108. datapt targz,datapt vdist,plyrdat *plyrtb,datapt *xyz_ptr,word *ref_ptr,int);
  109. extern void switch_coords();
  110. ////////////////////////////////////////////////////////////////
  111. ////////////////////////////////////////////////////////////////
  112. int init_3d()
  113. {
  114. // grmode(19);
  115. // grmode(0x61);
  116. prev_camera=camera;
  117. mode_change=0;
  118. camera_dist=280;
  119. // Make sure vectors are corrected...
  120. new_update_coords(); // Initialize old tab...
  121. new_update_coords(); // Initialize old tab...
  122. return(init3d());
  123. }
  124. ////////////////////////////////////////////////////////////////
  125. ////////////////////////////////////////////////////////////////
  126. ////////////////////////////////////////////
  127. // FUNCTIONS CALLED FROM IN-GAME MENUS... //
  128. ////////////////////////////////////////////
  129. /******************************************************************************
  130. *****************************************************************************/
  131. void setup_replay()
  132. {
  133. rep_camera=camera;
  134. if (camera==15)
  135. camera=old_cam;
  136. }
  137. /******************************************************************************
  138. *****************************************************************************/
  139. void reset_replay()
  140. {
  141. camera=rep_camera;
  142. }
  143. /******************************************************************************
  144. *****************************************************************************/
  145. void sub_player(short t,short p,short s)
  146. {
  147. p+=11*(t^(match_half&1));
  148. player_being_subbed=p+1;
  149. player_on_off=p+1;
  150. player_coming_on=s+1;
  151. init_off_int(&teams[p]);
  152. if (p>10)
  153. PlaySubstitutionMessage(team_b,p-11,s,FALSE);
  154. else
  155. PlaySubstitutionMessage(team_a,p,s,FALSE);
  156. }
  157. /******************************************************************************
  158. *****************************************************************************/
  159. void do_replay_render3d(float s)
  160. {
  161. s+=(float)replay_pos/REAL_SPEED;
  162. if (s>=replay_seconds)
  163. s-=replay_seconds;
  164. int is1=(int)(s*REAL_SPEED);
  165. plyrdat *rep1=&replay_tab[is1*ncb]; // Replay Frame...
  166. int is2=(int)(s*REAL_SPEED)+1;
  167. if (is2>=replay_seconds*REAL_SPEED)
  168. is2-=replay_seconds*REAL_SPEED;
  169. plyrdat *rep2=&replay_tab[is2*ncb]; // Replay Frame...
  170. memcpy(old_coords,rep1,sizeof(plyrdat)*ncb);
  171. memcpy(new_coords,rep2,sizeof(plyrdat)*ncb);
  172. mf_scale=s*REAL_SPEED-is1;
  173. realtime_coords();
  174. replay_cnt=TRUE;
  175. update_3d();
  176. replay_cnt=FALSE;
  177. }
  178. /******************************************************************************
  179. *****************************************************************************/
  180. void process_replay()
  181. {
  182. if (++replay_pos>=replay_seconds*REAL_SPEED)
  183. replay_pos=0;
  184. }
  185. /******************************************************************************
  186. *****************************************************************************/
  187. void plr_comments()
  188. {
  189. plyrdat *ptr=pos;
  190. for (int i=0; i<players; i++)
  191. {
  192. if (teams[i].guy_on)
  193. {
  194. if (teams[i].tm_comm>0)
  195. {
  196. init_speech(i+1,teams[i].tm_comm,4);
  197. }
  198. }
  199. }
  200. }
  201. /******************************************************************************
  202. *****************************************************************************/
  203. void process_pitch_sprs()
  204. {
  205. plr_comments();
  206. }
  207. /******************************************************************************
  208. *****************************************************************************/
  209. void init_replay()
  210. {
  211. // Fill all replay buffer with current coords etc...
  212. allow_replay=TRUE;
  213. plyrdat *dest=replay_tab;
  214. plyrdat *src=pos;
  215. short reps,n;
  216. for (reps=0; reps<replay_seconds*20; reps++)
  217. {
  218. for (short i=0; i<ncb; i++)
  219. {
  220. memcpy(dest++,src++,sizeof(plyrdat));
  221. }
  222. src-=ncb;
  223. }
  224. }
  225. /******************************************************************************
  226. *****************************************************************************/
  227. void draw_string_center(int x,int y,char *st,buff_info *buff)
  228. {
  229. if (scrmode==0x13)
  230. // Low res...
  231. draw_string(buff,1,x,y,st,norm_font_col,2);
  232. else
  233. // Higher res...
  234. draw_string(buff,2,x,y,st,norm_font_col,2);
  235. }
  236. /******************************************************************************
  237. *****************************************************************************/
  238. void draw_string_left(int x,int y,char *st,buff_info *buff)
  239. {
  240. if (scrmode==0x13)
  241. // Low res...
  242. draw_string(buff,1,x,y,st,norm_font_col,0);
  243. else
  244. // Higher res...
  245. draw_string(buff,2,x,y,st,norm_font_col,0);
  246. }
  247. /******************************************************************************
  248. *****************************************************************************/
  249. void draw_string_right(int x,int y,char *st,buff_info *buff)
  250. {
  251. if (scrmode==0x13)
  252. // Low res...
  253. draw_string(buff,1,x,y,st,norm_font_col,1);
  254. else
  255. // Higher res...
  256. draw_string(buff,2,x,y,st,norm_font_col,1);
  257. }
  258. /******************************************************************************
  259. *****************************************************************************/
  260. void set_normal_color(int c)
  261. {
  262. norm_font_col=c;
  263. }
  264. /******************************************************************************
  265. *****************************************************************************/
  266. void extra_info()
  267. {
  268. char info_str_a[16];
  269. char info_str_b[16];
  270. for (short p=0; p<11; p++)
  271. {
  272. switch(xinfo)
  273. {
  274. case(1):
  275. sprintf(info_str_a,"SPD. %d. %d",(p+1),teams[p].tm_rate);
  276. sprintf(info_str_b,"SPD. %d. %d",(p+11),teams[p+11].tm_rate);
  277. break;
  278. case(2):
  279. sprintf(info_str_a,"POW. %d. %d",(p+1),teams[p].tm_pow);
  280. sprintf(info_str_b,"POW. %d. %d",(p+11),teams[p+11].tm_pow);
  281. break;
  282. case(3):
  283. sprintf(info_str_a,"CON. %d. %d",(p+1),teams[p].tm_cont);
  284. sprintf(info_str_b,"CON. %d. %d",(p+11),teams[p+11].tm_cont);
  285. break;
  286. case(4):
  287. sprintf(info_str_a,"FLR. %d. %d",(p+1),teams[p].tm_flair);
  288. sprintf(info_str_b,"FLR. %d. %d",(p+11),teams[p+11].tm_flair);
  289. break;
  290. case(5):
  291. sprintf(info_str_a,"VIS. %d. %d",(p+1),teams[p].tm_vis);
  292. sprintf(info_str_b,"VIS. %d. %d",(p+11),teams[p+11].tm_vis);
  293. break;
  294. case(6):
  295. sprintf(info_str_a,"ACC. %d. %d",(p+1),teams[p].tm_ac);
  296. sprintf(info_str_b,"ACC. %d. %d",(p+11),teams[p+11].tm_ac);
  297. break;
  298. case(7):
  299. sprintf(info_str_a,"STM. %d. %d",(p+1),teams[p].tm_stam);
  300. sprintf(info_str_b,"STM. %d. %d",(p+11),teams[p+11].tm_stam);
  301. break;
  302. case(8):
  303. sprintf(info_str_a,"DIS. %d. %d",(p+1),teams[p].tm_disc);
  304. sprintf(info_str_b,"DIS. %d. %d",(p+11),teams[p+11].tm_disc);
  305. break;
  306. case(9):
  307. sprintf(info_str_a,"PER. %d. %d",(p+1),performance[p]);
  308. sprintf(info_str_b,"PER. %d. %d",(p+11),performance[p+11]);
  309. break;
  310. }
  311. draw_string_left(64,32+(p*10),info_str_a,&main_buff);
  312. draw_string_left(192,32+(p*10),info_str_b,&main_buff);
  313. }
  314. }
  315. /******************************************************************************
  316. *****************************************************************************/
  317. extern "C" short state_checksum;
  318. extern int logic_cnt;
  319. void info_line()
  320. {
  321. set_normal_color(WHITE);
  322. char info_str1[14];
  323. char info_str2[14];
  324. char info_str3[14];
  325. char info_str4[10];
  326. char info_str5[10];
  327. if (setp_taker)
  328. {
  329. sprintf(info_str3,"%d ",teams[setp_taker-1].tm_ac);
  330. draw_string_center(50,60,info_str3,&main_buff);
  331. sprintf(info_str3,"%d ",teams[setp_taker-1].tm_flair);
  332. draw_string_center(50,80,info_str3,&main_buff);
  333. }
  334. sprintf(info_str3,"1. %d ",users[0].plr);
  335. draw_string_center(150,60,info_str3,&main_buff);
  336. sprintf(info_str3,"2. %d ",users[1].plr);
  337. draw_string_center(150,80,info_str3,&main_buff);
  338. sprintf(info_str3,"3. %d ",users[2].plr);
  339. draw_string_center(50,100,info_str3,&main_buff);
  340. sprintf(info_str3,"4. %d ",users[3].plr);
  341. draw_string_center(50,120,info_str3,&main_buff);
  342. sprintf(info_str3,"%d ",deb_is);
  343. draw_string_center(150,100,info_str3,&main_buff);
  344. /*
  345. sprintf(info_str3,"%d ",users[1].control);
  346. draw_string_center(150,120,info_str3,&main_buff);
  347. sprintf(info_str3,"%d ",wConsoleNode);
  348. draw_string_center(100,140,info_str3,&main_buff);
  349. sprintf(info_str3,"%d ",deb_a);
  350. draw_string_center(100,160,info_str3,&main_buff);
  351. sprintf(info_str3,"%1.3f ",mf_scale);
  352. draw_string_center(100,180,info_str3,&main_buff);
  353. */
  354. sprintf(info_str3,"%d ",good_poss);
  355. sprintf(info_str2,"%d : %d ",frms_per_sec,game_speed);
  356. // sprintf(info_str2,"%d : %1.2f ",frms_per_sec,poss_held);
  357. #ifdef CROWD
  358. switch(crowd_mood_a)
  359. {
  360. case(1):
  361. sprintf(info_str4,"NORMAL ");
  362. break;
  363. case(2):
  364. sprintf(info_str4,"PENSIVE ");
  365. break;
  366. case(3):
  367. sprintf(info_str4,"ENCOURAGE");
  368. break;
  369. case(4):
  370. sprintf(info_str4,"EXCITED ");
  371. break;
  372. case(5):
  373. sprintf(info_str4,"CELEBRATE");
  374. break;
  375. case(6):
  376. sprintf(info_str4,"BOO... ");
  377. break;
  378. case(7):
  379. sprintf(info_str4,"SAVE ");
  380. break;
  381. case(8):
  382. sprintf(info_str4,"MISS ");
  383. break;
  384. case(9):
  385. sprintf(info_str4,"LAUGH ");
  386. break;
  387. }
  388. switch(crowd_mood_b)
  389. {
  390. case(1):
  391. sprintf(info_str5,"NORMAL ");
  392. break;
  393. case(2):
  394. sprintf(info_str5,"PENSIVE ");
  395. break;
  396. case(3):
  397. sprintf(info_str5,"ENCOURAGE");
  398. break;
  399. case(4):
  400. sprintf(info_str5,"EXCITED ");
  401. break;
  402. case(5):
  403. sprintf(info_str5,"CELEBRATE");
  404. break;
  405. case(6):
  406. sprintf(info_str5,"BOO... ");
  407. break;
  408. case(7):
  409. sprintf(info_str5,"SAVE ");
  410. break;
  411. case(8):
  412. sprintf(info_str5,"MISS ");
  413. break;
  414. case(9):
  415. sprintf(info_str5,"LAUGH ");
  416. break;
  417. }
  418. #endif
  419. if (replay_cnt)
  420. sprintf(info_str1,"REPLAY");
  421. else
  422. {
  423. if (match_mode)
  424. {
  425. switch(match_mode)
  426. {
  427. case(CORNER_TL):
  428. case(CORNER_TR):
  429. case(CORNER_BL):
  430. case(CORNER_BR):
  431. sprintf(info_str1,"CORNER");
  432. break;
  433. case(CENTRE_A):
  434. case(CENTRE_B):
  435. sprintf(info_str1,"CENTRE");
  436. break;
  437. case(GOAL_KICK_TL):
  438. case(GOAL_KICK_TR):
  439. case(GOAL_KICK_BL):
  440. case(GOAL_KICK_BR):
  441. sprintf(info_str1,"GOAL KICK");
  442. break;
  443. case(THROW_IN_A):
  444. case(THROW_IN_B):
  445. sprintf(info_str1,"THROW IN");
  446. break;
  447. case(IF_KICK_A):
  448. case(IF_KICK_B):
  449. if (offside_now)
  450. sprintf(info_str1,"OFFSIDE FK");
  451. else
  452. sprintf(info_str1,"INDIRECT FK");
  453. break;
  454. case(DF_KICK_A):
  455. case(DF_KICK_B):
  456. sprintf(info_str1,"DIRECT FK");
  457. break;
  458. default:
  459. sprintf(info_str1,"STOPPED");
  460. };
  461. // Event...
  462. draw_string_center(50,4,info_str1,&main_buff);
  463. }
  464. }
  465. draw_string_center(270,4,info_str3,&main_buff);
  466. draw_string_center(160,4,":",&main_buff);
  467. draw_string_center(270,4,info_str3,&main_buff);
  468. // Score...
  469. sprintf(info_str1,"%d - %d",team_a_goals,team_b_goals);
  470. draw_string_center(160,185,info_str1,&main_buff);
  471. // Seconds...
  472. sprintf(info_str1,"%2.2d",(unsigned short)match_time.sec);
  473. draw_string_center(164,4,info_str1,&main_buff);
  474. // Minutes...
  475. sprintf(info_str1,"%3d",match_time.min);
  476. draw_string_center(126,4,info_str1,&main_buff);
  477. }
  478. /******************************************************************************
  479. *****************************************************************************/
  480. // Switch off camera damping...
  481. void damping_off()
  482. {
  483. old_camx=camera_x;
  484. old_camy=camera_y;
  485. old_camz=camera_z;
  486. }
  487. /******************************************************************************
  488. *****************************************************************************/
  489. void add_message(char *t,short c,char force)
  490. {
  491. if (force)
  492. {
  493. // Instant display over-riding current message...
  494. message_buffer[current_mess].ptr=t;
  495. message_buffer[current_mess].col=c;
  496. new_text=MESSAGE_TIME;
  497. if (!message_cnt)
  498. message_cnt++;
  499. }
  500. else
  501. {
  502. if (message_cnt<MAX_MESSAGES)
  503. {
  504. // Can provide message service...
  505. short m=message_cnt+current_mess;
  506. if (m>=MAX_MESSAGES)
  507. m-=MAX_MESSAGES;
  508. short lm=m-1;
  509. if (lm<0)
  510. lm=MAX_MESSAGES-1;
  511. if (!message_cnt || strcmp(t,message_buffer[lm].ptr))
  512. {
  513. // New message...
  514. message_buffer[m].ptr=t;
  515. message_buffer[m].col=c;
  516. if (!message_cnt++)
  517. new_text=MESSAGE_TIME;
  518. }
  519. }
  520. }
  521. }
  522. /******************************************************************************
  523. *****************************************************************************/
  524. void display_messages()
  525. {
  526. if (new_text)
  527. {
  528. set_normal_color(message_buffer[current_mess].col);
  529. draw_string_center(main_buff.clip_wid>>1,main_buff.clip_hgt/16,
  530. message_buffer[current_mess].ptr,&main_buff);
  531. }
  532. }
  533. /******************************************************************************
  534. *****************************************************************************/
  535. void change_cam(short c)
  536. {
  537. set_camera_dist=260;
  538. set_camera_height=100;
  539. camera=c;
  540. char *t;
  541. if (!camera)
  542. t="FAR";
  543. if (camera==1)
  544. t="PLAN";
  545. if (camera==2)
  546. t="G.LINE";
  547. if (camera==3)
  548. t="MANUAL";
  549. if (camera==4)
  550. t="PLAYER";
  551. if (camera==5)
  552. t="USER";
  553. if (camera==6)
  554. t="FOLLOW";
  555. if (camera==7)
  556. t="REF.";
  557. if (camera==8)
  558. t="WIRE";
  559. if (camera==14)
  560. t="ISO.";
  561. if ((camera<14 && camera>8) || (camera>14))
  562. t=" ";
  563. add_message(t,YELLOW,TRUE);
  564. }
  565. ////////////////////////////////////////////////////////////////
  566. ////////////////////////////////////////////////////////////////
  567. void update_3d()
  568. {
  569. float targ_x,targ_y,targ_z;
  570. char use_fixed;
  571. scale=INIT_SCALE;
  572. char cam_limit=TRUE;
  573. char cam_buffer=TRUE;
  574. plyrdat *ptr=pos; // Tweened object x,y,z and orientations...
  575. float x,y;
  576. if (!line_up)
  577. {
  578. // Not in pre-match line-up (can use all available camera options)...
  579. if (!replay_cnt)
  580. {
  581. // No celebration view during replay...
  582. if ((just_scored && just_scored<(SCORE_WAIT-30)) && (camera!=15))
  583. {
  584. // Camera is forced to follow scorer!
  585. old_cam=camera;
  586. #ifdef WAYNE
  587. camera=20;
  588. if (keys[0x11]) // w
  589. {
  590. wayne_cam[0]=set_camera_dist;
  591. wayne_cam[1]=set_camera_height;
  592. FILE *fp1=fopen("wayne","wb");
  593. fwrite(wayne_cam,sizeof(float),2,fp1);
  594. fclose(fp1);
  595. do_penalty_anim(0);
  596. do_penalty_menu(0);
  597. }
  598. if (keys[0x2c]) // z
  599. {
  600. FILE *fp1=fopen("wayne","rb");
  601. fread(wayne_cam,sizeof(float),2,fp1);
  602. fclose(fp1);
  603. set_camera_dist=wayne_cam[0];
  604. set_camera_height=wayne_cam[1];
  605. }
  606. #else
  607. camera=15; // Follow scorer.
  608. #endif
  609. }
  610. else
  611. {
  612. if (!just_scored && camera==15)
  613. camera=old_cam;
  614. }
  615. }
  616. if (!EUROmatch_info.timeit)
  617. {
  618. #ifdef SUPPORT_LP
  619. if (users_dir[lp_user-1].f&32 || users_dir[lp_user-1].f&16)
  620. {
  621. if ((keys[0x4b] || (users_dir[lp_user-1].f&4
  622. && users_dir[lp_user-1].f&32)) && (set_camera_dist>10)) // keypad 4
  623. set_camera_dist-=4;
  624. if ((keys[0x4d] || (users_dir[lp_user-1].f&8
  625. && users_dir[lp_user-1].f&32)) && (set_camera_dist<600)) // keypad 6
  626. set_camera_dist+=4;
  627. if ((keys[0x48] || (users_dir[lp_user-1].f&8
  628. && users_dir[lp_user-1].f&16)) && (set_camera_height<600)) // keypad 8
  629. set_camera_height+=4;
  630. if ((keys[0x50] || (users_dir[lp_user-1].f&4
  631. && users_dir[lp_user-1].f&16)) && (set_camera_height>10)) // keypad 2
  632. set_camera_height-=4;
  633. }
  634. #endif
  635. if ((keys[0x4b]) && (set_camera_dist>10)) // keypad 4
  636. set_camera_dist-=4;
  637. if ((keys[0x4d]) && (set_camera_dist<600)) // keypad 6
  638. set_camera_dist+=4;
  639. if ((keys[0x48]) && (set_camera_height<600)) // keypad 8
  640. set_camera_height+=4;
  641. if ((keys[0x50]) && (set_camera_height>10)) // keypad 2
  642. set_camera_height-=4;
  643. if (keys[0x4c]) // keypad 5
  644. {
  645. set_camera_dist=260;
  646. set_camera_height=100;
  647. }
  648. if (replay_cnt || (!just_scored && match_mode!=SWAP_ENDS))
  649. {
  650. // Don't allow user to change camera during celebration!
  651. if (keys[0x02]) // 1 // Autocam
  652. change_cam(0); // camera=0
  653. if (keys[0x03]) // 2 // Plan
  654. change_cam(1); // camera=1
  655. if (keys[0x04]) // 3 // 1/2 Plan
  656. change_cam(2); // camera=2
  657. if (keys[0x05]) // 4
  658. change_cam(3); // camera=3
  659. if (keys[0x06]) // 5 // Player
  660. change_cam(4); // camera=4
  661. if (keys[0x07]) // 6 // Wire
  662. change_cam(8); // camera=8
  663. if (keys[0x08]) // 7 // Referee
  664. change_cam(7); // camera=7
  665. if (keys[0x09]) // 8 // Isometric
  666. change_cam(14); // camera=14
  667. }
  668. if (debug)
  669. {
  670. // don't use these views for normal game.
  671. if (keys[0x0a]) // 9
  672. change_cam(5); // camera=5
  673. if (keys[0x0b]) // 0
  674. change_cam(6); // camera=6
  675. }
  676. if (camera==4)
  677. {
  678. if ((keys[0x48]) && (play_cam<players)) //keypad 8
  679. play_cam+=1;
  680. if ((keys[0x50]) && (play_cam>1)) //keypad 2
  681. play_cam-=1;
  682. }
  683. // If in network game and a fixed player has been chosen,
  684. // then all camera views should treat the fixed player (not the ball)
  685. // as the target...
  686. if (network_on && fixed_net_user)
  687. {
  688. // Fixed player target...
  689. targ_x=teams[users[fixed_net_user-1].plr-1].tm_x;
  690. targ_y=teams[users[fixed_net_user-1].plr-1].tm_y;
  691. targ_z=teams[users[fixed_net_user-1].plr-1].tm_z;
  692. use_fixed=TRUE;
  693. }
  694. else
  695. {
  696. if (use_ball_limit)
  697. {
  698. targ_x=ballx_out;
  699. targ_y=bally_out;
  700. targ_z=ballz_out;
  701. }
  702. else
  703. {
  704. targ_x=eff_ballx;
  705. targ_y=eff_bally;
  706. targ_z=eff_ballz;
  707. }
  708. use_fixed=FALSE;
  709. }
  710. }
  711. /***************************************/
  712. // FACE CELEBRATION
  713. /***************************************/
  714. if (camera==15)
  715. {
  716. cam_buffer=TRUE;
  717. tx=teams[goal_scorer-1].tm_x;
  718. ty=teams[goal_scorer-1].tm_y;
  719. tz=24;
  720. camera_x=tx+teams[goal_scorer-1].tm_xdis*set_camera_dist/1.5;
  721. camera_y=ty+teams[goal_scorer-1].tm_ydis*set_camera_dist/1.5;
  722. camera_z=set_camera_height/1.5;
  723. }
  724. /***************************************/
  725. // TUNNEL VEIW
  726. /***************************************/
  727. if (camera==16)
  728. {
  729. cam_buffer=TRUE;
  730. tx=stadlist[setup.stadium].tunlx;
  731. ty=-stadlist[setup.stadium].tunlz;
  732. tz=stadlist[setup.stadium].tunly;
  733. camera_x=cntspot_x;
  734. camera_y=cntspot_y;
  735. camera_z=40;
  736. }
  737. /***************************************/
  738. // PLAYER ON/OFF VEIW
  739. /***************************************/
  740. if (camera==17)
  741. {
  742. short p=player_on_off;
  743. if (player_on_off<0)
  744. p=-p;
  745. p-=1;
  746. cam_buffer=TRUE;
  747. if (-stadlist[setup.stadium].tunlz>cntspot_y)
  748. camera_y=teams[p].tm_y-(40+(teams[p].tm_y/2));
  749. else
  750. camera_y=teams[p].tm_y+(40+((pitch_wid-teams[p].tm_y)/2));
  751. camera_x=teams[p].tm_x;
  752. camera_z=80;
  753. tx=teams[p].tm_x;
  754. ty=teams[p].tm_y;
  755. tz=10;
  756. }
  757. /***************************************/
  758. // MAN OF THE MATCH VEIW
  759. /***************************************/
  760. if (camera==18)
  761. {
  762. cam_buffer=TRUE;
  763. tx=teams[man_of_match-1].tm_x;
  764. ty=teams[man_of_match-1].tm_y;
  765. tz=20;
  766. camera_x=tx+(teams[man_of_match-1].tm_xdis*set_camera_dist);
  767. camera_y=ty+(teams[man_of_match-1].tm_ydis*set_camera_dist);
  768. camera_z=set_camera_height/2;
  769. }
  770. /***************************************/
  771. // GOAL-SCORER
  772. /***************************************/
  773. if (camera==20)
  774. {
  775. cam_buffer=TRUE;
  776. cam_limit=FALSE;
  777. float x,y,z,d;
  778. if (last_goal==1)
  779. {
  780. // B vidi...
  781. x=stadlist[setup.stadium].vid2x;
  782. y=-stadlist[setup.stadium].vid2z;
  783. z=stadlist[setup.stadium].vid2y;
  784. }
  785. else
  786. {
  787. // A vidi...
  788. x=stadlist[setup.stadium].vid1x;
  789. y=-stadlist[setup.stadium].vid1z;
  790. z=stadlist[setup.stadium].vid1y;
  791. }
  792. tx=x+(teams[goal_scorer-1].tm_x-x)*just_scored/(SCORE_WAIT-30);
  793. ty=y+(teams[goal_scorer-1].tm_y-y)*just_scored/(SCORE_WAIT-30);
  794. tz=z+(teams[goal_scorer-1].tm_z-z)*just_scored/(SCORE_WAIT-30);
  795. x-=teams[goal_scorer-1].tm_x;
  796. y-=teams[goal_scorer-1].tm_y;
  797. z-=teams[goal_scorer-1].tm_z;
  798. d=calc_dist(x,y);
  799. x=(x*set_camera_dist*0.5/d);
  800. y=(y*set_camera_dist*0.5/d);
  801. z=15;
  802. camera_x=teams[goal_scorer-1].tm_x-x;
  803. camera_y=teams[goal_scorer-1].tm_y-y;
  804. camera_z=z;
  805. }
  806. /***************************************/
  807. // AUTO-CAMERA
  808. /***************************************/
  809. if (camera==0)
  810. {
  811. datapt over=((targ_x>cntspot_x) ? (targ_x-cntspot_x)/2:(cntspot_x-targ_x)/2);
  812. datapt target_x=(int)(targ_x);
  813. datapt target_y=(int)(pitch_wid/2)+((targ_y-cntspot_y)/2)-(targ_z/4)+60;
  814. datapt target_z=0; //(int)targ_z;
  815. tx=target_x;
  816. ty=target_y;
  817. tz=target_z;
  818. camera_x=(pitch_len/2)+((tx-pitch_len/2)/2);
  819. camera_y=(pitch_wid+60)+((targ_y-cntspot_y)/1.5)-(over);
  820. camera_z=180-(targ_y/12)+(over/3);
  821. }
  822. /***************************************/
  823. // PLAN ( Kick-off view )
  824. /***************************************/
  825. if (camera==1)
  826. {
  827. static float dx=0;
  828. static float dy=0;
  829. float x,y,dcx,dcy,move_rate;
  830. cam_buffer=FALSE; // Switch camera buffering off!
  831. cam_limit=FALSE; // Switch camera limit off!
  832. if (game_speed)
  833. move_rate=(0.2*MF*REAL_SPEED)/game_speed;
  834. else
  835. move_rate=0.2;
  836. if (ball_still || use_fixed)
  837. {
  838. x=targ_x;
  839. y=targ_y;
  840. }
  841. else
  842. {
  843. dx+=((ballxdis*10)-dx)*0.8;
  844. dy+=((ballydis*10)-dy)*0.8;
  845. x=(eff_ballx+dx);
  846. y=(eff_bally+dy);
  847. }
  848. dcx=x-old_tx;
  849. dcy=y-old_ty;
  850. cxs+=(dcx*camera_inertia-cxs)*move_rate;
  851. cys+=(dcy*camera_inertia-cys)*move_rate;
  852. x=old_tx+cxs;
  853. y=old_ty+cys;
  854. int xhf=(set_camera_height/2.45)-prat*3;
  855. int yhf=(set_camera_height/1.6)-prat*2;
  856. if (x<xhf)
  857. x=xhf;
  858. if (x>pitch_len-xhf)
  859. x=pitch_len-xhf;
  860. if (y<yhf)
  861. y=yhf;
  862. if (y>pitch_wid-yhf)
  863. y=pitch_wid-yhf;
  864. tx=x;
  865. ty=y;
  866. tz=0;
  867. camera_x=x-1;
  868. camera_y=y;
  869. camera_z=prat*6+set_camera_height;
  870. }
  871. /***************************************/
  872. // 1/2 PLAN ( Sensi style view )
  873. /***************************************/
  874. if (camera==2)
  875. {
  876. static float dx=0;
  877. static float dy=0;
  878. float x,y,dcx,dcy,move_rate;
  879. cam_buffer=FALSE; // Switch camera buffering off!
  880. cam_limit=FALSE; // Switch camera limit off!
  881. if (game_speed)
  882. move_rate=(0.2*MF*REAL_SPEED)/game_speed;
  883. else
  884. move_rate=0.2;
  885. if (ball_still || use_fixed)
  886. {
  887. x=targ_x;
  888. y=targ_y;
  889. }
  890. else
  891. {
  892. dx+=((ballxdis*10)-dx)*0.4;
  893. dy+=((ballydis*10)-dy)*0.4;
  894. x=(eff_ballx+dx);
  895. y=(eff_bally+dy);
  896. }
  897. dcx=x-old_tx;
  898. dcy=y-old_ty;
  899. cxs+=(dcx*camera_inertia-cxs)*move_rate;
  900. cys+=(dcy*camera_inertia-cys)*move_rate;
  901. x=old_tx+cxs;
  902. y=old_ty+cys;
  903. int xhf=((set_camera_height+8)/2.45)-prat*3;
  904. int yhf=(calc_dist(set_camera_dist+(targ_x/6),(set_camera_height+8)/2)/1.6)-prat*3;
  905. if (x<xhf)
  906. x=xhf;
  907. if (x>pitch_len-xhf)
  908. x=pitch_len-xhf;
  909. if (y<yhf)
  910. y=yhf;
  911. if (y>pitch_wid-yhf)
  912. y=pitch_wid-yhf;
  913. tx=x;
  914. ty=y;
  915. tz=0;
  916. camera_x=x-set_camera_dist-(targ_x/6);
  917. camera_y=y;
  918. camera_z=(set_camera_height+8);
  919. }
  920. /***************************************/
  921. // MANUAL
  922. /***************************************/
  923. if (camera==3)
  924. {
  925. ReportMouse();
  926. camera_x=Mouse.x*2.125-40;
  927. camera_y=Mouse.y*4.4-40;
  928. camera_z=set_camera_height;
  929. tx=targ_x;
  930. ty=targ_y;
  931. tz=targ_z;
  932. }
  933. /***************************************/
  934. // PLAYER
  935. /***************************************/
  936. if (camera==4)
  937. {
  938. cam_buffer=2;
  939. camera_x=(ptr+(play_cam-1))->x;
  940. camera_z=(ptr+(play_cam-1))->y+PLAYER_HEIGHT-3;
  941. camera_y=(ptr+(play_cam-1))->z;
  942. x=-(ptr+(play_cam-1))->crot;
  943. y=((ptr+(play_cam-1))->srot);
  944. tx=camera_x+x*100;
  945. ty=camera_y+y*100;
  946. tz=PLAYER_HEIGHT-3;
  947. }
  948. /***************************************/
  949. // USER
  950. /***************************************/
  951. if (camera==5)
  952. {
  953. camera_x=(ptr+(ball_poss-1))->x;
  954. camera_z=(ptr+(ball_poss-1))->y+PLAYER_HEIGHT;
  955. camera_y=(ptr+(ball_poss-1))->z+2;
  956. x=-(ptr+(ball_poss-1))->crot;
  957. y=((ptr+(ball_poss-1))->srot);
  958. tx=camera_x+x*100;
  959. ty=camera_y+y*100;
  960. tz=PLAYER_HEIGHT;
  961. damping_off();
  962. }
  963. /***************************************/
  964. // FOLLOW BALL
  965. /***************************************/
  966. if (camera==6)
  967. {
  968. float xd,yd;
  969. if (ball_poss)
  970. {
  971. xd=teams[ball_poss-1].tm_xdis;
  972. yd=teams[ball_poss-1].tm_ydis;
  973. }
  974. else
  975. {
  976. xd=ballxdis;
  977. yd=ballydis;
  978. }
  979. if ((ABS(xd)<.1) && (ABS(yd)<.1))
  980. {
  981. tx=old_tx;
  982. ty=old_ty;
  983. tz=old_tz;
  984. camera_x=old_camx;
  985. camera_y=old_camy;
  986. camera_z=targ_z+40;
  987. }
  988. else
  989. {
  990. float d=calc_dist(xd,yd);
  991. camera_x=targ_x-(120*xd/d);
  992. camera_y=targ_y-(120*yd/d);
  993. camera_z=targ_z+40;
  994. tx=targ_x;
  995. ty=targ_y;
  996. tz=targ_z;
  997. }
  998. }
  999. /***************************************/
  1000. // REFEREE
  1001. /***************************************/
  1002. if (camera==7)
  1003. {
  1004. cam_buffer=2;
  1005. camera_x=(ptr+(players))->x;
  1006. camera_z=(ptr+(players))->y+PLAYER_HEIGHT-3;
  1007. camera_y=(ptr+(players))->z;
  1008. x=-(ptr+(players))->crot;
  1009. y=(ptr+(players))->srot;
  1010. tx=camera_x+x*100;
  1011. ty=camera_y+y*100;
  1012. tz=PLAYER_HEIGHT-3;
  1013. damping_off();
  1014. }
  1015. /***************************************/
  1016. // WIRE
  1017. /***************************************/
  1018. if (camera==8)
  1019. {
  1020. float bxd,byd,d,ox,oy,nx,ny;
  1021. if ((!match_mode) || (match_mode==CENTRE_A) || (match_mode==CENTRE_B)
  1022. || (match_mode>=IF_KICK_A && match_mode<=PEN_KICK_B))
  1023. {
  1024. // Normal Play...
  1025. camera_dist=set_camera_dist;
  1026. if (targ_x>cntspot_x)
  1027. // Right goal...
  1028. {
  1029. bxd=pitch_len-targ_x;
  1030. byd=cntspot_y-targ_y;
  1031. }
  1032. else
  1033. {
  1034. // Left goal...
  1035. bxd=-targ_x;
  1036. byd=cntspot_y-targ_y;
  1037. }
  1038. d=calc_dist(bxd,byd);
  1039. bxd=bxd/d;
  1040. byd=byd/d;
  1041. ox=0;
  1042. oy=-1;
  1043. // get difference (cos a).
  1044. float dif=acos((bxd*ox)+(byd*oy));
  1045. if (targ_x>cntspot_x)
  1046. dif=(((targ_x-cntspot_x)/cntspot_x)*(dif));
  1047. else
  1048. dif=-(((cntspot_x-targ_x)/cntspot_x)*(dif));
  1049. // The closer to the goal-line, the more in line with ball to goal!
  1050. nx=(ox*cos(dif))-(oy*sin(dif));
  1051. ny=(oy*cos(dif))+(ox*sin(dif));
  1052. tx=targ_x+(nx*(set_camera_dist+20)/3);
  1053. ty=targ_y+(ny*(set_camera_dist+20)/3);
  1054. tx=targ_x;
  1055. ty=targ_y;
  1056. tz=targ_z/2;
  1057. camera_x=targ_x-(nx*(set_camera_dist+20));
  1058. camera_y=targ_y-(ny*((set_camera_dist+20)
  1059. -((set_camera_dist+20)*(targ_y/(pitch_wid*2)))));
  1060. camera_z=(set_camera_height+20)-(((set_camera_height+20)*.8)*(ABS((targ_y-cntspot_y)/cntspot_y)));
  1061. if (targ_y<cntspot_y)
  1062. camera_y=camera_y+((cntspot_y-targ_y)/20);
  1063. // Now bring target in according to height...
  1064. bxd=camera_x-tx;
  1065. byd=camera_y-ty;
  1066. d=calc_dist(bxd,byd);
  1067. bxd=tx+(bxd*camera_z/(d*5));
  1068. byd=ty+(byd*camera_z/(d*5));
  1069. tx=bxd;
  1070. ty=byd;
  1071. }
  1072. else
  1073. {
  1074. switch(match_mode)
  1075. {
  1076. case(GOAL_KICK_TL):
  1077. case(GOAL_KICK_BL):
  1078. camera=9;
  1079. break;
  1080. case(GOAL_KICK_TR):
  1081. case(GOAL_KICK_BR):
  1082. camera=10;
  1083. break;
  1084. case(CORNER_TL):
  1085. case(CORNER_BL):
  1086. camera=11;
  1087. break;
  1088. case(CORNER_TR):
  1089. case(CORNER_BR):
  1090. camera=12;
  1091. break;
  1092. case(THROW_IN_A):
  1093. case(THROW_IN_B):
  1094. camera=13;
  1095. break;
  1096. }
  1097. }
  1098. }
  1099. /***************************************/
  1100. /***************************************/
  1101. if (camera==9)
  1102. // Goal kick from left...
  1103. {
  1104. camera_y=cntspot_y;
  1105. camera_x=eff_ballx-set_camera_dist;
  1106. camera_z=eff_ballz/2+set_camera_height;
  1107. tx=eff_ballx+((cntspot_x-eff_ballx)/10);
  1108. ty=eff_bally;
  1109. tz=eff_ballz;
  1110. if (match_mode!=GOAL_KICK_TL && match_mode!=GOAL_KICK_BL)
  1111. camera=8;
  1112. }
  1113. /***************************************/
  1114. /***************************************/
  1115. if (camera==10)
  1116. // Goal kick from right...
  1117. {
  1118. camera_y=cntspot_y;
  1119. camera_x=eff_ballx+set_camera_dist;
  1120. camera_z=eff_ballz/2+set_camera_height;
  1121. tx=eff_ballx-((eff_ballx-cntspot_x)/10);
  1122. ty=eff_bally;
  1123. tz=eff_ballz;
  1124. if (match_mode!=GOAL_KICK_TR && match_mode!=GOAL_KICK_BR)
  1125. camera=8;
  1126. }
  1127. /***************************************/
  1128. /***************************************/
  1129. if (camera==11)
  1130. // Corner kick at left goal...
  1131. {
  1132. float bxd,byd,d;
  1133. tx=prat*12;
  1134. ty=cntspot_y;
  1135. tz=0;
  1136. bxd=eff_ballx-tx;
  1137. byd=eff_bally-ty;
  1138. d=calc_dist(bxd,byd);
  1139. camera_x=eff_ballx+(bxd*set_camera_dist/d);
  1140. camera_y=eff_bally+(byd*set_camera_dist/d);
  1141. camera_z=set_camera_height/4;
  1142. if ((!match_mode) && (last_touch!=corner_taker))
  1143. camera=8;
  1144. }
  1145. /***************************************/
  1146. /***************************************/
  1147. if (camera==12)
  1148. // Corner kick at right goal...
  1149. {
  1150. float bxd,byd,d;
  1151. tx=pitch_len-(prat*12);
  1152. ty=cntspot_y;
  1153. tz=0;
  1154. bxd=eff_ballx-tx;
  1155. byd=eff_bally-ty;
  1156. d=calc_dist(bxd,byd);
  1157. camera_x=eff_ballx+(bxd*set_camera_dist/d)/2;
  1158. camera_y=eff_bally+(byd*set_camera_dist/d)/2;
  1159. camera_z=set_camera_height/4;
  1160. if ((!match_mode) && (last_touch!=corner_taker))
  1161. camera=8;
  1162. }
  1163. /***************************************/
  1164. /***************************************/
  1165. if (camera==13)
  1166. // Throw in...
  1167. {
  1168. tx=eff_ballx;
  1169. ty=eff_bally;
  1170. tz=eff_ballz;
  1171. camera_x=eff_ballx;
  1172. camera_y=eff_bally;
  1173. if (bally>cntspot_y)
  1174. camera_y+=set_camera_dist/2;
  1175. else
  1176. camera_y-=set_camera_dist/2;
  1177. camera_z=eff_ballz+set_camera_height/4;
  1178. if ((!match_mode) && (last_touch!=throw_in_taker))
  1179. camera=8;
  1180. }
  1181. /***************************************/
  1182. // ISOMETRIC
  1183. /***************************************/
  1184. if (camera==14)
  1185. {
  1186. tx=targ_x;
  1187. ty=targ_y+((cntspot_y-targ_y)/4);
  1188. tz=targ_z;
  1189. camera_x=tx-20-set_camera_dist*1.4;
  1190. camera_y=ty+20+set_camera_dist*1.4;
  1191. camera_z=targ_z/3+(set_camera_height*2);
  1192. scale=512*2;
  1193. cam_limit=TRUE;
  1194. }
  1195. }
  1196. else
  1197. {
  1198. // Pre-match Line-up!!!
  1199. if (first_update)
  1200. {
  1201. cam_buffer=FALSE;
  1202. first_update=FALSE;
  1203. }
  1204. else
  1205. cam_buffer=TRUE;
  1206. if (line_up>=40)
  1207. {
  1208. // Move camera...
  1209. cam_limit=FALSE;
  1210. float rad=((LINE_UP_DELAY+40-line_up)*(LINE_UP_DELAY+40-line_up))/90;
  1211. float ang=(float)(line_up-40)/LINE_UP_DELAY*PI;
  1212. tx=ballx;
  1213. ty=bally;
  1214. tz=ball_diam/2;
  1215. camera_x=tx-(3*rad*sin(ang));
  1216. camera_y=ty+(3*rad*cos(ang))-30;
  1217. camera_z=20+rad;
  1218. /*
  1219. y=(float)(line_up-40)/LINE_UP_DELAY;
  1220. camera_z=prat*2+(y*y*y*y*(prat*60));
  1221. camera_x=cntspot_x;
  1222. camera_y=cntspot_y+80+(y*y*(prat*80));
  1223. tx=cntspot_x;
  1224. ty=cntspot_y+(y*y*(prat*30));
  1225. tz=0;
  1226. */
  1227. }
  1228. }
  1229. /***************************************/
  1230. /***************************************/
  1231. #define PULL_BACK_FACTOR 1.
  1232. if (prev_camera!=camera)
  1233. mode_change=CAM_MODE_BUFFER;
  1234. prev_camera=camera;
  1235. float cur_camx,cur_camy,cur_camz,cur_tx,cur_ty,cur_tz;
  1236. float dif_camx,dif_camy,dif_camz,dif_tx,dif_ty,dif_tz,dif_scale;
  1237. static float move_rate=0.4;
  1238. if (!line_up && camera==8 && camera==6)
  1239. {
  1240. float d=calc_dist(tx-camera_x,ty-camera_y);
  1241. d=calc_dist(tz-camera_z,d);
  1242. x=(camera_x-tx)/d;
  1243. y=(camera_y-ty)/d;
  1244. float z=(camera_z-tz)/d;
  1245. float cam_dist=calc_dist(set_camera_dist,set_camera_height);
  1246. float r=(d/cam_dist)*PULL_BACK_FACTOR;
  1247. camera_x=tx+(r*d*x);
  1248. camera_y=ty+(r*d*y);
  1249. camera_z=tz+(r*d*z);
  1250. }
  1251. // Stadium Perimeter as defined by 3d engine...
  1252. int st_l=stadlist[setup.stadium].st_l;
  1253. int st_w=stadlist[setup.stadium].st_w;
  1254. int st_h=stadlist[setup.stadium].st_h;
  1255. if (cam_limit)
  1256. {
  1257. // Camera cannot go far off pitch...
  1258. if (camera_x<-st_l/2)
  1259. camera_x=-st_l/2;
  1260. if (camera_x>pitch_len+(st_l/2))
  1261. camera_x=pitch_len+(st_l/2);
  1262. if (camera_y<-st_w/2)
  1263. camera_y=-st_w/2;
  1264. if (camera_y>pitch_wid+(st_w/2))
  1265. camera_y=pitch_wid+(st_w/2);
  1266. if (camera_z>st_hm)
  1267. camera_z=st_hm;
  1268. }
  1269. if (cam_buffer)
  1270. {
  1271. // Tween scale...
  1272. dif_scale=scale-old_scale;
  1273. // Camera buffering...
  1274. dif_camx=camera_x-old_camx;
  1275. dif_camy=camera_y-old_camy;
  1276. dif_camz=camera_z-old_camz;
  1277. dif_tx=tx-old_tx;
  1278. dif_ty=ty-old_ty;
  1279. dif_tz=tz-old_tz;
  1280. if (!replay_cnt)
  1281. {
  1282. // Time Camera movement...
  1283. if (count>old_count+(TIMER_SPEED/2))
  1284. // Half a second interval...
  1285. {
  1286. old_count+=(TIMER_SPEED/2);
  1287. if (!updates)
  1288. updates=1;
  1289. if (camera==3)
  1290. move_rate=1./updates; // Mouse control disregards game speed!
  1291. else
  1292. move_rate=1./updates*game_speed/REAL_SPEED;
  1293. updates=0;
  1294. }
  1295. }
  1296. else
  1297. {
  1298. // No need to time...
  1299. move_rate=0.2;
  1300. }
  1301. if (dif_camx>MAX_CAM_DIF)
  1302. dif_camx=MAX_CAM_DIF;
  1303. if (dif_camy>MAX_CAM_DIF)
  1304. dif_camy=MAX_CAM_DIF;
  1305. if (dif_camz>MAX_CAM_DIF)
  1306. dif_camz=MAX_CAM_DIF;
  1307. if (dif_camx<-MAX_CAM_DIF)
  1308. dif_camx=-MAX_CAM_DIF;
  1309. if (dif_camy<-MAX_CAM_DIF)
  1310. dif_camy=-MAX_CAM_DIF;
  1311. if (dif_camz<-MAX_CAM_DIF)
  1312. dif_camz=-MAX_CAM_DIF;
  1313. if (dif_tx>MAX_CAM_DIF)
  1314. dif_tx=MAX_CAM_DIF;
  1315. if (dif_ty>MAX_CAM_DIF)
  1316. dif_ty=MAX_CAM_DIF;
  1317. if (dif_tz>MAX_CAM_DIF)
  1318. dif_tz=MAX_CAM_DIF;
  1319. if (dif_tx<-MAX_CAM_DIF)
  1320. dif_tx=-MAX_CAM_DIF;
  1321. if (dif_ty<-MAX_CAM_DIF)
  1322. dif_ty=-MAX_CAM_DIF;
  1323. if (dif_tz<-MAX_CAM_DIF)
  1324. dif_tz=-MAX_CAM_DIF;
  1325. cur_camx=old_camx+(dif_camx*move_rate);
  1326. cur_camy=old_camy+(dif_camy*move_rate);
  1327. cur_camz=old_camz+(dif_camz*move_rate);
  1328. cur_tx=old_tx+(dif_tx*move_rate*1.5);
  1329. cur_ty=old_ty+(dif_ty*move_rate*1.5);
  1330. cur_tz=old_tz+(dif_tz*move_rate*1.5);
  1331. }
  1332. else
  1333. {
  1334. cur_camx=camera_x;
  1335. cur_camy=camera_y;
  1336. cur_camz=camera_z;
  1337. cur_tx=tx;
  1338. cur_ty=ty;
  1339. cur_tz=tz;
  1340. }
  1341. #ifndef DEMO
  1342. if (opt_user && !replay_cnt)
  1343. {
  1344. plyrdat *buff=new_coords;
  1345. // In Game options menu(Formation,Subs,Replay)
  1346. old_rep_pos=replay_pos;
  1347. replay_pos++; // In case of replay point to first frame...
  1348. if (opt_user==100)
  1349. {
  1350. // Substitution Menu...
  1351. sub_camera=camera;
  1352. camera=17;
  1353. subbing_now=SUB_DELAY;
  1354. substitution(&main_buff,cur_camx,cur_camz,cur_camy,
  1355. cur_tx,cur_tz,cur_ty,
  1356. scale,pos,&spr_coord_tab[0],&spr_ref_tab[0],opt_team);
  1357. if (!player_being_subbed)
  1358. camera=sub_camera;
  1359. opt_user=FALSE;
  1360. }
  1361. else
  1362. {
  1363. options(&main_buff,cur_camx,cur_camz,cur_camy,
  1364. cur_tx,cur_tz,cur_ty,
  1365. scale,pos,&spr_coord_tab[0],&spr_ref_tab[0],--opt_user,opt_team);
  1366. }
  1367. // if (buff!=new_coords)
  1368. // switch_coords();
  1369. replay_pos=old_rep_pos;
  1370. old_count=count;
  1371. opt_user=0;
  1372. stop_mf_time();
  1373. }
  1374. else
  1375. #endif
  1376. {
  1377. if (key_togs[0x0a] && !vidi_anim) // 9
  1378. // Vidi screen on...
  1379. {
  1380. render3d(&vidi_buff,cntspot_x,cur_camz,pitch_wid+80,
  1381. eff_ballx,eff_ballz,eff_bally,
  1382. scale,pos,&spr_coord_tab[0],&spr_ref_tab[0]);
  1383. vidi_buff.dump(0,0);
  1384. }
  1385. // Straight to Vram...
  1386. // main_buff.buff_start=(unsigned char *)0xa0000;
  1387. // Update display buffer...
  1388. render3d(&main_buff,cur_camx,cur_camz,cur_camy,
  1389. cur_tx,cur_tz,cur_ty,
  1390. scale,pos,&spr_coord_tab[0],&spr_ref_tab[0]);
  1391. }
  1392. // Overlaid sprites...
  1393. if (debug)
  1394. {
  1395. info_line();
  1396. if (xinfo)
  1397. extra_info();
  1398. }
  1399. // New Message...
  1400. display_messages();
  1401. #ifdef EURO96
  1402. // Name of player in possession...
  1403. if (last_touch && match_mode!=THROW_IN_A && match_mode!=THROW_IN_B)
  1404. {
  1405. short c;
  1406. short p=last_touch;
  1407. char name[20];
  1408. if (p<12)
  1409. c=(match_half&1 ? 1:0);
  1410. else
  1411. c=(match_half&1 ? 0:1);
  1412. p=standard_player(p);
  1413. itoa(teams[last_touch-1].shirt,name,10);
  1414. char *n=&game_data[country(c)].players[p-1].name[game_data[country(c)].players[p-1].goal_index];
  1415. strcat(name,". ");
  1416. strcat(name,n);
  1417. if (!c)
  1418. {
  1419. set_normal_color(TEAM1COL);
  1420. draw_string_left(8,1,name,&main_buff);
  1421. }
  1422. else
  1423. {
  1424. set_normal_color(TEAM2COL);
  1425. draw_string_right(main_buff.clip_wid-8,1,name,&main_buff);
  1426. }
  1427. }
  1428. #endif
  1429. /* Goal Sprite Out...
  1430. if (just_scored>0 && !replay_cnt)
  1431. {
  1432. // OUT
  1433. shadow_sprite(160*2+6,100*2+8,0,&main_buff);
  1434. overlay_sprite(160*2,100*2,0,&main_buff);
  1435. }
  1436. */
  1437. main_buff.dump(0,0);
  1438. old_tx=cur_tx;
  1439. old_ty=cur_ty;
  1440. old_tz=cur_tz;
  1441. old_camx=cur_camx;
  1442. old_camy=cur_camy;
  1443. old_camz=cur_camz;
  1444. old_scale=scale;
  1445. }
  1446. /******************************************************************************
  1447. *****************************************************************************/
  1448. void pass_coords(plyrdat *ptr)
  1449. {
  1450. float x,y;
  1451. plyrdat *rep=&replay_tab[replay_pos*ncb]; // Replay Frame...
  1452. int col;
  1453. if (replay_cnt && replay_seconds)
  1454. {
  1455. // Replay On....
  1456. // Use Replay Table only...
  1457. memcpy(ptr,rep,sizeof(plyrdat)*ncb);
  1458. }
  1459. else
  1460. {
  1461. // Normal Game mode....
  1462. // Update Replay table also...
  1463. for (int i=0; i<players+3; i++)
  1464. {
  1465. if (i>=players)
  1466. {
  1467. // Officials
  1468. ptr->x=(datapt)(refs[i-(players)].x); //x
  1469. ptr->y=(datapt)(refs[i-(players)].z); //y
  1470. ptr->z=(datapt)(refs[i-(players)].y); //z
  1471. if (i==players)
  1472. ptr->type=3; //referee colour
  1473. else
  1474. ptr->type=4; //linesman colour
  1475. ptr->crot=refs[i-(players)].dir_x;
  1476. ptr->srot=refs[i-(players)].dir_y;
  1477. ptr->anim=refs[i-(players)].anim; //anim seq.
  1478. ptr->frame=refs[i-(players)].frm; //anim frm.
  1479. ptr->fstep=refs[i-(players)].fstep; //anim fstep.
  1480. ptr->htype=0; // htype
  1481. ptr->hcol=0; // hcol
  1482. if (speech_tab[i].cnt)
  1483. ptr->sprite=speech_tab[i].say;
  1484. else
  1485. ptr->sprite=-1;
  1486. ptr++;
  1487. }
  1488. else
  1489. {
  1490. ptr->x=(datapt)(teams[i].tm_x); //x
  1491. ptr->y=(datapt)(teams[i].tm_z); //y
  1492. ptr->z=(datapt)(teams[i].tm_y); //z
  1493. if (!teams[i].guy_on)
  1494. // Not on field...
  1495. ptr->type=FALSE;
  1496. else
  1497. {
  1498. if (teams[i].draw_me)
  1499. {
  1500. if (match_half&1)
  1501. {
  1502. if (i>=players/2)
  1503. col=1;
  1504. else
  1505. col=2;
  1506. }
  1507. else
  1508. {
  1509. if (i>=players/2)
  1510. col=2;
  1511. else
  1512. col=1;
  1513. }
  1514. }
  1515. else
  1516. col=FALSE; // Don't draw him!
  1517. ptr->type=col; //colour
  1518. }
  1519. ptr->number=teams[i].shirt;
  1520. x=(teams[i].tm_xdis); //x
  1521. y=(teams[i].tm_ydis); //y
  1522. ptr->crot=x;
  1523. ptr->srot=y;
  1524. ptr->anim=teams[i].tm_anim;
  1525. ptr->frame=teams[i].tm_frm;
  1526. ptr->fstep=teams[i].tm_fstep;
  1527. ptr->htype=(float)teams[i].tm_htype;
  1528. ptr->hcol=(float)teams[i].tm_hcol;
  1529. if (speech_tab[i].cnt)
  1530. ptr->sprite=speech_tab[i].say;
  1531. else
  1532. ptr->sprite=-1;
  1533. ptr++;
  1534. }
  1535. }
  1536. ptr->x=ballx;
  1537. ptr->y=ballz;
  1538. // ptr->y=ball_diam/2+ballz-0.5;
  1539. ptr->z=bally;
  1540. ptr->type=0; //ball type
  1541. ptr->crot=cos(ball_horz_ang-PI/2);
  1542. ptr->srot=sin(ball_horz_ang-PI/2);
  1543. ptr->anim=0;
  1544. ptr->frame=cos(ball_vert_ang);
  1545. ptr->fstep=sin(ball_vert_ang);
  1546. ptr->sprite=0;
  1547. ptr++;
  1548. // Store in replay array...
  1549. if (replay_seconds)
  1550. memcpy(rep,ptr-ncb,sizeof(plyrdat)*ncb);
  1551. }
  1552. }
  1553. /******************************************************************************
  1554. *****************************************************************************/
  1555. void switch_coords()
  1556. {
  1557. if (new_coords==coords_tab1)
  1558. {
  1559. new_coords=coords_tab2;
  1560. old_coords=coords_tab1;
  1561. }
  1562. else
  1563. {
  1564. new_coords=coords_tab1;
  1565. old_coords=coords_tab2;
  1566. }
  1567. }
  1568. /******************************************************************************
  1569. *****************************************************************************/
  1570. void new_update_coords()
  1571. {
  1572. switch_coords();
  1573. pass_coords(new_coords);
  1574. }
  1575. /******************************************************************************
  1576. *****************************************************************************/
  1577. void realtime_coords()
  1578. {
  1579. double n;
  1580. plyrdat *old=old_coords;
  1581. plyrdat *newp=new_coords;
  1582. plyrdat *ptr=pos;
  1583. float ox,oy,nx,ny,dif;
  1584. int col;
  1585. if (tweening)
  1586. {
  1587. for (int i=0; i<players+3; i++)
  1588. {
  1589. if ((teams[i].guy_on) || (i>=players))
  1590. {
  1591. nx=newp->x;
  1592. ox=old->x;
  1593. nx=ox+((nx-ox)*mf_scale);
  1594. ptr->x=nx;
  1595. nx=newp->y;
  1596. ox=old->y;
  1597. nx=ox+((nx-ox)*mf_scale);
  1598. ptr->y=nx;
  1599. nx=newp->z;
  1600. ox=old->z;
  1601. nx=ox+((nx-ox)*mf_scale);
  1602. ptr->z=nx;
  1603. ptr->type=newp->type; //col
  1604. ptr->number=newp->number; // shirt no.
  1605. ox=(old->crot);
  1606. oy=(old->srot);
  1607. nx=(newp->crot);
  1608. ny=(newp->srot);
  1609. // get difference...
  1610. dif=((nx*ox)+(ny*oy));
  1611. if (dif>1.0)
  1612. dif=1;
  1613. if (dif<-1.0)
  1614. dif=-1;
  1615. dif=acos(dif);
  1616. dif=dif*mf_scale;
  1617. // Which way to turn?
  1618. if ((nx*oy)<(ny*ox))
  1619. dif=-dif;
  1620. nx=(ox*cos(dif))+(oy*sin(dif));
  1621. ny=(oy*cos(dif))-(ox*sin(dif));
  1622. ptr->crot=-nx; //xd
  1623. ptr->srot=ny; //yd
  1624. // Animation seq...
  1625. ptr->anim=newp->anim;
  1626. // Animation frame...
  1627. if ((i>=players && refs[i-players].newanim)
  1628. || (teams[i].tm_newanim && i<players))
  1629. {
  1630. nx=modf(newp->frame,&n);
  1631. ptr->frame=nx; // Initial frame...
  1632. if (i>=players)
  1633. refs[i-players].newanim=FALSE;
  1634. else
  1635. teams[i].tm_newanim=FALSE;
  1636. old->frame=0;
  1637. }
  1638. else
  1639. {
  1640. nx=newp->frame;
  1641. ox=old->frame;
  1642. if (nx<ox)
  1643. // Prevent backwards tweening...(looks bad in slow motion!)
  1644. nx+=1;
  1645. nx=ox+((nx-ox)*mf_scale);
  1646. nx=modf(nx,&n);
  1647. ptr->frame=nx;
  1648. if (i==11)
  1649. deb_data=nx;
  1650. }
  1651. ptr->fstep=newp->fstep;
  1652. ptr->htype=newp->htype;
  1653. ptr->hcol=newp->hcol;
  1654. ptr->sprite=newp->sprite;
  1655. }
  1656. else
  1657. {
  1658. ptr->type=0; //Off!
  1659. }
  1660. ptr++;
  1661. newp++;
  1662. old++;
  1663. }
  1664. // Ball...
  1665. nx=newp->x;
  1666. ox=old->x;
  1667. nx=ox+((nx-ox)*mf_scale);
  1668. ptr->x=nx;
  1669. eff_ballx=nx;
  1670. nx=newp->y;
  1671. ox=old->y;
  1672. nx=ox+((nx-ox)*mf_scale);
  1673. ptr->y=nx;
  1674. eff_ballz=nx;
  1675. nx=newp->z;
  1676. ox=old->z;
  1677. nx=ox+((nx-ox)*mf_scale);
  1678. ptr->z=nx;
  1679. eff_bally=nx;
  1680. ptr->type=0;
  1681. ox=(old->crot);
  1682. oy=(old->srot);
  1683. nx=(newp->crot);
  1684. ny=(newp->srot);
  1685. // get difference...
  1686. dif=((nx*ox)+(ny*oy));
  1687. if (dif>1.0)
  1688. dif=1;
  1689. if (dif<-1.0)
  1690. dif=-1;
  1691. dif=acos(dif);
  1692. dif=dif*mf_scale;
  1693. // Which way to turn?
  1694. if ((nx*oy)<(ny*ox))
  1695. dif=-dif;
  1696. nx=(ox*cos(dif))+(oy*sin(dif));
  1697. ny=(oy*cos(dif))-(ox*sin(dif));
  1698. ptr->crot=nx;
  1699. ptr->srot=ny;
  1700. ptr->anim=0;
  1701. ox=(old->frame);
  1702. oy=(old->fstep);
  1703. nx=(newp->frame);
  1704. ny=(newp->fstep);
  1705. // get difference...
  1706. dif=((nx*ox)+(ny*oy));
  1707. if (dif>1.0)
  1708. dif=1;
  1709. if (dif<-1.0)
  1710. dif=-1;
  1711. dif=acos(dif);
  1712. dif=dif*mf_scale;
  1713. // Which way to turn?
  1714. if ((nx*oy)<(ny*ox))
  1715. dif=-dif;
  1716. nx=(ox*cos(dif))+(oy*sin(dif));
  1717. ny=(oy*cos(dif))-(ox*sin(dif));
  1718. ptr->frame=nx;
  1719. ptr->fstep=ny;
  1720. ptr->sprite=0;
  1721. ptr++;
  1722. newp++;
  1723. old++;
  1724. }
  1725. else
  1726. {
  1727. for (int i=0; i<players+3; i++)
  1728. {
  1729. if ((teams[i].guy_on) || (i>=players))
  1730. {
  1731. ptr->x=newp->x;
  1732. ptr->y=newp->y;
  1733. ptr->z=newp->z;
  1734. ptr->type=newp->type;
  1735. ptr->number=newp->number; // shirt no.
  1736. ptr->crot=-(newp->crot);
  1737. ptr->srot=newp->srot;
  1738. nx=newp->anim;
  1739. // nx=modf(nx,&n);
  1740. ptr->anim=nx;
  1741. nx=newp->frame;
  1742. nx=modf(nx,&n);
  1743. ptr->frame=nx;
  1744. ptr->fstep=newp->fstep;
  1745. ptr->htype=newp->htype;
  1746. ptr->hcol=newp->hcol;
  1747. ptr->sprite=newp->sprite;
  1748. }
  1749. else
  1750. {
  1751. ptr->type=0; //Off!
  1752. }
  1753. ptr++;
  1754. newp++;
  1755. }
  1756. // Ball...
  1757. ptr->x=newp->x;
  1758. ptr->y=newp->y;
  1759. ptr->z=newp->z;
  1760. ptr->crot=newp->crot;
  1761. ptr->srot=newp->srot;
  1762. ptr->frame=newp->frame;
  1763. ptr->fstep=newp->fstep;
  1764. ptr->sprite=newp->sprite;
  1765. ptr++;
  1766. newp++;
  1767. old++;
  1768. }
  1769. }
  1770. /******************************************************************************
  1771. *****************************************************************************/
  1772. void sprite3d(short x,short y,short ref)
  1773. {
  1774. unsigned char *scr=main_buff.buff_start;
  1775. scr+=(y*320/2)+x/2;
  1776. if (y<400 && y>=0 && x<640 && x>=0)
  1777. {
  1778. if (!ref)
  1779. *scr=31;
  1780. else
  1781. *scr=2;
  1782. }
  1783. /*
  1784. // OUT
  1785. switch(ref)
  1786. {
  1787. case(SAY_FOUL):
  1788. speech_bubble(x,y,"FOUL!",&main_buff);
  1789. break;
  1790. case(SAY_PASS):
  1791. speech_bubble(x,y,"To Me!",&main_buff);
  1792. break;
  1793. case(SAY_SHIT):
  1794. speech_bubble(x,y,"Oh Dear!",&main_buff);
  1795. break;
  1796. case(SAY_CROSS):
  1797. speech_bubble(x,y,"On me head!",&main_buff);
  1798. break;
  1799. case(SAY_OFFSIDE):
  1800. speech_bubble(x,y,"OFFSIDE!",&main_buff);
  1801. break;
  1802. case(SAY_ADV):
  1803. speech_bubble(x,y,"Play on...",&main_buff);
  1804. break;
  1805. case(SAY_REF):
  1806. speech_bubble(x,y,"Ref!",&main_buff);
  1807. break;
  1808. case(SAY_PENALTY):
  1809. speech_bubble(x,y,"PENALTY!",&main_buff);
  1810. break;
  1811. case(SAY_TIMEW):
  1812. speech_bubble(x,y,"Time Wasting!",&main_buff);
  1813. break;
  1814. default:
  1815. overlay_sprite(x,y,ref,&main_buff);
  1816. }
  1817. */
  1818. }