1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808 |
- /******************************************************************************
- ******************************************************************************/
- //
- // Actua Soccer. 1.9.94
- //
- // Programmed by Andy Findlay.
- //
- /******************************************************************************
- ******************************************************************************/
- #include <malloc.h>
- #include "global.h"
- #include "3deng.h"
- #include "mouse.h"
- #include "editor.h"
- #include "time.h"
- #include "front.h"
- #include "menu.h"
- #include "defines.h"
- #include "mallocx.h"
- #include "eurofrnt\euro_int.h"
- extern "C" net_var_start;
- extern "C" net_var_end;
- extern void init_foul(int fouler,char direct,char see=FALSE);
- extern void set_normal_color(int c);
- extern int draw_string(buff_info *buff,int font_no,int x,int y,char *string,unsigned char col,short just);
- extern int winrange;
- extern int Vbytesperline;
- extern void mem_test();
- extern void setpal();
- extern int VESAmode(int *);
- extern void VGAmode(unsigned char);
- extern void svgacpy(unsigned char *,short,short, short,short);
- extern setup_info setup;
- extern buff_info main_buff,vidi_buff;
- extern match_data match_info;
- extern char return_doskey;
- extern team_info game_data[];
- extern setup_info setup;
- extern match_data match_info;
- short time_table[]={5,10,20,40,90};
- extern unsigned char *readrawfile(char *filename,unsigned char *address);
- extern unsigned char pal[768];
- extern plyrdat *replay_tab;
- //#define NET_A
- #include "audio.h" // SOS header
- #ifdef ECTS
- extern void read_config_file();
- #endif
- extern "C" volatile int ux1,ux2,wptr,rptr;
- extern "C" volatile short net_error;
- extern "C" volatile char net_half;
- /******************************************************************************
- ******************************************************************************/
- #include "defines.h"
- #include "glob_var.h"
- extern void init_off_int(match_player *player);
- extern void opendebugfile();
- extern void closedebugfile();
- extern void writeplayerdata();
- extern void writecontroldata(int i);
- extern void do_ref_menu();
- extern char anykey;
- extern float set_camera_height;
- extern float set_camera_dist;
- extern void out_mcball_coords();
- /******************************************************************************
- *****************************************************************************/
- void checksum()
- {
- short *v=(short *)&var_start;
- short sum=0;
- do
- {
- sum^=*v;
- v++;
- }while(v<(short *)&var_end);
- sprintf(check_str,"%d",sum);
- add_message(check_str,WHITE,TRUE);
- }
- /******************************************************************************
- ******************************************************************************/
- extern void force_penalty();
- int pen_cnt=100;
- void make_mtable(int t1,int t2)
- {
- float d,min_d,x,y,gx;
- int p;
- for (int j=t2; j<t2+10; j++)
- {
- teams[j-1].tm_mark=FALSE;
- }
- if (t2<12)
- // Team A goals...
- gx=0;
- else
- // Team B goals...
- gx=pitch_len;
- for (int a=t1; a>t1-10; a--)
- {
- // Can't mark guy on ball...
- if ((a!=main_man) && (teams[a-1].guy_on>0))
- {
- x=teams[a-1].tm_x;
- y=teams[a-1].tm_y;
- p=0;
- if (calc_dist(gx-x,cntspot_y-y)<MUST_MARK_DIST)
- // Close enough to be a threat!!!
- {
- min_d=5000;
- for (int i=t2; i<t2+10; i++)
- {
- if ((teams[i-1].guy_on>0) && (!teams[i-1].tm_wall)
- && (!teams[i-1].tm_mark))
- {
- if (i<12)
- d=calc_dist(x-match_tactics1[ball_zone1][i-2][0],
- y-match_tactics1[ball_zone1][i-2][1]);
- else
- d=calc_dist((pitch_len-x)-match_tactics2[ball_zone2][i-13][0],
- (pitch_wid-y)-match_tactics2[ball_zone2][i-13][1]);
- if (d<min_d)
- {
- min_d=d;
- p=i;
- }
- }
- }
- }
- if (p)
- {
- d=calc_dist(gx-x,cntspot_y-y);
- // How tightly they mark depends on discipline...
- x+=(prat*(gx-x)*((192-teams[p-1].tm_disc)/64)/d);
- y+=(prat*(cntspot_y-y)*((192-teams[p-1].tm_disc)/64)/d);
- teams[p-1].tm_mark=a;
- if (p>11)
- p-=11;
- man2man[p-2][0]=(int)x;
- man2man[p-2][1]=(int)y;
- }
- }
- }
- }
- /******************************************************************************
- ******************************************************************************/
- extern "C" int deb_x;
- extern "C" int deb_y;
- void player_stamina()
- {
- short ir,p;
- if (match_time.min!=old_min)
- {
- old_min=match_time.min;
- for (short i=0; i<22; i++)
- {
- if (!match_info.GameType)
- {
- int rank;
- if ((i<11 && !(match_half&1)) || (i>10 && (match_half&1)))
- rank=game_data[setup.team_a].ranking;
- else
- rank=game_data[setup.team_b].ranking;
- ir=50+(1.4*(COUNTRIES-rank-1)); // 50 - 110
- }
- else
- {
- if ((i<11 && !(match_half&1)) || (i>10 && (match_half&1)))
- {
- // Team A...
- if (!(match_half&1))
- {
- p=i;
- }
- else
- {
- p=i-11;
- }
- ir=game_data[setup.team_a].players[p].pace+28;
- }
- else
- {
- // Team B...
- if (match_half&1)
- {
- p=i;
- }
- else
- {
- p=i-11;
- }
- ir=game_data[setup.team_b].players[p].pace+28;
- }
- }
- int st=teams[i].tm_stam;
- float f=(sin((PI*teams[i].tm_time/120)-(PI/2))+1)/2;
- float t=f*(129-st)/140*ir;
- teams[i].tm_rate=ir-t;
- /*
- if ((i==1 && !(match_half&1)) || (i==12 && (match_half&1)))
- deb_x=teams[i].tm_rate;
- else
- if (i==1 || i==12)
- deb_y=teams[i].tm_rate;
- */
- }
- }
- }
- /******************************************************************************
- ******************************************************************************/
- // Process Various control flags on each logic cycle...
- void process_flags()
- {
- #ifdef EURO96
- player_stamina();
- #endif
- // Text message counter...
- if (message_cnt)
- if (!(--new_text))
- if (--message_cnt)
- {
- new_text=MESSAGE_TIME;
- if (++current_mess==MAX_MESSAGES)
- current_mess=0;
- }
- // Used for offside rule...
- if (ball_released)
- if (ball_released>0)
- ball_released--;
- else
- ball_released++;
- if (play_advantage)
- {
- // Referee has seen an indiscretion but is waiting to see who collects ball...
- if (ball_poss)
- {
- // Some-one has collected ball!!!
- if ((ball_poss<12 && bad_guy>11) || (ball_poss>11 && bad_guy<12))
- {
- // Favoured team has it!
- play_advantage=FALSE;
- }
- else
- {
- // Fouling team has it! (no advantage gained!)
- retake_foul();
- }
- }
- }
- if (just_thrown)
- if (last_touch==throw_in_taker)
- just_thrown--;
- else
- just_thrown=FALSE;
- switch(match_mode)
- {
- case(IF_KICK_B):
- case(DF_KICK_B):
- case(CORNER_TL):
- case(CORNER_BL):
- man2man_a=TRUE;
- man2man_b=FALSE;
- break;
- case(IF_KICK_A):
- case(DF_KICK_A):
- case(CORNER_TR):
- case(CORNER_BR):
- man2man_b=TRUE;
- man2man_a=FALSE;
- break;
- default:
- man2man_a=FALSE;
- man2man_b=FALSE;
- break;
- }
- if (man2man_b)
- // Team B marking table...
- {
- make_mtable(11,13);
- }
- else
- {
- if (man2man_a)
- // Team A marking table...
- {
- make_mtable(22,2);
- }
- }
- }
- /******************************************************************************
- *****************************************************************************/
- void init_line_up()
- {
- line_up=LINE_UP_DELAY+40;
- }
- /******************************************************************************
- *****************************************************************************/
- short convert_control(char c)
- {
- switch(c)
- {
- case(0):
- return(KEY1_CTRL);
- break;
- case(1):
- return(KEY2_CTRL);
- break;
- case(2):
- return(JOY1_CTRL);
- break;
- case(3):
- return(JOY2_CTRL);
- break;
- case(4):
- return(MOUSE_CTRL);
- break;
- case(5):
- return(LOGPAD_CTRL);
- break;
- }
- return(0);
- }
- /******************************************************************************
- *****************************************************************************/
- short conv_conts_back(char c)
- {
- switch(c)
- {
- case(JOY1_CTRL):
- return(2);
- break;
- case(JOY2_CTRL):
- return(3);
- break;
- case(KEY1_CTRL):
- return(0);
- break;
- case(KEY2_CTRL):
- return(1);
- break;
- case(MOUSE_CTRL):
- return(4);
- break;
- case(LOGPAD_CTRL):
- return(5);
- break;
- }
- return(0);
- }
- /******************************************************************************
- *****************************************************************************/
- void init_rand()
- {
- // Get it from front-end...
- srand(EUROmatch_info.rand);
- }
- /******************************************************************************
- *****************************************************************************/
- void get_performance()
- {
- short p,max_p1,max_p2,min_p1,min_p2,min_p,sp,spa,spb;
- float clock=45./time_factor;
- for (short i=0; i<22; i++)
- {
- p=0;
- if (teams[i].tm_time>=15)
- {
- if (!i || i==(KP_B-1))
- {
- // Keeper performance...
- p+=PER_KPSAVES*clock*teams[i].tm_kpsaves;
- p+=PER_GOALSIN*clock*(i<11 ? team_a_goals:team_b_goals);
- }
- p+=PER_BOOKINGS*clock*teams[i].tm_book;
- p+=PER_FOULS*clock*teams[i].tm_fouls;
- p+=PER_GOALS*clock*teams[i].tm_goals;
- p+=PER_OGS*clock*teams[i].tm_ogs;
- p+=PER_POSS*clock*teams[i].tm_posst;
- p+=PER_WORK*clock*teams[i].tm_work;
- if (teams[i].tm_tacks)
- p+=PER_TACKS*teams[i].tm_twon/(teams[i].tm_tacks+10/clock);
- if (teams[i].tm_shots)
- p+=PER_SHOTS*teams[i].tm_saved/(teams[i].tm_shots+10/clock);
- if (teams[i].tm_pass)
- p+=PER_PASSES*teams[i].tm_pwon/(teams[i].tm_pass+10/clock);
- }
- else
- // Not been on field long enough...
- p=-2000;
- performance[i]=p;
- }
- max_p1=-1000;
- max_p2=-1000;
- min_p1=1000;
- min_p2=1000;
- for (i=0; i<22; i++)
- {
- p=performance[i];
- if (i>10)
- {
- if (p>max_p1)
- {
- max_p1=p;
- spa=i+1;
- }
- if (p<min_p1)
- min_p1=p;
- }
- if (i<11)
- {
- if (p>max_p2)
- {
- max_p2=p;
- spb=i+1;
- }
- if (p<min_p2)
- min_p2=p;
- }
- }
- if (max_p1>max_p2)
- {
- sp=max_p1;
- man_of_match=spa;
- }
- else
- {
- sp=max_p2;
- man_of_match=spb;
- }
- if (min_p1<min_p2)
- min_p=min_p1;
- else
- min_p=min_p2;
- sp-=min_p;
- // Performance is a percentage of star players...
-
- for (i=0; i<22; i++)
- {
- p=performance[i];
- performance[i]=100.*(p-min_p)/sp;
- }
- }
- /******************************************************************************
- *****************************************************************************/
- // Initialise zero vars...
- extern char cross_on;
- extern "C" short state_checksum;
- void initialise_vars()
- {
- int i;
- for (i=0; i<5; i++)
- {
- burst_timer[i]=0;
- }
- for (i=0; i<22; i++)
- {
- sel_circle[i]=0;
- }
- #ifdef EURO96
- state_checksum=0;
- state_ptr=&state1;
- checksum_ptr=(short *)state_ptr;
- #endif
- escape_pending=0;
- man_of_match=0;
- xinfo=0;
- message_cnt=0;
- current_mess=0;
- new_text=0;
- not_ahead=FALSE;
- kick_off=TRUE;
- forced=0;
- keep_timer=0;
- player_on_off=FALSE;
- player_being_subbed=FALSE;
- sub_pending=FALSE;
- booking=FALSE;
- stop_clock=FALSE;
- card_is_out=0;
- anykey=FALSE;
- demo_match=FALSE;
- rolling_clock=0;
- keep_dive=FALSE;
- hold_up_play=0;
- cross_on=FALSE;
- wall_is_up=FALSE;
-
- comsetp=0;
- init_rand();
- // Timing Vars...
- updates=0;
- old_count=0;
- crowd_mood_a=0;
- crowd_mood_b=0;
- possession=0;
- poss_held=0;
- for (i=0; i<11; i++)
- {
- strike[i].t=0;
- strike[i].free=0;
- strike[i].ptype=0;
- strike[i].pplr=0;
- strike[i].gt=0;
- strike[i].x=0;
- strike[i].y=0;
- strike[i].atime=0;
- strike[i].stop=0;
- }
- first_time_it=FALSE;
- auto_select=FALSE;
- seconds=0;
- arrow_on=0;
- logic_cnt=0;
- ball_move=FALSE;
- first_bounce=0;
- swerve=0;
- spin_cnt=0;
- spin_ball=0;
- prediction=FALSE;
- set_xyspin=0;
- set_zspin=0;
- ball_horz_ang=0;
- ball_vert_ang=0;
- max_sw_factor=0;
- swerve_factor=0;
- rebound_ball=0;
- headed_ball=0;
- say_names=TRUE;
- fired_a_shot=0;
- comm_pass=0;
- comm_pass_type=0;
- keeper_spd=0;
- keeper_down=FALSE;
- save_direction=FALSE;
- keeper_will_save=FALSE;
- keeper_on_grnd=FALSE;
- keeper_contact=0;
- ball_in_goal=FALSE;
- ball_in_hands=FALSE;
- game_action=FALSE;
- throw_cnt=0;
- team_a_goals=0;
- team_b_goals=0;
- last_goal=0;
- scorer_running=FALSE;
- just_scored=0;
- just_thrown=0;
- goal_scorer=0;
- pass_type=0;
- kick_type=0;
- receiver=0;
- cross_now=0;
- must_face=FALSE;
- must_face_time=0;
- must_face_x=0;
- must_face_y=0;
- must_shoot=FALSE;
- chip_pass=FALSE;
- must_pass=FALSE;
- must_punt=FALSE;
- keeper_a_in_box=0;
- keeper_b_in_box=0;
- keeper_steps=0;
- save_block=0;
- save_xoff=0;
- save_yoff=0;
- save_zoff=0;
- shot_speed=0;
- scr_x=0;
- scr_y=0;
- ball_speed=0;
- ball_int_speed=0;
- interceptor_a=0;
- interceptor_b=0;
- in_cross_area=0;
- close_in_number=0;
- shooter=0;
- ball_inair=1;
- super_shot=0;
- opponents_near_holder=0;
- opponents_really_close=0;
- int ball_poss=0;
- sender_1_2=0;
- ball_still=0;
- last_touch=0;
- want_pass=0;
- before=0;
- support_me=0;
- pre_kp_touch=0;
- prev_touch=0;
- ball_limbo_p=0;
- ball_limbo_on=FALSE;
- ball_limbo_c=0;
- ball_released=0;
- cannot_pick_up=0;
- last_user_a=0;
- last_user_b=0;
- last_plr_a=0;
- last_plr_b=0;
- players_off_a=0;
- players_off_b=0;
- want_pass_stat=0;
- ball_zone1=0;
- ball_zone2=0;
- ball_out_of_play=0;
- receiver_a=0;
- receiver_b=0;
- ready_centre=0;
- shot_attempt=0;
- force_select=0;
- heading_ball=0;
- flag=0;
- rep_camera=0;
- sub_camera=0;
- allow_replay=0;
- replay_pos=0;
- old_rep_pos=0;
- replay_cnt=0;
- pitch_sprs=0;
- fixed_net_user=0;
- memset(&auto_users_list_a,0,sizeof(auto_users_list_a));
- memset(&auto_users_list_b,0,sizeof(auto_users_list_b));
- auto_users_a=0;
- auto_users_b=0;
- play_ball_a=0;
- play_ball_b=0;
- new_select=0;
- auto_intercept=0;
- closest=0;
- f1_down=0;
- f2_down=0;
- spec_kick_type=0;
- setp_hgt=0;
- setp_power=0;
- setp_kick_x=0;
- setp_kick_y=0;
- setp_bxd=0;
- setp_byd=0;
- setp_bzd=0;
-
- user_taker=0;
- user_controlled=0;
- user_plr=0;
- after_touch_on=FALSE;
- drive_shot=0;
- wallx=0;
- wally=0;
- men_in_wall=0;
- for (i=0; i<5; i++)
- {
- wguys[i].guy=0;
- wguys[i].x=0;
- wguys[i].y=0;
- }
- keeper_pos_x=0;
- keeper_pos_y=0;
- centre_guy_1=0;
- centre_guy_2=0;
- in_range=0;
- in_header_rng=0;
- in_shot_rng=0;
- taker_x=0;
- taker_y=0;
- bad_guy=0;
- direct_fk=FALSE;
- play_advantage=0;
- set_piece_on=0;
- shot_acknowledged=FALSE;
- shot_pending=FALSE;
- real_shot=FALSE;
- shot_missed=0;
- shot_saved=0;
- for (i=0; i<10; i++)
- {
- opp_dir_tab[i][0]=0;
- opp_dir_tab[i][1]=0;
- opp_dir_tab[i][2]=0;
- }
- offside_now=0;
- memset(&tussle_tab,0,sizeof(tussle_tab));
- ball_travel=0;
- select_cnt=10;
- in_game=1;
- analogue=1;
- ballxdis=12.0, ballydis=2.0, ballzdis=10.0;
- ballx=cntspot_x, bally=cntspot_y, ballz=ball_diam/2;
- prev_ballx=0.0*16, prev_bally=30.0*16, prev_ballz=ball_diam/2;
- ns_ballx=0.0, ns_bally=0.0, ns_ballz=ball_diam/2;
- ball_zspin=0;
- ball_xyspin=0;
- full_zspin=0;
- full_xyspin=0;
- shoot_x=0;
- shoot_y=0;
- nearest_a=0,nearest_b=0,old_ltouch=-1,old_ball_poss=-1;
- use_ball_limit=0;
- near_path_a=0;
- near_path_b=0;
- zone1_x=0;
- zone2_x=0;
- zone1_y=0;
- zone2_y=0;
- incident_x=0;
- incident_y=0;
- difficulty=0;
- match_mode=0;
- dead_ball_cnt=0;
- defense_a=0;
- defense_b=0;
- poss_mode=0;
- for (i=0; i<50; i++)
- {
- ball_pred_tab[i][0]=ballx;
- ball_pred_tab[i][1]=bally;
- ball_pred_tab[i][2]=ballz;
- ns_ball_pred_tab[i][0]=ballx;
- ns_ball_pred_tab[i][1]=bally;
- ns_ball_pred_tab[i][2]=ballz;
- }
- delay_cnt=40;
- play_nums_on=0;
- frame=FALSE;
- frames=0;
- frms_per_sec=0;
- last_second=0;
- old_clock=0;
- }
- /******************************************************************************
- *****************************************************************************/
- void init_user_controls()
- {
- #ifdef FRONT_END
- num_of_users=0;
- #endif
- short home_plrs=EUROmatch_info.TeamA_users;
- short away_plrs=EUROmatch_info.TeamB_users;
- /*
- short home_plrs=game_data[setup.team_a].player_control;
- short away_plrs=game_data[setup.team_b].player_control;
- */
- short plrs=0;
- short c;
- short pnum=0;
- for (short i=1; i<16; i<<=1)
- {
- pnum++;
- if (home_plrs&i)
- {
- // User...
- plrs++;
- c=convert_control(EUROmatch_info.CntrlTypes[pnum-1]);
- add_team_user(-1,c);
- }
- if (away_plrs&i)
- {
- // User...
- plrs++;
- c=convert_control(EUROmatch_info.CntrlTypes[pnum-1]);
- add_team_user(-2,c);
- }
- }
- }
- /******************************************************************************
- *****************************************************************************/
- // Copy buffer to current VESA screen
- void svgacpy2(unsigned char *buffpt,short x,short y,short w,short h)
- {
- union REGS regs;
- short i,co;
- char *scrpt;
- int scrdisp=x+Vbytesperline*y;
- char bank=scrdisp/winrange;
- scrdisp%=winrange;
- scrpt=(char *)0xa0000+scrdisp;
- regs.x.eax=0x4f05;
- regs.x.ebx=0;
- regs.x.edx=bank;
- int386(16,®s,®s);
- do
- {
- co=MIN((winrange-scrdisp)/Vbytesperline,h);
- for (i=0;i<co;i++)
- {
- memcpy(scrpt,buffpt,640);
- scrpt+=Vbytesperline;
- buffpt+=640;
- h--;
- }
- if (h)
- {
- scrdisp=(scrdisp+(co+1)*Vbytesperline)%winrange;
- co=MIN(Vbytesperline-scrdisp,w);
- memcpy(scrpt,buffpt,co);
- bank++;
- regs.x.eax=0x4f05;
- regs.x.ebx=0;
- regs.x.edx=bank;
- int386(16,®s,®s);
- if (co!=w)
- memcpy((char *)0xa0000,buffpt+co,w-co);
- scrpt=(char *)0xa0000+scrdisp;
- buffpt+=640;
- h--;
- }
- }while (h);
- regs.x.eax=0x4f05;
- regs.x.ebx=0;
- regs.x.edx=0;
- int386(16,®s,®s);
- }
- /******************************************************************************
- *****************************************************************************/
- void display_endscr()
- {
- int vesas[]={0x101,-1};
- unsigned char *scr=(unsigned char *)mallocx(640*480);
- readrawfile("rolling.pal",(unsigned char *)pal); // Laurent's
- VESAmode(vesas);
- readrawfile("rolling.bm",scr);
- svgacpy2(scr,0,0,640,480);
- setpal();
- return_doskey=TRUE;
- getch();
- freex(scr);
- }
- /******************************************************************************
- *****************************************************************************/
- void display_screen()
- {
- int vesas[]={0x101,-1};
- int svesas[]={0x100,-1};
- unsigned char spal[768];
- memcpy(spal,pal,768);
- readrawfile("andy.pal",(unsigned char *)pal); // Laurent's
- unsigned short x,y;
- unsigned char sw;
- VESAmode(vesas);
- readrawfile("andy.bm",(unsigned char *)main_buff.buff_start);
- svgacpy2(main_buff.buff_start,0,0,640,480);
- setpal();
- count=1;
-
- do{
- read_joystick(0,&x,&y,&sw);
- if (!--count)
- {
- count=200;
- pal[768-6]--;
- pal[768-5]--;
- pal[768-4]--;
- setpal();
- }
- }while(!sw);
- #ifndef ONE_MACHINE
- VGAmode(0x13);
- #else
- VESAmode(svesas);
- #endif
- memcpy(pal,spal,768);
- setpal();
- }
- /******************************************************************************
- *****************************************************************************/
- void load_new_tactics()
- {
- FILE *fp1;
- if (tactics_a!=old_tac_a)
- {
- // Load Match tactics...
- switch(tactics_a)
- {
- case(F_4_3_3):
- fp1=fopen("tac_433.tac","rb");
- break;
-
- case(F_5_3_2):
- fp1=fopen("tac_532.tac","rb");
- break;
- case(F_6_3_1):
- fp1=fopen("tac_631.tac","rb");
- break;
- case(F_4_2_4):
- fp1=fopen("tac_424.tac","rb");
- break;
- case(F_5_1_4):
- fp1=fopen("tac_514.tac","rb");
- break;
- case(F_4_0_6):
- fp1=fopen("tac_406.tac","rb");
- break;
- case(F_3_1_6):
- fp1=fopen("tac_316.tac","rb");
- break;
- case(F_4_1_5):
- fp1=fopen("tac_415.tac","rb");
- break;
- case(F_5_2_3):
- fp1=fopen("tac_523.tac","rb");
- break;
- case(F_4_4_2):
- fp1=fopen("tac_442.tac","rb");
- break;
- }
- // Team A tactics...
- if (!(match_half&1))
- fread(match_tactics1,sizeof(int),((32*2)+6)*10*2,fp1);
- else
- fread(match_tactics2,sizeof(int),((32*2)+6)*10*2,fp1);
- fclose(fp1);
- }
- if (tactics_b!=old_tac_b)
- {
- // Load Match tactics...
- switch(tactics_b)
- {
- case(F_4_3_3):
- fp1=fopen("tac_433.tac","rb");
- break;
-
- case(F_5_3_2):
- fp1=fopen("tac_532.tac","rb");
- break;
- case(F_6_3_1):
- fp1=fopen("tac_631.tac","rb");
- break;
- case(F_4_2_4):
- fp1=fopen("tac_424.tac","rb");
- break;
- case(F_5_1_4):
- fp1=fopen("tac_514.tac","rb");
- break;
- case(F_4_0_6):
- fp1=fopen("tac_406.tac","rb");
- break;
- case(F_3_1_6):
- fp1=fopen("tac_316.tac","rb");
- break;
- case(F_4_1_5):
- fp1=fopen("tac_415.tac","rb");
- break;
- case(F_5_2_3):
- fp1=fopen("tac_523.tac","rb");
- break;
- case(F_4_4_2):
- fp1=fopen("tac_442.tac","rb");
- break;
- }
- // Team B tactics...
- if (!(match_half&1))
- fread(match_tactics2,sizeof(int),((32*2)+6)*10*2,fp1);
- else
- fread(match_tactics1,sizeof(int),((32*2)+6)*10*2,fp1);
- fclose(fp1);
- }
- old_tac_a=tactics_a;
- old_tac_b=tactics_b;
- }
- /******************************************************************************
- *****************************************************************************/
- void init_match()
- {
- sub_pending=0;
- key_togs[0x0a]=EUROmatch_info.vidi;
- // Initialise Penalty Shoot-out...
- penalties=0;
- home_pens_left=5;
- away_pens_left=5;
- penalty_game=FALSE;
- penalty_team=FALSE;
- penalty_counter=0;
- pen_taker_a=11;
- pen_taker_b=22;
- first_update=TRUE;
- reset_ball();
- opt_user=0;
- subbing_now=FALSE;
- if (setup.M8)
- replay_seconds=15;
- else
- replay_seconds=0;
- if (replay_seconds)
- {
- replay_tab=(plyrdat *)mallocx(replay_seconds*ncb*20*sizeof(plyrdat));
- if (replay_tab==NULL)
- {
- printf("Ooops... Can't malloc replay buffer!\n");
- exit(-1);
- }
- }
- auto_intercept=TRUE;
- end_game=FALSE;
- allow_replay=FALSE;
- match_time.min=0;
- match_time.sec=0;
- next_mins=0;
- just_scored=0;
- set_piece_on=0;
- team_a_goals=0;
- team_b_goals=0;
- if (!network_on)
- init_user_controls();
- need_result=(match_info.CompetitionType==2);
- clock_running=FALSE;
- team_a=0;
- team_b=1;
- match_half=0;
- last_centre=0;
- init_line_up();
- // Ects show demo (head to head)...
- #ifdef ECTS
- read_config_file();
- display_screen();
- #endif
- /*** Setup Tactics ***/
- tactics_a=EUROmatch_info.tac_1;
- tactics_b=EUROmatch_info.tac_2;
- old_tac_a=-1; // Force new tactical load!
- old_tac_b=-1;
- load_new_tactics();
- ref_accuracy=EUROmatch_info.referee_vision;
- ref_strictness=EUROmatch_info.referee_discipline;
- }
- /******************************************************************************
- ******************************************************************************/
- #define COUNTRIES 44
- void init_player_stats(short p)
- {
- p--;
- short ps;
- if ((!(match_half&1) && p<11)
- || (match_half&1 && p>10))
- {
- // Team A...
- if (!(match_half&1))
- {
- ps=p;
- }
- else
- {
- ps=p-11;
- }
- if (match_info.GameType)
- {
- // Simulation Mode!!!
- teams[p].tm_rate=game_data[setup.team_a].players[ps].pace+28;
- teams[p].tm_pow=game_data[setup.team_a].players[ps].power+28;
- teams[p].tm_cont=game_data[setup.team_a].players[ps].control+28;
- teams[p].tm_flair=game_data[setup.team_a].players[ps].flair+28;
- teams[p].tm_vis=game_data[setup.team_a].players[ps].vision+28;
- teams[p].tm_ac=game_data[setup.team_a].players[ps].accuracy+28;
- teams[p].tm_stam=game_data[setup.team_a].players[ps].stamina+28;
- teams[p].tm_disc=game_data[setup.team_a].players[ps].discipline+28;
- }
- else
- {
- // Arcade Mode!!!
- int rank=game_data[setup.team_a].ranking;
- short avg=50+(1.4*(COUNTRIES-rank-1)); // 50 - 110
- teams[p].tm_rate=30+(avg/2);
- teams[p].tm_pow=avg;
- teams[p].tm_cont=avg;
- teams[p].tm_flair=avg;
- teams[p].tm_vis=avg;
- teams[p].tm_ac=avg;
- teams[p].tm_stam=avg;
- teams[p].tm_disc=avg;
- }
- }
- else
- {
- // Team B...
- if (match_half&1)
- {
- ps=p;
- }
- else
- {
- ps=p-11;
- }
- if (match_info.GameType)
- {
- // Simulation Mode!!!
- teams[p].tm_rate=game_data[setup.team_b].players[ps].pace+28;
- teams[p].tm_pow=game_data[setup.team_b].players[ps].power+28;
- teams[p].tm_cont=game_data[setup.team_b].players[ps].control+28;
- teams[p].tm_flair=game_data[setup.team_b].players[ps].flair+28;
- teams[p].tm_vis=game_data[setup.team_b].players[ps].vision+28;
- teams[p].tm_ac=game_data[setup.team_b].players[ps].accuracy+28;
- teams[p].tm_stam=game_data[setup.team_b].players[ps].stamina+28;
- teams[p].tm_disc=game_data[setup.team_b].players[ps].discipline+28;
- }
- else
- {
- // Arcade Mode!!!
- int rank=game_data[setup.team_b].ranking;
- short avg=50+(1.4*(COUNTRIES-rank-1)); // 50 - 110
- teams[p].tm_rate=30+(avg/2);
- teams[p].tm_pow=avg;
- teams[p].tm_cont=avg;
- teams[p].tm_flair=avg;
- teams[p].tm_vis=avg;
- teams[p].tm_ac=avg;
- teams[p].tm_stam=avg;
- teams[p].tm_disc=avg;
- }
- }
- }
- /******************************************************************************
- ******************************************************************************/
- void process_subs()
- {
- if (player_being_subbed)
- {
- // Player has been selected and should come off!
- if (!teams[player_being_subbed-1].guy_on)
- {
- // He's off the park... (Bring on new guy!)
- init_player_stats(player_being_subbed);
- teams[player_being_subbed-1].shirt=player_coming_on;
- teams[player_being_subbed-1].tm_trap=FALSE;
- teams[player_being_subbed-1].int_move=FALSE;
- teams[player_being_subbed-1].int_cnt=FALSE;
- reset_ideas(&teams[player_being_subbed-1]);
- player_being_subbed=FALSE;
- teams[player_on_off-1].guy_on=TRUE;
- player_on_off=-player_on_off; // Coming on!
- init_off_int(&teams[(-player_on_off)-1]);
- }
- }
- else
- {
- if (!player_on_off && sub_pending && (match_mode>=CORNER_TL && match_mode<=DF_KICK_B)
- && !kickoff)
- {
- opt_user=100; // Substitute instead of options...
- // Some-one is trying to make a substitution...(Who?)
- if (sub_pending&1)
- opt_team=0;
- else
- opt_team=1;
- }
- }
- }
- /******************************************************************************
- ******************************************************************************/
- void save_state(save_data *save_it)
- {
- memcpy(save_it->teams,teams,sizeof(teams));
- memcpy(&save_it->match_time,&match_time,sizeof(match_time));
- memcpy(save_it->refs,refs,sizeof(refs));
- memcpy(save_it->speech_tab,speech_tab,sizeof(speech_tab));
- memcpy(save_it->wguys,wguys,sizeof(wguys));
- memcpy(save_it->sel_circle,sel_circle,sizeof(sel_circle));
- memcpy(save_it->burst_timer,burst_timer,sizeof(burst_timer));
- memcpy(save_it->auto_users_list_a,auto_users_list_a,sizeof(auto_users_list_a));
- memcpy(save_it->auto_users_list_b,auto_users_list_b,sizeof(auto_users_list_b));
- memcpy(save_it->rand1_tab,rand1_tab,sizeof(rand1_tab));
- memcpy(save_it->rand2_tab,rand2_tab,sizeof(rand2_tab));
- memcpy(save_it->man2man,man2man,sizeof(man2man));
- memcpy(save_it->glob_str1,glob_str1,sizeof(glob_str1));
- memcpy(save_it->glob_str2,glob_str2,sizeof(glob_str2));
- save_it->sub_pending=sub_pending;
- save_it->return_12=return_12;
- save_it->shamed_player=shamed_player;
- save_it->old_min=old_min;
- save_it->users_left=users_left;
- save_it->setp_x=setp_x;
- save_it->setp_y=setp_y;
- save_it->setp_wait_cnt=setp_wait_cnt;
- save_it->frame=frame;
- save_it->kick_off=kick_off;
- save_it->keep_timer=keep_timer;
- save_it->stop_clock=stop_clock;
- save_it->keep_dive=keep_dive;
- save_it->hold_up_play=hold_up_play;
- save_it->wall_is_up=wall_is_up;
- save_it->card_is_out=card_is_out;
- save_it->crowd_mood_a=crowd_mood_a;
- save_it->crowd_mood_b=crowd_mood_b;
- save_it->possession=possession;
- save_it->poss_held=poss_held;
- save_it->arrow_on=arrow_on;
- save_it->logic_cnt=logic_cnt;
- save_it->ball_move=ball_move;
- save_it->first_bounce=first_bounce;
- save_it->swerve=swerve;
- save_it->spin_cnt=spin_cnt;
- save_it->spin_ball=spin_ball;
- save_it->prediction=prediction;
- save_it->set_xyspin=set_xyspin;
- save_it->set_zspin=set_zspin;
- save_it->ball_horz_ang=ball_horz_ang;
- save_it->ball_vert_ang=ball_vert_ang;
- save_it->max_sw_factor=max_sw_factor;
- save_it->swerve_factor=swerve_factor;
- save_it->rebound_ball=rebound_ball;
- save_it->headed_ball=headed_ball;
- save_it->say_names=say_names;
- save_it->fired_a_shot=fired_a_shot;
- save_it->comm_pass=comm_pass;
- save_it->comm_pass_type=comm_pass_type;
- save_it->keeper_spd=keeper_spd;
- save_it->keeper_down=keeper_down;
- save_it->save_direction=save_direction;
- save_it->keeper_will_save=keeper_will_save;
- save_it->keeper_on_grnd=keeper_on_grnd;
- save_it->keeper_contact=keeper_contact;
- save_it->ball_in_goal=ball_in_goal;
- save_it->ball_in_hands=ball_in_hands;
- save_it->game_action=game_action;
- save_it->throw_cnt=throw_cnt;
- save_it->team_a_goals=team_a_goals;
- save_it->team_b_goals=team_b_goals;
- save_it->last_goal=last_goal;
- save_it->scorer_running=scorer_running;
- save_it->just_scored=just_scored;
- save_it->just_thrown=just_thrown;
- save_it->goal_scorer=goal_scorer;
- save_it->pass_type=pass_type;
- save_it->kick_type=kick_type;
- save_it->receiver=receiver;
- save_it->cross_now=cross_now;
- save_it->auto_select=auto_select;
- save_it->must_face=must_face;
- save_it->must_face_time=must_face_time;
- save_it->must_face_x=must_face_x;
- save_it->must_face_y=must_face_y;
- save_it->must_shoot=must_shoot;
- save_it->chip_pass=chip_pass;
- save_it->must_pass=must_pass;
- save_it->must_punt=must_punt;
- save_it->keeper_a_in_box=keeper_a_in_box;
- save_it->keeper_b_in_box=keeper_b_in_box;
- save_it->keeper_steps=keeper_steps;
- save_it->save_block=save_block;
- save_it->save_xoff=save_xoff;
- save_it->save_yoff=save_yoff;
- save_it->save_zoff=save_zoff;
- save_it->shot_speed=shot_speed;
- save_it->scr_x=scr_x;
- save_it->scr_y=scr_y;
- save_it->ball_speed=ball_speed;
- save_it->ball_int_speed=ball_int_speed;
- save_it->interceptor_a=interceptor_a;
- save_it->interceptor_b=interceptor_b;
- save_it->in_cross_area=in_cross_area;
- save_it->close_in_number=close_in_number;
- save_it->shooter=shooter;
- save_it->ball_inair=ball_inair;
- save_it->super_shot=super_shot;
- save_it->opponents_near_holder=opponents_near_holder;
- save_it->opponents_really_close=opponents_really_close;
- save_it->ball_poss=ball_poss;
- save_it->sender_1_2=sender_1_2;
- save_it->ball_still=ball_still;
- save_it->last_touch=last_touch;
- save_it->want_pass=want_pass;
- save_it->before=before;
- save_it->support_me=support_me;
- save_it->pre_kp_touch=pre_kp_touch;
- save_it->prev_touch=prev_touch;
- save_it->ball_limbo_p=ball_limbo_p;
- save_it->ball_limbo_on=ball_limbo_on;
- save_it->ball_limbo_c=ball_limbo_c;
- save_it->ball_released=ball_released;
- save_it->cannot_pick_up=cannot_pick_up;
- save_it->forced=forced;
- save_it->last_user_a=last_user_a;
- save_it->last_user_b=last_user_b;
- save_it->last_plr_a=last_plr_a;
- save_it->last_plr_b=last_plr_b;
- save_it->players_off_a=players_off_a;
- save_it->players_off_b=players_off_b;
- save_it->want_pass_stat=want_pass_stat;
- save_it->ball_zone1=ball_zone1;
- save_it->ball_zone2=ball_zone2;
- save_it->ball_out_of_play=ball_out_of_play;
- save_it->receiver_a=receiver_a;
- save_it->receiver_b=receiver_b;
- save_it->ready_centre=ready_centre;
- save_it->shot_attempt=shot_attempt;
- save_it->force_select=force_select;
- save_it->heading_ball=heading_ball;
- save_it->flag=flag;
- save_it->rep_camera=rep_camera;
- save_it->sub_camera=sub_camera;
- save_it->allow_replay=allow_replay;
- save_it->replay_pos=replay_pos;
- save_it->old_rep_pos=old_rep_pos;
- save_it->replay_cnt=replay_cnt;
- save_it->pitch_sprs=pitch_sprs;
- save_it->lp_user=lp_user;
- save_it->fixed_net_user=fixed_net_user;
- save_it->auto_users_a=auto_users_a;
- save_it->auto_users_b=auto_users_b;
- save_it->play_ball_a=play_ball_a;
- save_it->play_ball_b=play_ball_b;
- save_it->new_select=new_select;
- save_it->auto_intercept=auto_intercept;
- save_it->closest=closest;
- save_it->f1_down=f1_down;
- save_it->f2_down=f2_down;
- save_it->spec_kick_type=spec_kick_type;
- save_it->setp_hgt=setp_hgt;
- save_it->setp_power=setp_power;
- save_it->setp_kick_x=setp_kick_x;
- save_it->setp_kick_y=setp_kick_y;
- save_it->setp_bxd=setp_bxd;
- save_it->setp_byd=setp_byd;
- save_it->setp_bzd=setp_bzd;
- save_it->user_taker=user_taker;
- save_it->user_taker2=user_taker2;
- save_it->user_controlled=user_controlled;
- save_it->user_plr=user_plr;
- save_it->after_touch_on=after_touch_on;
- save_it->drive_shot=drive_shot;
- save_it->newk_shot=newk_shot;
- save_it->wallx=wallx;
- save_it->wally=wally;
- save_it->men_in_wall=men_in_wall;
- save_it->keeper_pos_x=keeper_pos_x;
- save_it->keeper_pos_y=keeper_pos_y;
- save_it->centre_guy_1=centre_guy_1;
- save_it->centre_guy_2=centre_guy_2;
- save_it->in_range=in_range;
- save_it->in_header_rng=in_header_rng;
- save_it->in_shot_rng=in_shot_rng;
- save_it->taker_x=taker_x;
- save_it->taker_y=taker_y;
- save_it->penalty_shot=penalty_shot;
- save_it->penalties=penalties;
- save_it->penalty_game=penalty_game;
- save_it->home_pens_left=home_pens_left;
- save_it->away_pens_left=away_pens_left;
- save_it->penalty_counter=penalty_counter;
- save_it->pen_taker_a=pen_taker_a;
- save_it->pen_taker_b=pen_taker_b;
- save_it->penalty_team=penalty_team;
- save_it->penalty_taker=penalty_taker;
- save_it->penalty_taker_a=penalty_taker_a;
- save_it->penalty_taker_b=penalty_taker_b;
- save_it->setp_taker=setp_taker;
- save_it->fkick_taker=fkick_taker;
- save_it->fkick_taker_a=fkick_taker_a;
- save_it->fkick_taker_b=fkick_taker_b;
- save_it->gkick_taker=gkick_taker;
- save_it->goal_kicker_a=goal_kicker_a;
- save_it->goal_kicker_b=goal_kicker_b;
- save_it->corner_taker=corner_taker;
- save_it->corn_kicker_a=corn_kicker_a;
- save_it->corn_kicker_b=corn_kicker_b;
- save_it->ktaker=ktaker;
- save_it->bad_guy=bad_guy;
- save_it->direct_fk=direct_fk;
- save_it->play_advantage=play_advantage;
- save_it->set_piece_on=set_piece_on;
- save_it->throw_in_taker=throw_in_taker;
- save_it->main_man=main_man;
- save_it->player_num=player_num;
- save_it->savex=savex;
- save_it->savey=savey;
- save_it->savez=savez;
- save_it->shot_acknowledged=shot_acknowledged;
- save_it->shot_pending=shot_pending;
- save_it->real_shot=real_shot;
- save_it->shot_missed=shot_missed;
- save_it->shot_saved=shot_saved;
- save_it->drib_opps=drib_opps;
- save_it->stop_and_face=stop_and_face;
- save_it->x_face=x_face;
- save_it->y_face=y_face;
- save_it->offside_now=offside_now;
- save_it->can_be_offside=can_be_offside;
- save_it->ref_accuracy=ref_accuracy;
- save_it->ref_strictness=ref_strictness;
- save_it->ref_wait=ref_wait;
- save_it->tussle_ptr=tussle_ptr;
- save_it->crowd_a=crowd_a;
- save_it->crowd_b=crowd_b;
- save_it->kickoff=kickoff;
- save_it->end_game=end_game;
- save_it->team_a=team_a;
- save_it->team_b=team_b;
- save_it->last_centre=last_centre;
- save_it->need_result=need_result;
- save_it->injury_time=injury_time;
- save_it->special_move=special_move;
- save_it->match_half=match_half;
- save_it->opt_user=opt_user;
- save_it->opt_team=opt_team;
- save_it->options_on=options_on;
- save_it->line_up=line_up;
- save_it->player_being_subbed=player_being_subbed;
- save_it->player_on_off=player_on_off;
- save_it->player_coming_on=player_coming_on;
- save_it->booking=booking;
- save_it->subbing_now=subbing_now;
- save_it->first_update=first_update;
- save_it->newdx=newdx;
- save_it->newdy=newdy;
- save_it->wind_on=wind_on;
- save_it->wind_d_trend=wind_d_trend;
- save_it->wind_s_trend=wind_s_trend;
- save_it->wind_x=wind_x;
- save_it->wind_y=wind_y;
- save_it->wind_speed=wind_speed;
- save_it->init_wind_x=init_wind_x;
- save_it->init_wind_y=init_wind_y;
- save_it->init_wind_speed=init_wind_speed;
- save_it->wind_var_ang=wind_var_ang;
- save_it->tactics_a=tactics_a;
- save_it->tactics_b=tactics_b;
- save_it->old_tac_a=old_tac_a;
- save_it->old_tac_b=old_tac_b;
- save_it->afr1=afr1;
- save_it->afr2=afr2;
- save_it->man2man_a=man2man_a;
- save_it->man2man_b=man2man_b;
- save_it->next_mins=next_mins;
- save_it->time_factor=time_factor;
- save_it->clock_running=clock_running;
- save_it->demo_match=demo_match;
- save_it->rolling_clock=rolling_clock;
- save_it->arrow_guy=arrow_guy;
- save_it->rand_seed=rand_seed;
- save_it->seed=seed;
- save_it->man_down=man_down;
- save_it->launch_type=launch_type;
- save_it->launch_x=launch_x;
- save_it->launch_y=launch_y;
- save_it->ballxdis=ballxdis;
- save_it->ballydis=ballydis;
- save_it->ballzdis=ballzdis;
- save_it->ballx=ballx;
- save_it->bally=bally;
- save_it->ballz=ballz;
- save_it->ballx_out=ballx_out;
- save_it->bally_out=bally_out;
- save_it->ballz_out=ballz_out;
- save_it->b_xoff=b_xoff;
- save_it->b_yoff=b_yoff;
- save_it->b_zoff=b_zoff;
- save_it->save_ballx=save_ballx;
- save_it->save_bally=save_bally;
- save_it->save_ballz=save_ballz;
- save_it->save_ball_poss=save_ball_poss;
- save_it->good_poss=good_poss;
- save_it->eff_ballx=eff_ballx;
- save_it->eff_bally=eff_bally;
- save_it->eff_ballz=eff_ballz;
- save_it->prev_ballx=prev_ballx;
- save_it->prev_bally=prev_bally;
- save_it->prev_ballz=prev_ballz;
- save_it->ns_ballx=ns_ballx;
- save_it->ns_bally=ns_bally;
- save_it->ns_ballz=ns_ballz;
- save_it->ball_zspin=ball_zspin;
- save_it->ball_xyspin=ball_xyspin;
- save_it->full_zspin=full_zspin;
- save_it->full_xyspin=full_xyspin;
- save_it->shoot_x=shoot_x;
- save_it->shoot_y=shoot_y;
- save_it->nearest_a=nearest_a;
- save_it->nearest_b=nearest_b;
- save_it->old_ltouch=old_ltouch;
- save_it->old_ball_poss=old_ball_poss;
- save_it->use_ball_limit=use_ball_limit;
- save_it->near_path_a=near_path_a;
- save_it->near_path_b=near_path_b;
- save_it->zone1_x=zone1_x;
- save_it->zone1_y=zone1_y;
- save_it->zone2_x=zone2_x;
- save_it->zone2_y=zone2_y;
- save_it->incident_x=incident_x;
- save_it->incident_y=incident_y;
- save_it->difficulty=difficulty;
- save_it->match_mode=match_mode;
- save_it->dead_ball_cnt=dead_ball_cnt;
- save_it->defense_a=defense_a;
- save_it->defense_b=defense_b;
- save_it->poss_mode=poss_mode;
- save_it->ball_travel=ball_travel;
- save_it->select_cnt=select_cnt;
- save_it->already_there=already_there;
- save_it->reselection=reselection;
- save_it->offside_on=offside_on;
- // "C" Vars...
- save_it->joy1_max_x=joy1_max_x;
- save_it->joy1_min_x=joy1_min_x;
- save_it->joy1_max_y=joy1_max_y;
- save_it->joy1_min_y=joy1_min_y;
- save_it->joy1_cnt_x=joy1_cnt_x;
- save_it->joy1_cnt_y=joy1_cnt_y;
- save_it->joy2_max_x=joy2_max_x;
- save_it->joy2_min_x=joy2_min_x;
- save_it->joy2_max_y=joy2_max_y;
- save_it->joy2_min_y=joy2_min_y;
- save_it->joy2_cnt_x=joy2_cnt_x;
- save_it->joy2_cnt_y=joy2_cnt_y;
- }
- /******************************************************************************
- ******************************************************************************/
- void restore_state(save_data *save_it)
- {
- memcpy(teams,save_it->teams,sizeof(teams));
- memcpy(&match_time,&save_it->match_time,sizeof(match_time));
- memcpy(refs,save_it->refs,sizeof(refs));
- memcpy(speech_tab,save_it->speech_tab,sizeof(speech_tab));
- memcpy(wguys,save_it->wguys,sizeof(wguys));
- memcpy(sel_circle,save_it->sel_circle,sizeof(sel_circle));
- memcpy(burst_timer,save_it->burst_timer,sizeof(burst_timer));
- memcpy(auto_users_list_a,save_it->auto_users_list_a,sizeof(auto_users_list_a));
- memcpy(auto_users_list_b,save_it->auto_users_list_b,sizeof(auto_users_list_b));
- memcpy(rand1_tab,save_it->rand1_tab,sizeof(rand1_tab));
- memcpy(rand2_tab,save_it->rand2_tab,sizeof(rand2_tab));
- memcpy(man2man,save_it->man2man,sizeof(man2man));
- memcpy(glob_str1,save_it->glob_str1,sizeof(glob_str1));
- memcpy(glob_str2,save_it->glob_str2,sizeof(glob_str2));
- sub_pending=save_it->sub_pending;
- return_12=save_it->return_12;
- shamed_player=save_it->shamed_player;
- old_min=save_it->old_min;
- users_left=save_it->users_left;
- setp_x=save_it->setp_x;
- setp_y=save_it->setp_y;
- setp_wait_cnt=save_it->setp_wait_cnt;
- frame=save_it->frame;
- kick_off=save_it->kick_off;
- keep_timer=save_it->keep_timer;
- stop_clock=save_it->stop_clock;
- keep_dive=save_it->keep_dive;
- hold_up_play=save_it->hold_up_play;
- wall_is_up=save_it->wall_is_up;
- card_is_out=save_it->card_is_out;
- crowd_mood_a=save_it->crowd_mood_a;
- crowd_mood_b=save_it->crowd_mood_b;
- possession=save_it->possession;
- poss_held=save_it->poss_held;
- arrow_on=save_it->arrow_on;
- logic_cnt=save_it->logic_cnt;
- ball_move=save_it->ball_move;
- first_bounce=save_it->first_bounce;
- swerve=save_it->swerve;
- spin_cnt=save_it->spin_cnt;
- spin_ball=save_it->spin_ball;
- prediction=save_it->prediction;
- set_xyspin=save_it->set_xyspin;
- set_zspin=save_it->set_zspin;
- ball_horz_ang=save_it->ball_horz_ang;
- ball_vert_ang=save_it->ball_vert_ang;
- max_sw_factor=save_it->max_sw_factor;
- swerve_factor=save_it->swerve_factor;
- rebound_ball=save_it->rebound_ball;
- headed_ball=save_it->headed_ball;
- say_names=save_it->say_names;
- fired_a_shot=save_it->fired_a_shot;
- comm_pass=save_it->comm_pass;
- comm_pass_type=save_it->comm_pass_type;
- keeper_spd=save_it->keeper_spd;
- keeper_down=save_it->keeper_down;
- save_direction=save_it->save_direction;
- keeper_will_save=save_it->keeper_will_save;
- keeper_on_grnd=save_it->keeper_on_grnd;
- keeper_contact=save_it->keeper_contact;
- ball_in_goal=save_it->ball_in_goal;
- ball_in_hands=save_it->ball_in_hands;
- game_action=save_it->game_action;
- throw_cnt=save_it->throw_cnt;
- team_a_goals=save_it->team_a_goals;
- team_b_goals=save_it->team_b_goals;
- last_goal=save_it->last_goal;
- scorer_running=save_it->scorer_running;
- just_scored=save_it->just_scored;
- just_thrown=save_it->just_thrown;
- goal_scorer=save_it->goal_scorer;
- pass_type=save_it->pass_type;
- kick_type=save_it->kick_type;
- receiver=save_it->receiver;
- cross_now=save_it->cross_now;
- auto_select=save_it->auto_select;
- must_face=save_it->must_face;
- must_face_time=save_it->must_face_time;
- must_face_x=save_it->must_face_x;
- must_face_y=save_it->must_face_y;
- must_shoot=save_it->must_shoot;
- chip_pass=save_it->chip_pass;
- must_pass=save_it->must_pass;
- must_punt=save_it->must_punt;
- keeper_a_in_box=save_it->keeper_a_in_box;
- keeper_b_in_box=save_it->keeper_b_in_box;
- keeper_steps=save_it->keeper_steps;
- save_block=save_it->save_block;
- save_xoff=save_it->save_xoff;
- save_yoff=save_it->save_yoff;
- save_zoff=save_it->save_zoff;
- shot_speed=save_it->shot_speed;
- scr_x=save_it->scr_x;
- scr_y=save_it->scr_y;
- ball_speed=save_it->ball_speed;
- ball_int_speed=save_it->ball_int_speed;
- interceptor_a=save_it->interceptor_a;
- interceptor_b=save_it->interceptor_b;
- in_cross_area=save_it->in_cross_area;
- close_in_number=save_it->close_in_number;
- shooter=save_it->shooter;
- ball_inair=save_it->ball_inair;
- super_shot=save_it->super_shot;
- opponents_near_holder=save_it->opponents_near_holder;
- opponents_really_close=save_it->opponents_really_close;
- ball_poss=save_it->ball_poss;
- sender_1_2=save_it->sender_1_2;
- ball_still=save_it->ball_still;
- last_touch=save_it->last_touch;
- want_pass=save_it->want_pass;
- before=save_it->before;
- support_me=save_it->support_me;
- pre_kp_touch=save_it->pre_kp_touch;
- prev_touch=save_it->prev_touch;
- ball_limbo_p=save_it->ball_limbo_p;
- ball_limbo_on=save_it->ball_limbo_on;
- ball_limbo_c=save_it->ball_limbo_c;
- ball_released=save_it->ball_released;
- cannot_pick_up=save_it->cannot_pick_up;
- forced=save_it->forced;
- last_user_a=save_it->last_user_a;
- last_user_b=save_it->last_user_b;
- last_plr_a=save_it->last_plr_a;
- last_plr_b=save_it->last_plr_b;
- players_off_a=save_it->players_off_a;
- players_off_b=save_it->players_off_b;
- want_pass_stat=save_it->want_pass_stat;
- ball_zone1=save_it->ball_zone1;
- ball_zone2=save_it->ball_zone2;
- ball_out_of_play=save_it->ball_out_of_play;
- receiver_a=save_it->receiver_a;
- receiver_b=save_it->receiver_b;
- ready_centre=save_it->ready_centre;
- shot_attempt=save_it->shot_attempt;
- force_select=save_it->force_select;
- heading_ball=save_it->heading_ball;
- flag=save_it->flag;
- rep_camera=save_it->rep_camera;
- sub_camera=save_it->sub_camera;
- allow_replay=save_it->allow_replay;
- replay_pos=save_it->replay_pos;
- old_rep_pos=save_it->old_rep_pos;
- replay_cnt=save_it->replay_cnt;
- pitch_sprs=save_it->pitch_sprs;
- lp_user=save_it->lp_user;
- fixed_net_user=save_it->fixed_net_user;
- auto_users_a=save_it->auto_users_a;
- auto_users_b=save_it->auto_users_b;
- play_ball_a=save_it->play_ball_a;
- play_ball_b=save_it->play_ball_b;
- new_select=save_it->new_select;
- auto_intercept=save_it->auto_intercept;
- closest=save_it->closest;
- f1_down=save_it->f1_down;
- f2_down=save_it->f2_down;
- spec_kick_type=save_it->spec_kick_type;
- setp_hgt=save_it->setp_hgt;
- setp_power=save_it->setp_power;
- setp_kick_x=save_it->setp_kick_x;
- setp_kick_y=save_it->setp_kick_y;
- setp_bxd=save_it->setp_bxd;
- setp_byd=save_it->setp_byd;
- setp_bzd=save_it->setp_bzd;
- user_taker=save_it->user_taker;
- user_taker2=save_it->user_taker2;
- user_controlled=save_it->user_controlled;
- user_plr=save_it->user_plr;
- after_touch_on=save_it->after_touch_on;
- drive_shot=save_it->drive_shot;
- newk_shot=save_it->newk_shot;
- wallx=save_it->wallx;
- wally=save_it->wally;
- men_in_wall=save_it->men_in_wall;
- keeper_pos_x=save_it->keeper_pos_x;
- keeper_pos_y=save_it->keeper_pos_y;
- centre_guy_1=save_it->centre_guy_1;
- centre_guy_2=save_it->centre_guy_2;
- in_range=save_it->in_range;
- in_header_rng=save_it->in_header_rng;
- in_shot_rng=save_it->in_shot_rng;
- taker_x=save_it->taker_x;
- taker_y=save_it->taker_y;
- penalty_shot=save_it->penalty_shot;
- penalties=save_it->penalties;
- penalty_game=save_it->penalty_game;
- home_pens_left=save_it->home_pens_left;
- away_pens_left=save_it->away_pens_left;
- penalty_counter=save_it->penalty_counter;
- pen_taker_a=save_it->pen_taker_a;
- pen_taker_b=save_it->pen_taker_b;
- penalty_team=save_it->penalty_team;
- penalty_taker=save_it->penalty_taker;
- penalty_taker_a=save_it->penalty_taker_a;
- penalty_taker_b=save_it->penalty_taker_b;
- setp_taker=save_it->setp_taker;
- fkick_taker=save_it->fkick_taker;
- fkick_taker_a=save_it->fkick_taker_a;
- fkick_taker_b=save_it->fkick_taker_b;
- gkick_taker=save_it->gkick_taker;
- goal_kicker_a=save_it->goal_kicker_a;
- goal_kicker_b=save_it->goal_kicker_b;
- corner_taker=save_it->corner_taker;
- corn_kicker_a=save_it->corn_kicker_a;
- corn_kicker_b=save_it->corn_kicker_b;
- ktaker=save_it->ktaker;
- bad_guy=save_it->bad_guy;
- direct_fk=save_it->direct_fk;
- play_advantage=save_it->play_advantage;
- set_piece_on=save_it->set_piece_on;
- throw_in_taker=save_it->throw_in_taker;
- main_man=save_it->main_man;
- player_num=save_it->player_num;
- savex=save_it->savex;
- savey=save_it->savey;
- savez=save_it->savez;
- shot_acknowledged=save_it->shot_acknowledged;
- shot_pending=save_it->shot_pending;
- real_shot=save_it->real_shot;
- shot_missed=save_it->shot_missed;
- shot_saved=save_it->shot_saved;
- drib_opps=save_it->drib_opps;
- stop_and_face=save_it->stop_and_face;
- x_face=save_it->x_face;
- y_face=save_it->y_face;
- offside_now=save_it->offside_now;
- can_be_offside=save_it->can_be_offside;
- ref_accuracy=save_it->ref_accuracy;
- ref_strictness=save_it->ref_strictness;
- ref_wait=save_it->ref_wait;
- tussle_ptr=save_it->tussle_ptr;
- crowd_a=save_it->crowd_a;
- crowd_b=save_it->crowd_b;
- kickoff=save_it->kickoff;
- end_game=save_it->end_game;
- team_a=save_it->team_a;
- team_b=save_it->team_b;
- last_centre=save_it->last_centre;
- need_result=save_it->need_result;
- injury_time=save_it->injury_time;
- special_move=save_it->special_move;
- match_half=save_it->match_half;
- opt_user=save_it->opt_user;
- opt_team=save_it->opt_team;
- options_on=save_it->options_on;
- line_up=save_it->line_up;
- player_being_subbed=save_it->player_being_subbed;
- player_on_off=save_it->player_on_off;
- player_coming_on=save_it->player_coming_on;
- booking=save_it->booking;
- subbing_now=save_it->subbing_now;
- first_update=save_it->first_update;
- newdx=save_it->newdx;
- newdy=save_it->newdy;
- wind_on=save_it->wind_on;
- wind_d_trend=save_it->wind_d_trend;
- wind_s_trend=save_it->wind_s_trend;
- wind_x=save_it->wind_x;
- wind_y=save_it->wind_y;
- wind_speed=save_it->wind_speed;
- init_wind_x=save_it->init_wind_x;
- init_wind_y=save_it->init_wind_y;
- init_wind_speed=save_it->init_wind_speed;
- wind_var_ang=save_it->wind_var_ang;
- tactics_a=save_it->tactics_a;
- tactics_b=save_it->tactics_b;
- old_tac_a=save_it->old_tac_a;
- old_tac_b=save_it->old_tac_b;
- afr1=save_it->afr1;
- afr2=save_it->afr2;
- man2man_a=save_it->man2man_a;
- man2man_b=save_it->man2man_b;
- next_mins=save_it->next_mins;
- time_factor=save_it->time_factor;
- clock_running=save_it->clock_running;
- demo_match=save_it->demo_match;
- rolling_clock=save_it->rolling_clock;
- arrow_guy=save_it->arrow_guy;
- rand_seed=save_it->rand_seed;
- seed=save_it->seed;
- man_down=save_it->man_down;
- launch_type=save_it->launch_type;
- launch_x=save_it->launch_x;
- launch_y=save_it->launch_y;
- ballxdis=save_it->ballxdis;
- ballydis=save_it->ballydis;
- ballzdis=save_it->ballzdis;
- ballx=save_it->ballx;
- bally=save_it->bally;
- ballz=save_it->ballz;
- ballx_out=save_it->ballx_out;
- bally_out=save_it->bally_out;
- ballz_out=save_it->ballz_out;
- b_xoff=save_it->b_xoff;
- b_yoff=save_it->b_yoff;
- b_zoff=save_it->b_zoff;
- save_ballx=save_it->save_ballx;
- save_bally=save_it->save_bally;
- save_ballz=save_it->save_ballz;
- save_ball_poss=save_it->save_ball_poss;
- good_poss=save_it->good_poss;
- eff_ballx=save_it->eff_ballx;
- eff_bally=save_it->eff_bally;
- eff_ballz=save_it->eff_ballz;
- prev_ballx=save_it->prev_ballx;
- prev_bally=save_it->prev_bally;
- prev_ballz=save_it->prev_ballz;
- ns_ballx=save_it->ns_ballx;
- ns_bally=save_it->ns_bally;
- ns_ballz=save_it->ns_ballz;
- ball_zspin=save_it->ball_zspin;
- ball_xyspin=save_it->ball_xyspin;
- full_zspin=save_it->full_zspin;
- full_xyspin=save_it->full_xyspin;
- shoot_x=save_it->shoot_x;
- shoot_y=save_it->shoot_y;
- nearest_a=save_it->nearest_a;
- nearest_b=save_it->nearest_b;
- old_ltouch=save_it->old_ltouch;
- old_ball_poss=save_it->old_ball_poss;
- use_ball_limit=save_it->use_ball_limit;
- near_path_a=save_it->near_path_a;
- near_path_b=save_it->near_path_b;
- zone1_x=save_it->zone1_x;
- zone1_y=save_it->zone1_y;
- zone2_x=save_it->zone2_x;
- zone2_y=save_it->zone2_y;
- incident_x=save_it->incident_x;
- incident_y=save_it->incident_y;
- difficulty=save_it->difficulty;
- match_mode=save_it->match_mode;
- dead_ball_cnt=save_it->dead_ball_cnt;
- defense_a=save_it->defense_a;
- defense_b=save_it->defense_b;
- poss_mode=save_it->poss_mode;
- ball_travel=save_it->ball_travel;
- select_cnt=save_it->select_cnt;
- already_there=save_it->already_there;
- reselection=save_it->reselection;
- offside_on=save_it->offside_on;
- // "C" Vars...
- joy1_max_x=save_it->joy1_max_x;
- joy1_min_x=save_it->joy1_min_x;
- joy1_max_y=save_it->joy1_max_y;
- joy1_min_y=save_it->joy1_min_y;
- joy1_cnt_x=save_it->joy1_cnt_x;
- joy1_cnt_y=save_it->joy1_cnt_y;
- joy2_max_x=save_it->joy2_max_x;
- joy2_min_x=save_it->joy2_min_x;
- joy2_max_y=save_it->joy2_max_y;
- joy2_min_y=save_it->joy2_min_y;
- joy2_cnt_x=save_it->joy2_cnt_x;
- joy2_cnt_y=save_it->joy2_cnt_y;
- }
- #ifdef EURO96
- /******************************************************************************
- *****************************************************************************/
- void checksum_state()
- {
- short *ptr=(short *)state_ptr;
- ptr+=(sizeof(save_data)/sizeof(short));
- short lim=CHECKSUM_CHUNK;
- _disable();
- // Must finish checksum before netsend...
- if (checksum_ptr<ptr)
- {
- // Some data left to checksum...
- for (short i=0; i<lim; i++)
- {
- state_checksum^=*checksum_ptr++;
- if (checksum_ptr>=ptr)
- i=lim;
- }
- }
- logic_cnt++;
- _enable();
- }
- /******************************************************************************
- ******************************************************************************/
- void process_state()
- {
- checksum_state();
- if (!(logic_cnt%(REAL_SPEED*STATE_INTERVAL)))
- {
- // Time for a save...
- if (state_ptr==&state1)
- state_ptr=&state2;
- else
- state_ptr=&state1;
- save_state(state_ptr);
- checksum_ptr=(short *)state_ptr;
- }
- }
- /******************************************************************************
- ******************************************************************************/
- void reset_state(char buff)
- {
- // Buff indicates current (0) or previous state (1)!
- if (buff)
- // Swap state_ptr...
- if (state_ptr==&state1)
- state_ptr=&state2;
- else
- state_ptr=&state1;
- restore_state(state_ptr);
- checksum_ptr=(short *)state_ptr;
- state_checksum=0xafaf;
- }
- #endif
- /******************************************************************************
- *****************************************************************************/
- void variable_wind()
- {
- // Variable speed and direction around initial settings...
- // Do dir.
- if (wind_d_trend>0)
- {
- // Wind current dir gets further from initial setting...
- wind_d_trend--;
- if (wind_var_ang<0)
- wind_var_ang-=(MAX_WIND_CHANGE*seed/128);
- else
- wind_var_ang+=(MAX_WIND_CHANGE*seed/128);
- wind_x=(init_wind_x*cos(wind_var_ang))-(init_wind_y*sin(wind_var_ang));
- wind_y=(init_wind_y*cos(wind_var_ang))+(init_wind_x*sin(wind_var_ang));
- }
- else
- {
- if (wind_d_trend<0)
- {
- // Wind current dir returns to initial setting...
- wind_d_trend++;
- if (wind_var_ang<0)
- wind_var_ang+=(MAX_WIND_CHANGE*seed/128);
- else
- wind_var_ang-=(MAX_WIND_CHANGE*seed/128);
- wind_x=(init_wind_x*cos(wind_var_ang))-(init_wind_y*sin(wind_var_ang));
- wind_y=(init_wind_y*cos(wind_var_ang))+(init_wind_x*sin(wind_var_ang));
- }
- else
- {
- // New trend...
- if (ABS(wind_var_ang*128/PI)<seed)
- wind_d_trend=WIND_BLUSTERINESS;
- else
- wind_d_trend=-WIND_BLUSTERINESS;
- }
- }
-
- af_randomize();
- // Do speed.
- if (wind_s_trend>0)
- {
- // Increment difference in speed...
- wind_s_trend--;
- if ((wind_speed-init_wind_speed)<0)
- {
- wind_speed-=(MAX_WIND_S_CHANGE*seed/128);
- if (wind_speed<0)
- wind_speed=0;
- }
- else
- {
- wind_speed+=(MAX_WIND_S_CHANGE*seed/128);
- if (wind_speed>128)
- wind_speed=128;
- }
- }
- else
- {
- if (wind_s_trend<0)
- {
- // Decrement difference in speed...
- wind_s_trend++;
- if ((wind_speed-init_wind_speed)<0)
- {
- wind_speed+=(MAX_WIND_S_CHANGE*seed/128);
- if (wind_speed>128)
- wind_speed=128;
- }
- else
- {
- wind_speed-=(MAX_WIND_S_CHANGE*seed/128);
- if (wind_speed<0)
- wind_speed=0;
- }
- }
- else
- {
- // New trend...
- if (ABS(wind_speed-init_wind_speed)<(seed/2))
- wind_s_trend=WIND_GUSTINESS;
- else
- wind_s_trend=-WIND_GUSTINESS;
- }
- }
- }
- /******************************************************************************
- ******************************************************************************/
- int coo=0;
- char gkey=0;
-
- void do_logic()
- {
- init_pitch_sprites();
- #ifdef SAVE_GAME
- if (keys[0x11]) // w
- {
- save_game();
- }
- if (keys[0x2c]) // z
- {
- restore_game();
- }
- #endif
- #ifndef COVERDISK
- if (debug && key_togs[0x30]) // b
- {
- // Move ball around with mouse.
- ReportMouse();
- ballx=Mouse.x*5-160;
- bally=Mouse.y*5-160;
- char key=0;
- float x,y;
- }
- #endif
- // Normal logic mode.
- /*
- if (!match_mode)
- {
- if (!--pen_cnt)
- force_penalty();
- }
- */
- frame=(frame) ? 0:1;
- af_randomize();
- if (!on_3d)
- {
- ReportMouse();
- }
- process_subs();
- if (wind_on<0)
- variable_wind(); // Get current wind parameters...
- process_ball();
- match_rules();
- keeper_boxes();
- player_distances();
- get_nearest(); // near_path_a, near_path_b
- get_opp_near_ball(ball_poss);
- process_speech();
- process_comments();
- process_flags();
- process_teams();
- new_users();
- select_all_hlites();
- process_offs();
- if (!match_mode && comsetp)
- --comsetp;
- }
- /******************************************************************************
- *****************************************************************************/
- void stop_mf_time()
- {
- /*
- int cl=clock();
- int c=cl/CLOCKS_PER_SEC;
- last_second=c;
- old_clock=cl;
- */
- oldcnt=count-1;
- }
- /******************************************************************************
- *****************************************************************************/
- void pause_game()
- {
- char key=0;
- do{
- }while (paused);
- stop_mf_time();
- }
- /******************************************************************************
- *****************************************************************************/
- extern "C" char calibrated_1,calibrated_2;
- /******************************************************************************
- *****************************************************************************/
- void init_joy1()
- {
- calibrated_1=FALSE;
- joy1_min_x=20000;
- joy1_max_x=0;
- joy1_min_y=20000;
- joy1_max_y=0;
- }
- /******************************************************************************
- *****************************************************************************/
- void init_joy2()
- {
- calibrated_2=FALSE;
- joy2_min_x=20000;
- joy2_max_x=0;
- joy2_min_y=20000;
- joy2_max_y=0;
- }
- /******************************************************************************
- *****************************************************************************/
- void init_joys()
- {
- init_joy1();
- init_joy2();
- }
- void process_keys()
- {
- if (!demo_match || debug)
- {
- while(escape_pending>0)
- {
- if (keys[0x15]) // Y
- {
- add_message("Leaving Match!",RED,TRUE);
- escape_pending=-1;
- }
- if (keys[0x31]) // N
- {
- add_message(" ",WHITE,TRUE);
- escape_pending=FALSE;
- stop_mf_time();
- }
- }
- if (paused)
- pause_game();
- if (keys[0x3b] && keys[0x1d] && joystick1_on)
- {
- // Ctrl F1...
- calibrated_1=FALSE;
- init_joy1();
- add_message("Auto Calibrating Port 1",WHITE,TRUE);
- }
- if (keys[0x3c] && keys[0x1d] && joystick2_on)
- {
- // Ctrl F2...
- calibrated_2=FALSE;
- init_joy2();
- add_message("Auto Calibrating Port 2",WHITE,TRUE);
- }
- #ifdef NO_AUTO_SEL
- if (keys[0x43]) // f9
- if (key_togs[0x43])
- add_message("Manual Switching",WHITE,TRUE);
- else
- add_message("Automatic Switching",WHITE,TRUE);
- #endif
- #ifndef COVERDISK
- if (debug)
- {
- if (keys[0x11] && ball_poss && !match_mode)
- {
- short b=ball_poss;
- holder_lose_ball();
- init_foul((b<12 ? 13:2),TRUE,TRUE); // pass no. of fouler.
- }
- if (keys[0x0f])
- delete_net_user(2);
- /*
- if (keys[0x14]) // t
- if (key_togs[0x14])
- tweening=TRUE;
- else
- tweening=FALSE;
- */
- if (keys[0x14]) // t
- {
- do; while(keys[0x14]);
- if (++xinfo>8)
- xinfo=0;
- }
- /*
- if (keys[0x0f]) // TAB
- {
- delete_net_user(2);
- while(keys[0x14]);
- }
- */
- if (keys[0x21]) // f
- {
- // Fixed speed...
- mf_fixed=TRUE;
- mf_scale=1;
- }
- if (keys[0x22]) // g
- {
- // Variable speed...
- mf_fixed=FALSE;
- }
- if (keys[0x4a]) // +
- {
- // Game Faster...
- if (game_speed>0)
- game_speed--;
- }
- if (keys[0x4e]) // -
- {
- // Game Slower...
- game_speed++;
- }
- }
- #endif
- if (!network_on && !player_on_off && !line_up && match_mode!=SWAP_ENDS)
- {
- #ifdef SUPPORT_LP
- if (keys[0x3b] || (users_dir[0].f&8 && users_dir[0].f&4 && !(users_dir[0].f&48))) // LS + RS
- {
- if (num_of_users>=1)
- {
- // User player 1 options...
- opt_user=1;
- }
- else
- // No user players...
- opt_user=-1;
- }
- if ((keys[0x3c] || (users_dir[1].f&8 && users_dir[1].f&4) && !(users_dir[0].f&48)) && num_of_users>=2)
- {
- // User player 2 options...
- opt_user=2;
- }
- if ((keys[0x3d] || (users_dir[2].f&8 && users_dir[2].f&4) && !(users_dir[0].f&48)) && num_of_users>=3)
- {
- // User player 3 options...
- opt_user=3;
- }
- if ((keys[0x3e] || (users_dir[3].f&8 && users_dir[3].f&4) && !(users_dir[0].f&48)) && num_of_users>=4)
- {
- // User player 4 options...
- opt_user=4;
- }
- #else
- if (keys[0x3b] && !keys[0x1d]) // F1
- {
- if (num_of_users>=1)
- {
- // User player 1 options...
- opt_user=1;
- }
- else
- // No user players...
- opt_user=-1;
- }
- if (keys[0x3c] && !keys[0x1d] && num_of_users>=2) // F2
- {
- // User player 2 options...
- opt_user=2;
- }
- if (keys[0x3d] && !keys[0x1d] && num_of_users>=3) // F3
- {
- // User player 3 options...
- opt_user=3;
- }
- if (keys[0x3e] && !keys[0x1d] && num_of_users>=4) // F4
- {
- // User player 4 options...
- opt_user=4;
- }
- #endif
-
- if (opt_user)
- {
- if (users[opt_user-1].type==-1)
- opt_team=team_a;
- else
- if (users[opt_user-1].type==-2)
- opt_team=team_b;
- else
- if (users[opt_user-1].type<12)
- opt_team=team_a;
- else
- opt_team=team_b;
- }
- }
- }
- else
- if (anykey)
- end_game=TRUE;
- }
- /******************************************************************************
- *****************************************************************************/
- void animate_players()
- {
- for (int i=0; i<players; i++)
- {
- teams[i].tm_frm+=teams[i].tm_fstep;
- }
- for (i=0; i<3; i++)
- {
- refs[i].frm+=refs[i].fstep;
- }
- }
- /******************************************************************************
- *****************************************************************************/
- void update_2d()
- {
- if (plot_buffer)
- plot_cnta=1;
- else
- plot_cntb=1;
- _setplotaction(_GPSET);
- process_butts();
- _setplotaction(_GXOR);
- if (Mouse.b&&1)
- mouse_fired();
- draw_ball();
- draw_team();
- draw_buffer();
- plot_buffer=!plot_buffer;
- draw_buffer();
- delay(delay_cnt);
- panel_data();
- }
- /******************************************************************************
- *****************************************************************************/
- void reset_possession()
- {
- poss_held=0;
- possession=0;
- }
- /******************************************************************************
- *****************************************************************************/
- void accumulate_possession()
- {
- if (ball_poss>11)
- {
- // Team b. currently has possession...
- poss_held+=(0.0001+(ABS(poss_held)/30));
- if (poss_held>0.5)
- poss_held=0.5;
- }
- else
- {
- if (ball_poss)
- // Team a. currently has possession...
- {
- poss_held-=(0.0001+(ABS(poss_held)/30));
- if (poss_held<-0.5)
- poss_held=-0.5;
- }
- }
-
- if (!ball_poss)
- {
- // Ball is free...(tend slowly towards 0)
- poss_held+=(-poss_held/60);
- }
- possession+=poss_held;
- if (possession>1)
- possession=1;
- if (possession<-1)
- possession=-1;
- }
- /******************************************************************************
- *****************************************************************************/
- void process_crowd_noise()
- {
- if (shot_missed)
- {
- if (shot_missed<0)
- {
- // Missed by a long way...
- shot_missed++;
- if (last_touch<12)
- {
- // team A shot...
- crowd_mood_a=CN_BOO;
- crowd_mood_b=CN_LAUGH;
- }
- else
- {
- // team B shot...
- crowd_mood_a=CN_LAUGH;
- crowd_mood_b=CN_BOO;
- }
- }
- else
- {
- // Near missed...
- shot_missed--;
- if (last_touch<12)
- {
- // team A shot...
- crowd_mood_a=CN_MISS;
- crowd_mood_b=CN_PENSIVE;
- }
- else
- {
- // team B shot...
- crowd_mood_a=CN_PENSIVE;
- crowd_mood_b=CN_MISS;
- }
- }
- }
- else
- {
- if (shot_saved)
- {
- // Shot stopped...
- shot_saved--;
- if (last_touch<12)
- {
- // team A save...
- crowd_mood_a=CN_SAVE;
- crowd_mood_b=CN_MISS;
- }
- else
- {
- // team B save...
- crowd_mood_a=CN_MISS;
- crowd_mood_b=CN_SAVE;
- }
- }
- else
- {
- if (card_is_out)
- {
- card_is_out--;
- crowd_mood_a=CN_FOWL;
- crowd_mood_b=CN_FOWL;
- }
- else
- {
- if (match_half>10)
- {
- // End of Game...
- crowd_mood_a=CN_EXCITED;
- crowd_mood_b=CN_EXCITED;
- }
- else
- {
- switch(match_mode)
- {
- case(NORMAL_PLAY):
-
- if (shot_pending && shot_acknowledged)
- {
- // Keeper is reacting to incoming ball...
- if (ballx<prat*40 && ballxdis<0 && last_touch>11)
- {
- // Ball coming left (from team B)...
- crowd_mood_a=CN_PENSIVE;
- crowd_mood_b=CN_EXCITED;
- }
- if (ballx>(pitch_len-(prat*40)) && ballxdis>0 && last_touch<12)
- {
- // Ball coming right (from team A)...
- crowd_mood_a=CN_EXCITED;
- crowd_mood_b=CN_PENSIVE;
- }
- }
- else
- {
- accumulate_possession();
-
- if (ball_in_hands && (ball_poss==KP_A || ball_poss==KP_B))
- {
- // Keepers ball...(calm)
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- else
- {
- if ((ballx>(cntspot_x-prat*16)) && (ballx<(cntspot_x+prat*16)))
- {
- // In mid-field...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- else
- {
- if (ballx<=(cntspot_x-prat*16))
- {
- // Near Goal A...
- if (possession>0.5)
- {
- // Team B has good possession...
- crowd_mood_a=CN_PENSIVE;
- crowd_mood_b=CN_EXCITED;
- }
- else
- {
- if (possession<-0.5)
- {
- // Defending team A has it under control...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- else
- {
- // No one team has it under control...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_ENCOURAGING;
- }
- }
- }
- else
- {
- // Near Goal B...
- if (possession<-0.5)
- {
- // Team A has good possession...
- crowd_mood_a=CN_EXCITED;
- crowd_mood_b=CN_PENSIVE;
- }
- else
- {
- if (possession>0.5)
- {
- // Defending team B has it under control...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- else
- {
- // No one team has it under control...
- crowd_mood_a=CN_ENCOURAGING;
- crowd_mood_b=CN_NORMAL;
- }
- }
- }
- }
- }
-
- if (just_scored)
- {
- // someone has scored a goal...
- if (ballx<cntspot_x)
- {
- // Team A. goal...
- if (goal_scorer>11)
- {
- // Team B scores good goal!
- crowd_mood_a=CN_PENSIVE;
- crowd_mood_b=CN_CELEBRATE;
- }
- else
- {
- // Team A scores own goal!
- crowd_mood_a=CN_BOO;
- crowd_mood_b=CN_CELEBRATE;
- }
- }
- else
- {
- // Team B. goal...
- if (goal_scorer<12)
- {
- // Team A scores good goal!
- crowd_mood_a=CN_CELEBRATE;
- crowd_mood_b=CN_PENSIVE;
- }
- else
- {
- // Team B scores own goal!
- crowd_mood_a=CN_CELEBRATE;
- crowd_mood_b=CN_BOO;
- }
- }
- }
- }
- break;
-
- case(DF_KICK_B):
- if (!men_in_wall) // Not in shooting range!
- {
- if ((ballx>(cntspot_x-prat*16)) && (ballx<(cntspot_x+prat*16)))
- {
- // In mid-field...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- else
- {
- if (ballx<=(cntspot_x-prat*16))
- {
- // Near Goal A...
- crowd_mood_a=CN_PENSIVE;
- crowd_mood_b=CN_ENCOURAGING;
- }
- else
- {
- // Near Own Goal B...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- }
- break;
- }
-
- case(CORNER_TL):
- case(CORNER_BL):
- crowd_mood_a=CN_PENSIVE;
- crowd_mood_b=CN_EXCITED;
- break;
-
- case(DF_KICK_A):
- if (!men_in_wall) // Not in shooting range!
- {
- if ((ballx>(cntspot_x-prat*16)) && (ballx<(cntspot_x+prat*16)))
- {
- // In mid-field...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- else
- {
- if (ballx>=(cntspot_x+prat*16))
- {
- // Near Goal B...
- crowd_mood_a=CN_ENCOURAGING;
- crowd_mood_b=CN_PENSIVE;
- }
- else
- {
- // Near Own Goal A...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- }
- break;
- }
-
- case(CORNER_TR):
- case(CORNER_BR):
- crowd_mood_a=CN_EXCITED;
- crowd_mood_b=CN_PENSIVE;
- break;
-
- case(GOAL_KICK_TL):
- case(GOAL_KICK_TR):
- case(GOAL_KICK_BL):
- case(GOAL_KICK_BR):
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- reset_possession();
- break;
-
- case(IF_KICK_A):
- case(THROW_IN_A):
- if ((ballx>(cntspot_x-prat*16)) && (ballx<(cntspot_x+prat*16)))
- {
- // In mid-field...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- else
- {
- if (ballx>=(cntspot_x+prat*16))
- {
- // Near Goal B...
- crowd_mood_a=CN_ENCOURAGING;
- crowd_mood_b=CN_PENSIVE;
- }
- else
- {
- // Near Own Goal A...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- }
- break;
-
- case(IF_KICK_B):
- case(THROW_IN_B):
- if ((ballx>(cntspot_x-prat*16)) && (ballx<(cntspot_x+prat*16)))
- {
- // In mid-field...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- else
- {
- if (ballx<=(cntspot_x-prat*16))
- {
- // Near Goal A...
- crowd_mood_a=CN_PENSIVE;
- crowd_mood_b=CN_ENCOURAGING;
- }
- else
- {
- // Near Own Goal B...
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- }
- break;
-
- case(PEN_KICK_A):
- case(PEN_KICK_B):
- case(SWAP_ENDS):
- crowd_mood_a=CN_EXCITED;
- crowd_mood_b=CN_EXCITED;
- break;
-
- case(CENTRE_A):
- case(CENTRE_B):
- reset_possession();
- if (kickoff)
- {
- crowd_mood_a=CN_EXCITED;
- crowd_mood_b=CN_EXCITED;
- }
- else
- {
- crowd_mood_a=CN_NORMAL;
- crowd_mood_b=CN_NORMAL;
- }
- break;
- }
- }
- }
- }
- }
- }
- /******************************************************************************
- *****************************************************************************/
- char nothing_happening()
- {
- if (!match_mode && !just_scored)
- {
- // In Play...
- play_fx(PS_FULLTIMEWHISTLE,refs[0].x,refs[0].y);
- if (shot_pending || dead_ball_cnt || game_action)
- return(FALSE); // Crucial moment!
- else
- return(TRUE);
- }
- else
- {
- if (match_mode<=CORNER_BR || match_mode>=PEN_KICK_A)
- return(FALSE); // Crucial moment!
- else
- if ((match_mode==DF_KICK_B || match_mode==DF_KICK_A) && men_in_wall)
- return(FALSE); // Crucial moment!
- else
- return(TRUE);
- }
- }
- /******************************************************************************
- *****************************************************************************/
- void watch_match_time()
- {
- if (golden_goal==2 && !just_scored)
- {
- // End of sudden death...
- if (match_half<11)
- {
- // Start leaving field!
- play_fx(PS_FULLTIMEWHISTLE,refs[0].x,refs[0].y);
- last_goal=0;
- match_mode=SWAP_ENDS;
- init_match_mode();
- do_full_time_anim(0);
- do_fulltime_menu();
- match_half=11; // End game!
- PlayCommentaryMessage(TI_FULLTIME);
- next_mins=0;
- #ifdef EURO96
- get_performance();
- xinfo=9;
- if (man_of_match)
- camera=18;
- #endif
- }
- }
- else
- {
- if (match_info.CompetitionType==PENALTIES)
- {
- // Practice penalties...
- if (!penalty_game)
- {
- if (team_a_goals!=team_b_goals)
- {
- // Someone has won shoot-out...
- if (match_half<11)
- {
- // Initialise end of penalty shoot-out...
- last_goal=0;
- match_mode=SWAP_ENDS;
- init_match_mode();
- do_full_time_anim(0);
- EUROmatch_info.Team_A_penalties=team_a_goals;
- EUROmatch_info.Team_B_penalties=team_b_goals;
- do_final_score_menu();
- match_half=11; // End game!
- PlayCommentaryMessage(TI_FULLTIME);
- next_mins=0;
- #ifdef EURO96
- get_performance();
- xinfo=9;
- if (man_of_match)
- camera=18;
- #endif
- }
- }
- else
- {
- // Initialise penalty shoot-out...
- EUROmatch_info.penalties=TRUE;
- penalty_game=TRUE;
- team_a_goals=0;
- team_b_goals=0;
- EUROmatch_info.Team_A_penalties=team_a_goals;
- EUROmatch_info.Team_B_penalties=team_b_goals;
- do_penalty_shootout_menu();
- next_mins=0;
- }
- }
- }
- else
- {
- if (match_time.min>=(45+injury_time) && !match_half && nothing_happening())
- {
- // End of first half! (It's a game of two halves...)
- #ifdef DEMO
- last_goal=0;
- match_mode=SWAP_ENDS;
- init_match_mode();
- play_fx(PS_FULLTIMEWHISTLE,refs[0].x,refs[0].y);
- do_full_time_anim(0);
- do_fulltime_menu();
- PlayCommentaryMessage(TI_FULLTIME);
- match_half=11; // End game!
- next_mins=0;
- #else
- match_mode=SWAP_ENDS;
- last_goal=0;
- init_match_mode();
- play_fx(PS_HALFTIMEWHISTLE,refs[0].x,refs[0].y);
- do_half_time_anim(0);
- do_halftime_menu();
- PlayCommentaryMessage(TI_HALFTIME);
- kickoff=TRUE;
- next_mins=45;
- if (practice)
- match_half=12;
- #endif
- }
- else
- {
- if (match_time.min>=(90+injury_time) && match_half==1 && nothing_happening())
- {
- // End of full time! (Not half mate...)
- last_goal=0;
- match_mode=SWAP_ENDS;
- init_match_mode();
- play_fx(PS_FULLTIMEWHISTLE,refs[0].x,refs[0].y);
- if (need_result && team_a_goals==team_b_goals)
- {
- do_extra_time_anim(0);
- do_extratime_menu();
- EUROmatch_info.extra=TRUE;
- kickoff=TRUE;
- next_mins=90;
- }
- else
- {
- do_full_time_anim(0);
- do_fulltime_menu();
- PlayCommentaryMessage(TI_FULLTIME);
- match_half=11; // End game!
- next_mins=0;
- #ifdef EURO96
- get_performance();
- xinfo=9;
- if (man_of_match)
- camera=18;
- #endif
- }
- }
- else
- {
- if (need_result && match_time.min>=(90+15+injury_time)
- && match_half==2 && nothing_happening())
- // End of first half of extra time! (It's a game with more halves...)
- {
- last_goal=0;
- match_mode=SWAP_ENDS;
- init_match_mode();
- do_half_time_anim(0);
- do_halftime_menu();
- play_fx(PS_HALFTIMEWHISTLE,refs[0].x,refs[0].y);
- kickoff=TRUE;
- next_mins=105;
- }
- else
- {
- if (!penalty_game && need_result && match_time.min>=(90+30+injury_time)
- && match_half==3 && nothing_happening())
- // End of full extra time!
- {
- play_fx(PS_FULLTIMEWHISTLE,refs[0].x,refs[0].y);
- if (need_result && team_a_goals==team_b_goals)
- {
- EUROmatch_info.penalties=TRUE;
- penalty_game=TRUE;
- team_a_goals=0;
- team_b_goals=0;
- EUROmatch_info.Team_A_penalties=team_a_goals;
- EUROmatch_info.Team_B_penalties=team_b_goals;
- do_penalty_shootout_menu();
- next_mins=0;
- }
- else
- {
- last_goal=0;
- match_mode=SWAP_ENDS;
- init_match_mode();
- do_full_time_anim(0);
- if (EUROmatch_info.penalties)
- {
- EUROmatch_info.Team_A_penalties=team_a_goals;
- EUROmatch_info.Team_B_penalties=team_b_goals;
- do_final_score_menu();
- }
- else
- do_fulltime_menu();
- match_half=11; // End game!
- PlayCommentaryMessage(TI_FULLTIME);
- next_mins=0;
- #ifdef EURO96
- get_performance();
- xinfo=9;
- if (man_of_match)
- camera=18;
- #endif
- }
- }
- }
- }
- }
- }
- }
- }
- /******************************************************************************
- *****************************************************************************/
- void setup_alarm()
- {
- mf_fixed=FALSE;
- alarm=FALSE; // Debug alarm on/off.
- watch=TRUE;
- stop_min=45;
- stop_sec=1; // Debug alarm stop.
- }
- /******************************************************************************
- *****************************************************************************/
- void init_wind()
- {
- // Wind stuff...
- if (EUROmatch_info.wind)
- {
- init_wind_x=1;
- init_wind_y=0;
- wind_x=init_wind_x;
- wind_y=init_wind_y;
- init_wind_speed=EUROmatch_info.wind*30; // (30,60,90)
- wind_speed=init_wind_speed;
- wind_var_ang=0;
- wind_d_trend=0;
- wind_s_trend=0;
- af_randomize();
- if (!(seed&3))
- wind_on=-TRUE; // Variable wind!
- else
- wind_on=TRUE;
- wind_on=TRUE;
- }
- else
- wind_on=FALSE;
- }
- /******************************************************************************
- *****************************************************************************/
- // Get your grubby mits off these routines Andy!
- void NetUserInit()
- {
- if (network_on)
- {
- // Network init users
- for (int i=0;i<network_on;i++)
- {
- int ctrl;
- if (i==wConsoleNode)
- {
- ctrl=convert_control(match_info.control_methods[0]);
- // ctrl=KEY1_CTRL;
- // calibrate_joy(0,&joy1_cnt_x,&joy1_cnt_y);
- }
- else
- ctrl=NET_CTRL;
- if (NetTeams[i]==0)
- if (Players[i]==1)
- add_team_user(TEAM_A,ctrl);
- else
- add_fixed_user(Players[i],ctrl);
- else
- if (Players[i]==1)
- add_team_user(TEAM_B,ctrl);
- else
- add_fixed_user(Players[i]+11,ctrl);
- }
- }
- }
- int otick;
- void TimerInit()
- {
- ftick=0;
- otick=tick=0;
- old_count=count;
- /*
- if (!old_mf)
- {
- get_user_inputs();
- process_user_inputs();
- writeptr++;
- }
- */
- while(tick==otick);
- }
- /******************************************************************************
- *****************************************************************************/
- void reset_front()
- {
- for (int i=0; i<sizeof(cam_array); i++)
- {
- if (camera==cam_array[i])
- {
- EUROmatch_info.camera=i;
- match_info.camera_toggle=i;
- break;
- }
- }
- }
- /******************************************************************************
- *****************************************************************************/
- int match(int argc, char **argv)
- {
- int match_err=FALSE;
- initialise_vars();
- #ifdef NET_GAME
- // Pseudo net initialisation (not normally used)
- NetTest();
- #endif
- if (network_on)
- old_mf=FALSE;
- else
- old_mf=TRUE;
- offside_on=EUROmatch_info.offside;
- if (match_info.CompetitionType==PRACTICE)
- {
- offside_on=FALSE;
- }
- // Set up default camera...
- camera=cam_array[EUROmatch_info.camera];
- float cd=set_camera_dist;
- float ch=set_camera_height;
- change_cam(camera);
- set_camera_dist=cd;
- set_camera_height=ch;
- // Set up audio...
- audio_version=(char)EUROmatch_info.audio;
- // Vidi screen setup...
- vidi_wall_on=(char)EUROmatch_info.vidi; // Vidi toggle!
- // Debugging alarm...
- setup_alarm();
-
- #ifndef FRONT_END
- time_factor=4;
- // debug=TRUE; // Allows return keyboard to dos.
- #else
- say_names=TRUE;
- if (network_on)
- time_factor=time_table[net_half]; // Real minutes duration.
- else
- time_factor=time_table[EUROmatch_info.time]; // Real minutes duration.
- debug=FALSE; // Allows return keyboard to dos.
- #endif
- #ifdef ECTS
- time_factor=4;
- #endif
- // debug=TRUE;
- // time_factor=10;
- init_wind();
- gravity=0.60;
- on_3d=TRUE;
- digital_joy1=FALSE;
- digital_joy2=FALSE;
- close_in_number=2;
- goal_kicker_a=1;
- goal_kicker_b=12;
- fkick_taker_a=0;
- fkick_taker_b=0;
- corn_kicker_a=0;
- corn_kicker_b=0;
- // _setvideomode(_MRES256COLOR);
- init_officials();
- init_match();
-
- if (!on_3d)
- {
- plot_buffer=TRUE;
- plot_cnta=0;
- plot_cntb=0;
- draw_pitch();
- pitch_markings();
- _setcolor(4);
- draw_buttons();
- _setcolor(50);
- _setplotaction(_GXOR);
- ShowMouse();
- MouseYlim(140,200-4);
- MouseXlim(160*2,(320-4)*2);
- }
- else
- {
- if (init_3d()<0)
- goto ERR_3D;
- MouseYlim(0,200);
- MouseXlim(0,320);
- }
- if (audio_version)
- {
- InitMatchAudio(rand_seed);
- if (!LoadPitchSamples())
- if (!LoadTeamSamples(setup.team_a,HOME_TEAM))
- if (!LoadTeamSamples(setup.team_b,AWAY_TEAM))
- {
- if (match_info.CompetitionType!=PRACTICE)
- LoadCommentarySamples();
- StartCrowd(HOME_TEAM);
- StartCrowd(AWAY_TEAM);
- }
- }
- // Pseudo net user initialisation (not normally used)
- NetUserInit();
- users_left=num_of_users;
- // Wait for everyone to get here, set timer & machine factor...
- readptr=writeptr=0;
- Network_Play_Ready();
- setscreen();
- if (audio_version)
- PlayWelcomeMessage();
- // Various timing initialisations for network (DO NOT MOVE)
- TimerInit();
- mf_scale=omf_scale=0.5;
- MF=1;
- old_clock=clock();
- oldcnt=count;
- // No Dos. keyboard chain!
- return_doskey=FALSE;
- // Main program loop...
- // penalty_game=TRUE;
- #ifdef NET_DEBUG
- if (network_on)
- opendebugfile();
- #endif
- do_ref_menu();
- #ifdef FRONT_END
- if (!num_of_users)
- {
- // No Players... Rolling match...
- anykey=FALSE;
- rolling_clock=80*REAL_SPEED;
- demo_match=TRUE;
- }
- #endif
- // out_mcball_coords();
- // old_mf=0;
- while (in_game && !net_quit)
- {
- /***********************************************/
- if (!old_mf) // New logical loop
- {
- int ttick=tick;
- int tftick=ftick;
- int twriteptr=writeptr;
- if ((mf_fixed) || (!on_3d) || (!watch && alarm))
- ttick=tick=otick+1,tftick=ftick=0,mf_scale=omf_scale=0;
- mf_scale=(float)tftick/TIMER_SPEED;
- MF=(ttick+mf_scale)-(otick+omf_scale);
- omf_scale=mf_scale;
- log_factor=MF; // Passed to 3d (Logic cycles/update)
- for (int i=readptr; i!=twriteptr; ++i&=511)
- {
- process_crowd_noise();
- if (audio_version)
- {
- process_crowd_noise();
- UpdateCrowd(crowd_mood_a,team_a);
- UpdateCrowd(crowd_mood_b,team_b);
- UpdateCommentary();
- }
- wptr=writeptr;
- rptr=readptr;
- convert_inputs();
- readptr++;
- readptr&=511;
- if (!line_up)
- {
- do_logic();
- }
- else
- {
- line_up--;
- animate_players();
- if (!line_up)
- {
- match_mode=CENTRE_A;
- init_match_mode();
- }
- }
- #ifdef EURO96
- process_state();
- #else
- logic_cnt++;
- #endif
- #ifdef NET_DEBUG
- if (network_on)
- {
- writeplayerdata();
- writecontroldata(i);
- }
- #endif
- new_update_coords();
- process_replay();
- watch_match_time();
- }
- otick=ttick;
- }
- else
- {
- if ((mf_fixed) || (!on_3d) || (!watch && alarm))
- MF=1;
- mf_scale+=MF;
- log_factor=MF; // Passed to 3d(Logic cycles/update)
- for (float i=(mf_scale); (i>1); i=i-1)
- {
- process_crowd_noise();
- if (audio_version)
- {
- process_crowd_noise();
- UpdateCrowd(crowd_mood_a,team_a);
- UpdateCrowd(crowd_mood_b,team_b);
- UpdateCommentary();
- }
- get_user_inputs();
- process_user_inputs();
- writeptr++;
- writeptr&=511;
- convert_inputs();
- readptr++;
- readptr&=511;
- if (!line_up)
- {
- do_logic();
- }
- else
- {
- line_up--;
- animate_players();
- if (!line_up)
- {
- match_mode=CENTRE_A;
- init_match_mode();
- }
- }
- #ifdef EURO96
- process_state();
- #else
- logic_cnt++;
- #endif
- new_update_coords();
- process_replay();
- watch_match_time();
- mf_scale=mf_scale-1;
- }
- }
- /***********************************************/
- if (!(!watch && alarm))
- {
- realtime_coords();
- process_pitch_sprs();
- if (keys[0x01] && !escape_pending) // (Esc.)
- {
- escape_pending=TRUE;
- add_message("Quit Game Y or N",RED,TRUE);
- }
- if (on_3d)
- update_3d();
- else
- update_2d();
- if (on_3d)
- {
- if (old_mf)
- {
- frame_count();
- }
- else
- updates++;
- process_keys();
- }
- }
- if (demo_match && rolling_clock<=0)
- end_game=TRUE;
- if ((!on_3d) && (delay_cnt))
- delay(delay_cnt);
- if (!in_game && !on_3d)
- {
- editor_main();
- break;
- }
- if (escape_pending<0)
- {
- // Quit Match...
- net_error=-1;
- break;
- }
- if (end_game)
- break;
- }
- #ifdef NET_DEBUG
- if (network_on)
- closedebugfile();
- #endif
- // Remove network (if appropriate)
- Quit_Network_Play();
- if (audio_version)
- {
- StopAudio();
- }
- end3d(); // Goodbye Laurent's crappy heap of runny donkey shit code...
- freex(replay_tab);
- #ifdef COVERDISK
- do{
- }while(keys[0x01]);
- display_endscr();
- #endif
- // Inform front end on times...
- if (end_game)
- {
- // Played Full Match!!!
- EUROmatch_info.return_mins=-1;
- }
- else
- {
- // Escaped from match!!!
- EUROmatch_info.return_mins=match_time.min;
- }
- if (audio_version)
- {
- FreeCommentarySamples();
- FreeTeamSamples(AWAY_TEAM);
- FreeTeamSamples(HOME_TEAM);
- FreePitchSamples();
- }
- // Give back front end enviroment stuff...
- reset_front();
- // Give Dos. keyboard chain!
- #ifdef MEG4
- release_key_int();
- #endif
- return_doskey=TRUE;
- return(FALSE); // No errors...
- /************ ERRORS *************/
- /*********/
- ERR_3D:;
- // Remove network (if appropriate)
- net_error=-1;
- Quit_Network_Play();
- match_err+=256;
- goto RETURN_ERR;
- /*********/
- RETURN_ERR:;
- return(match_err);
- }
|