ScriptEngine.cpp 404 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353
  1. /*
  2. ** Command & Conquer Generals Zero Hour(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. ////////////////////////////////////////////////////////////////////////////////
  19. // //
  20. // (c) 2001-2003 Electronic Arts Inc. //
  21. // //
  22. ////////////////////////////////////////////////////////////////////////////////
  23. // FILE: ScriptEngine.cpp /////////////////////////////////////////////////////////////////////////
  24. // The game scripting engine. Interprets scripts.
  25. // Author: John Ahlquist, Nov. 2001
  26. ///////////////////////////////////////////////////////////////////////////////////////////////////
  27. #include "PreRTS.h" // This must go first in EVERY cpp file int the GameEngine
  28. #include "common/DataChunk.h"
  29. #include "Common/File.h"
  30. #include "Common/FileSystem.h"
  31. #include "Common/GameEngine.h"
  32. #include "Common/GameState.h"
  33. #include "Common/LatchRestore.h"
  34. #include "Common/MessageStream.h"
  35. #include "Common/PerfTimer.h"
  36. #include "Common/Player.h"
  37. #include "Common/PlayerList.h"
  38. #include "Common/Team.h"
  39. #include "Common/ThingFactory.h"
  40. #include "Common/ThingTemplate.h"
  41. #include "Common/Xfer.h"
  42. #include "GameClient/MessageBox.h"
  43. #include "GameClient/Shell.h"
  44. #include "GameClient/View.h"
  45. #include "GameClient/CampaignManager.h"
  46. #include "GameLogic/GameLogic.h"
  47. #include "GameLogic/Module/AIUpdate.h"
  48. #include "GameLogic/ObjectTypes.h"
  49. #include "GameLogic/PartitionManager.h"
  50. #include "GameLogic/ScriptActions.h"
  51. #include "GameLogic/ScriptConditions.h"
  52. #include "GameLogic/ScriptEngine.h"
  53. #include "GameLogic/SidesList.h"
  54. #ifdef _INTERNAL
  55. // for occasional debugging...
  56. //#pragma optimize("", off)
  57. //#pragma MESSAGE("************************************** WARNING, optimization disabled for debugging purposes")
  58. #endif
  59. // These are for debugger window
  60. static int st_LastCurrentFrame;
  61. static int st_CurrentFrame;
  62. static Bool st_CanAppCont;
  63. static Bool st_AppIsFast = false;
  64. static void _appendMessage(const AsciiString& str, Bool isTrueMessage = true, Bool shouldPause = false);
  65. static void _adjustVariable(const AsciiString& str, Int value, Bool shouldPause = false);
  66. static void _updateFrameNumber( void );
  67. static HMODULE st_DebugDLL;
  68. // That's it for debugger window
  69. // These are for particle editor
  70. #define DEFINE_PARTICLE_SYSTEM_NAMES 1
  71. #include "GameClient/ParticleSys.h"
  72. #include "Common/MapObject.h"
  73. #include "../../GameEngineDevice/Include/W3DDevice/GameClient/W3DAssetManagerExposed.h"
  74. static void _addUpdatedParticleSystem( AsciiString particleSystemName );
  75. static void _appendAllParticleSystems( void );
  76. static void _appendAllThingTemplates( void );
  77. static int _getEditorBehavior( void );
  78. static int _getNewCurrentParticleCap( void );
  79. static AsciiString _getParticleSystemName( void );
  80. static void _reloadParticleSystemFromINI( AsciiString particleSystemName );
  81. static void _updateAndSetCurrentSystem( void );
  82. extern void _updateAsciiStringParmsFromSystem( ParticleSystemTemplate *particleTemplate );
  83. extern void _updateAsciiStringParmsToSystem( ParticleSystemTemplate *particleTemplate );
  84. static void _updateCurrentParticleCap( void );
  85. static void _updateCurrentParticleCount( void );
  86. static void _updatePanelParameters( ParticleSystemTemplate *particleTemplate );
  87. static void _writeOutINI( void );
  88. extern void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *particleTemplate );
  89. static void _reloadTextures( void );
  90. static HMODULE st_ParticleDLL;
  91. ParticleSystem *st_particleSystem;
  92. Bool st_particleSystemNeedsStopping = FALSE; ///< Set along with st_particleSystem if the particle system has infinite life
  93. #define ARBITRARY_BUFF_SIZE 128
  94. #define FORMAT_STRING "%.2f"
  95. #define FORMAT_STRING_LEADING_STRING "%s%.2f"
  96. // That's it for particle editor
  97. #if defined(_INTERNAL)
  98. #define DO_VTUNE_STUFF
  99. #endif
  100. #ifdef DO_VTUNE_STUFF
  101. //typedef __declspec(dllimport) void __cdecl (*VTProc)();
  102. typedef void (*VTProc)();
  103. static Bool st_EnableVTune = false;
  104. static HMODULE st_vTuneDLL = NULL;
  105. static VTProc VTPause = NULL;
  106. static VTProc VTResume = NULL;
  107. static void _initVTune( void );
  108. static void _updateVTune ( void );
  109. static void _cleanUpVTune( void );
  110. #endif
  111. enum { K_SCRIPTS_DATA_VERSION_1 = 1 };
  112. enum { MAX_SPIN_COUNT = 20 };
  113. #define NONE_STRING "<none>"
  114. static const Int FRAMES_TO_SHOW_WIN_LOSE_MESSAGE = 120;
  115. static const Int FRAMES_TO_FADE_IN_AT_START = 33;
  116. //------------------------------------------------------------------------------ Performance Timers
  117. //#include "Common/PerfMetrics.h"
  118. //#include "Common/PerfTimer.h"
  119. // GLOBALS ////////////////////////////////////////////////////////////////////////////////////////
  120. ScriptEngine *TheScriptEngine = NULL;
  121. /// Local classes
  122. /// AttackPriorityInfo class
  123. static const Int ATTACK_PRIORITY_DEFAULT = 1;
  124. //-------------------------------------------------------------------------------------------------
  125. /** Ctor */
  126. //-------------------------------------------------------------------------------------------------
  127. AttackPriorityInfo::AttackPriorityInfo() :m_defaultPriority(ATTACK_PRIORITY_DEFAULT), m_priorityMap(NULL)
  128. {
  129. m_name.clear();
  130. }
  131. //-------------------------------------------------------------------------------------------------
  132. /** dtor */
  133. //-------------------------------------------------------------------------------------------------
  134. AttackPriorityInfo::~AttackPriorityInfo()
  135. {
  136. if (m_priorityMap) delete m_priorityMap;
  137. m_priorityMap = NULL;
  138. }
  139. //-------------------------------------------------------------------------------------------------
  140. /** set a priority for a thing template. */
  141. //-------------------------------------------------------------------------------------------------
  142. void AttackPriorityInfo::setPriority(const ThingTemplate *tThing, Int priority)
  143. {
  144. if (tThing==NULL) return;
  145. if (m_priorityMap==NULL) {
  146. m_priorityMap = NEW AttackPriorityMap; // STL type, so impractical to use memorypool
  147. }
  148. tThing = (const ThingTemplate *)tThing->getFinalOverride();
  149. Int &thePriority = (*m_priorityMap)[tThing];
  150. thePriority = priority;
  151. }
  152. /** set a priority for a thing template. */
  153. //-------------------------------------------------------------------------------------------------
  154. Int AttackPriorityInfo::getPriority(const ThingTemplate *tThing) const
  155. {
  156. Int priority = m_defaultPriority;
  157. if (tThing==NULL) return priority;
  158. tThing = (const ThingTemplate *)tThing->getFinalOverride();
  159. if (m_priorityMap && !m_priorityMap->empty()) {
  160. AttackPriorityMap::const_iterator it = m_priorityMap->find(tThing);
  161. if (it != m_priorityMap->end())
  162. {
  163. priority = (*it).second;
  164. }
  165. }
  166. return priority;
  167. }
  168. #ifdef _DEBUG
  169. /** Dump the info. */
  170. //-------------------------------------------------------------------------------------------------
  171. void AttackPriorityInfo::dumpPriorityInfo(void)
  172. {
  173. #ifdef DEBUG_LOGGING
  174. DEBUG_LOG(("Attack priority '%s', default %d\n", m_name.str(), m_defaultPriority));
  175. if (m_priorityMap==NULL) return;
  176. for (AttackPriorityMap::const_iterator it = m_priorityMap->begin(); it != m_priorityMap->end(); ++it)
  177. {
  178. const ThingTemplate *tThing = (*it).first;
  179. Int priority = (*it).second;
  180. DEBUG_LOG((" Thing '%s' priority %d\n",tThing->getName().str(), priority));
  181. }
  182. #endif
  183. }
  184. #endif
  185. // ------------------------------------------------------------------------------------------------
  186. /** Reset to default state */
  187. // ------------------------------------------------------------------------------------------------
  188. void AttackPriorityInfo::reset( void )
  189. {
  190. // clear name just to be clean
  191. m_name.clear();
  192. // go back to default priority
  193. m_defaultPriority = ATTACK_PRIORITY_DEFAULT;
  194. // delete the priority map if present
  195. if( m_priorityMap )
  196. {
  197. delete m_priorityMap;
  198. m_priorityMap = NULL;
  199. } // end if
  200. } // end reset
  201. // ------------------------------------------------------------------------------------------------
  202. /** CRC */
  203. // ------------------------------------------------------------------------------------------------
  204. void AttackPriorityInfo::crc( Xfer *xfer )
  205. {
  206. } // end crc
  207. // ------------------------------------------------------------------------------------------------
  208. /** Xfer method
  209. * Version Info:
  210. * 1: Initial version */
  211. // ------------------------------------------------------------------------------------------------
  212. void AttackPriorityInfo::xfer( Xfer *xfer )
  213. {
  214. // version
  215. XferVersion currentVersion = 1;
  216. XferVersion version = currentVersion;
  217. xfer->xferVersion( &version, currentVersion );
  218. // name
  219. xfer->xferAsciiString( &m_name );
  220. xfer->xferInt( &m_defaultPriority );
  221. //
  222. // priority map count, note there is question to the following code that is
  223. // commented out in that we're not sure it returns the correct number of elements
  224. // in the map. To be safe, we're getting the count by manually counting the
  225. // elements ourselves as we iterate through them
  226. //
  227. // Please KEEP the below code here for reference
  228. // UnsignedShort priorityMapCount = m_priorityMap ? m_priorityMap->size() : 0;
  229. //
  230. UnsignedShort priorityMapCount = 0;
  231. if( m_priorityMap )
  232. {
  233. AttackPriorityMap::const_iterator it;
  234. for( it = m_priorityMap->begin(); it != m_priorityMap->end(); ++it )
  235. ++priorityMapCount;
  236. } // end if
  237. xfer->xferUnsignedShort( &priorityMapCount );
  238. // priority map
  239. AsciiString thingTemplateName;
  240. const ThingTemplate *thingTemplate;
  241. Int priority;
  242. if( xfer->getXferMode() == XFER_SAVE )
  243. {
  244. if( m_priorityMap )
  245. {
  246. // iterate all the entries
  247. AttackPriorityMap::const_iterator it;
  248. UnsignedShort count = 0;
  249. for( it = m_priorityMap->begin(); it != m_priorityMap->end(); ++it )
  250. {
  251. // keep a count for sanity
  252. ++count;
  253. // write thing template name
  254. thingTemplate = (*it).first;
  255. thingTemplateName = thingTemplate->getName();
  256. DEBUG_ASSERTCRASH( thingTemplateName.isEmpty() == FALSE,
  257. ("AttackPriorityInfo::xfer - Writing an empty thing template name\n") );
  258. xfer->xferAsciiString( &thingTemplateName );
  259. // write priority
  260. priority = (*it).second;
  261. xfer->xferInt( &priority );
  262. } // end for i
  263. // sanity
  264. DEBUG_ASSERTCRASH( count == priorityMapCount,
  265. ("AttackPriorityInfo::xfer - Mismatch in priority map size. Size() method returned '%d' but actual iteration count was '%d'\n",
  266. priorityMapCount, count) );
  267. } // end if
  268. } // end if, save
  269. else
  270. {
  271. // read all entries
  272. for( UnsignedShort i = 0; i < priorityMapCount; ++i )
  273. {
  274. // read thing template name, and get template
  275. xfer->xferAsciiString( &thingTemplateName );
  276. thingTemplate = TheThingFactory->findTemplate( thingTemplateName );
  277. if( thingTemplate == NULL )
  278. {
  279. DEBUG_CRASH(( "AttackPriorityInfo::xfer - Unable to find thing template '%s'\n",
  280. thingTemplateName.str() ));
  281. throw SC_INVALID_DATA;
  282. } // end if
  283. // read priority
  284. xfer->xferInt( &priority );
  285. // set priority (this will allocate the map on the first call as well)
  286. setPriority( thingTemplate, priority );
  287. } // end for
  288. } // end else, load
  289. } // end xfer
  290. // ------------------------------------------------------------------------------------------------
  291. /** Load post process */
  292. // ------------------------------------------------------------------------------------------------
  293. void AttackPriorityInfo::loadPostProcess( void )
  294. {
  295. } // end loadPostProcess
  296. // ScriptEngine class
  297. static const FieldParse TheTemplateFieldParseTable[] =
  298. {
  299. { "InternalName", INI::parseAsciiString,NULL, offsetof( Template, m_internalName ) },
  300. { "UIName", INI::parseAsciiString,NULL, offsetof( Template, m_uiName ) },
  301. { "UIName2", INI::parseAsciiString,NULL, offsetof( Template, m_uiName2 ) },
  302. { "HelpText", INI::parseAsciiString,NULL, offsetof( Template, m_helpText ) },
  303. { NULL, NULL, NULL, 0 } // keep this last
  304. };
  305. //-------------------------------------------------------------------------------------------------
  306. /** Parse script action entry. The InternalName has to match the action's internal name, and then it
  307. overrides the ui name and help text. If no entry is present in the ini file, the default code
  308. initialized value in ScriptEngine::init() is used. jba*/
  309. //-------------------------------------------------------------------------------------------------
  310. void ScriptEngine::parseScriptAction( INI* ini )
  311. {
  312. // parse the ini weapon definition
  313. ActionTemplate scriptTemplate;
  314. ini->initFromINI( &scriptTemplate, TheTemplateFieldParseTable );
  315. if (TheScriptEngine) {
  316. TheScriptEngine->addActionTemplateInfo(&scriptTemplate);
  317. }
  318. }
  319. //-------------------------------------------------------------------------------------------------
  320. /** Update the info from a script action's .ini entry. The InternalName has to match the action's
  321. internal name, and then it
  322. overrides the ui name and help text. If no entry is present in the ini file, the default code
  323. initialized value in ScriptEngine::init() is used. jba*/
  324. //-------------------------------------------------------------------------------------------------
  325. void ScriptEngine::addActionTemplateInfo( Template *actionTemplate)
  326. {
  327. Int i;
  328. for (i=0; i<ScriptAction::NUM_ITEMS; i++) {
  329. if (m_actionTemplates[i].m_internalName == actionTemplate->m_internalName) {
  330. m_actionTemplates[i].m_uiName = actionTemplate->m_uiName;
  331. m_actionTemplates[i].m_uiName2 = actionTemplate->m_uiName2;
  332. m_actionTemplates[i].m_helpText = actionTemplate->m_helpText;
  333. return;
  334. }
  335. }
  336. DEBUG_LOG(("Couldn't find script action named %s\n", actionTemplate->m_internalName.str()));
  337. }
  338. //-------------------------------------------------------------------------------------------------
  339. /** Parse script condition entry. The InternalName has to match the condition's internal name, and then it
  340. overrides the ui name and help text. If no entry is present in the ini file, the default code
  341. initialized value in ScriptEngine::init() is used. jba*/
  342. //-------------------------------------------------------------------------------------------------
  343. void ScriptEngine::parseScriptCondition( INI* ini )
  344. {
  345. // parse the ini weapon definition
  346. ActionTemplate scriptTemplate;
  347. ini->initFromINI( &scriptTemplate, TheTemplateFieldParseTable );
  348. if (TheScriptEngine) {
  349. TheScriptEngine->addConditionTemplateInfo(&scriptTemplate);
  350. }
  351. }
  352. //-------------------------------------------------------------------------------------------------
  353. /** Update the info from a script action's .ini entry. The InternalName has to match the action's
  354. internal name, and then it
  355. overrides the ui name and help text. If no entry is present in the ini file, the default code
  356. initialized value in ScriptEngine::init() is used. jba*/
  357. //-------------------------------------------------------------------------------------------------
  358. void ScriptEngine::addConditionTemplateInfo( Template *actionTemplate)
  359. {
  360. Int i;
  361. for (i=0; i<Condition::NUM_ITEMS; i++) {
  362. if (m_conditionTemplates[i].m_internalName == actionTemplate->m_internalName) {
  363. m_conditionTemplates[i].m_uiName = actionTemplate->m_uiName;
  364. m_conditionTemplates[i].m_uiName2 = actionTemplate->m_uiName2;
  365. m_conditionTemplates[i].m_helpText = actionTemplate->m_helpText;
  366. return;
  367. }
  368. }
  369. DEBUG_LOG(("Couldn't find script condition named %s", actionTemplate->m_internalName.str()));
  370. }
  371. //-------------------------------------------------------------------------------------------------
  372. //-------------------------------------------------------------------------------------------------
  373. ScriptEngine::ScriptEngine():
  374. m_numCounters(0),
  375. m_numFlags(0),
  376. m_callingTeam(NULL),
  377. m_callingObject(NULL),
  378. m_conditionTeam(NULL),
  379. m_conditionObject(NULL),
  380. m_currentPlayer(NULL),
  381. m_skirmishHumanPlayer(NULL),
  382. m_fade(FADE_NONE),
  383. m_freezeByScript(FALSE),
  384. m_frameObjectCountChanged(0),
  385. //Added By Sadullah Nader
  386. //Initializations inserted
  387. m_closeWindowTimer(0),
  388. m_curFadeFrame(0),
  389. m_curFadeValue(0.0f),
  390. m_endGameTimer(0),
  391. m_fadeFramesDecrease(0),
  392. m_fadeFramesHold(0),
  393. m_fadeFramesIncrease(0),
  394. m_firstUpdate(TRUE),
  395. m_maxFade(0.0f),
  396. m_minFade(0.0f),
  397. m_numAttackInfo(0),
  398. m_shownMPLocalDefeatWindow(FALSE),
  399. m_objectsShouldReceiveDifficultyBonus(TRUE),
  400. m_ChooseVictimAlwaysUsesNormal(false)
  401. //
  402. {
  403. st_CanAppCont = true;
  404. st_LastCurrentFrame = st_CurrentFrame = 0;
  405. // By default, difficulty should be normal.
  406. setGlobalDifficulty(DIFFICULTY_NORMAL);
  407. } // end ScriptEngine
  408. //-------------------------------------------------------------------------------------------------
  409. //-------------------------------------------------------------------------------------------------
  410. ScriptEngine::~ScriptEngine()
  411. {
  412. if (st_DebugDLL) {
  413. FARPROC proc = GetProcAddress(st_DebugDLL, "DestroyDebugDialog");
  414. if (proc) {
  415. proc();
  416. }
  417. FreeLibrary(st_DebugDLL);
  418. st_DebugDLL = NULL;
  419. }
  420. if (st_ParticleDLL) {
  421. FARPROC proc = GetProcAddress(st_ParticleDLL, "DestroyParticleSystemDialog");
  422. if (proc) {
  423. proc();
  424. }
  425. FreeLibrary(st_ParticleDLL);
  426. st_ParticleDLL = NULL;
  427. }
  428. #ifdef DO_VTUNE_STUFF
  429. _cleanUpVTune();
  430. #endif
  431. reset(); // just in case.
  432. #ifdef COUNT_SCRIPT_USAGE
  433. Int i;
  434. for (i=0; i<ScriptAction::NUM_ITEMS; i++) {
  435. DEBUG_LOG(("ScriptAction%d, %4d, %s, %s, %s\n", i, m_actionTemplates[i].m_numTimesUsed,
  436. m_actionTemplates[i].m_internalName.str(), m_actionTemplates[i].m_firstMapUsed.str(),
  437. m_actionTemplates[i].m_uiName.str()));
  438. }
  439. for (i=0; i<Condition::NUM_ITEMS; i++) {
  440. DEBUG_LOG(("ScriptCondition%d, %4d, %s, %s, %s\n", i, m_conditionTemplates[i].m_numTimesUsed,
  441. m_conditionTemplates[i].m_internalName.str(), m_conditionTemplates[i].m_firstMapUsed.str(),
  442. m_conditionTemplates[i].m_uiName.str()));
  443. }
  444. #endif
  445. } // end ~ScriptEngine
  446. //-------------------------------------------------------------------------------------------------
  447. /** Init */
  448. //-------------------------------------------------------------------------------------------------
  449. void ScriptEngine::init( void )
  450. {
  451. if (TheGlobalData->m_windowed)
  452. if (TheGlobalData->m_scriptDebug) {
  453. st_DebugDLL = LoadLibrary("DebugWindow.dll");
  454. } else {
  455. st_DebugDLL = NULL;
  456. }
  457. if (TheGlobalData->m_particleEdit) {
  458. st_ParticleDLL = LoadLibrary("ParticleEditor.dll");
  459. } else {
  460. st_ParticleDLL = NULL;
  461. }
  462. if (st_DebugDLL) {
  463. FARPROC proc = GetProcAddress(st_DebugDLL, "CreateDebugDialog");
  464. if (proc) {
  465. proc();
  466. }
  467. }
  468. if (st_ParticleDLL) {
  469. FARPROC proc = GetProcAddress(st_ParticleDLL, "CreateParticleSystemDialog");
  470. if (proc) {
  471. proc();
  472. }
  473. }
  474. #ifdef DO_VTUNE_STUFF
  475. _initVTune();
  476. #endif
  477. #ifdef SPECIAL_SCRIPT_PROFILING
  478. #ifdef DEBUG_LOGGING
  479. m_numFrames=0;
  480. m_totalUpdateTime=0;
  481. m_maxUpdateTime=0;
  482. #endif
  483. #endif
  484. if (TheScriptActions) {
  485. TheScriptActions->init();
  486. }
  487. if (TheScriptConditions) {
  488. TheScriptConditions->init();
  489. }
  490. /* Recipe for adding an action:
  491. 1. In Scripts.h, add an enum element to enum ScriptActionType just before NUM_ITEMS.
  492. 2. Go to the end of this section of templates, and create a template.
  493. 3. Go to ScriptActions.h and add a protected method.
  494. 4. Go to ScriptActions.cpp, and add your enum to the
  495. switch in ScriptActions::executeAction to call your method in 3 above.
  496. */
  497. // Set up the script action templates.
  498. Template *curTemplate = &m_actionTemplates[ScriptAction::DEBUG_MESSAGE_BOX];
  499. curTemplate->m_internalName = "DEBUG_MESSAGE_BOX";
  500. curTemplate->m_uiName = "Scripting_/Debug/Display message and pause";
  501. curTemplate->m_numParameters = 1;
  502. curTemplate->m_parameters[0] = Parameter::TEXT_STRING;
  503. curTemplate->m_numUiStrings = 1;
  504. curTemplate->m_uiStrings[0] = "Show debug string and pause: ";
  505. curTemplate = &m_actionTemplates[ScriptAction::DEBUG_STRING];
  506. curTemplate->m_internalName = "DEBUG_STRING";
  507. curTemplate->m_uiName = "Scripting_/Debug/Display string";
  508. curTemplate->m_numParameters = 1;
  509. curTemplate->m_parameters[0] = Parameter::TEXT_STRING;
  510. curTemplate->m_numUiStrings = 1;
  511. curTemplate->m_uiStrings[0] = "Show debug string without pausing: ";
  512. curTemplate = &m_actionTemplates[ScriptAction::DEBUG_CRASH_BOX];
  513. curTemplate->m_internalName = "DEBUG_CRASH_BOX";
  514. curTemplate->m_uiName = "{INTERNAL}_/Debug/Display a crash box (debug/internal builds only).";
  515. curTemplate->m_numParameters = 1;
  516. curTemplate->m_parameters[0] = Parameter::TEXT_STRING;
  517. curTemplate->m_numUiStrings = 1;
  518. curTemplate->m_uiStrings[0] = "Display a crash box with the text: ";
  519. curTemplate = &m_actionTemplates[ScriptAction::SET_FLAG];
  520. curTemplate->m_internalName = "SET_FLAG";
  521. curTemplate->m_uiName = "Scripting_/Flags/Set flag to value";
  522. curTemplate->m_numParameters = 2;
  523. curTemplate->m_parameters[0] = Parameter::FLAG;
  524. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  525. curTemplate->m_numUiStrings = 2;
  526. curTemplate->m_uiStrings[0] = "Set ";
  527. curTemplate->m_uiStrings[1] = " to ";
  528. curTemplate = &m_actionTemplates[ScriptAction::SET_COUNTER];
  529. curTemplate->m_internalName = "SET_COUNTER";
  530. curTemplate->m_uiName = "Scripting_/Counters/Set counter to a value";
  531. curTemplate->m_numParameters = 2;
  532. curTemplate->m_parameters[0] = Parameter::COUNTER;
  533. curTemplate->m_parameters[1] = Parameter::INT;
  534. curTemplate->m_numUiStrings = 2;
  535. curTemplate->m_uiStrings[0] = "Set ";
  536. curTemplate->m_uiStrings[1] = " to ";
  537. curTemplate = &m_actionTemplates[ScriptAction::SET_TREE_SWAY];
  538. curTemplate->m_internalName = "SET_TREE_SWAY";
  539. curTemplate->m_uiName = "Map_/Environment/Set wind sway amount and direction.";
  540. curTemplate->m_numParameters = 5;
  541. curTemplate->m_parameters[0] = Parameter::ANGLE;
  542. curTemplate->m_parameters[1] = Parameter::ANGLE;
  543. curTemplate->m_parameters[2] = Parameter::ANGLE;
  544. curTemplate->m_parameters[3] = Parameter::INT;
  545. curTemplate->m_parameters[4] = Parameter::REAL;
  546. curTemplate->m_numUiStrings = 6;
  547. curTemplate->m_uiStrings[0] = "Set wind direction to ";
  548. curTemplate->m_uiStrings[1] = ", amount to sway ";
  549. curTemplate->m_uiStrings[2] = ", amount to lean with the wind ";
  550. curTemplate->m_uiStrings[3] = ", frames to take to sway once ";
  551. curTemplate->m_uiStrings[4] = ", randomness ";
  552. curTemplate->m_uiStrings[5] = "(0=lock step, 1=large random variation).";
  553. curTemplate = &m_actionTemplates[ScriptAction::SET_INFANTRY_LIGHTING_OVERRIDE];
  554. curTemplate->m_internalName = "SET_INFANTRY_LIGHTING_OVERRIDE";
  555. curTemplate->m_uiName = "Map_/Environment/Infantry Lighting - Set.";
  556. curTemplate->m_numParameters = 1;
  557. curTemplate->m_parameters[0] = Parameter::REAL;
  558. curTemplate->m_numUiStrings = 2;
  559. curTemplate->m_uiStrings[0] = "Set lighting percent on infantry to ";
  560. curTemplate->m_uiStrings[1] = " (0.0==min, 1.0==normal day, 2.0==max (which is normal night).)";
  561. curTemplate = &m_actionTemplates[ScriptAction::RESET_INFANTRY_LIGHTING_OVERRIDE];
  562. curTemplate->m_internalName = "RESET_INFANTRY_LIGHTING_OVERRIDE";
  563. curTemplate->m_uiName = "Map_/Environment/Infantry Lighting - Reset.";
  564. curTemplate->m_numParameters = 0;
  565. curTemplate->m_numUiStrings = 1;
  566. curTemplate->m_uiStrings[0] = "Reset infantry lighting to the normal setting. 1.0 for the two day states, 2.0 for the two night states. (Look in GamesData.ini)";
  567. curTemplate = &m_actionTemplates[ScriptAction::QUICKVICTORY];
  568. curTemplate->m_internalName = "QUICKVICTORY";
  569. curTemplate->m_uiName = "User_/ Announce quick win";
  570. curTemplate->m_numParameters = 0;
  571. curTemplate->m_numUiStrings = 1;
  572. curTemplate->m_uiStrings[0] = "End game in victory immediately.";
  573. curTemplate = &m_actionTemplates[ScriptAction::VICTORY];
  574. curTemplate->m_internalName = "VICTORY";
  575. curTemplate->m_uiName = "User_/ Announce win";
  576. curTemplate->m_numParameters = 0;
  577. curTemplate->m_numUiStrings = 1;
  578. curTemplate->m_uiStrings[0] = "Announce win.";
  579. curTemplate = &m_actionTemplates[ScriptAction::DEFEAT];
  580. curTemplate->m_internalName = "DEFEAT";
  581. curTemplate->m_uiName = "User_/ Announce lose";
  582. curTemplate->m_numParameters = 0;
  583. curTemplate->m_numUiStrings = 1;
  584. curTemplate->m_uiStrings[0] = "Announce lose.";
  585. curTemplate = &m_actionTemplates[ScriptAction::NO_OP];
  586. curTemplate->m_internalName = "NO_OP";
  587. curTemplate->m_uiName = "Scripting_/Debug/Null operation.";
  588. curTemplate->m_numParameters = 0;
  589. curTemplate->m_numUiStrings = 1;
  590. curTemplate->m_uiStrings[0] = "Null operation. (Does nothing.)";
  591. curTemplate = &m_actionTemplates[ScriptAction::SET_TIMER];
  592. curTemplate->m_internalName = "SET_TIMER";
  593. curTemplate->m_uiName = "Scripting_/Timer/Frame countdown timer -- set.";
  594. curTemplate->m_numParameters = 2;
  595. curTemplate->m_parameters[0] = Parameter::COUNTER;
  596. curTemplate->m_parameters[1] = Parameter::INT;
  597. curTemplate->m_numUiStrings = 3;
  598. curTemplate->m_uiStrings[0] = "Set timer ";
  599. curTemplate->m_uiStrings[1] = " to expire in ";
  600. curTemplate->m_uiStrings[2] = " frames.";
  601. curTemplate = &m_actionTemplates[ScriptAction::SET_RANDOM_TIMER];
  602. curTemplate->m_internalName = "SET_RANDOM_TIMER";
  603. curTemplate->m_uiName = "Scripting_/Timer/Frame countdown timer -- set random.";
  604. curTemplate->m_numParameters = 3;
  605. curTemplate->m_parameters[0] = Parameter::COUNTER;
  606. curTemplate->m_parameters[1] = Parameter::INT;
  607. curTemplate->m_parameters[2] = Parameter::INT;
  608. curTemplate->m_numUiStrings = 4;
  609. curTemplate->m_uiStrings[0] = "Set timer ";
  610. curTemplate->m_uiStrings[1] = " to expire between ";
  611. curTemplate->m_uiStrings[2] = " and ";
  612. curTemplate->m_uiStrings[3] = " frames.";
  613. curTemplate = &m_actionTemplates[ScriptAction::STOP_TIMER];
  614. curTemplate->m_internalName = "STOP_TIMER";
  615. curTemplate->m_uiName = "Scripting_/Timer/Timer -- stop.";
  616. curTemplate->m_numParameters = 1;
  617. curTemplate->m_parameters[0] = Parameter::COUNTER;
  618. curTemplate->m_numUiStrings = 1;
  619. curTemplate->m_uiStrings[0] = "Stop timer ";
  620. curTemplate = &m_actionTemplates[ScriptAction::RESTART_TIMER];
  621. curTemplate->m_internalName = "RESTART_TIMER";
  622. curTemplate->m_uiName = "Scripting_/Timer/Timer -- restart stopped.";
  623. curTemplate->m_numParameters = 1;
  624. curTemplate->m_parameters[0] = Parameter::COUNTER;
  625. curTemplate->m_numUiStrings = 1;
  626. curTemplate->m_uiStrings[0] = "Restart timer ";
  627. curTemplate = &m_actionTemplates[ScriptAction::PLAY_SOUND_EFFECT];
  628. curTemplate->m_internalName = "PLAY_SOUND_EFFECT";
  629. curTemplate->m_uiName = "Multimedia_/Sound Effect/Play sound effect.";
  630. curTemplate->m_numParameters = 1;
  631. curTemplate->m_parameters[0] = Parameter::SOUND;
  632. curTemplate->m_numUiStrings = 2;
  633. curTemplate->m_uiStrings[0] = "Play ";
  634. curTemplate->m_uiStrings[1] = ".";
  635. curTemplate = &m_actionTemplates[ScriptAction::ENABLE_SCRIPT];
  636. curTemplate->m_internalName = "ENABLE_SCRIPT";
  637. curTemplate->m_uiName = "Scripting_/Script/Enable Script.";
  638. curTemplate->m_numParameters = 1;
  639. curTemplate->m_parameters[0] = Parameter::SCRIPT;
  640. curTemplate->m_numUiStrings = 2;
  641. curTemplate->m_uiStrings[0] = "Enable ";
  642. curTemplate->m_uiStrings[1] = ".";
  643. curTemplate = &m_actionTemplates[ScriptAction::DISABLE_SCRIPT];
  644. curTemplate->m_internalName = "DISABLE_SCRIPT";
  645. curTemplate->m_uiName = "Scripting_/Script/Disable script.";
  646. curTemplate->m_numParameters = 1;
  647. curTemplate->m_parameters[0] = Parameter::SCRIPT;
  648. curTemplate->m_numUiStrings = 2;
  649. curTemplate->m_uiStrings[0] = "Disable ";
  650. curTemplate->m_uiStrings[1] = ".";
  651. curTemplate = &m_actionTemplates[ScriptAction::CALL_SUBROUTINE];
  652. curTemplate->m_internalName = "CALL_SUBROUTINE";
  653. curTemplate->m_uiName = "Scripting_/Script/Run subroutine script.";
  654. curTemplate->m_numParameters = 1;
  655. curTemplate->m_parameters[0] = Parameter::SCRIPT_SUBROUTINE;
  656. curTemplate->m_numUiStrings = 2;
  657. curTemplate->m_uiStrings[0] = "Run ";
  658. curTemplate->m_uiStrings[1] = ".";
  659. curTemplate = &m_actionTemplates[ScriptAction::PLAY_SOUND_EFFECT_AT];
  660. curTemplate->m_internalName = "PLAY_SOUND_EFFECT_AT";
  661. curTemplate->m_uiName = "Multimedia_/Sound Effect/Play sound effect at waypoint.";
  662. curTemplate->m_numParameters = 2;
  663. curTemplate->m_parameters[0] = Parameter::SOUND;
  664. curTemplate->m_parameters[1] = Parameter::WAYPOINT;
  665. curTemplate->m_numUiStrings = 3;
  666. curTemplate->m_uiStrings[0] = "Play ";
  667. curTemplate->m_uiStrings[1] = " at ";
  668. curTemplate->m_uiStrings[2] = ".";
  669. curTemplate = &m_actionTemplates[ScriptAction::DAMAGE_MEMBERS_OF_TEAM];
  670. curTemplate->m_internalName = "DAMAGE_MEMBERS_OF_TEAM";
  671. curTemplate->m_uiName = "Team_/Damage/Damage the members of a team.";
  672. curTemplate->m_numParameters = 2;
  673. curTemplate->m_parameters[0] = Parameter::TEAM;
  674. curTemplate->m_parameters[1] = Parameter::REAL;
  675. curTemplate->m_numUiStrings = 3;
  676. curTemplate->m_uiStrings[0] = "Damage ";
  677. curTemplate->m_uiStrings[1] = ", amount=";
  678. curTemplate->m_uiStrings[2] = " (-1==kill).";
  679. curTemplate = &m_actionTemplates[ScriptAction::MOVE_TEAM_TO];
  680. curTemplate->m_internalName = "MOVE_TEAM_TO";
  681. curTemplate->m_uiName = "Team_/Move/Set to move to a location.";
  682. curTemplate->m_numParameters = 2;
  683. curTemplate->m_parameters[0] = Parameter::TEAM;
  684. curTemplate->m_parameters[1] = Parameter::WAYPOINT;
  685. curTemplate->m_numUiStrings = 3;
  686. curTemplate->m_uiStrings[0] = "Move ";
  687. curTemplate->m_uiStrings[1] = " to ";
  688. curTemplate->m_uiStrings[2] = ".";
  689. curTemplate = &m_actionTemplates[ScriptAction::TEAM_FOLLOW_WAYPOINTS];
  690. curTemplate->m_internalName = "TEAM_FOLLOW_WAYPOINTS";
  691. curTemplate->m_uiName = "Team_/Move/Set to follow a waypoint path.";
  692. curTemplate->m_numParameters = 3;
  693. curTemplate->m_parameters[0] = Parameter::TEAM;
  694. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  695. curTemplate->m_parameters[2] = Parameter::BOOLEAN;
  696. curTemplate->m_numUiStrings = 3;
  697. curTemplate->m_uiStrings[0] = "Have ";
  698. curTemplate->m_uiStrings[1] = " follow ";
  699. curTemplate->m_uiStrings[2] = " , as a team is ";
  700. curTemplate = &m_actionTemplates[ScriptAction::TEAM_FOLLOW_WAYPOINTS_EXACT];
  701. curTemplate->m_internalName = "TEAM_FOLLOW_WAYPOINTS_EXACT";
  702. curTemplate->m_uiName = "Team_/Move/Set to EXACTLY follow a waypoint path.";
  703. curTemplate->m_numParameters = 3;
  704. curTemplate->m_parameters[0] = Parameter::TEAM;
  705. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  706. curTemplate->m_parameters[2] = Parameter::BOOLEAN;
  707. curTemplate->m_numUiStrings = 3;
  708. curTemplate->m_uiStrings[0] = "Have ";
  709. curTemplate->m_uiStrings[1] = " EXACTLY follow ";
  710. curTemplate->m_uiStrings[2] = " , as a team is ";
  711. curTemplate = &m_actionTemplates[ScriptAction::TEAM_WANDER_IN_PLACE];
  712. curTemplate->m_internalName = "TEAM_WANDER_IN_PLACE";
  713. curTemplate->m_uiName = "Team_/Move/Set to wander around current location.";
  714. curTemplate->m_numParameters = 1;
  715. curTemplate->m_parameters[0] = Parameter::TEAM;
  716. curTemplate->m_numUiStrings = 2;
  717. curTemplate->m_uiStrings[0] = "Have ";
  718. curTemplate->m_uiStrings[1] = " wander around it's current location.";
  719. curTemplate = &m_actionTemplates[ScriptAction::TEAM_INCREASE_PRIORITY];
  720. curTemplate->m_internalName = "TEAM_INCREASE_PRIORITY";
  721. curTemplate->m_uiName = "Team_/AI/Increase priority by Success Priority Increase amount.";
  722. curTemplate->m_numParameters = 1;
  723. curTemplate->m_parameters[0] = Parameter::TEAM;
  724. curTemplate->m_numUiStrings = 2;
  725. curTemplate->m_uiStrings[0] = "Increase the AI priority for";
  726. curTemplate->m_uiStrings[1] = " by its Success Priority Increase amount.";
  727. curTemplate = &m_actionTemplates[ScriptAction::TEAM_DECREASE_PRIORITY];
  728. curTemplate->m_internalName = "TEAM_DECREASE_PRIORITY";
  729. curTemplate->m_uiName = "Team_/AI/Reduce priority by Failure Priority Decrease amount.";
  730. curTemplate->m_numParameters = 1;
  731. curTemplate->m_parameters[0] = Parameter::TEAM;
  732. curTemplate->m_numUiStrings = 2;
  733. curTemplate->m_uiStrings[0] = "Reduce the AI priority for";
  734. curTemplate->m_uiStrings[1] = " by its Failure Priority Decrease amount.";
  735. curTemplate = &m_actionTemplates[ScriptAction::TEAM_WANDER];
  736. curTemplate->m_internalName = "TEAM_WANDER";
  737. curTemplate->m_uiName = "Team_/Move/Set to follow a waypoint path -- wander.";
  738. curTemplate->m_numParameters = 2;
  739. curTemplate->m_parameters[0] = Parameter::TEAM;
  740. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  741. curTemplate->m_numUiStrings = 2;
  742. curTemplate->m_uiStrings[0] = "Have ";
  743. curTemplate->m_uiStrings[1] = " wander along ";
  744. curTemplate = &m_actionTemplates[ScriptAction::TEAM_PANIC];
  745. curTemplate->m_internalName = "TEAM_PANIC";
  746. curTemplate->m_uiName = "Team_/Move/Set to follow a waypoint path -- panic.";
  747. curTemplate->m_numParameters = 2;
  748. curTemplate->m_parameters[0] = Parameter::TEAM;
  749. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  750. curTemplate->m_numUiStrings = 2;
  751. curTemplate->m_uiStrings[0] = "Have ";
  752. curTemplate->m_uiStrings[1] = " move in panic along ";
  753. curTemplate = &m_actionTemplates[ScriptAction::MOVE_NAMED_UNIT_TO];
  754. curTemplate->m_internalName = "MOVE_NAMED_UNIT_TO";
  755. curTemplate->m_uiName = "Unit_/Move/Move a specific unit to a location.";
  756. curTemplate->m_numParameters = 2;
  757. curTemplate->m_parameters[0] = Parameter::UNIT;
  758. curTemplate->m_parameters[1] = Parameter::WAYPOINT;
  759. curTemplate->m_numUiStrings = 3;
  760. curTemplate->m_uiStrings[0] = "Move ";
  761. curTemplate->m_uiStrings[1] = " to ";
  762. curTemplate->m_uiStrings[2] = ".";
  763. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_STATE];
  764. curTemplate->m_internalName = "TEAM_SET_STATE";
  765. curTemplate->m_uiName = "Team_/Misc/Team custom state - set state.";
  766. curTemplate->m_numParameters = 2;
  767. curTemplate->m_parameters[0] = Parameter::TEAM;
  768. curTemplate->m_parameters[1] = Parameter::TEAM_STATE;
  769. curTemplate->m_numUiStrings = 3;
  770. curTemplate->m_uiStrings[0] = "Set ";
  771. curTemplate->m_uiStrings[1] = " to ";
  772. curTemplate->m_uiStrings[2] = ".";
  773. curTemplate = &m_actionTemplates[ScriptAction::CREATE_REINFORCEMENT_TEAM];
  774. curTemplate->m_internalName = "CREATE_REINFORCEMENT_TEAM";
  775. curTemplate->m_uiName = "Team_/ Spawn a reinforcement team.";
  776. curTemplate->m_numParameters = 2;
  777. curTemplate->m_parameters[0] = Parameter::TEAM;
  778. curTemplate->m_parameters[1] = Parameter::WAYPOINT;
  779. curTemplate->m_numUiStrings = 3;
  780. curTemplate->m_uiStrings[0] = "Spawn an instance of ";
  781. curTemplate->m_uiStrings[1] = " at ";
  782. curTemplate->m_uiStrings[2] = ".";
  783. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_BUILD_BUILDING];
  784. curTemplate->m_internalName = "SKIRMISH_BUILD_BUILDING";
  785. curTemplate->m_uiName = "Skirmish Only_/ Build a building.";
  786. curTemplate->m_numParameters = 1;
  787. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  788. curTemplate->m_numUiStrings = 1;
  789. curTemplate->m_uiStrings[0] = "Build a building of type ";
  790. curTemplate->m_uiStrings[1] = ".";
  791. curTemplate = &m_actionTemplates[ScriptAction::AI_PLAYER_BUILD_SUPPLY_CENTER];
  792. curTemplate->m_internalName = "AI_PLAYER_BUILD_SUPPLY_CENTER";
  793. curTemplate->m_uiName = "Player_/AI/AI player build near a supply source.";
  794. curTemplate->m_numParameters = 3;
  795. curTemplate->m_parameters[0] = Parameter::SIDE;
  796. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  797. curTemplate->m_parameters[2] = Parameter::INT;
  798. curTemplate->m_numUiStrings = 4;
  799. curTemplate->m_uiStrings[0] = "Have AI ";
  800. curTemplate->m_uiStrings[1] = " build a ";
  801. curTemplate->m_uiStrings[2] = " near a supply src with at least ";
  802. curTemplate->m_uiStrings[3] = " available resources.";
  803. curTemplate = &m_actionTemplates[ScriptAction::AI_PLAYER_BUILD_TYPE_NEAREST_TEAM];
  804. curTemplate->m_internalName = "AI_PLAYER_BUILD_TYPE_NEAREST_TEAM";
  805. curTemplate->m_uiName = "Player_/AI/AI player build nearest specified team.";
  806. curTemplate->m_numParameters = 3;
  807. curTemplate->m_parameters[0] = Parameter::SIDE;
  808. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  809. curTemplate->m_parameters[2] = Parameter::TEAM;
  810. curTemplate->m_numUiStrings = 4;
  811. curTemplate->m_uiStrings[0] = "Have AI ";
  812. curTemplate->m_uiStrings[1] = " build a ";
  813. curTemplate->m_uiStrings[2] = " nearest team ";
  814. curTemplate->m_uiStrings[3] = ".";
  815. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GUARD_SUPPLY_CENTER];
  816. curTemplate->m_internalName = "TEAM_GUARD_SUPPLY_CENTER";
  817. curTemplate->m_uiName = "Team_/Guard/Set to guard a supply source.";
  818. curTemplate->m_numParameters = 2;
  819. curTemplate->m_parameters[0] = Parameter::TEAM;
  820. curTemplate->m_parameters[1] = Parameter::INT;
  821. curTemplate->m_numUiStrings = 3;
  822. curTemplate->m_uiStrings[0] = "Have Team ";
  823. curTemplate->m_uiStrings[1] = " guard attacked or closest supply src with at least ";
  824. curTemplate->m_uiStrings[2] = " available resources";
  825. curTemplate = &m_actionTemplates[ScriptAction::AI_PLAYER_BUILD_UPGRADE];
  826. curTemplate->m_internalName = "AI_PLAYER_BUILD_UPGRADE";
  827. curTemplate->m_uiName = "Player_/AI/AI player build an upgrade.";
  828. curTemplate->m_numParameters = 2;
  829. curTemplate->m_parameters[0] = Parameter::SIDE;
  830. curTemplate->m_parameters[1] = Parameter::UPGRADE;
  831. curTemplate->m_numUiStrings = 2;
  832. curTemplate->m_uiStrings[0] = "Have AI ";
  833. curTemplate->m_uiStrings[1] = " build this upgrade: ";
  834. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_FOLLOW_APPROACH_PATH ];
  835. curTemplate->m_internalName = "SKIRMISH_FOLLOW_APPROACH_PATH";
  836. curTemplate->m_uiName = "Skirmish Only_/Move/Team follow approach path.";
  837. curTemplate->m_numParameters = 3;
  838. curTemplate->m_parameters[0] = Parameter::TEAM;
  839. curTemplate->m_parameters[1] = Parameter::SKIRMISH_WAYPOINT_PATH;
  840. curTemplate->m_parameters[2] = Parameter::BOOLEAN;
  841. curTemplate->m_numUiStrings = 3;
  842. curTemplate->m_uiStrings[0] = "Have ";
  843. curTemplate->m_uiStrings[1] = " approach the enemy using path ";
  844. curTemplate->m_uiStrings[2] = ", as a team is ";
  845. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_MOVE_TO_APPROACH_PATH ];
  846. curTemplate->m_internalName = "SKIRMISH_MOVE_TO_APPROACH_PATH";
  847. curTemplate->m_uiName = "Skirmish Only_/Move/Team move to approach path.";
  848. curTemplate->m_numParameters = 2;
  849. curTemplate->m_parameters[0] = Parameter::TEAM;
  850. curTemplate->m_parameters[1] = Parameter::SKIRMISH_WAYPOINT_PATH;
  851. curTemplate->m_numUiStrings = 3;
  852. curTemplate->m_uiStrings[0] = "Have ";
  853. curTemplate->m_uiStrings[1] = " move to the start of enemy path ";
  854. curTemplate->m_uiStrings[2] = ".";
  855. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_BUILD_BASE_DEFENSE_FRONT];
  856. curTemplate->m_internalName = "SKIRMISH_BUILD_BASE_DEFENSE_FRONT";
  857. curTemplate->m_uiName = "Skirmish Only_/Build/Build base defense on front perimeter.";
  858. curTemplate->m_numParameters = 0;
  859. curTemplate->m_numUiStrings = 1;
  860. curTemplate->m_uiStrings[0] = "Build one additional perimeter base defenses, on the front.";
  861. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_BUILD_BASE_DEFENSE_FLANK];
  862. curTemplate->m_internalName = "SKIRMISH_BUILD_BASE_DEFENSE_FLANK";
  863. curTemplate->m_uiName = "Skirmish Only_/Build/Build base defense on flank perimeter.";
  864. curTemplate->m_numParameters = 0;
  865. curTemplate->m_numUiStrings = 1;
  866. curTemplate->m_uiStrings[0] = "Build one additional perimeter base defenses, on the flank.";
  867. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_BUILD_STRUCTURE_FRONT];
  868. curTemplate->m_internalName = "SKIRMISH_BUILD_STRUCTURE_FRONT";
  869. curTemplate->m_uiName = "Skirmish Only_/Build/Build structure on front perimeter.";
  870. curTemplate->m_numParameters = 1;
  871. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  872. curTemplate->m_numUiStrings = 2;
  873. curTemplate->m_uiStrings[0] = "Build one additional ";
  874. curTemplate->m_uiStrings[1] = ", on the front.";
  875. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_BUILD_STRUCTURE_FLANK];
  876. curTemplate->m_internalName = "SKIRMISH_BUILD_STRUCTURE_FLANK";
  877. curTemplate->m_uiName = "Skirmish Only_/Build/Build structure on flank perimeter.";
  878. curTemplate->m_numParameters = 1;
  879. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  880. curTemplate->m_numUiStrings = 2;
  881. curTemplate->m_uiStrings[0] = "Build one additional ";
  882. curTemplate->m_uiStrings[1] = ", on the flank.";
  883. curTemplate = &m_actionTemplates[ScriptAction::RECRUIT_TEAM];
  884. curTemplate->m_internalName = "RECRUIT_TEAM";
  885. curTemplate->m_uiName = "Team_/Create/Recruit a team.";
  886. curTemplate->m_numParameters = 2;
  887. curTemplate->m_parameters[0] = Parameter::TEAM;
  888. curTemplate->m_parameters[1] = Parameter::REAL;
  889. curTemplate->m_numUiStrings = 3;
  890. curTemplate->m_uiStrings[0] = "Recruit an instance of ";
  891. curTemplate->m_uiStrings[1] = ", maximum recruiting distance (feet):";
  892. curTemplate->m_uiStrings[2] = ".";
  893. curTemplate = &m_actionTemplates[ScriptAction::MOVE_CAMERA_TO];
  894. curTemplate->m_internalName = "MOVE_CAMERA_TO";
  895. curTemplate->m_uiName = "Camera_/Move/Move the camera to a location.";
  896. curTemplate->m_numParameters = 5;
  897. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  898. curTemplate->m_parameters[1] = Parameter::REAL;
  899. curTemplate->m_parameters[2] = Parameter::REAL;
  900. curTemplate->m_parameters[3] = Parameter::REAL;
  901. curTemplate->m_parameters[4] = Parameter::REAL;
  902. curTemplate->m_numUiStrings = 6;
  903. curTemplate->m_uiStrings[0] = "Move camera to ";
  904. curTemplate->m_uiStrings[1] = " in ";
  905. curTemplate->m_uiStrings[2] = " seconds, camera shutter ";
  906. curTemplate->m_uiStrings[3] = " seconds, ease-in ";
  907. curTemplate->m_uiStrings[4] = " seconds, ease-out ";
  908. curTemplate->m_uiStrings[5] = " seconds.";
  909. curTemplate = &m_actionTemplates[ScriptAction::ZOOM_CAMERA];
  910. curTemplate->m_internalName = "ZOOM_CAMERA";
  911. curTemplate->m_uiName = "Camera_/Adjust/Change the camera zoom.";
  912. curTemplate->m_numParameters = 4;
  913. curTemplate->m_parameters[0] = Parameter::REAL;
  914. curTemplate->m_parameters[1] = Parameter::REAL;
  915. curTemplate->m_parameters[2] = Parameter::REAL;
  916. curTemplate->m_parameters[3] = Parameter::REAL;
  917. curTemplate->m_numUiStrings = 5;
  918. curTemplate->m_uiStrings[0] = "Change camera zoom to ";
  919. curTemplate->m_uiStrings[1] = " in ";
  920. curTemplate->m_uiStrings[2] = " seconds, ease-in ";
  921. curTemplate->m_uiStrings[3] = " seconds, ease-out ";
  922. curTemplate->m_uiStrings[4] = " seconds.";
  923. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_ADD];
  924. curTemplate->m_internalName = "CAMERA_FADE_ADD";
  925. curTemplate->m_uiName = "Camera_/Fade Effects/Fade using an add blend to white.";
  926. curTemplate->m_numParameters = 5;
  927. curTemplate->m_parameters[0] = Parameter::REAL;
  928. curTemplate->m_parameters[1] = Parameter::REAL;
  929. curTemplate->m_parameters[2] = Parameter::INT;
  930. curTemplate->m_parameters[3] = Parameter::INT;
  931. curTemplate->m_parameters[4] = Parameter::INT;
  932. curTemplate->m_numUiStrings = 6;
  933. curTemplate->m_uiStrings[0] = "Fade (0-1) from ";
  934. curTemplate->m_uiStrings[1] = " to ";
  935. curTemplate->m_uiStrings[2] = " adding toward white. Take ";
  936. curTemplate->m_uiStrings[3] = " frames to increase, hold for ";
  937. curTemplate->m_uiStrings[4] = " fames, and decrease ";
  938. curTemplate->m_uiStrings[5] = " frames.";
  939. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_SUBTRACT];
  940. curTemplate->m_internalName = "CAMERA_FADE_SUBTRACT";
  941. curTemplate->m_uiName = "Camera_/Fade Effects/Fade using a subtractive blend to black.";
  942. curTemplate->m_numParameters = 5;
  943. curTemplate->m_parameters[0] = Parameter::REAL;
  944. curTemplate->m_parameters[1] = Parameter::REAL;
  945. curTemplate->m_parameters[2] = Parameter::INT;
  946. curTemplate->m_parameters[3] = Parameter::INT;
  947. curTemplate->m_parameters[4] = Parameter::INT;
  948. curTemplate->m_numUiStrings = 6;
  949. curTemplate->m_uiStrings[0] = "Fade (0-1) from ";
  950. curTemplate->m_uiStrings[1] = " to ";
  951. curTemplate->m_uiStrings[2] = " subtracting toward black. Take ";
  952. curTemplate->m_uiStrings[3] = " frames to increase, hold for ";
  953. curTemplate->m_uiStrings[4] = " fames, and decrease ";
  954. curTemplate->m_uiStrings[5] = " frames.";
  955. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_MULTIPLY];
  956. curTemplate->m_internalName = "CAMERA_FADE_MULTIPLY";
  957. curTemplate->m_uiName = "Camera_/Fade Effects/Fade using a multiply blend to black.";
  958. curTemplate->m_numParameters = 5;
  959. curTemplate->m_parameters[0] = Parameter::REAL;
  960. curTemplate->m_parameters[1] = Parameter::REAL;
  961. curTemplate->m_parameters[2] = Parameter::INT;
  962. curTemplate->m_parameters[3] = Parameter::INT;
  963. curTemplate->m_parameters[4] = Parameter::INT;
  964. curTemplate->m_numUiStrings = 6;
  965. curTemplate->m_uiStrings[0] = "Fade (1-0) from ";
  966. curTemplate->m_uiStrings[1] = " to ";
  967. curTemplate->m_uiStrings[2] = " multiplying toward black. Take ";
  968. curTemplate->m_uiStrings[3] = " frames to increase, hold for ";
  969. curTemplate->m_uiStrings[4] = " fames, and decrease ";
  970. curTemplate->m_uiStrings[5] = " frames.";
  971. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_SATURATE];
  972. curTemplate->m_internalName = "CAMERA_FADE_SATURATE";
  973. curTemplate->m_uiName = "Camera_/Fade Effects/Fade using a saturate blend.";
  974. curTemplate->m_numParameters = 5;
  975. curTemplate->m_parameters[0] = Parameter::REAL;
  976. curTemplate->m_parameters[1] = Parameter::REAL;
  977. curTemplate->m_parameters[2] = Parameter::INT;
  978. curTemplate->m_parameters[3] = Parameter::INT;
  979. curTemplate->m_parameters[4] = Parameter::INT;
  980. curTemplate->m_numUiStrings = 6;
  981. curTemplate->m_uiStrings[0] = "Fade (0.5-1) from ";
  982. curTemplate->m_uiStrings[1] = " to ";
  983. curTemplate->m_uiStrings[2] = " increasing saturation. Take ";
  984. curTemplate->m_uiStrings[3] = " frames to increase, hold for ";
  985. curTemplate->m_uiStrings[4] = " fames, and decrease ";
  986. curTemplate->m_uiStrings[5] = " frames.";
  987. curTemplate = &m_actionTemplates[ScriptAction::PITCH_CAMERA];
  988. curTemplate->m_internalName = "PITCH_CAMERA";
  989. curTemplate->m_uiName = "Camera_/Adjust/Change the camera pitch.";
  990. curTemplate->m_numParameters = 4;
  991. curTemplate->m_parameters[0] = Parameter::REAL;
  992. curTemplate->m_parameters[1] = Parameter::REAL;
  993. curTemplate->m_parameters[2] = Parameter::REAL;
  994. curTemplate->m_parameters[3] = Parameter::REAL;
  995. curTemplate->m_numUiStrings = 5;
  996. curTemplate->m_uiStrings[0] = "Change camera pitch to ";
  997. curTemplate->m_uiStrings[1] = " in ";
  998. curTemplate->m_uiStrings[2] = " seconds, ease-in ";
  999. curTemplate->m_uiStrings[3] = " seconds, ease-out ";
  1000. curTemplate->m_uiStrings[4] = " seconds.";
  1001. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FOLLOW_NAMED];
  1002. curTemplate->m_internalName = "CAMERA_FOLLOW_NAMED";
  1003. curTemplate->m_uiName = "Camera_/Move/Follow a specific unit.";
  1004. curTemplate->m_numParameters = 2;
  1005. curTemplate->m_parameters[0] = Parameter::UNIT;
  1006. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  1007. curTemplate->m_numUiStrings = 3;
  1008. curTemplate->m_uiStrings[0] = "Have the camera follow ";
  1009. curTemplate->m_uiStrings[1] = ". Snap camera to object is ";
  1010. curTemplate->m_uiStrings[2] = ".";
  1011. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_STOP_FOLLOW];
  1012. curTemplate->m_internalName = "CAMERA_STOP_FOLLOW";
  1013. curTemplate->m_uiName = "Camera_/Move/Stop following any units.";
  1014. curTemplate->m_numParameters = 0;
  1015. curTemplate->m_numUiStrings = 1;
  1016. curTemplate->m_uiStrings[0] = "Stop following any units.";
  1017. curTemplate = &m_actionTemplates[ScriptAction::SETUP_CAMERA];
  1018. curTemplate->m_internalName = "SETUP_CAMERA";
  1019. curTemplate->m_uiName = "Camera_/Adjust/Set up the camera.";
  1020. curTemplate->m_numParameters = 4;
  1021. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  1022. curTemplate->m_parameters[1] = Parameter::REAL;
  1023. curTemplate->m_parameters[2] = Parameter::REAL;
  1024. curTemplate->m_parameters[3] = Parameter::WAYPOINT;
  1025. curTemplate->m_numUiStrings = 5;
  1026. curTemplate->m_uiStrings[0] = "Position camera at ";
  1027. curTemplate->m_uiStrings[1] = ", zoom = ";
  1028. curTemplate->m_uiStrings[2] = "(0.0 to 1.0), pitch = ";
  1029. curTemplate->m_uiStrings[3] = "(1.0==default), looking towards ";
  1030. curTemplate->m_uiStrings[4] = ".";
  1031. curTemplate = &m_actionTemplates[ScriptAction::INCREMENT_COUNTER];
  1032. curTemplate->m_internalName = "INCREMENT_COUNTER";
  1033. curTemplate->m_uiName = "Scripting_/Counters/Increment counter.";
  1034. curTemplate->m_numParameters = 2;
  1035. curTemplate->m_parameters[0] = Parameter::INT;
  1036. curTemplate->m_parameters[1] = Parameter::COUNTER;
  1037. curTemplate->m_numUiStrings = 2;
  1038. curTemplate->m_uiStrings[0] = "Add ";
  1039. curTemplate->m_uiStrings[1] = " to counter ";
  1040. curTemplate = &m_actionTemplates[ScriptAction::DECREMENT_COUNTER];
  1041. curTemplate->m_internalName = "DECREMENT_COUNTER";
  1042. curTemplate->m_uiName = "Scripting_/Counters/Decrement counter.";
  1043. curTemplate->m_numParameters = 2;
  1044. curTemplate->m_parameters[0] = Parameter::INT;
  1045. curTemplate->m_parameters[1] = Parameter::COUNTER;
  1046. curTemplate->m_numUiStrings = 2;
  1047. curTemplate->m_uiStrings[0] = "Subtract ";
  1048. curTemplate->m_uiStrings[1] = " from counter ";
  1049. curTemplate = &m_actionTemplates[ScriptAction::MOVE_CAMERA_ALONG_WAYPOINT_PATH];
  1050. curTemplate->m_internalName = "MOVE_CAMERA_ALONG_WAYPOINT_PATH";
  1051. curTemplate->m_uiName = "Camera_/Move/Move along a waypoint path.";
  1052. curTemplate->m_numParameters = 5;
  1053. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  1054. curTemplate->m_parameters[1] = Parameter::REAL;
  1055. curTemplate->m_parameters[2] = Parameter::REAL;
  1056. curTemplate->m_parameters[3] = Parameter::REAL;
  1057. curTemplate->m_parameters[4] = Parameter::REAL;
  1058. curTemplate->m_numUiStrings = 6;
  1059. curTemplate->m_uiStrings[0] = "Move along path starting with ";
  1060. curTemplate->m_uiStrings[1] = " in ";
  1061. curTemplate->m_uiStrings[2] = " seconds, camera shutter ";
  1062. curTemplate->m_uiStrings[3] = " seconds, ease-in ";
  1063. curTemplate->m_uiStrings[4] = " seconds, ease-out ";
  1064. curTemplate->m_uiStrings[5] = " seconds.";
  1065. curTemplate = &m_actionTemplates[ScriptAction::ROTATE_CAMERA];
  1066. curTemplate->m_internalName = "ROTATE_CAMERA";
  1067. curTemplate->m_uiName = "Camera_/Rotate/ Rotate around the current viewpoint.";
  1068. curTemplate->m_numParameters = 4;
  1069. curTemplate->m_parameters[0] = Parameter::REAL;
  1070. curTemplate->m_parameters[1] = Parameter::REAL;
  1071. curTemplate->m_parameters[2] = Parameter::REAL;
  1072. curTemplate->m_parameters[3] = Parameter::REAL;
  1073. curTemplate->m_numUiStrings = 5;
  1074. curTemplate->m_uiStrings[0] = "Rotate ";
  1075. curTemplate->m_uiStrings[1] = " times, taking ";
  1076. curTemplate->m_uiStrings[2] = " seconds, ease-in ";
  1077. curTemplate->m_uiStrings[3] = " seconds, ease-out ";
  1078. curTemplate->m_uiStrings[4] = " seconds.";
  1079. curTemplate = &m_actionTemplates[ScriptAction::RESET_CAMERA];
  1080. curTemplate->m_internalName = "RESET_CAMERA";
  1081. curTemplate->m_uiName = "Camera_/Move/ Reset to the default view.";
  1082. curTemplate->m_numParameters = 4;
  1083. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  1084. curTemplate->m_parameters[1] = Parameter::REAL;
  1085. curTemplate->m_parameters[2] = Parameter::REAL;
  1086. curTemplate->m_parameters[3] = Parameter::REAL;
  1087. curTemplate->m_numUiStrings = 5;
  1088. curTemplate->m_uiStrings[0] = "Reset to ";
  1089. curTemplate->m_uiStrings[1] = ", taking ";
  1090. curTemplate->m_uiStrings[2] = " seconds, ease-in ";
  1091. curTemplate->m_uiStrings[3] = " seconds, ease-out ";
  1092. curTemplate->m_uiStrings[4] = " seconds.";
  1093. curTemplate = &m_actionTemplates[ScriptAction::MOVE_CAMERA_TO_SELECTION];
  1094. curTemplate->m_internalName = "MOVE_CAMERA_TO_SELECTION";
  1095. curTemplate->m_uiName = "Camera_/Move/Modify/ End movement at selected unit.";
  1096. curTemplate->m_numParameters = 0;
  1097. curTemplate->m_numUiStrings = 1;
  1098. curTemplate->m_uiStrings[0] = "End movement at selected unit.";
  1099. curTemplate = &m_actionTemplates[ScriptAction::SET_MILLISECOND_TIMER];
  1100. curTemplate->m_internalName = "SET_MILLISECOND_TIMER";
  1101. curTemplate->m_uiName = "Scripting_/Timer/Seconds countdown timer -- set.";
  1102. curTemplate->m_numParameters = 2;
  1103. curTemplate->m_parameters[0] = Parameter::COUNTER;
  1104. curTemplate->m_parameters[1] = Parameter::REAL;
  1105. curTemplate->m_numUiStrings = 3;
  1106. curTemplate->m_uiStrings[0] = "Set timer ";
  1107. curTemplate->m_uiStrings[1] = " to expire in ";
  1108. curTemplate->m_uiStrings[2] = " seconds.";
  1109. curTemplate = &m_actionTemplates[ScriptAction::SET_RANDOM_MSEC_TIMER];
  1110. curTemplate->m_internalName = "SET_RANDOM_MSEC_TIMER";
  1111. curTemplate->m_uiName = "Scripting_/Timer/Seconds countdown timer -- set random.";
  1112. curTemplate->m_numParameters = 3;
  1113. curTemplate->m_parameters[0] = Parameter::COUNTER;
  1114. curTemplate->m_parameters[1] = Parameter::REAL;
  1115. curTemplate->m_parameters[2] = Parameter::REAL;
  1116. curTemplate->m_numUiStrings = 4;
  1117. curTemplate->m_uiStrings[0] = "Set timer ";
  1118. curTemplate->m_uiStrings[1] = " to expire between ";
  1119. curTemplate->m_uiStrings[2] = " and ";
  1120. curTemplate->m_uiStrings[3] = " seconds.";
  1121. curTemplate = &m_actionTemplates[ScriptAction::ADD_TO_MSEC_TIMER];
  1122. curTemplate->m_internalName = "ADD_TO_MSEC_TIMER";
  1123. curTemplate->m_uiName = "Scripting_/Timer/Seconds countdown timer -- add seconds.";
  1124. curTemplate->m_numParameters = 2;
  1125. curTemplate->m_parameters[0] = Parameter::REAL;
  1126. curTemplate->m_parameters[1] = Parameter::COUNTER;
  1127. curTemplate->m_numUiStrings = 3;
  1128. curTemplate->m_uiStrings[0] = "Add ";
  1129. curTemplate->m_uiStrings[1] = " seconds to timer ";
  1130. curTemplate->m_uiStrings[2] = " .";
  1131. curTemplate = &m_actionTemplates[ScriptAction::SUB_FROM_MSEC_TIMER];
  1132. curTemplate->m_internalName = "SUB_FROM_MSEC_TIMER";
  1133. curTemplate->m_uiName = "Scripting_/Timer/Seconds countdown timer -- subtract seconds.";
  1134. curTemplate->m_numParameters = 2;
  1135. curTemplate->m_parameters[0] = Parameter::REAL;
  1136. curTemplate->m_parameters[1] = Parameter::COUNTER;
  1137. curTemplate->m_numUiStrings = 3;
  1138. curTemplate->m_uiStrings[0] = "Subtract ";
  1139. curTemplate->m_uiStrings[1] = " seconds from timer ";
  1140. curTemplate->m_uiStrings[2] = " .";
  1141. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOD_FREEZE_TIME];
  1142. curTemplate->m_internalName = "CAMERA_MOD_FREEZE_TIME";
  1143. curTemplate->m_uiName = "Camera_/Move/Modify/ Freeze time during the camera movement.";
  1144. curTemplate->m_numParameters = 0;
  1145. curTemplate->m_numUiStrings = 1;
  1146. curTemplate->m_uiStrings[0] = "Freeze time during the camera movement.";
  1147. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOD_FREEZE_ANGLE];
  1148. curTemplate->m_internalName = "CAMERA_MOD_FREEZE_ANGLE";
  1149. curTemplate->m_uiName = "Camera_/Move/Modify/ Freeze camera angle during the camera movement.";
  1150. curTemplate->m_numParameters = 0;
  1151. curTemplate->m_numUiStrings = 1;
  1152. curTemplate->m_uiStrings[0] = "Freeze camera angle during the camera movement.";
  1153. curTemplate = &m_actionTemplates[ScriptAction::SUSPEND_BACKGROUND_SOUNDS];
  1154. curTemplate->m_internalName = "SUSPEND_BACKGROUND_SOUNDS";
  1155. curTemplate->m_uiName = "Multimedia_/All Sounds/Suspend all sounds.";
  1156. curTemplate->m_numParameters = 0;
  1157. curTemplate->m_numUiStrings = 1;
  1158. curTemplate->m_uiStrings[0] = "Suspend background sounds.";
  1159. curTemplate = &m_actionTemplates[ScriptAction::RESUME_BACKGROUND_SOUNDS];
  1160. curTemplate->m_internalName = "RESUME_BACKGROUND_SOUNDS";
  1161. curTemplate->m_uiName = "Multimedia_/All Sounds/Resume all sounds.";
  1162. curTemplate->m_numParameters = 0;
  1163. curTemplate->m_numUiStrings = 1;
  1164. curTemplate->m_uiStrings[0] = "Resume background sounds.";
  1165. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOD_SET_FINAL_ZOOM];
  1166. curTemplate->m_internalName = "CAMERA_MOD_SET_FINAL_ZOOM";
  1167. curTemplate->m_uiName = "Camera_/Move/Modify/Set Final zoom for camera movement.";
  1168. curTemplate->m_numParameters = 3;
  1169. curTemplate->m_parameters[0] = Parameter::REAL;
  1170. curTemplate->m_parameters[1] = Parameter::PERCENT;
  1171. curTemplate->m_parameters[2] = Parameter::PERCENT;
  1172. curTemplate->m_numUiStrings = 4;
  1173. curTemplate->m_uiStrings[0] = "Adjust zoom to ";
  1174. curTemplate->m_uiStrings[1] = " (1.0==max height, 0.0==in the ground) ";
  1175. curTemplate->m_uiStrings[2] = " ease-in ";
  1176. curTemplate->m_uiStrings[3] = " ease-out.";
  1177. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOD_SET_FINAL_PITCH];
  1178. curTemplate->m_internalName = "CAMERA_MOD_SET_FINAL_PITCH";
  1179. curTemplate->m_uiName = "Camera_/Move/Modify/Set Final pitch for camera movement.";
  1180. curTemplate->m_numParameters = 3;
  1181. curTemplate->m_parameters[0] = Parameter::REAL;
  1182. curTemplate->m_parameters[1] = Parameter::PERCENT;
  1183. curTemplate->m_parameters[2] = Parameter::PERCENT;
  1184. curTemplate->m_numUiStrings = 4;
  1185. curTemplate->m_uiStrings[0] = "Adjust pitch to ";
  1186. curTemplate->m_uiStrings[1] = " (1.0==default, 0.0==toward horizon, >1 = toward ground) ";
  1187. curTemplate->m_uiStrings[2] = " ease-in ";
  1188. curTemplate->m_uiStrings[3] = " ease-out.";
  1189. curTemplate = &m_actionTemplates[ScriptAction::SET_VISUAL_SPEED_MULTIPLIER];
  1190. curTemplate->m_internalName = "SET_VISUAL_SPEED_MULTIPLIER";
  1191. curTemplate->m_uiName = "{Compatibility}_/Multimedia/Modify visual game time.";
  1192. curTemplate->m_numParameters = 1;
  1193. curTemplate->m_parameters[0] = Parameter::INT;
  1194. curTemplate->m_numUiStrings = 2;
  1195. curTemplate->m_uiStrings[0] = "Make visual time ";
  1196. curTemplate->m_uiStrings[1] = " time normal (1=normal, 2 = twice as fast, ...).";
  1197. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOD_SET_FINAL_SPEED_MULTIPLIER];
  1198. curTemplate->m_internalName = "CAMERA_MOD_SET_FINAL_SPEED_MULTIPLIER";
  1199. curTemplate->m_uiName = "{Compatibility}_/Camera/Modify/Final visual game time for camera movement.";
  1200. curTemplate->m_numParameters = 1;
  1201. curTemplate->m_parameters[0] = Parameter::INT;
  1202. curTemplate->m_numUiStrings = 2;
  1203. curTemplate->m_uiStrings[0] = "Adjust game time to";
  1204. curTemplate->m_uiStrings[1] = " times normal (1=normal, 2 = twice as fast, ...).";
  1205. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOD_SET_ROLLING_AVERAGE];
  1206. curTemplate->m_internalName = "CAMERA_MOD_SET_ROLLING_AVERAGE";
  1207. curTemplate->m_uiName = "Camera_/Move/Modify/ Number of frames to average movements.";
  1208. curTemplate->m_numParameters = 1;
  1209. curTemplate->m_parameters[0] = Parameter::INT;
  1210. curTemplate->m_numUiStrings = 2;
  1211. curTemplate->m_uiStrings[0] = "Average position and angle changes over";
  1212. curTemplate->m_uiStrings[1] = " frames. (1=no smoothing, 5 = very smooth)";
  1213. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOD_FINAL_LOOK_TOWARD];
  1214. curTemplate->m_internalName = "CAMERA_MOD_FINAL_LOOK_TOWARD";
  1215. curTemplate->m_uiName = "{Compatibility}_/Camera/Modify/Move/ Final camera look toward point.";
  1216. curTemplate->m_numParameters = 1;
  1217. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  1218. curTemplate->m_numUiStrings = 2;
  1219. curTemplate->m_uiStrings[0] = "Look toward";
  1220. curTemplate->m_uiStrings[1] = " at the end of the camera movement.";
  1221. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOD_LOOK_TOWARD];
  1222. curTemplate->m_internalName = "CAMERA_MOD_LOOK_TOWARD";
  1223. curTemplate->m_uiName = "Camera_/Modify/Move/Camera look toward point while moving.";
  1224. curTemplate->m_numParameters = 1;
  1225. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  1226. curTemplate->m_numUiStrings = 2;
  1227. curTemplate->m_uiStrings[0] = "Look toward";
  1228. curTemplate->m_uiStrings[1] = " during the camera movement.";
  1229. curTemplate = &m_actionTemplates[ScriptAction::CREATE_OBJECT];
  1230. curTemplate->m_internalName = "CREATE_OBJECT";
  1231. curTemplate->m_uiName = "Unit_/Spawn/Spawn object.";
  1232. curTemplate->m_numParameters = 4;
  1233. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  1234. curTemplate->m_parameters[1] = Parameter::TEAM;
  1235. curTemplate->m_parameters[2] = Parameter::COORD3D;
  1236. curTemplate->m_parameters[3] = Parameter::ANGLE;
  1237. curTemplate->m_numUiStrings = 5;
  1238. curTemplate->m_uiStrings[0] = "Spawn object ";
  1239. curTemplate->m_uiStrings[1] = " in ";
  1240. curTemplate->m_uiStrings[2] = " at position (";
  1241. curTemplate->m_uiStrings[3] = "), rotated ";
  1242. curTemplate->m_uiStrings[4] = " .";
  1243. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ATTACK_TEAM];
  1244. curTemplate->m_internalName = "TEAM_ATTACK_TEAM";
  1245. curTemplate->m_uiName = "Team_/Attack/Set to attack -- another team.";
  1246. curTemplate->m_numParameters = 2;
  1247. curTemplate->m_parameters[0] = Parameter::TEAM;
  1248. curTemplate->m_parameters[1] = Parameter::TEAM;
  1249. curTemplate->m_numUiStrings = 2;
  1250. curTemplate->m_uiStrings[0] = " ";
  1251. curTemplate->m_uiStrings[1] = " begin attack on ";
  1252. curTemplate = &m_actionTemplates[ScriptAction::NAMED_ATTACK_NAMED];
  1253. curTemplate->m_internalName = "NAMED_ATTACK_NAMED";
  1254. curTemplate->m_uiName = "Unit_/Attack/Set unit to attack another unit.";
  1255. curTemplate->m_numParameters = 2;
  1256. curTemplate->m_parameters[0] = Parameter::UNIT;
  1257. curTemplate->m_parameters[1] = Parameter::UNIT;
  1258. curTemplate->m_numUiStrings = 2;
  1259. curTemplate->m_uiStrings[0] = " ";
  1260. curTemplate->m_uiStrings[1] = " begin attack on ";
  1261. curTemplate = &m_actionTemplates[ScriptAction::CREATE_NAMED_ON_TEAM_AT_WAYPOINT];
  1262. curTemplate->m_internalName = "CREATE_NAMED_ON_TEAM_AT_WAYPOINT";
  1263. curTemplate->m_uiName = "Unit_/Spawn/Spawn -- named unit on a team at a waypoint.";
  1264. curTemplate->m_numParameters = 4;
  1265. curTemplate->m_parameters[0] = Parameter::UNIT;
  1266. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  1267. curTemplate->m_parameters[2] = Parameter::TEAM;
  1268. curTemplate->m_parameters[3] = Parameter::WAYPOINT;
  1269. curTemplate->m_numUiStrings = 4;
  1270. curTemplate->m_uiStrings[0] = "Spawn ";
  1271. curTemplate->m_uiStrings[1] = " of type ";
  1272. curTemplate->m_uiStrings[2] = " on ";
  1273. curTemplate->m_uiStrings[3] = " at waypoint ";
  1274. curTemplate = &m_actionTemplates[ScriptAction::CREATE_UNNAMED_ON_TEAM_AT_WAYPOINT];
  1275. curTemplate->m_internalName = "CREATE_UNNAMED_ON_TEAM_AT_WAYPOINT";
  1276. curTemplate->m_uiName = "Unit_/Spawn/Spawn -- unnamed unit on a team at a waypoint.";
  1277. curTemplate->m_numParameters = 3;
  1278. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  1279. curTemplate->m_parameters[1] = Parameter::TEAM;
  1280. curTemplate->m_parameters[2] = Parameter::WAYPOINT;
  1281. curTemplate->m_numUiStrings = 3;
  1282. curTemplate->m_uiStrings[0] = "Spawn unit of type ";
  1283. curTemplate->m_uiStrings[1] = " on ";
  1284. curTemplate->m_uiStrings[2] = " at waypoint ";
  1285. curTemplate = &m_actionTemplates[ScriptAction::NAMED_APPLY_ATTACK_PRIORITY_SET];
  1286. curTemplate->m_internalName = "NAMED_APPLY_ATTACK_PRIORITY_SET";
  1287. curTemplate->m_uiName = "AttackPrioritySet_/Apply/Unit/Apply unit's attack priority set.";
  1288. curTemplate->m_numParameters = 2;
  1289. curTemplate->m_parameters[0] = Parameter::UNIT;
  1290. curTemplate->m_parameters[1] = Parameter::ATTACK_PRIORITY_SET;
  1291. curTemplate->m_numUiStrings = 3;
  1292. curTemplate->m_uiStrings[0] = "Have ";
  1293. curTemplate->m_uiStrings[1] = " use ";
  1294. curTemplate->m_uiStrings[2] = ".";
  1295. curTemplate = &m_actionTemplates[ScriptAction::TEAM_APPLY_ATTACK_PRIORITY_SET];
  1296. curTemplate->m_internalName = "TEAM_APPLY_ATTACK_PRIORITY_SET";
  1297. curTemplate->m_uiName = "AttackPrioritySet_/Apply/Team/Apply a team's attack priority set.";
  1298. curTemplate->m_numParameters = 2;
  1299. curTemplate->m_parameters[0] = Parameter::TEAM;
  1300. curTemplate->m_parameters[1] = Parameter::ATTACK_PRIORITY_SET;
  1301. curTemplate->m_numUiStrings = 3;
  1302. curTemplate->m_uiStrings[0] = "Have ";
  1303. curTemplate->m_uiStrings[1] = " use ";
  1304. curTemplate->m_uiStrings[2] = ".";
  1305. curTemplate = &m_actionTemplates[ScriptAction::SET_ATTACK_PRIORITY_THING];
  1306. curTemplate->m_internalName = "SET_ATTACK_PRIORITY_THING";
  1307. curTemplate->m_uiName = "AttackPrioritySet_/Set/Modify a set's priority for a single unit type.";
  1308. curTemplate->m_numParameters = 3;
  1309. curTemplate->m_parameters[0] = Parameter::ATTACK_PRIORITY_SET;
  1310. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  1311. curTemplate->m_parameters[2] = Parameter::INT;
  1312. curTemplate->m_numUiStrings = 3;
  1313. curTemplate->m_uiStrings[0] = "For ";
  1314. curTemplate->m_uiStrings[1] = " set the priority of object type ";
  1315. curTemplate->m_uiStrings[2] = " to ";
  1316. curTemplate = &m_actionTemplates[ScriptAction::SET_ATTACK_PRIORITY_KIND_OF];
  1317. curTemplate->m_internalName = "SET_ATTACK_PRIORITY_KIND_OF";
  1318. curTemplate->m_uiName = "AttackPrioritySet_/Set/Modify a set's priorities for all of a kind.";
  1319. curTemplate->m_numParameters = 3;
  1320. curTemplate->m_parameters[0] = Parameter::ATTACK_PRIORITY_SET;
  1321. curTemplate->m_parameters[1] = Parameter::KIND_OF_PARAM;
  1322. curTemplate->m_parameters[2] = Parameter::INT;
  1323. curTemplate->m_numUiStrings = 3;
  1324. curTemplate->m_uiStrings[0] = "For ";
  1325. curTemplate->m_uiStrings[1] = " set the priority of object type ";
  1326. curTemplate->m_uiStrings[2] = " to ";
  1327. curTemplate = &m_actionTemplates[ScriptAction::SET_DEFAULT_ATTACK_PRIORITY];
  1328. curTemplate->m_internalName = "SET_DEFAULT_ATTACK_PRIORITY";
  1329. curTemplate->m_uiName = "AttackPrioritySet_/Set/Specify the set's default priority.";
  1330. curTemplate->m_numParameters = 2;
  1331. curTemplate->m_parameters[0] = Parameter::ATTACK_PRIORITY_SET;
  1332. curTemplate->m_parameters[1] = Parameter::INT;
  1333. curTemplate->m_numUiStrings = 2;
  1334. curTemplate->m_uiStrings[0] = "For ";
  1335. curTemplate->m_uiStrings[1] = " set the default priority to ";
  1336. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_ADD_SKILLPOINTS];
  1337. curTemplate->m_internalName = "PLAYER_ADD_SKILLPOINTS";
  1338. curTemplate->m_uiName = "Player_/Experience/Add or Subtract Skill Points.";
  1339. curTemplate->m_numParameters = 2;
  1340. curTemplate->m_parameters[0] = Parameter::SIDE;
  1341. curTemplate->m_parameters[1] = Parameter::INT;
  1342. curTemplate->m_numUiStrings = 3;
  1343. curTemplate->m_uiStrings[0] = " ";
  1344. curTemplate->m_uiStrings[1] = " is given ";
  1345. curTemplate->m_uiStrings[2] = " Skill Points.";
  1346. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_ADD_RANKLEVEL];
  1347. curTemplate->m_internalName = "PLAYER_ADD_RANKLEVEL";
  1348. curTemplate->m_uiName = "Player_/Experience/Add or Subtract Rank Levels.";
  1349. curTemplate->m_numParameters = 2;
  1350. curTemplate->m_parameters[0] = Parameter::SIDE;
  1351. curTemplate->m_parameters[1] = Parameter::INT;
  1352. curTemplate->m_numUiStrings = 3;
  1353. curTemplate->m_uiStrings[0] = " ";
  1354. curTemplate->m_uiStrings[1] = " is given ";
  1355. curTemplate->m_uiStrings[2] = " Rank Levels.";
  1356. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_SET_RANKLEVEL];
  1357. curTemplate->m_internalName = "PLAYER_SET_RANKLEVEL";
  1358. curTemplate->m_uiName = "Player_/Experience/Set Rank Level.";
  1359. curTemplate->m_numParameters = 2;
  1360. curTemplate->m_parameters[0] = Parameter::SIDE;
  1361. curTemplate->m_parameters[1] = Parameter::INT;
  1362. curTemplate->m_numUiStrings = 3;
  1363. curTemplate->m_uiStrings[0] = " ";
  1364. curTemplate->m_uiStrings[1] = " is given a Rank Level of ";
  1365. curTemplate->m_uiStrings[2] = ".";
  1366. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_SET_RANKLEVELLIMIT];
  1367. curTemplate->m_internalName = "PLAYER_SET_RANKLEVELLIMIT";
  1368. curTemplate->m_uiName = "Map_/Experience/Set Rank Level Limit for current Map.";
  1369. curTemplate->m_numParameters = 1;
  1370. curTemplate->m_parameters[0] = Parameter::INT;
  1371. curTemplate->m_numUiStrings = 2;
  1372. curTemplate->m_uiStrings[0] = "The current map is given a Rank Level Limit of ";
  1373. curTemplate->m_uiStrings[1] = ".";
  1374. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_GRANT_SCIENCE];
  1375. curTemplate->m_internalName = "PLAYER_GRANT_SCIENCE";
  1376. curTemplate->m_uiName = "Player_/Science/Grant a Science to a given Player (ignoring prerequisites).";
  1377. curTemplate->m_numParameters = 2;
  1378. curTemplate->m_parameters[0] = Parameter::SIDE;
  1379. curTemplate->m_parameters[1] = Parameter::SCIENCE;
  1380. curTemplate->m_numUiStrings = 3;
  1381. curTemplate->m_uiStrings[0] = " ";
  1382. curTemplate->m_uiStrings[1] = " is granted ";
  1383. curTemplate->m_uiStrings[2] = ".";
  1384. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_PURCHASE_SCIENCE];
  1385. curTemplate->m_internalName = "PLAYER_PURCHASE_SCIENCE";
  1386. curTemplate->m_uiName = "Player_/Science/Player attempts to purchase a Science.";
  1387. curTemplate->m_numParameters = 2;
  1388. curTemplate->m_parameters[0] = Parameter::SIDE;
  1389. curTemplate->m_parameters[1] = Parameter::SCIENCE;
  1390. curTemplate->m_numUiStrings = 3;
  1391. curTemplate->m_uiStrings[0] = " ";
  1392. curTemplate->m_uiStrings[1] = " attempts to purchase Science ";
  1393. curTemplate->m_uiStrings[2] = ".";
  1394. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_SCIENCE_AVAILABILITY];
  1395. curTemplate->m_internalName = "PLAYER_SCIENCE_AVAILABILITY";
  1396. curTemplate->m_uiName = "Player_/Science/Set science availability.";
  1397. curTemplate->m_numParameters = 3;
  1398. curTemplate->m_parameters[0] = Parameter::SIDE;
  1399. curTemplate->m_parameters[1] = Parameter::SCIENCE;
  1400. curTemplate->m_parameters[2] = Parameter::SCIENCE_AVAILABILITY;
  1401. curTemplate->m_numUiStrings = 4;
  1402. curTemplate->m_uiStrings[0] = " ";
  1403. curTemplate->m_uiStrings[1] = " set ";
  1404. curTemplate->m_uiStrings[2] = " availability to ";
  1405. curTemplate->m_uiStrings[3] = ".";
  1406. curTemplate = &m_actionTemplates[ScriptAction::SET_BASE_CONSTRUCTION_SPEED];
  1407. curTemplate->m_internalName = "SET_BASE_CONSTRUCTION_SPEED";
  1408. curTemplate->m_uiName = "Player_/AI/Set the delay between building teams.";
  1409. curTemplate->m_numParameters = 2;
  1410. curTemplate->m_parameters[0] = Parameter::SIDE;
  1411. curTemplate->m_parameters[1] = Parameter::INT;
  1412. curTemplate->m_numUiStrings = 3;
  1413. curTemplate->m_uiStrings[0] = " ";
  1414. curTemplate->m_uiStrings[1] = " will delay ";
  1415. curTemplate->m_uiStrings[1] = " seconds between building teams.";
  1416. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_ATTITUDE];
  1417. curTemplate->m_internalName = "NAMED_SET_ATTITUDE";
  1418. curTemplate->m_uiName = "Unit_/Mood/Set the general attitude of a specific unit.";
  1419. curTemplate->m_numParameters = 2;
  1420. curTemplate->m_parameters[0] = Parameter::UNIT;
  1421. curTemplate->m_parameters[1] = Parameter::AI_MOOD;
  1422. curTemplate->m_numUiStrings = 2;
  1423. curTemplate->m_uiStrings[0] = " ";
  1424. curTemplate->m_uiStrings[1] = " changes his attitude to ";
  1425. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_ATTITUDE];
  1426. curTemplate->m_internalName = "TEAM_SET_ATTITUDE";
  1427. curTemplate->m_uiName = "Team_/Mood/Set the general attitude of a team.";
  1428. curTemplate->m_numParameters = 2;
  1429. curTemplate->m_parameters[0] = Parameter::TEAM;
  1430. curTemplate->m_parameters[1] = Parameter::AI_MOOD;
  1431. curTemplate->m_numUiStrings = 2;
  1432. curTemplate->m_uiStrings[0] = " ";
  1433. curTemplate->m_uiStrings[1] = " change their attitude to ";
  1434. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_REPULSOR];
  1435. curTemplate->m_internalName = "NAMED_SET_REPULSOR";
  1436. curTemplate->m_uiName = "Unit_/Internal/Repulsor/Set the REPULSOR flag of a specific unit.";
  1437. curTemplate->m_numParameters = 2;
  1438. curTemplate->m_parameters[0] = Parameter::UNIT;
  1439. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  1440. curTemplate->m_numUiStrings = 2;
  1441. curTemplate->m_uiStrings[0] = " ";
  1442. curTemplate->m_uiStrings[1] = " REPULSOR flag is ";
  1443. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_REPULSOR];
  1444. curTemplate->m_internalName = "TEAM_SET_REPULSOR";
  1445. curTemplate->m_uiName = "Team_/Internal/Repulsor/Set the REPULSOR flag of a team.";
  1446. curTemplate->m_numParameters = 2;
  1447. curTemplate->m_parameters[0] = Parameter::TEAM;
  1448. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  1449. curTemplate->m_numUiStrings = 2;
  1450. curTemplate->m_uiStrings[0] = " ";
  1451. curTemplate->m_uiStrings[1] = " REPULSOR flag is ";
  1452. curTemplate = &m_actionTemplates[ScriptAction::NAMED_ATTACK_AREA];
  1453. curTemplate->m_internalName = "NAMED_ATTACK_AREA";
  1454. curTemplate->m_uiName = "Unit_/Attack/Set a specific unit to attack a specific trigger area.";
  1455. curTemplate->m_numParameters = 2;
  1456. curTemplate->m_parameters[0] = Parameter::UNIT;
  1457. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  1458. curTemplate->m_numUiStrings = 2;
  1459. curTemplate->m_uiStrings[0] = " ";
  1460. curTemplate->m_uiStrings[1] = " attacks anything in ";
  1461. curTemplate = &m_actionTemplates[ScriptAction::NAMED_ATTACK_TEAM];
  1462. curTemplate->m_internalName = "NAMED_ATTACK_TEAM";
  1463. curTemplate->m_uiName = "Unit_/Attack/Set a specific unit to attack a team.";
  1464. curTemplate->m_numParameters = 2;
  1465. curTemplate->m_parameters[0] = Parameter::UNIT;
  1466. curTemplate->m_parameters[1] = Parameter::TEAM;
  1467. curTemplate->m_numUiStrings = 2;
  1468. curTemplate->m_uiStrings[0] = " ";
  1469. curTemplate->m_uiStrings[1] = " attacks ";
  1470. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ATTACK_AREA];
  1471. curTemplate->m_internalName = "TEAM_ATTACK_AREA";
  1472. curTemplate->m_uiName = "Team_/Attack/Set to attack -- trigger area.";
  1473. curTemplate->m_numParameters = 2;
  1474. curTemplate->m_parameters[0] = Parameter::TEAM;
  1475. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  1476. curTemplate->m_numUiStrings = 2;
  1477. curTemplate->m_uiStrings[0] = " ";
  1478. curTemplate->m_uiStrings[1] = " attack anything in ";
  1479. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ATTACK_NAMED];
  1480. curTemplate->m_internalName = "TEAM_ATTACK_NAMED";
  1481. curTemplate->m_uiName = "Team_/Attack/Set to attack -- specific unit.";
  1482. curTemplate->m_numParameters = 2;
  1483. curTemplate->m_parameters[0] = Parameter::TEAM;
  1484. curTemplate->m_parameters[1] = Parameter::UNIT;
  1485. curTemplate->m_numUiStrings = 2;
  1486. curTemplate->m_uiStrings[0] = " ";
  1487. curTemplate->m_uiStrings[1] = " attacks ";
  1488. curTemplate = &m_actionTemplates[ScriptAction::TEAM_LOAD_TRANSPORTS];
  1489. curTemplate->m_internalName = "TEAM_LOAD_TRANSPORTS";
  1490. curTemplate->m_uiName = "Team_/Transport/Transport -- automatically load.";
  1491. curTemplate->m_numParameters = 1;
  1492. curTemplate->m_parameters[0] = Parameter::TEAM;
  1493. curTemplate->m_numUiStrings = 2;
  1494. curTemplate->m_uiStrings[0] = " ";
  1495. curTemplate->m_uiStrings[1] = " load into transports.";
  1496. curTemplate = &m_actionTemplates[ScriptAction::NAMED_ENTER_NAMED];
  1497. curTemplate->m_internalName = "NAMED_ENTER_NAMED";
  1498. curTemplate->m_uiName = "Unit_/Transport/Transport -- load unit into specific.";
  1499. curTemplate->m_numParameters = 2;
  1500. curTemplate->m_parameters[0] = Parameter::UNIT;
  1501. curTemplate->m_parameters[1] = Parameter::UNIT;
  1502. curTemplate->m_numUiStrings = 2;
  1503. curTemplate->m_uiStrings[0] = " ";
  1504. curTemplate->m_uiStrings[1] = " loads into ";
  1505. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ENTER_NAMED];
  1506. curTemplate->m_internalName = "TEAM_ENTER_NAMED";
  1507. curTemplate->m_uiName = "Team_/Transport/Transport -- load team into specific.";
  1508. curTemplate->m_numParameters = 2;
  1509. curTemplate->m_parameters[0] = Parameter::TEAM;
  1510. curTemplate->m_parameters[1] = Parameter::UNIT;
  1511. curTemplate->m_numUiStrings = 2;
  1512. curTemplate->m_uiStrings[0] = " ";
  1513. curTemplate->m_uiStrings[1] = " attempt to load into ";
  1514. curTemplate = &m_actionTemplates[ScriptAction::NAMED_EXIT_ALL];
  1515. curTemplate->m_internalName = "NAMED_EXIT_ALL";
  1516. curTemplate->m_uiName = "Unit_/Transport/Transport -- unload units from specific.";
  1517. curTemplate->m_numParameters = 1;
  1518. curTemplate->m_parameters[0] = Parameter::UNIT;
  1519. curTemplate->m_numUiStrings = 2;
  1520. curTemplate->m_uiStrings[0] = " ";
  1521. curTemplate->m_uiStrings[1] = " unloads.";
  1522. curTemplate = &m_actionTemplates[ScriptAction::TEAM_EXIT_ALL];
  1523. curTemplate->m_internalName = "TEAM_EXIT_ALL";
  1524. curTemplate->m_uiName = "Team_/Transport/Transport -- unload team from all.";
  1525. curTemplate->m_numParameters = 1;
  1526. curTemplate->m_parameters[0] = Parameter::TEAM;
  1527. curTemplate->m_numUiStrings = 2;
  1528. curTemplate->m_uiStrings[0] = " ";
  1529. curTemplate->m_uiStrings[1] = " unload.";
  1530. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FOLLOW_WAYPOINTS];
  1531. curTemplate->m_internalName = "NAMED_FOLLOW_WAYPOINTS";
  1532. curTemplate->m_uiName = "Unit_/Move/Set a specific unit to follow a waypoint path.";
  1533. curTemplate->m_numParameters = 2;
  1534. curTemplate->m_parameters[0] = Parameter::UNIT;
  1535. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  1536. curTemplate->m_numUiStrings = 2;
  1537. curTemplate->m_uiStrings[0] = " ";
  1538. curTemplate->m_uiStrings[1] = " follows waypoints, beginning at ";
  1539. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FOLLOW_WAYPOINTS_EXACT];
  1540. curTemplate->m_internalName = "NAMED_FOLLOW_WAYPOINTS_EXACT";
  1541. curTemplate->m_uiName = "Unit_/Move/Set a specific unit to EXACTLY follow a waypoint path.";
  1542. curTemplate->m_numParameters = 2;
  1543. curTemplate->m_parameters[0] = Parameter::UNIT;
  1544. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  1545. curTemplate->m_numUiStrings = 2;
  1546. curTemplate->m_uiStrings[0] = " ";
  1547. curTemplate->m_uiStrings[1] = " EXACTLY follows waypoints, beginning at ";
  1548. curTemplate = &m_actionTemplates[ScriptAction::NAMED_GUARD];
  1549. curTemplate->m_internalName = "NAMED_GUARD";
  1550. curTemplate->m_uiName = "Unit_/Move/Set to guard.";
  1551. curTemplate->m_numParameters = 1;
  1552. curTemplate->m_parameters[0] = Parameter::UNIT;
  1553. curTemplate->m_numUiStrings = 2;
  1554. curTemplate->m_uiStrings[0] = " ";
  1555. curTemplate->m_uiStrings[1] = " begins guarding.";
  1556. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GUARD];
  1557. curTemplate->m_internalName = "TEAM_GUARD";
  1558. curTemplate->m_uiName = "Team_/Guard/Set to guard -- current location.";
  1559. curTemplate->m_numParameters = 1;
  1560. curTemplate->m_parameters[0] = Parameter::TEAM;
  1561. curTemplate->m_numUiStrings = 2;
  1562. curTemplate->m_uiStrings[0] = " ";
  1563. curTemplate->m_uiStrings[1] = " begins guarding.";
  1564. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GUARD_POSITION];
  1565. curTemplate->m_internalName = "TEAM_GUARD_POSITION";
  1566. curTemplate->m_uiName = "Team_/Guard/Set to guard -- location.";
  1567. curTemplate->m_numParameters = 2;
  1568. curTemplate->m_parameters[0] = Parameter::TEAM;
  1569. curTemplate->m_parameters[1] = Parameter::WAYPOINT;
  1570. curTemplate->m_numUiStrings = 2;
  1571. curTemplate->m_uiStrings[0] = " ";
  1572. curTemplate->m_uiStrings[1] = " begins guarding at ";
  1573. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GUARD_OBJECT];
  1574. curTemplate->m_internalName = "TEAM_GUARD_OBJECT";
  1575. curTemplate->m_uiName = "Team_/Guard/Set to guard -- specific unit.";
  1576. curTemplate->m_numParameters = 2;
  1577. curTemplate->m_parameters[0] = Parameter::TEAM;
  1578. curTemplate->m_parameters[1] = Parameter::UNIT;
  1579. curTemplate->m_numUiStrings = 2;
  1580. curTemplate->m_uiStrings[0] = " ";
  1581. curTemplate->m_uiStrings[1] = " begins guarding ";
  1582. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GUARD_AREA];
  1583. curTemplate->m_internalName = "TEAM_GUARD_AREA";
  1584. curTemplate->m_uiName = "Team_/Guard/Set to guard -- area.";
  1585. curTemplate->m_numParameters = 2;
  1586. curTemplate->m_parameters[0] = Parameter::TEAM;
  1587. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  1588. curTemplate->m_numUiStrings = 2;
  1589. curTemplate->m_uiStrings[0] = " ";
  1590. curTemplate->m_uiStrings[1] = " begins guarding ";
  1591. curTemplate = &m_actionTemplates[ScriptAction::NAMED_HUNT];
  1592. curTemplate->m_internalName = "NAMED_HUNT";
  1593. curTemplate->m_uiName = "Unit_/Hunt/Set a specific unit to hunt.";
  1594. curTemplate->m_numParameters = 1;
  1595. curTemplate->m_parameters[0] = Parameter::UNIT;
  1596. curTemplate->m_numUiStrings = 2;
  1597. curTemplate->m_uiStrings[0] = " ";
  1598. curTemplate->m_uiStrings[1] = " begins hunting.";
  1599. curTemplate = &m_actionTemplates[ScriptAction::TEAM_HUNT_WITH_COMMAND_BUTTON];
  1600. curTemplate->m_internalName = "TEAM_HUNT_WITH_COMMAND_BUTTON";
  1601. curTemplate->m_uiName = "Team_/Hunt/Set to hunt using commandbutton ability.";
  1602. curTemplate->m_numParameters = 2;
  1603. curTemplate->m_parameters[0] = Parameter::TEAM;
  1604. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  1605. curTemplate->m_numUiStrings = 3;
  1606. curTemplate->m_uiStrings[0] = " ";
  1607. curTemplate->m_uiStrings[1] = " begins hunting using ";
  1608. curTemplate->m_uiStrings[2] = ".";
  1609. curTemplate = &m_actionTemplates[ScriptAction::TEAM_HUNT];
  1610. curTemplate->m_internalName = "TEAM_HUNT";
  1611. curTemplate->m_uiName = "Team_/Hunt/Set to hunt.";
  1612. curTemplate->m_numParameters = 1;
  1613. curTemplate->m_parameters[0] = Parameter::TEAM;
  1614. curTemplate->m_numUiStrings = 2;
  1615. curTemplate->m_uiStrings[0] = " ";
  1616. curTemplate->m_uiStrings[1] = " begins hunting.";
  1617. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_HUNT];
  1618. curTemplate->m_internalName = "PLAYER_HUNT";
  1619. curTemplate->m_uiName = "Player_/Hunt/Set all of a player's units to hunt.";
  1620. curTemplate->m_numParameters = 1;
  1621. curTemplate->m_parameters[0] = Parameter::SIDE;
  1622. curTemplate->m_numUiStrings = 2;
  1623. curTemplate->m_uiStrings[0] = " ";
  1624. curTemplate->m_uiStrings[1] = " begins hunting.";
  1625. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_SELL_EVERYTHING];
  1626. curTemplate->m_internalName = "PLAYER_SELL_EVERYTHING";
  1627. curTemplate->m_uiName = "Player_/Set/Set a player to sell everything.";
  1628. curTemplate->m_numParameters = 1;
  1629. curTemplate->m_parameters[0] = Parameter::SIDE;
  1630. curTemplate->m_numUiStrings = 2;
  1631. curTemplate->m_uiStrings[0] = " ";
  1632. curTemplate->m_uiStrings[1] = " sells everything.";
  1633. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_DISABLE_BASE_CONSTRUCTION];
  1634. curTemplate->m_internalName = "PLAYER_DISABLE_BASE_CONSTRUCTION";
  1635. curTemplate->m_uiName = "Player_/Build/Set a player to be unable to build buildings.";
  1636. curTemplate->m_numParameters = 1;
  1637. curTemplate->m_parameters[0] = Parameter::SIDE;
  1638. curTemplate->m_numUiStrings = 2;
  1639. curTemplate->m_uiStrings[0] = " ";
  1640. curTemplate->m_uiStrings[1] = " is unable to build buildings.";
  1641. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_DISABLE_FACTORIES];
  1642. curTemplate->m_internalName = "PLAYER_DISABLE_FACTORIES";
  1643. curTemplate->m_uiName = "Player_/Build/Set a player to be unable to build from a specific building.";
  1644. curTemplate->m_numParameters = 2;
  1645. curTemplate->m_parameters[0] = Parameter::SIDE;
  1646. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  1647. curTemplate->m_numUiStrings = 2;
  1648. curTemplate->m_uiStrings[0] = " ";
  1649. curTemplate->m_uiStrings[1] = " is unable to build from ";
  1650. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_DISABLE_UNIT_CONSTRUCTION];
  1651. curTemplate->m_internalName = "PLAYER_DISABLE_UNIT_CONSTRUCTION";
  1652. curTemplate->m_uiName = "Player_/Build/Set a player to be unable to build units.";
  1653. curTemplate->m_numParameters = 1;
  1654. curTemplate->m_parameters[0] = Parameter::SIDE;
  1655. curTemplate->m_numUiStrings = 2;
  1656. curTemplate->m_uiStrings[0] = " ";
  1657. curTemplate->m_uiStrings[1] = " is unable to build units.";
  1658. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_ENABLE_BASE_CONSTRUCTION];
  1659. curTemplate->m_internalName = "PLAYER_ENABLE_BASE_CONSTRUCTION";
  1660. curTemplate->m_uiName = "Player_/Build/Set a player to be able to build buildings.";
  1661. curTemplate->m_numParameters = 1;
  1662. curTemplate->m_parameters[0] = Parameter::SIDE;
  1663. curTemplate->m_numUiStrings = 2;
  1664. curTemplate->m_uiStrings[0] = " ";
  1665. curTemplate->m_uiStrings[1] = " is able to build buildings.";
  1666. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_ENABLE_FACTORIES];
  1667. curTemplate->m_internalName = "PLAYER_ENABLE_FACTORIES";
  1668. curTemplate->m_uiName = "Player_/Build/Set a player to be able to build from a specific building.";
  1669. curTemplate->m_numParameters = 2;
  1670. curTemplate->m_parameters[0] = Parameter::SIDE;
  1671. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  1672. curTemplate->m_numUiStrings = 2;
  1673. curTemplate->m_uiStrings[0] = " ";
  1674. curTemplate->m_uiStrings[1] = " is able to build from ";
  1675. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_ENABLE_UNIT_CONSTRUCTION];
  1676. curTemplate->m_internalName = "PLAYER_ENABLE_UNIT_CONSTRUCTION";
  1677. curTemplate->m_uiName = "Player_/Build/Set a player to be able to build units.";
  1678. curTemplate->m_numParameters = 1;
  1679. curTemplate->m_parameters[0] = Parameter::SIDE;
  1680. curTemplate->m_numUiStrings = 2;
  1681. curTemplate->m_uiStrings[0] = " ";
  1682. curTemplate->m_uiStrings[1] = " is able to build units.";
  1683. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOVE_HOME];
  1684. curTemplate->m_internalName = "CAMERA_MOVE_HOME";
  1685. curTemplate->m_uiName = "Camera_/Move/Move the camera to the home position.";
  1686. curTemplate->m_numParameters = 0;
  1687. curTemplate->m_numUiStrings = 1;
  1688. curTemplate->m_uiStrings[0] = "The camera moves to the home base.";
  1689. curTemplate = &m_actionTemplates[ScriptAction::OVERSIZE_TERRAIN];
  1690. curTemplate->m_internalName = "OVERSIZE_TERRAIN";
  1691. curTemplate->m_uiName = "Camera_/Terrain/Oversize the terrain.";
  1692. curTemplate->m_numParameters = 1;
  1693. curTemplate->m_parameters[0] = Parameter::INT;
  1694. curTemplate->m_numUiStrings = 2;
  1695. curTemplate->m_uiStrings[0] = "Oversize the terrain ";
  1696. curTemplate->m_uiStrings[1] = " tiles on each side [0 = reset to normal].";
  1697. curTemplate = &m_actionTemplates[ScriptAction::BUILD_TEAM];
  1698. curTemplate->m_internalName = "BUILD_TEAM";
  1699. curTemplate->m_uiName = "Team_/AI/Start building a team.";
  1700. curTemplate->m_numParameters = 1;
  1701. curTemplate->m_parameters[0] = Parameter::TEAM;
  1702. curTemplate->m_numUiStrings = 1;
  1703. curTemplate->m_uiStrings[0] = "Start building team ";
  1704. curTemplate = &m_actionTemplates[ScriptAction::NAMED_DAMAGE];
  1705. curTemplate->m_internalName = "NAMED_DAMAGE";
  1706. curTemplate->m_uiName = "Unit_/Damage/Deal damage to a specific unit.";
  1707. curTemplate->m_numParameters = 2;
  1708. curTemplate->m_parameters[0] = Parameter::UNIT;
  1709. curTemplate->m_parameters[1] = Parameter::INT;
  1710. curTemplate->m_numUiStrings = 3;
  1711. curTemplate->m_uiStrings[0] = " ";
  1712. curTemplate->m_uiStrings[1] = " takes ";
  1713. curTemplate->m_uiStrings[2] = " points of damage.";
  1714. curTemplate = &m_actionTemplates[ScriptAction::NAMED_DELETE];
  1715. curTemplate->m_internalName = "NAMED_DELETE";
  1716. curTemplate->m_uiName = "Unit_/Damage or Remove/Delete a specific unit.";
  1717. curTemplate->m_numParameters = 1;
  1718. curTemplate->m_parameters[0] = Parameter::UNIT;
  1719. curTemplate->m_numUiStrings = 2;
  1720. curTemplate->m_uiStrings[0] = " ";
  1721. curTemplate->m_uiStrings[1] = " is removed from the world.";
  1722. curTemplate = &m_actionTemplates[ScriptAction::TEAM_DELETE];
  1723. curTemplate->m_internalName = "TEAM_DELETE";
  1724. curTemplate->m_uiName = "Team_/Damage or Remove/Delete a team.";
  1725. curTemplate->m_numParameters = 1;
  1726. curTemplate->m_parameters[0] = Parameter::TEAM;
  1727. curTemplate->m_numUiStrings = 2;
  1728. curTemplate->m_uiStrings[0] = " ";
  1729. curTemplate->m_uiStrings[1] = " is removed from the world.";
  1730. curTemplate = &m_actionTemplates[ScriptAction::TEAM_DELETE_LIVING];
  1731. curTemplate->m_internalName = "TEAM_DELETE_LIVING";
  1732. curTemplate->m_uiName = "Team_/Damage or Remove/Delete a team, but ignore dead guys.";
  1733. curTemplate->m_numParameters = 1;
  1734. curTemplate->m_parameters[0] = Parameter::TEAM;
  1735. curTemplate->m_numUiStrings = 2;
  1736. curTemplate->m_uiStrings[0] = "Each living member of team ";
  1737. curTemplate->m_uiStrings[1] = " is removed from the world.";
  1738. curTemplate = &m_actionTemplates[ScriptAction::NAMED_KILL];
  1739. curTemplate->m_internalName = "NAMED_KILL";
  1740. curTemplate->m_uiName = "Unit_/Damage or Remove/Kill a specific unit.";
  1741. curTemplate->m_numParameters = 1;
  1742. curTemplate->m_parameters[0] = Parameter::UNIT;
  1743. curTemplate->m_numUiStrings = 2;
  1744. curTemplate->m_uiStrings[0] = " ";
  1745. curTemplate->m_uiStrings[1] = "is dealt a lethal amount of damage.";
  1746. curTemplate = &m_actionTemplates[ScriptAction::TEAM_KILL];
  1747. curTemplate->m_internalName = "TEAM_KILL";
  1748. curTemplate->m_uiName = "Team_/Damage or Remove/Kill an entire team.";
  1749. curTemplate->m_numParameters = 1;
  1750. curTemplate->m_parameters[0] = Parameter::TEAM;
  1751. curTemplate->m_numUiStrings = 2;
  1752. curTemplate->m_uiStrings[0] = " ";
  1753. curTemplate->m_uiStrings[1] = " is dealt a lethal amount of damage.";
  1754. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_KILL];
  1755. curTemplate->m_internalName = "PLAYER_KILL";
  1756. curTemplate->m_uiName = "Player_/Damage or Remove/Kill a player.";
  1757. curTemplate->m_numParameters = 1;
  1758. curTemplate->m_parameters[0] = Parameter::SIDE;
  1759. curTemplate->m_numUiStrings = 2;
  1760. curTemplate->m_uiStrings[0] = "All of ";
  1761. curTemplate->m_uiStrings[1] = "'s buildings and units are dealt a lethal amount of damage.";
  1762. curTemplate = &m_actionTemplates[ScriptAction::DISPLAY_TEXT];
  1763. curTemplate->m_internalName = "DISPLAY_TEXT";
  1764. curTemplate->m_uiName = "User_/String/Display a string.";
  1765. curTemplate->m_numParameters = 1;
  1766. curTemplate->m_parameters[0] = Parameter::LOCALIZED_TEXT;
  1767. curTemplate->m_numUiStrings = 2;
  1768. curTemplate->m_uiStrings[0] = "Displays ";
  1769. curTemplate->m_uiStrings[1] = " in the text log and message area.";
  1770. curTemplate = &m_actionTemplates[ScriptAction::DISPLAY_CINEMATIC_TEXT];
  1771. curTemplate->m_internalName = "DISPLAY_CINEMATIC_TEXT";
  1772. curTemplate->m_uiName = "User_/String/Display a cinematic string.";
  1773. curTemplate->m_numParameters = 3;
  1774. curTemplate->m_parameters[0] = Parameter::LOCALIZED_TEXT;
  1775. curTemplate->m_parameters[1] = Parameter::FONT_NAME;
  1776. curTemplate->m_parameters[2] = Parameter::INT;
  1777. curTemplate->m_numUiStrings = 4;
  1778. curTemplate->m_uiStrings[0] = "Displays ";
  1779. curTemplate->m_uiStrings[1] = " with font type ";
  1780. curTemplate->m_uiStrings[2] = " in the bottom letterbox for ";
  1781. curTemplate->m_uiStrings[3] = " seconds.";
  1782. curTemplate = &m_actionTemplates[ScriptAction::CAMEO_FLASH];
  1783. curTemplate->m_internalName = "CAMEO_FLASH";
  1784. curTemplate->m_uiName = "User_/Flash/Flash a cameo for a specified amount of time.";
  1785. curTemplate->m_numParameters = 2;
  1786. curTemplate->m_parameters[0] = Parameter::COMMAND_BUTTON;
  1787. curTemplate->m_parameters[1] = Parameter::INT;
  1788. curTemplate->m_numUiStrings = 3;
  1789. curTemplate->m_uiStrings[0] = " ";
  1790. curTemplate->m_uiStrings[1] = " flashes for ";
  1791. curTemplate->m_uiStrings[2] = " seconds.";
  1792. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FLASH];
  1793. curTemplate->m_internalName = "NAMED_FLASH";
  1794. curTemplate->m_uiName = "User_/Flash/Flash a specific unit for a specified amount of time.";
  1795. curTemplate->m_numParameters = 2;
  1796. curTemplate->m_parameters[0] = Parameter::UNIT;
  1797. curTemplate->m_parameters[1] = Parameter::INT;
  1798. curTemplate->m_numUiStrings = 3;
  1799. curTemplate->m_uiStrings[0] = " ";
  1800. curTemplate->m_uiStrings[1] = " flashes for ";
  1801. curTemplate->m_uiStrings[2] = " seconds.";
  1802. curTemplate = &m_actionTemplates[ScriptAction::TEAM_FLASH];
  1803. curTemplate->m_internalName = "TEAM_FLASH";
  1804. curTemplate->m_uiName = "User_/Flash/Flash a team for a specified amount of time.";
  1805. curTemplate->m_numParameters = 2;
  1806. curTemplate->m_parameters[0] = Parameter::TEAM;
  1807. curTemplate->m_parameters[1] = Parameter::INT;
  1808. curTemplate->m_numUiStrings = 3;
  1809. curTemplate->m_uiStrings[0] = " ";
  1810. curTemplate->m_uiStrings[1] = " flashes for ";
  1811. curTemplate->m_uiStrings[2] = " seconds.";
  1812. curTemplate = &m_actionTemplates[ScriptAction::NAMED_CUSTOM_COLOR];
  1813. curTemplate->m_internalName = "NAMED_CUSTOM_COLOR";
  1814. curTemplate->m_uiName = "User_/Flash/Set a specific unit to use a special indicator color.";
  1815. curTemplate->m_numParameters = 2;
  1816. curTemplate->m_parameters[0] = Parameter::UNIT;
  1817. curTemplate->m_parameters[1] = Parameter::COLOR;
  1818. curTemplate->m_numUiStrings = 3;
  1819. curTemplate->m_uiStrings[0] = " ";
  1820. curTemplate->m_uiStrings[1] = " uses the color ";
  1821. curTemplate->m_uiStrings[2] = " .";
  1822. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FLASH_WHITE];
  1823. curTemplate->m_internalName = "NAMED_FLASH_WHITE";
  1824. curTemplate->m_uiName = "User_/Flash/Flash a specific unit white for a specified amount of time.";
  1825. curTemplate->m_numParameters = 2;
  1826. curTemplate->m_parameters[0] = Parameter::UNIT;
  1827. curTemplate->m_parameters[1] = Parameter::INT;
  1828. curTemplate->m_numUiStrings = 3;
  1829. curTemplate->m_uiStrings[0] = " ";
  1830. curTemplate->m_uiStrings[1] = " flashes white for ";
  1831. curTemplate->m_uiStrings[2] = " seconds.";
  1832. curTemplate = &m_actionTemplates[ScriptAction::TEAM_FLASH_WHITE];
  1833. curTemplate->m_internalName = "TEAM_FLASH_WHITE";
  1834. curTemplate->m_uiName = "User_/Flash/Flash a team white for a specified amount of time.";
  1835. curTemplate->m_numParameters = 2;
  1836. curTemplate->m_parameters[0] = Parameter::TEAM;
  1837. curTemplate->m_parameters[1] = Parameter::INT;
  1838. curTemplate->m_numUiStrings = 3;
  1839. curTemplate->m_uiStrings[0] = " ";
  1840. curTemplate->m_uiStrings[1] = " flashes white for ";
  1841. curTemplate->m_uiStrings[2] = " seconds.";
  1842. curTemplate = &m_actionTemplates[ScriptAction::INGAME_POPUP_MESSAGE];
  1843. curTemplate->m_internalName = "INGAME_POPUP_MESSAGE";
  1844. curTemplate->m_uiName = "User_/String/Display Popup Message Box.";
  1845. curTemplate->m_numParameters = 5;
  1846. curTemplate->m_parameters[0] = Parameter::LOCALIZED_TEXT;
  1847. curTemplate->m_parameters[1] = Parameter::INT;
  1848. curTemplate->m_parameters[2] = Parameter::INT;
  1849. curTemplate->m_parameters[3] = Parameter::INT;
  1850. curTemplate->m_parameters[4] = Parameter::BOOLEAN;
  1851. curTemplate->m_numUiStrings = 6;
  1852. curTemplate->m_uiStrings[0] = "Displays ";
  1853. curTemplate->m_uiStrings[1] = " at ";
  1854. curTemplate->m_uiStrings[2] = " percent of the screen Width ";
  1855. curTemplate->m_uiStrings[3] = " percent of the screen Height and a width of ";
  1856. curTemplate->m_uiStrings[4] = " pixels and pauses the game (";
  1857. curTemplate->m_uiStrings[5] = " )";
  1858. curTemplate = &m_actionTemplates[ScriptAction::MOVIE_PLAY_FULLSCREEN];
  1859. curTemplate->m_internalName = "MOVIE_PLAY_FULLSCREEN";
  1860. curTemplate->m_uiName = "Multimedia_/Movie/Play a movie in fullscreen mode.";
  1861. curTemplate->m_numParameters = 1;
  1862. curTemplate->m_parameters[0] = Parameter::MOVIE;
  1863. curTemplate->m_numUiStrings = 2;
  1864. curTemplate->m_uiStrings[0] = " ";
  1865. curTemplate->m_uiStrings[1] = " plays fullscreen.";
  1866. curTemplate = &m_actionTemplates[ScriptAction::MOVIE_PLAY_RADAR];
  1867. curTemplate->m_internalName = "MOVIE_PLAY_RADAR";
  1868. curTemplate->m_uiName = "Multimedia_/Movie/Play a movie in the radar.";
  1869. curTemplate->m_numParameters = 1;
  1870. curTemplate->m_parameters[0] = Parameter::MOVIE;
  1871. curTemplate->m_numUiStrings = 2;
  1872. curTemplate->m_uiStrings[0] = " ";
  1873. curTemplate->m_uiStrings[1] = " plays in the radar window.";
  1874. curTemplate = &m_actionTemplates[ScriptAction::SOUND_PLAY_NAMED];
  1875. curTemplate->m_internalName = "SOUND_PLAY_NAMED";
  1876. curTemplate->m_uiName = "Multimedia_/Sound Effects/Play a sound as though coming from a specific unit.";
  1877. curTemplate->m_numParameters = 2;
  1878. curTemplate->m_parameters[0] = Parameter::TEXT_STRING;
  1879. curTemplate->m_parameters[1] = Parameter::UNIT;
  1880. curTemplate->m_numUiStrings = 2;
  1881. curTemplate->m_uiStrings[0] = " ";
  1882. curTemplate->m_uiStrings[1] = " plays as though coming from ";
  1883. curTemplate = &m_actionTemplates[ScriptAction::SPEECH_PLAY];
  1884. curTemplate->m_internalName = "SPEECH_PLAY";
  1885. curTemplate->m_uiName = "Multimedia_/Sound Effects/Play a speech file.";
  1886. curTemplate->m_numParameters = 2;
  1887. curTemplate->m_parameters[0] = Parameter::DIALOG;
  1888. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  1889. curTemplate->m_numUiStrings = 3;
  1890. curTemplate->m_uiStrings[0] = " ";
  1891. curTemplate->m_uiStrings[1] = " plays, allowing overlap ";
  1892. curTemplate->m_uiStrings[2] = " (true to allow, false to disallow).";
  1893. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_TRANSFER_OWNERSHIP_PLAYER];
  1894. curTemplate->m_internalName = "PLAYER_TRANSFER_OWNERSHIP_PLAYER";
  1895. curTemplate->m_uiName = "Player_/Transfer/Transfer assets from one player to another player.";
  1896. curTemplate->m_numParameters = 2;
  1897. curTemplate->m_parameters[0] = Parameter::SIDE;
  1898. curTemplate->m_parameters[1] = Parameter::SIDE;
  1899. curTemplate->m_numUiStrings = 2;
  1900. curTemplate->m_uiStrings[0] = "All assets of ";
  1901. curTemplate->m_uiStrings[1] = " are transferred to ";
  1902. curTemplate = &m_actionTemplates[ScriptAction::NAMED_TRANSFER_OWNERSHIP_PLAYER];
  1903. curTemplate->m_internalName = "NAMED_TRANSFER_OWNERSHIP_PLAYER";
  1904. curTemplate->m_uiName = "Player_/Transfer/Transfer a specific unit to the control of a player.";
  1905. curTemplate->m_numParameters = 2;
  1906. curTemplate->m_parameters[0] = Parameter::UNIT;
  1907. curTemplate->m_parameters[1] = Parameter::SIDE;
  1908. curTemplate->m_numUiStrings = 2;
  1909. curTemplate->m_uiStrings[0] = " ";
  1910. curTemplate->m_uiStrings[1] = " is transferred to the command of ";
  1911. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_EXCLUDE_FROM_SCORE_SCREEN];
  1912. curTemplate->m_internalName = "PLAYER_EXCLUDE_FROM_SCORE_SCREEN";
  1913. curTemplate->m_uiName = "Player_/Score/Exclude this player from the score screen.";
  1914. curTemplate->m_numParameters = 1;
  1915. curTemplate->m_parameters[0] = Parameter::SIDE;
  1916. curTemplate->m_numUiStrings = 2;
  1917. curTemplate->m_uiStrings[0] = "Exclude ";
  1918. curTemplate->m_uiStrings[1] = " from the score screen.";
  1919. curTemplate = &m_actionTemplates[ScriptAction::ENABLE_SCORING];
  1920. curTemplate->m_internalName = "ENABLE_SCORING";
  1921. curTemplate->m_uiName = "Player_/Score/Turn on scoring.";
  1922. curTemplate->m_numParameters = 0;
  1923. curTemplate->m_numUiStrings = 1;
  1924. curTemplate->m_uiStrings[0] = "Turn on scoring.";
  1925. curTemplate = &m_actionTemplates[ScriptAction::DISABLE_SCORING];
  1926. curTemplate->m_internalName = "DISABLE_SCORING";
  1927. curTemplate->m_uiName = "Player_/Score/Turn off scoring.";
  1928. curTemplate->m_numParameters = 0;
  1929. curTemplate->m_numUiStrings = 1;
  1930. curTemplate->m_uiStrings[0] = "Turn off scoring.";
  1931. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_RELATES_PLAYER];
  1932. curTemplate->m_internalName = "PLAYER_RELATES_PLAYER";
  1933. curTemplate->m_uiName = "Player_/Alliances/Change how a player relates to another player.";
  1934. curTemplate->m_numParameters = 3;
  1935. curTemplate->m_parameters[0] = Parameter::SIDE;
  1936. curTemplate->m_parameters[1] = Parameter::SIDE;
  1937. curTemplate->m_parameters[2] = Parameter::RELATION;
  1938. curTemplate->m_numUiStrings = 3;
  1939. curTemplate->m_uiStrings[0] = " ";
  1940. curTemplate->m_uiStrings[1] = " considers ";
  1941. curTemplate->m_uiStrings[2] = " to be ";
  1942. curTemplate = &m_actionTemplates[ScriptAction::RADAR_CREATE_EVENT];
  1943. curTemplate->m_internalName = "RADAR_CREATE_EVENT";
  1944. curTemplate->m_uiName = "Radar_/Create Event/Create a radar event at a specified location.";
  1945. curTemplate->m_numParameters = 2;
  1946. curTemplate->m_parameters[0] = Parameter::COORD3D;
  1947. curTemplate->m_parameters[1] = Parameter::RADAR_EVENT_TYPE;
  1948. curTemplate->m_numUiStrings = 2;
  1949. curTemplate->m_uiStrings[0] = "A radar event occurs at ";
  1950. curTemplate->m_uiStrings[1] = " of type ";
  1951. curTemplate = &m_actionTemplates[ScriptAction::OBJECT_CREATE_RADAR_EVENT];
  1952. curTemplate->m_internalName = "OBJECT_CREATE_RADAR_EVENT";
  1953. curTemplate->m_uiName = "Radar_/Create Event/Create a radar event at a specific object.";
  1954. curTemplate->m_numParameters = 2;
  1955. curTemplate->m_parameters[0] = Parameter::UNIT;
  1956. curTemplate->m_parameters[1] = Parameter::RADAR_EVENT_TYPE;
  1957. curTemplate->m_numUiStrings = 2;
  1958. curTemplate->m_uiStrings[0] = "A radar event occurs at ";
  1959. curTemplate->m_uiStrings[1] = " of type ";
  1960. curTemplate = &m_actionTemplates[ScriptAction::TEAM_CREATE_RADAR_EVENT];
  1961. curTemplate->m_internalName = "TEAM_CREATE_RADAR_EVENT";
  1962. curTemplate->m_uiName = "Radar_/Create Event/Create a radar event at a specific team.";
  1963. curTemplate->m_numParameters = 2;
  1964. curTemplate->m_parameters[0] = Parameter::TEAM;
  1965. curTemplate->m_parameters[1] = Parameter::RADAR_EVENT_TYPE;
  1966. curTemplate->m_numUiStrings = 2;
  1967. curTemplate->m_uiStrings[0] = "A radar event occurs at ";
  1968. curTemplate->m_uiStrings[1] = " of type ";
  1969. curTemplate = &m_actionTemplates[ScriptAction::RADAR_DISABLE];
  1970. curTemplate->m_internalName = "RADAR_DISABLE";
  1971. curTemplate->m_uiName = "Radar_/Control/Disable the radar.";
  1972. curTemplate->m_numParameters = 0;
  1973. curTemplate->m_numUiStrings = 1;
  1974. curTemplate->m_uiStrings[0] = "The radar is disabled.";
  1975. curTemplate = &m_actionTemplates[ScriptAction::RADAR_ENABLE];
  1976. curTemplate->m_internalName = "RADAR_ENABLE";
  1977. curTemplate->m_uiName = "Radar_/Control/Enable the radar.";
  1978. curTemplate->m_numParameters = 0;
  1979. curTemplate->m_numUiStrings = 1;
  1980. curTemplate->m_uiStrings[0] = "The radar is enabled.";
  1981. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_STEALTH_ENABLED];
  1982. curTemplate->m_internalName = "NAMED_SET_STEALTH_ENABLED";
  1983. curTemplate->m_uiName = "Unit_/Status/Stealth set enabled or disabled.";
  1984. curTemplate->m_numParameters = 2;
  1985. curTemplate->m_parameters[0] = Parameter::UNIT;
  1986. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  1987. curTemplate->m_numUiStrings = 3;
  1988. curTemplate->m_uiStrings[0] = "Set ";
  1989. curTemplate->m_uiStrings[1] = " stealth ability to ";
  1990. curTemplate->m_uiStrings[2] = ".";
  1991. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_STEALTH_ENABLED];
  1992. curTemplate->m_internalName = "TEAM_SET_STEALTH_ENABLED";
  1993. curTemplate->m_uiName = "Team_/Status/Stealth set enabled or disabled.";
  1994. curTemplate->m_numParameters = 2;
  1995. curTemplate->m_parameters[0] = Parameter::TEAM;
  1996. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  1997. curTemplate->m_numUiStrings = 3;
  1998. curTemplate->m_uiStrings[0] = "Set ";
  1999. curTemplate->m_uiStrings[1] = " stealth ability to ";
  2000. curTemplate->m_uiStrings[2] = ".";
  2001. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_UNMANNED_STATUS];
  2002. curTemplate->m_internalName = "NAMED_SET_UNMANNED_STATUS";
  2003. curTemplate->m_uiName = "Unit_/Status/Make unmanned.";
  2004. curTemplate->m_numParameters = 1;
  2005. curTemplate->m_parameters[0] = Parameter::UNIT;
  2006. curTemplate->m_numUiStrings = 2;
  2007. curTemplate->m_uiStrings[0] = "Make ";
  2008. curTemplate->m_uiStrings[1] = " unmanned.";
  2009. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_UNMANNED_STATUS];
  2010. curTemplate->m_internalName = "TEAM_SET_UNMANNED_STATUS";
  2011. curTemplate->m_uiName = "Team_/Status/Make unmanned.";
  2012. curTemplate->m_numParameters = 1;
  2013. curTemplate->m_parameters[0] = Parameter::TEAM;
  2014. curTemplate->m_numUiStrings = 2;
  2015. curTemplate->m_uiStrings[0] = "Make ";
  2016. curTemplate->m_uiStrings[1] = " unmanned.";
  2017. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_BOOBYTRAPPED];
  2018. curTemplate->m_internalName = "NAMED_SET_BOOBYTRAPPED";
  2019. curTemplate->m_uiName = "Unit_/Status/Add boobytrap.";
  2020. curTemplate->m_numParameters = 2;
  2021. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  2022. curTemplate->m_parameters[1] = Parameter::UNIT;
  2023. curTemplate->m_numUiStrings = 3;
  2024. curTemplate->m_uiStrings[0] = "Add boobytrap of type ";
  2025. curTemplate->m_uiStrings[1] = " to ";
  2026. curTemplate->m_uiStrings[2] = ".";
  2027. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_BOOBYTRAPPED];
  2028. curTemplate->m_internalName = "TEAM_SET_BOOBYTRAPPED";
  2029. curTemplate->m_uiName = "Team_/Status/Add boobytrap.";
  2030. curTemplate->m_numParameters = 2;
  2031. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  2032. curTemplate->m_parameters[1] = Parameter::TEAM;
  2033. curTemplate->m_numUiStrings = 3;
  2034. curTemplate->m_uiStrings[0] = "Add boobytrap of type ";
  2035. curTemplate->m_uiStrings[1] = " to team ";
  2036. curTemplate->m_uiStrings[2] = ".";
  2037. curTemplate = &m_actionTemplates[ScriptAction::MAP_REVEAL_AT_WAYPOINT];
  2038. curTemplate->m_internalName = "MAP_REVEAL_AT_WAYPOINT";
  2039. curTemplate->m_uiName = "Map_/Shroud or Reveal/Reveal map at waypoint -- fog.";
  2040. curTemplate->m_numParameters = 3;
  2041. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  2042. curTemplate->m_parameters[1] = Parameter::REAL;
  2043. curTemplate->m_parameters[2] = Parameter::SIDE;
  2044. curTemplate->m_numUiStrings = 4;
  2045. curTemplate->m_uiStrings[0] = "The map is revealed at ";
  2046. curTemplate->m_uiStrings[1] = " with a radius of ";
  2047. curTemplate->m_uiStrings[2] = " feet for ";
  2048. curTemplate->m_uiStrings[3] = ".";
  2049. curTemplate = &m_actionTemplates[ScriptAction::MAP_SHROUD_AT_WAYPOINT];
  2050. curTemplate->m_internalName = "MAP_SHROUD_AT_WAYPOINT";
  2051. curTemplate->m_uiName = "Map_/Shroud or Reveal/Shroud map at waypoint -- add fog.";
  2052. curTemplate->m_numParameters = 3;
  2053. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  2054. curTemplate->m_parameters[1] = Parameter::REAL;
  2055. curTemplate->m_parameters[2] = Parameter::SIDE;
  2056. curTemplate->m_numUiStrings = 4;
  2057. curTemplate->m_uiStrings[0] = "The map is shrouded at ";
  2058. curTemplate->m_uiStrings[1] = " with a radius of ";
  2059. curTemplate->m_uiStrings[2] = " feet for ";
  2060. curTemplate->m_uiStrings[3] = ".";
  2061. curTemplate = &m_actionTemplates[ScriptAction::MAP_REVEAL_ALL];
  2062. curTemplate->m_internalName = "MAP_REVEAL_ALL";
  2063. curTemplate->m_uiName = "Map_/Shroud or Reveal/Reveal the entire map for a player.";
  2064. curTemplate->m_numParameters = 1;
  2065. curTemplate->m_parameters[0] = Parameter::SIDE;
  2066. curTemplate->m_numUiStrings = 2;
  2067. curTemplate->m_uiStrings[0] = "The world is revealed for ";
  2068. curTemplate->m_uiStrings[1] = ".";
  2069. curTemplate = &m_actionTemplates[ScriptAction::MAP_REVEAL_ALL_PERM];
  2070. curTemplate->m_internalName = "MAP_REVEAL_ALL_PERM";
  2071. curTemplate->m_uiName = "Map_/Shroud or Reveal/Reveal the entire map permanently for a player.";
  2072. curTemplate->m_numParameters = 1;
  2073. curTemplate->m_parameters[0] = Parameter::SIDE;
  2074. curTemplate->m_numUiStrings = 2;
  2075. curTemplate->m_uiStrings[0] = "The world is revealed permanently for ";
  2076. curTemplate->m_uiStrings[1] = ".";
  2077. curTemplate = &m_actionTemplates[ScriptAction::MAP_REVEAL_ALL_UNDO_PERM];
  2078. curTemplate->m_internalName = "MAP_REVEAL_ALL_UNDO_PERM";
  2079. curTemplate->m_uiName = "Map_/Shroud or Reveal/Un-Reveal the entire map permanently for a player.";
  2080. curTemplate->m_numParameters = 1;
  2081. curTemplate->m_parameters[0] = Parameter::SIDE;
  2082. curTemplate->m_numUiStrings = 2;
  2083. curTemplate->m_uiStrings[0] = "Undo the permanent reveal for ";
  2084. curTemplate->m_uiStrings[1] = ". This will mess things up badly if called when there has been no permanent reveal.";
  2085. curTemplate = &m_actionTemplates[ScriptAction::MAP_SHROUD_ALL];
  2086. curTemplate->m_internalName = "MAP_SHROUD_ALL";
  2087. curTemplate->m_uiName = "Map_/Shroud or Reveal/Shroud the entire map for a player.";
  2088. curTemplate->m_numParameters = 1;
  2089. curTemplate->m_parameters[0] = Parameter::SIDE;
  2090. curTemplate->m_numUiStrings = 2;
  2091. curTemplate->m_uiStrings[0] = "The world is shrouded for ";
  2092. curTemplate->m_uiStrings[1] = ".";
  2093. curTemplate = &m_actionTemplates[ScriptAction::DISABLE_BORDER_SHROUD];
  2094. curTemplate->m_internalName = "DISABLE_BORDER_SHROUD";
  2095. curTemplate->m_uiName = "Map_/Shroud or Reveal/Border Shroud is turned off.";
  2096. curTemplate->m_numParameters = 0;
  2097. curTemplate->m_numUiStrings = 1;
  2098. curTemplate->m_uiStrings[0] = "Shroud off the map edges is turned off.";
  2099. curTemplate = &m_actionTemplates[ScriptAction::ENABLE_BORDER_SHROUD];
  2100. curTemplate->m_internalName = "ENABLE_BORDER_SHROUD";
  2101. curTemplate->m_uiName = "Map_/Shroud or Reveal/Border Shroud is turned on.";
  2102. curTemplate->m_numParameters = 0;
  2103. curTemplate->m_numUiStrings = 1;
  2104. curTemplate->m_uiStrings[0] = "Shroud off the map edges is turned on.";
  2105. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GARRISON_SPECIFIC_BUILDING];
  2106. curTemplate->m_internalName = "TEAM_GARRISON_SPECIFIC_BUILDING";
  2107. curTemplate->m_uiName = "Team_/Garrison/Garrison a specific building with a team.";
  2108. curTemplate->m_numParameters = 2;
  2109. curTemplate->m_parameters[0] = Parameter::TEAM;
  2110. curTemplate->m_parameters[1] = Parameter::UNIT;
  2111. curTemplate->m_numUiStrings = 2;
  2112. curTemplate->m_uiStrings[0] = " ";
  2113. curTemplate->m_uiStrings[1] = " enters into building named ";
  2114. curTemplate = &m_actionTemplates[ScriptAction::EXIT_SPECIFIC_BUILDING];
  2115. curTemplate->m_internalName = "EXIT_SPECIFIC_BUILDING";
  2116. curTemplate->m_uiName = "Unit_/Garrison/Empty a specific building.";
  2117. curTemplate->m_numParameters = 1;
  2118. curTemplate->m_parameters[0] = Parameter::UNIT;
  2119. curTemplate->m_numUiStrings = 2;
  2120. curTemplate->m_uiStrings[0] = " ";
  2121. curTemplate->m_uiStrings[1] = " empties.";
  2122. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GARRISON_NEAREST_BUILDING];
  2123. curTemplate->m_internalName = "TEAM_GARRISON_NEAREST_BUILDING";
  2124. curTemplate->m_uiName = "Team_/Garrison/Garrison a nearby building with a team.";
  2125. curTemplate->m_numParameters = 1;
  2126. curTemplate->m_parameters[0] = Parameter::TEAM;
  2127. curTemplate->m_numUiStrings = 2;
  2128. curTemplate->m_uiStrings[0] = " ";
  2129. curTemplate->m_uiStrings[1] = " garrison a nearby building.";
  2130. curTemplate = &m_actionTemplates[ScriptAction::TEAM_EXIT_ALL_BUILDINGS];
  2131. curTemplate->m_internalName = "TEAM_EXIT_ALL_BUILDINGS";
  2132. curTemplate->m_uiName = "Team_/Garrison/Exit all buildings a team is in.";
  2133. curTemplate->m_numParameters = 1;
  2134. curTemplate->m_parameters[0] = Parameter::TEAM;
  2135. curTemplate->m_numUiStrings = 2;
  2136. curTemplate->m_uiStrings[0] = " ";
  2137. curTemplate->m_uiStrings[1] = " exits all buildings.";
  2138. curTemplate = &m_actionTemplates[ScriptAction::NAMED_GARRISON_SPECIFIC_BUILDING];
  2139. curTemplate->m_internalName = "NAMED_GARRISON_SPECIFIC_BUILDING";
  2140. curTemplate->m_uiName = "Unit_/Garrison/Garrison a specific building with a specific unit.";
  2141. curTemplate->m_numParameters = 2;
  2142. curTemplate->m_parameters[0] = Parameter::UNIT;
  2143. curTemplate->m_parameters[1] = Parameter::UNIT;
  2144. curTemplate->m_numUiStrings = 2;
  2145. curTemplate->m_uiStrings[0] = " ";
  2146. curTemplate->m_uiStrings[1] = " garrison building ";
  2147. curTemplate = &m_actionTemplates[ScriptAction::NAMED_GARRISON_NEAREST_BUILDING];
  2148. curTemplate->m_internalName = "NAMED_GARRISON_NEAREST_BUILDING";
  2149. curTemplate->m_uiName = "Unit_/Garrison/Garrison a nearby building with a specific unit.";
  2150. curTemplate->m_numParameters = 1;
  2151. curTemplate->m_parameters[0] = Parameter::UNIT;
  2152. curTemplate->m_numUiStrings = 2;
  2153. curTemplate->m_uiStrings[0] = " ";
  2154. curTemplate->m_uiStrings[1] = " garrison a nearby building.";
  2155. curTemplate = &m_actionTemplates[ScriptAction::NAMED_EXIT_BUILDING];
  2156. curTemplate->m_internalName = "NAMED_EXIT_BUILDING";
  2157. curTemplate->m_uiName = "Unit_/Garrison/Exit the building the unit is in.";
  2158. curTemplate->m_numParameters = 1;
  2159. curTemplate->m_parameters[0] = Parameter::UNIT;
  2160. curTemplate->m_numUiStrings = 2;
  2161. curTemplate->m_uiStrings[0] = " ";
  2162. curTemplate->m_uiStrings[1] = " leaves the building.";
  2163. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_GARRISON_ALL_BUILDINGS];
  2164. curTemplate->m_internalName = "PLAYER_GARRISON_ALL_BUILDINGS";
  2165. curTemplate->m_uiName = "Player_/Garrison/Garrison as many buildings as player has units for.";
  2166. curTemplate->m_numParameters = 1;
  2167. curTemplate->m_parameters[0] = Parameter::SIDE;
  2168. curTemplate->m_numUiStrings = 2;
  2169. curTemplate->m_uiStrings[0] = " ";
  2170. curTemplate->m_uiStrings[1] = " garrison buildings.";
  2171. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_EXIT_ALL_BUILDINGS];
  2172. curTemplate->m_internalName = "PLAYER_EXIT_ALL_BUILDINGS";
  2173. curTemplate->m_uiName = "Player_/Garrison/All units leave their garrisons.";
  2174. curTemplate->m_numParameters = 1;
  2175. curTemplate->m_parameters[0] = Parameter::SIDE;
  2176. curTemplate->m_numUiStrings = 2;
  2177. curTemplate->m_uiStrings[0] = " ";
  2178. curTemplate->m_uiStrings[1] = " evacuate.";
  2179. curTemplate = &m_actionTemplates[ScriptAction::TEAM_AVAILABLE_FOR_RECRUITMENT];
  2180. curTemplate->m_internalName = "TEAM_AVAILABLE_FOR_RECRUITMENT";
  2181. curTemplate->m_uiName = "Team_/AI/Set whether members of a team can be recruited into another team.";
  2182. curTemplate->m_numParameters = 2;
  2183. curTemplate->m_parameters[0] = Parameter::TEAM;
  2184. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  2185. curTemplate->m_numUiStrings = 2;
  2186. curTemplate->m_uiStrings[0] = " ";
  2187. curTemplate->m_uiStrings[1] = " sets their willingness to join teams to ";
  2188. curTemplate = &m_actionTemplates[ScriptAction::TEAM_COLLECT_NEARBY_FOR_TEAM];
  2189. curTemplate->m_internalName = "TEAM_COLLECT_NEARBY_FOR_TEAM";
  2190. curTemplate->m_uiName = "Team_/AI/Set to collect nearby units.";
  2191. curTemplate->m_numParameters = 1;
  2192. curTemplate->m_parameters[0] = Parameter::TEAM;
  2193. curTemplate->m_numUiStrings = 2;
  2194. curTemplate->m_uiStrings[0] = " ";
  2195. curTemplate->m_uiStrings[1] = " attempts to collect nearby units for a team.";
  2196. curTemplate = &m_actionTemplates[ScriptAction::TEAM_MERGE_INTO_TEAM];
  2197. curTemplate->m_internalName = "TEAM_MERGE_INTO_TEAM";
  2198. curTemplate->m_uiName = "Team_/Merge/Merge a team into another team.";
  2199. curTemplate->m_numParameters = 2;
  2200. curTemplate->m_parameters[0] = Parameter::TEAM;
  2201. curTemplate->m_parameters[1] = Parameter::TEAM;
  2202. curTemplate->m_numUiStrings = 2;
  2203. curTemplate->m_uiStrings[0] = " ";
  2204. curTemplate->m_uiStrings[1] = " merges onto ";
  2205. curTemplate = &m_actionTemplates[ScriptAction::IDLE_ALL_UNITS];
  2206. curTemplate->m_internalName = "IDLE_ALL_UNITS";
  2207. curTemplate->m_uiName = "Scripting_/Idle or Restart/Idle all units for all players.";
  2208. curTemplate->m_numParameters = 0;
  2209. curTemplate->m_numUiStrings = 1;
  2210. curTemplate->m_uiStrings[0] = "Idle all units for all players.";
  2211. curTemplate = &m_actionTemplates[ScriptAction::RESUME_SUPPLY_TRUCKING];
  2212. curTemplate->m_internalName = "RESUME_SUPPLY_TRUCKING";
  2213. curTemplate->m_uiName = "Scripting_/Idle or Restart/All idle Supply Trucks attempt to resume supply routes.";
  2214. curTemplate->m_numParameters = 0;
  2215. curTemplate->m_numUiStrings = 1;
  2216. curTemplate->m_uiStrings[0] = "All idle Supply Trucks attempt to resume supply routes.";
  2217. curTemplate = &m_actionTemplates[ScriptAction::DISABLE_INPUT];
  2218. curTemplate->m_internalName = "DISABLE_INPUT";
  2219. curTemplate->m_uiName = "User_/Input/User input -- disable.";
  2220. curTemplate->m_numParameters = 0;
  2221. curTemplate->m_numUiStrings = 1;
  2222. curTemplate->m_uiStrings[0] = "Disable mouse and keyboard input.";
  2223. curTemplate = &m_actionTemplates[ScriptAction::ENABLE_INPUT];
  2224. curTemplate->m_internalName = "ENABLE_INPUT";
  2225. curTemplate->m_uiName = "User_/Input/User input -- enable.";
  2226. curTemplate->m_numParameters = 0;
  2227. curTemplate->m_numUiStrings = 1;
  2228. curTemplate->m_uiStrings[0] = "Enable mouse and keyboard input.";
  2229. curTemplate = &m_actionTemplates[ScriptAction::SOUND_AMBIENT_PAUSE];
  2230. curTemplate->m_internalName = "SOUND_AMBIENT_PAUSE";
  2231. curTemplate->m_uiName = "Multimedia_/SoundEffects/Pause the ambient sounds.";
  2232. curTemplate->m_numParameters = 0;
  2233. curTemplate->m_numUiStrings = 1;
  2234. curTemplate->m_uiStrings[0] = "Pause the ambient sounds.";
  2235. curTemplate = &m_actionTemplates[ScriptAction::SOUND_AMBIENT_RESUME];
  2236. curTemplate->m_internalName = "SOUND_AMBIENT_RESUME";
  2237. curTemplate->m_uiName = "Multimedia_/SoundEffects/Resume the ambient sounds.";
  2238. curTemplate->m_numParameters = 0;
  2239. curTemplate->m_numUiStrings = 1;
  2240. curTemplate->m_uiStrings[0] = "Resume the ambient sounds.";
  2241. curTemplate = &m_actionTemplates[ScriptAction::MUSIC_SET_TRACK];
  2242. curTemplate->m_internalName = "MUSIC_SET_TRACK";
  2243. curTemplate->m_uiName = "Multimedia_/Music/Play a music track.";
  2244. curTemplate->m_numParameters = 3;
  2245. curTemplate->m_parameters[0] = Parameter::MUSIC;
  2246. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  2247. curTemplate->m_parameters[2] = Parameter::BOOLEAN;
  2248. curTemplate->m_numUiStrings = 4;
  2249. curTemplate->m_uiStrings[0] = "Play ";
  2250. curTemplate->m_uiStrings[1] = " using fadeout (";
  2251. curTemplate->m_uiStrings[2] = ") and fadein (";
  2252. curTemplate->m_uiStrings[3] = ").";
  2253. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_LETTERBOX_BEGIN];
  2254. curTemplate->m_internalName = "CAMERA_LETTERBOX_BEGIN";
  2255. curTemplate->m_uiName = "Camera_/Letterbox/Start letterbox mode.";
  2256. curTemplate->m_numParameters = 0;
  2257. curTemplate->m_numUiStrings = 1;
  2258. curTemplate->m_uiStrings[0] = "Start letterbox mode (hide UI, add border).";
  2259. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_LETTERBOX_END];
  2260. curTemplate->m_internalName = "CAMERA_LETTERBOX_END";
  2261. curTemplate->m_uiName = "Camera_/ End letterbox mode.";
  2262. curTemplate->m_numParameters = 0;
  2263. curTemplate->m_numUiStrings = 1;
  2264. curTemplate->m_uiStrings[0] = "End letterbox mode (show UI, remove border).";
  2265. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_BW_MODE_BEGIN];
  2266. curTemplate->m_internalName = "CAMERA_BW_MODE_BEGIN";
  2267. curTemplate->m_uiName = "Camera_/Fade Effects/Start black & white mode.";
  2268. curTemplate->m_numParameters = 1;
  2269. curTemplate->m_parameters[0] = Parameter::INT;
  2270. curTemplate->m_numUiStrings = 1;
  2271. curTemplate->m_uiStrings[0] = "Frames to fade into black & white mode = ";
  2272. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_BW_MODE_END];
  2273. curTemplate->m_internalName = "CAMERA_BW_MODE_END";
  2274. curTemplate->m_uiName = "Camera_/Fade Effects/End black & white mode.";
  2275. curTemplate->m_numParameters = 1;
  2276. curTemplate->m_numUiStrings = 1;
  2277. curTemplate->m_uiStrings[0] = "Frames to fade into color mode = ";
  2278. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOTION_BLUR];
  2279. curTemplate->m_internalName = "CAMERA_MOTION_BLUR";
  2280. curTemplate->m_uiName = "Camera_/Fade Effects/Motion blur zoom.";
  2281. curTemplate->m_numParameters = 2;
  2282. curTemplate->m_parameters[0] = Parameter::BOOLEAN;
  2283. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  2284. curTemplate->m_numUiStrings = 2;
  2285. curTemplate->m_uiStrings[0] = "Blur zoom, zoom in = ";
  2286. curTemplate->m_uiStrings[1] = " (true=zoom in, false = zoom out), saturate colors = ";
  2287. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOTION_BLUR_JUMP];
  2288. curTemplate->m_internalName = "CAMERA_MOTION_BLUR_JUMP";
  2289. curTemplate->m_uiName = "Camera_/Fade Effects/Motion blur zoom with jump cut.";
  2290. curTemplate->m_numParameters = 2;
  2291. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  2292. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  2293. curTemplate->m_numUiStrings = 2;
  2294. curTemplate->m_uiStrings[0] = "Blur zoom, zoom in at current location, zoom out at ";
  2295. curTemplate->m_uiStrings[1] = ", saturate colors = ";
  2296. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOTION_BLUR_FOLLOW];
  2297. curTemplate->m_internalName = "CAMERA_MOTION_BLUR_FOLLOW";
  2298. curTemplate->m_uiName = "Camera_/Fade Effects/Start motion blur as the camera moves.";
  2299. curTemplate->m_numParameters = 1;
  2300. curTemplate->m_parameters[1] = Parameter::INT;
  2301. curTemplate->m_numUiStrings = 2;
  2302. curTemplate->m_uiStrings[0] = "Start motion blur as the camera moves, amount= ";
  2303. curTemplate->m_uiStrings[1] = " (start with 30 and adjust up or down). ";
  2304. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_MOTION_BLUR_END_FOLLOW];
  2305. curTemplate->m_internalName = "CAMERA_MOTION_BLUR_END_FOLLOW";
  2306. curTemplate->m_uiName = "Camera_/Fade Effects/End motion blur as the camera moves.";
  2307. curTemplate->m_numParameters = 0;
  2308. curTemplate->m_numUiStrings = 1;
  2309. curTemplate->m_uiStrings[0] = "End motion blur as the camera moves.";
  2310. curTemplate = &m_actionTemplates[ScriptAction::DRAW_SKYBOX_BEGIN];
  2311. curTemplate->m_internalName = "DRAW_SKYBOX_BEGIN";
  2312. curTemplate->m_uiName = "Camera_/Skybox/Start skybox mode.";
  2313. curTemplate->m_numParameters = 0;
  2314. curTemplate->m_numUiStrings = 1;
  2315. curTemplate->m_uiStrings[0] = "Start skybox mode (draw sky background).";
  2316. curTemplate = &m_actionTemplates[ScriptAction::DRAW_SKYBOX_END];
  2317. curTemplate->m_internalName = "DRAW_SKYBOX_END";
  2318. curTemplate->m_uiName = "Camera_/Skybox/End skybox mode.";
  2319. curTemplate->m_numParameters = 0;
  2320. curTemplate->m_numUiStrings = 1;
  2321. curTemplate->m_uiStrings[0] = "End skybox mode (draw black background).";
  2322. curTemplate = &m_actionTemplates[ScriptAction::FREEZE_TIME];
  2323. curTemplate->m_internalName = "FREEZE_TIME";
  2324. curTemplate->m_uiName = "Scripting_/Time/Freeze time.";
  2325. curTemplate->m_numParameters = 0;
  2326. curTemplate->m_numUiStrings = 1;
  2327. curTemplate->m_uiStrings[0] = "Freeze time.";
  2328. curTemplate = &m_actionTemplates[ScriptAction::UNFREEZE_TIME];
  2329. curTemplate->m_internalName = "UNFREEZE_TIME";
  2330. curTemplate->m_uiName = "Scripting_/Time/Unfreeze time.";
  2331. curTemplate->m_numParameters = 0;
  2332. curTemplate->m_numUiStrings = 1;
  2333. curTemplate->m_uiStrings[0] = "Unfreeze time.";
  2334. curTemplate = &m_actionTemplates[ScriptAction::SHOW_MILITARY_CAPTION];
  2335. curTemplate->m_internalName = "SHOW_MILITARY_CAPTION";
  2336. curTemplate->m_uiName = "Scripting_/Briefing/Show military briefing caption.";
  2337. curTemplate->m_numParameters = 2;
  2338. curTemplate->m_parameters[0] = Parameter::TEXT_STRING;
  2339. curTemplate->m_parameters[1] = Parameter::INT;
  2340. curTemplate->m_numUiStrings = 3;
  2341. curTemplate->m_uiStrings[0] = "Show military briefing ";
  2342. curTemplate->m_uiStrings[1] = " for ";
  2343. curTemplate->m_uiStrings[2] = " milliseconds.";
  2344. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_SET_AUDIBLE_DISTANCE];
  2345. curTemplate->m_internalName = "CAMERA_SET_AUDIBLE_DISTANCE";
  2346. curTemplate->m_uiName = "Camera_/Sounds/Set the audible distance for camera-up shots.";
  2347. curTemplate->m_numParameters = 1;
  2348. curTemplate->m_parameters[0] = Parameter::REAL;
  2349. curTemplate->m_numUiStrings = 2;
  2350. curTemplate->m_uiStrings[0] = "Set the audible range during camera-up shots to ";
  2351. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_HELD];
  2352. curTemplate->m_internalName = "NAMED_SET_HELD";
  2353. curTemplate->m_uiName = "Unit_/Move/Set unit to be held in place, ignoring Physics, Locomotors, etc.";
  2354. curTemplate->m_numParameters = 2;
  2355. curTemplate->m_parameters[0] = Parameter::UNIT;
  2356. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  2357. curTemplate->m_numUiStrings = 3;
  2358. curTemplate->m_uiStrings[0] = "Set Held status for ";
  2359. curTemplate->m_uiStrings[1] = " to ";
  2360. curTemplate->m_uiStrings[2] = ".";
  2361. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_STOPPING_DISTANCE];
  2362. curTemplate->m_internalName = "NAMED_SET_STOPPING_DISTANCE";
  2363. curTemplate->m_uiName = "Unit_/Move/Set stopping distance for current locomotor.";
  2364. curTemplate->m_numParameters = 2;
  2365. curTemplate->m_parameters[0] = Parameter::UNIT;
  2366. curTemplate->m_parameters[1] = Parameter::REAL;
  2367. curTemplate->m_numUiStrings = 3;
  2368. curTemplate->m_uiStrings[0] = "Set stopping distance for ";
  2369. curTemplate->m_uiStrings[1] = " to ";
  2370. curTemplate->m_uiStrings[2] = ".";
  2371. curTemplate = &m_actionTemplates[ScriptAction::SET_STOPPING_DISTANCE];
  2372. curTemplate->m_internalName = "SET_STOPPING_DISTANCE";
  2373. curTemplate->m_uiName = "Team_/Move/Set stopping distance for each unit's current locomotor.";
  2374. curTemplate->m_numParameters = 2;
  2375. curTemplate->m_parameters[0] = Parameter::TEAM;
  2376. curTemplate->m_parameters[1] = Parameter::REAL;
  2377. curTemplate->m_numUiStrings = 3;
  2378. curTemplate->m_uiStrings[0] = "Set stopping distances for ";
  2379. curTemplate->m_uiStrings[1] = " to ";
  2380. curTemplate->m_uiStrings[2] = ".";
  2381. curTemplate = &m_actionTemplates[ScriptAction::SET_FPS_LIMIT];
  2382. curTemplate->m_internalName = "SET_FPS_LIMIT";
  2383. curTemplate->m_uiName = "Scripting_/ Set max frames per second.";
  2384. curTemplate->m_numParameters = 1;
  2385. curTemplate->m_parameters[0] = Parameter::INT;
  2386. curTemplate->m_numUiStrings = 2;
  2387. curTemplate->m_uiStrings[0] = "Set max FPS to ";
  2388. curTemplate->m_uiStrings[1] = ". (0 sets to default.)";
  2389. curTemplate = &m_actionTemplates[ScriptAction::DISABLE_SPECIAL_POWER_DISPLAY];
  2390. curTemplate->m_internalName = "DISABLE_SPECIAL_POWER_DISPLAY";
  2391. curTemplate->m_uiName = "Scripting_/ Special power countdown display -- disable.";
  2392. curTemplate->m_numParameters = 0;
  2393. curTemplate->m_numUiStrings = 1;
  2394. curTemplate->m_uiStrings[0] = "Disables special power countdown display.";
  2395. curTemplate = &m_actionTemplates[ScriptAction::ENABLE_SPECIAL_POWER_DISPLAY];
  2396. curTemplate->m_internalName = "ENABLE_SPECIAL_POWER_DISPLAY";
  2397. curTemplate->m_uiName = "Scripting_/ Special power countdown display -- enable.";
  2398. curTemplate->m_numParameters = 0;
  2399. curTemplate->m_numUiStrings = 1;
  2400. curTemplate->m_uiStrings[0] = "Enables special power countdown display.";
  2401. curTemplate = &m_actionTemplates[ScriptAction::NAMED_HIDE_SPECIAL_POWER_DISPLAY];
  2402. curTemplate->m_internalName = "NAMED_HIDE_SPECIAL_POWER_DISPLAY";
  2403. curTemplate->m_uiName = "Unit_/ Special power countdown timer -- hide.";
  2404. curTemplate->m_numParameters = 1;
  2405. curTemplate->m_parameters[0] = Parameter::UNIT;
  2406. curTemplate->m_numUiStrings = 2;
  2407. curTemplate->m_uiStrings[0] = "Hides special power countdowns for ";
  2408. curTemplate->m_uiStrings[1] = ".";
  2409. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SHOW_SPECIAL_POWER_DISPLAY];
  2410. curTemplate->m_internalName = "NAMED_SHOW_SPECIAL_POWER_DISPLAY";
  2411. curTemplate->m_uiName = "Unit_/ Special power countdown timer -- display.";
  2412. curTemplate->m_numParameters = 1;
  2413. curTemplate->m_parameters[0] = Parameter::UNIT;
  2414. curTemplate->m_numUiStrings = 2;
  2415. curTemplate->m_uiStrings[0] = "Shows special power countdowns for ";
  2416. curTemplate->m_uiStrings[1] = ".";
  2417. curTemplate = &m_actionTemplates[ScriptAction::MUSIC_SET_VOLUME];
  2418. curTemplate->m_internalName = "MUSIC_SET_VOLUME";
  2419. curTemplate->m_uiName = "Multimedia_/ Set the current music volume.";
  2420. curTemplate->m_numParameters = 1;
  2421. curTemplate->m_parameters[0] = Parameter::REAL;
  2422. curTemplate->m_numUiStrings = 2;
  2423. curTemplate->m_uiStrings[0] = "Set the desired music volume to ";
  2424. curTemplate->m_uiStrings[1] = "%. (0-100)";
  2425. curTemplate = &m_actionTemplates[ScriptAction::TEAM_TRANSFER_TO_PLAYER];
  2426. curTemplate->m_internalName = "TEAM_TRANSFER_TO_PLAYER";
  2427. curTemplate->m_uiName = "Team_/ Transfer control of a team to a player.";
  2428. curTemplate->m_numParameters = 2;
  2429. curTemplate->m_parameters[0] = Parameter::TEAM;
  2430. curTemplate->m_parameters[1] = Parameter::SIDE;
  2431. curTemplate->m_numUiStrings = 2;
  2432. curTemplate->m_uiStrings[0] = "Control of ";
  2433. curTemplate->m_uiStrings[1] = " transfers to ";
  2434. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_SET_MONEY];
  2435. curTemplate->m_internalName = "PLAYER_SET_MONEY";
  2436. curTemplate->m_uiName = "Player_/ Set player's money.";
  2437. curTemplate->m_numParameters = 2;
  2438. curTemplate->m_parameters[0] = Parameter::SIDE;
  2439. curTemplate->m_parameters[1] = Parameter::INT;
  2440. curTemplate->m_numUiStrings = 2;
  2441. curTemplate->m_uiStrings[0] = "Set ";
  2442. curTemplate->m_uiStrings[1] = "'s money to $";
  2443. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_GIVE_MONEY];
  2444. curTemplate->m_internalName = "PLAYER_GIVE_MONEY";
  2445. curTemplate->m_uiName = "Player_/ Gives/takes from player's money.";
  2446. curTemplate->m_numParameters = 2;
  2447. curTemplate->m_parameters[0] = Parameter::SIDE;
  2448. curTemplate->m_parameters[1] = Parameter::INT;
  2449. curTemplate->m_numUiStrings = 2;
  2450. curTemplate->m_uiStrings[0] = " ";
  2451. curTemplate->m_uiStrings[1] = " gets $";
  2452. curTemplate = &m_actionTemplates[ScriptAction::DISPLAY_COUNTER];
  2453. curTemplate->m_internalName = "DISPLAY_COUNTER";
  2454. curTemplate->m_uiName = "Scripting_/ Counter -- display an individual counter to the user.";
  2455. curTemplate->m_numParameters = 2;
  2456. curTemplate->m_parameters[0] = Parameter::COUNTER;
  2457. curTemplate->m_parameters[1] = Parameter::LOCALIZED_TEXT;
  2458. curTemplate->m_numUiStrings = 2;
  2459. curTemplate->m_uiStrings[0] = "Show ";
  2460. curTemplate->m_uiStrings[1] = " with text ";
  2461. curTemplate = &m_actionTemplates[ScriptAction::HIDE_COUNTER];
  2462. curTemplate->m_internalName = "HIDE_COUNTER";
  2463. curTemplate->m_uiName = "Scripting_/ Counter -- hides an individual counter from the user.";
  2464. curTemplate->m_numParameters = 1;
  2465. curTemplate->m_parameters[0] = Parameter::COUNTER;
  2466. curTemplate->m_numUiStrings = 1;
  2467. curTemplate->m_uiStrings[0] = "Hide ";
  2468. curTemplate = &m_actionTemplates[ScriptAction::DISPLAY_COUNTDOWN_TIMER];
  2469. curTemplate->m_internalName = "DISPLAY_COUNTDOWN_TIMER";
  2470. curTemplate->m_uiName = "Scripting_/ Timer -- display an individual timer to the user.";
  2471. curTemplate->m_numParameters = 2;
  2472. curTemplate->m_parameters[0] = Parameter::COUNTER;
  2473. curTemplate->m_parameters[1] = Parameter::LOCALIZED_TEXT;
  2474. curTemplate->m_numUiStrings = 2;
  2475. curTemplate->m_uiStrings[0] = "Show ";
  2476. curTemplate->m_uiStrings[1] = " with text ";
  2477. curTemplate = &m_actionTemplates[ScriptAction::HIDE_COUNTDOWN_TIMER];
  2478. curTemplate->m_internalName = "HIDE_COUNTDOWN_TIMER";
  2479. curTemplate->m_uiName = "Scripting_/ Timer -- hides an individual timer from the user.";
  2480. curTemplate->m_numParameters = 1;
  2481. curTemplate->m_parameters[0] = Parameter::COUNTER;
  2482. curTemplate->m_numUiStrings = 1;
  2483. curTemplate->m_uiStrings[0] = "Hide ";
  2484. curTemplate = &m_actionTemplates[ScriptAction::DISABLE_COUNTDOWN_TIMER_DISPLAY];
  2485. curTemplate->m_internalName = "DISABLE_COUNTDOWN_TIMER_DISPLAY";
  2486. curTemplate->m_uiName = "Scripting_/ Timer -- hide all timers from the user.";
  2487. curTemplate->m_numParameters = 0;
  2488. curTemplate->m_numUiStrings = 1;
  2489. curTemplate->m_uiStrings[0] = "Disables timer display.";
  2490. curTemplate = &m_actionTemplates[ScriptAction::ENABLE_COUNTDOWN_TIMER_DISPLAY];
  2491. curTemplate->m_internalName = "ENABLE_COUNTDOWN_TIMER_DISPLAY";
  2492. curTemplate->m_uiName = "Scripting_/ Timer -- display all timers to the user.";
  2493. curTemplate->m_numParameters = 0;
  2494. curTemplate->m_numUiStrings = 1;
  2495. curTemplate->m_uiStrings[0] = "Enables timer display.";
  2496. curTemplate = &m_actionTemplates[ScriptAction::NAMED_STOP_SPECIAL_POWER_COUNTDOWN];
  2497. curTemplate->m_internalName = "NAMED_STOP_SPECIAL_POWER_COUNTDOWN";
  2498. curTemplate->m_uiName = "Unit_/ Special power countdown timer -- pause.";
  2499. curTemplate->m_numParameters = 2;
  2500. curTemplate->m_parameters[0] = Parameter::UNIT;
  2501. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  2502. curTemplate->m_numUiStrings = 3;
  2503. curTemplate->m_uiStrings[0] = "Pause ";
  2504. curTemplate->m_uiStrings[1] = "'s ";
  2505. curTemplate->m_uiStrings[2] = " countdown.";
  2506. curTemplate = &m_actionTemplates[ScriptAction::NAMED_START_SPECIAL_POWER_COUNTDOWN];
  2507. curTemplate->m_internalName = "NAMED_START_SPECIAL_POWER_COUNTDOWN";
  2508. curTemplate->m_uiName = "Unit_/ Special power countdown timer -- resume.";
  2509. curTemplate->m_numParameters = 2;
  2510. curTemplate->m_parameters[0] = Parameter::UNIT;
  2511. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  2512. curTemplate->m_numUiStrings = 3;
  2513. curTemplate->m_uiStrings[0] = "Resume ";
  2514. curTemplate->m_uiStrings[1] = "'s ";
  2515. curTemplate->m_uiStrings[2] = " countdown.";
  2516. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_SPECIAL_POWER_COUNTDOWN];
  2517. curTemplate->m_internalName = "NAMED_SET_SPECIAL_POWER_COUNTDOWN";
  2518. curTemplate->m_uiName = "Unit_/ Special power countdown timer -- set.";
  2519. curTemplate->m_numParameters = 3;
  2520. curTemplate->m_parameters[0] = Parameter::UNIT;
  2521. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  2522. curTemplate->m_parameters[2] = Parameter::INT;
  2523. curTemplate->m_numUiStrings = 4;
  2524. curTemplate->m_uiStrings[0] = "Set ";
  2525. curTemplate->m_uiStrings[1] = "'s ";
  2526. curTemplate->m_uiStrings[2] = " to ";
  2527. curTemplate->m_uiStrings[3] = " seconds.";
  2528. curTemplate = &m_actionTemplates[ScriptAction::NAMED_ADD_SPECIAL_POWER_COUNTDOWN];
  2529. curTemplate->m_internalName = "NAMED_ADD_SPECIAL_POWER_COUNTDOWN";
  2530. curTemplate->m_uiName = "Unit_/ Special power countdown timer -- add seconds.";
  2531. curTemplate->m_numParameters = 3;
  2532. curTemplate->m_parameters[0] = Parameter::UNIT;
  2533. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  2534. curTemplate->m_parameters[2] = Parameter::INT;
  2535. curTemplate->m_numUiStrings = 4;
  2536. curTemplate->m_uiStrings[0] = " ";
  2537. curTemplate->m_uiStrings[1] = "'s ";
  2538. curTemplate->m_uiStrings[2] = " has ";
  2539. curTemplate->m_uiStrings[3] = " seconds added to it.";
  2540. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_FIRE_SPECIAL_POWER_AT_MOST_COST];
  2541. curTemplate->m_internalName = "SKIRMISH_FIRE_SPECIAL_POWER_AT_MOST_COST";
  2542. curTemplate->m_uiName = "Skirmish_/ Special power -- fire at enemy's highest cost area.";
  2543. curTemplate->m_numParameters = 2;
  2544. curTemplate->m_parameters[0] = Parameter::SIDE;
  2545. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  2546. curTemplate->m_numUiStrings = 2;
  2547. curTemplate->m_uiStrings[0] = " ";
  2548. curTemplate->m_uiStrings[1] = " fire ";
  2549. curTemplate->m_uiStrings[2] = " at enemy's most costly area.";
  2550. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_REPAIR_NAMED_STRUCTURE];
  2551. curTemplate->m_internalName = "PLAYER_REPAIR_NAMED_STRUCTURE";
  2552. curTemplate->m_uiName = "Player_/ Repair named bridge or structure.";
  2553. curTemplate->m_numParameters = 2;
  2554. curTemplate->m_parameters[0] = Parameter::SIDE;
  2555. curTemplate->m_parameters[1] = Parameter::UNIT;
  2556. curTemplate->m_numUiStrings = 3;
  2557. curTemplate->m_uiStrings[0] = "Have ";
  2558. curTemplate->m_uiStrings[1] = " repair ";
  2559. curTemplate->m_uiStrings[2] = ".";
  2560. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FIRE_SPECIAL_POWER_AT_WAYPOINT];
  2561. curTemplate->m_internalName = "NAMED_FIRE_SPECIAL_POWER_AT_WAYPOINT";
  2562. curTemplate->m_uiName = "Unit_/ Special power -- fire at location.";
  2563. curTemplate->m_numParameters = 3;
  2564. curTemplate->m_parameters[0] = Parameter::UNIT;
  2565. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  2566. curTemplate->m_parameters[2] = Parameter::WAYPOINT;
  2567. curTemplate->m_numUiStrings = 4;
  2568. curTemplate->m_uiStrings[0] = " ";
  2569. curTemplate->m_uiStrings[1] = " fires ";
  2570. curTemplate->m_uiStrings[2] = " at ";
  2571. curTemplate->m_uiStrings[3] = ".";
  2572. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FIRE_SPECIAL_POWER_AT_NAMED];
  2573. curTemplate->m_internalName = "NAMED_FIRE_SPECIAL_POWER_AT_NAMED";
  2574. curTemplate->m_uiName = "Unit_/ Special power -- fire at unit.";
  2575. curTemplate->m_numParameters = 3;
  2576. curTemplate->m_parameters[0] = Parameter::UNIT;
  2577. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  2578. curTemplate->m_parameters[2] = Parameter::UNIT;
  2579. curTemplate->m_numUiStrings = 4;
  2580. curTemplate->m_uiStrings[0] = " ";
  2581. curTemplate->m_uiStrings[1] = " fires ";
  2582. curTemplate->m_uiStrings[2] = " at ";
  2583. curTemplate->m_uiStrings[3] = ".";
  2584. curTemplate = &m_actionTemplates[ScriptAction::REFRESH_RADAR];
  2585. curTemplate->m_internalName = "REFRESH_RADAR";
  2586. curTemplate->m_uiName = "Scripting_/ Refresh radar terrain.";
  2587. curTemplate->m_numParameters = 0;
  2588. curTemplate->m_numUiStrings = 1;
  2589. curTemplate->m_uiStrings[0] = "Refresh radar terrain.";
  2590. curTemplate = &m_actionTemplates[ScriptAction::NAMED_STOP];
  2591. curTemplate->m_internalName = "NAMED_STOP";
  2592. curTemplate->m_uiName = "Unit_/ Set a specific unit to stop.";
  2593. curTemplate->m_numParameters = 1;
  2594. curTemplate->m_parameters[0] = Parameter::UNIT;
  2595. curTemplate->m_numUiStrings = 2;
  2596. curTemplate->m_uiStrings[0] = " ";
  2597. curTemplate->m_uiStrings[1] = " stops.";
  2598. curTemplate = &m_actionTemplates[ScriptAction::TEAM_STOP];
  2599. curTemplate->m_internalName = "TEAM_STOP";
  2600. curTemplate->m_uiName = "Team_/ Set to stop.";
  2601. curTemplate->m_numParameters = 1;
  2602. curTemplate->m_parameters[0] = Parameter::TEAM;
  2603. curTemplate->m_numUiStrings = 2;
  2604. curTemplate->m_uiStrings[0] = " ";
  2605. curTemplate->m_uiStrings[1] = " stops.";
  2606. curTemplate = &m_actionTemplates[ScriptAction::TEAM_STOP_AND_DISBAND];
  2607. curTemplate->m_internalName = "TEAM_STOP_AND_DISBAND";
  2608. curTemplate->m_uiName = "Team_/ Set to stop, then disband.";
  2609. curTemplate->m_numParameters = 1;
  2610. curTemplate->m_parameters[0] = Parameter::TEAM;
  2611. curTemplate->m_numUiStrings = 2;
  2612. curTemplate->m_uiStrings[0] = " ";
  2613. curTemplate->m_uiStrings[1] = " stops, then disbands.";
  2614. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_OVERRIDE_RELATION_TO_TEAM];
  2615. curTemplate->m_internalName = "TEAM_SET_OVERRIDE_RELATION_TO_TEAM";
  2616. curTemplate->m_uiName = "Team_/ Override a team's relationship to another team.";
  2617. curTemplate->m_numParameters = 3;
  2618. curTemplate->m_parameters[0] = Parameter::TEAM;
  2619. curTemplate->m_parameters[1] = Parameter::TEAM;
  2620. curTemplate->m_parameters[2] = Parameter::RELATION;
  2621. curTemplate->m_numUiStrings = 4;
  2622. curTemplate->m_uiStrings[0] = " ";
  2623. curTemplate->m_uiStrings[1] = " considers ";
  2624. curTemplate->m_uiStrings[2] = " to be ";
  2625. curTemplate->m_uiStrings[3] = " (rather than using the the player relationship).";
  2626. curTemplate = &m_actionTemplates[ScriptAction::TEAM_REMOVE_OVERRIDE_RELATION_TO_TEAM];
  2627. curTemplate->m_internalName = "TEAM_REMOVE_OVERRIDE_RELATION_TO_TEAM";
  2628. curTemplate->m_uiName = "Team_/ Remove an override to a team's relationship to another team.";
  2629. curTemplate->m_numParameters = 2;
  2630. curTemplate->m_parameters[0] = Parameter::TEAM;
  2631. curTemplate->m_parameters[1] = Parameter::TEAM;
  2632. curTemplate->m_numUiStrings = 2;
  2633. curTemplate->m_uiStrings[0] = " ";
  2634. curTemplate->m_uiStrings[1] = " uses the player relationship to ";
  2635. curTemplate = &m_actionTemplates[ScriptAction::TEAM_REMOVE_ALL_OVERRIDE_RELATIONS];
  2636. curTemplate->m_internalName = "TEAM_REMOVE_ALL_OVERRIDE_RELATIONS";
  2637. curTemplate->m_uiName = "Team_/ Remove all overrides to team's relationship to teams and/or players.";
  2638. curTemplate->m_numParameters = 1;
  2639. curTemplate->m_parameters[0] = Parameter::TEAM;
  2640. curTemplate->m_numUiStrings = 2;
  2641. curTemplate->m_uiStrings[0] = " ";
  2642. curTemplate->m_uiStrings[1] = " uses the player relationship to all other teams and players.";
  2643. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_TETHER_NAMED];
  2644. curTemplate->m_internalName = "CAMERA_TETHER_NAMED";
  2645. curTemplate->m_uiName = "Camera_/ Tether camera to a specific unit.";
  2646. curTemplate->m_numParameters = 3;
  2647. curTemplate->m_parameters[0] = Parameter::UNIT;
  2648. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  2649. curTemplate->m_parameters[2] = Parameter::REAL;
  2650. curTemplate->m_numUiStrings = 4;
  2651. curTemplate->m_uiStrings[0] = "Have the camera tethered to ";
  2652. curTemplate->m_uiStrings[1] = ". Snap camera to object is ";
  2653. curTemplate->m_uiStrings[2] = ". Amount of play is ";
  2654. curTemplate->m_uiStrings[3] = ".";
  2655. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_STOP_TETHER_NAMED];
  2656. curTemplate->m_internalName = "CAMERA_STOP_TETHER_NAMED";
  2657. curTemplate->m_uiName = "Camera_/ Stop tether to any units.";
  2658. curTemplate->m_numParameters = 0;
  2659. curTemplate->m_numUiStrings = 1;
  2660. curTemplate->m_uiStrings[0] = "Stop tether to any units.";
  2661. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_SET_DEFAULT];
  2662. curTemplate->m_internalName = "CAMERA_SET_DEFAULT";
  2663. curTemplate->m_uiName = "Camera_/ Set default camera.";
  2664. curTemplate->m_numParameters = 3;
  2665. curTemplate->m_parameters[0] = Parameter::REAL;
  2666. curTemplate->m_parameters[1] = Parameter::REAL;
  2667. curTemplate->m_parameters[2] = Parameter::REAL;
  2668. curTemplate->m_numUiStrings = 4;
  2669. curTemplate->m_uiStrings[0] = "Camera Pitch = ";
  2670. curTemplate->m_uiStrings[1] = "(0.0==default), angle = ";
  2671. curTemplate->m_uiStrings[2] = "(0.0 is N, 90.0 is W, etc), height = ";
  2672. curTemplate->m_uiStrings[3] = "(1.0==default).";
  2673. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_LOOK_TOWARD_OBJECT];
  2674. curTemplate->m_internalName = "CAMERA_LOOK_TOWARD_OBJECT";
  2675. curTemplate->m_uiName = "Camera (R)_/ Rotate toward unit.";
  2676. curTemplate->m_numParameters = 5;
  2677. curTemplate->m_parameters[0] = Parameter::UNIT;
  2678. curTemplate->m_parameters[1] = Parameter::REAL;
  2679. curTemplate->m_parameters[2] = Parameter::REAL;
  2680. curTemplate->m_parameters[3] = Parameter::REAL;
  2681. curTemplate->m_parameters[4] = Parameter::REAL;
  2682. curTemplate->m_numUiStrings = 6;
  2683. curTemplate->m_uiStrings[0] = "Rotate toward ";
  2684. curTemplate->m_uiStrings[1] = ", taking ";
  2685. curTemplate->m_uiStrings[2] = " seconds and holding ";
  2686. curTemplate->m_uiStrings[3] = " seconds, ease-in ";
  2687. curTemplate->m_uiStrings[4] = " seconds, ease-out ";
  2688. curTemplate->m_uiStrings[5] = " seconds.";
  2689. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_LOOK_TOWARD_WAYPOINT];
  2690. curTemplate->m_internalName = "CAMERA_LOOK_TOWARD_WAYPOINT";
  2691. curTemplate->m_uiName = "Camera (R)_/ Rotate to look at a waypoint.";
  2692. curTemplate->m_numParameters = 5;
  2693. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  2694. curTemplate->m_parameters[1] = Parameter::REAL;
  2695. curTemplate->m_parameters[2] = Parameter::REAL;
  2696. curTemplate->m_parameters[3] = Parameter::REAL;
  2697. curTemplate->m_parameters[4] = Parameter::BOOLEAN;
  2698. curTemplate->m_numUiStrings = 6;
  2699. curTemplate->m_uiStrings[0] = "Rotate to look at ";
  2700. curTemplate->m_uiStrings[1] = ", taking ";
  2701. curTemplate->m_uiStrings[2] = " seconds, ease-in ";
  2702. curTemplate->m_uiStrings[3] = " seconds, ease-out ";
  2703. curTemplate->m_uiStrings[4] = " seconds, reverse rotation ";
  2704. curTemplate->m_uiStrings[5] = ".";
  2705. curTemplate = &m_actionTemplates[ScriptAction::UNIT_DESTROY_ALL_CONTAINED];
  2706. curTemplate->m_internalName = "UNIT_DESTROY_ALL_CONTAINED";
  2707. curTemplate->m_uiName = "Unit_/ Kill all units contained within a specific transport or structure.";
  2708. curTemplate->m_numParameters = 1;
  2709. curTemplate->m_parameters[0] = Parameter::UNIT;
  2710. // curTemplate->m_parameters[1] = Parameter::INT;
  2711. curTemplate->m_numUiStrings = 2;
  2712. curTemplate->m_uiStrings[0] = "All units inside ";
  2713. curTemplate->m_uiStrings[1] = " are killed.";
  2714. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FIRE_WEAPON_FOLLOWING_WAYPOINT_PATH];
  2715. curTemplate->m_internalName = "NAMED_FIRE_WEAPON_FOLLOWING_WAYPOINT_PATH";
  2716. curTemplate->m_uiName = "Unit_/ Fire waypoint-weapon following waypoint path.";
  2717. curTemplate->m_numParameters = 2;
  2718. curTemplate->m_parameters[0] = Parameter::UNIT;
  2719. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  2720. curTemplate->m_numUiStrings = 3;
  2721. curTemplate->m_uiStrings[0] = " ";
  2722. curTemplate->m_uiStrings[1] = " fire waypoint-weapon following waypoints starting at ";
  2723. curTemplate->m_uiStrings[2] = ".";
  2724. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_OVERRIDE_RELATION_TO_PLAYER];
  2725. curTemplate->m_internalName = "TEAM_SET_OVERRIDE_RELATION_TO_PLAYER";
  2726. curTemplate->m_uiName = "Team_/ Override a team's relationship to another player.";
  2727. curTemplate->m_numParameters = 3;
  2728. curTemplate->m_parameters[0] = Parameter::TEAM;
  2729. curTemplate->m_parameters[1] = Parameter::SIDE;
  2730. curTemplate->m_parameters[2] = Parameter::RELATION;
  2731. curTemplate->m_numUiStrings = 4;
  2732. curTemplate->m_uiStrings[0] = " ";
  2733. curTemplate->m_uiStrings[1] = " considers ";
  2734. curTemplate->m_uiStrings[2] = " to be ";
  2735. curTemplate->m_uiStrings[3] = " (rather than using the the player relationship).";
  2736. curTemplate = &m_actionTemplates[ScriptAction::TEAM_REMOVE_OVERRIDE_RELATION_TO_PLAYER];
  2737. curTemplate->m_internalName = "TEAM_REMOVE_OVERRIDE_RELATION_TO_PLAYER";
  2738. curTemplate->m_uiName = "Team_/ Remove an override to a team's relationship to another player.";
  2739. curTemplate->m_numParameters = 2;
  2740. curTemplate->m_parameters[0] = Parameter::TEAM;
  2741. curTemplate->m_parameters[1] = Parameter::SIDE;
  2742. curTemplate->m_numUiStrings = 2;
  2743. curTemplate->m_uiStrings[0] = " ";
  2744. curTemplate->m_uiStrings[1] = " uses the player relationship to ";
  2745. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_SET_OVERRIDE_RELATION_TO_TEAM];
  2746. curTemplate->m_internalName = "PLAYER_SET_OVERRIDE_RELATION_TO_TEAM";
  2747. curTemplate->m_uiName = "Player_/ Override a player's relationship to another team.";
  2748. curTemplate->m_numParameters = 3;
  2749. curTemplate->m_parameters[0] = Parameter::SIDE;
  2750. curTemplate->m_parameters[1] = Parameter::TEAM;
  2751. curTemplate->m_parameters[2] = Parameter::RELATION;
  2752. curTemplate->m_numUiStrings = 4;
  2753. curTemplate->m_uiStrings[0] = " ";
  2754. curTemplate->m_uiStrings[1] = " considers ";
  2755. curTemplate->m_uiStrings[2] = " to be ";
  2756. curTemplate->m_uiStrings[3] = " (rather than using the the player relationship).";
  2757. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_REMOVE_OVERRIDE_RELATION_TO_TEAM];
  2758. curTemplate->m_internalName = "PLAYER_REMOVE_OVERRIDE_RELATION_TO_TEAM";
  2759. curTemplate->m_uiName = "Player_/ Remove an override to a player's relationship to another team.";
  2760. curTemplate->m_numParameters = 2;
  2761. curTemplate->m_parameters[0] = Parameter::SIDE;
  2762. curTemplate->m_parameters[1] = Parameter::TEAM;
  2763. curTemplate->m_numUiStrings = 2;
  2764. curTemplate->m_uiStrings[0] = " ";
  2765. curTemplate->m_uiStrings[1] = " uses the player relationship to ";
  2766. curTemplate = &m_actionTemplates[ScriptAction::UNIT_EXECUTE_SEQUENTIAL_SCRIPT];
  2767. curTemplate->m_internalName = "UNIT_EXECUTE_SEQUENTIAL_SCRIPT";
  2768. curTemplate->m_uiName = "Unit_/ Set a specific unit to execute a script sequentially.";
  2769. curTemplate->m_numParameters = 2;
  2770. curTemplate->m_parameters[0] = Parameter::UNIT;
  2771. curTemplate->m_parameters[1] = Parameter::SCRIPT;
  2772. curTemplate->m_numUiStrings = 3;
  2773. curTemplate->m_uiStrings[0] = " ";
  2774. curTemplate->m_uiStrings[1] = " executes ";
  2775. curTemplate->m_uiStrings[2] = " sequentially.";
  2776. curTemplate = &m_actionTemplates[ScriptAction::UNIT_EXECUTE_SEQUENTIAL_SCRIPT_LOOPING];
  2777. curTemplate->m_internalName = "UNIT_EXECUTE_SEQUENTIAL_SCRIPT_LOOPING";
  2778. curTemplate->m_uiName = "Unit_/ Set a specific unit to execute a looping sequential script.";
  2779. curTemplate->m_numParameters = 3;
  2780. curTemplate->m_parameters[0] = Parameter::UNIT;
  2781. curTemplate->m_parameters[1] = Parameter::SCRIPT;
  2782. curTemplate->m_parameters[2] = Parameter::INT;
  2783. curTemplate->m_numUiStrings = 4;
  2784. curTemplate->m_uiStrings[0] = " ";
  2785. curTemplate->m_uiStrings[1] = " executes ";
  2786. curTemplate->m_uiStrings[2] = " sequentially, ";
  2787. curTemplate->m_uiStrings[3] = " times. (0=forever)";
  2788. curTemplate = &m_actionTemplates[ScriptAction::TEAM_EXECUTE_SEQUENTIAL_SCRIPT];
  2789. curTemplate->m_internalName = "TEAM_EXECUTE_SEQUENTIAL_SCRIPT";
  2790. curTemplate->m_uiName = "Team_/ Execute script sequentially -- start.";
  2791. curTemplate->m_numParameters = 2;
  2792. curTemplate->m_parameters[0] = Parameter::TEAM;
  2793. curTemplate->m_parameters[1] = Parameter::SCRIPT;
  2794. curTemplate->m_numUiStrings = 3;
  2795. curTemplate->m_uiStrings[0] = " ";
  2796. curTemplate->m_uiStrings[1] = " executes ";
  2797. curTemplate->m_uiStrings[2] = " sequentially.";
  2798. curTemplate = &m_actionTemplates[ScriptAction::TEAM_EXECUTE_SEQUENTIAL_SCRIPT_LOOPING];
  2799. curTemplate->m_internalName = "TEAM_EXECUTE_SEQUENTIAL_SCRIPT_LOOPING";
  2800. curTemplate->m_uiName = "Team_/ Execute script sequentially -- looping.";
  2801. curTemplate->m_numParameters = 3;
  2802. curTemplate->m_parameters[0] = Parameter::TEAM;
  2803. curTemplate->m_parameters[1] = Parameter::SCRIPT;
  2804. curTemplate->m_parameters[2] = Parameter::INT;
  2805. curTemplate->m_numUiStrings = 4;
  2806. curTemplate->m_uiStrings[0] = " ";
  2807. curTemplate->m_uiStrings[1] = " executes ";
  2808. curTemplate->m_uiStrings[2] = " sequentially, ";
  2809. curTemplate->m_uiStrings[3] = " times. (0=forever)";
  2810. curTemplate = &m_actionTemplates[ScriptAction::UNIT_STOP_SEQUENTIAL_SCRIPT];
  2811. curTemplate->m_internalName = "UNIT_STOP_SEQUENTIAL_SCRIPT";
  2812. curTemplate->m_uiName = "Unit_/ Set a specific unit to stop executing a sequential script.";
  2813. curTemplate->m_numParameters = 1;
  2814. curTemplate->m_parameters[0] = Parameter::UNIT;
  2815. curTemplate->m_numUiStrings = 2;
  2816. curTemplate->m_uiStrings[0] = " ";
  2817. curTemplate->m_uiStrings[1] = " stops executing.";
  2818. curTemplate = &m_actionTemplates[ScriptAction::TEAM_STOP_SEQUENTIAL_SCRIPT];
  2819. curTemplate->m_internalName = "TEAM_STOP_SEQUENTIAL_SCRIPT";
  2820. curTemplate->m_uiName = "Team_/ Execute script sequentially -- stop.";
  2821. curTemplate->m_numParameters = 1;
  2822. curTemplate->m_parameters[0] = Parameter::TEAM;
  2823. curTemplate->m_numUiStrings = 2;
  2824. curTemplate->m_uiStrings[0] = " ";
  2825. curTemplate->m_uiStrings[1] = " stops executing.";
  2826. curTemplate = &m_actionTemplates[ScriptAction::UNIT_GUARD_FOR_FRAMECOUNT];
  2827. curTemplate->m_internalName = "UNIT_GUARD_FOR_FRAMECOUNT";
  2828. curTemplate->m_uiName = "Unit_/ Set to guard for some number of frames.";
  2829. curTemplate->m_numParameters = 2;
  2830. curTemplate->m_parameters[0] = Parameter::UNIT;
  2831. curTemplate->m_parameters[1] = Parameter::INT;
  2832. curTemplate->m_numUiStrings = 3;
  2833. curTemplate->m_uiStrings[0] = " ";
  2834. curTemplate->m_uiStrings[1] = " guards for ";
  2835. curTemplate->m_uiStrings[2] = " frames.";
  2836. curTemplate = &m_actionTemplates[ScriptAction::UNIT_IDLE_FOR_FRAMECOUNT];
  2837. curTemplate->m_internalName = "UNIT_IDLE_FOR_FRAMECOUNT";
  2838. curTemplate->m_uiName = "Unit_/ Set to idle for some number of frames.";
  2839. curTemplate->m_numParameters = 2;
  2840. curTemplate->m_parameters[0] = Parameter::UNIT;
  2841. curTemplate->m_parameters[1] = Parameter::INT;
  2842. curTemplate->m_numUiStrings = 3;
  2843. curTemplate->m_uiStrings[0] = " ";
  2844. curTemplate->m_uiStrings[1] = " idles for ";
  2845. curTemplate->m_uiStrings[2] = " frames.";
  2846. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GUARD_FOR_FRAMECOUNT];
  2847. curTemplate->m_internalName = "TEAM_GUARD_FOR_FRAMECOUNT";
  2848. curTemplate->m_uiName = "Team_/ Set to guard -- number of frames.";
  2849. curTemplate->m_numParameters = 2;
  2850. curTemplate->m_parameters[0] = Parameter::TEAM;
  2851. curTemplate->m_parameters[1] = Parameter::INT;
  2852. curTemplate->m_numUiStrings = 3;
  2853. curTemplate->m_uiStrings[0] = " ";
  2854. curTemplate->m_uiStrings[1] = " guards for ";
  2855. curTemplate->m_uiStrings[2] = " frames.";
  2856. curTemplate = &m_actionTemplates[ScriptAction::TEAM_IDLE_FOR_FRAMECOUNT];
  2857. curTemplate->m_internalName = "TEAM_IDLE_FOR_FRAMECOUNT";
  2858. curTemplate->m_uiName = "Team_/ Set to idle for some number of frames.";
  2859. curTemplate->m_numParameters = 2;
  2860. curTemplate->m_parameters[0] = Parameter::TEAM;
  2861. curTemplate->m_parameters[1] = Parameter::INT;
  2862. curTemplate->m_numUiStrings = 3;
  2863. curTemplate->m_uiStrings[0] = " ";
  2864. curTemplate->m_uiStrings[1] = " idles for ";
  2865. curTemplate->m_uiStrings[2] = " frames.";
  2866. curTemplate = &m_actionTemplates[ScriptAction::WATER_CHANGE_HEIGHT];
  2867. curTemplate->m_internalName = "WATER_CHANGE_HEIGHT";
  2868. curTemplate->m_uiName = "Map_/ Adjust water height to a new level";
  2869. curTemplate->m_numParameters = 2;
  2870. curTemplate->m_parameters[0] = Parameter::TRIGGER_AREA;
  2871. curTemplate->m_parameters[1] = Parameter::REAL;
  2872. curTemplate->m_numUiStrings = 2;
  2873. curTemplate->m_uiStrings[0] = " ";
  2874. curTemplate->m_uiStrings[1] = " changes altitude to ";
  2875. curTemplate = &m_actionTemplates[ ScriptAction::WATER_CHANGE_HEIGHT_OVER_TIME ];
  2876. curTemplate->m_internalName = "WATER_CHANGE_HEIGHT_OVER_TIME";
  2877. curTemplate->m_uiName = "Map_/ Adjust water height to a new level with damage over time";
  2878. curTemplate->m_numParameters = 4;
  2879. curTemplate->m_parameters[0] = Parameter::TRIGGER_AREA;
  2880. curTemplate->m_parameters[1] = Parameter::REAL;
  2881. curTemplate->m_parameters[2] = Parameter::REAL;
  2882. curTemplate->m_parameters[3] = Parameter::REAL;
  2883. curTemplate->m_numUiStrings = 5;
  2884. curTemplate->m_uiStrings[0] = " ";
  2885. curTemplate->m_uiStrings[1] = " changes altitude to ";
  2886. curTemplate->m_uiStrings[2] = " in ";
  2887. curTemplate->m_uiStrings[3] = " seconds doing ";
  2888. curTemplate->m_uiStrings[4] = " dam_/sec.";
  2889. curTemplate = &m_actionTemplates[ ScriptAction::NAMED_USE_COMMANDBUTTON_ABILITY ];
  2890. curTemplate->m_internalName = "NAMED_USE_COMMANDBUTTON_ABILITY";
  2891. curTemplate->m_uiName = "Unit_/ Use commandbutton ability.";
  2892. curTemplate->m_numParameters = 2;
  2893. curTemplate->m_parameters[0] = Parameter::UNIT;
  2894. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ABILITY;
  2895. curTemplate->m_numUiStrings = 3;
  2896. curTemplate->m_uiStrings[0] = " ";
  2897. curTemplate->m_uiStrings[1] = " use ";
  2898. curTemplate->m_uiStrings[2] = ".";
  2899. curTemplate = &m_actionTemplates[ ScriptAction::NAMED_USE_COMMANDBUTTON_ABILITY_ON_NAMED ];
  2900. curTemplate->m_internalName = "NAMED_USE_COMMANDBUTTON_ABILITY_ON_NAMED";
  2901. curTemplate->m_uiName = "Unit_/ Use commandbutton ability on an object.";
  2902. curTemplate->m_numParameters = 3;
  2903. curTemplate->m_parameters[0] = Parameter::UNIT;
  2904. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ABILITY;
  2905. curTemplate->m_parameters[2] = Parameter::UNIT;
  2906. curTemplate->m_numUiStrings = 4;
  2907. curTemplate->m_uiStrings[0] = " ";
  2908. curTemplate->m_uiStrings[1] = " use ";
  2909. curTemplate->m_uiStrings[2] = " on ";
  2910. curTemplate->m_uiStrings[3] = ".";
  2911. curTemplate = &m_actionTemplates[ ScriptAction::NAMED_USE_COMMANDBUTTON_ABILITY_AT_WAYPOINT ];
  2912. curTemplate->m_internalName = "NAMED_USE_COMMANDBUTTON_ABILITY_AT_WAYPOINT";
  2913. curTemplate->m_uiName = "Unit_/ Use commandbutton ability at a waypoint.";
  2914. curTemplate->m_numParameters = 3;
  2915. curTemplate->m_parameters[0] = Parameter::UNIT;
  2916. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ABILITY;
  2917. curTemplate->m_parameters[2] = Parameter::WAYPOINT;
  2918. curTemplate->m_numUiStrings = 4;
  2919. curTemplate->m_uiStrings[0] = " ";
  2920. curTemplate->m_uiStrings[1] = " use ";
  2921. curTemplate->m_uiStrings[2] = " at ";
  2922. curTemplate->m_uiStrings[3] = ".";
  2923. curTemplate = &m_actionTemplates[ ScriptAction::NAMED_USE_COMMANDBUTTON_ABILITY_USING_WAYPOINT_PATH ];
  2924. curTemplate->m_internalName = "NAMED_USE_COMMANDBUTTON_ABILITY_USING_WAYPOINT_PATH";
  2925. curTemplate->m_uiName = "Unit_/ Use commandbutton ability using a waypoint path.";
  2926. curTemplate->m_numParameters = 3;
  2927. curTemplate->m_parameters[0] = Parameter::UNIT;
  2928. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ABILITY;
  2929. curTemplate->m_parameters[2] = Parameter::WAYPOINT_PATH;
  2930. curTemplate->m_numUiStrings = 4;
  2931. curTemplate->m_uiStrings[0] = " ";
  2932. curTemplate->m_uiStrings[1] = " use ";
  2933. curTemplate->m_uiStrings[2] = " to follow ";
  2934. curTemplate->m_uiStrings[3] = " path.";
  2935. curTemplate = &m_actionTemplates[ ScriptAction::TEAM_USE_COMMANDBUTTON_ABILITY ];
  2936. curTemplate->m_internalName = "TEAM_USE_COMMANDBUTTON_ABILITY";
  2937. curTemplate->m_uiName = "Team_/ Use commandbutton ability.";
  2938. curTemplate->m_numParameters = 2;
  2939. curTemplate->m_parameters[0] = Parameter::TEAM;
  2940. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  2941. curTemplate->m_numUiStrings = 3;
  2942. curTemplate->m_uiStrings[0] = " ";
  2943. curTemplate->m_uiStrings[1] = " use ";
  2944. curTemplate->m_uiStrings[2] = ".";
  2945. curTemplate = &m_actionTemplates[ ScriptAction::TEAM_USE_COMMANDBUTTON_ABILITY_ON_NAMED ];
  2946. curTemplate->m_internalName = "TEAM_USE_COMMANDBUTTON_ABILITY_ON_NAMED";
  2947. curTemplate->m_uiName = "Team_/ Use commandbutton ability on an object.";
  2948. curTemplate->m_numParameters = 3;
  2949. curTemplate->m_parameters[0] = Parameter::TEAM;
  2950. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  2951. curTemplate->m_parameters[2] = Parameter::UNIT;
  2952. curTemplate->m_numUiStrings = 4;
  2953. curTemplate->m_uiStrings[0] = " ";
  2954. curTemplate->m_uiStrings[1] = " use ";
  2955. curTemplate->m_uiStrings[2] = " on ";
  2956. curTemplate->m_uiStrings[3] = ".";
  2957. curTemplate = &m_actionTemplates[ ScriptAction::TEAM_USE_COMMANDBUTTON_ABILITY_AT_WAYPOINT ];
  2958. curTemplate->m_internalName = "TEAM_USE_COMMANDBUTTON_ABILITY_AT_WAYPOINT";
  2959. curTemplate->m_uiName = "Team_/ Use commandbutton ability at a waypoint.";
  2960. curTemplate->m_numParameters = 3;
  2961. curTemplate->m_parameters[0] = Parameter::TEAM;
  2962. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  2963. curTemplate->m_parameters[2] = Parameter::WAYPOINT;
  2964. curTemplate->m_numUiStrings = 4;
  2965. curTemplate->m_uiStrings[0] = " ";
  2966. curTemplate->m_uiStrings[1] = " use ";
  2967. curTemplate->m_uiStrings[2] = " at ";
  2968. curTemplate->m_uiStrings[3] = ".";
  2969. curTemplate = &m_actionTemplates[ScriptAction::MAP_SWITCH_BORDER];
  2970. curTemplate->m_internalName = "MAP_SWITCH_BORDER";
  2971. curTemplate->m_uiName = "Map_/ Change the active boundary.";
  2972. curTemplate->m_numParameters = 1;
  2973. curTemplate->m_parameters[0] = Parameter::BOUNDARY;
  2974. curTemplate->m_numUiStrings = 2;
  2975. curTemplate->m_uiStrings[0] = " ";
  2976. curTemplate->m_uiStrings[1] = " becomes the active border.";
  2977. curTemplate = &m_actionTemplates[ScriptAction::OBJECT_FORCE_SELECT];
  2978. curTemplate->m_internalName = "OBJECT_FORCE_SELECT";
  2979. curTemplate->m_uiName = "Scripting_/ Select the first object type on a team.";
  2980. curTemplate->m_numParameters = 4;
  2981. curTemplate->m_parameters[0] = Parameter::TEAM;
  2982. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  2983. curTemplate->m_parameters[2] = Parameter::BOOLEAN;
  2984. curTemplate->m_parameters[3] = Parameter::DIALOG;
  2985. curTemplate->m_numUiStrings = 4;
  2986. curTemplate->m_uiStrings[0] = " ";
  2987. curTemplate->m_uiStrings[1] = " 's first ";
  2988. curTemplate->m_uiStrings[2] = ", centers in view (";
  2989. curTemplate->m_uiStrings[3] = ") while playing ";
  2990. curTemplate = &m_actionTemplates[ScriptAction::RADAR_FORCE_ENABLE];
  2991. curTemplate->m_internalName = "RADAR_FORCE_ENABLE";
  2992. curTemplate->m_uiName = "Radar_/ Force enable the radar.";
  2993. curTemplate->m_numParameters = 0;
  2994. curTemplate->m_numUiStrings = 1;
  2995. curTemplate->m_uiStrings[0] = "The radar is now forced to be enabled.";
  2996. curTemplate = &m_actionTemplates[ScriptAction::RADAR_REVERT_TO_NORMAL];
  2997. curTemplate->m_internalName = "RADAR_REVERT_TO_NORMAL";
  2998. curTemplate->m_uiName = "Radar_/ Revert radar to normal behavior.";
  2999. curTemplate->m_numParameters = 0;
  3000. curTemplate->m_numUiStrings = 1;
  3001. curTemplate->m_uiStrings[0] = "The radar is now reverting to its normal behavior.";
  3002. curTemplate = &m_actionTemplates[ScriptAction::SCREEN_SHAKE];
  3003. curTemplate->m_internalName = "SCREEN_SHAKE";
  3004. curTemplate->m_uiName = "Camera_/ Shake Screen.";
  3005. curTemplate->m_numParameters = 1;
  3006. curTemplate->m_parameters[0] = Parameter::SHAKE_INTENSITY;
  3007. curTemplate->m_numUiStrings = 1;
  3008. curTemplate->m_uiStrings[0] = "The screen will shake with ";
  3009. curTemplate = &m_actionTemplates[ScriptAction::TECHTREE_MODIFY_BUILDABILITY_OBJECT];
  3010. curTemplate->m_internalName = "TECHTREE_MODIFY_BUILDABILITY_OBJECT";
  3011. curTemplate->m_uiName = "Map_/ Adjust the tech tree for a specific object type.";
  3012. curTemplate->m_numParameters = 2;
  3013. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  3014. curTemplate->m_parameters[1] = Parameter::BUILDABLE;
  3015. curTemplate->m_numUiStrings = 2;
  3016. curTemplate->m_uiStrings[0] = " ";
  3017. curTemplate->m_uiStrings[1] = " becomes ";
  3018. curTemplate = &m_actionTemplates[ScriptAction::SET_CAVE_INDEX];
  3019. curTemplate->m_internalName = "SET_CAVE_INDEX";
  3020. curTemplate->m_uiName = "Unit_/ Set Cave connectivity index.";
  3021. curTemplate->m_numParameters = 2;
  3022. curTemplate->m_parameters[0] = Parameter::UNIT;
  3023. curTemplate->m_parameters[1] = Parameter::INT;
  3024. curTemplate->m_numUiStrings = 3;
  3025. curTemplate->m_uiStrings[0] = "Cave named ";
  3026. curTemplate->m_uiStrings[1] = " is set to being connected to all caves of index ";
  3027. curTemplate->m_uiStrings[2] = ", but only if both Cave listings have no occupants. ";
  3028. curTemplate = &m_actionTemplates[ScriptAction::WAREHOUSE_SET_VALUE];
  3029. curTemplate->m_internalName = "WAREHOUSE_SET_VALUE";
  3030. curTemplate->m_uiName = "Unit_/ Set cash value of Warehouse.";
  3031. curTemplate->m_numParameters = 2;
  3032. curTemplate->m_parameters[0] = Parameter::UNIT;
  3033. curTemplate->m_parameters[1] = Parameter::INT;
  3034. curTemplate->m_numUiStrings = 3;
  3035. curTemplate->m_uiStrings[0] = "Warehouse named ";
  3036. curTemplate->m_uiStrings[1] = " is set to having ";
  3037. curTemplate->m_uiStrings[2] = " dollars worth of boxes. ";
  3038. curTemplate = &m_actionTemplates[ScriptAction::SOUND_DISABLE_TYPE];
  3039. curTemplate->m_internalName = "SOUND_DISABLE_TYPE";
  3040. curTemplate->m_uiName = "Multimedia_/ Sound Events -- disable type.";
  3041. curTemplate->m_numParameters = 1;
  3042. curTemplate->m_parameters[0] = Parameter::SOUND;
  3043. curTemplate->m_numUiStrings = 2;
  3044. curTemplate->m_uiStrings[0] = " ";
  3045. curTemplate->m_uiStrings[1] = " is disabled.";
  3046. curTemplate = &m_actionTemplates[ScriptAction::SOUND_ENABLE_TYPE];
  3047. curTemplate->m_internalName = "SOUND_ENABLE_TYPE";
  3048. curTemplate->m_uiName = "Multimedia_/ Sound Events -- enable type.";
  3049. curTemplate->m_numParameters = 1;
  3050. curTemplate->m_parameters[0] = Parameter::SOUND;
  3051. curTemplate->m_numUiStrings = 2;
  3052. curTemplate->m_uiStrings[0] = " ";
  3053. curTemplate->m_uiStrings[1] = " is enabled.";
  3054. curTemplate = &m_actionTemplates[ScriptAction::SOUND_REMOVE_TYPE];
  3055. curTemplate->m_internalName = "SOUND_REMOVE_TYPE";
  3056. curTemplate->m_uiName = "Multimedia_/ Sound Events -- remove type.";
  3057. curTemplate->m_numParameters = 1;
  3058. curTemplate->m_parameters[0] = Parameter::SOUND;
  3059. curTemplate->m_numUiStrings = 2;
  3060. curTemplate->m_uiStrings[0] = " ";
  3061. curTemplate->m_uiStrings[1] = " is removed.";
  3062. curTemplate = &m_actionTemplates[ScriptAction::SOUND_REMOVE_ALL_DISABLED];
  3063. curTemplate->m_internalName = "SOUND_REMOVE_ALL_DISABLED";
  3064. curTemplate->m_uiName = "Multimedia_/ Sound Events -- remove all disabled.";
  3065. curTemplate->m_numUiStrings = 1;
  3066. curTemplate->m_uiStrings[0] = "Remove all disabled sound events.";
  3067. curTemplate = &m_actionTemplates[ScriptAction::SOUND_ENABLE_ALL];
  3068. curTemplate->m_internalName = "SOUND_ENABLE_ALL";
  3069. curTemplate->m_uiName = "Multimedia_/ Sound Events -- enable all.";
  3070. curTemplate->m_numUiStrings = 1;
  3071. curTemplate->m_uiStrings[0] = "Enable all sound events.";
  3072. curTemplate = &m_actionTemplates[ScriptAction::AUDIO_OVERRIDE_VOLUME_TYPE];
  3073. curTemplate->m_internalName = "AUDIO_OVERRIDE_VOLUME_TYPE";
  3074. curTemplate->m_uiName = "Multimedia_/ Sound Events -- override volume -- type.";
  3075. curTemplate->m_numParameters = 2;
  3076. curTemplate->m_parameters[0] = Parameter::SOUND;
  3077. curTemplate->m_parameters[1] = Parameter::REAL;
  3078. curTemplate->m_numUiStrings = 3;
  3079. curTemplate->m_uiStrings[0] = " ";
  3080. curTemplate->m_uiStrings[1] = " play at ";
  3081. curTemplate->m_uiStrings[2] = "% of full volume.";
  3082. curTemplate = &m_actionTemplates[ScriptAction::AUDIO_RESTORE_VOLUME_TYPE];
  3083. curTemplate->m_internalName = "AUDIO_RESTORE_VOLUME_TYPE";
  3084. curTemplate->m_uiName = "Multimedia_/ Sound Events -- restore volume -- type.";
  3085. curTemplate->m_numParameters = 1;
  3086. curTemplate->m_parameters[0] = Parameter::SOUND;
  3087. curTemplate->m_numUiStrings = 3;
  3088. curTemplate->m_uiStrings[0] = " ";
  3089. curTemplate->m_uiStrings[1] = " play at normal volume.";
  3090. curTemplate = &m_actionTemplates[ScriptAction::AUDIO_RESTORE_VOLUME_ALL_TYPE];
  3091. curTemplate->m_internalName = "AUDIO_RESTORE_VOLUME_ALL_TYPE";
  3092. curTemplate->m_uiName = "Multimedia_/ Sound Events -- restore volume -- all.";
  3093. curTemplate->m_numUiStrings = 1;
  3094. curTemplate->m_uiStrings[0] = "All sound events play at normal volume.";
  3095. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_TOPPLE_DIRECTION];
  3096. curTemplate->m_internalName = "NAMED_SET_TOPPLE_DIRECTION";
  3097. curTemplate->m_uiName = "Unit_/ Set topple direction.";
  3098. curTemplate->m_numParameters = 2;
  3099. curTemplate->m_parameters[0] = Parameter::UNIT;
  3100. curTemplate->m_parameters[1] = Parameter::COORD3D;
  3101. curTemplate->m_numUiStrings = 3;
  3102. curTemplate->m_uiStrings[0] = " ";
  3103. curTemplate->m_uiStrings[1] = " will topple towards ";
  3104. curTemplate->m_uiStrings[2] = " if destroyed.";
  3105. curTemplate = &m_actionTemplates[ScriptAction::UNIT_MOVE_TOWARDS_NEAREST_OBJECT_TYPE];
  3106. curTemplate->m_internalName = "UNIT_MOVE_TOWARDS_NEAREST_OBJECT_TYPE";
  3107. curTemplate->m_uiName = "Unit_/ Move unit towards the nearest object of a specific type.";
  3108. curTemplate->m_numParameters = 3;
  3109. curTemplate->m_parameters[0] = Parameter::UNIT;
  3110. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3111. curTemplate->m_parameters[2] = Parameter::TRIGGER_AREA;
  3112. curTemplate->m_numUiStrings = 3;
  3113. curTemplate->m_uiStrings[0] = " ";
  3114. curTemplate->m_uiStrings[1] = " will move towards the nearest ";
  3115. curTemplate->m_uiStrings[2] = " within ";
  3116. curTemplate = &m_actionTemplates[ScriptAction::TEAM_MOVE_TOWARDS_NEAREST_OBJECT_TYPE];
  3117. curTemplate->m_internalName = "TEAM_MOVE_TOWARDS_NEAREST_OBJECT_TYPE";
  3118. curTemplate->m_uiName = "Team_/ Move team towards the nearest object of a specific type.";
  3119. curTemplate->m_numParameters = 3;
  3120. curTemplate->m_parameters[0] = Parameter::TEAM;
  3121. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3122. curTemplate->m_parameters[2] = Parameter::TRIGGER_AREA;
  3123. curTemplate->m_numUiStrings = 3;
  3124. curTemplate->m_uiStrings[0] = " ";
  3125. curTemplate->m_uiStrings[1] = " will move towards the nearest ";
  3126. curTemplate->m_uiStrings[2] = " within ";
  3127. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_ATTACK_NEAREST_GROUP_WITH_VALUE];
  3128. curTemplate->m_internalName = "SKIRMISH_ATTACK_NEAREST_GROUP_WITH_VALUE";
  3129. curTemplate->m_uiName = "Skirmish_/ Team attacks nearest group matching value comparison.";
  3130. curTemplate->m_numParameters = 3;
  3131. curTemplate->m_parameters[0] = Parameter::TEAM;
  3132. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  3133. curTemplate->m_parameters[2] = Parameter::INT;
  3134. curTemplate->m_numUiStrings = 3;
  3135. curTemplate->m_uiStrings[0] = " ";
  3136. curTemplate->m_uiStrings[1] = " attacks nearest group worth ";
  3137. curTemplate->m_uiStrings[2] = " ";
  3138. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_PERFORM_COMMANDBUTTON_ON_MOST_VALUABLE_OBJECT];
  3139. curTemplate->m_internalName = "SKIRMISH_PERFORM_COMMANDBUTTON_ON_MOST_VALUABLE_OBJECT";
  3140. curTemplate->m_uiName = "Skirmish_/ Team performs command ability on most valuable object.";
  3141. curTemplate->m_numParameters = 4;
  3142. curTemplate->m_parameters[0] = Parameter::TEAM;
  3143. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3144. curTemplate->m_parameters[2] = Parameter::REAL;
  3145. curTemplate->m_parameters[3] = Parameter::BOOLEAN;
  3146. curTemplate->m_numUiStrings = 5;
  3147. curTemplate->m_uiStrings[0] = " ";
  3148. curTemplate->m_uiStrings[1] = " performs ";
  3149. curTemplate->m_uiStrings[2] = " on most expensive object within ";
  3150. curTemplate->m_uiStrings[3] = " ";
  3151. curTemplate->m_uiStrings[4] = " (true = all valid sources, false = first valid source).";
  3152. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_ALL];
  3153. curTemplate->m_internalName = "SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_ALL";
  3154. curTemplate->m_uiName = "Skirmish_/ Delay a sequential script until the specified command ability is ready - all.";
  3155. curTemplate->m_numParameters = 3;
  3156. curTemplate->m_parameters[0] = Parameter::SIDE;
  3157. curTemplate->m_parameters[1] = Parameter::TEAM;
  3158. curTemplate->m_parameters[2] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3159. curTemplate->m_numUiStrings = 4;
  3160. curTemplate->m_uiStrings[0] = " ";
  3161. curTemplate->m_uiStrings[1] = " 's ";
  3162. curTemplate->m_uiStrings[2] = " all wait until ";
  3163. curTemplate->m_uiStrings[3] = " is ready.";
  3164. curTemplate = &m_actionTemplates[ScriptAction::SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_PARTIAL];
  3165. curTemplate->m_internalName = "SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_PARTIAL";
  3166. curTemplate->m_uiName = "Skirmish_/ Delay a sequential script until the specified command ability is ready - partial.";
  3167. curTemplate->m_numParameters = 3;
  3168. curTemplate->m_parameters[0] = Parameter::SIDE;
  3169. curTemplate->m_parameters[1] = Parameter::TEAM;
  3170. curTemplate->m_parameters[2] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3171. curTemplate->m_numUiStrings = 4;
  3172. curTemplate->m_uiStrings[0] = " ";
  3173. curTemplate->m_uiStrings[1] = " 's ";
  3174. curTemplate->m_uiStrings[2] = " wait until at least one member is ";
  3175. curTemplate->m_uiStrings[3] = " ready.";
  3176. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SPIN_FOR_FRAMECOUNT];
  3177. curTemplate->m_internalName = "TEAM_SPIN_FOR_FRAMECOUNT";
  3178. curTemplate->m_uiName = "Team_/ Set to continue current action for some number of frames.";
  3179. curTemplate->m_numParameters = 2;
  3180. curTemplate->m_parameters[0] = Parameter::TEAM;
  3181. curTemplate->m_parameters[1] = Parameter::INT;
  3182. curTemplate->m_numUiStrings = 3;
  3183. curTemplate->m_uiStrings[0] = " ";
  3184. curTemplate->m_uiStrings[1] = " continue their current action for at least ";
  3185. curTemplate->m_uiStrings[2] = " frames.";
  3186. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_FADE_MULTIPLY];
  3187. curTemplate->m_internalName = "CAMERA_FADE_MULTIPLY";
  3188. curTemplate->m_uiName = "Camera_/Fade Effects/Fade using a multiply blend to black.";
  3189. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_ENABLE_SLAVE_MODE];
  3190. curTemplate->m_internalName = "CAMERA_ENABLE_SLAVE_MODE";
  3191. curTemplate->m_uiName = "Camera_/Enable 3DSMax Camera Animation Playback mode.";
  3192. curTemplate->m_numParameters = 2;
  3193. curTemplate->m_numUiStrings = 2;
  3194. curTemplate->m_parameters[0] = Parameter::TEXT_STRING;
  3195. curTemplate->m_parameters[1] = Parameter::TEXT_STRING;
  3196. curTemplate->m_uiStrings[0] = "Enable 3DSMax Camera playback of animation with thing name ";
  3197. curTemplate->m_uiStrings[1] = " containing bone name ";
  3198. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_DISABLE_SLAVE_MODE];
  3199. curTemplate->m_internalName = "CAMERA_DISABLE_SLAVE_MODE";
  3200. curTemplate->m_uiName = "Camera_/Disable 3DSMax Camera Animation Playback mode.";
  3201. curTemplate->m_numParameters = 0;
  3202. curTemplate->m_numUiStrings = 1;
  3203. curTemplate->m_uiStrings[0] = "Disable camera playback mode.";
  3204. curTemplate = &m_actionTemplates[ScriptAction::CAMERA_ADD_SHAKER_AT];
  3205. curTemplate->m_internalName = "CAMERA_ADD_SHAKER_AT";
  3206. curTemplate->m_uiName = "Camera_/Add Camera Shaker Effect at.";
  3207. curTemplate->m_numParameters = 4;
  3208. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  3209. curTemplate->m_parameters[1] = Parameter::REAL;
  3210. curTemplate->m_parameters[2] = Parameter::REAL;
  3211. curTemplate->m_parameters[3] = Parameter::REAL;
  3212. curTemplate->m_numUiStrings = 4;
  3213. curTemplate->m_uiStrings[0] = "Add Camera Shaker Effect at waypoint ";
  3214. curTemplate->m_uiStrings[1] = " with Amplitude ";
  3215. curTemplate->m_uiStrings[2] = " Duration (seconds) ";
  3216. curTemplate->m_uiStrings[3] = " Radius.";
  3217. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NAMED];
  3218. curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NAMED";
  3219. curTemplate->m_uiName = "Team_/ Use command ability -- all -- named enemy";
  3220. curTemplate->m_numParameters = 2;
  3221. curTemplate->m_parameters[0] = Parameter::TEAM;
  3222. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3223. curTemplate->m_parameters[2] = Parameter::UNIT;
  3224. curTemplate->m_numUiStrings = 3;
  3225. curTemplate->m_uiStrings[0] = " ";
  3226. curTemplate->m_uiStrings[1] = " use ";
  3227. curTemplate->m_uiStrings[2] = " on ";
  3228. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_UNIT];
  3229. curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_UNIT";
  3230. curTemplate->m_uiName = "Team_/ Use command ability -- all -- nearest enemy unit";
  3231. curTemplate->m_numParameters = 2;
  3232. curTemplate->m_parameters[0] = Parameter::TEAM;
  3233. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3234. curTemplate->m_numUiStrings = 3;
  3235. curTemplate->m_uiStrings[0] = " ";
  3236. curTemplate->m_uiStrings[1] = " use ";
  3237. curTemplate->m_uiStrings[2] = " on nearest enemy unit.";
  3238. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_GARRISONED_BUILDING];
  3239. curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_GARRISONED_BUILDING";
  3240. curTemplate->m_uiName = "Team_/ Use command ability -- all -- nearest enemy garrisoned building.";
  3241. curTemplate->m_numParameters = 2;
  3242. curTemplate->m_parameters[0] = Parameter::TEAM;
  3243. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3244. curTemplate->m_numUiStrings = 3;
  3245. curTemplate->m_uiStrings[0] = " ";
  3246. curTemplate->m_uiStrings[1] = " use ";
  3247. curTemplate->m_uiStrings[2] = " on nearest enemy garrisoned building.";
  3248. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_KINDOF];
  3249. curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_KINDOF";
  3250. curTemplate->m_uiName = "Team_/ Use command ability -- all -- nearest enemy object with kind of.";
  3251. curTemplate->m_numParameters = 3;
  3252. curTemplate->m_parameters[0] = Parameter::TEAM;
  3253. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3254. curTemplate->m_parameters[2] = Parameter::KIND_OF_PARAM;
  3255. curTemplate->m_numUiStrings = 4;
  3256. curTemplate->m_uiStrings[0] = " ";
  3257. curTemplate->m_uiStrings[1] = " use ";
  3258. curTemplate->m_uiStrings[2] = " on nearest enemy with ";
  3259. curTemplate->m_uiStrings[4] = ".";
  3260. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING];
  3261. curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING";
  3262. curTemplate->m_uiName = "Team_/ Use command ability -- all -- nearest enemy building.";
  3263. curTemplate->m_numParameters = 2;
  3264. curTemplate->m_parameters[0] = Parameter::TEAM;
  3265. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3266. curTemplate->m_numUiStrings = 3;
  3267. curTemplate->m_uiStrings[0] = " ";
  3268. curTemplate->m_uiStrings[1] = " use ";
  3269. curTemplate->m_uiStrings[2] = " on nearest enemy building.";
  3270. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING_CLASS];
  3271. curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_ENEMY_BUILDING_CLASS";
  3272. curTemplate->m_uiName = "Team_/ Use command ability -- all -- nearest enemy building kindof.";
  3273. curTemplate->m_numParameters = 3;
  3274. curTemplate->m_parameters[0] = Parameter::TEAM;
  3275. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3276. curTemplate->m_parameters[2] = Parameter::KIND_OF_PARAM;
  3277. curTemplate->m_numUiStrings = 3;
  3278. curTemplate->m_uiStrings[0] = " ";
  3279. curTemplate->m_uiStrings[1] = " use ";
  3280. curTemplate->m_uiStrings[2] = " on nearest enemy building with ";
  3281. curTemplate = &m_actionTemplates[ScriptAction::TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_OBJECTTYPE];
  3282. curTemplate->m_internalName = "TEAM_ALL_USE_COMMANDBUTTON_ON_NEAREST_OBJECTTYPE";
  3283. curTemplate->m_uiName = "Team_/ Use command ability -- all -- nearest object type.";
  3284. curTemplate->m_numParameters = 3;
  3285. curTemplate->m_parameters[0] = Parameter::TEAM;
  3286. curTemplate->m_parameters[1] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3287. curTemplate->m_parameters[2] = Parameter::OBJECT_TYPE;
  3288. curTemplate->m_numUiStrings = 4;
  3289. curTemplate->m_uiStrings[0] = " ";
  3290. curTemplate->m_uiStrings[1] = " use ";
  3291. curTemplate->m_uiStrings[2] = " on nearest object of type ";
  3292. curTemplate->m_uiStrings[3] = ".";
  3293. curTemplate = &m_actionTemplates[ScriptAction::TEAM_PARTIAL_USE_COMMANDBUTTON];
  3294. curTemplate->m_internalName = "TEAM_PARTIAL_USE_COMMANDBUTTON";
  3295. curTemplate->m_uiName = "Team_/ Use command ability -- partial -- self.";
  3296. curTemplate->m_numParameters = 3;
  3297. curTemplate->m_parameters[0] = Parameter::REAL;
  3298. curTemplate->m_parameters[1] = Parameter::TEAM;
  3299. curTemplate->m_parameters[2] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  3300. curTemplate->m_numUiStrings = 4;
  3301. curTemplate->m_uiStrings[0] = " ";
  3302. curTemplate->m_uiStrings[1] = "% of ";
  3303. curTemplate->m_uiStrings[2] = " perform ";
  3304. curTemplate->m_uiStrings[3] = ".";
  3305. curTemplate = &m_actionTemplates[ScriptAction::TEAM_CAPTURE_NEAREST_UNOWNED_FACTION_UNIT];
  3306. curTemplate->m_internalName = "TEAM_CAPTURE_NEAREST_UNOWNED_FACTION_UNIT";
  3307. curTemplate->m_uiName = "Team_/ Capture unowned faction unit -- nearest.";
  3308. curTemplate->m_numParameters = 1;
  3309. curTemplate->m_parameters[0] = Parameter::TEAM;
  3310. curTemplate->m_numUiStrings = 2;
  3311. curTemplate->m_uiStrings[0] = " ";
  3312. curTemplate->m_uiStrings[1] = " capture the nearest unowned faction unit.";
  3313. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_CREATE_TEAM_FROM_CAPTURED_UNITS];
  3314. curTemplate->m_internalName = "PLAYER_CREATE_TEAM_FROM_CAPTURED_UNITS";
  3315. curTemplate->m_uiName = "Player_/ Create team from all captured units.";
  3316. curTemplate->m_numParameters = 2;
  3317. curTemplate->m_parameters[0] = Parameter::SIDE;
  3318. curTemplate->m_parameters[1] = Parameter::TEAM;
  3319. curTemplate->m_numUiStrings = 3;
  3320. curTemplate->m_uiStrings[0] = " ";
  3321. curTemplate->m_uiStrings[1] = " creates a new ";
  3322. curTemplate->m_uiStrings[2] = " from units it has captured. (There's nothing quite like being assaulted by your own captured units!)";
  3323. curTemplate = &m_actionTemplates[ScriptAction::TEAM_WAIT_FOR_NOT_CONTAINED_ALL];
  3324. curTemplate->m_internalName = "TEAM_WAIT_FOR_NOT_CONTAINED_ALL";
  3325. curTemplate->m_uiName = "Team_/ Delay a sequential script until the team is no longer contained - all";
  3326. curTemplate->m_numParameters = 1;
  3327. curTemplate->m_parameters[0] = Parameter::TEAM;
  3328. curTemplate->m_numUiStrings = 2;
  3329. curTemplate->m_uiStrings[0] = " ";
  3330. curTemplate->m_uiStrings[1] = " all delay until they are no longer contained.";
  3331. curTemplate = &m_actionTemplates[ScriptAction::TEAM_WAIT_FOR_NOT_CONTAINED_PARTIAL];
  3332. curTemplate->m_internalName = "TEAM_WAIT_FOR_NOT_CONTAINED_PARTIAL";
  3333. curTemplate->m_uiName = "Team_/ Delay a sequential script until the team is no longer contained - partial";
  3334. curTemplate->m_numParameters = 1;
  3335. curTemplate->m_parameters[0] = Parameter::TEAM;
  3336. curTemplate->m_numUiStrings = 2;
  3337. curTemplate->m_uiStrings[0] = " ";
  3338. curTemplate->m_uiStrings[1] = " delay until at least one of them is no longer contained.";
  3339. curTemplate = &m_actionTemplates[ScriptAction::TEAM_SET_EMOTICON];
  3340. curTemplate->m_internalName = "TEAM_SET_EMOTICON";
  3341. curTemplate->m_uiName = "Team_/ Set emoticon for duration (-1.0 permanent, otherwise duration in sec).";
  3342. curTemplate->m_numParameters = 3;
  3343. curTemplate->m_parameters[0] = Parameter::TEAM;
  3344. curTemplate->m_parameters[1] = Parameter::EMOTICON;
  3345. curTemplate->m_parameters[2] = Parameter::REAL;
  3346. curTemplate->m_numUiStrings = 4;
  3347. curTemplate->m_uiStrings[0] = " ";
  3348. curTemplate->m_uiStrings[1] = " use ";
  3349. curTemplate->m_uiStrings[2] = " emoticon for ";
  3350. curTemplate->m_uiStrings[3] = " seconds.";
  3351. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_EMOTICON];
  3352. curTemplate->m_internalName = "NAMED_SET_EMOTICON";
  3353. curTemplate->m_uiName = "Unit_/ Set emoticon for duration (-1.0 permanent, otherwise duration in sec).";
  3354. curTemplate->m_numParameters = 3;
  3355. curTemplate->m_parameters[0] = Parameter::UNIT;
  3356. curTemplate->m_parameters[1] = Parameter::EMOTICON;
  3357. curTemplate->m_parameters[2] = Parameter::REAL;
  3358. curTemplate->m_numUiStrings = 4;
  3359. curTemplate->m_uiStrings[0] = " ";
  3360. curTemplate->m_uiStrings[1] = " use ";
  3361. curTemplate->m_uiStrings[2] = " emoticon for ";
  3362. curTemplate->m_uiStrings[3] = " seconds.";
  3363. curTemplate = &m_actionTemplates[ScriptAction::OBJECTLIST_ADDOBJECTTYPE];
  3364. curTemplate->m_internalName = "OBJECTLIST_ADDOBJECTTYPE";
  3365. curTemplate->m_uiName = "Scripting_/ Object Type List -- Add Object Type.";
  3366. curTemplate->m_numParameters = 2;
  3367. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE_LIST;
  3368. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3369. curTemplate->m_numUiStrings = 2;
  3370. curTemplate->m_uiStrings[0] = " ";
  3371. curTemplate->m_uiStrings[1] = " : add ";
  3372. curTemplate = &m_actionTemplates[ScriptAction::OBJECTLIST_REMOVEOBJECTTYPE];
  3373. curTemplate->m_internalName = "OBJECTLIST_REMOVEOBJECTTYPE";
  3374. curTemplate->m_uiName = "Scripting_/ Object Type List -- Remove Object Type.";
  3375. curTemplate->m_numParameters = 2;
  3376. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE_LIST;
  3377. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3378. curTemplate->m_numUiStrings = 2;
  3379. curTemplate->m_uiStrings[0] = " ";
  3380. curTemplate->m_uiStrings[1] = " : remove ";
  3381. curTemplate = &m_actionTemplates[ScriptAction::MAP_REVEAL_PERMANENTLY_AT_WAYPOINT];
  3382. curTemplate->m_internalName = "MAP_REVEAL_PERMANENTLY_AT_WAYPOINT";
  3383. curTemplate->m_uiName = "Map_/ Reveal map at waypoint -- permanently.";
  3384. curTemplate->m_numParameters = 4;
  3385. curTemplate->m_parameters[0] = Parameter::WAYPOINT;
  3386. curTemplate->m_parameters[1] = Parameter::REAL;
  3387. curTemplate->m_parameters[2] = Parameter::SIDE;
  3388. curTemplate->m_parameters[3] = Parameter::REVEALNAME;
  3389. curTemplate->m_numUiStrings = 5;
  3390. curTemplate->m_uiStrings[0] = "The map is permanently revealed at ";
  3391. curTemplate->m_uiStrings[1] = " with a radius of ";
  3392. curTemplate->m_uiStrings[2] = " for ";
  3393. curTemplate->m_uiStrings[3] = ". (Afterwards referred to as ";
  3394. curTemplate->m_uiStrings[4] = ").";
  3395. curTemplate = &m_actionTemplates[ScriptAction::MAP_UNDO_REVEAL_PERMANENTLY_AT_WAYPOINT];
  3396. curTemplate->m_internalName = "MAP_UNDO_REVEAL_PERMANENTLY_AT_WAYPOINT";
  3397. curTemplate->m_uiName = "Map_/ Reveal map at waypoint -- undo permanently.";
  3398. curTemplate->m_numParameters = 1;
  3399. curTemplate->m_parameters[0] = Parameter::REVEALNAME;
  3400. curTemplate->m_numUiStrings = 2;
  3401. curTemplate->m_uiStrings[0] = " ";
  3402. curTemplate->m_uiStrings[1] = " is undone.";
  3403. curTemplate = &m_actionTemplates[ScriptAction::EVA_SET_ENABLED_DISABLED];
  3404. curTemplate->m_internalName = "EVA_SET_ENABLED_DISABLED";
  3405. curTemplate->m_uiName = "Scripting_/ Enable or Disable EVA.";
  3406. curTemplate->m_numParameters = 1;
  3407. curTemplate->m_parameters[0] = Parameter::BOOLEAN;
  3408. curTemplate->m_numUiStrings = 2;
  3409. curTemplate->m_uiStrings[0] = "Set EVA to be enabled ";
  3410. curTemplate->m_uiStrings[1] = " (False to disable.)";
  3411. curTemplate = &m_actionTemplates[ScriptAction::OPTIONS_SET_OCCLUSION_MODE];
  3412. curTemplate->m_internalName = "OPTIONS_SET_OCCLUSION_MODE";
  3413. curTemplate->m_uiName = "Scripting_/ Enable or Disable Occlusion (Drawing Behind Buildings).";
  3414. curTemplate->m_numParameters = 1;
  3415. curTemplate->m_parameters[0] = Parameter::BOOLEAN;
  3416. curTemplate->m_numUiStrings = 2;
  3417. curTemplate->m_uiStrings[0] = "Set Occlusion to be enabled ";
  3418. curTemplate->m_uiStrings[1] = " (False to disable.)";
  3419. curTemplate = &m_actionTemplates[ScriptAction::OPTIONS_SET_DRAWICON_UI_MODE];
  3420. curTemplate->m_internalName = "OPTIONS_SET_DRAWICON_UI_MODE";
  3421. curTemplate->m_uiName = "Scripting_/ Enable or Disable Draw-icon UI.";
  3422. curTemplate->m_numParameters = 1;
  3423. curTemplate->m_parameters[0] = Parameter::BOOLEAN;
  3424. curTemplate->m_numUiStrings = 2;
  3425. curTemplate->m_uiStrings[0] = "Set Draw-icon UI to be enabled ";
  3426. curTemplate->m_uiStrings[1] = " (False to disable.)";
  3427. curTemplate = &m_actionTemplates[ScriptAction::OPTIONS_SET_PARTICLE_CAP_MODE];
  3428. curTemplate->m_internalName = "OPTIONS_SET_PARTICLE_CAP_MODE";
  3429. curTemplate->m_uiName = "Scripting_/ Enable or Disable Particle Cap.";
  3430. curTemplate->m_numParameters = 1;
  3431. curTemplate->m_parameters[0] = Parameter::BOOLEAN;
  3432. curTemplate->m_numUiStrings = 2;
  3433. curTemplate->m_uiStrings[0] = "Set Particle Cap to be enabled ";
  3434. curTemplate->m_uiStrings[1] = " (False to disable.)";
  3435. curTemplate = &m_actionTemplates[ScriptAction::UNIT_AFFECT_OBJECT_PANEL_FLAGS];
  3436. curTemplate->m_internalName = "UNIT_AFFECT_OBJECT_PANEL_FLAGS";
  3437. curTemplate->m_uiName = "Unit_/ Affect flags set on object panel.";
  3438. curTemplate->m_numParameters = 3;
  3439. curTemplate->m_parameters[0] = Parameter::UNIT;
  3440. curTemplate->m_parameters[1] = Parameter::OBJECT_PANEL_FLAG;
  3441. curTemplate->m_parameters[2] = Parameter::BOOLEAN;
  3442. curTemplate->m_numUiStrings = 4;
  3443. curTemplate->m_uiStrings[0] = " ";
  3444. curTemplate->m_uiStrings[1] = " changes the value of flag ";
  3445. curTemplate->m_uiStrings[2] = " to ";
  3446. curTemplate->m_uiStrings[3] = ".";
  3447. curTemplate = &m_actionTemplates[ScriptAction::TEAM_AFFECT_OBJECT_PANEL_FLAGS];
  3448. curTemplate->m_internalName = "TEAM_AFFECT_OBJECT_PANEL_FLAGS";
  3449. curTemplate->m_uiName = "Team_/ Affect flags set on object panel - all.";
  3450. curTemplate->m_numParameters = 3;
  3451. curTemplate->m_parameters[0] = Parameter::TEAM;
  3452. curTemplate->m_parameters[1] = Parameter::OBJECT_PANEL_FLAG;
  3453. curTemplate->m_parameters[2] = Parameter::BOOLEAN;
  3454. curTemplate->m_numUiStrings = 4;
  3455. curTemplate->m_uiStrings[0] = " ";
  3456. curTemplate->m_uiStrings[1] = " change the value of flag ";
  3457. curTemplate->m_uiStrings[2] = " to ";
  3458. curTemplate->m_uiStrings[3] = ".";
  3459. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_SELECT_SKILLSET];
  3460. curTemplate->m_internalName = "PLAYER_SELECT_SKILLSET";
  3461. curTemplate->m_uiName = "Player_/ Set the skillset for a computer player.";
  3462. curTemplate->m_numParameters = 2;
  3463. curTemplate->m_parameters[0] = Parameter::SIDE;
  3464. curTemplate->m_parameters[1] = Parameter::INT;
  3465. curTemplate->m_numUiStrings = 3;
  3466. curTemplate->m_uiStrings[0] = " ";
  3467. curTemplate->m_uiStrings[1] = " uses skillset number ";
  3468. curTemplate->m_uiStrings[2] = " (1-5).";
  3469. curTemplate = &m_actionTemplates[ScriptAction::SCRIPTING_OVERRIDE_HULK_LIFETIME ];
  3470. curTemplate->m_internalName = "SCRIPTING_OVERRIDE_HULK_LIFETIME";
  3471. curTemplate->m_uiName = "Scripting_/ Hulk set override lifetime.";
  3472. curTemplate->m_numParameters = 1;
  3473. curTemplate->m_parameters[0] = Parameter::REAL;
  3474. curTemplate->m_numUiStrings = 2;
  3475. curTemplate->m_uiStrings[0] = "Override hulk lifetime to ";
  3476. curTemplate->m_uiStrings[1] = " seconds. Negative value reverts to normal behavior.";
  3477. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FACE_NAMED];
  3478. curTemplate->m_internalName = "NAMED_FACE_NAMED";
  3479. curTemplate->m_uiName = "Unit_/ Set unit to face another unit.";
  3480. curTemplate->m_numParameters = 2;
  3481. curTemplate->m_parameters[0] = Parameter::UNIT;
  3482. curTemplate->m_parameters[1] = Parameter::UNIT;
  3483. curTemplate->m_numUiStrings = 2;
  3484. curTemplate->m_uiStrings[0] = " ";
  3485. curTemplate->m_uiStrings[1] = " begin facing ";
  3486. curTemplate = &m_actionTemplates[ScriptAction::NAMED_FACE_WAYPOINT];
  3487. curTemplate->m_internalName = "NAMED_FACE_WAYPOINT";
  3488. curTemplate->m_uiName = "Unit_/ Set unit to face a waypoint.";
  3489. curTemplate->m_numParameters = 2;
  3490. curTemplate->m_parameters[0] = Parameter::UNIT;
  3491. curTemplate->m_parameters[1] = Parameter::WAYPOINT;
  3492. curTemplate->m_numUiStrings = 2;
  3493. curTemplate->m_uiStrings[0] = " ";
  3494. curTemplate->m_uiStrings[1] = " begin facing ";
  3495. curTemplate = &m_actionTemplates[ScriptAction::TEAM_FACE_NAMED];
  3496. curTemplate->m_internalName = "TEAM_FACE_NAMED";
  3497. curTemplate->m_uiName = "Team_/ Set team to face another unit.";
  3498. curTemplate->m_numParameters = 2;
  3499. curTemplate->m_parameters[0] = Parameter::TEAM;
  3500. curTemplate->m_parameters[1] = Parameter::UNIT;
  3501. curTemplate->m_numUiStrings = 2;
  3502. curTemplate->m_uiStrings[0] = " ";
  3503. curTemplate->m_uiStrings[1] = " begin facing ";
  3504. curTemplate = &m_actionTemplates[ScriptAction::TEAM_FACE_WAYPOINT];
  3505. curTemplate->m_internalName = "TEAM_FACE_WAYPOINT";
  3506. curTemplate->m_uiName = "Team_/ Set team to face a waypoint.";
  3507. curTemplate->m_numParameters = 2;
  3508. curTemplate->m_parameters[0] = Parameter::TEAM;
  3509. curTemplate->m_parameters[1] = Parameter::WAYPOINT;
  3510. curTemplate->m_numUiStrings = 2;
  3511. curTemplate->m_uiStrings[0] = " ";
  3512. curTemplate->m_uiStrings[1] = " begin facing ";
  3513. curTemplate = &m_actionTemplates[ScriptAction::COMMANDBAR_REMOVE_BUTTON_OBJECTTYPE];
  3514. curTemplate->m_internalName = "COMMANDBAR_REMOVE_BUTTON_OBJECTTYPE";
  3515. curTemplate->m_uiName = "Scripting_/ Remove a command button from an object type.";
  3516. curTemplate->m_numParameters = 2;
  3517. curTemplate->m_parameters[0] = Parameter::COMMAND_BUTTON;
  3518. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3519. curTemplate->m_numUiStrings = 3;
  3520. curTemplate->m_uiStrings[0] = " ";
  3521. curTemplate->m_uiStrings[1] = " is removed from all objects of type ";
  3522. curTemplate->m_uiStrings[2] = ".";
  3523. curTemplate = &m_actionTemplates[ScriptAction::COMMANDBAR_ADD_BUTTON_OBJECTTYPE_SLOT];
  3524. curTemplate->m_internalName = "COMMANDBAR_ADD_BUTTON_OBJECTTYPE_SLOT";
  3525. curTemplate->m_uiName = "Scripting_/ Add a command button to an object type.";
  3526. curTemplate->m_numParameters = 3;
  3527. curTemplate->m_parameters[0] = Parameter::COMMAND_BUTTON;
  3528. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3529. curTemplate->m_parameters[2] = Parameter::INT;
  3530. curTemplate->m_numUiStrings = 4;
  3531. curTemplate->m_uiStrings[0] = " ";
  3532. curTemplate->m_uiStrings[1] = " is added to all objects of type ";
  3533. curTemplate->m_uiStrings[2] = " in slot number ";
  3534. curTemplate->m_uiStrings[3] = " (1-12).";
  3535. curTemplate = &m_actionTemplates[ScriptAction::UNIT_SPAWN_NAMED_LOCATION_ORIENTATION];
  3536. curTemplate->m_internalName = "UNIT_SPAWN_NAMED_LOCATION_ORIENTATION";
  3537. curTemplate->m_uiName = "Unit_/ Spawn -- named unit on a team at a position with an orientation.";
  3538. curTemplate->m_numParameters = 5;
  3539. curTemplate->m_parameters[0] = Parameter::UNIT;
  3540. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3541. curTemplate->m_parameters[2] = Parameter::TEAM;
  3542. curTemplate->m_parameters[3] = Parameter::COORD3D;
  3543. curTemplate->m_parameters[4] = Parameter::ANGLE;
  3544. curTemplate->m_numUiStrings = 6;
  3545. curTemplate->m_uiStrings[0] = "Spawn ";
  3546. curTemplate->m_uiStrings[1] = " of type ";
  3547. curTemplate->m_uiStrings[2] = " on team ";
  3548. curTemplate->m_uiStrings[3] = " at position (";
  3549. curTemplate->m_uiStrings[4] = "), rotated ";
  3550. curTemplate->m_uiStrings[5] = " .";
  3551. curTemplate = &m_actionTemplates[ScriptAction::PLAYER_AFFECT_RECEIVING_EXPERIENCE];
  3552. curTemplate->m_internalName = "PLAYER_AFFECT_RECEIVING_EXPERIENCE";
  3553. curTemplate->m_uiName = "Player_/ Change the modifier to generals experience that a player receives.";
  3554. curTemplate->m_numParameters = 2;
  3555. curTemplate->m_parameters[0] = Parameter::SIDE;
  3556. curTemplate->m_parameters[1] = Parameter::REAL;
  3557. curTemplate->m_numUiStrings = 3;
  3558. curTemplate->m_uiStrings[0] = " ";
  3559. curTemplate->m_uiStrings[1] = " gains experience at ";
  3560. curTemplate->m_uiStrings[2] = " times the usual rate (0.0 for no gain, 1.0 for normal rate)";
  3561. curTemplate = &m_actionTemplates[ScriptAction::SOUND_SET_VOLUME];
  3562. curTemplate->m_internalName = "SOUND_SET_VOLUME";
  3563. curTemplate->m_uiName = "Multimedia_/ Set the current sound volume.";
  3564. curTemplate->m_numParameters = 1;
  3565. curTemplate->m_parameters[0] = Parameter::REAL;
  3566. curTemplate->m_numUiStrings = 2;
  3567. curTemplate->m_uiStrings[0] = "Set the desired sound volume to ";
  3568. curTemplate->m_uiStrings[1] = "%. (0-100)";
  3569. curTemplate = &m_actionTemplates[ScriptAction::SPEECH_SET_VOLUME];
  3570. curTemplate->m_internalName = "SPEECH_SET_VOLUME";
  3571. curTemplate->m_uiName = "Multimedia_/ Set the current speech volume.";
  3572. curTemplate->m_numParameters = 1;
  3573. curTemplate->m_parameters[0] = Parameter::REAL;
  3574. curTemplate->m_numUiStrings = 2;
  3575. curTemplate->m_uiStrings[0] = "Set the desired speech volume to ";
  3576. curTemplate->m_uiStrings[1] = "%. (0-100)";
  3577. curTemplate = &m_actionTemplates[ScriptAction::OBJECT_ALLOW_BONUSES];
  3578. curTemplate->m_internalName = "OBJECT_ALLOW_BONUSES";
  3579. curTemplate->m_uiName = "Map_/ Adjust Object Bonuses based on difficulty.";
  3580. curTemplate->m_numParameters = 1;
  3581. curTemplate->m_parameters[0] = Parameter::BOOLEAN;
  3582. curTemplate->m_numUiStrings = 2;
  3583. curTemplate->m_uiStrings[0] = "Enable Object Bonuses based on difficulty ";
  3584. curTemplate->m_uiStrings[1] = " (true to enable, false to disable).";
  3585. curTemplate = &m_actionTemplates[ScriptAction::TEAM_GUARD_IN_TUNNEL_NETWORK];
  3586. curTemplate->m_internalName = "TEAM_GUARD_IN_TUNNEL_NETWORK";
  3587. curTemplate->m_uiName = "Team_/ Set to guard - from inside tunnel network.";
  3588. curTemplate->m_numParameters = 1;
  3589. curTemplate->m_parameters[0] = Parameter::TEAM;
  3590. curTemplate->m_numUiStrings = 2;
  3591. curTemplate->m_uiStrings[0] = " ";
  3592. curTemplate->m_uiStrings[1] = " Enter and guard from tunnel network.";
  3593. curTemplate = &m_actionTemplates[ScriptAction::LOCALDEFEAT];
  3594. curTemplate->m_internalName = "LOCALDEFEAT";
  3595. curTemplate->m_uiName = "Multiplayer_/ Announce local defeat.";
  3596. curTemplate->m_numParameters = 0;
  3597. curTemplate->m_numUiStrings = 1;
  3598. curTemplate->m_uiStrings[0] = "Show 'Game Over' window";
  3599. curTemplate = &m_actionTemplates[ScriptAction::VICTORY];
  3600. curTemplate->m_internalName = "VICTORY";
  3601. curTemplate->m_uiName = "Multiplayer_/ Announce victory.";
  3602. curTemplate->m_numParameters = 0;
  3603. curTemplate->m_numUiStrings = 1;
  3604. curTemplate->m_uiStrings[0] = "Show 'Victorious' window and end game";
  3605. curTemplate = &m_actionTemplates[ScriptAction::DEFEAT];
  3606. curTemplate->m_internalName = "DEFEAT";
  3607. curTemplate->m_uiName = "Multiplayer_/ Announce defeat.";
  3608. curTemplate->m_numParameters = 0;
  3609. curTemplate->m_numUiStrings = 1;
  3610. curTemplate->m_uiStrings[0] = "Show 'Defeated' window and end game";
  3611. curTemplate = &m_actionTemplates[ScriptAction::RESIZE_VIEW_GUARDBAND];
  3612. curTemplate->m_internalName = "RESIZE_VIEW_GUARDBAND";
  3613. curTemplate->m_uiName = "Map_/ Resize view guardband.";
  3614. curTemplate->m_numParameters = 2;
  3615. curTemplate->m_parameters[0] = Parameter::REAL;
  3616. curTemplate->m_parameters[1] = Parameter::REAL;
  3617. curTemplate->m_numUiStrings = 3;
  3618. curTemplate->m_uiStrings[0] = "Allow bigger objects to be perceived as onscreen near the edge (" ;
  3619. curTemplate->m_uiStrings[1] = ",";
  3620. curTemplate->m_uiStrings[2] = ") Width then height, in world units.";
  3621. curTemplate = &m_actionTemplates[ScriptAction::DELETE_ALL_UNMANNED];
  3622. curTemplate->m_internalName = "DELETE_ALL_UNMANNED";
  3623. curTemplate->m_uiName = "Scripting_/ Delete all unmanned (sniped) vehicles.";
  3624. curTemplate->m_numParameters = 0;
  3625. curTemplate->m_numUiStrings = 1;
  3626. curTemplate->m_uiStrings[0] = "Delete all unmanned (sniped) vehicles." ;
  3627. curTemplate = &m_actionTemplates[ScriptAction::CHOOSE_VICTIM_ALWAYS_USES_NORMAL];
  3628. curTemplate->m_internalName = "CHOOSE_VICTIM_ALWAYS_USES_NORMAL";
  3629. curTemplate->m_uiName = "Map_/ Force ChooseVictim to ignore game difficulty and always use Normal setting.";
  3630. curTemplate->m_numParameters = 1;
  3631. curTemplate->m_parameters[0] = Parameter::BOOLEAN;
  3632. curTemplate->m_numUiStrings = 2;
  3633. curTemplate->m_uiStrings[0] = "Force ChooseVictim to ignore game difficulty and always use Normal setting ";
  3634. curTemplate->m_uiStrings[1] = " (true to enable, false to disable).";
  3635. curTemplate = &m_actionTemplates[ScriptAction::SET_TRAIN_HELD];
  3636. curTemplate->m_internalName = "SET_TRAIN_HELD";
  3637. curTemplate->m_uiName = "Unit/ Set a train to stay at a station. TRUE = stay. FALSE = go-ahead.";
  3638. curTemplate->m_numParameters = 2;
  3639. curTemplate->m_parameters[0] = Parameter::UNIT;
  3640. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  3641. curTemplate->m_numUiStrings = 2;
  3642. curTemplate->m_uiStrings[0] = " ";
  3643. curTemplate->m_uiStrings[1] = " sets its held status to ";
  3644. curTemplate = &m_actionTemplates[ScriptAction::NAMED_SET_EVAC_LEFT_OR_RIGHT];
  3645. curTemplate->m_internalName = "NAMED_SET_EVAC_LEFT_OR_RIGHT";
  3646. curTemplate->m_uiName = "Unit/ Set which side of a container (likely a train) you want the riders to exit on.";
  3647. curTemplate->m_numParameters = 2;
  3648. curTemplate->m_parameters[0] = Parameter::UNIT;
  3649. curTemplate->m_parameters[1] = Parameter::LEFT_OR_RIGHT;
  3650. curTemplate->m_numUiStrings = 2;
  3651. curTemplate->m_uiStrings[0] = " ";
  3652. curTemplate->m_uiStrings[1] = " will exit its riders on its ";
  3653. curTemplate = &m_actionTemplates[ScriptAction::ENABLE_OBJECT_SOUND];
  3654. curTemplate->m_internalName = "ENABLE_OBJECT_SOUND";
  3655. curTemplate->m_uiName = "Multimedia_/Sound Effect/Enable object's ambient sound";
  3656. curTemplate->m_numParameters = 1;
  3657. curTemplate->m_parameters[0] = Parameter::UNIT;
  3658. curTemplate->m_numUiStrings = 2;
  3659. curTemplate->m_uiStrings[0] = "Enable (or trigger) ";
  3660. curTemplate->m_uiStrings[1] = "'s ambient sound.";
  3661. curTemplate = &m_actionTemplates[ScriptAction::DISABLE_OBJECT_SOUND];
  3662. curTemplate->m_internalName = "DISABLE_OBJECT_SOUND";
  3663. curTemplate->m_uiName = "Multimedia_/Sound Effect/Disable object's ambient sound";
  3664. curTemplate->m_numParameters = 1;
  3665. curTemplate->m_parameters[0] = Parameter::UNIT;
  3666. curTemplate->m_numUiStrings = 2;
  3667. curTemplate->m_uiStrings[0] = "Disable ";
  3668. curTemplate->m_uiStrings[1] = "'s ambient sound.";
  3669. ///////////////////////////////////////////////////////////////////////////////////////////////////
  3670. /* Recipe for adding a condition:
  3671. 1. In Scripts.h, add an enum element to enum ConditionType just before NUM_ITEMS.
  3672. 2. Go to the end of this section of templates, and create a template.
  3673. 3. Go to ScriptConditions.h and add a protected method.
  3674. 4. Go to ScriptConditions.cpp, and add your enum to the
  3675. switch in ScriptConditions::evaluateCondition to call your method in 3 above.
  3676. */
  3677. // Set up condition templates.
  3678. curTemplate = &m_conditionTemplates[Condition::CONDITION_FALSE];
  3679. curTemplate->m_internalName = "CONDITION_FALSE";
  3680. curTemplate->m_uiName = "Scripting_/ False.";
  3681. curTemplate->m_numParameters = 0;
  3682. curTemplate->m_numUiStrings = 1;
  3683. curTemplate->m_uiStrings[0] = "False.";
  3684. curTemplate = &m_conditionTemplates[Condition::COUNTER];
  3685. curTemplate->m_internalName = "COUNTER";
  3686. curTemplate->m_uiName = "Scripting_/ Counter compared to a value.";
  3687. curTemplate->m_numParameters = 3;
  3688. curTemplate->m_parameters[0] = Parameter::COUNTER;
  3689. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  3690. curTemplate->m_parameters[2] = Parameter::INT;
  3691. curTemplate->m_numUiStrings = 3;
  3692. curTemplate->m_uiStrings[0] = "Counter ";
  3693. curTemplate->m_uiStrings[1] = " IS ";
  3694. curTemplate->m_uiStrings[2] = " ";
  3695. curTemplate = &m_conditionTemplates[Condition::UNIT_HEALTH];
  3696. curTemplate->m_internalName = "UNIT_HEALTH";
  3697. curTemplate->m_uiName = "Unit_/ Unit health % compared to a value.";
  3698. curTemplate->m_numParameters = 3;
  3699. curTemplate->m_parameters[0] = Parameter::UNIT;
  3700. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  3701. curTemplate->m_parameters[2] = Parameter::INT;
  3702. curTemplate->m_numUiStrings = 4;
  3703. curTemplate->m_uiStrings[0] = " ";
  3704. curTemplate->m_uiStrings[1] = " Health IS ";
  3705. curTemplate->m_uiStrings[2] = " ";
  3706. curTemplate->m_uiStrings[3] = " percent.";
  3707. curTemplate = &m_conditionTemplates[Condition::FLAG];
  3708. curTemplate->m_internalName = "FLAG";
  3709. curTemplate->m_uiName = "Scripting_/ Flag compared to a value.";
  3710. curTemplate->m_numParameters = 2;
  3711. curTemplate->m_parameters[0] = Parameter::FLAG;
  3712. curTemplate->m_parameters[1] = Parameter::BOOLEAN;
  3713. curTemplate->m_numUiStrings = 2;
  3714. curTemplate->m_uiStrings[0] = " ";
  3715. curTemplate->m_uiStrings[1] = " IS ";
  3716. curTemplate = &m_conditionTemplates[Condition::TEAM_STATE_IS];
  3717. curTemplate->m_internalName = "TEAM_STATE_IS";
  3718. curTemplate->m_uiName = "Team_/ Team state is.";
  3719. curTemplate->m_numParameters = 2;
  3720. curTemplate->m_parameters[0] = Parameter::TEAM;
  3721. curTemplate->m_parameters[1] = Parameter::TEAM_STATE;
  3722. curTemplate->m_numUiStrings = 2;
  3723. curTemplate->m_uiStrings[0] = " ";
  3724. curTemplate->m_uiStrings[1] = " state IS ";
  3725. curTemplate = &m_conditionTemplates[Condition::TEAM_STATE_IS_NOT];
  3726. curTemplate->m_internalName = "TEAM_STATE_IS_NOT";
  3727. curTemplate->m_uiName = "Team_/ Team state is not.";
  3728. curTemplate->m_numParameters = 2;
  3729. curTemplate->m_parameters[0] = Parameter::TEAM;
  3730. curTemplate->m_parameters[1] = Parameter::TEAM_STATE;
  3731. curTemplate->m_numUiStrings = 2;
  3732. curTemplate->m_uiStrings[0] = " ";
  3733. curTemplate->m_uiStrings[1] = " state IS NOT ";
  3734. curTemplate = &m_conditionTemplates[Condition::CONDITION_TRUE];
  3735. curTemplate->m_internalName = "CONDITION_TRUE";
  3736. curTemplate->m_uiName = "Scripting_/ True.";
  3737. curTemplate->m_numParameters = 0;
  3738. curTemplate->m_numUiStrings = 1;
  3739. curTemplate->m_uiStrings[0] = "True.";
  3740. curTemplate = &m_conditionTemplates[Condition::TIMER_EXPIRED];
  3741. curTemplate->m_internalName = "TIMER_EXPIRED";
  3742. curTemplate->m_uiName = "Scripting_/ Timer expired.";
  3743. curTemplate->m_numParameters = 1;
  3744. curTemplate->m_parameters[0] = Parameter::COUNTER;
  3745. curTemplate->m_numUiStrings = 2;
  3746. curTemplate->m_uiStrings[0] = "Timer ";
  3747. curTemplate->m_uiStrings[1] = " has expired.";
  3748. curTemplate = &m_conditionTemplates[Condition::PLAYER_ALL_DESTROYED];
  3749. curTemplate->m_internalName = "PLAYER_ALL_DESTROYED";
  3750. curTemplate->m_uiName = "Player_/ All destroyed.";
  3751. curTemplate->m_numParameters = 1;
  3752. curTemplate->m_parameters[0] = Parameter::SIDE;
  3753. curTemplate->m_numUiStrings = 2;
  3754. curTemplate->m_uiStrings[0] = "Everything belonging to ";
  3755. curTemplate->m_uiStrings[1] = " has been destroyed.";
  3756. curTemplate = &m_conditionTemplates[Condition::PLAYER_ALL_BUILDFACILITIES_DESTROYED];
  3757. curTemplate->m_internalName = "PLAYER_ALL_BUILDFACILITIES_DESTROYED";
  3758. curTemplate->m_uiName = "Player_/ All factories destroyed.";
  3759. curTemplate->m_numParameters = 1;
  3760. curTemplate->m_parameters[0] = Parameter::SIDE;
  3761. curTemplate->m_numUiStrings = 2;
  3762. curTemplate->m_uiStrings[0] = "All factories belonging to ";
  3763. curTemplate->m_uiStrings[1] = " have been destroyed.";
  3764. curTemplate = &m_conditionTemplates[Condition::TEAM_INSIDE_AREA_PARTIALLY];
  3765. curTemplate->m_internalName = "TEAM_INSIDE_AREA_PARTIALLY";
  3766. curTemplate->m_uiName = "Team_/ Team has units in an area.";
  3767. curTemplate->m_numParameters = 3;
  3768. curTemplate->m_parameters[0] = Parameter::TEAM;
  3769. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  3770. curTemplate->m_parameters[2] = Parameter::SURFACES_ALLOWED;
  3771. curTemplate->m_numUiStrings = 4;
  3772. curTemplate->m_uiStrings[0] = " ";
  3773. curTemplate->m_uiStrings[1] = " has one or more units in ";
  3774. curTemplate->m_uiStrings[2] = " (";
  3775. curTemplate->m_uiStrings[3] = ").";
  3776. curTemplate = &m_conditionTemplates[Condition::NAMED_INSIDE_AREA];
  3777. curTemplate->m_internalName = "NAMED_INSIDE_AREA";
  3778. curTemplate->m_uiName = "Unit_/ Unit entered area.";
  3779. curTemplate->m_numParameters = 2;
  3780. curTemplate->m_parameters[0] = Parameter::UNIT;
  3781. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  3782. curTemplate->m_numUiStrings = 4;
  3783. curTemplate->m_uiStrings[0] = " ";
  3784. curTemplate->m_uiStrings[1] = " is in ";
  3785. curTemplate->m_uiStrings[2] = " (";
  3786. curTemplate->m_uiStrings[3] = ").";
  3787. curTemplate = &m_conditionTemplates[Condition::TEAM_DESTROYED];
  3788. curTemplate->m_internalName = "TEAM_DESTROYED";
  3789. curTemplate->m_uiName = "Team_/ Team is destroyed.";
  3790. curTemplate->m_numParameters = 1;
  3791. curTemplate->m_parameters[0] = Parameter::TEAM;
  3792. curTemplate->m_numUiStrings = 2;
  3793. curTemplate->m_uiStrings[0] = " ";
  3794. curTemplate->m_uiStrings[1] = " has been destroyed.";
  3795. curTemplate = &m_conditionTemplates[Condition::NAMED_DESTROYED];
  3796. curTemplate->m_internalName = "NAMED_DESTROYED";
  3797. curTemplate->m_uiName = "Unit_/ Unit is destroyed.";
  3798. curTemplate->m_numParameters = 1;
  3799. curTemplate->m_parameters[0] = Parameter::UNIT;
  3800. curTemplate->m_numUiStrings = 2;
  3801. curTemplate->m_uiStrings[0] = " ";
  3802. curTemplate->m_uiStrings[1] = " has been destroyed.";
  3803. curTemplate = &m_conditionTemplates[Condition::NAMED_DYING];
  3804. curTemplate->m_internalName = "NAMED_DYING";
  3805. curTemplate->m_uiName = "Unit_/ Unit is dying.";
  3806. curTemplate->m_numParameters = 1;
  3807. curTemplate->m_parameters[0] = Parameter::UNIT;
  3808. curTemplate->m_numUiStrings = 2;
  3809. curTemplate->m_uiStrings[0] = " ";
  3810. curTemplate->m_uiStrings[1] = " has been killed, but still on screen.";
  3811. curTemplate = &m_conditionTemplates[Condition::NAMED_TOTALLY_DEAD];
  3812. curTemplate->m_internalName = "NAMED_TOTALLY_DEAD";
  3813. curTemplate->m_uiName = "Unit_/ Unit is finished dying.";
  3814. curTemplate->m_numParameters = 1;
  3815. curTemplate->m_parameters[0] = Parameter::UNIT;
  3816. curTemplate->m_numUiStrings = 2;
  3817. curTemplate->m_uiStrings[0] = " ";
  3818. curTemplate->m_uiStrings[1] = " has been killed, and is finished dying.";
  3819. curTemplate = &m_conditionTemplates[Condition::BRIDGE_BROKEN];
  3820. curTemplate->m_internalName = "BRIDGE_BROKEN";
  3821. curTemplate->m_uiName = "Unit_/ Bridge is broken.";
  3822. curTemplate->m_numParameters = 1;
  3823. curTemplate->m_parameters[0] = Parameter::BRIDGE;
  3824. curTemplate->m_numUiStrings = 2;
  3825. curTemplate->m_uiStrings[0] = " ";
  3826. curTemplate->m_uiStrings[1] = " has been broken.";
  3827. curTemplate = &m_conditionTemplates[Condition::BRIDGE_REPAIRED];
  3828. curTemplate->m_internalName = "BRIDGE_REPAIRED";
  3829. curTemplate->m_uiName = "Unit_/ Bridge is repaired.";
  3830. curTemplate->m_numParameters = 1;
  3831. curTemplate->m_parameters[0] = Parameter::BRIDGE;
  3832. curTemplate->m_numUiStrings = 2;
  3833. curTemplate->m_uiStrings[0] = " ";
  3834. curTemplate->m_uiStrings[1] = " has been repaired.";
  3835. curTemplate = &m_conditionTemplates[Condition::NAMED_NOT_DESTROYED];
  3836. curTemplate->m_internalName = "NAMED_NOT_DESTROYED";
  3837. curTemplate->m_uiName = "Unit_/ Unit exists and is alive.";
  3838. curTemplate->m_numParameters = 1;
  3839. curTemplate->m_parameters[0] = Parameter::UNIT;
  3840. curTemplate->m_numUiStrings = 2;
  3841. curTemplate->m_uiStrings[0] = " ";
  3842. curTemplate->m_uiStrings[1] = " exists and is alive.";
  3843. curTemplate = &m_conditionTemplates[Condition::TEAM_HAS_UNITS];
  3844. curTemplate->m_internalName = "TEAM_HAS_UNITS";
  3845. curTemplate->m_uiName = "Team_/ Team has units.";
  3846. curTemplate->m_numParameters = 1;
  3847. curTemplate->m_parameters[0] = Parameter::TEAM;
  3848. curTemplate->m_numUiStrings = 2;
  3849. curTemplate->m_uiStrings[0] = " ";
  3850. curTemplate->m_uiStrings[1] = " has one or more units.";
  3851. curTemplate = &m_conditionTemplates[Condition::CAMERA_MOVEMENT_FINISHED];
  3852. curTemplate->m_internalName = "CAMERA_MOVEMENT_FINISHED";
  3853. curTemplate->m_uiName = "Camera_/ Camera movement finished.";
  3854. curTemplate->m_numParameters = 0;
  3855. curTemplate->m_numUiStrings = 1;
  3856. curTemplate->m_uiStrings[0] = "The camera movement has finished.";
  3857. curTemplate = &m_conditionTemplates[Condition::NAMED_INSIDE_AREA];
  3858. curTemplate->m_internalName = "NAMED_INSIDE_AREA";
  3859. curTemplate->m_uiName = "Unit_/ Unit inside an area.";
  3860. curTemplate->m_numParameters = 2;
  3861. curTemplate->m_parameters[0] = Parameter::UNIT;
  3862. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  3863. curTemplate->m_numUiStrings = 2;
  3864. curTemplate->m_uiStrings[0] = " ";
  3865. curTemplate->m_uiStrings[1] = " is inside ";
  3866. curTemplate = &m_conditionTemplates[Condition::NAMED_OUTSIDE_AREA];
  3867. curTemplate->m_internalName = "NAMED_OUTSIDE_AREA";
  3868. curTemplate->m_uiName = "Unit_/ Unit outside an area.";
  3869. curTemplate->m_numParameters = 2;
  3870. curTemplate->m_parameters[0] = Parameter::UNIT;
  3871. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  3872. curTemplate->m_numUiStrings = 2;
  3873. curTemplate->m_uiStrings[0] = " ";
  3874. curTemplate->m_uiStrings[1] = " is outside ";
  3875. curTemplate = &m_conditionTemplates[Condition::TEAM_INSIDE_AREA_ENTIRELY];
  3876. curTemplate->m_internalName = "TEAM_INSIDE_AREA_ENTIRELY";
  3877. curTemplate->m_uiName = "Team_/ Team completely inside an area.";
  3878. curTemplate->m_numParameters = 3;
  3879. curTemplate->m_parameters[0] = Parameter::TEAM;
  3880. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  3881. curTemplate->m_parameters[2] = Parameter::SURFACES_ALLOWED;
  3882. curTemplate->m_numUiStrings = 4;
  3883. curTemplate->m_uiStrings[0] = " ";
  3884. curTemplate->m_uiStrings[1] = " is all inside ";
  3885. curTemplate->m_uiStrings[2] = " (";
  3886. curTemplate->m_uiStrings[3] = ").";
  3887. curTemplate = &m_conditionTemplates[Condition::TEAM_OUTSIDE_AREA_ENTIRELY];
  3888. curTemplate->m_internalName = "TEAM_OUTSIDE_AREA_ENTIRELY";
  3889. curTemplate->m_uiName = "Team_/ Team is completely outside an area.";
  3890. curTemplate->m_numParameters = 3;
  3891. curTemplate->m_parameters[0] = Parameter::TEAM;
  3892. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  3893. curTemplate->m_parameters[2] = Parameter::SURFACES_ALLOWED;
  3894. curTemplate->m_numUiStrings = 4;
  3895. curTemplate->m_uiStrings[0] = " ";
  3896. curTemplate->m_uiStrings[1] = " is completely outside ";
  3897. curTemplate->m_uiStrings[2] = " (";
  3898. curTemplate->m_uiStrings[3] = ").";
  3899. curTemplate = &m_conditionTemplates[Condition::NAMED_ATTACKED_BY_OBJECTTYPE];
  3900. curTemplate->m_internalName = "NAMED_ATTACKED_BY_OBJECTTYPE";
  3901. curTemplate->m_uiName = "Unit_/ Unit is attacked by a specific unit type.";
  3902. curTemplate->m_numParameters = 2;
  3903. curTemplate->m_parameters[0] = Parameter::UNIT;
  3904. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3905. curTemplate->m_numUiStrings = 2;
  3906. curTemplate->m_uiStrings[0] = " ";
  3907. curTemplate->m_uiStrings[1] = " has been attacked by a(n) ";
  3908. curTemplate = &m_conditionTemplates[Condition::TEAM_ATTACKED_BY_OBJECTTYPE];
  3909. curTemplate->m_internalName = "TEAM_ATTACKED_BY_OBJECTTYPE";
  3910. curTemplate->m_uiName = "Team_/ Team is attacked by a specific unit type.";
  3911. curTemplate->m_numParameters = 2;
  3912. curTemplate->m_parameters[0] = Parameter::TEAM;
  3913. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  3914. curTemplate->m_numUiStrings = 2;
  3915. curTemplate->m_uiStrings[0] = " ";
  3916. curTemplate->m_uiStrings[1] = " has been attacked by a(n) ";
  3917. curTemplate = &m_conditionTemplates[Condition::NAMED_ATTACKED_BY_PLAYER];
  3918. curTemplate->m_internalName = "NAMED_ATTACKED_BY_PLAYER";
  3919. curTemplate->m_uiName = "Unit_/ Unit has been attacked by a player.";
  3920. curTemplate->m_numParameters = 2;
  3921. curTemplate->m_parameters[0] = Parameter::UNIT;
  3922. curTemplate->m_parameters[1] = Parameter::SIDE;
  3923. curTemplate->m_numUiStrings = 2;
  3924. curTemplate->m_uiStrings[0] = " ";
  3925. curTemplate->m_uiStrings[1] = " has been attacked by ";
  3926. curTemplate = &m_conditionTemplates[Condition::TEAM_ATTACKED_BY_PLAYER];
  3927. curTemplate->m_internalName = "TEAM_ATTACKED_BY_PLAYER";
  3928. curTemplate->m_uiName = "Team_/ Team has been attacked by a player.";
  3929. curTemplate->m_numParameters = 2;
  3930. curTemplate->m_parameters[0] = Parameter::TEAM;
  3931. curTemplate->m_parameters[1] = Parameter::SIDE;
  3932. curTemplate->m_numUiStrings = 2;
  3933. curTemplate->m_uiStrings[0] = " ";
  3934. curTemplate->m_uiStrings[1] = " has been attacked by ";
  3935. curTemplate = &m_conditionTemplates[Condition::BUILT_BY_PLAYER];
  3936. curTemplate->m_internalName = "BUILT_BY_PLAYER";
  3937. curTemplate->m_uiName = "Player_/ Player has built an object type.";
  3938. curTemplate->m_numParameters = 2;
  3939. curTemplate->m_parameters[0] = Parameter::OBJECT_TYPE;
  3940. curTemplate->m_parameters[1] = Parameter::SIDE;
  3941. curTemplate->m_numUiStrings = 2;
  3942. curTemplate->m_uiStrings[0] = " ";
  3943. curTemplate->m_uiStrings[1] = " has been built by ";
  3944. curTemplate = &m_conditionTemplates[Condition::NAMED_CREATED];
  3945. curTemplate->m_internalName = "NAMED_CREATED";
  3946. curTemplate->m_uiName = "Unit_/ Unit has been created.";
  3947. curTemplate->m_numParameters = 1;
  3948. curTemplate->m_parameters[0] = Parameter::UNIT;
  3949. curTemplate->m_numUiStrings = 2;
  3950. curTemplate->m_uiStrings[0] = " ";
  3951. curTemplate->m_uiStrings[1] = " has been created.";
  3952. curTemplate = &m_conditionTemplates[Condition::TEAM_CREATED];
  3953. curTemplate->m_internalName = "TEAM_CREATED";
  3954. curTemplate->m_uiName = "Team_/ Team has been created.";
  3955. curTemplate->m_numParameters = 1;
  3956. curTemplate->m_parameters[0] = Parameter::TEAM;
  3957. curTemplate->m_numUiStrings = 2;
  3958. curTemplate->m_uiStrings[0] = " ";
  3959. curTemplate->m_uiStrings[1] = " has been created.";
  3960. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_CREDITS];
  3961. curTemplate->m_internalName = "PLAYER_HAS_CREDITS";
  3962. curTemplate->m_uiName = "Player_/ Player has (comparison) to a number of credits.";
  3963. curTemplate->m_numParameters = 3;
  3964. curTemplate->m_parameters[0] = Parameter::INT;
  3965. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  3966. curTemplate->m_parameters[2] = Parameter::SIDE;
  3967. curTemplate->m_numUiStrings = 3;
  3968. curTemplate->m_uiStrings[0] = " ";
  3969. curTemplate->m_uiStrings[1] = " is ";
  3970. curTemplate->m_uiStrings[2] = " the number of credits possessed by ";
  3971. curTemplate = &m_conditionTemplates[Condition::NAMED_DISCOVERED];
  3972. curTemplate->m_internalName = "NAMED_DISCOVERED";
  3973. curTemplate->m_uiName = "Player_/ Player has discovered a specific unit.";
  3974. curTemplate->m_numParameters = 2;
  3975. curTemplate->m_parameters[0] = Parameter::UNIT;
  3976. curTemplate->m_parameters[1] = Parameter::SIDE;
  3977. curTemplate->m_numUiStrings = 2;
  3978. curTemplate->m_uiStrings[0] = " ";
  3979. curTemplate->m_uiStrings[1] = " has been discovered by ";
  3980. curTemplate = &m_conditionTemplates[Condition::NAMED_BUILDING_IS_EMPTY];
  3981. curTemplate->m_internalName = "NAMED_BUILDING_IS_EMPTY";
  3982. curTemplate->m_uiName = "Unit_/ A specific building is empty.";
  3983. curTemplate->m_numParameters = 1;
  3984. curTemplate->m_parameters[0] = Parameter::UNIT;
  3985. curTemplate->m_numUiStrings = 2;
  3986. curTemplate->m_uiStrings[0] = " ";
  3987. curTemplate->m_uiStrings[1] = " is empty.";
  3988. curTemplate = &m_conditionTemplates[Condition::BUILDING_ENTERED_BY_PLAYER];
  3989. curTemplate->m_internalName = "BUILDING_ENTERED_BY_PLAYER";
  3990. curTemplate->m_uiName = "Player_/ Player has entered a specific building.";
  3991. curTemplate->m_numParameters = 2;
  3992. curTemplate->m_parameters[0] = Parameter::SIDE;
  3993. curTemplate->m_parameters[1] = Parameter::UNIT;
  3994. curTemplate->m_numUiStrings = 2;
  3995. curTemplate->m_uiStrings[0] = " ";
  3996. curTemplate->m_uiStrings[1] = " has entered building named ";
  3997. curTemplate = &m_conditionTemplates[Condition::ENEMY_SIGHTED];
  3998. curTemplate->m_internalName = "ENEMY_SIGHTED";
  3999. curTemplate->m_uiName = "Unit_/ Unit has sighted a(n) friendly/neutral/enemy unit belonging to a side.";
  4000. curTemplate->m_numParameters = 3;
  4001. curTemplate->m_parameters[0] = Parameter::UNIT;
  4002. curTemplate->m_parameters[1] = Parameter::RELATION;
  4003. curTemplate->m_parameters[2] = Parameter::SIDE;
  4004. curTemplate->m_numUiStrings = 4;
  4005. curTemplate->m_uiStrings[0] = " ";
  4006. curTemplate->m_uiStrings[1] = " sees a(n) ";
  4007. curTemplate->m_uiStrings[2] = " unit belonging to ";
  4008. curTemplate->m_uiStrings[3] = ".";
  4009. curTemplate = &m_conditionTemplates[Condition::TYPE_SIGHTED];
  4010. curTemplate->m_internalName = "TYPE_SIGHTED";
  4011. curTemplate->m_uiName = "Unit_/ Unit has sighted a type of unit belonging to a side.";
  4012. curTemplate->m_numParameters = 3;
  4013. curTemplate->m_parameters[0] = Parameter::UNIT;
  4014. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  4015. curTemplate->m_parameters[2] = Parameter::SIDE;
  4016. curTemplate->m_numUiStrings = 4;
  4017. curTemplate->m_uiStrings[0] = " ";
  4018. curTemplate->m_uiStrings[1] = " sees a(n) ";
  4019. curTemplate->m_uiStrings[2] = " belonging to ";
  4020. curTemplate->m_uiStrings[3] = ".";
  4021. curTemplate = &m_conditionTemplates[Condition::TEAM_DISCOVERED];
  4022. curTemplate->m_internalName = "TEAM_DISCOVERED";
  4023. curTemplate->m_uiName = "Player_/ Player has discovered a team.";
  4024. curTemplate->m_numParameters = 2;
  4025. curTemplate->m_parameters[0] = Parameter::TEAM;
  4026. curTemplate->m_parameters[1] = Parameter::SIDE;
  4027. curTemplate->m_numUiStrings = 2;
  4028. curTemplate->m_uiStrings[0] = " ";
  4029. curTemplate->m_uiStrings[1] = " has been discovered by ";
  4030. curTemplate = &m_conditionTemplates[Condition::MISSION_ATTEMPTS];
  4031. curTemplate->m_internalName = "MISSION_ATTEMPTS";
  4032. curTemplate->m_uiName = "Player_/ Player has attempted the mission a number of times.";
  4033. curTemplate->m_numParameters = 3;
  4034. curTemplate->m_parameters[0] = Parameter::SIDE;
  4035. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4036. curTemplate->m_parameters[2] = Parameter::INT;
  4037. curTemplate->m_numUiStrings = 4;
  4038. curTemplate->m_uiStrings[0] = " ";
  4039. curTemplate->m_uiStrings[1] = " has attempted the mission ";
  4040. curTemplate->m_uiStrings[2] = " ";
  4041. curTemplate->m_uiStrings[3] = " times.";
  4042. curTemplate = &m_conditionTemplates[Condition::NAMED_OWNED_BY_PLAYER];
  4043. curTemplate->m_internalName = "NAMED_OWNED_BY_PLAYER";
  4044. curTemplate->m_uiName = "Player_/ Player owns the specific Unit.";
  4045. curTemplate->m_numParameters = 2;
  4046. curTemplate->m_parameters[0] = Parameter::UNIT;
  4047. curTemplate->m_parameters[1] = Parameter::SIDE;
  4048. curTemplate->m_numUiStrings = 2;
  4049. curTemplate->m_uiStrings[0] = " ";
  4050. curTemplate->m_uiStrings[1] = " is owned by ";
  4051. curTemplate = &m_conditionTemplates[Condition::TEAM_OWNED_BY_PLAYER];
  4052. curTemplate->m_internalName = "TEAM_OWNED_BY_PLAYER";
  4053. curTemplate->m_uiName = "Player_/ Player owns a specific team.";
  4054. curTemplate->m_numParameters = 2;
  4055. curTemplate->m_parameters[0] = Parameter::TEAM;
  4056. curTemplate->m_parameters[1] = Parameter::SIDE;
  4057. curTemplate->m_numUiStrings = 2;
  4058. curTemplate->m_uiStrings[0] = " ";
  4059. curTemplate->m_uiStrings[1] = " is owned by ";
  4060. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_N_OR_FEWER_BUILDINGS];
  4061. curTemplate->m_internalName = "PLAYER_HAS_N_OR_FEWER_BUILDINGS";
  4062. curTemplate->m_uiName = "Player_/ Player currently owns N or fewer buildings.";
  4063. curTemplate->m_numParameters = 2;
  4064. curTemplate->m_parameters[0] = Parameter::SIDE;
  4065. curTemplate->m_parameters[1] = Parameter::INT;
  4066. curTemplate->m_numUiStrings = 3;
  4067. curTemplate->m_uiStrings[0] = " ";
  4068. curTemplate->m_uiStrings[1] = " currently owns ";
  4069. curTemplate->m_uiStrings[2] = " or fewer buildings.";
  4070. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_N_OR_FEWER_FACTION_BUILDINGS];
  4071. curTemplate->m_internalName = "PLAYER_HAS_N_OR_FEWER_FACTION_BUILDINGS";
  4072. curTemplate->m_uiName = "Player_/ Player currently owns N or fewer faction buildings.";
  4073. curTemplate->m_numParameters = 2;
  4074. curTemplate->m_parameters[0] = Parameter::SIDE;
  4075. curTemplate->m_parameters[1] = Parameter::INT;
  4076. curTemplate->m_numUiStrings = 3;
  4077. curTemplate->m_uiStrings[0] = " ";
  4078. curTemplate->m_uiStrings[1] = " currently owns ";
  4079. curTemplate->m_uiStrings[2] = " or fewer faction buildings.";
  4080. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_POWER];
  4081. curTemplate->m_internalName = "PLAYER_HAS_POWER";
  4082. curTemplate->m_uiName = "Player_/ Player's base currently has power.";
  4083. curTemplate->m_numParameters = 1;
  4084. curTemplate->m_parameters[0] = Parameter::SIDE;
  4085. curTemplate->m_numUiStrings = 2;
  4086. curTemplate->m_uiStrings[0] = " ";
  4087. curTemplate->m_uiStrings[1] = " buildings are powered.";
  4088. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_NO_POWER];
  4089. curTemplate->m_internalName = "PLAYER_HAS_NO_POWER";
  4090. curTemplate->m_uiName = "Player_/ Player's base currently has no power.";
  4091. curTemplate->m_numParameters = 1;
  4092. curTemplate->m_parameters[0] = Parameter::SIDE;
  4093. curTemplate->m_numUiStrings = 2;
  4094. curTemplate->m_uiStrings[0] = " ";
  4095. curTemplate->m_uiStrings[1] = " buildings are not powered.";
  4096. curTemplate = &m_conditionTemplates[Condition::NAMED_REACHED_WAYPOINTS_END];
  4097. curTemplate->m_internalName = "NAMED_REACHED_WAYPOINTS_END";
  4098. curTemplate->m_uiName = "Unit_/ Unit has reached the end of a specific waypoint path.";
  4099. curTemplate->m_numParameters = 2;
  4100. curTemplate->m_parameters[0] = Parameter::UNIT;
  4101. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  4102. curTemplate->m_numUiStrings = 2;
  4103. curTemplate->m_uiStrings[0] = " ";
  4104. curTemplate->m_uiStrings[1] = " has reached the end of ";
  4105. curTemplate = &m_conditionTemplates[Condition::TEAM_REACHED_WAYPOINTS_END];
  4106. curTemplate->m_internalName = "TEAM_REACHED_WAYPOINTS_END";
  4107. curTemplate->m_uiName = "Team_/ Team has reached the end of a specific waypoint path.";
  4108. curTemplate->m_numParameters = 2;
  4109. curTemplate->m_parameters[0] = Parameter::TEAM;
  4110. curTemplate->m_parameters[1] = Parameter::WAYPOINT_PATH;
  4111. curTemplate->m_numUiStrings = 2;
  4112. curTemplate->m_uiStrings[0] = " ";
  4113. curTemplate->m_uiStrings[1] = " has reached the end of ";
  4114. curTemplate = &m_conditionTemplates[Condition::NAMED_SELECTED];
  4115. curTemplate->m_internalName = "NAMED_SELECTED";
  4116. curTemplate->m_uiName = "Unit_/ Unit currently selected.";
  4117. curTemplate->m_numParameters = 1;
  4118. curTemplate->m_parameters[0] = Parameter::UNIT;
  4119. curTemplate->m_numUiStrings = 2;
  4120. curTemplate->m_uiStrings[0] = " ";
  4121. curTemplate->m_uiStrings[1] = " is currently selected.";
  4122. curTemplate = &m_conditionTemplates[Condition::NAMED_ENTERED_AREA];
  4123. curTemplate->m_internalName = "NAMED_ENTERED_AREA";
  4124. curTemplate->m_uiName = "Unit_/ Unit enters an area.";
  4125. curTemplate->m_numParameters = 2;
  4126. curTemplate->m_parameters[0] = Parameter::UNIT;
  4127. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4128. curTemplate->m_numUiStrings = 2;
  4129. curTemplate->m_uiStrings[0] = " ";
  4130. curTemplate->m_uiStrings[1] = " enters ";
  4131. curTemplate = &m_conditionTemplates[Condition::NAMED_EXITED_AREA];
  4132. curTemplate->m_internalName = "NAMED_EXITED_AREA";
  4133. curTemplate->m_uiName = "Unit_/ Unit exits an area.";
  4134. curTemplate->m_numParameters = 2;
  4135. curTemplate->m_parameters[0] = Parameter::UNIT;
  4136. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4137. curTemplate->m_numUiStrings = 2;
  4138. curTemplate->m_uiStrings[0] = " ";
  4139. curTemplate->m_uiStrings[1] = " exits ";
  4140. curTemplate = &m_conditionTemplates[Condition::TEAM_ENTERED_AREA_ENTIRELY];
  4141. curTemplate->m_internalName = "TEAM_ENTERED_AREA_ENTIRELY";
  4142. curTemplate->m_uiName = "Team_/ Team entirely enters an area.";
  4143. curTemplate->m_numParameters = 3;
  4144. curTemplate->m_parameters[0] = Parameter::TEAM;
  4145. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4146. curTemplate->m_parameters[2] = Parameter::SURFACES_ALLOWED;
  4147. curTemplate->m_numUiStrings = 4;
  4148. curTemplate->m_uiStrings[0] = " ";
  4149. curTemplate->m_uiStrings[1] = " all enter ";
  4150. curTemplate->m_uiStrings[2] = " (";
  4151. curTemplate->m_uiStrings[3] = ").";
  4152. curTemplate = &m_conditionTemplates[Condition::TEAM_ENTERED_AREA_PARTIALLY];
  4153. curTemplate->m_internalName = "TEAM_ENTERED_AREA_PARTIALLY";
  4154. curTemplate->m_uiName = "Team_/ One unit enters an area.";
  4155. curTemplate->m_numParameters = 3;
  4156. curTemplate->m_parameters[0] = Parameter::TEAM;
  4157. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4158. curTemplate->m_parameters[2] = Parameter::SURFACES_ALLOWED;
  4159. curTemplate->m_numUiStrings = 4;
  4160. curTemplate->m_uiStrings[0] = "One unit from ";
  4161. curTemplate->m_uiStrings[1] = " enters ";
  4162. curTemplate->m_uiStrings[2] = " (";
  4163. curTemplate->m_uiStrings[3] = ").";
  4164. curTemplate = &m_conditionTemplates[Condition::TEAM_EXITED_AREA_ENTIRELY];
  4165. curTemplate->m_internalName = "TEAM_EXITED_AREA_ENTIRELY";
  4166. curTemplate->m_uiName = "Team_/ Team entirely exits an area.";
  4167. curTemplate->m_numParameters = 3;
  4168. curTemplate->m_parameters[0] = Parameter::TEAM;
  4169. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4170. curTemplate->m_parameters[2] = Parameter::SURFACES_ALLOWED;
  4171. curTemplate->m_numUiStrings = 4;
  4172. curTemplate->m_uiStrings[0] = " ";
  4173. curTemplate->m_uiStrings[1] = " all exit ";
  4174. curTemplate->m_uiStrings[2] = " (";
  4175. curTemplate->m_uiStrings[3] = ").";
  4176. curTemplate = &m_conditionTemplates[Condition::TEAM_EXITED_AREA_PARTIALLY];
  4177. curTemplate->m_internalName = "TEAM_EXITED_AREA_PARTIALLY";
  4178. curTemplate->m_uiName = "Team_/ One unit exits an area.";
  4179. curTemplate->m_numParameters = 3;
  4180. curTemplate->m_parameters[0] = Parameter::TEAM;
  4181. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4182. curTemplate->m_parameters[2] = Parameter::SURFACES_ALLOWED;
  4183. curTemplate->m_numUiStrings = 4;
  4184. curTemplate->m_uiStrings[0] = "One unit from ";
  4185. curTemplate->m_uiStrings[1] = " exits ";
  4186. curTemplate->m_uiStrings[2] = " (";
  4187. curTemplate->m_uiStrings[3] = ").";
  4188. curTemplate = &m_conditionTemplates[Condition::MULTIPLAYER_ALLIED_VICTORY];
  4189. curTemplate->m_internalName = "MULTIPLAYER_ALLIED_VICTORY";
  4190. curTemplate->m_uiName = "Multiplayer_/ Multiplayer allied victory.";
  4191. curTemplate->m_numParameters = 0;
  4192. curTemplate->m_numUiStrings = 1;
  4193. curTemplate->m_uiStrings[0] = "The multiplayer game has ended in victory for the local player and his allies.";
  4194. curTemplate = &m_conditionTemplates[Condition::MULTIPLAYER_ALLIED_DEFEAT];
  4195. curTemplate->m_internalName = "MULTIPLAYER_ALLIED_DEFEAT";
  4196. curTemplate->m_uiName = "Multiplayer_/ Multiplayer allied defeat.";
  4197. curTemplate->m_numParameters = 0;
  4198. curTemplate->m_numUiStrings = 1;
  4199. curTemplate->m_uiStrings[0] = "The multiplayer game has ended in defeat for the local player and his allies.";
  4200. curTemplate = &m_conditionTemplates[Condition::MULTIPLAYER_PLAYER_DEFEAT];
  4201. curTemplate->m_internalName = "MULTIPLAYER_PLAYER_DEFEAT";
  4202. curTemplate->m_uiName = "Multiplayer_/ Multiplayer local player defeat check.";
  4203. curTemplate->m_numParameters = 0;
  4204. curTemplate->m_numUiStrings = 1;
  4205. curTemplate->m_uiStrings[0] = "Everything belonging to the local player has been destroyed, but his allies may or may not have been defeated.";
  4206. curTemplate = &m_conditionTemplates[Condition::HAS_FINISHED_VIDEO];
  4207. curTemplate->m_internalName = "HAS_FINISHED_VIDEO";
  4208. curTemplate->m_uiName = "Multimedia_/ Video has completed playing.";
  4209. curTemplate->m_numParameters = 1;
  4210. curTemplate->m_parameters[0] = Parameter::MOVIE;
  4211. curTemplate->m_numUiStrings = 2;
  4212. curTemplate->m_uiStrings[0] = " ";
  4213. curTemplate->m_uiStrings[1] = " has completed playing.";
  4214. curTemplate = &m_conditionTemplates[Condition::HAS_FINISHED_SPEECH];
  4215. curTemplate->m_internalName = "HAS_FINISHED_SPEECH";
  4216. curTemplate->m_uiName = "Multimedia_/ Speech has completed playing.";
  4217. curTemplate->m_numParameters = 1;
  4218. curTemplate->m_parameters[0] = Parameter::DIALOG;
  4219. curTemplate->m_numUiStrings = 2;
  4220. curTemplate->m_uiStrings[0] = " ";
  4221. curTemplate->m_uiStrings[1] = " has completed playing.";
  4222. curTemplate = &m_conditionTemplates[Condition::HAS_FINISHED_AUDIO];
  4223. curTemplate->m_internalName = "HAS_FINISHED_AUDIO";
  4224. curTemplate->m_uiName = "Multimedia_/ Sound has completed playing.";
  4225. curTemplate->m_numParameters = 1;
  4226. curTemplate->m_parameters[0] = Parameter::SOUND;
  4227. curTemplate->m_numUiStrings = 2;
  4228. curTemplate->m_uiStrings[0] = " ";
  4229. curTemplate->m_uiStrings[1] = " has completed playing.";
  4230. curTemplate = &m_conditionTemplates[Condition::PLAYER_TRIGGERED_SPECIAL_POWER];
  4231. curTemplate->m_internalName = "PLAYER_TRIGGERED_SPECIAL_POWER";
  4232. curTemplate->m_uiName = "Player_/ Player starts using a special power.";
  4233. curTemplate->m_numParameters = 2;
  4234. curTemplate->m_parameters[0] = Parameter::SIDE;
  4235. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  4236. curTemplate->m_numUiStrings = 3;
  4237. curTemplate->m_uiStrings[0] = "Player ";
  4238. curTemplate->m_uiStrings[1] = " starts using ";
  4239. curTemplate->m_uiStrings[2] = ".";
  4240. curTemplate = &m_conditionTemplates[Condition::PLAYER_TRIGGERED_SPECIAL_POWER_FROM_NAMED];
  4241. curTemplate->m_internalName = "PLAYER_TRIGGERED_SPECIAL_POWER_FROM_NAMED";
  4242. curTemplate->m_uiName = "Player_/ Player start using a special power from a named unit.";
  4243. curTemplate->m_numParameters = 3;
  4244. curTemplate->m_parameters[0] = Parameter::SIDE;
  4245. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  4246. curTemplate->m_parameters[2] = Parameter::UNIT;
  4247. curTemplate->m_numUiStrings = 4;
  4248. curTemplate->m_uiStrings[0] = "Player ";
  4249. curTemplate->m_uiStrings[1] = " starts using ";
  4250. curTemplate->m_uiStrings[2] = " from ";
  4251. curTemplate->m_uiStrings[3] = ".";
  4252. curTemplate = &m_conditionTemplates[Condition::PLAYER_MIDWAY_SPECIAL_POWER];
  4253. curTemplate->m_internalName = "PLAYER_MIDWAY_SPECIAL_POWER";
  4254. curTemplate->m_uiName = "Player_/ Player is midway through using a special power.";
  4255. curTemplate->m_numParameters = 2;
  4256. curTemplate->m_parameters[0] = Parameter::SIDE;
  4257. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  4258. curTemplate->m_numUiStrings = 3;
  4259. curTemplate->m_uiStrings[0] = "Player ";
  4260. curTemplate->m_uiStrings[1] = " is midway using ";
  4261. curTemplate->m_uiStrings[2] = ".";
  4262. curTemplate = &m_conditionTemplates[Condition::PLAYER_MIDWAY_SPECIAL_POWER_FROM_NAMED];
  4263. curTemplate->m_internalName = "PLAYER_MIDWAY_SPECIAL_POWER_FROM_NAMED";
  4264. curTemplate->m_uiName = "Player_/ Player is midway through using a special power from a named unit.";
  4265. curTemplate->m_numParameters = 3;
  4266. curTemplate->m_parameters[0] = Parameter::SIDE;
  4267. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  4268. curTemplate->m_parameters[2] = Parameter::UNIT;
  4269. curTemplate->m_numUiStrings = 4;
  4270. curTemplate->m_uiStrings[0] = "Player ";
  4271. curTemplate->m_uiStrings[1] = " is midway using ";
  4272. curTemplate->m_uiStrings[2] = " from ";
  4273. curTemplate->m_uiStrings[3] = ".";
  4274. curTemplate = &m_conditionTemplates[Condition::PLAYER_COMPLETED_SPECIAL_POWER];
  4275. curTemplate->m_internalName = "PLAYER_COMPLETED_SPECIAL_POWER";
  4276. curTemplate->m_uiName = "Player_/ Player completed using a special power.";
  4277. curTemplate->m_numParameters = 2;
  4278. curTemplate->m_parameters[0] = Parameter::SIDE;
  4279. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  4280. curTemplate->m_numUiStrings = 3;
  4281. curTemplate->m_uiStrings[0] = "Player ";
  4282. curTemplate->m_uiStrings[1] = " completed using ";
  4283. curTemplate->m_uiStrings[2] = ".";
  4284. curTemplate = &m_conditionTemplates[Condition::PLAYER_COMPLETED_SPECIAL_POWER_FROM_NAMED];
  4285. curTemplate->m_internalName = "PLAYER_COMPLETED_SPECIAL_POWER_FROM_NAMED";
  4286. curTemplate->m_uiName = "Player_/ Player completed using a special power from a named unit.";
  4287. curTemplate->m_numParameters = 3;
  4288. curTemplate->m_parameters[0] = Parameter::SIDE;
  4289. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  4290. curTemplate->m_parameters[2] = Parameter::UNIT;
  4291. curTemplate->m_numUiStrings = 4;
  4292. curTemplate->m_uiStrings[0] = "Player ";
  4293. curTemplate->m_uiStrings[1] = " completed using ";
  4294. curTemplate->m_uiStrings[2] = " from ";
  4295. curTemplate->m_uiStrings[3] = ".";
  4296. curTemplate = &m_conditionTemplates[Condition::PLAYER_ACQUIRED_SCIENCE];
  4297. curTemplate->m_internalName = "PLAYER_ACQUIRED_SCIENCE";
  4298. curTemplate->m_uiName = "Player_/ Player acquired a Science.";
  4299. curTemplate->m_numParameters = 2;
  4300. curTemplate->m_parameters[0] = Parameter::SIDE;
  4301. curTemplate->m_parameters[1] = Parameter::SCIENCE;
  4302. curTemplate->m_numUiStrings = 3;
  4303. curTemplate->m_uiStrings[0] = "Player ";
  4304. curTemplate->m_uiStrings[1] = " acquired ";
  4305. curTemplate->m_uiStrings[2] = ".";
  4306. curTemplate = &m_conditionTemplates[Condition::PLAYER_CAN_PURCHASE_SCIENCE];
  4307. curTemplate->m_internalName = "PLAYER_CAN_PURCHASE_SCIENCE";
  4308. curTemplate->m_uiName = "Player_/ Player can purchase a particular Science (has all prereqs & points).";
  4309. curTemplate->m_numParameters = 2;
  4310. curTemplate->m_parameters[0] = Parameter::SIDE;
  4311. curTemplate->m_parameters[1] = Parameter::SCIENCE;
  4312. curTemplate->m_numUiStrings = 3;
  4313. curTemplate->m_uiStrings[0] = "Player ";
  4314. curTemplate->m_uiStrings[1] = " can purchase ";
  4315. curTemplate->m_uiStrings[2] = ".";
  4316. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_SCIENCEPURCHASEPOINTS];
  4317. curTemplate->m_internalName = "PLAYER_HAS_SCIENCEPURCHASEPOINTS";
  4318. curTemplate->m_uiName = "Player_/ Player has a certain number of Science Purchase Points available.";
  4319. curTemplate->m_numParameters = 2;
  4320. curTemplate->m_parameters[0] = Parameter::SIDE;
  4321. curTemplate->m_parameters[1] = Parameter::INT;
  4322. curTemplate->m_numUiStrings = 3;
  4323. curTemplate->m_uiStrings[0] = "Player ";
  4324. curTemplate->m_uiStrings[1] = " has at least ";
  4325. curTemplate->m_uiStrings[2] = " Science Purchase Points available.";
  4326. curTemplate = &m_conditionTemplates[Condition::NAMED_HAS_FREE_CONTAINER_SLOTS];
  4327. curTemplate->m_internalName = "NAMED_HAS_FREE_CONTAINER_SLOTS";
  4328. curTemplate->m_uiName = "Unit_/ Unit has free container slots.";
  4329. curTemplate->m_numParameters = 1;
  4330. curTemplate->m_parameters[0] = Parameter::UNIT;
  4331. curTemplate->m_numUiStrings = 2;
  4332. curTemplate->m_uiStrings[0] = " ";
  4333. curTemplate->m_uiStrings[1] = " has free container slots.";
  4334. curTemplate = &m_conditionTemplates[Condition::PLAYER_BUILT_UPGRADE];
  4335. curTemplate->m_internalName = "PLAYER_BUILT_UPGRADE";
  4336. curTemplate->m_uiName = "Player_/ Player built an upgrade.";
  4337. curTemplate->m_numParameters = 2;
  4338. curTemplate->m_parameters[0] = Parameter::SIDE;
  4339. curTemplate->m_parameters[1] = Parameter::UPGRADE;
  4340. curTemplate->m_numUiStrings = 3;
  4341. curTemplate->m_uiStrings[0] = "Player ";
  4342. curTemplate->m_uiStrings[1] = " built ";
  4343. curTemplate->m_uiStrings[2] = ".";
  4344. curTemplate = &m_conditionTemplates[Condition::PLAYER_BUILT_UPGRADE_FROM_NAMED];
  4345. curTemplate->m_internalName = "PLAYER_BUILT_UPGRADE_FROM_NAMED";
  4346. curTemplate->m_uiName = "Player_/ Player built an upgrade from a named unit.";
  4347. curTemplate->m_numParameters = 3;
  4348. curTemplate->m_parameters[0] = Parameter::SIDE;
  4349. curTemplate->m_parameters[1] = Parameter::UPGRADE;
  4350. curTemplate->m_parameters[2] = Parameter::UNIT;
  4351. curTemplate->m_numUiStrings = 4;
  4352. curTemplate->m_uiStrings[0] = "Player ";
  4353. curTemplate->m_uiStrings[1] = " built ";
  4354. curTemplate->m_uiStrings[2] = " from ";
  4355. curTemplate->m_uiStrings[3] = ".";
  4356. curTemplate = &m_conditionTemplates[Condition::PLAYER_DESTROYED_N_BUILDINGS_PLAYER];
  4357. curTemplate->m_internalName = "PLAYER_DESTROYED_N_BUILDINGS_PLAYER";
  4358. curTemplate->m_uiName = "Player_/ Player destroyed N or more of an opponent's buildings.";
  4359. curTemplate->m_numParameters = 3;
  4360. curTemplate->m_parameters[0] = Parameter::SIDE;
  4361. curTemplate->m_parameters[1] = Parameter::INT;
  4362. curTemplate->m_parameters[2] = Parameter::SIDE;
  4363. curTemplate->m_numUiStrings = 4;
  4364. curTemplate->m_uiStrings[0] = "Player ";
  4365. curTemplate->m_uiStrings[1] = " destroyed ";
  4366. curTemplate->m_uiStrings[2] = " or more buildings owned by ";
  4367. curTemplate->m_uiStrings[3] = ".";
  4368. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_OBJECT_COMPARISON];
  4369. curTemplate->m_internalName = "PLAYER_HAS_OBJECT_COMPARISON";
  4370. curTemplate->m_uiName = "Player_/ Player has (comparison) unit type.";
  4371. curTemplate->m_numParameters = 4;
  4372. curTemplate->m_parameters[0] = Parameter::SIDE;
  4373. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4374. curTemplate->m_parameters[2] = Parameter::INT;
  4375. curTemplate->m_parameters[3] = Parameter::OBJECT_TYPE;
  4376. curTemplate->m_numUiStrings = 4;
  4377. curTemplate->m_uiStrings[0] = " ";
  4378. curTemplate->m_uiStrings[1] = " has ";
  4379. curTemplate->m_uiStrings[2] = " ";
  4380. curTemplate->m_uiStrings[3] = " unit or structure of type ";
  4381. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_COMPARISON_UNIT_TYPE_IN_TRIGGER_AREA];
  4382. curTemplate->m_internalName = "PLAYER_HAS_COMPARISON_UNIT_TYPE_IN_TRIGGER_AREA";
  4383. curTemplate->m_uiName = "Player_/ Player has (comparison) unit type in an area.";
  4384. curTemplate->m_numParameters = 5;
  4385. curTemplate->m_parameters[0] = Parameter::SIDE;
  4386. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4387. curTemplate->m_parameters[2] = Parameter::INT;
  4388. curTemplate->m_parameters[3] = Parameter::OBJECT_TYPE;
  4389. curTemplate->m_parameters[4] = Parameter::TRIGGER_AREA;
  4390. curTemplate->m_numUiStrings = 5;
  4391. curTemplate->m_uiStrings[0] = " ";
  4392. curTemplate->m_uiStrings[1] = " has ";
  4393. curTemplate->m_uiStrings[2] = " ";
  4394. curTemplate->m_uiStrings[3] = " unit or structure of type ";
  4395. curTemplate->m_uiStrings[4] = " in the ";
  4396. curTemplate = &m_conditionTemplates[Condition::PLAYER_HAS_COMPARISON_UNIT_KIND_IN_TRIGGER_AREA];
  4397. curTemplate->m_internalName = "PLAYER_HAS_COMPARISON_UNIT_KIND_IN_TRIGGER_AREA";
  4398. curTemplate->m_uiName = "Player_/ Player has (comparison) kind of unit or structure in an area.";
  4399. curTemplate->m_numParameters = 5;
  4400. curTemplate->m_parameters[0] = Parameter::SIDE;
  4401. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4402. curTemplate->m_parameters[2] = Parameter::INT;
  4403. curTemplate->m_parameters[3] = Parameter::KIND_OF_PARAM;
  4404. curTemplate->m_parameters[4] = Parameter::TRIGGER_AREA ;
  4405. curTemplate->m_numUiStrings = 5;
  4406. curTemplate->m_uiStrings[0] = " ";
  4407. curTemplate->m_uiStrings[1] = " has ";
  4408. curTemplate->m_uiStrings[2] = " ";
  4409. curTemplate->m_uiStrings[3] = " unit or structure with ";
  4410. curTemplate->m_uiStrings[4] = " in the ";
  4411. curTemplate = &m_conditionTemplates[Condition::PLAYER_POWER_COMPARE_PERCENT];
  4412. curTemplate->m_internalName = "PLAYER_POWER_COMPARE_PERCENT";
  4413. curTemplate->m_uiName = "Player_/ Player has (comparison) percent power supply to consumption.";
  4414. curTemplate->m_numParameters = 3;
  4415. curTemplate->m_parameters[0] = Parameter::SIDE;
  4416. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4417. curTemplate->m_parameters[2] = Parameter::INT;
  4418. curTemplate->m_numUiStrings = 4;
  4419. curTemplate->m_uiStrings[0] = " ";
  4420. curTemplate->m_uiStrings[1] = " has ";
  4421. curTemplate->m_uiStrings[2] = " ";
  4422. curTemplate->m_uiStrings[3] = " percent power supply ratio.";
  4423. curTemplate = &m_conditionTemplates[Condition::PLAYER_EXCESS_POWER_COMPARE_VALUE];
  4424. curTemplate->m_internalName = "PLAYER_EXCESS_POWER_COMPARE_VALUE";
  4425. curTemplate->m_uiName = "Player_/ Player has (comparison) kilowatts excess power supply.";
  4426. curTemplate->m_numParameters = 3;
  4427. curTemplate->m_parameters[0] = Parameter::SIDE;
  4428. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4429. curTemplate->m_parameters[2] = Parameter::INT;
  4430. curTemplate->m_numUiStrings = 4;
  4431. curTemplate->m_uiStrings[0] = " ";
  4432. curTemplate->m_uiStrings[1] = " has ";
  4433. curTemplate->m_uiStrings[2] = " ";
  4434. curTemplate->m_uiStrings[3] = " excess kilowatts power supply.";
  4435. curTemplate = &m_conditionTemplates[Condition::UNIT_EMPTIED];
  4436. curTemplate->m_internalName = "UNIT_EMPTIED";
  4437. curTemplate->m_uiName = "Unit_/ Unit has emptied its contents.";
  4438. curTemplate->m_numParameters = 1;
  4439. curTemplate->m_parameters[0] = Parameter::UNIT;
  4440. curTemplate->m_numUiStrings = 2;
  4441. curTemplate->m_uiStrings[0] = " ";
  4442. curTemplate->m_uiStrings[1] = " emptied its contents.";
  4443. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_SPECIAL_POWER_READY];
  4444. curTemplate->m_internalName = "SKIRMISH_SPECIAL_POWER_READY";
  4445. curTemplate->m_uiName = "Skirmish_/ Player's special power is ready to fire.";
  4446. curTemplate->m_numParameters = 2;
  4447. curTemplate->m_parameters[0] = Parameter::SIDE;
  4448. curTemplate->m_parameters[1] = Parameter::SPECIAL_POWER;
  4449. curTemplate->m_numUiStrings = 3;
  4450. curTemplate->m_uiStrings[0] = " ";
  4451. curTemplate->m_uiStrings[1] = " is ready to fire ";
  4452. curTemplate->m_uiStrings[2] = ".";
  4453. curTemplate = &m_conditionTemplates[Condition::UNIT_HAS_OBJECT_STATUS];
  4454. curTemplate->m_internalName = "UNIT_HAS_OBJECT_STATUS";
  4455. curTemplate->m_uiName = "Unit_/ Unit has object status.";
  4456. curTemplate->m_numParameters = 2;
  4457. curTemplate->m_parameters[0] = Parameter::UNIT;
  4458. curTemplate->m_parameters[1] = Parameter::OBJECT_STATUS;
  4459. curTemplate->m_numUiStrings = 2;
  4460. curTemplate->m_uiStrings[0] = " ";
  4461. curTemplate->m_uiStrings[1] = " has ";
  4462. curTemplate = &m_conditionTemplates[Condition::TEAM_ALL_HAS_OBJECT_STATUS];
  4463. curTemplate->m_internalName = "TEAM_ALL_HAS_OBJECT_STATUS";
  4464. curTemplate->m_uiName = "Team_/ Team has object status - all.";
  4465. curTemplate->m_numParameters = 2;
  4466. curTemplate->m_parameters[0] = Parameter::TEAM;
  4467. curTemplate->m_parameters[1] = Parameter::OBJECT_STATUS;
  4468. curTemplate->m_numUiStrings = 2;
  4469. curTemplate->m_uiStrings[0] = " ";
  4470. curTemplate->m_uiStrings[1] = " has ";
  4471. curTemplate = &m_conditionTemplates[Condition::TEAM_SOME_HAVE_OBJECT_STATUS];
  4472. curTemplate->m_internalName = "TEAM_SOME_HAVE_OBJECT_STATUS";
  4473. curTemplate->m_uiName = "Team_/ Team has object status - partial.";
  4474. curTemplate->m_numParameters = 2;
  4475. curTemplate->m_parameters[0] = Parameter::TEAM;
  4476. curTemplate->m_parameters[1] = Parameter::OBJECT_STATUS;
  4477. curTemplate->m_numUiStrings = 2;
  4478. curTemplate->m_uiStrings[0] = " ";
  4479. curTemplate->m_uiStrings[1] = " has ";
  4480. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_VALUE_IN_AREA];
  4481. curTemplate->m_internalName = "SKIRMISH_VALUE_IN_AREA";
  4482. curTemplate->m_uiName = "Skirmish Only_/ Player has total value in area.";
  4483. curTemplate->m_numParameters = 4;
  4484. curTemplate->m_parameters[0] = Parameter::SIDE;
  4485. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4486. curTemplate->m_parameters[2] = Parameter::INT;
  4487. curTemplate->m_parameters[3] = Parameter::TRIGGER_AREA;
  4488. curTemplate->m_numUiStrings = 4;
  4489. curTemplate->m_uiStrings[0] = " ";
  4490. curTemplate->m_uiStrings[1] = " has ";
  4491. curTemplate->m_uiStrings[2] = " ";
  4492. curTemplate->m_uiStrings[3] = " within area ";
  4493. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_FACTION];
  4494. curTemplate->m_internalName = "SKIRMISH_PLAYER_FACTION";
  4495. curTemplate->m_uiName = "Skirmish_/ Player is faction. - untested";
  4496. curTemplate->m_numParameters = 2;
  4497. curTemplate->m_parameters[0] = Parameter::SIDE;
  4498. curTemplate->m_parameters[1] = Parameter::FACTION_NAME;
  4499. curTemplate->m_numUiStrings = 2;
  4500. curTemplate->m_uiStrings[0] = " ";
  4501. curTemplate->m_uiStrings[1] = " is ";
  4502. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_SUPPLIES_VALUE_WITHIN_DISTANCE];
  4503. curTemplate->m_internalName = "SKIRMISH_SUPPLIES_VALUE_WITHIN_DISTANCE";
  4504. curTemplate->m_uiName = "Skirmish Only_/ Supplies are within specified distance.";
  4505. curTemplate->m_numParameters = 4;
  4506. curTemplate->m_parameters[0] = Parameter::SIDE;
  4507. curTemplate->m_parameters[1] = Parameter::REAL;
  4508. curTemplate->m_parameters[2] = Parameter::TRIGGER_AREA;
  4509. curTemplate->m_parameters[3] = Parameter::REAL;
  4510. curTemplate->m_numUiStrings = 4;
  4511. curTemplate->m_uiStrings[0] = " ";
  4512. curTemplate->m_uiStrings[1] = " has supplies within ";
  4513. curTemplate->m_uiStrings[2] = " of ";
  4514. curTemplate->m_uiStrings[3] = " worth at least ";
  4515. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_TECH_BUILDING_WITHIN_DISTANCE];
  4516. curTemplate->m_internalName = "SKIRMISH_TECH_BUILDING_WITHIN_DISTANCE";
  4517. curTemplate->m_uiName = "Skirmish Only_/ Tech building is within specified distance.";
  4518. curTemplate->m_numParameters = 3;
  4519. curTemplate->m_parameters[0] = Parameter::SIDE;
  4520. curTemplate->m_parameters[1] = Parameter::REAL;
  4521. curTemplate->m_parameters[2] = Parameter::TRIGGER_AREA;
  4522. curTemplate->m_numUiStrings = 3;
  4523. curTemplate->m_uiStrings[0] = " ";
  4524. curTemplate->m_uiStrings[1] = " has a tech building within ";
  4525. curTemplate->m_uiStrings[2] = " of ";
  4526. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_COMMAND_BUTTON_READY_ALL];
  4527. curTemplate->m_internalName = "SKIRMISH_COMMAND_BUTTON_READY_ALL";
  4528. curTemplate->m_uiName = "Skirmish_/ Command Ability is ready - all.";
  4529. curTemplate->m_numParameters = 3;
  4530. curTemplate->m_parameters[0] = Parameter::SIDE;
  4531. curTemplate->m_parameters[1] = Parameter::TEAM;
  4532. curTemplate->m_parameters[2] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  4533. curTemplate->m_numUiStrings = 4;
  4534. curTemplate->m_uiStrings[0] = " ";
  4535. curTemplate->m_uiStrings[1] = "'s ";
  4536. curTemplate->m_uiStrings[2] = " are ready to use ";
  4537. curTemplate->m_uiStrings[3] = " (all applicable members).";
  4538. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_COMMAND_BUTTON_READY_PARTIAL];
  4539. curTemplate->m_internalName = "SKIRMISH_COMMAND_BUTTON_READY_PARTIAL";
  4540. curTemplate->m_uiName = "Skirmish_/ Command Ability is ready - partial";
  4541. curTemplate->m_numParameters = 3;
  4542. curTemplate->m_parameters[0] = Parameter::SIDE;
  4543. curTemplate->m_parameters[1] = Parameter::TEAM;
  4544. curTemplate->m_parameters[2] = Parameter::COMMANDBUTTON_ALL_ABILITIES;
  4545. curTemplate->m_numUiStrings = 4;
  4546. curTemplate->m_uiStrings[0] = " ";
  4547. curTemplate->m_uiStrings[1] = "'s ";
  4548. curTemplate->m_uiStrings[2] = " are ready to use ";
  4549. curTemplate->m_uiStrings[3] = " (at least one member).";
  4550. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_UNOWNED_FACTION_UNIT_EXISTS];
  4551. curTemplate->m_internalName = "SKIRMISH_UNOWNED_FACTION_UNIT_EXISTS";
  4552. curTemplate->m_uiName = "Skirmish_/ Unowned faction unit -- comparison.";
  4553. curTemplate->m_numParameters = 3;
  4554. curTemplate->m_parameters[0] = Parameter::SIDE;
  4555. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4556. curTemplate->m_parameters[2] = Parameter::INT;
  4557. curTemplate->m_numUiStrings = 4;
  4558. curTemplate->m_uiStrings[0] = " ";
  4559. curTemplate->m_uiStrings[1] = ". There are ";
  4560. curTemplate->m_uiStrings[2] = " ";
  4561. curTemplate->m_uiStrings[3] = " unowned faction units.";
  4562. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_HAS_PREREQUISITE_TO_BUILD];
  4563. curTemplate->m_internalName = "SKIRMISH_PLAYER_HAS_PREREQUISITE_TO_BUILD";
  4564. curTemplate->m_uiName = "Skirmish_/ Player has prerequisites to build an object type.";
  4565. curTemplate->m_numParameters = 2;
  4566. curTemplate->m_parameters[0] = Parameter::SIDE;
  4567. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  4568. curTemplate->m_numUiStrings = 3;
  4569. curTemplate->m_uiStrings[0] = " ";
  4570. curTemplate->m_uiStrings[1] = " can build ";
  4571. curTemplate->m_uiStrings[2] = ".";
  4572. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_HAS_COMPARISON_GARRISONED];
  4573. curTemplate->m_internalName = "SKIRMISH_PLAYER_HAS_COMPARISON_GARRISONED";
  4574. curTemplate->m_uiName = "Skirmish_/ Player has garrisoned buildings -- comparison.";
  4575. curTemplate->m_numParameters = 3;
  4576. curTemplate->m_parameters[0] = Parameter::SIDE;
  4577. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4578. curTemplate->m_parameters[2] = Parameter::INT;
  4579. curTemplate->m_numUiStrings = 4;
  4580. curTemplate->m_uiStrings[0] = " ";
  4581. curTemplate->m_uiStrings[1] = " has ";
  4582. curTemplate->m_uiStrings[2] = " ";
  4583. curTemplate->m_uiStrings[3] = " garrisoned buildings.";
  4584. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_HAS_COMPARISON_CAPTURED_UNITS];
  4585. curTemplate->m_internalName = "SKIRMISH_PLAYER_HAS_COMPARISON_CAPTURED_UNITS";
  4586. curTemplate->m_uiName = "Skirmish_/ Player has captured units -- comparison";
  4587. curTemplate->m_numParameters = 3;
  4588. curTemplate->m_parameters[0] = Parameter::SIDE;
  4589. curTemplate->m_parameters[1] = Parameter::COMPARISON;
  4590. curTemplate->m_parameters[2] = Parameter::INT;
  4591. curTemplate->m_numUiStrings = 4;
  4592. curTemplate->m_uiStrings[0] = " ";
  4593. curTemplate->m_uiStrings[1] = " has captured ";
  4594. curTemplate->m_uiStrings[2] = " ";
  4595. curTemplate->m_uiStrings[3] = " units.";
  4596. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_NAMED_AREA_EXIST];
  4597. curTemplate->m_internalName = "SKIRMISH_NAMED_AREA_EXIST";
  4598. curTemplate->m_uiName = "Skirmish_/ Area exists.";
  4599. curTemplate->m_numParameters = 2;
  4600. curTemplate->m_parameters[0] = Parameter::SIDE;
  4601. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4602. curTemplate->m_numUiStrings = 3;
  4603. curTemplate->m_uiStrings[0] = " ";
  4604. curTemplate->m_uiStrings[1] = ". ";
  4605. curTemplate->m_uiStrings[2] = " exists.";
  4606. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_HAS_UNITS_IN_AREA];
  4607. curTemplate->m_internalName = "SKIRMISH_PLAYER_HAS_UNITS_IN_AREA";
  4608. curTemplate->m_uiName = "Skirmish_/ Player has units in an area";
  4609. curTemplate->m_numParameters = 2;
  4610. curTemplate->m_parameters[0] = Parameter::SIDE;
  4611. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4612. curTemplate->m_numUiStrings = 3;
  4613. curTemplate->m_uiStrings[0] = " ";
  4614. curTemplate->m_uiStrings[1] = " has units in ";
  4615. curTemplate->m_uiStrings[2] = ".";
  4616. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_HAS_BEEN_ATTACKED_BY_PLAYER];
  4617. curTemplate->m_internalName = "SKIRMISH_PLAYER_HAS_BEEN_ATTACKED_BY_PLAYER";
  4618. curTemplate->m_uiName = "Skirmish_/ Player has been attacked by player.";
  4619. curTemplate->m_numParameters = 2;
  4620. curTemplate->m_parameters[0] = Parameter::SIDE;
  4621. curTemplate->m_parameters[1] = Parameter::SIDE;
  4622. curTemplate->m_numUiStrings = 3;
  4623. curTemplate->m_uiStrings[0] = " ";
  4624. curTemplate->m_uiStrings[1] = " has been attacked by ";
  4625. curTemplate->m_uiStrings[2] = ".";
  4626. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_IS_OUTSIDE_AREA];
  4627. curTemplate->m_internalName = "SKIRMISH_PLAYER_IS_OUTSIDE_AREA";
  4628. curTemplate->m_uiName = "Skirmish_/ Player doesn't have units in an area.";
  4629. curTemplate->m_numParameters = 2;
  4630. curTemplate->m_parameters[0] = Parameter::SIDE;
  4631. curTemplate->m_parameters[1] = Parameter::TRIGGER_AREA;
  4632. curTemplate->m_numUiStrings = 3;
  4633. curTemplate->m_uiStrings[0] = " ";
  4634. curTemplate->m_uiStrings[1] = " has doesn't have units in ";
  4635. curTemplate->m_uiStrings[2] = ".";
  4636. curTemplate = &m_conditionTemplates[Condition::SKIRMISH_PLAYER_HAS_DISCOVERED_PLAYER];
  4637. curTemplate->m_internalName = "SKIRMISH_PLAYER_HAS_DISCOVERED_PLAYER";
  4638. curTemplate->m_uiName = "Skirmish_/ Player has discovered another player.";
  4639. curTemplate->m_numParameters = 2;
  4640. curTemplate->m_parameters[0] = Parameter::SIDE;
  4641. curTemplate->m_parameters[1] = Parameter::SIDE;
  4642. curTemplate->m_numUiStrings = 3;
  4643. curTemplate->m_uiStrings[0] = " ";
  4644. curTemplate->m_uiStrings[1] = " has discovered ";
  4645. curTemplate->m_uiStrings[2] = ".";
  4646. curTemplate = &m_conditionTemplates[Condition::MUSIC_TRACK_HAS_COMPLETED];
  4647. curTemplate->m_internalName = "MUSIC_TRACK_HAS_COMPLETED";
  4648. curTemplate->m_uiName = "Multimedia_/ Music track has completed some number of times.";
  4649. curTemplate->m_numParameters = 2;
  4650. curTemplate->m_parameters[0] = Parameter::MUSIC;
  4651. curTemplate->m_parameters[1] = Parameter::INT;
  4652. curTemplate->m_numUiStrings = 3;
  4653. curTemplate->m_uiStrings[0] = " ";
  4654. curTemplate->m_uiStrings[1] = " has completed at least ";
  4655. curTemplate->m_uiStrings[2] = " times. (NOTE: This can only be used to "
  4656. "start other music. USING THIS SCRIPT IN ANY OTHER WAY WILL CAUSE REPLAYS TO NOT WORK.)";
  4657. curTemplate = &m_conditionTemplates[Condition::SUPPLY_SOURCE_SAFE];
  4658. curTemplate->m_internalName = "SUPPLY_SOURCE_SAFE";
  4659. curTemplate->m_uiName = "Skirmish_/ Supply source is safe.";
  4660. curTemplate->m_numParameters = 2;
  4661. curTemplate->m_parameters[0] = Parameter::SIDE;
  4662. curTemplate->m_parameters[1] = Parameter::INT;
  4663. curTemplate->m_numUiStrings = 3;
  4664. curTemplate->m_uiStrings[0] = " ";
  4665. curTemplate->m_uiStrings[1] = " closest supply src with at least ";
  4666. curTemplate->m_uiStrings[2] = " available resources is SAFE from enemy influence.";
  4667. curTemplate = &m_conditionTemplates[Condition::SUPPLY_SOURCE_ATTACKED];
  4668. curTemplate->m_internalName = "SUPPLY_SOURCE_ATTACKED";
  4669. curTemplate->m_uiName = "Skirmish_/ Supply source is attacked.";
  4670. curTemplate->m_numParameters = 1;
  4671. curTemplate->m_parameters[0] = Parameter::SIDE;
  4672. curTemplate->m_numUiStrings = 2;
  4673. curTemplate->m_uiStrings[0] = " ";
  4674. curTemplate->m_uiStrings[1] = " supply source is under attack.";
  4675. curTemplate = &m_conditionTemplates[Condition::START_POSITION_IS];
  4676. curTemplate->m_internalName = "START_POSITION_IS";
  4677. curTemplate->m_uiName = "Skirmish_/ Start position.";
  4678. curTemplate->m_numParameters = 2;
  4679. curTemplate->m_parameters[0] = Parameter::SIDE;
  4680. curTemplate->m_parameters[1] = Parameter::INT;
  4681. curTemplate->m_numUiStrings = 3;
  4682. curTemplate->m_uiStrings[0] = " ";
  4683. curTemplate->m_uiStrings[1] = " starting position is ";
  4684. curTemplate->m_uiStrings[2] = " .";
  4685. curTemplate = &m_conditionTemplates[Condition::PLAYER_LOST_OBJECT_TYPE];
  4686. curTemplate->m_internalName = "PLAYER_LOST_OBJECT_TYPE";
  4687. curTemplate->m_uiName = "Player_/ Player has lost an object of type.";
  4688. curTemplate->m_numParameters = 2;
  4689. curTemplate->m_parameters[0] = Parameter::SIDE;
  4690. curTemplate->m_parameters[1] = Parameter::OBJECT_TYPE;
  4691. curTemplate->m_numUiStrings = 3;
  4692. curTemplate->m_uiStrings[0] = " ";
  4693. curTemplate->m_uiStrings[1] = " has lost an object of type ";
  4694. curTemplate->m_uiStrings[2] = " (can be an object type list).";
  4695. curTemplate = &m_actionTemplates[ScriptAction::SHOW_WEATHER];
  4696. curTemplate->m_internalName = "SHOW_WEATHER";
  4697. curTemplate->m_uiName = "Map/Environment/Show Weather.";
  4698. curTemplate->m_numParameters = 1;
  4699. curTemplate->m_parameters[0] = Parameter::BOOLEAN;
  4700. curTemplate->m_numUiStrings = 1;
  4701. curTemplate->m_uiStrings[0] = "Show Weather = ";
  4702. Int i;
  4703. for (i=0; i<Condition::NUM_ITEMS; i++) {
  4704. AsciiString str;
  4705. str.format("[%d]", i);
  4706. m_conditionTemplates[i].m_uiName.concat(str);
  4707. m_conditionTemplates[i].m_internalNameKey = NAMEKEY(m_conditionTemplates[i].m_internalName);
  4708. }
  4709. for (i=0; i<ScriptAction::NUM_ITEMS; i++) {
  4710. AsciiString str;
  4711. str.format("[%d]", i);
  4712. m_actionTemplates[i].m_uiName.concat(str);
  4713. m_actionTemplates[i].m_internalNameKey = NAMEKEY(m_actionTemplates[i].m_internalName);
  4714. }
  4715. reset();
  4716. } // end init
  4717. //-------------------------------------------------------------------------------------------------
  4718. /** Reset */
  4719. //-------------------------------------------------------------------------------------------------
  4720. void ScriptEngine::reset( void )
  4721. {
  4722. // setting FPS limit in case a script had changed it
  4723. if (TheGameEngine && TheGlobalData)
  4724. TheGameEngine->setFramesPerSecondLimit(TheGlobalData->m_framesPerSecondLimit);
  4725. if (TheScriptActions) {
  4726. TheScriptActions->reset();
  4727. }
  4728. if (TheScriptConditions) {
  4729. TheScriptConditions->reset();
  4730. }
  4731. m_numCounters = 1;
  4732. m_numAttackInfo = 1;
  4733. m_numFlags = 1;
  4734. m_endGameTimer = -1;
  4735. m_closeWindowTimer = -1;
  4736. m_callingTeam = NULL;
  4737. m_callingObject = NULL;
  4738. m_conditionTeam = NULL;
  4739. m_conditionObject = NULL;
  4740. m_currentPlayer = NULL;
  4741. m_skirmishHumanPlayer = NULL;
  4742. m_frameObjectCountChanged = 0;
  4743. m_shownMPLocalDefeatWindow = FALSE;
  4744. Int i;
  4745. for (i=0; i<MAX_COUNTERS; i++) {
  4746. m_counters[i].value = 0;
  4747. m_counters[i].isCountdownTimer = false;
  4748. m_counters[i].name.clear();
  4749. }
  4750. for (i=0; i<MAX_FLAGS; i++) {
  4751. m_flags[i].value = false;
  4752. m_flags[i].name.clear();
  4753. }
  4754. m_breezeInfo.m_direction = PI/3;
  4755. m_breezeInfo.m_directionVec.x = Sin(m_breezeInfo.m_direction);
  4756. m_breezeInfo.m_directionVec.y = Cos(m_breezeInfo.m_direction);
  4757. m_breezeInfo.m_intensity = 0.07f*PI/4;
  4758. m_breezeInfo.m_lean = 0.07f*PI/4;
  4759. m_breezeInfo.m_breezePeriod = LOGICFRAMES_PER_SECOND * 5;
  4760. m_breezeInfo.m_randomness = 0.2f;
  4761. m_breezeInfo.m_breezeVersion = 0;
  4762. m_freezeByScript = FALSE;
  4763. m_objectsShouldReceiveDifficultyBonus = TRUE;
  4764. m_ChooseVictimAlwaysUsesNormal = false;
  4765. #ifdef SPECIAL_SCRIPT_PROFILING
  4766. #ifdef DEBUG_LOGGING
  4767. if (m_numFrames > 1) {
  4768. DEBUG_LOG(("\n***SCRIPT ENGINE STATS %.0f frames:\n", m_numFrames));
  4769. DEBUG_LOG(("Avg time to update %.3f milisec\n", 1000*m_totalUpdateTime/m_numFrames));
  4770. DEBUG_LOG((" Max time to update %.3f miliseconds.\n", m_maxUpdateTime*1000));
  4771. }
  4772. m_numFrames=0;
  4773. m_totalUpdateTime=0;
  4774. m_maxUpdateTime=0;
  4775. Int numToDump;
  4776. if (TheSidesList) {
  4777. for (numToDump=0; numToDump<10; numToDump++) {
  4778. Real maxTime = 0;
  4779. Script *maxScript = NULL;
  4780. /* Run through scripts & set condition team names. */
  4781. for (i=0; i<TheSidesList->getNumSides(); i++) {
  4782. ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList();
  4783. if (!pSL) continue;
  4784. if (pSL == NULL) continue;
  4785. Script *pScr;
  4786. for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) {
  4787. if (pScr->getConditionTime()>maxTime) {
  4788. maxTime = pScr->getConditionTime();
  4789. maxScript = pScr;
  4790. }
  4791. }
  4792. ScriptGroup *pGroup;
  4793. for (pGroup = pSL->getScriptGroup(); pGroup; pGroup=pGroup->getNext()) {
  4794. for (pScr = pGroup->getScript(); pScr; pScr=pScr->getNext()) {
  4795. if (pScr->getConditionTime()>maxTime) {
  4796. maxTime = pScr->getConditionTime();
  4797. maxScript = pScr;
  4798. }
  4799. }
  4800. }
  4801. }
  4802. if (maxScript) {
  4803. DEBUG_LOG((" SCRIPT %s total time %f seconds,\n evaluated %d times, avg execution %2.3f msec (Goal less than 0.05)\n",
  4804. maxScript->getName().str(),
  4805. maxScript->getConditionTime(), maxScript->getConditionCount(), 1000*maxScript->getConditionTime()/maxScript->getConditionCount()) );
  4806. maxScript->addToConditionTime(-2*maxTime); // reset to negative.
  4807. }
  4808. }
  4809. DEBUG_LOG(("***\n"));
  4810. }
  4811. #endif
  4812. #endif
  4813. _updateCurrentParticleCap();
  4814. VecSequentialScriptPtrIt seqScriptIt;
  4815. for (seqScriptIt = m_sequentialScripts.begin(); seqScriptIt != m_sequentialScripts.end(); ) {
  4816. cleanupSequentialScript(seqScriptIt, TRUE);
  4817. }
  4818. // clear out all the lists of object types that were in the old map.
  4819. for (AllObjectTypesIt it = m_allObjectTypeLists.begin(); it != m_allObjectTypeLists.end(); it = m_allObjectTypeLists.begin() ) {
  4820. if (*it) {
  4821. removeObjectTypes(*it);
  4822. } else {
  4823. m_allObjectTypeLists.erase(it);
  4824. }
  4825. }
  4826. DEBUG_ASSERTCRASH( m_allObjectTypeLists.empty() == TRUE, ("ScriptEngine::reset - m_allObjectTypeLists should be empty but is not!\n") );
  4827. // reset all the reveals that have taken place.
  4828. m_namedReveals.clear();
  4829. // Clear the named objects list.
  4830. m_namedObjects.clear();
  4831. m_completedVideo.clear();
  4832. m_testingSpeech.clear();
  4833. m_testingAudio.clear();
  4834. m_uiInteractions.clear();
  4835. for (i=0; i<MAX_PLAYER_COUNT; ++i)
  4836. {
  4837. m_triggeredSpecialPowers[i].clear();
  4838. m_midwaySpecialPowers[i].clear();
  4839. m_finishedSpecialPowers[i].clear();
  4840. m_acquiredSciences[i].clear();
  4841. m_completedUpgrades[i].clear();
  4842. }
  4843. ScriptList::reset(); // Deletes scripts loaded when the map was loaded.
  4844. // reset the attack priority data
  4845. for( i = 0; i < MAX_ATTACK_PRIORITIES; ++i )
  4846. m_attackPriorityInfo[ i ].reset();
  4847. // clear out all of our object counts.
  4848. for( i = 0; i < MAX_PLAYER_COUNT; ++i )
  4849. m_objectCounts[i].clear();
  4850. // clear topple directions
  4851. m_toppleDirections.clear();
  4852. } // end reset
  4853. //-------------------------------------------------------------------------------------------------
  4854. /** newMap */
  4855. //-------------------------------------------------------------------------------------------------
  4856. void ScriptEngine::newMap( void )
  4857. {
  4858. m_numCounters = 1;
  4859. Int i;
  4860. for (i=0; i<MAX_COUNTERS; i++) {
  4861. m_counters[i].value = 0;
  4862. m_counters[i].isCountdownTimer = false;
  4863. m_counters[i].name.clear();
  4864. }
  4865. m_numFlags = 1;
  4866. for (i=0; i<MAX_FLAGS; i++) {
  4867. m_flags[i].value = false;
  4868. m_flags[i].name.clear();
  4869. }
  4870. m_endGameTimer = -1;
  4871. m_closeWindowTimer = -1;
  4872. #ifdef SPECIAL_SCRIPT_PROFILING
  4873. #ifdef DEBUG_LOGGING
  4874. m_numFrames=0;
  4875. m_totalUpdateTime=0;
  4876. m_maxUpdateTime=0;
  4877. #endif
  4878. #endif
  4879. m_completedVideo.clear();
  4880. m_testingSpeech.clear();
  4881. m_testingAudio.clear();
  4882. m_uiInteractions.clear();
  4883. for (i=0; i<MAX_PLAYER_COUNT; ++i)
  4884. {
  4885. m_triggeredSpecialPowers[i].clear();
  4886. m_midwaySpecialPowers[i].clear();
  4887. m_finishedSpecialPowers[i].clear();
  4888. m_acquiredSciences[i].clear();
  4889. m_completedUpgrades[i].clear();
  4890. }
  4891. /* Run through scripts & set condition team names. */
  4892. for (i=0; i<TheSidesList->getNumSides(); i++) {
  4893. ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList();
  4894. if (!pSL) continue;
  4895. if (pSL == NULL) continue;
  4896. Script *pScr;
  4897. for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) {
  4898. checkConditionsForTeamNames(pScr);
  4899. }
  4900. ScriptGroup *pGroup;
  4901. for (pGroup = pSL->getScriptGroup(); pGroup; pGroup=pGroup->getNext()) {
  4902. for (pScr = pGroup->getScript(); pScr; pScr=pScr->getNext()) {
  4903. checkConditionsForTeamNames(pScr);
  4904. }
  4905. }
  4906. }
  4907. m_firstUpdate = true;
  4908. m_fade = FADE_MULTIPLY; //default to a fade in from black.
  4909. m_curFadeFrame = 0;
  4910. m_minFade = 1.0f;
  4911. m_maxFade = 0.0f;
  4912. m_fadeFramesIncrease = 0;
  4913. m_fadeFramesHold = 0;
  4914. m_fadeFramesDecrease = FRAMES_TO_FADE_IN_AT_START;
  4915. m_curFadeValue = 0.0f;
  4916. } // end newMap
  4917. //-------------------------------------------------------------------------------------------------
  4918. /** Update */
  4919. //-------------------------------------------------------------------------------------------------
  4920. DECLARE_PERF_TIMER(ScriptEngine)
  4921. void ScriptEngine::update( void )
  4922. {
  4923. USE_PERF_TIMER(ScriptEngine)
  4924. #ifdef SPECIAL_SCRIPT_PROFILING
  4925. #ifdef DEBUG_LOGGING
  4926. __int64 startTime64;
  4927. double timeToUpdate=0.0f;
  4928. __int64 endTime64,freq64;
  4929. QueryPerformanceFrequency((LARGE_INTEGER *)&freq64);//LORENZEN'S NOTE_TO_SELF: USE THIS
  4930. QueryPerformanceCounter((LARGE_INTEGER *)&startTime64);//LORENZEN'S NOTE_TO_SELF: USE THIS
  4931. /* dump out the named objects table. For extremely intense debug only. jba. :P
  4932. for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) {
  4933. AsciiString name = it->first;
  4934. Object * obj = it->second;
  4935. if (obj && obj->getAIUpdateInterface())
  4936. DEBUG_LOG(("%s=%x('%s'), isDead%d\n", name.str(), obj, obj->getName().str(), obj->getAIUpdateInterface()->isDead()));
  4937. }
  4938. DEBUG_LOG(("\n\n"));
  4939. */
  4940. #endif
  4941. #endif
  4942. if (m_firstUpdate) {
  4943. createNamedCache();
  4944. particleEditorUpdate();
  4945. m_firstUpdate = false;
  4946. } else {
  4947. particleEditorUpdate();
  4948. }
  4949. if (m_closeWindowTimer>0) {
  4950. m_closeWindowTimer--;
  4951. if (m_closeWindowTimer < 1) {
  4952. TheScriptActions->closeWindows(FALSE); // Close victory or defeat windows.
  4953. }
  4954. }
  4955. if (m_endGameTimer>0) {
  4956. m_endGameTimer--;
  4957. if (m_endGameTimer < 1) {
  4958. // clear out all the game data
  4959. /*GameMessage *msg =*/ TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_GAME_DATA );
  4960. //TheScriptActions->closeWindows(FALSE); // Close victory or defeat windows.
  4961. }
  4962. }
  4963. _updateFrameNumber();
  4964. if (isTimeFrozenDebug()) {
  4965. st_LastCurrentFrame = st_CurrentFrame - 1; // Force us to get clean result from CanAppContinue
  4966. return;
  4967. }
  4968. if (m_fade!=FADE_NONE) {
  4969. updateFades();
  4970. }
  4971. if (m_endGameTimer>=0) {
  4972. return; // we are just timing down
  4973. }
  4974. if (TheScriptActions) {
  4975. TheScriptActions->update();
  4976. }
  4977. if (TheScriptConditions) {
  4978. TheScriptConditions->update();
  4979. }
  4980. // Update any countdown timers.
  4981. Int i;
  4982. // Note - counters start at 1. 0 means not assigned.
  4983. for (i=1; i<m_numCounters; i++) {
  4984. if (m_counters[i].isCountdownTimer) {
  4985. // If counter has any time left, decrement. Counters go to -1 and stop.
  4986. if (m_counters[i].value >= 0) {
  4987. m_counters[i].value--;
  4988. }
  4989. }
  4990. }
  4991. // Evaluate the scripts.
  4992. for (i=0; i<TheSidesList->getNumSides(); i++) {
  4993. m_currentPlayer = ThePlayerList->getNthPlayer(i);
  4994. ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList();
  4995. if (!pSL) continue;
  4996. executeScripts(pSL->getScript());
  4997. ScriptGroup *pGroup;
  4998. for (pGroup = pSL->getScriptGroup(); pGroup; pGroup=pGroup->getNext()) {
  4999. if (!pGroup->isActive()) {
  5000. continue; // Don't execute inactive groups.
  5001. }
  5002. if (pGroup->isSubroutine()) {
  5003. continue; // Don't execute subroutine groups.
  5004. }
  5005. executeScripts(pGroup->getScript());
  5006. }
  5007. m_currentPlayer = NULL;
  5008. }
  5009. // Reset the entered/exited flag in teams, so the next update sets them
  5010. // correctly. Also, execute any team created scripts.
  5011. ThePlayerList->updateTeamStates();
  5012. // Clear the UI Interaction flags.
  5013. m_uiInteractions.clear();
  5014. // update all sequential stuff.
  5015. evaluateAndProgressAllSequentialScripts();
  5016. // Script debugger stuff
  5017. st_CurrentFrame++;
  5018. if (st_DebugDLL) {
  5019. for (int j = 1; j < m_numCounters; ++j) {
  5020. _adjustVariable(m_counters[j].name.str(), m_counters[j].value);
  5021. }
  5022. for (int k = 1; k < m_numFlags; ++k) {
  5023. _adjustVariable(m_flags[k].name.str(), m_flags[k].value);
  5024. }
  5025. }
  5026. #ifdef _DEBUG
  5027. if (TheGameLogic->getFrame()==0) {
  5028. for (i=0; i<m_numAttackInfo; i++) {
  5029. m_attackPriorityInfo[i].dumpPriorityInfo();
  5030. }
  5031. }
  5032. #endif
  5033. #ifdef SPECIAL_SCRIPT_PROFILING
  5034. #ifdef DEBUG_LOGGING
  5035. QueryPerformanceCounter((LARGE_INTEGER *)&endTime64);//LORENZEN'S NOTE_TO_SELF: USE THIS
  5036. timeToUpdate = ((double)(endTime64-startTime64) / (double)(freq64));//LORENZEN'S NOTE_TO_SELF: USE THIS
  5037. m_numFrames++;
  5038. m_totalUpdateTime+=timeToUpdate;
  5039. if (timeToUpdate > m_maxUpdateTime) m_maxUpdateTime = timeToUpdate;
  5040. m_curUpdateTime = timeToUpdate;
  5041. #endif
  5042. #endif
  5043. #ifdef DO_VTUNE_STUFF
  5044. _updateVTune();
  5045. #endif
  5046. } // end update
  5047. //-------------------------------------------------------------------------------------------------
  5048. /** getStats */
  5049. //-------------------------------------------------------------------------------------------------
  5050. AsciiString ScriptEngine::getStats(Real *curTimePtr, Real *script1Time, Real *script2Time)
  5051. {
  5052. *curTimePtr = 0;
  5053. *script1Time = 0;
  5054. *script2Time = 0;
  5055. AsciiString msg = "Script Engine Profiling disabled.";
  5056. #ifdef SPECIAL_SCRIPT_PROFILING
  5057. #ifdef DEBUG_LOGGING
  5058. msg = "#1-";
  5059. *curTimePtr = (Real)m_curUpdateTime;
  5060. Int numToDump;
  5061. Int i;
  5062. if (TheSidesList) {
  5063. for (numToDump=0; numToDump<2; numToDump++) {
  5064. Real maxTime = 0;
  5065. Script *maxScript = NULL;
  5066. /* Run through scripts & set condition team names. */
  5067. for (i=0; i<TheSidesList->getNumSides(); i++) {
  5068. ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList();
  5069. if (!pSL) continue;
  5070. if (pSL == NULL) continue;
  5071. Script *pScr;
  5072. for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) {
  5073. if (pScr->getCurTime()>maxTime) {
  5074. maxTime = pScr->getCurTime();
  5075. maxScript = pScr;
  5076. }
  5077. }
  5078. ScriptGroup *pGroup;
  5079. for (pGroup = pSL->getScriptGroup(); pGroup; pGroup=pGroup->getNext()) {
  5080. for (pScr = pGroup->getScript(); pScr; pScr=pScr->getNext()) {
  5081. if (pScr->getCurTime()>maxTime) {
  5082. maxTime = pScr->getCurTime();
  5083. maxScript = pScr;
  5084. }
  5085. }
  5086. }
  5087. }
  5088. if (maxScript) {
  5089. if (numToDump == 0) {
  5090. *script1Time = maxTime;
  5091. } else {
  5092. *script2Time = maxTime;
  5093. msg.concat(", #2-");
  5094. }
  5095. msg.concat(maxScript->getName());
  5096. maxScript->setCurTime(0); // reset to 0.
  5097. }
  5098. }
  5099. }
  5100. #endif
  5101. #endif
  5102. return msg;
  5103. } // end getStats
  5104. //-------------------------------------------------------------------------------------------------
  5105. /** startQuickEndGameTimer */
  5106. //-------------------------------------------------------------------------------------------------
  5107. void ScriptEngine::startQuickEndGameTimer( void )
  5108. {
  5109. m_endGameTimer = 1;
  5110. } // end startQuickEndGameTimer
  5111. //-------------------------------------------------------------------------------------------------
  5112. /** startEndGameTimer */
  5113. //-------------------------------------------------------------------------------------------------
  5114. void ScriptEngine::startEndGameTimer( void )
  5115. {
  5116. m_endGameTimer = FRAMES_TO_SHOW_WIN_LOSE_MESSAGE;
  5117. } // end startEndGameTimer
  5118. //-------------------------------------------------------------------------------------------------
  5119. /** startCloseWindowTimer */
  5120. //-------------------------------------------------------------------------------------------------
  5121. void ScriptEngine::startCloseWindowTimer( void )
  5122. {
  5123. m_closeWindowTimer = FRAMES_TO_SHOW_WIN_LOSE_MESSAGE;
  5124. } // end startCloseWindowTimer
  5125. //-------------------------------------------------------------------------------------------------
  5126. /** updateFades */
  5127. //-------------------------------------------------------------------------------------------------
  5128. void ScriptEngine::updateFades( void )
  5129. {
  5130. m_curFadeFrame++;
  5131. Int fade = m_curFadeFrame;
  5132. Real factor;
  5133. if (fade<=m_fadeFramesIncrease) {
  5134. factor = (Real)m_curFadeFrame/m_fadeFramesIncrease;
  5135. m_curFadeValue = m_minFade + factor*(m_maxFade-m_minFade);
  5136. return;
  5137. }
  5138. fade -= m_fadeFramesIncrease;
  5139. if (fade<=m_fadeFramesHold) {
  5140. m_curFadeValue = m_maxFade;
  5141. return;
  5142. }
  5143. fade -= m_fadeFramesHold;
  5144. if (fade<=m_fadeFramesDecrease) {
  5145. Int divisor = m_fadeFramesDecrease+1;
  5146. if (divisor==0) divisor = 1;
  5147. factor = (Real)fade/divisor;
  5148. m_curFadeValue = m_maxFade + factor*(m_minFade-m_maxFade);
  5149. return;
  5150. }
  5151. // time is up.
  5152. m_fade = FADE_NONE;
  5153. } // end updateFades
  5154. //-------------------------------------------------------------------------------------------------
  5155. /** getCurrentPlayer */
  5156. //-------------------------------------------------------------------------------------------------
  5157. Player *ScriptEngine::getCurrentPlayer(void)
  5158. {
  5159. if (m_currentPlayer==NULL)
  5160. AppendDebugMessage("***Unexpected NULL player:***", false);
  5161. return m_currentPlayer;
  5162. } // end getCurrentPlayer
  5163. //-------------------------------------------------------------------------------------------------
  5164. /** clearFlag */
  5165. //-------------------------------------------------------------------------------------------------
  5166. void ScriptEngine::clearFlag(const AsciiString &name)
  5167. {
  5168. Int j;
  5169. for (j=0; j<MAX_PLAYER_COUNT; j++) {
  5170. AsciiString modName;
  5171. modName.format("%s%d", name.str(), j);
  5172. // Note - flags start at 1. 0 means not assigned.
  5173. Int i;
  5174. for (i=1; i<m_numFlags; i++) {
  5175. if ((modName==m_flags[i].name)) {
  5176. m_flags[i].value = FALSE;
  5177. }
  5178. }
  5179. }
  5180. } // end clearFlag
  5181. //-------------------------------------------------------------------------------------------------
  5182. /** clearTeamFlags */
  5183. //-------------------------------------------------------------------------------------------------
  5184. void ScriptEngine::clearTeamFlags(void)
  5185. {
  5186. clearFlag("USA Team is Building");
  5187. clearFlag("USA Air Team Is Building");
  5188. clearFlag("USA Inf Team Is Building");
  5189. clearFlag("China Team is Building");
  5190. clearFlag("China Air Team Is Building");
  5191. clearFlag("China Inf Team Is Building");
  5192. clearFlag("GLA Team is Building");
  5193. clearFlag("GLA Inf Team is Building");
  5194. } // end clearTeamFlags
  5195. //-------------------------------------------------------------------------------------------------
  5196. /** getSkirmishEnemyPlayer */
  5197. //-------------------------------------------------------------------------------------------------
  5198. Player *ScriptEngine::getSkirmishEnemyPlayer(void)
  5199. {
  5200. Bool is_GeneralsChallengeContext = TheCampaignManager->getCurrentCampaign() && TheCampaignManager->getCurrentCampaign()->m_isChallengeCampaign;
  5201. if (m_currentPlayer) {
  5202. Player *enemy = m_currentPlayer->getCurrentEnemy();
  5203. if (enemy==NULL) {
  5204. // get the human player.
  5205. Int i;
  5206. for (i=0; i<ThePlayerList->getPlayerCount(); i++) {
  5207. enemy = ThePlayerList->getNthPlayer(i);
  5208. if (/*enemy->isLocalPlayer() &&*/ enemy->getPlayerType()==PLAYER_HUMAN) {
  5209. if (is_GeneralsChallengeContext && enemy->getPlayerNameKey() == NAMEKEY(THE_PLAYER)) {
  5210. continue; // In generals challenge, ThePlayer is a dummy player. jba. [8/15/2003]
  5211. }
  5212. return enemy;
  5213. }
  5214. enemy = NULL;
  5215. }
  5216. }
  5217. return enemy;
  5218. }
  5219. DEBUG_CRASH(("No enemy found. Unexpected but not fatal. jba."));
  5220. return NULL;
  5221. }
  5222. //-------------------------------------------------------------------------------------------------
  5223. /** getPlayerFromAsciiString */
  5224. //-------------------------------------------------------------------------------------------------
  5225. Player *ScriptEngine::getPlayerFromAsciiString(const AsciiString& playerString)
  5226. {
  5227. Bool is_GeneralsChallengeContext = TheCampaignManager->getCurrentCampaign() && TheCampaignManager->getCurrentCampaign()->m_isChallengeCampaign;
  5228. if (playerString == LOCAL_PLAYER || (playerString == THE_PLAYER && is_GeneralsChallengeContext))
  5229. // Designers have built their Generals' Challenge maps, referencing "ThePlayer" meaning the local player.
  5230. // However, they've also built many of their single player maps with this string, where "ThePlayer" is not intended as an alias.
  5231. return ThePlayerList->getLocalPlayer();
  5232. if (playerString == THIS_PLAYER)
  5233. return getCurrentPlayer();
  5234. else if (playerString == THIS_PLAYER_ENEMY) {
  5235. return getSkirmishEnemyPlayer();
  5236. }
  5237. else {
  5238. NameKeyType key = NAMEKEY(playerString);
  5239. Player *pPlayer = ThePlayerList->findPlayerWithNameKey(key);
  5240. if (pPlayer!=NULL) {
  5241. return pPlayer;
  5242. }
  5243. }
  5244. AppendDebugMessage("***Invalid Player name:***", false);
  5245. return NULL;
  5246. }
  5247. //-------------------------------------------------------------------------------------------------
  5248. /** getObjectTypeList */
  5249. //-------------------------------------------------------------------------------------------------
  5250. ObjectTypes *ScriptEngine::getObjectTypes(const AsciiString& objectTypeList)
  5251. {
  5252. AllObjectTypesIt it;
  5253. for (it = m_allObjectTypeLists.begin(); it != m_allObjectTypeLists.end(); ++it) {
  5254. if ((*it) == NULL) {
  5255. DEBUG_CRASH(("NULL object type list was unexpected. jkmcd"));
  5256. continue;
  5257. }
  5258. if ((*it)->getListName() == objectTypeList) {
  5259. return (*it);
  5260. }
  5261. }
  5262. return NULL;
  5263. }
  5264. //-------------------------------------------------------------------------------------------------
  5265. /** doObjectTypeListMaintenance */
  5266. /** If addObject is false, remove the object. If it is true, add the object. */
  5267. /** If the object removed is the last object, then the list is removed as well. */
  5268. //-------------------------------------------------------------------------------------------------
  5269. void ScriptEngine::doObjectTypeListMaintenance(const AsciiString& objectTypeList, const AsciiString& objectType, Bool addObject)
  5270. {
  5271. ObjectTypes *currentObjectTypeVec = getObjectTypes(objectTypeList);
  5272. if (!currentObjectTypeVec) {
  5273. ObjectTypes *newVec = newInstance(ObjectTypes)(objectTypeList);
  5274. m_allObjectTypeLists.push_back(newVec);
  5275. currentObjectTypeVec = newVec;
  5276. }
  5277. if (addObject) {
  5278. currentObjectTypeVec->addObjectType(objectType);
  5279. } else {
  5280. currentObjectTypeVec->removeObjectType(objectType);
  5281. }
  5282. // Remove it. Its dead Jim.
  5283. if (currentObjectTypeVec->getListSize() == 0) {
  5284. removeObjectTypes(currentObjectTypeVec);
  5285. // Semantic emphasis
  5286. currentObjectTypeVec = NULL;
  5287. }
  5288. }
  5289. //-------------------------------------------------------------------------------------------------
  5290. /** Given a name, return the associated trigger area, or NULL if one doesn't exist.
  5291. Handles skirmish name qualification. */
  5292. //-------------------------------------------------------------------------------------------------
  5293. PolygonTrigger *ScriptEngine::getQualifiedTriggerAreaByName( AsciiString name )
  5294. {
  5295. if (name == MY_INNER_PERIMETER || name == MY_OUTER_PERIMETER) {
  5296. if (m_currentPlayer) {
  5297. Int ndx = m_currentPlayer->getMpStartIndex()+1;
  5298. if (name==MY_INNER_PERIMETER) {
  5299. name.format("%s%d", INNER_PERIMETER, ndx);
  5300. } else {
  5301. name.format("%s%d", OUTER_PERIMETER, ndx);
  5302. }
  5303. } else {
  5304. return NULL;
  5305. }
  5306. } else if (name == ENEMY_INNER_PERIMETER || name == ENEMY_OUTER_PERIMETER) {
  5307. Int mpNdx;
  5308. mpNdx = -1;
  5309. if (m_currentPlayer) {
  5310. Player *enemy = getCurrentPlayer()->getCurrentEnemy();
  5311. if (enemy) {
  5312. mpNdx = enemy->getMpStartIndex()+1;
  5313. }
  5314. }
  5315. if (name==ENEMY_INNER_PERIMETER) {
  5316. name.format("%s%d", INNER_PERIMETER, mpNdx);
  5317. } else {
  5318. name.format("%s%d", OUTER_PERIMETER, mpNdx);
  5319. }
  5320. }
  5321. PolygonTrigger *trig = TheTerrainLogic->getTriggerAreaByName(name);
  5322. if (trig==NULL) {
  5323. AsciiString msg = "!!!WARNING!!! Trigger area '";
  5324. msg.concat(name);
  5325. msg.concat("' not found.");
  5326. AppendDebugMessage(msg, TRUE);
  5327. }
  5328. return trig;
  5329. }
  5330. //-------------------------------------------------------------------------------------------------
  5331. /** getTeamNamed */
  5332. //-------------------------------------------------------------------------------------------------
  5333. Team * ScriptEngine::getTeamNamed(const AsciiString& teamName)
  5334. {
  5335. Bool is_GeneralsChallengeContext = TheCampaignManager->getCurrentCampaign() && TheCampaignManager->getCurrentCampaign()->m_isChallengeCampaign;
  5336. if (teamName == TEAM_THE_PLAYER && is_GeneralsChallengeContext)
  5337. // Designers have built their Generals' Challenge maps, referencing "teamThePlayer" meaning the local player's default (parent) team.
  5338. // However, they've also built many of their single player maps with this string, where "teamThePlayer" is not intended as an alias.
  5339. return ThePlayerList->getLocalPlayer()->getDefaultTeam();
  5340. if (teamName == THIS_TEAM) {
  5341. if (m_callingTeam)
  5342. return m_callingTeam;
  5343. return m_conditionTeam;
  5344. }
  5345. if (m_callingTeam && m_callingTeam->getName() == teamName) {
  5346. return m_callingTeam;
  5347. }
  5348. if (m_conditionTeam && m_conditionTeam->getName() == teamName) {
  5349. return m_conditionTeam;
  5350. }
  5351. TeamPrototype *theTeamProto = TheTeamFactory->findTeamPrototype( teamName );
  5352. if (theTeamProto == NULL) return NULL;
  5353. if (theTeamProto->getIsSingleton()) {
  5354. Team *theTeam = theTeamProto->getFirstItemIn_TeamInstanceList();
  5355. if (theTeam && theTeam->isActive()) {
  5356. return theTeam;
  5357. }
  5358. return NULL; // team wasn't active.
  5359. }
  5360. static int warnCount = 0;
  5361. if (theTeamProto->countTeamInstances()>1) {
  5362. if (warnCount<10) {
  5363. warnCount++;
  5364. AppendDebugMessage("***Referencing multiple team by unspecific instance:***", false);
  5365. AppendDebugMessage(teamName, false);
  5366. }
  5367. }
  5368. return theTeamProto->getFirstItemIn_TeamInstanceList();
  5369. } // end getTeamNamed
  5370. //-------------------------------------------------------------------------------------------------
  5371. /** getUnitNamed */
  5372. //-------------------------------------------------------------------------------------------------
  5373. Object * ScriptEngine::getUnitNamed(const AsciiString& unitName)
  5374. {
  5375. if (unitName == THIS_OBJECT) {
  5376. if (m_callingObject) {
  5377. return m_callingObject;
  5378. }
  5379. return m_conditionObject;
  5380. }
  5381. for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) {
  5382. if (unitName == (it->first)) {
  5383. return it->second;
  5384. }
  5385. }
  5386. return NULL;
  5387. }
  5388. //-------------------------------------------------------------------------------------------------
  5389. /** didUnitExist */
  5390. //-------------------------------------------------------------------------------------------------
  5391. Bool ScriptEngine::didUnitExist(const AsciiString& unitName)
  5392. {
  5393. for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) {
  5394. if (unitName == (it->first)) {
  5395. return (it->second == NULL);
  5396. }
  5397. }
  5398. return false;
  5399. }
  5400. //-------------------------------------------------------------------------------------------------
  5401. /** runScript - Executes a subroutine script, or script group - tests conditions, and executes actions or false actions. */
  5402. //-------------------------------------------------------------------------------------------------
  5403. void ScriptEngine::runScript(const AsciiString& scriptName, Team *pThisTeam)
  5404. {
  5405. if (scriptName.isEmpty()) {
  5406. return; // no script, just return.
  5407. }
  5408. if (scriptName==NONE_STRING) {
  5409. return; // no script
  5410. }
  5411. Player *savPlayer = m_currentPlayer;
  5412. // Team *pSavConditionTeam = m_conditionTeam;
  5413. LatchRestore<Team *> latch(m_callingTeam, pThisTeam);
  5414. m_conditionTeam = NULL;
  5415. m_currentPlayer = NULL;
  5416. if (m_callingTeam) {
  5417. m_currentPlayer = m_callingTeam->getControllingPlayer();
  5418. }
  5419. Script *pScript = NULL;
  5420. ScriptGroup *pGroup = findGroup(scriptName);
  5421. if (pGroup) {
  5422. if (pGroup->isSubroutine()) {
  5423. if (pGroup->isActive()) {
  5424. executeScripts(pGroup->getScript());
  5425. }
  5426. } else {
  5427. AppendDebugMessage("***Attempting to call script that is not a subroutine:***", false);
  5428. AppendDebugMessage(scriptName, false);
  5429. DEBUG_LOG(("Attempting to call script '%s' that is not a subroutine.\n", scriptName.str()));
  5430. }
  5431. } else {
  5432. pScript = findScript(scriptName);
  5433. if (pScript != NULL) {
  5434. if (pScript->isSubroutine()) {
  5435. executeScript(pScript);
  5436. } else {
  5437. AppendDebugMessage("***Attempting to call script that is not a subroutine:***", false);
  5438. AppendDebugMessage(scriptName, false);
  5439. DEBUG_LOG(("Attempting to call script '%s' that is not a subroutine.\n", scriptName.str()));
  5440. }
  5441. } else {
  5442. AppendDebugMessage("***Script not defined:***", false);
  5443. AppendDebugMessage(scriptName, false);
  5444. DEBUG_LOG(("WARNING: Script '%s' not defined.\n", scriptName.str()));
  5445. }
  5446. }
  5447. // m_callingTeam is restored automatically via LatchRestore
  5448. m_conditionTeam = m_conditionTeam;
  5449. m_currentPlayer = savPlayer;
  5450. } // end runScript
  5451. //-------------------------------------------------------------------------------------------------
  5452. /** runScript - Executes a subroutine script, or script group - tests conditions, and executes actions or false actions. */
  5453. //-------------------------------------------------------------------------------------------------
  5454. void ScriptEngine::runObjectScript(const AsciiString& scriptName, Object *pThisObject)
  5455. {
  5456. if (scriptName.isEmpty()) {
  5457. return; // no script, just return.
  5458. }
  5459. if (scriptName==NONE_STRING) {
  5460. return; // no script
  5461. }
  5462. Object *pSavCallingObject = m_callingObject;
  5463. m_callingObject = pThisObject;
  5464. Script *pScript = NULL;
  5465. ScriptGroup *pGroup = findGroup(scriptName);
  5466. if (pGroup) {
  5467. if (pGroup->isSubroutine()) {
  5468. if (pGroup->isActive()) {
  5469. executeScripts(pGroup->getScript());
  5470. }
  5471. } else {
  5472. AppendDebugMessage("***Attempting to call script that is not a subroutine:***", false);
  5473. AppendDebugMessage(scriptName, false);
  5474. DEBUG_LOG(("Attempting to call script '%s' that is not a subroutine.\n", scriptName.str()));
  5475. }
  5476. } else {
  5477. pScript = findScript(scriptName);
  5478. if (pScript != NULL) {
  5479. if (pScript->isSubroutine()) {
  5480. executeScript(pScript);
  5481. } else {
  5482. AppendDebugMessage("***Attempting to call script that is not a subroutine:***", false);
  5483. AppendDebugMessage(scriptName, false);
  5484. DEBUG_LOG(("Attempting to call script '%s' that is not a subroutine.\n", scriptName.str()));
  5485. }
  5486. } else {
  5487. AppendDebugMessage("***Script not defined:***", false);
  5488. AppendDebugMessage(scriptName, false);
  5489. DEBUG_LOG(("WARNING: Script '%s' not defined.\n", scriptName.str()));
  5490. }
  5491. }
  5492. m_callingObject = pSavCallingObject;
  5493. } // end runScript
  5494. //-------------------------------------------------------------------------------------------------
  5495. /** Allocates a counter, if this name doesn't exist. */
  5496. //-------------------------------------------------------------------------------------------------
  5497. Int ScriptEngine::allocateCounter( const AsciiString& name)
  5498. {
  5499. Int i;
  5500. // Note - counters start at 1. 0 means not assigned.
  5501. for (i=1; i<m_numCounters; i++) {
  5502. if (name==m_counters[i].name) {
  5503. return i;
  5504. }
  5505. }
  5506. DEBUG_ASSERTCRASH(m_numCounters<MAX_COUNTERS, ("Too many counters, failed to make '%s'.\n", name.str()));
  5507. if (m_numCounters < MAX_COUNTERS) {
  5508. m_counters[m_numCounters].name = name;
  5509. i = m_numCounters;
  5510. m_numCounters++;
  5511. return(i);
  5512. }
  5513. return 0; // Shouldn't ever happen.
  5514. }
  5515. //-------------------------------------------------------------------------------------------------
  5516. /** Gets a counter */
  5517. //-------------------------------------------------------------------------------------------------
  5518. const TCounter *ScriptEngine::getCounter(const AsciiString& counterName)
  5519. {
  5520. Int i;
  5521. for (i=1; i<m_numCounters; i++)
  5522. {
  5523. if (counterName == m_counters[i].name)
  5524. {
  5525. return &(m_counters[i]);
  5526. }
  5527. }
  5528. return NULL;
  5529. }
  5530. //-------------------------------------------------------------------------------------------------
  5531. void ScriptEngine::createNamedMapReveal(const AsciiString& revealName, const AsciiString& waypointName, Real radiusToReveal, const AsciiString& playerName)
  5532. {
  5533. VecNamedRevealIt it;
  5534. // Will fail if there's already one in existence of the same name.
  5535. for (it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it) {
  5536. if (it->m_revealName == revealName) {
  5537. DEBUG_CRASH(("ScriptEngine::createNamedMapReveal: Attempted to redefine named Reveal '%s', so I won't change it.\n", revealName.str()));
  5538. return;
  5539. }
  5540. }
  5541. NamedReveal reveal;
  5542. reveal.m_playerName = playerName;
  5543. reveal.m_radiusToReveal = radiusToReveal;
  5544. reveal.m_revealName = revealName;
  5545. reveal.m_waypointName = waypointName;
  5546. m_namedReveals.push_back(reveal);
  5547. }
  5548. //-------------------------------------------------------------------------------------------------
  5549. void ScriptEngine::doNamedMapReveal(const AsciiString& revealName)
  5550. {
  5551. VecNamedRevealIt it;
  5552. NamedReveal *reveal = NULL;
  5553. for (it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it) {
  5554. if (it->m_revealName == revealName) {
  5555. reveal = &(*it);
  5556. break;
  5557. }
  5558. }
  5559. if (!reveal) {
  5560. return;
  5561. }
  5562. Waypoint *way = TheTerrainLogic->getWaypointByName(reveal->m_waypointName);
  5563. if (!way) {
  5564. return;
  5565. }
  5566. Player *player = getPlayerFromAsciiString(reveal->m_playerName);
  5567. if (!player) {
  5568. return;
  5569. }
  5570. Coord3D pos;
  5571. pos = *way->getLocation();
  5572. ThePartitionManager->doShroudReveal(pos.x, pos.y, reveal->m_radiusToReveal, player->getPlayerMask());
  5573. }
  5574. //-------------------------------------------------------------------------------------------------
  5575. void ScriptEngine::undoNamedMapReveal(const AsciiString& revealName)
  5576. {
  5577. VecNamedRevealIt it;
  5578. NamedReveal *reveal = NULL;
  5579. for (it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it) {
  5580. if (it->m_revealName == revealName) {
  5581. reveal = &(*it);
  5582. break;
  5583. }
  5584. }
  5585. if (!reveal) {
  5586. return;
  5587. }
  5588. Waypoint *way = TheTerrainLogic->getWaypointByName(reveal->m_waypointName);
  5589. if (!way) {
  5590. return;
  5591. }
  5592. Player *player = getPlayerFromAsciiString(reveal->m_playerName);
  5593. if (!player) {
  5594. return;
  5595. }
  5596. Coord3D pos;
  5597. pos = *way->getLocation();
  5598. ThePartitionManager->undoShroudReveal(pos.x, pos.y, reveal->m_radiusToReveal, player->getPlayerMask());
  5599. }
  5600. //-------------------------------------------------------------------------------------------------
  5601. void ScriptEngine::removeNamedMapReveal(const AsciiString& revealName)
  5602. {
  5603. VecNamedRevealIt it;
  5604. for (it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it) {
  5605. if (it->m_revealName == revealName) {
  5606. m_namedReveals.erase(it);
  5607. return;
  5608. }
  5609. }
  5610. }
  5611. //-------------------------------------------------------------------------------------------------
  5612. /** Allocates a flag, if this name doesn't exist. */
  5613. //-------------------------------------------------------------------------------------------------
  5614. Int ScriptEngine::allocateFlag( const AsciiString& name)
  5615. {
  5616. Int i;
  5617. // Note - flags start at 1. 0 means not assigned.
  5618. for (i=1; i<m_numFlags; i++) {
  5619. if ((name==m_flags[i].name)) {
  5620. return i;
  5621. }
  5622. }
  5623. DEBUG_ASSERTCRASH(m_numFlags < MAX_FLAGS, ("Too many flags, failed to make '%s'..\n", name.str()));
  5624. if (m_numFlags < MAX_FLAGS) {
  5625. m_flags[m_numFlags].name = name;
  5626. i = m_numFlags;
  5627. m_numFlags++;
  5628. return(i);
  5629. }
  5630. return 0; // Shouldn't ever happen.
  5631. }
  5632. //-------------------------------------------------------------------------------------------------
  5633. /** Locates a group by name. */
  5634. //-------------------------------------------------------------------------------------------------
  5635. ScriptGroup *ScriptEngine::findGroup(const AsciiString& name)
  5636. {
  5637. Int i;
  5638. for (i=0; i<TheSidesList->getNumSides(); i++) {
  5639. ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList();
  5640. if (pSL==NULL) continue;
  5641. ScriptGroup *pGroup;
  5642. for (pGroup = pSL->getScriptGroup(); pGroup; pGroup=pGroup->getNext()) {
  5643. if (pGroup->getName() == name) {
  5644. return pGroup;
  5645. }
  5646. }
  5647. }
  5648. return 0; // Shouldn't ever happen.
  5649. }
  5650. //-------------------------------------------------------------------------------------------------
  5651. /** Locates a script by name. */
  5652. //-------------------------------------------------------------------------------------------------
  5653. Script *ScriptEngine::findScript(const AsciiString& name)
  5654. {
  5655. Int i;
  5656. for (i=0; i<TheSidesList->getNumSides(); i++) {
  5657. ScriptList *pSL = TheSidesList->getSideInfo(i)->getScriptList();
  5658. if (pSL==NULL) continue;
  5659. Script *pScr;
  5660. for (pScr = pSL->getScript(); pScr; pScr=pScr->getNext()) {
  5661. if ((name==pScr->getName())) {
  5662. return pScr;
  5663. }
  5664. }
  5665. ScriptGroup *pGroup;
  5666. for (pGroup = pSL->getScriptGroup(); pGroup; pGroup=pGroup->getNext()) {
  5667. for (pScr = pGroup->getScript(); pScr; pScr=pScr->getNext()) {
  5668. if ((name==pScr->getName())) {
  5669. return pScr;
  5670. }
  5671. }
  5672. }
  5673. }
  5674. return 0; // Shouldn't ever happen.
  5675. }
  5676. //-------------------------------------------------------------------------------------------------
  5677. /** Evaluates a counter condition */
  5678. //-------------------------------------------------------------------------------------------------
  5679. Bool ScriptEngine::evaluateCounter( Condition *pCondition )
  5680. {
  5681. DEBUG_ASSERTCRASH(pCondition->getNumParameters() >= 3, ("Not enough parameters.\n"));
  5682. DEBUG_ASSERTCRASH(pCondition->getConditionType() == Condition::COUNTER, ("Wrong condition.\n"));
  5683. Int counterNdx = pCondition->getParameter(0)->getInt();
  5684. if (counterNdx == 0) {
  5685. counterNdx = allocateCounter(pCondition->getParameter(0)->getString());
  5686. pCondition->getParameter(0)->friend_setInt(counterNdx);
  5687. }
  5688. Int value = pCondition->getParameter(2)->getInt();
  5689. switch (pCondition->getParameter(1)->getInt()) {
  5690. case Parameter::LESS_THAN: return m_counters[counterNdx].value < value;
  5691. case Parameter::LESS_EQUAL: return m_counters[counterNdx].value <= value;
  5692. case Parameter::EQUAL: return m_counters[counterNdx].value == value;
  5693. case Parameter::GREATER_EQUAL: return m_counters[counterNdx].value >= value;
  5694. case Parameter::GREATER: return m_counters[counterNdx].value > value;
  5695. case Parameter::NOT_EQUAL: return m_counters[counterNdx].value != value;
  5696. }
  5697. return false;
  5698. }
  5699. //-------------------------------------------------------------------------------------------------
  5700. /** Sets a counter. */
  5701. //-------------------------------------------------------------------------------------------------
  5702. void ScriptEngine::setCounter( ScriptAction *pAction )
  5703. {
  5704. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.\n"));
  5705. Int counterNdx = pAction->getParameter(0)->getInt();
  5706. if (counterNdx == 0) {
  5707. counterNdx = allocateCounter(pAction->getParameter(0)->getString());
  5708. pAction->getParameter(0)->friend_setInt(counterNdx);
  5709. }
  5710. Int value = pAction->getParameter(1)->getInt();
  5711. m_counters[counterNdx].value = value;
  5712. }
  5713. //-------------------------------------------------------------------------------------------------
  5714. /** Sets a fade. */
  5715. //-------------------------------------------------------------------------------------------------
  5716. void ScriptEngine::setFade( ScriptAction *pAction )
  5717. {
  5718. #if defined(_DEBUG) || defined(_INTERNAL)
  5719. if (TheGlobalData->m_disableCameraFade)
  5720. {
  5721. m_fade = FADE_NONE;
  5722. return;
  5723. }
  5724. #endif
  5725. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 5, ("Not enough parameters.\n"));
  5726. switch (pAction->getActionType()) {
  5727. default: m_fade = FADE_NONE; return;
  5728. case ScriptAction::CAMERA_FADE_ADD: m_fade = FADE_ADD; break;
  5729. case ScriptAction::CAMERA_FADE_SUBTRACT: m_fade = FADE_SUBTRACT; break;
  5730. case ScriptAction::CAMERA_FADE_SATURATE: m_fade = FADE_SATURATE; break;
  5731. case ScriptAction::CAMERA_FADE_MULTIPLY: m_fade = FADE_MULTIPLY; break;
  5732. }
  5733. m_curFadeFrame = 0;
  5734. m_minFade = pAction->getParameter(0)->getReal();
  5735. m_maxFade = pAction->getParameter(1)->getReal();
  5736. m_fadeFramesIncrease = pAction->getParameter(2)->getInt();
  5737. m_fadeFramesHold = pAction->getParameter(3)->getInt();
  5738. m_fadeFramesDecrease = pAction->getParameter(4)->getInt();
  5739. m_curFadeValue = m_minFade;
  5740. if( m_fadeFramesIncrease == 0 )
  5741. {
  5742. updateFades();
  5743. }
  5744. }
  5745. //-------------------------------------------------------------------------------------------------
  5746. /** Sets a counter. */
  5747. //-------------------------------------------------------------------------------------------------
  5748. void ScriptEngine::setSway( ScriptAction *pAction )
  5749. {
  5750. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 5, ("Not enough parameters.\n"));
  5751. ++m_breezeInfo.m_breezeVersion;
  5752. m_breezeInfo.m_direction = pAction->getParameter(0)->getReal();
  5753. m_breezeInfo.m_directionVec.x = Sin(m_breezeInfo.m_direction);
  5754. m_breezeInfo.m_directionVec.y = Cos(m_breezeInfo.m_direction);
  5755. m_breezeInfo.m_intensity = pAction->getParameter(1)->getReal();
  5756. m_breezeInfo.m_lean = pAction->getParameter(2)->getReal();
  5757. m_breezeInfo.m_breezePeriod = pAction->getParameter(3)->getInt();
  5758. if (m_breezeInfo.m_breezePeriod<1)
  5759. m_breezeInfo.m_breezePeriod = 1;
  5760. m_breezeInfo.m_randomness = pAction->getParameter(4)->getReal();
  5761. }
  5762. //-------------------------------------------------------------------------------------------------
  5763. /** Adds to a counter. */
  5764. //-------------------------------------------------------------------------------------------------
  5765. void ScriptEngine::addCounter( ScriptAction *pAction )
  5766. {
  5767. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.\n"));
  5768. Int value = pAction->getParameter(0)->getInt();
  5769. Int counterNdx = pAction->getParameter(1)->getInt();
  5770. if (counterNdx == 0) {
  5771. counterNdx = allocateCounter(pAction->getParameter(1)->getString());
  5772. pAction->getParameter(1)->friend_setInt(counterNdx);
  5773. }
  5774. m_counters[counterNdx].value += value;
  5775. }
  5776. //-------------------------------------------------------------------------------------------------
  5777. /** Subtracts from a counter. */
  5778. //-------------------------------------------------------------------------------------------------
  5779. void ScriptEngine::subCounter( ScriptAction *pAction )
  5780. {
  5781. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.\n"));
  5782. Int value = pAction->getParameter(0)->getInt();
  5783. Int counterNdx = pAction->getParameter(1)->getInt();
  5784. if (counterNdx == 0) {
  5785. counterNdx = allocateCounter(pAction->getParameter(1)->getString());
  5786. pAction->getParameter(1)->friend_setInt(counterNdx);
  5787. }
  5788. m_counters[counterNdx].value -= value;
  5789. }
  5790. //-------------------------------------------------------------------------------------------------
  5791. /** Evaluates a flag */
  5792. //-------------------------------------------------------------------------------------------------
  5793. Bool ScriptEngine::evaluateFlag( Condition *pCondition )
  5794. {
  5795. DEBUG_ASSERTCRASH(pCondition->getNumParameters() >= 2, ("Not enough parameters.\n"));
  5796. DEBUG_ASSERTCRASH(pCondition->getConditionType() == Condition::FLAG, ("Wrong condition.\n"));
  5797. Int flagNdx = pCondition->getParameter(0)->getInt();
  5798. if (flagNdx == 0) {
  5799. flagNdx = allocateFlag(pCondition->getParameter(0)->getString());
  5800. pCondition->getParameter(0)->friend_setInt(flagNdx);
  5801. }
  5802. Int value = pCondition->getParameter(1)->getInt();
  5803. Bool boolVal = (value!=0);
  5804. Bool boolFlag = (m_flags[flagNdx].value != 0);
  5805. if (boolVal == boolFlag) {
  5806. return true;
  5807. }
  5808. for (ListAsciiStringIt it = m_uiInteractions.begin(); it != m_uiInteractions.end(); ++it) {
  5809. if (it->compare(pCondition->getParameter(0)->getString()) == 0) {
  5810. // just return. This flag will be cleared up at the end of the ScriptEngine::update() call
  5811. return true;
  5812. }
  5813. }
  5814. return false;
  5815. }
  5816. //-------------------------------------------------------------------------------------------------
  5817. /** Sets a flag */
  5818. //-------------------------------------------------------------------------------------------------
  5819. void ScriptEngine::setFlag( ScriptAction *pAction )
  5820. {
  5821. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.\n"));
  5822. Int flagNdx = pAction->getParameter(0)->getInt();
  5823. if (flagNdx == 0) {
  5824. flagNdx = allocateFlag(pAction->getParameter(0)->getString());
  5825. pAction->getParameter(0)->friend_setInt(flagNdx);
  5826. }
  5827. Bool value = pAction->getParameter(1)->getInt();
  5828. m_flags[flagNdx].value = value;
  5829. }
  5830. //-------------------------------------------------------------------------------------------------
  5831. /** Finds a named attack info. Note - may return null. */
  5832. //-------------------------------------------------------------------------------------------------
  5833. AttackPriorityInfo * ScriptEngine::findAttackInfo(const AsciiString& name, Bool addIfNotFound)
  5834. {
  5835. // Note - m_attackPriorityInfo[0] is the default info, with an empty name.
  5836. Int i;
  5837. for (i=1; i<m_numAttackInfo; i++) {
  5838. if (m_attackPriorityInfo[i].getName() == name) {
  5839. return &m_attackPriorityInfo[i];
  5840. }
  5841. }
  5842. if (addIfNotFound && m_numAttackInfo<MAX_ATTACK_PRIORITIES) {
  5843. m_attackPriorityInfo[m_numAttackInfo].friend_setName(name);
  5844. m_numAttackInfo++;
  5845. return &m_attackPriorityInfo[m_numAttackInfo-1];
  5846. }
  5847. return NULL;
  5848. }
  5849. /// Attack priority stuff.
  5850. //-------------------------------------------------------------------------------------------------
  5851. /** Returns the default attack priority info. Never returns null. */
  5852. //-------------------------------------------------------------------------------------------------
  5853. const AttackPriorityInfo *ScriptEngine::getDefaultAttackInfo(void)
  5854. {
  5855. // Note - m_attackPriorityInfo[0] is the default info, with an empty name.
  5856. return &m_attackPriorityInfo[0];
  5857. }
  5858. //-------------------------------------------------------------------------------------------------
  5859. /** Returns the named attack info, if non-existent returns default attack priority info.
  5860. Never returns null. */
  5861. //-------------------------------------------------------------------------------------------------
  5862. const AttackPriorityInfo *ScriptEngine::getAttackInfo(const AsciiString& name)
  5863. {
  5864. Int i;
  5865. for (i=1; i<m_numAttackInfo; i++) {
  5866. if (m_attackPriorityInfo[i].getName() == name) {
  5867. return &m_attackPriorityInfo[i];
  5868. }
  5869. }
  5870. // Note - m_attackPriorityInfo[0] is the default info, with an empty name.
  5871. return &m_attackPriorityInfo[0];
  5872. }
  5873. //-------------------------------------------------------------------------------------------------
  5874. /** Sets an Attack Priority Set value for a thing */
  5875. //-------------------------------------------------------------------------------------------------
  5876. void ScriptEngine::setPriorityThing( ScriptAction *pAction )
  5877. {
  5878. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 3, ("Not enough parameters.\n"));
  5879. AsciiString typeArgument = pAction->getParameter(1)->getString();
  5880. // Our argument could be an individual type, or a list name.
  5881. const ObjectTypes *types = TheScriptEngine->getObjectTypes(typeArgument);
  5882. if( !types )
  5883. {
  5884. // Lookup failed, so it is just a single type
  5885. const ThingTemplate *thingTemplate;
  5886. // get thing template based from map object name
  5887. thingTemplate = TheThingFactory->findTemplate(typeArgument);
  5888. if (thingTemplate==NULL) {
  5889. AppendDebugMessage("***Attempting to set attack priority on an invalid thing:***", false);
  5890. AppendDebugMessage(pAction->getParameter(0)->getString(), false);
  5891. return;
  5892. }
  5893. AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true);
  5894. if (info==NULL) {
  5895. AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false);
  5896. return;
  5897. }
  5898. // DEBUG LOGGING
  5899. // AsciiString debug = "Set the priority on ";
  5900. // debug.concat(thingTemplate->getName().str());
  5901. // debug.concat(" to ");
  5902. // char intBuffer[16];
  5903. // itoa(pAction->getParameter(2)->getInt(), intBuffer, 10);
  5904. // debug.concat(intBuffer);
  5905. // AppendDebugMessage(debug, false);
  5906. // END DEBUGGING LOGGING
  5907. info->setPriority(thingTemplate, pAction->getParameter(2)->getInt());
  5908. return;
  5909. }
  5910. else
  5911. {
  5912. // Found a list by this name, so we have a bunch of things
  5913. for( Int typeIndex = 0; typeIndex < types->getListSize(); typeIndex ++ )
  5914. {
  5915. AsciiString thisTypeName = types->getNthInList(typeIndex);
  5916. const ThingTemplate *thisType = TheThingFactory->findTemplate(thisTypeName);
  5917. if (thisType==NULL) {
  5918. AppendDebugMessage("***Attempting to set attack priority on an invalid thing:***", false);
  5919. AppendDebugMessage(pAction->getParameter(0)->getString(), false);
  5920. return;
  5921. }
  5922. AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true);
  5923. if (info==NULL) {
  5924. AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false);
  5925. return;
  5926. }
  5927. // DEBUG LOGGING
  5928. // AsciiString debug = "Set the priority on ";
  5929. // debug.concat(thisType->getName().str());
  5930. // debug.concat(" to ");
  5931. // char intBuffer[16];
  5932. // itoa(pAction->getParameter(2)->getInt(), intBuffer, 10);
  5933. // debug.concat(intBuffer);
  5934. // AppendDebugMessage(debug, false);
  5935. // END DEBUGGING LOGGING
  5936. info->setPriority(thisType, pAction->getParameter(2)->getInt());
  5937. }
  5938. return;
  5939. }
  5940. }
  5941. //-------------------------------------------------------------------------------------------------
  5942. /** Sets an Attack Priority Set value for all things of a particular kind. */
  5943. //-------------------------------------------------------------------------------------------------
  5944. void ScriptEngine::setPriorityKind( ScriptAction *pAction )
  5945. {
  5946. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 3, ("Not enough parameters.\n"));
  5947. AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true);
  5948. if (info==NULL) {
  5949. AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false);
  5950. return;
  5951. }
  5952. KindOfType kind = (KindOfType)pAction->getParameter(1)->getInt();
  5953. Int priority = pAction->getParameter(2)->getInt();
  5954. const ThingTemplate *tTemplate;
  5955. for( tTemplate = TheThingFactory->firstTemplate();
  5956. tTemplate;
  5957. tTemplate = tTemplate->friend_getNextTemplate() )
  5958. {
  5959. if (tTemplate->isKindOf(kind)) {
  5960. info->setPriority(tTemplate, priority);
  5961. }
  5962. }
  5963. }
  5964. //-------------------------------------------------------------------------------------------------
  5965. /** Sets an Attack Priority Set default value. */
  5966. //-------------------------------------------------------------------------------------------------
  5967. void ScriptEngine::setPriorityDefault( ScriptAction *pAction )
  5968. {
  5969. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.\n"));
  5970. AttackPriorityInfo *info = findAttackInfo(pAction->getParameter(0)->getString(), true);
  5971. if (info==NULL) {
  5972. AppendDebugMessage("***Error allocating attack priority set - fix or raise limit. ***", false);
  5973. return;
  5974. }
  5975. info->friend_setDefaultPriority(pAction->getParameter(1)->getInt());
  5976. }
  5977. //-------------------------------------------------------------------------------------------------
  5978. Int ScriptEngine::getObjectCount(Int playerIndex, const AsciiString& objectTypeName) const
  5979. {
  5980. if (!ThePlayerList->getNthPlayer(playerIndex)->isPlayerActive()) {
  5981. // Inactive players should always pretend they have 0 objects.
  5982. return 0;
  5983. }
  5984. const ObjectTypeCount &ocm = m_objectCounts[playerIndex];
  5985. ObjectTypeCount::const_iterator it = ocm.find(objectTypeName);
  5986. if (it == ocm.end()) {
  5987. return 0;
  5988. }
  5989. return it->second;
  5990. }
  5991. //-------------------------------------------------------------------------------------------------
  5992. void ScriptEngine::setObjectCount(Int playerIndex, const AsciiString& objectTypeName, Int newCount)
  5993. {
  5994. // Don't really need inactive player checks here.
  5995. ObjectTypeCount &ocm = m_objectCounts[playerIndex];
  5996. ocm[objectTypeName] = newCount;
  5997. }
  5998. //-------------------------------------------------------------------------------------------------
  5999. /** Removes an object types list from the list owned by the script engine, and then deletes the */
  6000. /** associated item. */
  6001. //-------------------------------------------------------------------------------------------------
  6002. void ScriptEngine::removeObjectTypes(ObjectTypes *typesToRemove)
  6003. {
  6004. if (typesToRemove == NULL) {
  6005. return;
  6006. }
  6007. AllObjectTypesIt it = std::find(m_allObjectTypeLists.begin(), m_allObjectTypeLists.end(), typesToRemove);
  6008. if (it == m_allObjectTypeLists.end()) {
  6009. // Debug crash maybe?
  6010. return;
  6011. }
  6012. // delete it.
  6013. typesToRemove->deleteInstance();
  6014. // remove it from the main array of stuff
  6015. m_allObjectTypeLists.erase(it);
  6016. }
  6017. //-------------------------------------------------------------------------------------------------
  6018. /** Evaluates a timer */
  6019. //-------------------------------------------------------------------------------------------------
  6020. Bool ScriptEngine::evaluateTimer( Condition *pCondition )
  6021. {
  6022. DEBUG_ASSERTCRASH(pCondition->getNumParameters() >= 1, ("Not enough parameters.\n"));
  6023. DEBUG_ASSERTCRASH(pCondition->getConditionType() == Condition::TIMER_EXPIRED, ("Wrong condition.\n"));
  6024. Int counterNdx = pCondition->getParameter(0)->getInt();
  6025. if (counterNdx == 0) {
  6026. counterNdx = allocateCounter(pCondition->getParameter(0)->getString());
  6027. pCondition->getParameter(0)->friend_setInt(counterNdx);
  6028. }
  6029. if (!m_counters[counterNdx].isCountdownTimer) {
  6030. return false; // Timer hasn't been started yet.
  6031. }
  6032. Int value = m_counters[counterNdx].value;
  6033. // Timers decrement down to -1.
  6034. return (value < 1);
  6035. }
  6036. //-------------------------------------------------------------------------------------------------
  6037. /** Starts a timer. */
  6038. //-------------------------------------------------------------------------------------------------
  6039. void ScriptEngine::setTimer( ScriptAction *pAction, Bool millisecondTimer, Bool random )
  6040. {
  6041. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.\n"));
  6042. Int counterNdx = pAction->getParameter(0)->getInt();
  6043. if (counterNdx == 0) {
  6044. counterNdx = allocateCounter(pAction->getParameter(0)->getString());
  6045. pAction->getParameter(0)->friend_setInt(counterNdx);
  6046. }
  6047. if (millisecondTimer) {
  6048. Real value = pAction->getParameter(1)->getReal();
  6049. if (random) {
  6050. Real randomValue = pAction->getParameter(2)->getReal();
  6051. value = GameLogicRandomValue(value, randomValue);
  6052. }
  6053. m_counters[counterNdx].value = REAL_TO_INT_CEIL(ConvertDurationFromMsecsToFrames(value*1000));
  6054. } else {
  6055. Int value = pAction->getParameter(1)->getInt();
  6056. if (random) {
  6057. Int randomValue = pAction->getParameter(2)->getInt();
  6058. value = GameLogicRandomValue(value, randomValue);
  6059. }
  6060. m_counters[counterNdx].value = value;
  6061. }
  6062. m_counters[counterNdx].isCountdownTimer = true;
  6063. }
  6064. //-------------------------------------------------------------------------------------------------
  6065. /** Stops a timer. */
  6066. //-------------------------------------------------------------------------------------------------
  6067. void ScriptEngine::pauseTimer( ScriptAction *pAction )
  6068. {
  6069. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 1, ("Not enough parameters.\n"));
  6070. Int counterNdx = pAction->getParameter(0)->getInt();
  6071. if (counterNdx == 0) {
  6072. counterNdx = allocateCounter(pAction->getParameter(0)->getString());
  6073. pAction->getParameter(0)->friend_setInt(counterNdx);
  6074. }
  6075. m_counters[counterNdx].isCountdownTimer = false;
  6076. }
  6077. //-------------------------------------------------------------------------------------------------
  6078. /** Restarts a timer. */
  6079. //-------------------------------------------------------------------------------------------------
  6080. void ScriptEngine::restartTimer( ScriptAction *pAction )
  6081. {
  6082. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 1, ("Not enough parameters.\n"));
  6083. Int counterNdx = pAction->getParameter(0)->getInt();
  6084. if (counterNdx == 0) {
  6085. counterNdx = allocateCounter(pAction->getParameter(0)->getString());
  6086. pAction->getParameter(0)->friend_setInt(counterNdx);
  6087. }
  6088. if (m_counters[counterNdx].value > 0) {
  6089. m_counters[counterNdx].isCountdownTimer = true;
  6090. }
  6091. }
  6092. //-------------------------------------------------------------------------------------------------
  6093. /** adjusts a timer. */
  6094. //-------------------------------------------------------------------------------------------------
  6095. void ScriptEngine::adjustTimer( ScriptAction *pAction, Bool millisecondTimer, Bool add)
  6096. {
  6097. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 2, ("Not enough parameters.\n"));
  6098. Int counterNdx = pAction->getParameter(1)->getInt();
  6099. if (counterNdx == 0) {
  6100. counterNdx = allocateCounter(pAction->getParameter(1)->getString());
  6101. pAction->getParameter(1)->friend_setInt(counterNdx);
  6102. }
  6103. if (millisecondTimer) {
  6104. Real value = pAction->getParameter(0)->getReal();
  6105. if (!add)
  6106. value = -value;
  6107. m_counters[counterNdx].value += REAL_TO_INT_CEIL(ConvertDurationFromMsecsToFrames(value*1000));
  6108. } else {
  6109. Int value = pAction->getParameter(0)->getInt();
  6110. if (!add)
  6111. value = -value;
  6112. m_counters[counterNdx].value += value;
  6113. }
  6114. }
  6115. //-------------------------------------------------------------------------------------------------
  6116. /** Enables a script or group. */
  6117. //-------------------------------------------------------------------------------------------------
  6118. void ScriptEngine::enableScript( ScriptAction *pAction )
  6119. {
  6120. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 1, ("Not enough parameters.\n"));
  6121. ScriptGroup *pGroup = findGroup(pAction->getParameter(0)->getString());
  6122. if (pGroup) {
  6123. pGroup->setActive(true);
  6124. }
  6125. Script *pScript = findScript(pAction->getParameter(0)->getString());
  6126. if (pScript) {
  6127. pScript->setActive(true);
  6128. }
  6129. }
  6130. //-------------------------------------------------------------------------------------------------
  6131. /** Enables a script or group. */
  6132. //-------------------------------------------------------------------------------------------------
  6133. void ScriptEngine::disableScript( ScriptAction *pAction )
  6134. {
  6135. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 1, ("Not enough parameters.\n"));
  6136. Script *pScript = findScript(pAction->getParameter(0)->getString());
  6137. if (pScript) {
  6138. pScript->setActive(false);
  6139. }
  6140. ScriptGroup *pGroup = findGroup(pAction->getParameter(0)->getString());
  6141. if (pGroup) {
  6142. pGroup->setActive(false);
  6143. }
  6144. }
  6145. //-------------------------------------------------------------------------------------------------
  6146. /** Executes a script subroutine. */
  6147. //-------------------------------------------------------------------------------------------------
  6148. void ScriptEngine::callSubroutine( ScriptAction *pAction )
  6149. {
  6150. DEBUG_ASSERTCRASH(pAction->getNumParameters() >= 1, ("Not enough parameters.\n"));
  6151. AsciiString scriptName = pAction->getParameter(0)->getString();
  6152. Script *pScript;
  6153. ScriptGroup *pGroup = findGroup(scriptName);
  6154. if (pGroup) {
  6155. if (pGroup->isSubroutine()) {
  6156. if (pGroup->isActive()) {
  6157. executeScripts(pGroup->getScript());
  6158. }
  6159. } else {
  6160. AppendDebugMessage("***Attempting to call script that is not a subroutine:***", false);
  6161. AppendDebugMessage(scriptName, false);
  6162. DEBUG_LOG(("Attempting to call script '%s' that is not a subroutine.\n", scriptName.str()));
  6163. }
  6164. } else {
  6165. pScript = findScript(scriptName);
  6166. if (pScript != NULL) {
  6167. if (pScript->isSubroutine()) {
  6168. executeScript(pScript);
  6169. } else {
  6170. AppendDebugMessage("***Attempting to call script that is not a subroutine:***", false);
  6171. AppendDebugMessage(scriptName, false);
  6172. DEBUG_LOG(("Attempting to call script '%s' that is not a subroutine.\n", scriptName.str()));
  6173. }
  6174. } else {
  6175. AppendDebugMessage("***Script not defined:***", false);
  6176. AppendDebugMessage(scriptName, false);
  6177. DEBUG_LOG(("WARNING: Script '%s' not defined.\n", scriptName.str()));
  6178. }
  6179. }
  6180. }
  6181. //-------------------------------------------------------------------------------------------------
  6182. /** Checks to see if any teams are referenced in the conditions, so we can properly
  6183. iterate over multiple teams. */
  6184. //-------------------------------------------------------------------------------------------------
  6185. void ScriptEngine::checkConditionsForTeamNames(Script *pScript)
  6186. {
  6187. AsciiString singletonTeamName;
  6188. AsciiString multiTeamName;
  6189. if (pScript->getDelayEvalSeconds()>0) {
  6190. // Offset by a random number of frames
  6191. pScript->setFrameToEvaluate(GameLogicRandomValue(0,2*LOGICFRAMES_PER_SECOND));
  6192. } else {
  6193. pScript->setFrameToEvaluate(0);
  6194. }
  6195. AsciiString scriptName = pScript->getName();
  6196. OrCondition *pOr;
  6197. for (pOr = pScript->getOrCondition(); pOr; pOr = pOr->getNextOrCondition()) {
  6198. Condition *pCondition;
  6199. for (pCondition = pOr->getFirstAndCondition(); pCondition; pCondition = pCondition->getNext()) {
  6200. Int i;
  6201. for (i=0; i<pCondition->getNumParameters(); i++) {
  6202. if (Parameter::TEAM == pCondition->getParameter(i)->getParameterType()) {
  6203. AsciiString teamName = pCondition->getParameter(i)->getString();
  6204. TeamPrototype *proto = TheTeamFactory->findTeamPrototype(teamName);
  6205. if (proto==NULL) continue; // Undefined team - don't bother.
  6206. Bool singleton = proto->getIsSingleton();
  6207. if (proto->getTemplateInfo()->m_maxInstances < 2) {
  6208. singleton = true;
  6209. }
  6210. if (singleton) {
  6211. singletonTeamName = teamName; // Singleton team - use if it is the only one, but can have multiple of these.
  6212. } else {
  6213. if (multiTeamName.isEmpty()) {
  6214. multiTeamName = teamName; // Use one multiply defined team. Good.
  6215. } else if (multiTeamName!=teamName) {
  6216. // More than one multiply defined team - bad.
  6217. AppendDebugMessage("***WARNING: Script contains multiple non-singleton team conditions::***", false);
  6218. AppendDebugMessage(scriptName, false);
  6219. AppendDebugMessage(multiTeamName, false);
  6220. AppendDebugMessage(teamName, false);
  6221. DEBUG_LOG(("WARNING: Script '%s' contains multiple non-singleton team conditions: %s & %s.\n", scriptName.str(),
  6222. multiTeamName.str(), teamName.str()));
  6223. }
  6224. }
  6225. }
  6226. }
  6227. }
  6228. }
  6229. if (multiTeamName.isEmpty()) {
  6230. if (!singletonTeamName.isEmpty()) {
  6231. pScript->setConditionTeamName(singletonTeamName);
  6232. }
  6233. } else {
  6234. pScript->setConditionTeamName(multiTeamName);
  6235. }
  6236. }
  6237. //-------------------------------------------------------------------------------------------------
  6238. /** Executes a script. */
  6239. //-------------------------------------------------------------------------------------------------
  6240. void ScriptEngine::executeScript( Script *pScript )
  6241. {
  6242. pScript->setCurTime(0);
  6243. // If script is not active, return.
  6244. if (!pScript->isActive()) {
  6245. return;
  6246. }
  6247. enum GameDifficulty difficulty = getGlobalDifficulty();
  6248. if (m_currentPlayer) {
  6249. difficulty = m_currentPlayer->getPlayerDifficulty();
  6250. }
  6251. // If script doesn't match difficulty level, return.
  6252. switch (difficulty) {
  6253. case DIFFICULTY_EASY : if (!pScript->isEasy()) return; break;
  6254. case DIFFICULTY_NORMAL : if (!pScript->isNormal()) return; break;
  6255. case DIFFICULTY_HARD : if (!pScript->isHard()) return; break;
  6256. }
  6257. // If we are doing peridic evaluation, check the frame.
  6258. if (TheGameLogic->getFrame()<pScript->getFrameToEvaluate()) {
  6259. return;
  6260. }
  6261. Int delaySeconds = pScript->getDelayEvalSeconds();
  6262. if (delaySeconds>0) {
  6263. pScript->setFrameToEvaluate(TheGameLogic->getFrame()+delaySeconds*LOGICFRAMES_PER_SECOND);
  6264. }
  6265. #ifdef DEBUG_LOGGING
  6266. #ifdef SPECIAL_SCRIPT_PROFILING
  6267. __int64 startTime64;
  6268. Real timeToEvaluate=0.0f;
  6269. __int64 endTime64,freq64;
  6270. QueryPerformanceFrequency((LARGE_INTEGER *)&freq64);
  6271. QueryPerformanceCounter((LARGE_INTEGER *)&startTime64);
  6272. #endif
  6273. #endif
  6274. Team *pSavConditionTeam = m_conditionTeam;
  6275. TeamPrototype *pProto = NULL;
  6276. if (!pScript->getConditionTeamName().isEmpty()) {
  6277. pProto = TheTeamFactory->findTeamPrototype(pScript->getConditionTeamName());
  6278. }
  6279. if (pProto && pProto->countTeamInstances() > 0) {
  6280. // We have a team referred to in the conditions. Iterate over the instances of the team,
  6281. // applying the script conditions (and possibly actions) to each instance of the team.
  6282. for (DLINK_ITERATOR<Team> iter = pProto->iterate_TeamInstanceList(); !iter.done(); iter.advance()) {
  6283. m_conditionTeam = iter.cur();
  6284. // If conditions evaluate to true, execute actions.
  6285. if (evaluateConditions(pScript)) {
  6286. // Script Debug window
  6287. if (pScript->getAction()) {
  6288. _appendMessage(pScript->getName());
  6289. executeActions(pScript->getAction());
  6290. }
  6291. if (pScript->isOneShot()) {
  6292. pScript->setActive(false);
  6293. }
  6294. } else if (pScript->getFalseAction()) {
  6295. // Script Debug window
  6296. _appendMessage(pScript->getName(), false);
  6297. // Only do this is there are actually false actions.
  6298. executeActions(pScript->getFalseAction());
  6299. }
  6300. }
  6301. } else {
  6302. m_conditionTeam = NULL;
  6303. // If conditions evaluate to true, execute actions.
  6304. if (evaluateConditions(pScript)) {
  6305. if (pScript->getAction()) {
  6306. // Script Debug window
  6307. _appendMessage(pScript->getName());
  6308. executeActions(pScript->getAction());
  6309. }
  6310. if (pScript->isOneShot()) {
  6311. pScript->setActive(false);
  6312. }
  6313. } else if (pScript->getFalseAction()) {
  6314. // Script Debug window
  6315. _appendMessage(pScript->getName(), false);
  6316. // Only do this is there are actually false actions.
  6317. executeActions(pScript->getFalseAction());
  6318. if (pScript->isOneShot()) {
  6319. pScript->setActive(false);
  6320. }
  6321. }
  6322. }
  6323. #ifdef DEBUG_LOGGING
  6324. #ifdef SPECIAL_SCRIPT_PROFILING
  6325. QueryPerformanceCounter((LARGE_INTEGER *)&endTime64);
  6326. timeToEvaluate = ((Real)(endTime64-startTime64) / (Real)(freq64));
  6327. pScript->setCurTime(timeToEvaluate);
  6328. #endif
  6329. #endif
  6330. m_conditionTeam = pSavConditionTeam;
  6331. }
  6332. //-------------------------------------------------------------------------------------------------
  6333. /** Evaluates a condition */
  6334. //-------------------------------------------------------------------------------------------------
  6335. Bool ScriptEngine::evaluateCondition( Condition *pCondition )
  6336. {
  6337. switch (pCondition->getConditionType()) {
  6338. default:
  6339. return TheScriptConditions->evaluateCondition(pCondition);
  6340. case Condition::CONDITION_FALSE: return false;
  6341. case Condition::CONDITION_TRUE: return true;
  6342. case Condition::COUNTER: return evaluateCounter(pCondition);
  6343. case Condition::FLAG: return evaluateFlag(pCondition);
  6344. case Condition::TIMER_EXPIRED: return evaluateTimer(pCondition);
  6345. }
  6346. }
  6347. //-------------------------------------------------------------------------------------------------
  6348. /** Execute an action specified by pActionHead */
  6349. //-------------------------------------------------------------------------------------------------
  6350. void ScriptEngine::friend_executeAction( ScriptAction *pActionHead, Team *pThisTeam )
  6351. {
  6352. Team *pSavCallingTeam = m_callingTeam;
  6353. Player *pSavPlayer = m_currentPlayer;
  6354. m_callingTeam = pThisTeam;
  6355. m_currentPlayer = NULL;
  6356. if (pThisTeam) {
  6357. m_currentPlayer = pThisTeam->getControllingPlayer();
  6358. }
  6359. executeActions(pActionHead);
  6360. m_callingTeam = pSavCallingTeam;
  6361. m_currentPlayer = pSavPlayer;
  6362. }
  6363. //-------------------------------------------------------------------------------------------------
  6364. /** adds an object to the cache, allowing it to be looked up by name */
  6365. //-------------------------------------------------------------------------------------------------
  6366. void ScriptEngine::addObjectToCache(Object* pNewObject)
  6367. {
  6368. if (!pNewObject) {
  6369. return;
  6370. }
  6371. AsciiString objName = pNewObject->getName();
  6372. if (objName == AsciiString::TheEmptyString) {
  6373. return;
  6374. }
  6375. for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) {
  6376. if (it->first == objName) {
  6377. if (it->second == NULL) {
  6378. AsciiString newNameForDead;
  6379. newNameForDead.format("Reassigning dead object's name '%s' to object (%d) of type '%s'\n", objName.str(), pNewObject->getID(), pNewObject->getTemplate()->getName().str());
  6380. TheScriptEngine->AppendDebugMessage(newNameForDead, FALSE);
  6381. DEBUG_LOG((newNameForDead.str()));
  6382. it->second = pNewObject;
  6383. return;
  6384. } else {
  6385. DEBUG_CRASH(("Attempting to assign the name '%s' to object (%d) of type '%s',"
  6386. " but object (%d) of type '%s' already has that name\n",
  6387. objName.str(), pNewObject->getID(), pNewObject->getTemplate()->getName().str(),
  6388. it->second->getID(), it->second->getTemplate()->getName().str()));
  6389. return;
  6390. }
  6391. }
  6392. if (pNewObject == (it->second)) {
  6393. it->first = objName;
  6394. return;
  6395. }
  6396. }
  6397. NamedRequest req;
  6398. req.first = objName;
  6399. req.second = pNewObject;
  6400. m_namedObjects.push_back(req);
  6401. }
  6402. //-------------------------------------------------------------------------------------------------
  6403. /** removes a dead object from the cache, to prevent "Bad Stuff"(r) */
  6404. //-------------------------------------------------------------------------------------------------
  6405. void ScriptEngine::removeObjectFromCache( Object* pDeadObject )
  6406. {
  6407. for (VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it) {
  6408. if (pDeadObject == (it->second)) {
  6409. it->second = NULL; // Don't remove it, cause we want to check whether we ever knew a name later
  6410. break;
  6411. }
  6412. }
  6413. }
  6414. //-------------------------------------------------------------------------------------------------
  6415. /** Kris:
  6416. Looks for existing cached object with same name and replaces that object point with the supplied one.
  6417. This is an important feature for units that change into something else. Good examples include terrorists
  6418. entering a vehicle to convert it to a carbomb, pilots adding veterancy to vehicles, hijackers stealing
  6419. vehicles, and infantry taking over disabled vehicles.
  6420. */
  6421. //-------------------------------------------------------------------------------------------------
  6422. void ScriptEngine::transferObjectName( const AsciiString& unitName, Object *pNewObject )
  6423. {
  6424. //Sanity checks
  6425. if( !pNewObject || !unitName.getLength() )
  6426. {
  6427. return;
  6428. }
  6429. //John Ahlquist: When transferring an object name, make sure the new object isn't already in
  6430. // the vector. If so, remove it, or it'll end up there twice and cause a crash.
  6431. if( pNewObject->getName().isNotEmpty() )
  6432. {
  6433. removeObjectFromCache(pNewObject);
  6434. }
  6435. pNewObject->setName(unitName); // make sure it's named the name.
  6436. //Loop through the cached list and find the string entry. If found, change the object
  6437. //so it's pointing to the new one.
  6438. for( VecNamedRequestsIt it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it )
  6439. {
  6440. if( !unitName.compare( it->first ) )
  6441. {
  6442. Object* pOldObj = it->second;
  6443. if( pOldObj )
  6444. {
  6445. // if you are transferring your name, you should also transfer any custom indicator color you have.
  6446. if (pOldObj->hasCustomIndicatorColor())
  6447. pNewObject->setCustomIndicatorColor(pOldObj->getIndicatorColor());
  6448. else
  6449. pNewObject->removeCustomIndicatorColor();
  6450. }
  6451. it->second = pNewObject;
  6452. return;
  6453. }
  6454. }
  6455. }
  6456. //-------------------------------------------------------------------------------------------------
  6457. //-------------------------------------------------------------------------------------------------
  6458. void ScriptEngine::notifyOfObjectDestruction( Object *pDeadObject )
  6459. {
  6460. if (!pDeadObject->getName().isEmpty())
  6461. {
  6462. removeObjectFromCache(pDeadObject);
  6463. }
  6464. if (m_conditionObject == pDeadObject) {
  6465. m_conditionObject = NULL;
  6466. }
  6467. if (m_callingObject == pDeadObject) {
  6468. m_callingObject = NULL;
  6469. }
  6470. }
  6471. //-------------------------------------------------------------------------------------------------
  6472. /** Notify the script engine that a video has completed */
  6473. //-------------------------------------------------------------------------------------------------
  6474. void ScriptEngine::notifyOfCompletedVideo( const AsciiString& completedVideo )
  6475. {
  6476. m_completedVideo.push_back(completedVideo);
  6477. }
  6478. //-------------------------------------------------------------------------------------------------
  6479. /** Notify the script engine that a special power fired */
  6480. //-------------------------------------------------------------------------------------------------
  6481. void ScriptEngine::notifyOfTriggeredSpecialPower( Int playerIndex, const AsciiString& completedPower, ObjectID sourceObj )
  6482. {
  6483. m_triggeredSpecialPowers[playerIndex].push_back(AsciiStringObjectIDPair(completedPower, sourceObj));
  6484. }
  6485. //-------------------------------------------------------------------------------------------------
  6486. /** Notify the script engine that a special power fired */
  6487. //-------------------------------------------------------------------------------------------------
  6488. void ScriptEngine::notifyOfMidwaySpecialPower( Int playerIndex, const AsciiString& completedPower, ObjectID sourceObj )
  6489. {
  6490. m_midwaySpecialPowers[playerIndex].push_back(AsciiStringObjectIDPair(completedPower, sourceObj));
  6491. }
  6492. //-------------------------------------------------------------------------------------------------
  6493. /** Notify the script engine that a special power fired */
  6494. //-------------------------------------------------------------------------------------------------
  6495. void ScriptEngine::notifyOfCompletedSpecialPower( Int playerIndex, const AsciiString& completedPower, ObjectID sourceObj )
  6496. {
  6497. m_finishedSpecialPowers[playerIndex].push_back(AsciiStringObjectIDPair(completedPower, sourceObj));
  6498. }
  6499. //-------------------------------------------------------------------------------------------------
  6500. /** Notify the script engine that an upgrade finished */
  6501. //-------------------------------------------------------------------------------------------------
  6502. void ScriptEngine::notifyOfCompletedUpgrade( Int playerIndex, const AsciiString& upgrade, ObjectID sourceObj )
  6503. {
  6504. m_completedUpgrades[playerIndex].push_back(AsciiStringObjectIDPair(upgrade, sourceObj));
  6505. }
  6506. //-------------------------------------------------------------------------------------------------
  6507. /** Notify the script engine that a general was chosen fired */
  6508. //-------------------------------------------------------------------------------------------------
  6509. void ScriptEngine::notifyOfAcquiredScience( Int playerIndex, ScienceType science )
  6510. {
  6511. m_acquiredSciences[playerIndex].push_back(science);
  6512. }
  6513. //-------------------------------------------------------------------------------------------------
  6514. /** Notify that a UI button was pressed and some flag should go true, for one frame only. */
  6515. //-------------------------------------------------------------------------------------------------
  6516. void ScriptEngine::signalUIInteract(const AsciiString& hookName)
  6517. {
  6518. m_uiInteractions.push_front(hookName);
  6519. #ifdef DEBUG_LOGGING
  6520. AppendDebugMessage(hookName, false); // don't bother in Release
  6521. #endif
  6522. }
  6523. //-------------------------------------------------------------------------------------------------
  6524. /** Determine whether a video has completed */
  6525. //-------------------------------------------------------------------------------------------------
  6526. Bool ScriptEngine::isVideoComplete( const AsciiString& completedVideo, Bool removeFromList )
  6527. {
  6528. ListAsciiStringIt findIt = std::find(m_completedVideo.begin(), m_completedVideo.end(), completedVideo);
  6529. if (findIt != m_completedVideo.end()) {
  6530. if (removeFromList) {
  6531. m_completedVideo.erase(findIt);
  6532. }
  6533. return true;
  6534. }
  6535. return false;
  6536. }
  6537. //-------------------------------------------------------------------------------------------------
  6538. /** Determine whether a speech has completed */
  6539. //-------------------------------------------------------------------------------------------------
  6540. Bool ScriptEngine::isSpeechComplete( const AsciiString& testSpeech, Bool removeFromList )
  6541. {
  6542. ListAsciiStringUINTIt findIt;
  6543. for (findIt = m_testingSpeech.begin(); findIt != m_testingSpeech.end(); ++findIt) {
  6544. if (findIt->first == testSpeech) {
  6545. break;
  6546. }
  6547. }
  6548. if (findIt == m_testingSpeech.end()) {
  6549. PairAsciiStringUINT newPair;
  6550. AudioEventRTS event(testSpeech);
  6551. Real audioLength = TheAudio->getAudioLengthMS(&event);
  6552. UnsignedInt frameCount = REAL_TO_UNSIGNEDINT(audioLength / MSEC_PER_LOGICFRAME_REAL);
  6553. newPair.first = testSpeech;
  6554. newPair.second = frameCount + TheGameLogic->getFrame();
  6555. m_testingSpeech.push_front(newPair);
  6556. findIt = m_testingSpeech.begin();
  6557. }
  6558. if (TheGameLogic->getFrame() >= findIt->second) {
  6559. // This audio is completed
  6560. if (removeFromList) {
  6561. m_testingSpeech.erase(findIt);
  6562. }
  6563. return true;
  6564. }
  6565. return false;
  6566. }
  6567. //-------------------------------------------------------------------------------------------------
  6568. /** Determine whether a sound has completed */
  6569. //-------------------------------------------------------------------------------------------------
  6570. Bool ScriptEngine::isAudioComplete( const AsciiString& testAudio, Bool removeFromList )
  6571. {
  6572. ListAsciiStringUINTIt findIt;
  6573. for (findIt = m_testingAudio.begin(); findIt != m_testingAudio.end(); ++findIt) {
  6574. if (findIt->first == testAudio) {
  6575. break;
  6576. }
  6577. }
  6578. if (findIt == m_testingAudio.end()) {
  6579. PairAsciiStringUINT newPair;
  6580. AudioEventRTS event(testAudio);
  6581. Real audioLength = TheAudio->getAudioLengthMS(&event);
  6582. UnsignedInt frameCount = REAL_TO_UNSIGNEDINT(audioLength / MSEC_PER_LOGICFRAME_REAL);
  6583. newPair.first = testAudio;
  6584. newPair.second = frameCount + TheGameLogic->getFrame();
  6585. m_testingAudio.push_front(newPair);
  6586. findIt = m_testingAudio.begin();
  6587. }
  6588. if (TheGameLogic->getFrame() >= findIt->second) {
  6589. // This audio is completed
  6590. if (removeFromList) {
  6591. m_testingAudio.erase(findIt);
  6592. }
  6593. return true;
  6594. }
  6595. return false;
  6596. }
  6597. //-------------------------------------------------------------------------------------------------
  6598. /** Determine whether a special power has been started */
  6599. //-------------------------------------------------------------------------------------------------
  6600. Bool ScriptEngine::isSpecialPowerTriggered( Int playerIndex, const AsciiString& completedPower, Bool removeFromList, ObjectID sourceObj )
  6601. {
  6602. if (playerIndex < 0 || playerIndex >= MAX_PLAYER_COUNT)
  6603. return FALSE;
  6604. ListAsciiStringObjectID *specialList = &(m_triggeredSpecialPowers[playerIndex]);
  6605. for (ListAsciiStringObjectIDIt findIt = specialList->begin(); findIt != specialList->end(); ++findIt)
  6606. {
  6607. AsciiStringObjectIDPair pair = *findIt;
  6608. if (pair.first == completedPower && (sourceObj == INVALID_ID || sourceObj == pair.second))
  6609. {
  6610. if (removeFromList) {
  6611. specialList->erase(findIt);
  6612. }
  6613. return TRUE;
  6614. }
  6615. }
  6616. return FALSE;
  6617. }
  6618. //-------------------------------------------------------------------------------------------------
  6619. /** Determine whether a special power has reached a midpoint (not required for all special powers!) */
  6620. //-------------------------------------------------------------------------------------------------
  6621. Bool ScriptEngine::isSpecialPowerMidway( Int playerIndex, const AsciiString& completedPower, Bool removeFromList, ObjectID sourceObj )
  6622. {
  6623. if (playerIndex < 0 || playerIndex >= MAX_PLAYER_COUNT)
  6624. return FALSE;
  6625. ListAsciiStringObjectID *specialList = &(m_midwaySpecialPowers[playerIndex]);
  6626. for (ListAsciiStringObjectIDIt findIt = specialList->begin(); findIt != specialList->end(); ++findIt)
  6627. {
  6628. AsciiStringObjectIDPair pair = *findIt;
  6629. if (pair.first == completedPower && (sourceObj == INVALID_ID || sourceObj == pair.second))
  6630. {
  6631. if (removeFromList) {
  6632. specialList->erase(findIt);
  6633. }
  6634. return TRUE;
  6635. }
  6636. }
  6637. return FALSE;
  6638. }
  6639. //-------------------------------------------------------------------------------------------------
  6640. /** Determine whether a special power has been finished */
  6641. //-------------------------------------------------------------------------------------------------
  6642. Bool ScriptEngine::isSpecialPowerComplete( Int playerIndex, const AsciiString& completedPower, Bool removeFromList, ObjectID sourceObj )
  6643. {
  6644. if (playerIndex < 0 || playerIndex >= MAX_PLAYER_COUNT)
  6645. return FALSE;
  6646. ListAsciiStringObjectID *specialList = &(m_finishedSpecialPowers[playerIndex]);
  6647. for (ListAsciiStringObjectIDIt findIt = specialList->begin(); findIt != specialList->end(); ++findIt)
  6648. {
  6649. AsciiStringObjectIDPair pair = *findIt;
  6650. if (pair.first == completedPower && (sourceObj == INVALID_ID || sourceObj == pair.second))
  6651. {
  6652. if (removeFromList) {
  6653. specialList->erase(findIt);
  6654. }
  6655. return TRUE;
  6656. }
  6657. }
  6658. return FALSE;
  6659. }
  6660. //-------------------------------------------------------------------------------------------------
  6661. /** Determine whether an upgrade has been completed */
  6662. //-------------------------------------------------------------------------------------------------
  6663. Bool ScriptEngine::isUpgradeComplete( Int playerIndex, const AsciiString& upgrade, Bool removeFromList, ObjectID sourceObj )
  6664. {
  6665. if (playerIndex < 0 || playerIndex >= MAX_PLAYER_COUNT)
  6666. return FALSE;
  6667. ListAsciiStringObjectID *specialList = &(m_completedUpgrades[playerIndex]);
  6668. for (ListAsciiStringObjectIDIt findIt = specialList->begin(); findIt != specialList->end(); ++findIt)
  6669. {
  6670. AsciiStringObjectIDPair pair = *findIt;
  6671. if (pair.first == upgrade && (sourceObj == INVALID_ID || sourceObj == pair.second))
  6672. {
  6673. if (removeFromList) {
  6674. specialList->erase(findIt);
  6675. }
  6676. return TRUE;
  6677. }
  6678. }
  6679. return FALSE;
  6680. }
  6681. #ifdef OLD_GENERALS_SPECIALIZATION
  6682. //-------------------------------------------------------------------------------------------------
  6683. /** Determine whether a general has been chosen */
  6684. //-------------------------------------------------------------------------------------------------
  6685. Bool ScriptEngine::isGeneralChosen( Int playerIndex, const AsciiString& generalName, Bool removeFromList, ObjectID sourceObj )
  6686. {
  6687. if (playerIndex < 0 || playerIndex >= MAX_PLAYER_COUNT)
  6688. return FALSE;
  6689. ListAsciiStringObjectID *specialList = &(m_chosenGenerals[playerIndex]);
  6690. for (ListAsciiStringObjectIDIt findIt = specialList->begin(); findIt != specialList->end(); ++findIt)
  6691. {
  6692. AsciiStringObjectIDPair pair = *findIt;
  6693. if (pair.first == generalName && (sourceObj == INVALID_ID || sourceObj == pair.second))
  6694. {
  6695. if (removeFromList) {
  6696. specialList->erase(findIt);
  6697. }
  6698. return TRUE;
  6699. }
  6700. }
  6701. return FALSE;
  6702. }
  6703. #else
  6704. //-------------------------------------------------------------------------------------------------
  6705. /** Determine whether a science has been chosen */
  6706. //-------------------------------------------------------------------------------------------------
  6707. Bool ScriptEngine::isScienceAcquired( Int playerIndex, ScienceType science, Bool removeFromList )
  6708. {
  6709. if (playerIndex < 0 || playerIndex >= MAX_PLAYER_COUNT)
  6710. return FALSE;
  6711. ScienceVec* specialList = &(m_acquiredSciences[playerIndex]);
  6712. for (ScienceVec::iterator it = specialList->begin(); it != specialList->end(); ++it)
  6713. {
  6714. if (*it == science)
  6715. {
  6716. if (removeFromList)
  6717. {
  6718. specialList->erase(it);
  6719. }
  6720. return TRUE;
  6721. }
  6722. }
  6723. return FALSE;
  6724. }
  6725. #endif
  6726. //-------------------------------------------------------------------------------------------------
  6727. /** if the object has a specified topple direction, change it to direction. Otherwise add it to the
  6728. /** list. */
  6729. //-------------------------------------------------------------------------------------------------
  6730. void ScriptEngine::setToppleDirection( const AsciiString& objectName, const Coord3D *direction )
  6731. {
  6732. if (objectName.isEmpty()) {
  6733. return;
  6734. }
  6735. ListAsciiStringCoord3DIt it;
  6736. for (it = m_toppleDirections.begin(); it != m_toppleDirections.end(); ++it) {
  6737. if (it->first == objectName) {
  6738. if (direction) {
  6739. it->second = *direction;
  6740. } else {
  6741. m_toppleDirections.erase(it);
  6742. }
  6743. return;
  6744. }
  6745. }
  6746. AsciiStringCoord3DPair newPair;
  6747. newPair.first = objectName;
  6748. newPair.second = (*direction);
  6749. m_toppleDirections.push_front(newPair);
  6750. }
  6751. //-------------------------------------------------------------------------------------------------
  6752. /** if the object is named and has a specified topple direction, topple adjust direction to reflect
  6753. /** it. */
  6754. //-------------------------------------------------------------------------------------------------
  6755. void ScriptEngine::adjustToppleDirection( Object *object, Coord2D *direction)
  6756. {
  6757. if (!(object && direction)) {
  6758. return;
  6759. }
  6760. Coord3D dir;
  6761. dir.x = (*direction).x;
  6762. dir.y = (*direction).y;
  6763. adjustToppleDirection(object, &dir);
  6764. (*direction).x = dir.x;
  6765. (*direction).y = dir.y;
  6766. }
  6767. //-------------------------------------------------------------------------------------------------
  6768. /** if the object is named and has a specified topple direction, topple adjust direction to reflect
  6769. /** it. */
  6770. //-------------------------------------------------------------------------------------------------
  6771. void ScriptEngine::adjustToppleDirection( Object *object, Coord3D *direction)
  6772. {
  6773. AsciiString objName = object->getName();
  6774. if (objName.isEmpty() || !direction) {
  6775. return;
  6776. }
  6777. // this one *MAY* have a specified topple direction
  6778. ListAsciiStringCoord3DIt it;
  6779. for (it = m_toppleDirections.begin(); it != m_toppleDirections.end(); ++it) {
  6780. if (it->first == objName) {
  6781. (*direction) = it->second;
  6782. (*direction).normalize();
  6783. return;
  6784. }
  6785. }
  6786. }
  6787. //-------------------------------------------------------------------------------------------------
  6788. /** Evaluates a list of conditions */
  6789. //-------------------------------------------------------------------------------------------------
  6790. Bool ScriptEngine::evaluateConditions( Script *pScript, Team *thisTeam, Player *player )
  6791. {
  6792. LatchRestore<Team*> latch(m_callingTeam, thisTeam);
  6793. if (thisTeam) player = thisTeam->getControllingPlayer();
  6794. if (player==NULL) player=m_currentPlayer;
  6795. LatchRestore<Player*> latch2(m_currentPlayer, player);
  6796. OrCondition *pConditionHead = pScript->getOrCondition();
  6797. Bool testValue = false;
  6798. #ifdef DEBUG_LOGGING
  6799. #define COLLECT_CONDITION_EVAL_TIMES
  6800. #endif
  6801. #ifdef COLLECT_CONDITION_EVAL_TIMES
  6802. __int64 startTime64;
  6803. Real timeToEvaluate=0.0f;
  6804. __int64 endTime64,freq64;
  6805. QueryPerformanceFrequency((LARGE_INTEGER *)&freq64);
  6806. QueryPerformanceCounter((LARGE_INTEGER *)&startTime64);
  6807. #endif
  6808. OrCondition *pCurCondition;
  6809. for (pCurCondition = pConditionHead; pCurCondition; pCurCondition = pCurCondition->getNextOrCondition()) {
  6810. Condition *pCondition = pCurCondition->getFirstAndCondition();
  6811. if (!pCondition) continue; // No conditions, so go to the next or.
  6812. Bool andTerm = true;
  6813. while (pCondition && andTerm) {
  6814. if (!evaluateCondition(pCondition)) {
  6815. andTerm = false;
  6816. break; // Short circuit the and evauation - after the first false, we can quit.
  6817. }
  6818. pCondition = pCondition->getNext();
  6819. }
  6820. if (andTerm) { // The outer list is OR'ed - so any true inner means we are true.
  6821. testValue = true;
  6822. break;
  6823. }
  6824. }
  6825. #ifdef COLLECT_CONDITION_EVAL_TIMES
  6826. QueryPerformanceCounter((LARGE_INTEGER *)&endTime64);
  6827. timeToEvaluate = ((Real)(endTime64-startTime64) / (Real)(freq64));
  6828. pScript->incrementConditionCount();
  6829. pScript->addToConditionTime(timeToEvaluate);
  6830. #endif
  6831. return testValue; // If none of the or's fired, then it is false.
  6832. }
  6833. //-------------------------------------------------------------------------------------------------
  6834. /** Execute a linked list of actions */
  6835. //-------------------------------------------------------------------------------------------------
  6836. void ScriptEngine::executeActions( ScriptAction *pActionHead )
  6837. {
  6838. ScriptAction *pCurAction;
  6839. UnicodeString uStr1;
  6840. for (pCurAction = pActionHead; pCurAction; pCurAction = pCurAction->getNext()) {
  6841. switch (pCurAction->getActionType()) {
  6842. default: if (TheScriptActions) TheScriptActions->executeAction(pCurAction); break;
  6843. case ScriptAction::SET_COUNTER: setCounter(pCurAction); break;
  6844. case ScriptAction::SET_TREE_SWAY: setSway(pCurAction); break;
  6845. case ScriptAction::INCREMENT_COUNTER: addCounter(pCurAction); break;
  6846. case ScriptAction::DECREMENT_COUNTER: subCounter(pCurAction); break;
  6847. case ScriptAction::SET_FLAG: setFlag(pCurAction);break;
  6848. case ScriptAction::STOP_TIMER: pauseTimer(pCurAction);break;
  6849. case ScriptAction::RESTART_TIMER: restartTimer(pCurAction);break;
  6850. case ScriptAction::SET_TIMER: setTimer(pCurAction, false, false);break;
  6851. case ScriptAction::SET_MILLISECOND_TIMER: setTimer(pCurAction, true, false);break;
  6852. case ScriptAction::SET_RANDOM_TIMER: setTimer(pCurAction, false, true);break;
  6853. case ScriptAction::SET_RANDOM_MSEC_TIMER: setTimer(pCurAction, true, true);break;
  6854. case ScriptAction::ADD_TO_MSEC_TIMER: adjustTimer(pCurAction, true, true);break;
  6855. case ScriptAction::SUB_FROM_MSEC_TIMER: adjustTimer(pCurAction, true, false);break;
  6856. case ScriptAction::ENABLE_SCRIPT: enableScript(pCurAction);break;
  6857. case ScriptAction::DISABLE_SCRIPT: disableScript(pCurAction);break;
  6858. case ScriptAction::CALL_SUBROUTINE: callSubroutine(pCurAction);break;
  6859. // Fade operations.
  6860. case ScriptAction::CAMERA_FADE_ADD :
  6861. case ScriptAction::CAMERA_FADE_SUBTRACT :
  6862. case ScriptAction::CAMERA_FADE_SATURATE :
  6863. case ScriptAction::CAMERA_FADE_MULTIPLY :
  6864. setFade(pCurAction); break;
  6865. // Attack priority set operations.
  6866. case ScriptAction::SET_ATTACK_PRIORITY_THING : setPriorityThing(pCurAction); break;
  6867. case ScriptAction::SET_ATTACK_PRIORITY_KIND_OF : setPriorityKind(pCurAction); break;
  6868. case ScriptAction::SET_DEFAULT_ATTACK_PRIORITY : setPriorityDefault(pCurAction); break;
  6869. case ScriptAction::NO_OP: /* just break. */; break;
  6870. }
  6871. }
  6872. }
  6873. //-------------------------------------------------------------------------------------------------
  6874. /** Execute a linked list of scripts */
  6875. //-------------------------------------------------------------------------------------------------
  6876. void ScriptEngine::executeScripts( Script *pScriptHead )
  6877. {
  6878. // Evaluate the scripts.
  6879. Script *pCurScript;
  6880. for (pCurScript = pScriptHead; pCurScript; pCurScript=pCurScript->getNext()) {
  6881. if (pCurScript->isSubroutine()) {
  6882. continue; // Don't execute subroutines, except when called by other scripts.
  6883. }
  6884. executeScript(pCurScript);
  6885. }
  6886. } // end update
  6887. //-------------------------------------------------------------------------------------------------
  6888. /** Gets the ui and parameter template for a script action */
  6889. //-------------------------------------------------------------------------------------------------
  6890. const ActionTemplate * ScriptEngine::getActionTemplate( Int ndx )
  6891. {
  6892. DEBUG_ASSERTCRASH(ndx >= 0 && ndx < ScriptAction::NUM_ITEMS, ("Out of range.\n"));
  6893. if (ndx <0 || ndx >= ScriptAction::NUM_ITEMS) ndx = 0;
  6894. DEBUG_ASSERTCRASH (!m_actionTemplates[ndx].getName().isEmpty(), ("Need to initialize action enum=%d.\n", ndx));
  6895. return &m_actionTemplates[ndx];
  6896. } // end getActionTemplate
  6897. //-------------------------------------------------------------------------------------------------
  6898. /** Gets the ui and parameter template for a script condition */
  6899. //-------------------------------------------------------------------------------------------------
  6900. const ConditionTemplate * ScriptEngine::getConditionTemplate( Int ndx )
  6901. {
  6902. DEBUG_ASSERTCRASH(ndx >= 0 && ndx < ScriptAction::NUM_ITEMS, ("Out of range.\n"));
  6903. if (ndx <0 || ndx >= Condition::NUM_ITEMS) ndx = 0;
  6904. DEBUG_ASSERTCRASH (!m_conditionTemplates[ndx].getName().isEmpty(), ("Need to initialize Condition enum=%d.\n", ndx));
  6905. return &m_conditionTemplates[ndx];
  6906. } // end getConditionTemplate
  6907. //-------------------------------------------------------------------------------------------------
  6908. /** Fills the named object cache initally. */
  6909. //-------------------------------------------------------------------------------------------------
  6910. void ScriptEngine::createNamedCache( void )
  6911. {
  6912. m_namedObjects.clear();
  6913. if( !TheGameLogic )
  6914. {
  6915. return;
  6916. }
  6917. Object* pObj = TheGameLogic->getFirstObject();
  6918. while (pObj) {
  6919. if (!pObj->getName().isEmpty()) {
  6920. NamedRequest req;
  6921. req.first = pObj->getName();
  6922. req.second = pObj;
  6923. m_namedObjects.push_back(req);
  6924. }
  6925. pObj = pObj->getNextObject();
  6926. }
  6927. }
  6928. void ScriptEngine::appendSequentialScript(const SequentialScript *scriptToSequence)
  6929. {
  6930. SequentialScript *newSequentialScript = newInstance( SequentialScript );
  6931. (*newSequentialScript) = (*scriptToSequence);
  6932. // Must set this to NULL, as we don't want an infinite loop.
  6933. newSequentialScript->m_nextScriptInSequence = NULL;
  6934. // reset the instruction pointer
  6935. newSequentialScript->m_currentInstruction = -1;
  6936. VecSequentialScriptPtrIt it;
  6937. Bool found = false;
  6938. for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); ++it) {
  6939. SequentialScript *seqScript = (*it);
  6940. if (!seqScript) {
  6941. continue;
  6942. }
  6943. if ((scriptToSequence->m_objectID && scriptToSequence->m_objectID == seqScript->m_objectID) ||
  6944. (scriptToSequence->m_teamToExecOn && scriptToSequence->m_teamToExecOn == seqScript->m_teamToExecOn)) {
  6945. found = true;
  6946. while (seqScript->m_nextScriptInSequence) {
  6947. seqScript = seqScript->m_nextScriptInSequence;
  6948. }
  6949. seqScript->m_nextScriptInSequence = newSequentialScript;
  6950. break;
  6951. }
  6952. }
  6953. if (!found) {
  6954. m_sequentialScripts.push_back(newSequentialScript);
  6955. }
  6956. // do not delete either of these here.
  6957. }
  6958. void ScriptEngine::removeSequentialScript(SequentialScript *scriptToRemove)
  6959. {
  6960. }
  6961. void ScriptEngine::removeAllSequentialScripts(Object *obj)
  6962. {
  6963. if (!obj) {
  6964. return;
  6965. }
  6966. ObjectID id = obj->getID();
  6967. VecSequentialScriptPtrIt it;
  6968. for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); /* empty */) {
  6969. SequentialScript *seqScript = (*it);
  6970. if (!seqScript) {
  6971. ++it;
  6972. continue;
  6973. }
  6974. if (seqScript->m_objectID == id) {
  6975. it = cleanupSequentialScript(it, TRUE);
  6976. }
  6977. else
  6978. ++it;
  6979. }
  6980. }
  6981. void ScriptEngine::removeAllSequentialScripts(Team *team)
  6982. {
  6983. // this function will remove all pending scripts for this team, so just call it.
  6984. notifyOfTeamDestruction(team);
  6985. }
  6986. void ScriptEngine::notifyOfObjectCreationOrDestruction(void)
  6987. {
  6988. m_frameObjectCountChanged = TheGameLogic->getFrame();
  6989. }
  6990. void ScriptEngine::notifyOfTeamDestruction(Team *teamDestroyed)
  6991. {
  6992. if (!teamDestroyed) {
  6993. return;
  6994. }
  6995. VecSequentialScriptPtrIt it;
  6996. for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); /* empty */) {
  6997. SequentialScript *seqScript = (*it);
  6998. if (!seqScript) {
  6999. continue;
  7000. }
  7001. if (seqScript->m_teamToExecOn == teamDestroyed) {
  7002. it = cleanupSequentialScript(it, TRUE);
  7003. continue;
  7004. }
  7005. ++it;
  7006. }
  7007. if (m_callingTeam == teamDestroyed)
  7008. m_callingTeam = NULL;
  7009. if (m_conditionTeam == teamDestroyed)
  7010. m_conditionTeam = NULL;
  7011. }
  7012. void ScriptEngine::setSequentialTimer(Object *obj, Int frameCount)
  7013. {
  7014. if (!obj) {
  7015. return;
  7016. }
  7017. ObjectID id = obj->getID();
  7018. VecSequentialScriptPtrIt it;
  7019. for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); ++it) {
  7020. SequentialScript *seqScript = (*it);
  7021. if (!seqScript) {
  7022. continue;
  7023. }
  7024. if (seqScript->m_objectID == id) {
  7025. // this is it.
  7026. seqScript->m_framesToWait = frameCount;
  7027. return;
  7028. }
  7029. }
  7030. }
  7031. void ScriptEngine::setSequentialTimer(Team *team, Int frameCount)
  7032. {
  7033. if (!team) {
  7034. return;
  7035. }
  7036. VecSequentialScriptPtrIt it;
  7037. for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); ++it) {
  7038. SequentialScript *seqScript = (*it);
  7039. if (!seqScript) {
  7040. continue;
  7041. }
  7042. if (seqScript->m_teamToExecOn == team) {
  7043. // this is it.
  7044. seqScript->m_framesToWait = frameCount;
  7045. return;
  7046. }
  7047. }
  7048. }
  7049. void ScriptEngine::evaluateAndProgressAllSequentialScripts( void )
  7050. {
  7051. VecSequentialScriptPtrIt it, lastIt;
  7052. lastIt = m_sequentialScripts.end();
  7053. Int spinCount = 0;
  7054. for (it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); /* empty */) {
  7055. if (it == lastIt) {
  7056. ++spinCount;
  7057. } else {
  7058. spinCount = 0;
  7059. }
  7060. if (spinCount > MAX_SPIN_COUNT) {
  7061. SequentialScript *seqScript = (*it);
  7062. if (seqScript) {
  7063. DEBUG_LOG(("Sequential script %s appears to be in an infinite loop.\n",
  7064. seqScript->m_scriptToExecuteSequentially->getName().str()));
  7065. }
  7066. ++it;
  7067. continue;
  7068. }
  7069. lastIt = it;
  7070. Bool itAdvanced = false;
  7071. SequentialScript *seqScript = (*it);
  7072. if (seqScript == NULL) {
  7073. it = cleanupSequentialScript(it, false);
  7074. continue;
  7075. }
  7076. Team *team = seqScript->m_teamToExecOn;
  7077. Object *obj = TheGameLogic->findObjectByID(seqScript->m_objectID);
  7078. if (!(obj || team)) {
  7079. it = cleanupSequentialScript(it, false);
  7080. itAdvanced = true;
  7081. continue;
  7082. }
  7083. m_currentPlayer = NULL;
  7084. if (obj) {
  7085. m_currentPlayer = obj->getControllingPlayer();
  7086. } else if (team) {
  7087. m_currentPlayer = team->getControllingPlayer();
  7088. }
  7089. if (m_currentPlayer && !m_currentPlayer->isSkirmishAIPlayer()) {
  7090. m_currentPlayer = NULL;
  7091. }
  7092. AIUpdateInterface *ai = obj ? obj->getAIUpdateInterface() : NULL;
  7093. AIGroup *aigroup = (team ? TheAI->createGroup() : NULL);
  7094. if (aigroup) {
  7095. team->getTeamAsAIGroup(aigroup);
  7096. }
  7097. if( ai || aigroup ) {
  7098. if (((ai && (ai->isIdle()) || (aigroup && aigroup->isIdle())) &&
  7099. seqScript->m_framesToWait < 1) || (seqScript->m_framesToWait == 0)) {
  7100. // We want to supress messages if we're repeatedly waiting for an event to occur, cause
  7101. // it KILLS our debug framerate.
  7102. Bool displayMessage = TRUE;
  7103. // Time to progress to the next task.
  7104. if (seqScript->m_dontAdvanceInstruction) {
  7105. seqScript->m_dontAdvanceInstruction = FALSE;
  7106. displayMessage = FALSE;
  7107. } else {
  7108. ++seqScript->m_currentInstruction;
  7109. }
  7110. AsciiString msg = "Advancing SeqScript '";
  7111. msg.concat(seqScript->m_scriptToExecuteSequentially->getName());
  7112. msg.concat("' on ");
  7113. AsciiString name;
  7114. if (team) name = team->getName();
  7115. if (obj) name = obj->getName();
  7116. msg.concat(name);
  7117. msg.concat(" -- ");
  7118. int instruction = seqScript->m_currentInstruction;
  7119. ScriptAction *action = seqScript->m_scriptToExecuteSequentially->getAction();
  7120. while (action && instruction) {
  7121. --instruction;
  7122. action = action->getNext();
  7123. }
  7124. if (action) {
  7125. m_conditionTeam = team;
  7126. m_conditionObject = obj;
  7127. seqScript->m_framesToWait = -1;
  7128. // Save off the next action
  7129. ScriptAction *nextAction = action->getNext();
  7130. action->setNextAction(NULL);
  7131. if (action->getActionType() == ScriptAction::SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_ALL) {
  7132. if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(NULL, action->getParameter(1), action->getParameter(2), true)) {
  7133. seqScript->m_dontAdvanceInstruction = TRUE;
  7134. }
  7135. } else if (action->getActionType() == ScriptAction::SKIRMISH_WAIT_FOR_COMMANDBUTTON_AVAILABLE_PARTIAL) {
  7136. if (!TheScriptConditions->evaluateSkirmishCommandButtonIsReady(NULL, action->getParameter(1), action->getParameter(2), false)) {
  7137. seqScript->m_dontAdvanceInstruction = TRUE;
  7138. }
  7139. } else if (action->getActionType() == ScriptAction::TEAM_WAIT_FOR_NOT_CONTAINED_ALL) {
  7140. if (TheScriptConditions->evaluateTeamIsContained(action->getParameter(0), true)) {
  7141. seqScript->m_dontAdvanceInstruction = TRUE;
  7142. }
  7143. } else if (action->getActionType() == ScriptAction::TEAM_WAIT_FOR_NOT_CONTAINED_PARTIAL) {
  7144. if (TheScriptConditions->evaluateTeamIsContained(action->getParameter(0), false)) {
  7145. seqScript->m_dontAdvanceInstruction = TRUE;
  7146. }
  7147. } else {
  7148. executeActions(action);
  7149. }
  7150. if (displayMessage) {
  7151. msg.concat(action->getUiText());
  7152. AppendDebugMessage(msg, false);
  7153. } else {
  7154. msg.clear();
  7155. }
  7156. action->setNextAction(nextAction);
  7157. // Check to see if executing our action told us to wait. If so, skip to the next Sequential script
  7158. if (seqScript->m_dontAdvanceInstruction) {
  7159. ++it;
  7160. itAdvanced = true;
  7161. continue;
  7162. }
  7163. if (ai && ai->isIdle()) {
  7164. // pretend like we've already advanced to allow multiple checks on this object this frame.
  7165. itAdvanced = true;
  7166. } else if (team) {
  7167. // attempt to rebuild the aigroup, as it probably expired during the action execution
  7168. aigroup = (team ? TheAI->createGroup() : NULL);
  7169. team->getTeamAsAIGroup(aigroup);
  7170. }
  7171. if (aigroup && aigroup->isIdle()) {
  7172. // pretend like we've already advanced to allow multiple checks on this object this frame.
  7173. itAdvanced = true;
  7174. }
  7175. if (itAdvanced) { // check to make sure they aren't dead.
  7176. if (obj && obj->isEffectivelyDead()) {
  7177. it = cleanupSequentialScript(it, true);
  7178. continue;
  7179. }
  7180. if (aigroup && aigroup->isGroupAiDead()) {
  7181. it = cleanupSequentialScript(it, true);
  7182. continue;
  7183. }
  7184. }
  7185. } else {
  7186. if (seqScript->m_timesToLoop != 0) {
  7187. if (seqScript->m_timesToLoop != -1) {
  7188. --seqScript->m_timesToLoop;
  7189. }
  7190. seqScript->m_framesToWait = -1;
  7191. appendSequentialScript(seqScript);
  7192. }
  7193. it = cleanupSequentialScript(it, false);
  7194. itAdvanced = true;
  7195. }
  7196. } else if (seqScript->m_framesToWait > 0) {
  7197. --seqScript->m_framesToWait;
  7198. }
  7199. }
  7200. if (!itAdvanced) {
  7201. ++it;
  7202. }
  7203. }
  7204. m_currentPlayer = NULL;
  7205. }
  7206. ScriptEngine::VecSequentialScriptPtrIt ScriptEngine::cleanupSequentialScript(VecSequentialScriptPtrIt it, Bool cleanDanglers)
  7207. {
  7208. SequentialScript *seqScript;
  7209. seqScript = (*it);
  7210. if (!seqScript) {
  7211. return it;
  7212. }
  7213. SequentialScript *scriptToDelete = seqScript;
  7214. if (cleanDanglers) {
  7215. while (seqScript) {
  7216. scriptToDelete = seqScript;
  7217. seqScript = seqScript->m_nextScriptInSequence;
  7218. scriptToDelete->deleteInstance();
  7219. scriptToDelete = NULL;
  7220. }
  7221. (*it) = NULL;
  7222. } else {
  7223. // we want to make sure to not delete any dangling scripts.
  7224. (*it) = scriptToDelete->m_nextScriptInSequence;
  7225. scriptToDelete->deleteInstance();
  7226. scriptToDelete = NULL;
  7227. }
  7228. if ((*it) == NULL) {
  7229. return m_sequentialScripts.erase(it);
  7230. }
  7231. return it;
  7232. }
  7233. Bool ScriptEngine::hasUnitCompletedSequentialScript( Object *object, const AsciiString& sequentialScriptName )
  7234. {
  7235. return FALSE;
  7236. }
  7237. Bool ScriptEngine::hasTeamCompletedSequentialScript( Team *team, const AsciiString& sequentialScriptName )
  7238. {
  7239. return FALSE;
  7240. }
  7241. Bool ScriptEngine::getEnableVTune() const
  7242. {
  7243. #ifdef DO_VTUNE_STUFF
  7244. return st_EnableVTune;
  7245. #else
  7246. return false;
  7247. #endif
  7248. }
  7249. void ScriptEngine::setEnableVTune(Bool value)
  7250. {
  7251. #ifdef DO_VTUNE_STUFF
  7252. st_EnableVTune = value;
  7253. #endif
  7254. }
  7255. //----SequentialScript-----------------------------------------------------------------------------
  7256. SequentialScript::SequentialScript() : m_teamToExecOn(NULL),
  7257. m_objectID(INVALID_ID),
  7258. m_scriptToExecuteSequentially(NULL),
  7259. m_currentInstruction(START_INSTRUCTION),
  7260. m_timesToLoop(0),
  7261. m_framesToWait(-1),
  7262. m_dontAdvanceInstruction(FALSE),
  7263. m_nextScriptInSequence(NULL)
  7264. {
  7265. }
  7266. // ------------------------------------------------------------------------------------------------
  7267. /** CRC */
  7268. // ------------------------------------------------------------------------------------------------
  7269. void SequentialScript::crc( Xfer *xfer )
  7270. {
  7271. } // end crc
  7272. // ------------------------------------------------------------------------------------------------
  7273. /** Xfer Method
  7274. * Version Info:
  7275. * 1: Initial version */
  7276. // ------------------------------------------------------------------------------------------------
  7277. void SequentialScript::xfer( Xfer *xfer )
  7278. {
  7279. // version
  7280. XferVersion currentVersion = 1;
  7281. XferVersion version = currentVersion;
  7282. xfer->xferVersion( &version, currentVersion );
  7283. // team
  7284. TeamID teamID = m_teamToExecOn ? m_teamToExecOn->getID() : TEAM_ID_INVALID;
  7285. xfer->xferUser( &teamID, sizeof( TeamID ) );
  7286. if( xfer->getXferMode() == XFER_LOAD )
  7287. {
  7288. // tie up pointer
  7289. m_teamToExecOn = TheTeamFactory->findTeamByID( teamID );
  7290. // sanity
  7291. if( teamID != TEAM_ID_INVALID && m_teamToExecOn == NULL )
  7292. {
  7293. DEBUG_CRASH(( "SequentialScript::xfer - Unable to find team by ID (#%d) for m_teamToExecOn\n",
  7294. teamID ));
  7295. throw SC_INVALID_DATA;
  7296. } // end if
  7297. } // end if
  7298. // object id
  7299. xfer->xferObjectID( &m_objectID );
  7300. // saving
  7301. AsciiString scriptName;
  7302. if( xfer->getXferMode() == XFER_SAVE )
  7303. {
  7304. // write script name
  7305. scriptName = m_scriptToExecuteSequentially->getName();
  7306. xfer->xferAsciiString( &scriptName );
  7307. } // end if, save
  7308. else
  7309. {
  7310. // read script name
  7311. xfer->xferAsciiString( &scriptName );
  7312. // script pointer
  7313. DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially == NULL, ("SequentialScript::xfer - m_scripttoExecuteSequentially\n") );
  7314. // find script
  7315. m_scriptToExecuteSequentially = const_cast<Script*>(TheScriptEngine->findScriptByName(scriptName));
  7316. // sanity
  7317. DEBUG_ASSERTCRASH( m_scriptToExecuteSequentially != NULL,
  7318. ("SequentialScript::xfer - m_scriptToExecuteSequentially is NULL but should not be\n") );
  7319. } // end else, load
  7320. // current instruction
  7321. xfer->xferInt( &m_currentInstruction );
  7322. // times to loop
  7323. xfer->xferInt( &m_timesToLoop );
  7324. // frames to wait
  7325. xfer->xferInt( &m_framesToWait );
  7326. // dont advance instruction
  7327. xfer->xferBool( &m_dontAdvanceInstruction );
  7328. } // end xfer
  7329. // ------------------------------------------------------------------------------------------------
  7330. /** Load post process */
  7331. // ------------------------------------------------------------------------------------------------
  7332. void SequentialScript::loadPostProcess( void )
  7333. {
  7334. } // end loadPostProcess
  7335. #ifdef NOT_IN_USE
  7336. //----SequentialScriptStatus Stuff ----------------------------------------------------------------
  7337. // ------------------------------------------------------------------------------------------------
  7338. /** CRC */
  7339. // ------------------------------------------------------------------------------------------------
  7340. void SequentialScriptStatus::crc( Xfer *xfer )
  7341. {
  7342. } // end crc
  7343. // ------------------------------------------------------------------------------------------------
  7344. /** Xfer Method
  7345. * Version Info:
  7346. * 1: Initial version */
  7347. // ------------------------------------------------------------------------------------------------
  7348. void SequentialScriptStatus::xfer( Xfer *xfer )
  7349. {
  7350. // version
  7351. XferVersion currentVersion = 1;
  7352. XferVersion version = currentVersion;
  7353. xfer->xferVersion( &version, currentVersion );
  7354. // object id
  7355. xfer->xferObjectID( &m_objectID );
  7356. // sequential script completed
  7357. xfer->xferAsciiString( &m_sequentialScriptCompleted );
  7358. // is executing sequentially
  7359. xfer->xferBool( &m_isExecutingSequentially );
  7360. } // end xfer
  7361. // ------------------------------------------------------------------------------------------------
  7362. // Load post process */
  7363. // ------------------------------------------------------------------------------------------------
  7364. void SequentialScriptStatus::loadPostProcess( void )
  7365. {
  7366. } // end loadPostProcess
  7367. #endif
  7368. //----Particle Editor Stuff------------------------------------------------------------------------
  7369. //-------------------------------------------------------------------------------------------------
  7370. /** Updates the particle editor if its present */
  7371. //-------------------------------------------------------------------------------------------------
  7372. void ScriptEngine::particleEditorUpdate( void )
  7373. {
  7374. if (!st_ParticleDLL) {
  7375. return;
  7376. }
  7377. _updateCurrentParticleCount();
  7378. Bool busyWait = false;
  7379. do {
  7380. if (m_firstUpdate) {
  7381. _appendAllParticleSystems();
  7382. _appendAllThingTemplates();
  7383. } else {
  7384. switch (_getEditorBehavior())
  7385. {
  7386. case 0x00:
  7387. {
  7388. busyWait = false;
  7389. return;
  7390. }
  7391. case 0x01:
  7392. case 0x02:
  7393. {
  7394. _updateAndSetCurrentSystem();
  7395. busyWait = false;
  7396. break;
  7397. }
  7398. case 0x03:
  7399. {
  7400. AsciiString particleSystemName = _getParticleSystemName();
  7401. _addUpdatedParticleSystem(particleSystemName);
  7402. ParticleSystemTemplate *pTemp = const_cast<ParticleSystemTemplate*>(TheParticleSystemManager->findTemplate(particleSystemName));
  7403. if (pTemp) {
  7404. // make sure that this system is fully up to date.
  7405. _updateAsciiStringParmsToSystem(pTemp);
  7406. }
  7407. _writeOutINI();
  7408. busyWait = false;
  7409. break;
  7410. }
  7411. case 0x04:
  7412. {
  7413. AsciiString particleSystemName = _getParticleSystemName();
  7414. _reloadParticleSystemFromINI(particleSystemName);
  7415. busyWait = false;
  7416. return;
  7417. }
  7418. case 0x05:
  7419. {
  7420. int newCap = _getNewCurrentParticleCap();
  7421. if (newCap >= 0) {
  7422. TheWritableGlobalData->m_maxParticleCount = newCap;
  7423. }
  7424. busyWait = false;
  7425. }
  7426. case 0x06:
  7427. {
  7428. _reloadTextures();
  7429. busyWait = false;
  7430. break;
  7431. }
  7432. // destroy all particle systems
  7433. case 0x07:
  7434. {
  7435. TheParticleSystemManager->reset();
  7436. /*
  7437. //iterate through particle system list and remove each particle system
  7438. ParticleSystemManager::ParticleSystemList particleSysList;
  7439. ParticleSystemManager::ParticleSystemListIt it;
  7440. while (true)
  7441. {
  7442. // reassign values into variables
  7443. particleSysList = TheParticleSystemManager->getAllParticleSystems();
  7444. it = particleSysList.begin();
  7445. if (it == particleSysList.end())
  7446. break;
  7447. // check to make sure the particle system is valid
  7448. ParticleSystem *sys = (*it);
  7449. if (!sys)
  7450. continue;
  7451. //before removing the system, make sure to remove all of its particles individually
  7452. while (sys->getParticleCount() > 0) {
  7453. TheParticleSystemManager->removeParticle(sys->getFirstParticle());
  7454. sys->removeParticle(sys->getFirstParticle());
  7455. }
  7456. TheParticleSystemManager->removeParticleSystem(sys);
  7457. ++it;
  7458. }
  7459. */
  7460. //Int particleNum = TheParticleSystemManager->getParticleCount();
  7461. _updateCurrentParticleCount(); // probably don't need this...
  7462. }
  7463. case 0xFE:
  7464. {
  7465. busyWait = true;
  7466. break;
  7467. }
  7468. case 0xFF:
  7469. {
  7470. busyWait = false;
  7471. break;
  7472. }
  7473. }
  7474. }
  7475. } while (busyWait);
  7476. }
  7477. //-------------------------------------------------------------------------------------------------
  7478. /** Is time frozen by a script? */
  7479. //-------------------------------------------------------------------------------------------------
  7480. Bool ScriptEngine::isTimeFrozenScript( void )
  7481. {
  7482. return m_freezeByScript;
  7483. }
  7484. //-------------------------------------------------------------------------------------------------
  7485. /** Freeze time */
  7486. //-------------------------------------------------------------------------------------------------
  7487. void ScriptEngine::doFreezeTime( void )
  7488. {
  7489. m_freezeByScript = TRUE;
  7490. }
  7491. //-------------------------------------------------------------------------------------------------
  7492. /** Unfreeze time */
  7493. //-------------------------------------------------------------------------------------------------
  7494. void ScriptEngine::doUnfreezeTime( void )
  7495. {
  7496. m_freezeByScript = FALSE;
  7497. }
  7498. //-------------------------------------------------------------------------------------------------
  7499. /** For Debug and Internal builds, returns whether to continue (!pause), for release, returns false */
  7500. //-------------------------------------------------------------------------------------------------
  7501. Bool ScriptEngine::isTimeFrozenDebug(void)
  7502. {
  7503. typedef Bool (*funcptr)(void);
  7504. if (st_DebugDLL) {
  7505. if (st_LastCurrentFrame != st_CurrentFrame) {
  7506. st_LastCurrentFrame = st_CurrentFrame;
  7507. FARPROC proc = GetProcAddress(st_DebugDLL, "CanAppContinue");
  7508. if (proc) {
  7509. st_CanAppCont = ((funcptr)proc)();
  7510. if (st_CanAppCont) {
  7511. }
  7512. }
  7513. }
  7514. return !st_CanAppCont;
  7515. }
  7516. return false;
  7517. }
  7518. //-------------------------------------------------------------------------------------------------
  7519. /** For Debug and Internal builds, returns whether we are running fast (skipping draw) */
  7520. //-------------------------------------------------------------------------------------------------
  7521. Bool ScriptEngine::isTimeFast(void)
  7522. {
  7523. typedef Bool (*funcptr)(void);
  7524. if (st_DebugDLL) {
  7525. FARPROC proc = GetProcAddress(st_DebugDLL, "CanAppContinue");
  7526. proc = GetProcAddress(st_DebugDLL, "RunAppFast");
  7527. if (proc && ((funcptr)proc)()) {
  7528. st_AppIsFast = true;
  7529. } else {
  7530. if (st_AppIsFast) {
  7531. st_AppIsFast = false;
  7532. }
  7533. }
  7534. if (st_AppIsFast) {
  7535. if ((TheGameLogic->getFrame()%10) == 0) {
  7536. return false;
  7537. }
  7538. return true;
  7539. } else {
  7540. return false;
  7541. }
  7542. }
  7543. return false;
  7544. }
  7545. void ScriptEngine::forceUnfreezeTime(void)
  7546. {
  7547. typedef void (*funcptr)(void);
  7548. if (st_DebugDLL) {
  7549. FARPROC proc = GetProcAddress(st_DebugDLL, "ForceAppContinue");
  7550. if (proc) {
  7551. ((funcptr)proc)();
  7552. }
  7553. }
  7554. }
  7555. void ScriptEngine::AppendDebugMessage(const AsciiString& strToAdd, Bool forcePause)
  7556. {
  7557. #ifdef INTENSE_DEBUG
  7558. DEBUG_LOG(("-SCRIPT- %d %s\n", TheGameLogic->getFrame(), strToAdd.str()));
  7559. #endif
  7560. typedef void (*funcptr)(const char*);
  7561. if (!st_DebugDLL) {
  7562. return;
  7563. }
  7564. FARPROC proc;
  7565. if (forcePause) {
  7566. proc = GetProcAddress(st_DebugDLL, "AppendMessageAndPause");
  7567. } else {
  7568. proc = GetProcAddress(st_DebugDLL, "AppendMessage");
  7569. }
  7570. if (!proc) {
  7571. return;
  7572. }
  7573. AsciiString msg;
  7574. msg.format("%d ", TheGameLogic->getFrame());
  7575. msg.concat(strToAdd);
  7576. ((funcptr)proc)(msg.str());
  7577. }
  7578. void ScriptEngine::AdjustDebugVariableData(const AsciiString& variableName, Int value, Bool forcePause)
  7579. {
  7580. _adjustVariable(variableName, value, (forcePause != 0));
  7581. }
  7582. // ------------------------------------------------------------------------------------------------
  7583. /** CRC */
  7584. // ------------------------------------------------------------------------------------------------
  7585. void ScriptEngine::crc( Xfer *xfer )
  7586. {
  7587. } // end crc
  7588. // ------------------------------------------------------------------------------------------------
  7589. /** Version Info:
  7590. * 1: Initial version */
  7591. // ------------------------------------------------------------------------------------------------
  7592. static void xferListAsciiString( Xfer *xfer, ListAsciiString *list )
  7593. {
  7594. // sanity
  7595. DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiString - Invalid parameters\n") );
  7596. // version
  7597. XferVersion currentVersion = 1;
  7598. XferVersion version = currentVersion;
  7599. xfer->xferVersion( &version, currentVersion );
  7600. // size of list
  7601. UnsignedShort count = list->size();
  7602. xfer->xferUnsignedShort( &count );
  7603. // list data
  7604. AsciiString string;
  7605. if( xfer->getXferMode() == XFER_SAVE )
  7606. {
  7607. // write each string
  7608. ListAsciiStringIt it;
  7609. for( it = list->begin(); it != list->end(); ++it )
  7610. {
  7611. string = *it;
  7612. xfer->xferAsciiString( &string );
  7613. } // end for, it
  7614. } // end if, save
  7615. else
  7616. {
  7617. // this list should be empty upon loading
  7618. if( list->empty() == FALSE )
  7619. {
  7620. DEBUG_CRASH(( "xferListAsciiString - list should be empty upon loading but is not\n" ));
  7621. throw SC_INVALID_DATA;
  7622. } // end if
  7623. // read each string
  7624. for( UnsignedShort i = 0; i < count; ++i )
  7625. {
  7626. // read string
  7627. xfer->xferAsciiString( &string );
  7628. // put on list
  7629. list->push_back( string );
  7630. } // end for, i
  7631. } // end else, load
  7632. } // end xferListAsciiString
  7633. // ------------------------------------------------------------------------------------------------
  7634. /** Version Info:
  7635. * 1: Initial version */
  7636. // ------------------------------------------------------------------------------------------------
  7637. static void xferListAsciiStringUINT( Xfer *xfer, ListAsciiStringUINT *list )
  7638. {
  7639. // sanity
  7640. DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringUINT - Invalid parameters\n") );
  7641. // version
  7642. XferVersion currentVersion = 1;
  7643. XferVersion version = currentVersion;
  7644. xfer->xferVersion( &version, currentVersion );
  7645. // size of list
  7646. UnsignedShort count = list->size();
  7647. xfer->xferUnsignedShort( &count );
  7648. // list data
  7649. AsciiString string;
  7650. UnsignedInt unsignedIntData;
  7651. if( xfer->getXferMode() == XFER_SAVE )
  7652. {
  7653. // write each string
  7654. ListAsciiStringUINTIt it;
  7655. for( it = list->begin(); it != list->end(); ++it )
  7656. {
  7657. // string
  7658. string = it->first;
  7659. xfer->xferAsciiString( &string );
  7660. // unsigned int data
  7661. unsignedIntData = it->second;
  7662. xfer->xferUnsignedInt( &unsignedIntData );
  7663. } // end for, it
  7664. } // end if, save
  7665. else
  7666. {
  7667. PairAsciiStringUINT newPair;
  7668. // this list should be empty upon loading
  7669. if( list->empty() == FALSE )
  7670. {
  7671. DEBUG_CRASH(( "xferListAsciiStringUINT - list should be empty upon loading but is not\n" ));
  7672. throw SC_INVALID_DATA;
  7673. } // end if
  7674. // read each string
  7675. for( UnsignedShort i = 0; i < count; ++i )
  7676. {
  7677. // read string
  7678. xfer->xferAsciiString( &string );
  7679. // read unsigned int data
  7680. xfer->xferUnsignedInt( &unsignedIntData );
  7681. // put on list
  7682. newPair.first = string;
  7683. newPair.second = unsignedIntData;
  7684. list->push_back( newPair );
  7685. } // end for, i
  7686. } // end else, load
  7687. } // end xferListAsciiStringUINT
  7688. // ------------------------------------------------------------------------------------------------
  7689. /** Version Info:
  7690. * 1: Initial version */
  7691. // ------------------------------------------------------------------------------------------------
  7692. static void xferListAsciiStringObjectID( Xfer *xfer, ListAsciiStringObjectID *list )
  7693. {
  7694. // sanity
  7695. DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringObjectID - Invalid parameters\n") );
  7696. // version
  7697. XferVersion currentVersion = 1;
  7698. XferVersion version = currentVersion;
  7699. xfer->xferVersion( &version, currentVersion );
  7700. // size of list
  7701. UnsignedShort count = list->size();
  7702. xfer->xferUnsignedShort( &count );
  7703. // list data
  7704. AsciiString string;
  7705. ObjectID objectID;
  7706. if( xfer->getXferMode() == XFER_SAVE )
  7707. {
  7708. // write each string
  7709. ListAsciiStringObjectIDIt it;
  7710. for( it = list->begin(); it != list->end(); ++it )
  7711. {
  7712. // string
  7713. string = it->first;
  7714. xfer->xferAsciiString( &string );
  7715. // object id
  7716. objectID = it->second;
  7717. xfer->xferObjectID( &objectID );
  7718. } // end for, it
  7719. } // end if, save
  7720. else
  7721. {
  7722. AsciiStringObjectIDPair newPair;
  7723. // this list should be empty upon loading
  7724. if( list->empty() == FALSE )
  7725. {
  7726. DEBUG_CRASH(( "xferListAsciiStringObjectID - list should be empty upon loading but is not\n" ));
  7727. throw SC_INVALID_DATA;
  7728. } // end if
  7729. // read each string
  7730. for( UnsignedShort i = 0; i < count; ++i )
  7731. {
  7732. // read string
  7733. xfer->xferAsciiString( &string );
  7734. // read object id data
  7735. xfer->xferObjectID( &objectID );
  7736. // put on list
  7737. newPair.first = string;
  7738. newPair.second = objectID;
  7739. list->push_back( newPair );
  7740. } // end for, i
  7741. } // end else, load
  7742. } // end xferListAsciiStringObjectID
  7743. // ------------------------------------------------------------------------------------------------
  7744. /** Version Info:
  7745. * 1: Initial version */
  7746. // ------------------------------------------------------------------------------------------------
  7747. static void xferListAsciiStringCoord3D( Xfer *xfer, ListAsciiStringCoord3D *list )
  7748. {
  7749. // sanity
  7750. DEBUG_ASSERTCRASH( list != NULL, ("xferListAsciiStringCoord3D - Invalid parameters\n") );
  7751. // version
  7752. XferVersion currentVersion = 1;
  7753. XferVersion version = currentVersion;
  7754. xfer->xferVersion( &version, currentVersion );
  7755. // size of list
  7756. UnsignedShort count = list->size();
  7757. xfer->xferUnsignedShort( &count );
  7758. // list data
  7759. AsciiString string;
  7760. Coord3D coord;
  7761. if( xfer->getXferMode() == XFER_SAVE )
  7762. {
  7763. // write each string
  7764. ListAsciiStringCoord3DIt it;
  7765. for( it = list->begin(); it != list->end(); ++it )
  7766. {
  7767. // string
  7768. string = it->first;
  7769. xfer->xferAsciiString( &string );
  7770. // coord
  7771. coord = it->second;
  7772. xfer->xferCoord3D( &coord );
  7773. } // end for, it
  7774. } // end if, save
  7775. else
  7776. {
  7777. AsciiStringCoord3DPair newPair;
  7778. // this list should be empty upon loading
  7779. if( list->empty() == FALSE )
  7780. {
  7781. DEBUG_CRASH(( "xferListAsciiStringCoord3D - list should be empty upon loading but is not\n" ));
  7782. throw SC_INVALID_DATA;
  7783. } // end if
  7784. // read each string
  7785. for( UnsignedShort i = 0; i < count; ++i )
  7786. {
  7787. // read string
  7788. xfer->xferAsciiString( &string );
  7789. // read coord
  7790. xfer->xferCoord3D( &coord );
  7791. // put on list
  7792. newPair.first = string;
  7793. newPair.second = coord;
  7794. list->push_back( newPair );
  7795. } // end for, i
  7796. } // end else, load
  7797. } // ene xferListAsciiStringCoord3D
  7798. // ------------------------------------------------------------------------------------------------
  7799. // ------------------------------------------------------------------------------------------------
  7800. void ScriptEngine::setGlobalDifficulty( GameDifficulty difficulty )
  7801. {
  7802. DEBUG_LOG(("ScriptEngine::setGlobalDifficulty(%d)\n", ((Int)difficulty)));
  7803. m_gameDifficulty = difficulty;
  7804. }
  7805. // ------------------------------------------------------------------------------------------------
  7806. /** Xfer method
  7807. * Version Info:
  7808. * 1: Initial version
  7809. * 2: Added m_namedReveals and m_allObjectTypeLists (CBD)
  7810. * 3: Added m_objectsShouldReceiveDifficultyBonus (JKMCD)
  7811. * 4: current music track info
  7812. * 5: add ChooseVictimAlwaysUsesNormal
  7813. */
  7814. // ------------------------------------------------------------------------------------------------
  7815. void ScriptEngine::xfer( Xfer *xfer )
  7816. {
  7817. Int i;
  7818. // version
  7819. const XferVersion currentVersion = 5;
  7820. XferVersion version = currentVersion;
  7821. xfer->xferVersion( &version, currentVersion );
  7822. // sequential script count and data
  7823. UnsignedShort sequentialScriptCount = m_sequentialScripts.size();
  7824. xfer->xferUnsignedShort( &sequentialScriptCount );
  7825. SequentialScript *sequentialScript;
  7826. if( xfer->getXferMode() == XFER_SAVE )
  7827. {
  7828. // save each element
  7829. VecSequentialScriptPtrIt it;
  7830. for( it = m_sequentialScripts.begin(); it != m_sequentialScripts.end(); ++it )
  7831. {
  7832. // get data
  7833. sequentialScript = *it;
  7834. // xfer data
  7835. xfer->xferSnapshot( sequentialScript );
  7836. } // end for, it
  7837. } // end if, save
  7838. else
  7839. {
  7840. // this list should be empty on loading
  7841. if( m_sequentialScripts.size() != 0 )
  7842. {
  7843. DEBUG_CRASH(( "ScriptEngine::xfer - m_sequentialScripts should be empty but is not\n" ));
  7844. throw SC_INVALID_DATA;
  7845. } // end if
  7846. // read each entry
  7847. for( UnsignedShort i = 0; i < sequentialScriptCount; ++i )
  7848. {
  7849. // allocate new sequential script and put on our list
  7850. sequentialScript = newInstance( SequentialScript );
  7851. // tie to our list
  7852. m_sequentialScripts.push_back( sequentialScript );
  7853. // xfer data
  7854. xfer->xferSnapshot( sequentialScript );
  7855. } // end for i
  7856. } // end else, load
  7857. // counters
  7858. UnsignedShort countersSize = m_numCounters;
  7859. xfer->xferUnsignedShort( &countersSize );
  7860. if( countersSize > MAX_COUNTERS )
  7861. {
  7862. DEBUG_CRASH(( "ScriptEngine::xfer - MAX_COUNTERS has changed size, need to version this\n" ));
  7863. throw SC_INVALID_DATA;
  7864. } // end if
  7865. for( i = 0; i < countersSize; ++i )
  7866. {
  7867. // value
  7868. xfer->xferInt( &m_counters[ i ].value );
  7869. // name
  7870. xfer->xferAsciiString( &m_counters[ i ].name );
  7871. // countdown timer
  7872. xfer->xferBool( &m_counters[ i ].isCountdownTimer );
  7873. } // end for, i
  7874. // num counters
  7875. xfer->xferInt( &m_numCounters );
  7876. // flags
  7877. UnsignedShort flagsSize = m_numFlags;
  7878. xfer->xferUnsignedShort( &flagsSize );
  7879. if( flagsSize > MAX_FLAGS )
  7880. {
  7881. DEBUG_CRASH(( "ScriptEngine::xfer - MAX_FLAGS has changed size, need to version this\n" ));
  7882. throw SC_INVALID_DATA;
  7883. } // end if
  7884. for( i = 0; i < flagsSize; ++i )
  7885. {
  7886. // value
  7887. xfer->xferBool( &m_flags[ i ].value );
  7888. // name
  7889. xfer->xferAsciiString( &m_flags[ i ].name );
  7890. } // end for i
  7891. // num flags
  7892. xfer->xferInt( &m_numFlags );
  7893. // attack priority info
  7894. UnsignedShort attackPriorityInfoSize = m_numAttackInfo;
  7895. xfer->xferUnsignedShort( &attackPriorityInfoSize );
  7896. if( attackPriorityInfoSize > MAX_ATTACK_PRIORITIES )
  7897. {
  7898. DEBUG_CRASH(( "ScriptEngine::xfer - MAX_ATTACK_PRIORITIES size has changed, need to version this\n" ));
  7899. throw SC_INVALID_DATA;
  7900. } // end if
  7901. for( i = 0; i < attackPriorityInfoSize; ++i )
  7902. {
  7903. // xfer each data
  7904. xfer->xferSnapshot( &m_attackPriorityInfo[ i ] );
  7905. } // end for i
  7906. // num attack info
  7907. xfer->xferInt( &m_numAttackInfo );
  7908. // end game timers
  7909. xfer->xferInt( &m_endGameTimer );
  7910. xfer->xferInt( &m_closeWindowTimer );
  7911. // named objects
  7912. UnsignedShort namedObjectsCount = m_namedObjects.size();
  7913. xfer->xferUnsignedShort( &namedObjectsCount );
  7914. AsciiString namedObjectName;
  7915. Object *obj;
  7916. ObjectID objectID;
  7917. if( xfer->getXferMode() == XFER_SAVE )
  7918. {
  7919. // iterate elemnts
  7920. VecNamedRequestsIt it;
  7921. for( it = m_namedObjects.begin(); it != m_namedObjects.end(); ++it )
  7922. {
  7923. // write name
  7924. namedObjectName = it->first;
  7925. xfer->xferAsciiString( &namedObjectName );
  7926. // write object id (note that object may be NULL)
  7927. obj = it->second;
  7928. objectID = obj ? obj->getID() : INVALID_ID;
  7929. xfer->xferObjectID( &objectID );
  7930. } // end for i
  7931. } // end if, save
  7932. else
  7933. {
  7934. NamedRequest req;
  7935. //
  7936. // list should be empty, it is legal for it to not be empty at this point
  7937. // according to John M., so we're clearing it now
  7938. //
  7939. m_namedObjects.clear();
  7940. // read each element
  7941. for( UnsignedShort i = 0; i < namedObjectsCount; ++i )
  7942. {
  7943. // read name
  7944. xfer->xferAsciiString( &namedObjectName );
  7945. // read object id and turn into object pointer
  7946. xfer->xferObjectID( &objectID );
  7947. obj = TheGameLogic->findObjectByID( objectID );
  7948. if( obj == NULL && objectID != INVALID_ID )
  7949. {
  7950. DEBUG_CRASH(( "ScriptEngine::xfer - Unable to find object by ID for m_namedObjects\n" ));
  7951. throw SC_INVALID_DATA;
  7952. } // end if
  7953. // assign
  7954. req.first = namedObjectName;
  7955. req.second = obj;
  7956. m_namedObjects.push_back( req );
  7957. } // end for, i
  7958. } // end else, load
  7959. // first update
  7960. xfer->xferBool( &m_firstUpdate );
  7961. // trade (this needs a better descriptive name (CBD)
  7962. xfer->xferUser( &m_fade, sizeof( TFade ) );
  7963. // min fade
  7964. xfer->xferReal( &m_minFade );
  7965. // max fade
  7966. xfer->xferReal( &m_maxFade );
  7967. // curr fade value
  7968. xfer->xferReal( &m_curFadeValue );
  7969. // current fade frame
  7970. xfer->xferInt( &m_curFadeFrame );
  7971. // fade frames increase
  7972. xfer->xferInt( &m_fadeFramesIncrease );
  7973. // fade frames hold
  7974. xfer->xferInt( &m_fadeFramesHold );
  7975. // fade frames decrease
  7976. xfer->xferInt( &m_fadeFramesDecrease );
  7977. // complete video
  7978. xferListAsciiString( xfer, &m_completedVideo );
  7979. // testing speech
  7980. xferListAsciiStringUINT( xfer, &m_testingSpeech );
  7981. // testing audio
  7982. xferListAsciiStringUINT( xfer, &m_testingAudio );
  7983. // ui interactions
  7984. xferListAsciiString( xfer, &m_uiInteractions );
  7985. // triggered special powers
  7986. UnsignedShort triggeredSpecialPowersSize = MAX_PLAYER_COUNT;
  7987. xfer->xferUnsignedShort( &triggeredSpecialPowersSize );
  7988. if( triggeredSpecialPowersSize != MAX_PLAYER_COUNT )
  7989. {
  7990. DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_triggeredSpecialPowers size is now different and we must version this\n" ));
  7991. throw SC_INVALID_DATA;
  7992. } // end if
  7993. for( i = 0; i < triggeredSpecialPowersSize; ++i )
  7994. xferListAsciiStringObjectID( xfer, &m_triggeredSpecialPowers[ i ] );
  7995. // midway special powers
  7996. UnsignedShort midwaySpecialPowersSize = MAX_PLAYER_COUNT;
  7997. xfer->xferUnsignedShort( &midwaySpecialPowersSize );
  7998. if( midwaySpecialPowersSize != MAX_PLAYER_COUNT )
  7999. {
  8000. DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_midwaySpecialPowers size is now different and we must version this\n" ));
  8001. throw SC_INVALID_DATA;
  8002. } // end if
  8003. for( i = 0; i < midwaySpecialPowersSize; ++i )
  8004. xferListAsciiStringObjectID( xfer, &m_midwaySpecialPowers[ i ] );
  8005. // finished special powers
  8006. UnsignedShort finishedSpecialPowersSize = MAX_PLAYER_COUNT;
  8007. xfer->xferUnsignedShort( &finishedSpecialPowersSize );
  8008. if( finishedSpecialPowersSize != MAX_PLAYER_COUNT )
  8009. {
  8010. DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_finishedSpecialPowers size is now different and we must version this\n" ));
  8011. throw SC_INVALID_DATA;
  8012. } // end if
  8013. for( i = 0; i < finishedSpecialPowersSize; ++i )
  8014. xferListAsciiStringObjectID( xfer, &m_finishedSpecialPowers[ i ] );
  8015. // completed upgrades
  8016. UnsignedShort completedUpgradesSize = MAX_PLAYER_COUNT;
  8017. xfer->xferUnsignedShort( &completedUpgradesSize );
  8018. if( completedUpgradesSize != MAX_PLAYER_COUNT )
  8019. {
  8020. DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_completedUpgrades size is now different and we must version this\n" ));
  8021. throw SC_INVALID_DATA;
  8022. } // end if
  8023. for( i = 0; i < completedUpgradesSize; ++i )
  8024. xferListAsciiStringObjectID( xfer, &m_completedUpgrades[ i ] );
  8025. // acquired sciences
  8026. UnsignedShort acquiredSciencesSize = MAX_PLAYER_COUNT;
  8027. xfer->xferUnsignedShort( &acquiredSciencesSize );
  8028. if( acquiredSciencesSize != MAX_PLAYER_COUNT )
  8029. {
  8030. DEBUG_CRASH(( "ScriptEngine::xfer - MAX_PLAYER_COUNT has changed, m_acquiredSciences size is now different and we must version this\n" ));
  8031. throw SC_INVALID_DATA;
  8032. } // end if
  8033. for( i = 0; i < acquiredSciencesSize; ++i )
  8034. xfer->xferScienceVec( &m_acquiredSciences[ i ] );
  8035. // topple directions
  8036. xferListAsciiStringCoord3D( xfer, &m_toppleDirections );
  8037. // breeze info
  8038. xfer->xferReal( &m_breezeInfo.m_direction );
  8039. xfer->xferReal( &m_breezeInfo.m_directionVec.x );
  8040. xfer->xferReal( &m_breezeInfo.m_directionVec.y );
  8041. xfer->xferReal( &m_breezeInfo.m_intensity );
  8042. xfer->xferReal( &m_breezeInfo.m_lean );
  8043. xfer->xferReal( &m_breezeInfo.m_randomness );
  8044. xfer->xferShort( &m_breezeInfo.m_breezePeriod );
  8045. xfer->xferShort( &m_breezeInfo.m_breezeVersion );
  8046. // game difficulty
  8047. xfer->xferUser( &m_gameDifficulty, sizeof( GameDifficulty ) );
  8048. // freeze by script
  8049. xfer->xferBool( &m_freezeByScript );
  8050. // version 2
  8051. if( version >= 2 )
  8052. {
  8053. // number of entries in named reveals
  8054. UnsignedShort namedRevealCount = m_namedReveals.size();
  8055. xfer->xferUnsignedShort( &namedRevealCount );
  8056. // named reveal data
  8057. if( xfer->getXferMode() == XFER_SAVE )
  8058. {
  8059. // iterate vector
  8060. VecNamedRevealIt it;
  8061. for( it = m_namedReveals.begin(); it != m_namedReveals.end(); ++it )
  8062. {
  8063. // name
  8064. xfer->xferAsciiString( &it->m_revealName );
  8065. // waypoint name
  8066. xfer->xferAsciiString( &it->m_waypointName );
  8067. // radius
  8068. xfer->xferReal( &it->m_radiusToReveal );
  8069. // player name
  8070. xfer->xferAsciiString( &it->m_playerName );
  8071. } // end for, it
  8072. } // end if, save
  8073. else
  8074. {
  8075. // the vector should be emtpy now
  8076. if( m_namedReveals.empty() == FALSE )
  8077. {
  8078. DEBUG_CRASH(( "ScriptEngine::xfer - m_namedReveals should be empty but is not!\n" ));
  8079. throw SC_INVALID_DATA;
  8080. } // end if
  8081. // read all entries
  8082. NamedReveal reveal;
  8083. for( UnsignedShort i = 0; i < namedRevealCount; ++i )
  8084. {
  8085. // read name
  8086. xfer->xferAsciiString( &reveal.m_revealName );
  8087. // read waypoint name
  8088. xfer->xferAsciiString( &reveal.m_waypointName );
  8089. // read radius
  8090. xfer->xferReal( &reveal.m_radiusToReveal );
  8091. // read player name
  8092. xfer->xferAsciiString( &reveal.m_playerName );
  8093. // put on list
  8094. m_namedReveals.push_back( reveal );
  8095. } // end for, i
  8096. } // end else, load
  8097. // all object type lists size
  8098. UnsignedShort allObjectTypesCount = m_allObjectTypeLists.size();
  8099. xfer->xferUnsignedShort( &allObjectTypesCount );
  8100. // all object type lists data
  8101. if( xfer->getXferMode() == XFER_SAVE )
  8102. {
  8103. // iterate list
  8104. AllObjectTypesIt it;
  8105. ObjectTypes *objectTypes;
  8106. for( it = m_allObjectTypeLists.begin(); it != m_allObjectTypeLists.end(); ++it )
  8107. {
  8108. // get object types from iterator
  8109. objectTypes = *it;
  8110. // save object types
  8111. xfer->xferSnapshot( objectTypes );
  8112. } // end for, it
  8113. } // end if, save
  8114. else
  8115. {
  8116. // sanity, the list should be empty now
  8117. if( m_allObjectTypeLists.empty() == FALSE )
  8118. {
  8119. DEBUG_CRASH(( "ScriptEngine::xfer - m_allObjectTypeLists should be empty but is not!\n" ));
  8120. throw SC_INVALID_DATA;
  8121. } // end if
  8122. // read all data
  8123. ObjectTypes *objectTypes;
  8124. for( UnsignedShort i = 0; i < allObjectTypesCount; ++i )
  8125. {
  8126. // allocate a new object types
  8127. objectTypes = newInstance( ObjectTypes );
  8128. // xfer object types data
  8129. xfer->xferSnapshot( objectTypes );
  8130. // put on list
  8131. m_allObjectTypeLists.push_back( objectTypes );
  8132. } // end for, i
  8133. } // end else, load
  8134. } // end if, version 2
  8135. if (version >= 3) {
  8136. xfer->xferBool(&m_objectsShouldReceiveDifficultyBonus);
  8137. } else {
  8138. m_objectsShouldReceiveDifficultyBonus = TRUE;
  8139. }
  8140. if (version >= 4)
  8141. {
  8142. xfer->xferAsciiString(&m_currentTrackName);
  8143. }
  8144. if (version >= 5)
  8145. {
  8146. xfer->xferBool(&m_ChooseVictimAlwaysUsesNormal);
  8147. }
  8148. else
  8149. {
  8150. m_ChooseVictimAlwaysUsesNormal = false;
  8151. }
  8152. if( xfer->getXferMode() == XFER_LOAD ) {
  8153. // We are doing a load. If there is no fade active, do a black fade in to start.
  8154. if (m_fade == FADE_NONE) {
  8155. m_fade = FADE_MULTIPLY; //default to a fade in from black.
  8156. m_curFadeFrame = 0;
  8157. m_minFade = 1.0f;
  8158. m_maxFade = 0.0f;
  8159. m_fadeFramesIncrease = 0;
  8160. m_fadeFramesHold = 0;
  8161. m_fadeFramesDecrease = FRAMES_TO_FADE_IN_AT_START;
  8162. m_curFadeValue = 0.0f;
  8163. }
  8164. }
  8165. } // end xfer
  8166. // ------------------------------------------------------------------------------------------------
  8167. /** Load post process */
  8168. // ------------------------------------------------------------------------------------------------
  8169. void ScriptEngine::loadPostProcess( void )
  8170. {
  8171. // Now that we've loaded everything, go through and set them all back in sync with what we
  8172. // currently think they should be.
  8173. TheScriptActions->doEnableOrDisableObjectDifficultyBonuses(m_objectsShouldReceiveDifficultyBonus);
  8174. if (m_currentTrackName.isNotEmpty())
  8175. {
  8176. AudioEventRTS event(m_currentTrackName);
  8177. event.setPlayerIndex(ThePlayerList->getLocalPlayer()->getPlayerIndex());
  8178. TheAudio->addAudioEvent(&event);
  8179. }
  8180. } // end loadPostProcess
  8181. //#if defined(_DEBUG) || defined(_INTERNAL)
  8182. void ScriptEngine::debugVictory( void )
  8183. {
  8184. ScriptAction *action = newInstance(ScriptAction)(ScriptAction::VICTORY);
  8185. TheScriptActions->executeAction(action);
  8186. }
  8187. //#endif
  8188. Bool ScriptEngine::hasShownMPLocalDefeatWindow(void)
  8189. {
  8190. return m_shownMPLocalDefeatWindow;
  8191. }
  8192. void ScriptEngine::markMPLocalDefeatWindowShown(void)
  8193. {
  8194. m_shownMPLocalDefeatWindow = TRUE;
  8195. }
  8196. // ------------------------------------------------------------------------------------------------
  8197. /** Misc helper functions (ParticleEdit, etc) */
  8198. // ------------------------------------------------------------------------------------------------
  8199. void _appendMessage(const AsciiString& str, Bool isTrueMessage, Bool shouldPause)
  8200. {
  8201. typedef void (*funcptr)(const char*);
  8202. AsciiString msg;
  8203. msg.format("%d ", TheGameLogic->getFrame());
  8204. if (isTrueMessage) {
  8205. msg.concat("Run script - ");
  8206. } else {
  8207. msg.concat("Run script false -");
  8208. }
  8209. msg.concat(str);
  8210. #ifdef INTENSE_DEBUG
  8211. DEBUG_LOG(("-SCRIPT- %s\n", msg.str()));
  8212. #endif
  8213. if (!st_DebugDLL) {
  8214. return;
  8215. }
  8216. FARPROC proc;
  8217. if (shouldPause) {
  8218. proc = GetProcAddress(st_DebugDLL, "AppendMessageAndPause");
  8219. } else {
  8220. proc = GetProcAddress(st_DebugDLL, "AppendMessage");
  8221. }
  8222. if (!proc) {
  8223. return;
  8224. }
  8225. ((funcptr)proc)(msg.str());
  8226. }
  8227. void _adjustVariable(const AsciiString& str, Int value, Bool shouldPause)
  8228. {
  8229. typedef void (*funcptr)(const char*, const char*);
  8230. if (!st_DebugDLL) {
  8231. return;
  8232. }
  8233. FARPROC proc;
  8234. if (shouldPause) {
  8235. proc = GetProcAddress(st_DebugDLL, "AdjustVariableAndPause");
  8236. } else {
  8237. proc = GetProcAddress(st_DebugDLL, "AdjustVariable");
  8238. }
  8239. if (!proc) {
  8240. return;
  8241. }
  8242. char buff[12]; // for sprintf
  8243. sprintf(buff, "%d", value);
  8244. ((funcptr)proc)(str.str(), buff);
  8245. }
  8246. void _updateFrameNumber( void )
  8247. {
  8248. if (TheScriptEngine->isTimeFast()) return;
  8249. typedef void (*funcptr)(int);
  8250. if (!st_DebugDLL) {
  8251. return;
  8252. }
  8253. FARPROC proc;
  8254. proc = GetProcAddress(st_DebugDLL, "SetFrameNumber");
  8255. if (!proc) {
  8256. return;
  8257. }
  8258. UnsignedInt frameNum = TheGameLogic->getFrame();
  8259. ((funcptr)proc)(frameNum);
  8260. }
  8261. void _appendAllParticleSystems( void )
  8262. {
  8263. typedef void (*funcptr)(const char*);
  8264. if (!st_ParticleDLL) {
  8265. return;
  8266. }
  8267. FARPROC proc;
  8268. proc = GetProcAddress(st_ParticleDLL, "RemoveAllParticleSystems");
  8269. if (proc) {
  8270. proc();
  8271. } else {
  8272. return;
  8273. }
  8274. proc = GetProcAddress(st_ParticleDLL, "AppendParticleSystem");
  8275. if (!proc) {
  8276. return;
  8277. }
  8278. // Copy just the names for the list of particle system templates
  8279. ParticleSystemManager::TemplateMap::iterator begin(TheParticleSystemManager->beginParticleSystemTemplate());
  8280. ParticleSystemManager::TemplateMap::iterator end(TheParticleSystemManager->endParticleSystemTemplate());
  8281. for (; begin != end; ++begin) {
  8282. ((funcptr)proc)((*begin).first.str());
  8283. }
  8284. }
  8285. // all ThingTemplates can be thrown with a particle system, so...
  8286. void _appendAllThingTemplates( void )
  8287. {
  8288. typedef void (*funcptr)(const char*);
  8289. if (!st_ParticleDLL) {
  8290. return;
  8291. }
  8292. FARPROC proc;
  8293. proc = GetProcAddress(st_ParticleDLL, "RemoveAllThingTemplates");
  8294. if (proc) {
  8295. proc();
  8296. } else {
  8297. return;
  8298. }
  8299. proc = GetProcAddress(st_ParticleDLL, "AppendThingTemplate");
  8300. if (!proc) {
  8301. return;
  8302. }
  8303. const ThingTemplate *pTemplate = TheThingFactory->firstTemplate();
  8304. while (pTemplate) {
  8305. ((funcptr)proc)(pTemplate->getName().str());
  8306. pTemplate = pTemplate->friend_getNextTemplate();
  8307. }
  8308. }
  8309. void _addUpdatedParticleSystem( AsciiString particleSystemName )
  8310. {
  8311. typedef void (*funcptr)(const char*);
  8312. typedef void (*funcptr2)(ParticleSystemTemplate*);
  8313. if (!st_ParticleDLL) {
  8314. return;
  8315. }
  8316. if (TheParticleSystemManager->findTemplate(particleSystemName)) {
  8317. return;
  8318. }
  8319. FARPROC proc, proc2;
  8320. proc = GetProcAddress(st_ParticleDLL, "AppendParticleSystem");
  8321. if (!proc) {
  8322. return;
  8323. }
  8324. proc2 = GetProcAddress(st_ParticleDLL, "UpdateSystemUseParameters");
  8325. if (!proc2) {
  8326. return;
  8327. }
  8328. ParticleSystemTemplate *pTemplate = TheParticleSystemManager->newTemplate(particleSystemName);
  8329. if (!pTemplate) {
  8330. return;
  8331. }
  8332. ((funcptr)proc)(pTemplate->getName().str());
  8333. ((funcptr2)proc2)(pTemplate);
  8334. }
  8335. AsciiString _getParticleSystemName( void )
  8336. {
  8337. typedef void (*funcptr)(char*);
  8338. if (!st_ParticleDLL) {
  8339. return AsciiString::TheEmptyString;
  8340. }
  8341. FARPROC proc;
  8342. proc = GetProcAddress(st_ParticleDLL, "GetSelectedParticleSystemName");
  8343. if (!proc) {
  8344. return AsciiString::TheEmptyString;
  8345. }
  8346. static char buff[1024];
  8347. ((funcptr) proc)(buff);
  8348. return AsciiString(buff);
  8349. }
  8350. void _updatePanelParameters( ParticleSystemTemplate *particleTemplate )
  8351. {
  8352. typedef void (*funcptr)(ParticleSystemTemplate*);
  8353. if (!st_ParticleDLL) {
  8354. return;
  8355. }
  8356. FARPROC proc;
  8357. proc = GetProcAddress(st_ParticleDLL, "UpdateCurrentParticleSystem");
  8358. if (!proc) {
  8359. return;
  8360. }
  8361. ((funcptr) proc)(particleTemplate);
  8362. }
  8363. void _updateAsciiStringParmsToSystem( ParticleSystemTemplate *particleTemplate )
  8364. {
  8365. typedef void (*funcptr)(int, char*, ParticleSystemTemplate **);
  8366. if (!st_ParticleDLL || !particleTemplate) {
  8367. return;
  8368. }
  8369. FARPROC proc;
  8370. proc = GetProcAddress(st_ParticleDLL, "GetSelectedParticleAsciiStringParm");
  8371. if (!proc) {
  8372. return;
  8373. }
  8374. char buff[ARBITRARY_BUFF_SIZE];
  8375. ParticleSystemTemplate* otherTemp;
  8376. ((funcptr) proc)(0, buff, &otherTemp); // PARM_ParticleTypeName
  8377. if (otherTemp == particleTemplate) {
  8378. particleTemplate->m_particleTypeName.set(buff);
  8379. }
  8380. ((funcptr) proc)(1, buff, &otherTemp); // PARM_SlaveSystemName
  8381. if (otherTemp == particleTemplate) {
  8382. particleTemplate->m_slaveSystemName.set(buff);
  8383. }
  8384. ((funcptr) proc)(2, buff, &otherTemp); // PARM_AttachedSystemName
  8385. if (otherTemp == particleTemplate) {
  8386. particleTemplate->m_attachedSystemName.set(buff);
  8387. }
  8388. }
  8389. extern void _updateAsciiStringParmsFromSystem( ParticleSystemTemplate *particleTemplate )
  8390. {
  8391. typedef void (*funcptr)(int, const char*, ParticleSystemTemplate**);
  8392. if (!st_ParticleDLL || !particleTemplate) {
  8393. return;
  8394. }
  8395. FARPROC proc;
  8396. proc = GetProcAddress(st_ParticleDLL, "UpdateParticleAsciiStringParm");
  8397. if (!proc) {
  8398. return;
  8399. }
  8400. ((funcptr) proc)(0, particleTemplate->m_particleTypeName.str(), NULL); // PARM_ParticleTypeName
  8401. ((funcptr) proc)(1, particleTemplate->m_slaveSystemName.str(), NULL); // PARM_SlaveSystemName
  8402. ((funcptr) proc)(2, particleTemplate->m_attachedSystemName.str(), NULL); // PARM_AttachedSystemName
  8403. }
  8404. #define BACKUP_FILE_NAME "Data\\INI\\ParticleSystem"
  8405. #define BACKUP_EXT "BAK"
  8406. static void _writeOutINI( void )
  8407. {
  8408. // currently, this uses NO intelligence. It blindly iterates through all of the
  8409. // particle system templates and writes out every field that it thinks it should.
  8410. const int maxFileLength = 128;
  8411. char buff[maxFileLength];
  8412. File *saveFile = NULL;
  8413. int i = 0;
  8414. do {
  8415. if (saveFile) {
  8416. saveFile->close();
  8417. saveFile = NULL;
  8418. }
  8419. sprintf(buff, "%s%d.%s", BACKUP_FILE_NAME, i, BACKUP_EXT);
  8420. saveFile = TheFileSystem->openFile(buff, File::READ | File::TEXT);
  8421. ++i;
  8422. } while (saveFile);
  8423. saveFile = TheFileSystem->openFile(buff, File::WRITE | File::TEXT);
  8424. if (!saveFile) {
  8425. return;
  8426. }
  8427. // save the old file
  8428. File *oldINI = TheFileSystem->openFile("Data\\INI\\ParticleSystem.ini", File::READ | File::TEXT);
  8429. if (oldINI) {
  8430. char singleChar;
  8431. while (oldINI->position() != oldINI->size()) {
  8432. oldINI->read(&singleChar, 1);
  8433. saveFile->write(&singleChar, 1);
  8434. }
  8435. oldINI->close();
  8436. oldINI = NULL;
  8437. saveFile->close();
  8438. saveFile = NULL;
  8439. }
  8440. // open the .ini file for writing, truncate.
  8441. File *newINI = TheFileSystem->openFile("Data\\INI\\ParticleSystem.ini", File::WRITE | File::TEXT);
  8442. if (!newINI) {
  8443. DEBUG_CRASH(("Unable to open ParticleSystem.ini. Is it write protected?"));
  8444. return;
  8445. }
  8446. ParticleSystemManager::TemplateMap::iterator begin(TheParticleSystemManager->beginParticleSystemTemplate());
  8447. ParticleSystemManager::TemplateMap::iterator end(TheParticleSystemManager->endParticleSystemTemplate());
  8448. for (; begin != end; ++begin) {
  8449. _writeSingleParticleSystem(newINI, (*begin).second);
  8450. }
  8451. newINI->close();
  8452. newINI = NULL;
  8453. }
  8454. static const std::string HEADER = "ParticleSystem";
  8455. static const std::string SEP_SPACE = " ";
  8456. static const std::string SEP_HEAD = " ";
  8457. static const std::string SEP_EOL = "\n";
  8458. static const std::string SEP_TAB = "\t";
  8459. static const std::string STR_TRUE = "Yes";
  8460. static const std::string STR_FALSE = "No";
  8461. static const std::string EQ_WITH_SPACES = " = ";
  8462. static const std::string STR_R = "R:";
  8463. static const std::string STR_G = "G:";
  8464. static const std::string STR_B = "B:";
  8465. static const std::string STR_X = "X:";
  8466. static const std::string STR_Y = "Y:";
  8467. static const std::string STR_Z = "Z:";
  8468. static const std::string STR_END = "End";
  8469. static const std::string F_PRIORITY = "Priority";
  8470. static const std::string F_ISONESHOT = "IsOneShot";
  8471. static const std::string F_SHADER = "Shader";
  8472. static const std::string F_TYPE = "Type";
  8473. static const std::string F_PARTICLENAME = "ParticleName";
  8474. static const std::string F_ANGLEX = "AngleX";
  8475. static const std::string F_ANGLEY = "AngleY";
  8476. static const std::string F_ANGLEZ = "AngleZ";
  8477. static const std::string F_ANGLERATEX = "AngularRateX";
  8478. static const std::string F_ANGLERATEY = "AngularRateY";
  8479. static const std::string F_ANGLERATEZ = "AngularRateZ";
  8480. static const std::string F_ANGLEDAMP = "AngularDamping";
  8481. static const std::string F_VELOCITYDAMP = "VelocityDamping";
  8482. static const std::string F_GRAVITY = "Gravity";
  8483. static const std::string F_SLAVESYSTEM = "SlaveSystem";
  8484. static const std::string F_SLAVEPOS = "SlavePosOffset";
  8485. static const std::string F_ATTACHED = "PerParticleAttachedSystem";
  8486. static const std::string F_LIFETIME = "Lifetime";
  8487. static const std::string F_SYSLIFETIME = "SystemLifetime";
  8488. static const std::string F_SIZE = "Size";
  8489. static const std::string F_STARTSIZERATE ="StartSizeRate";
  8490. static const std::string F_SIZERATE = "SizeRate";
  8491. static const std::string F_SIZERATEDAMP = "SizeRateDamping";
  8492. static const std::string F_ALPHA1 = "Alpha1";
  8493. static const std::string F_ALPHA2 = "Alpha2";
  8494. static const std::string F_ALPHA3 = "Alpha3";
  8495. static const std::string F_ALPHA4 = "Alpha4";
  8496. static const std::string F_ALPHA5 = "Alpha5";
  8497. static const std::string F_ALPHA6 = "Alpha6";
  8498. static const std::string F_ALPHA7 = "Alpha7";
  8499. static const std::string F_ALPHA8 = "Alpha8";
  8500. static const std::string F_COLOR1 = "Color1";
  8501. static const std::string F_COLOR2 = "Color2";
  8502. static const std::string F_COLOR3 = "Color3";
  8503. static const std::string F_COLOR4 = "Color4";
  8504. static const std::string F_COLOR5 = "Color5";
  8505. static const std::string F_COLOR6 = "Color6";
  8506. static const std::string F_COLOR7 = "Color7";
  8507. static const std::string F_COLOR8 = "Color8";
  8508. static const std::string F_COLORSCALE = "ColorScale";
  8509. static const std::string F_BURSTDELAY = "BurstDelay";
  8510. static const std::string F_BURSTCOUNT = "BurstCount";
  8511. static const std::string F_INITIALDELAY = "InitialDelay";
  8512. static const std::string F_DRIFTVELOCITY ="DriftVelocity";
  8513. static const std::string F_VELOCITYTYPE = "VelocityType";
  8514. static const std::string F_VELORTHOX = "VelOrthoX";
  8515. static const std::string F_VELORTHOY = "VelOrthoY";
  8516. static const std::string F_VELORTHOZ = "VelOrthoZ";
  8517. static const std::string F_VELSPHERE = "VelSpherical";
  8518. static const std::string F_HEMISPHERE = "VelHemispherical";
  8519. static const std::string F_VELCYLRAD = "VelCylindricalRadial";
  8520. static const std::string F_VELCYLNOR = "VelCylindricalNormal";
  8521. static const std::string F_VELOUTWARD = "VelOutward";
  8522. static const std::string F_VELOUTOTHER = "VelOutwardOther";
  8523. static const std::string F_VOLUMETYPE = "VolumeType";
  8524. static const std::string F_VOLLINESTART = "VolLineStart";
  8525. static const std::string F_VOLLINEEND = "VolLineEnd";
  8526. static const std::string F_VOLBOXHALF = "VolBoxHalfSize";
  8527. static const std::string F_VOLSPHERERAD = "VolSphereRadius";
  8528. static const std::string F_VOLCYLRAD = "VolCylinderRadius";
  8529. static const std::string F_VOLCYLLEN = "VolCylinderLength";
  8530. static const std::string F_ISHOLLOW = "IsHollow";
  8531. static const std::string F_ISXYPLANAR = "IsGroundAligned";
  8532. static const std::string F_ISEMITABOVEGROUNDONLY
  8533. = "IsEmitAboveGroundOnly";
  8534. static const std::string F_ISPARTICLEUPTOWARDSEMITTER
  8535. = "IsParticleUpTowardsEmitter";
  8536. static const std::string F_WINDMOTION = "WindMotion";
  8537. static const std::string F_WINDANGLECHANGEMIN = "WindAngleChangeMin";
  8538. static const std::string F_WINDANGLECHANGEMAX = "WindAngleChangeMax";
  8539. static const std::string F_WINDPINGPONGSTARTANGLEMIN = "WindPingPongStartAngleMin";
  8540. static const std::string F_WINDPINGPONGSTARTANGLEMAX = "WindPingPongStartAngleMax";
  8541. static const std::string F_WINDPINGPONGENDANGLEMIN = "WindPingPongEndAngleMin";
  8542. static const std::string F_WINDPINGPONGENDANGLEMAX = "WindPingPongEndAngleMax";
  8543. void _writeSingleParticleSystem( File *out, ParticleSystemTemplate *templ )
  8544. {
  8545. if (!templ || !out || templ->getName().isEmpty()) {
  8546. // sanity
  8547. return;
  8548. }
  8549. static char buff1[ARBITRARY_BUFF_SIZE];
  8550. static char buff2[ARBITRARY_BUFF_SIZE];
  8551. static char buff3[ARBITRARY_BUFF_SIZE];
  8552. static char buff4[ARBITRARY_BUFF_SIZE];
  8553. // the .append looks REALLY ugly, but this code was written with streams in mind, and so
  8554. // these were all originally << (feed-operator for streams)
  8555. // I might come back and re-write this later, if there are enough complaints. ;-) jkmcd
  8556. // in the meantime, move along...
  8557. std::string thisEntry = "";
  8558. thisEntry.append(HEADER).append(SEP_SPACE).append(templ->getName().str()).append(SEP_EOL);
  8559. thisEntry.append(SEP_HEAD).append(F_PRIORITY).append(EQ_WITH_SPACES).append(ParticlePriorityNames[templ->m_priority]).append(SEP_EOL);
  8560. thisEntry.append(SEP_HEAD).append(F_ISONESHOT).append(EQ_WITH_SPACES).append((templ->m_isOneShot ? STR_TRUE : STR_FALSE)).append(SEP_EOL);
  8561. thisEntry.append(SEP_HEAD).append(F_SHADER).append(EQ_WITH_SPACES).append(ParticleShaderTypeNames[templ->m_shaderType]).append(SEP_EOL);
  8562. thisEntry.append(SEP_HEAD).append(F_TYPE).append(EQ_WITH_SPACES).append(ParticleTypeNames[templ->m_particleType]).append(SEP_EOL);
  8563. thisEntry.append(SEP_HEAD).append(F_PARTICLENAME).append(EQ_WITH_SPACES).append(templ->m_particleTypeName.str()).append(SEP_EOL);
  8564. sprintf(buff1, FORMAT_STRING, templ->m_angleZ.getMinimumValue());
  8565. sprintf(buff2, FORMAT_STRING, templ->m_angleZ.getMaximumValue());
  8566. thisEntry.append(SEP_HEAD).append(F_ANGLEZ).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8567. sprintf(buff1, FORMAT_STRING, templ->m_angularRateZ.getMinimumValue());
  8568. sprintf(buff2, FORMAT_STRING, templ->m_angularRateZ.getMaximumValue());
  8569. thisEntry.append(SEP_HEAD).append(F_ANGLERATEZ).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8570. sprintf(buff1, FORMAT_STRING, templ->m_angularDamping.getMinimumValue());
  8571. sprintf(buff2, FORMAT_STRING, templ->m_angularDamping.getMaximumValue());
  8572. thisEntry.append(SEP_HEAD).append(F_ANGLEDAMP).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8573. sprintf(buff1, FORMAT_STRING, templ->m_velDamping.getMinimumValue());
  8574. sprintf(buff2, FORMAT_STRING, templ->m_velDamping.getMaximumValue());
  8575. thisEntry.append(SEP_HEAD).append(F_VELOCITYDAMP).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8576. sprintf(buff1, FORMAT_STRING, templ->m_gravity);
  8577. thisEntry.append(SEP_HEAD).append(F_GRAVITY).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8578. if (!templ->m_slaveSystemName.isEmpty()) {
  8579. thisEntry.append(SEP_HEAD).append(F_SLAVESYSTEM).append(EQ_WITH_SPACES).append(templ->m_slaveSystemName.str()).append(SEP_EOL);
  8580. sprintf(buff1, FORMAT_STRING_LEADING_STRING, STR_X.c_str(), templ->m_slavePosOffset.x);
  8581. sprintf(buff2, FORMAT_STRING_LEADING_STRING, STR_Y.c_str(), templ->m_slavePosOffset.y);
  8582. sprintf(buff3, FORMAT_STRING_LEADING_STRING, STR_Z.c_str(), templ->m_slavePosOffset.z);
  8583. thisEntry.append(SEP_HEAD).append(F_SLAVEPOS).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8584. }
  8585. if (!templ->m_attachedSystemName.isEmpty()) {
  8586. thisEntry.append(SEP_HEAD).append(F_ATTACHED).append(EQ_WITH_SPACES).append(templ->m_attachedSystemName.str()).append(SEP_EOL);
  8587. }
  8588. sprintf(buff1, FORMAT_STRING, templ->m_lifetime.getMinimumValue());
  8589. sprintf(buff2, FORMAT_STRING, templ->m_lifetime.getMaximumValue());
  8590. thisEntry.append(SEP_HEAD).append(F_LIFETIME).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8591. sprintf(buff1, "%d", templ->m_systemLifetime);
  8592. thisEntry.append(SEP_HEAD).append(F_SYSLIFETIME).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8593. sprintf(buff1, FORMAT_STRING, templ->m_startSize.getMinimumValue());
  8594. sprintf(buff2, FORMAT_STRING, templ->m_startSize.getMaximumValue());
  8595. thisEntry.append(SEP_HEAD).append(F_SIZE).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8596. sprintf(buff1, FORMAT_STRING, templ->m_startSizeRate.getMinimumValue());
  8597. sprintf(buff2, FORMAT_STRING, templ->m_startSizeRate.getMaximumValue());
  8598. thisEntry.append(SEP_HEAD).append(F_STARTSIZERATE).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8599. sprintf(buff1, FORMAT_STRING, templ->m_sizeRate.getMinimumValue());
  8600. sprintf(buff2, FORMAT_STRING, templ->m_sizeRate.getMaximumValue());
  8601. thisEntry.append(SEP_HEAD).append(F_SIZERATE).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8602. sprintf(buff1, FORMAT_STRING, templ->m_sizeRateDamping.getMinimumValue());
  8603. sprintf(buff2, FORMAT_STRING, templ->m_sizeRateDamping.getMaximumValue());
  8604. thisEntry.append(SEP_HEAD).append(F_SIZERATEDAMP).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8605. sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[0].var.getMinimumValue());
  8606. sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[0].var.getMaximumValue());
  8607. sprintf(buff3, "%d", templ->m_alphaKey[0].frame);
  8608. thisEntry.append(SEP_HEAD).append(F_ALPHA1).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8609. sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[1].var.getMinimumValue());
  8610. sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[1].var.getMaximumValue());
  8611. sprintf(buff3, "%d", templ->m_alphaKey[1].frame);
  8612. thisEntry.append(SEP_HEAD).append(F_ALPHA2).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8613. sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[2].var.getMinimumValue());
  8614. sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[2].var.getMaximumValue());
  8615. sprintf(buff3, "%d", templ->m_alphaKey[2].frame);
  8616. thisEntry.append(SEP_HEAD).append(F_ALPHA3).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8617. sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[3].var.getMinimumValue());
  8618. sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[3].var.getMaximumValue());
  8619. sprintf(buff3, "%d", templ->m_alphaKey[3].frame);
  8620. thisEntry.append(SEP_HEAD).append(F_ALPHA4).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8621. sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[4].var.getMinimumValue());
  8622. sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[4].var.getMaximumValue());
  8623. sprintf(buff3, "%d", templ->m_alphaKey[4].frame);
  8624. thisEntry.append(SEP_HEAD).append(F_ALPHA5).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8625. sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[5].var.getMinimumValue());
  8626. sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[5].var.getMaximumValue());
  8627. sprintf(buff3, "%d", templ->m_alphaKey[5].frame);
  8628. thisEntry.append(SEP_HEAD).append(F_ALPHA6).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8629. sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[6].var.getMinimumValue());
  8630. sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[6].var.getMaximumValue());
  8631. sprintf(buff3, "%d", templ->m_alphaKey[6].frame);
  8632. thisEntry.append(SEP_HEAD).append(F_ALPHA7).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8633. sprintf(buff1, FORMAT_STRING, templ->m_alphaKey[7].var.getMinimumValue());
  8634. sprintf(buff2, FORMAT_STRING, templ->m_alphaKey[7].var.getMaximumValue());
  8635. sprintf(buff3, "%d", templ->m_alphaKey[7].frame);
  8636. thisEntry.append(SEP_HEAD).append(F_ALPHA8).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8637. sprintf(buff1, "%s%d", STR_R.c_str(), REAL_TO_INT(templ->m_colorKey[0].color.red * 255 + 0.5));
  8638. sprintf(buff2, "%s%d", STR_G.c_str(), REAL_TO_INT(templ->m_colorKey[0].color.green * 255 + 0.5));
  8639. sprintf(buff3, "%s%d", STR_B.c_str(), REAL_TO_INT(templ->m_colorKey[0].color.blue * 255 + 0.5));
  8640. sprintf(buff4, "%d", templ->m_colorKey[0].frame);
  8641. thisEntry.append(SEP_HEAD).append(F_COLOR1).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_SPACE).append(buff4).append(SEP_EOL);
  8642. sprintf(buff1, "%s%d", STR_R.c_str(), REAL_TO_INT(templ->m_colorKey[1].color.red * 255 + 0.5));
  8643. sprintf(buff2, "%s%d", STR_G.c_str(), REAL_TO_INT(templ->m_colorKey[1].color.green * 255 + 0.5));
  8644. sprintf(buff3, "%s%d", STR_B.c_str(), REAL_TO_INT(templ->m_colorKey[1].color.blue * 255 + 0.5));
  8645. sprintf(buff4, "%d", templ->m_colorKey[1].frame);
  8646. thisEntry.append(SEP_HEAD).append(F_COLOR2).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_SPACE).append(buff4).append(SEP_EOL);
  8647. sprintf(buff1, "%s%d", STR_R.c_str(), REAL_TO_INT(templ->m_colorKey[2].color.red * 255 + 0.5));
  8648. sprintf(buff2, "%s%d", STR_G.c_str(), REAL_TO_INT(templ->m_colorKey[2].color.green * 255 + 0.5));
  8649. sprintf(buff3, "%s%d", STR_B.c_str(), REAL_TO_INT(templ->m_colorKey[2].color.blue * 255 + 0.5));
  8650. sprintf(buff4, "%d", templ->m_colorKey[2].frame);
  8651. thisEntry.append(SEP_HEAD).append(F_COLOR3).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_SPACE).append(buff4).append(SEP_EOL);
  8652. sprintf(buff1, "%s%d", STR_R.c_str(), REAL_TO_INT(templ->m_colorKey[3].color.red * 255 + 0.5));
  8653. sprintf(buff2, "%s%d", STR_G.c_str(), REAL_TO_INT(templ->m_colorKey[3].color.green * 255 + 0.5));
  8654. sprintf(buff3, "%s%d", STR_B.c_str(), REAL_TO_INT(templ->m_colorKey[3].color.blue * 255 + 0.5));
  8655. sprintf(buff4, "%d", templ->m_colorKey[3].frame);
  8656. thisEntry.append(SEP_HEAD).append(F_COLOR4).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_SPACE).append(buff4).append(SEP_EOL);
  8657. sprintf(buff1, "%s%d", STR_R.c_str(), REAL_TO_INT(templ->m_colorKey[4].color.red * 255 + 0.5));
  8658. sprintf(buff2, "%s%d", STR_G.c_str(), REAL_TO_INT(templ->m_colorKey[4].color.green * 255 + 0.5));
  8659. sprintf(buff3, "%s%d", STR_B.c_str(), REAL_TO_INT(templ->m_colorKey[4].color.blue * 255 + 0.5));
  8660. sprintf(buff4, "%d", templ->m_colorKey[4].frame);
  8661. thisEntry.append(SEP_HEAD).append(F_COLOR5).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_SPACE).append(buff4).append(SEP_EOL);
  8662. sprintf(buff1, "%s%d", STR_R.c_str(), REAL_TO_INT(templ->m_colorKey[5].color.red * 255 + 0.5));
  8663. sprintf(buff2, "%s%d", STR_G.c_str(), REAL_TO_INT(templ->m_colorKey[5].color.green * 255 + 0.5));
  8664. sprintf(buff3, "%s%d", STR_B.c_str(), REAL_TO_INT(templ->m_colorKey[5].color.blue * 255 + 0.5));
  8665. sprintf(buff4, "%d", templ->m_colorKey[5].frame);
  8666. thisEntry.append(SEP_HEAD).append(F_COLOR6).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_SPACE).append(buff4).append(SEP_EOL);
  8667. sprintf(buff1, "%s%d", STR_R.c_str(), REAL_TO_INT(templ->m_colorKey[6].color.red * 255 + 0.5));
  8668. sprintf(buff2, "%s%d", STR_G.c_str(), REAL_TO_INT(templ->m_colorKey[6].color.green * 255 + 0.5));
  8669. sprintf(buff3, "%s%d", STR_B.c_str(), REAL_TO_INT(templ->m_colorKey[6].color.blue * 255 + 0.5));
  8670. sprintf(buff4, "%d", templ->m_colorKey[6].frame);
  8671. thisEntry.append(SEP_HEAD).append(F_COLOR7).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_SPACE).append(buff4).append(SEP_EOL);
  8672. sprintf(buff1, "%s%d", STR_R.c_str(), REAL_TO_INT(templ->m_colorKey[7].color.red * 255 + 0.5));
  8673. sprintf(buff2, "%s%d", STR_G.c_str(), REAL_TO_INT(templ->m_colorKey[7].color.green * 255 + 0.5));
  8674. sprintf(buff3, "%s%d", STR_B.c_str(), REAL_TO_INT(templ->m_colorKey[7].color.blue * 255 + 0.5));
  8675. sprintf(buff4, "%d", templ->m_colorKey[7].frame);
  8676. thisEntry.append(SEP_HEAD).append(F_COLOR8).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_SPACE).append(buff4).append(SEP_EOL);
  8677. sprintf(buff1, FORMAT_STRING, templ->m_colorScale.getMinimumValue());
  8678. sprintf(buff2, FORMAT_STRING, templ->m_colorScale.getMaximumValue());
  8679. thisEntry.append(SEP_HEAD).append(F_COLORSCALE).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8680. sprintf(buff1, FORMAT_STRING, templ->m_burstDelay.getMinimumValue());
  8681. sprintf(buff2, FORMAT_STRING, templ->m_burstDelay.getMaximumValue());
  8682. thisEntry.append(SEP_HEAD).append(F_BURSTDELAY).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8683. sprintf(buff1, FORMAT_STRING, templ->m_burstCount.getMinimumValue());
  8684. sprintf(buff2, FORMAT_STRING, templ->m_burstCount.getMaximumValue());
  8685. thisEntry.append(SEP_HEAD).append(F_BURSTCOUNT).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8686. sprintf(buff1, FORMAT_STRING, templ->m_initialDelay.getMinimumValue());
  8687. sprintf(buff2, FORMAT_STRING, templ->m_initialDelay.getMaximumValue());
  8688. thisEntry.append(SEP_HEAD).append(F_INITIALDELAY).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8689. sprintf(buff1, FORMAT_STRING_LEADING_STRING, STR_X.c_str(), templ->m_driftVelocity.x);
  8690. sprintf(buff2, FORMAT_STRING_LEADING_STRING, STR_Y.c_str(), templ->m_driftVelocity.y);
  8691. sprintf(buff3, FORMAT_STRING_LEADING_STRING, STR_Z.c_str(), templ->m_driftVelocity.z);
  8692. thisEntry.append(SEP_HEAD).append(F_DRIFTVELOCITY).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8693. thisEntry.append(SEP_HEAD).append(F_VELOCITYTYPE).append(EQ_WITH_SPACES).append(EmissionVelocityTypeNames[templ->m_emissionVelocityType]).append(SEP_EOL);
  8694. if (templ->m_emissionVelocityType == ParticleSystemInfo::ORTHO) {
  8695. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.ortho.x.getMinimumValue());
  8696. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.ortho.x.getMaximumValue());
  8697. thisEntry.append(SEP_HEAD).append(F_VELORTHOX).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8698. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.ortho.y.getMinimumValue());
  8699. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.ortho.y.getMaximumValue());
  8700. thisEntry.append(SEP_HEAD).append(F_VELORTHOY).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8701. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.ortho.z.getMinimumValue());
  8702. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.ortho.z.getMaximumValue());
  8703. thisEntry.append(SEP_HEAD).append(F_VELORTHOZ).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8704. } else if (templ->m_emissionVelocityType == ParticleSystemInfo::SPHERICAL) {
  8705. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.spherical.speed.getMinimumValue());
  8706. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.spherical.speed.getMaximumValue());
  8707. thisEntry.append(SEP_HEAD).append(F_VELSPHERE).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8708. } else if (templ->m_emissionVelocityType == ParticleSystemInfo::HEMISPHERICAL) {
  8709. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.hemispherical.speed.getMinimumValue());
  8710. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.hemispherical.speed.getMaximumValue());
  8711. thisEntry.append(SEP_HEAD).append(F_HEMISPHERE).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8712. } else if (templ->m_emissionVelocityType == ParticleSystemInfo::CYLINDRICAL) {
  8713. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.cylindrical.radial.getMinimumValue());
  8714. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.cylindrical.radial.getMaximumValue());
  8715. thisEntry.append(SEP_HEAD).append(F_VELCYLRAD).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8716. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.cylindrical.normal.getMinimumValue());
  8717. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.cylindrical.normal.getMaximumValue());
  8718. thisEntry.append(SEP_HEAD).append(F_VELCYLNOR).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8719. } else if (templ->m_emissionVelocityType == ParticleSystemInfo::OUTWARD) {
  8720. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.outward.speed.getMinimumValue());
  8721. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.outward.speed.getMaximumValue());
  8722. thisEntry.append(SEP_HEAD).append(F_VELOUTWARD).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8723. sprintf(buff1, FORMAT_STRING, templ->m_emissionVelocity.outward.otherSpeed.getMinimumValue());
  8724. sprintf(buff2, FORMAT_STRING, templ->m_emissionVelocity.outward.otherSpeed.getMaximumValue());
  8725. thisEntry.append(SEP_HEAD).append(F_VELOUTOTHER).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_EOL);
  8726. }
  8727. thisEntry.append(SEP_HEAD).append(F_VOLUMETYPE).append(EQ_WITH_SPACES).append(EmissionVolumeTypeNames[templ->m_emissionVolumeType]).append(SEP_EOL);
  8728. if (templ->m_emissionVolumeType == ParticleSystemInfo::POINT) {
  8729. // nothing to output here for lines
  8730. } else if (templ->m_emissionVolumeType == ParticleSystemInfo::LINE) {
  8731. sprintf(buff1, FORMAT_STRING_LEADING_STRING, STR_X.c_str(), templ->m_emissionVolume.line.start.x);
  8732. sprintf(buff2, FORMAT_STRING_LEADING_STRING, STR_Y.c_str(), templ->m_emissionVolume.line.start.y);
  8733. sprintf(buff3, FORMAT_STRING_LEADING_STRING, STR_Z.c_str(), templ->m_emissionVolume.line.start.z);
  8734. thisEntry.append(SEP_HEAD).append(F_VOLLINESTART).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8735. sprintf(buff1, FORMAT_STRING_LEADING_STRING, STR_X.c_str(), templ->m_emissionVolume.line.end.x);
  8736. sprintf(buff2, FORMAT_STRING_LEADING_STRING, STR_Y.c_str(), templ->m_emissionVolume.line.end.y);
  8737. sprintf(buff3, FORMAT_STRING_LEADING_STRING, STR_Z.c_str(), templ->m_emissionVolume.line.end.z);
  8738. thisEntry.append(SEP_HEAD).append(F_VOLLINEEND).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8739. } else if (templ->m_emissionVolumeType == ParticleSystemInfo::BOX) {
  8740. sprintf(buff1, FORMAT_STRING_LEADING_STRING, STR_X.c_str(), templ->m_emissionVolume.box.halfSize.x);
  8741. sprintf(buff2, FORMAT_STRING_LEADING_STRING, STR_Y.c_str(), templ->m_emissionVolume.box.halfSize.y);
  8742. sprintf(buff3, FORMAT_STRING_LEADING_STRING, STR_Z.c_str(), templ->m_emissionVolume.box.halfSize.z);
  8743. thisEntry.append(SEP_HEAD).append(F_VOLBOXHALF).append(EQ_WITH_SPACES).append(buff1).append(SEP_SPACE).append(buff2).append(SEP_SPACE).append(buff3).append(SEP_EOL);
  8744. } else if (templ->m_emissionVolumeType == ParticleSystemInfo::SPHERE) {
  8745. sprintf(buff1, FORMAT_STRING, templ->m_emissionVolume.sphere.radius);
  8746. thisEntry.append(SEP_HEAD).append(F_VOLSPHERERAD).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8747. } else if (templ->m_emissionVolumeType == ParticleSystemInfo::CYLINDER) {
  8748. sprintf(buff1, FORMAT_STRING, templ->m_emissionVolume.cylinder.radius);
  8749. thisEntry.append(SEP_HEAD).append(F_VOLCYLRAD).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8750. sprintf(buff1, FORMAT_STRING, templ->m_emissionVolume.cylinder.length);
  8751. thisEntry.append(SEP_HEAD).append(F_VOLCYLLEN).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8752. }
  8753. thisEntry.append(SEP_HEAD).append(F_ISHOLLOW).append(EQ_WITH_SPACES).append((templ->m_isEmissionVolumeHollow ? STR_TRUE : STR_FALSE)).append(SEP_EOL);
  8754. thisEntry.append(SEP_HEAD).append(F_ISXYPLANAR).append(EQ_WITH_SPACES).append((templ->m_isGroundAligned ? STR_TRUE : STR_FALSE)).append(SEP_EOL);
  8755. thisEntry.append(SEP_HEAD).append(F_ISEMITABOVEGROUNDONLY).append(EQ_WITH_SPACES).append((templ->m_isEmitAboveGroundOnly ? STR_TRUE : STR_FALSE)).append(SEP_EOL);
  8756. thisEntry.append(SEP_HEAD).append(F_ISPARTICLEUPTOWARDSEMITTER).append(EQ_WITH_SPACES).append((templ->m_isParticleUpTowardsEmitter ? STR_TRUE : STR_FALSE)).append(SEP_EOL);
  8757. // wind angle and stuff
  8758. thisEntry.append(SEP_HEAD).append(F_WINDMOTION).append(EQ_WITH_SPACES).append(WindMotionNames[templ->m_windMotion]).append(SEP_EOL);
  8759. sprintf( buff1, "%f", templ->m_windAngleChangeMin );
  8760. thisEntry.append(SEP_HEAD).append(F_WINDANGLECHANGEMIN).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8761. sprintf( buff1, "%f", templ->m_windAngleChangeMax );
  8762. thisEntry.append(SEP_HEAD).append(F_WINDANGLECHANGEMAX).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8763. sprintf( buff1, "%f", templ->m_windMotionStartAngleMin );
  8764. thisEntry.append(SEP_HEAD).append(F_WINDPINGPONGSTARTANGLEMIN).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8765. sprintf( buff1, "%f", templ->m_windMotionStartAngleMax );
  8766. thisEntry.append(SEP_HEAD).append(F_WINDPINGPONGSTARTANGLEMAX).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8767. sprintf( buff1, "%f", templ->m_windMotionEndAngleMin );
  8768. thisEntry.append(SEP_HEAD).append(F_WINDPINGPONGENDANGLEMIN).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8769. sprintf( buff1, "%f", templ->m_windMotionEndAngleMax );
  8770. thisEntry.append(SEP_HEAD).append(F_WINDPINGPONGENDANGLEMAX).append(EQ_WITH_SPACES).append(buff1).append(SEP_EOL);
  8771. thisEntry.append(STR_END).append(SEP_EOL).append(SEP_EOL);
  8772. // fwrite(thisEntry.c_str(), thisEntry.size(), 1, out);
  8773. out->write(thisEntry.c_str(), thisEntry.size());
  8774. }
  8775. static int _getEditorBehavior( void )
  8776. {
  8777. typedef int (*funcptr)( void );
  8778. if (!st_ParticleDLL) {
  8779. return 0x00;
  8780. }
  8781. FARPROC proc;
  8782. proc = GetProcAddress(st_ParticleDLL, "NextParticleEditorBehavior");
  8783. if (!proc) {
  8784. return 0x00;
  8785. }
  8786. return ((funcptr)proc)();
  8787. }
  8788. static void _updateAndSetCurrentSystem( void )
  8789. {
  8790. AsciiString particleSystemName = _getParticleSystemName();
  8791. _addUpdatedParticleSystem(particleSystemName);
  8792. ParticleSystemTemplate *pTemp = const_cast<ParticleSystemTemplate*>(TheParticleSystemManager->findTemplate(particleSystemName));
  8793. if (pTemp) {
  8794. _updateAsciiStringParmsToSystem(pTemp);
  8795. _updateAsciiStringParmsFromSystem(pTemp);
  8796. _updatePanelParameters(pTemp);
  8797. if( st_particleSystemNeedsStopping )
  8798. {
  8799. st_particleSystem->stop();
  8800. st_particleSystem->destroy();
  8801. st_particleSystemNeedsStopping = FALSE;
  8802. }
  8803. st_particleSystem = TheParticleSystemManager->createParticleSystem(pTemp);
  8804. if( st_particleSystem )
  8805. {
  8806. if( st_particleSystem->isSystemForever() )
  8807. st_particleSystemNeedsStopping = TRUE;// Only infinite lifetime systems need to be stopped.
  8808. // You can't stop others, because you can't know if they have deleted themselves. That used
  8809. // to be a tiny memory overwrite, now it is a crash since destroy() now has a function call.
  8810. ParticleSystemTemplate *parentTemp = TheParticleSystemManager->findParentTemplate(pTemp->getName(), 0);
  8811. if (parentTemp) {
  8812. ParticleSystem *parentSystem = NULL;
  8813. parentSystem = TheParticleSystemManager->createParticleSystem(parentTemp);
  8814. if (parentSystem) {
  8815. ParticleSystem::mergeRelatedParticleSystems(parentSystem, st_particleSystem, true);
  8816. parentSystem->stop();
  8817. parentSystem->destroy();
  8818. }
  8819. }
  8820. Coord3D pos;
  8821. pos.x = pos.y = 50 * MAP_XY_FACTOR;
  8822. pos.z = TheTerrainLogic->getGroundHeight(pos.x, pos.y) + 5 * MAP_XY_FACTOR;
  8823. st_particleSystem->setPosition(&pos);
  8824. }
  8825. }
  8826. }
  8827. static void _reloadParticleSystemFromINI( AsciiString particleSystemName )
  8828. {
  8829. if (!st_ParticleDLL || particleSystemName.isEmpty()) {
  8830. return;
  8831. }
  8832. // Here's what we're doing
  8833. // Find the entry in Data\\INI\\ParticleSystem.ini
  8834. // put that whole entry into a temp file
  8835. // force the INI to reload with INI_LOAD_OVERWRITE
  8836. // force the particle system editor to recognize that the system has changed without its consent.
  8837. static char linebuff[INI_MAX_CHARS_PER_LINE + 1];
  8838. linebuff[0] = 0;
  8839. // save the old file
  8840. File *iniFile = TheFileSystem->openFile("Data\\INI\\ParticleSystem.ini", File::READ | File::TEXT);
  8841. File *outTempINI = NULL;
  8842. if (!iniFile) {
  8843. return;
  8844. }
  8845. try {
  8846. // find the entry
  8847. while (!((iniFile->eof()) || INI::isDeclarationOfType("ParticleSystem", particleSystemName, linebuff))) {
  8848. iniFile->nextLine(linebuff, INI_MAX_CHARS_PER_LINE);
  8849. }
  8850. { // copy it to a temp file
  8851. if (iniFile->eof()) {
  8852. throw 0;
  8853. }
  8854. outTempINI = TheFileSystem->openFile("temporary.ini", File::WRITE | File::TEXT);
  8855. if (!outTempINI) {
  8856. throw 0;
  8857. }
  8858. while (!(iniFile->eof() || INI::isEndOfBlock(linebuff)) ) {
  8859. outTempINI->write(linebuff, strlen(linebuff));
  8860. iniFile->nextLine(linebuff, INI_MAX_CHARS_PER_LINE);
  8861. }
  8862. if (iniFile->eof()) {
  8863. throw 1;
  8864. }
  8865. // write out the closing "END"
  8866. outTempINI->write(linebuff, strlen(linebuff));
  8867. outTempINI->close();
  8868. outTempINI = NULL;
  8869. }
  8870. // force the current system to stop.
  8871. if (st_particleSystemNeedsStopping)
  8872. {
  8873. st_particleSystem->stop();
  8874. st_particleSystem->destroy();
  8875. st_particleSystemNeedsStopping = FALSE;
  8876. }
  8877. // reload that entry
  8878. INI ini;
  8879. ini.load("temporary.ini", INI_LOAD_OVERWRITE, NULL);
  8880. // delete the file
  8881. // unlink("temporary.ini");
  8882. // force the particle system to update itself
  8883. ParticleSystemTemplate *pTemp = const_cast<ParticleSystemTemplate*>(TheParticleSystemManager->findTemplate(particleSystemName));
  8884. _updateAsciiStringParmsFromSystem(pTemp);
  8885. _updatePanelParameters(pTemp);
  8886. } catch (int why) {
  8887. switch(why)
  8888. {
  8889. case 2:
  8890. case 1: if (outTempINI) { outTempINI->close(); }
  8891. case 0: if (iniFile) { iniFile->close(); }
  8892. }
  8893. }
  8894. }
  8895. static int _getNewCurrentParticleCap( void )
  8896. {
  8897. typedef int (*funcptr)( void );
  8898. if (!st_ParticleDLL) {
  8899. return -1;
  8900. }
  8901. FARPROC proc;
  8902. proc = GetProcAddress(st_ParticleDLL, "GetNewParticleCap");
  8903. if (!proc) {
  8904. return -1;
  8905. }
  8906. return ((funcptr)proc)();
  8907. }
  8908. static void _updateCurrentParticleCap( void )
  8909. {
  8910. typedef void (*funcptr)( int );
  8911. if (!st_ParticleDLL) {
  8912. return;
  8913. }
  8914. FARPROC proc;
  8915. proc = GetProcAddress(st_ParticleDLL, "UpdateCurrentParticleCap");
  8916. if (!proc) {
  8917. return;
  8918. }
  8919. ((funcptr)proc)(TheGlobalData->m_maxParticleCount);
  8920. }
  8921. static void _updateCurrentParticleCount( void )
  8922. {
  8923. typedef void (*funcptr)( int );
  8924. if (!st_ParticleDLL) {
  8925. return;
  8926. }
  8927. FARPROC proc;
  8928. proc = GetProcAddress(st_ParticleDLL, "UpdateCurrentNumParticles");
  8929. if (!proc) {
  8930. return;
  8931. }
  8932. ((funcptr)proc)(TheParticleSystemManager->getParticleCount());
  8933. }
  8934. static void _reloadTextures( void )
  8935. {
  8936. // Need no interaction with the particle editor now.
  8937. ReloadAllTextures();
  8938. }
  8939. #ifdef DO_VTUNE_STUFF
  8940. static void _initVTune()
  8941. {
  8942. // always try loading it, even if -vtune wasn't specified.
  8943. st_vTuneDLL = ::LoadLibrary("vtuneapi.dll");
  8944. // nope, not here...
  8945. //DEBUG_ASSERTCRASH(st_vTuneDLL != NULL, "VTuneAPI DLL not found!"));
  8946. if (st_vTuneDLL)
  8947. {
  8948. VTPause = (VTProc)::GetProcAddress(st_vTuneDLL, "VTPause");
  8949. VTResume = (VTProc)::GetProcAddress(st_vTuneDLL, "VTResume");
  8950. DEBUG_ASSERTCRASH(VTPause != NULL && VTResume != NULL, ("VTuneAPI procs not found!\n"));
  8951. }
  8952. else
  8953. {
  8954. VTPause = NULL;
  8955. VTResume = NULL;
  8956. }
  8957. if (TheGlobalData->m_vTune)
  8958. {
  8959. // if -vtune was specified, start it paused.
  8960. st_EnableVTune = false;
  8961. if (VTPause)
  8962. VTPause();
  8963. // only complain about it being missing if they were expecting it to be present
  8964. DEBUG_ASSERTCRASH(st_vTuneDLL != NULL, ("VTuneAPI DLL not found!\n"));
  8965. }
  8966. else
  8967. {
  8968. // otherwise enable it.
  8969. st_EnableVTune = true;
  8970. if (VTResume)
  8971. VTResume();
  8972. }
  8973. }
  8974. static void _updateVTune()
  8975. {
  8976. if (!st_vTuneDLL)
  8977. return;
  8978. if (st_EnableVTune)
  8979. {
  8980. if (VTResume)
  8981. VTResume();
  8982. }
  8983. else
  8984. {
  8985. if (VTPause)
  8986. VTPause();
  8987. }
  8988. }
  8989. static void _cleanUpVTune()
  8990. {
  8991. if (st_vTuneDLL)
  8992. {
  8993. FreeLibrary(st_vTuneDLL);
  8994. }
  8995. st_vTuneDLL = NULL;
  8996. VTPause = NULL;
  8997. VTResume = NULL;
  8998. }
  8999. #endif // VTUNE